aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesús <heckyel@hyperbola.info>2021-05-22 17:05:39 -0500
committerJesús <heckyel@hyperbola.info>2021-05-22 17:05:39 -0500
commitb3abec81e14b583400eebb120de8e5c4b7ca1da2 (patch)
treeace867440dbf8d26b082c9730a52bb883eb19d90
parente44647f1064c994237f6266b9b53b49a0d34db7e (diff)
downloadyt-local-b3abec81e14b583400eebb120de8e5c4b7ca1da2.tar.lz
yt-local-b3abec81e14b583400eebb120de8e5c4b7ca1da2.tar.xz
yt-local-b3abec81e14b583400eebb120de8e5c4b7ca1da2.zip
Add plyr as main player
Also plyr supports switch quality
-rw-r--r--youtube/static/js/plyr-start.js23
-rw-r--r--youtube/static/modules/plyr/blank.webmbin0 -> 594 bytes
-rw-r--r--youtube/static/modules/plyr/plyr.css1
-rw-r--r--youtube/static/modules/plyr/plyr.js9320
-rw-r--r--youtube/static/modules/plyr/plyr.min.js4
-rw-r--r--youtube/static/modules/plyr/plyr.min.js.map1
-rw-r--r--youtube/static/modules/plyr/plyr.min.mjs3
-rw-r--r--youtube/static/modules/plyr/plyr.min.mjs.map1
-rw-r--r--youtube/static/modules/plyr/plyr.mjs9312
-rw-r--r--youtube/static/modules/plyr/plyr.polyfilled.js15761
-rw-r--r--youtube/static/modules/plyr/plyr.polyfilled.min.js4
-rw-r--r--youtube/static/modules/plyr/plyr.polyfilled.min.js.map1
-rw-r--r--youtube/static/modules/plyr/plyr.polyfilled.min.mjs3
-rw-r--r--youtube/static/modules/plyr/plyr.polyfilled.min.mjs.map1
-rw-r--r--youtube/static/modules/plyr/plyr.polyfilled.mjs15753
-rw-r--r--youtube/static/modules/plyr/plyr.svg1
-rw-r--r--youtube/static/watch.css14
-rw-r--r--youtube/templates/licenses.html5
-rw-r--r--youtube/templates/watch.html11
19 files changed, 50218 insertions, 1 deletions
diff --git a/youtube/static/js/plyr-start.js b/youtube/static/js/plyr-start.js
new file mode 100644
index 0000000..aae3002
--- /dev/null
+++ b/youtube/static/js/plyr-start.js
@@ -0,0 +1,23 @@
+// @license magnet:?xt=urn:btih:1f739d935676111cfff4b4693e3816e664797050&dn=gpl-3.0.txt GPL-v3-or-Later
+const player = new Plyr(document.getElementById('js-video-player'), {
+ disableContextMenu: false,
+ captions: {
+ active: true,
+ language: 'en'
+ },
+ controls: [
+ 'play-large',
+ 'play',
+ 'progress',
+ 'current-time',
+ 'mute',
+ 'volume',
+ 'captions',
+ 'settings',
+ 'fullscreen'
+ ],
+ iconUrl: "/youtube.com/static/modules/plyr/plyr.svg",
+ blankVideo: "/youtube.com/static/modules/plyr/blank.webm",
+ debug: false
+});
+// @license-end
diff --git a/youtube/static/modules/plyr/blank.webm b/youtube/static/modules/plyr/blank.webm
new file mode 100644
index 0000000..6ec17ef
--- /dev/null
+++ b/youtube/static/modules/plyr/blank.webm
Binary files differ
diff --git a/youtube/static/modules/plyr/plyr.css b/youtube/static/modules/plyr/plyr.css
new file mode 100644
index 0000000..7d98f20
--- /dev/null
+++ b/youtube/static/modules/plyr/plyr.css
@@ -0,0 +1 @@
+@keyframes plyr-progress{to{background-position:25px 0;background-position:var(--plyr-progress-loading-size,25px) 0}}@keyframes plyr-popup{0%{opacity:.5;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}@keyframes plyr-fade-in{from{opacity:0}to{opacity:1}}.plyr{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;align-items:center;direction:ltr;display:flex;flex-direction:column;font-family:inherit;font-family:var(--plyr-font-family,inherit);font-variant-numeric:tabular-nums;font-weight:400;font-weight:var(--plyr-font-weight-regular,400);height:100%;line-height:1.7;line-height:var(--plyr-line-height,1.7);max-width:100%;min-width:200px;position:relative;text-shadow:none;transition:box-shadow .3s ease;z-index:0}.plyr audio,.plyr iframe,.plyr video{display:block;height:100%;width:100%}.plyr button{font:inherit;line-height:inherit;width:auto}.plyr:focus{outline:0}.plyr--full-ui{box-sizing:border-box}.plyr--full-ui *,.plyr--full-ui ::after,.plyr--full-ui ::before{box-sizing:inherit}.plyr--full-ui a,.plyr--full-ui button,.plyr--full-ui input,.plyr--full-ui label{touch-action:manipulation}.plyr__badge{background:#4a5464;background:var(--plyr-badge-background,#4a5464);border-radius:2px;border-radius:var(--plyr-badge-border-radius,2px);color:#fff;color:var(--plyr-badge-text-color,#fff);font-size:9px;font-size:var(--plyr-font-size-badge,9px);line-height:1;padding:3px 4px}.plyr--full-ui ::-webkit-media-text-track-container{display:none}.plyr__captions{animation:plyr-fade-in .3s ease;bottom:0;display:none;font-size:13px;font-size:var(--plyr-font-size-small,13px);left:0;padding:10px;padding:var(--plyr-control-spacing,10px);position:absolute;text-align:center;transition:transform .4s ease-in-out;width:100%}.plyr__captions span:empty{display:none}@media (min-width:480px){.plyr__captions{font-size:15px;font-size:var(--plyr-font-size-base,15px);padding:calc(10px * 2);padding:calc(var(--plyr-control-spacing,10px) * 2)}}@media (min-width:768px){.plyr__captions{font-size:18px;font-size:var(--plyr-font-size-large,18px)}}.plyr--captions-active .plyr__captions{display:block}.plyr:not(.plyr--hide-controls) .plyr__controls:not(:empty)~.plyr__captions{transform:translateY(calc(10px * -4));transform:translateY(calc(var(--plyr-control-spacing,10px) * -4))}.plyr__caption{background:rgba(0,0,0,.8);background:var(--plyr-captions-background,rgba(0,0,0,.8));border-radius:2px;-webkit-box-decoration-break:clone;box-decoration-break:clone;color:#fff;color:var(--plyr-captions-text-color,#fff);line-height:185%;padding:.2em .5em;white-space:pre-wrap}.plyr__caption div{display:inline}.plyr__control{background:0 0;border:0;border-radius:3px;border-radius:var(--plyr-control-radius,3px);color:inherit;cursor:pointer;flex-shrink:0;overflow:visible;padding:calc(10px * .7);padding:calc(var(--plyr-control-spacing,10px) * .7);position:relative;transition:all .3s ease}.plyr__control svg{display:block;fill:currentColor;height:18px;height:var(--plyr-control-icon-size,18px);pointer-events:none;width:18px;width:var(--plyr-control-icon-size,18px)}.plyr__control:focus{outline:0}.plyr__control.plyr__tab-focus{outline-color:#00b3ff;outline-color:var(--plyr-tab-focus-color,var(--plyr-color-main,var(--plyr-color-main,#00b3ff)));outline-offset:2px;outline-style:dotted;outline-width:3px}a.plyr__control{text-decoration:none}a.plyr__control::after,a.plyr__control::before{display:none}.plyr__control.plyr__control--pressed .icon--not-pressed,.plyr__control.plyr__control--pressed .label--not-pressed,.plyr__control:not(.plyr__control--pressed) .icon--pressed,.plyr__control:not(.plyr__control--pressed) .label--pressed{display:none}.plyr--full-ui ::-webkit-media-controls{display:none}.plyr__controls{align-items:center;display:flex;justify-content:flex-end;text-align:center}.plyr__controls .plyr__progress__container{flex:1;min-width:0}.plyr__controls .plyr__controls__item{margin-left:calc(10px / 4);margin-left:calc(var(--plyr-control-spacing,10px)/ 4)}.plyr__controls .plyr__controls__item:first-child{margin-left:0;margin-right:auto}.plyr__controls .plyr__controls__item.plyr__progress__container{padding-left:calc(10px / 4);padding-left:calc(var(--plyr-control-spacing,10px)/ 4)}.plyr__controls .plyr__controls__item.plyr__time{padding:0 calc(10px / 2);padding:0 calc(var(--plyr-control-spacing,10px)/ 2)}.plyr__controls .plyr__controls__item.plyr__progress__container:first-child,.plyr__controls .plyr__controls__item.plyr__time+.plyr__time,.plyr__controls .plyr__controls__item.plyr__time:first-child{padding-left:0}.plyr__controls:empty{display:none}.plyr [data-plyr=airplay],.plyr [data-plyr=captions],.plyr [data-plyr=fullscreen],.plyr [data-plyr=pip]{display:none}.plyr--airplay-supported [data-plyr=airplay],.plyr--captions-enabled [data-plyr=captions],.plyr--fullscreen-enabled [data-plyr=fullscreen],.plyr--pip-supported [data-plyr=pip]{display:inline-block}.plyr__menu{display:flex;position:relative}.plyr__menu .plyr__control svg{transition:transform .3s ease}.plyr__menu .plyr__control[aria-expanded=true] svg{transform:rotate(90deg)}.plyr__menu .plyr__control[aria-expanded=true] .plyr__tooltip{display:none}.plyr__menu__container{animation:plyr-popup .2s ease;background:rgba(255,255,255,.9);background:var(--plyr-menu-background,rgba(255,255,255,.9));border-radius:4px;bottom:100%;box-shadow:0 1px 2px rgba(0,0,0,.15);box-shadow:var(--plyr-menu-shadow,0 1px 2px rgba(0,0,0,.15));color:#4a5464;color:var(--plyr-menu-color,#4a5464);font-size:15px;font-size:var(--plyr-font-size-base,15px);margin-bottom:10px;position:absolute;right:-3px;text-align:left;white-space:nowrap;z-index:3}.plyr__menu__container>div{overflow:hidden;transition:height .35s cubic-bezier(.4,0,.2,1),width .35s cubic-bezier(.4,0,.2,1)}.plyr__menu__container::after{border:4px solid transparent;border:var(--plyr-menu-arrow-size,4px) solid transparent;border-top-color:rgba(255,255,255,.9);border-top-color:var(--plyr-menu-background,rgba(255,255,255,.9));content:'';height:0;position:absolute;right:calc(((18px / 2) + calc(10px * .7)) - (4px / 2));right:calc(((var(--plyr-control-icon-size,18px)/ 2) + calc(var(--plyr-control-spacing,10px) * .7)) - (var(--plyr-menu-arrow-size,4px)/ 2));top:100%;width:0}.plyr__menu__container [role=menu]{padding:calc(10px * .7);padding:calc(var(--plyr-control-spacing,10px) * .7)}.plyr__menu__container [role=menucaptions]{padding:calc(10px * .7);padding:calc(var(--plyr-control-spacing,10px) * .7);max-height:320px;overflow-y:auto}.plyr__menu__container [role=menuitem],.plyr__menu__container [role=menuitemradio]{margin-top:2px}.plyr__menu__container [role=menuitem]:first-child,.plyr__menu__container [role=menuitemradio]:first-child{margin-top:0}.plyr__menu__container .plyr__control{align-items:center;color:#4a5464;color:var(--plyr-menu-color,#4a5464);display:flex;font-size:13px;font-size:var(--plyr-font-size-menu,var(--plyr-font-size-small,13px));padding-bottom:calc(calc(10px * .7)/ 1.5);padding-bottom:calc(calc(var(--plyr-control-spacing,10px) * .7)/ 1.5);padding-left:calc(calc(10px * .7) * 1.5);padding-left:calc(calc(var(--plyr-control-spacing,10px) * .7) * 1.5);padding-right:calc(calc(10px * .7) * 1.5);padding-right:calc(calc(var(--plyr-control-spacing,10px) * .7) * 1.5);padding-top:calc(calc(10px * .7)/ 1.5);padding-top:calc(calc(var(--plyr-control-spacing,10px) * .7)/ 1.5);-webkit-user-select:none;-ms-user-select:none;user-select:none;width:100%}.plyr__menu__container .plyr__control>span{align-items:inherit;display:flex;width:100%}.plyr__menu__container .plyr__control::after{border:4px solid transparent;border:var(--plyr-menu-item-arrow-size,4px) solid transparent;content:'';position:absolute;top:50%;transform:translateY(-50%)}.plyr__menu__container .plyr__control--forward{padding-right:calc(calc(10px * .7) * 4);padding-right:calc(calc(var(--plyr-control-spacing,10px) * .7) * 4)}.plyr__menu__container .plyr__control--forward::after{border-left-color:#728197;border-left-color:var(--plyr-menu-arrow-color,#728197);right:calc((calc(10px * .7) * 1.5) - 4px);right:calc((calc(var(--plyr-control-spacing,10px) * .7) * 1.5) - var(--plyr-menu-item-arrow-size,4px))}.plyr__menu__container .plyr__control--forward.plyr__tab-focus::after,.plyr__menu__container .plyr__control--forward:hover::after{border-left-color:currentColor}.plyr__menu__container .plyr__control--back{font-weight:400;font-weight:var(--plyr-font-weight-regular,400);margin:calc(10px * .7);margin:calc(var(--plyr-control-spacing,10px) * .7);margin-bottom:calc(calc(10px * .7)/ 2);margin-bottom:calc(calc(var(--plyr-control-spacing,10px) * .7)/ 2);padding-left:calc(calc(10px * .7) * 4);padding-left:calc(calc(var(--plyr-control-spacing,10px) * .7) * 4);position:relative;width:calc(100% - (calc(10px * .7) * 2));width:calc(100% - (calc(var(--plyr-control-spacing,10px) * .7) * 2))}.plyr__menu__container .plyr__control--back::after{border-right-color:#728197;border-right-color:var(--plyr-menu-arrow-color,#728197);left:calc((calc(10px * .7) * 1.5) - 4px);left:calc((calc(var(--plyr-control-spacing,10px) * .7) * 1.5) - var(--plyr-menu-item-arrow-size,4px))}.plyr__menu__container .plyr__control--back::before{background:#dcdfe5;background:var(--plyr-menu-back-border-color,#dcdfe5);box-shadow:0 1px 0 #fff;box-shadow:0 1px 0 var(--plyr-menu-back-border-shadow-color,#fff);content:'';height:1px;left:0;margin-top:calc(calc(10px * .7)/ 2);margin-top:calc(calc(var(--plyr-control-spacing,10px) * .7)/ 2);overflow:hidden;position:absolute;right:0;top:100%}.plyr__menu__container .plyr__control--back.plyr__tab-focus::after,.plyr__menu__container .plyr__control--back:hover::after{border-right-color:currentColor}.plyr__menu__container .plyr__control[role=menuitemradio]{padding-left:calc(10px * .7);padding-left:calc(var(--plyr-control-spacing,10px) * .7)}.plyr__menu__container .plyr__control[role=menuitemradio]::after,.plyr__menu__container .plyr__control[role=menuitemradio]::before{border-radius:100%}.plyr__menu__container .plyr__control[role=menuitemradio]::before{background:rgba(0,0,0,.1);content:'';display:block;flex-shrink:0;height:16px;margin-right:10px;margin-right:var(--plyr-control-spacing,10px);transition:all .3s ease;width:16px}.plyr__menu__container .plyr__control[role=menuitemradio]::after{background:#fff;border:0;height:6px;left:12px;opacity:0;top:50%;transform:translateY(-50%) scale(0);transition:transform .3s ease,opacity .3s ease;width:6px}.plyr__menu__container .plyr__control[role=menuitemradio][aria-checked=true]::before{background:#00b3ff;background:var(--plyr-control-toggle-checked-background,var(--plyr-color-main,var(--plyr-color-main,#00b3ff)))}.plyr__menu__container .plyr__control[role=menuitemradio][aria-checked=true]::after{opacity:1;transform:translateY(-50%) scale(1)}.plyr__menu__container .plyr__control[role=menuitemradio].plyr__tab-focus::before,.plyr__menu__container .plyr__control[role=menuitemradio]:hover::before{background:rgba(35,40,47,.1)}.plyr__menu__container .plyr__menu__value{align-items:center;display:flex;margin-left:auto;margin-right:calc((calc(10px * .7) - 2) * -1);margin-right:calc((calc(var(--plyr-control-spacing,10px) * .7) - 2) * -1);overflow:hidden;padding-left:calc(calc(10px * .7) * 3.5);padding-left:calc(calc(var(--plyr-control-spacing,10px) * .7) * 3.5);pointer-events:none}.plyr--full-ui input[type=range]{-webkit-appearance:none;background:0 0;border:0;border-radius:calc(13px * 2);border-radius:calc(var(--plyr-range-thumb-height,13px) * 2);color:#00b3ff;color:var(--plyr-range-fill-background,var(--plyr-color-main,var(--plyr-color-main,#00b3ff)));display:block;height:calc((3px * 2) + 13px);height:calc((var(--plyr-range-thumb-active-shadow-width,3px) * 2) + var(--plyr-range-thumb-height,13px));margin:0;padding:0;transition:box-shadow .3s ease;width:100%}.plyr--full-ui input[type=range]::-webkit-slider-runnable-track{background:0 0;border:0;border-radius:calc(5px / 2);border-radius:calc(var(--plyr-range-track-height,5px)/ 2);height:5px;height:var(--plyr-range-track-height,5px);-webkit-transition:box-shadow .3s ease;transition:box-shadow .3s ease;-webkit-user-select:none;user-select:none;background-image:linear-gradient(to right,currentColor 0,transparent 0);background-image:linear-gradient(to right,currentColor var(--value,0),transparent var(--value,0))}.plyr--full-ui input[type=range]::-webkit-slider-thumb{background:#fff;background:var(--plyr-range-thumb-background,#fff);border:0;border-radius:100%;box-shadow:0 1px 1px rgba(35,40,47,.15),0 0 0 1px rgba(35,40,47,.2);box-shadow:var(--plyr-range-thumb-shadow,0 1px 1px rgba(35,40,47,.15),0 0 0 1px rgba(35,40,47,.2));height:13px;height:var(--plyr-range-thumb-height,13px);position:relative;-webkit-transition:all .2s ease;transition:all .2s ease;width:13px;width:var(--plyr-range-thumb-height,13px);-webkit-appearance:none;margin-top:calc(((13px - 5px)/ 2) * -1);margin-top:calc(((var(--plyr-range-thumb-height,13px) - var(--plyr-range-track-height,5px))/ 2) * -1)}.plyr--full-ui input[type=range]::-moz-range-track{background:0 0;border:0;border-radius:calc(5px / 2);border-radius:calc(var(--plyr-range-track-height,5px)/ 2);height:5px;height:var(--plyr-range-track-height,5px);-moz-transition:box-shadow .3s ease;transition:box-shadow .3s ease;user-select:none}.plyr--full-ui input[type=range]::-moz-range-thumb{background:#fff;background:var(--plyr-range-thumb-background,#fff);border:0;border-radius:100%;box-shadow:0 1px 1px rgba(35,40,47,.15),0 0 0 1px rgba(35,40,47,.2);box-shadow:var(--plyr-range-thumb-shadow,0 1px 1px rgba(35,40,47,.15),0 0 0 1px rgba(35,40,47,.2));height:13px;height:var(--plyr-range-thumb-height,13px);position:relative;-moz-transition:all .2s ease;transition:all .2s ease;width:13px;width:var(--plyr-range-thumb-height,13px)}.plyr--full-ui input[type=range]::-moz-range-progress{background:currentColor;border-radius:calc(5px / 2);border-radius:calc(var(--plyr-range-track-height,5px)/ 2);height:5px;height:var(--plyr-range-track-height,5px)}.plyr--full-ui input[type=range]::-ms-track{background:0 0;border:0;border-radius:calc(5px / 2);border-radius:calc(var(--plyr-range-track-height,5px)/ 2);height:5px;height:var(--plyr-range-track-height,5px);-ms-transition:box-shadow .3s ease;transition:box-shadow .3s ease;-ms-user-select:none;user-select:none;color:transparent}.plyr--full-ui input[type=range]::-ms-fill-upper{background:0 0;border:0;border-radius:calc(5px / 2);border-radius:calc(var(--plyr-range-track-height,5px)/ 2);height:5px;height:var(--plyr-range-track-height,5px);-ms-transition:box-shadow .3s ease;transition:box-shadow .3s ease;-ms-user-select:none;user-select:none}.plyr--full-ui input[type=range]::-ms-fill-lower{background:0 0;border:0;border-radius:calc(5px / 2);border-radius:calc(var(--plyr-range-track-height,5px)/ 2);height:5px;height:var(--plyr-range-track-height,5px);-ms-transition:box-shadow .3s ease;transition:box-shadow .3s ease;-ms-user-select:none;user-select:none;background:currentColor}.plyr--full-ui input[type=range]::-ms-thumb{background:#fff;background:var(--plyr-range-thumb-background,#fff);border:0;border-radius:100%;box-shadow:0 1px 1px rgba(35,40,47,.15),0 0 0 1px rgba(35,40,47,.2);box-shadow:var(--plyr-range-thumb-shadow,0 1px 1px rgba(35,40,47,.15),0 0 0 1px rgba(35,40,47,.2));height:13px;height:var(--plyr-range-thumb-height,13px);position:relative;-ms-transition:all .2s ease;transition:all .2s ease;width:13px;width:var(--plyr-range-thumb-height,13px);margin-top:0}.plyr--full-ui input[type=range]::-ms-tooltip{display:none}.plyr--full-ui input[type=range]:focus{outline:0}.plyr--full-ui input[type=range]::-moz-focus-outer{border:0}.plyr--full-ui input[type=range].plyr__tab-focus::-webkit-slider-runnable-track{outline-color:#00b3ff;outline-color:var(--plyr-tab-focus-color,var(--plyr-color-main,var(--plyr-color-main,#00b3ff)));outline-offset:2px;outline-style:dotted;outline-width:3px}.plyr--full-ui input[type=range].plyr__tab-focus::-moz-range-track{outline-color:#00b3ff;outline-color:var(--plyr-tab-focus-color,var(--plyr-color-main,var(--plyr-color-main,#00b3ff)));outline-offset:2px;outline-style:dotted;outline-width:3px}.plyr--full-ui input[type=range].plyr__tab-focus::-ms-track{outline-color:#00b3ff;outline-color:var(--plyr-tab-focus-color,var(--plyr-color-main,var(--plyr-color-main,#00b3ff)));outline-offset:2px;outline-style:dotted;outline-width:3px}.plyr__poster{background-color:#000;background-position:50% 50%;background-repeat:no-repeat;background-size:contain;height:100%;left:0;opacity:0;position:absolute;top:0;transition:opacity .2s ease;width:100%;z-index:1}.plyr--stopped.plyr__poster-enabled .plyr__poster{opacity:1}.plyr__time{font-size:13px;font-size:var(--plyr-font-size-time,var(--plyr-font-size-small,13px))}.plyr__time+.plyr__time::before{content:'\2044';margin-right:10px;margin-right:var(--plyr-control-spacing,10px)}@media (max-width:calc(768px - 1)){.plyr__time+.plyr__time{display:none}}.plyr__tooltip{background:rgba(255,255,255,.9);background:var(--plyr-tooltip-background,rgba(255,255,255,.9));border-radius:3px;border-radius:var(--plyr-tooltip-radius,3px);bottom:100%;box-shadow:0 1px 2px rgba(0,0,0,.15);box-shadow:var(--plyr-tooltip-shadow,0 1px 2px rgba(0,0,0,.15));color:#4a5464;color:var(--plyr-tooltip-color,#4a5464);font-size:13px;font-size:var(--plyr-font-size-small,13px);font-weight:400;font-weight:var(--plyr-font-weight-regular,400);left:50%;line-height:1.3;margin-bottom:calc(calc(10px / 2) * 2);margin-bottom:calc(calc(var(--plyr-control-spacing,10px)/ 2) * 2);opacity:0;padding:calc(10px / 2) calc(calc(10px / 2) * 1.5);padding:calc(var(--plyr-control-spacing,10px)/ 2) calc(calc(var(--plyr-control-spacing,10px)/ 2) * 1.5);pointer-events:none;position:absolute;transform:translate(-50%,10px) scale(.8);transform-origin:50% 100%;transition:transform .2s .1s ease,opacity .2s .1s ease;white-space:nowrap;z-index:2}.plyr__tooltip::before{border-left:4px solid transparent;border-left:var(--plyr-tooltip-arrow-size,4px) solid transparent;border-right:4px solid transparent;border-right:var(--plyr-tooltip-arrow-size,4px) solid transparent;border-top:4px solid rgba(255,255,255,.9);border-top:var(--plyr-tooltip-arrow-size,4px) solid var(--plyr-tooltip-background,rgba(255,255,255,.9));bottom:calc(4px * -1);bottom:calc(var(--plyr-tooltip-arrow-size,4px) * -1);content:'';height:0;left:50%;position:absolute;transform:translateX(-50%);width:0;z-index:2}.plyr .plyr__control.plyr__tab-focus .plyr__tooltip,.plyr .plyr__control:hover .plyr__tooltip,.plyr__tooltip--visible{opacity:1;transform:translate(-50%,0) scale(1)}.plyr .plyr__control:hover .plyr__tooltip{z-index:3}.plyr__controls>.plyr__control:first-child .plyr__tooltip,.plyr__controls>.plyr__control:first-child+.plyr__control .plyr__tooltip{left:0;transform:translate(0,10px) scale(.8);transform-origin:0 100%}.plyr__controls>.plyr__control:first-child .plyr__tooltip::before,.plyr__controls>.plyr__control:first-child+.plyr__control .plyr__tooltip::before{left:calc((18px / 2) + calc(10px * .7));left:calc((var(--plyr-control-icon-size,18px)/ 2) + calc(var(--plyr-control-spacing,10px) * .7))}.plyr__controls>.plyr__control:last-child .plyr__tooltip{left:auto;right:0;transform:translate(0,10px) scale(.8);transform-origin:100% 100%}.plyr__controls>.plyr__control:last-child .plyr__tooltip::before{left:auto;right:calc((18px / 2) + calc(10px * .7));right:calc((var(--plyr-control-icon-size,18px)/ 2) + calc(var(--plyr-control-spacing,10px) * .7));transform:translateX(50%)}.plyr__controls>.plyr__control:first-child .plyr__tooltip--visible,.plyr__controls>.plyr__control:first-child+.plyr__control .plyr__tooltip--visible,.plyr__controls>.plyr__control:first-child+.plyr__control.plyr__tab-focus .plyr__tooltip,.plyr__controls>.plyr__control:first-child+.plyr__control:hover .plyr__tooltip,.plyr__controls>.plyr__control:first-child.plyr__tab-focus .plyr__tooltip,.plyr__controls>.plyr__control:first-child:hover .plyr__tooltip,.plyr__controls>.plyr__control:last-child .plyr__tooltip--visible,.plyr__controls>.plyr__control:last-child.plyr__tab-focus .plyr__tooltip,.plyr__controls>.plyr__control:last-child:hover .plyr__tooltip{transform:translate(0,0) scale(1)}.plyr__progress{left:calc(13px * .5);left:calc(var(--plyr-range-thumb-height,13px) * .5);margin-right:13px;margin-right:var(--plyr-range-thumb-height,13px);position:relative}.plyr__progress input[type=range],.plyr__progress__buffer{margin-left:calc(13px * -.5);margin-left:calc(var(--plyr-range-thumb-height,13px) * -.5);margin-right:calc(13px * -.5);margin-right:calc(var(--plyr-range-thumb-height,13px) * -.5);width:calc(100% + 13px);width:calc(100% + var(--plyr-range-thumb-height,13px))}.plyr__progress input[type=range]{position:relative;z-index:2}.plyr__progress .plyr__tooltip{font-size:13px;font-size:var(--plyr-font-size-time,var(--plyr-font-size-small,13px));left:0}.plyr__progress__buffer{-webkit-appearance:none;background:0 0;border:0;border-radius:100px;height:5px;height:var(--plyr-range-track-height,5px);left:0;margin-top:calc((5px / 2) * -1);margin-top:calc((var(--plyr-range-track-height,5px)/ 2) * -1);padding:0;position:absolute;top:50%}.plyr__progress__buffer::-webkit-progress-bar{background:0 0}.plyr__progress__buffer::-webkit-progress-value{background:currentColor;border-radius:100px;min-width:5px;min-width:var(--plyr-range-track-height,5px);-webkit-transition:width .2s ease;transition:width .2s ease}.plyr__progress__buffer::-moz-progress-bar{background:currentColor;border-radius:100px;min-width:5px;min-width:var(--plyr-range-track-height,5px);-moz-transition:width .2s ease;transition:width .2s ease}.plyr__progress__buffer::-ms-fill{border-radius:100px;-ms-transition:width .2s ease;transition:width .2s ease}.plyr--loading .plyr__progress__buffer{animation:plyr-progress 1s linear infinite;background-image:linear-gradient(-45deg,rgba(35,40,47,.6) 25%,transparent 25%,transparent 50%,rgba(35,40,47,.6) 50%,rgba(35,40,47,.6) 75%,transparent 75%,transparent);background-image:linear-gradient(-45deg,var(--plyr-progress-loading-background,rgba(35,40,47,.6)) 25%,transparent 25%,transparent 50%,var(--plyr-progress-loading-background,rgba(35,40,47,.6)) 50%,var(--plyr-progress-loading-background,rgba(35,40,47,.6)) 75%,transparent 75%,transparent);background-repeat:repeat-x;background-size:25px 25px;background-size:var(--plyr-progress-loading-size,25px) var(--plyr-progress-loading-size,25px);color:transparent}.plyr--video.plyr--loading .plyr__progress__buffer{background-color:rgba(255,255,255,.25);background-color:var(--plyr-video-progress-buffered-background,rgba(255,255,255,.25))}.plyr--audio.plyr--loading .plyr__progress__buffer{background-color:rgba(193,200,209,.6);background-color:var(--plyr-audio-progress-buffered-background,rgba(193,200,209,.6))}.plyr__volume{align-items:center;display:flex;max-width:110px;min-width:80px;position:relative;width:20%}.plyr__volume input[type=range]{margin-left:calc(10px / 2);margin-left:calc(var(--plyr-control-spacing,10px)/ 2);margin-right:calc(10px / 2);margin-right:calc(var(--plyr-control-spacing,10px)/ 2);position:relative;z-index:2}.plyr--is-ios .plyr__volume{min-width:0;width:auto}.plyr--audio{display:block}.plyr--audio .plyr__controls{background:#fff;background:var(--plyr-audio-controls-background,#fff);border-radius:inherit;color:#4a5464;color:var(--plyr-audio-control-color,#4a5464);padding:10px;padding:var(--plyr-control-spacing,10px)}.plyr--audio .plyr__control.plyr__tab-focus,.plyr--audio .plyr__control:hover,.plyr--audio .plyr__control[aria-expanded=true]{background:#00b3ff;background:var(--plyr-audio-control-background-hover,var(--plyr-color-main,var(--plyr-color-main,#00b3ff)));color:#fff;color:var(--plyr-audio-control-color-hover,#fff)}.plyr--full-ui.plyr--audio input[type=range]::-webkit-slider-runnable-track{background-color:rgba(193,200,209,.6);background-color:var(--plyr-audio-range-track-background,var(--plyr-audio-progress-buffered-background,rgba(193,200,209,.6)))}.plyr--full-ui.plyr--audio input[type=range]::-moz-range-track{background-color:rgba(193,200,209,.6);background-color:var(--plyr-audio-range-track-background,var(--plyr-audio-progress-buffered-background,rgba(193,200,209,.6)))}.plyr--full-ui.plyr--audio input[type=range]::-ms-track{background-color:rgba(193,200,209,.6);background-color:var(--plyr-audio-range-track-background,var(--plyr-audio-progress-buffered-background,rgba(193,200,209,.6)))}.plyr--full-ui.plyr--audio input[type=range]:active::-webkit-slider-thumb{box-shadow:0 1px 1px rgba(35,40,47,.15),0 0 0 1px rgba(35,40,47,.2),0 0 0 3px rgba(35,40,47,.1);box-shadow:var(--plyr-range-thumb-shadow,0 1px 1px rgba(35,40,47,.15),0 0 0 1px rgba(35,40,47,.2)),0 0 0 var(--plyr-range-thumb-active-shadow-width,3px) var(--plyr-audio-range-thumb-active-shadow-color,rgba(35,40,47,.1))}.plyr--full-ui.plyr--audio input[type=range]:active::-moz-range-thumb{box-shadow:0 1px 1px rgba(35,40,47,.15),0 0 0 1px rgba(35,40,47,.2),0 0 0 3px rgba(35,40,47,.1);box-shadow:var(--plyr-range-thumb-shadow,0 1px 1px rgba(35,40,47,.15),0 0 0 1px rgba(35,40,47,.2)),0 0 0 var(--plyr-range-thumb-active-shadow-width,3px) var(--plyr-audio-range-thumb-active-shadow-color,rgba(35,40,47,.1))}.plyr--full-ui.plyr--audio input[type=range]:active::-ms-thumb{box-shadow:0 1px 1px rgba(35,40,47,.15),0 0 0 1px rgba(35,40,47,.2),0 0 0 3px rgba(35,40,47,.1);box-shadow:var(--plyr-range-thumb-shadow,0 1px 1px rgba(35,40,47,.15),0 0 0 1px rgba(35,40,47,.2)),0 0 0 var(--plyr-range-thumb-active-shadow-width,3px) var(--plyr-audio-range-thumb-active-shadow-color,rgba(35,40,47,.1))}.plyr--audio .plyr__progress__buffer{color:rgba(193,200,209,.6);color:var(--plyr-audio-progress-buffered-background,rgba(193,200,209,.6))}.plyr--video{background:#000;overflow:hidden}.plyr--video.plyr--menu-open{overflow:visible}.plyr__video-wrapper{background:#000;height:100%;margin:auto;overflow:hidden;position:relative;width:100%}.plyr__video-embed,.plyr__video-wrapper--fixed-ratio{height:0;padding-bottom:56.25%}.plyr__video-embed iframe,.plyr__video-wrapper--fixed-ratio video{border:0;left:0;position:absolute;top:0}.plyr--full-ui .plyr__video-embed>.plyr__video-embed__container{padding-bottom:240%;position:relative;transform:translateY(-38.28125%)}.plyr--video .plyr__controls{background:linear-gradient(rgba(0,0,0,0),rgba(0,0,0,.75));background:var(--plyr-video-controls-background,linear-gradient(rgba(0,0,0,0),rgba(0,0,0,.75)));border-bottom-left-radius:inherit;border-bottom-right-radius:inherit;bottom:0;color:#fff;color:var(--plyr-video-control-color,#fff);left:0;padding:calc(10px / 2);padding:calc(var(--plyr-control-spacing,10px)/ 2);padding-top:calc(10px * 2);padding-top:calc(var(--plyr-control-spacing,10px) * 2);position:absolute;right:0;transition:opacity .4s ease-in-out,transform .4s ease-in-out;z-index:3}@media (min-width:480px){.plyr--video .plyr__controls{padding:10px;padding:var(--plyr-control-spacing,10px);padding-top:calc(10px * 3.5);padding-top:calc(var(--plyr-control-spacing,10px) * 3.5)}}.plyr--video.plyr--hide-controls .plyr__controls{opacity:0;pointer-events:none;transform:translateY(100%)}.plyr--video .plyr__control.plyr__tab-focus,.plyr--video .plyr__control:hover,.plyr--video .plyr__control[aria-expanded=true]{background:#00b3ff;background:var(--plyr-video-control-background-hover,var(--plyr-color-main,var(--plyr-color-main,#00b3ff)));color:#fff;color:var(--plyr-video-control-color-hover,#fff)}.plyr__control--overlaid{background:#00b3ff;background:var(--plyr-video-control-background-hover,var(--plyr-color-main,var(--plyr-color-main,#00b3ff)));border:0;border-radius:100%;color:#fff;color:var(--plyr-video-control-color,#fff);display:none;left:50%;opacity:.9;padding:calc(10px * 1.5);padding:calc(var(--plyr-control-spacing,10px) * 1.5);position:absolute;top:50%;transform:translate(-50%,-50%);transition:.3s;z-index:2}.plyr__control--overlaid svg{left:2px;position:relative}.plyr__control--overlaid:focus,.plyr__control--overlaid:hover{opacity:1}.plyr--playing .plyr__control--overlaid{opacity:0;visibility:hidden}.plyr--full-ui.plyr--video .plyr__control--overlaid{display:block}.plyr--full-ui.plyr--video input[type=range]::-webkit-slider-runnable-track{background-color:rgba(255,255,255,.25);background-color:var(--plyr-video-range-track-background,var(--plyr-video-progress-buffered-background,rgba(255,255,255,.25)))}.plyr--full-ui.plyr--video input[type=range]::-moz-range-track{background-color:rgba(255,255,255,.25);background-color:var(--plyr-video-range-track-background,var(--plyr-video-progress-buffered-background,rgba(255,255,255,.25)))}.plyr--full-ui.plyr--video input[type=range]::-ms-track{background-color:rgba(255,255,255,.25);background-color:var(--plyr-video-range-track-background,var(--plyr-video-progress-buffered-background,rgba(255,255,255,.25)))}.plyr--full-ui.plyr--video input[type=range]:active::-webkit-slider-thumb{box-shadow:0 1px 1px rgba(35,40,47,.15),0 0 0 1px rgba(35,40,47,.2),0 0 0 3px rgba(255,255,255,.5);box-shadow:var(--plyr-range-thumb-shadow,0 1px 1px rgba(35,40,47,.15),0 0 0 1px rgba(35,40,47,.2)),0 0 0 var(--plyr-range-thumb-active-shadow-width,3px) var(--plyr-audio-range-thumb-active-shadow-color,rgba(255,255,255,.5))}.plyr--full-ui.plyr--video input[type=range]:active::-moz-range-thumb{box-shadow:0 1px 1px rgba(35,40,47,.15),0 0 0 1px rgba(35,40,47,.2),0 0 0 3px rgba(255,255,255,.5);box-shadow:var(--plyr-range-thumb-shadow,0 1px 1px rgba(35,40,47,.15),0 0 0 1px rgba(35,40,47,.2)),0 0 0 var(--plyr-range-thumb-active-shadow-width,3px) var(--plyr-audio-range-thumb-active-shadow-color,rgba(255,255,255,.5))}.plyr--full-ui.plyr--video input[type=range]:active::-ms-thumb{box-shadow:0 1px 1px rgba(35,40,47,.15),0 0 0 1px rgba(35,40,47,.2),0 0 0 3px rgba(255,255,255,.5);box-shadow:var(--plyr-range-thumb-shadow,0 1px 1px rgba(35,40,47,.15),0 0 0 1px rgba(35,40,47,.2)),0 0 0 var(--plyr-range-thumb-active-shadow-width,3px) var(--plyr-audio-range-thumb-active-shadow-color,rgba(255,255,255,.5))}.plyr--video .plyr__progress__buffer{color:rgba(255,255,255,.25);color:var(--plyr-video-progress-buffered-background,rgba(255,255,255,.25))}.plyr:-webkit-full-screen{background:#000;border-radius:0!important;height:100%;margin:0;width:100%}.plyr:-ms-fullscreen{background:#000;border-radius:0!important;height:100%;margin:0;width:100%}.plyr:fullscreen{background:#000;border-radius:0!important;height:100%;margin:0;width:100%}.plyr:-webkit-full-screen video{height:100%}.plyr:-ms-fullscreen video{height:100%}.plyr:fullscreen video{height:100%}.plyr:-webkit-full-screen .plyr__video-wrapper{height:100%;position:static}.plyr:-ms-fullscreen .plyr__video-wrapper{height:100%;position:static}.plyr:fullscreen .plyr__video-wrapper{height:100%;position:static}.plyr:-webkit-full-screen.plyr--vimeo .plyr__video-wrapper{height:0;position:relative}.plyr:-ms-fullscreen.plyr--vimeo .plyr__video-wrapper{height:0;position:relative}.plyr:fullscreen.plyr--vimeo .plyr__video-wrapper{height:0;position:relative}.plyr:-webkit-full-screen .plyr__control .icon--exit-fullscreen{display:block}.plyr:-ms-fullscreen .plyr__control .icon--exit-fullscreen{display:block}.plyr:fullscreen .plyr__control .icon--exit-fullscreen{display:block}.plyr:-webkit-full-screen .plyr__control .icon--exit-fullscreen+svg{display:none}.plyr:-ms-fullscreen .plyr__control .icon--exit-fullscreen+svg{display:none}.plyr:fullscreen .plyr__control .icon--exit-fullscreen+svg{display:none}.plyr:-webkit-full-screen.plyr--hide-controls{cursor:none}.plyr:-ms-fullscreen.plyr--hide-controls{cursor:none}.plyr:fullscreen.plyr--hide-controls{cursor:none}@media (min-width:1024px){.plyr:-webkit-full-screen .plyr__captions{font-size:21px;font-size:var(--plyr-font-size-xlarge,21px)}.plyr:-ms-fullscreen .plyr__captions{font-size:21px;font-size:var(--plyr-font-size-xlarge,21px)}.plyr:fullscreen .plyr__captions{font-size:21px;font-size:var(--plyr-font-size-xlarge,21px)}}.plyr:-webkit-full-screen{background:#000;border-radius:0!important;height:100%;margin:0;width:100%}.plyr:-webkit-full-screen video{height:100%}.plyr:-webkit-full-screen .plyr__video-wrapper{height:100%;position:static}.plyr:-webkit-full-screen.plyr--vimeo .plyr__video-wrapper{height:0;position:relative}.plyr:-webkit-full-screen .plyr__control .icon--exit-fullscreen{display:block}.plyr:-webkit-full-screen .plyr__control .icon--exit-fullscreen+svg{display:none}.plyr:-webkit-full-screen.plyr--hide-controls{cursor:none}@media (min-width:1024px){.plyr:-webkit-full-screen .plyr__captions{font-size:21px;font-size:var(--plyr-font-size-xlarge,21px)}}.plyr:-moz-full-screen{background:#000;border-radius:0!important;height:100%;margin:0;width:100%}.plyr:-moz-full-screen video{height:100%}.plyr:-moz-full-screen .plyr__video-wrapper{height:100%;position:static}.plyr:-moz-full-screen.plyr--vimeo .plyr__video-wrapper{height:0;position:relative}.plyr:-moz-full-screen .plyr__control .icon--exit-fullscreen{display:block}.plyr:-moz-full-screen .plyr__control .icon--exit-fullscreen+svg{display:none}.plyr:-moz-full-screen.plyr--hide-controls{cursor:none}@media (min-width:1024px){.plyr:-moz-full-screen .plyr__captions{font-size:21px;font-size:var(--plyr-font-size-xlarge,21px)}}.plyr:-ms-fullscreen{background:#000;border-radius:0!important;height:100%;margin:0;width:100%}.plyr:-ms-fullscreen video{height:100%}.plyr:-ms-fullscreen .plyr__video-wrapper{height:100%;position:static}.plyr:-ms-fullscreen.plyr--vimeo .plyr__video-wrapper{height:0;position:relative}.plyr:-ms-fullscreen .plyr__control .icon--exit-fullscreen{display:block}.plyr:-ms-fullscreen .plyr__control .icon--exit-fullscreen+svg{display:none}.plyr:-ms-fullscreen.plyr--hide-controls{cursor:none}@media (min-width:1024px){.plyr:-ms-fullscreen .plyr__captions{font-size:21px;font-size:var(--plyr-font-size-xlarge,21px)}}.plyr--fullscreen-fallback{background:#000;border-radius:0!important;height:100%;margin:0;width:100%;bottom:0;display:block;left:0;position:fixed;right:0;top:0;z-index:10000000}.plyr--fullscreen-fallback video{height:100%}.plyr--fullscreen-fallback .plyr__video-wrapper{height:100%;position:static}.plyr--fullscreen-fallback.plyr--vimeo .plyr__video-wrapper{height:0;position:relative}.plyr--fullscreen-fallback .plyr__control .icon--exit-fullscreen{display:block}.plyr--fullscreen-fallback .plyr__control .icon--exit-fullscreen+svg{display:none}.plyr--fullscreen-fallback.plyr--hide-controls{cursor:none}@media (min-width:1024px){.plyr--fullscreen-fallback .plyr__captions{font-size:21px;font-size:var(--plyr-font-size-xlarge,21px)}}.plyr__ads{border-radius:inherit;bottom:0;cursor:pointer;left:0;overflow:hidden;position:absolute;right:0;top:0;z-index:-1}.plyr__ads>div,.plyr__ads>div iframe{height:100%;position:absolute;width:100%}.plyr__ads::after{background:#23282f;border-radius:2px;bottom:10px;bottom:var(--plyr-control-spacing,10px);color:#fff;content:attr(data-badge-text);font-size:11px;padding:2px 6px;pointer-events:none;position:absolute;right:10px;right:var(--plyr-control-spacing,10px);z-index:3}.plyr__ads::after:empty{display:none}.plyr__cues{background:currentColor;display:block;height:5px;height:var(--plyr-range-track-height,5px);left:0;margin:-var(--plyr-range-track-height,5px)/2 0 0;opacity:.8;position:absolute;top:50%;width:3px;z-index:3}.plyr__preview-thumb{background-color:rgba(255,255,255,.9);background-color:var(--plyr-tooltip-background,rgba(255,255,255,.9));border-radius:3px;bottom:100%;box-shadow:0 1px 2px rgba(0,0,0,.15);box-shadow:var(--plyr-tooltip-shadow,0 1px 2px rgba(0,0,0,.15));margin-bottom:calc(calc(10px / 2) * 2);margin-bottom:calc(calc(var(--plyr-control-spacing,10px)/ 2) * 2);opacity:0;padding:3px;padding:var(--plyr-tooltip-radius,3px);pointer-events:none;position:absolute;transform:translate(0,10px) scale(.8);transform-origin:50% 100%;transition:transform .2s .1s ease,opacity .2s .1s ease;z-index:2}.plyr__preview-thumb--is-shown{opacity:1;transform:translate(0,0) scale(1)}.plyr__preview-thumb::before{border-left:4px solid transparent;border-left:var(--plyr-tooltip-arrow-size,4px) solid transparent;border-right:4px solid transparent;border-right:var(--plyr-tooltip-arrow-size,4px) solid transparent;border-top:4px solid rgba(255,255,255,.9);border-top:var(--plyr-tooltip-arrow-size,4px) solid var(--plyr-tooltip-background,rgba(255,255,255,.9));bottom:calc(4px * -1);bottom:calc(var(--plyr-tooltip-arrow-size,4px) * -1);content:'';height:0;left:50%;position:absolute;transform:translateX(-50%);width:0;z-index:2}.plyr__preview-thumb__image-container{background:#c1c8d1;border-radius:calc(3px - 1px);border-radius:calc(var(--plyr-tooltip-radius,3px) - 1px);overflow:hidden;position:relative;z-index:0}.plyr__preview-thumb__image-container img{height:100%;left:0;max-height:none;max-width:none;position:absolute;top:0;width:100%}.plyr__preview-thumb__time-container{bottom:6px;left:0;position:absolute;right:0;white-space:nowrap;z-index:3}.plyr__preview-thumb__time-container span{background-color:rgba(0,0,0,.55);border-radius:calc(3px - 1px);border-radius:calc(var(--plyr-tooltip-radius,3px) - 1px);color:#fff;font-size:13px;font-size:var(--plyr-font-size-time,var(--plyr-font-size-small,13px));padding:3px 6px}.plyr__preview-scrubbing{bottom:0;filter:blur(1px);height:100%;left:0;margin:auto;opacity:0;overflow:hidden;pointer-events:none;position:absolute;right:0;top:0;transition:opacity .3s ease;width:100%;z-index:1}.plyr__preview-scrubbing--is-shown{opacity:1}.plyr__preview-scrubbing img{height:100%;left:0;max-height:none;max-width:none;object-fit:contain;position:absolute;top:0;width:100%}.plyr--no-transition{transition:none!important}.plyr__sr-only{clip:rect(1px,1px,1px,1px);overflow:hidden;border:0!important;height:1px!important;padding:0!important;position:absolute!important;width:1px!important}.plyr [hidden]{display:none!important} \ No newline at end of file
diff --git a/youtube/static/modules/plyr/plyr.js b/youtube/static/modules/plyr/plyr.js
new file mode 100644
index 0000000..d5cc84e
--- /dev/null
+++ b/youtube/static/modules/plyr/plyr.js
@@ -0,0 +1,9320 @@
+typeof navigator === "object" && (function (global, factory) {
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
+ typeof define === 'function' && define.amd ? define('Plyr', factory) :
+ (global = global || self, global.Plyr = factory());
+}(this, (function () { 'use strict';
+
+ function _classCallCheck(instance, Constructor) {
+ if (!(instance instanceof Constructor)) {
+ throw new TypeError("Cannot call a class as a function");
+ }
+ }
+
+ function _defineProperties(target, props) {
+ for (var i = 0; i < props.length; i++) {
+ var descriptor = props[i];
+ descriptor.enumerable = descriptor.enumerable || false;
+ descriptor.configurable = true;
+ if ("value" in descriptor) descriptor.writable = true;
+ Object.defineProperty(target, descriptor.key, descriptor);
+ }
+ }
+
+ function _createClass(Constructor, protoProps, staticProps) {
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
+ if (staticProps) _defineProperties(Constructor, staticProps);
+ return Constructor;
+ }
+
+ function _defineProperty(obj, key, value) {
+ if (key in obj) {
+ Object.defineProperty(obj, key, {
+ value: value,
+ enumerable: true,
+ configurable: true,
+ writable: true
+ });
+ } else {
+ obj[key] = value;
+ }
+
+ return obj;
+ }
+
+ function ownKeys(object, enumerableOnly) {
+ var keys = Object.keys(object);
+
+ if (Object.getOwnPropertySymbols) {
+ var symbols = Object.getOwnPropertySymbols(object);
+ if (enumerableOnly) symbols = symbols.filter(function (sym) {
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
+ });
+ keys.push.apply(keys, symbols);
+ }
+
+ return keys;
+ }
+
+ function _objectSpread2(target) {
+ for (var i = 1; i < arguments.length; i++) {
+ var source = arguments[i] != null ? arguments[i] : {};
+
+ if (i % 2) {
+ ownKeys(Object(source), true).forEach(function (key) {
+ _defineProperty(target, key, source[key]);
+ });
+ } else if (Object.getOwnPropertyDescriptors) {
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
+ } else {
+ ownKeys(Object(source)).forEach(function (key) {
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
+ });
+ }
+ }
+
+ return target;
+ }
+
+ function _objectWithoutPropertiesLoose(source, excluded) {
+ if (source == null) return {};
+ var target = {};
+ var sourceKeys = Object.keys(source);
+ var key, i;
+
+ for (i = 0; i < sourceKeys.length; i++) {
+ key = sourceKeys[i];
+ if (excluded.indexOf(key) >= 0) continue;
+ target[key] = source[key];
+ }
+
+ return target;
+ }
+
+ function _objectWithoutProperties(source, excluded) {
+ if (source == null) return {};
+
+ var target = _objectWithoutPropertiesLoose(source, excluded);
+
+ var key, i;
+
+ if (Object.getOwnPropertySymbols) {
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
+
+ for (i = 0; i < sourceSymbolKeys.length; i++) {
+ key = sourceSymbolKeys[i];
+ if (excluded.indexOf(key) >= 0) continue;
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
+ target[key] = source[key];
+ }
+ }
+
+ return target;
+ }
+
+ function _slicedToArray(arr, i) {
+ return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
+ }
+
+ function _toConsumableArray(arr) {
+ return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
+ }
+
+ function _arrayWithoutHoles(arr) {
+ if (Array.isArray(arr)) return _arrayLikeToArray(arr);
+ }
+
+ function _arrayWithHoles(arr) {
+ if (Array.isArray(arr)) return arr;
+ }
+
+ function _iterableToArray(iter) {
+ if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
+ }
+
+ function _iterableToArrayLimit(arr, i) {
+ if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
+ var _arr = [];
+ var _n = true;
+ var _d = false;
+ var _e = undefined;
+
+ try {
+ for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
+ _arr.push(_s.value);
+
+ if (i && _arr.length === i) break;
+ }
+ } catch (err) {
+ _d = true;
+ _e = err;
+ } finally {
+ try {
+ if (!_n && _i["return"] != null) _i["return"]();
+ } finally {
+ if (_d) throw _e;
+ }
+ }
+
+ return _arr;
+ }
+
+ function _unsupportedIterableToArray(o, minLen) {
+ if (!o) return;
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
+ var n = Object.prototype.toString.call(o).slice(8, -1);
+ if (n === "Object" && o.constructor) n = o.constructor.name;
+ if (n === "Map" || n === "Set") return Array.from(o);
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
+ }
+
+ function _arrayLikeToArray(arr, len) {
+ if (len == null || len > arr.length) len = arr.length;
+
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
+
+ return arr2;
+ }
+
+ function _nonIterableSpread() {
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
+ }
+
+ function _nonIterableRest() {
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
+ }
+
+ function _classCallCheck$1(e, t) {
+ if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function");
+ }
+
+ function _defineProperties$1(e, t) {
+ for (var n = 0; n < t.length; n++) {
+ var r = t[n];
+ r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r);
+ }
+ }
+
+ function _createClass$1(e, t, n) {
+ return t && _defineProperties$1(e.prototype, t), n && _defineProperties$1(e, n), e;
+ }
+
+ function _defineProperty$1(e, t, n) {
+ return t in e ? Object.defineProperty(e, t, {
+ value: n,
+ enumerable: !0,
+ configurable: !0,
+ writable: !0
+ }) : e[t] = n, e;
+ }
+
+ function ownKeys$1(e, t) {
+ var n = Object.keys(e);
+
+ if (Object.getOwnPropertySymbols) {
+ var r = Object.getOwnPropertySymbols(e);
+ t && (r = r.filter(function (t) {
+ return Object.getOwnPropertyDescriptor(e, t).enumerable;
+ })), n.push.apply(n, r);
+ }
+
+ return n;
+ }
+
+ function _objectSpread2$1(e) {
+ for (var t = 1; t < arguments.length; t++) {
+ var n = null != arguments[t] ? arguments[t] : {};
+ t % 2 ? ownKeys$1(Object(n), !0).forEach(function (t) {
+ _defineProperty$1(e, t, n[t]);
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : ownKeys$1(Object(n)).forEach(function (t) {
+ Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(n, t));
+ });
+ }
+
+ return e;
+ }
+
+ var defaults = {
+ addCSS: !0,
+ thumbWidth: 15,
+ watch: !0
+ };
+
+ function matches(e, t) {
+ return function () {
+ return Array.from(document.querySelectorAll(t)).includes(this);
+ }.call(e, t);
+ }
+
+ function trigger(e, t) {
+ if (e && t) {
+ var n = new Event(t, {
+ bubbles: !0
+ });
+ e.dispatchEvent(n);
+ }
+ }
+
+ var getConstructor = function getConstructor(e) {
+ return null != e ? e.constructor : null;
+ },
+ instanceOf = function instanceOf(e, t) {
+ return !!(e && t && e instanceof t);
+ },
+ isNullOrUndefined = function isNullOrUndefined(e) {
+ return null == e;
+ },
+ isObject = function isObject(e) {
+ return getConstructor(e) === Object;
+ },
+ isNumber = function isNumber(e) {
+ return getConstructor(e) === Number && !Number.isNaN(e);
+ },
+ isString = function isString(e) {
+ return getConstructor(e) === String;
+ },
+ isBoolean = function isBoolean(e) {
+ return getConstructor(e) === Boolean;
+ },
+ isFunction = function isFunction(e) {
+ return getConstructor(e) === Function;
+ },
+ isArray = function isArray(e) {
+ return Array.isArray(e);
+ },
+ isNodeList = function isNodeList(e) {
+ return instanceOf(e, NodeList);
+ },
+ isElement = function isElement(e) {
+ return instanceOf(e, Element);
+ },
+ isEvent = function isEvent(e) {
+ return instanceOf(e, Event);
+ },
+ isEmpty = function isEmpty(e) {
+ return isNullOrUndefined(e) || (isString(e) || isArray(e) || isNodeList(e)) && !e.length || isObject(e) && !Object.keys(e).length;
+ },
+ is = {
+ nullOrUndefined: isNullOrUndefined,
+ object: isObject,
+ number: isNumber,
+ string: isString,
+ boolean: isBoolean,
+ function: isFunction,
+ array: isArray,
+ nodeList: isNodeList,
+ element: isElement,
+ event: isEvent,
+ empty: isEmpty
+ };
+
+ function getDecimalPlaces(e) {
+ var t = "".concat(e).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);
+ return t ? Math.max(0, (t[1] ? t[1].length : 0) - (t[2] ? +t[2] : 0)) : 0;
+ }
+
+ function round(e, t) {
+ if (1 > t) {
+ var n = getDecimalPlaces(t);
+ return parseFloat(e.toFixed(n));
+ }
+
+ return Math.round(e / t) * t;
+ }
+
+ var RangeTouch = function () {
+ function e(t, n) {
+ _classCallCheck$1(this, e), is.element(t) ? this.element = t : is.string(t) && (this.element = document.querySelector(t)), is.element(this.element) && is.empty(this.element.rangeTouch) && (this.config = _objectSpread2$1({}, defaults, {}, n), this.init());
+ }
+
+ return _createClass$1(e, [{
+ key: "init",
+ value: function value() {
+ e.enabled && (this.config.addCSS && (this.element.style.userSelect = "none", this.element.style.webKitUserSelect = "none", this.element.style.touchAction = "manipulation"), this.listeners(!0), this.element.rangeTouch = this);
+ }
+ }, {
+ key: "destroy",
+ value: function value() {
+ e.enabled && (this.config.addCSS && (this.element.style.userSelect = "", this.element.style.webKitUserSelect = "", this.element.style.touchAction = ""), this.listeners(!1), this.element.rangeTouch = null);
+ }
+ }, {
+ key: "listeners",
+ value: function value(e) {
+ var t = this,
+ n = e ? "addEventListener" : "removeEventListener";
+ ["touchstart", "touchmove", "touchend"].forEach(function (e) {
+ t.element[n](e, function (e) {
+ return t.set(e);
+ }, !1);
+ });
+ }
+ }, {
+ key: "get",
+ value: function value(t) {
+ if (!e.enabled || !is.event(t)) return null;
+ var n,
+ r = t.target,
+ i = t.changedTouches[0],
+ o = parseFloat(r.getAttribute("min")) || 0,
+ s = parseFloat(r.getAttribute("max")) || 100,
+ u = parseFloat(r.getAttribute("step")) || 1,
+ c = r.getBoundingClientRect(),
+ a = 100 / c.width * (this.config.thumbWidth / 2) / 100;
+ return 0 > (n = 100 / c.width * (i.clientX - c.left)) ? n = 0 : 100 < n && (n = 100), 50 > n ? n -= (100 - 2 * n) * a : 50 < n && (n += 2 * (n - 50) * a), o + round(n / 100 * (s - o), u);
+ }
+ }, {
+ key: "set",
+ value: function value(t) {
+ e.enabled && is.event(t) && !t.target.disabled && (t.preventDefault(), t.target.value = this.get(t), trigger(t.target, "touchend" === t.type ? "change" : "input"));
+ }
+ }], [{
+ key: "setup",
+ value: function value(t) {
+ var n = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : {},
+ r = null;
+ if (is.empty(t) || is.string(t) ? r = Array.from(document.querySelectorAll(is.string(t) ? t : 'input[type="range"]')) : is.element(t) ? r = [t] : is.nodeList(t) ? r = Array.from(t) : is.array(t) && (r = t.filter(is.element)), is.empty(r)) return null;
+
+ var i = _objectSpread2$1({}, defaults, {}, n);
+
+ if (is.string(t) && i.watch) {
+ var o = new MutationObserver(function (n) {
+ Array.from(n).forEach(function (n) {
+ Array.from(n.addedNodes).forEach(function (n) {
+ is.element(n) && matches(n, t) && new e(n, i);
+ });
+ });
+ });
+ o.observe(document.body, {
+ childList: !0,
+ subtree: !0
+ });
+ }
+
+ return r.map(function (t) {
+ return new e(t, n);
+ });
+ }
+ }, {
+ key: "enabled",
+ get: function get() {
+ return "ontouchstart" in document.documentElement;
+ }
+ }]), e;
+ }();
+
+ // ==========================================================================
+ // Type checking utils
+ // ==========================================================================
+ var getConstructor$1 = function getConstructor(input) {
+ return input !== null && typeof input !== 'undefined' ? input.constructor : null;
+ };
+
+ var instanceOf$1 = function instanceOf(input, constructor) {
+ return Boolean(input && constructor && input instanceof constructor);
+ };
+
+ var isNullOrUndefined$1 = function isNullOrUndefined(input) {
+ return input === null || typeof input === 'undefined';
+ };
+
+ var isObject$1 = function isObject(input) {
+ return getConstructor$1(input) === Object;
+ };
+
+ var isNumber$1 = function isNumber(input) {
+ return getConstructor$1(input) === Number && !Number.isNaN(input);
+ };
+
+ var isString$1 = function isString(input) {
+ return getConstructor$1(input) === String;
+ };
+
+ var isBoolean$1 = function isBoolean(input) {
+ return getConstructor$1(input) === Boolean;
+ };
+
+ var isFunction$1 = function isFunction(input) {
+ return getConstructor$1(input) === Function;
+ };
+
+ var isArray$1 = function isArray(input) {
+ return Array.isArray(input);
+ };
+
+ var isWeakMap = function isWeakMap(input) {
+ return instanceOf$1(input, WeakMap);
+ };
+
+ var isNodeList$1 = function isNodeList(input) {
+ return instanceOf$1(input, NodeList);
+ };
+
+ var isElement$1 = function isElement(input) {
+ return instanceOf$1(input, Element);
+ };
+
+ var isTextNode = function isTextNode(input) {
+ return getConstructor$1(input) === Text;
+ };
+
+ var isEvent$1 = function isEvent(input) {
+ return instanceOf$1(input, Event);
+ };
+
+ var isKeyboardEvent = function isKeyboardEvent(input) {
+ return instanceOf$1(input, KeyboardEvent);
+ };
+
+ var isCue = function isCue(input) {
+ return instanceOf$1(input, window.TextTrackCue) || instanceOf$1(input, window.VTTCue);
+ };
+
+ var isTrack = function isTrack(input) {
+ return instanceOf$1(input, TextTrack) || !isNullOrUndefined$1(input) && isString$1(input.kind);
+ };
+
+ var isPromise = function isPromise(input) {
+ return instanceOf$1(input, Promise) && isFunction$1(input.then);
+ };
+
+ var isEmpty$1 = function isEmpty(input) {
+ return isNullOrUndefined$1(input) || (isString$1(input) || isArray$1(input) || isNodeList$1(input)) && !input.length || isObject$1(input) && !Object.keys(input).length;
+ };
+
+ var isUrl = function isUrl(input) {
+ // Accept a URL object
+ if (instanceOf$1(input, window.URL)) {
+ return true;
+ } // Must be string from here
+
+
+ if (!isString$1(input)) {
+ return false;
+ } // Add the protocol if required
+
+
+ var string = input;
+
+ if (!input.startsWith('http://') || !input.startsWith('https://')) {
+ string = "http://".concat(input);
+ }
+
+ try {
+ return !isEmpty$1(new URL(string).hostname);
+ } catch (e) {
+ return false;
+ }
+ };
+
+ var is$1 = {
+ nullOrUndefined: isNullOrUndefined$1,
+ object: isObject$1,
+ number: isNumber$1,
+ string: isString$1,
+ boolean: isBoolean$1,
+ function: isFunction$1,
+ array: isArray$1,
+ weakMap: isWeakMap,
+ nodeList: isNodeList$1,
+ element: isElement$1,
+ textNode: isTextNode,
+ event: isEvent$1,
+ keyboardEvent: isKeyboardEvent,
+ cue: isCue,
+ track: isTrack,
+ promise: isPromise,
+ url: isUrl,
+ empty: isEmpty$1
+ };
+
+ // ==========================================================================
+ var transitionEndEvent = function () {
+ var element = document.createElement('span');
+ var events = {
+ WebkitTransition: 'webkitTransitionEnd',
+ MozTransition: 'transitionend',
+ OTransition: 'oTransitionEnd otransitionend',
+ transition: 'transitionend'
+ };
+ var type = Object.keys(events).find(function (event) {
+ return element.style[event] !== undefined;
+ });
+ return is$1.string(type) ? events[type] : false;
+ }(); // Force repaint of element
+
+ function repaint(element, delay) {
+ setTimeout(function () {
+ try {
+ // eslint-disable-next-line no-param-reassign
+ element.hidden = true; // eslint-disable-next-line no-unused-expressions
+
+ element.offsetHeight; // eslint-disable-next-line no-param-reassign
+
+ element.hidden = false;
+ } catch (e) {// Do nothing
+ }
+ }, delay);
+ }
+
+ // ==========================================================================
+ // Browser sniffing
+ // Unfortunately, due to mixed support, UA sniffing is required
+ // ==========================================================================
+ var browser = {
+ isIE:
+ /* @cc_on!@ */
+ !!document.documentMode,
+ isEdge: window.navigator.userAgent.includes('Edge'),
+ isWebkit: 'WebkitAppearance' in document.documentElement.style && !/Edge/.test(navigator.userAgent),
+ isIPhone: /(iPhone|iPod)/gi.test(navigator.platform),
+ isIos: /(iPad|iPhone|iPod)/gi.test(navigator.platform)
+ };
+
+ function cloneDeep(object) {
+ return JSON.parse(JSON.stringify(object));
+ } // Get a nested value in an object
+
+ function getDeep(object, path) {
+ return path.split('.').reduce(function (obj, key) {
+ return obj && obj[key];
+ }, object);
+ } // Deep extend destination object with N more objects
+
+ function extend() {
+ var target = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
+
+ for (var _len = arguments.length, sources = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
+ sources[_key - 1] = arguments[_key];
+ }
+
+ if (!sources.length) {
+ return target;
+ }
+
+ var source = sources.shift();
+
+ if (!is$1.object(source)) {
+ return target;
+ }
+
+ Object.keys(source).forEach(function (key) {
+ if (is$1.object(source[key])) {
+ if (!Object.keys(target).includes(key)) {
+ Object.assign(target, _defineProperty({}, key, {}));
+ }
+
+ extend(target[key], source[key]);
+ } else {
+ Object.assign(target, _defineProperty({}, key, source[key]));
+ }
+ });
+ return extend.apply(void 0, [target].concat(sources));
+ }
+
+ function wrap(elements, wrapper) {
+ // Convert `elements` to an array, if necessary.
+ var targets = elements.length ? elements : [elements]; // Loops backwards to prevent having to clone the wrapper on the
+ // first element (see `child` below).
+
+ Array.from(targets).reverse().forEach(function (element, index) {
+ var child = index > 0 ? wrapper.cloneNode(true) : wrapper; // Cache the current parent and sibling.
+
+ var parent = element.parentNode;
+ var sibling = element.nextSibling; // Wrap the element (is automatically removed from its current
+ // parent).
+
+ child.appendChild(element); // If the element had a sibling, insert the wrapper before
+ // the sibling to maintain the HTML structure; otherwise, just
+ // append it to the parent.
+
+ if (sibling) {
+ parent.insertBefore(child, sibling);
+ } else {
+ parent.appendChild(child);
+ }
+ });
+ } // Set attributes
+
+ function setAttributes(element, attributes) {
+ if (!is$1.element(element) || is$1.empty(attributes)) {
+ return;
+ } // Assume null and undefined attributes should be left out,
+ // Setting them would otherwise convert them to "null" and "undefined"
+
+
+ Object.entries(attributes).filter(function (_ref) {
+ var _ref2 = _slicedToArray(_ref, 2),
+ value = _ref2[1];
+
+ return !is$1.nullOrUndefined(value);
+ }).forEach(function (_ref3) {
+ var _ref4 = _slicedToArray(_ref3, 2),
+ key = _ref4[0],
+ value = _ref4[1];
+
+ return element.setAttribute(key, value);
+ });
+ } // Create a DocumentFragment
+
+ function createElement(type, attributes, text) {
+ // Create a new <element>
+ var element = document.createElement(type); // Set all passed attributes
+
+ if (is$1.object(attributes)) {
+ setAttributes(element, attributes);
+ } // Add text node
+
+
+ if (is$1.string(text)) {
+ element.innerText = text;
+ } // Return built element
+
+
+ return element;
+ } // Inaert an element after another
+
+ function insertAfter(element, target) {
+ if (!is$1.element(element) || !is$1.element(target)) {
+ return;
+ }
+
+ target.parentNode.insertBefore(element, target.nextSibling);
+ } // Insert a DocumentFragment
+
+ function insertElement(type, parent, attributes, text) {
+ if (!is$1.element(parent)) {
+ return;
+ }
+
+ parent.appendChild(createElement(type, attributes, text));
+ } // Remove element(s)
+
+ function removeElement(element) {
+ if (is$1.nodeList(element) || is$1.array(element)) {
+ Array.from(element).forEach(removeElement);
+ return;
+ }
+
+ if (!is$1.element(element) || !is$1.element(element.parentNode)) {
+ return;
+ }
+
+ element.parentNode.removeChild(element);
+ } // Remove all child elements
+
+ function emptyElement(element) {
+ if (!is$1.element(element)) {
+ return;
+ }
+
+ var length = element.childNodes.length;
+
+ while (length > 0) {
+ element.removeChild(element.lastChild);
+ length -= 1;
+ }
+ } // Replace element
+
+ function replaceElement(newChild, oldChild) {
+ if (!is$1.element(oldChild) || !is$1.element(oldChild.parentNode) || !is$1.element(newChild)) {
+ return null;
+ }
+
+ oldChild.parentNode.replaceChild(newChild, oldChild);
+ return newChild;
+ } // Get an attribute object from a string selector
+
+ function getAttributesFromSelector(sel, existingAttributes) {
+ // For example:
+ // '.test' to { class: 'test' }
+ // '#test' to { id: 'test' }
+ // '[data-test="test"]' to { 'data-test': 'test' }
+ if (!is$1.string(sel) || is$1.empty(sel)) {
+ return {};
+ }
+
+ var attributes = {};
+ var existing = extend({}, existingAttributes);
+ sel.split(',').forEach(function (s) {
+ // Remove whitespace
+ var selector = s.trim();
+ var className = selector.replace('.', '');
+ var stripped = selector.replace(/[[\]]/g, ''); // Get the parts and value
+
+ var parts = stripped.split('=');
+
+ var _parts = _slicedToArray(parts, 1),
+ key = _parts[0];
+
+ var value = parts.length > 1 ? parts[1].replace(/["']/g, '') : ''; // Get the first character
+
+ var start = selector.charAt(0);
+
+ switch (start) {
+ case '.':
+ // Add to existing classname
+ if (is$1.string(existing.class)) {
+ attributes.class = "".concat(existing.class, " ").concat(className);
+ } else {
+ attributes.class = className;
+ }
+
+ break;
+
+ case '#':
+ // ID selector
+ attributes.id = selector.replace('#', '');
+ break;
+
+ case '[':
+ // Attribute selector
+ attributes[key] = value;
+ break;
+ }
+ });
+ return extend(existing, attributes);
+ } // Toggle hidden
+
+ function toggleHidden(element, hidden) {
+ if (!is$1.element(element)) {
+ return;
+ }
+
+ var hide = hidden;
+
+ if (!is$1.boolean(hide)) {
+ hide = !element.hidden;
+ } // eslint-disable-next-line no-param-reassign
+
+
+ element.hidden = hide;
+ } // Mirror Element.classList.toggle, with IE compatibility for "force" argument
+
+ function toggleClass(element, className, force) {
+ if (is$1.nodeList(element)) {
+ return Array.from(element).map(function (e) {
+ return toggleClass(e, className, force);
+ });
+ }
+
+ if (is$1.element(element)) {
+ var method = 'toggle';
+
+ if (typeof force !== 'undefined') {
+ method = force ? 'add' : 'remove';
+ }
+
+ element.classList[method](className);
+ return element.classList.contains(className);
+ }
+
+ return false;
+ } // Has class name
+
+ function hasClass(element, className) {
+ return is$1.element(element) && element.classList.contains(className);
+ } // Element matches selector
+
+ function matches$1(element, selector) {
+ var _Element = Element,
+ prototype = _Element.prototype;
+
+ function match() {
+ return Array.from(document.querySelectorAll(selector)).includes(this);
+ }
+
+ var method = prototype.matches || prototype.webkitMatchesSelector || prototype.mozMatchesSelector || prototype.msMatchesSelector || match;
+ return method.call(element, selector);
+ } // Closest ancestor element matching selector (also tests element itself)
+
+ function closest(element, selector) {
+ var _Element2 = Element,
+ prototype = _Element2.prototype; // https://developer.mozilla.org/en-US/docs/Web/API/Element/closest#Polyfill
+
+ function closestElement() {
+ var el = this;
+
+ do {
+ if (matches$1.matches(el, selector)) return el;
+ el = el.parentElement || el.parentNode;
+ } while (el !== null && el.nodeType === 1);
+
+ return null;
+ }
+
+ var method = prototype.closest || closestElement;
+ return method.call(element, selector);
+ } // Find all elements
+
+ function getElements(selector) {
+ return this.elements.container.querySelectorAll(selector);
+ } // Find a single element
+
+ function getElement(selector) {
+ return this.elements.container.querySelector(selector);
+ } // Set focus and tab focus class
+
+ function setFocus() {
+ var element = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
+ var tabFocus = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
+
+ if (!is$1.element(element)) {
+ return;
+ } // Set regular focus
+
+
+ element.focus({
+ preventScroll: true
+ }); // If we want to mimic keyboard focus via tab
+
+ if (tabFocus) {
+ toggleClass(element, this.config.classNames.tabFocus);
+ }
+ }
+
+ var defaultCodecs = {
+ 'audio/ogg': 'vorbis',
+ 'audio/wav': '1',
+ 'video/webm': 'vp8, vorbis',
+ 'video/mp4': 'avc1.42E01E, mp4a.40.2',
+ 'video/ogg': 'theora'
+ }; // Check for feature support
+
+ var support = {
+ // Basic support
+ audio: 'canPlayType' in document.createElement('audio'),
+ video: 'canPlayType' in document.createElement('video'),
+ // Check for support
+ // Basic functionality vs full UI
+ check: function check(type, provider, playsinline) {
+ var canPlayInline = browser.isIPhone && playsinline && support.playsinline;
+ var api = support[type] || provider !== 'html5';
+ var ui = api && support.rangeInput && (type !== 'video' || !browser.isIPhone || canPlayInline);
+ return {
+ api: api,
+ ui: ui
+ };
+ },
+ // Picture-in-picture support
+ // Safari & Chrome only currently
+ pip: function () {
+ if (browser.isIPhone) {
+ return false;
+ } // Safari
+ // https://developer.apple.com/documentation/webkitjs/adding_picture_in_picture_to_your_safari_media_controls
+
+
+ if (is$1.function(createElement('video').webkitSetPresentationMode)) {
+ return true;
+ } // Chrome
+ // https://developers.google.com/web/updates/2018/10/watch-video-using-picture-in-picture
+
+
+ if (document.pictureInPictureEnabled && !createElement('video').disablePictureInPicture) {
+ return true;
+ }
+
+ return false;
+ }(),
+ // Airplay support
+ // Safari only currently
+ airplay: is$1.function(window.WebKitPlaybackTargetAvailabilityEvent),
+ // Inline playback support
+ // https://webkit.org/blog/6784/new-video-policies-for-ios/
+ playsinline: 'playsInline' in document.createElement('video'),
+ // Check for mime type support against a player instance
+ // Credits: http://diveintohtml5.info/everything.html
+ // Related: http://www.leanbackplayer.com/test/h5mt.html
+ mime: function mime(input) {
+ if (is$1.empty(input)) {
+ return false;
+ }
+
+ var _input$split = input.split('/'),
+ _input$split2 = _slicedToArray(_input$split, 1),
+ mediaType = _input$split2[0];
+
+ var type = input; // Verify we're using HTML5 and there's no media type mismatch
+
+ if (!this.isHTML5 || mediaType !== this.type) {
+ return false;
+ } // Add codec if required
+
+
+ if (Object.keys(defaultCodecs).includes(type)) {
+ type += "; codecs=\"".concat(defaultCodecs[input], "\"");
+ }
+
+ try {
+ return Boolean(type && this.media.canPlayType(type).replace(/no/, ''));
+ } catch (e) {
+ return false;
+ }
+ },
+ // Check for textTracks support
+ textTracks: 'textTracks' in document.createElement('video'),
+ // <input type="range"> Sliders
+ rangeInput: function () {
+ var range = document.createElement('input');
+ range.type = 'range';
+ return range.type === 'range';
+ }(),
+ // Touch
+ // NOTE: Remember a device can be mouse + touch enabled so we check on first touch event
+ touch: 'ontouchstart' in document.documentElement,
+ // Detect transitions support
+ transitions: transitionEndEvent !== false,
+ // Reduced motion iOS & MacOS setting
+ // https://webkit.org/blog/7551/responsive-design-for-motion/
+ reducedMotion: 'matchMedia' in window && window.matchMedia('(prefers-reduced-motion)').matches
+ };
+
+ // https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md
+ // https://www.youtube.com/watch?v=NPM6172J22g
+
+ var supportsPassiveListeners = function () {
+ // Test via a getter in the options object to see if the passive property is accessed
+ var supported = false;
+
+ try {
+ var options = Object.defineProperty({}, 'passive', {
+ get: function get() {
+ supported = true;
+ return null;
+ }
+ });
+ window.addEventListener('test', null, options);
+ window.removeEventListener('test', null, options);
+ } catch (e) {// Do nothing
+ }
+
+ return supported;
+ }(); // Toggle event listener
+
+
+ function toggleListener(element, event, callback) {
+ var _this = this;
+
+ var toggle = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
+ var passive = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
+ var capture = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
+
+ // Bail if no element, event, or callback
+ if (!element || !('addEventListener' in element) || is$1.empty(event) || !is$1.function(callback)) {
+ return;
+ } // Allow multiple events
+
+
+ var events = event.split(' '); // Build options
+ // Default to just the capture boolean for browsers with no passive listener support
+
+ var options = capture; // If passive events listeners are supported
+
+ if (supportsPassiveListeners) {
+ options = {
+ // Whether the listener can be passive (i.e. default never prevented)
+ passive: passive,
+ // Whether the listener is a capturing listener or not
+ capture: capture
+ };
+ } // If a single node is passed, bind the event listener
+
+
+ events.forEach(function (type) {
+ if (_this && _this.eventListeners && toggle) {
+ // Cache event listener
+ _this.eventListeners.push({
+ element: element,
+ type: type,
+ callback: callback,
+ options: options
+ });
+ }
+
+ element[toggle ? 'addEventListener' : 'removeEventListener'](type, callback, options);
+ });
+ } // Bind event handler
+
+ function on(element) {
+ var events = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
+ var callback = arguments.length > 2 ? arguments[2] : undefined;
+ var passive = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
+ var capture = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
+ toggleListener.call(this, element, events, callback, true, passive, capture);
+ } // Unbind event handler
+
+ function off(element) {
+ var events = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
+ var callback = arguments.length > 2 ? arguments[2] : undefined;
+ var passive = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
+ var capture = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
+ toggleListener.call(this, element, events, callback, false, passive, capture);
+ } // Bind once-only event handler
+
+ function once(element) {
+ var _this2 = this;
+
+ var events = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
+ var callback = arguments.length > 2 ? arguments[2] : undefined;
+ var passive = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
+ var capture = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
+
+ var onceCallback = function onceCallback() {
+ off(element, events, onceCallback, passive, capture);
+
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
+ args[_key] = arguments[_key];
+ }
+
+ callback.apply(_this2, args);
+ };
+
+ toggleListener.call(this, element, events, onceCallback, true, passive, capture);
+ } // Trigger event
+
+ function triggerEvent(element) {
+ var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
+ var bubbles = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
+ var detail = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
+
+ // Bail if no element
+ if (!is$1.element(element) || is$1.empty(type)) {
+ return;
+ } // Create and dispatch the event
+
+
+ var event = new CustomEvent(type, {
+ bubbles: bubbles,
+ detail: _objectSpread2(_objectSpread2({}, detail), {}, {
+ plyr: this
+ })
+ }); // Dispatch the event
+
+ element.dispatchEvent(event);
+ } // Unbind all cached event listeners
+
+ function unbindListeners() {
+ if (this && this.eventListeners) {
+ this.eventListeners.forEach(function (item) {
+ var element = item.element,
+ type = item.type,
+ callback = item.callback,
+ options = item.options;
+ element.removeEventListener(type, callback, options);
+ });
+ this.eventListeners = [];
+ }
+ } // Run method when / if player is ready
+
+ function ready() {
+ var _this3 = this;
+
+ return new Promise(function (resolve) {
+ return _this3.ready ? setTimeout(resolve, 0) : on.call(_this3, _this3.elements.container, 'ready', resolve);
+ }).then(function () {});
+ }
+
+ /**
+ * Silence a Promise-like object.
+ * This is useful for avoiding non-harmful, but potentially confusing "uncaught
+ * play promise" rejection error messages.
+ * @param {Object} value An object that may or may not be `Promise`-like.
+ */
+
+ function silencePromise(value) {
+ if (is$1.promise(value)) {
+ value.then(null, function () {});
+ }
+ }
+
+ function validateRatio(input) {
+ if (!is$1.array(input) && (!is$1.string(input) || !input.includes(':'))) {
+ return false;
+ }
+
+ var ratio = is$1.array(input) ? input : input.split(':');
+ return ratio.map(Number).every(is$1.number);
+ }
+ function reduceAspectRatio(ratio) {
+ if (!is$1.array(ratio) || !ratio.every(is$1.number)) {
+ return null;
+ }
+
+ var _ratio = _slicedToArray(ratio, 2),
+ width = _ratio[0],
+ height = _ratio[1];
+
+ var getDivider = function getDivider(w, h) {
+ return h === 0 ? w : getDivider(h, w % h);
+ };
+
+ var divider = getDivider(width, height);
+ return [width / divider, height / divider];
+ }
+ function getAspectRatio(input) {
+ var parse = function parse(ratio) {
+ return validateRatio(ratio) ? ratio.split(':').map(Number) : null;
+ }; // Try provided ratio
+
+
+ var ratio = parse(input); // Get from config
+
+ if (ratio === null) {
+ ratio = parse(this.config.ratio);
+ } // Get from embed
+
+
+ if (ratio === null && !is$1.empty(this.embed) && is$1.array(this.embed.ratio)) {
+ ratio = this.embed.ratio;
+ } // Get from HTML5 video
+
+
+ if (ratio === null && this.isHTML5) {
+ var _this$media = this.media,
+ videoWidth = _this$media.videoWidth,
+ videoHeight = _this$media.videoHeight;
+ ratio = reduceAspectRatio([videoWidth, videoHeight]);
+ }
+
+ return ratio;
+ } // Set aspect ratio for responsive container
+
+ function setAspectRatio(input) {
+ if (!this.isVideo) {
+ return {};
+ }
+
+ var wrapper = this.elements.wrapper;
+ var ratio = getAspectRatio.call(this, input);
+
+ var _ref = is$1.array(ratio) ? ratio : [0, 0],
+ _ref2 = _slicedToArray(_ref, 2),
+ w = _ref2[0],
+ h = _ref2[1];
+
+ var padding = 100 / w * h;
+ wrapper.style.paddingBottom = "".concat(padding, "%"); // For Vimeo we have an extra <div> to hide the standard controls and UI
+
+ if (this.isVimeo && !this.config.vimeo.premium && this.supported.ui) {
+ var height = 100 / this.media.offsetWidth * parseInt(window.getComputedStyle(this.media).paddingBottom, 10);
+ var offset = (height - padding) / (height / 50);
+ this.media.style.transform = "translateY(-".concat(offset, "%)");
+ } else if (this.isHTML5) {
+ wrapper.classList.toggle(this.config.classNames.videoFixedRatio, ratio !== null);
+ }
+
+ return {
+ padding: padding,
+ ratio: ratio
+ };
+ }
+
+ // ==========================================================================
+ var html5 = {
+ getSources: function getSources() {
+ var _this = this;
+
+ if (!this.isHTML5) {
+ return [];
+ }
+
+ var sources = Array.from(this.media.querySelectorAll('source')); // Filter out unsupported sources (if type is specified)
+
+ return sources.filter(function (source) {
+ var type = source.getAttribute('type');
+
+ if (is$1.empty(type)) {
+ return true;
+ }
+
+ return support.mime.call(_this, type);
+ });
+ },
+ // Get quality levels
+ getQualityOptions: function getQualityOptions() {
+ // Whether we're forcing all options (e.g. for streaming)
+ if (this.config.quality.forced) {
+ return this.config.quality.options;
+ } // Get sizes from <source> elements
+
+
+ return html5.getSources.call(this).map(function (source) {
+ return Number(source.getAttribute('data-res'));
+ }).filter(Boolean);
+ },
+ setup: function setup() {
+ if (!this.isHTML5) {
+ return;
+ }
+
+ var player = this; // Set speed options from config
+
+ player.options.speed = player.config.speed.options; // Set aspect ratio if fixed
+
+ if (!is$1.empty(this.config.ratio)) {
+ setAspectRatio.call(player);
+ } // Quality
+
+
+ Object.defineProperty(player.media, 'quality', {
+ get: function get() {
+ // Get sources
+ var sources = html5.getSources.call(player);
+ var source = sources.find(function (s) {
+ return s.getAttribute('src') === player.source;
+ }); // Return size, if match is found
+
+ return source && Number(source.getAttribute('data-res'));
+ },
+ set: function set(input) {
+ if (player.quality === input) {
+ return;
+ } // If we're using an an external handler...
+
+
+ if (player.config.quality.forced && is$1.function(player.config.quality.onChange)) {
+ player.config.quality.onChange(input);
+ } else {
+ // Get sources
+ var sources = html5.getSources.call(player); // Get first match for requested size
+
+ var source = sources.find(function (s) {
+ return Number(s.getAttribute('data-res')) === input;
+ }); // No matching source found
+
+ if (!source) {
+ return;
+ } // Get current state
+
+
+ var _player$media = player.media,
+ currentTime = _player$media.currentTime,
+ paused = _player$media.paused,
+ preload = _player$media.preload,
+ readyState = _player$media.readyState,
+ playbackRate = _player$media.playbackRate; // Set new source
+
+ player.media.src = source.getAttribute('src'); // Prevent loading if preload="none" and the current source isn't loaded (#1044)
+
+ if (preload !== 'none' || readyState) {
+ // Restore time
+ player.once('loadedmetadata', function () {
+ player.speed = playbackRate;
+ player.currentTime = currentTime; // Resume playing
+
+ if (!paused) {
+ silencePromise(player.play());
+ }
+ }); // Load new source
+
+ player.media.load();
+ }
+ } // Trigger change event
+
+
+ triggerEvent.call(player, player.media, 'qualitychange', false, {
+ quality: input
+ });
+ }
+ });
+ },
+ // Cancel current network requests
+ // See https://github.com/sampotts/plyr/issues/174
+ cancelRequests: function cancelRequests() {
+ if (!this.isHTML5) {
+ return;
+ } // Remove child sources
+
+
+ removeElement(html5.getSources.call(this)); // Set blank video src attribute
+ // This is to prevent a MEDIA_ERR_SRC_NOT_SUPPORTED error
+ // Info: http://stackoverflow.com/questions/32231579/how-to-properly-dispose-of-an-html5-video-and-close-socket-or-connection
+
+ this.media.setAttribute('src', this.config.blankVideo); // Load the new empty source
+ // This will cancel existing requests
+ // See https://github.com/sampotts/plyr/issues/174
+
+ this.media.load(); // Debugging
+
+ this.debug.log('Cancelled network requests');
+ }
+ };
+
+ // ==========================================================================
+
+ function dedupe(array) {
+ if (!is$1.array(array)) {
+ return array;
+ }
+
+ return array.filter(function (item, index) {
+ return array.indexOf(item) === index;
+ });
+ } // Get the closest value in an array
+
+ function closest$1(array, value) {
+ if (!is$1.array(array) || !array.length) {
+ return null;
+ }
+
+ return array.reduce(function (prev, curr) {
+ return Math.abs(curr - value) < Math.abs(prev - value) ? curr : prev;
+ });
+ }
+
+ // ==========================================================================
+
+ function generateId(prefix) {
+ return "".concat(prefix, "-").concat(Math.floor(Math.random() * 10000));
+ } // Format string
+
+ function format(input) {
+ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
+ args[_key - 1] = arguments[_key];
+ }
+
+ if (is$1.empty(input)) {
+ return input;
+ }
+
+ return input.toString().replace(/{(\d+)}/g, function (match, i) {
+ return args[i].toString();
+ });
+ } // Get percentage
+
+ function getPercentage(current, max) {
+ if (current === 0 || max === 0 || Number.isNaN(current) || Number.isNaN(max)) {
+ return 0;
+ }
+
+ return (current / max * 100).toFixed(2);
+ } // Replace all occurances of a string in a string
+
+ var replaceAll = function replaceAll() {
+ var input = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
+ var find = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
+ var replace = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
+ return input.replace(new RegExp(find.toString().replace(/([.*+?^=!:${}()|[\]/\\])/g, '\\$1'), 'g'), replace.toString());
+ }; // Convert to title case
+
+ var toTitleCase = function toTitleCase() {
+ var input = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
+ return input.toString().replace(/\w\S*/g, function (text) {
+ return text.charAt(0).toUpperCase() + text.substr(1).toLowerCase();
+ });
+ }; // Convert string to pascalCase
+
+ function toPascalCase() {
+ var input = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
+ var string = input.toString(); // Convert kebab case
+
+ string = replaceAll(string, '-', ' '); // Convert snake case
+
+ string = replaceAll(string, '_', ' '); // Convert to title case
+
+ string = toTitleCase(string); // Convert to pascal case
+
+ return replaceAll(string, ' ', '');
+ } // Convert string to pascalCase
+
+ function toCamelCase() {
+ var input = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
+ var string = input.toString(); // Convert to pascal case
+
+ string = toPascalCase(string); // Convert first character to lowercase
+
+ return string.charAt(0).toLowerCase() + string.slice(1);
+ } // Remove HTML from a string
+
+ function stripHTML(source) {
+ var fragment = document.createDocumentFragment();
+ var element = document.createElement('div');
+ fragment.appendChild(element);
+ element.innerHTML = source;
+ return fragment.firstChild.innerText;
+ } // Like outerHTML, but also works for DocumentFragment
+
+ function getHTML(element) {
+ var wrapper = document.createElement('div');
+ wrapper.appendChild(element);
+ return wrapper.innerHTML;
+ }
+
+ var resources = {
+ pip: 'PIP',
+ airplay: 'AirPlay',
+ html5: 'HTML5',
+ vimeo: 'Vimeo',
+ youtube: 'YouTube'
+ };
+ var i18n = {
+ get: function get() {
+ var key = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
+ var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
+
+ if (is$1.empty(key) || is$1.empty(config)) {
+ return '';
+ }
+
+ var string = getDeep(config.i18n, key);
+
+ if (is$1.empty(string)) {
+ if (Object.keys(resources).includes(key)) {
+ return resources[key];
+ }
+
+ return '';
+ }
+
+ var replace = {
+ '{seektime}': config.seekTime,
+ '{title}': config.title
+ };
+ Object.entries(replace).forEach(function (_ref) {
+ var _ref2 = _slicedToArray(_ref, 2),
+ k = _ref2[0],
+ v = _ref2[1];
+
+ string = replaceAll(string, k, v);
+ });
+ return string;
+ }
+ };
+
+ var Storage = /*#__PURE__*/function () {
+ function Storage(player) {
+ _classCallCheck(this, Storage);
+
+ this.enabled = player.config.storage.enabled;
+ this.key = player.config.storage.key;
+ } // Check for actual support (see if we can use it)
+
+
+ _createClass(Storage, [{
+ key: "get",
+ value: function get(key) {
+ if (!Storage.supported || !this.enabled) {
+ return null;
+ }
+
+ var store = window.localStorage.getItem(this.key);
+
+ if (is$1.empty(store)) {
+ return null;
+ }
+
+ var json = JSON.parse(store);
+ return is$1.string(key) && key.length ? json[key] : json;
+ }
+ }, {
+ key: "set",
+ value: function set(object) {
+ // Bail if we don't have localStorage support or it's disabled
+ if (!Storage.supported || !this.enabled) {
+ return;
+ } // Can only store objectst
+
+
+ if (!is$1.object(object)) {
+ return;
+ } // Get current storage
+
+
+ var storage = this.get(); // Default to empty object
+
+ if (is$1.empty(storage)) {
+ storage = {};
+ } // Update the working copy of the values
+
+
+ extend(storage, object); // Update storage
+
+ window.localStorage.setItem(this.key, JSON.stringify(storage));
+ }
+ }], [{
+ key: "supported",
+ get: function get() {
+ try {
+ if (!('localStorage' in window)) {
+ return false;
+ }
+
+ var test = '___test'; // Try to use it (it might be disabled, e.g. user is in private mode)
+ // see: https://github.com/sampotts/plyr/issues/131
+
+ window.localStorage.setItem(test, test);
+ window.localStorage.removeItem(test);
+ return true;
+ } catch (e) {
+ return false;
+ }
+ }
+ }]);
+
+ return Storage;
+ }();
+
+ // ==========================================================================
+ // Fetch wrapper
+ // Using XHR to avoid issues with older browsers
+ // ==========================================================================
+ function fetch(url) {
+ var responseType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'text';
+ return new Promise(function (resolve, reject) {
+ try {
+ var request = new XMLHttpRequest(); // Check for CORS support
+
+ if (!('withCredentials' in request)) {
+ return;
+ }
+
+ request.addEventListener('load', function () {
+ if (responseType === 'text') {
+ try {
+ resolve(JSON.parse(request.responseText));
+ } catch (e) {
+ resolve(request.responseText);
+ }
+ } else {
+ resolve(request.response);
+ }
+ });
+ request.addEventListener('error', function () {
+ throw new Error(request.status);
+ });
+ request.open('GET', url, true); // Set the required response type
+
+ request.responseType = responseType;
+ request.send();
+ } catch (e) {
+ reject(e);
+ }
+ });
+ }
+
+ // ==========================================================================
+
+ function loadSprite(url, id) {
+ if (!is$1.string(url)) {
+ return;
+ }
+
+ var prefix = 'cache';
+ var hasId = is$1.string(id);
+ var isCached = false;
+
+ var exists = function exists() {
+ return document.getElementById(id) !== null;
+ };
+
+ var update = function update(container, data) {
+ // eslint-disable-next-line no-param-reassign
+ container.innerHTML = data; // Check again incase of race condition
+
+ if (hasId && exists()) {
+ return;
+ } // Inject the SVG to the body
+
+
+ document.body.insertAdjacentElement('afterbegin', container);
+ }; // Only load once if ID set
+
+
+ if (!hasId || !exists()) {
+ var useStorage = Storage.supported; // Create container
+
+ var container = document.createElement('div');
+ container.setAttribute('hidden', '');
+
+ if (hasId) {
+ container.setAttribute('id', id);
+ } // Check in cache
+
+
+ if (useStorage) {
+ var cached = window.localStorage.getItem("".concat(prefix, "-").concat(id));
+ isCached = cached !== null;
+
+ if (isCached) {
+ var data = JSON.parse(cached);
+ update(container, data.content);
+ }
+ } // Get the sprite
+
+
+ fetch(url).then(function (result) {
+ if (is$1.empty(result)) {
+ return;
+ }
+
+ if (useStorage) {
+ window.localStorage.setItem("".concat(prefix, "-").concat(id), JSON.stringify({
+ content: result
+ }));
+ }
+
+ update(container, result);
+ }).catch(function () {});
+ }
+ }
+
+ // ==========================================================================
+
+ var getHours = function getHours(value) {
+ return Math.trunc(value / 60 / 60 % 60, 10);
+ };
+ var getMinutes = function getMinutes(value) {
+ return Math.trunc(value / 60 % 60, 10);
+ };
+ var getSeconds = function getSeconds(value) {
+ return Math.trunc(value % 60, 10);
+ }; // Format time to UI friendly string
+
+ function formatTime() {
+ var time = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
+ var displayHours = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
+ var inverted = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
+
+ // Bail if the value isn't a number
+ if (!is$1.number(time)) {
+ return formatTime(undefined, displayHours, inverted);
+ } // Format time component to add leading zero
+
+
+ var format = function format(value) {
+ return "0".concat(value).slice(-2);
+ }; // Breakdown to hours, mins, secs
+
+
+ var hours = getHours(time);
+ var mins = getMinutes(time);
+ var secs = getSeconds(time); // Do we need to display hours?
+
+ if (displayHours || hours > 0) {
+ hours = "".concat(hours, ":");
+ } else {
+ hours = '';
+ } // Render
+
+
+ return "".concat(inverted && time > 0 ? '-' : '').concat(hours).concat(format(mins), ":").concat(format(secs));
+ }
+
+ var controls = {
+ // Get icon URL
+ getIconUrl: function getIconUrl() {
+ var url = new URL(this.config.iconUrl, window.location);
+ var cors = url.host !== window.location.host || browser.isIE && !window.svg4everybody;
+ return {
+ url: this.config.iconUrl,
+ cors: cors
+ };
+ },
+ // Find the UI controls
+ findElements: function findElements() {
+ try {
+ this.elements.controls = getElement.call(this, this.config.selectors.controls.wrapper); // Buttons
+
+ this.elements.buttons = {
+ play: getElements.call(this, this.config.selectors.buttons.play),
+ pause: getElement.call(this, this.config.selectors.buttons.pause),
+ restart: getElement.call(this, this.config.selectors.buttons.restart),
+ rewind: getElement.call(this, this.config.selectors.buttons.rewind),
+ fastForward: getElement.call(this, this.config.selectors.buttons.fastForward),
+ mute: getElement.call(this, this.config.selectors.buttons.mute),
+ pip: getElement.call(this, this.config.selectors.buttons.pip),
+ airplay: getElement.call(this, this.config.selectors.buttons.airplay),
+ settings: getElement.call(this, this.config.selectors.buttons.settings),
+ captions: getElement.call(this, this.config.selectors.buttons.captions),
+ fullscreen: getElement.call(this, this.config.selectors.buttons.fullscreen)
+ }; // Progress
+
+ this.elements.progress = getElement.call(this, this.config.selectors.progress); // Inputs
+
+ this.elements.inputs = {
+ seek: getElement.call(this, this.config.selectors.inputs.seek),
+ volume: getElement.call(this, this.config.selectors.inputs.volume)
+ }; // Display
+
+ this.elements.display = {
+ buffer: getElement.call(this, this.config.selectors.display.buffer),
+ currentTime: getElement.call(this, this.config.selectors.display.currentTime),
+ duration: getElement.call(this, this.config.selectors.display.duration)
+ }; // Seek tooltip
+
+ if (is$1.element(this.elements.progress)) {
+ this.elements.display.seekTooltip = this.elements.progress.querySelector(".".concat(this.config.classNames.tooltip));
+ }
+
+ return true;
+ } catch (error) {
+ // Log it
+ this.debug.warn('It looks like there is a problem with your custom controls HTML', error); // Restore native video controls
+
+ this.toggleNativeControls(true);
+ return false;
+ }
+ },
+ // Create <svg> icon
+ createIcon: function createIcon(type, attributes) {
+ var namespace = 'http://www.w3.org/2000/svg';
+ var iconUrl = controls.getIconUrl.call(this);
+ var iconPath = "".concat(!iconUrl.cors ? iconUrl.url : '', "#").concat(this.config.iconPrefix); // Create <svg>
+
+ var icon = document.createElementNS(namespace, 'svg');
+ setAttributes(icon, extend(attributes, {
+ 'aria-hidden': 'true',
+ focusable: 'false'
+ })); // Create the <use> to reference sprite
+
+ var use = document.createElementNS(namespace, 'use');
+ var path = "".concat(iconPath, "-").concat(type); // Set `href` attributes
+ // https://github.com/sampotts/plyr/issues/460
+ // https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/xlink:href
+
+ if ('href' in use) {
+ use.setAttributeNS('http://www.w3.org/1999/xlink', 'href', path);
+ } // Always set the older attribute even though it's "deprecated" (it'll be around for ages)
+
+
+ use.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', path); // Add <use> to <svg>
+
+ icon.appendChild(use);
+ return icon;
+ },
+ // Create hidden text label
+ createLabel: function createLabel(key) {
+ var attr = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
+ var text = i18n.get(key, this.config);
+
+ var attributes = _objectSpread2(_objectSpread2({}, attr), {}, {
+ class: [attr.class, this.config.classNames.hidden].filter(Boolean).join(' ')
+ });
+
+ return createElement('span', attributes, text);
+ },
+ // Create a badge
+ createBadge: function createBadge(text) {
+ if (is$1.empty(text)) {
+ return null;
+ }
+
+ var badge = createElement('span', {
+ class: this.config.classNames.menu.value
+ });
+ badge.appendChild(createElement('span', {
+ class: this.config.classNames.menu.badge
+ }, text));
+ return badge;
+ },
+ // Create a <button>
+ createButton: function createButton(buttonType, attr) {
+ var _this = this;
+
+ var attributes = extend({}, attr);
+ var type = toCamelCase(buttonType);
+ var props = {
+ element: 'button',
+ toggle: false,
+ label: null,
+ icon: null,
+ labelPressed: null,
+ iconPressed: null
+ };
+ ['element', 'icon', 'label'].forEach(function (key) {
+ if (Object.keys(attributes).includes(key)) {
+ props[key] = attributes[key];
+ delete attributes[key];
+ }
+ }); // Default to 'button' type to prevent form submission
+
+ if (props.element === 'button' && !Object.keys(attributes).includes('type')) {
+ attributes.type = 'button';
+ } // Set class name
+
+
+ if (Object.keys(attributes).includes('class')) {
+ if (!attributes.class.split(' ').some(function (c) {
+ return c === _this.config.classNames.control;
+ })) {
+ extend(attributes, {
+ class: "".concat(attributes.class, " ").concat(this.config.classNames.control)
+ });
+ }
+ } else {
+ attributes.class = this.config.classNames.control;
+ } // Large play button
+
+
+ switch (buttonType) {
+ case 'play':
+ props.toggle = true;
+ props.label = 'play';
+ props.labelPressed = 'pause';
+ props.icon = 'play';
+ props.iconPressed = 'pause';
+ break;
+
+ case 'mute':
+ props.toggle = true;
+ props.label = 'mute';
+ props.labelPressed = 'unmute';
+ props.icon = 'volume';
+ props.iconPressed = 'muted';
+ break;
+
+ case 'captions':
+ props.toggle = true;
+ props.label = 'enableCaptions';
+ props.labelPressed = 'disableCaptions';
+ props.icon = 'captions-off';
+ props.iconPressed = 'captions-on';
+ break;
+
+ case 'fullscreen':
+ props.toggle = true;
+ props.label = 'enterFullscreen';
+ props.labelPressed = 'exitFullscreen';
+ props.icon = 'enter-fullscreen';
+ props.iconPressed = 'exit-fullscreen';
+ break;
+
+ case 'play-large':
+ attributes.class += " ".concat(this.config.classNames.control, "--overlaid");
+ type = 'play';
+ props.label = 'play';
+ props.icon = 'play';
+ break;
+
+ default:
+ if (is$1.empty(props.label)) {
+ props.label = type;
+ }
+
+ if (is$1.empty(props.icon)) {
+ props.icon = buttonType;
+ }
+
+ }
+
+ var button = createElement(props.element); // Setup toggle icon and labels
+
+ if (props.toggle) {
+ // Icon
+ button.appendChild(controls.createIcon.call(this, props.iconPressed, {
+ class: 'icon--pressed'
+ }));
+ button.appendChild(controls.createIcon.call(this, props.icon, {
+ class: 'icon--not-pressed'
+ })); // Label/Tooltip
+
+ button.appendChild(controls.createLabel.call(this, props.labelPressed, {
+ class: 'label--pressed'
+ }));
+ button.appendChild(controls.createLabel.call(this, props.label, {
+ class: 'label--not-pressed'
+ }));
+ } else {
+ button.appendChild(controls.createIcon.call(this, props.icon));
+ button.appendChild(controls.createLabel.call(this, props.label));
+ } // Merge and set attributes
+
+
+ extend(attributes, getAttributesFromSelector(this.config.selectors.buttons[type], attributes));
+ setAttributes(button, attributes); // We have multiple play buttons
+
+ if (type === 'play') {
+ if (!is$1.array(this.elements.buttons[type])) {
+ this.elements.buttons[type] = [];
+ }
+
+ this.elements.buttons[type].push(button);
+ } else {
+ this.elements.buttons[type] = button;
+ }
+
+ return button;
+ },
+ // Create an <input type='range'>
+ createRange: function createRange(type, attributes) {
+ // Seek input
+ var input = createElement('input', extend(getAttributesFromSelector(this.config.selectors.inputs[type]), {
+ type: 'range',
+ min: 0,
+ max: 100,
+ step: 0.01,
+ value: 0,
+ autocomplete: 'off',
+ // A11y fixes for https://github.com/sampotts/plyr/issues/905
+ role: 'slider',
+ 'aria-label': i18n.get(type, this.config),
+ 'aria-valuemin': 0,
+ 'aria-valuemax': 100,
+ 'aria-valuenow': 0
+ }, attributes));
+ this.elements.inputs[type] = input; // Set the fill for webkit now
+
+ controls.updateRangeFill.call(this, input); // Improve support on touch devices
+
+ RangeTouch.setup(input);
+ return input;
+ },
+ // Create a <progress>
+ createProgress: function createProgress(type, attributes) {
+ var progress = createElement('progress', extend(getAttributesFromSelector(this.config.selectors.display[type]), {
+ min: 0,
+ max: 100,
+ value: 0,
+ role: 'progressbar',
+ 'aria-hidden': true
+ }, attributes)); // Create the label inside
+
+ if (type !== 'volume') {
+ progress.appendChild(createElement('span', null, '0'));
+ var suffixKey = {
+ played: 'played',
+ buffer: 'buffered'
+ }[type];
+ var suffix = suffixKey ? i18n.get(suffixKey, this.config) : '';
+ progress.innerText = "% ".concat(suffix.toLowerCase());
+ }
+
+ this.elements.display[type] = progress;
+ return progress;
+ },
+ // Create time display
+ createTime: function createTime(type, attrs) {
+ var attributes = getAttributesFromSelector(this.config.selectors.display[type], attrs);
+ var container = createElement('div', extend(attributes, {
+ class: "".concat(attributes.class ? attributes.class : '', " ").concat(this.config.classNames.display.time, " ").trim(),
+ 'aria-label': i18n.get(type, this.config)
+ }), '00:00'); // Reference for updates
+
+ this.elements.display[type] = container;
+ return container;
+ },
+ // Bind keyboard shortcuts for a menu item
+ // We have to bind to keyup otherwise Firefox triggers a click when a keydown event handler shifts focus
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=1220143
+ bindMenuItemShortcuts: function bindMenuItemShortcuts(menuItem, type) {
+ var _this2 = this;
+
+ // Navigate through menus via arrow keys and space
+ on.call(this, menuItem, 'keydown keyup', function (event) {
+ // We only care about space and ⬆️ ⬇️️ ➡️
+ if (![32, 38, 39, 40].includes(event.which)) {
+ return;
+ } // Prevent play / seek
+
+
+ event.preventDefault();
+ event.stopPropagation(); // We're just here to prevent the keydown bubbling
+
+ if (event.type === 'keydown') {
+ return;
+ }
+
+ var isRadioButton = matches$1(menuItem, '[role="menuitemradio"]'); // Show the respective menu
+
+ if (!isRadioButton && [32, 39].includes(event.which)) {
+ controls.showMenuPanel.call(_this2, type, true);
+ } else {
+ var target;
+
+ if (event.which !== 32) {
+ if (event.which === 40 || isRadioButton && event.which === 39) {
+ target = menuItem.nextElementSibling;
+
+ if (!is$1.element(target)) {
+ target = menuItem.parentNode.firstElementChild;
+ }
+ } else {
+ target = menuItem.previousElementSibling;
+
+ if (!is$1.element(target)) {
+ target = menuItem.parentNode.lastElementChild;
+ }
+ }
+
+ setFocus.call(_this2, target, true);
+ }
+ }
+ }, false); // Enter will fire a `click` event but we still need to manage focus
+ // So we bind to keyup which fires after and set focus here
+
+ on.call(this, menuItem, 'keyup', function (event) {
+ if (event.which !== 13) {
+ return;
+ }
+
+ controls.focusFirstMenuItem.call(_this2, null, true);
+ });
+ },
+ // Create a settings menu item
+ createMenuItem: function createMenuItem(_ref) {
+ var _this3 = this;
+
+ var value = _ref.value,
+ list = _ref.list,
+ type = _ref.type,
+ title = _ref.title,
+ _ref$badge = _ref.badge,
+ badge = _ref$badge === void 0 ? null : _ref$badge,
+ _ref$checked = _ref.checked,
+ checked = _ref$checked === void 0 ? false : _ref$checked;
+ var attributes = getAttributesFromSelector(this.config.selectors.inputs[type]);
+ var menuItem = createElement('button', extend(attributes, {
+ type: 'button',
+ role: 'menuitemradio',
+ class: "".concat(this.config.classNames.control, " ").concat(attributes.class ? attributes.class : '').trim(),
+ 'aria-checked': checked,
+ value: value
+ }));
+ var flex = createElement('span'); // We have to set as HTML incase of special characters
+
+ flex.innerHTML = title;
+
+ if (is$1.element(badge)) {
+ flex.appendChild(badge);
+ }
+
+ menuItem.appendChild(flex); // Replicate radio button behaviour
+
+ Object.defineProperty(menuItem, 'checked', {
+ enumerable: true,
+ get: function get() {
+ return menuItem.getAttribute('aria-checked') === 'true';
+ },
+ set: function set(check) {
+ // Ensure exclusivity
+ if (check) {
+ Array.from(menuItem.parentNode.children).filter(function (node) {
+ return matches$1(node, '[role="menuitemradio"]');
+ }).forEach(function (node) {
+ return node.setAttribute('aria-checked', 'false');
+ });
+ }
+
+ menuItem.setAttribute('aria-checked', check ? 'true' : 'false');
+ }
+ });
+ this.listeners.bind(menuItem, 'click keyup', function (event) {
+ if (is$1.keyboardEvent(event) && event.which !== 32) {
+ return;
+ }
+
+ event.preventDefault();
+ event.stopPropagation();
+ menuItem.checked = true;
+
+ switch (type) {
+ case 'language':
+ _this3.currentTrack = Number(value);
+ break;
+
+ case 'quality':
+ _this3.quality = value;
+ break;
+
+ case 'speed':
+ _this3.speed = parseFloat(value);
+ break;
+ }
+
+ controls.showMenuPanel.call(_this3, 'home', is$1.keyboardEvent(event));
+ }, type, false);
+ controls.bindMenuItemShortcuts.call(this, menuItem, type);
+ list.appendChild(menuItem);
+ },
+ // Format a time for display
+ formatTime: function formatTime$1() {
+ var time = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
+ var inverted = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
+
+ // Bail if the value isn't a number
+ if (!is$1.number(time)) {
+ return time;
+ } // Always display hours if duration is over an hour
+
+
+ var forceHours = getHours(this.duration) > 0;
+ return formatTime(time, forceHours, inverted);
+ },
+ // Update the displayed time
+ updateTimeDisplay: function updateTimeDisplay() {
+ var target = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
+ var time = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
+ var inverted = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
+
+ // Bail if there's no element to display or the value isn't a number
+ if (!is$1.element(target) || !is$1.number(time)) {
+ return;
+ } // eslint-disable-next-line no-param-reassign
+
+
+ target.innerText = controls.formatTime(time, inverted);
+ },
+ // Update volume UI and storage
+ updateVolume: function updateVolume() {
+ if (!this.supported.ui) {
+ return;
+ } // Update range
+
+
+ if (is$1.element(this.elements.inputs.volume)) {
+ controls.setRange.call(this, this.elements.inputs.volume, this.muted ? 0 : this.volume);
+ } // Update mute state
+
+
+ if (is$1.element(this.elements.buttons.mute)) {
+ this.elements.buttons.mute.pressed = this.muted || this.volume === 0;
+ }
+ },
+ // Update seek value and lower fill
+ setRange: function setRange(target) {
+ var value = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
+
+ if (!is$1.element(target)) {
+ return;
+ } // eslint-disable-next-line
+
+
+ target.value = value; // Webkit range fill
+
+ controls.updateRangeFill.call(this, target);
+ },
+ // Update <progress> elements
+ updateProgress: function updateProgress(event) {
+ var _this4 = this;
+
+ if (!this.supported.ui || !is$1.event(event)) {
+ return;
+ }
+
+ var value = 0;
+
+ var setProgress = function setProgress(target, input) {
+ var val = is$1.number(input) ? input : 0;
+ var progress = is$1.element(target) ? target : _this4.elements.display.buffer; // Update value and label
+
+ if (is$1.element(progress)) {
+ progress.value = val; // Update text label inside
+
+ var label = progress.getElementsByTagName('span')[0];
+
+ if (is$1.element(label)) {
+ label.childNodes[0].nodeValue = val;
+ }
+ }
+ };
+
+ if (event) {
+ switch (event.type) {
+ // Video playing
+ case 'timeupdate':
+ case 'seeking':
+ case 'seeked':
+ value = getPercentage(this.currentTime, this.duration); // Set seek range value only if it's a 'natural' time event
+
+ if (event.type === 'timeupdate') {
+ controls.setRange.call(this, this.elements.inputs.seek, value);
+ }
+
+ break;
+ // Check buffer status
+
+ case 'playing':
+ case 'progress':
+ setProgress(this.elements.display.buffer, this.buffered * 100);
+ break;
+ }
+ }
+ },
+ // Webkit polyfill for lower fill range
+ updateRangeFill: function updateRangeFill(target) {
+ // Get range from event if event passed
+ var range = is$1.event(target) ? target.target : target; // Needs to be a valid <input type='range'>
+
+ if (!is$1.element(range) || range.getAttribute('type') !== 'range') {
+ return;
+ } // Set aria values for https://github.com/sampotts/plyr/issues/905
+
+
+ if (matches$1(range, this.config.selectors.inputs.seek)) {
+ range.setAttribute('aria-valuenow', this.currentTime);
+ var currentTime = controls.formatTime(this.currentTime);
+ var duration = controls.formatTime(this.duration);
+ var format = i18n.get('seekLabel', this.config);
+ range.setAttribute('aria-valuetext', format.replace('{currentTime}', currentTime).replace('{duration}', duration));
+ } else if (matches$1(range, this.config.selectors.inputs.volume)) {
+ var percent = range.value * 100;
+ range.setAttribute('aria-valuenow', percent);
+ range.setAttribute('aria-valuetext', "".concat(percent.toFixed(1), "%"));
+ } else {
+ range.setAttribute('aria-valuenow', range.value);
+ } // WebKit only
+
+
+ if (!browser.isWebkit) {
+ return;
+ } // Set CSS custom property
+
+
+ range.style.setProperty('--value', "".concat(range.value / range.max * 100, "%"));
+ },
+ // Update hover tooltip for seeking
+ updateSeekTooltip: function updateSeekTooltip(event) {
+ var _this5 = this;
+
+ // Bail if setting not true
+ if (!this.config.tooltips.seek || !is$1.element(this.elements.inputs.seek) || !is$1.element(this.elements.display.seekTooltip) || this.duration === 0) {
+ return;
+ }
+
+ var visible = "".concat(this.config.classNames.tooltip, "--visible");
+
+ var toggle = function toggle(show) {
+ return toggleClass(_this5.elements.display.seekTooltip, visible, show);
+ }; // Hide on touch
+
+
+ if (this.touch) {
+ toggle(false);
+ return;
+ } // Determine percentage, if already visible
+
+
+ var percent = 0;
+ var clientRect = this.elements.progress.getBoundingClientRect();
+
+ if (is$1.event(event)) {
+ percent = 100 / clientRect.width * (event.pageX - clientRect.left);
+ } else if (hasClass(this.elements.display.seekTooltip, visible)) {
+ percent = parseFloat(this.elements.display.seekTooltip.style.left, 10);
+ } else {
+ return;
+ } // Set bounds
+
+
+ if (percent < 0) {
+ percent = 0;
+ } else if (percent > 100) {
+ percent = 100;
+ } // Display the time a click would seek to
+
+
+ controls.updateTimeDisplay.call(this, this.elements.display.seekTooltip, this.duration / 100 * percent); // Set position
+
+ this.elements.display.seekTooltip.style.left = "".concat(percent, "%"); // Show/hide the tooltip
+ // If the event is a moues in/out and percentage is inside bounds
+
+ if (is$1.event(event) && ['mouseenter', 'mouseleave'].includes(event.type)) {
+ toggle(event.type === 'mouseenter');
+ }
+ },
+ // Handle time change event
+ timeUpdate: function timeUpdate(event) {
+ // Only invert if only one time element is displayed and used for both duration and currentTime
+ var invert = !is$1.element(this.elements.display.duration) && this.config.invertTime; // Duration
+
+ controls.updateTimeDisplay.call(this, this.elements.display.currentTime, invert ? this.duration - this.currentTime : this.currentTime, invert); // Ignore updates while seeking
+
+ if (event && event.type === 'timeupdate' && this.media.seeking) {
+ return;
+ } // Playing progress
+
+
+ controls.updateProgress.call(this, event);
+ },
+ // Show the duration on metadataloaded or durationchange events
+ durationUpdate: function durationUpdate() {
+ // Bail if no UI or durationchange event triggered after playing/seek when invertTime is false
+ if (!this.supported.ui || !this.config.invertTime && this.currentTime) {
+ return;
+ } // 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.
+ // https://github.com/video-dev/hls.js/blob/5820d29d3c4c8a46e8b75f1e3afa3e68c1a9a2db/src/controller/buffer-controller.js#L415
+ // https://github.com/google/shaka-player/blob/4d889054631f4e1cf0fbd80ddd2b71887c02e232/lib/media/streaming_engine.js#L1062
+ // https://github.com/Dash-Industry-Forum/dash.js/blob/69859f51b969645b234666800d4cb596d89c602d/src/dash/models/DashManifestModel.js#L338
+
+
+ if (this.duration >= Math.pow(2, 32)) {
+ toggleHidden(this.elements.display.currentTime, true);
+ toggleHidden(this.elements.progress, true);
+ return;
+ } // Update ARIA values
+
+
+ if (is$1.element(this.elements.inputs.seek)) {
+ this.elements.inputs.seek.setAttribute('aria-valuemax', this.duration);
+ } // If there's a spot to display duration
+
+
+ var hasDuration = is$1.element(this.elements.display.duration); // If there's only one time display, display duration there
+
+ if (!hasDuration && this.config.displayDuration && this.paused) {
+ controls.updateTimeDisplay.call(this, this.elements.display.currentTime, this.duration);
+ } // If there's a duration element, update content
+
+
+ if (hasDuration) {
+ controls.updateTimeDisplay.call(this, this.elements.display.duration, this.duration);
+ } // Update the tooltip (if visible)
+
+
+ controls.updateSeekTooltip.call(this);
+ },
+ // Hide/show a tab
+ toggleMenuButton: function toggleMenuButton(setting, toggle) {
+ toggleHidden(this.elements.settings.buttons[setting], !toggle);
+ },
+ // Update the selected setting
+ updateSetting: function updateSetting(setting, container, input) {
+ var pane = this.elements.settings.panels[setting];
+ var value = null;
+ var list = container;
+
+ if (setting === 'captions') {
+ value = this.currentTrack;
+ } else {
+ value = !is$1.empty(input) ? input : this[setting]; // Get default
+
+ if (is$1.empty(value)) {
+ value = this.config[setting].default;
+ } // Unsupported value
+
+
+ if (!is$1.empty(this.options[setting]) && !this.options[setting].includes(value)) {
+ this.debug.warn("Unsupported value of '".concat(value, "' for ").concat(setting));
+ return;
+ } // Disabled value
+
+
+ if (!this.config[setting].options.includes(value)) {
+ this.debug.warn("Disabled value of '".concat(value, "' for ").concat(setting));
+ return;
+ }
+ } // Get the list if we need to
+
+
+ if (!is$1.element(list)) {
+ list = pane && pane.querySelector('[role="menu"]');
+ } // If there's no list it means it's not been rendered...
+
+
+ if (!is$1.element(list)) {
+ return;
+ } // Update the label
+
+
+ var label = this.elements.settings.buttons[setting].querySelector(".".concat(this.config.classNames.menu.value));
+ label.innerHTML = controls.getLabel.call(this, setting, value); // Find the radio option and check it
+
+ var target = list && list.querySelector("[value=\"".concat(value, "\"]"));
+
+ if (is$1.element(target)) {
+ target.checked = true;
+ }
+ },
+ // Translate a value into a nice label
+ getLabel: function getLabel(setting, value) {
+ switch (setting) {
+ case 'speed':
+ return value === 1 ? i18n.get('normal', this.config) : "".concat(value, "&times;");
+
+ case 'quality':
+ if (is$1.number(value)) {
+ var label = i18n.get("qualityLabel.".concat(value), this.config);
+
+ if (!label.length) {
+ return "".concat(value, "p");
+ }
+
+ return label;
+ }
+
+ return toTitleCase(value);
+
+ case 'captions':
+ return captions.getLabel.call(this);
+
+ default:
+ return null;
+ }
+ },
+ // Set the quality menu
+ setQualityMenu: function setQualityMenu(options) {
+ var _this6 = this;
+
+ // Menu required
+ if (!is$1.element(this.elements.settings.panels.quality)) {
+ return;
+ }
+
+ var type = 'quality';
+ var list = this.elements.settings.panels.quality.querySelector('[role="menu"]'); // Set options if passed and filter based on uniqueness and config
+
+ if (is$1.array(options)) {
+ this.options.quality = dedupe(options).filter(function (quality) {
+ return _this6.config.quality.options.includes(quality);
+ });
+ } // Toggle the pane and tab
+
+
+ var toggle = !is$1.empty(this.options.quality) && this.options.quality.length > 1;
+ controls.toggleMenuButton.call(this, type, toggle); // Empty the menu
+
+ emptyElement(list); // Check if we need to toggle the parent
+
+ controls.checkMenu.call(this); // If we're hiding, nothing more to do
+
+ if (!toggle) {
+ return;
+ } // Get the badge HTML for HD, 4K etc
+
+
+ var getBadge = function getBadge(quality) {
+ var label = i18n.get("qualityBadge.".concat(quality), _this6.config);
+
+ if (!label.length) {
+ return null;
+ }
+
+ return controls.createBadge.call(_this6, label);
+ }; // Sort options by the config and then render options
+
+
+ this.options.quality.sort(function (a, b) {
+ var sorting = _this6.config.quality.options;
+ return sorting.indexOf(a) > sorting.indexOf(b) ? 1 : -1;
+ }).forEach(function (quality) {
+ controls.createMenuItem.call(_this6, {
+ value: quality,
+ list: list,
+ type: type,
+ title: controls.getLabel.call(_this6, 'quality', quality),
+ badge: getBadge(quality)
+ });
+ });
+ controls.updateSetting.call(this, type, list);
+ },
+ // Set the looping options
+
+ /* setLoopMenu() {
+ // Menu required
+ if (!is.element(this.elements.settings.panels.loop)) {
+ return;
+ }
+ const options = ['start', 'end', 'all', 'reset'];
+ const list = this.elements.settings.panels.loop.querySelector('[role="menu"]');
+ // Show the pane and tab
+ toggleHidden(this.elements.settings.buttons.loop, false);
+ toggleHidden(this.elements.settings.panels.loop, false);
+ // Toggle the pane and tab
+ const toggle = !is.empty(this.loop.options);
+ controls.toggleMenuButton.call(this, 'loop', toggle);
+ // Empty the menu
+ emptyElement(list);
+ options.forEach(option => {
+ const item = createElement('li');
+ const button = createElement(
+ 'button',
+ extend(getAttributesFromSelector(this.config.selectors.buttons.loop), {
+ type: 'button',
+ class: this.config.classNames.control,
+ 'data-plyr-loop-action': option,
+ }),
+ i18n.get(option, this.config)
+ );
+ if (['start', 'end'].includes(option)) {
+ const badge = controls.createBadge.call(this, '00:00');
+ button.appendChild(badge);
+ }
+ item.appendChild(button);
+ list.appendChild(item);
+ });
+ }, */
+ // Get current selected caption language
+ // TODO: rework this to user the getter in the API?
+ // Set a list of available captions languages
+ setCaptionsMenu: function setCaptionsMenu() {
+ var _this7 = this;
+
+ // Menu required
+ if (!is$1.element(this.elements.settings.panels.captions)) {
+ return;
+ } // TODO: Captions or language? Currently it's mixed
+
+
+ var type = 'captions';
+ var list = this.elements.settings.panels.captions.querySelector('[role="menucaptions"]');
+ var tracks = captions.getTracks.call(this);
+ var toggle = Boolean(tracks.length); // Toggle the pane and tab
+
+ controls.toggleMenuButton.call(this, type, toggle); // Empty the menu
+
+ emptyElement(list); // Check if we need to toggle the parent
+
+ controls.checkMenu.call(this); // If there's no captions, bail
+
+ if (!toggle) {
+ return;
+ } // Generate options data
+
+
+ var options = tracks.map(function (track, value) {
+ return {
+ value: value,
+ checked: _this7.captions.toggled && _this7.currentTrack === value,
+ title: captions.getLabel.call(_this7, track),
+ badge: track.language && controls.createBadge.call(_this7, track.language.toUpperCase()),
+ list: list,
+ type: 'language'
+ };
+ }); // Add the "Disabled" option to turn off captions
+
+ options.unshift({
+ value: -1,
+ checked: !this.captions.toggled,
+ title: i18n.get('disabled', this.config),
+ list: list,
+ type: 'language'
+ }); // Generate options
+
+ options.forEach(controls.createMenuItem.bind(this));
+ controls.updateSetting.call(this, type, list);
+ },
+ // Set a list of available captions languages
+ setSpeedMenu: function setSpeedMenu() {
+ var _this8 = this;
+
+ // Menu required
+ if (!is$1.element(this.elements.settings.panels.speed)) {
+ return;
+ }
+
+ var type = 'speed';
+ var list = this.elements.settings.panels.speed.querySelector('[role="menu"]'); // Filter out invalid speeds
+
+ this.options.speed = this.options.speed.filter(function (o) {
+ return o >= _this8.minimumSpeed && o <= _this8.maximumSpeed;
+ }); // Toggle the pane and tab
+
+ var toggle = !is$1.empty(this.options.speed) && this.options.speed.length > 1;
+ controls.toggleMenuButton.call(this, type, toggle); // Empty the menu
+
+ emptyElement(list); // Check if we need to toggle the parent
+
+ controls.checkMenu.call(this); // If we're hiding, nothing more to do
+
+ if (!toggle) {
+ return;
+ } // Create items
+
+
+ this.options.speed.forEach(function (speed) {
+ controls.createMenuItem.call(_this8, {
+ value: speed,
+ list: list,
+ type: type,
+ title: controls.getLabel.call(_this8, 'speed', speed)
+ });
+ });
+ controls.updateSetting.call(this, type, list);
+ },
+ // Check if we need to hide/show the settings menu
+ checkMenu: function checkMenu() {
+ var buttons = this.elements.settings.buttons;
+ var visible = !is$1.empty(buttons) && Object.values(buttons).some(function (button) {
+ return !button.hidden;
+ });
+ toggleHidden(this.elements.settings.menu, !visible);
+ },
+ // Focus the first menu item in a given (or visible) menu
+ focusFirstMenuItem: function focusFirstMenuItem(pane) {
+ var tabFocus = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
+
+ if (this.elements.settings.popup.hidden) {
+ return;
+ }
+
+ var target = pane;
+
+ if (!is$1.element(target)) {
+ target = Object.values(this.elements.settings.panels).find(function (p) {
+ return !p.hidden;
+ });
+ }
+
+ var firstItem = target.querySelector('[role^="menuitem"]');
+ setFocus.call(this, firstItem, tabFocus);
+ },
+ // Show/hide menu
+ toggleMenu: function toggleMenu(input) {
+ var popup = this.elements.settings.popup;
+ var button = this.elements.buttons.settings; // Menu and button are required
+
+ if (!is$1.element(popup) || !is$1.element(button)) {
+ return;
+ } // True toggle by default
+
+
+ var hidden = popup.hidden;
+ var show = hidden;
+
+ if (is$1.boolean(input)) {
+ show = input;
+ } else if (is$1.keyboardEvent(input) && input.which === 27) {
+ show = false;
+ } else if (is$1.event(input)) {
+ // If Plyr is in a shadowDOM, the event target is set to the component, instead of the
+ // Element in the shadowDOM. The path, if available, is complete.
+ var target = is$1.function(input.composedPath) ? input.composedPath()[0] : input.target;
+ var isMenuItem = popup.contains(target); // If the click was inside the menu or if the click
+ // wasn't the button or menu item and we're trying to
+ // show the menu (a doc click shouldn't show the menu)
+
+ if (isMenuItem || !isMenuItem && input.target !== button && show) {
+ return;
+ }
+ } // Set button attributes
+
+
+ button.setAttribute('aria-expanded', show); // Show the actual popup
+
+ toggleHidden(popup, !show); // Add class hook
+
+ toggleClass(this.elements.container, this.config.classNames.menu.open, show); // Focus the first item if key interaction
+
+ if (show && is$1.keyboardEvent(input)) {
+ controls.focusFirstMenuItem.call(this, null, true);
+ } else if (!show && !hidden) {
+ // If closing, re-focus the button
+ setFocus.call(this, button, is$1.keyboardEvent(input));
+ }
+ },
+ // Get the natural size of a menu panel
+ getMenuSize: function getMenuSize(tab) {
+ var clone = tab.cloneNode(true);
+ clone.style.position = 'absolute';
+ clone.style.opacity = 0;
+ clone.removeAttribute('hidden'); // Append to parent so we get the "real" size
+
+ tab.parentNode.appendChild(clone); // Get the sizes before we remove
+
+ var width = clone.scrollWidth;
+ var height = clone.scrollHeight; // Remove from the DOM
+
+ removeElement(clone);
+ return {
+ width: width,
+ height: height
+ };
+ },
+ // Show a panel in the menu
+ showMenuPanel: function showMenuPanel() {
+ var _this9 = this;
+
+ var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
+ var tabFocus = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
+ var target = this.elements.container.querySelector("#plyr-settings-".concat(this.id, "-").concat(type)); // Nothing to show, bail
+
+ if (!is$1.element(target)) {
+ return;
+ } // Hide all other panels
+
+
+ var container = target.parentNode;
+ var current = Array.from(container.children).find(function (node) {
+ return !node.hidden;
+ }); // If we can do fancy animations, we'll animate the height/width
+
+ if (support.transitions && !support.reducedMotion) {
+ // Set the current width as a base
+ container.style.width = "".concat(current.scrollWidth, "px");
+ container.style.height = "".concat(current.scrollHeight, "px"); // Get potential sizes
+
+ var size = controls.getMenuSize.call(this, target); // Restore auto height/width
+
+ var restore = function restore(event) {
+ // We're only bothered about height and width on the container
+ if (event.target !== container || !['width', 'height'].includes(event.propertyName)) {
+ return;
+ } // Revert back to auto
+
+
+ container.style.width = '';
+ container.style.height = ''; // Only listen once
+
+ off.call(_this9, container, transitionEndEvent, restore);
+ }; // Listen for the transition finishing and restore auto height/width
+
+
+ on.call(this, container, transitionEndEvent, restore); // Set dimensions to target
+
+ container.style.width = "".concat(size.width, "px");
+ container.style.height = "".concat(size.height, "px");
+ } // Set attributes on current tab
+
+
+ toggleHidden(current, true); // Set attributes on target
+
+ toggleHidden(target, false); // Focus the first item
+
+ controls.focusFirstMenuItem.call(this, target, tabFocus);
+ },
+ // Set the download URL
+ setDownloadUrl: function setDownloadUrl() {
+ var button = this.elements.buttons.download; // Bail if no button
+
+ if (!is$1.element(button)) {
+ return;
+ } // Set attribute
+
+
+ button.setAttribute('href', this.download);
+ },
+ // Build the default HTML
+ create: function create(data) {
+ var _this10 = this;
+
+ var bindMenuItemShortcuts = controls.bindMenuItemShortcuts,
+ createButton = controls.createButton,
+ createProgress = controls.createProgress,
+ createRange = controls.createRange,
+ createTime = controls.createTime,
+ setQualityMenu = controls.setQualityMenu,
+ setSpeedMenu = controls.setSpeedMenu,
+ showMenuPanel = controls.showMenuPanel;
+ this.elements.controls = null; // Larger overlaid play button
+
+ if (is$1.array(this.config.controls) && this.config.controls.includes('play-large')) {
+ this.elements.container.appendChild(createButton.call(this, 'play-large'));
+ } // Create the container
+
+
+ var container = createElement('div', getAttributesFromSelector(this.config.selectors.controls.wrapper));
+ this.elements.controls = container; // Default item attributes
+
+ var defaultAttributes = {
+ class: 'plyr__controls__item'
+ }; // Loop through controls in order
+
+ dedupe(is$1.array(this.config.controls) ? this.config.controls : []).forEach(function (control) {
+ // Restart button
+ if (control === 'restart') {
+ container.appendChild(createButton.call(_this10, 'restart', defaultAttributes));
+ } // Rewind button
+
+
+ if (control === 'rewind') {
+ container.appendChild(createButton.call(_this10, 'rewind', defaultAttributes));
+ } // Play/Pause button
+
+
+ if (control === 'play') {
+ container.appendChild(createButton.call(_this10, 'play', defaultAttributes));
+ } // Fast forward button
+
+
+ if (control === 'fast-forward') {
+ container.appendChild(createButton.call(_this10, 'fast-forward', defaultAttributes));
+ } // Progress
+
+
+ if (control === 'progress') {
+ var progressContainer = createElement('div', {
+ class: "".concat(defaultAttributes.class, " plyr__progress__container")
+ });
+ var progress = createElement('div', getAttributesFromSelector(_this10.config.selectors.progress)); // Seek range slider
+
+ progress.appendChild(createRange.call(_this10, 'seek', {
+ id: "plyr-seek-".concat(data.id)
+ })); // Buffer progress
+
+ progress.appendChild(createProgress.call(_this10, 'buffer')); // TODO: Add loop display indicator
+ // Seek tooltip
+
+ if (_this10.config.tooltips.seek) {
+ var tooltip = createElement('span', {
+ class: _this10.config.classNames.tooltip
+ }, '00:00');
+ progress.appendChild(tooltip);
+ _this10.elements.display.seekTooltip = tooltip;
+ }
+
+ _this10.elements.progress = progress;
+ progressContainer.appendChild(_this10.elements.progress);
+ container.appendChild(progressContainer);
+ } // Media current time display
+
+
+ if (control === 'current-time') {
+ container.appendChild(createTime.call(_this10, 'currentTime', defaultAttributes));
+ } // Media duration display
+
+
+ if (control === 'duration') {
+ container.appendChild(createTime.call(_this10, 'duration', defaultAttributes));
+ } // Volume controls
+
+
+ if (control === 'mute' || control === 'volume') {
+ var volume = _this10.elements.volume; // Create the volume container if needed
+
+ if (!is$1.element(volume) || !container.contains(volume)) {
+ volume = createElement('div', extend({}, defaultAttributes, {
+ class: "".concat(defaultAttributes.class, " plyr__volume").trim()
+ }));
+ _this10.elements.volume = volume;
+ container.appendChild(volume);
+ } // Toggle mute button
+
+
+ if (control === 'mute') {
+ volume.appendChild(createButton.call(_this10, 'mute'));
+ } // Volume range control
+ // Ignored on iOS as it's handled globally
+ // https://developer.apple.com/library/safari/documentation/AudioVideo/Conceptual/Using_HTML5_Audio_Video/Device-SpecificConsiderations/Device-SpecificConsiderations.html
+
+
+ if (control === 'volume' && !browser.isIos) {
+ // Set the attributes
+ var attributes = {
+ max: 1,
+ step: 0.05,
+ value: _this10.config.volume
+ }; // Create the volume range slider
+
+ volume.appendChild(createRange.call(_this10, 'volume', extend(attributes, {
+ id: "plyr-volume-".concat(data.id)
+ })));
+ }
+ } // Toggle captions button
+
+
+ if (control === 'captions') {
+ container.appendChild(createButton.call(_this10, 'captions', defaultAttributes));
+ } // Settings button / menu
+
+
+ if (control === 'settings' && !is$1.empty(_this10.config.settings)) {
+ var wrapper = createElement('div', extend({}, defaultAttributes, {
+ class: "".concat(defaultAttributes.class, " plyr__menu").trim(),
+ hidden: ''
+ }));
+ wrapper.appendChild(createButton.call(_this10, 'settings', {
+ 'aria-haspopup': true,
+ 'aria-controls': "plyr-settings-".concat(data.id),
+ 'aria-expanded': false
+ }));
+ var popup = createElement('div', {
+ class: 'plyr__menu__container',
+ id: "plyr-settings-".concat(data.id),
+ hidden: ''
+ });
+ var inner = createElement('div');
+ var home = createElement('div', {
+ id: "plyr-settings-".concat(data.id, "-home")
+ }); // Create the menu
+
+ var menu = createElement('div', {
+ role: 'menu'
+ });
+ home.appendChild(menu);
+ inner.appendChild(home);
+ _this10.elements.settings.panels.home = home; // Build the menu items
+
+ _this10.config.settings.forEach(function (type) {
+ // TODO: bundle this with the createMenuItem helper and bindings
+ var menuItem = createElement('button', extend(getAttributesFromSelector(_this10.config.selectors.buttons.settings), {
+ type: 'button',
+ class: "".concat(_this10.config.classNames.control, " ").concat(_this10.config.classNames.control, "--forward"),
+ role: 'menuitem',
+ 'aria-haspopup': true,
+ hidden: ''
+ })); // Bind menu shortcuts for keyboard users
+
+ bindMenuItemShortcuts.call(_this10, menuItem, type); // Show menu on click
+
+ on.call(_this10, menuItem, 'click', function () {
+ showMenuPanel.call(_this10, type, false);
+ });
+ var flex = createElement('span', null, i18n.get(type, _this10.config));
+ var value = createElement('span', {
+ class: _this10.config.classNames.menu.value
+ }); // Speed contains HTML entities
+
+ value.innerHTML = data[type];
+ flex.appendChild(value);
+ menuItem.appendChild(flex);
+ menu.appendChild(menuItem); // Build the panes
+
+ var pane = createElement('div', {
+ id: "plyr-settings-".concat(data.id, "-").concat(type),
+ hidden: ''
+ }); // Back button
+
+ var backButton = createElement('button', {
+ type: 'button',
+ class: "".concat(_this10.config.classNames.control, " ").concat(_this10.config.classNames.control, "--back")
+ }); // Visible label
+
+ backButton.appendChild(createElement('span', {
+ 'aria-hidden': true
+ }, i18n.get(type, _this10.config))); // Screen reader label
+
+ backButton.appendChild(createElement('span', {
+ class: _this10.config.classNames.hidden
+ }, i18n.get('menuBack', _this10.config))); // Go back via keyboard
+
+ on.call(_this10, pane, 'keydown', function (event) {
+ // We only care about <-
+ if (event.which !== 37) {
+ return;
+ } // Prevent seek
+
+
+ event.preventDefault();
+ event.stopPropagation(); // Show the respective menu
+
+ showMenuPanel.call(_this10, 'home', true);
+ }, false); // Go back via button click
+
+ on.call(_this10, backButton, 'click', function () {
+ showMenuPanel.call(_this10, 'home', false);
+ }); // Add to pane
+
+ pane.appendChild(backButton); // Menu
+
+ pane.appendChild(createElement('div', {
+ role: 'menu'
+ })); // Menu Captions
+
+ pane.appendChild(createElement('div', {
+ role: 'menucaptions'
+ }));
+ inner.appendChild(pane);
+ _this10.elements.settings.buttons[type] = menuItem;
+ _this10.elements.settings.panels[type] = pane;
+ });
+
+ popup.appendChild(inner);
+ wrapper.appendChild(popup);
+ container.appendChild(wrapper);
+ _this10.elements.settings.popup = popup;
+ _this10.elements.settings.menu = wrapper;
+ } // Picture in picture button
+
+
+ if (control === 'pip' && support.pip) {
+ container.appendChild(createButton.call(_this10, 'pip', defaultAttributes));
+ } // Airplay button
+
+
+ if (control === 'airplay' && support.airplay) {
+ container.appendChild(createButton.call(_this10, 'airplay', defaultAttributes));
+ } // Download button
+
+
+ if (control === 'download') {
+ var _attributes = extend({}, defaultAttributes, {
+ element: 'a',
+ href: _this10.download,
+ target: '_blank'
+ }); // Set download attribute for HTML5 only
+
+
+ if (_this10.isHTML5) {
+ _attributes.download = '';
+ }
+
+ var download = _this10.config.urls.download;
+
+ if (!is$1.url(download) && _this10.isEmbed) {
+ extend(_attributes, {
+ icon: "logo-".concat(_this10.provider),
+ label: _this10.provider
+ });
+ }
+
+ container.appendChild(createButton.call(_this10, 'download', _attributes));
+ } // Toggle fullscreen button
+
+
+ if (control === 'fullscreen') {
+ container.appendChild(createButton.call(_this10, 'fullscreen', defaultAttributes));
+ }
+ }); // Set available quality levels
+
+ if (this.isHTML5) {
+ setQualityMenu.call(this, html5.getQualityOptions.call(this));
+ }
+
+ setSpeedMenu.call(this);
+ return container;
+ },
+ // Insert controls
+ inject: function inject() {
+ var _this11 = this;
+
+ // Sprite
+ if (this.config.loadSprite) {
+ var icon = controls.getIconUrl.call(this); // Only load external sprite using AJAX
+
+ if (icon.cors) {
+ loadSprite(icon.url, 'sprite-plyr');
+ }
+ } // Create a unique ID
+
+
+ this.id = Math.floor(Math.random() * 10000); // Null by default
+
+ var container = null;
+ this.elements.controls = null; // Set template properties
+
+ var props = {
+ id: this.id,
+ seektime: this.config.seekTime,
+ title: this.config.title
+ };
+ var update = true; // If function, run it and use output
+
+ if (is$1.function(this.config.controls)) {
+ this.config.controls = this.config.controls.call(this, props);
+ } // Convert falsy controls to empty array (primarily for empty strings)
+
+
+ if (!this.config.controls) {
+ this.config.controls = [];
+ }
+
+ if (is$1.element(this.config.controls) || is$1.string(this.config.controls)) {
+ // HTMLElement or Non-empty string passed as the option
+ container = this.config.controls;
+ } else {
+ // Create controls
+ container = controls.create.call(this, {
+ id: this.id,
+ seektime: this.config.seekTime,
+ speed: this.speed,
+ quality: this.quality,
+ captions: captions.getLabel.call(this) // TODO: Looping
+ // loop: 'None',
+
+ });
+ update = false;
+ } // Replace props with their value
+
+
+ var replace = function replace(input) {
+ var result = input;
+ Object.entries(props).forEach(function (_ref2) {
+ var _ref3 = _slicedToArray(_ref2, 2),
+ key = _ref3[0],
+ value = _ref3[1];
+
+ result = replaceAll(result, "{".concat(key, "}"), value);
+ });
+ return result;
+ }; // Update markup
+
+
+ if (update) {
+ if (is$1.string(this.config.controls)) {
+ container = replace(container);
+ }
+ } // Controls container
+
+
+ var target; // Inject to custom location
+
+ if (is$1.string(this.config.selectors.controls.container)) {
+ target = document.querySelector(this.config.selectors.controls.container);
+ } // Inject into the container by default
+
+
+ if (!is$1.element(target)) {
+ target = this.elements.container;
+ } // Inject controls HTML (needs to be before captions, hence "afterbegin")
+
+
+ var insertMethod = is$1.element(container) ? 'insertAdjacentElement' : 'insertAdjacentHTML';
+ target[insertMethod]('afterbegin', container); // Find the elements if need be
+
+ if (!is$1.element(this.elements.controls)) {
+ controls.findElements.call(this);
+ } // Add pressed property to buttons
+
+
+ if (!is$1.empty(this.elements.buttons)) {
+ var addProperty = function addProperty(button) {
+ var className = _this11.config.classNames.controlPressed;
+ Object.defineProperty(button, 'pressed', {
+ enumerable: true,
+ get: function get() {
+ return hasClass(button, className);
+ },
+ set: function set() {
+ var pressed = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
+ toggleClass(button, className, pressed);
+ }
+ });
+ }; // Toggle classname when pressed property is set
+
+
+ Object.values(this.elements.buttons).filter(Boolean).forEach(function (button) {
+ if (is$1.array(button) || is$1.nodeList(button)) {
+ Array.from(button).filter(Boolean).forEach(addProperty);
+ } else {
+ addProperty(button);
+ }
+ });
+ } // Edge sometimes doesn't finish the paint so force a repaint
+
+
+ if (browser.isEdge) {
+ repaint(target);
+ } // Setup tooltips
+
+
+ if (this.config.tooltips.controls) {
+ var _this$config = this.config,
+ classNames = _this$config.classNames,
+ selectors = _this$config.selectors;
+ var selector = "".concat(selectors.controls.wrapper, " ").concat(selectors.labels, " .").concat(classNames.hidden);
+ var labels = getElements.call(this, selector);
+ Array.from(labels).forEach(function (label) {
+ toggleClass(label, _this11.config.classNames.hidden, false);
+ toggleClass(label, _this11.config.classNames.tooltip, true);
+ });
+ }
+ }
+ };
+
+ /**
+ * Parse a string to a URL object
+ * @param {String} input - the URL to be parsed
+ * @param {Boolean} safe - failsafe parsing
+ */
+
+ function parseUrl(input) {
+ var safe = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
+ var url = input;
+
+ if (safe) {
+ var parser = document.createElement('a');
+ parser.href = url;
+ url = parser.href;
+ }
+
+ try {
+ return new URL(url);
+ } catch (e) {
+ return null;
+ }
+ } // Convert object to URLSearchParams
+
+ function buildUrlParams(input) {
+ var params = new URLSearchParams();
+
+ if (is$1.object(input)) {
+ Object.entries(input).forEach(function (_ref) {
+ var _ref2 = _slicedToArray(_ref, 2),
+ key = _ref2[0],
+ value = _ref2[1];
+
+ params.set(key, value);
+ });
+ }
+
+ return params;
+ }
+
+ var captions = {
+ // Setup captions
+ setup: function setup() {
+ // Requires UI support
+ if (!this.supported.ui) {
+ return;
+ } // Only Vimeo and HTML5 video supported at this point
+
+
+ if (!this.isVideo || this.isYouTube || this.isHTML5 && !support.textTracks) {
+ // Clear menu and hide
+ if (is$1.array(this.config.controls) && this.config.controls.includes('settings') && this.config.settings.includes('captions')) {
+ controls.setCaptionsMenu.call(this);
+ }
+
+ return;
+ } // Inject the container
+
+
+ if (!is$1.element(this.elements.captions)) {
+ this.elements.captions = createElement('div', getAttributesFromSelector(this.config.selectors.captions));
+ insertAfter(this.elements.captions, this.elements.wrapper);
+ } // Fix IE captions if CORS is used
+ // Fetch captions and inject as blobs instead (data URIs not supported!)
+
+
+ if (browser.isIE && window.URL) {
+ var elements = this.media.querySelectorAll('track');
+ Array.from(elements).forEach(function (track) {
+ var src = track.getAttribute('src');
+ var url = parseUrl(src);
+
+ if (url !== null && url.hostname !== window.location.href.hostname && ['http:', 'https:'].includes(url.protocol)) {
+ fetch(src, 'blob').then(function (blob) {
+ track.setAttribute('src', window.URL.createObjectURL(blob));
+ }).catch(function () {
+ removeElement(track);
+ });
+ }
+ });
+ } // Get and set initial data
+ // The "preferred" options are not realized unless / until the wanted language has a match
+ // * languages: Array of user's browser languages.
+ // * language: The language preferred by user settings or config
+ // * active: The state preferred by user settings or config
+ // * toggled: The real captions state
+
+
+ var browserLanguages = navigator.languages || [navigator.language || navigator.userLanguage || 'en'];
+ var languages = dedupe(browserLanguages.map(function (language) {
+ return language.split('-')[0];
+ }));
+ var language = (this.storage.get('language') || this.config.captions.language || 'auto').toLowerCase(); // Use first browser language when language is 'auto'
+
+ if (language === 'auto') {
+ var _languages = _slicedToArray(languages, 1);
+
+ language = _languages[0];
+ }
+
+ var active = this.storage.get('captions');
+
+ if (!is$1.boolean(active)) {
+ active = this.config.captions.active;
+ }
+
+ Object.assign(this.captions, {
+ toggled: false,
+ active: active,
+ language: language,
+ languages: languages
+ }); // Watch changes to textTracks and update captions menu
+
+ if (this.isHTML5) {
+ var trackEvents = this.config.captions.update ? 'addtrack removetrack' : 'removetrack';
+ on.call(this, this.media.textTracks, trackEvents, captions.update.bind(this));
+ } // Update available languages in list next tick (the event must not be triggered before the listeners)
+
+
+ setTimeout(captions.update.bind(this), 0);
+ },
+ // Update available language options in settings based on tracks
+ update: function update() {
+ var _this = this;
+
+ var tracks = captions.getTracks.call(this, true); // Get the wanted language
+
+ var _this$captions = this.captions,
+ active = _this$captions.active,
+ language = _this$captions.language,
+ meta = _this$captions.meta,
+ currentTrackNode = _this$captions.currentTrackNode;
+ var languageExists = Boolean(tracks.find(function (track) {
+ return track.language === language;
+ })); // Handle tracks (add event listener and "pseudo"-default)
+
+ if (this.isHTML5 && this.isVideo) {
+ tracks.filter(function (track) {
+ return !meta.get(track);
+ }).forEach(function (track) {
+ _this.debug.log('Track added', track); // Attempt to store if the original dom element was "default"
+
+
+ meta.set(track, {
+ default: track.mode === 'showing'
+ }); // Turn off native caption rendering to avoid double captions
+ // Note: mode='hidden' forces a track to download. To ensure every track
+ // isn't downloaded at once, only 'showing' tracks should be reassigned
+ // eslint-disable-next-line no-param-reassign
+
+ if (track.mode === 'showing') {
+ // eslint-disable-next-line no-param-reassign
+ track.mode = 'hidden';
+ } // Add event listener for cue changes
+
+
+ on.call(_this, track, 'cuechange', function () {
+ return captions.updateCues.call(_this);
+ });
+ });
+ } // Update language first time it matches, or if the previous matching track was removed
+
+
+ if (languageExists && this.language !== language || !tracks.includes(currentTrackNode)) {
+ captions.setLanguage.call(this, language);
+ captions.toggle.call(this, active && languageExists);
+ } // Enable or disable captions based on track length
+
+
+ toggleClass(this.elements.container, this.config.classNames.captions.enabled, !is$1.empty(tracks)); // Update available languages in list
+
+ if (is$1.array(this.config.controls) && this.config.controls.includes('settings') && this.config.settings.includes('captions')) {
+ controls.setCaptionsMenu.call(this);
+ }
+ },
+ // Toggle captions display
+ // Used internally for the toggleCaptions method, with the passive option forced to false
+ toggle: function toggle(input) {
+ var _this2 = this;
+
+ var passive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
+
+ // If there's no full support
+ if (!this.supported.ui) {
+ return;
+ }
+
+ var toggled = this.captions.toggled; // Current state
+
+ var activeClass = this.config.classNames.captions.active; // Get the next state
+ // If the method is called without parameter, toggle based on current value
+
+ var active = is$1.nullOrUndefined(input) ? !toggled : input; // Update state and trigger event
+
+ if (active !== toggled) {
+ // When passive, don't override user preferences
+ if (!passive) {
+ this.captions.active = active;
+ this.storage.set({
+ captions: active
+ });
+ } // Force language if the call isn't passive and there is no matching language to toggle to
+
+
+ if (!this.language && active && !passive) {
+ var tracks = captions.getTracks.call(this);
+ 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
+
+ this.captions.language = track.language; // Set caption, but don't store in localStorage as user preference
+
+ captions.set.call(this, tracks.indexOf(track));
+ return;
+ } // Toggle button if it's enabled
+
+
+ if (this.elements.buttons.captions) {
+ this.elements.buttons.captions.pressed = active;
+ } // Add class hook
+
+
+ toggleClass(this.elements.container, activeClass, active);
+ this.captions.toggled = active; // Update settings menu
+
+ controls.updateSetting.call(this, 'captions'); // Trigger event (not used internally)
+
+ triggerEvent.call(this, this.media, active ? 'captionsenabled' : 'captionsdisabled');
+ } // Wait for the call stack to clear before setting mode='hidden'
+ // on the active track - forcing the browser to download it
+
+
+ setTimeout(function () {
+ if (active && _this2.captions.toggled) {
+ _this2.captions.currentTrackNode.mode = 'hidden';
+ }
+ });
+ },
+ // Set captions by track index
+ // Used internally for the currentTrack setter with the passive option forced to false
+ set: function set(index) {
+ var passive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
+ var tracks = captions.getTracks.call(this); // Disable captions if setting to -1
+
+ if (index === -1) {
+ captions.toggle.call(this, false, passive);
+ return;
+ }
+
+ if (!is$1.number(index)) {
+ this.debug.warn('Invalid caption argument', index);
+ return;
+ }
+
+ if (!(index in tracks)) {
+ this.debug.warn('Track not found', index);
+ return;
+ }
+
+ if (this.captions.currentTrack !== index) {
+ this.captions.currentTrack = index;
+ var track = tracks[index];
+
+ var _ref = track || {},
+ language = _ref.language; // Store reference to node for invalidation on remove
+
+
+ this.captions.currentTrackNode = track; // Update settings menu
+
+ controls.updateSetting.call(this, 'captions'); // When passive, don't override user preferences
+
+ if (!passive) {
+ this.captions.language = language;
+ this.storage.set({
+ language: language
+ });
+ } // Handle Vimeo captions
+
+
+ if (this.isVimeo) {
+ this.embed.enableTextTrack(language);
+ } // Trigger event
+
+
+ triggerEvent.call(this, this.media, 'languagechange');
+ } // Show captions
+
+
+ captions.toggle.call(this, true, passive);
+
+ if (this.isHTML5 && this.isVideo) {
+ // If we change the active track while a cue is already displayed we need to update it
+ captions.updateCues.call(this);
+ }
+ },
+ // Set captions by language
+ // Used internally for the language setter with the passive option forced to false
+ setLanguage: function setLanguage(input) {
+ var passive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
+
+ if (!is$1.string(input)) {
+ this.debug.warn('Invalid language argument', input);
+ return;
+ } // Normalize
+
+
+ var language = input.toLowerCase();
+ this.captions.language = language; // Set currentTrack
+
+ var tracks = captions.getTracks.call(this);
+ var track = captions.findTrack.call(this, [language]);
+ captions.set.call(this, tracks.indexOf(track), passive);
+ },
+ // Get current valid caption tracks
+ // If update is false it will also ignore tracks without metadata
+ // This is used to "freeze" the language options when captions.update is false
+ getTracks: function getTracks() {
+ var _this3 = this;
+
+ var update = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
+ // Handle media or textTracks missing or null
+ var tracks = Array.from((this.media || {}).textTracks || []); // For HTML5, use cache instead of current tracks when it exists (if captions.update is false)
+ // Filter out removed tracks and tracks that aren't captions/subtitles (for example metadata)
+
+ return tracks.filter(function (track) {
+ return !_this3.isHTML5 || update || _this3.captions.meta.has(track);
+ }).filter(function (track) {
+ return ['captions', 'subtitles'].includes(track.kind);
+ });
+ },
+ // Match tracks based on languages and get the first
+ findTrack: function findTrack(languages) {
+ var _this4 = this;
+
+ var force = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
+ var tracks = captions.getTracks.call(this);
+
+ var sortIsDefault = function sortIsDefault(track) {
+ return Number((_this4.captions.meta.get(track) || {}).default);
+ };
+
+ var sorted = Array.from(tracks).sort(function (a, b) {
+ return sortIsDefault(b) - sortIsDefault(a);
+ });
+ var track;
+ languages.every(function (language) {
+ track = sorted.find(function (t) {
+ return t.language === language;
+ });
+ return !track; // Break iteration if there is a match
+ }); // If no match is found but is required, get first
+
+ return track || (force ? sorted[0] : undefined);
+ },
+ // Get the current track
+ getCurrentTrack: function getCurrentTrack() {
+ return captions.getTracks.call(this)[this.currentTrack];
+ },
+ // Get UI label for track
+ getLabel: function getLabel(track) {
+ var currentTrack = track;
+
+ if (!is$1.track(currentTrack) && support.textTracks && this.captions.toggled) {
+ currentTrack = captions.getCurrentTrack.call(this);
+ }
+
+ if (is$1.track(currentTrack)) {
+ if (!is$1.empty(currentTrack.label)) {
+ return currentTrack.label;
+ }
+
+ if (!is$1.empty(currentTrack.language)) {
+ return track.language.toUpperCase();
+ }
+
+ return i18n.get('enabled', this.config);
+ }
+
+ return i18n.get('disabled', this.config);
+ },
+ // Update captions using current track's active cues
+ // Also optional array argument in case there isn't any track (ex: vimeo)
+ updateCues: function updateCues(input) {
+ // Requires UI
+ if (!this.supported.ui) {
+ return;
+ }
+
+ if (!is$1.element(this.elements.captions)) {
+ this.debug.warn('No captions element to render to');
+ return;
+ } // Only accept array or empty input
+
+
+ if (!is$1.nullOrUndefined(input) && !Array.isArray(input)) {
+ this.debug.warn('updateCues: Invalid input', input);
+ return;
+ }
+
+ var cues = input; // Get cues from track
+
+ if (!cues) {
+ var track = captions.getCurrentTrack.call(this);
+ cues = Array.from((track || {}).activeCues || []).map(function (cue) {
+ return cue.getCueAsHTML();
+ }).map(getHTML);
+ } // Set new caption text
+
+
+ var content = cues.map(function (cueText) {
+ return cueText.trim();
+ }).join('\n');
+ var changed = content !== this.elements.captions.innerHTML;
+
+ if (changed) {
+ // Empty the container and create a new child element
+ emptyElement(this.elements.captions);
+ var caption = createElement('span', getAttributesFromSelector(this.config.selectors.caption));
+ caption.innerHTML = content;
+ this.elements.captions.appendChild(caption); // Trigger event
+
+ triggerEvent.call(this, this.media, 'cuechange');
+ }
+ }
+ };
+
+ // ==========================================================================
+ // Plyr default config
+ // ==========================================================================
+ var defaults$1 = {
+ // Disable
+ enabled: true,
+ // Custom media title
+ title: '',
+ // Logging to console
+ debug: false,
+ // Auto play (if supported)
+ autoplay: false,
+ // Only allow one media playing at once (vimeo only)
+ autopause: true,
+ // Allow inline playback on iOS (this effects YouTube/Vimeo - HTML5 requires the attribute present)
+ // TODO: Remove iosNative fullscreen option in favour of this (logic needs work)
+ playsinline: true,
+ // Default time to skip when rewind/fast forward
+ seekTime: 10,
+ // Default volume
+ volume: 1,
+ muted: false,
+ // Pass a custom duration
+ duration: null,
+ // Display the media duration on load in the current time position
+ // If you have opted to display both duration and currentTime, this is ignored
+ displayDuration: true,
+ // Invert the current time to be a countdown
+ invertTime: true,
+ // Clicking the currentTime inverts it's value to show time left rather than elapsed
+ toggleInvert: true,
+ // Force an aspect ratio
+ // The format must be `'w:h'` (e.g. `'16:9'`)
+ ratio: null,
+ // Click video container to play/pause
+ clickToPlay: true,
+ // Auto hide the controls
+ hideControls: true,
+ // Reset to start when playback ended
+ resetOnEnd: false,
+ // Disable the standard context menu
+ disableContextMenu: true,
+ // Sprite (for icons)
+ loadSprite: true,
+ iconPrefix: 'plyr',
+ iconUrl: '/theme/modules/plyr/plyr.svg',
+ // Blank video (used to prevent errors on source change)
+ blankVideo: '/theme/modules/plyr/blank.webm',
+ // Quality default
+ quality: {
+ default: 576,
+ // The options to display in the UI, if available for the source media
+ options: [4320, 2880, 2160, 1440, 1080, 720, 576, 480, 360, 240],
+ forced: false,
+ onChange: null
+ },
+ // Set loops
+ loop: {
+ active: false // start: null,
+ // end: null,
+
+ },
+ // Speed default and options to display
+ speed: {
+ selected: 1,
+ // The options to display in the UI, if available for the source media (e.g. Vimeo and YouTube only support 0.5x-4x)
+ options: [0.5, 0.75, 1, 1.25, 1.5, 1.75, 2, 4]
+ },
+ // Keyboard shortcut settings
+ keyboard: {
+ focused: true,
+ global: false
+ },
+ // Display tooltips
+ tooltips: {
+ controls: false,
+ seek: true
+ },
+ // Captions settings
+ captions: {
+ active: false,
+ language: 'auto',
+ // Listen to new tracks added after Plyr is initialized.
+ // This is needed for streaming captions, but may result in unselectable options
+ update: false
+ },
+ // Fullscreen settings
+ fullscreen: {
+ enabled: true,
+ // Allow fullscreen?
+ fallback: true,
+ // Fallback using full viewport/window
+ iosNative: false // Use the native fullscreen in iOS (disables custom controls)
+ // Selector for the fullscreen container so contextual / non-player content can remain visible in fullscreen mode
+ // Non-ancestors of the player element will be ignored
+ // container: null, // defaults to the player element
+
+ },
+ // Local storage
+ storage: {
+ enabled: true,
+ key: 'plyr'
+ },
+ // Default controls
+ controls: ['play-large', // 'restart',
+ // 'rewind',
+ 'play', // 'fast-forward',
+ 'progress', 'current-time', // 'duration',
+ 'mute', 'volume', 'captions', 'settings', 'pip', 'airplay', // 'download',
+ 'fullscreen'],
+ settings: ['captions', 'quality', 'speed'],
+ // Localisation
+ i18n: {
+ restart: 'Restart',
+ rewind: 'Rewind {seektime}s',
+ play: 'Play',
+ pause: 'Pause',
+ fastForward: 'Forward {seektime}s',
+ seek: 'Seek',
+ seekLabel: '{currentTime} of {duration}',
+ played: 'Played',
+ buffered: 'Buffered',
+ currentTime: 'Current time',
+ duration: 'Duration',
+ volume: 'Volume',
+ mute: 'Mute',
+ unmute: 'Unmute',
+ enableCaptions: 'Enable captions',
+ disableCaptions: 'Disable captions',
+ download: 'Download',
+ enterFullscreen: 'Enter fullscreen',
+ exitFullscreen: 'Exit fullscreen',
+ frameTitle: 'Player for {title}',
+ captions: 'Captions',
+ settings: 'Settings',
+ pip: 'PIP',
+ menuBack: 'Go back to previous menu',
+ speed: 'Speed',
+ normal: 'Normal',
+ quality: 'Quality',
+ loop: 'Loop',
+ start: 'Start',
+ end: 'End',
+ all: 'All',
+ reset: 'Reset',
+ disabled: 'Disabled',
+ enabled: 'Enabled',
+ advertisement: 'Ad',
+ qualityBadge: {
+ 2160: '4K',
+ 1440: 'HD',
+ 1080: 'HD',
+ 720: 'HD',
+ 576: 'SD',
+ 480: 'SD'
+ }
+ },
+ // URLs
+ urls: {
+ download: null,
+ vimeo: {
+ sdk: 'https://player.vimeo.com/api/player.js',
+ iframe: 'https://player.vimeo.com/video/{0}?{1}',
+ api: 'https://vimeo.com/api/v2/video/{0}.json'
+ },
+ youtube: {
+ sdk: 'https://www.youtube.com/iframe_api',
+ api: 'https://noembed.com/embed?url=https://www.youtube.com/watch?v={0}'
+ },
+ googleIMA: {
+ sdk: 'https://imasdk.googleapis.com/js/sdkloader/ima3.js'
+ }
+ },
+ // Custom control listeners
+ listeners: {
+ seek: null,
+ play: null,
+ pause: null,
+ restart: null,
+ rewind: null,
+ fastForward: null,
+ mute: null,
+ volume: null,
+ captions: null,
+ download: null,
+ fullscreen: null,
+ pip: null,
+ airplay: null,
+ speed: null,
+ quality: null,
+ loop: null,
+ language: null
+ },
+ // Events to watch and bubble
+ events: [// Events to watch on HTML5 media elements and bubble
+ // https://developer.mozilla.org/en/docs/Web/Guide/Events/Media_events
+ 'ended', 'progress', 'stalled', 'playing', 'waiting', 'canplay', 'canplaythrough', 'loadstart', 'loadeddata', 'loadedmetadata', 'timeupdate', 'volumechange', 'play', 'pause', 'error', 'seeking', 'seeked', 'emptied', 'ratechange', 'cuechange', // Custom events
+ 'download', 'enterfullscreen', 'exitfullscreen', 'captionsenabled', 'captionsdisabled', 'languagechange', 'controlshidden', 'controlsshown', 'ready', // YouTube
+ 'statechange', // Quality
+ 'qualitychange', // Ads
+ 'adsloaded', 'adscontentpause', 'adscontentresume', 'adstarted', 'adsmidpoint', 'adscomplete', 'adsallcomplete', 'adsimpression', 'adsclick'],
+ // Selectors
+ // Change these to match your template if using custom HTML
+ selectors: {
+ editable: 'input, textarea, select, [contenteditable]',
+ container: '.plyr',
+ controls: {
+ container: null,
+ wrapper: '.plyr__controls'
+ },
+ labels: '[data-plyr]',
+ buttons: {
+ play: '[data-plyr="play"]',
+ pause: '[data-plyr="pause"]',
+ restart: '[data-plyr="restart"]',
+ rewind: '[data-plyr="rewind"]',
+ fastForward: '[data-plyr="fast-forward"]',
+ mute: '[data-plyr="mute"]',
+ captions: '[data-plyr="captions"]',
+ download: '[data-plyr="download"]',
+ fullscreen: '[data-plyr="fullscreen"]',
+ pip: '[data-plyr="pip"]',
+ airplay: '[data-plyr="airplay"]',
+ settings: '[data-plyr="settings"]',
+ loop: '[data-plyr="loop"]'
+ },
+ inputs: {
+ seek: '[data-plyr="seek"]',
+ volume: '[data-plyr="volume"]',
+ speed: '[data-plyr="speed"]',
+ language: '[data-plyr="language"]',
+ quality: '[data-plyr="quality"]'
+ },
+ display: {
+ currentTime: '.plyr__time--current',
+ duration: '.plyr__time--duration',
+ buffer: '.plyr__progress__buffer',
+ loop: '.plyr__progress__loop',
+ // Used later
+ volume: '.plyr__volume--display'
+ },
+ progress: '.plyr__progress',
+ captions: '.plyr__captions',
+ caption: '.plyr__caption'
+ },
+ // Class hooks added to the player in different states
+ classNames: {
+ type: 'plyr--{0}',
+ provider: 'plyr--{0}',
+ video: 'plyr__video-wrapper',
+ embed: 'plyr__video-embed',
+ videoFixedRatio: 'plyr__video-wrapper--fixed-ratio',
+ embedContainer: 'plyr__video-embed__container',
+ poster: 'plyr__poster',
+ posterEnabled: 'plyr__poster-enabled',
+ ads: 'plyr__ads',
+ control: 'plyr__control',
+ controlPressed: 'plyr__control--pressed',
+ playing: 'plyr--playing',
+ paused: 'plyr--paused',
+ stopped: 'plyr--stopped',
+ loading: 'plyr--loading',
+ hover: 'plyr--hover',
+ tooltip: 'plyr__tooltip',
+ cues: 'plyr__cues',
+ hidden: 'plyr__sr-only',
+ hideControls: 'plyr--hide-controls',
+ isIos: 'plyr--is-ios',
+ isTouch: 'plyr--is-touch',
+ uiSupported: 'plyr--full-ui',
+ noTransition: 'plyr--no-transition',
+ display: {
+ time: 'plyr__time'
+ },
+ menu: {
+ value: 'plyr__menu__value',
+ badge: 'plyr__badge',
+ open: 'plyr--menu-open'
+ },
+ captions: {
+ enabled: 'plyr--captions-enabled',
+ active: 'plyr--captions-active'
+ },
+ fullscreen: {
+ enabled: 'plyr--fullscreen-enabled',
+ fallback: 'plyr--fullscreen-fallback'
+ },
+ pip: {
+ supported: 'plyr--pip-supported',
+ active: 'plyr--pip-active'
+ },
+ airplay: {
+ supported: 'plyr--airplay-supported',
+ active: 'plyr--airplay-active'
+ },
+ tabFocus: 'plyr__tab-focus',
+ previewThumbnails: {
+ // Tooltip thumbs
+ thumbContainer: 'plyr__preview-thumb',
+ thumbContainerShown: 'plyr__preview-thumb--is-shown',
+ imageContainer: 'plyr__preview-thumb__image-container',
+ timeContainer: 'plyr__preview-thumb__time-container',
+ // Scrubbing
+ scrubbingContainer: 'plyr__preview-scrubbing',
+ scrubbingContainerShown: 'plyr__preview-scrubbing--is-shown'
+ }
+ },
+ // Embed attributes
+ attributes: {
+ embed: {
+ provider: 'data-plyr-provider',
+ id: 'data-plyr-embed-id'
+ }
+ },
+ // Advertisements plugin
+ // Register for an account here: http://vi.ai/publisher-video-monetization/?aid=plyrio
+ ads: {
+ enabled: false,
+ publisherId: '',
+ tagUrl: ''
+ },
+ // Preview Thumbnails plugin
+ previewThumbnails: {
+ enabled: false,
+ src: ''
+ },
+ // Vimeo plugin
+ vimeo: {
+ byline: false,
+ portrait: false,
+ title: false,
+ speed: true,
+ transparent: false,
+ // Whether the owner of the video has a Pro or Business account
+ // (which allows us to properly hide controls without CSS hacks, etc)
+ premium: false,
+ // Custom settings from Plyr
+ referrerPolicy: null // https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement/referrerPolicy
+
+ },
+ // YouTube plugin
+ youtube: {
+ noCookie: true,
+ // Whether to use an alternative version of YouTube without cookies
+ rel: 0,
+ // No related vids
+ showinfo: 0,
+ // Hide info
+ iv_load_policy: 3,
+ // Hide annotations
+ modestbranding: 1 // Hide logos as much as possible (they still show one in the corner when paused)
+
+ }
+ };
+
+ // ==========================================================================
+ // Plyr states
+ // ==========================================================================
+ var pip = {
+ active: 'picture-in-picture',
+ inactive: 'inline'
+ };
+
+ // ==========================================================================
+ // Plyr supported types and providers
+ // ==========================================================================
+ var providers = {
+ html5: 'html5',
+ youtube: 'youtube',
+ vimeo: 'vimeo'
+ };
+ var types = {
+ audio: 'audio',
+ video: 'video'
+ };
+ /**
+ * Get provider by URL
+ * @param {String} url
+ */
+
+ function getProviderByUrl(url) {
+ // YouTube
+ if (/^(https?:\/\/)?(www\.)?(youtube\.com|youtube-nocookie\.com|youtu\.?be)\/.+$/.test(url)) {
+ return providers.youtube;
+ } // Vimeo
+
+
+ if (/^https?:\/\/player.vimeo.com\/video\/\d{0,9}(?=\b|\/)/.test(url)) {
+ return providers.vimeo;
+ }
+
+ return null;
+ }
+
+ // ==========================================================================
+ // Console wrapper
+ // ==========================================================================
+ var noop = function noop() {};
+
+ var Console = /*#__PURE__*/function () {
+ function Console() {
+ var enabled = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
+
+ _classCallCheck(this, Console);
+
+ this.enabled = window.console && enabled;
+
+ if (this.enabled) {
+ this.log('Debugging enabled');
+ }
+ }
+
+ _createClass(Console, [{
+ key: "log",
+ get: function get() {
+ // eslint-disable-next-line no-console
+ return this.enabled ? Function.prototype.bind.call(console.log, console) : noop;
+ }
+ }, {
+ key: "warn",
+ get: function get() {
+ // eslint-disable-next-line no-console
+ return this.enabled ? Function.prototype.bind.call(console.warn, console) : noop;
+ }
+ }, {
+ key: "error",
+ get: function get() {
+ // eslint-disable-next-line no-console
+ return this.enabled ? Function.prototype.bind.call(console.error, console) : noop;
+ }
+ }]);
+
+ return Console;
+ }();
+
+ var Fullscreen = /*#__PURE__*/function () {
+ function Fullscreen(player) {
+ var _this = this;
+
+ _classCallCheck(this, Fullscreen);
+
+ // Keep reference to parent
+ this.player = player; // Get prefix
+
+ this.prefix = Fullscreen.prefix;
+ this.property = Fullscreen.property; // Scroll position
+
+ this.scrollPosition = {
+ x: 0,
+ y: 0
+ }; // Force the use of 'full window/browser' rather than fullscreen
+
+ this.forceFallback = player.config.fullscreen.fallback === 'force'; // Get the fullscreen element
+ // Checks container is an ancestor, defaults to null
+
+ this.player.elements.fullscreen = player.config.fullscreen.container && closest(this.player.elements.container, player.config.fullscreen.container); // Register event listeners
+ // Handle event (incase user presses escape etc)
+
+ on.call(this.player, document, this.prefix === 'ms' ? 'MSFullscreenChange' : "".concat(this.prefix, "fullscreenchange"), function () {
+ // TODO: Filter for target??
+ _this.onChange();
+ }); // Fullscreen toggle on double click
+
+ on.call(this.player, this.player.elements.container, 'dblclick', function (event) {
+ // Ignore double click in controls
+ if (is$1.element(_this.player.elements.controls) && _this.player.elements.controls.contains(event.target)) {
+ return;
+ }
+
+ _this.toggle();
+ }); // Tap focus when in fullscreen
+
+ on.call(this, this.player.elements.container, 'keydown', function (event) {
+ return _this.trapFocus(event);
+ }); // Update the UI
+
+ this.update();
+ } // Determine if native supported
+
+
+ _createClass(Fullscreen, [{
+ key: "onChange",
+ value: function onChange() {
+ if (!this.enabled) {
+ return;
+ } // Update toggle button
+
+
+ var button = this.player.elements.buttons.fullscreen;
+
+ if (is$1.element(button)) {
+ button.pressed = this.active;
+ } // Trigger an event
+
+
+ triggerEvent.call(this.player, this.target, this.active ? 'enterfullscreen' : 'exitfullscreen', true);
+ }
+ }, {
+ key: "toggleFallback",
+ value: function toggleFallback() {
+ var toggle = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
+
+ // Store or restore scroll position
+ if (toggle) {
+ this.scrollPosition = {
+ x: window.scrollX || 0,
+ y: window.scrollY || 0
+ };
+ } else {
+ window.scrollTo(this.scrollPosition.x, this.scrollPosition.y);
+ } // Toggle scroll
+
+
+ document.body.style.overflow = toggle ? 'hidden' : ''; // Toggle class hook
+
+ toggleClass(this.target, this.player.config.classNames.fullscreen.fallback, toggle); // Force full viewport on iPhone X+
+
+ if (browser.isIos) {
+ var viewport = document.head.querySelector('meta[name="viewport"]');
+ var property = 'viewport-fit=cover'; // Inject the viewport meta if required
+
+ if (!viewport) {
+ viewport = document.createElement('meta');
+ viewport.setAttribute('name', 'viewport');
+ } // Check if the property already exists
+
+
+ var hasProperty = is$1.string(viewport.content) && viewport.content.includes(property);
+
+ if (toggle) {
+ this.cleanupViewport = !hasProperty;
+
+ if (!hasProperty) {
+ viewport.content += ",".concat(property);
+ }
+ } else if (this.cleanupViewport) {
+ viewport.content = viewport.content.split(',').filter(function (part) {
+ return part.trim() !== property;
+ }).join(',');
+ }
+ } // Toggle button and fire events
+
+
+ this.onChange();
+ } // Trap focus inside container
+
+ }, {
+ key: "trapFocus",
+ value: function trapFocus(event) {
+ // Bail if iOS, not active, not the tab key
+ if (browser.isIos || !this.active || event.key !== 'Tab' || event.keyCode !== 9) {
+ return;
+ } // Get the current focused element
+
+
+ var focused = document.activeElement;
+ var focusable = getElements.call(this.player, 'a[href], button:not(:disabled), input:not(:disabled), [tabindex]');
+
+ var _focusable = _slicedToArray(focusable, 1),
+ first = _focusable[0];
+
+ var last = focusable[focusable.length - 1];
+
+ if (focused === last && !event.shiftKey) {
+ // Move focus to first element that can be tabbed if Shift isn't used
+ first.focus();
+ event.preventDefault();
+ } else if (focused === first && event.shiftKey) {
+ // Move focus to last element that can be tabbed if Shift is used
+ last.focus();
+ event.preventDefault();
+ }
+ } // Update UI
+
+ }, {
+ key: "update",
+ value: function update() {
+ if (this.enabled) {
+ var mode;
+
+ if (this.forceFallback) {
+ mode = 'Fallback (forced)';
+ } else if (Fullscreen.native) {
+ mode = 'Native';
+ } else {
+ mode = 'Fallback';
+ }
+
+ this.player.debug.log("".concat(mode, " fullscreen enabled"));
+ } else {
+ this.player.debug.log('Fullscreen not supported and fallback disabled');
+ } // Add styling hook to show button
+
+
+ toggleClass(this.player.elements.container, this.player.config.classNames.fullscreen.enabled, this.enabled);
+ } // Make an element fullscreen
+
+ }, {
+ key: "enter",
+ value: function enter() {
+ if (!this.enabled) {
+ return;
+ } // iOS native fullscreen doesn't need the request step
+
+
+ if (browser.isIos && this.player.config.fullscreen.iosNative) {
+ this.target.webkitEnterFullscreen();
+ } else if (!Fullscreen.native || this.forceFallback) {
+ this.toggleFallback(true);
+ } else if (!this.prefix) {
+ this.target.requestFullscreen({
+ navigationUI: 'hide'
+ });
+ } else if (!is$1.empty(this.prefix)) {
+ this.target["".concat(this.prefix, "Request").concat(this.property)]();
+ }
+ } // Bail from fullscreen
+
+ }, {
+ key: "exit",
+ value: function exit() {
+ if (!this.enabled) {
+ return;
+ } // iOS native fullscreen
+
+
+ if (browser.isIos && this.player.config.fullscreen.iosNative) {
+ this.target.webkitExitFullscreen();
+ silencePromise(this.player.play());
+ } else if (!Fullscreen.native || this.forceFallback) {
+ this.toggleFallback(false);
+ } else if (!this.prefix) {
+ (document.cancelFullScreen || document.exitFullscreen).call(document);
+ } else if (!is$1.empty(this.prefix)) {
+ var action = this.prefix === 'moz' ? 'Cancel' : 'Exit';
+ document["".concat(this.prefix).concat(action).concat(this.property)]();
+ }
+ } // Toggle state
+
+ }, {
+ key: "toggle",
+ value: function toggle() {
+ if (!this.active) {
+ this.enter();
+ } else {
+ this.exit();
+ }
+ }
+ }, {
+ key: "usingNative",
+ // If we're actually using native
+ get: function get() {
+ return Fullscreen.native && !this.forceFallback;
+ } // Get the prefix for handlers
+
+ }, {
+ key: "enabled",
+ // Determine if fullscreen is enabled
+ get: function get() {
+ return (Fullscreen.native || this.player.config.fullscreen.fallback) && this.player.config.fullscreen.enabled && this.player.supported.ui && this.player.isVideo;
+ } // Get active state
+
+ }, {
+ key: "active",
+ get: function get() {
+ if (!this.enabled) {
+ return false;
+ } // Fallback using classname
+
+
+ if (!Fullscreen.native || this.forceFallback) {
+ return hasClass(this.target, this.player.config.classNames.fullscreen.fallback);
+ }
+
+ var element = !this.prefix ? document.fullscreenElement : document["".concat(this.prefix).concat(this.property, "Element")];
+ return element && element.shadowRoot ? element === this.target.getRootNode().host : element === this.target;
+ } // Get target element
+
+ }, {
+ key: "target",
+ get: function get() {
+ return browser.isIos && this.player.config.fullscreen.iosNative ? this.player.media : this.player.elements.fullscreen || this.player.elements.container;
+ }
+ }], [{
+ key: "native",
+ get: function get() {
+ return !!(document.fullscreenEnabled || document.webkitFullscreenEnabled || document.mozFullScreenEnabled || document.msFullscreenEnabled);
+ }
+ }, {
+ key: "prefix",
+ get: function get() {
+ // No prefix
+ if (is$1.function(document.exitFullscreen)) {
+ return '';
+ } // Check for fullscreen support by vendor prefix
+
+
+ var value = '';
+ var prefixes = ['webkit', 'moz', 'ms'];
+ prefixes.some(function (pre) {
+ if (is$1.function(document["".concat(pre, "ExitFullscreen")]) || is$1.function(document["".concat(pre, "CancelFullScreen")])) {
+ value = pre;
+ return true;
+ }
+
+ return false;
+ });
+ return value;
+ }
+ }, {
+ key: "property",
+ get: function get() {
+ return this.prefix === 'moz' ? 'FullScreen' : 'Fullscreen';
+ }
+ }]);
+
+ return Fullscreen;
+ }();
+
+ // ==========================================================================
+ // Load image avoiding xhr/fetch CORS issues
+ // Server status can't be obtained this way unfortunately, so this uses "naturalWidth" to determine if the image has loaded
+ // By default it checks if it is at least 1px, but you can add a second argument to change this
+ // ==========================================================================
+ function loadImage(src) {
+ var minWidth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
+ return new Promise(function (resolve, reject) {
+ var image = new Image();
+
+ var handler = function handler() {
+ delete image.onload;
+ delete image.onerror;
+ (image.naturalWidth >= minWidth ? resolve : reject)(image);
+ };
+
+ Object.assign(image, {
+ onload: handler,
+ onerror: handler,
+ src: src
+ });
+ });
+ }
+
+ var ui = {
+ addStyleHook: function addStyleHook() {
+ toggleClass(this.elements.container, this.config.selectors.container.replace('.', ''), true);
+ toggleClass(this.elements.container, this.config.classNames.uiSupported, this.supported.ui);
+ },
+ // Toggle native HTML5 media controls
+ toggleNativeControls: function toggleNativeControls() {
+ var toggle = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
+
+ if (toggle && this.isHTML5) {
+ this.media.setAttribute('controls', '');
+ } else {
+ this.media.removeAttribute('controls');
+ }
+ },
+ // Setup the UI
+ build: function build() {
+ var _this = this;
+
+ // Re-attach media element listeners
+ // TODO: Use event bubbling?
+ this.listeners.media(); // Don't setup interface if no support
+
+ if (!this.supported.ui) {
+ this.debug.warn("Basic support only for ".concat(this.provider, " ").concat(this.type)); // Restore native controls
+
+ ui.toggleNativeControls.call(this, true); // Bail
+
+ return;
+ } // Inject custom controls if not present
+
+
+ if (!is$1.element(this.elements.controls)) {
+ // Inject custom controls
+ controls.inject.call(this); // Re-attach control listeners
+
+ this.listeners.controls();
+ } // Remove native controls
+
+
+ ui.toggleNativeControls.call(this); // Setup captions for HTML5
+
+ if (this.isHTML5) {
+ captions.setup.call(this);
+ } // Reset volume
+
+
+ this.volume = null; // Reset mute state
+
+ this.muted = null; // Reset loop state
+
+ this.loop = null; // Reset quality setting
+
+ this.quality = null; // Reset speed
+
+ this.speed = null; // Reset volume display
+
+ controls.updateVolume.call(this); // Reset time display
+
+ controls.timeUpdate.call(this); // Update the UI
+
+ ui.checkPlaying.call(this); // Check for picture-in-picture support
+
+ toggleClass(this.elements.container, this.config.classNames.pip.supported, support.pip && this.isHTML5 && this.isVideo); // Check for airplay support
+
+ toggleClass(this.elements.container, this.config.classNames.airplay.supported, support.airplay && this.isHTML5); // Add iOS class
+
+ toggleClass(this.elements.container, this.config.classNames.isIos, browser.isIos); // Add touch class
+
+ toggleClass(this.elements.container, this.config.classNames.isTouch, this.touch); // Ready for API calls
+
+ this.ready = true; // Ready event at end of execution stack
+
+ setTimeout(function () {
+ triggerEvent.call(_this, _this.media, 'ready');
+ }, 0); // Set the title
+
+ ui.setTitle.call(this); // Assure the poster image is set, if the property was added before the element was created
+
+ if (this.poster) {
+ ui.setPoster.call(this, this.poster, false).catch(function () {});
+ } // Manually set the duration if user has overridden it.
+ // The event listeners for it doesn't get called if preload is disabled (#701)
+
+
+ if (this.config.duration) {
+ controls.durationUpdate.call(this);
+ }
+ },
+ // Setup aria attribute for play and iframe title
+ setTitle: function setTitle() {
+ // Find the current text
+ var label = i18n.get('play', this.config); // If there's a media title set, use that for the label
+
+ if (is$1.string(this.config.title) && !is$1.empty(this.config.title)) {
+ label += ", ".concat(this.config.title);
+ } // If there's a play button, set label
+
+
+ Array.from(this.elements.buttons.play || []).forEach(function (button) {
+ button.setAttribute('aria-label', label);
+ }); // Set iframe title
+ // https://github.com/sampotts/plyr/issues/124
+
+ if (this.isEmbed) {
+ var iframe = getElement.call(this, 'iframe');
+
+ if (!is$1.element(iframe)) {
+ return;
+ } // Default to media type
+
+
+ var title = !is$1.empty(this.config.title) ? this.config.title : 'video';
+ var format = i18n.get('frameTitle', this.config);
+ iframe.setAttribute('title', format.replace('{title}', title));
+ }
+ },
+ // Toggle poster
+ togglePoster: function togglePoster(enable) {
+ toggleClass(this.elements.container, this.config.classNames.posterEnabled, enable);
+ },
+ // Set the poster image (async)
+ // Used internally for the poster setter, with the passive option forced to false
+ setPoster: function setPoster(poster) {
+ var _this2 = this;
+
+ var passive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
+
+ // Don't override if call is passive
+ if (passive && this.poster) {
+ return Promise.reject(new Error('Poster already set'));
+ } // Set property synchronously to respect the call order
+
+
+ this.media.setAttribute('data-poster', poster); // Wait until ui is ready
+
+ return ready.call(this) // Load image
+ .then(function () {
+ return loadImage(poster);
+ }).catch(function (err) {
+ // Hide poster on error unless it's been set by another call
+ if (poster === _this2.poster) {
+ ui.togglePoster.call(_this2, false);
+ } // Rethrow
+
+
+ throw err;
+ }).then(function () {
+ // Prevent race conditions
+ if (poster !== _this2.poster) {
+ throw new Error('setPoster cancelled by later call to setPoster');
+ }
+ }).then(function () {
+ Object.assign(_this2.elements.poster.style, {
+ backgroundImage: "url('".concat(poster, "')"),
+ // Reset backgroundSize as well (since it can be set to "cover" for padded thumbnails for youtube)
+ backgroundSize: ''
+ });
+ ui.togglePoster.call(_this2, true);
+ return poster;
+ });
+ },
+ // Check playing state
+ checkPlaying: function checkPlaying(event) {
+ var _this3 = this;
+
+ // Class hooks
+ toggleClass(this.elements.container, this.config.classNames.playing, this.playing);
+ toggleClass(this.elements.container, this.config.classNames.paused, this.paused);
+ toggleClass(this.elements.container, this.config.classNames.stopped, this.stopped); // Set state
+
+ Array.from(this.elements.buttons.play || []).forEach(function (target) {
+ Object.assign(target, {
+ pressed: _this3.playing
+ });
+ target.setAttribute('aria-label', i18n.get(_this3.playing ? 'pause' : 'play', _this3.config));
+ }); // Only update controls on non timeupdate events
+
+ if (is$1.event(event) && event.type === 'timeupdate') {
+ return;
+ } // Toggle controls
+
+
+ ui.toggleControls.call(this);
+ },
+ // Check if media is loading
+ checkLoading: function checkLoading(event) {
+ var _this4 = this;
+
+ this.loading = ['stalled', 'waiting'].includes(event.type); // Clear timer
+
+ clearTimeout(this.timers.loading); // Timer to prevent flicker when seeking
+
+ this.timers.loading = setTimeout(function () {
+ // Update progress bar loading class state
+ toggleClass(_this4.elements.container, _this4.config.classNames.loading, _this4.loading); // Update controls visibility
+
+ ui.toggleControls.call(_this4);
+ }, this.loading ? 250 : 0);
+ },
+ // Toggle controls based on state and `force` argument
+ toggleControls: function toggleControls(force) {
+ var controlsElement = this.elements.controls;
+
+ if (controlsElement && this.config.hideControls) {
+ // 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.)
+ var recentTouchSeek = this.touch && this.lastSeekTime + 2000 > Date.now(); // Show controls if force, loading, paused, button interaction, or recent seek, otherwise hide
+
+ this.toggleControls(Boolean(force || this.loading || this.paused || controlsElement.pressed || controlsElement.hover || recentTouchSeek));
+ }
+ },
+ // Migrate any custom properties from the media to the parent
+ migrateStyles: function migrateStyles() {
+ var _this5 = this;
+
+ // Loop through values (as they are the keys when the object is spread 🤔)
+ Object.values(_objectSpread2({}, this.media.style)) // We're only fussed about Plyr specific properties
+ .filter(function (key) {
+ return !is$1.empty(key) && key.startsWith('--plyr');
+ }).forEach(function (key) {
+ // Set on the container
+ _this5.elements.container.style.setProperty(key, _this5.media.style.getPropertyValue(key)); // Clean up from media element
+
+
+ _this5.media.style.removeProperty(key);
+ }); // Remove attribute if empty
+
+ if (is$1.empty(this.media.style)) {
+ this.media.removeAttribute('style');
+ }
+ }
+ };
+
+ var Listeners = /*#__PURE__*/function () {
+ function Listeners(player) {
+ _classCallCheck(this, Listeners);
+
+ this.player = player;
+ this.lastKey = null;
+ this.focusTimer = null;
+ this.lastKeyDown = null;
+ this.handleKey = this.handleKey.bind(this);
+ this.toggleMenu = this.toggleMenu.bind(this);
+ this.setTabFocus = this.setTabFocus.bind(this);
+ this.firstTouch = this.firstTouch.bind(this);
+ } // Handle key presses
+
+
+ _createClass(Listeners, [{
+ key: "handleKey",
+ value: function handleKey(event) {
+ var player = this.player;
+ var elements = player.elements;
+ var code = event.keyCode ? event.keyCode : event.which;
+ var pressed = event.type === 'keydown';
+ var repeat = pressed && code === this.lastKey; // Bail if a modifier key is set
+
+ if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) {
+ return;
+ } // If the event is bubbled from the media element
+ // Firefox doesn't get the keycode for whatever reason
+
+
+ if (!is$1.number(code)) {
+ return;
+ } // Seek by the number keys
+
+
+ var seekByKey = function seekByKey() {
+ // Divide the max duration into 10th's and times by the number value
+ player.currentTime = player.duration / 10 * (code - 48);
+ }; // Handle the key on keydown
+ // Reset on keyup
+
+
+ if (pressed) {
+ // Check focused element
+ // and if the focused element is not editable (e.g. text input)
+ // and any that accept key input http://webaim.org/techniques/keyboard/
+ var focused = document.activeElement;
+
+ if (is$1.element(focused)) {
+ var editable = player.config.selectors.editable;
+ var seek = elements.inputs.seek;
+
+ if (focused !== seek && matches$1(focused, editable)) {
+ return;
+ }
+
+ if (event.which === 32 && matches$1(focused, 'button, [role^="menuitem"]')) {
+ return;
+ }
+ } // Which keycodes should we prevent default
+
+
+ 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)
+
+ if (preventDefault.includes(code)) {
+ event.preventDefault();
+ event.stopPropagation();
+ }
+
+ switch (code) {
+ case 48:
+ case 49:
+ case 50:
+ case 51:
+ case 52:
+ case 53:
+ case 54:
+ case 55:
+ case 56:
+ case 57:
+ // 0-9
+ if (!repeat) {
+ seekByKey();
+ }
+
+ break;
+
+ case 32:
+ case 75:
+ // Space and K key
+ if (!repeat) {
+ silencePromise(player.togglePlay());
+ }
+
+ break;
+
+ case 38:
+ // Arrow up
+ player.increaseVolume(0.1);
+ break;
+
+ case 40:
+ // Arrow down
+ player.decreaseVolume(0.1);
+ break;
+
+ case 77:
+ // M key
+ if (!repeat) {
+ player.muted = !player.muted;
+ }
+
+ break;
+
+ case 39:
+ // Arrow forward
+ player.forward();
+ break;
+
+ case 37:
+ // Arrow back
+ player.rewind();
+ break;
+
+ case 70:
+ // F key
+ player.fullscreen.toggle();
+ break;
+
+ case 67:
+ // C key
+ if (!repeat) {
+ player.toggleCaptions();
+ }
+
+ break;
+
+ case 76:
+ // L key
+ player.loop = !player.loop;
+ break;
+ } // Escape is handle natively when in full screen
+ // So we only need to worry about non native
+
+
+ if (code === 27 && !player.fullscreen.usingNative && player.fullscreen.active) {
+ player.fullscreen.toggle();
+ } // Store last code for next cycle
+
+
+ this.lastKey = code;
+ } else {
+ this.lastKey = null;
+ }
+ } // Toggle menu
+
+ }, {
+ key: "toggleMenu",
+ value: function toggleMenu(event) {
+ controls.toggleMenu.call(this.player, event);
+ } // Device is touch enabled
+
+ }, {
+ key: "firstTouch",
+ value: function firstTouch() {
+ var player = this.player;
+ var elements = player.elements;
+ player.touch = true; // Add touch class
+
+ toggleClass(elements.container, player.config.classNames.isTouch, true);
+ }
+ }, {
+ key: "setTabFocus",
+ value: function setTabFocus(event) {
+ var player = this.player;
+ var elements = player.elements;
+ clearTimeout(this.focusTimer); // Ignore any key other than tab
+
+ if (event.type === 'keydown' && event.which !== 9) {
+ return;
+ } // Store reference to event timeStamp
+
+
+ if (event.type === 'keydown') {
+ this.lastKeyDown = event.timeStamp;
+ } // Remove current classes
+
+
+ var removeCurrent = function removeCurrent() {
+ var className = player.config.classNames.tabFocus;
+ var current = getElements.call(player, ".".concat(className));
+ toggleClass(current, className, false);
+ }; // Determine if a key was pressed to trigger this event
+
+
+ var wasKeyDown = event.timeStamp - this.lastKeyDown <= 20; // Ignore focus events if a key was pressed prior
+
+ if (event.type === 'focus' && !wasKeyDown) {
+ return;
+ } // Remove all current
+
+
+ removeCurrent(); // Delay the adding of classname until the focus has changed
+ // This event fires before the focusin event
+
+ if (event.type !== 'focusout') {
+ this.focusTimer = setTimeout(function () {
+ var focused = document.activeElement; // Ignore if current focus element isn't inside the player
+
+ if (!elements.container.contains(focused)) {
+ return;
+ }
+
+ toggleClass(document.activeElement, player.config.classNames.tabFocus, true);
+ }, 10);
+ }
+ } // Global window & document listeners
+
+ }, {
+ key: "global",
+ value: function global() {
+ var toggle = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
+ var player = this.player; // Keyboard shortcuts
+
+ if (player.config.keyboard.global) {
+ toggleListener.call(player, window, 'keydown keyup', this.handleKey, toggle, false);
+ } // Click anywhere closes menu
+
+
+ toggleListener.call(player, document.body, 'click', this.toggleMenu, toggle); // Detect touch by events
+
+ once.call(player, document.body, 'touchstart', this.firstTouch); // Tab focus detection
+
+ toggleListener.call(player, document.body, 'keydown focus blur focusout', this.setTabFocus, toggle, false, true);
+ } // Container listeners
+
+ }, {
+ key: "container",
+ value: function container() {
+ var player = this.player;
+ var config = player.config,
+ elements = player.elements,
+ timers = player.timers; // Keyboard shortcuts
+
+ if (!config.keyboard.global && config.keyboard.focused) {
+ on.call(player, elements.container, 'keydown keyup', this.handleKey, false);
+ } // Toggle controls on mouse events and entering fullscreen
+
+
+ on.call(player, elements.container, 'mousemove mouseleave touchstart touchmove enterfullscreen exitfullscreen', function (event) {
+ var controlsElement = elements.controls; // Remove button states for fullscreen
+
+ if (controlsElement && event.type === 'enterfullscreen') {
+ controlsElement.pressed = false;
+ controlsElement.hover = false;
+ } // Show, then hide after a timeout unless another control event occurs
+
+
+ var show = ['touchstart', 'touchmove', 'mousemove'].includes(event.type);
+ var delay = 0;
+
+ if (show) {
+ ui.toggleControls.call(player, true); // Use longer timeout for touch devices
+
+ delay = player.touch ? 3000 : 2000;
+ } // Clear timer
+
+
+ clearTimeout(timers.controls); // Set new timer to prevent flicker when seeking
+
+ timers.controls = setTimeout(function () {
+ return ui.toggleControls.call(player, false);
+ }, delay);
+ }); // Set a gutter for Vimeo
+
+ var setGutter = function setGutter(ratio, padding, toggle) {
+ if (!player.isVimeo || player.config.vimeo.premium) {
+ return;
+ }
+
+ var target = player.elements.wrapper.firstChild;
+
+ var _ratio = _slicedToArray(ratio, 2),
+ y = _ratio[1];
+
+ var _getAspectRatio$call = getAspectRatio.call(player),
+ _getAspectRatio$call2 = _slicedToArray(_getAspectRatio$call, 2),
+ videoX = _getAspectRatio$call2[0],
+ videoY = _getAspectRatio$call2[1];
+
+ target.style.maxWidth = toggle ? "".concat(y / videoY * videoX, "px") : null;
+ target.style.margin = toggle ? '0 auto' : null;
+ }; // Resize on fullscreen change
+
+
+ var setPlayerSize = function setPlayerSize(measure) {
+ // If we don't need to measure the viewport
+ if (!measure) {
+ return setAspectRatio.call(player);
+ }
+
+ var rect = elements.container.getBoundingClientRect();
+ var width = rect.width,
+ height = rect.height;
+ return setAspectRatio.call(player, "".concat(width, ":").concat(height));
+ };
+
+ var resized = function resized() {
+ clearTimeout(timers.resized);
+ timers.resized = setTimeout(setPlayerSize, 50);
+ };
+
+ on.call(player, elements.container, 'enterfullscreen exitfullscreen', function (event) {
+ var _player$fullscreen = player.fullscreen,
+ target = _player$fullscreen.target,
+ usingNative = _player$fullscreen.usingNative; // Ignore events not from target
+
+ if (target !== elements.container) {
+ return;
+ } // If it's not an embed and no ratio specified
+
+
+ if (!player.isEmbed && is$1.empty(player.config.ratio)) {
+ return;
+ }
+
+ var isEnter = event.type === 'enterfullscreen'; // Set the player size when entering fullscreen to viewport size
+
+ var _setPlayerSize = setPlayerSize(isEnter),
+ padding = _setPlayerSize.padding,
+ ratio = _setPlayerSize.ratio; // Set Vimeo gutter
+
+
+ setGutter(ratio, padding, isEnter); // If not using native browser fullscreen API, we need to check for resizes of viewport
+
+ if (!usingNative) {
+ if (isEnter) {
+ on.call(player, window, 'resize', resized);
+ } else {
+ off.call(player, window, 'resize', resized);
+ }
+ }
+ });
+ } // Listen for media events
+
+ }, {
+ key: "media",
+ value: function media() {
+ var _this = this;
+
+ var player = this.player;
+ var elements = player.elements; // Time change on media
+
+ on.call(player, player.media, 'timeupdate seeking seeked', function (event) {
+ return controls.timeUpdate.call(player, event);
+ }); // Display duration
+
+ on.call(player, player.media, 'durationchange loadeddata loadedmetadata', function (event) {
+ return controls.durationUpdate.call(player, event);
+ }); // Handle the media finishing
+
+ on.call(player, player.media, 'ended', function () {
+ // Show poster on end
+ if (player.isHTML5 && player.isVideo && player.config.resetOnEnd) {
+ // Restart
+ player.restart(); // Call pause otherwise IE11 will start playing the video again
+
+ player.pause();
+ }
+ }); // Check for buffer progress
+
+ on.call(player, player.media, 'progress playing seeking seeked', function (event) {
+ return controls.updateProgress.call(player, event);
+ }); // Handle volume changes
+
+ on.call(player, player.media, 'volumechange', function (event) {
+ return controls.updateVolume.call(player, event);
+ }); // Handle play/pause
+
+ on.call(player, player.media, 'playing play pause ended emptied timeupdate', function (event) {
+ return ui.checkPlaying.call(player, event);
+ }); // Loading state
+
+ on.call(player, player.media, 'waiting canplay seeked playing', function (event) {
+ return ui.checkLoading.call(player, event);
+ }); // Click video
+
+ if (player.supported.ui && player.config.clickToPlay && !player.isAudio) {
+ // Re-fetch the wrapper
+ var wrapper = getElement.call(player, ".".concat(player.config.classNames.video)); // Bail if there's no wrapper (this should never happen)
+
+ if (!is$1.element(wrapper)) {
+ return;
+ } // On click play, pause or restart
+
+
+ on.call(player, elements.container, 'click', function (event) {
+ var targets = [elements.container, wrapper]; // Ignore if click if not container or in video wrapper
+
+ if (!targets.includes(event.target) && !wrapper.contains(event.target)) {
+ return;
+ } // Touch devices will just show controls (if hidden)
+
+
+ if (player.touch && player.config.hideControls) {
+ return;
+ }
+
+ if (player.ended) {
+ _this.proxy(event, player.restart, 'restart');
+
+ _this.proxy(event, function () {
+ silencePromise(player.play());
+ }, 'play');
+ } else {
+ _this.proxy(event, function () {
+ silencePromise(player.togglePlay());
+ }, 'play');
+ }
+ });
+ } // Disable right click
+
+
+ if (player.supported.ui && player.config.disableContextMenu) {
+ on.call(player, elements.wrapper, 'contextmenu', function (event) {
+ event.preventDefault();
+ }, false);
+ } // Volume change
+
+
+ on.call(player, player.media, 'volumechange', function () {
+ // Save to storage
+ player.storage.set({
+ volume: player.volume,
+ muted: player.muted
+ });
+ }); // Speed change
+
+ on.call(player, player.media, 'ratechange', function () {
+ // Update UI
+ controls.updateSetting.call(player, 'speed'); // Save to storage
+
+
+ player.storage.set({
+ speed: player.speed
+ });
+ }); // Quality change
+
+ on.call(player, player.media, 'qualitychange', function (event) {
+ // Update UI
+ controls.updateSetting.call(player, 'quality', null, event.detail.quality);
+ }); // Update download link when ready and if quality changes
+
+ on.call(player, player.media, 'ready qualitychange', function () {
+ controls.setDownloadUrl.call(player);
+ }); // Proxy events to container
+ // Bubble up key events for Edge
+
+ var proxyEvents = player.config.events.concat(['keyup', 'keydown']).join(' ');
+ on.call(player, player.media, proxyEvents, function (event) {
+ var _event$detail = event.detail,
+ detail = _event$detail === void 0 ? {} : _event$detail; // Get error details from media
+
+ if (event.type === 'error') {
+ detail = player.media.error;
+ }
+
+ triggerEvent.call(player, elements.container, event.type, true, detail);
+ });
+ } // Run default and custom handlers
+
+ }, {
+ key: "proxy",
+ value: function proxy(event, defaultHandler, customHandlerKey) {
+ var player = this.player;
+ var customHandler = player.config.listeners[customHandlerKey];
+ var hasCustomHandler = is$1.function(customHandler);
+ var returned = true; // Execute custom handler
+
+ if (hasCustomHandler) {
+ returned = customHandler.call(player, event);
+ } // Only call default handler if not prevented in custom handler
+
+
+ if (returned !== false && is$1.function(defaultHandler)) {
+ defaultHandler.call(player, event);
+ }
+ } // Trigger custom and default handlers
+
+ }, {
+ key: "bind",
+ value: function bind(element, type, defaultHandler, customHandlerKey) {
+ var _this2 = this;
+
+ var passive = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
+ var player = this.player;
+ var customHandler = player.config.listeners[customHandlerKey];
+ var hasCustomHandler = is$1.function(customHandler);
+ on.call(player, element, type, function (event) {
+ return _this2.proxy(event, defaultHandler, customHandlerKey);
+ }, passive && !hasCustomHandler);
+ } // Listen for control events
+
+ }, {
+ key: "controls",
+ value: function controls$1() {
+ var _this3 = this;
+
+ var player = this.player;
+ var elements = player.elements; // IE doesn't support input event, so we fallback to change
+
+ var inputEvent = browser.isIE ? 'change' : 'input'; // Play/pause toggle
+
+ if (elements.buttons.play) {
+ Array.from(elements.buttons.play).forEach(function (button) {
+ _this3.bind(button, 'click', function () {
+ silencePromise(player.togglePlay());
+ }, 'play');
+ });
+ } // Pause
+
+
+ this.bind(elements.buttons.restart, 'click', player.restart, 'restart'); // Rewind
+
+ this.bind(elements.buttons.rewind, 'click', player.rewind, 'rewind'); // Rewind
+
+ this.bind(elements.buttons.fastForward, 'click', player.forward, 'fastForward'); // Mute toggle
+
+ this.bind(elements.buttons.mute, 'click', function () {
+ player.muted = !player.muted;
+ }, 'mute'); // Captions toggle
+
+ this.bind(elements.buttons.captions, 'click', function () {
+ return player.toggleCaptions();
+ }); // Download
+
+ this.bind(elements.buttons.download, 'click', function () {
+ triggerEvent.call(player, player.media, 'download');
+ }, 'download'); // Fullscreen toggle
+
+ this.bind(elements.buttons.fullscreen, 'click', function () {
+ player.fullscreen.toggle();
+ }, 'fullscreen'); // Picture-in-Picture
+
+ this.bind(elements.buttons.pip, 'click', function () {
+ player.pip = 'toggle';
+ }, 'pip'); // Airplay
+
+ this.bind(elements.buttons.airplay, 'click', player.airplay, 'airplay'); // Settings menu - click toggle
+
+ this.bind(elements.buttons.settings, 'click', function (event) {
+ // Prevent the document click listener closing the menu
+ event.stopPropagation();
+ event.preventDefault();
+
+ controls.toggleMenu.call(player, event);
+ }, null, false); // Can't be passive as we're preventing default
+ // Settings menu - keyboard toggle
+ // We have to bind to keyup otherwise Firefox triggers a click when a keydown event handler shifts focus
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=1220143
+
+ this.bind(elements.buttons.settings, 'keyup', function (event) {
+ var code = event.which; // We only care about space and return
+
+ if (![13, 32].includes(code)) {
+ return;
+ } // Because return triggers a click anyway, all we need to do is set focus
+
+
+ if (code === 13) {
+ controls.focusFirstMenuItem.call(player, null, true);
+
+ return;
+ } // Prevent scroll
+
+
+ event.preventDefault(); // Prevent playing video (Firefox)
+
+ event.stopPropagation(); // Toggle menu
+
+ controls.toggleMenu.call(player, event);
+ }, null, false // Can't be passive as we're preventing default
+ ); // Escape closes menu
+
+ this.bind(elements.settings.menu, 'keydown', function (event) {
+ if (event.which === 27) {
+ controls.toggleMenu.call(player, event);
+ }
+ }); // Set range input alternative "value", which matches the tooltip time (#954)
+
+ this.bind(elements.inputs.seek, 'mousedown mousemove', function (event) {
+ var rect = elements.progress.getBoundingClientRect();
+ var percent = 100 / rect.width * (event.pageX - rect.left);
+ event.currentTarget.setAttribute('seek-value', percent);
+ }); // Pause while seeking
+
+ this.bind(elements.inputs.seek, 'mousedown mouseup keydown keyup touchstart touchend', function (event) {
+ var seek = event.currentTarget;
+ var code = event.keyCode ? event.keyCode : event.which;
+ var attribute = 'play-on-seeked';
+
+ if (is$1.keyboardEvent(event) && code !== 39 && code !== 37) {
+ return;
+ } // Record seek time so we can prevent hiding controls for a few seconds after seek
+
+
+ player.lastSeekTime = Date.now(); // Was playing before?
+
+ var play = seek.hasAttribute(attribute); // Done seeking
+
+ var done = ['mouseup', 'touchend', 'keyup'].includes(event.type); // If we're done seeking and it was playing, resume playback
+
+ if (play && done) {
+ seek.removeAttribute(attribute);
+ silencePromise(player.play());
+ } else if (!done && player.playing) {
+ seek.setAttribute(attribute, '');
+ player.pause();
+ }
+ }); // Fix range inputs on iOS
+ // Super weird iOS bug where after you interact with an <input type="range">,
+ // it takes over further interactions on the page. This is a hack
+
+ if (browser.isIos) {
+ var inputs = getElements.call(player, 'input[type="range"]');
+ Array.from(inputs).forEach(function (input) {
+ return _this3.bind(input, inputEvent, function (event) {
+ return repaint(event.target);
+ });
+ });
+ } // Seek
+
+
+ this.bind(elements.inputs.seek, inputEvent, function (event) {
+ var seek = event.currentTarget; // If it exists, use seek-value instead of "value" for consistency with tooltip time (#954)
+
+ var seekTo = seek.getAttribute('seek-value');
+
+ if (is$1.empty(seekTo)) {
+ seekTo = seek.value;
+ }
+
+ seek.removeAttribute('seek-value');
+ player.currentTime = seekTo / seek.max * player.duration;
+ }, 'seek'); // Seek tooltip
+
+ this.bind(elements.progress, 'mouseenter mouseleave mousemove', function (event) {
+ return controls.updateSeekTooltip.call(player, event);
+ }); // Preview thumbnails plugin
+ // TODO: Really need to work on some sort of plug-in wide event bus or pub-sub for this
+
+ this.bind(elements.progress, 'mousemove touchmove', function (event) {
+ var previewThumbnails = player.previewThumbnails;
+
+ if (previewThumbnails && previewThumbnails.loaded) {
+ previewThumbnails.startMove(event);
+ }
+ }); // Hide thumbnail preview - on mouse click, mouse leave, and video play/seek. All four are required, e.g., for buffering
+
+ this.bind(elements.progress, 'mouseleave touchend click', function () {
+ var previewThumbnails = player.previewThumbnails;
+
+ if (previewThumbnails && previewThumbnails.loaded) {
+ previewThumbnails.endMove(false, true);
+ }
+ }); // Show scrubbing preview
+
+ this.bind(elements.progress, 'mousedown touchstart', function (event) {
+ var previewThumbnails = player.previewThumbnails;
+
+ if (previewThumbnails && previewThumbnails.loaded) {
+ previewThumbnails.startScrubbing(event);
+ }
+ });
+ this.bind(elements.progress, 'mouseup touchend', function (event) {
+ var previewThumbnails = player.previewThumbnails;
+
+ if (previewThumbnails && previewThumbnails.loaded) {
+ previewThumbnails.endScrubbing(event);
+ }
+ }); // Polyfill for lower fill in <input type="range"> for webkit
+
+ if (browser.isWebkit) {
+ Array.from(getElements.call(player, 'input[type="range"]')).forEach(function (element) {
+ _this3.bind(element, 'input', function (event) {
+ return controls.updateRangeFill.call(player, event.target);
+ });
+ });
+ } // Current time invert
+ // Only if one time element is used for both currentTime and duration
+
+
+ if (player.config.toggleInvert && !is$1.element(elements.display.duration)) {
+ this.bind(elements.display.currentTime, 'click', function () {
+ // Do nothing if we're at the start
+ if (player.currentTime === 0) {
+ return;
+ }
+
+ player.config.invertTime = !player.config.invertTime;
+
+ controls.timeUpdate.call(player);
+ });
+ } // Volume
+
+
+ this.bind(elements.inputs.volume, inputEvent, function (event) {
+ player.volume = event.target.value;
+ }, 'volume'); // Update controls.hover state (used for ui.toggleControls to avoid hiding when interacting)
+
+ this.bind(elements.controls, 'mouseenter mouseleave', function (event) {
+ elements.controls.hover = !player.touch && event.type === 'mouseenter';
+ }); // Also update controls.hover state for any non-player children of fullscreen element (as above)
+
+ if (elements.fullscreen) {
+ Array.from(elements.fullscreen.children).filter(function (c) {
+ return !c.contains(elements.container);
+ }).forEach(function (child) {
+ _this3.bind(child, 'mouseenter mouseleave', function (event) {
+ elements.controls.hover = !player.touch && event.type === 'mouseenter';
+ });
+ });
+ } // Update controls.pressed state (used for ui.toggleControls to avoid hiding when interacting)
+
+
+ this.bind(elements.controls, 'mousedown mouseup touchstart touchend touchcancel', function (event) {
+ elements.controls.pressed = ['mousedown', 'touchstart'].includes(event.type);
+ }); // Show controls when they receive focus (e.g., when using keyboard tab key)
+
+ this.bind(elements.controls, 'focusin', function () {
+ var config = player.config,
+ timers = player.timers; // Skip transition to prevent focus from scrolling the parent element
+
+ toggleClass(elements.controls, config.classNames.noTransition, true); // Toggle
+
+ ui.toggleControls.call(player, true); // Restore transition
+
+ setTimeout(function () {
+ toggleClass(elements.controls, config.classNames.noTransition, false);
+ }, 0); // Delay a little more for mouse users
+
+ var delay = _this3.touch ? 3000 : 4000; // Clear timer
+
+ clearTimeout(timers.controls); // Hide again after delay
+
+ timers.controls = setTimeout(function () {
+ return ui.toggleControls.call(player, false);
+ }, delay);
+ }); // Mouse wheel for volume
+
+ this.bind(elements.inputs.volume, 'wheel', function (event) {
+ // Detect "natural" scroll - suppored on OS X Safari only
+ // Other browsers on OS X will be inverted until support improves
+ var inverted = event.webkitDirectionInvertedFromDevice; // Get delta from event. Invert if `inverted` is true
+
+ var _map = [event.deltaX, -event.deltaY].map(function (value) {
+ return inverted ? -value : value;
+ }),
+ _map2 = _slicedToArray(_map, 2),
+ x = _map2[0],
+ y = _map2[1]; // Using the biggest delta, normalize to 1 or -1 (or 0 if no delta)
+
+
+ var direction = Math.sign(Math.abs(x) > Math.abs(y) ? x : y); // Change the volume by 2%
+
+ player.increaseVolume(direction / 50); // Don't break page scrolling at max and min
+
+ var volume = player.media.volume;
+
+ if (direction === 1 && volume < 1 || direction === -1 && volume > 0) {
+ event.preventDefault();
+ }
+ }, 'volume', false);
+ }
+ }]);
+
+ return Listeners;
+ }();
+
+ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
+
+ function createCommonjsModule(fn, module) {
+ return module = { exports: {} }, fn(module, module.exports), module.exports;
+ }
+
+ var loadjs_umd = createCommonjsModule(function (module, exports) {
+ (function (root, factory) {
+ {
+ module.exports = factory();
+ }
+ })(commonjsGlobal, function () {
+ /**
+ * Global dependencies.
+ * @global {Object} document - DOM
+ */
+ var devnull = function devnull() {},
+ bundleIdCache = {},
+ bundleResultCache = {},
+ bundleCallbackQueue = {};
+ /**
+ * Subscribe to bundle load event.
+ * @param {string[]} bundleIds - Bundle ids
+ * @param {Function} callbackFn - The callback function
+ */
+
+
+ function subscribe(bundleIds, callbackFn) {
+ // listify
+ bundleIds = bundleIds.push ? bundleIds : [bundleIds];
+ var depsNotFound = [],
+ i = bundleIds.length,
+ numWaiting = i,
+ fn,
+ bundleId,
+ r,
+ q; // define callback function
+
+ fn = function fn(bundleId, pathsNotFound) {
+ if (pathsNotFound.length) depsNotFound.push(bundleId);
+ numWaiting--;
+ if (!numWaiting) callbackFn(depsNotFound);
+ }; // register callback
+
+
+ while (i--) {
+ bundleId = bundleIds[i]; // execute callback if in result cache
+
+ r = bundleResultCache[bundleId];
+
+ if (r) {
+ fn(bundleId, r);
+ continue;
+ } // add to callback queue
+
+
+ q = bundleCallbackQueue[bundleId] = bundleCallbackQueue[bundleId] || [];
+ q.push(fn);
+ }
+ }
+ /**
+ * Publish bundle load event.
+ * @param {string} bundleId - Bundle id
+ * @param {string[]} pathsNotFound - List of files not found
+ */
+
+
+ function publish(bundleId, pathsNotFound) {
+ // exit if id isn't defined
+ if (!bundleId) return;
+ var q = bundleCallbackQueue[bundleId]; // cache result
+
+ bundleResultCache[bundleId] = pathsNotFound; // exit if queue is empty
+
+ if (!q) return; // empty callback queue
+
+ while (q.length) {
+ q[0](bundleId, pathsNotFound);
+ q.splice(0, 1);
+ }
+ }
+ /**
+ * Execute callbacks.
+ * @param {Object or Function} args - The callback args
+ * @param {string[]} depsNotFound - List of dependencies not found
+ */
+
+
+ function executeCallbacks(args, depsNotFound) {
+ // accept function as argument
+ if (args.call) args = {
+ success: args
+ }; // success and error callbacks
+
+ if (depsNotFound.length) (args.error || devnull)(depsNotFound);else (args.success || devnull)(args);
+ }
+ /**
+ * Load individual file.
+ * @param {string} path - The file path
+ * @param {Function} callbackFn - The callback function
+ */
+
+
+ function loadFile(path, callbackFn, args, numTries) {
+ var doc = document,
+ async = args.async,
+ maxTries = (args.numRetries || 0) + 1,
+ beforeCallbackFn = args.before || devnull,
+ pathname = path.replace(/[\?|#].*$/, ''),
+ pathStripped = path.replace(/^(css|img)!/, ''),
+ isLegacyIECss,
+ e;
+ numTries = numTries || 0;
+
+ if (/(^css!|\.css$)/.test(pathname)) {
+ // css
+ e = doc.createElement('link');
+ e.rel = 'stylesheet';
+ e.href = pathStripped; // tag IE9+
+
+ isLegacyIECss = 'hideFocus' in e; // use preload in IE Edge (to detect load errors)
+
+ if (isLegacyIECss && e.relList) {
+ isLegacyIECss = 0;
+ e.rel = 'preload';
+ e.as = 'style';
+ }
+ } else if (/(^img!|\.(png|gif|jpg|svg|webp)$)/.test(pathname)) {
+ // image
+ e = doc.createElement('img');
+ e.src = pathStripped;
+ } else {
+ // javascript
+ e = doc.createElement('script');
+ e.src = path;
+ e.async = async === undefined ? true : async;
+ }
+
+ e.onload = e.onerror = e.onbeforeload = function (ev) {
+ var result = ev.type[0]; // treat empty stylesheets as failures to get around lack of onerror
+ // support in IE9-11
+
+ if (isLegacyIECss) {
+ try {
+ if (!e.sheet.cssText.length) result = 'e';
+ } catch (x) {
+ // sheets objects created from load errors don't allow access to
+ // `cssText` (unless error is Code:18 SecurityError)
+ if (x.code != 18) result = 'e';
+ }
+ } // handle retries in case of load failure
+
+
+ if (result == 'e') {
+ // increment counter
+ numTries += 1; // exit function and try again
+
+ if (numTries < maxTries) {
+ return loadFile(path, callbackFn, args, numTries);
+ }
+ } else if (e.rel == 'preload' && e.as == 'style') {
+ // activate preloaded stylesheets
+ return e.rel = 'stylesheet'; // jshint ignore:line
+ } // execute callback
+
+
+ callbackFn(path, result, ev.defaultPrevented);
+ }; // add to document (unless callback returns `false`)
+
+
+ if (beforeCallbackFn(path, e) !== false) doc.head.appendChild(e);
+ }
+ /**
+ * Load multiple files.
+ * @param {string[]} paths - The file paths
+ * @param {Function} callbackFn - The callback function
+ */
+
+
+ function loadFiles(paths, callbackFn, args) {
+ // listify paths
+ paths = paths.push ? paths : [paths];
+ var numWaiting = paths.length,
+ x = numWaiting,
+ pathsNotFound = [],
+ fn,
+ i; // define callback function
+
+ fn = function fn(path, result, defaultPrevented) {
+ // handle error
+ if (result == 'e') pathsNotFound.push(path); // handle beforeload event. If defaultPrevented then that means the load
+ // will be blocked (ex. Ghostery/ABP on Safari)
+
+ if (result == 'b') {
+ if (defaultPrevented) pathsNotFound.push(path);else return;
+ }
+
+ numWaiting--;
+ if (!numWaiting) callbackFn(pathsNotFound);
+ }; // load scripts
+
+
+ for (i = 0; i < x; i++) {
+ loadFile(paths[i], fn, args);
+ }
+ }
+ /**
+ * Initiate script load and register bundle.
+ * @param {(string|string[])} paths - The file paths
+ * @param {(string|Function|Object)} [arg1] - The (1) bundleId or (2) success
+ * callback or (3) object literal with success/error arguments, numRetries,
+ * etc.
+ * @param {(Function|Object)} [arg2] - The (1) success callback or (2) object
+ * literal with success/error arguments, numRetries, etc.
+ */
+
+
+ function loadjs(paths, arg1, arg2) {
+ var bundleId, args; // bundleId (if string)
+
+ if (arg1 && arg1.trim) bundleId = arg1; // args (default is {})
+
+ args = (bundleId ? arg2 : arg1) || {}; // throw error if bundle is already defined
+
+ if (bundleId) {
+ if (bundleId in bundleIdCache) {
+ throw "LoadJS";
+ } else {
+ bundleIdCache[bundleId] = true;
+ }
+ }
+
+ function loadFn(resolve, reject) {
+ loadFiles(paths, function (pathsNotFound) {
+ // execute callbacks
+ executeCallbacks(args, pathsNotFound); // resolve Promise
+
+ if (resolve) {
+ executeCallbacks({
+ success: resolve,
+ error: reject
+ }, pathsNotFound);
+ } // publish bundle load event
+
+
+ publish(bundleId, pathsNotFound);
+ }, args);
+ }
+
+ if (args.returnPromise) return new Promise(loadFn);else loadFn();
+ }
+ /**
+ * Execute callbacks when dependencies have been satisfied.
+ * @param {(string|string[])} deps - List of bundle ids
+ * @param {Object} args - success/error arguments
+ */
+
+
+ loadjs.ready = function ready(deps, args) {
+ // subscribe to bundle load event
+ subscribe(deps, function (depsNotFound) {
+ // execute callbacks
+ executeCallbacks(args, depsNotFound);
+ });
+ return loadjs;
+ };
+ /**
+ * Manually satisfy bundle dependencies.
+ * @param {string} bundleId - The bundle id
+ */
+
+
+ loadjs.done = function done(bundleId) {
+ publish(bundleId, []);
+ };
+ /**
+ * Reset loadjs dependencies statuses
+ */
+
+
+ loadjs.reset = function reset() {
+ bundleIdCache = {};
+ bundleResultCache = {};
+ bundleCallbackQueue = {};
+ };
+ /**
+ * Determine if bundle has already been defined
+ * @param String} bundleId - The bundle id
+ */
+
+
+ loadjs.isDefined = function isDefined(bundleId) {
+ return bundleId in bundleIdCache;
+ }; // export
+
+
+ return loadjs;
+ });
+ });
+
+ // ==========================================================================
+ function loadScript(url) {
+ return new Promise(function (resolve, reject) {
+ loadjs_umd(url, {
+ success: resolve,
+ error: reject
+ });
+ });
+ }
+
+ function parseId(url) {
+ if (is$1.empty(url)) {
+ return null;
+ }
+
+ if (is$1.number(Number(url))) {
+ return url;
+ }
+
+ var regex = /^.*(vimeo.com\/|video\/)(\d+).*/;
+ return url.match(regex) ? RegExp.$2 : url;
+ } // Set playback state and trigger change (only on actual change)
+
+
+ function assurePlaybackState(play) {
+ if (play && !this.embed.hasPlayed) {
+ this.embed.hasPlayed = true;
+ }
+
+ if (this.media.paused === play) {
+ this.media.paused = !play;
+ triggerEvent.call(this, this.media, play ? 'play' : 'pause');
+ }
+ }
+
+ var vimeo = {
+ setup: function setup() {
+ var player = this; // Add embed class for responsive
+
+ toggleClass(player.elements.wrapper, player.config.classNames.embed, true); // Set speed options from config
+
+ player.options.speed = player.config.speed.options; // Set intial ratio
+
+ setAspectRatio.call(player); // Load the SDK if not already
+
+ if (!is$1.object(window.Vimeo)) {
+ loadScript(player.config.urls.vimeo.sdk).then(function () {
+ vimeo.ready.call(player);
+ }).catch(function (error) {
+ player.debug.warn('Vimeo SDK (player.js) failed to load', error);
+ });
+ } else {
+ vimeo.ready.call(player);
+ }
+ },
+ // API Ready
+ ready: function ready() {
+ var _this = this;
+
+ var player = this;
+ var config = player.config.vimeo;
+
+ var premium = config.premium,
+ referrerPolicy = config.referrerPolicy,
+ frameParams = _objectWithoutProperties(config, ["premium", "referrerPolicy"]); // If the owner has a pro or premium account then we can hide controls etc
+
+
+ if (premium) {
+ Object.assign(frameParams, {
+ controls: false,
+ sidedock: false
+ });
+ } // Get Vimeo params for the iframe
+
+
+ var params = buildUrlParams(_objectSpread2({
+ loop: player.config.loop.active,
+ autoplay: player.autoplay,
+ muted: player.muted,
+ gesture: 'media',
+ playsinline: !this.config.fullscreen.iosNative
+ }, frameParams)); // Get the source URL or ID
+
+ var source = player.media.getAttribute('src'); // Get from <div> if needed
+
+ if (is$1.empty(source)) {
+ source = player.media.getAttribute(player.config.attributes.embed.id);
+ }
+
+ var id = parseId(source); // Build an iframe
+
+ var iframe = createElement('iframe');
+ var src = format(player.config.urls.vimeo.iframe, id, params);
+ iframe.setAttribute('src', src);
+ iframe.setAttribute('allowfullscreen', '');
+ iframe.setAttribute('allow', 'autoplay,fullscreen,picture-in-picture'); // Set the referrer policy if required
+
+ if (!is$1.empty(referrerPolicy)) {
+ iframe.setAttribute('referrerPolicy', referrerPolicy);
+ } // Inject the package
+
+
+ var poster = player.poster;
+
+ if (premium) {
+ iframe.setAttribute('data-poster', poster);
+ player.media = replaceElement(iframe, player.media);
+ } else {
+ var wrapper = createElement('div', {
+ class: player.config.classNames.embedContainer,
+ 'data-poster': poster
+ });
+ wrapper.appendChild(iframe);
+ player.media = replaceElement(wrapper, player.media);
+ } // Get poster image
+
+
+ fetch(format(player.config.urls.vimeo.api, id), 'json').then(function (response) {
+ if (is$1.empty(response)) {
+ return;
+ } // Get the URL for thumbnail
+
+
+ var url = new URL(response[0].thumbnail_large); // Get original image
+
+ url.pathname = "".concat(url.pathname.split('_')[0], ".jpg"); // Set and show poster
+
+ ui.setPoster.call(player, url.href).catch(function () {});
+ }); // Setup instance
+ // https://github.com/vimeo/player.js
+
+ player.embed = new window.Vimeo.Player(iframe, {
+ autopause: player.config.autopause,
+ muted: player.muted
+ });
+ player.media.paused = true;
+ player.media.currentTime = 0; // Disable native text track rendering
+
+ if (player.supported.ui) {
+ player.embed.disableTextTrack();
+ } // Create a faux HTML5 API using the Vimeo API
+
+
+ player.media.play = function () {
+ assurePlaybackState.call(player, true);
+ return player.embed.play();
+ };
+
+ player.media.pause = function () {
+ assurePlaybackState.call(player, false);
+ return player.embed.pause();
+ };
+
+ player.media.stop = function () {
+ player.pause();
+ player.currentTime = 0;
+ }; // Seeking
+
+
+ var currentTime = player.media.currentTime;
+ Object.defineProperty(player.media, 'currentTime', {
+ get: function get() {
+ return currentTime;
+ },
+ set: function set(time) {
+ // Vimeo will automatically play on seek if the video hasn't been played before
+ // Get current paused state and volume etc
+ var embed = player.embed,
+ media = player.media,
+ paused = player.paused,
+ volume = player.volume;
+ var restorePause = paused && !embed.hasPlayed; // Set seeking state and trigger event
+
+ media.seeking = true;
+ triggerEvent.call(player, media, 'seeking'); // If paused, mute until seek is complete
+
+ Promise.resolve(restorePause && embed.setVolume(0)) // Seek
+ .then(function () {
+ return embed.setCurrentTime(time);
+ }) // Restore paused
+ .then(function () {
+ return restorePause && embed.pause();
+ }) // Restore volume
+ .then(function () {
+ return restorePause && embed.setVolume(volume);
+ }).catch(function () {// Do nothing
+ });
+ }
+ }); // Playback speed
+
+ var speed = player.config.speed.selected;
+ Object.defineProperty(player.media, 'playbackRate', {
+ get: function get() {
+ return speed;
+ },
+ set: function set(input) {
+ player.embed.setPlaybackRate(input).then(function () {
+ speed = input;
+ triggerEvent.call(player, player.media, 'ratechange');
+ }).catch(function () {
+ // Cannot set Playback Rate, Video is probably not on Pro account
+ player.options.speed = [1];
+ });
+ }
+ }); // Volume
+
+ var volume = player.config.volume;
+ Object.defineProperty(player.media, 'volume', {
+ get: function get() {
+ return volume;
+ },
+ set: function set(input) {
+ player.embed.setVolume(input).then(function () {
+ volume = input;
+ triggerEvent.call(player, player.media, 'volumechange');
+ });
+ }
+ }); // Muted
+
+ var muted = player.config.muted;
+ Object.defineProperty(player.media, 'muted', {
+ get: function get() {
+ return muted;
+ },
+ set: function set(input) {
+ var toggle = is$1.boolean(input) ? input : false;
+ player.embed.setVolume(toggle ? 0 : player.config.volume).then(function () {
+ muted = toggle;
+ triggerEvent.call(player, player.media, 'volumechange');
+ });
+ }
+ }); // Loop
+
+ var loop = player.config.loop;
+ Object.defineProperty(player.media, 'loop', {
+ get: function get() {
+ return loop;
+ },
+ set: function set(input) {
+ var toggle = is$1.boolean(input) ? input : player.config.loop.active;
+ player.embed.setLoop(toggle).then(function () {
+ loop = toggle;
+ });
+ }
+ }); // Source
+
+ var currentSrc;
+ player.embed.getVideoUrl().then(function (value) {
+ currentSrc = value;
+ controls.setDownloadUrl.call(player);
+ }).catch(function (error) {
+ _this.debug.warn(error);
+ });
+ Object.defineProperty(player.media, 'currentSrc', {
+ get: function get() {
+ return currentSrc;
+ }
+ }); // Ended
+
+ Object.defineProperty(player.media, 'ended', {
+ get: function get() {
+ return player.currentTime === player.duration;
+ }
+ }); // Set aspect ratio based on video size
+
+ Promise.all([player.embed.getVideoWidth(), player.embed.getVideoHeight()]).then(function (dimensions) {
+ var _dimensions = _slicedToArray(dimensions, 2),
+ width = _dimensions[0],
+ height = _dimensions[1];
+
+ player.embed.ratio = [width, height];
+ setAspectRatio.call(_this);
+ }); // Set autopause
+
+ player.embed.setAutopause(player.config.autopause).then(function (state) {
+ player.config.autopause = state;
+ }); // Get title
+
+ player.embed.getVideoTitle().then(function (title) {
+ player.config.title = title;
+ ui.setTitle.call(_this);
+ }); // Get current time
+
+ player.embed.getCurrentTime().then(function (value) {
+ currentTime = value;
+ triggerEvent.call(player, player.media, 'timeupdate');
+ }); // Get duration
+
+ player.embed.getDuration().then(function (value) {
+ player.media.duration = value;
+ triggerEvent.call(player, player.media, 'durationchange');
+ }); // Get captions
+
+ player.embed.getTextTracks().then(function (tracks) {
+ player.media.textTracks = tracks;
+ captions.setup.call(player);
+ });
+ player.embed.on('cuechange', function (_ref) {
+ var _ref$cues = _ref.cues,
+ cues = _ref$cues === void 0 ? [] : _ref$cues;
+ var strippedCues = cues.map(function (cue) {
+ return stripHTML(cue.text);
+ });
+ captions.updateCues.call(player, strippedCues);
+ });
+ player.embed.on('loaded', function () {
+ // Assure state and events are updated on autoplay
+ player.embed.getPaused().then(function (paused) {
+ assurePlaybackState.call(player, !paused);
+
+ if (!paused) {
+ triggerEvent.call(player, player.media, 'playing');
+ }
+ });
+
+ if (is$1.element(player.embed.element) && player.supported.ui) {
+ var frame = player.embed.element; // Fix keyboard focus issues
+ // https://github.com/sampotts/plyr/issues/317
+
+ frame.setAttribute('tabindex', -1);
+ }
+ });
+ player.embed.on('bufferstart', function () {
+ triggerEvent.call(player, player.media, 'waiting');
+ });
+ player.embed.on('bufferend', function () {
+ triggerEvent.call(player, player.media, 'playing');
+ });
+ player.embed.on('play', function () {
+ assurePlaybackState.call(player, true);
+ triggerEvent.call(player, player.media, 'playing');
+ });
+ player.embed.on('pause', function () {
+ assurePlaybackState.call(player, false);
+ });
+ player.embed.on('timeupdate', function (data) {
+ player.media.seeking = false;
+ currentTime = data.seconds;
+ triggerEvent.call(player, player.media, 'timeupdate');
+ });
+ player.embed.on('progress', function (data) {
+ player.media.buffered = data.percent;
+ triggerEvent.call(player, player.media, 'progress'); // Check all loaded
+
+ if (parseInt(data.percent, 10) === 1) {
+ triggerEvent.call(player, player.media, 'canplaythrough');
+ } // Get duration as if we do it before load, it gives an incorrect value
+ // https://github.com/sampotts/plyr/issues/891
+
+
+ player.embed.getDuration().then(function (value) {
+ if (value !== player.media.duration) {
+ player.media.duration = value;
+ triggerEvent.call(player, player.media, 'durationchange');
+ }
+ });
+ });
+ player.embed.on('seeked', function () {
+ player.media.seeking = false;
+ triggerEvent.call(player, player.media, 'seeked');
+ });
+ player.embed.on('ended', function () {
+ player.media.paused = true;
+ triggerEvent.call(player, player.media, 'ended');
+ });
+ player.embed.on('error', function (detail) {
+ player.media.error = detail;
+ triggerEvent.call(player, player.media, 'error');
+ }); // Rebuild UI
+
+ setTimeout(function () {
+ return ui.build.call(player);
+ }, 0);
+ }
+ };
+
+ // ==========================================================================
+
+ function parseId$1(url) {
+ if (is$1.empty(url)) {
+ return null;
+ }
+
+ var regex = /^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*/;
+ return url.match(regex) ? RegExp.$2 : url;
+ } // Set playback state and trigger change (only on actual change)
+
+
+ function assurePlaybackState$1(play) {
+ if (play && !this.embed.hasPlayed) {
+ this.embed.hasPlayed = true;
+ }
+
+ if (this.media.paused === play) {
+ this.media.paused = !play;
+ triggerEvent.call(this, this.media, play ? 'play' : 'pause');
+ }
+ }
+
+ function getHost(config) {
+ if (config.noCookie) {
+ return 'https://www.youtube-nocookie.com';
+ }
+
+ if (window.location.protocol === 'http:') {
+ return 'http://www.youtube.com';
+ } // Use YouTube's default
+
+
+ return undefined;
+ }
+
+ var youtube = {
+ setup: function setup() {
+ var _this = this;
+
+ // Add embed class for responsive
+ toggleClass(this.elements.wrapper, this.config.classNames.embed, true); // Setup API
+
+ if (is$1.object(window.YT) && is$1.function(window.YT.Player)) {
+ youtube.ready.call(this);
+ } else {
+ // Reference current global callback
+ var callback = window.onYouTubeIframeAPIReady; // Set callback to process queue
+
+ window.onYouTubeIframeAPIReady = function () {
+ // Call global callback if set
+ if (is$1.function(callback)) {
+ callback();
+ }
+
+ youtube.ready.call(_this);
+ }; // Load the SDK
+
+
+ loadScript(this.config.urls.youtube.sdk).catch(function (error) {
+ _this.debug.warn('YouTube API failed to load', error);
+ });
+ }
+ },
+ // Get the media title
+ getTitle: function getTitle(videoId) {
+ var _this2 = this;
+
+ var url = format(this.config.urls.youtube.api, videoId);
+ fetch(url).then(function (data) {
+ if (is$1.object(data)) {
+ var title = data.title,
+ height = data.height,
+ width = data.width; // Set title
+
+ _this2.config.title = title;
+ ui.setTitle.call(_this2); // Set aspect ratio
+
+ _this2.embed.ratio = [width, height];
+ }
+
+ setAspectRatio.call(_this2);
+ }).catch(function () {
+ // Set aspect ratio
+ setAspectRatio.call(_this2);
+ });
+ },
+ // API ready
+ ready: function ready() {
+ var player = this; // Ignore already setup (race condition)
+
+ var currentId = player.media && player.media.getAttribute('id');
+
+ if (!is$1.empty(currentId) && currentId.startsWith('youtube-')) {
+ return;
+ } // Get the source URL or ID
+
+
+ var source = player.media.getAttribute('src'); // Get from <div> if needed
+
+ if (is$1.empty(source)) {
+ source = player.media.getAttribute(this.config.attributes.embed.id);
+ } // Replace the <iframe> with a <div> due to YouTube API issues
+
+
+ var videoId = parseId$1(source);
+ var id = generateId(player.provider); // Get poster, if already set
+
+ var poster = player.poster; // Replace media element
+
+ var container = createElement('div', {
+ id: id,
+ 'data-poster': poster
+ });
+ player.media = replaceElement(container, player.media); // Id to poster wrapper
+
+ var posterSrc = function posterSrc(s) {
+ return "https://i.ytimg.com/vi/".concat(videoId, "/").concat(s, "default.jpg");
+ }; // Check thumbnail images in order of quality, but reject fallback thumbnails (120px wide)
+
+
+ loadImage(posterSrc('maxres'), 121) // Higest quality and unpadded
+ .catch(function () {
+ return loadImage(posterSrc('sd'), 121);
+ }) // 480p padded 4:3
+ .catch(function () {
+ return loadImage(posterSrc('hq'));
+ }) // 360p padded 4:3. Always exists
+ .then(function (image) {
+ return ui.setPoster.call(player, image.src);
+ }).then(function (src) {
+ // If the image is padded, use background-size "cover" instead (like youtube does too with their posters)
+ if (!src.includes('maxres')) {
+ player.elements.poster.style.backgroundSize = 'cover';
+ }
+ }).catch(function () {});
+ var config = player.config.youtube; // Setup instance
+ // https://developers.google.com/youtube/iframe_api_reference
+
+ player.embed = new window.YT.Player(id, {
+ videoId: videoId,
+ host: getHost(config),
+ playerVars: extend({}, {
+ autoplay: player.config.autoplay ? 1 : 0,
+ // Autoplay
+ hl: player.config.hl,
+ // iframe interface language
+ controls: player.supported.ui ? 0 : 1,
+ // Only show controls if not fully supported
+ disablekb: 1,
+ // Disable keyboard as we handle it
+ playsinline: !player.config.fullscreen.iosNative ? 1 : 0,
+ // Allow iOS inline playback
+ // Captions are flaky on YouTube
+ cc_load_policy: player.captions.active ? 1 : 0,
+ cc_lang_pref: player.config.captions.language,
+ // Tracking for stats
+ widget_referrer: window ? window.location.href : null
+ }, config),
+ events: {
+ onError: function onError(event) {
+ // YouTube may fire onError twice, so only handle it once
+ if (!player.media.error) {
+ var code = event.data; // Messages copied from https://developers.google.com/youtube/iframe_api_reference#onError
+
+ var message = {
+ 2: 'The request contains an invalid parameter value. For example, this error occurs if you specify a video ID that does not have 11 characters, or if the video ID contains invalid characters, such as exclamation points or asterisks.',
+ 5: 'The requested content cannot be played in an HTML5 player or another error related to the HTML5 player has occurred.',
+ 100: 'The video requested was not found. This error occurs when a video has been removed (for any reason) or has been marked as private.',
+ 101: 'The owner of the requested video does not allow it to be played in embedded players.',
+ 150: 'The owner of the requested video does not allow it to be played in embedded players.'
+ }[code] || 'An unknown error occured';
+ player.media.error = {
+ code: code,
+ message: message
+ };
+ triggerEvent.call(player, player.media, 'error');
+ }
+ },
+ onPlaybackRateChange: function onPlaybackRateChange(event) {
+ // Get the instance
+ var instance = event.target; // Get current speed
+
+ player.media.playbackRate = instance.getPlaybackRate();
+ triggerEvent.call(player, player.media, 'ratechange');
+ },
+ onReady: function onReady(event) {
+ // Bail if onReady has already been called. See issue #1108
+ if (is$1.function(player.media.play)) {
+ return;
+ } // Get the instance
+
+
+ var instance = event.target; // Get the title
+
+ youtube.getTitle.call(player, videoId); // Create a faux HTML5 API using the YouTube API
+
+ player.media.play = function () {
+ assurePlaybackState$1.call(player, true);
+ instance.playVideo();
+ };
+
+ player.media.pause = function () {
+ assurePlaybackState$1.call(player, false);
+ instance.pauseVideo();
+ };
+
+ player.media.stop = function () {
+ instance.stopVideo();
+ };
+
+ player.media.duration = instance.getDuration();
+ player.media.paused = true; // Seeking
+
+ player.media.currentTime = 0;
+ Object.defineProperty(player.media, 'currentTime', {
+ get: function get() {
+ return Number(instance.getCurrentTime());
+ },
+ set: function set(time) {
+ // If paused and never played, mute audio preventively (YouTube starts playing on seek if the video hasn't been played yet).
+ if (player.paused && !player.embed.hasPlayed) {
+ player.embed.mute();
+ } // Set seeking state and trigger event
+
+
+ player.media.seeking = true;
+ triggerEvent.call(player, player.media, 'seeking'); // Seek after events sent
+
+ instance.seekTo(time);
+ }
+ }); // Playback speed
+
+ Object.defineProperty(player.media, 'playbackRate', {
+ get: function get() {
+ return instance.getPlaybackRate();
+ },
+ set: function set(input) {
+ instance.setPlaybackRate(input);
+ }
+ }); // Volume
+
+ var volume = player.config.volume;
+ Object.defineProperty(player.media, 'volume', {
+ get: function get() {
+ return volume;
+ },
+ set: function set(input) {
+ volume = input;
+ instance.setVolume(volume * 100);
+ triggerEvent.call(player, player.media, 'volumechange');
+ }
+ }); // Muted
+
+ var muted = player.config.muted;
+ Object.defineProperty(player.media, 'muted', {
+ get: function get() {
+ return muted;
+ },
+ set: function set(input) {
+ var toggle = is$1.boolean(input) ? input : muted;
+ muted = toggle;
+ instance[toggle ? 'mute' : 'unMute']();
+ triggerEvent.call(player, player.media, 'volumechange');
+ }
+ }); // Source
+
+ Object.defineProperty(player.media, 'currentSrc', {
+ get: function get() {
+ return instance.getVideoUrl();
+ }
+ }); // Ended
+
+ Object.defineProperty(player.media, 'ended', {
+ get: function get() {
+ return player.currentTime === player.duration;
+ }
+ }); // Get available speeds
+
+ var speeds = instance.getAvailablePlaybackRates(); // Filter based on config
+
+ player.options.speed = speeds.filter(function (s) {
+ return player.config.speed.options.includes(s);
+ }); // Set the tabindex to avoid focus entering iframe
+
+ if (player.supported.ui) {
+ player.media.setAttribute('tabindex', -1);
+ }
+
+ triggerEvent.call(player, player.media, 'timeupdate');
+ triggerEvent.call(player, player.media, 'durationchange'); // Reset timer
+
+ clearInterval(player.timers.buffering); // Setup buffering
+
+ player.timers.buffering = setInterval(function () {
+ // Get loaded % from YouTube
+ player.media.buffered = instance.getVideoLoadedFraction(); // Trigger progress only when we actually buffer something
+
+ if (player.media.lastBuffered === null || player.media.lastBuffered < player.media.buffered) {
+ triggerEvent.call(player, player.media, 'progress');
+ } // Set last buffer point
+
+
+ player.media.lastBuffered = player.media.buffered; // Bail if we're at 100%
+
+ if (player.media.buffered === 1) {
+ clearInterval(player.timers.buffering); // Trigger event
+
+ triggerEvent.call(player, player.media, 'canplaythrough');
+ }
+ }, 200); // Rebuild UI
+
+ setTimeout(function () {
+ return ui.build.call(player);
+ }, 50);
+ },
+ onStateChange: function onStateChange(event) {
+ // Get the instance
+ var instance = event.target; // Reset timer
+
+ clearInterval(player.timers.playing);
+ var seeked = player.media.seeking && [1, 2].includes(event.data);
+
+ if (seeked) {
+ // Unset seeking and fire seeked event
+ player.media.seeking = false;
+ triggerEvent.call(player, player.media, 'seeked');
+ } // Handle events
+ // -1 Unstarted
+ // 0 Ended
+ // 1 Playing
+ // 2 Paused
+ // 3 Buffering
+ // 5 Video cued
+
+
+ switch (event.data) {
+ case -1:
+ // Update scrubber
+ triggerEvent.call(player, player.media, 'timeupdate'); // Get loaded % from YouTube
+
+ player.media.buffered = instance.getVideoLoadedFraction();
+ triggerEvent.call(player, player.media, 'progress');
+ break;
+
+ case 0:
+ assurePlaybackState$1.call(player, false); // YouTube doesn't support loop for a single video, so mimick it.
+
+ if (player.media.loop) {
+ // YouTube needs a call to `stopVideo` before playing again
+ instance.stopVideo();
+ instance.playVideo();
+ } else {
+ triggerEvent.call(player, player.media, 'ended');
+ }
+
+ break;
+
+ case 1:
+ // Restore paused state (YouTube starts playing on seek if the video hasn't been played yet)
+ if (!player.config.autoplay && player.media.paused && !player.embed.hasPlayed) {
+ player.media.pause();
+ } else {
+ assurePlaybackState$1.call(player, true);
+ triggerEvent.call(player, player.media, 'playing'); // Poll to get playback progress
+
+ player.timers.playing = setInterval(function () {
+ triggerEvent.call(player, player.media, 'timeupdate');
+ }, 50); // Check duration again due to YouTube bug
+ // https://github.com/sampotts/plyr/issues/374
+ // https://code.google.com/p/gdata-issues/issues/detail?id=8690
+
+ if (player.media.duration !== instance.getDuration()) {
+ player.media.duration = instance.getDuration();
+ triggerEvent.call(player, player.media, 'durationchange');
+ }
+ }
+
+ break;
+
+ case 2:
+ // Restore audio (YouTube starts playing on seek if the video hasn't been played yet)
+ if (!player.muted) {
+ player.embed.unMute();
+ }
+
+ assurePlaybackState$1.call(player, false);
+ break;
+
+ case 3:
+ // Trigger waiting event to add loading classes to container as the video buffers.
+ triggerEvent.call(player, player.media, 'waiting');
+ break;
+ }
+
+ triggerEvent.call(player, player.elements.container, 'statechange', false, {
+ code: event.data
+ });
+ }
+ }
+ });
+ }
+ };
+
+ // ==========================================================================
+ var media = {
+ // Setup media
+ setup: function setup() {
+ // If there's no media, bail
+ if (!this.media) {
+ this.debug.warn('No media element found!');
+ return;
+ } // Add type class
+
+
+ toggleClass(this.elements.container, this.config.classNames.type.replace('{0}', this.type), true); // Add provider class
+
+ toggleClass(this.elements.container, this.config.classNames.provider.replace('{0}', this.provider), true); // Add video class for embeds
+ // This will require changes if audio embeds are added
+
+ if (this.isEmbed) {
+ toggleClass(this.elements.container, this.config.classNames.type.replace('{0}', 'video'), true);
+ } // Inject the player wrapper
+
+
+ if (this.isVideo) {
+ // Create the wrapper div
+ this.elements.wrapper = createElement('div', {
+ class: this.config.classNames.video
+ }); // Wrap the video in a container
+
+ wrap(this.media, this.elements.wrapper); // Poster image container
+
+ this.elements.poster = createElement('div', {
+ class: this.config.classNames.poster
+ });
+ this.elements.wrapper.appendChild(this.elements.poster);
+ }
+
+ if (this.isHTML5) {
+ html5.setup.call(this);
+ } else if (this.isYouTube) {
+ youtube.setup.call(this);
+ } else if (this.isVimeo) {
+ vimeo.setup.call(this);
+ }
+ }
+ };
+
+ var destroy = function destroy(instance) {
+ // Destroy our adsManager
+ if (instance.manager) {
+ instance.manager.destroy();
+ } // Destroy our adsManager
+
+
+ if (instance.elements.displayContainer) {
+ instance.elements.displayContainer.destroy();
+ }
+
+ instance.elements.container.remove();
+ };
+
+ var Ads = /*#__PURE__*/function () {
+ /**
+ * Ads constructor.
+ * @param {Object} player
+ * @return {Ads}
+ */
+ function Ads(player) {
+ var _this = this;
+
+ _classCallCheck(this, Ads);
+
+ this.player = player;
+ this.config = player.config.ads;
+ this.playing = false;
+ this.initialized = false;
+ this.elements = {
+ container: null,
+ displayContainer: null
+ };
+ this.manager = null;
+ this.loader = null;
+ this.cuePoints = null;
+ this.events = {};
+ this.safetyTimer = null;
+ this.countdownTimer = null; // Setup a promise to resolve when the IMA manager is ready
+
+ this.managerPromise = new Promise(function (resolve, reject) {
+ // The ad is loaded and ready
+ _this.on('loaded', resolve); // Ads failed
+
+
+ _this.on('error', reject);
+ });
+ this.load();
+ }
+
+ _createClass(Ads, [{
+ key: "load",
+
+ /**
+ * Load the IMA SDK
+ */
+ value: function load() {
+ var _this2 = this;
+
+ if (!this.enabled) {
+ return;
+ } // Check if the Google IMA3 SDK is loaded or load it ourselves
+
+
+ if (!is$1.object(window.google) || !is$1.object(window.google.ima)) {
+ loadScript(this.player.config.urls.googleIMA.sdk).then(function () {
+ _this2.ready();
+ }).catch(function () {
+ // Script failed to load or is blocked
+ _this2.trigger('error', new Error('Google IMA SDK failed to load'));
+ });
+ } else {
+ this.ready();
+ }
+ }
+ /**
+ * Get the ads instance ready
+ */
+
+ }, {
+ key: "ready",
+ value: function ready() {
+ var _this3 = this;
+
+ // Double check we're enabled
+ if (!this.enabled) {
+ destroy(this);
+ } // Start ticking our safety timer. If the whole advertisement
+ // thing doesn't resolve within our set time; we bail
+
+
+ this.startSafetyTimer(12000, 'ready()'); // Clear the safety timer
+
+ this.managerPromise.then(function () {
+ _this3.clearSafetyTimer('onAdsManagerLoaded()');
+ }); // Set listeners on the Plyr instance
+
+ this.listeners(); // Setup the IMA SDK
+
+ this.setupIMA();
+ } // Build the tag URL
+
+ }, {
+ key: "setupIMA",
+
+ /**
+ * In order for the SDK to display ads for our video, we need to tell it where to put them,
+ * so here we define our ad container. This div is set up to render on top of the video player.
+ * Using the code below, we tell the SDK to render ads within that div. We also provide a
+ * handle to the content video player - the SDK will poll the current time of our player to
+ * properly place mid-rolls. After we create the ad display container, we initialize it. On
+ * mobile devices, this initialization is done as the result of a user action.
+ */
+ value: function setupIMA() {
+ var _this4 = this;
+
+ // Create the container for our advertisements
+ this.elements.container = createElement('div', {
+ class: this.player.config.classNames.ads
+ });
+ this.player.elements.container.appendChild(this.elements.container); // So we can run VPAID2
+
+ google.ima.settings.setVpaidMode(google.ima.ImaSdkSettings.VpaidMode.ENABLED); // Set language
+
+ google.ima.settings.setLocale(this.player.config.ads.language); // Set playback for iOS10+
+
+ 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
+
+ this.elements.displayContainer = new google.ima.AdDisplayContainer(this.elements.container, this.player.media); // Create ads loader
+
+ this.loader = new google.ima.AdsLoader(this.elements.displayContainer); // Listen and respond to ads loaded and error events
+
+ this.loader.addEventListener(google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED, function (event) {
+ return _this4.onAdsManagerLoaded(event);
+ }, false);
+ this.loader.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR, function (error) {
+ return _this4.onAdError(error);
+ }, false); // Request video ads to be pre-loaded
+
+ this.requestAds();
+ }
+ /**
+ * Request advertisements
+ */
+
+ }, {
+ key: "requestAds",
+ value: function requestAds() {
+ var container = this.player.elements.container;
+
+ try {
+ // Request video ads
+ var request = new google.ima.AdsRequest();
+ request.adTagUrl = this.tagUrl; // Specify the linear and nonlinear slot sizes. This helps the SDK
+ // to select the correct creative if multiple are returned
+
+ request.linearAdSlotWidth = container.offsetWidth;
+ request.linearAdSlotHeight = container.offsetHeight;
+ request.nonLinearAdSlotWidth = container.offsetWidth;
+ request.nonLinearAdSlotHeight = container.offsetHeight; // We only overlay ads as we only support video.
+
+ request.forceNonLinearFullSlot = false; // Mute based on current state
+
+ request.setAdWillPlayMuted(!this.player.muted);
+ this.loader.requestAds(request);
+ } catch (e) {
+ this.onAdError(e);
+ }
+ }
+ /**
+ * Update the ad countdown
+ * @param {Boolean} start
+ */
+
+ }, {
+ key: "pollCountdown",
+ value: function pollCountdown() {
+ var _this5 = this;
+
+ var start = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
+
+ if (!start) {
+ clearInterval(this.countdownTimer);
+ this.elements.container.removeAttribute('data-badge-text');
+ return;
+ }
+
+ var update = function update() {
+ var time = formatTime(Math.max(_this5.manager.getRemainingTime(), 0));
+ var label = "".concat(i18n.get('advertisement', _this5.player.config), " - ").concat(time);
+
+ _this5.elements.container.setAttribute('data-badge-text', label);
+ };
+
+ this.countdownTimer = setInterval(update, 100);
+ }
+ /**
+ * This method is called whenever the ads are ready inside the AdDisplayContainer
+ * @param {Event} adsManagerLoadedEvent
+ */
+
+ }, {
+ key: "onAdsManagerLoaded",
+ value: function onAdsManagerLoaded(event) {
+ var _this6 = this;
+
+ // Load could occur after a source change (race condition)
+ if (!this.enabled) {
+ return;
+ } // Get the ads manager
+
+
+ var settings = new google.ima.AdsRenderingSettings(); // Tell the SDK to save and restore content video state on our behalf
+
+ settings.restoreCustomPlaybackStateOnAdBreakComplete = true;
+ settings.enablePreloading = true; // The SDK is polling currentTime on the contentPlayback. And needs a duration
+ // so it can determine when to start the mid- and post-roll
+
+ this.manager = event.getAdsManager(this.player, settings); // Get the cue points for any mid-rolls by filtering out the pre- and post-roll
+
+ this.cuePoints = this.manager.getCuePoints(); // Add listeners to the required events
+ // Advertisement error events
+
+ this.manager.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR, function (error) {
+ return _this6.onAdError(error);
+ }); // Advertisement regular events
+
+ Object.keys(google.ima.AdEvent.Type).forEach(function (type) {
+ _this6.manager.addEventListener(google.ima.AdEvent.Type[type], function (e) {
+ return _this6.onAdEvent(e);
+ });
+ }); // Resolve our adsManager
+
+ this.trigger('loaded');
+ }
+ }, {
+ key: "addCuePoints",
+ value: function addCuePoints() {
+ var _this7 = this;
+
+ // Add advertisement cue's within the time line if available
+ if (!is$1.empty(this.cuePoints)) {
+ this.cuePoints.forEach(function (cuePoint) {
+ if (cuePoint !== 0 && cuePoint !== -1 && cuePoint < _this7.player.duration) {
+ var seekElement = _this7.player.elements.progress;
+
+ if (is$1.element(seekElement)) {
+ var cuePercentage = 100 / _this7.player.duration * cuePoint;
+ var cue = createElement('span', {
+ class: _this7.player.config.classNames.cues
+ });
+ cue.style.left = "".concat(cuePercentage.toString(), "%");
+ seekElement.appendChild(cue);
+ }
+ }
+ });
+ }
+ }
+ /**
+ * This is where all the event handling takes place. Retrieve the ad from the event. Some
+ * events (e.g. ALL_ADS_COMPLETED) don't have the ad object associated
+ * https://developers.google.com/interactive-media-ads/docs/sdks/html5/v3/apis#ima.AdEvent.Type
+ * @param {Event} event
+ */
+
+ }, {
+ key: "onAdEvent",
+ value: function onAdEvent(event) {
+ var _this8 = this;
+
+ var container = this.player.elements.container; // Retrieve the ad from the event. Some events (e.g. ALL_ADS_COMPLETED)
+ // don't have ad object associated
+
+ var ad = event.getAd();
+ var adData = event.getAdData(); // Proxy event
+
+ var dispatchEvent = function dispatchEvent(type) {
+ triggerEvent.call(_this8.player, _this8.player.media, "ads".concat(type.replace(/_/g, '').toLowerCase()));
+ }; // Bubble the event
+
+
+ dispatchEvent(event.type);
+
+ switch (event.type) {
+ case google.ima.AdEvent.Type.LOADED:
+ // This is the first event sent for an ad - it is possible to determine whether the
+ // ad is a video ad or an overlay
+ this.trigger('loaded'); // Start countdown
+
+ this.pollCountdown(true);
+
+ if (!ad.isLinear()) {
+ // Position AdDisplayContainer correctly for overlay
+ ad.width = container.offsetWidth;
+ ad.height = container.offsetHeight;
+ } // console.info('Ad type: ' + event.getAd().getAdPodInfo().getPodIndex());
+ // console.info('Ad time: ' + event.getAd().getAdPodInfo().getTimeOffset());
+
+
+ break;
+
+ case google.ima.AdEvent.Type.STARTED:
+ // Set volume to match player
+ this.manager.setVolume(this.player.volume);
+ break;
+
+ case google.ima.AdEvent.Type.ALL_ADS_COMPLETED:
+ // All ads for the current videos are done. We can now request new advertisements
+ // in case the video is re-played
+ // TODO: Example for what happens when a next video in a playlist would be loaded.
+ // So here we load a new video when all ads are done.
+ // Then we load new ads within a new adsManager. When the video
+ // Is started - after - the ads are loaded, then we get ads.
+ // You can also easily test cancelling and reloading by running
+ // player.ads.cancel() and player.ads.play from the console I guess.
+ // this.player.source = {
+ // type: 'video',
+ // title: 'View From A Blue Moon',
+ // sources: [{
+ // src:
+ // 'https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.mp4', type:
+ // 'video/mp4', }], poster:
+ // 'https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.jpg', tracks:
+ // [ { kind: 'captions', label: 'English', srclang: 'en', src:
+ // 'https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.en.vtt',
+ // default: true, }, { kind: 'captions', label: 'French', srclang: 'fr', src:
+ // 'https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.fr.vtt', }, ],
+ // };
+ // TODO: So there is still this thing where a video should only be allowed to start
+ // playing when the IMA SDK is ready or has failed
+ if (this.player.ended) {
+ this.loadAds();
+ } else {
+ // The SDK won't allow new ads to be called without receiving a contentComplete()
+ this.loader.contentComplete();
+ }
+
+ break;
+
+ case google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED:
+ // This event indicates the ad has started - the video player can adjust the UI,
+ // for example display a pause button and remaining time. Fired when content should
+ // be paused. This usually happens right before an ad is about to cover the content
+ this.pauseContent();
+ break;
+
+ case google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED:
+ // This event indicates the ad has finished - the video player can perform
+ // appropriate UI actions, such as removing the timer for remaining time detection.
+ // Fired when content should be resumed. This usually happens when an ad finishes
+ // or collapses
+ this.pollCountdown();
+ this.resumeContent();
+ break;
+
+ case google.ima.AdEvent.Type.LOG:
+ if (adData.adError) {
+ this.player.debug.warn("Non-fatal ad error: ".concat(adData.adError.getMessage()));
+ }
+
+ break;
+ }
+ }
+ /**
+ * Any ad error handling comes through here
+ * @param {Event} event
+ */
+
+ }, {
+ key: "onAdError",
+ value: function onAdError(event) {
+ this.cancel();
+ this.player.debug.warn('Ads error', event);
+ }
+ /**
+ * Setup hooks for Plyr and window events. This ensures
+ * the mid- and post-roll launch at the correct time. And
+ * resize the advertisement when the player resizes
+ */
+
+ }, {
+ key: "listeners",
+ value: function listeners() {
+ var _this9 = this;
+
+ var container = this.player.elements.container;
+ var time;
+ this.player.on('canplay', function () {
+ _this9.addCuePoints();
+ });
+ this.player.on('ended', function () {
+ _this9.loader.contentComplete();
+ });
+ this.player.on('timeupdate', function () {
+ time = _this9.player.currentTime;
+ });
+ this.player.on('seeked', function () {
+ var seekedTime = _this9.player.currentTime;
+
+ if (is$1.empty(_this9.cuePoints)) {
+ return;
+ }
+
+ _this9.cuePoints.forEach(function (cuePoint, index) {
+ if (time < cuePoint && cuePoint < seekedTime) {
+ _this9.manager.discardAdBreak();
+
+ _this9.cuePoints.splice(index, 1);
+ }
+ });
+ }); // Listen to the resizing of the window. And resize ad accordingly
+ // TODO: eventually implement ResizeObserver
+
+ window.addEventListener('resize', function () {
+ if (_this9.manager) {
+ _this9.manager.resize(container.offsetWidth, container.offsetHeight, google.ima.ViewMode.NORMAL);
+ }
+ });
+ }
+ /**
+ * Initialize the adsManager and start playing advertisements
+ */
+
+ }, {
+ key: "play",
+ value: function play() {
+ var _this10 = this;
+
+ var container = this.player.elements.container;
+
+ if (!this.managerPromise) {
+ this.resumeContent();
+ } // Play the requested advertisement whenever the adsManager is ready
+
+
+ this.managerPromise.then(function () {
+ // Set volume to match player
+ _this10.manager.setVolume(_this10.player.volume); // Initialize the container. Must be done via a user action on mobile devices
+
+
+ _this10.elements.displayContainer.initialize();
+
+ try {
+ if (!_this10.initialized) {
+ // Initialize the ads manager. Ad rules playlist will start at this time
+ _this10.manager.init(container.offsetWidth, container.offsetHeight, google.ima.ViewMode.NORMAL); // Call play to start showing the ad. Single video and overlay ads will
+ // start at this time; the call will be ignored for ad rules
+
+
+ _this10.manager.start();
+ }
+
+ _this10.initialized = true;
+ } catch (adError) {
+ // An error may be thrown if there was a problem with the
+ // VAST response
+ _this10.onAdError(adError);
+ }
+ }).catch(function () {});
+ }
+ /**
+ * Resume our video
+ */
+
+ }, {
+ key: "resumeContent",
+ value: function resumeContent() {
+ // Hide the advertisement container
+ this.elements.container.style.zIndex = ''; // Ad is stopped
+
+ this.playing = false; // Play video
+
+ silencePromise(this.player.media.play());
+ }
+ /**
+ * Pause our video
+ */
+
+ }, {
+ key: "pauseContent",
+ value: function pauseContent() {
+ // Show the advertisement container
+ this.elements.container.style.zIndex = 3; // Ad is playing
+
+ this.playing = true; // Pause our video.
+
+ this.player.media.pause();
+ }
+ /**
+ * Destroy the adsManager so we can grab new ads after this. If we don't then we're not
+ * allowed to call new ads based on google policies, as they interpret this as an accidental
+ * video requests. https://developers.google.com/interactive-
+ * media-ads/docs/sdks/android/faq#8
+ */
+
+ }, {
+ key: "cancel",
+ value: function cancel() {
+ // Pause our video
+ if (this.initialized) {
+ this.resumeContent();
+ } // Tell our instance that we're done for now
+
+
+ this.trigger('error'); // Re-create our adsManager
+
+ this.loadAds();
+ }
+ /**
+ * Re-create our adsManager
+ */
+
+ }, {
+ key: "loadAds",
+ value: function loadAds() {
+ var _this11 = this;
+
+ // Tell our adsManager to go bye bye
+ this.managerPromise.then(function () {
+ // Destroy our adsManager
+ if (_this11.manager) {
+ _this11.manager.destroy();
+ } // Re-set our adsManager promises
+
+
+ _this11.managerPromise = new Promise(function (resolve) {
+ _this11.on('loaded', resolve);
+
+ _this11.player.debug.log(_this11.manager);
+ }); // Now that the manager has been destroyed set it to also be un-initialized
+
+ _this11.initialized = false; // Now request some new advertisements
+
+ _this11.requestAds();
+ }).catch(function () {});
+ }
+ /**
+ * Handles callbacks after an ad event was invoked
+ * @param {String} event - Event type
+ */
+
+ }, {
+ key: "trigger",
+ value: function trigger(event) {
+ var _this12 = this;
+
+ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
+ args[_key - 1] = arguments[_key];
+ }
+
+ var handlers = this.events[event];
+
+ if (is$1.array(handlers)) {
+ handlers.forEach(function (handler) {
+ if (is$1.function(handler)) {
+ handler.apply(_this12, args);
+ }
+ });
+ }
+ }
+ /**
+ * Add event listeners
+ * @param {String} event - Event type
+ * @param {Function} callback - Callback for when event occurs
+ * @return {Ads}
+ */
+
+ }, {
+ key: "on",
+ value: function on(event, callback) {
+ if (!is$1.array(this.events[event])) {
+ this.events[event] = [];
+ }
+
+ this.events[event].push(callback);
+ return this;
+ }
+ /**
+ * Setup a safety timer for when the ad network doesn't respond for whatever reason.
+ * The advertisement has 12 seconds to get its things together. We stop this timer when the
+ * advertisement is playing, or when a user action is required to start, then we clear the
+ * timer on ad ready
+ * @param {Number} time
+ * @param {String} from
+ */
+
+ }, {
+ key: "startSafetyTimer",
+ value: function startSafetyTimer(time, from) {
+ var _this13 = this;
+
+ this.player.debug.log("Safety timer invoked from: ".concat(from));
+ this.safetyTimer = setTimeout(function () {
+ _this13.cancel();
+
+ _this13.clearSafetyTimer('startSafetyTimer()');
+ }, time);
+ }
+ /**
+ * Clear our safety timer(s)
+ * @param {String} from
+ */
+
+ }, {
+ key: "clearSafetyTimer",
+ value: function clearSafetyTimer(from) {
+ if (!is$1.nullOrUndefined(this.safetyTimer)) {
+ this.player.debug.log("Safety timer cleared from: ".concat(from));
+ clearTimeout(this.safetyTimer);
+ this.safetyTimer = null;
+ }
+ }
+ }, {
+ key: "enabled",
+ get: function get() {
+ var config = this.config;
+ return this.player.isHTML5 && this.player.isVideo && config.enabled && (!is$1.empty(config.publisherId) || is$1.url(config.tagUrl));
+ }
+ }, {
+ key: "tagUrl",
+ get: function get() {
+ var config = this.config;
+
+ if (is$1.url(config.tagUrl)) {
+ return config.tagUrl;
+ }
+
+ var params = {
+ AV_PUBLISHERID: '58c25bb0073ef448b1087ad6',
+ AV_CHANNELID: '5a0458dc28a06145e4519d21',
+ AV_URL: window.location.hostname,
+ cb: Date.now(),
+ AV_WIDTH: 640,
+ AV_HEIGHT: 480,
+ AV_CDIM2: config.publisherId
+ };
+ var base = 'https://go.aniview.com/api/adserver6/vast/';
+ return "".concat(base, "?").concat(buildUrlParams(params));
+ }
+ }]);
+
+ return Ads;
+ }();
+
+ var parseVtt = function parseVtt(vttDataString) {
+ var processedList = [];
+ var frames = vttDataString.split(/\r\n\r\n|\n\n|\r\r/);
+ frames.forEach(function (frame) {
+ var result = {};
+ var lines = frame.split(/\r\n|\n|\r/);
+ lines.forEach(function (line) {
+ if (!is$1.number(result.startTime)) {
+ // The line with start and end times on it is the first line of interest
+ 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
+
+ if (matchTimes) {
+ result.startTime = Number(matchTimes[1] || 0) * 60 * 60 + Number(matchTimes[2]) * 60 + Number(matchTimes[3]) + Number("0.".concat(matchTimes[4]));
+ result.endTime = Number(matchTimes[6] || 0) * 60 * 60 + Number(matchTimes[7]) * 60 + Number(matchTimes[8]) + Number("0.".concat(matchTimes[9]));
+ }
+ } else if (!is$1.empty(line.trim()) && is$1.empty(result.text)) {
+ // If we already have the startTime, then we're definitely up to the text line(s)
+ var lineSplit = line.trim().split('#xywh=');
+
+ var _lineSplit = _slicedToArray(lineSplit, 1);
+
+ result.text = _lineSplit[0];
+
+ // If there's content in lineSplit[1], then we have sprites. If not, then it's just one frame per image
+ if (lineSplit[1]) {
+ var _lineSplit$1$split = lineSplit[1].split(',');
+
+ var _lineSplit$1$split2 = _slicedToArray(_lineSplit$1$split, 4);
+
+ result.x = _lineSplit$1$split2[0];
+ result.y = _lineSplit$1$split2[1];
+ result.w = _lineSplit$1$split2[2];
+ result.h = _lineSplit$1$split2[3];
+ }
+ }
+ });
+
+ if (result.text) {
+ processedList.push(result);
+ }
+ });
+ return processedList;
+ };
+ /**
+ * Preview thumbnails for seek hover and scrubbing
+ * Seeking: Hover over the seek bar (desktop only): shows a small preview container above the seek bar
+ * 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
+ *
+ * Notes:
+ * - 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
+ * - 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
+ * - 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
+ */
+
+
+ var fitRatio = function fitRatio(ratio, outer) {
+ var targetRatio = outer.width / outer.height;
+ var result = {};
+
+ if (ratio > targetRatio) {
+ result.width = outer.width;
+ result.height = 1 / ratio * outer.width;
+ } else {
+ result.height = outer.height;
+ result.width = ratio * outer.height;
+ }
+
+ return result;
+ };
+
+ var PreviewThumbnails = /*#__PURE__*/function () {
+ /**
+ * PreviewThumbnails constructor.
+ * @param {Plyr} player
+ * @return {PreviewThumbnails}
+ */
+ function PreviewThumbnails(player) {
+ _classCallCheck(this, PreviewThumbnails);
+
+ this.player = player;
+ this.thumbnails = [];
+ this.loaded = false;
+ this.lastMouseMoveTime = Date.now();
+ this.mouseDown = false;
+ this.loadedImages = [];
+ this.elements = {
+ thumb: {},
+ scrubbing: {}
+ };
+ this.load();
+ }
+
+ _createClass(PreviewThumbnails, [{
+ key: "load",
+ value: function load() {
+ var _this = this;
+
+ // Toggle the regular seek tooltip
+ if (this.player.elements.display.seekTooltip) {
+ this.player.elements.display.seekTooltip.hidden = this.enabled;
+ }
+
+ if (!this.enabled) {
+ return;
+ }
+
+ this.getThumbnails().then(function () {
+ if (!_this.enabled) {
+ return;
+ } // Render DOM elements
+
+
+ _this.render(); // Check to see if thumb container size was specified manually in CSS
+
+
+ _this.determineContainerAutoSizing();
+
+ _this.loaded = true;
+ });
+ } // Download VTT files and parse them
+
+ }, {
+ key: "getThumbnails",
+ value: function getThumbnails() {
+ var _this2 = this;
+
+ return new Promise(function (resolve) {
+ var src = _this2.player.config.previewThumbnails.src;
+
+ if (is$1.empty(src)) {
+ throw new Error('Missing previewThumbnails.src config attribute');
+ } // Resolve promise
+
+
+ var sortAndResolve = function sortAndResolve() {
+ // Sort smallest to biggest (e.g., [120p, 480p, 1080p])
+ _this2.thumbnails.sort(function (x, y) {
+ return x.height - y.height;
+ });
+
+ _this2.player.debug.log('Preview thumbnails', _this2.thumbnails);
+
+ resolve();
+ }; // Via callback()
+
+
+ if (is$1.function(src)) {
+ src(function (thumbnails) {
+ _this2.thumbnails = thumbnails;
+ sortAndResolve();
+ });
+ } // VTT urls
+ else {
+ // If string, convert into single-element list
+ 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
+
+ var promises = urls.map(function (u) {
+ return _this2.getThumbnail(u);
+ }); // Resolve
+
+ Promise.all(promises).then(sortAndResolve);
+ }
+ });
+ } // Process individual VTT file
+
+ }, {
+ key: "getThumbnail",
+ value: function getThumbnail(url) {
+ var _this3 = this;
+
+ return new Promise(function (resolve) {
+ fetch(url).then(function (response) {
+ var thumbnail = {
+ frames: parseVtt(response),
+ height: null,
+ urlPrefix: ''
+ }; // If the URLs don't start with '/', then we need to set their relative path to be the location of the VTT file
+ // If the URLs do start with '/', then they obviously don't need a prefix, so it will remain blank
+ // 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
+
+ if (!thumbnail.frames[0].text.startsWith('/') && !thumbnail.frames[0].text.startsWith('http://') && !thumbnail.frames[0].text.startsWith('https://')) {
+ thumbnail.urlPrefix = url.substring(0, url.lastIndexOf('/') + 1);
+ } // Download the first frame, so that we can determine/set the height of this thumbnailsDef
+
+
+ var tempImage = new Image();
+
+ tempImage.onload = function () {
+ thumbnail.height = tempImage.naturalHeight;
+ thumbnail.width = tempImage.naturalWidth;
+
+ _this3.thumbnails.push(thumbnail);
+
+ resolve();
+ };
+
+ tempImage.src = thumbnail.urlPrefix + thumbnail.frames[0].text;
+ });
+ });
+ }
+ }, {
+ key: "startMove",
+ value: function startMove(event) {
+ if (!this.loaded) {
+ return;
+ }
+
+ if (!is$1.event(event) || !['touchmove', 'mousemove'].includes(event.type)) {
+ return;
+ } // Wait until media has a duration
+
+
+ if (!this.player.media.duration) {
+ return;
+ }
+
+ if (event.type === 'touchmove') {
+ // Calculate seek hover position as approx video seconds
+ this.seekTime = this.player.media.duration * (this.player.elements.inputs.seek.value / 100);
+ } else {
+ // Calculate seek hover position as approx video seconds
+ var clientRect = this.player.elements.progress.getBoundingClientRect();
+ var percentage = 100 / clientRect.width * (event.pageX - clientRect.left);
+ this.seekTime = this.player.media.duration * (percentage / 100);
+
+ if (this.seekTime < 0) {
+ // The mousemove fires for 10+px out to the left
+ this.seekTime = 0;
+ }
+
+ if (this.seekTime > this.player.media.duration - 1) {
+ // Took 1 second off the duration for safety, because different players can disagree on the real duration of a video
+ this.seekTime = this.player.media.duration - 1;
+ }
+
+ this.mousePosX = event.pageX; // Set time text inside image container
+
+ this.elements.thumb.time.innerText = formatTime(this.seekTime);
+ } // Download and show image
+
+
+ this.showImageAtCurrentTime();
+ }
+ }, {
+ key: "endMove",
+ value: function endMove() {
+ this.toggleThumbContainer(false, true);
+ }
+ }, {
+ key: "startScrubbing",
+ value: function startScrubbing(event) {
+ // Only act on left mouse button (0), or touch device (event.button does not exist or is false)
+ if (is$1.nullOrUndefined(event.button) || event.button === false || event.button === 0) {
+ this.mouseDown = true; // Wait until media has a duration
+
+ if (this.player.media.duration) {
+ this.toggleScrubbingContainer(true);
+ this.toggleThumbContainer(false, true); // Download and show image
+
+ this.showImageAtCurrentTime();
+ }
+ }
+ }
+ }, {
+ key: "endScrubbing",
+ value: function endScrubbing() {
+ var _this4 = this;
+
+ this.mouseDown = false; // Hide scrubbing preview. But wait until the video has successfully seeked before hiding the scrubbing preview
+
+ if (Math.ceil(this.lastTime) === Math.ceil(this.player.media.currentTime)) {
+ // The video was already seeked/loaded at the chosen time - hide immediately
+ this.toggleScrubbingContainer(false);
+ } else {
+ // The video hasn't seeked yet. Wait for that
+ once.call(this.player, this.player.media, 'timeupdate', function () {
+ // Re-check mousedown - we might have already started scrubbing again
+ if (!_this4.mouseDown) {
+ _this4.toggleScrubbingContainer(false);
+ }
+ });
+ }
+ }
+ /**
+ * Setup hooks for Plyr and window events
+ */
+
+ }, {
+ key: "listeners",
+ value: function listeners() {
+ var _this5 = this;
+
+ // 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
+ this.player.on('play', function () {
+ _this5.toggleThumbContainer(false, true);
+ });
+ this.player.on('seeked', function () {
+ _this5.toggleThumbContainer(false);
+ });
+ this.player.on('timeupdate', function () {
+ _this5.lastTime = _this5.player.media.currentTime;
+ });
+ }
+ /**
+ * Create HTML elements for image containers
+ */
+
+ }, {
+ key: "render",
+ value: function render() {
+ // Create HTML element: plyr__preview-thumbnail-container
+ this.elements.thumb.container = createElement('div', {
+ class: this.player.config.classNames.previewThumbnails.thumbContainer
+ }); // Wrapper for the image for styling
+
+ this.elements.thumb.imageContainer = createElement('div', {
+ class: this.player.config.classNames.previewThumbnails.imageContainer
+ });
+ this.elements.thumb.container.appendChild(this.elements.thumb.imageContainer); // Create HTML element, parent+span: time text (e.g., 01:32:00)
+
+ var timeContainer = createElement('div', {
+ class: this.player.config.classNames.previewThumbnails.timeContainer
+ });
+ this.elements.thumb.time = createElement('span', {}, '00:00');
+ timeContainer.appendChild(this.elements.thumb.time);
+ this.elements.thumb.container.appendChild(timeContainer); // Inject the whole thumb
+
+ if (is$1.element(this.player.elements.progress)) {
+ this.player.elements.progress.appendChild(this.elements.thumb.container);
+ } // Create HTML element: plyr__preview-scrubbing-container
+
+
+ this.elements.scrubbing.container = createElement('div', {
+ class: this.player.config.classNames.previewThumbnails.scrubbingContainer
+ });
+ this.player.elements.wrapper.appendChild(this.elements.scrubbing.container);
+ }
+ }, {
+ key: "destroy",
+ value: function destroy() {
+ if (this.elements.thumb.container) {
+ this.elements.thumb.container.remove();
+ }
+
+ if (this.elements.scrubbing.container) {
+ this.elements.scrubbing.container.remove();
+ }
+ }
+ }, {
+ key: "showImageAtCurrentTime",
+ value: function showImageAtCurrentTime() {
+ var _this6 = this;
+
+ if (this.mouseDown) {
+ this.setScrubbingContainerSize();
+ } else {
+ this.setThumbContainerSizeAndPos();
+ } // Find the desired thumbnail index
+ // TODO: Handle a video longer than the thumbs where thumbNum is null
+
+
+ var thumbNum = this.thumbnails[0].frames.findIndex(function (frame) {
+ return _this6.seekTime >= frame.startTime && _this6.seekTime <= frame.endTime;
+ });
+ var hasThumb = thumbNum >= 0;
+ var qualityIndex = 0; // Show the thumb container if we're not scrubbing
+
+ if (!this.mouseDown) {
+ this.toggleThumbContainer(hasThumb);
+ } // No matching thumb found
+
+
+ if (!hasThumb) {
+ return;
+ } // Check to see if we've already downloaded higher quality versions of this image
+
+
+ this.thumbnails.forEach(function (thumbnail, index) {
+ if (_this6.loadedImages.includes(thumbnail.frames[thumbNum].text)) {
+ qualityIndex = index;
+ }
+ }); // Only proceed if either thumbnum or thumbfilename has changed
+
+ if (thumbNum !== this.showingThumb) {
+ this.showingThumb = thumbNum;
+ this.loadImage(qualityIndex);
+ }
+ } // Show the image that's currently specified in this.showingThumb
+
+ }, {
+ key: "loadImage",
+ value: function loadImage() {
+ var _this7 = this;
+
+ var qualityIndex = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
+ var thumbNum = this.showingThumb;
+ var thumbnail = this.thumbnails[qualityIndex];
+ var urlPrefix = thumbnail.urlPrefix;
+ var frame = thumbnail.frames[thumbNum];
+ var thumbFilename = thumbnail.frames[thumbNum].text;
+ var thumbUrl = urlPrefix + thumbFilename;
+
+ if (!this.currentImageElement || this.currentImageElement.dataset.filename !== thumbFilename) {
+ // If we're already loading a previous image, remove its onload handler - we don't want it to load after this one
+ // Only do this if not using sprites. Without sprites we really want to show as many images as possible, as a best-effort
+ if (this.loadingImage && this.usingSprites) {
+ this.loadingImage.onload = null;
+ } // We're building and adding a new image. In other implementations of similar functionality (YouTube), background image
+ // is instead used. But this causes issues with larger images in Firefox and Safari - switching between background
+ // images causes a flicker. Putting a new image over the top does not
+
+
+ var previewImage = new Image();
+ previewImage.src = thumbUrl;
+ previewImage.dataset.index = thumbNum;
+ previewImage.dataset.filename = thumbFilename;
+ this.showingThumbFilename = thumbFilename;
+ 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...
+
+ previewImage.onload = function () {
+ return _this7.showImage(previewImage, frame, qualityIndex, thumbNum, thumbFilename, true);
+ };
+
+ this.loadingImage = previewImage;
+ this.removeOldImages(previewImage);
+ } else {
+ // Update the existing image
+ this.showImage(this.currentImageElement, frame, qualityIndex, thumbNum, thumbFilename, false);
+ this.currentImageElement.dataset.index = thumbNum;
+ this.removeOldImages(this.currentImageElement);
+ }
+ }
+ }, {
+ key: "showImage",
+ value: function showImage(previewImage, frame, qualityIndex, thumbNum, thumbFilename) {
+ var newImage = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : true;
+ this.player.debug.log("Showing thumb: ".concat(thumbFilename, ". num: ").concat(thumbNum, ". qual: ").concat(qualityIndex, ". newimg: ").concat(newImage));
+ this.setImageSizeAndOffset(previewImage, frame);
+
+ if (newImage) {
+ this.currentImageContainer.appendChild(previewImage);
+ this.currentImageElement = previewImage;
+
+ if (!this.loadedImages.includes(thumbFilename)) {
+ this.loadedImages.push(thumbFilename);
+ }
+ } // Preload images before and after the current one
+ // Show higher quality of the same frame
+ // 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
+
+
+ this.preloadNearby(thumbNum, true).then(this.preloadNearby(thumbNum, false)).then(this.getHigherQuality(qualityIndex, previewImage, frame, thumbFilename));
+ } // Remove all preview images that aren't the designated current image
+
+ }, {
+ key: "removeOldImages",
+ value: function removeOldImages(currentImage) {
+ var _this8 = this;
+
+ // Get a list of all images, convert it from a DOM list to an array
+ Array.from(this.currentImageContainer.children).forEach(function (image) {
+ if (image.tagName.toLowerCase() !== 'img') {
+ return;
+ }
+
+ var removeDelay = _this8.usingSprites ? 500 : 1000;
+
+ if (image.dataset.index !== currentImage.dataset.index && !image.dataset.deleting) {
+ // 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
+ // First set attribute 'deleting' to prevent multi-handling of this on repeat firing of this function
+ // eslint-disable-next-line no-param-reassign
+ image.dataset.deleting = true; // This has to be set before the timeout - to prevent issues switching between hover and scrub
+
+ var currentImageContainer = _this8.currentImageContainer;
+ setTimeout(function () {
+ currentImageContainer.removeChild(image);
+
+ _this8.player.debug.log("Removing thumb: ".concat(image.dataset.filename));
+ }, removeDelay);
+ }
+ });
+ } // Preload images before and after the current one. Only if the user is still hovering/seeking the same frame
+ // This will only preload the lowest quality
+
+ }, {
+ key: "preloadNearby",
+ value: function preloadNearby(thumbNum) {
+ var _this9 = this;
+
+ var forward = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
+ return new Promise(function (resolve) {
+ setTimeout(function () {
+ var oldThumbFilename = _this9.thumbnails[0].frames[thumbNum].text;
+
+ if (_this9.showingThumbFilename === oldThumbFilename) {
+ // 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
+ var thumbnailsClone;
+
+ if (forward) {
+ thumbnailsClone = _this9.thumbnails[0].frames.slice(thumbNum);
+ } else {
+ thumbnailsClone = _this9.thumbnails[0].frames.slice(0, thumbNum).reverse();
+ }
+
+ var foundOne = false;
+ thumbnailsClone.forEach(function (frame) {
+ var newThumbFilename = frame.text;
+
+ if (newThumbFilename !== oldThumbFilename) {
+ // Found one with a different filename. Make sure it hasn't already been loaded on this page visit
+ if (!_this9.loadedImages.includes(newThumbFilename)) {
+ foundOne = true;
+
+ _this9.player.debug.log("Preloading thumb filename: ".concat(newThumbFilename));
+
+ var urlPrefix = _this9.thumbnails[0].urlPrefix;
+ var thumbURL = urlPrefix + newThumbFilename;
+ var previewImage = new Image();
+ previewImage.src = thumbURL;
+
+ previewImage.onload = function () {
+ _this9.player.debug.log("Preloaded thumb filename: ".concat(newThumbFilename));
+
+ if (!_this9.loadedImages.includes(newThumbFilename)) _this9.loadedImages.push(newThumbFilename); // We don't resolve until the thumb is loaded
+
+ resolve();
+ };
+ }
+ }
+ }); // If there are none to preload then we want to resolve immediately
+
+ if (!foundOne) {
+ resolve();
+ }
+ }
+ }, 300);
+ });
+ } // If user has been hovering current image for half a second, look for a higher quality one
+
+ }, {
+ key: "getHigherQuality",
+ value: function getHigherQuality(currentQualityIndex, previewImage, frame, thumbFilename) {
+ var _this10 = this;
+
+ if (currentQualityIndex < this.thumbnails.length - 1) {
+ // 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
+ var previewImageHeight = previewImage.naturalHeight;
+
+ if (this.usingSprites) {
+ previewImageHeight = frame.h;
+ }
+
+ if (previewImageHeight < this.thumbContainerHeight) {
+ // Recurse back to the loadImage function - show a higher quality one, but only if the viewer is on this frame for a while
+ setTimeout(function () {
+ // Make sure the mouse hasn't already moved on and started hovering at another image
+ if (_this10.showingThumbFilename === thumbFilename) {
+ _this10.player.debug.log("Showing higher quality thumb for: ".concat(thumbFilename));
+
+ _this10.loadImage(currentQualityIndex + 1);
+ }
+ }, 300);
+ }
+ }
+ }
+ }, {
+ key: "toggleThumbContainer",
+ value: function toggleThumbContainer() {
+ var toggle = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
+ var clearShowing = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
+ var className = this.player.config.classNames.previewThumbnails.thumbContainerShown;
+ this.elements.thumb.container.classList.toggle(className, toggle);
+
+ if (!toggle && clearShowing) {
+ this.showingThumb = null;
+ this.showingThumbFilename = null;
+ }
+ }
+ }, {
+ key: "toggleScrubbingContainer",
+ value: function toggleScrubbingContainer() {
+ var toggle = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
+ var className = this.player.config.classNames.previewThumbnails.scrubbingContainerShown;
+ this.elements.scrubbing.container.classList.toggle(className, toggle);
+
+ if (!toggle) {
+ this.showingThumb = null;
+ this.showingThumbFilename = null;
+ }
+ }
+ }, {
+ key: "determineContainerAutoSizing",
+ value: function determineContainerAutoSizing() {
+ if (this.elements.thumb.imageContainer.clientHeight > 20 || this.elements.thumb.imageContainer.clientWidth > 20) {
+ // This will prevent auto sizing in this.setThumbContainerSizeAndPos()
+ this.sizeSpecifiedInCSS = true;
+ }
+ } // 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
+
+ }, {
+ key: "setThumbContainerSizeAndPos",
+ value: function setThumbContainerSizeAndPos() {
+ if (!this.sizeSpecifiedInCSS) {
+ var thumbWidth = Math.floor(this.thumbContainerHeight * this.thumbAspectRatio);
+ this.elements.thumb.imageContainer.style.height = "".concat(this.thumbContainerHeight, "px");
+ this.elements.thumb.imageContainer.style.width = "".concat(thumbWidth, "px");
+ } else if (this.elements.thumb.imageContainer.clientHeight > 20 && this.elements.thumb.imageContainer.clientWidth < 20) {
+ var _thumbWidth = Math.floor(this.elements.thumb.imageContainer.clientHeight * this.thumbAspectRatio);
+
+ this.elements.thumb.imageContainer.style.width = "".concat(_thumbWidth, "px");
+ } else if (this.elements.thumb.imageContainer.clientHeight < 20 && this.elements.thumb.imageContainer.clientWidth > 20) {
+ var thumbHeight = Math.floor(this.elements.thumb.imageContainer.clientWidth / this.thumbAspectRatio);
+ this.elements.thumb.imageContainer.style.height = "".concat(thumbHeight, "px");
+ }
+
+ this.setThumbContainerPos();
+ }
+ }, {
+ key: "setThumbContainerPos",
+ value: function setThumbContainerPos() {
+ var seekbarRect = this.player.elements.progress.getBoundingClientRect();
+ var plyrRect = this.player.elements.container.getBoundingClientRect();
+ 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
+
+ var minVal = plyrRect.left - seekbarRect.left + 10;
+ var maxVal = plyrRect.right - seekbarRect.left - container.clientWidth - 10; // Set preview container position to: mousepos, minus seekbar.left, minus half of previewContainer.clientWidth
+
+ var previewPos = this.mousePosX - seekbarRect.left - container.clientWidth / 2;
+
+ if (previewPos < minVal) {
+ previewPos = minVal;
+ }
+
+ if (previewPos > maxVal) {
+ previewPos = maxVal;
+ }
+
+ container.style.left = "".concat(previewPos, "px");
+ } // Can't use 100% width, in case the video is a different aspect ratio to the video container
+
+ }, {
+ key: "setScrubbingContainerSize",
+ value: function setScrubbingContainerSize() {
+ var _fitRatio = fitRatio(this.thumbAspectRatio, {
+ width: this.player.media.clientWidth,
+ height: this.player.media.clientHeight
+ }),
+ width = _fitRatio.width,
+ height = _fitRatio.height;
+
+ this.elements.scrubbing.container.style.width = "".concat(width, "px");
+ this.elements.scrubbing.container.style.height = "".concat(height, "px");
+ } // Sprites need to be offset to the correct location
+
+ }, {
+ key: "setImageSizeAndOffset",
+ value: function setImageSizeAndOffset(previewImage, frame) {
+ if (!this.usingSprites) {
+ return;
+ } // Find difference between height and preview container height
+
+
+ var multiplier = this.thumbContainerHeight / frame.h; // eslint-disable-next-line no-param-reassign
+
+ previewImage.style.height = "".concat(previewImage.naturalHeight * multiplier, "px"); // eslint-disable-next-line no-param-reassign
+
+ previewImage.style.width = "".concat(previewImage.naturalWidth * multiplier, "px"); // eslint-disable-next-line no-param-reassign
+
+ previewImage.style.left = "-".concat(frame.x * multiplier, "px"); // eslint-disable-next-line no-param-reassign
+
+ previewImage.style.top = "-".concat(frame.y * multiplier, "px");
+ }
+ }, {
+ key: "enabled",
+ get: function get() {
+ return this.player.isHTML5 && this.player.isVideo && this.player.config.previewThumbnails.enabled;
+ }
+ }, {
+ key: "currentImageContainer",
+ get: function get() {
+ if (this.mouseDown) {
+ return this.elements.scrubbing.container;
+ }
+
+ return this.elements.thumb.imageContainer;
+ }
+ }, {
+ key: "usingSprites",
+ get: function get() {
+ return Object.keys(this.thumbnails[0].frames[0]).includes('w');
+ }
+ }, {
+ key: "thumbAspectRatio",
+ get: function get() {
+ if (this.usingSprites) {
+ return this.thumbnails[0].frames[0].w / this.thumbnails[0].frames[0].h;
+ }
+
+ return this.thumbnails[0].width / this.thumbnails[0].height;
+ }
+ }, {
+ key: "thumbContainerHeight",
+ get: function get() {
+ if (this.mouseDown) {
+ var _fitRatio2 = fitRatio(this.thumbAspectRatio, {
+ width: this.player.media.clientWidth,
+ height: this.player.media.clientHeight
+ }),
+ height = _fitRatio2.height;
+
+ return height;
+ } // If css is used this needs to return the css height for sprites to work (see setImageSizeAndOffset)
+
+
+ if (this.sizeSpecifiedInCSS) {
+ return this.elements.thumb.imageContainer.clientHeight;
+ }
+
+ return Math.floor(this.player.media.clientWidth / this.thumbAspectRatio / 4);
+ }
+ }, {
+ key: "currentImageElement",
+ get: function get() {
+ if (this.mouseDown) {
+ return this.currentScrubbingImageElement;
+ }
+
+ return this.currentThumbnailImageElement;
+ },
+ set: function set(element) {
+ if (this.mouseDown) {
+ this.currentScrubbingImageElement = element;
+ } else {
+ this.currentThumbnailImageElement = element;
+ }
+ }
+ }]);
+
+ return PreviewThumbnails;
+ }();
+
+ var source = {
+ // Add elements to HTML5 media (source, tracks, etc)
+ insertElements: function insertElements(type, attributes) {
+ var _this = this;
+
+ if (is$1.string(attributes)) {
+ insertElement(type, this.media, {
+ src: attributes
+ });
+ } else if (is$1.array(attributes)) {
+ attributes.forEach(function (attribute) {
+ insertElement(type, _this.media, attribute);
+ });
+ }
+ },
+ // Update source
+ // Sources are not checked for support so be careful
+ change: function change(input) {
+ var _this2 = this;
+
+ if (!getDeep(input, 'sources.length')) {
+ this.debug.warn('Invalid source format');
+ return;
+ } // Cancel current network requests
+
+
+ html5.cancelRequests.call(this); // Destroy instance and re-setup
+
+ this.destroy.call(this, function () {
+ // Reset quality options
+ _this2.options.quality = []; // Remove elements
+
+ removeElement(_this2.media);
+ _this2.media = null; // Reset class name
+
+ if (is$1.element(_this2.elements.container)) {
+ _this2.elements.container.removeAttribute('class');
+ } // Set the type and provider
+
+
+ var sources = input.sources,
+ type = input.type;
+
+ var _sources = _slicedToArray(sources, 1),
+ _sources$ = _sources[0],
+ _sources$$provider = _sources$.provider,
+ provider = _sources$$provider === void 0 ? providers.html5 : _sources$$provider,
+ src = _sources$.src;
+
+ var tagName = provider === 'html5' ? type : 'div';
+ var attributes = provider === 'html5' ? {} : {
+ src: src
+ };
+ Object.assign(_this2, {
+ provider: provider,
+ type: type,
+ // Check for support
+ supported: support.check(type, provider, _this2.config.playsinline),
+ // Create new element
+ media: createElement(tagName, attributes)
+ }); // Inject the new element
+
+ _this2.elements.container.appendChild(_this2.media); // Autoplay the new source?
+
+
+ if (is$1.boolean(input.autoplay)) {
+ _this2.config.autoplay = input.autoplay;
+ } // Set attributes for audio and video
+
+
+ if (_this2.isHTML5) {
+ if (_this2.config.crossorigin) {
+ _this2.media.setAttribute('crossorigin', '');
+ }
+
+ if (_this2.config.autoplay) {
+ _this2.media.setAttribute('autoplay', '');
+ }
+
+ if (!is$1.empty(input.poster)) {
+ _this2.poster = input.poster;
+ }
+
+ if (_this2.config.loop.active) {
+ _this2.media.setAttribute('loop', '');
+ }
+
+ if (_this2.config.muted) {
+ _this2.media.setAttribute('muted', '');
+ }
+
+ if (_this2.config.playsinline) {
+ _this2.media.setAttribute('playsinline', '');
+ }
+ } // Restore class hook
+
+
+ ui.addStyleHook.call(_this2); // Set new sources for html5
+
+ if (_this2.isHTML5) {
+ source.insertElements.call(_this2, 'source', sources);
+ } // Set video title
+
+
+ _this2.config.title = input.title; // Set up from scratch
+
+ media.setup.call(_this2); // HTML5 stuff
+
+ if (_this2.isHTML5) {
+ // Setup captions
+ if (Object.keys(input).includes('tracks')) {
+ source.insertElements.call(_this2, 'track', input.tracks);
+ }
+ } // If HTML5 or embed but not fully supported, setupInterface and call ready now
+
+
+ if (_this2.isHTML5 || _this2.isEmbed && !_this2.supported.ui) {
+ // Setup interface
+ ui.build.call(_this2);
+ } // Load HTML5 sources
+
+
+ if (_this2.isHTML5) {
+ _this2.media.load();
+ } // Update previewThumbnails config & reload plugin
+
+
+ if (!is$1.empty(input.previewThumbnails)) {
+ Object.assign(_this2.config.previewThumbnails, input.previewThumbnails); // Cleanup previewThumbnails plugin if it was loaded
+
+ if (_this2.previewThumbnails && _this2.previewThumbnails.loaded) {
+ _this2.previewThumbnails.destroy();
+
+ _this2.previewThumbnails = null;
+ } // Create new instance if it is still enabled
+
+
+ if (_this2.config.previewThumbnails.enabled) {
+ _this2.previewThumbnails = new PreviewThumbnails(_this2);
+ }
+ } // Update the fullscreen support
+
+
+ _this2.fullscreen.update();
+ }, true);
+ }
+ };
+
+ /**
+ * Returns a number whose value is limited to the given range.
+ *
+ * Example: limit the output of this computation to between 0 and 255
+ * (x * 255).clamp(0, 255)
+ *
+ * @param {Number} input
+ * @param {Number} min The lower boundary of the output range
+ * @param {Number} max The upper boundary of the output range
+ * @returns A number in the range [min, max]
+ * @type Number
+ */
+ function clamp() {
+ var input = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
+ var min = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
+ var max = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 255;
+ return Math.min(Math.max(input, min), max);
+ }
+
+ // TODO: Use a WeakMap for private globals
+ // const globals = new WeakMap();
+ // Plyr instance
+
+ var Plyr = /*#__PURE__*/function () {
+ function Plyr(target, options) {
+ var _this = this;
+
+ _classCallCheck(this, Plyr);
+
+ this.timers = {}; // State
+
+ this.ready = false;
+ this.loading = false;
+ this.failed = false; // Touch device
+
+ this.touch = support.touch; // Set the media element
+
+ this.media = target; // String selector passed
+
+ if (is$1.string(this.media)) {
+ this.media = document.querySelectorAll(this.media);
+ } // jQuery, NodeList or Array passed, use first element
+
+
+ if (window.jQuery && this.media instanceof jQuery || is$1.nodeList(this.media) || is$1.array(this.media)) {
+ // eslint-disable-next-line
+ this.media = this.media[0];
+ } // Set config
+
+
+ this.config = extend({}, defaults$1, Plyr.defaults, options || {}, function () {
+ try {
+ return JSON.parse(_this.media.getAttribute('data-plyr-config'));
+ } catch (e) {
+ return {};
+ }
+ }()); // Elements cache
+
+ this.elements = {
+ container: null,
+ fullscreen: null,
+ captions: null,
+ buttons: {},
+ display: {},
+ progress: {},
+ inputs: {},
+ settings: {
+ popup: null,
+ menu: null,
+ panels: {},
+ buttons: {}
+ }
+ }; // Captions
+
+ this.captions = {
+ active: null,
+ currentTrack: -1,
+ meta: new WeakMap()
+ }; // Fullscreen
+
+ this.fullscreen = {
+ active: false
+ }; // Options
+
+ this.options = {
+ speed: [],
+ quality: []
+ }; // Debugging
+ // TODO: move to globals
+
+ this.debug = new Console(this.config.debug); // Log config options and support
+
+ this.debug.log('Config', this.config);
+ this.debug.log('Support', support); // We need an element to setup
+
+ if (is$1.nullOrUndefined(this.media) || !is$1.element(this.media)) {
+ this.debug.error('Setup failed: no suitable element passed');
+ return;
+ } // Bail if the element is initialized
+
+
+ if (this.media.plyr) {
+ this.debug.warn('Target already setup');
+ return;
+ } // Bail if not enabled
+
+
+ if (!this.config.enabled) {
+ this.debug.error('Setup failed: disabled by config');
+ return;
+ } // Bail if disabled or no basic support
+ // You may want to disable certain UAs etc
+
+
+ if (!support.check().api) {
+ this.debug.error('Setup failed: no support');
+ return;
+ } // Cache original element state for .destroy()
+
+
+ var clone = this.media.cloneNode(true);
+ clone.autoplay = false;
+ this.elements.original = clone; // Set media type based on tag or data attribute
+ // Supported: video, audio, vimeo, youtube
+
+ var type = this.media.tagName.toLowerCase(); // Embed properties
+
+ var iframe = null;
+ var url = null; // Different setup based on type
+
+ switch (type) {
+ case 'div':
+ // Find the frame
+ iframe = this.media.querySelector('iframe'); // <iframe> type
+
+ if (is$1.element(iframe)) {
+ // Detect provider
+ url = parseUrl(iframe.getAttribute('src'));
+ this.provider = getProviderByUrl(url.toString()); // Rework elements
+
+ this.elements.container = this.media;
+ this.media = iframe; // Reset classname
+
+ this.elements.container.className = ''; // Get attributes from URL and set config
+
+ if (url.search.length) {
+ var truthy = ['1', 'true'];
+
+ if (truthy.includes(url.searchParams.get('autoplay'))) {
+ this.config.autoplay = true;
+ }
+
+ if (truthy.includes(url.searchParams.get('loop'))) {
+ this.config.loop.active = true;
+ } // TODO: replace fullscreen.iosNative with this playsinline config option
+ // YouTube requires the playsinline in the URL
+
+
+ if (this.isYouTube) {
+ this.config.playsinline = truthy.includes(url.searchParams.get('playsinline'));
+ this.config.youtube.hl = url.searchParams.get('hl'); // TODO: Should this be setting language?
+ } else {
+ this.config.playsinline = true;
+ }
+ }
+ } else {
+ // <div> with attributes
+ this.provider = this.media.getAttribute(this.config.attributes.embed.provider); // Remove attribute
+
+ this.media.removeAttribute(this.config.attributes.embed.provider);
+ } // Unsupported or missing provider
+
+
+ if (is$1.empty(this.provider) || !Object.keys(providers).includes(this.provider)) {
+ this.debug.error('Setup failed: Invalid provider');
+ return;
+ } // Audio will come later for external providers
+
+
+ this.type = types.video;
+ break;
+
+ case 'video':
+ case 'audio':
+ this.type = type;
+ this.provider = providers.html5; // Get config from attributes
+
+ if (this.media.hasAttribute('crossorigin')) {
+ this.config.crossorigin = true;
+ }
+
+ if (this.media.hasAttribute('autoplay')) {
+ this.config.autoplay = true;
+ }
+
+ if (this.media.hasAttribute('playsinline') || this.media.hasAttribute('webkit-playsinline')) {
+ this.config.playsinline = true;
+ }
+
+ if (this.media.hasAttribute('muted')) {
+ this.config.muted = true;
+ }
+
+ if (this.media.hasAttribute('loop')) {
+ this.config.loop.active = true;
+ }
+
+ break;
+
+ default:
+ this.debug.error('Setup failed: unsupported type');
+ return;
+ } // Check for support again but with type
+
+
+ this.supported = support.check(this.type, this.provider, this.config.playsinline); // If no support for even API, bail
+
+ if (!this.supported.api) {
+ this.debug.error('Setup failed: no support');
+ return;
+ }
+
+ this.eventListeners = []; // Create listeners
+
+ this.listeners = new Listeners(this); // Setup local storage for user settings
+
+ this.storage = new Storage(this); // Store reference
+
+ this.media.plyr = this; // Wrap media
+
+ if (!is$1.element(this.elements.container)) {
+ this.elements.container = createElement('div', {
+ tabindex: 0
+ });
+ wrap(this.media, this.elements.container);
+ } // Migrate custom properties from media to container (so they work 😉)
+
+
+ ui.migrateStyles.call(this); // Add style hook
+
+ ui.addStyleHook.call(this); // Setup media
+
+ media.setup.call(this); // Listen for events if debugging
+
+ if (this.config.debug) {
+ on.call(this, this.elements.container, this.config.events.join(' '), function (event) {
+ _this.debug.log("event: ".concat(event.type));
+ });
+ } // Setup fullscreen
+
+
+ this.fullscreen = new Fullscreen(this); // Setup interface
+ // If embed but not fully supported, build interface now to avoid flash of controls
+
+ if (this.isHTML5 || this.isEmbed && !this.supported.ui) {
+ ui.build.call(this);
+ } // Container listeners
+
+
+ this.listeners.container(); // Global listeners
+
+ this.listeners.global(); // Setup ads if provided
+
+ if (this.config.ads.enabled) {
+ this.ads = new Ads(this);
+ } // Autoplay if required
+
+
+ if (this.isHTML5 && this.config.autoplay) {
+ setTimeout(function () {
+ return silencePromise(_this.play());
+ }, 10);
+ } // Seek time will be recorded (in listeners.js) so we can prevent hiding controls for a few seconds after seek
+
+
+ this.lastSeekTime = 0; // Setup preview thumbnails if enabled
+
+ if (this.config.previewThumbnails.enabled) {
+ this.previewThumbnails = new PreviewThumbnails(this);
+ }
+ } // ---------------------------------------
+ // API
+ // ---------------------------------------
+
+ /**
+ * Types and provider helpers
+ */
+
+
+ _createClass(Plyr, [{
+ key: "play",
+
+ /**
+ * Play the media, or play the advertisement (if they are not blocked)
+ */
+ value: function play() {
+ var _this2 = this;
+
+ if (!is$1.function(this.media.play)) {
+ return null;
+ } // Intecept play with ads
+
+
+ if (this.ads && this.ads.enabled) {
+ this.ads.managerPromise.then(function () {
+ return _this2.ads.play();
+ }).catch(function () {
+ return silencePromise(_this2.media.play());
+ });
+ } // Return the promise (for HTML5)
+
+
+ return this.media.play();
+ }
+ /**
+ * Pause the media
+ */
+
+ }, {
+ key: "pause",
+ value: function pause() {
+ if (!this.playing || !is$1.function(this.media.pause)) {
+ return null;
+ }
+
+ return this.media.pause();
+ }
+ /**
+ * Get playing state
+ */
+
+ }, {
+ key: "togglePlay",
+
+ /**
+ * Toggle playback based on current status
+ * @param {Boolean} input
+ */
+ value: function togglePlay(input) {
+ // Toggle based on current state if nothing passed
+ var toggle = is$1.boolean(input) ? input : !this.playing;
+
+ if (toggle) {
+ return this.play();
+ }
+
+ return this.pause();
+ }
+ /**
+ * Stop playback
+ */
+
+ }, {
+ key: "stop",
+ value: function stop() {
+ if (this.isHTML5) {
+ this.pause();
+ this.restart();
+ } else if (is$1.function(this.media.stop)) {
+ this.media.stop();
+ }
+ }
+ /**
+ * Restart playback
+ */
+
+ }, {
+ key: "restart",
+ value: function restart() {
+ this.currentTime = 0;
+ }
+ /**
+ * Rewind
+ * @param {Number} seekTime - how far to rewind in seconds. Defaults to the config.seekTime
+ */
+
+ }, {
+ key: "rewind",
+ value: function rewind(seekTime) {
+ this.currentTime -= is$1.number(seekTime) ? seekTime : this.config.seekTime;
+ }
+ /**
+ * Fast forward
+ * @param {Number} seekTime - how far to fast forward in seconds. Defaults to the config.seekTime
+ */
+
+ }, {
+ key: "forward",
+ value: function forward(seekTime) {
+ this.currentTime += is$1.number(seekTime) ? seekTime : this.config.seekTime;
+ }
+ /**
+ * Seek to a time
+ * @param {Number} input - where to seek to in seconds. Defaults to 0 (the start)
+ */
+
+ }, {
+ key: "increaseVolume",
+
+ /**
+ * Increase volume
+ * @param {Boolean} step - How much to decrease by (between 0 and 1)
+ */
+ value: function increaseVolume(step) {
+ var volume = this.media.muted ? 0 : this.volume;
+ this.volume = volume + (is$1.number(step) ? step : 0);
+ }
+ /**
+ * Decrease volume
+ * @param {Boolean} step - How much to decrease by (between 0 and 1)
+ */
+
+ }, {
+ key: "decreaseVolume",
+ value: function decreaseVolume(step) {
+ this.increaseVolume(-step);
+ }
+ /**
+ * Set muted state
+ * @param {Boolean} mute
+ */
+
+ }, {
+ key: "toggleCaptions",
+
+ /**
+ * Toggle captions
+ * @param {Boolean} input - Whether to enable captions
+ */
+ value: function toggleCaptions(input) {
+ captions.toggle.call(this, input, false);
+ }
+ /**
+ * Set the caption track by index
+ * @param {Number} - Caption index
+ */
+
+ }, {
+ key: "airplay",
+
+ /**
+ * Trigger the airplay dialog
+ * TODO: update player with state, support, enabled
+ */
+ value: function airplay() {
+ // Show dialog if supported
+ if (support.airplay) {
+ this.media.webkitShowPlaybackTargetPicker();
+ }
+ }
+ /**
+ * Toggle the player controls
+ * @param {Boolean} [toggle] - Whether to show the controls
+ */
+
+ }, {
+ key: "toggleControls",
+ value: function toggleControls(toggle) {
+ // Don't toggle if missing UI support or if it's audio
+ if (this.supported.ui && !this.isAudio) {
+ // Get state before change
+ var isHidden = hasClass(this.elements.container, this.config.classNames.hideControls); // Negate the argument if not undefined since adding the class to hides the controls
+
+ var force = typeof toggle === 'undefined' ? undefined : !toggle; // Apply and get updated state
+
+ var hiding = toggleClass(this.elements.container, this.config.classNames.hideControls, force); // Close menu
+
+ if (hiding && is$1.array(this.config.controls) && this.config.controls.includes('settings') && !is$1.empty(this.config.settings)) {
+ controls.toggleMenu.call(this, false);
+ } // Trigger event on change
+
+
+ if (hiding !== isHidden) {
+ var eventName = hiding ? 'controlshidden' : 'controlsshown';
+ triggerEvent.call(this, this.media, eventName);
+ }
+
+ return !hiding;
+ }
+
+ return false;
+ }
+ /**
+ * Add event listeners
+ * @param {String} event - Event type
+ * @param {Function} callback - Callback for when event occurs
+ */
+
+ }, {
+ key: "on",
+ value: function on$1(event, callback) {
+ on.call(this, this.elements.container, event, callback);
+ }
+ /**
+ * Add event listeners once
+ * @param {String} event - Event type
+ * @param {Function} callback - Callback for when event occurs
+ */
+
+ }, {
+ key: "once",
+ value: function once$1(event, callback) {
+ once.call(this, this.elements.container, event, callback);
+ }
+ /**
+ * Remove event listeners
+ * @param {String} event - Event type
+ * @param {Function} callback - Callback for when event occurs
+ */
+
+ }, {
+ key: "off",
+ value: function off$1(event, callback) {
+ off(this.elements.container, event, callback);
+ }
+ /**
+ * Destroy an instance
+ * Event listeners are removed when elements are removed
+ * http://stackoverflow.com/questions/12528049/if-a-dom-element-is-removed-are-its-listeners-also-removed-from-memory
+ * @param {Function} callback - Callback for when destroy is complete
+ * @param {Boolean} soft - Whether it's a soft destroy (for source changes etc)
+ */
+
+ }, {
+ key: "destroy",
+ value: function destroy(callback) {
+ var _this3 = this;
+
+ var soft = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
+
+ if (!this.ready) {
+ return;
+ }
+
+ var done = function done() {
+ // Reset overflow (incase destroyed while in fullscreen)
+ document.body.style.overflow = ''; // GC for embed
+
+ _this3.embed = null; // If it's a soft destroy, make minimal changes
+
+ if (soft) {
+ if (Object.keys(_this3.elements).length) {
+ // Remove elements
+ removeElement(_this3.elements.buttons.play);
+ removeElement(_this3.elements.captions);
+ removeElement(_this3.elements.controls);
+ removeElement(_this3.elements.wrapper); // Clear for GC
+
+ _this3.elements.buttons.play = null;
+ _this3.elements.captions = null;
+ _this3.elements.controls = null;
+ _this3.elements.wrapper = null;
+ } // Callback
+
+
+ if (is$1.function(callback)) {
+ callback();
+ }
+ } else {
+ // Unbind listeners
+ unbindListeners.call(_this3); // Replace the container with the original element provided
+
+ replaceElement(_this3.elements.original, _this3.elements.container); // Event
+
+ triggerEvent.call(_this3, _this3.elements.original, 'destroyed', true); // Callback
+
+ if (is$1.function(callback)) {
+ callback.call(_this3.elements.original);
+ } // Reset state
+
+
+ _this3.ready = false; // Clear for garbage collection
+
+ setTimeout(function () {
+ _this3.elements = null;
+ _this3.media = null;
+ }, 200);
+ }
+ }; // Stop playback
+
+
+ this.stop(); // Clear timeouts
+
+ clearTimeout(this.timers.loading);
+ clearTimeout(this.timers.controls);
+ clearTimeout(this.timers.resized); // Provider specific stuff
+
+ if (this.isHTML5) {
+ // Restore native video controls
+ ui.toggleNativeControls.call(this, true); // Clean up
+
+ done();
+ } else if (this.isYouTube) {
+ // Clear timers
+ clearInterval(this.timers.buffering);
+ clearInterval(this.timers.playing); // Destroy YouTube API
+
+ if (this.embed !== null && is$1.function(this.embed.destroy)) {
+ this.embed.destroy();
+ } // Clean up
+
+
+ done();
+ } else if (this.isVimeo) {
+ // Destroy Vimeo API
+ // then clean up (wait, to prevent postmessage errors)
+ if (this.embed !== null) {
+ this.embed.unload().then(done);
+ } // Vimeo does not always return
+
+
+ setTimeout(done, 200);
+ }
+ }
+ /**
+ * Check for support for a mime type (HTML5 only)
+ * @param {String} type - Mime type
+ */
+
+ }, {
+ key: "supports",
+ value: function supports(type) {
+ return support.mime.call(this, type);
+ }
+ /**
+ * Check for support
+ * @param {String} type - Player type (audio/video)
+ * @param {String} provider - Provider (html5/youtube/vimeo)
+ * @param {Boolean} inline - Where player has `playsinline` sttribute
+ */
+
+ }, {
+ key: "isHTML5",
+ get: function get() {
+ return this.provider === providers.html5;
+ }
+ }, {
+ key: "isEmbed",
+ get: function get() {
+ return this.isYouTube || this.isVimeo;
+ }
+ }, {
+ key: "isYouTube",
+ get: function get() {
+ return this.provider === providers.youtube;
+ }
+ }, {
+ key: "isVimeo",
+ get: function get() {
+ return this.provider === providers.vimeo;
+ }
+ }, {
+ key: "isVideo",
+ get: function get() {
+ return this.type === types.video;
+ }
+ }, {
+ key: "isAudio",
+ get: function get() {
+ return this.type === types.audio;
+ }
+ }, {
+ key: "playing",
+ get: function get() {
+ return Boolean(this.ready && !this.paused && !this.ended);
+ }
+ /**
+ * Get paused state
+ */
+
+ }, {
+ key: "paused",
+ get: function get() {
+ return Boolean(this.media.paused);
+ }
+ /**
+ * Get stopped state
+ */
+
+ }, {
+ key: "stopped",
+ get: function get() {
+ return Boolean(this.paused && this.currentTime === 0);
+ }
+ /**
+ * Get ended state
+ */
+
+ }, {
+ key: "ended",
+ get: function get() {
+ return Boolean(this.media.ended);
+ }
+ }, {
+ key: "currentTime",
+ set: function set(input) {
+ // Bail if media duration isn't available yet
+ if (!this.duration) {
+ return;
+ } // Validate input
+
+
+ var inputIsValid = is$1.number(input) && input > 0; // Set
+
+ this.media.currentTime = inputIsValid ? Math.min(input, this.duration) : 0; // Logging
+
+ this.debug.log("Seeking to ".concat(this.currentTime, " seconds"));
+ }
+ /**
+ * Get current time
+ */
+ ,
+ get: function get() {
+ return Number(this.media.currentTime);
+ }
+ /**
+ * Get buffered
+ */
+
+ }, {
+ key: "buffered",
+ get: function get() {
+ var buffered = this.media.buffered; // YouTube / Vimeo return a float between 0-1
+
+ if (is$1.number(buffered)) {
+ return buffered;
+ } // HTML5
+ // TODO: Handle buffered chunks of the media
+ // (i.e. seek to another section buffers only that section)
+
+
+ if (buffered && buffered.length && this.duration > 0) {
+ return buffered.end(0) / this.duration;
+ }
+
+ return 0;
+ }
+ /**
+ * Get seeking status
+ */
+
+ }, {
+ key: "seeking",
+ get: function get() {
+ return Boolean(this.media.seeking);
+ }
+ /**
+ * Get the duration of the current media
+ */
+
+ }, {
+ key: "duration",
+ get: function get() {
+ // Faux duration set via config
+ var fauxDuration = parseFloat(this.config.duration); // Media duration can be NaN or Infinity before the media has loaded
+
+ var realDuration = (this.media || {}).duration;
+ var duration = !is$1.number(realDuration) || realDuration === Infinity ? 0 : realDuration; // If config duration is funky, use regular duration
+
+ return fauxDuration || duration;
+ }
+ /**
+ * Set the player volume
+ * @param {Number} value - must be between 0 and 1. Defaults to the value from local storage and config.volume if not set in storage
+ */
+
+ }, {
+ key: "volume",
+ set: function set(value) {
+ var volume = value;
+ var max = 1;
+ var min = 0;
+
+ if (is$1.string(volume)) {
+ volume = Number(volume);
+ } // Load volume from storage if no value specified
+
+
+ if (!is$1.number(volume)) {
+ volume = this.storage.get('volume');
+ } // Use config if all else fails
+
+
+ if (!is$1.number(volume)) {
+ volume = this.config.volume;
+ } // Maximum is volumeMax
+
+
+ if (volume > max) {
+ volume = max;
+ } // Minimum is volumeMin
+
+
+ if (volume < min) {
+ volume = min;
+ } // Update config
+
+
+ this.config.volume = volume; // Set the player volume
+
+ this.media.volume = volume; // If muted, and we're increasing volume manually, reset muted state
+
+ if (!is$1.empty(value) && this.muted && volume > 0) {
+ this.muted = false;
+ }
+ }
+ /**
+ * Get the current player volume
+ */
+ ,
+ get: function get() {
+ return Number(this.media.volume);
+ }
+ }, {
+ key: "muted",
+ set: function set(mute) {
+ var toggle = mute; // Load muted state from storage
+
+ if (!is$1.boolean(toggle)) {
+ toggle = this.storage.get('muted');
+ } // Use config if all else fails
+
+
+ if (!is$1.boolean(toggle)) {
+ toggle = this.config.muted;
+ } // Update config
+
+
+ this.config.muted = toggle; // Set mute on the player
+
+ this.media.muted = toggle;
+ }
+ /**
+ * Get current muted state
+ */
+ ,
+ get: function get() {
+ return Boolean(this.media.muted);
+ }
+ /**
+ * Check if the media has audio
+ */
+
+ }, {
+ key: "hasAudio",
+ get: function get() {
+ // Assume yes for all non HTML5 (as we can't tell...)
+ if (!this.isHTML5) {
+ return true;
+ }
+
+ if (this.isAudio) {
+ return true;
+ } // Get audio tracks
+
+
+ return Boolean(this.media.mozHasAudio) || Boolean(this.media.webkitAudioDecodedByteCount) || Boolean(this.media.audioTracks && this.media.audioTracks.length);
+ }
+ /**
+ * Set playback speed
+ * @param {Number} speed - the speed of playback (0.5-2.0)
+ */
+
+ }, {
+ key: "speed",
+ set: function set(input) {
+ var _this4 = this;
+
+ var speed = null;
+
+ if (is$1.number(input)) {
+ speed = input;
+ }
+
+ if (!is$1.number(speed)) {
+ speed = this.storage.get('speed');
+ }
+
+ if (!is$1.number(speed)) {
+ speed = this.config.speed.selected;
+ } // Clamp to min/max
+
+
+ var min = this.minimumSpeed,
+ max = this.maximumSpeed;
+ speed = clamp(speed, min, max); // Update config
+
+ this.config.speed.selected = speed; // Set media speed
+
+ setTimeout(function () {
+ _this4.media.playbackRate = speed;
+ }, 0);
+ }
+ /**
+ * Get current playback speed
+ */
+ ,
+ get: function get() {
+ return Number(this.media.playbackRate);
+ }
+ /**
+ * Get the minimum allowed speed
+ */
+
+ }, {
+ key: "minimumSpeed",
+ get: function get() {
+ if (this.isYouTube) {
+ // https://developers.google.com/youtube/iframe_api_reference#setPlaybackRate
+ return Math.min.apply(Math, _toConsumableArray(this.options.speed));
+ }
+
+ if (this.isVimeo) {
+ // https://github.com/vimeo/player.js/#setplaybackrateplaybackrate-number-promisenumber-rangeerrorerror
+ return 0.5;
+ } // https://stackoverflow.com/a/32320020/1191319
+
+
+ return 0.0625;
+ }
+ /**
+ * Get the maximum allowed speed
+ */
+
+ }, {
+ key: "maximumSpeed",
+ get: function get() {
+ if (this.isYouTube) {
+ // https://developers.google.com/youtube/iframe_api_reference#setPlaybackRate
+ return Math.max.apply(Math, _toConsumableArray(this.options.speed));
+ }
+
+ if (this.isVimeo) {
+ // https://github.com/vimeo/player.js/#setplaybackrateplaybackrate-number-promisenumber-rangeerrorerror
+ return 2;
+ } // https://stackoverflow.com/a/32320020/1191319
+
+
+ return 16;
+ }
+ /**
+ * Set playback quality
+ * Currently HTML5 & YouTube only
+ * @param {Number} input - Quality level
+ */
+
+ }, {
+ key: "quality",
+ set: function set(input) {
+ var config = this.config.quality;
+ var options = this.options.quality;
+
+ if (!options.length) {
+ return;
+ }
+
+ var quality = [!is$1.empty(input) && Number(input), this.storage.get('quality'), config.selected, config.default].find(is$1.number);
+ var updateStorage = true;
+
+ if (!options.includes(quality)) {
+ var value = closest$1(options, quality);
+ this.debug.warn("Unsupported quality option: ".concat(quality, ", using ").concat(value, " instead"));
+ quality = value; // Don't update storage if quality is not supported
+
+ updateStorage = false;
+ } // Update config
+
+
+ config.selected = quality; // Set quality
+
+ this.media.quality = quality; // Save to storage
+
+ if (updateStorage) {
+ this.storage.set({
+ quality: quality
+ });
+ }
+ }
+ /**
+ * Get current quality level
+ */
+ ,
+ get: function get() {
+ return this.media.quality;
+ }
+ /**
+ * Toggle loop
+ * TODO: Finish fancy new logic. Set the indicator on load as user may pass loop as config
+ * @param {Boolean} input - Whether to loop or not
+ */
+
+ }, {
+ key: "loop",
+ set: function set(input) {
+ var toggle = is$1.boolean(input) ? input : this.config.loop.active;
+ this.config.loop.active = toggle;
+ this.media.loop = toggle; // Set default to be a true toggle
+
+ /* const type = ['start', 'end', 'all', 'none', 'toggle'].includes(input) ? input : 'toggle';
+ switch (type) {
+ case 'start':
+ if (this.config.loop.end && this.config.loop.end <= this.currentTime) {
+ this.config.loop.end = null;
+ }
+ this.config.loop.start = this.currentTime;
+ // this.config.loop.indicator.start = this.elements.display.played.value;
+ break;
+ case 'end':
+ if (this.config.loop.start >= this.currentTime) {
+ return this;
+ }
+ this.config.loop.end = this.currentTime;
+ // this.config.loop.indicator.end = this.elements.display.played.value;
+ break;
+ case 'all':
+ this.config.loop.start = 0;
+ this.config.loop.end = this.duration - 2;
+ this.config.loop.indicator.start = 0;
+ this.config.loop.indicator.end = 100;
+ break;
+ case 'toggle':
+ if (this.config.loop.active) {
+ this.config.loop.start = 0;
+ this.config.loop.end = null;
+ } else {
+ this.config.loop.start = 0;
+ this.config.loop.end = this.duration - 2;
+ }
+ break;
+ default:
+ this.config.loop.start = 0;
+ this.config.loop.end = null;
+ break;
+ } */
+ }
+ /**
+ * Get current loop state
+ */
+ ,
+ get: function get() {
+ return Boolean(this.media.loop);
+ }
+ /**
+ * Set new media source
+ * @param {Object} input - The new source object (see docs)
+ */
+
+ }, {
+ key: "source",
+ set: function set(input) {
+ source.change.call(this, input);
+ }
+ /**
+ * Get current source
+ */
+ ,
+ get: function get() {
+ return this.media.currentSrc;
+ }
+ /**
+ * Get a download URL (either source or custom)
+ */
+
+ }, {
+ key: "download",
+ get: function get() {
+ var download = this.config.urls.download;
+ return is$1.url(download) ? download : this.source;
+ }
+ /**
+ * Set the download URL
+ */
+ ,
+ set: function set(input) {
+ if (!is$1.url(input)) {
+ return;
+ }
+
+ this.config.urls.download = input;
+ controls.setDownloadUrl.call(this);
+ }
+ /**
+ * Set the poster image for a video
+ * @param {String} input - the URL for the new poster image
+ */
+
+ }, {
+ key: "poster",
+ set: function set(input) {
+ if (!this.isVideo) {
+ this.debug.warn('Poster can only be set for video');
+ return;
+ }
+
+ ui.setPoster.call(this, input, false).catch(function () {});
+ }
+ /**
+ * Get the current poster image
+ */
+ ,
+ get: function get() {
+ if (!this.isVideo) {
+ return null;
+ }
+
+ return this.media.getAttribute('poster') || this.media.getAttribute('data-poster');
+ }
+ /**
+ * Get the current aspect ratio in use
+ */
+
+ }, {
+ key: "ratio",
+ get: function get() {
+ if (!this.isVideo) {
+ return null;
+ }
+
+ var ratio = reduceAspectRatio(getAspectRatio.call(this));
+ return is$1.array(ratio) ? ratio.join(':') : ratio;
+ }
+ /**
+ * Set video aspect ratio
+ */
+ ,
+ set: function set(input) {
+ if (!this.isVideo) {
+ this.debug.warn('Aspect ratio can only be set for video');
+ return;
+ }
+
+ if (!is$1.string(input) || !validateRatio(input)) {
+ this.debug.error("Invalid aspect ratio specified (".concat(input, ")"));
+ return;
+ }
+
+ this.config.ratio = input;
+ setAspectRatio.call(this);
+ }
+ /**
+ * Set the autoplay state
+ * @param {Boolean} input - Whether to autoplay or not
+ */
+
+ }, {
+ key: "autoplay",
+ set: function set(input) {
+ var toggle = is$1.boolean(input) ? input : this.config.autoplay;
+ this.config.autoplay = toggle;
+ }
+ /**
+ * Get the current autoplay state
+ */
+ ,
+ get: function get() {
+ return Boolean(this.config.autoplay);
+ }
+ }, {
+ key: "currentTrack",
+ set: function set(input) {
+ captions.set.call(this, input, false);
+ }
+ /**
+ * Get the current caption track index (-1 if disabled)
+ */
+ ,
+ get: function get() {
+ var _this$captions = this.captions,
+ toggled = _this$captions.toggled,
+ currentTrack = _this$captions.currentTrack;
+ return toggled ? currentTrack : -1;
+ }
+ /**
+ * Set the wanted language for captions
+ * Since tracks can be added later it won't update the actual caption track until there is a matching track
+ * @param {String} - Two character ISO language code (e.g. EN, FR, PT, etc)
+ */
+
+ }, {
+ key: "language",
+ set: function set(input) {
+ captions.setLanguage.call(this, input, false);
+ }
+ /**
+ * Get the current track's language
+ */
+ ,
+ get: function get() {
+ return (captions.getCurrentTrack.call(this) || {}).language;
+ }
+ /**
+ * Toggle picture-in-picture playback on WebKit/MacOS
+ * TODO: update player with state, support, enabled
+ * TODO: detect outside changes
+ */
+
+ }, {
+ key: "pip",
+ set: function set(input) {
+ // Bail if no support
+ if (!support.pip) {
+ return;
+ } // Toggle based on current state if not passed
+
+
+ var toggle = is$1.boolean(input) ? input : !this.pip; // Toggle based on current state
+ // Safari
+
+ if (is$1.function(this.media.webkitSetPresentationMode)) {
+ this.media.webkitSetPresentationMode(toggle ? pip.active : pip.inactive);
+ } // Chrome
+
+
+ if (is$1.function(this.media.requestPictureInPicture)) {
+ if (!this.pip && toggle) {
+ this.media.requestPictureInPicture();
+ } else if (this.pip && !toggle) {
+ document.exitPictureInPicture();
+ }
+ }
+ }
+ /**
+ * Get the current picture-in-picture state
+ */
+ ,
+ get: function get() {
+ if (!support.pip) {
+ return null;
+ } // Safari
+
+
+ if (!is$1.empty(this.media.webkitPresentationMode)) {
+ return this.media.webkitPresentationMode === pip.active;
+ } // Chrome
+
+
+ return this.media === document.pictureInPictureElement;
+ }
+ }], [{
+ key: "supported",
+ value: function supported(type, provider, inline) {
+ return support.check(type, provider, inline);
+ }
+ /**
+ * Load an SVG sprite into the page
+ * @param {String} url - URL for the SVG sprite
+ * @param {String} [id] - Unique ID
+ */
+
+ }, {
+ key: "loadSprite",
+ value: function loadSprite$1(url, id) {
+ return loadSprite(url, id);
+ }
+ /**
+ * Setup multiple instances
+ * @param {*} selector
+ * @param {Object} options
+ */
+
+ }, {
+ key: "setup",
+ value: function setup(selector) {
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
+ var targets = null;
+
+ if (is$1.string(selector)) {
+ targets = Array.from(document.querySelectorAll(selector));
+ } else if (is$1.nodeList(selector)) {
+ targets = Array.from(selector);
+ } else if (is$1.array(selector)) {
+ targets = selector.filter(is$1.element);
+ }
+
+ if (is$1.empty(targets)) {
+ return null;
+ }
+
+ return targets.map(function (t) {
+ return new Plyr(t, options);
+ });
+ }
+ }]);
+
+ return Plyr;
+ }();
+
+ Plyr.defaults = cloneDeep(defaults$1);
+
+ return Plyr;
+
+})));
diff --git a/youtube/static/modules/plyr/plyr.min.js b/youtube/static/modules/plyr/plyr.min.js
new file mode 100644
index 0000000..213c413
--- /dev/null
+++ b/youtube/static/modules/plyr/plyr.min.js
@@ -0,0 +1,4 @@
+"object"==typeof navigator&&function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define("Plyr",t):(e=e||self).Plyr=t()}(this,(function(){"use strict";function e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function t(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function i(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}function n(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function a(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,n)}return i}function s(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?a(Object(i),!0).forEach((function(t){n(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):a(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}function r(e,t){if(null==e)return{};var i,n,a=function(e,t){if(null==e)return{};var i,n,a={},s=Object.keys(e);for(n=0;n<s.length;n++)i=s[n],t.indexOf(i)>=0||(a[i]=e[i]);return a}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n<s.length;n++)i=s[n],t.indexOf(i)>=0||Object.prototype.propertyIsEnumerable.call(e,i)&&(a[i]=e[i])}return a}function o(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var i=[],n=!0,a=!1,s=void 0;try{for(var r,o=e[Symbol.iterator]();!(n=(r=o.next()).done)&&(i.push(r.value),!t||i.length!==t);n=!0);}catch(e){a=!0,s=e}finally{try{n||null==o.return||o.return()}finally{if(a)throw s}}return i}(e,t)||c(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function l(e){return function(e){if(Array.isArray(e))return u(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||c(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(e,t){if(e){if("string"==typeof e)return u(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?u(e,t):void 0}}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=new Array(t);i<t;i++)n[i]=e[i];return n}function d(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function h(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function p(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,n)}return i}function m(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?p(Object(i),!0).forEach((function(t){h(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):p(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}var f={addCSS:!0,thumbWidth:15,watch:!0};function g(e,t){return function(){return Array.from(document.querySelectorAll(t)).includes(this)}.call(e,t)}var y=function(e){return null!=e?e.constructor:null},v=function(e,t){return!!(e&&t&&e instanceof t)},b=function(e){return null==e},w=function(e){return y(e)===Object},k=function(e){return y(e)===String},T=function(e){return Array.isArray(e)},C=function(e){return v(e,NodeList)},A=k,S=T,P=C,E=function(e){return v(e,Element)},N=function(e){return v(e,Event)},M=function(e){return b(e)||(k(e)||T(e)||C(e))&&!e.length||w(e)&&!Object.keys(e).length};function x(e,t){if(1>t){var i=function(e){var t="".concat(e).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);return t?Math.max(0,(t[1]?t[1].length:0)-(t[2]?+t[2]:0)):0}(t);return parseFloat(e.toFixed(i))}return Math.round(e/t)*t}var I,L,O,_=function(){function e(t,i){(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,e),E(t)?this.element=t:A(t)&&(this.element=document.querySelector(t)),E(this.element)&&M(this.element.rangeTouch)&&(this.config=m({},f,{},i),this.init())}return function(e,t,i){t&&d(e.prototype,t),i&&d(e,i)}(e,[{key:"init",value:function(){e.enabled&&(this.config.addCSS&&(this.element.style.userSelect="none",this.element.style.webKitUserSelect="none",this.element.style.touchAction="manipulation"),this.listeners(!0),this.element.rangeTouch=this)}},{key:"destroy",value:function(){e.enabled&&(this.config.addCSS&&(this.element.style.userSelect="",this.element.style.webKitUserSelect="",this.element.style.touchAction=""),this.listeners(!1),this.element.rangeTouch=null)}},{key:"listeners",value:function(e){var t=this,i=e?"addEventListener":"removeEventListener";["touchstart","touchmove","touchend"].forEach((function(e){t.element[i](e,(function(e){return t.set(e)}),!1)}))}},{key:"get",value:function(t){if(!e.enabled||!N(t))return null;var i,n=t.target,a=t.changedTouches[0],s=parseFloat(n.getAttribute("min"))||0,r=parseFloat(n.getAttribute("max"))||100,o=parseFloat(n.getAttribute("step"))||1,l=n.getBoundingClientRect(),c=100/l.width*(this.config.thumbWidth/2)/100;return 0>(i=100/l.width*(a.clientX-l.left))?i=0:100<i&&(i=100),50>i?i-=(100-2*i)*c:50<i&&(i+=2*(i-50)*c),s+x(i/100*(r-s),o)}},{key:"set",value:function(t){e.enabled&&N(t)&&!t.target.disabled&&(t.preventDefault(),t.target.value=this.get(t),function(e,t){if(e&&t){var i=new Event(t,{bubbles:!0});e.dispatchEvent(i)}}(t.target,"touchend"===t.type?"change":"input"))}}],[{key:"setup",value:function(t){var i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},n=null;if(M(t)||A(t)?n=Array.from(document.querySelectorAll(A(t)?t:'input[type="range"]')):E(t)?n=[t]:P(t)?n=Array.from(t):S(t)&&(n=t.filter(E)),M(n))return null;var a=m({},f,{},i);if(A(t)&&a.watch){var s=new MutationObserver((function(i){Array.from(i).forEach((function(i){Array.from(i.addedNodes).forEach((function(i){E(i)&&g(i,t)&&new e(i,a)}))}))}));s.observe(document.body,{childList:!0,subtree:!0})}return n.map((function(t){return new e(t,i)}))}},{key:"enabled",get:function(){return"ontouchstart"in document.documentElement}}]),e}(),j=function(e){return null!=e?e.constructor:null},q=function(e,t){return Boolean(e&&t&&e instanceof t)},D=function(e){return null==e},H=function(e){return j(e)===Object},F=function(e){return j(e)===String},R=function(e){return j(e)===Function},V=function(e){return Array.isArray(e)},B=function(e){return q(e,NodeList)},U=function(e){return D(e)||(F(e)||V(e)||B(e))&&!e.length||H(e)&&!Object.keys(e).length},W=D,z=H,K=function(e){return j(e)===Number&&!Number.isNaN(e)},Y=F,Q=function(e){return j(e)===Boolean},X=R,$=V,J=B,G=function(e){return q(e,Element)},Z=function(e){return q(e,Event)},ee=function(e){return q(e,KeyboardEvent)},te=function(e){return q(e,TextTrack)||!D(e)&&F(e.kind)},ie=function(e){return q(e,Promise)&&R(e.then)},ne=function(e){if(q(e,window.URL))return!0;if(!F(e))return!1;var t=e;e.startsWith("http://")&&e.startsWith("https://")||(t="http://".concat(e));try{return!U(new URL(t).hostname)}catch(e){return!1}},ae=U,se=(I=document.createElement("span"),L={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"},O=Object.keys(L).find((function(e){return void 0!==I.style[e]})),!!Y(O)&&L[O]);function re(e,t){setTimeout((function(){try{e.hidden=!0,e.offsetHeight,e.hidden=!1}catch(e){}}),t)}var oe={isIE:
+/* @cc_on!@ */
+!!document.documentMode,isEdge:window.navigator.userAgent.includes("Edge"),isWebkit:"WebkitAppearance"in document.documentElement.style&&!/Edge/.test(navigator.userAgent),isIPhone:/(iPhone|iPod)/gi.test(navigator.platform),isIos:/(iPad|iPhone|iPod)/gi.test(navigator.platform)};function le(e,t){return t.split(".").reduce((function(e,t){return e&&e[t]}),e)}function ce(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length,i=new Array(t>1?t-1:0),a=1;a<t;a++)i[a-1]=arguments[a];if(!i.length)return e;var s=i.shift();return z(s)?(Object.keys(s).forEach((function(t){z(s[t])?(Object.keys(e).includes(t)||Object.assign(e,n({},t,{})),ce(e[t],s[t])):Object.assign(e,n({},t,s[t]))})),ce.apply(void 0,[e].concat(i))):e}function ue(e,t){var i=e.length?e:[e];Array.from(i).reverse().forEach((function(e,i){var n=i>0?t.cloneNode(!0):t,a=e.parentNode,s=e.nextSibling;n.appendChild(e),s?a.insertBefore(n,s):a.appendChild(n)}))}function de(e,t){G(e)&&!ae(t)&&Object.entries(t).filter((function(e){var t=o(e,2)[1];return!W(t)})).forEach((function(t){var i=o(t,2),n=i[0],a=i[1];return e.setAttribute(n,a)}))}function he(e,t,i){var n=document.createElement(e);return z(t)&&de(n,t),Y(i)&&(n.innerText=i),n}function pe(e,t,i,n){G(t)&&t.appendChild(he(e,i,n))}function me(e){J(e)||$(e)?Array.from(e).forEach(me):G(e)&&G(e.parentNode)&&e.parentNode.removeChild(e)}function fe(e){if(G(e))for(var t=e.childNodes.length;t>0;)e.removeChild(e.lastChild),t-=1}function ge(e,t){return G(t)&&G(t.parentNode)&&G(e)?(t.parentNode.replaceChild(e,t),e):null}function ye(e,t){if(!Y(e)||ae(e))return{};var i={},n=ce({},t);return e.split(",").forEach((function(e){var t=e.trim(),a=t.replace(".",""),s=t.replace(/[[\]]/g,"").split("="),r=o(s,1)[0],l=s.length>1?s[1].replace(/["']/g,""):"";switch(t.charAt(0)){case".":Y(n.class)?i.class="".concat(n.class," ").concat(a):i.class=a;break;case"#":i.id=t.replace("#","");break;case"[":i[r]=l}})),ce(n,i)}function ve(e,t){if(G(e)){var i=t;Q(i)||(i=!e.hidden),e.hidden=i}}function be(e,t,i){if(J(e))return Array.from(e).map((function(e){return be(e,t,i)}));if(G(e)){var n="toggle";return void 0!==i&&(n=i?"add":"remove"),e.classList[n](t),e.classList.contains(t)}return!1}function we(e,t){return G(e)&&e.classList.contains(t)}function ke(e,t){var i=Element.prototype;return(i.matches||i.webkitMatchesSelector||i.mozMatchesSelector||i.msMatchesSelector||function(){return Array.from(document.querySelectorAll(t)).includes(this)}).call(e,t)}function Te(e){return this.elements.container.querySelectorAll(e)}function Ce(e){return this.elements.container.querySelector(e)}function Ae(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];G(e)&&(e.focus({preventScroll:!0}),t&&be(e,this.config.classNames.tabFocus))}var Se,Pe={"audio/ogg":"vorbis","audio/wav":"1","video/webm":"vp8, vorbis","video/mp4":"avc1.42E01E, mp4a.40.2","video/ogg":"theora"},Ee={audio:"canPlayType"in document.createElement("audio"),video:"canPlayType"in document.createElement("video"),check:function(e,t,i){var n=oe.isIPhone&&i&&Ee.playsinline,a=Ee[e]||"html5"!==t;return{api:a,ui:a&&Ee.rangeInput&&("video"!==e||!oe.isIPhone||n)}},pip:!(oe.isIPhone||!X(he("video").webkitSetPresentationMode)&&(!document.pictureInPictureEnabled||he("video").disablePictureInPicture)),airplay:X(window.WebKitPlaybackTargetAvailabilityEvent),playsinline:"playsInline"in document.createElement("video"),mime:function(e){if(ae(e))return!1;var t=o(e.split("/"),1)[0],i=e;if(!this.isHTML5||t!==this.type)return!1;Object.keys(Pe).includes(i)&&(i+='; codecs="'.concat(Pe[e],'"'));try{return Boolean(i&&this.media.canPlayType(i).replace(/no/,""))}catch(e){return!1}},textTracks:"textTracks"in document.createElement("video"),rangeInput:(Se=document.createElement("input"),Se.type="range","range"===Se.type),touch:"ontouchstart"in document.documentElement,transitions:!1!==se,reducedMotion:"matchMedia"in window&&window.matchMedia("(prefers-reduced-motion)").matches},Ne=function(){var e=!1;try{var t=Object.defineProperty({},"passive",{get:function(){return e=!0,null}});window.addEventListener("test",null,t),window.removeEventListener("test",null,t)}catch(e){}return e}();function Me(e,t,i){var n=this,a=arguments.length>3&&void 0!==arguments[3]&&arguments[3],s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],r=arguments.length>5&&void 0!==arguments[5]&&arguments[5];if(e&&"addEventListener"in e&&!ae(t)&&X(i)){var o=t.split(" "),l=r;Ne&&(l={passive:s,capture:r}),o.forEach((function(t){n&&n.eventListeners&&a&&n.eventListeners.push({element:e,type:t,callback:i,options:l}),e[a?"addEventListener":"removeEventListener"](t,i,l)}))}}function xe(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",i=arguments.length>2?arguments[2]:void 0,n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],a=arguments.length>4&&void 0!==arguments[4]&&arguments[4];Me.call(this,e,t,i,!0,n,a)}function Ie(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",i=arguments.length>2?arguments[2]:void 0,n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],a=arguments.length>4&&void 0!==arguments[4]&&arguments[4];Me.call(this,e,t,i,!1,n,a)}function Le(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2?arguments[2]:void 0,a=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],s=arguments.length>4&&void 0!==arguments[4]&&arguments[4],r=function r(){Ie(e,i,r,a,s);for(var o=arguments.length,l=new Array(o),c=0;c<o;c++)l[c]=arguments[c];n.apply(t,l)};Me.call(this,e,i,r,!0,a,s)}function Oe(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(G(e)&&!ae(t)){var a=new CustomEvent(t,{bubbles:i,detail:s(s({},n),{},{plyr:this})});e.dispatchEvent(a)}}function _e(){this&&this.eventListeners&&(this.eventListeners.forEach((function(e){var t=e.element,i=e.type,n=e.callback,a=e.options;t.removeEventListener(i,n,a)})),this.eventListeners=[])}function je(){var e=this;return new Promise((function(t){return e.ready?setTimeout(t,0):xe.call(e,e.elements.container,"ready",t)})).then((function(){}))}function qe(e){ie(e)&&e.then(null,(function(){}))}function De(e){return!!($(e)||Y(e)&&e.includes(":"))&&($(e)?e:e.split(":")).map(Number).every(K)}function He(e){if(!$(e)||!e.every(K))return null;var t=o(e,2),i=t[0],n=t[1],a=function e(t,i){return 0===i?t:e(i,t%i)}(i,n);return[i/a,n/a]}function Fe(e){var t=function(e){return De(e)?e.split(":").map(Number):null},i=t(e);if(null===i&&(i=t(this.config.ratio)),null===i&&!ae(this.embed)&&$(this.embed.ratio)&&(i=this.embed.ratio),null===i&&this.isHTML5){var n=this.media;i=He([n.videoWidth,n.videoHeight])}return i}function Re(e){if(!this.isVideo)return{};var t=this.elements.wrapper,i=Fe.call(this,e),n=o($(i)?i:[0,0],2),a=100/n[0]*n[1];if(t.style.paddingBottom="".concat(a,"%"),this.isVimeo&&!this.config.vimeo.premium&&this.supported.ui){var s=100/this.media.offsetWidth*parseInt(window.getComputedStyle(this.media).paddingBottom,10),r=(s-a)/(s/50);this.media.style.transform="translateY(-".concat(r,"%)")}else this.isHTML5&&t.classList.toggle(this.config.classNames.videoFixedRatio,null!==i);return{padding:a,ratio:i}}var Ve={getSources:function(){var e=this;return this.isHTML5?Array.from(this.media.querySelectorAll("source")).filter((function(t){var i=t.getAttribute("type");return!!ae(i)||Ee.mime.call(e,i)})):[]},getQualityOptions:function(){return this.config.quality.forced?this.config.quality.options:Ve.getSources.call(this).map((function(e){return Number(e.getAttribute("data-res"))})).filter(Boolean)},setup:function(){if(this.isHTML5){var e=this;e.options.speed=e.config.speed.options,ae(this.config.ratio)||Re.call(e),Object.defineProperty(e.media,"quality",{get:function(){var t=Ve.getSources.call(e).find((function(t){return t.getAttribute("src")===e.source}));return t&&Number(t.getAttribute("data-res"))},set:function(t){if(e.quality!==t){if(e.config.quality.forced&&X(e.config.quality.onChange))e.config.quality.onChange(t);else{var i=Ve.getSources.call(e).find((function(e){return Number(e.getAttribute("data-res"))===t}));if(!i)return;var n=e.media,a=n.currentTime,s=n.paused,r=n.preload,o=n.readyState,l=n.playbackRate;e.media.src=i.getAttribute("src"),("none"!==r||o)&&(e.once("loadedmetadata",(function(){e.speed=l,e.currentTime=a,s||qe(e.play())})),e.media.load())}Oe.call(e,e.media,"qualitychange",!1,{quality:t})}}})}},cancelRequests:function(){this.isHTML5&&(me(Ve.getSources.call(this)),this.media.setAttribute("src",this.config.blankVideo),this.media.load(),this.debug.log("Cancelled network requests"))}};function Be(e){return $(e)?e.filter((function(t,i){return e.indexOf(t)===i})):e}function Ue(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),n=1;n<t;n++)i[n-1]=arguments[n];return ae(e)?e:e.toString().replace(/{(\d+)}/g,(function(e,t){return i[t].toString()}))}var We=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return e.replace(new RegExp(t.toString().replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1"),"g"),i.toString())},ze=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return e.toString().replace(/\w\S*/g,(function(e){return e.charAt(0).toUpperCase()+e.substr(1).toLowerCase()}))};function Ke(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=e.toString();return t=We(t,"-"," "),t=We(t,"_"," "),t=ze(t),We(t," ","")}function Ye(e){var t=document.createElement("div");return t.appendChild(e),t.innerHTML}var Qe={pip:"PIP",airplay:"AirPlay",html5:"HTML5",vimeo:"Vimeo",youtube:"YouTube"},Xe=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(ae(e)||ae(t))return"";var i=le(t.i18n,e);if(ae(i))return Object.keys(Qe).includes(e)?Qe[e]:"";var n={"{seektime}":t.seekTime,"{title}":t.title};return Object.entries(n).forEach((function(e){var t=o(e,2),n=t[0],a=t[1];i=We(i,n,a)})),i},$e=function(){function t(i){e(this,t),this.enabled=i.config.storage.enabled,this.key=i.config.storage.key}return i(t,[{key:"get",value:function(e){if(!t.supported||!this.enabled)return null;var i=window.localStorage.getItem(this.key);if(ae(i))return null;var n=JSON.parse(i);return Y(e)&&e.length?n[e]:n}},{key:"set",value:function(e){if(t.supported&&this.enabled&&z(e)){var i=this.get();ae(i)&&(i={}),ce(i,e),window.localStorage.setItem(this.key,JSON.stringify(i))}}}],[{key:"supported",get:function(){try{if(!("localStorage"in window))return!1;return window.localStorage.setItem("___test","___test"),window.localStorage.removeItem("___test"),!0}catch(e){return!1}}}]),t}();function Je(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"text";return new Promise((function(i,n){try{var a=new XMLHttpRequest;if(!("withCredentials"in a))return;a.addEventListener("load",(function(){if("text"===t)try{i(JSON.parse(a.responseText))}catch(e){i(a.responseText)}else i(a.response)})),a.addEventListener("error",(function(){throw new Error(a.status)})),a.open("GET",e,!0),a.responseType=t,a.send()}catch(e){n(e)}}))}function Ge(e,t){if(Y(e)){var i=Y(t),n=function(){return null!==document.getElementById(t)},a=function(e,t){e.innerHTML=t,i&&n()||document.body.insertAdjacentElement("afterbegin",e)};if(!i||!n()){var s=$e.supported,r=document.createElement("div");if(r.setAttribute("hidden",""),i&&r.setAttribute("id",t),s){var o=window.localStorage.getItem("".concat("cache","-").concat(t));if(null!==o){var l=JSON.parse(o);a(r,l.content)}}Je(e).then((function(e){ae(e)||(s&&window.localStorage.setItem("".concat("cache","-").concat(t),JSON.stringify({content:e})),a(r,e))})).catch((function(){}))}}}var Ze=function(e){return Math.trunc(e/60/60%60,10)},et=function(e){return Math.trunc(e/60%60,10)},tt=function(e){return Math.trunc(e%60,10)};function it(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!K(e))return it(void 0,t,i);var n=function(e){return"0".concat(e).slice(-2)},a=Ze(e),s=et(e),r=tt(e);return a=t||a>0?"".concat(a,":"):"","".concat(i&&e>0?"-":"").concat(a).concat(n(s),":").concat(n(r))}var nt={getIconUrl:function(){var e=new URL(this.config.iconUrl,window.location).host!==window.location.host||oe.isIE&&!window.svg4everybody;return{url:this.config.iconUrl,cors:e}},findElements:function(){try{return this.elements.controls=Ce.call(this,this.config.selectors.controls.wrapper),this.elements.buttons={play:Te.call(this,this.config.selectors.buttons.play),pause:Ce.call(this,this.config.selectors.buttons.pause),restart:Ce.call(this,this.config.selectors.buttons.restart),rewind:Ce.call(this,this.config.selectors.buttons.rewind),fastForward:Ce.call(this,this.config.selectors.buttons.fastForward),mute:Ce.call(this,this.config.selectors.buttons.mute),pip:Ce.call(this,this.config.selectors.buttons.pip),airplay:Ce.call(this,this.config.selectors.buttons.airplay),settings:Ce.call(this,this.config.selectors.buttons.settings),captions:Ce.call(this,this.config.selectors.buttons.captions),fullscreen:Ce.call(this,this.config.selectors.buttons.fullscreen)},this.elements.progress=Ce.call(this,this.config.selectors.progress),this.elements.inputs={seek:Ce.call(this,this.config.selectors.inputs.seek),volume:Ce.call(this,this.config.selectors.inputs.volume)},this.elements.display={buffer:Ce.call(this,this.config.selectors.display.buffer),currentTime:Ce.call(this,this.config.selectors.display.currentTime),duration:Ce.call(this,this.config.selectors.display.duration)},G(this.elements.progress)&&(this.elements.display.seekTooltip=this.elements.progress.querySelector(".".concat(this.config.classNames.tooltip))),!0}catch(e){return this.debug.warn("It looks like there is a problem with your custom controls HTML",e),this.toggleNativeControls(!0),!1}},createIcon:function(e,t){var i=nt.getIconUrl.call(this),n="".concat(i.cors?"":i.url,"#").concat(this.config.iconPrefix),a=document.createElementNS("http://www.w3.org/2000/svg","svg");de(a,ce(t,{"aria-hidden":"true",focusable:"false"}));var s=document.createElementNS("http://www.w3.org/2000/svg","use"),r="".concat(n,"-").concat(e);return"href"in s&&s.setAttributeNS("http://www.w3.org/1999/xlink","href",r),s.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",r),a.appendChild(s),a},createLabel:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=Xe(e,this.config),n=s(s({},t),{},{class:[t.class,this.config.classNames.hidden].filter(Boolean).join(" ")});return he("span",n,i)},createBadge:function(e){if(ae(e))return null;var t=he("span",{class:this.config.classNames.menu.value});return t.appendChild(he("span",{class:this.config.classNames.menu.badge},e)),t},createButton:function(e,t){var i=this,n=ce({},t),a=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=e.toString();return(t=Ke(t)).charAt(0).toLowerCase()+t.slice(1)}(e),s={element:"button",toggle:!1,label:null,icon:null,labelPressed:null,iconPressed:null};switch(["element","icon","label"].forEach((function(e){Object.keys(n).includes(e)&&(s[e]=n[e],delete n[e])})),"button"!==s.element||Object.keys(n).includes("type")||(n.type="button"),Object.keys(n).includes("class")?n.class.split(" ").some((function(e){return e===i.config.classNames.control}))||ce(n,{class:"".concat(n.class," ").concat(this.config.classNames.control)}):n.class=this.config.classNames.control,e){case"play":s.toggle=!0,s.label="play",s.labelPressed="pause",s.icon="play",s.iconPressed="pause";break;case"mute":s.toggle=!0,s.label="mute",s.labelPressed="unmute",s.icon="volume",s.iconPressed="muted";break;case"captions":s.toggle=!0,s.label="enableCaptions",s.labelPressed="disableCaptions",s.icon="captions-off",s.iconPressed="captions-on";break;case"fullscreen":s.toggle=!0,s.label="enterFullscreen",s.labelPressed="exitFullscreen",s.icon="enter-fullscreen",s.iconPressed="exit-fullscreen";break;case"play-large":n.class+=" ".concat(this.config.classNames.control,"--overlaid"),a="play",s.label="play",s.icon="play";break;default:ae(s.label)&&(s.label=a),ae(s.icon)&&(s.icon=e)}var r=he(s.element);return s.toggle?(r.appendChild(nt.createIcon.call(this,s.iconPressed,{class:"icon--pressed"})),r.appendChild(nt.createIcon.call(this,s.icon,{class:"icon--not-pressed"})),r.appendChild(nt.createLabel.call(this,s.labelPressed,{class:"label--pressed"})),r.appendChild(nt.createLabel.call(this,s.label,{class:"label--not-pressed"}))):(r.appendChild(nt.createIcon.call(this,s.icon)),r.appendChild(nt.createLabel.call(this,s.label))),ce(n,ye(this.config.selectors.buttons[a],n)),de(r,n),"play"===a?($(this.elements.buttons[a])||(this.elements.buttons[a]=[]),this.elements.buttons[a].push(r)):this.elements.buttons[a]=r,r},createRange:function(e,t){var i=he("input",ce(ye(this.config.selectors.inputs[e]),{type:"range",min:0,max:100,step:.01,value:0,autocomplete:"off",role:"slider","aria-label":Xe(e,this.config),"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":0},t));return this.elements.inputs[e]=i,nt.updateRangeFill.call(this,i),_.setup(i),i},createProgress:function(e,t){var i=he("progress",ce(ye(this.config.selectors.display[e]),{min:0,max:100,value:0,role:"progressbar","aria-hidden":!0},t));if("volume"!==e){i.appendChild(he("span",null,"0"));var n={played:"played",buffer:"buffered"}[e],a=n?Xe(n,this.config):"";i.innerText="% ".concat(a.toLowerCase())}return this.elements.display[e]=i,i},createTime:function(e,t){var i=ye(this.config.selectors.display[e],t),n=he("div",ce(i,{class:"".concat(i.class?i.class:""," ").concat(this.config.classNames.display.time," ").trim(),"aria-label":Xe(e,this.config)}),"00:00");return this.elements.display[e]=n,n},bindMenuItemShortcuts:function(e,t){var i=this;xe.call(this,e,"keydown keyup",(function(n){if([32,38,39,40].includes(n.which)&&(n.preventDefault(),n.stopPropagation(),"keydown"!==n.type)){var a,s=ke(e,'[role="menuitemradio"]');if(!s&&[32,39].includes(n.which))nt.showMenuPanel.call(i,t,!0);else 32!==n.which&&(40===n.which||s&&39===n.which?(a=e.nextElementSibling,G(a)||(a=e.parentNode.firstElementChild)):(a=e.previousElementSibling,G(a)||(a=e.parentNode.lastElementChild)),Ae.call(i,a,!0))}}),!1),xe.call(this,e,"keyup",(function(e){13===e.which&&nt.focusFirstMenuItem.call(i,null,!0)}))},createMenuItem:function(e){var t=this,i=e.value,n=e.list,a=e.type,s=e.title,r=e.badge,o=void 0===r?null:r,l=e.checked,c=void 0!==l&&l,u=ye(this.config.selectors.inputs[a]),d=he("button",ce(u,{type:"button",role:"menuitemradio",class:"".concat(this.config.classNames.control," ").concat(u.class?u.class:"").trim(),"aria-checked":c,value:i})),h=he("span");h.innerHTML=s,G(o)&&h.appendChild(o),d.appendChild(h),Object.defineProperty(d,"checked",{enumerable:!0,get:function(){return"true"===d.getAttribute("aria-checked")},set:function(e){e&&Array.from(d.parentNode.children).filter((function(e){return ke(e,'[role="menuitemradio"]')})).forEach((function(e){return e.setAttribute("aria-checked","false")})),d.setAttribute("aria-checked",e?"true":"false")}}),this.listeners.bind(d,"click keyup",(function(e){if(!ee(e)||32===e.which){switch(e.preventDefault(),e.stopPropagation(),d.checked=!0,a){case"language":t.currentTrack=Number(i);break;case"quality":t.quality=i;break;case"speed":t.speed=parseFloat(i)}nt.showMenuPanel.call(t,"home",ee(e))}}),a,!1),nt.bindMenuItemShortcuts.call(this,d,a),n.appendChild(d)},formatTime:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!K(e))return e;var i=Ze(this.duration)>0;return it(e,i,t)},updateTimeDisplay:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];G(e)&&K(t)&&(e.innerText=nt.formatTime(t,i))},updateVolume:function(){this.supported.ui&&(G(this.elements.inputs.volume)&&nt.setRange.call(this,this.elements.inputs.volume,this.muted?0:this.volume),G(this.elements.buttons.mute)&&(this.elements.buttons.mute.pressed=this.muted||0===this.volume))},setRange:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;G(e)&&(e.value=t,nt.updateRangeFill.call(this,e))},updateProgress:function(e){var t=this;if(this.supported.ui&&Z(e)){var i,n,a=0;if(e)switch(e.type){case"timeupdate":case"seeking":case"seeked":i=this.currentTime,n=this.duration,a=0===i||0===n||Number.isNaN(i)||Number.isNaN(n)?0:(i/n*100).toFixed(2),"timeupdate"===e.type&&nt.setRange.call(this,this.elements.inputs.seek,a);break;case"playing":case"progress":!function(e,i){var n=K(i)?i:0,a=G(e)?e:t.elements.display.buffer;if(G(a)){a.value=n;var s=a.getElementsByTagName("span")[0];G(s)&&(s.childNodes[0].nodeValue=n)}}(this.elements.display.buffer,100*this.buffered)}}},updateRangeFill:function(e){var t=Z(e)?e.target:e;if(G(t)&&"range"===t.getAttribute("type")){if(ke(t,this.config.selectors.inputs.seek)){t.setAttribute("aria-valuenow",this.currentTime);var i=nt.formatTime(this.currentTime),n=nt.formatTime(this.duration),a=Xe("seekLabel",this.config);t.setAttribute("aria-valuetext",a.replace("{currentTime}",i).replace("{duration}",n))}else if(ke(t,this.config.selectors.inputs.volume)){var s=100*t.value;t.setAttribute("aria-valuenow",s),t.setAttribute("aria-valuetext","".concat(s.toFixed(1),"%"))}else t.setAttribute("aria-valuenow",t.value);oe.isWebkit&&t.style.setProperty("--value","".concat(t.value/t.max*100,"%"))}},updateSeekTooltip:function(e){var t=this;if(this.config.tooltips.seek&&G(this.elements.inputs.seek)&&G(this.elements.display.seekTooltip)&&0!==this.duration){var i="".concat(this.config.classNames.tooltip,"--visible"),n=function(e){return be(t.elements.display.seekTooltip,i,e)};if(this.touch)n(!1);else{var a=0,s=this.elements.progress.getBoundingClientRect();if(Z(e))a=100/s.width*(e.pageX-s.left);else{if(!we(this.elements.display.seekTooltip,i))return;a=parseFloat(this.elements.display.seekTooltip.style.left,10)}a<0?a=0:a>100&&(a=100),nt.updateTimeDisplay.call(this,this.elements.display.seekTooltip,this.duration/100*a),this.elements.display.seekTooltip.style.left="".concat(a,"%"),Z(e)&&["mouseenter","mouseleave"].includes(e.type)&&n("mouseenter"===e.type)}}},timeUpdate:function(e){var t=!G(this.elements.display.duration)&&this.config.invertTime;nt.updateTimeDisplay.call(this,this.elements.display.currentTime,t?this.duration-this.currentTime:this.currentTime,t),e&&"timeupdate"===e.type&&this.media.seeking||nt.updateProgress.call(this,e)},durationUpdate:function(){if(this.supported.ui&&(this.config.invertTime||!this.currentTime)){if(this.duration>=Math.pow(2,32))return ve(this.elements.display.currentTime,!0),void ve(this.elements.progress,!0);G(this.elements.inputs.seek)&&this.elements.inputs.seek.setAttribute("aria-valuemax",this.duration);var e=G(this.elements.display.duration);!e&&this.config.displayDuration&&this.paused&&nt.updateTimeDisplay.call(this,this.elements.display.currentTime,this.duration),e&&nt.updateTimeDisplay.call(this,this.elements.display.duration,this.duration),nt.updateSeekTooltip.call(this)}},toggleMenuButton:function(e,t){ve(this.elements.settings.buttons[e],!t)},updateSetting:function(e,t,i){var n=this.elements.settings.panels[e],a=null,s=t;if("captions"===e)a=this.currentTrack;else{if(a=ae(i)?this[e]:i,ae(a)&&(a=this.config[e].default),!ae(this.options[e])&&!this.options[e].includes(a))return void this.debug.warn("Unsupported value of '".concat(a,"' for ").concat(e));if(!this.config[e].options.includes(a))return void this.debug.warn("Disabled value of '".concat(a,"' for ").concat(e))}if(G(s)||(s=n&&n.querySelector('[role="menu"]')),G(s)){this.elements.settings.buttons[e].querySelector(".".concat(this.config.classNames.menu.value)).innerHTML=nt.getLabel.call(this,e,a);var r=s&&s.querySelector('[value="'.concat(a,'"]'));G(r)&&(r.checked=!0)}},getLabel:function(e,t){switch(e){case"speed":return 1===t?Xe("normal",this.config):"".concat(t,"&times;");case"quality":if(K(t)){var i=Xe("qualityLabel.".concat(t),this.config);return i.length?i:"".concat(t,"p")}return ze(t);case"captions":return rt.getLabel.call(this);default:return null}},setQualityMenu:function(e){var t=this;if(G(this.elements.settings.panels.quality)){var i=this.elements.settings.panels.quality.querySelector('[role="menu"]');$(e)&&(this.options.quality=Be(e).filter((function(e){return t.config.quality.options.includes(e)})));var n=!ae(this.options.quality)&&this.options.quality.length>1;if(nt.toggleMenuButton.call(this,"quality",n),fe(i),nt.checkMenu.call(this),n){var a=function(e){var i=Xe("qualityBadge.".concat(e),t.config);return i.length?nt.createBadge.call(t,i):null};this.options.quality.sort((function(e,i){var n=t.config.quality.options;return n.indexOf(e)>n.indexOf(i)?1:-1})).forEach((function(e){nt.createMenuItem.call(t,{value:e,list:i,type:"quality",title:nt.getLabel.call(t,"quality",e),badge:a(e)})})),nt.updateSetting.call(this,"quality",i)}}},setCaptionsMenu:function(){var e=this;if(G(this.elements.settings.panels.captions)){var t=this.elements.settings.panels.captions.querySelector('[role="menucaptions"]'),i=rt.getTracks.call(this),n=Boolean(i.length);if(nt.toggleMenuButton.call(this,"captions",n),fe(t),nt.checkMenu.call(this),n){var a=i.map((function(i,n){return{value:n,checked:e.captions.toggled&&e.currentTrack===n,title:rt.getLabel.call(e,i),badge:i.language&&nt.createBadge.call(e,i.language.toUpperCase()),list:t,type:"language"}}));a.unshift({value:-1,checked:!this.captions.toggled,title:Xe("disabled",this.config),list:t,type:"language"}),a.forEach(nt.createMenuItem.bind(this)),nt.updateSetting.call(this,"captions",t)}}},setSpeedMenu:function(){var e=this;if(G(this.elements.settings.panels.speed)){var t=this.elements.settings.panels.speed.querySelector('[role="menu"]');this.options.speed=this.options.speed.filter((function(t){return t>=e.minimumSpeed&&t<=e.maximumSpeed}));var i=!ae(this.options.speed)&&this.options.speed.length>1;nt.toggleMenuButton.call(this,"speed",i),fe(t),nt.checkMenu.call(this),i&&(this.options.speed.forEach((function(i){nt.createMenuItem.call(e,{value:i,list:t,type:"speed",title:nt.getLabel.call(e,"speed",i)})})),nt.updateSetting.call(this,"speed",t))}},checkMenu:function(){var e=this.elements.settings.buttons,t=!ae(e)&&Object.values(e).some((function(e){return!e.hidden}));ve(this.elements.settings.menu,!t)},focusFirstMenuItem:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!this.elements.settings.popup.hidden){var i=e;G(i)||(i=Object.values(this.elements.settings.panels).find((function(e){return!e.hidden})));var n=i.querySelector('[role^="menuitem"]');Ae.call(this,n,t)}},toggleMenu:function(e){var t=this.elements.settings.popup,i=this.elements.buttons.settings;if(G(t)&&G(i)){var n=t.hidden,a=n;if(Q(e))a=e;else if(ee(e)&&27===e.which)a=!1;else if(Z(e)){var s=X(e.composedPath)?e.composedPath()[0]:e.target,r=t.contains(s);if(r||!r&&e.target!==i&&a)return}i.setAttribute("aria-expanded",a),ve(t,!a),be(this.elements.container,this.config.classNames.menu.open,a),a&&ee(e)?nt.focusFirstMenuItem.call(this,null,!0):a||n||Ae.call(this,i,ee(e))}},getMenuSize:function(e){var t=e.cloneNode(!0);t.style.position="absolute",t.style.opacity=0,t.removeAttribute("hidden"),e.parentNode.appendChild(t);var i=t.scrollWidth,n=t.scrollHeight;return me(t),{width:i,height:n}},showMenuPanel:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",i=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=this.elements.container.querySelector("#plyr-settings-".concat(this.id,"-").concat(t));if(G(n)){var a=n.parentNode,s=Array.from(a.children).find((function(e){return!e.hidden}));if(Ee.transitions&&!Ee.reducedMotion){a.style.width="".concat(s.scrollWidth,"px"),a.style.height="".concat(s.scrollHeight,"px");var r=nt.getMenuSize.call(this,n),o=function t(i){i.target===a&&["width","height"].includes(i.propertyName)&&(a.style.width="",a.style.height="",Ie.call(e,a,se,t))};xe.call(this,a,se,o),a.style.width="".concat(r.width,"px"),a.style.height="".concat(r.height,"px")}ve(s,!0),ve(n,!1),nt.focusFirstMenuItem.call(this,n,i)}},setDownloadUrl:function(){var e=this.elements.buttons.download;G(e)&&e.setAttribute("href",this.download)},create:function(e){var t=this,i=nt.bindMenuItemShortcuts,n=nt.createButton,a=nt.createProgress,s=nt.createRange,r=nt.createTime,o=nt.setQualityMenu,l=nt.setSpeedMenu,c=nt.showMenuPanel;this.elements.controls=null,$(this.config.controls)&&this.config.controls.includes("play-large")&&this.elements.container.appendChild(n.call(this,"play-large"));var u=he("div",ye(this.config.selectors.controls.wrapper));this.elements.controls=u;var d={class:"plyr__controls__item"};return Be($(this.config.controls)?this.config.controls:[]).forEach((function(o){if("restart"===o&&u.appendChild(n.call(t,"restart",d)),"rewind"===o&&u.appendChild(n.call(t,"rewind",d)),"play"===o&&u.appendChild(n.call(t,"play",d)),"fast-forward"===o&&u.appendChild(n.call(t,"fast-forward",d)),"progress"===o){var l=he("div",{class:"".concat(d.class," plyr__progress__container")}),h=he("div",ye(t.config.selectors.progress));if(h.appendChild(s.call(t,"seek",{id:"plyr-seek-".concat(e.id)})),h.appendChild(a.call(t,"buffer")),t.config.tooltips.seek){var p=he("span",{class:t.config.classNames.tooltip},"00:00");h.appendChild(p),t.elements.display.seekTooltip=p}t.elements.progress=h,l.appendChild(t.elements.progress),u.appendChild(l)}if("current-time"===o&&u.appendChild(r.call(t,"currentTime",d)),"duration"===o&&u.appendChild(r.call(t,"duration",d)),"mute"===o||"volume"===o){var m=t.elements.volume;if(G(m)&&u.contains(m)||(m=he("div",ce({},d,{class:"".concat(d.class," plyr__volume").trim()})),t.elements.volume=m,u.appendChild(m)),"mute"===o&&m.appendChild(n.call(t,"mute")),"volume"===o&&!oe.isIos){var f={max:1,step:.05,value:t.config.volume};m.appendChild(s.call(t,"volume",ce(f,{id:"plyr-volume-".concat(e.id)})))}}if("captions"===o&&u.appendChild(n.call(t,"captions",d)),"settings"===o&&!ae(t.config.settings)){var g=he("div",ce({},d,{class:"".concat(d.class," plyr__menu").trim(),hidden:""}));g.appendChild(n.call(t,"settings",{"aria-haspopup":!0,"aria-controls":"plyr-settings-".concat(e.id),"aria-expanded":!1}));var y=he("div",{class:"plyr__menu__container",id:"plyr-settings-".concat(e.id),hidden:""}),v=he("div"),b=he("div",{id:"plyr-settings-".concat(e.id,"-home")}),w=he("div",{role:"menu"});b.appendChild(w),v.appendChild(b),t.elements.settings.panels.home=b,t.config.settings.forEach((function(n){var a=he("button",ce(ye(t.config.selectors.buttons.settings),{type:"button",class:"".concat(t.config.classNames.control," ").concat(t.config.classNames.control,"--forward"),role:"menuitem","aria-haspopup":!0,hidden:""}));i.call(t,a,n),xe.call(t,a,"click",(function(){c.call(t,n,!1)}));var s=he("span",null,Xe(n,t.config)),r=he("span",{class:t.config.classNames.menu.value});r.innerHTML=e[n],s.appendChild(r),a.appendChild(s),w.appendChild(a);var o=he("div",{id:"plyr-settings-".concat(e.id,"-").concat(n),hidden:""}),l=he("button",{type:"button",class:"".concat(t.config.classNames.control," ").concat(t.config.classNames.control,"--back")});l.appendChild(he("span",{"aria-hidden":!0},Xe(n,t.config))),l.appendChild(he("span",{class:t.config.classNames.hidden},Xe("menuBack",t.config))),xe.call(t,o,"keydown",(function(e){37===e.which&&(e.preventDefault(),e.stopPropagation(),c.call(t,"home",!0))}),!1),xe.call(t,l,"click",(function(){c.call(t,"home",!1)})),o.appendChild(l),o.appendChild(he("div",{role:"menu"})),o.appendChild(he("div",{role:"menucaptions"})),v.appendChild(o),t.elements.settings.buttons[n]=a,t.elements.settings.panels[n]=o})),y.appendChild(v),g.appendChild(y),u.appendChild(g),t.elements.settings.popup=y,t.elements.settings.menu=g}if("pip"===o&&Ee.pip&&u.appendChild(n.call(t,"pip",d)),"airplay"===o&&Ee.airplay&&u.appendChild(n.call(t,"airplay",d)),"download"===o){var k=ce({},d,{element:"a",href:t.download,target:"_blank"});t.isHTML5&&(k.download="");var T=t.config.urls.download;!ne(T)&&t.isEmbed&&ce(k,{icon:"logo-".concat(t.provider),label:t.provider}),u.appendChild(n.call(t,"download",k))}"fullscreen"===o&&u.appendChild(n.call(t,"fullscreen",d))})),this.isHTML5&&o.call(this,Ve.getQualityOptions.call(this)),l.call(this),u},inject:function(){var e=this;if(this.config.loadSprite){var t=nt.getIconUrl.call(this);t.cors&&Ge(t.url,"sprite-plyr")}this.id=Math.floor(1e4*Math.random());var i=null;this.elements.controls=null;var n={id:this.id,seektime:this.config.seekTime,title:this.config.title},a=!0;X(this.config.controls)&&(this.config.controls=this.config.controls.call(this,n)),this.config.controls||(this.config.controls=[]),G(this.config.controls)||Y(this.config.controls)?i=this.config.controls:(i=nt.create.call(this,{id:this.id,seektime:this.config.seekTime,speed:this.speed,quality:this.quality,captions:rt.getLabel.call(this)}),a=!1);var s,r;if(a&&Y(this.config.controls)&&(s=i,Object.entries(n).forEach((function(e){var t=o(e,2),i=t[0],n=t[1];s=We(s,"{".concat(i,"}"),n)})),i=s),Y(this.config.selectors.controls.container)&&(r=document.querySelector(this.config.selectors.controls.container)),G(r)||(r=this.elements.container),r[G(i)?"insertAdjacentElement":"insertAdjacentHTML"]("afterbegin",i),G(this.elements.controls)||nt.findElements.call(this),!ae(this.elements.buttons)){var l=function(t){var i=e.config.classNames.controlPressed;Object.defineProperty(t,"pressed",{enumerable:!0,get:function(){return we(t,i)},set:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];be(t,i,e)}})};Object.values(this.elements.buttons).filter(Boolean).forEach((function(e){$(e)||J(e)?Array.from(e).filter(Boolean).forEach(l):l(e)}))}if(oe.isEdge&&re(r),this.config.tooltips.controls){var c=this.config,u=c.classNames,d=c.selectors,h="".concat(d.controls.wrapper," ").concat(d.labels," .").concat(u.hidden),p=Te.call(this,h);Array.from(p).forEach((function(t){be(t,e.config.classNames.hidden,!1),be(t,e.config.classNames.tooltip,!0)}))}}};function at(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=e;if(t){var n=document.createElement("a");n.href=i,i=n.href}try{return new URL(i)}catch(e){return null}}function st(e){var t=new URLSearchParams;return z(e)&&Object.entries(e).forEach((function(e){var i=o(e,2),n=i[0],a=i[1];t.set(n,a)})),t}var rt={setup:function(){if(this.supported.ui)if(!this.isVideo||this.isYouTube||this.isHTML5&&!Ee.textTracks)$(this.config.controls)&&this.config.controls.includes("settings")&&this.config.settings.includes("captions")&&nt.setCaptionsMenu.call(this);else{if(G(this.elements.captions)||(this.elements.captions=he("div",ye(this.config.selectors.captions)),function(e,t){G(e)&&G(t)&&t.parentNode.insertBefore(e,t.nextSibling)}(this.elements.captions,this.elements.wrapper)),oe.isIE&&window.URL){var e=this.media.querySelectorAll("track");Array.from(e).forEach((function(e){var t=e.getAttribute("src"),i=at(t);null!==i&&i.hostname!==window.location.href.hostname&&["http:","https:"].includes(i.protocol)&&Je(t,"blob").then((function(t){e.setAttribute("src",window.URL.createObjectURL(t))})).catch((function(){me(e)}))}))}var t=Be((navigator.languages||[navigator.language||navigator.userLanguage||"en"]).map((function(e){return e.split("-")[0]}))),i=(this.storage.get("language")||this.config.captions.language||"auto").toLowerCase();if("auto"===i)i=o(t,1)[0];var n=this.storage.get("captions");if(Q(n)||(n=this.config.captions.active),Object.assign(this.captions,{toggled:!1,active:n,language:i,languages:t}),this.isHTML5){var a=this.config.captions.update?"addtrack removetrack":"removetrack";xe.call(this,this.media.textTracks,a,rt.update.bind(this))}setTimeout(rt.update.bind(this),0)}},update:function(){var e=this,t=rt.getTracks.call(this,!0),i=this.captions,n=i.active,a=i.language,s=i.meta,r=i.currentTrackNode,o=Boolean(t.find((function(e){return e.language===a})));this.isHTML5&&this.isVideo&&t.filter((function(e){return!s.get(e)})).forEach((function(t){e.debug.log("Track added",t),s.set(t,{default:"showing"===t.mode}),"showing"===t.mode&&(t.mode="hidden"),xe.call(e,t,"cuechange",(function(){return rt.updateCues.call(e)}))})),(o&&this.language!==a||!t.includes(r))&&(rt.setLanguage.call(this,a),rt.toggle.call(this,n&&o)),be(this.elements.container,this.config.classNames.captions.enabled,!ae(t)),$(this.config.controls)&&this.config.controls.includes("settings")&&this.config.settings.includes("captions")&&nt.setCaptionsMenu.call(this)},toggle:function(e){var t=this,i=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.supported.ui){var n=this.captions.toggled,a=this.config.classNames.captions.active,s=W(e)?!n:e;if(s!==n){if(i||(this.captions.active=s,this.storage.set({captions:s})),!this.language&&s&&!i){var r=rt.getTracks.call(this),o=rt.findTrack.call(this,[this.captions.language].concat(l(this.captions.languages)),!0);return this.captions.language=o.language,void rt.set.call(this,r.indexOf(o))}this.elements.buttons.captions&&(this.elements.buttons.captions.pressed=s),be(this.elements.container,a,s),this.captions.toggled=s,nt.updateSetting.call(this,"captions"),Oe.call(this,this.media,s?"captionsenabled":"captionsdisabled")}setTimeout((function(){s&&t.captions.toggled&&(t.captions.currentTrackNode.mode="hidden")}))}},set:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=rt.getTracks.call(this);if(-1!==e)if(K(e))if(e in i){if(this.captions.currentTrack!==e){this.captions.currentTrack=e;var n=i[e],a=n||{},s=a.language;this.captions.currentTrackNode=n,nt.updateSetting.call(this,"captions"),t||(this.captions.language=s,this.storage.set({language:s})),this.isVimeo&&this.embed.enableTextTrack(s),Oe.call(this,this.media,"languagechange")}rt.toggle.call(this,!0,t),this.isHTML5&&this.isVideo&&rt.updateCues.call(this)}else this.debug.warn("Track not found",e);else this.debug.warn("Invalid caption argument",e);else rt.toggle.call(this,!1,t)},setLanguage:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(Y(e)){var i=e.toLowerCase();this.captions.language=i;var n=rt.getTracks.call(this),a=rt.findTrack.call(this,[i]);rt.set.call(this,n.indexOf(a),t)}else this.debug.warn("Invalid language argument",e)},getTracks:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],i=Array.from((this.media||{}).textTracks||[]);return i.filter((function(i){return!e.isHTML5||t||e.captions.meta.has(i)})).filter((function(e){return["captions","subtitles"].includes(e.kind)}))},findTrack:function(e){var t,i=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],a=rt.getTracks.call(this),s=function(e){return Number((i.captions.meta.get(e)||{}).default)},r=Array.from(a).sort((function(e,t){return s(t)-s(e)}));return e.every((function(e){return!(t=r.find((function(t){return t.language===e})))})),t||(n?r[0]:void 0)},getCurrentTrack:function(){return rt.getTracks.call(this)[this.currentTrack]},getLabel:function(e){var t=e;return!te(t)&&Ee.textTracks&&this.captions.toggled&&(t=rt.getCurrentTrack.call(this)),te(t)?ae(t.label)?ae(t.language)?Xe("enabled",this.config):e.language.toUpperCase():t.label:Xe("disabled",this.config)},updateCues:function(e){if(this.supported.ui)if(G(this.elements.captions))if(W(e)||Array.isArray(e)){var t=e;if(!t){var i=rt.getCurrentTrack.call(this);t=Array.from((i||{}).activeCues||[]).map((function(e){return e.getCueAsHTML()})).map(Ye)}var n=t.map((function(e){return e.trim()})).join("\n");if(n!==this.elements.captions.innerHTML){fe(this.elements.captions);var a=he("span",ye(this.config.selectors.caption));a.innerHTML=n,this.elements.captions.appendChild(a),Oe.call(this,this.media,"cuechange")}}else this.debug.warn("updateCues: Invalid input",e);else this.debug.warn("No captions element to render to")}},ot={enabled:!0,title:"",debug:!1,autoplay:!1,autopause:!0,playsinline:!0,seekTime:10,volume:1,muted:!1,duration:null,displayDuration:!0,invertTime:!0,toggleInvert:!0,ratio:null,clickToPlay:!0,hideControls:!0,resetOnEnd:!1,disableContextMenu:!0,loadSprite:!0,iconPrefix:"plyr",iconUrl:"/theme/modules/plyr/plyr.svg",blankVideo:"/theme/modules/plyr/blank.webm",quality:{default:576,options:[4320,2880,2160,1440,1080,720,576,480,360,240],forced:!1,onChange:null},loop:{active:!1},speed:{selected:1,options:[.5,.75,1,1.25,1.5,1.75,2,4]},keyboard:{focused:!0,global:!1},tooltips:{controls:!1,seek:!0},captions:{active:!1,language:"auto",update:!1},fullscreen:{enabled:!0,fallback:!0,iosNative:!1},storage:{enabled:!0,key:"plyr"},controls:["play-large","play","progress","current-time","mute","volume","captions","settings","pip","airplay","fullscreen"],settings:["captions","quality","speed"],i18n:{restart:"Restart",rewind:"Rewind {seektime}s",play:"Play",pause:"Pause",fastForward:"Forward {seektime}s",seek:"Seek",seekLabel:"{currentTime} of {duration}",played:"Played",buffered:"Buffered",currentTime:"Current time",duration:"Duration",volume:"Volume",mute:"Mute",unmute:"Unmute",enableCaptions:"Enable captions",disableCaptions:"Disable captions",download:"Download",enterFullscreen:"Enter fullscreen",exitFullscreen:"Exit fullscreen",frameTitle:"Player for {title}",captions:"Captions",settings:"Settings",pip:"PIP",menuBack:"Go back to previous menu",speed:"Speed",normal:"Normal",quality:"Quality",loop:"Loop",start:"Start",end:"End",all:"All",reset:"Reset",disabled:"Disabled",enabled:"Enabled",advertisement:"Ad",qualityBadge:{2160:"4K",1440:"HD",1080:"HD",720:"HD",576:"SD",480:"SD"}},urls:{download:null,vimeo:{sdk:"https://player.vimeo.com/api/player.js",iframe:"https://player.vimeo.com/video/{0}?{1}",api:"https://vimeo.com/api/v2/video/{0}.json"},youtube:{sdk:"https://www.youtube.com/iframe_api",api:"https://noembed.com/embed?url=https://www.youtube.com/watch?v={0}"},googleIMA:{sdk:"https://imasdk.googleapis.com/js/sdkloader/ima3.js"}},listeners:{seek:null,play:null,pause:null,restart:null,rewind:null,fastForward:null,mute:null,volume:null,captions:null,download:null,fullscreen:null,pip:null,airplay:null,speed:null,quality:null,loop:null,language:null},events:["ended","progress","stalled","playing","waiting","canplay","canplaythrough","loadstart","loadeddata","loadedmetadata","timeupdate","volumechange","play","pause","error","seeking","seeked","emptied","ratechange","cuechange","download","enterfullscreen","exitfullscreen","captionsenabled","captionsdisabled","languagechange","controlshidden","controlsshown","ready","statechange","qualitychange","adsloaded","adscontentpause","adscontentresume","adstarted","adsmidpoint","adscomplete","adsallcomplete","adsimpression","adsclick"],selectors:{editable:"input, textarea, select, [contenteditable]",container:".plyr",controls:{container:null,wrapper:".plyr__controls"},labels:"[data-plyr]",buttons:{play:'[data-plyr="play"]',pause:'[data-plyr="pause"]',restart:'[data-plyr="restart"]',rewind:'[data-plyr="rewind"]',fastForward:'[data-plyr="fast-forward"]',mute:'[data-plyr="mute"]',captions:'[data-plyr="captions"]',download:'[data-plyr="download"]',fullscreen:'[data-plyr="fullscreen"]',pip:'[data-plyr="pip"]',airplay:'[data-plyr="airplay"]',settings:'[data-plyr="settings"]',loop:'[data-plyr="loop"]'},inputs:{seek:'[data-plyr="seek"]',volume:'[data-plyr="volume"]',speed:'[data-plyr="speed"]',language:'[data-plyr="language"]',quality:'[data-plyr="quality"]'},display:{currentTime:".plyr__time--current",duration:".plyr__time--duration",buffer:".plyr__progress__buffer",loop:".plyr__progress__loop",volume:".plyr__volume--display"},progress:".plyr__progress",captions:".plyr__captions",caption:".plyr__caption"},classNames:{type:"plyr--{0}",provider:"plyr--{0}",video:"plyr__video-wrapper",embed:"plyr__video-embed",videoFixedRatio:"plyr__video-wrapper--fixed-ratio",embedContainer:"plyr__video-embed__container",poster:"plyr__poster",posterEnabled:"plyr__poster-enabled",ads:"plyr__ads",control:"plyr__control",controlPressed:"plyr__control--pressed",playing:"plyr--playing",paused:"plyr--paused",stopped:"plyr--stopped",loading:"plyr--loading",hover:"plyr--hover",tooltip:"plyr__tooltip",cues:"plyr__cues",hidden:"plyr__sr-only",hideControls:"plyr--hide-controls",isIos:"plyr--is-ios",isTouch:"plyr--is-touch",uiSupported:"plyr--full-ui",noTransition:"plyr--no-transition",display:{time:"plyr__time"},menu:{value:"plyr__menu__value",badge:"plyr__badge",open:"plyr--menu-open"},captions:{enabled:"plyr--captions-enabled",active:"plyr--captions-active"},fullscreen:{enabled:"plyr--fullscreen-enabled",fallback:"plyr--fullscreen-fallback"},pip:{supported:"plyr--pip-supported",active:"plyr--pip-active"},airplay:{supported:"plyr--airplay-supported",active:"plyr--airplay-active"},tabFocus:"plyr__tab-focus",previewThumbnails:{thumbContainer:"plyr__preview-thumb",thumbContainerShown:"plyr__preview-thumb--is-shown",imageContainer:"plyr__preview-thumb__image-container",timeContainer:"plyr__preview-thumb__time-container",scrubbingContainer:"plyr__preview-scrubbing",scrubbingContainerShown:"plyr__preview-scrubbing--is-shown"}},attributes:{embed:{provider:"data-plyr-provider",id:"data-plyr-embed-id"}},ads:{enabled:!1,publisherId:"",tagUrl:""},previewThumbnails:{enabled:!1,src:""},vimeo:{byline:!1,portrait:!1,title:!1,speed:!0,transparent:!1,premium:!1,referrerPolicy:null},youtube:{noCookie:!0,rel:0,showinfo:0,iv_load_policy:3,modestbranding:1}},lt="picture-in-picture",ct="inline",ut={html5:"html5",youtube:"youtube",vimeo:"vimeo"},dt="audio",ht="video";var pt=function(){},mt=function(){function t(){var i=arguments.length>0&&void 0!==arguments[0]&&arguments[0];e(this,t),this.enabled=window.console&&i,this.enabled&&this.log("Debugging enabled")}return i(t,[{key:"log",get:function(){return this.enabled?Function.prototype.bind.call(console.log,console):pt}},{key:"warn",get:function(){return this.enabled?Function.prototype.bind.call(console.warn,console):pt}},{key:"error",get:function(){return this.enabled?Function.prototype.bind.call(console.error,console):pt}}]),t}(),ft=function(){function t(i){var n=this;e(this,t),this.player=i,this.prefix=t.prefix,this.property=t.property,this.scrollPosition={x:0,y:0},this.forceFallback="force"===i.config.fullscreen.fallback,this.player.elements.fullscreen=i.config.fullscreen.container&&function(e,t){return(Element.prototype.closest||function(){var e=this;do{if(ke.matches(e,t))return e;e=e.parentElement||e.parentNode}while(null!==e&&1===e.nodeType);return null}).call(e,t)}(this.player.elements.container,i.config.fullscreen.container),xe.call(this.player,document,"ms"===this.prefix?"MSFullscreenChange":"".concat(this.prefix,"fullscreenchange"),(function(){n.onChange()})),xe.call(this.player,this.player.elements.container,"dblclick",(function(e){G(n.player.elements.controls)&&n.player.elements.controls.contains(e.target)||n.toggle()})),xe.call(this,this.player.elements.container,"keydown",(function(e){return n.trapFocus(e)})),this.update()}return i(t,[{key:"onChange",value:function(){if(this.enabled){var e=this.player.elements.buttons.fullscreen;G(e)&&(e.pressed=this.active),Oe.call(this.player,this.target,this.active?"enterfullscreen":"exitfullscreen",!0)}}},{key:"toggleFallback",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(e?this.scrollPosition={x:window.scrollX||0,y:window.scrollY||0}:window.scrollTo(this.scrollPosition.x,this.scrollPosition.y),document.body.style.overflow=e?"hidden":"",be(this.target,this.player.config.classNames.fullscreen.fallback,e),oe.isIos){var t=document.head.querySelector('meta[name="viewport"]'),i="viewport-fit=cover";t||(t=document.createElement("meta")).setAttribute("name","viewport");var n=Y(t.content)&&t.content.includes(i);e?(this.cleanupViewport=!n,n||(t.content+=",".concat(i))):this.cleanupViewport&&(t.content=t.content.split(",").filter((function(e){return e.trim()!==i})).join(","))}this.onChange()}},{key:"trapFocus",value:function(e){if(!oe.isIos&&this.active&&"Tab"===e.key&&9===e.keyCode){var t=document.activeElement,i=Te.call(this.player,"a[href], button:not(:disabled), input:not(:disabled), [tabindex]"),n=o(i,1)[0],a=i[i.length-1];t!==a||e.shiftKey?t===n&&e.shiftKey&&(a.focus(),e.preventDefault()):(n.focus(),e.preventDefault())}}},{key:"update",value:function(){var e;this.enabled?(e=this.forceFallback?"Fallback (forced)":t.native?"Native":"Fallback",this.player.debug.log("".concat(e," fullscreen enabled"))):this.player.debug.log("Fullscreen not supported and fallback disabled");be(this.player.elements.container,this.player.config.classNames.fullscreen.enabled,this.enabled)}},{key:"enter",value:function(){this.enabled&&(oe.isIos&&this.player.config.fullscreen.iosNative?this.target.webkitEnterFullscreen():!t.native||this.forceFallback?this.toggleFallback(!0):this.prefix?ae(this.prefix)||this.target["".concat(this.prefix,"Request").concat(this.property)]():this.target.requestFullscreen({navigationUI:"hide"}))}},{key:"exit",value:function(){if(this.enabled)if(oe.isIos&&this.player.config.fullscreen.iosNative)this.target.webkitExitFullscreen(),qe(this.player.play());else if(!t.native||this.forceFallback)this.toggleFallback(!1);else if(this.prefix){if(!ae(this.prefix)){var e="moz"===this.prefix?"Cancel":"Exit";document["".concat(this.prefix).concat(e).concat(this.property)]()}}else(document.cancelFullScreen||document.exitFullscreen).call(document)}},{key:"toggle",value:function(){this.active?this.exit():this.enter()}},{key:"usingNative",get:function(){return t.native&&!this.forceFallback}},{key:"enabled",get:function(){return(t.native||this.player.config.fullscreen.fallback)&&this.player.config.fullscreen.enabled&&this.player.supported.ui&&this.player.isVideo}},{key:"active",get:function(){if(!this.enabled)return!1;if(!t.native||this.forceFallback)return we(this.target,this.player.config.classNames.fullscreen.fallback);var e=this.prefix?document["".concat(this.prefix).concat(this.property,"Element")]:document.fullscreenElement;return e&&e.shadowRoot?e===this.target.getRootNode().host:e===this.target}},{key:"target",get:function(){return oe.isIos&&this.player.config.fullscreen.iosNative?this.player.media:this.player.elements.fullscreen||this.player.elements.container}}],[{key:"native",get:function(){return!!(document.fullscreenEnabled||document.webkitFullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled)}},{key:"prefix",get:function(){if(X(document.exitFullscreen))return"";var e="";return["webkit","moz","ms"].some((function(t){return!(!X(document["".concat(t,"ExitFullscreen")])&&!X(document["".concat(t,"CancelFullScreen")]))&&(e=t,!0)})),e}},{key:"property",get:function(){return"moz"===this.prefix?"FullScreen":"Fullscreen"}}]),t}();function gt(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return new Promise((function(i,n){var a=new Image,s=function(){delete a.onload,delete a.onerror,(a.naturalWidth>=t?i:n)(a)};Object.assign(a,{onload:s,onerror:s,src:e})}))}var yt={addStyleHook:function(){be(this.elements.container,this.config.selectors.container.replace(".",""),!0),be(this.elements.container,this.config.classNames.uiSupported,this.supported.ui)},toggleNativeControls:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];e&&this.isHTML5?this.media.setAttribute("controls",""):this.media.removeAttribute("controls")},build:function(){var e=this;if(this.listeners.media(),!this.supported.ui)return this.debug.warn("Basic support only for ".concat(this.provider," ").concat(this.type)),void yt.toggleNativeControls.call(this,!0);G(this.elements.controls)||(nt.inject.call(this),this.listeners.controls()),yt.toggleNativeControls.call(this),this.isHTML5&&rt.setup.call(this),this.volume=null,this.muted=null,this.loop=null,this.quality=null,this.speed=null,nt.updateVolume.call(this),nt.timeUpdate.call(this),yt.checkPlaying.call(this),be(this.elements.container,this.config.classNames.pip.supported,Ee.pip&&this.isHTML5&&this.isVideo),be(this.elements.container,this.config.classNames.airplay.supported,Ee.airplay&&this.isHTML5),be(this.elements.container,this.config.classNames.isIos,oe.isIos),be(this.elements.container,this.config.classNames.isTouch,this.touch),this.ready=!0,setTimeout((function(){Oe.call(e,e.media,"ready")}),0),yt.setTitle.call(this),this.poster&&yt.setPoster.call(this,this.poster,!1).catch((function(){})),this.config.duration&&nt.durationUpdate.call(this)},setTitle:function(){var e=Xe("play",this.config);if(Y(this.config.title)&&!ae(this.config.title)&&(e+=", ".concat(this.config.title)),Array.from(this.elements.buttons.play||[]).forEach((function(t){t.setAttribute("aria-label",e)})),this.isEmbed){var t=Ce.call(this,"iframe");if(!G(t))return;var i=ae(this.config.title)?"video":this.config.title,n=Xe("frameTitle",this.config);t.setAttribute("title",n.replace("{title}",i))}},togglePoster:function(e){be(this.elements.container,this.config.classNames.posterEnabled,e)},setPoster:function(e){var t=this,i=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return i&&this.poster?Promise.reject(new Error("Poster already set")):(this.media.setAttribute("data-poster",e),je.call(this).then((function(){return gt(e)})).catch((function(i){throw e===t.poster&&yt.togglePoster.call(t,!1),i})).then((function(){if(e!==t.poster)throw new Error("setPoster cancelled by later call to setPoster")})).then((function(){return Object.assign(t.elements.poster.style,{backgroundImage:"url('".concat(e,"')"),backgroundSize:""}),yt.togglePoster.call(t,!0),e})))},checkPlaying:function(e){var t=this;be(this.elements.container,this.config.classNames.playing,this.playing),be(this.elements.container,this.config.classNames.paused,this.paused),be(this.elements.container,this.config.classNames.stopped,this.stopped),Array.from(this.elements.buttons.play||[]).forEach((function(e){Object.assign(e,{pressed:t.playing}),e.setAttribute("aria-label",Xe(t.playing?"pause":"play",t.config))})),Z(e)&&"timeupdate"===e.type||yt.toggleControls.call(this)},checkLoading:function(e){var t=this;this.loading=["stalled","waiting"].includes(e.type),clearTimeout(this.timers.loading),this.timers.loading=setTimeout((function(){be(t.elements.container,t.config.classNames.loading,t.loading),yt.toggleControls.call(t)}),this.loading?250:0)},toggleControls:function(e){var t=this.elements.controls;if(t&&this.config.hideControls){var i=this.touch&&this.lastSeekTime+2e3>Date.now();this.toggleControls(Boolean(e||this.loading||this.paused||t.pressed||t.hover||i))}},migrateStyles:function(){var e=this;Object.values(s({},this.media.style)).filter((function(e){return!ae(e)&&e.startsWith("--plyr")})).forEach((function(t){e.elements.container.style.setProperty(t,e.media.style.getPropertyValue(t)),e.media.style.removeProperty(t)})),ae(this.media.style)&&this.media.removeAttribute("style")}},vt=function(){function t(i){e(this,t),this.player=i,this.lastKey=null,this.focusTimer=null,this.lastKeyDown=null,this.handleKey=this.handleKey.bind(this),this.toggleMenu=this.toggleMenu.bind(this),this.setTabFocus=this.setTabFocus.bind(this),this.firstTouch=this.firstTouch.bind(this)}return i(t,[{key:"handleKey",value:function(e){var t=this.player,i=t.elements,n=e.keyCode?e.keyCode:e.which,a="keydown"===e.type,s=a&&n===this.lastKey;if(!(e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)&&K(n)){if(a){var r=document.activeElement;if(G(r)){var o=t.config.selectors.editable;if(r!==i.inputs.seek&&ke(r,o))return;if(32===e.which&&ke(r,'button, [role^="menuitem"]'))return}switch([32,37,38,39,40,48,49,50,51,52,53,54,56,57,67,70,73,75,76,77,79].includes(n)&&(e.preventDefault(),e.stopPropagation()),n){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:s||(t.currentTime=t.duration/10*(n-48));break;case 32:case 75:s||qe(t.togglePlay());break;case 38:t.increaseVolume(.1);break;case 40:t.decreaseVolume(.1);break;case 77:s||(t.muted=!t.muted);break;case 39:t.forward();break;case 37:t.rewind();break;case 70:t.fullscreen.toggle();break;case 67:s||t.toggleCaptions();break;case 76:t.loop=!t.loop}27===n&&!t.fullscreen.usingNative&&t.fullscreen.active&&t.fullscreen.toggle(),this.lastKey=n}else this.lastKey=null}}},{key:"toggleMenu",value:function(e){nt.toggleMenu.call(this.player,e)}},{key:"firstTouch",value:function(){var e=this.player,t=e.elements;e.touch=!0,be(t.container,e.config.classNames.isTouch,!0)}},{key:"setTabFocus",value:function(e){var t=this.player,i=t.elements;if(clearTimeout(this.focusTimer),"keydown"!==e.type||9===e.which){"keydown"===e.type&&(this.lastKeyDown=e.timeStamp);var n,a=e.timeStamp-this.lastKeyDown<=20;if("focus"!==e.type||a)n=t.config.classNames.tabFocus,be(Te.call(t,".".concat(n)),n,!1),"focusout"!==e.type&&(this.focusTimer=setTimeout((function(){var e=document.activeElement;i.container.contains(e)&&be(document.activeElement,t.config.classNames.tabFocus,!0)}),10))}}},{key:"global",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=this.player;t.config.keyboard.global&&Me.call(t,window,"keydown keyup",this.handleKey,e,!1),Me.call(t,document.body,"click",this.toggleMenu,e),Le.call(t,document.body,"touchstart",this.firstTouch),Me.call(t,document.body,"keydown focus blur focusout",this.setTabFocus,e,!1,!0)}},{key:"container",value:function(){var e=this.player,t=e.config,i=e.elements,n=e.timers;!t.keyboard.global&&t.keyboard.focused&&xe.call(e,i.container,"keydown keyup",this.handleKey,!1),xe.call(e,i.container,"mousemove mouseleave touchstart touchmove enterfullscreen exitfullscreen",(function(t){var a=i.controls;a&&"enterfullscreen"===t.type&&(a.pressed=!1,a.hover=!1);var s=0;["touchstart","touchmove","mousemove"].includes(t.type)&&(yt.toggleControls.call(e,!0),s=e.touch?3e3:2e3),clearTimeout(n.controls),n.controls=setTimeout((function(){return yt.toggleControls.call(e,!1)}),s)}));var a=function(t){if(!t)return Re.call(e);var n=i.container.getBoundingClientRect(),a=n.width,s=n.height;return Re.call(e,"".concat(a,":").concat(s))},s=function(){clearTimeout(n.resized),n.resized=setTimeout(a,50)};xe.call(e,i.container,"enterfullscreen exitfullscreen",(function(t){var n=e.fullscreen,r=n.target,l=n.usingNative;if(r===i.container&&(e.isEmbed||!ae(e.config.ratio))){var c="enterfullscreen"===t.type,u=a(c);u.padding;!function(t,i,n){if(e.isVimeo&&!e.config.vimeo.premium){var a=e.elements.wrapper.firstChild,s=o(t,2)[1],r=o(Fe.call(e),2),l=r[0],c=r[1];a.style.maxWidth=n?"".concat(s/c*l,"px"):null,a.style.margin=n?"0 auto":null}}(u.ratio,0,c),l||(c?xe.call(e,window,"resize",s):Ie.call(e,window,"resize",s))}}))}},{key:"media",value:function(){var e=this,t=this.player,i=t.elements;if(xe.call(t,t.media,"timeupdate seeking seeked",(function(e){return nt.timeUpdate.call(t,e)})),xe.call(t,t.media,"durationchange loadeddata loadedmetadata",(function(e){return nt.durationUpdate.call(t,e)})),xe.call(t,t.media,"ended",(function(){t.isHTML5&&t.isVideo&&t.config.resetOnEnd&&(t.restart(),t.pause())})),xe.call(t,t.media,"progress playing seeking seeked",(function(e){return nt.updateProgress.call(t,e)})),xe.call(t,t.media,"volumechange",(function(e){return nt.updateVolume.call(t,e)})),xe.call(t,t.media,"playing play pause ended emptied timeupdate",(function(e){return yt.checkPlaying.call(t,e)})),xe.call(t,t.media,"waiting canplay seeked playing",(function(e){return yt.checkLoading.call(t,e)})),t.supported.ui&&t.config.clickToPlay&&!t.isAudio){var n=Ce.call(t,".".concat(t.config.classNames.video));if(!G(n))return;xe.call(t,i.container,"click",(function(a){([i.container,n].includes(a.target)||n.contains(a.target))&&(t.touch&&t.config.hideControls||(t.ended?(e.proxy(a,t.restart,"restart"),e.proxy(a,(function(){qe(t.play())}),"play")):e.proxy(a,(function(){qe(t.togglePlay())}),"play")))}))}t.supported.ui&&t.config.disableContextMenu&&xe.call(t,i.wrapper,"contextmenu",(function(e){e.preventDefault()}),!1),xe.call(t,t.media,"volumechange",(function(){t.storage.set({volume:t.volume,muted:t.muted})})),xe.call(t,t.media,"ratechange",(function(){nt.updateSetting.call(t,"speed"),t.storage.set({speed:t.speed})})),xe.call(t,t.media,"qualitychange",(function(e){nt.updateSetting.call(t,"quality",null,e.detail.quality)})),xe.call(t,t.media,"ready qualitychange",(function(){nt.setDownloadUrl.call(t)}));var a=t.config.events.concat(["keyup","keydown"]).join(" ");xe.call(t,t.media,a,(function(e){var n=e.detail,a=void 0===n?{}:n;"error"===e.type&&(a=t.media.error),Oe.call(t,i.container,e.type,!0,a)}))}},{key:"proxy",value:function(e,t,i){var n=this.player,a=n.config.listeners[i],s=!0;X(a)&&(s=a.call(n,e)),!1!==s&&X(t)&&t.call(n,e)}},{key:"bind",value:function(e,t,i,n){var a=this,s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],r=this.player,o=r.config.listeners[n],l=X(o);xe.call(r,e,t,(function(e){return a.proxy(e,i,n)}),s&&!l)}},{key:"controls",value:function(){var e=this,t=this.player,i=t.elements,n=oe.isIE?"change":"input";if(i.buttons.play&&Array.from(i.buttons.play).forEach((function(i){e.bind(i,"click",(function(){qe(t.togglePlay())}),"play")})),this.bind(i.buttons.restart,"click",t.restart,"restart"),this.bind(i.buttons.rewind,"click",t.rewind,"rewind"),this.bind(i.buttons.fastForward,"click",t.forward,"fastForward"),this.bind(i.buttons.mute,"click",(function(){t.muted=!t.muted}),"mute"),this.bind(i.buttons.captions,"click",(function(){return t.toggleCaptions()})),this.bind(i.buttons.download,"click",(function(){Oe.call(t,t.media,"download")}),"download"),this.bind(i.buttons.fullscreen,"click",(function(){t.fullscreen.toggle()}),"fullscreen"),this.bind(i.buttons.pip,"click",(function(){t.pip="toggle"}),"pip"),this.bind(i.buttons.airplay,"click",t.airplay,"airplay"),this.bind(i.buttons.settings,"click",(function(e){e.stopPropagation(),e.preventDefault(),nt.toggleMenu.call(t,e)}),null,!1),this.bind(i.buttons.settings,"keyup",(function(e){var i=e.which;[13,32].includes(i)&&(13!==i?(e.preventDefault(),e.stopPropagation(),nt.toggleMenu.call(t,e)):nt.focusFirstMenuItem.call(t,null,!0))}),null,!1),this.bind(i.settings.menu,"keydown",(function(e){27===e.which&&nt.toggleMenu.call(t,e)})),this.bind(i.inputs.seek,"mousedown mousemove",(function(e){var t=i.progress.getBoundingClientRect(),n=100/t.width*(e.pageX-t.left);e.currentTarget.setAttribute("seek-value",n)})),this.bind(i.inputs.seek,"mousedown mouseup keydown keyup touchstart touchend",(function(e){var i=e.currentTarget,n=e.keyCode?e.keyCode:e.which;if(!ee(e)||39===n||37===n){t.lastSeekTime=Date.now();var a=i.hasAttribute("play-on-seeked"),s=["mouseup","touchend","keyup"].includes(e.type);a&&s?(i.removeAttribute("play-on-seeked"),qe(t.play())):!s&&t.playing&&(i.setAttribute("play-on-seeked",""),t.pause())}})),oe.isIos){var a=Te.call(t,'input[type="range"]');Array.from(a).forEach((function(t){return e.bind(t,n,(function(e){return re(e.target)}))}))}this.bind(i.inputs.seek,n,(function(e){var i=e.currentTarget,n=i.getAttribute("seek-value");ae(n)&&(n=i.value),i.removeAttribute("seek-value"),t.currentTime=n/i.max*t.duration}),"seek"),this.bind(i.progress,"mouseenter mouseleave mousemove",(function(e){return nt.updateSeekTooltip.call(t,e)})),this.bind(i.progress,"mousemove touchmove",(function(e){var i=t.previewThumbnails;i&&i.loaded&&i.startMove(e)})),this.bind(i.progress,"mouseleave touchend click",(function(){var e=t.previewThumbnails;e&&e.loaded&&e.endMove(!1,!0)})),this.bind(i.progress,"mousedown touchstart",(function(e){var i=t.previewThumbnails;i&&i.loaded&&i.startScrubbing(e)})),this.bind(i.progress,"mouseup touchend",(function(e){var i=t.previewThumbnails;i&&i.loaded&&i.endScrubbing(e)})),oe.isWebkit&&Array.from(Te.call(t,'input[type="range"]')).forEach((function(i){e.bind(i,"input",(function(e){return nt.updateRangeFill.call(t,e.target)}))})),t.config.toggleInvert&&!G(i.display.duration)&&this.bind(i.display.currentTime,"click",(function(){0!==t.currentTime&&(t.config.invertTime=!t.config.invertTime,nt.timeUpdate.call(t))})),this.bind(i.inputs.volume,n,(function(e){t.volume=e.target.value}),"volume"),this.bind(i.controls,"mouseenter mouseleave",(function(e){i.controls.hover=!t.touch&&"mouseenter"===e.type})),i.fullscreen&&Array.from(i.fullscreen.children).filter((function(e){return!e.contains(i.container)})).forEach((function(n){e.bind(n,"mouseenter mouseleave",(function(e){i.controls.hover=!t.touch&&"mouseenter"===e.type}))})),this.bind(i.controls,"mousedown mouseup touchstart touchend touchcancel",(function(e){i.controls.pressed=["mousedown","touchstart"].includes(e.type)})),this.bind(i.controls,"focusin",(function(){var n=t.config,a=t.timers;be(i.controls,n.classNames.noTransition,!0),yt.toggleControls.call(t,!0),setTimeout((function(){be(i.controls,n.classNames.noTransition,!1)}),0);var s=e.touch?3e3:4e3;clearTimeout(a.controls),a.controls=setTimeout((function(){return yt.toggleControls.call(t,!1)}),s)})),this.bind(i.inputs.volume,"wheel",(function(e){var i=e.webkitDirectionInvertedFromDevice,n=o([e.deltaX,-e.deltaY].map((function(e){return i?-e:e})),2),a=n[0],s=n[1],r=Math.sign(Math.abs(a)>Math.abs(s)?a:s);t.increaseVolume(r/50);var l=t.media.volume;(1===r&&l<1||-1===r&&l>0)&&e.preventDefault()}),"volume",!1)}}]),t}();"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;var bt=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(e,t){e.exports=function(){var e=function(){},t={},i={},n={};function a(e,t){if(e){var a=n[e];if(i[e]=t,a)for(;a.length;)a[0](e,t),a.splice(0,1)}}function s(t,i){t.call&&(t={success:t}),i.length?(t.error||e)(i):(t.success||e)(t)}function r(t,i,n,a){var s,o,l=document,c=n.async,u=(n.numRetries||0)+1,d=n.before||e,h=t.replace(/[\?|#].*$/,""),p=t.replace(/^(css|img)!/,"");a=a||0,/(^css!|\.css$)/.test(h)?((o=l.createElement("link")).rel="stylesheet",o.href=p,(s="hideFocus"in o)&&o.relList&&(s=0,o.rel="preload",o.as="style")):/(^img!|\.(png|gif|jpg|svg|webp)$)/.test(h)?(o=l.createElement("img")).src=p:((o=l.createElement("script")).src=t,o.async=void 0===c||c),o.onload=o.onerror=o.onbeforeload=function(e){var l=e.type[0];if(s)try{o.sheet.cssText.length||(l="e")}catch(e){18!=e.code&&(l="e")}if("e"==l){if((a+=1)<u)return r(t,i,n,a)}else if("preload"==o.rel&&"style"==o.as)return o.rel="stylesheet";i(t,l,e.defaultPrevented)},!1!==d(t,o)&&l.head.appendChild(o)}function o(e,i,n){var o,l;if(i&&i.trim&&(o=i),l=(o?n:i)||{},o){if(o in t)throw"LoadJS";t[o]=!0}function c(t,i){!function(e,t,i){var n,a,s=(e=e.push?e:[e]).length,o=s,l=[];for(n=function(e,i,n){if("e"==i&&l.push(e),"b"==i){if(!n)return;l.push(e)}--s||t(l)},a=0;a<o;a++)r(e[a],n,i)}(e,(function(e){s(l,e),t&&s({success:t,error:i},e),a(o,e)}),l)}if(l.returnPromise)return new Promise(c);c()}return o.ready=function(e,t){return function(e,t){e=e.push?e:[e];var a,s,r,o=[],l=e.length,c=l;for(a=function(e,i){i.length&&o.push(e),--c||t(o)};l--;)s=e[l],(r=i[s])?a(s,r):(n[s]=n[s]||[]).push(a)}(e,(function(e){s(t,e)})),o},o.done=function(e){a(e,[])},o.reset=function(){t={},i={},n={}},o.isDefined=function(e){return e in t},o}()}));function wt(e){return new Promise((function(t,i){bt(e,{success:t,error:i})}))}function kt(e){e&&!this.embed.hasPlayed&&(this.embed.hasPlayed=!0),this.media.paused===e&&(this.media.paused=!e,Oe.call(this,this.media,e?"play":"pause"))}var Tt={setup:function(){var e=this;be(e.elements.wrapper,e.config.classNames.embed,!0),e.options.speed=e.config.speed.options,Re.call(e),z(window.Vimeo)?Tt.ready.call(e):wt(e.config.urls.vimeo.sdk).then((function(){Tt.ready.call(e)})).catch((function(t){e.debug.warn("Vimeo SDK (player.js) failed to load",t)}))},ready:function(){var e=this,t=this,i=t.config.vimeo,n=i.premium,a=i.referrerPolicy,l=r(i,["premium","referrerPolicy"]);n&&Object.assign(l,{controls:!1,sidedock:!1});var c=st(s({loop:t.config.loop.active,autoplay:t.autoplay,muted:t.muted,gesture:"media",playsinline:!this.config.fullscreen.iosNative},l)),u=t.media.getAttribute("src");ae(u)&&(u=t.media.getAttribute(t.config.attributes.embed.id));var d,h=ae(d=u)?null:K(Number(d))?d:d.match(/^.*(vimeo.com\/|video\/)(\d+).*/)?RegExp.$2:d,p=he("iframe"),m=Ue(t.config.urls.vimeo.iframe,h,c);p.setAttribute("src",m),p.setAttribute("allowfullscreen",""),p.setAttribute("allow","autoplay,fullscreen,picture-in-picture"),ae(a)||p.setAttribute("referrerPolicy",a);var f=t.poster;if(n)p.setAttribute("data-poster",f),t.media=ge(p,t.media);else{var g=he("div",{class:t.config.classNames.embedContainer,"data-poster":f});g.appendChild(p),t.media=ge(g,t.media)}Je(Ue(t.config.urls.vimeo.api,h),"json").then((function(e){if(!ae(e)){var i=new URL(e[0].thumbnail_large);i.pathname="".concat(i.pathname.split("_")[0],".jpg"),yt.setPoster.call(t,i.href).catch((function(){}))}})),t.embed=new window.Vimeo.Player(p,{autopause:t.config.autopause,muted:t.muted}),t.media.paused=!0,t.media.currentTime=0,t.supported.ui&&t.embed.disableTextTrack(),t.media.play=function(){return kt.call(t,!0),t.embed.play()},t.media.pause=function(){return kt.call(t,!1),t.embed.pause()},t.media.stop=function(){t.pause(),t.currentTime=0};var y=t.media.currentTime;Object.defineProperty(t.media,"currentTime",{get:function(){return y},set:function(e){var i=t.embed,n=t.media,a=t.paused,s=t.volume,r=a&&!i.hasPlayed;n.seeking=!0,Oe.call(t,n,"seeking"),Promise.resolve(r&&i.setVolume(0)).then((function(){return i.setCurrentTime(e)})).then((function(){return r&&i.pause()})).then((function(){return r&&i.setVolume(s)})).catch((function(){}))}});var v=t.config.speed.selected;Object.defineProperty(t.media,"playbackRate",{get:function(){return v},set:function(e){t.embed.setPlaybackRate(e).then((function(){v=e,Oe.call(t,t.media,"ratechange")})).catch((function(){t.options.speed=[1]}))}});var b=t.config.volume;Object.defineProperty(t.media,"volume",{get:function(){return b},set:function(e){t.embed.setVolume(e).then((function(){b=e,Oe.call(t,t.media,"volumechange")}))}});var w=t.config.muted;Object.defineProperty(t.media,"muted",{get:function(){return w},set:function(e){var i=!!Q(e)&&e;t.embed.setVolume(i?0:t.config.volume).then((function(){w=i,Oe.call(t,t.media,"volumechange")}))}});var k,T=t.config.loop;Object.defineProperty(t.media,"loop",{get:function(){return T},set:function(e){var i=Q(e)?e:t.config.loop.active;t.embed.setLoop(i).then((function(){T=i}))}}),t.embed.getVideoUrl().then((function(e){k=e,nt.setDownloadUrl.call(t)})).catch((function(t){e.debug.warn(t)})),Object.defineProperty(t.media,"currentSrc",{get:function(){return k}}),Object.defineProperty(t.media,"ended",{get:function(){return t.currentTime===t.duration}}),Promise.all([t.embed.getVideoWidth(),t.embed.getVideoHeight()]).then((function(i){var n=o(i,2),a=n[0],s=n[1];t.embed.ratio=[a,s],Re.call(e)})),t.embed.setAutopause(t.config.autopause).then((function(e){t.config.autopause=e})),t.embed.getVideoTitle().then((function(i){t.config.title=i,yt.setTitle.call(e)})),t.embed.getCurrentTime().then((function(e){y=e,Oe.call(t,t.media,"timeupdate")})),t.embed.getDuration().then((function(e){t.media.duration=e,Oe.call(t,t.media,"durationchange")})),t.embed.getTextTracks().then((function(e){t.media.textTracks=e,rt.setup.call(t)})),t.embed.on("cuechange",(function(e){var i=e.cues,n=(void 0===i?[]:i).map((function(e){return function(e){var t=document.createDocumentFragment(),i=document.createElement("div");return t.appendChild(i),i.innerHTML=e,t.firstChild.innerText}(e.text)}));rt.updateCues.call(t,n)})),t.embed.on("loaded",(function(){(t.embed.getPaused().then((function(e){kt.call(t,!e),e||Oe.call(t,t.media,"playing")})),G(t.embed.element)&&t.supported.ui)&&t.embed.element.setAttribute("tabindex",-1)})),t.embed.on("bufferstart",(function(){Oe.call(t,t.media,"waiting")})),t.embed.on("bufferend",(function(){Oe.call(t,t.media,"playing")})),t.embed.on("play",(function(){kt.call(t,!0),Oe.call(t,t.media,"playing")})),t.embed.on("pause",(function(){kt.call(t,!1)})),t.embed.on("timeupdate",(function(e){t.media.seeking=!1,y=e.seconds,Oe.call(t,t.media,"timeupdate")})),t.embed.on("progress",(function(e){t.media.buffered=e.percent,Oe.call(t,t.media,"progress"),1===parseInt(e.percent,10)&&Oe.call(t,t.media,"canplaythrough"),t.embed.getDuration().then((function(e){e!==t.media.duration&&(t.media.duration=e,Oe.call(t,t.media,"durationchange"))}))})),t.embed.on("seeked",(function(){t.media.seeking=!1,Oe.call(t,t.media,"seeked")})),t.embed.on("ended",(function(){t.media.paused=!0,Oe.call(t,t.media,"ended")})),t.embed.on("error",(function(e){t.media.error=e,Oe.call(t,t.media,"error")})),setTimeout((function(){return yt.build.call(t)}),0)}};function Ct(e){e&&!this.embed.hasPlayed&&(this.embed.hasPlayed=!0),this.media.paused===e&&(this.media.paused=!e,Oe.call(this,this.media,e?"play":"pause"))}function At(e){return e.noCookie?"https://www.youtube-nocookie.com":"http:"===window.location.protocol?"http://www.youtube.com":void 0}var St={setup:function(){var e=this;if(be(this.elements.wrapper,this.config.classNames.embed,!0),z(window.YT)&&X(window.YT.Player))St.ready.call(this);else{var t=window.onYouTubeIframeAPIReady;window.onYouTubeIframeAPIReady=function(){X(t)&&t(),St.ready.call(e)},wt(this.config.urls.youtube.sdk).catch((function(t){e.debug.warn("YouTube API failed to load",t)}))}},getTitle:function(e){var t=this;Je(Ue(this.config.urls.youtube.api,e)).then((function(e){if(z(e)){var i=e.title,n=e.height,a=e.width;t.config.title=i,yt.setTitle.call(t),t.embed.ratio=[a,n]}Re.call(t)})).catch((function(){Re.call(t)}))},ready:function(){var e=this,t=e.media&&e.media.getAttribute("id");if(ae(t)||!t.startsWith("youtube-")){var i=e.media.getAttribute("src");ae(i)&&(i=e.media.getAttribute(this.config.attributes.embed.id));var n,a,s=ae(n=i)?null:n.match(/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*/)?RegExp.$2:n,r=(a=e.provider,"".concat(a,"-").concat(Math.floor(1e4*Math.random()))),o=he("div",{id:r,"data-poster":e.poster});e.media=ge(o,e.media);var l=function(e){return"https://i.ytimg.com/vi/".concat(s,"/").concat(e,"default.jpg")};gt(l("maxres"),121).catch((function(){return gt(l("sd"),121)})).catch((function(){return gt(l("hq"))})).then((function(t){return yt.setPoster.call(e,t.src)})).then((function(t){t.includes("maxres")||(e.elements.poster.style.backgroundSize="cover")})).catch((function(){}));var c=e.config.youtube;e.embed=new window.YT.Player(r,{videoId:s,host:At(c),playerVars:ce({},{autoplay:e.config.autoplay?1:0,hl:e.config.hl,controls:e.supported.ui?0:1,disablekb:1,playsinline:e.config.fullscreen.iosNative?0:1,cc_load_policy:e.captions.active?1:0,cc_lang_pref:e.config.captions.language,widget_referrer:window?window.location.href:null},c),events:{onError:function(t){if(!e.media.error){var i=t.data,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.",5:"The requested content cannot be played in an HTML5 player or another error related to the HTML5 player has occurred.",100:"The video requested was not found. This error occurs when a video has been removed (for any reason) or has been marked as private.",101:"The owner of the requested video does not allow it to be played in embedded players.",150:"The owner of the requested video does not allow it to be played in embedded players."}[i]||"An unknown error occured";e.media.error={code:i,message:n},Oe.call(e,e.media,"error")}},onPlaybackRateChange:function(t){var i=t.target;e.media.playbackRate=i.getPlaybackRate(),Oe.call(e,e.media,"ratechange")},onReady:function(t){if(!X(e.media.play)){var i=t.target;St.getTitle.call(e,s),e.media.play=function(){Ct.call(e,!0),i.playVideo()},e.media.pause=function(){Ct.call(e,!1),i.pauseVideo()},e.media.stop=function(){i.stopVideo()},e.media.duration=i.getDuration(),e.media.paused=!0,e.media.currentTime=0,Object.defineProperty(e.media,"currentTime",{get:function(){return Number(i.getCurrentTime())},set:function(t){e.paused&&!e.embed.hasPlayed&&e.embed.mute(),e.media.seeking=!0,Oe.call(e,e.media,"seeking"),i.seekTo(t)}}),Object.defineProperty(e.media,"playbackRate",{get:function(){return i.getPlaybackRate()},set:function(e){i.setPlaybackRate(e)}});var n=e.config.volume;Object.defineProperty(e.media,"volume",{get:function(){return n},set:function(t){n=t,i.setVolume(100*n),Oe.call(e,e.media,"volumechange")}});var a=e.config.muted;Object.defineProperty(e.media,"muted",{get:function(){return a},set:function(t){var n=Q(t)?t:a;a=n,i[n?"mute":"unMute"](),Oe.call(e,e.media,"volumechange")}}),Object.defineProperty(e.media,"currentSrc",{get:function(){return i.getVideoUrl()}}),Object.defineProperty(e.media,"ended",{get:function(){return e.currentTime===e.duration}});var r=i.getAvailablePlaybackRates();e.options.speed=r.filter((function(t){return e.config.speed.options.includes(t)})),e.supported.ui&&e.media.setAttribute("tabindex",-1),Oe.call(e,e.media,"timeupdate"),Oe.call(e,e.media,"durationchange"),clearInterval(e.timers.buffering),e.timers.buffering=setInterval((function(){e.media.buffered=i.getVideoLoadedFraction(),(null===e.media.lastBuffered||e.media.lastBuffered<e.media.buffered)&&Oe.call(e,e.media,"progress"),e.media.lastBuffered=e.media.buffered,1===e.media.buffered&&(clearInterval(e.timers.buffering),Oe.call(e,e.media,"canplaythrough"))}),200),setTimeout((function(){return yt.build.call(e)}),50)}},onStateChange:function(t){var i=t.target;switch(clearInterval(e.timers.playing),e.media.seeking&&[1,2].includes(t.data)&&(e.media.seeking=!1,Oe.call(e,e.media,"seeked")),t.data){case-1:Oe.call(e,e.media,"timeupdate"),e.media.buffered=i.getVideoLoadedFraction(),Oe.call(e,e.media,"progress");break;case 0:Ct.call(e,!1),e.media.loop?(i.stopVideo(),i.playVideo()):Oe.call(e,e.media,"ended");break;case 1:e.config.autoplay||!e.media.paused||e.embed.hasPlayed?(Ct.call(e,!0),Oe.call(e,e.media,"playing"),e.timers.playing=setInterval((function(){Oe.call(e,e.media,"timeupdate")}),50),e.media.duration!==i.getDuration()&&(e.media.duration=i.getDuration(),Oe.call(e,e.media,"durationchange"))):e.media.pause();break;case 2:e.muted||e.embed.unMute(),Ct.call(e,!1);break;case 3:Oe.call(e,e.media,"waiting")}Oe.call(e,e.elements.container,"statechange",!1,{code:t.data})}}})}}},Pt={setup:function(){this.media?(be(this.elements.container,this.config.classNames.type.replace("{0}",this.type),!0),be(this.elements.container,this.config.classNames.provider.replace("{0}",this.provider),!0),this.isEmbed&&be(this.elements.container,this.config.classNames.type.replace("{0}","video"),!0),this.isVideo&&(this.elements.wrapper=he("div",{class:this.config.classNames.video}),ue(this.media,this.elements.wrapper),this.elements.poster=he("div",{class:this.config.classNames.poster}),this.elements.wrapper.appendChild(this.elements.poster)),this.isHTML5?Ve.setup.call(this):this.isYouTube?St.setup.call(this):this.isVimeo&&Tt.setup.call(this)):this.debug.warn("No media element found!")}},Et=function(){function t(i){var n=this;e(this,t),this.player=i,this.config=i.config.ads,this.playing=!1,this.initialized=!1,this.elements={container:null,displayContainer:null},this.manager=null,this.loader=null,this.cuePoints=null,this.events={},this.safetyTimer=null,this.countdownTimer=null,this.managerPromise=new Promise((function(e,t){n.on("loaded",e),n.on("error",t)})),this.load()}return i(t,[{key:"load",value:function(){var e=this;this.enabled&&(z(window.google)&&z(window.google.ima)?this.ready():wt(this.player.config.urls.googleIMA.sdk).then((function(){e.ready()})).catch((function(){e.trigger("error",new Error("Google IMA SDK failed to load"))})))}},{key:"ready",value:function(){var e,t=this;this.enabled||((e=this).manager&&e.manager.destroy(),e.elements.displayContainer&&e.elements.displayContainer.destroy(),e.elements.container.remove()),this.startSafetyTimer(12e3,"ready()"),this.managerPromise.then((function(){t.clearSafetyTimer("onAdsManagerLoaded()")})),this.listeners(),this.setupIMA()}},{key:"setupIMA",value:function(){var e=this;this.elements.container=he("div",{class:this.player.config.classNames.ads}),this.player.elements.container.appendChild(this.elements.container),google.ima.settings.setVpaidMode(google.ima.ImaSdkSettings.VpaidMode.ENABLED),google.ima.settings.setLocale(this.player.config.ads.language),google.ima.settings.setDisableCustomPlaybackForIOS10Plus(this.player.config.playsinline),this.elements.displayContainer=new google.ima.AdDisplayContainer(this.elements.container,this.player.media),this.loader=new google.ima.AdsLoader(this.elements.displayContainer),this.loader.addEventListener(google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,(function(t){return e.onAdsManagerLoaded(t)}),!1),this.loader.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR,(function(t){return e.onAdError(t)}),!1),this.requestAds()}},{key:"requestAds",value:function(){var e=this.player.elements.container;try{var t=new google.ima.AdsRequest;t.adTagUrl=this.tagUrl,t.linearAdSlotWidth=e.offsetWidth,t.linearAdSlotHeight=e.offsetHeight,t.nonLinearAdSlotWidth=e.offsetWidth,t.nonLinearAdSlotHeight=e.offsetHeight,t.forceNonLinearFullSlot=!1,t.setAdWillPlayMuted(!this.player.muted),this.loader.requestAds(t)}catch(e){this.onAdError(e)}}},{key:"pollCountdown",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!t)return clearInterval(this.countdownTimer),void this.elements.container.removeAttribute("data-badge-text");var i=function(){var t=it(Math.max(e.manager.getRemainingTime(),0)),i="".concat(Xe("advertisement",e.player.config)," - ").concat(t);e.elements.container.setAttribute("data-badge-text",i)};this.countdownTimer=setInterval(i,100)}},{key:"onAdsManagerLoaded",value:function(e){var t=this;if(this.enabled){var i=new google.ima.AdsRenderingSettings;i.restoreCustomPlaybackStateOnAdBreakComplete=!0,i.enablePreloading=!0,this.manager=e.getAdsManager(this.player,i),this.cuePoints=this.manager.getCuePoints(),this.manager.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR,(function(e){return t.onAdError(e)})),Object.keys(google.ima.AdEvent.Type).forEach((function(e){t.manager.addEventListener(google.ima.AdEvent.Type[e],(function(e){return t.onAdEvent(e)}))})),this.trigger("loaded")}}},{key:"addCuePoints",value:function(){var e=this;ae(this.cuePoints)||this.cuePoints.forEach((function(t){if(0!==t&&-1!==t&&t<e.player.duration){var i=e.player.elements.progress;if(G(i)){var n=100/e.player.duration*t,a=he("span",{class:e.player.config.classNames.cues});a.style.left="".concat(n.toString(),"%"),i.appendChild(a)}}}))}},{key:"onAdEvent",value:function(e){var t=this,i=this.player.elements.container,n=e.getAd(),a=e.getAdData();switch(function(e){Oe.call(t.player,t.player.media,"ads".concat(e.replace(/_/g,"").toLowerCase()))}(e.type),e.type){case google.ima.AdEvent.Type.LOADED:this.trigger("loaded"),this.pollCountdown(!0),n.isLinear()||(n.width=i.offsetWidth,n.height=i.offsetHeight);break;case google.ima.AdEvent.Type.STARTED:this.manager.setVolume(this.player.volume);break;case google.ima.AdEvent.Type.ALL_ADS_COMPLETED:this.player.ended?this.loadAds():this.loader.contentComplete();break;case google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED:this.pauseContent();break;case google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED:this.pollCountdown(),this.resumeContent();break;case google.ima.AdEvent.Type.LOG:a.adError&&this.player.debug.warn("Non-fatal ad error: ".concat(a.adError.getMessage()))}}},{key:"onAdError",value:function(e){this.cancel(),this.player.debug.warn("Ads error",e)}},{key:"listeners",value:function(){var e,t=this,i=this.player.elements.container;this.player.on("canplay",(function(){t.addCuePoints()})),this.player.on("ended",(function(){t.loader.contentComplete()})),this.player.on("timeupdate",(function(){e=t.player.currentTime})),this.player.on("seeked",(function(){var i=t.player.currentTime;ae(t.cuePoints)||t.cuePoints.forEach((function(n,a){e<n&&n<i&&(t.manager.discardAdBreak(),t.cuePoints.splice(a,1))}))})),window.addEventListener("resize",(function(){t.manager&&t.manager.resize(i.offsetWidth,i.offsetHeight,google.ima.ViewMode.NORMAL)}))}},{key:"play",value:function(){var e=this,t=this.player.elements.container;this.managerPromise||this.resumeContent(),this.managerPromise.then((function(){e.manager.setVolume(e.player.volume),e.elements.displayContainer.initialize();try{e.initialized||(e.manager.init(t.offsetWidth,t.offsetHeight,google.ima.ViewMode.NORMAL),e.manager.start()),e.initialized=!0}catch(t){e.onAdError(t)}})).catch((function(){}))}},{key:"resumeContent",value:function(){this.elements.container.style.zIndex="",this.playing=!1,qe(this.player.media.play())}},{key:"pauseContent",value:function(){this.elements.container.style.zIndex=3,this.playing=!0,this.player.media.pause()}},{key:"cancel",value:function(){this.initialized&&this.resumeContent(),this.trigger("error"),this.loadAds()}},{key:"loadAds",value:function(){var e=this;this.managerPromise.then((function(){e.manager&&e.manager.destroy(),e.managerPromise=new Promise((function(t){e.on("loaded",t),e.player.debug.log(e.manager)})),e.initialized=!1,e.requestAds()})).catch((function(){}))}},{key:"trigger",value:function(e){for(var t=this,i=arguments.length,n=new Array(i>1?i-1:0),a=1;a<i;a++)n[a-1]=arguments[a];var s=this.events[e];$(s)&&s.forEach((function(e){X(e)&&e.apply(t,n)}))}},{key:"on",value:function(e,t){return $(this.events[e])||(this.events[e]=[]),this.events[e].push(t),this}},{key:"startSafetyTimer",value:function(e,t){var i=this;this.player.debug.log("Safety timer invoked from: ".concat(t)),this.safetyTimer=setTimeout((function(){i.cancel(),i.clearSafetyTimer("startSafetyTimer()")}),e)}},{key:"clearSafetyTimer",value:function(e){W(this.safetyTimer)||(this.player.debug.log("Safety timer cleared from: ".concat(e)),clearTimeout(this.safetyTimer),this.safetyTimer=null)}},{key:"enabled",get:function(){var e=this.config;return this.player.isHTML5&&this.player.isVideo&&e.enabled&&(!ae(e.publisherId)||ne(e.tagUrl))}},{key:"tagUrl",get:function(){var e=this.config;if(ne(e.tagUrl))return e.tagUrl;var t={AV_PUBLISHERID:"58c25bb0073ef448b1087ad6",AV_CHANNELID:"5a0458dc28a06145e4519d21",AV_URL:window.location.hostname,cb:Date.now(),AV_WIDTH:640,AV_HEIGHT:480,AV_CDIM2:e.publisherId};return"".concat("https://go.aniview.com/api/adserver6/vast/","?").concat(st(t))}}]),t}(),Nt=function(e,t){var i={};return e>t.width/t.height?(i.width=t.width,i.height=1/e*t.width):(i.height=t.height,i.width=e*t.height),i},Mt=function(){function t(i){e(this,t),this.player=i,this.thumbnails=[],this.loaded=!1,this.lastMouseMoveTime=Date.now(),this.mouseDown=!1,this.loadedImages=[],this.elements={thumb:{},scrubbing:{}},this.load()}return i(t,[{key:"load",value:function(){var e=this;this.player.elements.display.seekTooltip&&(this.player.elements.display.seekTooltip.hidden=this.enabled),this.enabled&&this.getThumbnails().then((function(){e.enabled&&(e.render(),e.determineContainerAutoSizing(),e.loaded=!0)}))}},{key:"getThumbnails",value:function(){var e=this;return new Promise((function(t){var i=e.player.config.previewThumbnails.src;if(ae(i))throw new Error("Missing previewThumbnails.src config attribute");var n=function(){e.thumbnails.sort((function(e,t){return e.height-t.height})),e.player.debug.log("Preview thumbnails",e.thumbnails),t()};if(X(i))i((function(t){e.thumbnails=t,n()}));else{var a=(Y(i)?[i]:i).map((function(t){return e.getThumbnail(t)}));Promise.all(a).then(n)}}))}},{key:"getThumbnail",value:function(e){var t=this;return new Promise((function(i){Je(e).then((function(n){var a,s,r={frames:(a=n,s=[],a.split(/\r\n\r\n|\n\n|\r\r/).forEach((function(e){var t={};e.split(/\r\n|\n|\r/).forEach((function(e){if(K(t.startTime)){if(!ae(e.trim())&&ae(t.text)){var i=e.trim().split("#xywh="),n=o(i,1);if(t.text=n[0],i[1]){var a=o(i[1].split(","),4);t.x=a[0],t.y=a[1],t.w=a[2],t.h=a[3]}}}else{var s=e.match(/([0-9]{2})?:?([0-9]{2}):([0-9]{2}).([0-9]{2,3})( ?--> ?)([0-9]{2})?:?([0-9]{2}):([0-9]{2}).([0-9]{2,3})/);s&&(t.startTime=60*Number(s[1]||0)*60+60*Number(s[2])+Number(s[3])+Number("0.".concat(s[4])),t.endTime=60*Number(s[6]||0)*60+60*Number(s[7])+Number(s[8])+Number("0.".concat(s[9])))}})),t.text&&s.push(t)})),s),height:null,urlPrefix:""};r.frames[0].text.startsWith("/")||r.frames[0].text.startsWith("http://")||r.frames[0].text.startsWith("https://")||(r.urlPrefix=e.substring(0,e.lastIndexOf("/")+1));var l=new Image;l.onload=function(){r.height=l.naturalHeight,r.width=l.naturalWidth,t.thumbnails.push(r),i()},l.src=r.urlPrefix+r.frames[0].text}))}))}},{key:"startMove",value:function(e){if(this.loaded&&Z(e)&&["touchmove","mousemove"].includes(e.type)&&this.player.media.duration){if("touchmove"===e.type)this.seekTime=this.player.media.duration*(this.player.elements.inputs.seek.value/100);else{var t=this.player.elements.progress.getBoundingClientRect(),i=100/t.width*(e.pageX-t.left);this.seekTime=this.player.media.duration*(i/100),this.seekTime<0&&(this.seekTime=0),this.seekTime>this.player.media.duration-1&&(this.seekTime=this.player.media.duration-1),this.mousePosX=e.pageX,this.elements.thumb.time.innerText=it(this.seekTime)}this.showImageAtCurrentTime()}}},{key:"endMove",value:function(){this.toggleThumbContainer(!1,!0)}},{key:"startScrubbing",value:function(e){(W(e.button)||!1===e.button||0===e.button)&&(this.mouseDown=!0,this.player.media.duration&&(this.toggleScrubbingContainer(!0),this.toggleThumbContainer(!1,!0),this.showImageAtCurrentTime()))}},{key:"endScrubbing",value:function(){var e=this;this.mouseDown=!1,Math.ceil(this.lastTime)===Math.ceil(this.player.media.currentTime)?this.toggleScrubbingContainer(!1):Le.call(this.player,this.player.media,"timeupdate",(function(){e.mouseDown||e.toggleScrubbingContainer(!1)}))}},{key:"listeners",value:function(){var e=this;this.player.on("play",(function(){e.toggleThumbContainer(!1,!0)})),this.player.on("seeked",(function(){e.toggleThumbContainer(!1)})),this.player.on("timeupdate",(function(){e.lastTime=e.player.media.currentTime}))}},{key:"render",value:function(){this.elements.thumb.container=he("div",{class:this.player.config.classNames.previewThumbnails.thumbContainer}),this.elements.thumb.imageContainer=he("div",{class:this.player.config.classNames.previewThumbnails.imageContainer}),this.elements.thumb.container.appendChild(this.elements.thumb.imageContainer);var e=he("div",{class:this.player.config.classNames.previewThumbnails.timeContainer});this.elements.thumb.time=he("span",{},"00:00"),e.appendChild(this.elements.thumb.time),this.elements.thumb.container.appendChild(e),G(this.player.elements.progress)&&this.player.elements.progress.appendChild(this.elements.thumb.container),this.elements.scrubbing.container=he("div",{class:this.player.config.classNames.previewThumbnails.scrubbingContainer}),this.player.elements.wrapper.appendChild(this.elements.scrubbing.container)}},{key:"destroy",value:function(){this.elements.thumb.container&&this.elements.thumb.container.remove(),this.elements.scrubbing.container&&this.elements.scrubbing.container.remove()}},{key:"showImageAtCurrentTime",value:function(){var e=this;this.mouseDown?this.setScrubbingContainerSize():this.setThumbContainerSizeAndPos();var t=this.thumbnails[0].frames.findIndex((function(t){return e.seekTime>=t.startTime&&e.seekTime<=t.endTime})),i=t>=0,n=0;this.mouseDown||this.toggleThumbContainer(i),i&&(this.thumbnails.forEach((function(i,a){e.loadedImages.includes(i.frames[t].text)&&(n=a)})),t!==this.showingThumb&&(this.showingThumb=t,this.loadImage(n)))}},{key:"loadImage",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,i=this.showingThumb,n=this.thumbnails[t],a=n.urlPrefix,s=n.frames[i],r=n.frames[i].text,o=a+r;if(this.currentImageElement&&this.currentImageElement.dataset.filename===r)this.showImage(this.currentImageElement,s,t,i,r,!1),this.currentImageElement.dataset.index=i,this.removeOldImages(this.currentImageElement);else{this.loadingImage&&this.usingSprites&&(this.loadingImage.onload=null);var l=new Image;l.src=o,l.dataset.index=i,l.dataset.filename=r,this.showingThumbFilename=r,this.player.debug.log("Loading image: ".concat(o)),l.onload=function(){return e.showImage(l,s,t,i,r,!0)},this.loadingImage=l,this.removeOldImages(l)}}},{key:"showImage",value:function(e,t,i,n,a){var s=!(arguments.length>5&&void 0!==arguments[5])||arguments[5];this.player.debug.log("Showing thumb: ".concat(a,". num: ").concat(n,". qual: ").concat(i,". newimg: ").concat(s)),this.setImageSizeAndOffset(e,t),s&&(this.currentImageContainer.appendChild(e),this.currentImageElement=e,this.loadedImages.includes(a)||this.loadedImages.push(a)),this.preloadNearby(n,!0).then(this.preloadNearby(n,!1)).then(this.getHigherQuality(i,e,t,a))}},{key:"removeOldImages",value:function(e){var t=this;Array.from(this.currentImageContainer.children).forEach((function(i){if("img"===i.tagName.toLowerCase()){var n=t.usingSprites?500:1e3;if(i.dataset.index!==e.dataset.index&&!i.dataset.deleting){i.dataset.deleting=!0;var a=t.currentImageContainer;setTimeout((function(){a.removeChild(i),t.player.debug.log("Removing thumb: ".concat(i.dataset.filename))}),n)}}}))}},{key:"preloadNearby",value:function(e){var t=this,i=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return new Promise((function(n){setTimeout((function(){var a=t.thumbnails[0].frames[e].text;if(t.showingThumbFilename===a){var s;s=i?t.thumbnails[0].frames.slice(e):t.thumbnails[0].frames.slice(0,e).reverse();var r=!1;s.forEach((function(e){var i=e.text;if(i!==a&&!t.loadedImages.includes(i)){r=!0,t.player.debug.log("Preloading thumb filename: ".concat(i));var s=t.thumbnails[0].urlPrefix+i,o=new Image;o.src=s,o.onload=function(){t.player.debug.log("Preloaded thumb filename: ".concat(i)),t.loadedImages.includes(i)||t.loadedImages.push(i),n()}}})),r||n()}}),300)}))}},{key:"getHigherQuality",value:function(e,t,i,n){var a=this;if(e<this.thumbnails.length-1){var s=t.naturalHeight;this.usingSprites&&(s=i.h),s<this.thumbContainerHeight&&setTimeout((function(){a.showingThumbFilename===n&&(a.player.debug.log("Showing higher quality thumb for: ".concat(n)),a.loadImage(e+1))}),300)}}},{key:"toggleThumbContainer",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=this.player.config.classNames.previewThumbnails.thumbContainerShown;this.elements.thumb.container.classList.toggle(i,e),!e&&t&&(this.showingThumb=null,this.showingThumbFilename=null)}},{key:"toggleScrubbingContainer",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.player.config.classNames.previewThumbnails.scrubbingContainerShown;this.elements.scrubbing.container.classList.toggle(t,e),e||(this.showingThumb=null,this.showingThumbFilename=null)}},{key:"determineContainerAutoSizing",value:function(){(this.elements.thumb.imageContainer.clientHeight>20||this.elements.thumb.imageContainer.clientWidth>20)&&(this.sizeSpecifiedInCSS=!0)}},{key:"setThumbContainerSizeAndPos",value:function(){if(this.sizeSpecifiedInCSS){if(this.elements.thumb.imageContainer.clientHeight>20&&this.elements.thumb.imageContainer.clientWidth<20){var e=Math.floor(this.elements.thumb.imageContainer.clientHeight*this.thumbAspectRatio);this.elements.thumb.imageContainer.style.width="".concat(e,"px")}else if(this.elements.thumb.imageContainer.clientHeight<20&&this.elements.thumb.imageContainer.clientWidth>20){var t=Math.floor(this.elements.thumb.imageContainer.clientWidth/this.thumbAspectRatio);this.elements.thumb.imageContainer.style.height="".concat(t,"px")}}else{var i=Math.floor(this.thumbContainerHeight*this.thumbAspectRatio);this.elements.thumb.imageContainer.style.height="".concat(this.thumbContainerHeight,"px"),this.elements.thumb.imageContainer.style.width="".concat(i,"px")}this.setThumbContainerPos()}},{key:"setThumbContainerPos",value:function(){var e=this.player.elements.progress.getBoundingClientRect(),t=this.player.elements.container.getBoundingClientRect(),i=this.elements.thumb.container,n=t.left-e.left+10,a=t.right-e.left-i.clientWidth-10,s=this.mousePosX-e.left-i.clientWidth/2;s<n&&(s=n),s>a&&(s=a),i.style.left="".concat(s,"px")}},{key:"setScrubbingContainerSize",value:function(){var e=Nt(this.thumbAspectRatio,{width:this.player.media.clientWidth,height:this.player.media.clientHeight}),t=e.width,i=e.height;this.elements.scrubbing.container.style.width="".concat(t,"px"),this.elements.scrubbing.container.style.height="".concat(i,"px")}},{key:"setImageSizeAndOffset",value:function(e,t){if(this.usingSprites){var i=this.thumbContainerHeight/t.h;e.style.height="".concat(e.naturalHeight*i,"px"),e.style.width="".concat(e.naturalWidth*i,"px"),e.style.left="-".concat(t.x*i,"px"),e.style.top="-".concat(t.y*i,"px")}}},{key:"enabled",get:function(){return this.player.isHTML5&&this.player.isVideo&&this.player.config.previewThumbnails.enabled}},{key:"currentImageContainer",get:function(){return this.mouseDown?this.elements.scrubbing.container:this.elements.thumb.imageContainer}},{key:"usingSprites",get:function(){return Object.keys(this.thumbnails[0].frames[0]).includes("w")}},{key:"thumbAspectRatio",get:function(){return this.usingSprites?this.thumbnails[0].frames[0].w/this.thumbnails[0].frames[0].h:this.thumbnails[0].width/this.thumbnails[0].height}},{key:"thumbContainerHeight",get:function(){return this.mouseDown?Nt(this.thumbAspectRatio,{width:this.player.media.clientWidth,height:this.player.media.clientHeight}).height:this.sizeSpecifiedInCSS?this.elements.thumb.imageContainer.clientHeight:Math.floor(this.player.media.clientWidth/this.thumbAspectRatio/4)}},{key:"currentImageElement",get:function(){return this.mouseDown?this.currentScrubbingImageElement:this.currentThumbnailImageElement},set:function(e){this.mouseDown?this.currentScrubbingImageElement=e:this.currentThumbnailImageElement=e}}]),t}(),xt={insertElements:function(e,t){var i=this;Y(t)?pe(e,this.media,{src:t}):$(t)&&t.forEach((function(t){pe(e,i.media,t)}))},change:function(e){var t=this;le(e,"sources.length")?(Ve.cancelRequests.call(this),this.destroy.call(this,(function(){t.options.quality=[],me(t.media),t.media=null,G(t.elements.container)&&t.elements.container.removeAttribute("class");var i=e.sources,n=e.type,a=o(i,1)[0],s=a.provider,r=void 0===s?ut.html5:s,l=a.src,c="html5"===r?n:"div",u="html5"===r?{}:{src:l};Object.assign(t,{provider:r,type:n,supported:Ee.check(n,r,t.config.playsinline),media:he(c,u)}),t.elements.container.appendChild(t.media),Q(e.autoplay)&&(t.config.autoplay=e.autoplay),t.isHTML5&&(t.config.crossorigin&&t.media.setAttribute("crossorigin",""),t.config.autoplay&&t.media.setAttribute("autoplay",""),ae(e.poster)||(t.poster=e.poster),t.config.loop.active&&t.media.setAttribute("loop",""),t.config.muted&&t.media.setAttribute("muted",""),t.config.playsinline&&t.media.setAttribute("playsinline","")),yt.addStyleHook.call(t),t.isHTML5&&xt.insertElements.call(t,"source",i),t.config.title=e.title,Pt.setup.call(t),t.isHTML5&&Object.keys(e).includes("tracks")&&xt.insertElements.call(t,"track",e.tracks),(t.isHTML5||t.isEmbed&&!t.supported.ui)&&yt.build.call(t),t.isHTML5&&t.media.load(),ae(e.previewThumbnails)||(Object.assign(t.config.previewThumbnails,e.previewThumbnails),t.previewThumbnails&&t.previewThumbnails.loaded&&(t.previewThumbnails.destroy(),t.previewThumbnails=null),t.config.previewThumbnails.enabled&&(t.previewThumbnails=new Mt(t))),t.fullscreen.update()}),!0)):this.debug.warn("Invalid source format")}};var It,Lt=function(){function t(i,n){var a=this;if(e(this,t),this.timers={},this.ready=!1,this.loading=!1,this.failed=!1,this.touch=Ee.touch,this.media=i,Y(this.media)&&(this.media=document.querySelectorAll(this.media)),(window.jQuery&&this.media instanceof jQuery||J(this.media)||$(this.media))&&(this.media=this.media[0]),this.config=ce({},ot,t.defaults,n||{},function(){try{return JSON.parse(a.media.getAttribute("data-plyr-config"))}catch(e){return{}}}()),this.elements={container:null,fullscreen:null,captions:null,buttons:{},display:{},progress:{},inputs:{},settings:{popup:null,menu:null,panels:{},buttons:{}}},this.captions={active:null,currentTrack:-1,meta:new WeakMap},this.fullscreen={active:!1},this.options={speed:[],quality:[]},this.debug=new mt(this.config.debug),this.debug.log("Config",this.config),this.debug.log("Support",Ee),!W(this.media)&&G(this.media))if(this.media.plyr)this.debug.warn("Target already setup");else if(this.config.enabled)if(Ee.check().api){var s=this.media.cloneNode(!0);s.autoplay=!1,this.elements.original=s;var r=this.media.tagName.toLowerCase(),o=null,l=null;switch(r){case"div":if(o=this.media.querySelector("iframe"),G(o)){if(l=at(o.getAttribute("src")),this.provider=function(e){return/^(https?:\/\/)?(www\.)?(youtube\.com|youtube-nocookie\.com|youtu\.?be)\/.+$/.test(e)?ut.youtube:/^https?:\/\/player.vimeo.com\/video\/\d{0,9}(?=\b|\/)/.test(e)?ut.vimeo:null}(l.toString()),this.elements.container=this.media,this.media=o,this.elements.container.className="",l.search.length){var c=["1","true"];c.includes(l.searchParams.get("autoplay"))&&(this.config.autoplay=!0),c.includes(l.searchParams.get("loop"))&&(this.config.loop.active=!0),this.isYouTube?(this.config.playsinline=c.includes(l.searchParams.get("playsinline")),this.config.youtube.hl=l.searchParams.get("hl")):this.config.playsinline=!0}}else this.provider=this.media.getAttribute(this.config.attributes.embed.provider),this.media.removeAttribute(this.config.attributes.embed.provider);if(ae(this.provider)||!Object.keys(ut).includes(this.provider))return void this.debug.error("Setup failed: Invalid provider");this.type=ht;break;case"video":case"audio":this.type=r,this.provider=ut.html5,this.media.hasAttribute("crossorigin")&&(this.config.crossorigin=!0),this.media.hasAttribute("autoplay")&&(this.config.autoplay=!0),(this.media.hasAttribute("playsinline")||this.media.hasAttribute("webkit-playsinline"))&&(this.config.playsinline=!0),this.media.hasAttribute("muted")&&(this.config.muted=!0),this.media.hasAttribute("loop")&&(this.config.loop.active=!0);break;default:return void this.debug.error("Setup failed: unsupported type")}this.supported=Ee.check(this.type,this.provider,this.config.playsinline),this.supported.api?(this.eventListeners=[],this.listeners=new vt(this),this.storage=new $e(this),this.media.plyr=this,G(this.elements.container)||(this.elements.container=he("div",{tabindex:0}),ue(this.media,this.elements.container)),yt.migrateStyles.call(this),yt.addStyleHook.call(this),Pt.setup.call(this),this.config.debug&&xe.call(this,this.elements.container,this.config.events.join(" "),(function(e){a.debug.log("event: ".concat(e.type))})),this.fullscreen=new ft(this),(this.isHTML5||this.isEmbed&&!this.supported.ui)&&yt.build.call(this),this.listeners.container(),this.listeners.global(),this.config.ads.enabled&&(this.ads=new Et(this)),this.isHTML5&&this.config.autoplay&&setTimeout((function(){return qe(a.play())}),10),this.lastSeekTime=0,this.config.previewThumbnails.enabled&&(this.previewThumbnails=new Mt(this))):this.debug.error("Setup failed: no support")}else this.debug.error("Setup failed: no support");else this.debug.error("Setup failed: disabled by config");else this.debug.error("Setup failed: no suitable element passed")}return i(t,[{key:"play",value:function(){var e=this;return X(this.media.play)?(this.ads&&this.ads.enabled&&this.ads.managerPromise.then((function(){return e.ads.play()})).catch((function(){return qe(e.media.play())})),this.media.play()):null}},{key:"pause",value:function(){return this.playing&&X(this.media.pause)?this.media.pause():null}},{key:"togglePlay",value:function(e){return(Q(e)?e:!this.playing)?this.play():this.pause()}},{key:"stop",value:function(){this.isHTML5?(this.pause(),this.restart()):X(this.media.stop)&&this.media.stop()}},{key:"restart",value:function(){this.currentTime=0}},{key:"rewind",value:function(e){this.currentTime-=K(e)?e:this.config.seekTime}},{key:"forward",value:function(e){this.currentTime+=K(e)?e:this.config.seekTime}},{key:"increaseVolume",value:function(e){var t=this.media.muted?0:this.volume;this.volume=t+(K(e)?e:0)}},{key:"decreaseVolume",value:function(e){this.increaseVolume(-e)}},{key:"toggleCaptions",value:function(e){rt.toggle.call(this,e,!1)}},{key:"airplay",value:function(){Ee.airplay&&this.media.webkitShowPlaybackTargetPicker()}},{key:"toggleControls",value:function(e){if(this.supported.ui&&!this.isAudio){var t=we(this.elements.container,this.config.classNames.hideControls),i=void 0===e?void 0:!e,n=be(this.elements.container,this.config.classNames.hideControls,i);if(n&&$(this.config.controls)&&this.config.controls.includes("settings")&&!ae(this.config.settings)&&nt.toggleMenu.call(this,!1),n!==t){var a=n?"controlshidden":"controlsshown";Oe.call(this,this.media,a)}return!n}return!1}},{key:"on",value:function(e,t){xe.call(this,this.elements.container,e,t)}},{key:"once",value:function(e,t){Le.call(this,this.elements.container,e,t)}},{key:"off",value:function(e,t){Ie(this.elements.container,e,t)}},{key:"destroy",value:function(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this.ready){var n=function(){document.body.style.overflow="",t.embed=null,i?(Object.keys(t.elements).length&&(me(t.elements.buttons.play),me(t.elements.captions),me(t.elements.controls),me(t.elements.wrapper),t.elements.buttons.play=null,t.elements.captions=null,t.elements.controls=null,t.elements.wrapper=null),X(e)&&e()):(_e.call(t),ge(t.elements.original,t.elements.container),Oe.call(t,t.elements.original,"destroyed",!0),X(e)&&e.call(t.elements.original),t.ready=!1,setTimeout((function(){t.elements=null,t.media=null}),200))};this.stop(),clearTimeout(this.timers.loading),clearTimeout(this.timers.controls),clearTimeout(this.timers.resized),this.isHTML5?(yt.toggleNativeControls.call(this,!0),n()):this.isYouTube?(clearInterval(this.timers.buffering),clearInterval(this.timers.playing),null!==this.embed&&X(this.embed.destroy)&&this.embed.destroy(),n()):this.isVimeo&&(null!==this.embed&&this.embed.unload().then(n),setTimeout(n,200))}}},{key:"supports",value:function(e){return Ee.mime.call(this,e)}},{key:"isHTML5",get:function(){return this.provider===ut.html5}},{key:"isEmbed",get:function(){return this.isYouTube||this.isVimeo}},{key:"isYouTube",get:function(){return this.provider===ut.youtube}},{key:"isVimeo",get:function(){return this.provider===ut.vimeo}},{key:"isVideo",get:function(){return this.type===ht}},{key:"isAudio",get:function(){return this.type===dt}},{key:"playing",get:function(){return Boolean(this.ready&&!this.paused&&!this.ended)}},{key:"paused",get:function(){return Boolean(this.media.paused)}},{key:"stopped",get:function(){return Boolean(this.paused&&0===this.currentTime)}},{key:"ended",get:function(){return Boolean(this.media.ended)}},{key:"currentTime",set:function(e){if(this.duration){var t=K(e)&&e>0;this.media.currentTime=t?Math.min(e,this.duration):0,this.debug.log("Seeking to ".concat(this.currentTime," seconds"))}},get:function(){return Number(this.media.currentTime)}},{key:"buffered",get:function(){var e=this.media.buffered;return K(e)?e:e&&e.length&&this.duration>0?e.end(0)/this.duration:0}},{key:"seeking",get:function(){return Boolean(this.media.seeking)}},{key:"duration",get:function(){var e=parseFloat(this.config.duration),t=(this.media||{}).duration,i=K(t)&&t!==1/0?t:0;return e||i}},{key:"volume",set:function(e){var t=e;Y(t)&&(t=Number(t)),K(t)||(t=this.storage.get("volume")),K(t)||(t=this.config.volume),t>1&&(t=1),t<0&&(t=0),this.config.volume=t,this.media.volume=t,!ae(e)&&this.muted&&t>0&&(this.muted=!1)},get:function(){return Number(this.media.volume)}},{key:"muted",set:function(e){var t=e;Q(t)||(t=this.storage.get("muted")),Q(t)||(t=this.config.muted),this.config.muted=t,this.media.muted=t},get:function(){return Boolean(this.media.muted)}},{key:"hasAudio",get:function(){return!this.isHTML5||(!!this.isAudio||(Boolean(this.media.mozHasAudio)||Boolean(this.media.webkitAudioDecodedByteCount)||Boolean(this.media.audioTracks&&this.media.audioTracks.length)))}},{key:"speed",set:function(e){var t=this,i=null;K(e)&&(i=e),K(i)||(i=this.storage.get("speed")),K(i)||(i=this.config.speed.selected);var n=this.minimumSpeed,a=this.maximumSpeed;i=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:255;return Math.min(Math.max(e,t),i)}(i,n,a),this.config.speed.selected=i,setTimeout((function(){t.media.playbackRate=i}),0)},get:function(){return Number(this.media.playbackRate)}},{key:"minimumSpeed",get:function(){return this.isYouTube?Math.min.apply(Math,l(this.options.speed)):this.isVimeo?.5:.0625}},{key:"maximumSpeed",get:function(){return this.isYouTube?Math.max.apply(Math,l(this.options.speed)):this.isVimeo?2:16}},{key:"quality",set:function(e){var t=this.config.quality,i=this.options.quality;if(i.length){var n=[!ae(e)&&Number(e),this.storage.get("quality"),t.selected,t.default].find(K),a=!0;if(!i.includes(n)){var s=function(e,t){return $(e)&&e.length?e.reduce((function(e,i){return Math.abs(i-t)<Math.abs(e-t)?i:e})):null}(i,n);this.debug.warn("Unsupported quality option: ".concat(n,", using ").concat(s," instead")),n=s,a=!1}t.selected=n,this.media.quality=n,a&&this.storage.set({quality:n})}},get:function(){return this.media.quality}},{key:"loop",set:function(e){var t=Q(e)?e:this.config.loop.active;this.config.loop.active=t,this.media.loop=t},get:function(){return Boolean(this.media.loop)}},{key:"source",set:function(e){xt.change.call(this,e)},get:function(){return this.media.currentSrc}},{key:"download",get:function(){var e=this.config.urls.download;return ne(e)?e:this.source},set:function(e){ne(e)&&(this.config.urls.download=e,nt.setDownloadUrl.call(this))}},{key:"poster",set:function(e){this.isVideo?yt.setPoster.call(this,e,!1).catch((function(){})):this.debug.warn("Poster can only be set for video")},get:function(){return this.isVideo?this.media.getAttribute("poster")||this.media.getAttribute("data-poster"):null}},{key:"ratio",get:function(){if(!this.isVideo)return null;var e=He(Fe.call(this));return $(e)?e.join(":"):e},set:function(e){this.isVideo?Y(e)&&De(e)?(this.config.ratio=e,Re.call(this)):this.debug.error("Invalid aspect ratio specified (".concat(e,")")):this.debug.warn("Aspect ratio can only be set for video")}},{key:"autoplay",set:function(e){var t=Q(e)?e:this.config.autoplay;this.config.autoplay=t},get:function(){return Boolean(this.config.autoplay)}},{key:"currentTrack",set:function(e){rt.set.call(this,e,!1)},get:function(){var e=this.captions,t=e.toggled,i=e.currentTrack;return t?i:-1}},{key:"language",set:function(e){rt.setLanguage.call(this,e,!1)},get:function(){return(rt.getCurrentTrack.call(this)||{}).language}},{key:"pip",set:function(e){if(Ee.pip){var t=Q(e)?e:!this.pip;X(this.media.webkitSetPresentationMode)&&this.media.webkitSetPresentationMode(t?lt:ct),X(this.media.requestPictureInPicture)&&(!this.pip&&t?this.media.requestPictureInPicture():this.pip&&!t&&document.exitPictureInPicture())}},get:function(){return Ee.pip?ae(this.media.webkitPresentationMode)?this.media===document.pictureInPictureElement:this.media.webkitPresentationMode===lt:null}}],[{key:"supported",value:function(e,t,i){return Ee.check(e,t,i)}},{key:"loadSprite",value:function(e,t){return Ge(e,t)}},{key:"setup",value:function(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=null;return Y(e)?n=Array.from(document.querySelectorAll(e)):J(e)?n=Array.from(e):$(e)&&(n=e.filter(G)),ae(n)?null:n.map((function(e){return new t(e,i)}))}}]),t}();return Lt.defaults=(It=ot,JSON.parse(JSON.stringify(It))),Lt}));
+//# sourceMappingURL=plyr.min.js.map
diff --git a/youtube/static/modules/plyr/plyr.min.js.map b/youtube/static/modules/plyr/plyr.min.js.map
new file mode 100644
index 0000000..dfc592b
--- /dev/null
+++ b/youtube/static/modules/plyr/plyr.min.js.map
@@ -0,0 +1 @@
+{"version":3,"sources":["plyr.js","node_modules/rangetouch/dist/rangetouch.mjs","src/js/utils/animation.js","src/js/utils/is.js","src/js/utils/browser.js","src/js/utils/objects.js","src/js/utils/elements.js","src/js/support.js","src/js/utils/events.js","src/js/utils/promise.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","ownKeys","object","enumerableOnly","keys","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","push","apply","_objectSpread2","arguments","source","forEach","getOwnPropertyDescriptors","defineProperties","_objectWithoutProperties","excluded","sourceKeys","indexOf","_objectWithoutPropertiesLoose","sourceSymbolKeys","propertyIsEnumerable","call","_slicedToArray","arr","Array","isArray","_arrayWithHoles","Symbol","iterator","_arr","_n","_d","_e","undefined","_s","_i","next","done","err","_iterableToArrayLimit","_unsupportedIterableToArray","_nonIterableRest","_toConsumableArray","_arrayLikeToArray","_arrayWithoutHoles","iter","from","_iterableToArray","_nonIterableSpread","o","minLen","n","toString","slice","constructor","name","test","len","arr2","e","t","r","defaults","addCSS","thumbWidth","watch","matches","document","querySelectorAll","includes","getConstructor","instanceOf","isNullOrUndefined","isObject","isString","String","isNodeList","NodeList","is","Element","Event","round","concat","match","Math","max","getDecimalPlaces","parseFloat","toFixed","element","events","type","RangeTouch","querySelector","rangeTouch","config","init","enabled","style","userSelect","webKitUserSelect","touchAction","listeners","set","changedTouches","getAttribute","s","u","c","getBoundingClientRect","a","width","clientX","left","disabled","preventDefault","get","bubbles","dispatchEvent","trigger","MutationObserver","addedNodes","observe","body","childList","subtree","map","documentElement","input","Boolean","isFunction","Function","isEmpty","is$1","Number","isNaN","KeyboardEvent","TextTrack","kind","Promise","then","window","URL","string","startsWith","hostname","transitionEndEvent","createElement","WebkitTransition","MozTransition","OTransition","transition","find","event","repaint","delay","setTimeout","hidden","offsetHeight","browser","isIE","documentMode","isEdge","userAgent","isWebkit","isIPhone","platform","isIos","getDeep","path","split","reduce","extend","_len","sources","_key","shift","assign","wrap","elements","wrapper","targets","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","selector","trim","className","replace","parts","charAt","class","id","toggleHidden","hide","toggleClass","force","method","classList","contains","hasClass","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","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","touch","transitions","reducedMotion","matchMedia","supportsPassiveListeners","supported","options","addEventListener","removeEventListener","toggleListener","callback","_this","toggle","passive","capture","eventListeners","on","off","once","_this2","onceCallback","args","triggerEvent","detail","CustomEvent","plyr","unbindListeners","item","ready","_this3","resolve","silencePromise","validateRatio","every","reduceAspectRatio","ratio","_ratio","height","divider","getDivider","w","h","getAspectRatio","parse","embed","_this$media","videoWidth","videoHeight","setAspectRatio","isVideo","_ref2","padding","paddingBottom","isVimeo","vimeo","premium","offsetWidth","parseInt","getComputedStyle","offset","transform","videoFixedRatio","html5","getSources","getQualityOptions","quality","forced","setup","player","speed","onChange","_player$media","currentTime","paused","preload","readyState","playbackRate","src","play","load","cancelRequests","blankVideo","debug","log","dedupe","array","format","replaceAll","RegExp","toTitleCase","toUpperCase","substr","toLowerCase","toPascalCase","getHTML","innerHTML","resources","youtube","i18n","{seektime}","seekTime","{title}","title","k","v","Storage","storage","store","localStorage","getItem","json","JSON","setItem","stringify","removeItem","fetch","url","responseType","reject","request","XMLHttpRequest","responseText","response","Error","status","open","send","loadSprite","hasId","exists","getElementById","update","data","insertAdjacentElement","useStorage","cached","content","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","aria-hidden","focusable","use","setAttributeNS","createLabel","attr","join","createBadge","badge","menu","createButton","buttonType","toCamelCase","label","labelPressed","iconPressed","some","control","button","createRange","min","step","autocomplete","role","aria-label","aria-valuemin","aria-valuemax","aria-valuenow","updateRangeFill","createProgress","suffixKey","played","suffix","createTime","attrs","bindMenuItemShortcuts","menuItem","which","stopPropagation","isRadioButton","showMenuPanel","nextElementSibling","firstElementChild","previousElementSibling","lastElementChild","focusFirstMenuItem","createMenuItem","list","_ref$badge","_ref$checked","checked","aria-checked","flex","children","node","bind","currentTrack","forceHours","updateTimeDisplay","updateVolume","setRange","muted","pressed","updateProgress","_this4","current","val","getElementsByTagName","nodeValue","setProgress","buffered","percent","setProperty","updateSeekTooltip","_this5","tooltips","visible","show","clientRect","pageX","timeUpdate","invert","invertTime","seeking","durationUpdate","pow","hasDuration","displayDuration","toggleMenuButton","setting","updateSetting","pane","panels","default","getLabel","setQualityMenu","_this6","checkMenu","getBadge","sort","b","sorting","setCaptionsMenu","_this7","tracks","getTracks","track","toggled","language","unshift","setSpeedMenu","_this8","minimumSpeed","maximumSpeed","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","safe","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","cue","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","referrerPolicy","noCookie","rel","showinfo","iv_load_policy","modestbranding","providers","types","noop","Console","console","Fullscreen","prefix","property","scrollPosition","x","y","forceFallback","closest","el","parentElement","nodeType","trapFocus","scrollX","scrollY","scrollTo","overflow","viewport","head","hasProperty","cleanupViewport","part","keyCode","activeElement","first","last","shiftKey","native","webkitEnterFullscreen","toggleFallback","requestFullscreen","navigationUI","webkitExitFullscreen","action","cancelFullScreen","exit","enter","fullscreenElement","shadowRoot","getRootNode","fullscreenEnabled","webkitFullscreenEnabled","mozFullScreenEnabled","msFullscreenEnabled","pre","loadImage","minWidth","image","Image","handler","onload","onerror","naturalWidth","addStyleHook","build","checkPlaying","setTitle","setPoster","togglePoster","enable","backgroundImage","backgroundSize","toggleControls","checkLoading","clearTimeout","timers","controlsElement","recentTouchSeek","lastSeekTime","Date","now","migrateStyles","getPropertyValue","removeProperty","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","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","pathname","pathStripped","relList","as","onbeforeload","ev","sheet","cssText","defaultPrevented","loadjs","paths","arg1","arg2","loadFn","numWaiting","loadFiles","returnPromise","deps","bundleIds","subscribe","isDefined","loadScript","assurePlaybackState","hasPlayed","Vimeo","frameParams","sidedock","gesture","$2","data-poster","thumbnail_large","Player","disableTextTrack","stop","restorePause","setVolume","setCurrentTime","setPlaybackRate","currentSrc","setLoop","getVideoUrl","getVideoWidth","getVideoHeight","dimensions","_dimensions","setAutopause","state","getVideoTitle","getCurrentTime","getDuration","getTextTracks","_ref$cues","strippedCues","fragment","createDocumentFragment","stripHTML","getPaused","seconds","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","getPlaybackRate","onReady","playVideo","pauseVideo","stopVideo","speeds","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","AdsLoader","AdsManagerLoadedEvent","Type","ADS_MANAGER_LOADED","onAdsManagerLoaded","AdErrorEvent","AD_ERROR","onAdError","requestAds","AdsRequest","adTagUrl","linearAdSlotWidth","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","contentComplete","CONTENT_PAUSE_REQUESTED","pauseContent","CONTENT_RESUME_REQUESTED","resumeContent","LOG","adError","getMessage","cancel","addCuePoints","seekedTime","discardAdBreak","resize","ViewMode","NORMAL","initialize","zIndex","_this12","handlers","_this13","AV_PUBLISHERID","AV_CHANNELID","AV_URL","cb","AV_WIDTH","AV_HEIGHT","AV_CDIM2","fitRatio","outer","PreviewThumbnails","thumbnails","lastMouseMoveTime","mouseDown","loadedImages","thumb","scrubbing","getThumbnails","render","determineContainerAutoSizing","sortAndResolve","promises","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","clientWidth","sizeSpecifiedInCSS","thumbAspectRatio","thumbHeight","setThumbContainerPos","seekbarRect","plyrRect","minVal","maxVal","right","previewPos","_fitRatio","multiplier","top","currentScrubbingImageElement","currentThumbnailImageElement","insertElements","attribute","change","_sources$","_sources$$provider","crossorigin","failed","jQuery","WeakMap","original","getProviderByUrl","search","truthy","searchParams","tabindex","webkitShowPlaybackTargetPicker","isHidden","hiding","eventName","soft","unload","inputIsValid","fauxDuration","realDuration","Infinity","mozHasAudio","webkitAudioDecodedByteCount","audioTracks","clamp","updateStorage","prev","curr","requestPictureInPicture","exitPictureInPicture","webkitPresentationMode","pictureInPictureElement","inline"],"mappings":"AAAqB,iBAAdA,WAA2B,SAAUC,EAAQC,GAC/B,iBAAZC,SAA0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B,OAAOgL,GAAWX,EAAKrK,KtC63PpB,CACDzO,IAAK,QACLO,MAAO,SsCv3PE2N,GAAwB,IAAd8D,EAAc5Q,UAAA3B,OAAA,QAAAmD,IAAAxB,UAAA,GAAAA,UAAA,GAAJ,GAC3B4K,EAAU,KAUd,OARIvG,EAAUyI,GACZlC,EAAU7J,MAAMsB,KAAKqB,SAASC,iBAAiBmJ,IACtCzI,EAAYyI,GACrBlC,EAAU7J,MAAMsB,KAAKyK,GACZzI,EAASyI,KAClBlC,EAAUkC,EAASpN,OAAO2E,IAGxBA,GAASuG,GACJ,KAGFA,EAAQvD,KAAI,SAAAlE,GAAC,OAAI,IAAIxF,EAAKwF,EAAGyN,UtC83P7BjT,EsC1jSLA,GtC+jSJ,OsC/3PFA,GAAK0F,UjC/tCqBhE,GiC+tCAgE,GjC9tCjBgU,KAAKpE,MAAMoE,KAAKE,UAAUlY,ML6lS1B1B","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 ownKeys(object, enumerableOnly) {\n var keys = Object.keys(object);\n\n if (Object.getOwnPropertySymbols) {\n var symbols = Object.getOwnPropertySymbols(object);\n if (enumerableOnly) symbols = symbols.filter(function (sym) {\n return Object.getOwnPropertyDescriptor(object, sym).enumerable;\n });\n keys.push.apply(keys, symbols);\n }\n\n return keys;\n }\n\n function _objectSpread2(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i] != null ? arguments[i] : {};\n\n if (i % 2) {\n ownKeys(Object(source), true).forEach(function (key) {\n _defineProperty(target, key, source[key]);\n });\n } else if (Object.getOwnPropertyDescriptors) {\n Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));\n } else {\n ownKeys(Object(source)).forEach(function (key) {\n Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));\n });\n }\n }\n\n return target;\n }\n\n function _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n\n return target;\n }\n\n function _objectWithoutProperties(source, excluded) {\n if (source == null) return {};\n\n var target = _objectWithoutPropertiesLoose(source, excluded);\n\n var key, i;\n\n if (Object.getOwnPropertySymbols) {\n var sourceSymbolKeys = Object.getOwnPropertySymbols(source);\n\n for (i = 0; i < sourceSymbolKeys.length; i++) {\n key = sourceSymbolKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;\n target[key] = source[key];\n }\n }\n\n return target;\n }\n\n function _slicedToArray(arr, i) {\n return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();\n }\n\n function _toConsumableArray(arr) {\n return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();\n }\n\n function _arrayWithoutHoles(arr) {\n if (Array.isArray(arr)) return _arrayLikeToArray(arr);\n }\n\n function _arrayWithHoles(arr) {\n if (Array.isArray(arr)) return arr;\n }\n\n function _iterableToArray(iter) {\n if (typeof Symbol !== \"undefined\" && Symbol.iterator in Object(iter)) return Array.from(iter);\n }\n\n function _iterableToArrayLimit(arr, i) {\n if (typeof Symbol === \"undefined\" || !(Symbol.iterator in Object(arr))) return;\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 _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return _arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(o);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);\n }\n\n function _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n\n for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];\n\n return arr2;\n }\n\n function _nonIterableSpread() {\n throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n }\n\n function _nonIterableRest() {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n }\n\n function _classCallCheck$1(e, t) {\n if (!(e instanceof t)) throw new TypeError(\"Cannot call a class as a function\");\n }\n\n function _defineProperties$1(e, t) {\n for (var n = 0; n < t.length; n++) {\n var r = t[n];\n r.enumerable = r.enumerable || !1, r.configurable = !0, \"value\" in r && (r.writable = !0), Object.defineProperty(e, r.key, r);\n }\n }\n\n function _createClass$1(e, t, n) {\n return t && _defineProperties$1(e.prototype, t), n && _defineProperties$1(e, n), e;\n }\n\n function _defineProperty$1(e, t, n) {\n return t in e ? Object.defineProperty(e, t, {\n value: n,\n enumerable: !0,\n configurable: !0,\n writable: !0\n }) : e[t] = n, e;\n }\n\n function ownKeys$1(e, t) {\n var n = Object.keys(e);\n\n if (Object.getOwnPropertySymbols) {\n var r = Object.getOwnPropertySymbols(e);\n t && (r = r.filter(function (t) {\n return Object.getOwnPropertyDescriptor(e, t).enumerable;\n })), n.push.apply(n, r);\n }\n\n return n;\n }\n\n function _objectSpread2$1(e) {\n for (var t = 1; t < arguments.length; t++) {\n var n = null != arguments[t] ? arguments[t] : {};\n t % 2 ? ownKeys$1(Object(n), !0).forEach(function (t) {\n _defineProperty$1(e, t, n[t]);\n }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : ownKeys$1(Object(n)).forEach(function (t) {\n Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(n, t));\n });\n }\n\n return e;\n }\n\n var defaults = {\n addCSS: !0,\n thumbWidth: 15,\n watch: !0\n };\n\n function matches(e, t) {\n return function () {\n return Array.from(document.querySelectorAll(t)).includes(this);\n }.call(e, t);\n }\n\n function trigger(e, t) {\n if (e && t) {\n var n = new Event(t, {\n bubbles: !0\n });\n e.dispatchEvent(n);\n }\n }\n\n var getConstructor = function getConstructor(e) {\n return null != e ? e.constructor : null;\n },\n instanceOf = function instanceOf(e, t) {\n return !!(e && t && e instanceof t);\n },\n isNullOrUndefined = function isNullOrUndefined(e) {\n return null == e;\n },\n isObject = function isObject(e) {\n return getConstructor(e) === Object;\n },\n isNumber = function isNumber(e) {\n return getConstructor(e) === Number && !Number.isNaN(e);\n },\n isString = function isString(e) {\n return getConstructor(e) === String;\n },\n isBoolean = function isBoolean(e) {\n return getConstructor(e) === Boolean;\n },\n isFunction = function isFunction(e) {\n return getConstructor(e) === Function;\n },\n isArray = function isArray(e) {\n return Array.isArray(e);\n },\n isNodeList = function isNodeList(e) {\n return instanceOf(e, NodeList);\n },\n isElement = function isElement(e) {\n return instanceOf(e, Element);\n },\n isEvent = function isEvent(e) {\n return instanceOf(e, Event);\n },\n isEmpty = function isEmpty(e) {\n return isNullOrUndefined(e) || (isString(e) || isArray(e) || isNodeList(e)) && !e.length || isObject(e) && !Object.keys(e).length;\n },\n 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 function getDecimalPlaces(e) {\n var t = \"\".concat(e).match(/(?:\\.(\\d+))?(?:[eE]([+-]?\\d+))?$/);\n return t ? Math.max(0, (t[1] ? t[1].length : 0) - (t[2] ? +t[2] : 0)) : 0;\n }\n\n function round(e, t) {\n if (1 > t) {\n var n = getDecimalPlaces(t);\n return parseFloat(e.toFixed(n));\n }\n\n return Math.round(e / t) * t;\n }\n\n var RangeTouch = function () {\n function e(t, n) {\n _classCallCheck$1(this, e), is.element(t) ? this.element = t : is.string(t) && (this.element = document.querySelector(t)), is.element(this.element) && is.empty(this.element.rangeTouch) && (this.config = _objectSpread2$1({}, defaults, {}, n), this.init());\n }\n\n return _createClass$1(e, [{\n key: \"init\",\n value: function value() {\n e.enabled && (this.config.addCSS && (this.element.style.userSelect = \"none\", this.element.style.webKitUserSelect = \"none\", this.element.style.touchAction = \"manipulation\"), this.listeners(!0), this.element.rangeTouch = this);\n }\n }, {\n key: \"destroy\",\n value: function value() {\n e.enabled && (this.config.addCSS && (this.element.style.userSelect = \"\", this.element.style.webKitUserSelect = \"\", this.element.style.touchAction = \"\"), this.listeners(!1), this.element.rangeTouch = null);\n }\n }, {\n key: \"listeners\",\n value: function value(e) {\n var t = this,\n n = e ? \"addEventListener\" : \"removeEventListener\";\n [\"touchstart\", \"touchmove\", \"touchend\"].forEach(function (e) {\n t.element[n](e, function (e) {\n return t.set(e);\n }, !1);\n });\n }\n }, {\n key: \"get\",\n value: function value(t) {\n if (!e.enabled || !is.event(t)) return null;\n var n,\n r = t.target,\n i = t.changedTouches[0],\n o = parseFloat(r.getAttribute(\"min\")) || 0,\n s = parseFloat(r.getAttribute(\"max\")) || 100,\n u = parseFloat(r.getAttribute(\"step\")) || 1,\n c = r.getBoundingClientRect(),\n a = 100 / c.width * (this.config.thumbWidth / 2) / 100;\n return 0 > (n = 100 / c.width * (i.clientX - c.left)) ? n = 0 : 100 < n && (n = 100), 50 > n ? n -= (100 - 2 * n) * a : 50 < n && (n += 2 * (n - 50) * a), o + round(n / 100 * (s - o), u);\n }\n }, {\n key: \"set\",\n value: function value(t) {\n e.enabled && is.event(t) && !t.target.disabled && (t.preventDefault(), t.target.value = this.get(t), trigger(t.target, \"touchend\" === t.type ? \"change\" : \"input\"));\n }\n }], [{\n key: \"setup\",\n value: function value(t) {\n var n = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : {},\n r = null;\n if (is.empty(t) || is.string(t) ? r = Array.from(document.querySelectorAll(is.string(t) ? t : 'input[type=\"range\"]')) : is.element(t) ? r = [t] : is.nodeList(t) ? r = Array.from(t) : is.array(t) && (r = t.filter(is.element)), is.empty(r)) return null;\n\n var i = _objectSpread2$1({}, defaults, {}, n);\n\n if (is.string(t) && i.watch) {\n var o = new MutationObserver(function (n) {\n Array.from(n).forEach(function (n) {\n Array.from(n.addedNodes).forEach(function (n) {\n is.element(n) && matches(n, t) && new e(n, i);\n });\n });\n });\n o.observe(document.body, {\n childList: !0,\n subtree: !0\n });\n }\n\n return r.map(function (t) {\n return new e(t, n);\n });\n }\n }, {\n key: \"enabled\",\n get: function get() {\n return \"ontouchstart\" in document.documentElement;\n }\n }]), e;\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) && isFunction$1(input.then);\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 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 });\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 var _Element = Element,\n prototype = _Element.prototype;\n\n function match() {\n return Array.from(document.querySelectorAll(selector)).includes(this);\n }\n\n var method = prototype.matches || prototype.webkitMatchesSelector || prototype.mozMatchesSelector || prototype.msMatchesSelector || match;\n return method.call(element, selector);\n } // Closest ancestor element matching selector (also tests element itself)\n\n function closest(element, selector) {\n var _Element2 = Element,\n prototype = _Element2.prototype; // https://developer.mozilla.org/en-US/docs/Web/API/Element/closest#Polyfill\n\n function closestElement() {\n var el = this;\n\n do {\n if (matches$1.matches(el, selector)) return el;\n el = el.parentElement || el.parentNode;\n } while (el !== null && el.nodeType === 1);\n\n return null;\n }\n\n var method = prototype.closest || closestElement;\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 } // 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 // 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: _objectSpread2(_objectSpread2({}, 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 /**\n * Silence a Promise-like object.\n * This is useful for avoiding non-harmful, but potentially confusing \"uncaught\n * play promise\" rejection error messages.\n * @param {Object} value An object that may or may not be `Promise`-like.\n */\n\n function silencePromise(value) {\n if (is$1.promise(value)) {\n value.then(null, function () {});\n }\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 wrapper = this.elements.wrapper;\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 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.config.vimeo.premium && this.supported.ui) {\n var height = 100 / this.media.offsetWidth * parseInt(window.getComputedStyle(this.media).paddingBottom, 10);\n var offset = (height - padding) / (height / 50);\n this.media.style.transform = \"translateY(-\".concat(offset, \"%)\");\n } else if (this.isHTML5) {\n 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 // Whether we're forcing all options (e.g. for streaming)\n if (this.config.quality.forced) {\n return this.config.quality.options;\n } // Get sizes from <source> elements\n\n\n return html5.getSources.call(this).map(function (source) {\n return Number(source.getAttribute('data-res'));\n }).filter(Boolean);\n },\n setup: function setup() {\n if (!this.isHTML5) {\n return;\n }\n\n var player = this; // Set speed options from config\n\n player.options.speed = player.config.speed.options; // 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('data-res'));\n },\n set: function set(input) {\n if (player.quality === input) {\n return;\n } // If we're using an an external handler...\n\n\n if (player.config.quality.forced && is$1.function(player.config.quality.onChange)) {\n player.config.quality.onChange(input);\n } else {\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('data-res')) === 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,\n playbackRate = _player$media.playbackRate; // 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.speed = playbackRate;\n player.currentTime = currentTime; // Resume playing\n\n if (!paused) {\n silencePromise(player.play());\n }\n }); // Load new source\n\n player.media.load();\n }\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$1(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 var replaceAll = 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 var toTitleCase = 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 = /*#__PURE__*/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(undefined, 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 'aria-hidden': 'true',\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\n var attributes = _objectSpread2(_objectSpread2({}, attr), {}, {\n class: [attr.class, this.config.classNames.hidden].filter(Boolean).join(' ')\n });\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.call(this, 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.call(this, 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\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 }\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=\"menucaptions\"]');\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() {\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\"]'); // Filter out invalid speeds\n\n this.options.speed = this.options.speed.filter(function (o) {\n return o >= _this8.minimumSpeed && o <= _this8.maximumSpeed;\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 (is$1.array(this.config.controls) && 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(is$1.array(this.config.controls) ? 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 // Ignored on iOS as it's handled globally\n // https://developer.apple.com/library/safari/documentation/AudioVideo/Conceptual/Using_HTML5_Audio_Video/Device-SpecificConsiderations/Device-SpecificConsiderations.html\n\n\n if (control === 'volume' && !browser.isIos) {\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.call(_this10, 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.call(_this10, 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.call(_this10, 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 })); // Menu Captions\n\n pane.appendChild(createElement('div', {\n role: 'menucaptions'\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 }); // Set download attribute for HTML5 only\n\n\n if (_this10.isHTML5) {\n _attributes.download = '';\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 }\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 // Note: mode='hidden' forces a track to download. To ensure every track\n // isn't downloaded at once, only 'showing' tracks should be reassigned\n // eslint-disable-next-line no-param-reassign\n\n if (track.mode === 'showing') {\n // eslint-disable-next-line no-param-reassign\n track.mode = 'hidden';\n } // Add event listener for cue changes\n\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 (is$1.array(this.config.controls) && 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 _this2 = this;\n\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 } // Wait for the call stack to clear before setting mode='hidden'\n // on the active track - forcing the browser to download it\n\n\n setTimeout(function () {\n if (active && _this2.captions.toggled) {\n _this2.captions.currentTrackNode.mode = 'hidden';\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: 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 _this3 = 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 !_this3.isHTML5 || update || _this3.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 _this4 = 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((_this4.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: '/theme/modules/plyr/plyr.svg',\n // Blank video (used to prevent errors on source change)\n blankVideo: '/theme/modules/plyr/blank.webm',\n // Quality default\n quality: {\n default: 576,\n // The options to display in the UI, if available for the source media\n options: [4320, 2880, 2160, 1440, 1080, 720, 576, 480, 360, 240],\n forced: false,\n onChange: null\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 // The options to display in the UI, if available for the source media (e.g. Vimeo and YouTube only support 0.5x-4x)\n options: [0.5, 0.75, 1, 1.25, 1.5, 1.75, 2, 4]\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 // Selector for the fullscreen container so contextual / non-player content can remain visible in fullscreen mode\n // Non-ancestors of the player element will be ignored\n // container: null, // defaults to the player element\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 pip: 'PIP',\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 // Whether the owner of the video has a Pro or Business account\n // (which allows us to properly hide controls without CSS hacks, etc)\n premium: false,\n // Custom settings from Plyr\n referrerPolicy: null // https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement/referrerPolicy\n\n },\n // YouTube plugin\n youtube: {\n noCookie: true,\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 = /*#__PURE__*/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 var Fullscreen = /*#__PURE__*/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'; // Get the fullscreen element\n // Checks container is an ancestor, defaults to null\n\n this.player.elements.fullscreen = player.config.fullscreen.container && closest(this.player.elements.container, player.config.fullscreen.container); // 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 _this.onChange();\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 }); // Tap focus when in fullscreen\n\n on.call(this, this.player.elements.container, 'keydown', function (event) {\n return _this.trapFocus(event);\n }); // Update the UI\n\n this.update();\n } // Determine if native supported\n\n\n _createClass(Fullscreen, [{\n key: \"onChange\",\n value: 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);\n }\n }, {\n key: \"toggleFallback\",\n value: 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 this.onChange();\n } // Trap focus inside container\n\n }, {\n key: \"trapFocus\",\n value: function trapFocus(event) {\n // Bail if iOS, not active, not the tab key\n if (browser.isIos || !this.active || event.key !== 'Tab' || event.keyCode !== 9) {\n return;\n } // Get the current focused element\n\n\n var focused = document.activeElement;\n var focusable = getElements.call(this.player, 'a[href], button:not(:disabled), input:not(:disabled), [tabindex]');\n\n var _focusable = _slicedToArray(focusable, 1),\n first = _focusable[0];\n\n var last = focusable[focusable.length - 1];\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 } // Update UI\n\n }, {\n key: \"update\",\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 this.toggleFallback(true);\n } else if (!this.prefix) {\n this.target.requestFullscreen({\n navigationUI: 'hide'\n });\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 silencePromise(this.player.play());\n } else if (!Fullscreen.native || this.forceFallback) {\n this.toggleFallback(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 && element.shadowRoot ? element === this.target.getRootNode().host : 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.fullscreen || 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 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('data-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 target.setAttribute('aria-label', i18n.get(_this3.playing ? 'pause' : 'play', _this3.config));\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 // Migrate any custom properties from the media to the parent\n migrateStyles: function migrateStyles() {\n var _this5 = this;\n\n // Loop through values (as they are the keys when the object is spread 🤔)\n Object.values(_objectSpread2({}, this.media.style)) // We're only fussed about Plyr specific properties\n .filter(function (key) {\n return !is$1.empty(key) && key.startsWith('--plyr');\n }).forEach(function (key) {\n // Set on the container\n _this5.elements.container.style.setProperty(key, _this5.media.style.getPropertyValue(key)); // Clean up from media element\n\n\n _this5.media.style.removeProperty(key);\n }); // Remove attribute if empty\n\n if (is$1.empty(this.media.style)) {\n this.media.removeAttribute('style');\n }\n }\n };\n\n var Listeners = /*#__PURE__*/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 silencePromise(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 } // 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 if (event.type !== 'focusout') {\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 }\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 focusout', 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 || player.config.vimeo.premium) {\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 browser fullscreen API, 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 }); // 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(); // Call pause otherwise IE11 will start playing the video again\n\n player.pause();\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, function () {\n silencePromise(player.play());\n }, 'play');\n } else {\n _this.proxy(event, function () {\n silencePromise(player.togglePlay());\n }, '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 !== false && 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', function () {\n silencePromise(player.togglePlay());\n }, '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 event.preventDefault();\n\n controls.toggleMenu.call(player, event);\n }, null, false); // Can't be passive as we're preventing default\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 silencePromise(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 touchend 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 }); // Also update controls.hover state for any non-player children of fullscreen element (as above)\n\n if (elements.fullscreen) {\n Array.from(elements.fullscreen.children).filter(function (c) {\n return !c.contains(elements.container);\n }).forEach(function (child) {\n _this3.bind(child, 'mouseenter mouseleave', function (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\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 pathname = path.replace(/[\\?|#].*$/, ''),\n pathStripped = path.replace(/^(css|img)!/, ''),\n isLegacyIECss,\n e;\n numTries = numTries || 0;\n\n if (/(^css!|\\.css$)/.test(pathname)) {\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|webp)$)/.test(pathname)) {\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 player = this; // Add embed class for responsive\n\n toggleClass(player.elements.wrapper, player.config.classNames.embed, true); // Set speed options from config\n\n player.options.speed = player.config.speed.options; // Set intial ratio\n\n setAspectRatio.call(player); // Load the SDK if not already\n\n if (!is$1.object(window.Vimeo)) {\n loadScript(player.config.urls.vimeo.sdk).then(function () {\n vimeo.ready.call(player);\n }).catch(function (error) {\n player.debug.warn('Vimeo SDK (player.js) failed to load', error);\n });\n } else {\n vimeo.ready.call(player);\n }\n },\n // API Ready\n ready: function ready() {\n var _this = this;\n\n var player = this;\n var config = player.config.vimeo;\n\n var premium = config.premium,\n referrerPolicy = config.referrerPolicy,\n frameParams = _objectWithoutProperties(config, [\"premium\", \"referrerPolicy\"]); // If the owner has a pro or premium account then we can hide controls etc\n\n\n if (premium) {\n Object.assign(frameParams, {\n controls: false,\n sidedock: false\n });\n } // Get Vimeo params for the iframe\n\n\n var params = buildUrlParams(_objectSpread2({\n loop: player.config.loop.active,\n autoplay: player.autoplay,\n muted: player.muted,\n gesture: 'media',\n playsinline: !this.config.fullscreen.iosNative\n }, frameParams)); // 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('allow', 'autoplay,fullscreen,picture-in-picture'); // Set the referrer policy if required\n\n if (!is$1.empty(referrerPolicy)) {\n iframe.setAttribute('referrerPolicy', referrerPolicy);\n } // Inject the package\n\n\n var poster = player.poster;\n\n if (premium) {\n iframe.setAttribute('data-poster', poster);\n player.media = replaceElement(iframe, player.media);\n } else {\n var wrapper = createElement('div', {\n class: player.config.classNames.embedContainer,\n 'data-poster': poster\n });\n wrapper.appendChild(iframe);\n player.media = replaceElement(wrapper, player.media);\n } // Get poster image\n\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 () {\n // Cannot set Playback Rate, Video is probably not on Pro account\n player.options.speed = [1];\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 _this.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(_this);\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(_this);\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('bufferstart', function () {\n triggerEvent.call(player, player.media, 'waiting');\n });\n player.embed.on('bufferend', function () {\n triggerEvent.call(player, player.media, 'playing');\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 'data-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 var speeds = instance.getAvailablePlaybackRates(); // Filter based on config\n\n player.options.speed = speeds.filter(function (s) {\n return player.config.speed.options.includes(s);\n }); // 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 case 3:\n // Trigger waiting event to add loading classes to container as the video buffers.\n triggerEvent.call(player, player.media, 'waiting');\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); // Poster image 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.setup.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 = /*#__PURE__*/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 var _this4 = this;\n\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); // Create ads loader\n\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 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 container = this.player.elements.container;\n\n try {\n // Request video ads\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 if (this.player.ended) {\n this.loadAds();\n } else {\n // The SDK won't allow new ads to be called without receiving a contentComplete()\n this.loader.contentComplete();\n }\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 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 }\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 silencePromise(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 that the manager has been destroyed set it to also be un-initialized\n\n _this11.initialized = false; // 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: config.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 fitRatio = function fitRatio(ratio, outer) {\n var targetRatio = outer.width / outer.height;\n var result = {};\n\n if (ratio > targetRatio) {\n result.width = outer.width;\n result.height = 1 / ratio * outer.width;\n } else {\n result.height = outer.height;\n result.width = ratio * outer.height;\n }\n\n return result;\n };\n\n var PreviewThumbnails = /*#__PURE__*/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 // Toggle the 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 } // Resolve promise\n\n\n var sortAndResolve = function sortAndResolve() {\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 }; // Via callback()\n\n\n if (is$1.function(src)) {\n src(function (thumbnails) {\n _this2.thumbnails = thumbnails;\n sortAndResolve();\n });\n } // VTT urls\n else {\n // If string, convert into single-element list\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 }); // Resolve\n\n Promise.all(promises).then(sortAndResolve);\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 does not exist or is false)\n if (is$1.nullOrUndefined(event.button) || 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: \"destroy\",\n value: function destroy() {\n if (this.elements.thumb.container) {\n this.elements.thumb.container.remove();\n }\n\n if (this.elements.scrubbing.container) {\n this.elements.scrubbing.container.remove();\n }\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 || this.elements.thumb.imageContainer.clientWidth > 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 } else if (this.elements.thumb.imageContainer.clientHeight > 20 && this.elements.thumb.imageContainer.clientWidth < 20) {\n var _thumbWidth = Math.floor(this.elements.thumb.imageContainer.clientHeight * this.thumbAspectRatio);\n\n this.elements.thumb.imageContainer.style.width = \"\".concat(_thumbWidth, \"px\");\n } else if (this.elements.thumb.imageContainer.clientHeight < 20 && this.elements.thumb.imageContainer.clientWidth > 20) {\n var thumbHeight = Math.floor(this.elements.thumb.imageContainer.clientWidth / this.thumbAspectRatio);\n this.elements.thumb.imageContainer.style.height = \"\".concat(thumbHeight, \"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 var _fitRatio = fitRatio(this.thumbAspectRatio, {\n width: this.player.media.clientWidth,\n height: this.player.media.clientHeight\n }),\n width = _fitRatio.width,\n height = _fitRatio.height;\n\n this.elements.scrubbing.container.style.width = \"\".concat(width, \"px\");\n this.elements.scrubbing.container.style.height = \"\".concat(height, \"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(previewImage.naturalHeight * multiplier, \"px\"); // eslint-disable-next-line no-param-reassign\n\n previewImage.style.width = \"\".concat(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 var _fitRatio2 = fitRatio(this.thumbAspectRatio, {\n width: this.player.media.clientWidth,\n height: this.player.media.clientHeight\n }),\n height = _fitRatio2.height;\n\n return height;\n } // If css is used this needs to return the css height for sprites to work (see setImageSizeAndOffset)\n\n\n if (this.sizeSpecifiedInCSS) {\n return this.elements.thumb.imageContainer.clientHeight;\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 } // Update previewThumbnails config & reload plugin\n\n\n if (!is$1.empty(input.previewThumbnails)) {\n Object.assign(_this2.config.previewThumbnails, input.previewThumbnails); // Cleanup previewThumbnails plugin if it was loaded\n\n if (_this2.previewThumbnails && _this2.previewThumbnails.loaded) {\n _this2.previewThumbnails.destroy();\n\n _this2.previewThumbnails = null;\n } // Create new instance if it is still enabled\n\n\n if (_this2.config.previewThumbnails.enabled) {\n _this2.previewThumbnails = new PreviewThumbnails(_this2);\n }\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 = /*#__PURE__*/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 fullscreen: 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 } // Migrate custom properties from media to container (so they work 😉)\n\n\n ui.migrateStyles.call(this); // Add style hook\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 fullscreen\n\n\n this.fullscreen = new Fullscreen(this); // Setup interface\n // If embed but not fully supported, build interface now to avoid flash of controls\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 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 silencePromise(_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 silencePromise(_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 null;\n }\n\n return 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 return this.play();\n }\n\n return this.pause();\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 -= 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 += 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 && is$1.array(this.config.controls) && 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$1(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') || this.media.getAttribute('data-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","function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError(\"Cannot call a class as a function\")}function _defineProperties(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,\"value\"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function _createClass(e,t,n){return t&&_defineProperties(e.prototype,t),n&&_defineProperties(e,n),e}function _defineProperty(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ownKeys(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function _objectSpread2(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(n),!0).forEach((function(t){_defineProperty(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ownKeys(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var defaults={addCSS:!0,thumbWidth:15,watch:!0};function matches(e,t){return function(){return Array.from(document.querySelectorAll(t)).includes(this)}.call(e,t)}function trigger(e,t){if(e&&t){var n=new Event(t,{bubbles:!0});e.dispatchEvent(n)}}var getConstructor=function(e){return null!=e?e.constructor:null},instanceOf=function(e,t){return!!(e&&t&&e instanceof t)},isNullOrUndefined=function(e){return null==e},isObject=function(e){return getConstructor(e)===Object},isNumber=function(e){return getConstructor(e)===Number&&!Number.isNaN(e)},isString=function(e){return getConstructor(e)===String},isBoolean=function(e){return getConstructor(e)===Boolean},isFunction=function(e){return getConstructor(e)===Function},isArray=function(e){return Array.isArray(e)},isNodeList=function(e){return instanceOf(e,NodeList)},isElement=function(e){return instanceOf(e,Element)},isEvent=function(e){return instanceOf(e,Event)},isEmpty=function(e){return isNullOrUndefined(e)||(isString(e)||isArray(e)||isNodeList(e))&&!e.length||isObject(e)&&!Object.keys(e).length},is={nullOrUndefined:isNullOrUndefined,object:isObject,number:isNumber,string:isString,boolean:isBoolean,function:isFunction,array:isArray,nodeList:isNodeList,element:isElement,event:isEvent,empty:isEmpty};function getDecimalPlaces(e){var t=\"\".concat(e).match(/(?:\\.(\\d+))?(?:[eE]([+-]?\\d+))?$/);return t?Math.max(0,(t[1]?t[1].length:0)-(t[2]?+t[2]:0)):0}function round(e,t){if(1>t){var n=getDecimalPlaces(t);return parseFloat(e.toFixed(n))}return Math.round(e/t)*t}var RangeTouch=function(){function e(t,n){_classCallCheck(this,e),is.element(t)?this.element=t:is.string(t)&&(this.element=document.querySelector(t)),is.element(this.element)&&is.empty(this.element.rangeTouch)&&(this.config=_objectSpread2({},defaults,{},n),this.init())}return _createClass(e,[{key:\"init\",value:function(){e.enabled&&(this.config.addCSS&&(this.element.style.userSelect=\"none\",this.element.style.webKitUserSelect=\"none\",this.element.style.touchAction=\"manipulation\"),this.listeners(!0),this.element.rangeTouch=this)}},{key:\"destroy\",value:function(){e.enabled&&(this.config.addCSS&&(this.element.style.userSelect=\"\",this.element.style.webKitUserSelect=\"\",this.element.style.touchAction=\"\"),this.listeners(!1),this.element.rangeTouch=null)}},{key:\"listeners\",value:function(e){var t=this,n=e?\"addEventListener\":\"removeEventListener\";[\"touchstart\",\"touchmove\",\"touchend\"].forEach((function(e){t.element[n](e,(function(e){return t.set(e)}),!1)}))}},{key:\"get\",value:function(t){if(!e.enabled||!is.event(t))return null;var n,r=t.target,i=t.changedTouches[0],o=parseFloat(r.getAttribute(\"min\"))||0,s=parseFloat(r.getAttribute(\"max\"))||100,u=parseFloat(r.getAttribute(\"step\"))||1,c=r.getBoundingClientRect(),a=100/c.width*(this.config.thumbWidth/2)/100;return 0>(n=100/c.width*(i.clientX-c.left))?n=0:100<n&&(n=100),50>n?n-=(100-2*n)*a:50<n&&(n+=2*(n-50)*a),o+round(n/100*(s-o),u)}},{key:\"set\",value:function(t){e.enabled&&is.event(t)&&!t.target.disabled&&(t.preventDefault(),t.target.value=this.get(t),trigger(t.target,\"touchend\"===t.type?\"change\":\"input\"))}}],[{key:\"setup\",value:function(t){var n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},r=null;if(is.empty(t)||is.string(t)?r=Array.from(document.querySelectorAll(is.string(t)?t:'input[type=\"range\"]')):is.element(t)?r=[t]:is.nodeList(t)?r=Array.from(t):is.array(t)&&(r=t.filter(is.element)),is.empty(r))return null;var i=_objectSpread2({},defaults,{},n);if(is.string(t)&&i.watch){var o=new MutationObserver((function(n){Array.from(n).forEach((function(n){Array.from(n.addedNodes).forEach((function(n){is.element(n)&&matches(n,t)&&new e(n,i)}))}))}));o.observe(document.body,{childList:!0,subtree:!0})}return r.map((function(t){return new e(t,n)}))}},{key:\"enabled\",get:function(){return\"ontouchstart\"in document.documentElement}}]),e}();export default RangeTouch;","// ==========================================================================\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// 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) && isFunction(input.then);\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// 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 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// Closest ancestor element matching selector (also tests element itself)\nexport function closest(element, selector) {\n const { prototype } = Element;\n\n // https://developer.mozilla.org/en-US/docs/Web/API/Element/closest#Polyfill\n function closestElement() {\n let el = this;\n\n do {\n if (matches.matches(el, selector)) return el;\n el = el.parentElement || el.parentNode;\n } while (el !== null && el.nodeType === 1);\n return null;\n }\n\n const method = prototype.closest || closestElement;\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// 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// 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: { ...detail, plyr: this },\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","import is from './is';\n/**\n * Silence a Promise-like object.\n * This is useful for avoiding non-harmful, but potentially confusing \"uncaught\n * play promise\" rejection error messages.\n * @param {Object} value An object that may or may not be `Promise`-like.\n */\nexport function silencePromise(value) {\n if (is.promise(value)) {\n value.then(null, () => {});\n }\n}\n\nexport default { silencePromise };\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 { wrapper } = this.elements;\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 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.config.vimeo.premium && this.supported.ui) {\n const height = (100 / this.media.offsetWidth) * parseInt(window.getComputedStyle(this.media).paddingBottom, 10);\n const offset = (height - padding) / (height / 50);\n\n this.media.style.transform = `translateY(-${offset}%)`;\n } else if (this.isHTML5) {\n 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 { silencePromise } from './utils/promise';\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 // Whether we're forcing all options (e.g. for streaming)\n if (this.config.quality.forced) {\n return this.config.quality.options;\n }\n\n // Get sizes from <source> elements\n return html5.getSources\n .call(this)\n .map(source => Number(source.getAttribute('data-res')))\n .filter(Boolean);\n },\n\n setup() {\n if (!this.isHTML5) {\n return;\n }\n\n const player = this;\n\n // Set speed options from config\n player.options.speed = player.config.speed.options;\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('data-res'));\n },\n set(input) {\n if (player.quality === input) {\n return;\n }\n\n // If we're using an an external handler...\n if (player.config.quality.forced && is.function(player.config.quality.onChange)) {\n player.config.quality.onChange(input);\n } else {\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('data-res')) === input);\n\n // No matching source found\n if (!source) {\n return;\n }\n\n // Get current state\n const { currentTime, paused, preload, readyState, playbackRate } = 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.speed = playbackRate;\n player.currentTime = currentTime;\n\n // Resume playing\n if (!paused) {\n silencePromise(player.play());\n }\n });\n\n // Load new source\n player.media.load();\n }\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 const replaceAll = (input = '', find = '', replace = '') =>\n input.replace(new RegExp(find.toString().replace(/([.*+?^=!:${}()|[\\]/\\\\])/g, '\\\\$1'), 'g'), replace.toString());\n\n// Convert to title case\nexport const toTitleCase = (input = '') =>\n input.toString().replace(/\\w\\S*/g, text => text.charAt(0).toUpperCase() + text.substr(1).toLowerCase());\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(undefined, 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(`.${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);\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 'aria-hidden': 'true',\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 const attributes = { ...attr, class: [attr.class, this.config.classNames.hidden].filter(Boolean).join(' ') };\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.call(\n this,\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.call(this, 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=\"menucaptions\"]');\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() {\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 // Filter out invalid speeds\n this.options.speed = this.options.speed.filter(o => o >= this.minimumSpeed && o <= this.maximumSpeed);\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 (is.array(this.config.controls) && 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(is.array(this.config.controls) ? 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 // Ignored on iOS as it's handled globally\n // https://developer.apple.com/library/safari/documentation/AudioVideo/Conceptual/Using_HTML5_Audio_Video/Device-SpecificConsiderations/Device-SpecificConsiderations.html\n if (control === 'volume' && !browser.isIos) {\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.call(this, 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.call(\n this,\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.call(this, 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 // Menu Captions\n pane.appendChild(\n createElement('div', {\n role: 'menucaptions',\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 // Set download attribute for HTML5 only\n if (this.isHTML5) {\n attributes.download = '';\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 }\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\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 // Note: mode='hidden' forces a track to download. To ensure every track\n // isn't downloaded at once, only 'showing' tracks should be reassigned\n // eslint-disable-next-line no-param-reassign\n if (track.mode === 'showing') {\n // eslint-disable-next-line no-param-reassign\n track.mode = 'hidden';\n }\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 (\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\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 // Wait for the call stack to clear before setting mode='hidden'\n // on the active track - forcing the browser to download it\n setTimeout(() => {\n if (active && this.captions.toggled) {\n this.captions.currentTrackNode.mode = 'hidden';\n }\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: '/theme/modules/plyr/plyr.svg',\n\n // Blank video (used to prevent errors on source change)\n blankVideo: '/theme/modules/plyr/blank.webm',\n\n // Quality default\n quality: {\n default: 576,\n // The options to display in the UI, if available for the source media\n options: [4320, 2880, 2160, 1440, 1080, 720, 576, 480, 360, 240],\n forced: false,\n onChange: null,\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 // The options to display in the UI, if available for the source media (e.g. Vimeo and YouTube only support 0.5x-4x)\n options: [0.5, 0.75, 1, 1.25, 1.5, 1.75, 2, 4],\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 // Selector for the fullscreen container so contextual / non-player content can remain visible in fullscreen mode\n // Non-ancestors of the player element will be ignored\n // container: null, // defaults to the player element\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 pip: 'PIP',\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 // Whether the owner of the video has a Pro or Business account\n // (which allows us to properly hide controls without CSS hacks, etc)\n premium: false,\n // Custom settings from Plyr\n referrerPolicy: null, // https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement/referrerPolicy\n },\n\n // YouTube plugin\n youtube: {\n noCookie: true, // 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 { closest,getElements, hasClass, toggleClass } from './utils/elements';\nimport { on, triggerEvent } from './utils/events';\nimport is from './utils/is';\nimport { silencePromise } from './utils/promise';\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 // Get the fullscreen element\n // Checks container is an ancestor, defaults to null\n this.player.elements.fullscreen =\n player.config.fullscreen.container && closest(this.player.elements.container, player.config.fullscreen.container);\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 this.onChange();\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 // Tap focus when in fullscreen\n on.call(this, this.player.elements.container, 'keydown', event => this.trapFocus(event));\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 && element.shadowRoot ? element === this.target.getRootNode().host : 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.fullscreen || this.player.elements.container;\n }\n\n 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\n 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 this.onChange();\n }\n\n // Trap focus inside container\n trapFocus(event) {\n // Bail if iOS, not active, not the tab key\n if (browser.isIos || !this.active || event.key !== 'Tab' || event.keyCode !== 9) {\n return;\n }\n\n // Get the current focused element\n const focused = document.activeElement;\n const focusable = getElements.call(this.player, 'a[href], button:not(:disabled), input:not(:disabled), [tabindex]');\n const [first] = focusable;\n const last = focusable[focusable.length - 1];\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 // 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 this.toggleFallback(true);\n } else if (!this.prefix) {\n this.target.requestFullscreen({ navigationUI: 'hide' });\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 silencePromise(this.player.play());\n } else if (!Fullscreen.native || this.forceFallback) {\n this.toggleFallback(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('data-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\n ui.togglePoster.call(this, true);\n\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 target.setAttribute('aria-label', i18n.get(this.playing ? 'pause' : 'play', this.config));\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 || this.loading || this.paused || controlsElement.pressed || controlsElement.hover || recentTouchSeek,\n ),\n );\n }\n },\n\n // Migrate any custom properties from the media to the parent\n migrateStyles() {\n // Loop through values (as they are the keys when the object is spread 🤔)\n Object.values({ ...this.media.style })\n // We're only fussed about Plyr specific properties\n .filter(key => !is.empty(key) && key.startsWith('--plyr'))\n .forEach(key => {\n // Set on the container\n this.elements.container.style.setProperty(key, this.media.style.getPropertyValue(key));\n\n // Clean up from media element\n this.media.style.removeProperty(key);\n });\n\n // Remove attribute if empty\n if (is.empty(this.media.style)) {\n this.media.removeAttribute('style');\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 } from './utils/elements';\nimport { off, on, once, toggleListener, triggerEvent } from './utils/events';\nimport is from './utils/is';\nimport { silencePromise } from './utils/promise';\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 silencePromise(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 if (event.type !== 'focusout') {\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\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 focusout', 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 || player.config.vimeo.premium) {\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 browser fullscreen API, 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 // 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 // Call pause otherwise IE11 will start playing the video again\n player.pause();\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(\n event,\n () => {\n silencePromise(player.play());\n },\n 'play',\n );\n } else {\n this.proxy(\n event,\n () => {\n silencePromise(player.togglePlay());\n },\n 'play',\n );\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 !== false && 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(\n button,\n 'click',\n () => {\n silencePromise(player.togglePlay());\n },\n 'play',\n );\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(\n elements.buttons.settings,\n 'click',\n event => {\n // Prevent the document click listener closing the menu\n event.stopPropagation();\n event.preventDefault();\n\n controls.toggleMenu.call(player, event);\n },\n null,\n false,\n ); // Can't be passive as we're preventing default\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 silencePromise(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 touchend 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 // Also update controls.hover state for any non-player children of fullscreen element (as above)\n if (elements.fullscreen) {\n Array.from(elements.fullscreen.children)\n .filter(c => !c.contains(elements.container))\n .forEach(child => {\n this.bind(child, 'mouseenter mouseleave', event => {\n elements.controls.hover = !player.touch && event.type === 'mouseenter';\n });\n });\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 pathname = path.replace(/[\\?|#].*$/, ''),\n pathStripped = path.replace(/^(css|img)!/, ''),\n isLegacyIECss,\n e;\n\n numTries = numTries || 0;\n\n if (/(^css!|\\.css$)/.test(pathname)) {\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|webp)$)/.test(pathname)) {\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 { 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 const player = this;\n\n // Add embed class for responsive\n toggleClass(player.elements.wrapper, player.config.classNames.embed, true);\n\n // Set speed options from config\n player.options.speed = player.config.speed.options;\n\n // Set intial ratio\n setAspectRatio.call(player);\n\n // Load the SDK if not already\n if (!is.object(window.Vimeo)) {\n loadScript(player.config.urls.vimeo.sdk)\n .then(() => {\n vimeo.ready.call(player);\n })\n .catch(error => {\n player.debug.warn('Vimeo SDK (player.js) failed to load', error);\n });\n } else {\n vimeo.ready.call(player);\n }\n },\n\n // API Ready\n ready() {\n const player = this;\n const config = player.config.vimeo;\n const { premium, referrerPolicy, ...frameParams } = config;\n\n // If the owner has a pro or premium account then we can hide controls etc\n if (premium) {\n Object.assign(frameParams, {\n controls: false,\n sidedock: false,\n });\n }\n\n // Get Vimeo params for the iframe\n const params = buildUrlParams({\n loop: player.config.loop.active,\n autoplay: player.autoplay,\n muted: player.muted,\n gesture: 'media',\n playsinline: !this.config.fullscreen.iosNative,\n ...frameParams,\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('allow', 'autoplay,fullscreen,picture-in-picture');\n\n // Set the referrer policy if required\n if (!is.empty(referrerPolicy)) {\n iframe.setAttribute('referrerPolicy', referrerPolicy);\n }\n\n // Inject the package\n const { poster } = player;\n if (premium) {\n iframe.setAttribute('data-poster', poster);\n player.media = replaceElement(iframe, player.media);\n } else {\n const wrapper = createElement('div', { class: player.config.classNames.embedContainer, 'data-poster': poster });\n wrapper.appendChild(iframe);\n player.media = replaceElement(wrapper, player.media);\n }\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(() => {\n // Cannot set Playback Rate, Video is probably not on Pro account\n player.options.speed = [1];\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('bufferstart', () => {\n triggerEvent.call(player, player.media, 'waiting');\n });\n\n player.embed.on('bufferend', () => {\n triggerEvent.call(player, player.media, 'playing');\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, 'data-poster': 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 const speeds = instance.getAvailablePlaybackRates();\n // Filter based on config\n player.options.speed = speeds.filter(s => player.config.speed.options.includes(s));\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 case 3:\n // Trigger waiting event to add loading classes to container as the video buffers.\n triggerEvent.call(player, player.media, 'waiting');\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 // Poster image 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.setup.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 { silencePromise } from '../utils/promise';\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: config.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 // 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 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 // 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 if (this.player.ended) {\n this.loadAds();\n } else {\n // The SDK won't allow new ads to be called without receiving a contentComplete()\n this.loader.contentComplete();\n }\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 silencePromise(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 // Now that the manager has been destroyed set it to also be un-initialized\n this.initialized = false;\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\nconst fitRatio = (ratio, outer) => {\n const targetRatio = outer.width / outer.height;\n const result = {};\n if (ratio > targetRatio) {\n result.width = outer.width;\n result.height = (1 / ratio) * outer.width;\n } else {\n result.height = outer.height;\n result.width = ratio * outer.height;\n }\n\n return result;\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 // Toggle the 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 // Resolve promise\n const sortAndResolve = () => {\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 // Via callback()\n if (is.function(src)) {\n src(thumbnails => {\n this.thumbnails = thumbnails;\n sortAndResolve();\n });\n }\n // VTT urls\n else {\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 // Resolve\n Promise.all(promises).then(sortAndResolve);\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 does not exist or is false)\n if (is.nullOrUndefined(event.button) || 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 destroy() {\n if (this.elements.thumb.container) {\n this.elements.thumb.container.remove();\n }\n if (this.elements.scrubbing.container) {\n this.elements.scrubbing.container.remove();\n }\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 = () => 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)) 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 const { height } = fitRatio(this.thumbAspectRatio, {\n width: this.player.media.clientWidth,\n height: this.player.media.clientHeight,\n });\n return height;\n }\n\n // If css is used this needs to return the css height for sprites to work (see setImageSizeAndOffset)\n if (this.sizeSpecifiedInCSS) {\n return this.elements.thumb.imageContainer.clientHeight;\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 || this.elements.thumb.imageContainer.clientWidth > 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 } else if (\n this.elements.thumb.imageContainer.clientHeight > 20 &&\n this.elements.thumb.imageContainer.clientWidth < 20\n ) {\n const thumbWidth = Math.floor(this.elements.thumb.imageContainer.clientHeight * this.thumbAspectRatio);\n this.elements.thumb.imageContainer.style.width = `${thumbWidth}px`;\n } else if (\n this.elements.thumb.imageContainer.clientHeight < 20 &&\n this.elements.thumb.imageContainer.clientWidth > 20\n ) {\n const thumbHeight = Math.floor(this.elements.thumb.imageContainer.clientWidth / this.thumbAspectRatio);\n this.elements.thumb.imageContainer.style.height = `${thumbHeight}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 const { width, height } = fitRatio(this.thumbAspectRatio, {\n width: this.player.media.clientWidth,\n height: this.player.media.clientHeight,\n });\n this.elements.scrubbing.container.style.width = `${width}px`;\n this.elements.scrubbing.container.style.height = `${height}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 = `${previewImage.naturalHeight * multiplier}px`;\n // eslint-disable-next-line no-param-reassign\n previewImage.style.width = `${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 PreviewThumbnails from './plugins/preview-thumbnails';\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 // Update previewThumbnails config & reload plugin\n if (!is.empty(input.previewThumbnails)) {\n Object.assign(this.config.previewThumbnails, input.previewThumbnails);\n\n // Cleanup previewThumbnails plugin if it was loaded\n if (this.previewThumbnails && this.previewThumbnails.loaded) {\n this.previewThumbnails.destroy();\n this.previewThumbnails = null;\n }\n\n // Create new instance if it is still enabled\n if (this.config.previewThumbnails.enabled) {\n this.previewThumbnails = new PreviewThumbnails(this);\n }\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.6.2\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 { silencePromise } from './utils/promise';\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 fullscreen: 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 // Migrate custom properties from media to container (so they work 😉)\n ui.migrateStyles.call(this);\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 fullscreen\n this.fullscreen = new Fullscreen(this);\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 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(() => silencePromise(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(() => silencePromise(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 null;\n }\n\n return 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 return this.play();\n }\n\n return this.pause();\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 -= 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 += 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') || this.media.getAttribute('data-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 && is.array(this.config.controls) && 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"]} \ No newline at end of file
diff --git a/youtube/static/modules/plyr/plyr.min.mjs b/youtube/static/modules/plyr/plyr.min.mjs
new file mode 100644
index 0000000..d008321
--- /dev/null
+++ b/youtube/static/modules/plyr/plyr.min.mjs
@@ -0,0 +1,3 @@
+function _defineProperties(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _createClass(e,t,i){return t&&_defineProperties(e.prototype,t),i&&_defineProperties(e,i),e}function _defineProperty(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function ownKeys(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,n)}return i}function _objectSpread2(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(i),!0).forEach((function(t){_defineProperty(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):ownKeys(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}function _objectWithoutPropertiesLoose(e,t){if(null==e)return{};var i,n,s={},a=Object.keys(e);for(n=0;n<a.length;n++)i=a[n],t.indexOf(i)>=0||(s[i]=e[i]);return s}function _objectWithoutProperties(e,t){if(null==e)return{};var i,n,s=_objectWithoutPropertiesLoose(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)i=a[n],t.indexOf(i)>=0||Object.prototype.propertyIsEnumerable.call(e,i)&&(s[i]=e[i])}return s}function _slicedToArray(e,t){return _arrayWithHoles(e)||_iterableToArrayLimit(e,t)||_unsupportedIterableToArray(e,t)||_nonIterableRest()}function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _arrayWithHoles(e){if(Array.isArray(e))return e}function _iterableToArray(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}function _iterableToArrayLimit(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var i=[],n=!0,s=!1,a=void 0;try{for(var r,o=e[Symbol.iterator]();!(n=(r=o.next()).done)&&(i.push(r.value),!t||i.length!==t);n=!0);}catch(e){s=!0,a=e}finally{try{n||null==o.return||o.return()}finally{if(s)throw a}}return i}}function _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=new Array(t);i<t;i++)n[i]=e[i];return n}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _classCallCheck$1(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties$1(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _createClass$1(e,t,i){return t&&_defineProperties$1(e.prototype,t),i&&_defineProperties$1(e,i),e}function _defineProperty$1(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function ownKeys$1(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,n)}return i}function _objectSpread2$1(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?ownKeys$1(Object(i),!0).forEach((function(t){_defineProperty$1(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):ownKeys$1(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}var defaults={addCSS:!0,thumbWidth:15,watch:!0};function matches(e,t){return function(){return Array.from(document.querySelectorAll(t)).includes(this)}.call(e,t)}function trigger(e,t){if(e&&t){var i=new Event(t,{bubbles:!0});e.dispatchEvent(i)}}var getConstructor=function(e){return null!=e?e.constructor:null},instanceOf=function(e,t){return!!(e&&t&&e instanceof t)},isNullOrUndefined=function(e){return null==e},isObject=function(e){return getConstructor(e)===Object},isNumber=function(e){return getConstructor(e)===Number&&!Number.isNaN(e)},isString=function(e){return getConstructor(e)===String},isBoolean=function(e){return getConstructor(e)===Boolean},isFunction=function(e){return getConstructor(e)===Function},isArray=function(e){return Array.isArray(e)},isNodeList=function(e){return instanceOf(e,NodeList)},isElement=function(e){return instanceOf(e,Element)},isEvent=function(e){return instanceOf(e,Event)},isEmpty=function(e){return isNullOrUndefined(e)||(isString(e)||isArray(e)||isNodeList(e))&&!e.length||isObject(e)&&!Object.keys(e).length},is={nullOrUndefined:isNullOrUndefined,object:isObject,number:isNumber,string:isString,boolean:isBoolean,function:isFunction,array:isArray,nodeList:isNodeList,element:isElement,event:isEvent,empty:isEmpty};function getDecimalPlaces(e){var t="".concat(e).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);return t?Math.max(0,(t[1]?t[1].length:0)-(t[2]?+t[2]:0)):0}function round(e,t){if(1>t){var i=getDecimalPlaces(t);return parseFloat(e.toFixed(i))}return Math.round(e/t)*t}var RangeTouch=function(){function e(t,i){_classCallCheck$1(this,e),is.element(t)?this.element=t:is.string(t)&&(this.element=document.querySelector(t)),is.element(this.element)&&is.empty(this.element.rangeTouch)&&(this.config=_objectSpread2$1({},defaults,{},i),this.init())}return _createClass$1(e,[{key:"init",value:function(){e.enabled&&(this.config.addCSS&&(this.element.style.userSelect="none",this.element.style.webKitUserSelect="none",this.element.style.touchAction="manipulation"),this.listeners(!0),this.element.rangeTouch=this)}},{key:"destroy",value:function(){e.enabled&&(this.config.addCSS&&(this.element.style.userSelect="",this.element.style.webKitUserSelect="",this.element.style.touchAction=""),this.listeners(!1),this.element.rangeTouch=null)}},{key:"listeners",value:function(e){var t=this,i=e?"addEventListener":"removeEventListener";["touchstart","touchmove","touchend"].forEach((function(e){t.element[i](e,(function(e){return t.set(e)}),!1)}))}},{key:"get",value:function(t){if(!e.enabled||!is.event(t))return null;var i,n=t.target,s=t.changedTouches[0],a=parseFloat(n.getAttribute("min"))||0,r=parseFloat(n.getAttribute("max"))||100,o=parseFloat(n.getAttribute("step"))||1,l=n.getBoundingClientRect(),c=100/l.width*(this.config.thumbWidth/2)/100;return 0>(i=100/l.width*(s.clientX-l.left))?i=0:100<i&&(i=100),50>i?i-=(100-2*i)*c:50<i&&(i+=2*(i-50)*c),a+round(i/100*(r-a),o)}},{key:"set",value:function(t){e.enabled&&is.event(t)&&!t.target.disabled&&(t.preventDefault(),t.target.value=this.get(t),trigger(t.target,"touchend"===t.type?"change":"input"))}}],[{key:"setup",value:function(t){var i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},n=null;if(is.empty(t)||is.string(t)?n=Array.from(document.querySelectorAll(is.string(t)?t:'input[type="range"]')):is.element(t)?n=[t]:is.nodeList(t)?n=Array.from(t):is.array(t)&&(n=t.filter(is.element)),is.empty(n))return null;var s=_objectSpread2$1({},defaults,{},i);if(is.string(t)&&s.watch){var a=new MutationObserver((function(i){Array.from(i).forEach((function(i){Array.from(i.addedNodes).forEach((function(i){is.element(i)&&matches(i,t)&&new e(i,s)}))}))}));a.observe(document.body,{childList:!0,subtree:!0})}return n.map((function(t){return new e(t,i)}))}},{key:"enabled",get:function(){return"ontouchstart"in document.documentElement}}]),e}(),getConstructor$1=function(e){return null!=e?e.constructor:null},instanceOf$1=function(e,t){return Boolean(e&&t&&e instanceof t)},isNullOrUndefined$1=function(e){return null==e},isObject$1=function(e){return getConstructor$1(e)===Object},isNumber$1=function(e){return getConstructor$1(e)===Number&&!Number.isNaN(e)},isString$1=function(e){return getConstructor$1(e)===String},isBoolean$1=function(e){return getConstructor$1(e)===Boolean},isFunction$1=function(e){return getConstructor$1(e)===Function},isArray$1=function(e){return Array.isArray(e)},isWeakMap=function(e){return instanceOf$1(e,WeakMap)},isNodeList$1=function(e){return instanceOf$1(e,NodeList)},isElement$1=function(e){return instanceOf$1(e,Element)},isTextNode=function(e){return getConstructor$1(e)===Text},isEvent$1=function(e){return instanceOf$1(e,Event)},isKeyboardEvent=function(e){return instanceOf$1(e,KeyboardEvent)},isCue=function(e){return instanceOf$1(e,window.TextTrackCue)||instanceOf$1(e,window.VTTCue)},isTrack=function(e){return instanceOf$1(e,TextTrack)||!isNullOrUndefined$1(e)&&isString$1(e.kind)},isPromise=function(e){return instanceOf$1(e,Promise)&&isFunction$1(e.then)},isEmpty$1=function(e){return isNullOrUndefined$1(e)||(isString$1(e)||isArray$1(e)||isNodeList$1(e))&&!e.length||isObject$1(e)&&!Object.keys(e).length},isUrl=function(e){if(instanceOf$1(e,window.URL))return!0;if(!isString$1(e))return!1;var t=e;e.startsWith("http://")&&e.startsWith("https://")||(t="http://".concat(e));try{return!isEmpty$1(new URL(t).hostname)}catch(e){return!1}},is$1={nullOrUndefined:isNullOrUndefined$1,object:isObject$1,number:isNumber$1,string:isString$1,boolean:isBoolean$1,function:isFunction$1,array:isArray$1,weakMap:isWeakMap,nodeList:isNodeList$1,element:isElement$1,textNode:isTextNode,event:isEvent$1,keyboardEvent:isKeyboardEvent,cue:isCue,track:isTrack,promise:isPromise,url:isUrl,empty:isEmpty$1},transitionEndEvent=function(){var e=document.createElement("span"),t={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"},i=Object.keys(t).find((function(t){return void 0!==e.style[t]}));return!!is$1.string(i)&&t[i]}();function repaint(e,t){setTimeout((function(){try{e.hidden=!0,e.offsetHeight,e.hidden=!1}catch(e){}}),t)}var browser={isIE:
+/* @cc_on!@ */
+!!document.documentMode,isEdge:window.navigator.userAgent.includes("Edge"),isWebkit:"WebkitAppearance"in document.documentElement.style&&!/Edge/.test(navigator.userAgent),isIPhone:/(iPhone|iPod)/gi.test(navigator.platform),isIos:/(iPad|iPhone|iPod)/gi.test(navigator.platform)};function cloneDeep(e){return JSON.parse(JSON.stringify(e))}function getDeep(e,t){return t.split(".").reduce((function(e,t){return e&&e[t]}),e)}function extend(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length,i=new Array(t>1?t-1:0),n=1;n<t;n++)i[n-1]=arguments[n];if(!i.length)return e;var s=i.shift();return is$1.object(s)?(Object.keys(s).forEach((function(t){is$1.object(s[t])?(Object.keys(e).includes(t)||Object.assign(e,_defineProperty({},t,{})),extend(e[t],s[t])):Object.assign(e,_defineProperty({},t,s[t]))})),extend.apply(void 0,[e].concat(i))):e}function wrap(e,t){var i=e.length?e:[e];Array.from(i).reverse().forEach((function(e,i){var n=i>0?t.cloneNode(!0):t,s=e.parentNode,a=e.nextSibling;n.appendChild(e),a?s.insertBefore(n,a):s.appendChild(n)}))}function setAttributes(e,t){is$1.element(e)&&!is$1.empty(t)&&Object.entries(t).filter((function(e){var t=_slicedToArray(e,2)[1];return!is$1.nullOrUndefined(t)})).forEach((function(t){var i=_slicedToArray(t,2),n=i[0],s=i[1];return e.setAttribute(n,s)}))}function createElement(e,t,i){var n=document.createElement(e);return is$1.object(t)&&setAttributes(n,t),is$1.string(i)&&(n.innerText=i),n}function insertAfter(e,t){is$1.element(e)&&is$1.element(t)&&t.parentNode.insertBefore(e,t.nextSibling)}function insertElement(e,t,i,n){is$1.element(t)&&t.appendChild(createElement(e,i,n))}function removeElement(e){is$1.nodeList(e)||is$1.array(e)?Array.from(e).forEach(removeElement):is$1.element(e)&&is$1.element(e.parentNode)&&e.parentNode.removeChild(e)}function emptyElement(e){if(is$1.element(e))for(var t=e.childNodes.length;t>0;)e.removeChild(e.lastChild),t-=1}function replaceElement(e,t){return is$1.element(t)&&is$1.element(t.parentNode)&&is$1.element(e)?(t.parentNode.replaceChild(e,t),e):null}function getAttributesFromSelector(e,t){if(!is$1.string(e)||is$1.empty(e))return{};var i={},n=extend({},t);return e.split(",").forEach((function(e){var t=e.trim(),s=t.replace(".",""),a=t.replace(/[[\]]/g,"").split("="),r=_slicedToArray(a,1)[0],o=a.length>1?a[1].replace(/["']/g,""):"";switch(t.charAt(0)){case".":is$1.string(n.class)?i.class="".concat(n.class," ").concat(s):i.class=s;break;case"#":i.id=t.replace("#","");break;case"[":i[r]=o}})),extend(n,i)}function toggleHidden(e,t){if(is$1.element(e)){var i=t;is$1.boolean(i)||(i=!e.hidden),e.hidden=i}}function toggleClass(e,t,i){if(is$1.nodeList(e))return Array.from(e).map((function(e){return toggleClass(e,t,i)}));if(is$1.element(e)){var n="toggle";return void 0!==i&&(n=i?"add":"remove"),e.classList[n](t),e.classList.contains(t)}return!1}function hasClass(e,t){return is$1.element(e)&&e.classList.contains(t)}function matches$1(e,t){var i=Element.prototype;return(i.matches||i.webkitMatchesSelector||i.mozMatchesSelector||i.msMatchesSelector||function(){return Array.from(document.querySelectorAll(t)).includes(this)}).call(e,t)}function closest(e,t){return(Element.prototype.closest||function(){var e=this;do{if(matches$1.matches(e,t))return e;e=e.parentElement||e.parentNode}while(null!==e&&1===e.nodeType);return null}).call(e,t)}function getElements(e){return this.elements.container.querySelectorAll(e)}function getElement(e){return this.elements.container.querySelector(e)}function setFocus(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];is$1.element(e)&&(e.focus({preventScroll:!0}),t&&toggleClass(e,this.config.classNames.tabFocus))}var defaultCodecs={"audio/ogg":"vorbis","audio/wav":"1","video/webm":"vp8, vorbis","video/mp4":"avc1.42E01E, mp4a.40.2","video/ogg":"theora"},support={audio:"canPlayType"in document.createElement("audio"),video:"canPlayType"in document.createElement("video"),check:function(e,t,i){var n=browser.isIPhone&&i&&support.playsinline,s=support[e]||"html5"!==t;return{api:s,ui:s&&support.rangeInput&&("video"!==e||!browser.isIPhone||n)}},pip:!(browser.isIPhone||!is$1.function(createElement("video").webkitSetPresentationMode)&&(!document.pictureInPictureEnabled||createElement("video").disablePictureInPicture)),airplay:is$1.function(window.WebKitPlaybackTargetAvailabilityEvent),playsinline:"playsInline"in document.createElement("video"),mime:function(e){if(is$1.empty(e))return!1;var t=_slicedToArray(e.split("/"),1)[0],i=e;if(!this.isHTML5||t!==this.type)return!1;Object.keys(defaultCodecs).includes(i)&&(i+='; codecs="'.concat(defaultCodecs[e],'"'));try{return Boolean(i&&this.media.canPlayType(i).replace(/no/,""))}catch(e){return!1}},textTracks:"textTracks"in document.createElement("video"),rangeInput:function(){var e=document.createElement("input");return e.type="range","range"===e.type}(),touch:"ontouchstart"in document.documentElement,transitions:!1!==transitionEndEvent,reducedMotion:"matchMedia"in window&&window.matchMedia("(prefers-reduced-motion)").matches},supportsPassiveListeners=function(){var e=!1;try{var t=Object.defineProperty({},"passive",{get:function(){return e=!0,null}});window.addEventListener("test",null,t),window.removeEventListener("test",null,t)}catch(e){}return e}();function toggleListener(e,t,i){var n=this,s=arguments.length>3&&void 0!==arguments[3]&&arguments[3],a=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],r=arguments.length>5&&void 0!==arguments[5]&&arguments[5];if(e&&"addEventListener"in e&&!is$1.empty(t)&&is$1.function(i)){var o=t.split(" "),l=r;supportsPassiveListeners&&(l={passive:a,capture:r}),o.forEach((function(t){n&&n.eventListeners&&s&&n.eventListeners.push({element:e,type:t,callback:i,options:l}),e[s?"addEventListener":"removeEventListener"](t,i,l)}))}}function on(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",i=arguments.length>2?arguments[2]:void 0,n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],s=arguments.length>4&&void 0!==arguments[4]&&arguments[4];toggleListener.call(this,e,t,i,!0,n,s)}function off(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",i=arguments.length>2?arguments[2]:void 0,n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],s=arguments.length>4&&void 0!==arguments[4]&&arguments[4];toggleListener.call(this,e,t,i,!1,n,s)}function once(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2?arguments[2]:void 0,s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],a=arguments.length>4&&void 0!==arguments[4]&&arguments[4],r=function r(){off(e,i,r,s,a);for(var o=arguments.length,l=new Array(o),c=0;c<o;c++)l[c]=arguments[c];n.apply(t,l)};toggleListener.call(this,e,i,r,!0,s,a)}function triggerEvent(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(is$1.element(e)&&!is$1.empty(t)){var s=new CustomEvent(t,{bubbles:i,detail:_objectSpread2(_objectSpread2({},n),{},{plyr:this})});e.dispatchEvent(s)}}function unbindListeners(){this&&this.eventListeners&&(this.eventListeners.forEach((function(e){var t=e.element,i=e.type,n=e.callback,s=e.options;t.removeEventListener(i,n,s)})),this.eventListeners=[])}function ready(){var e=this;return new Promise((function(t){return e.ready?setTimeout(t,0):on.call(e,e.elements.container,"ready",t)})).then((function(){}))}function silencePromise(e){is$1.promise(e)&&e.then(null,(function(){}))}function validateRatio(e){return!!(is$1.array(e)||is$1.string(e)&&e.includes(":"))&&(is$1.array(e)?e:e.split(":")).map(Number).every(is$1.number)}function reduceAspectRatio(e){if(!is$1.array(e)||!e.every(is$1.number))return null;var t=_slicedToArray(e,2),i=t[0],n=t[1],s=function e(t,i){return 0===i?t:e(i,t%i)}(i,n);return[i/s,n/s]}function getAspectRatio(e){var t=function(e){return validateRatio(e)?e.split(":").map(Number):null},i=t(e);if(null===i&&(i=t(this.config.ratio)),null===i&&!is$1.empty(this.embed)&&is$1.array(this.embed.ratio)&&(i=this.embed.ratio),null===i&&this.isHTML5){var n=this.media;i=reduceAspectRatio([n.videoWidth,n.videoHeight])}return i}function setAspectRatio(e){if(!this.isVideo)return{};var t=this.elements.wrapper,i=getAspectRatio.call(this,e),n=_slicedToArray(is$1.array(i)?i:[0,0],2),s=100/n[0]*n[1];if(t.style.paddingBottom="".concat(s,"%"),this.isVimeo&&!this.config.vimeo.premium&&this.supported.ui){var a=100/this.media.offsetWidth*parseInt(window.getComputedStyle(this.media).paddingBottom,10),r=(a-s)/(a/50);this.media.style.transform="translateY(-".concat(r,"%)")}else this.isHTML5&&t.classList.toggle(this.config.classNames.videoFixedRatio,null!==i);return{padding:s,ratio:i}}var html5={getSources:function(){var e=this;return this.isHTML5?Array.from(this.media.querySelectorAll("source")).filter((function(t){var i=t.getAttribute("type");return!!is$1.empty(i)||support.mime.call(e,i)})):[]},getQualityOptions:function(){return this.config.quality.forced?this.config.quality.options:html5.getSources.call(this).map((function(e){return Number(e.getAttribute("data-res"))})).filter(Boolean)},setup:function(){if(this.isHTML5){var e=this;e.options.speed=e.config.speed.options,is$1.empty(this.config.ratio)||setAspectRatio.call(e),Object.defineProperty(e.media,"quality",{get:function(){var t=html5.getSources.call(e).find((function(t){return t.getAttribute("src")===e.source}));return t&&Number(t.getAttribute("data-res"))},set:function(t){if(e.quality!==t){if(e.config.quality.forced&&is$1.function(e.config.quality.onChange))e.config.quality.onChange(t);else{var i=html5.getSources.call(e).find((function(e){return Number(e.getAttribute("data-res"))===t}));if(!i)return;var n=e.media,s=n.currentTime,a=n.paused,r=n.preload,o=n.readyState,l=n.playbackRate;e.media.src=i.getAttribute("src"),("none"!==r||o)&&(e.once("loadedmetadata",(function(){e.speed=l,e.currentTime=s,a||silencePromise(e.play())})),e.media.load())}triggerEvent.call(e,e.media,"qualitychange",!1,{quality:t})}}})}},cancelRequests:function(){this.isHTML5&&(removeElement(html5.getSources.call(this)),this.media.setAttribute("src",this.config.blankVideo),this.media.load(),this.debug.log("Cancelled network requests"))}};function dedupe(e){return is$1.array(e)?e.filter((function(t,i){return e.indexOf(t)===i})):e}function closest$1(e,t){return is$1.array(e)&&e.length?e.reduce((function(e,i){return Math.abs(i-t)<Math.abs(e-t)?i:e})):null}function generateId(e){return"".concat(e,"-").concat(Math.floor(1e4*Math.random()))}function format(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),n=1;n<t;n++)i[n-1]=arguments[n];return is$1.empty(e)?e:e.toString().replace(/{(\d+)}/g,(function(e,t){return i[t].toString()}))}function getPercentage(e,t){return 0===e||0===t||Number.isNaN(e)||Number.isNaN(t)?0:(e/t*100).toFixed(2)}var replaceAll=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return e.replace(new RegExp(t.toString().replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1"),"g"),i.toString())},toTitleCase=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return e.toString().replace(/\w\S*/g,(function(e){return e.charAt(0).toUpperCase()+e.substr(1).toLowerCase()}))};function toPascalCase(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=e.toString();return t=replaceAll(t,"-"," "),t=replaceAll(t,"_"," "),t=toTitleCase(t),replaceAll(t," ","")}function toCamelCase(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=e.toString();return(t=toPascalCase(t)).charAt(0).toLowerCase()+t.slice(1)}function stripHTML(e){var t=document.createDocumentFragment(),i=document.createElement("div");return t.appendChild(i),i.innerHTML=e,t.firstChild.innerText}function getHTML(e){var t=document.createElement("div");return t.appendChild(e),t.innerHTML}var resources={pip:"PIP",airplay:"AirPlay",html5:"HTML5",vimeo:"Vimeo",youtube:"YouTube"},i18n={get:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(is$1.empty(e)||is$1.empty(t))return"";var i=getDeep(t.i18n,e);if(is$1.empty(i))return Object.keys(resources).includes(e)?resources[e]:"";var n={"{seektime}":t.seekTime,"{title}":t.title};return Object.entries(n).forEach((function(e){var t=_slicedToArray(e,2),n=t[0],s=t[1];i=replaceAll(i,n,s)})),i}},Storage=function(){function e(t){_classCallCheck(this,e),this.enabled=t.config.storage.enabled,this.key=t.config.storage.key}return _createClass(e,[{key:"get",value:function(t){if(!e.supported||!this.enabled)return null;var i=window.localStorage.getItem(this.key);if(is$1.empty(i))return null;var n=JSON.parse(i);return is$1.string(t)&&t.length?n[t]:n}},{key:"set",value:function(t){if(e.supported&&this.enabled&&is$1.object(t)){var i=this.get();is$1.empty(i)&&(i={}),extend(i,t),window.localStorage.setItem(this.key,JSON.stringify(i))}}}],[{key:"supported",get:function(){try{if(!("localStorage"in window))return!1;return window.localStorage.setItem("___test","___test"),window.localStorage.removeItem("___test"),!0}catch(e){return!1}}}]),e}();function fetch(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"text";return new Promise((function(i,n){try{var s=new XMLHttpRequest;if(!("withCredentials"in s))return;s.addEventListener("load",(function(){if("text"===t)try{i(JSON.parse(s.responseText))}catch(e){i(s.responseText)}else i(s.response)})),s.addEventListener("error",(function(){throw new Error(s.status)})),s.open("GET",e,!0),s.responseType=t,s.send()}catch(e){n(e)}}))}function loadSprite(e,t){if(is$1.string(e)){var i=is$1.string(t),n=function(){return null!==document.getElementById(t)},s=function(e,t){e.innerHTML=t,i&&n()||document.body.insertAdjacentElement("afterbegin",e)};if(!i||!n()){var a=Storage.supported,r=document.createElement("div");if(r.setAttribute("hidden",""),i&&r.setAttribute("id",t),a){var o=window.localStorage.getItem("".concat("cache","-").concat(t));if(null!==o){var l=JSON.parse(o);s(r,l.content)}}fetch(e).then((function(e){is$1.empty(e)||(a&&window.localStorage.setItem("".concat("cache","-").concat(t),JSON.stringify({content:e})),s(r,e))})).catch((function(){}))}}}var getHours=function(e){return Math.trunc(e/60/60%60,10)},getMinutes=function(e){return Math.trunc(e/60%60,10)},getSeconds=function(e){return Math.trunc(e%60,10)};function formatTime(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!is$1.number(e))return formatTime(void 0,t,i);var n=function(e){return"0".concat(e).slice(-2)},s=getHours(e),a=getMinutes(e),r=getSeconds(e);return s=t||s>0?"".concat(s,":"):"","".concat(i&&e>0?"-":"").concat(s).concat(n(a),":").concat(n(r))}var controls={getIconUrl:function(){var e=new URL(this.config.iconUrl,window.location).host!==window.location.host||browser.isIE&&!window.svg4everybody;return{url:this.config.iconUrl,cors:e}},findElements:function(){try{return this.elements.controls=getElement.call(this,this.config.selectors.controls.wrapper),this.elements.buttons={play:getElements.call(this,this.config.selectors.buttons.play),pause:getElement.call(this,this.config.selectors.buttons.pause),restart:getElement.call(this,this.config.selectors.buttons.restart),rewind:getElement.call(this,this.config.selectors.buttons.rewind),fastForward:getElement.call(this,this.config.selectors.buttons.fastForward),mute:getElement.call(this,this.config.selectors.buttons.mute),pip:getElement.call(this,this.config.selectors.buttons.pip),airplay:getElement.call(this,this.config.selectors.buttons.airplay),settings:getElement.call(this,this.config.selectors.buttons.settings),captions:getElement.call(this,this.config.selectors.buttons.captions),fullscreen:getElement.call(this,this.config.selectors.buttons.fullscreen)},this.elements.progress=getElement.call(this,this.config.selectors.progress),this.elements.inputs={seek:getElement.call(this,this.config.selectors.inputs.seek),volume:getElement.call(this,this.config.selectors.inputs.volume)},this.elements.display={buffer:getElement.call(this,this.config.selectors.display.buffer),currentTime:getElement.call(this,this.config.selectors.display.currentTime),duration:getElement.call(this,this.config.selectors.display.duration)},is$1.element(this.elements.progress)&&(this.elements.display.seekTooltip=this.elements.progress.querySelector(".".concat(this.config.classNames.tooltip))),!0}catch(e){return this.debug.warn("It looks like there is a problem with your custom controls HTML",e),this.toggleNativeControls(!0),!1}},createIcon:function(e,t){var i=controls.getIconUrl.call(this),n="".concat(i.cors?"":i.url,"#").concat(this.config.iconPrefix),s=document.createElementNS("http://www.w3.org/2000/svg","svg");setAttributes(s,extend(t,{"aria-hidden":"true",focusable:"false"}));var a=document.createElementNS("http://www.w3.org/2000/svg","use"),r="".concat(n,"-").concat(e);return"href"in a&&a.setAttributeNS("http://www.w3.org/1999/xlink","href",r),a.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",r),s.appendChild(a),s},createLabel:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=i18n.get(e,this.config),n=_objectSpread2(_objectSpread2({},t),{},{class:[t.class,this.config.classNames.hidden].filter(Boolean).join(" ")});return createElement("span",n,i)},createBadge:function(e){if(is$1.empty(e))return null;var t=createElement("span",{class:this.config.classNames.menu.value});return t.appendChild(createElement("span",{class:this.config.classNames.menu.badge},e)),t},createButton:function(e,t){var i=this,n=extend({},t),s=toCamelCase(e),a={element:"button",toggle:!1,label:null,icon:null,labelPressed:null,iconPressed:null};switch(["element","icon","label"].forEach((function(e){Object.keys(n).includes(e)&&(a[e]=n[e],delete n[e])})),"button"!==a.element||Object.keys(n).includes("type")||(n.type="button"),Object.keys(n).includes("class")?n.class.split(" ").some((function(e){return e===i.config.classNames.control}))||extend(n,{class:"".concat(n.class," ").concat(this.config.classNames.control)}):n.class=this.config.classNames.control,e){case"play":a.toggle=!0,a.label="play",a.labelPressed="pause",a.icon="play",a.iconPressed="pause";break;case"mute":a.toggle=!0,a.label="mute",a.labelPressed="unmute",a.icon="volume",a.iconPressed="muted";break;case"captions":a.toggle=!0,a.label="enableCaptions",a.labelPressed="disableCaptions",a.icon="captions-off",a.iconPressed="captions-on";break;case"fullscreen":a.toggle=!0,a.label="enterFullscreen",a.labelPressed="exitFullscreen",a.icon="enter-fullscreen",a.iconPressed="exit-fullscreen";break;case"play-large":n.class+=" ".concat(this.config.classNames.control,"--overlaid"),s="play",a.label="play",a.icon="play";break;default:is$1.empty(a.label)&&(a.label=s),is$1.empty(a.icon)&&(a.icon=e)}var r=createElement(a.element);return a.toggle?(r.appendChild(controls.createIcon.call(this,a.iconPressed,{class:"icon--pressed"})),r.appendChild(controls.createIcon.call(this,a.icon,{class:"icon--not-pressed"})),r.appendChild(controls.createLabel.call(this,a.labelPressed,{class:"label--pressed"})),r.appendChild(controls.createLabel.call(this,a.label,{class:"label--not-pressed"}))):(r.appendChild(controls.createIcon.call(this,a.icon)),r.appendChild(controls.createLabel.call(this,a.label))),extend(n,getAttributesFromSelector(this.config.selectors.buttons[s],n)),setAttributes(r,n),"play"===s?(is$1.array(this.elements.buttons[s])||(this.elements.buttons[s]=[]),this.elements.buttons[s].push(r)):this.elements.buttons[s]=r,r},createRange:function(e,t){var i=createElement("input",extend(getAttributesFromSelector(this.config.selectors.inputs[e]),{type:"range",min:0,max:100,step:.01,value:0,autocomplete:"off",role:"slider","aria-label":i18n.get(e,this.config),"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":0},t));return this.elements.inputs[e]=i,controls.updateRangeFill.call(this,i),RangeTouch.setup(i),i},createProgress:function(e,t){var i=createElement("progress",extend(getAttributesFromSelector(this.config.selectors.display[e]),{min:0,max:100,value:0,role:"progressbar","aria-hidden":!0},t));if("volume"!==e){i.appendChild(createElement("span",null,"0"));var n={played:"played",buffer:"buffered"}[e],s=n?i18n.get(n,this.config):"";i.innerText="% ".concat(s.toLowerCase())}return this.elements.display[e]=i,i},createTime:function(e,t){var i=getAttributesFromSelector(this.config.selectors.display[e],t),n=createElement("div",extend(i,{class:"".concat(i.class?i.class:""," ").concat(this.config.classNames.display.time," ").trim(),"aria-label":i18n.get(e,this.config)}),"00:00");return this.elements.display[e]=n,n},bindMenuItemShortcuts:function(e,t){var i=this;on.call(this,e,"keydown keyup",(function(n){if([32,38,39,40].includes(n.which)&&(n.preventDefault(),n.stopPropagation(),"keydown"!==n.type)){var s,a=matches$1(e,'[role="menuitemradio"]');if(!a&&[32,39].includes(n.which))controls.showMenuPanel.call(i,t,!0);else 32!==n.which&&(40===n.which||a&&39===n.which?(s=e.nextElementSibling,is$1.element(s)||(s=e.parentNode.firstElementChild)):(s=e.previousElementSibling,is$1.element(s)||(s=e.parentNode.lastElementChild)),setFocus.call(i,s,!0))}}),!1),on.call(this,e,"keyup",(function(e){13===e.which&&controls.focusFirstMenuItem.call(i,null,!0)}))},createMenuItem:function(e){var t=this,i=e.value,n=e.list,s=e.type,a=e.title,r=e.badge,o=void 0===r?null:r,l=e.checked,c=void 0!==l&&l,u=getAttributesFromSelector(this.config.selectors.inputs[s]),d=createElement("button",extend(u,{type:"button",role:"menuitemradio",class:"".concat(this.config.classNames.control," ").concat(u.class?u.class:"").trim(),"aria-checked":c,value:i})),h=createElement("span");h.innerHTML=a,is$1.element(o)&&h.appendChild(o),d.appendChild(h),Object.defineProperty(d,"checked",{enumerable:!0,get:function(){return"true"===d.getAttribute("aria-checked")},set:function(e){e&&Array.from(d.parentNode.children).filter((function(e){return matches$1(e,'[role="menuitemradio"]')})).forEach((function(e){return e.setAttribute("aria-checked","false")})),d.setAttribute("aria-checked",e?"true":"false")}}),this.listeners.bind(d,"click keyup",(function(e){if(!is$1.keyboardEvent(e)||32===e.which){switch(e.preventDefault(),e.stopPropagation(),d.checked=!0,s){case"language":t.currentTrack=Number(i);break;case"quality":t.quality=i;break;case"speed":t.speed=parseFloat(i)}controls.showMenuPanel.call(t,"home",is$1.keyboardEvent(e))}}),s,!1),controls.bindMenuItemShortcuts.call(this,d,s),n.appendChild(d)},formatTime:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!is$1.number(e))return e;var i=getHours(this.duration)>0;return formatTime(e,i,t)},updateTimeDisplay:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];is$1.element(e)&&is$1.number(t)&&(e.innerText=controls.formatTime(t,i))},updateVolume:function(){this.supported.ui&&(is$1.element(this.elements.inputs.volume)&&controls.setRange.call(this,this.elements.inputs.volume,this.muted?0:this.volume),is$1.element(this.elements.buttons.mute)&&(this.elements.buttons.mute.pressed=this.muted||0===this.volume))},setRange:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;is$1.element(e)&&(e.value=t,controls.updateRangeFill.call(this,e))},updateProgress:function(e){var t=this;if(this.supported.ui&&is$1.event(e)){var i=0;if(e)switch(e.type){case"timeupdate":case"seeking":case"seeked":i=getPercentage(this.currentTime,this.duration),"timeupdate"===e.type&&controls.setRange.call(this,this.elements.inputs.seek,i);break;case"playing":case"progress":!function(e,i){var n=is$1.number(i)?i:0,s=is$1.element(e)?e:t.elements.display.buffer;if(is$1.element(s)){s.value=n;var a=s.getElementsByTagName("span")[0];is$1.element(a)&&(a.childNodes[0].nodeValue=n)}}(this.elements.display.buffer,100*this.buffered)}}},updateRangeFill:function(e){var t=is$1.event(e)?e.target:e;if(is$1.element(t)&&"range"===t.getAttribute("type")){if(matches$1(t,this.config.selectors.inputs.seek)){t.setAttribute("aria-valuenow",this.currentTime);var i=controls.formatTime(this.currentTime),n=controls.formatTime(this.duration),s=i18n.get("seekLabel",this.config);t.setAttribute("aria-valuetext",s.replace("{currentTime}",i).replace("{duration}",n))}else if(matches$1(t,this.config.selectors.inputs.volume)){var a=100*t.value;t.setAttribute("aria-valuenow",a),t.setAttribute("aria-valuetext","".concat(a.toFixed(1),"%"))}else t.setAttribute("aria-valuenow",t.value);browser.isWebkit&&t.style.setProperty("--value","".concat(t.value/t.max*100,"%"))}},updateSeekTooltip:function(e){var t=this;if(this.config.tooltips.seek&&is$1.element(this.elements.inputs.seek)&&is$1.element(this.elements.display.seekTooltip)&&0!==this.duration){var i="".concat(this.config.classNames.tooltip,"--visible"),n=function(e){return toggleClass(t.elements.display.seekTooltip,i,e)};if(this.touch)n(!1);else{var s=0,a=this.elements.progress.getBoundingClientRect();if(is$1.event(e))s=100/a.width*(e.pageX-a.left);else{if(!hasClass(this.elements.display.seekTooltip,i))return;s=parseFloat(this.elements.display.seekTooltip.style.left,10)}s<0?s=0:s>100&&(s=100),controls.updateTimeDisplay.call(this,this.elements.display.seekTooltip,this.duration/100*s),this.elements.display.seekTooltip.style.left="".concat(s,"%"),is$1.event(e)&&["mouseenter","mouseleave"].includes(e.type)&&n("mouseenter"===e.type)}}},timeUpdate:function(e){var t=!is$1.element(this.elements.display.duration)&&this.config.invertTime;controls.updateTimeDisplay.call(this,this.elements.display.currentTime,t?this.duration-this.currentTime:this.currentTime,t),e&&"timeupdate"===e.type&&this.media.seeking||controls.updateProgress.call(this,e)},durationUpdate:function(){if(this.supported.ui&&(this.config.invertTime||!this.currentTime)){if(this.duration>=Math.pow(2,32))return toggleHidden(this.elements.display.currentTime,!0),void toggleHidden(this.elements.progress,!0);is$1.element(this.elements.inputs.seek)&&this.elements.inputs.seek.setAttribute("aria-valuemax",this.duration);var e=is$1.element(this.elements.display.duration);!e&&this.config.displayDuration&&this.paused&&controls.updateTimeDisplay.call(this,this.elements.display.currentTime,this.duration),e&&controls.updateTimeDisplay.call(this,this.elements.display.duration,this.duration),controls.updateSeekTooltip.call(this)}},toggleMenuButton:function(e,t){toggleHidden(this.elements.settings.buttons[e],!t)},updateSetting:function(e,t,i){var n=this.elements.settings.panels[e],s=null,a=t;if("captions"===e)s=this.currentTrack;else{if(s=is$1.empty(i)?this[e]:i,is$1.empty(s)&&(s=this.config[e].default),!is$1.empty(this.options[e])&&!this.options[e].includes(s))return void this.debug.warn("Unsupported value of '".concat(s,"' for ").concat(e));if(!this.config[e].options.includes(s))return void this.debug.warn("Disabled value of '".concat(s,"' for ").concat(e))}if(is$1.element(a)||(a=n&&n.querySelector('[role="menu"]')),is$1.element(a)){this.elements.settings.buttons[e].querySelector(".".concat(this.config.classNames.menu.value)).innerHTML=controls.getLabel.call(this,e,s);var r=a&&a.querySelector('[value="'.concat(s,'"]'));is$1.element(r)&&(r.checked=!0)}},getLabel:function(e,t){switch(e){case"speed":return 1===t?i18n.get("normal",this.config):"".concat(t,"&times;");case"quality":if(is$1.number(t)){var i=i18n.get("qualityLabel.".concat(t),this.config);return i.length?i:"".concat(t,"p")}return toTitleCase(t);case"captions":return captions.getLabel.call(this);default:return null}},setQualityMenu:function(e){var t=this;if(is$1.element(this.elements.settings.panels.quality)){var i=this.elements.settings.panels.quality.querySelector('[role="menu"]');is$1.array(e)&&(this.options.quality=dedupe(e).filter((function(e){return t.config.quality.options.includes(e)})));var n=!is$1.empty(this.options.quality)&&this.options.quality.length>1;if(controls.toggleMenuButton.call(this,"quality",n),emptyElement(i),controls.checkMenu.call(this),n){var s=function(e){var i=i18n.get("qualityBadge.".concat(e),t.config);return i.length?controls.createBadge.call(t,i):null};this.options.quality.sort((function(e,i){var n=t.config.quality.options;return n.indexOf(e)>n.indexOf(i)?1:-1})).forEach((function(e){controls.createMenuItem.call(t,{value:e,list:i,type:"quality",title:controls.getLabel.call(t,"quality",e),badge:s(e)})})),controls.updateSetting.call(this,"quality",i)}}},setCaptionsMenu:function(){var e=this;if(is$1.element(this.elements.settings.panels.captions)){var t=this.elements.settings.panels.captions.querySelector('[role="menucaptions"]'),i=captions.getTracks.call(this),n=Boolean(i.length);if(controls.toggleMenuButton.call(this,"captions",n),emptyElement(t),controls.checkMenu.call(this),n){var s=i.map((function(i,n){return{value:n,checked:e.captions.toggled&&e.currentTrack===n,title:captions.getLabel.call(e,i),badge:i.language&&controls.createBadge.call(e,i.language.toUpperCase()),list:t,type:"language"}}));s.unshift({value:-1,checked:!this.captions.toggled,title:i18n.get("disabled",this.config),list:t,type:"language"}),s.forEach(controls.createMenuItem.bind(this)),controls.updateSetting.call(this,"captions",t)}}},setSpeedMenu:function(){var e=this;if(is$1.element(this.elements.settings.panels.speed)){var t=this.elements.settings.panels.speed.querySelector('[role="menu"]');this.options.speed=this.options.speed.filter((function(t){return t>=e.minimumSpeed&&t<=e.maximumSpeed}));var i=!is$1.empty(this.options.speed)&&this.options.speed.length>1;controls.toggleMenuButton.call(this,"speed",i),emptyElement(t),controls.checkMenu.call(this),i&&(this.options.speed.forEach((function(i){controls.createMenuItem.call(e,{value:i,list:t,type:"speed",title:controls.getLabel.call(e,"speed",i)})})),controls.updateSetting.call(this,"speed",t))}},checkMenu:function(){var e=this.elements.settings.buttons,t=!is$1.empty(e)&&Object.values(e).some((function(e){return!e.hidden}));toggleHidden(this.elements.settings.menu,!t)},focusFirstMenuItem:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!this.elements.settings.popup.hidden){var i=e;is$1.element(i)||(i=Object.values(this.elements.settings.panels).find((function(e){return!e.hidden})));var n=i.querySelector('[role^="menuitem"]');setFocus.call(this,n,t)}},toggleMenu:function(e){var t=this.elements.settings.popup,i=this.elements.buttons.settings;if(is$1.element(t)&&is$1.element(i)){var n=t.hidden,s=n;if(is$1.boolean(e))s=e;else if(is$1.keyboardEvent(e)&&27===e.which)s=!1;else if(is$1.event(e)){var a=is$1.function(e.composedPath)?e.composedPath()[0]:e.target,r=t.contains(a);if(r||!r&&e.target!==i&&s)return}i.setAttribute("aria-expanded",s),toggleHidden(t,!s),toggleClass(this.elements.container,this.config.classNames.menu.open,s),s&&is$1.keyboardEvent(e)?controls.focusFirstMenuItem.call(this,null,!0):s||n||setFocus.call(this,i,is$1.keyboardEvent(e))}},getMenuSize:function(e){var t=e.cloneNode(!0);t.style.position="absolute",t.style.opacity=0,t.removeAttribute("hidden"),e.parentNode.appendChild(t);var i=t.scrollWidth,n=t.scrollHeight;return removeElement(t),{width:i,height:n}},showMenuPanel:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",i=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=this.elements.container.querySelector("#plyr-settings-".concat(this.id,"-").concat(t));if(is$1.element(n)){var s=n.parentNode,a=Array.from(s.children).find((function(e){return!e.hidden}));if(support.transitions&&!support.reducedMotion){s.style.width="".concat(a.scrollWidth,"px"),s.style.height="".concat(a.scrollHeight,"px");var r=controls.getMenuSize.call(this,n),o=function t(i){i.target===s&&["width","height"].includes(i.propertyName)&&(s.style.width="",s.style.height="",off.call(e,s,transitionEndEvent,t))};on.call(this,s,transitionEndEvent,o),s.style.width="".concat(r.width,"px"),s.style.height="".concat(r.height,"px")}toggleHidden(a,!0),toggleHidden(n,!1),controls.focusFirstMenuItem.call(this,n,i)}},setDownloadUrl:function(){var e=this.elements.buttons.download;is$1.element(e)&&e.setAttribute("href",this.download)},create:function(e){var t=this,i=controls.bindMenuItemShortcuts,n=controls.createButton,s=controls.createProgress,a=controls.createRange,r=controls.createTime,o=controls.setQualityMenu,l=controls.setSpeedMenu,c=controls.showMenuPanel;this.elements.controls=null,is$1.array(this.config.controls)&&this.config.controls.includes("play-large")&&this.elements.container.appendChild(n.call(this,"play-large"));var u=createElement("div",getAttributesFromSelector(this.config.selectors.controls.wrapper));this.elements.controls=u;var d={class:"plyr__controls__item"};return dedupe(is$1.array(this.config.controls)?this.config.controls:[]).forEach((function(o){if("restart"===o&&u.appendChild(n.call(t,"restart",d)),"rewind"===o&&u.appendChild(n.call(t,"rewind",d)),"play"===o&&u.appendChild(n.call(t,"play",d)),"fast-forward"===o&&u.appendChild(n.call(t,"fast-forward",d)),"progress"===o){var l=createElement("div",{class:"".concat(d.class," plyr__progress__container")}),h=createElement("div",getAttributesFromSelector(t.config.selectors.progress));if(h.appendChild(a.call(t,"seek",{id:"plyr-seek-".concat(e.id)})),h.appendChild(s.call(t,"buffer")),t.config.tooltips.seek){var m=createElement("span",{class:t.config.classNames.tooltip},"00:00");h.appendChild(m),t.elements.display.seekTooltip=m}t.elements.progress=h,l.appendChild(t.elements.progress),u.appendChild(l)}if("current-time"===o&&u.appendChild(r.call(t,"currentTime",d)),"duration"===o&&u.appendChild(r.call(t,"duration",d)),"mute"===o||"volume"===o){var p=t.elements.volume;if(is$1.element(p)&&u.contains(p)||(p=createElement("div",extend({},d,{class:"".concat(d.class," plyr__volume").trim()})),t.elements.volume=p,u.appendChild(p)),"mute"===o&&p.appendChild(n.call(t,"mute")),"volume"===o&&!browser.isIos){var g={max:1,step:.05,value:t.config.volume};p.appendChild(a.call(t,"volume",extend(g,{id:"plyr-volume-".concat(e.id)})))}}if("captions"===o&&u.appendChild(n.call(t,"captions",d)),"settings"===o&&!is$1.empty(t.config.settings)){var f=createElement("div",extend({},d,{class:"".concat(d.class," plyr__menu").trim(),hidden:""}));f.appendChild(n.call(t,"settings",{"aria-haspopup":!0,"aria-controls":"plyr-settings-".concat(e.id),"aria-expanded":!1}));var y=createElement("div",{class:"plyr__menu__container",id:"plyr-settings-".concat(e.id),hidden:""}),v=createElement("div"),b=createElement("div",{id:"plyr-settings-".concat(e.id,"-home")}),w=createElement("div",{role:"menu"});b.appendChild(w),v.appendChild(b),t.elements.settings.panels.home=b,t.config.settings.forEach((function(n){var s=createElement("button",extend(getAttributesFromSelector(t.config.selectors.buttons.settings),{type:"button",class:"".concat(t.config.classNames.control," ").concat(t.config.classNames.control,"--forward"),role:"menuitem","aria-haspopup":!0,hidden:""}));i.call(t,s,n),on.call(t,s,"click",(function(){c.call(t,n,!1)}));var a=createElement("span",null,i18n.get(n,t.config)),r=createElement("span",{class:t.config.classNames.menu.value});r.innerHTML=e[n],a.appendChild(r),s.appendChild(a),w.appendChild(s);var o=createElement("div",{id:"plyr-settings-".concat(e.id,"-").concat(n),hidden:""}),l=createElement("button",{type:"button",class:"".concat(t.config.classNames.control," ").concat(t.config.classNames.control,"--back")});l.appendChild(createElement("span",{"aria-hidden":!0},i18n.get(n,t.config))),l.appendChild(createElement("span",{class:t.config.classNames.hidden},i18n.get("menuBack",t.config))),on.call(t,o,"keydown",(function(e){37===e.which&&(e.preventDefault(),e.stopPropagation(),c.call(t,"home",!0))}),!1),on.call(t,l,"click",(function(){c.call(t,"home",!1)})),o.appendChild(l),o.appendChild(createElement("div",{role:"menu"})),o.appendChild(createElement("div",{role:"menucaptions"})),v.appendChild(o),t.elements.settings.buttons[n]=s,t.elements.settings.panels[n]=o})),y.appendChild(v),f.appendChild(y),u.appendChild(f),t.elements.settings.popup=y,t.elements.settings.menu=f}if("pip"===o&&support.pip&&u.appendChild(n.call(t,"pip",d)),"airplay"===o&&support.airplay&&u.appendChild(n.call(t,"airplay",d)),"download"===o){var k=extend({},d,{element:"a",href:t.download,target:"_blank"});t.isHTML5&&(k.download="");var T=t.config.urls.download;!is$1.url(T)&&t.isEmbed&&extend(k,{icon:"logo-".concat(t.provider),label:t.provider}),u.appendChild(n.call(t,"download",k))}"fullscreen"===o&&u.appendChild(n.call(t,"fullscreen",d))})),this.isHTML5&&o.call(this,html5.getQualityOptions.call(this)),l.call(this),u},inject:function(){var e=this;if(this.config.loadSprite){var t=controls.getIconUrl.call(this);t.cors&&loadSprite(t.url,"sprite-plyr")}this.id=Math.floor(1e4*Math.random());var i=null;this.elements.controls=null;var n={id:this.id,seektime:this.config.seekTime,title:this.config.title},s=!0;is$1.function(this.config.controls)&&(this.config.controls=this.config.controls.call(this,n)),this.config.controls||(this.config.controls=[]),is$1.element(this.config.controls)||is$1.string(this.config.controls)?i=this.config.controls:(i=controls.create.call(this,{id:this.id,seektime:this.config.seekTime,speed:this.speed,quality:this.quality,captions:captions.getLabel.call(this)}),s=!1);var a,r;if(s&&is$1.string(this.config.controls)&&(a=i,Object.entries(n).forEach((function(e){var t=_slicedToArray(e,2),i=t[0],n=t[1];a=replaceAll(a,"{".concat(i,"}"),n)})),i=a),is$1.string(this.config.selectors.controls.container)&&(r=document.querySelector(this.config.selectors.controls.container)),is$1.element(r)||(r=this.elements.container),r[is$1.element(i)?"insertAdjacentElement":"insertAdjacentHTML"]("afterbegin",i),is$1.element(this.elements.controls)||controls.findElements.call(this),!is$1.empty(this.elements.buttons)){var o=function(t){var i=e.config.classNames.controlPressed;Object.defineProperty(t,"pressed",{enumerable:!0,get:function(){return hasClass(t,i)},set:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];toggleClass(t,i,e)}})};Object.values(this.elements.buttons).filter(Boolean).forEach((function(e){is$1.array(e)||is$1.nodeList(e)?Array.from(e).filter(Boolean).forEach(o):o(e)}))}if(browser.isEdge&&repaint(r),this.config.tooltips.controls){var l=this.config,c=l.classNames,u=l.selectors,d="".concat(u.controls.wrapper," ").concat(u.labels," .").concat(c.hidden),h=getElements.call(this,d);Array.from(h).forEach((function(t){toggleClass(t,e.config.classNames.hidden,!1),toggleClass(t,e.config.classNames.tooltip,!0)}))}}};function parseUrl(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=e;if(t){var n=document.createElement("a");n.href=i,i=n.href}try{return new URL(i)}catch(e){return null}}function buildUrlParams(e){var t=new URLSearchParams;return is$1.object(e)&&Object.entries(e).forEach((function(e){var i=_slicedToArray(e,2),n=i[0],s=i[1];t.set(n,s)})),t}var captions={setup:function(){if(this.supported.ui)if(!this.isVideo||this.isYouTube||this.isHTML5&&!support.textTracks)is$1.array(this.config.controls)&&this.config.controls.includes("settings")&&this.config.settings.includes("captions")&&controls.setCaptionsMenu.call(this);else{if(is$1.element(this.elements.captions)||(this.elements.captions=createElement("div",getAttributesFromSelector(this.config.selectors.captions)),insertAfter(this.elements.captions,this.elements.wrapper)),browser.isIE&&window.URL){var e=this.media.querySelectorAll("track");Array.from(e).forEach((function(e){var t=e.getAttribute("src"),i=parseUrl(t);null!==i&&i.hostname!==window.location.href.hostname&&["http:","https:"].includes(i.protocol)&&fetch(t,"blob").then((function(t){e.setAttribute("src",window.URL.createObjectURL(t))})).catch((function(){removeElement(e)}))}))}var t=dedupe((navigator.languages||[navigator.language||navigator.userLanguage||"en"]).map((function(e){return e.split("-")[0]}))),i=(this.storage.get("language")||this.config.captions.language||"auto").toLowerCase();if("auto"===i)i=_slicedToArray(t,1)[0];var n=this.storage.get("captions");if(is$1.boolean(n)||(n=this.config.captions.active),Object.assign(this.captions,{toggled:!1,active:n,language:i,languages:t}),this.isHTML5){var s=this.config.captions.update?"addtrack removetrack":"removetrack";on.call(this,this.media.textTracks,s,captions.update.bind(this))}setTimeout(captions.update.bind(this),0)}},update:function(){var e=this,t=captions.getTracks.call(this,!0),i=this.captions,n=i.active,s=i.language,a=i.meta,r=i.currentTrackNode,o=Boolean(t.find((function(e){return e.language===s})));this.isHTML5&&this.isVideo&&t.filter((function(e){return!a.get(e)})).forEach((function(t){e.debug.log("Track added",t),a.set(t,{default:"showing"===t.mode}),"showing"===t.mode&&(t.mode="hidden"),on.call(e,t,"cuechange",(function(){return captions.updateCues.call(e)}))})),(o&&this.language!==s||!t.includes(r))&&(captions.setLanguage.call(this,s),captions.toggle.call(this,n&&o)),toggleClass(this.elements.container,this.config.classNames.captions.enabled,!is$1.empty(t)),is$1.array(this.config.controls)&&this.config.controls.includes("settings")&&this.config.settings.includes("captions")&&controls.setCaptionsMenu.call(this)},toggle:function(e){var t=this,i=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.supported.ui){var n=this.captions.toggled,s=this.config.classNames.captions.active,a=is$1.nullOrUndefined(e)?!n:e;if(a!==n){if(i||(this.captions.active=a,this.storage.set({captions:a})),!this.language&&a&&!i){var r=captions.getTracks.call(this),o=captions.findTrack.call(this,[this.captions.language].concat(_toConsumableArray(this.captions.languages)),!0);return this.captions.language=o.language,void captions.set.call(this,r.indexOf(o))}this.elements.buttons.captions&&(this.elements.buttons.captions.pressed=a),toggleClass(this.elements.container,s,a),this.captions.toggled=a,controls.updateSetting.call(this,"captions"),triggerEvent.call(this,this.media,a?"captionsenabled":"captionsdisabled")}setTimeout((function(){a&&t.captions.toggled&&(t.captions.currentTrackNode.mode="hidden")}))}},set:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=captions.getTracks.call(this);if(-1!==e)if(is$1.number(e))if(e in i){if(this.captions.currentTrack!==e){this.captions.currentTrack=e;var n=i[e],s=n||{},a=s.language;this.captions.currentTrackNode=n,controls.updateSetting.call(this,"captions"),t||(this.captions.language=a,this.storage.set({language:a})),this.isVimeo&&this.embed.enableTextTrack(a),triggerEvent.call(this,this.media,"languagechange")}captions.toggle.call(this,!0,t),this.isHTML5&&this.isVideo&&captions.updateCues.call(this)}else this.debug.warn("Track not found",e);else this.debug.warn("Invalid caption argument",e);else captions.toggle.call(this,!1,t)},setLanguage:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(is$1.string(e)){var i=e.toLowerCase();this.captions.language=i;var n=captions.getTracks.call(this),s=captions.findTrack.call(this,[i]);captions.set.call(this,n.indexOf(s),t)}else this.debug.warn("Invalid language argument",e)},getTracks:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],i=Array.from((this.media||{}).textTracks||[]);return i.filter((function(i){return!e.isHTML5||t||e.captions.meta.has(i)})).filter((function(e){return["captions","subtitles"].includes(e.kind)}))},findTrack:function(e){var t,i=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],s=captions.getTracks.call(this),a=function(e){return Number((i.captions.meta.get(e)||{}).default)},r=Array.from(s).sort((function(e,t){return a(t)-a(e)}));return e.every((function(e){return!(t=r.find((function(t){return t.language===e})))})),t||(n?r[0]:void 0)},getCurrentTrack:function(){return captions.getTracks.call(this)[this.currentTrack]},getLabel:function(e){var t=e;return!is$1.track(t)&&support.textTracks&&this.captions.toggled&&(t=captions.getCurrentTrack.call(this)),is$1.track(t)?is$1.empty(t.label)?is$1.empty(t.language)?i18n.get("enabled",this.config):e.language.toUpperCase():t.label:i18n.get("disabled",this.config)},updateCues:function(e){if(this.supported.ui)if(is$1.element(this.elements.captions))if(is$1.nullOrUndefined(e)||Array.isArray(e)){var t=e;if(!t){var i=captions.getCurrentTrack.call(this);t=Array.from((i||{}).activeCues||[]).map((function(e){return e.getCueAsHTML()})).map(getHTML)}var n=t.map((function(e){return e.trim()})).join("\n");if(n!==this.elements.captions.innerHTML){emptyElement(this.elements.captions);var s=createElement("span",getAttributesFromSelector(this.config.selectors.caption));s.innerHTML=n,this.elements.captions.appendChild(s),triggerEvent.call(this,this.media,"cuechange")}}else this.debug.warn("updateCues: Invalid input",e);else this.debug.warn("No captions element to render to")}},defaults$1={enabled:!0,title:"",debug:!1,autoplay:!1,autopause:!0,playsinline:!0,seekTime:10,volume:1,muted:!1,duration:null,displayDuration:!0,invertTime:!0,toggleInvert:!0,ratio:null,clickToPlay:!0,hideControls:!0,resetOnEnd:!1,disableContextMenu:!0,loadSprite:!0,iconPrefix:"plyr",iconUrl:"/theme/modules/plyr/plyr.svg",blankVideo:"/theme/modules/plyr/blank.webm",quality:{default:576,options:[4320,2880,2160,1440,1080,720,576,480,360,240],forced:!1,onChange:null},loop:{active:!1},speed:{selected:1,options:[.5,.75,1,1.25,1.5,1.75,2,4]},keyboard:{focused:!0,global:!1},tooltips:{controls:!1,seek:!0},captions:{active:!1,language:"auto",update:!1},fullscreen:{enabled:!0,fallback:!0,iosNative:!1},storage:{enabled:!0,key:"plyr"},controls:["play-large","play","progress","current-time","mute","volume","captions","settings","pip","airplay","fullscreen"],settings:["captions","quality","speed"],i18n:{restart:"Restart",rewind:"Rewind {seektime}s",play:"Play",pause:"Pause",fastForward:"Forward {seektime}s",seek:"Seek",seekLabel:"{currentTime} of {duration}",played:"Played",buffered:"Buffered",currentTime:"Current time",duration:"Duration",volume:"Volume",mute:"Mute",unmute:"Unmute",enableCaptions:"Enable captions",disableCaptions:"Disable captions",download:"Download",enterFullscreen:"Enter fullscreen",exitFullscreen:"Exit fullscreen",frameTitle:"Player for {title}",captions:"Captions",settings:"Settings",pip:"PIP",menuBack:"Go back to previous menu",speed:"Speed",normal:"Normal",quality:"Quality",loop:"Loop",start:"Start",end:"End",all:"All",reset:"Reset",disabled:"Disabled",enabled:"Enabled",advertisement:"Ad",qualityBadge:{2160:"4K",1440:"HD",1080:"HD",720:"HD",576:"SD",480:"SD"}},urls:{download:null,vimeo:{sdk:"https://player.vimeo.com/api/player.js",iframe:"https://player.vimeo.com/video/{0}?{1}",api:"https://vimeo.com/api/v2/video/{0}.json"},youtube:{sdk:"https://www.youtube.com/iframe_api",api:"https://noembed.com/embed?url=https://www.youtube.com/watch?v={0}"},googleIMA:{sdk:"https://imasdk.googleapis.com/js/sdkloader/ima3.js"}},listeners:{seek:null,play:null,pause:null,restart:null,rewind:null,fastForward:null,mute:null,volume:null,captions:null,download:null,fullscreen:null,pip:null,airplay:null,speed:null,quality:null,loop:null,language:null},events:["ended","progress","stalled","playing","waiting","canplay","canplaythrough","loadstart","loadeddata","loadedmetadata","timeupdate","volumechange","play","pause","error","seeking","seeked","emptied","ratechange","cuechange","download","enterfullscreen","exitfullscreen","captionsenabled","captionsdisabled","languagechange","controlshidden","controlsshown","ready","statechange","qualitychange","adsloaded","adscontentpause","adscontentresume","adstarted","adsmidpoint","adscomplete","adsallcomplete","adsimpression","adsclick"],selectors:{editable:"input, textarea, select, [contenteditable]",container:".plyr",controls:{container:null,wrapper:".plyr__controls"},labels:"[data-plyr]",buttons:{play:'[data-plyr="play"]',pause:'[data-plyr="pause"]',restart:'[data-plyr="restart"]',rewind:'[data-plyr="rewind"]',fastForward:'[data-plyr="fast-forward"]',mute:'[data-plyr="mute"]',captions:'[data-plyr="captions"]',download:'[data-plyr="download"]',fullscreen:'[data-plyr="fullscreen"]',pip:'[data-plyr="pip"]',airplay:'[data-plyr="airplay"]',settings:'[data-plyr="settings"]',loop:'[data-plyr="loop"]'},inputs:{seek:'[data-plyr="seek"]',volume:'[data-plyr="volume"]',speed:'[data-plyr="speed"]',language:'[data-plyr="language"]',quality:'[data-plyr="quality"]'},display:{currentTime:".plyr__time--current",duration:".plyr__time--duration",buffer:".plyr__progress__buffer",loop:".plyr__progress__loop",volume:".plyr__volume--display"},progress:".plyr__progress",captions:".plyr__captions",caption:".plyr__caption"},classNames:{type:"plyr--{0}",provider:"plyr--{0}",video:"plyr__video-wrapper",embed:"plyr__video-embed",videoFixedRatio:"plyr__video-wrapper--fixed-ratio",embedContainer:"plyr__video-embed__container",poster:"plyr__poster",posterEnabled:"plyr__poster-enabled",ads:"plyr__ads",control:"plyr__control",controlPressed:"plyr__control--pressed",playing:"plyr--playing",paused:"plyr--paused",stopped:"plyr--stopped",loading:"plyr--loading",hover:"plyr--hover",tooltip:"plyr__tooltip",cues:"plyr__cues",hidden:"plyr__sr-only",hideControls:"plyr--hide-controls",isIos:"plyr--is-ios",isTouch:"plyr--is-touch",uiSupported:"plyr--full-ui",noTransition:"plyr--no-transition",display:{time:"plyr__time"},menu:{value:"plyr__menu__value",badge:"plyr__badge",open:"plyr--menu-open"},captions:{enabled:"plyr--captions-enabled",active:"plyr--captions-active"},fullscreen:{enabled:"plyr--fullscreen-enabled",fallback:"plyr--fullscreen-fallback"},pip:{supported:"plyr--pip-supported",active:"plyr--pip-active"},airplay:{supported:"plyr--airplay-supported",active:"plyr--airplay-active"},tabFocus:"plyr__tab-focus",previewThumbnails:{thumbContainer:"plyr__preview-thumb",thumbContainerShown:"plyr__preview-thumb--is-shown",imageContainer:"plyr__preview-thumb__image-container",timeContainer:"plyr__preview-thumb__time-container",scrubbingContainer:"plyr__preview-scrubbing",scrubbingContainerShown:"plyr__preview-scrubbing--is-shown"}},attributes:{embed:{provider:"data-plyr-provider",id:"data-plyr-embed-id"}},ads:{enabled:!1,publisherId:"",tagUrl:""},previewThumbnails:{enabled:!1,src:""},vimeo:{byline:!1,portrait:!1,title:!1,speed:!0,transparent:!1,premium:!1,referrerPolicy:null},youtube:{noCookie:!0,rel:0,showinfo:0,iv_load_policy:3,modestbranding:1}},pip={active:"picture-in-picture",inactive:"inline"},providers={html5:"html5",youtube:"youtube",vimeo:"vimeo"},types={audio:"audio",video:"video"};function getProviderByUrl(e){return/^(https?:\/\/)?(www\.)?(youtube\.com|youtube-nocookie\.com|youtu\.?be)\/.+$/.test(e)?providers.youtube:/^https?:\/\/player.vimeo.com\/video\/\d{0,9}(?=\b|\/)/.test(e)?providers.vimeo:null}var noop=function(){},Console=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];_classCallCheck(this,e),this.enabled=window.console&&t,this.enabled&&this.log("Debugging enabled")}return _createClass(e,[{key:"log",get:function(){return this.enabled?Function.prototype.bind.call(console.log,console):noop}},{key:"warn",get:function(){return this.enabled?Function.prototype.bind.call(console.warn,console):noop}},{key:"error",get:function(){return this.enabled?Function.prototype.bind.call(console.error,console):noop}}]),e}(),Fullscreen=function(){function e(t){var i=this;_classCallCheck(this,e),this.player=t,this.prefix=e.prefix,this.property=e.property,this.scrollPosition={x:0,y:0},this.forceFallback="force"===t.config.fullscreen.fallback,this.player.elements.fullscreen=t.config.fullscreen.container&&closest(this.player.elements.container,t.config.fullscreen.container),on.call(this.player,document,"ms"===this.prefix?"MSFullscreenChange":"".concat(this.prefix,"fullscreenchange"),(function(){i.onChange()})),on.call(this.player,this.player.elements.container,"dblclick",(function(e){is$1.element(i.player.elements.controls)&&i.player.elements.controls.contains(e.target)||i.toggle()})),on.call(this,this.player.elements.container,"keydown",(function(e){return i.trapFocus(e)})),this.update()}return _createClass(e,[{key:"onChange",value:function(){if(this.enabled){var e=this.player.elements.buttons.fullscreen;is$1.element(e)&&(e.pressed=this.active),triggerEvent.call(this.player,this.target,this.active?"enterfullscreen":"exitfullscreen",!0)}}},{key:"toggleFallback",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(e?this.scrollPosition={x:window.scrollX||0,y:window.scrollY||0}:window.scrollTo(this.scrollPosition.x,this.scrollPosition.y),document.body.style.overflow=e?"hidden":"",toggleClass(this.target,this.player.config.classNames.fullscreen.fallback,e),browser.isIos){var t=document.head.querySelector('meta[name="viewport"]'),i="viewport-fit=cover";t||(t=document.createElement("meta")).setAttribute("name","viewport");var n=is$1.string(t.content)&&t.content.includes(i);e?(this.cleanupViewport=!n,n||(t.content+=",".concat(i))):this.cleanupViewport&&(t.content=t.content.split(",").filter((function(e){return e.trim()!==i})).join(","))}this.onChange()}},{key:"trapFocus",value:function(e){if(!browser.isIos&&this.active&&"Tab"===e.key&&9===e.keyCode){var t=document.activeElement,i=getElements.call(this.player,"a[href], button:not(:disabled), input:not(:disabled), [tabindex]"),n=_slicedToArray(i,1)[0],s=i[i.length-1];t!==s||e.shiftKey?t===n&&e.shiftKey&&(s.focus(),e.preventDefault()):(n.focus(),e.preventDefault())}}},{key:"update",value:function(){var t;this.enabled?(t=this.forceFallback?"Fallback (forced)":e.native?"Native":"Fallback",this.player.debug.log("".concat(t," fullscreen enabled"))):this.player.debug.log("Fullscreen not supported and fallback disabled");toggleClass(this.player.elements.container,this.player.config.classNames.fullscreen.enabled,this.enabled)}},{key:"enter",value:function(){this.enabled&&(browser.isIos&&this.player.config.fullscreen.iosNative?this.target.webkitEnterFullscreen():!e.native||this.forceFallback?this.toggleFallback(!0):this.prefix?is$1.empty(this.prefix)||this.target["".concat(this.prefix,"Request").concat(this.property)]():this.target.requestFullscreen({navigationUI:"hide"}))}},{key:"exit",value:function(){if(this.enabled)if(browser.isIos&&this.player.config.fullscreen.iosNative)this.target.webkitExitFullscreen(),silencePromise(this.player.play());else if(!e.native||this.forceFallback)this.toggleFallback(!1);else if(this.prefix){if(!is$1.empty(this.prefix)){var t="moz"===this.prefix?"Cancel":"Exit";document["".concat(this.prefix).concat(t).concat(this.property)]()}}else(document.cancelFullScreen||document.exitFullscreen).call(document)}},{key:"toggle",value:function(){this.active?this.exit():this.enter()}},{key:"usingNative",get:function(){return e.native&&!this.forceFallback}},{key:"enabled",get:function(){return(e.native||this.player.config.fullscreen.fallback)&&this.player.config.fullscreen.enabled&&this.player.supported.ui&&this.player.isVideo}},{key:"active",get:function(){if(!this.enabled)return!1;if(!e.native||this.forceFallback)return hasClass(this.target,this.player.config.classNames.fullscreen.fallback);var t=this.prefix?document["".concat(this.prefix).concat(this.property,"Element")]:document.fullscreenElement;return t&&t.shadowRoot?t===this.target.getRootNode().host:t===this.target}},{key:"target",get:function(){return browser.isIos&&this.player.config.fullscreen.iosNative?this.player.media:this.player.elements.fullscreen||this.player.elements.container}}],[{key:"native",get:function(){return!!(document.fullscreenEnabled||document.webkitFullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled)}},{key:"prefix",get:function(){if(is$1.function(document.exitFullscreen))return"";var e="";return["webkit","moz","ms"].some((function(t){return!(!is$1.function(document["".concat(t,"ExitFullscreen")])&&!is$1.function(document["".concat(t,"CancelFullScreen")]))&&(e=t,!0)})),e}},{key:"property",get:function(){return"moz"===this.prefix?"FullScreen":"Fullscreen"}}]),e}();function loadImage(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return new Promise((function(i,n){var s=new Image,a=function(){delete s.onload,delete s.onerror,(s.naturalWidth>=t?i:n)(s)};Object.assign(s,{onload:a,onerror:a,src:e})}))}var ui={addStyleHook:function(){toggleClass(this.elements.container,this.config.selectors.container.replace(".",""),!0),toggleClass(this.elements.container,this.config.classNames.uiSupported,this.supported.ui)},toggleNativeControls:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];e&&this.isHTML5?this.media.setAttribute("controls",""):this.media.removeAttribute("controls")},build:function(){var e=this;if(this.listeners.media(),!this.supported.ui)return this.debug.warn("Basic support only for ".concat(this.provider," ").concat(this.type)),void ui.toggleNativeControls.call(this,!0);is$1.element(this.elements.controls)||(controls.inject.call(this),this.listeners.controls()),ui.toggleNativeControls.call(this),this.isHTML5&&captions.setup.call(this),this.volume=null,this.muted=null,this.loop=null,this.quality=null,this.speed=null,controls.updateVolume.call(this),controls.timeUpdate.call(this),ui.checkPlaying.call(this),toggleClass(this.elements.container,this.config.classNames.pip.supported,support.pip&&this.isHTML5&&this.isVideo),toggleClass(this.elements.container,this.config.classNames.airplay.supported,support.airplay&&this.isHTML5),toggleClass(this.elements.container,this.config.classNames.isIos,browser.isIos),toggleClass(this.elements.container,this.config.classNames.isTouch,this.touch),this.ready=!0,setTimeout((function(){triggerEvent.call(e,e.media,"ready")}),0),ui.setTitle.call(this),this.poster&&ui.setPoster.call(this,this.poster,!1).catch((function(){})),this.config.duration&&controls.durationUpdate.call(this)},setTitle:function(){var e=i18n.get("play",this.config);if(is$1.string(this.config.title)&&!is$1.empty(this.config.title)&&(e+=", ".concat(this.config.title)),Array.from(this.elements.buttons.play||[]).forEach((function(t){t.setAttribute("aria-label",e)})),this.isEmbed){var t=getElement.call(this,"iframe");if(!is$1.element(t))return;var i=is$1.empty(this.config.title)?"video":this.config.title,n=i18n.get("frameTitle",this.config);t.setAttribute("title",n.replace("{title}",i))}},togglePoster:function(e){toggleClass(this.elements.container,this.config.classNames.posterEnabled,e)},setPoster:function(e){var t=this,i=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return i&&this.poster?Promise.reject(new Error("Poster already set")):(this.media.setAttribute("data-poster",e),ready.call(this).then((function(){return loadImage(e)})).catch((function(i){throw e===t.poster&&ui.togglePoster.call(t,!1),i})).then((function(){if(e!==t.poster)throw new Error("setPoster cancelled by later call to setPoster")})).then((function(){return Object.assign(t.elements.poster.style,{backgroundImage:"url('".concat(e,"')"),backgroundSize:""}),ui.togglePoster.call(t,!0),e})))},checkPlaying:function(e){var t=this;toggleClass(this.elements.container,this.config.classNames.playing,this.playing),toggleClass(this.elements.container,this.config.classNames.paused,this.paused),toggleClass(this.elements.container,this.config.classNames.stopped,this.stopped),Array.from(this.elements.buttons.play||[]).forEach((function(e){Object.assign(e,{pressed:t.playing}),e.setAttribute("aria-label",i18n.get(t.playing?"pause":"play",t.config))})),is$1.event(e)&&"timeupdate"===e.type||ui.toggleControls.call(this)},checkLoading:function(e){var t=this;this.loading=["stalled","waiting"].includes(e.type),clearTimeout(this.timers.loading),this.timers.loading=setTimeout((function(){toggleClass(t.elements.container,t.config.classNames.loading,t.loading),ui.toggleControls.call(t)}),this.loading?250:0)},toggleControls:function(e){var t=this.elements.controls;if(t&&this.config.hideControls){var i=this.touch&&this.lastSeekTime+2e3>Date.now();this.toggleControls(Boolean(e||this.loading||this.paused||t.pressed||t.hover||i))}},migrateStyles:function(){var e=this;Object.values(_objectSpread2({},this.media.style)).filter((function(e){return!is$1.empty(e)&&e.startsWith("--plyr")})).forEach((function(t){e.elements.container.style.setProperty(t,e.media.style.getPropertyValue(t)),e.media.style.removeProperty(t)})),is$1.empty(this.media.style)&&this.media.removeAttribute("style")}},Listeners=function(){function e(t){_classCallCheck(this,e),this.player=t,this.lastKey=null,this.focusTimer=null,this.lastKeyDown=null,this.handleKey=this.handleKey.bind(this),this.toggleMenu=this.toggleMenu.bind(this),this.setTabFocus=this.setTabFocus.bind(this),this.firstTouch=this.firstTouch.bind(this)}return _createClass(e,[{key:"handleKey",value:function(e){var t=this.player,i=t.elements,n=e.keyCode?e.keyCode:e.which,s="keydown"===e.type,a=s&&n===this.lastKey;if(!(e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)&&is$1.number(n)){if(s){var r=document.activeElement;if(is$1.element(r)){var o=t.config.selectors.editable;if(r!==i.inputs.seek&&matches$1(r,o))return;if(32===e.which&&matches$1(r,'button, [role^="menuitem"]'))return}switch([32,37,38,39,40,48,49,50,51,52,53,54,56,57,67,70,73,75,76,77,79].includes(n)&&(e.preventDefault(),e.stopPropagation()),n){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:a||(t.currentTime=t.duration/10*(n-48));break;case 32:case 75:a||silencePromise(t.togglePlay());break;case 38:t.increaseVolume(.1);break;case 40:t.decreaseVolume(.1);break;case 77:a||(t.muted=!t.muted);break;case 39:t.forward();break;case 37:t.rewind();break;case 70:t.fullscreen.toggle();break;case 67:a||t.toggleCaptions();break;case 76:t.loop=!t.loop}27===n&&!t.fullscreen.usingNative&&t.fullscreen.active&&t.fullscreen.toggle(),this.lastKey=n}else this.lastKey=null}}},{key:"toggleMenu",value:function(e){controls.toggleMenu.call(this.player,e)}},{key:"firstTouch",value:function(){var e=this.player,t=e.elements;e.touch=!0,toggleClass(t.container,e.config.classNames.isTouch,!0)}},{key:"setTabFocus",value:function(e){var t=this.player,i=t.elements;if(clearTimeout(this.focusTimer),"keydown"!==e.type||9===e.which){"keydown"===e.type&&(this.lastKeyDown=e.timeStamp);var n,s=e.timeStamp-this.lastKeyDown<=20;if("focus"!==e.type||s)n=t.config.classNames.tabFocus,toggleClass(getElements.call(t,".".concat(n)),n,!1),"focusout"!==e.type&&(this.focusTimer=setTimeout((function(){var e=document.activeElement;i.container.contains(e)&&toggleClass(document.activeElement,t.config.classNames.tabFocus,!0)}),10))}}},{key:"global",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=this.player;t.config.keyboard.global&&toggleListener.call(t,window,"keydown keyup",this.handleKey,e,!1),toggleListener.call(t,document.body,"click",this.toggleMenu,e),once.call(t,document.body,"touchstart",this.firstTouch),toggleListener.call(t,document.body,"keydown focus blur focusout",this.setTabFocus,e,!1,!0)}},{key:"container",value:function(){var e=this.player,t=e.config,i=e.elements,n=e.timers;!t.keyboard.global&&t.keyboard.focused&&on.call(e,i.container,"keydown keyup",this.handleKey,!1),on.call(e,i.container,"mousemove mouseleave touchstart touchmove enterfullscreen exitfullscreen",(function(t){var s=i.controls;s&&"enterfullscreen"===t.type&&(s.pressed=!1,s.hover=!1);var a=0;["touchstart","touchmove","mousemove"].includes(t.type)&&(ui.toggleControls.call(e,!0),a=e.touch?3e3:2e3),clearTimeout(n.controls),n.controls=setTimeout((function(){return ui.toggleControls.call(e,!1)}),a)}));var s=function(t){if(!t)return setAspectRatio.call(e);var n=i.container.getBoundingClientRect(),s=n.width,a=n.height;return setAspectRatio.call(e,"".concat(s,":").concat(a))},a=function(){clearTimeout(n.resized),n.resized=setTimeout(s,50)};on.call(e,i.container,"enterfullscreen exitfullscreen",(function(t){var n=e.fullscreen,r=n.target,o=n.usingNative;if(r===i.container&&(e.isEmbed||!is$1.empty(e.config.ratio))){var l="enterfullscreen"===t.type,c=s(l);c.padding;!function(t,i,n){if(e.isVimeo&&!e.config.vimeo.premium){var s=e.elements.wrapper.firstChild,a=_slicedToArray(t,2)[1],r=_slicedToArray(getAspectRatio.call(e),2),o=r[0],l=r[1];s.style.maxWidth=n?"".concat(a/l*o,"px"):null,s.style.margin=n?"0 auto":null}}(c.ratio,0,l),o||(l?on.call(e,window,"resize",a):off.call(e,window,"resize",a))}}))}},{key:"media",value:function(){var e=this,t=this.player,i=t.elements;if(on.call(t,t.media,"timeupdate seeking seeked",(function(e){return controls.timeUpdate.call(t,e)})),on.call(t,t.media,"durationchange loadeddata loadedmetadata",(function(e){return controls.durationUpdate.call(t,e)})),on.call(t,t.media,"ended",(function(){t.isHTML5&&t.isVideo&&t.config.resetOnEnd&&(t.restart(),t.pause())})),on.call(t,t.media,"progress playing seeking seeked",(function(e){return controls.updateProgress.call(t,e)})),on.call(t,t.media,"volumechange",(function(e){return controls.updateVolume.call(t,e)})),on.call(t,t.media,"playing play pause ended emptied timeupdate",(function(e){return ui.checkPlaying.call(t,e)})),on.call(t,t.media,"waiting canplay seeked playing",(function(e){return ui.checkLoading.call(t,e)})),t.supported.ui&&t.config.clickToPlay&&!t.isAudio){var n=getElement.call(t,".".concat(t.config.classNames.video));if(!is$1.element(n))return;on.call(t,i.container,"click",(function(s){([i.container,n].includes(s.target)||n.contains(s.target))&&(t.touch&&t.config.hideControls||(t.ended?(e.proxy(s,t.restart,"restart"),e.proxy(s,(function(){silencePromise(t.play())}),"play")):e.proxy(s,(function(){silencePromise(t.togglePlay())}),"play")))}))}t.supported.ui&&t.config.disableContextMenu&&on.call(t,i.wrapper,"contextmenu",(function(e){e.preventDefault()}),!1),on.call(t,t.media,"volumechange",(function(){t.storage.set({volume:t.volume,muted:t.muted})})),on.call(t,t.media,"ratechange",(function(){controls.updateSetting.call(t,"speed"),t.storage.set({speed:t.speed})})),on.call(t,t.media,"qualitychange",(function(e){controls.updateSetting.call(t,"quality",null,e.detail.quality)})),on.call(t,t.media,"ready qualitychange",(function(){controls.setDownloadUrl.call(t)}));var s=t.config.events.concat(["keyup","keydown"]).join(" ");on.call(t,t.media,s,(function(e){var n=e.detail,s=void 0===n?{}:n;"error"===e.type&&(s=t.media.error),triggerEvent.call(t,i.container,e.type,!0,s)}))}},{key:"proxy",value:function(e,t,i){var n=this.player,s=n.config.listeners[i],a=!0;is$1.function(s)&&(a=s.call(n,e)),!1!==a&&is$1.function(t)&&t.call(n,e)}},{key:"bind",value:function(e,t,i,n){var s=this,a=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],r=this.player,o=r.config.listeners[n],l=is$1.function(o);on.call(r,e,t,(function(e){return s.proxy(e,i,n)}),a&&!l)}},{key:"controls",value:function(){var e=this,t=this.player,i=t.elements,n=browser.isIE?"change":"input";if(i.buttons.play&&Array.from(i.buttons.play).forEach((function(i){e.bind(i,"click",(function(){silencePromise(t.togglePlay())}),"play")})),this.bind(i.buttons.restart,"click",t.restart,"restart"),this.bind(i.buttons.rewind,"click",t.rewind,"rewind"),this.bind(i.buttons.fastForward,"click",t.forward,"fastForward"),this.bind(i.buttons.mute,"click",(function(){t.muted=!t.muted}),"mute"),this.bind(i.buttons.captions,"click",(function(){return t.toggleCaptions()})),this.bind(i.buttons.download,"click",(function(){triggerEvent.call(t,t.media,"download")}),"download"),this.bind(i.buttons.fullscreen,"click",(function(){t.fullscreen.toggle()}),"fullscreen"),this.bind(i.buttons.pip,"click",(function(){t.pip="toggle"}),"pip"),this.bind(i.buttons.airplay,"click",t.airplay,"airplay"),this.bind(i.buttons.settings,"click",(function(e){e.stopPropagation(),e.preventDefault(),controls.toggleMenu.call(t,e)}),null,!1),this.bind(i.buttons.settings,"keyup",(function(e){var i=e.which;[13,32].includes(i)&&(13!==i?(e.preventDefault(),e.stopPropagation(),controls.toggleMenu.call(t,e)):controls.focusFirstMenuItem.call(t,null,!0))}),null,!1),this.bind(i.settings.menu,"keydown",(function(e){27===e.which&&controls.toggleMenu.call(t,e)})),this.bind(i.inputs.seek,"mousedown mousemove",(function(e){var t=i.progress.getBoundingClientRect(),n=100/t.width*(e.pageX-t.left);e.currentTarget.setAttribute("seek-value",n)})),this.bind(i.inputs.seek,"mousedown mouseup keydown keyup touchstart touchend",(function(e){var i=e.currentTarget,n=e.keyCode?e.keyCode:e.which;if(!is$1.keyboardEvent(e)||39===n||37===n){t.lastSeekTime=Date.now();var s=i.hasAttribute("play-on-seeked"),a=["mouseup","touchend","keyup"].includes(e.type);s&&a?(i.removeAttribute("play-on-seeked"),silencePromise(t.play())):!a&&t.playing&&(i.setAttribute("play-on-seeked",""),t.pause())}})),browser.isIos){var s=getElements.call(t,'input[type="range"]');Array.from(s).forEach((function(t){return e.bind(t,n,(function(e){return repaint(e.target)}))}))}this.bind(i.inputs.seek,n,(function(e){var i=e.currentTarget,n=i.getAttribute("seek-value");is$1.empty(n)&&(n=i.value),i.removeAttribute("seek-value"),t.currentTime=n/i.max*t.duration}),"seek"),this.bind(i.progress,"mouseenter mouseleave mousemove",(function(e){return controls.updateSeekTooltip.call(t,e)})),this.bind(i.progress,"mousemove touchmove",(function(e){var i=t.previewThumbnails;i&&i.loaded&&i.startMove(e)})),this.bind(i.progress,"mouseleave touchend click",(function(){var e=t.previewThumbnails;e&&e.loaded&&e.endMove(!1,!0)})),this.bind(i.progress,"mousedown touchstart",(function(e){var i=t.previewThumbnails;i&&i.loaded&&i.startScrubbing(e)})),this.bind(i.progress,"mouseup touchend",(function(e){var i=t.previewThumbnails;i&&i.loaded&&i.endScrubbing(e)})),browser.isWebkit&&Array.from(getElements.call(t,'input[type="range"]')).forEach((function(i){e.bind(i,"input",(function(e){return controls.updateRangeFill.call(t,e.target)}))})),t.config.toggleInvert&&!is$1.element(i.display.duration)&&this.bind(i.display.currentTime,"click",(function(){0!==t.currentTime&&(t.config.invertTime=!t.config.invertTime,controls.timeUpdate.call(t))})),this.bind(i.inputs.volume,n,(function(e){t.volume=e.target.value}),"volume"),this.bind(i.controls,"mouseenter mouseleave",(function(e){i.controls.hover=!t.touch&&"mouseenter"===e.type})),i.fullscreen&&Array.from(i.fullscreen.children).filter((function(e){return!e.contains(i.container)})).forEach((function(n){e.bind(n,"mouseenter mouseleave",(function(e){i.controls.hover=!t.touch&&"mouseenter"===e.type}))})),this.bind(i.controls,"mousedown mouseup touchstart touchend touchcancel",(function(e){i.controls.pressed=["mousedown","touchstart"].includes(e.type)})),this.bind(i.controls,"focusin",(function(){var n=t.config,s=t.timers;toggleClass(i.controls,n.classNames.noTransition,!0),ui.toggleControls.call(t,!0),setTimeout((function(){toggleClass(i.controls,n.classNames.noTransition,!1)}),0);var a=e.touch?3e3:4e3;clearTimeout(s.controls),s.controls=setTimeout((function(){return ui.toggleControls.call(t,!1)}),a)})),this.bind(i.inputs.volume,"wheel",(function(e){var i=e.webkitDirectionInvertedFromDevice,n=_slicedToArray([e.deltaX,-e.deltaY].map((function(e){return i?-e:e})),2),s=n[0],a=n[1],r=Math.sign(Math.abs(s)>Math.abs(a)?s:a);t.increaseVolume(r/50);var o=t.media.volume;(1===r&&o<1||-1===r&&o>0)&&e.preventDefault()}),"volume",!1)}}]),e}(),commonjsGlobal="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function createCommonjsModule(e,t){return e(t={exports:{}},t.exports),t.exports}var loadjs_umd=createCommonjsModule((function(e,t){e.exports=function(){var e=function(){},t={},i={},n={};function s(e,t){if(e){var s=n[e];if(i[e]=t,s)for(;s.length;)s[0](e,t),s.splice(0,1)}}function a(t,i){t.call&&(t={success:t}),i.length?(t.error||e)(i):(t.success||e)(t)}function r(t,i,n,s){var a,o,l=document,c=n.async,u=(n.numRetries||0)+1,d=n.before||e,h=t.replace(/[\?|#].*$/,""),m=t.replace(/^(css|img)!/,"");s=s||0,/(^css!|\.css$)/.test(h)?((o=l.createElement("link")).rel="stylesheet",o.href=m,(a="hideFocus"in o)&&o.relList&&(a=0,o.rel="preload",o.as="style")):/(^img!|\.(png|gif|jpg|svg|webp)$)/.test(h)?(o=l.createElement("img")).src=m:((o=l.createElement("script")).src=t,o.async=void 0===c||c),o.onload=o.onerror=o.onbeforeload=function(e){var l=e.type[0];if(a)try{o.sheet.cssText.length||(l="e")}catch(e){18!=e.code&&(l="e")}if("e"==l){if((s+=1)<u)return r(t,i,n,s)}else if("preload"==o.rel&&"style"==o.as)return o.rel="stylesheet";i(t,l,e.defaultPrevented)},!1!==d(t,o)&&l.head.appendChild(o)}function o(e,i,n){var o,l;if(i&&i.trim&&(o=i),l=(o?n:i)||{},o){if(o in t)throw"LoadJS";t[o]=!0}function c(t,i){!function(e,t,i){var n,s,a=(e=e.push?e:[e]).length,o=a,l=[];for(n=function(e,i,n){if("e"==i&&l.push(e),"b"==i){if(!n)return;l.push(e)}--a||t(l)},s=0;s<o;s++)r(e[s],n,i)}(e,(function(e){a(l,e),t&&a({success:t,error:i},e),s(o,e)}),l)}if(l.returnPromise)return new Promise(c);c()}return o.ready=function(e,t){return function(e,t){e=e.push?e:[e];var s,a,r,o=[],l=e.length,c=l;for(s=function(e,i){i.length&&o.push(e),--c||t(o)};l--;)a=e[l],(r=i[a])?s(a,r):(n[a]=n[a]||[]).push(s)}(e,(function(e){a(t,e)})),o},o.done=function(e){s(e,[])},o.reset=function(){t={},i={},n={}},o.isDefined=function(e){return e in t},o}()}));function loadScript(e){return new Promise((function(t,i){loadjs_umd(e,{success:t,error:i})}))}function parseId(e){if(is$1.empty(e))return null;if(is$1.number(Number(e)))return e;return e.match(/^.*(vimeo.com\/|video\/)(\d+).*/)?RegExp.$2:e}function assurePlaybackState(e){e&&!this.embed.hasPlayed&&(this.embed.hasPlayed=!0),this.media.paused===e&&(this.media.paused=!e,triggerEvent.call(this,this.media,e?"play":"pause"))}var vimeo={setup:function(){var e=this;toggleClass(e.elements.wrapper,e.config.classNames.embed,!0),e.options.speed=e.config.speed.options,setAspectRatio.call(e),is$1.object(window.Vimeo)?vimeo.ready.call(e):loadScript(e.config.urls.vimeo.sdk).then((function(){vimeo.ready.call(e)})).catch((function(t){e.debug.warn("Vimeo SDK (player.js) failed to load",t)}))},ready:function(){var e=this,t=this,i=t.config.vimeo,n=i.premium,s=i.referrerPolicy,a=_objectWithoutProperties(i,["premium","referrerPolicy"]);n&&Object.assign(a,{controls:!1,sidedock:!1});var r=buildUrlParams(_objectSpread2({loop:t.config.loop.active,autoplay:t.autoplay,muted:t.muted,gesture:"media",playsinline:!this.config.fullscreen.iosNative},a)),o=t.media.getAttribute("src");is$1.empty(o)&&(o=t.media.getAttribute(t.config.attributes.embed.id));var l=parseId(o),c=createElement("iframe"),u=format(t.config.urls.vimeo.iframe,l,r);c.setAttribute("src",u),c.setAttribute("allowfullscreen",""),c.setAttribute("allow","autoplay,fullscreen,picture-in-picture"),is$1.empty(s)||c.setAttribute("referrerPolicy",s);var d=t.poster;if(n)c.setAttribute("data-poster",d),t.media=replaceElement(c,t.media);else{var h=createElement("div",{class:t.config.classNames.embedContainer,"data-poster":d});h.appendChild(c),t.media=replaceElement(h,t.media)}fetch(format(t.config.urls.vimeo.api,l),"json").then((function(e){if(!is$1.empty(e)){var i=new URL(e[0].thumbnail_large);i.pathname="".concat(i.pathname.split("_")[0],".jpg"),ui.setPoster.call(t,i.href).catch((function(){}))}})),t.embed=new window.Vimeo.Player(c,{autopause:t.config.autopause,muted:t.muted}),t.media.paused=!0,t.media.currentTime=0,t.supported.ui&&t.embed.disableTextTrack(),t.media.play=function(){return assurePlaybackState.call(t,!0),t.embed.play()},t.media.pause=function(){return assurePlaybackState.call(t,!1),t.embed.pause()},t.media.stop=function(){t.pause(),t.currentTime=0};var m=t.media.currentTime;Object.defineProperty(t.media,"currentTime",{get:function(){return m},set:function(e){var i=t.embed,n=t.media,s=t.paused,a=t.volume,r=s&&!i.hasPlayed;n.seeking=!0,triggerEvent.call(t,n,"seeking"),Promise.resolve(r&&i.setVolume(0)).then((function(){return i.setCurrentTime(e)})).then((function(){return r&&i.pause()})).then((function(){return r&&i.setVolume(a)})).catch((function(){}))}});var p=t.config.speed.selected;Object.defineProperty(t.media,"playbackRate",{get:function(){return p},set:function(e){t.embed.setPlaybackRate(e).then((function(){p=e,triggerEvent.call(t,t.media,"ratechange")})).catch((function(){t.options.speed=[1]}))}});var g=t.config.volume;Object.defineProperty(t.media,"volume",{get:function(){return g},set:function(e){t.embed.setVolume(e).then((function(){g=e,triggerEvent.call(t,t.media,"volumechange")}))}});var f=t.config.muted;Object.defineProperty(t.media,"muted",{get:function(){return f},set:function(e){var i=!!is$1.boolean(e)&&e;t.embed.setVolume(i?0:t.config.volume).then((function(){f=i,triggerEvent.call(t,t.media,"volumechange")}))}});var y,v=t.config.loop;Object.defineProperty(t.media,"loop",{get:function(){return v},set:function(e){var i=is$1.boolean(e)?e:t.config.loop.active;t.embed.setLoop(i).then((function(){v=i}))}}),t.embed.getVideoUrl().then((function(e){y=e,controls.setDownloadUrl.call(t)})).catch((function(t){e.debug.warn(t)})),Object.defineProperty(t.media,"currentSrc",{get:function(){return y}}),Object.defineProperty(t.media,"ended",{get:function(){return t.currentTime===t.duration}}),Promise.all([t.embed.getVideoWidth(),t.embed.getVideoHeight()]).then((function(i){var n=_slicedToArray(i,2),s=n[0],a=n[1];t.embed.ratio=[s,a],setAspectRatio.call(e)})),t.embed.setAutopause(t.config.autopause).then((function(e){t.config.autopause=e})),t.embed.getVideoTitle().then((function(i){t.config.title=i,ui.setTitle.call(e)})),t.embed.getCurrentTime().then((function(e){m=e,triggerEvent.call(t,t.media,"timeupdate")})),t.embed.getDuration().then((function(e){t.media.duration=e,triggerEvent.call(t,t.media,"durationchange")})),t.embed.getTextTracks().then((function(e){t.media.textTracks=e,captions.setup.call(t)})),t.embed.on("cuechange",(function(e){var i=e.cues,n=(void 0===i?[]:i).map((function(e){return stripHTML(e.text)}));captions.updateCues.call(t,n)})),t.embed.on("loaded",(function(){(t.embed.getPaused().then((function(e){assurePlaybackState.call(t,!e),e||triggerEvent.call(t,t.media,"playing")})),is$1.element(t.embed.element)&&t.supported.ui)&&t.embed.element.setAttribute("tabindex",-1)})),t.embed.on("bufferstart",(function(){triggerEvent.call(t,t.media,"waiting")})),t.embed.on("bufferend",(function(){triggerEvent.call(t,t.media,"playing")})),t.embed.on("play",(function(){assurePlaybackState.call(t,!0),triggerEvent.call(t,t.media,"playing")})),t.embed.on("pause",(function(){assurePlaybackState.call(t,!1)})),t.embed.on("timeupdate",(function(e){t.media.seeking=!1,m=e.seconds,triggerEvent.call(t,t.media,"timeupdate")})),t.embed.on("progress",(function(e){t.media.buffered=e.percent,triggerEvent.call(t,t.media,"progress"),1===parseInt(e.percent,10)&&triggerEvent.call(t,t.media,"canplaythrough"),t.embed.getDuration().then((function(e){e!==t.media.duration&&(t.media.duration=e,triggerEvent.call(t,t.media,"durationchange"))}))})),t.embed.on("seeked",(function(){t.media.seeking=!1,triggerEvent.call(t,t.media,"seeked")})),t.embed.on("ended",(function(){t.media.paused=!0,triggerEvent.call(t,t.media,"ended")})),t.embed.on("error",(function(e){t.media.error=e,triggerEvent.call(t,t.media,"error")})),setTimeout((function(){return ui.build.call(t)}),0)}};function parseId$1(e){if(is$1.empty(e))return null;return e.match(/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*/)?RegExp.$2:e}function assurePlaybackState$1(e){e&&!this.embed.hasPlayed&&(this.embed.hasPlayed=!0),this.media.paused===e&&(this.media.paused=!e,triggerEvent.call(this,this.media,e?"play":"pause"))}function getHost(e){return e.noCookie?"https://www.youtube-nocookie.com":"http:"===window.location.protocol?"http://www.youtube.com":void 0}var youtube={setup:function(){var e=this;if(toggleClass(this.elements.wrapper,this.config.classNames.embed,!0),is$1.object(window.YT)&&is$1.function(window.YT.Player))youtube.ready.call(this);else{var t=window.onYouTubeIframeAPIReady;window.onYouTubeIframeAPIReady=function(){is$1.function(t)&&t(),youtube.ready.call(e)},loadScript(this.config.urls.youtube.sdk).catch((function(t){e.debug.warn("YouTube API failed to load",t)}))}},getTitle:function(e){var t=this;fetch(format(this.config.urls.youtube.api,e)).then((function(e){if(is$1.object(e)){var i=e.title,n=e.height,s=e.width;t.config.title=i,ui.setTitle.call(t),t.embed.ratio=[s,n]}setAspectRatio.call(t)})).catch((function(){setAspectRatio.call(t)}))},ready:function(){var e=this,t=e.media&&e.media.getAttribute("id");if(is$1.empty(t)||!t.startsWith("youtube-")){var i=e.media.getAttribute("src");is$1.empty(i)&&(i=e.media.getAttribute(this.config.attributes.embed.id));var n=parseId$1(i),s=generateId(e.provider),a=createElement("div",{id:s,"data-poster":e.poster});e.media=replaceElement(a,e.media);var r=function(e){return"https://i.ytimg.com/vi/".concat(n,"/").concat(e,"default.jpg")};loadImage(r("maxres"),121).catch((function(){return loadImage(r("sd"),121)})).catch((function(){return loadImage(r("hq"))})).then((function(t){return ui.setPoster.call(e,t.src)})).then((function(t){t.includes("maxres")||(e.elements.poster.style.backgroundSize="cover")})).catch((function(){}));var o=e.config.youtube;e.embed=new window.YT.Player(s,{videoId:n,host:getHost(o),playerVars:extend({},{autoplay:e.config.autoplay?1:0,hl:e.config.hl,controls:e.supported.ui?0:1,disablekb:1,playsinline:e.config.fullscreen.iosNative?0:1,cc_load_policy:e.captions.active?1:0,cc_lang_pref:e.config.captions.language,widget_referrer:window?window.location.href:null},o),events:{onError:function(t){if(!e.media.error){var i=t.data,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.",5:"The requested content cannot be played in an HTML5 player or another error related to the HTML5 player has occurred.",100:"The video requested was not found. This error occurs when a video has been removed (for any reason) or has been marked as private.",101:"The owner of the requested video does not allow it to be played in embedded players.",150:"The owner of the requested video does not allow it to be played in embedded players."}[i]||"An unknown error occured";e.media.error={code:i,message:n},triggerEvent.call(e,e.media,"error")}},onPlaybackRateChange:function(t){var i=t.target;e.media.playbackRate=i.getPlaybackRate(),triggerEvent.call(e,e.media,"ratechange")},onReady:function(t){if(!is$1.function(e.media.play)){var i=t.target;youtube.getTitle.call(e,n),e.media.play=function(){assurePlaybackState$1.call(e,!0),i.playVideo()},e.media.pause=function(){assurePlaybackState$1.call(e,!1),i.pauseVideo()},e.media.stop=function(){i.stopVideo()},e.media.duration=i.getDuration(),e.media.paused=!0,e.media.currentTime=0,Object.defineProperty(e.media,"currentTime",{get:function(){return Number(i.getCurrentTime())},set:function(t){e.paused&&!e.embed.hasPlayed&&e.embed.mute(),e.media.seeking=!0,triggerEvent.call(e,e.media,"seeking"),i.seekTo(t)}}),Object.defineProperty(e.media,"playbackRate",{get:function(){return i.getPlaybackRate()},set:function(e){i.setPlaybackRate(e)}});var s=e.config.volume;Object.defineProperty(e.media,"volume",{get:function(){return s},set:function(t){s=t,i.setVolume(100*s),triggerEvent.call(e,e.media,"volumechange")}});var a=e.config.muted;Object.defineProperty(e.media,"muted",{get:function(){return a},set:function(t){var n=is$1.boolean(t)?t:a;a=n,i[n?"mute":"unMute"](),triggerEvent.call(e,e.media,"volumechange")}}),Object.defineProperty(e.media,"currentSrc",{get:function(){return i.getVideoUrl()}}),Object.defineProperty(e.media,"ended",{get:function(){return e.currentTime===e.duration}});var r=i.getAvailablePlaybackRates();e.options.speed=r.filter((function(t){return e.config.speed.options.includes(t)})),e.supported.ui&&e.media.setAttribute("tabindex",-1),triggerEvent.call(e,e.media,"timeupdate"),triggerEvent.call(e,e.media,"durationchange"),clearInterval(e.timers.buffering),e.timers.buffering=setInterval((function(){e.media.buffered=i.getVideoLoadedFraction(),(null===e.media.lastBuffered||e.media.lastBuffered<e.media.buffered)&&triggerEvent.call(e,e.media,"progress"),e.media.lastBuffered=e.media.buffered,1===e.media.buffered&&(clearInterval(e.timers.buffering),triggerEvent.call(e,e.media,"canplaythrough"))}),200),setTimeout((function(){return ui.build.call(e)}),50)}},onStateChange:function(t){var i=t.target;switch(clearInterval(e.timers.playing),e.media.seeking&&[1,2].includes(t.data)&&(e.media.seeking=!1,triggerEvent.call(e,e.media,"seeked")),t.data){case-1:triggerEvent.call(e,e.media,"timeupdate"),e.media.buffered=i.getVideoLoadedFraction(),triggerEvent.call(e,e.media,"progress");break;case 0:assurePlaybackState$1.call(e,!1),e.media.loop?(i.stopVideo(),i.playVideo()):triggerEvent.call(e,e.media,"ended");break;case 1:e.config.autoplay||!e.media.paused||e.embed.hasPlayed?(assurePlaybackState$1.call(e,!0),triggerEvent.call(e,e.media,"playing"),e.timers.playing=setInterval((function(){triggerEvent.call(e,e.media,"timeupdate")}),50),e.media.duration!==i.getDuration()&&(e.media.duration=i.getDuration(),triggerEvent.call(e,e.media,"durationchange"))):e.media.pause();break;case 2:e.muted||e.embed.unMute(),assurePlaybackState$1.call(e,!1);break;case 3:triggerEvent.call(e,e.media,"waiting")}triggerEvent.call(e,e.elements.container,"statechange",!1,{code:t.data})}}})}}},media={setup:function(){this.media?(toggleClass(this.elements.container,this.config.classNames.type.replace("{0}",this.type),!0),toggleClass(this.elements.container,this.config.classNames.provider.replace("{0}",this.provider),!0),this.isEmbed&&toggleClass(this.elements.container,this.config.classNames.type.replace("{0}","video"),!0),this.isVideo&&(this.elements.wrapper=createElement("div",{class:this.config.classNames.video}),wrap(this.media,this.elements.wrapper),this.elements.poster=createElement("div",{class:this.config.classNames.poster}),this.elements.wrapper.appendChild(this.elements.poster)),this.isHTML5?html5.setup.call(this):this.isYouTube?youtube.setup.call(this):this.isVimeo&&vimeo.setup.call(this)):this.debug.warn("No media element found!")}},destroy=function(e){e.manager&&e.manager.destroy(),e.elements.displayContainer&&e.elements.displayContainer.destroy(),e.elements.container.remove()},Ads=function(){function e(t){var i=this;_classCallCheck(this,e),this.player=t,this.config=t.config.ads,this.playing=!1,this.initialized=!1,this.elements={container:null,displayContainer:null},this.manager=null,this.loader=null,this.cuePoints=null,this.events={},this.safetyTimer=null,this.countdownTimer=null,this.managerPromise=new Promise((function(e,t){i.on("loaded",e),i.on("error",t)})),this.load()}return _createClass(e,[{key:"load",value:function(){var e=this;this.enabled&&(is$1.object(window.google)&&is$1.object(window.google.ima)?this.ready():loadScript(this.player.config.urls.googleIMA.sdk).then((function(){e.ready()})).catch((function(){e.trigger("error",new Error("Google IMA SDK failed to load"))})))}},{key:"ready",value:function(){var e=this;this.enabled||destroy(this),this.startSafetyTimer(12e3,"ready()"),this.managerPromise.then((function(){e.clearSafetyTimer("onAdsManagerLoaded()")})),this.listeners(),this.setupIMA()}},{key:"setupIMA",value:function(){var e=this;this.elements.container=createElement("div",{class:this.player.config.classNames.ads}),this.player.elements.container.appendChild(this.elements.container),google.ima.settings.setVpaidMode(google.ima.ImaSdkSettings.VpaidMode.ENABLED),google.ima.settings.setLocale(this.player.config.ads.language),google.ima.settings.setDisableCustomPlaybackForIOS10Plus(this.player.config.playsinline),this.elements.displayContainer=new google.ima.AdDisplayContainer(this.elements.container,this.player.media),this.loader=new google.ima.AdsLoader(this.elements.displayContainer),this.loader.addEventListener(google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,(function(t){return e.onAdsManagerLoaded(t)}),!1),this.loader.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR,(function(t){return e.onAdError(t)}),!1),this.requestAds()}},{key:"requestAds",value:function(){var e=this.player.elements.container;try{var t=new google.ima.AdsRequest;t.adTagUrl=this.tagUrl,t.linearAdSlotWidth=e.offsetWidth,t.linearAdSlotHeight=e.offsetHeight,t.nonLinearAdSlotWidth=e.offsetWidth,t.nonLinearAdSlotHeight=e.offsetHeight,t.forceNonLinearFullSlot=!1,t.setAdWillPlayMuted(!this.player.muted),this.loader.requestAds(t)}catch(e){this.onAdError(e)}}},{key:"pollCountdown",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!t)return clearInterval(this.countdownTimer),void this.elements.container.removeAttribute("data-badge-text");var i=function(){var t=formatTime(Math.max(e.manager.getRemainingTime(),0)),i="".concat(i18n.get("advertisement",e.player.config)," - ").concat(t);e.elements.container.setAttribute("data-badge-text",i)};this.countdownTimer=setInterval(i,100)}},{key:"onAdsManagerLoaded",value:function(e){var t=this;if(this.enabled){var i=new google.ima.AdsRenderingSettings;i.restoreCustomPlaybackStateOnAdBreakComplete=!0,i.enablePreloading=!0,this.manager=e.getAdsManager(this.player,i),this.cuePoints=this.manager.getCuePoints(),this.manager.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR,(function(e){return t.onAdError(e)})),Object.keys(google.ima.AdEvent.Type).forEach((function(e){t.manager.addEventListener(google.ima.AdEvent.Type[e],(function(e){return t.onAdEvent(e)}))})),this.trigger("loaded")}}},{key:"addCuePoints",value:function(){var e=this;is$1.empty(this.cuePoints)||this.cuePoints.forEach((function(t){if(0!==t&&-1!==t&&t<e.player.duration){var i=e.player.elements.progress;if(is$1.element(i)){var n=100/e.player.duration*t,s=createElement("span",{class:e.player.config.classNames.cues});s.style.left="".concat(n.toString(),"%"),i.appendChild(s)}}}))}},{key:"onAdEvent",value:function(e){var t,i=this,n=this.player.elements.container,s=e.getAd(),a=e.getAdData();switch(t=e.type,triggerEvent.call(i.player,i.player.media,"ads".concat(t.replace(/_/g,"").toLowerCase())),e.type){case google.ima.AdEvent.Type.LOADED:this.trigger("loaded"),this.pollCountdown(!0),s.isLinear()||(s.width=n.offsetWidth,s.height=n.offsetHeight);break;case google.ima.AdEvent.Type.STARTED:this.manager.setVolume(this.player.volume);break;case google.ima.AdEvent.Type.ALL_ADS_COMPLETED:this.player.ended?this.loadAds():this.loader.contentComplete();break;case google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED:this.pauseContent();break;case google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED:this.pollCountdown(),this.resumeContent();break;case google.ima.AdEvent.Type.LOG:a.adError&&this.player.debug.warn("Non-fatal ad error: ".concat(a.adError.getMessage()))}}},{key:"onAdError",value:function(e){this.cancel(),this.player.debug.warn("Ads error",e)}},{key:"listeners",value:function(){var e,t=this,i=this.player.elements.container;this.player.on("canplay",(function(){t.addCuePoints()})),this.player.on("ended",(function(){t.loader.contentComplete()})),this.player.on("timeupdate",(function(){e=t.player.currentTime})),this.player.on("seeked",(function(){var i=t.player.currentTime;is$1.empty(t.cuePoints)||t.cuePoints.forEach((function(n,s){e<n&&n<i&&(t.manager.discardAdBreak(),t.cuePoints.splice(s,1))}))})),window.addEventListener("resize",(function(){t.manager&&t.manager.resize(i.offsetWidth,i.offsetHeight,google.ima.ViewMode.NORMAL)}))}},{key:"play",value:function(){var e=this,t=this.player.elements.container;this.managerPromise||this.resumeContent(),this.managerPromise.then((function(){e.manager.setVolume(e.player.volume),e.elements.displayContainer.initialize();try{e.initialized||(e.manager.init(t.offsetWidth,t.offsetHeight,google.ima.ViewMode.NORMAL),e.manager.start()),e.initialized=!0}catch(t){e.onAdError(t)}})).catch((function(){}))}},{key:"resumeContent",value:function(){this.elements.container.style.zIndex="",this.playing=!1,silencePromise(this.player.media.play())}},{key:"pauseContent",value:function(){this.elements.container.style.zIndex=3,this.playing=!0,this.player.media.pause()}},{key:"cancel",value:function(){this.initialized&&this.resumeContent(),this.trigger("error"),this.loadAds()}},{key:"loadAds",value:function(){var e=this;this.managerPromise.then((function(){e.manager&&e.manager.destroy(),e.managerPromise=new Promise((function(t){e.on("loaded",t),e.player.debug.log(e.manager)})),e.initialized=!1,e.requestAds()})).catch((function(){}))}},{key:"trigger",value:function(e){for(var t=this,i=arguments.length,n=new Array(i>1?i-1:0),s=1;s<i;s++)n[s-1]=arguments[s];var a=this.events[e];is$1.array(a)&&a.forEach((function(e){is$1.function(e)&&e.apply(t,n)}))}},{key:"on",value:function(e,t){return is$1.array(this.events[e])||(this.events[e]=[]),this.events[e].push(t),this}},{key:"startSafetyTimer",value:function(e,t){var i=this;this.player.debug.log("Safety timer invoked from: ".concat(t)),this.safetyTimer=setTimeout((function(){i.cancel(),i.clearSafetyTimer("startSafetyTimer()")}),e)}},{key:"clearSafetyTimer",value:function(e){is$1.nullOrUndefined(this.safetyTimer)||(this.player.debug.log("Safety timer cleared from: ".concat(e)),clearTimeout(this.safetyTimer),this.safetyTimer=null)}},{key:"enabled",get:function(){var e=this.config;return this.player.isHTML5&&this.player.isVideo&&e.enabled&&(!is$1.empty(e.publisherId)||is$1.url(e.tagUrl))}},{key:"tagUrl",get:function(){var e=this.config;if(is$1.url(e.tagUrl))return e.tagUrl;var t={AV_PUBLISHERID:"58c25bb0073ef448b1087ad6",AV_CHANNELID:"5a0458dc28a06145e4519d21",AV_URL:window.location.hostname,cb:Date.now(),AV_WIDTH:640,AV_HEIGHT:480,AV_CDIM2:e.publisherId};return"".concat("https://go.aniview.com/api/adserver6/vast/","?").concat(buildUrlParams(t))}}]),e}(),parseVtt=function(e){var t=[];return e.split(/\r\n\r\n|\n\n|\r\r/).forEach((function(e){var i={};e.split(/\r\n|\n|\r/).forEach((function(e){if(is$1.number(i.startTime)){if(!is$1.empty(e.trim())&&is$1.empty(i.text)){var t=e.trim().split("#xywh="),n=_slicedToArray(t,1);if(i.text=n[0],t[1]){var s=_slicedToArray(t[1].split(","),4);i.x=s[0],i.y=s[1],i.w=s[2],i.h=s[3]}}}else{var a=e.match(/([0-9]{2})?:?([0-9]{2}):([0-9]{2}).([0-9]{2,3})( ?--> ?)([0-9]{2})?:?([0-9]{2}):([0-9]{2}).([0-9]{2,3})/);a&&(i.startTime=60*Number(a[1]||0)*60+60*Number(a[2])+Number(a[3])+Number("0.".concat(a[4])),i.endTime=60*Number(a[6]||0)*60+60*Number(a[7])+Number(a[8])+Number("0.".concat(a[9])))}})),i.text&&t.push(i)})),t},fitRatio=function(e,t){var i={};return e>t.width/t.height?(i.width=t.width,i.height=1/e*t.width):(i.height=t.height,i.width=e*t.height),i},PreviewThumbnails=function(){function e(t){_classCallCheck(this,e),this.player=t,this.thumbnails=[],this.loaded=!1,this.lastMouseMoveTime=Date.now(),this.mouseDown=!1,this.loadedImages=[],this.elements={thumb:{},scrubbing:{}},this.load()}return _createClass(e,[{key:"load",value:function(){var e=this;this.player.elements.display.seekTooltip&&(this.player.elements.display.seekTooltip.hidden=this.enabled),this.enabled&&this.getThumbnails().then((function(){e.enabled&&(e.render(),e.determineContainerAutoSizing(),e.loaded=!0)}))}},{key:"getThumbnails",value:function(){var e=this;return new Promise((function(t){var i=e.player.config.previewThumbnails.src;if(is$1.empty(i))throw new Error("Missing previewThumbnails.src config attribute");var n=function(){e.thumbnails.sort((function(e,t){return e.height-t.height})),e.player.debug.log("Preview thumbnails",e.thumbnails),t()};if(is$1.function(i))i((function(t){e.thumbnails=t,n()}));else{var s=(is$1.string(i)?[i]:i).map((function(t){return e.getThumbnail(t)}));Promise.all(s).then(n)}}))}},{key:"getThumbnail",value:function(e){var t=this;return new Promise((function(i){fetch(e).then((function(n){var s={frames:parseVtt(n),height:null,urlPrefix:""};s.frames[0].text.startsWith("/")||s.frames[0].text.startsWith("http://")||s.frames[0].text.startsWith("https://")||(s.urlPrefix=e.substring(0,e.lastIndexOf("/")+1));var a=new Image;a.onload=function(){s.height=a.naturalHeight,s.width=a.naturalWidth,t.thumbnails.push(s),i()},a.src=s.urlPrefix+s.frames[0].text}))}))}},{key:"startMove",value:function(e){if(this.loaded&&is$1.event(e)&&["touchmove","mousemove"].includes(e.type)&&this.player.media.duration){if("touchmove"===e.type)this.seekTime=this.player.media.duration*(this.player.elements.inputs.seek.value/100);else{var t=this.player.elements.progress.getBoundingClientRect(),i=100/t.width*(e.pageX-t.left);this.seekTime=this.player.media.duration*(i/100),this.seekTime<0&&(this.seekTime=0),this.seekTime>this.player.media.duration-1&&(this.seekTime=this.player.media.duration-1),this.mousePosX=e.pageX,this.elements.thumb.time.innerText=formatTime(this.seekTime)}this.showImageAtCurrentTime()}}},{key:"endMove",value:function(){this.toggleThumbContainer(!1,!0)}},{key:"startScrubbing",value:function(e){(is$1.nullOrUndefined(e.button)||!1===e.button||0===e.button)&&(this.mouseDown=!0,this.player.media.duration&&(this.toggleScrubbingContainer(!0),this.toggleThumbContainer(!1,!0),this.showImageAtCurrentTime()))}},{key:"endScrubbing",value:function(){var e=this;this.mouseDown=!1,Math.ceil(this.lastTime)===Math.ceil(this.player.media.currentTime)?this.toggleScrubbingContainer(!1):once.call(this.player,this.player.media,"timeupdate",(function(){e.mouseDown||e.toggleScrubbingContainer(!1)}))}},{key:"listeners",value:function(){var e=this;this.player.on("play",(function(){e.toggleThumbContainer(!1,!0)})),this.player.on("seeked",(function(){e.toggleThumbContainer(!1)})),this.player.on("timeupdate",(function(){e.lastTime=e.player.media.currentTime}))}},{key:"render",value:function(){this.elements.thumb.container=createElement("div",{class:this.player.config.classNames.previewThumbnails.thumbContainer}),this.elements.thumb.imageContainer=createElement("div",{class:this.player.config.classNames.previewThumbnails.imageContainer}),this.elements.thumb.container.appendChild(this.elements.thumb.imageContainer);var e=createElement("div",{class:this.player.config.classNames.previewThumbnails.timeContainer});this.elements.thumb.time=createElement("span",{},"00:00"),e.appendChild(this.elements.thumb.time),this.elements.thumb.container.appendChild(e),is$1.element(this.player.elements.progress)&&this.player.elements.progress.appendChild(this.elements.thumb.container),this.elements.scrubbing.container=createElement("div",{class:this.player.config.classNames.previewThumbnails.scrubbingContainer}),this.player.elements.wrapper.appendChild(this.elements.scrubbing.container)}},{key:"destroy",value:function(){this.elements.thumb.container&&this.elements.thumb.container.remove(),this.elements.scrubbing.container&&this.elements.scrubbing.container.remove()}},{key:"showImageAtCurrentTime",value:function(){var e=this;this.mouseDown?this.setScrubbingContainerSize():this.setThumbContainerSizeAndPos();var t=this.thumbnails[0].frames.findIndex((function(t){return e.seekTime>=t.startTime&&e.seekTime<=t.endTime})),i=t>=0,n=0;this.mouseDown||this.toggleThumbContainer(i),i&&(this.thumbnails.forEach((function(i,s){e.loadedImages.includes(i.frames[t].text)&&(n=s)})),t!==this.showingThumb&&(this.showingThumb=t,this.loadImage(n)))}},{key:"loadImage",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,i=this.showingThumb,n=this.thumbnails[t],s=n.urlPrefix,a=n.frames[i],r=n.frames[i].text,o=s+r;if(this.currentImageElement&&this.currentImageElement.dataset.filename===r)this.showImage(this.currentImageElement,a,t,i,r,!1),this.currentImageElement.dataset.index=i,this.removeOldImages(this.currentImageElement);else{this.loadingImage&&this.usingSprites&&(this.loadingImage.onload=null);var l=new Image;l.src=o,l.dataset.index=i,l.dataset.filename=r,this.showingThumbFilename=r,this.player.debug.log("Loading image: ".concat(o)),l.onload=function(){return e.showImage(l,a,t,i,r,!0)},this.loadingImage=l,this.removeOldImages(l)}}},{key:"showImage",value:function(e,t,i,n,s){var a=!(arguments.length>5&&void 0!==arguments[5])||arguments[5];this.player.debug.log("Showing thumb: ".concat(s,". num: ").concat(n,". qual: ").concat(i,". newimg: ").concat(a)),this.setImageSizeAndOffset(e,t),a&&(this.currentImageContainer.appendChild(e),this.currentImageElement=e,this.loadedImages.includes(s)||this.loadedImages.push(s)),this.preloadNearby(n,!0).then(this.preloadNearby(n,!1)).then(this.getHigherQuality(i,e,t,s))}},{key:"removeOldImages",value:function(e){var t=this;Array.from(this.currentImageContainer.children).forEach((function(i){if("img"===i.tagName.toLowerCase()){var n=t.usingSprites?500:1e3;if(i.dataset.index!==e.dataset.index&&!i.dataset.deleting){i.dataset.deleting=!0;var s=t.currentImageContainer;setTimeout((function(){s.removeChild(i),t.player.debug.log("Removing thumb: ".concat(i.dataset.filename))}),n)}}}))}},{key:"preloadNearby",value:function(e){var t=this,i=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return new Promise((function(n){setTimeout((function(){var s=t.thumbnails[0].frames[e].text;if(t.showingThumbFilename===s){var a;a=i?t.thumbnails[0].frames.slice(e):t.thumbnails[0].frames.slice(0,e).reverse();var r=!1;a.forEach((function(e){var i=e.text;if(i!==s&&!t.loadedImages.includes(i)){r=!0,t.player.debug.log("Preloading thumb filename: ".concat(i));var a=t.thumbnails[0].urlPrefix+i,o=new Image;o.src=a,o.onload=function(){t.player.debug.log("Preloaded thumb filename: ".concat(i)),t.loadedImages.includes(i)||t.loadedImages.push(i),n()}}})),r||n()}}),300)}))}},{key:"getHigherQuality",value:function(e,t,i,n){var s=this;if(e<this.thumbnails.length-1){var a=t.naturalHeight;this.usingSprites&&(a=i.h),a<this.thumbContainerHeight&&setTimeout((function(){s.showingThumbFilename===n&&(s.player.debug.log("Showing higher quality thumb for: ".concat(n)),s.loadImage(e+1))}),300)}}},{key:"toggleThumbContainer",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=this.player.config.classNames.previewThumbnails.thumbContainerShown;this.elements.thumb.container.classList.toggle(i,e),!e&&t&&(this.showingThumb=null,this.showingThumbFilename=null)}},{key:"toggleScrubbingContainer",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.player.config.classNames.previewThumbnails.scrubbingContainerShown;this.elements.scrubbing.container.classList.toggle(t,e),e||(this.showingThumb=null,this.showingThumbFilename=null)}},{key:"determineContainerAutoSizing",value:function(){(this.elements.thumb.imageContainer.clientHeight>20||this.elements.thumb.imageContainer.clientWidth>20)&&(this.sizeSpecifiedInCSS=!0)}},{key:"setThumbContainerSizeAndPos",value:function(){if(this.sizeSpecifiedInCSS){if(this.elements.thumb.imageContainer.clientHeight>20&&this.elements.thumb.imageContainer.clientWidth<20){var e=Math.floor(this.elements.thumb.imageContainer.clientHeight*this.thumbAspectRatio);this.elements.thumb.imageContainer.style.width="".concat(e,"px")}else if(this.elements.thumb.imageContainer.clientHeight<20&&this.elements.thumb.imageContainer.clientWidth>20){var t=Math.floor(this.elements.thumb.imageContainer.clientWidth/this.thumbAspectRatio);this.elements.thumb.imageContainer.style.height="".concat(t,"px")}}else{var i=Math.floor(this.thumbContainerHeight*this.thumbAspectRatio);this.elements.thumb.imageContainer.style.height="".concat(this.thumbContainerHeight,"px"),this.elements.thumb.imageContainer.style.width="".concat(i,"px")}this.setThumbContainerPos()}},{key:"setThumbContainerPos",value:function(){var e=this.player.elements.progress.getBoundingClientRect(),t=this.player.elements.container.getBoundingClientRect(),i=this.elements.thumb.container,n=t.left-e.left+10,s=t.right-e.left-i.clientWidth-10,a=this.mousePosX-e.left-i.clientWidth/2;a<n&&(a=n),a>s&&(a=s),i.style.left="".concat(a,"px")}},{key:"setScrubbingContainerSize",value:function(){var e=fitRatio(this.thumbAspectRatio,{width:this.player.media.clientWidth,height:this.player.media.clientHeight}),t=e.width,i=e.height;this.elements.scrubbing.container.style.width="".concat(t,"px"),this.elements.scrubbing.container.style.height="".concat(i,"px")}},{key:"setImageSizeAndOffset",value:function(e,t){if(this.usingSprites){var i=this.thumbContainerHeight/t.h;e.style.height="".concat(e.naturalHeight*i,"px"),e.style.width="".concat(e.naturalWidth*i,"px"),e.style.left="-".concat(t.x*i,"px"),e.style.top="-".concat(t.y*i,"px")}}},{key:"enabled",get:function(){return this.player.isHTML5&&this.player.isVideo&&this.player.config.previewThumbnails.enabled}},{key:"currentImageContainer",get:function(){return this.mouseDown?this.elements.scrubbing.container:this.elements.thumb.imageContainer}},{key:"usingSprites",get:function(){return Object.keys(this.thumbnails[0].frames[0]).includes("w")}},{key:"thumbAspectRatio",get:function(){return this.usingSprites?this.thumbnails[0].frames[0].w/this.thumbnails[0].frames[0].h:this.thumbnails[0].width/this.thumbnails[0].height}},{key:"thumbContainerHeight",get:function(){return this.mouseDown?fitRatio(this.thumbAspectRatio,{width:this.player.media.clientWidth,height:this.player.media.clientHeight}).height:this.sizeSpecifiedInCSS?this.elements.thumb.imageContainer.clientHeight:Math.floor(this.player.media.clientWidth/this.thumbAspectRatio/4)}},{key:"currentImageElement",get:function(){return this.mouseDown?this.currentScrubbingImageElement:this.currentThumbnailImageElement},set:function(e){this.mouseDown?this.currentScrubbingImageElement=e:this.currentThumbnailImageElement=e}}]),e}(),source={insertElements:function(e,t){var i=this;is$1.string(t)?insertElement(e,this.media,{src:t}):is$1.array(t)&&t.forEach((function(t){insertElement(e,i.media,t)}))},change:function(e){var t=this;getDeep(e,"sources.length")?(html5.cancelRequests.call(this),this.destroy.call(this,(function(){t.options.quality=[],removeElement(t.media),t.media=null,is$1.element(t.elements.container)&&t.elements.container.removeAttribute("class");var i=e.sources,n=e.type,s=_slicedToArray(i,1)[0],a=s.provider,r=void 0===a?providers.html5:a,o=s.src,l="html5"===r?n:"div",c="html5"===r?{}:{src:o};Object.assign(t,{provider:r,type:n,supported:support.check(n,r,t.config.playsinline),media:createElement(l,c)}),t.elements.container.appendChild(t.media),is$1.boolean(e.autoplay)&&(t.config.autoplay=e.autoplay),t.isHTML5&&(t.config.crossorigin&&t.media.setAttribute("crossorigin",""),t.config.autoplay&&t.media.setAttribute("autoplay",""),is$1.empty(e.poster)||(t.poster=e.poster),t.config.loop.active&&t.media.setAttribute("loop",""),t.config.muted&&t.media.setAttribute("muted",""),t.config.playsinline&&t.media.setAttribute("playsinline","")),ui.addStyleHook.call(t),t.isHTML5&&source.insertElements.call(t,"source",i),t.config.title=e.title,media.setup.call(t),t.isHTML5&&Object.keys(e).includes("tracks")&&source.insertElements.call(t,"track",e.tracks),(t.isHTML5||t.isEmbed&&!t.supported.ui)&&ui.build.call(t),t.isHTML5&&t.media.load(),is$1.empty(e.previewThumbnails)||(Object.assign(t.config.previewThumbnails,e.previewThumbnails),t.previewThumbnails&&t.previewThumbnails.loaded&&(t.previewThumbnails.destroy(),t.previewThumbnails=null),t.config.previewThumbnails.enabled&&(t.previewThumbnails=new PreviewThumbnails(t))),t.fullscreen.update()}),!0)):this.debug.warn("Invalid source format")}};function clamp(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:255;return Math.min(Math.max(e,t),i)}var Plyr=function(){function e(t,i){var n=this;if(_classCallCheck(this,e),this.timers={},this.ready=!1,this.loading=!1,this.failed=!1,this.touch=support.touch,this.media=t,is$1.string(this.media)&&(this.media=document.querySelectorAll(this.media)),(window.jQuery&&this.media instanceof jQuery||is$1.nodeList(this.media)||is$1.array(this.media))&&(this.media=this.media[0]),this.config=extend({},defaults$1,e.defaults,i||{},function(){try{return JSON.parse(n.media.getAttribute("data-plyr-config"))}catch(e){return{}}}()),this.elements={container:null,fullscreen:null,captions:null,buttons:{},display:{},progress:{},inputs:{},settings:{popup:null,menu:null,panels:{},buttons:{}}},this.captions={active:null,currentTrack:-1,meta:new WeakMap},this.fullscreen={active:!1},this.options={speed:[],quality:[]},this.debug=new Console(this.config.debug),this.debug.log("Config",this.config),this.debug.log("Support",support),!is$1.nullOrUndefined(this.media)&&is$1.element(this.media))if(this.media.plyr)this.debug.warn("Target already setup");else if(this.config.enabled)if(support.check().api){var s=this.media.cloneNode(!0);s.autoplay=!1,this.elements.original=s;var a=this.media.tagName.toLowerCase(),r=null,o=null;switch(a){case"div":if(r=this.media.querySelector("iframe"),is$1.element(r)){if(o=parseUrl(r.getAttribute("src")),this.provider=getProviderByUrl(o.toString()),this.elements.container=this.media,this.media=r,this.elements.container.className="",o.search.length){var l=["1","true"];l.includes(o.searchParams.get("autoplay"))&&(this.config.autoplay=!0),l.includes(o.searchParams.get("loop"))&&(this.config.loop.active=!0),this.isYouTube?(this.config.playsinline=l.includes(o.searchParams.get("playsinline")),this.config.youtube.hl=o.searchParams.get("hl")):this.config.playsinline=!0}}else this.provider=this.media.getAttribute(this.config.attributes.embed.provider),this.media.removeAttribute(this.config.attributes.embed.provider);if(is$1.empty(this.provider)||!Object.keys(providers).includes(this.provider))return void this.debug.error("Setup failed: Invalid provider");this.type=types.video;break;case"video":case"audio":this.type=a,this.provider=providers.html5,this.media.hasAttribute("crossorigin")&&(this.config.crossorigin=!0),this.media.hasAttribute("autoplay")&&(this.config.autoplay=!0),(this.media.hasAttribute("playsinline")||this.media.hasAttribute("webkit-playsinline"))&&(this.config.playsinline=!0),this.media.hasAttribute("muted")&&(this.config.muted=!0),this.media.hasAttribute("loop")&&(this.config.loop.active=!0);break;default:return void this.debug.error("Setup failed: unsupported type")}this.supported=support.check(this.type,this.provider,this.config.playsinline),this.supported.api?(this.eventListeners=[],this.listeners=new Listeners(this),this.storage=new Storage(this),this.media.plyr=this,is$1.element(this.elements.container)||(this.elements.container=createElement("div",{tabindex:0}),wrap(this.media,this.elements.container)),ui.migrateStyles.call(this),ui.addStyleHook.call(this),media.setup.call(this),this.config.debug&&on.call(this,this.elements.container,this.config.events.join(" "),(function(e){n.debug.log("event: ".concat(e.type))})),this.fullscreen=new Fullscreen(this),(this.isHTML5||this.isEmbed&&!this.supported.ui)&&ui.build.call(this),this.listeners.container(),this.listeners.global(),this.config.ads.enabled&&(this.ads=new Ads(this)),this.isHTML5&&this.config.autoplay&&setTimeout((function(){return silencePromise(n.play())}),10),this.lastSeekTime=0,this.config.previewThumbnails.enabled&&(this.previewThumbnails=new PreviewThumbnails(this))):this.debug.error("Setup failed: no support")}else this.debug.error("Setup failed: no support");else this.debug.error("Setup failed: disabled by config");else this.debug.error("Setup failed: no suitable element passed")}return _createClass(e,[{key:"play",value:function(){var e=this;return is$1.function(this.media.play)?(this.ads&&this.ads.enabled&&this.ads.managerPromise.then((function(){return e.ads.play()})).catch((function(){return silencePromise(e.media.play())})),this.media.play()):null}},{key:"pause",value:function(){return this.playing&&is$1.function(this.media.pause)?this.media.pause():null}},{key:"togglePlay",value:function(e){return(is$1.boolean(e)?e:!this.playing)?this.play():this.pause()}},{key:"stop",value:function(){this.isHTML5?(this.pause(),this.restart()):is$1.function(this.media.stop)&&this.media.stop()}},{key:"restart",value:function(){this.currentTime=0}},{key:"rewind",value:function(e){this.currentTime-=is$1.number(e)?e:this.config.seekTime}},{key:"forward",value:function(e){this.currentTime+=is$1.number(e)?e:this.config.seekTime}},{key:"increaseVolume",value:function(e){var t=this.media.muted?0:this.volume;this.volume=t+(is$1.number(e)?e:0)}},{key:"decreaseVolume",value:function(e){this.increaseVolume(-e)}},{key:"toggleCaptions",value:function(e){captions.toggle.call(this,e,!1)}},{key:"airplay",value:function(){support.airplay&&this.media.webkitShowPlaybackTargetPicker()}},{key:"toggleControls",value:function(e){if(this.supported.ui&&!this.isAudio){var t=hasClass(this.elements.container,this.config.classNames.hideControls),i=void 0===e?void 0:!e,n=toggleClass(this.elements.container,this.config.classNames.hideControls,i);if(n&&is$1.array(this.config.controls)&&this.config.controls.includes("settings")&&!is$1.empty(this.config.settings)&&controls.toggleMenu.call(this,!1),n!==t){var s=n?"controlshidden":"controlsshown";triggerEvent.call(this,this.media,s)}return!n}return!1}},{key:"on",value:function(e,t){on.call(this,this.elements.container,e,t)}},{key:"once",value:function(e,t){once.call(this,this.elements.container,e,t)}},{key:"off",value:function(e,t){off(this.elements.container,e,t)}},{key:"destroy",value:function(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this.ready){var n=function(){document.body.style.overflow="",t.embed=null,i?(Object.keys(t.elements).length&&(removeElement(t.elements.buttons.play),removeElement(t.elements.captions),removeElement(t.elements.controls),removeElement(t.elements.wrapper),t.elements.buttons.play=null,t.elements.captions=null,t.elements.controls=null,t.elements.wrapper=null),is$1.function(e)&&e()):(unbindListeners.call(t),replaceElement(t.elements.original,t.elements.container),triggerEvent.call(t,t.elements.original,"destroyed",!0),is$1.function(e)&&e.call(t.elements.original),t.ready=!1,setTimeout((function(){t.elements=null,t.media=null}),200))};this.stop(),clearTimeout(this.timers.loading),clearTimeout(this.timers.controls),clearTimeout(this.timers.resized),this.isHTML5?(ui.toggleNativeControls.call(this,!0),n()):this.isYouTube?(clearInterval(this.timers.buffering),clearInterval(this.timers.playing),null!==this.embed&&is$1.function(this.embed.destroy)&&this.embed.destroy(),n()):this.isVimeo&&(null!==this.embed&&this.embed.unload().then(n),setTimeout(n,200))}}},{key:"supports",value:function(e){return support.mime.call(this,e)}},{key:"isHTML5",get:function(){return this.provider===providers.html5}},{key:"isEmbed",get:function(){return this.isYouTube||this.isVimeo}},{key:"isYouTube",get:function(){return this.provider===providers.youtube}},{key:"isVimeo",get:function(){return this.provider===providers.vimeo}},{key:"isVideo",get:function(){return this.type===types.video}},{key:"isAudio",get:function(){return this.type===types.audio}},{key:"playing",get:function(){return Boolean(this.ready&&!this.paused&&!this.ended)}},{key:"paused",get:function(){return Boolean(this.media.paused)}},{key:"stopped",get:function(){return Boolean(this.paused&&0===this.currentTime)}},{key:"ended",get:function(){return Boolean(this.media.ended)}},{key:"currentTime",set:function(e){if(this.duration){var t=is$1.number(e)&&e>0;this.media.currentTime=t?Math.min(e,this.duration):0,this.debug.log("Seeking to ".concat(this.currentTime," seconds"))}},get:function(){return Number(this.media.currentTime)}},{key:"buffered",get:function(){var e=this.media.buffered;return is$1.number(e)?e:e&&e.length&&this.duration>0?e.end(0)/this.duration:0}},{key:"seeking",get:function(){return Boolean(this.media.seeking)}},{key:"duration",get:function(){var e=parseFloat(this.config.duration),t=(this.media||{}).duration,i=is$1.number(t)&&t!==1/0?t:0;return e||i}},{key:"volume",set:function(e){var t=e;is$1.string(t)&&(t=Number(t)),is$1.number(t)||(t=this.storage.get("volume")),is$1.number(t)||(t=this.config.volume),t>1&&(t=1),t<0&&(t=0),this.config.volume=t,this.media.volume=t,!is$1.empty(e)&&this.muted&&t>0&&(this.muted=!1)},get:function(){return Number(this.media.volume)}},{key:"muted",set:function(e){var t=e;is$1.boolean(t)||(t=this.storage.get("muted")),is$1.boolean(t)||(t=this.config.muted),this.config.muted=t,this.media.muted=t},get:function(){return Boolean(this.media.muted)}},{key:"hasAudio",get:function(){return!this.isHTML5||(!!this.isAudio||(Boolean(this.media.mozHasAudio)||Boolean(this.media.webkitAudioDecodedByteCount)||Boolean(this.media.audioTracks&&this.media.audioTracks.length)))}},{key:"speed",set:function(e){var t=this,i=null;is$1.number(e)&&(i=e),is$1.number(i)||(i=this.storage.get("speed")),is$1.number(i)||(i=this.config.speed.selected);var n=this.minimumSpeed,s=this.maximumSpeed;i=clamp(i,n,s),this.config.speed.selected=i,setTimeout((function(){t.media.playbackRate=i}),0)},get:function(){return Number(this.media.playbackRate)}},{key:"minimumSpeed",get:function(){return this.isYouTube?Math.min.apply(Math,_toConsumableArray(this.options.speed)):this.isVimeo?.5:.0625}},{key:"maximumSpeed",get:function(){return this.isYouTube?Math.max.apply(Math,_toConsumableArray(this.options.speed)):this.isVimeo?2:16}},{key:"quality",set:function(e){var t=this.config.quality,i=this.options.quality;if(i.length){var n=[!is$1.empty(e)&&Number(e),this.storage.get("quality"),t.selected,t.default].find(is$1.number),s=!0;if(!i.includes(n)){var a=closest$1(i,n);this.debug.warn("Unsupported quality option: ".concat(n,", using ").concat(a," instead")),n=a,s=!1}t.selected=n,this.media.quality=n,s&&this.storage.set({quality:n})}},get:function(){return this.media.quality}},{key:"loop",set:function(e){var t=is$1.boolean(e)?e:this.config.loop.active;this.config.loop.active=t,this.media.loop=t},get:function(){return Boolean(this.media.loop)}},{key:"source",set:function(e){source.change.call(this,e)},get:function(){return this.media.currentSrc}},{key:"download",get:function(){var e=this.config.urls.download;return is$1.url(e)?e:this.source},set:function(e){is$1.url(e)&&(this.config.urls.download=e,controls.setDownloadUrl.call(this))}},{key:"poster",set:function(e){this.isVideo?ui.setPoster.call(this,e,!1).catch((function(){})):this.debug.warn("Poster can only be set for video")},get:function(){return this.isVideo?this.media.getAttribute("poster")||this.media.getAttribute("data-poster"):null}},{key:"ratio",get:function(){if(!this.isVideo)return null;var e=reduceAspectRatio(getAspectRatio.call(this));return is$1.array(e)?e.join(":"):e},set:function(e){this.isVideo?is$1.string(e)&&validateRatio(e)?(this.config.ratio=e,setAspectRatio.call(this)):this.debug.error("Invalid aspect ratio specified (".concat(e,")")):this.debug.warn("Aspect ratio can only be set for video")}},{key:"autoplay",set:function(e){var t=is$1.boolean(e)?e:this.config.autoplay;this.config.autoplay=t},get:function(){return Boolean(this.config.autoplay)}},{key:"currentTrack",set:function(e){captions.set.call(this,e,!1)},get:function(){var e=this.captions,t=e.toggled,i=e.currentTrack;return t?i:-1}},{key:"language",set:function(e){captions.setLanguage.call(this,e,!1)},get:function(){return(captions.getCurrentTrack.call(this)||{}).language}},{key:"pip",set:function(e){if(support.pip){var t=is$1.boolean(e)?e:!this.pip;is$1.function(this.media.webkitSetPresentationMode)&&this.media.webkitSetPresentationMode(t?pip.active:pip.inactive),is$1.function(this.media.requestPictureInPicture)&&(!this.pip&&t?this.media.requestPictureInPicture():this.pip&&!t&&document.exitPictureInPicture())}},get:function(){return support.pip?is$1.empty(this.media.webkitPresentationMode)?this.media===document.pictureInPictureElement:this.media.webkitPresentationMode===pip.active:null}}],[{key:"supported",value:function(e,t,i){return support.check(e,t,i)}},{key:"loadSprite",value:function(e,t){return loadSprite(e,t)}},{key:"setup",value:function(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=null;return is$1.string(t)?n=Array.from(document.querySelectorAll(t)):is$1.nodeList(t)?n=Array.from(t):is$1.array(t)&&(n=t.filter(is$1.element)),is$1.empty(n)?null:n.map((function(t){return new e(t,i)}))}}]),e}();Plyr.defaults=cloneDeep(defaults$1);export default Plyr; \ No newline at end of file
diff --git a/youtube/static/modules/plyr/plyr.min.mjs.map b/youtube/static/modules/plyr/plyr.min.mjs.map
new file mode 100644
index 0000000..054c2cf
--- /dev/null
+++ b/youtube/static/modules/plyr/plyr.min.mjs.map
@@ -0,0 +1 @@
+{"version":3,"sources":["plyr.mjs","node_modules/rangetouch/dist/rangetouch.mjs","src/js/utils/is.js","src/js/utils/animation.js","src/js/utils/browser.js","src/js/utils/objects.js","src/js/utils/elements.js","src/js/support.js","src/js/utils/events.js","src/js/utils/promise.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/utils/numbers.js","src/js/plyr.js"],"names":["_defineProperties","target","props","i","length","descriptor","enumerable","configurable","writable","Object","defineProperty","key","_createClass","Constructor","protoProps","staticProps","prototype","_defineProperty","obj","value","ownKeys","object","enumerableOnly","keys","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","push","apply","_objectSpread2","arguments","source","forEach","getOwnPropertyDescriptors","defineProperties","_objectWithoutPropertiesLoose","excluded","sourceKeys","indexOf","_objectWithoutProperties","sourceSymbolKeys","propertyIsEnumerable","call","_slicedToArray","arr","_arrayWithHoles","_iterableToArrayLimit","_unsupportedIterableToArray","_nonIterableRest","_toConsumableArray","_arrayWithoutHoles","_iterableToArray","_nonIterableSpread","Array","isArray","_arrayLikeToArray","iter","Symbol","iterator","from","_arr","_n","_d","_e","undefined","_s","_i","next","done","err","o","minLen","n","toString","slice","constructor","name","test","len","arr2","TypeError","_classCallCheck","e","t","r","defaults","addCSS","thumbWidth","watch","matches","document","querySelectorAll","includes","this","trigger","Event","bubbles","dispatchEvent","getConstructor","instanceOf","isNullOrUndefined","isObject","isNumber","Number","isNaN","isString","String","isBoolean","Boolean","isFunction","Function","isNodeList","NodeList","isElement","Element","isEvent","isEmpty","is","nullOrUndefined","number","string","boolean","function","array","nodeList","element","event","empty","getDecimalPlaces","concat","match","Math","max","round","parseFloat","toFixed","RangeTouch","querySelector","rangeTouch","config","init","enabled","style","userSelect","webKitUserSelect","touchAction","listeners","set","changedTouches","getAttribute","s","u","c","getBoundingClientRect","a","width","clientX","left","disabled","preventDefault","get","type","MutationObserver","addedNodes","observe","body","childList","subtree","map","documentElement","input","isWeakMap","WeakMap","isTextNode","Text","isKeyboardEvent","KeyboardEvent","isCue","window","TextTrackCue","VTTCue","isTrack","TextTrack","kind","isPromise","Promise","then","isUrl","URL","startsWith","hostname","is$1","weakMap","textNode","keyboardEvent","cue","track","promise","url","transitionEndEvent","createElement","events","WebkitTransition","MozTransition","OTransition","transition","find","repaint","delay","setTimeout","hidden","offsetHeight","browser","isIE","documentMode","isEdge","navigator","userAgent","isWebkit","isIPhone","platform","isIos","cloneDeep","JSON","parse","stringify","getDeep","path","split","reduce","extend","_len","sources","_key","shift","assign","wrap","elements","wrapper","targets","reverse","index","child","cloneNode","parent","parentNode","sibling","nextSibling","appendChild","insertBefore","setAttributes","attributes","entries","_ref","_ref3","_ref4","setAttribute","text","innerText","insertAfter","insertElement","removeElement","removeChild","emptyElement","childNodes","lastChild","replaceElement","newChild","oldChild","replaceChild","getAttributesFromSelector","sel","existingAttributes","existing","selector","trim","className","replace","parts","charAt","class","id","toggleHidden","hide","toggleClass","force","method","classList","contains","hasClass","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","closest","el","parentElement","nodeType","getElements","container","getElement","setFocus","tabFocus","focus","preventScroll","classNames","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","range","touch","transitions","reducedMotion","matchMedia","supportsPassiveListeners","supported","options","addEventListener","removeEventListener","toggleListener","callback","_this","toggle","passive","capture","eventListeners","on","off","once","_this2","onceCallback","args","triggerEvent","detail","CustomEvent","plyr","unbindListeners","item","ready","_this3","resolve","silencePromise","validateRatio","every","reduceAspectRatio","ratio","_ratio","height","divider","getDivider","w","h","getAspectRatio","embed","_this$media","videoWidth","videoHeight","setAspectRatio","isVideo","_ref2","padding","paddingBottom","isVimeo","vimeo","premium","offsetWidth","parseInt","getComputedStyle","offset","transform","videoFixedRatio","html5","getSources","getQualityOptions","quality","forced","setup","player","speed","onChange","_player$media","currentTime","paused","preload","readyState","playbackRate","src","play","load","cancelRequests","blankVideo","debug","log","dedupe","prev","curr","abs","generateId","prefix","floor","random","format","getPercentage","current","replaceAll","RegExp","toTitleCase","toUpperCase","substr","toLowerCase","toPascalCase","toCamelCase","stripHTML","fragment","createDocumentFragment","innerHTML","firstChild","getHTML","resources","youtube","i18n","{seektime}","seekTime","{title}","title","k","v","Storage","storage","store","localStorage","getItem","json","setItem","removeItem","fetch","responseType","reject","request","XMLHttpRequest","responseText","response","Error","status","open","send","loadSprite","hasId","exists","getElementById","update","data","insertAdjacentElement","useStorage","cached","content","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","aria-hidden","focusable","use","setAttributeNS","createLabel","attr","join","createBadge","badge","menu","createButton","buttonType","label","labelPressed","iconPressed","some","control","button","createRange","min","step","autocomplete","role","aria-label","aria-valuemin","aria-valuemax","aria-valuenow","updateRangeFill","createProgress","suffixKey","played","suffix","createTime","attrs","bindMenuItemShortcuts","menuItem","which","stopPropagation","isRadioButton","showMenuPanel","nextElementSibling","firstElementChild","previousElementSibling","lastElementChild","focusFirstMenuItem","createMenuItem","list","_ref$badge","_ref$checked","checked","aria-checked","flex","children","node","bind","currentTrack","forceHours","updateTimeDisplay","updateVolume","setRange","muted","pressed","updateProgress","_this4","val","getElementsByTagName","nodeValue","setProgress","buffered","percent","setProperty","updateSeekTooltip","_this5","tooltips","visible","show","clientRect","pageX","timeUpdate","invert","invertTime","seeking","durationUpdate","pow","hasDuration","displayDuration","toggleMenuButton","setting","updateSetting","pane","panels","default","getLabel","setQualityMenu","_this6","checkMenu","getBadge","sort","b","sorting","setCaptionsMenu","_this7","tracks","getTracks","toggled","language","unshift","setSpeedMenu","_this8","minimumSpeed","maximumSpeed","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","seektime","addProperty","controlPressed","_this$config","labels","parseUrl","safe","parser","buildUrlParams","params","URLSearchParams","isYouTube","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","global","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","referrerPolicy","noCookie","rel","showinfo","iv_load_policy","modestbranding","inactive","providers","types","getProviderByUrl","noop","Console","console","Fullscreen","property","scrollPosition","x","y","forceFallback","trapFocus","scrollX","scrollY","scrollTo","overflow","viewport","head","hasProperty","cleanupViewport","part","keyCode","activeElement","first","last","shiftKey","native","webkitEnterFullscreen","toggleFallback","requestFullscreen","navigationUI","webkitExitFullscreen","action","cancelFullScreen","exit","enter","fullscreenElement","shadowRoot","getRootNode","fullscreenEnabled","webkitFullscreenEnabled","mozFullScreenEnabled","msFullscreenEnabled","pre","loadImage","minWidth","image","Image","handler","onload","onerror","naturalWidth","addStyleHook","build","checkPlaying","setTitle","setPoster","togglePoster","enable","backgroundImage","backgroundSize","toggleControls","checkLoading","clearTimeout","timers","controlsElement","recentTouchSeek","lastSeekTime","Date","now","migrateStyles","getPropertyValue","removeProperty","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","_getAspectRatio$call2","videoX","videoY","maxWidth","margin","setGutter","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","commonjsGlobal","globalThis","self","createCommonjsModule","fn","module","exports","loadjs_umd","devnull","bundleIdCache","bundleResultCache","bundleCallbackQueue","publish","bundleId","pathsNotFound","q","splice","executeCallbacks","depsNotFound","success","loadFile","callbackFn","numTries","isLegacyIECss","doc","async","maxTries","numRetries","beforeCallbackFn","before","pathname","pathStripped","relList","as","onbeforeload","ev","sheet","cssText","defaultPrevented","loadjs","paths","arg1","arg2","loadFn","numWaiting","loadFiles","returnPromise","deps","bundleIds","subscribe","isDefined","factory","loadScript","parseId","$2","assurePlaybackState","hasPlayed","Vimeo","frameParams","sidedock","gesture","data-poster","thumbnail_large","Player","disableTextTrack","stop","restorePause","setVolume","setCurrentTime","setPlaybackRate","currentSrc","setLoop","getVideoUrl","getVideoWidth","getVideoHeight","dimensions","_dimensions","setAutopause","state","getVideoTitle","getCurrentTime","getDuration","getTextTracks","_ref$cues","strippedCues","getPaused","seconds","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","instance","getPlaybackRate","onReady","playVideo","pauseVideo","stopVideo","speeds","getAvailablePlaybackRates","clearInterval","buffering","setInterval","getVideoLoadedFraction","lastBuffered","onStateChange","unMute","destroy","manager","displayContainer","remove","Ads","initialized","loader","cuePoints","safetyTimer","countdownTimer","managerPromise","google","ima","startSafetyTimer","clearSafetyTimer","setupIMA","setVpaidMode","ImaSdkSettings","VpaidMode","ENABLED","setLocale","setDisableCustomPlaybackForIOS10Plus","AdDisplayContainer","AdsLoader","AdsManagerLoadedEvent","Type","ADS_MANAGER_LOADED","onAdsManagerLoaded","AdErrorEvent","AD_ERROR","onAdError","requestAds","AdsRequest","adTagUrl","linearAdSlotWidth","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","contentComplete","CONTENT_PAUSE_REQUESTED","pauseContent","CONTENT_RESUME_REQUESTED","resumeContent","LOG","adError","getMessage","cancel","addCuePoints","seekedTime","discardAdBreak","resize","ViewMode","NORMAL","initialize","zIndex","_this12","handlers","_this13","AV_PUBLISHERID","AV_CHANNELID","AV_URL","cb","AV_WIDTH","AV_HEIGHT","AV_CDIM2","parseVtt","vttDataString","processedList","frame","line","startTime","lineSplit","_lineSplit","_lineSplit$1$split2","matchTimes","endTime","fitRatio","outer","PreviewThumbnails","thumbnails","lastMouseMoveTime","mouseDown","loadedImages","thumb","scrubbing","getThumbnails","render","determineContainerAutoSizing","sortAndResolve","promises","getThumbnail","thumbnail","frames","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","clientWidth","sizeSpecifiedInCSS","thumbAspectRatio","thumbHeight","setThumbContainerPos","seekbarRect","plyrRect","minVal","maxVal","right","previewPos","_fitRatio","multiplier","top","currentScrubbingImageElement","currentThumbnailImageElement","insertElements","attribute","change","_sources$","_sources$$provider","crossorigin","clamp","Plyr","failed","jQuery","original","search","truthy","searchParams","tabindex","webkitShowPlaybackTargetPicker","isHidden","hiding","eventName","soft","unload","inputIsValid","fauxDuration","realDuration","Infinity","mozHasAudio","webkitAudioDecodedByteCount","audioTracks","updateStorage","requestPictureInPic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AAA,GAAAA,UAAA,GAAJ,GAC3BiN,EAAU,KAUd,OARI1H,KAAGG,OAAO0J,GACZnC,EAAU1L,MAAMM,KAAK+B,SAASC,iBAAiBuL,IACtC7J,KAAGO,SAASsJ,GACrBnC,EAAU1L,MAAMM,KAAKuN,GACZ7J,KAAGM,MAAMuJ,KAClBnC,EAAUmC,EAAS1P,OAAO6F,KAAGQ,UAG3BR,KAAGU,MAAMgH,GACJ,KAGFA,EAAQvE,KAAI,SAAArF,GAAC,OAAI,IAAIsnC,EAAKtnC,EAAGiQ,UvCw3P/Bq3B,EuCpjSHA,GAgsCNA,KAAKpnC,SAAWyI,UAAUzI,2BvCy3PXonC","file":"plyr.min.mjs","sourcesContent":["typeof navigator === \"object\" && function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\n\nfunction _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\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n}\n\nfunction _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\nfunction ownKeys(object, enumerableOnly) {\n var keys = Object.keys(object);\n\n if (Object.getOwnPropertySymbols) {\n var symbols = Object.getOwnPropertySymbols(object);\n if (enumerableOnly) symbols = symbols.filter(function (sym) {\n return Object.getOwnPropertyDescriptor(object, sym).enumerable;\n });\n keys.push.apply(keys, symbols);\n }\n\n return keys;\n}\n\nfunction _objectSpread2(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i] != null ? arguments[i] : {};\n\n if (i % 2) {\n ownKeys(Object(source), true).forEach(function (key) {\n _defineProperty(target, key, source[key]);\n });\n } else if (Object.getOwnPropertyDescriptors) {\n Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));\n } else {\n ownKeys(Object(source)).forEach(function (key) {\n Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));\n });\n }\n }\n\n return target;\n}\n\nfunction _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n\n return target;\n}\n\nfunction _objectWithoutProperties(source, excluded) {\n if (source == null) return {};\n\n var target = _objectWithoutPropertiesLoose(source, excluded);\n\n var key, i;\n\n if (Object.getOwnPropertySymbols) {\n var sourceSymbolKeys = Object.getOwnPropertySymbols(source);\n\n for (i = 0; i < sourceSymbolKeys.length; i++) {\n key = sourceSymbolKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;\n target[key] = source[key];\n }\n }\n\n return target;\n}\n\nfunction _slicedToArray(arr, i) {\n return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();\n}\n\nfunction _toConsumableArray(arr) {\n return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();\n}\n\nfunction _arrayWithoutHoles(arr) {\n if (Array.isArray(arr)) return _arrayLikeToArray(arr);\n}\n\nfunction _arrayWithHoles(arr) {\n if (Array.isArray(arr)) return arr;\n}\n\nfunction _iterableToArray(iter) {\n if (typeof Symbol !== \"undefined\" && Symbol.iterator in Object(iter)) return Array.from(iter);\n}\n\nfunction _iterableToArrayLimit(arr, i) {\n if (typeof Symbol === \"undefined\" || !(Symbol.iterator in Object(arr))) return;\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\nfunction _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return _arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(o);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);\n}\n\nfunction _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n\n for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];\n\n return arr2;\n}\n\nfunction _nonIterableSpread() {\n throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\n\nfunction _nonIterableRest() {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\n\nfunction _classCallCheck$1(e, t) {\n if (!(e instanceof t)) throw new TypeError(\"Cannot call a class as a function\");\n}\n\nfunction _defineProperties$1(e, t) {\n for (var n = 0; n < t.length; n++) {\n var r = t[n];\n r.enumerable = r.enumerable || !1, r.configurable = !0, \"value\" in r && (r.writable = !0), Object.defineProperty(e, r.key, r);\n }\n}\n\nfunction _createClass$1(e, t, n) {\n return t && _defineProperties$1(e.prototype, t), n && _defineProperties$1(e, n), e;\n}\n\nfunction _defineProperty$1(e, t, n) {\n return t in e ? Object.defineProperty(e, t, {\n value: n,\n enumerable: !0,\n configurable: !0,\n writable: !0\n }) : e[t] = n, e;\n}\n\nfunction ownKeys$1(e, t) {\n var n = Object.keys(e);\n\n if (Object.getOwnPropertySymbols) {\n var r = Object.getOwnPropertySymbols(e);\n t && (r = r.filter(function (t) {\n return Object.getOwnPropertyDescriptor(e, t).enumerable;\n })), n.push.apply(n, r);\n }\n\n return n;\n}\n\nfunction _objectSpread2$1(e) {\n for (var t = 1; t < arguments.length; t++) {\n var n = null != arguments[t] ? arguments[t] : {};\n t % 2 ? ownKeys$1(Object(n), !0).forEach(function (t) {\n _defineProperty$1(e, t, n[t]);\n }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : ownKeys$1(Object(n)).forEach(function (t) {\n Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(n, t));\n });\n }\n\n return e;\n}\n\nvar defaults = {\n addCSS: !0,\n thumbWidth: 15,\n watch: !0\n};\n\nfunction matches(e, t) {\n return function () {\n return Array.from(document.querySelectorAll(t)).includes(this);\n }.call(e, t);\n}\n\nfunction trigger(e, t) {\n if (e && t) {\n var n = new Event(t, {\n bubbles: !0\n });\n e.dispatchEvent(n);\n }\n}\n\nvar getConstructor = function getConstructor(e) {\n return null != e ? e.constructor : null;\n},\n instanceOf = function instanceOf(e, t) {\n return !!(e && t && e instanceof t);\n},\n isNullOrUndefined = function isNullOrUndefined(e) {\n return null == e;\n},\n isObject = function isObject(e) {\n return getConstructor(e) === Object;\n},\n isNumber = function isNumber(e) {\n return getConstructor(e) === Number && !Number.isNaN(e);\n},\n isString = function isString(e) {\n return getConstructor(e) === String;\n},\n isBoolean = function isBoolean(e) {\n return getConstructor(e) === Boolean;\n},\n isFunction = function isFunction(e) {\n return getConstructor(e) === Function;\n},\n isArray = function isArray(e) {\n return Array.isArray(e);\n},\n isNodeList = function isNodeList(e) {\n return instanceOf(e, NodeList);\n},\n isElement = function isElement(e) {\n return instanceOf(e, Element);\n},\n isEvent = function isEvent(e) {\n return instanceOf(e, Event);\n},\n isEmpty = function isEmpty(e) {\n return isNullOrUndefined(e) || (isString(e) || isArray(e) || isNodeList(e)) && !e.length || isObject(e) && !Object.keys(e).length;\n},\n 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\nfunction getDecimalPlaces(e) {\n var t = \"\".concat(e).match(/(?:\\.(\\d+))?(?:[eE]([+-]?\\d+))?$/);\n return t ? Math.max(0, (t[1] ? t[1].length : 0) - (t[2] ? +t[2] : 0)) : 0;\n}\n\nfunction round(e, t) {\n if (1 > t) {\n var n = getDecimalPlaces(t);\n return parseFloat(e.toFixed(n));\n }\n\n return Math.round(e / t) * t;\n}\n\nvar RangeTouch = function () {\n function e(t, n) {\n _classCallCheck$1(this, e), is.element(t) ? this.element = t : is.string(t) && (this.element = document.querySelector(t)), is.element(this.element) && is.empty(this.element.rangeTouch) && (this.config = _objectSpread2$1({}, defaults, {}, n), this.init());\n }\n\n return _createClass$1(e, [{\n key: \"init\",\n value: function value() {\n e.enabled && (this.config.addCSS && (this.element.style.userSelect = \"none\", this.element.style.webKitUserSelect = \"none\", this.element.style.touchAction = \"manipulation\"), this.listeners(!0), this.element.rangeTouch = this);\n }\n }, {\n key: \"destroy\",\n value: function value() {\n e.enabled && (this.config.addCSS && (this.element.style.userSelect = \"\", this.element.style.webKitUserSelect = \"\", this.element.style.touchAction = \"\"), this.listeners(!1), this.element.rangeTouch = null);\n }\n }, {\n key: \"listeners\",\n value: function value(e) {\n var t = this,\n n = e ? \"addEventListener\" : \"removeEventListener\";\n [\"touchstart\", \"touchmove\", \"touchend\"].forEach(function (e) {\n t.element[n](e, function (e) {\n return t.set(e);\n }, !1);\n });\n }\n }, {\n key: \"get\",\n value: function value(t) {\n if (!e.enabled || !is.event(t)) return null;\n var n,\n r = t.target,\n i = t.changedTouches[0],\n o = parseFloat(r.getAttribute(\"min\")) || 0,\n s = parseFloat(r.getAttribute(\"max\")) || 100,\n u = parseFloat(r.getAttribute(\"step\")) || 1,\n c = r.getBoundingClientRect(),\n a = 100 / c.width * (this.config.thumbWidth / 2) / 100;\n return 0 > (n = 100 / c.width * (i.clientX - c.left)) ? n = 0 : 100 < n && (n = 100), 50 > n ? n -= (100 - 2 * n) * a : 50 < n && (n += 2 * (n - 50) * a), o + round(n / 100 * (s - o), u);\n }\n }, {\n key: \"set\",\n value: function value(t) {\n e.enabled && is.event(t) && !t.target.disabled && (t.preventDefault(), t.target.value = this.get(t), trigger(t.target, \"touchend\" === t.type ? \"change\" : \"input\"));\n }\n }], [{\n key: \"setup\",\n value: function value(t) {\n var n = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : {},\n r = null;\n if (is.empty(t) || is.string(t) ? r = Array.from(document.querySelectorAll(is.string(t) ? t : 'input[type=\"range\"]')) : is.element(t) ? r = [t] : is.nodeList(t) ? r = Array.from(t) : is.array(t) && (r = t.filter(is.element)), is.empty(r)) return null;\n\n var i = _objectSpread2$1({}, defaults, {}, n);\n\n if (is.string(t) && i.watch) {\n var o = new MutationObserver(function (n) {\n Array.from(n).forEach(function (n) {\n Array.from(n.addedNodes).forEach(function (n) {\n is.element(n) && matches(n, t) && new e(n, i);\n });\n });\n });\n o.observe(document.body, {\n childList: !0,\n subtree: !0\n });\n }\n\n return r.map(function (t) {\n return new e(t, n);\n });\n }\n }, {\n key: \"enabled\",\n get: function get() {\n return \"ontouchstart\" in document.documentElement;\n }\n }]), e;\n}();\n\n// ==========================================================================\n// Type checking utils\n// ==========================================================================\nvar getConstructor$1 = function getConstructor(input) {\n return input !== null && typeof input !== 'undefined' ? input.constructor : null;\n};\n\nvar instanceOf$1 = function instanceOf(input, constructor) {\n return Boolean(input && constructor && input instanceof constructor);\n};\n\nvar isNullOrUndefined$1 = function isNullOrUndefined(input) {\n return input === null || typeof input === 'undefined';\n};\n\nvar isObject$1 = function isObject(input) {\n return getConstructor$1(input) === Object;\n};\n\nvar isNumber$1 = function isNumber(input) {\n return getConstructor$1(input) === Number && !Number.isNaN(input);\n};\n\nvar isString$1 = function isString(input) {\n return getConstructor$1(input) === String;\n};\n\nvar isBoolean$1 = function isBoolean(input) {\n return getConstructor$1(input) === Boolean;\n};\n\nvar isFunction$1 = function isFunction(input) {\n return getConstructor$1(input) === Function;\n};\n\nvar isArray$1 = function isArray(input) {\n return Array.isArray(input);\n};\n\nvar isWeakMap = function isWeakMap(input) {\n return instanceOf$1(input, WeakMap);\n};\n\nvar isNodeList$1 = function isNodeList(input) {\n return instanceOf$1(input, NodeList);\n};\n\nvar isElement$1 = function isElement(input) {\n return instanceOf$1(input, Element);\n};\n\nvar isTextNode = function isTextNode(input) {\n return getConstructor$1(input) === Text;\n};\n\nvar isEvent$1 = function isEvent(input) {\n return instanceOf$1(input, Event);\n};\n\nvar isKeyboardEvent = function isKeyboardEvent(input) {\n return instanceOf$1(input, KeyboardEvent);\n};\n\nvar isCue = function isCue(input) {\n return instanceOf$1(input, window.TextTrackCue) || instanceOf$1(input, window.VTTCue);\n};\n\nvar isTrack = function isTrack(input) {\n return instanceOf$1(input, TextTrack) || !isNullOrUndefined$1(input) && isString$1(input.kind);\n};\n\nvar isPromise = function isPromise(input) {\n return instanceOf$1(input, Promise) && isFunction$1(input.then);\n};\n\nvar 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\nvar 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\nvar 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// ==========================================================================\nvar 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\nfunction 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// ==========================================================================\nvar 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\nfunction cloneDeep(object) {\n return JSON.parse(JSON.stringify(object));\n} // Get a nested value in an object\n\nfunction 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\nfunction 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\nfunction 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\nfunction 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\nfunction 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\nfunction 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\nfunction 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\nfunction 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\nfunction 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\nfunction 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\nfunction 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 });\n return extend(existing, attributes);\n} // Toggle hidden\n\nfunction 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\nfunction 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\nfunction hasClass(element, className) {\n return is$1.element(element) && element.classList.contains(className);\n} // Element matches selector\n\nfunction matches$1(element, selector) {\n var _Element = Element,\n prototype = _Element.prototype;\n\n function match() {\n return Array.from(document.querySelectorAll(selector)).includes(this);\n }\n\n var method = prototype.matches || prototype.webkitMatchesSelector || prototype.mozMatchesSelector || prototype.msMatchesSelector || match;\n return method.call(element, selector);\n} // Closest ancestor element matching selector (also tests element itself)\n\nfunction closest(element, selector) {\n var _Element2 = Element,\n prototype = _Element2.prototype; // https://developer.mozilla.org/en-US/docs/Web/API/Element/closest#Polyfill\n\n function closestElement() {\n var el = this;\n\n do {\n if (matches$1.matches(el, selector)) return el;\n el = el.parentElement || el.parentNode;\n } while (el !== null && el.nodeType === 1);\n\n return null;\n }\n\n var method = prototype.closest || closestElement;\n return method.call(element, selector);\n} // Find all elements\n\nfunction getElements(selector) {\n return this.elements.container.querySelectorAll(selector);\n} // Find a single element\n\nfunction getElement(selector) {\n return this.elements.container.querySelector(selector);\n} // Set focus and tab focus class\n\nfunction 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\nvar 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\nvar 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// https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md\n// https://www.youtube.com/watch?v=NPM6172J22g\n\nvar 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\nfunction 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\nfunction 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\nfunction 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\nfunction 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\nfunction 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: _objectSpread2(_objectSpread2({}, detail), {}, {\n plyr: this\n })\n }); // Dispatch the event\n\n element.dispatchEvent(event);\n} // Unbind all cached event listeners\n\nfunction 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\nfunction 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/**\n * Silence a Promise-like object.\n * This is useful for avoiding non-harmful, but potentially confusing \"uncaught\n * play promise\" rejection error messages.\n * @param {Object} value An object that may or may not be `Promise`-like.\n */\n\nfunction silencePromise(value) {\n if (is$1.promise(value)) {\n value.then(null, function () {});\n }\n}\n\nfunction 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}\nfunction 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}\nfunction 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\nfunction setAspectRatio(input) {\n if (!this.isVideo) {\n return {};\n }\n\n var wrapper = this.elements.wrapper;\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 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.config.vimeo.premium && this.supported.ui) {\n var height = 100 / this.media.offsetWidth * parseInt(window.getComputedStyle(this.media).paddingBottom, 10);\n var offset = (height - padding) / (height / 50);\n this.media.style.transform = \"translateY(-\".concat(offset, \"%)\");\n } else if (this.isHTML5) {\n wrapper.classList.toggle(this.config.classNames.videoFixedRatio, ratio !== null);\n }\n\n return {\n padding: padding,\n ratio: ratio\n };\n}\n\n// ==========================================================================\nvar 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 // Whether we're forcing all options (e.g. for streaming)\n if (this.config.quality.forced) {\n return this.config.quality.options;\n } // Get sizes from <source> elements\n\n\n return html5.getSources.call(this).map(function (source) {\n return Number(source.getAttribute('data-res'));\n }).filter(Boolean);\n },\n setup: function setup() {\n if (!this.isHTML5) {\n return;\n }\n\n var player = this; // Set speed options from config\n\n player.options.speed = player.config.speed.options; // 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('data-res'));\n },\n set: function set(input) {\n if (player.quality === input) {\n return;\n } // If we're using an an external handler...\n\n\n if (player.config.quality.forced && is$1.function(player.config.quality.onChange)) {\n player.config.quality.onChange(input);\n } else {\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('data-res')) === 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,\n playbackRate = _player$media.playbackRate; // 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.speed = playbackRate;\n player.currentTime = currentTime; // Resume playing\n\n if (!paused) {\n silencePromise(player.play());\n }\n }); // Load new source\n\n player.media.load();\n }\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\nfunction 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\nfunction closest$1(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\nfunction generateId(prefix) {\n return \"\".concat(prefix, \"-\").concat(Math.floor(Math.random() * 10000));\n} // Format string\n\nfunction 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\nfunction 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\nvar replaceAll = 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\nvar toTitleCase = 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\nfunction 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\nfunction 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\nfunction 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\nfunction getHTML(element) {\n var wrapper = document.createElement('div');\n wrapper.appendChild(element);\n return wrapper.innerHTML;\n}\n\nvar resources = {\n pip: 'PIP',\n airplay: 'AirPlay',\n html5: 'HTML5',\n vimeo: 'Vimeo',\n youtube: 'YouTube'\n};\nvar 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\nvar Storage = /*#__PURE__*/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// ==========================================================================\nfunction 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\nfunction 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\nvar getHours = function getHours(value) {\n return Math.trunc(value / 60 / 60 % 60, 10);\n};\nvar getMinutes = function getMinutes(value) {\n return Math.trunc(value / 60 % 60, 10);\n};\nvar getSeconds = function getSeconds(value) {\n return Math.trunc(value % 60, 10);\n}; // Format time to UI friendly string\n\nfunction 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(undefined, 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\nvar 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 'aria-hidden': 'true',\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\n var attributes = _objectSpread2(_objectSpread2({}, attr), {}, {\n class: [attr.class, this.config.classNames.hidden].filter(Boolean).join(' ')\n });\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.call(this, 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.call(this, 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\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 }\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=\"menucaptions\"]');\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() {\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\"]'); // Filter out invalid speeds\n\n this.options.speed = this.options.speed.filter(function (o) {\n return o >= _this8.minimumSpeed && o <= _this8.maximumSpeed;\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 (is$1.array(this.config.controls) && 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(is$1.array(this.config.controls) ? 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 // Ignored on iOS as it's handled globally\n // https://developer.apple.com/library/safari/documentation/AudioVideo/Conceptual/Using_HTML5_Audio_Video/Device-SpecificConsiderations/Device-SpecificConsiderations.html\n\n\n if (control === 'volume' && !browser.isIos) {\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.call(_this10, 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.call(_this10, 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.call(_this10, 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 })); // Menu Captions\n\n pane.appendChild(createElement('div', {\n role: 'menucaptions'\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 }); // Set download attribute for HTML5 only\n\n\n if (_this10.isHTML5) {\n _attributes.download = '';\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 }\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\nfunction 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\nfunction 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\nvar 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 // Note: mode='hidden' forces a track to download. To ensure every track\n // isn't downloaded at once, only 'showing' tracks should be reassigned\n // eslint-disable-next-line no-param-reassign\n\n if (track.mode === 'showing') {\n // eslint-disable-next-line no-param-reassign\n track.mode = 'hidden';\n } // Add event listener for cue changes\n\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 (is$1.array(this.config.controls) && 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 _this2 = this;\n\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 } // Wait for the call stack to clear before setting mode='hidden'\n // on the active track - forcing the browser to download it\n\n\n setTimeout(function () {\n if (active && _this2.captions.toggled) {\n _this2.captions.currentTrackNode.mode = 'hidden';\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: 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 _this3 = 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 !_this3.isHTML5 || update || _this3.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 _this4 = 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((_this4.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// ==========================================================================\nvar 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: '/theme/modules/plyr/plyr.svg',\n // Blank video (used to prevent errors on source change)\n blankVideo: '/theme/modules/plyr/blank.webm',\n // Quality default\n quality: {\n default: 576,\n // The options to display in the UI, if available for the source media\n options: [4320, 2880, 2160, 1440, 1080, 720, 576, 480, 360, 240],\n forced: false,\n onChange: null\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 // The options to display in the UI, if available for the source media (e.g. Vimeo and YouTube only support 0.5x-4x)\n options: [0.5, 0.75, 1, 1.25, 1.5, 1.75, 2, 4]\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 // Selector for the fullscreen container so contextual / non-player content can remain visible in fullscreen mode\n // Non-ancestors of the player element will be ignored\n // container: null, // defaults to the player element\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 pip: 'PIP',\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 // Whether the owner of the video has a Pro or Business account\n // (which allows us to properly hide controls without CSS hacks, etc)\n premium: false,\n // Custom settings from Plyr\n referrerPolicy: null // https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement/referrerPolicy\n\n },\n // YouTube plugin\n youtube: {\n noCookie: true,\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// ==========================================================================\nvar pip = {\n active: 'picture-in-picture',\n inactive: 'inline'\n};\n\n// ==========================================================================\n// Plyr supported types and providers\n// ==========================================================================\nvar providers = {\n html5: 'html5',\n youtube: 'youtube',\n vimeo: 'vimeo'\n};\nvar types = {\n audio: 'audio',\n video: 'video'\n};\n/**\n * Get provider by URL\n * @param {String} url\n */\n\nfunction 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// ==========================================================================\nvar noop = function noop() {};\n\nvar Console = /*#__PURE__*/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\nvar Fullscreen = /*#__PURE__*/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'; // Get the fullscreen element\n // Checks container is an ancestor, defaults to null\n\n this.player.elements.fullscreen = player.config.fullscreen.container && closest(this.player.elements.container, player.config.fullscreen.container); // 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 _this.onChange();\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 }); // Tap focus when in fullscreen\n\n on.call(this, this.player.elements.container, 'keydown', function (event) {\n return _this.trapFocus(event);\n }); // Update the UI\n\n this.update();\n } // Determine if native supported\n\n\n _createClass(Fullscreen, [{\n key: \"onChange\",\n value: 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);\n }\n }, {\n key: \"toggleFallback\",\n value: 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 this.onChange();\n } // Trap focus inside container\n\n }, {\n key: \"trapFocus\",\n value: function trapFocus(event) {\n // Bail if iOS, not active, not the tab key\n if (browser.isIos || !this.active || event.key !== 'Tab' || event.keyCode !== 9) {\n return;\n } // Get the current focused element\n\n\n var focused = document.activeElement;\n var focusable = getElements.call(this.player, 'a[href], button:not(:disabled), input:not(:disabled), [tabindex]');\n\n var _focusable = _slicedToArray(focusable, 1),\n first = _focusable[0];\n\n var last = focusable[focusable.length - 1];\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 } // Update UI\n\n }, {\n key: \"update\",\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 this.toggleFallback(true);\n } else if (!this.prefix) {\n this.target.requestFullscreen({\n navigationUI: 'hide'\n });\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 silencePromise(this.player.play());\n } else if (!Fullscreen.native || this.forceFallback) {\n this.toggleFallback(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 && element.shadowRoot ? element === this.target.getRootNode().host : 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.fullscreen || 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// ==========================================================================\nfunction 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\nvar 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('data-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 target.setAttribute('aria-label', i18n.get(_this3.playing ? 'pause' : 'play', _this3.config));\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 // Migrate any custom properties from the media to the parent\n migrateStyles: function migrateStyles() {\n var _this5 = this;\n\n // Loop through values (as they are the keys when the object is spread 🤔)\n Object.values(_objectSpread2({}, this.media.style)) // We're only fussed about Plyr specific properties\n .filter(function (key) {\n return !is$1.empty(key) && key.startsWith('--plyr');\n }).forEach(function (key) {\n // Set on the container\n _this5.elements.container.style.setProperty(key, _this5.media.style.getPropertyValue(key)); // Clean up from media element\n\n\n _this5.media.style.removeProperty(key);\n }); // Remove attribute if empty\n\n if (is$1.empty(this.media.style)) {\n this.media.removeAttribute('style');\n }\n }\n};\n\nvar Listeners = /*#__PURE__*/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 silencePromise(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 } // 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 if (event.type !== 'focusout') {\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 }\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 focusout', 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 || player.config.vimeo.premium) {\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 browser fullscreen API, 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 }); // 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(); // Call pause otherwise IE11 will start playing the video again\n\n player.pause();\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, function () {\n silencePromise(player.play());\n }, 'play');\n } else {\n _this.proxy(event, function () {\n silencePromise(player.togglePlay());\n }, '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 !== false && 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', function () {\n silencePromise(player.togglePlay());\n }, '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 event.preventDefault();\n\n controls.toggleMenu.call(player, event);\n }, null, false); // Can't be passive as we're preventing default\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 silencePromise(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 touchend 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 }); // Also update controls.hover state for any non-player children of fullscreen element (as above)\n\n if (elements.fullscreen) {\n Array.from(elements.fullscreen.children).filter(function (c) {\n return !c.contains(elements.container);\n }).forEach(function (child) {\n _this3.bind(child, 'mouseenter mouseleave', function (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\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\nvar commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};\n\nfunction createCommonjsModule(fn, module) {\n\treturn module = { exports: {} }, fn(module, module.exports), module.exports;\n}\n\nvar 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 pathname = path.replace(/[\\?|#].*$/, ''),\n pathStripped = path.replace(/^(css|img)!/, ''),\n isLegacyIECss,\n e;\n numTries = numTries || 0;\n\n if (/(^css!|\\.css$)/.test(pathname)) {\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|webp)$)/.test(pathname)) {\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// ==========================================================================\nfunction loadScript(url) {\n return new Promise(function (resolve, reject) {\n loadjs_umd(url, {\n success: resolve,\n error: reject\n });\n });\n}\n\nfunction 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\nfunction 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\nvar vimeo = {\n setup: function setup() {\n var player = this; // Add embed class for responsive\n\n toggleClass(player.elements.wrapper, player.config.classNames.embed, true); // Set speed options from config\n\n player.options.speed = player.config.speed.options; // Set intial ratio\n\n setAspectRatio.call(player); // Load the SDK if not already\n\n if (!is$1.object(window.Vimeo)) {\n loadScript(player.config.urls.vimeo.sdk).then(function () {\n vimeo.ready.call(player);\n }).catch(function (error) {\n player.debug.warn('Vimeo SDK (player.js) failed to load', error);\n });\n } else {\n vimeo.ready.call(player);\n }\n },\n // API Ready\n ready: function ready() {\n var _this = this;\n\n var player = this;\n var config = player.config.vimeo;\n\n var premium = config.premium,\n referrerPolicy = config.referrerPolicy,\n frameParams = _objectWithoutProperties(config, [\"premium\", \"referrerPolicy\"]); // If the owner has a pro or premium account then we can hide controls etc\n\n\n if (premium) {\n Object.assign(frameParams, {\n controls: false,\n sidedock: false\n });\n } // Get Vimeo params for the iframe\n\n\n var params = buildUrlParams(_objectSpread2({\n loop: player.config.loop.active,\n autoplay: player.autoplay,\n muted: player.muted,\n gesture: 'media',\n playsinline: !this.config.fullscreen.iosNative\n }, frameParams)); // 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('allow', 'autoplay,fullscreen,picture-in-picture'); // Set the referrer policy if required\n\n if (!is$1.empty(referrerPolicy)) {\n iframe.setAttribute('referrerPolicy', referrerPolicy);\n } // Inject the package\n\n\n var poster = player.poster;\n\n if (premium) {\n iframe.setAttribute('data-poster', poster);\n player.media = replaceElement(iframe, player.media);\n } else {\n var wrapper = createElement('div', {\n class: player.config.classNames.embedContainer,\n 'data-poster': poster\n });\n wrapper.appendChild(iframe);\n player.media = replaceElement(wrapper, player.media);\n } // Get poster image\n\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 () {\n // Cannot set Playback Rate, Video is probably not on Pro account\n player.options.speed = [1];\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 _this.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(_this);\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(_this);\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('bufferstart', function () {\n triggerEvent.call(player, player.media, 'waiting');\n });\n player.embed.on('bufferend', function () {\n triggerEvent.call(player, player.media, 'playing');\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\nfunction 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\nfunction 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\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 } // Use YouTube's default\n\n\n return undefined;\n}\n\nvar 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 'data-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 var speeds = instance.getAvailablePlaybackRates(); // Filter based on config\n\n player.options.speed = speeds.filter(function (s) {\n return player.config.speed.options.includes(s);\n }); // 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 case 3:\n // Trigger waiting event to add loading classes to container as the video buffers.\n triggerEvent.call(player, player.media, 'waiting');\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// ==========================================================================\nvar 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); // Poster image 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.setup.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\nvar 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\nvar Ads = /*#__PURE__*/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 var _this4 = this;\n\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); // Create ads loader\n\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 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 container = this.player.elements.container;\n\n try {\n // Request video ads\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 if (this.player.ended) {\n this.loadAds();\n } else {\n // The SDK won't allow new ads to be called without receiving a contentComplete()\n this.loader.contentComplete();\n }\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 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 }\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 silencePromise(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 that the manager has been destroyed set it to also be un-initialized\n\n _this11.initialized = false; // 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: config.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\nvar 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\nvar fitRatio = function fitRatio(ratio, outer) {\n var targetRatio = outer.width / outer.height;\n var result = {};\n\n if (ratio > targetRatio) {\n result.width = outer.width;\n result.height = 1 / ratio * outer.width;\n } else {\n result.height = outer.height;\n result.width = ratio * outer.height;\n }\n\n return result;\n};\n\nvar PreviewThumbnails = /*#__PURE__*/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 // Toggle the 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 } // Resolve promise\n\n\n var sortAndResolve = function sortAndResolve() {\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 }; // Via callback()\n\n\n if (is$1.function(src)) {\n src(function (thumbnails) {\n _this2.thumbnails = thumbnails;\n sortAndResolve();\n });\n } // VTT urls\n else {\n // If string, convert into single-element list\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 }); // Resolve\n\n Promise.all(promises).then(sortAndResolve);\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 does not exist or is false)\n if (is$1.nullOrUndefined(event.button) || 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: \"destroy\",\n value: function destroy() {\n if (this.elements.thumb.container) {\n this.elements.thumb.container.remove();\n }\n\n if (this.elements.scrubbing.container) {\n this.elements.scrubbing.container.remove();\n }\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 || this.elements.thumb.imageContainer.clientWidth > 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 } else if (this.elements.thumb.imageContainer.clientHeight > 20 && this.elements.thumb.imageContainer.clientWidth < 20) {\n var _thumbWidth = Math.floor(this.elements.thumb.imageContainer.clientHeight * this.thumbAspectRatio);\n\n this.elements.thumb.imageContainer.style.width = \"\".concat(_thumbWidth, \"px\");\n } else if (this.elements.thumb.imageContainer.clientHeight < 20 && this.elements.thumb.imageContainer.clientWidth > 20) {\n var thumbHeight = Math.floor(this.elements.thumb.imageContainer.clientWidth / this.thumbAspectRatio);\n this.elements.thumb.imageContainer.style.height = \"\".concat(thumbHeight, \"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 var _fitRatio = fitRatio(this.thumbAspectRatio, {\n width: this.player.media.clientWidth,\n height: this.player.media.clientHeight\n }),\n width = _fitRatio.width,\n height = _fitRatio.height;\n\n this.elements.scrubbing.container.style.width = \"\".concat(width, \"px\");\n this.elements.scrubbing.container.style.height = \"\".concat(height, \"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(previewImage.naturalHeight * multiplier, \"px\"); // eslint-disable-next-line no-param-reassign\n\n previewImage.style.width = \"\".concat(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 var _fitRatio2 = fitRatio(this.thumbAspectRatio, {\n width: this.player.media.clientWidth,\n height: this.player.media.clientHeight\n }),\n height = _fitRatio2.height;\n\n return height;\n } // If css is used this needs to return the css height for sprites to work (see setImageSizeAndOffset)\n\n\n if (this.sizeSpecifiedInCSS) {\n return this.elements.thumb.imageContainer.clientHeight;\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\nvar 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 } // Update previewThumbnails config & reload plugin\n\n\n if (!is$1.empty(input.previewThumbnails)) {\n Object.assign(_this2.config.previewThumbnails, input.previewThumbnails); // Cleanup previewThumbnails plugin if it was loaded\n\n if (_this2.previewThumbnails && _this2.previewThumbnails.loaded) {\n _this2.previewThumbnails.destroy();\n\n _this2.previewThumbnails = null;\n } // Create new instance if it is still enabled\n\n\n if (_this2.config.previewThumbnails.enabled) {\n _this2.previewThumbnails = new PreviewThumbnails(_this2);\n }\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 */\nfunction 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\nvar Plyr = /*#__PURE__*/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 fullscreen: 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 } // Migrate custom properties from media to container (so they work 😉)\n\n\n ui.migrateStyles.call(this); // Add style hook\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 fullscreen\n\n\n this.fullscreen = new Fullscreen(this); // Setup interface\n // If embed but not fully supported, build interface now to avoid flash of controls\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 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 silencePromise(_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 silencePromise(_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 null;\n }\n\n return 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 return this.play();\n }\n\n return this.pause();\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 -= 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 += 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 && is$1.array(this.config.controls) && 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$1(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') || this.media.getAttribute('data-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\nPlyr.defaults = cloneDeep(defaults$1);\n\nexport default Plyr;\n","function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError(\"Cannot call a class as a function\")}function _defineProperties(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,\"value\"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function _createClass(e,t,n){return t&&_defineProperties(e.prototype,t),n&&_defineProperties(e,n),e}function _defineProperty(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ownKeys(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function _objectSpread2(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(n),!0).forEach((function(t){_defineProperty(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ownKeys(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var defaults={addCSS:!0,thumbWidth:15,watch:!0};function matches(e,t){return function(){return Array.from(document.querySelectorAll(t)).includes(this)}.call(e,t)}function trigger(e,t){if(e&&t){var n=new Event(t,{bubbles:!0});e.dispatchEvent(n)}}var getConstructor=function(e){return null!=e?e.constructor:null},instanceOf=function(e,t){return!!(e&&t&&e instanceof t)},isNullOrUndefined=function(e){return null==e},isObject=function(e){return getConstructor(e)===Object},isNumber=function(e){return getConstructor(e)===Number&&!Number.isNaN(e)},isString=function(e){return getConstructor(e)===String},isBoolean=function(e){return getConstructor(e)===Boolean},isFunction=function(e){return getConstructor(e)===Function},isArray=function(e){return Array.isArray(e)},isNodeList=function(e){return instanceOf(e,NodeList)},isElement=function(e){return instanceOf(e,Element)},isEvent=function(e){return instanceOf(e,Event)},isEmpty=function(e){return isNullOrUndefined(e)||(isString(e)||isArray(e)||isNodeList(e))&&!e.length||isObject(e)&&!Object.keys(e).length},is={nullOrUndefined:isNullOrUndefined,object:isObject,number:isNumber,string:isString,boolean:isBoolean,function:isFunction,array:isArray,nodeList:isNodeList,element:isElement,event:isEvent,empty:isEmpty};function getDecimalPlaces(e){var t=\"\".concat(e).match(/(?:\\.(\\d+))?(?:[eE]([+-]?\\d+))?$/);return t?Math.max(0,(t[1]?t[1].length:0)-(t[2]?+t[2]:0)):0}function round(e,t){if(1>t){var n=getDecimalPlaces(t);return parseFloat(e.toFixed(n))}return Math.round(e/t)*t}var RangeTouch=function(){function e(t,n){_classCallCheck(this,e),is.element(t)?this.element=t:is.string(t)&&(this.element=document.querySelector(t)),is.element(this.element)&&is.empty(this.element.rangeTouch)&&(this.config=_objectSpread2({},defaults,{},n),this.init())}return _createClass(e,[{key:\"init\",value:function(){e.enabled&&(this.config.addCSS&&(this.element.style.userSelect=\"none\",this.element.style.webKitUserSelect=\"none\",this.element.style.touchAction=\"manipulation\"),this.listeners(!0),this.element.rangeTouch=this)}},{key:\"destroy\",value:function(){e.enabled&&(this.config.addCSS&&(this.element.style.userSelect=\"\",this.element.style.webKitUserSelect=\"\",this.element.style.touchAction=\"\"),this.listeners(!1),this.element.rangeTouch=null)}},{key:\"listeners\",value:function(e){var t=this,n=e?\"addEventListener\":\"removeEventListener\";[\"touchstart\",\"touchmove\",\"touchend\"].forEach((function(e){t.element[n](e,(function(e){return t.set(e)}),!1)}))}},{key:\"get\",value:function(t){if(!e.enabled||!is.event(t))return null;var n,r=t.target,i=t.changedTouches[0],o=parseFloat(r.getAttribute(\"min\"))||0,s=parseFloat(r.getAttribute(\"max\"))||100,u=parseFloat(r.getAttribute(\"step\"))||1,c=r.getBoundingClientRect(),a=100/c.width*(this.config.thumbWidth/2)/100;return 0>(n=100/c.width*(i.clientX-c.left))?n=0:100<n&&(n=100),50>n?n-=(100-2*n)*a:50<n&&(n+=2*(n-50)*a),o+round(n/100*(s-o),u)}},{key:\"set\",value:function(t){e.enabled&&is.event(t)&&!t.target.disabled&&(t.preventDefault(),t.target.value=this.get(t),trigger(t.target,\"touchend\"===t.type?\"change\":\"input\"))}}],[{key:\"setup\",value:function(t){var n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},r=null;if(is.empty(t)||is.string(t)?r=Array.from(document.querySelectorAll(is.string(t)?t:'input[type=\"range\"]')):is.element(t)?r=[t]:is.nodeList(t)?r=Array.from(t):is.array(t)&&(r=t.filter(is.element)),is.empty(r))return null;var i=_objectSpread2({},defaults,{},n);if(is.string(t)&&i.watch){var o=new MutationObserver((function(n){Array.from(n).forEach((function(n){Array.from(n.addedNodes).forEach((function(n){is.element(n)&&matches(n,t)&&new e(n,i)}))}))}));o.observe(document.body,{childList:!0,subtree:!0})}return r.map((function(t){return new e(t,n)}))}},{key:\"enabled\",get:function(){return\"ontouchstart\"in document.documentElement}}]),e}();export default RangeTouch;","// ==========================================================================\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) && isFunction(input.then);\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// 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// 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// 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 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// Closest ancestor element matching selector (also tests element itself)\nexport function closest(element, selector) {\n const { prototype } = Element;\n\n // https://developer.mozilla.org/en-US/docs/Web/API/Element/closest#Polyfill\n function closestElement() {\n let el = this;\n\n do {\n if (matches.matches(el, selector)) return el;\n el = el.parentElement || el.parentNode;\n } while (el !== null && el.nodeType === 1);\n return null;\n }\n\n const method = prototype.closest || closestElement;\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// 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// 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: { ...detail, plyr: this },\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","import is from './is';\n/**\n * Silence a Promise-like object.\n * This is useful for avoiding non-harmful, but potentially confusing \"uncaught\n * play promise\" rejection error messages.\n * @param {Object} value An object that may or may not be `Promise`-like.\n */\nexport function silencePromise(value) {\n if (is.promise(value)) {\n value.then(null, () => {});\n }\n}\n\nexport default { silencePromise };\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 { wrapper } = this.elements;\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 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.config.vimeo.premium && this.supported.ui) {\n const height = (100 / this.media.offsetWidth) * parseInt(window.getComputedStyle(this.media).paddingBottom, 10);\n const offset = (height - padding) / (height / 50);\n\n this.media.style.transform = `translateY(-${offset}%)`;\n } else if (this.isHTML5) {\n 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 { silencePromise } from './utils/promise';\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 // Whether we're forcing all options (e.g. for streaming)\n if (this.config.quality.forced) {\n return this.config.quality.options;\n }\n\n // Get sizes from <source> elements\n return html5.getSources\n .call(this)\n .map(source => Number(source.getAttribute('data-res')))\n .filter(Boolean);\n },\n\n setup() {\n if (!this.isHTML5) {\n return;\n }\n\n const player = this;\n\n // Set speed options from config\n player.options.speed = player.config.speed.options;\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('data-res'));\n },\n set(input) {\n if (player.quality === input) {\n return;\n }\n\n // If we're using an an external handler...\n if (player.config.quality.forced && is.function(player.config.quality.onChange)) {\n player.config.quality.onChange(input);\n } else {\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('data-res')) === input);\n\n // No matching source found\n if (!source) {\n return;\n }\n\n // Get current state\n const { currentTime, paused, preload, readyState, playbackRate } = 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.speed = playbackRate;\n player.currentTime = currentTime;\n\n // Resume playing\n if (!paused) {\n silencePromise(player.play());\n }\n });\n\n // Load new source\n player.media.load();\n }\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 const replaceAll = (input = '', find = '', replace = '') =>\n input.replace(new RegExp(find.toString().replace(/([.*+?^=!:${}()|[\\]/\\\\])/g, '\\\\$1'), 'g'), replace.toString());\n\n// Convert to title case\nexport const toTitleCase = (input = '') =>\n input.toString().replace(/\\w\\S*/g, text => text.charAt(0).toUpperCase() + text.substr(1).toLowerCase());\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(undefined, 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(`.${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);\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 'aria-hidden': 'true',\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 const attributes = { ...attr, class: [attr.class, this.config.classNames.hidden].filter(Boolean).join(' ') };\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.call(\n this,\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.call(this, 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=\"menucaptions\"]');\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() {\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 // Filter out invalid speeds\n this.options.speed = this.options.speed.filter(o => o >= this.minimumSpeed && o <= this.maximumSpeed);\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 (is.array(this.config.controls) && 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(is.array(this.config.controls) ? 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 // Ignored on iOS as it's handled globally\n // https://developer.apple.com/library/safari/documentation/AudioVideo/Conceptual/Using_HTML5_Audio_Video/Device-SpecificConsiderations/Device-SpecificConsiderations.html\n if (control === 'volume' && !browser.isIos) {\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.call(this, 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.call(\n this,\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.call(this, 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 // Menu Captions\n pane.appendChild(\n createElement('div', {\n role: 'menucaptions',\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 // Set download attribute for HTML5 only\n if (this.isHTML5) {\n attributes.download = '';\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 }\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\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 // Note: mode='hidden' forces a track to download. To ensure every track\n // isn't downloaded at once, only 'showing' tracks should be reassigned\n // eslint-disable-next-line no-param-reassign\n if (track.mode === 'showing') {\n // eslint-disable-next-line no-param-reassign\n track.mode = 'hidden';\n }\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 (\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\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 // Wait for the call stack to clear before setting mode='hidden'\n // on the active track - forcing the browser to download it\n setTimeout(() => {\n if (active && this.captions.toggled) {\n this.captions.currentTrackNode.mode = 'hidden';\n }\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: '/theme/modules/plyr/plyr.svg',\n\n // Blank video (used to prevent errors on source change)\n blankVideo: '/theme/modules/plyr/blank.webm',\n\n // Quality default\n quality: {\n default: 576,\n // The options to display in the UI, if available for the source media\n options: [4320, 2880, 2160, 1440, 1080, 720, 576, 480, 360, 240],\n forced: false,\n onChange: null,\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 // The options to display in the UI, if available for the source media (e.g. Vimeo and YouTube only support 0.5x-4x)\n options: [0.5, 0.75, 1, 1.25, 1.5, 1.75, 2, 4],\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 // Selector for the fullscreen container so contextual / non-player content can remain visible in fullscreen mode\n // Non-ancestors of the player element will be ignored\n // container: null, // defaults to the player element\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 pip: 'PIP',\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 // Whether the owner of the video has a Pro or Business account\n // (which allows us to properly hide controls without CSS hacks, etc)\n premium: false,\n // Custom settings from Plyr\n referrerPolicy: null, // https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement/referrerPolicy\n },\n\n // YouTube plugin\n youtube: {\n noCookie: true, // 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 { closest,getElements, hasClass, toggleClass } from './utils/elements';\nimport { on, triggerEvent } from './utils/events';\nimport is from './utils/is';\nimport { silencePromise } from './utils/promise';\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 // Get the fullscreen element\n // Checks container is an ancestor, defaults to null\n this.player.elements.fullscreen =\n player.config.fullscreen.container && closest(this.player.elements.container, player.config.fullscreen.container);\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 this.onChange();\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 // Tap focus when in fullscreen\n on.call(this, this.player.elements.container, 'keydown', event => this.trapFocus(event));\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 && element.shadowRoot ? element === this.target.getRootNode().host : 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.fullscreen || this.player.elements.container;\n }\n\n 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\n 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 this.onChange();\n }\n\n // Trap focus inside container\n trapFocus(event) {\n // Bail if iOS, not active, not the tab key\n if (browser.isIos || !this.active || event.key !== 'Tab' || event.keyCode !== 9) {\n return;\n }\n\n // Get the current focused element\n const focused = document.activeElement;\n const focusable = getElements.call(this.player, 'a[href], button:not(:disabled), input:not(:disabled), [tabindex]');\n const [first] = focusable;\n const last = focusable[focusable.length - 1];\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 // 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 this.toggleFallback(true);\n } else if (!this.prefix) {\n this.target.requestFullscreen({ navigationUI: 'hide' });\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 silencePromise(this.player.play());\n } else if (!Fullscreen.native || this.forceFallback) {\n this.toggleFallback(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('data-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\n ui.togglePoster.call(this, true);\n\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 target.setAttribute('aria-label', i18n.get(this.playing ? 'pause' : 'play', this.config));\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 || this.loading || this.paused || controlsElement.pressed || controlsElement.hover || recentTouchSeek,\n ),\n );\n }\n },\n\n // Migrate any custom properties from the media to the parent\n migrateStyles() {\n // Loop through values (as they are the keys when the object is spread 🤔)\n Object.values({ ...this.media.style })\n // We're only fussed about Plyr specific properties\n .filter(key => !is.empty(key) && key.startsWith('--plyr'))\n .forEach(key => {\n // Set on the container\n this.elements.container.style.setProperty(key, this.media.style.getPropertyValue(key));\n\n // Clean up from media element\n this.media.style.removeProperty(key);\n });\n\n // Remove attribute if empty\n if (is.empty(this.media.style)) {\n this.media.removeAttribute('style');\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 } from './utils/elements';\nimport { off, on, once, toggleListener, triggerEvent } from './utils/events';\nimport is from './utils/is';\nimport { silencePromise } from './utils/promise';\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 silencePromise(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 if (event.type !== 'focusout') {\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\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 focusout', 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 || player.config.vimeo.premium) {\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 browser fullscreen API, 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 // 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 // Call pause otherwise IE11 will start playing the video again\n player.pause();\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(\n event,\n () => {\n silencePromise(player.play());\n },\n 'play',\n );\n } else {\n this.proxy(\n event,\n () => {\n silencePromise(player.togglePlay());\n },\n 'play',\n );\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 !== false && 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(\n button,\n 'click',\n () => {\n silencePromise(player.togglePlay());\n },\n 'play',\n );\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(\n elements.buttons.settings,\n 'click',\n event => {\n // Prevent the document click listener closing the menu\n event.stopPropagation();\n event.preventDefault();\n\n controls.toggleMenu.call(player, event);\n },\n null,\n false,\n ); // Can't be passive as we're preventing default\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 silencePromise(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 touchend 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 // Also update controls.hover state for any non-player children of fullscreen element (as above)\n if (elements.fullscreen) {\n Array.from(elements.fullscreen.children)\n .filter(c => !c.contains(elements.container))\n .forEach(child => {\n this.bind(child, 'mouseenter mouseleave', event => {\n elements.controls.hover = !player.touch && event.type === 'mouseenter';\n });\n });\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 pathname = path.replace(/[\\?|#].*$/, ''),\n pathStripped = path.replace(/^(css|img)!/, ''),\n isLegacyIECss,\n e;\n\n numTries = numTries || 0;\n\n if (/(^css!|\\.css$)/.test(pathname)) {\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|webp)$)/.test(pathname)) {\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 { 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 const player = this;\n\n // Add embed class for responsive\n toggleClass(player.elements.wrapper, player.config.classNames.embed, true);\n\n // Set speed options from config\n player.options.speed = player.config.speed.options;\n\n // Set intial ratio\n setAspectRatio.call(player);\n\n // Load the SDK if not already\n if (!is.object(window.Vimeo)) {\n loadScript(player.config.urls.vimeo.sdk)\n .then(() => {\n vimeo.ready.call(player);\n })\n .catch(error => {\n player.debug.warn('Vimeo SDK (player.js) failed to load', error);\n });\n } else {\n vimeo.ready.call(player);\n }\n },\n\n // API Ready\n ready() {\n const player = this;\n const config = player.config.vimeo;\n const { premium, referrerPolicy, ...frameParams } = config;\n\n // If the owner has a pro or premium account then we can hide controls etc\n if (premium) {\n Object.assign(frameParams, {\n controls: false,\n sidedock: false,\n });\n }\n\n // Get Vimeo params for the iframe\n const params = buildUrlParams({\n loop: player.config.loop.active,\n autoplay: player.autoplay,\n muted: player.muted,\n gesture: 'media',\n playsinline: !this.config.fullscreen.iosNative,\n ...frameParams,\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('allow', 'autoplay,fullscreen,picture-in-picture');\n\n // Set the referrer policy if required\n if (!is.empty(referrerPolicy)) {\n iframe.setAttribute('referrerPolicy', referrerPolicy);\n }\n\n // Inject the package\n const { poster } = player;\n if (premium) {\n iframe.setAttribute('data-poster', poster);\n player.media = replaceElement(iframe, player.media);\n } else {\n const wrapper = createElement('div', { class: player.config.classNames.embedContainer, 'data-poster': poster });\n wrapper.appendChild(iframe);\n player.media = replaceElement(wrapper, player.media);\n }\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(() => {\n // Cannot set Playback Rate, Video is probably not on Pro account\n player.options.speed = [1];\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('bufferstart', () => {\n triggerEvent.call(player, player.media, 'waiting');\n });\n\n player.embed.on('bufferend', () => {\n triggerEvent.call(player, player.media, 'playing');\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, 'data-poster': 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 const speeds = instance.getAvailablePlaybackRates();\n // Filter based on config\n player.options.speed = speeds.filter(s => player.config.speed.options.includes(s));\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 case 3:\n // Trigger waiting event to add loading classes to container as the video buffers.\n triggerEvent.call(player, player.media, 'waiting');\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 // Poster image 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.setup.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 { silencePromise } from '../utils/promise';\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: config.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 // 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 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 // 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 if (this.player.ended) {\n this.loadAds();\n } else {\n // The SDK won't allow new ads to be called without receiving a contentComplete()\n this.loader.contentComplete();\n }\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 silencePromise(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 // Now that the manager has been destroyed set it to also be un-initialized\n this.initialized = false;\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\nconst fitRatio = (ratio, outer) => {\n const targetRatio = outer.width / outer.height;\n const result = {};\n if (ratio > targetRatio) {\n result.width = outer.width;\n result.height = (1 / ratio) * outer.width;\n } else {\n result.height = outer.height;\n result.width = ratio * outer.height;\n }\n\n return result;\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 // Toggle the 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 // Resolve promise\n const sortAndResolve = () => {\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 // Via callback()\n if (is.function(src)) {\n src(thumbnails => {\n this.thumbnails = thumbnails;\n sortAndResolve();\n });\n }\n // VTT urls\n else {\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 // Resolve\n Promise.all(promises).then(sortAndResolve);\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 does not exist or is false)\n if (is.nullOrUndefined(event.button) || 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 destroy() {\n if (this.elements.thumb.container) {\n this.elements.thumb.container.remove();\n }\n if (this.elements.scrubbing.container) {\n this.elements.scrubbing.container.remove();\n }\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 = () => 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)) 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 const { height } = fitRatio(this.thumbAspectRatio, {\n width: this.player.media.clientWidth,\n height: this.player.media.clientHeight,\n });\n return height;\n }\n\n // If css is used this needs to return the css height for sprites to work (see setImageSizeAndOffset)\n if (this.sizeSpecifiedInCSS) {\n return this.elements.thumb.imageContainer.clientHeight;\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 || this.elements.thumb.imageContainer.clientWidth > 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 } else if (\n this.elements.thumb.imageContainer.clientHeight > 20 &&\n this.elements.thumb.imageContainer.clientWidth < 20\n ) {\n const thumbWidth = Math.floor(this.elements.thumb.imageContainer.clientHeight * this.thumbAspectRatio);\n this.elements.thumb.imageContainer.style.width = `${thumbWidth}px`;\n } else if (\n this.elements.thumb.imageContainer.clientHeight < 20 &&\n this.elements.thumb.imageContainer.clientWidth > 20\n ) {\n const thumbHeight = Math.floor(this.elements.thumb.imageContainer.clientWidth / this.thumbAspectRatio);\n this.elements.thumb.imageContainer.style.height = `${thumbHeight}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 const { width, height } = fitRatio(this.thumbAspectRatio, {\n width: this.player.media.clientWidth,\n height: this.player.media.clientHeight,\n });\n this.elements.scrubbing.container.style.width = `${width}px`;\n this.elements.scrubbing.container.style.height = `${height}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 = `${previewImage.naturalHeight * multiplier}px`;\n // eslint-disable-next-line no-param-reassign\n previewImage.style.width = `${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 PreviewThumbnails from './plugins/preview-thumbnails';\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 // Update previewThumbnails config & reload plugin\n if (!is.empty(input.previewThumbnails)) {\n Object.assign(this.config.previewThumbnails, input.previewThumbnails);\n\n // Cleanup previewThumbnails plugin if it was loaded\n if (this.previewThumbnails && this.previewThumbnails.loaded) {\n this.previewThumbnails.destroy();\n this.previewThumbnails = null;\n }\n\n // Create new instance if it is still enabled\n if (this.config.previewThumbnails.enabled) {\n this.previewThumbnails = new PreviewThumbnails(this);\n }\n }\n\n // Update the fullscreen support\n this.fullscreen.update();\n },\n true,\n );\n },\n};\n\nexport default source;\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","// ==========================================================================\n// Plyr\n// plyr.js v3.6.2\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 { silencePromise } from './utils/promise';\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 fullscreen: 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 // Migrate custom properties from media to container (so they work 😉)\n ui.migrateStyles.call(this);\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 fullscreen\n this.fullscreen = new Fullscreen(this);\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 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(() => silencePromise(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(() => silencePromise(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 null;\n }\n\n return 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 return this.play();\n }\n\n return this.pause();\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 -= 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 += 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') || this.media.getAttribute('data-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 && is.array(this.config.controls) && 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"]} \ No newline at end of file
diff --git a/youtube/static/modules/plyr/plyr.mjs b/youtube/static/modules/plyr/plyr.mjs
new file mode 100644
index 0000000..52ce9a4
--- /dev/null
+++ b/youtube/static/modules/plyr/plyr.mjs
@@ -0,0 +1,9312 @@
+typeof navigator === "object" && function _classCallCheck(instance, Constructor) {
+ if (!(instance instanceof Constructor)) {
+ throw new TypeError("Cannot call a class as a function");
+ }
+}
+
+function _defineProperties(target, props) {
+ for (var i = 0; i < props.length; i++) {
+ var descriptor = props[i];
+ descriptor.enumerable = descriptor.enumerable || false;
+ descriptor.configurable = true;
+ if ("value" in descriptor) descriptor.writable = true;
+ Object.defineProperty(target, descriptor.key, descriptor);
+ }
+}
+
+function _createClass(Constructor, protoProps, staticProps) {
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
+ if (staticProps) _defineProperties(Constructor, staticProps);
+ return Constructor;
+}
+
+function _defineProperty(obj, key, value) {
+ if (key in obj) {
+ Object.defineProperty(obj, key, {
+ value: value,
+ enumerable: true,
+ configurable: true,
+ writable: true
+ });
+ } else {
+ obj[key] = value;
+ }
+
+ return obj;
+}
+
+function ownKeys(object, enumerableOnly) {
+ var keys = Object.keys(object);
+
+ if (Object.getOwnPropertySymbols) {
+ var symbols = Object.getOwnPropertySymbols(object);
+ if (enumerableOnly) symbols = symbols.filter(function (sym) {
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
+ });
+ keys.push.apply(keys, symbols);
+ }
+
+ return keys;
+}
+
+function _objectSpread2(target) {
+ for (var i = 1; i < arguments.length; i++) {
+ var source = arguments[i] != null ? arguments[i] : {};
+
+ if (i % 2) {
+ ownKeys(Object(source), true).forEach(function (key) {
+ _defineProperty(target, key, source[key]);
+ });
+ } else if (Object.getOwnPropertyDescriptors) {
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
+ } else {
+ ownKeys(Object(source)).forEach(function (key) {
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
+ });
+ }
+ }
+
+ return target;
+}
+
+function _objectWithoutPropertiesLoose(source, excluded) {
+ if (source == null) return {};
+ var target = {};
+ var sourceKeys = Object.keys(source);
+ var key, i;
+
+ for (i = 0; i < sourceKeys.length; i++) {
+ key = sourceKeys[i];
+ if (excluded.indexOf(key) >= 0) continue;
+ target[key] = source[key];
+ }
+
+ return target;
+}
+
+function _objectWithoutProperties(source, excluded) {
+ if (source == null) return {};
+
+ var target = _objectWithoutPropertiesLoose(source, excluded);
+
+ var key, i;
+
+ if (Object.getOwnPropertySymbols) {
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
+
+ for (i = 0; i < sourceSymbolKeys.length; i++) {
+ key = sourceSymbolKeys[i];
+ if (excluded.indexOf(key) >= 0) continue;
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
+ target[key] = source[key];
+ }
+ }
+
+ return target;
+}
+
+function _slicedToArray(arr, i) {
+ return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
+}
+
+function _toConsumableArray(arr) {
+ return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
+}
+
+function _arrayWithoutHoles(arr) {
+ if (Array.isArray(arr)) return _arrayLikeToArray(arr);
+}
+
+function _arrayWithHoles(arr) {
+ if (Array.isArray(arr)) return arr;
+}
+
+function _iterableToArray(iter) {
+ if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
+}
+
+function _iterableToArrayLimit(arr, i) {
+ if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
+ var _arr = [];
+ var _n = true;
+ var _d = false;
+ var _e = undefined;
+
+ try {
+ for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
+ _arr.push(_s.value);
+
+ if (i && _arr.length === i) break;
+ }
+ } catch (err) {
+ _d = true;
+ _e = err;
+ } finally {
+ try {
+ if (!_n && _i["return"] != null) _i["return"]();
+ } finally {
+ if (_d) throw _e;
+ }
+ }
+
+ return _arr;
+}
+
+function _unsupportedIterableToArray(o, minLen) {
+ if (!o) return;
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
+ var n = Object.prototype.toString.call(o).slice(8, -1);
+ if (n === "Object" && o.constructor) n = o.constructor.name;
+ if (n === "Map" || n === "Set") return Array.from(o);
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
+}
+
+function _arrayLikeToArray(arr, len) {
+ if (len == null || len > arr.length) len = arr.length;
+
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
+
+ return arr2;
+}
+
+function _nonIterableSpread() {
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
+}
+
+function _nonIterableRest() {
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
+}
+
+function _classCallCheck$1(e, t) {
+ if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function");
+}
+
+function _defineProperties$1(e, t) {
+ for (var n = 0; n < t.length; n++) {
+ var r = t[n];
+ r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r);
+ }
+}
+
+function _createClass$1(e, t, n) {
+ return t && _defineProperties$1(e.prototype, t), n && _defineProperties$1(e, n), e;
+}
+
+function _defineProperty$1(e, t, n) {
+ return t in e ? Object.defineProperty(e, t, {
+ value: n,
+ enumerable: !0,
+ configurable: !0,
+ writable: !0
+ }) : e[t] = n, e;
+}
+
+function ownKeys$1(e, t) {
+ var n = Object.keys(e);
+
+ if (Object.getOwnPropertySymbols) {
+ var r = Object.getOwnPropertySymbols(e);
+ t && (r = r.filter(function (t) {
+ return Object.getOwnPropertyDescriptor(e, t).enumerable;
+ })), n.push.apply(n, r);
+ }
+
+ return n;
+}
+
+function _objectSpread2$1(e) {
+ for (var t = 1; t < arguments.length; t++) {
+ var n = null != arguments[t] ? arguments[t] : {};
+ t % 2 ? ownKeys$1(Object(n), !0).forEach(function (t) {
+ _defineProperty$1(e, t, n[t]);
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : ownKeys$1(Object(n)).forEach(function (t) {
+ Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(n, t));
+ });
+ }
+
+ return e;
+}
+
+var defaults = {
+ addCSS: !0,
+ thumbWidth: 15,
+ watch: !0
+};
+
+function matches(e, t) {
+ return function () {
+ return Array.from(document.querySelectorAll(t)).includes(this);
+ }.call(e, t);
+}
+
+function trigger(e, t) {
+ if (e && t) {
+ var n = new Event(t, {
+ bubbles: !0
+ });
+ e.dispatchEvent(n);
+ }
+}
+
+var getConstructor = function getConstructor(e) {
+ return null != e ? e.constructor : null;
+},
+ instanceOf = function instanceOf(e, t) {
+ return !!(e && t && e instanceof t);
+},
+ isNullOrUndefined = function isNullOrUndefined(e) {
+ return null == e;
+},
+ isObject = function isObject(e) {
+ return getConstructor(e) === Object;
+},
+ isNumber = function isNumber(e) {
+ return getConstructor(e) === Number && !Number.isNaN(e);
+},
+ isString = function isString(e) {
+ return getConstructor(e) === String;
+},
+ isBoolean = function isBoolean(e) {
+ return getConstructor(e) === Boolean;
+},
+ isFunction = function isFunction(e) {
+ return getConstructor(e) === Function;
+},
+ isArray = function isArray(e) {
+ return Array.isArray(e);
+},
+ isNodeList = function isNodeList(e) {
+ return instanceOf(e, NodeList);
+},
+ isElement = function isElement(e) {
+ return instanceOf(e, Element);
+},
+ isEvent = function isEvent(e) {
+ return instanceOf(e, Event);
+},
+ isEmpty = function isEmpty(e) {
+ return isNullOrUndefined(e) || (isString(e) || isArray(e) || isNodeList(e)) && !e.length || isObject(e) && !Object.keys(e).length;
+},
+ is = {
+ nullOrUndefined: isNullOrUndefined,
+ object: isObject,
+ number: isNumber,
+ string: isString,
+ boolean: isBoolean,
+ function: isFunction,
+ array: isArray,
+ nodeList: isNodeList,
+ element: isElement,
+ event: isEvent,
+ empty: isEmpty
+};
+
+function getDecimalPlaces(e) {
+ var t = "".concat(e).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);
+ return t ? Math.max(0, (t[1] ? t[1].length : 0) - (t[2] ? +t[2] : 0)) : 0;
+}
+
+function round(e, t) {
+ if (1 > t) {
+ var n = getDecimalPlaces(t);
+ return parseFloat(e.toFixed(n));
+ }
+
+ return Math.round(e / t) * t;
+}
+
+var RangeTouch = function () {
+ function e(t, n) {
+ _classCallCheck$1(this, e), is.element(t) ? this.element = t : is.string(t) && (this.element = document.querySelector(t)), is.element(this.element) && is.empty(this.element.rangeTouch) && (this.config = _objectSpread2$1({}, defaults, {}, n), this.init());
+ }
+
+ return _createClass$1(e, [{
+ key: "init",
+ value: function value() {
+ e.enabled && (this.config.addCSS && (this.element.style.userSelect = "none", this.element.style.webKitUserSelect = "none", this.element.style.touchAction = "manipulation"), this.listeners(!0), this.element.rangeTouch = this);
+ }
+ }, {
+ key: "destroy",
+ value: function value() {
+ e.enabled && (this.config.addCSS && (this.element.style.userSelect = "", this.element.style.webKitUserSelect = "", this.element.style.touchAction = ""), this.listeners(!1), this.element.rangeTouch = null);
+ }
+ }, {
+ key: "listeners",
+ value: function value(e) {
+ var t = this,
+ n = e ? "addEventListener" : "removeEventListener";
+ ["touchstart", "touchmove", "touchend"].forEach(function (e) {
+ t.element[n](e, function (e) {
+ return t.set(e);
+ }, !1);
+ });
+ }
+ }, {
+ key: "get",
+ value: function value(t) {
+ if (!e.enabled || !is.event(t)) return null;
+ var n,
+ r = t.target,
+ i = t.changedTouches[0],
+ o = parseFloat(r.getAttribute("min")) || 0,
+ s = parseFloat(r.getAttribute("max")) || 100,
+ u = parseFloat(r.getAttribute("step")) || 1,
+ c = r.getBoundingClientRect(),
+ a = 100 / c.width * (this.config.thumbWidth / 2) / 100;
+ return 0 > (n = 100 / c.width * (i.clientX - c.left)) ? n = 0 : 100 < n && (n = 100), 50 > n ? n -= (100 - 2 * n) * a : 50 < n && (n += 2 * (n - 50) * a), o + round(n / 100 * (s - o), u);
+ }
+ }, {
+ key: "set",
+ value: function value(t) {
+ e.enabled && is.event(t) && !t.target.disabled && (t.preventDefault(), t.target.value = this.get(t), trigger(t.target, "touchend" === t.type ? "change" : "input"));
+ }
+ }], [{
+ key: "setup",
+ value: function value(t) {
+ var n = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : {},
+ r = null;
+ if (is.empty(t) || is.string(t) ? r = Array.from(document.querySelectorAll(is.string(t) ? t : 'input[type="range"]')) : is.element(t) ? r = [t] : is.nodeList(t) ? r = Array.from(t) : is.array(t) && (r = t.filter(is.element)), is.empty(r)) return null;
+
+ var i = _objectSpread2$1({}, defaults, {}, n);
+
+ if (is.string(t) && i.watch) {
+ var o = new MutationObserver(function (n) {
+ Array.from(n).forEach(function (n) {
+ Array.from(n.addedNodes).forEach(function (n) {
+ is.element(n) && matches(n, t) && new e(n, i);
+ });
+ });
+ });
+ o.observe(document.body, {
+ childList: !0,
+ subtree: !0
+ });
+ }
+
+ return r.map(function (t) {
+ return new e(t, n);
+ });
+ }
+ }, {
+ key: "enabled",
+ get: function get() {
+ return "ontouchstart" in document.documentElement;
+ }
+ }]), e;
+}();
+
+// ==========================================================================
+// Type checking utils
+// ==========================================================================
+var getConstructor$1 = function getConstructor(input) {
+ return input !== null && typeof input !== 'undefined' ? input.constructor : null;
+};
+
+var instanceOf$1 = function instanceOf(input, constructor) {
+ return Boolean(input && constructor && input instanceof constructor);
+};
+
+var isNullOrUndefined$1 = function isNullOrUndefined(input) {
+ return input === null || typeof input === 'undefined';
+};
+
+var isObject$1 = function isObject(input) {
+ return getConstructor$1(input) === Object;
+};
+
+var isNumber$1 = function isNumber(input) {
+ return getConstructor$1(input) === Number && !Number.isNaN(input);
+};
+
+var isString$1 = function isString(input) {
+ return getConstructor$1(input) === String;
+};
+
+var isBoolean$1 = function isBoolean(input) {
+ return getConstructor$1(input) === Boolean;
+};
+
+var isFunction$1 = function isFunction(input) {
+ return getConstructor$1(input) === Function;
+};
+
+var isArray$1 = function isArray(input) {
+ return Array.isArray(input);
+};
+
+var isWeakMap = function isWeakMap(input) {
+ return instanceOf$1(input, WeakMap);
+};
+
+var isNodeList$1 = function isNodeList(input) {
+ return instanceOf$1(input, NodeList);
+};
+
+var isElement$1 = function isElement(input) {
+ return instanceOf$1(input, Element);
+};
+
+var isTextNode = function isTextNode(input) {
+ return getConstructor$1(input) === Text;
+};
+
+var isEvent$1 = function isEvent(input) {
+ return instanceOf$1(input, Event);
+};
+
+var isKeyboardEvent = function isKeyboardEvent(input) {
+ return instanceOf$1(input, KeyboardEvent);
+};
+
+var isCue = function isCue(input) {
+ return instanceOf$1(input, window.TextTrackCue) || instanceOf$1(input, window.VTTCue);
+};
+
+var isTrack = function isTrack(input) {
+ return instanceOf$1(input, TextTrack) || !isNullOrUndefined$1(input) && isString$1(input.kind);
+};
+
+var isPromise = function isPromise(input) {
+ return instanceOf$1(input, Promise) && isFunction$1(input.then);
+};
+
+var isEmpty$1 = function isEmpty(input) {
+ return isNullOrUndefined$1(input) || (isString$1(input) || isArray$1(input) || isNodeList$1(input)) && !input.length || isObject$1(input) && !Object.keys(input).length;
+};
+
+var isUrl = function isUrl(input) {
+ // Accept a URL object
+ if (instanceOf$1(input, window.URL)) {
+ return true;
+ } // Must be string from here
+
+
+ if (!isString$1(input)) {
+ return false;
+ } // Add the protocol if required
+
+
+ var string = input;
+
+ if (!input.startsWith('http://') || !input.startsWith('https://')) {
+ string = "http://".concat(input);
+ }
+
+ try {
+ return !isEmpty$1(new URL(string).hostname);
+ } catch (e) {
+ return false;
+ }
+};
+
+var is$1 = {
+ nullOrUndefined: isNullOrUndefined$1,
+ object: isObject$1,
+ number: isNumber$1,
+ string: isString$1,
+ boolean: isBoolean$1,
+ function: isFunction$1,
+ array: isArray$1,
+ weakMap: isWeakMap,
+ nodeList: isNodeList$1,
+ element: isElement$1,
+ textNode: isTextNode,
+ event: isEvent$1,
+ keyboardEvent: isKeyboardEvent,
+ cue: isCue,
+ track: isTrack,
+ promise: isPromise,
+ url: isUrl,
+ empty: isEmpty$1
+};
+
+// ==========================================================================
+var transitionEndEvent = function () {
+ var element = document.createElement('span');
+ var events = {
+ WebkitTransition: 'webkitTransitionEnd',
+ MozTransition: 'transitionend',
+ OTransition: 'oTransitionEnd otransitionend',
+ transition: 'transitionend'
+ };
+ var type = Object.keys(events).find(function (event) {
+ return element.style[event] !== undefined;
+ });
+ return is$1.string(type) ? events[type] : false;
+}(); // Force repaint of element
+
+function repaint(element, delay) {
+ setTimeout(function () {
+ try {
+ // eslint-disable-next-line no-param-reassign
+ element.hidden = true; // eslint-disable-next-line no-unused-expressions
+
+ element.offsetHeight; // eslint-disable-next-line no-param-reassign
+
+ element.hidden = false;
+ } catch (e) {// Do nothing
+ }
+ }, delay);
+}
+
+// ==========================================================================
+// Browser sniffing
+// Unfortunately, due to mixed support, UA sniffing is required
+// ==========================================================================
+var browser = {
+ isIE:
+ /* @cc_on!@ */
+ !!document.documentMode,
+ isEdge: window.navigator.userAgent.includes('Edge'),
+ isWebkit: 'WebkitAppearance' in document.documentElement.style && !/Edge/.test(navigator.userAgent),
+ isIPhone: /(iPhone|iPod)/gi.test(navigator.platform),
+ isIos: /(iPad|iPhone|iPod)/gi.test(navigator.platform)
+};
+
+function cloneDeep(object) {
+ return JSON.parse(JSON.stringify(object));
+} // Get a nested value in an object
+
+function getDeep(object, path) {
+ return path.split('.').reduce(function (obj, key) {
+ return obj && obj[key];
+ }, object);
+} // Deep extend destination object with N more objects
+
+function extend() {
+ var target = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
+
+ for (var _len = arguments.length, sources = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
+ sources[_key - 1] = arguments[_key];
+ }
+
+ if (!sources.length) {
+ return target;
+ }
+
+ var source = sources.shift();
+
+ if (!is$1.object(source)) {
+ return target;
+ }
+
+ Object.keys(source).forEach(function (key) {
+ if (is$1.object(source[key])) {
+ if (!Object.keys(target).includes(key)) {
+ Object.assign(target, _defineProperty({}, key, {}));
+ }
+
+ extend(target[key], source[key]);
+ } else {
+ Object.assign(target, _defineProperty({}, key, source[key]));
+ }
+ });
+ return extend.apply(void 0, [target].concat(sources));
+}
+
+function wrap(elements, wrapper) {
+ // Convert `elements` to an array, if necessary.
+ var targets = elements.length ? elements : [elements]; // Loops backwards to prevent having to clone the wrapper on the
+ // first element (see `child` below).
+
+ Array.from(targets).reverse().forEach(function (element, index) {
+ var child = index > 0 ? wrapper.cloneNode(true) : wrapper; // Cache the current parent and sibling.
+
+ var parent = element.parentNode;
+ var sibling = element.nextSibling; // Wrap the element (is automatically removed from its current
+ // parent).
+
+ child.appendChild(element); // If the element had a sibling, insert the wrapper before
+ // the sibling to maintain the HTML structure; otherwise, just
+ // append it to the parent.
+
+ if (sibling) {
+ parent.insertBefore(child, sibling);
+ } else {
+ parent.appendChild(child);
+ }
+ });
+} // Set attributes
+
+function setAttributes(element, attributes) {
+ if (!is$1.element(element) || is$1.empty(attributes)) {
+ return;
+ } // Assume null and undefined attributes should be left out,
+ // Setting them would otherwise convert them to "null" and "undefined"
+
+
+ Object.entries(attributes).filter(function (_ref) {
+ var _ref2 = _slicedToArray(_ref, 2),
+ value = _ref2[1];
+
+ return !is$1.nullOrUndefined(value);
+ }).forEach(function (_ref3) {
+ var _ref4 = _slicedToArray(_ref3, 2),
+ key = _ref4[0],
+ value = _ref4[1];
+
+ return element.setAttribute(key, value);
+ });
+} // Create a DocumentFragment
+
+function createElement(type, attributes, text) {
+ // Create a new <element>
+ var element = document.createElement(type); // Set all passed attributes
+
+ if (is$1.object(attributes)) {
+ setAttributes(element, attributes);
+ } // Add text node
+
+
+ if (is$1.string(text)) {
+ element.innerText = text;
+ } // Return built element
+
+
+ return element;
+} // Inaert an element after another
+
+function insertAfter(element, target) {
+ if (!is$1.element(element) || !is$1.element(target)) {
+ return;
+ }
+
+ target.parentNode.insertBefore(element, target.nextSibling);
+} // Insert a DocumentFragment
+
+function insertElement(type, parent, attributes, text) {
+ if (!is$1.element(parent)) {
+ return;
+ }
+
+ parent.appendChild(createElement(type, attributes, text));
+} // Remove element(s)
+
+function removeElement(element) {
+ if (is$1.nodeList(element) || is$1.array(element)) {
+ Array.from(element).forEach(removeElement);
+ return;
+ }
+
+ if (!is$1.element(element) || !is$1.element(element.parentNode)) {
+ return;
+ }
+
+ element.parentNode.removeChild(element);
+} // Remove all child elements
+
+function emptyElement(element) {
+ if (!is$1.element(element)) {
+ return;
+ }
+
+ var length = element.childNodes.length;
+
+ while (length > 0) {
+ element.removeChild(element.lastChild);
+ length -= 1;
+ }
+} // Replace element
+
+function replaceElement(newChild, oldChild) {
+ if (!is$1.element(oldChild) || !is$1.element(oldChild.parentNode) || !is$1.element(newChild)) {
+ return null;
+ }
+
+ oldChild.parentNode.replaceChild(newChild, oldChild);
+ return newChild;
+} // Get an attribute object from a string selector
+
+function getAttributesFromSelector(sel, existingAttributes) {
+ // For example:
+ // '.test' to { class: 'test' }
+ // '#test' to { id: 'test' }
+ // '[data-test="test"]' to { 'data-test': 'test' }
+ if (!is$1.string(sel) || is$1.empty(sel)) {
+ return {};
+ }
+
+ var attributes = {};
+ var existing = extend({}, existingAttributes);
+ sel.split(',').forEach(function (s) {
+ // Remove whitespace
+ var selector = s.trim();
+ var className = selector.replace('.', '');
+ var stripped = selector.replace(/[[\]]/g, ''); // Get the parts and value
+
+ var parts = stripped.split('=');
+
+ var _parts = _slicedToArray(parts, 1),
+ key = _parts[0];
+
+ var value = parts.length > 1 ? parts[1].replace(/["']/g, '') : ''; // Get the first character
+
+ var start = selector.charAt(0);
+
+ switch (start) {
+ case '.':
+ // Add to existing classname
+ if (is$1.string(existing.class)) {
+ attributes.class = "".concat(existing.class, " ").concat(className);
+ } else {
+ attributes.class = className;
+ }
+
+ break;
+
+ case '#':
+ // ID selector
+ attributes.id = selector.replace('#', '');
+ break;
+
+ case '[':
+ // Attribute selector
+ attributes[key] = value;
+ break;
+ }
+ });
+ return extend(existing, attributes);
+} // Toggle hidden
+
+function toggleHidden(element, hidden) {
+ if (!is$1.element(element)) {
+ return;
+ }
+
+ var hide = hidden;
+
+ if (!is$1.boolean(hide)) {
+ hide = !element.hidden;
+ } // eslint-disable-next-line no-param-reassign
+
+
+ element.hidden = hide;
+} // Mirror Element.classList.toggle, with IE compatibility for "force" argument
+
+function toggleClass(element, className, force) {
+ if (is$1.nodeList(element)) {
+ return Array.from(element).map(function (e) {
+ return toggleClass(e, className, force);
+ });
+ }
+
+ if (is$1.element(element)) {
+ var method = 'toggle';
+
+ if (typeof force !== 'undefined') {
+ method = force ? 'add' : 'remove';
+ }
+
+ element.classList[method](className);
+ return element.classList.contains(className);
+ }
+
+ return false;
+} // Has class name
+
+function hasClass(element, className) {
+ return is$1.element(element) && element.classList.contains(className);
+} // Element matches selector
+
+function matches$1(element, selector) {
+ var _Element = Element,
+ prototype = _Element.prototype;
+
+ function match() {
+ return Array.from(document.querySelectorAll(selector)).includes(this);
+ }
+
+ var method = prototype.matches || prototype.webkitMatchesSelector || prototype.mozMatchesSelector || prototype.msMatchesSelector || match;
+ return method.call(element, selector);
+} // Closest ancestor element matching selector (also tests element itself)
+
+function closest(element, selector) {
+ var _Element2 = Element,
+ prototype = _Element2.prototype; // https://developer.mozilla.org/en-US/docs/Web/API/Element/closest#Polyfill
+
+ function closestElement() {
+ var el = this;
+
+ do {
+ if (matches$1.matches(el, selector)) return el;
+ el = el.parentElement || el.parentNode;
+ } while (el !== null && el.nodeType === 1);
+
+ return null;
+ }
+
+ var method = prototype.closest || closestElement;
+ return method.call(element, selector);
+} // Find all elements
+
+function getElements(selector) {
+ return this.elements.container.querySelectorAll(selector);
+} // Find a single element
+
+function getElement(selector) {
+ return this.elements.container.querySelector(selector);
+} // Set focus and tab focus class
+
+function setFocus() {
+ var element = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
+ var tabFocus = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
+
+ if (!is$1.element(element)) {
+ return;
+ } // Set regular focus
+
+
+ element.focus({
+ preventScroll: true
+ }); // If we want to mimic keyboard focus via tab
+
+ if (tabFocus) {
+ toggleClass(element, this.config.classNames.tabFocus);
+ }
+}
+
+var defaultCodecs = {
+ 'audio/ogg': 'vorbis',
+ 'audio/wav': '1',
+ 'video/webm': 'vp8, vorbis',
+ 'video/mp4': 'avc1.42E01E, mp4a.40.2',
+ 'video/ogg': 'theora'
+}; // Check for feature support
+
+var support = {
+ // Basic support
+ audio: 'canPlayType' in document.createElement('audio'),
+ video: 'canPlayType' in document.createElement('video'),
+ // Check for support
+ // Basic functionality vs full UI
+ check: function check(type, provider, playsinline) {
+ var canPlayInline = browser.isIPhone && playsinline && support.playsinline;
+ var api = support[type] || provider !== 'html5';
+ var ui = api && support.rangeInput && (type !== 'video' || !browser.isIPhone || canPlayInline);
+ return {
+ api: api,
+ ui: ui
+ };
+ },
+ // Picture-in-picture support
+ // Safari & Chrome only currently
+ pip: function () {
+ if (browser.isIPhone) {
+ return false;
+ } // Safari
+ // https://developer.apple.com/documentation/webkitjs/adding_picture_in_picture_to_your_safari_media_controls
+
+
+ if (is$1.function(createElement('video').webkitSetPresentationMode)) {
+ return true;
+ } // Chrome
+ // https://developers.google.com/web/updates/2018/10/watch-video-using-picture-in-picture
+
+
+ if (document.pictureInPictureEnabled && !createElement('video').disablePictureInPicture) {
+ return true;
+ }
+
+ return false;
+ }(),
+ // Airplay support
+ // Safari only currently
+ airplay: is$1.function(window.WebKitPlaybackTargetAvailabilityEvent),
+ // Inline playback support
+ // https://webkit.org/blog/6784/new-video-policies-for-ios/
+ playsinline: 'playsInline' in document.createElement('video'),
+ // Check for mime type support against a player instance
+ // Credits: http://diveintohtml5.info/everything.html
+ // Related: http://www.leanbackplayer.com/test/h5mt.html
+ mime: function mime(input) {
+ if (is$1.empty(input)) {
+ return false;
+ }
+
+ var _input$split = input.split('/'),
+ _input$split2 = _slicedToArray(_input$split, 1),
+ mediaType = _input$split2[0];
+
+ var type = input; // Verify we're using HTML5 and there's no media type mismatch
+
+ if (!this.isHTML5 || mediaType !== this.type) {
+ return false;
+ } // Add codec if required
+
+
+ if (Object.keys(defaultCodecs).includes(type)) {
+ type += "; codecs=\"".concat(defaultCodecs[input], "\"");
+ }
+
+ try {
+ return Boolean(type && this.media.canPlayType(type).replace(/no/, ''));
+ } catch (e) {
+ return false;
+ }
+ },
+ // Check for textTracks support
+ textTracks: 'textTracks' in document.createElement('video'),
+ // <input type="range"> Sliders
+ rangeInput: function () {
+ var range = document.createElement('input');
+ range.type = 'range';
+ return range.type === 'range';
+ }(),
+ // Touch
+ // NOTE: Remember a device can be mouse + touch enabled so we check on first touch event
+ touch: 'ontouchstart' in document.documentElement,
+ // Detect transitions support
+ transitions: transitionEndEvent !== false,
+ // Reduced motion iOS & MacOS setting
+ // https://webkit.org/blog/7551/responsive-design-for-motion/
+ reducedMotion: 'matchMedia' in window && window.matchMedia('(prefers-reduced-motion)').matches
+};
+
+// https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md
+// https://www.youtube.com/watch?v=NPM6172J22g
+
+var supportsPassiveListeners = function () {
+ // Test via a getter in the options object to see if the passive property is accessed
+ var supported = false;
+
+ try {
+ var options = Object.defineProperty({}, 'passive', {
+ get: function get() {
+ supported = true;
+ return null;
+ }
+ });
+ window.addEventListener('test', null, options);
+ window.removeEventListener('test', null, options);
+ } catch (e) {// Do nothing
+ }
+
+ return supported;
+}(); // Toggle event listener
+
+
+function toggleListener(element, event, callback) {
+ var _this = this;
+
+ var toggle = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
+ var passive = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
+ var capture = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
+
+ // Bail if no element, event, or callback
+ if (!element || !('addEventListener' in element) || is$1.empty(event) || !is$1.function(callback)) {
+ return;
+ } // Allow multiple events
+
+
+ var events = event.split(' '); // Build options
+ // Default to just the capture boolean for browsers with no passive listener support
+
+ var options = capture; // If passive events listeners are supported
+
+ if (supportsPassiveListeners) {
+ options = {
+ // Whether the listener can be passive (i.e. default never prevented)
+ passive: passive,
+ // Whether the listener is a capturing listener or not
+ capture: capture
+ };
+ } // If a single node is passed, bind the event listener
+
+
+ events.forEach(function (type) {
+ if (_this && _this.eventListeners && toggle) {
+ // Cache event listener
+ _this.eventListeners.push({
+ element: element,
+ type: type,
+ callback: callback,
+ options: options
+ });
+ }
+
+ element[toggle ? 'addEventListener' : 'removeEventListener'](type, callback, options);
+ });
+} // Bind event handler
+
+function on(element) {
+ var events = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
+ var callback = arguments.length > 2 ? arguments[2] : undefined;
+ var passive = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
+ var capture = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
+ toggleListener.call(this, element, events, callback, true, passive, capture);
+} // Unbind event handler
+
+function off(element) {
+ var events = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
+ var callback = arguments.length > 2 ? arguments[2] : undefined;
+ var passive = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
+ var capture = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
+ toggleListener.call(this, element, events, callback, false, passive, capture);
+} // Bind once-only event handler
+
+function once(element) {
+ var _this2 = this;
+
+ var events = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
+ var callback = arguments.length > 2 ? arguments[2] : undefined;
+ var passive = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
+ var capture = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
+
+ var onceCallback = function onceCallback() {
+ off(element, events, onceCallback, passive, capture);
+
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
+ args[_key] = arguments[_key];
+ }
+
+ callback.apply(_this2, args);
+ };
+
+ toggleListener.call(this, element, events, onceCallback, true, passive, capture);
+} // Trigger event
+
+function triggerEvent(element) {
+ var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
+ var bubbles = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
+ var detail = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
+
+ // Bail if no element
+ if (!is$1.element(element) || is$1.empty(type)) {
+ return;
+ } // Create and dispatch the event
+
+
+ var event = new CustomEvent(type, {
+ bubbles: bubbles,
+ detail: _objectSpread2(_objectSpread2({}, detail), {}, {
+ plyr: this
+ })
+ }); // Dispatch the event
+
+ element.dispatchEvent(event);
+} // Unbind all cached event listeners
+
+function unbindListeners() {
+ if (this && this.eventListeners) {
+ this.eventListeners.forEach(function (item) {
+ var element = item.element,
+ type = item.type,
+ callback = item.callback,
+ options = item.options;
+ element.removeEventListener(type, callback, options);
+ });
+ this.eventListeners = [];
+ }
+} // Run method when / if player is ready
+
+function ready() {
+ var _this3 = this;
+
+ return new Promise(function (resolve) {
+ return _this3.ready ? setTimeout(resolve, 0) : on.call(_this3, _this3.elements.container, 'ready', resolve);
+ }).then(function () {});
+}
+
+/**
+ * Silence a Promise-like object.
+ * This is useful for avoiding non-harmful, but potentially confusing "uncaught
+ * play promise" rejection error messages.
+ * @param {Object} value An object that may or may not be `Promise`-like.
+ */
+
+function silencePromise(value) {
+ if (is$1.promise(value)) {
+ value.then(null, function () {});
+ }
+}
+
+function validateRatio(input) {
+ if (!is$1.array(input) && (!is$1.string(input) || !input.includes(':'))) {
+ return false;
+ }
+
+ var ratio = is$1.array(input) ? input : input.split(':');
+ return ratio.map(Number).every(is$1.number);
+}
+function reduceAspectRatio(ratio) {
+ if (!is$1.array(ratio) || !ratio.every(is$1.number)) {
+ return null;
+ }
+
+ var _ratio = _slicedToArray(ratio, 2),
+ width = _ratio[0],
+ height = _ratio[1];
+
+ var getDivider = function getDivider(w, h) {
+ return h === 0 ? w : getDivider(h, w % h);
+ };
+
+ var divider = getDivider(width, height);
+ return [width / divider, height / divider];
+}
+function getAspectRatio(input) {
+ var parse = function parse(ratio) {
+ return validateRatio(ratio) ? ratio.split(':').map(Number) : null;
+ }; // Try provided ratio
+
+
+ var ratio = parse(input); // Get from config
+
+ if (ratio === null) {
+ ratio = parse(this.config.ratio);
+ } // Get from embed
+
+
+ if (ratio === null && !is$1.empty(this.embed) && is$1.array(this.embed.ratio)) {
+ ratio = this.embed.ratio;
+ } // Get from HTML5 video
+
+
+ if (ratio === null && this.isHTML5) {
+ var _this$media = this.media,
+ videoWidth = _this$media.videoWidth,
+ videoHeight = _this$media.videoHeight;
+ ratio = reduceAspectRatio([videoWidth, videoHeight]);
+ }
+
+ return ratio;
+} // Set aspect ratio for responsive container
+
+function setAspectRatio(input) {
+ if (!this.isVideo) {
+ return {};
+ }
+
+ var wrapper = this.elements.wrapper;
+ var ratio = getAspectRatio.call(this, input);
+
+ var _ref = is$1.array(ratio) ? ratio : [0, 0],
+ _ref2 = _slicedToArray(_ref, 2),
+ w = _ref2[0],
+ h = _ref2[1];
+
+ var padding = 100 / w * h;
+ wrapper.style.paddingBottom = "".concat(padding, "%"); // For Vimeo we have an extra <div> to hide the standard controls and UI
+
+ if (this.isVimeo && !this.config.vimeo.premium && this.supported.ui) {
+ var height = 100 / this.media.offsetWidth * parseInt(window.getComputedStyle(this.media).paddingBottom, 10);
+ var offset = (height - padding) / (height / 50);
+ this.media.style.transform = "translateY(-".concat(offset, "%)");
+ } else if (this.isHTML5) {
+ wrapper.classList.toggle(this.config.classNames.videoFixedRatio, ratio !== null);
+ }
+
+ return {
+ padding: padding,
+ ratio: ratio
+ };
+}
+
+// ==========================================================================
+var html5 = {
+ getSources: function getSources() {
+ var _this = this;
+
+ if (!this.isHTML5) {
+ return [];
+ }
+
+ var sources = Array.from(this.media.querySelectorAll('source')); // Filter out unsupported sources (if type is specified)
+
+ return sources.filter(function (source) {
+ var type = source.getAttribute('type');
+
+ if (is$1.empty(type)) {
+ return true;
+ }
+
+ return support.mime.call(_this, type);
+ });
+ },
+ // Get quality levels
+ getQualityOptions: function getQualityOptions() {
+ // Whether we're forcing all options (e.g. for streaming)
+ if (this.config.quality.forced) {
+ return this.config.quality.options;
+ } // Get sizes from <source> elements
+
+
+ return html5.getSources.call(this).map(function (source) {
+ return Number(source.getAttribute('data-res'));
+ }).filter(Boolean);
+ },
+ setup: function setup() {
+ if (!this.isHTML5) {
+ return;
+ }
+
+ var player = this; // Set speed options from config
+
+ player.options.speed = player.config.speed.options; // Set aspect ratio if fixed
+
+ if (!is$1.empty(this.config.ratio)) {
+ setAspectRatio.call(player);
+ } // Quality
+
+
+ Object.defineProperty(player.media, 'quality', {
+ get: function get() {
+ // Get sources
+ var sources = html5.getSources.call(player);
+ var source = sources.find(function (s) {
+ return s.getAttribute('src') === player.source;
+ }); // Return size, if match is found
+
+ return source && Number(source.getAttribute('data-res'));
+ },
+ set: function set(input) {
+ if (player.quality === input) {
+ return;
+ } // If we're using an an external handler...
+
+
+ if (player.config.quality.forced && is$1.function(player.config.quality.onChange)) {
+ player.config.quality.onChange(input);
+ } else {
+ // Get sources
+ var sources = html5.getSources.call(player); // Get first match for requested size
+
+ var source = sources.find(function (s) {
+ return Number(s.getAttribute('data-res')) === input;
+ }); // No matching source found
+
+ if (!source) {
+ return;
+ } // Get current state
+
+
+ var _player$media = player.media,
+ currentTime = _player$media.currentTime,
+ paused = _player$media.paused,
+ preload = _player$media.preload,
+ readyState = _player$media.readyState,
+ playbackRate = _player$media.playbackRate; // Set new source
+
+ player.media.src = source.getAttribute('src'); // Prevent loading if preload="none" and the current source isn't loaded (#1044)
+
+ if (preload !== 'none' || readyState) {
+ // Restore time
+ player.once('loadedmetadata', function () {
+ player.speed = playbackRate;
+ player.currentTime = currentTime; // Resume playing
+
+ if (!paused) {
+ silencePromise(player.play());
+ }
+ }); // Load new source
+
+ player.media.load();
+ }
+ } // Trigger change event
+
+
+ triggerEvent.call(player, player.media, 'qualitychange', false, {
+ quality: input
+ });
+ }
+ });
+ },
+ // Cancel current network requests
+ // See https://github.com/sampotts/plyr/issues/174
+ cancelRequests: function cancelRequests() {
+ if (!this.isHTML5) {
+ return;
+ } // Remove child sources
+
+
+ removeElement(html5.getSources.call(this)); // Set blank video src attribute
+ // This is to prevent a MEDIA_ERR_SRC_NOT_SUPPORTED error
+ // Info: http://stackoverflow.com/questions/32231579/how-to-properly-dispose-of-an-html5-video-and-close-socket-or-connection
+
+ this.media.setAttribute('src', this.config.blankVideo); // Load the new empty source
+ // This will cancel existing requests
+ // See https://github.com/sampotts/plyr/issues/174
+
+ this.media.load(); // Debugging
+
+ this.debug.log('Cancelled network requests');
+ }
+};
+
+// ==========================================================================
+
+function dedupe(array) {
+ if (!is$1.array(array)) {
+ return array;
+ }
+
+ return array.filter(function (item, index) {
+ return array.indexOf(item) === index;
+ });
+} // Get the closest value in an array
+
+function closest$1(array, value) {
+ if (!is$1.array(array) || !array.length) {
+ return null;
+ }
+
+ return array.reduce(function (prev, curr) {
+ return Math.abs(curr - value) < Math.abs(prev - value) ? curr : prev;
+ });
+}
+
+// ==========================================================================
+
+function generateId(prefix) {
+ return "".concat(prefix, "-").concat(Math.floor(Math.random() * 10000));
+} // Format string
+
+function format(input) {
+ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
+ args[_key - 1] = arguments[_key];
+ }
+
+ if (is$1.empty(input)) {
+ return input;
+ }
+
+ return input.toString().replace(/{(\d+)}/g, function (match, i) {
+ return args[i].toString();
+ });
+} // Get percentage
+
+function getPercentage(current, max) {
+ if (current === 0 || max === 0 || Number.isNaN(current) || Number.isNaN(max)) {
+ return 0;
+ }
+
+ return (current / max * 100).toFixed(2);
+} // Replace all occurances of a string in a string
+
+var replaceAll = function replaceAll() {
+ var input = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
+ var find = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
+ var replace = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
+ return input.replace(new RegExp(find.toString().replace(/([.*+?^=!:${}()|[\]/\\])/g, '\\$1'), 'g'), replace.toString());
+}; // Convert to title case
+
+var toTitleCase = function toTitleCase() {
+ var input = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
+ return input.toString().replace(/\w\S*/g, function (text) {
+ return text.charAt(0).toUpperCase() + text.substr(1).toLowerCase();
+ });
+}; // Convert string to pascalCase
+
+function toPascalCase() {
+ var input = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
+ var string = input.toString(); // Convert kebab case
+
+ string = replaceAll(string, '-', ' '); // Convert snake case
+
+ string = replaceAll(string, '_', ' '); // Convert to title case
+
+ string = toTitleCase(string); // Convert to pascal case
+
+ return replaceAll(string, ' ', '');
+} // Convert string to pascalCase
+
+function toCamelCase() {
+ var input = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
+ var string = input.toString(); // Convert to pascal case
+
+ string = toPascalCase(string); // Convert first character to lowercase
+
+ return string.charAt(0).toLowerCase() + string.slice(1);
+} // Remove HTML from a string
+
+function stripHTML(source) {
+ var fragment = document.createDocumentFragment();
+ var element = document.createElement('div');
+ fragment.appendChild(element);
+ element.innerHTML = source;
+ return fragment.firstChild.innerText;
+} // Like outerHTML, but also works for DocumentFragment
+
+function getHTML(element) {
+ var wrapper = document.createElement('div');
+ wrapper.appendChild(element);
+ return wrapper.innerHTML;
+}
+
+var resources = {
+ pip: 'PIP',
+ airplay: 'AirPlay',
+ html5: 'HTML5',
+ vimeo: 'Vimeo',
+ youtube: 'YouTube'
+};
+var i18n = {
+ get: function get() {
+ var key = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
+ var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
+
+ if (is$1.empty(key) || is$1.empty(config)) {
+ return '';
+ }
+
+ var string = getDeep(config.i18n, key);
+
+ if (is$1.empty(string)) {
+ if (Object.keys(resources).includes(key)) {
+ return resources[key];
+ }
+
+ return '';
+ }
+
+ var replace = {
+ '{seektime}': config.seekTime,
+ '{title}': config.title
+ };
+ Object.entries(replace).forEach(function (_ref) {
+ var _ref2 = _slicedToArray(_ref, 2),
+ k = _ref2[0],
+ v = _ref2[1];
+
+ string = replaceAll(string, k, v);
+ });
+ return string;
+ }
+};
+
+var Storage = /*#__PURE__*/function () {
+ function Storage(player) {
+ _classCallCheck(this, Storage);
+
+ this.enabled = player.config.storage.enabled;
+ this.key = player.config.storage.key;
+ } // Check for actual support (see if we can use it)
+
+
+ _createClass(Storage, [{
+ key: "get",
+ value: function get(key) {
+ if (!Storage.supported || !this.enabled) {
+ return null;
+ }
+
+ var store = window.localStorage.getItem(this.key);
+
+ if (is$1.empty(store)) {
+ return null;
+ }
+
+ var json = JSON.parse(store);
+ return is$1.string(key) && key.length ? json[key] : json;
+ }
+ }, {
+ key: "set",
+ value: function set(object) {
+ // Bail if we don't have localStorage support or it's disabled
+ if (!Storage.supported || !this.enabled) {
+ return;
+ } // Can only store objectst
+
+
+ if (!is$1.object(object)) {
+ return;
+ } // Get current storage
+
+
+ var storage = this.get(); // Default to empty object
+
+ if (is$1.empty(storage)) {
+ storage = {};
+ } // Update the working copy of the values
+
+
+ extend(storage, object); // Update storage
+
+ window.localStorage.setItem(this.key, JSON.stringify(storage));
+ }
+ }], [{
+ key: "supported",
+ get: function get() {
+ try {
+ if (!('localStorage' in window)) {
+ return false;
+ }
+
+ var test = '___test'; // Try to use it (it might be disabled, e.g. user is in private mode)
+ // see: https://github.com/sampotts/plyr/issues/131
+
+ window.localStorage.setItem(test, test);
+ window.localStorage.removeItem(test);
+ return true;
+ } catch (e) {
+ return false;
+ }
+ }
+ }]);
+
+ return Storage;
+}();
+
+// ==========================================================================
+// Fetch wrapper
+// Using XHR to avoid issues with older browsers
+// ==========================================================================
+function fetch(url) {
+ var responseType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'text';
+ return new Promise(function (resolve, reject) {
+ try {
+ var request = new XMLHttpRequest(); // Check for CORS support
+
+ if (!('withCredentials' in request)) {
+ return;
+ }
+
+ request.addEventListener('load', function () {
+ if (responseType === 'text') {
+ try {
+ resolve(JSON.parse(request.responseText));
+ } catch (e) {
+ resolve(request.responseText);
+ }
+ } else {
+ resolve(request.response);
+ }
+ });
+ request.addEventListener('error', function () {
+ throw new Error(request.status);
+ });
+ request.open('GET', url, true); // Set the required response type
+
+ request.responseType = responseType;
+ request.send();
+ } catch (e) {
+ reject(e);
+ }
+ });
+}
+
+// ==========================================================================
+
+function loadSprite(url, id) {
+ if (!is$1.string(url)) {
+ return;
+ }
+
+ var prefix = 'cache';
+ var hasId = is$1.string(id);
+ var isCached = false;
+
+ var exists = function exists() {
+ return document.getElementById(id) !== null;
+ };
+
+ var update = function update(container, data) {
+ // eslint-disable-next-line no-param-reassign
+ container.innerHTML = data; // Check again incase of race condition
+
+ if (hasId && exists()) {
+ return;
+ } // Inject the SVG to the body
+
+
+ document.body.insertAdjacentElement('afterbegin', container);
+ }; // Only load once if ID set
+
+
+ if (!hasId || !exists()) {
+ var useStorage = Storage.supported; // Create container
+
+ var container = document.createElement('div');
+ container.setAttribute('hidden', '');
+
+ if (hasId) {
+ container.setAttribute('id', id);
+ } // Check in cache
+
+
+ if (useStorage) {
+ var cached = window.localStorage.getItem("".concat(prefix, "-").concat(id));
+ isCached = cached !== null;
+
+ if (isCached) {
+ var data = JSON.parse(cached);
+ update(container, data.content);
+ }
+ } // Get the sprite
+
+
+ fetch(url).then(function (result) {
+ if (is$1.empty(result)) {
+ return;
+ }
+
+ if (useStorage) {
+ window.localStorage.setItem("".concat(prefix, "-").concat(id), JSON.stringify({
+ content: result
+ }));
+ }
+
+ update(container, result);
+ }).catch(function () {});
+ }
+}
+
+// ==========================================================================
+
+var getHours = function getHours(value) {
+ return Math.trunc(value / 60 / 60 % 60, 10);
+};
+var getMinutes = function getMinutes(value) {
+ return Math.trunc(value / 60 % 60, 10);
+};
+var getSeconds = function getSeconds(value) {
+ return Math.trunc(value % 60, 10);
+}; // Format time to UI friendly string
+
+function formatTime() {
+ var time = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
+ var displayHours = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
+ var inverted = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
+
+ // Bail if the value isn't a number
+ if (!is$1.number(time)) {
+ return formatTime(undefined, displayHours, inverted);
+ } // Format time component to add leading zero
+
+
+ var format = function format(value) {
+ return "0".concat(value).slice(-2);
+ }; // Breakdown to hours, mins, secs
+
+
+ var hours = getHours(time);
+ var mins = getMinutes(time);
+ var secs = getSeconds(time); // Do we need to display hours?
+
+ if (displayHours || hours > 0) {
+ hours = "".concat(hours, ":");
+ } else {
+ hours = '';
+ } // Render
+
+
+ return "".concat(inverted && time > 0 ? '-' : '').concat(hours).concat(format(mins), ":").concat(format(secs));
+}
+
+var controls = {
+ // Get icon URL
+ getIconUrl: function getIconUrl() {
+ var url = new URL(this.config.iconUrl, window.location);
+ var cors = url.host !== window.location.host || browser.isIE && !window.svg4everybody;
+ return {
+ url: this.config.iconUrl,
+ cors: cors
+ };
+ },
+ // Find the UI controls
+ findElements: function findElements() {
+ try {
+ this.elements.controls = getElement.call(this, this.config.selectors.controls.wrapper); // Buttons
+
+ this.elements.buttons = {
+ play: getElements.call(this, this.config.selectors.buttons.play),
+ pause: getElement.call(this, this.config.selectors.buttons.pause),
+ restart: getElement.call(this, this.config.selectors.buttons.restart),
+ rewind: getElement.call(this, this.config.selectors.buttons.rewind),
+ fastForward: getElement.call(this, this.config.selectors.buttons.fastForward),
+ mute: getElement.call(this, this.config.selectors.buttons.mute),
+ pip: getElement.call(this, this.config.selectors.buttons.pip),
+ airplay: getElement.call(this, this.config.selectors.buttons.airplay),
+ settings: getElement.call(this, this.config.selectors.buttons.settings),
+ captions: getElement.call(this, this.config.selectors.buttons.captions),
+ fullscreen: getElement.call(this, this.config.selectors.buttons.fullscreen)
+ }; // Progress
+
+ this.elements.progress = getElement.call(this, this.config.selectors.progress); // Inputs
+
+ this.elements.inputs = {
+ seek: getElement.call(this, this.config.selectors.inputs.seek),
+ volume: getElement.call(this, this.config.selectors.inputs.volume)
+ }; // Display
+
+ this.elements.display = {
+ buffer: getElement.call(this, this.config.selectors.display.buffer),
+ currentTime: getElement.call(this, this.config.selectors.display.currentTime),
+ duration: getElement.call(this, this.config.selectors.display.duration)
+ }; // Seek tooltip
+
+ if (is$1.element(this.elements.progress)) {
+ this.elements.display.seekTooltip = this.elements.progress.querySelector(".".concat(this.config.classNames.tooltip));
+ }
+
+ return true;
+ } catch (error) {
+ // Log it
+ this.debug.warn('It looks like there is a problem with your custom controls HTML', error); // Restore native video controls
+
+ this.toggleNativeControls(true);
+ return false;
+ }
+ },
+ // Create <svg> icon
+ createIcon: function createIcon(type, attributes) {
+ var namespace = 'http://www.w3.org/2000/svg';
+ var iconUrl = controls.getIconUrl.call(this);
+ var iconPath = "".concat(!iconUrl.cors ? iconUrl.url : '', "#").concat(this.config.iconPrefix); // Create <svg>
+
+ var icon = document.createElementNS(namespace, 'svg');
+ setAttributes(icon, extend(attributes, {
+ 'aria-hidden': 'true',
+ focusable: 'false'
+ })); // Create the <use> to reference sprite
+
+ var use = document.createElementNS(namespace, 'use');
+ var path = "".concat(iconPath, "-").concat(type); // Set `href` attributes
+ // https://github.com/sampotts/plyr/issues/460
+ // https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/xlink:href
+
+ if ('href' in use) {
+ use.setAttributeNS('http://www.w3.org/1999/xlink', 'href', path);
+ } // Always set the older attribute even though it's "deprecated" (it'll be around for ages)
+
+
+ use.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', path); // Add <use> to <svg>
+
+ icon.appendChild(use);
+ return icon;
+ },
+ // Create hidden text label
+ createLabel: function createLabel(key) {
+ var attr = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
+ var text = i18n.get(key, this.config);
+
+ var attributes = _objectSpread2(_objectSpread2({}, attr), {}, {
+ class: [attr.class, this.config.classNames.hidden].filter(Boolean).join(' ')
+ });
+
+ return createElement('span', attributes, text);
+ },
+ // Create a badge
+ createBadge: function createBadge(text) {
+ if (is$1.empty(text)) {
+ return null;
+ }
+
+ var badge = createElement('span', {
+ class: this.config.classNames.menu.value
+ });
+ badge.appendChild(createElement('span', {
+ class: this.config.classNames.menu.badge
+ }, text));
+ return badge;
+ },
+ // Create a <button>
+ createButton: function createButton(buttonType, attr) {
+ var _this = this;
+
+ var attributes = extend({}, attr);
+ var type = toCamelCase(buttonType);
+ var props = {
+ element: 'button',
+ toggle: false,
+ label: null,
+ icon: null,
+ labelPressed: null,
+ iconPressed: null
+ };
+ ['element', 'icon', 'label'].forEach(function (key) {
+ if (Object.keys(attributes).includes(key)) {
+ props[key] = attributes[key];
+ delete attributes[key];
+ }
+ }); // Default to 'button' type to prevent form submission
+
+ if (props.element === 'button' && !Object.keys(attributes).includes('type')) {
+ attributes.type = 'button';
+ } // Set class name
+
+
+ if (Object.keys(attributes).includes('class')) {
+ if (!attributes.class.split(' ').some(function (c) {
+ return c === _this.config.classNames.control;
+ })) {
+ extend(attributes, {
+ class: "".concat(attributes.class, " ").concat(this.config.classNames.control)
+ });
+ }
+ } else {
+ attributes.class = this.config.classNames.control;
+ } // Large play button
+
+
+ switch (buttonType) {
+ case 'play':
+ props.toggle = true;
+ props.label = 'play';
+ props.labelPressed = 'pause';
+ props.icon = 'play';
+ props.iconPressed = 'pause';
+ break;
+
+ case 'mute':
+ props.toggle = true;
+ props.label = 'mute';
+ props.labelPressed = 'unmute';
+ props.icon = 'volume';
+ props.iconPressed = 'muted';
+ break;
+
+ case 'captions':
+ props.toggle = true;
+ props.label = 'enableCaptions';
+ props.labelPressed = 'disableCaptions';
+ props.icon = 'captions-off';
+ props.iconPressed = 'captions-on';
+ break;
+
+ case 'fullscreen':
+ props.toggle = true;
+ props.label = 'enterFullscreen';
+ props.labelPressed = 'exitFullscreen';
+ props.icon = 'enter-fullscreen';
+ props.iconPressed = 'exit-fullscreen';
+ break;
+
+ case 'play-large':
+ attributes.class += " ".concat(this.config.classNames.control, "--overlaid");
+ type = 'play';
+ props.label = 'play';
+ props.icon = 'play';
+ break;
+
+ default:
+ if (is$1.empty(props.label)) {
+ props.label = type;
+ }
+
+ if (is$1.empty(props.icon)) {
+ props.icon = buttonType;
+ }
+
+ }
+
+ var button = createElement(props.element); // Setup toggle icon and labels
+
+ if (props.toggle) {
+ // Icon
+ button.appendChild(controls.createIcon.call(this, props.iconPressed, {
+ class: 'icon--pressed'
+ }));
+ button.appendChild(controls.createIcon.call(this, props.icon, {
+ class: 'icon--not-pressed'
+ })); // Label/Tooltip
+
+ button.appendChild(controls.createLabel.call(this, props.labelPressed, {
+ class: 'label--pressed'
+ }));
+ button.appendChild(controls.createLabel.call(this, props.label, {
+ class: 'label--not-pressed'
+ }));
+ } else {
+ button.appendChild(controls.createIcon.call(this, props.icon));
+ button.appendChild(controls.createLabel.call(this, props.label));
+ } // Merge and set attributes
+
+
+ extend(attributes, getAttributesFromSelector(this.config.selectors.buttons[type], attributes));
+ setAttributes(button, attributes); // We have multiple play buttons
+
+ if (type === 'play') {
+ if (!is$1.array(this.elements.buttons[type])) {
+ this.elements.buttons[type] = [];
+ }
+
+ this.elements.buttons[type].push(button);
+ } else {
+ this.elements.buttons[type] = button;
+ }
+
+ return button;
+ },
+ // Create an <input type='range'>
+ createRange: function createRange(type, attributes) {
+ // Seek input
+ var input = createElement('input', extend(getAttributesFromSelector(this.config.selectors.inputs[type]), {
+ type: 'range',
+ min: 0,
+ max: 100,
+ step: 0.01,
+ value: 0,
+ autocomplete: 'off',
+ // A11y fixes for https://github.com/sampotts/plyr/issues/905
+ role: 'slider',
+ 'aria-label': i18n.get(type, this.config),
+ 'aria-valuemin': 0,
+ 'aria-valuemax': 100,
+ 'aria-valuenow': 0
+ }, attributes));
+ this.elements.inputs[type] = input; // Set the fill for webkit now
+
+ controls.updateRangeFill.call(this, input); // Improve support on touch devices
+
+ RangeTouch.setup(input);
+ return input;
+ },
+ // Create a <progress>
+ createProgress: function createProgress(type, attributes) {
+ var progress = createElement('progress', extend(getAttributesFromSelector(this.config.selectors.display[type]), {
+ min: 0,
+ max: 100,
+ value: 0,
+ role: 'progressbar',
+ 'aria-hidden': true
+ }, attributes)); // Create the label inside
+
+ if (type !== 'volume') {
+ progress.appendChild(createElement('span', null, '0'));
+ var suffixKey = {
+ played: 'played',
+ buffer: 'buffered'
+ }[type];
+ var suffix = suffixKey ? i18n.get(suffixKey, this.config) : '';
+ progress.innerText = "% ".concat(suffix.toLowerCase());
+ }
+
+ this.elements.display[type] = progress;
+ return progress;
+ },
+ // Create time display
+ createTime: function createTime(type, attrs) {
+ var attributes = getAttributesFromSelector(this.config.selectors.display[type], attrs);
+ var container = createElement('div', extend(attributes, {
+ class: "".concat(attributes.class ? attributes.class : '', " ").concat(this.config.classNames.display.time, " ").trim(),
+ 'aria-label': i18n.get(type, this.config)
+ }), '00:00'); // Reference for updates
+
+ this.elements.display[type] = container;
+ return container;
+ },
+ // Bind keyboard shortcuts for a menu item
+ // We have to bind to keyup otherwise Firefox triggers a click when a keydown event handler shifts focus
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=1220143
+ bindMenuItemShortcuts: function bindMenuItemShortcuts(menuItem, type) {
+ var _this2 = this;
+
+ // Navigate through menus via arrow keys and space
+ on.call(this, menuItem, 'keydown keyup', function (event) {
+ // We only care about space and ⬆️ ⬇️️ ➡️
+ if (![32, 38, 39, 40].includes(event.which)) {
+ return;
+ } // Prevent play / seek
+
+
+ event.preventDefault();
+ event.stopPropagation(); // We're just here to prevent the keydown bubbling
+
+ if (event.type === 'keydown') {
+ return;
+ }
+
+ var isRadioButton = matches$1(menuItem, '[role="menuitemradio"]'); // Show the respective menu
+
+ if (!isRadioButton && [32, 39].includes(event.which)) {
+ controls.showMenuPanel.call(_this2, type, true);
+ } else {
+ var target;
+
+ if (event.which !== 32) {
+ if (event.which === 40 || isRadioButton && event.which === 39) {
+ target = menuItem.nextElementSibling;
+
+ if (!is$1.element(target)) {
+ target = menuItem.parentNode.firstElementChild;
+ }
+ } else {
+ target = menuItem.previousElementSibling;
+
+ if (!is$1.element(target)) {
+ target = menuItem.parentNode.lastElementChild;
+ }
+ }
+
+ setFocus.call(_this2, target, true);
+ }
+ }
+ }, false); // Enter will fire a `click` event but we still need to manage focus
+ // So we bind to keyup which fires after and set focus here
+
+ on.call(this, menuItem, 'keyup', function (event) {
+ if (event.which !== 13) {
+ return;
+ }
+
+ controls.focusFirstMenuItem.call(_this2, null, true);
+ });
+ },
+ // Create a settings menu item
+ createMenuItem: function createMenuItem(_ref) {
+ var _this3 = this;
+
+ var value = _ref.value,
+ list = _ref.list,
+ type = _ref.type,
+ title = _ref.title,
+ _ref$badge = _ref.badge,
+ badge = _ref$badge === void 0 ? null : _ref$badge,
+ _ref$checked = _ref.checked,
+ checked = _ref$checked === void 0 ? false : _ref$checked;
+ var attributes = getAttributesFromSelector(this.config.selectors.inputs[type]);
+ var menuItem = createElement('button', extend(attributes, {
+ type: 'button',
+ role: 'menuitemradio',
+ class: "".concat(this.config.classNames.control, " ").concat(attributes.class ? attributes.class : '').trim(),
+ 'aria-checked': checked,
+ value: value
+ }));
+ var flex = createElement('span'); // We have to set as HTML incase of special characters
+
+ flex.innerHTML = title;
+
+ if (is$1.element(badge)) {
+ flex.appendChild(badge);
+ }
+
+ menuItem.appendChild(flex); // Replicate radio button behaviour
+
+ Object.defineProperty(menuItem, 'checked', {
+ enumerable: true,
+ get: function get() {
+ return menuItem.getAttribute('aria-checked') === 'true';
+ },
+ set: function set(check) {
+ // Ensure exclusivity
+ if (check) {
+ Array.from(menuItem.parentNode.children).filter(function (node) {
+ return matches$1(node, '[role="menuitemradio"]');
+ }).forEach(function (node) {
+ return node.setAttribute('aria-checked', 'false');
+ });
+ }
+
+ menuItem.setAttribute('aria-checked', check ? 'true' : 'false');
+ }
+ });
+ this.listeners.bind(menuItem, 'click keyup', function (event) {
+ if (is$1.keyboardEvent(event) && event.which !== 32) {
+ return;
+ }
+
+ event.preventDefault();
+ event.stopPropagation();
+ menuItem.checked = true;
+
+ switch (type) {
+ case 'language':
+ _this3.currentTrack = Number(value);
+ break;
+
+ case 'quality':
+ _this3.quality = value;
+ break;
+
+ case 'speed':
+ _this3.speed = parseFloat(value);
+ break;
+ }
+
+ controls.showMenuPanel.call(_this3, 'home', is$1.keyboardEvent(event));
+ }, type, false);
+ controls.bindMenuItemShortcuts.call(this, menuItem, type);
+ list.appendChild(menuItem);
+ },
+ // Format a time for display
+ formatTime: function formatTime$1() {
+ var time = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
+ var inverted = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
+
+ // Bail if the value isn't a number
+ if (!is$1.number(time)) {
+ return time;
+ } // Always display hours if duration is over an hour
+
+
+ var forceHours = getHours(this.duration) > 0;
+ return formatTime(time, forceHours, inverted);
+ },
+ // Update the displayed time
+ updateTimeDisplay: function updateTimeDisplay() {
+ var target = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
+ var time = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
+ var inverted = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
+
+ // Bail if there's no element to display or the value isn't a number
+ if (!is$1.element(target) || !is$1.number(time)) {
+ return;
+ } // eslint-disable-next-line no-param-reassign
+
+
+ target.innerText = controls.formatTime(time, inverted);
+ },
+ // Update volume UI and storage
+ updateVolume: function updateVolume() {
+ if (!this.supported.ui) {
+ return;
+ } // Update range
+
+
+ if (is$1.element(this.elements.inputs.volume)) {
+ controls.setRange.call(this, this.elements.inputs.volume, this.muted ? 0 : this.volume);
+ } // Update mute state
+
+
+ if (is$1.element(this.elements.buttons.mute)) {
+ this.elements.buttons.mute.pressed = this.muted || this.volume === 0;
+ }
+ },
+ // Update seek value and lower fill
+ setRange: function setRange(target) {
+ var value = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
+
+ if (!is$1.element(target)) {
+ return;
+ } // eslint-disable-next-line
+
+
+ target.value = value; // Webkit range fill
+
+ controls.updateRangeFill.call(this, target);
+ },
+ // Update <progress> elements
+ updateProgress: function updateProgress(event) {
+ var _this4 = this;
+
+ if (!this.supported.ui || !is$1.event(event)) {
+ return;
+ }
+
+ var value = 0;
+
+ var setProgress = function setProgress(target, input) {
+ var val = is$1.number(input) ? input : 0;
+ var progress = is$1.element(target) ? target : _this4.elements.display.buffer; // Update value and label
+
+ if (is$1.element(progress)) {
+ progress.value = val; // Update text label inside
+
+ var label = progress.getElementsByTagName('span')[0];
+
+ if (is$1.element(label)) {
+ label.childNodes[0].nodeValue = val;
+ }
+ }
+ };
+
+ if (event) {
+ switch (event.type) {
+ // Video playing
+ case 'timeupdate':
+ case 'seeking':
+ case 'seeked':
+ value = getPercentage(this.currentTime, this.duration); // Set seek range value only if it's a 'natural' time event
+
+ if (event.type === 'timeupdate') {
+ controls.setRange.call(this, this.elements.inputs.seek, value);
+ }
+
+ break;
+ // Check buffer status
+
+ case 'playing':
+ case 'progress':
+ setProgress(this.elements.display.buffer, this.buffered * 100);
+ break;
+ }
+ }
+ },
+ // Webkit polyfill for lower fill range
+ updateRangeFill: function updateRangeFill(target) {
+ // Get range from event if event passed
+ var range = is$1.event(target) ? target.target : target; // Needs to be a valid <input type='range'>
+
+ if (!is$1.element(range) || range.getAttribute('type') !== 'range') {
+ return;
+ } // Set aria values for https://github.com/sampotts/plyr/issues/905
+
+
+ if (matches$1(range, this.config.selectors.inputs.seek)) {
+ range.setAttribute('aria-valuenow', this.currentTime);
+ var currentTime = controls.formatTime(this.currentTime);
+ var duration = controls.formatTime(this.duration);
+ var format = i18n.get('seekLabel', this.config);
+ range.setAttribute('aria-valuetext', format.replace('{currentTime}', currentTime).replace('{duration}', duration));
+ } else if (matches$1(range, this.config.selectors.inputs.volume)) {
+ var percent = range.value * 100;
+ range.setAttribute('aria-valuenow', percent);
+ range.setAttribute('aria-valuetext', "".concat(percent.toFixed(1), "%"));
+ } else {
+ range.setAttribute('aria-valuenow', range.value);
+ } // WebKit only
+
+
+ if (!browser.isWebkit) {
+ return;
+ } // Set CSS custom property
+
+
+ range.style.setProperty('--value', "".concat(range.value / range.max * 100, "%"));
+ },
+ // Update hover tooltip for seeking
+ updateSeekTooltip: function updateSeekTooltip(event) {
+ var _this5 = this;
+
+ // Bail if setting not true
+ if (!this.config.tooltips.seek || !is$1.element(this.elements.inputs.seek) || !is$1.element(this.elements.display.seekTooltip) || this.duration === 0) {
+ return;
+ }
+
+ var visible = "".concat(this.config.classNames.tooltip, "--visible");
+
+ var toggle = function toggle(show) {
+ return toggleClass(_this5.elements.display.seekTooltip, visible, show);
+ }; // Hide on touch
+
+
+ if (this.touch) {
+ toggle(false);
+ return;
+ } // Determine percentage, if already visible
+
+
+ var percent = 0;
+ var clientRect = this.elements.progress.getBoundingClientRect();
+
+ if (is$1.event(event)) {
+ percent = 100 / clientRect.width * (event.pageX - clientRect.left);
+ } else if (hasClass(this.elements.display.seekTooltip, visible)) {
+ percent = parseFloat(this.elements.display.seekTooltip.style.left, 10);
+ } else {
+ return;
+ } // Set bounds
+
+
+ if (percent < 0) {
+ percent = 0;
+ } else if (percent > 100) {
+ percent = 100;
+ } // Display the time a click would seek to
+
+
+ controls.updateTimeDisplay.call(this, this.elements.display.seekTooltip, this.duration / 100 * percent); // Set position
+
+ this.elements.display.seekTooltip.style.left = "".concat(percent, "%"); // Show/hide the tooltip
+ // If the event is a moues in/out and percentage is inside bounds
+
+ if (is$1.event(event) && ['mouseenter', 'mouseleave'].includes(event.type)) {
+ toggle(event.type === 'mouseenter');
+ }
+ },
+ // Handle time change event
+ timeUpdate: function timeUpdate(event) {
+ // Only invert if only one time element is displayed and used for both duration and currentTime
+ var invert = !is$1.element(this.elements.display.duration) && this.config.invertTime; // Duration
+
+ controls.updateTimeDisplay.call(this, this.elements.display.currentTime, invert ? this.duration - this.currentTime : this.currentTime, invert); // Ignore updates while seeking
+
+ if (event && event.type === 'timeupdate' && this.media.seeking) {
+ return;
+ } // Playing progress
+
+
+ controls.updateProgress.call(this, event);
+ },
+ // Show the duration on metadataloaded or durationchange events
+ durationUpdate: function durationUpdate() {
+ // Bail if no UI or durationchange event triggered after playing/seek when invertTime is false
+ if (!this.supported.ui || !this.config.invertTime && this.currentTime) {
+ return;
+ } // 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.
+ // https://github.com/video-dev/hls.js/blob/5820d29d3c4c8a46e8b75f1e3afa3e68c1a9a2db/src/controller/buffer-controller.js#L415
+ // https://github.com/google/shaka-player/blob/4d889054631f4e1cf0fbd80ddd2b71887c02e232/lib/media/streaming_engine.js#L1062
+ // https://github.com/Dash-Industry-Forum/dash.js/blob/69859f51b969645b234666800d4cb596d89c602d/src/dash/models/DashManifestModel.js#L338
+
+
+ if (this.duration >= Math.pow(2, 32)) {
+ toggleHidden(this.elements.display.currentTime, true);
+ toggleHidden(this.elements.progress, true);
+ return;
+ } // Update ARIA values
+
+
+ if (is$1.element(this.elements.inputs.seek)) {
+ this.elements.inputs.seek.setAttribute('aria-valuemax', this.duration);
+ } // If there's a spot to display duration
+
+
+ var hasDuration = is$1.element(this.elements.display.duration); // If there's only one time display, display duration there
+
+ if (!hasDuration && this.config.displayDuration && this.paused) {
+ controls.updateTimeDisplay.call(this, this.elements.display.currentTime, this.duration);
+ } // If there's a duration element, update content
+
+
+ if (hasDuration) {
+ controls.updateTimeDisplay.call(this, this.elements.display.duration, this.duration);
+ } // Update the tooltip (if visible)
+
+
+ controls.updateSeekTooltip.call(this);
+ },
+ // Hide/show a tab
+ toggleMenuButton: function toggleMenuButton(setting, toggle) {
+ toggleHidden(this.elements.settings.buttons[setting], !toggle);
+ },
+ // Update the selected setting
+ updateSetting: function updateSetting(setting, container, input) {
+ var pane = this.elements.settings.panels[setting];
+ var value = null;
+ var list = container;
+
+ if (setting === 'captions') {
+ value = this.currentTrack;
+ } else {
+ value = !is$1.empty(input) ? input : this[setting]; // Get default
+
+ if (is$1.empty(value)) {
+ value = this.config[setting].default;
+ } // Unsupported value
+
+
+ if (!is$1.empty(this.options[setting]) && !this.options[setting].includes(value)) {
+ this.debug.warn("Unsupported value of '".concat(value, "' for ").concat(setting));
+ return;
+ } // Disabled value
+
+
+ if (!this.config[setting].options.includes(value)) {
+ this.debug.warn("Disabled value of '".concat(value, "' for ").concat(setting));
+ return;
+ }
+ } // Get the list if we need to
+
+
+ if (!is$1.element(list)) {
+ list = pane && pane.querySelector('[role="menu"]');
+ } // If there's no list it means it's not been rendered...
+
+
+ if (!is$1.element(list)) {
+ return;
+ } // Update the label
+
+
+ var label = this.elements.settings.buttons[setting].querySelector(".".concat(this.config.classNames.menu.value));
+ label.innerHTML = controls.getLabel.call(this, setting, value); // Find the radio option and check it
+
+ var target = list && list.querySelector("[value=\"".concat(value, "\"]"));
+
+ if (is$1.element(target)) {
+ target.checked = true;
+ }
+ },
+ // Translate a value into a nice label
+ getLabel: function getLabel(setting, value) {
+ switch (setting) {
+ case 'speed':
+ return value === 1 ? i18n.get('normal', this.config) : "".concat(value, "&times;");
+
+ case 'quality':
+ if (is$1.number(value)) {
+ var label = i18n.get("qualityLabel.".concat(value), this.config);
+
+ if (!label.length) {
+ return "".concat(value, "p");
+ }
+
+ return label;
+ }
+
+ return toTitleCase(value);
+
+ case 'captions':
+ return captions.getLabel.call(this);
+
+ default:
+ return null;
+ }
+ },
+ // Set the quality menu
+ setQualityMenu: function setQualityMenu(options) {
+ var _this6 = this;
+
+ // Menu required
+ if (!is$1.element(this.elements.settings.panels.quality)) {
+ return;
+ }
+
+ var type = 'quality';
+ var list = this.elements.settings.panels.quality.querySelector('[role="menu"]'); // Set options if passed and filter based on uniqueness and config
+
+ if (is$1.array(options)) {
+ this.options.quality = dedupe(options).filter(function (quality) {
+ return _this6.config.quality.options.includes(quality);
+ });
+ } // Toggle the pane and tab
+
+
+ var toggle = !is$1.empty(this.options.quality) && this.options.quality.length > 1;
+ controls.toggleMenuButton.call(this, type, toggle); // Empty the menu
+
+ emptyElement(list); // Check if we need to toggle the parent
+
+ controls.checkMenu.call(this); // If we're hiding, nothing more to do
+
+ if (!toggle) {
+ return;
+ } // Get the badge HTML for HD, 4K etc
+
+
+ var getBadge = function getBadge(quality) {
+ var label = i18n.get("qualityBadge.".concat(quality), _this6.config);
+
+ if (!label.length) {
+ return null;
+ }
+
+ return controls.createBadge.call(_this6, label);
+ }; // Sort options by the config and then render options
+
+
+ this.options.quality.sort(function (a, b) {
+ var sorting = _this6.config.quality.options;
+ return sorting.indexOf(a) > sorting.indexOf(b) ? 1 : -1;
+ }).forEach(function (quality) {
+ controls.createMenuItem.call(_this6, {
+ value: quality,
+ list: list,
+ type: type,
+ title: controls.getLabel.call(_this6, 'quality', quality),
+ badge: getBadge(quality)
+ });
+ });
+ controls.updateSetting.call(this, type, list);
+ },
+ // Set the looping options
+
+ /* setLoopMenu() {
+ // Menu required
+ if (!is.element(this.elements.settings.panels.loop)) {
+ return;
+ }
+ const options = ['start', 'end', 'all', 'reset'];
+ const list = this.elements.settings.panels.loop.querySelector('[role="menu"]');
+ // Show the pane and tab
+ toggleHidden(this.elements.settings.buttons.loop, false);
+ toggleHidden(this.elements.settings.panels.loop, false);
+ // Toggle the pane and tab
+ const toggle = !is.empty(this.loop.options);
+ controls.toggleMenuButton.call(this, 'loop', toggle);
+ // Empty the menu
+ emptyElement(list);
+ options.forEach(option => {
+ const item = createElement('li');
+ const button = createElement(
+ 'button',
+ extend(getAttributesFromSelector(this.config.selectors.buttons.loop), {
+ type: 'button',
+ class: this.config.classNames.control,
+ 'data-plyr-loop-action': option,
+ }),
+ i18n.get(option, this.config)
+ );
+ if (['start', 'end'].includes(option)) {
+ const badge = controls.createBadge.call(this, '00:00');
+ button.appendChild(badge);
+ }
+ item.appendChild(button);
+ list.appendChild(item);
+ });
+ }, */
+ // Get current selected caption language
+ // TODO: rework this to user the getter in the API?
+ // Set a list of available captions languages
+ setCaptionsMenu: function setCaptionsMenu() {
+ var _this7 = this;
+
+ // Menu required
+ if (!is$1.element(this.elements.settings.panels.captions)) {
+ return;
+ } // TODO: Captions or language? Currently it's mixed
+
+
+ var type = 'captions';
+ var list = this.elements.settings.panels.captions.querySelector('[role="menucaptions"]');
+ var tracks = captions.getTracks.call(this);
+ var toggle = Boolean(tracks.length); // Toggle the pane and tab
+
+ controls.toggleMenuButton.call(this, type, toggle); // Empty the menu
+
+ emptyElement(list); // Check if we need to toggle the parent
+
+ controls.checkMenu.call(this); // If there's no captions, bail
+
+ if (!toggle) {
+ return;
+ } // Generate options data
+
+
+ var options = tracks.map(function (track, value) {
+ return {
+ value: value,
+ checked: _this7.captions.toggled && _this7.currentTrack === value,
+ title: captions.getLabel.call(_this7, track),
+ badge: track.language && controls.createBadge.call(_this7, track.language.toUpperCase()),
+ list: list,
+ type: 'language'
+ };
+ }); // Add the "Disabled" option to turn off captions
+
+ options.unshift({
+ value: -1,
+ checked: !this.captions.toggled,
+ title: i18n.get('disabled', this.config),
+ list: list,
+ type: 'language'
+ }); // Generate options
+
+ options.forEach(controls.createMenuItem.bind(this));
+ controls.updateSetting.call(this, type, list);
+ },
+ // Set a list of available captions languages
+ setSpeedMenu: function setSpeedMenu() {
+ var _this8 = this;
+
+ // Menu required
+ if (!is$1.element(this.elements.settings.panels.speed)) {
+ return;
+ }
+
+ var type = 'speed';
+ var list = this.elements.settings.panels.speed.querySelector('[role="menu"]'); // Filter out invalid speeds
+
+ this.options.speed = this.options.speed.filter(function (o) {
+ return o >= _this8.minimumSpeed && o <= _this8.maximumSpeed;
+ }); // Toggle the pane and tab
+
+ var toggle = !is$1.empty(this.options.speed) && this.options.speed.length > 1;
+ controls.toggleMenuButton.call(this, type, toggle); // Empty the menu
+
+ emptyElement(list); // Check if we need to toggle the parent
+
+ controls.checkMenu.call(this); // If we're hiding, nothing more to do
+
+ if (!toggle) {
+ return;
+ } // Create items
+
+
+ this.options.speed.forEach(function (speed) {
+ controls.createMenuItem.call(_this8, {
+ value: speed,
+ list: list,
+ type: type,
+ title: controls.getLabel.call(_this8, 'speed', speed)
+ });
+ });
+ controls.updateSetting.call(this, type, list);
+ },
+ // Check if we need to hide/show the settings menu
+ checkMenu: function checkMenu() {
+ var buttons = this.elements.settings.buttons;
+ var visible = !is$1.empty(buttons) && Object.values(buttons).some(function (button) {
+ return !button.hidden;
+ });
+ toggleHidden(this.elements.settings.menu, !visible);
+ },
+ // Focus the first menu item in a given (or visible) menu
+ focusFirstMenuItem: function focusFirstMenuItem(pane) {
+ var tabFocus = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
+
+ if (this.elements.settings.popup.hidden) {
+ return;
+ }
+
+ var target = pane;
+
+ if (!is$1.element(target)) {
+ target = Object.values(this.elements.settings.panels).find(function (p) {
+ return !p.hidden;
+ });
+ }
+
+ var firstItem = target.querySelector('[role^="menuitem"]');
+ setFocus.call(this, firstItem, tabFocus);
+ },
+ // Show/hide menu
+ toggleMenu: function toggleMenu(input) {
+ var popup = this.elements.settings.popup;
+ var button = this.elements.buttons.settings; // Menu and button are required
+
+ if (!is$1.element(popup) || !is$1.element(button)) {
+ return;
+ } // True toggle by default
+
+
+ var hidden = popup.hidden;
+ var show = hidden;
+
+ if (is$1.boolean(input)) {
+ show = input;
+ } else if (is$1.keyboardEvent(input) && input.which === 27) {
+ show = false;
+ } else if (is$1.event(input)) {
+ // If Plyr is in a shadowDOM, the event target is set to the component, instead of the
+ // Element in the shadowDOM. The path, if available, is complete.
+ var target = is$1.function(input.composedPath) ? input.composedPath()[0] : input.target;
+ var isMenuItem = popup.contains(target); // If the click was inside the menu or if the click
+ // wasn't the button or menu item and we're trying to
+ // show the menu (a doc click shouldn't show the menu)
+
+ if (isMenuItem || !isMenuItem && input.target !== button && show) {
+ return;
+ }
+ } // Set button attributes
+
+
+ button.setAttribute('aria-expanded', show); // Show the actual popup
+
+ toggleHidden(popup, !show); // Add class hook
+
+ toggleClass(this.elements.container, this.config.classNames.menu.open, show); // Focus the first item if key interaction
+
+ if (show && is$1.keyboardEvent(input)) {
+ controls.focusFirstMenuItem.call(this, null, true);
+ } else if (!show && !hidden) {
+ // If closing, re-focus the button
+ setFocus.call(this, button, is$1.keyboardEvent(input));
+ }
+ },
+ // Get the natural size of a menu panel
+ getMenuSize: function getMenuSize(tab) {
+ var clone = tab.cloneNode(true);
+ clone.style.position = 'absolute';
+ clone.style.opacity = 0;
+ clone.removeAttribute('hidden'); // Append to parent so we get the "real" size
+
+ tab.parentNode.appendChild(clone); // Get the sizes before we remove
+
+ var width = clone.scrollWidth;
+ var height = clone.scrollHeight; // Remove from the DOM
+
+ removeElement(clone);
+ return {
+ width: width,
+ height: height
+ };
+ },
+ // Show a panel in the menu
+ showMenuPanel: function showMenuPanel() {
+ var _this9 = this;
+
+ var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
+ var tabFocus = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
+ var target = this.elements.container.querySelector("#plyr-settings-".concat(this.id, "-").concat(type)); // Nothing to show, bail
+
+ if (!is$1.element(target)) {
+ return;
+ } // Hide all other panels
+
+
+ var container = target.parentNode;
+ var current = Array.from(container.children).find(function (node) {
+ return !node.hidden;
+ }); // If we can do fancy animations, we'll animate the height/width
+
+ if (support.transitions && !support.reducedMotion) {
+ // Set the current width as a base
+ container.style.width = "".concat(current.scrollWidth, "px");
+ container.style.height = "".concat(current.scrollHeight, "px"); // Get potential sizes
+
+ var size = controls.getMenuSize.call(this, target); // Restore auto height/width
+
+ var restore = function restore(event) {
+ // We're only bothered about height and width on the container
+ if (event.target !== container || !['width', 'height'].includes(event.propertyName)) {
+ return;
+ } // Revert back to auto
+
+
+ container.style.width = '';
+ container.style.height = ''; // Only listen once
+
+ off.call(_this9, container, transitionEndEvent, restore);
+ }; // Listen for the transition finishing and restore auto height/width
+
+
+ on.call(this, container, transitionEndEvent, restore); // Set dimensions to target
+
+ container.style.width = "".concat(size.width, "px");
+ container.style.height = "".concat(size.height, "px");
+ } // Set attributes on current tab
+
+
+ toggleHidden(current, true); // Set attributes on target
+
+ toggleHidden(target, false); // Focus the first item
+
+ controls.focusFirstMenuItem.call(this, target, tabFocus);
+ },
+ // Set the download URL
+ setDownloadUrl: function setDownloadUrl() {
+ var button = this.elements.buttons.download; // Bail if no button
+
+ if (!is$1.element(button)) {
+ return;
+ } // Set attribute
+
+
+ button.setAttribute('href', this.download);
+ },
+ // Build the default HTML
+ create: function create(data) {
+ var _this10 = this;
+
+ var bindMenuItemShortcuts = controls.bindMenuItemShortcuts,
+ createButton = controls.createButton,
+ createProgress = controls.createProgress,
+ createRange = controls.createRange,
+ createTime = controls.createTime,
+ setQualityMenu = controls.setQualityMenu,
+ setSpeedMenu = controls.setSpeedMenu,
+ showMenuPanel = controls.showMenuPanel;
+ this.elements.controls = null; // Larger overlaid play button
+
+ if (is$1.array(this.config.controls) && this.config.controls.includes('play-large')) {
+ this.elements.container.appendChild(createButton.call(this, 'play-large'));
+ } // Create the container
+
+
+ var container = createElement('div', getAttributesFromSelector(this.config.selectors.controls.wrapper));
+ this.elements.controls = container; // Default item attributes
+
+ var defaultAttributes = {
+ class: 'plyr__controls__item'
+ }; // Loop through controls in order
+
+ dedupe(is$1.array(this.config.controls) ? this.config.controls : []).forEach(function (control) {
+ // Restart button
+ if (control === 'restart') {
+ container.appendChild(createButton.call(_this10, 'restart', defaultAttributes));
+ } // Rewind button
+
+
+ if (control === 'rewind') {
+ container.appendChild(createButton.call(_this10, 'rewind', defaultAttributes));
+ } // Play/Pause button
+
+
+ if (control === 'play') {
+ container.appendChild(createButton.call(_this10, 'play', defaultAttributes));
+ } // Fast forward button
+
+
+ if (control === 'fast-forward') {
+ container.appendChild(createButton.call(_this10, 'fast-forward', defaultAttributes));
+ } // Progress
+
+
+ if (control === 'progress') {
+ var progressContainer = createElement('div', {
+ class: "".concat(defaultAttributes.class, " plyr__progress__container")
+ });
+ var progress = createElement('div', getAttributesFromSelector(_this10.config.selectors.progress)); // Seek range slider
+
+ progress.appendChild(createRange.call(_this10, 'seek', {
+ id: "plyr-seek-".concat(data.id)
+ })); // Buffer progress
+
+ progress.appendChild(createProgress.call(_this10, 'buffer')); // TODO: Add loop display indicator
+ // Seek tooltip
+
+ if (_this10.config.tooltips.seek) {
+ var tooltip = createElement('span', {
+ class: _this10.config.classNames.tooltip
+ }, '00:00');
+ progress.appendChild(tooltip);
+ _this10.elements.display.seekTooltip = tooltip;
+ }
+
+ _this10.elements.progress = progress;
+ progressContainer.appendChild(_this10.elements.progress);
+ container.appendChild(progressContainer);
+ } // Media current time display
+
+
+ if (control === 'current-time') {
+ container.appendChild(createTime.call(_this10, 'currentTime', defaultAttributes));
+ } // Media duration display
+
+
+ if (control === 'duration') {
+ container.appendChild(createTime.call(_this10, 'duration', defaultAttributes));
+ } // Volume controls
+
+
+ if (control === 'mute' || control === 'volume') {
+ var volume = _this10.elements.volume; // Create the volume container if needed
+
+ if (!is$1.element(volume) || !container.contains(volume)) {
+ volume = createElement('div', extend({}, defaultAttributes, {
+ class: "".concat(defaultAttributes.class, " plyr__volume").trim()
+ }));
+ _this10.elements.volume = volume;
+ container.appendChild(volume);
+ } // Toggle mute button
+
+
+ if (control === 'mute') {
+ volume.appendChild(createButton.call(_this10, 'mute'));
+ } // Volume range control
+ // Ignored on iOS as it's handled globally
+ // https://developer.apple.com/library/safari/documentation/AudioVideo/Conceptual/Using_HTML5_Audio_Video/Device-SpecificConsiderations/Device-SpecificConsiderations.html
+
+
+ if (control === 'volume' && !browser.isIos) {
+ // Set the attributes
+ var attributes = {
+ max: 1,
+ step: 0.05,
+ value: _this10.config.volume
+ }; // Create the volume range slider
+
+ volume.appendChild(createRange.call(_this10, 'volume', extend(attributes, {
+ id: "plyr-volume-".concat(data.id)
+ })));
+ }
+ } // Toggle captions button
+
+
+ if (control === 'captions') {
+ container.appendChild(createButton.call(_this10, 'captions', defaultAttributes));
+ } // Settings button / menu
+
+
+ if (control === 'settings' && !is$1.empty(_this10.config.settings)) {
+ var wrapper = createElement('div', extend({}, defaultAttributes, {
+ class: "".concat(defaultAttributes.class, " plyr__menu").trim(),
+ hidden: ''
+ }));
+ wrapper.appendChild(createButton.call(_this10, 'settings', {
+ 'aria-haspopup': true,
+ 'aria-controls': "plyr-settings-".concat(data.id),
+ 'aria-expanded': false
+ }));
+ var popup = createElement('div', {
+ class: 'plyr__menu__container',
+ id: "plyr-settings-".concat(data.id),
+ hidden: ''
+ });
+ var inner = createElement('div');
+ var home = createElement('div', {
+ id: "plyr-settings-".concat(data.id, "-home")
+ }); // Create the menu
+
+ var menu = createElement('div', {
+ role: 'menu'
+ });
+ home.appendChild(menu);
+ inner.appendChild(home);
+ _this10.elements.settings.panels.home = home; // Build the menu items
+
+ _this10.config.settings.forEach(function (type) {
+ // TODO: bundle this with the createMenuItem helper and bindings
+ var menuItem = createElement('button', extend(getAttributesFromSelector(_this10.config.selectors.buttons.settings), {
+ type: 'button',
+ class: "".concat(_this10.config.classNames.control, " ").concat(_this10.config.classNames.control, "--forward"),
+ role: 'menuitem',
+ 'aria-haspopup': true,
+ hidden: ''
+ })); // Bind menu shortcuts for keyboard users
+
+ bindMenuItemShortcuts.call(_this10, menuItem, type); // Show menu on click
+
+ on.call(_this10, menuItem, 'click', function () {
+ showMenuPanel.call(_this10, type, false);
+ });
+ var flex = createElement('span', null, i18n.get(type, _this10.config));
+ var value = createElement('span', {
+ class: _this10.config.classNames.menu.value
+ }); // Speed contains HTML entities
+
+ value.innerHTML = data[type];
+ flex.appendChild(value);
+ menuItem.appendChild(flex);
+ menu.appendChild(menuItem); // Build the panes
+
+ var pane = createElement('div', {
+ id: "plyr-settings-".concat(data.id, "-").concat(type),
+ hidden: ''
+ }); // Back button
+
+ var backButton = createElement('button', {
+ type: 'button',
+ class: "".concat(_this10.config.classNames.control, " ").concat(_this10.config.classNames.control, "--back")
+ }); // Visible label
+
+ backButton.appendChild(createElement('span', {
+ 'aria-hidden': true
+ }, i18n.get(type, _this10.config))); // Screen reader label
+
+ backButton.appendChild(createElement('span', {
+ class: _this10.config.classNames.hidden
+ }, i18n.get('menuBack', _this10.config))); // Go back via keyboard
+
+ on.call(_this10, pane, 'keydown', function (event) {
+ // We only care about <-
+ if (event.which !== 37) {
+ return;
+ } // Prevent seek
+
+
+ event.preventDefault();
+ event.stopPropagation(); // Show the respective menu
+
+ showMenuPanel.call(_this10, 'home', true);
+ }, false); // Go back via button click
+
+ on.call(_this10, backButton, 'click', function () {
+ showMenuPanel.call(_this10, 'home', false);
+ }); // Add to pane
+
+ pane.appendChild(backButton); // Menu
+
+ pane.appendChild(createElement('div', {
+ role: 'menu'
+ })); // Menu Captions
+
+ pane.appendChild(createElement('div', {
+ role: 'menucaptions'
+ }));
+ inner.appendChild(pane);
+ _this10.elements.settings.buttons[type] = menuItem;
+ _this10.elements.settings.panels[type] = pane;
+ });
+
+ popup.appendChild(inner);
+ wrapper.appendChild(popup);
+ container.appendChild(wrapper);
+ _this10.elements.settings.popup = popup;
+ _this10.elements.settings.menu = wrapper;
+ } // Picture in picture button
+
+
+ if (control === 'pip' && support.pip) {
+ container.appendChild(createButton.call(_this10, 'pip', defaultAttributes));
+ } // Airplay button
+
+
+ if (control === 'airplay' && support.airplay) {
+ container.appendChild(createButton.call(_this10, 'airplay', defaultAttributes));
+ } // Download button
+
+
+ if (control === 'download') {
+ var _attributes = extend({}, defaultAttributes, {
+ element: 'a',
+ href: _this10.download,
+ target: '_blank'
+ }); // Set download attribute for HTML5 only
+
+
+ if (_this10.isHTML5) {
+ _attributes.download = '';
+ }
+
+ var download = _this10.config.urls.download;
+
+ if (!is$1.url(download) && _this10.isEmbed) {
+ extend(_attributes, {
+ icon: "logo-".concat(_this10.provider),
+ label: _this10.provider
+ });
+ }
+
+ container.appendChild(createButton.call(_this10, 'download', _attributes));
+ } // Toggle fullscreen button
+
+
+ if (control === 'fullscreen') {
+ container.appendChild(createButton.call(_this10, 'fullscreen', defaultAttributes));
+ }
+ }); // Set available quality levels
+
+ if (this.isHTML5) {
+ setQualityMenu.call(this, html5.getQualityOptions.call(this));
+ }
+
+ setSpeedMenu.call(this);
+ return container;
+ },
+ // Insert controls
+ inject: function inject() {
+ var _this11 = this;
+
+ // Sprite
+ if (this.config.loadSprite) {
+ var icon = controls.getIconUrl.call(this); // Only load external sprite using AJAX
+
+ if (icon.cors) {
+ loadSprite(icon.url, 'sprite-plyr');
+ }
+ } // Create a unique ID
+
+
+ this.id = Math.floor(Math.random() * 10000); // Null by default
+
+ var container = null;
+ this.elements.controls = null; // Set template properties
+
+ var props = {
+ id: this.id,
+ seektime: this.config.seekTime,
+ title: this.config.title
+ };
+ var update = true; // If function, run it and use output
+
+ if (is$1.function(this.config.controls)) {
+ this.config.controls = this.config.controls.call(this, props);
+ } // Convert falsy controls to empty array (primarily for empty strings)
+
+
+ if (!this.config.controls) {
+ this.config.controls = [];
+ }
+
+ if (is$1.element(this.config.controls) || is$1.string(this.config.controls)) {
+ // HTMLElement or Non-empty string passed as the option
+ container = this.config.controls;
+ } else {
+ // Create controls
+ container = controls.create.call(this, {
+ id: this.id,
+ seektime: this.config.seekTime,
+ speed: this.speed,
+ quality: this.quality,
+ captions: captions.getLabel.call(this) // TODO: Looping
+ // loop: 'None',
+
+ });
+ update = false;
+ } // Replace props with their value
+
+
+ var replace = function replace(input) {
+ var result = input;
+ Object.entries(props).forEach(function (_ref2) {
+ var _ref3 = _slicedToArray(_ref2, 2),
+ key = _ref3[0],
+ value = _ref3[1];
+
+ result = replaceAll(result, "{".concat(key, "}"), value);
+ });
+ return result;
+ }; // Update markup
+
+
+ if (update) {
+ if (is$1.string(this.config.controls)) {
+ container = replace(container);
+ }
+ } // Controls container
+
+
+ var target; // Inject to custom location
+
+ if (is$1.string(this.config.selectors.controls.container)) {
+ target = document.querySelector(this.config.selectors.controls.container);
+ } // Inject into the container by default
+
+
+ if (!is$1.element(target)) {
+ target = this.elements.container;
+ } // Inject controls HTML (needs to be before captions, hence "afterbegin")
+
+
+ var insertMethod = is$1.element(container) ? 'insertAdjacentElement' : 'insertAdjacentHTML';
+ target[insertMethod]('afterbegin', container); // Find the elements if need be
+
+ if (!is$1.element(this.elements.controls)) {
+ controls.findElements.call(this);
+ } // Add pressed property to buttons
+
+
+ if (!is$1.empty(this.elements.buttons)) {
+ var addProperty = function addProperty(button) {
+ var className = _this11.config.classNames.controlPressed;
+ Object.defineProperty(button, 'pressed', {
+ enumerable: true,
+ get: function get() {
+ return hasClass(button, className);
+ },
+ set: function set() {
+ var pressed = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
+ toggleClass(button, className, pressed);
+ }
+ });
+ }; // Toggle classname when pressed property is set
+
+
+ Object.values(this.elements.buttons).filter(Boolean).forEach(function (button) {
+ if (is$1.array(button) || is$1.nodeList(button)) {
+ Array.from(button).filter(Boolean).forEach(addProperty);
+ } else {
+ addProperty(button);
+ }
+ });
+ } // Edge sometimes doesn't finish the paint so force a repaint
+
+
+ if (browser.isEdge) {
+ repaint(target);
+ } // Setup tooltips
+
+
+ if (this.config.tooltips.controls) {
+ var _this$config = this.config,
+ classNames = _this$config.classNames,
+ selectors = _this$config.selectors;
+ var selector = "".concat(selectors.controls.wrapper, " ").concat(selectors.labels, " .").concat(classNames.hidden);
+ var labels = getElements.call(this, selector);
+ Array.from(labels).forEach(function (label) {
+ toggleClass(label, _this11.config.classNames.hidden, false);
+ toggleClass(label, _this11.config.classNames.tooltip, true);
+ });
+ }
+ }
+};
+
+/**
+ * Parse a string to a URL object
+ * @param {String} input - the URL to be parsed
+ * @param {Boolean} safe - failsafe parsing
+ */
+
+function parseUrl(input) {
+ var safe = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
+ var url = input;
+
+ if (safe) {
+ var parser = document.createElement('a');
+ parser.href = url;
+ url = parser.href;
+ }
+
+ try {
+ return new URL(url);
+ } catch (e) {
+ return null;
+ }
+} // Convert object to URLSearchParams
+
+function buildUrlParams(input) {
+ var params = new URLSearchParams();
+
+ if (is$1.object(input)) {
+ Object.entries(input).forEach(function (_ref) {
+ var _ref2 = _slicedToArray(_ref, 2),
+ key = _ref2[0],
+ value = _ref2[1];
+
+ params.set(key, value);
+ });
+ }
+
+ return params;
+}
+
+var captions = {
+ // Setup captions
+ setup: function setup() {
+ // Requires UI support
+ if (!this.supported.ui) {
+ return;
+ } // Only Vimeo and HTML5 video supported at this point
+
+
+ if (!this.isVideo || this.isYouTube || this.isHTML5 && !support.textTracks) {
+ // Clear menu and hide
+ if (is$1.array(this.config.controls) && this.config.controls.includes('settings') && this.config.settings.includes('captions')) {
+ controls.setCaptionsMenu.call(this);
+ }
+
+ return;
+ } // Inject the container
+
+
+ if (!is$1.element(this.elements.captions)) {
+ this.elements.captions = createElement('div', getAttributesFromSelector(this.config.selectors.captions));
+ insertAfter(this.elements.captions, this.elements.wrapper);
+ } // Fix IE captions if CORS is used
+ // Fetch captions and inject as blobs instead (data URIs not supported!)
+
+
+ if (browser.isIE && window.URL) {
+ var elements = this.media.querySelectorAll('track');
+ Array.from(elements).forEach(function (track) {
+ var src = track.getAttribute('src');
+ var url = parseUrl(src);
+
+ if (url !== null && url.hostname !== window.location.href.hostname && ['http:', 'https:'].includes(url.protocol)) {
+ fetch(src, 'blob').then(function (blob) {
+ track.setAttribute('src', window.URL.createObjectURL(blob));
+ }).catch(function () {
+ removeElement(track);
+ });
+ }
+ });
+ } // Get and set initial data
+ // The "preferred" options are not realized unless / until the wanted language has a match
+ // * languages: Array of user's browser languages.
+ // * language: The language preferred by user settings or config
+ // * active: The state preferred by user settings or config
+ // * toggled: The real captions state
+
+
+ var browserLanguages = navigator.languages || [navigator.language || navigator.userLanguage || 'en'];
+ var languages = dedupe(browserLanguages.map(function (language) {
+ return language.split('-')[0];
+ }));
+ var language = (this.storage.get('language') || this.config.captions.language || 'auto').toLowerCase(); // Use first browser language when language is 'auto'
+
+ if (language === 'auto') {
+ var _languages = _slicedToArray(languages, 1);
+
+ language = _languages[0];
+ }
+
+ var active = this.storage.get('captions');
+
+ if (!is$1.boolean(active)) {
+ active = this.config.captions.active;
+ }
+
+ Object.assign(this.captions, {
+ toggled: false,
+ active: active,
+ language: language,
+ languages: languages
+ }); // Watch changes to textTracks and update captions menu
+
+ if (this.isHTML5) {
+ var trackEvents = this.config.captions.update ? 'addtrack removetrack' : 'removetrack';
+ on.call(this, this.media.textTracks, trackEvents, captions.update.bind(this));
+ } // Update available languages in list next tick (the event must not be triggered before the listeners)
+
+
+ setTimeout(captions.update.bind(this), 0);
+ },
+ // Update available language options in settings based on tracks
+ update: function update() {
+ var _this = this;
+
+ var tracks = captions.getTracks.call(this, true); // Get the wanted language
+
+ var _this$captions = this.captions,
+ active = _this$captions.active,
+ language = _this$captions.language,
+ meta = _this$captions.meta,
+ currentTrackNode = _this$captions.currentTrackNode;
+ var languageExists = Boolean(tracks.find(function (track) {
+ return track.language === language;
+ })); // Handle tracks (add event listener and "pseudo"-default)
+
+ if (this.isHTML5 && this.isVideo) {
+ tracks.filter(function (track) {
+ return !meta.get(track);
+ }).forEach(function (track) {
+ _this.debug.log('Track added', track); // Attempt to store if the original dom element was "default"
+
+
+ meta.set(track, {
+ default: track.mode === 'showing'
+ }); // Turn off native caption rendering to avoid double captions
+ // Note: mode='hidden' forces a track to download. To ensure every track
+ // isn't downloaded at once, only 'showing' tracks should be reassigned
+ // eslint-disable-next-line no-param-reassign
+
+ if (track.mode === 'showing') {
+ // eslint-disable-next-line no-param-reassign
+ track.mode = 'hidden';
+ } // Add event listener for cue changes
+
+
+ on.call(_this, track, 'cuechange', function () {
+ return captions.updateCues.call(_this);
+ });
+ });
+ } // Update language first time it matches, or if the previous matching track was removed
+
+
+ if (languageExists && this.language !== language || !tracks.includes(currentTrackNode)) {
+ captions.setLanguage.call(this, language);
+ captions.toggle.call(this, active && languageExists);
+ } // Enable or disable captions based on track length
+
+
+ toggleClass(this.elements.container, this.config.classNames.captions.enabled, !is$1.empty(tracks)); // Update available languages in list
+
+ if (is$1.array(this.config.controls) && this.config.controls.includes('settings') && this.config.settings.includes('captions')) {
+ controls.setCaptionsMenu.call(this);
+ }
+ },
+ // Toggle captions display
+ // Used internally for the toggleCaptions method, with the passive option forced to false
+ toggle: function toggle(input) {
+ var _this2 = this;
+
+ var passive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
+
+ // If there's no full support
+ if (!this.supported.ui) {
+ return;
+ }
+
+ var toggled = this.captions.toggled; // Current state
+
+ var activeClass = this.config.classNames.captions.active; // Get the next state
+ // If the method is called without parameter, toggle based on current value
+
+ var active = is$1.nullOrUndefined(input) ? !toggled : input; // Update state and trigger event
+
+ if (active !== toggled) {
+ // When passive, don't override user preferences
+ if (!passive) {
+ this.captions.active = active;
+ this.storage.set({
+ captions: active
+ });
+ } // Force language if the call isn't passive and there is no matching language to toggle to
+
+
+ if (!this.language && active && !passive) {
+ var tracks = captions.getTracks.call(this);
+ 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
+
+ this.captions.language = track.language; // Set caption, but don't store in localStorage as user preference
+
+ captions.set.call(this, tracks.indexOf(track));
+ return;
+ } // Toggle button if it's enabled
+
+
+ if (this.elements.buttons.captions) {
+ this.elements.buttons.captions.pressed = active;
+ } // Add class hook
+
+
+ toggleClass(this.elements.container, activeClass, active);
+ this.captions.toggled = active; // Update settings menu
+
+ controls.updateSetting.call(this, 'captions'); // Trigger event (not used internally)
+
+ triggerEvent.call(this, this.media, active ? 'captionsenabled' : 'captionsdisabled');
+ } // Wait for the call stack to clear before setting mode='hidden'
+ // on the active track - forcing the browser to download it
+
+
+ setTimeout(function () {
+ if (active && _this2.captions.toggled) {
+ _this2.captions.currentTrackNode.mode = 'hidden';
+ }
+ });
+ },
+ // Set captions by track index
+ // Used internally for the currentTrack setter with the passive option forced to false
+ set: function set(index) {
+ var passive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
+ var tracks = captions.getTracks.call(this); // Disable captions if setting to -1
+
+ if (index === -1) {
+ captions.toggle.call(this, false, passive);
+ return;
+ }
+
+ if (!is$1.number(index)) {
+ this.debug.warn('Invalid caption argument', index);
+ return;
+ }
+
+ if (!(index in tracks)) {
+ this.debug.warn('Track not found', index);
+ return;
+ }
+
+ if (this.captions.currentTrack !== index) {
+ this.captions.currentTrack = index;
+ var track = tracks[index];
+
+ var _ref = track || {},
+ language = _ref.language; // Store reference to node for invalidation on remove
+
+
+ this.captions.currentTrackNode = track; // Update settings menu
+
+ controls.updateSetting.call(this, 'captions'); // When passive, don't override user preferences
+
+ if (!passive) {
+ this.captions.language = language;
+ this.storage.set({
+ language: language
+ });
+ } // Handle Vimeo captions
+
+
+ if (this.isVimeo) {
+ this.embed.enableTextTrack(language);
+ } // Trigger event
+
+
+ triggerEvent.call(this, this.media, 'languagechange');
+ } // Show captions
+
+
+ captions.toggle.call(this, true, passive);
+
+ if (this.isHTML5 && this.isVideo) {
+ // If we change the active track while a cue is already displayed we need to update it
+ captions.updateCues.call(this);
+ }
+ },
+ // Set captions by language
+ // Used internally for the language setter with the passive option forced to false
+ setLanguage: function setLanguage(input) {
+ var passive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
+
+ if (!is$1.string(input)) {
+ this.debug.warn('Invalid language argument', input);
+ return;
+ } // Normalize
+
+
+ var language = input.toLowerCase();
+ this.captions.language = language; // Set currentTrack
+
+ var tracks = captions.getTracks.call(this);
+ var track = captions.findTrack.call(this, [language]);
+ captions.set.call(this, tracks.indexOf(track), passive);
+ },
+ // Get current valid caption tracks
+ // If update is false it will also ignore tracks without metadata
+ // This is used to "freeze" the language options when captions.update is false
+ getTracks: function getTracks() {
+ var _this3 = this;
+
+ var update = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
+ // Handle media or textTracks missing or null
+ var tracks = Array.from((this.media || {}).textTracks || []); // For HTML5, use cache instead of current tracks when it exists (if captions.update is false)
+ // Filter out removed tracks and tracks that aren't captions/subtitles (for example metadata)
+
+ return tracks.filter(function (track) {
+ return !_this3.isHTML5 || update || _this3.captions.meta.has(track);
+ }).filter(function (track) {
+ return ['captions', 'subtitles'].includes(track.kind);
+ });
+ },
+ // Match tracks based on languages and get the first
+ findTrack: function findTrack(languages) {
+ var _this4 = this;
+
+ var force = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
+ var tracks = captions.getTracks.call(this);
+
+ var sortIsDefault = function sortIsDefault(track) {
+ return Number((_this4.captions.meta.get(track) || {}).default);
+ };
+
+ var sorted = Array.from(tracks).sort(function (a, b) {
+ return sortIsDefault(b) - sortIsDefault(a);
+ });
+ var track;
+ languages.every(function (language) {
+ track = sorted.find(function (t) {
+ return t.language === language;
+ });
+ return !track; // Break iteration if there is a match
+ }); // If no match is found but is required, get first
+
+ return track || (force ? sorted[0] : undefined);
+ },
+ // Get the current track
+ getCurrentTrack: function getCurrentTrack() {
+ return captions.getTracks.call(this)[this.currentTrack];
+ },
+ // Get UI label for track
+ getLabel: function getLabel(track) {
+ var currentTrack = track;
+
+ if (!is$1.track(currentTrack) && support.textTracks && this.captions.toggled) {
+ currentTrack = captions.getCurrentTrack.call(this);
+ }
+
+ if (is$1.track(currentTrack)) {
+ if (!is$1.empty(currentTrack.label)) {
+ return currentTrack.label;
+ }
+
+ if (!is$1.empty(currentTrack.language)) {
+ return track.language.toUpperCase();
+ }
+
+ return i18n.get('enabled', this.config);
+ }
+
+ return i18n.get('disabled', this.config);
+ },
+ // Update captions using current track's active cues
+ // Also optional array argument in case there isn't any track (ex: vimeo)
+ updateCues: function updateCues(input) {
+ // Requires UI
+ if (!this.supported.ui) {
+ return;
+ }
+
+ if (!is$1.element(this.elements.captions)) {
+ this.debug.warn('No captions element to render to');
+ return;
+ } // Only accept array or empty input
+
+
+ if (!is$1.nullOrUndefined(input) && !Array.isArray(input)) {
+ this.debug.warn('updateCues: Invalid input', input);
+ return;
+ }
+
+ var cues = input; // Get cues from track
+
+ if (!cues) {
+ var track = captions.getCurrentTrack.call(this);
+ cues = Array.from((track || {}).activeCues || []).map(function (cue) {
+ return cue.getCueAsHTML();
+ }).map(getHTML);
+ } // Set new caption text
+
+
+ var content = cues.map(function (cueText) {
+ return cueText.trim();
+ }).join('\n');
+ var changed = content !== this.elements.captions.innerHTML;
+
+ if (changed) {
+ // Empty the container and create a new child element
+ emptyElement(this.elements.captions);
+ var caption = createElement('span', getAttributesFromSelector(this.config.selectors.caption));
+ caption.innerHTML = content;
+ this.elements.captions.appendChild(caption); // Trigger event
+
+ triggerEvent.call(this, this.media, 'cuechange');
+ }
+ }
+};
+
+// ==========================================================================
+// Plyr default config
+// ==========================================================================
+var defaults$1 = {
+ // Disable
+ enabled: true,
+ // Custom media title
+ title: '',
+ // Logging to console
+ debug: false,
+ // Auto play (if supported)
+ autoplay: false,
+ // Only allow one media playing at once (vimeo only)
+ autopause: true,
+ // Allow inline playback on iOS (this effects YouTube/Vimeo - HTML5 requires the attribute present)
+ // TODO: Remove iosNative fullscreen option in favour of this (logic needs work)
+ playsinline: true,
+ // Default time to skip when rewind/fast forward
+ seekTime: 10,
+ // Default volume
+ volume: 1,
+ muted: false,
+ // Pass a custom duration
+ duration: null,
+ // Display the media duration on load in the current time position
+ // If you have opted to display both duration and currentTime, this is ignored
+ displayDuration: true,
+ // Invert the current time to be a countdown
+ invertTime: true,
+ // Clicking the currentTime inverts it's value to show time left rather than elapsed
+ toggleInvert: true,
+ // Force an aspect ratio
+ // The format must be `'w:h'` (e.g. `'16:9'`)
+ ratio: null,
+ // Click video container to play/pause
+ clickToPlay: true,
+ // Auto hide the controls
+ hideControls: true,
+ // Reset to start when playback ended
+ resetOnEnd: false,
+ // Disable the standard context menu
+ disableContextMenu: true,
+ // Sprite (for icons)
+ loadSprite: true,
+ iconPrefix: 'plyr',
+ iconUrl: '/theme/modules/plyr/plyr.svg',
+ // Blank video (used to prevent errors on source change)
+ blankVideo: '/theme/modules/plyr/blank.webm',
+ // Quality default
+ quality: {
+ default: 576,
+ // The options to display in the UI, if available for the source media
+ options: [4320, 2880, 2160, 1440, 1080, 720, 576, 480, 360, 240],
+ forced: false,
+ onChange: null
+ },
+ // Set loops
+ loop: {
+ active: false // start: null,
+ // end: null,
+
+ },
+ // Speed default and options to display
+ speed: {
+ selected: 1,
+ // The options to display in the UI, if available for the source media (e.g. Vimeo and YouTube only support 0.5x-4x)
+ options: [0.5, 0.75, 1, 1.25, 1.5, 1.75, 2, 4]
+ },
+ // Keyboard shortcut settings
+ keyboard: {
+ focused: true,
+ global: false
+ },
+ // Display tooltips
+ tooltips: {
+ controls: false,
+ seek: true
+ },
+ // Captions settings
+ captions: {
+ active: false,
+ language: 'auto',
+ // Listen to new tracks added after Plyr is initialized.
+ // This is needed for streaming captions, but may result in unselectable options
+ update: false
+ },
+ // Fullscreen settings
+ fullscreen: {
+ enabled: true,
+ // Allow fullscreen?
+ fallback: true,
+ // Fallback using full viewport/window
+ iosNative: false // Use the native fullscreen in iOS (disables custom controls)
+ // Selector for the fullscreen container so contextual / non-player content can remain visible in fullscreen mode
+ // Non-ancestors of the player element will be ignored
+ // container: null, // defaults to the player element
+
+ },
+ // Local storage
+ storage: {
+ enabled: true,
+ key: 'plyr'
+ },
+ // Default controls
+ controls: ['play-large', // 'restart',
+ // 'rewind',
+ 'play', // 'fast-forward',
+ 'progress', 'current-time', // 'duration',
+ 'mute', 'volume', 'captions', 'settings', 'pip', 'airplay', // 'download',
+ 'fullscreen'],
+ settings: ['captions', 'quality', 'speed'],
+ // Localisation
+ i18n: {
+ restart: 'Restart',
+ rewind: 'Rewind {seektime}s',
+ play: 'Play',
+ pause: 'Pause',
+ fastForward: 'Forward {seektime}s',
+ seek: 'Seek',
+ seekLabel: '{currentTime} of {duration}',
+ played: 'Played',
+ buffered: 'Buffered',
+ currentTime: 'Current time',
+ duration: 'Duration',
+ volume: 'Volume',
+ mute: 'Mute',
+ unmute: 'Unmute',
+ enableCaptions: 'Enable captions',
+ disableCaptions: 'Disable captions',
+ download: 'Download',
+ enterFullscreen: 'Enter fullscreen',
+ exitFullscreen: 'Exit fullscreen',
+ frameTitle: 'Player for {title}',
+ captions: 'Captions',
+ settings: 'Settings',
+ pip: 'PIP',
+ menuBack: 'Go back to previous menu',
+ speed: 'Speed',
+ normal: 'Normal',
+ quality: 'Quality',
+ loop: 'Loop',
+ start: 'Start',
+ end: 'End',
+ all: 'All',
+ reset: 'Reset',
+ disabled: 'Disabled',
+ enabled: 'Enabled',
+ advertisement: 'Ad',
+ qualityBadge: {
+ 2160: '4K',
+ 1440: 'HD',
+ 1080: 'HD',
+ 720: 'HD',
+ 576: 'SD',
+ 480: 'SD'
+ }
+ },
+ // URLs
+ urls: {
+ download: null,
+ vimeo: {
+ sdk: 'https://player.vimeo.com/api/player.js',
+ iframe: 'https://player.vimeo.com/video/{0}?{1}',
+ api: 'https://vimeo.com/api/v2/video/{0}.json'
+ },
+ youtube: {
+ sdk: 'https://www.youtube.com/iframe_api',
+ api: 'https://noembed.com/embed?url=https://www.youtube.com/watch?v={0}'
+ },
+ googleIMA: {
+ sdk: 'https://imasdk.googleapis.com/js/sdkloader/ima3.js'
+ }
+ },
+ // Custom control listeners
+ listeners: {
+ seek: null,
+ play: null,
+ pause: null,
+ restart: null,
+ rewind: null,
+ fastForward: null,
+ mute: null,
+ volume: null,
+ captions: null,
+ download: null,
+ fullscreen: null,
+ pip: null,
+ airplay: null,
+ speed: null,
+ quality: null,
+ loop: null,
+ language: null
+ },
+ // Events to watch and bubble
+ events: [// Events to watch on HTML5 media elements and bubble
+ // https://developer.mozilla.org/en/docs/Web/Guide/Events/Media_events
+ 'ended', 'progress', 'stalled', 'playing', 'waiting', 'canplay', 'canplaythrough', 'loadstart', 'loadeddata', 'loadedmetadata', 'timeupdate', 'volumechange', 'play', 'pause', 'error', 'seeking', 'seeked', 'emptied', 'ratechange', 'cuechange', // Custom events
+ 'download', 'enterfullscreen', 'exitfullscreen', 'captionsenabled', 'captionsdisabled', 'languagechange', 'controlshidden', 'controlsshown', 'ready', // YouTube
+ 'statechange', // Quality
+ 'qualitychange', // Ads
+ 'adsloaded', 'adscontentpause', 'adscontentresume', 'adstarted', 'adsmidpoint', 'adscomplete', 'adsallcomplete', 'adsimpression', 'adsclick'],
+ // Selectors
+ // Change these to match your template if using custom HTML
+ selectors: {
+ editable: 'input, textarea, select, [contenteditable]',
+ container: '.plyr',
+ controls: {
+ container: null,
+ wrapper: '.plyr__controls'
+ },
+ labels: '[data-plyr]',
+ buttons: {
+ play: '[data-plyr="play"]',
+ pause: '[data-plyr="pause"]',
+ restart: '[data-plyr="restart"]',
+ rewind: '[data-plyr="rewind"]',
+ fastForward: '[data-plyr="fast-forward"]',
+ mute: '[data-plyr="mute"]',
+ captions: '[data-plyr="captions"]',
+ download: '[data-plyr="download"]',
+ fullscreen: '[data-plyr="fullscreen"]',
+ pip: '[data-plyr="pip"]',
+ airplay: '[data-plyr="airplay"]',
+ settings: '[data-plyr="settings"]',
+ loop: '[data-plyr="loop"]'
+ },
+ inputs: {
+ seek: '[data-plyr="seek"]',
+ volume: '[data-plyr="volume"]',
+ speed: '[data-plyr="speed"]',
+ language: '[data-plyr="language"]',
+ quality: '[data-plyr="quality"]'
+ },
+ display: {
+ currentTime: '.plyr__time--current',
+ duration: '.plyr__time--duration',
+ buffer: '.plyr__progress__buffer',
+ loop: '.plyr__progress__loop',
+ // Used later
+ volume: '.plyr__volume--display'
+ },
+ progress: '.plyr__progress',
+ captions: '.plyr__captions',
+ caption: '.plyr__caption'
+ },
+ // Class hooks added to the player in different states
+ classNames: {
+ type: 'plyr--{0}',
+ provider: 'plyr--{0}',
+ video: 'plyr__video-wrapper',
+ embed: 'plyr__video-embed',
+ videoFixedRatio: 'plyr__video-wrapper--fixed-ratio',
+ embedContainer: 'plyr__video-embed__container',
+ poster: 'plyr__poster',
+ posterEnabled: 'plyr__poster-enabled',
+ ads: 'plyr__ads',
+ control: 'plyr__control',
+ controlPressed: 'plyr__control--pressed',
+ playing: 'plyr--playing',
+ paused: 'plyr--paused',
+ stopped: 'plyr--stopped',
+ loading: 'plyr--loading',
+ hover: 'plyr--hover',
+ tooltip: 'plyr__tooltip',
+ cues: 'plyr__cues',
+ hidden: 'plyr__sr-only',
+ hideControls: 'plyr--hide-controls',
+ isIos: 'plyr--is-ios',
+ isTouch: 'plyr--is-touch',
+ uiSupported: 'plyr--full-ui',
+ noTransition: 'plyr--no-transition',
+ display: {
+ time: 'plyr__time'
+ },
+ menu: {
+ value: 'plyr__menu__value',
+ badge: 'plyr__badge',
+ open: 'plyr--menu-open'
+ },
+ captions: {
+ enabled: 'plyr--captions-enabled',
+ active: 'plyr--captions-active'
+ },
+ fullscreen: {
+ enabled: 'plyr--fullscreen-enabled',
+ fallback: 'plyr--fullscreen-fallback'
+ },
+ pip: {
+ supported: 'plyr--pip-supported',
+ active: 'plyr--pip-active'
+ },
+ airplay: {
+ supported: 'plyr--airplay-supported',
+ active: 'plyr--airplay-active'
+ },
+ tabFocus: 'plyr__tab-focus',
+ previewThumbnails: {
+ // Tooltip thumbs
+ thumbContainer: 'plyr__preview-thumb',
+ thumbContainerShown: 'plyr__preview-thumb--is-shown',
+ imageContainer: 'plyr__preview-thumb__image-container',
+ timeContainer: 'plyr__preview-thumb__time-container',
+ // Scrubbing
+ scrubbingContainer: 'plyr__preview-scrubbing',
+ scrubbingContainerShown: 'plyr__preview-scrubbing--is-shown'
+ }
+ },
+ // Embed attributes
+ attributes: {
+ embed: {
+ provider: 'data-plyr-provider',
+ id: 'data-plyr-embed-id'
+ }
+ },
+ // Advertisements plugin
+ // Register for an account here: http://vi.ai/publisher-video-monetization/?aid=plyrio
+ ads: {
+ enabled: false,
+ publisherId: '',
+ tagUrl: ''
+ },
+ // Preview Thumbnails plugin
+ previewThumbnails: {
+ enabled: false,
+ src: ''
+ },
+ // Vimeo plugin
+ vimeo: {
+ byline: false,
+ portrait: false,
+ title: false,
+ speed: true,
+ transparent: false,
+ // Whether the owner of the video has a Pro or Business account
+ // (which allows us to properly hide controls without CSS hacks, etc)
+ premium: false,
+ // Custom settings from Plyr
+ referrerPolicy: null // https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement/referrerPolicy
+
+ },
+ // YouTube plugin
+ youtube: {
+ noCookie: true,
+ // Whether to use an alternative version of YouTube without cookies
+ rel: 0,
+ // No related vids
+ showinfo: 0,
+ // Hide info
+ iv_load_policy: 3,
+ // Hide annotations
+ modestbranding: 1 // Hide logos as much as possible (they still show one in the corner when paused)
+
+ }
+};
+
+// ==========================================================================
+// Plyr states
+// ==========================================================================
+var pip = {
+ active: 'picture-in-picture',
+ inactive: 'inline'
+};
+
+// ==========================================================================
+// Plyr supported types and providers
+// ==========================================================================
+var providers = {
+ html5: 'html5',
+ youtube: 'youtube',
+ vimeo: 'vimeo'
+};
+var types = {
+ audio: 'audio',
+ video: 'video'
+};
+/**
+ * Get provider by URL
+ * @param {String} url
+ */
+
+function getProviderByUrl(url) {
+ // YouTube
+ if (/^(https?:\/\/)?(www\.)?(youtube\.com|youtube-nocookie\.com|youtu\.?be)\/.+$/.test(url)) {
+ return providers.youtube;
+ } // Vimeo
+
+
+ if (/^https?:\/\/player.vimeo.com\/video\/\d{0,9}(?=\b|\/)/.test(url)) {
+ return providers.vimeo;
+ }
+
+ return null;
+}
+
+// ==========================================================================
+// Console wrapper
+// ==========================================================================
+var noop = function noop() {};
+
+var Console = /*#__PURE__*/function () {
+ function Console() {
+ var enabled = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
+
+ _classCallCheck(this, Console);
+
+ this.enabled = window.console && enabled;
+
+ if (this.enabled) {
+ this.log('Debugging enabled');
+ }
+ }
+
+ _createClass(Console, [{
+ key: "log",
+ get: function get() {
+ // eslint-disable-next-line no-console
+ return this.enabled ? Function.prototype.bind.call(console.log, console) : noop;
+ }
+ }, {
+ key: "warn",
+ get: function get() {
+ // eslint-disable-next-line no-console
+ return this.enabled ? Function.prototype.bind.call(console.warn, console) : noop;
+ }
+ }, {
+ key: "error",
+ get: function get() {
+ // eslint-disable-next-line no-console
+ return this.enabled ? Function.prototype.bind.call(console.error, console) : noop;
+ }
+ }]);
+
+ return Console;
+}();
+
+var Fullscreen = /*#__PURE__*/function () {
+ function Fullscreen(player) {
+ var _this = this;
+
+ _classCallCheck(this, Fullscreen);
+
+ // Keep reference to parent
+ this.player = player; // Get prefix
+
+ this.prefix = Fullscreen.prefix;
+ this.property = Fullscreen.property; // Scroll position
+
+ this.scrollPosition = {
+ x: 0,
+ y: 0
+ }; // Force the use of 'full window/browser' rather than fullscreen
+
+ this.forceFallback = player.config.fullscreen.fallback === 'force'; // Get the fullscreen element
+ // Checks container is an ancestor, defaults to null
+
+ this.player.elements.fullscreen = player.config.fullscreen.container && closest(this.player.elements.container, player.config.fullscreen.container); // Register event listeners
+ // Handle event (incase user presses escape etc)
+
+ on.call(this.player, document, this.prefix === 'ms' ? 'MSFullscreenChange' : "".concat(this.prefix, "fullscreenchange"), function () {
+ // TODO: Filter for target??
+ _this.onChange();
+ }); // Fullscreen toggle on double click
+
+ on.call(this.player, this.player.elements.container, 'dblclick', function (event) {
+ // Ignore double click in controls
+ if (is$1.element(_this.player.elements.controls) && _this.player.elements.controls.contains(event.target)) {
+ return;
+ }
+
+ _this.toggle();
+ }); // Tap focus when in fullscreen
+
+ on.call(this, this.player.elements.container, 'keydown', function (event) {
+ return _this.trapFocus(event);
+ }); // Update the UI
+
+ this.update();
+ } // Determine if native supported
+
+
+ _createClass(Fullscreen, [{
+ key: "onChange",
+ value: function onChange() {
+ if (!this.enabled) {
+ return;
+ } // Update toggle button
+
+
+ var button = this.player.elements.buttons.fullscreen;
+
+ if (is$1.element(button)) {
+ button.pressed = this.active;
+ } // Trigger an event
+
+
+ triggerEvent.call(this.player, this.target, this.active ? 'enterfullscreen' : 'exitfullscreen', true);
+ }
+ }, {
+ key: "toggleFallback",
+ value: function toggleFallback() {
+ var toggle = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
+
+ // Store or restore scroll position
+ if (toggle) {
+ this.scrollPosition = {
+ x: window.scrollX || 0,
+ y: window.scrollY || 0
+ };
+ } else {
+ window.scrollTo(this.scrollPosition.x, this.scrollPosition.y);
+ } // Toggle scroll
+
+
+ document.body.style.overflow = toggle ? 'hidden' : ''; // Toggle class hook
+
+ toggleClass(this.target, this.player.config.classNames.fullscreen.fallback, toggle); // Force full viewport on iPhone X+
+
+ if (browser.isIos) {
+ var viewport = document.head.querySelector('meta[name="viewport"]');
+ var property = 'viewport-fit=cover'; // Inject the viewport meta if required
+
+ if (!viewport) {
+ viewport = document.createElement('meta');
+ viewport.setAttribute('name', 'viewport');
+ } // Check if the property already exists
+
+
+ var hasProperty = is$1.string(viewport.content) && viewport.content.includes(property);
+
+ if (toggle) {
+ this.cleanupViewport = !hasProperty;
+
+ if (!hasProperty) {
+ viewport.content += ",".concat(property);
+ }
+ } else if (this.cleanupViewport) {
+ viewport.content = viewport.content.split(',').filter(function (part) {
+ return part.trim() !== property;
+ }).join(',');
+ }
+ } // Toggle button and fire events
+
+
+ this.onChange();
+ } // Trap focus inside container
+
+ }, {
+ key: "trapFocus",
+ value: function trapFocus(event) {
+ // Bail if iOS, not active, not the tab key
+ if (browser.isIos || !this.active || event.key !== 'Tab' || event.keyCode !== 9) {
+ return;
+ } // Get the current focused element
+
+
+ var focused = document.activeElement;
+ var focusable = getElements.call(this.player, 'a[href], button:not(:disabled), input:not(:disabled), [tabindex]');
+
+ var _focusable = _slicedToArray(focusable, 1),
+ first = _focusable[0];
+
+ var last = focusable[focusable.length - 1];
+
+ if (focused === last && !event.shiftKey) {
+ // Move focus to first element that can be tabbed if Shift isn't used
+ first.focus();
+ event.preventDefault();
+ } else if (focused === first && event.shiftKey) {
+ // Move focus to last element that can be tabbed if Shift is used
+ last.focus();
+ event.preventDefault();
+ }
+ } // Update UI
+
+ }, {
+ key: "update",
+ value: function update() {
+ if (this.enabled) {
+ var mode;
+
+ if (this.forceFallback) {
+ mode = 'Fallback (forced)';
+ } else if (Fullscreen.native) {
+ mode = 'Native';
+ } else {
+ mode = 'Fallback';
+ }
+
+ this.player.debug.log("".concat(mode, " fullscreen enabled"));
+ } else {
+ this.player.debug.log('Fullscreen not supported and fallback disabled');
+ } // Add styling hook to show button
+
+
+ toggleClass(this.player.elements.container, this.player.config.classNames.fullscreen.enabled, this.enabled);
+ } // Make an element fullscreen
+
+ }, {
+ key: "enter",
+ value: function enter() {
+ if (!this.enabled) {
+ return;
+ } // iOS native fullscreen doesn't need the request step
+
+
+ if (browser.isIos && this.player.config.fullscreen.iosNative) {
+ this.target.webkitEnterFullscreen();
+ } else if (!Fullscreen.native || this.forceFallback) {
+ this.toggleFallback(true);
+ } else if (!this.prefix) {
+ this.target.requestFullscreen({
+ navigationUI: 'hide'
+ });
+ } else if (!is$1.empty(this.prefix)) {
+ this.target["".concat(this.prefix, "Request").concat(this.property)]();
+ }
+ } // Bail from fullscreen
+
+ }, {
+ key: "exit",
+ value: function exit() {
+ if (!this.enabled) {
+ return;
+ } // iOS native fullscreen
+
+
+ if (browser.isIos && this.player.config.fullscreen.iosNative) {
+ this.target.webkitExitFullscreen();
+ silencePromise(this.player.play());
+ } else if (!Fullscreen.native || this.forceFallback) {
+ this.toggleFallback(false);
+ } else if (!this.prefix) {
+ (document.cancelFullScreen || document.exitFullscreen).call(document);
+ } else if (!is$1.empty(this.prefix)) {
+ var action = this.prefix === 'moz' ? 'Cancel' : 'Exit';
+ document["".concat(this.prefix).concat(action).concat(this.property)]();
+ }
+ } // Toggle state
+
+ }, {
+ key: "toggle",
+ value: function toggle() {
+ if (!this.active) {
+ this.enter();
+ } else {
+ this.exit();
+ }
+ }
+ }, {
+ key: "usingNative",
+ // If we're actually using native
+ get: function get() {
+ return Fullscreen.native && !this.forceFallback;
+ } // Get the prefix for handlers
+
+ }, {
+ key: "enabled",
+ // Determine if fullscreen is enabled
+ get: function get() {
+ return (Fullscreen.native || this.player.config.fullscreen.fallback) && this.player.config.fullscreen.enabled && this.player.supported.ui && this.player.isVideo;
+ } // Get active state
+
+ }, {
+ key: "active",
+ get: function get() {
+ if (!this.enabled) {
+ return false;
+ } // Fallback using classname
+
+
+ if (!Fullscreen.native || this.forceFallback) {
+ return hasClass(this.target, this.player.config.classNames.fullscreen.fallback);
+ }
+
+ var element = !this.prefix ? document.fullscreenElement : document["".concat(this.prefix).concat(this.property, "Element")];
+ return element && element.shadowRoot ? element === this.target.getRootNode().host : element === this.target;
+ } // Get target element
+
+ }, {
+ key: "target",
+ get: function get() {
+ return browser.isIos && this.player.config.fullscreen.iosNative ? this.player.media : this.player.elements.fullscreen || this.player.elements.container;
+ }
+ }], [{
+ key: "native",
+ get: function get() {
+ return !!(document.fullscreenEnabled || document.webkitFullscreenEnabled || document.mozFullScreenEnabled || document.msFullscreenEnabled);
+ }
+ }, {
+ key: "prefix",
+ get: function get() {
+ // No prefix
+ if (is$1.function(document.exitFullscreen)) {
+ return '';
+ } // Check for fullscreen support by vendor prefix
+
+
+ var value = '';
+ var prefixes = ['webkit', 'moz', 'ms'];
+ prefixes.some(function (pre) {
+ if (is$1.function(document["".concat(pre, "ExitFullscreen")]) || is$1.function(document["".concat(pre, "CancelFullScreen")])) {
+ value = pre;
+ return true;
+ }
+
+ return false;
+ });
+ return value;
+ }
+ }, {
+ key: "property",
+ get: function get() {
+ return this.prefix === 'moz' ? 'FullScreen' : 'Fullscreen';
+ }
+ }]);
+
+ return Fullscreen;
+}();
+
+// ==========================================================================
+// Load image avoiding xhr/fetch CORS issues
+// Server status can't be obtained this way unfortunately, so this uses "naturalWidth" to determine if the image has loaded
+// By default it checks if it is at least 1px, but you can add a second argument to change this
+// ==========================================================================
+function loadImage(src) {
+ var minWidth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
+ return new Promise(function (resolve, reject) {
+ var image = new Image();
+
+ var handler = function handler() {
+ delete image.onload;
+ delete image.onerror;
+ (image.naturalWidth >= minWidth ? resolve : reject)(image);
+ };
+
+ Object.assign(image, {
+ onload: handler,
+ onerror: handler,
+ src: src
+ });
+ });
+}
+
+var ui = {
+ addStyleHook: function addStyleHook() {
+ toggleClass(this.elements.container, this.config.selectors.container.replace('.', ''), true);
+ toggleClass(this.elements.container, this.config.classNames.uiSupported, this.supported.ui);
+ },
+ // Toggle native HTML5 media controls
+ toggleNativeControls: function toggleNativeControls() {
+ var toggle = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
+
+ if (toggle && this.isHTML5) {
+ this.media.setAttribute('controls', '');
+ } else {
+ this.media.removeAttribute('controls');
+ }
+ },
+ // Setup the UI
+ build: function build() {
+ var _this = this;
+
+ // Re-attach media element listeners
+ // TODO: Use event bubbling?
+ this.listeners.media(); // Don't setup interface if no support
+
+ if (!this.supported.ui) {
+ this.debug.warn("Basic support only for ".concat(this.provider, " ").concat(this.type)); // Restore native controls
+
+ ui.toggleNativeControls.call(this, true); // Bail
+
+ return;
+ } // Inject custom controls if not present
+
+
+ if (!is$1.element(this.elements.controls)) {
+ // Inject custom controls
+ controls.inject.call(this); // Re-attach control listeners
+
+ this.listeners.controls();
+ } // Remove native controls
+
+
+ ui.toggleNativeControls.call(this); // Setup captions for HTML5
+
+ if (this.isHTML5) {
+ captions.setup.call(this);
+ } // Reset volume
+
+
+ this.volume = null; // Reset mute state
+
+ this.muted = null; // Reset loop state
+
+ this.loop = null; // Reset quality setting
+
+ this.quality = null; // Reset speed
+
+ this.speed = null; // Reset volume display
+
+ controls.updateVolume.call(this); // Reset time display
+
+ controls.timeUpdate.call(this); // Update the UI
+
+ ui.checkPlaying.call(this); // Check for picture-in-picture support
+
+ toggleClass(this.elements.container, this.config.classNames.pip.supported, support.pip && this.isHTML5 && this.isVideo); // Check for airplay support
+
+ toggleClass(this.elements.container, this.config.classNames.airplay.supported, support.airplay && this.isHTML5); // Add iOS class
+
+ toggleClass(this.elements.container, this.config.classNames.isIos, browser.isIos); // Add touch class
+
+ toggleClass(this.elements.container, this.config.classNames.isTouch, this.touch); // Ready for API calls
+
+ this.ready = true; // Ready event at end of execution stack
+
+ setTimeout(function () {
+ triggerEvent.call(_this, _this.media, 'ready');
+ }, 0); // Set the title
+
+ ui.setTitle.call(this); // Assure the poster image is set, if the property was added before the element was created
+
+ if (this.poster) {
+ ui.setPoster.call(this, this.poster, false).catch(function () {});
+ } // Manually set the duration if user has overridden it.
+ // The event listeners for it doesn't get called if preload is disabled (#701)
+
+
+ if (this.config.duration) {
+ controls.durationUpdate.call(this);
+ }
+ },
+ // Setup aria attribute for play and iframe title
+ setTitle: function setTitle() {
+ // Find the current text
+ var label = i18n.get('play', this.config); // If there's a media title set, use that for the label
+
+ if (is$1.string(this.config.title) && !is$1.empty(this.config.title)) {
+ label += ", ".concat(this.config.title);
+ } // If there's a play button, set label
+
+
+ Array.from(this.elements.buttons.play || []).forEach(function (button) {
+ button.setAttribute('aria-label', label);
+ }); // Set iframe title
+ // https://github.com/sampotts/plyr/issues/124
+
+ if (this.isEmbed) {
+ var iframe = getElement.call(this, 'iframe');
+
+ if (!is$1.element(iframe)) {
+ return;
+ } // Default to media type
+
+
+ var title = !is$1.empty(this.config.title) ? this.config.title : 'video';
+ var format = i18n.get('frameTitle', this.config);
+ iframe.setAttribute('title', format.replace('{title}', title));
+ }
+ },
+ // Toggle poster
+ togglePoster: function togglePoster(enable) {
+ toggleClass(this.elements.container, this.config.classNames.posterEnabled, enable);
+ },
+ // Set the poster image (async)
+ // Used internally for the poster setter, with the passive option forced to false
+ setPoster: function setPoster(poster) {
+ var _this2 = this;
+
+ var passive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
+
+ // Don't override if call is passive
+ if (passive && this.poster) {
+ return Promise.reject(new Error('Poster already set'));
+ } // Set property synchronously to respect the call order
+
+
+ this.media.setAttribute('data-poster', poster); // Wait until ui is ready
+
+ return ready.call(this) // Load image
+ .then(function () {
+ return loadImage(poster);
+ }).catch(function (err) {
+ // Hide poster on error unless it's been set by another call
+ if (poster === _this2.poster) {
+ ui.togglePoster.call(_this2, false);
+ } // Rethrow
+
+
+ throw err;
+ }).then(function () {
+ // Prevent race conditions
+ if (poster !== _this2.poster) {
+ throw new Error('setPoster cancelled by later call to setPoster');
+ }
+ }).then(function () {
+ Object.assign(_this2.elements.poster.style, {
+ backgroundImage: "url('".concat(poster, "')"),
+ // Reset backgroundSize as well (since it can be set to "cover" for padded thumbnails for youtube)
+ backgroundSize: ''
+ });
+ ui.togglePoster.call(_this2, true);
+ return poster;
+ });
+ },
+ // Check playing state
+ checkPlaying: function checkPlaying(event) {
+ var _this3 = this;
+
+ // Class hooks
+ toggleClass(this.elements.container, this.config.classNames.playing, this.playing);
+ toggleClass(this.elements.container, this.config.classNames.paused, this.paused);
+ toggleClass(this.elements.container, this.config.classNames.stopped, this.stopped); // Set state
+
+ Array.from(this.elements.buttons.play || []).forEach(function (target) {
+ Object.assign(target, {
+ pressed: _this3.playing
+ });
+ target.setAttribute('aria-label', i18n.get(_this3.playing ? 'pause' : 'play', _this3.config));
+ }); // Only update controls on non timeupdate events
+
+ if (is$1.event(event) && event.type === 'timeupdate') {
+ return;
+ } // Toggle controls
+
+
+ ui.toggleControls.call(this);
+ },
+ // Check if media is loading
+ checkLoading: function checkLoading(event) {
+ var _this4 = this;
+
+ this.loading = ['stalled', 'waiting'].includes(event.type); // Clear timer
+
+ clearTimeout(this.timers.loading); // Timer to prevent flicker when seeking
+
+ this.timers.loading = setTimeout(function () {
+ // Update progress bar loading class state
+ toggleClass(_this4.elements.container, _this4.config.classNames.loading, _this4.loading); // Update controls visibility
+
+ ui.toggleControls.call(_this4);
+ }, this.loading ? 250 : 0);
+ },
+ // Toggle controls based on state and `force` argument
+ toggleControls: function toggleControls(force) {
+ var controlsElement = this.elements.controls;
+
+ if (controlsElement && this.config.hideControls) {
+ // 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.)
+ var recentTouchSeek = this.touch && this.lastSeekTime + 2000 > Date.now(); // Show controls if force, loading, paused, button interaction, or recent seek, otherwise hide
+
+ this.toggleControls(Boolean(force || this.loading || this.paused || controlsElement.pressed || controlsElement.hover || recentTouchSeek));
+ }
+ },
+ // Migrate any custom properties from the media to the parent
+ migrateStyles: function migrateStyles() {
+ var _this5 = this;
+
+ // Loop through values (as they are the keys when the object is spread 🤔)
+ Object.values(_objectSpread2({}, this.media.style)) // We're only fussed about Plyr specific properties
+ .filter(function (key) {
+ return !is$1.empty(key) && key.startsWith('--plyr');
+ }).forEach(function (key) {
+ // Set on the container
+ _this5.elements.container.style.setProperty(key, _this5.media.style.getPropertyValue(key)); // Clean up from media element
+
+
+ _this5.media.style.removeProperty(key);
+ }); // Remove attribute if empty
+
+ if (is$1.empty(this.media.style)) {
+ this.media.removeAttribute('style');
+ }
+ }
+};
+
+var Listeners = /*#__PURE__*/function () {
+ function Listeners(player) {
+ _classCallCheck(this, Listeners);
+
+ this.player = player;
+ this.lastKey = null;
+ this.focusTimer = null;
+ this.lastKeyDown = null;
+ this.handleKey = this.handleKey.bind(this);
+ this.toggleMenu = this.toggleMenu.bind(this);
+ this.setTabFocus = this.setTabFocus.bind(this);
+ this.firstTouch = this.firstTouch.bind(this);
+ } // Handle key presses
+
+
+ _createClass(Listeners, [{
+ key: "handleKey",
+ value: function handleKey(event) {
+ var player = this.player;
+ var elements = player.elements;
+ var code = event.keyCode ? event.keyCode : event.which;
+ var pressed = event.type === 'keydown';
+ var repeat = pressed && code === this.lastKey; // Bail if a modifier key is set
+
+ if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) {
+ return;
+ } // If the event is bubbled from the media element
+ // Firefox doesn't get the keycode for whatever reason
+
+
+ if (!is$1.number(code)) {
+ return;
+ } // Seek by the number keys
+
+
+ var seekByKey = function seekByKey() {
+ // Divide the max duration into 10th's and times by the number value
+ player.currentTime = player.duration / 10 * (code - 48);
+ }; // Handle the key on keydown
+ // Reset on keyup
+
+
+ if (pressed) {
+ // Check focused element
+ // and if the focused element is not editable (e.g. text input)
+ // and any that accept key input http://webaim.org/techniques/keyboard/
+ var focused = document.activeElement;
+
+ if (is$1.element(focused)) {
+ var editable = player.config.selectors.editable;
+ var seek = elements.inputs.seek;
+
+ if (focused !== seek && matches$1(focused, editable)) {
+ return;
+ }
+
+ if (event.which === 32 && matches$1(focused, 'button, [role^="menuitem"]')) {
+ return;
+ }
+ } // Which keycodes should we prevent default
+
+
+ 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)
+
+ if (preventDefault.includes(code)) {
+ event.preventDefault();
+ event.stopPropagation();
+ }
+
+ switch (code) {
+ case 48:
+ case 49:
+ case 50:
+ case 51:
+ case 52:
+ case 53:
+ case 54:
+ case 55:
+ case 56:
+ case 57:
+ // 0-9
+ if (!repeat) {
+ seekByKey();
+ }
+
+ break;
+
+ case 32:
+ case 75:
+ // Space and K key
+ if (!repeat) {
+ silencePromise(player.togglePlay());
+ }
+
+ break;
+
+ case 38:
+ // Arrow up
+ player.increaseVolume(0.1);
+ break;
+
+ case 40:
+ // Arrow down
+ player.decreaseVolume(0.1);
+ break;
+
+ case 77:
+ // M key
+ if (!repeat) {
+ player.muted = !player.muted;
+ }
+
+ break;
+
+ case 39:
+ // Arrow forward
+ player.forward();
+ break;
+
+ case 37:
+ // Arrow back
+ player.rewind();
+ break;
+
+ case 70:
+ // F key
+ player.fullscreen.toggle();
+ break;
+
+ case 67:
+ // C key
+ if (!repeat) {
+ player.toggleCaptions();
+ }
+
+ break;
+
+ case 76:
+ // L key
+ player.loop = !player.loop;
+ break;
+ } // Escape is handle natively when in full screen
+ // So we only need to worry about non native
+
+
+ if (code === 27 && !player.fullscreen.usingNative && player.fullscreen.active) {
+ player.fullscreen.toggle();
+ } // Store last code for next cycle
+
+
+ this.lastKey = code;
+ } else {
+ this.lastKey = null;
+ }
+ } // Toggle menu
+
+ }, {
+ key: "toggleMenu",
+ value: function toggleMenu(event) {
+ controls.toggleMenu.call(this.player, event);
+ } // Device is touch enabled
+
+ }, {
+ key: "firstTouch",
+ value: function firstTouch() {
+ var player = this.player;
+ var elements = player.elements;
+ player.touch = true; // Add touch class
+
+ toggleClass(elements.container, player.config.classNames.isTouch, true);
+ }
+ }, {
+ key: "setTabFocus",
+ value: function setTabFocus(event) {
+ var player = this.player;
+ var elements = player.elements;
+ clearTimeout(this.focusTimer); // Ignore any key other than tab
+
+ if (event.type === 'keydown' && event.which !== 9) {
+ return;
+ } // Store reference to event timeStamp
+
+
+ if (event.type === 'keydown') {
+ this.lastKeyDown = event.timeStamp;
+ } // Remove current classes
+
+
+ var removeCurrent = function removeCurrent() {
+ var className = player.config.classNames.tabFocus;
+ var current = getElements.call(player, ".".concat(className));
+ toggleClass(current, className, false);
+ }; // Determine if a key was pressed to trigger this event
+
+
+ var wasKeyDown = event.timeStamp - this.lastKeyDown <= 20; // Ignore focus events if a key was pressed prior
+
+ if (event.type === 'focus' && !wasKeyDown) {
+ return;
+ } // Remove all current
+
+
+ removeCurrent(); // Delay the adding of classname until the focus has changed
+ // This event fires before the focusin event
+
+ if (event.type !== 'focusout') {
+ this.focusTimer = setTimeout(function () {
+ var focused = document.activeElement; // Ignore if current focus element isn't inside the player
+
+ if (!elements.container.contains(focused)) {
+ return;
+ }
+
+ toggleClass(document.activeElement, player.config.classNames.tabFocus, true);
+ }, 10);
+ }
+ } // Global window & document listeners
+
+ }, {
+ key: "global",
+ value: function global() {
+ var toggle = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
+ var player = this.player; // Keyboard shortcuts
+
+ if (player.config.keyboard.global) {
+ toggleListener.call(player, window, 'keydown keyup', this.handleKey, toggle, false);
+ } // Click anywhere closes menu
+
+
+ toggleListener.call(player, document.body, 'click', this.toggleMenu, toggle); // Detect touch by events
+
+ once.call(player, document.body, 'touchstart', this.firstTouch); // Tab focus detection
+
+ toggleListener.call(player, document.body, 'keydown focus blur focusout', this.setTabFocus, toggle, false, true);
+ } // Container listeners
+
+ }, {
+ key: "container",
+ value: function container() {
+ var player = this.player;
+ var config = player.config,
+ elements = player.elements,
+ timers = player.timers; // Keyboard shortcuts
+
+ if (!config.keyboard.global && config.keyboard.focused) {
+ on.call(player, elements.container, 'keydown keyup', this.handleKey, false);
+ } // Toggle controls on mouse events and entering fullscreen
+
+
+ on.call(player, elements.container, 'mousemove mouseleave touchstart touchmove enterfullscreen exitfullscreen', function (event) {
+ var controlsElement = elements.controls; // Remove button states for fullscreen
+
+ if (controlsElement && event.type === 'enterfullscreen') {
+ controlsElement.pressed = false;
+ controlsElement.hover = false;
+ } // Show, then hide after a timeout unless another control event occurs
+
+
+ var show = ['touchstart', 'touchmove', 'mousemove'].includes(event.type);
+ var delay = 0;
+
+ if (show) {
+ ui.toggleControls.call(player, true); // Use longer timeout for touch devices
+
+ delay = player.touch ? 3000 : 2000;
+ } // Clear timer
+
+
+ clearTimeout(timers.controls); // Set new timer to prevent flicker when seeking
+
+ timers.controls = setTimeout(function () {
+ return ui.toggleControls.call(player, false);
+ }, delay);
+ }); // Set a gutter for Vimeo
+
+ var setGutter = function setGutter(ratio, padding, toggle) {
+ if (!player.isVimeo || player.config.vimeo.premium) {
+ return;
+ }
+
+ var target = player.elements.wrapper.firstChild;
+
+ var _ratio = _slicedToArray(ratio, 2),
+ y = _ratio[1];
+
+ var _getAspectRatio$call = getAspectRatio.call(player),
+ _getAspectRatio$call2 = _slicedToArray(_getAspectRatio$call, 2),
+ videoX = _getAspectRatio$call2[0],
+ videoY = _getAspectRatio$call2[1];
+
+ target.style.maxWidth = toggle ? "".concat(y / videoY * videoX, "px") : null;
+ target.style.margin = toggle ? '0 auto' : null;
+ }; // Resize on fullscreen change
+
+
+ var setPlayerSize = function setPlayerSize(measure) {
+ // If we don't need to measure the viewport
+ if (!measure) {
+ return setAspectRatio.call(player);
+ }
+
+ var rect = elements.container.getBoundingClientRect();
+ var width = rect.width,
+ height = rect.height;
+ return setAspectRatio.call(player, "".concat(width, ":").concat(height));
+ };
+
+ var resized = function resized() {
+ clearTimeout(timers.resized);
+ timers.resized = setTimeout(setPlayerSize, 50);
+ };
+
+ on.call(player, elements.container, 'enterfullscreen exitfullscreen', function (event) {
+ var _player$fullscreen = player.fullscreen,
+ target = _player$fullscreen.target,
+ usingNative = _player$fullscreen.usingNative; // Ignore events not from target
+
+ if (target !== elements.container) {
+ return;
+ } // If it's not an embed and no ratio specified
+
+
+ if (!player.isEmbed && is$1.empty(player.config.ratio)) {
+ return;
+ }
+
+ var isEnter = event.type === 'enterfullscreen'; // Set the player size when entering fullscreen to viewport size
+
+ var _setPlayerSize = setPlayerSize(isEnter),
+ padding = _setPlayerSize.padding,
+ ratio = _setPlayerSize.ratio; // Set Vimeo gutter
+
+
+ setGutter(ratio, padding, isEnter); // If not using native browser fullscreen API, we need to check for resizes of viewport
+
+ if (!usingNative) {
+ if (isEnter) {
+ on.call(player, window, 'resize', resized);
+ } else {
+ off.call(player, window, 'resize', resized);
+ }
+ }
+ });
+ } // Listen for media events
+
+ }, {
+ key: "media",
+ value: function media() {
+ var _this = this;
+
+ var player = this.player;
+ var elements = player.elements; // Time change on media
+
+ on.call(player, player.media, 'timeupdate seeking seeked', function (event) {
+ return controls.timeUpdate.call(player, event);
+ }); // Display duration
+
+ on.call(player, player.media, 'durationchange loadeddata loadedmetadata', function (event) {
+ return controls.durationUpdate.call(player, event);
+ }); // Handle the media finishing
+
+ on.call(player, player.media, 'ended', function () {
+ // Show poster on end
+ if (player.isHTML5 && player.isVideo && player.config.resetOnEnd) {
+ // Restart
+ player.restart(); // Call pause otherwise IE11 will start playing the video again
+
+ player.pause();
+ }
+ }); // Check for buffer progress
+
+ on.call(player, player.media, 'progress playing seeking seeked', function (event) {
+ return controls.updateProgress.call(player, event);
+ }); // Handle volume changes
+
+ on.call(player, player.media, 'volumechange', function (event) {
+ return controls.updateVolume.call(player, event);
+ }); // Handle play/pause
+
+ on.call(player, player.media, 'playing play pause ended emptied timeupdate', function (event) {
+ return ui.checkPlaying.call(player, event);
+ }); // Loading state
+
+ on.call(player, player.media, 'waiting canplay seeked playing', function (event) {
+ return ui.checkLoading.call(player, event);
+ }); // Click video
+
+ if (player.supported.ui && player.config.clickToPlay && !player.isAudio) {
+ // Re-fetch the wrapper
+ var wrapper = getElement.call(player, ".".concat(player.config.classNames.video)); // Bail if there's no wrapper (this should never happen)
+
+ if (!is$1.element(wrapper)) {
+ return;
+ } // On click play, pause or restart
+
+
+ on.call(player, elements.container, 'click', function (event) {
+ var targets = [elements.container, wrapper]; // Ignore if click if not container or in video wrapper
+
+ if (!targets.includes(event.target) && !wrapper.contains(event.target)) {
+ return;
+ } // Touch devices will just show controls (if hidden)
+
+
+ if (player.touch && player.config.hideControls) {
+ return;
+ }
+
+ if (player.ended) {
+ _this.proxy(event, player.restart, 'restart');
+
+ _this.proxy(event, function () {
+ silencePromise(player.play());
+ }, 'play');
+ } else {
+ _this.proxy(event, function () {
+ silencePromise(player.togglePlay());
+ }, 'play');
+ }
+ });
+ } // Disable right click
+
+
+ if (player.supported.ui && player.config.disableContextMenu) {
+ on.call(player, elements.wrapper, 'contextmenu', function (event) {
+ event.preventDefault();
+ }, false);
+ } // Volume change
+
+
+ on.call(player, player.media, 'volumechange', function () {
+ // Save to storage
+ player.storage.set({
+ volume: player.volume,
+ muted: player.muted
+ });
+ }); // Speed change
+
+ on.call(player, player.media, 'ratechange', function () {
+ // Update UI
+ controls.updateSetting.call(player, 'speed'); // Save to storage
+
+
+ player.storage.set({
+ speed: player.speed
+ });
+ }); // Quality change
+
+ on.call(player, player.media, 'qualitychange', function (event) {
+ // Update UI
+ controls.updateSetting.call(player, 'quality', null, event.detail.quality);
+ }); // Update download link when ready and if quality changes
+
+ on.call(player, player.media, 'ready qualitychange', function () {
+ controls.setDownloadUrl.call(player);
+ }); // Proxy events to container
+ // Bubble up key events for Edge
+
+ var proxyEvents = player.config.events.concat(['keyup', 'keydown']).join(' ');
+ on.call(player, player.media, proxyEvents, function (event) {
+ var _event$detail = event.detail,
+ detail = _event$detail === void 0 ? {} : _event$detail; // Get error details from media
+
+ if (event.type === 'error') {
+ detail = player.media.error;
+ }
+
+ triggerEvent.call(player, elements.container, event.type, true, detail);
+ });
+ } // Run default and custom handlers
+
+ }, {
+ key: "proxy",
+ value: function proxy(event, defaultHandler, customHandlerKey) {
+ var player = this.player;
+ var customHandler = player.config.listeners[customHandlerKey];
+ var hasCustomHandler = is$1.function(customHandler);
+ var returned = true; // Execute custom handler
+
+ if (hasCustomHandler) {
+ returned = customHandler.call(player, event);
+ } // Only call default handler if not prevented in custom handler
+
+
+ if (returned !== false && is$1.function(defaultHandler)) {
+ defaultHandler.call(player, event);
+ }
+ } // Trigger custom and default handlers
+
+ }, {
+ key: "bind",
+ value: function bind(element, type, defaultHandler, customHandlerKey) {
+ var _this2 = this;
+
+ var passive = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
+ var player = this.player;
+ var customHandler = player.config.listeners[customHandlerKey];
+ var hasCustomHandler = is$1.function(customHandler);
+ on.call(player, element, type, function (event) {
+ return _this2.proxy(event, defaultHandler, customHandlerKey);
+ }, passive && !hasCustomHandler);
+ } // Listen for control events
+
+ }, {
+ key: "controls",
+ value: function controls$1() {
+ var _this3 = this;
+
+ var player = this.player;
+ var elements = player.elements; // IE doesn't support input event, so we fallback to change
+
+ var inputEvent = browser.isIE ? 'change' : 'input'; // Play/pause toggle
+
+ if (elements.buttons.play) {
+ Array.from(elements.buttons.play).forEach(function (button) {
+ _this3.bind(button, 'click', function () {
+ silencePromise(player.togglePlay());
+ }, 'play');
+ });
+ } // Pause
+
+
+ this.bind(elements.buttons.restart, 'click', player.restart, 'restart'); // Rewind
+
+ this.bind(elements.buttons.rewind, 'click', player.rewind, 'rewind'); // Rewind
+
+ this.bind(elements.buttons.fastForward, 'click', player.forward, 'fastForward'); // Mute toggle
+
+ this.bind(elements.buttons.mute, 'click', function () {
+ player.muted = !player.muted;
+ }, 'mute'); // Captions toggle
+
+ this.bind(elements.buttons.captions, 'click', function () {
+ return player.toggleCaptions();
+ }); // Download
+
+ this.bind(elements.buttons.download, 'click', function () {
+ triggerEvent.call(player, player.media, 'download');
+ }, 'download'); // Fullscreen toggle
+
+ this.bind(elements.buttons.fullscreen, 'click', function () {
+ player.fullscreen.toggle();
+ }, 'fullscreen'); // Picture-in-Picture
+
+ this.bind(elements.buttons.pip, 'click', function () {
+ player.pip = 'toggle';
+ }, 'pip'); // Airplay
+
+ this.bind(elements.buttons.airplay, 'click', player.airplay, 'airplay'); // Settings menu - click toggle
+
+ this.bind(elements.buttons.settings, 'click', function (event) {
+ // Prevent the document click listener closing the menu
+ event.stopPropagation();
+ event.preventDefault();
+
+ controls.toggleMenu.call(player, event);
+ }, null, false); // Can't be passive as we're preventing default
+ // Settings menu - keyboard toggle
+ // We have to bind to keyup otherwise Firefox triggers a click when a keydown event handler shifts focus
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=1220143
+
+ this.bind(elements.buttons.settings, 'keyup', function (event) {
+ var code = event.which; // We only care about space and return
+
+ if (![13, 32].includes(code)) {
+ return;
+ } // Because return triggers a click anyway, all we need to do is set focus
+
+
+ if (code === 13) {
+ controls.focusFirstMenuItem.call(player, null, true);
+
+ return;
+ } // Prevent scroll
+
+
+ event.preventDefault(); // Prevent playing video (Firefox)
+
+ event.stopPropagation(); // Toggle menu
+
+ controls.toggleMenu.call(player, event);
+ }, null, false // Can't be passive as we're preventing default
+ ); // Escape closes menu
+
+ this.bind(elements.settings.menu, 'keydown', function (event) {
+ if (event.which === 27) {
+ controls.toggleMenu.call(player, event);
+ }
+ }); // Set range input alternative "value", which matches the tooltip time (#954)
+
+ this.bind(elements.inputs.seek, 'mousedown mousemove', function (event) {
+ var rect = elements.progress.getBoundingClientRect();
+ var percent = 100 / rect.width * (event.pageX - rect.left);
+ event.currentTarget.setAttribute('seek-value', percent);
+ }); // Pause while seeking
+
+ this.bind(elements.inputs.seek, 'mousedown mouseup keydown keyup touchstart touchend', function (event) {
+ var seek = event.currentTarget;
+ var code = event.keyCode ? event.keyCode : event.which;
+ var attribute = 'play-on-seeked';
+
+ if (is$1.keyboardEvent(event) && code !== 39 && code !== 37) {
+ return;
+ } // Record seek time so we can prevent hiding controls for a few seconds after seek
+
+
+ player.lastSeekTime = Date.now(); // Was playing before?
+
+ var play = seek.hasAttribute(attribute); // Done seeking
+
+ var done = ['mouseup', 'touchend', 'keyup'].includes(event.type); // If we're done seeking and it was playing, resume playback
+
+ if (play && done) {
+ seek.removeAttribute(attribute);
+ silencePromise(player.play());
+ } else if (!done && player.playing) {
+ seek.setAttribute(attribute, '');
+ player.pause();
+ }
+ }); // Fix range inputs on iOS
+ // Super weird iOS bug where after you interact with an <input type="range">,
+ // it takes over further interactions on the page. This is a hack
+
+ if (browser.isIos) {
+ var inputs = getElements.call(player, 'input[type="range"]');
+ Array.from(inputs).forEach(function (input) {
+ return _this3.bind(input, inputEvent, function (event) {
+ return repaint(event.target);
+ });
+ });
+ } // Seek
+
+
+ this.bind(elements.inputs.seek, inputEvent, function (event) {
+ var seek = event.currentTarget; // If it exists, use seek-value instead of "value" for consistency with tooltip time (#954)
+
+ var seekTo = seek.getAttribute('seek-value');
+
+ if (is$1.empty(seekTo)) {
+ seekTo = seek.value;
+ }
+
+ seek.removeAttribute('seek-value');
+ player.currentTime = seekTo / seek.max * player.duration;
+ }, 'seek'); // Seek tooltip
+
+ this.bind(elements.progress, 'mouseenter mouseleave mousemove', function (event) {
+ return controls.updateSeekTooltip.call(player, event);
+ }); // Preview thumbnails plugin
+ // TODO: Really need to work on some sort of plug-in wide event bus or pub-sub for this
+
+ this.bind(elements.progress, 'mousemove touchmove', function (event) {
+ var previewThumbnails = player.previewThumbnails;
+
+ if (previewThumbnails && previewThumbnails.loaded) {
+ previewThumbnails.startMove(event);
+ }
+ }); // Hide thumbnail preview - on mouse click, mouse leave, and video play/seek. All four are required, e.g., for buffering
+
+ this.bind(elements.progress, 'mouseleave touchend click', function () {
+ var previewThumbnails = player.previewThumbnails;
+
+ if (previewThumbnails && previewThumbnails.loaded) {
+ previewThumbnails.endMove(false, true);
+ }
+ }); // Show scrubbing preview
+
+ this.bind(elements.progress, 'mousedown touchstart', function (event) {
+ var previewThumbnails = player.previewThumbnails;
+
+ if (previewThumbnails && previewThumbnails.loaded) {
+ previewThumbnails.startScrubbing(event);
+ }
+ });
+ this.bind(elements.progress, 'mouseup touchend', function (event) {
+ var previewThumbnails = player.previewThumbnails;
+
+ if (previewThumbnails && previewThumbnails.loaded) {
+ previewThumbnails.endScrubbing(event);
+ }
+ }); // Polyfill for lower fill in <input type="range"> for webkit
+
+ if (browser.isWebkit) {
+ Array.from(getElements.call(player, 'input[type="range"]')).forEach(function (element) {
+ _this3.bind(element, 'input', function (event) {
+ return controls.updateRangeFill.call(player, event.target);
+ });
+ });
+ } // Current time invert
+ // Only if one time element is used for both currentTime and duration
+
+
+ if (player.config.toggleInvert && !is$1.element(elements.display.duration)) {
+ this.bind(elements.display.currentTime, 'click', function () {
+ // Do nothing if we're at the start
+ if (player.currentTime === 0) {
+ return;
+ }
+
+ player.config.invertTime = !player.config.invertTime;
+
+ controls.timeUpdate.call(player);
+ });
+ } // Volume
+
+
+ this.bind(elements.inputs.volume, inputEvent, function (event) {
+ player.volume = event.target.value;
+ }, 'volume'); // Update controls.hover state (used for ui.toggleControls to avoid hiding when interacting)
+
+ this.bind(elements.controls, 'mouseenter mouseleave', function (event) {
+ elements.controls.hover = !player.touch && event.type === 'mouseenter';
+ }); // Also update controls.hover state for any non-player children of fullscreen element (as above)
+
+ if (elements.fullscreen) {
+ Array.from(elements.fullscreen.children).filter(function (c) {
+ return !c.contains(elements.container);
+ }).forEach(function (child) {
+ _this3.bind(child, 'mouseenter mouseleave', function (event) {
+ elements.controls.hover = !player.touch && event.type === 'mouseenter';
+ });
+ });
+ } // Update controls.pressed state (used for ui.toggleControls to avoid hiding when interacting)
+
+
+ this.bind(elements.controls, 'mousedown mouseup touchstart touchend touchcancel', function (event) {
+ elements.controls.pressed = ['mousedown', 'touchstart'].includes(event.type);
+ }); // Show controls when they receive focus (e.g., when using keyboard tab key)
+
+ this.bind(elements.controls, 'focusin', function () {
+ var config = player.config,
+ timers = player.timers; // Skip transition to prevent focus from scrolling the parent element
+
+ toggleClass(elements.controls, config.classNames.noTransition, true); // Toggle
+
+ ui.toggleControls.call(player, true); // Restore transition
+
+ setTimeout(function () {
+ toggleClass(elements.controls, config.classNames.noTransition, false);
+ }, 0); // Delay a little more for mouse users
+
+ var delay = _this3.touch ? 3000 : 4000; // Clear timer
+
+ clearTimeout(timers.controls); // Hide again after delay
+
+ timers.controls = setTimeout(function () {
+ return ui.toggleControls.call(player, false);
+ }, delay);
+ }); // Mouse wheel for volume
+
+ this.bind(elements.inputs.volume, 'wheel', function (event) {
+ // Detect "natural" scroll - suppored on OS X Safari only
+ // Other browsers on OS X will be inverted until support improves
+ var inverted = event.webkitDirectionInvertedFromDevice; // Get delta from event. Invert if `inverted` is true
+
+ var _map = [event.deltaX, -event.deltaY].map(function (value) {
+ return inverted ? -value : value;
+ }),
+ _map2 = _slicedToArray(_map, 2),
+ x = _map2[0],
+ y = _map2[1]; // Using the biggest delta, normalize to 1 or -1 (or 0 if no delta)
+
+
+ var direction = Math.sign(Math.abs(x) > Math.abs(y) ? x : y); // Change the volume by 2%
+
+ player.increaseVolume(direction / 50); // Don't break page scrolling at max and min
+
+ var volume = player.media.volume;
+
+ if (direction === 1 && volume < 1 || direction === -1 && volume > 0) {
+ event.preventDefault();
+ }
+ }, 'volume', false);
+ }
+ }]);
+
+ return Listeners;
+}();
+
+var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
+
+function createCommonjsModule(fn, module) {
+ return module = { exports: {} }, fn(module, module.exports), module.exports;
+}
+
+var loadjs_umd = createCommonjsModule(function (module, exports) {
+ (function (root, factory) {
+ {
+ module.exports = factory();
+ }
+ })(commonjsGlobal, function () {
+ /**
+ * Global dependencies.
+ * @global {Object} document - DOM
+ */
+ var devnull = function devnull() {},
+ bundleIdCache = {},
+ bundleResultCache = {},
+ bundleCallbackQueue = {};
+ /**
+ * Subscribe to bundle load event.
+ * @param {string[]} bundleIds - Bundle ids
+ * @param {Function} callbackFn - The callback function
+ */
+
+
+ function subscribe(bundleIds, callbackFn) {
+ // listify
+ bundleIds = bundleIds.push ? bundleIds : [bundleIds];
+ var depsNotFound = [],
+ i = bundleIds.length,
+ numWaiting = i,
+ fn,
+ bundleId,
+ r,
+ q; // define callback function
+
+ fn = function fn(bundleId, pathsNotFound) {
+ if (pathsNotFound.length) depsNotFound.push(bundleId);
+ numWaiting--;
+ if (!numWaiting) callbackFn(depsNotFound);
+ }; // register callback
+
+
+ while (i--) {
+ bundleId = bundleIds[i]; // execute callback if in result cache
+
+ r = bundleResultCache[bundleId];
+
+ if (r) {
+ fn(bundleId, r);
+ continue;
+ } // add to callback queue
+
+
+ q = bundleCallbackQueue[bundleId] = bundleCallbackQueue[bundleId] || [];
+ q.push(fn);
+ }
+ }
+ /**
+ * Publish bundle load event.
+ * @param {string} bundleId - Bundle id
+ * @param {string[]} pathsNotFound - List of files not found
+ */
+
+
+ function publish(bundleId, pathsNotFound) {
+ // exit if id isn't defined
+ if (!bundleId) return;
+ var q = bundleCallbackQueue[bundleId]; // cache result
+
+ bundleResultCache[bundleId] = pathsNotFound; // exit if queue is empty
+
+ if (!q) return; // empty callback queue
+
+ while (q.length) {
+ q[0](bundleId, pathsNotFound);
+ q.splice(0, 1);
+ }
+ }
+ /**
+ * Execute callbacks.
+ * @param {Object or Function} args - The callback args
+ * @param {string[]} depsNotFound - List of dependencies not found
+ */
+
+
+ function executeCallbacks(args, depsNotFound) {
+ // accept function as argument
+ if (args.call) args = {
+ success: args
+ }; // success and error callbacks
+
+ if (depsNotFound.length) (args.error || devnull)(depsNotFound);else (args.success || devnull)(args);
+ }
+ /**
+ * Load individual file.
+ * @param {string} path - The file path
+ * @param {Function} callbackFn - The callback function
+ */
+
+
+ function loadFile(path, callbackFn, args, numTries) {
+ var doc = document,
+ async = args.async,
+ maxTries = (args.numRetries || 0) + 1,
+ beforeCallbackFn = args.before || devnull,
+ pathname = path.replace(/[\?|#].*$/, ''),
+ pathStripped = path.replace(/^(css|img)!/, ''),
+ isLegacyIECss,
+ e;
+ numTries = numTries || 0;
+
+ if (/(^css!|\.css$)/.test(pathname)) {
+ // css
+ e = doc.createElement('link');
+ e.rel = 'stylesheet';
+ e.href = pathStripped; // tag IE9+
+
+ isLegacyIECss = 'hideFocus' in e; // use preload in IE Edge (to detect load errors)
+
+ if (isLegacyIECss && e.relList) {
+ isLegacyIECss = 0;
+ e.rel = 'preload';
+ e.as = 'style';
+ }
+ } else if (/(^img!|\.(png|gif|jpg|svg|webp)$)/.test(pathname)) {
+ // image
+ e = doc.createElement('img');
+ e.src = pathStripped;
+ } else {
+ // javascript
+ e = doc.createElement('script');
+ e.src = path;
+ e.async = async === undefined ? true : async;
+ }
+
+ e.onload = e.onerror = e.onbeforeload = function (ev) {
+ var result = ev.type[0]; // treat empty stylesheets as failures to get around lack of onerror
+ // support in IE9-11
+
+ if (isLegacyIECss) {
+ try {
+ if (!e.sheet.cssText.length) result = 'e';
+ } catch (x) {
+ // sheets objects created from load errors don't allow access to
+ // `cssText` (unless error is Code:18 SecurityError)
+ if (x.code != 18) result = 'e';
+ }
+ } // handle retries in case of load failure
+
+
+ if (result == 'e') {
+ // increment counter
+ numTries += 1; // exit function and try again
+
+ if (numTries < maxTries) {
+ return loadFile(path, callbackFn, args, numTries);
+ }
+ } else if (e.rel == 'preload' && e.as == 'style') {
+ // activate preloaded stylesheets
+ return e.rel = 'stylesheet'; // jshint ignore:line
+ } // execute callback
+
+
+ callbackFn(path, result, ev.defaultPrevented);
+ }; // add to document (unless callback returns `false`)
+
+
+ if (beforeCallbackFn(path, e) !== false) doc.head.appendChild(e);
+ }
+ /**
+ * Load multiple files.
+ * @param {string[]} paths - The file paths
+ * @param {Function} callbackFn - The callback function
+ */
+
+
+ function loadFiles(paths, callbackFn, args) {
+ // listify paths
+ paths = paths.push ? paths : [paths];
+ var numWaiting = paths.length,
+ x = numWaiting,
+ pathsNotFound = [],
+ fn,
+ i; // define callback function
+
+ fn = function fn(path, result, defaultPrevented) {
+ // handle error
+ if (result == 'e') pathsNotFound.push(path); // handle beforeload event. If defaultPrevented then that means the load
+ // will be blocked (ex. Ghostery/ABP on Safari)
+
+ if (result == 'b') {
+ if (defaultPrevented) pathsNotFound.push(path);else return;
+ }
+
+ numWaiting--;
+ if (!numWaiting) callbackFn(pathsNotFound);
+ }; // load scripts
+
+
+ for (i = 0; i < x; i++) {
+ loadFile(paths[i], fn, args);
+ }
+ }
+ /**
+ * Initiate script load and register bundle.
+ * @param {(string|string[])} paths - The file paths
+ * @param {(string|Function|Object)} [arg1] - The (1) bundleId or (2) success
+ * callback or (3) object literal with success/error arguments, numRetries,
+ * etc.
+ * @param {(Function|Object)} [arg2] - The (1) success callback or (2) object
+ * literal with success/error arguments, numRetries, etc.
+ */
+
+
+ function loadjs(paths, arg1, arg2) {
+ var bundleId, args; // bundleId (if string)
+
+ if (arg1 && arg1.trim) bundleId = arg1; // args (default is {})
+
+ args = (bundleId ? arg2 : arg1) || {}; // throw error if bundle is already defined
+
+ if (bundleId) {
+ if (bundleId in bundleIdCache) {
+ throw "LoadJS";
+ } else {
+ bundleIdCache[bundleId] = true;
+ }
+ }
+
+ function loadFn(resolve, reject) {
+ loadFiles(paths, function (pathsNotFound) {
+ // execute callbacks
+ executeCallbacks(args, pathsNotFound); // resolve Promise
+
+ if (resolve) {
+ executeCallbacks({
+ success: resolve,
+ error: reject
+ }, pathsNotFound);
+ } // publish bundle load event
+
+
+ publish(bundleId, pathsNotFound);
+ }, args);
+ }
+
+ if (args.returnPromise) return new Promise(loadFn);else loadFn();
+ }
+ /**
+ * Execute callbacks when dependencies have been satisfied.
+ * @param {(string|string[])} deps - List of bundle ids
+ * @param {Object} args - success/error arguments
+ */
+
+
+ loadjs.ready = function ready(deps, args) {
+ // subscribe to bundle load event
+ subscribe(deps, function (depsNotFound) {
+ // execute callbacks
+ executeCallbacks(args, depsNotFound);
+ });
+ return loadjs;
+ };
+ /**
+ * Manually satisfy bundle dependencies.
+ * @param {string} bundleId - The bundle id
+ */
+
+
+ loadjs.done = function done(bundleId) {
+ publish(bundleId, []);
+ };
+ /**
+ * Reset loadjs dependencies statuses
+ */
+
+
+ loadjs.reset = function reset() {
+ bundleIdCache = {};
+ bundleResultCache = {};
+ bundleCallbackQueue = {};
+ };
+ /**
+ * Determine if bundle has already been defined
+ * @param String} bundleId - The bundle id
+ */
+
+
+ loadjs.isDefined = function isDefined(bundleId) {
+ return bundleId in bundleIdCache;
+ }; // export
+
+
+ return loadjs;
+ });
+});
+
+// ==========================================================================
+function loadScript(url) {
+ return new Promise(function (resolve, reject) {
+ loadjs_umd(url, {
+ success: resolve,
+ error: reject
+ });
+ });
+}
+
+function parseId(url) {
+ if (is$1.empty(url)) {
+ return null;
+ }
+
+ if (is$1.number(Number(url))) {
+ return url;
+ }
+
+ var regex = /^.*(vimeo.com\/|video\/)(\d+).*/;
+ return url.match(regex) ? RegExp.$2 : url;
+} // Set playback state and trigger change (only on actual change)
+
+
+function assurePlaybackState(play) {
+ if (play && !this.embed.hasPlayed) {
+ this.embed.hasPlayed = true;
+ }
+
+ if (this.media.paused === play) {
+ this.media.paused = !play;
+ triggerEvent.call(this, this.media, play ? 'play' : 'pause');
+ }
+}
+
+var vimeo = {
+ setup: function setup() {
+ var player = this; // Add embed class for responsive
+
+ toggleClass(player.elements.wrapper, player.config.classNames.embed, true); // Set speed options from config
+
+ player.options.speed = player.config.speed.options; // Set intial ratio
+
+ setAspectRatio.call(player); // Load the SDK if not already
+
+ if (!is$1.object(window.Vimeo)) {
+ loadScript(player.config.urls.vimeo.sdk).then(function () {
+ vimeo.ready.call(player);
+ }).catch(function (error) {
+ player.debug.warn('Vimeo SDK (player.js) failed to load', error);
+ });
+ } else {
+ vimeo.ready.call(player);
+ }
+ },
+ // API Ready
+ ready: function ready() {
+ var _this = this;
+
+ var player = this;
+ var config = player.config.vimeo;
+
+ var premium = config.premium,
+ referrerPolicy = config.referrerPolicy,
+ frameParams = _objectWithoutProperties(config, ["premium", "referrerPolicy"]); // If the owner has a pro or premium account then we can hide controls etc
+
+
+ if (premium) {
+ Object.assign(frameParams, {
+ controls: false,
+ sidedock: false
+ });
+ } // Get Vimeo params for the iframe
+
+
+ var params = buildUrlParams(_objectSpread2({
+ loop: player.config.loop.active,
+ autoplay: player.autoplay,
+ muted: player.muted,
+ gesture: 'media',
+ playsinline: !this.config.fullscreen.iosNative
+ }, frameParams)); // Get the source URL or ID
+
+ var source = player.media.getAttribute('src'); // Get from <div> if needed
+
+ if (is$1.empty(source)) {
+ source = player.media.getAttribute(player.config.attributes.embed.id);
+ }
+
+ var id = parseId(source); // Build an iframe
+
+ var iframe = createElement('iframe');
+ var src = format(player.config.urls.vimeo.iframe, id, params);
+ iframe.setAttribute('src', src);
+ iframe.setAttribute('allowfullscreen', '');
+ iframe.setAttribute('allow', 'autoplay,fullscreen,picture-in-picture'); // Set the referrer policy if required
+
+ if (!is$1.empty(referrerPolicy)) {
+ iframe.setAttribute('referrerPolicy', referrerPolicy);
+ } // Inject the package
+
+
+ var poster = player.poster;
+
+ if (premium) {
+ iframe.setAttribute('data-poster', poster);
+ player.media = replaceElement(iframe, player.media);
+ } else {
+ var wrapper = createElement('div', {
+ class: player.config.classNames.embedContainer,
+ 'data-poster': poster
+ });
+ wrapper.appendChild(iframe);
+ player.media = replaceElement(wrapper, player.media);
+ } // Get poster image
+
+
+ fetch(format(player.config.urls.vimeo.api, id), 'json').then(function (response) {
+ if (is$1.empty(response)) {
+ return;
+ } // Get the URL for thumbnail
+
+
+ var url = new URL(response[0].thumbnail_large); // Get original image
+
+ url.pathname = "".concat(url.pathname.split('_')[0], ".jpg"); // Set and show poster
+
+ ui.setPoster.call(player, url.href).catch(function () {});
+ }); // Setup instance
+ // https://github.com/vimeo/player.js
+
+ player.embed = new window.Vimeo.Player(iframe, {
+ autopause: player.config.autopause,
+ muted: player.muted
+ });
+ player.media.paused = true;
+ player.media.currentTime = 0; // Disable native text track rendering
+
+ if (player.supported.ui) {
+ player.embed.disableTextTrack();
+ } // Create a faux HTML5 API using the Vimeo API
+
+
+ player.media.play = function () {
+ assurePlaybackState.call(player, true);
+ return player.embed.play();
+ };
+
+ player.media.pause = function () {
+ assurePlaybackState.call(player, false);
+ return player.embed.pause();
+ };
+
+ player.media.stop = function () {
+ player.pause();
+ player.currentTime = 0;
+ }; // Seeking
+
+
+ var currentTime = player.media.currentTime;
+ Object.defineProperty(player.media, 'currentTime', {
+ get: function get() {
+ return currentTime;
+ },
+ set: function set(time) {
+ // Vimeo will automatically play on seek if the video hasn't been played before
+ // Get current paused state and volume etc
+ var embed = player.embed,
+ media = player.media,
+ paused = player.paused,
+ volume = player.volume;
+ var restorePause = paused && !embed.hasPlayed; // Set seeking state and trigger event
+
+ media.seeking = true;
+ triggerEvent.call(player, media, 'seeking'); // If paused, mute until seek is complete
+
+ Promise.resolve(restorePause && embed.setVolume(0)) // Seek
+ .then(function () {
+ return embed.setCurrentTime(time);
+ }) // Restore paused
+ .then(function () {
+ return restorePause && embed.pause();
+ }) // Restore volume
+ .then(function () {
+ return restorePause && embed.setVolume(volume);
+ }).catch(function () {// Do nothing
+ });
+ }
+ }); // Playback speed
+
+ var speed = player.config.speed.selected;
+ Object.defineProperty(player.media, 'playbackRate', {
+ get: function get() {
+ return speed;
+ },
+ set: function set(input) {
+ player.embed.setPlaybackRate(input).then(function () {
+ speed = input;
+ triggerEvent.call(player, player.media, 'ratechange');
+ }).catch(function () {
+ // Cannot set Playback Rate, Video is probably not on Pro account
+ player.options.speed = [1];
+ });
+ }
+ }); // Volume
+
+ var volume = player.config.volume;
+ Object.defineProperty(player.media, 'volume', {
+ get: function get() {
+ return volume;
+ },
+ set: function set(input) {
+ player.embed.setVolume(input).then(function () {
+ volume = input;
+ triggerEvent.call(player, player.media, 'volumechange');
+ });
+ }
+ }); // Muted
+
+ var muted = player.config.muted;
+ Object.defineProperty(player.media, 'muted', {
+ get: function get() {
+ return muted;
+ },
+ set: function set(input) {
+ var toggle = is$1.boolean(input) ? input : false;
+ player.embed.setVolume(toggle ? 0 : player.config.volume).then(function () {
+ muted = toggle;
+ triggerEvent.call(player, player.media, 'volumechange');
+ });
+ }
+ }); // Loop
+
+ var loop = player.config.loop;
+ Object.defineProperty(player.media, 'loop', {
+ get: function get() {
+ return loop;
+ },
+ set: function set(input) {
+ var toggle = is$1.boolean(input) ? input : player.config.loop.active;
+ player.embed.setLoop(toggle).then(function () {
+ loop = toggle;
+ });
+ }
+ }); // Source
+
+ var currentSrc;
+ player.embed.getVideoUrl().then(function (value) {
+ currentSrc = value;
+ controls.setDownloadUrl.call(player);
+ }).catch(function (error) {
+ _this.debug.warn(error);
+ });
+ Object.defineProperty(player.media, 'currentSrc', {
+ get: function get() {
+ return currentSrc;
+ }
+ }); // Ended
+
+ Object.defineProperty(player.media, 'ended', {
+ get: function get() {
+ return player.currentTime === player.duration;
+ }
+ }); // Set aspect ratio based on video size
+
+ Promise.all([player.embed.getVideoWidth(), player.embed.getVideoHeight()]).then(function (dimensions) {
+ var _dimensions = _slicedToArray(dimensions, 2),
+ width = _dimensions[0],
+ height = _dimensions[1];
+
+ player.embed.ratio = [width, height];
+ setAspectRatio.call(_this);
+ }); // Set autopause
+
+ player.embed.setAutopause(player.config.autopause).then(function (state) {
+ player.config.autopause = state;
+ }); // Get title
+
+ player.embed.getVideoTitle().then(function (title) {
+ player.config.title = title;
+ ui.setTitle.call(_this);
+ }); // Get current time
+
+ player.embed.getCurrentTime().then(function (value) {
+ currentTime = value;
+ triggerEvent.call(player, player.media, 'timeupdate');
+ }); // Get duration
+
+ player.embed.getDuration().then(function (value) {
+ player.media.duration = value;
+ triggerEvent.call(player, player.media, 'durationchange');
+ }); // Get captions
+
+ player.embed.getTextTracks().then(function (tracks) {
+ player.media.textTracks = tracks;
+ captions.setup.call(player);
+ });
+ player.embed.on('cuechange', function (_ref) {
+ var _ref$cues = _ref.cues,
+ cues = _ref$cues === void 0 ? [] : _ref$cues;
+ var strippedCues = cues.map(function (cue) {
+ return stripHTML(cue.text);
+ });
+ captions.updateCues.call(player, strippedCues);
+ });
+ player.embed.on('loaded', function () {
+ // Assure state and events are updated on autoplay
+ player.embed.getPaused().then(function (paused) {
+ assurePlaybackState.call(player, !paused);
+
+ if (!paused) {
+ triggerEvent.call(player, player.media, 'playing');
+ }
+ });
+
+ if (is$1.element(player.embed.element) && player.supported.ui) {
+ var frame = player.embed.element; // Fix keyboard focus issues
+ // https://github.com/sampotts/plyr/issues/317
+
+ frame.setAttribute('tabindex', -1);
+ }
+ });
+ player.embed.on('bufferstart', function () {
+ triggerEvent.call(player, player.media, 'waiting');
+ });
+ player.embed.on('bufferend', function () {
+ triggerEvent.call(player, player.media, 'playing');
+ });
+ player.embed.on('play', function () {
+ assurePlaybackState.call(player, true);
+ triggerEvent.call(player, player.media, 'playing');
+ });
+ player.embed.on('pause', function () {
+ assurePlaybackState.call(player, false);
+ });
+ player.embed.on('timeupdate', function (data) {
+ player.media.seeking = false;
+ currentTime = data.seconds;
+ triggerEvent.call(player, player.media, 'timeupdate');
+ });
+ player.embed.on('progress', function (data) {
+ player.media.buffered = data.percent;
+ triggerEvent.call(player, player.media, 'progress'); // Check all loaded
+
+ if (parseInt(data.percent, 10) === 1) {
+ triggerEvent.call(player, player.media, 'canplaythrough');
+ } // Get duration as if we do it before load, it gives an incorrect value
+ // https://github.com/sampotts/plyr/issues/891
+
+
+ player.embed.getDuration().then(function (value) {
+ if (value !== player.media.duration) {
+ player.media.duration = value;
+ triggerEvent.call(player, player.media, 'durationchange');
+ }
+ });
+ });
+ player.embed.on('seeked', function () {
+ player.media.seeking = false;
+ triggerEvent.call(player, player.media, 'seeked');
+ });
+ player.embed.on('ended', function () {
+ player.media.paused = true;
+ triggerEvent.call(player, player.media, 'ended');
+ });
+ player.embed.on('error', function (detail) {
+ player.media.error = detail;
+ triggerEvent.call(player, player.media, 'error');
+ }); // Rebuild UI
+
+ setTimeout(function () {
+ return ui.build.call(player);
+ }, 0);
+ }
+};
+
+// ==========================================================================
+
+function parseId$1(url) {
+ if (is$1.empty(url)) {
+ return null;
+ }
+
+ var regex = /^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*/;
+ return url.match(regex) ? RegExp.$2 : url;
+} // Set playback state and trigger change (only on actual change)
+
+
+function assurePlaybackState$1(play) {
+ if (play && !this.embed.hasPlayed) {
+ this.embed.hasPlayed = true;
+ }
+
+ if (this.media.paused === play) {
+ this.media.paused = !play;
+ triggerEvent.call(this, this.media, play ? 'play' : 'pause');
+ }
+}
+
+function getHost(config) {
+ if (config.noCookie) {
+ return 'https://www.youtube-nocookie.com';
+ }
+
+ if (window.location.protocol === 'http:') {
+ return 'http://www.youtube.com';
+ } // Use YouTube's default
+
+
+ return undefined;
+}
+
+var youtube = {
+ setup: function setup() {
+ var _this = this;
+
+ // Add embed class for responsive
+ toggleClass(this.elements.wrapper, this.config.classNames.embed, true); // Setup API
+
+ if (is$1.object(window.YT) && is$1.function(window.YT.Player)) {
+ youtube.ready.call(this);
+ } else {
+ // Reference current global callback
+ var callback = window.onYouTubeIframeAPIReady; // Set callback to process queue
+
+ window.onYouTubeIframeAPIReady = function () {
+ // Call global callback if set
+ if (is$1.function(callback)) {
+ callback();
+ }
+
+ youtube.ready.call(_this);
+ }; // Load the SDK
+
+
+ loadScript(this.config.urls.youtube.sdk).catch(function (error) {
+ _this.debug.warn('YouTube API failed to load', error);
+ });
+ }
+ },
+ // Get the media title
+ getTitle: function getTitle(videoId) {
+ var _this2 = this;
+
+ var url = format(this.config.urls.youtube.api, videoId);
+ fetch(url).then(function (data) {
+ if (is$1.object(data)) {
+ var title = data.title,
+ height = data.height,
+ width = data.width; // Set title
+
+ _this2.config.title = title;
+ ui.setTitle.call(_this2); // Set aspect ratio
+
+ _this2.embed.ratio = [width, height];
+ }
+
+ setAspectRatio.call(_this2);
+ }).catch(function () {
+ // Set aspect ratio
+ setAspectRatio.call(_this2);
+ });
+ },
+ // API ready
+ ready: function ready() {
+ var player = this; // Ignore already setup (race condition)
+
+ var currentId = player.media && player.media.getAttribute('id');
+
+ if (!is$1.empty(currentId) && currentId.startsWith('youtube-')) {
+ return;
+ } // Get the source URL or ID
+
+
+ var source = player.media.getAttribute('src'); // Get from <div> if needed
+
+ if (is$1.empty(source)) {
+ source = player.media.getAttribute(this.config.attributes.embed.id);
+ } // Replace the <iframe> with a <div> due to YouTube API issues
+
+
+ var videoId = parseId$1(source);
+ var id = generateId(player.provider); // Get poster, if already set
+
+ var poster = player.poster; // Replace media element
+
+ var container = createElement('div', {
+ id: id,
+ 'data-poster': poster
+ });
+ player.media = replaceElement(container, player.media); // Id to poster wrapper
+
+ var posterSrc = function posterSrc(s) {
+ return "https://i.ytimg.com/vi/".concat(videoId, "/").concat(s, "default.jpg");
+ }; // Check thumbnail images in order of quality, but reject fallback thumbnails (120px wide)
+
+
+ loadImage(posterSrc('maxres'), 121) // Higest quality and unpadded
+ .catch(function () {
+ return loadImage(posterSrc('sd'), 121);
+ }) // 480p padded 4:3
+ .catch(function () {
+ return loadImage(posterSrc('hq'));
+ }) // 360p padded 4:3. Always exists
+ .then(function (image) {
+ return ui.setPoster.call(player, image.src);
+ }).then(function (src) {
+ // If the image is padded, use background-size "cover" instead (like youtube does too with their posters)
+ if (!src.includes('maxres')) {
+ player.elements.poster.style.backgroundSize = 'cover';
+ }
+ }).catch(function () {});
+ var config = player.config.youtube; // Setup instance
+ // https://developers.google.com/youtube/iframe_api_reference
+
+ player.embed = new window.YT.Player(id, {
+ videoId: videoId,
+ host: getHost(config),
+ playerVars: extend({}, {
+ autoplay: player.config.autoplay ? 1 : 0,
+ // Autoplay
+ hl: player.config.hl,
+ // iframe interface language
+ controls: player.supported.ui ? 0 : 1,
+ // Only show controls if not fully supported
+ disablekb: 1,
+ // Disable keyboard as we handle it
+ playsinline: !player.config.fullscreen.iosNative ? 1 : 0,
+ // Allow iOS inline playback
+ // Captions are flaky on YouTube
+ cc_load_policy: player.captions.active ? 1 : 0,
+ cc_lang_pref: player.config.captions.language,
+ // Tracking for stats
+ widget_referrer: window ? window.location.href : null
+ }, config),
+ events: {
+ onError: function onError(event) {
+ // YouTube may fire onError twice, so only handle it once
+ if (!player.media.error) {
+ var code = event.data; // Messages copied from https://developers.google.com/youtube/iframe_api_reference#onError
+
+ var message = {
+ 2: 'The request contains an invalid parameter value. For example, this error occurs if you specify a video ID that does not have 11 characters, or if the video ID contains invalid characters, such as exclamation points or asterisks.',
+ 5: 'The requested content cannot be played in an HTML5 player or another error related to the HTML5 player has occurred.',
+ 100: 'The video requested was not found. This error occurs when a video has been removed (for any reason) or has been marked as private.',
+ 101: 'The owner of the requested video does not allow it to be played in embedded players.',
+ 150: 'The owner of the requested video does not allow it to be played in embedded players.'
+ }[code] || 'An unknown error occured';
+ player.media.error = {
+ code: code,
+ message: message
+ };
+ triggerEvent.call(player, player.media, 'error');
+ }
+ },
+ onPlaybackRateChange: function onPlaybackRateChange(event) {
+ // Get the instance
+ var instance = event.target; // Get current speed
+
+ player.media.playbackRate = instance.getPlaybackRate();
+ triggerEvent.call(player, player.media, 'ratechange');
+ },
+ onReady: function onReady(event) {
+ // Bail if onReady has already been called. See issue #1108
+ if (is$1.function(player.media.play)) {
+ return;
+ } // Get the instance
+
+
+ var instance = event.target; // Get the title
+
+ youtube.getTitle.call(player, videoId); // Create a faux HTML5 API using the YouTube API
+
+ player.media.play = function () {
+ assurePlaybackState$1.call(player, true);
+ instance.playVideo();
+ };
+
+ player.media.pause = function () {
+ assurePlaybackState$1.call(player, false);
+ instance.pauseVideo();
+ };
+
+ player.media.stop = function () {
+ instance.stopVideo();
+ };
+
+ player.media.duration = instance.getDuration();
+ player.media.paused = true; // Seeking
+
+ player.media.currentTime = 0;
+ Object.defineProperty(player.media, 'currentTime', {
+ get: function get() {
+ return Number(instance.getCurrentTime());
+ },
+ set: function set(time) {
+ // If paused and never played, mute audio preventively (YouTube starts playing on seek if the video hasn't been played yet).
+ if (player.paused && !player.embed.hasPlayed) {
+ player.embed.mute();
+ } // Set seeking state and trigger event
+
+
+ player.media.seeking = true;
+ triggerEvent.call(player, player.media, 'seeking'); // Seek after events sent
+
+ instance.seekTo(time);
+ }
+ }); // Playback speed
+
+ Object.defineProperty(player.media, 'playbackRate', {
+ get: function get() {
+ return instance.getPlaybackRate();
+ },
+ set: function set(input) {
+ instance.setPlaybackRate(input);
+ }
+ }); // Volume
+
+ var volume = player.config.volume;
+ Object.defineProperty(player.media, 'volume', {
+ get: function get() {
+ return volume;
+ },
+ set: function set(input) {
+ volume = input;
+ instance.setVolume(volume * 100);
+ triggerEvent.call(player, player.media, 'volumechange');
+ }
+ }); // Muted
+
+ var muted = player.config.muted;
+ Object.defineProperty(player.media, 'muted', {
+ get: function get() {
+ return muted;
+ },
+ set: function set(input) {
+ var toggle = is$1.boolean(input) ? input : muted;
+ muted = toggle;
+ instance[toggle ? 'mute' : 'unMute']();
+ triggerEvent.call(player, player.media, 'volumechange');
+ }
+ }); // Source
+
+ Object.defineProperty(player.media, 'currentSrc', {
+ get: function get() {
+ return instance.getVideoUrl();
+ }
+ }); // Ended
+
+ Object.defineProperty(player.media, 'ended', {
+ get: function get() {
+ return player.currentTime === player.duration;
+ }
+ }); // Get available speeds
+
+ var speeds = instance.getAvailablePlaybackRates(); // Filter based on config
+
+ player.options.speed = speeds.filter(function (s) {
+ return player.config.speed.options.includes(s);
+ }); // Set the tabindex to avoid focus entering iframe
+
+ if (player.supported.ui) {
+ player.media.setAttribute('tabindex', -1);
+ }
+
+ triggerEvent.call(player, player.media, 'timeupdate');
+ triggerEvent.call(player, player.media, 'durationchange'); // Reset timer
+
+ clearInterval(player.timers.buffering); // Setup buffering
+
+ player.timers.buffering = setInterval(function () {
+ // Get loaded % from YouTube
+ player.media.buffered = instance.getVideoLoadedFraction(); // Trigger progress only when we actually buffer something
+
+ if (player.media.lastBuffered === null || player.media.lastBuffered < player.media.buffered) {
+ triggerEvent.call(player, player.media, 'progress');
+ } // Set last buffer point
+
+
+ player.media.lastBuffered = player.media.buffered; // Bail if we're at 100%
+
+ if (player.media.buffered === 1) {
+ clearInterval(player.timers.buffering); // Trigger event
+
+ triggerEvent.call(player, player.media, 'canplaythrough');
+ }
+ }, 200); // Rebuild UI
+
+ setTimeout(function () {
+ return ui.build.call(player);
+ }, 50);
+ },
+ onStateChange: function onStateChange(event) {
+ // Get the instance
+ var instance = event.target; // Reset timer
+
+ clearInterval(player.timers.playing);
+ var seeked = player.media.seeking && [1, 2].includes(event.data);
+
+ if (seeked) {
+ // Unset seeking and fire seeked event
+ player.media.seeking = false;
+ triggerEvent.call(player, player.media, 'seeked');
+ } // Handle events
+ // -1 Unstarted
+ // 0 Ended
+ // 1 Playing
+ // 2 Paused
+ // 3 Buffering
+ // 5 Video cued
+
+
+ switch (event.data) {
+ case -1:
+ // Update scrubber
+ triggerEvent.call(player, player.media, 'timeupdate'); // Get loaded % from YouTube
+
+ player.media.buffered = instance.getVideoLoadedFraction();
+ triggerEvent.call(player, player.media, 'progress');
+ break;
+
+ case 0:
+ assurePlaybackState$1.call(player, false); // YouTube doesn't support loop for a single video, so mimick it.
+
+ if (player.media.loop) {
+ // YouTube needs a call to `stopVideo` before playing again
+ instance.stopVideo();
+ instance.playVideo();
+ } else {
+ triggerEvent.call(player, player.media, 'ended');
+ }
+
+ break;
+
+ case 1:
+ // Restore paused state (YouTube starts playing on seek if the video hasn't been played yet)
+ if (!player.config.autoplay && player.media.paused && !player.embed.hasPlayed) {
+ player.media.pause();
+ } else {
+ assurePlaybackState$1.call(player, true);
+ triggerEvent.call(player, player.media, 'playing'); // Poll to get playback progress
+
+ player.timers.playing = setInterval(function () {
+ triggerEvent.call(player, player.media, 'timeupdate');
+ }, 50); // Check duration again due to YouTube bug
+ // https://github.com/sampotts/plyr/issues/374
+ // https://code.google.com/p/gdata-issues/issues/detail?id=8690
+
+ if (player.media.duration !== instance.getDuration()) {
+ player.media.duration = instance.getDuration();
+ triggerEvent.call(player, player.media, 'durationchange');
+ }
+ }
+
+ break;
+
+ case 2:
+ // Restore audio (YouTube starts playing on seek if the video hasn't been played yet)
+ if (!player.muted) {
+ player.embed.unMute();
+ }
+
+ assurePlaybackState$1.call(player, false);
+ break;
+
+ case 3:
+ // Trigger waiting event to add loading classes to container as the video buffers.
+ triggerEvent.call(player, player.media, 'waiting');
+ break;
+ }
+
+ triggerEvent.call(player, player.elements.container, 'statechange', false, {
+ code: event.data
+ });
+ }
+ }
+ });
+ }
+};
+
+// ==========================================================================
+var media = {
+ // Setup media
+ setup: function setup() {
+ // If there's no media, bail
+ if (!this.media) {
+ this.debug.warn('No media element found!');
+ return;
+ } // Add type class
+
+
+ toggleClass(this.elements.container, this.config.classNames.type.replace('{0}', this.type), true); // Add provider class
+
+ toggleClass(this.elements.container, this.config.classNames.provider.replace('{0}', this.provider), true); // Add video class for embeds
+ // This will require changes if audio embeds are added
+
+ if (this.isEmbed) {
+ toggleClass(this.elements.container, this.config.classNames.type.replace('{0}', 'video'), true);
+ } // Inject the player wrapper
+
+
+ if (this.isVideo) {
+ // Create the wrapper div
+ this.elements.wrapper = createElement('div', {
+ class: this.config.classNames.video
+ }); // Wrap the video in a container
+
+ wrap(this.media, this.elements.wrapper); // Poster image container
+
+ this.elements.poster = createElement('div', {
+ class: this.config.classNames.poster
+ });
+ this.elements.wrapper.appendChild(this.elements.poster);
+ }
+
+ if (this.isHTML5) {
+ html5.setup.call(this);
+ } else if (this.isYouTube) {
+ youtube.setup.call(this);
+ } else if (this.isVimeo) {
+ vimeo.setup.call(this);
+ }
+ }
+};
+
+var destroy = function destroy(instance) {
+ // Destroy our adsManager
+ if (instance.manager) {
+ instance.manager.destroy();
+ } // Destroy our adsManager
+
+
+ if (instance.elements.displayContainer) {
+ instance.elements.displayContainer.destroy();
+ }
+
+ instance.elements.container.remove();
+};
+
+var Ads = /*#__PURE__*/function () {
+ /**
+ * Ads constructor.
+ * @param {Object} player
+ * @return {Ads}
+ */
+ function Ads(player) {
+ var _this = this;
+
+ _classCallCheck(this, Ads);
+
+ this.player = player;
+ this.config = player.config.ads;
+ this.playing = false;
+ this.initialized = false;
+ this.elements = {
+ container: null,
+ displayContainer: null
+ };
+ this.manager = null;
+ this.loader = null;
+ this.cuePoints = null;
+ this.events = {};
+ this.safetyTimer = null;
+ this.countdownTimer = null; // Setup a promise to resolve when the IMA manager is ready
+
+ this.managerPromise = new Promise(function (resolve, reject) {
+ // The ad is loaded and ready
+ _this.on('loaded', resolve); // Ads failed
+
+
+ _this.on('error', reject);
+ });
+ this.load();
+ }
+
+ _createClass(Ads, [{
+ key: "load",
+
+ /**
+ * Load the IMA SDK
+ */
+ value: function load() {
+ var _this2 = this;
+
+ if (!this.enabled) {
+ return;
+ } // Check if the Google IMA3 SDK is loaded or load it ourselves
+
+
+ if (!is$1.object(window.google) || !is$1.object(window.google.ima)) {
+ loadScript(this.player.config.urls.googleIMA.sdk).then(function () {
+ _this2.ready();
+ }).catch(function () {
+ // Script failed to load or is blocked
+ _this2.trigger('error', new Error('Google IMA SDK failed to load'));
+ });
+ } else {
+ this.ready();
+ }
+ }
+ /**
+ * Get the ads instance ready
+ */
+
+ }, {
+ key: "ready",
+ value: function ready() {
+ var _this3 = this;
+
+ // Double check we're enabled
+ if (!this.enabled) {
+ destroy(this);
+ } // Start ticking our safety timer. If the whole advertisement
+ // thing doesn't resolve within our set time; we bail
+
+
+ this.startSafetyTimer(12000, 'ready()'); // Clear the safety timer
+
+ this.managerPromise.then(function () {
+ _this3.clearSafetyTimer('onAdsManagerLoaded()');
+ }); // Set listeners on the Plyr instance
+
+ this.listeners(); // Setup the IMA SDK
+
+ this.setupIMA();
+ } // Build the tag URL
+
+ }, {
+ key: "setupIMA",
+
+ /**
+ * In order for the SDK to display ads for our video, we need to tell it where to put them,
+ * so here we define our ad container. This div is set up to render on top of the video player.
+ * Using the code below, we tell the SDK to render ads within that div. We also provide a
+ * handle to the content video player - the SDK will poll the current time of our player to
+ * properly place mid-rolls. After we create the ad display container, we initialize it. On
+ * mobile devices, this initialization is done as the result of a user action.
+ */
+ value: function setupIMA() {
+ var _this4 = this;
+
+ // Create the container for our advertisements
+ this.elements.container = createElement('div', {
+ class: this.player.config.classNames.ads
+ });
+ this.player.elements.container.appendChild(this.elements.container); // So we can run VPAID2
+
+ google.ima.settings.setVpaidMode(google.ima.ImaSdkSettings.VpaidMode.ENABLED); // Set language
+
+ google.ima.settings.setLocale(this.player.config.ads.language); // Set playback for iOS10+
+
+ 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
+
+ this.elements.displayContainer = new google.ima.AdDisplayContainer(this.elements.container, this.player.media); // Create ads loader
+
+ this.loader = new google.ima.AdsLoader(this.elements.displayContainer); // Listen and respond to ads loaded and error events
+
+ this.loader.addEventListener(google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED, function (event) {
+ return _this4.onAdsManagerLoaded(event);
+ }, false);
+ this.loader.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR, function (error) {
+ return _this4.onAdError(error);
+ }, false); // Request video ads to be pre-loaded
+
+ this.requestAds();
+ }
+ /**
+ * Request advertisements
+ */
+
+ }, {
+ key: "requestAds",
+ value: function requestAds() {
+ var container = this.player.elements.container;
+
+ try {
+ // Request video ads
+ var request = new google.ima.AdsRequest();
+ request.adTagUrl = this.tagUrl; // Specify the linear and nonlinear slot sizes. This helps the SDK
+ // to select the correct creative if multiple are returned
+
+ request.linearAdSlotWidth = container.offsetWidth;
+ request.linearAdSlotHeight = container.offsetHeight;
+ request.nonLinearAdSlotWidth = container.offsetWidth;
+ request.nonLinearAdSlotHeight = container.offsetHeight; // We only overlay ads as we only support video.
+
+ request.forceNonLinearFullSlot = false; // Mute based on current state
+
+ request.setAdWillPlayMuted(!this.player.muted);
+ this.loader.requestAds(request);
+ } catch (e) {
+ this.onAdError(e);
+ }
+ }
+ /**
+ * Update the ad countdown
+ * @param {Boolean} start
+ */
+
+ }, {
+ key: "pollCountdown",
+ value: function pollCountdown() {
+ var _this5 = this;
+
+ var start = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
+
+ if (!start) {
+ clearInterval(this.countdownTimer);
+ this.elements.container.removeAttribute('data-badge-text');
+ return;
+ }
+
+ var update = function update() {
+ var time = formatTime(Math.max(_this5.manager.getRemainingTime(), 0));
+ var label = "".concat(i18n.get('advertisement', _this5.player.config), " - ").concat(time);
+
+ _this5.elements.container.setAttribute('data-badge-text', label);
+ };
+
+ this.countdownTimer = setInterval(update, 100);
+ }
+ /**
+ * This method is called whenever the ads are ready inside the AdDisplayContainer
+ * @param {Event} adsManagerLoadedEvent
+ */
+
+ }, {
+ key: "onAdsManagerLoaded",
+ value: function onAdsManagerLoaded(event) {
+ var _this6 = this;
+
+ // Load could occur after a source change (race condition)
+ if (!this.enabled) {
+ return;
+ } // Get the ads manager
+
+
+ var settings = new google.ima.AdsRenderingSettings(); // Tell the SDK to save and restore content video state on our behalf
+
+ settings.restoreCustomPlaybackStateOnAdBreakComplete = true;
+ settings.enablePreloading = true; // The SDK is polling currentTime on the contentPlayback. And needs a duration
+ // so it can determine when to start the mid- and post-roll
+
+ this.manager = event.getAdsManager(this.player, settings); // Get the cue points for any mid-rolls by filtering out the pre- and post-roll
+
+ this.cuePoints = this.manager.getCuePoints(); // Add listeners to the required events
+ // Advertisement error events
+
+ this.manager.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR, function (error) {
+ return _this6.onAdError(error);
+ }); // Advertisement regular events
+
+ Object.keys(google.ima.AdEvent.Type).forEach(function (type) {
+ _this6.manager.addEventListener(google.ima.AdEvent.Type[type], function (e) {
+ return _this6.onAdEvent(e);
+ });
+ }); // Resolve our adsManager
+
+ this.trigger('loaded');
+ }
+ }, {
+ key: "addCuePoints",
+ value: function addCuePoints() {
+ var _this7 = this;
+
+ // Add advertisement cue's within the time line if available
+ if (!is$1.empty(this.cuePoints)) {
+ this.cuePoints.forEach(function (cuePoint) {
+ if (cuePoint !== 0 && cuePoint !== -1 && cuePoint < _this7.player.duration) {
+ var seekElement = _this7.player.elements.progress;
+
+ if (is$1.element(seekElement)) {
+ var cuePercentage = 100 / _this7.player.duration * cuePoint;
+ var cue = createElement('span', {
+ class: _this7.player.config.classNames.cues
+ });
+ cue.style.left = "".concat(cuePercentage.toString(), "%");
+ seekElement.appendChild(cue);
+ }
+ }
+ });
+ }
+ }
+ /**
+ * This is where all the event handling takes place. Retrieve the ad from the event. Some
+ * events (e.g. ALL_ADS_COMPLETED) don't have the ad object associated
+ * https://developers.google.com/interactive-media-ads/docs/sdks/html5/v3/apis#ima.AdEvent.Type
+ * @param {Event} event
+ */
+
+ }, {
+ key: "onAdEvent",
+ value: function onAdEvent(event) {
+ var _this8 = this;
+
+ var container = this.player.elements.container; // Retrieve the ad from the event. Some events (e.g. ALL_ADS_COMPLETED)
+ // don't have ad object associated
+
+ var ad = event.getAd();
+ var adData = event.getAdData(); // Proxy event
+
+ var dispatchEvent = function dispatchEvent(type) {
+ triggerEvent.call(_this8.player, _this8.player.media, "ads".concat(type.replace(/_/g, '').toLowerCase()));
+ }; // Bubble the event
+
+
+ dispatchEvent(event.type);
+
+ switch (event.type) {
+ case google.ima.AdEvent.Type.LOADED:
+ // This is the first event sent for an ad - it is possible to determine whether the
+ // ad is a video ad or an overlay
+ this.trigger('loaded'); // Start countdown
+
+ this.pollCountdown(true);
+
+ if (!ad.isLinear()) {
+ // Position AdDisplayContainer correctly for overlay
+ ad.width = container.offsetWidth;
+ ad.height = container.offsetHeight;
+ } // console.info('Ad type: ' + event.getAd().getAdPodInfo().getPodIndex());
+ // console.info('Ad time: ' + event.getAd().getAdPodInfo().getTimeOffset());
+
+
+ break;
+
+ case google.ima.AdEvent.Type.STARTED:
+ // Set volume to match player
+ this.manager.setVolume(this.player.volume);
+ break;
+
+ case google.ima.AdEvent.Type.ALL_ADS_COMPLETED:
+ // All ads for the current videos are done. We can now request new advertisements
+ // in case the video is re-played
+ // TODO: Example for what happens when a next video in a playlist would be loaded.
+ // So here we load a new video when all ads are done.
+ // Then we load new ads within a new adsManager. When the video
+ // Is started - after - the ads are loaded, then we get ads.
+ // You can also easily test cancelling and reloading by running
+ // player.ads.cancel() and player.ads.play from the console I guess.
+ // this.player.source = {
+ // type: 'video',
+ // title: 'View From A Blue Moon',
+ // sources: [{
+ // src:
+ // 'https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.mp4', type:
+ // 'video/mp4', }], poster:
+ // 'https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.jpg', tracks:
+ // [ { kind: 'captions', label: 'English', srclang: 'en', src:
+ // 'https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.en.vtt',
+ // default: true, }, { kind: 'captions', label: 'French', srclang: 'fr', src:
+ // 'https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.fr.vtt', }, ],
+ // };
+ // TODO: So there is still this thing where a video should only be allowed to start
+ // playing when the IMA SDK is ready or has failed
+ if (this.player.ended) {
+ this.loadAds();
+ } else {
+ // The SDK won't allow new ads to be called without receiving a contentComplete()
+ this.loader.contentComplete();
+ }
+
+ break;
+
+ case google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED:
+ // This event indicates the ad has started - the video player can adjust the UI,
+ // for example display a pause button and remaining time. Fired when content should
+ // be paused. This usually happens right before an ad is about to cover the content
+ this.pauseContent();
+ break;
+
+ case google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED:
+ // This event indicates the ad has finished - the video player can perform
+ // appropriate UI actions, such as removing the timer for remaining time detection.
+ // Fired when content should be resumed. This usually happens when an ad finishes
+ // or collapses
+ this.pollCountdown();
+ this.resumeContent();
+ break;
+
+ case google.ima.AdEvent.Type.LOG:
+ if (adData.adError) {
+ this.player.debug.warn("Non-fatal ad error: ".concat(adData.adError.getMessage()));
+ }
+
+ break;
+ }
+ }
+ /**
+ * Any ad error handling comes through here
+ * @param {Event} event
+ */
+
+ }, {
+ key: "onAdError",
+ value: function onAdError(event) {
+ this.cancel();
+ this.player.debug.warn('Ads error', event);
+ }
+ /**
+ * Setup hooks for Plyr and window events. This ensures
+ * the mid- and post-roll launch at the correct time. And
+ * resize the advertisement when the player resizes
+ */
+
+ }, {
+ key: "listeners",
+ value: function listeners() {
+ var _this9 = this;
+
+ var container = this.player.elements.container;
+ var time;
+ this.player.on('canplay', function () {
+ _this9.addCuePoints();
+ });
+ this.player.on('ended', function () {
+ _this9.loader.contentComplete();
+ });
+ this.player.on('timeupdate', function () {
+ time = _this9.player.currentTime;
+ });
+ this.player.on('seeked', function () {
+ var seekedTime = _this9.player.currentTime;
+
+ if (is$1.empty(_this9.cuePoints)) {
+ return;
+ }
+
+ _this9.cuePoints.forEach(function (cuePoint, index) {
+ if (time < cuePoint && cuePoint < seekedTime) {
+ _this9.manager.discardAdBreak();
+
+ _this9.cuePoints.splice(index, 1);
+ }
+ });
+ }); // Listen to the resizing of the window. And resize ad accordingly
+ // TODO: eventually implement ResizeObserver
+
+ window.addEventListener('resize', function () {
+ if (_this9.manager) {
+ _this9.manager.resize(container.offsetWidth, container.offsetHeight, google.ima.ViewMode.NORMAL);
+ }
+ });
+ }
+ /**
+ * Initialize the adsManager and start playing advertisements
+ */
+
+ }, {
+ key: "play",
+ value: function play() {
+ var _this10 = this;
+
+ var container = this.player.elements.container;
+
+ if (!this.managerPromise) {
+ this.resumeContent();
+ } // Play the requested advertisement whenever the adsManager is ready
+
+
+ this.managerPromise.then(function () {
+ // Set volume to match player
+ _this10.manager.setVolume(_this10.player.volume); // Initialize the container. Must be done via a user action on mobile devices
+
+
+ _this10.elements.displayContainer.initialize();
+
+ try {
+ if (!_this10.initialized) {
+ // Initialize the ads manager. Ad rules playlist will start at this time
+ _this10.manager.init(container.offsetWidth, container.offsetHeight, google.ima.ViewMode.NORMAL); // Call play to start showing the ad. Single video and overlay ads will
+ // start at this time; the call will be ignored for ad rules
+
+
+ _this10.manager.start();
+ }
+
+ _this10.initialized = true;
+ } catch (adError) {
+ // An error may be thrown if there was a problem with the
+ // VAST response
+ _this10.onAdError(adError);
+ }
+ }).catch(function () {});
+ }
+ /**
+ * Resume our video
+ */
+
+ }, {
+ key: "resumeContent",
+ value: function resumeContent() {
+ // Hide the advertisement container
+ this.elements.container.style.zIndex = ''; // Ad is stopped
+
+ this.playing = false; // Play video
+
+ silencePromise(this.player.media.play());
+ }
+ /**
+ * Pause our video
+ */
+
+ }, {
+ key: "pauseContent",
+ value: function pauseContent() {
+ // Show the advertisement container
+ this.elements.container.style.zIndex = 3; // Ad is playing
+
+ this.playing = true; // Pause our video.
+
+ this.player.media.pause();
+ }
+ /**
+ * Destroy the adsManager so we can grab new ads after this. If we don't then we're not
+ * allowed to call new ads based on google policies, as they interpret this as an accidental
+ * video requests. https://developers.google.com/interactive-
+ * media-ads/docs/sdks/android/faq#8
+ */
+
+ }, {
+ key: "cancel",
+ value: function cancel() {
+ // Pause our video
+ if (this.initialized) {
+ this.resumeContent();
+ } // Tell our instance that we're done for now
+
+
+ this.trigger('error'); // Re-create our adsManager
+
+ this.loadAds();
+ }
+ /**
+ * Re-create our adsManager
+ */
+
+ }, {
+ key: "loadAds",
+ value: function loadAds() {
+ var _this11 = this;
+
+ // Tell our adsManager to go bye bye
+ this.managerPromise.then(function () {
+ // Destroy our adsManager
+ if (_this11.manager) {
+ _this11.manager.destroy();
+ } // Re-set our adsManager promises
+
+
+ _this11.managerPromise = new Promise(function (resolve) {
+ _this11.on('loaded', resolve);
+
+ _this11.player.debug.log(_this11.manager);
+ }); // Now that the manager has been destroyed set it to also be un-initialized
+
+ _this11.initialized = false; // Now request some new advertisements
+
+ _this11.requestAds();
+ }).catch(function () {});
+ }
+ /**
+ * Handles callbacks after an ad event was invoked
+ * @param {String} event - Event type
+ */
+
+ }, {
+ key: "trigger",
+ value: function trigger(event) {
+ var _this12 = this;
+
+ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
+ args[_key - 1] = arguments[_key];
+ }
+
+ var handlers = this.events[event];
+
+ if (is$1.array(handlers)) {
+ handlers.forEach(function (handler) {
+ if (is$1.function(handler)) {
+ handler.apply(_this12, args);
+ }
+ });
+ }
+ }
+ /**
+ * Add event listeners
+ * @param {String} event - Event type
+ * @param {Function} callback - Callback for when event occurs
+ * @return {Ads}
+ */
+
+ }, {
+ key: "on",
+ value: function on(event, callback) {
+ if (!is$1.array(this.events[event])) {
+ this.events[event] = [];
+ }
+
+ this.events[event].push(callback);
+ return this;
+ }
+ /**
+ * Setup a safety timer for when the ad network doesn't respond for whatever reason.
+ * The advertisement has 12 seconds to get its things together. We stop this timer when the
+ * advertisement is playing, or when a user action is required to start, then we clear the
+ * timer on ad ready
+ * @param {Number} time
+ * @param {String} from
+ */
+
+ }, {
+ key: "startSafetyTimer",
+ value: function startSafetyTimer(time, from) {
+ var _this13 = this;
+
+ this.player.debug.log("Safety timer invoked from: ".concat(from));
+ this.safetyTimer = setTimeout(function () {
+ _this13.cancel();
+
+ _this13.clearSafetyTimer('startSafetyTimer()');
+ }, time);
+ }
+ /**
+ * Clear our safety timer(s)
+ * @param {String} from
+ */
+
+ }, {
+ key: "clearSafetyTimer",
+ value: function clearSafetyTimer(from) {
+ if (!is$1.nullOrUndefined(this.safetyTimer)) {
+ this.player.debug.log("Safety timer cleared from: ".concat(from));
+ clearTimeout(this.safetyTimer);
+ this.safetyTimer = null;
+ }
+ }
+ }, {
+ key: "enabled",
+ get: function get() {
+ var config = this.config;
+ return this.player.isHTML5 && this.player.isVideo && config.enabled && (!is$1.empty(config.publisherId) || is$1.url(config.tagUrl));
+ }
+ }, {
+ key: "tagUrl",
+ get: function get() {
+ var config = this.config;
+
+ if (is$1.url(config.tagUrl)) {
+ return config.tagUrl;
+ }
+
+ var params = {
+ AV_PUBLISHERID: '58c25bb0073ef448b1087ad6',
+ AV_CHANNELID: '5a0458dc28a06145e4519d21',
+ AV_URL: window.location.hostname,
+ cb: Date.now(),
+ AV_WIDTH: 640,
+ AV_HEIGHT: 480,
+ AV_CDIM2: config.publisherId
+ };
+ var base = 'https://go.aniview.com/api/adserver6/vast/';
+ return "".concat(base, "?").concat(buildUrlParams(params));
+ }
+ }]);
+
+ return Ads;
+}();
+
+var parseVtt = function parseVtt(vttDataString) {
+ var processedList = [];
+ var frames = vttDataString.split(/\r\n\r\n|\n\n|\r\r/);
+ frames.forEach(function (frame) {
+ var result = {};
+ var lines = frame.split(/\r\n|\n|\r/);
+ lines.forEach(function (line) {
+ if (!is$1.number(result.startTime)) {
+ // The line with start and end times on it is the first line of interest
+ 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
+
+ if (matchTimes) {
+ result.startTime = Number(matchTimes[1] || 0) * 60 * 60 + Number(matchTimes[2]) * 60 + Number(matchTimes[3]) + Number("0.".concat(matchTimes[4]));
+ result.endTime = Number(matchTimes[6] || 0) * 60 * 60 + Number(matchTimes[7]) * 60 + Number(matchTimes[8]) + Number("0.".concat(matchTimes[9]));
+ }
+ } else if (!is$1.empty(line.trim()) && is$1.empty(result.text)) {
+ // If we already have the startTime, then we're definitely up to the text line(s)
+ var lineSplit = line.trim().split('#xywh=');
+
+ var _lineSplit = _slicedToArray(lineSplit, 1);
+
+ result.text = _lineSplit[0];
+
+ // If there's content in lineSplit[1], then we have sprites. If not, then it's just one frame per image
+ if (lineSplit[1]) {
+ var _lineSplit$1$split = lineSplit[1].split(',');
+
+ var _lineSplit$1$split2 = _slicedToArray(_lineSplit$1$split, 4);
+
+ result.x = _lineSplit$1$split2[0];
+ result.y = _lineSplit$1$split2[1];
+ result.w = _lineSplit$1$split2[2];
+ result.h = _lineSplit$1$split2[3];
+ }
+ }
+ });
+
+ if (result.text) {
+ processedList.push(result);
+ }
+ });
+ return processedList;
+};
+/**
+ * Preview thumbnails for seek hover and scrubbing
+ * Seeking: Hover over the seek bar (desktop only): shows a small preview container above the seek bar
+ * 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
+ *
+ * Notes:
+ * - 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
+ * - 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
+ * - 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
+ */
+
+
+var fitRatio = function fitRatio(ratio, outer) {
+ var targetRatio = outer.width / outer.height;
+ var result = {};
+
+ if (ratio > targetRatio) {
+ result.width = outer.width;
+ result.height = 1 / ratio * outer.width;
+ } else {
+ result.height = outer.height;
+ result.width = ratio * outer.height;
+ }
+
+ return result;
+};
+
+var PreviewThumbnails = /*#__PURE__*/function () {
+ /**
+ * PreviewThumbnails constructor.
+ * @param {Plyr} player
+ * @return {PreviewThumbnails}
+ */
+ function PreviewThumbnails(player) {
+ _classCallCheck(this, PreviewThumbnails);
+
+ this.player = player;
+ this.thumbnails = [];
+ this.loaded = false;
+ this.lastMouseMoveTime = Date.now();
+ this.mouseDown = false;
+ this.loadedImages = [];
+ this.elements = {
+ thumb: {},
+ scrubbing: {}
+ };
+ this.load();
+ }
+
+ _createClass(PreviewThumbnails, [{
+ key: "load",
+ value: function load() {
+ var _this = this;
+
+ // Toggle the regular seek tooltip
+ if (this.player.elements.display.seekTooltip) {
+ this.player.elements.display.seekTooltip.hidden = this.enabled;
+ }
+
+ if (!this.enabled) {
+ return;
+ }
+
+ this.getThumbnails().then(function () {
+ if (!_this.enabled) {
+ return;
+ } // Render DOM elements
+
+
+ _this.render(); // Check to see if thumb container size was specified manually in CSS
+
+
+ _this.determineContainerAutoSizing();
+
+ _this.loaded = true;
+ });
+ } // Download VTT files and parse them
+
+ }, {
+ key: "getThumbnails",
+ value: function getThumbnails() {
+ var _this2 = this;
+
+ return new Promise(function (resolve) {
+ var src = _this2.player.config.previewThumbnails.src;
+
+ if (is$1.empty(src)) {
+ throw new Error('Missing previewThumbnails.src config attribute');
+ } // Resolve promise
+
+
+ var sortAndResolve = function sortAndResolve() {
+ // Sort smallest to biggest (e.g., [120p, 480p, 1080p])
+ _this2.thumbnails.sort(function (x, y) {
+ return x.height - y.height;
+ });
+
+ _this2.player.debug.log('Preview thumbnails', _this2.thumbnails);
+
+ resolve();
+ }; // Via callback()
+
+
+ if (is$1.function(src)) {
+ src(function (thumbnails) {
+ _this2.thumbnails = thumbnails;
+ sortAndResolve();
+ });
+ } // VTT urls
+ else {
+ // If string, convert into single-element list
+ 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
+
+ var promises = urls.map(function (u) {
+ return _this2.getThumbnail(u);
+ }); // Resolve
+
+ Promise.all(promises).then(sortAndResolve);
+ }
+ });
+ } // Process individual VTT file
+
+ }, {
+ key: "getThumbnail",
+ value: function getThumbnail(url) {
+ var _this3 = this;
+
+ return new Promise(function (resolve) {
+ fetch(url).then(function (response) {
+ var thumbnail = {
+ frames: parseVtt(response),
+ height: null,
+ urlPrefix: ''
+ }; // If the URLs don't start with '/', then we need to set their relative path to be the location of the VTT file
+ // If the URLs do start with '/', then they obviously don't need a prefix, so it will remain blank
+ // 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
+
+ if (!thumbnail.frames[0].text.startsWith('/') && !thumbnail.frames[0].text.startsWith('http://') && !thumbnail.frames[0].text.startsWith('https://')) {
+ thumbnail.urlPrefix = url.substring(0, url.lastIndexOf('/') + 1);
+ } // Download the first frame, so that we can determine/set the height of this thumbnailsDef
+
+
+ var tempImage = new Image();
+
+ tempImage.onload = function () {
+ thumbnail.height = tempImage.naturalHeight;
+ thumbnail.width = tempImage.naturalWidth;
+
+ _this3.thumbnails.push(thumbnail);
+
+ resolve();
+ };
+
+ tempImage.src = thumbnail.urlPrefix + thumbnail.frames[0].text;
+ });
+ });
+ }
+ }, {
+ key: "startMove",
+ value: function startMove(event) {
+ if (!this.loaded) {
+ return;
+ }
+
+ if (!is$1.event(event) || !['touchmove', 'mousemove'].includes(event.type)) {
+ return;
+ } // Wait until media has a duration
+
+
+ if (!this.player.media.duration) {
+ return;
+ }
+
+ if (event.type === 'touchmove') {
+ // Calculate seek hover position as approx video seconds
+ this.seekTime = this.player.media.duration * (this.player.elements.inputs.seek.value / 100);
+ } else {
+ // Calculate seek hover position as approx video seconds
+ var clientRect = this.player.elements.progress.getBoundingClientRect();
+ var percentage = 100 / clientRect.width * (event.pageX - clientRect.left);
+ this.seekTime = this.player.media.duration * (percentage / 100);
+
+ if (this.seekTime < 0) {
+ // The mousemove fires for 10+px out to the left
+ this.seekTime = 0;
+ }
+
+ if (this.seekTime > this.player.media.duration - 1) {
+ // Took 1 second off the duration for safety, because different players can disagree on the real duration of a video
+ this.seekTime = this.player.media.duration - 1;
+ }
+
+ this.mousePosX = event.pageX; // Set time text inside image container
+
+ this.elements.thumb.time.innerText = formatTime(this.seekTime);
+ } // Download and show image
+
+
+ this.showImageAtCurrentTime();
+ }
+ }, {
+ key: "endMove",
+ value: function endMove() {
+ this.toggleThumbContainer(false, true);
+ }
+ }, {
+ key: "startScrubbing",
+ value: function startScrubbing(event) {
+ // Only act on left mouse button (0), or touch device (event.button does not exist or is false)
+ if (is$1.nullOrUndefined(event.button) || event.button === false || event.button === 0) {
+ this.mouseDown = true; // Wait until media has a duration
+
+ if (this.player.media.duration) {
+ this.toggleScrubbingContainer(true);
+ this.toggleThumbContainer(false, true); // Download and show image
+
+ this.showImageAtCurrentTime();
+ }
+ }
+ }
+ }, {
+ key: "endScrubbing",
+ value: function endScrubbing() {
+ var _this4 = this;
+
+ this.mouseDown = false; // Hide scrubbing preview. But wait until the video has successfully seeked before hiding the scrubbing preview
+
+ if (Math.ceil(this.lastTime) === Math.ceil(this.player.media.currentTime)) {
+ // The video was already seeked/loaded at the chosen time - hide immediately
+ this.toggleScrubbingContainer(false);
+ } else {
+ // The video hasn't seeked yet. Wait for that
+ once.call(this.player, this.player.media, 'timeupdate', function () {
+ // Re-check mousedown - we might have already started scrubbing again
+ if (!_this4.mouseDown) {
+ _this4.toggleScrubbingContainer(false);
+ }
+ });
+ }
+ }
+ /**
+ * Setup hooks for Plyr and window events
+ */
+
+ }, {
+ key: "listeners",
+ value: function listeners() {
+ var _this5 = this;
+
+ // 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
+ this.player.on('play', function () {
+ _this5.toggleThumbContainer(false, true);
+ });
+ this.player.on('seeked', function () {
+ _this5.toggleThumbContainer(false);
+ });
+ this.player.on('timeupdate', function () {
+ _this5.lastTime = _this5.player.media.currentTime;
+ });
+ }
+ /**
+ * Create HTML elements for image containers
+ */
+
+ }, {
+ key: "render",
+ value: function render() {
+ // Create HTML element: plyr__preview-thumbnail-container
+ this.elements.thumb.container = createElement('div', {
+ class: this.player.config.classNames.previewThumbnails.thumbContainer
+ }); // Wrapper for the image for styling
+
+ this.elements.thumb.imageContainer = createElement('div', {
+ class: this.player.config.classNames.previewThumbnails.imageContainer
+ });
+ this.elements.thumb.container.appendChild(this.elements.thumb.imageContainer); // Create HTML element, parent+span: time text (e.g., 01:32:00)
+
+ var timeContainer = createElement('div', {
+ class: this.player.config.classNames.previewThumbnails.timeContainer
+ });
+ this.elements.thumb.time = createElement('span', {}, '00:00');
+ timeContainer.appendChild(this.elements.thumb.time);
+ this.elements.thumb.container.appendChild(timeContainer); // Inject the whole thumb
+
+ if (is$1.element(this.player.elements.progress)) {
+ this.player.elements.progress.appendChild(this.elements.thumb.container);
+ } // Create HTML element: plyr__preview-scrubbing-container
+
+
+ this.elements.scrubbing.container = createElement('div', {
+ class: this.player.config.classNames.previewThumbnails.scrubbingContainer
+ });
+ this.player.elements.wrapper.appendChild(this.elements.scrubbing.container);
+ }
+ }, {
+ key: "destroy",
+ value: function destroy() {
+ if (this.elements.thumb.container) {
+ this.elements.thumb.container.remove();
+ }
+
+ if (this.elements.scrubbing.container) {
+ this.elements.scrubbing.container.remove();
+ }
+ }
+ }, {
+ key: "showImageAtCurrentTime",
+ value: function showImageAtCurrentTime() {
+ var _this6 = this;
+
+ if (this.mouseDown) {
+ this.setScrubbingContainerSize();
+ } else {
+ this.setThumbContainerSizeAndPos();
+ } // Find the desired thumbnail index
+ // TODO: Handle a video longer than the thumbs where thumbNum is null
+
+
+ var thumbNum = this.thumbnails[0].frames.findIndex(function (frame) {
+ return _this6.seekTime >= frame.startTime && _this6.seekTime <= frame.endTime;
+ });
+ var hasThumb = thumbNum >= 0;
+ var qualityIndex = 0; // Show the thumb container if we're not scrubbing
+
+ if (!this.mouseDown) {
+ this.toggleThumbContainer(hasThumb);
+ } // No matching thumb found
+
+
+ if (!hasThumb) {
+ return;
+ } // Check to see if we've already downloaded higher quality versions of this image
+
+
+ this.thumbnails.forEach(function (thumbnail, index) {
+ if (_this6.loadedImages.includes(thumbnail.frames[thumbNum].text)) {
+ qualityIndex = index;
+ }
+ }); // Only proceed if either thumbnum or thumbfilename has changed
+
+ if (thumbNum !== this.showingThumb) {
+ this.showingThumb = thumbNum;
+ this.loadImage(qualityIndex);
+ }
+ } // Show the image that's currently specified in this.showingThumb
+
+ }, {
+ key: "loadImage",
+ value: function loadImage() {
+ var _this7 = this;
+
+ var qualityIndex = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
+ var thumbNum = this.showingThumb;
+ var thumbnail = this.thumbnails[qualityIndex];
+ var urlPrefix = thumbnail.urlPrefix;
+ var frame = thumbnail.frames[thumbNum];
+ var thumbFilename = thumbnail.frames[thumbNum].text;
+ var thumbUrl = urlPrefix + thumbFilename;
+
+ if (!this.currentImageElement || this.currentImageElement.dataset.filename !== thumbFilename) {
+ // If we're already loading a previous image, remove its onload handler - we don't want it to load after this one
+ // Only do this if not using sprites. Without sprites we really want to show as many images as possible, as a best-effort
+ if (this.loadingImage && this.usingSprites) {
+ this.loadingImage.onload = null;
+ } // We're building and adding a new image. In other implementations of similar functionality (YouTube), background image
+ // is instead used. But this causes issues with larger images in Firefox and Safari - switching between background
+ // images causes a flicker. Putting a new image over the top does not
+
+
+ var previewImage = new Image();
+ previewImage.src = thumbUrl;
+ previewImage.dataset.index = thumbNum;
+ previewImage.dataset.filename = thumbFilename;
+ this.showingThumbFilename = thumbFilename;
+ 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...
+
+ previewImage.onload = function () {
+ return _this7.showImage(previewImage, frame, qualityIndex, thumbNum, thumbFilename, true);
+ };
+
+ this.loadingImage = previewImage;
+ this.removeOldImages(previewImage);
+ } else {
+ // Update the existing image
+ this.showImage(this.currentImageElement, frame, qualityIndex, thumbNum, thumbFilename, false);
+ this.currentImageElement.dataset.index = thumbNum;
+ this.removeOldImages(this.currentImageElement);
+ }
+ }
+ }, {
+ key: "showImage",
+ value: function showImage(previewImage, frame, qualityIndex, thumbNum, thumbFilename) {
+ var newImage = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : true;
+ this.player.debug.log("Showing thumb: ".concat(thumbFilename, ". num: ").concat(thumbNum, ". qual: ").concat(qualityIndex, ". newimg: ").concat(newImage));
+ this.setImageSizeAndOffset(previewImage, frame);
+
+ if (newImage) {
+ this.currentImageContainer.appendChild(previewImage);
+ this.currentImageElement = previewImage;
+
+ if (!this.loadedImages.includes(thumbFilename)) {
+ this.loadedImages.push(thumbFilename);
+ }
+ } // Preload images before and after the current one
+ // Show higher quality of the same frame
+ // 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
+
+
+ this.preloadNearby(thumbNum, true).then(this.preloadNearby(thumbNum, false)).then(this.getHigherQuality(qualityIndex, previewImage, frame, thumbFilename));
+ } // Remove all preview images that aren't the designated current image
+
+ }, {
+ key: "removeOldImages",
+ value: function removeOldImages(currentImage) {
+ var _this8 = this;
+
+ // Get a list of all images, convert it from a DOM list to an array
+ Array.from(this.currentImageContainer.children).forEach(function (image) {
+ if (image.tagName.toLowerCase() !== 'img') {
+ return;
+ }
+
+ var removeDelay = _this8.usingSprites ? 500 : 1000;
+
+ if (image.dataset.index !== currentImage.dataset.index && !image.dataset.deleting) {
+ // 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
+ // First set attribute 'deleting' to prevent multi-handling of this on repeat firing of this function
+ // eslint-disable-next-line no-param-reassign
+ image.dataset.deleting = true; // This has to be set before the timeout - to prevent issues switching between hover and scrub
+
+ var currentImageContainer = _this8.currentImageContainer;
+ setTimeout(function () {
+ currentImageContainer.removeChild(image);
+
+ _this8.player.debug.log("Removing thumb: ".concat(image.dataset.filename));
+ }, removeDelay);
+ }
+ });
+ } // Preload images before and after the current one. Only if the user is still hovering/seeking the same frame
+ // This will only preload the lowest quality
+
+ }, {
+ key: "preloadNearby",
+ value: function preloadNearby(thumbNum) {
+ var _this9 = this;
+
+ var forward = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
+ return new Promise(function (resolve) {
+ setTimeout(function () {
+ var oldThumbFilename = _this9.thumbnails[0].frames[thumbNum].text;
+
+ if (_this9.showingThumbFilename === oldThumbFilename) {
+ // 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
+ var thumbnailsClone;
+
+ if (forward) {
+ thumbnailsClone = _this9.thumbnails[0].frames.slice(thumbNum);
+ } else {
+ thumbnailsClone = _this9.thumbnails[0].frames.slice(0, thumbNum).reverse();
+ }
+
+ var foundOne = false;
+ thumbnailsClone.forEach(function (frame) {
+ var newThumbFilename = frame.text;
+
+ if (newThumbFilename !== oldThumbFilename) {
+ // Found one with a different filename. Make sure it hasn't already been loaded on this page visit
+ if (!_this9.loadedImages.includes(newThumbFilename)) {
+ foundOne = true;
+
+ _this9.player.debug.log("Preloading thumb filename: ".concat(newThumbFilename));
+
+ var urlPrefix = _this9.thumbnails[0].urlPrefix;
+ var thumbURL = urlPrefix + newThumbFilename;
+ var previewImage = new Image();
+ previewImage.src = thumbURL;
+
+ previewImage.onload = function () {
+ _this9.player.debug.log("Preloaded thumb filename: ".concat(newThumbFilename));
+
+ if (!_this9.loadedImages.includes(newThumbFilename)) _this9.loadedImages.push(newThumbFilename); // We don't resolve until the thumb is loaded
+
+ resolve();
+ };
+ }
+ }
+ }); // If there are none to preload then we want to resolve immediately
+
+ if (!foundOne) {
+ resolve();
+ }
+ }
+ }, 300);
+ });
+ } // If user has been hovering current image for half a second, look for a higher quality one
+
+ }, {
+ key: "getHigherQuality",
+ value: function getHigherQuality(currentQualityIndex, previewImage, frame, thumbFilename) {
+ var _this10 = this;
+
+ if (currentQualityIndex < this.thumbnails.length - 1) {
+ // 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
+ var previewImageHeight = previewImage.naturalHeight;
+
+ if (this.usingSprites) {
+ previewImageHeight = frame.h;
+ }
+
+ if (previewImageHeight < this.thumbContainerHeight) {
+ // Recurse back to the loadImage function - show a higher quality one, but only if the viewer is on this frame for a while
+ setTimeout(function () {
+ // Make sure the mouse hasn't already moved on and started hovering at another image
+ if (_this10.showingThumbFilename === thumbFilename) {
+ _this10.player.debug.log("Showing higher quality thumb for: ".concat(thumbFilename));
+
+ _this10.loadImage(currentQualityIndex + 1);
+ }
+ }, 300);
+ }
+ }
+ }
+ }, {
+ key: "toggleThumbContainer",
+ value: function toggleThumbContainer() {
+ var toggle = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
+ var clearShowing = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
+ var className = this.player.config.classNames.previewThumbnails.thumbContainerShown;
+ this.elements.thumb.container.classList.toggle(className, toggle);
+
+ if (!toggle && clearShowing) {
+ this.showingThumb = null;
+ this.showingThumbFilename = null;
+ }
+ }
+ }, {
+ key: "toggleScrubbingContainer",
+ value: function toggleScrubbingContainer() {
+ var toggle = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
+ var className = this.player.config.classNames.previewThumbnails.scrubbingContainerShown;
+ this.elements.scrubbing.container.classList.toggle(className, toggle);
+
+ if (!toggle) {
+ this.showingThumb = null;
+ this.showingThumbFilename = null;
+ }
+ }
+ }, {
+ key: "determineContainerAutoSizing",
+ value: function determineContainerAutoSizing() {
+ if (this.elements.thumb.imageContainer.clientHeight > 20 || this.elements.thumb.imageContainer.clientWidth > 20) {
+ // This will prevent auto sizing in this.setThumbContainerSizeAndPos()
+ this.sizeSpecifiedInCSS = true;
+ }
+ } // 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
+
+ }, {
+ key: "setThumbContainerSizeAndPos",
+ value: function setThumbContainerSizeAndPos() {
+ if (!this.sizeSpecifiedInCSS) {
+ var thumbWidth = Math.floor(this.thumbContainerHeight * this.thumbAspectRatio);
+ this.elements.thumb.imageContainer.style.height = "".concat(this.thumbContainerHeight, "px");
+ this.elements.thumb.imageContainer.style.width = "".concat(thumbWidth, "px");
+ } else if (this.elements.thumb.imageContainer.clientHeight > 20 && this.elements.thumb.imageContainer.clientWidth < 20) {
+ var _thumbWidth = Math.floor(this.elements.thumb.imageContainer.clientHeight * this.thumbAspectRatio);
+
+ this.elements.thumb.imageContainer.style.width = "".concat(_thumbWidth, "px");
+ } else if (this.elements.thumb.imageContainer.clientHeight < 20 && this.elements.thumb.imageContainer.clientWidth > 20) {
+ var thumbHeight = Math.floor(this.elements.thumb.imageContainer.clientWidth / this.thumbAspectRatio);
+ this.elements.thumb.imageContainer.style.height = "".concat(thumbHeight, "px");
+ }
+
+ this.setThumbContainerPos();
+ }
+ }, {
+ key: "setThumbContainerPos",
+ value: function setThumbContainerPos() {
+ var seekbarRect = this.player.elements.progress.getBoundingClientRect();
+ var plyrRect = this.player.elements.container.getBoundingClientRect();
+ 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
+
+ var minVal = plyrRect.left - seekbarRect.left + 10;
+ var maxVal = plyrRect.right - seekbarRect.left - container.clientWidth - 10; // Set preview container position to: mousepos, minus seekbar.left, minus half of previewContainer.clientWidth
+
+ var previewPos = this.mousePosX - seekbarRect.left - container.clientWidth / 2;
+
+ if (previewPos < minVal) {
+ previewPos = minVal;
+ }
+
+ if (previewPos > maxVal) {
+ previewPos = maxVal;
+ }
+
+ container.style.left = "".concat(previewPos, "px");
+ } // Can't use 100% width, in case the video is a different aspect ratio to the video container
+
+ }, {
+ key: "setScrubbingContainerSize",
+ value: function setScrubbingContainerSize() {
+ var _fitRatio = fitRatio(this.thumbAspectRatio, {
+ width: this.player.media.clientWidth,
+ height: this.player.media.clientHeight
+ }),
+ width = _fitRatio.width,
+ height = _fitRatio.height;
+
+ this.elements.scrubbing.container.style.width = "".concat(width, "px");
+ this.elements.scrubbing.container.style.height = "".concat(height, "px");
+ } // Sprites need to be offset to the correct location
+
+ }, {
+ key: "setImageSizeAndOffset",
+ value: function setImageSizeAndOffset(previewImage, frame) {
+ if (!this.usingSprites) {
+ return;
+ } // Find difference between height and preview container height
+
+
+ var multiplier = this.thumbContainerHeight / frame.h; // eslint-disable-next-line no-param-reassign
+
+ previewImage.style.height = "".concat(previewImage.naturalHeight * multiplier, "px"); // eslint-disable-next-line no-param-reassign
+
+ previewImage.style.width = "".concat(previewImage.naturalWidth * multiplier, "px"); // eslint-disable-next-line no-param-reassign
+
+ previewImage.style.left = "-".concat(frame.x * multiplier, "px"); // eslint-disable-next-line no-param-reassign
+
+ previewImage.style.top = "-".concat(frame.y * multiplier, "px");
+ }
+ }, {
+ key: "enabled",
+ get: function get() {
+ return this.player.isHTML5 && this.player.isVideo && this.player.config.previewThumbnails.enabled;
+ }
+ }, {
+ key: "currentImageContainer",
+ get: function get() {
+ if (this.mouseDown) {
+ return this.elements.scrubbing.container;
+ }
+
+ return this.elements.thumb.imageContainer;
+ }
+ }, {
+ key: "usingSprites",
+ get: function get() {
+ return Object.keys(this.thumbnails[0].frames[0]).includes('w');
+ }
+ }, {
+ key: "thumbAspectRatio",
+ get: function get() {
+ if (this.usingSprites) {
+ return this.thumbnails[0].frames[0].w / this.thumbnails[0].frames[0].h;
+ }
+
+ return this.thumbnails[0].width / this.thumbnails[0].height;
+ }
+ }, {
+ key: "thumbContainerHeight",
+ get: function get() {
+ if (this.mouseDown) {
+ var _fitRatio2 = fitRatio(this.thumbAspectRatio, {
+ width: this.player.media.clientWidth,
+ height: this.player.media.clientHeight
+ }),
+ height = _fitRatio2.height;
+
+ return height;
+ } // If css is used this needs to return the css height for sprites to work (see setImageSizeAndOffset)
+
+
+ if (this.sizeSpecifiedInCSS) {
+ return this.elements.thumb.imageContainer.clientHeight;
+ }
+
+ return Math.floor(this.player.media.clientWidth / this.thumbAspectRatio / 4);
+ }
+ }, {
+ key: "currentImageElement",
+ get: function get() {
+ if (this.mouseDown) {
+ return this.currentScrubbingImageElement;
+ }
+
+ return this.currentThumbnailImageElement;
+ },
+ set: function set(element) {
+ if (this.mouseDown) {
+ this.currentScrubbingImageElement = element;
+ } else {
+ this.currentThumbnailImageElement = element;
+ }
+ }
+ }]);
+
+ return PreviewThumbnails;
+}();
+
+var source = {
+ // Add elements to HTML5 media (source, tracks, etc)
+ insertElements: function insertElements(type, attributes) {
+ var _this = this;
+
+ if (is$1.string(attributes)) {
+ insertElement(type, this.media, {
+ src: attributes
+ });
+ } else if (is$1.array(attributes)) {
+ attributes.forEach(function (attribute) {
+ insertElement(type, _this.media, attribute);
+ });
+ }
+ },
+ // Update source
+ // Sources are not checked for support so be careful
+ change: function change(input) {
+ var _this2 = this;
+
+ if (!getDeep(input, 'sources.length')) {
+ this.debug.warn('Invalid source format');
+ return;
+ } // Cancel current network requests
+
+
+ html5.cancelRequests.call(this); // Destroy instance and re-setup
+
+ this.destroy.call(this, function () {
+ // Reset quality options
+ _this2.options.quality = []; // Remove elements
+
+ removeElement(_this2.media);
+ _this2.media = null; // Reset class name
+
+ if (is$1.element(_this2.elements.container)) {
+ _this2.elements.container.removeAttribute('class');
+ } // Set the type and provider
+
+
+ var sources = input.sources,
+ type = input.type;
+
+ var _sources = _slicedToArray(sources, 1),
+ _sources$ = _sources[0],
+ _sources$$provider = _sources$.provider,
+ provider = _sources$$provider === void 0 ? providers.html5 : _sources$$provider,
+ src = _sources$.src;
+
+ var tagName = provider === 'html5' ? type : 'div';
+ var attributes = provider === 'html5' ? {} : {
+ src: src
+ };
+ Object.assign(_this2, {
+ provider: provider,
+ type: type,
+ // Check for support
+ supported: support.check(type, provider, _this2.config.playsinline),
+ // Create new element
+ media: createElement(tagName, attributes)
+ }); // Inject the new element
+
+ _this2.elements.container.appendChild(_this2.media); // Autoplay the new source?
+
+
+ if (is$1.boolean(input.autoplay)) {
+ _this2.config.autoplay = input.autoplay;
+ } // Set attributes for audio and video
+
+
+ if (_this2.isHTML5) {
+ if (_this2.config.crossorigin) {
+ _this2.media.setAttribute('crossorigin', '');
+ }
+
+ if (_this2.config.autoplay) {
+ _this2.media.setAttribute('autoplay', '');
+ }
+
+ if (!is$1.empty(input.poster)) {
+ _this2.poster = input.poster;
+ }
+
+ if (_this2.config.loop.active) {
+ _this2.media.setAttribute('loop', '');
+ }
+
+ if (_this2.config.muted) {
+ _this2.media.setAttribute('muted', '');
+ }
+
+ if (_this2.config.playsinline) {
+ _this2.media.setAttribute('playsinline', '');
+ }
+ } // Restore class hook
+
+
+ ui.addStyleHook.call(_this2); // Set new sources for html5
+
+ if (_this2.isHTML5) {
+ source.insertElements.call(_this2, 'source', sources);
+ } // Set video title
+
+
+ _this2.config.title = input.title; // Set up from scratch
+
+ media.setup.call(_this2); // HTML5 stuff
+
+ if (_this2.isHTML5) {
+ // Setup captions
+ if (Object.keys(input).includes('tracks')) {
+ source.insertElements.call(_this2, 'track', input.tracks);
+ }
+ } // If HTML5 or embed but not fully supported, setupInterface and call ready now
+
+
+ if (_this2.isHTML5 || _this2.isEmbed && !_this2.supported.ui) {
+ // Setup interface
+ ui.build.call(_this2);
+ } // Load HTML5 sources
+
+
+ if (_this2.isHTML5) {
+ _this2.media.load();
+ } // Update previewThumbnails config & reload plugin
+
+
+ if (!is$1.empty(input.previewThumbnails)) {
+ Object.assign(_this2.config.previewThumbnails, input.previewThumbnails); // Cleanup previewThumbnails plugin if it was loaded
+
+ if (_this2.previewThumbnails && _this2.previewThumbnails.loaded) {
+ _this2.previewThumbnails.destroy();
+
+ _this2.previewThumbnails = null;
+ } // Create new instance if it is still enabled
+
+
+ if (_this2.config.previewThumbnails.enabled) {
+ _this2.previewThumbnails = new PreviewThumbnails(_this2);
+ }
+ } // Update the fullscreen support
+
+
+ _this2.fullscreen.update();
+ }, true);
+ }
+};
+
+/**
+ * Returns a number whose value is limited to the given range.
+ *
+ * Example: limit the output of this computation to between 0 and 255
+ * (x * 255).clamp(0, 255)
+ *
+ * @param {Number} input
+ * @param {Number} min The lower boundary of the output range
+ * @param {Number} max The upper boundary of the output range
+ * @returns A number in the range [min, max]
+ * @type Number
+ */
+function clamp() {
+ var input = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
+ var min = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
+ var max = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 255;
+ return Math.min(Math.max(input, min), max);
+}
+
+// TODO: Use a WeakMap for private globals
+// const globals = new WeakMap();
+// Plyr instance
+
+var Plyr = /*#__PURE__*/function () {
+ function Plyr(target, options) {
+ var _this = this;
+
+ _classCallCheck(this, Plyr);
+
+ this.timers = {}; // State
+
+ this.ready = false;
+ this.loading = false;
+ this.failed = false; // Touch device
+
+ this.touch = support.touch; // Set the media element
+
+ this.media = target; // String selector passed
+
+ if (is$1.string(this.media)) {
+ this.media = document.querySelectorAll(this.media);
+ } // jQuery, NodeList or Array passed, use first element
+
+
+ if (window.jQuery && this.media instanceof jQuery || is$1.nodeList(this.media) || is$1.array(this.media)) {
+ // eslint-disable-next-line
+ this.media = this.media[0];
+ } // Set config
+
+
+ this.config = extend({}, defaults$1, Plyr.defaults, options || {}, function () {
+ try {
+ return JSON.parse(_this.media.getAttribute('data-plyr-config'));
+ } catch (e) {
+ return {};
+ }
+ }()); // Elements cache
+
+ this.elements = {
+ container: null,
+ fullscreen: null,
+ captions: null,
+ buttons: {},
+ display: {},
+ progress: {},
+ inputs: {},
+ settings: {
+ popup: null,
+ menu: null,
+ panels: {},
+ buttons: {}
+ }
+ }; // Captions
+
+ this.captions = {
+ active: null,
+ currentTrack: -1,
+ meta: new WeakMap()
+ }; // Fullscreen
+
+ this.fullscreen = {
+ active: false
+ }; // Options
+
+ this.options = {
+ speed: [],
+ quality: []
+ }; // Debugging
+ // TODO: move to globals
+
+ this.debug = new Console(this.config.debug); // Log config options and support
+
+ this.debug.log('Config', this.config);
+ this.debug.log('Support', support); // We need an element to setup
+
+ if (is$1.nullOrUndefined(this.media) || !is$1.element(this.media)) {
+ this.debug.error('Setup failed: no suitable element passed');
+ return;
+ } // Bail if the element is initialized
+
+
+ if (this.media.plyr) {
+ this.debug.warn('Target already setup');
+ return;
+ } // Bail if not enabled
+
+
+ if (!this.config.enabled) {
+ this.debug.error('Setup failed: disabled by config');
+ return;
+ } // Bail if disabled or no basic support
+ // You may want to disable certain UAs etc
+
+
+ if (!support.check().api) {
+ this.debug.error('Setup failed: no support');
+ return;
+ } // Cache original element state for .destroy()
+
+
+ var clone = this.media.cloneNode(true);
+ clone.autoplay = false;
+ this.elements.original = clone; // Set media type based on tag or data attribute
+ // Supported: video, audio, vimeo, youtube
+
+ var type = this.media.tagName.toLowerCase(); // Embed properties
+
+ var iframe = null;
+ var url = null; // Different setup based on type
+
+ switch (type) {
+ case 'div':
+ // Find the frame
+ iframe = this.media.querySelector('iframe'); // <iframe> type
+
+ if (is$1.element(iframe)) {
+ // Detect provider
+ url = parseUrl(iframe.getAttribute('src'));
+ this.provider = getProviderByUrl(url.toString()); // Rework elements
+
+ this.elements.container = this.media;
+ this.media = iframe; // Reset classname
+
+ this.elements.container.className = ''; // Get attributes from URL and set config
+
+ if (url.search.length) {
+ var truthy = ['1', 'true'];
+
+ if (truthy.includes(url.searchParams.get('autoplay'))) {
+ this.config.autoplay = true;
+ }
+
+ if (truthy.includes(url.searchParams.get('loop'))) {
+ this.config.loop.active = true;
+ } // TODO: replace fullscreen.iosNative with this playsinline config option
+ // YouTube requires the playsinline in the URL
+
+
+ if (this.isYouTube) {
+ this.config.playsinline = truthy.includes(url.searchParams.get('playsinline'));
+ this.config.youtube.hl = url.searchParams.get('hl'); // TODO: Should this be setting language?
+ } else {
+ this.config.playsinline = true;
+ }
+ }
+ } else {
+ // <div> with attributes
+ this.provider = this.media.getAttribute(this.config.attributes.embed.provider); // Remove attribute
+
+ this.media.removeAttribute(this.config.attributes.embed.provider);
+ } // Unsupported or missing provider
+
+
+ if (is$1.empty(this.provider) || !Object.keys(providers).includes(this.provider)) {
+ this.debug.error('Setup failed: Invalid provider');
+ return;
+ } // Audio will come later for external providers
+
+
+ this.type = types.video;
+ break;
+
+ case 'video':
+ case 'audio':
+ this.type = type;
+ this.provider = providers.html5; // Get config from attributes
+
+ if (this.media.hasAttribute('crossorigin')) {
+ this.config.crossorigin = true;
+ }
+
+ if (this.media.hasAttribute('autoplay')) {
+ this.config.autoplay = true;
+ }
+
+ if (this.media.hasAttribute('playsinline') || this.media.hasAttribute('webkit-playsinline')) {
+ this.config.playsinline = true;
+ }
+
+ if (this.media.hasAttribute('muted')) {
+ this.config.muted = true;
+ }
+
+ if (this.media.hasAttribute('loop')) {
+ this.config.loop.active = true;
+ }
+
+ break;
+
+ default:
+ this.debug.error('Setup failed: unsupported type');
+ return;
+ } // Check for support again but with type
+
+
+ this.supported = support.check(this.type, this.provider, this.config.playsinline); // If no support for even API, bail
+
+ if (!this.supported.api) {
+ this.debug.error('Setup failed: no support');
+ return;
+ }
+
+ this.eventListeners = []; // Create listeners
+
+ this.listeners = new Listeners(this); // Setup local storage for user settings
+
+ this.storage = new Storage(this); // Store reference
+
+ this.media.plyr = this; // Wrap media
+
+ if (!is$1.element(this.elements.container)) {
+ this.elements.container = createElement('div', {
+ tabindex: 0
+ });
+ wrap(this.media, this.elements.container);
+ } // Migrate custom properties from media to container (so they work 😉)
+
+
+ ui.migrateStyles.call(this); // Add style hook
+
+ ui.addStyleHook.call(this); // Setup media
+
+ media.setup.call(this); // Listen for events if debugging
+
+ if (this.config.debug) {
+ on.call(this, this.elements.container, this.config.events.join(' '), function (event) {
+ _this.debug.log("event: ".concat(event.type));
+ });
+ } // Setup fullscreen
+
+
+ this.fullscreen = new Fullscreen(this); // Setup interface
+ // If embed but not fully supported, build interface now to avoid flash of controls
+
+ if (this.isHTML5 || this.isEmbed && !this.supported.ui) {
+ ui.build.call(this);
+ } // Container listeners
+
+
+ this.listeners.container(); // Global listeners
+
+ this.listeners.global(); // Setup ads if provided
+
+ if (this.config.ads.enabled) {
+ this.ads = new Ads(this);
+ } // Autoplay if required
+
+
+ if (this.isHTML5 && this.config.autoplay) {
+ setTimeout(function () {
+ return silencePromise(_this.play());
+ }, 10);
+ } // Seek time will be recorded (in listeners.js) so we can prevent hiding controls for a few seconds after seek
+
+
+ this.lastSeekTime = 0; // Setup preview thumbnails if enabled
+
+ if (this.config.previewThumbnails.enabled) {
+ this.previewThumbnails = new PreviewThumbnails(this);
+ }
+ } // ---------------------------------------
+ // API
+ // ---------------------------------------
+
+ /**
+ * Types and provider helpers
+ */
+
+
+ _createClass(Plyr, [{
+ key: "play",
+
+ /**
+ * Play the media, or play the advertisement (if they are not blocked)
+ */
+ value: function play() {
+ var _this2 = this;
+
+ if (!is$1.function(this.media.play)) {
+ return null;
+ } // Intecept play with ads
+
+
+ if (this.ads && this.ads.enabled) {
+ this.ads.managerPromise.then(function () {
+ return _this2.ads.play();
+ }).catch(function () {
+ return silencePromise(_this2.media.play());
+ });
+ } // Return the promise (for HTML5)
+
+
+ return this.media.play();
+ }
+ /**
+ * Pause the media
+ */
+
+ }, {
+ key: "pause",
+ value: function pause() {
+ if (!this.playing || !is$1.function(this.media.pause)) {
+ return null;
+ }
+
+ return this.media.pause();
+ }
+ /**
+ * Get playing state
+ */
+
+ }, {
+ key: "togglePlay",
+
+ /**
+ * Toggle playback based on current status
+ * @param {Boolean} input
+ */
+ value: function togglePlay(input) {
+ // Toggle based on current state if nothing passed
+ var toggle = is$1.boolean(input) ? input : !this.playing;
+
+ if (toggle) {
+ return this.play();
+ }
+
+ return this.pause();
+ }
+ /**
+ * Stop playback
+ */
+
+ }, {
+ key: "stop",
+ value: function stop() {
+ if (this.isHTML5) {
+ this.pause();
+ this.restart();
+ } else if (is$1.function(this.media.stop)) {
+ this.media.stop();
+ }
+ }
+ /**
+ * Restart playback
+ */
+
+ }, {
+ key: "restart",
+ value: function restart() {
+ this.currentTime = 0;
+ }
+ /**
+ * Rewind
+ * @param {Number} seekTime - how far to rewind in seconds. Defaults to the config.seekTime
+ */
+
+ }, {
+ key: "rewind",
+ value: function rewind(seekTime) {
+ this.currentTime -= is$1.number(seekTime) ? seekTime : this.config.seekTime;
+ }
+ /**
+ * Fast forward
+ * @param {Number} seekTime - how far to fast forward in seconds. Defaults to the config.seekTime
+ */
+
+ }, {
+ key: "forward",
+ value: function forward(seekTime) {
+ this.currentTime += is$1.number(seekTime) ? seekTime : this.config.seekTime;
+ }
+ /**
+ * Seek to a time
+ * @param {Number} input - where to seek to in seconds. Defaults to 0 (the start)
+ */
+
+ }, {
+ key: "increaseVolume",
+
+ /**
+ * Increase volume
+ * @param {Boolean} step - How much to decrease by (between 0 and 1)
+ */
+ value: function increaseVolume(step) {
+ var volume = this.media.muted ? 0 : this.volume;
+ this.volume = volume + (is$1.number(step) ? step : 0);
+ }
+ /**
+ * Decrease volume
+ * @param {Boolean} step - How much to decrease by (between 0 and 1)
+ */
+
+ }, {
+ key: "decreaseVolume",
+ value: function decreaseVolume(step) {
+ this.increaseVolume(-step);
+ }
+ /**
+ * Set muted state
+ * @param {Boolean} mute
+ */
+
+ }, {
+ key: "toggleCaptions",
+
+ /**
+ * Toggle captions
+ * @param {Boolean} input - Whether to enable captions
+ */
+ value: function toggleCaptions(input) {
+ captions.toggle.call(this, input, false);
+ }
+ /**
+ * Set the caption track by index
+ * @param {Number} - Caption index
+ */
+
+ }, {
+ key: "airplay",
+
+ /**
+ * Trigger the airplay dialog
+ * TODO: update player with state, support, enabled
+ */
+ value: function airplay() {
+ // Show dialog if supported
+ if (support.airplay) {
+ this.media.webkitShowPlaybackTargetPicker();
+ }
+ }
+ /**
+ * Toggle the player controls
+ * @param {Boolean} [toggle] - Whether to show the controls
+ */
+
+ }, {
+ key: "toggleControls",
+ value: function toggleControls(toggle) {
+ // Don't toggle if missing UI support or if it's audio
+ if (this.supported.ui && !this.isAudio) {
+ // Get state before change
+ var isHidden = hasClass(this.elements.container, this.config.classNames.hideControls); // Negate the argument if not undefined since adding the class to hides the controls
+
+ var force = typeof toggle === 'undefined' ? undefined : !toggle; // Apply and get updated state
+
+ var hiding = toggleClass(this.elements.container, this.config.classNames.hideControls, force); // Close menu
+
+ if (hiding && is$1.array(this.config.controls) && this.config.controls.includes('settings') && !is$1.empty(this.config.settings)) {
+ controls.toggleMenu.call(this, false);
+ } // Trigger event on change
+
+
+ if (hiding !== isHidden) {
+ var eventName = hiding ? 'controlshidden' : 'controlsshown';
+ triggerEvent.call(this, this.media, eventName);
+ }
+
+ return !hiding;
+ }
+
+ return false;
+ }
+ /**
+ * Add event listeners
+ * @param {String} event - Event type
+ * @param {Function} callback - Callback for when event occurs
+ */
+
+ }, {
+ key: "on",
+ value: function on$1(event, callback) {
+ on.call(this, this.elements.container, event, callback);
+ }
+ /**
+ * Add event listeners once
+ * @param {String} event - Event type
+ * @param {Function} callback - Callback for when event occurs
+ */
+
+ }, {
+ key: "once",
+ value: function once$1(event, callback) {
+ once.call(this, this.elements.container, event, callback);
+ }
+ /**
+ * Remove event listeners
+ * @param {String} event - Event type
+ * @param {Function} callback - Callback for when event occurs
+ */
+
+ }, {
+ key: "off",
+ value: function off$1(event, callback) {
+ off(this.elements.container, event, callback);
+ }
+ /**
+ * Destroy an instance
+ * Event listeners are removed when elements are removed
+ * http://stackoverflow.com/questions/12528049/if-a-dom-element-is-removed-are-its-listeners-also-removed-from-memory
+ * @param {Function} callback - Callback for when destroy is complete
+ * @param {Boolean} soft - Whether it's a soft destroy (for source changes etc)
+ */
+
+ }, {
+ key: "destroy",
+ value: function destroy(callback) {
+ var _this3 = this;
+
+ var soft = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
+
+ if (!this.ready) {
+ return;
+ }
+
+ var done = function done() {
+ // Reset overflow (incase destroyed while in fullscreen)
+ document.body.style.overflow = ''; // GC for embed
+
+ _this3.embed = null; // If it's a soft destroy, make minimal changes
+
+ if (soft) {
+ if (Object.keys(_this3.elements).length) {
+ // Remove elements
+ removeElement(_this3.elements.buttons.play);
+ removeElement(_this3.elements.captions);
+ removeElement(_this3.elements.controls);
+ removeElement(_this3.elements.wrapper); // Clear for GC
+
+ _this3.elements.buttons.play = null;
+ _this3.elements.captions = null;
+ _this3.elements.controls = null;
+ _this3.elements.wrapper = null;
+ } // Callback
+
+
+ if (is$1.function(callback)) {
+ callback();
+ }
+ } else {
+ // Unbind listeners
+ unbindListeners.call(_this3); // Replace the container with the original element provided
+
+ replaceElement(_this3.elements.original, _this3.elements.container); // Event
+
+ triggerEvent.call(_this3, _this3.elements.original, 'destroyed', true); // Callback
+
+ if (is$1.function(callback)) {
+ callback.call(_this3.elements.original);
+ } // Reset state
+
+
+ _this3.ready = false; // Clear for garbage collection
+
+ setTimeout(function () {
+ _this3.elements = null;
+ _this3.media = null;
+ }, 200);
+ }
+ }; // Stop playback
+
+
+ this.stop(); // Clear timeouts
+
+ clearTimeout(this.timers.loading);
+ clearTimeout(this.timers.controls);
+ clearTimeout(this.timers.resized); // Provider specific stuff
+
+ if (this.isHTML5) {
+ // Restore native video controls
+ ui.toggleNativeControls.call(this, true); // Clean up
+
+ done();
+ } else if (this.isYouTube) {
+ // Clear timers
+ clearInterval(this.timers.buffering);
+ clearInterval(this.timers.playing); // Destroy YouTube API
+
+ if (this.embed !== null && is$1.function(this.embed.destroy)) {
+ this.embed.destroy();
+ } // Clean up
+
+
+ done();
+ } else if (this.isVimeo) {
+ // Destroy Vimeo API
+ // then clean up (wait, to prevent postmessage errors)
+ if (this.embed !== null) {
+ this.embed.unload().then(done);
+ } // Vimeo does not always return
+
+
+ setTimeout(done, 200);
+ }
+ }
+ /**
+ * Check for support for a mime type (HTML5 only)
+ * @param {String} type - Mime type
+ */
+
+ }, {
+ key: "supports",
+ value: function supports(type) {
+ return support.mime.call(this, type);
+ }
+ /**
+ * Check for support
+ * @param {String} type - Player type (audio/video)
+ * @param {String} provider - Provider (html5/youtube/vimeo)
+ * @param {Boolean} inline - Where player has `playsinline` sttribute
+ */
+
+ }, {
+ key: "isHTML5",
+ get: function get() {
+ return this.provider === providers.html5;
+ }
+ }, {
+ key: "isEmbed",
+ get: function get() {
+ return this.isYouTube || this.isVimeo;
+ }
+ }, {
+ key: "isYouTube",
+ get: function get() {
+ return this.provider === providers.youtube;
+ }
+ }, {
+ key: "isVimeo",
+ get: function get() {
+ return this.provider === providers.vimeo;
+ }
+ }, {
+ key: "isVideo",
+ get: function get() {
+ return this.type === types.video;
+ }
+ }, {
+ key: "isAudio",
+ get: function get() {
+ return this.type === types.audio;
+ }
+ }, {
+ key: "playing",
+ get: function get() {
+ return Boolean(this.ready && !this.paused && !this.ended);
+ }
+ /**
+ * Get paused state
+ */
+
+ }, {
+ key: "paused",
+ get: function get() {
+ return Boolean(this.media.paused);
+ }
+ /**
+ * Get stopped state
+ */
+
+ }, {
+ key: "stopped",
+ get: function get() {
+ return Boolean(this.paused && this.currentTime === 0);
+ }
+ /**
+ * Get ended state
+ */
+
+ }, {
+ key: "ended",
+ get: function get() {
+ return Boolean(this.media.ended);
+ }
+ }, {
+ key: "currentTime",
+ set: function set(input) {
+ // Bail if media duration isn't available yet
+ if (!this.duration) {
+ return;
+ } // Validate input
+
+
+ var inputIsValid = is$1.number(input) && input > 0; // Set
+
+ this.media.currentTime = inputIsValid ? Math.min(input, this.duration) : 0; // Logging
+
+ this.debug.log("Seeking to ".concat(this.currentTime, " seconds"));
+ }
+ /**
+ * Get current time
+ */
+ ,
+ get: function get() {
+ return Number(this.media.currentTime);
+ }
+ /**
+ * Get buffered
+ */
+
+ }, {
+ key: "buffered",
+ get: function get() {
+ var buffered = this.media.buffered; // YouTube / Vimeo return a float between 0-1
+
+ if (is$1.number(buffered)) {
+ return buffered;
+ } // HTML5
+ // TODO: Handle buffered chunks of the media
+ // (i.e. seek to another section buffers only that section)
+
+
+ if (buffered && buffered.length && this.duration > 0) {
+ return buffered.end(0) / this.duration;
+ }
+
+ return 0;
+ }
+ /**
+ * Get seeking status
+ */
+
+ }, {
+ key: "seeking",
+ get: function get() {
+ return Boolean(this.media.seeking);
+ }
+ /**
+ * Get the duration of the current media
+ */
+
+ }, {
+ key: "duration",
+ get: function get() {
+ // Faux duration set via config
+ var fauxDuration = parseFloat(this.config.duration); // Media duration can be NaN or Infinity before the media has loaded
+
+ var realDuration = (this.media || {}).duration;
+ var duration = !is$1.number(realDuration) || realDuration === Infinity ? 0 : realDuration; // If config duration is funky, use regular duration
+
+ return fauxDuration || duration;
+ }
+ /**
+ * Set the player volume
+ * @param {Number} value - must be between 0 and 1. Defaults to the value from local storage and config.volume if not set in storage
+ */
+
+ }, {
+ key: "volume",
+ set: function set(value) {
+ var volume = value;
+ var max = 1;
+ var min = 0;
+
+ if (is$1.string(volume)) {
+ volume = Number(volume);
+ } // Load volume from storage if no value specified
+
+
+ if (!is$1.number(volume)) {
+ volume = this.storage.get('volume');
+ } // Use config if all else fails
+
+
+ if (!is$1.number(volume)) {
+ volume = this.config.volume;
+ } // Maximum is volumeMax
+
+
+ if (volume > max) {
+ volume = max;
+ } // Minimum is volumeMin
+
+
+ if (volume < min) {
+ volume = min;
+ } // Update config
+
+
+ this.config.volume = volume; // Set the player volume
+
+ this.media.volume = volume; // If muted, and we're increasing volume manually, reset muted state
+
+ if (!is$1.empty(value) && this.muted && volume > 0) {
+ this.muted = false;
+ }
+ }
+ /**
+ * Get the current player volume
+ */
+ ,
+ get: function get() {
+ return Number(this.media.volume);
+ }
+ }, {
+ key: "muted",
+ set: function set(mute) {
+ var toggle = mute; // Load muted state from storage
+
+ if (!is$1.boolean(toggle)) {
+ toggle = this.storage.get('muted');
+ } // Use config if all else fails
+
+
+ if (!is$1.boolean(toggle)) {
+ toggle = this.config.muted;
+ } // Update config
+
+
+ this.config.muted = toggle; // Set mute on the player
+
+ this.media.muted = toggle;
+ }
+ /**
+ * Get current muted state
+ */
+ ,
+ get: function get() {
+ return Boolean(this.media.muted);
+ }
+ /**
+ * Check if the media has audio
+ */
+
+ }, {
+ key: "hasAudio",
+ get: function get() {
+ // Assume yes for all non HTML5 (as we can't tell...)
+ if (!this.isHTML5) {
+ return true;
+ }
+
+ if (this.isAudio) {
+ return true;
+ } // Get audio tracks
+
+
+ return Boolean(this.media.mozHasAudio) || Boolean(this.media.webkitAudioDecodedByteCount) || Boolean(this.media.audioTracks && this.media.audioTracks.length);
+ }
+ /**
+ * Set playback speed
+ * @param {Number} speed - the speed of playback (0.5-2.0)
+ */
+
+ }, {
+ key: "speed",
+ set: function set(input) {
+ var _this4 = this;
+
+ var speed = null;
+
+ if (is$1.number(input)) {
+ speed = input;
+ }
+
+ if (!is$1.number(speed)) {
+ speed = this.storage.get('speed');
+ }
+
+ if (!is$1.number(speed)) {
+ speed = this.config.speed.selected;
+ } // Clamp to min/max
+
+
+ var min = this.minimumSpeed,
+ max = this.maximumSpeed;
+ speed = clamp(speed, min, max); // Update config
+
+ this.config.speed.selected = speed; // Set media speed
+
+ setTimeout(function () {
+ _this4.media.playbackRate = speed;
+ }, 0);
+ }
+ /**
+ * Get current playback speed
+ */
+ ,
+ get: function get() {
+ return Number(this.media.playbackRate);
+ }
+ /**
+ * Get the minimum allowed speed
+ */
+
+ }, {
+ key: "minimumSpeed",
+ get: function get() {
+ if (this.isYouTube) {
+ // https://developers.google.com/youtube/iframe_api_reference#setPlaybackRate
+ return Math.min.apply(Math, _toConsumableArray(this.options.speed));
+ }
+
+ if (this.isVimeo) {
+ // https://github.com/vimeo/player.js/#setplaybackrateplaybackrate-number-promisenumber-rangeerrorerror
+ return 0.5;
+ } // https://stackoverflow.com/a/32320020/1191319
+
+
+ return 0.0625;
+ }
+ /**
+ * Get the maximum allowed speed
+ */
+
+ }, {
+ key: "maximumSpeed",
+ get: function get() {
+ if (this.isYouTube) {
+ // https://developers.google.com/youtube/iframe_api_reference#setPlaybackRate
+ return Math.max.apply(Math, _toConsumableArray(this.options.speed));
+ }
+
+ if (this.isVimeo) {
+ // https://github.com/vimeo/player.js/#setplaybackrateplaybackrate-number-promisenumber-rangeerrorerror
+ return 2;
+ } // https://stackoverflow.com/a/32320020/1191319
+
+
+ return 16;
+ }
+ /**
+ * Set playback quality
+ * Currently HTML5 & YouTube only
+ * @param {Number} input - Quality level
+ */
+
+ }, {
+ key: "quality",
+ set: function set(input) {
+ var config = this.config.quality;
+ var options = this.options.quality;
+
+ if (!options.length) {
+ return;
+ }
+
+ var quality = [!is$1.empty(input) && Number(input), this.storage.get('quality'), config.selected, config.default].find(is$1.number);
+ var updateStorage = true;
+
+ if (!options.includes(quality)) {
+ var value = closest$1(options, quality);
+ this.debug.warn("Unsupported quality option: ".concat(quality, ", using ").concat(value, " instead"));
+ quality = value; // Don't update storage if quality is not supported
+
+ updateStorage = false;
+ } // Update config
+
+
+ config.selected = quality; // Set quality
+
+ this.media.quality = quality; // Save to storage
+
+ if (updateStorage) {
+ this.storage.set({
+ quality: quality
+ });
+ }
+ }
+ /**
+ * Get current quality level
+ */
+ ,
+ get: function get() {
+ return this.media.quality;
+ }
+ /**
+ * Toggle loop
+ * TODO: Finish fancy new logic. Set the indicator on load as user may pass loop as config
+ * @param {Boolean} input - Whether to loop or not
+ */
+
+ }, {
+ key: "loop",
+ set: function set(input) {
+ var toggle = is$1.boolean(input) ? input : this.config.loop.active;
+ this.config.loop.active = toggle;
+ this.media.loop = toggle; // Set default to be a true toggle
+
+ /* const type = ['start', 'end', 'all', 'none', 'toggle'].includes(input) ? input : 'toggle';
+ switch (type) {
+ case 'start':
+ if (this.config.loop.end && this.config.loop.end <= this.currentTime) {
+ this.config.loop.end = null;
+ }
+ this.config.loop.start = this.currentTime;
+ // this.config.loop.indicator.start = this.elements.display.played.value;
+ break;
+ case 'end':
+ if (this.config.loop.start >= this.currentTime) {
+ return this;
+ }
+ this.config.loop.end = this.currentTime;
+ // this.config.loop.indicator.end = this.elements.display.played.value;
+ break;
+ case 'all':
+ this.config.loop.start = 0;
+ this.config.loop.end = this.duration - 2;
+ this.config.loop.indicator.start = 0;
+ this.config.loop.indicator.end = 100;
+ break;
+ case 'toggle':
+ if (this.config.loop.active) {
+ this.config.loop.start = 0;
+ this.config.loop.end = null;
+ } else {
+ this.config.loop.start = 0;
+ this.config.loop.end = this.duration - 2;
+ }
+ break;
+ default:
+ this.config.loop.start = 0;
+ this.config.loop.end = null;
+ break;
+ } */
+ }
+ /**
+ * Get current loop state
+ */
+ ,
+ get: function get() {
+ return Boolean(this.media.loop);
+ }
+ /**
+ * Set new media source
+ * @param {Object} input - The new source object (see docs)
+ */
+
+ }, {
+ key: "source",
+ set: function set(input) {
+ source.change.call(this, input);
+ }
+ /**
+ * Get current source
+ */
+ ,
+ get: function get() {
+ return this.media.currentSrc;
+ }
+ /**
+ * Get a download URL (either source or custom)
+ */
+
+ }, {
+ key: "download",
+ get: function get() {
+ var download = this.config.urls.download;
+ return is$1.url(download) ? download : this.source;
+ }
+ /**
+ * Set the download URL
+ */
+ ,
+ set: function set(input) {
+ if (!is$1.url(input)) {
+ return;
+ }
+
+ this.config.urls.download = input;
+ controls.setDownloadUrl.call(this);
+ }
+ /**
+ * Set the poster image for a video
+ * @param {String} input - the URL for the new poster image
+ */
+
+ }, {
+ key: "poster",
+ set: function set(input) {
+ if (!this.isVideo) {
+ this.debug.warn('Poster can only be set for video');
+ return;
+ }
+
+ ui.setPoster.call(this, input, false).catch(function () {});
+ }
+ /**
+ * Get the current poster image
+ */
+ ,
+ get: function get() {
+ if (!this.isVideo) {
+ return null;
+ }
+
+ return this.media.getAttribute('poster') || this.media.getAttribute('data-poster');
+ }
+ /**
+ * Get the current aspect ratio in use
+ */
+
+ }, {
+ key: "ratio",
+ get: function get() {
+ if (!this.isVideo) {
+ return null;
+ }
+
+ var ratio = reduceAspectRatio(getAspectRatio.call(this));
+ return is$1.array(ratio) ? ratio.join(':') : ratio;
+ }
+ /**
+ * Set video aspect ratio
+ */
+ ,
+ set: function set(input) {
+ if (!this.isVideo) {
+ this.debug.warn('Aspect ratio can only be set for video');
+ return;
+ }
+
+ if (!is$1.string(input) || !validateRatio(input)) {
+ this.debug.error("Invalid aspect ratio specified (".concat(input, ")"));
+ return;
+ }
+
+ this.config.ratio = input;
+ setAspectRatio.call(this);
+ }
+ /**
+ * Set the autoplay state
+ * @param {Boolean} input - Whether to autoplay or not
+ */
+
+ }, {
+ key: "autoplay",
+ set: function set(input) {
+ var toggle = is$1.boolean(input) ? input : this.config.autoplay;
+ this.config.autoplay = toggle;
+ }
+ /**
+ * Get the current autoplay state
+ */
+ ,
+ get: function get() {
+ return Boolean(this.config.autoplay);
+ }
+ }, {
+ key: "currentTrack",
+ set: function set(input) {
+ captions.set.call(this, input, false);
+ }
+ /**
+ * Get the current caption track index (-1 if disabled)
+ */
+ ,
+ get: function get() {
+ var _this$captions = this.captions,
+ toggled = _this$captions.toggled,
+ currentTrack = _this$captions.currentTrack;
+ return toggled ? currentTrack : -1;
+ }
+ /**
+ * Set the wanted language for captions
+ * Since tracks can be added later it won't update the actual caption track until there is a matching track
+ * @param {String} - Two character ISO language code (e.g. EN, FR, PT, etc)
+ */
+
+ }, {
+ key: "language",
+ set: function set(input) {
+ captions.setLanguage.call(this, input, false);
+ }
+ /**
+ * Get the current track's language
+ */
+ ,
+ get: function get() {
+ return (captions.getCurrentTrack.call(this) || {}).language;
+ }
+ /**
+ * Toggle picture-in-picture playback on WebKit/MacOS
+ * TODO: update player with state, support, enabled
+ * TODO: detect outside changes
+ */
+
+ }, {
+ key: "pip",
+ set: function set(input) {
+ // Bail if no support
+ if (!support.pip) {
+ return;
+ } // Toggle based on current state if not passed
+
+
+ var toggle = is$1.boolean(input) ? input : !this.pip; // Toggle based on current state
+ // Safari
+
+ if (is$1.function(this.media.webkitSetPresentationMode)) {
+ this.media.webkitSetPresentationMode(toggle ? pip.active : pip.inactive);
+ } // Chrome
+
+
+ if (is$1.function(this.media.requestPictureInPicture)) {
+ if (!this.pip && toggle) {
+ this.media.requestPictureInPicture();
+ } else if (this.pip && !toggle) {
+ document.exitPictureInPicture();
+ }
+ }
+ }
+ /**
+ * Get the current picture-in-picture state
+ */
+ ,
+ get: function get() {
+ if (!support.pip) {
+ return null;
+ } // Safari
+
+
+ if (!is$1.empty(this.media.webkitPresentationMode)) {
+ return this.media.webkitPresentationMode === pip.active;
+ } // Chrome
+
+
+ return this.media === document.pictureInPictureElement;
+ }
+ }], [{
+ key: "supported",
+ value: function supported(type, provider, inline) {
+ return support.check(type, provider, inline);
+ }
+ /**
+ * Load an SVG sprite into the page
+ * @param {String} url - URL for the SVG sprite
+ * @param {String} [id] - Unique ID
+ */
+
+ }, {
+ key: "loadSprite",
+ value: function loadSprite$1(url, id) {
+ return loadSprite(url, id);
+ }
+ /**
+ * Setup multiple instances
+ * @param {*} selector
+ * @param {Object} options
+ */
+
+ }, {
+ key: "setup",
+ value: function setup(selector) {
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
+ var targets = null;
+
+ if (is$1.string(selector)) {
+ targets = Array.from(document.querySelectorAll(selector));
+ } else if (is$1.nodeList(selector)) {
+ targets = Array.from(selector);
+ } else if (is$1.array(selector)) {
+ targets = selector.filter(is$1.element);
+ }
+
+ if (is$1.empty(targets)) {
+ return null;
+ }
+
+ return targets.map(function (t) {
+ return new Plyr(t, options);
+ });
+ }
+ }]);
+
+ return Plyr;
+}();
+
+Plyr.defaults = cloneDeep(defaults$1);
+
+export default Plyr;
diff --git a/youtube/static/modules/plyr/plyr.polyfilled.js b/youtube/static/modules/plyr/plyr.polyfilled.js
new file mode 100644
index 0000000..a8187b1
--- /dev/null
+++ b/youtube/static/modules/plyr/plyr.polyfilled.js
@@ -0,0 +1,15761 @@
+typeof navigator === "object" && (function (global, factory) {
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
+ typeof define === 'function' && define.amd ? define('Plyr', factory) :
+ (global = global || self, global.Plyr = factory());
+}(this, (function () { 'use strict';
+
+ // Polyfill for creating CustomEvents on IE9/10/11
+ // code pulled from:
+ // https://github.com/d4tocchini/customevent-polyfill
+ // https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent#Polyfill
+ (function () {
+ if (typeof window === 'undefined') {
+ return;
+ }
+
+ try {
+ var ce = new window.CustomEvent('test', {
+ cancelable: true
+ });
+ ce.preventDefault();
+
+ if (ce.defaultPrevented !== true) {
+ // IE has problems with .preventDefault() on custom events
+ // http://stackoverflow.com/questions/23349191
+ throw new Error('Could not prevent default');
+ }
+ } catch (e) {
+ var CustomEvent = function CustomEvent(event, params) {
+ var evt, origPrevent;
+ params = params || {};
+ params.bubbles = !!params.bubbles;
+ params.cancelable = !!params.cancelable;
+ evt = document.createEvent('CustomEvent');
+ evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);
+ origPrevent = evt.preventDefault;
+
+ evt.preventDefault = function () {
+ origPrevent.call(this);
+
+ try {
+ Object.defineProperty(this, 'defaultPrevented', {
+ get: function get() {
+ return true;
+ }
+ });
+ } catch (e) {
+ this.defaultPrevented = true;
+ }
+ };
+
+ return evt;
+ };
+
+ CustomEvent.prototype = window.Event.prototype;
+ window.CustomEvent = CustomEvent; // expose definition to window
+ }
+ })();
+
+ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
+
+ function createCommonjsModule(fn, module) {
+ return module = { exports: {} }, fn(module, module.exports), module.exports;
+ }
+
+ var check = function (it) {
+ return it && it.Math == Math && it;
+ };
+
+ // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
+ var global_1 =
+ // eslint-disable-next-line no-undef
+ check(typeof globalThis == 'object' && globalThis) ||
+ check(typeof window == 'object' && window) ||
+ check(typeof self == 'object' && self) ||
+ check(typeof commonjsGlobal == 'object' && commonjsGlobal) ||
+ // eslint-disable-next-line no-new-func
+ Function('return this')();
+
+ var fails = function (exec) {
+ try {
+ return !!exec();
+ } catch (error) {
+ return true;
+ }
+ };
+
+ // Thank's IE8 for his funny defineProperty
+ var descriptors = !fails(function () {
+ return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7;
+ });
+
+ var nativePropertyIsEnumerable = {}.propertyIsEnumerable;
+ var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
+
+ // Nashorn ~ JDK8 bug
+ var NASHORN_BUG = getOwnPropertyDescriptor && !nativePropertyIsEnumerable.call({ 1: 2 }, 1);
+
+ // `Object.prototype.propertyIsEnumerable` method implementation
+ // https://tc39.github.io/ecma262/#sec-object.prototype.propertyisenumerable
+ var f = NASHORN_BUG ? function propertyIsEnumerable(V) {
+ var descriptor = getOwnPropertyDescriptor(this, V);
+ return !!descriptor && descriptor.enumerable;
+ } : nativePropertyIsEnumerable;
+
+ var objectPropertyIsEnumerable = {
+ f: f
+ };
+
+ var createPropertyDescriptor = function (bitmap, value) {
+ return {
+ enumerable: !(bitmap & 1),
+ configurable: !(bitmap & 2),
+ writable: !(bitmap & 4),
+ value: value
+ };
+ };
+
+ var toString = {}.toString;
+
+ var classofRaw = function (it) {
+ return toString.call(it).slice(8, -1);
+ };
+
+ var split = ''.split;
+
+ // fallback for non-array-like ES3 and non-enumerable old V8 strings
+ var indexedObject = fails(function () {
+ // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
+ // eslint-disable-next-line no-prototype-builtins
+ return !Object('z').propertyIsEnumerable(0);
+ }) ? function (it) {
+ return classofRaw(it) == 'String' ? split.call(it, '') : Object(it);
+ } : Object;
+
+ // `RequireObjectCoercible` abstract operation
+ // https://tc39.github.io/ecma262/#sec-requireobjectcoercible
+ var requireObjectCoercible = function (it) {
+ if (it == undefined) throw TypeError("Can't call method on " + it);
+ return it;
+ };
+
+ // toObject with fallback for non-array-like ES3 strings
+
+
+
+ var toIndexedObject = function (it) {
+ return indexedObject(requireObjectCoercible(it));
+ };
+
+ var isObject = function (it) {
+ return typeof it === 'object' ? it !== null : typeof it === 'function';
+ };
+
+ // `ToPrimitive` abstract operation
+ // https://tc39.github.io/ecma262/#sec-toprimitive
+ // instead of the ES6 spec version, we didn't implement @@toPrimitive case
+ // and the second argument - flag - preferred type is a string
+ var toPrimitive = function (input, PREFERRED_STRING) {
+ if (!isObject(input)) return input;
+ var fn, val;
+ if (PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
+ if (typeof (fn = input.valueOf) == 'function' && !isObject(val = fn.call(input))) return val;
+ if (!PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
+ throw TypeError("Can't convert object to primitive value");
+ };
+
+ var hasOwnProperty = {}.hasOwnProperty;
+
+ var has = function (it, key) {
+ return hasOwnProperty.call(it, key);
+ };
+
+ var document$1 = global_1.document;
+ // typeof document.createElement is 'object' in old IE
+ var EXISTS = isObject(document$1) && isObject(document$1.createElement);
+
+ var documentCreateElement = function (it) {
+ return EXISTS ? document$1.createElement(it) : {};
+ };
+
+ // Thank's IE8 for his funny defineProperty
+ var ie8DomDefine = !descriptors && !fails(function () {
+ return Object.defineProperty(documentCreateElement('div'), 'a', {
+ get: function () { return 7; }
+ }).a != 7;
+ });
+
+ var nativeGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
+
+ // `Object.getOwnPropertyDescriptor` method
+ // https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptor
+ var f$1 = descriptors ? nativeGetOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
+ O = toIndexedObject(O);
+ P = toPrimitive(P, true);
+ if (ie8DomDefine) try {
+ return nativeGetOwnPropertyDescriptor(O, P);
+ } catch (error) { /* empty */ }
+ if (has(O, P)) return createPropertyDescriptor(!objectPropertyIsEnumerable.f.call(O, P), O[P]);
+ };
+
+ var objectGetOwnPropertyDescriptor = {
+ f: f$1
+ };
+
+ var anObject = function (it) {
+ if (!isObject(it)) {
+ throw TypeError(String(it) + ' is not an object');
+ } return it;
+ };
+
+ var nativeDefineProperty = Object.defineProperty;
+
+ // `Object.defineProperty` method
+ // https://tc39.github.io/ecma262/#sec-object.defineproperty
+ var f$2 = descriptors ? nativeDefineProperty : function defineProperty(O, P, Attributes) {
+ anObject(O);
+ P = toPrimitive(P, true);
+ anObject(Attributes);
+ if (ie8DomDefine) try {
+ return nativeDefineProperty(O, P, Attributes);
+ } catch (error) { /* empty */ }
+ if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported');
+ if ('value' in Attributes) O[P] = Attributes.value;
+ return O;
+ };
+
+ var objectDefineProperty = {
+ f: f$2
+ };
+
+ var createNonEnumerableProperty = descriptors ? function (object, key, value) {
+ return objectDefineProperty.f(object, key, createPropertyDescriptor(1, value));
+ } : function (object, key, value) {
+ object[key] = value;
+ return object;
+ };
+
+ var setGlobal = function (key, value) {
+ try {
+ createNonEnumerableProperty(global_1, key, value);
+ } catch (error) {
+ global_1[key] = value;
+ } return value;
+ };
+
+ var SHARED = '__core-js_shared__';
+ var store = global_1[SHARED] || setGlobal(SHARED, {});
+
+ var sharedStore = store;
+
+ var functionToString = Function.toString;
+
+ // this helper broken in `3.4.1-3.4.4`, so we can't use `shared` helper
+ if (typeof sharedStore.inspectSource != 'function') {
+ sharedStore.inspectSource = function (it) {
+ return functionToString.call(it);
+ };
+ }
+
+ var inspectSource = sharedStore.inspectSource;
+
+ var WeakMap$1 = global_1.WeakMap;
+
+ var nativeWeakMap = typeof WeakMap$1 === 'function' && /native code/.test(inspectSource(WeakMap$1));
+
+ var isPure = false;
+
+ var shared = createCommonjsModule(function (module) {
+ (module.exports = function (key, value) {
+ return sharedStore[key] || (sharedStore[key] = value !== undefined ? value : {});
+ })('versions', []).push({
+ version: '3.6.5',
+ mode: 'global',
+ copyright: '© 2020 Denis Pushkarev (zloirock.ru)'
+ });
+ });
+
+ var id = 0;
+ var postfix = Math.random();
+
+ var uid = function (key) {
+ return 'Symbol(' + String(key === undefined ? '' : key) + ')_' + (++id + postfix).toString(36);
+ };
+
+ var keys = shared('keys');
+
+ var sharedKey = function (key) {
+ return keys[key] || (keys[key] = uid(key));
+ };
+
+ var hiddenKeys = {};
+
+ var WeakMap$2 = global_1.WeakMap;
+ var set, get, has$1;
+
+ var enforce = function (it) {
+ return has$1(it) ? get(it) : set(it, {});
+ };
+
+ var getterFor = function (TYPE) {
+ return function (it) {
+ var state;
+ if (!isObject(it) || (state = get(it)).type !== TYPE) {
+ throw TypeError('Incompatible receiver, ' + TYPE + ' required');
+ } return state;
+ };
+ };
+
+ if (nativeWeakMap) {
+ var store$1 = new WeakMap$2();
+ var wmget = store$1.get;
+ var wmhas = store$1.has;
+ var wmset = store$1.set;
+ set = function (it, metadata) {
+ wmset.call(store$1, it, metadata);
+ return metadata;
+ };
+ get = function (it) {
+ return wmget.call(store$1, it) || {};
+ };
+ has$1 = function (it) {
+ return wmhas.call(store$1, it);
+ };
+ } else {
+ var STATE = sharedKey('state');
+ hiddenKeys[STATE] = true;
+ set = function (it, metadata) {
+ createNonEnumerableProperty(it, STATE, metadata);
+ return metadata;
+ };
+ get = function (it) {
+ return has(it, STATE) ? it[STATE] : {};
+ };
+ has$1 = function (it) {
+ return has(it, STATE);
+ };
+ }
+
+ var internalState = {
+ set: set,
+ get: get,
+ has: has$1,
+ enforce: enforce,
+ getterFor: getterFor
+ };
+
+ var redefine = createCommonjsModule(function (module) {
+ var getInternalState = internalState.get;
+ var enforceInternalState = internalState.enforce;
+ var TEMPLATE = String(String).split('String');
+
+ (module.exports = function (O, key, value, options) {
+ var unsafe = options ? !!options.unsafe : false;
+ var simple = options ? !!options.enumerable : false;
+ var noTargetGet = options ? !!options.noTargetGet : false;
+ if (typeof value == 'function') {
+ if (typeof key == 'string' && !has(value, 'name')) createNonEnumerableProperty(value, 'name', key);
+ enforceInternalState(value).source = TEMPLATE.join(typeof key == 'string' ? key : '');
+ }
+ if (O === global_1) {
+ if (simple) O[key] = value;
+ else setGlobal(key, value);
+ return;
+ } else if (!unsafe) {
+ delete O[key];
+ } else if (!noTargetGet && O[key]) {
+ simple = true;
+ }
+ if (simple) O[key] = value;
+ else createNonEnumerableProperty(O, key, value);
+ // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
+ })(Function.prototype, 'toString', function toString() {
+ return typeof this == 'function' && getInternalState(this).source || inspectSource(this);
+ });
+ });
+
+ var path = global_1;
+
+ var aFunction = function (variable) {
+ return typeof variable == 'function' ? variable : undefined;
+ };
+
+ var getBuiltIn = function (namespace, method) {
+ return arguments.length < 2 ? aFunction(path[namespace]) || aFunction(global_1[namespace])
+ : path[namespace] && path[namespace][method] || global_1[namespace] && global_1[namespace][method];
+ };
+
+ var ceil = Math.ceil;
+ var floor = Math.floor;
+
+ // `ToInteger` abstract operation
+ // https://tc39.github.io/ecma262/#sec-tointeger
+ var toInteger = function (argument) {
+ return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor : ceil)(argument);
+ };
+
+ var min = Math.min;
+
+ // `ToLength` abstract operation
+ // https://tc39.github.io/ecma262/#sec-tolength
+ var toLength = function (argument) {
+ return argument > 0 ? min(toInteger(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
+ };
+
+ var max = Math.max;
+ var min$1 = Math.min;
+
+ // Helper for a popular repeating case of the spec:
+ // Let integer be ? ToInteger(index).
+ // If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
+ var toAbsoluteIndex = function (index, length) {
+ var integer = toInteger(index);
+ return integer < 0 ? max(integer + length, 0) : min$1(integer, length);
+ };
+
+ // `Array.prototype.{ indexOf, includes }` methods implementation
+ var createMethod = function (IS_INCLUDES) {
+ return function ($this, el, fromIndex) {
+ var O = toIndexedObject($this);
+ var length = toLength(O.length);
+ var index = toAbsoluteIndex(fromIndex, length);
+ var value;
+ // Array#includes uses SameValueZero equality algorithm
+ // eslint-disable-next-line no-self-compare
+ if (IS_INCLUDES && el != el) while (length > index) {
+ value = O[index++];
+ // eslint-disable-next-line no-self-compare
+ if (value != value) return true;
+ // Array#indexOf ignores holes, Array#includes - not
+ } else for (;length > index; index++) {
+ if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
+ } return !IS_INCLUDES && -1;
+ };
+ };
+
+ var arrayIncludes = {
+ // `Array.prototype.includes` method
+ // https://tc39.github.io/ecma262/#sec-array.prototype.includes
+ includes: createMethod(true),
+ // `Array.prototype.indexOf` method
+ // https://tc39.github.io/ecma262/#sec-array.prototype.indexof
+ indexOf: createMethod(false)
+ };
+
+ var indexOf = arrayIncludes.indexOf;
+
+
+ var objectKeysInternal = function (object, names) {
+ var O = toIndexedObject(object);
+ var i = 0;
+ var result = [];
+ var key;
+ for (key in O) !has(hiddenKeys, key) && has(O, key) && result.push(key);
+ // Don't enum bug & hidden keys
+ while (names.length > i) if (has(O, key = names[i++])) {
+ ~indexOf(result, key) || result.push(key);
+ }
+ return result;
+ };
+
+ // IE8- don't enum bug keys
+ var enumBugKeys = [
+ 'constructor',
+ 'hasOwnProperty',
+ 'isPrototypeOf',
+ 'propertyIsEnumerable',
+ 'toLocaleString',
+ 'toString',
+ 'valueOf'
+ ];
+
+ var hiddenKeys$1 = enumBugKeys.concat('length', 'prototype');
+
+ // `Object.getOwnPropertyNames` method
+ // https://tc39.github.io/ecma262/#sec-object.getownpropertynames
+ var f$3 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
+ return objectKeysInternal(O, hiddenKeys$1);
+ };
+
+ var objectGetOwnPropertyNames = {
+ f: f$3
+ };
+
+ var f$4 = Object.getOwnPropertySymbols;
+
+ var objectGetOwnPropertySymbols = {
+ f: f$4
+ };
+
+ // all object keys, includes non-enumerable and symbols
+ var ownKeys = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
+ var keys = objectGetOwnPropertyNames.f(anObject(it));
+ var getOwnPropertySymbols = objectGetOwnPropertySymbols.f;
+ return getOwnPropertySymbols ? keys.concat(getOwnPropertySymbols(it)) : keys;
+ };
+
+ var copyConstructorProperties = function (target, source) {
+ var keys = ownKeys(source);
+ var defineProperty = objectDefineProperty.f;
+ var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
+ for (var i = 0; i < keys.length; i++) {
+ var key = keys[i];
+ if (!has(target, key)) defineProperty(target, key, getOwnPropertyDescriptor(source, key));
+ }
+ };
+
+ var replacement = /#|\.prototype\./;
+
+ var isForced = function (feature, detection) {
+ var value = data[normalize(feature)];
+ return value == POLYFILL ? true
+ : value == NATIVE ? false
+ : typeof detection == 'function' ? fails(detection)
+ : !!detection;
+ };
+
+ var normalize = isForced.normalize = function (string) {
+ return String(string).replace(replacement, '.').toLowerCase();
+ };
+
+ var data = isForced.data = {};
+ var NATIVE = isForced.NATIVE = 'N';
+ var POLYFILL = isForced.POLYFILL = 'P';
+
+ var isForced_1 = isForced;
+
+ var getOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f;
+
+
+
+
+
+
+ /*
+ options.target - name of the target object
+ options.global - target is the global object
+ options.stat - export as static methods of target
+ options.proto - export as prototype methods of target
+ options.real - real prototype method for the `pure` version
+ options.forced - export even if the native feature is available
+ options.bind - bind methods to the target, required for the `pure` version
+ options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
+ options.unsafe - use the simple assignment of property instead of delete + defineProperty
+ options.sham - add a flag to not completely full polyfills
+ options.enumerable - export as enumerable property
+ options.noTargetGet - prevent calling a getter on target
+ */
+ var _export = function (options, source) {
+ var TARGET = options.target;
+ var GLOBAL = options.global;
+ var STATIC = options.stat;
+ var FORCED, target, key, targetProperty, sourceProperty, descriptor;
+ if (GLOBAL) {
+ target = global_1;
+ } else if (STATIC) {
+ target = global_1[TARGET] || setGlobal(TARGET, {});
+ } else {
+ target = (global_1[TARGET] || {}).prototype;
+ }
+ if (target) for (key in source) {
+ sourceProperty = source[key];
+ if (options.noTargetGet) {
+ descriptor = getOwnPropertyDescriptor$1(target, key);
+ targetProperty = descriptor && descriptor.value;
+ } else targetProperty = target[key];
+ FORCED = isForced_1(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
+ // contained in target
+ if (!FORCED && targetProperty !== undefined) {
+ if (typeof sourceProperty === typeof targetProperty) continue;
+ copyConstructorProperties(sourceProperty, targetProperty);
+ }
+ // add a flag to not completely full polyfills
+ if (options.sham || (targetProperty && targetProperty.sham)) {
+ createNonEnumerableProperty(sourceProperty, 'sham', true);
+ }
+ // extend global
+ redefine(target, key, sourceProperty, options);
+ }
+ };
+
+ var nativeSymbol = !!Object.getOwnPropertySymbols && !fails(function () {
+ // Chrome 38 Symbol has incorrect toString conversion
+ // eslint-disable-next-line no-undef
+ return !String(Symbol());
+ });
+
+ var useSymbolAsUid = nativeSymbol
+ // eslint-disable-next-line no-undef
+ && !Symbol.sham
+ // eslint-disable-next-line no-undef
+ && typeof Symbol.iterator == 'symbol';
+
+ // `IsArray` abstract operation
+ // https://tc39.github.io/ecma262/#sec-isarray
+ var isArray = Array.isArray || function isArray(arg) {
+ return classofRaw(arg) == 'Array';
+ };
+
+ // `ToObject` abstract operation
+ // https://tc39.github.io/ecma262/#sec-toobject
+ var toObject = function (argument) {
+ return Object(requireObjectCoercible(argument));
+ };
+
+ // `Object.keys` method
+ // https://tc39.github.io/ecma262/#sec-object.keys
+ var objectKeys = Object.keys || function keys(O) {
+ return objectKeysInternal(O, enumBugKeys);
+ };
+
+ // `Object.defineProperties` method
+ // https://tc39.github.io/ecma262/#sec-object.defineproperties
+ var objectDefineProperties = descriptors ? Object.defineProperties : function defineProperties(O, Properties) {
+ anObject(O);
+ var keys = objectKeys(Properties);
+ var length = keys.length;
+ var index = 0;
+ var key;
+ while (length > index) objectDefineProperty.f(O, key = keys[index++], Properties[key]);
+ return O;
+ };
+
+ var html = getBuiltIn('document', 'documentElement');
+
+ var GT = '>';
+ var LT = '<';
+ var PROTOTYPE = 'prototype';
+ var SCRIPT = 'script';
+ var IE_PROTO = sharedKey('IE_PROTO');
+
+ var EmptyConstructor = function () { /* empty */ };
+
+ var scriptTag = function (content) {
+ return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
+ };
+
+ // Create object with fake `null` prototype: use ActiveX Object with cleared prototype
+ var NullProtoObjectViaActiveX = function (activeXDocument) {
+ activeXDocument.write(scriptTag(''));
+ activeXDocument.close();
+ var temp = activeXDocument.parentWindow.Object;
+ activeXDocument = null; // avoid memory leak
+ return temp;
+ };
+
+ // Create object with fake `null` prototype: use iframe Object with cleared prototype
+ var NullProtoObjectViaIFrame = function () {
+ // Thrash, waste and sodomy: IE GC bug
+ var iframe = documentCreateElement('iframe');
+ var JS = 'java' + SCRIPT + ':';
+ var iframeDocument;
+ iframe.style.display = 'none';
+ html.appendChild(iframe);
+ // https://github.com/zloirock/core-js/issues/475
+ iframe.src = String(JS);
+ iframeDocument = iframe.contentWindow.document;
+ iframeDocument.open();
+ iframeDocument.write(scriptTag('document.F=Object'));
+ iframeDocument.close();
+ return iframeDocument.F;
+ };
+
+ // Check for document.domain and active x support
+ // No need to use active x approach when document.domain is not set
+ // see https://github.com/es-shims/es5-shim/issues/150
+ // variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346
+ // avoid IE GC bug
+ var activeXDocument;
+ var NullProtoObject = function () {
+ try {
+ /* global ActiveXObject */
+ activeXDocument = document.domain && new ActiveXObject('htmlfile');
+ } catch (error) { /* ignore */ }
+ NullProtoObject = activeXDocument ? NullProtoObjectViaActiveX(activeXDocument) : NullProtoObjectViaIFrame();
+ var length = enumBugKeys.length;
+ while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];
+ return NullProtoObject();
+ };
+
+ hiddenKeys[IE_PROTO] = true;
+
+ // `Object.create` method
+ // https://tc39.github.io/ecma262/#sec-object.create
+ var objectCreate = Object.create || function create(O, Properties) {
+ var result;
+ if (O !== null) {
+ EmptyConstructor[PROTOTYPE] = anObject(O);
+ result = new EmptyConstructor();
+ EmptyConstructor[PROTOTYPE] = null;
+ // add "__proto__" for Object.getPrototypeOf polyfill
+ result[IE_PROTO] = O;
+ } else result = NullProtoObject();
+ return Properties === undefined ? result : objectDefineProperties(result, Properties);
+ };
+
+ var nativeGetOwnPropertyNames = objectGetOwnPropertyNames.f;
+
+ var toString$1 = {}.toString;
+
+ var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames
+ ? Object.getOwnPropertyNames(window) : [];
+
+ var getWindowNames = function (it) {
+ try {
+ return nativeGetOwnPropertyNames(it);
+ } catch (error) {
+ return windowNames.slice();
+ }
+ };
+
+ // fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window
+ var f$5 = function getOwnPropertyNames(it) {
+ return windowNames && toString$1.call(it) == '[object Window]'
+ ? getWindowNames(it)
+ : nativeGetOwnPropertyNames(toIndexedObject(it));
+ };
+
+ var objectGetOwnPropertyNamesExternal = {
+ f: f$5
+ };
+
+ var WellKnownSymbolsStore = shared('wks');
+ var Symbol$1 = global_1.Symbol;
+ var createWellKnownSymbol = useSymbolAsUid ? Symbol$1 : Symbol$1 && Symbol$1.withoutSetter || uid;
+
+ var wellKnownSymbol = function (name) {
+ if (!has(WellKnownSymbolsStore, name)) {
+ if (nativeSymbol && has(Symbol$1, name)) WellKnownSymbolsStore[name] = Symbol$1[name];
+ else WellKnownSymbolsStore[name] = createWellKnownSymbol('Symbol.' + name);
+ } return WellKnownSymbolsStore[name];
+ };
+
+ var f$6 = wellKnownSymbol;
+
+ var wellKnownSymbolWrapped = {
+ f: f$6
+ };
+
+ var defineProperty = objectDefineProperty.f;
+
+ var defineWellKnownSymbol = function (NAME) {
+ var Symbol = path.Symbol || (path.Symbol = {});
+ if (!has(Symbol, NAME)) defineProperty(Symbol, NAME, {
+ value: wellKnownSymbolWrapped.f(NAME)
+ });
+ };
+
+ var defineProperty$1 = objectDefineProperty.f;
+
+
+
+ var TO_STRING_TAG = wellKnownSymbol('toStringTag');
+
+ var setToStringTag = function (it, TAG, STATIC) {
+ if (it && !has(it = STATIC ? it : it.prototype, TO_STRING_TAG)) {
+ defineProperty$1(it, TO_STRING_TAG, { configurable: true, value: TAG });
+ }
+ };
+
+ var aFunction$1 = function (it) {
+ if (typeof it != 'function') {
+ throw TypeError(String(it) + ' is not a function');
+ } return it;
+ };
+
+ // optional / simple context binding
+ var functionBindContext = function (fn, that, length) {
+ aFunction$1(fn);
+ if (that === undefined) return fn;
+ switch (length) {
+ case 0: return function () {
+ return fn.call(that);
+ };
+ case 1: return function (a) {
+ return fn.call(that, a);
+ };
+ case 2: return function (a, b) {
+ return fn.call(that, a, b);
+ };
+ case 3: return function (a, b, c) {
+ return fn.call(that, a, b, c);
+ };
+ }
+ return function (/* ...args */) {
+ return fn.apply(that, arguments);
+ };
+ };
+
+ var SPECIES = wellKnownSymbol('species');
+
+ // `ArraySpeciesCreate` abstract operation
+ // https://tc39.github.io/ecma262/#sec-arrayspeciescreate
+ var arraySpeciesCreate = function (originalArray, length) {
+ var C;
+ if (isArray(originalArray)) {
+ C = originalArray.constructor;
+ // cross-realm fallback
+ if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined;
+ else if (isObject(C)) {
+ C = C[SPECIES];
+ if (C === null) C = undefined;
+ }
+ } return new (C === undefined ? Array : C)(length === 0 ? 0 : length);
+ };
+
+ var push = [].push;
+
+ // `Array.prototype.{ forEach, map, filter, some, every, find, findIndex }` methods implementation
+ var createMethod$1 = function (TYPE) {
+ var IS_MAP = TYPE == 1;
+ var IS_FILTER = TYPE == 2;
+ var IS_SOME = TYPE == 3;
+ var IS_EVERY = TYPE == 4;
+ var IS_FIND_INDEX = TYPE == 6;
+ var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
+ return function ($this, callbackfn, that, specificCreate) {
+ var O = toObject($this);
+ var self = indexedObject(O);
+ var boundFunction = functionBindContext(callbackfn, that, 3);
+ var length = toLength(self.length);
+ var index = 0;
+ var create = specificCreate || arraySpeciesCreate;
+ var target = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined;
+ var value, result;
+ for (;length > index; index++) if (NO_HOLES || index in self) {
+ value = self[index];
+ result = boundFunction(value, index, O);
+ if (TYPE) {
+ if (IS_MAP) target[index] = result; // map
+ else if (result) switch (TYPE) {
+ case 3: return true; // some
+ case 5: return value; // find
+ case 6: return index; // findIndex
+ case 2: push.call(target, value); // filter
+ } else if (IS_EVERY) return false; // every
+ }
+ }
+ return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target;
+ };
+ };
+
+ var arrayIteration = {
+ // `Array.prototype.forEach` method
+ // https://tc39.github.io/ecma262/#sec-array.prototype.foreach
+ forEach: createMethod$1(0),
+ // `Array.prototype.map` method
+ // https://tc39.github.io/ecma262/#sec-array.prototype.map
+ map: createMethod$1(1),
+ // `Array.prototype.filter` method
+ // https://tc39.github.io/ecma262/#sec-array.prototype.filter
+ filter: createMethod$1(2),
+ // `Array.prototype.some` method
+ // https://tc39.github.io/ecma262/#sec-array.prototype.some
+ some: createMethod$1(3),
+ // `Array.prototype.every` method
+ // https://tc39.github.io/ecma262/#sec-array.prototype.every
+ every: createMethod$1(4),
+ // `Array.prototype.find` method
+ // https://tc39.github.io/ecma262/#sec-array.prototype.find
+ find: createMethod$1(5),
+ // `Array.prototype.findIndex` method
+ // https://tc39.github.io/ecma262/#sec-array.prototype.findIndex
+ findIndex: createMethod$1(6)
+ };
+
+ var $forEach = arrayIteration.forEach;
+
+ var HIDDEN = sharedKey('hidden');
+ var SYMBOL = 'Symbol';
+ var PROTOTYPE$1 = 'prototype';
+ var TO_PRIMITIVE = wellKnownSymbol('toPrimitive');
+ var setInternalState = internalState.set;
+ var getInternalState = internalState.getterFor(SYMBOL);
+ var ObjectPrototype = Object[PROTOTYPE$1];
+ var $Symbol = global_1.Symbol;
+ var $stringify = getBuiltIn('JSON', 'stringify');
+ var nativeGetOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f;
+ var nativeDefineProperty$1 = objectDefineProperty.f;
+ var nativeGetOwnPropertyNames$1 = objectGetOwnPropertyNamesExternal.f;
+ var nativePropertyIsEnumerable$1 = objectPropertyIsEnumerable.f;
+ var AllSymbols = shared('symbols');
+ var ObjectPrototypeSymbols = shared('op-symbols');
+ var StringToSymbolRegistry = shared('string-to-symbol-registry');
+ var SymbolToStringRegistry = shared('symbol-to-string-registry');
+ var WellKnownSymbolsStore$1 = shared('wks');
+ var QObject = global_1.QObject;
+ // Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173
+ var USE_SETTER = !QObject || !QObject[PROTOTYPE$1] || !QObject[PROTOTYPE$1].findChild;
+
+ // fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687
+ var setSymbolDescriptor = descriptors && fails(function () {
+ return objectCreate(nativeDefineProperty$1({}, 'a', {
+ get: function () { return nativeDefineProperty$1(this, 'a', { value: 7 }).a; }
+ })).a != 7;
+ }) ? function (O, P, Attributes) {
+ var ObjectPrototypeDescriptor = nativeGetOwnPropertyDescriptor$1(ObjectPrototype, P);
+ if (ObjectPrototypeDescriptor) delete ObjectPrototype[P];
+ nativeDefineProperty$1(O, P, Attributes);
+ if (ObjectPrototypeDescriptor && O !== ObjectPrototype) {
+ nativeDefineProperty$1(ObjectPrototype, P, ObjectPrototypeDescriptor);
+ }
+ } : nativeDefineProperty$1;
+
+ var wrap = function (tag, description) {
+ var symbol = AllSymbols[tag] = objectCreate($Symbol[PROTOTYPE$1]);
+ setInternalState(symbol, {
+ type: SYMBOL,
+ tag: tag,
+ description: description
+ });
+ if (!descriptors) symbol.description = description;
+ return symbol;
+ };
+
+ var isSymbol = useSymbolAsUid ? function (it) {
+ return typeof it == 'symbol';
+ } : function (it) {
+ return Object(it) instanceof $Symbol;
+ };
+
+ var $defineProperty = function defineProperty(O, P, Attributes) {
+ if (O === ObjectPrototype) $defineProperty(ObjectPrototypeSymbols, P, Attributes);
+ anObject(O);
+ var key = toPrimitive(P, true);
+ anObject(Attributes);
+ if (has(AllSymbols, key)) {
+ if (!Attributes.enumerable) {
+ if (!has(O, HIDDEN)) nativeDefineProperty$1(O, HIDDEN, createPropertyDescriptor(1, {}));
+ O[HIDDEN][key] = true;
+ } else {
+ if (has(O, HIDDEN) && O[HIDDEN][key]) O[HIDDEN][key] = false;
+ Attributes = objectCreate(Attributes, { enumerable: createPropertyDescriptor(0, false) });
+ } return setSymbolDescriptor(O, key, Attributes);
+ } return nativeDefineProperty$1(O, key, Attributes);
+ };
+
+ var $defineProperties = function defineProperties(O, Properties) {
+ anObject(O);
+ var properties = toIndexedObject(Properties);
+ var keys = objectKeys(properties).concat($getOwnPropertySymbols(properties));
+ $forEach(keys, function (key) {
+ if (!descriptors || $propertyIsEnumerable.call(properties, key)) $defineProperty(O, key, properties[key]);
+ });
+ return O;
+ };
+
+ var $create = function create(O, Properties) {
+ return Properties === undefined ? objectCreate(O) : $defineProperties(objectCreate(O), Properties);
+ };
+
+ var $propertyIsEnumerable = function propertyIsEnumerable(V) {
+ var P = toPrimitive(V, true);
+ var enumerable = nativePropertyIsEnumerable$1.call(this, P);
+ if (this === ObjectPrototype && has(AllSymbols, P) && !has(ObjectPrototypeSymbols, P)) return false;
+ return enumerable || !has(this, P) || !has(AllSymbols, P) || has(this, HIDDEN) && this[HIDDEN][P] ? enumerable : true;
+ };
+
+ var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(O, P) {
+ var it = toIndexedObject(O);
+ var key = toPrimitive(P, true);
+ if (it === ObjectPrototype && has(AllSymbols, key) && !has(ObjectPrototypeSymbols, key)) return;
+ var descriptor = nativeGetOwnPropertyDescriptor$1(it, key);
+ if (descriptor && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key])) {
+ descriptor.enumerable = true;
+ }
+ return descriptor;
+ };
+
+ var $getOwnPropertyNames = function getOwnPropertyNames(O) {
+ var names = nativeGetOwnPropertyNames$1(toIndexedObject(O));
+ var result = [];
+ $forEach(names, function (key) {
+ if (!has(AllSymbols, key) && !has(hiddenKeys, key)) result.push(key);
+ });
+ return result;
+ };
+
+ var $getOwnPropertySymbols = function getOwnPropertySymbols(O) {
+ var IS_OBJECT_PROTOTYPE = O === ObjectPrototype;
+ var names = nativeGetOwnPropertyNames$1(IS_OBJECT_PROTOTYPE ? ObjectPrototypeSymbols : toIndexedObject(O));
+ var result = [];
+ $forEach(names, function (key) {
+ if (has(AllSymbols, key) && (!IS_OBJECT_PROTOTYPE || has(ObjectPrototype, key))) {
+ result.push(AllSymbols[key]);
+ }
+ });
+ return result;
+ };
+
+ // `Symbol` constructor
+ // https://tc39.github.io/ecma262/#sec-symbol-constructor
+ if (!nativeSymbol) {
+ $Symbol = function Symbol() {
+ if (this instanceof $Symbol) throw TypeError('Symbol is not a constructor');
+ var description = !arguments.length || arguments[0] === undefined ? undefined : String(arguments[0]);
+ var tag = uid(description);
+ var setter = function (value) {
+ if (this === ObjectPrototype) setter.call(ObjectPrototypeSymbols, value);
+ if (has(this, HIDDEN) && has(this[HIDDEN], tag)) this[HIDDEN][tag] = false;
+ setSymbolDescriptor(this, tag, createPropertyDescriptor(1, value));
+ };
+ if (descriptors && USE_SETTER) setSymbolDescriptor(ObjectPrototype, tag, { configurable: true, set: setter });
+ return wrap(tag, description);
+ };
+
+ redefine($Symbol[PROTOTYPE$1], 'toString', function toString() {
+ return getInternalState(this).tag;
+ });
+
+ redefine($Symbol, 'withoutSetter', function (description) {
+ return wrap(uid(description), description);
+ });
+
+ objectPropertyIsEnumerable.f = $propertyIsEnumerable;
+ objectDefineProperty.f = $defineProperty;
+ objectGetOwnPropertyDescriptor.f = $getOwnPropertyDescriptor;
+ objectGetOwnPropertyNames.f = objectGetOwnPropertyNamesExternal.f = $getOwnPropertyNames;
+ objectGetOwnPropertySymbols.f = $getOwnPropertySymbols;
+
+ wellKnownSymbolWrapped.f = function (name) {
+ return wrap(wellKnownSymbol(name), name);
+ };
+
+ if (descriptors) {
+ // https://github.com/tc39/proposal-Symbol-description
+ nativeDefineProperty$1($Symbol[PROTOTYPE$1], 'description', {
+ configurable: true,
+ get: function description() {
+ return getInternalState(this).description;
+ }
+ });
+ {
+ redefine(ObjectPrototype, 'propertyIsEnumerable', $propertyIsEnumerable, { unsafe: true });
+ }
+ }
+ }
+
+ _export({ global: true, wrap: true, forced: !nativeSymbol, sham: !nativeSymbol }, {
+ Symbol: $Symbol
+ });
+
+ $forEach(objectKeys(WellKnownSymbolsStore$1), function (name) {
+ defineWellKnownSymbol(name);
+ });
+
+ _export({ target: SYMBOL, stat: true, forced: !nativeSymbol }, {
+ // `Symbol.for` method
+ // https://tc39.github.io/ecma262/#sec-symbol.for
+ 'for': function (key) {
+ var string = String(key);
+ if (has(StringToSymbolRegistry, string)) return StringToSymbolRegistry[string];
+ var symbol = $Symbol(string);
+ StringToSymbolRegistry[string] = symbol;
+ SymbolToStringRegistry[symbol] = string;
+ return symbol;
+ },
+ // `Symbol.keyFor` method
+ // https://tc39.github.io/ecma262/#sec-symbol.keyfor
+ keyFor: function keyFor(sym) {
+ if (!isSymbol(sym)) throw TypeError(sym + ' is not a symbol');
+ if (has(SymbolToStringRegistry, sym)) return SymbolToStringRegistry[sym];
+ },
+ useSetter: function () { USE_SETTER = true; },
+ useSimple: function () { USE_SETTER = false; }
+ });
+
+ _export({ target: 'Object', stat: true, forced: !nativeSymbol, sham: !descriptors }, {
+ // `Object.create` method
+ // https://tc39.github.io/ecma262/#sec-object.create
+ create: $create,
+ // `Object.defineProperty` method
+ // https://tc39.github.io/ecma262/#sec-object.defineproperty
+ defineProperty: $defineProperty,
+ // `Object.defineProperties` method
+ // https://tc39.github.io/ecma262/#sec-object.defineproperties
+ defineProperties: $defineProperties,
+ // `Object.getOwnPropertyDescriptor` method
+ // https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptors
+ getOwnPropertyDescriptor: $getOwnPropertyDescriptor
+ });
+
+ _export({ target: 'Object', stat: true, forced: !nativeSymbol }, {
+ // `Object.getOwnPropertyNames` method
+ // https://tc39.github.io/ecma262/#sec-object.getownpropertynames
+ getOwnPropertyNames: $getOwnPropertyNames,
+ // `Object.getOwnPropertySymbols` method
+ // https://tc39.github.io/ecma262/#sec-object.getownpropertysymbols
+ getOwnPropertySymbols: $getOwnPropertySymbols
+ });
+
+ // Chrome 38 and 39 `Object.getOwnPropertySymbols` fails on primitives
+ // https://bugs.chromium.org/p/v8/issues/detail?id=3443
+ _export({ target: 'Object', stat: true, forced: fails(function () { objectGetOwnPropertySymbols.f(1); }) }, {
+ getOwnPropertySymbols: function getOwnPropertySymbols(it) {
+ return objectGetOwnPropertySymbols.f(toObject(it));
+ }
+ });
+
+ // `JSON.stringify` method behavior with symbols
+ // https://tc39.github.io/ecma262/#sec-json.stringify
+ if ($stringify) {
+ var FORCED_JSON_STRINGIFY = !nativeSymbol || fails(function () {
+ var symbol = $Symbol();
+ // MS Edge converts symbol values to JSON as {}
+ return $stringify([symbol]) != '[null]'
+ // WebKit converts symbol values to JSON as null
+ || $stringify({ a: symbol }) != '{}'
+ // V8 throws on boxed symbols
+ || $stringify(Object(symbol)) != '{}';
+ });
+
+ _export({ target: 'JSON', stat: true, forced: FORCED_JSON_STRINGIFY }, {
+ // eslint-disable-next-line no-unused-vars
+ stringify: function stringify(it, replacer, space) {
+ var args = [it];
+ var index = 1;
+ var $replacer;
+ while (arguments.length > index) args.push(arguments[index++]);
+ $replacer = replacer;
+ if (!isObject(replacer) && it === undefined || isSymbol(it)) return; // IE8 returns string on undefined
+ if (!isArray(replacer)) replacer = function (key, value) {
+ if (typeof $replacer == 'function') value = $replacer.call(this, key, value);
+ if (!isSymbol(value)) return value;
+ };
+ args[1] = replacer;
+ return $stringify.apply(null, args);
+ }
+ });
+ }
+
+ // `Symbol.prototype[@@toPrimitive]` method
+ // https://tc39.github.io/ecma262/#sec-symbol.prototype-@@toprimitive
+ if (!$Symbol[PROTOTYPE$1][TO_PRIMITIVE]) {
+ createNonEnumerableProperty($Symbol[PROTOTYPE$1], TO_PRIMITIVE, $Symbol[PROTOTYPE$1].valueOf);
+ }
+ // `Symbol.prototype[@@toStringTag]` property
+ // https://tc39.github.io/ecma262/#sec-symbol.prototype-@@tostringtag
+ setToStringTag($Symbol, SYMBOL);
+
+ hiddenKeys[HIDDEN] = true;
+
+ var defineProperty$2 = objectDefineProperty.f;
+
+
+ var NativeSymbol = global_1.Symbol;
+
+ if (descriptors && typeof NativeSymbol == 'function' && (!('description' in NativeSymbol.prototype) ||
+ // Safari 12 bug
+ NativeSymbol().description !== undefined
+ )) {
+ var EmptyStringDescriptionStore = {};
+ // wrap Symbol constructor for correct work with undefined description
+ var SymbolWrapper = function Symbol() {
+ var description = arguments.length < 1 || arguments[0] === undefined ? undefined : String(arguments[0]);
+ var result = this instanceof SymbolWrapper
+ ? new NativeSymbol(description)
+ // in Edge 13, String(Symbol(undefined)) === 'Symbol(undefined)'
+ : description === undefined ? NativeSymbol() : NativeSymbol(description);
+ if (description === '') EmptyStringDescriptionStore[result] = true;
+ return result;
+ };
+ copyConstructorProperties(SymbolWrapper, NativeSymbol);
+ var symbolPrototype = SymbolWrapper.prototype = NativeSymbol.prototype;
+ symbolPrototype.constructor = SymbolWrapper;
+
+ var symbolToString = symbolPrototype.toString;
+ var native = String(NativeSymbol('test')) == 'Symbol(test)';
+ var regexp = /^Symbol\((.*)\)[^)]+$/;
+ defineProperty$2(symbolPrototype, 'description', {
+ configurable: true,
+ get: function description() {
+ var symbol = isObject(this) ? this.valueOf() : this;
+ var string = symbolToString.call(symbol);
+ if (has(EmptyStringDescriptionStore, symbol)) return '';
+ var desc = native ? string.slice(7, -1) : string.replace(regexp, '$1');
+ return desc === '' ? undefined : desc;
+ }
+ });
+
+ _export({ global: true, forced: true }, {
+ Symbol: SymbolWrapper
+ });
+ }
+
+ // `Symbol.iterator` well-known symbol
+ // https://tc39.github.io/ecma262/#sec-symbol.iterator
+ defineWellKnownSymbol('iterator');
+
+ var arrayMethodIsStrict = function (METHOD_NAME, argument) {
+ var method = [][METHOD_NAME];
+ return !!method && fails(function () {
+ // eslint-disable-next-line no-useless-call,no-throw-literal
+ method.call(null, argument || function () { throw 1; }, 1);
+ });
+ };
+
+ var defineProperty$3 = Object.defineProperty;
+ var cache = {};
+
+ var thrower = function (it) { throw it; };
+
+ var arrayMethodUsesToLength = function (METHOD_NAME, options) {
+ if (has(cache, METHOD_NAME)) return cache[METHOD_NAME];
+ if (!options) options = {};
+ var method = [][METHOD_NAME];
+ var ACCESSORS = has(options, 'ACCESSORS') ? options.ACCESSORS : false;
+ var argument0 = has(options, 0) ? options[0] : thrower;
+ var argument1 = has(options, 1) ? options[1] : undefined;
+
+ return cache[METHOD_NAME] = !!method && !fails(function () {
+ if (ACCESSORS && !descriptors) return true;
+ var O = { length: -1 };
+
+ if (ACCESSORS) defineProperty$3(O, 1, { enumerable: true, get: thrower });
+ else O[1] = 1;
+
+ method.call(O, argument0, argument1);
+ });
+ };
+
+ var $forEach$1 = arrayIteration.forEach;
+
+
+
+ var STRICT_METHOD = arrayMethodIsStrict('forEach');
+ var USES_TO_LENGTH = arrayMethodUsesToLength('forEach');
+
+ // `Array.prototype.forEach` method implementation
+ // https://tc39.github.io/ecma262/#sec-array.prototype.foreach
+ var arrayForEach = (!STRICT_METHOD || !USES_TO_LENGTH) ? function forEach(callbackfn /* , thisArg */) {
+ return $forEach$1(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
+ } : [].forEach;
+
+ // `Array.prototype.forEach` method
+ // https://tc39.github.io/ecma262/#sec-array.prototype.foreach
+ _export({ target: 'Array', proto: true, forced: [].forEach != arrayForEach }, {
+ forEach: arrayForEach
+ });
+
+ var $indexOf = arrayIncludes.indexOf;
+
+
+
+ var nativeIndexOf = [].indexOf;
+
+ var NEGATIVE_ZERO = !!nativeIndexOf && 1 / [1].indexOf(1, -0) < 0;
+ var STRICT_METHOD$1 = arrayMethodIsStrict('indexOf');
+ var USES_TO_LENGTH$1 = arrayMethodUsesToLength('indexOf', { ACCESSORS: true, 1: 0 });
+
+ // `Array.prototype.indexOf` method
+ // https://tc39.github.io/ecma262/#sec-array.prototype.indexof
+ _export({ target: 'Array', proto: true, forced: NEGATIVE_ZERO || !STRICT_METHOD$1 || !USES_TO_LENGTH$1 }, {
+ indexOf: function indexOf(searchElement /* , fromIndex = 0 */) {
+ return NEGATIVE_ZERO
+ // convert -0 to +0
+ ? nativeIndexOf.apply(this, arguments) || 0
+ : $indexOf(this, searchElement, arguments.length > 1 ? arguments[1] : undefined);
+ }
+ });
+
+ var UNSCOPABLES = wellKnownSymbol('unscopables');
+ var ArrayPrototype = Array.prototype;
+
+ // Array.prototype[@@unscopables]
+ // https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables
+ if (ArrayPrototype[UNSCOPABLES] == undefined) {
+ objectDefineProperty.f(ArrayPrototype, UNSCOPABLES, {
+ configurable: true,
+ value: objectCreate(null)
+ });
+ }
+
+ // add a key to Array.prototype[@@unscopables]
+ var addToUnscopables = function (key) {
+ ArrayPrototype[UNSCOPABLES][key] = true;
+ };
+
+ var iterators = {};
+
+ var correctPrototypeGetter = !fails(function () {
+ function F() { /* empty */ }
+ F.prototype.constructor = null;
+ return Object.getPrototypeOf(new F()) !== F.prototype;
+ });
+
+ var IE_PROTO$1 = sharedKey('IE_PROTO');
+ var ObjectPrototype$1 = Object.prototype;
+
+ // `Object.getPrototypeOf` method
+ // https://tc39.github.io/ecma262/#sec-object.getprototypeof
+ var objectGetPrototypeOf = correctPrototypeGetter ? Object.getPrototypeOf : function (O) {
+ O = toObject(O);
+ if (has(O, IE_PROTO$1)) return O[IE_PROTO$1];
+ if (typeof O.constructor == 'function' && O instanceof O.constructor) {
+ return O.constructor.prototype;
+ } return O instanceof Object ? ObjectPrototype$1 : null;
+ };
+
+ var ITERATOR = wellKnownSymbol('iterator');
+ var BUGGY_SAFARI_ITERATORS = false;
+
+ var returnThis = function () { return this; };
+
+ // `%IteratorPrototype%` object
+ // https://tc39.github.io/ecma262/#sec-%iteratorprototype%-object
+ var IteratorPrototype, PrototypeOfArrayIteratorPrototype, arrayIterator;
+
+ if ([].keys) {
+ arrayIterator = [].keys();
+ // Safari 8 has buggy iterators w/o `next`
+ if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS = true;
+ else {
+ PrototypeOfArrayIteratorPrototype = objectGetPrototypeOf(objectGetPrototypeOf(arrayIterator));
+ if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype = PrototypeOfArrayIteratorPrototype;
+ }
+ }
+
+ if (IteratorPrototype == undefined) IteratorPrototype = {};
+
+ // 25.1.2.1.1 %IteratorPrototype%[@@iterator]()
+ if ( !has(IteratorPrototype, ITERATOR)) {
+ createNonEnumerableProperty(IteratorPrototype, ITERATOR, returnThis);
+ }
+
+ var iteratorsCore = {
+ IteratorPrototype: IteratorPrototype,
+ BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS
+ };
+
+ var IteratorPrototype$1 = iteratorsCore.IteratorPrototype;
+
+
+
+
+
+ var returnThis$1 = function () { return this; };
+
+ var createIteratorConstructor = function (IteratorConstructor, NAME, next) {
+ var TO_STRING_TAG = NAME + ' Iterator';
+ IteratorConstructor.prototype = objectCreate(IteratorPrototype$1, { next: createPropertyDescriptor(1, next) });
+ setToStringTag(IteratorConstructor, TO_STRING_TAG, false);
+ iterators[TO_STRING_TAG] = returnThis$1;
+ return IteratorConstructor;
+ };
+
+ var aPossiblePrototype = function (it) {
+ if (!isObject(it) && it !== null) {
+ throw TypeError("Can't set " + String(it) + ' as a prototype');
+ } return it;
+ };
+
+ // `Object.setPrototypeOf` method
+ // https://tc39.github.io/ecma262/#sec-object.setprototypeof
+ // Works with __proto__ only. Old v8 can't work with null proto objects.
+ /* eslint-disable no-proto */
+ var objectSetPrototypeOf = Object.setPrototypeOf || ('__proto__' in {} ? function () {
+ var CORRECT_SETTER = false;
+ var test = {};
+ var setter;
+ try {
+ setter = Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set;
+ setter.call(test, []);
+ CORRECT_SETTER = test instanceof Array;
+ } catch (error) { /* empty */ }
+ return function setPrototypeOf(O, proto) {
+ anObject(O);
+ aPossiblePrototype(proto);
+ if (CORRECT_SETTER) setter.call(O, proto);
+ else O.__proto__ = proto;
+ return O;
+ };
+ }() : undefined);
+
+ var IteratorPrototype$2 = iteratorsCore.IteratorPrototype;
+ var BUGGY_SAFARI_ITERATORS$1 = iteratorsCore.BUGGY_SAFARI_ITERATORS;
+ var ITERATOR$1 = wellKnownSymbol('iterator');
+ var KEYS = 'keys';
+ var VALUES = 'values';
+ var ENTRIES = 'entries';
+
+ var returnThis$2 = function () { return this; };
+
+ var defineIterator = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) {
+ createIteratorConstructor(IteratorConstructor, NAME, next);
+
+ var getIterationMethod = function (KIND) {
+ if (KIND === DEFAULT && defaultIterator) return defaultIterator;
+ if (!BUGGY_SAFARI_ITERATORS$1 && KIND in IterablePrototype) return IterablePrototype[KIND];
+ switch (KIND) {
+ case KEYS: return function keys() { return new IteratorConstructor(this, KIND); };
+ case VALUES: return function values() { return new IteratorConstructor(this, KIND); };
+ case ENTRIES: return function entries() { return new IteratorConstructor(this, KIND); };
+ } return function () { return new IteratorConstructor(this); };
+ };
+
+ var TO_STRING_TAG = NAME + ' Iterator';
+ var INCORRECT_VALUES_NAME = false;
+ var IterablePrototype = Iterable.prototype;
+ var nativeIterator = IterablePrototype[ITERATOR$1]
+ || IterablePrototype['@@iterator']
+ || DEFAULT && IterablePrototype[DEFAULT];
+ var defaultIterator = !BUGGY_SAFARI_ITERATORS$1 && nativeIterator || getIterationMethod(DEFAULT);
+ var anyNativeIterator = NAME == 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator;
+ var CurrentIteratorPrototype, methods, KEY;
+
+ // fix native
+ if (anyNativeIterator) {
+ CurrentIteratorPrototype = objectGetPrototypeOf(anyNativeIterator.call(new Iterable()));
+ if (IteratorPrototype$2 !== Object.prototype && CurrentIteratorPrototype.next) {
+ if ( objectGetPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype$2) {
+ if (objectSetPrototypeOf) {
+ objectSetPrototypeOf(CurrentIteratorPrototype, IteratorPrototype$2);
+ } else if (typeof CurrentIteratorPrototype[ITERATOR$1] != 'function') {
+ createNonEnumerableProperty(CurrentIteratorPrototype, ITERATOR$1, returnThis$2);
+ }
+ }
+ // Set @@toStringTag to native iterators
+ setToStringTag(CurrentIteratorPrototype, TO_STRING_TAG, true);
+ }
+ }
+
+ // fix Array#{values, @@iterator}.name in V8 / FF
+ if (DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES) {
+ INCORRECT_VALUES_NAME = true;
+ defaultIterator = function values() { return nativeIterator.call(this); };
+ }
+
+ // define iterator
+ if ( IterablePrototype[ITERATOR$1] !== defaultIterator) {
+ createNonEnumerableProperty(IterablePrototype, ITERATOR$1, defaultIterator);
+ }
+ iterators[NAME] = defaultIterator;
+
+ // export additional methods
+ if (DEFAULT) {
+ methods = {
+ values: getIterationMethod(VALUES),
+ keys: IS_SET ? defaultIterator : getIterationMethod(KEYS),
+ entries: getIterationMethod(ENTRIES)
+ };
+ if (FORCED) for (KEY in methods) {
+ if (BUGGY_SAFARI_ITERATORS$1 || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) {
+ redefine(IterablePrototype, KEY, methods[KEY]);
+ }
+ } else _export({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS$1 || INCORRECT_VALUES_NAME }, methods);
+ }
+
+ return methods;
+ };
+
+ var ARRAY_ITERATOR = 'Array Iterator';
+ var setInternalState$1 = internalState.set;
+ var getInternalState$1 = internalState.getterFor(ARRAY_ITERATOR);
+
+ // `Array.prototype.entries` method
+ // https://tc39.github.io/ecma262/#sec-array.prototype.entries
+ // `Array.prototype.keys` method
+ // https://tc39.github.io/ecma262/#sec-array.prototype.keys
+ // `Array.prototype.values` method
+ // https://tc39.github.io/ecma262/#sec-array.prototype.values
+ // `Array.prototype[@@iterator]` method
+ // https://tc39.github.io/ecma262/#sec-array.prototype-@@iterator
+ // `CreateArrayIterator` internal method
+ // https://tc39.github.io/ecma262/#sec-createarrayiterator
+ var es_array_iterator = defineIterator(Array, 'Array', function (iterated, kind) {
+ setInternalState$1(this, {
+ type: ARRAY_ITERATOR,
+ target: toIndexedObject(iterated), // target
+ index: 0, // next index
+ kind: kind // kind
+ });
+ // `%ArrayIteratorPrototype%.next` method
+ // https://tc39.github.io/ecma262/#sec-%arrayiteratorprototype%.next
+ }, function () {
+ var state = getInternalState$1(this);
+ var target = state.target;
+ var kind = state.kind;
+ var index = state.index++;
+ if (!target || index >= target.length) {
+ state.target = undefined;
+ return { value: undefined, done: true };
+ }
+ if (kind == 'keys') return { value: index, done: false };
+ if (kind == 'values') return { value: target[index], done: false };
+ return { value: [index, target[index]], done: false };
+ }, 'values');
+
+ // argumentsList[@@iterator] is %ArrayProto_values%
+ // https://tc39.github.io/ecma262/#sec-createunmappedargumentsobject
+ // https://tc39.github.io/ecma262/#sec-createmappedargumentsobject
+ iterators.Arguments = iterators.Array;
+
+ // https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables
+ addToUnscopables('keys');
+ addToUnscopables('values');
+ addToUnscopables('entries');
+
+ var nativeJoin = [].join;
+
+ var ES3_STRINGS = indexedObject != Object;
+ var STRICT_METHOD$2 = arrayMethodIsStrict('join', ',');
+
+ // `Array.prototype.join` method
+ // https://tc39.github.io/ecma262/#sec-array.prototype.join
+ _export({ target: 'Array', proto: true, forced: ES3_STRINGS || !STRICT_METHOD$2 }, {
+ join: function join(separator) {
+ return nativeJoin.call(toIndexedObject(this), separator === undefined ? ',' : separator);
+ }
+ });
+
+ var createProperty = function (object, key, value) {
+ var propertyKey = toPrimitive(key);
+ if (propertyKey in object) objectDefineProperty.f(object, propertyKey, createPropertyDescriptor(0, value));
+ else object[propertyKey] = value;
+ };
+
+ var engineUserAgent = getBuiltIn('navigator', 'userAgent') || '';
+
+ var process = global_1.process;
+ var versions = process && process.versions;
+ var v8 = versions && versions.v8;
+ var match, version;
+
+ if (v8) {
+ match = v8.split('.');
+ version = match[0] + match[1];
+ } else if (engineUserAgent) {
+ match = engineUserAgent.match(/Edge\/(\d+)/);
+ if (!match || match[1] >= 74) {
+ match = engineUserAgent.match(/Chrome\/(\d+)/);
+ if (match) version = match[1];
+ }
+ }
+
+ var engineV8Version = version && +version;
+
+ var SPECIES$1 = wellKnownSymbol('species');
+
+ var arrayMethodHasSpeciesSupport = function (METHOD_NAME) {
+ // We can't use this feature detection in V8 since it causes
+ // deoptimization and serious performance degradation
+ // https://github.com/zloirock/core-js/issues/677
+ return engineV8Version >= 51 || !fails(function () {
+ var array = [];
+ var constructor = array.constructor = {};
+ constructor[SPECIES$1] = function () {
+ return { foo: 1 };
+ };
+ return array[METHOD_NAME](Boolean).foo !== 1;
+ });
+ };
+
+ var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('slice');
+ var USES_TO_LENGTH$2 = arrayMethodUsesToLength('slice', { ACCESSORS: true, 0: 0, 1: 2 });
+
+ var SPECIES$2 = wellKnownSymbol('species');
+ var nativeSlice = [].slice;
+ var max$1 = Math.max;
+
+ // `Array.prototype.slice` method
+ // https://tc39.github.io/ecma262/#sec-array.prototype.slice
+ // fallback for not array-like ES3 strings and DOM objects
+ _export({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT || !USES_TO_LENGTH$2 }, {
+ slice: function slice(start, end) {
+ var O = toIndexedObject(this);
+ var length = toLength(O.length);
+ var k = toAbsoluteIndex(start, length);
+ var fin = toAbsoluteIndex(end === undefined ? length : end, length);
+ // inline `ArraySpeciesCreate` for usage native `Array#slice` where it's possible
+ var Constructor, result, n;
+ if (isArray(O)) {
+ Constructor = O.constructor;
+ // cross-realm fallback
+ if (typeof Constructor == 'function' && (Constructor === Array || isArray(Constructor.prototype))) {
+ Constructor = undefined;
+ } else if (isObject(Constructor)) {
+ Constructor = Constructor[SPECIES$2];
+ if (Constructor === null) Constructor = undefined;
+ }
+ if (Constructor === Array || Constructor === undefined) {
+ return nativeSlice.call(O, k, fin);
+ }
+ }
+ result = new (Constructor === undefined ? Array : Constructor)(max$1(fin - k, 0));
+ for (n = 0; k < fin; k++, n++) if (k in O) createProperty(result, n, O[k]);
+ result.length = n;
+ return result;
+ }
+ });
+
+ var TO_STRING_TAG$1 = wellKnownSymbol('toStringTag');
+ var test = {};
+
+ test[TO_STRING_TAG$1] = 'z';
+
+ var toStringTagSupport = String(test) === '[object z]';
+
+ var TO_STRING_TAG$2 = wellKnownSymbol('toStringTag');
+ // ES3 wrong here
+ var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments';
+
+ // fallback for IE11 Script Access Denied error
+ var tryGet = function (it, key) {
+ try {
+ return it[key];
+ } catch (error) { /* empty */ }
+ };
+
+ // getting tag from ES6+ `Object.prototype.toString`
+ var classof = toStringTagSupport ? classofRaw : function (it) {
+ var O, tag, result;
+ return it === undefined ? 'Undefined' : it === null ? 'Null'
+ // @@toStringTag case
+ : typeof (tag = tryGet(O = Object(it), TO_STRING_TAG$2)) == 'string' ? tag
+ // builtinTag case
+ : CORRECT_ARGUMENTS ? classofRaw(O)
+ // ES3 arguments fallback
+ : (result = classofRaw(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : result;
+ };
+
+ // `Object.prototype.toString` method implementation
+ // https://tc39.github.io/ecma262/#sec-object.prototype.tostring
+ var objectToString = toStringTagSupport ? {}.toString : function toString() {
+ return '[object ' + classof(this) + ']';
+ };
+
+ // `Object.prototype.toString` method
+ // https://tc39.github.io/ecma262/#sec-object.prototype.tostring
+ if (!toStringTagSupport) {
+ redefine(Object.prototype, 'toString', objectToString, { unsafe: true });
+ }
+
+ // `RegExp.prototype.flags` getter implementation
+ // https://tc39.github.io/ecma262/#sec-get-regexp.prototype.flags
+ var regexpFlags = function () {
+ var that = anObject(this);
+ var result = '';
+ if (that.global) result += 'g';
+ if (that.ignoreCase) result += 'i';
+ if (that.multiline) result += 'm';
+ if (that.dotAll) result += 's';
+ if (that.unicode) result += 'u';
+ if (that.sticky) result += 'y';
+ return result;
+ };
+
+ // babel-minify transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError,
+ // so we use an intermediate function.
+ function RE(s, f) {
+ return RegExp(s, f);
+ }
+
+ var UNSUPPORTED_Y = fails(function () {
+ // babel-minify transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError
+ var re = RE('a', 'y');
+ re.lastIndex = 2;
+ return re.exec('abcd') != null;
+ });
+
+ var BROKEN_CARET = fails(function () {
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=773687
+ var re = RE('^r', 'gy');
+ re.lastIndex = 2;
+ return re.exec('str') != null;
+ });
+
+ var regexpStickyHelpers = {
+ UNSUPPORTED_Y: UNSUPPORTED_Y,
+ BROKEN_CARET: BROKEN_CARET
+ };
+
+ var nativeExec = RegExp.prototype.exec;
+ // This always refers to the native implementation, because the
+ // String#replace polyfill uses ./fix-regexp-well-known-symbol-logic.js,
+ // which loads this file before patching the method.
+ var nativeReplace = String.prototype.replace;
+
+ var patchedExec = nativeExec;
+
+ var UPDATES_LAST_INDEX_WRONG = (function () {
+ var re1 = /a/;
+ var re2 = /b*/g;
+ nativeExec.call(re1, 'a');
+ nativeExec.call(re2, 'a');
+ return re1.lastIndex !== 0 || re2.lastIndex !== 0;
+ })();
+
+ var UNSUPPORTED_Y$1 = regexpStickyHelpers.UNSUPPORTED_Y || regexpStickyHelpers.BROKEN_CARET;
+
+ // nonparticipating capturing group, copied from es5-shim's String#split patch.
+ var NPCG_INCLUDED = /()??/.exec('')[1] !== undefined;
+
+ var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED || UNSUPPORTED_Y$1;
+
+ if (PATCH) {
+ patchedExec = function exec(str) {
+ var re = this;
+ var lastIndex, reCopy, match, i;
+ var sticky = UNSUPPORTED_Y$1 && re.sticky;
+ var flags = regexpFlags.call(re);
+ var source = re.source;
+ var charsAdded = 0;
+ var strCopy = str;
+
+ if (sticky) {
+ flags = flags.replace('y', '');
+ if (flags.indexOf('g') === -1) {
+ flags += 'g';
+ }
+
+ strCopy = String(str).slice(re.lastIndex);
+ // Support anchored sticky behavior.
+ if (re.lastIndex > 0 && (!re.multiline || re.multiline && str[re.lastIndex - 1] !== '\n')) {
+ source = '(?: ' + source + ')';
+ strCopy = ' ' + strCopy;
+ charsAdded++;
+ }
+ // ^(? + rx + ) is needed, in combination with some str slicing, to
+ // simulate the 'y' flag.
+ reCopy = new RegExp('^(?:' + source + ')', flags);
+ }
+
+ if (NPCG_INCLUDED) {
+ reCopy = new RegExp('^' + source + '$(?!\\s)', flags);
+ }
+ if (UPDATES_LAST_INDEX_WRONG) lastIndex = re.lastIndex;
+
+ match = nativeExec.call(sticky ? reCopy : re, strCopy);
+
+ if (sticky) {
+ if (match) {
+ match.input = match.input.slice(charsAdded);
+ match[0] = match[0].slice(charsAdded);
+ match.index = re.lastIndex;
+ re.lastIndex += match[0].length;
+ } else re.lastIndex = 0;
+ } else if (UPDATES_LAST_INDEX_WRONG && match) {
+ re.lastIndex = re.global ? match.index + match[0].length : lastIndex;
+ }
+ if (NPCG_INCLUDED && match && match.length > 1) {
+ // Fix browsers whose `exec` methods don't consistently return `undefined`
+ // for NPCG, like IE8. NOTE: This doesn' work for /(.?)?/
+ nativeReplace.call(match[0], reCopy, function () {
+ for (i = 1; i < arguments.length - 2; i++) {
+ if (arguments[i] === undefined) match[i] = undefined;
+ }
+ });
+ }
+
+ return match;
+ };
+ }
+
+ var regexpExec = patchedExec;
+
+ _export({ target: 'RegExp', proto: true, forced: /./.exec !== regexpExec }, {
+ exec: regexpExec
+ });
+
+ var TO_STRING = 'toString';
+ var RegExpPrototype = RegExp.prototype;
+ var nativeToString = RegExpPrototype[TO_STRING];
+
+ var NOT_GENERIC = fails(function () { return nativeToString.call({ source: 'a', flags: 'b' }) != '/a/b'; });
+ // FF44- RegExp#toString has a wrong name
+ var INCORRECT_NAME = nativeToString.name != TO_STRING;
+
+ // `RegExp.prototype.toString` method
+ // https://tc39.github.io/ecma262/#sec-regexp.prototype.tostring
+ if (NOT_GENERIC || INCORRECT_NAME) {
+ redefine(RegExp.prototype, TO_STRING, function toString() {
+ var R = anObject(this);
+ var p = String(R.source);
+ var rf = R.flags;
+ var f = String(rf === undefined && R instanceof RegExp && !('flags' in RegExpPrototype) ? regexpFlags.call(R) : rf);
+ return '/' + p + '/' + f;
+ }, { unsafe: true });
+ }
+
+ // `String.prototype.{ codePointAt, at }` methods implementation
+ var createMethod$2 = function (CONVERT_TO_STRING) {
+ return function ($this, pos) {
+ var S = String(requireObjectCoercible($this));
+ var position = toInteger(pos);
+ var size = S.length;
+ var first, second;
+ if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;
+ first = S.charCodeAt(position);
+ return first < 0xD800 || first > 0xDBFF || position + 1 === size
+ || (second = S.charCodeAt(position + 1)) < 0xDC00 || second > 0xDFFF
+ ? CONVERT_TO_STRING ? S.charAt(position) : first
+ : CONVERT_TO_STRING ? S.slice(position, position + 2) : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;
+ };
+ };
+
+ var stringMultibyte = {
+ // `String.prototype.codePointAt` method
+ // https://tc39.github.io/ecma262/#sec-string.prototype.codepointat
+ codeAt: createMethod$2(false),
+ // `String.prototype.at` method
+ // https://github.com/mathiasbynens/String.prototype.at
+ charAt: createMethod$2(true)
+ };
+
+ var charAt = stringMultibyte.charAt;
+
+
+
+ var STRING_ITERATOR = 'String Iterator';
+ var setInternalState$2 = internalState.set;
+ var getInternalState$2 = internalState.getterFor(STRING_ITERATOR);
+
+ // `String.prototype[@@iterator]` method
+ // https://tc39.github.io/ecma262/#sec-string.prototype-@@iterator
+ defineIterator(String, 'String', function (iterated) {
+ setInternalState$2(this, {
+ type: STRING_ITERATOR,
+ string: String(iterated),
+ index: 0
+ });
+ // `%StringIteratorPrototype%.next` method
+ // https://tc39.github.io/ecma262/#sec-%stringiteratorprototype%.next
+ }, function next() {
+ var state = getInternalState$2(this);
+ var string = state.string;
+ var index = state.index;
+ var point;
+ if (index >= string.length) return { value: undefined, done: true };
+ point = charAt(string, index);
+ state.index += point.length;
+ return { value: point, done: false };
+ });
+
+ // TODO: Remove from `core-js@4` since it's moved to entry points
+
+
+
+
+
+
+
+ var SPECIES$3 = wellKnownSymbol('species');
+
+ var REPLACE_SUPPORTS_NAMED_GROUPS = !fails(function () {
+ // #replace needs built-in support for named groups.
+ // #match works fine because it just return the exec results, even if it has
+ // a "grops" property.
+ var re = /./;
+ re.exec = function () {
+ var result = [];
+ result.groups = { a: '7' };
+ return result;
+ };
+ return ''.replace(re, '$<a>') !== '7';
+ });
+
+ // IE <= 11 replaces $0 with the whole match, as if it was $&
+ // https://stackoverflow.com/questions/6024666/getting-ie-to-replace-a-regex-with-the-literal-string-0
+ var REPLACE_KEEPS_$0 = (function () {
+ return 'a'.replace(/./, '$0') === '$0';
+ })();
+
+ var REPLACE = wellKnownSymbol('replace');
+ // Safari <= 13.0.3(?) substitutes nth capture where n>m with an empty string
+ var REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE = (function () {
+ if (/./[REPLACE]) {
+ return /./[REPLACE]('a', '$0') === '';
+ }
+ return false;
+ })();
+
+ // Chrome 51 has a buggy "split" implementation when RegExp#exec !== nativeExec
+ // Weex JS has frozen built-in prototypes, so use try / catch wrapper
+ var SPLIT_WORKS_WITH_OVERWRITTEN_EXEC = !fails(function () {
+ var re = /(?:)/;
+ var originalExec = re.exec;
+ re.exec = function () { return originalExec.apply(this, arguments); };
+ var result = 'ab'.split(re);
+ return result.length !== 2 || result[0] !== 'a' || result[1] !== 'b';
+ });
+
+ var fixRegexpWellKnownSymbolLogic = function (KEY, length, exec, sham) {
+ var SYMBOL = wellKnownSymbol(KEY);
+
+ var DELEGATES_TO_SYMBOL = !fails(function () {
+ // String methods call symbol-named RegEp methods
+ var O = {};
+ O[SYMBOL] = function () { return 7; };
+ return ''[KEY](O) != 7;
+ });
+
+ var DELEGATES_TO_EXEC = DELEGATES_TO_SYMBOL && !fails(function () {
+ // Symbol-named RegExp methods call .exec
+ var execCalled = false;
+ var re = /a/;
+
+ if (KEY === 'split') {
+ // We can't use real regex here since it causes deoptimization
+ // and serious performance degradation in V8
+ // https://github.com/zloirock/core-js/issues/306
+ re = {};
+ // RegExp[@@split] doesn't call the regex's exec method, but first creates
+ // a new one. We need to return the patched regex when creating the new one.
+ re.constructor = {};
+ re.constructor[SPECIES$3] = function () { return re; };
+ re.flags = '';
+ re[SYMBOL] = /./[SYMBOL];
+ }
+
+ re.exec = function () { execCalled = true; return null; };
+
+ re[SYMBOL]('');
+ return !execCalled;
+ });
+
+ if (
+ !DELEGATES_TO_SYMBOL ||
+ !DELEGATES_TO_EXEC ||
+ (KEY === 'replace' && !(
+ REPLACE_SUPPORTS_NAMED_GROUPS &&
+ REPLACE_KEEPS_$0 &&
+ !REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE
+ )) ||
+ (KEY === 'split' && !SPLIT_WORKS_WITH_OVERWRITTEN_EXEC)
+ ) {
+ var nativeRegExpMethod = /./[SYMBOL];
+ var methods = exec(SYMBOL, ''[KEY], function (nativeMethod, regexp, str, arg2, forceStringMethod) {
+ if (regexp.exec === regexpExec) {
+ if (DELEGATES_TO_SYMBOL && !forceStringMethod) {
+ // The native String method already delegates to @@method (this
+ // polyfilled function), leasing to infinite recursion.
+ // We avoid it by directly calling the native @@method method.
+ return { done: true, value: nativeRegExpMethod.call(regexp, str, arg2) };
+ }
+ return { done: true, value: nativeMethod.call(str, regexp, arg2) };
+ }
+ return { done: false };
+ }, {
+ REPLACE_KEEPS_$0: REPLACE_KEEPS_$0,
+ REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE: REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE
+ });
+ var stringMethod = methods[0];
+ var regexMethod = methods[1];
+
+ redefine(String.prototype, KEY, stringMethod);
+ redefine(RegExp.prototype, SYMBOL, length == 2
+ // 21.2.5.8 RegExp.prototype[@@replace](string, replaceValue)
+ // 21.2.5.11 RegExp.prototype[@@split](string, limit)
+ ? function (string, arg) { return regexMethod.call(string, this, arg); }
+ // 21.2.5.6 RegExp.prototype[@@match](string)
+ // 21.2.5.9 RegExp.prototype[@@search](string)
+ : function (string) { return regexMethod.call(string, this); }
+ );
+ }
+
+ if (sham) createNonEnumerableProperty(RegExp.prototype[SYMBOL], 'sham', true);
+ };
+
+ var charAt$1 = stringMultibyte.charAt;
+
+ // `AdvanceStringIndex` abstract operation
+ // https://tc39.github.io/ecma262/#sec-advancestringindex
+ var advanceStringIndex = function (S, index, unicode) {
+ return index + (unicode ? charAt$1(S, index).length : 1);
+ };
+
+ // `RegExpExec` abstract operation
+ // https://tc39.github.io/ecma262/#sec-regexpexec
+ var regexpExecAbstract = function (R, S) {
+ var exec = R.exec;
+ if (typeof exec === 'function') {
+ var result = exec.call(R, S);
+ if (typeof result !== 'object') {
+ throw TypeError('RegExp exec method returned something other than an Object or null');
+ }
+ return result;
+ }
+
+ if (classofRaw(R) !== 'RegExp') {
+ throw TypeError('RegExp#exec called on incompatible receiver');
+ }
+
+ return regexpExec.call(R, S);
+ };
+
+ var max$2 = Math.max;
+ var min$2 = Math.min;
+ var floor$1 = Math.floor;
+ var SUBSTITUTION_SYMBOLS = /\$([$&'`]|\d\d?|<[^>]*>)/g;
+ var SUBSTITUTION_SYMBOLS_NO_NAMED = /\$([$&'`]|\d\d?)/g;
+
+ var maybeToString = function (it) {
+ return it === undefined ? it : String(it);
+ };
+
+ // @@replace logic
+ fixRegexpWellKnownSymbolLogic('replace', 2, function (REPLACE, nativeReplace, maybeCallNative, reason) {
+ var REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE = reason.REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE;
+ var REPLACE_KEEPS_$0 = reason.REPLACE_KEEPS_$0;
+ var UNSAFE_SUBSTITUTE = REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE ? '$' : '$0';
+
+ return [
+ // `String.prototype.replace` method
+ // https://tc39.github.io/ecma262/#sec-string.prototype.replace
+ function replace(searchValue, replaceValue) {
+ var O = requireObjectCoercible(this);
+ var replacer = searchValue == undefined ? undefined : searchValue[REPLACE];
+ return replacer !== undefined
+ ? replacer.call(searchValue, O, replaceValue)
+ : nativeReplace.call(String(O), searchValue, replaceValue);
+ },
+ // `RegExp.prototype[@@replace]` method
+ // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@replace
+ function (regexp, replaceValue) {
+ if (
+ (!REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE && REPLACE_KEEPS_$0) ||
+ (typeof replaceValue === 'string' && replaceValue.indexOf(UNSAFE_SUBSTITUTE) === -1)
+ ) {
+ var res = maybeCallNative(nativeReplace, regexp, this, replaceValue);
+ if (res.done) return res.value;
+ }
+
+ var rx = anObject(regexp);
+ var S = String(this);
+
+ var functionalReplace = typeof replaceValue === 'function';
+ if (!functionalReplace) replaceValue = String(replaceValue);
+
+ var global = rx.global;
+ if (global) {
+ var fullUnicode = rx.unicode;
+ rx.lastIndex = 0;
+ }
+ var results = [];
+ while (true) {
+ var result = regexpExecAbstract(rx, S);
+ if (result === null) break;
+
+ results.push(result);
+ if (!global) break;
+
+ var matchStr = String(result[0]);
+ if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
+ }
+
+ var accumulatedResult = '';
+ var nextSourcePosition = 0;
+ for (var i = 0; i < results.length; i++) {
+ result = results[i];
+
+ var matched = String(result[0]);
+ var position = max$2(min$2(toInteger(result.index), S.length), 0);
+ var captures = [];
+ // NOTE: This is equivalent to
+ // captures = result.slice(1).map(maybeToString)
+ // but for some reason `nativeSlice.call(result, 1, result.length)` (called in
+ // the slice polyfill when slicing native arrays) "doesn't work" in safari 9 and
+ // causes a crash (https://pastebin.com/N21QzeQA) when trying to debug it.
+ for (var j = 1; j < result.length; j++) captures.push(maybeToString(result[j]));
+ var namedCaptures = result.groups;
+ if (functionalReplace) {
+ var replacerArgs = [matched].concat(captures, position, S);
+ if (namedCaptures !== undefined) replacerArgs.push(namedCaptures);
+ var replacement = String(replaceValue.apply(undefined, replacerArgs));
+ } else {
+ replacement = getSubstitution(matched, S, position, captures, namedCaptures, replaceValue);
+ }
+ if (position >= nextSourcePosition) {
+ accumulatedResult += S.slice(nextSourcePosition, position) + replacement;
+ nextSourcePosition = position + matched.length;
+ }
+ }
+ return accumulatedResult + S.slice(nextSourcePosition);
+ }
+ ];
+
+ // https://tc39.github.io/ecma262/#sec-getsubstitution
+ function getSubstitution(matched, str, position, captures, namedCaptures, replacement) {
+ var tailPos = position + matched.length;
+ var m = captures.length;
+ var symbols = SUBSTITUTION_SYMBOLS_NO_NAMED;
+ if (namedCaptures !== undefined) {
+ namedCaptures = toObject(namedCaptures);
+ symbols = SUBSTITUTION_SYMBOLS;
+ }
+ return nativeReplace.call(replacement, symbols, function (match, ch) {
+ var capture;
+ switch (ch.charAt(0)) {
+ case '$': return '$';
+ case '&': return matched;
+ case '`': return str.slice(0, position);
+ case "'": return str.slice(tailPos);
+ case '<':
+ capture = namedCaptures[ch.slice(1, -1)];
+ break;
+ default: // \d\d?
+ var n = +ch;
+ if (n === 0) return match;
+ if (n > m) {
+ var f = floor$1(n / 10);
+ if (f === 0) return match;
+ if (f <= m) return captures[f - 1] === undefined ? ch.charAt(1) : captures[f - 1] + ch.charAt(1);
+ return match;
+ }
+ capture = captures[n - 1];
+ }
+ return capture === undefined ? '' : capture;
+ });
+ }
+ });
+
+ // `SameValue` abstract operation
+ // https://tc39.github.io/ecma262/#sec-samevalue
+ var sameValue = Object.is || function is(x, y) {
+ // eslint-disable-next-line no-self-compare
+ return x === y ? x !== 0 || 1 / x === 1 / y : x != x && y != y;
+ };
+
+ // @@search logic
+ fixRegexpWellKnownSymbolLogic('search', 1, function (SEARCH, nativeSearch, maybeCallNative) {
+ return [
+ // `String.prototype.search` method
+ // https://tc39.github.io/ecma262/#sec-string.prototype.search
+ function search(regexp) {
+ var O = requireObjectCoercible(this);
+ var searcher = regexp == undefined ? undefined : regexp[SEARCH];
+ return searcher !== undefined ? searcher.call(regexp, O) : new RegExp(regexp)[SEARCH](String(O));
+ },
+ // `RegExp.prototype[@@search]` method
+ // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@search
+ function (regexp) {
+ var res = maybeCallNative(nativeSearch, regexp, this);
+ if (res.done) return res.value;
+
+ var rx = anObject(regexp);
+ var S = String(this);
+
+ var previousLastIndex = rx.lastIndex;
+ if (!sameValue(previousLastIndex, 0)) rx.lastIndex = 0;
+ var result = regexpExecAbstract(rx, S);
+ if (!sameValue(rx.lastIndex, previousLastIndex)) rx.lastIndex = previousLastIndex;
+ return result === null ? -1 : result.index;
+ }
+ ];
+ });
+
+ var MATCH = wellKnownSymbol('match');
+
+ // `IsRegExp` abstract operation
+ // https://tc39.github.io/ecma262/#sec-isregexp
+ var isRegexp = function (it) {
+ var isRegExp;
+ return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : classofRaw(it) == 'RegExp');
+ };
+
+ var SPECIES$4 = wellKnownSymbol('species');
+
+ // `SpeciesConstructor` abstract operation
+ // https://tc39.github.io/ecma262/#sec-speciesconstructor
+ var speciesConstructor = function (O, defaultConstructor) {
+ var C = anObject(O).constructor;
+ var S;
+ return C === undefined || (S = anObject(C)[SPECIES$4]) == undefined ? defaultConstructor : aFunction$1(S);
+ };
+
+ var arrayPush = [].push;
+ var min$3 = Math.min;
+ var MAX_UINT32 = 0xFFFFFFFF;
+
+ // babel-minify transpiles RegExp('x', 'y') -> /x/y and it causes SyntaxError
+ var SUPPORTS_Y = !fails(function () { return !RegExp(MAX_UINT32, 'y'); });
+
+ // @@split logic
+ fixRegexpWellKnownSymbolLogic('split', 2, function (SPLIT, nativeSplit, maybeCallNative) {
+ var internalSplit;
+ if (
+ 'abbc'.split(/(b)*/)[1] == 'c' ||
+ 'test'.split(/(?:)/, -1).length != 4 ||
+ 'ab'.split(/(?:ab)*/).length != 2 ||
+ '.'.split(/(.?)(.?)/).length != 4 ||
+ '.'.split(/()()/).length > 1 ||
+ ''.split(/.?/).length
+ ) {
+ // based on es5-shim implementation, need to rework it
+ internalSplit = function (separator, limit) {
+ var string = String(requireObjectCoercible(this));
+ var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;
+ if (lim === 0) return [];
+ if (separator === undefined) return [string];
+ // If `separator` is not a regex, use native split
+ if (!isRegexp(separator)) {
+ return nativeSplit.call(string, separator, lim);
+ }
+ var output = [];
+ var flags = (separator.ignoreCase ? 'i' : '') +
+ (separator.multiline ? 'm' : '') +
+ (separator.unicode ? 'u' : '') +
+ (separator.sticky ? 'y' : '');
+ var lastLastIndex = 0;
+ // Make `global` and avoid `lastIndex` issues by working with a copy
+ var separatorCopy = new RegExp(separator.source, flags + 'g');
+ var match, lastIndex, lastLength;
+ while (match = regexpExec.call(separatorCopy, string)) {
+ lastIndex = separatorCopy.lastIndex;
+ if (lastIndex > lastLastIndex) {
+ output.push(string.slice(lastLastIndex, match.index));
+ if (match.length > 1 && match.index < string.length) arrayPush.apply(output, match.slice(1));
+ lastLength = match[0].length;
+ lastLastIndex = lastIndex;
+ if (output.length >= lim) break;
+ }
+ if (separatorCopy.lastIndex === match.index) separatorCopy.lastIndex++; // Avoid an infinite loop
+ }
+ if (lastLastIndex === string.length) {
+ if (lastLength || !separatorCopy.test('')) output.push('');
+ } else output.push(string.slice(lastLastIndex));
+ return output.length > lim ? output.slice(0, lim) : output;
+ };
+ // Chakra, V8
+ } else if ('0'.split(undefined, 0).length) {
+ internalSplit = function (separator, limit) {
+ return separator === undefined && limit === 0 ? [] : nativeSplit.call(this, separator, limit);
+ };
+ } else internalSplit = nativeSplit;
+
+ return [
+ // `String.prototype.split` method
+ // https://tc39.github.io/ecma262/#sec-string.prototype.split
+ function split(separator, limit) {
+ var O = requireObjectCoercible(this);
+ var splitter = separator == undefined ? undefined : separator[SPLIT];
+ return splitter !== undefined
+ ? splitter.call(separator, O, limit)
+ : internalSplit.call(String(O), separator, limit);
+ },
+ // `RegExp.prototype[@@split]` method
+ // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@split
+ //
+ // NOTE: This cannot be properly polyfilled in engines that don't support
+ // the 'y' flag.
+ function (regexp, limit) {
+ var res = maybeCallNative(internalSplit, regexp, this, limit, internalSplit !== nativeSplit);
+ if (res.done) return res.value;
+
+ var rx = anObject(regexp);
+ var S = String(this);
+ var C = speciesConstructor(rx, RegExp);
+
+ var unicodeMatching = rx.unicode;
+ var flags = (rx.ignoreCase ? 'i' : '') +
+ (rx.multiline ? 'm' : '') +
+ (rx.unicode ? 'u' : '') +
+ (SUPPORTS_Y ? 'y' : 'g');
+
+ // ^(? + rx + ) is needed, in combination with some S slicing, to
+ // simulate the 'y' flag.
+ var splitter = new C(SUPPORTS_Y ? rx : '^(?:' + rx.source + ')', flags);
+ var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;
+ if (lim === 0) return [];
+ if (S.length === 0) return regexpExecAbstract(splitter, S) === null ? [S] : [];
+ var p = 0;
+ var q = 0;
+ var A = [];
+ while (q < S.length) {
+ splitter.lastIndex = SUPPORTS_Y ? q : 0;
+ var z = regexpExecAbstract(splitter, SUPPORTS_Y ? S : S.slice(q));
+ var e;
+ if (
+ z === null ||
+ (e = min$3(toLength(splitter.lastIndex + (SUPPORTS_Y ? 0 : q)), S.length)) === p
+ ) {
+ q = advanceStringIndex(S, q, unicodeMatching);
+ } else {
+ A.push(S.slice(p, q));
+ if (A.length === lim) return A;
+ for (var i = 1; i <= z.length - 1; i++) {
+ A.push(z[i]);
+ if (A.length === lim) return A;
+ }
+ q = p = e;
+ }
+ }
+ A.push(S.slice(p));
+ return A;
+ }
+ ];
+ }, !SUPPORTS_Y);
+
+ // iterable DOM collections
+ // flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods
+ var domIterables = {
+ CSSRuleList: 0,
+ CSSStyleDeclaration: 0,
+ CSSValueList: 0,
+ ClientRectList: 0,
+ DOMRectList: 0,
+ DOMStringList: 0,
+ DOMTokenList: 1,
+ DataTransferItemList: 0,
+ FileList: 0,
+ HTMLAllCollection: 0,
+ HTMLCollection: 0,
+ HTMLFormElement: 0,
+ HTMLSelectElement: 0,
+ MediaList: 0,
+ MimeTypeArray: 0,
+ NamedNodeMap: 0,
+ NodeList: 1,
+ PaintRequestList: 0,
+ Plugin: 0,
+ PluginArray: 0,
+ SVGLengthList: 0,
+ SVGNumberList: 0,
+ SVGPathSegList: 0,
+ SVGPointList: 0,
+ SVGStringList: 0,
+ SVGTransformList: 0,
+ SourceBufferList: 0,
+ StyleSheetList: 0,
+ TextTrackCueList: 0,
+ TextTrackList: 0,
+ TouchList: 0
+ };
+
+ for (var COLLECTION_NAME in domIterables) {
+ var Collection = global_1[COLLECTION_NAME];
+ var CollectionPrototype = Collection && Collection.prototype;
+ // some Chrome versions have non-configurable methods on DOMTokenList
+ if (CollectionPrototype && CollectionPrototype.forEach !== arrayForEach) try {
+ createNonEnumerableProperty(CollectionPrototype, 'forEach', arrayForEach);
+ } catch (error) {
+ CollectionPrototype.forEach = arrayForEach;
+ }
+ }
+
+ var ITERATOR$2 = wellKnownSymbol('iterator');
+ var TO_STRING_TAG$3 = wellKnownSymbol('toStringTag');
+ var ArrayValues = es_array_iterator.values;
+
+ for (var COLLECTION_NAME$1 in domIterables) {
+ var Collection$1 = global_1[COLLECTION_NAME$1];
+ var CollectionPrototype$1 = Collection$1 && Collection$1.prototype;
+ if (CollectionPrototype$1) {
+ // some Chrome versions have non-configurable methods on DOMTokenList
+ if (CollectionPrototype$1[ITERATOR$2] !== ArrayValues) try {
+ createNonEnumerableProperty(CollectionPrototype$1, ITERATOR$2, ArrayValues);
+ } catch (error) {
+ CollectionPrototype$1[ITERATOR$2] = ArrayValues;
+ }
+ if (!CollectionPrototype$1[TO_STRING_TAG$3]) {
+ createNonEnumerableProperty(CollectionPrototype$1, TO_STRING_TAG$3, COLLECTION_NAME$1);
+ }
+ if (domIterables[COLLECTION_NAME$1]) for (var METHOD_NAME in es_array_iterator) {
+ // some Chrome versions have non-configurable methods on DOMTokenList
+ if (CollectionPrototype$1[METHOD_NAME] !== es_array_iterator[METHOD_NAME]) try {
+ createNonEnumerableProperty(CollectionPrototype$1, METHOD_NAME, es_array_iterator[METHOD_NAME]);
+ } catch (error) {
+ CollectionPrototype$1[METHOD_NAME] = es_array_iterator[METHOD_NAME];
+ }
+ }
+ }
+ }
+
+ var ITERATOR$3 = wellKnownSymbol('iterator');
+
+ var nativeUrl = !fails(function () {
+ var url = new URL('b?a=1&b=2&c=3', 'http://a');
+ var searchParams = url.searchParams;
+ var result = '';
+ url.pathname = 'c%20d';
+ searchParams.forEach(function (value, key) {
+ searchParams['delete']('b');
+ result += key + value;
+ });
+ return (isPure && !url.toJSON)
+ || !searchParams.sort
+ || url.href !== 'http://a/c%20d?a=1&c=3'
+ || searchParams.get('c') !== '3'
+ || String(new URLSearchParams('?a=1')) !== 'a=1'
+ || !searchParams[ITERATOR$3]
+ // throws in Edge
+ || new URL('https://a@b').username !== 'a'
+ || new URLSearchParams(new URLSearchParams('a=b')).get('a') !== 'b'
+ // not punycoded in Edge
+ || new URL('http://тест').host !== 'xn--e1aybc'
+ // not escaped in Chrome 62-
+ || new URL('http://a#б').hash !== '#%D0%B1'
+ // fails in Chrome 66-
+ || result !== 'a1c3'
+ // throws in Safari
+ || new URL('http://x', undefined).host !== 'x';
+ });
+
+ var anInstance = function (it, Constructor, name) {
+ if (!(it instanceof Constructor)) {
+ throw TypeError('Incorrect ' + (name ? name + ' ' : '') + 'invocation');
+ } return it;
+ };
+
+ var nativeAssign = Object.assign;
+ var defineProperty$4 = Object.defineProperty;
+
+ // `Object.assign` method
+ // https://tc39.github.io/ecma262/#sec-object.assign
+ var objectAssign = !nativeAssign || fails(function () {
+ // should have correct order of operations (Edge bug)
+ if (descriptors && nativeAssign({ b: 1 }, nativeAssign(defineProperty$4({}, 'a', {
+ enumerable: true,
+ get: function () {
+ defineProperty$4(this, 'b', {
+ value: 3,
+ enumerable: false
+ });
+ }
+ }), { b: 2 })).b !== 1) return true;
+ // should work with symbols and should have deterministic property order (V8 bug)
+ var A = {};
+ var B = {};
+ // eslint-disable-next-line no-undef
+ var symbol = Symbol();
+ var alphabet = 'abcdefghijklmnopqrst';
+ A[symbol] = 7;
+ alphabet.split('').forEach(function (chr) { B[chr] = chr; });
+ return nativeAssign({}, A)[symbol] != 7 || objectKeys(nativeAssign({}, B)).join('') != alphabet;
+ }) ? function assign(target, source) { // eslint-disable-line no-unused-vars
+ var T = toObject(target);
+ var argumentsLength = arguments.length;
+ var index = 1;
+ var getOwnPropertySymbols = objectGetOwnPropertySymbols.f;
+ var propertyIsEnumerable = objectPropertyIsEnumerable.f;
+ while (argumentsLength > index) {
+ var S = indexedObject(arguments[index++]);
+ var keys = getOwnPropertySymbols ? objectKeys(S).concat(getOwnPropertySymbols(S)) : objectKeys(S);
+ var length = keys.length;
+ var j = 0;
+ var key;
+ while (length > j) {
+ key = keys[j++];
+ if (!descriptors || propertyIsEnumerable.call(S, key)) T[key] = S[key];
+ }
+ } return T;
+ } : nativeAssign;
+
+ // call something on iterator step with safe closing on error
+ var callWithSafeIterationClosing = function (iterator, fn, value, ENTRIES) {
+ try {
+ return ENTRIES ? fn(anObject(value)[0], value[1]) : fn(value);
+ // 7.4.6 IteratorClose(iterator, completion)
+ } catch (error) {
+ var returnMethod = iterator['return'];
+ if (returnMethod !== undefined) anObject(returnMethod.call(iterator));
+ throw error;
+ }
+ };
+
+ var ITERATOR$4 = wellKnownSymbol('iterator');
+ var ArrayPrototype$1 = Array.prototype;
+
+ // check on default Array iterator
+ var isArrayIteratorMethod = function (it) {
+ return it !== undefined && (iterators.Array === it || ArrayPrototype$1[ITERATOR$4] === it);
+ };
+
+ var ITERATOR$5 = wellKnownSymbol('iterator');
+
+ var getIteratorMethod = function (it) {
+ if (it != undefined) return it[ITERATOR$5]
+ || it['@@iterator']
+ || iterators[classof(it)];
+ };
+
+ // `Array.from` method implementation
+ // https://tc39.github.io/ecma262/#sec-array.from
+ var arrayFrom = function from(arrayLike /* , mapfn = undefined, thisArg = undefined */) {
+ var O = toObject(arrayLike);
+ var C = typeof this == 'function' ? this : Array;
+ var argumentsLength = arguments.length;
+ var mapfn = argumentsLength > 1 ? arguments[1] : undefined;
+ var mapping = mapfn !== undefined;
+ var iteratorMethod = getIteratorMethod(O);
+ var index = 0;
+ var length, result, step, iterator, next, value;
+ if (mapping) mapfn = functionBindContext(mapfn, argumentsLength > 2 ? arguments[2] : undefined, 2);
+ // if the target is not iterable or it's an array with the default iterator - use a simple case
+ if (iteratorMethod != undefined && !(C == Array && isArrayIteratorMethod(iteratorMethod))) {
+ iterator = iteratorMethod.call(O);
+ next = iterator.next;
+ result = new C();
+ for (;!(step = next.call(iterator)).done; index++) {
+ value = mapping ? callWithSafeIterationClosing(iterator, mapfn, [step.value, index], true) : step.value;
+ createProperty(result, index, value);
+ }
+ } else {
+ length = toLength(O.length);
+ result = new C(length);
+ for (;length > index; index++) {
+ value = mapping ? mapfn(O[index], index) : O[index];
+ createProperty(result, index, value);
+ }
+ }
+ result.length = index;
+ return result;
+ };
+
+ // based on https://github.com/bestiejs/punycode.js/blob/master/punycode.js
+ var maxInt = 2147483647; // aka. 0x7FFFFFFF or 2^31-1
+ var base = 36;
+ var tMin = 1;
+ var tMax = 26;
+ var skew = 38;
+ var damp = 700;
+ var initialBias = 72;
+ var initialN = 128; // 0x80
+ var delimiter = '-'; // '\x2D'
+ var regexNonASCII = /[^\0-\u007E]/; // non-ASCII chars
+ var regexSeparators = /[.\u3002\uFF0E\uFF61]/g; // RFC 3490 separators
+ var OVERFLOW_ERROR = 'Overflow: input needs wider integers to process';
+ var baseMinusTMin = base - tMin;
+ var floor$2 = Math.floor;
+ var stringFromCharCode = String.fromCharCode;
+
+ /**
+ * Creates an array containing the numeric code points of each Unicode
+ * character in the string. While JavaScript uses UCS-2 internally,
+ * this function will convert a pair of surrogate halves (each of which
+ * UCS-2 exposes as separate characters) into a single code point,
+ * matching UTF-16.
+ */
+ var ucs2decode = function (string) {
+ var output = [];
+ var counter = 0;
+ var length = string.length;
+ while (counter < length) {
+ var value = string.charCodeAt(counter++);
+ if (value >= 0xD800 && value <= 0xDBFF && counter < length) {
+ // It's a high surrogate, and there is a next character.
+ var extra = string.charCodeAt(counter++);
+ if ((extra & 0xFC00) == 0xDC00) { // Low surrogate.
+ output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
+ } else {
+ // It's an unmatched surrogate; only append this code unit, in case the
+ // next code unit is the high surrogate of a surrogate pair.
+ output.push(value);
+ counter--;
+ }
+ } else {
+ output.push(value);
+ }
+ }
+ return output;
+ };
+
+ /**
+ * Converts a digit/integer into a basic code point.
+ */
+ var digitToBasic = function (digit) {
+ // 0..25 map to ASCII a..z or A..Z
+ // 26..35 map to ASCII 0..9
+ return digit + 22 + 75 * (digit < 26);
+ };
+
+ /**
+ * Bias adaptation function as per section 3.4 of RFC 3492.
+ * https://tools.ietf.org/html/rfc3492#section-3.4
+ */
+ var adapt = function (delta, numPoints, firstTime) {
+ var k = 0;
+ delta = firstTime ? floor$2(delta / damp) : delta >> 1;
+ delta += floor$2(delta / numPoints);
+ for (; delta > baseMinusTMin * tMax >> 1; k += base) {
+ delta = floor$2(delta / baseMinusTMin);
+ }
+ return floor$2(k + (baseMinusTMin + 1) * delta / (delta + skew));
+ };
+
+ /**
+ * Converts a string of Unicode symbols (e.g. a domain name label) to a
+ * Punycode string of ASCII-only symbols.
+ */
+ // eslint-disable-next-line max-statements
+ var encode = function (input) {
+ var output = [];
+
+ // Convert the input in UCS-2 to an array of Unicode code points.
+ input = ucs2decode(input);
+
+ // Cache the length.
+ var inputLength = input.length;
+
+ // Initialize the state.
+ var n = initialN;
+ var delta = 0;
+ var bias = initialBias;
+ var i, currentValue;
+
+ // Handle the basic code points.
+ for (i = 0; i < input.length; i++) {
+ currentValue = input[i];
+ if (currentValue < 0x80) {
+ output.push(stringFromCharCode(currentValue));
+ }
+ }
+
+ var basicLength = output.length; // number of basic code points.
+ var handledCPCount = basicLength; // number of code points that have been handled;
+
+ // Finish the basic string with a delimiter unless it's empty.
+ if (basicLength) {
+ output.push(delimiter);
+ }
+
+ // Main encoding loop:
+ while (handledCPCount < inputLength) {
+ // All non-basic code points < n have been handled already. Find the next larger one:
+ var m = maxInt;
+ for (i = 0; i < input.length; i++) {
+ currentValue = input[i];
+ if (currentValue >= n && currentValue < m) {
+ m = currentValue;
+ }
+ }
+
+ // Increase `delta` enough to advance the decoder's <n,i> state to <m,0>, but guard against overflow.
+ var handledCPCountPlusOne = handledCPCount + 1;
+ if (m - n > floor$2((maxInt - delta) / handledCPCountPlusOne)) {
+ throw RangeError(OVERFLOW_ERROR);
+ }
+
+ delta += (m - n) * handledCPCountPlusOne;
+ n = m;
+
+ for (i = 0; i < input.length; i++) {
+ currentValue = input[i];
+ if (currentValue < n && ++delta > maxInt) {
+ throw RangeError(OVERFLOW_ERROR);
+ }
+ if (currentValue == n) {
+ // Represent delta as a generalized variable-length integer.
+ var q = delta;
+ for (var k = base; /* no condition */; k += base) {
+ var t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
+ if (q < t) break;
+ var qMinusT = q - t;
+ var baseMinusT = base - t;
+ output.push(stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT)));
+ q = floor$2(qMinusT / baseMinusT);
+ }
+
+ output.push(stringFromCharCode(digitToBasic(q)));
+ bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);
+ delta = 0;
+ ++handledCPCount;
+ }
+ }
+
+ ++delta;
+ ++n;
+ }
+ return output.join('');
+ };
+
+ var stringPunycodeToAscii = function (input) {
+ var encoded = [];
+ var labels = input.toLowerCase().replace(regexSeparators, '\u002E').split('.');
+ var i, label;
+ for (i = 0; i < labels.length; i++) {
+ label = labels[i];
+ encoded.push(regexNonASCII.test(label) ? 'xn--' + encode(label) : label);
+ }
+ return encoded.join('.');
+ };
+
+ var redefineAll = function (target, src, options) {
+ for (var key in src) redefine(target, key, src[key], options);
+ return target;
+ };
+
+ var getIterator = function (it) {
+ var iteratorMethod = getIteratorMethod(it);
+ if (typeof iteratorMethod != 'function') {
+ throw TypeError(String(it) + ' is not iterable');
+ } return anObject(iteratorMethod.call(it));
+ };
+
+ // TODO: in core-js@4, move /modules/ dependencies to public entries for better optimization by tools like `preset-env`
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ var $fetch = getBuiltIn('fetch');
+ var Headers = getBuiltIn('Headers');
+ var ITERATOR$6 = wellKnownSymbol('iterator');
+ var URL_SEARCH_PARAMS = 'URLSearchParams';
+ var URL_SEARCH_PARAMS_ITERATOR = URL_SEARCH_PARAMS + 'Iterator';
+ var setInternalState$3 = internalState.set;
+ var getInternalParamsState = internalState.getterFor(URL_SEARCH_PARAMS);
+ var getInternalIteratorState = internalState.getterFor(URL_SEARCH_PARAMS_ITERATOR);
+
+ var plus = /\+/g;
+ var sequences = Array(4);
+
+ var percentSequence = function (bytes) {
+ return sequences[bytes - 1] || (sequences[bytes - 1] = RegExp('((?:%[\\da-f]{2}){' + bytes + '})', 'gi'));
+ };
+
+ var percentDecode = function (sequence) {
+ try {
+ return decodeURIComponent(sequence);
+ } catch (error) {
+ return sequence;
+ }
+ };
+
+ var deserialize = function (it) {
+ var result = it.replace(plus, ' ');
+ var bytes = 4;
+ try {
+ return decodeURIComponent(result);
+ } catch (error) {
+ while (bytes) {
+ result = result.replace(percentSequence(bytes--), percentDecode);
+ }
+ return result;
+ }
+ };
+
+ var find = /[!'()~]|%20/g;
+
+ var replace = {
+ '!': '%21',
+ "'": '%27',
+ '(': '%28',
+ ')': '%29',
+ '~': '%7E',
+ '%20': '+'
+ };
+
+ var replacer = function (match) {
+ return replace[match];
+ };
+
+ var serialize = function (it) {
+ return encodeURIComponent(it).replace(find, replacer);
+ };
+
+ var parseSearchParams = function (result, query) {
+ if (query) {
+ var attributes = query.split('&');
+ var index = 0;
+ var attribute, entry;
+ while (index < attributes.length) {
+ attribute = attributes[index++];
+ if (attribute.length) {
+ entry = attribute.split('=');
+ result.push({
+ key: deserialize(entry.shift()),
+ value: deserialize(entry.join('='))
+ });
+ }
+ }
+ }
+ };
+
+ var updateSearchParams = function (query) {
+ this.entries.length = 0;
+ parseSearchParams(this.entries, query);
+ };
+
+ var validateArgumentsLength = function (passed, required) {
+ if (passed < required) throw TypeError('Not enough arguments');
+ };
+
+ var URLSearchParamsIterator = createIteratorConstructor(function Iterator(params, kind) {
+ setInternalState$3(this, {
+ type: URL_SEARCH_PARAMS_ITERATOR,
+ iterator: getIterator(getInternalParamsState(params).entries),
+ kind: kind
+ });
+ }, 'Iterator', function next() {
+ var state = getInternalIteratorState(this);
+ var kind = state.kind;
+ var step = state.iterator.next();
+ var entry = step.value;
+ if (!step.done) {
+ step.value = kind === 'keys' ? entry.key : kind === 'values' ? entry.value : [entry.key, entry.value];
+ } return step;
+ });
+
+ // `URLSearchParams` constructor
+ // https://url.spec.whatwg.org/#interface-urlsearchparams
+ var URLSearchParamsConstructor = function URLSearchParams(/* init */) {
+ anInstance(this, URLSearchParamsConstructor, URL_SEARCH_PARAMS);
+ var init = arguments.length > 0 ? arguments[0] : undefined;
+ var that = this;
+ var entries = [];
+ var iteratorMethod, iterator, next, step, entryIterator, entryNext, first, second, key;
+
+ setInternalState$3(that, {
+ type: URL_SEARCH_PARAMS,
+ entries: entries,
+ updateURL: function () { /* empty */ },
+ updateSearchParams: updateSearchParams
+ });
+
+ if (init !== undefined) {
+ if (isObject(init)) {
+ iteratorMethod = getIteratorMethod(init);
+ if (typeof iteratorMethod === 'function') {
+ iterator = iteratorMethod.call(init);
+ next = iterator.next;
+ while (!(step = next.call(iterator)).done) {
+ entryIterator = getIterator(anObject(step.value));
+ entryNext = entryIterator.next;
+ if (
+ (first = entryNext.call(entryIterator)).done ||
+ (second = entryNext.call(entryIterator)).done ||
+ !entryNext.call(entryIterator).done
+ ) throw TypeError('Expected sequence with length 2');
+ entries.push({ key: first.value + '', value: second.value + '' });
+ }
+ } else for (key in init) if (has(init, key)) entries.push({ key: key, value: init[key] + '' });
+ } else {
+ parseSearchParams(entries, typeof init === 'string' ? init.charAt(0) === '?' ? init.slice(1) : init : init + '');
+ }
+ }
+ };
+
+ var URLSearchParamsPrototype = URLSearchParamsConstructor.prototype;
+
+ redefineAll(URLSearchParamsPrototype, {
+ // `URLSearchParams.prototype.appent` method
+ // https://url.spec.whatwg.org/#dom-urlsearchparams-append
+ append: function append(name, value) {
+ validateArgumentsLength(arguments.length, 2);
+ var state = getInternalParamsState(this);
+ state.entries.push({ key: name + '', value: value + '' });
+ state.updateURL();
+ },
+ // `URLSearchParams.prototype.delete` method
+ // https://url.spec.whatwg.org/#dom-urlsearchparams-delete
+ 'delete': function (name) {
+ validateArgumentsLength(arguments.length, 1);
+ var state = getInternalParamsState(this);
+ var entries = state.entries;
+ var key = name + '';
+ var index = 0;
+ while (index < entries.length) {
+ if (entries[index].key === key) entries.splice(index, 1);
+ else index++;
+ }
+ state.updateURL();
+ },
+ // `URLSearchParams.prototype.get` method
+ // https://url.spec.whatwg.org/#dom-urlsearchparams-get
+ get: function get(name) {
+ validateArgumentsLength(arguments.length, 1);
+ var entries = getInternalParamsState(this).entries;
+ var key = name + '';
+ var index = 0;
+ for (; index < entries.length; index++) {
+ if (entries[index].key === key) return entries[index].value;
+ }
+ return null;
+ },
+ // `URLSearchParams.prototype.getAll` method
+ // https://url.spec.whatwg.org/#dom-urlsearchparams-getall
+ getAll: function getAll(name) {
+ validateArgumentsLength(arguments.length, 1);
+ var entries = getInternalParamsState(this).entries;
+ var key = name + '';
+ var result = [];
+ var index = 0;
+ for (; index < entries.length; index++) {
+ if (entries[index].key === key) result.push(entries[index].value);
+ }
+ return result;
+ },
+ // `URLSearchParams.prototype.has` method
+ // https://url.spec.whatwg.org/#dom-urlsearchparams-has
+ has: function has(name) {
+ validateArgumentsLength(arguments.length, 1);
+ var entries = getInternalParamsState(this).entries;
+ var key = name + '';
+ var index = 0;
+ while (index < entries.length) {
+ if (entries[index++].key === key) return true;
+ }
+ return false;
+ },
+ // `URLSearchParams.prototype.set` method
+ // https://url.spec.whatwg.org/#dom-urlsearchparams-set
+ set: function set(name, value) {
+ validateArgumentsLength(arguments.length, 1);
+ var state = getInternalParamsState(this);
+ var entries = state.entries;
+ var found = false;
+ var key = name + '';
+ var val = value + '';
+ var index = 0;
+ var entry;
+ for (; index < entries.length; index++) {
+ entry = entries[index];
+ if (entry.key === key) {
+ if (found) entries.splice(index--, 1);
+ else {
+ found = true;
+ entry.value = val;
+ }
+ }
+ }
+ if (!found) entries.push({ key: key, value: val });
+ state.updateURL();
+ },
+ // `URLSearchParams.prototype.sort` method
+ // https://url.spec.whatwg.org/#dom-urlsearchparams-sort
+ sort: function sort() {
+ var state = getInternalParamsState(this);
+ var entries = state.entries;
+ // Array#sort is not stable in some engines
+ var slice = entries.slice();
+ var entry, entriesIndex, sliceIndex;
+ entries.length = 0;
+ for (sliceIndex = 0; sliceIndex < slice.length; sliceIndex++) {
+ entry = slice[sliceIndex];
+ for (entriesIndex = 0; entriesIndex < sliceIndex; entriesIndex++) {
+ if (entries[entriesIndex].key > entry.key) {
+ entries.splice(entriesIndex, 0, entry);
+ break;
+ }
+ }
+ if (entriesIndex === sliceIndex) entries.push(entry);
+ }
+ state.updateURL();
+ },
+ // `URLSearchParams.prototype.forEach` method
+ forEach: function forEach(callback /* , thisArg */) {
+ var entries = getInternalParamsState(this).entries;
+ var boundFunction = functionBindContext(callback, arguments.length > 1 ? arguments[1] : undefined, 3);
+ var index = 0;
+ var entry;
+ while (index < entries.length) {
+ entry = entries[index++];
+ boundFunction(entry.value, entry.key, this);
+ }
+ },
+ // `URLSearchParams.prototype.keys` method
+ keys: function keys() {
+ return new URLSearchParamsIterator(this, 'keys');
+ },
+ // `URLSearchParams.prototype.values` method
+ values: function values() {
+ return new URLSearchParamsIterator(this, 'values');
+ },
+ // `URLSearchParams.prototype.entries` method
+ entries: function entries() {
+ return new URLSearchParamsIterator(this, 'entries');
+ }
+ }, { enumerable: true });
+
+ // `URLSearchParams.prototype[@@iterator]` method
+ redefine(URLSearchParamsPrototype, ITERATOR$6, URLSearchParamsPrototype.entries);
+
+ // `URLSearchParams.prototype.toString` method
+ // https://url.spec.whatwg.org/#urlsearchparams-stringification-behavior
+ redefine(URLSearchParamsPrototype, 'toString', function toString() {
+ var entries = getInternalParamsState(this).entries;
+ var result = [];
+ var index = 0;
+ var entry;
+ while (index < entries.length) {
+ entry = entries[index++];
+ result.push(serialize(entry.key) + '=' + serialize(entry.value));
+ } return result.join('&');
+ }, { enumerable: true });
+
+ setToStringTag(URLSearchParamsConstructor, URL_SEARCH_PARAMS);
+
+ _export({ global: true, forced: !nativeUrl }, {
+ URLSearchParams: URLSearchParamsConstructor
+ });
+
+ // Wrap `fetch` for correct work with polyfilled `URLSearchParams`
+ // https://github.com/zloirock/core-js/issues/674
+ if (!nativeUrl && typeof $fetch == 'function' && typeof Headers == 'function') {
+ _export({ global: true, enumerable: true, forced: true }, {
+ fetch: function fetch(input /* , init */) {
+ var args = [input];
+ var init, body, headers;
+ if (arguments.length > 1) {
+ init = arguments[1];
+ if (isObject(init)) {
+ body = init.body;
+ if (classof(body) === URL_SEARCH_PARAMS) {
+ headers = init.headers ? new Headers(init.headers) : new Headers();
+ if (!headers.has('content-type')) {
+ headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8');
+ }
+ init = objectCreate(init, {
+ body: createPropertyDescriptor(0, String(body)),
+ headers: createPropertyDescriptor(0, headers)
+ });
+ }
+ }
+ args.push(init);
+ } return $fetch.apply(this, args);
+ }
+ });
+ }
+
+ var web_urlSearchParams = {
+ URLSearchParams: URLSearchParamsConstructor,
+ getState: getInternalParamsState
+ };
+
+ // TODO: in core-js@4, move /modules/ dependencies to public entries for better optimization by tools like `preset-env`
+
+
+
+
+
+
+
+
+
+
+
+ var codeAt = stringMultibyte.codeAt;
+
+
+
+
+
+ var NativeURL = global_1.URL;
+ var URLSearchParams$1 = web_urlSearchParams.URLSearchParams;
+ var getInternalSearchParamsState = web_urlSearchParams.getState;
+ var setInternalState$4 = internalState.set;
+ var getInternalURLState = internalState.getterFor('URL');
+ var floor$3 = Math.floor;
+ var pow = Math.pow;
+
+ var INVALID_AUTHORITY = 'Invalid authority';
+ var INVALID_SCHEME = 'Invalid scheme';
+ var INVALID_HOST = 'Invalid host';
+ var INVALID_PORT = 'Invalid port';
+
+ var ALPHA = /[A-Za-z]/;
+ var ALPHANUMERIC = /[\d+-.A-Za-z]/;
+ var DIGIT = /\d/;
+ var HEX_START = /^(0x|0X)/;
+ var OCT = /^[0-7]+$/;
+ var DEC = /^\d+$/;
+ var HEX = /^[\dA-Fa-f]+$/;
+ // eslint-disable-next-line no-control-regex
+ var FORBIDDEN_HOST_CODE_POINT = /[\u0000\u0009\u000A\u000D #%/:?@[\\]]/;
+ // eslint-disable-next-line no-control-regex
+ var FORBIDDEN_HOST_CODE_POINT_EXCLUDING_PERCENT = /[\u0000\u0009\u000A\u000D #/:?@[\\]]/;
+ // eslint-disable-next-line no-control-regex
+ var LEADING_AND_TRAILING_C0_CONTROL_OR_SPACE = /^[\u0000-\u001F ]+|[\u0000-\u001F ]+$/g;
+ // eslint-disable-next-line no-control-regex
+ var TAB_AND_NEW_LINE = /[\u0009\u000A\u000D]/g;
+ var EOF;
+
+ var parseHost = function (url, input) {
+ var result, codePoints, index;
+ if (input.charAt(0) == '[') {
+ if (input.charAt(input.length - 1) != ']') return INVALID_HOST;
+ result = parseIPv6(input.slice(1, -1));
+ if (!result) return INVALID_HOST;
+ url.host = result;
+ // opaque host
+ } else if (!isSpecial(url)) {
+ if (FORBIDDEN_HOST_CODE_POINT_EXCLUDING_PERCENT.test(input)) return INVALID_HOST;
+ result = '';
+ codePoints = arrayFrom(input);
+ for (index = 0; index < codePoints.length; index++) {
+ result += percentEncode(codePoints[index], C0ControlPercentEncodeSet);
+ }
+ url.host = result;
+ } else {
+ input = stringPunycodeToAscii(input);
+ if (FORBIDDEN_HOST_CODE_POINT.test(input)) return INVALID_HOST;
+ result = parseIPv4(input);
+ if (result === null) return INVALID_HOST;
+ url.host = result;
+ }
+ };
+
+ var parseIPv4 = function (input) {
+ var parts = input.split('.');
+ var partsLength, numbers, index, part, radix, number, ipv4;
+ if (parts.length && parts[parts.length - 1] == '') {
+ parts.pop();
+ }
+ partsLength = parts.length;
+ if (partsLength > 4) return input;
+ numbers = [];
+ for (index = 0; index < partsLength; index++) {
+ part = parts[index];
+ if (part == '') return input;
+ radix = 10;
+ if (part.length > 1 && part.charAt(0) == '0') {
+ radix = HEX_START.test(part) ? 16 : 8;
+ part = part.slice(radix == 8 ? 1 : 2);
+ }
+ if (part === '') {
+ number = 0;
+ } else {
+ if (!(radix == 10 ? DEC : radix == 8 ? OCT : HEX).test(part)) return input;
+ number = parseInt(part, radix);
+ }
+ numbers.push(number);
+ }
+ for (index = 0; index < partsLength; index++) {
+ number = numbers[index];
+ if (index == partsLength - 1) {
+ if (number >= pow(256, 5 - partsLength)) return null;
+ } else if (number > 255) return null;
+ }
+ ipv4 = numbers.pop();
+ for (index = 0; index < numbers.length; index++) {
+ ipv4 += numbers[index] * pow(256, 3 - index);
+ }
+ return ipv4;
+ };
+
+ // eslint-disable-next-line max-statements
+ var parseIPv6 = function (input) {
+ var address = [0, 0, 0, 0, 0, 0, 0, 0];
+ var pieceIndex = 0;
+ var compress = null;
+ var pointer = 0;
+ var value, length, numbersSeen, ipv4Piece, number, swaps, swap;
+
+ var char = function () {
+ return input.charAt(pointer);
+ };
+
+ if (char() == ':') {
+ if (input.charAt(1) != ':') return;
+ pointer += 2;
+ pieceIndex++;
+ compress = pieceIndex;
+ }
+ while (char()) {
+ if (pieceIndex == 8) return;
+ if (char() == ':') {
+ if (compress !== null) return;
+ pointer++;
+ pieceIndex++;
+ compress = pieceIndex;
+ continue;
+ }
+ value = length = 0;
+ while (length < 4 && HEX.test(char())) {
+ value = value * 16 + parseInt(char(), 16);
+ pointer++;
+ length++;
+ }
+ if (char() == '.') {
+ if (length == 0) return;
+ pointer -= length;
+ if (pieceIndex > 6) return;
+ numbersSeen = 0;
+ while (char()) {
+ ipv4Piece = null;
+ if (numbersSeen > 0) {
+ if (char() == '.' && numbersSeen < 4) pointer++;
+ else return;
+ }
+ if (!DIGIT.test(char())) return;
+ while (DIGIT.test(char())) {
+ number = parseInt(char(), 10);
+ if (ipv4Piece === null) ipv4Piece = number;
+ else if (ipv4Piece == 0) return;
+ else ipv4Piece = ipv4Piece * 10 + number;
+ if (ipv4Piece > 255) return;
+ pointer++;
+ }
+ address[pieceIndex] = address[pieceIndex] * 256 + ipv4Piece;
+ numbersSeen++;
+ if (numbersSeen == 2 || numbersSeen == 4) pieceIndex++;
+ }
+ if (numbersSeen != 4) return;
+ break;
+ } else if (char() == ':') {
+ pointer++;
+ if (!char()) return;
+ } else if (char()) return;
+ address[pieceIndex++] = value;
+ }
+ if (compress !== null) {
+ swaps = pieceIndex - compress;
+ pieceIndex = 7;
+ while (pieceIndex != 0 && swaps > 0) {
+ swap = address[pieceIndex];
+ address[pieceIndex--] = address[compress + swaps - 1];
+ address[compress + --swaps] = swap;
+ }
+ } else if (pieceIndex != 8) return;
+ return address;
+ };
+
+ var findLongestZeroSequence = function (ipv6) {
+ var maxIndex = null;
+ var maxLength = 1;
+ var currStart = null;
+ var currLength = 0;
+ var index = 0;
+ for (; index < 8; index++) {
+ if (ipv6[index] !== 0) {
+ if (currLength > maxLength) {
+ maxIndex = currStart;
+ maxLength = currLength;
+ }
+ currStart = null;
+ currLength = 0;
+ } else {
+ if (currStart === null) currStart = index;
+ ++currLength;
+ }
+ }
+ if (currLength > maxLength) {
+ maxIndex = currStart;
+ maxLength = currLength;
+ }
+ return maxIndex;
+ };
+
+ var serializeHost = function (host) {
+ var result, index, compress, ignore0;
+ // ipv4
+ if (typeof host == 'number') {
+ result = [];
+ for (index = 0; index < 4; index++) {
+ result.unshift(host % 256);
+ host = floor$3(host / 256);
+ } return result.join('.');
+ // ipv6
+ } else if (typeof host == 'object') {
+ result = '';
+ compress = findLongestZeroSequence(host);
+ for (index = 0; index < 8; index++) {
+ if (ignore0 && host[index] === 0) continue;
+ if (ignore0) ignore0 = false;
+ if (compress === index) {
+ result += index ? ':' : '::';
+ ignore0 = true;
+ } else {
+ result += host[index].toString(16);
+ if (index < 7) result += ':';
+ }
+ }
+ return '[' + result + ']';
+ } return host;
+ };
+
+ var C0ControlPercentEncodeSet = {};
+ var fragmentPercentEncodeSet = objectAssign({}, C0ControlPercentEncodeSet, {
+ ' ': 1, '"': 1, '<': 1, '>': 1, '`': 1
+ });
+ var pathPercentEncodeSet = objectAssign({}, fragmentPercentEncodeSet, {
+ '#': 1, '?': 1, '{': 1, '}': 1
+ });
+ var userinfoPercentEncodeSet = objectAssign({}, pathPercentEncodeSet, {
+ '/': 1, ':': 1, ';': 1, '=': 1, '@': 1, '[': 1, '\\': 1, ']': 1, '^': 1, '|': 1
+ });
+
+ var percentEncode = function (char, set) {
+ var code = codeAt(char, 0);
+ return code > 0x20 && code < 0x7F && !has(set, char) ? char : encodeURIComponent(char);
+ };
+
+ var specialSchemes = {
+ ftp: 21,
+ file: null,
+ http: 80,
+ https: 443,
+ ws: 80,
+ wss: 443
+ };
+
+ var isSpecial = function (url) {
+ return has(specialSchemes, url.scheme);
+ };
+
+ var includesCredentials = function (url) {
+ return url.username != '' || url.password != '';
+ };
+
+ var cannotHaveUsernamePasswordPort = function (url) {
+ return !url.host || url.cannotBeABaseURL || url.scheme == 'file';
+ };
+
+ var isWindowsDriveLetter = function (string, normalized) {
+ var second;
+ return string.length == 2 && ALPHA.test(string.charAt(0))
+ && ((second = string.charAt(1)) == ':' || (!normalized && second == '|'));
+ };
+
+ var startsWithWindowsDriveLetter = function (string) {
+ var third;
+ return string.length > 1 && isWindowsDriveLetter(string.slice(0, 2)) && (
+ string.length == 2 ||
+ ((third = string.charAt(2)) === '/' || third === '\\' || third === '?' || third === '#')
+ );
+ };
+
+ var shortenURLsPath = function (url) {
+ var path = url.path;
+ var pathSize = path.length;
+ if (pathSize && (url.scheme != 'file' || pathSize != 1 || !isWindowsDriveLetter(path[0], true))) {
+ path.pop();
+ }
+ };
+
+ var isSingleDot = function (segment) {
+ return segment === '.' || segment.toLowerCase() === '%2e';
+ };
+
+ var isDoubleDot = function (segment) {
+ segment = segment.toLowerCase();
+ return segment === '..' || segment === '%2e.' || segment === '.%2e' || segment === '%2e%2e';
+ };
+
+ // States:
+ var SCHEME_START = {};
+ var SCHEME = {};
+ var NO_SCHEME = {};
+ var SPECIAL_RELATIVE_OR_AUTHORITY = {};
+ var PATH_OR_AUTHORITY = {};
+ var RELATIVE = {};
+ var RELATIVE_SLASH = {};
+ var SPECIAL_AUTHORITY_SLASHES = {};
+ var SPECIAL_AUTHORITY_IGNORE_SLASHES = {};
+ var AUTHORITY = {};
+ var HOST = {};
+ var HOSTNAME = {};
+ var PORT = {};
+ var FILE = {};
+ var FILE_SLASH = {};
+ var FILE_HOST = {};
+ var PATH_START = {};
+ var PATH = {};
+ var CANNOT_BE_A_BASE_URL_PATH = {};
+ var QUERY = {};
+ var FRAGMENT = {};
+
+ // eslint-disable-next-line max-statements
+ var parseURL = function (url, input, stateOverride, base) {
+ var state = stateOverride || SCHEME_START;
+ var pointer = 0;
+ var buffer = '';
+ var seenAt = false;
+ var seenBracket = false;
+ var seenPasswordToken = false;
+ var codePoints, char, bufferCodePoints, failure;
+
+ if (!stateOverride) {
+ url.scheme = '';
+ url.username = '';
+ url.password = '';
+ url.host = null;
+ url.port = null;
+ url.path = [];
+ url.query = null;
+ url.fragment = null;
+ url.cannotBeABaseURL = false;
+ input = input.replace(LEADING_AND_TRAILING_C0_CONTROL_OR_SPACE, '');
+ }
+
+ input = input.replace(TAB_AND_NEW_LINE, '');
+
+ codePoints = arrayFrom(input);
+
+ while (pointer <= codePoints.length) {
+ char = codePoints[pointer];
+ switch (state) {
+ case SCHEME_START:
+ if (char && ALPHA.test(char)) {
+ buffer += char.toLowerCase();
+ state = SCHEME;
+ } else if (!stateOverride) {
+ state = NO_SCHEME;
+ continue;
+ } else return INVALID_SCHEME;
+ break;
+
+ case SCHEME:
+ if (char && (ALPHANUMERIC.test(char) || char == '+' || char == '-' || char == '.')) {
+ buffer += char.toLowerCase();
+ } else if (char == ':') {
+ if (stateOverride && (
+ (isSpecial(url) != has(specialSchemes, buffer)) ||
+ (buffer == 'file' && (includesCredentials(url) || url.port !== null)) ||
+ (url.scheme == 'file' && !url.host)
+ )) return;
+ url.scheme = buffer;
+ if (stateOverride) {
+ if (isSpecial(url) && specialSchemes[url.scheme] == url.port) url.port = null;
+ return;
+ }
+ buffer = '';
+ if (url.scheme == 'file') {
+ state = FILE;
+ } else if (isSpecial(url) && base && base.scheme == url.scheme) {
+ state = SPECIAL_RELATIVE_OR_AUTHORITY;
+ } else if (isSpecial(url)) {
+ state = SPECIAL_AUTHORITY_SLASHES;
+ } else if (codePoints[pointer + 1] == '/') {
+ state = PATH_OR_AUTHORITY;
+ pointer++;
+ } else {
+ url.cannotBeABaseURL = true;
+ url.path.push('');
+ state = CANNOT_BE_A_BASE_URL_PATH;
+ }
+ } else if (!stateOverride) {
+ buffer = '';
+ state = NO_SCHEME;
+ pointer = 0;
+ continue;
+ } else return INVALID_SCHEME;
+ break;
+
+ case NO_SCHEME:
+ if (!base || (base.cannotBeABaseURL && char != '#')) return INVALID_SCHEME;
+ if (base.cannotBeABaseURL && char == '#') {
+ url.scheme = base.scheme;
+ url.path = base.path.slice();
+ url.query = base.query;
+ url.fragment = '';
+ url.cannotBeABaseURL = true;
+ state = FRAGMENT;
+ break;
+ }
+ state = base.scheme == 'file' ? FILE : RELATIVE;
+ continue;
+
+ case SPECIAL_RELATIVE_OR_AUTHORITY:
+ if (char == '/' && codePoints[pointer + 1] == '/') {
+ state = SPECIAL_AUTHORITY_IGNORE_SLASHES;
+ pointer++;
+ } else {
+ state = RELATIVE;
+ continue;
+ } break;
+
+ case PATH_OR_AUTHORITY:
+ if (char == '/') {
+ state = AUTHORITY;
+ break;
+ } else {
+ state = PATH;
+ continue;
+ }
+
+ case RELATIVE:
+ url.scheme = base.scheme;
+ if (char == EOF) {
+ url.username = base.username;
+ url.password = base.password;
+ url.host = base.host;
+ url.port = base.port;
+ url.path = base.path.slice();
+ url.query = base.query;
+ } else if (char == '/' || (char == '\\' && isSpecial(url))) {
+ state = RELATIVE_SLASH;
+ } else if (char == '?') {
+ url.username = base.username;
+ url.password = base.password;
+ url.host = base.host;
+ url.port = base.port;
+ url.path = base.path.slice();
+ url.query = '';
+ state = QUERY;
+ } else if (char == '#') {
+ url.username = base.username;
+ url.password = base.password;
+ url.host = base.host;
+ url.port = base.port;
+ url.path = base.path.slice();
+ url.query = base.query;
+ url.fragment = '';
+ state = FRAGMENT;
+ } else {
+ url.username = base.username;
+ url.password = base.password;
+ url.host = base.host;
+ url.port = base.port;
+ url.path = base.path.slice();
+ url.path.pop();
+ state = PATH;
+ continue;
+ } break;
+
+ case RELATIVE_SLASH:
+ if (isSpecial(url) && (char == '/' || char == '\\')) {
+ state = SPECIAL_AUTHORITY_IGNORE_SLASHES;
+ } else if (char == '/') {
+ state = AUTHORITY;
+ } else {
+ url.username = base.username;
+ url.password = base.password;
+ url.host = base.host;
+ url.port = base.port;
+ state = PATH;
+ continue;
+ } break;
+
+ case SPECIAL_AUTHORITY_SLASHES:
+ state = SPECIAL_AUTHORITY_IGNORE_SLASHES;
+ if (char != '/' || buffer.charAt(pointer + 1) != '/') continue;
+ pointer++;
+ break;
+
+ case SPECIAL_AUTHORITY_IGNORE_SLASHES:
+ if (char != '/' && char != '\\') {
+ state = AUTHORITY;
+ continue;
+ } break;
+
+ case AUTHORITY:
+ if (char == '@') {
+ if (seenAt) buffer = '%40' + buffer;
+ seenAt = true;
+ bufferCodePoints = arrayFrom(buffer);
+ for (var i = 0; i < bufferCodePoints.length; i++) {
+ var codePoint = bufferCodePoints[i];
+ if (codePoint == ':' && !seenPasswordToken) {
+ seenPasswordToken = true;
+ continue;
+ }
+ var encodedCodePoints = percentEncode(codePoint, userinfoPercentEncodeSet);
+ if (seenPasswordToken) url.password += encodedCodePoints;
+ else url.username += encodedCodePoints;
+ }
+ buffer = '';
+ } else if (
+ char == EOF || char == '/' || char == '?' || char == '#' ||
+ (char == '\\' && isSpecial(url))
+ ) {
+ if (seenAt && buffer == '') return INVALID_AUTHORITY;
+ pointer -= arrayFrom(buffer).length + 1;
+ buffer = '';
+ state = HOST;
+ } else buffer += char;
+ break;
+
+ case HOST:
+ case HOSTNAME:
+ if (stateOverride && url.scheme == 'file') {
+ state = FILE_HOST;
+ continue;
+ } else if (char == ':' && !seenBracket) {
+ if (buffer == '') return INVALID_HOST;
+ failure = parseHost(url, buffer);
+ if (failure) return failure;
+ buffer = '';
+ state = PORT;
+ if (stateOverride == HOSTNAME) return;
+ } else if (
+ char == EOF || char == '/' || char == '?' || char == '#' ||
+ (char == '\\' && isSpecial(url))
+ ) {
+ if (isSpecial(url) && buffer == '') return INVALID_HOST;
+ if (stateOverride && buffer == '' && (includesCredentials(url) || url.port !== null)) return;
+ failure = parseHost(url, buffer);
+ if (failure) return failure;
+ buffer = '';
+ state = PATH_START;
+ if (stateOverride) return;
+ continue;
+ } else {
+ if (char == '[') seenBracket = true;
+ else if (char == ']') seenBracket = false;
+ buffer += char;
+ } break;
+
+ case PORT:
+ if (DIGIT.test(char)) {
+ buffer += char;
+ } else if (
+ char == EOF || char == '/' || char == '?' || char == '#' ||
+ (char == '\\' && isSpecial(url)) ||
+ stateOverride
+ ) {
+ if (buffer != '') {
+ var port = parseInt(buffer, 10);
+ if (port > 0xFFFF) return INVALID_PORT;
+ url.port = (isSpecial(url) && port === specialSchemes[url.scheme]) ? null : port;
+ buffer = '';
+ }
+ if (stateOverride) return;
+ state = PATH_START;
+ continue;
+ } else return INVALID_PORT;
+ break;
+
+ case FILE:
+ url.scheme = 'file';
+ if (char == '/' || char == '\\') state = FILE_SLASH;
+ else if (base && base.scheme == 'file') {
+ if (char == EOF) {
+ url.host = base.host;
+ url.path = base.path.slice();
+ url.query = base.query;
+ } else if (char == '?') {
+ url.host = base.host;
+ url.path = base.path.slice();
+ url.query = '';
+ state = QUERY;
+ } else if (char == '#') {
+ url.host = base.host;
+ url.path = base.path.slice();
+ url.query = base.query;
+ url.fragment = '';
+ state = FRAGMENT;
+ } else {
+ if (!startsWithWindowsDriveLetter(codePoints.slice(pointer).join(''))) {
+ url.host = base.host;
+ url.path = base.path.slice();
+ shortenURLsPath(url);
+ }
+ state = PATH;
+ continue;
+ }
+ } else {
+ state = PATH;
+ continue;
+ } break;
+
+ case FILE_SLASH:
+ if (char == '/' || char == '\\') {
+ state = FILE_HOST;
+ break;
+ }
+ if (base && base.scheme == 'file' && !startsWithWindowsDriveLetter(codePoints.slice(pointer).join(''))) {
+ if (isWindowsDriveLetter(base.path[0], true)) url.path.push(base.path[0]);
+ else url.host = base.host;
+ }
+ state = PATH;
+ continue;
+
+ case FILE_HOST:
+ if (char == EOF || char == '/' || char == '\\' || char == '?' || char == '#') {
+ if (!stateOverride && isWindowsDriveLetter(buffer)) {
+ state = PATH;
+ } else if (buffer == '') {
+ url.host = '';
+ if (stateOverride) return;
+ state = PATH_START;
+ } else {
+ failure = parseHost(url, buffer);
+ if (failure) return failure;
+ if (url.host == 'localhost') url.host = '';
+ if (stateOverride) return;
+ buffer = '';
+ state = PATH_START;
+ } continue;
+ } else buffer += char;
+ break;
+
+ case PATH_START:
+ if (isSpecial(url)) {
+ state = PATH;
+ if (char != '/' && char != '\\') continue;
+ } else if (!stateOverride && char == '?') {
+ url.query = '';
+ state = QUERY;
+ } else if (!stateOverride && char == '#') {
+ url.fragment = '';
+ state = FRAGMENT;
+ } else if (char != EOF) {
+ state = PATH;
+ if (char != '/') continue;
+ } break;
+
+ case PATH:
+ if (
+ char == EOF || char == '/' ||
+ (char == '\\' && isSpecial(url)) ||
+ (!stateOverride && (char == '?' || char == '#'))
+ ) {
+ if (isDoubleDot(buffer)) {
+ shortenURLsPath(url);
+ if (char != '/' && !(char == '\\' && isSpecial(url))) {
+ url.path.push('');
+ }
+ } else if (isSingleDot(buffer)) {
+ if (char != '/' && !(char == '\\' && isSpecial(url))) {
+ url.path.push('');
+ }
+ } else {
+ if (url.scheme == 'file' && !url.path.length && isWindowsDriveLetter(buffer)) {
+ if (url.host) url.host = '';
+ buffer = buffer.charAt(0) + ':'; // normalize windows drive letter
+ }
+ url.path.push(buffer);
+ }
+ buffer = '';
+ if (url.scheme == 'file' && (char == EOF || char == '?' || char == '#')) {
+ while (url.path.length > 1 && url.path[0] === '') {
+ url.path.shift();
+ }
+ }
+ if (char == '?') {
+ url.query = '';
+ state = QUERY;
+ } else if (char == '#') {
+ url.fragment = '';
+ state = FRAGMENT;
+ }
+ } else {
+ buffer += percentEncode(char, pathPercentEncodeSet);
+ } break;
+
+ case CANNOT_BE_A_BASE_URL_PATH:
+ if (char == '?') {
+ url.query = '';
+ state = QUERY;
+ } else if (char == '#') {
+ url.fragment = '';
+ state = FRAGMENT;
+ } else if (char != EOF) {
+ url.path[0] += percentEncode(char, C0ControlPercentEncodeSet);
+ } break;
+
+ case QUERY:
+ if (!stateOverride && char == '#') {
+ url.fragment = '';
+ state = FRAGMENT;
+ } else if (char != EOF) {
+ if (char == "'" && isSpecial(url)) url.query += '%27';
+ else if (char == '#') url.query += '%23';
+ else url.query += percentEncode(char, C0ControlPercentEncodeSet);
+ } break;
+
+ case FRAGMENT:
+ if (char != EOF) url.fragment += percentEncode(char, fragmentPercentEncodeSet);
+ break;
+ }
+
+ pointer++;
+ }
+ };
+
+ // `URL` constructor
+ // https://url.spec.whatwg.org/#url-class
+ var URLConstructor = function URL(url /* , base */) {
+ var that = anInstance(this, URLConstructor, 'URL');
+ var base = arguments.length > 1 ? arguments[1] : undefined;
+ var urlString = String(url);
+ var state = setInternalState$4(that, { type: 'URL' });
+ var baseState, failure;
+ if (base !== undefined) {
+ if (base instanceof URLConstructor) baseState = getInternalURLState(base);
+ else {
+ failure = parseURL(baseState = {}, String(base));
+ if (failure) throw TypeError(failure);
+ }
+ }
+ failure = parseURL(state, urlString, null, baseState);
+ if (failure) throw TypeError(failure);
+ var searchParams = state.searchParams = new URLSearchParams$1();
+ var searchParamsState = getInternalSearchParamsState(searchParams);
+ searchParamsState.updateSearchParams(state.query);
+ searchParamsState.updateURL = function () {
+ state.query = String(searchParams) || null;
+ };
+ if (!descriptors) {
+ that.href = serializeURL.call(that);
+ that.origin = getOrigin.call(that);
+ that.protocol = getProtocol.call(that);
+ that.username = getUsername.call(that);
+ that.password = getPassword.call(that);
+ that.host = getHost.call(that);
+ that.hostname = getHostname.call(that);
+ that.port = getPort.call(that);
+ that.pathname = getPathname.call(that);
+ that.search = getSearch.call(that);
+ that.searchParams = getSearchParams.call(that);
+ that.hash = getHash.call(that);
+ }
+ };
+
+ var URLPrototype = URLConstructor.prototype;
+
+ var serializeURL = function () {
+ var url = getInternalURLState(this);
+ var scheme = url.scheme;
+ var username = url.username;
+ var password = url.password;
+ var host = url.host;
+ var port = url.port;
+ var path = url.path;
+ var query = url.query;
+ var fragment = url.fragment;
+ var output = scheme + ':';
+ if (host !== null) {
+ output += '//';
+ if (includesCredentials(url)) {
+ output += username + (password ? ':' + password : '') + '@';
+ }
+ output += serializeHost(host);
+ if (port !== null) output += ':' + port;
+ } else if (scheme == 'file') output += '//';
+ output += url.cannotBeABaseURL ? path[0] : path.length ? '/' + path.join('/') : '';
+ if (query !== null) output += '?' + query;
+ if (fragment !== null) output += '#' + fragment;
+ return output;
+ };
+
+ var getOrigin = function () {
+ var url = getInternalURLState(this);
+ var scheme = url.scheme;
+ var port = url.port;
+ if (scheme == 'blob') try {
+ return new URL(scheme.path[0]).origin;
+ } catch (error) {
+ return 'null';
+ }
+ if (scheme == 'file' || !isSpecial(url)) return 'null';
+ return scheme + '://' + serializeHost(url.host) + (port !== null ? ':' + port : '');
+ };
+
+ var getProtocol = function () {
+ return getInternalURLState(this).scheme + ':';
+ };
+
+ var getUsername = function () {
+ return getInternalURLState(this).username;
+ };
+
+ var getPassword = function () {
+ return getInternalURLState(this).password;
+ };
+
+ var getHost = function () {
+ var url = getInternalURLState(this);
+ var host = url.host;
+ var port = url.port;
+ return host === null ? ''
+ : port === null ? serializeHost(host)
+ : serializeHost(host) + ':' + port;
+ };
+
+ var getHostname = function () {
+ var host = getInternalURLState(this).host;
+ return host === null ? '' : serializeHost(host);
+ };
+
+ var getPort = function () {
+ var port = getInternalURLState(this).port;
+ return port === null ? '' : String(port);
+ };
+
+ var getPathname = function () {
+ var url = getInternalURLState(this);
+ var path = url.path;
+ return url.cannotBeABaseURL ? path[0] : path.length ? '/' + path.join('/') : '';
+ };
+
+ var getSearch = function () {
+ var query = getInternalURLState(this).query;
+ return query ? '?' + query : '';
+ };
+
+ var getSearchParams = function () {
+ return getInternalURLState(this).searchParams;
+ };
+
+ var getHash = function () {
+ var fragment = getInternalURLState(this).fragment;
+ return fragment ? '#' + fragment : '';
+ };
+
+ var accessorDescriptor = function (getter, setter) {
+ return { get: getter, set: setter, configurable: true, enumerable: true };
+ };
+
+ if (descriptors) {
+ objectDefineProperties(URLPrototype, {
+ // `URL.prototype.href` accessors pair
+ // https://url.spec.whatwg.org/#dom-url-href
+ href: accessorDescriptor(serializeURL, function (href) {
+ var url = getInternalURLState(this);
+ var urlString = String(href);
+ var failure = parseURL(url, urlString);
+ if (failure) throw TypeError(failure);
+ getInternalSearchParamsState(url.searchParams).updateSearchParams(url.query);
+ }),
+ // `URL.prototype.origin` getter
+ // https://url.spec.whatwg.org/#dom-url-origin
+ origin: accessorDescriptor(getOrigin),
+ // `URL.prototype.protocol` accessors pair
+ // https://url.spec.whatwg.org/#dom-url-protocol
+ protocol: accessorDescriptor(getProtocol, function (protocol) {
+ var url = getInternalURLState(this);
+ parseURL(url, String(protocol) + ':', SCHEME_START);
+ }),
+ // `URL.prototype.username` accessors pair
+ // https://url.spec.whatwg.org/#dom-url-username
+ username: accessorDescriptor(getUsername, function (username) {
+ var url = getInternalURLState(this);
+ var codePoints = arrayFrom(String(username));
+ if (cannotHaveUsernamePasswordPort(url)) return;
+ url.username = '';
+ for (var i = 0; i < codePoints.length; i++) {
+ url.username += percentEncode(codePoints[i], userinfoPercentEncodeSet);
+ }
+ }),
+ // `URL.prototype.password` accessors pair
+ // https://url.spec.whatwg.org/#dom-url-password
+ password: accessorDescriptor(getPassword, function (password) {
+ var url = getInternalURLState(this);
+ var codePoints = arrayFrom(String(password));
+ if (cannotHaveUsernamePasswordPort(url)) return;
+ url.password = '';
+ for (var i = 0; i < codePoints.length; i++) {
+ url.password += percentEncode(codePoints[i], userinfoPercentEncodeSet);
+ }
+ }),
+ // `URL.prototype.host` accessors pair
+ // https://url.spec.whatwg.org/#dom-url-host
+ host: accessorDescriptor(getHost, function (host) {
+ var url = getInternalURLState(this);
+ if (url.cannotBeABaseURL) return;
+ parseURL(url, String(host), HOST);
+ }),
+ // `URL.prototype.hostname` accessors pair
+ // https://url.spec.whatwg.org/#dom-url-hostname
+ hostname: accessorDescriptor(getHostname, function (hostname) {
+ var url = getInternalURLState(this);
+ if (url.cannotBeABaseURL) return;
+ parseURL(url, String(hostname), HOSTNAME);
+ }),
+ // `URL.prototype.port` accessors pair
+ // https://url.spec.whatwg.org/#dom-url-port
+ port: accessorDescriptor(getPort, function (port) {
+ var url = getInternalURLState(this);
+ if (cannotHaveUsernamePasswordPort(url)) return;
+ port = String(port);
+ if (port == '') url.port = null;
+ else parseURL(url, port, PORT);
+ }),
+ // `URL.prototype.pathname` accessors pair
+ // https://url.spec.whatwg.org/#dom-url-pathname
+ pathname: accessorDescriptor(getPathname, function (pathname) {
+ var url = getInternalURLState(this);
+ if (url.cannotBeABaseURL) return;
+ url.path = [];
+ parseURL(url, pathname + '', PATH_START);
+ }),
+ // `URL.prototype.search` accessors pair
+ // https://url.spec.whatwg.org/#dom-url-search
+ search: accessorDescriptor(getSearch, function (search) {
+ var url = getInternalURLState(this);
+ search = String(search);
+ if (search == '') {
+ url.query = null;
+ } else {
+ if ('?' == search.charAt(0)) search = search.slice(1);
+ url.query = '';
+ parseURL(url, search, QUERY);
+ }
+ getInternalSearchParamsState(url.searchParams).updateSearchParams(url.query);
+ }),
+ // `URL.prototype.searchParams` getter
+ // https://url.spec.whatwg.org/#dom-url-searchparams
+ searchParams: accessorDescriptor(getSearchParams),
+ // `URL.prototype.hash` accessors pair
+ // https://url.spec.whatwg.org/#dom-url-hash
+ hash: accessorDescriptor(getHash, function (hash) {
+ var url = getInternalURLState(this);
+ hash = String(hash);
+ if (hash == '') {
+ url.fragment = null;
+ return;
+ }
+ if ('#' == hash.charAt(0)) hash = hash.slice(1);
+ url.fragment = '';
+ parseURL(url, hash, FRAGMENT);
+ })
+ });
+ }
+
+ // `URL.prototype.toJSON` method
+ // https://url.spec.whatwg.org/#dom-url-tojson
+ redefine(URLPrototype, 'toJSON', function toJSON() {
+ return serializeURL.call(this);
+ }, { enumerable: true });
+
+ // `URL.prototype.toString` method
+ // https://url.spec.whatwg.org/#URL-stringification-behavior
+ redefine(URLPrototype, 'toString', function toString() {
+ return serializeURL.call(this);
+ }, { enumerable: true });
+
+ if (NativeURL) {
+ var nativeCreateObjectURL = NativeURL.createObjectURL;
+ var nativeRevokeObjectURL = NativeURL.revokeObjectURL;
+ // `URL.createObjectURL` method
+ // https://developer.mozilla.org/en-US/docs/Web/API/URL/createObjectURL
+ // eslint-disable-next-line no-unused-vars
+ if (nativeCreateObjectURL) redefine(URLConstructor, 'createObjectURL', function createObjectURL(blob) {
+ return nativeCreateObjectURL.apply(NativeURL, arguments);
+ });
+ // `URL.revokeObjectURL` method
+ // https://developer.mozilla.org/en-US/docs/Web/API/URL/revokeObjectURL
+ // eslint-disable-next-line no-unused-vars
+ if (nativeRevokeObjectURL) redefine(URLConstructor, 'revokeObjectURL', function revokeObjectURL(url) {
+ return nativeRevokeObjectURL.apply(NativeURL, arguments);
+ });
+ }
+
+ setToStringTag(URLConstructor, 'URL');
+
+ _export({ global: true, forced: !nativeUrl, sham: !descriptors }, {
+ URL: URLConstructor
+ });
+
+ function _typeof(obj) {
+ "@babel/helpers - typeof";
+
+ if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
+ _typeof = function (obj) {
+ return typeof obj;
+ };
+ } else {
+ _typeof = function (obj) {
+ return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
+ };
+ }
+
+ return _typeof(obj);
+ }
+
+ function _classCallCheck(instance, Constructor) {
+ if (!(instance instanceof Constructor)) {
+ throw new TypeError("Cannot call a class as a function");
+ }
+ }
+
+ function _defineProperties(target, props) {
+ for (var i = 0; i < props.length; i++) {
+ var descriptor = props[i];
+ descriptor.enumerable = descriptor.enumerable || false;
+ descriptor.configurable = true;
+ if ("value" in descriptor) descriptor.writable = true;
+ Object.defineProperty(target, descriptor.key, descriptor);
+ }
+ }
+
+ function _createClass(Constructor, protoProps, staticProps) {
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
+ if (staticProps) _defineProperties(Constructor, staticProps);
+ return Constructor;
+ }
+
+ function _defineProperty(obj, key, value) {
+ if (key in obj) {
+ Object.defineProperty(obj, key, {
+ value: value,
+ enumerable: true,
+ configurable: true,
+ writable: true
+ });
+ } else {
+ obj[key] = value;
+ }
+
+ return obj;
+ }
+
+ function ownKeys$1(object, enumerableOnly) {
+ var keys = Object.keys(object);
+
+ if (Object.getOwnPropertySymbols) {
+ var symbols = Object.getOwnPropertySymbols(object);
+ if (enumerableOnly) symbols = symbols.filter(function (sym) {
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
+ });
+ keys.push.apply(keys, symbols);
+ }
+
+ return keys;
+ }
+
+ function _objectSpread2(target) {
+ for (var i = 1; i < arguments.length; i++) {
+ var source = arguments[i] != null ? arguments[i] : {};
+
+ if (i % 2) {
+ ownKeys$1(Object(source), true).forEach(function (key) {
+ _defineProperty(target, key, source[key]);
+ });
+ } else if (Object.getOwnPropertyDescriptors) {
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
+ } else {
+ ownKeys$1(Object(source)).forEach(function (key) {
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
+ });
+ }
+ }
+
+ return target;
+ }
+
+ function _objectWithoutPropertiesLoose(source, excluded) {
+ if (source == null) return {};
+ var target = {};
+ var sourceKeys = Object.keys(source);
+ var key, i;
+
+ for (i = 0; i < sourceKeys.length; i++) {
+ key = sourceKeys[i];
+ if (excluded.indexOf(key) >= 0) continue;
+ target[key] = source[key];
+ }
+
+ return target;
+ }
+
+ function _objectWithoutProperties(source, excluded) {
+ if (source == null) return {};
+
+ var target = _objectWithoutPropertiesLoose(source, excluded);
+
+ var key, i;
+
+ if (Object.getOwnPropertySymbols) {
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
+
+ for (i = 0; i < sourceSymbolKeys.length; i++) {
+ key = sourceSymbolKeys[i];
+ if (excluded.indexOf(key) >= 0) continue;
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
+ target[key] = source[key];
+ }
+ }
+
+ return target;
+ }
+
+ function _slicedToArray(arr, i) {
+ return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
+ }
+
+ function _toConsumableArray(arr) {
+ return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
+ }
+
+ function _arrayWithoutHoles(arr) {
+ if (Array.isArray(arr)) return _arrayLikeToArray(arr);
+ }
+
+ function _arrayWithHoles(arr) {
+ if (Array.isArray(arr)) return arr;
+ }
+
+ function _iterableToArray(iter) {
+ if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
+ }
+
+ function _iterableToArrayLimit(arr, i) {
+ if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
+ var _arr = [];
+ var _n = true;
+ var _d = false;
+ var _e = undefined;
+
+ try {
+ for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
+ _arr.push(_s.value);
+
+ if (i && _arr.length === i) break;
+ }
+ } catch (err) {
+ _d = true;
+ _e = err;
+ } finally {
+ try {
+ if (!_n && _i["return"] != null) _i["return"]();
+ } finally {
+ if (_d) throw _e;
+ }
+ }
+
+ return _arr;
+ }
+
+ function _unsupportedIterableToArray(o, minLen) {
+ if (!o) return;
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
+ var n = Object.prototype.toString.call(o).slice(8, -1);
+ if (n === "Object" && o.constructor) n = o.constructor.name;
+ if (n === "Map" || n === "Set") return Array.from(o);
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
+ }
+
+ function _arrayLikeToArray(arr, len) {
+ if (len == null || len > arr.length) len = arr.length;
+
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
+
+ return arr2;
+ }
+
+ function _nonIterableSpread() {
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
+ }
+
+ function _nonIterableRest() {
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
+ }
+
+ (function (global) {
+ /**
+ * Polyfill URLSearchParams
+ *
+ * Inspired from : https://github.com/WebReflection/url-search-params/blob/master/src/url-search-params.js
+ */
+ var checkIfIteratorIsSupported = function checkIfIteratorIsSupported() {
+ try {
+ return !!Symbol.iterator;
+ } catch (error) {
+ return false;
+ }
+ };
+
+ var iteratorSupported = checkIfIteratorIsSupported();
+
+ var createIterator = function createIterator(items) {
+ var iterator = {
+ next: function next() {
+ var value = items.shift();
+ return {
+ done: value === void 0,
+ value: value
+ };
+ }
+ };
+
+ if (iteratorSupported) {
+ iterator[Symbol.iterator] = function () {
+ return iterator;
+ };
+ }
+
+ return iterator;
+ };
+ /**
+ * Search param name and values should be encoded according to https://url.spec.whatwg.org/#urlencoded-serializing
+ * encodeURIComponent() produces the same result except encoding spaces as `%20` instead of `+`.
+ */
+
+
+ var serializeParam = function serializeParam(value) {
+ return encodeURIComponent(value).replace(/%20/g, '+');
+ };
+
+ var deserializeParam = function deserializeParam(value) {
+ return decodeURIComponent(String(value).replace(/\+/g, ' '));
+ };
+
+ var polyfillURLSearchParams = function polyfillURLSearchParams() {
+ var URLSearchParams = function URLSearchParams(searchString) {
+ Object.defineProperty(this, '_entries', {
+ writable: true,
+ value: {}
+ });
+
+ var typeofSearchString = _typeof(searchString);
+
+ if (typeofSearchString === 'undefined') ; else if (typeofSearchString === 'string') {
+ if (searchString !== '') {
+ this._fromString(searchString);
+ }
+ } else if (searchString instanceof URLSearchParams) {
+ var _this = this;
+
+ searchString.forEach(function (value, name) {
+ _this.append(name, value);
+ });
+ } else if (searchString !== null && typeofSearchString === 'object') {
+ if (Object.prototype.toString.call(searchString) === '[object Array]') {
+ for (var i = 0; i < searchString.length; i++) {
+ var entry = searchString[i];
+
+ if (Object.prototype.toString.call(entry) === '[object Array]' || entry.length !== 2) {
+ this.append(entry[0], entry[1]);
+ } else {
+ throw new TypeError('Expected [string, any] as entry at index ' + i + ' of URLSearchParams\'s input');
+ }
+ }
+ } else {
+ for (var key in searchString) {
+ if (searchString.hasOwnProperty(key)) {
+ this.append(key, searchString[key]);
+ }
+ }
+ }
+ } else {
+ throw new TypeError('Unsupported input\'s type for URLSearchParams');
+ }
+ };
+
+ var proto = URLSearchParams.prototype;
+
+ proto.append = function (name, value) {
+ if (name in this._entries) {
+ this._entries[name].push(String(value));
+ } else {
+ this._entries[name] = [String(value)];
+ }
+ };
+
+ proto.delete = function (name) {
+ delete this._entries[name];
+ };
+
+ proto.get = function (name) {
+ return name in this._entries ? this._entries[name][0] : null;
+ };
+
+ proto.getAll = function (name) {
+ return name in this._entries ? this._entries[name].slice(0) : [];
+ };
+
+ proto.has = function (name) {
+ return name in this._entries;
+ };
+
+ proto.set = function (name, value) {
+ this._entries[name] = [String(value)];
+ };
+
+ proto.forEach = function (callback, thisArg) {
+ var entries;
+
+ for (var name in this._entries) {
+ if (this._entries.hasOwnProperty(name)) {
+ entries = this._entries[name];
+
+ for (var i = 0; i < entries.length; i++) {
+ callback.call(thisArg, entries[i], name, this);
+ }
+ }
+ }
+ };
+
+ proto.keys = function () {
+ var items = [];
+ this.forEach(function (value, name) {
+ items.push(name);
+ });
+ return createIterator(items);
+ };
+
+ proto.values = function () {
+ var items = [];
+ this.forEach(function (value) {
+ items.push(value);
+ });
+ return createIterator(items);
+ };
+
+ proto.entries = function () {
+ var items = [];
+ this.forEach(function (value, name) {
+ items.push([name, value]);
+ });
+ return createIterator(items);
+ };
+
+ if (iteratorSupported) {
+ proto[Symbol.iterator] = proto.entries;
+ }
+
+ proto.toString = function () {
+ var searchArray = [];
+ this.forEach(function (value, name) {
+ searchArray.push(serializeParam(name) + '=' + serializeParam(value));
+ });
+ return searchArray.join('&');
+ };
+
+ global.URLSearchParams = URLSearchParams;
+ };
+
+ var checkIfURLSearchParamsSupported = function checkIfURLSearchParamsSupported() {
+ try {
+ var URLSearchParams = global.URLSearchParams;
+ return new URLSearchParams('?a=1').toString() === 'a=1' && typeof URLSearchParams.prototype.set === 'function';
+ } catch (e) {
+ return false;
+ }
+ };
+
+ if (!checkIfURLSearchParamsSupported()) {
+ polyfillURLSearchParams();
+ }
+
+ var proto = global.URLSearchParams.prototype;
+
+ if (typeof proto.sort !== 'function') {
+ proto.sort = function () {
+ var _this = this;
+
+ var items = [];
+ this.forEach(function (value, name) {
+ items.push([name, value]);
+
+ if (!_this._entries) {
+ _this.delete(name);
+ }
+ });
+ items.sort(function (a, b) {
+ if (a[0] < b[0]) {
+ return -1;
+ } else if (a[0] > b[0]) {
+ return +1;
+ } else {
+ return 0;
+ }
+ });
+
+ if (_this._entries) {
+ // force reset because IE keeps keys index
+ _this._entries = {};
+ }
+
+ for (var i = 0; i < items.length; i++) {
+ this.append(items[i][0], items[i][1]);
+ }
+ };
+ }
+
+ if (typeof proto._fromString !== 'function') {
+ Object.defineProperty(proto, '_fromString', {
+ enumerable: false,
+ configurable: false,
+ writable: false,
+ value: function value(searchString) {
+ if (this._entries) {
+ this._entries = {};
+ } else {
+ var keys = [];
+ this.forEach(function (value, name) {
+ keys.push(name);
+ });
+
+ for (var i = 0; i < keys.length; i++) {
+ this.delete(keys[i]);
+ }
+ }
+
+ searchString = searchString.replace(/^\?/, '');
+ var attributes = searchString.split('&');
+ var attribute;
+
+ for (var i = 0; i < attributes.length; i++) {
+ attribute = attributes[i].split('=');
+ this.append(deserializeParam(attribute[0]), attribute.length > 1 ? deserializeParam(attribute[1]) : '');
+ }
+ }
+ });
+ } // HTMLAnchorElement
+
+ })(typeof commonjsGlobal !== 'undefined' ? commonjsGlobal : typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : commonjsGlobal);
+
+ (function (global) {
+ /**
+ * Polyfill URL
+ *
+ * Inspired from : https://github.com/arv/DOM-URL-Polyfill/blob/master/src/url.js
+ */
+ var checkIfURLIsSupported = function checkIfURLIsSupported() {
+ try {
+ var u = new global.URL('b', 'http://a');
+ u.pathname = 'c d';
+ return u.href === 'http://a/c%20d' && u.searchParams;
+ } catch (e) {
+ return false;
+ }
+ };
+
+ var polyfillURL = function polyfillURL() {
+ var _URL = global.URL;
+
+ var URL = function URL(url, base) {
+ if (typeof url !== 'string') url = String(url); // Only create another document if the base is different from current location.
+
+ var doc = document,
+ baseElement;
+
+ if (base && (global.location === void 0 || base !== global.location.href)) {
+ doc = document.implementation.createHTMLDocument('');
+ baseElement = doc.createElement('base');
+ baseElement.href = base;
+ doc.head.appendChild(baseElement);
+
+ try {
+ if (baseElement.href.indexOf(base) !== 0) throw new Error(baseElement.href);
+ } catch (err) {
+ throw new Error('URL unable to set base ' + base + ' due to ' + err);
+ }
+ }
+
+ var anchorElement = doc.createElement('a');
+ anchorElement.href = url;
+
+ if (baseElement) {
+ doc.body.appendChild(anchorElement);
+ anchorElement.href = anchorElement.href; // force href to refresh
+ }
+
+ var inputElement = doc.createElement('input');
+ inputElement.type = 'url';
+ inputElement.value = url;
+
+ if (anchorElement.protocol === ':' || !/:/.test(anchorElement.href) || !inputElement.checkValidity() && !base) {
+ throw new TypeError('Invalid URL');
+ }
+
+ Object.defineProperty(this, '_anchorElement', {
+ value: anchorElement
+ }); // create a linked searchParams which reflect its changes on URL
+
+ var searchParams = new global.URLSearchParams(this.search);
+ var enableSearchUpdate = true;
+ var enableSearchParamsUpdate = true;
+
+ var _this = this;
+
+ ['append', 'delete', 'set'].forEach(function (methodName) {
+ var method = searchParams[methodName];
+
+ searchParams[methodName] = function () {
+ method.apply(searchParams, arguments);
+
+ if (enableSearchUpdate) {
+ enableSearchParamsUpdate = false;
+ _this.search = searchParams.toString();
+ enableSearchParamsUpdate = true;
+ }
+ };
+ });
+ Object.defineProperty(this, 'searchParams', {
+ value: searchParams,
+ enumerable: true
+ });
+ var search = void 0;
+ Object.defineProperty(this, '_updateSearchParams', {
+ enumerable: false,
+ configurable: false,
+ writable: false,
+ value: function value() {
+ if (this.search !== search) {
+ search = this.search;
+
+ if (enableSearchParamsUpdate) {
+ enableSearchUpdate = false;
+
+ this.searchParams._fromString(this.search);
+
+ enableSearchUpdate = true;
+ }
+ }
+ }
+ });
+ };
+
+ var proto = URL.prototype;
+
+ var linkURLWithAnchorAttribute = function linkURLWithAnchorAttribute(attributeName) {
+ Object.defineProperty(proto, attributeName, {
+ get: function get() {
+ return this._anchorElement[attributeName];
+ },
+ set: function set(value) {
+ this._anchorElement[attributeName] = value;
+ },
+ enumerable: true
+ });
+ };
+
+ ['hash', 'host', 'hostname', 'port', 'protocol'].forEach(function (attributeName) {
+ linkURLWithAnchorAttribute(attributeName);
+ });
+ Object.defineProperty(proto, 'search', {
+ get: function get() {
+ return this._anchorElement['search'];
+ },
+ set: function set(value) {
+ this._anchorElement['search'] = value;
+
+ this._updateSearchParams();
+ },
+ enumerable: true
+ });
+ Object.defineProperties(proto, {
+ 'toString': {
+ get: function get() {
+ var _this = this;
+
+ return function () {
+ return _this.href;
+ };
+ }
+ },
+ 'href': {
+ get: function get() {
+ return this._anchorElement.href.replace(/\?$/, '');
+ },
+ set: function set(value) {
+ this._anchorElement.href = value;
+
+ this._updateSearchParams();
+ },
+ enumerable: true
+ },
+ 'pathname': {
+ get: function get() {
+ return this._anchorElement.pathname.replace(/(^\/?)/, '/');
+ },
+ set: function set(value) {
+ this._anchorElement.pathname = value;
+ },
+ enumerable: true
+ },
+ 'origin': {
+ get: function get() {
+ // get expected port from protocol
+ var expectedPort = {
+ 'http:': 80,
+ 'https:': 443,
+ 'ftp:': 21
+ }[this._anchorElement.protocol]; // add port to origin if, expected port is different than actual port
+ // and it is not empty f.e http://foo:8080
+ // 8080 != 80 && 8080 != ''
+
+ var addPortToOrigin = this._anchorElement.port != expectedPort && this._anchorElement.port !== '';
+ return this._anchorElement.protocol + '//' + this._anchorElement.hostname + (addPortToOrigin ? ':' + this._anchorElement.port : '');
+ },
+ enumerable: true
+ },
+ 'password': {
+ // TODO
+ get: function get() {
+ return '';
+ },
+ set: function set(value) {},
+ enumerable: true
+ },
+ 'username': {
+ // TODO
+ get: function get() {
+ return '';
+ },
+ set: function set(value) {},
+ enumerable: true
+ }
+ });
+
+ URL.createObjectURL = function (blob) {
+ return _URL.createObjectURL.apply(_URL, arguments);
+ };
+
+ URL.revokeObjectURL = function (url) {
+ return _URL.revokeObjectURL.apply(_URL, arguments);
+ };
+
+ global.URL = URL;
+ };
+
+ if (!checkIfURLIsSupported()) {
+ polyfillURL();
+ }
+
+ if (global.location !== void 0 && !('origin' in global.location)) {
+ var getOrigin = function getOrigin() {
+ return global.location.protocol + '//' + global.location.hostname + (global.location.port ? ':' + global.location.port : '');
+ };
+
+ try {
+ Object.defineProperty(global.location, 'origin', {
+ get: getOrigin,
+ enumerable: true
+ });
+ } catch (e) {
+ setInterval(function () {
+ global.location.origin = getOrigin();
+ }, 100);
+ }
+ }
+ })(typeof commonjsGlobal !== 'undefined' ? commonjsGlobal : typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : commonjsGlobal);
+
+ var IS_CONCAT_SPREADABLE = wellKnownSymbol('isConcatSpreadable');
+ var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF;
+ var MAXIMUM_ALLOWED_INDEX_EXCEEDED = 'Maximum allowed index exceeded';
+
+ // We can't use this feature detection in V8 since it causes
+ // deoptimization and serious performance degradation
+ // https://github.com/zloirock/core-js/issues/679
+ var IS_CONCAT_SPREADABLE_SUPPORT = engineV8Version >= 51 || !fails(function () {
+ var array = [];
+ array[IS_CONCAT_SPREADABLE] = false;
+ return array.concat()[0] !== array;
+ });
+
+ var SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('concat');
+
+ var isConcatSpreadable = function (O) {
+ if (!isObject(O)) return false;
+ var spreadable = O[IS_CONCAT_SPREADABLE];
+ return spreadable !== undefined ? !!spreadable : isArray(O);
+ };
+
+ var FORCED = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT;
+
+ // `Array.prototype.concat` method
+ // https://tc39.github.io/ecma262/#sec-array.prototype.concat
+ // with adding support of @@isConcatSpreadable and @@species
+ _export({ target: 'Array', proto: true, forced: FORCED }, {
+ concat: function concat(arg) { // eslint-disable-line no-unused-vars
+ var O = toObject(this);
+ var A = arraySpeciesCreate(O, 0);
+ var n = 0;
+ var i, k, length, len, E;
+ for (i = -1, length = arguments.length; i < length; i++) {
+ E = i === -1 ? O : arguments[i];
+ if (isConcatSpreadable(E)) {
+ len = toLength(E.length);
+ if (n + len > MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
+ for (k = 0; k < len; k++, n++) if (k in E) createProperty(A, n, E[k]);
+ } else {
+ if (n >= MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
+ createProperty(A, n++, E);
+ }
+ }
+ A.length = n;
+ return A;
+ }
+ });
+
+ var $filter = arrayIteration.filter;
+
+
+
+ var HAS_SPECIES_SUPPORT$1 = arrayMethodHasSpeciesSupport('filter');
+ // Edge 14- issue
+ var USES_TO_LENGTH$3 = arrayMethodUsesToLength('filter');
+
+ // `Array.prototype.filter` method
+ // https://tc39.github.io/ecma262/#sec-array.prototype.filter
+ // with adding support of @@species
+ _export({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT$1 || !USES_TO_LENGTH$3 }, {
+ filter: function filter(callbackfn /* , thisArg */) {
+ return $filter(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
+ }
+ });
+
+ var $find = arrayIteration.find;
+
+
+
+ var FIND = 'find';
+ var SKIPS_HOLES = true;
+
+ var USES_TO_LENGTH$4 = arrayMethodUsesToLength(FIND);
+
+ // Shouldn't skip holes
+ if (FIND in []) Array(1)[FIND](function () { SKIPS_HOLES = false; });
+
+ // `Array.prototype.find` method
+ // https://tc39.github.io/ecma262/#sec-array.prototype.find
+ _export({ target: 'Array', proto: true, forced: SKIPS_HOLES || !USES_TO_LENGTH$4 }, {
+ find: function find(callbackfn /* , that = undefined */) {
+ return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
+ }
+ });
+
+ // https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables
+ addToUnscopables(FIND);
+
+ var ITERATOR$7 = wellKnownSymbol('iterator');
+ var SAFE_CLOSING = false;
+
+ try {
+ var called = 0;
+ var iteratorWithReturn = {
+ next: function () {
+ return { done: !!called++ };
+ },
+ 'return': function () {
+ SAFE_CLOSING = true;
+ }
+ };
+ iteratorWithReturn[ITERATOR$7] = function () {
+ return this;
+ };
+ // eslint-disable-next-line no-throw-literal
+ Array.from(iteratorWithReturn, function () { throw 2; });
+ } catch (error) { /* empty */ }
+
+ var checkCorrectnessOfIteration = function (exec, SKIP_CLOSING) {
+ if (!SKIP_CLOSING && !SAFE_CLOSING) return false;
+ var ITERATION_SUPPORT = false;
+ try {
+ var object = {};
+ object[ITERATOR$7] = function () {
+ return {
+ next: function () {
+ return { done: ITERATION_SUPPORT = true };
+ }
+ };
+ };
+ exec(object);
+ } catch (error) { /* empty */ }
+ return ITERATION_SUPPORT;
+ };
+
+ var INCORRECT_ITERATION = !checkCorrectnessOfIteration(function (iterable) {
+ Array.from(iterable);
+ });
+
+ // `Array.from` method
+ // https://tc39.github.io/ecma262/#sec-array.from
+ _export({ target: 'Array', stat: true, forced: INCORRECT_ITERATION }, {
+ from: arrayFrom
+ });
+
+ var $includes = arrayIncludes.includes;
+
+
+
+ var USES_TO_LENGTH$5 = arrayMethodUsesToLength('indexOf', { ACCESSORS: true, 1: 0 });
+
+ // `Array.prototype.includes` method
+ // https://tc39.github.io/ecma262/#sec-array.prototype.includes
+ _export({ target: 'Array', proto: true, forced: !USES_TO_LENGTH$5 }, {
+ includes: function includes(el /* , fromIndex = 0 */) {
+ return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
+ }
+ });
+
+ // https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables
+ addToUnscopables('includes');
+
+ var $map = arrayIteration.map;
+
+
+
+ var HAS_SPECIES_SUPPORT$2 = arrayMethodHasSpeciesSupport('map');
+ // FF49- issue
+ var USES_TO_LENGTH$6 = arrayMethodUsesToLength('map');
+
+ // `Array.prototype.map` method
+ // https://tc39.github.io/ecma262/#sec-array.prototype.map
+ // with adding support of @@species
+ _export({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT$2 || !USES_TO_LENGTH$6 }, {
+ map: function map(callbackfn /* , thisArg */) {
+ return $map(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
+ }
+ });
+
+ // makes subclassing work correct for wrapped built-ins
+ var inheritIfRequired = function ($this, dummy, Wrapper) {
+ var NewTarget, NewTargetPrototype;
+ if (
+ // it can work only with native `setPrototypeOf`
+ objectSetPrototypeOf &&
+ // we haven't completely correct pre-ES6 way for getting `new.target`, so use this
+ typeof (NewTarget = dummy.constructor) == 'function' &&
+ NewTarget !== Wrapper &&
+ isObject(NewTargetPrototype = NewTarget.prototype) &&
+ NewTargetPrototype !== Wrapper.prototype
+ ) objectSetPrototypeOf($this, NewTargetPrototype);
+ return $this;
+ };
+
+ // a string of all valid unicode whitespaces
+ // eslint-disable-next-line max-len
+ var whitespaces = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF';
+
+ var whitespace = '[' + whitespaces + ']';
+ var ltrim = RegExp('^' + whitespace + whitespace + '*');
+ var rtrim = RegExp(whitespace + whitespace + '*$');
+
+ // `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation
+ var createMethod$3 = function (TYPE) {
+ return function ($this) {
+ var string = String(requireObjectCoercible($this));
+ if (TYPE & 1) string = string.replace(ltrim, '');
+ if (TYPE & 2) string = string.replace(rtrim, '');
+ return string;
+ };
+ };
+
+ var stringTrim = {
+ // `String.prototype.{ trimLeft, trimStart }` methods
+ // https://tc39.github.io/ecma262/#sec-string.prototype.trimstart
+ start: createMethod$3(1),
+ // `String.prototype.{ trimRight, trimEnd }` methods
+ // https://tc39.github.io/ecma262/#sec-string.prototype.trimend
+ end: createMethod$3(2),
+ // `String.prototype.trim` method
+ // https://tc39.github.io/ecma262/#sec-string.prototype.trim
+ trim: createMethod$3(3)
+ };
+
+ var getOwnPropertyNames = objectGetOwnPropertyNames.f;
+ var getOwnPropertyDescriptor$2 = objectGetOwnPropertyDescriptor.f;
+ var defineProperty$5 = objectDefineProperty.f;
+ var trim = stringTrim.trim;
+
+ var NUMBER = 'Number';
+ var NativeNumber = global_1[NUMBER];
+ var NumberPrototype = NativeNumber.prototype;
+
+ // Opera ~12 has broken Object#toString
+ var BROKEN_CLASSOF = classofRaw(objectCreate(NumberPrototype)) == NUMBER;
+
+ // `ToNumber` abstract operation
+ // https://tc39.github.io/ecma262/#sec-tonumber
+ var toNumber = function (argument) {
+ var it = toPrimitive(argument, false);
+ var first, third, radix, maxCode, digits, length, index, code;
+ if (typeof it == 'string' && it.length > 2) {
+ it = trim(it);
+ first = it.charCodeAt(0);
+ if (first === 43 || first === 45) {
+ third = it.charCodeAt(2);
+ if (third === 88 || third === 120) return NaN; // Number('+0x1') should be NaN, old V8 fix
+ } else if (first === 48) {
+ switch (it.charCodeAt(1)) {
+ case 66: case 98: radix = 2; maxCode = 49; break; // fast equal of /^0b[01]+$/i
+ case 79: case 111: radix = 8; maxCode = 55; break; // fast equal of /^0o[0-7]+$/i
+ default: return +it;
+ }
+ digits = it.slice(2);
+ length = digits.length;
+ for (index = 0; index < length; index++) {
+ code = digits.charCodeAt(index);
+ // parseInt parses a string to a first unavailable symbol
+ // but ToNumber should return NaN if a string contains unavailable symbols
+ if (code < 48 || code > maxCode) return NaN;
+ } return parseInt(digits, radix);
+ }
+ } return +it;
+ };
+
+ // `Number` constructor
+ // https://tc39.github.io/ecma262/#sec-number-constructor
+ if (isForced_1(NUMBER, !NativeNumber(' 0o1') || !NativeNumber('0b1') || NativeNumber('+0x1'))) {
+ var NumberWrapper = function Number(value) {
+ var it = arguments.length < 1 ? 0 : value;
+ var dummy = this;
+ return dummy instanceof NumberWrapper
+ // check on 1..constructor(foo) case
+ && (BROKEN_CLASSOF ? fails(function () { NumberPrototype.valueOf.call(dummy); }) : classofRaw(dummy) != NUMBER)
+ ? inheritIfRequired(new NativeNumber(toNumber(it)), dummy, NumberWrapper) : toNumber(it);
+ };
+ for (var keys$1 = descriptors ? getOwnPropertyNames(NativeNumber) : (
+ // ES3:
+ 'MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,' +
+ // ES2015 (in case, if modules with ES2015 Number statics required before):
+ 'EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,' +
+ 'MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger'
+ ).split(','), j = 0, key; keys$1.length > j; j++) {
+ if (has(NativeNumber, key = keys$1[j]) && !has(NumberWrapper, key)) {
+ defineProperty$5(NumberWrapper, key, getOwnPropertyDescriptor$2(NativeNumber, key));
+ }
+ }
+ NumberWrapper.prototype = NumberPrototype;
+ NumberPrototype.constructor = NumberWrapper;
+ redefine(global_1, NUMBER, NumberWrapper);
+ }
+
+ var FAILS_ON_PRIMITIVES = fails(function () { objectKeys(1); });
+
+ // `Object.keys` method
+ // https://tc39.github.io/ecma262/#sec-object.keys
+ _export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, {
+ keys: function keys(it) {
+ return objectKeys(toObject(it));
+ }
+ });
+
+ var notARegexp = function (it) {
+ if (isRegexp(it)) {
+ throw TypeError("The method doesn't accept regular expressions");
+ } return it;
+ };
+
+ var MATCH$1 = wellKnownSymbol('match');
+
+ var correctIsRegexpLogic = function (METHOD_NAME) {
+ var regexp = /./;
+ try {
+ '/./'[METHOD_NAME](regexp);
+ } catch (e) {
+ try {
+ regexp[MATCH$1] = false;
+ return '/./'[METHOD_NAME](regexp);
+ } catch (f) { /* empty */ }
+ } return false;
+ };
+
+ // `String.prototype.includes` method
+ // https://tc39.github.io/ecma262/#sec-string.prototype.includes
+ _export({ target: 'String', proto: true, forced: !correctIsRegexpLogic('includes') }, {
+ includes: function includes(searchString /* , position = 0 */) {
+ return !!~String(requireObjectCoercible(this))
+ .indexOf(notARegexp(searchString), arguments.length > 1 ? arguments[1] : undefined);
+ }
+ });
+
+ var freezing = !fails(function () {
+ return Object.isExtensible(Object.preventExtensions({}));
+ });
+
+ var internalMetadata = createCommonjsModule(function (module) {
+ var defineProperty = objectDefineProperty.f;
+
+
+
+ var METADATA = uid('meta');
+ var id = 0;
+
+ var isExtensible = Object.isExtensible || function () {
+ return true;
+ };
+
+ var setMetadata = function (it) {
+ defineProperty(it, METADATA, { value: {
+ objectID: 'O' + ++id, // object ID
+ weakData: {} // weak collections IDs
+ } });
+ };
+
+ var fastKey = function (it, create) {
+ // return a primitive with prefix
+ if (!isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;
+ if (!has(it, METADATA)) {
+ // can't set metadata to uncaught frozen object
+ if (!isExtensible(it)) return 'F';
+ // not necessary to add metadata
+ if (!create) return 'E';
+ // add missing metadata
+ setMetadata(it);
+ // return object ID
+ } return it[METADATA].objectID;
+ };
+
+ var getWeakData = function (it, create) {
+ if (!has(it, METADATA)) {
+ // can't set metadata to uncaught frozen object
+ if (!isExtensible(it)) return true;
+ // not necessary to add metadata
+ if (!create) return false;
+ // add missing metadata
+ setMetadata(it);
+ // return the store of weak collections IDs
+ } return it[METADATA].weakData;
+ };
+
+ // add metadata on freeze-family methods calling
+ var onFreeze = function (it) {
+ if (freezing && meta.REQUIRED && isExtensible(it) && !has(it, METADATA)) setMetadata(it);
+ return it;
+ };
+
+ var meta = module.exports = {
+ REQUIRED: false,
+ fastKey: fastKey,
+ getWeakData: getWeakData,
+ onFreeze: onFreeze
+ };
+
+ hiddenKeys[METADATA] = true;
+ });
+ var internalMetadata_1 = internalMetadata.REQUIRED;
+ var internalMetadata_2 = internalMetadata.fastKey;
+ var internalMetadata_3 = internalMetadata.getWeakData;
+ var internalMetadata_4 = internalMetadata.onFreeze;
+
+ var iterate_1 = createCommonjsModule(function (module) {
+ var Result = function (stopped, result) {
+ this.stopped = stopped;
+ this.result = result;
+ };
+
+ var iterate = module.exports = function (iterable, fn, that, AS_ENTRIES, IS_ITERATOR) {
+ var boundFunction = functionBindContext(fn, that, AS_ENTRIES ? 2 : 1);
+ var iterator, iterFn, index, length, result, next, step;
+
+ if (IS_ITERATOR) {
+ iterator = iterable;
+ } else {
+ iterFn = getIteratorMethod(iterable);
+ if (typeof iterFn != 'function') throw TypeError('Target is not iterable');
+ // optimisation for array iterators
+ if (isArrayIteratorMethod(iterFn)) {
+ for (index = 0, length = toLength(iterable.length); length > index; index++) {
+ result = AS_ENTRIES
+ ? boundFunction(anObject(step = iterable[index])[0], step[1])
+ : boundFunction(iterable[index]);
+ if (result && result instanceof Result) return result;
+ } return new Result(false);
+ }
+ iterator = iterFn.call(iterable);
+ }
+
+ next = iterator.next;
+ while (!(step = next.call(iterator)).done) {
+ result = callWithSafeIterationClosing(iterator, boundFunction, step.value, AS_ENTRIES);
+ if (typeof result == 'object' && result && result instanceof Result) return result;
+ } return new Result(false);
+ };
+
+ iterate.stop = function (result) {
+ return new Result(true, result);
+ };
+ });
+
+ var collection = function (CONSTRUCTOR_NAME, wrapper, common) {
+ var IS_MAP = CONSTRUCTOR_NAME.indexOf('Map') !== -1;
+ var IS_WEAK = CONSTRUCTOR_NAME.indexOf('Weak') !== -1;
+ var ADDER = IS_MAP ? 'set' : 'add';
+ var NativeConstructor = global_1[CONSTRUCTOR_NAME];
+ var NativePrototype = NativeConstructor && NativeConstructor.prototype;
+ var Constructor = NativeConstructor;
+ var exported = {};
+
+ var fixMethod = function (KEY) {
+ var nativeMethod = NativePrototype[KEY];
+ redefine(NativePrototype, KEY,
+ KEY == 'add' ? function add(value) {
+ nativeMethod.call(this, value === 0 ? 0 : value);
+ return this;
+ } : KEY == 'delete' ? function (key) {
+ return IS_WEAK && !isObject(key) ? false : nativeMethod.call(this, key === 0 ? 0 : key);
+ } : KEY == 'get' ? function get(key) {
+ return IS_WEAK && !isObject(key) ? undefined : nativeMethod.call(this, key === 0 ? 0 : key);
+ } : KEY == 'has' ? function has(key) {
+ return IS_WEAK && !isObject(key) ? false : nativeMethod.call(this, key === 0 ? 0 : key);
+ } : function set(key, value) {
+ nativeMethod.call(this, key === 0 ? 0 : key, value);
+ return this;
+ }
+ );
+ };
+
+ // eslint-disable-next-line max-len
+ if (isForced_1(CONSTRUCTOR_NAME, typeof NativeConstructor != 'function' || !(IS_WEAK || NativePrototype.forEach && !fails(function () {
+ new NativeConstructor().entries().next();
+ })))) {
+ // create collection constructor
+ Constructor = common.getConstructor(wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER);
+ internalMetadata.REQUIRED = true;
+ } else if (isForced_1(CONSTRUCTOR_NAME, true)) {
+ var instance = new Constructor();
+ // early implementations not supports chaining
+ var HASNT_CHAINING = instance[ADDER](IS_WEAK ? {} : -0, 1) != instance;
+ // V8 ~ Chromium 40- weak-collections throws on primitives, but should return false
+ var THROWS_ON_PRIMITIVES = fails(function () { instance.has(1); });
+ // most early implementations doesn't supports iterables, most modern - not close it correctly
+ // eslint-disable-next-line no-new
+ var ACCEPT_ITERABLES = checkCorrectnessOfIteration(function (iterable) { new NativeConstructor(iterable); });
+ // for early implementations -0 and +0 not the same
+ var BUGGY_ZERO = !IS_WEAK && fails(function () {
+ // V8 ~ Chromium 42- fails only with 5+ elements
+ var $instance = new NativeConstructor();
+ var index = 5;
+ while (index--) $instance[ADDER](index, index);
+ return !$instance.has(-0);
+ });
+
+ if (!ACCEPT_ITERABLES) {
+ Constructor = wrapper(function (dummy, iterable) {
+ anInstance(dummy, Constructor, CONSTRUCTOR_NAME);
+ var that = inheritIfRequired(new NativeConstructor(), dummy, Constructor);
+ if (iterable != undefined) iterate_1(iterable, that[ADDER], that, IS_MAP);
+ return that;
+ });
+ Constructor.prototype = NativePrototype;
+ NativePrototype.constructor = Constructor;
+ }
+
+ if (THROWS_ON_PRIMITIVES || BUGGY_ZERO) {
+ fixMethod('delete');
+ fixMethod('has');
+ IS_MAP && fixMethod('get');
+ }
+
+ if (BUGGY_ZERO || HASNT_CHAINING) fixMethod(ADDER);
+
+ // weak collections should not contains .clear method
+ if (IS_WEAK && NativePrototype.clear) delete NativePrototype.clear;
+ }
+
+ exported[CONSTRUCTOR_NAME] = Constructor;
+ _export({ global: true, forced: Constructor != NativeConstructor }, exported);
+
+ setToStringTag(Constructor, CONSTRUCTOR_NAME);
+
+ if (!IS_WEAK) common.setStrong(Constructor, CONSTRUCTOR_NAME, IS_MAP);
+
+ return Constructor;
+ };
+
+ var getWeakData = internalMetadata.getWeakData;
+
+
+
+
+
+
+
+
+ var setInternalState$5 = internalState.set;
+ var internalStateGetterFor = internalState.getterFor;
+ var find$1 = arrayIteration.find;
+ var findIndex = arrayIteration.findIndex;
+ var id$1 = 0;
+
+ // fallback for uncaught frozen keys
+ var uncaughtFrozenStore = function (store) {
+ return store.frozen || (store.frozen = new UncaughtFrozenStore());
+ };
+
+ var UncaughtFrozenStore = function () {
+ this.entries = [];
+ };
+
+ var findUncaughtFrozen = function (store, key) {
+ return find$1(store.entries, function (it) {
+ return it[0] === key;
+ });
+ };
+
+ UncaughtFrozenStore.prototype = {
+ get: function (key) {
+ var entry = findUncaughtFrozen(this, key);
+ if (entry) return entry[1];
+ },
+ has: function (key) {
+ return !!findUncaughtFrozen(this, key);
+ },
+ set: function (key, value) {
+ var entry = findUncaughtFrozen(this, key);
+ if (entry) entry[1] = value;
+ else this.entries.push([key, value]);
+ },
+ 'delete': function (key) {
+ var index = findIndex(this.entries, function (it) {
+ return it[0] === key;
+ });
+ if (~index) this.entries.splice(index, 1);
+ return !!~index;
+ }
+ };
+
+ var collectionWeak = {
+ getConstructor: function (wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER) {
+ var C = wrapper(function (that, iterable) {
+ anInstance(that, C, CONSTRUCTOR_NAME);
+ setInternalState$5(that, {
+ type: CONSTRUCTOR_NAME,
+ id: id$1++,
+ frozen: undefined
+ });
+ if (iterable != undefined) iterate_1(iterable, that[ADDER], that, IS_MAP);
+ });
+
+ var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME);
+
+ var define = function (that, key, value) {
+ var state = getInternalState(that);
+ var data = getWeakData(anObject(key), true);
+ if (data === true) uncaughtFrozenStore(state).set(key, value);
+ else data[state.id] = value;
+ return that;
+ };
+
+ redefineAll(C.prototype, {
+ // 23.3.3.2 WeakMap.prototype.delete(key)
+ // 23.4.3.3 WeakSet.prototype.delete(value)
+ 'delete': function (key) {
+ var state = getInternalState(this);
+ if (!isObject(key)) return false;
+ var data = getWeakData(key);
+ if (data === true) return uncaughtFrozenStore(state)['delete'](key);
+ return data && has(data, state.id) && delete data[state.id];
+ },
+ // 23.3.3.4 WeakMap.prototype.has(key)
+ // 23.4.3.4 WeakSet.prototype.has(value)
+ has: function has$1(key) {
+ var state = getInternalState(this);
+ if (!isObject(key)) return false;
+ var data = getWeakData(key);
+ if (data === true) return uncaughtFrozenStore(state).has(key);
+ return data && has(data, state.id);
+ }
+ });
+
+ redefineAll(C.prototype, IS_MAP ? {
+ // 23.3.3.3 WeakMap.prototype.get(key)
+ get: function get(key) {
+ var state = getInternalState(this);
+ if (isObject(key)) {
+ var data = getWeakData(key);
+ if (data === true) return uncaughtFrozenStore(state).get(key);
+ return data ? data[state.id] : undefined;
+ }
+ },
+ // 23.3.3.5 WeakMap.prototype.set(key, value)
+ set: function set(key, value) {
+ return define(this, key, value);
+ }
+ } : {
+ // 23.4.3.1 WeakSet.prototype.add(value)
+ add: function add(value) {
+ return define(this, value, true);
+ }
+ });
+
+ return C;
+ }
+ };
+
+ var es_weakMap = createCommonjsModule(function (module) {
+
+
+
+
+
+
+ var enforceIternalState = internalState.enforce;
+
+
+ var IS_IE11 = !global_1.ActiveXObject && 'ActiveXObject' in global_1;
+ var isExtensible = Object.isExtensible;
+ var InternalWeakMap;
+
+ var wrapper = function (init) {
+ return function WeakMap() {
+ return init(this, arguments.length ? arguments[0] : undefined);
+ };
+ };
+
+ // `WeakMap` constructor
+ // https://tc39.github.io/ecma262/#sec-weakmap-constructor
+ var $WeakMap = module.exports = collection('WeakMap', wrapper, collectionWeak);
+
+ // IE11 WeakMap frozen keys fix
+ // We can't use feature detection because it crash some old IE builds
+ // https://github.com/zloirock/core-js/issues/485
+ if (nativeWeakMap && IS_IE11) {
+ InternalWeakMap = collectionWeak.getConstructor(wrapper, 'WeakMap', true);
+ internalMetadata.REQUIRED = true;
+ var WeakMapPrototype = $WeakMap.prototype;
+ var nativeDelete = WeakMapPrototype['delete'];
+ var nativeHas = WeakMapPrototype.has;
+ var nativeGet = WeakMapPrototype.get;
+ var nativeSet = WeakMapPrototype.set;
+ redefineAll(WeakMapPrototype, {
+ 'delete': function (key) {
+ if (isObject(key) && !isExtensible(key)) {
+ var state = enforceIternalState(this);
+ if (!state.frozen) state.frozen = new InternalWeakMap();
+ return nativeDelete.call(this, key) || state.frozen['delete'](key);
+ } return nativeDelete.call(this, key);
+ },
+ has: function has(key) {
+ if (isObject(key) && !isExtensible(key)) {
+ var state = enforceIternalState(this);
+ if (!state.frozen) state.frozen = new InternalWeakMap();
+ return nativeHas.call(this, key) || state.frozen.has(key);
+ } return nativeHas.call(this, key);
+ },
+ get: function get(key) {
+ if (isObject(key) && !isExtensible(key)) {
+ var state = enforceIternalState(this);
+ if (!state.frozen) state.frozen = new InternalWeakMap();
+ return nativeHas.call(this, key) ? nativeGet.call(this, key) : state.frozen.get(key);
+ } return nativeGet.call(this, key);
+ },
+ set: function set(key, value) {
+ if (isObject(key) && !isExtensible(key)) {
+ var state = enforceIternalState(this);
+ if (!state.frozen) state.frozen = new InternalWeakMap();
+ nativeHas.call(this, key) ? nativeSet.call(this, key, value) : state.frozen.set(key, value);
+ } else nativeSet.call(this, key, value);
+ return this;
+ }
+ });
+ }
+ });
+
+ var $every = arrayIteration.every;
+
+
+
+ var STRICT_METHOD$3 = arrayMethodIsStrict('every');
+ var USES_TO_LENGTH$7 = arrayMethodUsesToLength('every');
+
+ // `Array.prototype.every` method
+ // https://tc39.github.io/ecma262/#sec-array.prototype.every
+ _export({ target: 'Array', proto: true, forced: !STRICT_METHOD$3 || !USES_TO_LENGTH$7 }, {
+ every: function every(callbackfn /* , thisArg */) {
+ return $every(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
+ }
+ });
+
+ // `Object.assign` method
+ // https://tc39.github.io/ecma262/#sec-object.assign
+ _export({ target: 'Object', stat: true, forced: Object.assign !== objectAssign }, {
+ assign: objectAssign
+ });
+
+ var non = '\u200B\u0085\u180E';
+
+ // check that a method works with the correct list
+ // of whitespaces and has a correct name
+ var stringTrimForced = function (METHOD_NAME) {
+ return fails(function () {
+ return !!whitespaces[METHOD_NAME]() || non[METHOD_NAME]() != non || whitespaces[METHOD_NAME].name !== METHOD_NAME;
+ });
+ };
+
+ var $trim = stringTrim.trim;
+
+
+ // `String.prototype.trim` method
+ // https://tc39.github.io/ecma262/#sec-string.prototype.trim
+ _export({ target: 'String', proto: true, forced: stringTrimForced('trim') }, {
+ trim: function trim() {
+ return $trim(this);
+ }
+ });
+
+ var $some = arrayIteration.some;
+
+
+
+ var STRICT_METHOD$4 = arrayMethodIsStrict('some');
+ var USES_TO_LENGTH$8 = arrayMethodUsesToLength('some');
+
+ // `Array.prototype.some` method
+ // https://tc39.github.io/ecma262/#sec-array.prototype.some
+ _export({ target: 'Array', proto: true, forced: !STRICT_METHOD$4 || !USES_TO_LENGTH$8 }, {
+ some: function some(callbackfn /* , thisArg */) {
+ return $some(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
+ }
+ });
+
+ // `thisNumberValue` abstract operation
+ // https://tc39.github.io/ecma262/#sec-thisnumbervalue
+ var thisNumberValue = function (value) {
+ if (typeof value != 'number' && classofRaw(value) != 'Number') {
+ throw TypeError('Incorrect invocation');
+ }
+ return +value;
+ };
+
+ // `String.prototype.repeat` method implementation
+ // https://tc39.github.io/ecma262/#sec-string.prototype.repeat
+ var stringRepeat = ''.repeat || function repeat(count) {
+ var str = String(requireObjectCoercible(this));
+ var result = '';
+ var n = toInteger(count);
+ if (n < 0 || n == Infinity) throw RangeError('Wrong number of repetitions');
+ for (;n > 0; (n >>>= 1) && (str += str)) if (n & 1) result += str;
+ return result;
+ };
+
+ var nativeToFixed = 1.0.toFixed;
+ var floor$4 = Math.floor;
+
+ var pow$1 = function (x, n, acc) {
+ return n === 0 ? acc : n % 2 === 1 ? pow$1(x, n - 1, acc * x) : pow$1(x * x, n / 2, acc);
+ };
+
+ var log = function (x) {
+ var n = 0;
+ var x2 = x;
+ while (x2 >= 4096) {
+ n += 12;
+ x2 /= 4096;
+ }
+ while (x2 >= 2) {
+ n += 1;
+ x2 /= 2;
+ } return n;
+ };
+
+ var FORCED$1 = nativeToFixed && (
+ 0.00008.toFixed(3) !== '0.000' ||
+ 0.9.toFixed(0) !== '1' ||
+ 1.255.toFixed(2) !== '1.25' ||
+ 1000000000000000128.0.toFixed(0) !== '1000000000000000128'
+ ) || !fails(function () {
+ // V8 ~ Android 4.3-
+ nativeToFixed.call({});
+ });
+
+ // `Number.prototype.toFixed` method
+ // https://tc39.github.io/ecma262/#sec-number.prototype.tofixed
+ _export({ target: 'Number', proto: true, forced: FORCED$1 }, {
+ // eslint-disable-next-line max-statements
+ toFixed: function toFixed(fractionDigits) {
+ var number = thisNumberValue(this);
+ var fractDigits = toInteger(fractionDigits);
+ var data = [0, 0, 0, 0, 0, 0];
+ var sign = '';
+ var result = '0';
+ var e, z, j, k;
+
+ var multiply = function (n, c) {
+ var index = -1;
+ var c2 = c;
+ while (++index < 6) {
+ c2 += n * data[index];
+ data[index] = c2 % 1e7;
+ c2 = floor$4(c2 / 1e7);
+ }
+ };
+
+ var divide = function (n) {
+ var index = 6;
+ var c = 0;
+ while (--index >= 0) {
+ c += data[index];
+ data[index] = floor$4(c / n);
+ c = (c % n) * 1e7;
+ }
+ };
+
+ var dataToString = function () {
+ var index = 6;
+ var s = '';
+ while (--index >= 0) {
+ if (s !== '' || index === 0 || data[index] !== 0) {
+ var t = String(data[index]);
+ s = s === '' ? t : s + stringRepeat.call('0', 7 - t.length) + t;
+ }
+ } return s;
+ };
+
+ if (fractDigits < 0 || fractDigits > 20) throw RangeError('Incorrect fraction digits');
+ // eslint-disable-next-line no-self-compare
+ if (number != number) return 'NaN';
+ if (number <= -1e21 || number >= 1e21) return String(number);
+ if (number < 0) {
+ sign = '-';
+ number = -number;
+ }
+ if (number > 1e-21) {
+ e = log(number * pow$1(2, 69, 1)) - 69;
+ z = e < 0 ? number * pow$1(2, -e, 1) : number / pow$1(2, e, 1);
+ z *= 0x10000000000000;
+ e = 52 - e;
+ if (e > 0) {
+ multiply(0, z);
+ j = fractDigits;
+ while (j >= 7) {
+ multiply(1e7, 0);
+ j -= 7;
+ }
+ multiply(pow$1(10, j, 1), 0);
+ j = e - 1;
+ while (j >= 23) {
+ divide(1 << 23);
+ j -= 23;
+ }
+ divide(1 << j);
+ multiply(1, 1);
+ divide(2);
+ result = dataToString();
+ } else {
+ multiply(0, z);
+ multiply(1 << -e, 0);
+ result = dataToString() + stringRepeat.call('0', fractDigits);
+ }
+ }
+ if (fractDigits > 0) {
+ k = result.length;
+ result = sign + (k <= fractDigits
+ ? '0.' + stringRepeat.call('0', fractDigits - k) + result
+ : result.slice(0, k - fractDigits) + '.' + result.slice(k - fractDigits));
+ } else {
+ result = sign + result;
+ } return result;
+ }
+ });
+
+ var propertyIsEnumerable = objectPropertyIsEnumerable.f;
+
+ // `Object.{ entries, values }` methods implementation
+ var createMethod$4 = function (TO_ENTRIES) {
+ return function (it) {
+ var O = toIndexedObject(it);
+ var keys = objectKeys(O);
+ var length = keys.length;
+ var i = 0;
+ var result = [];
+ var key;
+ while (length > i) {
+ key = keys[i++];
+ if (!descriptors || propertyIsEnumerable.call(O, key)) {
+ result.push(TO_ENTRIES ? [key, O[key]] : O[key]);
+ }
+ }
+ return result;
+ };
+ };
+
+ var objectToArray = {
+ // `Object.entries` method
+ // https://tc39.github.io/ecma262/#sec-object.entries
+ entries: createMethod$4(true),
+ // `Object.values` method
+ // https://tc39.github.io/ecma262/#sec-object.values
+ values: createMethod$4(false)
+ };
+
+ var $entries = objectToArray.entries;
+
+ // `Object.entries` method
+ // https://tc39.github.io/ecma262/#sec-object.entries
+ _export({ target: 'Object', stat: true }, {
+ entries: function entries(O) {
+ return $entries(O);
+ }
+ });
+
+ var $values = objectToArray.values;
+
+ // `Object.values` method
+ // https://tc39.github.io/ecma262/#sec-object.values
+ _export({ target: 'Object', stat: true }, {
+ values: function values(O) {
+ return $values(O);
+ }
+ });
+
+ // `Number.isNaN` method
+ // https://tc39.github.io/ecma262/#sec-number.isnan
+ _export({ target: 'Number', stat: true }, {
+ isNaN: function isNaN(number) {
+ // eslint-disable-next-line no-self-compare
+ return number != number;
+ }
+ });
+
+ var nativeGetOwnPropertyDescriptor$2 = objectGetOwnPropertyDescriptor.f;
+
+
+ var FAILS_ON_PRIMITIVES$1 = fails(function () { nativeGetOwnPropertyDescriptor$2(1); });
+ var FORCED$2 = !descriptors || FAILS_ON_PRIMITIVES$1;
+
+ // `Object.getOwnPropertyDescriptor` method
+ // https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptor
+ _export({ target: 'Object', stat: true, forced: FORCED$2, sham: !descriptors }, {
+ getOwnPropertyDescriptor: function getOwnPropertyDescriptor(it, key) {
+ return nativeGetOwnPropertyDescriptor$2(toIndexedObject(it), key);
+ }
+ });
+
+ // `Object.getOwnPropertyDescriptors` method
+ // https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptors
+ _export({ target: 'Object', stat: true, sham: !descriptors }, {
+ getOwnPropertyDescriptors: function getOwnPropertyDescriptors(object) {
+ var O = toIndexedObject(object);
+ var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
+ var keys = ownKeys(O);
+ var result = {};
+ var index = 0;
+ var key, descriptor;
+ while (keys.length > index) {
+ descriptor = getOwnPropertyDescriptor(O, key = keys[index++]);
+ if (descriptor !== undefined) createProperty(result, key, descriptor);
+ }
+ return result;
+ }
+ });
+
+ // @@match logic
+ fixRegexpWellKnownSymbolLogic('match', 1, function (MATCH, nativeMatch, maybeCallNative) {
+ return [
+ // `String.prototype.match` method
+ // https://tc39.github.io/ecma262/#sec-string.prototype.match
+ function match(regexp) {
+ var O = requireObjectCoercible(this);
+ var matcher = regexp == undefined ? undefined : regexp[MATCH];
+ return matcher !== undefined ? matcher.call(regexp, O) : new RegExp(regexp)[MATCH](String(O));
+ },
+ // `RegExp.prototype[@@match]` method
+ // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@match
+ function (regexp) {
+ var res = maybeCallNative(nativeMatch, regexp, this);
+ if (res.done) return res.value;
+
+ var rx = anObject(regexp);
+ var S = String(this);
+
+ if (!rx.global) return regexpExecAbstract(rx, S);
+
+ var fullUnicode = rx.unicode;
+ rx.lastIndex = 0;
+ var A = [];
+ var n = 0;
+ var result;
+ while ((result = regexpExecAbstract(rx, S)) !== null) {
+ var matchStr = String(result[0]);
+ A[n] = matchStr;
+ if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
+ n++;
+ }
+ return n === 0 ? null : A;
+ }
+ ];
+ });
+
+ function _classCallCheck$1(e, t) {
+ if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function");
+ }
+
+ function _defineProperties$1(e, t) {
+ for (var n = 0; n < t.length; n++) {
+ var r = t[n];
+ r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r);
+ }
+ }
+
+ function _createClass$1(e, t, n) {
+ return t && _defineProperties$1(e.prototype, t), n && _defineProperties$1(e, n), e;
+ }
+
+ function _defineProperty$1(e, t, n) {
+ return t in e ? Object.defineProperty(e, t, {
+ value: n,
+ enumerable: !0,
+ configurable: !0,
+ writable: !0
+ }) : e[t] = n, e;
+ }
+
+ function ownKeys$2(e, t) {
+ var n = Object.keys(e);
+
+ if (Object.getOwnPropertySymbols) {
+ var r = Object.getOwnPropertySymbols(e);
+ t && (r = r.filter(function (t) {
+ return Object.getOwnPropertyDescriptor(e, t).enumerable;
+ })), n.push.apply(n, r);
+ }
+
+ return n;
+ }
+
+ function _objectSpread2$1(e) {
+ for (var t = 1; t < arguments.length; t++) {
+ var n = null != arguments[t] ? arguments[t] : {};
+ t % 2 ? ownKeys$2(Object(n), !0).forEach(function (t) {
+ _defineProperty$1(e, t, n[t]);
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : ownKeys$2(Object(n)).forEach(function (t) {
+ Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(n, t));
+ });
+ }
+
+ return e;
+ }
+
+ var defaults = {
+ addCSS: !0,
+ thumbWidth: 15,
+ watch: !0
+ };
+
+ function matches(e, t) {
+ return function () {
+ return Array.from(document.querySelectorAll(t)).includes(this);
+ }.call(e, t);
+ }
+
+ function trigger(e, t) {
+ if (e && t) {
+ var n = new Event(t, {
+ bubbles: !0
+ });
+ e.dispatchEvent(n);
+ }
+ }
+
+ var getConstructor = function getConstructor(e) {
+ return null != e ? e.constructor : null;
+ },
+ instanceOf = function instanceOf(e, t) {
+ return !!(e && t && e instanceof t);
+ },
+ isNullOrUndefined = function isNullOrUndefined(e) {
+ return null == e;
+ },
+ isObject$1 = function isObject(e) {
+ return getConstructor(e) === Object;
+ },
+ isNumber = function isNumber(e) {
+ return getConstructor(e) === Number && !Number.isNaN(e);
+ },
+ isString = function isString(e) {
+ return getConstructor(e) === String;
+ },
+ isBoolean = function isBoolean(e) {
+ return getConstructor(e) === Boolean;
+ },
+ isFunction = function isFunction(e) {
+ return getConstructor(e) === Function;
+ },
+ isArray$1 = function isArray(e) {
+ return Array.isArray(e);
+ },
+ isNodeList = function isNodeList(e) {
+ return instanceOf(e, NodeList);
+ },
+ isElement = function isElement(e) {
+ return instanceOf(e, Element);
+ },
+ isEvent = function isEvent(e) {
+ return instanceOf(e, Event);
+ },
+ isEmpty = function isEmpty(e) {
+ return isNullOrUndefined(e) || (isString(e) || isArray$1(e) || isNodeList(e)) && !e.length || isObject$1(e) && !Object.keys(e).length;
+ },
+ is = {
+ nullOrUndefined: isNullOrUndefined,
+ object: isObject$1,
+ number: isNumber,
+ string: isString,
+ boolean: isBoolean,
+ function: isFunction,
+ array: isArray$1,
+ nodeList: isNodeList,
+ element: isElement,
+ event: isEvent,
+ empty: isEmpty
+ };
+
+ function getDecimalPlaces(e) {
+ var t = "".concat(e).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);
+ return t ? Math.max(0, (t[1] ? t[1].length : 0) - (t[2] ? +t[2] : 0)) : 0;
+ }
+
+ function round(e, t) {
+ if (1 > t) {
+ var n = getDecimalPlaces(t);
+ return parseFloat(e.toFixed(n));
+ }
+
+ return Math.round(e / t) * t;
+ }
+
+ var RangeTouch = function () {
+ function e(t, n) {
+ _classCallCheck$1(this, e), is.element(t) ? this.element = t : is.string(t) && (this.element = document.querySelector(t)), is.element(this.element) && is.empty(this.element.rangeTouch) && (this.config = _objectSpread2$1({}, defaults, {}, n), this.init());
+ }
+
+ return _createClass$1(e, [{
+ key: "init",
+ value: function value() {
+ e.enabled && (this.config.addCSS && (this.element.style.userSelect = "none", this.element.style.webKitUserSelect = "none", this.element.style.touchAction = "manipulation"), this.listeners(!0), this.element.rangeTouch = this);
+ }
+ }, {
+ key: "destroy",
+ value: function value() {
+ e.enabled && (this.config.addCSS && (this.element.style.userSelect = "", this.element.style.webKitUserSelect = "", this.element.style.touchAction = ""), this.listeners(!1), this.element.rangeTouch = null);
+ }
+ }, {
+ key: "listeners",
+ value: function value(e) {
+ var t = this,
+ n = e ? "addEventListener" : "removeEventListener";
+ ["touchstart", "touchmove", "touchend"].forEach(function (e) {
+ t.element[n](e, function (e) {
+ return t.set(e);
+ }, !1);
+ });
+ }
+ }, {
+ key: "get",
+ value: function value(t) {
+ if (!e.enabled || !is.event(t)) return null;
+ var n,
+ r = t.target,
+ i = t.changedTouches[0],
+ o = parseFloat(r.getAttribute("min")) || 0,
+ s = parseFloat(r.getAttribute("max")) || 100,
+ u = parseFloat(r.getAttribute("step")) || 1,
+ c = r.getBoundingClientRect(),
+ a = 100 / c.width * (this.config.thumbWidth / 2) / 100;
+ return 0 > (n = 100 / c.width * (i.clientX - c.left)) ? n = 0 : 100 < n && (n = 100), 50 > n ? n -= (100 - 2 * n) * a : 50 < n && (n += 2 * (n - 50) * a), o + round(n / 100 * (s - o), u);
+ }
+ }, {
+ key: "set",
+ value: function value(t) {
+ e.enabled && is.event(t) && !t.target.disabled && (t.preventDefault(), t.target.value = this.get(t), trigger(t.target, "touchend" === t.type ? "change" : "input"));
+ }
+ }], [{
+ key: "setup",
+ value: function value(t) {
+ var n = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : {},
+ r = null;
+ if (is.empty(t) || is.string(t) ? r = Array.from(document.querySelectorAll(is.string(t) ? t : 'input[type="range"]')) : is.element(t) ? r = [t] : is.nodeList(t) ? r = Array.from(t) : is.array(t) && (r = t.filter(is.element)), is.empty(r)) return null;
+
+ var i = _objectSpread2$1({}, defaults, {}, n);
+
+ if (is.string(t) && i.watch) {
+ var o = new MutationObserver(function (n) {
+ Array.from(n).forEach(function (n) {
+ Array.from(n.addedNodes).forEach(function (n) {
+ is.element(n) && matches(n, t) && new e(n, i);
+ });
+ });
+ });
+ o.observe(document.body, {
+ childList: !0,
+ subtree: !0
+ });
+ }
+
+ return r.map(function (t) {
+ return new e(t, n);
+ });
+ }
+ }, {
+ key: "enabled",
+ get: function get() {
+ return "ontouchstart" in document.documentElement;
+ }
+ }]), e;
+ }();
+
+ var nativePromiseConstructor = global_1.Promise;
+
+ var SPECIES$5 = wellKnownSymbol('species');
+
+ var setSpecies = function (CONSTRUCTOR_NAME) {
+ var Constructor = getBuiltIn(CONSTRUCTOR_NAME);
+ var defineProperty = objectDefineProperty.f;
+
+ if (descriptors && Constructor && !Constructor[SPECIES$5]) {
+ defineProperty(Constructor, SPECIES$5, {
+ configurable: true,
+ get: function () { return this; }
+ });
+ }
+ };
+
+ var engineIsIos = /(iphone|ipod|ipad).*applewebkit/i.test(engineUserAgent);
+
+ var location = global_1.location;
+ var set$1 = global_1.setImmediate;
+ var clear = global_1.clearImmediate;
+ var process$1 = global_1.process;
+ var MessageChannel = global_1.MessageChannel;
+ var Dispatch = global_1.Dispatch;
+ var counter = 0;
+ var queue = {};
+ var ONREADYSTATECHANGE = 'onreadystatechange';
+ var defer, channel, port;
+
+ var run = function (id) {
+ // eslint-disable-next-line no-prototype-builtins
+ if (queue.hasOwnProperty(id)) {
+ var fn = queue[id];
+ delete queue[id];
+ fn();
+ }
+ };
+
+ var runner = function (id) {
+ return function () {
+ run(id);
+ };
+ };
+
+ var listener = function (event) {
+ run(event.data);
+ };
+
+ var post = function (id) {
+ // old engines have not location.origin
+ global_1.postMessage(id + '', location.protocol + '//' + location.host);
+ };
+
+ // Node.js 0.9+ & IE10+ has setImmediate, otherwise:
+ if (!set$1 || !clear) {
+ set$1 = function setImmediate(fn) {
+ var args = [];
+ var i = 1;
+ while (arguments.length > i) args.push(arguments[i++]);
+ queue[++counter] = function () {
+ // eslint-disable-next-line no-new-func
+ (typeof fn == 'function' ? fn : Function(fn)).apply(undefined, args);
+ };
+ defer(counter);
+ return counter;
+ };
+ clear = function clearImmediate(id) {
+ delete queue[id];
+ };
+ // Node.js 0.8-
+ if (classofRaw(process$1) == 'process') {
+ defer = function (id) {
+ process$1.nextTick(runner(id));
+ };
+ // Sphere (JS game engine) Dispatch API
+ } else if (Dispatch && Dispatch.now) {
+ defer = function (id) {
+ Dispatch.now(runner(id));
+ };
+ // Browsers with MessageChannel, includes WebWorkers
+ // except iOS - https://github.com/zloirock/core-js/issues/624
+ } else if (MessageChannel && !engineIsIos) {
+ channel = new MessageChannel();
+ port = channel.port2;
+ channel.port1.onmessage = listener;
+ defer = functionBindContext(port.postMessage, port, 1);
+ // Browsers with postMessage, skip WebWorkers
+ // IE8 has postMessage, but it's sync & typeof its postMessage is 'object'
+ } else if (
+ global_1.addEventListener &&
+ typeof postMessage == 'function' &&
+ !global_1.importScripts &&
+ !fails(post) &&
+ location.protocol !== 'file:'
+ ) {
+ defer = post;
+ global_1.addEventListener('message', listener, false);
+ // IE8-
+ } else if (ONREADYSTATECHANGE in documentCreateElement('script')) {
+ defer = function (id) {
+ html.appendChild(documentCreateElement('script'))[ONREADYSTATECHANGE] = function () {
+ html.removeChild(this);
+ run(id);
+ };
+ };
+ // Rest old browsers
+ } else {
+ defer = function (id) {
+ setTimeout(runner(id), 0);
+ };
+ }
+ }
+
+ var task = {
+ set: set$1,
+ clear: clear
+ };
+
+ var getOwnPropertyDescriptor$3 = objectGetOwnPropertyDescriptor.f;
+
+ var macrotask = task.set;
+
+
+ var MutationObserver$1 = global_1.MutationObserver || global_1.WebKitMutationObserver;
+ var process$2 = global_1.process;
+ var Promise$1 = global_1.Promise;
+ var IS_NODE = classofRaw(process$2) == 'process';
+ // Node.js 11 shows ExperimentalWarning on getting `queueMicrotask`
+ var queueMicrotaskDescriptor = getOwnPropertyDescriptor$3(global_1, 'queueMicrotask');
+ var queueMicrotask = queueMicrotaskDescriptor && queueMicrotaskDescriptor.value;
+
+ var flush, head, last, notify, toggle, node, promise, then;
+
+ // modern engines have queueMicrotask method
+ if (!queueMicrotask) {
+ flush = function () {
+ var parent, fn;
+ if (IS_NODE && (parent = process$2.domain)) parent.exit();
+ while (head) {
+ fn = head.fn;
+ head = head.next;
+ try {
+ fn();
+ } catch (error) {
+ if (head) notify();
+ else last = undefined;
+ throw error;
+ }
+ } last = undefined;
+ if (parent) parent.enter();
+ };
+
+ // Node.js
+ if (IS_NODE) {
+ notify = function () {
+ process$2.nextTick(flush);
+ };
+ // browsers with MutationObserver, except iOS - https://github.com/zloirock/core-js/issues/339
+ } else if (MutationObserver$1 && !engineIsIos) {
+ toggle = true;
+ node = document.createTextNode('');
+ new MutationObserver$1(flush).observe(node, { characterData: true });
+ notify = function () {
+ node.data = toggle = !toggle;
+ };
+ // environments with maybe non-completely correct, but existent Promise
+ } else if (Promise$1 && Promise$1.resolve) {
+ // Promise.resolve without an argument throws an error in LG WebOS 2
+ promise = Promise$1.resolve(undefined);
+ then = promise.then;
+ notify = function () {
+ then.call(promise, flush);
+ };
+ // for other environments - macrotask based on:
+ // - setImmediate
+ // - MessageChannel
+ // - window.postMessag
+ // - onreadystatechange
+ // - setTimeout
+ } else {
+ notify = function () {
+ // strange IE + webpack dev server bug - use .call(global)
+ macrotask.call(global_1, flush);
+ };
+ }
+ }
+
+ var microtask = queueMicrotask || function (fn) {
+ var task = { fn: fn, next: undefined };
+ if (last) last.next = task;
+ if (!head) {
+ head = task;
+ notify();
+ } last = task;
+ };
+
+ var PromiseCapability = function (C) {
+ var resolve, reject;
+ this.promise = new C(function ($$resolve, $$reject) {
+ if (resolve !== undefined || reject !== undefined) throw TypeError('Bad Promise constructor');
+ resolve = $$resolve;
+ reject = $$reject;
+ });
+ this.resolve = aFunction$1(resolve);
+ this.reject = aFunction$1(reject);
+ };
+
+ // 25.4.1.5 NewPromiseCapability(C)
+ var f$7 = function (C) {
+ return new PromiseCapability(C);
+ };
+
+ var newPromiseCapability = {
+ f: f$7
+ };
+
+ var promiseResolve = function (C, x) {
+ anObject(C);
+ if (isObject(x) && x.constructor === C) return x;
+ var promiseCapability = newPromiseCapability.f(C);
+ var resolve = promiseCapability.resolve;
+ resolve(x);
+ return promiseCapability.promise;
+ };
+
+ var hostReportErrors = function (a, b) {
+ var console = global_1.console;
+ if (console && console.error) {
+ arguments.length === 1 ? console.error(a) : console.error(a, b);
+ }
+ };
+
+ var perform = function (exec) {
+ try {
+ return { error: false, value: exec() };
+ } catch (error) {
+ return { error: true, value: error };
+ }
+ };
+
+ var task$1 = task.set;
+
+
+
+
+
+
+
+
+
+
+ var SPECIES$6 = wellKnownSymbol('species');
+ var PROMISE = 'Promise';
+ var getInternalState$3 = internalState.get;
+ var setInternalState$6 = internalState.set;
+ var getInternalPromiseState = internalState.getterFor(PROMISE);
+ var PromiseConstructor = nativePromiseConstructor;
+ var TypeError$1 = global_1.TypeError;
+ var document$2 = global_1.document;
+ var process$3 = global_1.process;
+ var $fetch$1 = getBuiltIn('fetch');
+ var newPromiseCapability$1 = newPromiseCapability.f;
+ var newGenericPromiseCapability = newPromiseCapability$1;
+ var IS_NODE$1 = classofRaw(process$3) == 'process';
+ var DISPATCH_EVENT = !!(document$2 && document$2.createEvent && global_1.dispatchEvent);
+ var UNHANDLED_REJECTION = 'unhandledrejection';
+ var REJECTION_HANDLED = 'rejectionhandled';
+ var PENDING = 0;
+ var FULFILLED = 1;
+ var REJECTED = 2;
+ var HANDLED = 1;
+ var UNHANDLED = 2;
+ var Internal, OwnPromiseCapability, PromiseWrapper, nativeThen;
+
+ var FORCED$3 = isForced_1(PROMISE, function () {
+ var GLOBAL_CORE_JS_PROMISE = inspectSource(PromiseConstructor) !== String(PromiseConstructor);
+ if (!GLOBAL_CORE_JS_PROMISE) {
+ // V8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables
+ // https://bugs.chromium.org/p/chromium/issues/detail?id=830565
+ // We can't detect it synchronously, so just check versions
+ if (engineV8Version === 66) return true;
+ // Unhandled rejections tracking support, NodeJS Promise without it fails @@species test
+ if (!IS_NODE$1 && typeof PromiseRejectionEvent != 'function') return true;
+ }
+ // We can't use @@species feature detection in V8 since it causes
+ // deoptimization and performance degradation
+ // https://github.com/zloirock/core-js/issues/679
+ if (engineV8Version >= 51 && /native code/.test(PromiseConstructor)) return false;
+ // Detect correctness of subclassing with @@species support
+ var promise = PromiseConstructor.resolve(1);
+ var FakePromise = function (exec) {
+ exec(function () { /* empty */ }, function () { /* empty */ });
+ };
+ var constructor = promise.constructor = {};
+ constructor[SPECIES$6] = FakePromise;
+ return !(promise.then(function () { /* empty */ }) instanceof FakePromise);
+ });
+
+ var INCORRECT_ITERATION$1 = FORCED$3 || !checkCorrectnessOfIteration(function (iterable) {
+ PromiseConstructor.all(iterable)['catch'](function () { /* empty */ });
+ });
+
+ // helpers
+ var isThenable = function (it) {
+ var then;
+ return isObject(it) && typeof (then = it.then) == 'function' ? then : false;
+ };
+
+ var notify$1 = function (promise, state, isReject) {
+ if (state.notified) return;
+ state.notified = true;
+ var chain = state.reactions;
+ microtask(function () {
+ var value = state.value;
+ var ok = state.state == FULFILLED;
+ var index = 0;
+ // variable length - can't use forEach
+ while (chain.length > index) {
+ var reaction = chain[index++];
+ var handler = ok ? reaction.ok : reaction.fail;
+ var resolve = reaction.resolve;
+ var reject = reaction.reject;
+ var domain = reaction.domain;
+ var result, then, exited;
+ try {
+ if (handler) {
+ if (!ok) {
+ if (state.rejection === UNHANDLED) onHandleUnhandled(promise, state);
+ state.rejection = HANDLED;
+ }
+ if (handler === true) result = value;
+ else {
+ if (domain) domain.enter();
+ result = handler(value); // can throw
+ if (domain) {
+ domain.exit();
+ exited = true;
+ }
+ }
+ if (result === reaction.promise) {
+ reject(TypeError$1('Promise-chain cycle'));
+ } else if (then = isThenable(result)) {
+ then.call(result, resolve, reject);
+ } else resolve(result);
+ } else reject(value);
+ } catch (error) {
+ if (domain && !exited) domain.exit();
+ reject(error);
+ }
+ }
+ state.reactions = [];
+ state.notified = false;
+ if (isReject && !state.rejection) onUnhandled(promise, state);
+ });
+ };
+
+ var dispatchEvent = function (name, promise, reason) {
+ var event, handler;
+ if (DISPATCH_EVENT) {
+ event = document$2.createEvent('Event');
+ event.promise = promise;
+ event.reason = reason;
+ event.initEvent(name, false, true);
+ global_1.dispatchEvent(event);
+ } else event = { promise: promise, reason: reason };
+ if (handler = global_1['on' + name]) handler(event);
+ else if (name === UNHANDLED_REJECTION) hostReportErrors('Unhandled promise rejection', reason);
+ };
+
+ var onUnhandled = function (promise, state) {
+ task$1.call(global_1, function () {
+ var value = state.value;
+ var IS_UNHANDLED = isUnhandled(state);
+ var result;
+ if (IS_UNHANDLED) {
+ result = perform(function () {
+ if (IS_NODE$1) {
+ process$3.emit('unhandledRejection', value, promise);
+ } else dispatchEvent(UNHANDLED_REJECTION, promise, value);
+ });
+ // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should
+ state.rejection = IS_NODE$1 || isUnhandled(state) ? UNHANDLED : HANDLED;
+ if (result.error) throw result.value;
+ }
+ });
+ };
+
+ var isUnhandled = function (state) {
+ return state.rejection !== HANDLED && !state.parent;
+ };
+
+ var onHandleUnhandled = function (promise, state) {
+ task$1.call(global_1, function () {
+ if (IS_NODE$1) {
+ process$3.emit('rejectionHandled', promise);
+ } else dispatchEvent(REJECTION_HANDLED, promise, state.value);
+ });
+ };
+
+ var bind = function (fn, promise, state, unwrap) {
+ return function (value) {
+ fn(promise, state, value, unwrap);
+ };
+ };
+
+ var internalReject = function (promise, state, value, unwrap) {
+ if (state.done) return;
+ state.done = true;
+ if (unwrap) state = unwrap;
+ state.value = value;
+ state.state = REJECTED;
+ notify$1(promise, state, true);
+ };
+
+ var internalResolve = function (promise, state, value, unwrap) {
+ if (state.done) return;
+ state.done = true;
+ if (unwrap) state = unwrap;
+ try {
+ if (promise === value) throw TypeError$1("Promise can't be resolved itself");
+ var then = isThenable(value);
+ if (then) {
+ microtask(function () {
+ var wrapper = { done: false };
+ try {
+ then.call(value,
+ bind(internalResolve, promise, wrapper, state),
+ bind(internalReject, promise, wrapper, state)
+ );
+ } catch (error) {
+ internalReject(promise, wrapper, error, state);
+ }
+ });
+ } else {
+ state.value = value;
+ state.state = FULFILLED;
+ notify$1(promise, state, false);
+ }
+ } catch (error) {
+ internalReject(promise, { done: false }, error, state);
+ }
+ };
+
+ // constructor polyfill
+ if (FORCED$3) {
+ // 25.4.3.1 Promise(executor)
+ PromiseConstructor = function Promise(executor) {
+ anInstance(this, PromiseConstructor, PROMISE);
+ aFunction$1(executor);
+ Internal.call(this);
+ var state = getInternalState$3(this);
+ try {
+ executor(bind(internalResolve, this, state), bind(internalReject, this, state));
+ } catch (error) {
+ internalReject(this, state, error);
+ }
+ };
+ // eslint-disable-next-line no-unused-vars
+ Internal = function Promise(executor) {
+ setInternalState$6(this, {
+ type: PROMISE,
+ done: false,
+ notified: false,
+ parent: false,
+ reactions: [],
+ rejection: false,
+ state: PENDING,
+ value: undefined
+ });
+ };
+ Internal.prototype = redefineAll(PromiseConstructor.prototype, {
+ // `Promise.prototype.then` method
+ // https://tc39.github.io/ecma262/#sec-promise.prototype.then
+ then: function then(onFulfilled, onRejected) {
+ var state = getInternalPromiseState(this);
+ var reaction = newPromiseCapability$1(speciesConstructor(this, PromiseConstructor));
+ reaction.ok = typeof onFulfilled == 'function' ? onFulfilled : true;
+ reaction.fail = typeof onRejected == 'function' && onRejected;
+ reaction.domain = IS_NODE$1 ? process$3.domain : undefined;
+ state.parent = true;
+ state.reactions.push(reaction);
+ if (state.state != PENDING) notify$1(this, state, false);
+ return reaction.promise;
+ },
+ // `Promise.prototype.catch` method
+ // https://tc39.github.io/ecma262/#sec-promise.prototype.catch
+ 'catch': function (onRejected) {
+ return this.then(undefined, onRejected);
+ }
+ });
+ OwnPromiseCapability = function () {
+ var promise = new Internal();
+ var state = getInternalState$3(promise);
+ this.promise = promise;
+ this.resolve = bind(internalResolve, promise, state);
+ this.reject = bind(internalReject, promise, state);
+ };
+ newPromiseCapability.f = newPromiseCapability$1 = function (C) {
+ return C === PromiseConstructor || C === PromiseWrapper
+ ? new OwnPromiseCapability(C)
+ : newGenericPromiseCapability(C);
+ };
+
+ if ( typeof nativePromiseConstructor == 'function') {
+ nativeThen = nativePromiseConstructor.prototype.then;
+
+ // wrap native Promise#then for native async functions
+ redefine(nativePromiseConstructor.prototype, 'then', function then(onFulfilled, onRejected) {
+ var that = this;
+ return new PromiseConstructor(function (resolve, reject) {
+ nativeThen.call(that, resolve, reject);
+ }).then(onFulfilled, onRejected);
+ // https://github.com/zloirock/core-js/issues/640
+ }, { unsafe: true });
+
+ // wrap fetch result
+ if (typeof $fetch$1 == 'function') _export({ global: true, enumerable: true, forced: true }, {
+ // eslint-disable-next-line no-unused-vars
+ fetch: function fetch(input /* , init */) {
+ return promiseResolve(PromiseConstructor, $fetch$1.apply(global_1, arguments));
+ }
+ });
+ }
+ }
+
+ _export({ global: true, wrap: true, forced: FORCED$3 }, {
+ Promise: PromiseConstructor
+ });
+
+ setToStringTag(PromiseConstructor, PROMISE, false);
+ setSpecies(PROMISE);
+
+ PromiseWrapper = getBuiltIn(PROMISE);
+
+ // statics
+ _export({ target: PROMISE, stat: true, forced: FORCED$3 }, {
+ // `Promise.reject` method
+ // https://tc39.github.io/ecma262/#sec-promise.reject
+ reject: function reject(r) {
+ var capability = newPromiseCapability$1(this);
+ capability.reject.call(undefined, r);
+ return capability.promise;
+ }
+ });
+
+ _export({ target: PROMISE, stat: true, forced: FORCED$3 }, {
+ // `Promise.resolve` method
+ // https://tc39.github.io/ecma262/#sec-promise.resolve
+ resolve: function resolve(x) {
+ return promiseResolve( this, x);
+ }
+ });
+
+ _export({ target: PROMISE, stat: true, forced: INCORRECT_ITERATION$1 }, {
+ // `Promise.all` method
+ // https://tc39.github.io/ecma262/#sec-promise.all
+ all: function all(iterable) {
+ var C = this;
+ var capability = newPromiseCapability$1(C);
+ var resolve = capability.resolve;
+ var reject = capability.reject;
+ var result = perform(function () {
+ var $promiseResolve = aFunction$1(C.resolve);
+ var values = [];
+ var counter = 0;
+ var remaining = 1;
+ iterate_1(iterable, function (promise) {
+ var index = counter++;
+ var alreadyCalled = false;
+ values.push(undefined);
+ remaining++;
+ $promiseResolve.call(C, promise).then(function (value) {
+ if (alreadyCalled) return;
+ alreadyCalled = true;
+ values[index] = value;
+ --remaining || resolve(values);
+ }, reject);
+ });
+ --remaining || resolve(values);
+ });
+ if (result.error) reject(result.value);
+ return capability.promise;
+ },
+ // `Promise.race` method
+ // https://tc39.github.io/ecma262/#sec-promise.race
+ race: function race(iterable) {
+ var C = this;
+ var capability = newPromiseCapability$1(C);
+ var reject = capability.reject;
+ var result = perform(function () {
+ var $promiseResolve = aFunction$1(C.resolve);
+ iterate_1(iterable, function (promise) {
+ $promiseResolve.call(C, promise).then(capability.resolve, reject);
+ });
+ });
+ if (result.error) reject(result.value);
+ return capability.promise;
+ }
+ });
+
+ var getOwnPropertyDescriptor$4 = objectGetOwnPropertyDescriptor.f;
+
+
+
+
+
+
+ var nativeStartsWith = ''.startsWith;
+ var min$4 = Math.min;
+
+ var CORRECT_IS_REGEXP_LOGIC = correctIsRegexpLogic('startsWith');
+ // https://github.com/zloirock/core-js/pull/702
+ var MDN_POLYFILL_BUG = !CORRECT_IS_REGEXP_LOGIC && !!function () {
+ var descriptor = getOwnPropertyDescriptor$4(String.prototype, 'startsWith');
+ return descriptor && !descriptor.writable;
+ }();
+
+ // `String.prototype.startsWith` method
+ // https://tc39.github.io/ecma262/#sec-string.prototype.startswith
+ _export({ target: 'String', proto: true, forced: !MDN_POLYFILL_BUG && !CORRECT_IS_REGEXP_LOGIC }, {
+ startsWith: function startsWith(searchString /* , position = 0 */) {
+ var that = String(requireObjectCoercible(this));
+ notARegexp(searchString);
+ var index = toLength(min$4(arguments.length > 1 ? arguments[1] : undefined, that.length));
+ var search = String(searchString);
+ return nativeStartsWith
+ ? nativeStartsWith.call(that, search, index)
+ : that.slice(index, index + search.length) === search;
+ }
+ });
+
+ // ==========================================================================
+ // Type checking utils
+ // ==========================================================================
+ var getConstructor$1 = function getConstructor(input) {
+ return input !== null && typeof input !== 'undefined' ? input.constructor : null;
+ };
+
+ var instanceOf$1 = function instanceOf(input, constructor) {
+ return Boolean(input && constructor && input instanceof constructor);
+ };
+
+ var isNullOrUndefined$1 = function isNullOrUndefined(input) {
+ return input === null || typeof input === 'undefined';
+ };
+
+ var isObject$2 = function isObject(input) {
+ return getConstructor$1(input) === Object;
+ };
+
+ var isNumber$1 = function isNumber(input) {
+ return getConstructor$1(input) === Number && !Number.isNaN(input);
+ };
+
+ var isString$1 = function isString(input) {
+ return getConstructor$1(input) === String;
+ };
+
+ var isBoolean$1 = function isBoolean(input) {
+ return getConstructor$1(input) === Boolean;
+ };
+
+ var isFunction$1 = function isFunction(input) {
+ return getConstructor$1(input) === Function;
+ };
+
+ var isArray$2 = function isArray(input) {
+ return Array.isArray(input);
+ };
+
+ var isWeakMap = function isWeakMap(input) {
+ return instanceOf$1(input, WeakMap);
+ };
+
+ var isNodeList$1 = function isNodeList(input) {
+ return instanceOf$1(input, NodeList);
+ };
+
+ var isElement$1 = function isElement(input) {
+ return instanceOf$1(input, Element);
+ };
+
+ var isTextNode = function isTextNode(input) {
+ return getConstructor$1(input) === Text;
+ };
+
+ var isEvent$1 = function isEvent(input) {
+ return instanceOf$1(input, Event);
+ };
+
+ var isKeyboardEvent = function isKeyboardEvent(input) {
+ return instanceOf$1(input, KeyboardEvent);
+ };
+
+ var isCue = function isCue(input) {
+ return instanceOf$1(input, window.TextTrackCue) || instanceOf$1(input, window.VTTCue);
+ };
+
+ var isTrack = function isTrack(input) {
+ return instanceOf$1(input, TextTrack) || !isNullOrUndefined$1(input) && isString$1(input.kind);
+ };
+
+ var isPromise = function isPromise(input) {
+ return instanceOf$1(input, Promise) && isFunction$1(input.then);
+ };
+
+ var isEmpty$1 = function isEmpty(input) {
+ return isNullOrUndefined$1(input) || (isString$1(input) || isArray$2(input) || isNodeList$1(input)) && !input.length || isObject$2(input) && !Object.keys(input).length;
+ };
+
+ var isUrl = function isUrl(input) {
+ // Accept a URL object
+ if (instanceOf$1(input, window.URL)) {
+ return true;
+ } // Must be string from here
+
+
+ if (!isString$1(input)) {
+ return false;
+ } // Add the protocol if required
+
+
+ var string = input;
+
+ if (!input.startsWith('http://') || !input.startsWith('https://')) {
+ string = "http://".concat(input);
+ }
+
+ try {
+ return !isEmpty$1(new URL(string).hostname);
+ } catch (e) {
+ return false;
+ }
+ };
+
+ var is$1 = {
+ nullOrUndefined: isNullOrUndefined$1,
+ object: isObject$2,
+ number: isNumber$1,
+ string: isString$1,
+ boolean: isBoolean$1,
+ function: isFunction$1,
+ array: isArray$2,
+ weakMap: isWeakMap,
+ nodeList: isNodeList$1,
+ element: isElement$1,
+ textNode: isTextNode,
+ event: isEvent$1,
+ keyboardEvent: isKeyboardEvent,
+ cue: isCue,
+ track: isTrack,
+ promise: isPromise,
+ url: isUrl,
+ empty: isEmpty$1
+ };
+
+ var transitionEndEvent = function () {
+ var element = document.createElement('span');
+ var events = {
+ WebkitTransition: 'webkitTransitionEnd',
+ MozTransition: 'transitionend',
+ OTransition: 'oTransitionEnd otransitionend',
+ transition: 'transitionend'
+ };
+ var type = Object.keys(events).find(function (event) {
+ return element.style[event] !== undefined;
+ });
+ return is$1.string(type) ? events[type] : false;
+ }(); // Force repaint of element
+
+ function repaint(element, delay) {
+ setTimeout(function () {
+ try {
+ // eslint-disable-next-line no-param-reassign
+ element.hidden = true; // eslint-disable-next-line no-unused-expressions
+
+ element.offsetHeight; // eslint-disable-next-line no-param-reassign
+
+ element.hidden = false;
+ } catch (e) {// Do nothing
+ }
+ }, delay);
+ }
+
+ // ==========================================================================
+ // Browser sniffing
+ // Unfortunately, due to mixed support, UA sniffing is required
+ // ==========================================================================
+ var browser = {
+ isIE:
+ /* @cc_on!@ */
+ !!document.documentMode,
+ isEdge: window.navigator.userAgent.includes('Edge'),
+ isWebkit: 'WebkitAppearance' in document.documentElement.style && !/Edge/.test(navigator.userAgent),
+ isIPhone: /(iPhone|iPod)/gi.test(navigator.platform),
+ isIos: /(iPad|iPhone|iPod)/gi.test(navigator.platform)
+ };
+
+ // `Array.prototype.{ reduce, reduceRight }` methods implementation
+ var createMethod$5 = function (IS_RIGHT) {
+ return function (that, callbackfn, argumentsLength, memo) {
+ aFunction$1(callbackfn);
+ var O = toObject(that);
+ var self = indexedObject(O);
+ var length = toLength(O.length);
+ var index = IS_RIGHT ? length - 1 : 0;
+ var i = IS_RIGHT ? -1 : 1;
+ if (argumentsLength < 2) while (true) {
+ if (index in self) {
+ memo = self[index];
+ index += i;
+ break;
+ }
+ index += i;
+ if (IS_RIGHT ? index < 0 : length <= index) {
+ throw TypeError('Reduce of empty array with no initial value');
+ }
+ }
+ for (;IS_RIGHT ? index >= 0 : length > index; index += i) if (index in self) {
+ memo = callbackfn(memo, self[index], index, O);
+ }
+ return memo;
+ };
+ };
+
+ var arrayReduce = {
+ // `Array.prototype.reduce` method
+ // https://tc39.github.io/ecma262/#sec-array.prototype.reduce
+ left: createMethod$5(false),
+ // `Array.prototype.reduceRight` method
+ // https://tc39.github.io/ecma262/#sec-array.prototype.reduceright
+ right: createMethod$5(true)
+ };
+
+ var $reduce = arrayReduce.left;
+
+
+
+ var STRICT_METHOD$5 = arrayMethodIsStrict('reduce');
+ var USES_TO_LENGTH$9 = arrayMethodUsesToLength('reduce', { 1: 0 });
+
+ // `Array.prototype.reduce` method
+ // https://tc39.github.io/ecma262/#sec-array.prototype.reduce
+ _export({ target: 'Array', proto: true, forced: !STRICT_METHOD$5 || !USES_TO_LENGTH$9 }, {
+ reduce: function reduce(callbackfn /* , initialValue */) {
+ return $reduce(this, callbackfn, arguments.length, arguments.length > 1 ? arguments[1] : undefined);
+ }
+ });
+
+ function cloneDeep(object) {
+ return JSON.parse(JSON.stringify(object));
+ } // Get a nested value in an object
+
+ function getDeep(object, path) {
+ return path.split('.').reduce(function (obj, key) {
+ return obj && obj[key];
+ }, object);
+ } // Deep extend destination object with N more objects
+
+ function extend() {
+ var target = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
+
+ for (var _len = arguments.length, sources = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
+ sources[_key - 1] = arguments[_key];
+ }
+
+ if (!sources.length) {
+ return target;
+ }
+
+ var source = sources.shift();
+
+ if (!is$1.object(source)) {
+ return target;
+ }
+
+ Object.keys(source).forEach(function (key) {
+ if (is$1.object(source[key])) {
+ if (!Object.keys(target).includes(key)) {
+ Object.assign(target, _defineProperty({}, key, {}));
+ }
+
+ extend(target[key], source[key]);
+ } else {
+ Object.assign(target, _defineProperty({}, key, source[key]));
+ }
+ });
+ return extend.apply(void 0, [target].concat(sources));
+ }
+
+ function wrap$1(elements, wrapper) {
+ // Convert `elements` to an array, if necessary.
+ var targets = elements.length ? elements : [elements]; // Loops backwards to prevent having to clone the wrapper on the
+ // first element (see `child` below).
+
+ Array.from(targets).reverse().forEach(function (element, index) {
+ var child = index > 0 ? wrapper.cloneNode(true) : wrapper; // Cache the current parent and sibling.
+
+ var parent = element.parentNode;
+ var sibling = element.nextSibling; // Wrap the element (is automatically removed from its current
+ // parent).
+
+ child.appendChild(element); // If the element had a sibling, insert the wrapper before
+ // the sibling to maintain the HTML structure; otherwise, just
+ // append it to the parent.
+
+ if (sibling) {
+ parent.insertBefore(child, sibling);
+ } else {
+ parent.appendChild(child);
+ }
+ });
+ } // Set attributes
+
+ function setAttributes(element, attributes) {
+ if (!is$1.element(element) || is$1.empty(attributes)) {
+ return;
+ } // Assume null and undefined attributes should be left out,
+ // Setting them would otherwise convert them to "null" and "undefined"
+
+
+ Object.entries(attributes).filter(function (_ref) {
+ var _ref2 = _slicedToArray(_ref, 2),
+ value = _ref2[1];
+
+ return !is$1.nullOrUndefined(value);
+ }).forEach(function (_ref3) {
+ var _ref4 = _slicedToArray(_ref3, 2),
+ key = _ref4[0],
+ value = _ref4[1];
+
+ return element.setAttribute(key, value);
+ });
+ } // Create a DocumentFragment
+
+ function createElement(type, attributes, text) {
+ // Create a new <element>
+ var element = document.createElement(type); // Set all passed attributes
+
+ if (is$1.object(attributes)) {
+ setAttributes(element, attributes);
+ } // Add text node
+
+
+ if (is$1.string(text)) {
+ element.innerText = text;
+ } // Return built element
+
+
+ return element;
+ } // Inaert an element after another
+
+ function insertAfter(element, target) {
+ if (!is$1.element(element) || !is$1.element(target)) {
+ return;
+ }
+
+ target.parentNode.insertBefore(element, target.nextSibling);
+ } // Insert a DocumentFragment
+
+ function insertElement(type, parent, attributes, text) {
+ if (!is$1.element(parent)) {
+ return;
+ }
+
+ parent.appendChild(createElement(type, attributes, text));
+ } // Remove element(s)
+
+ function removeElement(element) {
+ if (is$1.nodeList(element) || is$1.array(element)) {
+ Array.from(element).forEach(removeElement);
+ return;
+ }
+
+ if (!is$1.element(element) || !is$1.element(element.parentNode)) {
+ return;
+ }
+
+ element.parentNode.removeChild(element);
+ } // Remove all child elements
+
+ function emptyElement(element) {
+ if (!is$1.element(element)) {
+ return;
+ }
+
+ var length = element.childNodes.length;
+
+ while (length > 0) {
+ element.removeChild(element.lastChild);
+ length -= 1;
+ }
+ } // Replace element
+
+ function replaceElement(newChild, oldChild) {
+ if (!is$1.element(oldChild) || !is$1.element(oldChild.parentNode) || !is$1.element(newChild)) {
+ return null;
+ }
+
+ oldChild.parentNode.replaceChild(newChild, oldChild);
+ return newChild;
+ } // Get an attribute object from a string selector
+
+ function getAttributesFromSelector(sel, existingAttributes) {
+ // For example:
+ // '.test' to { class: 'test' }
+ // '#test' to { id: 'test' }
+ // '[data-test="test"]' to { 'data-test': 'test' }
+ if (!is$1.string(sel) || is$1.empty(sel)) {
+ return {};
+ }
+
+ var attributes = {};
+ var existing = extend({}, existingAttributes);
+ sel.split(',').forEach(function (s) {
+ // Remove whitespace
+ var selector = s.trim();
+ var className = selector.replace('.', '');
+ var stripped = selector.replace(/[[\]]/g, ''); // Get the parts and value
+
+ var parts = stripped.split('=');
+
+ var _parts = _slicedToArray(parts, 1),
+ key = _parts[0];
+
+ var value = parts.length > 1 ? parts[1].replace(/["']/g, '') : ''; // Get the first character
+
+ var start = selector.charAt(0);
+
+ switch (start) {
+ case '.':
+ // Add to existing classname
+ if (is$1.string(existing.class)) {
+ attributes.class = "".concat(existing.class, " ").concat(className);
+ } else {
+ attributes.class = className;
+ }
+
+ break;
+
+ case '#':
+ // ID selector
+ attributes.id = selector.replace('#', '');
+ break;
+
+ case '[':
+ // Attribute selector
+ attributes[key] = value;
+ break;
+ }
+ });
+ return extend(existing, attributes);
+ } // Toggle hidden
+
+ function toggleHidden(element, hidden) {
+ if (!is$1.element(element)) {
+ return;
+ }
+
+ var hide = hidden;
+
+ if (!is$1.boolean(hide)) {
+ hide = !element.hidden;
+ } // eslint-disable-next-line no-param-reassign
+
+
+ element.hidden = hide;
+ } // Mirror Element.classList.toggle, with IE compatibility for "force" argument
+
+ function toggleClass(element, className, force) {
+ if (is$1.nodeList(element)) {
+ return Array.from(element).map(function (e) {
+ return toggleClass(e, className, force);
+ });
+ }
+
+ if (is$1.element(element)) {
+ var method = 'toggle';
+
+ if (typeof force !== 'undefined') {
+ method = force ? 'add' : 'remove';
+ }
+
+ element.classList[method](className);
+ return element.classList.contains(className);
+ }
+
+ return false;
+ } // Has class name
+
+ function hasClass(element, className) {
+ return is$1.element(element) && element.classList.contains(className);
+ } // Element matches selector
+
+ function matches$1(element, selector) {
+ var _Element = Element,
+ prototype = _Element.prototype;
+
+ function match() {
+ return Array.from(document.querySelectorAll(selector)).includes(this);
+ }
+
+ var method = prototype.matches || prototype.webkitMatchesSelector || prototype.mozMatchesSelector || prototype.msMatchesSelector || match;
+ return method.call(element, selector);
+ } // Closest ancestor element matching selector (also tests element itself)
+
+ function closest(element, selector) {
+ var _Element2 = Element,
+ prototype = _Element2.prototype; // https://developer.mozilla.org/en-US/docs/Web/API/Element/closest#Polyfill
+
+ function closestElement() {
+ var el = this;
+
+ do {
+ if (matches$1.matches(el, selector)) return el;
+ el = el.parentElement || el.parentNode;
+ } while (el !== null && el.nodeType === 1);
+
+ return null;
+ }
+
+ var method = prototype.closest || closestElement;
+ return method.call(element, selector);
+ } // Find all elements
+
+ function getElements(selector) {
+ return this.elements.container.querySelectorAll(selector);
+ } // Find a single element
+
+ function getElement(selector) {
+ return this.elements.container.querySelector(selector);
+ } // Set focus and tab focus class
+
+ function setFocus() {
+ var element = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
+ var tabFocus = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
+
+ if (!is$1.element(element)) {
+ return;
+ } // Set regular focus
+
+
+ element.focus({
+ preventScroll: true
+ }); // If we want to mimic keyboard focus via tab
+
+ if (tabFocus) {
+ toggleClass(element, this.config.classNames.tabFocus);
+ }
+ }
+
+ var defaultCodecs = {
+ 'audio/ogg': 'vorbis',
+ 'audio/wav': '1',
+ 'video/webm': 'vp8, vorbis',
+ 'video/mp4': 'avc1.42E01E, mp4a.40.2',
+ 'video/ogg': 'theora'
+ }; // Check for feature support
+
+ var support = {
+ // Basic support
+ audio: 'canPlayType' in document.createElement('audio'),
+ video: 'canPlayType' in document.createElement('video'),
+ // Check for support
+ // Basic functionality vs full UI
+ check: function check(type, provider, playsinline) {
+ var canPlayInline = browser.isIPhone && playsinline && support.playsinline;
+ var api = support[type] || provider !== 'html5';
+ var ui = api && support.rangeInput && (type !== 'video' || !browser.isIPhone || canPlayInline);
+ return {
+ api: api,
+ ui: ui
+ };
+ },
+ // Picture-in-picture support
+ // Safari & Chrome only currently
+ pip: function () {
+ if (browser.isIPhone) {
+ return false;
+ } // Safari
+ // https://developer.apple.com/documentation/webkitjs/adding_picture_in_picture_to_your_safari_media_controls
+
+
+ if (is$1.function(createElement('video').webkitSetPresentationMode)) {
+ return true;
+ } // Chrome
+ // https://developers.google.com/web/updates/2018/10/watch-video-using-picture-in-picture
+
+
+ if (document.pictureInPictureEnabled && !createElement('video').disablePictureInPicture) {
+ return true;
+ }
+
+ return false;
+ }(),
+ // Airplay support
+ // Safari only currently
+ airplay: is$1.function(window.WebKitPlaybackTargetAvailabilityEvent),
+ // Inline playback support
+ // https://webkit.org/blog/6784/new-video-policies-for-ios/
+ playsinline: 'playsInline' in document.createElement('video'),
+ // Check for mime type support against a player instance
+ // Credits: http://diveintohtml5.info/everything.html
+ // Related: http://www.leanbackplayer.com/test/h5mt.html
+ mime: function mime(input) {
+ if (is$1.empty(input)) {
+ return false;
+ }
+
+ var _input$split = input.split('/'),
+ _input$split2 = _slicedToArray(_input$split, 1),
+ mediaType = _input$split2[0];
+
+ var type = input; // Verify we're using HTML5 and there's no media type mismatch
+
+ if (!this.isHTML5 || mediaType !== this.type) {
+ return false;
+ } // Add codec if required
+
+
+ if (Object.keys(defaultCodecs).includes(type)) {
+ type += "; codecs=\"".concat(defaultCodecs[input], "\"");
+ }
+
+ try {
+ return Boolean(type && this.media.canPlayType(type).replace(/no/, ''));
+ } catch (e) {
+ return false;
+ }
+ },
+ // Check for textTracks support
+ textTracks: 'textTracks' in document.createElement('video'),
+ // <input type="range"> Sliders
+ rangeInput: function () {
+ var range = document.createElement('input');
+ range.type = 'range';
+ return range.type === 'range';
+ }(),
+ // Touch
+ // NOTE: Remember a device can be mouse + touch enabled so we check on first touch event
+ touch: 'ontouchstart' in document.documentElement,
+ // Detect transitions support
+ transitions: transitionEndEvent !== false,
+ // Reduced motion iOS & MacOS setting
+ // https://webkit.org/blog/7551/responsive-design-for-motion/
+ reducedMotion: 'matchMedia' in window && window.matchMedia('(prefers-reduced-motion)').matches
+ };
+
+ // https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md
+ // https://www.youtube.com/watch?v=NPM6172J22g
+
+ var supportsPassiveListeners = function () {
+ // Test via a getter in the options object to see if the passive property is accessed
+ var supported = false;
+
+ try {
+ var options = Object.defineProperty({}, 'passive', {
+ get: function get() {
+ supported = true;
+ return null;
+ }
+ });
+ window.addEventListener('test', null, options);
+ window.removeEventListener('test', null, options);
+ } catch (e) {// Do nothing
+ }
+
+ return supported;
+ }(); // Toggle event listener
+
+
+ function toggleListener(element, event, callback) {
+ var _this = this;
+
+ var toggle = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
+ var passive = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
+ var capture = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
+
+ // Bail if no element, event, or callback
+ if (!element || !('addEventListener' in element) || is$1.empty(event) || !is$1.function(callback)) {
+ return;
+ } // Allow multiple events
+
+
+ var events = event.split(' '); // Build options
+ // Default to just the capture boolean for browsers with no passive listener support
+
+ var options = capture; // If passive events listeners are supported
+
+ if (supportsPassiveListeners) {
+ options = {
+ // Whether the listener can be passive (i.e. default never prevented)
+ passive: passive,
+ // Whether the listener is a capturing listener or not
+ capture: capture
+ };
+ } // If a single node is passed, bind the event listener
+
+
+ events.forEach(function (type) {
+ if (_this && _this.eventListeners && toggle) {
+ // Cache event listener
+ _this.eventListeners.push({
+ element: element,
+ type: type,
+ callback: callback,
+ options: options
+ });
+ }
+
+ element[toggle ? 'addEventListener' : 'removeEventListener'](type, callback, options);
+ });
+ } // Bind event handler
+
+ function on(element) {
+ var events = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
+ var callback = arguments.length > 2 ? arguments[2] : undefined;
+ var passive = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
+ var capture = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
+ toggleListener.call(this, element, events, callback, true, passive, capture);
+ } // Unbind event handler
+
+ function off(element) {
+ var events = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
+ var callback = arguments.length > 2 ? arguments[2] : undefined;
+ var passive = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
+ var capture = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
+ toggleListener.call(this, element, events, callback, false, passive, capture);
+ } // Bind once-only event handler
+
+ function once(element) {
+ var _this2 = this;
+
+ var events = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
+ var callback = arguments.length > 2 ? arguments[2] : undefined;
+ var passive = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
+ var capture = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
+
+ var onceCallback = function onceCallback() {
+ off(element, events, onceCallback, passive, capture);
+
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
+ args[_key] = arguments[_key];
+ }
+
+ callback.apply(_this2, args);
+ };
+
+ toggleListener.call(this, element, events, onceCallback, true, passive, capture);
+ } // Trigger event
+
+ function triggerEvent(element) {
+ var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
+ var bubbles = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
+ var detail = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
+
+ // Bail if no element
+ if (!is$1.element(element) || is$1.empty(type)) {
+ return;
+ } // Create and dispatch the event
+
+
+ var event = new CustomEvent(type, {
+ bubbles: bubbles,
+ detail: _objectSpread2(_objectSpread2({}, detail), {}, {
+ plyr: this
+ })
+ }); // Dispatch the event
+
+ element.dispatchEvent(event);
+ } // Unbind all cached event listeners
+
+ function unbindListeners() {
+ if (this && this.eventListeners) {
+ this.eventListeners.forEach(function (item) {
+ var element = item.element,
+ type = item.type,
+ callback = item.callback,
+ options = item.options;
+ element.removeEventListener(type, callback, options);
+ });
+ this.eventListeners = [];
+ }
+ } // Run method when / if player is ready
+
+ function ready() {
+ var _this3 = this;
+
+ return new Promise(function (resolve) {
+ return _this3.ready ? setTimeout(resolve, 0) : on.call(_this3, _this3.elements.container, 'ready', resolve);
+ }).then(function () {});
+ }
+
+ /**
+ * Silence a Promise-like object.
+ * This is useful for avoiding non-harmful, but potentially confusing "uncaught
+ * play promise" rejection error messages.
+ * @param {Object} value An object that may or may not be `Promise`-like.
+ */
+
+ function silencePromise(value) {
+ if (is$1.promise(value)) {
+ value.then(null, function () {});
+ }
+ }
+
+ function validateRatio(input) {
+ if (!is$1.array(input) && (!is$1.string(input) || !input.includes(':'))) {
+ return false;
+ }
+
+ var ratio = is$1.array(input) ? input : input.split(':');
+ return ratio.map(Number).every(is$1.number);
+ }
+ function reduceAspectRatio(ratio) {
+ if (!is$1.array(ratio) || !ratio.every(is$1.number)) {
+ return null;
+ }
+
+ var _ratio = _slicedToArray(ratio, 2),
+ width = _ratio[0],
+ height = _ratio[1];
+
+ var getDivider = function getDivider(w, h) {
+ return h === 0 ? w : getDivider(h, w % h);
+ };
+
+ var divider = getDivider(width, height);
+ return [width / divider, height / divider];
+ }
+ function getAspectRatio(input) {
+ var parse = function parse(ratio) {
+ return validateRatio(ratio) ? ratio.split(':').map(Number) : null;
+ }; // Try provided ratio
+
+
+ var ratio = parse(input); // Get from config
+
+ if (ratio === null) {
+ ratio = parse(this.config.ratio);
+ } // Get from embed
+
+
+ if (ratio === null && !is$1.empty(this.embed) && is$1.array(this.embed.ratio)) {
+ ratio = this.embed.ratio;
+ } // Get from HTML5 video
+
+
+ if (ratio === null && this.isHTML5) {
+ var _this$media = this.media,
+ videoWidth = _this$media.videoWidth,
+ videoHeight = _this$media.videoHeight;
+ ratio = reduceAspectRatio([videoWidth, videoHeight]);
+ }
+
+ return ratio;
+ } // Set aspect ratio for responsive container
+
+ function setAspectRatio(input) {
+ if (!this.isVideo) {
+ return {};
+ }
+
+ var wrapper = this.elements.wrapper;
+ var ratio = getAspectRatio.call(this, input);
+
+ var _ref = is$1.array(ratio) ? ratio : [0, 0],
+ _ref2 = _slicedToArray(_ref, 2),
+ w = _ref2[0],
+ h = _ref2[1];
+
+ var padding = 100 / w * h;
+ wrapper.style.paddingBottom = "".concat(padding, "%"); // For Vimeo we have an extra <div> to hide the standard controls and UI
+
+ if (this.isVimeo && !this.config.vimeo.premium && this.supported.ui) {
+ var height = 100 / this.media.offsetWidth * parseInt(window.getComputedStyle(this.media).paddingBottom, 10);
+ var offset = (height - padding) / (height / 50);
+ this.media.style.transform = "translateY(-".concat(offset, "%)");
+ } else if (this.isHTML5) {
+ wrapper.classList.toggle(this.config.classNames.videoFixedRatio, ratio !== null);
+ }
+
+ return {
+ padding: padding,
+ ratio: ratio
+ };
+ }
+
+ var html5 = {
+ getSources: function getSources() {
+ var _this = this;
+
+ if (!this.isHTML5) {
+ return [];
+ }
+
+ var sources = Array.from(this.media.querySelectorAll('source')); // Filter out unsupported sources (if type is specified)
+
+ return sources.filter(function (source) {
+ var type = source.getAttribute('type');
+
+ if (is$1.empty(type)) {
+ return true;
+ }
+
+ return support.mime.call(_this, type);
+ });
+ },
+ // Get quality levels
+ getQualityOptions: function getQualityOptions() {
+ // Whether we're forcing all options (e.g. for streaming)
+ if (this.config.quality.forced) {
+ return this.config.quality.options;
+ } // Get sizes from <source> elements
+
+
+ return html5.getSources.call(this).map(function (source) {
+ return Number(source.getAttribute('data-res'));
+ }).filter(Boolean);
+ },
+ setup: function setup() {
+ if (!this.isHTML5) {
+ return;
+ }
+
+ var player = this; // Set speed options from config
+
+ player.options.speed = player.config.speed.options; // Set aspect ratio if fixed
+
+ if (!is$1.empty(this.config.ratio)) {
+ setAspectRatio.call(player);
+ } // Quality
+
+
+ Object.defineProperty(player.media, 'quality', {
+ get: function get() {
+ // Get sources
+ var sources = html5.getSources.call(player);
+ var source = sources.find(function (s) {
+ return s.getAttribute('src') === player.source;
+ }); // Return size, if match is found
+
+ return source && Number(source.getAttribute('data-res'));
+ },
+ set: function set(input) {
+ if (player.quality === input) {
+ return;
+ } // If we're using an an external handler...
+
+
+ if (player.config.quality.forced && is$1.function(player.config.quality.onChange)) {
+ player.config.quality.onChange(input);
+ } else {
+ // Get sources
+ var sources = html5.getSources.call(player); // Get first match for requested size
+
+ var source = sources.find(function (s) {
+ return Number(s.getAttribute('data-res')) === input;
+ }); // No matching source found
+
+ if (!source) {
+ return;
+ } // Get current state
+
+
+ var _player$media = player.media,
+ currentTime = _player$media.currentTime,
+ paused = _player$media.paused,
+ preload = _player$media.preload,
+ readyState = _player$media.readyState,
+ playbackRate = _player$media.playbackRate; // Set new source
+
+ player.media.src = source.getAttribute('src'); // Prevent loading if preload="none" and the current source isn't loaded (#1044)
+
+ if (preload !== 'none' || readyState) {
+ // Restore time
+ player.once('loadedmetadata', function () {
+ player.speed = playbackRate;
+ player.currentTime = currentTime; // Resume playing
+
+ if (!paused) {
+ silencePromise(player.play());
+ }
+ }); // Load new source
+
+ player.media.load();
+ }
+ } // Trigger change event
+
+
+ triggerEvent.call(player, player.media, 'qualitychange', false, {
+ quality: input
+ });
+ }
+ });
+ },
+ // Cancel current network requests
+ // See https://github.com/sampotts/plyr/issues/174
+ cancelRequests: function cancelRequests() {
+ if (!this.isHTML5) {
+ return;
+ } // Remove child sources
+
+
+ removeElement(html5.getSources.call(this)); // Set blank video src attribute
+ // This is to prevent a MEDIA_ERR_SRC_NOT_SUPPORTED error
+ // Info: http://stackoverflow.com/questions/32231579/how-to-properly-dispose-of-an-html5-video-and-close-socket-or-connection
+
+ this.media.setAttribute('src', this.config.blankVideo); // Load the new empty source
+ // This will cancel existing requests
+ // See https://github.com/sampotts/plyr/issues/174
+
+ this.media.load(); // Debugging
+
+ this.debug.log('Cancelled network requests');
+ }
+ };
+
+ function dedupe(array) {
+ if (!is$1.array(array)) {
+ return array;
+ }
+
+ return array.filter(function (item, index) {
+ return array.indexOf(item) === index;
+ });
+ } // Get the closest value in an array
+
+ function closest$1(array, value) {
+ if (!is$1.array(array) || !array.length) {
+ return null;
+ }
+
+ return array.reduce(function (prev, curr) {
+ return Math.abs(curr - value) < Math.abs(prev - value) ? curr : prev;
+ });
+ }
+
+ var defineProperty$6 = objectDefineProperty.f;
+ var getOwnPropertyNames$1 = objectGetOwnPropertyNames.f;
+
+
+
+
+
+ var setInternalState$7 = internalState.set;
+
+
+
+ var MATCH$2 = wellKnownSymbol('match');
+ var NativeRegExp = global_1.RegExp;
+ var RegExpPrototype$1 = NativeRegExp.prototype;
+ var re1 = /a/g;
+ var re2 = /a/g;
+
+ // "new" should create a new object, old webkit bug
+ var CORRECT_NEW = new NativeRegExp(re1) !== re1;
+
+ var UNSUPPORTED_Y$2 = regexpStickyHelpers.UNSUPPORTED_Y;
+
+ var FORCED$4 = descriptors && isForced_1('RegExp', (!CORRECT_NEW || UNSUPPORTED_Y$2 || fails(function () {
+ re2[MATCH$2] = false;
+ // RegExp constructor can alter flags and IsRegExp works correct with @@match
+ return NativeRegExp(re1) != re1 || NativeRegExp(re2) == re2 || NativeRegExp(re1, 'i') != '/a/i';
+ })));
+
+ // `RegExp` constructor
+ // https://tc39.github.io/ecma262/#sec-regexp-constructor
+ if (FORCED$4) {
+ var RegExpWrapper = function RegExp(pattern, flags) {
+ var thisIsRegExp = this instanceof RegExpWrapper;
+ var patternIsRegExp = isRegexp(pattern);
+ var flagsAreUndefined = flags === undefined;
+ var sticky;
+
+ if (!thisIsRegExp && patternIsRegExp && pattern.constructor === RegExpWrapper && flagsAreUndefined) {
+ return pattern;
+ }
+
+ if (CORRECT_NEW) {
+ if (patternIsRegExp && !flagsAreUndefined) pattern = pattern.source;
+ } else if (pattern instanceof RegExpWrapper) {
+ if (flagsAreUndefined) flags = regexpFlags.call(pattern);
+ pattern = pattern.source;
+ }
+
+ if (UNSUPPORTED_Y$2) {
+ sticky = !!flags && flags.indexOf('y') > -1;
+ if (sticky) flags = flags.replace(/y/g, '');
+ }
+
+ var result = inheritIfRequired(
+ CORRECT_NEW ? new NativeRegExp(pattern, flags) : NativeRegExp(pattern, flags),
+ thisIsRegExp ? this : RegExpPrototype$1,
+ RegExpWrapper
+ );
+
+ if (UNSUPPORTED_Y$2 && sticky) setInternalState$7(result, { sticky: sticky });
+
+ return result;
+ };
+ var proxy = function (key) {
+ key in RegExpWrapper || defineProperty$6(RegExpWrapper, key, {
+ configurable: true,
+ get: function () { return NativeRegExp[key]; },
+ set: function (it) { NativeRegExp[key] = it; }
+ });
+ };
+ var keys$2 = getOwnPropertyNames$1(NativeRegExp);
+ var index = 0;
+ while (keys$2.length > index) proxy(keys$2[index++]);
+ RegExpPrototype$1.constructor = RegExpWrapper;
+ RegExpWrapper.prototype = RegExpPrototype$1;
+ redefine(global_1, 'RegExp', RegExpWrapper);
+ }
+
+ // https://tc39.github.io/ecma262/#sec-get-regexp-@@species
+ setSpecies('RegExp');
+
+ function generateId(prefix) {
+ return "".concat(prefix, "-").concat(Math.floor(Math.random() * 10000));
+ } // Format string
+
+ function format(input) {
+ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
+ args[_key - 1] = arguments[_key];
+ }
+
+ if (is$1.empty(input)) {
+ return input;
+ }
+
+ return input.toString().replace(/{(\d+)}/g, function (match, i) {
+ return args[i].toString();
+ });
+ } // Get percentage
+
+ function getPercentage(current, max) {
+ if (current === 0 || max === 0 || Number.isNaN(current) || Number.isNaN(max)) {
+ return 0;
+ }
+
+ return (current / max * 100).toFixed(2);
+ } // Replace all occurances of a string in a string
+
+ var replaceAll = function replaceAll() {
+ var input = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
+ var find = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
+ var replace = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
+ return input.replace(new RegExp(find.toString().replace(/([.*+?^=!:${}()|[\]/\\])/g, '\\$1'), 'g'), replace.toString());
+ }; // Convert to title case
+
+ var toTitleCase = function toTitleCase() {
+ var input = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
+ return input.toString().replace(/\w\S*/g, function (text) {
+ return text.charAt(0).toUpperCase() + text.substr(1).toLowerCase();
+ });
+ }; // Convert string to pascalCase
+
+ function toPascalCase() {
+ var input = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
+ var string = input.toString(); // Convert kebab case
+
+ string = replaceAll(string, '-', ' '); // Convert snake case
+
+ string = replaceAll(string, '_', ' '); // Convert to title case
+
+ string = toTitleCase(string); // Convert to pascal case
+
+ return replaceAll(string, ' ', '');
+ } // Convert string to pascalCase
+
+ function toCamelCase() {
+ var input = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
+ var string = input.toString(); // Convert to pascal case
+
+ string = toPascalCase(string); // Convert first character to lowercase
+
+ return string.charAt(0).toLowerCase() + string.slice(1);
+ } // Remove HTML from a string
+
+ function stripHTML(source) {
+ var fragment = document.createDocumentFragment();
+ var element = document.createElement('div');
+ fragment.appendChild(element);
+ element.innerHTML = source;
+ return fragment.firstChild.innerText;
+ } // Like outerHTML, but also works for DocumentFragment
+
+ function getHTML(element) {
+ var wrapper = document.createElement('div');
+ wrapper.appendChild(element);
+ return wrapper.innerHTML;
+ }
+
+ var resources = {
+ pip: 'PIP',
+ airplay: 'AirPlay',
+ html5: 'HTML5',
+ vimeo: 'Vimeo',
+ youtube: 'YouTube'
+ };
+ var i18n = {
+ get: function get() {
+ var key = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
+ var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
+
+ if (is$1.empty(key) || is$1.empty(config)) {
+ return '';
+ }
+
+ var string = getDeep(config.i18n, key);
+
+ if (is$1.empty(string)) {
+ if (Object.keys(resources).includes(key)) {
+ return resources[key];
+ }
+
+ return '';
+ }
+
+ var replace = {
+ '{seektime}': config.seekTime,
+ '{title}': config.title
+ };
+ Object.entries(replace).forEach(function (_ref) {
+ var _ref2 = _slicedToArray(_ref, 2),
+ k = _ref2[0],
+ v = _ref2[1];
+
+ string = replaceAll(string, k, v);
+ });
+ return string;
+ }
+ };
+
+ var Storage = /*#__PURE__*/function () {
+ function Storage(player) {
+ _classCallCheck(this, Storage);
+
+ this.enabled = player.config.storage.enabled;
+ this.key = player.config.storage.key;
+ } // Check for actual support (see if we can use it)
+
+
+ _createClass(Storage, [{
+ key: "get",
+ value: function get(key) {
+ if (!Storage.supported || !this.enabled) {
+ return null;
+ }
+
+ var store = window.localStorage.getItem(this.key);
+
+ if (is$1.empty(store)) {
+ return null;
+ }
+
+ var json = JSON.parse(store);
+ return is$1.string(key) && key.length ? json[key] : json;
+ }
+ }, {
+ key: "set",
+ value: function set(object) {
+ // Bail if we don't have localStorage support or it's disabled
+ if (!Storage.supported || !this.enabled) {
+ return;
+ } // Can only store objectst
+
+
+ if (!is$1.object(object)) {
+ return;
+ } // Get current storage
+
+
+ var storage = this.get(); // Default to empty object
+
+ if (is$1.empty(storage)) {
+ storage = {};
+ } // Update the working copy of the values
+
+
+ extend(storage, object); // Update storage
+
+ window.localStorage.setItem(this.key, JSON.stringify(storage));
+ }
+ }], [{
+ key: "supported",
+ get: function get() {
+ try {
+ if (!('localStorage' in window)) {
+ return false;
+ }
+
+ var test = '___test'; // Try to use it (it might be disabled, e.g. user is in private mode)
+ // see: https://github.com/sampotts/plyr/issues/131
+
+ window.localStorage.setItem(test, test);
+ window.localStorage.removeItem(test);
+ return true;
+ } catch (e) {
+ return false;
+ }
+ }
+ }]);
+
+ return Storage;
+ }();
+
+ // ==========================================================================
+ // Fetch wrapper
+ // Using XHR to avoid issues with older browsers
+ // ==========================================================================
+ function fetch(url) {
+ var responseType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'text';
+ return new Promise(function (resolve, reject) {
+ try {
+ var request = new XMLHttpRequest(); // Check for CORS support
+
+ if (!('withCredentials' in request)) {
+ return;
+ }
+
+ request.addEventListener('load', function () {
+ if (responseType === 'text') {
+ try {
+ resolve(JSON.parse(request.responseText));
+ } catch (e) {
+ resolve(request.responseText);
+ }
+ } else {
+ resolve(request.response);
+ }
+ });
+ request.addEventListener('error', function () {
+ throw new Error(request.status);
+ });
+ request.open('GET', url, true); // Set the required response type
+
+ request.responseType = responseType;
+ request.send();
+ } catch (e) {
+ reject(e);
+ }
+ });
+ }
+
+ // ==========================================================================
+
+ function loadSprite(url, id) {
+ if (!is$1.string(url)) {
+ return;
+ }
+
+ var prefix = 'cache';
+ var hasId = is$1.string(id);
+ var isCached = false;
+
+ var exists = function exists() {
+ return document.getElementById(id) !== null;
+ };
+
+ var update = function update(container, data) {
+ // eslint-disable-next-line no-param-reassign
+ container.innerHTML = data; // Check again incase of race condition
+
+ if (hasId && exists()) {
+ return;
+ } // Inject the SVG to the body
+
+
+ document.body.insertAdjacentElement('afterbegin', container);
+ }; // Only load once if ID set
+
+
+ if (!hasId || !exists()) {
+ var useStorage = Storage.supported; // Create container
+
+ var container = document.createElement('div');
+ container.setAttribute('hidden', '');
+
+ if (hasId) {
+ container.setAttribute('id', id);
+ } // Check in cache
+
+
+ if (useStorage) {
+ var cached = window.localStorage.getItem("".concat(prefix, "-").concat(id));
+ isCached = cached !== null;
+
+ if (isCached) {
+ var data = JSON.parse(cached);
+ update(container, data.content);
+ }
+ } // Get the sprite
+
+
+ fetch(url).then(function (result) {
+ if (is$1.empty(result)) {
+ return;
+ }
+
+ if (useStorage) {
+ window.localStorage.setItem("".concat(prefix, "-").concat(id), JSON.stringify({
+ content: result
+ }));
+ }
+
+ update(container, result);
+ }).catch(function () {});
+ }
+ }
+
+ var ceil$1 = Math.ceil;
+ var floor$5 = Math.floor;
+
+ // `Math.trunc` method
+ // https://tc39.github.io/ecma262/#sec-math.trunc
+ _export({ target: 'Math', stat: true }, {
+ trunc: function trunc(it) {
+ return (it > 0 ? floor$5 : ceil$1)(it);
+ }
+ });
+
+ var getHours = function getHours(value) {
+ return Math.trunc(value / 60 / 60 % 60, 10);
+ };
+ var getMinutes = function getMinutes(value) {
+ return Math.trunc(value / 60 % 60, 10);
+ };
+ var getSeconds = function getSeconds(value) {
+ return Math.trunc(value % 60, 10);
+ }; // Format time to UI friendly string
+
+ function formatTime() {
+ var time = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
+ var displayHours = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
+ var inverted = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
+
+ // Bail if the value isn't a number
+ if (!is$1.number(time)) {
+ return formatTime(undefined, displayHours, inverted);
+ } // Format time component to add leading zero
+
+
+ var format = function format(value) {
+ return "0".concat(value).slice(-2);
+ }; // Breakdown to hours, mins, secs
+
+
+ var hours = getHours(time);
+ var mins = getMinutes(time);
+ var secs = getSeconds(time); // Do we need to display hours?
+
+ if (displayHours || hours > 0) {
+ hours = "".concat(hours, ":");
+ } else {
+ hours = '';
+ } // Render
+
+
+ return "".concat(inverted && time > 0 ? '-' : '').concat(hours).concat(format(mins), ":").concat(format(secs));
+ }
+
+ var controls = {
+ // Get icon URL
+ getIconUrl: function getIconUrl() {
+ var url = new URL(this.config.iconUrl, window.location);
+ var cors = url.host !== window.location.host || browser.isIE && !window.svg4everybody;
+ return {
+ url: this.config.iconUrl,
+ cors: cors
+ };
+ },
+ // Find the UI controls
+ findElements: function findElements() {
+ try {
+ this.elements.controls = getElement.call(this, this.config.selectors.controls.wrapper); // Buttons
+
+ this.elements.buttons = {
+ play: getElements.call(this, this.config.selectors.buttons.play),
+ pause: getElement.call(this, this.config.selectors.buttons.pause),
+ restart: getElement.call(this, this.config.selectors.buttons.restart),
+ rewind: getElement.call(this, this.config.selectors.buttons.rewind),
+ fastForward: getElement.call(this, this.config.selectors.buttons.fastForward),
+ mute: getElement.call(this, this.config.selectors.buttons.mute),
+ pip: getElement.call(this, this.config.selectors.buttons.pip),
+ airplay: getElement.call(this, this.config.selectors.buttons.airplay),
+ settings: getElement.call(this, this.config.selectors.buttons.settings),
+ captions: getElement.call(this, this.config.selectors.buttons.captions),
+ fullscreen: getElement.call(this, this.config.selectors.buttons.fullscreen)
+ }; // Progress
+
+ this.elements.progress = getElement.call(this, this.config.selectors.progress); // Inputs
+
+ this.elements.inputs = {
+ seek: getElement.call(this, this.config.selectors.inputs.seek),
+ volume: getElement.call(this, this.config.selectors.inputs.volume)
+ }; // Display
+
+ this.elements.display = {
+ buffer: getElement.call(this, this.config.selectors.display.buffer),
+ currentTime: getElement.call(this, this.config.selectors.display.currentTime),
+ duration: getElement.call(this, this.config.selectors.display.duration)
+ }; // Seek tooltip
+
+ if (is$1.element(this.elements.progress)) {
+ this.elements.display.seekTooltip = this.elements.progress.querySelector(".".concat(this.config.classNames.tooltip));
+ }
+
+ return true;
+ } catch (error) {
+ // Log it
+ this.debug.warn('It looks like there is a problem with your custom controls HTML', error); // Restore native video controls
+
+ this.toggleNativeControls(true);
+ return false;
+ }
+ },
+ // Create <svg> icon
+ createIcon: function createIcon(type, attributes) {
+ var namespace = 'http://www.w3.org/2000/svg';
+ var iconUrl = controls.getIconUrl.call(this);
+ var iconPath = "".concat(!iconUrl.cors ? iconUrl.url : '', "#").concat(this.config.iconPrefix); // Create <svg>
+
+ var icon = document.createElementNS(namespace, 'svg');
+ setAttributes(icon, extend(attributes, {
+ 'aria-hidden': 'true',
+ focusable: 'false'
+ })); // Create the <use> to reference sprite
+
+ var use = document.createElementNS(namespace, 'use');
+ var path = "".concat(iconPath, "-").concat(type); // Set `href` attributes
+ // https://github.com/sampotts/plyr/issues/460
+ // https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/xlink:href
+
+ if ('href' in use) {
+ use.setAttributeNS('http://www.w3.org/1999/xlink', 'href', path);
+ } // Always set the older attribute even though it's "deprecated" (it'll be around for ages)
+
+
+ use.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', path); // Add <use> to <svg>
+
+ icon.appendChild(use);
+ return icon;
+ },
+ // Create hidden text label
+ createLabel: function createLabel(key) {
+ var attr = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
+ var text = i18n.get(key, this.config);
+
+ var attributes = _objectSpread2(_objectSpread2({}, attr), {}, {
+ class: [attr.class, this.config.classNames.hidden].filter(Boolean).join(' ')
+ });
+
+ return createElement('span', attributes, text);
+ },
+ // Create a badge
+ createBadge: function createBadge(text) {
+ if (is$1.empty(text)) {
+ return null;
+ }
+
+ var badge = createElement('span', {
+ class: this.config.classNames.menu.value
+ });
+ badge.appendChild(createElement('span', {
+ class: this.config.classNames.menu.badge
+ }, text));
+ return badge;
+ },
+ // Create a <button>
+ createButton: function createButton(buttonType, attr) {
+ var _this = this;
+
+ var attributes = extend({}, attr);
+ var type = toCamelCase(buttonType);
+ var props = {
+ element: 'button',
+ toggle: false,
+ label: null,
+ icon: null,
+ labelPressed: null,
+ iconPressed: null
+ };
+ ['element', 'icon', 'label'].forEach(function (key) {
+ if (Object.keys(attributes).includes(key)) {
+ props[key] = attributes[key];
+ delete attributes[key];
+ }
+ }); // Default to 'button' type to prevent form submission
+
+ if (props.element === 'button' && !Object.keys(attributes).includes('type')) {
+ attributes.type = 'button';
+ } // Set class name
+
+
+ if (Object.keys(attributes).includes('class')) {
+ if (!attributes.class.split(' ').some(function (c) {
+ return c === _this.config.classNames.control;
+ })) {
+ extend(attributes, {
+ class: "".concat(attributes.class, " ").concat(this.config.classNames.control)
+ });
+ }
+ } else {
+ attributes.class = this.config.classNames.control;
+ } // Large play button
+
+
+ switch (buttonType) {
+ case 'play':
+ props.toggle = true;
+ props.label = 'play';
+ props.labelPressed = 'pause';
+ props.icon = 'play';
+ props.iconPressed = 'pause';
+ break;
+
+ case 'mute':
+ props.toggle = true;
+ props.label = 'mute';
+ props.labelPressed = 'unmute';
+ props.icon = 'volume';
+ props.iconPressed = 'muted';
+ break;
+
+ case 'captions':
+ props.toggle = true;
+ props.label = 'enableCaptions';
+ props.labelPressed = 'disableCaptions';
+ props.icon = 'captions-off';
+ props.iconPressed = 'captions-on';
+ break;
+
+ case 'fullscreen':
+ props.toggle = true;
+ props.label = 'enterFullscreen';
+ props.labelPressed = 'exitFullscreen';
+ props.icon = 'enter-fullscreen';
+ props.iconPressed = 'exit-fullscreen';
+ break;
+
+ case 'play-large':
+ attributes.class += " ".concat(this.config.classNames.control, "--overlaid");
+ type = 'play';
+ props.label = 'play';
+ props.icon = 'play';
+ break;
+
+ default:
+ if (is$1.empty(props.label)) {
+ props.label = type;
+ }
+
+ if (is$1.empty(props.icon)) {
+ props.icon = buttonType;
+ }
+
+ }
+
+ var button = createElement(props.element); // Setup toggle icon and labels
+
+ if (props.toggle) {
+ // Icon
+ button.appendChild(controls.createIcon.call(this, props.iconPressed, {
+ class: 'icon--pressed'
+ }));
+ button.appendChild(controls.createIcon.call(this, props.icon, {
+ class: 'icon--not-pressed'
+ })); // Label/Tooltip
+
+ button.appendChild(controls.createLabel.call(this, props.labelPressed, {
+ class: 'label--pressed'
+ }));
+ button.appendChild(controls.createLabel.call(this, props.label, {
+ class: 'label--not-pressed'
+ }));
+ } else {
+ button.appendChild(controls.createIcon.call(this, props.icon));
+ button.appendChild(controls.createLabel.call(this, props.label));
+ } // Merge and set attributes
+
+
+ extend(attributes, getAttributesFromSelector(this.config.selectors.buttons[type], attributes));
+ setAttributes(button, attributes); // We have multiple play buttons
+
+ if (type === 'play') {
+ if (!is$1.array(this.elements.buttons[type])) {
+ this.elements.buttons[type] = [];
+ }
+
+ this.elements.buttons[type].push(button);
+ } else {
+ this.elements.buttons[type] = button;
+ }
+
+ return button;
+ },
+ // Create an <input type='range'>
+ createRange: function createRange(type, attributes) {
+ // Seek input
+ var input = createElement('input', extend(getAttributesFromSelector(this.config.selectors.inputs[type]), {
+ type: 'range',
+ min: 0,
+ max: 100,
+ step: 0.01,
+ value: 0,
+ autocomplete: 'off',
+ // A11y fixes for https://github.com/sampotts/plyr/issues/905
+ role: 'slider',
+ 'aria-label': i18n.get(type, this.config),
+ 'aria-valuemin': 0,
+ 'aria-valuemax': 100,
+ 'aria-valuenow': 0
+ }, attributes));
+ this.elements.inputs[type] = input; // Set the fill for webkit now
+
+ controls.updateRangeFill.call(this, input); // Improve support on touch devices
+
+ RangeTouch.setup(input);
+ return input;
+ },
+ // Create a <progress>
+ createProgress: function createProgress(type, attributes) {
+ var progress = createElement('progress', extend(getAttributesFromSelector(this.config.selectors.display[type]), {
+ min: 0,
+ max: 100,
+ value: 0,
+ role: 'progressbar',
+ 'aria-hidden': true
+ }, attributes)); // Create the label inside
+
+ if (type !== 'volume') {
+ progress.appendChild(createElement('span', null, '0'));
+ var suffixKey = {
+ played: 'played',
+ buffer: 'buffered'
+ }[type];
+ var suffix = suffixKey ? i18n.get(suffixKey, this.config) : '';
+ progress.innerText = "% ".concat(suffix.toLowerCase());
+ }
+
+ this.elements.display[type] = progress;
+ return progress;
+ },
+ // Create time display
+ createTime: function createTime(type, attrs) {
+ var attributes = getAttributesFromSelector(this.config.selectors.display[type], attrs);
+ var container = createElement('div', extend(attributes, {
+ class: "".concat(attributes.class ? attributes.class : '', " ").concat(this.config.classNames.display.time, " ").trim(),
+ 'aria-label': i18n.get(type, this.config)
+ }), '00:00'); // Reference for updates
+
+ this.elements.display[type] = container;
+ return container;
+ },
+ // Bind keyboard shortcuts for a menu item
+ // We have to bind to keyup otherwise Firefox triggers a click when a keydown event handler shifts focus
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=1220143
+ bindMenuItemShortcuts: function bindMenuItemShortcuts(menuItem, type) {
+ var _this2 = this;
+
+ // Navigate through menus via arrow keys and space
+ on.call(this, menuItem, 'keydown keyup', function (event) {
+ // We only care about space and ⬆️ ⬇️️ ➡️
+ if (![32, 38, 39, 40].includes(event.which)) {
+ return;
+ } // Prevent play / seek
+
+
+ event.preventDefault();
+ event.stopPropagation(); // We're just here to prevent the keydown bubbling
+
+ if (event.type === 'keydown') {
+ return;
+ }
+
+ var isRadioButton = matches$1(menuItem, '[role="menuitemradio"]'); // Show the respective menu
+
+ if (!isRadioButton && [32, 39].includes(event.which)) {
+ controls.showMenuPanel.call(_this2, type, true);
+ } else {
+ var target;
+
+ if (event.which !== 32) {
+ if (event.which === 40 || isRadioButton && event.which === 39) {
+ target = menuItem.nextElementSibling;
+
+ if (!is$1.element(target)) {
+ target = menuItem.parentNode.firstElementChild;
+ }
+ } else {
+ target = menuItem.previousElementSibling;
+
+ if (!is$1.element(target)) {
+ target = menuItem.parentNode.lastElementChild;
+ }
+ }
+
+ setFocus.call(_this2, target, true);
+ }
+ }
+ }, false); // Enter will fire a `click` event but we still need to manage focus
+ // So we bind to keyup which fires after and set focus here
+
+ on.call(this, menuItem, 'keyup', function (event) {
+ if (event.which !== 13) {
+ return;
+ }
+
+ controls.focusFirstMenuItem.call(_this2, null, true);
+ });
+ },
+ // Create a settings menu item
+ createMenuItem: function createMenuItem(_ref) {
+ var _this3 = this;
+
+ var value = _ref.value,
+ list = _ref.list,
+ type = _ref.type,
+ title = _ref.title,
+ _ref$badge = _ref.badge,
+ badge = _ref$badge === void 0 ? null : _ref$badge,
+ _ref$checked = _ref.checked,
+ checked = _ref$checked === void 0 ? false : _ref$checked;
+ var attributes = getAttributesFromSelector(this.config.selectors.inputs[type]);
+ var menuItem = createElement('button', extend(attributes, {
+ type: 'button',
+ role: 'menuitemradio',
+ class: "".concat(this.config.classNames.control, " ").concat(attributes.class ? attributes.class : '').trim(),
+ 'aria-checked': checked,
+ value: value
+ }));
+ var flex = createElement('span'); // We have to set as HTML incase of special characters
+
+ flex.innerHTML = title;
+
+ if (is$1.element(badge)) {
+ flex.appendChild(badge);
+ }
+
+ menuItem.appendChild(flex); // Replicate radio button behaviour
+
+ Object.defineProperty(menuItem, 'checked', {
+ enumerable: true,
+ get: function get() {
+ return menuItem.getAttribute('aria-checked') === 'true';
+ },
+ set: function set(check) {
+ // Ensure exclusivity
+ if (check) {
+ Array.from(menuItem.parentNode.children).filter(function (node) {
+ return matches$1(node, '[role="menuitemradio"]');
+ }).forEach(function (node) {
+ return node.setAttribute('aria-checked', 'false');
+ });
+ }
+
+ menuItem.setAttribute('aria-checked', check ? 'true' : 'false');
+ }
+ });
+ this.listeners.bind(menuItem, 'click keyup', function (event) {
+ if (is$1.keyboardEvent(event) && event.which !== 32) {
+ return;
+ }
+
+ event.preventDefault();
+ event.stopPropagation();
+ menuItem.checked = true;
+
+ switch (type) {
+ case 'language':
+ _this3.currentTrack = Number(value);
+ break;
+
+ case 'quality':
+ _this3.quality = value;
+ break;
+
+ case 'speed':
+ _this3.speed = parseFloat(value);
+ break;
+ }
+
+ controls.showMenuPanel.call(_this3, 'home', is$1.keyboardEvent(event));
+ }, type, false);
+ controls.bindMenuItemShortcuts.call(this, menuItem, type);
+ list.appendChild(menuItem);
+ },
+ // Format a time for display
+ formatTime: function formatTime$1() {
+ var time = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
+ var inverted = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
+
+ // Bail if the value isn't a number
+ if (!is$1.number(time)) {
+ return time;
+ } // Always display hours if duration is over an hour
+
+
+ var forceHours = getHours(this.duration) > 0;
+ return formatTime(time, forceHours, inverted);
+ },
+ // Update the displayed time
+ updateTimeDisplay: function updateTimeDisplay() {
+ var target = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
+ var time = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
+ var inverted = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
+
+ // Bail if there's no element to display or the value isn't a number
+ if (!is$1.element(target) || !is$1.number(time)) {
+ return;
+ } // eslint-disable-next-line no-param-reassign
+
+
+ target.innerText = controls.formatTime(time, inverted);
+ },
+ // Update volume UI and storage
+ updateVolume: function updateVolume() {
+ if (!this.supported.ui) {
+ return;
+ } // Update range
+
+
+ if (is$1.element(this.elements.inputs.volume)) {
+ controls.setRange.call(this, this.elements.inputs.volume, this.muted ? 0 : this.volume);
+ } // Update mute state
+
+
+ if (is$1.element(this.elements.buttons.mute)) {
+ this.elements.buttons.mute.pressed = this.muted || this.volume === 0;
+ }
+ },
+ // Update seek value and lower fill
+ setRange: function setRange(target) {
+ var value = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
+
+ if (!is$1.element(target)) {
+ return;
+ } // eslint-disable-next-line
+
+
+ target.value = value; // Webkit range fill
+
+ controls.updateRangeFill.call(this, target);
+ },
+ // Update <progress> elements
+ updateProgress: function updateProgress(event) {
+ var _this4 = this;
+
+ if (!this.supported.ui || !is$1.event(event)) {
+ return;
+ }
+
+ var value = 0;
+
+ var setProgress = function setProgress(target, input) {
+ var val = is$1.number(input) ? input : 0;
+ var progress = is$1.element(target) ? target : _this4.elements.display.buffer; // Update value and label
+
+ if (is$1.element(progress)) {
+ progress.value = val; // Update text label inside
+
+ var label = progress.getElementsByTagName('span')[0];
+
+ if (is$1.element(label)) {
+ label.childNodes[0].nodeValue = val;
+ }
+ }
+ };
+
+ if (event) {
+ switch (event.type) {
+ // Video playing
+ case 'timeupdate':
+ case 'seeking':
+ case 'seeked':
+ value = getPercentage(this.currentTime, this.duration); // Set seek range value only if it's a 'natural' time event
+
+ if (event.type === 'timeupdate') {
+ controls.setRange.call(this, this.elements.inputs.seek, value);
+ }
+
+ break;
+ // Check buffer status
+
+ case 'playing':
+ case 'progress':
+ setProgress(this.elements.display.buffer, this.buffered * 100);
+ break;
+ }
+ }
+ },
+ // Webkit polyfill for lower fill range
+ updateRangeFill: function updateRangeFill(target) {
+ // Get range from event if event passed
+ var range = is$1.event(target) ? target.target : target; // Needs to be a valid <input type='range'>
+
+ if (!is$1.element(range) || range.getAttribute('type') !== 'range') {
+ return;
+ } // Set aria values for https://github.com/sampotts/plyr/issues/905
+
+
+ if (matches$1(range, this.config.selectors.inputs.seek)) {
+ range.setAttribute('aria-valuenow', this.currentTime);
+ var currentTime = controls.formatTime(this.currentTime);
+ var duration = controls.formatTime(this.duration);
+ var format = i18n.get('seekLabel', this.config);
+ range.setAttribute('aria-valuetext', format.replace('{currentTime}', currentTime).replace('{duration}', duration));
+ } else if (matches$1(range, this.config.selectors.inputs.volume)) {
+ var percent = range.value * 100;
+ range.setAttribute('aria-valuenow', percent);
+ range.setAttribute('aria-valuetext', "".concat(percent.toFixed(1), "%"));
+ } else {
+ range.setAttribute('aria-valuenow', range.value);
+ } // WebKit only
+
+
+ if (!browser.isWebkit) {
+ return;
+ } // Set CSS custom property
+
+
+ range.style.setProperty('--value', "".concat(range.value / range.max * 100, "%"));
+ },
+ // Update hover tooltip for seeking
+ updateSeekTooltip: function updateSeekTooltip(event) {
+ var _this5 = this;
+
+ // Bail if setting not true
+ if (!this.config.tooltips.seek || !is$1.element(this.elements.inputs.seek) || !is$1.element(this.elements.display.seekTooltip) || this.duration === 0) {
+ return;
+ }
+
+ var visible = "".concat(this.config.classNames.tooltip, "--visible");
+
+ var toggle = function toggle(show) {
+ return toggleClass(_this5.elements.display.seekTooltip, visible, show);
+ }; // Hide on touch
+
+
+ if (this.touch) {
+ toggle(false);
+ return;
+ } // Determine percentage, if already visible
+
+
+ var percent = 0;
+ var clientRect = this.elements.progress.getBoundingClientRect();
+
+ if (is$1.event(event)) {
+ percent = 100 / clientRect.width * (event.pageX - clientRect.left);
+ } else if (hasClass(this.elements.display.seekTooltip, visible)) {
+ percent = parseFloat(this.elements.display.seekTooltip.style.left, 10);
+ } else {
+ return;
+ } // Set bounds
+
+
+ if (percent < 0) {
+ percent = 0;
+ } else if (percent > 100) {
+ percent = 100;
+ } // Display the time a click would seek to
+
+
+ controls.updateTimeDisplay.call(this, this.elements.display.seekTooltip, this.duration / 100 * percent); // Set position
+
+ this.elements.display.seekTooltip.style.left = "".concat(percent, "%"); // Show/hide the tooltip
+ // If the event is a moues in/out and percentage is inside bounds
+
+ if (is$1.event(event) && ['mouseenter', 'mouseleave'].includes(event.type)) {
+ toggle(event.type === 'mouseenter');
+ }
+ },
+ // Handle time change event
+ timeUpdate: function timeUpdate(event) {
+ // Only invert if only one time element is displayed and used for both duration and currentTime
+ var invert = !is$1.element(this.elements.display.duration) && this.config.invertTime; // Duration
+
+ controls.updateTimeDisplay.call(this, this.elements.display.currentTime, invert ? this.duration - this.currentTime : this.currentTime, invert); // Ignore updates while seeking
+
+ if (event && event.type === 'timeupdate' && this.media.seeking) {
+ return;
+ } // Playing progress
+
+
+ controls.updateProgress.call(this, event);
+ },
+ // Show the duration on metadataloaded or durationchange events
+ durationUpdate: function durationUpdate() {
+ // Bail if no UI or durationchange event triggered after playing/seek when invertTime is false
+ if (!this.supported.ui || !this.config.invertTime && this.currentTime) {
+ return;
+ } // 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.
+ // https://github.com/video-dev/hls.js/blob/5820d29d3c4c8a46e8b75f1e3afa3e68c1a9a2db/src/controller/buffer-controller.js#L415
+ // https://github.com/google/shaka-player/blob/4d889054631f4e1cf0fbd80ddd2b71887c02e232/lib/media/streaming_engine.js#L1062
+ // https://github.com/Dash-Industry-Forum/dash.js/blob/69859f51b969645b234666800d4cb596d89c602d/src/dash/models/DashManifestModel.js#L338
+
+
+ if (this.duration >= Math.pow(2, 32)) {
+ toggleHidden(this.elements.display.currentTime, true);
+ toggleHidden(this.elements.progress, true);
+ return;
+ } // Update ARIA values
+
+
+ if (is$1.element(this.elements.inputs.seek)) {
+ this.elements.inputs.seek.setAttribute('aria-valuemax', this.duration);
+ } // If there's a spot to display duration
+
+
+ var hasDuration = is$1.element(this.elements.display.duration); // If there's only one time display, display duration there
+
+ if (!hasDuration && this.config.displayDuration && this.paused) {
+ controls.updateTimeDisplay.call(this, this.elements.display.currentTime, this.duration);
+ } // If there's a duration element, update content
+
+
+ if (hasDuration) {
+ controls.updateTimeDisplay.call(this, this.elements.display.duration, this.duration);
+ } // Update the tooltip (if visible)
+
+
+ controls.updateSeekTooltip.call(this);
+ },
+ // Hide/show a tab
+ toggleMenuButton: function toggleMenuButton(setting, toggle) {
+ toggleHidden(this.elements.settings.buttons[setting], !toggle);
+ },
+ // Update the selected setting
+ updateSetting: function updateSetting(setting, container, input) {
+ var pane = this.elements.settings.panels[setting];
+ var value = null;
+ var list = container;
+
+ if (setting === 'captions') {
+ value = this.currentTrack;
+ } else {
+ value = !is$1.empty(input) ? input : this[setting]; // Get default
+
+ if (is$1.empty(value)) {
+ value = this.config[setting].default;
+ } // Unsupported value
+
+
+ if (!is$1.empty(this.options[setting]) && !this.options[setting].includes(value)) {
+ this.debug.warn("Unsupported value of '".concat(value, "' for ").concat(setting));
+ return;
+ } // Disabled value
+
+
+ if (!this.config[setting].options.includes(value)) {
+ this.debug.warn("Disabled value of '".concat(value, "' for ").concat(setting));
+ return;
+ }
+ } // Get the list if we need to
+
+
+ if (!is$1.element(list)) {
+ list = pane && pane.querySelector('[role="menu"]');
+ } // If there's no list it means it's not been rendered...
+
+
+ if (!is$1.element(list)) {
+ return;
+ } // Update the label
+
+
+ var label = this.elements.settings.buttons[setting].querySelector(".".concat(this.config.classNames.menu.value));
+ label.innerHTML = controls.getLabel.call(this, setting, value); // Find the radio option and check it
+
+ var target = list && list.querySelector("[value=\"".concat(value, "\"]"));
+
+ if (is$1.element(target)) {
+ target.checked = true;
+ }
+ },
+ // Translate a value into a nice label
+ getLabel: function getLabel(setting, value) {
+ switch (setting) {
+ case 'speed':
+ return value === 1 ? i18n.get('normal', this.config) : "".concat(value, "&times;");
+
+ case 'quality':
+ if (is$1.number(value)) {
+ var label = i18n.get("qualityLabel.".concat(value), this.config);
+
+ if (!label.length) {
+ return "".concat(value, "p");
+ }
+
+ return label;
+ }
+
+ return toTitleCase(value);
+
+ case 'captions':
+ return captions.getLabel.call(this);
+
+ default:
+ return null;
+ }
+ },
+ // Set the quality menu
+ setQualityMenu: function setQualityMenu(options) {
+ var _this6 = this;
+
+ // Menu required
+ if (!is$1.element(this.elements.settings.panels.quality)) {
+ return;
+ }
+
+ var type = 'quality';
+ var list = this.elements.settings.panels.quality.querySelector('[role="menu"]'); // Set options if passed and filter based on uniqueness and config
+
+ if (is$1.array(options)) {
+ this.options.quality = dedupe(options).filter(function (quality) {
+ return _this6.config.quality.options.includes(quality);
+ });
+ } // Toggle the pane and tab
+
+
+ var toggle = !is$1.empty(this.options.quality) && this.options.quality.length > 1;
+ controls.toggleMenuButton.call(this, type, toggle); // Empty the menu
+
+ emptyElement(list); // Check if we need to toggle the parent
+
+ controls.checkMenu.call(this); // If we're hiding, nothing more to do
+
+ if (!toggle) {
+ return;
+ } // Get the badge HTML for HD, 4K etc
+
+
+ var getBadge = function getBadge(quality) {
+ var label = i18n.get("qualityBadge.".concat(quality), _this6.config);
+
+ if (!label.length) {
+ return null;
+ }
+
+ return controls.createBadge.call(_this6, label);
+ }; // Sort options by the config and then render options
+
+
+ this.options.quality.sort(function (a, b) {
+ var sorting = _this6.config.quality.options;
+ return sorting.indexOf(a) > sorting.indexOf(b) ? 1 : -1;
+ }).forEach(function (quality) {
+ controls.createMenuItem.call(_this6, {
+ value: quality,
+ list: list,
+ type: type,
+ title: controls.getLabel.call(_this6, 'quality', quality),
+ badge: getBadge(quality)
+ });
+ });
+ controls.updateSetting.call(this, type, list);
+ },
+ // Set the looping options
+
+ /* setLoopMenu() {
+ // Menu required
+ if (!is.element(this.elements.settings.panels.loop)) {
+ return;
+ }
+ const options = ['start', 'end', 'all', 'reset'];
+ const list = this.elements.settings.panels.loop.querySelector('[role="menu"]');
+ // Show the pane and tab
+ toggleHidden(this.elements.settings.buttons.loop, false);
+ toggleHidden(this.elements.settings.panels.loop, false);
+ // Toggle the pane and tab
+ const toggle = !is.empty(this.loop.options);
+ controls.toggleMenuButton.call(this, 'loop', toggle);
+ // Empty the menu
+ emptyElement(list);
+ options.forEach(option => {
+ const item = createElement('li');
+ const button = createElement(
+ 'button',
+ extend(getAttributesFromSelector(this.config.selectors.buttons.loop), {
+ type: 'button',
+ class: this.config.classNames.control,
+ 'data-plyr-loop-action': option,
+ }),
+ i18n.get(option, this.config)
+ );
+ if (['start', 'end'].includes(option)) {
+ const badge = controls.createBadge.call(this, '00:00');
+ button.appendChild(badge);
+ }
+ item.appendChild(button);
+ list.appendChild(item);
+ });
+ }, */
+ // Get current selected caption language
+ // TODO: rework this to user the getter in the API?
+ // Set a list of available captions languages
+ setCaptionsMenu: function setCaptionsMenu() {
+ var _this7 = this;
+
+ // Menu required
+ if (!is$1.element(this.elements.settings.panels.captions)) {
+ return;
+ } // TODO: Captions or language? Currently it's mixed
+
+
+ var type = 'captions';
+ var list = this.elements.settings.panels.captions.querySelector('[role="menucaptions"]');
+ var tracks = captions.getTracks.call(this);
+ var toggle = Boolean(tracks.length); // Toggle the pane and tab
+
+ controls.toggleMenuButton.call(this, type, toggle); // Empty the menu
+
+ emptyElement(list); // Check if we need to toggle the parent
+
+ controls.checkMenu.call(this); // If there's no captions, bail
+
+ if (!toggle) {
+ return;
+ } // Generate options data
+
+
+ var options = tracks.map(function (track, value) {
+ return {
+ value: value,
+ checked: _this7.captions.toggled && _this7.currentTrack === value,
+ title: captions.getLabel.call(_this7, track),
+ badge: track.language && controls.createBadge.call(_this7, track.language.toUpperCase()),
+ list: list,
+ type: 'language'
+ };
+ }); // Add the "Disabled" option to turn off captions
+
+ options.unshift({
+ value: -1,
+ checked: !this.captions.toggled,
+ title: i18n.get('disabled', this.config),
+ list: list,
+ type: 'language'
+ }); // Generate options
+
+ options.forEach(controls.createMenuItem.bind(this));
+ controls.updateSetting.call(this, type, list);
+ },
+ // Set a list of available captions languages
+ setSpeedMenu: function setSpeedMenu() {
+ var _this8 = this;
+
+ // Menu required
+ if (!is$1.element(this.elements.settings.panels.speed)) {
+ return;
+ }
+
+ var type = 'speed';
+ var list = this.elements.settings.panels.speed.querySelector('[role="menu"]'); // Filter out invalid speeds
+
+ this.options.speed = this.options.speed.filter(function (o) {
+ return o >= _this8.minimumSpeed && o <= _this8.maximumSpeed;
+ }); // Toggle the pane and tab
+
+ var toggle = !is$1.empty(this.options.speed) && this.options.speed.length > 1;
+ controls.toggleMenuButton.call(this, type, toggle); // Empty the menu
+
+ emptyElement(list); // Check if we need to toggle the parent
+
+ controls.checkMenu.call(this); // If we're hiding, nothing more to do
+
+ if (!toggle) {
+ return;
+ } // Create items
+
+
+ this.options.speed.forEach(function (speed) {
+ controls.createMenuItem.call(_this8, {
+ value: speed,
+ list: list,
+ type: type,
+ title: controls.getLabel.call(_this8, 'speed', speed)
+ });
+ });
+ controls.updateSetting.call(this, type, list);
+ },
+ // Check if we need to hide/show the settings menu
+ checkMenu: function checkMenu() {
+ var buttons = this.elements.settings.buttons;
+ var visible = !is$1.empty(buttons) && Object.values(buttons).some(function (button) {
+ return !button.hidden;
+ });
+ toggleHidden(this.elements.settings.menu, !visible);
+ },
+ // Focus the first menu item in a given (or visible) menu
+ focusFirstMenuItem: function focusFirstMenuItem(pane) {
+ var tabFocus = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
+
+ if (this.elements.settings.popup.hidden) {
+ return;
+ }
+
+ var target = pane;
+
+ if (!is$1.element(target)) {
+ target = Object.values(this.elements.settings.panels).find(function (p) {
+ return !p.hidden;
+ });
+ }
+
+ var firstItem = target.querySelector('[role^="menuitem"]');
+ setFocus.call(this, firstItem, tabFocus);
+ },
+ // Show/hide menu
+ toggleMenu: function toggleMenu(input) {
+ var popup = this.elements.settings.popup;
+ var button = this.elements.buttons.settings; // Menu and button are required
+
+ if (!is$1.element(popup) || !is$1.element(button)) {
+ return;
+ } // True toggle by default
+
+
+ var hidden = popup.hidden;
+ var show = hidden;
+
+ if (is$1.boolean(input)) {
+ show = input;
+ } else if (is$1.keyboardEvent(input) && input.which === 27) {
+ show = false;
+ } else if (is$1.event(input)) {
+ // If Plyr is in a shadowDOM, the event target is set to the component, instead of the
+ // Element in the shadowDOM. The path, if available, is complete.
+ var target = is$1.function(input.composedPath) ? input.composedPath()[0] : input.target;
+ var isMenuItem = popup.contains(target); // If the click was inside the menu or if the click
+ // wasn't the button or menu item and we're trying to
+ // show the menu (a doc click shouldn't show the menu)
+
+ if (isMenuItem || !isMenuItem && input.target !== button && show) {
+ return;
+ }
+ } // Set button attributes
+
+
+ button.setAttribute('aria-expanded', show); // Show the actual popup
+
+ toggleHidden(popup, !show); // Add class hook
+
+ toggleClass(this.elements.container, this.config.classNames.menu.open, show); // Focus the first item if key interaction
+
+ if (show && is$1.keyboardEvent(input)) {
+ controls.focusFirstMenuItem.call(this, null, true);
+ } else if (!show && !hidden) {
+ // If closing, re-focus the button
+ setFocus.call(this, button, is$1.keyboardEvent(input));
+ }
+ },
+ // Get the natural size of a menu panel
+ getMenuSize: function getMenuSize(tab) {
+ var clone = tab.cloneNode(true);
+ clone.style.position = 'absolute';
+ clone.style.opacity = 0;
+ clone.removeAttribute('hidden'); // Append to parent so we get the "real" size
+
+ tab.parentNode.appendChild(clone); // Get the sizes before we remove
+
+ var width = clone.scrollWidth;
+ var height = clone.scrollHeight; // Remove from the DOM
+
+ removeElement(clone);
+ return {
+ width: width,
+ height: height
+ };
+ },
+ // Show a panel in the menu
+ showMenuPanel: function showMenuPanel() {
+ var _this9 = this;
+
+ var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
+ var tabFocus = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
+ var target = this.elements.container.querySelector("#plyr-settings-".concat(this.id, "-").concat(type)); // Nothing to show, bail
+
+ if (!is$1.element(target)) {
+ return;
+ } // Hide all other panels
+
+
+ var container = target.parentNode;
+ var current = Array.from(container.children).find(function (node) {
+ return !node.hidden;
+ }); // If we can do fancy animations, we'll animate the height/width
+
+ if (support.transitions && !support.reducedMotion) {
+ // Set the current width as a base
+ container.style.width = "".concat(current.scrollWidth, "px");
+ container.style.height = "".concat(current.scrollHeight, "px"); // Get potential sizes
+
+ var size = controls.getMenuSize.call(this, target); // Restore auto height/width
+
+ var restore = function restore(event) {
+ // We're only bothered about height and width on the container
+ if (event.target !== container || !['width', 'height'].includes(event.propertyName)) {
+ return;
+ } // Revert back to auto
+
+
+ container.style.width = '';
+ container.style.height = ''; // Only listen once
+
+ off.call(_this9, container, transitionEndEvent, restore);
+ }; // Listen for the transition finishing and restore auto height/width
+
+
+ on.call(this, container, transitionEndEvent, restore); // Set dimensions to target
+
+ container.style.width = "".concat(size.width, "px");
+ container.style.height = "".concat(size.height, "px");
+ } // Set attributes on current tab
+
+
+ toggleHidden(current, true); // Set attributes on target
+
+ toggleHidden(target, false); // Focus the first item
+
+ controls.focusFirstMenuItem.call(this, target, tabFocus);
+ },
+ // Set the download URL
+ setDownloadUrl: function setDownloadUrl() {
+ var button = this.elements.buttons.download; // Bail if no button
+
+ if (!is$1.element(button)) {
+ return;
+ } // Set attribute
+
+
+ button.setAttribute('href', this.download);
+ },
+ // Build the default HTML
+ create: function create(data) {
+ var _this10 = this;
+
+ var bindMenuItemShortcuts = controls.bindMenuItemShortcuts,
+ createButton = controls.createButton,
+ createProgress = controls.createProgress,
+ createRange = controls.createRange,
+ createTime = controls.createTime,
+ setQualityMenu = controls.setQualityMenu,
+ setSpeedMenu = controls.setSpeedMenu,
+ showMenuPanel = controls.showMenuPanel;
+ this.elements.controls = null; // Larger overlaid play button
+
+ if (is$1.array(this.config.controls) && this.config.controls.includes('play-large')) {
+ this.elements.container.appendChild(createButton.call(this, 'play-large'));
+ } // Create the container
+
+
+ var container = createElement('div', getAttributesFromSelector(this.config.selectors.controls.wrapper));
+ this.elements.controls = container; // Default item attributes
+
+ var defaultAttributes = {
+ class: 'plyr__controls__item'
+ }; // Loop through controls in order
+
+ dedupe(is$1.array(this.config.controls) ? this.config.controls : []).forEach(function (control) {
+ // Restart button
+ if (control === 'restart') {
+ container.appendChild(createButton.call(_this10, 'restart', defaultAttributes));
+ } // Rewind button
+
+
+ if (control === 'rewind') {
+ container.appendChild(createButton.call(_this10, 'rewind', defaultAttributes));
+ } // Play/Pause button
+
+
+ if (control === 'play') {
+ container.appendChild(createButton.call(_this10, 'play', defaultAttributes));
+ } // Fast forward button
+
+
+ if (control === 'fast-forward') {
+ container.appendChild(createButton.call(_this10, 'fast-forward', defaultAttributes));
+ } // Progress
+
+
+ if (control === 'progress') {
+ var progressContainer = createElement('div', {
+ class: "".concat(defaultAttributes.class, " plyr__progress__container")
+ });
+ var progress = createElement('div', getAttributesFromSelector(_this10.config.selectors.progress)); // Seek range slider
+
+ progress.appendChild(createRange.call(_this10, 'seek', {
+ id: "plyr-seek-".concat(data.id)
+ })); // Buffer progress
+
+ progress.appendChild(createProgress.call(_this10, 'buffer')); // TODO: Add loop display indicator
+ // Seek tooltip
+
+ if (_this10.config.tooltips.seek) {
+ var tooltip = createElement('span', {
+ class: _this10.config.classNames.tooltip
+ }, '00:00');
+ progress.appendChild(tooltip);
+ _this10.elements.display.seekTooltip = tooltip;
+ }
+
+ _this10.elements.progress = progress;
+ progressContainer.appendChild(_this10.elements.progress);
+ container.appendChild(progressContainer);
+ } // Media current time display
+
+
+ if (control === 'current-time') {
+ container.appendChild(createTime.call(_this10, 'currentTime', defaultAttributes));
+ } // Media duration display
+
+
+ if (control === 'duration') {
+ container.appendChild(createTime.call(_this10, 'duration', defaultAttributes));
+ } // Volume controls
+
+
+ if (control === 'mute' || control === 'volume') {
+ var volume = _this10.elements.volume; // Create the volume container if needed
+
+ if (!is$1.element(volume) || !container.contains(volume)) {
+ volume = createElement('div', extend({}, defaultAttributes, {
+ class: "".concat(defaultAttributes.class, " plyr__volume").trim()
+ }));
+ _this10.elements.volume = volume;
+ container.appendChild(volume);
+ } // Toggle mute button
+
+
+ if (control === 'mute') {
+ volume.appendChild(createButton.call(_this10, 'mute'));
+ } // Volume range control
+ // Ignored on iOS as it's handled globally
+ // https://developer.apple.com/library/safari/documentation/AudioVideo/Conceptual/Using_HTML5_Audio_Video/Device-SpecificConsiderations/Device-SpecificConsiderations.html
+
+
+ if (control === 'volume' && !browser.isIos) {
+ // Set the attributes
+ var attributes = {
+ max: 1,
+ step: 0.05,
+ value: _this10.config.volume
+ }; // Create the volume range slider
+
+ volume.appendChild(createRange.call(_this10, 'volume', extend(attributes, {
+ id: "plyr-volume-".concat(data.id)
+ })));
+ }
+ } // Toggle captions button
+
+
+ if (control === 'captions') {
+ container.appendChild(createButton.call(_this10, 'captions', defaultAttributes));
+ } // Settings button / menu
+
+
+ if (control === 'settings' && !is$1.empty(_this10.config.settings)) {
+ var wrapper = createElement('div', extend({}, defaultAttributes, {
+ class: "".concat(defaultAttributes.class, " plyr__menu").trim(),
+ hidden: ''
+ }));
+ wrapper.appendChild(createButton.call(_this10, 'settings', {
+ 'aria-haspopup': true,
+ 'aria-controls': "plyr-settings-".concat(data.id),
+ 'aria-expanded': false
+ }));
+ var popup = createElement('div', {
+ class: 'plyr__menu__container',
+ id: "plyr-settings-".concat(data.id),
+ hidden: ''
+ });
+ var inner = createElement('div');
+ var home = createElement('div', {
+ id: "plyr-settings-".concat(data.id, "-home")
+ }); // Create the menu
+
+ var menu = createElement('div', {
+ role: 'menu'
+ });
+ home.appendChild(menu);
+ inner.appendChild(home);
+ _this10.elements.settings.panels.home = home; // Build the menu items
+
+ _this10.config.settings.forEach(function (type) {
+ // TODO: bundle this with the createMenuItem helper and bindings
+ var menuItem = createElement('button', extend(getAttributesFromSelector(_this10.config.selectors.buttons.settings), {
+ type: 'button',
+ class: "".concat(_this10.config.classNames.control, " ").concat(_this10.config.classNames.control, "--forward"),
+ role: 'menuitem',
+ 'aria-haspopup': true,
+ hidden: ''
+ })); // Bind menu shortcuts for keyboard users
+
+ bindMenuItemShortcuts.call(_this10, menuItem, type); // Show menu on click
+
+ on.call(_this10, menuItem, 'click', function () {
+ showMenuPanel.call(_this10, type, false);
+ });
+ var flex = createElement('span', null, i18n.get(type, _this10.config));
+ var value = createElement('span', {
+ class: _this10.config.classNames.menu.value
+ }); // Speed contains HTML entities
+
+ value.innerHTML = data[type];
+ flex.appendChild(value);
+ menuItem.appendChild(flex);
+ menu.appendChild(menuItem); // Build the panes
+
+ var pane = createElement('div', {
+ id: "plyr-settings-".concat(data.id, "-").concat(type),
+ hidden: ''
+ }); // Back button
+
+ var backButton = createElement('button', {
+ type: 'button',
+ class: "".concat(_this10.config.classNames.control, " ").concat(_this10.config.classNames.control, "--back")
+ }); // Visible label
+
+ backButton.appendChild(createElement('span', {
+ 'aria-hidden': true
+ }, i18n.get(type, _this10.config))); // Screen reader label
+
+ backButton.appendChild(createElement('span', {
+ class: _this10.config.classNames.hidden
+ }, i18n.get('menuBack', _this10.config))); // Go back via keyboard
+
+ on.call(_this10, pane, 'keydown', function (event) {
+ // We only care about <-
+ if (event.which !== 37) {
+ return;
+ } // Prevent seek
+
+
+ event.preventDefault();
+ event.stopPropagation(); // Show the respective menu
+
+ showMenuPanel.call(_this10, 'home', true);
+ }, false); // Go back via button click
+
+ on.call(_this10, backButton, 'click', function () {
+ showMenuPanel.call(_this10, 'home', false);
+ }); // Add to pane
+
+ pane.appendChild(backButton); // Menu
+
+ pane.appendChild(createElement('div', {
+ role: 'menu'
+ })); // Menu Captions
+
+ pane.appendChild(createElement('div', {
+ role: 'menucaptions'
+ }));
+ inner.appendChild(pane);
+ _this10.elements.settings.buttons[type] = menuItem;
+ _this10.elements.settings.panels[type] = pane;
+ });
+
+ popup.appendChild(inner);
+ wrapper.appendChild(popup);
+ container.appendChild(wrapper);
+ _this10.elements.settings.popup = popup;
+ _this10.elements.settings.menu = wrapper;
+ } // Picture in picture button
+
+
+ if (control === 'pip' && support.pip) {
+ container.appendChild(createButton.call(_this10, 'pip', defaultAttributes));
+ } // Airplay button
+
+
+ if (control === 'airplay' && support.airplay) {
+ container.appendChild(createButton.call(_this10, 'airplay', defaultAttributes));
+ } // Download button
+
+
+ if (control === 'download') {
+ var _attributes = extend({}, defaultAttributes, {
+ element: 'a',
+ href: _this10.download,
+ target: '_blank'
+ }); // Set download attribute for HTML5 only
+
+
+ if (_this10.isHTML5) {
+ _attributes.download = '';
+ }
+
+ var download = _this10.config.urls.download;
+
+ if (!is$1.url(download) && _this10.isEmbed) {
+ extend(_attributes, {
+ icon: "logo-".concat(_this10.provider),
+ label: _this10.provider
+ });
+ }
+
+ container.appendChild(createButton.call(_this10, 'download', _attributes));
+ } // Toggle fullscreen button
+
+
+ if (control === 'fullscreen') {
+ container.appendChild(createButton.call(_this10, 'fullscreen', defaultAttributes));
+ }
+ }); // Set available quality levels
+
+ if (this.isHTML5) {
+ setQualityMenu.call(this, html5.getQualityOptions.call(this));
+ }
+
+ setSpeedMenu.call(this);
+ return container;
+ },
+ // Insert controls
+ inject: function inject() {
+ var _this11 = this;
+
+ // Sprite
+ if (this.config.loadSprite) {
+ var icon = controls.getIconUrl.call(this); // Only load external sprite using AJAX
+
+ if (icon.cors) {
+ loadSprite(icon.url, 'sprite-plyr');
+ }
+ } // Create a unique ID
+
+
+ this.id = Math.floor(Math.random() * 10000); // Null by default
+
+ var container = null;
+ this.elements.controls = null; // Set template properties
+
+ var props = {
+ id: this.id,
+ seektime: this.config.seekTime,
+ title: this.config.title
+ };
+ var update = true; // If function, run it and use output
+
+ if (is$1.function(this.config.controls)) {
+ this.config.controls = this.config.controls.call(this, props);
+ } // Convert falsy controls to empty array (primarily for empty strings)
+
+
+ if (!this.config.controls) {
+ this.config.controls = [];
+ }
+
+ if (is$1.element(this.config.controls) || is$1.string(this.config.controls)) {
+ // HTMLElement or Non-empty string passed as the option
+ container = this.config.controls;
+ } else {
+ // Create controls
+ container = controls.create.call(this, {
+ id: this.id,
+ seektime: this.config.seekTime,
+ speed: this.speed,
+ quality: this.quality,
+ captions: captions.getLabel.call(this) // TODO: Looping
+ // loop: 'None',
+
+ });
+ update = false;
+ } // Replace props with their value
+
+
+ var replace = function replace(input) {
+ var result = input;
+ Object.entries(props).forEach(function (_ref2) {
+ var _ref3 = _slicedToArray(_ref2, 2),
+ key = _ref3[0],
+ value = _ref3[1];
+
+ result = replaceAll(result, "{".concat(key, "}"), value);
+ });
+ return result;
+ }; // Update markup
+
+
+ if (update) {
+ if (is$1.string(this.config.controls)) {
+ container = replace(container);
+ }
+ } // Controls container
+
+
+ var target; // Inject to custom location
+
+ if (is$1.string(this.config.selectors.controls.container)) {
+ target = document.querySelector(this.config.selectors.controls.container);
+ } // Inject into the container by default
+
+
+ if (!is$1.element(target)) {
+ target = this.elements.container;
+ } // Inject controls HTML (needs to be before captions, hence "afterbegin")
+
+
+ var insertMethod = is$1.element(container) ? 'insertAdjacentElement' : 'insertAdjacentHTML';
+ target[insertMethod]('afterbegin', container); // Find the elements if need be
+
+ if (!is$1.element(this.elements.controls)) {
+ controls.findElements.call(this);
+ } // Add pressed property to buttons
+
+
+ if (!is$1.empty(this.elements.buttons)) {
+ var addProperty = function addProperty(button) {
+ var className = _this11.config.classNames.controlPressed;
+ Object.defineProperty(button, 'pressed', {
+ enumerable: true,
+ get: function get() {
+ return hasClass(button, className);
+ },
+ set: function set() {
+ var pressed = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
+ toggleClass(button, className, pressed);
+ }
+ });
+ }; // Toggle classname when pressed property is set
+
+
+ Object.values(this.elements.buttons).filter(Boolean).forEach(function (button) {
+ if (is$1.array(button) || is$1.nodeList(button)) {
+ Array.from(button).filter(Boolean).forEach(addProperty);
+ } else {
+ addProperty(button);
+ }
+ });
+ } // Edge sometimes doesn't finish the paint so force a repaint
+
+
+ if (browser.isEdge) {
+ repaint(target);
+ } // Setup tooltips
+
+
+ if (this.config.tooltips.controls) {
+ var _this$config = this.config,
+ classNames = _this$config.classNames,
+ selectors = _this$config.selectors;
+ var selector = "".concat(selectors.controls.wrapper, " ").concat(selectors.labels, " .").concat(classNames.hidden);
+ var labels = getElements.call(this, selector);
+ Array.from(labels).forEach(function (label) {
+ toggleClass(label, _this11.config.classNames.hidden, false);
+ toggleClass(label, _this11.config.classNames.tooltip, true);
+ });
+ }
+ }
+ };
+
+ /**
+ * Parse a string to a URL object
+ * @param {String} input - the URL to be parsed
+ * @param {Boolean} safe - failsafe parsing
+ */
+
+ function parseUrl(input) {
+ var safe = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
+ var url = input;
+
+ if (safe) {
+ var parser = document.createElement('a');
+ parser.href = url;
+ url = parser.href;
+ }
+
+ try {
+ return new URL(url);
+ } catch (e) {
+ return null;
+ }
+ } // Convert object to URLSearchParams
+
+ function buildUrlParams(input) {
+ var params = new URLSearchParams();
+
+ if (is$1.object(input)) {
+ Object.entries(input).forEach(function (_ref) {
+ var _ref2 = _slicedToArray(_ref, 2),
+ key = _ref2[0],
+ value = _ref2[1];
+
+ params.set(key, value);
+ });
+ }
+
+ return params;
+ }
+
+ var captions = {
+ // Setup captions
+ setup: function setup() {
+ // Requires UI support
+ if (!this.supported.ui) {
+ return;
+ } // Only Vimeo and HTML5 video supported at this point
+
+
+ if (!this.isVideo || this.isYouTube || this.isHTML5 && !support.textTracks) {
+ // Clear menu and hide
+ if (is$1.array(this.config.controls) && this.config.controls.includes('settings') && this.config.settings.includes('captions')) {
+ controls.setCaptionsMenu.call(this);
+ }
+
+ return;
+ } // Inject the container
+
+
+ if (!is$1.element(this.elements.captions)) {
+ this.elements.captions = createElement('div', getAttributesFromSelector(this.config.selectors.captions));
+ insertAfter(this.elements.captions, this.elements.wrapper);
+ } // Fix IE captions if CORS is used
+ // Fetch captions and inject as blobs instead (data URIs not supported!)
+
+
+ if (browser.isIE && window.URL) {
+ var elements = this.media.querySelectorAll('track');
+ Array.from(elements).forEach(function (track) {
+ var src = track.getAttribute('src');
+ var url = parseUrl(src);
+
+ if (url !== null && url.hostname !== window.location.href.hostname && ['http:', 'https:'].includes(url.protocol)) {
+ fetch(src, 'blob').then(function (blob) {
+ track.setAttribute('src', window.URL.createObjectURL(blob));
+ }).catch(function () {
+ removeElement(track);
+ });
+ }
+ });
+ } // Get and set initial data
+ // The "preferred" options are not realized unless / until the wanted language has a match
+ // * languages: Array of user's browser languages.
+ // * language: The language preferred by user settings or config
+ // * active: The state preferred by user settings or config
+ // * toggled: The real captions state
+
+
+ var browserLanguages = navigator.languages || [navigator.language || navigator.userLanguage || 'en'];
+ var languages = dedupe(browserLanguages.map(function (language) {
+ return language.split('-')[0];
+ }));
+ var language = (this.storage.get('language') || this.config.captions.language || 'auto').toLowerCase(); // Use first browser language when language is 'auto'
+
+ if (language === 'auto') {
+ var _languages = _slicedToArray(languages, 1);
+
+ language = _languages[0];
+ }
+
+ var active = this.storage.get('captions');
+
+ if (!is$1.boolean(active)) {
+ active = this.config.captions.active;
+ }
+
+ Object.assign(this.captions, {
+ toggled: false,
+ active: active,
+ language: language,
+ languages: languages
+ }); // Watch changes to textTracks and update captions menu
+
+ if (this.isHTML5) {
+ var trackEvents = this.config.captions.update ? 'addtrack removetrack' : 'removetrack';
+ on.call(this, this.media.textTracks, trackEvents, captions.update.bind(this));
+ } // Update available languages in list next tick (the event must not be triggered before the listeners)
+
+
+ setTimeout(captions.update.bind(this), 0);
+ },
+ // Update available language options in settings based on tracks
+ update: function update() {
+ var _this = this;
+
+ var tracks = captions.getTracks.call(this, true); // Get the wanted language
+
+ var _this$captions = this.captions,
+ active = _this$captions.active,
+ language = _this$captions.language,
+ meta = _this$captions.meta,
+ currentTrackNode = _this$captions.currentTrackNode;
+ var languageExists = Boolean(tracks.find(function (track) {
+ return track.language === language;
+ })); // Handle tracks (add event listener and "pseudo"-default)
+
+ if (this.isHTML5 && this.isVideo) {
+ tracks.filter(function (track) {
+ return !meta.get(track);
+ }).forEach(function (track) {
+ _this.debug.log('Track added', track); // Attempt to store if the original dom element was "default"
+
+
+ meta.set(track, {
+ default: track.mode === 'showing'
+ }); // Turn off native caption rendering to avoid double captions
+ // Note: mode='hidden' forces a track to download. To ensure every track
+ // isn't downloaded at once, only 'showing' tracks should be reassigned
+ // eslint-disable-next-line no-param-reassign
+
+ if (track.mode === 'showing') {
+ // eslint-disable-next-line no-param-reassign
+ track.mode = 'hidden';
+ } // Add event listener for cue changes
+
+
+ on.call(_this, track, 'cuechange', function () {
+ return captions.updateCues.call(_this);
+ });
+ });
+ } // Update language first time it matches, or if the previous matching track was removed
+
+
+ if (languageExists && this.language !== language || !tracks.includes(currentTrackNode)) {
+ captions.setLanguage.call(this, language);
+ captions.toggle.call(this, active && languageExists);
+ } // Enable or disable captions based on track length
+
+
+ toggleClass(this.elements.container, this.config.classNames.captions.enabled, !is$1.empty(tracks)); // Update available languages in list
+
+ if (is$1.array(this.config.controls) && this.config.controls.includes('settings') && this.config.settings.includes('captions')) {
+ controls.setCaptionsMenu.call(this);
+ }
+ },
+ // Toggle captions display
+ // Used internally for the toggleCaptions method, with the passive option forced to false
+ toggle: function toggle(input) {
+ var _this2 = this;
+
+ var passive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
+
+ // If there's no full support
+ if (!this.supported.ui) {
+ return;
+ }
+
+ var toggled = this.captions.toggled; // Current state
+
+ var activeClass = this.config.classNames.captions.active; // Get the next state
+ // If the method is called without parameter, toggle based on current value
+
+ var active = is$1.nullOrUndefined(input) ? !toggled : input; // Update state and trigger event
+
+ if (active !== toggled) {
+ // When passive, don't override user preferences
+ if (!passive) {
+ this.captions.active = active;
+ this.storage.set({
+ captions: active
+ });
+ } // Force language if the call isn't passive and there is no matching language to toggle to
+
+
+ if (!this.language && active && !passive) {
+ var tracks = captions.getTracks.call(this);
+ 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
+
+ this.captions.language = track.language; // Set caption, but don't store in localStorage as user preference
+
+ captions.set.call(this, tracks.indexOf(track));
+ return;
+ } // Toggle button if it's enabled
+
+
+ if (this.elements.buttons.captions) {
+ this.elements.buttons.captions.pressed = active;
+ } // Add class hook
+
+
+ toggleClass(this.elements.container, activeClass, active);
+ this.captions.toggled = active; // Update settings menu
+
+ controls.updateSetting.call(this, 'captions'); // Trigger event (not used internally)
+
+ triggerEvent.call(this, this.media, active ? 'captionsenabled' : 'captionsdisabled');
+ } // Wait for the call stack to clear before setting mode='hidden'
+ // on the active track - forcing the browser to download it
+
+
+ setTimeout(function () {
+ if (active && _this2.captions.toggled) {
+ _this2.captions.currentTrackNode.mode = 'hidden';
+ }
+ });
+ },
+ // Set captions by track index
+ // Used internally for the currentTrack setter with the passive option forced to false
+ set: function set(index) {
+ var passive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
+ var tracks = captions.getTracks.call(this); // Disable captions if setting to -1
+
+ if (index === -1) {
+ captions.toggle.call(this, false, passive);
+ return;
+ }
+
+ if (!is$1.number(index)) {
+ this.debug.warn('Invalid caption argument', index);
+ return;
+ }
+
+ if (!(index in tracks)) {
+ this.debug.warn('Track not found', index);
+ return;
+ }
+
+ if (this.captions.currentTrack !== index) {
+ this.captions.currentTrack = index;
+ var track = tracks[index];
+
+ var _ref = track || {},
+ language = _ref.language; // Store reference to node for invalidation on remove
+
+
+ this.captions.currentTrackNode = track; // Update settings menu
+
+ controls.updateSetting.call(this, 'captions'); // When passive, don't override user preferences
+
+ if (!passive) {
+ this.captions.language = language;
+ this.storage.set({
+ language: language
+ });
+ } // Handle Vimeo captions
+
+
+ if (this.isVimeo) {
+ this.embed.enableTextTrack(language);
+ } // Trigger event
+
+
+ triggerEvent.call(this, this.media, 'languagechange');
+ } // Show captions
+
+
+ captions.toggle.call(this, true, passive);
+
+ if (this.isHTML5 && this.isVideo) {
+ // If we change the active track while a cue is already displayed we need to update it
+ captions.updateCues.call(this);
+ }
+ },
+ // Set captions by language
+ // Used internally for the language setter with the passive option forced to false
+ setLanguage: function setLanguage(input) {
+ var passive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
+
+ if (!is$1.string(input)) {
+ this.debug.warn('Invalid language argument', input);
+ return;
+ } // Normalize
+
+
+ var language = input.toLowerCase();
+ this.captions.language = language; // Set currentTrack
+
+ var tracks = captions.getTracks.call(this);
+ var track = captions.findTrack.call(this, [language]);
+ captions.set.call(this, tracks.indexOf(track), passive);
+ },
+ // Get current valid caption tracks
+ // If update is false it will also ignore tracks without metadata
+ // This is used to "freeze" the language options when captions.update is false
+ getTracks: function getTracks() {
+ var _this3 = this;
+
+ var update = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
+ // Handle media or textTracks missing or null
+ var tracks = Array.from((this.media || {}).textTracks || []); // For HTML5, use cache instead of current tracks when it exists (if captions.update is false)
+ // Filter out removed tracks and tracks that aren't captions/subtitles (for example metadata)
+
+ return tracks.filter(function (track) {
+ return !_this3.isHTML5 || update || _this3.captions.meta.has(track);
+ }).filter(function (track) {
+ return ['captions', 'subtitles'].includes(track.kind);
+ });
+ },
+ // Match tracks based on languages and get the first
+ findTrack: function findTrack(languages) {
+ var _this4 = this;
+
+ var force = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
+ var tracks = captions.getTracks.call(this);
+
+ var sortIsDefault = function sortIsDefault(track) {
+ return Number((_this4.captions.meta.get(track) || {}).default);
+ };
+
+ var sorted = Array.from(tracks).sort(function (a, b) {
+ return sortIsDefault(b) - sortIsDefault(a);
+ });
+ var track;
+ languages.every(function (language) {
+ track = sorted.find(function (t) {
+ return t.language === language;
+ });
+ return !track; // Break iteration if there is a match
+ }); // If no match is found but is required, get first
+
+ return track || (force ? sorted[0] : undefined);
+ },
+ // Get the current track
+ getCurrentTrack: function getCurrentTrack() {
+ return captions.getTracks.call(this)[this.currentTrack];
+ },
+ // Get UI label for track
+ getLabel: function getLabel(track) {
+ var currentTrack = track;
+
+ if (!is$1.track(currentTrack) && support.textTracks && this.captions.toggled) {
+ currentTrack = captions.getCurrentTrack.call(this);
+ }
+
+ if (is$1.track(currentTrack)) {
+ if (!is$1.empty(currentTrack.label)) {
+ return currentTrack.label;
+ }
+
+ if (!is$1.empty(currentTrack.language)) {
+ return track.language.toUpperCase();
+ }
+
+ return i18n.get('enabled', this.config);
+ }
+
+ return i18n.get('disabled', this.config);
+ },
+ // Update captions using current track's active cues
+ // Also optional array argument in case there isn't any track (ex: vimeo)
+ updateCues: function updateCues(input) {
+ // Requires UI
+ if (!this.supported.ui) {
+ return;
+ }
+
+ if (!is$1.element(this.elements.captions)) {
+ this.debug.warn('No captions element to render to');
+ return;
+ } // Only accept array or empty input
+
+
+ if (!is$1.nullOrUndefined(input) && !Array.isArray(input)) {
+ this.debug.warn('updateCues: Invalid input', input);
+ return;
+ }
+
+ var cues = input; // Get cues from track
+
+ if (!cues) {
+ var track = captions.getCurrentTrack.call(this);
+ cues = Array.from((track || {}).activeCues || []).map(function (cue) {
+ return cue.getCueAsHTML();
+ }).map(getHTML);
+ } // Set new caption text
+
+
+ var content = cues.map(function (cueText) {
+ return cueText.trim();
+ }).join('\n');
+ var changed = content !== this.elements.captions.innerHTML;
+
+ if (changed) {
+ // Empty the container and create a new child element
+ emptyElement(this.elements.captions);
+ var caption = createElement('span', getAttributesFromSelector(this.config.selectors.caption));
+ caption.innerHTML = content;
+ this.elements.captions.appendChild(caption); // Trigger event
+
+ triggerEvent.call(this, this.media, 'cuechange');
+ }
+ }
+ };
+
+ // ==========================================================================
+ // Plyr default config
+ // ==========================================================================
+ var defaults$1 = {
+ // Disable
+ enabled: true,
+ // Custom media title
+ title: '',
+ // Logging to console
+ debug: false,
+ // Auto play (if supported)
+ autoplay: false,
+ // Only allow one media playing at once (vimeo only)
+ autopause: true,
+ // Allow inline playback on iOS (this effects YouTube/Vimeo - HTML5 requires the attribute present)
+ // TODO: Remove iosNative fullscreen option in favour of this (logic needs work)
+ playsinline: true,
+ // Default time to skip when rewind/fast forward
+ seekTime: 10,
+ // Default volume
+ volume: 1,
+ muted: false,
+ // Pass a custom duration
+ duration: null,
+ // Display the media duration on load in the current time position
+ // If you have opted to display both duration and currentTime, this is ignored
+ displayDuration: true,
+ // Invert the current time to be a countdown
+ invertTime: true,
+ // Clicking the currentTime inverts it's value to show time left rather than elapsed
+ toggleInvert: true,
+ // Force an aspect ratio
+ // The format must be `'w:h'` (e.g. `'16:9'`)
+ ratio: null,
+ // Click video container to play/pause
+ clickToPlay: true,
+ // Auto hide the controls
+ hideControls: true,
+ // Reset to start when playback ended
+ resetOnEnd: false,
+ // Disable the standard context menu
+ disableContextMenu: true,
+ // Sprite (for icons)
+ loadSprite: true,
+ iconPrefix: 'plyr',
+ iconUrl: '/theme/modules/plyr/plyr.svg',
+ // Blank video (used to prevent errors on source change)
+ blankVideo: '/theme/modules/plyr/blank.webm',
+ // Quality default
+ quality: {
+ default: 576,
+ // The options to display in the UI, if available for the source media
+ options: [4320, 2880, 2160, 1440, 1080, 720, 576, 480, 360, 240],
+ forced: false,
+ onChange: null
+ },
+ // Set loops
+ loop: {
+ active: false // start: null,
+ // end: null,
+
+ },
+ // Speed default and options to display
+ speed: {
+ selected: 1,
+ // The options to display in the UI, if available for the source media (e.g. Vimeo and YouTube only support 0.5x-4x)
+ options: [0.5, 0.75, 1, 1.25, 1.5, 1.75, 2, 4]
+ },
+ // Keyboard shortcut settings
+ keyboard: {
+ focused: true,
+ global: false
+ },
+ // Display tooltips
+ tooltips: {
+ controls: false,
+ seek: true
+ },
+ // Captions settings
+ captions: {
+ active: false,
+ language: 'auto',
+ // Listen to new tracks added after Plyr is initialized.
+ // This is needed for streaming captions, but may result in unselectable options
+ update: false
+ },
+ // Fullscreen settings
+ fullscreen: {
+ enabled: true,
+ // Allow fullscreen?
+ fallback: true,
+ // Fallback using full viewport/window
+ iosNative: false // Use the native fullscreen in iOS (disables custom controls)
+ // Selector for the fullscreen container so contextual / non-player content can remain visible in fullscreen mode
+ // Non-ancestors of the player element will be ignored
+ // container: null, // defaults to the player element
+
+ },
+ // Local storage
+ storage: {
+ enabled: true,
+ key: 'plyr'
+ },
+ // Default controls
+ controls: ['play-large', // 'restart',
+ // 'rewind',
+ 'play', // 'fast-forward',
+ 'progress', 'current-time', // 'duration',
+ 'mute', 'volume', 'captions', 'settings', 'pip', 'airplay', // 'download',
+ 'fullscreen'],
+ settings: ['captions', 'quality', 'speed'],
+ // Localisation
+ i18n: {
+ restart: 'Restart',
+ rewind: 'Rewind {seektime}s',
+ play: 'Play',
+ pause: 'Pause',
+ fastForward: 'Forward {seektime}s',
+ seek: 'Seek',
+ seekLabel: '{currentTime} of {duration}',
+ played: 'Played',
+ buffered: 'Buffered',
+ currentTime: 'Current time',
+ duration: 'Duration',
+ volume: 'Volume',
+ mute: 'Mute',
+ unmute: 'Unmute',
+ enableCaptions: 'Enable captions',
+ disableCaptions: 'Disable captions',
+ download: 'Download',
+ enterFullscreen: 'Enter fullscreen',
+ exitFullscreen: 'Exit fullscreen',
+ frameTitle: 'Player for {title}',
+ captions: 'Captions',
+ settings: 'Settings',
+ pip: 'PIP',
+ menuBack: 'Go back to previous menu',
+ speed: 'Speed',
+ normal: 'Normal',
+ quality: 'Quality',
+ loop: 'Loop',
+ start: 'Start',
+ end: 'End',
+ all: 'All',
+ reset: 'Reset',
+ disabled: 'Disabled',
+ enabled: 'Enabled',
+ advertisement: 'Ad',
+ qualityBadge: {
+ 2160: '4K',
+ 1440: 'HD',
+ 1080: 'HD',
+ 720: 'HD',
+ 576: 'SD',
+ 480: 'SD'
+ }
+ },
+ // URLs
+ urls: {
+ download: null,
+ vimeo: {
+ sdk: 'https://player.vimeo.com/api/player.js',
+ iframe: 'https://player.vimeo.com/video/{0}?{1}',
+ api: 'https://vimeo.com/api/v2/video/{0}.json'
+ },
+ youtube: {
+ sdk: 'https://www.youtube.com/iframe_api',
+ api: 'https://noembed.com/embed?url=https://www.youtube.com/watch?v={0}'
+ },
+ googleIMA: {
+ sdk: 'https://imasdk.googleapis.com/js/sdkloader/ima3.js'
+ }
+ },
+ // Custom control listeners
+ listeners: {
+ seek: null,
+ play: null,
+ pause: null,
+ restart: null,
+ rewind: null,
+ fastForward: null,
+ mute: null,
+ volume: null,
+ captions: null,
+ download: null,
+ fullscreen: null,
+ pip: null,
+ airplay: null,
+ speed: null,
+ quality: null,
+ loop: null,
+ language: null
+ },
+ // Events to watch and bubble
+ events: [// Events to watch on HTML5 media elements and bubble
+ // https://developer.mozilla.org/en/docs/Web/Guide/Events/Media_events
+ 'ended', 'progress', 'stalled', 'playing', 'waiting', 'canplay', 'canplaythrough', 'loadstart', 'loadeddata', 'loadedmetadata', 'timeupdate', 'volumechange', 'play', 'pause', 'error', 'seeking', 'seeked', 'emptied', 'ratechange', 'cuechange', // Custom events
+ 'download', 'enterfullscreen', 'exitfullscreen', 'captionsenabled', 'captionsdisabled', 'languagechange', 'controlshidden', 'controlsshown', 'ready', // YouTube
+ 'statechange', // Quality
+ 'qualitychange', // Ads
+ 'adsloaded', 'adscontentpause', 'adscontentresume', 'adstarted', 'adsmidpoint', 'adscomplete', 'adsallcomplete', 'adsimpression', 'adsclick'],
+ // Selectors
+ // Change these to match your template if using custom HTML
+ selectors: {
+ editable: 'input, textarea, select, [contenteditable]',
+ container: '.plyr',
+ controls: {
+ container: null,
+ wrapper: '.plyr__controls'
+ },
+ labels: '[data-plyr]',
+ buttons: {
+ play: '[data-plyr="play"]',
+ pause: '[data-plyr="pause"]',
+ restart: '[data-plyr="restart"]',
+ rewind: '[data-plyr="rewind"]',
+ fastForward: '[data-plyr="fast-forward"]',
+ mute: '[data-plyr="mute"]',
+ captions: '[data-plyr="captions"]',
+ download: '[data-plyr="download"]',
+ fullscreen: '[data-plyr="fullscreen"]',
+ pip: '[data-plyr="pip"]',
+ airplay: '[data-plyr="airplay"]',
+ settings: '[data-plyr="settings"]',
+ loop: '[data-plyr="loop"]'
+ },
+ inputs: {
+ seek: '[data-plyr="seek"]',
+ volume: '[data-plyr="volume"]',
+ speed: '[data-plyr="speed"]',
+ language: '[data-plyr="language"]',
+ quality: '[data-plyr="quality"]'
+ },
+ display: {
+ currentTime: '.plyr__time--current',
+ duration: '.plyr__time--duration',
+ buffer: '.plyr__progress__buffer',
+ loop: '.plyr__progress__loop',
+ // Used later
+ volume: '.plyr__volume--display'
+ },
+ progress: '.plyr__progress',
+ captions: '.plyr__captions',
+ caption: '.plyr__caption'
+ },
+ // Class hooks added to the player in different states
+ classNames: {
+ type: 'plyr--{0}',
+ provider: 'plyr--{0}',
+ video: 'plyr__video-wrapper',
+ embed: 'plyr__video-embed',
+ videoFixedRatio: 'plyr__video-wrapper--fixed-ratio',
+ embedContainer: 'plyr__video-embed__container',
+ poster: 'plyr__poster',
+ posterEnabled: 'plyr__poster-enabled',
+ ads: 'plyr__ads',
+ control: 'plyr__control',
+ controlPressed: 'plyr__control--pressed',
+ playing: 'plyr--playing',
+ paused: 'plyr--paused',
+ stopped: 'plyr--stopped',
+ loading: 'plyr--loading',
+ hover: 'plyr--hover',
+ tooltip: 'plyr__tooltip',
+ cues: 'plyr__cues',
+ hidden: 'plyr__sr-only',
+ hideControls: 'plyr--hide-controls',
+ isIos: 'plyr--is-ios',
+ isTouch: 'plyr--is-touch',
+ uiSupported: 'plyr--full-ui',
+ noTransition: 'plyr--no-transition',
+ display: {
+ time: 'plyr__time'
+ },
+ menu: {
+ value: 'plyr__menu__value',
+ badge: 'plyr__badge',
+ open: 'plyr--menu-open'
+ },
+ captions: {
+ enabled: 'plyr--captions-enabled',
+ active: 'plyr--captions-active'
+ },
+ fullscreen: {
+ enabled: 'plyr--fullscreen-enabled',
+ fallback: 'plyr--fullscreen-fallback'
+ },
+ pip: {
+ supported: 'plyr--pip-supported',
+ active: 'plyr--pip-active'
+ },
+ airplay: {
+ supported: 'plyr--airplay-supported',
+ active: 'plyr--airplay-active'
+ },
+ tabFocus: 'plyr__tab-focus',
+ previewThumbnails: {
+ // Tooltip thumbs
+ thumbContainer: 'plyr__preview-thumb',
+ thumbContainerShown: 'plyr__preview-thumb--is-shown',
+ imageContainer: 'plyr__preview-thumb__image-container',
+ timeContainer: 'plyr__preview-thumb__time-container',
+ // Scrubbing
+ scrubbingContainer: 'plyr__preview-scrubbing',
+ scrubbingContainerShown: 'plyr__preview-scrubbing--is-shown'
+ }
+ },
+ // Embed attributes
+ attributes: {
+ embed: {
+ provider: 'data-plyr-provider',
+ id: 'data-plyr-embed-id'
+ }
+ },
+ // Advertisements plugin
+ // Register for an account here: http://vi.ai/publisher-video-monetization/?aid=plyrio
+ ads: {
+ enabled: false,
+ publisherId: '',
+ tagUrl: ''
+ },
+ // Preview Thumbnails plugin
+ previewThumbnails: {
+ enabled: false,
+ src: ''
+ },
+ // Vimeo plugin
+ vimeo: {
+ byline: false,
+ portrait: false,
+ title: false,
+ speed: true,
+ transparent: false,
+ // Whether the owner of the video has a Pro or Business account
+ // (which allows us to properly hide controls without CSS hacks, etc)
+ premium: false,
+ // Custom settings from Plyr
+ referrerPolicy: null // https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement/referrerPolicy
+
+ },
+ // YouTube plugin
+ youtube: {
+ noCookie: true,
+ // Whether to use an alternative version of YouTube without cookies
+ rel: 0,
+ // No related vids
+ showinfo: 0,
+ // Hide info
+ iv_load_policy: 3,
+ // Hide annotations
+ modestbranding: 1 // Hide logos as much as possible (they still show one in the corner when paused)
+
+ }
+ };
+
+ // ==========================================================================
+ // Plyr states
+ // ==========================================================================
+ var pip = {
+ active: 'picture-in-picture',
+ inactive: 'inline'
+ };
+
+ // ==========================================================================
+ // Plyr supported types and providers
+ // ==========================================================================
+ var providers = {
+ html5: 'html5',
+ youtube: 'youtube',
+ vimeo: 'vimeo'
+ };
+ var types = {
+ audio: 'audio',
+ video: 'video'
+ };
+ /**
+ * Get provider by URL
+ * @param {String} url
+ */
+
+ function getProviderByUrl(url) {
+ // YouTube
+ if (/^(https?:\/\/)?(www\.)?(youtube\.com|youtube-nocookie\.com|youtu\.?be)\/.+$/.test(url)) {
+ return providers.youtube;
+ } // Vimeo
+
+
+ if (/^https?:\/\/player.vimeo.com\/video\/\d{0,9}(?=\b|\/)/.test(url)) {
+ return providers.vimeo;
+ }
+
+ return null;
+ }
+
+ // ==========================================================================
+ // Console wrapper
+ // ==========================================================================
+ var noop = function noop() {};
+
+ var Console = /*#__PURE__*/function () {
+ function Console() {
+ var enabled = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
+
+ _classCallCheck(this, Console);
+
+ this.enabled = window.console && enabled;
+
+ if (this.enabled) {
+ this.log('Debugging enabled');
+ }
+ }
+
+ _createClass(Console, [{
+ key: "log",
+ get: function get() {
+ // eslint-disable-next-line no-console
+ return this.enabled ? Function.prototype.bind.call(console.log, console) : noop;
+ }
+ }, {
+ key: "warn",
+ get: function get() {
+ // eslint-disable-next-line no-console
+ return this.enabled ? Function.prototype.bind.call(console.warn, console) : noop;
+ }
+ }, {
+ key: "error",
+ get: function get() {
+ // eslint-disable-next-line no-console
+ return this.enabled ? Function.prototype.bind.call(console.error, console) : noop;
+ }
+ }]);
+
+ return Console;
+ }();
+
+ var Fullscreen = /*#__PURE__*/function () {
+ function Fullscreen(player) {
+ var _this = this;
+
+ _classCallCheck(this, Fullscreen);
+
+ // Keep reference to parent
+ this.player = player; // Get prefix
+
+ this.prefix = Fullscreen.prefix;
+ this.property = Fullscreen.property; // Scroll position
+
+ this.scrollPosition = {
+ x: 0,
+ y: 0
+ }; // Force the use of 'full window/browser' rather than fullscreen
+
+ this.forceFallback = player.config.fullscreen.fallback === 'force'; // Get the fullscreen element
+ // Checks container is an ancestor, defaults to null
+
+ this.player.elements.fullscreen = player.config.fullscreen.container && closest(this.player.elements.container, player.config.fullscreen.container); // Register event listeners
+ // Handle event (incase user presses escape etc)
+
+ on.call(this.player, document, this.prefix === 'ms' ? 'MSFullscreenChange' : "".concat(this.prefix, "fullscreenchange"), function () {
+ // TODO: Filter for target??
+ _this.onChange();
+ }); // Fullscreen toggle on double click
+
+ on.call(this.player, this.player.elements.container, 'dblclick', function (event) {
+ // Ignore double click in controls
+ if (is$1.element(_this.player.elements.controls) && _this.player.elements.controls.contains(event.target)) {
+ return;
+ }
+
+ _this.toggle();
+ }); // Tap focus when in fullscreen
+
+ on.call(this, this.player.elements.container, 'keydown', function (event) {
+ return _this.trapFocus(event);
+ }); // Update the UI
+
+ this.update();
+ } // Determine if native supported
+
+
+ _createClass(Fullscreen, [{
+ key: "onChange",
+ value: function onChange() {
+ if (!this.enabled) {
+ return;
+ } // Update toggle button
+
+
+ var button = this.player.elements.buttons.fullscreen;
+
+ if (is$1.element(button)) {
+ button.pressed = this.active;
+ } // Trigger an event
+
+
+ triggerEvent.call(this.player, this.target, this.active ? 'enterfullscreen' : 'exitfullscreen', true);
+ }
+ }, {
+ key: "toggleFallback",
+ value: function toggleFallback() {
+ var toggle = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
+
+ // Store or restore scroll position
+ if (toggle) {
+ this.scrollPosition = {
+ x: window.scrollX || 0,
+ y: window.scrollY || 0
+ };
+ } else {
+ window.scrollTo(this.scrollPosition.x, this.scrollPosition.y);
+ } // Toggle scroll
+
+
+ document.body.style.overflow = toggle ? 'hidden' : ''; // Toggle class hook
+
+ toggleClass(this.target, this.player.config.classNames.fullscreen.fallback, toggle); // Force full viewport on iPhone X+
+
+ if (browser.isIos) {
+ var viewport = document.head.querySelector('meta[name="viewport"]');
+ var property = 'viewport-fit=cover'; // Inject the viewport meta if required
+
+ if (!viewport) {
+ viewport = document.createElement('meta');
+ viewport.setAttribute('name', 'viewport');
+ } // Check if the property already exists
+
+
+ var hasProperty = is$1.string(viewport.content) && viewport.content.includes(property);
+
+ if (toggle) {
+ this.cleanupViewport = !hasProperty;
+
+ if (!hasProperty) {
+ viewport.content += ",".concat(property);
+ }
+ } else if (this.cleanupViewport) {
+ viewport.content = viewport.content.split(',').filter(function (part) {
+ return part.trim() !== property;
+ }).join(',');
+ }
+ } // Toggle button and fire events
+
+
+ this.onChange();
+ } // Trap focus inside container
+
+ }, {
+ key: "trapFocus",
+ value: function trapFocus(event) {
+ // Bail if iOS, not active, not the tab key
+ if (browser.isIos || !this.active || event.key !== 'Tab' || event.keyCode !== 9) {
+ return;
+ } // Get the current focused element
+
+
+ var focused = document.activeElement;
+ var focusable = getElements.call(this.player, 'a[href], button:not(:disabled), input:not(:disabled), [tabindex]');
+
+ var _focusable = _slicedToArray(focusable, 1),
+ first = _focusable[0];
+
+ var last = focusable[focusable.length - 1];
+
+ if (focused === last && !event.shiftKey) {
+ // Move focus to first element that can be tabbed if Shift isn't used
+ first.focus();
+ event.preventDefault();
+ } else if (focused === first && event.shiftKey) {
+ // Move focus to last element that can be tabbed if Shift is used
+ last.focus();
+ event.preventDefault();
+ }
+ } // Update UI
+
+ }, {
+ key: "update",
+ value: function update() {
+ if (this.enabled) {
+ var mode;
+
+ if (this.forceFallback) {
+ mode = 'Fallback (forced)';
+ } else if (Fullscreen.native) {
+ mode = 'Native';
+ } else {
+ mode = 'Fallback';
+ }
+
+ this.player.debug.log("".concat(mode, " fullscreen enabled"));
+ } else {
+ this.player.debug.log('Fullscreen not supported and fallback disabled');
+ } // Add styling hook to show button
+
+
+ toggleClass(this.player.elements.container, this.player.config.classNames.fullscreen.enabled, this.enabled);
+ } // Make an element fullscreen
+
+ }, {
+ key: "enter",
+ value: function enter() {
+ if (!this.enabled) {
+ return;
+ } // iOS native fullscreen doesn't need the request step
+
+
+ if (browser.isIos && this.player.config.fullscreen.iosNative) {
+ this.target.webkitEnterFullscreen();
+ } else if (!Fullscreen.native || this.forceFallback) {
+ this.toggleFallback(true);
+ } else if (!this.prefix) {
+ this.target.requestFullscreen({
+ navigationUI: 'hide'
+ });
+ } else if (!is$1.empty(this.prefix)) {
+ this.target["".concat(this.prefix, "Request").concat(this.property)]();
+ }
+ } // Bail from fullscreen
+
+ }, {
+ key: "exit",
+ value: function exit() {
+ if (!this.enabled) {
+ return;
+ } // iOS native fullscreen
+
+
+ if (browser.isIos && this.player.config.fullscreen.iosNative) {
+ this.target.webkitExitFullscreen();
+ silencePromise(this.player.play());
+ } else if (!Fullscreen.native || this.forceFallback) {
+ this.toggleFallback(false);
+ } else if (!this.prefix) {
+ (document.cancelFullScreen || document.exitFullscreen).call(document);
+ } else if (!is$1.empty(this.prefix)) {
+ var action = this.prefix === 'moz' ? 'Cancel' : 'Exit';
+ document["".concat(this.prefix).concat(action).concat(this.property)]();
+ }
+ } // Toggle state
+
+ }, {
+ key: "toggle",
+ value: function toggle() {
+ if (!this.active) {
+ this.enter();
+ } else {
+ this.exit();
+ }
+ }
+ }, {
+ key: "usingNative",
+ // If we're actually using native
+ get: function get() {
+ return Fullscreen.native && !this.forceFallback;
+ } // Get the prefix for handlers
+
+ }, {
+ key: "enabled",
+ // Determine if fullscreen is enabled
+ get: function get() {
+ return (Fullscreen.native || this.player.config.fullscreen.fallback) && this.player.config.fullscreen.enabled && this.player.supported.ui && this.player.isVideo;
+ } // Get active state
+
+ }, {
+ key: "active",
+ get: function get() {
+ if (!this.enabled) {
+ return false;
+ } // Fallback using classname
+
+
+ if (!Fullscreen.native || this.forceFallback) {
+ return hasClass(this.target, this.player.config.classNames.fullscreen.fallback);
+ }
+
+ var element = !this.prefix ? document.fullscreenElement : document["".concat(this.prefix).concat(this.property, "Element")];
+ return element && element.shadowRoot ? element === this.target.getRootNode().host : element === this.target;
+ } // Get target element
+
+ }, {
+ key: "target",
+ get: function get() {
+ return browser.isIos && this.player.config.fullscreen.iosNative ? this.player.media : this.player.elements.fullscreen || this.player.elements.container;
+ }
+ }], [{
+ key: "native",
+ get: function get() {
+ return !!(document.fullscreenEnabled || document.webkitFullscreenEnabled || document.mozFullScreenEnabled || document.msFullscreenEnabled);
+ }
+ }, {
+ key: "prefix",
+ get: function get() {
+ // No prefix
+ if (is$1.function(document.exitFullscreen)) {
+ return '';
+ } // Check for fullscreen support by vendor prefix
+
+
+ var value = '';
+ var prefixes = ['webkit', 'moz', 'ms'];
+ prefixes.some(function (pre) {
+ if (is$1.function(document["".concat(pre, "ExitFullscreen")]) || is$1.function(document["".concat(pre, "CancelFullScreen")])) {
+ value = pre;
+ return true;
+ }
+
+ return false;
+ });
+ return value;
+ }
+ }, {
+ key: "property",
+ get: function get() {
+ return this.prefix === 'moz' ? 'FullScreen' : 'Fullscreen';
+ }
+ }]);
+
+ return Fullscreen;
+ }();
+
+ // `Math.sign` method implementation
+ // https://tc39.github.io/ecma262/#sec-math.sign
+ var mathSign = Math.sign || function sign(x) {
+ // eslint-disable-next-line no-self-compare
+ return (x = +x) == 0 || x != x ? x : x < 0 ? -1 : 1;
+ };
+
+ // `Math.sign` method
+ // https://tc39.github.io/ecma262/#sec-math.sign
+ _export({ target: 'Math', stat: true }, {
+ sign: mathSign
+ });
+
+ // ==========================================================================
+ // Load image avoiding xhr/fetch CORS issues
+ // Server status can't be obtained this way unfortunately, so this uses "naturalWidth" to determine if the image has loaded
+ // By default it checks if it is at least 1px, but you can add a second argument to change this
+ // ==========================================================================
+ function loadImage(src) {
+ var minWidth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
+ return new Promise(function (resolve, reject) {
+ var image = new Image();
+
+ var handler = function handler() {
+ delete image.onload;
+ delete image.onerror;
+ (image.naturalWidth >= minWidth ? resolve : reject)(image);
+ };
+
+ Object.assign(image, {
+ onload: handler,
+ onerror: handler,
+ src: src
+ });
+ });
+ }
+
+ var ui = {
+ addStyleHook: function addStyleHook() {
+ toggleClass(this.elements.container, this.config.selectors.container.replace('.', ''), true);
+ toggleClass(this.elements.container, this.config.classNames.uiSupported, this.supported.ui);
+ },
+ // Toggle native HTML5 media controls
+ toggleNativeControls: function toggleNativeControls() {
+ var toggle = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
+
+ if (toggle && this.isHTML5) {
+ this.media.setAttribute('controls', '');
+ } else {
+ this.media.removeAttribute('controls');
+ }
+ },
+ // Setup the UI
+ build: function build() {
+ var _this = this;
+
+ // Re-attach media element listeners
+ // TODO: Use event bubbling?
+ this.listeners.media(); // Don't setup interface if no support
+
+ if (!this.supported.ui) {
+ this.debug.warn("Basic support only for ".concat(this.provider, " ").concat(this.type)); // Restore native controls
+
+ ui.toggleNativeControls.call(this, true); // Bail
+
+ return;
+ } // Inject custom controls if not present
+
+
+ if (!is$1.element(this.elements.controls)) {
+ // Inject custom controls
+ controls.inject.call(this); // Re-attach control listeners
+
+ this.listeners.controls();
+ } // Remove native controls
+
+
+ ui.toggleNativeControls.call(this); // Setup captions for HTML5
+
+ if (this.isHTML5) {
+ captions.setup.call(this);
+ } // Reset volume
+
+
+ this.volume = null; // Reset mute state
+
+ this.muted = null; // Reset loop state
+
+ this.loop = null; // Reset quality setting
+
+ this.quality = null; // Reset speed
+
+ this.speed = null; // Reset volume display
+
+ controls.updateVolume.call(this); // Reset time display
+
+ controls.timeUpdate.call(this); // Update the UI
+
+ ui.checkPlaying.call(this); // Check for picture-in-picture support
+
+ toggleClass(this.elements.container, this.config.classNames.pip.supported, support.pip && this.isHTML5 && this.isVideo); // Check for airplay support
+
+ toggleClass(this.elements.container, this.config.classNames.airplay.supported, support.airplay && this.isHTML5); // Add iOS class
+
+ toggleClass(this.elements.container, this.config.classNames.isIos, browser.isIos); // Add touch class
+
+ toggleClass(this.elements.container, this.config.classNames.isTouch, this.touch); // Ready for API calls
+
+ this.ready = true; // Ready event at end of execution stack
+
+ setTimeout(function () {
+ triggerEvent.call(_this, _this.media, 'ready');
+ }, 0); // Set the title
+
+ ui.setTitle.call(this); // Assure the poster image is set, if the property was added before the element was created
+
+ if (this.poster) {
+ ui.setPoster.call(this, this.poster, false).catch(function () {});
+ } // Manually set the duration if user has overridden it.
+ // The event listeners for it doesn't get called if preload is disabled (#701)
+
+
+ if (this.config.duration) {
+ controls.durationUpdate.call(this);
+ }
+ },
+ // Setup aria attribute for play and iframe title
+ setTitle: function setTitle() {
+ // Find the current text
+ var label = i18n.get('play', this.config); // If there's a media title set, use that for the label
+
+ if (is$1.string(this.config.title) && !is$1.empty(this.config.title)) {
+ label += ", ".concat(this.config.title);
+ } // If there's a play button, set label
+
+
+ Array.from(this.elements.buttons.play || []).forEach(function (button) {
+ button.setAttribute('aria-label', label);
+ }); // Set iframe title
+ // https://github.com/sampotts/plyr/issues/124
+
+ if (this.isEmbed) {
+ var iframe = getElement.call(this, 'iframe');
+
+ if (!is$1.element(iframe)) {
+ return;
+ } // Default to media type
+
+
+ var title = !is$1.empty(this.config.title) ? this.config.title : 'video';
+ var format = i18n.get('frameTitle', this.config);
+ iframe.setAttribute('title', format.replace('{title}', title));
+ }
+ },
+ // Toggle poster
+ togglePoster: function togglePoster(enable) {
+ toggleClass(this.elements.container, this.config.classNames.posterEnabled, enable);
+ },
+ // Set the poster image (async)
+ // Used internally for the poster setter, with the passive option forced to false
+ setPoster: function setPoster(poster) {
+ var _this2 = this;
+
+ var passive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
+
+ // Don't override if call is passive
+ if (passive && this.poster) {
+ return Promise.reject(new Error('Poster already set'));
+ } // Set property synchronously to respect the call order
+
+
+ this.media.setAttribute('data-poster', poster); // Wait until ui is ready
+
+ return ready.call(this) // Load image
+ .then(function () {
+ return loadImage(poster);
+ }).catch(function (err) {
+ // Hide poster on error unless it's been set by another call
+ if (poster === _this2.poster) {
+ ui.togglePoster.call(_this2, false);
+ } // Rethrow
+
+
+ throw err;
+ }).then(function () {
+ // Prevent race conditions
+ if (poster !== _this2.poster) {
+ throw new Error('setPoster cancelled by later call to setPoster');
+ }
+ }).then(function () {
+ Object.assign(_this2.elements.poster.style, {
+ backgroundImage: "url('".concat(poster, "')"),
+ // Reset backgroundSize as well (since it can be set to "cover" for padded thumbnails for youtube)
+ backgroundSize: ''
+ });
+ ui.togglePoster.call(_this2, true);
+ return poster;
+ });
+ },
+ // Check playing state
+ checkPlaying: function checkPlaying(event) {
+ var _this3 = this;
+
+ // Class hooks
+ toggleClass(this.elements.container, this.config.classNames.playing, this.playing);
+ toggleClass(this.elements.container, this.config.classNames.paused, this.paused);
+ toggleClass(this.elements.container, this.config.classNames.stopped, this.stopped); // Set state
+
+ Array.from(this.elements.buttons.play || []).forEach(function (target) {
+ Object.assign(target, {
+ pressed: _this3.playing
+ });
+ target.setAttribute('aria-label', i18n.get(_this3.playing ? 'pause' : 'play', _this3.config));
+ }); // Only update controls on non timeupdate events
+
+ if (is$1.event(event) && event.type === 'timeupdate') {
+ return;
+ } // Toggle controls
+
+
+ ui.toggleControls.call(this);
+ },
+ // Check if media is loading
+ checkLoading: function checkLoading(event) {
+ var _this4 = this;
+
+ this.loading = ['stalled', 'waiting'].includes(event.type); // Clear timer
+
+ clearTimeout(this.timers.loading); // Timer to prevent flicker when seeking
+
+ this.timers.loading = setTimeout(function () {
+ // Update progress bar loading class state
+ toggleClass(_this4.elements.container, _this4.config.classNames.loading, _this4.loading); // Update controls visibility
+
+ ui.toggleControls.call(_this4);
+ }, this.loading ? 250 : 0);
+ },
+ // Toggle controls based on state and `force` argument
+ toggleControls: function toggleControls(force) {
+ var controlsElement = this.elements.controls;
+
+ if (controlsElement && this.config.hideControls) {
+ // 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.)
+ var recentTouchSeek = this.touch && this.lastSeekTime + 2000 > Date.now(); // Show controls if force, loading, paused, button interaction, or recent seek, otherwise hide
+
+ this.toggleControls(Boolean(force || this.loading || this.paused || controlsElement.pressed || controlsElement.hover || recentTouchSeek));
+ }
+ },
+ // Migrate any custom properties from the media to the parent
+ migrateStyles: function migrateStyles() {
+ var _this5 = this;
+
+ // Loop through values (as they are the keys when the object is spread 🤔)
+ Object.values(_objectSpread2({}, this.media.style)) // We're only fussed about Plyr specific properties
+ .filter(function (key) {
+ return !is$1.empty(key) && key.startsWith('--plyr');
+ }).forEach(function (key) {
+ // Set on the container
+ _this5.elements.container.style.setProperty(key, _this5.media.style.getPropertyValue(key)); // Clean up from media element
+
+
+ _this5.media.style.removeProperty(key);
+ }); // Remove attribute if empty
+
+ if (is$1.empty(this.media.style)) {
+ this.media.removeAttribute('style');
+ }
+ }
+ };
+
+ var Listeners = /*#__PURE__*/function () {
+ function Listeners(player) {
+ _classCallCheck(this, Listeners);
+
+ this.player = player;
+ this.lastKey = null;
+ this.focusTimer = null;
+ this.lastKeyDown = null;
+ this.handleKey = this.handleKey.bind(this);
+ this.toggleMenu = this.toggleMenu.bind(this);
+ this.setTabFocus = this.setTabFocus.bind(this);
+ this.firstTouch = this.firstTouch.bind(this);
+ } // Handle key presses
+
+
+ _createClass(Listeners, [{
+ key: "handleKey",
+ value: function handleKey(event) {
+ var player = this.player;
+ var elements = player.elements;
+ var code = event.keyCode ? event.keyCode : event.which;
+ var pressed = event.type === 'keydown';
+ var repeat = pressed && code === this.lastKey; // Bail if a modifier key is set
+
+ if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) {
+ return;
+ } // If the event is bubbled from the media element
+ // Firefox doesn't get the keycode for whatever reason
+
+
+ if (!is$1.number(code)) {
+ return;
+ } // Seek by the number keys
+
+
+ var seekByKey = function seekByKey() {
+ // Divide the max duration into 10th's and times by the number value
+ player.currentTime = player.duration / 10 * (code - 48);
+ }; // Handle the key on keydown
+ // Reset on keyup
+
+
+ if (pressed) {
+ // Check focused element
+ // and if the focused element is not editable (e.g. text input)
+ // and any that accept key input http://webaim.org/techniques/keyboard/
+ var focused = document.activeElement;
+
+ if (is$1.element(focused)) {
+ var editable = player.config.selectors.editable;
+ var seek = elements.inputs.seek;
+
+ if (focused !== seek && matches$1(focused, editable)) {
+ return;
+ }
+
+ if (event.which === 32 && matches$1(focused, 'button, [role^="menuitem"]')) {
+ return;
+ }
+ } // Which keycodes should we prevent default
+
+
+ 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)
+
+ if (preventDefault.includes(code)) {
+ event.preventDefault();
+ event.stopPropagation();
+ }
+
+ switch (code) {
+ case 48:
+ case 49:
+ case 50:
+ case 51:
+ case 52:
+ case 53:
+ case 54:
+ case 55:
+ case 56:
+ case 57:
+ // 0-9
+ if (!repeat) {
+ seekByKey();
+ }
+
+ break;
+
+ case 32:
+ case 75:
+ // Space and K key
+ if (!repeat) {
+ silencePromise(player.togglePlay());
+ }
+
+ break;
+
+ case 38:
+ // Arrow up
+ player.increaseVolume(0.1);
+ break;
+
+ case 40:
+ // Arrow down
+ player.decreaseVolume(0.1);
+ break;
+
+ case 77:
+ // M key
+ if (!repeat) {
+ player.muted = !player.muted;
+ }
+
+ break;
+
+ case 39:
+ // Arrow forward
+ player.forward();
+ break;
+
+ case 37:
+ // Arrow back
+ player.rewind();
+ break;
+
+ case 70:
+ // F key
+ player.fullscreen.toggle();
+ break;
+
+ case 67:
+ // C key
+ if (!repeat) {
+ player.toggleCaptions();
+ }
+
+ break;
+
+ case 76:
+ // L key
+ player.loop = !player.loop;
+ break;
+ } // Escape is handle natively when in full screen
+ // So we only need to worry about non native
+
+
+ if (code === 27 && !player.fullscreen.usingNative && player.fullscreen.active) {
+ player.fullscreen.toggle();
+ } // Store last code for next cycle
+
+
+ this.lastKey = code;
+ } else {
+ this.lastKey = null;
+ }
+ } // Toggle menu
+
+ }, {
+ key: "toggleMenu",
+ value: function toggleMenu(event) {
+ controls.toggleMenu.call(this.player, event);
+ } // Device is touch enabled
+
+ }, {
+ key: "firstTouch",
+ value: function firstTouch() {
+ var player = this.player;
+ var elements = player.elements;
+ player.touch = true; // Add touch class
+
+ toggleClass(elements.container, player.config.classNames.isTouch, true);
+ }
+ }, {
+ key: "setTabFocus",
+ value: function setTabFocus(event) {
+ var player = this.player;
+ var elements = player.elements;
+ clearTimeout(this.focusTimer); // Ignore any key other than tab
+
+ if (event.type === 'keydown' && event.which !== 9) {
+ return;
+ } // Store reference to event timeStamp
+
+
+ if (event.type === 'keydown') {
+ this.lastKeyDown = event.timeStamp;
+ } // Remove current classes
+
+
+ var removeCurrent = function removeCurrent() {
+ var className = player.config.classNames.tabFocus;
+ var current = getElements.call(player, ".".concat(className));
+ toggleClass(current, className, false);
+ }; // Determine if a key was pressed to trigger this event
+
+
+ var wasKeyDown = event.timeStamp - this.lastKeyDown <= 20; // Ignore focus events if a key was pressed prior
+
+ if (event.type === 'focus' && !wasKeyDown) {
+ return;
+ } // Remove all current
+
+
+ removeCurrent(); // Delay the adding of classname until the focus has changed
+ // This event fires before the focusin event
+
+ if (event.type !== 'focusout') {
+ this.focusTimer = setTimeout(function () {
+ var focused = document.activeElement; // Ignore if current focus element isn't inside the player
+
+ if (!elements.container.contains(focused)) {
+ return;
+ }
+
+ toggleClass(document.activeElement, player.config.classNames.tabFocus, true);
+ }, 10);
+ }
+ } // Global window & document listeners
+
+ }, {
+ key: "global",
+ value: function global() {
+ var toggle = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
+ var player = this.player; // Keyboard shortcuts
+
+ if (player.config.keyboard.global) {
+ toggleListener.call(player, window, 'keydown keyup', this.handleKey, toggle, false);
+ } // Click anywhere closes menu
+
+
+ toggleListener.call(player, document.body, 'click', this.toggleMenu, toggle); // Detect touch by events
+
+ once.call(player, document.body, 'touchstart', this.firstTouch); // Tab focus detection
+
+ toggleListener.call(player, document.body, 'keydown focus blur focusout', this.setTabFocus, toggle, false, true);
+ } // Container listeners
+
+ }, {
+ key: "container",
+ value: function container() {
+ var player = this.player;
+ var config = player.config,
+ elements = player.elements,
+ timers = player.timers; // Keyboard shortcuts
+
+ if (!config.keyboard.global && config.keyboard.focused) {
+ on.call(player, elements.container, 'keydown keyup', this.handleKey, false);
+ } // Toggle controls on mouse events and entering fullscreen
+
+
+ on.call(player, elements.container, 'mousemove mouseleave touchstart touchmove enterfullscreen exitfullscreen', function (event) {
+ var controlsElement = elements.controls; // Remove button states for fullscreen
+
+ if (controlsElement && event.type === 'enterfullscreen') {
+ controlsElement.pressed = false;
+ controlsElement.hover = false;
+ } // Show, then hide after a timeout unless another control event occurs
+
+
+ var show = ['touchstart', 'touchmove', 'mousemove'].includes(event.type);
+ var delay = 0;
+
+ if (show) {
+ ui.toggleControls.call(player, true); // Use longer timeout for touch devices
+
+ delay = player.touch ? 3000 : 2000;
+ } // Clear timer
+
+
+ clearTimeout(timers.controls); // Set new timer to prevent flicker when seeking
+
+ timers.controls = setTimeout(function () {
+ return ui.toggleControls.call(player, false);
+ }, delay);
+ }); // Set a gutter for Vimeo
+
+ var setGutter = function setGutter(ratio, padding, toggle) {
+ if (!player.isVimeo || player.config.vimeo.premium) {
+ return;
+ }
+
+ var target = player.elements.wrapper.firstChild;
+
+ var _ratio = _slicedToArray(ratio, 2),
+ y = _ratio[1];
+
+ var _getAspectRatio$call = getAspectRatio.call(player),
+ _getAspectRatio$call2 = _slicedToArray(_getAspectRatio$call, 2),
+ videoX = _getAspectRatio$call2[0],
+ videoY = _getAspectRatio$call2[1];
+
+ target.style.maxWidth = toggle ? "".concat(y / videoY * videoX, "px") : null;
+ target.style.margin = toggle ? '0 auto' : null;
+ }; // Resize on fullscreen change
+
+
+ var setPlayerSize = function setPlayerSize(measure) {
+ // If we don't need to measure the viewport
+ if (!measure) {
+ return setAspectRatio.call(player);
+ }
+
+ var rect = elements.container.getBoundingClientRect();
+ var width = rect.width,
+ height = rect.height;
+ return setAspectRatio.call(player, "".concat(width, ":").concat(height));
+ };
+
+ var resized = function resized() {
+ clearTimeout(timers.resized);
+ timers.resized = setTimeout(setPlayerSize, 50);
+ };
+
+ on.call(player, elements.container, 'enterfullscreen exitfullscreen', function (event) {
+ var _player$fullscreen = player.fullscreen,
+ target = _player$fullscreen.target,
+ usingNative = _player$fullscreen.usingNative; // Ignore events not from target
+
+ if (target !== elements.container) {
+ return;
+ } // If it's not an embed and no ratio specified
+
+
+ if (!player.isEmbed && is$1.empty(player.config.ratio)) {
+ return;
+ }
+
+ var isEnter = event.type === 'enterfullscreen'; // Set the player size when entering fullscreen to viewport size
+
+ var _setPlayerSize = setPlayerSize(isEnter),
+ padding = _setPlayerSize.padding,
+ ratio = _setPlayerSize.ratio; // Set Vimeo gutter
+
+
+ setGutter(ratio, padding, isEnter); // If not using native browser fullscreen API, we need to check for resizes of viewport
+
+ if (!usingNative) {
+ if (isEnter) {
+ on.call(player, window, 'resize', resized);
+ } else {
+ off.call(player, window, 'resize', resized);
+ }
+ }
+ });
+ } // Listen for media events
+
+ }, {
+ key: "media",
+ value: function media() {
+ var _this = this;
+
+ var player = this.player;
+ var elements = player.elements; // Time change on media
+
+ on.call(player, player.media, 'timeupdate seeking seeked', function (event) {
+ return controls.timeUpdate.call(player, event);
+ }); // Display duration
+
+ on.call(player, player.media, 'durationchange loadeddata loadedmetadata', function (event) {
+ return controls.durationUpdate.call(player, event);
+ }); // Handle the media finishing
+
+ on.call(player, player.media, 'ended', function () {
+ // Show poster on end
+ if (player.isHTML5 && player.isVideo && player.config.resetOnEnd) {
+ // Restart
+ player.restart(); // Call pause otherwise IE11 will start playing the video again
+
+ player.pause();
+ }
+ }); // Check for buffer progress
+
+ on.call(player, player.media, 'progress playing seeking seeked', function (event) {
+ return controls.updateProgress.call(player, event);
+ }); // Handle volume changes
+
+ on.call(player, player.media, 'volumechange', function (event) {
+ return controls.updateVolume.call(player, event);
+ }); // Handle play/pause
+
+ on.call(player, player.media, 'playing play pause ended emptied timeupdate', function (event) {
+ return ui.checkPlaying.call(player, event);
+ }); // Loading state
+
+ on.call(player, player.media, 'waiting canplay seeked playing', function (event) {
+ return ui.checkLoading.call(player, event);
+ }); // Click video
+
+ if (player.supported.ui && player.config.clickToPlay && !player.isAudio) {
+ // Re-fetch the wrapper
+ var wrapper = getElement.call(player, ".".concat(player.config.classNames.video)); // Bail if there's no wrapper (this should never happen)
+
+ if (!is$1.element(wrapper)) {
+ return;
+ } // On click play, pause or restart
+
+
+ on.call(player, elements.container, 'click', function (event) {
+ var targets = [elements.container, wrapper]; // Ignore if click if not container or in video wrapper
+
+ if (!targets.includes(event.target) && !wrapper.contains(event.target)) {
+ return;
+ } // Touch devices will just show controls (if hidden)
+
+
+ if (player.touch && player.config.hideControls) {
+ return;
+ }
+
+ if (player.ended) {
+ _this.proxy(event, player.restart, 'restart');
+
+ _this.proxy(event, function () {
+ silencePromise(player.play());
+ }, 'play');
+ } else {
+ _this.proxy(event, function () {
+ silencePromise(player.togglePlay());
+ }, 'play');
+ }
+ });
+ } // Disable right click
+
+
+ if (player.supported.ui && player.config.disableContextMenu) {
+ on.call(player, elements.wrapper, 'contextmenu', function (event) {
+ event.preventDefault();
+ }, false);
+ } // Volume change
+
+
+ on.call(player, player.media, 'volumechange', function () {
+ // Save to storage
+ player.storage.set({
+ volume: player.volume,
+ muted: player.muted
+ });
+ }); // Speed change
+
+ on.call(player, player.media, 'ratechange', function () {
+ // Update UI
+ controls.updateSetting.call(player, 'speed'); // Save to storage
+
+
+ player.storage.set({
+ speed: player.speed
+ });
+ }); // Quality change
+
+ on.call(player, player.media, 'qualitychange', function (event) {
+ // Update UI
+ controls.updateSetting.call(player, 'quality', null, event.detail.quality);
+ }); // Update download link when ready and if quality changes
+
+ on.call(player, player.media, 'ready qualitychange', function () {
+ controls.setDownloadUrl.call(player);
+ }); // Proxy events to container
+ // Bubble up key events for Edge
+
+ var proxyEvents = player.config.events.concat(['keyup', 'keydown']).join(' ');
+ on.call(player, player.media, proxyEvents, function (event) {
+ var _event$detail = event.detail,
+ detail = _event$detail === void 0 ? {} : _event$detail; // Get error details from media
+
+ if (event.type === 'error') {
+ detail = player.media.error;
+ }
+
+ triggerEvent.call(player, elements.container, event.type, true, detail);
+ });
+ } // Run default and custom handlers
+
+ }, {
+ key: "proxy",
+ value: function proxy(event, defaultHandler, customHandlerKey) {
+ var player = this.player;
+ var customHandler = player.config.listeners[customHandlerKey];
+ var hasCustomHandler = is$1.function(customHandler);
+ var returned = true; // Execute custom handler
+
+ if (hasCustomHandler) {
+ returned = customHandler.call(player, event);
+ } // Only call default handler if not prevented in custom handler
+
+
+ if (returned !== false && is$1.function(defaultHandler)) {
+ defaultHandler.call(player, event);
+ }
+ } // Trigger custom and default handlers
+
+ }, {
+ key: "bind",
+ value: function bind(element, type, defaultHandler, customHandlerKey) {
+ var _this2 = this;
+
+ var passive = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
+ var player = this.player;
+ var customHandler = player.config.listeners[customHandlerKey];
+ var hasCustomHandler = is$1.function(customHandler);
+ on.call(player, element, type, function (event) {
+ return _this2.proxy(event, defaultHandler, customHandlerKey);
+ }, passive && !hasCustomHandler);
+ } // Listen for control events
+
+ }, {
+ key: "controls",
+ value: function controls$1() {
+ var _this3 = this;
+
+ var player = this.player;
+ var elements = player.elements; // IE doesn't support input event, so we fallback to change
+
+ var inputEvent = browser.isIE ? 'change' : 'input'; // Play/pause toggle
+
+ if (elements.buttons.play) {
+ Array.from(elements.buttons.play).forEach(function (button) {
+ _this3.bind(button, 'click', function () {
+ silencePromise(player.togglePlay());
+ }, 'play');
+ });
+ } // Pause
+
+
+ this.bind(elements.buttons.restart, 'click', player.restart, 'restart'); // Rewind
+
+ this.bind(elements.buttons.rewind, 'click', player.rewind, 'rewind'); // Rewind
+
+ this.bind(elements.buttons.fastForward, 'click', player.forward, 'fastForward'); // Mute toggle
+
+ this.bind(elements.buttons.mute, 'click', function () {
+ player.muted = !player.muted;
+ }, 'mute'); // Captions toggle
+
+ this.bind(elements.buttons.captions, 'click', function () {
+ return player.toggleCaptions();
+ }); // Download
+
+ this.bind(elements.buttons.download, 'click', function () {
+ triggerEvent.call(player, player.media, 'download');
+ }, 'download'); // Fullscreen toggle
+
+ this.bind(elements.buttons.fullscreen, 'click', function () {
+ player.fullscreen.toggle();
+ }, 'fullscreen'); // Picture-in-Picture
+
+ this.bind(elements.buttons.pip, 'click', function () {
+ player.pip = 'toggle';
+ }, 'pip'); // Airplay
+
+ this.bind(elements.buttons.airplay, 'click', player.airplay, 'airplay'); // Settings menu - click toggle
+
+ this.bind(elements.buttons.settings, 'click', function (event) {
+ // Prevent the document click listener closing the menu
+ event.stopPropagation();
+ event.preventDefault();
+
+ controls.toggleMenu.call(player, event);
+ }, null, false); // Can't be passive as we're preventing default
+ // Settings menu - keyboard toggle
+ // We have to bind to keyup otherwise Firefox triggers a click when a keydown event handler shifts focus
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=1220143
+
+ this.bind(elements.buttons.settings, 'keyup', function (event) {
+ var code = event.which; // We only care about space and return
+
+ if (![13, 32].includes(code)) {
+ return;
+ } // Because return triggers a click anyway, all we need to do is set focus
+
+
+ if (code === 13) {
+ controls.focusFirstMenuItem.call(player, null, true);
+
+ return;
+ } // Prevent scroll
+
+
+ event.preventDefault(); // Prevent playing video (Firefox)
+
+ event.stopPropagation(); // Toggle menu
+
+ controls.toggleMenu.call(player, event);
+ }, null, false // Can't be passive as we're preventing default
+ ); // Escape closes menu
+
+ this.bind(elements.settings.menu, 'keydown', function (event) {
+ if (event.which === 27) {
+ controls.toggleMenu.call(player, event);
+ }
+ }); // Set range input alternative "value", which matches the tooltip time (#954)
+
+ this.bind(elements.inputs.seek, 'mousedown mousemove', function (event) {
+ var rect = elements.progress.getBoundingClientRect();
+ var percent = 100 / rect.width * (event.pageX - rect.left);
+ event.currentTarget.setAttribute('seek-value', percent);
+ }); // Pause while seeking
+
+ this.bind(elements.inputs.seek, 'mousedown mouseup keydown keyup touchstart touchend', function (event) {
+ var seek = event.currentTarget;
+ var code = event.keyCode ? event.keyCode : event.which;
+ var attribute = 'play-on-seeked';
+
+ if (is$1.keyboardEvent(event) && code !== 39 && code !== 37) {
+ return;
+ } // Record seek time so we can prevent hiding controls for a few seconds after seek
+
+
+ player.lastSeekTime = Date.now(); // Was playing before?
+
+ var play = seek.hasAttribute(attribute); // Done seeking
+
+ var done = ['mouseup', 'touchend', 'keyup'].includes(event.type); // If we're done seeking and it was playing, resume playback
+
+ if (play && done) {
+ seek.removeAttribute(attribute);
+ silencePromise(player.play());
+ } else if (!done && player.playing) {
+ seek.setAttribute(attribute, '');
+ player.pause();
+ }
+ }); // Fix range inputs on iOS
+ // Super weird iOS bug where after you interact with an <input type="range">,
+ // it takes over further interactions on the page. This is a hack
+
+ if (browser.isIos) {
+ var inputs = getElements.call(player, 'input[type="range"]');
+ Array.from(inputs).forEach(function (input) {
+ return _this3.bind(input, inputEvent, function (event) {
+ return repaint(event.target);
+ });
+ });
+ } // Seek
+
+
+ this.bind(elements.inputs.seek, inputEvent, function (event) {
+ var seek = event.currentTarget; // If it exists, use seek-value instead of "value" for consistency with tooltip time (#954)
+
+ var seekTo = seek.getAttribute('seek-value');
+
+ if (is$1.empty(seekTo)) {
+ seekTo = seek.value;
+ }
+
+ seek.removeAttribute('seek-value');
+ player.currentTime = seekTo / seek.max * player.duration;
+ }, 'seek'); // Seek tooltip
+
+ this.bind(elements.progress, 'mouseenter mouseleave mousemove', function (event) {
+ return controls.updateSeekTooltip.call(player, event);
+ }); // Preview thumbnails plugin
+ // TODO: Really need to work on some sort of plug-in wide event bus or pub-sub for this
+
+ this.bind(elements.progress, 'mousemove touchmove', function (event) {
+ var previewThumbnails = player.previewThumbnails;
+
+ if (previewThumbnails && previewThumbnails.loaded) {
+ previewThumbnails.startMove(event);
+ }
+ }); // Hide thumbnail preview - on mouse click, mouse leave, and video play/seek. All four are required, e.g., for buffering
+
+ this.bind(elements.progress, 'mouseleave touchend click', function () {
+ var previewThumbnails = player.previewThumbnails;
+
+ if (previewThumbnails && previewThumbnails.loaded) {
+ previewThumbnails.endMove(false, true);
+ }
+ }); // Show scrubbing preview
+
+ this.bind(elements.progress, 'mousedown touchstart', function (event) {
+ var previewThumbnails = player.previewThumbnails;
+
+ if (previewThumbnails && previewThumbnails.loaded) {
+ previewThumbnails.startScrubbing(event);
+ }
+ });
+ this.bind(elements.progress, 'mouseup touchend', function (event) {
+ var previewThumbnails = player.previewThumbnails;
+
+ if (previewThumbnails && previewThumbnails.loaded) {
+ previewThumbnails.endScrubbing(event);
+ }
+ }); // Polyfill for lower fill in <input type="range"> for webkit
+
+ if (browser.isWebkit) {
+ Array.from(getElements.call(player, 'input[type="range"]')).forEach(function (element) {
+ _this3.bind(element, 'input', function (event) {
+ return controls.updateRangeFill.call(player, event.target);
+ });
+ });
+ } // Current time invert
+ // Only if one time element is used for both currentTime and duration
+
+
+ if (player.config.toggleInvert && !is$1.element(elements.display.duration)) {
+ this.bind(elements.display.currentTime, 'click', function () {
+ // Do nothing if we're at the start
+ if (player.currentTime === 0) {
+ return;
+ }
+
+ player.config.invertTime = !player.config.invertTime;
+
+ controls.timeUpdate.call(player);
+ });
+ } // Volume
+
+
+ this.bind(elements.inputs.volume, inputEvent, function (event) {
+ player.volume = event.target.value;
+ }, 'volume'); // Update controls.hover state (used for ui.toggleControls to avoid hiding when interacting)
+
+ this.bind(elements.controls, 'mouseenter mouseleave', function (event) {
+ elements.controls.hover = !player.touch && event.type === 'mouseenter';
+ }); // Also update controls.hover state for any non-player children of fullscreen element (as above)
+
+ if (elements.fullscreen) {
+ Array.from(elements.fullscreen.children).filter(function (c) {
+ return !c.contains(elements.container);
+ }).forEach(function (child) {
+ _this3.bind(child, 'mouseenter mouseleave', function (event) {
+ elements.controls.hover = !player.touch && event.type === 'mouseenter';
+ });
+ });
+ } // Update controls.pressed state (used for ui.toggleControls to avoid hiding when interacting)
+
+
+ this.bind(elements.controls, 'mousedown mouseup touchstart touchend touchcancel', function (event) {
+ elements.controls.pressed = ['mousedown', 'touchstart'].includes(event.type);
+ }); // Show controls when they receive focus (e.g., when using keyboard tab key)
+
+ this.bind(elements.controls, 'focusin', function () {
+ var config = player.config,
+ timers = player.timers; // Skip transition to prevent focus from scrolling the parent element
+
+ toggleClass(elements.controls, config.classNames.noTransition, true); // Toggle
+
+ ui.toggleControls.call(player, true); // Restore transition
+
+ setTimeout(function () {
+ toggleClass(elements.controls, config.classNames.noTransition, false);
+ }, 0); // Delay a little more for mouse users
+
+ var delay = _this3.touch ? 3000 : 4000; // Clear timer
+
+ clearTimeout(timers.controls); // Hide again after delay
+
+ timers.controls = setTimeout(function () {
+ return ui.toggleControls.call(player, false);
+ }, delay);
+ }); // Mouse wheel for volume
+
+ this.bind(elements.inputs.volume, 'wheel', function (event) {
+ // Detect "natural" scroll - suppored on OS X Safari only
+ // Other browsers on OS X will be inverted until support improves
+ var inverted = event.webkitDirectionInvertedFromDevice; // Get delta from event. Invert if `inverted` is true
+
+ var _map = [event.deltaX, -event.deltaY].map(function (value) {
+ return inverted ? -value : value;
+ }),
+ _map2 = _slicedToArray(_map, 2),
+ x = _map2[0],
+ y = _map2[1]; // Using the biggest delta, normalize to 1 or -1 (or 0 if no delta)
+
+
+ var direction = Math.sign(Math.abs(x) > Math.abs(y) ? x : y); // Change the volume by 2%
+
+ player.increaseVolume(direction / 50); // Don't break page scrolling at max and min
+
+ var volume = player.media.volume;
+
+ if (direction === 1 && volume < 1 || direction === -1 && volume > 0) {
+ event.preventDefault();
+ }
+ }, 'volume', false);
+ }
+ }]);
+
+ return Listeners;
+ }();
+
+ var HAS_SPECIES_SUPPORT$3 = arrayMethodHasSpeciesSupport('splice');
+ var USES_TO_LENGTH$a = arrayMethodUsesToLength('splice', { ACCESSORS: true, 0: 0, 1: 2 });
+
+ var max$3 = Math.max;
+ var min$5 = Math.min;
+ var MAX_SAFE_INTEGER$1 = 0x1FFFFFFFFFFFFF;
+ var MAXIMUM_ALLOWED_LENGTH_EXCEEDED = 'Maximum allowed length exceeded';
+
+ // `Array.prototype.splice` method
+ // https://tc39.github.io/ecma262/#sec-array.prototype.splice
+ // with adding support of @@species
+ _export({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT$3 || !USES_TO_LENGTH$a }, {
+ splice: function splice(start, deleteCount /* , ...items */) {
+ var O = toObject(this);
+ var len = toLength(O.length);
+ var actualStart = toAbsoluteIndex(start, len);
+ var argumentsLength = arguments.length;
+ var insertCount, actualDeleteCount, A, k, from, to;
+ if (argumentsLength === 0) {
+ insertCount = actualDeleteCount = 0;
+ } else if (argumentsLength === 1) {
+ insertCount = 0;
+ actualDeleteCount = len - actualStart;
+ } else {
+ insertCount = argumentsLength - 2;
+ actualDeleteCount = min$5(max$3(toInteger(deleteCount), 0), len - actualStart);
+ }
+ if (len + insertCount - actualDeleteCount > MAX_SAFE_INTEGER$1) {
+ throw TypeError(MAXIMUM_ALLOWED_LENGTH_EXCEEDED);
+ }
+ A = arraySpeciesCreate(O, actualDeleteCount);
+ for (k = 0; k < actualDeleteCount; k++) {
+ from = actualStart + k;
+ if (from in O) createProperty(A, k, O[from]);
+ }
+ A.length = actualDeleteCount;
+ if (insertCount < actualDeleteCount) {
+ for (k = actualStart; k < len - actualDeleteCount; k++) {
+ from = k + actualDeleteCount;
+ to = k + insertCount;
+ if (from in O) O[to] = O[from];
+ else delete O[to];
+ }
+ for (k = len; k > len - actualDeleteCount + insertCount; k--) delete O[k - 1];
+ } else if (insertCount > actualDeleteCount) {
+ for (k = len - actualDeleteCount; k > actualStart; k--) {
+ from = k + actualDeleteCount - 1;
+ to = k + insertCount - 1;
+ if (from in O) O[to] = O[from];
+ else delete O[to];
+ }
+ }
+ for (k = 0; k < insertCount; k++) {
+ O[k + actualStart] = arguments[k + 2];
+ }
+ O.length = len - actualDeleteCount + insertCount;
+ return A;
+ }
+ });
+
+ var loadjs_umd = createCommonjsModule(function (module, exports) {
+ (function (root, factory) {
+ {
+ module.exports = factory();
+ }
+ })(commonjsGlobal, function () {
+ /**
+ * Global dependencies.
+ * @global {Object} document - DOM
+ */
+ var devnull = function devnull() {},
+ bundleIdCache = {},
+ bundleResultCache = {},
+ bundleCallbackQueue = {};
+ /**
+ * Subscribe to bundle load event.
+ * @param {string[]} bundleIds - Bundle ids
+ * @param {Function} callbackFn - The callback function
+ */
+
+
+ function subscribe(bundleIds, callbackFn) {
+ // listify
+ bundleIds = bundleIds.push ? bundleIds : [bundleIds];
+ var depsNotFound = [],
+ i = bundleIds.length,
+ numWaiting = i,
+ fn,
+ bundleId,
+ r,
+ q; // define callback function
+
+ fn = function fn(bundleId, pathsNotFound) {
+ if (pathsNotFound.length) depsNotFound.push(bundleId);
+ numWaiting--;
+ if (!numWaiting) callbackFn(depsNotFound);
+ }; // register callback
+
+
+ while (i--) {
+ bundleId = bundleIds[i]; // execute callback if in result cache
+
+ r = bundleResultCache[bundleId];
+
+ if (r) {
+ fn(bundleId, r);
+ continue;
+ } // add to callback queue
+
+
+ q = bundleCallbackQueue[bundleId] = bundleCallbackQueue[bundleId] || [];
+ q.push(fn);
+ }
+ }
+ /**
+ * Publish bundle load event.
+ * @param {string} bundleId - Bundle id
+ * @param {string[]} pathsNotFound - List of files not found
+ */
+
+
+ function publish(bundleId, pathsNotFound) {
+ // exit if id isn't defined
+ if (!bundleId) return;
+ var q = bundleCallbackQueue[bundleId]; // cache result
+
+ bundleResultCache[bundleId] = pathsNotFound; // exit if queue is empty
+
+ if (!q) return; // empty callback queue
+
+ while (q.length) {
+ q[0](bundleId, pathsNotFound);
+ q.splice(0, 1);
+ }
+ }
+ /**
+ * Execute callbacks.
+ * @param {Object or Function} args - The callback args
+ * @param {string[]} depsNotFound - List of dependencies not found
+ */
+
+
+ function executeCallbacks(args, depsNotFound) {
+ // accept function as argument
+ if (args.call) args = {
+ success: args
+ }; // success and error callbacks
+
+ if (depsNotFound.length) (args.error || devnull)(depsNotFound);else (args.success || devnull)(args);
+ }
+ /**
+ * Load individual file.
+ * @param {string} path - The file path
+ * @param {Function} callbackFn - The callback function
+ */
+
+
+ function loadFile(path, callbackFn, args, numTries) {
+ var doc = document,
+ async = args.async,
+ maxTries = (args.numRetries || 0) + 1,
+ beforeCallbackFn = args.before || devnull,
+ pathname = path.replace(/[\?|#].*$/, ''),
+ pathStripped = path.replace(/^(css|img)!/, ''),
+ isLegacyIECss,
+ e;
+ numTries = numTries || 0;
+
+ if (/(^css!|\.css$)/.test(pathname)) {
+ // css
+ e = doc.createElement('link');
+ e.rel = 'stylesheet';
+ e.href = pathStripped; // tag IE9+
+
+ isLegacyIECss = 'hideFocus' in e; // use preload in IE Edge (to detect load errors)
+
+ if (isLegacyIECss && e.relList) {
+ isLegacyIECss = 0;
+ e.rel = 'preload';
+ e.as = 'style';
+ }
+ } else if (/(^img!|\.(png|gif|jpg|svg|webp)$)/.test(pathname)) {
+ // image
+ e = doc.createElement('img');
+ e.src = pathStripped;
+ } else {
+ // javascript
+ e = doc.createElement('script');
+ e.src = path;
+ e.async = async === undefined ? true : async;
+ }
+
+ e.onload = e.onerror = e.onbeforeload = function (ev) {
+ var result = ev.type[0]; // treat empty stylesheets as failures to get around lack of onerror
+ // support in IE9-11
+
+ if (isLegacyIECss) {
+ try {
+ if (!e.sheet.cssText.length) result = 'e';
+ } catch (x) {
+ // sheets objects created from load errors don't allow access to
+ // `cssText` (unless error is Code:18 SecurityError)
+ if (x.code != 18) result = 'e';
+ }
+ } // handle retries in case of load failure
+
+
+ if (result == 'e') {
+ // increment counter
+ numTries += 1; // exit function and try again
+
+ if (numTries < maxTries) {
+ return loadFile(path, callbackFn, args, numTries);
+ }
+ } else if (e.rel == 'preload' && e.as == 'style') {
+ // activate preloaded stylesheets
+ return e.rel = 'stylesheet'; // jshint ignore:line
+ } // execute callback
+
+
+ callbackFn(path, result, ev.defaultPrevented);
+ }; // add to document (unless callback returns `false`)
+
+
+ if (beforeCallbackFn(path, e) !== false) doc.head.appendChild(e);
+ }
+ /**
+ * Load multiple files.
+ * @param {string[]} paths - The file paths
+ * @param {Function} callbackFn - The callback function
+ */
+
+
+ function loadFiles(paths, callbackFn, args) {
+ // listify paths
+ paths = paths.push ? paths : [paths];
+ var numWaiting = paths.length,
+ x = numWaiting,
+ pathsNotFound = [],
+ fn,
+ i; // define callback function
+
+ fn = function fn(path, result, defaultPrevented) {
+ // handle error
+ if (result == 'e') pathsNotFound.push(path); // handle beforeload event. If defaultPrevented then that means the load
+ // will be blocked (ex. Ghostery/ABP on Safari)
+
+ if (result == 'b') {
+ if (defaultPrevented) pathsNotFound.push(path);else return;
+ }
+
+ numWaiting--;
+ if (!numWaiting) callbackFn(pathsNotFound);
+ }; // load scripts
+
+
+ for (i = 0; i < x; i++) {
+ loadFile(paths[i], fn, args);
+ }
+ }
+ /**
+ * Initiate script load and register bundle.
+ * @param {(string|string[])} paths - The file paths
+ * @param {(string|Function|Object)} [arg1] - The (1) bundleId or (2) success
+ * callback or (3) object literal with success/error arguments, numRetries,
+ * etc.
+ * @param {(Function|Object)} [arg2] - The (1) success callback or (2) object
+ * literal with success/error arguments, numRetries, etc.
+ */
+
+
+ function loadjs(paths, arg1, arg2) {
+ var bundleId, args; // bundleId (if string)
+
+ if (arg1 && arg1.trim) bundleId = arg1; // args (default is {})
+
+ args = (bundleId ? arg2 : arg1) || {}; // throw error if bundle is already defined
+
+ if (bundleId) {
+ if (bundleId in bundleIdCache) {
+ throw "LoadJS";
+ } else {
+ bundleIdCache[bundleId] = true;
+ }
+ }
+
+ function loadFn(resolve, reject) {
+ loadFiles(paths, function (pathsNotFound) {
+ // execute callbacks
+ executeCallbacks(args, pathsNotFound); // resolve Promise
+
+ if (resolve) {
+ executeCallbacks({
+ success: resolve,
+ error: reject
+ }, pathsNotFound);
+ } // publish bundle load event
+
+
+ publish(bundleId, pathsNotFound);
+ }, args);
+ }
+
+ if (args.returnPromise) return new Promise(loadFn);else loadFn();
+ }
+ /**
+ * Execute callbacks when dependencies have been satisfied.
+ * @param {(string|string[])} deps - List of bundle ids
+ * @param {Object} args - success/error arguments
+ */
+
+
+ loadjs.ready = function ready(deps, args) {
+ // subscribe to bundle load event
+ subscribe(deps, function (depsNotFound) {
+ // execute callbacks
+ executeCallbacks(args, depsNotFound);
+ });
+ return loadjs;
+ };
+ /**
+ * Manually satisfy bundle dependencies.
+ * @param {string} bundleId - The bundle id
+ */
+
+
+ loadjs.done = function done(bundleId) {
+ publish(bundleId, []);
+ };
+ /**
+ * Reset loadjs dependencies statuses
+ */
+
+
+ loadjs.reset = function reset() {
+ bundleIdCache = {};
+ bundleResultCache = {};
+ bundleCallbackQueue = {};
+ };
+ /**
+ * Determine if bundle has already been defined
+ * @param String} bundleId - The bundle id
+ */
+
+
+ loadjs.isDefined = function isDefined(bundleId) {
+ return bundleId in bundleIdCache;
+ }; // export
+
+
+ return loadjs;
+ });
+ });
+
+ function loadScript(url) {
+ return new Promise(function (resolve, reject) {
+ loadjs_umd(url, {
+ success: resolve,
+ error: reject
+ });
+ });
+ }
+
+ function parseId(url) {
+ if (is$1.empty(url)) {
+ return null;
+ }
+
+ if (is$1.number(Number(url))) {
+ return url;
+ }
+
+ var regex = /^.*(vimeo.com\/|video\/)(\d+).*/;
+ return url.match(regex) ? RegExp.$2 : url;
+ } // Set playback state and trigger change (only on actual change)
+
+
+ function assurePlaybackState(play) {
+ if (play && !this.embed.hasPlayed) {
+ this.embed.hasPlayed = true;
+ }
+
+ if (this.media.paused === play) {
+ this.media.paused = !play;
+ triggerEvent.call(this, this.media, play ? 'play' : 'pause');
+ }
+ }
+
+ var vimeo = {
+ setup: function setup() {
+ var player = this; // Add embed class for responsive
+
+ toggleClass(player.elements.wrapper, player.config.classNames.embed, true); // Set speed options from config
+
+ player.options.speed = player.config.speed.options; // Set intial ratio
+
+ setAspectRatio.call(player); // Load the SDK if not already
+
+ if (!is$1.object(window.Vimeo)) {
+ loadScript(player.config.urls.vimeo.sdk).then(function () {
+ vimeo.ready.call(player);
+ }).catch(function (error) {
+ player.debug.warn('Vimeo SDK (player.js) failed to load', error);
+ });
+ } else {
+ vimeo.ready.call(player);
+ }
+ },
+ // API Ready
+ ready: function ready() {
+ var _this = this;
+
+ var player = this;
+ var config = player.config.vimeo;
+
+ var premium = config.premium,
+ referrerPolicy = config.referrerPolicy,
+ frameParams = _objectWithoutProperties(config, ["premium", "referrerPolicy"]); // If the owner has a pro or premium account then we can hide controls etc
+
+
+ if (premium) {
+ Object.assign(frameParams, {
+ controls: false,
+ sidedock: false
+ });
+ } // Get Vimeo params for the iframe
+
+
+ var params = buildUrlParams(_objectSpread2({
+ loop: player.config.loop.active,
+ autoplay: player.autoplay,
+ muted: player.muted,
+ gesture: 'media',
+ playsinline: !this.config.fullscreen.iosNative
+ }, frameParams)); // Get the source URL or ID
+
+ var source = player.media.getAttribute('src'); // Get from <div> if needed
+
+ if (is$1.empty(source)) {
+ source = player.media.getAttribute(player.config.attributes.embed.id);
+ }
+
+ var id = parseId(source); // Build an iframe
+
+ var iframe = createElement('iframe');
+ var src = format(player.config.urls.vimeo.iframe, id, params);
+ iframe.setAttribute('src', src);
+ iframe.setAttribute('allowfullscreen', '');
+ iframe.setAttribute('allow', 'autoplay,fullscreen,picture-in-picture'); // Set the referrer policy if required
+
+ if (!is$1.empty(referrerPolicy)) {
+ iframe.setAttribute('referrerPolicy', referrerPolicy);
+ } // Inject the package
+
+
+ var poster = player.poster;
+
+ if (premium) {
+ iframe.setAttribute('data-poster', poster);
+ player.media = replaceElement(iframe, player.media);
+ } else {
+ var wrapper = createElement('div', {
+ class: player.config.classNames.embedContainer,
+ 'data-poster': poster
+ });
+ wrapper.appendChild(iframe);
+ player.media = replaceElement(wrapper, player.media);
+ } // Get poster image
+
+
+ fetch(format(player.config.urls.vimeo.api, id), 'json').then(function (response) {
+ if (is$1.empty(response)) {
+ return;
+ } // Get the URL for thumbnail
+
+
+ var url = new URL(response[0].thumbnail_large); // Get original image
+
+ url.pathname = "".concat(url.pathname.split('_')[0], ".jpg"); // Set and show poster
+
+ ui.setPoster.call(player, url.href).catch(function () {});
+ }); // Setup instance
+ // https://github.com/vimeo/player.js
+
+ player.embed = new window.Vimeo.Player(iframe, {
+ autopause: player.config.autopause,
+ muted: player.muted
+ });
+ player.media.paused = true;
+ player.media.currentTime = 0; // Disable native text track rendering
+
+ if (player.supported.ui) {
+ player.embed.disableTextTrack();
+ } // Create a faux HTML5 API using the Vimeo API
+
+
+ player.media.play = function () {
+ assurePlaybackState.call(player, true);
+ return player.embed.play();
+ };
+
+ player.media.pause = function () {
+ assurePlaybackState.call(player, false);
+ return player.embed.pause();
+ };
+
+ player.media.stop = function () {
+ player.pause();
+ player.currentTime = 0;
+ }; // Seeking
+
+
+ var currentTime = player.media.currentTime;
+ Object.defineProperty(player.media, 'currentTime', {
+ get: function get() {
+ return currentTime;
+ },
+ set: function set(time) {
+ // Vimeo will automatically play on seek if the video hasn't been played before
+ // Get current paused state and volume etc
+ var embed = player.embed,
+ media = player.media,
+ paused = player.paused,
+ volume = player.volume;
+ var restorePause = paused && !embed.hasPlayed; // Set seeking state and trigger event
+
+ media.seeking = true;
+ triggerEvent.call(player, media, 'seeking'); // If paused, mute until seek is complete
+
+ Promise.resolve(restorePause && embed.setVolume(0)) // Seek
+ .then(function () {
+ return embed.setCurrentTime(time);
+ }) // Restore paused
+ .then(function () {
+ return restorePause && embed.pause();
+ }) // Restore volume
+ .then(function () {
+ return restorePause && embed.setVolume(volume);
+ }).catch(function () {// Do nothing
+ });
+ }
+ }); // Playback speed
+
+ var speed = player.config.speed.selected;
+ Object.defineProperty(player.media, 'playbackRate', {
+ get: function get() {
+ return speed;
+ },
+ set: function set(input) {
+ player.embed.setPlaybackRate(input).then(function () {
+ speed = input;
+ triggerEvent.call(player, player.media, 'ratechange');
+ }).catch(function () {
+ // Cannot set Playback Rate, Video is probably not on Pro account
+ player.options.speed = [1];
+ });
+ }
+ }); // Volume
+
+ var volume = player.config.volume;
+ Object.defineProperty(player.media, 'volume', {
+ get: function get() {
+ return volume;
+ },
+ set: function set(input) {
+ player.embed.setVolume(input).then(function () {
+ volume = input;
+ triggerEvent.call(player, player.media, 'volumechange');
+ });
+ }
+ }); // Muted
+
+ var muted = player.config.muted;
+ Object.defineProperty(player.media, 'muted', {
+ get: function get() {
+ return muted;
+ },
+ set: function set(input) {
+ var toggle = is$1.boolean(input) ? input : false;
+ player.embed.setVolume(toggle ? 0 : player.config.volume).then(function () {
+ muted = toggle;
+ triggerEvent.call(player, player.media, 'volumechange');
+ });
+ }
+ }); // Loop
+
+ var loop = player.config.loop;
+ Object.defineProperty(player.media, 'loop', {
+ get: function get() {
+ return loop;
+ },
+ set: function set(input) {
+ var toggle = is$1.boolean(input) ? input : player.config.loop.active;
+ player.embed.setLoop(toggle).then(function () {
+ loop = toggle;
+ });
+ }
+ }); // Source
+
+ var currentSrc;
+ player.embed.getVideoUrl().then(function (value) {
+ currentSrc = value;
+ controls.setDownloadUrl.call(player);
+ }).catch(function (error) {
+ _this.debug.warn(error);
+ });
+ Object.defineProperty(player.media, 'currentSrc', {
+ get: function get() {
+ return currentSrc;
+ }
+ }); // Ended
+
+ Object.defineProperty(player.media, 'ended', {
+ get: function get() {
+ return player.currentTime === player.duration;
+ }
+ }); // Set aspect ratio based on video size
+
+ Promise.all([player.embed.getVideoWidth(), player.embed.getVideoHeight()]).then(function (dimensions) {
+ var _dimensions = _slicedToArray(dimensions, 2),
+ width = _dimensions[0],
+ height = _dimensions[1];
+
+ player.embed.ratio = [width, height];
+ setAspectRatio.call(_this);
+ }); // Set autopause
+
+ player.embed.setAutopause(player.config.autopause).then(function (state) {
+ player.config.autopause = state;
+ }); // Get title
+
+ player.embed.getVideoTitle().then(function (title) {
+ player.config.title = title;
+ ui.setTitle.call(_this);
+ }); // Get current time
+
+ player.embed.getCurrentTime().then(function (value) {
+ currentTime = value;
+ triggerEvent.call(player, player.media, 'timeupdate');
+ }); // Get duration
+
+ player.embed.getDuration().then(function (value) {
+ player.media.duration = value;
+ triggerEvent.call(player, player.media, 'durationchange');
+ }); // Get captions
+
+ player.embed.getTextTracks().then(function (tracks) {
+ player.media.textTracks = tracks;
+ captions.setup.call(player);
+ });
+ player.embed.on('cuechange', function (_ref) {
+ var _ref$cues = _ref.cues,
+ cues = _ref$cues === void 0 ? [] : _ref$cues;
+ var strippedCues = cues.map(function (cue) {
+ return stripHTML(cue.text);
+ });
+ captions.updateCues.call(player, strippedCues);
+ });
+ player.embed.on('loaded', function () {
+ // Assure state and events are updated on autoplay
+ player.embed.getPaused().then(function (paused) {
+ assurePlaybackState.call(player, !paused);
+
+ if (!paused) {
+ triggerEvent.call(player, player.media, 'playing');
+ }
+ });
+
+ if (is$1.element(player.embed.element) && player.supported.ui) {
+ var frame = player.embed.element; // Fix keyboard focus issues
+ // https://github.com/sampotts/plyr/issues/317
+
+ frame.setAttribute('tabindex', -1);
+ }
+ });
+ player.embed.on('bufferstart', function () {
+ triggerEvent.call(player, player.media, 'waiting');
+ });
+ player.embed.on('bufferend', function () {
+ triggerEvent.call(player, player.media, 'playing');
+ });
+ player.embed.on('play', function () {
+ assurePlaybackState.call(player, true);
+ triggerEvent.call(player, player.media, 'playing');
+ });
+ player.embed.on('pause', function () {
+ assurePlaybackState.call(player, false);
+ });
+ player.embed.on('timeupdate', function (data) {
+ player.media.seeking = false;
+ currentTime = data.seconds;
+ triggerEvent.call(player, player.media, 'timeupdate');
+ });
+ player.embed.on('progress', function (data) {
+ player.media.buffered = data.percent;
+ triggerEvent.call(player, player.media, 'progress'); // Check all loaded
+
+ if (parseInt(data.percent, 10) === 1) {
+ triggerEvent.call(player, player.media, 'canplaythrough');
+ } // Get duration as if we do it before load, it gives an incorrect value
+ // https://github.com/sampotts/plyr/issues/891
+
+
+ player.embed.getDuration().then(function (value) {
+ if (value !== player.media.duration) {
+ player.media.duration = value;
+ triggerEvent.call(player, player.media, 'durationchange');
+ }
+ });
+ });
+ player.embed.on('seeked', function () {
+ player.media.seeking = false;
+ triggerEvent.call(player, player.media, 'seeked');
+ });
+ player.embed.on('ended', function () {
+ player.media.paused = true;
+ triggerEvent.call(player, player.media, 'ended');
+ });
+ player.embed.on('error', function (detail) {
+ player.media.error = detail;
+ triggerEvent.call(player, player.media, 'error');
+ }); // Rebuild UI
+
+ setTimeout(function () {
+ return ui.build.call(player);
+ }, 0);
+ }
+ };
+
+ function parseId$1(url) {
+ if (is$1.empty(url)) {
+ return null;
+ }
+
+ var regex = /^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*/;
+ return url.match(regex) ? RegExp.$2 : url;
+ } // Set playback state and trigger change (only on actual change)
+
+
+ function assurePlaybackState$1(play) {
+ if (play && !this.embed.hasPlayed) {
+ this.embed.hasPlayed = true;
+ }
+
+ if (this.media.paused === play) {
+ this.media.paused = !play;
+ triggerEvent.call(this, this.media, play ? 'play' : 'pause');
+ }
+ }
+
+ function getHost$1(config) {
+ if (config.noCookie) {
+ return 'https://www.youtube-nocookie.com';
+ }
+
+ if (window.location.protocol === 'http:') {
+ return 'http://www.youtube.com';
+ } // Use YouTube's default
+
+
+ return undefined;
+ }
+
+ var youtube = {
+ setup: function setup() {
+ var _this = this;
+
+ // Add embed class for responsive
+ toggleClass(this.elements.wrapper, this.config.classNames.embed, true); // Setup API
+
+ if (is$1.object(window.YT) && is$1.function(window.YT.Player)) {
+ youtube.ready.call(this);
+ } else {
+ // Reference current global callback
+ var callback = window.onYouTubeIframeAPIReady; // Set callback to process queue
+
+ window.onYouTubeIframeAPIReady = function () {
+ // Call global callback if set
+ if (is$1.function(callback)) {
+ callback();
+ }
+
+ youtube.ready.call(_this);
+ }; // Load the SDK
+
+
+ loadScript(this.config.urls.youtube.sdk).catch(function (error) {
+ _this.debug.warn('YouTube API failed to load', error);
+ });
+ }
+ },
+ // Get the media title
+ getTitle: function getTitle(videoId) {
+ var _this2 = this;
+
+ var url = format(this.config.urls.youtube.api, videoId);
+ fetch(url).then(function (data) {
+ if (is$1.object(data)) {
+ var title = data.title,
+ height = data.height,
+ width = data.width; // Set title
+
+ _this2.config.title = title;
+ ui.setTitle.call(_this2); // Set aspect ratio
+
+ _this2.embed.ratio = [width, height];
+ }
+
+ setAspectRatio.call(_this2);
+ }).catch(function () {
+ // Set aspect ratio
+ setAspectRatio.call(_this2);
+ });
+ },
+ // API ready
+ ready: function ready() {
+ var player = this; // Ignore already setup (race condition)
+
+ var currentId = player.media && player.media.getAttribute('id');
+
+ if (!is$1.empty(currentId) && currentId.startsWith('youtube-')) {
+ return;
+ } // Get the source URL or ID
+
+
+ var source = player.media.getAttribute('src'); // Get from <div> if needed
+
+ if (is$1.empty(source)) {
+ source = player.media.getAttribute(this.config.attributes.embed.id);
+ } // Replace the <iframe> with a <div> due to YouTube API issues
+
+
+ var videoId = parseId$1(source);
+ var id = generateId(player.provider); // Get poster, if already set
+
+ var poster = player.poster; // Replace media element
+
+ var container = createElement('div', {
+ id: id,
+ 'data-poster': poster
+ });
+ player.media = replaceElement(container, player.media); // Id to poster wrapper
+
+ var posterSrc = function posterSrc(s) {
+ return "https://i.ytimg.com/vi/".concat(videoId, "/").concat(s, "default.jpg");
+ }; // Check thumbnail images in order of quality, but reject fallback thumbnails (120px wide)
+
+
+ loadImage(posterSrc('maxres'), 121) // Higest quality and unpadded
+ .catch(function () {
+ return loadImage(posterSrc('sd'), 121);
+ }) // 480p padded 4:3
+ .catch(function () {
+ return loadImage(posterSrc('hq'));
+ }) // 360p padded 4:3. Always exists
+ .then(function (image) {
+ return ui.setPoster.call(player, image.src);
+ }).then(function (src) {
+ // If the image is padded, use background-size "cover" instead (like youtube does too with their posters)
+ if (!src.includes('maxres')) {
+ player.elements.poster.style.backgroundSize = 'cover';
+ }
+ }).catch(function () {});
+ var config = player.config.youtube; // Setup instance
+ // https://developers.google.com/youtube/iframe_api_reference
+
+ player.embed = new window.YT.Player(id, {
+ videoId: videoId,
+ host: getHost$1(config),
+ playerVars: extend({}, {
+ autoplay: player.config.autoplay ? 1 : 0,
+ // Autoplay
+ hl: player.config.hl,
+ // iframe interface language
+ controls: player.supported.ui ? 0 : 1,
+ // Only show controls if not fully supported
+ disablekb: 1,
+ // Disable keyboard as we handle it
+ playsinline: !player.config.fullscreen.iosNative ? 1 : 0,
+ // Allow iOS inline playback
+ // Captions are flaky on YouTube
+ cc_load_policy: player.captions.active ? 1 : 0,
+ cc_lang_pref: player.config.captions.language,
+ // Tracking for stats
+ widget_referrer: window ? window.location.href : null
+ }, config),
+ events: {
+ onError: function onError(event) {
+ // YouTube may fire onError twice, so only handle it once
+ if (!player.media.error) {
+ var code = event.data; // Messages copied from https://developers.google.com/youtube/iframe_api_reference#onError
+
+ var message = {
+ 2: 'The request contains an invalid parameter value. For example, this error occurs if you specify a video ID that does not have 11 characters, or if the video ID contains invalid characters, such as exclamation points or asterisks.',
+ 5: 'The requested content cannot be played in an HTML5 player or another error related to the HTML5 player has occurred.',
+ 100: 'The video requested was not found. This error occurs when a video has been removed (for any reason) or has been marked as private.',
+ 101: 'The owner of the requested video does not allow it to be played in embedded players.',
+ 150: 'The owner of the requested video does not allow it to be played in embedded players.'
+ }[code] || 'An unknown error occured';
+ player.media.error = {
+ code: code,
+ message: message
+ };
+ triggerEvent.call(player, player.media, 'error');
+ }
+ },
+ onPlaybackRateChange: function onPlaybackRateChange(event) {
+ // Get the instance
+ var instance = event.target; // Get current speed
+
+ player.media.playbackRate = instance.getPlaybackRate();
+ triggerEvent.call(player, player.media, 'ratechange');
+ },
+ onReady: function onReady(event) {
+ // Bail if onReady has already been called. See issue #1108
+ if (is$1.function(player.media.play)) {
+ return;
+ } // Get the instance
+
+
+ var instance = event.target; // Get the title
+
+ youtube.getTitle.call(player, videoId); // Create a faux HTML5 API using the YouTube API
+
+ player.media.play = function () {
+ assurePlaybackState$1.call(player, true);
+ instance.playVideo();
+ };
+
+ player.media.pause = function () {
+ assurePlaybackState$1.call(player, false);
+ instance.pauseVideo();
+ };
+
+ player.media.stop = function () {
+ instance.stopVideo();
+ };
+
+ player.media.duration = instance.getDuration();
+ player.media.paused = true; // Seeking
+
+ player.media.currentTime = 0;
+ Object.defineProperty(player.media, 'currentTime', {
+ get: function get() {
+ return Number(instance.getCurrentTime());
+ },
+ set: function set(time) {
+ // If paused and never played, mute audio preventively (YouTube starts playing on seek if the video hasn't been played yet).
+ if (player.paused && !player.embed.hasPlayed) {
+ player.embed.mute();
+ } // Set seeking state and trigger event
+
+
+ player.media.seeking = true;
+ triggerEvent.call(player, player.media, 'seeking'); // Seek after events sent
+
+ instance.seekTo(time);
+ }
+ }); // Playback speed
+
+ Object.defineProperty(player.media, 'playbackRate', {
+ get: function get() {
+ return instance.getPlaybackRate();
+ },
+ set: function set(input) {
+ instance.setPlaybackRate(input);
+ }
+ }); // Volume
+
+ var volume = player.config.volume;
+ Object.defineProperty(player.media, 'volume', {
+ get: function get() {
+ return volume;
+ },
+ set: function set(input) {
+ volume = input;
+ instance.setVolume(volume * 100);
+ triggerEvent.call(player, player.media, 'volumechange');
+ }
+ }); // Muted
+
+ var muted = player.config.muted;
+ Object.defineProperty(player.media, 'muted', {
+ get: function get() {
+ return muted;
+ },
+ set: function set(input) {
+ var toggle = is$1.boolean(input) ? input : muted;
+ muted = toggle;
+ instance[toggle ? 'mute' : 'unMute']();
+ triggerEvent.call(player, player.media, 'volumechange');
+ }
+ }); // Source
+
+ Object.defineProperty(player.media, 'currentSrc', {
+ get: function get() {
+ return instance.getVideoUrl();
+ }
+ }); // Ended
+
+ Object.defineProperty(player.media, 'ended', {
+ get: function get() {
+ return player.currentTime === player.duration;
+ }
+ }); // Get available speeds
+
+ var speeds = instance.getAvailablePlaybackRates(); // Filter based on config
+
+ player.options.speed = speeds.filter(function (s) {
+ return player.config.speed.options.includes(s);
+ }); // Set the tabindex to avoid focus entering iframe
+
+ if (player.supported.ui) {
+ player.media.setAttribute('tabindex', -1);
+ }
+
+ triggerEvent.call(player, player.media, 'timeupdate');
+ triggerEvent.call(player, player.media, 'durationchange'); // Reset timer
+
+ clearInterval(player.timers.buffering); // Setup buffering
+
+ player.timers.buffering = setInterval(function () {
+ // Get loaded % from YouTube
+ player.media.buffered = instance.getVideoLoadedFraction(); // Trigger progress only when we actually buffer something
+
+ if (player.media.lastBuffered === null || player.media.lastBuffered < player.media.buffered) {
+ triggerEvent.call(player, player.media, 'progress');
+ } // Set last buffer point
+
+
+ player.media.lastBuffered = player.media.buffered; // Bail if we're at 100%
+
+ if (player.media.buffered === 1) {
+ clearInterval(player.timers.buffering); // Trigger event
+
+ triggerEvent.call(player, player.media, 'canplaythrough');
+ }
+ }, 200); // Rebuild UI
+
+ setTimeout(function () {
+ return ui.build.call(player);
+ }, 50);
+ },
+ onStateChange: function onStateChange(event) {
+ // Get the instance
+ var instance = event.target; // Reset timer
+
+ clearInterval(player.timers.playing);
+ var seeked = player.media.seeking && [1, 2].includes(event.data);
+
+ if (seeked) {
+ // Unset seeking and fire seeked event
+ player.media.seeking = false;
+ triggerEvent.call(player, player.media, 'seeked');
+ } // Handle events
+ // -1 Unstarted
+ // 0 Ended
+ // 1 Playing
+ // 2 Paused
+ // 3 Buffering
+ // 5 Video cued
+
+
+ switch (event.data) {
+ case -1:
+ // Update scrubber
+ triggerEvent.call(player, player.media, 'timeupdate'); // Get loaded % from YouTube
+
+ player.media.buffered = instance.getVideoLoadedFraction();
+ triggerEvent.call(player, player.media, 'progress');
+ break;
+
+ case 0:
+ assurePlaybackState$1.call(player, false); // YouTube doesn't support loop for a single video, so mimick it.
+
+ if (player.media.loop) {
+ // YouTube needs a call to `stopVideo` before playing again
+ instance.stopVideo();
+ instance.playVideo();
+ } else {
+ triggerEvent.call(player, player.media, 'ended');
+ }
+
+ break;
+
+ case 1:
+ // Restore paused state (YouTube starts playing on seek if the video hasn't been played yet)
+ if (!player.config.autoplay && player.media.paused && !player.embed.hasPlayed) {
+ player.media.pause();
+ } else {
+ assurePlaybackState$1.call(player, true);
+ triggerEvent.call(player, player.media, 'playing'); // Poll to get playback progress
+
+ player.timers.playing = setInterval(function () {
+ triggerEvent.call(player, player.media, 'timeupdate');
+ }, 50); // Check duration again due to YouTube bug
+ // https://github.com/sampotts/plyr/issues/374
+ // https://code.google.com/p/gdata-issues/issues/detail?id=8690
+
+ if (player.media.duration !== instance.getDuration()) {
+ player.media.duration = instance.getDuration();
+ triggerEvent.call(player, player.media, 'durationchange');
+ }
+ }
+
+ break;
+
+ case 2:
+ // Restore audio (YouTube starts playing on seek if the video hasn't been played yet)
+ if (!player.muted) {
+ player.embed.unMute();
+ }
+
+ assurePlaybackState$1.call(player, false);
+ break;
+
+ case 3:
+ // Trigger waiting event to add loading classes to container as the video buffers.
+ triggerEvent.call(player, player.media, 'waiting');
+ break;
+ }
+
+ triggerEvent.call(player, player.elements.container, 'statechange', false, {
+ code: event.data
+ });
+ }
+ }
+ });
+ }
+ };
+
+ var media = {
+ // Setup media
+ setup: function setup() {
+ // If there's no media, bail
+ if (!this.media) {
+ this.debug.warn('No media element found!');
+ return;
+ } // Add type class
+
+
+ toggleClass(this.elements.container, this.config.classNames.type.replace('{0}', this.type), true); // Add provider class
+
+ toggleClass(this.elements.container, this.config.classNames.provider.replace('{0}', this.provider), true); // Add video class for embeds
+ // This will require changes if audio embeds are added
+
+ if (this.isEmbed) {
+ toggleClass(this.elements.container, this.config.classNames.type.replace('{0}', 'video'), true);
+ } // Inject the player wrapper
+
+
+ if (this.isVideo) {
+ // Create the wrapper div
+ this.elements.wrapper = createElement('div', {
+ class: this.config.classNames.video
+ }); // Wrap the video in a container
+
+ wrap$1(this.media, this.elements.wrapper); // Poster image container
+
+ this.elements.poster = createElement('div', {
+ class: this.config.classNames.poster
+ });
+ this.elements.wrapper.appendChild(this.elements.poster);
+ }
+
+ if (this.isHTML5) {
+ html5.setup.call(this);
+ } else if (this.isYouTube) {
+ youtube.setup.call(this);
+ } else if (this.isVimeo) {
+ vimeo.setup.call(this);
+ }
+ }
+ };
+
+ var destroy = function destroy(instance) {
+ // Destroy our adsManager
+ if (instance.manager) {
+ instance.manager.destroy();
+ } // Destroy our adsManager
+
+
+ if (instance.elements.displayContainer) {
+ instance.elements.displayContainer.destroy();
+ }
+
+ instance.elements.container.remove();
+ };
+
+ var Ads = /*#__PURE__*/function () {
+ /**
+ * Ads constructor.
+ * @param {Object} player
+ * @return {Ads}
+ */
+ function Ads(player) {
+ var _this = this;
+
+ _classCallCheck(this, Ads);
+
+ this.player = player;
+ this.config = player.config.ads;
+ this.playing = false;
+ this.initialized = false;
+ this.elements = {
+ container: null,
+ displayContainer: null
+ };
+ this.manager = null;
+ this.loader = null;
+ this.cuePoints = null;
+ this.events = {};
+ this.safetyTimer = null;
+ this.countdownTimer = null; // Setup a promise to resolve when the IMA manager is ready
+
+ this.managerPromise = new Promise(function (resolve, reject) {
+ // The ad is loaded and ready
+ _this.on('loaded', resolve); // Ads failed
+
+
+ _this.on('error', reject);
+ });
+ this.load();
+ }
+
+ _createClass(Ads, [{
+ key: "load",
+
+ /**
+ * Load the IMA SDK
+ */
+ value: function load() {
+ var _this2 = this;
+
+ if (!this.enabled) {
+ return;
+ } // Check if the Google IMA3 SDK is loaded or load it ourselves
+
+
+ if (!is$1.object(window.google) || !is$1.object(window.google.ima)) {
+ loadScript(this.player.config.urls.googleIMA.sdk).then(function () {
+ _this2.ready();
+ }).catch(function () {
+ // Script failed to load or is blocked
+ _this2.trigger('error', new Error('Google IMA SDK failed to load'));
+ });
+ } else {
+ this.ready();
+ }
+ }
+ /**
+ * Get the ads instance ready
+ */
+
+ }, {
+ key: "ready",
+ value: function ready() {
+ var _this3 = this;
+
+ // Double check we're enabled
+ if (!this.enabled) {
+ destroy(this);
+ } // Start ticking our safety timer. If the whole advertisement
+ // thing doesn't resolve within our set time; we bail
+
+
+ this.startSafetyTimer(12000, 'ready()'); // Clear the safety timer
+
+ this.managerPromise.then(function () {
+ _this3.clearSafetyTimer('onAdsManagerLoaded()');
+ }); // Set listeners on the Plyr instance
+
+ this.listeners(); // Setup the IMA SDK
+
+ this.setupIMA();
+ } // Build the tag URL
+
+ }, {
+ key: "setupIMA",
+
+ /**
+ * In order for the SDK to display ads for our video, we need to tell it where to put them,
+ * so here we define our ad container. This div is set up to render on top of the video player.
+ * Using the code below, we tell the SDK to render ads within that div. We also provide a
+ * handle to the content video player - the SDK will poll the current time of our player to
+ * properly place mid-rolls. After we create the ad display container, we initialize it. On
+ * mobile devices, this initialization is done as the result of a user action.
+ */
+ value: function setupIMA() {
+ var _this4 = this;
+
+ // Create the container for our advertisements
+ this.elements.container = createElement('div', {
+ class: this.player.config.classNames.ads
+ });
+ this.player.elements.container.appendChild(this.elements.container); // So we can run VPAID2
+
+ google.ima.settings.setVpaidMode(google.ima.ImaSdkSettings.VpaidMode.ENABLED); // Set language
+
+ google.ima.settings.setLocale(this.player.config.ads.language); // Set playback for iOS10+
+
+ 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
+
+ this.elements.displayContainer = new google.ima.AdDisplayContainer(this.elements.container, this.player.media); // Create ads loader
+
+ this.loader = new google.ima.AdsLoader(this.elements.displayContainer); // Listen and respond to ads loaded and error events
+
+ this.loader.addEventListener(google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED, function (event) {
+ return _this4.onAdsManagerLoaded(event);
+ }, false);
+ this.loader.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR, function (error) {
+ return _this4.onAdError(error);
+ }, false); // Request video ads to be pre-loaded
+
+ this.requestAds();
+ }
+ /**
+ * Request advertisements
+ */
+
+ }, {
+ key: "requestAds",
+ value: function requestAds() {
+ var container = this.player.elements.container;
+
+ try {
+ // Request video ads
+ var request = new google.ima.AdsRequest();
+ request.adTagUrl = this.tagUrl; // Specify the linear and nonlinear slot sizes. This helps the SDK
+ // to select the correct creative if multiple are returned
+
+ request.linearAdSlotWidth = container.offsetWidth;
+ request.linearAdSlotHeight = container.offsetHeight;
+ request.nonLinearAdSlotWidth = container.offsetWidth;
+ request.nonLinearAdSlotHeight = container.offsetHeight; // We only overlay ads as we only support video.
+
+ request.forceNonLinearFullSlot = false; // Mute based on current state
+
+ request.setAdWillPlayMuted(!this.player.muted);
+ this.loader.requestAds(request);
+ } catch (e) {
+ this.onAdError(e);
+ }
+ }
+ /**
+ * Update the ad countdown
+ * @param {Boolean} start
+ */
+
+ }, {
+ key: "pollCountdown",
+ value: function pollCountdown() {
+ var _this5 = this;
+
+ var start = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
+
+ if (!start) {
+ clearInterval(this.countdownTimer);
+ this.elements.container.removeAttribute('data-badge-text');
+ return;
+ }
+
+ var update = function update() {
+ var time = formatTime(Math.max(_this5.manager.getRemainingTime(), 0));
+ var label = "".concat(i18n.get('advertisement', _this5.player.config), " - ").concat(time);
+
+ _this5.elements.container.setAttribute('data-badge-text', label);
+ };
+
+ this.countdownTimer = setInterval(update, 100);
+ }
+ /**
+ * This method is called whenever the ads are ready inside the AdDisplayContainer
+ * @param {Event} adsManagerLoadedEvent
+ */
+
+ }, {
+ key: "onAdsManagerLoaded",
+ value: function onAdsManagerLoaded(event) {
+ var _this6 = this;
+
+ // Load could occur after a source change (race condition)
+ if (!this.enabled) {
+ return;
+ } // Get the ads manager
+
+
+ var settings = new google.ima.AdsRenderingSettings(); // Tell the SDK to save and restore content video state on our behalf
+
+ settings.restoreCustomPlaybackStateOnAdBreakComplete = true;
+ settings.enablePreloading = true; // The SDK is polling currentTime on the contentPlayback. And needs a duration
+ // so it can determine when to start the mid- and post-roll
+
+ this.manager = event.getAdsManager(this.player, settings); // Get the cue points for any mid-rolls by filtering out the pre- and post-roll
+
+ this.cuePoints = this.manager.getCuePoints(); // Add listeners to the required events
+ // Advertisement error events
+
+ this.manager.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR, function (error) {
+ return _this6.onAdError(error);
+ }); // Advertisement regular events
+
+ Object.keys(google.ima.AdEvent.Type).forEach(function (type) {
+ _this6.manager.addEventListener(google.ima.AdEvent.Type[type], function (e) {
+ return _this6.onAdEvent(e);
+ });
+ }); // Resolve our adsManager
+
+ this.trigger('loaded');
+ }
+ }, {
+ key: "addCuePoints",
+ value: function addCuePoints() {
+ var _this7 = this;
+
+ // Add advertisement cue's within the time line if available
+ if (!is$1.empty(this.cuePoints)) {
+ this.cuePoints.forEach(function (cuePoint) {
+ if (cuePoint !== 0 && cuePoint !== -1 && cuePoint < _this7.player.duration) {
+ var seekElement = _this7.player.elements.progress;
+
+ if (is$1.element(seekElement)) {
+ var cuePercentage = 100 / _this7.player.duration * cuePoint;
+ var cue = createElement('span', {
+ class: _this7.player.config.classNames.cues
+ });
+ cue.style.left = "".concat(cuePercentage.toString(), "%");
+ seekElement.appendChild(cue);
+ }
+ }
+ });
+ }
+ }
+ /**
+ * This is where all the event handling takes place. Retrieve the ad from the event. Some
+ * events (e.g. ALL_ADS_COMPLETED) don't have the ad object associated
+ * https://developers.google.com/interactive-media-ads/docs/sdks/html5/v3/apis#ima.AdEvent.Type
+ * @param {Event} event
+ */
+
+ }, {
+ key: "onAdEvent",
+ value: function onAdEvent(event) {
+ var _this8 = this;
+
+ var container = this.player.elements.container; // Retrieve the ad from the event. Some events (e.g. ALL_ADS_COMPLETED)
+ // don't have ad object associated
+
+ var ad = event.getAd();
+ var adData = event.getAdData(); // Proxy event
+
+ var dispatchEvent = function dispatchEvent(type) {
+ triggerEvent.call(_this8.player, _this8.player.media, "ads".concat(type.replace(/_/g, '').toLowerCase()));
+ }; // Bubble the event
+
+
+ dispatchEvent(event.type);
+
+ switch (event.type) {
+ case google.ima.AdEvent.Type.LOADED:
+ // This is the first event sent for an ad - it is possible to determine whether the
+ // ad is a video ad or an overlay
+ this.trigger('loaded'); // Start countdown
+
+ this.pollCountdown(true);
+
+ if (!ad.isLinear()) {
+ // Position AdDisplayContainer correctly for overlay
+ ad.width = container.offsetWidth;
+ ad.height = container.offsetHeight;
+ } // console.info('Ad type: ' + event.getAd().getAdPodInfo().getPodIndex());
+ // console.info('Ad time: ' + event.getAd().getAdPodInfo().getTimeOffset());
+
+
+ break;
+
+ case google.ima.AdEvent.Type.STARTED:
+ // Set volume to match player
+ this.manager.setVolume(this.player.volume);
+ break;
+
+ case google.ima.AdEvent.Type.ALL_ADS_COMPLETED:
+ // All ads for the current videos are done. We can now request new advertisements
+ // in case the video is re-played
+ // TODO: Example for what happens when a next video in a playlist would be loaded.
+ // So here we load a new video when all ads are done.
+ // Then we load new ads within a new adsManager. When the video
+ // Is started - after - the ads are loaded, then we get ads.
+ // You can also easily test cancelling and reloading by running
+ // player.ads.cancel() and player.ads.play from the console I guess.
+ // this.player.source = {
+ // type: 'video',
+ // title: 'View From A Blue Moon',
+ // sources: [{
+ // src:
+ // 'https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.mp4', type:
+ // 'video/mp4', }], poster:
+ // 'https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.jpg', tracks:
+ // [ { kind: 'captions', label: 'English', srclang: 'en', src:
+ // 'https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.en.vtt',
+ // default: true, }, { kind: 'captions', label: 'French', srclang: 'fr', src:
+ // 'https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.fr.vtt', }, ],
+ // };
+ // TODO: So there is still this thing where a video should only be allowed to start
+ // playing when the IMA SDK is ready or has failed
+ if (this.player.ended) {
+ this.loadAds();
+ } else {
+ // The SDK won't allow new ads to be called without receiving a contentComplete()
+ this.loader.contentComplete();
+ }
+
+ break;
+
+ case google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED:
+ // This event indicates the ad has started - the video player can adjust the UI,
+ // for example display a pause button and remaining time. Fired when content should
+ // be paused. This usually happens right before an ad is about to cover the content
+ this.pauseContent();
+ break;
+
+ case google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED:
+ // This event indicates the ad has finished - the video player can perform
+ // appropriate UI actions, such as removing the timer for remaining time detection.
+ // Fired when content should be resumed. This usually happens when an ad finishes
+ // or collapses
+ this.pollCountdown();
+ this.resumeContent();
+ break;
+
+ case google.ima.AdEvent.Type.LOG:
+ if (adData.adError) {
+ this.player.debug.warn("Non-fatal ad error: ".concat(adData.adError.getMessage()));
+ }
+
+ break;
+ }
+ }
+ /**
+ * Any ad error handling comes through here
+ * @param {Event} event
+ */
+
+ }, {
+ key: "onAdError",
+ value: function onAdError(event) {
+ this.cancel();
+ this.player.debug.warn('Ads error', event);
+ }
+ /**
+ * Setup hooks for Plyr and window events. This ensures
+ * the mid- and post-roll launch at the correct time. And
+ * resize the advertisement when the player resizes
+ */
+
+ }, {
+ key: "listeners",
+ value: function listeners() {
+ var _this9 = this;
+
+ var container = this.player.elements.container;
+ var time;
+ this.player.on('canplay', function () {
+ _this9.addCuePoints();
+ });
+ this.player.on('ended', function () {
+ _this9.loader.contentComplete();
+ });
+ this.player.on('timeupdate', function () {
+ time = _this9.player.currentTime;
+ });
+ this.player.on('seeked', function () {
+ var seekedTime = _this9.player.currentTime;
+
+ if (is$1.empty(_this9.cuePoints)) {
+ return;
+ }
+
+ _this9.cuePoints.forEach(function (cuePoint, index) {
+ if (time < cuePoint && cuePoint < seekedTime) {
+ _this9.manager.discardAdBreak();
+
+ _this9.cuePoints.splice(index, 1);
+ }
+ });
+ }); // Listen to the resizing of the window. And resize ad accordingly
+ // TODO: eventually implement ResizeObserver
+
+ window.addEventListener('resize', function () {
+ if (_this9.manager) {
+ _this9.manager.resize(container.offsetWidth, container.offsetHeight, google.ima.ViewMode.NORMAL);
+ }
+ });
+ }
+ /**
+ * Initialize the adsManager and start playing advertisements
+ */
+
+ }, {
+ key: "play",
+ value: function play() {
+ var _this10 = this;
+
+ var container = this.player.elements.container;
+
+ if (!this.managerPromise) {
+ this.resumeContent();
+ } // Play the requested advertisement whenever the adsManager is ready
+
+
+ this.managerPromise.then(function () {
+ // Set volume to match player
+ _this10.manager.setVolume(_this10.player.volume); // Initialize the container. Must be done via a user action on mobile devices
+
+
+ _this10.elements.displayContainer.initialize();
+
+ try {
+ if (!_this10.initialized) {
+ // Initialize the ads manager. Ad rules playlist will start at this time
+ _this10.manager.init(container.offsetWidth, container.offsetHeight, google.ima.ViewMode.NORMAL); // Call play to start showing the ad. Single video and overlay ads will
+ // start at this time; the call will be ignored for ad rules
+
+
+ _this10.manager.start();
+ }
+
+ _this10.initialized = true;
+ } catch (adError) {
+ // An error may be thrown if there was a problem with the
+ // VAST response
+ _this10.onAdError(adError);
+ }
+ }).catch(function () {});
+ }
+ /**
+ * Resume our video
+ */
+
+ }, {
+ key: "resumeContent",
+ value: function resumeContent() {
+ // Hide the advertisement container
+ this.elements.container.style.zIndex = ''; // Ad is stopped
+
+ this.playing = false; // Play video
+
+ silencePromise(this.player.media.play());
+ }
+ /**
+ * Pause our video
+ */
+
+ }, {
+ key: "pauseContent",
+ value: function pauseContent() {
+ // Show the advertisement container
+ this.elements.container.style.zIndex = 3; // Ad is playing
+
+ this.playing = true; // Pause our video.
+
+ this.player.media.pause();
+ }
+ /**
+ * Destroy the adsManager so we can grab new ads after this. If we don't then we're not
+ * allowed to call new ads based on google policies, as they interpret this as an accidental
+ * video requests. https://developers.google.com/interactive-
+ * media-ads/docs/sdks/android/faq#8
+ */
+
+ }, {
+ key: "cancel",
+ value: function cancel() {
+ // Pause our video
+ if (this.initialized) {
+ this.resumeContent();
+ } // Tell our instance that we're done for now
+
+
+ this.trigger('error'); // Re-create our adsManager
+
+ this.loadAds();
+ }
+ /**
+ * Re-create our adsManager
+ */
+
+ }, {
+ key: "loadAds",
+ value: function loadAds() {
+ var _this11 = this;
+
+ // Tell our adsManager to go bye bye
+ this.managerPromise.then(function () {
+ // Destroy our adsManager
+ if (_this11.manager) {
+ _this11.manager.destroy();
+ } // Re-set our adsManager promises
+
+
+ _this11.managerPromise = new Promise(function (resolve) {
+ _this11.on('loaded', resolve);
+
+ _this11.player.debug.log(_this11.manager);
+ }); // Now that the manager has been destroyed set it to also be un-initialized
+
+ _this11.initialized = false; // Now request some new advertisements
+
+ _this11.requestAds();
+ }).catch(function () {});
+ }
+ /**
+ * Handles callbacks after an ad event was invoked
+ * @param {String} event - Event type
+ */
+
+ }, {
+ key: "trigger",
+ value: function trigger(event) {
+ var _this12 = this;
+
+ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
+ args[_key - 1] = arguments[_key];
+ }
+
+ var handlers = this.events[event];
+
+ if (is$1.array(handlers)) {
+ handlers.forEach(function (handler) {
+ if (is$1.function(handler)) {
+ handler.apply(_this12, args);
+ }
+ });
+ }
+ }
+ /**
+ * Add event listeners
+ * @param {String} event - Event type
+ * @param {Function} callback - Callback for when event occurs
+ * @return {Ads}
+ */
+
+ }, {
+ key: "on",
+ value: function on(event, callback) {
+ if (!is$1.array(this.events[event])) {
+ this.events[event] = [];
+ }
+
+ this.events[event].push(callback);
+ return this;
+ }
+ /**
+ * Setup a safety timer for when the ad network doesn't respond for whatever reason.
+ * The advertisement has 12 seconds to get its things together. We stop this timer when the
+ * advertisement is playing, or when a user action is required to start, then we clear the
+ * timer on ad ready
+ * @param {Number} time
+ * @param {String} from
+ */
+
+ }, {
+ key: "startSafetyTimer",
+ value: function startSafetyTimer(time, from) {
+ var _this13 = this;
+
+ this.player.debug.log("Safety timer invoked from: ".concat(from));
+ this.safetyTimer = setTimeout(function () {
+ _this13.cancel();
+
+ _this13.clearSafetyTimer('startSafetyTimer()');
+ }, time);
+ }
+ /**
+ * Clear our safety timer(s)
+ * @param {String} from
+ */
+
+ }, {
+ key: "clearSafetyTimer",
+ value: function clearSafetyTimer(from) {
+ if (!is$1.nullOrUndefined(this.safetyTimer)) {
+ this.player.debug.log("Safety timer cleared from: ".concat(from));
+ clearTimeout(this.safetyTimer);
+ this.safetyTimer = null;
+ }
+ }
+ }, {
+ key: "enabled",
+ get: function get() {
+ var config = this.config;
+ return this.player.isHTML5 && this.player.isVideo && config.enabled && (!is$1.empty(config.publisherId) || is$1.url(config.tagUrl));
+ }
+ }, {
+ key: "tagUrl",
+ get: function get() {
+ var config = this.config;
+
+ if (is$1.url(config.tagUrl)) {
+ return config.tagUrl;
+ }
+
+ var params = {
+ AV_PUBLISHERID: '58c25bb0073ef448b1087ad6',
+ AV_CHANNELID: '5a0458dc28a06145e4519d21',
+ AV_URL: window.location.hostname,
+ cb: Date.now(),
+ AV_WIDTH: 640,
+ AV_HEIGHT: 480,
+ AV_CDIM2: config.publisherId
+ };
+ var base = 'https://go.aniview.com/api/adserver6/vast/';
+ return "".concat(base, "?").concat(buildUrlParams(params));
+ }
+ }]);
+
+ return Ads;
+ }();
+
+ var $findIndex = arrayIteration.findIndex;
+
+
+
+ var FIND_INDEX = 'findIndex';
+ var SKIPS_HOLES$1 = true;
+
+ var USES_TO_LENGTH$b = arrayMethodUsesToLength(FIND_INDEX);
+
+ // Shouldn't skip holes
+ if (FIND_INDEX in []) Array(1)[FIND_INDEX](function () { SKIPS_HOLES$1 = false; });
+
+ // `Array.prototype.findIndex` method
+ // https://tc39.github.io/ecma262/#sec-array.prototype.findindex
+ _export({ target: 'Array', proto: true, forced: SKIPS_HOLES$1 || !USES_TO_LENGTH$b }, {
+ findIndex: function findIndex(callbackfn /* , that = undefined */) {
+ return $findIndex(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
+ }
+ });
+
+ // https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables
+ addToUnscopables(FIND_INDEX);
+
+ var min$6 = Math.min;
+ var nativeLastIndexOf = [].lastIndexOf;
+ var NEGATIVE_ZERO$1 = !!nativeLastIndexOf && 1 / [1].lastIndexOf(1, -0) < 0;
+ var STRICT_METHOD$6 = arrayMethodIsStrict('lastIndexOf');
+ // For preventing possible almost infinite loop in non-standard implementations, test the forward version of the method
+ var USES_TO_LENGTH$c = arrayMethodUsesToLength('indexOf', { ACCESSORS: true, 1: 0 });
+ var FORCED$5 = NEGATIVE_ZERO$1 || !STRICT_METHOD$6 || !USES_TO_LENGTH$c;
+
+ // `Array.prototype.lastIndexOf` method implementation
+ // https://tc39.github.io/ecma262/#sec-array.prototype.lastindexof
+ var arrayLastIndexOf = FORCED$5 ? function lastIndexOf(searchElement /* , fromIndex = @[*-1] */) {
+ // convert -0 to +0
+ if (NEGATIVE_ZERO$1) return nativeLastIndexOf.apply(this, arguments) || 0;
+ var O = toIndexedObject(this);
+ var length = toLength(O.length);
+ var index = length - 1;
+ if (arguments.length > 1) index = min$6(index, toInteger(arguments[1]));
+ if (index < 0) index = length + index;
+ for (;index >= 0; index--) if (index in O && O[index] === searchElement) return index || 0;
+ return -1;
+ } : nativeLastIndexOf;
+
+ // `Array.prototype.lastIndexOf` method
+ // https://tc39.github.io/ecma262/#sec-array.prototype.lastindexof
+ _export({ target: 'Array', proto: true, forced: arrayLastIndexOf !== [].lastIndexOf }, {
+ lastIndexOf: arrayLastIndexOf
+ });
+
+ var parseVtt = function parseVtt(vttDataString) {
+ var processedList = [];
+ var frames = vttDataString.split(/\r\n\r\n|\n\n|\r\r/);
+ frames.forEach(function (frame) {
+ var result = {};
+ var lines = frame.split(/\r\n|\n|\r/);
+ lines.forEach(function (line) {
+ if (!is$1.number(result.startTime)) {
+ // The line with start and end times on it is the first line of interest
+ 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
+
+ if (matchTimes) {
+ result.startTime = Number(matchTimes[1] || 0) * 60 * 60 + Number(matchTimes[2]) * 60 + Number(matchTimes[3]) + Number("0.".concat(matchTimes[4]));
+ result.endTime = Number(matchTimes[6] || 0) * 60 * 60 + Number(matchTimes[7]) * 60 + Number(matchTimes[8]) + Number("0.".concat(matchTimes[9]));
+ }
+ } else if (!is$1.empty(line.trim()) && is$1.empty(result.text)) {
+ // If we already have the startTime, then we're definitely up to the text line(s)
+ var lineSplit = line.trim().split('#xywh=');
+
+ var _lineSplit = _slicedToArray(lineSplit, 1);
+
+ result.text = _lineSplit[0];
+
+ // If there's content in lineSplit[1], then we have sprites. If not, then it's just one frame per image
+ if (lineSplit[1]) {
+ var _lineSplit$1$split = lineSplit[1].split(',');
+
+ var _lineSplit$1$split2 = _slicedToArray(_lineSplit$1$split, 4);
+
+ result.x = _lineSplit$1$split2[0];
+ result.y = _lineSplit$1$split2[1];
+ result.w = _lineSplit$1$split2[2];
+ result.h = _lineSplit$1$split2[3];
+ }
+ }
+ });
+
+ if (result.text) {
+ processedList.push(result);
+ }
+ });
+ return processedList;
+ };
+ /**
+ * Preview thumbnails for seek hover and scrubbing
+ * Seeking: Hover over the seek bar (desktop only): shows a small preview container above the seek bar
+ * 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
+ *
+ * Notes:
+ * - 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
+ * - 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
+ * - 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
+ */
+
+
+ var fitRatio = function fitRatio(ratio, outer) {
+ var targetRatio = outer.width / outer.height;
+ var result = {};
+
+ if (ratio > targetRatio) {
+ result.width = outer.width;
+ result.height = 1 / ratio * outer.width;
+ } else {
+ result.height = outer.height;
+ result.width = ratio * outer.height;
+ }
+
+ return result;
+ };
+
+ var PreviewThumbnails = /*#__PURE__*/function () {
+ /**
+ * PreviewThumbnails constructor.
+ * @param {Plyr} player
+ * @return {PreviewThumbnails}
+ */
+ function PreviewThumbnails(player) {
+ _classCallCheck(this, PreviewThumbnails);
+
+ this.player = player;
+ this.thumbnails = [];
+ this.loaded = false;
+ this.lastMouseMoveTime = Date.now();
+ this.mouseDown = false;
+ this.loadedImages = [];
+ this.elements = {
+ thumb: {},
+ scrubbing: {}
+ };
+ this.load();
+ }
+
+ _createClass(PreviewThumbnails, [{
+ key: "load",
+ value: function load() {
+ var _this = this;
+
+ // Toggle the regular seek tooltip
+ if (this.player.elements.display.seekTooltip) {
+ this.player.elements.display.seekTooltip.hidden = this.enabled;
+ }
+
+ if (!this.enabled) {
+ return;
+ }
+
+ this.getThumbnails().then(function () {
+ if (!_this.enabled) {
+ return;
+ } // Render DOM elements
+
+
+ _this.render(); // Check to see if thumb container size was specified manually in CSS
+
+
+ _this.determineContainerAutoSizing();
+
+ _this.loaded = true;
+ });
+ } // Download VTT files and parse them
+
+ }, {
+ key: "getThumbnails",
+ value: function getThumbnails() {
+ var _this2 = this;
+
+ return new Promise(function (resolve) {
+ var src = _this2.player.config.previewThumbnails.src;
+
+ if (is$1.empty(src)) {
+ throw new Error('Missing previewThumbnails.src config attribute');
+ } // Resolve promise
+
+
+ var sortAndResolve = function sortAndResolve() {
+ // Sort smallest to biggest (e.g., [120p, 480p, 1080p])
+ _this2.thumbnails.sort(function (x, y) {
+ return x.height - y.height;
+ });
+
+ _this2.player.debug.log('Preview thumbnails', _this2.thumbnails);
+
+ resolve();
+ }; // Via callback()
+
+
+ if (is$1.function(src)) {
+ src(function (thumbnails) {
+ _this2.thumbnails = thumbnails;
+ sortAndResolve();
+ });
+ } // VTT urls
+ else {
+ // If string, convert into single-element list
+ 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
+
+ var promises = urls.map(function (u) {
+ return _this2.getThumbnail(u);
+ }); // Resolve
+
+ Promise.all(promises).then(sortAndResolve);
+ }
+ });
+ } // Process individual VTT file
+
+ }, {
+ key: "getThumbnail",
+ value: function getThumbnail(url) {
+ var _this3 = this;
+
+ return new Promise(function (resolve) {
+ fetch(url).then(function (response) {
+ var thumbnail = {
+ frames: parseVtt(response),
+ height: null,
+ urlPrefix: ''
+ }; // If the URLs don't start with '/', then we need to set their relative path to be the location of the VTT file
+ // If the URLs do start with '/', then they obviously don't need a prefix, so it will remain blank
+ // 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
+
+ if (!thumbnail.frames[0].text.startsWith('/') && !thumbnail.frames[0].text.startsWith('http://') && !thumbnail.frames[0].text.startsWith('https://')) {
+ thumbnail.urlPrefix = url.substring(0, url.lastIndexOf('/') + 1);
+ } // Download the first frame, so that we can determine/set the height of this thumbnailsDef
+
+
+ var tempImage = new Image();
+
+ tempImage.onload = function () {
+ thumbnail.height = tempImage.naturalHeight;
+ thumbnail.width = tempImage.naturalWidth;
+
+ _this3.thumbnails.push(thumbnail);
+
+ resolve();
+ };
+
+ tempImage.src = thumbnail.urlPrefix + thumbnail.frames[0].text;
+ });
+ });
+ }
+ }, {
+ key: "startMove",
+ value: function startMove(event) {
+ if (!this.loaded) {
+ return;
+ }
+
+ if (!is$1.event(event) || !['touchmove', 'mousemove'].includes(event.type)) {
+ return;
+ } // Wait until media has a duration
+
+
+ if (!this.player.media.duration) {
+ return;
+ }
+
+ if (event.type === 'touchmove') {
+ // Calculate seek hover position as approx video seconds
+ this.seekTime = this.player.media.duration * (this.player.elements.inputs.seek.value / 100);
+ } else {
+ // Calculate seek hover position as approx video seconds
+ var clientRect = this.player.elements.progress.getBoundingClientRect();
+ var percentage = 100 / clientRect.width * (event.pageX - clientRect.left);
+ this.seekTime = this.player.media.duration * (percentage / 100);
+
+ if (this.seekTime < 0) {
+ // The mousemove fires for 10+px out to the left
+ this.seekTime = 0;
+ }
+
+ if (this.seekTime > this.player.media.duration - 1) {
+ // Took 1 second off the duration for safety, because different players can disagree on the real duration of a video
+ this.seekTime = this.player.media.duration - 1;
+ }
+
+ this.mousePosX = event.pageX; // Set time text inside image container
+
+ this.elements.thumb.time.innerText = formatTime(this.seekTime);
+ } // Download and show image
+
+
+ this.showImageAtCurrentTime();
+ }
+ }, {
+ key: "endMove",
+ value: function endMove() {
+ this.toggleThumbContainer(false, true);
+ }
+ }, {
+ key: "startScrubbing",
+ value: function startScrubbing(event) {
+ // Only act on left mouse button (0), or touch device (event.button does not exist or is false)
+ if (is$1.nullOrUndefined(event.button) || event.button === false || event.button === 0) {
+ this.mouseDown = true; // Wait until media has a duration
+
+ if (this.player.media.duration) {
+ this.toggleScrubbingContainer(true);
+ this.toggleThumbContainer(false, true); // Download and show image
+
+ this.showImageAtCurrentTime();
+ }
+ }
+ }
+ }, {
+ key: "endScrubbing",
+ value: function endScrubbing() {
+ var _this4 = this;
+
+ this.mouseDown = false; // Hide scrubbing preview. But wait until the video has successfully seeked before hiding the scrubbing preview
+
+ if (Math.ceil(this.lastTime) === Math.ceil(this.player.media.currentTime)) {
+ // The video was already seeked/loaded at the chosen time - hide immediately
+ this.toggleScrubbingContainer(false);
+ } else {
+ // The video hasn't seeked yet. Wait for that
+ once.call(this.player, this.player.media, 'timeupdate', function () {
+ // Re-check mousedown - we might have already started scrubbing again
+ if (!_this4.mouseDown) {
+ _this4.toggleScrubbingContainer(false);
+ }
+ });
+ }
+ }
+ /**
+ * Setup hooks for Plyr and window events
+ */
+
+ }, {
+ key: "listeners",
+ value: function listeners() {
+ var _this5 = this;
+
+ // 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
+ this.player.on('play', function () {
+ _this5.toggleThumbContainer(false, true);
+ });
+ this.player.on('seeked', function () {
+ _this5.toggleThumbContainer(false);
+ });
+ this.player.on('timeupdate', function () {
+ _this5.lastTime = _this5.player.media.currentTime;
+ });
+ }
+ /**
+ * Create HTML elements for image containers
+ */
+
+ }, {
+ key: "render",
+ value: function render() {
+ // Create HTML element: plyr__preview-thumbnail-container
+ this.elements.thumb.container = createElement('div', {
+ class: this.player.config.classNames.previewThumbnails.thumbContainer
+ }); // Wrapper for the image for styling
+
+ this.elements.thumb.imageContainer = createElement('div', {
+ class: this.player.config.classNames.previewThumbnails.imageContainer
+ });
+ this.elements.thumb.container.appendChild(this.elements.thumb.imageContainer); // Create HTML element, parent+span: time text (e.g., 01:32:00)
+
+ var timeContainer = createElement('div', {
+ class: this.player.config.classNames.previewThumbnails.timeContainer
+ });
+ this.elements.thumb.time = createElement('span', {}, '00:00');
+ timeContainer.appendChild(this.elements.thumb.time);
+ this.elements.thumb.container.appendChild(timeContainer); // Inject the whole thumb
+
+ if (is$1.element(this.player.elements.progress)) {
+ this.player.elements.progress.appendChild(this.elements.thumb.container);
+ } // Create HTML element: plyr__preview-scrubbing-container
+
+
+ this.elements.scrubbing.container = createElement('div', {
+ class: this.player.config.classNames.previewThumbnails.scrubbingContainer
+ });
+ this.player.elements.wrapper.appendChild(this.elements.scrubbing.container);
+ }
+ }, {
+ key: "destroy",
+ value: function destroy() {
+ if (this.elements.thumb.container) {
+ this.elements.thumb.container.remove();
+ }
+
+ if (this.elements.scrubbing.container) {
+ this.elements.scrubbing.container.remove();
+ }
+ }
+ }, {
+ key: "showImageAtCurrentTime",
+ value: function showImageAtCurrentTime() {
+ var _this6 = this;
+
+ if (this.mouseDown) {
+ this.setScrubbingContainerSize();
+ } else {
+ this.setThumbContainerSizeAndPos();
+ } // Find the desired thumbnail index
+ // TODO: Handle a video longer than the thumbs where thumbNum is null
+
+
+ var thumbNum = this.thumbnails[0].frames.findIndex(function (frame) {
+ return _this6.seekTime >= frame.startTime && _this6.seekTime <= frame.endTime;
+ });
+ var hasThumb = thumbNum >= 0;
+ var qualityIndex = 0; // Show the thumb container if we're not scrubbing
+
+ if (!this.mouseDown) {
+ this.toggleThumbContainer(hasThumb);
+ } // No matching thumb found
+
+
+ if (!hasThumb) {
+ return;
+ } // Check to see if we've already downloaded higher quality versions of this image
+
+
+ this.thumbnails.forEach(function (thumbnail, index) {
+ if (_this6.loadedImages.includes(thumbnail.frames[thumbNum].text)) {
+ qualityIndex = index;
+ }
+ }); // Only proceed if either thumbnum or thumbfilename has changed
+
+ if (thumbNum !== this.showingThumb) {
+ this.showingThumb = thumbNum;
+ this.loadImage(qualityIndex);
+ }
+ } // Show the image that's currently specified in this.showingThumb
+
+ }, {
+ key: "loadImage",
+ value: function loadImage() {
+ var _this7 = this;
+
+ var qualityIndex = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
+ var thumbNum = this.showingThumb;
+ var thumbnail = this.thumbnails[qualityIndex];
+ var urlPrefix = thumbnail.urlPrefix;
+ var frame = thumbnail.frames[thumbNum];
+ var thumbFilename = thumbnail.frames[thumbNum].text;
+ var thumbUrl = urlPrefix + thumbFilename;
+
+ if (!this.currentImageElement || this.currentImageElement.dataset.filename !== thumbFilename) {
+ // If we're already loading a previous image, remove its onload handler - we don't want it to load after this one
+ // Only do this if not using sprites. Without sprites we really want to show as many images as possible, as a best-effort
+ if (this.loadingImage && this.usingSprites) {
+ this.loadingImage.onload = null;
+ } // We're building and adding a new image. In other implementations of similar functionality (YouTube), background image
+ // is instead used. But this causes issues with larger images in Firefox and Safari - switching between background
+ // images causes a flicker. Putting a new image over the top does not
+
+
+ var previewImage = new Image();
+ previewImage.src = thumbUrl;
+ previewImage.dataset.index = thumbNum;
+ previewImage.dataset.filename = thumbFilename;
+ this.showingThumbFilename = thumbFilename;
+ 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...
+
+ previewImage.onload = function () {
+ return _this7.showImage(previewImage, frame, qualityIndex, thumbNum, thumbFilename, true);
+ };
+
+ this.loadingImage = previewImage;
+ this.removeOldImages(previewImage);
+ } else {
+ // Update the existing image
+ this.showImage(this.currentImageElement, frame, qualityIndex, thumbNum, thumbFilename, false);
+ this.currentImageElement.dataset.index = thumbNum;
+ this.removeOldImages(this.currentImageElement);
+ }
+ }
+ }, {
+ key: "showImage",
+ value: function showImage(previewImage, frame, qualityIndex, thumbNum, thumbFilename) {
+ var newImage = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : true;
+ this.player.debug.log("Showing thumb: ".concat(thumbFilename, ". num: ").concat(thumbNum, ". qual: ").concat(qualityIndex, ". newimg: ").concat(newImage));
+ this.setImageSizeAndOffset(previewImage, frame);
+
+ if (newImage) {
+ this.currentImageContainer.appendChild(previewImage);
+ this.currentImageElement = previewImage;
+
+ if (!this.loadedImages.includes(thumbFilename)) {
+ this.loadedImages.push(thumbFilename);
+ }
+ } // Preload images before and after the current one
+ // Show higher quality of the same frame
+ // 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
+
+
+ this.preloadNearby(thumbNum, true).then(this.preloadNearby(thumbNum, false)).then(this.getHigherQuality(qualityIndex, previewImage, frame, thumbFilename));
+ } // Remove all preview images that aren't the designated current image
+
+ }, {
+ key: "removeOldImages",
+ value: function removeOldImages(currentImage) {
+ var _this8 = this;
+
+ // Get a list of all images, convert it from a DOM list to an array
+ Array.from(this.currentImageContainer.children).forEach(function (image) {
+ if (image.tagName.toLowerCase() !== 'img') {
+ return;
+ }
+
+ var removeDelay = _this8.usingSprites ? 500 : 1000;
+
+ if (image.dataset.index !== currentImage.dataset.index && !image.dataset.deleting) {
+ // 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
+ // First set attribute 'deleting' to prevent multi-handling of this on repeat firing of this function
+ // eslint-disable-next-line no-param-reassign
+ image.dataset.deleting = true; // This has to be set before the timeout - to prevent issues switching between hover and scrub
+
+ var currentImageContainer = _this8.currentImageContainer;
+ setTimeout(function () {
+ currentImageContainer.removeChild(image);
+
+ _this8.player.debug.log("Removing thumb: ".concat(image.dataset.filename));
+ }, removeDelay);
+ }
+ });
+ } // Preload images before and after the current one. Only if the user is still hovering/seeking the same frame
+ // This will only preload the lowest quality
+
+ }, {
+ key: "preloadNearby",
+ value: function preloadNearby(thumbNum) {
+ var _this9 = this;
+
+ var forward = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
+ return new Promise(function (resolve) {
+ setTimeout(function () {
+ var oldThumbFilename = _this9.thumbnails[0].frames[thumbNum].text;
+
+ if (_this9.showingThumbFilename === oldThumbFilename) {
+ // 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
+ var thumbnailsClone;
+
+ if (forward) {
+ thumbnailsClone = _this9.thumbnails[0].frames.slice(thumbNum);
+ } else {
+ thumbnailsClone = _this9.thumbnails[0].frames.slice(0, thumbNum).reverse();
+ }
+
+ var foundOne = false;
+ thumbnailsClone.forEach(function (frame) {
+ var newThumbFilename = frame.text;
+
+ if (newThumbFilename !== oldThumbFilename) {
+ // Found one with a different filename. Make sure it hasn't already been loaded on this page visit
+ if (!_this9.loadedImages.includes(newThumbFilename)) {
+ foundOne = true;
+
+ _this9.player.debug.log("Preloading thumb filename: ".concat(newThumbFilename));
+
+ var urlPrefix = _this9.thumbnails[0].urlPrefix;
+ var thumbURL = urlPrefix + newThumbFilename;
+ var previewImage = new Image();
+ previewImage.src = thumbURL;
+
+ previewImage.onload = function () {
+ _this9.player.debug.log("Preloaded thumb filename: ".concat(newThumbFilename));
+
+ if (!_this9.loadedImages.includes(newThumbFilename)) _this9.loadedImages.push(newThumbFilename); // We don't resolve until the thumb is loaded
+
+ resolve();
+ };
+ }
+ }
+ }); // If there are none to preload then we want to resolve immediately
+
+ if (!foundOne) {
+ resolve();
+ }
+ }
+ }, 300);
+ });
+ } // If user has been hovering current image for half a second, look for a higher quality one
+
+ }, {
+ key: "getHigherQuality",
+ value: function getHigherQuality(currentQualityIndex, previewImage, frame, thumbFilename) {
+ var _this10 = this;
+
+ if (currentQualityIndex < this.thumbnails.length - 1) {
+ // 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
+ var previewImageHeight = previewImage.naturalHeight;
+
+ if (this.usingSprites) {
+ previewImageHeight = frame.h;
+ }
+
+ if (previewImageHeight < this.thumbContainerHeight) {
+ // Recurse back to the loadImage function - show a higher quality one, but only if the viewer is on this frame for a while
+ setTimeout(function () {
+ // Make sure the mouse hasn't already moved on and started hovering at another image
+ if (_this10.showingThumbFilename === thumbFilename) {
+ _this10.player.debug.log("Showing higher quality thumb for: ".concat(thumbFilename));
+
+ _this10.loadImage(currentQualityIndex + 1);
+ }
+ }, 300);
+ }
+ }
+ }
+ }, {
+ key: "toggleThumbContainer",
+ value: function toggleThumbContainer() {
+ var toggle = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
+ var clearShowing = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
+ var className = this.player.config.classNames.previewThumbnails.thumbContainerShown;
+ this.elements.thumb.container.classList.toggle(className, toggle);
+
+ if (!toggle && clearShowing) {
+ this.showingThumb = null;
+ this.showingThumbFilename = null;
+ }
+ }
+ }, {
+ key: "toggleScrubbingContainer",
+ value: function toggleScrubbingContainer() {
+ var toggle = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
+ var className = this.player.config.classNames.previewThumbnails.scrubbingContainerShown;
+ this.elements.scrubbing.container.classList.toggle(className, toggle);
+
+ if (!toggle) {
+ this.showingThumb = null;
+ this.showingThumbFilename = null;
+ }
+ }
+ }, {
+ key: "determineContainerAutoSizing",
+ value: function determineContainerAutoSizing() {
+ if (this.elements.thumb.imageContainer.clientHeight > 20 || this.elements.thumb.imageContainer.clientWidth > 20) {
+ // This will prevent auto sizing in this.setThumbContainerSizeAndPos()
+ this.sizeSpecifiedInCSS = true;
+ }
+ } // 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
+
+ }, {
+ key: "setThumbContainerSizeAndPos",
+ value: function setThumbContainerSizeAndPos() {
+ if (!this.sizeSpecifiedInCSS) {
+ var thumbWidth = Math.floor(this.thumbContainerHeight * this.thumbAspectRatio);
+ this.elements.thumb.imageContainer.style.height = "".concat(this.thumbContainerHeight, "px");
+ this.elements.thumb.imageContainer.style.width = "".concat(thumbWidth, "px");
+ } else if (this.elements.thumb.imageContainer.clientHeight > 20 && this.elements.thumb.imageContainer.clientWidth < 20) {
+ var _thumbWidth = Math.floor(this.elements.thumb.imageContainer.clientHeight * this.thumbAspectRatio);
+
+ this.elements.thumb.imageContainer.style.width = "".concat(_thumbWidth, "px");
+ } else if (this.elements.thumb.imageContainer.clientHeight < 20 && this.elements.thumb.imageContainer.clientWidth > 20) {
+ var thumbHeight = Math.floor(this.elements.thumb.imageContainer.clientWidth / this.thumbAspectRatio);
+ this.elements.thumb.imageContainer.style.height = "".concat(thumbHeight, "px");
+ }
+
+ this.setThumbContainerPos();
+ }
+ }, {
+ key: "setThumbContainerPos",
+ value: function setThumbContainerPos() {
+ var seekbarRect = this.player.elements.progress.getBoundingClientRect();
+ var plyrRect = this.player.elements.container.getBoundingClientRect();
+ 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
+
+ var minVal = plyrRect.left - seekbarRect.left + 10;
+ var maxVal = plyrRect.right - seekbarRect.left - container.clientWidth - 10; // Set preview container position to: mousepos, minus seekbar.left, minus half of previewContainer.clientWidth
+
+ var previewPos = this.mousePosX - seekbarRect.left - container.clientWidth / 2;
+
+ if (previewPos < minVal) {
+ previewPos = minVal;
+ }
+
+ if (previewPos > maxVal) {
+ previewPos = maxVal;
+ }
+
+ container.style.left = "".concat(previewPos, "px");
+ } // Can't use 100% width, in case the video is a different aspect ratio to the video container
+
+ }, {
+ key: "setScrubbingContainerSize",
+ value: function setScrubbingContainerSize() {
+ var _fitRatio = fitRatio(this.thumbAspectRatio, {
+ width: this.player.media.clientWidth,
+ height: this.player.media.clientHeight
+ }),
+ width = _fitRatio.width,
+ height = _fitRatio.height;
+
+ this.elements.scrubbing.container.style.width = "".concat(width, "px");
+ this.elements.scrubbing.container.style.height = "".concat(height, "px");
+ } // Sprites need to be offset to the correct location
+
+ }, {
+ key: "setImageSizeAndOffset",
+ value: function setImageSizeAndOffset(previewImage, frame) {
+ if (!this.usingSprites) {
+ return;
+ } // Find difference between height and preview container height
+
+
+ var multiplier = this.thumbContainerHeight / frame.h; // eslint-disable-next-line no-param-reassign
+
+ previewImage.style.height = "".concat(previewImage.naturalHeight * multiplier, "px"); // eslint-disable-next-line no-param-reassign
+
+ previewImage.style.width = "".concat(previewImage.naturalWidth * multiplier, "px"); // eslint-disable-next-line no-param-reassign
+
+ previewImage.style.left = "-".concat(frame.x * multiplier, "px"); // eslint-disable-next-line no-param-reassign
+
+ previewImage.style.top = "-".concat(frame.y * multiplier, "px");
+ }
+ }, {
+ key: "enabled",
+ get: function get() {
+ return this.player.isHTML5 && this.player.isVideo && this.player.config.previewThumbnails.enabled;
+ }
+ }, {
+ key: "currentImageContainer",
+ get: function get() {
+ if (this.mouseDown) {
+ return this.elements.scrubbing.container;
+ }
+
+ return this.elements.thumb.imageContainer;
+ }
+ }, {
+ key: "usingSprites",
+ get: function get() {
+ return Object.keys(this.thumbnails[0].frames[0]).includes('w');
+ }
+ }, {
+ key: "thumbAspectRatio",
+ get: function get() {
+ if (this.usingSprites) {
+ return this.thumbnails[0].frames[0].w / this.thumbnails[0].frames[0].h;
+ }
+
+ return this.thumbnails[0].width / this.thumbnails[0].height;
+ }
+ }, {
+ key: "thumbContainerHeight",
+ get: function get() {
+ if (this.mouseDown) {
+ var _fitRatio2 = fitRatio(this.thumbAspectRatio, {
+ width: this.player.media.clientWidth,
+ height: this.player.media.clientHeight
+ }),
+ height = _fitRatio2.height;
+
+ return height;
+ } // If css is used this needs to return the css height for sprites to work (see setImageSizeAndOffset)
+
+
+ if (this.sizeSpecifiedInCSS) {
+ return this.elements.thumb.imageContainer.clientHeight;
+ }
+
+ return Math.floor(this.player.media.clientWidth / this.thumbAspectRatio / 4);
+ }
+ }, {
+ key: "currentImageElement",
+ get: function get() {
+ if (this.mouseDown) {
+ return this.currentScrubbingImageElement;
+ }
+
+ return this.currentThumbnailImageElement;
+ },
+ set: function set(element) {
+ if (this.mouseDown) {
+ this.currentScrubbingImageElement = element;
+ } else {
+ this.currentThumbnailImageElement = element;
+ }
+ }
+ }]);
+
+ return PreviewThumbnails;
+ }();
+
+ var source = {
+ // Add elements to HTML5 media (source, tracks, etc)
+ insertElements: function insertElements(type, attributes) {
+ var _this = this;
+
+ if (is$1.string(attributes)) {
+ insertElement(type, this.media, {
+ src: attributes
+ });
+ } else if (is$1.array(attributes)) {
+ attributes.forEach(function (attribute) {
+ insertElement(type, _this.media, attribute);
+ });
+ }
+ },
+ // Update source
+ // Sources are not checked for support so be careful
+ change: function change(input) {
+ var _this2 = this;
+
+ if (!getDeep(input, 'sources.length')) {
+ this.debug.warn('Invalid source format');
+ return;
+ } // Cancel current network requests
+
+
+ html5.cancelRequests.call(this); // Destroy instance and re-setup
+
+ this.destroy.call(this, function () {
+ // Reset quality options
+ _this2.options.quality = []; // Remove elements
+
+ removeElement(_this2.media);
+ _this2.media = null; // Reset class name
+
+ if (is$1.element(_this2.elements.container)) {
+ _this2.elements.container.removeAttribute('class');
+ } // Set the type and provider
+
+
+ var sources = input.sources,
+ type = input.type;
+
+ var _sources = _slicedToArray(sources, 1),
+ _sources$ = _sources[0],
+ _sources$$provider = _sources$.provider,
+ provider = _sources$$provider === void 0 ? providers.html5 : _sources$$provider,
+ src = _sources$.src;
+
+ var tagName = provider === 'html5' ? type : 'div';
+ var attributes = provider === 'html5' ? {} : {
+ src: src
+ };
+ Object.assign(_this2, {
+ provider: provider,
+ type: type,
+ // Check for support
+ supported: support.check(type, provider, _this2.config.playsinline),
+ // Create new element
+ media: createElement(tagName, attributes)
+ }); // Inject the new element
+
+ _this2.elements.container.appendChild(_this2.media); // Autoplay the new source?
+
+
+ if (is$1.boolean(input.autoplay)) {
+ _this2.config.autoplay = input.autoplay;
+ } // Set attributes for audio and video
+
+
+ if (_this2.isHTML5) {
+ if (_this2.config.crossorigin) {
+ _this2.media.setAttribute('crossorigin', '');
+ }
+
+ if (_this2.config.autoplay) {
+ _this2.media.setAttribute('autoplay', '');
+ }
+
+ if (!is$1.empty(input.poster)) {
+ _this2.poster = input.poster;
+ }
+
+ if (_this2.config.loop.active) {
+ _this2.media.setAttribute('loop', '');
+ }
+
+ if (_this2.config.muted) {
+ _this2.media.setAttribute('muted', '');
+ }
+
+ if (_this2.config.playsinline) {
+ _this2.media.setAttribute('playsinline', '');
+ }
+ } // Restore class hook
+
+
+ ui.addStyleHook.call(_this2); // Set new sources for html5
+
+ if (_this2.isHTML5) {
+ source.insertElements.call(_this2, 'source', sources);
+ } // Set video title
+
+
+ _this2.config.title = input.title; // Set up from scratch
+
+ media.setup.call(_this2); // HTML5 stuff
+
+ if (_this2.isHTML5) {
+ // Setup captions
+ if (Object.keys(input).includes('tracks')) {
+ source.insertElements.call(_this2, 'track', input.tracks);
+ }
+ } // If HTML5 or embed but not fully supported, setupInterface and call ready now
+
+
+ if (_this2.isHTML5 || _this2.isEmbed && !_this2.supported.ui) {
+ // Setup interface
+ ui.build.call(_this2);
+ } // Load HTML5 sources
+
+
+ if (_this2.isHTML5) {
+ _this2.media.load();
+ } // Update previewThumbnails config & reload plugin
+
+
+ if (!is$1.empty(input.previewThumbnails)) {
+ Object.assign(_this2.config.previewThumbnails, input.previewThumbnails); // Cleanup previewThumbnails plugin if it was loaded
+
+ if (_this2.previewThumbnails && _this2.previewThumbnails.loaded) {
+ _this2.previewThumbnails.destroy();
+
+ _this2.previewThumbnails = null;
+ } // Create new instance if it is still enabled
+
+
+ if (_this2.config.previewThumbnails.enabled) {
+ _this2.previewThumbnails = new PreviewThumbnails(_this2);
+ }
+ } // Update the fullscreen support
+
+
+ _this2.fullscreen.update();
+ }, true);
+ }
+ };
+
+ /**
+ * Returns a number whose value is limited to the given range.
+ *
+ * Example: limit the output of this computation to between 0 and 255
+ * (x * 255).clamp(0, 255)
+ *
+ * @param {Number} input
+ * @param {Number} min The lower boundary of the output range
+ * @param {Number} max The upper boundary of the output range
+ * @returns A number in the range [min, max]
+ * @type Number
+ */
+ function clamp() {
+ var input = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
+ var min = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
+ var max = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 255;
+ return Math.min(Math.max(input, min), max);
+ }
+
+ // TODO: Use a WeakMap for private globals
+ // const globals = new WeakMap();
+ // Plyr instance
+
+ var Plyr = /*#__PURE__*/function () {
+ function Plyr(target, options) {
+ var _this = this;
+
+ _classCallCheck(this, Plyr);
+
+ this.timers = {}; // State
+
+ this.ready = false;
+ this.loading = false;
+ this.failed = false; // Touch device
+
+ this.touch = support.touch; // Set the media element
+
+ this.media = target; // String selector passed
+
+ if (is$1.string(this.media)) {
+ this.media = document.querySelectorAll(this.media);
+ } // jQuery, NodeList or Array passed, use first element
+
+
+ if (window.jQuery && this.media instanceof jQuery || is$1.nodeList(this.media) || is$1.array(this.media)) {
+ // eslint-disable-next-line
+ this.media = this.media[0];
+ } // Set config
+
+
+ this.config = extend({}, defaults$1, Plyr.defaults, options || {}, function () {
+ try {
+ return JSON.parse(_this.media.getAttribute('data-plyr-config'));
+ } catch (e) {
+ return {};
+ }
+ }()); // Elements cache
+
+ this.elements = {
+ container: null,
+ fullscreen: null,
+ captions: null,
+ buttons: {},
+ display: {},
+ progress: {},
+ inputs: {},
+ settings: {
+ popup: null,
+ menu: null,
+ panels: {},
+ buttons: {}
+ }
+ }; // Captions
+
+ this.captions = {
+ active: null,
+ currentTrack: -1,
+ meta: new WeakMap()
+ }; // Fullscreen
+
+ this.fullscreen = {
+ active: false
+ }; // Options
+
+ this.options = {
+ speed: [],
+ quality: []
+ }; // Debugging
+ // TODO: move to globals
+
+ this.debug = new Console(this.config.debug); // Log config options and support
+
+ this.debug.log('Config', this.config);
+ this.debug.log('Support', support); // We need an element to setup
+
+ if (is$1.nullOrUndefined(this.media) || !is$1.element(this.media)) {
+ this.debug.error('Setup failed: no suitable element passed');
+ return;
+ } // Bail if the element is initialized
+
+
+ if (this.media.plyr) {
+ this.debug.warn('Target already setup');
+ return;
+ } // Bail if not enabled
+
+
+ if (!this.config.enabled) {
+ this.debug.error('Setup failed: disabled by config');
+ return;
+ } // Bail if disabled or no basic support
+ // You may want to disable certain UAs etc
+
+
+ if (!support.check().api) {
+ this.debug.error('Setup failed: no support');
+ return;
+ } // Cache original element state for .destroy()
+
+
+ var clone = this.media.cloneNode(true);
+ clone.autoplay = false;
+ this.elements.original = clone; // Set media type based on tag or data attribute
+ // Supported: video, audio, vimeo, youtube
+
+ var type = this.media.tagName.toLowerCase(); // Embed properties
+
+ var iframe = null;
+ var url = null; // Different setup based on type
+
+ switch (type) {
+ case 'div':
+ // Find the frame
+ iframe = this.media.querySelector('iframe'); // <iframe> type
+
+ if (is$1.element(iframe)) {
+ // Detect provider
+ url = parseUrl(iframe.getAttribute('src'));
+ this.provider = getProviderByUrl(url.toString()); // Rework elements
+
+ this.elements.container = this.media;
+ this.media = iframe; // Reset classname
+
+ this.elements.container.className = ''; // Get attributes from URL and set config
+
+ if (url.search.length) {
+ var truthy = ['1', 'true'];
+
+ if (truthy.includes(url.searchParams.get('autoplay'))) {
+ this.config.autoplay = true;
+ }
+
+ if (truthy.includes(url.searchParams.get('loop'))) {
+ this.config.loop.active = true;
+ } // TODO: replace fullscreen.iosNative with this playsinline config option
+ // YouTube requires the playsinline in the URL
+
+
+ if (this.isYouTube) {
+ this.config.playsinline = truthy.includes(url.searchParams.get('playsinline'));
+ this.config.youtube.hl = url.searchParams.get('hl'); // TODO: Should this be setting language?
+ } else {
+ this.config.playsinline = true;
+ }
+ }
+ } else {
+ // <div> with attributes
+ this.provider = this.media.getAttribute(this.config.attributes.embed.provider); // Remove attribute
+
+ this.media.removeAttribute(this.config.attributes.embed.provider);
+ } // Unsupported or missing provider
+
+
+ if (is$1.empty(this.provider) || !Object.keys(providers).includes(this.provider)) {
+ this.debug.error('Setup failed: Invalid provider');
+ return;
+ } // Audio will come later for external providers
+
+
+ this.type = types.video;
+ break;
+
+ case 'video':
+ case 'audio':
+ this.type = type;
+ this.provider = providers.html5; // Get config from attributes
+
+ if (this.media.hasAttribute('crossorigin')) {
+ this.config.crossorigin = true;
+ }
+
+ if (this.media.hasAttribute('autoplay')) {
+ this.config.autoplay = true;
+ }
+
+ if (this.media.hasAttribute('playsinline') || this.media.hasAttribute('webkit-playsinline')) {
+ this.config.playsinline = true;
+ }
+
+ if (this.media.hasAttribute('muted')) {
+ this.config.muted = true;
+ }
+
+ if (this.media.hasAttribute('loop')) {
+ this.config.loop.active = true;
+ }
+
+ break;
+
+ default:
+ this.debug.error('Setup failed: unsupported type');
+ return;
+ } // Check for support again but with type
+
+
+ this.supported = support.check(this.type, this.provider, this.config.playsinline); // If no support for even API, bail
+
+ if (!this.supported.api) {
+ this.debug.error('Setup failed: no support');
+ return;
+ }
+
+ this.eventListeners = []; // Create listeners
+
+ this.listeners = new Listeners(this); // Setup local storage for user settings
+
+ this.storage = new Storage(this); // Store reference
+
+ this.media.plyr = this; // Wrap media
+
+ if (!is$1.element(this.elements.container)) {
+ this.elements.container = createElement('div', {
+ tabindex: 0
+ });
+ wrap$1(this.media, this.elements.container);
+ } // Migrate custom properties from media to container (so they work 😉)
+
+
+ ui.migrateStyles.call(this); // Add style hook
+
+ ui.addStyleHook.call(this); // Setup media
+
+ media.setup.call(this); // Listen for events if debugging
+
+ if (this.config.debug) {
+ on.call(this, this.elements.container, this.config.events.join(' '), function (event) {
+ _this.debug.log("event: ".concat(event.type));
+ });
+ } // Setup fullscreen
+
+
+ this.fullscreen = new Fullscreen(this); // Setup interface
+ // If embed but not fully supported, build interface now to avoid flash of controls
+
+ if (this.isHTML5 || this.isEmbed && !this.supported.ui) {
+ ui.build.call(this);
+ } // Container listeners
+
+
+ this.listeners.container(); // Global listeners
+
+ this.listeners.global(); // Setup ads if provided
+
+ if (this.config.ads.enabled) {
+ this.ads = new Ads(this);
+ } // Autoplay if required
+
+
+ if (this.isHTML5 && this.config.autoplay) {
+ setTimeout(function () {
+ return silencePromise(_this.play());
+ }, 10);
+ } // Seek time will be recorded (in listeners.js) so we can prevent hiding controls for a few seconds after seek
+
+
+ this.lastSeekTime = 0; // Setup preview thumbnails if enabled
+
+ if (this.config.previewThumbnails.enabled) {
+ this.previewThumbnails = new PreviewThumbnails(this);
+ }
+ } // ---------------------------------------
+ // API
+ // ---------------------------------------
+
+ /**
+ * Types and provider helpers
+ */
+
+
+ _createClass(Plyr, [{
+ key: "play",
+
+ /**
+ * Play the media, or play the advertisement (if they are not blocked)
+ */
+ value: function play() {
+ var _this2 = this;
+
+ if (!is$1.function(this.media.play)) {
+ return null;
+ } // Intecept play with ads
+
+
+ if (this.ads && this.ads.enabled) {
+ this.ads.managerPromise.then(function () {
+ return _this2.ads.play();
+ }).catch(function () {
+ return silencePromise(_this2.media.play());
+ });
+ } // Return the promise (for HTML5)
+
+
+ return this.media.play();
+ }
+ /**
+ * Pause the media
+ */
+
+ }, {
+ key: "pause",
+ value: function pause() {
+ if (!this.playing || !is$1.function(this.media.pause)) {
+ return null;
+ }
+
+ return this.media.pause();
+ }
+ /**
+ * Get playing state
+ */
+
+ }, {
+ key: "togglePlay",
+
+ /**
+ * Toggle playback based on current status
+ * @param {Boolean} input
+ */
+ value: function togglePlay(input) {
+ // Toggle based on current state if nothing passed
+ var toggle = is$1.boolean(input) ? input : !this.playing;
+
+ if (toggle) {
+ return this.play();
+ }
+
+ return this.pause();
+ }
+ /**
+ * Stop playback
+ */
+
+ }, {
+ key: "stop",
+ value: function stop() {
+ if (this.isHTML5) {
+ this.pause();
+ this.restart();
+ } else if (is$1.function(this.media.stop)) {
+ this.media.stop();
+ }
+ }
+ /**
+ * Restart playback
+ */
+
+ }, {
+ key: "restart",
+ value: function restart() {
+ this.currentTime = 0;
+ }
+ /**
+ * Rewind
+ * @param {Number} seekTime - how far to rewind in seconds. Defaults to the config.seekTime
+ */
+
+ }, {
+ key: "rewind",
+ value: function rewind(seekTime) {
+ this.currentTime -= is$1.number(seekTime) ? seekTime : this.config.seekTime;
+ }
+ /**
+ * Fast forward
+ * @param {Number} seekTime - how far to fast forward in seconds. Defaults to the config.seekTime
+ */
+
+ }, {
+ key: "forward",
+ value: function forward(seekTime) {
+ this.currentTime += is$1.number(seekTime) ? seekTime : this.config.seekTime;
+ }
+ /**
+ * Seek to a time
+ * @param {Number} input - where to seek to in seconds. Defaults to 0 (the start)
+ */
+
+ }, {
+ key: "increaseVolume",
+
+ /**
+ * Increase volume
+ * @param {Boolean} step - How much to decrease by (between 0 and 1)
+ */
+ value: function increaseVolume(step) {
+ var volume = this.media.muted ? 0 : this.volume;
+ this.volume = volume + (is$1.number(step) ? step : 0);
+ }
+ /**
+ * Decrease volume
+ * @param {Boolean} step - How much to decrease by (between 0 and 1)
+ */
+
+ }, {
+ key: "decreaseVolume",
+ value: function decreaseVolume(step) {
+ this.increaseVolume(-step);
+ }
+ /**
+ * Set muted state
+ * @param {Boolean} mute
+ */
+
+ }, {
+ key: "toggleCaptions",
+
+ /**
+ * Toggle captions
+ * @param {Boolean} input - Whether to enable captions
+ */
+ value: function toggleCaptions(input) {
+ captions.toggle.call(this, input, false);
+ }
+ /**
+ * Set the caption track by index
+ * @param {Number} - Caption index
+ */
+
+ }, {
+ key: "airplay",
+
+ /**
+ * Trigger the airplay dialog
+ * TODO: update player with state, support, enabled
+ */
+ value: function airplay() {
+ // Show dialog if supported
+ if (support.airplay) {
+ this.media.webkitShowPlaybackTargetPicker();
+ }
+ }
+ /**
+ * Toggle the player controls
+ * @param {Boolean} [toggle] - Whether to show the controls
+ */
+
+ }, {
+ key: "toggleControls",
+ value: function toggleControls(toggle) {
+ // Don't toggle if missing UI support or if it's audio
+ if (this.supported.ui && !this.isAudio) {
+ // Get state before change
+ var isHidden = hasClass(this.elements.container, this.config.classNames.hideControls); // Negate the argument if not undefined since adding the class to hides the controls
+
+ var force = typeof toggle === 'undefined' ? undefined : !toggle; // Apply and get updated state
+
+ var hiding = toggleClass(this.elements.container, this.config.classNames.hideControls, force); // Close menu
+
+ if (hiding && is$1.array(this.config.controls) && this.config.controls.includes('settings') && !is$1.empty(this.config.settings)) {
+ controls.toggleMenu.call(this, false);
+ } // Trigger event on change
+
+
+ if (hiding !== isHidden) {
+ var eventName = hiding ? 'controlshidden' : 'controlsshown';
+ triggerEvent.call(this, this.media, eventName);
+ }
+
+ return !hiding;
+ }
+
+ return false;
+ }
+ /**
+ * Add event listeners
+ * @param {String} event - Event type
+ * @param {Function} callback - Callback for when event occurs
+ */
+
+ }, {
+ key: "on",
+ value: function on$1(event, callback) {
+ on.call(this, this.elements.container, event, callback);
+ }
+ /**
+ * Add event listeners once
+ * @param {String} event - Event type
+ * @param {Function} callback - Callback for when event occurs
+ */
+
+ }, {
+ key: "once",
+ value: function once$1(event, callback) {
+ once.call(this, this.elements.container, event, callback);
+ }
+ /**
+ * Remove event listeners
+ * @param {String} event - Event type
+ * @param {Function} callback - Callback for when event occurs
+ */
+
+ }, {
+ key: "off",
+ value: function off$1(event, callback) {
+ off(this.elements.container, event, callback);
+ }
+ /**
+ * Destroy an instance
+ * Event listeners are removed when elements are removed
+ * http://stackoverflow.com/questions/12528049/if-a-dom-element-is-removed-are-its-listeners-also-removed-from-memory
+ * @param {Function} callback - Callback for when destroy is complete
+ * @param {Boolean} soft - Whether it's a soft destroy (for source changes etc)
+ */
+
+ }, {
+ key: "destroy",
+ value: function destroy(callback) {
+ var _this3 = this;
+
+ var soft = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
+
+ if (!this.ready) {
+ return;
+ }
+
+ var done = function done() {
+ // Reset overflow (incase destroyed while in fullscreen)
+ document.body.style.overflow = ''; // GC for embed
+
+ _this3.embed = null; // If it's a soft destroy, make minimal changes
+
+ if (soft) {
+ if (Object.keys(_this3.elements).length) {
+ // Remove elements
+ removeElement(_this3.elements.buttons.play);
+ removeElement(_this3.elements.captions);
+ removeElement(_this3.elements.controls);
+ removeElement(_this3.elements.wrapper); // Clear for GC
+
+ _this3.elements.buttons.play = null;
+ _this3.elements.captions = null;
+ _this3.elements.controls = null;
+ _this3.elements.wrapper = null;
+ } // Callback
+
+
+ if (is$1.function(callback)) {
+ callback();
+ }
+ } else {
+ // Unbind listeners
+ unbindListeners.call(_this3); // Replace the container with the original element provided
+
+ replaceElement(_this3.elements.original, _this3.elements.container); // Event
+
+ triggerEvent.call(_this3, _this3.elements.original, 'destroyed', true); // Callback
+
+ if (is$1.function(callback)) {
+ callback.call(_this3.elements.original);
+ } // Reset state
+
+
+ _this3.ready = false; // Clear for garbage collection
+
+ setTimeout(function () {
+ _this3.elements = null;
+ _this3.media = null;
+ }, 200);
+ }
+ }; // Stop playback
+
+
+ this.stop(); // Clear timeouts
+
+ clearTimeout(this.timers.loading);
+ clearTimeout(this.timers.controls);
+ clearTimeout(this.timers.resized); // Provider specific stuff
+
+ if (this.isHTML5) {
+ // Restore native video controls
+ ui.toggleNativeControls.call(this, true); // Clean up
+
+ done();
+ } else if (this.isYouTube) {
+ // Clear timers
+ clearInterval(this.timers.buffering);
+ clearInterval(this.timers.playing); // Destroy YouTube API
+
+ if (this.embed !== null && is$1.function(this.embed.destroy)) {
+ this.embed.destroy();
+ } // Clean up
+
+
+ done();
+ } else if (this.isVimeo) {
+ // Destroy Vimeo API
+ // then clean up (wait, to prevent postmessage errors)
+ if (this.embed !== null) {
+ this.embed.unload().then(done);
+ } // Vimeo does not always return
+
+
+ setTimeout(done, 200);
+ }
+ }
+ /**
+ * Check for support for a mime type (HTML5 only)
+ * @param {String} type - Mime type
+ */
+
+ }, {
+ key: "supports",
+ value: function supports(type) {
+ return support.mime.call(this, type);
+ }
+ /**
+ * Check for support
+ * @param {String} type - Player type (audio/video)
+ * @param {String} provider - Provider (html5/youtube/vimeo)
+ * @param {Boolean} inline - Where player has `playsinline` sttribute
+ */
+
+ }, {
+ key: "isHTML5",
+ get: function get() {
+ return this.provider === providers.html5;
+ }
+ }, {
+ key: "isEmbed",
+ get: function get() {
+ return this.isYouTube || this.isVimeo;
+ }
+ }, {
+ key: "isYouTube",
+ get: function get() {
+ return this.provider === providers.youtube;
+ }
+ }, {
+ key: "isVimeo",
+ get: function get() {
+ return this.provider === providers.vimeo;
+ }
+ }, {
+ key: "isVideo",
+ get: function get() {
+ return this.type === types.video;
+ }
+ }, {
+ key: "isAudio",
+ get: function get() {
+ return this.type === types.audio;
+ }
+ }, {
+ key: "playing",
+ get: function get() {
+ return Boolean(this.ready && !this.paused && !this.ended);
+ }
+ /**
+ * Get paused state
+ */
+
+ }, {
+ key: "paused",
+ get: function get() {
+ return Boolean(this.media.paused);
+ }
+ /**
+ * Get stopped state
+ */
+
+ }, {
+ key: "stopped",
+ get: function get() {
+ return Boolean(this.paused && this.currentTime === 0);
+ }
+ /**
+ * Get ended state
+ */
+
+ }, {
+ key: "ended",
+ get: function get() {
+ return Boolean(this.media.ended);
+ }
+ }, {
+ key: "currentTime",
+ set: function set(input) {
+ // Bail if media duration isn't available yet
+ if (!this.duration) {
+ return;
+ } // Validate input
+
+
+ var inputIsValid = is$1.number(input) && input > 0; // Set
+
+ this.media.currentTime = inputIsValid ? Math.min(input, this.duration) : 0; // Logging
+
+ this.debug.log("Seeking to ".concat(this.currentTime, " seconds"));
+ }
+ /**
+ * Get current time
+ */
+ ,
+ get: function get() {
+ return Number(this.media.currentTime);
+ }
+ /**
+ * Get buffered
+ */
+
+ }, {
+ key: "buffered",
+ get: function get() {
+ var buffered = this.media.buffered; // YouTube / Vimeo return a float between 0-1
+
+ if (is$1.number(buffered)) {
+ return buffered;
+ } // HTML5
+ // TODO: Handle buffered chunks of the media
+ // (i.e. seek to another section buffers only that section)
+
+
+ if (buffered && buffered.length && this.duration > 0) {
+ return buffered.end(0) / this.duration;
+ }
+
+ return 0;
+ }
+ /**
+ * Get seeking status
+ */
+
+ }, {
+ key: "seeking",
+ get: function get() {
+ return Boolean(this.media.seeking);
+ }
+ /**
+ * Get the duration of the current media
+ */
+
+ }, {
+ key: "duration",
+ get: function get() {
+ // Faux duration set via config
+ var fauxDuration = parseFloat(this.config.duration); // Media duration can be NaN or Infinity before the media has loaded
+
+ var realDuration = (this.media || {}).duration;
+ var duration = !is$1.number(realDuration) || realDuration === Infinity ? 0 : realDuration; // If config duration is funky, use regular duration
+
+ return fauxDuration || duration;
+ }
+ /**
+ * Set the player volume
+ * @param {Number} value - must be between 0 and 1. Defaults to the value from local storage and config.volume if not set in storage
+ */
+
+ }, {
+ key: "volume",
+ set: function set(value) {
+ var volume = value;
+ var max = 1;
+ var min = 0;
+
+ if (is$1.string(volume)) {
+ volume = Number(volume);
+ } // Load volume from storage if no value specified
+
+
+ if (!is$1.number(volume)) {
+ volume = this.storage.get('volume');
+ } // Use config if all else fails
+
+
+ if (!is$1.number(volume)) {
+ volume = this.config.volume;
+ } // Maximum is volumeMax
+
+
+ if (volume > max) {
+ volume = max;
+ } // Minimum is volumeMin
+
+
+ if (volume < min) {
+ volume = min;
+ } // Update config
+
+
+ this.config.volume = volume; // Set the player volume
+
+ this.media.volume = volume; // If muted, and we're increasing volume manually, reset muted state
+
+ if (!is$1.empty(value) && this.muted && volume > 0) {
+ this.muted = false;
+ }
+ }
+ /**
+ * Get the current player volume
+ */
+ ,
+ get: function get() {
+ return Number(this.media.volume);
+ }
+ }, {
+ key: "muted",
+ set: function set(mute) {
+ var toggle = mute; // Load muted state from storage
+
+ if (!is$1.boolean(toggle)) {
+ toggle = this.storage.get('muted');
+ } // Use config if all else fails
+
+
+ if (!is$1.boolean(toggle)) {
+ toggle = this.config.muted;
+ } // Update config
+
+
+ this.config.muted = toggle; // Set mute on the player
+
+ this.media.muted = toggle;
+ }
+ /**
+ * Get current muted state
+ */
+ ,
+ get: function get() {
+ return Boolean(this.media.muted);
+ }
+ /**
+ * Check if the media has audio
+ */
+
+ }, {
+ key: "hasAudio",
+ get: function get() {
+ // Assume yes for all non HTML5 (as we can't tell...)
+ if (!this.isHTML5) {
+ return true;
+ }
+
+ if (this.isAudio) {
+ return true;
+ } // Get audio tracks
+
+
+ return Boolean(this.media.mozHasAudio) || Boolean(this.media.webkitAudioDecodedByteCount) || Boolean(this.media.audioTracks && this.media.audioTracks.length);
+ }
+ /**
+ * Set playback speed
+ * @param {Number} speed - the speed of playback (0.5-2.0)
+ */
+
+ }, {
+ key: "speed",
+ set: function set(input) {
+ var _this4 = this;
+
+ var speed = null;
+
+ if (is$1.number(input)) {
+ speed = input;
+ }
+
+ if (!is$1.number(speed)) {
+ speed = this.storage.get('speed');
+ }
+
+ if (!is$1.number(speed)) {
+ speed = this.config.speed.selected;
+ } // Clamp to min/max
+
+
+ var min = this.minimumSpeed,
+ max = this.maximumSpeed;
+ speed = clamp(speed, min, max); // Update config
+
+ this.config.speed.selected = speed; // Set media speed
+
+ setTimeout(function () {
+ _this4.media.playbackRate = speed;
+ }, 0);
+ }
+ /**
+ * Get current playback speed
+ */
+ ,
+ get: function get() {
+ return Number(this.media.playbackRate);
+ }
+ /**
+ * Get the minimum allowed speed
+ */
+
+ }, {
+ key: "minimumSpeed",
+ get: function get() {
+ if (this.isYouTube) {
+ // https://developers.google.com/youtube/iframe_api_reference#setPlaybackRate
+ return Math.min.apply(Math, _toConsumableArray(this.options.speed));
+ }
+
+ if (this.isVimeo) {
+ // https://github.com/vimeo/player.js/#setplaybackrateplaybackrate-number-promisenumber-rangeerrorerror
+ return 0.5;
+ } // https://stackoverflow.com/a/32320020/1191319
+
+
+ return 0.0625;
+ }
+ /**
+ * Get the maximum allowed speed
+ */
+
+ }, {
+ key: "maximumSpeed",
+ get: function get() {
+ if (this.isYouTube) {
+ // https://developers.google.com/youtube/iframe_api_reference#setPlaybackRate
+ return Math.max.apply(Math, _toConsumableArray(this.options.speed));
+ }
+
+ if (this.isVimeo) {
+ // https://github.com/vimeo/player.js/#setplaybackrateplaybackrate-number-promisenumber-rangeerrorerror
+ return 2;
+ } // https://stackoverflow.com/a/32320020/1191319
+
+
+ return 16;
+ }
+ /**
+ * Set playback quality
+ * Currently HTML5 & YouTube only
+ * @param {Number} input - Quality level
+ */
+
+ }, {
+ key: "quality",
+ set: function set(input) {
+ var config = this.config.quality;
+ var options = this.options.quality;
+
+ if (!options.length) {
+ return;
+ }
+
+ var quality = [!is$1.empty(input) && Number(input), this.storage.get('quality'), config.selected, config.default].find(is$1.number);
+ var updateStorage = true;
+
+ if (!options.includes(quality)) {
+ var value = closest$1(options, quality);
+ this.debug.warn("Unsupported quality option: ".concat(quality, ", using ").concat(value, " instead"));
+ quality = value; // Don't update storage if quality is not supported
+
+ updateStorage = false;
+ } // Update config
+
+
+ config.selected = quality; // Set quality
+
+ this.media.quality = quality; // Save to storage
+
+ if (updateStorage) {
+ this.storage.set({
+ quality: quality
+ });
+ }
+ }
+ /**
+ * Get current quality level
+ */
+ ,
+ get: function get() {
+ return this.media.quality;
+ }
+ /**
+ * Toggle loop
+ * TODO: Finish fancy new logic. Set the indicator on load as user may pass loop as config
+ * @param {Boolean} input - Whether to loop or not
+ */
+
+ }, {
+ key: "loop",
+ set: function set(input) {
+ var toggle = is$1.boolean(input) ? input : this.config.loop.active;
+ this.config.loop.active = toggle;
+ this.media.loop = toggle; // Set default to be a true toggle
+
+ /* const type = ['start', 'end', 'all', 'none', 'toggle'].includes(input) ? input : 'toggle';
+ switch (type) {
+ case 'start':
+ if (this.config.loop.end && this.config.loop.end <= this.currentTime) {
+ this.config.loop.end = null;
+ }
+ this.config.loop.start = this.currentTime;
+ // this.config.loop.indicator.start = this.elements.display.played.value;
+ break;
+ case 'end':
+ if (this.config.loop.start >= this.currentTime) {
+ return this;
+ }
+ this.config.loop.end = this.currentTime;
+ // this.config.loop.indicator.end = this.elements.display.played.value;
+ break;
+ case 'all':
+ this.config.loop.start = 0;
+ this.config.loop.end = this.duration - 2;
+ this.config.loop.indicator.start = 0;
+ this.config.loop.indicator.end = 100;
+ break;
+ case 'toggle':
+ if (this.config.loop.active) {
+ this.config.loop.start = 0;
+ this.config.loop.end = null;
+ } else {
+ this.config.loop.start = 0;
+ this.config.loop.end = this.duration - 2;
+ }
+ break;
+ default:
+ this.config.loop.start = 0;
+ this.config.loop.end = null;
+ break;
+ } */
+ }
+ /**
+ * Get current loop state
+ */
+ ,
+ get: function get() {
+ return Boolean(this.media.loop);
+ }
+ /**
+ * Set new media source
+ * @param {Object} input - The new source object (see docs)
+ */
+
+ }, {
+ key: "source",
+ set: function set(input) {
+ source.change.call(this, input);
+ }
+ /**
+ * Get current source
+ */
+ ,
+ get: function get() {
+ return this.media.currentSrc;
+ }
+ /**
+ * Get a download URL (either source or custom)
+ */
+
+ }, {
+ key: "download",
+ get: function get() {
+ var download = this.config.urls.download;
+ return is$1.url(download) ? download : this.source;
+ }
+ /**
+ * Set the download URL
+ */
+ ,
+ set: function set(input) {
+ if (!is$1.url(input)) {
+ return;
+ }
+
+ this.config.urls.download = input;
+ controls.setDownloadUrl.call(this);
+ }
+ /**
+ * Set the poster image for a video
+ * @param {String} input - the URL for the new poster image
+ */
+
+ }, {
+ key: "poster",
+ set: function set(input) {
+ if (!this.isVideo) {
+ this.debug.warn('Poster can only be set for video');
+ return;
+ }
+
+ ui.setPoster.call(this, input, false).catch(function () {});
+ }
+ /**
+ * Get the current poster image
+ */
+ ,
+ get: function get() {
+ if (!this.isVideo) {
+ return null;
+ }
+
+ return this.media.getAttribute('poster') || this.media.getAttribute('data-poster');
+ }
+ /**
+ * Get the current aspect ratio in use
+ */
+
+ }, {
+ key: "ratio",
+ get: function get() {
+ if (!this.isVideo) {
+ return null;
+ }
+
+ var ratio = reduceAspectRatio(getAspectRatio.call(this));
+ return is$1.array(ratio) ? ratio.join(':') : ratio;
+ }
+ /**
+ * Set video aspect ratio
+ */
+ ,
+ set: function set(input) {
+ if (!this.isVideo) {
+ this.debug.warn('Aspect ratio can only be set for video');
+ return;
+ }
+
+ if (!is$1.string(input) || !validateRatio(input)) {
+ this.debug.error("Invalid aspect ratio specified (".concat(input, ")"));
+ return;
+ }
+
+ this.config.ratio = input;
+ setAspectRatio.call(this);
+ }
+ /**
+ * Set the autoplay state
+ * @param {Boolean} input - Whether to autoplay or not
+ */
+
+ }, {
+ key: "autoplay",
+ set: function set(input) {
+ var toggle = is$1.boolean(input) ? input : this.config.autoplay;
+ this.config.autoplay = toggle;
+ }
+ /**
+ * Get the current autoplay state
+ */
+ ,
+ get: function get() {
+ return Boolean(this.config.autoplay);
+ }
+ }, {
+ key: "currentTrack",
+ set: function set(input) {
+ captions.set.call(this, input, false);
+ }
+ /**
+ * Get the current caption track index (-1 if disabled)
+ */
+ ,
+ get: function get() {
+ var _this$captions = this.captions,
+ toggled = _this$captions.toggled,
+ currentTrack = _this$captions.currentTrack;
+ return toggled ? currentTrack : -1;
+ }
+ /**
+ * Set the wanted language for captions
+ * Since tracks can be added later it won't update the actual caption track until there is a matching track
+ * @param {String} - Two character ISO language code (e.g. EN, FR, PT, etc)
+ */
+
+ }, {
+ key: "language",
+ set: function set(input) {
+ captions.setLanguage.call(this, input, false);
+ }
+ /**
+ * Get the current track's language
+ */
+ ,
+ get: function get() {
+ return (captions.getCurrentTrack.call(this) || {}).language;
+ }
+ /**
+ * Toggle picture-in-picture playback on WebKit/MacOS
+ * TODO: update player with state, support, enabled
+ * TODO: detect outside changes
+ */
+
+ }, {
+ key: "pip",
+ set: function set(input) {
+ // Bail if no support
+ if (!support.pip) {
+ return;
+ } // Toggle based on current state if not passed
+
+
+ var toggle = is$1.boolean(input) ? input : !this.pip; // Toggle based on current state
+ // Safari
+
+ if (is$1.function(this.media.webkitSetPresentationMode)) {
+ this.media.webkitSetPresentationMode(toggle ? pip.active : pip.inactive);
+ } // Chrome
+
+
+ if (is$1.function(this.media.requestPictureInPicture)) {
+ if (!this.pip && toggle) {
+ this.media.requestPictureInPicture();
+ } else if (this.pip && !toggle) {
+ document.exitPictureInPicture();
+ }
+ }
+ }
+ /**
+ * Get the current picture-in-picture state
+ */
+ ,
+ get: function get() {
+ if (!support.pip) {
+ return null;
+ } // Safari
+
+
+ if (!is$1.empty(this.media.webkitPresentationMode)) {
+ return this.media.webkitPresentationMode === pip.active;
+ } // Chrome
+
+
+ return this.media === document.pictureInPictureElement;
+ }
+ }], [{
+ key: "supported",
+ value: function supported(type, provider, inline) {
+ return support.check(type, provider, inline);
+ }
+ /**
+ * Load an SVG sprite into the page
+ * @param {String} url - URL for the SVG sprite
+ * @param {String} [id] - Unique ID
+ */
+
+ }, {
+ key: "loadSprite",
+ value: function loadSprite$1(url, id) {
+ return loadSprite(url, id);
+ }
+ /**
+ * Setup multiple instances
+ * @param {*} selector
+ * @param {Object} options
+ */
+
+ }, {
+ key: "setup",
+ value: function setup(selector) {
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
+ var targets = null;
+
+ if (is$1.string(selector)) {
+ targets = Array.from(document.querySelectorAll(selector));
+ } else if (is$1.nodeList(selector)) {
+ targets = Array.from(selector);
+ } else if (is$1.array(selector)) {
+ targets = selector.filter(is$1.element);
+ }
+
+ if (is$1.empty(targets)) {
+ return null;
+ }
+
+ return targets.map(function (t) {
+ return new Plyr(t, options);
+ });
+ }
+ }]);
+
+ return Plyr;
+ }();
+
+ Plyr.defaults = cloneDeep(defaults$1);
+
+ // ==========================================================================
+
+ return Plyr;
+
+})));
diff --git a/youtube/static/modules/plyr/plyr.polyfilled.min.js b/youtube/static/modules/plyr/plyr.polyfilled.min.js
new file mode 100644
index 0000000..8b5faf1
--- /dev/null
+++ b/youtube/static/modules/plyr/plyr.polyfilled.min.js
@@ -0,0 +1,4 @@
+"object"==typeof navigator&&function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define("Plyr",t):(e=e||self).Plyr=t()}(this,(function(){"use strict";!function(){if("undefined"!=typeof window)try{var e=new window.CustomEvent("test",{cancelable:!0});if(e.preventDefault(),!0!==e.defaultPrevented)throw new Error("Could not prevent default")}catch(e){var t=function(e,t){var n,i;return(t=t||{}).bubbles=!!t.bubbles,t.cancelable=!!t.cancelable,(n=document.createEvent("CustomEvent")).initCustomEvent(e,t.bubbles,t.cancelable,t.detail),i=n.preventDefault,n.preventDefault=function(){i.call(this);try{Object.defineProperty(this,"defaultPrevented",{get:function(){return!0}})}catch(e){this.defaultPrevented=!0}},n};t.prototype=window.Event.prototype,window.CustomEvent=t}}();var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function t(e,t){return e(t={exports:{}},t.exports),t.exports}var n=function(e){return e&&e.Math==Math&&e},i=n("object"==typeof globalThis&&globalThis)||n("object"==typeof window&&window)||n("object"==typeof self&&self)||n("object"==typeof e&&e)||Function("return this")(),r=function(e){try{return!!e()}catch(e){return!0}},a=!r((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),o={}.propertyIsEnumerable,s=Object.getOwnPropertyDescriptor,l={f:s&&!o.call({1:2},1)?function(e){var t=s(this,e);return!!t&&t.enumerable}:o},c=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},u={}.toString,h=function(e){return u.call(e).slice(8,-1)},f="".split,d=r((function(){return!Object("z").propertyIsEnumerable(0)}))?function(e){return"String"==h(e)?f.call(e,""):Object(e)}:Object,p=function(e){if(null==e)throw TypeError("Can't call method on "+e);return e},m=function(e){return d(p(e))},g=function(e){return"object"==typeof e?null!==e:"function"==typeof e},v=function(e,t){if(!g(e))return e;var n,i;if(t&&"function"==typeof(n=e.toString)&&!g(i=n.call(e)))return i;if("function"==typeof(n=e.valueOf)&&!g(i=n.call(e)))return i;if(!t&&"function"==typeof(n=e.toString)&&!g(i=n.call(e)))return i;throw TypeError("Can't convert object to primitive value")},y={}.hasOwnProperty,b=function(e,t){return y.call(e,t)},w=i.document,k=g(w)&&g(w.createElement),T=function(e){return k?w.createElement(e):{}},S=!a&&!r((function(){return 7!=Object.defineProperty(T("div"),"a",{get:function(){return 7}}).a})),E=Object.getOwnPropertyDescriptor,A={f:a?E:function(e,t){if(e=m(e),t=v(t,!0),S)try{return E(e,t)}catch(e){}if(b(e,t))return c(!l.f.call(e,t),e[t])}},P=function(e){if(!g(e))throw TypeError(String(e)+" is not an object");return e},x=Object.defineProperty,C={f:a?x:function(e,t,n){if(P(e),t=v(t,!0),P(n),S)try{return x(e,t,n)}catch(e){}if("get"in n||"set"in n)throw TypeError("Accessors not supported");return"value"in n&&(e[t]=n.value),e}},O=a?function(e,t,n){return C.f(e,t,c(1,n))}:function(e,t,n){return e[t]=n,e},I=function(e,t){try{O(i,e,t)}catch(n){i[e]=t}return t},L=i["__core-js_shared__"]||I("__core-js_shared__",{}),j=Function.toString;"function"!=typeof L.inspectSource&&(L.inspectSource=function(e){return j.call(e)});var N,R,M,_=L.inspectSource,U=i.WeakMap,D="function"==typeof U&&/native code/.test(_(U)),F=t((function(e){(e.exports=function(e,t){return L[e]||(L[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.6.5",mode:"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})})),q=0,H=Math.random(),B=function(e){return"Symbol("+String(void 0===e?"":e)+")_"+(++q+H).toString(36)},V=F("keys"),z=function(e){return V[e]||(V[e]=B(e))},W={},K=i.WeakMap;if(D){var $=new K,Y=$.get,G=$.has,X=$.set;N=function(e,t){return X.call($,e,t),t},R=function(e){return Y.call($,e)||{}},M=function(e){return G.call($,e)}}else{var Q=z("state");W[Q]=!0,N=function(e,t){return O(e,Q,t),t},R=function(e){return b(e,Q)?e[Q]:{}},M=function(e){return b(e,Q)}}var J,Z={set:N,get:R,has:M,enforce:function(e){return M(e)?R(e):N(e,{})},getterFor:function(e){return function(t){var n;if(!g(t)||(n=R(t)).type!==e)throw TypeError("Incompatible receiver, "+e+" required");return n}}},ee=t((function(e){var t=Z.get,n=Z.enforce,r=String(String).split("String");(e.exports=function(e,t,a,o){var s=!!o&&!!o.unsafe,l=!!o&&!!o.enumerable,c=!!o&&!!o.noTargetGet;"function"==typeof a&&("string"!=typeof t||b(a,"name")||O(a,"name",t),n(a).source=r.join("string"==typeof t?t:"")),e!==i?(s?!c&&e[t]&&(l=!0):delete e[t],l?e[t]=a:O(e,t,a)):l?e[t]=a:I(t,a)})(Function.prototype,"toString",(function(){return"function"==typeof this&&t(this).source||_(this)}))})),te=i,ne=function(e){return"function"==typeof e?e:void 0},ie=function(e,t){return arguments.length<2?ne(te[e])||ne(i[e]):te[e]&&te[e][t]||i[e]&&i[e][t]},re=Math.ceil,ae=Math.floor,oe=function(e){return isNaN(e=+e)?0:(e>0?ae:re)(e)},se=Math.min,le=function(e){return e>0?se(oe(e),9007199254740991):0},ce=Math.max,ue=Math.min,he=function(e,t){var n=oe(e);return n<0?ce(n+t,0):ue(n,t)},fe=function(e){return function(t,n,i){var r,a=m(t),o=le(a.length),s=he(i,o);if(e&&n!=n){for(;o>s;)if((r=a[s++])!=r)return!0}else for(;o>s;s++)if((e||s in a)&&a[s]===n)return e||s||0;return!e&&-1}},de={includes:fe(!0),indexOf:fe(!1)},pe=de.indexOf,me=function(e,t){var n,i=m(e),r=0,a=[];for(n in i)!b(W,n)&&b(i,n)&&a.push(n);for(;t.length>r;)b(i,n=t[r++])&&(~pe(a,n)||a.push(n));return a},ge=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],ve=ge.concat("length","prototype"),ye={f:Object.getOwnPropertyNames||function(e){return me(e,ve)}},be={f:Object.getOwnPropertySymbols},we=ie("Reflect","ownKeys")||function(e){var t=ye.f(P(e)),n=be.f;return n?t.concat(n(e)):t},ke=function(e,t){for(var n=we(t),i=C.f,r=A.f,a=0;a<n.length;a++){var o=n[a];b(e,o)||i(e,o,r(t,o))}},Te=/#|\.prototype\./,Se=function(e,t){var n=Ae[Ee(e)];return n==xe||n!=Pe&&("function"==typeof t?r(t):!!t)},Ee=Se.normalize=function(e){return String(e).replace(Te,".").toLowerCase()},Ae=Se.data={},Pe=Se.NATIVE="N",xe=Se.POLYFILL="P",Ce=Se,Oe=A.f,Ie=function(e,t){var n,r,a,o,s,l=e.target,c=e.global,u=e.stat;if(n=c?i:u?i[l]||I(l,{}):(i[l]||{}).prototype)for(r in t){if(o=t[r],a=e.noTargetGet?(s=Oe(n,r))&&s.value:n[r],!Ce(c?r:l+(u?".":"#")+r,e.forced)&&void 0!==a){if(typeof o==typeof a)continue;ke(o,a)}(e.sham||a&&a.sham)&&O(o,"sham",!0),ee(n,r,o,e)}},Le=!!Object.getOwnPropertySymbols&&!r((function(){return!String(Symbol())})),je=Le&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,Ne=Array.isArray||function(e){return"Array"==h(e)},Re=function(e){return Object(p(e))},Me=Object.keys||function(e){return me(e,ge)},_e=a?Object.defineProperties:function(e,t){P(e);for(var n,i=Me(t),r=i.length,a=0;r>a;)C.f(e,n=i[a++],t[n]);return e},Ue=ie("document","documentElement"),De=z("IE_PROTO"),Fe=function(){},qe=function(e){return"<script>"+e+"<\/script>"},He=function(){try{J=document.domain&&new ActiveXObject("htmlfile")}catch(e){}var e,t;He=J?function(e){e.write(qe("")),e.close();var t=e.parentWindow.Object;return e=null,t}(J):((t=T("iframe")).style.display="none",Ue.appendChild(t),t.src=String("javascript:"),(e=t.contentWindow.document).open(),e.write(qe("document.F=Object")),e.close(),e.F);for(var n=ge.length;n--;)delete He.prototype[ge[n]];return He()};W[De]=!0;var Be=Object.create||function(e,t){var n;return null!==e?(Fe.prototype=P(e),n=new Fe,Fe.prototype=null,n[De]=e):n=He(),void 0===t?n:_e(n,t)},Ve=ye.f,ze={}.toString,We="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],Ke={f:function(e){return We&&"[object Window]"==ze.call(e)?function(e){try{return Ve(e)}catch(e){return We.slice()}}(e):Ve(m(e))}},$e=F("wks"),Ye=i.Symbol,Ge=je?Ye:Ye&&Ye.withoutSetter||B,Xe=function(e){return b($e,e)||(Le&&b(Ye,e)?$e[e]=Ye[e]:$e[e]=Ge("Symbol."+e)),$e[e]},Qe={f:Xe},Je=C.f,Ze=function(e){var t=te.Symbol||(te.Symbol={});b(t,e)||Je(t,e,{value:Qe.f(e)})},et=C.f,tt=Xe("toStringTag"),nt=function(e,t,n){e&&!b(e=n?e:e.prototype,tt)&&et(e,tt,{configurable:!0,value:t})},it=function(e){if("function"!=typeof e)throw TypeError(String(e)+" is not a function");return e},rt=function(e,t,n){if(it(e),void 0===t)return e;switch(n){case 0:return function(){return e.call(t)};case 1:return function(n){return e.call(t,n)};case 2:return function(n,i){return e.call(t,n,i)};case 3:return function(n,i,r){return e.call(t,n,i,r)}}return function(){return e.apply(t,arguments)}},at=Xe("species"),ot=function(e,t){var n;return Ne(e)&&("function"!=typeof(n=e.constructor)||n!==Array&&!Ne(n.prototype)?g(n)&&null===(n=n[at])&&(n=void 0):n=void 0),new(void 0===n?Array:n)(0===t?0:t)},st=[].push,lt=function(e){var t=1==e,n=2==e,i=3==e,r=4==e,a=6==e,o=5==e||a;return function(s,l,c,u){for(var h,f,p=Re(s),m=d(p),g=rt(l,c,3),v=le(m.length),y=0,b=u||ot,w=t?b(s,v):n?b(s,0):void 0;v>y;y++)if((o||y in m)&&(f=g(h=m[y],y,p),e))if(t)w[y]=f;else if(f)switch(e){case 3:return!0;case 5:return h;case 6:return y;case 2:st.call(w,h)}else if(r)return!1;return a?-1:i||r?r:w}},ct={forEach:lt(0),map:lt(1),filter:lt(2),some:lt(3),every:lt(4),find:lt(5),findIndex:lt(6)},ut=ct.forEach,ht=z("hidden"),ft=Xe("toPrimitive"),dt=Z.set,pt=Z.getterFor("Symbol"),mt=Object.prototype,gt=i.Symbol,vt=ie("JSON","stringify"),yt=A.f,bt=C.f,wt=Ke.f,kt=l.f,Tt=F("symbols"),St=F("op-symbols"),Et=F("string-to-symbol-registry"),At=F("symbol-to-string-registry"),Pt=F("wks"),xt=i.QObject,Ct=!xt||!xt.prototype||!xt.prototype.findChild,Ot=a&&r((function(){return 7!=Be(bt({},"a",{get:function(){return bt(this,"a",{value:7}).a}})).a}))?function(e,t,n){var i=yt(mt,t);i&&delete mt[t],bt(e,t,n),i&&e!==mt&&bt(mt,t,i)}:bt,It=function(e,t){var n=Tt[e]=Be(gt.prototype);return dt(n,{type:"Symbol",tag:e,description:t}),a||(n.description=t),n},Lt=je?function(e){return"symbol"==typeof e}:function(e){return Object(e)instanceof gt},jt=function(e,t,n){e===mt&&jt(St,t,n),P(e);var i=v(t,!0);return P(n),b(Tt,i)?(n.enumerable?(b(e,ht)&&e[ht][i]&&(e[ht][i]=!1),n=Be(n,{enumerable:c(0,!1)})):(b(e,ht)||bt(e,ht,c(1,{})),e[ht][i]=!0),Ot(e,i,n)):bt(e,i,n)},Nt=function(e,t){P(e);var n=m(t),i=Me(n).concat(Ut(n));return ut(i,(function(t){a&&!Rt.call(n,t)||jt(e,t,n[t])})),e},Rt=function(e){var t=v(e,!0),n=kt.call(this,t);return!(this===mt&&b(Tt,t)&&!b(St,t))&&(!(n||!b(this,t)||!b(Tt,t)||b(this,ht)&&this[ht][t])||n)},Mt=function(e,t){var n=m(e),i=v(t,!0);if(n!==mt||!b(Tt,i)||b(St,i)){var r=yt(n,i);return!r||!b(Tt,i)||b(n,ht)&&n[ht][i]||(r.enumerable=!0),r}},_t=function(e){var t=wt(m(e)),n=[];return ut(t,(function(e){b(Tt,e)||b(W,e)||n.push(e)})),n},Ut=function(e){var t=e===mt,n=wt(t?St:m(e)),i=[];return ut(n,(function(e){!b(Tt,e)||t&&!b(mt,e)||i.push(Tt[e])})),i};if(Le||(ee((gt=function(){if(this instanceof gt)throw TypeError("Symbol is not a constructor");var e=arguments.length&&void 0!==arguments[0]?String(arguments[0]):void 0,t=B(e),n=function(e){this===mt&&n.call(St,e),b(this,ht)&&b(this[ht],t)&&(this[ht][t]=!1),Ot(this,t,c(1,e))};return a&&Ct&&Ot(mt,t,{configurable:!0,set:n}),It(t,e)}).prototype,"toString",(function(){return pt(this).tag})),ee(gt,"withoutSetter",(function(e){return It(B(e),e)})),l.f=Rt,C.f=jt,A.f=Mt,ye.f=Ke.f=_t,be.f=Ut,Qe.f=function(e){return It(Xe(e),e)},a&&(bt(gt.prototype,"description",{configurable:!0,get:function(){return pt(this).description}}),ee(mt,"propertyIsEnumerable",Rt,{unsafe:!0}))),Ie({global:!0,wrap:!0,forced:!Le,sham:!Le},{Symbol:gt}),ut(Me(Pt),(function(e){Ze(e)})),Ie({target:"Symbol",stat:!0,forced:!Le},{for:function(e){var t=String(e);if(b(Et,t))return Et[t];var n=gt(t);return Et[t]=n,At[n]=t,n},keyFor:function(e){if(!Lt(e))throw TypeError(e+" is not a symbol");if(b(At,e))return At[e]},useSetter:function(){Ct=!0},useSimple:function(){Ct=!1}}),Ie({target:"Object",stat:!0,forced:!Le,sham:!a},{create:function(e,t){return void 0===t?Be(e):Nt(Be(e),t)},defineProperty:jt,defineProperties:Nt,getOwnPropertyDescriptor:Mt}),Ie({target:"Object",stat:!0,forced:!Le},{getOwnPropertyNames:_t,getOwnPropertySymbols:Ut}),Ie({target:"Object",stat:!0,forced:r((function(){be.f(1)}))},{getOwnPropertySymbols:function(e){return be.f(Re(e))}}),vt){var Dt=!Le||r((function(){var e=gt();return"[null]"!=vt([e])||"{}"!=vt({a:e})||"{}"!=vt(Object(e))}));Ie({target:"JSON",stat:!0,forced:Dt},{stringify:function(e,t,n){for(var i,r=[e],a=1;arguments.length>a;)r.push(arguments[a++]);if(i=t,(g(t)||void 0!==e)&&!Lt(e))return Ne(t)||(t=function(e,t){if("function"==typeof i&&(t=i.call(this,e,t)),!Lt(t))return t}),r[1]=t,vt.apply(null,r)}})}gt.prototype[ft]||O(gt.prototype,ft,gt.prototype.valueOf),nt(gt,"Symbol"),W[ht]=!0;var Ft=C.f,qt=i.Symbol;if(a&&"function"==typeof qt&&(!("description"in qt.prototype)||void 0!==qt().description)){var Ht={},Bt=function(){var e=arguments.length<1||void 0===arguments[0]?void 0:String(arguments[0]),t=this instanceof Bt?new qt(e):void 0===e?qt():qt(e);return""===e&&(Ht[t]=!0),t};ke(Bt,qt);var Vt=Bt.prototype=qt.prototype;Vt.constructor=Bt;var zt=Vt.toString,Wt="Symbol(test)"==String(qt("test")),Kt=/^Symbol\((.*)\)[^)]+$/;Ft(Vt,"description",{configurable:!0,get:function(){var e=g(this)?this.valueOf():this,t=zt.call(e);if(b(Ht,e))return"";var n=Wt?t.slice(7,-1):t.replace(Kt,"$1");return""===n?void 0:n}}),Ie({global:!0,forced:!0},{Symbol:Bt})}Ze("iterator");var $t=function(e,t){var n=[][e];return!!n&&r((function(){n.call(null,t||function(){throw 1},1)}))},Yt=Object.defineProperty,Gt={},Xt=function(e){throw e},Qt=function(e,t){if(b(Gt,e))return Gt[e];t||(t={});var n=[][e],i=!!b(t,"ACCESSORS")&&t.ACCESSORS,o=b(t,0)?t[0]:Xt,s=b(t,1)?t[1]:void 0;return Gt[e]=!!n&&!r((function(){if(i&&!a)return!0;var e={length:-1};i?Yt(e,1,{enumerable:!0,get:Xt}):e[1]=1,n.call(e,o,s)}))},Jt=ct.forEach,Zt=$t("forEach"),en=Qt("forEach"),tn=Zt&&en?[].forEach:function(e){return Jt(this,e,arguments.length>1?arguments[1]:void 0)};Ie({target:"Array",proto:!0,forced:[].forEach!=tn},{forEach:tn});var nn=de.indexOf,rn=[].indexOf,an=!!rn&&1/[1].indexOf(1,-0)<0,on=$t("indexOf"),sn=Qt("indexOf",{ACCESSORS:!0,1:0});Ie({target:"Array",proto:!0,forced:an||!on||!sn},{indexOf:function(e){return an?rn.apply(this,arguments)||0:nn(this,e,arguments.length>1?arguments[1]:void 0)}});var ln=Xe("unscopables"),cn=Array.prototype;null==cn[ln]&&C.f(cn,ln,{configurable:!0,value:Be(null)});var un,hn,fn,dn=function(e){cn[ln][e]=!0},pn={},mn=!r((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),gn=z("IE_PROTO"),vn=Object.prototype,yn=mn?Object.getPrototypeOf:function(e){return e=Re(e),b(e,gn)?e[gn]:"function"==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?vn:null},bn=Xe("iterator"),wn=!1;[].keys&&("next"in(fn=[].keys())?(hn=yn(yn(fn)))!==Object.prototype&&(un=hn):wn=!0),null==un&&(un={}),b(un,bn)||O(un,bn,(function(){return this}));var kn={IteratorPrototype:un,BUGGY_SAFARI_ITERATORS:wn},Tn=kn.IteratorPrototype,Sn=function(){return this},En=function(e,t,n){var i=t+" Iterator";return e.prototype=Be(Tn,{next:c(1,n)}),nt(e,i,!1),pn[i]=Sn,e},An=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,n={};try{(e=Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set).call(n,[]),t=n instanceof Array}catch(e){}return function(n,i){return P(n),function(e){if(!g(e)&&null!==e)throw TypeError("Can't set "+String(e)+" as a prototype")}(i),t?e.call(n,i):n.__proto__=i,n}}():void 0),Pn=kn.IteratorPrototype,xn=kn.BUGGY_SAFARI_ITERATORS,Cn=Xe("iterator"),On=function(){return this},In=function(e,t,n,i,r,a,o){En(n,t,i);var s,l,c,u=function(e){if(e===r&&m)return m;if(!xn&&e in d)return d[e];switch(e){case"keys":case"values":case"entries":return function(){return new n(this,e)}}return function(){return new n(this)}},h=t+" Iterator",f=!1,d=e.prototype,p=d[Cn]||d["@@iterator"]||r&&d[r],m=!xn&&p||u(r),g="Array"==t&&d.entries||p;if(g&&(s=yn(g.call(new e)),Pn!==Object.prototype&&s.next&&(yn(s)!==Pn&&(An?An(s,Pn):"function"!=typeof s[Cn]&&O(s,Cn,On)),nt(s,h,!0))),"values"==r&&p&&"values"!==p.name&&(f=!0,m=function(){return p.call(this)}),d[Cn]!==m&&O(d,Cn,m),pn[t]=m,r)if(l={values:u("values"),keys:a?m:u("keys"),entries:u("entries")},o)for(c in l)(xn||f||!(c in d))&&ee(d,c,l[c]);else Ie({target:t,proto:!0,forced:xn||f},l);return l},Ln=Z.set,jn=Z.getterFor("Array Iterator"),Nn=In(Array,"Array",(function(e,t){Ln(this,{type:"Array Iterator",target:m(e),index:0,kind:t})}),(function(){var e=jn(this),t=e.target,n=e.kind,i=e.index++;return!t||i>=t.length?(e.target=void 0,{value:void 0,done:!0}):"keys"==n?{value:i,done:!1}:"values"==n?{value:t[i],done:!1}:{value:[i,t[i]],done:!1}}),"values");pn.Arguments=pn.Array,dn("keys"),dn("values"),dn("entries");var Rn=[].join,Mn=d!=Object,_n=$t("join",",");Ie({target:"Array",proto:!0,forced:Mn||!_n},{join:function(e){return Rn.call(m(this),void 0===e?",":e)}});var Un,Dn,Fn=function(e,t,n){var i=v(t);i in e?C.f(e,i,c(0,n)):e[i]=n},qn=ie("navigator","userAgent")||"",Hn=i.process,Bn=Hn&&Hn.versions,Vn=Bn&&Bn.v8;Vn?Dn=(Un=Vn.split("."))[0]+Un[1]:qn&&(!(Un=qn.match(/Edge\/(\d+)/))||Un[1]>=74)&&(Un=qn.match(/Chrome\/(\d+)/))&&(Dn=Un[1]);var zn=Dn&&+Dn,Wn=Xe("species"),Kn=function(e){return zn>=51||!r((function(){var t=[];return(t.constructor={})[Wn]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},$n=Kn("slice"),Yn=Qt("slice",{ACCESSORS:!0,0:0,1:2}),Gn=Xe("species"),Xn=[].slice,Qn=Math.max;Ie({target:"Array",proto:!0,forced:!$n||!Yn},{slice:function(e,t){var n,i,r,a=m(this),o=le(a.length),s=he(e,o),l=he(void 0===t?o:t,o);if(Ne(a)&&("function"!=typeof(n=a.constructor)||n!==Array&&!Ne(n.prototype)?g(n)&&null===(n=n[Gn])&&(n=void 0):n=void 0,n===Array||void 0===n))return Xn.call(a,s,l);for(i=new(void 0===n?Array:n)(Qn(l-s,0)),r=0;s<l;s++,r++)s in a&&Fn(i,r,a[s]);return i.length=r,i}});var Jn={};Jn[Xe("toStringTag")]="z";var Zn="[object z]"===String(Jn),ei=Xe("toStringTag"),ti="Arguments"==h(function(){return arguments}()),ni=Zn?h:function(e){var t,n,i;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=function(e,t){try{return e[t]}catch(e){}}(t=Object(e),ei))?n:ti?h(t):"Object"==(i=h(t))&&"function"==typeof t.callee?"Arguments":i},ii=Zn?{}.toString:function(){return"[object "+ni(this)+"]"};Zn||ee(Object.prototype,"toString",ii,{unsafe:!0});var ri=function(){var e=P(this),t="";return e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.sticky&&(t+="y"),t};function ai(e,t){return RegExp(e,t)}var oi={UNSUPPORTED_Y:r((function(){var e=ai("a","y");return e.lastIndex=2,null!=e.exec("abcd")})),BROKEN_CARET:r((function(){var e=ai("^r","gy");return e.lastIndex=2,null!=e.exec("str")}))},si=RegExp.prototype.exec,li=String.prototype.replace,ci=si,ui=function(){var e=/a/,t=/b*/g;return si.call(e,"a"),si.call(t,"a"),0!==e.lastIndex||0!==t.lastIndex}(),hi=oi.UNSUPPORTED_Y||oi.BROKEN_CARET,fi=void 0!==/()??/.exec("")[1];(ui||fi||hi)&&(ci=function(e){var t,n,i,r,a=this,o=hi&&a.sticky,s=ri.call(a),l=a.source,c=0,u=e;return o&&(-1===(s=s.replace("y","")).indexOf("g")&&(s+="g"),u=String(e).slice(a.lastIndex),a.lastIndex>0&&(!a.multiline||a.multiline&&"\n"!==e[a.lastIndex-1])&&(l="(?: "+l+")",u=" "+u,c++),n=new RegExp("^(?:"+l+")",s)),fi&&(n=new RegExp("^"+l+"$(?!\\s)",s)),ui&&(t=a.lastIndex),i=si.call(o?n:a,u),o?i?(i.input=i.input.slice(c),i[0]=i[0].slice(c),i.index=a.lastIndex,a.lastIndex+=i[0].length):a.lastIndex=0:ui&&i&&(a.lastIndex=a.global?i.index+i[0].length:t),fi&&i&&i.length>1&&li.call(i[0],n,(function(){for(r=1;r<arguments.length-2;r++)void 0===arguments[r]&&(i[r]=void 0)})),i});var di=ci;Ie({target:"RegExp",proto:!0,forced:/./.exec!==di},{exec:di});var pi=RegExp.prototype,mi=pi.toString,gi=r((function(){return"/a/b"!=mi.call({source:"a",flags:"b"})})),vi="toString"!=mi.name;(gi||vi)&&ee(RegExp.prototype,"toString",(function(){var e=P(this),t=String(e.source),n=e.flags;return"/"+t+"/"+String(void 0===n&&e instanceof RegExp&&!("flags"in pi)?ri.call(e):n)}),{unsafe:!0});var yi=function(e){return function(t,n){var i,r,a=String(p(t)),o=oe(n),s=a.length;return o<0||o>=s?e?"":void 0:(i=a.charCodeAt(o))<55296||i>56319||o+1===s||(r=a.charCodeAt(o+1))<56320||r>57343?e?a.charAt(o):i:e?a.slice(o,o+2):r-56320+(i-55296<<10)+65536}},bi={codeAt:yi(!1),charAt:yi(!0)},wi=bi.charAt,ki=Z.set,Ti=Z.getterFor("String Iterator");In(String,"String",(function(e){ki(this,{type:"String Iterator",string:String(e),index:0})}),(function(){var e,t=Ti(this),n=t.string,i=t.index;return i>=n.length?{value:void 0,done:!0}:(e=wi(n,i),t.index+=e.length,{value:e,done:!1})}));var Si=Xe("species"),Ei=!r((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$<a>")})),Ai="$0"==="a".replace(/./,"$0"),Pi=Xe("replace"),xi=!!/./[Pi]&&""===/./[Pi]("a","$0"),Ci=!r((function(){var e=/(?:)/,t=e.exec;e.exec=function(){return t.apply(this,arguments)};var n="ab".split(e);return 2!==n.length||"a"!==n[0]||"b"!==n[1]})),Oi=function(e,t,n,i){var a=Xe(e),o=!r((function(){var t={};return t[a]=function(){return 7},7!=""[e](t)})),s=o&&!r((function(){var t=!1,n=/a/;return"split"===e&&((n={}).constructor={},n.constructor[Si]=function(){return n},n.flags="",n[a]=/./[a]),n.exec=function(){return t=!0,null},n[a](""),!t}));if(!o||!s||"replace"===e&&(!Ei||!Ai||xi)||"split"===e&&!Ci){var l=/./[a],c=n(a,""[e],(function(e,t,n,i,r){return t.exec===di?o&&!r?{done:!0,value:l.call(t,n,i)}:{done:!0,value:e.call(n,t,i)}:{done:!1}}),{REPLACE_KEEPS_$0:Ai,REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE:xi}),u=c[0],h=c[1];ee(String.prototype,e,u),ee(RegExp.prototype,a,2==t?function(e,t){return h.call(e,this,t)}:function(e){return h.call(e,this)})}i&&O(RegExp.prototype[a],"sham",!0)},Ii=bi.charAt,Li=function(e,t,n){return t+(n?Ii(e,t).length:1)},ji=function(e,t){var n=e.exec;if("function"==typeof n){var i=n.call(e,t);if("object"!=typeof i)throw TypeError("RegExp exec method returned something other than an Object or null");return i}if("RegExp"!==h(e))throw TypeError("RegExp#exec called on incompatible receiver");return di.call(e,t)},Ni=Math.max,Ri=Math.min,Mi=Math.floor,_i=/\$([$&'`]|\d\d?|<[^>]*>)/g,Ui=/\$([$&'`]|\d\d?)/g;Oi("replace",2,(function(e,t,n,i){var r=i.REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE,a=i.REPLACE_KEEPS_$0,o=r?"$":"$0";return[function(n,i){var r=p(this),a=null==n?void 0:n[e];return void 0!==a?a.call(n,r,i):t.call(String(r),n,i)},function(e,i){if(!r&&a||"string"==typeof i&&-1===i.indexOf(o)){var l=n(t,e,this,i);if(l.done)return l.value}var c=P(e),u=String(this),h="function"==typeof i;h||(i=String(i));var f=c.global;if(f){var d=c.unicode;c.lastIndex=0}for(var p=[];;){var m=ji(c,u);if(null===m)break;if(p.push(m),!f)break;""===String(m[0])&&(c.lastIndex=Li(u,le(c.lastIndex),d))}for(var g,v="",y=0,b=0;b<p.length;b++){m=p[b];for(var w=String(m[0]),k=Ni(Ri(oe(m.index),u.length),0),T=[],S=1;S<m.length;S++)T.push(void 0===(g=m[S])?g:String(g));var E=m.groups;if(h){var A=[w].concat(T,k,u);void 0!==E&&A.push(E);var x=String(i.apply(void 0,A))}else x=s(w,u,k,T,E,i);k>=y&&(v+=u.slice(y,k)+x,y=k+w.length)}return v+u.slice(y)}];function s(e,n,i,r,a,o){var s=i+e.length,l=r.length,c=Ui;return void 0!==a&&(a=Re(a),c=_i),t.call(o,c,(function(t,o){var c;switch(o.charAt(0)){case"$":return"$";case"&":return e;case"`":return n.slice(0,i);case"'":return n.slice(s);case"<":c=a[o.slice(1,-1)];break;default:var u=+o;if(0===u)return t;if(u>l){var h=Mi(u/10);return 0===h?t:h<=l?void 0===r[h-1]?o.charAt(1):r[h-1]+o.charAt(1):t}c=r[u-1]}return void 0===c?"":c}))}}));var Di=Object.is||function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t};Oi("search",1,(function(e,t,n){return[function(t){var n=p(this),i=null==t?void 0:t[e];return void 0!==i?i.call(t,n):new RegExp(t)[e](String(n))},function(e){var i=n(t,e,this);if(i.done)return i.value;var r=P(e),a=String(this),o=r.lastIndex;Di(o,0)||(r.lastIndex=0);var s=ji(r,a);return Di(r.lastIndex,o)||(r.lastIndex=o),null===s?-1:s.index}]}));var Fi=Xe("match"),qi=function(e){var t;return g(e)&&(void 0!==(t=e[Fi])?!!t:"RegExp"==h(e))},Hi=Xe("species"),Bi=function(e,t){var n,i=P(e).constructor;return void 0===i||null==(n=P(i)[Hi])?t:it(n)},Vi=[].push,zi=Math.min,Wi=!r((function(){return!RegExp(4294967295,"y")}));Oi("split",2,(function(e,t,n){var i;return i="c"=="abbc".split(/(b)*/)[1]||4!="test".split(/(?:)/,-1).length||2!="ab".split(/(?:ab)*/).length||4!=".".split(/(.?)(.?)/).length||".".split(/()()/).length>1||"".split(/.?/).length?function(e,n){var i=String(p(this)),r=void 0===n?4294967295:n>>>0;if(0===r)return[];if(void 0===e)return[i];if(!qi(e))return t.call(i,e,r);for(var a,o,s,l=[],c=(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.unicode?"u":"")+(e.sticky?"y":""),u=0,h=new RegExp(e.source,c+"g");(a=di.call(h,i))&&!((o=h.lastIndex)>u&&(l.push(i.slice(u,a.index)),a.length>1&&a.index<i.length&&Vi.apply(l,a.slice(1)),s=a[0].length,u=o,l.length>=r));)h.lastIndex===a.index&&h.lastIndex++;return u===i.length?!s&&h.test("")||l.push(""):l.push(i.slice(u)),l.length>r?l.slice(0,r):l}:"0".split(void 0,0).length?function(e,n){return void 0===e&&0===n?[]:t.call(this,e,n)}:t,[function(t,n){var r=p(this),a=null==t?void 0:t[e];return void 0!==a?a.call(t,r,n):i.call(String(r),t,n)},function(e,r){var a=n(i,e,this,r,i!==t);if(a.done)return a.value;var o=P(e),s=String(this),l=Bi(o,RegExp),c=o.unicode,u=(o.ignoreCase?"i":"")+(o.multiline?"m":"")+(o.unicode?"u":"")+(Wi?"y":"g"),h=new l(Wi?o:"^(?:"+o.source+")",u),f=void 0===r?4294967295:r>>>0;if(0===f)return[];if(0===s.length)return null===ji(h,s)?[s]:[];for(var d=0,p=0,m=[];p<s.length;){h.lastIndex=Wi?p:0;var g,v=ji(h,Wi?s:s.slice(p));if(null===v||(g=zi(le(h.lastIndex+(Wi?0:p)),s.length))===d)p=Li(s,p,c);else{if(m.push(s.slice(d,p)),m.length===f)return m;for(var y=1;y<=v.length-1;y++)if(m.push(v[y]),m.length===f)return m;p=d=g}}return m.push(s.slice(d)),m}]}),!Wi);var Ki={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0};for(var $i in Ki){var Yi=i[$i],Gi=Yi&&Yi.prototype;if(Gi&&Gi.forEach!==tn)try{O(Gi,"forEach",tn)}catch(e){Gi.forEach=tn}}var Xi=Xe("iterator"),Qi=Xe("toStringTag"),Ji=Nn.values;for(var Zi in Ki){var er=i[Zi],tr=er&&er.prototype;if(tr){if(tr[Xi]!==Ji)try{O(tr,Xi,Ji)}catch(e){tr[Xi]=Ji}if(tr[Qi]||O(tr,Qi,Zi),Ki[Zi])for(var nr in Nn)if(tr[nr]!==Nn[nr])try{O(tr,nr,Nn[nr])}catch(e){tr[nr]=Nn[nr]}}}var ir=Xe("iterator"),rr=!r((function(){var e=new URL("b?a=1&b=2&c=3","http://a"),t=e.searchParams,n="";return e.pathname="c%20d",t.forEach((function(e,i){t.delete("b"),n+=i+e})),!t.sort||"http://a/c%20d?a=1&c=3"!==e.href||"3"!==t.get("c")||"a=1"!==String(new URLSearchParams("?a=1"))||!t[ir]||"a"!==new URL("https://a@b").username||"b"!==new URLSearchParams(new URLSearchParams("a=b")).get("a")||"xn--e1aybc"!==new URL("http://тест").host||"#%D0%B1"!==new URL("http://a#б").hash||"a1c3"!==n||"x"!==new URL("http://x",void 0).host})),ar=function(e,t,n){if(!(e instanceof t))throw TypeError("Incorrect "+(n?n+" ":"")+"invocation");return e},or=Object.assign,sr=Object.defineProperty,lr=!or||r((function(){if(a&&1!==or({b:1},or(sr({},"a",{enumerable:!0,get:function(){sr(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var e={},t={},n=Symbol();return e[n]=7,"abcdefghijklmnopqrst".split("").forEach((function(e){t[e]=e})),7!=or({},e)[n]||"abcdefghijklmnopqrst"!=Me(or({},t)).join("")}))?function(e,t){for(var n=Re(e),i=arguments.length,r=1,o=be.f,s=l.f;i>r;)for(var c,u=d(arguments[r++]),h=o?Me(u).concat(o(u)):Me(u),f=h.length,p=0;f>p;)c=h[p++],a&&!s.call(u,c)||(n[c]=u[c]);return n}:or,cr=function(e,t,n,i){try{return i?t(P(n)[0],n[1]):t(n)}catch(t){var r=e.return;throw void 0!==r&&P(r.call(e)),t}},ur=Xe("iterator"),hr=Array.prototype,fr=function(e){return void 0!==e&&(pn.Array===e||hr[ur]===e)},dr=Xe("iterator"),pr=function(e){if(null!=e)return e[dr]||e["@@iterator"]||pn[ni(e)]},mr=function(e){var t,n,i,r,a,o,s=Re(e),l="function"==typeof this?this:Array,c=arguments.length,u=c>1?arguments[1]:void 0,h=void 0!==u,f=pr(s),d=0;if(h&&(u=rt(u,c>2?arguments[2]:void 0,2)),null==f||l==Array&&fr(f))for(n=new l(t=le(s.length));t>d;d++)o=h?u(s[d],d):s[d],Fn(n,d,o);else for(a=(r=f.call(s)).next,n=new l;!(i=a.call(r)).done;d++)o=h?cr(r,u,[i.value,d],!0):i.value,Fn(n,d,o);return n.length=d,n},gr=/[^\0-\u007E]/,vr=/[.\u3002\uFF0E\uFF61]/g,yr="Overflow: input needs wider integers to process",br=Math.floor,wr=String.fromCharCode,kr=function(e){return e+22+75*(e<26)},Tr=function(e,t,n){var i=0;for(e=n?br(e/700):e>>1,e+=br(e/t);e>455;i+=36)e=br(e/35);return br(i+36*e/(e+38))},Sr=function(e){var t,n,i=[],r=(e=function(e){for(var t=[],n=0,i=e.length;n<i;){var r=e.charCodeAt(n++);if(r>=55296&&r<=56319&&n<i){var a=e.charCodeAt(n++);56320==(64512&a)?t.push(((1023&r)<<10)+(1023&a)+65536):(t.push(r),n--)}else t.push(r)}return t}(e)).length,a=128,o=0,s=72;for(t=0;t<e.length;t++)(n=e[t])<128&&i.push(wr(n));var l=i.length,c=l;for(l&&i.push("-");c<r;){var u=2147483647;for(t=0;t<e.length;t++)(n=e[t])>=a&&n<u&&(u=n);var h=c+1;if(u-a>br((2147483647-o)/h))throw RangeError(yr);for(o+=(u-a)*h,a=u,t=0;t<e.length;t++){if((n=e[t])<a&&++o>2147483647)throw RangeError(yr);if(n==a){for(var f=o,d=36;;d+=36){var p=d<=s?1:d>=s+26?26:d-s;if(f<p)break;var m=f-p,g=36-p;i.push(wr(kr(p+m%g))),f=br(m/g)}i.push(wr(kr(f))),s=Tr(o,h,c==l),o=0,++c}}++o,++a}return i.join("")},Er=function(e,t,n){for(var i in t)ee(e,i,t[i],n);return e},Ar=function(e){var t=pr(e);if("function"!=typeof t)throw TypeError(String(e)+" is not iterable");return P(t.call(e))},Pr=ie("fetch"),xr=ie("Headers"),Cr=Xe("iterator"),Or=Z.set,Ir=Z.getterFor("URLSearchParams"),Lr=Z.getterFor("URLSearchParamsIterator"),jr=/\+/g,Nr=Array(4),Rr=function(e){return Nr[e-1]||(Nr[e-1]=RegExp("((?:%[\\da-f]{2}){"+e+"})","gi"))},Mr=function(e){try{return decodeURIComponent(e)}catch(t){return e}},_r=function(e){var t=e.replace(jr," "),n=4;try{return decodeURIComponent(t)}catch(e){for(;n;)t=t.replace(Rr(n--),Mr);return t}},Ur=/[!'()~]|%20/g,Dr={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},Fr=function(e){return Dr[e]},qr=function(e){return encodeURIComponent(e).replace(Ur,Fr)},Hr=function(e,t){if(t)for(var n,i,r=t.split("&"),a=0;a<r.length;)(n=r[a++]).length&&(i=n.split("="),e.push({key:_r(i.shift()),value:_r(i.join("="))}))},Br=function(e){this.entries.length=0,Hr(this.entries,e)},Vr=function(e,t){if(e<t)throw TypeError("Not enough arguments")},zr=En((function(e,t){Or(this,{type:"URLSearchParamsIterator",iterator:Ar(Ir(e).entries),kind:t})}),"Iterator",(function(){var e=Lr(this),t=e.kind,n=e.iterator.next(),i=n.value;return n.done||(n.value="keys"===t?i.key:"values"===t?i.value:[i.key,i.value]),n})),Wr=function(){ar(this,Wr,"URLSearchParams");var e,t,n,i,r,a,o,s,l,c=arguments.length>0?arguments[0]:void 0,u=this,h=[];if(Or(u,{type:"URLSearchParams",entries:h,updateURL:function(){},updateSearchParams:Br}),void 0!==c)if(g(c))if("function"==typeof(e=pr(c)))for(n=(t=e.call(c)).next;!(i=n.call(t)).done;){if((o=(a=(r=Ar(P(i.value))).next).call(r)).done||(s=a.call(r)).done||!a.call(r).done)throw TypeError("Expected sequence with length 2");h.push({key:o.value+"",value:s.value+""})}else for(l in c)b(c,l)&&h.push({key:l,value:c[l]+""});else Hr(h,"string"==typeof c?"?"===c.charAt(0)?c.slice(1):c:c+"")},Kr=Wr.prototype;Er(Kr,{append:function(e,t){Vr(arguments.length,2);var n=Ir(this);n.entries.push({key:e+"",value:t+""}),n.updateURL()},delete:function(e){Vr(arguments.length,1);for(var t=Ir(this),n=t.entries,i=e+"",r=0;r<n.length;)n[r].key===i?n.splice(r,1):r++;t.updateURL()},get:function(e){Vr(arguments.length,1);for(var t=Ir(this).entries,n=e+"",i=0;i<t.length;i++)if(t[i].key===n)return t[i].value;return null},getAll:function(e){Vr(arguments.length,1);for(var t=Ir(this).entries,n=e+"",i=[],r=0;r<t.length;r++)t[r].key===n&&i.push(t[r].value);return i},has:function(e){Vr(arguments.length,1);for(var t=Ir(this).entries,n=e+"",i=0;i<t.length;)if(t[i++].key===n)return!0;return!1},set:function(e,t){Vr(arguments.length,1);for(var n,i=Ir(this),r=i.entries,a=!1,o=e+"",s=t+"",l=0;l<r.length;l++)(n=r[l]).key===o&&(a?r.splice(l--,1):(a=!0,n.value=s));a||r.push({key:o,value:s}),i.updateURL()},sort:function(){var e,t,n,i=Ir(this),r=i.entries,a=r.slice();for(r.length=0,n=0;n<a.length;n++){for(e=a[n],t=0;t<n;t++)if(r[t].key>e.key){r.splice(t,0,e);break}t===n&&r.push(e)}i.updateURL()},forEach:function(e){for(var t,n=Ir(this).entries,i=rt(e,arguments.length>1?arguments[1]:void 0,3),r=0;r<n.length;)i((t=n[r++]).value,t.key,this)},keys:function(){return new zr(this,"keys")},values:function(){return new zr(this,"values")},entries:function(){return new zr(this,"entries")}},{enumerable:!0}),ee(Kr,Cr,Kr.entries),ee(Kr,"toString",(function(){for(var e,t=Ir(this).entries,n=[],i=0;i<t.length;)e=t[i++],n.push(qr(e.key)+"="+qr(e.value));return n.join("&")}),{enumerable:!0}),nt(Wr,"URLSearchParams"),Ie({global:!0,forced:!rr},{URLSearchParams:Wr}),rr||"function"!=typeof Pr||"function"!=typeof xr||Ie({global:!0,enumerable:!0,forced:!0},{fetch:function(e){var t,n,i,r=[e];return arguments.length>1&&(g(t=arguments[1])&&(n=t.body,"URLSearchParams"===ni(n)&&((i=t.headers?new xr(t.headers):new xr).has("content-type")||i.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"),t=Be(t,{body:c(0,String(n)),headers:c(0,i)}))),r.push(t)),Pr.apply(this,r)}});var $r,Yr={URLSearchParams:Wr,getState:Ir},Gr=bi.codeAt,Xr=i.URL,Qr=Yr.URLSearchParams,Jr=Yr.getState,Zr=Z.set,ea=Z.getterFor("URL"),ta=Math.floor,na=Math.pow,ia=/[A-Za-z]/,ra=/[\d+-.A-Za-z]/,aa=/\d/,oa=/^(0x|0X)/,sa=/^[0-7]+$/,la=/^\d+$/,ca=/^[\dA-Fa-f]+$/,ua=/[\u0000\u0009\u000A\u000D #%/:?@[\\]]/,ha=/[\u0000\u0009\u000A\u000D #/:?@[\\]]/,fa=/^[\u0000-\u001F ]+|[\u0000-\u001F ]+$/g,da=/[\u0009\u000A\u000D]/g,pa=function(e,t){var n,i,r;if("["==t.charAt(0)){if("]"!=t.charAt(t.length-1))return"Invalid host";if(!(n=ga(t.slice(1,-1))))return"Invalid host";e.host=n}else if(Ea(e)){if(t=function(e){var t,n,i=[],r=e.toLowerCase().replace(vr,".").split(".");for(t=0;t<r.length;t++)n=r[t],i.push(gr.test(n)?"xn--"+Sr(n):n);return i.join(".")}(t),ua.test(t))return"Invalid host";if(null===(n=ma(t)))return"Invalid host";e.host=n}else{if(ha.test(t))return"Invalid host";for(n="",i=mr(t),r=0;r<i.length;r++)n+=Ta(i[r],ya);e.host=n}},ma=function(e){var t,n,i,r,a,o,s,l=e.split(".");if(l.length&&""==l[l.length-1]&&l.pop(),(t=l.length)>4)return e;for(n=[],i=0;i<t;i++){if(""==(r=l[i]))return e;if(a=10,r.length>1&&"0"==r.charAt(0)&&(a=oa.test(r)?16:8,r=r.slice(8==a?1:2)),""===r)o=0;else{if(!(10==a?la:8==a?sa:ca).test(r))return e;o=parseInt(r,a)}n.push(o)}for(i=0;i<t;i++)if(o=n[i],i==t-1){if(o>=na(256,5-t))return null}else if(o>255)return null;for(s=n.pop(),i=0;i<n.length;i++)s+=n[i]*na(256,3-i);return s},ga=function(e){var t,n,i,r,a,o,s,l=[0,0,0,0,0,0,0,0],c=0,u=null,h=0,f=function(){return e.charAt(h)};if(":"==f()){if(":"!=e.charAt(1))return;h+=2,u=++c}for(;f();){if(8==c)return;if(":"!=f()){for(t=n=0;n<4&&ca.test(f());)t=16*t+parseInt(f(),16),h++,n++;if("."==f()){if(0==n)return;if(h-=n,c>6)return;for(i=0;f();){if(r=null,i>0){if(!("."==f()&&i<4))return;h++}if(!aa.test(f()))return;for(;aa.test(f());){if(a=parseInt(f(),10),null===r)r=a;else{if(0==r)return;r=10*r+a}if(r>255)return;h++}l[c]=256*l[c]+r,2!=++i&&4!=i||c++}if(4!=i)return;break}if(":"==f()){if(h++,!f())return}else if(f())return;l[c++]=t}else{if(null!==u)return;h++,u=++c}}if(null!==u)for(o=c-u,c=7;0!=c&&o>0;)s=l[c],l[c--]=l[u+o-1],l[u+--o]=s;else if(8!=c)return;return l},va=function(e){var t,n,i,r;if("number"==typeof e){for(t=[],n=0;n<4;n++)t.unshift(e%256),e=ta(e/256);return t.join(".")}if("object"==typeof e){for(t="",i=function(e){for(var t=null,n=1,i=null,r=0,a=0;a<8;a++)0!==e[a]?(r>n&&(t=i,n=r),i=null,r=0):(null===i&&(i=a),++r);return r>n&&(t=i,n=r),t}(e),n=0;n<8;n++)r&&0===e[n]||(r&&(r=!1),i===n?(t+=n?":":"::",r=!0):(t+=e[n].toString(16),n<7&&(t+=":")));return"["+t+"]"}return e},ya={},ba=lr({},ya,{" ":1,'"':1,"<":1,">":1,"`":1}),wa=lr({},ba,{"#":1,"?":1,"{":1,"}":1}),ka=lr({},wa,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),Ta=function(e,t){var n=Gr(e,0);return n>32&&n<127&&!b(t,e)?e:encodeURIComponent(e)},Sa={ftp:21,file:null,http:80,https:443,ws:80,wss:443},Ea=function(e){return b(Sa,e.scheme)},Aa=function(e){return""!=e.username||""!=e.password},Pa=function(e){return!e.host||e.cannotBeABaseURL||"file"==e.scheme},xa=function(e,t){var n;return 2==e.length&&ia.test(e.charAt(0))&&(":"==(n=e.charAt(1))||!t&&"|"==n)},Ca=function(e){var t;return e.length>1&&xa(e.slice(0,2))&&(2==e.length||"/"===(t=e.charAt(2))||"\\"===t||"?"===t||"#"===t)},Oa=function(e){var t=e.path,n=t.length;!n||"file"==e.scheme&&1==n&&xa(t[0],!0)||t.pop()},Ia=function(e){return"."===e||"%2e"===e.toLowerCase()},La={},ja={},Na={},Ra={},Ma={},_a={},Ua={},Da={},Fa={},qa={},Ha={},Ba={},Va={},za={},Wa={},Ka={},$a={},Ya={},Ga={},Xa={},Qa={},Ja=function(e,t,n,i){var r,a,o,s,l,c=n||La,u=0,h="",f=!1,d=!1,p=!1;for(n||(e.scheme="",e.username="",e.password="",e.host=null,e.port=null,e.path=[],e.query=null,e.fragment=null,e.cannotBeABaseURL=!1,t=t.replace(fa,"")),t=t.replace(da,""),r=mr(t);u<=r.length;){switch(a=r[u],c){case La:if(!a||!ia.test(a)){if(n)return"Invalid scheme";c=Na;continue}h+=a.toLowerCase(),c=ja;break;case ja:if(a&&(ra.test(a)||"+"==a||"-"==a||"."==a))h+=a.toLowerCase();else{if(":"!=a){if(n)return"Invalid scheme";h="",c=Na,u=0;continue}if(n&&(Ea(e)!=b(Sa,h)||"file"==h&&(Aa(e)||null!==e.port)||"file"==e.scheme&&!e.host))return;if(e.scheme=h,n)return void(Ea(e)&&Sa[e.scheme]==e.port&&(e.port=null));h="","file"==e.scheme?c=za:Ea(e)&&i&&i.scheme==e.scheme?c=Ra:Ea(e)?c=Da:"/"==r[u+1]?(c=Ma,u++):(e.cannotBeABaseURL=!0,e.path.push(""),c=Ga)}break;case Na:if(!i||i.cannotBeABaseURL&&"#"!=a)return"Invalid scheme";if(i.cannotBeABaseURL&&"#"==a){e.scheme=i.scheme,e.path=i.path.slice(),e.query=i.query,e.fragment="",e.cannotBeABaseURL=!0,c=Qa;break}c="file"==i.scheme?za:_a;continue;case Ra:if("/"!=a||"/"!=r[u+1]){c=_a;continue}c=Fa,u++;break;case Ma:if("/"==a){c=qa;break}c=Ya;continue;case _a:if(e.scheme=i.scheme,a==$r)e.username=i.username,e.password=i.password,e.host=i.host,e.port=i.port,e.path=i.path.slice(),e.query=i.query;else if("/"==a||"\\"==a&&Ea(e))c=Ua;else if("?"==a)e.username=i.username,e.password=i.password,e.host=i.host,e.port=i.port,e.path=i.path.slice(),e.query="",c=Xa;else{if("#"!=a){e.username=i.username,e.password=i.password,e.host=i.host,e.port=i.port,e.path=i.path.slice(),e.path.pop(),c=Ya;continue}e.username=i.username,e.password=i.password,e.host=i.host,e.port=i.port,e.path=i.path.slice(),e.query=i.query,e.fragment="",c=Qa}break;case Ua:if(!Ea(e)||"/"!=a&&"\\"!=a){if("/"!=a){e.username=i.username,e.password=i.password,e.host=i.host,e.port=i.port,c=Ya;continue}c=qa}else c=Fa;break;case Da:if(c=Fa,"/"!=a||"/"!=h.charAt(u+1))continue;u++;break;case Fa:if("/"!=a&&"\\"!=a){c=qa;continue}break;case qa:if("@"==a){f&&(h="%40"+h),f=!0,o=mr(h);for(var m=0;m<o.length;m++){var g=o[m];if(":"!=g||p){var v=Ta(g,ka);p?e.password+=v:e.username+=v}else p=!0}h=""}else if(a==$r||"/"==a||"?"==a||"#"==a||"\\"==a&&Ea(e)){if(f&&""==h)return"Invalid authority";u-=mr(h).length+1,h="",c=Ha}else h+=a;break;case Ha:case Ba:if(n&&"file"==e.scheme){c=Ka;continue}if(":"!=a||d){if(a==$r||"/"==a||"?"==a||"#"==a||"\\"==a&&Ea(e)){if(Ea(e)&&""==h)return"Invalid host";if(n&&""==h&&(Aa(e)||null!==e.port))return;if(s=pa(e,h))return s;if(h="",c=$a,n)return;continue}"["==a?d=!0:"]"==a&&(d=!1),h+=a}else{if(""==h)return"Invalid host";if(s=pa(e,h))return s;if(h="",c=Va,n==Ba)return}break;case Va:if(!aa.test(a)){if(a==$r||"/"==a||"?"==a||"#"==a||"\\"==a&&Ea(e)||n){if(""!=h){var y=parseInt(h,10);if(y>65535)return"Invalid port";e.port=Ea(e)&&y===Sa[e.scheme]?null:y,h=""}if(n)return;c=$a;continue}return"Invalid port"}h+=a;break;case za:if(e.scheme="file","/"==a||"\\"==a)c=Wa;else{if(!i||"file"!=i.scheme){c=Ya;continue}if(a==$r)e.host=i.host,e.path=i.path.slice(),e.query=i.query;else if("?"==a)e.host=i.host,e.path=i.path.slice(),e.query="",c=Xa;else{if("#"!=a){Ca(r.slice(u).join(""))||(e.host=i.host,e.path=i.path.slice(),Oa(e)),c=Ya;continue}e.host=i.host,e.path=i.path.slice(),e.query=i.query,e.fragment="",c=Qa}}break;case Wa:if("/"==a||"\\"==a){c=Ka;break}i&&"file"==i.scheme&&!Ca(r.slice(u).join(""))&&(xa(i.path[0],!0)?e.path.push(i.path[0]):e.host=i.host),c=Ya;continue;case Ka:if(a==$r||"/"==a||"\\"==a||"?"==a||"#"==a){if(!n&&xa(h))c=Ya;else if(""==h){if(e.host="",n)return;c=$a}else{if(s=pa(e,h))return s;if("localhost"==e.host&&(e.host=""),n)return;h="",c=$a}continue}h+=a;break;case $a:if(Ea(e)){if(c=Ya,"/"!=a&&"\\"!=a)continue}else if(n||"?"!=a)if(n||"#"!=a){if(a!=$r&&(c=Ya,"/"!=a))continue}else e.fragment="",c=Qa;else e.query="",c=Xa;break;case Ya:if(a==$r||"/"==a||"\\"==a&&Ea(e)||!n&&("?"==a||"#"==a)){if(".."===(l=(l=h).toLowerCase())||"%2e."===l||".%2e"===l||"%2e%2e"===l?(Oa(e),"/"==a||"\\"==a&&Ea(e)||e.path.push("")):Ia(h)?"/"==a||"\\"==a&&Ea(e)||e.path.push(""):("file"==e.scheme&&!e.path.length&&xa(h)&&(e.host&&(e.host=""),h=h.charAt(0)+":"),e.path.push(h)),h="","file"==e.scheme&&(a==$r||"?"==a||"#"==a))for(;e.path.length>1&&""===e.path[0];)e.path.shift();"?"==a?(e.query="",c=Xa):"#"==a&&(e.fragment="",c=Qa)}else h+=Ta(a,wa);break;case Ga:"?"==a?(e.query="",c=Xa):"#"==a?(e.fragment="",c=Qa):a!=$r&&(e.path[0]+=Ta(a,ya));break;case Xa:n||"#"!=a?a!=$r&&("'"==a&&Ea(e)?e.query+="%27":e.query+="#"==a?"%23":Ta(a,ya)):(e.fragment="",c=Qa);break;case Qa:a!=$r&&(e.fragment+=Ta(a,ba))}u++}},Za=function(e){var t,n,i=ar(this,Za,"URL"),r=arguments.length>1?arguments[1]:void 0,o=String(e),s=Zr(i,{type:"URL"});if(void 0!==r)if(r instanceof Za)t=ea(r);else if(n=Ja(t={},String(r)))throw TypeError(n);if(n=Ja(s,o,null,t))throw TypeError(n);var l=s.searchParams=new Qr,c=Jr(l);c.updateSearchParams(s.query),c.updateURL=function(){s.query=String(l)||null},a||(i.href=to.call(i),i.origin=no.call(i),i.protocol=io.call(i),i.username=ro.call(i),i.password=ao.call(i),i.host=oo.call(i),i.hostname=so.call(i),i.port=lo.call(i),i.pathname=co.call(i),i.search=uo.call(i),i.searchParams=ho.call(i),i.hash=fo.call(i))},eo=Za.prototype,to=function(){var e=ea(this),t=e.scheme,n=e.username,i=e.password,r=e.host,a=e.port,o=e.path,s=e.query,l=e.fragment,c=t+":";return null!==r?(c+="//",Aa(e)&&(c+=n+(i?":"+i:"")+"@"),c+=va(r),null!==a&&(c+=":"+a)):"file"==t&&(c+="//"),c+=e.cannotBeABaseURL?o[0]:o.length?"/"+o.join("/"):"",null!==s&&(c+="?"+s),null!==l&&(c+="#"+l),c},no=function(){var e=ea(this),t=e.scheme,n=e.port;if("blob"==t)try{return new URL(t.path[0]).origin}catch(e){return"null"}return"file"!=t&&Ea(e)?t+"://"+va(e.host)+(null!==n?":"+n:""):"null"},io=function(){return ea(this).scheme+":"},ro=function(){return ea(this).username},ao=function(){return ea(this).password},oo=function(){var e=ea(this),t=e.host,n=e.port;return null===t?"":null===n?va(t):va(t)+":"+n},so=function(){var e=ea(this).host;return null===e?"":va(e)},lo=function(){var e=ea(this).port;return null===e?"":String(e)},co=function(){var e=ea(this),t=e.path;return e.cannotBeABaseURL?t[0]:t.length?"/"+t.join("/"):""},uo=function(){var e=ea(this).query;return e?"?"+e:""},ho=function(){return ea(this).searchParams},fo=function(){var e=ea(this).fragment;return e?"#"+e:""},po=function(e,t){return{get:e,set:t,configurable:!0,enumerable:!0}};if(a&&_e(eo,{href:po(to,(function(e){var t=ea(this),n=String(e),i=Ja(t,n);if(i)throw TypeError(i);Jr(t.searchParams).updateSearchParams(t.query)})),origin:po(no),protocol:po(io,(function(e){var t=ea(this);Ja(t,String(e)+":",La)})),username:po(ro,(function(e){var t=ea(this),n=mr(String(e));if(!Pa(t)){t.username="";for(var i=0;i<n.length;i++)t.username+=Ta(n[i],ka)}})),password:po(ao,(function(e){var t=ea(this),n=mr(String(e));if(!Pa(t)){t.password="";for(var i=0;i<n.length;i++)t.password+=Ta(n[i],ka)}})),host:po(oo,(function(e){var t=ea(this);t.cannotBeABaseURL||Ja(t,String(e),Ha)})),hostname:po(so,(function(e){var t=ea(this);t.cannotBeABaseURL||Ja(t,String(e),Ba)})),port:po(lo,(function(e){var t=ea(this);Pa(t)||(""==(e=String(e))?t.port=null:Ja(t,e,Va))})),pathname:po(co,(function(e){var t=ea(this);t.cannotBeABaseURL||(t.path=[],Ja(t,e+"",$a))})),search:po(uo,(function(e){var t=ea(this);""==(e=String(e))?t.query=null:("?"==e.charAt(0)&&(e=e.slice(1)),t.query="",Ja(t,e,Xa)),Jr(t.searchParams).updateSearchParams(t.query)})),searchParams:po(ho),hash:po(fo,(function(e){var t=ea(this);""!=(e=String(e))?("#"==e.charAt(0)&&(e=e.slice(1)),t.fragment="",Ja(t,e,Qa)):t.fragment=null}))}),ee(eo,"toJSON",(function(){return to.call(this)}),{enumerable:!0}),ee(eo,"toString",(function(){return to.call(this)}),{enumerable:!0}),Xr){var mo=Xr.createObjectURL,go=Xr.revokeObjectURL;mo&&ee(Za,"createObjectURL",(function(e){return mo.apply(Xr,arguments)})),go&&ee(Za,"revokeObjectURL",(function(e){return go.apply(Xr,arguments)}))}function vo(e){return(vo="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function yo(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function bo(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function wo(e,t,n){return t&&bo(e.prototype,t),n&&bo(e,n),e}function ko(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function To(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function So(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?To(Object(n),!0).forEach((function(t){ko(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):To(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Eo(e,t){if(null==e)return{};var n,i,r=function(e,t){if(null==e)return{};var n,i,r={},a=Object.keys(e);for(i=0;i<a.length;i++)n=a[i],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)n=a[i],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Ao(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],i=!0,r=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(i=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);i=!0);}catch(e){r=!0,a=e}finally{try{i||null==s.return||s.return()}finally{if(r)throw a}}return n}(e,t)||xo(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Po(e){return function(e){if(Array.isArray(e))return Co(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||xo(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function xo(e,t){if(e){if("string"==typeof e)return Co(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Co(e,t):void 0}}function Co(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}nt(Za,"URL"),Ie({global:!0,forced:!rr,sham:!a},{URL:Za}),function(e){var t=function(){try{return!!Symbol.iterator}catch(e){return!1}}(),n=function(e){var n={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return t&&(n[Symbol.iterator]=function(){return n}),n},i=function(e){return encodeURIComponent(e).replace(/%20/g,"+")},r=function(e){return decodeURIComponent(String(e).replace(/\+/g," "))};(function(){try{var t=e.URLSearchParams;return"a=1"===new t("?a=1").toString()&&"function"==typeof t.prototype.set}catch(e){return!1}})()||function(){var r=function e(t){Object.defineProperty(this,"_entries",{writable:!0,value:{}});var n=vo(t);if("undefined"===n);else if("string"===n)""!==t&&this._fromString(t);else if(t instanceof e){var i=this;t.forEach((function(e,t){i.append(t,e)}))}else{if(null===t||"object"!==n)throw new TypeError("Unsupported input's type for URLSearchParams");if("[object Array]"===Object.prototype.toString.call(t))for(var r=0;r<t.length;r++){var a=t[r];if("[object Array]"!==Object.prototype.toString.call(a)&&2===a.length)throw new TypeError("Expected [string, any] as entry at index "+r+" of URLSearchParams's input");this.append(a[0],a[1])}else for(var o in t)t.hasOwnProperty(o)&&this.append(o,t[o])}},a=r.prototype;a.append=function(e,t){e in this._entries?this._entries[e].push(String(t)):this._entries[e]=[String(t)]},a.delete=function(e){delete this._entries[e]},a.get=function(e){return e in this._entries?this._entries[e][0]:null},a.getAll=function(e){return e in this._entries?this._entries[e].slice(0):[]},a.has=function(e){return e in this._entries},a.set=function(e,t){this._entries[e]=[String(t)]},a.forEach=function(e,t){var n;for(var i in this._entries)if(this._entries.hasOwnProperty(i)){n=this._entries[i];for(var r=0;r<n.length;r++)e.call(t,n[r],i,this)}},a.keys=function(){var e=[];return this.forEach((function(t,n){e.push(n)})),n(e)},a.values=function(){var e=[];return this.forEach((function(t){e.push(t)})),n(e)},a.entries=function(){var e=[];return this.forEach((function(t,n){e.push([n,t])})),n(e)},t&&(a[Symbol.iterator]=a.entries),a.toString=function(){var e=[];return this.forEach((function(t,n){e.push(i(n)+"="+i(t))})),e.join("&")},e.URLSearchParams=r}();var a=e.URLSearchParams.prototype;"function"!=typeof a.sort&&(a.sort=function(){var e=this,t=[];this.forEach((function(n,i){t.push([i,n]),e._entries||e.delete(i)})),t.sort((function(e,t){return e[0]<t[0]?-1:e[0]>t[0]?1:0})),e._entries&&(e._entries={});for(var n=0;n<t.length;n++)this.append(t[n][0],t[n][1])}),"function"!=typeof a._fromString&&Object.defineProperty(a,"_fromString",{enumerable:!1,configurable:!1,writable:!1,value:function(e){if(this._entries)this._entries={};else{var t=[];this.forEach((function(e,n){t.push(n)}));for(var n=0;n<t.length;n++)this.delete(t[n])}var i,a=(e=e.replace(/^\?/,"")).split("&");for(n=0;n<a.length;n++)i=a[n].split("="),this.append(r(i[0]),i.length>1?r(i[1]):"")}})}(void 0!==e?e:"undefined"!=typeof window?window:"undefined"!=typeof self?self:e),function(e){if(function(){try{var t=new e.URL("b","http://a");return t.pathname="c d","http://a/c%20d"===t.href&&t.searchParams}catch(e){return!1}}()||function(){var t=e.URL,n=function(t,n){"string"!=typeof t&&(t=String(t));var i,r=document;if(n&&(void 0===e.location||n!==e.location.href)){(i=(r=document.implementation.createHTMLDocument("")).createElement("base")).href=n,r.head.appendChild(i);try{if(0!==i.href.indexOf(n))throw new Error(i.href)}catch(e){throw new Error("URL unable to set base "+n+" due to "+e)}}var a=r.createElement("a");a.href=t,i&&(r.body.appendChild(a),a.href=a.href);var o=r.createElement("input");if(o.type="url",o.value=t,":"===a.protocol||!/:/.test(a.href)||!o.checkValidity()&&!n)throw new TypeError("Invalid URL");Object.defineProperty(this,"_anchorElement",{value:a});var s=new e.URLSearchParams(this.search),l=!0,c=!0,u=this;["append","delete","set"].forEach((function(e){var t=s[e];s[e]=function(){t.apply(s,arguments),l&&(c=!1,u.search=s.toString(),c=!0)}})),Object.defineProperty(this,"searchParams",{value:s,enumerable:!0});var h=void 0;Object.defineProperty(this,"_updateSearchParams",{enumerable:!1,configurable:!1,writable:!1,value:function(){this.search!==h&&(h=this.search,c&&(l=!1,this.searchParams._fromString(this.search),l=!0))}})},i=n.prototype;["hash","host","hostname","port","protocol"].forEach((function(e){!function(e){Object.defineProperty(i,e,{get:function(){return this._anchorElement[e]},set:function(t){this._anchorElement[e]=t},enumerable:!0})}(e)})),Object.defineProperty(i,"search",{get:function(){return this._anchorElement.search},set:function(e){this._anchorElement.search=e,this._updateSearchParams()},enumerable:!0}),Object.defineProperties(i,{toString:{get:function(){var e=this;return function(){return e.href}}},href:{get:function(){return this._anchorElement.href.replace(/\?$/,"")},set:function(e){this._anchorElement.href=e,this._updateSearchParams()},enumerable:!0},pathname:{get:function(){return this._anchorElement.pathname.replace(/(^\/?)/,"/")},set:function(e){this._anchorElement.pathname=e},enumerable:!0},origin:{get:function(){var e={"http:":80,"https:":443,"ftp:":21}[this._anchorElement.protocol],t=this._anchorElement.port!=e&&""!==this._anchorElement.port;return this._anchorElement.protocol+"//"+this._anchorElement.hostname+(t?":"+this._anchorElement.port:"")},enumerable:!0},password:{get:function(){return""},set:function(e){},enumerable:!0},username:{get:function(){return""},set:function(e){},enumerable:!0}}),n.createObjectURL=function(e){return t.createObjectURL.apply(t,arguments)},n.revokeObjectURL=function(e){return t.revokeObjectURL.apply(t,arguments)},e.URL=n}(),void 0!==e.location&&!("origin"in e.location)){var t=function(){return e.location.protocol+"//"+e.location.hostname+(e.location.port?":"+e.location.port:"")};try{Object.defineProperty(e.location,"origin",{get:t,enumerable:!0})}catch(n){setInterval((function(){e.location.origin=t()}),100)}}}(void 0!==e?e:"undefined"!=typeof window?window:"undefined"!=typeof self?self:e);var Oo=Xe("isConcatSpreadable"),Io=zn>=51||!r((function(){var e=[];return e[Oo]=!1,e.concat()[0]!==e})),Lo=Kn("concat"),jo=function(e){if(!g(e))return!1;var t=e[Oo];return void 0!==t?!!t:Ne(e)};Ie({target:"Array",proto:!0,forced:!Io||!Lo},{concat:function(e){var t,n,i,r,a,o=Re(this),s=ot(o,0),l=0;for(t=-1,i=arguments.length;t<i;t++)if(jo(a=-1===t?o:arguments[t])){if(l+(r=le(a.length))>9007199254740991)throw TypeError("Maximum allowed index exceeded");for(n=0;n<r;n++,l++)n in a&&Fn(s,l,a[n])}else{if(l>=9007199254740991)throw TypeError("Maximum allowed index exceeded");Fn(s,l++,a)}return s.length=l,s}});var No=ct.filter,Ro=Kn("filter"),Mo=Qt("filter");Ie({target:"Array",proto:!0,forced:!Ro||!Mo},{filter:function(e){return No(this,e,arguments.length>1?arguments[1]:void 0)}});var _o=ct.find,Uo=!0,Do=Qt("find");"find"in[]&&Array(1).find((function(){Uo=!1})),Ie({target:"Array",proto:!0,forced:Uo||!Do},{find:function(e){return _o(this,e,arguments.length>1?arguments[1]:void 0)}}),dn("find");var Fo=Xe("iterator"),qo=!1;try{var Ho=0,Bo={next:function(){return{done:!!Ho++}},return:function(){qo=!0}};Bo[Fo]=function(){return this},Array.from(Bo,(function(){throw 2}))}catch(e){}var Vo=function(e,t){if(!t&&!qo)return!1;var n=!1;try{var i={};i[Fo]=function(){return{next:function(){return{done:n=!0}}}},e(i)}catch(e){}return n},zo=!Vo((function(e){Array.from(e)}));Ie({target:"Array",stat:!0,forced:zo},{from:mr});var Wo=de.includes,Ko=Qt("indexOf",{ACCESSORS:!0,1:0});Ie({target:"Array",proto:!0,forced:!Ko},{includes:function(e){return Wo(this,e,arguments.length>1?arguments[1]:void 0)}}),dn("includes");var $o=ct.map,Yo=Kn("map"),Go=Qt("map");Ie({target:"Array",proto:!0,forced:!Yo||!Go},{map:function(e){return $o(this,e,arguments.length>1?arguments[1]:void 0)}});var Xo=function(e,t,n){var i,r;return An&&"function"==typeof(i=t.constructor)&&i!==n&&g(r=i.prototype)&&r!==n.prototype&&An(e,r),e},Qo="\t\n\v\f\r                 \u2028\u2029\ufeff",Jo="["+Qo+"]",Zo=RegExp("^"+Jo+Jo+"*"),es=RegExp(Jo+Jo+"*$"),ts=function(e){return function(t){var n=String(p(t));return 1&e&&(n=n.replace(Zo,"")),2&e&&(n=n.replace(es,"")),n}},ns={start:ts(1),end:ts(2),trim:ts(3)},is=ye.f,rs=A.f,as=C.f,os=ns.trim,ss=i.Number,ls=ss.prototype,cs="Number"==h(Be(ls)),us=function(e){var t,n,i,r,a,o,s,l,c=v(e,!1);if("string"==typeof c&&c.length>2)if(43===(t=(c=os(c)).charCodeAt(0))||45===t){if(88===(n=c.charCodeAt(2))||120===n)return NaN}else if(48===t){switch(c.charCodeAt(1)){case 66:case 98:i=2,r=49;break;case 79:case 111:i=8,r=55;break;default:return+c}for(o=(a=c.slice(2)).length,s=0;s<o;s++)if((l=a.charCodeAt(s))<48||l>r)return NaN;return parseInt(a,i)}return+c};if(Ce("Number",!ss(" 0o1")||!ss("0b1")||ss("+0x1"))){for(var hs,fs=function(e){var t=arguments.length<1?0:e,n=this;return n instanceof fs&&(cs?r((function(){ls.valueOf.call(n)})):"Number"!=h(n))?Xo(new ss(us(t)),n,fs):us(t)},ds=a?is(ss):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger".split(","),ps=0;ds.length>ps;ps++)b(ss,hs=ds[ps])&&!b(fs,hs)&&as(fs,hs,rs(ss,hs));fs.prototype=ls,ls.constructor=fs,ee(i,"Number",fs)}var ms=r((function(){Me(1)}));Ie({target:"Object",stat:!0,forced:ms},{keys:function(e){return Me(Re(e))}});var gs=function(e){if(qi(e))throw TypeError("The method doesn't accept regular expressions");return e},vs=Xe("match"),ys=function(e){var t=/./;try{"/./"[e](t)}catch(n){try{return t[vs]=!1,"/./"[e](t)}catch(e){}}return!1};Ie({target:"String",proto:!0,forced:!ys("includes")},{includes:function(e){return!!~String(p(this)).indexOf(gs(e),arguments.length>1?arguments[1]:void 0)}});var bs=!r((function(){return Object.isExtensible(Object.preventExtensions({}))})),ws=t((function(e){var t=C.f,n=B("meta"),i=0,r=Object.isExtensible||function(){return!0},a=function(e){t(e,n,{value:{objectID:"O"+ ++i,weakData:{}}})},o=e.exports={REQUIRED:!1,fastKey:function(e,t){if(!g(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!b(e,n)){if(!r(e))return"F";if(!t)return"E";a(e)}return e[n].objectID},getWeakData:function(e,t){if(!b(e,n)){if(!r(e))return!0;if(!t)return!1;a(e)}return e[n].weakData},onFreeze:function(e){return bs&&o.REQUIRED&&r(e)&&!b(e,n)&&a(e),e}};W[n]=!0})),ks=(ws.REQUIRED,ws.fastKey,ws.getWeakData,ws.onFreeze,t((function(e){var t=function(e,t){this.stopped=e,this.result=t};(e.exports=function(e,n,i,r,a){var o,s,l,c,u,h,f,d=rt(n,i,r?2:1);if(a)o=e;else{if("function"!=typeof(s=pr(e)))throw TypeError("Target is not iterable");if(fr(s)){for(l=0,c=le(e.length);c>l;l++)if((u=r?d(P(f=e[l])[0],f[1]):d(e[l]))&&u instanceof t)return u;return new t(!1)}o=s.call(e)}for(h=o.next;!(f=h.call(o)).done;)if("object"==typeof(u=cr(o,d,f.value,r))&&u&&u instanceof t)return u;return new t(!1)}).stop=function(e){return new t(!0,e)}}))),Ts=ws.getWeakData,Ss=Z.set,Es=Z.getterFor,As=ct.find,Ps=ct.findIndex,xs=0,Cs=function(e){return e.frozen||(e.frozen=new Os)},Os=function(){this.entries=[]},Is=function(e,t){return As(e.entries,(function(e){return e[0]===t}))};Os.prototype={get:function(e){var t=Is(this,e);if(t)return t[1]},has:function(e){return!!Is(this,e)},set:function(e,t){var n=Is(this,e);n?n[1]=t:this.entries.push([e,t])},delete:function(e){var t=Ps(this.entries,(function(t){return t[0]===e}));return~t&&this.entries.splice(t,1),!!~t}};var Ls={getConstructor:function(e,t,n,i){var r=e((function(e,a){ar(e,r,t),Ss(e,{type:t,id:xs++,frozen:void 0}),null!=a&&ks(a,e[i],e,n)})),a=Es(t),o=function(e,t,n){var i=a(e),r=Ts(P(t),!0);return!0===r?Cs(i).set(t,n):r[i.id]=n,e};return Er(r.prototype,{delete:function(e){var t=a(this);if(!g(e))return!1;var n=Ts(e);return!0===n?Cs(t).delete(e):n&&b(n,t.id)&&delete n[t.id]},has:function(e){var t=a(this);if(!g(e))return!1;var n=Ts(e);return!0===n?Cs(t).has(e):n&&b(n,t.id)}}),Er(r.prototype,n?{get:function(e){var t=a(this);if(g(e)){var n=Ts(e);return!0===n?Cs(t).get(e):n?n[t.id]:void 0}},set:function(e,t){return o(this,e,t)}}:{add:function(e){return o(this,e,!0)}}),r}},js=(t((function(e){var t,n=Z.enforce,a=!i.ActiveXObject&&"ActiveXObject"in i,o=Object.isExtensible,s=function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}},l=e.exports=function(e,t,n){var a=-1!==e.indexOf("Map"),o=-1!==e.indexOf("Weak"),s=a?"set":"add",l=i[e],c=l&&l.prototype,u=l,h={},f=function(e){var t=c[e];ee(c,e,"add"==e?function(e){return t.call(this,0===e?0:e),this}:"delete"==e?function(e){return!(o&&!g(e))&&t.call(this,0===e?0:e)}:"get"==e?function(e){return o&&!g(e)?void 0:t.call(this,0===e?0:e)}:"has"==e?function(e){return!(o&&!g(e))&&t.call(this,0===e?0:e)}:function(e,n){return t.call(this,0===e?0:e,n),this})};if(Ce(e,"function"!=typeof l||!(o||c.forEach&&!r((function(){(new l).entries().next()})))))u=n.getConstructor(t,e,a,s),ws.REQUIRED=!0;else if(Ce(e,!0)){var d=new u,p=d[s](o?{}:-0,1)!=d,m=r((function(){d.has(1)})),v=Vo((function(e){new l(e)})),y=!o&&r((function(){for(var e=new l,t=5;t--;)e[s](t,t);return!e.has(-0)}));v||((u=t((function(t,n){ar(t,u,e);var i=Xo(new l,t,u);return null!=n&&ks(n,i[s],i,a),i}))).prototype=c,c.constructor=u),(m||y)&&(f("delete"),f("has"),a&&f("get")),(y||p)&&f(s),o&&c.clear&&delete c.clear}return h[e]=u,Ie({global:!0,forced:u!=l},h),nt(u,e),o||n.setStrong(u,e,a),u}("WeakMap",s,Ls);if(D&&a){t=Ls.getConstructor(s,"WeakMap",!0),ws.REQUIRED=!0;var c=l.prototype,u=c.delete,h=c.has,f=c.get,d=c.set;Er(c,{delete:function(e){if(g(e)&&!o(e)){var i=n(this);return i.frozen||(i.frozen=new t),u.call(this,e)||i.frozen.delete(e)}return u.call(this,e)},has:function(e){if(g(e)&&!o(e)){var i=n(this);return i.frozen||(i.frozen=new t),h.call(this,e)||i.frozen.has(e)}return h.call(this,e)},get:function(e){if(g(e)&&!o(e)){var i=n(this);return i.frozen||(i.frozen=new t),h.call(this,e)?f.call(this,e):i.frozen.get(e)}return f.call(this,e)},set:function(e,i){if(g(e)&&!o(e)){var r=n(this);r.frozen||(r.frozen=new t),h.call(this,e)?d.call(this,e,i):r.frozen.set(e,i)}else d.call(this,e,i);return this}})}})),ct.every),Ns=$t("every"),Rs=Qt("every");Ie({target:"Array",proto:!0,forced:!Ns||!Rs},{every:function(e){return js(this,e,arguments.length>1?arguments[1]:void 0)}}),Ie({target:"Object",stat:!0,forced:Object.assign!==lr},{assign:lr});var Ms=ns.trim;Ie({target:"String",proto:!0,forced:function(e){return r((function(){return!!Qo[e]()||"​…᠎"!="​…᠎"[e]()||Qo[e].name!==e}))}("trim")},{trim:function(){return Ms(this)}});var _s=ct.some,Us=$t("some"),Ds=Qt("some");Ie({target:"Array",proto:!0,forced:!Us||!Ds},{some:function(e){return _s(this,e,arguments.length>1?arguments[1]:void 0)}});var Fs="".repeat||function(e){var t=String(p(this)),n="",i=oe(e);if(i<0||i==1/0)throw RangeError("Wrong number of repetitions");for(;i>0;(i>>>=1)&&(t+=t))1&i&&(n+=t);return n},qs=1..toFixed,Hs=Math.floor,Bs=function(e,t,n){return 0===t?n:t%2==1?Bs(e,t-1,n*e):Bs(e*e,t/2,n)},Vs=qs&&("0.000"!==8e-5.toFixed(3)||"1"!==.9.toFixed(0)||"1.25"!==1.255.toFixed(2)||"1000000000000000128"!==(0xde0b6b3a7640080).toFixed(0))||!r((function(){qs.call({})}));Ie({target:"Number",proto:!0,forced:Vs},{toFixed:function(e){var t,n,i,r,a=function(e){if("number"!=typeof e&&"Number"!=h(e))throw TypeError("Incorrect invocation");return+e}(this),o=oe(e),s=[0,0,0,0,0,0],l="",c="0",u=function(e,t){for(var n=-1,i=t;++n<6;)i+=e*s[n],s[n]=i%1e7,i=Hs(i/1e7)},f=function(e){for(var t=6,n=0;--t>=0;)n+=s[t],s[t]=Hs(n/e),n=n%e*1e7},d=function(){for(var e=6,t="";--e>=0;)if(""!==t||0===e||0!==s[e]){var n=String(s[e]);t=""===t?n:t+Fs.call("0",7-n.length)+n}return t};if(o<0||o>20)throw RangeError("Incorrect fraction digits");if(a!=a)return"NaN";if(a<=-1e21||a>=1e21)return String(a);if(a<0&&(l="-",a=-a),a>1e-21)if(n=(t=function(e){for(var t=0,n=e;n>=4096;)t+=12,n/=4096;for(;n>=2;)t+=1,n/=2;return t}(a*Bs(2,69,1))-69)<0?a*Bs(2,-t,1):a/Bs(2,t,1),n*=4503599627370496,(t=52-t)>0){for(u(0,n),i=o;i>=7;)u(1e7,0),i-=7;for(u(Bs(10,i,1),0),i=t-1;i>=23;)f(1<<23),i-=23;f(1<<i),u(1,1),f(2),c=d()}else u(0,n),u(1<<-t,0),c=d()+Fs.call("0",o);return c=o>0?l+((r=c.length)<=o?"0."+Fs.call("0",o-r)+c:c.slice(0,r-o)+"."+c.slice(r-o)):l+c}});var zs=l.f,Ws=function(e){return function(t){for(var n,i=m(t),r=Me(i),o=r.length,s=0,l=[];o>s;)n=r[s++],a&&!zs.call(i,n)||l.push(e?[n,i[n]]:i[n]);return l}},Ks={entries:Ws(!0),values:Ws(!1)},$s=Ks.entries;Ie({target:"Object",stat:!0},{entries:function(e){return $s(e)}});var Ys=Ks.values;Ie({target:"Object",stat:!0},{values:function(e){return Ys(e)}}),Ie({target:"Number",stat:!0},{isNaN:function(e){return e!=e}});var Gs=A.f,Xs=r((function(){Gs(1)}));function Qs(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function Js(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Zs(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function el(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Zs(Object(n),!0).forEach((function(t){Js(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Zs(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}Ie({target:"Object",stat:!0,forced:!a||Xs,sham:!a},{getOwnPropertyDescriptor:function(e,t){return Gs(m(e),t)}}),Ie({target:"Object",stat:!0,sham:!a},{getOwnPropertyDescriptors:function(e){for(var t,n,i=m(e),r=A.f,a=we(i),o={},s=0;a.length>s;)void 0!==(n=r(i,t=a[s++]))&&Fn(o,t,n);return o}}),Oi("match",1,(function(e,t,n){return[function(t){var n=p(this),i=null==t?void 0:t[e];return void 0!==i?i.call(t,n):new RegExp(t)[e](String(n))},function(e){var i=n(t,e,this);if(i.done)return i.value;var r=P(e),a=String(this);if(!r.global)return ji(r,a);var o=r.unicode;r.lastIndex=0;for(var s,l=[],c=0;null!==(s=ji(r,a));){var u=String(s[0]);l[c]=u,""===u&&(r.lastIndex=Li(a,le(r.lastIndex),o)),c++}return 0===c?null:l}]}));var tl={addCSS:!0,thumbWidth:15,watch:!0};function nl(e,t){return function(){return Array.from(document.querySelectorAll(t)).includes(this)}.call(e,t)}var il=function(e){return null!=e?e.constructor:null},rl=function(e,t){return!!(e&&t&&e instanceof t)},al=function(e){return null==e},ol=function(e){return il(e)===Object},sl=function(e){return il(e)===String},ll=function(e){return Array.isArray(e)},cl=function(e){return rl(e,NodeList)},ul=sl,hl=ll,fl=cl,dl=function(e){return rl(e,Element)},pl=function(e){return rl(e,Event)},ml=function(e){return al(e)||(sl(e)||ll(e)||cl(e))&&!e.length||ol(e)&&!Object.keys(e).length};function gl(e,t){if(1>t){var n=function(e){var t="".concat(e).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);return t?Math.max(0,(t[1]?t[1].length:0)-(t[2]?+t[2]:0)):0}(t);return parseFloat(e.toFixed(n))}return Math.round(e/t)*t}var vl,yl,bl,wl=function(){function e(t,n){(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,e),dl(t)?this.element=t:ul(t)&&(this.element=document.querySelector(t)),dl(this.element)&&ml(this.element.rangeTouch)&&(this.config=el({},tl,{},n),this.init())}return function(e,t,n){t&&Qs(e.prototype,t),n&&Qs(e,n)}(e,[{key:"init",value:function(){e.enabled&&(this.config.addCSS&&(this.element.style.userSelect="none",this.element.style.webKitUserSelect="none",this.element.style.touchAction="manipulation"),this.listeners(!0),this.element.rangeTouch=this)}},{key:"destroy",value:function(){e.enabled&&(this.config.addCSS&&(this.element.style.userSelect="",this.element.style.webKitUserSelect="",this.element.style.touchAction=""),this.listeners(!1),this.element.rangeTouch=null)}},{key:"listeners",value:function(e){var t=this,n=e?"addEventListener":"removeEventListener";["touchstart","touchmove","touchend"].forEach((function(e){t.element[n](e,(function(e){return t.set(e)}),!1)}))}},{key:"get",value:function(t){if(!e.enabled||!pl(t))return null;var n,i=t.target,r=t.changedTouches[0],a=parseFloat(i.getAttribute("min"))||0,o=parseFloat(i.getAttribute("max"))||100,s=parseFloat(i.getAttribute("step"))||1,l=i.getBoundingClientRect(),c=100/l.width*(this.config.thumbWidth/2)/100;return 0>(n=100/l.width*(r.clientX-l.left))?n=0:100<n&&(n=100),50>n?n-=(100-2*n)*c:50<n&&(n+=2*(n-50)*c),a+gl(n/100*(o-a),s)}},{key:"set",value:function(t){e.enabled&&pl(t)&&!t.target.disabled&&(t.preventDefault(),t.target.value=this.get(t),function(e,t){if(e&&t){var n=new Event(t,{bubbles:!0});e.dispatchEvent(n)}}(t.target,"touchend"===t.type?"change":"input"))}}],[{key:"setup",value:function(t){var n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},i=null;if(ml(t)||ul(t)?i=Array.from(document.querySelectorAll(ul(t)?t:'input[type="range"]')):dl(t)?i=[t]:fl(t)?i=Array.from(t):hl(t)&&(i=t.filter(dl)),ml(i))return null;var r=el({},tl,{},n);if(ul(t)&&r.watch){var a=new MutationObserver((function(n){Array.from(n).forEach((function(n){Array.from(n.addedNodes).forEach((function(n){dl(n)&&nl(n,t)&&new e(n,r)}))}))}));a.observe(document.body,{childList:!0,subtree:!0})}return i.map((function(t){return new e(t,n)}))}},{key:"enabled",get:function(){return"ontouchstart"in document.documentElement}}]),e}(),kl=i.Promise,Tl=Xe("species"),Sl=function(e){var t=ie(e),n=C.f;a&&t&&!t[Tl]&&n(t,Tl,{configurable:!0,get:function(){return this}})},El=/(iphone|ipod|ipad).*applewebkit/i.test(qn),Al=i.location,Pl=i.setImmediate,xl=i.clearImmediate,Cl=i.process,Ol=i.MessageChannel,Il=i.Dispatch,Ll=0,jl={},Nl=function(e){if(jl.hasOwnProperty(e)){var t=jl[e];delete jl[e],t()}},Rl=function(e){return function(){Nl(e)}},Ml=function(e){Nl(e.data)},_l=function(e){i.postMessage(e+"",Al.protocol+"//"+Al.host)};Pl&&xl||(Pl=function(e){for(var t=[],n=1;arguments.length>n;)t.push(arguments[n++]);return jl[++Ll]=function(){("function"==typeof e?e:Function(e)).apply(void 0,t)},vl(Ll),Ll},xl=function(e){delete jl[e]},"process"==h(Cl)?vl=function(e){Cl.nextTick(Rl(e))}:Il&&Il.now?vl=function(e){Il.now(Rl(e))}:Ol&&!El?(bl=(yl=new Ol).port2,yl.port1.onmessage=Ml,vl=rt(bl.postMessage,bl,1)):!i.addEventListener||"function"!=typeof postMessage||i.importScripts||r(_l)||"file:"===Al.protocol?vl="onreadystatechange"in T("script")?function(e){Ue.appendChild(T("script")).onreadystatechange=function(){Ue.removeChild(this),Nl(e)}}:function(e){setTimeout(Rl(e),0)}:(vl=_l,i.addEventListener("message",Ml,!1)));var Ul,Dl,Fl,ql,Hl,Bl,Vl,zl,Wl={set:Pl,clear:xl},Kl=A.f,$l=Wl.set,Yl=i.MutationObserver||i.WebKitMutationObserver,Gl=i.process,Xl=i.Promise,Ql="process"==h(Gl),Jl=Kl(i,"queueMicrotask"),Zl=Jl&&Jl.value;Zl||(Ul=function(){var e,t;for(Ql&&(e=Gl.domain)&&e.exit();Dl;){t=Dl.fn,Dl=Dl.next;try{t()}catch(e){throw Dl?ql():Fl=void 0,e}}Fl=void 0,e&&e.enter()},Ql?ql=function(){Gl.nextTick(Ul)}:Yl&&!El?(Hl=!0,Bl=document.createTextNode(""),new Yl(Ul).observe(Bl,{characterData:!0}),ql=function(){Bl.data=Hl=!Hl}):Xl&&Xl.resolve?(Vl=Xl.resolve(void 0),zl=Vl.then,ql=function(){zl.call(Vl,Ul)}):ql=function(){$l.call(i,Ul)});var ec,tc,nc,ic,rc=Zl||function(e){var t={fn:e,next:void 0};Fl&&(Fl.next=t),Dl||(Dl=t,ql()),Fl=t},ac=function(e){var t,n;this.promise=new e((function(e,i){if(void 0!==t||void 0!==n)throw TypeError("Bad Promise constructor");t=e,n=i})),this.resolve=it(t),this.reject=it(n)},oc={f:function(e){return new ac(e)}},sc=function(e,t){if(P(e),g(t)&&t.constructor===e)return t;var n=oc.f(e);return(0,n.resolve)(t),n.promise},lc=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}},cc=Wl.set,uc=Xe("species"),hc="Promise",fc=Z.get,dc=Z.set,pc=Z.getterFor(hc),mc=kl,gc=i.TypeError,vc=i.document,yc=i.process,bc=ie("fetch"),wc=oc.f,kc=wc,Tc="process"==h(yc),Sc=!!(vc&&vc.createEvent&&i.dispatchEvent),Ec=Ce(hc,(function(){if(!(_(mc)!==String(mc))){if(66===zn)return!0;if(!Tc&&"function"!=typeof PromiseRejectionEvent)return!0}if(zn>=51&&/native code/.test(mc))return!1;var e=mc.resolve(1),t=function(e){e((function(){}),(function(){}))};return(e.constructor={})[uc]=t,!(e.then((function(){}))instanceof t)})),Ac=Ec||!Vo((function(e){mc.all(e).catch((function(){}))})),Pc=function(e){var t;return!(!g(e)||"function"!=typeof(t=e.then))&&t},xc=function(e,t,n){if(!t.notified){t.notified=!0;var i=t.reactions;rc((function(){for(var r=t.value,a=1==t.state,o=0;i.length>o;){var s,l,c,u=i[o++],h=a?u.ok:u.fail,f=u.resolve,d=u.reject,p=u.domain;try{h?(a||(2===t.rejection&&Lc(e,t),t.rejection=1),!0===h?s=r:(p&&p.enter(),s=h(r),p&&(p.exit(),c=!0)),s===u.promise?d(gc("Promise-chain cycle")):(l=Pc(s))?l.call(s,f,d):f(s)):d(r)}catch(e){p&&!c&&p.exit(),d(e)}}t.reactions=[],t.notified=!1,n&&!t.rejection&&Oc(e,t)}))}},Cc=function(e,t,n){var r,a;Sc?((r=vc.createEvent("Event")).promise=t,r.reason=n,r.initEvent(e,!1,!0),i.dispatchEvent(r)):r={promise:t,reason:n},(a=i["on"+e])?a(r):"unhandledrejection"===e&&function(e,t){var n=i.console;n&&n.error&&(1===arguments.length?n.error(e):n.error(e,t))}("Unhandled promise rejection",n)},Oc=function(e,t){cc.call(i,(function(){var n,i=t.value;if(Ic(t)&&(n=lc((function(){Tc?yc.emit("unhandledRejection",i,e):Cc("unhandledrejection",e,i)})),t.rejection=Tc||Ic(t)?2:1,n.error))throw n.value}))},Ic=function(e){return 1!==e.rejection&&!e.parent},Lc=function(e,t){cc.call(i,(function(){Tc?yc.emit("rejectionHandled",e):Cc("rejectionhandled",e,t.value)}))},jc=function(e,t,n,i){return function(r){e(t,n,r,i)}},Nc=function(e,t,n,i){t.done||(t.done=!0,i&&(t=i),t.value=n,t.state=2,xc(e,t,!0))},Rc=function(e,t,n,i){if(!t.done){t.done=!0,i&&(t=i);try{if(e===n)throw gc("Promise can't be resolved itself");var r=Pc(n);r?rc((function(){var i={done:!1};try{r.call(n,jc(Rc,e,i,t),jc(Nc,e,i,t))}catch(n){Nc(e,i,n,t)}})):(t.value=n,t.state=1,xc(e,t,!1))}catch(n){Nc(e,{done:!1},n,t)}}};Ec&&(mc=function(e){ar(this,mc,hc),it(e),ec.call(this);var t=fc(this);try{e(jc(Rc,this,t),jc(Nc,this,t))}catch(e){Nc(this,t,e)}},(ec=function(e){dc(this,{type:hc,done:!1,notified:!1,parent:!1,reactions:[],rejection:!1,state:0,value:void 0})}).prototype=Er(mc.prototype,{then:function(e,t){var n=pc(this),i=wc(Bi(this,mc));return i.ok="function"!=typeof e||e,i.fail="function"==typeof t&&t,i.domain=Tc?yc.domain:void 0,n.parent=!0,n.reactions.push(i),0!=n.state&&xc(this,n,!1),i.promise},catch:function(e){return this.then(void 0,e)}}),tc=function(){var e=new ec,t=fc(e);this.promise=e,this.resolve=jc(Rc,e,t),this.reject=jc(Nc,e,t)},oc.f=wc=function(e){return e===mc||e===nc?new tc(e):kc(e)},"function"==typeof kl&&(ic=kl.prototype.then,ee(kl.prototype,"then",(function(e,t){var n=this;return new mc((function(e,t){ic.call(n,e,t)})).then(e,t)}),{unsafe:!0}),"function"==typeof bc&&Ie({global:!0,enumerable:!0,forced:!0},{fetch:function(e){return sc(mc,bc.apply(i,arguments))}}))),Ie({global:!0,wrap:!0,forced:Ec},{Promise:mc}),nt(mc,hc,!1),Sl(hc),nc=ie(hc),Ie({target:hc,stat:!0,forced:Ec},{reject:function(e){var t=wc(this);return t.reject.call(void 0,e),t.promise}}),Ie({target:hc,stat:!0,forced:Ec},{resolve:function(e){return sc(this,e)}}),Ie({target:hc,stat:!0,forced:Ac},{all:function(e){var t=this,n=wc(t),i=n.resolve,r=n.reject,a=lc((function(){var n=it(t.resolve),a=[],o=0,s=1;ks(e,(function(e){var l=o++,c=!1;a.push(void 0),s++,n.call(t,e).then((function(e){c||(c=!0,a[l]=e,--s||i(a))}),r)})),--s||i(a)}));return a.error&&r(a.value),n.promise},race:function(e){var t=this,n=wc(t),i=n.reject,r=lc((function(){var r=it(t.resolve);ks(e,(function(e){r.call(t,e).then(n.resolve,i)}))}));return r.error&&i(r.value),n.promise}});var Mc,_c=A.f,Uc="".startsWith,Dc=Math.min,Fc=ys("startsWith"),qc=!(Fc||(Mc=_c(String.prototype,"startsWith"),!Mc||Mc.writable));Ie({target:"String",proto:!0,forced:!qc&&!Fc},{startsWith:function(e){var t=String(p(this));gs(e);var n=le(Dc(arguments.length>1?arguments[1]:void 0,t.length)),i=String(e);return Uc?Uc.call(t,i,n):t.slice(n,n+i.length)===i}});var Hc,Bc,Vc,zc=function(e){return null!=e?e.constructor:null},Wc=function(e,t){return Boolean(e&&t&&e instanceof t)},Kc=function(e){return null==e},$c=function(e){return zc(e)===Object},Yc=function(e){return zc(e)===String},Gc=function(e){return zc(e)===Function},Xc=function(e){return Array.isArray(e)},Qc=function(e){return Wc(e,NodeList)},Jc=function(e){return Kc(e)||(Yc(e)||Xc(e)||Qc(e))&&!e.length||$c(e)&&!Object.keys(e).length},Zc=Kc,eu=$c,tu=function(e){return zc(e)===Number&&!Number.isNaN(e)},nu=Yc,iu=function(e){return zc(e)===Boolean},ru=Gc,au=Xc,ou=Qc,su=function(e){return Wc(e,Element)},lu=function(e){return Wc(e,Event)},cu=function(e){return Wc(e,KeyboardEvent)},uu=function(e){return Wc(e,TextTrack)||!Kc(e)&&Yc(e.kind)},hu=function(e){return Wc(e,Promise)&&Gc(e.then)},fu=function(e){if(Wc(e,window.URL))return!0;if(!Yc(e))return!1;var t=e;e.startsWith("http://")&&e.startsWith("https://")||(t="http://".concat(e));try{return!Jc(new URL(t).hostname)}catch(e){return!1}},du=Jc,pu=(Hc=document.createElement("span"),Bc={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"},Vc=Object.keys(Bc).find((function(e){return void 0!==Hc.style[e]})),!!nu(Vc)&&Bc[Vc]);function mu(e,t){setTimeout((function(){try{e.hidden=!0,e.offsetHeight,e.hidden=!1}catch(e){}}),t)}var gu={isIE:
+/* @cc_on!@ */
+!!document.documentMode,isEdge:window.navigator.userAgent.includes("Edge"),isWebkit:"WebkitAppearance"in document.documentElement.style&&!/Edge/.test(navigator.userAgent),isIPhone:/(iPhone|iPod)/gi.test(navigator.platform),isIos:/(iPad|iPhone|iPod)/gi.test(navigator.platform)},vu=function(e){return function(t,n,i,r){it(n);var a=Re(t),o=d(a),s=le(a.length),l=e?s-1:0,c=e?-1:1;if(i<2)for(;;){if(l in o){r=o[l],l+=c;break}if(l+=c,e?l<0:s<=l)throw TypeError("Reduce of empty array with no initial value")}for(;e?l>=0:s>l;l+=c)l in o&&(r=n(r,o[l],l,a));return r}},yu={left:vu(!1),right:vu(!0)}.left,bu=$t("reduce"),wu=Qt("reduce",{1:0});function ku(e,t){return t.split(".").reduce((function(e,t){return e&&e[t]}),e)}function Tu(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];if(!n.length)return e;var r=n.shift();return eu(r)?(Object.keys(r).forEach((function(t){eu(r[t])?(Object.keys(e).includes(t)||Object.assign(e,ko({},t,{})),Tu(e[t],r[t])):Object.assign(e,ko({},t,r[t]))})),Tu.apply(void 0,[e].concat(n))):e}function Su(e,t){var n=e.length?e:[e];Array.from(n).reverse().forEach((function(e,n){var i=n>0?t.cloneNode(!0):t,r=e.parentNode,a=e.nextSibling;i.appendChild(e),a?r.insertBefore(i,a):r.appendChild(i)}))}function Eu(e,t){su(e)&&!du(t)&&Object.entries(t).filter((function(e){var t=Ao(e,2)[1];return!Zc(t)})).forEach((function(t){var n=Ao(t,2),i=n[0],r=n[1];return e.setAttribute(i,r)}))}function Au(e,t,n){var i=document.createElement(e);return eu(t)&&Eu(i,t),nu(n)&&(i.innerText=n),i}function Pu(e,t,n,i){su(t)&&t.appendChild(Au(e,n,i))}function xu(e){ou(e)||au(e)?Array.from(e).forEach(xu):su(e)&&su(e.parentNode)&&e.parentNode.removeChild(e)}function Cu(e){if(su(e))for(var t=e.childNodes.length;t>0;)e.removeChild(e.lastChild),t-=1}function Ou(e,t){return su(t)&&su(t.parentNode)&&su(e)?(t.parentNode.replaceChild(e,t),e):null}function Iu(e,t){if(!nu(e)||du(e))return{};var n={},i=Tu({},t);return e.split(",").forEach((function(e){var t=e.trim(),r=t.replace(".",""),a=t.replace(/[[\]]/g,"").split("="),o=Ao(a,1)[0],s=a.length>1?a[1].replace(/["']/g,""):"";switch(t.charAt(0)){case".":nu(i.class)?n.class="".concat(i.class," ").concat(r):n.class=r;break;case"#":n.id=t.replace("#","");break;case"[":n[o]=s}})),Tu(i,n)}function Lu(e,t){if(su(e)){var n=t;iu(n)||(n=!e.hidden),e.hidden=n}}function ju(e,t,n){if(ou(e))return Array.from(e).map((function(e){return ju(e,t,n)}));if(su(e)){var i="toggle";return void 0!==n&&(i=n?"add":"remove"),e.classList[i](t),e.classList.contains(t)}return!1}function Nu(e,t){return su(e)&&e.classList.contains(t)}function Ru(e,t){var n=Element.prototype;return(n.matches||n.webkitMatchesSelector||n.mozMatchesSelector||n.msMatchesSelector||function(){return Array.from(document.querySelectorAll(t)).includes(this)}).call(e,t)}function Mu(e){return this.elements.container.querySelectorAll(e)}function _u(e){return this.elements.container.querySelector(e)}function Uu(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];su(e)&&(e.focus({preventScroll:!0}),t&&ju(e,this.config.classNames.tabFocus))}Ie({target:"Array",proto:!0,forced:!bu||!wu},{reduce:function(e){return yu(this,e,arguments.length,arguments.length>1?arguments[1]:void 0)}});var Du,Fu={"audio/ogg":"vorbis","audio/wav":"1","video/webm":"vp8, vorbis","video/mp4":"avc1.42E01E, mp4a.40.2","video/ogg":"theora"},qu={audio:"canPlayType"in document.createElement("audio"),video:"canPlayType"in document.createElement("video"),check:function(e,t,n){var i=gu.isIPhone&&n&&qu.playsinline,r=qu[e]||"html5"!==t;return{api:r,ui:r&&qu.rangeInput&&("video"!==e||!gu.isIPhone||i)}},pip:!(gu.isIPhone||!ru(Au("video").webkitSetPresentationMode)&&(!document.pictureInPictureEnabled||Au("video").disablePictureInPicture)),airplay:ru(window.WebKitPlaybackTargetAvailabilityEvent),playsinline:"playsInline"in document.createElement("video"),mime:function(e){if(du(e))return!1;var t=Ao(e.split("/"),1)[0],n=e;if(!this.isHTML5||t!==this.type)return!1;Object.keys(Fu).includes(n)&&(n+='; codecs="'.concat(Fu[e],'"'));try{return Boolean(n&&this.media.canPlayType(n).replace(/no/,""))}catch(e){return!1}},textTracks:"textTracks"in document.createElement("video"),rangeInput:(Du=document.createElement("input"),Du.type="range","range"===Du.type),touch:"ontouchstart"in document.documentElement,transitions:!1!==pu,reducedMotion:"matchMedia"in window&&window.matchMedia("(prefers-reduced-motion)").matches},Hu=function(){var e=!1;try{var t=Object.defineProperty({},"passive",{get:function(){return e=!0,null}});window.addEventListener("test",null,t),window.removeEventListener("test",null,t)}catch(e){}return e}();function Bu(e,t,n){var i=this,r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],a=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],o=arguments.length>5&&void 0!==arguments[5]&&arguments[5];if(e&&"addEventListener"in e&&!du(t)&&ru(n)){var s=t.split(" "),l=o;Hu&&(l={passive:a,capture:o}),s.forEach((function(t){i&&i.eventListeners&&r&&i.eventListeners.push({element:e,type:t,callback:n,options:l}),e[r?"addEventListener":"removeEventListener"](t,n,l)}))}}function Vu(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2?arguments[2]:void 0,i=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],r=arguments.length>4&&void 0!==arguments[4]&&arguments[4];Bu.call(this,e,t,n,!0,i,r)}function zu(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2?arguments[2]:void 0,i=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],r=arguments.length>4&&void 0!==arguments[4]&&arguments[4];Bu.call(this,e,t,n,!1,i,r)}function Wu(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",i=arguments.length>2?arguments[2]:void 0,r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],a=arguments.length>4&&void 0!==arguments[4]&&arguments[4],o=function o(){zu(e,n,o,r,a);for(var s=arguments.length,l=new Array(s),c=0;c<s;c++)l[c]=arguments[c];i.apply(t,l)};Bu.call(this,e,n,o,!0,r,a)}function Ku(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(su(e)&&!du(t)){var r=new CustomEvent(t,{bubbles:n,detail:So(So({},i),{},{plyr:this})});e.dispatchEvent(r)}}function $u(){this&&this.eventListeners&&(this.eventListeners.forEach((function(e){var t=e.element,n=e.type,i=e.callback,r=e.options;t.removeEventListener(n,i,r)})),this.eventListeners=[])}function Yu(){var e=this;return new Promise((function(t){return e.ready?setTimeout(t,0):Vu.call(e,e.elements.container,"ready",t)})).then((function(){}))}function Gu(e){hu(e)&&e.then(null,(function(){}))}function Xu(e){return!!(au(e)||nu(e)&&e.includes(":"))&&(au(e)?e:e.split(":")).map(Number).every(tu)}function Qu(e){if(!au(e)||!e.every(tu))return null;var t=Ao(e,2),n=t[0],i=t[1],r=function e(t,n){return 0===n?t:e(n,t%n)}(n,i);return[n/r,i/r]}function Ju(e){var t=function(e){return Xu(e)?e.split(":").map(Number):null},n=t(e);if(null===n&&(n=t(this.config.ratio)),null===n&&!du(this.embed)&&au(this.embed.ratio)&&(n=this.embed.ratio),null===n&&this.isHTML5){var i=this.media;n=Qu([i.videoWidth,i.videoHeight])}return n}function Zu(e){if(!this.isVideo)return{};var t=this.elements.wrapper,n=Ju.call(this,e),i=Ao(au(n)?n:[0,0],2),r=100/i[0]*i[1];if(t.style.paddingBottom="".concat(r,"%"),this.isVimeo&&!this.config.vimeo.premium&&this.supported.ui){var a=100/this.media.offsetWidth*parseInt(window.getComputedStyle(this.media).paddingBottom,10),o=(a-r)/(a/50);this.media.style.transform="translateY(-".concat(o,"%)")}else this.isHTML5&&t.classList.toggle(this.config.classNames.videoFixedRatio,null!==n);return{padding:r,ratio:n}}var eh={getSources:function(){var e=this;return this.isHTML5?Array.from(this.media.querySelectorAll("source")).filter((function(t){var n=t.getAttribute("type");return!!du(n)||qu.mime.call(e,n)})):[]},getQualityOptions:function(){return this.config.quality.forced?this.config.quality.options:eh.getSources.call(this).map((function(e){return Number(e.getAttribute("data-res"))})).filter(Boolean)},setup:function(){if(this.isHTML5){var e=this;e.options.speed=e.config.speed.options,du(this.config.ratio)||Zu.call(e),Object.defineProperty(e.media,"quality",{get:function(){var t=eh.getSources.call(e).find((function(t){return t.getAttribute("src")===e.source}));return t&&Number(t.getAttribute("data-res"))},set:function(t){if(e.quality!==t){if(e.config.quality.forced&&ru(e.config.quality.onChange))e.config.quality.onChange(t);else{var n=eh.getSources.call(e).find((function(e){return Number(e.getAttribute("data-res"))===t}));if(!n)return;var i=e.media,r=i.currentTime,a=i.paused,o=i.preload,s=i.readyState,l=i.playbackRate;e.media.src=n.getAttribute("src"),("none"!==o||s)&&(e.once("loadedmetadata",(function(){e.speed=l,e.currentTime=r,a||Gu(e.play())})),e.media.load())}Ku.call(e,e.media,"qualitychange",!1,{quality:t})}}})}},cancelRequests:function(){this.isHTML5&&(xu(eh.getSources.call(this)),this.media.setAttribute("src",this.config.blankVideo),this.media.load(),this.debug.log("Cancelled network requests"))}};function th(e){return au(e)?e.filter((function(t,n){return e.indexOf(t)===n})):e}var nh=C.f,ih=ye.f,rh=Z.set,ah=Xe("match"),oh=i.RegExp,sh=oh.prototype,lh=/a/g,ch=/a/g,uh=new oh(lh)!==lh,hh=oi.UNSUPPORTED_Y;if(a&&Ce("RegExp",!uh||hh||r((function(){return ch[ah]=!1,oh(lh)!=lh||oh(ch)==ch||"/a/i"!=oh(lh,"i")})))){for(var fh=function(e,t){var n,i=this instanceof fh,r=qi(e),a=void 0===t;if(!i&&r&&e.constructor===fh&&a)return e;uh?r&&!a&&(e=e.source):e instanceof fh&&(a&&(t=ri.call(e)),e=e.source),hh&&(n=!!t&&t.indexOf("y")>-1)&&(t=t.replace(/y/g,""));var o=Xo(uh?new oh(e,t):oh(e,t),i?this:sh,fh);return hh&&n&&rh(o,{sticky:n}),o},dh=function(e){e in fh||nh(fh,e,{configurable:!0,get:function(){return oh[e]},set:function(t){oh[e]=t}})},ph=ih(oh),mh=0;ph.length>mh;)dh(ph[mh++]);sh.constructor=fh,fh.prototype=sh,ee(i,"RegExp",fh)}function gh(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return du(e)?e:e.toString().replace(/{(\d+)}/g,(function(e,t){return n[t].toString()}))}Sl("RegExp");var vh=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return e.replace(new RegExp(t.toString().replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1"),"g"),n.toString())},yh=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return e.toString().replace(/\w\S*/g,(function(e){return e.charAt(0).toUpperCase()+e.substr(1).toLowerCase()}))};function bh(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=e.toString();return t=vh(t,"-"," "),t=vh(t,"_"," "),t=yh(t),vh(t," ","")}function wh(e){var t=document.createElement("div");return t.appendChild(e),t.innerHTML}var kh={pip:"PIP",airplay:"AirPlay",html5:"HTML5",vimeo:"Vimeo",youtube:"YouTube"},Th=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(du(e)||du(t))return"";var n=ku(t.i18n,e);if(du(n))return Object.keys(kh).includes(e)?kh[e]:"";var i={"{seektime}":t.seekTime,"{title}":t.title};return Object.entries(i).forEach((function(e){var t=Ao(e,2),i=t[0],r=t[1];n=vh(n,i,r)})),n},Sh=function(){function e(t){yo(this,e),this.enabled=t.config.storage.enabled,this.key=t.config.storage.key}return wo(e,[{key:"get",value:function(t){if(!e.supported||!this.enabled)return null;var n=window.localStorage.getItem(this.key);if(du(n))return null;var i=JSON.parse(n);return nu(t)&&t.length?i[t]:i}},{key:"set",value:function(t){if(e.supported&&this.enabled&&eu(t)){var n=this.get();du(n)&&(n={}),Tu(n,t),window.localStorage.setItem(this.key,JSON.stringify(n))}}}],[{key:"supported",get:function(){try{if(!("localStorage"in window))return!1;return window.localStorage.setItem("___test","___test"),window.localStorage.removeItem("___test"),!0}catch(e){return!1}}}]),e}();function Eh(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"text";return new Promise((function(n,i){try{var r=new XMLHttpRequest;if(!("withCredentials"in r))return;r.addEventListener("load",(function(){if("text"===t)try{n(JSON.parse(r.responseText))}catch(e){n(r.responseText)}else n(r.response)})),r.addEventListener("error",(function(){throw new Error(r.status)})),r.open("GET",e,!0),r.responseType=t,r.send()}catch(e){i(e)}}))}function Ah(e,t){if(nu(e)){var n=nu(t),i=function(){return null!==document.getElementById(t)},r=function(e,t){e.innerHTML=t,n&&i()||document.body.insertAdjacentElement("afterbegin",e)};if(!n||!i()){var a=Sh.supported,o=document.createElement("div");if(o.setAttribute("hidden",""),n&&o.setAttribute("id",t),a){var s=window.localStorage.getItem("".concat("cache","-").concat(t));if(null!==s){var l=JSON.parse(s);r(o,l.content)}}Eh(e).then((function(e){du(e)||(a&&window.localStorage.setItem("".concat("cache","-").concat(t),JSON.stringify({content:e})),r(o,e))})).catch((function(){}))}}}var Ph=Math.ceil,xh=Math.floor;Ie({target:"Math",stat:!0},{trunc:function(e){return(e>0?xh:Ph)(e)}});var Ch=function(e){return Math.trunc(e/60/60%60,10)},Oh=function(e){return Math.trunc(e/60%60,10)},Ih=function(e){return Math.trunc(e%60,10)};function Lh(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!tu(e))return Lh(void 0,t,n);var i=function(e){return"0".concat(e).slice(-2)},r=Ch(e),a=Oh(e),o=Ih(e);return r=t||r>0?"".concat(r,":"):"","".concat(n&&e>0?"-":"").concat(r).concat(i(a),":").concat(i(o))}var jh={getIconUrl:function(){var e=new URL(this.config.iconUrl,window.location).host!==window.location.host||gu.isIE&&!window.svg4everybody;return{url:this.config.iconUrl,cors:e}},findElements:function(){try{return this.elements.controls=_u.call(this,this.config.selectors.controls.wrapper),this.elements.buttons={play:Mu.call(this,this.config.selectors.buttons.play),pause:_u.call(this,this.config.selectors.buttons.pause),restart:_u.call(this,this.config.selectors.buttons.restart),rewind:_u.call(this,this.config.selectors.buttons.rewind),fastForward:_u.call(this,this.config.selectors.buttons.fastForward),mute:_u.call(this,this.config.selectors.buttons.mute),pip:_u.call(this,this.config.selectors.buttons.pip),airplay:_u.call(this,this.config.selectors.buttons.airplay),settings:_u.call(this,this.config.selectors.buttons.settings),captions:_u.call(this,this.config.selectors.buttons.captions),fullscreen:_u.call(this,this.config.selectors.buttons.fullscreen)},this.elements.progress=_u.call(this,this.config.selectors.progress),this.elements.inputs={seek:_u.call(this,this.config.selectors.inputs.seek),volume:_u.call(this,this.config.selectors.inputs.volume)},this.elements.display={buffer:_u.call(this,this.config.selectors.display.buffer),currentTime:_u.call(this,this.config.selectors.display.currentTime),duration:_u.call(this,this.config.selectors.display.duration)},su(this.elements.progress)&&(this.elements.display.seekTooltip=this.elements.progress.querySelector(".".concat(this.config.classNames.tooltip))),!0}catch(e){return this.debug.warn("It looks like there is a problem with your custom controls HTML",e),this.toggleNativeControls(!0),!1}},createIcon:function(e,t){var n=jh.getIconUrl.call(this),i="".concat(n.cors?"":n.url,"#").concat(this.config.iconPrefix),r=document.createElementNS("http://www.w3.org/2000/svg","svg");Eu(r,Tu(t,{"aria-hidden":"true",focusable:"false"}));var a=document.createElementNS("http://www.w3.org/2000/svg","use"),o="".concat(i,"-").concat(e);return"href"in a&&a.setAttributeNS("http://www.w3.org/1999/xlink","href",o),a.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",o),r.appendChild(a),r},createLabel:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=Th(e,this.config),i=So(So({},t),{},{class:[t.class,this.config.classNames.hidden].filter(Boolean).join(" ")});return Au("span",i,n)},createBadge:function(e){if(du(e))return null;var t=Au("span",{class:this.config.classNames.menu.value});return t.appendChild(Au("span",{class:this.config.classNames.menu.badge},e)),t},createButton:function(e,t){var n=this,i=Tu({},t),r=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=e.toString();return(t=bh(t)).charAt(0).toLowerCase()+t.slice(1)}(e),a={element:"button",toggle:!1,label:null,icon:null,labelPressed:null,iconPressed:null};switch(["element","icon","label"].forEach((function(e){Object.keys(i).includes(e)&&(a[e]=i[e],delete i[e])})),"button"!==a.element||Object.keys(i).includes("type")||(i.type="button"),Object.keys(i).includes("class")?i.class.split(" ").some((function(e){return e===n.config.classNames.control}))||Tu(i,{class:"".concat(i.class," ").concat(this.config.classNames.control)}):i.class=this.config.classNames.control,e){case"play":a.toggle=!0,a.label="play",a.labelPressed="pause",a.icon="play",a.iconPressed="pause";break;case"mute":a.toggle=!0,a.label="mute",a.labelPressed="unmute",a.icon="volume",a.iconPressed="muted";break;case"captions":a.toggle=!0,a.label="enableCaptions",a.labelPressed="disableCaptions",a.icon="captions-off",a.iconPressed="captions-on";break;case"fullscreen":a.toggle=!0,a.label="enterFullscreen",a.labelPressed="exitFullscreen",a.icon="enter-fullscreen",a.iconPressed="exit-fullscreen";break;case"play-large":i.class+=" ".concat(this.config.classNames.control,"--overlaid"),r="play",a.label="play",a.icon="play";break;default:du(a.label)&&(a.label=r),du(a.icon)&&(a.icon=e)}var o=Au(a.element);return a.toggle?(o.appendChild(jh.createIcon.call(this,a.iconPressed,{class:"icon--pressed"})),o.appendChild(jh.createIcon.call(this,a.icon,{class:"icon--not-pressed"})),o.appendChild(jh.createLabel.call(this,a.labelPressed,{class:"label--pressed"})),o.appendChild(jh.createLabel.call(this,a.label,{class:"label--not-pressed"}))):(o.appendChild(jh.createIcon.call(this,a.icon)),o.appendChild(jh.createLabel.call(this,a.label))),Tu(i,Iu(this.config.selectors.buttons[r],i)),Eu(o,i),"play"===r?(au(this.elements.buttons[r])||(this.elements.buttons[r]=[]),this.elements.buttons[r].push(o)):this.elements.buttons[r]=o,o},createRange:function(e,t){var n=Au("input",Tu(Iu(this.config.selectors.inputs[e]),{type:"range",min:0,max:100,step:.01,value:0,autocomplete:"off",role:"slider","aria-label":Th(e,this.config),"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":0},t));return this.elements.inputs[e]=n,jh.updateRangeFill.call(this,n),wl.setup(n),n},createProgress:function(e,t){var n=Au("progress",Tu(Iu(this.config.selectors.display[e]),{min:0,max:100,value:0,role:"progressbar","aria-hidden":!0},t));if("volume"!==e){n.appendChild(Au("span",null,"0"));var i={played:"played",buffer:"buffered"}[e],r=i?Th(i,this.config):"";n.innerText="% ".concat(r.toLowerCase())}return this.elements.display[e]=n,n},createTime:function(e,t){var n=Iu(this.config.selectors.display[e],t),i=Au("div",Tu(n,{class:"".concat(n.class?n.class:""," ").concat(this.config.classNames.display.time," ").trim(),"aria-label":Th(e,this.config)}),"00:00");return this.elements.display[e]=i,i},bindMenuItemShortcuts:function(e,t){var n=this;Vu.call(this,e,"keydown keyup",(function(i){if([32,38,39,40].includes(i.which)&&(i.preventDefault(),i.stopPropagation(),"keydown"!==i.type)){var r,a=Ru(e,'[role="menuitemradio"]');if(!a&&[32,39].includes(i.which))jh.showMenuPanel.call(n,t,!0);else 32!==i.which&&(40===i.which||a&&39===i.which?(r=e.nextElementSibling,su(r)||(r=e.parentNode.firstElementChild)):(r=e.previousElementSibling,su(r)||(r=e.parentNode.lastElementChild)),Uu.call(n,r,!0))}}),!1),Vu.call(this,e,"keyup",(function(e){13===e.which&&jh.focusFirstMenuItem.call(n,null,!0)}))},createMenuItem:function(e){var t=this,n=e.value,i=e.list,r=e.type,a=e.title,o=e.badge,s=void 0===o?null:o,l=e.checked,c=void 0!==l&&l,u=Iu(this.config.selectors.inputs[r]),h=Au("button",Tu(u,{type:"button",role:"menuitemradio",class:"".concat(this.config.classNames.control," ").concat(u.class?u.class:"").trim(),"aria-checked":c,value:n})),f=Au("span");f.innerHTML=a,su(s)&&f.appendChild(s),h.appendChild(f),Object.defineProperty(h,"checked",{enumerable:!0,get:function(){return"true"===h.getAttribute("aria-checked")},set:function(e){e&&Array.from(h.parentNode.children).filter((function(e){return Ru(e,'[role="menuitemradio"]')})).forEach((function(e){return e.setAttribute("aria-checked","false")})),h.setAttribute("aria-checked",e?"true":"false")}}),this.listeners.bind(h,"click keyup",(function(e){if(!cu(e)||32===e.which){switch(e.preventDefault(),e.stopPropagation(),h.checked=!0,r){case"language":t.currentTrack=Number(n);break;case"quality":t.quality=n;break;case"speed":t.speed=parseFloat(n)}jh.showMenuPanel.call(t,"home",cu(e))}}),r,!1),jh.bindMenuItemShortcuts.call(this,h,r),i.appendChild(h)},formatTime:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!tu(e))return e;var n=Ch(this.duration)>0;return Lh(e,n,t)},updateTimeDisplay:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];su(e)&&tu(t)&&(e.innerText=jh.formatTime(t,n))},updateVolume:function(){this.supported.ui&&(su(this.elements.inputs.volume)&&jh.setRange.call(this,this.elements.inputs.volume,this.muted?0:this.volume),su(this.elements.buttons.mute)&&(this.elements.buttons.mute.pressed=this.muted||0===this.volume))},setRange:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;su(e)&&(e.value=t,jh.updateRangeFill.call(this,e))},updateProgress:function(e){var t=this;if(this.supported.ui&&lu(e)){var n=0;if(e)switch(e.type){case"timeupdate":case"seeking":case"seeked":n=function(e,t){return 0===e||0===t||Number.isNaN(e)||Number.isNaN(t)?0:(e/t*100).toFixed(2)}(this.currentTime,this.duration),"timeupdate"===e.type&&jh.setRange.call(this,this.elements.inputs.seek,n);break;case"playing":case"progress":!function(e,n){var i=tu(n)?n:0,r=su(e)?e:t.elements.display.buffer;if(su(r)){r.value=i;var a=r.getElementsByTagName("span")[0];su(a)&&(a.childNodes[0].nodeValue=i)}}(this.elements.display.buffer,100*this.buffered)}}},updateRangeFill:function(e){var t=lu(e)?e.target:e;if(su(t)&&"range"===t.getAttribute("type")){if(Ru(t,this.config.selectors.inputs.seek)){t.setAttribute("aria-valuenow",this.currentTime);var n=jh.formatTime(this.currentTime),i=jh.formatTime(this.duration),r=Th("seekLabel",this.config);t.setAttribute("aria-valuetext",r.replace("{currentTime}",n).replace("{duration}",i))}else if(Ru(t,this.config.selectors.inputs.volume)){var a=100*t.value;t.setAttribute("aria-valuenow",a),t.setAttribute("aria-valuetext","".concat(a.toFixed(1),"%"))}else t.setAttribute("aria-valuenow",t.value);gu.isWebkit&&t.style.setProperty("--value","".concat(t.value/t.max*100,"%"))}},updateSeekTooltip:function(e){var t=this;if(this.config.tooltips.seek&&su(this.elements.inputs.seek)&&su(this.elements.display.seekTooltip)&&0!==this.duration){var n="".concat(this.config.classNames.tooltip,"--visible"),i=function(e){return ju(t.elements.display.seekTooltip,n,e)};if(this.touch)i(!1);else{var r=0,a=this.elements.progress.getBoundingClientRect();if(lu(e))r=100/a.width*(e.pageX-a.left);else{if(!Nu(this.elements.display.seekTooltip,n))return;r=parseFloat(this.elements.display.seekTooltip.style.left,10)}r<0?r=0:r>100&&(r=100),jh.updateTimeDisplay.call(this,this.elements.display.seekTooltip,this.duration/100*r),this.elements.display.seekTooltip.style.left="".concat(r,"%"),lu(e)&&["mouseenter","mouseleave"].includes(e.type)&&i("mouseenter"===e.type)}}},timeUpdate:function(e){var t=!su(this.elements.display.duration)&&this.config.invertTime;jh.updateTimeDisplay.call(this,this.elements.display.currentTime,t?this.duration-this.currentTime:this.currentTime,t),e&&"timeupdate"===e.type&&this.media.seeking||jh.updateProgress.call(this,e)},durationUpdate:function(){if(this.supported.ui&&(this.config.invertTime||!this.currentTime)){if(this.duration>=Math.pow(2,32))return Lu(this.elements.display.currentTime,!0),void Lu(this.elements.progress,!0);su(this.elements.inputs.seek)&&this.elements.inputs.seek.setAttribute("aria-valuemax",this.duration);var e=su(this.elements.display.duration);!e&&this.config.displayDuration&&this.paused&&jh.updateTimeDisplay.call(this,this.elements.display.currentTime,this.duration),e&&jh.updateTimeDisplay.call(this,this.elements.display.duration,this.duration),jh.updateSeekTooltip.call(this)}},toggleMenuButton:function(e,t){Lu(this.elements.settings.buttons[e],!t)},updateSetting:function(e,t,n){var i=this.elements.settings.panels[e],r=null,a=t;if("captions"===e)r=this.currentTrack;else{if(r=du(n)?this[e]:n,du(r)&&(r=this.config[e].default),!du(this.options[e])&&!this.options[e].includes(r))return void this.debug.warn("Unsupported value of '".concat(r,"' for ").concat(e));if(!this.config[e].options.includes(r))return void this.debug.warn("Disabled value of '".concat(r,"' for ").concat(e))}if(su(a)||(a=i&&i.querySelector('[role="menu"]')),su(a)){this.elements.settings.buttons[e].querySelector(".".concat(this.config.classNames.menu.value)).innerHTML=jh.getLabel.call(this,e,r);var o=a&&a.querySelector('[value="'.concat(r,'"]'));su(o)&&(o.checked=!0)}},getLabel:function(e,t){switch(e){case"speed":return 1===t?Th("normal",this.config):"".concat(t,"&times;");case"quality":if(tu(t)){var n=Th("qualityLabel.".concat(t),this.config);return n.length?n:"".concat(t,"p")}return yh(t);case"captions":return Mh.getLabel.call(this);default:return null}},setQualityMenu:function(e){var t=this;if(su(this.elements.settings.panels.quality)){var n=this.elements.settings.panels.quality.querySelector('[role="menu"]');au(e)&&(this.options.quality=th(e).filter((function(e){return t.config.quality.options.includes(e)})));var i=!du(this.options.quality)&&this.options.quality.length>1;if(jh.toggleMenuButton.call(this,"quality",i),Cu(n),jh.checkMenu.call(this),i){var r=function(e){var n=Th("qualityBadge.".concat(e),t.config);return n.length?jh.createBadge.call(t,n):null};this.options.quality.sort((function(e,n){var i=t.config.quality.options;return i.indexOf(e)>i.indexOf(n)?1:-1})).forEach((function(e){jh.createMenuItem.call(t,{value:e,list:n,type:"quality",title:jh.getLabel.call(t,"quality",e),badge:r(e)})})),jh.updateSetting.call(this,"quality",n)}}},setCaptionsMenu:function(){var e=this;if(su(this.elements.settings.panels.captions)){var t=this.elements.settings.panels.captions.querySelector('[role="menucaptions"]'),n=Mh.getTracks.call(this),i=Boolean(n.length);if(jh.toggleMenuButton.call(this,"captions",i),Cu(t),jh.checkMenu.call(this),i){var r=n.map((function(n,i){return{value:i,checked:e.captions.toggled&&e.currentTrack===i,title:Mh.getLabel.call(e,n),badge:n.language&&jh.createBadge.call(e,n.language.toUpperCase()),list:t,type:"language"}}));r.unshift({value:-1,checked:!this.captions.toggled,title:Th("disabled",this.config),list:t,type:"language"}),r.forEach(jh.createMenuItem.bind(this)),jh.updateSetting.call(this,"captions",t)}}},setSpeedMenu:function(){var e=this;if(su(this.elements.settings.panels.speed)){var t=this.elements.settings.panels.speed.querySelector('[role="menu"]');this.options.speed=this.options.speed.filter((function(t){return t>=e.minimumSpeed&&t<=e.maximumSpeed}));var n=!du(this.options.speed)&&this.options.speed.length>1;jh.toggleMenuButton.call(this,"speed",n),Cu(t),jh.checkMenu.call(this),n&&(this.options.speed.forEach((function(n){jh.createMenuItem.call(e,{value:n,list:t,type:"speed",title:jh.getLabel.call(e,"speed",n)})})),jh.updateSetting.call(this,"speed",t))}},checkMenu:function(){var e=this.elements.settings.buttons,t=!du(e)&&Object.values(e).some((function(e){return!e.hidden}));Lu(this.elements.settings.menu,!t)},focusFirstMenuItem:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!this.elements.settings.popup.hidden){var n=e;su(n)||(n=Object.values(this.elements.settings.panels).find((function(e){return!e.hidden})));var i=n.querySelector('[role^="menuitem"]');Uu.call(this,i,t)}},toggleMenu:function(e){var t=this.elements.settings.popup,n=this.elements.buttons.settings;if(su(t)&&su(n)){var i=t.hidden,r=i;if(iu(e))r=e;else if(cu(e)&&27===e.which)r=!1;else if(lu(e)){var a=ru(e.composedPath)?e.composedPath()[0]:e.target,o=t.contains(a);if(o||!o&&e.target!==n&&r)return}n.setAttribute("aria-expanded",r),Lu(t,!r),ju(this.elements.container,this.config.classNames.menu.open,r),r&&cu(e)?jh.focusFirstMenuItem.call(this,null,!0):r||i||Uu.call(this,n,cu(e))}},getMenuSize:function(e){var t=e.cloneNode(!0);t.style.position="absolute",t.style.opacity=0,t.removeAttribute("hidden"),e.parentNode.appendChild(t);var n=t.scrollWidth,i=t.scrollHeight;return xu(t),{width:n,height:i}},showMenuPanel:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=this.elements.container.querySelector("#plyr-settings-".concat(this.id,"-").concat(t));if(su(i)){var r=i.parentNode,a=Array.from(r.children).find((function(e){return!e.hidden}));if(qu.transitions&&!qu.reducedMotion){r.style.width="".concat(a.scrollWidth,"px"),r.style.height="".concat(a.scrollHeight,"px");var o=jh.getMenuSize.call(this,i),s=function t(n){n.target===r&&["width","height"].includes(n.propertyName)&&(r.style.width="",r.style.height="",zu.call(e,r,pu,t))};Vu.call(this,r,pu,s),r.style.width="".concat(o.width,"px"),r.style.height="".concat(o.height,"px")}Lu(a,!0),Lu(i,!1),jh.focusFirstMenuItem.call(this,i,n)}},setDownloadUrl:function(){var e=this.elements.buttons.download;su(e)&&e.setAttribute("href",this.download)},create:function(e){var t=this,n=jh.bindMenuItemShortcuts,i=jh.createButton,r=jh.createProgress,a=jh.createRange,o=jh.createTime,s=jh.setQualityMenu,l=jh.setSpeedMenu,c=jh.showMenuPanel;this.elements.controls=null,au(this.config.controls)&&this.config.controls.includes("play-large")&&this.elements.container.appendChild(i.call(this,"play-large"));var u=Au("div",Iu(this.config.selectors.controls.wrapper));this.elements.controls=u;var h={class:"plyr__controls__item"};return th(au(this.config.controls)?this.config.controls:[]).forEach((function(s){if("restart"===s&&u.appendChild(i.call(t,"restart",h)),"rewind"===s&&u.appendChild(i.call(t,"rewind",h)),"play"===s&&u.appendChild(i.call(t,"play",h)),"fast-forward"===s&&u.appendChild(i.call(t,"fast-forward",h)),"progress"===s){var l=Au("div",{class:"".concat(h.class," plyr__progress__container")}),f=Au("div",Iu(t.config.selectors.progress));if(f.appendChild(a.call(t,"seek",{id:"plyr-seek-".concat(e.id)})),f.appendChild(r.call(t,"buffer")),t.config.tooltips.seek){var d=Au("span",{class:t.config.classNames.tooltip},"00:00");f.appendChild(d),t.elements.display.seekTooltip=d}t.elements.progress=f,l.appendChild(t.elements.progress),u.appendChild(l)}if("current-time"===s&&u.appendChild(o.call(t,"currentTime",h)),"duration"===s&&u.appendChild(o.call(t,"duration",h)),"mute"===s||"volume"===s){var p=t.elements.volume;if(su(p)&&u.contains(p)||(p=Au("div",Tu({},h,{class:"".concat(h.class," plyr__volume").trim()})),t.elements.volume=p,u.appendChild(p)),"mute"===s&&p.appendChild(i.call(t,"mute")),"volume"===s&&!gu.isIos){var m={max:1,step:.05,value:t.config.volume};p.appendChild(a.call(t,"volume",Tu(m,{id:"plyr-volume-".concat(e.id)})))}}if("captions"===s&&u.appendChild(i.call(t,"captions",h)),"settings"===s&&!du(t.config.settings)){var g=Au("div",Tu({},h,{class:"".concat(h.class," plyr__menu").trim(),hidden:""}));g.appendChild(i.call(t,"settings",{"aria-haspopup":!0,"aria-controls":"plyr-settings-".concat(e.id),"aria-expanded":!1}));var v=Au("div",{class:"plyr__menu__container",id:"plyr-settings-".concat(e.id),hidden:""}),y=Au("div"),b=Au("div",{id:"plyr-settings-".concat(e.id,"-home")}),w=Au("div",{role:"menu"});b.appendChild(w),y.appendChild(b),t.elements.settings.panels.home=b,t.config.settings.forEach((function(i){var r=Au("button",Tu(Iu(t.config.selectors.buttons.settings),{type:"button",class:"".concat(t.config.classNames.control," ").concat(t.config.classNames.control,"--forward"),role:"menuitem","aria-haspopup":!0,hidden:""}));n.call(t,r,i),Vu.call(t,r,"click",(function(){c.call(t,i,!1)}));var a=Au("span",null,Th(i,t.config)),o=Au("span",{class:t.config.classNames.menu.value});o.innerHTML=e[i],a.appendChild(o),r.appendChild(a),w.appendChild(r);var s=Au("div",{id:"plyr-settings-".concat(e.id,"-").concat(i),hidden:""}),l=Au("button",{type:"button",class:"".concat(t.config.classNames.control," ").concat(t.config.classNames.control,"--back")});l.appendChild(Au("span",{"aria-hidden":!0},Th(i,t.config))),l.appendChild(Au("span",{class:t.config.classNames.hidden},Th("menuBack",t.config))),Vu.call(t,s,"keydown",(function(e){37===e.which&&(e.preventDefault(),e.stopPropagation(),c.call(t,"home",!0))}),!1),Vu.call(t,l,"click",(function(){c.call(t,"home",!1)})),s.appendChild(l),s.appendChild(Au("div",{role:"menu"})),s.appendChild(Au("div",{role:"menucaptions"})),y.appendChild(s),t.elements.settings.buttons[i]=r,t.elements.settings.panels[i]=s})),v.appendChild(y),g.appendChild(v),u.appendChild(g),t.elements.settings.popup=v,t.elements.settings.menu=g}if("pip"===s&&qu.pip&&u.appendChild(i.call(t,"pip",h)),"airplay"===s&&qu.airplay&&u.appendChild(i.call(t,"airplay",h)),"download"===s){var k=Tu({},h,{element:"a",href:t.download,target:"_blank"});t.isHTML5&&(k.download="");var T=t.config.urls.download;!fu(T)&&t.isEmbed&&Tu(k,{icon:"logo-".concat(t.provider),label:t.provider}),u.appendChild(i.call(t,"download",k))}"fullscreen"===s&&u.appendChild(i.call(t,"fullscreen",h))})),this.isHTML5&&s.call(this,eh.getQualityOptions.call(this)),l.call(this),u},inject:function(){var e=this;if(this.config.loadSprite){var t=jh.getIconUrl.call(this);t.cors&&Ah(t.url,"sprite-plyr")}this.id=Math.floor(1e4*Math.random());var n=null;this.elements.controls=null;var i={id:this.id,seektime:this.config.seekTime,title:this.config.title},r=!0;ru(this.config.controls)&&(this.config.controls=this.config.controls.call(this,i)),this.config.controls||(this.config.controls=[]),su(this.config.controls)||nu(this.config.controls)?n=this.config.controls:(n=jh.create.call(this,{id:this.id,seektime:this.config.seekTime,speed:this.speed,quality:this.quality,captions:Mh.getLabel.call(this)}),r=!1);var a,o;if(r&&nu(this.config.controls)&&(a=n,Object.entries(i).forEach((function(e){var t=Ao(e,2),n=t[0],i=t[1];a=vh(a,"{".concat(n,"}"),i)})),n=a),nu(this.config.selectors.controls.container)&&(o=document.querySelector(this.config.selectors.controls.container)),su(o)||(o=this.elements.container),o[su(n)?"insertAdjacentElement":"insertAdjacentHTML"]("afterbegin",n),su(this.elements.controls)||jh.findElements.call(this),!du(this.elements.buttons)){var s=function(t){var n=e.config.classNames.controlPressed;Object.defineProperty(t,"pressed",{enumerable:!0,get:function(){return Nu(t,n)},set:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];ju(t,n,e)}})};Object.values(this.elements.buttons).filter(Boolean).forEach((function(e){au(e)||ou(e)?Array.from(e).filter(Boolean).forEach(s):s(e)}))}if(gu.isEdge&&mu(o),this.config.tooltips.controls){var l=this.config,c=l.classNames,u=l.selectors,h="".concat(u.controls.wrapper," ").concat(u.labels," .").concat(c.hidden),f=Mu.call(this,h);Array.from(f).forEach((function(t){ju(t,e.config.classNames.hidden,!1),ju(t,e.config.classNames.tooltip,!0)}))}}};function Nh(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=e;if(t){var i=document.createElement("a");i.href=n,n=i.href}try{return new URL(n)}catch(e){return null}}function Rh(e){var t=new URLSearchParams;return eu(e)&&Object.entries(e).forEach((function(e){var n=Ao(e,2),i=n[0],r=n[1];t.set(i,r)})),t}var Mh={setup:function(){if(this.supported.ui)if(!this.isVideo||this.isYouTube||this.isHTML5&&!qu.textTracks)au(this.config.controls)&&this.config.controls.includes("settings")&&this.config.settings.includes("captions")&&jh.setCaptionsMenu.call(this);else{if(su(this.elements.captions)||(this.elements.captions=Au("div",Iu(this.config.selectors.captions)),function(e,t){su(e)&&su(t)&&t.parentNode.insertBefore(e,t.nextSibling)}(this.elements.captions,this.elements.wrapper)),gu.isIE&&window.URL){var e=this.media.querySelectorAll("track");Array.from(e).forEach((function(e){var t=e.getAttribute("src"),n=Nh(t);null!==n&&n.hostname!==window.location.href.hostname&&["http:","https:"].includes(n.protocol)&&Eh(t,"blob").then((function(t){e.setAttribute("src",window.URL.createObjectURL(t))})).catch((function(){xu(e)}))}))}var t=th((navigator.languages||[navigator.language||navigator.userLanguage||"en"]).map((function(e){return e.split("-")[0]}))),n=(this.storage.get("language")||this.config.captions.language||"auto").toLowerCase();if("auto"===n)n=Ao(t,1)[0];var i=this.storage.get("captions");if(iu(i)||(i=this.config.captions.active),Object.assign(this.captions,{toggled:!1,active:i,language:n,languages:t}),this.isHTML5){var r=this.config.captions.update?"addtrack removetrack":"removetrack";Vu.call(this,this.media.textTracks,r,Mh.update.bind(this))}setTimeout(Mh.update.bind(this),0)}},update:function(){var e=this,t=Mh.getTracks.call(this,!0),n=this.captions,i=n.active,r=n.language,a=n.meta,o=n.currentTrackNode,s=Boolean(t.find((function(e){return e.language===r})));this.isHTML5&&this.isVideo&&t.filter((function(e){return!a.get(e)})).forEach((function(t){e.debug.log("Track added",t),a.set(t,{default:"showing"===t.mode}),"showing"===t.mode&&(t.mode="hidden"),Vu.call(e,t,"cuechange",(function(){return Mh.updateCues.call(e)}))})),(s&&this.language!==r||!t.includes(o))&&(Mh.setLanguage.call(this,r),Mh.toggle.call(this,i&&s)),ju(this.elements.container,this.config.classNames.captions.enabled,!du(t)),au(this.config.controls)&&this.config.controls.includes("settings")&&this.config.settings.includes("captions")&&jh.setCaptionsMenu.call(this)},toggle:function(e){var t=this,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.supported.ui){var i=this.captions.toggled,r=this.config.classNames.captions.active,a=Zc(e)?!i:e;if(a!==i){if(n||(this.captions.active=a,this.storage.set({captions:a})),!this.language&&a&&!n){var o=Mh.getTracks.call(this),s=Mh.findTrack.call(this,[this.captions.language].concat(Po(this.captions.languages)),!0);return this.captions.language=s.language,void Mh.set.call(this,o.indexOf(s))}this.elements.buttons.captions&&(this.elements.buttons.captions.pressed=a),ju(this.elements.container,r,a),this.captions.toggled=a,jh.updateSetting.call(this,"captions"),Ku.call(this,this.media,a?"captionsenabled":"captionsdisabled")}setTimeout((function(){a&&t.captions.toggled&&(t.captions.currentTrackNode.mode="hidden")}))}},set:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=Mh.getTracks.call(this);if(-1!==e)if(tu(e))if(e in n){if(this.captions.currentTrack!==e){this.captions.currentTrack=e;var i=n[e],r=i||{},a=r.language;this.captions.currentTrackNode=i,jh.updateSetting.call(this,"captions"),t||(this.captions.language=a,this.storage.set({language:a})),this.isVimeo&&this.embed.enableTextTrack(a),Ku.call(this,this.media,"languagechange")}Mh.toggle.call(this,!0,t),this.isHTML5&&this.isVideo&&Mh.updateCues.call(this)}else this.debug.warn("Track not found",e);else this.debug.warn("Invalid caption argument",e);else Mh.toggle.call(this,!1,t)},setLanguage:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(nu(e)){var n=e.toLowerCase();this.captions.language=n;var i=Mh.getTracks.call(this),r=Mh.findTrack.call(this,[n]);Mh.set.call(this,i.indexOf(r),t)}else this.debug.warn("Invalid language argument",e)},getTracks:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],n=Array.from((this.media||{}).textTracks||[]);return n.filter((function(n){return!e.isHTML5||t||e.captions.meta.has(n)})).filter((function(e){return["captions","subtitles"].includes(e.kind)}))},findTrack:function(e){var t,n=this,i=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=Mh.getTracks.call(this),a=function(e){return Number((n.captions.meta.get(e)||{}).default)},o=Array.from(r).sort((function(e,t){return a(t)-a(e)}));return e.every((function(e){return!(t=o.find((function(t){return t.language===e})))})),t||(i?o[0]:void 0)},getCurrentTrack:function(){return Mh.getTracks.call(this)[this.currentTrack]},getLabel:function(e){var t=e;return!uu(t)&&qu.textTracks&&this.captions.toggled&&(t=Mh.getCurrentTrack.call(this)),uu(t)?du(t.label)?du(t.language)?Th("enabled",this.config):e.language.toUpperCase():t.label:Th("disabled",this.config)},updateCues:function(e){if(this.supported.ui)if(su(this.elements.captions))if(Zc(e)||Array.isArray(e)){var t=e;if(!t){var n=Mh.getCurrentTrack.call(this);t=Array.from((n||{}).activeCues||[]).map((function(e){return e.getCueAsHTML()})).map(wh)}var i=t.map((function(e){return e.trim()})).join("\n");if(i!==this.elements.captions.innerHTML){Cu(this.elements.captions);var r=Au("span",Iu(this.config.selectors.caption));r.innerHTML=i,this.elements.captions.appendChild(r),Ku.call(this,this.media,"cuechange")}}else this.debug.warn("updateCues: Invalid input",e);else this.debug.warn("No captions element to render to")}},_h={enabled:!0,title:"",debug:!1,autoplay:!1,autopause:!0,playsinline:!0,seekTime:10,volume:1,muted:!1,duration:null,displayDuration:!0,invertTime:!0,toggleInvert:!0,ratio:null,clickToPlay:!0,hideControls:!0,resetOnEnd:!1,disableContextMenu:!0,loadSprite:!0,iconPrefix:"plyr",iconUrl:"/theme/modules/plyr/plyr.svg",blankVideo:"/theme/modules/plyr/blank.webm",quality:{default:576,options:[4320,2880,2160,1440,1080,720,576,480,360,240],forced:!1,onChange:null},loop:{active:!1},speed:{selected:1,options:[.5,.75,1,1.25,1.5,1.75,2,4]},keyboard:{focused:!0,global:!1},tooltips:{controls:!1,seek:!0},captions:{active:!1,language:"auto",update:!1},fullscreen:{enabled:!0,fallback:!0,iosNative:!1},storage:{enabled:!0,key:"plyr"},controls:["play-large","play","progress","current-time","mute","volume","captions","settings","pip","airplay","fullscreen"],settings:["captions","quality","speed"],i18n:{restart:"Restart",rewind:"Rewind {seektime}s",play:"Play",pause:"Pause",fastForward:"Forward {seektime}s",seek:"Seek",seekLabel:"{currentTime} of {duration}",played:"Played",buffered:"Buffered",currentTime:"Current time",duration:"Duration",volume:"Volume",mute:"Mute",unmute:"Unmute",enableCaptions:"Enable captions",disableCaptions:"Disable captions",download:"Download",enterFullscreen:"Enter fullscreen",exitFullscreen:"Exit fullscreen",frameTitle:"Player for {title}",captions:"Captions",settings:"Settings",pip:"PIP",menuBack:"Go back to previous menu",speed:"Speed",normal:"Normal",quality:"Quality",loop:"Loop",start:"Start",end:"End",all:"All",reset:"Reset",disabled:"Disabled",enabled:"Enabled",advertisement:"Ad",qualityBadge:{2160:"4K",1440:"HD",1080:"HD",720:"HD",576:"SD",480:"SD"}},urls:{download:null,vimeo:{sdk:"https://player.vimeo.com/api/player.js",iframe:"https://player.vimeo.com/video/{0}?{1}",api:"https://vimeo.com/api/v2/video/{0}.json"},youtube:{sdk:"https://www.youtube.com/iframe_api",api:"https://noembed.com/embed?url=https://www.youtube.com/watch?v={0}"},googleIMA:{sdk:"https://imasdk.googleapis.com/js/sdkloader/ima3.js"}},listeners:{seek:null,play:null,pause:null,restart:null,rewind:null,fastForward:null,mute:null,volume:null,captions:null,download:null,fullscreen:null,pip:null,airplay:null,speed:null,quality:null,loop:null,language:null},events:["ended","progress","stalled","playing","waiting","canplay","canplaythrough","loadstart","loadeddata","loadedmetadata","timeupdate","volumechange","play","pause","error","seeking","seeked","emptied","ratechange","cuechange","download","enterfullscreen","exitfullscreen","captionsenabled","captionsdisabled","languagechange","controlshidden","controlsshown","ready","statechange","qualitychange","adsloaded","adscontentpause","adscontentresume","adstarted","adsmidpoint","adscomplete","adsallcomplete","adsimpression","adsclick"],selectors:{editable:"input, textarea, select, [contenteditable]",container:".plyr",controls:{container:null,wrapper:".plyr__controls"},labels:"[data-plyr]",buttons:{play:'[data-plyr="play"]',pause:'[data-plyr="pause"]',restart:'[data-plyr="restart"]',rewind:'[data-plyr="rewind"]',fastForward:'[data-plyr="fast-forward"]',mute:'[data-plyr="mute"]',captions:'[data-plyr="captions"]',download:'[data-plyr="download"]',fullscreen:'[data-plyr="fullscreen"]',pip:'[data-plyr="pip"]',airplay:'[data-plyr="airplay"]',settings:'[data-plyr="settings"]',loop:'[data-plyr="loop"]'},inputs:{seek:'[data-plyr="seek"]',volume:'[data-plyr="volume"]',speed:'[data-plyr="speed"]',language:'[data-plyr="language"]',quality:'[data-plyr="quality"]'},display:{currentTime:".plyr__time--current",duration:".plyr__time--duration",buffer:".plyr__progress__buffer",loop:".plyr__progress__loop",volume:".plyr__volume--display"},progress:".plyr__progress",captions:".plyr__captions",caption:".plyr__caption"},classNames:{type:"plyr--{0}",provider:"plyr--{0}",video:"plyr__video-wrapper",embed:"plyr__video-embed",videoFixedRatio:"plyr__video-wrapper--fixed-ratio",embedContainer:"plyr__video-embed__container",poster:"plyr__poster",posterEnabled:"plyr__poster-enabled",ads:"plyr__ads",control:"plyr__control",controlPressed:"plyr__control--pressed",playing:"plyr--playing",paused:"plyr--paused",stopped:"plyr--stopped",loading:"plyr--loading",hover:"plyr--hover",tooltip:"plyr__tooltip",cues:"plyr__cues",hidden:"plyr__sr-only",hideControls:"plyr--hide-controls",isIos:"plyr--is-ios",isTouch:"plyr--is-touch",uiSupported:"plyr--full-ui",noTransition:"plyr--no-transition",display:{time:"plyr__time"},menu:{value:"plyr__menu__value",badge:"plyr__badge",open:"plyr--menu-open"},captions:{enabled:"plyr--captions-enabled",active:"plyr--captions-active"},fullscreen:{enabled:"plyr--fullscreen-enabled",fallback:"plyr--fullscreen-fallback"},pip:{supported:"plyr--pip-supported",active:"plyr--pip-active"},airplay:{supported:"plyr--airplay-supported",active:"plyr--airplay-active"},tabFocus:"plyr__tab-focus",previewThumbnails:{thumbContainer:"plyr__preview-thumb",thumbContainerShown:"plyr__preview-thumb--is-shown",imageContainer:"plyr__preview-thumb__image-container",timeContainer:"plyr__preview-thumb__time-container",scrubbingContainer:"plyr__preview-scrubbing",scrubbingContainerShown:"plyr__preview-scrubbing--is-shown"}},attributes:{embed:{provider:"data-plyr-provider",id:"data-plyr-embed-id"}},ads:{enabled:!1,publisherId:"",tagUrl:""},previewThumbnails:{enabled:!1,src:""},vimeo:{byline:!1,portrait:!1,title:!1,speed:!0,transparent:!1,premium:!1,referrerPolicy:null},youtube:{noCookie:!0,rel:0,showinfo:0,iv_load_policy:3,modestbranding:1}},Uh="picture-in-picture",Dh="inline",Fh={html5:"html5",youtube:"youtube",vimeo:"vimeo"},qh="audio",Hh="video";var Bh=function(){},Vh=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];yo(this,e),this.enabled=window.console&&t,this.enabled&&this.log("Debugging enabled")}return wo(e,[{key:"log",get:function(){return this.enabled?Function.prototype.bind.call(console.log,console):Bh}},{key:"warn",get:function(){return this.enabled?Function.prototype.bind.call(console.warn,console):Bh}},{key:"error",get:function(){return this.enabled?Function.prototype.bind.call(console.error,console):Bh}}]),e}(),zh=function(){function e(t){var n=this;yo(this,e),this.player=t,this.prefix=e.prefix,this.property=e.property,this.scrollPosition={x:0,y:0},this.forceFallback="force"===t.config.fullscreen.fallback,this.player.elements.fullscreen=t.config.fullscreen.container&&function(e,t){return(Element.prototype.closest||function(){var e=this;do{if(Ru.matches(e,t))return e;e=e.parentElement||e.parentNode}while(null!==e&&1===e.nodeType);return null}).call(e,t)}(this.player.elements.container,t.config.fullscreen.container),Vu.call(this.player,document,"ms"===this.prefix?"MSFullscreenChange":"".concat(this.prefix,"fullscreenchange"),(function(){n.onChange()})),Vu.call(this.player,this.player.elements.container,"dblclick",(function(e){su(n.player.elements.controls)&&n.player.elements.controls.contains(e.target)||n.toggle()})),Vu.call(this,this.player.elements.container,"keydown",(function(e){return n.trapFocus(e)})),this.update()}return wo(e,[{key:"onChange",value:function(){if(this.enabled){var e=this.player.elements.buttons.fullscreen;su(e)&&(e.pressed=this.active),Ku.call(this.player,this.target,this.active?"enterfullscreen":"exitfullscreen",!0)}}},{key:"toggleFallback",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(e?this.scrollPosition={x:window.scrollX||0,y:window.scrollY||0}:window.scrollTo(this.scrollPosition.x,this.scrollPosition.y),document.body.style.overflow=e?"hidden":"",ju(this.target,this.player.config.classNames.fullscreen.fallback,e),gu.isIos){var t=document.head.querySelector('meta[name="viewport"]'),n="viewport-fit=cover";t||(t=document.createElement("meta")).setAttribute("name","viewport");var i=nu(t.content)&&t.content.includes(n);e?(this.cleanupViewport=!i,i||(t.content+=",".concat(n))):this.cleanupViewport&&(t.content=t.content.split(",").filter((function(e){return e.trim()!==n})).join(","))}this.onChange()}},{key:"trapFocus",value:function(e){if(!gu.isIos&&this.active&&"Tab"===e.key&&9===e.keyCode){var t=document.activeElement,n=Mu.call(this.player,"a[href], button:not(:disabled), input:not(:disabled), [tabindex]"),i=Ao(n,1)[0],r=n[n.length-1];t!==r||e.shiftKey?t===i&&e.shiftKey&&(r.focus(),e.preventDefault()):(i.focus(),e.preventDefault())}}},{key:"update",value:function(){var t;this.enabled?(t=this.forceFallback?"Fallback (forced)":e.native?"Native":"Fallback",this.player.debug.log("".concat(t," fullscreen enabled"))):this.player.debug.log("Fullscreen not supported and fallback disabled");ju(this.player.elements.container,this.player.config.classNames.fullscreen.enabled,this.enabled)}},{key:"enter",value:function(){this.enabled&&(gu.isIos&&this.player.config.fullscreen.iosNative?this.target.webkitEnterFullscreen():!e.native||this.forceFallback?this.toggleFallback(!0):this.prefix?du(this.prefix)||this.target["".concat(this.prefix,"Request").concat(this.property)]():this.target.requestFullscreen({navigationUI:"hide"}))}},{key:"exit",value:function(){if(this.enabled)if(gu.isIos&&this.player.config.fullscreen.iosNative)this.target.webkitExitFullscreen(),Gu(this.player.play());else if(!e.native||this.forceFallback)this.toggleFallback(!1);else if(this.prefix){if(!du(this.prefix)){var t="moz"===this.prefix?"Cancel":"Exit";document["".concat(this.prefix).concat(t).concat(this.property)]()}}else(document.cancelFullScreen||document.exitFullscreen).call(document)}},{key:"toggle",value:function(){this.active?this.exit():this.enter()}},{key:"usingNative",get:function(){return e.native&&!this.forceFallback}},{key:"enabled",get:function(){return(e.native||this.player.config.fullscreen.fallback)&&this.player.config.fullscreen.enabled&&this.player.supported.ui&&this.player.isVideo}},{key:"active",get:function(){if(!this.enabled)return!1;if(!e.native||this.forceFallback)return Nu(this.target,this.player.config.classNames.fullscreen.fallback);var t=this.prefix?document["".concat(this.prefix).concat(this.property,"Element")]:document.fullscreenElement;return t&&t.shadowRoot?t===this.target.getRootNode().host:t===this.target}},{key:"target",get:function(){return gu.isIos&&this.player.config.fullscreen.iosNative?this.player.media:this.player.elements.fullscreen||this.player.elements.container}}],[{key:"native",get:function(){return!!(document.fullscreenEnabled||document.webkitFullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled)}},{key:"prefix",get:function(){if(ru(document.exitFullscreen))return"";var e="";return["webkit","moz","ms"].some((function(t){return!(!ru(document["".concat(t,"ExitFullscreen")])&&!ru(document["".concat(t,"CancelFullScreen")]))&&(e=t,!0)})),e}},{key:"property",get:function(){return"moz"===this.prefix?"FullScreen":"Fullscreen"}}]),e}(),Wh=Math.sign||function(e){return 0==(e=+e)||e!=e?e:e<0?-1:1};function Kh(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return new Promise((function(n,i){var r=new Image,a=function(){delete r.onload,delete r.onerror,(r.naturalWidth>=t?n:i)(r)};Object.assign(r,{onload:a,onerror:a,src:e})}))}Ie({target:"Math",stat:!0},{sign:Wh});var $h={addStyleHook:function(){ju(this.elements.container,this.config.selectors.container.replace(".",""),!0),ju(this.elements.container,this.config.classNames.uiSupported,this.supported.ui)},toggleNativeControls:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];e&&this.isHTML5?this.media.setAttribute("controls",""):this.media.removeAttribute("controls")},build:function(){var e=this;if(this.listeners.media(),!this.supported.ui)return this.debug.warn("Basic support only for ".concat(this.provider," ").concat(this.type)),void $h.toggleNativeControls.call(this,!0);su(this.elements.controls)||(jh.inject.call(this),this.listeners.controls()),$h.toggleNativeControls.call(this),this.isHTML5&&Mh.setup.call(this),this.volume=null,this.muted=null,this.loop=null,this.quality=null,this.speed=null,jh.updateVolume.call(this),jh.timeUpdate.call(this),$h.checkPlaying.call(this),ju(this.elements.container,this.config.classNames.pip.supported,qu.pip&&this.isHTML5&&this.isVideo),ju(this.elements.container,this.config.classNames.airplay.supported,qu.airplay&&this.isHTML5),ju(this.elements.container,this.config.classNames.isIos,gu.isIos),ju(this.elements.container,this.config.classNames.isTouch,this.touch),this.ready=!0,setTimeout((function(){Ku.call(e,e.media,"ready")}),0),$h.setTitle.call(this),this.poster&&$h.setPoster.call(this,this.poster,!1).catch((function(){})),this.config.duration&&jh.durationUpdate.call(this)},setTitle:function(){var e=Th("play",this.config);if(nu(this.config.title)&&!du(this.config.title)&&(e+=", ".concat(this.config.title)),Array.from(this.elements.buttons.play||[]).forEach((function(t){t.setAttribute("aria-label",e)})),this.isEmbed){var t=_u.call(this,"iframe");if(!su(t))return;var n=du(this.config.title)?"video":this.config.title,i=Th("frameTitle",this.config);t.setAttribute("title",i.replace("{title}",n))}},togglePoster:function(e){ju(this.elements.container,this.config.classNames.posterEnabled,e)},setPoster:function(e){var t=this,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return n&&this.poster?Promise.reject(new Error("Poster already set")):(this.media.setAttribute("data-poster",e),Yu.call(this).then((function(){return Kh(e)})).catch((function(n){throw e===t.poster&&$h.togglePoster.call(t,!1),n})).then((function(){if(e!==t.poster)throw new Error("setPoster cancelled by later call to setPoster")})).then((function(){return Object.assign(t.elements.poster.style,{backgroundImage:"url('".concat(e,"')"),backgroundSize:""}),$h.togglePoster.call(t,!0),e})))},checkPlaying:function(e){var t=this;ju(this.elements.container,this.config.classNames.playing,this.playing),ju(this.elements.container,this.config.classNames.paused,this.paused),ju(this.elements.container,this.config.classNames.stopped,this.stopped),Array.from(this.elements.buttons.play||[]).forEach((function(e){Object.assign(e,{pressed:t.playing}),e.setAttribute("aria-label",Th(t.playing?"pause":"play",t.config))})),lu(e)&&"timeupdate"===e.type||$h.toggleControls.call(this)},checkLoading:function(e){var t=this;this.loading=["stalled","waiting"].includes(e.type),clearTimeout(this.timers.loading),this.timers.loading=setTimeout((function(){ju(t.elements.container,t.config.classNames.loading,t.loading),$h.toggleControls.call(t)}),this.loading?250:0)},toggleControls:function(e){var t=this.elements.controls;if(t&&this.config.hideControls){var n=this.touch&&this.lastSeekTime+2e3>Date.now();this.toggleControls(Boolean(e||this.loading||this.paused||t.pressed||t.hover||n))}},migrateStyles:function(){var e=this;Object.values(So({},this.media.style)).filter((function(e){return!du(e)&&e.startsWith("--plyr")})).forEach((function(t){e.elements.container.style.setProperty(t,e.media.style.getPropertyValue(t)),e.media.style.removeProperty(t)})),du(this.media.style)&&this.media.removeAttribute("style")}},Yh=function(){function e(t){yo(this,e),this.player=t,this.lastKey=null,this.focusTimer=null,this.lastKeyDown=null,this.handleKey=this.handleKey.bind(this),this.toggleMenu=this.toggleMenu.bind(this),this.setTabFocus=this.setTabFocus.bind(this),this.firstTouch=this.firstTouch.bind(this)}return wo(e,[{key:"handleKey",value:function(e){var t=this.player,n=t.elements,i=e.keyCode?e.keyCode:e.which,r="keydown"===e.type,a=r&&i===this.lastKey;if(!(e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)&&tu(i)){if(r){var o=document.activeElement;if(su(o)){var s=t.config.selectors.editable;if(o!==n.inputs.seek&&Ru(o,s))return;if(32===e.which&&Ru(o,'button, [role^="menuitem"]'))return}switch([32,37,38,39,40,48,49,50,51,52,53,54,56,57,67,70,73,75,76,77,79].includes(i)&&(e.preventDefault(),e.stopPropagation()),i){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:a||(t.currentTime=t.duration/10*(i-48));break;case 32:case 75:a||Gu(t.togglePlay());break;case 38:t.increaseVolume(.1);break;case 40:t.decreaseVolume(.1);break;case 77:a||(t.muted=!t.muted);break;case 39:t.forward();break;case 37:t.rewind();break;case 70:t.fullscreen.toggle();break;case 67:a||t.toggleCaptions();break;case 76:t.loop=!t.loop}27===i&&!t.fullscreen.usingNative&&t.fullscreen.active&&t.fullscreen.toggle(),this.lastKey=i}else this.lastKey=null}}},{key:"toggleMenu",value:function(e){jh.toggleMenu.call(this.player,e)}},{key:"firstTouch",value:function(){var e=this.player,t=e.elements;e.touch=!0,ju(t.container,e.config.classNames.isTouch,!0)}},{key:"setTabFocus",value:function(e){var t=this.player,n=t.elements;if(clearTimeout(this.focusTimer),"keydown"!==e.type||9===e.which){"keydown"===e.type&&(this.lastKeyDown=e.timeStamp);var i,r=e.timeStamp-this.lastKeyDown<=20;if("focus"!==e.type||r)i=t.config.classNames.tabFocus,ju(Mu.call(t,".".concat(i)),i,!1),"focusout"!==e.type&&(this.focusTimer=setTimeout((function(){var e=document.activeElement;n.container.contains(e)&&ju(document.activeElement,t.config.classNames.tabFocus,!0)}),10))}}},{key:"global",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=this.player;t.config.keyboard.global&&Bu.call(t,window,"keydown keyup",this.handleKey,e,!1),Bu.call(t,document.body,"click",this.toggleMenu,e),Wu.call(t,document.body,"touchstart",this.firstTouch),Bu.call(t,document.body,"keydown focus blur focusout",this.setTabFocus,e,!1,!0)}},{key:"container",value:function(){var e=this.player,t=e.config,n=e.elements,i=e.timers;!t.keyboard.global&&t.keyboard.focused&&Vu.call(e,n.container,"keydown keyup",this.handleKey,!1),Vu.call(e,n.container,"mousemove mouseleave touchstart touchmove enterfullscreen exitfullscreen",(function(t){var r=n.controls;r&&"enterfullscreen"===t.type&&(r.pressed=!1,r.hover=!1);var a=0;["touchstart","touchmove","mousemove"].includes(t.type)&&($h.toggleControls.call(e,!0),a=e.touch?3e3:2e3),clearTimeout(i.controls),i.controls=setTimeout((function(){return $h.toggleControls.call(e,!1)}),a)}));var r=function(t){if(!t)return Zu.call(e);var i=n.container.getBoundingClientRect(),r=i.width,a=i.height;return Zu.call(e,"".concat(r,":").concat(a))},a=function(){clearTimeout(i.resized),i.resized=setTimeout(r,50)};Vu.call(e,n.container,"enterfullscreen exitfullscreen",(function(t){var i=e.fullscreen,o=i.target,s=i.usingNative;if(o===n.container&&(e.isEmbed||!du(e.config.ratio))){var l="enterfullscreen"===t.type,c=r(l);c.padding;!function(t,n,i){if(e.isVimeo&&!e.config.vimeo.premium){var r=e.elements.wrapper.firstChild,a=Ao(t,2)[1],o=Ao(Ju.call(e),2),s=o[0],l=o[1];r.style.maxWidth=i?"".concat(a/l*s,"px"):null,r.style.margin=i?"0 auto":null}}(c.ratio,0,l),s||(l?Vu.call(e,window,"resize",a):zu.call(e,window,"resize",a))}}))}},{key:"media",value:function(){var e=this,t=this.player,n=t.elements;if(Vu.call(t,t.media,"timeupdate seeking seeked",(function(e){return jh.timeUpdate.call(t,e)})),Vu.call(t,t.media,"durationchange loadeddata loadedmetadata",(function(e){return jh.durationUpdate.call(t,e)})),Vu.call(t,t.media,"ended",(function(){t.isHTML5&&t.isVideo&&t.config.resetOnEnd&&(t.restart(),t.pause())})),Vu.call(t,t.media,"progress playing seeking seeked",(function(e){return jh.updateProgress.call(t,e)})),Vu.call(t,t.media,"volumechange",(function(e){return jh.updateVolume.call(t,e)})),Vu.call(t,t.media,"playing play pause ended emptied timeupdate",(function(e){return $h.checkPlaying.call(t,e)})),Vu.call(t,t.media,"waiting canplay seeked playing",(function(e){return $h.checkLoading.call(t,e)})),t.supported.ui&&t.config.clickToPlay&&!t.isAudio){var i=_u.call(t,".".concat(t.config.classNames.video));if(!su(i))return;Vu.call(t,n.container,"click",(function(r){([n.container,i].includes(r.target)||i.contains(r.target))&&(t.touch&&t.config.hideControls||(t.ended?(e.proxy(r,t.restart,"restart"),e.proxy(r,(function(){Gu(t.play())}),"play")):e.proxy(r,(function(){Gu(t.togglePlay())}),"play")))}))}t.supported.ui&&t.config.disableContextMenu&&Vu.call(t,n.wrapper,"contextmenu",(function(e){e.preventDefault()}),!1),Vu.call(t,t.media,"volumechange",(function(){t.storage.set({volume:t.volume,muted:t.muted})})),Vu.call(t,t.media,"ratechange",(function(){jh.updateSetting.call(t,"speed"),t.storage.set({speed:t.speed})})),Vu.call(t,t.media,"qualitychange",(function(e){jh.updateSetting.call(t,"quality",null,e.detail.quality)})),Vu.call(t,t.media,"ready qualitychange",(function(){jh.setDownloadUrl.call(t)}));var r=t.config.events.concat(["keyup","keydown"]).join(" ");Vu.call(t,t.media,r,(function(e){var i=e.detail,r=void 0===i?{}:i;"error"===e.type&&(r=t.media.error),Ku.call(t,n.container,e.type,!0,r)}))}},{key:"proxy",value:function(e,t,n){var i=this.player,r=i.config.listeners[n],a=!0;ru(r)&&(a=r.call(i,e)),!1!==a&&ru(t)&&t.call(i,e)}},{key:"bind",value:function(e,t,n,i){var r=this,a=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],o=this.player,s=o.config.listeners[i],l=ru(s);Vu.call(o,e,t,(function(e){return r.proxy(e,n,i)}),a&&!l)}},{key:"controls",value:function(){var e=this,t=this.player,n=t.elements,i=gu.isIE?"change":"input";if(n.buttons.play&&Array.from(n.buttons.play).forEach((function(n){e.bind(n,"click",(function(){Gu(t.togglePlay())}),"play")})),this.bind(n.buttons.restart,"click",t.restart,"restart"),this.bind(n.buttons.rewind,"click",t.rewind,"rewind"),this.bind(n.buttons.fastForward,"click",t.forward,"fastForward"),this.bind(n.buttons.mute,"click",(function(){t.muted=!t.muted}),"mute"),this.bind(n.buttons.captions,"click",(function(){return t.toggleCaptions()})),this.bind(n.buttons.download,"click",(function(){Ku.call(t,t.media,"download")}),"download"),this.bind(n.buttons.fullscreen,"click",(function(){t.fullscreen.toggle()}),"fullscreen"),this.bind(n.buttons.pip,"click",(function(){t.pip="toggle"}),"pip"),this.bind(n.buttons.airplay,"click",t.airplay,"airplay"),this.bind(n.buttons.settings,"click",(function(e){e.stopPropagation(),e.preventDefault(),jh.toggleMenu.call(t,e)}),null,!1),this.bind(n.buttons.settings,"keyup",(function(e){var n=e.which;[13,32].includes(n)&&(13!==n?(e.preventDefault(),e.stopPropagation(),jh.toggleMenu.call(t,e)):jh.focusFirstMenuItem.call(t,null,!0))}),null,!1),this.bind(n.settings.menu,"keydown",(function(e){27===e.which&&jh.toggleMenu.call(t,e)})),this.bind(n.inputs.seek,"mousedown mousemove",(function(e){var t=n.progress.getBoundingClientRect(),i=100/t.width*(e.pageX-t.left);e.currentTarget.setAttribute("seek-value",i)})),this.bind(n.inputs.seek,"mousedown mouseup keydown keyup touchstart touchend",(function(e){var n=e.currentTarget,i=e.keyCode?e.keyCode:e.which;if(!cu(e)||39===i||37===i){t.lastSeekTime=Date.now();var r=n.hasAttribute("play-on-seeked"),a=["mouseup","touchend","keyup"].includes(e.type);r&&a?(n.removeAttribute("play-on-seeked"),Gu(t.play())):!a&&t.playing&&(n.setAttribute("play-on-seeked",""),t.pause())}})),gu.isIos){var r=Mu.call(t,'input[type="range"]');Array.from(r).forEach((function(t){return e.bind(t,i,(function(e){return mu(e.target)}))}))}this.bind(n.inputs.seek,i,(function(e){var n=e.currentTarget,i=n.getAttribute("seek-value");du(i)&&(i=n.value),n.removeAttribute("seek-value"),t.currentTime=i/n.max*t.duration}),"seek"),this.bind(n.progress,"mouseenter mouseleave mousemove",(function(e){return jh.updateSeekTooltip.call(t,e)})),this.bind(n.progress,"mousemove touchmove",(function(e){var n=t.previewThumbnails;n&&n.loaded&&n.startMove(e)})),this.bind(n.progress,"mouseleave touchend click",(function(){var e=t.previewThumbnails;e&&e.loaded&&e.endMove(!1,!0)})),this.bind(n.progress,"mousedown touchstart",(function(e){var n=t.previewThumbnails;n&&n.loaded&&n.startScrubbing(e)})),this.bind(n.progress,"mouseup touchend",(function(e){var n=t.previewThumbnails;n&&n.loaded&&n.endScrubbing(e)})),gu.isWebkit&&Array.from(Mu.call(t,'input[type="range"]')).forEach((function(n){e.bind(n,"input",(function(e){return jh.updateRangeFill.call(t,e.target)}))})),t.config.toggleInvert&&!su(n.display.duration)&&this.bind(n.display.currentTime,"click",(function(){0!==t.currentTime&&(t.config.invertTime=!t.config.invertTime,jh.timeUpdate.call(t))})),this.bind(n.inputs.volume,i,(function(e){t.volume=e.target.value}),"volume"),this.bind(n.controls,"mouseenter mouseleave",(function(e){n.controls.hover=!t.touch&&"mouseenter"===e.type})),n.fullscreen&&Array.from(n.fullscreen.children).filter((function(e){return!e.contains(n.container)})).forEach((function(i){e.bind(i,"mouseenter mouseleave",(function(e){n.controls.hover=!t.touch&&"mouseenter"===e.type}))})),this.bind(n.controls,"mousedown mouseup touchstart touchend touchcancel",(function(e){n.controls.pressed=["mousedown","touchstart"].includes(e.type)})),this.bind(n.controls,"focusin",(function(){var i=t.config,r=t.timers;ju(n.controls,i.classNames.noTransition,!0),$h.toggleControls.call(t,!0),setTimeout((function(){ju(n.controls,i.classNames.noTransition,!1)}),0);var a=e.touch?3e3:4e3;clearTimeout(r.controls),r.controls=setTimeout((function(){return $h.toggleControls.call(t,!1)}),a)})),this.bind(n.inputs.volume,"wheel",(function(e){var n=e.webkitDirectionInvertedFromDevice,i=Ao([e.deltaX,-e.deltaY].map((function(e){return n?-e:e})),2),r=i[0],a=i[1],o=Math.sign(Math.abs(r)>Math.abs(a)?r:a);t.increaseVolume(o/50);var s=t.media.volume;(1===o&&s<1||-1===o&&s>0)&&e.preventDefault()}),"volume",!1)}}]),e}(),Gh=Kn("splice"),Xh=Qt("splice",{ACCESSORS:!0,0:0,1:2}),Qh=Math.max,Jh=Math.min;Ie({target:"Array",proto:!0,forced:!Gh||!Xh},{splice:function(e,t){var n,i,r,a,o,s,l=Re(this),c=le(l.length),u=he(e,c),h=arguments.length;if(0===h?n=i=0:1===h?(n=0,i=c-u):(n=h-2,i=Jh(Qh(oe(t),0),c-u)),c+n-i>9007199254740991)throw TypeError("Maximum allowed length exceeded");for(r=ot(l,i),a=0;a<i;a++)(o=u+a)in l&&Fn(r,a,l[o]);if(r.length=i,n<i){for(a=u;a<c-i;a++)s=a+n,(o=a+i)in l?l[s]=l[o]:delete l[s];for(a=c;a>c-i+n;a--)delete l[a-1]}else if(n>i)for(a=c-i;a>u;a--)s=a+n-1,(o=a+i-1)in l?l[s]=l[o]:delete l[s];for(a=0;a<n;a++)l[a+u]=arguments[a+2];return l.length=c-i+n,r}});var Zh=t((function(e,t){e.exports=function(){var e=function(){},t={},n={},i={};function r(e,t){if(e){var r=i[e];if(n[e]=t,r)for(;r.length;)r[0](e,t),r.splice(0,1)}}function a(t,n){t.call&&(t={success:t}),n.length?(t.error||e)(n):(t.success||e)(t)}function o(t,n,i,r){var a,s,l=document,c=i.async,u=(i.numRetries||0)+1,h=i.before||e,f=t.replace(/[\?|#].*$/,""),d=t.replace(/^(css|img)!/,"");r=r||0,/(^css!|\.css$)/.test(f)?((s=l.createElement("link")).rel="stylesheet",s.href=d,(a="hideFocus"in s)&&s.relList&&(a=0,s.rel="preload",s.as="style")):/(^img!|\.(png|gif|jpg|svg|webp)$)/.test(f)?(s=l.createElement("img")).src=d:((s=l.createElement("script")).src=t,s.async=void 0===c||c),s.onload=s.onerror=s.onbeforeload=function(e){var l=e.type[0];if(a)try{s.sheet.cssText.length||(l="e")}catch(e){18!=e.code&&(l="e")}if("e"==l){if((r+=1)<u)return o(t,n,i,r)}else if("preload"==s.rel&&"style"==s.as)return s.rel="stylesheet";n(t,l,e.defaultPrevented)},!1!==h(t,s)&&l.head.appendChild(s)}function s(e,n,i){var s,l;if(n&&n.trim&&(s=n),l=(s?i:n)||{},s){if(s in t)throw"LoadJS";t[s]=!0}function c(t,n){!function(e,t,n){var i,r,a=(e=e.push?e:[e]).length,s=a,l=[];for(i=function(e,n,i){if("e"==n&&l.push(e),"b"==n){if(!i)return;l.push(e)}--a||t(l)},r=0;r<s;r++)o(e[r],i,n)}(e,(function(e){a(l,e),t&&a({success:t,error:n},e),r(s,e)}),l)}if(l.returnPromise)return new Promise(c);c()}return s.ready=function(e,t){return function(e,t){e=e.push?e:[e];var r,a,o,s=[],l=e.length,c=l;for(r=function(e,n){n.length&&s.push(e),--c||t(s)};l--;)a=e[l],(o=n[a])?r(a,o):(i[a]=i[a]||[]).push(r)}(e,(function(e){a(t,e)})),s},s.done=function(e){r(e,[])},s.reset=function(){t={},n={},i={}},s.isDefined=function(e){return e in t},s}()}));function ef(e){return new Promise((function(t,n){Zh(e,{success:t,error:n})}))}function tf(e){e&&!this.embed.hasPlayed&&(this.embed.hasPlayed=!0),this.media.paused===e&&(this.media.paused=!e,Ku.call(this,this.media,e?"play":"pause"))}var nf={setup:function(){var e=this;ju(e.elements.wrapper,e.config.classNames.embed,!0),e.options.speed=e.config.speed.options,Zu.call(e),eu(window.Vimeo)?nf.ready.call(e):ef(e.config.urls.vimeo.sdk).then((function(){nf.ready.call(e)})).catch((function(t){e.debug.warn("Vimeo SDK (player.js) failed to load",t)}))},ready:function(){var e=this,t=this,n=t.config.vimeo,i=n.premium,r=n.referrerPolicy,a=Eo(n,["premium","referrerPolicy"]);i&&Object.assign(a,{controls:!1,sidedock:!1});var o=Rh(So({loop:t.config.loop.active,autoplay:t.autoplay,muted:t.muted,gesture:"media",playsinline:!this.config.fullscreen.iosNative},a)),s=t.media.getAttribute("src");du(s)&&(s=t.media.getAttribute(t.config.attributes.embed.id));var l,c=du(l=s)?null:tu(Number(l))?l:l.match(/^.*(vimeo.com\/|video\/)(\d+).*/)?RegExp.$2:l,u=Au("iframe"),h=gh(t.config.urls.vimeo.iframe,c,o);u.setAttribute("src",h),u.setAttribute("allowfullscreen",""),u.setAttribute("allow","autoplay,fullscreen,picture-in-picture"),du(r)||u.setAttribute("referrerPolicy",r);var f=t.poster;if(i)u.setAttribute("data-poster",f),t.media=Ou(u,t.media);else{var d=Au("div",{class:t.config.classNames.embedContainer,"data-poster":f});d.appendChild(u),t.media=Ou(d,t.media)}Eh(gh(t.config.urls.vimeo.api,c),"json").then((function(e){if(!du(e)){var n=new URL(e[0].thumbnail_large);n.pathname="".concat(n.pathname.split("_")[0],".jpg"),$h.setPoster.call(t,n.href).catch((function(){}))}})),t.embed=new window.Vimeo.Player(u,{autopause:t.config.autopause,muted:t.muted}),t.media.paused=!0,t.media.currentTime=0,t.supported.ui&&t.embed.disableTextTrack(),t.media.play=function(){return tf.call(t,!0),t.embed.play()},t.media.pause=function(){return tf.call(t,!1),t.embed.pause()},t.media.stop=function(){t.pause(),t.currentTime=0};var p=t.media.currentTime;Object.defineProperty(t.media,"currentTime",{get:function(){return p},set:function(e){var n=t.embed,i=t.media,r=t.paused,a=t.volume,o=r&&!n.hasPlayed;i.seeking=!0,Ku.call(t,i,"seeking"),Promise.resolve(o&&n.setVolume(0)).then((function(){return n.setCurrentTime(e)})).then((function(){return o&&n.pause()})).then((function(){return o&&n.setVolume(a)})).catch((function(){}))}});var m=t.config.speed.selected;Object.defineProperty(t.media,"playbackRate",{get:function(){return m},set:function(e){t.embed.setPlaybackRate(e).then((function(){m=e,Ku.call(t,t.media,"ratechange")})).catch((function(){t.options.speed=[1]}))}});var g=t.config.volume;Object.defineProperty(t.media,"volume",{get:function(){return g},set:function(e){t.embed.setVolume(e).then((function(){g=e,Ku.call(t,t.media,"volumechange")}))}});var v=t.config.muted;Object.defineProperty(t.media,"muted",{get:function(){return v},set:function(e){var n=!!iu(e)&&e;t.embed.setVolume(n?0:t.config.volume).then((function(){v=n,Ku.call(t,t.media,"volumechange")}))}});var y,b=t.config.loop;Object.defineProperty(t.media,"loop",{get:function(){return b},set:function(e){var n=iu(e)?e:t.config.loop.active;t.embed.setLoop(n).then((function(){b=n}))}}),t.embed.getVideoUrl().then((function(e){y=e,jh.setDownloadUrl.call(t)})).catch((function(t){e.debug.warn(t)})),Object.defineProperty(t.media,"currentSrc",{get:function(){return y}}),Object.defineProperty(t.media,"ended",{get:function(){return t.currentTime===t.duration}}),Promise.all([t.embed.getVideoWidth(),t.embed.getVideoHeight()]).then((function(n){var i=Ao(n,2),r=i[0],a=i[1];t.embed.ratio=[r,a],Zu.call(e)})),t.embed.setAutopause(t.config.autopause).then((function(e){t.config.autopause=e})),t.embed.getVideoTitle().then((function(n){t.config.title=n,$h.setTitle.call(e)})),t.embed.getCurrentTime().then((function(e){p=e,Ku.call(t,t.media,"timeupdate")})),t.embed.getDuration().then((function(e){t.media.duration=e,Ku.call(t,t.media,"durationchange")})),t.embed.getTextTracks().then((function(e){t.media.textTracks=e,Mh.setup.call(t)})),t.embed.on("cuechange",(function(e){var n=e.cues,i=(void 0===n?[]:n).map((function(e){return function(e){var t=document.createDocumentFragment(),n=document.createElement("div");return t.appendChild(n),n.innerHTML=e,t.firstChild.innerText}(e.text)}));Mh.updateCues.call(t,i)})),t.embed.on("loaded",(function(){(t.embed.getPaused().then((function(e){tf.call(t,!e),e||Ku.call(t,t.media,"playing")})),su(t.embed.element)&&t.supported.ui)&&t.embed.element.setAttribute("tabindex",-1)})),t.embed.on("bufferstart",(function(){Ku.call(t,t.media,"waiting")})),t.embed.on("bufferend",(function(){Ku.call(t,t.media,"playing")})),t.embed.on("play",(function(){tf.call(t,!0),Ku.call(t,t.media,"playing")})),t.embed.on("pause",(function(){tf.call(t,!1)})),t.embed.on("timeupdate",(function(e){t.media.seeking=!1,p=e.seconds,Ku.call(t,t.media,"timeupdate")})),t.embed.on("progress",(function(e){t.media.buffered=e.percent,Ku.call(t,t.media,"progress"),1===parseInt(e.percent,10)&&Ku.call(t,t.media,"canplaythrough"),t.embed.getDuration().then((function(e){e!==t.media.duration&&(t.media.duration=e,Ku.call(t,t.media,"durationchange"))}))})),t.embed.on("seeked",(function(){t.media.seeking=!1,Ku.call(t,t.media,"seeked")})),t.embed.on("ended",(function(){t.media.paused=!0,Ku.call(t,t.media,"ended")})),t.embed.on("error",(function(e){t.media.error=e,Ku.call(t,t.media,"error")})),setTimeout((function(){return $h.build.call(t)}),0)}};function rf(e){e&&!this.embed.hasPlayed&&(this.embed.hasPlayed=!0),this.media.paused===e&&(this.media.paused=!e,Ku.call(this,this.media,e?"play":"pause"))}function af(e){return e.noCookie?"https://www.youtube-nocookie.com":"http:"===window.location.protocol?"http://www.youtube.com":void 0}var of={setup:function(){var e=this;if(ju(this.elements.wrapper,this.config.classNames.embed,!0),eu(window.YT)&&ru(window.YT.Player))of.ready.call(this);else{var t=window.onYouTubeIframeAPIReady;window.onYouTubeIframeAPIReady=function(){ru(t)&&t(),of.ready.call(e)},ef(this.config.urls.youtube.sdk).catch((function(t){e.debug.warn("YouTube API failed to load",t)}))}},getTitle:function(e){var t=this;Eh(gh(this.config.urls.youtube.api,e)).then((function(e){if(eu(e)){var n=e.title,i=e.height,r=e.width;t.config.title=n,$h.setTitle.call(t),t.embed.ratio=[r,i]}Zu.call(t)})).catch((function(){Zu.call(t)}))},ready:function(){var e=this,t=e.media&&e.media.getAttribute("id");if(du(t)||!t.startsWith("youtube-")){var n=e.media.getAttribute("src");du(n)&&(n=e.media.getAttribute(this.config.attributes.embed.id));var i,r,a=du(i=n)?null:i.match(/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*/)?RegExp.$2:i,o=(r=e.provider,"".concat(r,"-").concat(Math.floor(1e4*Math.random()))),s=Au("div",{id:o,"data-poster":e.poster});e.media=Ou(s,e.media);var l=function(e){return"https://i.ytimg.com/vi/".concat(a,"/").concat(e,"default.jpg")};Kh(l("maxres"),121).catch((function(){return Kh(l("sd"),121)})).catch((function(){return Kh(l("hq"))})).then((function(t){return $h.setPoster.call(e,t.src)})).then((function(t){t.includes("maxres")||(e.elements.poster.style.backgroundSize="cover")})).catch((function(){}));var c=e.config.youtube;e.embed=new window.YT.Player(o,{videoId:a,host:af(c),playerVars:Tu({},{autoplay:e.config.autoplay?1:0,hl:e.config.hl,controls:e.supported.ui?0:1,disablekb:1,playsinline:e.config.fullscreen.iosNative?0:1,cc_load_policy:e.captions.active?1:0,cc_lang_pref:e.config.captions.language,widget_referrer:window?window.location.href:null},c),events:{onError:function(t){if(!e.media.error){var n=t.data,i={2:"The request contains an invalid parameter value. For example, this error occurs if you specify a video ID that does not have 11 characters, or if the video ID contains invalid characters, such as exclamation points or asterisks.",5:"The requested content cannot be played in an HTML5 player or another error related to the HTML5 player has occurred.",100:"The video requested was not found. This error occurs when a video has been removed (for any reason) or has been marked as private.",101:"The owner of the requested video does not allow it to be played in embedded players.",150:"The owner of the requested video does not allow it to be played in embedded players."}[n]||"An unknown error occured";e.media.error={code:n,message:i},Ku.call(e,e.media,"error")}},onPlaybackRateChange:function(t){var n=t.target;e.media.playbackRate=n.getPlaybackRate(),Ku.call(e,e.media,"ratechange")},onReady:function(t){if(!ru(e.media.play)){var n=t.target;of.getTitle.call(e,a),e.media.play=function(){rf.call(e,!0),n.playVideo()},e.media.pause=function(){rf.call(e,!1),n.pauseVideo()},e.media.stop=function(){n.stopVideo()},e.media.duration=n.getDuration(),e.media.paused=!0,e.media.currentTime=0,Object.defineProperty(e.media,"currentTime",{get:function(){return Number(n.getCurrentTime())},set:function(t){e.paused&&!e.embed.hasPlayed&&e.embed.mute(),e.media.seeking=!0,Ku.call(e,e.media,"seeking"),n.seekTo(t)}}),Object.defineProperty(e.media,"playbackRate",{get:function(){return n.getPlaybackRate()},set:function(e){n.setPlaybackRate(e)}});var i=e.config.volume;Object.defineProperty(e.media,"volume",{get:function(){return i},set:function(t){i=t,n.setVolume(100*i),Ku.call(e,e.media,"volumechange")}});var r=e.config.muted;Object.defineProperty(e.media,"muted",{get:function(){return r},set:function(t){var i=iu(t)?t:r;r=i,n[i?"mute":"unMute"](),Ku.call(e,e.media,"volumechange")}}),Object.defineProperty(e.media,"currentSrc",{get:function(){return n.getVideoUrl()}}),Object.defineProperty(e.media,"ended",{get:function(){return e.currentTime===e.duration}});var o=n.getAvailablePlaybackRates();e.options.speed=o.filter((function(t){return e.config.speed.options.includes(t)})),e.supported.ui&&e.media.setAttribute("tabindex",-1),Ku.call(e,e.media,"timeupdate"),Ku.call(e,e.media,"durationchange"),clearInterval(e.timers.buffering),e.timers.buffering=setInterval((function(){e.media.buffered=n.getVideoLoadedFraction(),(null===e.media.lastBuffered||e.media.lastBuffered<e.media.buffered)&&Ku.call(e,e.media,"progress"),e.media.lastBuffered=e.media.buffered,1===e.media.buffered&&(clearInterval(e.timers.buffering),Ku.call(e,e.media,"canplaythrough"))}),200),setTimeout((function(){return $h.build.call(e)}),50)}},onStateChange:function(t){var n=t.target;switch(clearInterval(e.timers.playing),e.media.seeking&&[1,2].includes(t.data)&&(e.media.seeking=!1,Ku.call(e,e.media,"seeked")),t.data){case-1:Ku.call(e,e.media,"timeupdate"),e.media.buffered=n.getVideoLoadedFraction(),Ku.call(e,e.media,"progress");break;case 0:rf.call(e,!1),e.media.loop?(n.stopVideo(),n.playVideo()):Ku.call(e,e.media,"ended");break;case 1:e.config.autoplay||!e.media.paused||e.embed.hasPlayed?(rf.call(e,!0),Ku.call(e,e.media,"playing"),e.timers.playing=setInterval((function(){Ku.call(e,e.media,"timeupdate")}),50),e.media.duration!==n.getDuration()&&(e.media.duration=n.getDuration(),Ku.call(e,e.media,"durationchange"))):e.media.pause();break;case 2:e.muted||e.embed.unMute(),rf.call(e,!1);break;case 3:Ku.call(e,e.media,"waiting")}Ku.call(e,e.elements.container,"statechange",!1,{code:t.data})}}})}}},sf={setup:function(){this.media?(ju(this.elements.container,this.config.classNames.type.replace("{0}",this.type),!0),ju(this.elements.container,this.config.classNames.provider.replace("{0}",this.provider),!0),this.isEmbed&&ju(this.elements.container,this.config.classNames.type.replace("{0}","video"),!0),this.isVideo&&(this.elements.wrapper=Au("div",{class:this.config.classNames.video}),Su(this.media,this.elements.wrapper),this.elements.poster=Au("div",{class:this.config.classNames.poster}),this.elements.wrapper.appendChild(this.elements.poster)),this.isHTML5?eh.setup.call(this):this.isYouTube?of.setup.call(this):this.isVimeo&&nf.setup.call(this)):this.debug.warn("No media element found!")}},lf=function(){function e(t){var n=this;yo(this,e),this.player=t,this.config=t.config.ads,this.playing=!1,this.initialized=!1,this.elements={container:null,displayContainer:null},this.manager=null,this.loader=null,this.cuePoints=null,this.events={},this.safetyTimer=null,this.countdownTimer=null,this.managerPromise=new Promise((function(e,t){n.on("loaded",e),n.on("error",t)})),this.load()}return wo(e,[{key:"load",value:function(){var e=this;this.enabled&&(eu(window.google)&&eu(window.google.ima)?this.ready():ef(this.player.config.urls.googleIMA.sdk).then((function(){e.ready()})).catch((function(){e.trigger("error",new Error("Google IMA SDK failed to load"))})))}},{key:"ready",value:function(){var e,t=this;this.enabled||((e=this).manager&&e.manager.destroy(),e.elements.displayContainer&&e.elements.displayContainer.destroy(),e.elements.container.remove()),this.startSafetyTimer(12e3,"ready()"),this.managerPromise.then((function(){t.clearSafetyTimer("onAdsManagerLoaded()")})),this.listeners(),this.setupIMA()}},{key:"setupIMA",value:function(){var e=this;this.elements.container=Au("div",{class:this.player.config.classNames.ads}),this.player.elements.container.appendChild(this.elements.container),google.ima.settings.setVpaidMode(google.ima.ImaSdkSettings.VpaidMode.ENABLED),google.ima.settings.setLocale(this.player.config.ads.language),google.ima.settings.setDisableCustomPlaybackForIOS10Plus(this.player.config.playsinline),this.elements.displayContainer=new google.ima.AdDisplayContainer(this.elements.container,this.player.media),this.loader=new google.ima.AdsLoader(this.elements.displayContainer),this.loader.addEventListener(google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,(function(t){return e.onAdsManagerLoaded(t)}),!1),this.loader.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR,(function(t){return e.onAdError(t)}),!1),this.requestAds()}},{key:"requestAds",value:function(){var e=this.player.elements.container;try{var t=new google.ima.AdsRequest;t.adTagUrl=this.tagUrl,t.linearAdSlotWidth=e.offsetWidth,t.linearAdSlotHeight=e.offsetHeight,t.nonLinearAdSlotWidth=e.offsetWidth,t.nonLinearAdSlotHeight=e.offsetHeight,t.forceNonLinearFullSlot=!1,t.setAdWillPlayMuted(!this.player.muted),this.loader.requestAds(t)}catch(e){this.onAdError(e)}}},{key:"pollCountdown",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!t)return clearInterval(this.countdownTimer),void this.elements.container.removeAttribute("data-badge-text");var n=function(){var t=Lh(Math.max(e.manager.getRemainingTime(),0)),n="".concat(Th("advertisement",e.player.config)," - ").concat(t);e.elements.container.setAttribute("data-badge-text",n)};this.countdownTimer=setInterval(n,100)}},{key:"onAdsManagerLoaded",value:function(e){var t=this;if(this.enabled){var n=new google.ima.AdsRenderingSettings;n.restoreCustomPlaybackStateOnAdBreakComplete=!0,n.enablePreloading=!0,this.manager=e.getAdsManager(this.player,n),this.cuePoints=this.manager.getCuePoints(),this.manager.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR,(function(e){return t.onAdError(e)})),Object.keys(google.ima.AdEvent.Type).forEach((function(e){t.manager.addEventListener(google.ima.AdEvent.Type[e],(function(e){return t.onAdEvent(e)}))})),this.trigger("loaded")}}},{key:"addCuePoints",value:function(){var e=this;du(this.cuePoints)||this.cuePoints.forEach((function(t){if(0!==t&&-1!==t&&t<e.player.duration){var n=e.player.elements.progress;if(su(n)){var i=100/e.player.duration*t,r=Au("span",{class:e.player.config.classNames.cues});r.style.left="".concat(i.toString(),"%"),n.appendChild(r)}}}))}},{key:"onAdEvent",value:function(e){var t=this,n=this.player.elements.container,i=e.getAd(),r=e.getAdData();switch(function(e){Ku.call(t.player,t.player.media,"ads".concat(e.replace(/_/g,"").toLowerCase()))}(e.type),e.type){case google.ima.AdEvent.Type.LOADED:this.trigger("loaded"),this.pollCountdown(!0),i.isLinear()||(i.width=n.offsetWidth,i.height=n.offsetHeight);break;case google.ima.AdEvent.Type.STARTED:this.manager.setVolume(this.player.volume);break;case google.ima.AdEvent.Type.ALL_ADS_COMPLETED:this.player.ended?this.loadAds():this.loader.contentComplete();break;case google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED:this.pauseContent();break;case google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED:this.pollCountdown(),this.resumeContent();break;case google.ima.AdEvent.Type.LOG:r.adError&&this.player.debug.warn("Non-fatal ad error: ".concat(r.adError.getMessage()))}}},{key:"onAdError",value:function(e){this.cancel(),this.player.debug.warn("Ads error",e)}},{key:"listeners",value:function(){var e,t=this,n=this.player.elements.container;this.player.on("canplay",(function(){t.addCuePoints()})),this.player.on("ended",(function(){t.loader.contentComplete()})),this.player.on("timeupdate",(function(){e=t.player.currentTime})),this.player.on("seeked",(function(){var n=t.player.currentTime;du(t.cuePoints)||t.cuePoints.forEach((function(i,r){e<i&&i<n&&(t.manager.discardAdBreak(),t.cuePoints.splice(r,1))}))})),window.addEventListener("resize",(function(){t.manager&&t.manager.resize(n.offsetWidth,n.offsetHeight,google.ima.ViewMode.NORMAL)}))}},{key:"play",value:function(){var e=this,t=this.player.elements.container;this.managerPromise||this.resumeContent(),this.managerPromise.then((function(){e.manager.setVolume(e.player.volume),e.elements.displayContainer.initialize();try{e.initialized||(e.manager.init(t.offsetWidth,t.offsetHeight,google.ima.ViewMode.NORMAL),e.manager.start()),e.initialized=!0}catch(t){e.onAdError(t)}})).catch((function(){}))}},{key:"resumeContent",value:function(){this.elements.container.style.zIndex="",this.playing=!1,Gu(this.player.media.play())}},{key:"pauseContent",value:function(){this.elements.container.style.zIndex=3,this.playing=!0,this.player.media.pause()}},{key:"cancel",value:function(){this.initialized&&this.resumeContent(),this.trigger("error"),this.loadAds()}},{key:"loadAds",value:function(){var e=this;this.managerPromise.then((function(){e.manager&&e.manager.destroy(),e.managerPromise=new Promise((function(t){e.on("loaded",t),e.player.debug.log(e.manager)})),e.initialized=!1,e.requestAds()})).catch((function(){}))}},{key:"trigger",value:function(e){for(var t=this,n=arguments.length,i=new Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];var a=this.events[e];au(a)&&a.forEach((function(e){ru(e)&&e.apply(t,i)}))}},{key:"on",value:function(e,t){return au(this.events[e])||(this.events[e]=[]),this.events[e].push(t),this}},{key:"startSafetyTimer",value:function(e,t){var n=this;this.player.debug.log("Safety timer invoked from: ".concat(t)),this.safetyTimer=setTimeout((function(){n.cancel(),n.clearSafetyTimer("startSafetyTimer()")}),e)}},{key:"clearSafetyTimer",value:function(e){Zc(this.safetyTimer)||(this.player.debug.log("Safety timer cleared from: ".concat(e)),clearTimeout(this.safetyTimer),this.safetyTimer=null)}},{key:"enabled",get:function(){var e=this.config;return this.player.isHTML5&&this.player.isVideo&&e.enabled&&(!du(e.publisherId)||fu(e.tagUrl))}},{key:"tagUrl",get:function(){var e=this.config;if(fu(e.tagUrl))return e.tagUrl;var t={AV_PUBLISHERID:"58c25bb0073ef448b1087ad6",AV_CHANNELID:"5a0458dc28a06145e4519d21",AV_URL:window.location.hostname,cb:Date.now(),AV_WIDTH:640,AV_HEIGHT:480,AV_CDIM2:e.publisherId};return"".concat("https://go.aniview.com/api/adserver6/vast/","?").concat(Rh(t))}}]),e}(),cf=ct.findIndex,uf=!0,hf=Qt("findIndex");"findIndex"in[]&&Array(1).findIndex((function(){uf=!1})),Ie({target:"Array",proto:!0,forced:uf||!hf},{findIndex:function(e){return cf(this,e,arguments.length>1?arguments[1]:void 0)}}),dn("findIndex");var ff=Math.min,df=[].lastIndexOf,pf=!!df&&1/[1].lastIndexOf(1,-0)<0,mf=$t("lastIndexOf"),gf=Qt("indexOf",{ACCESSORS:!0,1:0}),vf=pf||!mf||!gf?function(e){if(pf)return df.apply(this,arguments)||0;var t=m(this),n=le(t.length),i=n-1;for(arguments.length>1&&(i=ff(i,oe(arguments[1]))),i<0&&(i=n+i);i>=0;i--)if(i in t&&t[i]===e)return i||0;return-1}:df;Ie({target:"Array",proto:!0,forced:vf!==[].lastIndexOf},{lastIndexOf:vf});var yf=function(e,t){var n={};return e>t.width/t.height?(n.width=t.width,n.height=1/e*t.width):(n.height=t.height,n.width=e*t.height),n},bf=function(){function e(t){yo(this,e),this.player=t,this.thumbnails=[],this.loaded=!1,this.lastMouseMoveTime=Date.now(),this.mouseDown=!1,this.loadedImages=[],this.elements={thumb:{},scrubbing:{}},this.load()}return wo(e,[{key:"load",value:function(){var e=this;this.player.elements.display.seekTooltip&&(this.player.elements.display.seekTooltip.hidden=this.enabled),this.enabled&&this.getThumbnails().then((function(){e.enabled&&(e.render(),e.determineContainerAutoSizing(),e.loaded=!0)}))}},{key:"getThumbnails",value:function(){var e=this;return new Promise((function(t){var n=e.player.config.previewThumbnails.src;if(du(n))throw new Error("Missing previewThumbnails.src config attribute");var i=function(){e.thumbnails.sort((function(e,t){return e.height-t.height})),e.player.debug.log("Preview thumbnails",e.thumbnails),t()};if(ru(n))n((function(t){e.thumbnails=t,i()}));else{var r=(nu(n)?[n]:n).map((function(t){return e.getThumbnail(t)}));Promise.all(r).then(i)}}))}},{key:"getThumbnail",value:function(e){var t=this;return new Promise((function(n){Eh(e).then((function(i){var r,a,o={frames:(r=i,a=[],r.split(/\r\n\r\n|\n\n|\r\r/).forEach((function(e){var t={};e.split(/\r\n|\n|\r/).forEach((function(e){if(tu(t.startTime)){if(!du(e.trim())&&du(t.text)){var n=e.trim().split("#xywh="),i=Ao(n,1);if(t.text=i[0],n[1]){var r=Ao(n[1].split(","),4);t.x=r[0],t.y=r[1],t.w=r[2],t.h=r[3]}}}else{var a=e.match(/([0-9]{2})?:?([0-9]{2}):([0-9]{2}).([0-9]{2,3})( ?--> ?)([0-9]{2})?:?([0-9]{2}):([0-9]{2}).([0-9]{2,3})/);a&&(t.startTime=60*Number(a[1]||0)*60+60*Number(a[2])+Number(a[3])+Number("0.".concat(a[4])),t.endTime=60*Number(a[6]||0)*60+60*Number(a[7])+Number(a[8])+Number("0.".concat(a[9])))}})),t.text&&a.push(t)})),a),height:null,urlPrefix:""};o.frames[0].text.startsWith("/")||o.frames[0].text.startsWith("http://")||o.frames[0].text.startsWith("https://")||(o.urlPrefix=e.substring(0,e.lastIndexOf("/")+1));var s=new Image;s.onload=function(){o.height=s.naturalHeight,o.width=s.naturalWidth,t.thumbnails.push(o),n()},s.src=o.urlPrefix+o.frames[0].text}))}))}},{key:"startMove",value:function(e){if(this.loaded&&lu(e)&&["touchmove","mousemove"].includes(e.type)&&this.player.media.duration){if("touchmove"===e.type)this.seekTime=this.player.media.duration*(this.player.elements.inputs.seek.value/100);else{var t=this.player.elements.progress.getBoundingClientRect(),n=100/t.width*(e.pageX-t.left);this.seekTime=this.player.media.duration*(n/100),this.seekTime<0&&(this.seekTime=0),this.seekTime>this.player.media.duration-1&&(this.seekTime=this.player.media.duration-1),this.mousePosX=e.pageX,this.elements.thumb.time.innerText=Lh(this.seekTime)}this.showImageAtCurrentTime()}}},{key:"endMove",value:function(){this.toggleThumbContainer(!1,!0)}},{key:"startScrubbing",value:function(e){(Zc(e.button)||!1===e.button||0===e.button)&&(this.mouseDown=!0,this.player.media.duration&&(this.toggleScrubbingContainer(!0),this.toggleThumbContainer(!1,!0),this.showImageAtCurrentTime()))}},{key:"endScrubbing",value:function(){var e=this;this.mouseDown=!1,Math.ceil(this.lastTime)===Math.ceil(this.player.media.currentTime)?this.toggleScrubbingContainer(!1):Wu.call(this.player,this.player.media,"timeupdate",(function(){e.mouseDown||e.toggleScrubbingContainer(!1)}))}},{key:"listeners",value:function(){var e=this;this.player.on("play",(function(){e.toggleThumbContainer(!1,!0)})),this.player.on("seeked",(function(){e.toggleThumbContainer(!1)})),this.player.on("timeupdate",(function(){e.lastTime=e.player.media.currentTime}))}},{key:"render",value:function(){this.elements.thumb.container=Au("div",{class:this.player.config.classNames.previewThumbnails.thumbContainer}),this.elements.thumb.imageContainer=Au("div",{class:this.player.config.classNames.previewThumbnails.imageContainer}),this.elements.thumb.container.appendChild(this.elements.thumb.imageContainer);var e=Au("div",{class:this.player.config.classNames.previewThumbnails.timeContainer});this.elements.thumb.time=Au("span",{},"00:00"),e.appendChild(this.elements.thumb.time),this.elements.thumb.container.appendChild(e),su(this.player.elements.progress)&&this.player.elements.progress.appendChild(this.elements.thumb.container),this.elements.scrubbing.container=Au("div",{class:this.player.config.classNames.previewThumbnails.scrubbingContainer}),this.player.elements.wrapper.appendChild(this.elements.scrubbing.container)}},{key:"destroy",value:function(){this.elements.thumb.container&&this.elements.thumb.container.remove(),this.elements.scrubbing.container&&this.elements.scrubbing.container.remove()}},{key:"showImageAtCurrentTime",value:function(){var e=this;this.mouseDown?this.setScrubbingContainerSize():this.setThumbContainerSizeAndPos();var t=this.thumbnails[0].frames.findIndex((function(t){return e.seekTime>=t.startTime&&e.seekTime<=t.endTime})),n=t>=0,i=0;this.mouseDown||this.toggleThumbContainer(n),n&&(this.thumbnails.forEach((function(n,r){e.loadedImages.includes(n.frames[t].text)&&(i=r)})),t!==this.showingThumb&&(this.showingThumb=t,this.loadImage(i)))}},{key:"loadImage",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=this.showingThumb,i=this.thumbnails[t],r=i.urlPrefix,a=i.frames[n],o=i.frames[n].text,s=r+o;if(this.currentImageElement&&this.currentImageElement.dataset.filename===o)this.showImage(this.currentImageElement,a,t,n,o,!1),this.currentImageElement.dataset.index=n,this.removeOldImages(this.currentImageElement);else{this.loadingImage&&this.usingSprites&&(this.loadingImage.onload=null);var l=new Image;l.src=s,l.dataset.index=n,l.dataset.filename=o,this.showingThumbFilename=o,this.player.debug.log("Loading image: ".concat(s)),l.onload=function(){return e.showImage(l,a,t,n,o,!0)},this.loadingImage=l,this.removeOldImages(l)}}},{key:"showImage",value:function(e,t,n,i,r){var a=!(arguments.length>5&&void 0!==arguments[5])||arguments[5];this.player.debug.log("Showing thumb: ".concat(r,". num: ").concat(i,". qual: ").concat(n,". newimg: ").concat(a)),this.setImageSizeAndOffset(e,t),a&&(this.currentImageContainer.appendChild(e),this.currentImageElement=e,this.loadedImages.includes(r)||this.loadedImages.push(r)),this.preloadNearby(i,!0).then(this.preloadNearby(i,!1)).then(this.getHigherQuality(n,e,t,r))}},{key:"removeOldImages",value:function(e){var t=this;Array.from(this.currentImageContainer.children).forEach((function(n){if("img"===n.tagName.toLowerCase()){var i=t.usingSprites?500:1e3;if(n.dataset.index!==e.dataset.index&&!n.dataset.deleting){n.dataset.deleting=!0;var r=t.currentImageContainer;setTimeout((function(){r.removeChild(n),t.player.debug.log("Removing thumb: ".concat(n.dataset.filename))}),i)}}}))}},{key:"preloadNearby",value:function(e){var t=this,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return new Promise((function(i){setTimeout((function(){var r=t.thumbnails[0].frames[e].text;if(t.showingThumbFilename===r){var a;a=n?t.thumbnails[0].frames.slice(e):t.thumbnails[0].frames.slice(0,e).reverse();var o=!1;a.forEach((function(e){var n=e.text;if(n!==r&&!t.loadedImages.includes(n)){o=!0,t.player.debug.log("Preloading thumb filename: ".concat(n));var a=t.thumbnails[0].urlPrefix+n,s=new Image;s.src=a,s.onload=function(){t.player.debug.log("Preloaded thumb filename: ".concat(n)),t.loadedImages.includes(n)||t.loadedImages.push(n),i()}}})),o||i()}}),300)}))}},{key:"getHigherQuality",value:function(e,t,n,i){var r=this;if(e<this.thumbnails.length-1){var a=t.naturalHeight;this.usingSprites&&(a=n.h),a<this.thumbContainerHeight&&setTimeout((function(){r.showingThumbFilename===i&&(r.player.debug.log("Showing higher quality thumb for: ".concat(i)),r.loadImage(e+1))}),300)}}},{key:"toggleThumbContainer",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=this.player.config.classNames.previewThumbnails.thumbContainerShown;this.elements.thumb.container.classList.toggle(n,e),!e&&t&&(this.showingThumb=null,this.showingThumbFilename=null)}},{key:"toggleScrubbingContainer",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.player.config.classNames.previewThumbnails.scrubbingContainerShown;this.elements.scrubbing.container.classList.toggle(t,e),e||(this.showingThumb=null,this.showingThumbFilename=null)}},{key:"determineContainerAutoSizing",value:function(){(this.elements.thumb.imageContainer.clientHeight>20||this.elements.thumb.imageContainer.clientWidth>20)&&(this.sizeSpecifiedInCSS=!0)}},{key:"setThumbContainerSizeAndPos",value:function(){if(this.sizeSpecifiedInCSS){if(this.elements.thumb.imageContainer.clientHeight>20&&this.elements.thumb.imageContainer.clientWidth<20){var e=Math.floor(this.elements.thumb.imageContainer.clientHeight*this.thumbAspectRatio);this.elements.thumb.imageContainer.style.width="".concat(e,"px")}else if(this.elements.thumb.imageContainer.clientHeight<20&&this.elements.thumb.imageContainer.clientWidth>20){var t=Math.floor(this.elements.thumb.imageContainer.clientWidth/this.thumbAspectRatio);this.elements.thumb.imageContainer.style.height="".concat(t,"px")}}else{var n=Math.floor(this.thumbContainerHeight*this.thumbAspectRatio);this.elements.thumb.imageContainer.style.height="".concat(this.thumbContainerHeight,"px"),this.elements.thumb.imageContainer.style.width="".concat(n,"px")}this.setThumbContainerPos()}},{key:"setThumbContainerPos",value:function(){var e=this.player.elements.progress.getBoundingClientRect(),t=this.player.elements.container.getBoundingClientRect(),n=this.elements.thumb.container,i=t.left-e.left+10,r=t.right-e.left-n.clientWidth-10,a=this.mousePosX-e.left-n.clientWidth/2;a<i&&(a=i),a>r&&(a=r),n.style.left="".concat(a,"px")}},{key:"setScrubbingContainerSize",value:function(){var e=yf(this.thumbAspectRatio,{width:this.player.media.clientWidth,height:this.player.media.clientHeight}),t=e.width,n=e.height;this.elements.scrubbing.container.style.width="".concat(t,"px"),this.elements.scrubbing.container.style.height="".concat(n,"px")}},{key:"setImageSizeAndOffset",value:function(e,t){if(this.usingSprites){var n=this.thumbContainerHeight/t.h;e.style.height="".concat(e.naturalHeight*n,"px"),e.style.width="".concat(e.naturalWidth*n,"px"),e.style.left="-".concat(t.x*n,"px"),e.style.top="-".concat(t.y*n,"px")}}},{key:"enabled",get:function(){return this.player.isHTML5&&this.player.isVideo&&this.player.config.previewThumbnails.enabled}},{key:"currentImageContainer",get:function(){return this.mouseDown?this.elements.scrubbing.container:this.elements.thumb.imageContainer}},{key:"usingSprites",get:function(){return Object.keys(this.thumbnails[0].frames[0]).includes("w")}},{key:"thumbAspectRatio",get:function(){return this.usingSprites?this.thumbnails[0].frames[0].w/this.thumbnails[0].frames[0].h:this.thumbnails[0].width/this.thumbnails[0].height}},{key:"thumbContainerHeight",get:function(){return this.mouseDown?yf(this.thumbAspectRatio,{width:this.player.media.clientWidth,height:this.player.media.clientHeight}).height:this.sizeSpecifiedInCSS?this.elements.thumb.imageContainer.clientHeight:Math.floor(this.player.media.clientWidth/this.thumbAspectRatio/4)}},{key:"currentImageElement",get:function(){return this.mouseDown?this.currentScrubbingImageElement:this.currentThumbnailImageElement},set:function(e){this.mouseDown?this.currentScrubbingImageElement=e:this.currentThumbnailImageElement=e}}]),e}(),wf={insertElements:function(e,t){var n=this;nu(t)?Pu(e,this.media,{src:t}):au(t)&&t.forEach((function(t){Pu(e,n.media,t)}))},change:function(e){var t=this;ku(e,"sources.length")?(eh.cancelRequests.call(this),this.destroy.call(this,(function(){t.options.quality=[],xu(t.media),t.media=null,su(t.elements.container)&&t.elements.container.removeAttribute("class");var n=e.sources,i=e.type,r=Ao(n,1)[0],a=r.provider,o=void 0===a?Fh.html5:a,s=r.src,l="html5"===o?i:"div",c="html5"===o?{}:{src:s};Object.assign(t,{provider:o,type:i,supported:qu.check(i,o,t.config.playsinline),media:Au(l,c)}),t.elements.container.appendChild(t.media),iu(e.autoplay)&&(t.config.autoplay=e.autoplay),t.isHTML5&&(t.config.crossorigin&&t.media.setAttribute("crossorigin",""),t.config.autoplay&&t.media.setAttribute("autoplay",""),du(e.poster)||(t.poster=e.poster),t.config.loop.active&&t.media.setAttribute("loop",""),t.config.muted&&t.media.setAttribute("muted",""),t.config.playsinline&&t.media.setAttribute("playsinline","")),$h.addStyleHook.call(t),t.isHTML5&&wf.insertElements.call(t,"source",n),t.config.title=e.title,sf.setup.call(t),t.isHTML5&&Object.keys(e).includes("tracks")&&wf.insertElements.call(t,"track",e.tracks),(t.isHTML5||t.isEmbed&&!t.supported.ui)&&$h.build.call(t),t.isHTML5&&t.media.load(),du(e.previewThumbnails)||(Object.assign(t.config.previewThumbnails,e.previewThumbnails),t.previewThumbnails&&t.previewThumbnails.loaded&&(t.previewThumbnails.destroy(),t.previewThumbnails=null),t.config.previewThumbnails.enabled&&(t.previewThumbnails=new bf(t))),t.fullscreen.update()}),!0)):this.debug.warn("Invalid source format")}};var kf,Tf=function(){function e(t,n){var i=this;if(yo(this,e),this.timers={},this.ready=!1,this.loading=!1,this.failed=!1,this.touch=qu.touch,this.media=t,nu(this.media)&&(this.media=document.querySelectorAll(this.media)),(window.jQuery&&this.media instanceof jQuery||ou(this.media)||au(this.media))&&(this.media=this.media[0]),this.config=Tu({},_h,e.defaults,n||{},function(){try{return JSON.parse(i.media.getAttribute("data-plyr-config"))}catch(e){return{}}}()),this.elements={container:null,fullscreen:null,captions:null,buttons:{},display:{},progress:{},inputs:{},settings:{popup:null,menu:null,panels:{},buttons:{}}},this.captions={active:null,currentTrack:-1,meta:new WeakMap},this.fullscreen={active:!1},this.options={speed:[],quality:[]},this.debug=new Vh(this.config.debug),this.debug.log("Config",this.config),this.debug.log("Support",qu),!Zc(this.media)&&su(this.media))if(this.media.plyr)this.debug.warn("Target already setup");else if(this.config.enabled)if(qu.check().api){var r=this.media.cloneNode(!0);r.autoplay=!1,this.elements.original=r;var a=this.media.tagName.toLowerCase(),o=null,s=null;switch(a){case"div":if(o=this.media.querySelector("iframe"),su(o)){if(s=Nh(o.getAttribute("src")),this.provider=function(e){return/^(https?:\/\/)?(www\.)?(youtube\.com|youtube-nocookie\.com|youtu\.?be)\/.+$/.test(e)?Fh.youtube:/^https?:\/\/player.vimeo.com\/video\/\d{0,9}(?=\b|\/)/.test(e)?Fh.vimeo:null}(s.toString()),this.elements.container=this.media,this.media=o,this.elements.container.className="",s.search.length){var l=["1","true"];l.includes(s.searchParams.get("autoplay"))&&(this.config.autoplay=!0),l.includes(s.searchParams.get("loop"))&&(this.config.loop.active=!0),this.isYouTube?(this.config.playsinline=l.includes(s.searchParams.get("playsinline")),this.config.youtube.hl=s.searchParams.get("hl")):this.config.playsinline=!0}}else this.provider=this.media.getAttribute(this.config.attributes.embed.provider),this.media.removeAttribute(this.config.attributes.embed.provider);if(du(this.provider)||!Object.keys(Fh).includes(this.provider))return void this.debug.error("Setup failed: Invalid provider");this.type=Hh;break;case"video":case"audio":this.type=a,this.provider=Fh.html5,this.media.hasAttribute("crossorigin")&&(this.config.crossorigin=!0),this.media.hasAttribute("autoplay")&&(this.config.autoplay=!0),(this.media.hasAttribute("playsinline")||this.media.hasAttribute("webkit-playsinline"))&&(this.config.playsinline=!0),this.media.hasAttribute("muted")&&(this.config.muted=!0),this.media.hasAttribute("loop")&&(this.config.loop.active=!0);break;default:return void this.debug.error("Setup failed: unsupported type")}this.supported=qu.check(this.type,this.provider,this.config.playsinline),this.supported.api?(this.eventListeners=[],this.listeners=new Yh(this),this.storage=new Sh(this),this.media.plyr=this,su(this.elements.container)||(this.elements.container=Au("div",{tabindex:0}),Su(this.media,this.elements.container)),$h.migrateStyles.call(this),$h.addStyleHook.call(this),sf.setup.call(this),this.config.debug&&Vu.call(this,this.elements.container,this.config.events.join(" "),(function(e){i.debug.log("event: ".concat(e.type))})),this.fullscreen=new zh(this),(this.isHTML5||this.isEmbed&&!this.supported.ui)&&$h.build.call(this),this.listeners.container(),this.listeners.global(),this.config.ads.enabled&&(this.ads=new lf(this)),this.isHTML5&&this.config.autoplay&&setTimeout((function(){return Gu(i.play())}),10),this.lastSeekTime=0,this.config.previewThumbnails.enabled&&(this.previewThumbnails=new bf(this))):this.debug.error("Setup failed: no support")}else this.debug.error("Setup failed: no support");else this.debug.error("Setup failed: disabled by config");else this.debug.error("Setup failed: no suitable element passed")}return wo(e,[{key:"play",value:function(){var e=this;return ru(this.media.play)?(this.ads&&this.ads.enabled&&this.ads.managerPromise.then((function(){return e.ads.play()})).catch((function(){return Gu(e.media.play())})),this.media.play()):null}},{key:"pause",value:function(){return this.playing&&ru(this.media.pause)?this.media.pause():null}},{key:"togglePlay",value:function(e){return(iu(e)?e:!this.playing)?this.play():this.pause()}},{key:"stop",value:function(){this.isHTML5?(this.pause(),this.restart()):ru(this.media.stop)&&this.media.stop()}},{key:"restart",value:function(){this.currentTime=0}},{key:"rewind",value:function(e){this.currentTime-=tu(e)?e:this.config.seekTime}},{key:"forward",value:function(e){this.currentTime+=tu(e)?e:this.config.seekTime}},{key:"increaseVolume",value:function(e){var t=this.media.muted?0:this.volume;this.volume=t+(tu(e)?e:0)}},{key:"decreaseVolume",value:function(e){this.increaseVolume(-e)}},{key:"toggleCaptions",value:function(e){Mh.toggle.call(this,e,!1)}},{key:"airplay",value:function(){qu.airplay&&this.media.webkitShowPlaybackTargetPicker()}},{key:"toggleControls",value:function(e){if(this.supported.ui&&!this.isAudio){var t=Nu(this.elements.container,this.config.classNames.hideControls),n=void 0===e?void 0:!e,i=ju(this.elements.container,this.config.classNames.hideControls,n);if(i&&au(this.config.controls)&&this.config.controls.includes("settings")&&!du(this.config.settings)&&jh.toggleMenu.call(this,!1),i!==t){var r=i?"controlshidden":"controlsshown";Ku.call(this,this.media,r)}return!i}return!1}},{key:"on",value:function(e,t){Vu.call(this,this.elements.container,e,t)}},{key:"once",value:function(e,t){Wu.call(this,this.elements.container,e,t)}},{key:"off",value:function(e,t){zu(this.elements.container,e,t)}},{key:"destroy",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this.ready){var i=function(){document.body.style.overflow="",t.embed=null,n?(Object.keys(t.elements).length&&(xu(t.elements.buttons.play),xu(t.elements.captions),xu(t.elements.controls),xu(t.elements.wrapper),t.elements.buttons.play=null,t.elements.captions=null,t.elements.controls=null,t.elements.wrapper=null),ru(e)&&e()):($u.call(t),Ou(t.elements.original,t.elements.container),Ku.call(t,t.elements.original,"destroyed",!0),ru(e)&&e.call(t.elements.original),t.ready=!1,setTimeout((function(){t.elements=null,t.media=null}),200))};this.stop(),clearTimeout(this.timers.loading),clearTimeout(this.timers.controls),clearTimeout(this.timers.resized),this.isHTML5?($h.toggleNativeControls.call(this,!0),i()):this.isYouTube?(clearInterval(this.timers.buffering),clearInterval(this.timers.playing),null!==this.embed&&ru(this.embed.destroy)&&this.embed.destroy(),i()):this.isVimeo&&(null!==this.embed&&this.embed.unload().then(i),setTimeout(i,200))}}},{key:"supports",value:function(e){return qu.mime.call(this,e)}},{key:"isHTML5",get:function(){return this.provider===Fh.html5}},{key:"isEmbed",get:function(){return this.isYouTube||this.isVimeo}},{key:"isYouTube",get:function(){return this.provider===Fh.youtube}},{key:"isVimeo",get:function(){return this.provider===Fh.vimeo}},{key:"isVideo",get:function(){return this.type===Hh}},{key:"isAudio",get:function(){return this.type===qh}},{key:"playing",get:function(){return Boolean(this.ready&&!this.paused&&!this.ended)}},{key:"paused",get:function(){return Boolean(this.media.paused)}},{key:"stopped",get:function(){return Boolean(this.paused&&0===this.currentTime)}},{key:"ended",get:function(){return Boolean(this.media.ended)}},{key:"currentTime",set:function(e){if(this.duration){var t=tu(e)&&e>0;this.media.currentTime=t?Math.min(e,this.duration):0,this.debug.log("Seeking to ".concat(this.currentTime," seconds"))}},get:function(){return Number(this.media.currentTime)}},{key:"buffered",get:function(){var e=this.media.buffered;return tu(e)?e:e&&e.length&&this.duration>0?e.end(0)/this.duration:0}},{key:"seeking",get:function(){return Boolean(this.media.seeking)}},{key:"duration",get:function(){var e=parseFloat(this.config.duration),t=(this.media||{}).duration,n=tu(t)&&t!==1/0?t:0;return e||n}},{key:"volume",set:function(e){var t=e;nu(t)&&(t=Number(t)),tu(t)||(t=this.storage.get("volume")),tu(t)||(t=this.config.volume),t>1&&(t=1),t<0&&(t=0),this.config.volume=t,this.media.volume=t,!du(e)&&this.muted&&t>0&&(this.muted=!1)},get:function(){return Number(this.media.volume)}},{key:"muted",set:function(e){var t=e;iu(t)||(t=this.storage.get("muted")),iu(t)||(t=this.config.muted),this.config.muted=t,this.media.muted=t},get:function(){return Boolean(this.media.muted)}},{key:"hasAudio",get:function(){return!this.isHTML5||(!!this.isAudio||(Boolean(this.media.mozHasAudio)||Boolean(this.media.webkitAudioDecodedByteCount)||Boolean(this.media.audioTracks&&this.media.audioTracks.length)))}},{key:"speed",set:function(e){var t=this,n=null;tu(e)&&(n=e),tu(n)||(n=this.storage.get("speed")),tu(n)||(n=this.config.speed.selected);var i=this.minimumSpeed,r=this.maximumSpeed;n=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:255;return Math.min(Math.max(e,t),n)}(n,i,r),this.config.speed.selected=n,setTimeout((function(){t.media.playbackRate=n}),0)},get:function(){return Number(this.media.playbackRate)}},{key:"minimumSpeed",get:function(){return this.isYouTube?Math.min.apply(Math,Po(this.options.speed)):this.isVimeo?.5:.0625}},{key:"maximumSpeed",get:function(){return this.isYouTube?Math.max.apply(Math,Po(this.options.speed)):this.isVimeo?2:16}},{key:"quality",set:function(e){var t=this.config.quality,n=this.options.quality;if(n.length){var i=[!du(e)&&Number(e),this.storage.get("quality"),t.selected,t.default].find(tu),r=!0;if(!n.includes(i)){var a=function(e,t){return au(e)&&e.length?e.reduce((function(e,n){return Math.abs(n-t)<Math.abs(e-t)?n:e})):null}(n,i);this.debug.warn("Unsupported quality option: ".concat(i,", using ").concat(a," instead")),i=a,r=!1}t.selected=i,this.media.quality=i,r&&this.storage.set({quality:i})}},get:function(){return this.media.quality}},{key:"loop",set:function(e){var t=iu(e)?e:this.config.loop.active;this.config.loop.active=t,this.media.loop=t},get:function(){return Boolean(this.media.loop)}},{key:"source",set:function(e){wf.change.call(this,e)},get:function(){return this.media.currentSrc}},{key:"download",get:function(){var e=this.config.urls.download;return fu(e)?e:this.source},set:function(e){fu(e)&&(this.config.urls.download=e,jh.setDownloadUrl.call(this))}},{key:"poster",set:function(e){this.isVideo?$h.setPoster.call(this,e,!1).catch((function(){})):this.debug.warn("Poster can only be set for video")},get:function(){return this.isVideo?this.media.getAttribute("poster")||this.media.getAttribute("data-poster"):null}},{key:"ratio",get:function(){if(!this.isVideo)return null;var e=Qu(Ju.call(this));return au(e)?e.join(":"):e},set:function(e){this.isVideo?nu(e)&&Xu(e)?(this.config.ratio=e,Zu.call(this)):this.debug.error("Invalid aspect ratio specified (".concat(e,")")):this.debug.warn("Aspect ratio can only be set for video")}},{key:"autoplay",set:function(e){var t=iu(e)?e:this.config.autoplay;this.config.autoplay=t},get:function(){return Boolean(this.config.autoplay)}},{key:"currentTrack",set:function(e){Mh.set.call(this,e,!1)},get:function(){var e=this.captions,t=e.toggled,n=e.currentTrack;return t?n:-1}},{key:"language",set:function(e){Mh.setLanguage.call(this,e,!1)},get:function(){return(Mh.getCurrentTrack.call(this)||{}).language}},{key:"pip",set:function(e){if(qu.pip){var t=iu(e)?e:!this.pip;ru(this.media.webkitSetPresentationMode)&&this.media.webkitSetPresentationMode(t?Uh:Dh),ru(this.media.requestPictureInPicture)&&(!this.pip&&t?this.media.requestPictureInPicture():this.pip&&!t&&document.exitPictureInPicture())}},get:function(){return qu.pip?du(this.media.webkitPresentationMode)?this.media===document.pictureInPictureElement:this.media.webkitPresentationMode===Uh:null}}],[{key:"supported",value:function(e,t,n){return qu.check(e,t,n)}},{key:"loadSprite",value:function(e,t){return Ah(e,t)}},{key:"setup",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=null;return nu(t)?i=Array.from(document.querySelectorAll(t)):ou(t)?i=Array.from(t):au(t)&&(i=t.filter(su)),du(i)?null:i.map((function(t){return new e(t,n)}))}}]),e}();return Tf.defaults=(kf=_h,JSON.parse(JSON.stringify(kf))),Tf}));
+//# sourceMappingURL=plyr.polyfilled.min.js.map
diff --git a/youtube/static/modules/plyr/plyr.polyfilled.min.js.map b/youtube/static/modules/plyr/plyr.polyfilled.min.js.map
new file mode 100644
index 0000000..19be540
--- /dev/null
+++ b/youtube/static/modules/plyr/plyr.polyfilled.min.js.map
@@ -0,0 +1 @@
+{"version":3,"sources":["plyr.polyfilled.js","node_modules/custom-event-polyfill/polyfill.js","node_modules/core-js/internals/global.js","node_modules/core-js/internals/fails.js","node_modules/core-js/internals/descriptors.js","node_modules/core-js/internals/object-property-is-enumerable.js","node_modules/core-js/internals/create-property-descriptor.js","node_modules/core-js/internals/classof-raw.js","node_modules/core-js/internals/indexed-object.js","node_modules/core-js/internals/require-object-coercible.js","node_modules/core-js/internals/to-indexed-object.js","node_modules/core-js/internals/is-object.js","node_modules/core-js/internals/to-primitive.js","node_modules/core-js/internals/has.js","node_modules/core-js/internals/document-create-element.js","node_modules/core-js/internals/ie8-dom-define.js","node_modules/core-js/internals/object-get-own-property-descriptor.js","node_modules/core-js/internals/an-object.js","node_modules/core-js/internals/object-define-property.js","node_modules/core-js/internals/create-non-enumerable-property.js","node_modules/core-js/internals/set-global.js","node_modules/core-js/internals/shared-store.js","node_modules/core-js/internals/inspect-source.js","node_modules/core-js/internals/internal-state.js","node_modules/core-js/internals/native-weak-map.js","node_modules/core-js/internals/shared.js","node_modules/core-js/internals/uid.js","node_modules/core-js/internals/shared-key.js","node_modules/core-js/internals/hidden-keys.js","node_modules/core-js/internals/object-create.js","node_modules/core-js/internals/redefine.js","node_modules/core-js/internals/path.js","node_modules/core-js/internals/get-built-in.js","node_modules/core-js/internals/to-integer.js","node_modules/core-js/internals/to-length.js","node_modules/core-js/internals/to-absolute-index.js","node_modules/core-js/internals/array-includes.js","node_modules/core-js/internals/object-keys-internal.js","node_modules/core-js/internals/enum-bug-keys.js","node_modules/core-js/internals/object-get-own-property-names.js","node_modules/core-js/internals/object-get-own-property-symbols.js","node_modules/core-js/internals/own-keys.js","node_modules/core-js/internals/copy-constructor-properties.js","node_modules/core-js/internals/is-forced.js","node_modules/core-js/internals/export.js","node_modules/core-js/internals/native-symbol.js","node_modules/core-js/internals/use-symbol-as-uid.js","node_modules/core-js/internals/is-array.js","node_modules/core-js/internals/to-object.js","node_modules/core-js/internals/object-keys.js","node_modules/core-js/internals/object-define-properties.js","node_modules/core-js/internals/html.js","node_modules/core-js/internals/object-get-own-property-names-external.js","node_modules/core-js/internals/well-known-symbol.js","node_modules/core-js/internals/well-known-symbol-wrapped.js","node_modules/core-js/internals/define-well-known-symbol.js","node_modules/core-js/internals/set-to-string-tag.js","node_modules/core-js/internals/a-function.js","node_modules/core-js/internals/function-bind-context.js","node_modules/core-js/internals/array-species-create.js","node_modules/core-js/internals/array-iteration.js","node_modules/core-js/modules/es.symbol.js","node_modules/core-js/modules/es.symbol.description.js","node_modules/core-js/modules/es.symbol.iterator.js","node_modules/core-js/internals/array-method-is-strict.js","node_modules/core-js/internals/array-method-uses-to-length.js","node_modules/core-js/internals/array-for-each.js","node_modules/core-js/modules/es.array.for-each.js","node_modules/core-js/modules/es.array.index-of.js","node_modules/core-js/internals/add-to-unscopables.js","node_modules/core-js/internals/iterators-core.js","node_modules/core-js/internals/iterators.js","node_modules/core-js/internals/correct-prototype-getter.js","node_modules/core-js/internals/object-get-prototype-of.js","node_modules/core-js/internals/create-iterator-constructor.js","node_modules/core-js/internals/object-set-prototype-of.js","node_modules/core-js/internals/a-possible-prototype.js","node_modules/core-js/internals/define-iterator.js","node_modules/core-js/modules/es.array.iterator.js","node_modules/core-js/modules/es.array.join.js","node_modules/core-js/internals/create-property.js","node_modules/core-js/internals/engine-v8-version.js","node_modules/core-js/internals/engine-user-agent.js","node_modules/core-js/internals/array-method-has-species-support.js","node_modules/core-js/modules/es.array.slice.js","node_modules/core-js/internals/to-string-tag-support.js","node_modules/core-js/internals/classof.js","node_modules/core-js/internals/object-to-string.js","node_modules/core-js/modules/es.object.to-string.js","node_modules/core-js/internals/regexp-flags.js","node_modules/core-js/internals/regexp-sticky-helpers.js","node_modules/core-js/internals/regexp-exec.js","node_modules/core-js/modules/es.regexp.exec.js","node_modules/core-js/modules/es.regexp.to-string.js","node_modules/core-js/internals/string-multibyte.js","node_modules/core-js/modules/es.string.iterator.js","node_modules/core-js/internals/fix-regexp-well-known-symbol-logic.js","node_modules/core-js/internals/advance-string-index.js","node_modules/core-js/internals/regexp-exec-abstract.js","node_modules/core-js/modules/es.string.replace.js","node_modules/core-js/internals/same-value.js","node_modules/core-js/modules/es.string.search.js","node_modules/core-js/internals/is-regexp.js","node_modules/core-js/internals/species-constructor.js","node_modules/core-js/modules/es.string.split.js","node_modules/core-js/internals/dom-iterables.js","node_modules/core-js/modules/web.dom-collections.for-each.js","node_modules/core-js/modules/web.dom-collections.iterator.js","node_modules/core-js/internals/native-url.js","node_modules/core-js/internals/an-instance.js","node_modules/core-js/internals/object-assign.js","node_modules/core-js/internals/call-with-safe-iteration-closing.js","node_modules/core-js/internals/is-array-iterator-method.js","node_modules/core-js/internals/get-iterator-method.js","node_modules/core-js/internals/array-from.js","node_modules/core-js/internals/string-punycode-to-ascii.js","node_modules/core-js/internals/redefine-all.js","node_modules/core-js/internals/get-iterator.js","node_modules/core-js/modules/web.url-search-params.js","node_modules/core-js/modules/web.url.js","node_modules/url-polyfill/url-polyfill.js","node_modules/core-js/modules/es.array.concat.js","node_modules/core-js/modules/es.array.filter.js","node_modules/core-js/modules/es.array.find.js","node_modules/core-js/internals/check-correctness-of-iteration.js","node_modules/core-js/modules/es.array.from.js","node_modules/core-js/modules/es.array.includes.js","node_modules/core-js/modules/es.array.map.js","node_modules/core-js/internals/inherit-if-required.js","node_modules/core-js/internals/whitespaces.js","node_modules/core-js/internals/string-trim.js","node_modules/core-js/modules/es.number.constructor.js","node_modules/core-js/modules/es.object.keys.js","node_modules/core-js/internals/not-a-regexp.js","node_modules/core-js/internals/correct-is-regexp-logic.js","node_modules/core-js/modules/es.string.includes.js","node_modules/core-js/internals/freezing.js","node_modules/core-js/internals/internal-metadata.js","node_modules/core-js/internals/iterate.js","node_modules/core-js/internals/collection-weak.js","node_modules/core-js/modules/es.array.every.js","node_modules/core-js/modules/es.weak-map.js","node_modules/core-js/internals/collection.js","node_modules/core-js/modules/es.object.assign.js","node_modules/core-js/internals/string-trim-forced.js","node_modules/core-js/modules/es.string.trim.js","node_modules/core-js/modules/es.array.some.js","node_modules/core-js/internals/this-number-value.js","node_modules/core-js/internals/string-repeat.js","node_modules/core-js/modules/es.number.to-fixed.js","node_modules/core-js/internals/object-to-array.js","node_modules/core-js/modules/es.object.entries.js","node_modules/core-js/modules/es.object.values.js","node_modules/core-js/modules/es.number.is-nan.js","node_modules/core-js/modules/es.object.get-own-property-descriptor.js","node_modules/rangetouch/dist/rangetouch.mjs","node_modules/core-js/modules/es.object.get-own-property-descriptors.js","node_modules/core-js/modules/es.string.match.js","node_modules/core-js/internals/task.js","node_modules/core-js/internals/native-promise-constructor.js","node_modules/core-js/internals/set-species.js","node_modules/core-js/internals/engine-is-ios.js","node_modules/core-js/internals/microtask.js","node_modules/core-js/modules/es.promise.js","node_modules/core-js/internals/new-promise-capability.js","node_modules/core-js/internals/promise-resolve.js","node_modules/core-js/internals/perform.js","node_modules/core-js/internals/host-report-errors.js","node_modules/core-js/modules/es.string.starts-with.js","src/js/utils/is.js","src/js/utils/animation.js","src/js/utils/browser.js","node_modules/core-js/internals/array-reduce.js","node_modules/core-js/modules/es.array.reduce.js","src/js/utils/objects.js","src/js/utils/elements.js","src/js/support.js","src/js/utils/events.js","src/js/utils/promise.js","src/js/utils/style.js","src/js/html5.js","src/js/utils/arrays.js","node_modules/core-js/modules/es.regexp.constructor.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","node_modules/core-js/modules/es.math.trunc.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","node_modules/core-js/internals/math-sign.js","src/js/utils/load-image.js","node_modules/core-js/modules/es.math.sign.js","src/js/ui.js","src/js/listeners.js","node_modules/core-js/modules/es.array.splice.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","node_modules/core-js/modules/es.array.find-index.js","node_modules/core-js/internals/array-last-index-of.js","node_modules/core-js/modules/es.array.last-index-of.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","window","ce","CustomEvent","cancelable","preventDefault","defaultPrevented","Error","e","event","params","evt","origPrevent","bubbles","document","createEvent","initCustomEvent","detail","call","Object","defineProperty","get","prototype","Event","commonjsGlobal","globalThis","createCommonjsModule","fn","check","it","Math","global_1","Function","fails","exec","error","descriptors","nativePropertyIsEnumerable","propertyIsEnumerable","getOwnPropertyDescriptor","objectPropertyIsEnumerable","f","1","V","descriptor","enumerable","createPropertyDescriptor","bitmap","value","configurable","writable","toString","classofRaw","slice","split","indexedObject","classof","requireObjectCoercible","undefined","TypeError","toIndexedObject","IndexedObject","isObject","toPrimitive","input","PREFERRED_STRING","val","valueOf","hasOwnProperty","has","key","EXISTS","createElement","documentCreateElement","ie8DomDefine","DESCRIPTORS","a","nativeGetOwnPropertyDescriptor","objectGetOwnPropertyDescriptor","O","P","IE8_DOM_DEFINE","propertyIsEnumerableModule","anObject","String","nativeDefineProperty","objectDefineProperty","Attributes","createNonEnumerableProperty","object","definePropertyModule","setGlobal","sharedStore","functionToString","store","inspectSource","set","WeakMap","nativeWeakMap","test","shared","push","version","mode","copyright","id","postfix","random","uid","keys","sharedKey","hiddenKeys","NATIVE_WEAK_MAP","wmget","wmhas","wmset","metadata","STATE","objectHas","activeXDocument","internalState","enforce","getterFor","TYPE","state","type","redefine","getInternalState","InternalStateModule","enforceInternalState","TEMPLATE","options","unsafe","simple","noTargetGet","source","join","path","aFunction","variable","getBuiltIn","namespace","method","arguments","length","ceil","floor","toInteger","argument","isNaN","min","toLength","max","toAbsoluteIndex","index","integer","createMethod","IS_INCLUDES","$this","el","fromIndex","arrayIncludes","includes","indexOf","require$$0","objectKeysInternal","names","i","result","enumBugKeys","concat","objectGetOwnPropertyNames","getOwnPropertyNames","internalObjectKeys","objectGetOwnPropertySymbols","getOwnPropertySymbols","ownKeys","getOwnPropertyNamesModule","getOwnPropertySymbolsModule","copyConstructorProperties","target","getOwnPropertyDescriptorModule","replacement","isForced","feature","detection","data","normalize","POLYFILL","NATIVE","string","replace","toLowerCase","isForced_1","_export","targetProperty","sourceProperty","TARGET","GLOBAL","STATIC","stat","forced","sham","nativeSymbol","Symbol","useSymbolAsUid","NATIVE_SYMBOL","iterator","isArray","Array","arg","toObject","objectKeys","objectDefineProperties","defineProperties","Properties","html","IE_PROTO","EmptyConstructor","scriptTag","content","LT","NullProtoObject","domain","ActiveXObject","iframeDocument","iframe","write","close","temp","parentWindow","NullProtoObjectViaActiveX","style","display","appendChild","src","contentWindow","open","F","objectCreate","create","nativeGetOwnPropertyNames","windowNames","objectGetOwnPropertyNamesExternal","getWindowNames","WellKnownSymbolsStore","createWellKnownSymbol","USE_SYMBOL_AS_UID","withoutSetter","wellKnownSymbol","name","wellKnownSymbolWrapped","defineWellKnownSymbol","NAME","wrappedWellKnownSymbolModule","TO_STRING_TAG","setToStringTag","TAG","aFunction$1","functionBindContext","that","b","c","apply","SPECIES","arraySpeciesCreate","originalArray","C","constructor","IS_MAP","IS_FILTER","IS_SOME","IS_EVERY","IS_FIND_INDEX","NO_HOLES","callbackfn","specificCreate","boundFunction","bind","arrayIteration","forEach","map","filter","some","every","find","findIndex","$forEach","HIDDEN","TO_PRIMITIVE","setInternalState","ObjectPrototype","$Symbol","$stringify","getOwnPropertyNamesExternal","AllSymbols","ObjectPrototypeSymbols","StringToSymbolRegistry","SymbolToStringRegistry","QObject","USE_SETTER","findChild","setSymbolDescriptor","nativeObjectCreate","ObjectPrototypeDescriptor","wrap","tag","description","symbol","isSymbol","$defineProperty","$defineProperties","properties","$getOwnPropertySymbols","$propertyIsEnumerable","$getOwnPropertyDescriptor","$getOwnPropertyNames","IS_OBJECT_PROTOTYPE","setter","$","for","keyFor","sym","useSetter","useSimple","FORCED_JSON_STRINGIFY","stringify","replacer","space","$replacer","args","NativeSymbol","EmptyStringDescriptionStore","SymbolWrapper","symbolPrototype","symbolToString","native","regexp","desc","arrayMethodIsStrict","METHOD_NAME","cache","thrower","arrayMethodUsesToLength","ACCESSORS","argument0","argument1","STRICT_METHOD","USES_TO_LENGTH","arrayForEach","proto","$indexOf","nativeIndexOf","NEGATIVE_ZERO","searchElement","UNSCOPABLES","ArrayPrototype","IteratorPrototype","PrototypeOfArrayIteratorPrototype","arrayIterator","addToUnscopables","iterators","correctPrototypeGetter","getPrototypeOf","objectGetPrototypeOf","CORRECT_PROTOTYPE_GETTER","ITERATOR","BUGGY_SAFARI_ITERATORS","iteratorsCore","returnThis","createIteratorConstructor","IteratorConstructor","next","Iterators","objectSetPrototypeOf","setPrototypeOf","CORRECT_SETTER","aPossiblePrototype","__proto__","IteratorsCore","defineIterator","Iterable","DEFAULT","IS_SET","FORCED","CurrentIteratorPrototype","methods","KEY","getIterationMethod","KIND","defaultIterator","IterablePrototype","INCORRECT_VALUES_NAME","nativeIterator","anyNativeIterator","entries","values","es_array_iterator","iterated","kind","done","Arguments","nativeJoin","ES3_STRINGS","separator","match","createProperty","propertyKey","engineUserAgent","process","versions","v8","userAgent","engineV8Version","arrayMethodHasSpeciesSupport","V8_VERSION","array","foo","Boolean","HAS_SPECIES_SUPPORT","0","nativeSlice","start","end","Constructor","n","k","fin","toStringTagSupport","CORRECT_ARGUMENTS","TO_STRING_TAG_SUPPORT","tryGet","callee","objectToString","regexpFlags","ignoreCase","multiline","dotAll","unicode","sticky","RE","s","RegExp","regexpStickyHelpers","UNSUPPORTED_Y","re","lastIndex","BROKEN_CARET","nativeExec","nativeReplace","patchedExec","UPDATES_LAST_INDEX_WRONG","re1","re2","stickyHelpers","NPCG_INCLUDED","str","reCopy","flags","charsAdded","strCopy","regexpExec","RegExpPrototype","nativeToString","NOT_GENERIC","INCORRECT_NAME","R","p","rf","CONVERT_TO_STRING","pos","first","second","S","position","size","charCodeAt","charAt","stringMultibyte","codeAt","point","REPLACE_SUPPORTS_NAMED_GROUPS","groups","REPLACE_KEEPS_$0","REPLACE","REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE","SPLIT_WORKS_WITH_OVERWRITTEN_EXEC","originalExec","fixRegexpWellKnownSymbolLogic","SYMBOL","DELEGATES_TO_SYMBOL","DELEGATES_TO_EXEC","execCalled","nativeRegExpMethod","nativeMethod","arg2","forceStringMethod","stringMethod","regexMethod","advanceStringIndex","regexpExecAbstract","SUBSTITUTION_SYMBOLS","SUBSTITUTION_SYMBOLS_NO_NAMED","fixRegExpWellKnownSymbolLogic","maybeCallNative","reason","UNSAFE_SUBSTITUTE","searchValue","replaceValue","res","rx","functionalReplace","fullUnicode","results","regExpExec","accumulatedResult","nextSourcePosition","matched","captures","j","namedCaptures","replacerArgs","getSubstitution","tailPos","m","symbols","ch","capture","sameValue","is","x","y","SEARCH","nativeSearch","searcher","previousLastIndex","MATCH","isRegexp","isRegExp","speciesConstructor","defaultConstructor","arrayPush","SUPPORTS_Y","SPLIT","nativeSplit","internalSplit","limit","lim","lastLength","output","lastLastIndex","separatorCopy","splitter","unicodeMatching","callRegExpExec","q","A","z","domIterables","CSSRuleList","CSSStyleDeclaration","CSSValueList","ClientRectList","DOMRectList","DOMStringList","DOMTokenList","DataTransferItemList","FileList","HTMLAllCollection","HTMLCollection","HTMLFormElement","HTMLSelectElement","MediaList","MimeTypeArray","NamedNodeMap","NodeList","PaintRequestList","Plugin","PluginArray","SVGLengthList","SVGNumberList","SVGPathSegList","SVGPointList","SVGStringList","SVGTransformList","SourceBufferList","StyleSheetList","TextTrackCueList","TextTrackList","TouchList","COLLECTION_NAME","DOMIterables","Collection","CollectionPrototype","ArrayValues","ArrayIteratorMethods","nativeUrl","url","URL","searchParams","pathname","sort","href","URLSearchParams","username","host","hash","anInstance","nativeAssign","assign","objectAssign","B","chr","T","argumentsLength","callWithSafeIterationClosing","ENTRIES","returnMethod","isArrayIteratorMethod","getIteratorMethod","arrayFrom","arrayLike","step","mapfn","mapping","iteratorMethod","regexNonASCII","regexSeparators","OVERFLOW_ERROR","stringFromCharCode","fromCharCode","digitToBasic","digit","adapt","delta","numPoints","firstTime","baseMinusTMin","base","encode","currentValue","inputLength","counter","extra","ucs2decode","bias","basicLength","handledCPCount","handledCPCountPlusOne","RangeError","t","qMinusT","baseMinusT","redefineAll","getIterator","$fetch","Headers","getInternalParamsState","getInternalIteratorState","URL_SEARCH_PARAMS","plus","sequences","percentSequence","bytes","percentDecode","sequence","decodeURIComponent","deserialize","!","'","(",")","~","%20","serialize","encodeURIComponent","parseSearchParams","query","attribute","entry","attributes","shift","updateSearchParams","validateArgumentsLength","passed","required","URLSearchParamsIterator","URLSearchParamsConstructor","entryIterator","entryNext","init","updateURL","hasOwn","URLSearchParamsPrototype","append","delete","splice","getAll","found","entriesIndex","sliceIndex","callback","USE_NATIVE_URL","fetch","body","headers","EOF","web_urlSearchParams","getState","require$$1","NativeURL","URLSearchParamsModule","getInternalSearchParamsState","getInternalURLState","pow","ALPHA","ALPHANUMERIC","DIGIT","HEX_START","OCT","DEC","HEX","FORBIDDEN_HOST_CODE_POINT","FORBIDDEN_HOST_CODE_POINT_EXCLUDING_PERCENT","LEADING_AND_TRAILING_C0_CONTROL_OR_SPACE","TAB_AND_NEW_LINE","parseHost","codePoints","parseIPv6","isSpecial","label","encoded","labels","toASCII","parseIPv4","percentEncode","C0ControlPercentEncodeSet","partsLength","numbers","part","radix","number","ipv4","parts","pop","parseInt","numbersSeen","ipv4Piece","swaps","swap","address","pieceIndex","compress","pointer","char","serializeHost","ignore0","unshift","ipv6","maxIndex","maxLength","currStart","currLength","findLongestZeroSequence","fragmentPercentEncodeSet"," ","\"","<",">","`","pathPercentEncodeSet","#","?","{","}","userinfoPercentEncodeSet","/",":",";","=","@","[","\\","]","^","|","code","specialSchemes","ftp","file","http","https","ws","wss","scheme","includesCredentials","password","cannotHaveUsernamePasswordPort","cannotBeABaseURL","isWindowsDriveLetter","normalized","startsWithWindowsDriveLetter","third","shortenURLsPath","pathSize","isSingleDot","segment","SCHEME_START","SCHEME","NO_SCHEME","SPECIAL_RELATIVE_OR_AUTHORITY","PATH_OR_AUTHORITY","RELATIVE","RELATIVE_SLASH","SPECIAL_AUTHORITY_SLASHES","SPECIAL_AUTHORITY_IGNORE_SLASHES","AUTHORITY","HOST","HOSTNAME","PORT","FILE","FILE_SLASH","FILE_HOST","PATH_START","PATH","CANNOT_BE_A_BASE_URL_PATH","QUERY","FRAGMENT","parseURL","stateOverride","bufferCodePoints","failure","buffer","seenAt","seenBracket","seenPasswordToken","port","fragment","codePoint","encodedCodePoints","URLConstructor","baseState","urlString","searchParamsState","serializeURL","origin","getOrigin","protocol","getProtocol","getUsername","getPassword","getHost","hostname","getHostname","getPort","getPathname","search","getSearch","getSearchParams","getHash","URLPrototype","accessorDescriptor","getter","nativeCreateObjectURL","createObjectURL","nativeRevokeObjectURL","revokeObjectURL","blob","_typeof","obj","_classCallCheck","instance","_defineProperties","props","_createClass","protoProps","staticProps","_defineProperty","ownKeys$1","enumerableOnly","_objectSpread2","getOwnPropertyDescriptors","_objectWithoutProperties","excluded","sourceKeys","_objectWithoutPropertiesLoose","sourceSymbolKeys","_slicedToArray","arr","_arrayWithHoles","_arr","_n","_d","_e","_s","_i","err","_iterableToArrayLimit","_unsupportedIterableToArray","_nonIterableRest","_toConsumableArray","_arrayLikeToArray","_arrayWithoutHoles","iter","from","_iterableToArray","_nonIterableSpread","o","minLen","len","arr2","iteratorSupported","checkIfIteratorIsSupported","createIterator","items","serializeParam","deserializeParam","checkIfURLSearchParamsSupported","searchString","typeofSearchString","_fromString","_this","_entries","thisArg","searchArray","polyfillURLSearchParams","u","checkIfURLIsSupported","_URL","baseElement","doc","location","implementation","createHTMLDocument","head","anchorElement","inputElement","checkValidity","enableSearchUpdate","enableSearchParamsUpdate","methodName","attributeName","_anchorElement","linkURLWithAnchorAttribute","_updateSearchParams","expectedPort","http:","https:","ftp:","addPortToOrigin","polyfillURL","setInterval","IS_CONCAT_SPREADABLE","IS_CONCAT_SPREADABLE_SUPPORT","SPECIES_SUPPORT","isConcatSpreadable","spreadable","E","$filter","$find","SKIPS_HOLES","SAFE_CLOSING","called","iteratorWithReturn","return","checkCorrectnessOfIteration","SKIP_CLOSING","ITERATION_SUPPORT","INCORRECT_ITERATION","iterable","$includes","$map","inheritIfRequired","dummy","Wrapper","NewTarget","NewTargetPrototype","whitespaces","whitespace","ltrim","rtrim","stringTrim","trim","require$$2","require$$3","NativeNumber","NumberPrototype","BROKEN_CLASSOF","toNumber","maxCode","digits","NaN","NumberWrapper","FAILS_ON_PRIMITIVES","nativeKeys","notARegexp","correctIsRegexpLogic","correctIsRegExpLogic","notARegExp","freezing","isExtensible","preventExtensions","internalMetadata","METADATA","setMetadata","objectID","weakData","meta","REQUIRED","fastKey","getWeakData","onFreeze","FREEZING","iterate_1","Result","stopped","AS_ENTRIES","IS_ITERATOR","iterFn","stop","internalStateGetterFor","ArrayIterationModule","uncaughtFrozenStore","frozen","UncaughtFrozenStore","findUncaughtFrozen","collectionWeak","getConstructor","wrapper","CONSTRUCTOR_NAME","ADDER","iterate","$has","add","$every","InternalWeakMap","enforceIternalState","IS_IE11","$WeakMap","common","IS_WEAK","NativeConstructor","NativePrototype","exported","fixMethod","InternalMetadataModule","HASNT_CHAINING","THROWS_ON_PRIMITIVES","ACCEPT_ITERABLES","BUGGY_ZERO","$instance","clear","setStrong","collection","WeakMapPrototype","nativeDelete","nativeHas","nativeGet","nativeSet","$trim","forcedStringTrimMethod","$some","stringRepeat","repeat","count","Infinity","nativeToFixed","toFixed","acc","fractionDigits","thisNumberValue","fractDigits","sign","multiply","c2","divide","dataToString","x2","log","TO_ENTRIES","objectToArray","$entries","$values","r","nativeMatch","matcher","matchStr","defaults","addCSS","thumbWidth","watch","matches","querySelectorAll","instanceOf","isNullOrUndefined","isString","isNodeList","Element","round","getDecimalPlaces","parseFloat","defer","channel","RangeTouch","element","querySelector","rangeTouch","config","enabled","userSelect","webKitUserSelect","touchAction","listeners","changedTouches","getAttribute","getBoundingClientRect","width","clientX","left","disabled","dispatchEvent","trigger","MutationObserver","addedNodes","observe","childList","subtree","documentElement","nativePromiseConstructor","Promise","setSpecies","engineIsIos","setImmediate","clearImmediate","MessageChannel","Dispatch","queue","run","runner","listener","post","postMessage","nextTick","now","IS_IOS","port2","port1","onmessage","addEventListener","importScripts","removeChild","setTimeout","flush","last","notify","toggle","node","promise","then","task","macrotask","WebKitMutationObserver","IS_NODE","queueMicrotaskDescriptor","queueMicrotask","parent","exit","enter","createTextNode","characterData","resolve","Internal","OwnPromiseCapability","PromiseWrapper","nativeThen","microtask","PromiseCapability","reject","$$resolve","$$reject","newPromiseCapability","promiseResolve","promiseCapability","perform","PROMISE","getInternalPromiseState","PromiseConstructor","NativePromise","newPromiseCapabilityModule","newGenericPromiseCapability","DISPATCH_EVENT","PromiseRejectionEvent","FakePromise","all","isThenable","isReject","notified","chain","reactions","ok","exited","reaction","handler","fail","rejection","onHandleUnhandled","onUnhandled","initEvent","console","hostReportErrors","isUnhandled","emit","unwrap","internalReject","internalResolve","executor","onFulfilled","onRejected","catch","capability","$promiseResolve","remaining","alreadyCalled","race","nativeStartsWith","startsWith","CORRECT_IS_REGEXP_LOGIC","MDN_POLYFILL_BUG","events","isFunction","isEmpty","is$1","Number","KeyboardEvent","TextTrack","transitionEndEvent","WebkitTransition","MozTransition","OTransition","transition","repaint","delay","hidden","offsetHeight","browser","isIE","documentMode","isEdge","isWebkit","isIPhone","platform","isIos","IS_RIGHT","memo","$reduce","right","getDeep","reduce","extend","_len","sources","_key","elements","targets","reverse","child","cloneNode","parentNode","sibling","nextSibling","insertBefore","setAttributes","_ref","_ref3","_ref4","setAttribute","text","innerText","insertElement","removeElement","emptyElement","childNodes","lastChild","replaceElement","newChild","oldChild","replaceChild","getAttributesFromSelector","sel","existingAttributes","existing","selector","className","class","toggleHidden","hide","toggleClass","force","classList","contains","hasClass","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","getElements","container","getElement","setFocus","tabFocus","focus","preventScroll","classNames","range","defaultCodecs","audio/ogg","audio/wav","video/webm","video/mp4","video/ogg","support","audio","video","provider","playsinline","canPlayInline","api","ui","rangeInput","pip","webkitSetPresentationMode","pictureInPictureEnabled","disablePictureInPicture","airplay","WebKitPlaybackTargetAvailabilityEvent","mime","mediaType","isHTML5","media","canPlayType","textTracks","touch","transitions","reducedMotion","matchMedia","supportsPassiveListeners","supported","removeEventListener","toggleListener","passive","eventListeners","on","off","once","_this2","onceCallback","triggerEvent","plyr","unbindListeners","item","ready","_this3","silencePromise","validateRatio","reduceAspectRatio","ratio","_ratio","height","divider","getDivider","w","h","getAspectRatio","parse","embed","_this$media","videoWidth","videoHeight","setAspectRatio","isVideo","_ref2","padding","paddingBottom","isVimeo","vimeo","premium","offsetWidth","getComputedStyle","offset","transform","videoFixedRatio","html5","getSources","getQualityOptions","quality","setup","player","speed","onChange","_player$media","currentTime","paused","preload","readyState","playbackRate","play","load","cancelRequests","blankVideo","debug","dedupe","NativeRegExp","CORRECT_NEW","RegExpWrapper","pattern","thisIsRegExp","patternIsRegExp","flagsAreUndefined","getFlags","proxy","format","replaceAll","toTitleCase","toUpperCase","substr","toPascalCase","getHTML","innerHTML","resources","youtube","i18n","{seektime}","seekTime","{title}","title","v","Storage","storage","localStorage","getItem","json","JSON","setItem","removeItem","responseType","request","XMLHttpRequest","responseText","response","status","send","loadSprite","hasId","exists","getElementById","update","insertAdjacentElement","useStorage","cached","trunc","getHours","getMinutes","getSeconds","formatTime","time","displayHours","inverted","hours","mins","secs","controls","getIconUrl","cors","iconUrl","svg4everybody","findElements","selectors","buttons","pause","restart","rewind","fastForward","mute","settings","captions","fullscreen","progress","inputs","seek","volume","duration","seekTooltip","tooltip","warn","toggleNativeControls","createIcon","iconPath","iconPrefix","icon","createElementNS","aria-hidden","focusable","use","setAttributeNS","createLabel","attr","createBadge","badge","menu","createButton","buttonType","toCamelCase","labelPressed","iconPressed","control","button","createRange","autocomplete","role","aria-label","aria-valuemin","aria-valuemax","aria-valuenow","updateRangeFill","createProgress","suffixKey","played","suffix","createTime","attrs","bindMenuItemShortcuts","menuItem","which","stopPropagation","isRadioButton","showMenuPanel","nextElementSibling","firstElementChild","previousElementSibling","lastElementChild","focusFirstMenuItem","createMenuItem","list","_ref$badge","_ref$checked","checked","aria-checked","flex","children","currentTrack","forceHours","updateTimeDisplay","updateVolume","setRange","muted","pressed","updateProgress","_this4","current","getPercentage","getElementsByTagName","nodeValue","setProgress","buffered","percent","setProperty","updateSeekTooltip","_this5","tooltips","visible","show","clientRect","pageX","timeUpdate","invert","invertTime","seeking","durationUpdate","hasDuration","displayDuration","toggleMenuButton","setting","updateSetting","pane","panels","default","getLabel","setQualityMenu","_this6","checkMenu","getBadge","sorting","setCaptionsMenu","_this7","tracks","getTracks","track","toggled","language","setSpeedMenu","_this8","minimumSpeed","maximumSpeed","popup","firstItem","toggleMenu","composedPath","isMenuItem","getMenuSize","tab","clone","opacity","removeAttribute","scrollWidth","scrollHeight","_this9","restore","propertyName","setDownloadUrl","download","_this10","defaultAttributes","progressContainer","aria-haspopup","aria-controls","aria-expanded","inner","home","backButton","urls","isEmbed","inject","_this11","seektime","addProperty","controlPressed","_this$config","parseUrl","safe","parser","buildUrlParams","isYouTube","insertAfter","languages","userLanguage","active","trackEvents","_this$captions","currentTrackNode","languageExists","updateCues","setLanguage","activeClass","findTrack","enableTextTrack","sortIsDefault","sorted","getCurrentTrack","cues","activeCues","cue","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","reset","advertisement","qualityBadge","2160","1440","1080","720","576","480","sdk","googleIMA","editable","embedContainer","poster","posterEnabled","ads","playing","loading","hover","isTouch","uiSupported","noTransition","previewThumbnails","thumbContainer","thumbContainerShown","imageContainer","timeContainer","scrubbingContainer","scrubbingContainerShown","publisherId","tagUrl","byline","portrait","transparent","referrerPolicy","noCookie","rel","showinfo","iv_load_policy","modestbranding","providers","types","noop","Console","Fullscreen","prefix","property","scrollPosition","forceFallback","closest","parentElement","nodeType","trapFocus","scrollX","scrollY","scrollTo","overflow","viewport","hasProperty","cleanupViewport","keyCode","activeElement","shiftKey","webkitEnterFullscreen","toggleFallback","requestFullscreen","navigationUI","webkitExitFullscreen","action","cancelFullScreen","fullscreenElement","shadowRoot","getRootNode","fullscreenEnabled","webkitFullscreenEnabled","mozFullScreenEnabled","msFullscreenEnabled","pre","mathSign","loadImage","minWidth","image","Image","onload","onerror","naturalWidth","addStyleHook","build","checkPlaying","setTitle","setPoster","togglePoster","enable","backgroundImage","backgroundSize","toggleControls","checkLoading","clearTimeout","timers","controlsElement","recentTouchSeek","lastSeekTime","Date","migrateStyles","getPropertyValue","removeProperty","Listeners","lastKey","focusTimer","lastKeyDown","handleKey","setTabFocus","firstTouch","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","isAudio","ended","proxyEvents","_event$detail","defaultHandler","customHandlerKey","customHandler","returned","hasCustomHandler","inputEvent","currentTarget","hasAttribute","seekTo","loaded","startMove","endMove","startScrubbing","endScrubbing","webkitDirectionInvertedFromDevice","_map2","deltaX","deltaY","direction","abs","deleteCount","insertCount","actualDeleteCount","to","actualStart","loadjs_umd","devnull","bundleIdCache","bundleResultCache","bundleCallbackQueue","publish","bundleId","pathsNotFound","executeCallbacks","depsNotFound","success","loadFile","callbackFn","numTries","isLegacyIECss","async","maxTries","numRetries","beforeCallbackFn","before","pathStripped","relList","as","onbeforeload","ev","sheet","cssText","loadjs","paths","arg1","loadFn","numWaiting","loadFiles","returnPromise","deps","bundleIds","subscribe","isDefined","loadScript","assurePlaybackState","hasPlayed","Vimeo","frameParams","sidedock","gesture","$2","data-poster","thumbnail_large","Player","disableTextTrack","restorePause","setVolume","setCurrentTime","setPlaybackRate","currentSrc","setLoop","getVideoUrl","getVideoWidth","getVideoHeight","dimensions","_dimensions","setAutopause","getVideoTitle","getCurrentTime","getDuration","getTextTracks","_ref$cues","strippedCues","createDocumentFragment","stripHTML","getPaused","seconds","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","getPlaybackRate","onReady","playVideo","pauseVideo","stopVideo","speeds","getAvailablePlaybackRates","clearInterval","buffering","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","AdsLoader","AdsManagerLoadedEvent","Type","ADS_MANAGER_LOADED","onAdsManagerLoaded","AdErrorEvent","AD_ERROR","onAdError","requestAds","AdsRequest","adTagUrl","linearAdSlotWidth","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","contentComplete","CONTENT_PAUSE_REQUESTED","pauseContent","CONTENT_RESUME_REQUESTED","resumeContent","LOG","adError","getMessage","cancel","addCuePoints","seekedTime","discardAdBreak","resize","ViewMode","NORMAL","initialize","zIndex","_this12","handlers","_this13","AV_PUBLISHERID","AV_CHANNELID","AV_URL","cb","AV_WIDTH","AV_HEIGHT","AV_CDIM2","$findIndex","nativeLastIndexOf","lastIndexOf","arrayLastIndexOf","fitRatio","outer","PreviewThumbnails","thumbnails","lastMouseMoveTime","mouseDown","loadedImages","thumb","scrubbing","getThumbnails","render","determineContainerAutoSizing","sortAndResolve","promises","getThumbnail","vttDataString","processedList","thumbnail","frames","frame","line","startTime","lineSplit","_lineSplit","_lineSplit$1$split2","matchTimes","endTime","urlPrefix","substring","tempImage","naturalHeight","percentage","mousePosX","showImageAtCurrentTime","toggleThumbContainer","toggleScrubbingContainer","lastTime","setScrubbingContainerSize","setThumbContainerSizeAndPos","thumbNum","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","clientWidth","sizeSpecifiedInCSS","thumbAspectRatio","thumbHeight","setThumbContainerPos","seekbarRect","plyrRect","minVal","maxVal","previewPos","_fitRatio","multiplier","top","currentScrubbingImageElement","currentThumbnailImageElement","insertElements","change","_sources$","_sources$$provider","crossorigin","failed","jQuery","original","getProviderByUrl","truthy","tabindex","webkitShowPlaybackTargetPicker","isHidden","hiding","eventName","soft","unload","inputIsValid","fauxDuration","realDuration","mozHasAudio","webkitAudioDecodedByteCount","audioTracks","clamp","updateStorage","prev","curr","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,MAAM,WAAe,cCEvB,WACE,GAAsB,oBAAXC,OAIX,IACE,IAAIC,EAAK,IAAID,OAAOE,YAAY,OAAQ,CAAEC,YAAY,IAEtD,GADAF,EAAGG,kBACyB,IAAxBH,EAAGI,iBAGL,MAAM,IAAIC,MAAM,6BAElB,MAAOC,GACP,IAAIL,EAAc,SAASM,EAAOC,GAChC,IAAIC,EAAKC,EAyBT,OAxBAF,EAASA,GAAU,IACZG,UAAYH,EAAOG,QAC1BH,EAAON,aAAeM,EAAON,YAE7BO,EAAMG,SAASC,YAAY,gBACvBC,gBACFP,EACAC,EAAOG,QACPH,EAAON,WACPM,EAAOO,QAETL,EAAcD,EAAIN,eAClBM,EAAIN,eAAiB,WACnBO,EAAYM,KAAKlB,MACjB,IACEmB,OAAOC,eAAepB,KAAM,mBAAoB,CAC9CqB,IAAK,WACH,OAAO,KAGX,MAAOb,GACPR,KAAKM,kBAAmB,IAGrBK,GAGTR,EAAYmB,UAAYrB,OAAOsB,MAAMD,UACrCrB,OAAOE,YAAcA,GA5CzB,GDoDE,IAAIqB,EAAuC,oBAAfC,WAA6BA,WAA+B,oBAAXxB,OAAyBA,OAA2B,oBAAXT,OAAyBA,OAAyB,oBAATM,KAAuBA,KAAO,GAE7L,SAAS4B,EAAqBC,EAAIhC,GACjC,OAAiCgC,EAA1BhC,EAAS,CAAED,QAAS,IAAiBC,EAAOD,SAAU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AAMurB,KAAK13B,SAASsjC,iBAAiBuM,IACtC1vB,GAAY0vB,GACrB5B,EAAU9hC,MAAMurB,KAAKmY,GACZ1vB,GAAS0vB,KAClB5B,EAAU4B,EAASj/B,OAAOuP,KAGxBA,GAAS8tB,GACJ,KAGFA,EAAQt9B,KAAI,SAAAiX,GAAC,OAAI,IAAI3oB,EAAK2oB,EAAGvgB,UvNqqc7BpI,EuNj2eLA,GvNw2eJ,OuNxqcFA,GAAKgkC,UzC/tCqBt+B,GyC+tCAs+B,GzC9tCjBiW,KAAKpE,MAAMoE,KAAK1lC,UAAU7O,M9Ks4e1B1F","file":"plyr.polyfilled.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 // Polyfill for creating CustomEvents on IE9/10/11\n // code pulled from:\n // https://github.com/d4tocchini/customevent-polyfill\n // https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent#Polyfill\n (function () {\n if (typeof window === 'undefined') {\n return;\n }\n\n try {\n var ce = new window.CustomEvent('test', {\n cancelable: true\n });\n ce.preventDefault();\n\n if (ce.defaultPrevented !== true) {\n // IE has problems with .preventDefault() on custom events\n // http://stackoverflow.com/questions/23349191\n throw new Error('Could not prevent default');\n }\n } catch (e) {\n var CustomEvent = function CustomEvent(event, params) {\n var evt, origPrevent;\n params = params || {};\n params.bubbles = !!params.bubbles;\n params.cancelable = !!params.cancelable;\n evt = document.createEvent('CustomEvent');\n evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);\n origPrevent = evt.preventDefault;\n\n evt.preventDefault = function () {\n origPrevent.call(this);\n\n try {\n Object.defineProperty(this, 'defaultPrevented', {\n get: function get() {\n return true;\n }\n });\n } catch (e) {\n this.defaultPrevented = true;\n }\n };\n\n return evt;\n };\n\n CustomEvent.prototype = window.Event.prototype;\n window.CustomEvent = CustomEvent; // expose definition to window\n }\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 check = function (it) {\n return it && it.Math == Math && it;\n };\n\n // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028\n var global_1 =\n // eslint-disable-next-line no-undef\n check(typeof globalThis == 'object' && globalThis) ||\n check(typeof window == 'object' && window) ||\n check(typeof self == 'object' && self) ||\n check(typeof commonjsGlobal == 'object' && commonjsGlobal) ||\n // eslint-disable-next-line no-new-func\n Function('return this')();\n\n var fails = function (exec) {\n try {\n return !!exec();\n } catch (error) {\n return true;\n }\n };\n\n // Thank's IE8 for his funny defineProperty\n var descriptors = !fails(function () {\n return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7;\n });\n\n var nativePropertyIsEnumerable = {}.propertyIsEnumerable;\n var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;\n\n // Nashorn ~ JDK8 bug\n var NASHORN_BUG = getOwnPropertyDescriptor && !nativePropertyIsEnumerable.call({ 1: 2 }, 1);\n\n // `Object.prototype.propertyIsEnumerable` method implementation\n // https://tc39.github.io/ecma262/#sec-object.prototype.propertyisenumerable\n var f = NASHORN_BUG ? function propertyIsEnumerable(V) {\n var descriptor = getOwnPropertyDescriptor(this, V);\n return !!descriptor && descriptor.enumerable;\n } : nativePropertyIsEnumerable;\n\n var objectPropertyIsEnumerable = {\n \tf: f\n };\n\n var createPropertyDescriptor = function (bitmap, value) {\n return {\n enumerable: !(bitmap & 1),\n configurable: !(bitmap & 2),\n writable: !(bitmap & 4),\n value: value\n };\n };\n\n var toString = {}.toString;\n\n var classofRaw = function (it) {\n return toString.call(it).slice(8, -1);\n };\n\n var split = ''.split;\n\n // fallback for non-array-like ES3 and non-enumerable old V8 strings\n var indexedObject = fails(function () {\n // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346\n // eslint-disable-next-line no-prototype-builtins\n return !Object('z').propertyIsEnumerable(0);\n }) ? function (it) {\n return classofRaw(it) == 'String' ? split.call(it, '') : Object(it);\n } : Object;\n\n // `RequireObjectCoercible` abstract operation\n // https://tc39.github.io/ecma262/#sec-requireobjectcoercible\n var requireObjectCoercible = function (it) {\n if (it == undefined) throw TypeError(\"Can't call method on \" + it);\n return it;\n };\n\n // toObject with fallback for non-array-like ES3 strings\n\n\n\n var toIndexedObject = function (it) {\n return indexedObject(requireObjectCoercible(it));\n };\n\n var isObject = function (it) {\n return typeof it === 'object' ? it !== null : typeof it === 'function';\n };\n\n // `ToPrimitive` abstract operation\n // https://tc39.github.io/ecma262/#sec-toprimitive\n // instead of the ES6 spec version, we didn't implement @@toPrimitive case\n // and the second argument - flag - preferred type is a string\n var toPrimitive = function (input, PREFERRED_STRING) {\n if (!isObject(input)) return input;\n var fn, val;\n if (PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;\n if (typeof (fn = input.valueOf) == 'function' && !isObject(val = fn.call(input))) return val;\n if (!PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;\n throw TypeError(\"Can't convert object to primitive value\");\n };\n\n var hasOwnProperty = {}.hasOwnProperty;\n\n var has = function (it, key) {\n return hasOwnProperty.call(it, key);\n };\n\n var document$1 = global_1.document;\n // typeof document.createElement is 'object' in old IE\n var EXISTS = isObject(document$1) && isObject(document$1.createElement);\n\n var documentCreateElement = function (it) {\n return EXISTS ? document$1.createElement(it) : {};\n };\n\n // Thank's IE8 for his funny defineProperty\n var ie8DomDefine = !descriptors && !fails(function () {\n return Object.defineProperty(documentCreateElement('div'), 'a', {\n get: function () { return 7; }\n }).a != 7;\n });\n\n var nativeGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;\n\n // `Object.getOwnPropertyDescriptor` method\n // https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptor\n var f$1 = descriptors ? nativeGetOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {\n O = toIndexedObject(O);\n P = toPrimitive(P, true);\n if (ie8DomDefine) try {\n return nativeGetOwnPropertyDescriptor(O, P);\n } catch (error) { /* empty */ }\n if (has(O, P)) return createPropertyDescriptor(!objectPropertyIsEnumerable.f.call(O, P), O[P]);\n };\n\n var objectGetOwnPropertyDescriptor = {\n \tf: f$1\n };\n\n var anObject = function (it) {\n if (!isObject(it)) {\n throw TypeError(String(it) + ' is not an object');\n } return it;\n };\n\n var nativeDefineProperty = Object.defineProperty;\n\n // `Object.defineProperty` method\n // https://tc39.github.io/ecma262/#sec-object.defineproperty\n var f$2 = descriptors ? nativeDefineProperty : function defineProperty(O, P, Attributes) {\n anObject(O);\n P = toPrimitive(P, true);\n anObject(Attributes);\n if (ie8DomDefine) try {\n return nativeDefineProperty(O, P, Attributes);\n } catch (error) { /* empty */ }\n if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported');\n if ('value' in Attributes) O[P] = Attributes.value;\n return O;\n };\n\n var objectDefineProperty = {\n \tf: f$2\n };\n\n var createNonEnumerableProperty = descriptors ? function (object, key, value) {\n return objectDefineProperty.f(object, key, createPropertyDescriptor(1, value));\n } : function (object, key, value) {\n object[key] = value;\n return object;\n };\n\n var setGlobal = function (key, value) {\n try {\n createNonEnumerableProperty(global_1, key, value);\n } catch (error) {\n global_1[key] = value;\n } return value;\n };\n\n var SHARED = '__core-js_shared__';\n var store = global_1[SHARED] || setGlobal(SHARED, {});\n\n var sharedStore = store;\n\n var functionToString = Function.toString;\n\n // this helper broken in `3.4.1-3.4.4`, so we can't use `shared` helper\n if (typeof sharedStore.inspectSource != 'function') {\n sharedStore.inspectSource = function (it) {\n return functionToString.call(it);\n };\n }\n\n var inspectSource = sharedStore.inspectSource;\n\n var WeakMap$1 = global_1.WeakMap;\n\n var nativeWeakMap = typeof WeakMap$1 === 'function' && /native code/.test(inspectSource(WeakMap$1));\n\n var isPure = false;\n\n var shared = createCommonjsModule(function (module) {\n (module.exports = function (key, value) {\n return sharedStore[key] || (sharedStore[key] = value !== undefined ? value : {});\n })('versions', []).push({\n version: '3.6.5',\n mode: 'global',\n copyright: '© 2020 Denis Pushkarev (zloirock.ru)'\n });\n });\n\n var id = 0;\n var postfix = Math.random();\n\n var uid = function (key) {\n return 'Symbol(' + String(key === undefined ? '' : key) + ')_' + (++id + postfix).toString(36);\n };\n\n var keys = shared('keys');\n\n var sharedKey = function (key) {\n return keys[key] || (keys[key] = uid(key));\n };\n\n var hiddenKeys = {};\n\n var WeakMap$2 = global_1.WeakMap;\n var set, get, has$1;\n\n var enforce = function (it) {\n return has$1(it) ? get(it) : set(it, {});\n };\n\n var getterFor = function (TYPE) {\n return function (it) {\n var state;\n if (!isObject(it) || (state = get(it)).type !== TYPE) {\n throw TypeError('Incompatible receiver, ' + TYPE + ' required');\n } return state;\n };\n };\n\n if (nativeWeakMap) {\n var store$1 = new WeakMap$2();\n var wmget = store$1.get;\n var wmhas = store$1.has;\n var wmset = store$1.set;\n set = function (it, metadata) {\n wmset.call(store$1, it, metadata);\n return metadata;\n };\n get = function (it) {\n return wmget.call(store$1, it) || {};\n };\n has$1 = function (it) {\n return wmhas.call(store$1, it);\n };\n } else {\n var STATE = sharedKey('state');\n hiddenKeys[STATE] = true;\n set = function (it, metadata) {\n createNonEnumerableProperty(it, STATE, metadata);\n return metadata;\n };\n get = function (it) {\n return has(it, STATE) ? it[STATE] : {};\n };\n has$1 = function (it) {\n return has(it, STATE);\n };\n }\n\n var internalState = {\n set: set,\n get: get,\n has: has$1,\n enforce: enforce,\n getterFor: getterFor\n };\n\n var redefine = createCommonjsModule(function (module) {\n var getInternalState = internalState.get;\n var enforceInternalState = internalState.enforce;\n var TEMPLATE = String(String).split('String');\n\n (module.exports = function (O, key, value, options) {\n var unsafe = options ? !!options.unsafe : false;\n var simple = options ? !!options.enumerable : false;\n var noTargetGet = options ? !!options.noTargetGet : false;\n if (typeof value == 'function') {\n if (typeof key == 'string' && !has(value, 'name')) createNonEnumerableProperty(value, 'name', key);\n enforceInternalState(value).source = TEMPLATE.join(typeof key == 'string' ? key : '');\n }\n if (O === global_1) {\n if (simple) O[key] = value;\n else setGlobal(key, value);\n return;\n } else if (!unsafe) {\n delete O[key];\n } else if (!noTargetGet && O[key]) {\n simple = true;\n }\n if (simple) O[key] = value;\n else createNonEnumerableProperty(O, key, value);\n // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative\n })(Function.prototype, 'toString', function toString() {\n return typeof this == 'function' && getInternalState(this).source || inspectSource(this);\n });\n });\n\n var path = global_1;\n\n var aFunction = function (variable) {\n return typeof variable == 'function' ? variable : undefined;\n };\n\n var getBuiltIn = function (namespace, method) {\n return arguments.length < 2 ? aFunction(path[namespace]) || aFunction(global_1[namespace])\n : path[namespace] && path[namespace][method] || global_1[namespace] && global_1[namespace][method];\n };\n\n var ceil = Math.ceil;\n var floor = Math.floor;\n\n // `ToInteger` abstract operation\n // https://tc39.github.io/ecma262/#sec-tointeger\n var toInteger = function (argument) {\n return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor : ceil)(argument);\n };\n\n var min = Math.min;\n\n // `ToLength` abstract operation\n // https://tc39.github.io/ecma262/#sec-tolength\n var toLength = function (argument) {\n return argument > 0 ? min(toInteger(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991\n };\n\n var max = Math.max;\n var min$1 = Math.min;\n\n // Helper for a popular repeating case of the spec:\n // Let integer be ? ToInteger(index).\n // If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).\n var toAbsoluteIndex = function (index, length) {\n var integer = toInteger(index);\n return integer < 0 ? max(integer + length, 0) : min$1(integer, length);\n };\n\n // `Array.prototype.{ indexOf, includes }` methods implementation\n var createMethod = function (IS_INCLUDES) {\n return function ($this, el, fromIndex) {\n var O = toIndexedObject($this);\n var length = toLength(O.length);\n var index = toAbsoluteIndex(fromIndex, length);\n var value;\n // Array#includes uses SameValueZero equality algorithm\n // eslint-disable-next-line no-self-compare\n if (IS_INCLUDES && el != el) while (length > index) {\n value = O[index++];\n // eslint-disable-next-line no-self-compare\n if (value != value) return true;\n // Array#indexOf ignores holes, Array#includes - not\n } else for (;length > index; index++) {\n if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;\n } return !IS_INCLUDES && -1;\n };\n };\n\n var arrayIncludes = {\n // `Array.prototype.includes` method\n // https://tc39.github.io/ecma262/#sec-array.prototype.includes\n includes: createMethod(true),\n // `Array.prototype.indexOf` method\n // https://tc39.github.io/ecma262/#sec-array.prototype.indexof\n indexOf: createMethod(false)\n };\n\n var indexOf = arrayIncludes.indexOf;\n\n\n var objectKeysInternal = function (object, names) {\n var O = toIndexedObject(object);\n var i = 0;\n var result = [];\n var key;\n for (key in O) !has(hiddenKeys, key) && has(O, key) && result.push(key);\n // Don't enum bug & hidden keys\n while (names.length > i) if (has(O, key = names[i++])) {\n ~indexOf(result, key) || result.push(key);\n }\n return result;\n };\n\n // IE8- don't enum bug keys\n var enumBugKeys = [\n 'constructor',\n 'hasOwnProperty',\n 'isPrototypeOf',\n 'propertyIsEnumerable',\n 'toLocaleString',\n 'toString',\n 'valueOf'\n ];\n\n var hiddenKeys$1 = enumBugKeys.concat('length', 'prototype');\n\n // `Object.getOwnPropertyNames` method\n // https://tc39.github.io/ecma262/#sec-object.getownpropertynames\n var f$3 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {\n return objectKeysInternal(O, hiddenKeys$1);\n };\n\n var objectGetOwnPropertyNames = {\n \tf: f$3\n };\n\n var f$4 = Object.getOwnPropertySymbols;\n\n var objectGetOwnPropertySymbols = {\n \tf: f$4\n };\n\n // all object keys, includes non-enumerable and symbols\n var ownKeys = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {\n var keys = objectGetOwnPropertyNames.f(anObject(it));\n var getOwnPropertySymbols = objectGetOwnPropertySymbols.f;\n return getOwnPropertySymbols ? keys.concat(getOwnPropertySymbols(it)) : keys;\n };\n\n var copyConstructorProperties = function (target, source) {\n var keys = ownKeys(source);\n var defineProperty = objectDefineProperty.f;\n var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;\n for (var i = 0; i < keys.length; i++) {\n var key = keys[i];\n if (!has(target, key)) defineProperty(target, key, getOwnPropertyDescriptor(source, key));\n }\n };\n\n var replacement = /#|\\.prototype\\./;\n\n var isForced = function (feature, detection) {\n var value = data[normalize(feature)];\n return value == POLYFILL ? true\n : value == NATIVE ? false\n : typeof detection == 'function' ? fails(detection)\n : !!detection;\n };\n\n var normalize = isForced.normalize = function (string) {\n return String(string).replace(replacement, '.').toLowerCase();\n };\n\n var data = isForced.data = {};\n var NATIVE = isForced.NATIVE = 'N';\n var POLYFILL = isForced.POLYFILL = 'P';\n\n var isForced_1 = isForced;\n\n var getOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f;\n\n\n\n\n\n\n /*\n options.target - name of the target object\n options.global - target is the global object\n options.stat - export as static methods of target\n options.proto - export as prototype methods of target\n options.real - real prototype method for the `pure` version\n options.forced - export even if the native feature is available\n options.bind - bind methods to the target, required for the `pure` version\n options.wrap - wrap constructors to preventing global pollution, required for the `pure` version\n options.unsafe - use the simple assignment of property instead of delete + defineProperty\n options.sham - add a flag to not completely full polyfills\n options.enumerable - export as enumerable property\n options.noTargetGet - prevent calling a getter on target\n */\n var _export = function (options, source) {\n var TARGET = options.target;\n var GLOBAL = options.global;\n var STATIC = options.stat;\n var FORCED, target, key, targetProperty, sourceProperty, descriptor;\n if (GLOBAL) {\n target = global_1;\n } else if (STATIC) {\n target = global_1[TARGET] || setGlobal(TARGET, {});\n } else {\n target = (global_1[TARGET] || {}).prototype;\n }\n if (target) for (key in source) {\n sourceProperty = source[key];\n if (options.noTargetGet) {\n descriptor = getOwnPropertyDescriptor$1(target, key);\n targetProperty = descriptor && descriptor.value;\n } else targetProperty = target[key];\n FORCED = isForced_1(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);\n // contained in target\n if (!FORCED && targetProperty !== undefined) {\n if (typeof sourceProperty === typeof targetProperty) continue;\n copyConstructorProperties(sourceProperty, targetProperty);\n }\n // add a flag to not completely full polyfills\n if (options.sham || (targetProperty && targetProperty.sham)) {\n createNonEnumerableProperty(sourceProperty, 'sham', true);\n }\n // extend global\n redefine(target, key, sourceProperty, options);\n }\n };\n\n var nativeSymbol = !!Object.getOwnPropertySymbols && !fails(function () {\n // Chrome 38 Symbol has incorrect toString conversion\n // eslint-disable-next-line no-undef\n return !String(Symbol());\n });\n\n var useSymbolAsUid = nativeSymbol\n // eslint-disable-next-line no-undef\n && !Symbol.sham\n // eslint-disable-next-line no-undef\n && typeof Symbol.iterator == 'symbol';\n\n // `IsArray` abstract operation\n // https://tc39.github.io/ecma262/#sec-isarray\n var isArray = Array.isArray || function isArray(arg) {\n return classofRaw(arg) == 'Array';\n };\n\n // `ToObject` abstract operation\n // https://tc39.github.io/ecma262/#sec-toobject\n var toObject = function (argument) {\n return Object(requireObjectCoercible(argument));\n };\n\n // `Object.keys` method\n // https://tc39.github.io/ecma262/#sec-object.keys\n var objectKeys = Object.keys || function keys(O) {\n return objectKeysInternal(O, enumBugKeys);\n };\n\n // `Object.defineProperties` method\n // https://tc39.github.io/ecma262/#sec-object.defineproperties\n var objectDefineProperties = descriptors ? Object.defineProperties : function defineProperties(O, Properties) {\n anObject(O);\n var keys = objectKeys(Properties);\n var length = keys.length;\n var index = 0;\n var key;\n while (length > index) objectDefineProperty.f(O, key = keys[index++], Properties[key]);\n return O;\n };\n\n var html = getBuiltIn('document', 'documentElement');\n\n var GT = '>';\n var LT = '<';\n var PROTOTYPE = 'prototype';\n var SCRIPT = 'script';\n var IE_PROTO = sharedKey('IE_PROTO');\n\n var EmptyConstructor = function () { /* empty */ };\n\n var scriptTag = function (content) {\n return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;\n };\n\n // Create object with fake `null` prototype: use ActiveX Object with cleared prototype\n var NullProtoObjectViaActiveX = function (activeXDocument) {\n activeXDocument.write(scriptTag(''));\n activeXDocument.close();\n var temp = activeXDocument.parentWindow.Object;\n activeXDocument = null; // avoid memory leak\n return temp;\n };\n\n // Create object with fake `null` prototype: use iframe Object with cleared prototype\n var NullProtoObjectViaIFrame = function () {\n // Thrash, waste and sodomy: IE GC bug\n var iframe = documentCreateElement('iframe');\n var JS = 'java' + SCRIPT + ':';\n var iframeDocument;\n iframe.style.display = 'none';\n html.appendChild(iframe);\n // https://github.com/zloirock/core-js/issues/475\n iframe.src = String(JS);\n iframeDocument = iframe.contentWindow.document;\n iframeDocument.open();\n iframeDocument.write(scriptTag('document.F=Object'));\n iframeDocument.close();\n return iframeDocument.F;\n };\n\n // Check for document.domain and active x support\n // No need to use active x approach when document.domain is not set\n // see https://github.com/es-shims/es5-shim/issues/150\n // variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346\n // avoid IE GC bug\n var activeXDocument;\n var NullProtoObject = function () {\n try {\n /* global ActiveXObject */\n activeXDocument = document.domain && new ActiveXObject('htmlfile');\n } catch (error) { /* ignore */ }\n NullProtoObject = activeXDocument ? NullProtoObjectViaActiveX(activeXDocument) : NullProtoObjectViaIFrame();\n var length = enumBugKeys.length;\n while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];\n return NullProtoObject();\n };\n\n hiddenKeys[IE_PROTO] = true;\n\n // `Object.create` method\n // https://tc39.github.io/ecma262/#sec-object.create\n var objectCreate = Object.create || function create(O, Properties) {\n var result;\n if (O !== null) {\n EmptyConstructor[PROTOTYPE] = anObject(O);\n result = new EmptyConstructor();\n EmptyConstructor[PROTOTYPE] = null;\n // add \"__proto__\" for Object.getPrototypeOf polyfill\n result[IE_PROTO] = O;\n } else result = NullProtoObject();\n return Properties === undefined ? result : objectDefineProperties(result, Properties);\n };\n\n var nativeGetOwnPropertyNames = objectGetOwnPropertyNames.f;\n\n var toString$1 = {}.toString;\n\n var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames\n ? Object.getOwnPropertyNames(window) : [];\n\n var getWindowNames = function (it) {\n try {\n return nativeGetOwnPropertyNames(it);\n } catch (error) {\n return windowNames.slice();\n }\n };\n\n // fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window\n var f$5 = function getOwnPropertyNames(it) {\n return windowNames && toString$1.call(it) == '[object Window]'\n ? getWindowNames(it)\n : nativeGetOwnPropertyNames(toIndexedObject(it));\n };\n\n var objectGetOwnPropertyNamesExternal = {\n \tf: f$5\n };\n\n var WellKnownSymbolsStore = shared('wks');\n var Symbol$1 = global_1.Symbol;\n var createWellKnownSymbol = useSymbolAsUid ? Symbol$1 : Symbol$1 && Symbol$1.withoutSetter || uid;\n\n var wellKnownSymbol = function (name) {\n if (!has(WellKnownSymbolsStore, name)) {\n if (nativeSymbol && has(Symbol$1, name)) WellKnownSymbolsStore[name] = Symbol$1[name];\n else WellKnownSymbolsStore[name] = createWellKnownSymbol('Symbol.' + name);\n } return WellKnownSymbolsStore[name];\n };\n\n var f$6 = wellKnownSymbol;\n\n var wellKnownSymbolWrapped = {\n \tf: f$6\n };\n\n var defineProperty = objectDefineProperty.f;\n\n var defineWellKnownSymbol = function (NAME) {\n var Symbol = path.Symbol || (path.Symbol = {});\n if (!has(Symbol, NAME)) defineProperty(Symbol, NAME, {\n value: wellKnownSymbolWrapped.f(NAME)\n });\n };\n\n var defineProperty$1 = objectDefineProperty.f;\n\n\n\n var TO_STRING_TAG = wellKnownSymbol('toStringTag');\n\n var setToStringTag = function (it, TAG, STATIC) {\n if (it && !has(it = STATIC ? it : it.prototype, TO_STRING_TAG)) {\n defineProperty$1(it, TO_STRING_TAG, { configurable: true, value: TAG });\n }\n };\n\n var aFunction$1 = function (it) {\n if (typeof it != 'function') {\n throw TypeError(String(it) + ' is not a function');\n } return it;\n };\n\n // optional / simple context binding\n var functionBindContext = function (fn, that, length) {\n aFunction$1(fn);\n if (that === undefined) return fn;\n switch (length) {\n case 0: return function () {\n return fn.call(that);\n };\n case 1: return function (a) {\n return fn.call(that, a);\n };\n case 2: return function (a, b) {\n return fn.call(that, a, b);\n };\n case 3: return function (a, b, c) {\n return fn.call(that, a, b, c);\n };\n }\n return function (/* ...args */) {\n return fn.apply(that, arguments);\n };\n };\n\n var SPECIES = wellKnownSymbol('species');\n\n // `ArraySpeciesCreate` abstract operation\n // https://tc39.github.io/ecma262/#sec-arrayspeciescreate\n var arraySpeciesCreate = function (originalArray, length) {\n var C;\n if (isArray(originalArray)) {\n C = originalArray.constructor;\n // cross-realm fallback\n if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined;\n else if (isObject(C)) {\n C = C[SPECIES];\n if (C === null) C = undefined;\n }\n } return new (C === undefined ? Array : C)(length === 0 ? 0 : length);\n };\n\n var push = [].push;\n\n // `Array.prototype.{ forEach, map, filter, some, every, find, findIndex }` methods implementation\n var createMethod$1 = function (TYPE) {\n var IS_MAP = TYPE == 1;\n var IS_FILTER = TYPE == 2;\n var IS_SOME = TYPE == 3;\n var IS_EVERY = TYPE == 4;\n var IS_FIND_INDEX = TYPE == 6;\n var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;\n return function ($this, callbackfn, that, specificCreate) {\n var O = toObject($this);\n var self = indexedObject(O);\n var boundFunction = functionBindContext(callbackfn, that, 3);\n var length = toLength(self.length);\n var index = 0;\n var create = specificCreate || arraySpeciesCreate;\n var target = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined;\n var value, result;\n for (;length > index; index++) if (NO_HOLES || index in self) {\n value = self[index];\n result = boundFunction(value, index, O);\n if (TYPE) {\n if (IS_MAP) target[index] = result; // map\n else if (result) switch (TYPE) {\n case 3: return true; // some\n case 5: return value; // find\n case 6: return index; // findIndex\n case 2: push.call(target, value); // filter\n } else if (IS_EVERY) return false; // every\n }\n }\n return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target;\n };\n };\n\n var arrayIteration = {\n // `Array.prototype.forEach` method\n // https://tc39.github.io/ecma262/#sec-array.prototype.foreach\n forEach: createMethod$1(0),\n // `Array.prototype.map` method\n // https://tc39.github.io/ecma262/#sec-array.prototype.map\n map: createMethod$1(1),\n // `Array.prototype.filter` method\n // https://tc39.github.io/ecma262/#sec-array.prototype.filter\n filter: createMethod$1(2),\n // `Array.prototype.some` method\n // https://tc39.github.io/ecma262/#sec-array.prototype.some\n some: createMethod$1(3),\n // `Array.prototype.every` method\n // https://tc39.github.io/ecma262/#sec-array.prototype.every\n every: createMethod$1(4),\n // `Array.prototype.find` method\n // https://tc39.github.io/ecma262/#sec-array.prototype.find\n find: createMethod$1(5),\n // `Array.prototype.findIndex` method\n // https://tc39.github.io/ecma262/#sec-array.prototype.findIndex\n findIndex: createMethod$1(6)\n };\n\n var $forEach = arrayIteration.forEach;\n\n var HIDDEN = sharedKey('hidden');\n var SYMBOL = 'Symbol';\n var PROTOTYPE$1 = 'prototype';\n var TO_PRIMITIVE = wellKnownSymbol('toPrimitive');\n var setInternalState = internalState.set;\n var getInternalState = internalState.getterFor(SYMBOL);\n var ObjectPrototype = Object[PROTOTYPE$1];\n var $Symbol = global_1.Symbol;\n var $stringify = getBuiltIn('JSON', 'stringify');\n var nativeGetOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f;\n var nativeDefineProperty$1 = objectDefineProperty.f;\n var nativeGetOwnPropertyNames$1 = objectGetOwnPropertyNamesExternal.f;\n var nativePropertyIsEnumerable$1 = objectPropertyIsEnumerable.f;\n var AllSymbols = shared('symbols');\n var ObjectPrototypeSymbols = shared('op-symbols');\n var StringToSymbolRegistry = shared('string-to-symbol-registry');\n var SymbolToStringRegistry = shared('symbol-to-string-registry');\n var WellKnownSymbolsStore$1 = shared('wks');\n var QObject = global_1.QObject;\n // Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173\n var USE_SETTER = !QObject || !QObject[PROTOTYPE$1] || !QObject[PROTOTYPE$1].findChild;\n\n // fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687\n var setSymbolDescriptor = descriptors && fails(function () {\n return objectCreate(nativeDefineProperty$1({}, 'a', {\n get: function () { return nativeDefineProperty$1(this, 'a', { value: 7 }).a; }\n })).a != 7;\n }) ? function (O, P, Attributes) {\n var ObjectPrototypeDescriptor = nativeGetOwnPropertyDescriptor$1(ObjectPrototype, P);\n if (ObjectPrototypeDescriptor) delete ObjectPrototype[P];\n nativeDefineProperty$1(O, P, Attributes);\n if (ObjectPrototypeDescriptor && O !== ObjectPrototype) {\n nativeDefineProperty$1(ObjectPrototype, P, ObjectPrototypeDescriptor);\n }\n } : nativeDefineProperty$1;\n\n var wrap = function (tag, description) {\n var symbol = AllSymbols[tag] = objectCreate($Symbol[PROTOTYPE$1]);\n setInternalState(symbol, {\n type: SYMBOL,\n tag: tag,\n description: description\n });\n if (!descriptors) symbol.description = description;\n return symbol;\n };\n\n var isSymbol = useSymbolAsUid ? function (it) {\n return typeof it == 'symbol';\n } : function (it) {\n return Object(it) instanceof $Symbol;\n };\n\n var $defineProperty = function defineProperty(O, P, Attributes) {\n if (O === ObjectPrototype) $defineProperty(ObjectPrototypeSymbols, P, Attributes);\n anObject(O);\n var key = toPrimitive(P, true);\n anObject(Attributes);\n if (has(AllSymbols, key)) {\n if (!Attributes.enumerable) {\n if (!has(O, HIDDEN)) nativeDefineProperty$1(O, HIDDEN, createPropertyDescriptor(1, {}));\n O[HIDDEN][key] = true;\n } else {\n if (has(O, HIDDEN) && O[HIDDEN][key]) O[HIDDEN][key] = false;\n Attributes = objectCreate(Attributes, { enumerable: createPropertyDescriptor(0, false) });\n } return setSymbolDescriptor(O, key, Attributes);\n } return nativeDefineProperty$1(O, key, Attributes);\n };\n\n var $defineProperties = function defineProperties(O, Properties) {\n anObject(O);\n var properties = toIndexedObject(Properties);\n var keys = objectKeys(properties).concat($getOwnPropertySymbols(properties));\n $forEach(keys, function (key) {\n if (!descriptors || $propertyIsEnumerable.call(properties, key)) $defineProperty(O, key, properties[key]);\n });\n return O;\n };\n\n var $create = function create(O, Properties) {\n return Properties === undefined ? objectCreate(O) : $defineProperties(objectCreate(O), Properties);\n };\n\n var $propertyIsEnumerable = function propertyIsEnumerable(V) {\n var P = toPrimitive(V, true);\n var enumerable = nativePropertyIsEnumerable$1.call(this, P);\n if (this === ObjectPrototype && has(AllSymbols, P) && !has(ObjectPrototypeSymbols, P)) return false;\n return enumerable || !has(this, P) || !has(AllSymbols, P) || has(this, HIDDEN) && this[HIDDEN][P] ? enumerable : true;\n };\n\n var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(O, P) {\n var it = toIndexedObject(O);\n var key = toPrimitive(P, true);\n if (it === ObjectPrototype && has(AllSymbols, key) && !has(ObjectPrototypeSymbols, key)) return;\n var descriptor = nativeGetOwnPropertyDescriptor$1(it, key);\n if (descriptor && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key])) {\n descriptor.enumerable = true;\n }\n return descriptor;\n };\n\n var $getOwnPropertyNames = function getOwnPropertyNames(O) {\n var names = nativeGetOwnPropertyNames$1(toIndexedObject(O));\n var result = [];\n $forEach(names, function (key) {\n if (!has(AllSymbols, key) && !has(hiddenKeys, key)) result.push(key);\n });\n return result;\n };\n\n var $getOwnPropertySymbols = function getOwnPropertySymbols(O) {\n var IS_OBJECT_PROTOTYPE = O === ObjectPrototype;\n var names = nativeGetOwnPropertyNames$1(IS_OBJECT_PROTOTYPE ? ObjectPrototypeSymbols : toIndexedObject(O));\n var result = [];\n $forEach(names, function (key) {\n if (has(AllSymbols, key) && (!IS_OBJECT_PROTOTYPE || has(ObjectPrototype, key))) {\n result.push(AllSymbols[key]);\n }\n });\n return result;\n };\n\n // `Symbol` constructor\n // https://tc39.github.io/ecma262/#sec-symbol-constructor\n if (!nativeSymbol) {\n $Symbol = function Symbol() {\n if (this instanceof $Symbol) throw TypeError('Symbol is not a constructor');\n var description = !arguments.length || arguments[0] === undefined ? undefined : String(arguments[0]);\n var tag = uid(description);\n var setter = function (value) {\n if (this === ObjectPrototype) setter.call(ObjectPrototypeSymbols, value);\n if (has(this, HIDDEN) && has(this[HIDDEN], tag)) this[HIDDEN][tag] = false;\n setSymbolDescriptor(this, tag, createPropertyDescriptor(1, value));\n };\n if (descriptors && USE_SETTER) setSymbolDescriptor(ObjectPrototype, tag, { configurable: true, set: setter });\n return wrap(tag, description);\n };\n\n redefine($Symbol[PROTOTYPE$1], 'toString', function toString() {\n return getInternalState(this).tag;\n });\n\n redefine($Symbol, 'withoutSetter', function (description) {\n return wrap(uid(description), description);\n });\n\n objectPropertyIsEnumerable.f = $propertyIsEnumerable;\n objectDefineProperty.f = $defineProperty;\n objectGetOwnPropertyDescriptor.f = $getOwnPropertyDescriptor;\n objectGetOwnPropertyNames.f = objectGetOwnPropertyNamesExternal.f = $getOwnPropertyNames;\n objectGetOwnPropertySymbols.f = $getOwnPropertySymbols;\n\n wellKnownSymbolWrapped.f = function (name) {\n return wrap(wellKnownSymbol(name), name);\n };\n\n if (descriptors) {\n // https://github.com/tc39/proposal-Symbol-description\n nativeDefineProperty$1($Symbol[PROTOTYPE$1], 'description', {\n configurable: true,\n get: function description() {\n return getInternalState(this).description;\n }\n });\n {\n redefine(ObjectPrototype, 'propertyIsEnumerable', $propertyIsEnumerable, { unsafe: true });\n }\n }\n }\n\n _export({ global: true, wrap: true, forced: !nativeSymbol, sham: !nativeSymbol }, {\n Symbol: $Symbol\n });\n\n $forEach(objectKeys(WellKnownSymbolsStore$1), function (name) {\n defineWellKnownSymbol(name);\n });\n\n _export({ target: SYMBOL, stat: true, forced: !nativeSymbol }, {\n // `Symbol.for` method\n // https://tc39.github.io/ecma262/#sec-symbol.for\n 'for': function (key) {\n var string = String(key);\n if (has(StringToSymbolRegistry, string)) return StringToSymbolRegistry[string];\n var symbol = $Symbol(string);\n StringToSymbolRegistry[string] = symbol;\n SymbolToStringRegistry[symbol] = string;\n return symbol;\n },\n // `Symbol.keyFor` method\n // https://tc39.github.io/ecma262/#sec-symbol.keyfor\n keyFor: function keyFor(sym) {\n if (!isSymbol(sym)) throw TypeError(sym + ' is not a symbol');\n if (has(SymbolToStringRegistry, sym)) return SymbolToStringRegistry[sym];\n },\n useSetter: function () { USE_SETTER = true; },\n useSimple: function () { USE_SETTER = false; }\n });\n\n _export({ target: 'Object', stat: true, forced: !nativeSymbol, sham: !descriptors }, {\n // `Object.create` method\n // https://tc39.github.io/ecma262/#sec-object.create\n create: $create,\n // `Object.defineProperty` method\n // https://tc39.github.io/ecma262/#sec-object.defineproperty\n defineProperty: $defineProperty,\n // `Object.defineProperties` method\n // https://tc39.github.io/ecma262/#sec-object.defineproperties\n defineProperties: $defineProperties,\n // `Object.getOwnPropertyDescriptor` method\n // https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptors\n getOwnPropertyDescriptor: $getOwnPropertyDescriptor\n });\n\n _export({ target: 'Object', stat: true, forced: !nativeSymbol }, {\n // `Object.getOwnPropertyNames` method\n // https://tc39.github.io/ecma262/#sec-object.getownpropertynames\n getOwnPropertyNames: $getOwnPropertyNames,\n // `Object.getOwnPropertySymbols` method\n // https://tc39.github.io/ecma262/#sec-object.getownpropertysymbols\n getOwnPropertySymbols: $getOwnPropertySymbols\n });\n\n // Chrome 38 and 39 `Object.getOwnPropertySymbols` fails on primitives\n // https://bugs.chromium.org/p/v8/issues/detail?id=3443\n _export({ target: 'Object', stat: true, forced: fails(function () { objectGetOwnPropertySymbols.f(1); }) }, {\n getOwnPropertySymbols: function getOwnPropertySymbols(it) {\n return objectGetOwnPropertySymbols.f(toObject(it));\n }\n });\n\n // `JSON.stringify` method behavior with symbols\n // https://tc39.github.io/ecma262/#sec-json.stringify\n if ($stringify) {\n var FORCED_JSON_STRINGIFY = !nativeSymbol || fails(function () {\n var symbol = $Symbol();\n // MS Edge converts symbol values to JSON as {}\n return $stringify([symbol]) != '[null]'\n // WebKit converts symbol values to JSON as null\n || $stringify({ a: symbol }) != '{}'\n // V8 throws on boxed symbols\n || $stringify(Object(symbol)) != '{}';\n });\n\n _export({ target: 'JSON', stat: true, forced: FORCED_JSON_STRINGIFY }, {\n // eslint-disable-next-line no-unused-vars\n stringify: function stringify(it, replacer, space) {\n var args = [it];\n var index = 1;\n var $replacer;\n while (arguments.length > index) args.push(arguments[index++]);\n $replacer = replacer;\n if (!isObject(replacer) && it === undefined || isSymbol(it)) return; // IE8 returns string on undefined\n if (!isArray(replacer)) replacer = function (key, value) {\n if (typeof $replacer == 'function') value = $replacer.call(this, key, value);\n if (!isSymbol(value)) return value;\n };\n args[1] = replacer;\n return $stringify.apply(null, args);\n }\n });\n }\n\n // `Symbol.prototype[@@toPrimitive]` method\n // https://tc39.github.io/ecma262/#sec-symbol.prototype-@@toprimitive\n if (!$Symbol[PROTOTYPE$1][TO_PRIMITIVE]) {\n createNonEnumerableProperty($Symbol[PROTOTYPE$1], TO_PRIMITIVE, $Symbol[PROTOTYPE$1].valueOf);\n }\n // `Symbol.prototype[@@toStringTag]` property\n // https://tc39.github.io/ecma262/#sec-symbol.prototype-@@tostringtag\n setToStringTag($Symbol, SYMBOL);\n\n hiddenKeys[HIDDEN] = true;\n\n var defineProperty$2 = objectDefineProperty.f;\n\n\n var NativeSymbol = global_1.Symbol;\n\n if (descriptors && typeof NativeSymbol == 'function' && (!('description' in NativeSymbol.prototype) ||\n // Safari 12 bug\n NativeSymbol().description !== undefined\n )) {\n var EmptyStringDescriptionStore = {};\n // wrap Symbol constructor for correct work with undefined description\n var SymbolWrapper = function Symbol() {\n var description = arguments.length < 1 || arguments[0] === undefined ? undefined : String(arguments[0]);\n var result = this instanceof SymbolWrapper\n ? new NativeSymbol(description)\n // in Edge 13, String(Symbol(undefined)) === 'Symbol(undefined)'\n : description === undefined ? NativeSymbol() : NativeSymbol(description);\n if (description === '') EmptyStringDescriptionStore[result] = true;\n return result;\n };\n copyConstructorProperties(SymbolWrapper, NativeSymbol);\n var symbolPrototype = SymbolWrapper.prototype = NativeSymbol.prototype;\n symbolPrototype.constructor = SymbolWrapper;\n\n var symbolToString = symbolPrototype.toString;\n var native = String(NativeSymbol('test')) == 'Symbol(test)';\n var regexp = /^Symbol\\((.*)\\)[^)]+$/;\n defineProperty$2(symbolPrototype, 'description', {\n configurable: true,\n get: function description() {\n var symbol = isObject(this) ? this.valueOf() : this;\n var string = symbolToString.call(symbol);\n if (has(EmptyStringDescriptionStore, symbol)) return '';\n var desc = native ? string.slice(7, -1) : string.replace(regexp, '$1');\n return desc === '' ? undefined : desc;\n }\n });\n\n _export({ global: true, forced: true }, {\n Symbol: SymbolWrapper\n });\n }\n\n // `Symbol.iterator` well-known symbol\n // https://tc39.github.io/ecma262/#sec-symbol.iterator\n defineWellKnownSymbol('iterator');\n\n var arrayMethodIsStrict = function (METHOD_NAME, argument) {\n var method = [][METHOD_NAME];\n return !!method && fails(function () {\n // eslint-disable-next-line no-useless-call,no-throw-literal\n method.call(null, argument || function () { throw 1; }, 1);\n });\n };\n\n var defineProperty$3 = Object.defineProperty;\n var cache = {};\n\n var thrower = function (it) { throw it; };\n\n var arrayMethodUsesToLength = function (METHOD_NAME, options) {\n if (has(cache, METHOD_NAME)) return cache[METHOD_NAME];\n if (!options) options = {};\n var method = [][METHOD_NAME];\n var ACCESSORS = has(options, 'ACCESSORS') ? options.ACCESSORS : false;\n var argument0 = has(options, 0) ? options[0] : thrower;\n var argument1 = has(options, 1) ? options[1] : undefined;\n\n return cache[METHOD_NAME] = !!method && !fails(function () {\n if (ACCESSORS && !descriptors) return true;\n var O = { length: -1 };\n\n if (ACCESSORS) defineProperty$3(O, 1, { enumerable: true, get: thrower });\n else O[1] = 1;\n\n method.call(O, argument0, argument1);\n });\n };\n\n var $forEach$1 = arrayIteration.forEach;\n\n\n\n var STRICT_METHOD = arrayMethodIsStrict('forEach');\n var USES_TO_LENGTH = arrayMethodUsesToLength('forEach');\n\n // `Array.prototype.forEach` method implementation\n // https://tc39.github.io/ecma262/#sec-array.prototype.foreach\n var arrayForEach = (!STRICT_METHOD || !USES_TO_LENGTH) ? function forEach(callbackfn /* , thisArg */) {\n return $forEach$1(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);\n } : [].forEach;\n\n // `Array.prototype.forEach` method\n // https://tc39.github.io/ecma262/#sec-array.prototype.foreach\n _export({ target: 'Array', proto: true, forced: [].forEach != arrayForEach }, {\n forEach: arrayForEach\n });\n\n var $indexOf = arrayIncludes.indexOf;\n\n\n\n var nativeIndexOf = [].indexOf;\n\n var NEGATIVE_ZERO = !!nativeIndexOf && 1 / [1].indexOf(1, -0) < 0;\n var STRICT_METHOD$1 = arrayMethodIsStrict('indexOf');\n var USES_TO_LENGTH$1 = arrayMethodUsesToLength('indexOf', { ACCESSORS: true, 1: 0 });\n\n // `Array.prototype.indexOf` method\n // https://tc39.github.io/ecma262/#sec-array.prototype.indexof\n _export({ target: 'Array', proto: true, forced: NEGATIVE_ZERO || !STRICT_METHOD$1 || !USES_TO_LENGTH$1 }, {\n indexOf: function indexOf(searchElement /* , fromIndex = 0 */) {\n return NEGATIVE_ZERO\n // convert -0 to +0\n ? nativeIndexOf.apply(this, arguments) || 0\n : $indexOf(this, searchElement, arguments.length > 1 ? arguments[1] : undefined);\n }\n });\n\n var UNSCOPABLES = wellKnownSymbol('unscopables');\n var ArrayPrototype = Array.prototype;\n\n // Array.prototype[@@unscopables]\n // https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables\n if (ArrayPrototype[UNSCOPABLES] == undefined) {\n objectDefineProperty.f(ArrayPrototype, UNSCOPABLES, {\n configurable: true,\n value: objectCreate(null)\n });\n }\n\n // add a key to Array.prototype[@@unscopables]\n var addToUnscopables = function (key) {\n ArrayPrototype[UNSCOPABLES][key] = true;\n };\n\n var iterators = {};\n\n var correctPrototypeGetter = !fails(function () {\n function F() { /* empty */ }\n F.prototype.constructor = null;\n return Object.getPrototypeOf(new F()) !== F.prototype;\n });\n\n var IE_PROTO$1 = sharedKey('IE_PROTO');\n var ObjectPrototype$1 = Object.prototype;\n\n // `Object.getPrototypeOf` method\n // https://tc39.github.io/ecma262/#sec-object.getprototypeof\n var objectGetPrototypeOf = correctPrototypeGetter ? Object.getPrototypeOf : function (O) {\n O = toObject(O);\n if (has(O, IE_PROTO$1)) return O[IE_PROTO$1];\n if (typeof O.constructor == 'function' && O instanceof O.constructor) {\n return O.constructor.prototype;\n } return O instanceof Object ? ObjectPrototype$1 : null;\n };\n\n var ITERATOR = wellKnownSymbol('iterator');\n var BUGGY_SAFARI_ITERATORS = false;\n\n var returnThis = function () { return this; };\n\n // `%IteratorPrototype%` object\n // https://tc39.github.io/ecma262/#sec-%iteratorprototype%-object\n var IteratorPrototype, PrototypeOfArrayIteratorPrototype, arrayIterator;\n\n if ([].keys) {\n arrayIterator = [].keys();\n // Safari 8 has buggy iterators w/o `next`\n if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS = true;\n else {\n PrototypeOfArrayIteratorPrototype = objectGetPrototypeOf(objectGetPrototypeOf(arrayIterator));\n if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype = PrototypeOfArrayIteratorPrototype;\n }\n }\n\n if (IteratorPrototype == undefined) IteratorPrototype = {};\n\n // 25.1.2.1.1 %IteratorPrototype%[@@iterator]()\n if ( !has(IteratorPrototype, ITERATOR)) {\n createNonEnumerableProperty(IteratorPrototype, ITERATOR, returnThis);\n }\n\n var iteratorsCore = {\n IteratorPrototype: IteratorPrototype,\n BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS\n };\n\n var IteratorPrototype$1 = iteratorsCore.IteratorPrototype;\n\n\n\n\n\n var returnThis$1 = function () { return this; };\n\n var createIteratorConstructor = function (IteratorConstructor, NAME, next) {\n var TO_STRING_TAG = NAME + ' Iterator';\n IteratorConstructor.prototype = objectCreate(IteratorPrototype$1, { next: createPropertyDescriptor(1, next) });\n setToStringTag(IteratorConstructor, TO_STRING_TAG, false);\n iterators[TO_STRING_TAG] = returnThis$1;\n return IteratorConstructor;\n };\n\n var aPossiblePrototype = function (it) {\n if (!isObject(it) && it !== null) {\n throw TypeError(\"Can't set \" + String(it) + ' as a prototype');\n } return it;\n };\n\n // `Object.setPrototypeOf` method\n // https://tc39.github.io/ecma262/#sec-object.setprototypeof\n // Works with __proto__ only. Old v8 can't work with null proto objects.\n /* eslint-disable no-proto */\n var objectSetPrototypeOf = Object.setPrototypeOf || ('__proto__' in {} ? function () {\n var CORRECT_SETTER = false;\n var test = {};\n var setter;\n try {\n setter = Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set;\n setter.call(test, []);\n CORRECT_SETTER = test instanceof Array;\n } catch (error) { /* empty */ }\n return function setPrototypeOf(O, proto) {\n anObject(O);\n aPossiblePrototype(proto);\n if (CORRECT_SETTER) setter.call(O, proto);\n else O.__proto__ = proto;\n return O;\n };\n }() : undefined);\n\n var IteratorPrototype$2 = iteratorsCore.IteratorPrototype;\n var BUGGY_SAFARI_ITERATORS$1 = iteratorsCore.BUGGY_SAFARI_ITERATORS;\n var ITERATOR$1 = wellKnownSymbol('iterator');\n var KEYS = 'keys';\n var VALUES = 'values';\n var ENTRIES = 'entries';\n\n var returnThis$2 = function () { return this; };\n\n var defineIterator = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) {\n createIteratorConstructor(IteratorConstructor, NAME, next);\n\n var getIterationMethod = function (KIND) {\n if (KIND === DEFAULT && defaultIterator) return defaultIterator;\n if (!BUGGY_SAFARI_ITERATORS$1 && KIND in IterablePrototype) return IterablePrototype[KIND];\n switch (KIND) {\n case KEYS: return function keys() { return new IteratorConstructor(this, KIND); };\n case VALUES: return function values() { return new IteratorConstructor(this, KIND); };\n case ENTRIES: return function entries() { return new IteratorConstructor(this, KIND); };\n } return function () { return new IteratorConstructor(this); };\n };\n\n var TO_STRING_TAG = NAME + ' Iterator';\n var INCORRECT_VALUES_NAME = false;\n var IterablePrototype = Iterable.prototype;\n var nativeIterator = IterablePrototype[ITERATOR$1]\n || IterablePrototype['@@iterator']\n || DEFAULT && IterablePrototype[DEFAULT];\n var defaultIterator = !BUGGY_SAFARI_ITERATORS$1 && nativeIterator || getIterationMethod(DEFAULT);\n var anyNativeIterator = NAME == 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator;\n var CurrentIteratorPrototype, methods, KEY;\n\n // fix native\n if (anyNativeIterator) {\n CurrentIteratorPrototype = objectGetPrototypeOf(anyNativeIterator.call(new Iterable()));\n if (IteratorPrototype$2 !== Object.prototype && CurrentIteratorPrototype.next) {\n if ( objectGetPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype$2) {\n if (objectSetPrototypeOf) {\n objectSetPrototypeOf(CurrentIteratorPrototype, IteratorPrototype$2);\n } else if (typeof CurrentIteratorPrototype[ITERATOR$1] != 'function') {\n createNonEnumerableProperty(CurrentIteratorPrototype, ITERATOR$1, returnThis$2);\n }\n }\n // Set @@toStringTag to native iterators\n setToStringTag(CurrentIteratorPrototype, TO_STRING_TAG, true);\n }\n }\n\n // fix Array#{values, @@iterator}.name in V8 / FF\n if (DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES) {\n INCORRECT_VALUES_NAME = true;\n defaultIterator = function values() { return nativeIterator.call(this); };\n }\n\n // define iterator\n if ( IterablePrototype[ITERATOR$1] !== defaultIterator) {\n createNonEnumerableProperty(IterablePrototype, ITERATOR$1, defaultIterator);\n }\n iterators[NAME] = defaultIterator;\n\n // export additional methods\n if (DEFAULT) {\n methods = {\n values: getIterationMethod(VALUES),\n keys: IS_SET ? defaultIterator : getIterationMethod(KEYS),\n entries: getIterationMethod(ENTRIES)\n };\n if (FORCED) for (KEY in methods) {\n if (BUGGY_SAFARI_ITERATORS$1 || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) {\n redefine(IterablePrototype, KEY, methods[KEY]);\n }\n } else _export({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS$1 || INCORRECT_VALUES_NAME }, methods);\n }\n\n return methods;\n };\n\n var ARRAY_ITERATOR = 'Array Iterator';\n var setInternalState$1 = internalState.set;\n var getInternalState$1 = internalState.getterFor(ARRAY_ITERATOR);\n\n // `Array.prototype.entries` method\n // https://tc39.github.io/ecma262/#sec-array.prototype.entries\n // `Array.prototype.keys` method\n // https://tc39.github.io/ecma262/#sec-array.prototype.keys\n // `Array.prototype.values` method\n // https://tc39.github.io/ecma262/#sec-array.prototype.values\n // `Array.prototype[@@iterator]` method\n // https://tc39.github.io/ecma262/#sec-array.prototype-@@iterator\n // `CreateArrayIterator` internal method\n // https://tc39.github.io/ecma262/#sec-createarrayiterator\n var es_array_iterator = defineIterator(Array, 'Array', function (iterated, kind) {\n setInternalState$1(this, {\n type: ARRAY_ITERATOR,\n target: toIndexedObject(iterated), // target\n index: 0, // next index\n kind: kind // kind\n });\n // `%ArrayIteratorPrototype%.next` method\n // https://tc39.github.io/ecma262/#sec-%arrayiteratorprototype%.next\n }, function () {\n var state = getInternalState$1(this);\n var target = state.target;\n var kind = state.kind;\n var index = state.index++;\n if (!target || index >= target.length) {\n state.target = undefined;\n return { value: undefined, done: true };\n }\n if (kind == 'keys') return { value: index, done: false };\n if (kind == 'values') return { value: target[index], done: false };\n return { value: [index, target[index]], done: false };\n }, 'values');\n\n // argumentsList[@@iterator] is %ArrayProto_values%\n // https://tc39.github.io/ecma262/#sec-createunmappedargumentsobject\n // https://tc39.github.io/ecma262/#sec-createmappedargumentsobject\n iterators.Arguments = iterators.Array;\n\n // https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables\n addToUnscopables('keys');\n addToUnscopables('values');\n addToUnscopables('entries');\n\n var nativeJoin = [].join;\n\n var ES3_STRINGS = indexedObject != Object;\n var STRICT_METHOD$2 = arrayMethodIsStrict('join', ',');\n\n // `Array.prototype.join` method\n // https://tc39.github.io/ecma262/#sec-array.prototype.join\n _export({ target: 'Array', proto: true, forced: ES3_STRINGS || !STRICT_METHOD$2 }, {\n join: function join(separator) {\n return nativeJoin.call(toIndexedObject(this), separator === undefined ? ',' : separator);\n }\n });\n\n var createProperty = function (object, key, value) {\n var propertyKey = toPrimitive(key);\n if (propertyKey in object) objectDefineProperty.f(object, propertyKey, createPropertyDescriptor(0, value));\n else object[propertyKey] = value;\n };\n\n var engineUserAgent = getBuiltIn('navigator', 'userAgent') || '';\n\n var process = global_1.process;\n var versions = process && process.versions;\n var v8 = versions && versions.v8;\n var match, version;\n\n if (v8) {\n match = v8.split('.');\n version = match[0] + match[1];\n } else if (engineUserAgent) {\n match = engineUserAgent.match(/Edge\\/(\\d+)/);\n if (!match || match[1] >= 74) {\n match = engineUserAgent.match(/Chrome\\/(\\d+)/);\n if (match) version = match[1];\n }\n }\n\n var engineV8Version = version && +version;\n\n var SPECIES$1 = wellKnownSymbol('species');\n\n var arrayMethodHasSpeciesSupport = function (METHOD_NAME) {\n // We can't use this feature detection in V8 since it causes\n // deoptimization and serious performance degradation\n // https://github.com/zloirock/core-js/issues/677\n return engineV8Version >= 51 || !fails(function () {\n var array = [];\n var constructor = array.constructor = {};\n constructor[SPECIES$1] = function () {\n return { foo: 1 };\n };\n return array[METHOD_NAME](Boolean).foo !== 1;\n });\n };\n\n var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('slice');\n var USES_TO_LENGTH$2 = arrayMethodUsesToLength('slice', { ACCESSORS: true, 0: 0, 1: 2 });\n\n var SPECIES$2 = wellKnownSymbol('species');\n var nativeSlice = [].slice;\n var max$1 = Math.max;\n\n // `Array.prototype.slice` method\n // https://tc39.github.io/ecma262/#sec-array.prototype.slice\n // fallback for not array-like ES3 strings and DOM objects\n _export({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT || !USES_TO_LENGTH$2 }, {\n slice: function slice(start, end) {\n var O = toIndexedObject(this);\n var length = toLength(O.length);\n var k = toAbsoluteIndex(start, length);\n var fin = toAbsoluteIndex(end === undefined ? length : end, length);\n // inline `ArraySpeciesCreate` for usage native `Array#slice` where it's possible\n var Constructor, result, n;\n if (isArray(O)) {\n Constructor = O.constructor;\n // cross-realm fallback\n if (typeof Constructor == 'function' && (Constructor === Array || isArray(Constructor.prototype))) {\n Constructor = undefined;\n } else if (isObject(Constructor)) {\n Constructor = Constructor[SPECIES$2];\n if (Constructor === null) Constructor = undefined;\n }\n if (Constructor === Array || Constructor === undefined) {\n return nativeSlice.call(O, k, fin);\n }\n }\n result = new (Constructor === undefined ? Array : Constructor)(max$1(fin - k, 0));\n for (n = 0; k < fin; k++, n++) if (k in O) createProperty(result, n, O[k]);\n result.length = n;\n return result;\n }\n });\n\n var TO_STRING_TAG$1 = wellKnownSymbol('toStringTag');\n var test = {};\n\n test[TO_STRING_TAG$1] = 'z';\n\n var toStringTagSupport = String(test) === '[object z]';\n\n var TO_STRING_TAG$2 = wellKnownSymbol('toStringTag');\n // ES3 wrong here\n var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments';\n\n // fallback for IE11 Script Access Denied error\n var tryGet = function (it, key) {\n try {\n return it[key];\n } catch (error) { /* empty */ }\n };\n\n // getting tag from ES6+ `Object.prototype.toString`\n var classof = toStringTagSupport ? classofRaw : function (it) {\n var O, tag, result;\n return it === undefined ? 'Undefined' : it === null ? 'Null'\n // @@toStringTag case\n : typeof (tag = tryGet(O = Object(it), TO_STRING_TAG$2)) == 'string' ? tag\n // builtinTag case\n : CORRECT_ARGUMENTS ? classofRaw(O)\n // ES3 arguments fallback\n : (result = classofRaw(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : result;\n };\n\n // `Object.prototype.toString` method implementation\n // https://tc39.github.io/ecma262/#sec-object.prototype.tostring\n var objectToString = toStringTagSupport ? {}.toString : function toString() {\n return '[object ' + classof(this) + ']';\n };\n\n // `Object.prototype.toString` method\n // https://tc39.github.io/ecma262/#sec-object.prototype.tostring\n if (!toStringTagSupport) {\n redefine(Object.prototype, 'toString', objectToString, { unsafe: true });\n }\n\n // `RegExp.prototype.flags` getter implementation\n // https://tc39.github.io/ecma262/#sec-get-regexp.prototype.flags\n var regexpFlags = function () {\n var that = anObject(this);\n var result = '';\n if (that.global) result += 'g';\n if (that.ignoreCase) result += 'i';\n if (that.multiline) result += 'm';\n if (that.dotAll) result += 's';\n if (that.unicode) result += 'u';\n if (that.sticky) result += 'y';\n return result;\n };\n\n // babel-minify transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError,\n // so we use an intermediate function.\n function RE(s, f) {\n return RegExp(s, f);\n }\n\n var UNSUPPORTED_Y = fails(function () {\n // babel-minify transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError\n var re = RE('a', 'y');\n re.lastIndex = 2;\n return re.exec('abcd') != null;\n });\n\n var BROKEN_CARET = fails(function () {\n // https://bugzilla.mozilla.org/show_bug.cgi?id=773687\n var re = RE('^r', 'gy');\n re.lastIndex = 2;\n return re.exec('str') != null;\n });\n\n var regexpStickyHelpers = {\n \tUNSUPPORTED_Y: UNSUPPORTED_Y,\n \tBROKEN_CARET: BROKEN_CARET\n };\n\n var nativeExec = RegExp.prototype.exec;\n // This always refers to the native implementation, because the\n // String#replace polyfill uses ./fix-regexp-well-known-symbol-logic.js,\n // which loads this file before patching the method.\n var nativeReplace = String.prototype.replace;\n\n var patchedExec = nativeExec;\n\n var UPDATES_LAST_INDEX_WRONG = (function () {\n var re1 = /a/;\n var re2 = /b*/g;\n nativeExec.call(re1, 'a');\n nativeExec.call(re2, 'a');\n return re1.lastIndex !== 0 || re2.lastIndex !== 0;\n })();\n\n var UNSUPPORTED_Y$1 = regexpStickyHelpers.UNSUPPORTED_Y || regexpStickyHelpers.BROKEN_CARET;\n\n // nonparticipating capturing group, copied from es5-shim's String#split patch.\n var NPCG_INCLUDED = /()??/.exec('')[1] !== undefined;\n\n var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED || UNSUPPORTED_Y$1;\n\n if (PATCH) {\n patchedExec = function exec(str) {\n var re = this;\n var lastIndex, reCopy, match, i;\n var sticky = UNSUPPORTED_Y$1 && re.sticky;\n var flags = regexpFlags.call(re);\n var source = re.source;\n var charsAdded = 0;\n var strCopy = str;\n\n if (sticky) {\n flags = flags.replace('y', '');\n if (flags.indexOf('g') === -1) {\n flags += 'g';\n }\n\n strCopy = String(str).slice(re.lastIndex);\n // Support anchored sticky behavior.\n if (re.lastIndex > 0 && (!re.multiline || re.multiline && str[re.lastIndex - 1] !== '\\n')) {\n source = '(?: ' + source + ')';\n strCopy = ' ' + strCopy;\n charsAdded++;\n }\n // ^(? + rx + ) is needed, in combination with some str slicing, to\n // simulate the 'y' flag.\n reCopy = new RegExp('^(?:' + source + ')', flags);\n }\n\n if (NPCG_INCLUDED) {\n reCopy = new RegExp('^' + source + '$(?!\\\\s)', flags);\n }\n if (UPDATES_LAST_INDEX_WRONG) lastIndex = re.lastIndex;\n\n match = nativeExec.call(sticky ? reCopy : re, strCopy);\n\n if (sticky) {\n if (match) {\n match.input = match.input.slice(charsAdded);\n match[0] = match[0].slice(charsAdded);\n match.index = re.lastIndex;\n re.lastIndex += match[0].length;\n } else re.lastIndex = 0;\n } else if (UPDATES_LAST_INDEX_WRONG && match) {\n re.lastIndex = re.global ? match.index + match[0].length : lastIndex;\n }\n if (NPCG_INCLUDED && match && match.length > 1) {\n // Fix browsers whose `exec` methods don't consistently return `undefined`\n // for NPCG, like IE8. NOTE: This doesn' work for /(.?)?/\n nativeReplace.call(match[0], reCopy, function () {\n for (i = 1; i < arguments.length - 2; i++) {\n if (arguments[i] === undefined) match[i] = undefined;\n }\n });\n }\n\n return match;\n };\n }\n\n var regexpExec = patchedExec;\n\n _export({ target: 'RegExp', proto: true, forced: /./.exec !== regexpExec }, {\n exec: regexpExec\n });\n\n var TO_STRING = 'toString';\n var RegExpPrototype = RegExp.prototype;\n var nativeToString = RegExpPrototype[TO_STRING];\n\n var NOT_GENERIC = fails(function () { return nativeToString.call({ source: 'a', flags: 'b' }) != '/a/b'; });\n // FF44- RegExp#toString has a wrong name\n var INCORRECT_NAME = nativeToString.name != TO_STRING;\n\n // `RegExp.prototype.toString` method\n // https://tc39.github.io/ecma262/#sec-regexp.prototype.tostring\n if (NOT_GENERIC || INCORRECT_NAME) {\n redefine(RegExp.prototype, TO_STRING, function toString() {\n var R = anObject(this);\n var p = String(R.source);\n var rf = R.flags;\n var f = String(rf === undefined && R instanceof RegExp && !('flags' in RegExpPrototype) ? regexpFlags.call(R) : rf);\n return '/' + p + '/' + f;\n }, { unsafe: true });\n }\n\n // `String.prototype.{ codePointAt, at }` methods implementation\n var createMethod$2 = function (CONVERT_TO_STRING) {\n return function ($this, pos) {\n var S = String(requireObjectCoercible($this));\n var position = toInteger(pos);\n var size = S.length;\n var first, second;\n if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;\n first = S.charCodeAt(position);\n return first < 0xD800 || first > 0xDBFF || position + 1 === size\n || (second = S.charCodeAt(position + 1)) < 0xDC00 || second > 0xDFFF\n ? CONVERT_TO_STRING ? S.charAt(position) : first\n : CONVERT_TO_STRING ? S.slice(position, position + 2) : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;\n };\n };\n\n var stringMultibyte = {\n // `String.prototype.codePointAt` method\n // https://tc39.github.io/ecma262/#sec-string.prototype.codepointat\n codeAt: createMethod$2(false),\n // `String.prototype.at` method\n // https://github.com/mathiasbynens/String.prototype.at\n charAt: createMethod$2(true)\n };\n\n var charAt = stringMultibyte.charAt;\n\n\n\n var STRING_ITERATOR = 'String Iterator';\n var setInternalState$2 = internalState.set;\n var getInternalState$2 = internalState.getterFor(STRING_ITERATOR);\n\n // `String.prototype[@@iterator]` method\n // https://tc39.github.io/ecma262/#sec-string.prototype-@@iterator\n defineIterator(String, 'String', function (iterated) {\n setInternalState$2(this, {\n type: STRING_ITERATOR,\n string: String(iterated),\n index: 0\n });\n // `%StringIteratorPrototype%.next` method\n // https://tc39.github.io/ecma262/#sec-%stringiteratorprototype%.next\n }, function next() {\n var state = getInternalState$2(this);\n var string = state.string;\n var index = state.index;\n var point;\n if (index >= string.length) return { value: undefined, done: true };\n point = charAt(string, index);\n state.index += point.length;\n return { value: point, done: false };\n });\n\n // TODO: Remove from `core-js@4` since it's moved to entry points\n\n\n\n\n\n\n\n var SPECIES$3 = wellKnownSymbol('species');\n\n var REPLACE_SUPPORTS_NAMED_GROUPS = !fails(function () {\n // #replace needs built-in support for named groups.\n // #match works fine because it just return the exec results, even if it has\n // a \"grops\" property.\n var re = /./;\n re.exec = function () {\n var result = [];\n result.groups = { a: '7' };\n return result;\n };\n return ''.replace(re, '$<a>') !== '7';\n });\n\n // IE <= 11 replaces $0 with the whole match, as if it was $&\n // https://stackoverflow.com/questions/6024666/getting-ie-to-replace-a-regex-with-the-literal-string-0\n var REPLACE_KEEPS_$0 = (function () {\n return 'a'.replace(/./, '$0') === '$0';\n })();\n\n var REPLACE = wellKnownSymbol('replace');\n // Safari <= 13.0.3(?) substitutes nth capture where n>m with an empty string\n var REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE = (function () {\n if (/./[REPLACE]) {\n return /./[REPLACE]('a', '$0') === '';\n }\n return false;\n })();\n\n // Chrome 51 has a buggy \"split\" implementation when RegExp#exec !== nativeExec\n // Weex JS has frozen built-in prototypes, so use try / catch wrapper\n var SPLIT_WORKS_WITH_OVERWRITTEN_EXEC = !fails(function () {\n var re = /(?:)/;\n var originalExec = re.exec;\n re.exec = function () { return originalExec.apply(this, arguments); };\n var result = 'ab'.split(re);\n return result.length !== 2 || result[0] !== 'a' || result[1] !== 'b';\n });\n\n var fixRegexpWellKnownSymbolLogic = function (KEY, length, exec, sham) {\n var SYMBOL = wellKnownSymbol(KEY);\n\n var DELEGATES_TO_SYMBOL = !fails(function () {\n // String methods call symbol-named RegEp methods\n var O = {};\n O[SYMBOL] = function () { return 7; };\n return ''[KEY](O) != 7;\n });\n\n var DELEGATES_TO_EXEC = DELEGATES_TO_SYMBOL && !fails(function () {\n // Symbol-named RegExp methods call .exec\n var execCalled = false;\n var re = /a/;\n\n if (KEY === 'split') {\n // We can't use real regex here since it causes deoptimization\n // and serious performance degradation in V8\n // https://github.com/zloirock/core-js/issues/306\n re = {};\n // RegExp[@@split] doesn't call the regex's exec method, but first creates\n // a new one. We need to return the patched regex when creating the new one.\n re.constructor = {};\n re.constructor[SPECIES$3] = function () { return re; };\n re.flags = '';\n re[SYMBOL] = /./[SYMBOL];\n }\n\n re.exec = function () { execCalled = true; return null; };\n\n re[SYMBOL]('');\n return !execCalled;\n });\n\n if (\n !DELEGATES_TO_SYMBOL ||\n !DELEGATES_TO_EXEC ||\n (KEY === 'replace' && !(\n REPLACE_SUPPORTS_NAMED_GROUPS &&\n REPLACE_KEEPS_$0 &&\n !REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE\n )) ||\n (KEY === 'split' && !SPLIT_WORKS_WITH_OVERWRITTEN_EXEC)\n ) {\n var nativeRegExpMethod = /./[SYMBOL];\n var methods = exec(SYMBOL, ''[KEY], function (nativeMethod, regexp, str, arg2, forceStringMethod) {\n if (regexp.exec === regexpExec) {\n if (DELEGATES_TO_SYMBOL && !forceStringMethod) {\n // The native String method already delegates to @@method (this\n // polyfilled function), leasing to infinite recursion.\n // We avoid it by directly calling the native @@method method.\n return { done: true, value: nativeRegExpMethod.call(regexp, str, arg2) };\n }\n return { done: true, value: nativeMethod.call(str, regexp, arg2) };\n }\n return { done: false };\n }, {\n REPLACE_KEEPS_$0: REPLACE_KEEPS_$0,\n REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE: REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE\n });\n var stringMethod = methods[0];\n var regexMethod = methods[1];\n\n redefine(String.prototype, KEY, stringMethod);\n redefine(RegExp.prototype, SYMBOL, length == 2\n // 21.2.5.8 RegExp.prototype[@@replace](string, replaceValue)\n // 21.2.5.11 RegExp.prototype[@@split](string, limit)\n ? function (string, arg) { return regexMethod.call(string, this, arg); }\n // 21.2.5.6 RegExp.prototype[@@match](string)\n // 21.2.5.9 RegExp.prototype[@@search](string)\n : function (string) { return regexMethod.call(string, this); }\n );\n }\n\n if (sham) createNonEnumerableProperty(RegExp.prototype[SYMBOL], 'sham', true);\n };\n\n var charAt$1 = stringMultibyte.charAt;\n\n // `AdvanceStringIndex` abstract operation\n // https://tc39.github.io/ecma262/#sec-advancestringindex\n var advanceStringIndex = function (S, index, unicode) {\n return index + (unicode ? charAt$1(S, index).length : 1);\n };\n\n // `RegExpExec` abstract operation\n // https://tc39.github.io/ecma262/#sec-regexpexec\n var regexpExecAbstract = function (R, S) {\n var exec = R.exec;\n if (typeof exec === 'function') {\n var result = exec.call(R, S);\n if (typeof result !== 'object') {\n throw TypeError('RegExp exec method returned something other than an Object or null');\n }\n return result;\n }\n\n if (classofRaw(R) !== 'RegExp') {\n throw TypeError('RegExp#exec called on incompatible receiver');\n }\n\n return regexpExec.call(R, S);\n };\n\n var max$2 = Math.max;\n var min$2 = Math.min;\n var floor$1 = Math.floor;\n var SUBSTITUTION_SYMBOLS = /\\$([$&'`]|\\d\\d?|<[^>]*>)/g;\n var SUBSTITUTION_SYMBOLS_NO_NAMED = /\\$([$&'`]|\\d\\d?)/g;\n\n var maybeToString = function (it) {\n return it === undefined ? it : String(it);\n };\n\n // @@replace logic\n fixRegexpWellKnownSymbolLogic('replace', 2, function (REPLACE, nativeReplace, maybeCallNative, reason) {\n var REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE = reason.REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE;\n var REPLACE_KEEPS_$0 = reason.REPLACE_KEEPS_$0;\n var UNSAFE_SUBSTITUTE = REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE ? '$' : '$0';\n\n return [\n // `String.prototype.replace` method\n // https://tc39.github.io/ecma262/#sec-string.prototype.replace\n function replace(searchValue, replaceValue) {\n var O = requireObjectCoercible(this);\n var replacer = searchValue == undefined ? undefined : searchValue[REPLACE];\n return replacer !== undefined\n ? replacer.call(searchValue, O, replaceValue)\n : nativeReplace.call(String(O), searchValue, replaceValue);\n },\n // `RegExp.prototype[@@replace]` method\n // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@replace\n function (regexp, replaceValue) {\n if (\n (!REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE && REPLACE_KEEPS_$0) ||\n (typeof replaceValue === 'string' && replaceValue.indexOf(UNSAFE_SUBSTITUTE) === -1)\n ) {\n var res = maybeCallNative(nativeReplace, regexp, this, replaceValue);\n if (res.done) return res.value;\n }\n\n var rx = anObject(regexp);\n var S = String(this);\n\n var functionalReplace = typeof replaceValue === 'function';\n if (!functionalReplace) replaceValue = String(replaceValue);\n\n var global = rx.global;\n if (global) {\n var fullUnicode = rx.unicode;\n rx.lastIndex = 0;\n }\n var results = [];\n while (true) {\n var result = regexpExecAbstract(rx, S);\n if (result === null) break;\n\n results.push(result);\n if (!global) break;\n\n var matchStr = String(result[0]);\n if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);\n }\n\n var accumulatedResult = '';\n var nextSourcePosition = 0;\n for (var i = 0; i < results.length; i++) {\n result = results[i];\n\n var matched = String(result[0]);\n var position = max$2(min$2(toInteger(result.index), S.length), 0);\n var captures = [];\n // NOTE: This is equivalent to\n // captures = result.slice(1).map(maybeToString)\n // but for some reason `nativeSlice.call(result, 1, result.length)` (called in\n // the slice polyfill when slicing native arrays) \"doesn't work\" in safari 9 and\n // causes a crash (https://pastebin.com/N21QzeQA) when trying to debug it.\n for (var j = 1; j < result.length; j++) captures.push(maybeToString(result[j]));\n var namedCaptures = result.groups;\n if (functionalReplace) {\n var replacerArgs = [matched].concat(captures, position, S);\n if (namedCaptures !== undefined) replacerArgs.push(namedCaptures);\n var replacement = String(replaceValue.apply(undefined, replacerArgs));\n } else {\n replacement = getSubstitution(matched, S, position, captures, namedCaptures, replaceValue);\n }\n if (position >= nextSourcePosition) {\n accumulatedResult += S.slice(nextSourcePosition, position) + replacement;\n nextSourcePosition = position + matched.length;\n }\n }\n return accumulatedResult + S.slice(nextSourcePosition);\n }\n ];\n\n // https://tc39.github.io/ecma262/#sec-getsubstitution\n function getSubstitution(matched, str, position, captures, namedCaptures, replacement) {\n var tailPos = position + matched.length;\n var m = captures.length;\n var symbols = SUBSTITUTION_SYMBOLS_NO_NAMED;\n if (namedCaptures !== undefined) {\n namedCaptures = toObject(namedCaptures);\n symbols = SUBSTITUTION_SYMBOLS;\n }\n return nativeReplace.call(replacement, symbols, function (match, ch) {\n var capture;\n switch (ch.charAt(0)) {\n case '$': return '$';\n case '&': return matched;\n case '`': return str.slice(0, position);\n case \"'\": return str.slice(tailPos);\n case '<':\n capture = namedCaptures[ch.slice(1, -1)];\n break;\n default: // \\d\\d?\n var n = +ch;\n if (n === 0) return match;\n if (n > m) {\n var f = floor$1(n / 10);\n if (f === 0) return match;\n if (f <= m) return captures[f - 1] === undefined ? ch.charAt(1) : captures[f - 1] + ch.charAt(1);\n return match;\n }\n capture = captures[n - 1];\n }\n return capture === undefined ? '' : capture;\n });\n }\n });\n\n // `SameValue` abstract operation\n // https://tc39.github.io/ecma262/#sec-samevalue\n var sameValue = Object.is || function is(x, y) {\n // eslint-disable-next-line no-self-compare\n return x === y ? x !== 0 || 1 / x === 1 / y : x != x && y != y;\n };\n\n // @@search logic\n fixRegexpWellKnownSymbolLogic('search', 1, function (SEARCH, nativeSearch, maybeCallNative) {\n return [\n // `String.prototype.search` method\n // https://tc39.github.io/ecma262/#sec-string.prototype.search\n function search(regexp) {\n var O = requireObjectCoercible(this);\n var searcher = regexp == undefined ? undefined : regexp[SEARCH];\n return searcher !== undefined ? searcher.call(regexp, O) : new RegExp(regexp)[SEARCH](String(O));\n },\n // `RegExp.prototype[@@search]` method\n // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@search\n function (regexp) {\n var res = maybeCallNative(nativeSearch, regexp, this);\n if (res.done) return res.value;\n\n var rx = anObject(regexp);\n var S = String(this);\n\n var previousLastIndex = rx.lastIndex;\n if (!sameValue(previousLastIndex, 0)) rx.lastIndex = 0;\n var result = regexpExecAbstract(rx, S);\n if (!sameValue(rx.lastIndex, previousLastIndex)) rx.lastIndex = previousLastIndex;\n return result === null ? -1 : result.index;\n }\n ];\n });\n\n var MATCH = wellKnownSymbol('match');\n\n // `IsRegExp` abstract operation\n // https://tc39.github.io/ecma262/#sec-isregexp\n var isRegexp = function (it) {\n var isRegExp;\n return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : classofRaw(it) == 'RegExp');\n };\n\n var SPECIES$4 = wellKnownSymbol('species');\n\n // `SpeciesConstructor` abstract operation\n // https://tc39.github.io/ecma262/#sec-speciesconstructor\n var speciesConstructor = function (O, defaultConstructor) {\n var C = anObject(O).constructor;\n var S;\n return C === undefined || (S = anObject(C)[SPECIES$4]) == undefined ? defaultConstructor : aFunction$1(S);\n };\n\n var arrayPush = [].push;\n var min$3 = Math.min;\n var MAX_UINT32 = 0xFFFFFFFF;\n\n // babel-minify transpiles RegExp('x', 'y') -> /x/y and it causes SyntaxError\n var SUPPORTS_Y = !fails(function () { return !RegExp(MAX_UINT32, 'y'); });\n\n // @@split logic\n fixRegexpWellKnownSymbolLogic('split', 2, function (SPLIT, nativeSplit, maybeCallNative) {\n var internalSplit;\n if (\n 'abbc'.split(/(b)*/)[1] == 'c' ||\n 'test'.split(/(?:)/, -1).length != 4 ||\n 'ab'.split(/(?:ab)*/).length != 2 ||\n '.'.split(/(.?)(.?)/).length != 4 ||\n '.'.split(/()()/).length > 1 ||\n ''.split(/.?/).length\n ) {\n // based on es5-shim implementation, need to rework it\n internalSplit = function (separator, limit) {\n var string = String(requireObjectCoercible(this));\n var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;\n if (lim === 0) return [];\n if (separator === undefined) return [string];\n // If `separator` is not a regex, use native split\n if (!isRegexp(separator)) {\n return nativeSplit.call(string, separator, lim);\n }\n var output = [];\n var flags = (separator.ignoreCase ? 'i' : '') +\n (separator.multiline ? 'm' : '') +\n (separator.unicode ? 'u' : '') +\n (separator.sticky ? 'y' : '');\n var lastLastIndex = 0;\n // Make `global` and avoid `lastIndex` issues by working with a copy\n var separatorCopy = new RegExp(separator.source, flags + 'g');\n var match, lastIndex, lastLength;\n while (match = regexpExec.call(separatorCopy, string)) {\n lastIndex = separatorCopy.lastIndex;\n if (lastIndex > lastLastIndex) {\n output.push(string.slice(lastLastIndex, match.index));\n if (match.length > 1 && match.index < string.length) arrayPush.apply(output, match.slice(1));\n lastLength = match[0].length;\n lastLastIndex = lastIndex;\n if (output.length >= lim) break;\n }\n if (separatorCopy.lastIndex === match.index) separatorCopy.lastIndex++; // Avoid an infinite loop\n }\n if (lastLastIndex === string.length) {\n if (lastLength || !separatorCopy.test('')) output.push('');\n } else output.push(string.slice(lastLastIndex));\n return output.length > lim ? output.slice(0, lim) : output;\n };\n // Chakra, V8\n } else if ('0'.split(undefined, 0).length) {\n internalSplit = function (separator, limit) {\n return separator === undefined && limit === 0 ? [] : nativeSplit.call(this, separator, limit);\n };\n } else internalSplit = nativeSplit;\n\n return [\n // `String.prototype.split` method\n // https://tc39.github.io/ecma262/#sec-string.prototype.split\n function split(separator, limit) {\n var O = requireObjectCoercible(this);\n var splitter = separator == undefined ? undefined : separator[SPLIT];\n return splitter !== undefined\n ? splitter.call(separator, O, limit)\n : internalSplit.call(String(O), separator, limit);\n },\n // `RegExp.prototype[@@split]` method\n // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@split\n //\n // NOTE: This cannot be properly polyfilled in engines that don't support\n // the 'y' flag.\n function (regexp, limit) {\n var res = maybeCallNative(internalSplit, regexp, this, limit, internalSplit !== nativeSplit);\n if (res.done) return res.value;\n\n var rx = anObject(regexp);\n var S = String(this);\n var C = speciesConstructor(rx, RegExp);\n\n var unicodeMatching = rx.unicode;\n var flags = (rx.ignoreCase ? 'i' : '') +\n (rx.multiline ? 'm' : '') +\n (rx.unicode ? 'u' : '') +\n (SUPPORTS_Y ? 'y' : 'g');\n\n // ^(? + rx + ) is needed, in combination with some S slicing, to\n // simulate the 'y' flag.\n var splitter = new C(SUPPORTS_Y ? rx : '^(?:' + rx.source + ')', flags);\n var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;\n if (lim === 0) return [];\n if (S.length === 0) return regexpExecAbstract(splitter, S) === null ? [S] : [];\n var p = 0;\n var q = 0;\n var A = [];\n while (q < S.length) {\n splitter.lastIndex = SUPPORTS_Y ? q : 0;\n var z = regexpExecAbstract(splitter, SUPPORTS_Y ? S : S.slice(q));\n var e;\n if (\n z === null ||\n (e = min$3(toLength(splitter.lastIndex + (SUPPORTS_Y ? 0 : q)), S.length)) === p\n ) {\n q = advanceStringIndex(S, q, unicodeMatching);\n } else {\n A.push(S.slice(p, q));\n if (A.length === lim) return A;\n for (var i = 1; i <= z.length - 1; i++) {\n A.push(z[i]);\n if (A.length === lim) return A;\n }\n q = p = e;\n }\n }\n A.push(S.slice(p));\n return A;\n }\n ];\n }, !SUPPORTS_Y);\n\n // iterable DOM collections\n // flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods\n var domIterables = {\n CSSRuleList: 0,\n CSSStyleDeclaration: 0,\n CSSValueList: 0,\n ClientRectList: 0,\n DOMRectList: 0,\n DOMStringList: 0,\n DOMTokenList: 1,\n DataTransferItemList: 0,\n FileList: 0,\n HTMLAllCollection: 0,\n HTMLCollection: 0,\n HTMLFormElement: 0,\n HTMLSelectElement: 0,\n MediaList: 0,\n MimeTypeArray: 0,\n NamedNodeMap: 0,\n NodeList: 1,\n PaintRequestList: 0,\n Plugin: 0,\n PluginArray: 0,\n SVGLengthList: 0,\n SVGNumberList: 0,\n SVGPathSegList: 0,\n SVGPointList: 0,\n SVGStringList: 0,\n SVGTransformList: 0,\n SourceBufferList: 0,\n StyleSheetList: 0,\n TextTrackCueList: 0,\n TextTrackList: 0,\n TouchList: 0\n };\n\n for (var COLLECTION_NAME in domIterables) {\n var Collection = global_1[COLLECTION_NAME];\n var CollectionPrototype = Collection && Collection.prototype;\n // some Chrome versions have non-configurable methods on DOMTokenList\n if (CollectionPrototype && CollectionPrototype.forEach !== arrayForEach) try {\n createNonEnumerableProperty(CollectionPrototype, 'forEach', arrayForEach);\n } catch (error) {\n CollectionPrototype.forEach = arrayForEach;\n }\n }\n\n var ITERATOR$2 = wellKnownSymbol('iterator');\n var TO_STRING_TAG$3 = wellKnownSymbol('toStringTag');\n var ArrayValues = es_array_iterator.values;\n\n for (var COLLECTION_NAME$1 in domIterables) {\n var Collection$1 = global_1[COLLECTION_NAME$1];\n var CollectionPrototype$1 = Collection$1 && Collection$1.prototype;\n if (CollectionPrototype$1) {\n // some Chrome versions have non-configurable methods on DOMTokenList\n if (CollectionPrototype$1[ITERATOR$2] !== ArrayValues) try {\n createNonEnumerableProperty(CollectionPrototype$1, ITERATOR$2, ArrayValues);\n } catch (error) {\n CollectionPrototype$1[ITERATOR$2] = ArrayValues;\n }\n if (!CollectionPrototype$1[TO_STRING_TAG$3]) {\n createNonEnumerableProperty(CollectionPrototype$1, TO_STRING_TAG$3, COLLECTION_NAME$1);\n }\n if (domIterables[COLLECTION_NAME$1]) for (var METHOD_NAME in es_array_iterator) {\n // some Chrome versions have non-configurable methods on DOMTokenList\n if (CollectionPrototype$1[METHOD_NAME] !== es_array_iterator[METHOD_NAME]) try {\n createNonEnumerableProperty(CollectionPrototype$1, METHOD_NAME, es_array_iterator[METHOD_NAME]);\n } catch (error) {\n CollectionPrototype$1[METHOD_NAME] = es_array_iterator[METHOD_NAME];\n }\n }\n }\n }\n\n var ITERATOR$3 = wellKnownSymbol('iterator');\n\n var nativeUrl = !fails(function () {\n var url = new URL('b?a=1&b=2&c=3', 'http://a');\n var searchParams = url.searchParams;\n var result = '';\n url.pathname = 'c%20d';\n searchParams.forEach(function (value, key) {\n searchParams['delete']('b');\n result += key + value;\n });\n return (isPure && !url.toJSON)\n || !searchParams.sort\n || url.href !== 'http://a/c%20d?a=1&c=3'\n || searchParams.get('c') !== '3'\n || String(new URLSearchParams('?a=1')) !== 'a=1'\n || !searchParams[ITERATOR$3]\n // throws in Edge\n || new URL('https://a@b').username !== 'a'\n || new URLSearchParams(new URLSearchParams('a=b')).get('a') !== 'b'\n // not punycoded in Edge\n || new URL('http://тест').host !== 'xn--e1aybc'\n // not escaped in Chrome 62-\n || new URL('http://a#б').hash !== '#%D0%B1'\n // fails in Chrome 66-\n || result !== 'a1c3'\n // throws in Safari\n || new URL('http://x', undefined).host !== 'x';\n });\n\n var anInstance = function (it, Constructor, name) {\n if (!(it instanceof Constructor)) {\n throw TypeError('Incorrect ' + (name ? name + ' ' : '') + 'invocation');\n } return it;\n };\n\n var nativeAssign = Object.assign;\n var defineProperty$4 = Object.defineProperty;\n\n // `Object.assign` method\n // https://tc39.github.io/ecma262/#sec-object.assign\n var objectAssign = !nativeAssign || fails(function () {\n // should have correct order of operations (Edge bug)\n if (descriptors && nativeAssign({ b: 1 }, nativeAssign(defineProperty$4({}, 'a', {\n enumerable: true,\n get: function () {\n defineProperty$4(this, 'b', {\n value: 3,\n enumerable: false\n });\n }\n }), { b: 2 })).b !== 1) return true;\n // should work with symbols and should have deterministic property order (V8 bug)\n var A = {};\n var B = {};\n // eslint-disable-next-line no-undef\n var symbol = Symbol();\n var alphabet = 'abcdefghijklmnopqrst';\n A[symbol] = 7;\n alphabet.split('').forEach(function (chr) { B[chr] = chr; });\n return nativeAssign({}, A)[symbol] != 7 || objectKeys(nativeAssign({}, B)).join('') != alphabet;\n }) ? function assign(target, source) { // eslint-disable-line no-unused-vars\n var T = toObject(target);\n var argumentsLength = arguments.length;\n var index = 1;\n var getOwnPropertySymbols = objectGetOwnPropertySymbols.f;\n var propertyIsEnumerable = objectPropertyIsEnumerable.f;\n while (argumentsLength > index) {\n var S = indexedObject(arguments[index++]);\n var keys = getOwnPropertySymbols ? objectKeys(S).concat(getOwnPropertySymbols(S)) : objectKeys(S);\n var length = keys.length;\n var j = 0;\n var key;\n while (length > j) {\n key = keys[j++];\n if (!descriptors || propertyIsEnumerable.call(S, key)) T[key] = S[key];\n }\n } return T;\n } : nativeAssign;\n\n // call something on iterator step with safe closing on error\n var callWithSafeIterationClosing = function (iterator, fn, value, ENTRIES) {\n try {\n return ENTRIES ? fn(anObject(value)[0], value[1]) : fn(value);\n // 7.4.6 IteratorClose(iterator, completion)\n } catch (error) {\n var returnMethod = iterator['return'];\n if (returnMethod !== undefined) anObject(returnMethod.call(iterator));\n throw error;\n }\n };\n\n var ITERATOR$4 = wellKnownSymbol('iterator');\n var ArrayPrototype$1 = Array.prototype;\n\n // check on default Array iterator\n var isArrayIteratorMethod = function (it) {\n return it !== undefined && (iterators.Array === it || ArrayPrototype$1[ITERATOR$4] === it);\n };\n\n var ITERATOR$5 = wellKnownSymbol('iterator');\n\n var getIteratorMethod = function (it) {\n if (it != undefined) return it[ITERATOR$5]\n || it['@@iterator']\n || iterators[classof(it)];\n };\n\n // `Array.from` method implementation\n // https://tc39.github.io/ecma262/#sec-array.from\n var arrayFrom = function from(arrayLike /* , mapfn = undefined, thisArg = undefined */) {\n var O = toObject(arrayLike);\n var C = typeof this == 'function' ? this : Array;\n var argumentsLength = arguments.length;\n var mapfn = argumentsLength > 1 ? arguments[1] : undefined;\n var mapping = mapfn !== undefined;\n var iteratorMethod = getIteratorMethod(O);\n var index = 0;\n var length, result, step, iterator, next, value;\n if (mapping) mapfn = functionBindContext(mapfn, argumentsLength > 2 ? arguments[2] : undefined, 2);\n // if the target is not iterable or it's an array with the default iterator - use a simple case\n if (iteratorMethod != undefined && !(C == Array && isArrayIteratorMethod(iteratorMethod))) {\n iterator = iteratorMethod.call(O);\n next = iterator.next;\n result = new C();\n for (;!(step = next.call(iterator)).done; index++) {\n value = mapping ? callWithSafeIterationClosing(iterator, mapfn, [step.value, index], true) : step.value;\n createProperty(result, index, value);\n }\n } else {\n length = toLength(O.length);\n result = new C(length);\n for (;length > index; index++) {\n value = mapping ? mapfn(O[index], index) : O[index];\n createProperty(result, index, value);\n }\n }\n result.length = index;\n return result;\n };\n\n // based on https://github.com/bestiejs/punycode.js/blob/master/punycode.js\n var maxInt = 2147483647; // aka. 0x7FFFFFFF or 2^31-1\n var base = 36;\n var tMin = 1;\n var tMax = 26;\n var skew = 38;\n var damp = 700;\n var initialBias = 72;\n var initialN = 128; // 0x80\n var delimiter = '-'; // '\\x2D'\n var regexNonASCII = /[^\\0-\\u007E]/; // non-ASCII chars\n var regexSeparators = /[.\\u3002\\uFF0E\\uFF61]/g; // RFC 3490 separators\n var OVERFLOW_ERROR = 'Overflow: input needs wider integers to process';\n var baseMinusTMin = base - tMin;\n var floor$2 = Math.floor;\n var stringFromCharCode = String.fromCharCode;\n\n /**\n * Creates an array containing the numeric code points of each Unicode\n * character in the string. While JavaScript uses UCS-2 internally,\n * this function will convert a pair of surrogate halves (each of which\n * UCS-2 exposes as separate characters) into a single code point,\n * matching UTF-16.\n */\n var ucs2decode = function (string) {\n var output = [];\n var counter = 0;\n var length = string.length;\n while (counter < length) {\n var value = string.charCodeAt(counter++);\n if (value >= 0xD800 && value <= 0xDBFF && counter < length) {\n // It's a high surrogate, and there is a next character.\n var extra = string.charCodeAt(counter++);\n if ((extra & 0xFC00) == 0xDC00) { // Low surrogate.\n output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);\n } else {\n // It's an unmatched surrogate; only append this code unit, in case the\n // next code unit is the high surrogate of a surrogate pair.\n output.push(value);\n counter--;\n }\n } else {\n output.push(value);\n }\n }\n return output;\n };\n\n /**\n * Converts a digit/integer into a basic code point.\n */\n var digitToBasic = function (digit) {\n // 0..25 map to ASCII a..z or A..Z\n // 26..35 map to ASCII 0..9\n return digit + 22 + 75 * (digit < 26);\n };\n\n /**\n * Bias adaptation function as per section 3.4 of RFC 3492.\n * https://tools.ietf.org/html/rfc3492#section-3.4\n */\n var adapt = function (delta, numPoints, firstTime) {\n var k = 0;\n delta = firstTime ? floor$2(delta / damp) : delta >> 1;\n delta += floor$2(delta / numPoints);\n for (; delta > baseMinusTMin * tMax >> 1; k += base) {\n delta = floor$2(delta / baseMinusTMin);\n }\n return floor$2(k + (baseMinusTMin + 1) * delta / (delta + skew));\n };\n\n /**\n * Converts a string of Unicode symbols (e.g. a domain name label) to a\n * Punycode string of ASCII-only symbols.\n */\n // eslint-disable-next-line max-statements\n var encode = function (input) {\n var output = [];\n\n // Convert the input in UCS-2 to an array of Unicode code points.\n input = ucs2decode(input);\n\n // Cache the length.\n var inputLength = input.length;\n\n // Initialize the state.\n var n = initialN;\n var delta = 0;\n var bias = initialBias;\n var i, currentValue;\n\n // Handle the basic code points.\n for (i = 0; i < input.length; i++) {\n currentValue = input[i];\n if (currentValue < 0x80) {\n output.push(stringFromCharCode(currentValue));\n }\n }\n\n var basicLength = output.length; // number of basic code points.\n var handledCPCount = basicLength; // number of code points that have been handled;\n\n // Finish the basic string with a delimiter unless it's empty.\n if (basicLength) {\n output.push(delimiter);\n }\n\n // Main encoding loop:\n while (handledCPCount < inputLength) {\n // All non-basic code points < n have been handled already. Find the next larger one:\n var m = maxInt;\n for (i = 0; i < input.length; i++) {\n currentValue = input[i];\n if (currentValue >= n && currentValue < m) {\n m = currentValue;\n }\n }\n\n // Increase `delta` enough to advance the decoder's <n,i> state to <m,0>, but guard against overflow.\n var handledCPCountPlusOne = handledCPCount + 1;\n if (m - n > floor$2((maxInt - delta) / handledCPCountPlusOne)) {\n throw RangeError(OVERFLOW_ERROR);\n }\n\n delta += (m - n) * handledCPCountPlusOne;\n n = m;\n\n for (i = 0; i < input.length; i++) {\n currentValue = input[i];\n if (currentValue < n && ++delta > maxInt) {\n throw RangeError(OVERFLOW_ERROR);\n }\n if (currentValue == n) {\n // Represent delta as a generalized variable-length integer.\n var q = delta;\n for (var k = base; /* no condition */; k += base) {\n var t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);\n if (q < t) break;\n var qMinusT = q - t;\n var baseMinusT = base - t;\n output.push(stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT)));\n q = floor$2(qMinusT / baseMinusT);\n }\n\n output.push(stringFromCharCode(digitToBasic(q)));\n bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);\n delta = 0;\n ++handledCPCount;\n }\n }\n\n ++delta;\n ++n;\n }\n return output.join('');\n };\n\n var stringPunycodeToAscii = function (input) {\n var encoded = [];\n var labels = input.toLowerCase().replace(regexSeparators, '\\u002E').split('.');\n var i, label;\n for (i = 0; i < labels.length; i++) {\n label = labels[i];\n encoded.push(regexNonASCII.test(label) ? 'xn--' + encode(label) : label);\n }\n return encoded.join('.');\n };\n\n var redefineAll = function (target, src, options) {\n for (var key in src) redefine(target, key, src[key], options);\n return target;\n };\n\n var getIterator = function (it) {\n var iteratorMethod = getIteratorMethod(it);\n if (typeof iteratorMethod != 'function') {\n throw TypeError(String(it) + ' is not iterable');\n } return anObject(iteratorMethod.call(it));\n };\n\n // TODO: in core-js@4, move /modules/ dependencies to public entries for better optimization by tools like `preset-env`\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n var $fetch = getBuiltIn('fetch');\n var Headers = getBuiltIn('Headers');\n var ITERATOR$6 = wellKnownSymbol('iterator');\n var URL_SEARCH_PARAMS = 'URLSearchParams';\n var URL_SEARCH_PARAMS_ITERATOR = URL_SEARCH_PARAMS + 'Iterator';\n var setInternalState$3 = internalState.set;\n var getInternalParamsState = internalState.getterFor(URL_SEARCH_PARAMS);\n var getInternalIteratorState = internalState.getterFor(URL_SEARCH_PARAMS_ITERATOR);\n\n var plus = /\\+/g;\n var sequences = Array(4);\n\n var percentSequence = function (bytes) {\n return sequences[bytes - 1] || (sequences[bytes - 1] = RegExp('((?:%[\\\\da-f]{2}){' + bytes + '})', 'gi'));\n };\n\n var percentDecode = function (sequence) {\n try {\n return decodeURIComponent(sequence);\n } catch (error) {\n return sequence;\n }\n };\n\n var deserialize = function (it) {\n var result = it.replace(plus, ' ');\n var bytes = 4;\n try {\n return decodeURIComponent(result);\n } catch (error) {\n while (bytes) {\n result = result.replace(percentSequence(bytes--), percentDecode);\n }\n return result;\n }\n };\n\n var find = /[!'()~]|%20/g;\n\n var replace = {\n '!': '%21',\n \"'\": '%27',\n '(': '%28',\n ')': '%29',\n '~': '%7E',\n '%20': '+'\n };\n\n var replacer = function (match) {\n return replace[match];\n };\n\n var serialize = function (it) {\n return encodeURIComponent(it).replace(find, replacer);\n };\n\n var parseSearchParams = function (result, query) {\n if (query) {\n var attributes = query.split('&');\n var index = 0;\n var attribute, entry;\n while (index < attributes.length) {\n attribute = attributes[index++];\n if (attribute.length) {\n entry = attribute.split('=');\n result.push({\n key: deserialize(entry.shift()),\n value: deserialize(entry.join('='))\n });\n }\n }\n }\n };\n\n var updateSearchParams = function (query) {\n this.entries.length = 0;\n parseSearchParams(this.entries, query);\n };\n\n var validateArgumentsLength = function (passed, required) {\n if (passed < required) throw TypeError('Not enough arguments');\n };\n\n var URLSearchParamsIterator = createIteratorConstructor(function Iterator(params, kind) {\n setInternalState$3(this, {\n type: URL_SEARCH_PARAMS_ITERATOR,\n iterator: getIterator(getInternalParamsState(params).entries),\n kind: kind\n });\n }, 'Iterator', function next() {\n var state = getInternalIteratorState(this);\n var kind = state.kind;\n var step = state.iterator.next();\n var entry = step.value;\n if (!step.done) {\n step.value = kind === 'keys' ? entry.key : kind === 'values' ? entry.value : [entry.key, entry.value];\n } return step;\n });\n\n // `URLSearchParams` constructor\n // https://url.spec.whatwg.org/#interface-urlsearchparams\n var URLSearchParamsConstructor = function URLSearchParams(/* init */) {\n anInstance(this, URLSearchParamsConstructor, URL_SEARCH_PARAMS);\n var init = arguments.length > 0 ? arguments[0] : undefined;\n var that = this;\n var entries = [];\n var iteratorMethod, iterator, next, step, entryIterator, entryNext, first, second, key;\n\n setInternalState$3(that, {\n type: URL_SEARCH_PARAMS,\n entries: entries,\n updateURL: function () { /* empty */ },\n updateSearchParams: updateSearchParams\n });\n\n if (init !== undefined) {\n if (isObject(init)) {\n iteratorMethod = getIteratorMethod(init);\n if (typeof iteratorMethod === 'function') {\n iterator = iteratorMethod.call(init);\n next = iterator.next;\n while (!(step = next.call(iterator)).done) {\n entryIterator = getIterator(anObject(step.value));\n entryNext = entryIterator.next;\n if (\n (first = entryNext.call(entryIterator)).done ||\n (second = entryNext.call(entryIterator)).done ||\n !entryNext.call(entryIterator).done\n ) throw TypeError('Expected sequence with length 2');\n entries.push({ key: first.value + '', value: second.value + '' });\n }\n } else for (key in init) if (has(init, key)) entries.push({ key: key, value: init[key] + '' });\n } else {\n parseSearchParams(entries, typeof init === 'string' ? init.charAt(0) === '?' ? init.slice(1) : init : init + '');\n }\n }\n };\n\n var URLSearchParamsPrototype = URLSearchParamsConstructor.prototype;\n\n redefineAll(URLSearchParamsPrototype, {\n // `URLSearchParams.prototype.appent` method\n // https://url.spec.whatwg.org/#dom-urlsearchparams-append\n append: function append(name, value) {\n validateArgumentsLength(arguments.length, 2);\n var state = getInternalParamsState(this);\n state.entries.push({ key: name + '', value: value + '' });\n state.updateURL();\n },\n // `URLSearchParams.prototype.delete` method\n // https://url.spec.whatwg.org/#dom-urlsearchparams-delete\n 'delete': function (name) {\n validateArgumentsLength(arguments.length, 1);\n var state = getInternalParamsState(this);\n var entries = state.entries;\n var key = name + '';\n var index = 0;\n while (index < entries.length) {\n if (entries[index].key === key) entries.splice(index, 1);\n else index++;\n }\n state.updateURL();\n },\n // `URLSearchParams.prototype.get` method\n // https://url.spec.whatwg.org/#dom-urlsearchparams-get\n get: function get(name) {\n validateArgumentsLength(arguments.length, 1);\n var entries = getInternalParamsState(this).entries;\n var key = name + '';\n var index = 0;\n for (; index < entries.length; index++) {\n if (entries[index].key === key) return entries[index].value;\n }\n return null;\n },\n // `URLSearchParams.prototype.getAll` method\n // https://url.spec.whatwg.org/#dom-urlsearchparams-getall\n getAll: function getAll(name) {\n validateArgumentsLength(arguments.length, 1);\n var entries = getInternalParamsState(this).entries;\n var key = name + '';\n var result = [];\n var index = 0;\n for (; index < entries.length; index++) {\n if (entries[index].key === key) result.push(entries[index].value);\n }\n return result;\n },\n // `URLSearchParams.prototype.has` method\n // https://url.spec.whatwg.org/#dom-urlsearchparams-has\n has: function has(name) {\n validateArgumentsLength(arguments.length, 1);\n var entries = getInternalParamsState(this).entries;\n var key = name + '';\n var index = 0;\n while (index < entries.length) {\n if (entries[index++].key === key) return true;\n }\n return false;\n },\n // `URLSearchParams.prototype.set` method\n // https://url.spec.whatwg.org/#dom-urlsearchparams-set\n set: function set(name, value) {\n validateArgumentsLength(arguments.length, 1);\n var state = getInternalParamsState(this);\n var entries = state.entries;\n var found = false;\n var key = name + '';\n var val = value + '';\n var index = 0;\n var entry;\n for (; index < entries.length; index++) {\n entry = entries[index];\n if (entry.key === key) {\n if (found) entries.splice(index--, 1);\n else {\n found = true;\n entry.value = val;\n }\n }\n }\n if (!found) entries.push({ key: key, value: val });\n state.updateURL();\n },\n // `URLSearchParams.prototype.sort` method\n // https://url.spec.whatwg.org/#dom-urlsearchparams-sort\n sort: function sort() {\n var state = getInternalParamsState(this);\n var entries = state.entries;\n // Array#sort is not stable in some engines\n var slice = entries.slice();\n var entry, entriesIndex, sliceIndex;\n entries.length = 0;\n for (sliceIndex = 0; sliceIndex < slice.length; sliceIndex++) {\n entry = slice[sliceIndex];\n for (entriesIndex = 0; entriesIndex < sliceIndex; entriesIndex++) {\n if (entries[entriesIndex].key > entry.key) {\n entries.splice(entriesIndex, 0, entry);\n break;\n }\n }\n if (entriesIndex === sliceIndex) entries.push(entry);\n }\n state.updateURL();\n },\n // `URLSearchParams.prototype.forEach` method\n forEach: function forEach(callback /* , thisArg */) {\n var entries = getInternalParamsState(this).entries;\n var boundFunction = functionBindContext(callback, arguments.length > 1 ? arguments[1] : undefined, 3);\n var index = 0;\n var entry;\n while (index < entries.length) {\n entry = entries[index++];\n boundFunction(entry.value, entry.key, this);\n }\n },\n // `URLSearchParams.prototype.keys` method\n keys: function keys() {\n return new URLSearchParamsIterator(this, 'keys');\n },\n // `URLSearchParams.prototype.values` method\n values: function values() {\n return new URLSearchParamsIterator(this, 'values');\n },\n // `URLSearchParams.prototype.entries` method\n entries: function entries() {\n return new URLSearchParamsIterator(this, 'entries');\n }\n }, { enumerable: true });\n\n // `URLSearchParams.prototype[@@iterator]` method\n redefine(URLSearchParamsPrototype, ITERATOR$6, URLSearchParamsPrototype.entries);\n\n // `URLSearchParams.prototype.toString` method\n // https://url.spec.whatwg.org/#urlsearchparams-stringification-behavior\n redefine(URLSearchParamsPrototype, 'toString', function toString() {\n var entries = getInternalParamsState(this).entries;\n var result = [];\n var index = 0;\n var entry;\n while (index < entries.length) {\n entry = entries[index++];\n result.push(serialize(entry.key) + '=' + serialize(entry.value));\n } return result.join('&');\n }, { enumerable: true });\n\n setToStringTag(URLSearchParamsConstructor, URL_SEARCH_PARAMS);\n\n _export({ global: true, forced: !nativeUrl }, {\n URLSearchParams: URLSearchParamsConstructor\n });\n\n // Wrap `fetch` for correct work with polyfilled `URLSearchParams`\n // https://github.com/zloirock/core-js/issues/674\n if (!nativeUrl && typeof $fetch == 'function' && typeof Headers == 'function') {\n _export({ global: true, enumerable: true, forced: true }, {\n fetch: function fetch(input /* , init */) {\n var args = [input];\n var init, body, headers;\n if (arguments.length > 1) {\n init = arguments[1];\n if (isObject(init)) {\n body = init.body;\n if (classof(body) === URL_SEARCH_PARAMS) {\n headers = init.headers ? new Headers(init.headers) : new Headers();\n if (!headers.has('content-type')) {\n headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8');\n }\n init = objectCreate(init, {\n body: createPropertyDescriptor(0, String(body)),\n headers: createPropertyDescriptor(0, headers)\n });\n }\n }\n args.push(init);\n } return $fetch.apply(this, args);\n }\n });\n }\n\n var web_urlSearchParams = {\n URLSearchParams: URLSearchParamsConstructor,\n getState: getInternalParamsState\n };\n\n // TODO: in core-js@4, move /modules/ dependencies to public entries for better optimization by tools like `preset-env`\n\n\n\n\n\n\n\n\n\n\n\n var codeAt = stringMultibyte.codeAt;\n\n\n\n\n\n var NativeURL = global_1.URL;\n var URLSearchParams$1 = web_urlSearchParams.URLSearchParams;\n var getInternalSearchParamsState = web_urlSearchParams.getState;\n var setInternalState$4 = internalState.set;\n var getInternalURLState = internalState.getterFor('URL');\n var floor$3 = Math.floor;\n var pow = Math.pow;\n\n var INVALID_AUTHORITY = 'Invalid authority';\n var INVALID_SCHEME = 'Invalid scheme';\n var INVALID_HOST = 'Invalid host';\n var INVALID_PORT = 'Invalid port';\n\n var ALPHA = /[A-Za-z]/;\n var ALPHANUMERIC = /[\\d+-.A-Za-z]/;\n var DIGIT = /\\d/;\n var HEX_START = /^(0x|0X)/;\n var OCT = /^[0-7]+$/;\n var DEC = /^\\d+$/;\n var HEX = /^[\\dA-Fa-f]+$/;\n // eslint-disable-next-line no-control-regex\n var FORBIDDEN_HOST_CODE_POINT = /[\\u0000\\u0009\\u000A\\u000D #%/:?@[\\\\]]/;\n // eslint-disable-next-line no-control-regex\n var FORBIDDEN_HOST_CODE_POINT_EXCLUDING_PERCENT = /[\\u0000\\u0009\\u000A\\u000D #/:?@[\\\\]]/;\n // eslint-disable-next-line no-control-regex\n var LEADING_AND_TRAILING_C0_CONTROL_OR_SPACE = /^[\\u0000-\\u001F ]+|[\\u0000-\\u001F ]+$/g;\n // eslint-disable-next-line no-control-regex\n var TAB_AND_NEW_LINE = /[\\u0009\\u000A\\u000D]/g;\n var EOF;\n\n var parseHost = function (url, input) {\n var result, codePoints, index;\n if (input.charAt(0) == '[') {\n if (input.charAt(input.length - 1) != ']') return INVALID_HOST;\n result = parseIPv6(input.slice(1, -1));\n if (!result) return INVALID_HOST;\n url.host = result;\n // opaque host\n } else if (!isSpecial(url)) {\n if (FORBIDDEN_HOST_CODE_POINT_EXCLUDING_PERCENT.test(input)) return INVALID_HOST;\n result = '';\n codePoints = arrayFrom(input);\n for (index = 0; index < codePoints.length; index++) {\n result += percentEncode(codePoints[index], C0ControlPercentEncodeSet);\n }\n url.host = result;\n } else {\n input = stringPunycodeToAscii(input);\n if (FORBIDDEN_HOST_CODE_POINT.test(input)) return INVALID_HOST;\n result = parseIPv4(input);\n if (result === null) return INVALID_HOST;\n url.host = result;\n }\n };\n\n var parseIPv4 = function (input) {\n var parts = input.split('.');\n var partsLength, numbers, index, part, radix, number, ipv4;\n if (parts.length && parts[parts.length - 1] == '') {\n parts.pop();\n }\n partsLength = parts.length;\n if (partsLength > 4) return input;\n numbers = [];\n for (index = 0; index < partsLength; index++) {\n part = parts[index];\n if (part == '') return input;\n radix = 10;\n if (part.length > 1 && part.charAt(0) == '0') {\n radix = HEX_START.test(part) ? 16 : 8;\n part = part.slice(radix == 8 ? 1 : 2);\n }\n if (part === '') {\n number = 0;\n } else {\n if (!(radix == 10 ? DEC : radix == 8 ? OCT : HEX).test(part)) return input;\n number = parseInt(part, radix);\n }\n numbers.push(number);\n }\n for (index = 0; index < partsLength; index++) {\n number = numbers[index];\n if (index == partsLength - 1) {\n if (number >= pow(256, 5 - partsLength)) return null;\n } else if (number > 255) return null;\n }\n ipv4 = numbers.pop();\n for (index = 0; index < numbers.length; index++) {\n ipv4 += numbers[index] * pow(256, 3 - index);\n }\n return ipv4;\n };\n\n // eslint-disable-next-line max-statements\n var parseIPv6 = function (input) {\n var address = [0, 0, 0, 0, 0, 0, 0, 0];\n var pieceIndex = 0;\n var compress = null;\n var pointer = 0;\n var value, length, numbersSeen, ipv4Piece, number, swaps, swap;\n\n var char = function () {\n return input.charAt(pointer);\n };\n\n if (char() == ':') {\n if (input.charAt(1) != ':') return;\n pointer += 2;\n pieceIndex++;\n compress = pieceIndex;\n }\n while (char()) {\n if (pieceIndex == 8) return;\n if (char() == ':') {\n if (compress !== null) return;\n pointer++;\n pieceIndex++;\n compress = pieceIndex;\n continue;\n }\n value = length = 0;\n while (length < 4 && HEX.test(char())) {\n value = value * 16 + parseInt(char(), 16);\n pointer++;\n length++;\n }\n if (char() == '.') {\n if (length == 0) return;\n pointer -= length;\n if (pieceIndex > 6) return;\n numbersSeen = 0;\n while (char()) {\n ipv4Piece = null;\n if (numbersSeen > 0) {\n if (char() == '.' && numbersSeen < 4) pointer++;\n else return;\n }\n if (!DIGIT.test(char())) return;\n while (DIGIT.test(char())) {\n number = parseInt(char(), 10);\n if (ipv4Piece === null) ipv4Piece = number;\n else if (ipv4Piece == 0) return;\n else ipv4Piece = ipv4Piece * 10 + number;\n if (ipv4Piece > 255) return;\n pointer++;\n }\n address[pieceIndex] = address[pieceIndex] * 256 + ipv4Piece;\n numbersSeen++;\n if (numbersSeen == 2 || numbersSeen == 4) pieceIndex++;\n }\n if (numbersSeen != 4) return;\n break;\n } else if (char() == ':') {\n pointer++;\n if (!char()) return;\n } else if (char()) return;\n address[pieceIndex++] = value;\n }\n if (compress !== null) {\n swaps = pieceIndex - compress;\n pieceIndex = 7;\n while (pieceIndex != 0 && swaps > 0) {\n swap = address[pieceIndex];\n address[pieceIndex--] = address[compress + swaps - 1];\n address[compress + --swaps] = swap;\n }\n } else if (pieceIndex != 8) return;\n return address;\n };\n\n var findLongestZeroSequence = function (ipv6) {\n var maxIndex = null;\n var maxLength = 1;\n var currStart = null;\n var currLength = 0;\n var index = 0;\n for (; index < 8; index++) {\n if (ipv6[index] !== 0) {\n if (currLength > maxLength) {\n maxIndex = currStart;\n maxLength = currLength;\n }\n currStart = null;\n currLength = 0;\n } else {\n if (currStart === null) currStart = index;\n ++currLength;\n }\n }\n if (currLength > maxLength) {\n maxIndex = currStart;\n maxLength = currLength;\n }\n return maxIndex;\n };\n\n var serializeHost = function (host) {\n var result, index, compress, ignore0;\n // ipv4\n if (typeof host == 'number') {\n result = [];\n for (index = 0; index < 4; index++) {\n result.unshift(host % 256);\n host = floor$3(host / 256);\n } return result.join('.');\n // ipv6\n } else if (typeof host == 'object') {\n result = '';\n compress = findLongestZeroSequence(host);\n for (index = 0; index < 8; index++) {\n if (ignore0 && host[index] === 0) continue;\n if (ignore0) ignore0 = false;\n if (compress === index) {\n result += index ? ':' : '::';\n ignore0 = true;\n } else {\n result += host[index].toString(16);\n if (index < 7) result += ':';\n }\n }\n return '[' + result + ']';\n } return host;\n };\n\n var C0ControlPercentEncodeSet = {};\n var fragmentPercentEncodeSet = objectAssign({}, C0ControlPercentEncodeSet, {\n ' ': 1, '\"': 1, '<': 1, '>': 1, '`': 1\n });\n var pathPercentEncodeSet = objectAssign({}, fragmentPercentEncodeSet, {\n '#': 1, '?': 1, '{': 1, '}': 1\n });\n var userinfoPercentEncodeSet = objectAssign({}, pathPercentEncodeSet, {\n '/': 1, ':': 1, ';': 1, '=': 1, '@': 1, '[': 1, '\\\\': 1, ']': 1, '^': 1, '|': 1\n });\n\n var percentEncode = function (char, set) {\n var code = codeAt(char, 0);\n return code > 0x20 && code < 0x7F && !has(set, char) ? char : encodeURIComponent(char);\n };\n\n var specialSchemes = {\n ftp: 21,\n file: null,\n http: 80,\n https: 443,\n ws: 80,\n wss: 443\n };\n\n var isSpecial = function (url) {\n return has(specialSchemes, url.scheme);\n };\n\n var includesCredentials = function (url) {\n return url.username != '' || url.password != '';\n };\n\n var cannotHaveUsernamePasswordPort = function (url) {\n return !url.host || url.cannotBeABaseURL || url.scheme == 'file';\n };\n\n var isWindowsDriveLetter = function (string, normalized) {\n var second;\n return string.length == 2 && ALPHA.test(string.charAt(0))\n && ((second = string.charAt(1)) == ':' || (!normalized && second == '|'));\n };\n\n var startsWithWindowsDriveLetter = function (string) {\n var third;\n return string.length > 1 && isWindowsDriveLetter(string.slice(0, 2)) && (\n string.length == 2 ||\n ((third = string.charAt(2)) === '/' || third === '\\\\' || third === '?' || third === '#')\n );\n };\n\n var shortenURLsPath = function (url) {\n var path = url.path;\n var pathSize = path.length;\n if (pathSize && (url.scheme != 'file' || pathSize != 1 || !isWindowsDriveLetter(path[0], true))) {\n path.pop();\n }\n };\n\n var isSingleDot = function (segment) {\n return segment === '.' || segment.toLowerCase() === '%2e';\n };\n\n var isDoubleDot = function (segment) {\n segment = segment.toLowerCase();\n return segment === '..' || segment === '%2e.' || segment === '.%2e' || segment === '%2e%2e';\n };\n\n // States:\n var SCHEME_START = {};\n var SCHEME = {};\n var NO_SCHEME = {};\n var SPECIAL_RELATIVE_OR_AUTHORITY = {};\n var PATH_OR_AUTHORITY = {};\n var RELATIVE = {};\n var RELATIVE_SLASH = {};\n var SPECIAL_AUTHORITY_SLASHES = {};\n var SPECIAL_AUTHORITY_IGNORE_SLASHES = {};\n var AUTHORITY = {};\n var HOST = {};\n var HOSTNAME = {};\n var PORT = {};\n var FILE = {};\n var FILE_SLASH = {};\n var FILE_HOST = {};\n var PATH_START = {};\n var PATH = {};\n var CANNOT_BE_A_BASE_URL_PATH = {};\n var QUERY = {};\n var FRAGMENT = {};\n\n // eslint-disable-next-line max-statements\n var parseURL = function (url, input, stateOverride, base) {\n var state = stateOverride || SCHEME_START;\n var pointer = 0;\n var buffer = '';\n var seenAt = false;\n var seenBracket = false;\n var seenPasswordToken = false;\n var codePoints, char, bufferCodePoints, failure;\n\n if (!stateOverride) {\n url.scheme = '';\n url.username = '';\n url.password = '';\n url.host = null;\n url.port = null;\n url.path = [];\n url.query = null;\n url.fragment = null;\n url.cannotBeABaseURL = false;\n input = input.replace(LEADING_AND_TRAILING_C0_CONTROL_OR_SPACE, '');\n }\n\n input = input.replace(TAB_AND_NEW_LINE, '');\n\n codePoints = arrayFrom(input);\n\n while (pointer <= codePoints.length) {\n char = codePoints[pointer];\n switch (state) {\n case SCHEME_START:\n if (char && ALPHA.test(char)) {\n buffer += char.toLowerCase();\n state = SCHEME;\n } else if (!stateOverride) {\n state = NO_SCHEME;\n continue;\n } else return INVALID_SCHEME;\n break;\n\n case SCHEME:\n if (char && (ALPHANUMERIC.test(char) || char == '+' || char == '-' || char == '.')) {\n buffer += char.toLowerCase();\n } else if (char == ':') {\n if (stateOverride && (\n (isSpecial(url) != has(specialSchemes, buffer)) ||\n (buffer == 'file' && (includesCredentials(url) || url.port !== null)) ||\n (url.scheme == 'file' && !url.host)\n )) return;\n url.scheme = buffer;\n if (stateOverride) {\n if (isSpecial(url) && specialSchemes[url.scheme] == url.port) url.port = null;\n return;\n }\n buffer = '';\n if (url.scheme == 'file') {\n state = FILE;\n } else if (isSpecial(url) && base && base.scheme == url.scheme) {\n state = SPECIAL_RELATIVE_OR_AUTHORITY;\n } else if (isSpecial(url)) {\n state = SPECIAL_AUTHORITY_SLASHES;\n } else if (codePoints[pointer + 1] == '/') {\n state = PATH_OR_AUTHORITY;\n pointer++;\n } else {\n url.cannotBeABaseURL = true;\n url.path.push('');\n state = CANNOT_BE_A_BASE_URL_PATH;\n }\n } else if (!stateOverride) {\n buffer = '';\n state = NO_SCHEME;\n pointer = 0;\n continue;\n } else return INVALID_SCHEME;\n break;\n\n case NO_SCHEME:\n if (!base || (base.cannotBeABaseURL && char != '#')) return INVALID_SCHEME;\n if (base.cannotBeABaseURL && char == '#') {\n url.scheme = base.scheme;\n url.path = base.path.slice();\n url.query = base.query;\n url.fragment = '';\n url.cannotBeABaseURL = true;\n state = FRAGMENT;\n break;\n }\n state = base.scheme == 'file' ? FILE : RELATIVE;\n continue;\n\n case SPECIAL_RELATIVE_OR_AUTHORITY:\n if (char == '/' && codePoints[pointer + 1] == '/') {\n state = SPECIAL_AUTHORITY_IGNORE_SLASHES;\n pointer++;\n } else {\n state = RELATIVE;\n continue;\n } break;\n\n case PATH_OR_AUTHORITY:\n if (char == '/') {\n state = AUTHORITY;\n break;\n } else {\n state = PATH;\n continue;\n }\n\n case RELATIVE:\n url.scheme = base.scheme;\n if (char == EOF) {\n url.username = base.username;\n url.password = base.password;\n url.host = base.host;\n url.port = base.port;\n url.path = base.path.slice();\n url.query = base.query;\n } else if (char == '/' || (char == '\\\\' && isSpecial(url))) {\n state = RELATIVE_SLASH;\n } else if (char == '?') {\n url.username = base.username;\n url.password = base.password;\n url.host = base.host;\n url.port = base.port;\n url.path = base.path.slice();\n url.query = '';\n state = QUERY;\n } else if (char == '#') {\n url.username = base.username;\n url.password = base.password;\n url.host = base.host;\n url.port = base.port;\n url.path = base.path.slice();\n url.query = base.query;\n url.fragment = '';\n state = FRAGMENT;\n } else {\n url.username = base.username;\n url.password = base.password;\n url.host = base.host;\n url.port = base.port;\n url.path = base.path.slice();\n url.path.pop();\n state = PATH;\n continue;\n } break;\n\n case RELATIVE_SLASH:\n if (isSpecial(url) && (char == '/' || char == '\\\\')) {\n state = SPECIAL_AUTHORITY_IGNORE_SLASHES;\n } else if (char == '/') {\n state = AUTHORITY;\n } else {\n url.username = base.username;\n url.password = base.password;\n url.host = base.host;\n url.port = base.port;\n state = PATH;\n continue;\n } break;\n\n case SPECIAL_AUTHORITY_SLASHES:\n state = SPECIAL_AUTHORITY_IGNORE_SLASHES;\n if (char != '/' || buffer.charAt(pointer + 1) != '/') continue;\n pointer++;\n break;\n\n case SPECIAL_AUTHORITY_IGNORE_SLASHES:\n if (char != '/' && char != '\\\\') {\n state = AUTHORITY;\n continue;\n } break;\n\n case AUTHORITY:\n if (char == '@') {\n if (seenAt) buffer = '%40' + buffer;\n seenAt = true;\n bufferCodePoints = arrayFrom(buffer);\n for (var i = 0; i < bufferCodePoints.length; i++) {\n var codePoint = bufferCodePoints[i];\n if (codePoint == ':' && !seenPasswordToken) {\n seenPasswordToken = true;\n continue;\n }\n var encodedCodePoints = percentEncode(codePoint, userinfoPercentEncodeSet);\n if (seenPasswordToken) url.password += encodedCodePoints;\n else url.username += encodedCodePoints;\n }\n buffer = '';\n } else if (\n char == EOF || char == '/' || char == '?' || char == '#' ||\n (char == '\\\\' && isSpecial(url))\n ) {\n if (seenAt && buffer == '') return INVALID_AUTHORITY;\n pointer -= arrayFrom(buffer).length + 1;\n buffer = '';\n state = HOST;\n } else buffer += char;\n break;\n\n case HOST:\n case HOSTNAME:\n if (stateOverride && url.scheme == 'file') {\n state = FILE_HOST;\n continue;\n } else if (char == ':' && !seenBracket) {\n if (buffer == '') return INVALID_HOST;\n failure = parseHost(url, buffer);\n if (failure) return failure;\n buffer = '';\n state = PORT;\n if (stateOverride == HOSTNAME) return;\n } else if (\n char == EOF || char == '/' || char == '?' || char == '#' ||\n (char == '\\\\' && isSpecial(url))\n ) {\n if (isSpecial(url) && buffer == '') return INVALID_HOST;\n if (stateOverride && buffer == '' && (includesCredentials(url) || url.port !== null)) return;\n failure = parseHost(url, buffer);\n if (failure) return failure;\n buffer = '';\n state = PATH_START;\n if (stateOverride) return;\n continue;\n } else {\n if (char == '[') seenBracket = true;\n else if (char == ']') seenBracket = false;\n buffer += char;\n } break;\n\n case PORT:\n if (DIGIT.test(char)) {\n buffer += char;\n } else if (\n char == EOF || char == '/' || char == '?' || char == '#' ||\n (char == '\\\\' && isSpecial(url)) ||\n stateOverride\n ) {\n if (buffer != '') {\n var port = parseInt(buffer, 10);\n if (port > 0xFFFF) return INVALID_PORT;\n url.port = (isSpecial(url) && port === specialSchemes[url.scheme]) ? null : port;\n buffer = '';\n }\n if (stateOverride) return;\n state = PATH_START;\n continue;\n } else return INVALID_PORT;\n break;\n\n case FILE:\n url.scheme = 'file';\n if (char == '/' || char == '\\\\') state = FILE_SLASH;\n else if (base && base.scheme == 'file') {\n if (char == EOF) {\n url.host = base.host;\n url.path = base.path.slice();\n url.query = base.query;\n } else if (char == '?') {\n url.host = base.host;\n url.path = base.path.slice();\n url.query = '';\n state = QUERY;\n } else if (char == '#') {\n url.host = base.host;\n url.path = base.path.slice();\n url.query = base.query;\n url.fragment = '';\n state = FRAGMENT;\n } else {\n if (!startsWithWindowsDriveLetter(codePoints.slice(pointer).join(''))) {\n url.host = base.host;\n url.path = base.path.slice();\n shortenURLsPath(url);\n }\n state = PATH;\n continue;\n }\n } else {\n state = PATH;\n continue;\n } break;\n\n case FILE_SLASH:\n if (char == '/' || char == '\\\\') {\n state = FILE_HOST;\n break;\n }\n if (base && base.scheme == 'file' && !startsWithWindowsDriveLetter(codePoints.slice(pointer).join(''))) {\n if (isWindowsDriveLetter(base.path[0], true)) url.path.push(base.path[0]);\n else url.host = base.host;\n }\n state = PATH;\n continue;\n\n case FILE_HOST:\n if (char == EOF || char == '/' || char == '\\\\' || char == '?' || char == '#') {\n if (!stateOverride && isWindowsDriveLetter(buffer)) {\n state = PATH;\n } else if (buffer == '') {\n url.host = '';\n if (stateOverride) return;\n state = PATH_START;\n } else {\n failure = parseHost(url, buffer);\n if (failure) return failure;\n if (url.host == 'localhost') url.host = '';\n if (stateOverride) return;\n buffer = '';\n state = PATH_START;\n } continue;\n } else buffer += char;\n break;\n\n case PATH_START:\n if (isSpecial(url)) {\n state = PATH;\n if (char != '/' && char != '\\\\') continue;\n } else if (!stateOverride && char == '?') {\n url.query = '';\n state = QUERY;\n } else if (!stateOverride && char == '#') {\n url.fragment = '';\n state = FRAGMENT;\n } else if (char != EOF) {\n state = PATH;\n if (char != '/') continue;\n } break;\n\n case PATH:\n if (\n char == EOF || char == '/' ||\n (char == '\\\\' && isSpecial(url)) ||\n (!stateOverride && (char == '?' || char == '#'))\n ) {\n if (isDoubleDot(buffer)) {\n shortenURLsPath(url);\n if (char != '/' && !(char == '\\\\' && isSpecial(url))) {\n url.path.push('');\n }\n } else if (isSingleDot(buffer)) {\n if (char != '/' && !(char == '\\\\' && isSpecial(url))) {\n url.path.push('');\n }\n } else {\n if (url.scheme == 'file' && !url.path.length && isWindowsDriveLetter(buffer)) {\n if (url.host) url.host = '';\n buffer = buffer.charAt(0) + ':'; // normalize windows drive letter\n }\n url.path.push(buffer);\n }\n buffer = '';\n if (url.scheme == 'file' && (char == EOF || char == '?' || char == '#')) {\n while (url.path.length > 1 && url.path[0] === '') {\n url.path.shift();\n }\n }\n if (char == '?') {\n url.query = '';\n state = QUERY;\n } else if (char == '#') {\n url.fragment = '';\n state = FRAGMENT;\n }\n } else {\n buffer += percentEncode(char, pathPercentEncodeSet);\n } break;\n\n case CANNOT_BE_A_BASE_URL_PATH:\n if (char == '?') {\n url.query = '';\n state = QUERY;\n } else if (char == '#') {\n url.fragment = '';\n state = FRAGMENT;\n } else if (char != EOF) {\n url.path[0] += percentEncode(char, C0ControlPercentEncodeSet);\n } break;\n\n case QUERY:\n if (!stateOverride && char == '#') {\n url.fragment = '';\n state = FRAGMENT;\n } else if (char != EOF) {\n if (char == \"'\" && isSpecial(url)) url.query += '%27';\n else if (char == '#') url.query += '%23';\n else url.query += percentEncode(char, C0ControlPercentEncodeSet);\n } break;\n\n case FRAGMENT:\n if (char != EOF) url.fragment += percentEncode(char, fragmentPercentEncodeSet);\n break;\n }\n\n pointer++;\n }\n };\n\n // `URL` constructor\n // https://url.spec.whatwg.org/#url-class\n var URLConstructor = function URL(url /* , base */) {\n var that = anInstance(this, URLConstructor, 'URL');\n var base = arguments.length > 1 ? arguments[1] : undefined;\n var urlString = String(url);\n var state = setInternalState$4(that, { type: 'URL' });\n var baseState, failure;\n if (base !== undefined) {\n if (base instanceof URLConstructor) baseState = getInternalURLState(base);\n else {\n failure = parseURL(baseState = {}, String(base));\n if (failure) throw TypeError(failure);\n }\n }\n failure = parseURL(state, urlString, null, baseState);\n if (failure) throw TypeError(failure);\n var searchParams = state.searchParams = new URLSearchParams$1();\n var searchParamsState = getInternalSearchParamsState(searchParams);\n searchParamsState.updateSearchParams(state.query);\n searchParamsState.updateURL = function () {\n state.query = String(searchParams) || null;\n };\n if (!descriptors) {\n that.href = serializeURL.call(that);\n that.origin = getOrigin.call(that);\n that.protocol = getProtocol.call(that);\n that.username = getUsername.call(that);\n that.password = getPassword.call(that);\n that.host = getHost.call(that);\n that.hostname = getHostname.call(that);\n that.port = getPort.call(that);\n that.pathname = getPathname.call(that);\n that.search = getSearch.call(that);\n that.searchParams = getSearchParams.call(that);\n that.hash = getHash.call(that);\n }\n };\n\n var URLPrototype = URLConstructor.prototype;\n\n var serializeURL = function () {\n var url = getInternalURLState(this);\n var scheme = url.scheme;\n var username = url.username;\n var password = url.password;\n var host = url.host;\n var port = url.port;\n var path = url.path;\n var query = url.query;\n var fragment = url.fragment;\n var output = scheme + ':';\n if (host !== null) {\n output += '//';\n if (includesCredentials(url)) {\n output += username + (password ? ':' + password : '') + '@';\n }\n output += serializeHost(host);\n if (port !== null) output += ':' + port;\n } else if (scheme == 'file') output += '//';\n output += url.cannotBeABaseURL ? path[0] : path.length ? '/' + path.join('/') : '';\n if (query !== null) output += '?' + query;\n if (fragment !== null) output += '#' + fragment;\n return output;\n };\n\n var getOrigin = function () {\n var url = getInternalURLState(this);\n var scheme = url.scheme;\n var port = url.port;\n if (scheme == 'blob') try {\n return new URL(scheme.path[0]).origin;\n } catch (error) {\n return 'null';\n }\n if (scheme == 'file' || !isSpecial(url)) return 'null';\n return scheme + '://' + serializeHost(url.host) + (port !== null ? ':' + port : '');\n };\n\n var getProtocol = function () {\n return getInternalURLState(this).scheme + ':';\n };\n\n var getUsername = function () {\n return getInternalURLState(this).username;\n };\n\n var getPassword = function () {\n return getInternalURLState(this).password;\n };\n\n var getHost = function () {\n var url = getInternalURLState(this);\n var host = url.host;\n var port = url.port;\n return host === null ? ''\n : port === null ? serializeHost(host)\n : serializeHost(host) + ':' + port;\n };\n\n var getHostname = function () {\n var host = getInternalURLState(this).host;\n return host === null ? '' : serializeHost(host);\n };\n\n var getPort = function () {\n var port = getInternalURLState(this).port;\n return port === null ? '' : String(port);\n };\n\n var getPathname = function () {\n var url = getInternalURLState(this);\n var path = url.path;\n return url.cannotBeABaseURL ? path[0] : path.length ? '/' + path.join('/') : '';\n };\n\n var getSearch = function () {\n var query = getInternalURLState(this).query;\n return query ? '?' + query : '';\n };\n\n var getSearchParams = function () {\n return getInternalURLState(this).searchParams;\n };\n\n var getHash = function () {\n var fragment = getInternalURLState(this).fragment;\n return fragment ? '#' + fragment : '';\n };\n\n var accessorDescriptor = function (getter, setter) {\n return { get: getter, set: setter, configurable: true, enumerable: true };\n };\n\n if (descriptors) {\n objectDefineProperties(URLPrototype, {\n // `URL.prototype.href` accessors pair\n // https://url.spec.whatwg.org/#dom-url-href\n href: accessorDescriptor(serializeURL, function (href) {\n var url = getInternalURLState(this);\n var urlString = String(href);\n var failure = parseURL(url, urlString);\n if (failure) throw TypeError(failure);\n getInternalSearchParamsState(url.searchParams).updateSearchParams(url.query);\n }),\n // `URL.prototype.origin` getter\n // https://url.spec.whatwg.org/#dom-url-origin\n origin: accessorDescriptor(getOrigin),\n // `URL.prototype.protocol` accessors pair\n // https://url.spec.whatwg.org/#dom-url-protocol\n protocol: accessorDescriptor(getProtocol, function (protocol) {\n var url = getInternalURLState(this);\n parseURL(url, String(protocol) + ':', SCHEME_START);\n }),\n // `URL.prototype.username` accessors pair\n // https://url.spec.whatwg.org/#dom-url-username\n username: accessorDescriptor(getUsername, function (username) {\n var url = getInternalURLState(this);\n var codePoints = arrayFrom(String(username));\n if (cannotHaveUsernamePasswordPort(url)) return;\n url.username = '';\n for (var i = 0; i < codePoints.length; i++) {\n url.username += percentEncode(codePoints[i], userinfoPercentEncodeSet);\n }\n }),\n // `URL.prototype.password` accessors pair\n // https://url.spec.whatwg.org/#dom-url-password\n password: accessorDescriptor(getPassword, function (password) {\n var url = getInternalURLState(this);\n var codePoints = arrayFrom(String(password));\n if (cannotHaveUsernamePasswordPort(url)) return;\n url.password = '';\n for (var i = 0; i < codePoints.length; i++) {\n url.password += percentEncode(codePoints[i], userinfoPercentEncodeSet);\n }\n }),\n // `URL.prototype.host` accessors pair\n // https://url.spec.whatwg.org/#dom-url-host\n host: accessorDescriptor(getHost, function (host) {\n var url = getInternalURLState(this);\n if (url.cannotBeABaseURL) return;\n parseURL(url, String(host), HOST);\n }),\n // `URL.prototype.hostname` accessors pair\n // https://url.spec.whatwg.org/#dom-url-hostname\n hostname: accessorDescriptor(getHostname, function (hostname) {\n var url = getInternalURLState(this);\n if (url.cannotBeABaseURL) return;\n parseURL(url, String(hostname), HOSTNAME);\n }),\n // `URL.prototype.port` accessors pair\n // https://url.spec.whatwg.org/#dom-url-port\n port: accessorDescriptor(getPort, function (port) {\n var url = getInternalURLState(this);\n if (cannotHaveUsernamePasswordPort(url)) return;\n port = String(port);\n if (port == '') url.port = null;\n else parseURL(url, port, PORT);\n }),\n // `URL.prototype.pathname` accessors pair\n // https://url.spec.whatwg.org/#dom-url-pathname\n pathname: accessorDescriptor(getPathname, function (pathname) {\n var url = getInternalURLState(this);\n if (url.cannotBeABaseURL) return;\n url.path = [];\n parseURL(url, pathname + '', PATH_START);\n }),\n // `URL.prototype.search` accessors pair\n // https://url.spec.whatwg.org/#dom-url-search\n search: accessorDescriptor(getSearch, function (search) {\n var url = getInternalURLState(this);\n search = String(search);\n if (search == '') {\n url.query = null;\n } else {\n if ('?' == search.charAt(0)) search = search.slice(1);\n url.query = '';\n parseURL(url, search, QUERY);\n }\n getInternalSearchParamsState(url.searchParams).updateSearchParams(url.query);\n }),\n // `URL.prototype.searchParams` getter\n // https://url.spec.whatwg.org/#dom-url-searchparams\n searchParams: accessorDescriptor(getSearchParams),\n // `URL.prototype.hash` accessors pair\n // https://url.spec.whatwg.org/#dom-url-hash\n hash: accessorDescriptor(getHash, function (hash) {\n var url = getInternalURLState(this);\n hash = String(hash);\n if (hash == '') {\n url.fragment = null;\n return;\n }\n if ('#' == hash.charAt(0)) hash = hash.slice(1);\n url.fragment = '';\n parseURL(url, hash, FRAGMENT);\n })\n });\n }\n\n // `URL.prototype.toJSON` method\n // https://url.spec.whatwg.org/#dom-url-tojson\n redefine(URLPrototype, 'toJSON', function toJSON() {\n return serializeURL.call(this);\n }, { enumerable: true });\n\n // `URL.prototype.toString` method\n // https://url.spec.whatwg.org/#URL-stringification-behavior\n redefine(URLPrototype, 'toString', function toString() {\n return serializeURL.call(this);\n }, { enumerable: true });\n\n if (NativeURL) {\n var nativeCreateObjectURL = NativeURL.createObjectURL;\n var nativeRevokeObjectURL = NativeURL.revokeObjectURL;\n // `URL.createObjectURL` method\n // https://developer.mozilla.org/en-US/docs/Web/API/URL/createObjectURL\n // eslint-disable-next-line no-unused-vars\n if (nativeCreateObjectURL) redefine(URLConstructor, 'createObjectURL', function createObjectURL(blob) {\n return nativeCreateObjectURL.apply(NativeURL, arguments);\n });\n // `URL.revokeObjectURL` method\n // https://developer.mozilla.org/en-US/docs/Web/API/URL/revokeObjectURL\n // eslint-disable-next-line no-unused-vars\n if (nativeRevokeObjectURL) redefine(URLConstructor, 'revokeObjectURL', function revokeObjectURL(url) {\n return nativeRevokeObjectURL.apply(NativeURL, arguments);\n });\n }\n\n setToStringTag(URLConstructor, 'URL');\n\n _export({ global: true, forced: !nativeUrl, sham: !descriptors }, {\n URL: URLConstructor\n });\n\n function _typeof(obj) {\n \"@babel/helpers - typeof\";\n\n if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") {\n _typeof = function (obj) {\n return typeof obj;\n };\n } else {\n _typeof = function (obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n };\n }\n\n return _typeof(obj);\n }\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 ownKeys$1(object, enumerableOnly) {\n var keys = Object.keys(object);\n\n if (Object.getOwnPropertySymbols) {\n var symbols = Object.getOwnPropertySymbols(object);\n if (enumerableOnly) symbols = symbols.filter(function (sym) {\n return Object.getOwnPropertyDescriptor(object, sym).enumerable;\n });\n keys.push.apply(keys, symbols);\n }\n\n return keys;\n }\n\n function _objectSpread2(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i] != null ? arguments[i] : {};\n\n if (i % 2) {\n ownKeys$1(Object(source), true).forEach(function (key) {\n _defineProperty(target, key, source[key]);\n });\n } else if (Object.getOwnPropertyDescriptors) {\n Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));\n } else {\n ownKeys$1(Object(source)).forEach(function (key) {\n Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));\n });\n }\n }\n\n return target;\n }\n\n function _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n\n return target;\n }\n\n function _objectWithoutProperties(source, excluded) {\n if (source == null) return {};\n\n var target = _objectWithoutPropertiesLoose(source, excluded);\n\n var key, i;\n\n if (Object.getOwnPropertySymbols) {\n var sourceSymbolKeys = Object.getOwnPropertySymbols(source);\n\n for (i = 0; i < sourceSymbolKeys.length; i++) {\n key = sourceSymbolKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;\n target[key] = source[key];\n }\n }\n\n return target;\n }\n\n function _slicedToArray(arr, i) {\n return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();\n }\n\n function _toConsumableArray(arr) {\n return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();\n }\n\n function _arrayWithoutHoles(arr) {\n if (Array.isArray(arr)) return _arrayLikeToArray(arr);\n }\n\n function _arrayWithHoles(arr) {\n if (Array.isArray(arr)) return arr;\n }\n\n function _iterableToArray(iter) {\n if (typeof Symbol !== \"undefined\" && Symbol.iterator in Object(iter)) return Array.from(iter);\n }\n\n function _iterableToArrayLimit(arr, i) {\n if (typeof Symbol === \"undefined\" || !(Symbol.iterator in Object(arr))) return;\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 _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return _arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(o);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);\n }\n\n function _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n\n for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];\n\n return arr2;\n }\n\n function _nonIterableSpread() {\n throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n }\n\n function _nonIterableRest() {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n }\n\n (function (global) {\n /**\r\n * Polyfill URLSearchParams\r\n *\r\n * Inspired from : https://github.com/WebReflection/url-search-params/blob/master/src/url-search-params.js\r\n */\n var checkIfIteratorIsSupported = function checkIfIteratorIsSupported() {\n try {\n return !!Symbol.iterator;\n } catch (error) {\n return false;\n }\n };\n\n var iteratorSupported = checkIfIteratorIsSupported();\n\n var createIterator = function createIterator(items) {\n var iterator = {\n next: function next() {\n var value = items.shift();\n return {\n done: value === void 0,\n value: value\n };\n }\n };\n\n if (iteratorSupported) {\n iterator[Symbol.iterator] = function () {\n return iterator;\n };\n }\n\n return iterator;\n };\n /**\r\n * Search param name and values should be encoded according to https://url.spec.whatwg.org/#urlencoded-serializing\r\n * encodeURIComponent() produces the same result except encoding spaces as `%20` instead of `+`.\r\n */\n\n\n var serializeParam = function serializeParam(value) {\n return encodeURIComponent(value).replace(/%20/g, '+');\n };\n\n var deserializeParam = function deserializeParam(value) {\n return decodeURIComponent(String(value).replace(/\\+/g, ' '));\n };\n\n var polyfillURLSearchParams = function polyfillURLSearchParams() {\n var URLSearchParams = function URLSearchParams(searchString) {\n Object.defineProperty(this, '_entries', {\n writable: true,\n value: {}\n });\n\n var typeofSearchString = _typeof(searchString);\n\n if (typeofSearchString === 'undefined') ; else if (typeofSearchString === 'string') {\n if (searchString !== '') {\n this._fromString(searchString);\n }\n } else if (searchString instanceof URLSearchParams) {\n var _this = this;\n\n searchString.forEach(function (value, name) {\n _this.append(name, value);\n });\n } else if (searchString !== null && typeofSearchString === 'object') {\n if (Object.prototype.toString.call(searchString) === '[object Array]') {\n for (var i = 0; i < searchString.length; i++) {\n var entry = searchString[i];\n\n if (Object.prototype.toString.call(entry) === '[object Array]' || entry.length !== 2) {\n this.append(entry[0], entry[1]);\n } else {\n throw new TypeError('Expected [string, any] as entry at index ' + i + ' of URLSearchParams\\'s input');\n }\n }\n } else {\n for (var key in searchString) {\n if (searchString.hasOwnProperty(key)) {\n this.append(key, searchString[key]);\n }\n }\n }\n } else {\n throw new TypeError('Unsupported input\\'s type for URLSearchParams');\n }\n };\n\n var proto = URLSearchParams.prototype;\n\n proto.append = function (name, value) {\n if (name in this._entries) {\n this._entries[name].push(String(value));\n } else {\n this._entries[name] = [String(value)];\n }\n };\n\n proto.delete = function (name) {\n delete this._entries[name];\n };\n\n proto.get = function (name) {\n return name in this._entries ? this._entries[name][0] : null;\n };\n\n proto.getAll = function (name) {\n return name in this._entries ? this._entries[name].slice(0) : [];\n };\n\n proto.has = function (name) {\n return name in this._entries;\n };\n\n proto.set = function (name, value) {\n this._entries[name] = [String(value)];\n };\n\n proto.forEach = function (callback, thisArg) {\n var entries;\n\n for (var name in this._entries) {\n if (this._entries.hasOwnProperty(name)) {\n entries = this._entries[name];\n\n for (var i = 0; i < entries.length; i++) {\n callback.call(thisArg, entries[i], name, this);\n }\n }\n }\n };\n\n proto.keys = function () {\n var items = [];\n this.forEach(function (value, name) {\n items.push(name);\n });\n return createIterator(items);\n };\n\n proto.values = function () {\n var items = [];\n this.forEach(function (value) {\n items.push(value);\n });\n return createIterator(items);\n };\n\n proto.entries = function () {\n var items = [];\n this.forEach(function (value, name) {\n items.push([name, value]);\n });\n return createIterator(items);\n };\n\n if (iteratorSupported) {\n proto[Symbol.iterator] = proto.entries;\n }\n\n proto.toString = function () {\n var searchArray = [];\n this.forEach(function (value, name) {\n searchArray.push(serializeParam(name) + '=' + serializeParam(value));\n });\n return searchArray.join('&');\n };\n\n global.URLSearchParams = URLSearchParams;\n };\n\n var checkIfURLSearchParamsSupported = function checkIfURLSearchParamsSupported() {\n try {\n var URLSearchParams = global.URLSearchParams;\n return new URLSearchParams('?a=1').toString() === 'a=1' && typeof URLSearchParams.prototype.set === 'function';\n } catch (e) {\n return false;\n }\n };\n\n if (!checkIfURLSearchParamsSupported()) {\n polyfillURLSearchParams();\n }\n\n var proto = global.URLSearchParams.prototype;\n\n if (typeof proto.sort !== 'function') {\n proto.sort = function () {\n var _this = this;\n\n var items = [];\n this.forEach(function (value, name) {\n items.push([name, value]);\n\n if (!_this._entries) {\n _this.delete(name);\n }\n });\n items.sort(function (a, b) {\n if (a[0] < b[0]) {\n return -1;\n } else if (a[0] > b[0]) {\n return +1;\n } else {\n return 0;\n }\n });\n\n if (_this._entries) {\n // force reset because IE keeps keys index\n _this._entries = {};\n }\n\n for (var i = 0; i < items.length; i++) {\n this.append(items[i][0], items[i][1]);\n }\n };\n }\n\n if (typeof proto._fromString !== 'function') {\n Object.defineProperty(proto, '_fromString', {\n enumerable: false,\n configurable: false,\n writable: false,\n value: function value(searchString) {\n if (this._entries) {\n this._entries = {};\n } else {\n var keys = [];\n this.forEach(function (value, name) {\n keys.push(name);\n });\n\n for (var i = 0; i < keys.length; i++) {\n this.delete(keys[i]);\n }\n }\n\n searchString = searchString.replace(/^\\?/, '');\n var attributes = searchString.split('&');\n var attribute;\n\n for (var i = 0; i < attributes.length; i++) {\n attribute = attributes[i].split('=');\n this.append(deserializeParam(attribute[0]), attribute.length > 1 ? deserializeParam(attribute[1]) : '');\n }\n }\n });\n } // HTMLAnchorElement\n\n })(typeof commonjsGlobal !== 'undefined' ? commonjsGlobal : typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : commonjsGlobal);\n\n (function (global) {\n /**\r\n * Polyfill URL\r\n *\r\n * Inspired from : https://github.com/arv/DOM-URL-Polyfill/blob/master/src/url.js\r\n */\n var checkIfURLIsSupported = function checkIfURLIsSupported() {\n try {\n var u = new global.URL('b', 'http://a');\n u.pathname = 'c d';\n return u.href === 'http://a/c%20d' && u.searchParams;\n } catch (e) {\n return false;\n }\n };\n\n var polyfillURL = function polyfillURL() {\n var _URL = global.URL;\n\n var URL = function URL(url, base) {\n if (typeof url !== 'string') url = String(url); // Only create another document if the base is different from current location.\n\n var doc = document,\n baseElement;\n\n if (base && (global.location === void 0 || base !== global.location.href)) {\n doc = document.implementation.createHTMLDocument('');\n baseElement = doc.createElement('base');\n baseElement.href = base;\n doc.head.appendChild(baseElement);\n\n try {\n if (baseElement.href.indexOf(base) !== 0) throw new Error(baseElement.href);\n } catch (err) {\n throw new Error('URL unable to set base ' + base + ' due to ' + err);\n }\n }\n\n var anchorElement = doc.createElement('a');\n anchorElement.href = url;\n\n if (baseElement) {\n doc.body.appendChild(anchorElement);\n anchorElement.href = anchorElement.href; // force href to refresh\n }\n\n var inputElement = doc.createElement('input');\n inputElement.type = 'url';\n inputElement.value = url;\n\n if (anchorElement.protocol === ':' || !/:/.test(anchorElement.href) || !inputElement.checkValidity() && !base) {\n throw new TypeError('Invalid URL');\n }\n\n Object.defineProperty(this, '_anchorElement', {\n value: anchorElement\n }); // create a linked searchParams which reflect its changes on URL\n\n var searchParams = new global.URLSearchParams(this.search);\n var enableSearchUpdate = true;\n var enableSearchParamsUpdate = true;\n\n var _this = this;\n\n ['append', 'delete', 'set'].forEach(function (methodName) {\n var method = searchParams[methodName];\n\n searchParams[methodName] = function () {\n method.apply(searchParams, arguments);\n\n if (enableSearchUpdate) {\n enableSearchParamsUpdate = false;\n _this.search = searchParams.toString();\n enableSearchParamsUpdate = true;\n }\n };\n });\n Object.defineProperty(this, 'searchParams', {\n value: searchParams,\n enumerable: true\n });\n var search = void 0;\n Object.defineProperty(this, '_updateSearchParams', {\n enumerable: false,\n configurable: false,\n writable: false,\n value: function value() {\n if (this.search !== search) {\n search = this.search;\n\n if (enableSearchParamsUpdate) {\n enableSearchUpdate = false;\n\n this.searchParams._fromString(this.search);\n\n enableSearchUpdate = true;\n }\n }\n }\n });\n };\n\n var proto = URL.prototype;\n\n var linkURLWithAnchorAttribute = function linkURLWithAnchorAttribute(attributeName) {\n Object.defineProperty(proto, attributeName, {\n get: function get() {\n return this._anchorElement[attributeName];\n },\n set: function set(value) {\n this._anchorElement[attributeName] = value;\n },\n enumerable: true\n });\n };\n\n ['hash', 'host', 'hostname', 'port', 'protocol'].forEach(function (attributeName) {\n linkURLWithAnchorAttribute(attributeName);\n });\n Object.defineProperty(proto, 'search', {\n get: function get() {\n return this._anchorElement['search'];\n },\n set: function set(value) {\n this._anchorElement['search'] = value;\n\n this._updateSearchParams();\n },\n enumerable: true\n });\n Object.defineProperties(proto, {\n 'toString': {\n get: function get() {\n var _this = this;\n\n return function () {\n return _this.href;\n };\n }\n },\n 'href': {\n get: function get() {\n return this._anchorElement.href.replace(/\\?$/, '');\n },\n set: function set(value) {\n this._anchorElement.href = value;\n\n this._updateSearchParams();\n },\n enumerable: true\n },\n 'pathname': {\n get: function get() {\n return this._anchorElement.pathname.replace(/(^\\/?)/, '/');\n },\n set: function set(value) {\n this._anchorElement.pathname = value;\n },\n enumerable: true\n },\n 'origin': {\n get: function get() {\n // get expected port from protocol\n var expectedPort = {\n 'http:': 80,\n 'https:': 443,\n 'ftp:': 21\n }[this._anchorElement.protocol]; // add port to origin if, expected port is different than actual port\n // and it is not empty f.e http://foo:8080\n // 8080 != 80 && 8080 != ''\n\n var addPortToOrigin = this._anchorElement.port != expectedPort && this._anchorElement.port !== '';\n return this._anchorElement.protocol + '//' + this._anchorElement.hostname + (addPortToOrigin ? ':' + this._anchorElement.port : '');\n },\n enumerable: true\n },\n 'password': {\n // TODO\n get: function get() {\n return '';\n },\n set: function set(value) {},\n enumerable: true\n },\n 'username': {\n // TODO\n get: function get() {\n return '';\n },\n set: function set(value) {},\n enumerable: true\n }\n });\n\n URL.createObjectURL = function (blob) {\n return _URL.createObjectURL.apply(_URL, arguments);\n };\n\n URL.revokeObjectURL = function (url) {\n return _URL.revokeObjectURL.apply(_URL, arguments);\n };\n\n global.URL = URL;\n };\n\n if (!checkIfURLIsSupported()) {\n polyfillURL();\n }\n\n if (global.location !== void 0 && !('origin' in global.location)) {\n var getOrigin = function getOrigin() {\n return global.location.protocol + '//' + global.location.hostname + (global.location.port ? ':' + global.location.port : '');\n };\n\n try {\n Object.defineProperty(global.location, 'origin', {\n get: getOrigin,\n enumerable: true\n });\n } catch (e) {\n setInterval(function () {\n global.location.origin = getOrigin();\n }, 100);\n }\n }\n })(typeof commonjsGlobal !== 'undefined' ? commonjsGlobal : typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : commonjsGlobal);\n\n var IS_CONCAT_SPREADABLE = wellKnownSymbol('isConcatSpreadable');\n var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF;\n var MAXIMUM_ALLOWED_INDEX_EXCEEDED = 'Maximum allowed index exceeded';\n\n // We can't use this feature detection in V8 since it causes\n // deoptimization and serious performance degradation\n // https://github.com/zloirock/core-js/issues/679\n var IS_CONCAT_SPREADABLE_SUPPORT = engineV8Version >= 51 || !fails(function () {\n var array = [];\n array[IS_CONCAT_SPREADABLE] = false;\n return array.concat()[0] !== array;\n });\n\n var SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('concat');\n\n var isConcatSpreadable = function (O) {\n if (!isObject(O)) return false;\n var spreadable = O[IS_CONCAT_SPREADABLE];\n return spreadable !== undefined ? !!spreadable : isArray(O);\n };\n\n var FORCED = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT;\n\n // `Array.prototype.concat` method\n // https://tc39.github.io/ecma262/#sec-array.prototype.concat\n // with adding support of @@isConcatSpreadable and @@species\n _export({ target: 'Array', proto: true, forced: FORCED }, {\n concat: function concat(arg) { // eslint-disable-line no-unused-vars\n var O = toObject(this);\n var A = arraySpeciesCreate(O, 0);\n var n = 0;\n var i, k, length, len, E;\n for (i = -1, length = arguments.length; i < length; i++) {\n E = i === -1 ? O : arguments[i];\n if (isConcatSpreadable(E)) {\n len = toLength(E.length);\n if (n + len > MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);\n for (k = 0; k < len; k++, n++) if (k in E) createProperty(A, n, E[k]);\n } else {\n if (n >= MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);\n createProperty(A, n++, E);\n }\n }\n A.length = n;\n return A;\n }\n });\n\n var $filter = arrayIteration.filter;\n\n\n\n var HAS_SPECIES_SUPPORT$1 = arrayMethodHasSpeciesSupport('filter');\n // Edge 14- issue\n var USES_TO_LENGTH$3 = arrayMethodUsesToLength('filter');\n\n // `Array.prototype.filter` method\n // https://tc39.github.io/ecma262/#sec-array.prototype.filter\n // with adding support of @@species\n _export({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT$1 || !USES_TO_LENGTH$3 }, {\n filter: function filter(callbackfn /* , thisArg */) {\n return $filter(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);\n }\n });\n\n var $find = arrayIteration.find;\n\n\n\n var FIND = 'find';\n var SKIPS_HOLES = true;\n\n var USES_TO_LENGTH$4 = arrayMethodUsesToLength(FIND);\n\n // Shouldn't skip holes\n if (FIND in []) Array(1)[FIND](function () { SKIPS_HOLES = false; });\n\n // `Array.prototype.find` method\n // https://tc39.github.io/ecma262/#sec-array.prototype.find\n _export({ target: 'Array', proto: true, forced: SKIPS_HOLES || !USES_TO_LENGTH$4 }, {\n find: function find(callbackfn /* , that = undefined */) {\n return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);\n }\n });\n\n // https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables\n addToUnscopables(FIND);\n\n var ITERATOR$7 = wellKnownSymbol('iterator');\n var SAFE_CLOSING = false;\n\n try {\n var called = 0;\n var iteratorWithReturn = {\n next: function () {\n return { done: !!called++ };\n },\n 'return': function () {\n SAFE_CLOSING = true;\n }\n };\n iteratorWithReturn[ITERATOR$7] = function () {\n return this;\n };\n // eslint-disable-next-line no-throw-literal\n Array.from(iteratorWithReturn, function () { throw 2; });\n } catch (error) { /* empty */ }\n\n var checkCorrectnessOfIteration = function (exec, SKIP_CLOSING) {\n if (!SKIP_CLOSING && !SAFE_CLOSING) return false;\n var ITERATION_SUPPORT = false;\n try {\n var object = {};\n object[ITERATOR$7] = function () {\n return {\n next: function () {\n return { done: ITERATION_SUPPORT = true };\n }\n };\n };\n exec(object);\n } catch (error) { /* empty */ }\n return ITERATION_SUPPORT;\n };\n\n var INCORRECT_ITERATION = !checkCorrectnessOfIteration(function (iterable) {\n Array.from(iterable);\n });\n\n // `Array.from` method\n // https://tc39.github.io/ecma262/#sec-array.from\n _export({ target: 'Array', stat: true, forced: INCORRECT_ITERATION }, {\n from: arrayFrom\n });\n\n var $includes = arrayIncludes.includes;\n\n\n\n var USES_TO_LENGTH$5 = arrayMethodUsesToLength('indexOf', { ACCESSORS: true, 1: 0 });\n\n // `Array.prototype.includes` method\n // https://tc39.github.io/ecma262/#sec-array.prototype.includes\n _export({ target: 'Array', proto: true, forced: !USES_TO_LENGTH$5 }, {\n includes: function includes(el /* , fromIndex = 0 */) {\n return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);\n }\n });\n\n // https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables\n addToUnscopables('includes');\n\n var $map = arrayIteration.map;\n\n\n\n var HAS_SPECIES_SUPPORT$2 = arrayMethodHasSpeciesSupport('map');\n // FF49- issue\n var USES_TO_LENGTH$6 = arrayMethodUsesToLength('map');\n\n // `Array.prototype.map` method\n // https://tc39.github.io/ecma262/#sec-array.prototype.map\n // with adding support of @@species\n _export({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT$2 || !USES_TO_LENGTH$6 }, {\n map: function map(callbackfn /* , thisArg */) {\n return $map(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);\n }\n });\n\n // makes subclassing work correct for wrapped built-ins\n var inheritIfRequired = function ($this, dummy, Wrapper) {\n var NewTarget, NewTargetPrototype;\n if (\n // it can work only with native `setPrototypeOf`\n objectSetPrototypeOf &&\n // we haven't completely correct pre-ES6 way for getting `new.target`, so use this\n typeof (NewTarget = dummy.constructor) == 'function' &&\n NewTarget !== Wrapper &&\n isObject(NewTargetPrototype = NewTarget.prototype) &&\n NewTargetPrototype !== Wrapper.prototype\n ) objectSetPrototypeOf($this, NewTargetPrototype);\n return $this;\n };\n\n // a string of all valid unicode whitespaces\n // eslint-disable-next-line max-len\n var whitespaces = '\\u0009\\u000A\\u000B\\u000C\\u000D\\u0020\\u00A0\\u1680\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u202F\\u205F\\u3000\\u2028\\u2029\\uFEFF';\n\n var whitespace = '[' + whitespaces + ']';\n var ltrim = RegExp('^' + whitespace + whitespace + '*');\n var rtrim = RegExp(whitespace + whitespace + '*$');\n\n // `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation\n var createMethod$3 = function (TYPE) {\n return function ($this) {\n var string = String(requireObjectCoercible($this));\n if (TYPE & 1) string = string.replace(ltrim, '');\n if (TYPE & 2) string = string.replace(rtrim, '');\n return string;\n };\n };\n\n var stringTrim = {\n // `String.prototype.{ trimLeft, trimStart }` methods\n // https://tc39.github.io/ecma262/#sec-string.prototype.trimstart\n start: createMethod$3(1),\n // `String.prototype.{ trimRight, trimEnd }` methods\n // https://tc39.github.io/ecma262/#sec-string.prototype.trimend\n end: createMethod$3(2),\n // `String.prototype.trim` method\n // https://tc39.github.io/ecma262/#sec-string.prototype.trim\n trim: createMethod$3(3)\n };\n\n var getOwnPropertyNames = objectGetOwnPropertyNames.f;\n var getOwnPropertyDescriptor$2 = objectGetOwnPropertyDescriptor.f;\n var defineProperty$5 = objectDefineProperty.f;\n var trim = stringTrim.trim;\n\n var NUMBER = 'Number';\n var NativeNumber = global_1[NUMBER];\n var NumberPrototype = NativeNumber.prototype;\n\n // Opera ~12 has broken Object#toString\n var BROKEN_CLASSOF = classofRaw(objectCreate(NumberPrototype)) == NUMBER;\n\n // `ToNumber` abstract operation\n // https://tc39.github.io/ecma262/#sec-tonumber\n var toNumber = function (argument) {\n var it = toPrimitive(argument, false);\n var first, third, radix, maxCode, digits, length, index, code;\n if (typeof it == 'string' && it.length > 2) {\n it = trim(it);\n first = it.charCodeAt(0);\n if (first === 43 || first === 45) {\n third = it.charCodeAt(2);\n if (third === 88 || third === 120) return NaN; // Number('+0x1') should be NaN, old V8 fix\n } else if (first === 48) {\n switch (it.charCodeAt(1)) {\n case 66: case 98: radix = 2; maxCode = 49; break; // fast equal of /^0b[01]+$/i\n case 79: case 111: radix = 8; maxCode = 55; break; // fast equal of /^0o[0-7]+$/i\n default: return +it;\n }\n digits = it.slice(2);\n length = digits.length;\n for (index = 0; index < length; index++) {\n code = digits.charCodeAt(index);\n // parseInt parses a string to a first unavailable symbol\n // but ToNumber should return NaN if a string contains unavailable symbols\n if (code < 48 || code > maxCode) return NaN;\n } return parseInt(digits, radix);\n }\n } return +it;\n };\n\n // `Number` constructor\n // https://tc39.github.io/ecma262/#sec-number-constructor\n if (isForced_1(NUMBER, !NativeNumber(' 0o1') || !NativeNumber('0b1') || NativeNumber('+0x1'))) {\n var NumberWrapper = function Number(value) {\n var it = arguments.length < 1 ? 0 : value;\n var dummy = this;\n return dummy instanceof NumberWrapper\n // check on 1..constructor(foo) case\n && (BROKEN_CLASSOF ? fails(function () { NumberPrototype.valueOf.call(dummy); }) : classofRaw(dummy) != NUMBER)\n ? inheritIfRequired(new NativeNumber(toNumber(it)), dummy, NumberWrapper) : toNumber(it);\n };\n for (var keys$1 = descriptors ? getOwnPropertyNames(NativeNumber) : (\n // ES3:\n 'MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,' +\n // ES2015 (in case, if modules with ES2015 Number statics required before):\n 'EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,' +\n 'MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger'\n ).split(','), j = 0, key; keys$1.length > j; j++) {\n if (has(NativeNumber, key = keys$1[j]) && !has(NumberWrapper, key)) {\n defineProperty$5(NumberWrapper, key, getOwnPropertyDescriptor$2(NativeNumber, key));\n }\n }\n NumberWrapper.prototype = NumberPrototype;\n NumberPrototype.constructor = NumberWrapper;\n redefine(global_1, NUMBER, NumberWrapper);\n }\n\n var FAILS_ON_PRIMITIVES = fails(function () { objectKeys(1); });\n\n // `Object.keys` method\n // https://tc39.github.io/ecma262/#sec-object.keys\n _export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, {\n keys: function keys(it) {\n return objectKeys(toObject(it));\n }\n });\n\n var notARegexp = function (it) {\n if (isRegexp(it)) {\n throw TypeError(\"The method doesn't accept regular expressions\");\n } return it;\n };\n\n var MATCH$1 = wellKnownSymbol('match');\n\n var correctIsRegexpLogic = function (METHOD_NAME) {\n var regexp = /./;\n try {\n '/./'[METHOD_NAME](regexp);\n } catch (e) {\n try {\n regexp[MATCH$1] = false;\n return '/./'[METHOD_NAME](regexp);\n } catch (f) { /* empty */ }\n } return false;\n };\n\n // `String.prototype.includes` method\n // https://tc39.github.io/ecma262/#sec-string.prototype.includes\n _export({ target: 'String', proto: true, forced: !correctIsRegexpLogic('includes') }, {\n includes: function includes(searchString /* , position = 0 */) {\n return !!~String(requireObjectCoercible(this))\n .indexOf(notARegexp(searchString), arguments.length > 1 ? arguments[1] : undefined);\n }\n });\n\n var freezing = !fails(function () {\n return Object.isExtensible(Object.preventExtensions({}));\n });\n\n var internalMetadata = createCommonjsModule(function (module) {\n var defineProperty = objectDefineProperty.f;\n\n\n\n var METADATA = uid('meta');\n var id = 0;\n\n var isExtensible = Object.isExtensible || function () {\n return true;\n };\n\n var setMetadata = function (it) {\n defineProperty(it, METADATA, { value: {\n objectID: 'O' + ++id, // object ID\n weakData: {} // weak collections IDs\n } });\n };\n\n var fastKey = function (it, create) {\n // return a primitive with prefix\n if (!isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;\n if (!has(it, METADATA)) {\n // can't set metadata to uncaught frozen object\n if (!isExtensible(it)) return 'F';\n // not necessary to add metadata\n if (!create) return 'E';\n // add missing metadata\n setMetadata(it);\n // return object ID\n } return it[METADATA].objectID;\n };\n\n var getWeakData = function (it, create) {\n if (!has(it, METADATA)) {\n // can't set metadata to uncaught frozen object\n if (!isExtensible(it)) return true;\n // not necessary to add metadata\n if (!create) return false;\n // add missing metadata\n setMetadata(it);\n // return the store of weak collections IDs\n } return it[METADATA].weakData;\n };\n\n // add metadata on freeze-family methods calling\n var onFreeze = function (it) {\n if (freezing && meta.REQUIRED && isExtensible(it) && !has(it, METADATA)) setMetadata(it);\n return it;\n };\n\n var meta = module.exports = {\n REQUIRED: false,\n fastKey: fastKey,\n getWeakData: getWeakData,\n onFreeze: onFreeze\n };\n\n hiddenKeys[METADATA] = true;\n });\n var internalMetadata_1 = internalMetadata.REQUIRED;\n var internalMetadata_2 = internalMetadata.fastKey;\n var internalMetadata_3 = internalMetadata.getWeakData;\n var internalMetadata_4 = internalMetadata.onFreeze;\n\n var iterate_1 = createCommonjsModule(function (module) {\n var Result = function (stopped, result) {\n this.stopped = stopped;\n this.result = result;\n };\n\n var iterate = module.exports = function (iterable, fn, that, AS_ENTRIES, IS_ITERATOR) {\n var boundFunction = functionBindContext(fn, that, AS_ENTRIES ? 2 : 1);\n var iterator, iterFn, index, length, result, next, step;\n\n if (IS_ITERATOR) {\n iterator = iterable;\n } else {\n iterFn = getIteratorMethod(iterable);\n if (typeof iterFn != 'function') throw TypeError('Target is not iterable');\n // optimisation for array iterators\n if (isArrayIteratorMethod(iterFn)) {\n for (index = 0, length = toLength(iterable.length); length > index; index++) {\n result = AS_ENTRIES\n ? boundFunction(anObject(step = iterable[index])[0], step[1])\n : boundFunction(iterable[index]);\n if (result && result instanceof Result) return result;\n } return new Result(false);\n }\n iterator = iterFn.call(iterable);\n }\n\n next = iterator.next;\n while (!(step = next.call(iterator)).done) {\n result = callWithSafeIterationClosing(iterator, boundFunction, step.value, AS_ENTRIES);\n if (typeof result == 'object' && result && result instanceof Result) return result;\n } return new Result(false);\n };\n\n iterate.stop = function (result) {\n return new Result(true, result);\n };\n });\n\n var collection = function (CONSTRUCTOR_NAME, wrapper, common) {\n var IS_MAP = CONSTRUCTOR_NAME.indexOf('Map') !== -1;\n var IS_WEAK = CONSTRUCTOR_NAME.indexOf('Weak') !== -1;\n var ADDER = IS_MAP ? 'set' : 'add';\n var NativeConstructor = global_1[CONSTRUCTOR_NAME];\n var NativePrototype = NativeConstructor && NativeConstructor.prototype;\n var Constructor = NativeConstructor;\n var exported = {};\n\n var fixMethod = function (KEY) {\n var nativeMethod = NativePrototype[KEY];\n redefine(NativePrototype, KEY,\n KEY == 'add' ? function add(value) {\n nativeMethod.call(this, value === 0 ? 0 : value);\n return this;\n } : KEY == 'delete' ? function (key) {\n return IS_WEAK && !isObject(key) ? false : nativeMethod.call(this, key === 0 ? 0 : key);\n } : KEY == 'get' ? function get(key) {\n return IS_WEAK && !isObject(key) ? undefined : nativeMethod.call(this, key === 0 ? 0 : key);\n } : KEY == 'has' ? function has(key) {\n return IS_WEAK && !isObject(key) ? false : nativeMethod.call(this, key === 0 ? 0 : key);\n } : function set(key, value) {\n nativeMethod.call(this, key === 0 ? 0 : key, value);\n return this;\n }\n );\n };\n\n // eslint-disable-next-line max-len\n if (isForced_1(CONSTRUCTOR_NAME, typeof NativeConstructor != 'function' || !(IS_WEAK || NativePrototype.forEach && !fails(function () {\n new NativeConstructor().entries().next();\n })))) {\n // create collection constructor\n Constructor = common.getConstructor(wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER);\n internalMetadata.REQUIRED = true;\n } else if (isForced_1(CONSTRUCTOR_NAME, true)) {\n var instance = new Constructor();\n // early implementations not supports chaining\n var HASNT_CHAINING = instance[ADDER](IS_WEAK ? {} : -0, 1) != instance;\n // V8 ~ Chromium 40- weak-collections throws on primitives, but should return false\n var THROWS_ON_PRIMITIVES = fails(function () { instance.has(1); });\n // most early implementations doesn't supports iterables, most modern - not close it correctly\n // eslint-disable-next-line no-new\n var ACCEPT_ITERABLES = checkCorrectnessOfIteration(function (iterable) { new NativeConstructor(iterable); });\n // for early implementations -0 and +0 not the same\n var BUGGY_ZERO = !IS_WEAK && fails(function () {\n // V8 ~ Chromium 42- fails only with 5+ elements\n var $instance = new NativeConstructor();\n var index = 5;\n while (index--) $instance[ADDER](index, index);\n return !$instance.has(-0);\n });\n\n if (!ACCEPT_ITERABLES) {\n Constructor = wrapper(function (dummy, iterable) {\n anInstance(dummy, Constructor, CONSTRUCTOR_NAME);\n var that = inheritIfRequired(new NativeConstructor(), dummy, Constructor);\n if (iterable != undefined) iterate_1(iterable, that[ADDER], that, IS_MAP);\n return that;\n });\n Constructor.prototype = NativePrototype;\n NativePrototype.constructor = Constructor;\n }\n\n if (THROWS_ON_PRIMITIVES || BUGGY_ZERO) {\n fixMethod('delete');\n fixMethod('has');\n IS_MAP && fixMethod('get');\n }\n\n if (BUGGY_ZERO || HASNT_CHAINING) fixMethod(ADDER);\n\n // weak collections should not contains .clear method\n if (IS_WEAK && NativePrototype.clear) delete NativePrototype.clear;\n }\n\n exported[CONSTRUCTOR_NAME] = Constructor;\n _export({ global: true, forced: Constructor != NativeConstructor }, exported);\n\n setToStringTag(Constructor, CONSTRUCTOR_NAME);\n\n if (!IS_WEAK) common.setStrong(Constructor, CONSTRUCTOR_NAME, IS_MAP);\n\n return Constructor;\n };\n\n var getWeakData = internalMetadata.getWeakData;\n\n\n\n\n\n\n\n\n var setInternalState$5 = internalState.set;\n var internalStateGetterFor = internalState.getterFor;\n var find$1 = arrayIteration.find;\n var findIndex = arrayIteration.findIndex;\n var id$1 = 0;\n\n // fallback for uncaught frozen keys\n var uncaughtFrozenStore = function (store) {\n return store.frozen || (store.frozen = new UncaughtFrozenStore());\n };\n\n var UncaughtFrozenStore = function () {\n this.entries = [];\n };\n\n var findUncaughtFrozen = function (store, key) {\n return find$1(store.entries, function (it) {\n return it[0] === key;\n });\n };\n\n UncaughtFrozenStore.prototype = {\n get: function (key) {\n var entry = findUncaughtFrozen(this, key);\n if (entry) return entry[1];\n },\n has: function (key) {\n return !!findUncaughtFrozen(this, key);\n },\n set: function (key, value) {\n var entry = findUncaughtFrozen(this, key);\n if (entry) entry[1] = value;\n else this.entries.push([key, value]);\n },\n 'delete': function (key) {\n var index = findIndex(this.entries, function (it) {\n return it[0] === key;\n });\n if (~index) this.entries.splice(index, 1);\n return !!~index;\n }\n };\n\n var collectionWeak = {\n getConstructor: function (wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER) {\n var C = wrapper(function (that, iterable) {\n anInstance(that, C, CONSTRUCTOR_NAME);\n setInternalState$5(that, {\n type: CONSTRUCTOR_NAME,\n id: id$1++,\n frozen: undefined\n });\n if (iterable != undefined) iterate_1(iterable, that[ADDER], that, IS_MAP);\n });\n\n var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME);\n\n var define = function (that, key, value) {\n var state = getInternalState(that);\n var data = getWeakData(anObject(key), true);\n if (data === true) uncaughtFrozenStore(state).set(key, value);\n else data[state.id] = value;\n return that;\n };\n\n redefineAll(C.prototype, {\n // 23.3.3.2 WeakMap.prototype.delete(key)\n // 23.4.3.3 WeakSet.prototype.delete(value)\n 'delete': function (key) {\n var state = getInternalState(this);\n if (!isObject(key)) return false;\n var data = getWeakData(key);\n if (data === true) return uncaughtFrozenStore(state)['delete'](key);\n return data && has(data, state.id) && delete data[state.id];\n },\n // 23.3.3.4 WeakMap.prototype.has(key)\n // 23.4.3.4 WeakSet.prototype.has(value)\n has: function has$1(key) {\n var state = getInternalState(this);\n if (!isObject(key)) return false;\n var data = getWeakData(key);\n if (data === true) return uncaughtFrozenStore(state).has(key);\n return data && has(data, state.id);\n }\n });\n\n redefineAll(C.prototype, IS_MAP ? {\n // 23.3.3.3 WeakMap.prototype.get(key)\n get: function get(key) {\n var state = getInternalState(this);\n if (isObject(key)) {\n var data = getWeakData(key);\n if (data === true) return uncaughtFrozenStore(state).get(key);\n return data ? data[state.id] : undefined;\n }\n },\n // 23.3.3.5 WeakMap.prototype.set(key, value)\n set: function set(key, value) {\n return define(this, key, value);\n }\n } : {\n // 23.4.3.1 WeakSet.prototype.add(value)\n add: function add(value) {\n return define(this, value, true);\n }\n });\n\n return C;\n }\n };\n\n var es_weakMap = createCommonjsModule(function (module) {\n\n\n\n\n\n\n var enforceIternalState = internalState.enforce;\n\n\n var IS_IE11 = !global_1.ActiveXObject && 'ActiveXObject' in global_1;\n var isExtensible = Object.isExtensible;\n var InternalWeakMap;\n\n var wrapper = function (init) {\n return function WeakMap() {\n return init(this, arguments.length ? arguments[0] : undefined);\n };\n };\n\n // `WeakMap` constructor\n // https://tc39.github.io/ecma262/#sec-weakmap-constructor\n var $WeakMap = module.exports = collection('WeakMap', wrapper, collectionWeak);\n\n // IE11 WeakMap frozen keys fix\n // We can't use feature detection because it crash some old IE builds\n // https://github.com/zloirock/core-js/issues/485\n if (nativeWeakMap && IS_IE11) {\n InternalWeakMap = collectionWeak.getConstructor(wrapper, 'WeakMap', true);\n internalMetadata.REQUIRED = true;\n var WeakMapPrototype = $WeakMap.prototype;\n var nativeDelete = WeakMapPrototype['delete'];\n var nativeHas = WeakMapPrototype.has;\n var nativeGet = WeakMapPrototype.get;\n var nativeSet = WeakMapPrototype.set;\n redefineAll(WeakMapPrototype, {\n 'delete': function (key) {\n if (isObject(key) && !isExtensible(key)) {\n var state = enforceIternalState(this);\n if (!state.frozen) state.frozen = new InternalWeakMap();\n return nativeDelete.call(this, key) || state.frozen['delete'](key);\n } return nativeDelete.call(this, key);\n },\n has: function has(key) {\n if (isObject(key) && !isExtensible(key)) {\n var state = enforceIternalState(this);\n if (!state.frozen) state.frozen = new InternalWeakMap();\n return nativeHas.call(this, key) || state.frozen.has(key);\n } return nativeHas.call(this, key);\n },\n get: function get(key) {\n if (isObject(key) && !isExtensible(key)) {\n var state = enforceIternalState(this);\n if (!state.frozen) state.frozen = new InternalWeakMap();\n return nativeHas.call(this, key) ? nativeGet.call(this, key) : state.frozen.get(key);\n } return nativeGet.call(this, key);\n },\n set: function set(key, value) {\n if (isObject(key) && !isExtensible(key)) {\n var state = enforceIternalState(this);\n if (!state.frozen) state.frozen = new InternalWeakMap();\n nativeHas.call(this, key) ? nativeSet.call(this, key, value) : state.frozen.set(key, value);\n } else nativeSet.call(this, key, value);\n return this;\n }\n });\n }\n });\n\n var $every = arrayIteration.every;\n\n\n\n var STRICT_METHOD$3 = arrayMethodIsStrict('every');\n var USES_TO_LENGTH$7 = arrayMethodUsesToLength('every');\n\n // `Array.prototype.every` method\n // https://tc39.github.io/ecma262/#sec-array.prototype.every\n _export({ target: 'Array', proto: true, forced: !STRICT_METHOD$3 || !USES_TO_LENGTH$7 }, {\n every: function every(callbackfn /* , thisArg */) {\n return $every(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);\n }\n });\n\n // `Object.assign` method\n // https://tc39.github.io/ecma262/#sec-object.assign\n _export({ target: 'Object', stat: true, forced: Object.assign !== objectAssign }, {\n assign: objectAssign\n });\n\n var non = '\\u200B\\u0085\\u180E';\n\n // check that a method works with the correct list\n // of whitespaces and has a correct name\n var stringTrimForced = function (METHOD_NAME) {\n return fails(function () {\n return !!whitespaces[METHOD_NAME]() || non[METHOD_NAME]() != non || whitespaces[METHOD_NAME].name !== METHOD_NAME;\n });\n };\n\n var $trim = stringTrim.trim;\n\n\n // `String.prototype.trim` method\n // https://tc39.github.io/ecma262/#sec-string.prototype.trim\n _export({ target: 'String', proto: true, forced: stringTrimForced('trim') }, {\n trim: function trim() {\n return $trim(this);\n }\n });\n\n var $some = arrayIteration.some;\n\n\n\n var STRICT_METHOD$4 = arrayMethodIsStrict('some');\n var USES_TO_LENGTH$8 = arrayMethodUsesToLength('some');\n\n // `Array.prototype.some` method\n // https://tc39.github.io/ecma262/#sec-array.prototype.some\n _export({ target: 'Array', proto: true, forced: !STRICT_METHOD$4 || !USES_TO_LENGTH$8 }, {\n some: function some(callbackfn /* , thisArg */) {\n return $some(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);\n }\n });\n\n // `thisNumberValue` abstract operation\n // https://tc39.github.io/ecma262/#sec-thisnumbervalue\n var thisNumberValue = function (value) {\n if (typeof value != 'number' && classofRaw(value) != 'Number') {\n throw TypeError('Incorrect invocation');\n }\n return +value;\n };\n\n // `String.prototype.repeat` method implementation\n // https://tc39.github.io/ecma262/#sec-string.prototype.repeat\n var stringRepeat = ''.repeat || function repeat(count) {\n var str = String(requireObjectCoercible(this));\n var result = '';\n var n = toInteger(count);\n if (n < 0 || n == Infinity) throw RangeError('Wrong number of repetitions');\n for (;n > 0; (n >>>= 1) && (str += str)) if (n & 1) result += str;\n return result;\n };\n\n var nativeToFixed = 1.0.toFixed;\n var floor$4 = Math.floor;\n\n var pow$1 = function (x, n, acc) {\n return n === 0 ? acc : n % 2 === 1 ? pow$1(x, n - 1, acc * x) : pow$1(x * x, n / 2, acc);\n };\n\n var log = function (x) {\n var n = 0;\n var x2 = x;\n while (x2 >= 4096) {\n n += 12;\n x2 /= 4096;\n }\n while (x2 >= 2) {\n n += 1;\n x2 /= 2;\n } return n;\n };\n\n var FORCED$1 = nativeToFixed && (\n 0.00008.toFixed(3) !== '0.000' ||\n 0.9.toFixed(0) !== '1' ||\n 1.255.toFixed(2) !== '1.25' ||\n 1000000000000000128.0.toFixed(0) !== '1000000000000000128'\n ) || !fails(function () {\n // V8 ~ Android 4.3-\n nativeToFixed.call({});\n });\n\n // `Number.prototype.toFixed` method\n // https://tc39.github.io/ecma262/#sec-number.prototype.tofixed\n _export({ target: 'Number', proto: true, forced: FORCED$1 }, {\n // eslint-disable-next-line max-statements\n toFixed: function toFixed(fractionDigits) {\n var number = thisNumberValue(this);\n var fractDigits = toInteger(fractionDigits);\n var data = [0, 0, 0, 0, 0, 0];\n var sign = '';\n var result = '0';\n var e, z, j, k;\n\n var multiply = function (n, c) {\n var index = -1;\n var c2 = c;\n while (++index < 6) {\n c2 += n * data[index];\n data[index] = c2 % 1e7;\n c2 = floor$4(c2 / 1e7);\n }\n };\n\n var divide = function (n) {\n var index = 6;\n var c = 0;\n while (--index >= 0) {\n c += data[index];\n data[index] = floor$4(c / n);\n c = (c % n) * 1e7;\n }\n };\n\n var dataToString = function () {\n var index = 6;\n var s = '';\n while (--index >= 0) {\n if (s !== '' || index === 0 || data[index] !== 0) {\n var t = String(data[index]);\n s = s === '' ? t : s + stringRepeat.call('0', 7 - t.length) + t;\n }\n } return s;\n };\n\n if (fractDigits < 0 || fractDigits > 20) throw RangeError('Incorrect fraction digits');\n // eslint-disable-next-line no-self-compare\n if (number != number) return 'NaN';\n if (number <= -1e21 || number >= 1e21) return String(number);\n if (number < 0) {\n sign = '-';\n number = -number;\n }\n if (number > 1e-21) {\n e = log(number * pow$1(2, 69, 1)) - 69;\n z = e < 0 ? number * pow$1(2, -e, 1) : number / pow$1(2, e, 1);\n z *= 0x10000000000000;\n e = 52 - e;\n if (e > 0) {\n multiply(0, z);\n j = fractDigits;\n while (j >= 7) {\n multiply(1e7, 0);\n j -= 7;\n }\n multiply(pow$1(10, j, 1), 0);\n j = e - 1;\n while (j >= 23) {\n divide(1 << 23);\n j -= 23;\n }\n divide(1 << j);\n multiply(1, 1);\n divide(2);\n result = dataToString();\n } else {\n multiply(0, z);\n multiply(1 << -e, 0);\n result = dataToString() + stringRepeat.call('0', fractDigits);\n }\n }\n if (fractDigits > 0) {\n k = result.length;\n result = sign + (k <= fractDigits\n ? '0.' + stringRepeat.call('0', fractDigits - k) + result\n : result.slice(0, k - fractDigits) + '.' + result.slice(k - fractDigits));\n } else {\n result = sign + result;\n } return result;\n }\n });\n\n var propertyIsEnumerable = objectPropertyIsEnumerable.f;\n\n // `Object.{ entries, values }` methods implementation\n var createMethod$4 = function (TO_ENTRIES) {\n return function (it) {\n var O = toIndexedObject(it);\n var keys = objectKeys(O);\n var length = keys.length;\n var i = 0;\n var result = [];\n var key;\n while (length > i) {\n key = keys[i++];\n if (!descriptors || propertyIsEnumerable.call(O, key)) {\n result.push(TO_ENTRIES ? [key, O[key]] : O[key]);\n }\n }\n return result;\n };\n };\n\n var objectToArray = {\n // `Object.entries` method\n // https://tc39.github.io/ecma262/#sec-object.entries\n entries: createMethod$4(true),\n // `Object.values` method\n // https://tc39.github.io/ecma262/#sec-object.values\n values: createMethod$4(false)\n };\n\n var $entries = objectToArray.entries;\n\n // `Object.entries` method\n // https://tc39.github.io/ecma262/#sec-object.entries\n _export({ target: 'Object', stat: true }, {\n entries: function entries(O) {\n return $entries(O);\n }\n });\n\n var $values = objectToArray.values;\n\n // `Object.values` method\n // https://tc39.github.io/ecma262/#sec-object.values\n _export({ target: 'Object', stat: true }, {\n values: function values(O) {\n return $values(O);\n }\n });\n\n // `Number.isNaN` method\n // https://tc39.github.io/ecma262/#sec-number.isnan\n _export({ target: 'Number', stat: true }, {\n isNaN: function isNaN(number) {\n // eslint-disable-next-line no-self-compare\n return number != number;\n }\n });\n\n var nativeGetOwnPropertyDescriptor$2 = objectGetOwnPropertyDescriptor.f;\n\n\n var FAILS_ON_PRIMITIVES$1 = fails(function () { nativeGetOwnPropertyDescriptor$2(1); });\n var FORCED$2 = !descriptors || FAILS_ON_PRIMITIVES$1;\n\n // `Object.getOwnPropertyDescriptor` method\n // https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptor\n _export({ target: 'Object', stat: true, forced: FORCED$2, sham: !descriptors }, {\n getOwnPropertyDescriptor: function getOwnPropertyDescriptor(it, key) {\n return nativeGetOwnPropertyDescriptor$2(toIndexedObject(it), key);\n }\n });\n\n // `Object.getOwnPropertyDescriptors` method\n // https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptors\n _export({ target: 'Object', stat: true, sham: !descriptors }, {\n getOwnPropertyDescriptors: function getOwnPropertyDescriptors(object) {\n var O = toIndexedObject(object);\n var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;\n var keys = ownKeys(O);\n var result = {};\n var index = 0;\n var key, descriptor;\n while (keys.length > index) {\n descriptor = getOwnPropertyDescriptor(O, key = keys[index++]);\n if (descriptor !== undefined) createProperty(result, key, descriptor);\n }\n return result;\n }\n });\n\n // @@match logic\n fixRegexpWellKnownSymbolLogic('match', 1, function (MATCH, nativeMatch, maybeCallNative) {\n return [\n // `String.prototype.match` method\n // https://tc39.github.io/ecma262/#sec-string.prototype.match\n function match(regexp) {\n var O = requireObjectCoercible(this);\n var matcher = regexp == undefined ? undefined : regexp[MATCH];\n return matcher !== undefined ? matcher.call(regexp, O) : new RegExp(regexp)[MATCH](String(O));\n },\n // `RegExp.prototype[@@match]` method\n // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@match\n function (regexp) {\n var res = maybeCallNative(nativeMatch, regexp, this);\n if (res.done) return res.value;\n\n var rx = anObject(regexp);\n var S = String(this);\n\n if (!rx.global) return regexpExecAbstract(rx, S);\n\n var fullUnicode = rx.unicode;\n rx.lastIndex = 0;\n var A = [];\n var n = 0;\n var result;\n while ((result = regexpExecAbstract(rx, S)) !== null) {\n var matchStr = String(result[0]);\n A[n] = matchStr;\n if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);\n n++;\n }\n return n === 0 ? null : A;\n }\n ];\n });\n\n function _classCallCheck$1(e, t) {\n if (!(e instanceof t)) throw new TypeError(\"Cannot call a class as a function\");\n }\n\n function _defineProperties$1(e, t) {\n for (var n = 0; n < t.length; n++) {\n var r = t[n];\n r.enumerable = r.enumerable || !1, r.configurable = !0, \"value\" in r && (r.writable = !0), Object.defineProperty(e, r.key, r);\n }\n }\n\n function _createClass$1(e, t, n) {\n return t && _defineProperties$1(e.prototype, t), n && _defineProperties$1(e, n), e;\n }\n\n function _defineProperty$1(e, t, n) {\n return t in e ? Object.defineProperty(e, t, {\n value: n,\n enumerable: !0,\n configurable: !0,\n writable: !0\n }) : e[t] = n, e;\n }\n\n function ownKeys$2(e, t) {\n var n = Object.keys(e);\n\n if (Object.getOwnPropertySymbols) {\n var r = Object.getOwnPropertySymbols(e);\n t && (r = r.filter(function (t) {\n return Object.getOwnPropertyDescriptor(e, t).enumerable;\n })), n.push.apply(n, r);\n }\n\n return n;\n }\n\n function _objectSpread2$1(e) {\n for (var t = 1; t < arguments.length; t++) {\n var n = null != arguments[t] ? arguments[t] : {};\n t % 2 ? ownKeys$2(Object(n), !0).forEach(function (t) {\n _defineProperty$1(e, t, n[t]);\n }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : ownKeys$2(Object(n)).forEach(function (t) {\n Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(n, t));\n });\n }\n\n return e;\n }\n\n var defaults = {\n addCSS: !0,\n thumbWidth: 15,\n watch: !0\n };\n\n function matches(e, t) {\n return function () {\n return Array.from(document.querySelectorAll(t)).includes(this);\n }.call(e, t);\n }\n\n function trigger(e, t) {\n if (e && t) {\n var n = new Event(t, {\n bubbles: !0\n });\n e.dispatchEvent(n);\n }\n }\n\n var getConstructor = function getConstructor(e) {\n return null != e ? e.constructor : null;\n },\n instanceOf = function instanceOf(e, t) {\n return !!(e && t && e instanceof t);\n },\n isNullOrUndefined = function isNullOrUndefined(e) {\n return null == e;\n },\n isObject$1 = function isObject(e) {\n return getConstructor(e) === Object;\n },\n isNumber = function isNumber(e) {\n return getConstructor(e) === Number && !Number.isNaN(e);\n },\n isString = function isString(e) {\n return getConstructor(e) === String;\n },\n isBoolean = function isBoolean(e) {\n return getConstructor(e) === Boolean;\n },\n isFunction = function isFunction(e) {\n return getConstructor(e) === Function;\n },\n isArray$1 = function isArray(e) {\n return Array.isArray(e);\n },\n isNodeList = function isNodeList(e) {\n return instanceOf(e, NodeList);\n },\n isElement = function isElement(e) {\n return instanceOf(e, Element);\n },\n isEvent = function isEvent(e) {\n return instanceOf(e, Event);\n },\n isEmpty = function isEmpty(e) {\n return isNullOrUndefined(e) || (isString(e) || isArray$1(e) || isNodeList(e)) && !e.length || isObject$1(e) && !Object.keys(e).length;\n },\n is = {\n nullOrUndefined: isNullOrUndefined,\n object: isObject$1,\n number: isNumber,\n string: isString,\n boolean: isBoolean,\n function: isFunction,\n array: isArray$1,\n nodeList: isNodeList,\n element: isElement,\n event: isEvent,\n empty: isEmpty\n };\n\n function getDecimalPlaces(e) {\n var t = \"\".concat(e).match(/(?:\\.(\\d+))?(?:[eE]([+-]?\\d+))?$/);\n return t ? Math.max(0, (t[1] ? t[1].length : 0) - (t[2] ? +t[2] : 0)) : 0;\n }\n\n function round(e, t) {\n if (1 > t) {\n var n = getDecimalPlaces(t);\n return parseFloat(e.toFixed(n));\n }\n\n return Math.round(e / t) * t;\n }\n\n var RangeTouch = function () {\n function e(t, n) {\n _classCallCheck$1(this, e), is.element(t) ? this.element = t : is.string(t) && (this.element = document.querySelector(t)), is.element(this.element) && is.empty(this.element.rangeTouch) && (this.config = _objectSpread2$1({}, defaults, {}, n), this.init());\n }\n\n return _createClass$1(e, [{\n key: \"init\",\n value: function value() {\n e.enabled && (this.config.addCSS && (this.element.style.userSelect = \"none\", this.element.style.webKitUserSelect = \"none\", this.element.style.touchAction = \"manipulation\"), this.listeners(!0), this.element.rangeTouch = this);\n }\n }, {\n key: \"destroy\",\n value: function value() {\n e.enabled && (this.config.addCSS && (this.element.style.userSelect = \"\", this.element.style.webKitUserSelect = \"\", this.element.style.touchAction = \"\"), this.listeners(!1), this.element.rangeTouch = null);\n }\n }, {\n key: \"listeners\",\n value: function value(e) {\n var t = this,\n n = e ? \"addEventListener\" : \"removeEventListener\";\n [\"touchstart\", \"touchmove\", \"touchend\"].forEach(function (e) {\n t.element[n](e, function (e) {\n return t.set(e);\n }, !1);\n });\n }\n }, {\n key: \"get\",\n value: function value(t) {\n if (!e.enabled || !is.event(t)) return null;\n var n,\n r = t.target,\n i = t.changedTouches[0],\n o = parseFloat(r.getAttribute(\"min\")) || 0,\n s = parseFloat(r.getAttribute(\"max\")) || 100,\n u = parseFloat(r.getAttribute(\"step\")) || 1,\n c = r.getBoundingClientRect(),\n a = 100 / c.width * (this.config.thumbWidth / 2) / 100;\n return 0 > (n = 100 / c.width * (i.clientX - c.left)) ? n = 0 : 100 < n && (n = 100), 50 > n ? n -= (100 - 2 * n) * a : 50 < n && (n += 2 * (n - 50) * a), o + round(n / 100 * (s - o), u);\n }\n }, {\n key: \"set\",\n value: function value(t) {\n e.enabled && is.event(t) && !t.target.disabled && (t.preventDefault(), t.target.value = this.get(t), trigger(t.target, \"touchend\" === t.type ? \"change\" : \"input\"));\n }\n }], [{\n key: \"setup\",\n value: function value(t) {\n var n = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : {},\n r = null;\n if (is.empty(t) || is.string(t) ? r = Array.from(document.querySelectorAll(is.string(t) ? t : 'input[type=\"range\"]')) : is.element(t) ? r = [t] : is.nodeList(t) ? r = Array.from(t) : is.array(t) && (r = t.filter(is.element)), is.empty(r)) return null;\n\n var i = _objectSpread2$1({}, defaults, {}, n);\n\n if (is.string(t) && i.watch) {\n var o = new MutationObserver(function (n) {\n Array.from(n).forEach(function (n) {\n Array.from(n.addedNodes).forEach(function (n) {\n is.element(n) && matches(n, t) && new e(n, i);\n });\n });\n });\n o.observe(document.body, {\n childList: !0,\n subtree: !0\n });\n }\n\n return r.map(function (t) {\n return new e(t, n);\n });\n }\n }, {\n key: \"enabled\",\n get: function get() {\n return \"ontouchstart\" in document.documentElement;\n }\n }]), e;\n }();\n\n var nativePromiseConstructor = global_1.Promise;\n\n var SPECIES$5 = wellKnownSymbol('species');\n\n var setSpecies = function (CONSTRUCTOR_NAME) {\n var Constructor = getBuiltIn(CONSTRUCTOR_NAME);\n var defineProperty = objectDefineProperty.f;\n\n if (descriptors && Constructor && !Constructor[SPECIES$5]) {\n defineProperty(Constructor, SPECIES$5, {\n configurable: true,\n get: function () { return this; }\n });\n }\n };\n\n var engineIsIos = /(iphone|ipod|ipad).*applewebkit/i.test(engineUserAgent);\n\n var location = global_1.location;\n var set$1 = global_1.setImmediate;\n var clear = global_1.clearImmediate;\n var process$1 = global_1.process;\n var MessageChannel = global_1.MessageChannel;\n var Dispatch = global_1.Dispatch;\n var counter = 0;\n var queue = {};\n var ONREADYSTATECHANGE = 'onreadystatechange';\n var defer, channel, port;\n\n var run = function (id) {\n // eslint-disable-next-line no-prototype-builtins\n if (queue.hasOwnProperty(id)) {\n var fn = queue[id];\n delete queue[id];\n fn();\n }\n };\n\n var runner = function (id) {\n return function () {\n run(id);\n };\n };\n\n var listener = function (event) {\n run(event.data);\n };\n\n var post = function (id) {\n // old engines have not location.origin\n global_1.postMessage(id + '', location.protocol + '//' + location.host);\n };\n\n // Node.js 0.9+ & IE10+ has setImmediate, otherwise:\n if (!set$1 || !clear) {\n set$1 = function setImmediate(fn) {\n var args = [];\n var i = 1;\n while (arguments.length > i) args.push(arguments[i++]);\n queue[++counter] = function () {\n // eslint-disable-next-line no-new-func\n (typeof fn == 'function' ? fn : Function(fn)).apply(undefined, args);\n };\n defer(counter);\n return counter;\n };\n clear = function clearImmediate(id) {\n delete queue[id];\n };\n // Node.js 0.8-\n if (classofRaw(process$1) == 'process') {\n defer = function (id) {\n process$1.nextTick(runner(id));\n };\n // Sphere (JS game engine) Dispatch API\n } else if (Dispatch && Dispatch.now) {\n defer = function (id) {\n Dispatch.now(runner(id));\n };\n // Browsers with MessageChannel, includes WebWorkers\n // except iOS - https://github.com/zloirock/core-js/issues/624\n } else if (MessageChannel && !engineIsIos) {\n channel = new MessageChannel();\n port = channel.port2;\n channel.port1.onmessage = listener;\n defer = functionBindContext(port.postMessage, port, 1);\n // Browsers with postMessage, skip WebWorkers\n // IE8 has postMessage, but it's sync & typeof its postMessage is 'object'\n } else if (\n global_1.addEventListener &&\n typeof postMessage == 'function' &&\n !global_1.importScripts &&\n !fails(post) &&\n location.protocol !== 'file:'\n ) {\n defer = post;\n global_1.addEventListener('message', listener, false);\n // IE8-\n } else if (ONREADYSTATECHANGE in documentCreateElement('script')) {\n defer = function (id) {\n html.appendChild(documentCreateElement('script'))[ONREADYSTATECHANGE] = function () {\n html.removeChild(this);\n run(id);\n };\n };\n // Rest old browsers\n } else {\n defer = function (id) {\n setTimeout(runner(id), 0);\n };\n }\n }\n\n var task = {\n set: set$1,\n clear: clear\n };\n\n var getOwnPropertyDescriptor$3 = objectGetOwnPropertyDescriptor.f;\n\n var macrotask = task.set;\n\n\n var MutationObserver$1 = global_1.MutationObserver || global_1.WebKitMutationObserver;\n var process$2 = global_1.process;\n var Promise$1 = global_1.Promise;\n var IS_NODE = classofRaw(process$2) == 'process';\n // Node.js 11 shows ExperimentalWarning on getting `queueMicrotask`\n var queueMicrotaskDescriptor = getOwnPropertyDescriptor$3(global_1, 'queueMicrotask');\n var queueMicrotask = queueMicrotaskDescriptor && queueMicrotaskDescriptor.value;\n\n var flush, head, last, notify, toggle, node, promise, then;\n\n // modern engines have queueMicrotask method\n if (!queueMicrotask) {\n flush = function () {\n var parent, fn;\n if (IS_NODE && (parent = process$2.domain)) parent.exit();\n while (head) {\n fn = head.fn;\n head = head.next;\n try {\n fn();\n } catch (error) {\n if (head) notify();\n else last = undefined;\n throw error;\n }\n } last = undefined;\n if (parent) parent.enter();\n };\n\n // Node.js\n if (IS_NODE) {\n notify = function () {\n process$2.nextTick(flush);\n };\n // browsers with MutationObserver, except iOS - https://github.com/zloirock/core-js/issues/339\n } else if (MutationObserver$1 && !engineIsIos) {\n toggle = true;\n node = document.createTextNode('');\n new MutationObserver$1(flush).observe(node, { characterData: true });\n notify = function () {\n node.data = toggle = !toggle;\n };\n // environments with maybe non-completely correct, but existent Promise\n } else if (Promise$1 && Promise$1.resolve) {\n // Promise.resolve without an argument throws an error in LG WebOS 2\n promise = Promise$1.resolve(undefined);\n then = promise.then;\n notify = function () {\n then.call(promise, flush);\n };\n // for other environments - macrotask based on:\n // - setImmediate\n // - MessageChannel\n // - window.postMessag\n // - onreadystatechange\n // - setTimeout\n } else {\n notify = function () {\n // strange IE + webpack dev server bug - use .call(global)\n macrotask.call(global_1, flush);\n };\n }\n }\n\n var microtask = queueMicrotask || function (fn) {\n var task = { fn: fn, next: undefined };\n if (last) last.next = task;\n if (!head) {\n head = task;\n notify();\n } last = task;\n };\n\n var PromiseCapability = function (C) {\n var resolve, reject;\n this.promise = new C(function ($$resolve, $$reject) {\n if (resolve !== undefined || reject !== undefined) throw TypeError('Bad Promise constructor');\n resolve = $$resolve;\n reject = $$reject;\n });\n this.resolve = aFunction$1(resolve);\n this.reject = aFunction$1(reject);\n };\n\n // 25.4.1.5 NewPromiseCapability(C)\n var f$7 = function (C) {\n return new PromiseCapability(C);\n };\n\n var newPromiseCapability = {\n \tf: f$7\n };\n\n var promiseResolve = function (C, x) {\n anObject(C);\n if (isObject(x) && x.constructor === C) return x;\n var promiseCapability = newPromiseCapability.f(C);\n var resolve = promiseCapability.resolve;\n resolve(x);\n return promiseCapability.promise;\n };\n\n var hostReportErrors = function (a, b) {\n var console = global_1.console;\n if (console && console.error) {\n arguments.length === 1 ? console.error(a) : console.error(a, b);\n }\n };\n\n var perform = function (exec) {\n try {\n return { error: false, value: exec() };\n } catch (error) {\n return { error: true, value: error };\n }\n };\n\n var task$1 = task.set;\n\n\n\n\n\n\n\n\n\n\n var SPECIES$6 = wellKnownSymbol('species');\n var PROMISE = 'Promise';\n var getInternalState$3 = internalState.get;\n var setInternalState$6 = internalState.set;\n var getInternalPromiseState = internalState.getterFor(PROMISE);\n var PromiseConstructor = nativePromiseConstructor;\n var TypeError$1 = global_1.TypeError;\n var document$2 = global_1.document;\n var process$3 = global_1.process;\n var $fetch$1 = getBuiltIn('fetch');\n var newPromiseCapability$1 = newPromiseCapability.f;\n var newGenericPromiseCapability = newPromiseCapability$1;\n var IS_NODE$1 = classofRaw(process$3) == 'process';\n var DISPATCH_EVENT = !!(document$2 && document$2.createEvent && global_1.dispatchEvent);\n var UNHANDLED_REJECTION = 'unhandledrejection';\n var REJECTION_HANDLED = 'rejectionhandled';\n var PENDING = 0;\n var FULFILLED = 1;\n var REJECTED = 2;\n var HANDLED = 1;\n var UNHANDLED = 2;\n var Internal, OwnPromiseCapability, PromiseWrapper, nativeThen;\n\n var FORCED$3 = isForced_1(PROMISE, function () {\n var GLOBAL_CORE_JS_PROMISE = inspectSource(PromiseConstructor) !== String(PromiseConstructor);\n if (!GLOBAL_CORE_JS_PROMISE) {\n // V8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables\n // https://bugs.chromium.org/p/chromium/issues/detail?id=830565\n // We can't detect it synchronously, so just check versions\n if (engineV8Version === 66) return true;\n // Unhandled rejections tracking support, NodeJS Promise without it fails @@species test\n if (!IS_NODE$1 && typeof PromiseRejectionEvent != 'function') return true;\n }\n // We can't use @@species feature detection in V8 since it causes\n // deoptimization and performance degradation\n // https://github.com/zloirock/core-js/issues/679\n if (engineV8Version >= 51 && /native code/.test(PromiseConstructor)) return false;\n // Detect correctness of subclassing with @@species support\n var promise = PromiseConstructor.resolve(1);\n var FakePromise = function (exec) {\n exec(function () { /* empty */ }, function () { /* empty */ });\n };\n var constructor = promise.constructor = {};\n constructor[SPECIES$6] = FakePromise;\n return !(promise.then(function () { /* empty */ }) instanceof FakePromise);\n });\n\n var INCORRECT_ITERATION$1 = FORCED$3 || !checkCorrectnessOfIteration(function (iterable) {\n PromiseConstructor.all(iterable)['catch'](function () { /* empty */ });\n });\n\n // helpers\n var isThenable = function (it) {\n var then;\n return isObject(it) && typeof (then = it.then) == 'function' ? then : false;\n };\n\n var notify$1 = function (promise, state, isReject) {\n if (state.notified) return;\n state.notified = true;\n var chain = state.reactions;\n microtask(function () {\n var value = state.value;\n var ok = state.state == FULFILLED;\n var index = 0;\n // variable length - can't use forEach\n while (chain.length > index) {\n var reaction = chain[index++];\n var handler = ok ? reaction.ok : reaction.fail;\n var resolve = reaction.resolve;\n var reject = reaction.reject;\n var domain = reaction.domain;\n var result, then, exited;\n try {\n if (handler) {\n if (!ok) {\n if (state.rejection === UNHANDLED) onHandleUnhandled(promise, state);\n state.rejection = HANDLED;\n }\n if (handler === true) result = value;\n else {\n if (domain) domain.enter();\n result = handler(value); // can throw\n if (domain) {\n domain.exit();\n exited = true;\n }\n }\n if (result === reaction.promise) {\n reject(TypeError$1('Promise-chain cycle'));\n } else if (then = isThenable(result)) {\n then.call(result, resolve, reject);\n } else resolve(result);\n } else reject(value);\n } catch (error) {\n if (domain && !exited) domain.exit();\n reject(error);\n }\n }\n state.reactions = [];\n state.notified = false;\n if (isReject && !state.rejection) onUnhandled(promise, state);\n });\n };\n\n var dispatchEvent = function (name, promise, reason) {\n var event, handler;\n if (DISPATCH_EVENT) {\n event = document$2.createEvent('Event');\n event.promise = promise;\n event.reason = reason;\n event.initEvent(name, false, true);\n global_1.dispatchEvent(event);\n } else event = { promise: promise, reason: reason };\n if (handler = global_1['on' + name]) handler(event);\n else if (name === UNHANDLED_REJECTION) hostReportErrors('Unhandled promise rejection', reason);\n };\n\n var onUnhandled = function (promise, state) {\n task$1.call(global_1, function () {\n var value = state.value;\n var IS_UNHANDLED = isUnhandled(state);\n var result;\n if (IS_UNHANDLED) {\n result = perform(function () {\n if (IS_NODE$1) {\n process$3.emit('unhandledRejection', value, promise);\n } else dispatchEvent(UNHANDLED_REJECTION, promise, value);\n });\n // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should\n state.rejection = IS_NODE$1 || isUnhandled(state) ? UNHANDLED : HANDLED;\n if (result.error) throw result.value;\n }\n });\n };\n\n var isUnhandled = function (state) {\n return state.rejection !== HANDLED && !state.parent;\n };\n\n var onHandleUnhandled = function (promise, state) {\n task$1.call(global_1, function () {\n if (IS_NODE$1) {\n process$3.emit('rejectionHandled', promise);\n } else dispatchEvent(REJECTION_HANDLED, promise, state.value);\n });\n };\n\n var bind = function (fn, promise, state, unwrap) {\n return function (value) {\n fn(promise, state, value, unwrap);\n };\n };\n\n var internalReject = function (promise, state, value, unwrap) {\n if (state.done) return;\n state.done = true;\n if (unwrap) state = unwrap;\n state.value = value;\n state.state = REJECTED;\n notify$1(promise, state, true);\n };\n\n var internalResolve = function (promise, state, value, unwrap) {\n if (state.done) return;\n state.done = true;\n if (unwrap) state = unwrap;\n try {\n if (promise === value) throw TypeError$1(\"Promise can't be resolved itself\");\n var then = isThenable(value);\n if (then) {\n microtask(function () {\n var wrapper = { done: false };\n try {\n then.call(value,\n bind(internalResolve, promise, wrapper, state),\n bind(internalReject, promise, wrapper, state)\n );\n } catch (error) {\n internalReject(promise, wrapper, error, state);\n }\n });\n } else {\n state.value = value;\n state.state = FULFILLED;\n notify$1(promise, state, false);\n }\n } catch (error) {\n internalReject(promise, { done: false }, error, state);\n }\n };\n\n // constructor polyfill\n if (FORCED$3) {\n // 25.4.3.1 Promise(executor)\n PromiseConstructor = function Promise(executor) {\n anInstance(this, PromiseConstructor, PROMISE);\n aFunction$1(executor);\n Internal.call(this);\n var state = getInternalState$3(this);\n try {\n executor(bind(internalResolve, this, state), bind(internalReject, this, state));\n } catch (error) {\n internalReject(this, state, error);\n }\n };\n // eslint-disable-next-line no-unused-vars\n Internal = function Promise(executor) {\n setInternalState$6(this, {\n type: PROMISE,\n done: false,\n notified: false,\n parent: false,\n reactions: [],\n rejection: false,\n state: PENDING,\n value: undefined\n });\n };\n Internal.prototype = redefineAll(PromiseConstructor.prototype, {\n // `Promise.prototype.then` method\n // https://tc39.github.io/ecma262/#sec-promise.prototype.then\n then: function then(onFulfilled, onRejected) {\n var state = getInternalPromiseState(this);\n var reaction = newPromiseCapability$1(speciesConstructor(this, PromiseConstructor));\n reaction.ok = typeof onFulfilled == 'function' ? onFulfilled : true;\n reaction.fail = typeof onRejected == 'function' && onRejected;\n reaction.domain = IS_NODE$1 ? process$3.domain : undefined;\n state.parent = true;\n state.reactions.push(reaction);\n if (state.state != PENDING) notify$1(this, state, false);\n return reaction.promise;\n },\n // `Promise.prototype.catch` method\n // https://tc39.github.io/ecma262/#sec-promise.prototype.catch\n 'catch': function (onRejected) {\n return this.then(undefined, onRejected);\n }\n });\n OwnPromiseCapability = function () {\n var promise = new Internal();\n var state = getInternalState$3(promise);\n this.promise = promise;\n this.resolve = bind(internalResolve, promise, state);\n this.reject = bind(internalReject, promise, state);\n };\n newPromiseCapability.f = newPromiseCapability$1 = function (C) {\n return C === PromiseConstructor || C === PromiseWrapper\n ? new OwnPromiseCapability(C)\n : newGenericPromiseCapability(C);\n };\n\n if ( typeof nativePromiseConstructor == 'function') {\n nativeThen = nativePromiseConstructor.prototype.then;\n\n // wrap native Promise#then for native async functions\n redefine(nativePromiseConstructor.prototype, 'then', function then(onFulfilled, onRejected) {\n var that = this;\n return new PromiseConstructor(function (resolve, reject) {\n nativeThen.call(that, resolve, reject);\n }).then(onFulfilled, onRejected);\n // https://github.com/zloirock/core-js/issues/640\n }, { unsafe: true });\n\n // wrap fetch result\n if (typeof $fetch$1 == 'function') _export({ global: true, enumerable: true, forced: true }, {\n // eslint-disable-next-line no-unused-vars\n fetch: function fetch(input /* , init */) {\n return promiseResolve(PromiseConstructor, $fetch$1.apply(global_1, arguments));\n }\n });\n }\n }\n\n _export({ global: true, wrap: true, forced: FORCED$3 }, {\n Promise: PromiseConstructor\n });\n\n setToStringTag(PromiseConstructor, PROMISE, false);\n setSpecies(PROMISE);\n\n PromiseWrapper = getBuiltIn(PROMISE);\n\n // statics\n _export({ target: PROMISE, stat: true, forced: FORCED$3 }, {\n // `Promise.reject` method\n // https://tc39.github.io/ecma262/#sec-promise.reject\n reject: function reject(r) {\n var capability = newPromiseCapability$1(this);\n capability.reject.call(undefined, r);\n return capability.promise;\n }\n });\n\n _export({ target: PROMISE, stat: true, forced: FORCED$3 }, {\n // `Promise.resolve` method\n // https://tc39.github.io/ecma262/#sec-promise.resolve\n resolve: function resolve(x) {\n return promiseResolve( this, x);\n }\n });\n\n _export({ target: PROMISE, stat: true, forced: INCORRECT_ITERATION$1 }, {\n // `Promise.all` method\n // https://tc39.github.io/ecma262/#sec-promise.all\n all: function all(iterable) {\n var C = this;\n var capability = newPromiseCapability$1(C);\n var resolve = capability.resolve;\n var reject = capability.reject;\n var result = perform(function () {\n var $promiseResolve = aFunction$1(C.resolve);\n var values = [];\n var counter = 0;\n var remaining = 1;\n iterate_1(iterable, function (promise) {\n var index = counter++;\n var alreadyCalled = false;\n values.push(undefined);\n remaining++;\n $promiseResolve.call(C, promise).then(function (value) {\n if (alreadyCalled) return;\n alreadyCalled = true;\n values[index] = value;\n --remaining || resolve(values);\n }, reject);\n });\n --remaining || resolve(values);\n });\n if (result.error) reject(result.value);\n return capability.promise;\n },\n // `Promise.race` method\n // https://tc39.github.io/ecma262/#sec-promise.race\n race: function race(iterable) {\n var C = this;\n var capability = newPromiseCapability$1(C);\n var reject = capability.reject;\n var result = perform(function () {\n var $promiseResolve = aFunction$1(C.resolve);\n iterate_1(iterable, function (promise) {\n $promiseResolve.call(C, promise).then(capability.resolve, reject);\n });\n });\n if (result.error) reject(result.value);\n return capability.promise;\n }\n });\n\n var getOwnPropertyDescriptor$4 = objectGetOwnPropertyDescriptor.f;\n\n\n\n\n\n\n var nativeStartsWith = ''.startsWith;\n var min$4 = Math.min;\n\n var CORRECT_IS_REGEXP_LOGIC = correctIsRegexpLogic('startsWith');\n // https://github.com/zloirock/core-js/pull/702\n var MDN_POLYFILL_BUG = !CORRECT_IS_REGEXP_LOGIC && !!function () {\n var descriptor = getOwnPropertyDescriptor$4(String.prototype, 'startsWith');\n return descriptor && !descriptor.writable;\n }();\n\n // `String.prototype.startsWith` method\n // https://tc39.github.io/ecma262/#sec-string.prototype.startswith\n _export({ target: 'String', proto: true, forced: !MDN_POLYFILL_BUG && !CORRECT_IS_REGEXP_LOGIC }, {\n startsWith: function startsWith(searchString /* , position = 0 */) {\n var that = String(requireObjectCoercible(this));\n notARegexp(searchString);\n var index = toLength(min$4(arguments.length > 1 ? arguments[1] : undefined, that.length));\n var search = String(searchString);\n return nativeStartsWith\n ? nativeStartsWith.call(that, search, index)\n : that.slice(index, index + search.length) === search;\n }\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$2 = 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$2 = 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) && isFunction$1(input.then);\n };\n\n var isEmpty$1 = function isEmpty(input) {\n return isNullOrUndefined$1(input) || (isString$1(input) || isArray$2(input) || isNodeList$1(input)) && !input.length || isObject$2(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$2,\n number: isNumber$1,\n string: isString$1,\n boolean: isBoolean$1,\n function: isFunction$1,\n array: isArray$2,\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 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 // `Array.prototype.{ reduce, reduceRight }` methods implementation\n var createMethod$5 = function (IS_RIGHT) {\n return function (that, callbackfn, argumentsLength, memo) {\n aFunction$1(callbackfn);\n var O = toObject(that);\n var self = indexedObject(O);\n var length = toLength(O.length);\n var index = IS_RIGHT ? length - 1 : 0;\n var i = IS_RIGHT ? -1 : 1;\n if (argumentsLength < 2) while (true) {\n if (index in self) {\n memo = self[index];\n index += i;\n break;\n }\n index += i;\n if (IS_RIGHT ? index < 0 : length <= index) {\n throw TypeError('Reduce of empty array with no initial value');\n }\n }\n for (;IS_RIGHT ? index >= 0 : length > index; index += i) if (index in self) {\n memo = callbackfn(memo, self[index], index, O);\n }\n return memo;\n };\n };\n\n var arrayReduce = {\n // `Array.prototype.reduce` method\n // https://tc39.github.io/ecma262/#sec-array.prototype.reduce\n left: createMethod$5(false),\n // `Array.prototype.reduceRight` method\n // https://tc39.github.io/ecma262/#sec-array.prototype.reduceright\n right: createMethod$5(true)\n };\n\n var $reduce = arrayReduce.left;\n\n\n\n var STRICT_METHOD$5 = arrayMethodIsStrict('reduce');\n var USES_TO_LENGTH$9 = arrayMethodUsesToLength('reduce', { 1: 0 });\n\n // `Array.prototype.reduce` method\n // https://tc39.github.io/ecma262/#sec-array.prototype.reduce\n _export({ target: 'Array', proto: true, forced: !STRICT_METHOD$5 || !USES_TO_LENGTH$9 }, {\n reduce: function reduce(callbackfn /* , initialValue */) {\n return $reduce(this, callbackfn, arguments.length, arguments.length > 1 ? arguments[1] : undefined);\n }\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$1(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 });\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 var _Element = Element,\n prototype = _Element.prototype;\n\n function match() {\n return Array.from(document.querySelectorAll(selector)).includes(this);\n }\n\n var method = prototype.matches || prototype.webkitMatchesSelector || prototype.mozMatchesSelector || prototype.msMatchesSelector || match;\n return method.call(element, selector);\n } // Closest ancestor element matching selector (also tests element itself)\n\n function closest(element, selector) {\n var _Element2 = Element,\n prototype = _Element2.prototype; // https://developer.mozilla.org/en-US/docs/Web/API/Element/closest#Polyfill\n\n function closestElement() {\n var el = this;\n\n do {\n if (matches$1.matches(el, selector)) return el;\n el = el.parentElement || el.parentNode;\n } while (el !== null && el.nodeType === 1);\n\n return null;\n }\n\n var method = prototype.closest || closestElement;\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 } // 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 // 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: _objectSpread2(_objectSpread2({}, 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 /**\n * Silence a Promise-like object.\n * This is useful for avoiding non-harmful, but potentially confusing \"uncaught\n * play promise\" rejection error messages.\n * @param {Object} value An object that may or may not be `Promise`-like.\n */\n\n function silencePromise(value) {\n if (is$1.promise(value)) {\n value.then(null, function () {});\n }\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 wrapper = this.elements.wrapper;\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 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.config.vimeo.premium && this.supported.ui) {\n var height = 100 / this.media.offsetWidth * parseInt(window.getComputedStyle(this.media).paddingBottom, 10);\n var offset = (height - padding) / (height / 50);\n this.media.style.transform = \"translateY(-\".concat(offset, \"%)\");\n } else if (this.isHTML5) {\n wrapper.classList.toggle(this.config.classNames.videoFixedRatio, ratio !== null);\n }\n\n return {\n padding: padding,\n ratio: ratio\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 // Whether we're forcing all options (e.g. for streaming)\n if (this.config.quality.forced) {\n return this.config.quality.options;\n } // Get sizes from <source> elements\n\n\n return html5.getSources.call(this).map(function (source) {\n return Number(source.getAttribute('data-res'));\n }).filter(Boolean);\n },\n setup: function setup() {\n if (!this.isHTML5) {\n return;\n }\n\n var player = this; // Set speed options from config\n\n player.options.speed = player.config.speed.options; // 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('data-res'));\n },\n set: function set(input) {\n if (player.quality === input) {\n return;\n } // If we're using an an external handler...\n\n\n if (player.config.quality.forced && is$1.function(player.config.quality.onChange)) {\n player.config.quality.onChange(input);\n } else {\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('data-res')) === 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,\n playbackRate = _player$media.playbackRate; // 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.speed = playbackRate;\n player.currentTime = currentTime; // Resume playing\n\n if (!paused) {\n silencePromise(player.play());\n }\n }); // Load new source\n\n player.media.load();\n }\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 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$1(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 var defineProperty$6 = objectDefineProperty.f;\n var getOwnPropertyNames$1 = objectGetOwnPropertyNames.f;\n\n\n\n\n\n var setInternalState$7 = internalState.set;\n\n\n\n var MATCH$2 = wellKnownSymbol('match');\n var NativeRegExp = global_1.RegExp;\n var RegExpPrototype$1 = NativeRegExp.prototype;\n var re1 = /a/g;\n var re2 = /a/g;\n\n // \"new\" should create a new object, old webkit bug\n var CORRECT_NEW = new NativeRegExp(re1) !== re1;\n\n var UNSUPPORTED_Y$2 = regexpStickyHelpers.UNSUPPORTED_Y;\n\n var FORCED$4 = descriptors && isForced_1('RegExp', (!CORRECT_NEW || UNSUPPORTED_Y$2 || fails(function () {\n re2[MATCH$2] = false;\n // RegExp constructor can alter flags and IsRegExp works correct with @@match\n return NativeRegExp(re1) != re1 || NativeRegExp(re2) == re2 || NativeRegExp(re1, 'i') != '/a/i';\n })));\n\n // `RegExp` constructor\n // https://tc39.github.io/ecma262/#sec-regexp-constructor\n if (FORCED$4) {\n var RegExpWrapper = function RegExp(pattern, flags) {\n var thisIsRegExp = this instanceof RegExpWrapper;\n var patternIsRegExp = isRegexp(pattern);\n var flagsAreUndefined = flags === undefined;\n var sticky;\n\n if (!thisIsRegExp && patternIsRegExp && pattern.constructor === RegExpWrapper && flagsAreUndefined) {\n return pattern;\n }\n\n if (CORRECT_NEW) {\n if (patternIsRegExp && !flagsAreUndefined) pattern = pattern.source;\n } else if (pattern instanceof RegExpWrapper) {\n if (flagsAreUndefined) flags = regexpFlags.call(pattern);\n pattern = pattern.source;\n }\n\n if (UNSUPPORTED_Y$2) {\n sticky = !!flags && flags.indexOf('y') > -1;\n if (sticky) flags = flags.replace(/y/g, '');\n }\n\n var result = inheritIfRequired(\n CORRECT_NEW ? new NativeRegExp(pattern, flags) : NativeRegExp(pattern, flags),\n thisIsRegExp ? this : RegExpPrototype$1,\n RegExpWrapper\n );\n\n if (UNSUPPORTED_Y$2 && sticky) setInternalState$7(result, { sticky: sticky });\n\n return result;\n };\n var proxy = function (key) {\n key in RegExpWrapper || defineProperty$6(RegExpWrapper, key, {\n configurable: true,\n get: function () { return NativeRegExp[key]; },\n set: function (it) { NativeRegExp[key] = it; }\n });\n };\n var keys$2 = getOwnPropertyNames$1(NativeRegExp);\n var index = 0;\n while (keys$2.length > index) proxy(keys$2[index++]);\n RegExpPrototype$1.constructor = RegExpWrapper;\n RegExpWrapper.prototype = RegExpPrototype$1;\n redefine(global_1, 'RegExp', RegExpWrapper);\n }\n\n // https://tc39.github.io/ecma262/#sec-get-regexp-@@species\n setSpecies('RegExp');\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 var replaceAll = 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 var toTitleCase = 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 = /*#__PURE__*/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 var ceil$1 = Math.ceil;\n var floor$5 = Math.floor;\n\n // `Math.trunc` method\n // https://tc39.github.io/ecma262/#sec-math.trunc\n _export({ target: 'Math', stat: true }, {\n trunc: function trunc(it) {\n return (it > 0 ? floor$5 : ceil$1)(it);\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(undefined, 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 'aria-hidden': 'true',\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\n var attributes = _objectSpread2(_objectSpread2({}, attr), {}, {\n class: [attr.class, this.config.classNames.hidden].filter(Boolean).join(' ')\n });\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.call(this, 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.call(this, 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\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 }\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=\"menucaptions\"]');\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() {\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\"]'); // Filter out invalid speeds\n\n this.options.speed = this.options.speed.filter(function (o) {\n return o >= _this8.minimumSpeed && o <= _this8.maximumSpeed;\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 (is$1.array(this.config.controls) && 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(is$1.array(this.config.controls) ? 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 // Ignored on iOS as it's handled globally\n // https://developer.apple.com/library/safari/documentation/AudioVideo/Conceptual/Using_HTML5_Audio_Video/Device-SpecificConsiderations/Device-SpecificConsiderations.html\n\n\n if (control === 'volume' && !browser.isIos) {\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.call(_this10, 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.call(_this10, 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.call(_this10, 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 })); // Menu Captions\n\n pane.appendChild(createElement('div', {\n role: 'menucaptions'\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 }); // Set download attribute for HTML5 only\n\n\n if (_this10.isHTML5) {\n _attributes.download = '';\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 }\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 // Note: mode='hidden' forces a track to download. To ensure every track\n // isn't downloaded at once, only 'showing' tracks should be reassigned\n // eslint-disable-next-line no-param-reassign\n\n if (track.mode === 'showing') {\n // eslint-disable-next-line no-param-reassign\n track.mode = 'hidden';\n } // Add event listener for cue changes\n\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 (is$1.array(this.config.controls) && 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 _this2 = this;\n\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 } // Wait for the call stack to clear before setting mode='hidden'\n // on the active track - forcing the browser to download it\n\n\n setTimeout(function () {\n if (active && _this2.captions.toggled) {\n _this2.captions.currentTrackNode.mode = 'hidden';\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: 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 _this3 = 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 !_this3.isHTML5 || update || _this3.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 _this4 = 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((_this4.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: '/theme/modules/plyr/plyr.svg',\n // Blank video (used to prevent errors on source change)\n blankVideo: '/theme/modules/plyr/blank.webm',\n // Quality default\n quality: {\n default: 576,\n // The options to display in the UI, if available for the source media\n options: [4320, 2880, 2160, 1440, 1080, 720, 576, 480, 360, 240],\n forced: false,\n onChange: null\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 // The options to display in the UI, if available for the source media (e.g. Vimeo and YouTube only support 0.5x-4x)\n options: [0.5, 0.75, 1, 1.25, 1.5, 1.75, 2, 4]\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 // Selector for the fullscreen container so contextual / non-player content can remain visible in fullscreen mode\n // Non-ancestors of the player element will be ignored\n // container: null, // defaults to the player element\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 pip: 'PIP',\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 // Whether the owner of the video has a Pro or Business account\n // (which allows us to properly hide controls without CSS hacks, etc)\n premium: false,\n // Custom settings from Plyr\n referrerPolicy: null // https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement/referrerPolicy\n\n },\n // YouTube plugin\n youtube: {\n noCookie: true,\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 = /*#__PURE__*/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 var Fullscreen = /*#__PURE__*/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'; // Get the fullscreen element\n // Checks container is an ancestor, defaults to null\n\n this.player.elements.fullscreen = player.config.fullscreen.container && closest(this.player.elements.container, player.config.fullscreen.container); // 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 _this.onChange();\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 }); // Tap focus when in fullscreen\n\n on.call(this, this.player.elements.container, 'keydown', function (event) {\n return _this.trapFocus(event);\n }); // Update the UI\n\n this.update();\n } // Determine if native supported\n\n\n _createClass(Fullscreen, [{\n key: \"onChange\",\n value: 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);\n }\n }, {\n key: \"toggleFallback\",\n value: 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 this.onChange();\n } // Trap focus inside container\n\n }, {\n key: \"trapFocus\",\n value: function trapFocus(event) {\n // Bail if iOS, not active, not the tab key\n if (browser.isIos || !this.active || event.key !== 'Tab' || event.keyCode !== 9) {\n return;\n } // Get the current focused element\n\n\n var focused = document.activeElement;\n var focusable = getElements.call(this.player, 'a[href], button:not(:disabled), input:not(:disabled), [tabindex]');\n\n var _focusable = _slicedToArray(focusable, 1),\n first = _focusable[0];\n\n var last = focusable[focusable.length - 1];\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 } // Update UI\n\n }, {\n key: \"update\",\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 this.toggleFallback(true);\n } else if (!this.prefix) {\n this.target.requestFullscreen({\n navigationUI: 'hide'\n });\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 silencePromise(this.player.play());\n } else if (!Fullscreen.native || this.forceFallback) {\n this.toggleFallback(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 && element.shadowRoot ? element === this.target.getRootNode().host : 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.fullscreen || 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 // `Math.sign` method implementation\n // https://tc39.github.io/ecma262/#sec-math.sign\n var mathSign = Math.sign || function sign(x) {\n // eslint-disable-next-line no-self-compare\n return (x = +x) == 0 || x != x ? x : x < 0 ? -1 : 1;\n };\n\n // `Math.sign` method\n // https://tc39.github.io/ecma262/#sec-math.sign\n _export({ target: 'Math', stat: true }, {\n sign: mathSign\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 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('data-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 target.setAttribute('aria-label', i18n.get(_this3.playing ? 'pause' : 'play', _this3.config));\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 // Migrate any custom properties from the media to the parent\n migrateStyles: function migrateStyles() {\n var _this5 = this;\n\n // Loop through values (as they are the keys when the object is spread 🤔)\n Object.values(_objectSpread2({}, this.media.style)) // We're only fussed about Plyr specific properties\n .filter(function (key) {\n return !is$1.empty(key) && key.startsWith('--plyr');\n }).forEach(function (key) {\n // Set on the container\n _this5.elements.container.style.setProperty(key, _this5.media.style.getPropertyValue(key)); // Clean up from media element\n\n\n _this5.media.style.removeProperty(key);\n }); // Remove attribute if empty\n\n if (is$1.empty(this.media.style)) {\n this.media.removeAttribute('style');\n }\n }\n };\n\n var Listeners = /*#__PURE__*/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 silencePromise(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 } // 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 if (event.type !== 'focusout') {\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 }\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 focusout', 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 || player.config.vimeo.premium) {\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 browser fullscreen API, 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 }); // 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(); // Call pause otherwise IE11 will start playing the video again\n\n player.pause();\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, function () {\n silencePromise(player.play());\n }, 'play');\n } else {\n _this.proxy(event, function () {\n silencePromise(player.togglePlay());\n }, '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 !== false && 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', function () {\n silencePromise(player.togglePlay());\n }, '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 event.preventDefault();\n\n controls.toggleMenu.call(player, event);\n }, null, false); // Can't be passive as we're preventing default\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 silencePromise(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 touchend 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 }); // Also update controls.hover state for any non-player children of fullscreen element (as above)\n\n if (elements.fullscreen) {\n Array.from(elements.fullscreen.children).filter(function (c) {\n return !c.contains(elements.container);\n }).forEach(function (child) {\n _this3.bind(child, 'mouseenter mouseleave', function (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\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 HAS_SPECIES_SUPPORT$3 = arrayMethodHasSpeciesSupport('splice');\n var USES_TO_LENGTH$a = arrayMethodUsesToLength('splice', { ACCESSORS: true, 0: 0, 1: 2 });\n\n var max$3 = Math.max;\n var min$5 = Math.min;\n var MAX_SAFE_INTEGER$1 = 0x1FFFFFFFFFFFFF;\n var MAXIMUM_ALLOWED_LENGTH_EXCEEDED = 'Maximum allowed length exceeded';\n\n // `Array.prototype.splice` method\n // https://tc39.github.io/ecma262/#sec-array.prototype.splice\n // with adding support of @@species\n _export({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT$3 || !USES_TO_LENGTH$a }, {\n splice: function splice(start, deleteCount /* , ...items */) {\n var O = toObject(this);\n var len = toLength(O.length);\n var actualStart = toAbsoluteIndex(start, len);\n var argumentsLength = arguments.length;\n var insertCount, actualDeleteCount, A, k, from, to;\n if (argumentsLength === 0) {\n insertCount = actualDeleteCount = 0;\n } else if (argumentsLength === 1) {\n insertCount = 0;\n actualDeleteCount = len - actualStart;\n } else {\n insertCount = argumentsLength - 2;\n actualDeleteCount = min$5(max$3(toInteger(deleteCount), 0), len - actualStart);\n }\n if (len + insertCount - actualDeleteCount > MAX_SAFE_INTEGER$1) {\n throw TypeError(MAXIMUM_ALLOWED_LENGTH_EXCEEDED);\n }\n A = arraySpeciesCreate(O, actualDeleteCount);\n for (k = 0; k < actualDeleteCount; k++) {\n from = actualStart + k;\n if (from in O) createProperty(A, k, O[from]);\n }\n A.length = actualDeleteCount;\n if (insertCount < actualDeleteCount) {\n for (k = actualStart; k < len - actualDeleteCount; k++) {\n from = k + actualDeleteCount;\n to = k + insertCount;\n if (from in O) O[to] = O[from];\n else delete O[to];\n }\n for (k = len; k > len - actualDeleteCount + insertCount; k--) delete O[k - 1];\n } else if (insertCount > actualDeleteCount) {\n for (k = len - actualDeleteCount; k > actualStart; k--) {\n from = k + actualDeleteCount - 1;\n to = k + insertCount - 1;\n if (from in O) O[to] = O[from];\n else delete O[to];\n }\n }\n for (k = 0; k < insertCount; k++) {\n O[k + actualStart] = arguments[k + 2];\n }\n O.length = len - actualDeleteCount + insertCount;\n return A;\n }\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 pathname = path.replace(/[\\?|#].*$/, ''),\n pathStripped = path.replace(/^(css|img)!/, ''),\n isLegacyIECss,\n e;\n numTries = numTries || 0;\n\n if (/(^css!|\\.css$)/.test(pathname)) {\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|webp)$)/.test(pathname)) {\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 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 player = this; // Add embed class for responsive\n\n toggleClass(player.elements.wrapper, player.config.classNames.embed, true); // Set speed options from config\n\n player.options.speed = player.config.speed.options; // Set intial ratio\n\n setAspectRatio.call(player); // Load the SDK if not already\n\n if (!is$1.object(window.Vimeo)) {\n loadScript(player.config.urls.vimeo.sdk).then(function () {\n vimeo.ready.call(player);\n }).catch(function (error) {\n player.debug.warn('Vimeo SDK (player.js) failed to load', error);\n });\n } else {\n vimeo.ready.call(player);\n }\n },\n // API Ready\n ready: function ready() {\n var _this = this;\n\n var player = this;\n var config = player.config.vimeo;\n\n var premium = config.premium,\n referrerPolicy = config.referrerPolicy,\n frameParams = _objectWithoutProperties(config, [\"premium\", \"referrerPolicy\"]); // If the owner has a pro or premium account then we can hide controls etc\n\n\n if (premium) {\n Object.assign(frameParams, {\n controls: false,\n sidedock: false\n });\n } // Get Vimeo params for the iframe\n\n\n var params = buildUrlParams(_objectSpread2({\n loop: player.config.loop.active,\n autoplay: player.autoplay,\n muted: player.muted,\n gesture: 'media',\n playsinline: !this.config.fullscreen.iosNative\n }, frameParams)); // 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('allow', 'autoplay,fullscreen,picture-in-picture'); // Set the referrer policy if required\n\n if (!is$1.empty(referrerPolicy)) {\n iframe.setAttribute('referrerPolicy', referrerPolicy);\n } // Inject the package\n\n\n var poster = player.poster;\n\n if (premium) {\n iframe.setAttribute('data-poster', poster);\n player.media = replaceElement(iframe, player.media);\n } else {\n var wrapper = createElement('div', {\n class: player.config.classNames.embedContainer,\n 'data-poster': poster\n });\n wrapper.appendChild(iframe);\n player.media = replaceElement(wrapper, player.media);\n } // Get poster image\n\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 () {\n // Cannot set Playback Rate, Video is probably not on Pro account\n player.options.speed = [1];\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 _this.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(_this);\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(_this);\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('bufferstart', function () {\n triggerEvent.call(player, player.media, 'waiting');\n });\n player.embed.on('bufferend', function () {\n triggerEvent.call(player, player.media, 'playing');\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 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$1(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 'data-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$1(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 var speeds = instance.getAvailablePlaybackRates(); // Filter based on config\n\n player.options.speed = speeds.filter(function (s) {\n return player.config.speed.options.includes(s);\n }); // 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 case 3:\n // Trigger waiting event to add loading classes to container as the video buffers.\n triggerEvent.call(player, player.media, 'waiting');\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 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$1(this.media, this.elements.wrapper); // Poster image 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.setup.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 = /*#__PURE__*/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 var _this4 = this;\n\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); // Create ads loader\n\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 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 container = this.player.elements.container;\n\n try {\n // Request video ads\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 if (this.player.ended) {\n this.loadAds();\n } else {\n // The SDK won't allow new ads to be called without receiving a contentComplete()\n this.loader.contentComplete();\n }\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 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 }\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 silencePromise(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 that the manager has been destroyed set it to also be un-initialized\n\n _this11.initialized = false; // 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: config.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 $findIndex = arrayIteration.findIndex;\n\n\n\n var FIND_INDEX = 'findIndex';\n var SKIPS_HOLES$1 = true;\n\n var USES_TO_LENGTH$b = arrayMethodUsesToLength(FIND_INDEX);\n\n // Shouldn't skip holes\n if (FIND_INDEX in []) Array(1)[FIND_INDEX](function () { SKIPS_HOLES$1 = false; });\n\n // `Array.prototype.findIndex` method\n // https://tc39.github.io/ecma262/#sec-array.prototype.findindex\n _export({ target: 'Array', proto: true, forced: SKIPS_HOLES$1 || !USES_TO_LENGTH$b }, {\n findIndex: function findIndex(callbackfn /* , that = undefined */) {\n return $findIndex(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);\n }\n });\n\n // https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables\n addToUnscopables(FIND_INDEX);\n\n var min$6 = Math.min;\n var nativeLastIndexOf = [].lastIndexOf;\n var NEGATIVE_ZERO$1 = !!nativeLastIndexOf && 1 / [1].lastIndexOf(1, -0) < 0;\n var STRICT_METHOD$6 = arrayMethodIsStrict('lastIndexOf');\n // For preventing possible almost infinite loop in non-standard implementations, test the forward version of the method\n var USES_TO_LENGTH$c = arrayMethodUsesToLength('indexOf', { ACCESSORS: true, 1: 0 });\n var FORCED$5 = NEGATIVE_ZERO$1 || !STRICT_METHOD$6 || !USES_TO_LENGTH$c;\n\n // `Array.prototype.lastIndexOf` method implementation\n // https://tc39.github.io/ecma262/#sec-array.prototype.lastindexof\n var arrayLastIndexOf = FORCED$5 ? function lastIndexOf(searchElement /* , fromIndex = @[*-1] */) {\n // convert -0 to +0\n if (NEGATIVE_ZERO$1) return nativeLastIndexOf.apply(this, arguments) || 0;\n var O = toIndexedObject(this);\n var length = toLength(O.length);\n var index = length - 1;\n if (arguments.length > 1) index = min$6(index, toInteger(arguments[1]));\n if (index < 0) index = length + index;\n for (;index >= 0; index--) if (index in O && O[index] === searchElement) return index || 0;\n return -1;\n } : nativeLastIndexOf;\n\n // `Array.prototype.lastIndexOf` method\n // https://tc39.github.io/ecma262/#sec-array.prototype.lastindexof\n _export({ target: 'Array', proto: true, forced: arrayLastIndexOf !== [].lastIndexOf }, {\n lastIndexOf: arrayLastIndexOf\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 fitRatio = function fitRatio(ratio, outer) {\n var targetRatio = outer.width / outer.height;\n var result = {};\n\n if (ratio > targetRatio) {\n result.width = outer.width;\n result.height = 1 / ratio * outer.width;\n } else {\n result.height = outer.height;\n result.width = ratio * outer.height;\n }\n\n return result;\n };\n\n var PreviewThumbnails = /*#__PURE__*/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 // Toggle the 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 } // Resolve promise\n\n\n var sortAndResolve = function sortAndResolve() {\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 }; // Via callback()\n\n\n if (is$1.function(src)) {\n src(function (thumbnails) {\n _this2.thumbnails = thumbnails;\n sortAndResolve();\n });\n } // VTT urls\n else {\n // If string, convert into single-element list\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 }); // Resolve\n\n Promise.all(promises).then(sortAndResolve);\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 does not exist or is false)\n if (is$1.nullOrUndefined(event.button) || 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: \"destroy\",\n value: function destroy() {\n if (this.elements.thumb.container) {\n this.elements.thumb.container.remove();\n }\n\n if (this.elements.scrubbing.container) {\n this.elements.scrubbing.container.remove();\n }\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 || this.elements.thumb.imageContainer.clientWidth > 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 } else if (this.elements.thumb.imageContainer.clientHeight > 20 && this.elements.thumb.imageContainer.clientWidth < 20) {\n var _thumbWidth = Math.floor(this.elements.thumb.imageContainer.clientHeight * this.thumbAspectRatio);\n\n this.elements.thumb.imageContainer.style.width = \"\".concat(_thumbWidth, \"px\");\n } else if (this.elements.thumb.imageContainer.clientHeight < 20 && this.elements.thumb.imageContainer.clientWidth > 20) {\n var thumbHeight = Math.floor(this.elements.thumb.imageContainer.clientWidth / this.thumbAspectRatio);\n this.elements.thumb.imageContainer.style.height = \"\".concat(thumbHeight, \"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 var _fitRatio = fitRatio(this.thumbAspectRatio, {\n width: this.player.media.clientWidth,\n height: this.player.media.clientHeight\n }),\n width = _fitRatio.width,\n height = _fitRatio.height;\n\n this.elements.scrubbing.container.style.width = \"\".concat(width, \"px\");\n this.elements.scrubbing.container.style.height = \"\".concat(height, \"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(previewImage.naturalHeight * multiplier, \"px\"); // eslint-disable-next-line no-param-reassign\n\n previewImage.style.width = \"\".concat(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 var _fitRatio2 = fitRatio(this.thumbAspectRatio, {\n width: this.player.media.clientWidth,\n height: this.player.media.clientHeight\n }),\n height = _fitRatio2.height;\n\n return height;\n } // If css is used this needs to return the css height for sprites to work (see setImageSizeAndOffset)\n\n\n if (this.sizeSpecifiedInCSS) {\n return this.elements.thumb.imageContainer.clientHeight;\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 } // Update previewThumbnails config & reload plugin\n\n\n if (!is$1.empty(input.previewThumbnails)) {\n Object.assign(_this2.config.previewThumbnails, input.previewThumbnails); // Cleanup previewThumbnails plugin if it was loaded\n\n if (_this2.previewThumbnails && _this2.previewThumbnails.loaded) {\n _this2.previewThumbnails.destroy();\n\n _this2.previewThumbnails = null;\n } // Create new instance if it is still enabled\n\n\n if (_this2.config.previewThumbnails.enabled) {\n _this2.previewThumbnails = new PreviewThumbnails(_this2);\n }\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 = /*#__PURE__*/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 fullscreen: 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$1(this.media, this.elements.container);\n } // Migrate custom properties from media to container (so they work 😉)\n\n\n ui.migrateStyles.call(this); // Add style hook\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 fullscreen\n\n\n this.fullscreen = new Fullscreen(this); // Setup interface\n // If embed but not fully supported, build interface now to avoid flash of controls\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 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 silencePromise(_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 silencePromise(_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 null;\n }\n\n return 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 return this.play();\n }\n\n return this.pause();\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 -= 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 += 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 && is$1.array(this.config.controls) && 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$1(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') || this.media.getAttribute('data-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 // ==========================================================================\n\n return Plyr;\n\n})));\n","// Polyfill for creating CustomEvents on IE9/10/11\n\n// code pulled from:\n// https://github.com/d4tocchini/customevent-polyfill\n// https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent#Polyfill\n\n(function() {\n if (typeof window === 'undefined') {\n return;\n }\n\n try {\n var ce = new window.CustomEvent('test', { cancelable: true });\n ce.preventDefault();\n if (ce.defaultPrevented !== true) {\n // IE has problems with .preventDefault() on custom events\n // http://stackoverflow.com/questions/23349191\n throw new Error('Could not prevent default');\n }\n } catch (e) {\n var CustomEvent = function(event, params) {\n var evt, origPrevent;\n params = params || {};\n params.bubbles = !!params.bubbles;\n params.cancelable = !!params.cancelable;\n\n evt = document.createEvent('CustomEvent');\n evt.initCustomEvent(\n event,\n params.bubbles,\n params.cancelable,\n params.detail\n );\n origPrevent = evt.preventDefault;\n evt.preventDefault = function() {\n origPrevent.call(this);\n try {\n Object.defineProperty(this, 'defaultPrevented', {\n get: function() {\n return true;\n }\n });\n } catch (e) {\n this.defaultPrevented = true;\n }\n };\n return evt;\n };\n\n CustomEvent.prototype = window.Event.prototype;\n window.CustomEvent = CustomEvent; // expose definition to window\n }\n})();\n","var check = function (it) {\n return it && it.Math == Math && it;\n};\n\n// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028\nmodule.exports =\n // eslint-disable-next-line no-undef\n check(typeof globalThis == 'object' && globalThis) ||\n check(typeof window == 'object' && window) ||\n check(typeof self == 'object' && self) ||\n check(typeof global == 'object' && global) ||\n // eslint-disable-next-line no-new-func\n Function('return this')();\n","module.exports = function (exec) {\n try {\n return !!exec();\n } catch (error) {\n return true;\n }\n};\n","var fails = require('../internals/fails');\n\n// Thank's IE8 for his funny defineProperty\nmodule.exports = !fails(function () {\n return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7;\n});\n","'use strict';\nvar nativePropertyIsEnumerable = {}.propertyIsEnumerable;\nvar getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;\n\n// Nashorn ~ JDK8 bug\nvar NASHORN_BUG = getOwnPropertyDescriptor && !nativePropertyIsEnumerable.call({ 1: 2 }, 1);\n\n// `Object.prototype.propertyIsEnumerable` method implementation\n// https://tc39.github.io/ecma262/#sec-object.prototype.propertyisenumerable\nexports.f = NASHORN_BUG ? function propertyIsEnumerable(V) {\n var descriptor = getOwnPropertyDescriptor(this, V);\n return !!descriptor && descriptor.enumerable;\n} : nativePropertyIsEnumerable;\n","module.exports = function (bitmap, value) {\n return {\n enumerable: !(bitmap & 1),\n configurable: !(bitmap & 2),\n writable: !(bitmap & 4),\n value: value\n };\n};\n","var toString = {}.toString;\n\nmodule.exports = function (it) {\n return toString.call(it).slice(8, -1);\n};\n","var fails = require('../internals/fails');\nvar classof = require('../internals/classof-raw');\n\nvar split = ''.split;\n\n// fallback for non-array-like ES3 and non-enumerable old V8 strings\nmodule.exports = fails(function () {\n // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346\n // eslint-disable-next-line no-prototype-builtins\n return !Object('z').propertyIsEnumerable(0);\n}) ? function (it) {\n return classof(it) == 'String' ? split.call(it, '') : Object(it);\n} : Object;\n","// `RequireObjectCoercible` abstract operation\n// https://tc39.github.io/ecma262/#sec-requireobjectcoercible\nmodule.exports = function (it) {\n if (it == undefined) throw TypeError(\"Can't call method on \" + it);\n return it;\n};\n","// toObject with fallback for non-array-like ES3 strings\nvar IndexedObject = require('../internals/indexed-object');\nvar requireObjectCoercible = require('../internals/require-object-coercible');\n\nmodule.exports = function (it) {\n return IndexedObject(requireObjectCoercible(it));\n};\n","module.exports = function (it) {\n return typeof it === 'object' ? it !== null : typeof it === 'function';\n};\n","var isObject = require('../internals/is-object');\n\n// `ToPrimitive` abstract operation\n// https://tc39.github.io/ecma262/#sec-toprimitive\n// instead of the ES6 spec version, we didn't implement @@toPrimitive case\n// and the second argument - flag - preferred type is a string\nmodule.exports = function (input, PREFERRED_STRING) {\n if (!isObject(input)) return input;\n var fn, val;\n if (PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;\n if (typeof (fn = input.valueOf) == 'function' && !isObject(val = fn.call(input))) return val;\n if (!PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;\n throw TypeError(\"Can't convert object to primitive value\");\n};\n","var hasOwnProperty = {}.hasOwnProperty;\n\nmodule.exports = function (it, key) {\n return hasOwnProperty.call(it, key);\n};\n","var global = require('../internals/global');\nvar isObject = require('../internals/is-object');\n\nvar document = global.document;\n// typeof document.createElement is 'object' in old IE\nvar EXISTS = isObject(document) && isObject(document.createElement);\n\nmodule.exports = function (it) {\n return EXISTS ? document.createElement(it) : {};\n};\n","var DESCRIPTORS = require('../internals/descriptors');\nvar fails = require('../internals/fails');\nvar createElement = require('../internals/document-create-element');\n\n// Thank's IE8 for his funny defineProperty\nmodule.exports = !DESCRIPTORS && !fails(function () {\n return Object.defineProperty(createElement('div'), 'a', {\n get: function () { return 7; }\n }).a != 7;\n});\n","var DESCRIPTORS = require('../internals/descriptors');\nvar propertyIsEnumerableModule = require('../internals/object-property-is-enumerable');\nvar createPropertyDescriptor = require('../internals/create-property-descriptor');\nvar toIndexedObject = require('../internals/to-indexed-object');\nvar toPrimitive = require('../internals/to-primitive');\nvar has = require('../internals/has');\nvar IE8_DOM_DEFINE = require('../internals/ie8-dom-define');\n\nvar nativeGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;\n\n// `Object.getOwnPropertyDescriptor` method\n// https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptor\nexports.f = DESCRIPTORS ? nativeGetOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {\n O = toIndexedObject(O);\n P = toPrimitive(P, true);\n if (IE8_DOM_DEFINE) try {\n return nativeGetOwnPropertyDescriptor(O, P);\n } catch (error) { /* empty */ }\n if (has(O, P)) return createPropertyDescriptor(!propertyIsEnumerableModule.f.call(O, P), O[P]);\n};\n","var isObject = require('../internals/is-object');\n\nmodule.exports = function (it) {\n if (!isObject(it)) {\n throw TypeError(String(it) + ' is not an object');\n } return it;\n};\n","var DESCRIPTORS = require('../internals/descriptors');\nvar IE8_DOM_DEFINE = require('../internals/ie8-dom-define');\nvar anObject = require('../internals/an-object');\nvar toPrimitive = require('../internals/to-primitive');\n\nvar nativeDefineProperty = Object.defineProperty;\n\n// `Object.defineProperty` method\n// https://tc39.github.io/ecma262/#sec-object.defineproperty\nexports.f = DESCRIPTORS ? nativeDefineProperty : function defineProperty(O, P, Attributes) {\n anObject(O);\n P = toPrimitive(P, true);\n anObject(Attributes);\n if (IE8_DOM_DEFINE) try {\n return nativeDefineProperty(O, P, Attributes);\n } catch (error) { /* empty */ }\n if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported');\n if ('value' in Attributes) O[P] = Attributes.value;\n return O;\n};\n","var DESCRIPTORS = require('../internals/descriptors');\nvar definePropertyModule = require('../internals/object-define-property');\nvar createPropertyDescriptor = require('../internals/create-property-descriptor');\n\nmodule.exports = DESCRIPTORS ? function (object, key, value) {\n return definePropertyModule.f(object, key, createPropertyDescriptor(1, value));\n} : function (object, key, value) {\n object[key] = value;\n return object;\n};\n","var global = require('../internals/global');\nvar createNonEnumerableProperty = require('../internals/create-non-enumerable-property');\n\nmodule.exports = function (key, value) {\n try {\n createNonEnumerableProperty(global, key, value);\n } catch (error) {\n global[key] = value;\n } return value;\n};\n","var global = require('../internals/global');\nvar setGlobal = require('../internals/set-global');\n\nvar SHARED = '__core-js_shared__';\nvar store = global[SHARED] || setGlobal(SHARED, {});\n\nmodule.exports = store;\n","var store = require('../internals/shared-store');\n\nvar functionToString = Function.toString;\n\n// this helper broken in `3.4.1-3.4.4`, so we can't use `shared` helper\nif (typeof store.inspectSource != 'function') {\n store.inspectSource = function (it) {\n return functionToString.call(it);\n };\n}\n\nmodule.exports = store.inspectSource;\n","var NATIVE_WEAK_MAP = require('../internals/native-weak-map');\nvar global = require('../internals/global');\nvar isObject = require('../internals/is-object');\nvar createNonEnumerableProperty = require('../internals/create-non-enumerable-property');\nvar objectHas = require('../internals/has');\nvar sharedKey = require('../internals/shared-key');\nvar hiddenKeys = require('../internals/hidden-keys');\n\nvar WeakMap = global.WeakMap;\nvar set, get, has;\n\nvar enforce = function (it) {\n return has(it) ? get(it) : set(it, {});\n};\n\nvar getterFor = function (TYPE) {\n return function (it) {\n var state;\n if (!isObject(it) || (state = get(it)).type !== TYPE) {\n throw TypeError('Incompatible receiver, ' + TYPE + ' required');\n } return state;\n };\n};\n\nif (NATIVE_WEAK_MAP) {\n var store = new WeakMap();\n var wmget = store.get;\n var wmhas = store.has;\n var wmset = store.set;\n set = function (it, metadata) {\n wmset.call(store, it, metadata);\n return metadata;\n };\n get = function (it) {\n return wmget.call(store, it) || {};\n };\n has = function (it) {\n return wmhas.call(store, it);\n };\n} else {\n var STATE = sharedKey('state');\n hiddenKeys[STATE] = true;\n set = function (it, metadata) {\n createNonEnumerableProperty(it, STATE, metadata);\n return metadata;\n };\n get = function (it) {\n return objectHas(it, STATE) ? it[STATE] : {};\n };\n has = function (it) {\n return objectHas(it, STATE);\n };\n}\n\nmodule.exports = {\n set: set,\n get: get,\n has: has,\n enforce: enforce,\n getterFor: getterFor\n};\n","var global = require('../internals/global');\nvar inspectSource = require('../internals/inspect-source');\n\nvar WeakMap = global.WeakMap;\n\nmodule.exports = typeof WeakMap === 'function' && /native code/.test(inspectSource(WeakMap));\n","var IS_PURE = require('../internals/is-pure');\nvar store = require('../internals/shared-store');\n\n(module.exports = function (key, value) {\n return store[key] || (store[key] = value !== undefined ? value : {});\n})('versions', []).push({\n version: '3.6.5',\n mode: IS_PURE ? 'pure' : 'global',\n copyright: '© 2020 Denis Pushkarev (zloirock.ru)'\n});\n","var id = 0;\nvar postfix = Math.random();\n\nmodule.exports = function (key) {\n return 'Symbol(' + String(key === undefined ? '' : key) + ')_' + (++id + postfix).toString(36);\n};\n","var shared = require('../internals/shared');\nvar uid = require('../internals/uid');\n\nvar keys = shared('keys');\n\nmodule.exports = function (key) {\n return keys[key] || (keys[key] = uid(key));\n};\n","module.exports = {};\n","var anObject = require('../internals/an-object');\nvar defineProperties = require('../internals/object-define-properties');\nvar enumBugKeys = require('../internals/enum-bug-keys');\nvar hiddenKeys = require('../internals/hidden-keys');\nvar html = require('../internals/html');\nvar documentCreateElement = require('../internals/document-create-element');\nvar sharedKey = require('../internals/shared-key');\n\nvar GT = '>';\nvar LT = '<';\nvar PROTOTYPE = 'prototype';\nvar SCRIPT = 'script';\nvar IE_PROTO = sharedKey('IE_PROTO');\n\nvar EmptyConstructor = function () { /* empty */ };\n\nvar scriptTag = function (content) {\n return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;\n};\n\n// Create object with fake `null` prototype: use ActiveX Object with cleared prototype\nvar NullProtoObjectViaActiveX = function (activeXDocument) {\n activeXDocument.write(scriptTag(''));\n activeXDocument.close();\n var temp = activeXDocument.parentWindow.Object;\n activeXDocument = null; // avoid memory leak\n return temp;\n};\n\n// Create object with fake `null` prototype: use iframe Object with cleared prototype\nvar NullProtoObjectViaIFrame = function () {\n // Thrash, waste and sodomy: IE GC bug\n var iframe = documentCreateElement('iframe');\n var JS = 'java' + SCRIPT + ':';\n var iframeDocument;\n iframe.style.display = 'none';\n html.appendChild(iframe);\n // https://github.com/zloirock/core-js/issues/475\n iframe.src = String(JS);\n iframeDocument = iframe.contentWindow.document;\n iframeDocument.open();\n iframeDocument.write(scriptTag('document.F=Object'));\n iframeDocument.close();\n return iframeDocument.F;\n};\n\n// Check for document.domain and active x support\n// No need to use active x approach when document.domain is not set\n// see https://github.com/es-shims/es5-shim/issues/150\n// variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346\n// avoid IE GC bug\nvar activeXDocument;\nvar NullProtoObject = function () {\n try {\n /* global ActiveXObject */\n activeXDocument = document.domain && new ActiveXObject('htmlfile');\n } catch (error) { /* ignore */ }\n NullProtoObject = activeXDocument ? NullProtoObjectViaActiveX(activeXDocument) : NullProtoObjectViaIFrame();\n var length = enumBugKeys.length;\n while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];\n return NullProtoObject();\n};\n\nhiddenKeys[IE_PROTO] = true;\n\n// `Object.create` method\n// https://tc39.github.io/ecma262/#sec-object.create\nmodule.exports = Object.create || function create(O, Properties) {\n var result;\n if (O !== null) {\n EmptyConstructor[PROTOTYPE] = anObject(O);\n result = new EmptyConstructor();\n EmptyConstructor[PROTOTYPE] = null;\n // add \"__proto__\" for Object.getPrototypeOf polyfill\n result[IE_PROTO] = O;\n } else result = NullProtoObject();\n return Properties === undefined ? result : defineProperties(result, Properties);\n};\n","var global = require('../internals/global');\nvar createNonEnumerableProperty = require('../internals/create-non-enumerable-property');\nvar has = require('../internals/has');\nvar setGlobal = require('../internals/set-global');\nvar inspectSource = require('../internals/inspect-source');\nvar InternalStateModule = require('../internals/internal-state');\n\nvar getInternalState = InternalStateModule.get;\nvar enforceInternalState = InternalStateModule.enforce;\nvar TEMPLATE = String(String).split('String');\n\n(module.exports = function (O, key, value, options) {\n var unsafe = options ? !!options.unsafe : false;\n var simple = options ? !!options.enumerable : false;\n var noTargetGet = options ? !!options.noTargetGet : false;\n if (typeof value == 'function') {\n if (typeof key == 'string' && !has(value, 'name')) createNonEnumerableProperty(value, 'name', key);\n enforceInternalState(value).source = TEMPLATE.join(typeof key == 'string' ? key : '');\n }\n if (O === global) {\n if (simple) O[key] = value;\n else setGlobal(key, value);\n return;\n } else if (!unsafe) {\n delete O[key];\n } else if (!noTargetGet && O[key]) {\n simple = true;\n }\n if (simple) O[key] = value;\n else createNonEnumerableProperty(O, key, value);\n// add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative\n})(Function.prototype, 'toString', function toString() {\n return typeof this == 'function' && getInternalState(this).source || inspectSource(this);\n});\n","var global = require('../internals/global');\n\nmodule.exports = global;\n","var path = require('../internals/path');\nvar global = require('../internals/global');\n\nvar aFunction = function (variable) {\n return typeof variable == 'function' ? variable : undefined;\n};\n\nmodule.exports = function (namespace, method) {\n return arguments.length < 2 ? aFunction(path[namespace]) || aFunction(global[namespace])\n : path[namespace] && path[namespace][method] || global[namespace] && global[namespace][method];\n};\n","var ceil = Math.ceil;\nvar floor = Math.floor;\n\n// `ToInteger` abstract operation\n// https://tc39.github.io/ecma262/#sec-tointeger\nmodule.exports = function (argument) {\n return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor : ceil)(argument);\n};\n","var toInteger = require('../internals/to-integer');\n\nvar min = Math.min;\n\n// `ToLength` abstract operation\n// https://tc39.github.io/ecma262/#sec-tolength\nmodule.exports = function (argument) {\n return argument > 0 ? min(toInteger(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991\n};\n","var toInteger = require('../internals/to-integer');\n\nvar max = Math.max;\nvar min = Math.min;\n\n// Helper for a popular repeating case of the spec:\n// Let integer be ? ToInteger(index).\n// If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).\nmodule.exports = function (index, length) {\n var integer = toInteger(index);\n return integer < 0 ? max(integer + length, 0) : min(integer, length);\n};\n","var toIndexedObject = require('../internals/to-indexed-object');\nvar toLength = require('../internals/to-length');\nvar toAbsoluteIndex = require('../internals/to-absolute-index');\n\n// `Array.prototype.{ indexOf, includes }` methods implementation\nvar createMethod = function (IS_INCLUDES) {\n return function ($this, el, fromIndex) {\n var O = toIndexedObject($this);\n var length = toLength(O.length);\n var index = toAbsoluteIndex(fromIndex, length);\n var value;\n // Array#includes uses SameValueZero equality algorithm\n // eslint-disable-next-line no-self-compare\n if (IS_INCLUDES && el != el) while (length > index) {\n value = O[index++];\n // eslint-disable-next-line no-self-compare\n if (value != value) return true;\n // Array#indexOf ignores holes, Array#includes - not\n } else for (;length > index; index++) {\n if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;\n } return !IS_INCLUDES && -1;\n };\n};\n\nmodule.exports = {\n // `Array.prototype.includes` method\n // https://tc39.github.io/ecma262/#sec-array.prototype.includes\n includes: createMethod(true),\n // `Array.prototype.indexOf` method\n // https://tc39.github.io/ecma262/#sec-array.prototype.indexof\n indexOf: createMethod(false)\n};\n","var has = require('../internals/has');\nvar toIndexedObject = require('../internals/to-indexed-object');\nvar indexOf = require('../internals/array-includes').indexOf;\nvar hiddenKeys = require('../internals/hidden-keys');\n\nmodule.exports = function (object, names) {\n var O = toIndexedObject(object);\n var i = 0;\n var result = [];\n var key;\n for (key in O) !has(hiddenKeys, key) && has(O, key) && result.push(key);\n // Don't enum bug & hidden keys\n while (names.length > i) if (has(O, key = names[i++])) {\n ~indexOf(result, key) || result.push(key);\n }\n return result;\n};\n","// IE8- don't enum bug keys\nmodule.exports = [\n 'constructor',\n 'hasOwnProperty',\n 'isPrototypeOf',\n 'propertyIsEnumerable',\n 'toLocaleString',\n 'toString',\n 'valueOf'\n];\n","var internalObjectKeys = require('../internals/object-keys-internal');\nvar enumBugKeys = require('../internals/enum-bug-keys');\n\nvar hiddenKeys = enumBugKeys.concat('length', 'prototype');\n\n// `Object.getOwnPropertyNames` method\n// https://tc39.github.io/ecma262/#sec-object.getownpropertynames\nexports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {\n return internalObjectKeys(O, hiddenKeys);\n};\n","exports.f = Object.getOwnPropertySymbols;\n","var getBuiltIn = require('../internals/get-built-in');\nvar getOwnPropertyNamesModule = require('../internals/object-get-own-property-names');\nvar getOwnPropertySymbolsModule = require('../internals/object-get-own-property-symbols');\nvar anObject = require('../internals/an-object');\n\n// all object keys, includes non-enumerable and symbols\nmodule.exports = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {\n var keys = getOwnPropertyNamesModule.f(anObject(it));\n var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;\n return getOwnPropertySymbols ? keys.concat(getOwnPropertySymbols(it)) : keys;\n};\n","var has = require('../internals/has');\nvar ownKeys = require('../internals/own-keys');\nvar getOwnPropertyDescriptorModule = require('../internals/object-get-own-property-descriptor');\nvar definePropertyModule = require('../internals/object-define-property');\n\nmodule.exports = function (target, source) {\n var keys = ownKeys(source);\n var defineProperty = definePropertyModule.f;\n var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;\n for (var i = 0; i < keys.length; i++) {\n var key = keys[i];\n if (!has(target, key)) defineProperty(target, key, getOwnPropertyDescriptor(source, key));\n }\n};\n","var fails = require('../internals/fails');\n\nvar replacement = /#|\\.prototype\\./;\n\nvar isForced = function (feature, detection) {\n var value = data[normalize(feature)];\n return value == POLYFILL ? true\n : value == NATIVE ? false\n : typeof detection == 'function' ? fails(detection)\n : !!detection;\n};\n\nvar normalize = isForced.normalize = function (string) {\n return String(string).replace(replacement, '.').toLowerCase();\n};\n\nvar data = isForced.data = {};\nvar NATIVE = isForced.NATIVE = 'N';\nvar POLYFILL = isForced.POLYFILL = 'P';\n\nmodule.exports = isForced;\n","var global = require('../internals/global');\nvar getOwnPropertyDescriptor = require('../internals/object-get-own-property-descriptor').f;\nvar createNonEnumerableProperty = require('../internals/create-non-enumerable-property');\nvar redefine = require('../internals/redefine');\nvar setGlobal = require('../internals/set-global');\nvar copyConstructorProperties = require('../internals/copy-constructor-properties');\nvar isForced = require('../internals/is-forced');\n\n/*\n options.target - name of the target object\n options.global - target is the global object\n options.stat - export as static methods of target\n options.proto - export as prototype methods of target\n options.real - real prototype method for the `pure` version\n options.forced - export even if the native feature is available\n options.bind - bind methods to the target, required for the `pure` version\n options.wrap - wrap constructors to preventing global pollution, required for the `pure` version\n options.unsafe - use the simple assignment of property instead of delete + defineProperty\n options.sham - add a flag to not completely full polyfills\n options.enumerable - export as enumerable property\n options.noTargetGet - prevent calling a getter on target\n*/\nmodule.exports = function (options, source) {\n var TARGET = options.target;\n var GLOBAL = options.global;\n var STATIC = options.stat;\n var FORCED, target, key, targetProperty, sourceProperty, descriptor;\n if (GLOBAL) {\n target = global;\n } else if (STATIC) {\n target = global[TARGET] || setGlobal(TARGET, {});\n } else {\n target = (global[TARGET] || {}).prototype;\n }\n if (target) for (key in source) {\n sourceProperty = source[key];\n if (options.noTargetGet) {\n descriptor = getOwnPropertyDescriptor(target, key);\n targetProperty = descriptor && descriptor.value;\n } else targetProperty = target[key];\n FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);\n // contained in target\n if (!FORCED && targetProperty !== undefined) {\n if (typeof sourceProperty === typeof targetProperty) continue;\n copyConstructorProperties(sourceProperty, targetProperty);\n }\n // add a flag to not completely full polyfills\n if (options.sham || (targetProperty && targetProperty.sham)) {\n createNonEnumerableProperty(sourceProperty, 'sham', true);\n }\n // extend global\n redefine(target, key, sourceProperty, options);\n }\n};\n","var fails = require('../internals/fails');\n\nmodule.exports = !!Object.getOwnPropertySymbols && !fails(function () {\n // Chrome 38 Symbol has incorrect toString conversion\n // eslint-disable-next-line no-undef\n return !String(Symbol());\n});\n","var NATIVE_SYMBOL = require('../internals/native-symbol');\n\nmodule.exports = NATIVE_SYMBOL\n // eslint-disable-next-line no-undef\n && !Symbol.sham\n // eslint-disable-next-line no-undef\n && typeof Symbol.iterator == 'symbol';\n","var classof = require('../internals/classof-raw');\n\n// `IsArray` abstract operation\n// https://tc39.github.io/ecma262/#sec-isarray\nmodule.exports = Array.isArray || function isArray(arg) {\n return classof(arg) == 'Array';\n};\n","var requireObjectCoercible = require('../internals/require-object-coercible');\n\n// `ToObject` abstract operation\n// https://tc39.github.io/ecma262/#sec-toobject\nmodule.exports = function (argument) {\n return Object(requireObjectCoercible(argument));\n};\n","var internalObjectKeys = require('../internals/object-keys-internal');\nvar enumBugKeys = require('../internals/enum-bug-keys');\n\n// `Object.keys` method\n// https://tc39.github.io/ecma262/#sec-object.keys\nmodule.exports = Object.keys || function keys(O) {\n return internalObjectKeys(O, enumBugKeys);\n};\n","var DESCRIPTORS = require('../internals/descriptors');\nvar definePropertyModule = require('../internals/object-define-property');\nvar anObject = require('../internals/an-object');\nvar objectKeys = require('../internals/object-keys');\n\n// `Object.defineProperties` method\n// https://tc39.github.io/ecma262/#sec-object.defineproperties\nmodule.exports = DESCRIPTORS ? Object.defineProperties : function defineProperties(O, Properties) {\n anObject(O);\n var keys = objectKeys(Properties);\n var length = keys.length;\n var index = 0;\n var key;\n while (length > index) definePropertyModule.f(O, key = keys[index++], Properties[key]);\n return O;\n};\n","var getBuiltIn = require('../internals/get-built-in');\n\nmodule.exports = getBuiltIn('document', 'documentElement');\n","var toIndexedObject = require('../internals/to-indexed-object');\nvar nativeGetOwnPropertyNames = require('../internals/object-get-own-property-names').f;\n\nvar toString = {}.toString;\n\nvar windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames\n ? Object.getOwnPropertyNames(window) : [];\n\nvar getWindowNames = function (it) {\n try {\n return nativeGetOwnPropertyNames(it);\n } catch (error) {\n return windowNames.slice();\n }\n};\n\n// fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window\nmodule.exports.f = function getOwnPropertyNames(it) {\n return windowNames && toString.call(it) == '[object Window]'\n ? getWindowNames(it)\n : nativeGetOwnPropertyNames(toIndexedObject(it));\n};\n","var global = require('../internals/global');\nvar shared = require('../internals/shared');\nvar has = require('../internals/has');\nvar uid = require('../internals/uid');\nvar NATIVE_SYMBOL = require('../internals/native-symbol');\nvar USE_SYMBOL_AS_UID = require('../internals/use-symbol-as-uid');\n\nvar WellKnownSymbolsStore = shared('wks');\nvar Symbol = global.Symbol;\nvar createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol : Symbol && Symbol.withoutSetter || uid;\n\nmodule.exports = function (name) {\n if (!has(WellKnownSymbolsStore, name)) {\n if (NATIVE_SYMBOL && has(Symbol, name)) WellKnownSymbolsStore[name] = Symbol[name];\n else WellKnownSymbolsStore[name] = createWellKnownSymbol('Symbol.' + name);\n } return WellKnownSymbolsStore[name];\n};\n","var wellKnownSymbol = require('../internals/well-known-symbol');\n\nexports.f = wellKnownSymbol;\n","var path = require('../internals/path');\nvar has = require('../internals/has');\nvar wrappedWellKnownSymbolModule = require('../internals/well-known-symbol-wrapped');\nvar defineProperty = require('../internals/object-define-property').f;\n\nmodule.exports = function (NAME) {\n var Symbol = path.Symbol || (path.Symbol = {});\n if (!has(Symbol, NAME)) defineProperty(Symbol, NAME, {\n value: wrappedWellKnownSymbolModule.f(NAME)\n });\n};\n","var defineProperty = require('../internals/object-define-property').f;\nvar has = require('../internals/has');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\n\nvar TO_STRING_TAG = wellKnownSymbol('toStringTag');\n\nmodule.exports = function (it, TAG, STATIC) {\n if (it && !has(it = STATIC ? it : it.prototype, TO_STRING_TAG)) {\n defineProperty(it, TO_STRING_TAG, { configurable: true, value: TAG });\n }\n};\n","module.exports = function (it) {\n if (typeof it != 'function') {\n throw TypeError(String(it) + ' is not a function');\n } return it;\n};\n","var aFunction = require('../internals/a-function');\n\n// optional / simple context binding\nmodule.exports = function (fn, that, length) {\n aFunction(fn);\n if (that === undefined) return fn;\n switch (length) {\n case 0: return function () {\n return fn.call(that);\n };\n case 1: return function (a) {\n return fn.call(that, a);\n };\n case 2: return function (a, b) {\n return fn.call(that, a, b);\n };\n case 3: return function (a, b, c) {\n return fn.call(that, a, b, c);\n };\n }\n return function (/* ...args */) {\n return fn.apply(that, arguments);\n };\n};\n","var isObject = require('../internals/is-object');\nvar isArray = require('../internals/is-array');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\n\nvar SPECIES = wellKnownSymbol('species');\n\n// `ArraySpeciesCreate` abstract operation\n// https://tc39.github.io/ecma262/#sec-arrayspeciescreate\nmodule.exports = function (originalArray, length) {\n var C;\n if (isArray(originalArray)) {\n C = originalArray.constructor;\n // cross-realm fallback\n if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined;\n else if (isObject(C)) {\n C = C[SPECIES];\n if (C === null) C = undefined;\n }\n } return new (C === undefined ? Array : C)(length === 0 ? 0 : length);\n};\n","var bind = require('../internals/function-bind-context');\nvar IndexedObject = require('../internals/indexed-object');\nvar toObject = require('../internals/to-object');\nvar toLength = require('../internals/to-length');\nvar arraySpeciesCreate = require('../internals/array-species-create');\n\nvar push = [].push;\n\n// `Array.prototype.{ forEach, map, filter, some, every, find, findIndex }` methods implementation\nvar createMethod = function (TYPE) {\n var IS_MAP = TYPE == 1;\n var IS_FILTER = TYPE == 2;\n var IS_SOME = TYPE == 3;\n var IS_EVERY = TYPE == 4;\n var IS_FIND_INDEX = TYPE == 6;\n var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;\n return function ($this, callbackfn, that, specificCreate) {\n var O = toObject($this);\n var self = IndexedObject(O);\n var boundFunction = bind(callbackfn, that, 3);\n var length = toLength(self.length);\n var index = 0;\n var create = specificCreate || arraySpeciesCreate;\n var target = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined;\n var value, result;\n for (;length > index; index++) if (NO_HOLES || index in self) {\n value = self[index];\n result = boundFunction(value, index, O);\n if (TYPE) {\n if (IS_MAP) target[index] = result; // map\n else if (result) switch (TYPE) {\n case 3: return true; // some\n case 5: return value; // find\n case 6: return index; // findIndex\n case 2: push.call(target, value); // filter\n } else if (IS_EVERY) return false; // every\n }\n }\n return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target;\n };\n};\n\nmodule.exports = {\n // `Array.prototype.forEach` method\n // https://tc39.github.io/ecma262/#sec-array.prototype.foreach\n forEach: createMethod(0),\n // `Array.prototype.map` method\n // https://tc39.github.io/ecma262/#sec-array.prototype.map\n map: createMethod(1),\n // `Array.prototype.filter` method\n // https://tc39.github.io/ecma262/#sec-array.prototype.filter\n filter: createMethod(2),\n // `Array.prototype.some` method\n // https://tc39.github.io/ecma262/#sec-array.prototype.some\n some: createMethod(3),\n // `Array.prototype.every` method\n // https://tc39.github.io/ecma262/#sec-array.prototype.every\n every: createMethod(4),\n // `Array.prototype.find` method\n // https://tc39.github.io/ecma262/#sec-array.prototype.find\n find: createMethod(5),\n // `Array.prototype.findIndex` method\n // https://tc39.github.io/ecma262/#sec-array.prototype.findIndex\n findIndex: createMethod(6)\n};\n","'use strict';\nvar $ = require('../internals/export');\nvar global = require('../internals/global');\nvar getBuiltIn = require('../internals/get-built-in');\nvar IS_PURE = require('../internals/is-pure');\nvar DESCRIPTORS = require('../internals/descriptors');\nvar NATIVE_SYMBOL = require('../internals/native-symbol');\nvar USE_SYMBOL_AS_UID = require('../internals/use-symbol-as-uid');\nvar fails = require('../internals/fails');\nvar has = require('../internals/has');\nvar isArray = require('../internals/is-array');\nvar isObject = require('../internals/is-object');\nvar anObject = require('../internals/an-object');\nvar toObject = require('../internals/to-object');\nvar toIndexedObject = require('../internals/to-indexed-object');\nvar toPrimitive = require('../internals/to-primitive');\nvar createPropertyDescriptor = require('../internals/create-property-descriptor');\nvar nativeObjectCreate = require('../internals/object-create');\nvar objectKeys = require('../internals/object-keys');\nvar getOwnPropertyNamesModule = require('../internals/object-get-own-property-names');\nvar getOwnPropertyNamesExternal = require('../internals/object-get-own-property-names-external');\nvar getOwnPropertySymbolsModule = require('../internals/object-get-own-property-symbols');\nvar getOwnPropertyDescriptorModule = require('../internals/object-get-own-property-descriptor');\nvar definePropertyModule = require('../internals/object-define-property');\nvar propertyIsEnumerableModule = require('../internals/object-property-is-enumerable');\nvar createNonEnumerableProperty = require('../internals/create-non-enumerable-property');\nvar redefine = require('../internals/redefine');\nvar shared = require('../internals/shared');\nvar sharedKey = require('../internals/shared-key');\nvar hiddenKeys = require('../internals/hidden-keys');\nvar uid = require('../internals/uid');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\nvar wrappedWellKnownSymbolModule = require('../internals/well-known-symbol-wrapped');\nvar defineWellKnownSymbol = require('../internals/define-well-known-symbol');\nvar setToStringTag = require('../internals/set-to-string-tag');\nvar InternalStateModule = require('../internals/internal-state');\nvar $forEach = require('../internals/array-iteration').forEach;\n\nvar HIDDEN = sharedKey('hidden');\nvar SYMBOL = 'Symbol';\nvar PROTOTYPE = 'prototype';\nvar TO_PRIMITIVE = wellKnownSymbol('toPrimitive');\nvar setInternalState = InternalStateModule.set;\nvar getInternalState = InternalStateModule.getterFor(SYMBOL);\nvar ObjectPrototype = Object[PROTOTYPE];\nvar $Symbol = global.Symbol;\nvar $stringify = getBuiltIn('JSON', 'stringify');\nvar nativeGetOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;\nvar nativeDefineProperty = definePropertyModule.f;\nvar nativeGetOwnPropertyNames = getOwnPropertyNamesExternal.f;\nvar nativePropertyIsEnumerable = propertyIsEnumerableModule.f;\nvar AllSymbols = shared('symbols');\nvar ObjectPrototypeSymbols = shared('op-symbols');\nvar StringToSymbolRegistry = shared('string-to-symbol-registry');\nvar SymbolToStringRegistry = shared('symbol-to-string-registry');\nvar WellKnownSymbolsStore = shared('wks');\nvar QObject = global.QObject;\n// Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173\nvar USE_SETTER = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild;\n\n// fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687\nvar setSymbolDescriptor = DESCRIPTORS && fails(function () {\n return nativeObjectCreate(nativeDefineProperty({}, 'a', {\n get: function () { return nativeDefineProperty(this, 'a', { value: 7 }).a; }\n })).a != 7;\n}) ? function (O, P, Attributes) {\n var ObjectPrototypeDescriptor = nativeGetOwnPropertyDescriptor(ObjectPrototype, P);\n if (ObjectPrototypeDescriptor) delete ObjectPrototype[P];\n nativeDefineProperty(O, P, Attributes);\n if (ObjectPrototypeDescriptor && O !== ObjectPrototype) {\n nativeDefineProperty(ObjectPrototype, P, ObjectPrototypeDescriptor);\n }\n} : nativeDefineProperty;\n\nvar wrap = function (tag, description) {\n var symbol = AllSymbols[tag] = nativeObjectCreate($Symbol[PROTOTYPE]);\n setInternalState(symbol, {\n type: SYMBOL,\n tag: tag,\n description: description\n });\n if (!DESCRIPTORS) symbol.description = description;\n return symbol;\n};\n\nvar isSymbol = USE_SYMBOL_AS_UID ? function (it) {\n return typeof it == 'symbol';\n} : function (it) {\n return Object(it) instanceof $Symbol;\n};\n\nvar $defineProperty = function defineProperty(O, P, Attributes) {\n if (O === ObjectPrototype) $defineProperty(ObjectPrototypeSymbols, P, Attributes);\n anObject(O);\n var key = toPrimitive(P, true);\n anObject(Attributes);\n if (has(AllSymbols, key)) {\n if (!Attributes.enumerable) {\n if (!has(O, HIDDEN)) nativeDefineProperty(O, HIDDEN, createPropertyDescriptor(1, {}));\n O[HIDDEN][key] = true;\n } else {\n if (has(O, HIDDEN) && O[HIDDEN][key]) O[HIDDEN][key] = false;\n Attributes = nativeObjectCreate(Attributes, { enumerable: createPropertyDescriptor(0, false) });\n } return setSymbolDescriptor(O, key, Attributes);\n } return nativeDefineProperty(O, key, Attributes);\n};\n\nvar $defineProperties = function defineProperties(O, Properties) {\n anObject(O);\n var properties = toIndexedObject(Properties);\n var keys = objectKeys(properties).concat($getOwnPropertySymbols(properties));\n $forEach(keys, function (key) {\n if (!DESCRIPTORS || $propertyIsEnumerable.call(properties, key)) $defineProperty(O, key, properties[key]);\n });\n return O;\n};\n\nvar $create = function create(O, Properties) {\n return Properties === undefined ? nativeObjectCreate(O) : $defineProperties(nativeObjectCreate(O), Properties);\n};\n\nvar $propertyIsEnumerable = function propertyIsEnumerable(V) {\n var P = toPrimitive(V, true);\n var enumerable = nativePropertyIsEnumerable.call(this, P);\n if (this === ObjectPrototype && has(AllSymbols, P) && !has(ObjectPrototypeSymbols, P)) return false;\n return enumerable || !has(this, P) || !has(AllSymbols, P) || has(this, HIDDEN) && this[HIDDEN][P] ? enumerable : true;\n};\n\nvar $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(O, P) {\n var it = toIndexedObject(O);\n var key = toPrimitive(P, true);\n if (it === ObjectPrototype && has(AllSymbols, key) && !has(ObjectPrototypeSymbols, key)) return;\n var descriptor = nativeGetOwnPropertyDescriptor(it, key);\n if (descriptor && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key])) {\n descriptor.enumerable = true;\n }\n return descriptor;\n};\n\nvar $getOwnPropertyNames = function getOwnPropertyNames(O) {\n var names = nativeGetOwnPropertyNames(toIndexedObject(O));\n var result = [];\n $forEach(names, function (key) {\n if (!has(AllSymbols, key) && !has(hiddenKeys, key)) result.push(key);\n });\n return result;\n};\n\nvar $getOwnPropertySymbols = function getOwnPropertySymbols(O) {\n var IS_OBJECT_PROTOTYPE = O === ObjectPrototype;\n var names = nativeGetOwnPropertyNames(IS_OBJECT_PROTOTYPE ? ObjectPrototypeSymbols : toIndexedObject(O));\n var result = [];\n $forEach(names, function (key) {\n if (has(AllSymbols, key) && (!IS_OBJECT_PROTOTYPE || has(ObjectPrototype, key))) {\n result.push(AllSymbols[key]);\n }\n });\n return result;\n};\n\n// `Symbol` constructor\n// https://tc39.github.io/ecma262/#sec-symbol-constructor\nif (!NATIVE_SYMBOL) {\n $Symbol = function Symbol() {\n if (this instanceof $Symbol) throw TypeError('Symbol is not a constructor');\n var description = !arguments.length || arguments[0] === undefined ? undefined : String(arguments[0]);\n var tag = uid(description);\n var setter = function (value) {\n if (this === ObjectPrototype) setter.call(ObjectPrototypeSymbols, value);\n if (has(this, HIDDEN) && has(this[HIDDEN], tag)) this[HIDDEN][tag] = false;\n setSymbolDescriptor(this, tag, createPropertyDescriptor(1, value));\n };\n if (DESCRIPTORS && USE_SETTER) setSymbolDescriptor(ObjectPrototype, tag, { configurable: true, set: setter });\n return wrap(tag, description);\n };\n\n redefine($Symbol[PROTOTYPE], 'toString', function toString() {\n return getInternalState(this).tag;\n });\n\n redefine($Symbol, 'withoutSetter', function (description) {\n return wrap(uid(description), description);\n });\n\n propertyIsEnumerableModule.f = $propertyIsEnumerable;\n definePropertyModule.f = $defineProperty;\n getOwnPropertyDescriptorModule.f = $getOwnPropertyDescriptor;\n getOwnPropertyNamesModule.f = getOwnPropertyNamesExternal.f = $getOwnPropertyNames;\n getOwnPropertySymbolsModule.f = $getOwnPropertySymbols;\n\n wrappedWellKnownSymbolModule.f = function (name) {\n return wrap(wellKnownSymbol(name), name);\n };\n\n if (DESCRIPTORS) {\n // https://github.com/tc39/proposal-Symbol-description\n nativeDefineProperty($Symbol[PROTOTYPE], 'description', {\n configurable: true,\n get: function description() {\n return getInternalState(this).description;\n }\n });\n if (!IS_PURE) {\n redefine(ObjectPrototype, 'propertyIsEnumerable', $propertyIsEnumerable, { unsafe: true });\n }\n }\n}\n\n$({ global: true, wrap: true, forced: !NATIVE_SYMBOL, sham: !NATIVE_SYMBOL }, {\n Symbol: $Symbol\n});\n\n$forEach(objectKeys(WellKnownSymbolsStore), function (name) {\n defineWellKnownSymbol(name);\n});\n\n$({ target: SYMBOL, stat: true, forced: !NATIVE_SYMBOL }, {\n // `Symbol.for` method\n // https://tc39.github.io/ecma262/#sec-symbol.for\n 'for': function (key) {\n var string = String(key);\n if (has(StringToSymbolRegistry, string)) return StringToSymbolRegistry[string];\n var symbol = $Symbol(string);\n StringToSymbolRegistry[string] = symbol;\n SymbolToStringRegistry[symbol] = string;\n return symbol;\n },\n // `Symbol.keyFor` method\n // https://tc39.github.io/ecma262/#sec-symbol.keyfor\n keyFor: function keyFor(sym) {\n if (!isSymbol(sym)) throw TypeError(sym + ' is not a symbol');\n if (has(SymbolToStringRegistry, sym)) return SymbolToStringRegistry[sym];\n },\n useSetter: function () { USE_SETTER = true; },\n useSimple: function () { USE_SETTER = false; }\n});\n\n$({ target: 'Object', stat: true, forced: !NATIVE_SYMBOL, sham: !DESCRIPTORS }, {\n // `Object.create` method\n // https://tc39.github.io/ecma262/#sec-object.create\n create: $create,\n // `Object.defineProperty` method\n // https://tc39.github.io/ecma262/#sec-object.defineproperty\n defineProperty: $defineProperty,\n // `Object.defineProperties` method\n // https://tc39.github.io/ecma262/#sec-object.defineproperties\n defineProperties: $defineProperties,\n // `Object.getOwnPropertyDescriptor` method\n // https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptors\n getOwnPropertyDescriptor: $getOwnPropertyDescriptor\n});\n\n$({ target: 'Object', stat: true, forced: !NATIVE_SYMBOL }, {\n // `Object.getOwnPropertyNames` method\n // https://tc39.github.io/ecma262/#sec-object.getownpropertynames\n getOwnPropertyNames: $getOwnPropertyNames,\n // `Object.getOwnPropertySymbols` method\n // https://tc39.github.io/ecma262/#sec-object.getownpropertysymbols\n getOwnPropertySymbols: $getOwnPropertySymbols\n});\n\n// Chrome 38 and 39 `Object.getOwnPropertySymbols` fails on primitives\n// https://bugs.chromium.org/p/v8/issues/detail?id=3443\n$({ target: 'Object', stat: true, forced: fails(function () { getOwnPropertySymbolsModule.f(1); }) }, {\n getOwnPropertySymbols: function getOwnPropertySymbols(it) {\n return getOwnPropertySymbolsModule.f(toObject(it));\n }\n});\n\n// `JSON.stringify` method behavior with symbols\n// https://tc39.github.io/ecma262/#sec-json.stringify\nif ($stringify) {\n var FORCED_JSON_STRINGIFY = !NATIVE_SYMBOL || fails(function () {\n var symbol = $Symbol();\n // MS Edge converts symbol values to JSON as {}\n return $stringify([symbol]) != '[null]'\n // WebKit converts symbol values to JSON as null\n || $stringify({ a: symbol }) != '{}'\n // V8 throws on boxed symbols\n || $stringify(Object(symbol)) != '{}';\n });\n\n $({ target: 'JSON', stat: true, forced: FORCED_JSON_STRINGIFY }, {\n // eslint-disable-next-line no-unused-vars\n stringify: function stringify(it, replacer, space) {\n var args = [it];\n var index = 1;\n var $replacer;\n while (arguments.length > index) args.push(arguments[index++]);\n $replacer = replacer;\n if (!isObject(replacer) && it === undefined || isSymbol(it)) return; // IE8 returns string on undefined\n if (!isArray(replacer)) replacer = function (key, value) {\n if (typeof $replacer == 'function') value = $replacer.call(this, key, value);\n if (!isSymbol(value)) return value;\n };\n args[1] = replacer;\n return $stringify.apply(null, args);\n }\n });\n}\n\n// `Symbol.prototype[@@toPrimitive]` method\n// https://tc39.github.io/ecma262/#sec-symbol.prototype-@@toprimitive\nif (!$Symbol[PROTOTYPE][TO_PRIMITIVE]) {\n createNonEnumerableProperty($Symbol[PROTOTYPE], TO_PRIMITIVE, $Symbol[PROTOTYPE].valueOf);\n}\n// `Symbol.prototype[@@toStringTag]` property\n// https://tc39.github.io/ecma262/#sec-symbol.prototype-@@tostringtag\nsetToStringTag($Symbol, SYMBOL);\n\nhiddenKeys[HIDDEN] = true;\n","// `Symbol.prototype.description` getter\n// https://tc39.github.io/ecma262/#sec-symbol.prototype.description\n'use strict';\nvar $ = require('../internals/export');\nvar DESCRIPTORS = require('../internals/descriptors');\nvar global = require('../internals/global');\nvar has = require('../internals/has');\nvar isObject = require('../internals/is-object');\nvar defineProperty = require('../internals/object-define-property').f;\nvar copyConstructorProperties = require('../internals/copy-constructor-properties');\n\nvar NativeSymbol = global.Symbol;\n\nif (DESCRIPTORS && typeof NativeSymbol == 'function' && (!('description' in NativeSymbol.prototype) ||\n // Safari 12 bug\n NativeSymbol().description !== undefined\n)) {\n var EmptyStringDescriptionStore = {};\n // wrap Symbol constructor for correct work with undefined description\n var SymbolWrapper = function Symbol() {\n var description = arguments.length < 1 || arguments[0] === undefined ? undefined : String(arguments[0]);\n var result = this instanceof SymbolWrapper\n ? new NativeSymbol(description)\n // in Edge 13, String(Symbol(undefined)) === 'Symbol(undefined)'\n : description === undefined ? NativeSymbol() : NativeSymbol(description);\n if (description === '') EmptyStringDescriptionStore[result] = true;\n return result;\n };\n copyConstructorProperties(SymbolWrapper, NativeSymbol);\n var symbolPrototype = SymbolWrapper.prototype = NativeSymbol.prototype;\n symbolPrototype.constructor = SymbolWrapper;\n\n var symbolToString = symbolPrototype.toString;\n var native = String(NativeSymbol('test')) == 'Symbol(test)';\n var regexp = /^Symbol\\((.*)\\)[^)]+$/;\n defineProperty(symbolPrototype, 'description', {\n configurable: true,\n get: function description() {\n var symbol = isObject(this) ? this.valueOf() : this;\n var string = symbolToString.call(symbol);\n if (has(EmptyStringDescriptionStore, symbol)) return '';\n var desc = native ? string.slice(7, -1) : string.replace(regexp, '$1');\n return desc === '' ? undefined : desc;\n }\n });\n\n $({ global: true, forced: true }, {\n Symbol: SymbolWrapper\n });\n}\n","var defineWellKnownSymbol = require('../internals/define-well-known-symbol');\n\n// `Symbol.iterator` well-known symbol\n// https://tc39.github.io/ecma262/#sec-symbol.iterator\ndefineWellKnownSymbol('iterator');\n","'use strict';\nvar fails = require('../internals/fails');\n\nmodule.exports = function (METHOD_NAME, argument) {\n var method = [][METHOD_NAME];\n return !!method && fails(function () {\n // eslint-disable-next-line no-useless-call,no-throw-literal\n method.call(null, argument || function () { throw 1; }, 1);\n });\n};\n","var DESCRIPTORS = require('../internals/descriptors');\nvar fails = require('../internals/fails');\nvar has = require('../internals/has');\n\nvar defineProperty = Object.defineProperty;\nvar cache = {};\n\nvar thrower = function (it) { throw it; };\n\nmodule.exports = function (METHOD_NAME, options) {\n if (has(cache, METHOD_NAME)) return cache[METHOD_NAME];\n if (!options) options = {};\n var method = [][METHOD_NAME];\n var ACCESSORS = has(options, 'ACCESSORS') ? options.ACCESSORS : false;\n var argument0 = has(options, 0) ? options[0] : thrower;\n var argument1 = has(options, 1) ? options[1] : undefined;\n\n return cache[METHOD_NAME] = !!method && !fails(function () {\n if (ACCESSORS && !DESCRIPTORS) return true;\n var O = { length: -1 };\n\n if (ACCESSORS) defineProperty(O, 1, { enumerable: true, get: thrower });\n else O[1] = 1;\n\n method.call(O, argument0, argument1);\n });\n};\n","'use strict';\nvar $forEach = require('../internals/array-iteration').forEach;\nvar arrayMethodIsStrict = require('../internals/array-method-is-strict');\nvar arrayMethodUsesToLength = require('../internals/array-method-uses-to-length');\n\nvar STRICT_METHOD = arrayMethodIsStrict('forEach');\nvar USES_TO_LENGTH = arrayMethodUsesToLength('forEach');\n\n// `Array.prototype.forEach` method implementation\n// https://tc39.github.io/ecma262/#sec-array.prototype.foreach\nmodule.exports = (!STRICT_METHOD || !USES_TO_LENGTH) ? function forEach(callbackfn /* , thisArg */) {\n return $forEach(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);\n} : [].forEach;\n","'use strict';\nvar $ = require('../internals/export');\nvar forEach = require('../internals/array-for-each');\n\n// `Array.prototype.forEach` method\n// https://tc39.github.io/ecma262/#sec-array.prototype.foreach\n$({ target: 'Array', proto: true, forced: [].forEach != forEach }, {\n forEach: forEach\n});\n","'use strict';\nvar $ = require('../internals/export');\nvar $indexOf = require('../internals/array-includes').indexOf;\nvar arrayMethodIsStrict = require('../internals/array-method-is-strict');\nvar arrayMethodUsesToLength = require('../internals/array-method-uses-to-length');\n\nvar nativeIndexOf = [].indexOf;\n\nvar NEGATIVE_ZERO = !!nativeIndexOf && 1 / [1].indexOf(1, -0) < 0;\nvar STRICT_METHOD = arrayMethodIsStrict('indexOf');\nvar USES_TO_LENGTH = arrayMethodUsesToLength('indexOf', { ACCESSORS: true, 1: 0 });\n\n// `Array.prototype.indexOf` method\n// https://tc39.github.io/ecma262/#sec-array.prototype.indexof\n$({ target: 'Array', proto: true, forced: NEGATIVE_ZERO || !STRICT_METHOD || !USES_TO_LENGTH }, {\n indexOf: function indexOf(searchElement /* , fromIndex = 0 */) {\n return NEGATIVE_ZERO\n // convert -0 to +0\n ? nativeIndexOf.apply(this, arguments) || 0\n : $indexOf(this, searchElement, arguments.length > 1 ? arguments[1] : undefined);\n }\n});\n","var wellKnownSymbol = require('../internals/well-known-symbol');\nvar create = require('../internals/object-create');\nvar definePropertyModule = require('../internals/object-define-property');\n\nvar UNSCOPABLES = wellKnownSymbol('unscopables');\nvar ArrayPrototype = Array.prototype;\n\n// Array.prototype[@@unscopables]\n// https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables\nif (ArrayPrototype[UNSCOPABLES] == undefined) {\n definePropertyModule.f(ArrayPrototype, UNSCOPABLES, {\n configurable: true,\n value: create(null)\n });\n}\n\n// add a key to Array.prototype[@@unscopables]\nmodule.exports = function (key) {\n ArrayPrototype[UNSCOPABLES][key] = true;\n};\n","'use strict';\nvar getPrototypeOf = require('../internals/object-get-prototype-of');\nvar createNonEnumerableProperty = require('../internals/create-non-enumerable-property');\nvar has = require('../internals/has');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\nvar IS_PURE = require('../internals/is-pure');\n\nvar ITERATOR = wellKnownSymbol('iterator');\nvar BUGGY_SAFARI_ITERATORS = false;\n\nvar returnThis = function () { return this; };\n\n// `%IteratorPrototype%` object\n// https://tc39.github.io/ecma262/#sec-%iteratorprototype%-object\nvar IteratorPrototype, PrototypeOfArrayIteratorPrototype, arrayIterator;\n\nif ([].keys) {\n arrayIterator = [].keys();\n // Safari 8 has buggy iterators w/o `next`\n if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS = true;\n else {\n PrototypeOfArrayIteratorPrototype = getPrototypeOf(getPrototypeOf(arrayIterator));\n if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype = PrototypeOfArrayIteratorPrototype;\n }\n}\n\nif (IteratorPrototype == undefined) IteratorPrototype = {};\n\n// 25.1.2.1.1 %IteratorPrototype%[@@iterator]()\nif (!IS_PURE && !has(IteratorPrototype, ITERATOR)) {\n createNonEnumerableProperty(IteratorPrototype, ITERATOR, returnThis);\n}\n\nmodule.exports = {\n IteratorPrototype: IteratorPrototype,\n BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS\n};\n","module.exports = {};\n","var fails = require('../internals/fails');\n\nmodule.exports = !fails(function () {\n function F() { /* empty */ }\n F.prototype.constructor = null;\n return Object.getPrototypeOf(new F()) !== F.prototype;\n});\n","var has = require('../internals/has');\nvar toObject = require('../internals/to-object');\nvar sharedKey = require('../internals/shared-key');\nvar CORRECT_PROTOTYPE_GETTER = require('../internals/correct-prototype-getter');\n\nvar IE_PROTO = sharedKey('IE_PROTO');\nvar ObjectPrototype = Object.prototype;\n\n// `Object.getPrototypeOf` method\n// https://tc39.github.io/ecma262/#sec-object.getprototypeof\nmodule.exports = CORRECT_PROTOTYPE_GETTER ? Object.getPrototypeOf : function (O) {\n O = toObject(O);\n if (has(O, IE_PROTO)) return O[IE_PROTO];\n if (typeof O.constructor == 'function' && O instanceof O.constructor) {\n return O.constructor.prototype;\n } return O instanceof Object ? ObjectPrototype : null;\n};\n","'use strict';\nvar IteratorPrototype = require('../internals/iterators-core').IteratorPrototype;\nvar create = require('../internals/object-create');\nvar createPropertyDescriptor = require('../internals/create-property-descriptor');\nvar setToStringTag = require('../internals/set-to-string-tag');\nvar Iterators = require('../internals/iterators');\n\nvar returnThis = function () { return this; };\n\nmodule.exports = function (IteratorConstructor, NAME, next) {\n var TO_STRING_TAG = NAME + ' Iterator';\n IteratorConstructor.prototype = create(IteratorPrototype, { next: createPropertyDescriptor(1, next) });\n setToStringTag(IteratorConstructor, TO_STRING_TAG, false, true);\n Iterators[TO_STRING_TAG] = returnThis;\n return IteratorConstructor;\n};\n","var anObject = require('../internals/an-object');\nvar aPossiblePrototype = require('../internals/a-possible-prototype');\n\n// `Object.setPrototypeOf` method\n// https://tc39.github.io/ecma262/#sec-object.setprototypeof\n// Works with __proto__ only. Old v8 can't work with null proto objects.\n/* eslint-disable no-proto */\nmodule.exports = Object.setPrototypeOf || ('__proto__' in {} ? function () {\n var CORRECT_SETTER = false;\n var test = {};\n var setter;\n try {\n setter = Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set;\n setter.call(test, []);\n CORRECT_SETTER = test instanceof Array;\n } catch (error) { /* empty */ }\n return function setPrototypeOf(O, proto) {\n anObject(O);\n aPossiblePrototype(proto);\n if (CORRECT_SETTER) setter.call(O, proto);\n else O.__proto__ = proto;\n return O;\n };\n}() : undefined);\n","var isObject = require('../internals/is-object');\n\nmodule.exports = function (it) {\n if (!isObject(it) && it !== null) {\n throw TypeError(\"Can't set \" + String(it) + ' as a prototype');\n } return it;\n};\n","'use strict';\nvar $ = require('../internals/export');\nvar createIteratorConstructor = require('../internals/create-iterator-constructor');\nvar getPrototypeOf = require('../internals/object-get-prototype-of');\nvar setPrototypeOf = require('../internals/object-set-prototype-of');\nvar setToStringTag = require('../internals/set-to-string-tag');\nvar createNonEnumerableProperty = require('../internals/create-non-enumerable-property');\nvar redefine = require('../internals/redefine');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\nvar IS_PURE = require('../internals/is-pure');\nvar Iterators = require('../internals/iterators');\nvar IteratorsCore = require('../internals/iterators-core');\n\nvar IteratorPrototype = IteratorsCore.IteratorPrototype;\nvar BUGGY_SAFARI_ITERATORS = IteratorsCore.BUGGY_SAFARI_ITERATORS;\nvar ITERATOR = wellKnownSymbol('iterator');\nvar KEYS = 'keys';\nvar VALUES = 'values';\nvar ENTRIES = 'entries';\n\nvar returnThis = function () { return this; };\n\nmodule.exports = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) {\n createIteratorConstructor(IteratorConstructor, NAME, next);\n\n var getIterationMethod = function (KIND) {\n if (KIND === DEFAULT && defaultIterator) return defaultIterator;\n if (!BUGGY_SAFARI_ITERATORS && KIND in IterablePrototype) return IterablePrototype[KIND];\n switch (KIND) {\n case KEYS: return function keys() { return new IteratorConstructor(this, KIND); };\n case VALUES: return function values() { return new IteratorConstructor(this, KIND); };\n case ENTRIES: return function entries() { return new IteratorConstructor(this, KIND); };\n } return function () { return new IteratorConstructor(this); };\n };\n\n var TO_STRING_TAG = NAME + ' Iterator';\n var INCORRECT_VALUES_NAME = false;\n var IterablePrototype = Iterable.prototype;\n var nativeIterator = IterablePrototype[ITERATOR]\n || IterablePrototype['@@iterator']\n || DEFAULT && IterablePrototype[DEFAULT];\n var defaultIterator = !BUGGY_SAFARI_ITERATORS && nativeIterator || getIterationMethod(DEFAULT);\n var anyNativeIterator = NAME == 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator;\n var CurrentIteratorPrototype, methods, KEY;\n\n // fix native\n if (anyNativeIterator) {\n CurrentIteratorPrototype = getPrototypeOf(anyNativeIterator.call(new Iterable()));\n if (IteratorPrototype !== Object.prototype && CurrentIteratorPrototype.next) {\n if (!IS_PURE && getPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype) {\n if (setPrototypeOf) {\n setPrototypeOf(CurrentIteratorPrototype, IteratorPrototype);\n } else if (typeof CurrentIteratorPrototype[ITERATOR] != 'function') {\n createNonEnumerableProperty(CurrentIteratorPrototype, ITERATOR, returnThis);\n }\n }\n // Set @@toStringTag to native iterators\n setToStringTag(CurrentIteratorPrototype, TO_STRING_TAG, true, true);\n if (IS_PURE) Iterators[TO_STRING_TAG] = returnThis;\n }\n }\n\n // fix Array#{values, @@iterator}.name in V8 / FF\n if (DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES) {\n INCORRECT_VALUES_NAME = true;\n defaultIterator = function values() { return nativeIterator.call(this); };\n }\n\n // define iterator\n if ((!IS_PURE || FORCED) && IterablePrototype[ITERATOR] !== defaultIterator) {\n createNonEnumerableProperty(IterablePrototype, ITERATOR, defaultIterator);\n }\n Iterators[NAME] = defaultIterator;\n\n // export additional methods\n if (DEFAULT) {\n methods = {\n values: getIterationMethod(VALUES),\n keys: IS_SET ? defaultIterator : getIterationMethod(KEYS),\n entries: getIterationMethod(ENTRIES)\n };\n if (FORCED) for (KEY in methods) {\n if (BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) {\n redefine(IterablePrototype, KEY, methods[KEY]);\n }\n } else $({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME }, methods);\n }\n\n return methods;\n};\n","'use strict';\nvar toIndexedObject = require('../internals/to-indexed-object');\nvar addToUnscopables = require('../internals/add-to-unscopables');\nvar Iterators = require('../internals/iterators');\nvar InternalStateModule = require('../internals/internal-state');\nvar defineIterator = require('../internals/define-iterator');\n\nvar ARRAY_ITERATOR = 'Array Iterator';\nvar setInternalState = InternalStateModule.set;\nvar getInternalState = InternalStateModule.getterFor(ARRAY_ITERATOR);\n\n// `Array.prototype.entries` method\n// https://tc39.github.io/ecma262/#sec-array.prototype.entries\n// `Array.prototype.keys` method\n// https://tc39.github.io/ecma262/#sec-array.prototype.keys\n// `Array.prototype.values` method\n// https://tc39.github.io/ecma262/#sec-array.prototype.values\n// `Array.prototype[@@iterator]` method\n// https://tc39.github.io/ecma262/#sec-array.prototype-@@iterator\n// `CreateArrayIterator` internal method\n// https://tc39.github.io/ecma262/#sec-createarrayiterator\nmodule.exports = defineIterator(Array, 'Array', function (iterated, kind) {\n setInternalState(this, {\n type: ARRAY_ITERATOR,\n target: toIndexedObject(iterated), // target\n index: 0, // next index\n kind: kind // kind\n });\n// `%ArrayIteratorPrototype%.next` method\n// https://tc39.github.io/ecma262/#sec-%arrayiteratorprototype%.next\n}, function () {\n var state = getInternalState(this);\n var target = state.target;\n var kind = state.kind;\n var index = state.index++;\n if (!target || index >= target.length) {\n state.target = undefined;\n return { value: undefined, done: true };\n }\n if (kind == 'keys') return { value: index, done: false };\n if (kind == 'values') return { value: target[index], done: false };\n return { value: [index, target[index]], done: false };\n}, 'values');\n\n// argumentsList[@@iterator] is %ArrayProto_values%\n// https://tc39.github.io/ecma262/#sec-createunmappedargumentsobject\n// https://tc39.github.io/ecma262/#sec-createmappedargumentsobject\nIterators.Arguments = Iterators.Array;\n\n// https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables\naddToUnscopables('keys');\naddToUnscopables('values');\naddToUnscopables('entries');\n","'use strict';\nvar $ = require('../internals/export');\nvar IndexedObject = require('../internals/indexed-object');\nvar toIndexedObject = require('../internals/to-indexed-object');\nvar arrayMethodIsStrict = require('../internals/array-method-is-strict');\n\nvar nativeJoin = [].join;\n\nvar ES3_STRINGS = IndexedObject != Object;\nvar STRICT_METHOD = arrayMethodIsStrict('join', ',');\n\n// `Array.prototype.join` method\n// https://tc39.github.io/ecma262/#sec-array.prototype.join\n$({ target: 'Array', proto: true, forced: ES3_STRINGS || !STRICT_METHOD }, {\n join: function join(separator) {\n return nativeJoin.call(toIndexedObject(this), separator === undefined ? ',' : separator);\n }\n});\n","'use strict';\nvar toPrimitive = require('../internals/to-primitive');\nvar definePropertyModule = require('../internals/object-define-property');\nvar createPropertyDescriptor = require('../internals/create-property-descriptor');\n\nmodule.exports = function (object, key, value) {\n var propertyKey = toPrimitive(key);\n if (propertyKey in object) definePropertyModule.f(object, propertyKey, createPropertyDescriptor(0, value));\n else object[propertyKey] = value;\n};\n","var global = require('../internals/global');\nvar userAgent = require('../internals/engine-user-agent');\n\nvar process = global.process;\nvar versions = process && process.versions;\nvar v8 = versions && versions.v8;\nvar match, version;\n\nif (v8) {\n match = v8.split('.');\n version = match[0] + match[1];\n} else if (userAgent) {\n match = userAgent.match(/Edge\\/(\\d+)/);\n if (!match || match[1] >= 74) {\n match = userAgent.match(/Chrome\\/(\\d+)/);\n if (match) version = match[1];\n }\n}\n\nmodule.exports = version && +version;\n","var getBuiltIn = require('../internals/get-built-in');\n\nmodule.exports = getBuiltIn('navigator', 'userAgent') || '';\n","var fails = require('../internals/fails');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\nvar V8_VERSION = require('../internals/engine-v8-version');\n\nvar SPECIES = wellKnownSymbol('species');\n\nmodule.exports = function (METHOD_NAME) {\n // We can't use this feature detection in V8 since it causes\n // deoptimization and serious performance degradation\n // https://github.com/zloirock/core-js/issues/677\n return V8_VERSION >= 51 || !fails(function () {\n var array = [];\n var constructor = array.constructor = {};\n constructor[SPECIES] = function () {\n return { foo: 1 };\n };\n return array[METHOD_NAME](Boolean).foo !== 1;\n });\n};\n","'use strict';\nvar $ = require('../internals/export');\nvar isObject = require('../internals/is-object');\nvar isArray = require('../internals/is-array');\nvar toAbsoluteIndex = require('../internals/to-absolute-index');\nvar toLength = require('../internals/to-length');\nvar toIndexedObject = require('../internals/to-indexed-object');\nvar createProperty = require('../internals/create-property');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\nvar arrayMethodHasSpeciesSupport = require('../internals/array-method-has-species-support');\nvar arrayMethodUsesToLength = require('../internals/array-method-uses-to-length');\n\nvar HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('slice');\nvar USES_TO_LENGTH = arrayMethodUsesToLength('slice', { ACCESSORS: true, 0: 0, 1: 2 });\n\nvar SPECIES = wellKnownSymbol('species');\nvar nativeSlice = [].slice;\nvar max = Math.max;\n\n// `Array.prototype.slice` method\n// https://tc39.github.io/ecma262/#sec-array.prototype.slice\n// fallback for not array-like ES3 strings and DOM objects\n$({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT || !USES_TO_LENGTH }, {\n slice: function slice(start, end) {\n var O = toIndexedObject(this);\n var length = toLength(O.length);\n var k = toAbsoluteIndex(start, length);\n var fin = toAbsoluteIndex(end === undefined ? length : end, length);\n // inline `ArraySpeciesCreate` for usage native `Array#slice` where it's possible\n var Constructor, result, n;\n if (isArray(O)) {\n Constructor = O.constructor;\n // cross-realm fallback\n if (typeof Constructor == 'function' && (Constructor === Array || isArray(Constructor.prototype))) {\n Constructor = undefined;\n } else if (isObject(Constructor)) {\n Constructor = Constructor[SPECIES];\n if (Constructor === null) Constructor = undefined;\n }\n if (Constructor === Array || Constructor === undefined) {\n return nativeSlice.call(O, k, fin);\n }\n }\n result = new (Constructor === undefined ? Array : Constructor)(max(fin - k, 0));\n for (n = 0; k < fin; k++, n++) if (k in O) createProperty(result, n, O[k]);\n result.length = n;\n return result;\n }\n});\n","var wellKnownSymbol = require('../internals/well-known-symbol');\n\nvar TO_STRING_TAG = wellKnownSymbol('toStringTag');\nvar test = {};\n\ntest[TO_STRING_TAG] = 'z';\n\nmodule.exports = String(test) === '[object z]';\n","var TO_STRING_TAG_SUPPORT = require('../internals/to-string-tag-support');\nvar classofRaw = require('../internals/classof-raw');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\n\nvar TO_STRING_TAG = wellKnownSymbol('toStringTag');\n// ES3 wrong here\nvar CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments';\n\n// fallback for IE11 Script Access Denied error\nvar tryGet = function (it, key) {\n try {\n return it[key];\n } catch (error) { /* empty */ }\n};\n\n// getting tag from ES6+ `Object.prototype.toString`\nmodule.exports = TO_STRING_TAG_SUPPORT ? classofRaw : function (it) {\n var O, tag, result;\n return it === undefined ? 'Undefined' : it === null ? 'Null'\n // @@toStringTag case\n : typeof (tag = tryGet(O = Object(it), TO_STRING_TAG)) == 'string' ? tag\n // builtinTag case\n : CORRECT_ARGUMENTS ? classofRaw(O)\n // ES3 arguments fallback\n : (result = classofRaw(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : result;\n};\n","'use strict';\nvar TO_STRING_TAG_SUPPORT = require('../internals/to-string-tag-support');\nvar classof = require('../internals/classof');\n\n// `Object.prototype.toString` method implementation\n// https://tc39.github.io/ecma262/#sec-object.prototype.tostring\nmodule.exports = TO_STRING_TAG_SUPPORT ? {}.toString : function toString() {\n return '[object ' + classof(this) + ']';\n};\n","var TO_STRING_TAG_SUPPORT = require('../internals/to-string-tag-support');\nvar redefine = require('../internals/redefine');\nvar toString = require('../internals/object-to-string');\n\n// `Object.prototype.toString` method\n// https://tc39.github.io/ecma262/#sec-object.prototype.tostring\nif (!TO_STRING_TAG_SUPPORT) {\n redefine(Object.prototype, 'toString', toString, { unsafe: true });\n}\n","'use strict';\nvar anObject = require('../internals/an-object');\n\n// `RegExp.prototype.flags` getter implementation\n// https://tc39.github.io/ecma262/#sec-get-regexp.prototype.flags\nmodule.exports = function () {\n var that = anObject(this);\n var result = '';\n if (that.global) result += 'g';\n if (that.ignoreCase) result += 'i';\n if (that.multiline) result += 'm';\n if (that.dotAll) result += 's';\n if (that.unicode) result += 'u';\n if (that.sticky) result += 'y';\n return result;\n};\n","'use strict';\n\nvar fails = require('./fails');\n\n// babel-minify transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError,\n// so we use an intermediate function.\nfunction RE(s, f) {\n return RegExp(s, f);\n}\n\nexports.UNSUPPORTED_Y = fails(function () {\n // babel-minify transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError\n var re = RE('a', 'y');\n re.lastIndex = 2;\n return re.exec('abcd') != null;\n});\n\nexports.BROKEN_CARET = fails(function () {\n // https://bugzilla.mozilla.org/show_bug.cgi?id=773687\n var re = RE('^r', 'gy');\n re.lastIndex = 2;\n return re.exec('str') != null;\n});\n","'use strict';\nvar regexpFlags = require('./regexp-flags');\nvar stickyHelpers = require('./regexp-sticky-helpers');\n\nvar nativeExec = RegExp.prototype.exec;\n// This always refers to the native implementation, because the\n// String#replace polyfill uses ./fix-regexp-well-known-symbol-logic.js,\n// which loads this file before patching the method.\nvar nativeReplace = String.prototype.replace;\n\nvar patchedExec = nativeExec;\n\nvar UPDATES_LAST_INDEX_WRONG = (function () {\n var re1 = /a/;\n var re2 = /b*/g;\n nativeExec.call(re1, 'a');\n nativeExec.call(re2, 'a');\n return re1.lastIndex !== 0 || re2.lastIndex !== 0;\n})();\n\nvar UNSUPPORTED_Y = stickyHelpers.UNSUPPORTED_Y || stickyHelpers.BROKEN_CARET;\n\n// nonparticipating capturing group, copied from es5-shim's String#split patch.\nvar NPCG_INCLUDED = /()??/.exec('')[1] !== undefined;\n\nvar PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED || UNSUPPORTED_Y;\n\nif (PATCH) {\n patchedExec = function exec(str) {\n var re = this;\n var lastIndex, reCopy, match, i;\n var sticky = UNSUPPORTED_Y && re.sticky;\n var flags = regexpFlags.call(re);\n var source = re.source;\n var charsAdded = 0;\n var strCopy = str;\n\n if (sticky) {\n flags = flags.replace('y', '');\n if (flags.indexOf('g') === -1) {\n flags += 'g';\n }\n\n strCopy = String(str).slice(re.lastIndex);\n // Support anchored sticky behavior.\n if (re.lastIndex > 0 && (!re.multiline || re.multiline && str[re.lastIndex - 1] !== '\\n')) {\n source = '(?: ' + source + ')';\n strCopy = ' ' + strCopy;\n charsAdded++;\n }\n // ^(? + rx + ) is needed, in combination with some str slicing, to\n // simulate the 'y' flag.\n reCopy = new RegExp('^(?:' + source + ')', flags);\n }\n\n if (NPCG_INCLUDED) {\n reCopy = new RegExp('^' + source + '$(?!\\\\s)', flags);\n }\n if (UPDATES_LAST_INDEX_WRONG) lastIndex = re.lastIndex;\n\n match = nativeExec.call(sticky ? reCopy : re, strCopy);\n\n if (sticky) {\n if (match) {\n match.input = match.input.slice(charsAdded);\n match[0] = match[0].slice(charsAdded);\n match.index = re.lastIndex;\n re.lastIndex += match[0].length;\n } else re.lastIndex = 0;\n } else if (UPDATES_LAST_INDEX_WRONG && match) {\n re.lastIndex = re.global ? match.index + match[0].length : lastIndex;\n }\n if (NPCG_INCLUDED && match && match.length > 1) {\n // Fix browsers whose `exec` methods don't consistently return `undefined`\n // for NPCG, like IE8. NOTE: This doesn' work for /(.?)?/\n nativeReplace.call(match[0], reCopy, function () {\n for (i = 1; i < arguments.length - 2; i++) {\n if (arguments[i] === undefined) match[i] = undefined;\n }\n });\n }\n\n return match;\n };\n}\n\nmodule.exports = patchedExec;\n","'use strict';\nvar $ = require('../internals/export');\nvar exec = require('../internals/regexp-exec');\n\n$({ target: 'RegExp', proto: true, forced: /./.exec !== exec }, {\n exec: exec\n});\n","'use strict';\nvar redefine = require('../internals/redefine');\nvar anObject = require('../internals/an-object');\nvar fails = require('../internals/fails');\nvar flags = require('../internals/regexp-flags');\n\nvar TO_STRING = 'toString';\nvar RegExpPrototype = RegExp.prototype;\nvar nativeToString = RegExpPrototype[TO_STRING];\n\nvar NOT_GENERIC = fails(function () { return nativeToString.call({ source: 'a', flags: 'b' }) != '/a/b'; });\n// FF44- RegExp#toString has a wrong name\nvar INCORRECT_NAME = nativeToString.name != TO_STRING;\n\n// `RegExp.prototype.toString` method\n// https://tc39.github.io/ecma262/#sec-regexp.prototype.tostring\nif (NOT_GENERIC || INCORRECT_NAME) {\n redefine(RegExp.prototype, TO_STRING, function toString() {\n var R = anObject(this);\n var p = String(R.source);\n var rf = R.flags;\n var f = String(rf === undefined && R instanceof RegExp && !('flags' in RegExpPrototype) ? flags.call(R) : rf);\n return '/' + p + '/' + f;\n }, { unsafe: true });\n}\n","var toInteger = require('../internals/to-integer');\nvar requireObjectCoercible = require('../internals/require-object-coercible');\n\n// `String.prototype.{ codePointAt, at }` methods implementation\nvar createMethod = function (CONVERT_TO_STRING) {\n return function ($this, pos) {\n var S = String(requireObjectCoercible($this));\n var position = toInteger(pos);\n var size = S.length;\n var first, second;\n if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;\n first = S.charCodeAt(position);\n return first < 0xD800 || first > 0xDBFF || position + 1 === size\n || (second = S.charCodeAt(position + 1)) < 0xDC00 || second > 0xDFFF\n ? CONVERT_TO_STRING ? S.charAt(position) : first\n : CONVERT_TO_STRING ? S.slice(position, position + 2) : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;\n };\n};\n\nmodule.exports = {\n // `String.prototype.codePointAt` method\n // https://tc39.github.io/ecma262/#sec-string.prototype.codepointat\n codeAt: createMethod(false),\n // `String.prototype.at` method\n // https://github.com/mathiasbynens/String.prototype.at\n charAt: createMethod(true)\n};\n","'use strict';\nvar charAt = require('../internals/string-multibyte').charAt;\nvar InternalStateModule = require('../internals/internal-state');\nvar defineIterator = require('../internals/define-iterator');\n\nvar STRING_ITERATOR = 'String Iterator';\nvar setInternalState = InternalStateModule.set;\nvar getInternalState = InternalStateModule.getterFor(STRING_ITERATOR);\n\n// `String.prototype[@@iterator]` method\n// https://tc39.github.io/ecma262/#sec-string.prototype-@@iterator\ndefineIterator(String, 'String', function (iterated) {\n setInternalState(this, {\n type: STRING_ITERATOR,\n string: String(iterated),\n index: 0\n });\n// `%StringIteratorPrototype%.next` method\n// https://tc39.github.io/ecma262/#sec-%stringiteratorprototype%.next\n}, function next() {\n var state = getInternalState(this);\n var string = state.string;\n var index = state.index;\n var point;\n if (index >= string.length) return { value: undefined, done: true };\n point = charAt(string, index);\n state.index += point.length;\n return { value: point, done: false };\n});\n","'use strict';\n// TODO: Remove from `core-js@4` since it's moved to entry points\nrequire('../modules/es.regexp.exec');\nvar redefine = require('../internals/redefine');\nvar fails = require('../internals/fails');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\nvar regexpExec = require('../internals/regexp-exec');\nvar createNonEnumerableProperty = require('../internals/create-non-enumerable-property');\n\nvar SPECIES = wellKnownSymbol('species');\n\nvar REPLACE_SUPPORTS_NAMED_GROUPS = !fails(function () {\n // #replace needs built-in support for named groups.\n // #match works fine because it just return the exec results, even if it has\n // a \"grops\" property.\n var re = /./;\n re.exec = function () {\n var result = [];\n result.groups = { a: '7' };\n return result;\n };\n return ''.replace(re, '$<a>') !== '7';\n});\n\n// IE <= 11 replaces $0 with the whole match, as if it was $&\n// https://stackoverflow.com/questions/6024666/getting-ie-to-replace-a-regex-with-the-literal-string-0\nvar REPLACE_KEEPS_$0 = (function () {\n return 'a'.replace(/./, '$0') === '$0';\n})();\n\nvar REPLACE = wellKnownSymbol('replace');\n// Safari <= 13.0.3(?) substitutes nth capture where n>m with an empty string\nvar REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE = (function () {\n if (/./[REPLACE]) {\n return /./[REPLACE]('a', '$0') === '';\n }\n return false;\n})();\n\n// Chrome 51 has a buggy \"split\" implementation when RegExp#exec !== nativeExec\n// Weex JS has frozen built-in prototypes, so use try / catch wrapper\nvar SPLIT_WORKS_WITH_OVERWRITTEN_EXEC = !fails(function () {\n var re = /(?:)/;\n var originalExec = re.exec;\n re.exec = function () { return originalExec.apply(this, arguments); };\n var result = 'ab'.split(re);\n return result.length !== 2 || result[0] !== 'a' || result[1] !== 'b';\n});\n\nmodule.exports = function (KEY, length, exec, sham) {\n var SYMBOL = wellKnownSymbol(KEY);\n\n var DELEGATES_TO_SYMBOL = !fails(function () {\n // String methods call symbol-named RegEp methods\n var O = {};\n O[SYMBOL] = function () { return 7; };\n return ''[KEY](O) != 7;\n });\n\n var DELEGATES_TO_EXEC = DELEGATES_TO_SYMBOL && !fails(function () {\n // Symbol-named RegExp methods call .exec\n var execCalled = false;\n var re = /a/;\n\n if (KEY === 'split') {\n // We can't use real regex here since it causes deoptimization\n // and serious performance degradation in V8\n // https://github.com/zloirock/core-js/issues/306\n re = {};\n // RegExp[@@split] doesn't call the regex's exec method, but first creates\n // a new one. We need to return the patched regex when creating the new one.\n re.constructor = {};\n re.constructor[SPECIES] = function () { return re; };\n re.flags = '';\n re[SYMBOL] = /./[SYMBOL];\n }\n\n re.exec = function () { execCalled = true; return null; };\n\n re[SYMBOL]('');\n return !execCalled;\n });\n\n if (\n !DELEGATES_TO_SYMBOL ||\n !DELEGATES_TO_EXEC ||\n (KEY === 'replace' && !(\n REPLACE_SUPPORTS_NAMED_GROUPS &&\n REPLACE_KEEPS_$0 &&\n !REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE\n )) ||\n (KEY === 'split' && !SPLIT_WORKS_WITH_OVERWRITTEN_EXEC)\n ) {\n var nativeRegExpMethod = /./[SYMBOL];\n var methods = exec(SYMBOL, ''[KEY], function (nativeMethod, regexp, str, arg2, forceStringMethod) {\n if (regexp.exec === regexpExec) {\n if (DELEGATES_TO_SYMBOL && !forceStringMethod) {\n // The native String method already delegates to @@method (this\n // polyfilled function), leasing to infinite recursion.\n // We avoid it by directly calling the native @@method method.\n return { done: true, value: nativeRegExpMethod.call(regexp, str, arg2) };\n }\n return { done: true, value: nativeMethod.call(str, regexp, arg2) };\n }\n return { done: false };\n }, {\n REPLACE_KEEPS_$0: REPLACE_KEEPS_$0,\n REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE: REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE\n });\n var stringMethod = methods[0];\n var regexMethod = methods[1];\n\n redefine(String.prototype, KEY, stringMethod);\n redefine(RegExp.prototype, SYMBOL, length == 2\n // 21.2.5.8 RegExp.prototype[@@replace](string, replaceValue)\n // 21.2.5.11 RegExp.prototype[@@split](string, limit)\n ? function (string, arg) { return regexMethod.call(string, this, arg); }\n // 21.2.5.6 RegExp.prototype[@@match](string)\n // 21.2.5.9 RegExp.prototype[@@search](string)\n : function (string) { return regexMethod.call(string, this); }\n );\n }\n\n if (sham) createNonEnumerableProperty(RegExp.prototype[SYMBOL], 'sham', true);\n};\n","'use strict';\nvar charAt = require('../internals/string-multibyte').charAt;\n\n// `AdvanceStringIndex` abstract operation\n// https://tc39.github.io/ecma262/#sec-advancestringindex\nmodule.exports = function (S, index, unicode) {\n return index + (unicode ? charAt(S, index).length : 1);\n};\n","var classof = require('./classof-raw');\nvar regexpExec = require('./regexp-exec');\n\n// `RegExpExec` abstract operation\n// https://tc39.github.io/ecma262/#sec-regexpexec\nmodule.exports = function (R, S) {\n var exec = R.exec;\n if (typeof exec === 'function') {\n var result = exec.call(R, S);\n if (typeof result !== 'object') {\n throw TypeError('RegExp exec method returned something other than an Object or null');\n }\n return result;\n }\n\n if (classof(R) !== 'RegExp') {\n throw TypeError('RegExp#exec called on incompatible receiver');\n }\n\n return regexpExec.call(R, S);\n};\n\n","'use strict';\nvar fixRegExpWellKnownSymbolLogic = require('../internals/fix-regexp-well-known-symbol-logic');\nvar anObject = require('../internals/an-object');\nvar toObject = require('../internals/to-object');\nvar toLength = require('../internals/to-length');\nvar toInteger = require('../internals/to-integer');\nvar requireObjectCoercible = require('../internals/require-object-coercible');\nvar advanceStringIndex = require('../internals/advance-string-index');\nvar regExpExec = require('../internals/regexp-exec-abstract');\n\nvar max = Math.max;\nvar min = Math.min;\nvar floor = Math.floor;\nvar SUBSTITUTION_SYMBOLS = /\\$([$&'`]|\\d\\d?|<[^>]*>)/g;\nvar SUBSTITUTION_SYMBOLS_NO_NAMED = /\\$([$&'`]|\\d\\d?)/g;\n\nvar maybeToString = function (it) {\n return it === undefined ? it : String(it);\n};\n\n// @@replace logic\nfixRegExpWellKnownSymbolLogic('replace', 2, function (REPLACE, nativeReplace, maybeCallNative, reason) {\n var REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE = reason.REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE;\n var REPLACE_KEEPS_$0 = reason.REPLACE_KEEPS_$0;\n var UNSAFE_SUBSTITUTE = REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE ? '$' : '$0';\n\n return [\n // `String.prototype.replace` method\n // https://tc39.github.io/ecma262/#sec-string.prototype.replace\n function replace(searchValue, replaceValue) {\n var O = requireObjectCoercible(this);\n var replacer = searchValue == undefined ? undefined : searchValue[REPLACE];\n return replacer !== undefined\n ? replacer.call(searchValue, O, replaceValue)\n : nativeReplace.call(String(O), searchValue, replaceValue);\n },\n // `RegExp.prototype[@@replace]` method\n // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@replace\n function (regexp, replaceValue) {\n if (\n (!REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE && REPLACE_KEEPS_$0) ||\n (typeof replaceValue === 'string' && replaceValue.indexOf(UNSAFE_SUBSTITUTE) === -1)\n ) {\n var res = maybeCallNative(nativeReplace, regexp, this, replaceValue);\n if (res.done) return res.value;\n }\n\n var rx = anObject(regexp);\n var S = String(this);\n\n var functionalReplace = typeof replaceValue === 'function';\n if (!functionalReplace) replaceValue = String(replaceValue);\n\n var global = rx.global;\n if (global) {\n var fullUnicode = rx.unicode;\n rx.lastIndex = 0;\n }\n var results = [];\n while (true) {\n var result = regExpExec(rx, S);\n if (result === null) break;\n\n results.push(result);\n if (!global) break;\n\n var matchStr = String(result[0]);\n if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);\n }\n\n var accumulatedResult = '';\n var nextSourcePosition = 0;\n for (var i = 0; i < results.length; i++) {\n result = results[i];\n\n var matched = String(result[0]);\n var position = max(min(toInteger(result.index), S.length), 0);\n var captures = [];\n // NOTE: This is equivalent to\n // captures = result.slice(1).map(maybeToString)\n // but for some reason `nativeSlice.call(result, 1, result.length)` (called in\n // the slice polyfill when slicing native arrays) \"doesn't work\" in safari 9 and\n // causes a crash (https://pastebin.com/N21QzeQA) when trying to debug it.\n for (var j = 1; j < result.length; j++) captures.push(maybeToString(result[j]));\n var namedCaptures = result.groups;\n if (functionalReplace) {\n var replacerArgs = [matched].concat(captures, position, S);\n if (namedCaptures !== undefined) replacerArgs.push(namedCaptures);\n var replacement = String(replaceValue.apply(undefined, replacerArgs));\n } else {\n replacement = getSubstitution(matched, S, position, captures, namedCaptures, replaceValue);\n }\n if (position >= nextSourcePosition) {\n accumulatedResult += S.slice(nextSourcePosition, position) + replacement;\n nextSourcePosition = position + matched.length;\n }\n }\n return accumulatedResult + S.slice(nextSourcePosition);\n }\n ];\n\n // https://tc39.github.io/ecma262/#sec-getsubstitution\n function getSubstitution(matched, str, position, captures, namedCaptures, replacement) {\n var tailPos = position + matched.length;\n var m = captures.length;\n var symbols = SUBSTITUTION_SYMBOLS_NO_NAMED;\n if (namedCaptures !== undefined) {\n namedCaptures = toObject(namedCaptures);\n symbols = SUBSTITUTION_SYMBOLS;\n }\n return nativeReplace.call(replacement, symbols, function (match, ch) {\n var capture;\n switch (ch.charAt(0)) {\n case '$': return '$';\n case '&': return matched;\n case '`': return str.slice(0, position);\n case \"'\": return str.slice(tailPos);\n case '<':\n capture = namedCaptures[ch.slice(1, -1)];\n break;\n default: // \\d\\d?\n var n = +ch;\n if (n === 0) return match;\n if (n > m) {\n var f = floor(n / 10);\n if (f === 0) return match;\n if (f <= m) return captures[f - 1] === undefined ? ch.charAt(1) : captures[f - 1] + ch.charAt(1);\n return match;\n }\n capture = captures[n - 1];\n }\n return capture === undefined ? '' : capture;\n });\n }\n});\n","// `SameValue` abstract operation\n// https://tc39.github.io/ecma262/#sec-samevalue\nmodule.exports = Object.is || function is(x, y) {\n // eslint-disable-next-line no-self-compare\n return x === y ? x !== 0 || 1 / x === 1 / y : x != x && y != y;\n};\n","'use strict';\nvar fixRegExpWellKnownSymbolLogic = require('../internals/fix-regexp-well-known-symbol-logic');\nvar anObject = require('../internals/an-object');\nvar requireObjectCoercible = require('../internals/require-object-coercible');\nvar sameValue = require('../internals/same-value');\nvar regExpExec = require('../internals/regexp-exec-abstract');\n\n// @@search logic\nfixRegExpWellKnownSymbolLogic('search', 1, function (SEARCH, nativeSearch, maybeCallNative) {\n return [\n // `String.prototype.search` method\n // https://tc39.github.io/ecma262/#sec-string.prototype.search\n function search(regexp) {\n var O = requireObjectCoercible(this);\n var searcher = regexp == undefined ? undefined : regexp[SEARCH];\n return searcher !== undefined ? searcher.call(regexp, O) : new RegExp(regexp)[SEARCH](String(O));\n },\n // `RegExp.prototype[@@search]` method\n // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@search\n function (regexp) {\n var res = maybeCallNative(nativeSearch, regexp, this);\n if (res.done) return res.value;\n\n var rx = anObject(regexp);\n var S = String(this);\n\n var previousLastIndex = rx.lastIndex;\n if (!sameValue(previousLastIndex, 0)) rx.lastIndex = 0;\n var result = regExpExec(rx, S);\n if (!sameValue(rx.lastIndex, previousLastIndex)) rx.lastIndex = previousLastIndex;\n return result === null ? -1 : result.index;\n }\n ];\n});\n","var isObject = require('../internals/is-object');\nvar classof = require('../internals/classof-raw');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\n\nvar MATCH = wellKnownSymbol('match');\n\n// `IsRegExp` abstract operation\n// https://tc39.github.io/ecma262/#sec-isregexp\nmodule.exports = function (it) {\n var isRegExp;\n return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : classof(it) == 'RegExp');\n};\n","var anObject = require('../internals/an-object');\nvar aFunction = require('../internals/a-function');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\n\nvar SPECIES = wellKnownSymbol('species');\n\n// `SpeciesConstructor` abstract operation\n// https://tc39.github.io/ecma262/#sec-speciesconstructor\nmodule.exports = function (O, defaultConstructor) {\n var C = anObject(O).constructor;\n var S;\n return C === undefined || (S = anObject(C)[SPECIES]) == undefined ? defaultConstructor : aFunction(S);\n};\n","'use strict';\nvar fixRegExpWellKnownSymbolLogic = require('../internals/fix-regexp-well-known-symbol-logic');\nvar isRegExp = require('../internals/is-regexp');\nvar anObject = require('../internals/an-object');\nvar requireObjectCoercible = require('../internals/require-object-coercible');\nvar speciesConstructor = require('../internals/species-constructor');\nvar advanceStringIndex = require('../internals/advance-string-index');\nvar toLength = require('../internals/to-length');\nvar callRegExpExec = require('../internals/regexp-exec-abstract');\nvar regexpExec = require('../internals/regexp-exec');\nvar fails = require('../internals/fails');\n\nvar arrayPush = [].push;\nvar min = Math.min;\nvar MAX_UINT32 = 0xFFFFFFFF;\n\n// babel-minify transpiles RegExp('x', 'y') -> /x/y and it causes SyntaxError\nvar SUPPORTS_Y = !fails(function () { return !RegExp(MAX_UINT32, 'y'); });\n\n// @@split logic\nfixRegExpWellKnownSymbolLogic('split', 2, function (SPLIT, nativeSplit, maybeCallNative) {\n var internalSplit;\n if (\n 'abbc'.split(/(b)*/)[1] == 'c' ||\n 'test'.split(/(?:)/, -1).length != 4 ||\n 'ab'.split(/(?:ab)*/).length != 2 ||\n '.'.split(/(.?)(.?)/).length != 4 ||\n '.'.split(/()()/).length > 1 ||\n ''.split(/.?/).length\n ) {\n // based on es5-shim implementation, need to rework it\n internalSplit = function (separator, limit) {\n var string = String(requireObjectCoercible(this));\n var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;\n if (lim === 0) return [];\n if (separator === undefined) return [string];\n // If `separator` is not a regex, use native split\n if (!isRegExp(separator)) {\n return nativeSplit.call(string, separator, lim);\n }\n var output = [];\n var flags = (separator.ignoreCase ? 'i' : '') +\n (separator.multiline ? 'm' : '') +\n (separator.unicode ? 'u' : '') +\n (separator.sticky ? 'y' : '');\n var lastLastIndex = 0;\n // Make `global` and avoid `lastIndex` issues by working with a copy\n var separatorCopy = new RegExp(separator.source, flags + 'g');\n var match, lastIndex, lastLength;\n while (match = regexpExec.call(separatorCopy, string)) {\n lastIndex = separatorCopy.lastIndex;\n if (lastIndex > lastLastIndex) {\n output.push(string.slice(lastLastIndex, match.index));\n if (match.length > 1 && match.index < string.length) arrayPush.apply(output, match.slice(1));\n lastLength = match[0].length;\n lastLastIndex = lastIndex;\n if (output.length >= lim) break;\n }\n if (separatorCopy.lastIndex === match.index) separatorCopy.lastIndex++; // Avoid an infinite loop\n }\n if (lastLastIndex === string.length) {\n if (lastLength || !separatorCopy.test('')) output.push('');\n } else output.push(string.slice(lastLastIndex));\n return output.length > lim ? output.slice(0, lim) : output;\n };\n // Chakra, V8\n } else if ('0'.split(undefined, 0).length) {\n internalSplit = function (separator, limit) {\n return separator === undefined && limit === 0 ? [] : nativeSplit.call(this, separator, limit);\n };\n } else internalSplit = nativeSplit;\n\n return [\n // `String.prototype.split` method\n // https://tc39.github.io/ecma262/#sec-string.prototype.split\n function split(separator, limit) {\n var O = requireObjectCoercible(this);\n var splitter = separator == undefined ? undefined : separator[SPLIT];\n return splitter !== undefined\n ? splitter.call(separator, O, limit)\n : internalSplit.call(String(O), separator, limit);\n },\n // `RegExp.prototype[@@split]` method\n // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@split\n //\n // NOTE: This cannot be properly polyfilled in engines that don't support\n // the 'y' flag.\n function (regexp, limit) {\n var res = maybeCallNative(internalSplit, regexp, this, limit, internalSplit !== nativeSplit);\n if (res.done) return res.value;\n\n var rx = anObject(regexp);\n var S = String(this);\n var C = speciesConstructor(rx, RegExp);\n\n var unicodeMatching = rx.unicode;\n var flags = (rx.ignoreCase ? 'i' : '') +\n (rx.multiline ? 'm' : '') +\n (rx.unicode ? 'u' : '') +\n (SUPPORTS_Y ? 'y' : 'g');\n\n // ^(? + rx + ) is needed, in combination with some S slicing, to\n // simulate the 'y' flag.\n var splitter = new C(SUPPORTS_Y ? rx : '^(?:' + rx.source + ')', flags);\n var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;\n if (lim === 0) return [];\n if (S.length === 0) return callRegExpExec(splitter, S) === null ? [S] : [];\n var p = 0;\n var q = 0;\n var A = [];\n while (q < S.length) {\n splitter.lastIndex = SUPPORTS_Y ? q : 0;\n var z = callRegExpExec(splitter, SUPPORTS_Y ? S : S.slice(q));\n var e;\n if (\n z === null ||\n (e = min(toLength(splitter.lastIndex + (SUPPORTS_Y ? 0 : q)), S.length)) === p\n ) {\n q = advanceStringIndex(S, q, unicodeMatching);\n } else {\n A.push(S.slice(p, q));\n if (A.length === lim) return A;\n for (var i = 1; i <= z.length - 1; i++) {\n A.push(z[i]);\n if (A.length === lim) return A;\n }\n q = p = e;\n }\n }\n A.push(S.slice(p));\n return A;\n }\n ];\n}, !SUPPORTS_Y);\n","// iterable DOM collections\n// flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods\nmodule.exports = {\n CSSRuleList: 0,\n CSSStyleDeclaration: 0,\n CSSValueList: 0,\n ClientRectList: 0,\n DOMRectList: 0,\n DOMStringList: 0,\n DOMTokenList: 1,\n DataTransferItemList: 0,\n FileList: 0,\n HTMLAllCollection: 0,\n HTMLCollection: 0,\n HTMLFormElement: 0,\n HTMLSelectElement: 0,\n MediaList: 0,\n MimeTypeArray: 0,\n NamedNodeMap: 0,\n NodeList: 1,\n PaintRequestList: 0,\n Plugin: 0,\n PluginArray: 0,\n SVGLengthList: 0,\n SVGNumberList: 0,\n SVGPathSegList: 0,\n SVGPointList: 0,\n SVGStringList: 0,\n SVGTransformList: 0,\n SourceBufferList: 0,\n StyleSheetList: 0,\n TextTrackCueList: 0,\n TextTrackList: 0,\n TouchList: 0\n};\n","var global = require('../internals/global');\nvar DOMIterables = require('../internals/dom-iterables');\nvar forEach = require('../internals/array-for-each');\nvar createNonEnumerableProperty = require('../internals/create-non-enumerable-property');\n\nfor (var COLLECTION_NAME in DOMIterables) {\n var Collection = global[COLLECTION_NAME];\n var CollectionPrototype = Collection && Collection.prototype;\n // some Chrome versions have non-configurable methods on DOMTokenList\n if (CollectionPrototype && CollectionPrototype.forEach !== forEach) try {\n createNonEnumerableProperty(CollectionPrototype, 'forEach', forEach);\n } catch (error) {\n CollectionPrototype.forEach = forEach;\n }\n}\n","var global = require('../internals/global');\nvar DOMIterables = require('../internals/dom-iterables');\nvar ArrayIteratorMethods = require('../modules/es.array.iterator');\nvar createNonEnumerableProperty = require('../internals/create-non-enumerable-property');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\n\nvar ITERATOR = wellKnownSymbol('iterator');\nvar TO_STRING_TAG = wellKnownSymbol('toStringTag');\nvar ArrayValues = ArrayIteratorMethods.values;\n\nfor (var COLLECTION_NAME in DOMIterables) {\n var Collection = global[COLLECTION_NAME];\n var CollectionPrototype = Collection && Collection.prototype;\n if (CollectionPrototype) {\n // some Chrome versions have non-configurable methods on DOMTokenList\n if (CollectionPrototype[ITERATOR] !== ArrayValues) try {\n createNonEnumerableProperty(CollectionPrototype, ITERATOR, ArrayValues);\n } catch (error) {\n CollectionPrototype[ITERATOR] = ArrayValues;\n }\n if (!CollectionPrototype[TO_STRING_TAG]) {\n createNonEnumerableProperty(CollectionPrototype, TO_STRING_TAG, COLLECTION_NAME);\n }\n if (DOMIterables[COLLECTION_NAME]) for (var METHOD_NAME in ArrayIteratorMethods) {\n // some Chrome versions have non-configurable methods on DOMTokenList\n if (CollectionPrototype[METHOD_NAME] !== ArrayIteratorMethods[METHOD_NAME]) try {\n createNonEnumerableProperty(CollectionPrototype, METHOD_NAME, ArrayIteratorMethods[METHOD_NAME]);\n } catch (error) {\n CollectionPrototype[METHOD_NAME] = ArrayIteratorMethods[METHOD_NAME];\n }\n }\n }\n}\n","var fails = require('../internals/fails');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\nvar IS_PURE = require('../internals/is-pure');\n\nvar ITERATOR = wellKnownSymbol('iterator');\n\nmodule.exports = !fails(function () {\n var url = new URL('b?a=1&b=2&c=3', 'http://a');\n var searchParams = url.searchParams;\n var result = '';\n url.pathname = 'c%20d';\n searchParams.forEach(function (value, key) {\n searchParams['delete']('b');\n result += key + value;\n });\n return (IS_PURE && !url.toJSON)\n || !searchParams.sort\n || url.href !== 'http://a/c%20d?a=1&c=3'\n || searchParams.get('c') !== '3'\n || String(new URLSearchParams('?a=1')) !== 'a=1'\n || !searchParams[ITERATOR]\n // throws in Edge\n || new URL('https://a@b').username !== 'a'\n || new URLSearchParams(new URLSearchParams('a=b')).get('a') !== 'b'\n // not punycoded in Edge\n || new URL('http://тест').host !== 'xn--e1aybc'\n // not escaped in Chrome 62-\n || new URL('http://a#б').hash !== '#%D0%B1'\n // fails in Chrome 66-\n || result !== 'a1c3'\n // throws in Safari\n || new URL('http://x', undefined).host !== 'x';\n});\n","module.exports = function (it, Constructor, name) {\n if (!(it instanceof Constructor)) {\n throw TypeError('Incorrect ' + (name ? name + ' ' : '') + 'invocation');\n } return it;\n};\n","'use strict';\nvar DESCRIPTORS = require('../internals/descriptors');\nvar fails = require('../internals/fails');\nvar objectKeys = require('../internals/object-keys');\nvar getOwnPropertySymbolsModule = require('../internals/object-get-own-property-symbols');\nvar propertyIsEnumerableModule = require('../internals/object-property-is-enumerable');\nvar toObject = require('../internals/to-object');\nvar IndexedObject = require('../internals/indexed-object');\n\nvar nativeAssign = Object.assign;\nvar defineProperty = Object.defineProperty;\n\n// `Object.assign` method\n// https://tc39.github.io/ecma262/#sec-object.assign\nmodule.exports = !nativeAssign || fails(function () {\n // should have correct order of operations (Edge bug)\n if (DESCRIPTORS && nativeAssign({ b: 1 }, nativeAssign(defineProperty({}, 'a', {\n enumerable: true,\n get: function () {\n defineProperty(this, 'b', {\n value: 3,\n enumerable: false\n });\n }\n }), { b: 2 })).b !== 1) return true;\n // should work with symbols and should have deterministic property order (V8 bug)\n var A = {};\n var B = {};\n // eslint-disable-next-line no-undef\n var symbol = Symbol();\n var alphabet = 'abcdefghijklmnopqrst';\n A[symbol] = 7;\n alphabet.split('').forEach(function (chr) { B[chr] = chr; });\n return nativeAssign({}, A)[symbol] != 7 || objectKeys(nativeAssign({}, B)).join('') != alphabet;\n}) ? function assign(target, source) { // eslint-disable-line no-unused-vars\n var T = toObject(target);\n var argumentsLength = arguments.length;\n var index = 1;\n var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;\n var propertyIsEnumerable = propertyIsEnumerableModule.f;\n while (argumentsLength > index) {\n var S = IndexedObject(arguments[index++]);\n var keys = getOwnPropertySymbols ? objectKeys(S).concat(getOwnPropertySymbols(S)) : objectKeys(S);\n var length = keys.length;\n var j = 0;\n var key;\n while (length > j) {\n key = keys[j++];\n if (!DESCRIPTORS || propertyIsEnumerable.call(S, key)) T[key] = S[key];\n }\n } return T;\n} : nativeAssign;\n","var anObject = require('../internals/an-object');\n\n// call something on iterator step with safe closing on error\nmodule.exports = function (iterator, fn, value, ENTRIES) {\n try {\n return ENTRIES ? fn(anObject(value)[0], value[1]) : fn(value);\n // 7.4.6 IteratorClose(iterator, completion)\n } catch (error) {\n var returnMethod = iterator['return'];\n if (returnMethod !== undefined) anObject(returnMethod.call(iterator));\n throw error;\n }\n};\n","var wellKnownSymbol = require('../internals/well-known-symbol');\nvar Iterators = require('../internals/iterators');\n\nvar ITERATOR = wellKnownSymbol('iterator');\nvar ArrayPrototype = Array.prototype;\n\n// check on default Array iterator\nmodule.exports = function (it) {\n return it !== undefined && (Iterators.Array === it || ArrayPrototype[ITERATOR] === it);\n};\n","var classof = require('../internals/classof');\nvar Iterators = require('../internals/iterators');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\n\nvar ITERATOR = wellKnownSymbol('iterator');\n\nmodule.exports = function (it) {\n if (it != undefined) return it[ITERATOR]\n || it['@@iterator']\n || Iterators[classof(it)];\n};\n","'use strict';\nvar bind = require('../internals/function-bind-context');\nvar toObject = require('../internals/to-object');\nvar callWithSafeIterationClosing = require('../internals/call-with-safe-iteration-closing');\nvar isArrayIteratorMethod = require('../internals/is-array-iterator-method');\nvar toLength = require('../internals/to-length');\nvar createProperty = require('../internals/create-property');\nvar getIteratorMethod = require('../internals/get-iterator-method');\n\n// `Array.from` method implementation\n// https://tc39.github.io/ecma262/#sec-array.from\nmodule.exports = function from(arrayLike /* , mapfn = undefined, thisArg = undefined */) {\n var O = toObject(arrayLike);\n var C = typeof this == 'function' ? this : Array;\n var argumentsLength = arguments.length;\n var mapfn = argumentsLength > 1 ? arguments[1] : undefined;\n var mapping = mapfn !== undefined;\n var iteratorMethod = getIteratorMethod(O);\n var index = 0;\n var length, result, step, iterator, next, value;\n if (mapping) mapfn = bind(mapfn, argumentsLength > 2 ? arguments[2] : undefined, 2);\n // if the target is not iterable or it's an array with the default iterator - use a simple case\n if (iteratorMethod != undefined && !(C == Array && isArrayIteratorMethod(iteratorMethod))) {\n iterator = iteratorMethod.call(O);\n next = iterator.next;\n result = new C();\n for (;!(step = next.call(iterator)).done; index++) {\n value = mapping ? callWithSafeIterationClosing(iterator, mapfn, [step.value, index], true) : step.value;\n createProperty(result, index, value);\n }\n } else {\n length = toLength(O.length);\n result = new C(length);\n for (;length > index; index++) {\n value = mapping ? mapfn(O[index], index) : O[index];\n createProperty(result, index, value);\n }\n }\n result.length = index;\n return result;\n};\n","'use strict';\n// based on https://github.com/bestiejs/punycode.js/blob/master/punycode.js\nvar maxInt = 2147483647; // aka. 0x7FFFFFFF or 2^31-1\nvar base = 36;\nvar tMin = 1;\nvar tMax = 26;\nvar skew = 38;\nvar damp = 700;\nvar initialBias = 72;\nvar initialN = 128; // 0x80\nvar delimiter = '-'; // '\\x2D'\nvar regexNonASCII = /[^\\0-\\u007E]/; // non-ASCII chars\nvar regexSeparators = /[.\\u3002\\uFF0E\\uFF61]/g; // RFC 3490 separators\nvar OVERFLOW_ERROR = 'Overflow: input needs wider integers to process';\nvar baseMinusTMin = base - tMin;\nvar floor = Math.floor;\nvar stringFromCharCode = String.fromCharCode;\n\n/**\n * Creates an array containing the numeric code points of each Unicode\n * character in the string. While JavaScript uses UCS-2 internally,\n * this function will convert a pair of surrogate halves (each of which\n * UCS-2 exposes as separate characters) into a single code point,\n * matching UTF-16.\n */\nvar ucs2decode = function (string) {\n var output = [];\n var counter = 0;\n var length = string.length;\n while (counter < length) {\n var value = string.charCodeAt(counter++);\n if (value >= 0xD800 && value <= 0xDBFF && counter < length) {\n // It's a high surrogate, and there is a next character.\n var extra = string.charCodeAt(counter++);\n if ((extra & 0xFC00) == 0xDC00) { // Low surrogate.\n output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);\n } else {\n // It's an unmatched surrogate; only append this code unit, in case the\n // next code unit is the high surrogate of a surrogate pair.\n output.push(value);\n counter--;\n }\n } else {\n output.push(value);\n }\n }\n return output;\n};\n\n/**\n * Converts a digit/integer into a basic code point.\n */\nvar digitToBasic = function (digit) {\n // 0..25 map to ASCII a..z or A..Z\n // 26..35 map to ASCII 0..9\n return digit + 22 + 75 * (digit < 26);\n};\n\n/**\n * Bias adaptation function as per section 3.4 of RFC 3492.\n * https://tools.ietf.org/html/rfc3492#section-3.4\n */\nvar adapt = function (delta, numPoints, firstTime) {\n var k = 0;\n delta = firstTime ? floor(delta / damp) : delta >> 1;\n delta += floor(delta / numPoints);\n for (; delta > baseMinusTMin * tMax >> 1; k += base) {\n delta = floor(delta / baseMinusTMin);\n }\n return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));\n};\n\n/**\n * Converts a string of Unicode symbols (e.g. a domain name label) to a\n * Punycode string of ASCII-only symbols.\n */\n// eslint-disable-next-line max-statements\nvar encode = function (input) {\n var output = [];\n\n // Convert the input in UCS-2 to an array of Unicode code points.\n input = ucs2decode(input);\n\n // Cache the length.\n var inputLength = input.length;\n\n // Initialize the state.\n var n = initialN;\n var delta = 0;\n var bias = initialBias;\n var i, currentValue;\n\n // Handle the basic code points.\n for (i = 0; i < input.length; i++) {\n currentValue = input[i];\n if (currentValue < 0x80) {\n output.push(stringFromCharCode(currentValue));\n }\n }\n\n var basicLength = output.length; // number of basic code points.\n var handledCPCount = basicLength; // number of code points that have been handled;\n\n // Finish the basic string with a delimiter unless it's empty.\n if (basicLength) {\n output.push(delimiter);\n }\n\n // Main encoding loop:\n while (handledCPCount < inputLength) {\n // All non-basic code points < n have been handled already. Find the next larger one:\n var m = maxInt;\n for (i = 0; i < input.length; i++) {\n currentValue = input[i];\n if (currentValue >= n && currentValue < m) {\n m = currentValue;\n }\n }\n\n // Increase `delta` enough to advance the decoder's <n,i> state to <m,0>, but guard against overflow.\n var handledCPCountPlusOne = handledCPCount + 1;\n if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {\n throw RangeError(OVERFLOW_ERROR);\n }\n\n delta += (m - n) * handledCPCountPlusOne;\n n = m;\n\n for (i = 0; i < input.length; i++) {\n currentValue = input[i];\n if (currentValue < n && ++delta > maxInt) {\n throw RangeError(OVERFLOW_ERROR);\n }\n if (currentValue == n) {\n // Represent delta as a generalized variable-length integer.\n var q = delta;\n for (var k = base; /* no condition */; k += base) {\n var t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);\n if (q < t) break;\n var qMinusT = q - t;\n var baseMinusT = base - t;\n output.push(stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT)));\n q = floor(qMinusT / baseMinusT);\n }\n\n output.push(stringFromCharCode(digitToBasic(q)));\n bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);\n delta = 0;\n ++handledCPCount;\n }\n }\n\n ++delta;\n ++n;\n }\n return output.join('');\n};\n\nmodule.exports = function (input) {\n var encoded = [];\n var labels = input.toLowerCase().replace(regexSeparators, '\\u002E').split('.');\n var i, label;\n for (i = 0; i < labels.length; i++) {\n label = labels[i];\n encoded.push(regexNonASCII.test(label) ? 'xn--' + encode(label) : label);\n }\n return encoded.join('.');\n};\n","var redefine = require('../internals/redefine');\n\nmodule.exports = function (target, src, options) {\n for (var key in src) redefine(target, key, src[key], options);\n return target;\n};\n","var anObject = require('../internals/an-object');\nvar getIteratorMethod = require('../internals/get-iterator-method');\n\nmodule.exports = function (it) {\n var iteratorMethod = getIteratorMethod(it);\n if (typeof iteratorMethod != 'function') {\n throw TypeError(String(it) + ' is not iterable');\n } return anObject(iteratorMethod.call(it));\n};\n","'use strict';\n// TODO: in core-js@4, move /modules/ dependencies to public entries for better optimization by tools like `preset-env`\nrequire('../modules/es.array.iterator');\nvar $ = require('../internals/export');\nvar getBuiltIn = require('../internals/get-built-in');\nvar USE_NATIVE_URL = require('../internals/native-url');\nvar redefine = require('../internals/redefine');\nvar redefineAll = require('../internals/redefine-all');\nvar setToStringTag = require('../internals/set-to-string-tag');\nvar createIteratorConstructor = require('../internals/create-iterator-constructor');\nvar InternalStateModule = require('../internals/internal-state');\nvar anInstance = require('../internals/an-instance');\nvar hasOwn = require('../internals/has');\nvar bind = require('../internals/function-bind-context');\nvar classof = require('../internals/classof');\nvar anObject = require('../internals/an-object');\nvar isObject = require('../internals/is-object');\nvar create = require('../internals/object-create');\nvar createPropertyDescriptor = require('../internals/create-property-descriptor');\nvar getIterator = require('../internals/get-iterator');\nvar getIteratorMethod = require('../internals/get-iterator-method');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\n\nvar $fetch = getBuiltIn('fetch');\nvar Headers = getBuiltIn('Headers');\nvar ITERATOR = wellKnownSymbol('iterator');\nvar URL_SEARCH_PARAMS = 'URLSearchParams';\nvar URL_SEARCH_PARAMS_ITERATOR = URL_SEARCH_PARAMS + 'Iterator';\nvar setInternalState = InternalStateModule.set;\nvar getInternalParamsState = InternalStateModule.getterFor(URL_SEARCH_PARAMS);\nvar getInternalIteratorState = InternalStateModule.getterFor(URL_SEARCH_PARAMS_ITERATOR);\n\nvar plus = /\\+/g;\nvar sequences = Array(4);\n\nvar percentSequence = function (bytes) {\n return sequences[bytes - 1] || (sequences[bytes - 1] = RegExp('((?:%[\\\\da-f]{2}){' + bytes + '})', 'gi'));\n};\n\nvar percentDecode = function (sequence) {\n try {\n return decodeURIComponent(sequence);\n } catch (error) {\n return sequence;\n }\n};\n\nvar deserialize = function (it) {\n var result = it.replace(plus, ' ');\n var bytes = 4;\n try {\n return decodeURIComponent(result);\n } catch (error) {\n while (bytes) {\n result = result.replace(percentSequence(bytes--), percentDecode);\n }\n return result;\n }\n};\n\nvar find = /[!'()~]|%20/g;\n\nvar replace = {\n '!': '%21',\n \"'\": '%27',\n '(': '%28',\n ')': '%29',\n '~': '%7E',\n '%20': '+'\n};\n\nvar replacer = function (match) {\n return replace[match];\n};\n\nvar serialize = function (it) {\n return encodeURIComponent(it).replace(find, replacer);\n};\n\nvar parseSearchParams = function (result, query) {\n if (query) {\n var attributes = query.split('&');\n var index = 0;\n var attribute, entry;\n while (index < attributes.length) {\n attribute = attributes[index++];\n if (attribute.length) {\n entry = attribute.split('=');\n result.push({\n key: deserialize(entry.shift()),\n value: deserialize(entry.join('='))\n });\n }\n }\n }\n};\n\nvar updateSearchParams = function (query) {\n this.entries.length = 0;\n parseSearchParams(this.entries, query);\n};\n\nvar validateArgumentsLength = function (passed, required) {\n if (passed < required) throw TypeError('Not enough arguments');\n};\n\nvar URLSearchParamsIterator = createIteratorConstructor(function Iterator(params, kind) {\n setInternalState(this, {\n type: URL_SEARCH_PARAMS_ITERATOR,\n iterator: getIterator(getInternalParamsState(params).entries),\n kind: kind\n });\n}, 'Iterator', function next() {\n var state = getInternalIteratorState(this);\n var kind = state.kind;\n var step = state.iterator.next();\n var entry = step.value;\n if (!step.done) {\n step.value = kind === 'keys' ? entry.key : kind === 'values' ? entry.value : [entry.key, entry.value];\n } return step;\n});\n\n// `URLSearchParams` constructor\n// https://url.spec.whatwg.org/#interface-urlsearchparams\nvar URLSearchParamsConstructor = function URLSearchParams(/* init */) {\n anInstance(this, URLSearchParamsConstructor, URL_SEARCH_PARAMS);\n var init = arguments.length > 0 ? arguments[0] : undefined;\n var that = this;\n var entries = [];\n var iteratorMethod, iterator, next, step, entryIterator, entryNext, first, second, key;\n\n setInternalState(that, {\n type: URL_SEARCH_PARAMS,\n entries: entries,\n updateURL: function () { /* empty */ },\n updateSearchParams: updateSearchParams\n });\n\n if (init !== undefined) {\n if (isObject(init)) {\n iteratorMethod = getIteratorMethod(init);\n if (typeof iteratorMethod === 'function') {\n iterator = iteratorMethod.call(init);\n next = iterator.next;\n while (!(step = next.call(iterator)).done) {\n entryIterator = getIterator(anObject(step.value));\n entryNext = entryIterator.next;\n if (\n (first = entryNext.call(entryIterator)).done ||\n (second = entryNext.call(entryIterator)).done ||\n !entryNext.call(entryIterator).done\n ) throw TypeError('Expected sequence with length 2');\n entries.push({ key: first.value + '', value: second.value + '' });\n }\n } else for (key in init) if (hasOwn(init, key)) entries.push({ key: key, value: init[key] + '' });\n } else {\n parseSearchParams(entries, typeof init === 'string' ? init.charAt(0) === '?' ? init.slice(1) : init : init + '');\n }\n }\n};\n\nvar URLSearchParamsPrototype = URLSearchParamsConstructor.prototype;\n\nredefineAll(URLSearchParamsPrototype, {\n // `URLSearchParams.prototype.appent` method\n // https://url.spec.whatwg.org/#dom-urlsearchparams-append\n append: function append(name, value) {\n validateArgumentsLength(arguments.length, 2);\n var state = getInternalParamsState(this);\n state.entries.push({ key: name + '', value: value + '' });\n state.updateURL();\n },\n // `URLSearchParams.prototype.delete` method\n // https://url.spec.whatwg.org/#dom-urlsearchparams-delete\n 'delete': function (name) {\n validateArgumentsLength(arguments.length, 1);\n var state = getInternalParamsState(this);\n var entries = state.entries;\n var key = name + '';\n var index = 0;\n while (index < entries.length) {\n if (entries[index].key === key) entries.splice(index, 1);\n else index++;\n }\n state.updateURL();\n },\n // `URLSearchParams.prototype.get` method\n // https://url.spec.whatwg.org/#dom-urlsearchparams-get\n get: function get(name) {\n validateArgumentsLength(arguments.length, 1);\n var entries = getInternalParamsState(this).entries;\n var key = name + '';\n var index = 0;\n for (; index < entries.length; index++) {\n if (entries[index].key === key) return entries[index].value;\n }\n return null;\n },\n // `URLSearchParams.prototype.getAll` method\n // https://url.spec.whatwg.org/#dom-urlsearchparams-getall\n getAll: function getAll(name) {\n validateArgumentsLength(arguments.length, 1);\n var entries = getInternalParamsState(this).entries;\n var key = name + '';\n var result = [];\n var index = 0;\n for (; index < entries.length; index++) {\n if (entries[index].key === key) result.push(entries[index].value);\n }\n return result;\n },\n // `URLSearchParams.prototype.has` method\n // https://url.spec.whatwg.org/#dom-urlsearchparams-has\n has: function has(name) {\n validateArgumentsLength(arguments.length, 1);\n var entries = getInternalParamsState(this).entries;\n var key = name + '';\n var index = 0;\n while (index < entries.length) {\n if (entries[index++].key === key) return true;\n }\n return false;\n },\n // `URLSearchParams.prototype.set` method\n // https://url.spec.whatwg.org/#dom-urlsearchparams-set\n set: function set(name, value) {\n validateArgumentsLength(arguments.length, 1);\n var state = getInternalParamsState(this);\n var entries = state.entries;\n var found = false;\n var key = name + '';\n var val = value + '';\n var index = 0;\n var entry;\n for (; index < entries.length; index++) {\n entry = entries[index];\n if (entry.key === key) {\n if (found) entries.splice(index--, 1);\n else {\n found = true;\n entry.value = val;\n }\n }\n }\n if (!found) entries.push({ key: key, value: val });\n state.updateURL();\n },\n // `URLSearchParams.prototype.sort` method\n // https://url.spec.whatwg.org/#dom-urlsearchparams-sort\n sort: function sort() {\n var state = getInternalParamsState(this);\n var entries = state.entries;\n // Array#sort is not stable in some engines\n var slice = entries.slice();\n var entry, entriesIndex, sliceIndex;\n entries.length = 0;\n for (sliceIndex = 0; sliceIndex < slice.length; sliceIndex++) {\n entry = slice[sliceIndex];\n for (entriesIndex = 0; entriesIndex < sliceIndex; entriesIndex++) {\n if (entries[entriesIndex].key > entry.key) {\n entries.splice(entriesIndex, 0, entry);\n break;\n }\n }\n if (entriesIndex === sliceIndex) entries.push(entry);\n }\n state.updateURL();\n },\n // `URLSearchParams.prototype.forEach` method\n forEach: function forEach(callback /* , thisArg */) {\n var entries = getInternalParamsState(this).entries;\n var boundFunction = bind(callback, arguments.length > 1 ? arguments[1] : undefined, 3);\n var index = 0;\n var entry;\n while (index < entries.length) {\n entry = entries[index++];\n boundFunction(entry.value, entry.key, this);\n }\n },\n // `URLSearchParams.prototype.keys` method\n keys: function keys() {\n return new URLSearchParamsIterator(this, 'keys');\n },\n // `URLSearchParams.prototype.values` method\n values: function values() {\n return new URLSearchParamsIterator(this, 'values');\n },\n // `URLSearchParams.prototype.entries` method\n entries: function entries() {\n return new URLSearchParamsIterator(this, 'entries');\n }\n}, { enumerable: true });\n\n// `URLSearchParams.prototype[@@iterator]` method\nredefine(URLSearchParamsPrototype, ITERATOR, URLSearchParamsPrototype.entries);\n\n// `URLSearchParams.prototype.toString` method\n// https://url.spec.whatwg.org/#urlsearchparams-stringification-behavior\nredefine(URLSearchParamsPrototype, 'toString', function toString() {\n var entries = getInternalParamsState(this).entries;\n var result = [];\n var index = 0;\n var entry;\n while (index < entries.length) {\n entry = entries[index++];\n result.push(serialize(entry.key) + '=' + serialize(entry.value));\n } return result.join('&');\n}, { enumerable: true });\n\nsetToStringTag(URLSearchParamsConstructor, URL_SEARCH_PARAMS);\n\n$({ global: true, forced: !USE_NATIVE_URL }, {\n URLSearchParams: URLSearchParamsConstructor\n});\n\n// Wrap `fetch` for correct work with polyfilled `URLSearchParams`\n// https://github.com/zloirock/core-js/issues/674\nif (!USE_NATIVE_URL && typeof $fetch == 'function' && typeof Headers == 'function') {\n $({ global: true, enumerable: true, forced: true }, {\n fetch: function fetch(input /* , init */) {\n var args = [input];\n var init, body, headers;\n if (arguments.length > 1) {\n init = arguments[1];\n if (isObject(init)) {\n body = init.body;\n if (classof(body) === URL_SEARCH_PARAMS) {\n headers = init.headers ? new Headers(init.headers) : new Headers();\n if (!headers.has('content-type')) {\n headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8');\n }\n init = create(init, {\n body: createPropertyDescriptor(0, String(body)),\n headers: createPropertyDescriptor(0, headers)\n });\n }\n }\n args.push(init);\n } return $fetch.apply(this, args);\n }\n });\n}\n\nmodule.exports = {\n URLSearchParams: URLSearchParamsConstructor,\n getState: getInternalParamsState\n};\n","'use strict';\n// TODO: in core-js@4, move /modules/ dependencies to public entries for better optimization by tools like `preset-env`\nrequire('../modules/es.string.iterator');\nvar $ = require('../internals/export');\nvar DESCRIPTORS = require('../internals/descriptors');\nvar USE_NATIVE_URL = require('../internals/native-url');\nvar global = require('../internals/global');\nvar defineProperties = require('../internals/object-define-properties');\nvar redefine = require('../internals/redefine');\nvar anInstance = require('../internals/an-instance');\nvar has = require('../internals/has');\nvar assign = require('../internals/object-assign');\nvar arrayFrom = require('../internals/array-from');\nvar codeAt = require('../internals/string-multibyte').codeAt;\nvar toASCII = require('../internals/string-punycode-to-ascii');\nvar setToStringTag = require('../internals/set-to-string-tag');\nvar URLSearchParamsModule = require('../modules/web.url-search-params');\nvar InternalStateModule = require('../internals/internal-state');\n\nvar NativeURL = global.URL;\nvar URLSearchParams = URLSearchParamsModule.URLSearchParams;\nvar getInternalSearchParamsState = URLSearchParamsModule.getState;\nvar setInternalState = InternalStateModule.set;\nvar getInternalURLState = InternalStateModule.getterFor('URL');\nvar floor = Math.floor;\nvar pow = Math.pow;\n\nvar INVALID_AUTHORITY = 'Invalid authority';\nvar INVALID_SCHEME = 'Invalid scheme';\nvar INVALID_HOST = 'Invalid host';\nvar INVALID_PORT = 'Invalid port';\n\nvar ALPHA = /[A-Za-z]/;\nvar ALPHANUMERIC = /[\\d+-.A-Za-z]/;\nvar DIGIT = /\\d/;\nvar HEX_START = /^(0x|0X)/;\nvar OCT = /^[0-7]+$/;\nvar DEC = /^\\d+$/;\nvar HEX = /^[\\dA-Fa-f]+$/;\n// eslint-disable-next-line no-control-regex\nvar FORBIDDEN_HOST_CODE_POINT = /[\\u0000\\u0009\\u000A\\u000D #%/:?@[\\\\]]/;\n// eslint-disable-next-line no-control-regex\nvar FORBIDDEN_HOST_CODE_POINT_EXCLUDING_PERCENT = /[\\u0000\\u0009\\u000A\\u000D #/:?@[\\\\]]/;\n// eslint-disable-next-line no-control-regex\nvar LEADING_AND_TRAILING_C0_CONTROL_OR_SPACE = /^[\\u0000-\\u001F ]+|[\\u0000-\\u001F ]+$/g;\n// eslint-disable-next-line no-control-regex\nvar TAB_AND_NEW_LINE = /[\\u0009\\u000A\\u000D]/g;\nvar EOF;\n\nvar parseHost = function (url, input) {\n var result, codePoints, index;\n if (input.charAt(0) == '[') {\n if (input.charAt(input.length - 1) != ']') return INVALID_HOST;\n result = parseIPv6(input.slice(1, -1));\n if (!result) return INVALID_HOST;\n url.host = result;\n // opaque host\n } else if (!isSpecial(url)) {\n if (FORBIDDEN_HOST_CODE_POINT_EXCLUDING_PERCENT.test(input)) return INVALID_HOST;\n result = '';\n codePoints = arrayFrom(input);\n for (index = 0; index < codePoints.length; index++) {\n result += percentEncode(codePoints[index], C0ControlPercentEncodeSet);\n }\n url.host = result;\n } else {\n input = toASCII(input);\n if (FORBIDDEN_HOST_CODE_POINT.test(input)) return INVALID_HOST;\n result = parseIPv4(input);\n if (result === null) return INVALID_HOST;\n url.host = result;\n }\n};\n\nvar parseIPv4 = function (input) {\n var parts = input.split('.');\n var partsLength, numbers, index, part, radix, number, ipv4;\n if (parts.length && parts[parts.length - 1] == '') {\n parts.pop();\n }\n partsLength = parts.length;\n if (partsLength > 4) return input;\n numbers = [];\n for (index = 0; index < partsLength; index++) {\n part = parts[index];\n if (part == '') return input;\n radix = 10;\n if (part.length > 1 && part.charAt(0) == '0') {\n radix = HEX_START.test(part) ? 16 : 8;\n part = part.slice(radix == 8 ? 1 : 2);\n }\n if (part === '') {\n number = 0;\n } else {\n if (!(radix == 10 ? DEC : radix == 8 ? OCT : HEX).test(part)) return input;\n number = parseInt(part, radix);\n }\n numbers.push(number);\n }\n for (index = 0; index < partsLength; index++) {\n number = numbers[index];\n if (index == partsLength - 1) {\n if (number >= pow(256, 5 - partsLength)) return null;\n } else if (number > 255) return null;\n }\n ipv4 = numbers.pop();\n for (index = 0; index < numbers.length; index++) {\n ipv4 += numbers[index] * pow(256, 3 - index);\n }\n return ipv4;\n};\n\n// eslint-disable-next-line max-statements\nvar parseIPv6 = function (input) {\n var address = [0, 0, 0, 0, 0, 0, 0, 0];\n var pieceIndex = 0;\n var compress = null;\n var pointer = 0;\n var value, length, numbersSeen, ipv4Piece, number, swaps, swap;\n\n var char = function () {\n return input.charAt(pointer);\n };\n\n if (char() == ':') {\n if (input.charAt(1) != ':') return;\n pointer += 2;\n pieceIndex++;\n compress = pieceIndex;\n }\n while (char()) {\n if (pieceIndex == 8) return;\n if (char() == ':') {\n if (compress !== null) return;\n pointer++;\n pieceIndex++;\n compress = pieceIndex;\n continue;\n }\n value = length = 0;\n while (length < 4 && HEX.test(char())) {\n value = value * 16 + parseInt(char(), 16);\n pointer++;\n length++;\n }\n if (char() == '.') {\n if (length == 0) return;\n pointer -= length;\n if (pieceIndex > 6) return;\n numbersSeen = 0;\n while (char()) {\n ipv4Piece = null;\n if (numbersSeen > 0) {\n if (char() == '.' && numbersSeen < 4) pointer++;\n else return;\n }\n if (!DIGIT.test(char())) return;\n while (DIGIT.test(char())) {\n number = parseInt(char(), 10);\n if (ipv4Piece === null) ipv4Piece = number;\n else if (ipv4Piece == 0) return;\n else ipv4Piece = ipv4Piece * 10 + number;\n if (ipv4Piece > 255) return;\n pointer++;\n }\n address[pieceIndex] = address[pieceIndex] * 256 + ipv4Piece;\n numbersSeen++;\n if (numbersSeen == 2 || numbersSeen == 4) pieceIndex++;\n }\n if (numbersSeen != 4) return;\n break;\n } else if (char() == ':') {\n pointer++;\n if (!char()) return;\n } else if (char()) return;\n address[pieceIndex++] = value;\n }\n if (compress !== null) {\n swaps = pieceIndex - compress;\n pieceIndex = 7;\n while (pieceIndex != 0 && swaps > 0) {\n swap = address[pieceIndex];\n address[pieceIndex--] = address[compress + swaps - 1];\n address[compress + --swaps] = swap;\n }\n } else if (pieceIndex != 8) return;\n return address;\n};\n\nvar findLongestZeroSequence = function (ipv6) {\n var maxIndex = null;\n var maxLength = 1;\n var currStart = null;\n var currLength = 0;\n var index = 0;\n for (; index < 8; index++) {\n if (ipv6[index] !== 0) {\n if (currLength > maxLength) {\n maxIndex = currStart;\n maxLength = currLength;\n }\n currStart = null;\n currLength = 0;\n } else {\n if (currStart === null) currStart = index;\n ++currLength;\n }\n }\n if (currLength > maxLength) {\n maxIndex = currStart;\n maxLength = currLength;\n }\n return maxIndex;\n};\n\nvar serializeHost = function (host) {\n var result, index, compress, ignore0;\n // ipv4\n if (typeof host == 'number') {\n result = [];\n for (index = 0; index < 4; index++) {\n result.unshift(host % 256);\n host = floor(host / 256);\n } return result.join('.');\n // ipv6\n } else if (typeof host == 'object') {\n result = '';\n compress = findLongestZeroSequence(host);\n for (index = 0; index < 8; index++) {\n if (ignore0 && host[index] === 0) continue;\n if (ignore0) ignore0 = false;\n if (compress === index) {\n result += index ? ':' : '::';\n ignore0 = true;\n } else {\n result += host[index].toString(16);\n if (index < 7) result += ':';\n }\n }\n return '[' + result + ']';\n } return host;\n};\n\nvar C0ControlPercentEncodeSet = {};\nvar fragmentPercentEncodeSet = assign({}, C0ControlPercentEncodeSet, {\n ' ': 1, '\"': 1, '<': 1, '>': 1, '`': 1\n});\nvar pathPercentEncodeSet = assign({}, fragmentPercentEncodeSet, {\n '#': 1, '?': 1, '{': 1, '}': 1\n});\nvar userinfoPercentEncodeSet = assign({}, pathPercentEncodeSet, {\n '/': 1, ':': 1, ';': 1, '=': 1, '@': 1, '[': 1, '\\\\': 1, ']': 1, '^': 1, '|': 1\n});\n\nvar percentEncode = function (char, set) {\n var code = codeAt(char, 0);\n return code > 0x20 && code < 0x7F && !has(set, char) ? char : encodeURIComponent(char);\n};\n\nvar specialSchemes = {\n ftp: 21,\n file: null,\n http: 80,\n https: 443,\n ws: 80,\n wss: 443\n};\n\nvar isSpecial = function (url) {\n return has(specialSchemes, url.scheme);\n};\n\nvar includesCredentials = function (url) {\n return url.username != '' || url.password != '';\n};\n\nvar cannotHaveUsernamePasswordPort = function (url) {\n return !url.host || url.cannotBeABaseURL || url.scheme == 'file';\n};\n\nvar isWindowsDriveLetter = function (string, normalized) {\n var second;\n return string.length == 2 && ALPHA.test(string.charAt(0))\n && ((second = string.charAt(1)) == ':' || (!normalized && second == '|'));\n};\n\nvar startsWithWindowsDriveLetter = function (string) {\n var third;\n return string.length > 1 && isWindowsDriveLetter(string.slice(0, 2)) && (\n string.length == 2 ||\n ((third = string.charAt(2)) === '/' || third === '\\\\' || third === '?' || third === '#')\n );\n};\n\nvar shortenURLsPath = function (url) {\n var path = url.path;\n var pathSize = path.length;\n if (pathSize && (url.scheme != 'file' || pathSize != 1 || !isWindowsDriveLetter(path[0], true))) {\n path.pop();\n }\n};\n\nvar isSingleDot = function (segment) {\n return segment === '.' || segment.toLowerCase() === '%2e';\n};\n\nvar isDoubleDot = function (segment) {\n segment = segment.toLowerCase();\n return segment === '..' || segment === '%2e.' || segment === '.%2e' || segment === '%2e%2e';\n};\n\n// States:\nvar SCHEME_START = {};\nvar SCHEME = {};\nvar NO_SCHEME = {};\nvar SPECIAL_RELATIVE_OR_AUTHORITY = {};\nvar PATH_OR_AUTHORITY = {};\nvar RELATIVE = {};\nvar RELATIVE_SLASH = {};\nvar SPECIAL_AUTHORITY_SLASHES = {};\nvar SPECIAL_AUTHORITY_IGNORE_SLASHES = {};\nvar AUTHORITY = {};\nvar HOST = {};\nvar HOSTNAME = {};\nvar PORT = {};\nvar FILE = {};\nvar FILE_SLASH = {};\nvar FILE_HOST = {};\nvar PATH_START = {};\nvar PATH = {};\nvar CANNOT_BE_A_BASE_URL_PATH = {};\nvar QUERY = {};\nvar FRAGMENT = {};\n\n// eslint-disable-next-line max-statements\nvar parseURL = function (url, input, stateOverride, base) {\n var state = stateOverride || SCHEME_START;\n var pointer = 0;\n var buffer = '';\n var seenAt = false;\n var seenBracket = false;\n var seenPasswordToken = false;\n var codePoints, char, bufferCodePoints, failure;\n\n if (!stateOverride) {\n url.scheme = '';\n url.username = '';\n url.password = '';\n url.host = null;\n url.port = null;\n url.path = [];\n url.query = null;\n url.fragment = null;\n url.cannotBeABaseURL = false;\n input = input.replace(LEADING_AND_TRAILING_C0_CONTROL_OR_SPACE, '');\n }\n\n input = input.replace(TAB_AND_NEW_LINE, '');\n\n codePoints = arrayFrom(input);\n\n while (pointer <= codePoints.length) {\n char = codePoints[pointer];\n switch (state) {\n case SCHEME_START:\n if (char && ALPHA.test(char)) {\n buffer += char.toLowerCase();\n state = SCHEME;\n } else if (!stateOverride) {\n state = NO_SCHEME;\n continue;\n } else return INVALID_SCHEME;\n break;\n\n case SCHEME:\n if (char && (ALPHANUMERIC.test(char) || char == '+' || char == '-' || char == '.')) {\n buffer += char.toLowerCase();\n } else if (char == ':') {\n if (stateOverride && (\n (isSpecial(url) != has(specialSchemes, buffer)) ||\n (buffer == 'file' && (includesCredentials(url) || url.port !== null)) ||\n (url.scheme == 'file' && !url.host)\n )) return;\n url.scheme = buffer;\n if (stateOverride) {\n if (isSpecial(url) && specialSchemes[url.scheme] == url.port) url.port = null;\n return;\n }\n buffer = '';\n if (url.scheme == 'file') {\n state = FILE;\n } else if (isSpecial(url) && base && base.scheme == url.scheme) {\n state = SPECIAL_RELATIVE_OR_AUTHORITY;\n } else if (isSpecial(url)) {\n state = SPECIAL_AUTHORITY_SLASHES;\n } else if (codePoints[pointer + 1] == '/') {\n state = PATH_OR_AUTHORITY;\n pointer++;\n } else {\n url.cannotBeABaseURL = true;\n url.path.push('');\n state = CANNOT_BE_A_BASE_URL_PATH;\n }\n } else if (!stateOverride) {\n buffer = '';\n state = NO_SCHEME;\n pointer = 0;\n continue;\n } else return INVALID_SCHEME;\n break;\n\n case NO_SCHEME:\n if (!base || (base.cannotBeABaseURL && char != '#')) return INVALID_SCHEME;\n if (base.cannotBeABaseURL && char == '#') {\n url.scheme = base.scheme;\n url.path = base.path.slice();\n url.query = base.query;\n url.fragment = '';\n url.cannotBeABaseURL = true;\n state = FRAGMENT;\n break;\n }\n state = base.scheme == 'file' ? FILE : RELATIVE;\n continue;\n\n case SPECIAL_RELATIVE_OR_AUTHORITY:\n if (char == '/' && codePoints[pointer + 1] == '/') {\n state = SPECIAL_AUTHORITY_IGNORE_SLASHES;\n pointer++;\n } else {\n state = RELATIVE;\n continue;\n } break;\n\n case PATH_OR_AUTHORITY:\n if (char == '/') {\n state = AUTHORITY;\n break;\n } else {\n state = PATH;\n continue;\n }\n\n case RELATIVE:\n url.scheme = base.scheme;\n if (char == EOF) {\n url.username = base.username;\n url.password = base.password;\n url.host = base.host;\n url.port = base.port;\n url.path = base.path.slice();\n url.query = base.query;\n } else if (char == '/' || (char == '\\\\' && isSpecial(url))) {\n state = RELATIVE_SLASH;\n } else if (char == '?') {\n url.username = base.username;\n url.password = base.password;\n url.host = base.host;\n url.port = base.port;\n url.path = base.path.slice();\n url.query = '';\n state = QUERY;\n } else if (char == '#') {\n url.username = base.username;\n url.password = base.password;\n url.host = base.host;\n url.port = base.port;\n url.path = base.path.slice();\n url.query = base.query;\n url.fragment = '';\n state = FRAGMENT;\n } else {\n url.username = base.username;\n url.password = base.password;\n url.host = base.host;\n url.port = base.port;\n url.path = base.path.slice();\n url.path.pop();\n state = PATH;\n continue;\n } break;\n\n case RELATIVE_SLASH:\n if (isSpecial(url) && (char == '/' || char == '\\\\')) {\n state = SPECIAL_AUTHORITY_IGNORE_SLASHES;\n } else if (char == '/') {\n state = AUTHORITY;\n } else {\n url.username = base.username;\n url.password = base.password;\n url.host = base.host;\n url.port = base.port;\n state = PATH;\n continue;\n } break;\n\n case SPECIAL_AUTHORITY_SLASHES:\n state = SPECIAL_AUTHORITY_IGNORE_SLASHES;\n if (char != '/' || buffer.charAt(pointer + 1) != '/') continue;\n pointer++;\n break;\n\n case SPECIAL_AUTHORITY_IGNORE_SLASHES:\n if (char != '/' && char != '\\\\') {\n state = AUTHORITY;\n continue;\n } break;\n\n case AUTHORITY:\n if (char == '@') {\n if (seenAt) buffer = '%40' + buffer;\n seenAt = true;\n bufferCodePoints = arrayFrom(buffer);\n for (var i = 0; i < bufferCodePoints.length; i++) {\n var codePoint = bufferCodePoints[i];\n if (codePoint == ':' && !seenPasswordToken) {\n seenPasswordToken = true;\n continue;\n }\n var encodedCodePoints = percentEncode(codePoint, userinfoPercentEncodeSet);\n if (seenPasswordToken) url.password += encodedCodePoints;\n else url.username += encodedCodePoints;\n }\n buffer = '';\n } else if (\n char == EOF || char == '/' || char == '?' || char == '#' ||\n (char == '\\\\' && isSpecial(url))\n ) {\n if (seenAt && buffer == '') return INVALID_AUTHORITY;\n pointer -= arrayFrom(buffer).length + 1;\n buffer = '';\n state = HOST;\n } else buffer += char;\n break;\n\n case HOST:\n case HOSTNAME:\n if (stateOverride && url.scheme == 'file') {\n state = FILE_HOST;\n continue;\n } else if (char == ':' && !seenBracket) {\n if (buffer == '') return INVALID_HOST;\n failure = parseHost(url, buffer);\n if (failure) return failure;\n buffer = '';\n state = PORT;\n if (stateOverride == HOSTNAME) return;\n } else if (\n char == EOF || char == '/' || char == '?' || char == '#' ||\n (char == '\\\\' && isSpecial(url))\n ) {\n if (isSpecial(url) && buffer == '') return INVALID_HOST;\n if (stateOverride && buffer == '' && (includesCredentials(url) || url.port !== null)) return;\n failure = parseHost(url, buffer);\n if (failure) return failure;\n buffer = '';\n state = PATH_START;\n if (stateOverride) return;\n continue;\n } else {\n if (char == '[') seenBracket = true;\n else if (char == ']') seenBracket = false;\n buffer += char;\n } break;\n\n case PORT:\n if (DIGIT.test(char)) {\n buffer += char;\n } else if (\n char == EOF || char == '/' || char == '?' || char == '#' ||\n (char == '\\\\' && isSpecial(url)) ||\n stateOverride\n ) {\n if (buffer != '') {\n var port = parseInt(buffer, 10);\n if (port > 0xFFFF) return INVALID_PORT;\n url.port = (isSpecial(url) && port === specialSchemes[url.scheme]) ? null : port;\n buffer = '';\n }\n if (stateOverride) return;\n state = PATH_START;\n continue;\n } else return INVALID_PORT;\n break;\n\n case FILE:\n url.scheme = 'file';\n if (char == '/' || char == '\\\\') state = FILE_SLASH;\n else if (base && base.scheme == 'file') {\n if (char == EOF) {\n url.host = base.host;\n url.path = base.path.slice();\n url.query = base.query;\n } else if (char == '?') {\n url.host = base.host;\n url.path = base.path.slice();\n url.query = '';\n state = QUERY;\n } else if (char == '#') {\n url.host = base.host;\n url.path = base.path.slice();\n url.query = base.query;\n url.fragment = '';\n state = FRAGMENT;\n } else {\n if (!startsWithWindowsDriveLetter(codePoints.slice(pointer).join(''))) {\n url.host = base.host;\n url.path = base.path.slice();\n shortenURLsPath(url);\n }\n state = PATH;\n continue;\n }\n } else {\n state = PATH;\n continue;\n } break;\n\n case FILE_SLASH:\n if (char == '/' || char == '\\\\') {\n state = FILE_HOST;\n break;\n }\n if (base && base.scheme == 'file' && !startsWithWindowsDriveLetter(codePoints.slice(pointer).join(''))) {\n if (isWindowsDriveLetter(base.path[0], true)) url.path.push(base.path[0]);\n else url.host = base.host;\n }\n state = PATH;\n continue;\n\n case FILE_HOST:\n if (char == EOF || char == '/' || char == '\\\\' || char == '?' || char == '#') {\n if (!stateOverride && isWindowsDriveLetter(buffer)) {\n state = PATH;\n } else if (buffer == '') {\n url.host = '';\n if (stateOverride) return;\n state = PATH_START;\n } else {\n failure = parseHost(url, buffer);\n if (failure) return failure;\n if (url.host == 'localhost') url.host = '';\n if (stateOverride) return;\n buffer = '';\n state = PATH_START;\n } continue;\n } else buffer += char;\n break;\n\n case PATH_START:\n if (isSpecial(url)) {\n state = PATH;\n if (char != '/' && char != '\\\\') continue;\n } else if (!stateOverride && char == '?') {\n url.query = '';\n state = QUERY;\n } else if (!stateOverride && char == '#') {\n url.fragment = '';\n state = FRAGMENT;\n } else if (char != EOF) {\n state = PATH;\n if (char != '/') continue;\n } break;\n\n case PATH:\n if (\n char == EOF || char == '/' ||\n (char == '\\\\' && isSpecial(url)) ||\n (!stateOverride && (char == '?' || char == '#'))\n ) {\n if (isDoubleDot(buffer)) {\n shortenURLsPath(url);\n if (char != '/' && !(char == '\\\\' && isSpecial(url))) {\n url.path.push('');\n }\n } else if (isSingleDot(buffer)) {\n if (char != '/' && !(char == '\\\\' && isSpecial(url))) {\n url.path.push('');\n }\n } else {\n if (url.scheme == 'file' && !url.path.length && isWindowsDriveLetter(buffer)) {\n if (url.host) url.host = '';\n buffer = buffer.charAt(0) + ':'; // normalize windows drive letter\n }\n url.path.push(buffer);\n }\n buffer = '';\n if (url.scheme == 'file' && (char == EOF || char == '?' || char == '#')) {\n while (url.path.length > 1 && url.path[0] === '') {\n url.path.shift();\n }\n }\n if (char == '?') {\n url.query = '';\n state = QUERY;\n } else if (char == '#') {\n url.fragment = '';\n state = FRAGMENT;\n }\n } else {\n buffer += percentEncode(char, pathPercentEncodeSet);\n } break;\n\n case CANNOT_BE_A_BASE_URL_PATH:\n if (char == '?') {\n url.query = '';\n state = QUERY;\n } else if (char == '#') {\n url.fragment = '';\n state = FRAGMENT;\n } else if (char != EOF) {\n url.path[0] += percentEncode(char, C0ControlPercentEncodeSet);\n } break;\n\n case QUERY:\n if (!stateOverride && char == '#') {\n url.fragment = '';\n state = FRAGMENT;\n } else if (char != EOF) {\n if (char == \"'\" && isSpecial(url)) url.query += '%27';\n else if (char == '#') url.query += '%23';\n else url.query += percentEncode(char, C0ControlPercentEncodeSet);\n } break;\n\n case FRAGMENT:\n if (char != EOF) url.fragment += percentEncode(char, fragmentPercentEncodeSet);\n break;\n }\n\n pointer++;\n }\n};\n\n// `URL` constructor\n// https://url.spec.whatwg.org/#url-class\nvar URLConstructor = function URL(url /* , base */) {\n var that = anInstance(this, URLConstructor, 'URL');\n var base = arguments.length > 1 ? arguments[1] : undefined;\n var urlString = String(url);\n var state = setInternalState(that, { type: 'URL' });\n var baseState, failure;\n if (base !== undefined) {\n if (base instanceof URLConstructor) baseState = getInternalURLState(base);\n else {\n failure = parseURL(baseState = {}, String(base));\n if (failure) throw TypeError(failure);\n }\n }\n failure = parseURL(state, urlString, null, baseState);\n if (failure) throw TypeError(failure);\n var searchParams = state.searchParams = new URLSearchParams();\n var searchParamsState = getInternalSearchParamsState(searchParams);\n searchParamsState.updateSearchParams(state.query);\n searchParamsState.updateURL = function () {\n state.query = String(searchParams) || null;\n };\n if (!DESCRIPTORS) {\n that.href = serializeURL.call(that);\n that.origin = getOrigin.call(that);\n that.protocol = getProtocol.call(that);\n that.username = getUsername.call(that);\n that.password = getPassword.call(that);\n that.host = getHost.call(that);\n that.hostname = getHostname.call(that);\n that.port = getPort.call(that);\n that.pathname = getPathname.call(that);\n that.search = getSearch.call(that);\n that.searchParams = getSearchParams.call(that);\n that.hash = getHash.call(that);\n }\n};\n\nvar URLPrototype = URLConstructor.prototype;\n\nvar serializeURL = function () {\n var url = getInternalURLState(this);\n var scheme = url.scheme;\n var username = url.username;\n var password = url.password;\n var host = url.host;\n var port = url.port;\n var path = url.path;\n var query = url.query;\n var fragment = url.fragment;\n var output = scheme + ':';\n if (host !== null) {\n output += '//';\n if (includesCredentials(url)) {\n output += username + (password ? ':' + password : '') + '@';\n }\n output += serializeHost(host);\n if (port !== null) output += ':' + port;\n } else if (scheme == 'file') output += '//';\n output += url.cannotBeABaseURL ? path[0] : path.length ? '/' + path.join('/') : '';\n if (query !== null) output += '?' + query;\n if (fragment !== null) output += '#' + fragment;\n return output;\n};\n\nvar getOrigin = function () {\n var url = getInternalURLState(this);\n var scheme = url.scheme;\n var port = url.port;\n if (scheme == 'blob') try {\n return new URL(scheme.path[0]).origin;\n } catch (error) {\n return 'null';\n }\n if (scheme == 'file' || !isSpecial(url)) return 'null';\n return scheme + '://' + serializeHost(url.host) + (port !== null ? ':' + port : '');\n};\n\nvar getProtocol = function () {\n return getInternalURLState(this).scheme + ':';\n};\n\nvar getUsername = function () {\n return getInternalURLState(this).username;\n};\n\nvar getPassword = function () {\n return getInternalURLState(this).password;\n};\n\nvar getHost = function () {\n var url = getInternalURLState(this);\n var host = url.host;\n var port = url.port;\n return host === null ? ''\n : port === null ? serializeHost(host)\n : serializeHost(host) + ':' + port;\n};\n\nvar getHostname = function () {\n var host = getInternalURLState(this).host;\n return host === null ? '' : serializeHost(host);\n};\n\nvar getPort = function () {\n var port = getInternalURLState(this).port;\n return port === null ? '' : String(port);\n};\n\nvar getPathname = function () {\n var url = getInternalURLState(this);\n var path = url.path;\n return url.cannotBeABaseURL ? path[0] : path.length ? '/' + path.join('/') : '';\n};\n\nvar getSearch = function () {\n var query = getInternalURLState(this).query;\n return query ? '?' + query : '';\n};\n\nvar getSearchParams = function () {\n return getInternalURLState(this).searchParams;\n};\n\nvar getHash = function () {\n var fragment = getInternalURLState(this).fragment;\n return fragment ? '#' + fragment : '';\n};\n\nvar accessorDescriptor = function (getter, setter) {\n return { get: getter, set: setter, configurable: true, enumerable: true };\n};\n\nif (DESCRIPTORS) {\n defineProperties(URLPrototype, {\n // `URL.prototype.href` accessors pair\n // https://url.spec.whatwg.org/#dom-url-href\n href: accessorDescriptor(serializeURL, function (href) {\n var url = getInternalURLState(this);\n var urlString = String(href);\n var failure = parseURL(url, urlString);\n if (failure) throw TypeError(failure);\n getInternalSearchParamsState(url.searchParams).updateSearchParams(url.query);\n }),\n // `URL.prototype.origin` getter\n // https://url.spec.whatwg.org/#dom-url-origin\n origin: accessorDescriptor(getOrigin),\n // `URL.prototype.protocol` accessors pair\n // https://url.spec.whatwg.org/#dom-url-protocol\n protocol: accessorDescriptor(getProtocol, function (protocol) {\n var url = getInternalURLState(this);\n parseURL(url, String(protocol) + ':', SCHEME_START);\n }),\n // `URL.prototype.username` accessors pair\n // https://url.spec.whatwg.org/#dom-url-username\n username: accessorDescriptor(getUsername, function (username) {\n var url = getInternalURLState(this);\n var codePoints = arrayFrom(String(username));\n if (cannotHaveUsernamePasswordPort(url)) return;\n url.username = '';\n for (var i = 0; i < codePoints.length; i++) {\n url.username += percentEncode(codePoints[i], userinfoPercentEncodeSet);\n }\n }),\n // `URL.prototype.password` accessors pair\n // https://url.spec.whatwg.org/#dom-url-password\n password: accessorDescriptor(getPassword, function (password) {\n var url = getInternalURLState(this);\n var codePoints = arrayFrom(String(password));\n if (cannotHaveUsernamePasswordPort(url)) return;\n url.password = '';\n for (var i = 0; i < codePoints.length; i++) {\n url.password += percentEncode(codePoints[i], userinfoPercentEncodeSet);\n }\n }),\n // `URL.prototype.host` accessors pair\n // https://url.spec.whatwg.org/#dom-url-host\n host: accessorDescriptor(getHost, function (host) {\n var url = getInternalURLState(this);\n if (url.cannotBeABaseURL) return;\n parseURL(url, String(host), HOST);\n }),\n // `URL.prototype.hostname` accessors pair\n // https://url.spec.whatwg.org/#dom-url-hostname\n hostname: accessorDescriptor(getHostname, function (hostname) {\n var url = getInternalURLState(this);\n if (url.cannotBeABaseURL) return;\n parseURL(url, String(hostname), HOSTNAME);\n }),\n // `URL.prototype.port` accessors pair\n // https://url.spec.whatwg.org/#dom-url-port\n port: accessorDescriptor(getPort, function (port) {\n var url = getInternalURLState(this);\n if (cannotHaveUsernamePasswordPort(url)) return;\n port = String(port);\n if (port == '') url.port = null;\n else parseURL(url, port, PORT);\n }),\n // `URL.prototype.pathname` accessors pair\n // https://url.spec.whatwg.org/#dom-url-pathname\n pathname: accessorDescriptor(getPathname, function (pathname) {\n var url = getInternalURLState(this);\n if (url.cannotBeABaseURL) return;\n url.path = [];\n parseURL(url, pathname + '', PATH_START);\n }),\n // `URL.prototype.search` accessors pair\n // https://url.spec.whatwg.org/#dom-url-search\n search: accessorDescriptor(getSearch, function (search) {\n var url = getInternalURLState(this);\n search = String(search);\n if (search == '') {\n url.query = null;\n } else {\n if ('?' == search.charAt(0)) search = search.slice(1);\n url.query = '';\n parseURL(url, search, QUERY);\n }\n getInternalSearchParamsState(url.searchParams).updateSearchParams(url.query);\n }),\n // `URL.prototype.searchParams` getter\n // https://url.spec.whatwg.org/#dom-url-searchparams\n searchParams: accessorDescriptor(getSearchParams),\n // `URL.prototype.hash` accessors pair\n // https://url.spec.whatwg.org/#dom-url-hash\n hash: accessorDescriptor(getHash, function (hash) {\n var url = getInternalURLState(this);\n hash = String(hash);\n if (hash == '') {\n url.fragment = null;\n return;\n }\n if ('#' == hash.charAt(0)) hash = hash.slice(1);\n url.fragment = '';\n parseURL(url, hash, FRAGMENT);\n })\n });\n}\n\n// `URL.prototype.toJSON` method\n// https://url.spec.whatwg.org/#dom-url-tojson\nredefine(URLPrototype, 'toJSON', function toJSON() {\n return serializeURL.call(this);\n}, { enumerable: true });\n\n// `URL.prototype.toString` method\n// https://url.spec.whatwg.org/#URL-stringification-behavior\nredefine(URLPrototype, 'toString', function toString() {\n return serializeURL.call(this);\n}, { enumerable: true });\n\nif (NativeURL) {\n var nativeCreateObjectURL = NativeURL.createObjectURL;\n var nativeRevokeObjectURL = NativeURL.revokeObjectURL;\n // `URL.createObjectURL` method\n // https://developer.mozilla.org/en-US/docs/Web/API/URL/createObjectURL\n // eslint-disable-next-line no-unused-vars\n if (nativeCreateObjectURL) redefine(URLConstructor, 'createObjectURL', function createObjectURL(blob) {\n return nativeCreateObjectURL.apply(NativeURL, arguments);\n });\n // `URL.revokeObjectURL` method\n // https://developer.mozilla.org/en-US/docs/Web/API/URL/revokeObjectURL\n // eslint-disable-next-line no-unused-vars\n if (nativeRevokeObjectURL) redefine(URLConstructor, 'revokeObjectURL', function revokeObjectURL(url) {\n return nativeRevokeObjectURL.apply(NativeURL, arguments);\n });\n}\n\nsetToStringTag(URLConstructor, 'URL');\n\n$({ global: true, forced: !USE_NATIVE_URL, sham: !DESCRIPTORS }, {\n URL: URLConstructor\n});\n","(function(global) {\r\n /**\r\n * Polyfill URLSearchParams\r\n *\r\n * Inspired from : https://github.com/WebReflection/url-search-params/blob/master/src/url-search-params.js\r\n */\r\n\r\n var checkIfIteratorIsSupported = function() {\r\n try {\r\n return !!Symbol.iterator;\r\n } catch (error) {\r\n return false;\r\n }\r\n };\r\n\r\n\r\n var iteratorSupported = checkIfIteratorIsSupported();\r\n\r\n var createIterator = function(items) {\r\n var iterator = {\r\n next: function() {\r\n var value = items.shift();\r\n return { done: value === void 0, value: value };\r\n }\r\n };\r\n\r\n if (iteratorSupported) {\r\n iterator[Symbol.iterator] = function() {\r\n return iterator;\r\n };\r\n }\r\n\r\n return iterator;\r\n };\r\n\r\n /**\r\n * Search param name and values should be encoded according to https://url.spec.whatwg.org/#urlencoded-serializing\r\n * encodeURIComponent() produces the same result except encoding spaces as `%20` instead of `+`.\r\n */\r\n var serializeParam = function(value) {\r\n return encodeURIComponent(value).replace(/%20/g, '+');\r\n };\r\n\r\n var deserializeParam = function(value) {\r\n return decodeURIComponent(String(value).replace(/\\+/g, ' '));\r\n };\r\n\r\n var polyfillURLSearchParams = function() {\r\n\r\n var URLSearchParams = function(searchString) {\r\n Object.defineProperty(this, '_entries', { writable: true, value: {} });\r\n var typeofSearchString = typeof searchString;\r\n\r\n if (typeofSearchString === 'undefined') {\r\n // do nothing\r\n } else if (typeofSearchString === 'string') {\r\n if (searchString !== '') {\r\n this._fromString(searchString);\r\n }\r\n } else if (searchString instanceof URLSearchParams) {\r\n var _this = this;\r\n searchString.forEach(function(value, name) {\r\n _this.append(name, value);\r\n });\r\n } else if ((searchString !== null) && (typeofSearchString === 'object')) {\r\n if (Object.prototype.toString.call(searchString) === '[object Array]') {\r\n for (var i = 0; i < searchString.length; i++) {\r\n var entry = searchString[i];\r\n if ((Object.prototype.toString.call(entry) === '[object Array]') || (entry.length !== 2)) {\r\n this.append(entry[0], entry[1]);\r\n } else {\r\n throw new TypeError('Expected [string, any] as entry at index ' + i + ' of URLSearchParams\\'s input');\r\n }\r\n }\r\n } else {\r\n for (var key in searchString) {\r\n if (searchString.hasOwnProperty(key)) {\r\n this.append(key, searchString[key]);\r\n }\r\n }\r\n }\r\n } else {\r\n throw new TypeError('Unsupported input\\'s type for URLSearchParams');\r\n }\r\n };\r\n\r\n var proto = URLSearchParams.prototype;\r\n\r\n proto.append = function(name, value) {\r\n if (name in this._entries) {\r\n this._entries[name].push(String(value));\r\n } else {\r\n this._entries[name] = [String(value)];\r\n }\r\n };\r\n\r\n proto.delete = function(name) {\r\n delete this._entries[name];\r\n };\r\n\r\n proto.get = function(name) {\r\n return (name in this._entries) ? this._entries[name][0] : null;\r\n };\r\n\r\n proto.getAll = function(name) {\r\n return (name in this._entries) ? this._entries[name].slice(0) : [];\r\n };\r\n\r\n proto.has = function(name) {\r\n return (name in this._entries);\r\n };\r\n\r\n proto.set = function(name, value) {\r\n this._entries[name] = [String(value)];\r\n };\r\n\r\n proto.forEach = function(callback, thisArg) {\r\n var entries;\r\n for (var name in this._entries) {\r\n if (this._entries.hasOwnProperty(name)) {\r\n entries = this._entries[name];\r\n for (var i = 0; i < entries.length; i++) {\r\n callback.call(thisArg, entries[i], name, this);\r\n }\r\n }\r\n }\r\n };\r\n\r\n proto.keys = function() {\r\n var items = [];\r\n this.forEach(function(value, name) {\r\n items.push(name);\r\n });\r\n return createIterator(items);\r\n };\r\n\r\n proto.values = function() {\r\n var items = [];\r\n this.forEach(function(value) {\r\n items.push(value);\r\n });\r\n return createIterator(items);\r\n };\r\n\r\n proto.entries = function() {\r\n var items = [];\r\n this.forEach(function(value, name) {\r\n items.push([name, value]);\r\n });\r\n return createIterator(items);\r\n };\r\n\r\n if (iteratorSupported) {\r\n proto[Symbol.iterator] = proto.entries;\r\n }\r\n\r\n proto.toString = function() {\r\n var searchArray = [];\r\n this.forEach(function(value, name) {\r\n searchArray.push(serializeParam(name) + '=' + serializeParam(value));\r\n });\r\n return searchArray.join('&');\r\n };\r\n\r\n\r\n global.URLSearchParams = URLSearchParams;\r\n };\r\n\r\n var checkIfURLSearchParamsSupported = function() {\r\n try {\r\n var URLSearchParams = global.URLSearchParams;\r\n\r\n return (new URLSearchParams('?a=1').toString() === 'a=1') && (typeof URLSearchParams.prototype.set === 'function');\r\n } catch (e) {\r\n return false;\r\n }\r\n };\r\n\r\n if (!checkIfURLSearchParamsSupported()) {\r\n polyfillURLSearchParams();\r\n }\r\n\r\n var proto = global.URLSearchParams.prototype;\r\n\r\n if (typeof proto.sort !== 'function') {\r\n proto.sort = function() {\r\n var _this = this;\r\n var items = [];\r\n this.forEach(function(value, name) {\r\n items.push([name, value]);\r\n if (!_this._entries) {\r\n _this.delete(name);\r\n }\r\n });\r\n items.sort(function(a, b) {\r\n if (a[0] < b[0]) {\r\n return -1;\r\n } else if (a[0] > b[0]) {\r\n return +1;\r\n } else {\r\n return 0;\r\n }\r\n });\r\n if (_this._entries) { // force reset because IE keeps keys index\r\n _this._entries = {};\r\n }\r\n for (var i = 0; i < items.length; i++) {\r\n this.append(items[i][0], items[i][1]);\r\n }\r\n };\r\n }\r\n\r\n if (typeof proto._fromString !== 'function') {\r\n Object.defineProperty(proto, '_fromString', {\r\n enumerable: false,\r\n configurable: false,\r\n writable: false,\r\n value: function(searchString) {\r\n if (this._entries) {\r\n this._entries = {};\r\n } else {\r\n var keys = [];\r\n this.forEach(function(value, name) {\r\n keys.push(name);\r\n });\r\n for (var i = 0; i < keys.length; i++) {\r\n this.delete(keys[i]);\r\n }\r\n }\r\n\r\n searchString = searchString.replace(/^\\?/, '');\r\n var attributes = searchString.split('&');\r\n var attribute;\r\n for (var i = 0; i < attributes.length; i++) {\r\n attribute = attributes[i].split('=');\r\n this.append(\r\n deserializeParam(attribute[0]),\r\n (attribute.length > 1) ? deserializeParam(attribute[1]) : ''\r\n );\r\n }\r\n }\r\n });\r\n }\r\n\r\n // HTMLAnchorElement\r\n\r\n})(\r\n (typeof global !== 'undefined') ? global\r\n : ((typeof window !== 'undefined') ? window\r\n : ((typeof self !== 'undefined') ? self : this))\r\n);\r\n\r\n(function(global) {\r\n /**\r\n * Polyfill URL\r\n *\r\n * Inspired from : https://github.com/arv/DOM-URL-Polyfill/blob/master/src/url.js\r\n */\r\n\r\n var checkIfURLIsSupported = function() {\r\n try {\r\n var u = new global.URL('b', 'http://a');\r\n u.pathname = 'c d';\r\n return (u.href === 'http://a/c%20d') && u.searchParams;\r\n } catch (e) {\r\n return false;\r\n }\r\n };\r\n\r\n\r\n var polyfillURL = function() {\r\n var _URL = global.URL;\r\n\r\n var URL = function(url, base) {\r\n if (typeof url !== 'string') url = String(url);\r\n\r\n // Only create another document if the base is different from current location.\r\n var doc = document, baseElement;\r\n if (base && (global.location === void 0 || base !== global.location.href)) {\r\n doc = document.implementation.createHTMLDocument('');\r\n baseElement = doc.createElement('base');\r\n baseElement.href = base;\r\n doc.head.appendChild(baseElement);\r\n try {\r\n if (baseElement.href.indexOf(base) !== 0) throw new Error(baseElement.href);\r\n } catch (err) {\r\n throw new Error('URL unable to set base ' + base + ' due to ' + err);\r\n }\r\n }\r\n\r\n var anchorElement = doc.createElement('a');\r\n anchorElement.href = url;\r\n if (baseElement) {\r\n doc.body.appendChild(anchorElement);\r\n anchorElement.href = anchorElement.href; // force href to refresh\r\n }\r\n\r\n var inputElement = doc.createElement('input');\r\n inputElement.type = 'url';\r\n inputElement.value = url;\r\n\r\n if (anchorElement.protocol === ':' || !/:/.test(anchorElement.href) || (!inputElement.checkValidity() && !base)) {\r\n throw new TypeError('Invalid URL');\r\n }\r\n\r\n Object.defineProperty(this, '_anchorElement', {\r\n value: anchorElement\r\n });\r\n\r\n\r\n // create a linked searchParams which reflect its changes on URL\r\n var searchParams = new global.URLSearchParams(this.search);\r\n var enableSearchUpdate = true;\r\n var enableSearchParamsUpdate = true;\r\n var _this = this;\r\n ['append', 'delete', 'set'].forEach(function(methodName) {\r\n var method = searchParams[methodName];\r\n searchParams[methodName] = function() {\r\n method.apply(searchParams, arguments);\r\n if (enableSearchUpdate) {\r\n enableSearchParamsUpdate = false;\r\n _this.search = searchParams.toString();\r\n enableSearchParamsUpdate = true;\r\n }\r\n };\r\n });\r\n\r\n Object.defineProperty(this, 'searchParams', {\r\n value: searchParams,\r\n enumerable: true\r\n });\r\n\r\n var search = void 0;\r\n Object.defineProperty(this, '_updateSearchParams', {\r\n enumerable: false,\r\n configurable: false,\r\n writable: false,\r\n value: function() {\r\n if (this.search !== search) {\r\n search = this.search;\r\n if (enableSearchParamsUpdate) {\r\n enableSearchUpdate = false;\r\n this.searchParams._fromString(this.search);\r\n enableSearchUpdate = true;\r\n }\r\n }\r\n }\r\n });\r\n };\r\n\r\n var proto = URL.prototype;\r\n\r\n var linkURLWithAnchorAttribute = function(attributeName) {\r\n Object.defineProperty(proto, attributeName, {\r\n get: function() {\r\n return this._anchorElement[attributeName];\r\n },\r\n set: function(value) {\r\n this._anchorElement[attributeName] = value;\r\n },\r\n enumerable: true\r\n });\r\n };\r\n\r\n ['hash', 'host', 'hostname', 'port', 'protocol']\r\n .forEach(function(attributeName) {\r\n linkURLWithAnchorAttribute(attributeName);\r\n });\r\n\r\n Object.defineProperty(proto, 'search', {\r\n get: function() {\r\n return this._anchorElement['search'];\r\n },\r\n set: function(value) {\r\n this._anchorElement['search'] = value;\r\n this._updateSearchParams();\r\n },\r\n enumerable: true\r\n });\r\n\r\n Object.defineProperties(proto, {\r\n\r\n 'toString': {\r\n get: function() {\r\n var _this = this;\r\n return function() {\r\n return _this.href;\r\n };\r\n }\r\n },\r\n\r\n 'href': {\r\n get: function() {\r\n return this._anchorElement.href.replace(/\\?$/, '');\r\n },\r\n set: function(value) {\r\n this._anchorElement.href = value;\r\n this._updateSearchParams();\r\n },\r\n enumerable: true\r\n },\r\n\r\n 'pathname': {\r\n get: function() {\r\n return this._anchorElement.pathname.replace(/(^\\/?)/, '/');\r\n },\r\n set: function(value) {\r\n this._anchorElement.pathname = value;\r\n },\r\n enumerable: true\r\n },\r\n\r\n 'origin': {\r\n get: function() {\r\n // get expected port from protocol\r\n var expectedPort = { 'http:': 80, 'https:': 443, 'ftp:': 21 }[this._anchorElement.protocol];\r\n // add port to origin if, expected port is different than actual port\r\n // and it is not empty f.e http://foo:8080\r\n // 8080 != 80 && 8080 != ''\r\n var addPortToOrigin = this._anchorElement.port != expectedPort &&\r\n this._anchorElement.port !== '';\r\n\r\n return this._anchorElement.protocol +\r\n '//' +\r\n this._anchorElement.hostname +\r\n (addPortToOrigin ? (':' + this._anchorElement.port) : '');\r\n },\r\n enumerable: true\r\n },\r\n\r\n 'password': { // TODO\r\n get: function() {\r\n return '';\r\n },\r\n set: function(value) {\r\n },\r\n enumerable: true\r\n },\r\n\r\n 'username': { // TODO\r\n get: function() {\r\n return '';\r\n },\r\n set: function(value) {\r\n },\r\n enumerable: true\r\n },\r\n });\r\n\r\n URL.createObjectURL = function(blob) {\r\n return _URL.createObjectURL.apply(_URL, arguments);\r\n };\r\n\r\n URL.revokeObjectURL = function(url) {\r\n return _URL.revokeObjectURL.apply(_URL, arguments);\r\n };\r\n\r\n global.URL = URL;\r\n\r\n };\r\n\r\n if (!checkIfURLIsSupported()) {\r\n polyfillURL();\r\n }\r\n\r\n if ((global.location !== void 0) && !('origin' in global.location)) {\r\n var getOrigin = function() {\r\n return global.location.protocol + '//' + global.location.hostname + (global.location.port ? (':' + global.location.port) : '');\r\n };\r\n\r\n try {\r\n Object.defineProperty(global.location, 'origin', {\r\n get: getOrigin,\r\n enumerable: true\r\n });\r\n } catch (e) {\r\n setInterval(function() {\r\n global.location.origin = getOrigin();\r\n }, 100);\r\n }\r\n }\r\n\r\n})(\r\n (typeof global !== 'undefined') ? global\r\n : ((typeof window !== 'undefined') ? window\r\n : ((typeof self !== 'undefined') ? self : this))\r\n);\r\n","'use strict';\nvar $ = require('../internals/export');\nvar fails = require('../internals/fails');\nvar isArray = require('../internals/is-array');\nvar isObject = require('../internals/is-object');\nvar toObject = require('../internals/to-object');\nvar toLength = require('../internals/to-length');\nvar createProperty = require('../internals/create-property');\nvar arraySpeciesCreate = require('../internals/array-species-create');\nvar arrayMethodHasSpeciesSupport = require('../internals/array-method-has-species-support');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\nvar V8_VERSION = require('../internals/engine-v8-version');\n\nvar IS_CONCAT_SPREADABLE = wellKnownSymbol('isConcatSpreadable');\nvar MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF;\nvar MAXIMUM_ALLOWED_INDEX_EXCEEDED = 'Maximum allowed index exceeded';\n\n// We can't use this feature detection in V8 since it causes\n// deoptimization and serious performance degradation\n// https://github.com/zloirock/core-js/issues/679\nvar IS_CONCAT_SPREADABLE_SUPPORT = V8_VERSION >= 51 || !fails(function () {\n var array = [];\n array[IS_CONCAT_SPREADABLE] = false;\n return array.concat()[0] !== array;\n});\n\nvar SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('concat');\n\nvar isConcatSpreadable = function (O) {\n if (!isObject(O)) return false;\n var spreadable = O[IS_CONCAT_SPREADABLE];\n return spreadable !== undefined ? !!spreadable : isArray(O);\n};\n\nvar FORCED = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT;\n\n// `Array.prototype.concat` method\n// https://tc39.github.io/ecma262/#sec-array.prototype.concat\n// with adding support of @@isConcatSpreadable and @@species\n$({ target: 'Array', proto: true, forced: FORCED }, {\n concat: function concat(arg) { // eslint-disable-line no-unused-vars\n var O = toObject(this);\n var A = arraySpeciesCreate(O, 0);\n var n = 0;\n var i, k, length, len, E;\n for (i = -1, length = arguments.length; i < length; i++) {\n E = i === -1 ? O : arguments[i];\n if (isConcatSpreadable(E)) {\n len = toLength(E.length);\n if (n + len > MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);\n for (k = 0; k < len; k++, n++) if (k in E) createProperty(A, n, E[k]);\n } else {\n if (n >= MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);\n createProperty(A, n++, E);\n }\n }\n A.length = n;\n return A;\n }\n});\n","'use strict';\nvar $ = require('../internals/export');\nvar $filter = require('../internals/array-iteration').filter;\nvar arrayMethodHasSpeciesSupport = require('../internals/array-method-has-species-support');\nvar arrayMethodUsesToLength = require('../internals/array-method-uses-to-length');\n\nvar HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('filter');\n// Edge 14- issue\nvar USES_TO_LENGTH = arrayMethodUsesToLength('filter');\n\n// `Array.prototype.filter` method\n// https://tc39.github.io/ecma262/#sec-array.prototype.filter\n// with adding support of @@species\n$({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT || !USES_TO_LENGTH }, {\n filter: function filter(callbackfn /* , thisArg */) {\n return $filter(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);\n }\n});\n","'use strict';\nvar $ = require('../internals/export');\nvar $find = require('../internals/array-iteration').find;\nvar addToUnscopables = require('../internals/add-to-unscopables');\nvar arrayMethodUsesToLength = require('../internals/array-method-uses-to-length');\n\nvar FIND = 'find';\nvar SKIPS_HOLES = true;\n\nvar USES_TO_LENGTH = arrayMethodUsesToLength(FIND);\n\n// Shouldn't skip holes\nif (FIND in []) Array(1)[FIND](function () { SKIPS_HOLES = false; });\n\n// `Array.prototype.find` method\n// https://tc39.github.io/ecma262/#sec-array.prototype.find\n$({ target: 'Array', proto: true, forced: SKIPS_HOLES || !USES_TO_LENGTH }, {\n find: function find(callbackfn /* , that = undefined */) {\n return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);\n }\n});\n\n// https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables\naddToUnscopables(FIND);\n","var wellKnownSymbol = require('../internals/well-known-symbol');\n\nvar ITERATOR = wellKnownSymbol('iterator');\nvar SAFE_CLOSING = false;\n\ntry {\n var called = 0;\n var iteratorWithReturn = {\n next: function () {\n return { done: !!called++ };\n },\n 'return': function () {\n SAFE_CLOSING = true;\n }\n };\n iteratorWithReturn[ITERATOR] = function () {\n return this;\n };\n // eslint-disable-next-line no-throw-literal\n Array.from(iteratorWithReturn, function () { throw 2; });\n} catch (error) { /* empty */ }\n\nmodule.exports = function (exec, SKIP_CLOSING) {\n if (!SKIP_CLOSING && !SAFE_CLOSING) return false;\n var ITERATION_SUPPORT = false;\n try {\n var object = {};\n object[ITERATOR] = function () {\n return {\n next: function () {\n return { done: ITERATION_SUPPORT = true };\n }\n };\n };\n exec(object);\n } catch (error) { /* empty */ }\n return ITERATION_SUPPORT;\n};\n","var $ = require('../internals/export');\nvar from = require('../internals/array-from');\nvar checkCorrectnessOfIteration = require('../internals/check-correctness-of-iteration');\n\nvar INCORRECT_ITERATION = !checkCorrectnessOfIteration(function (iterable) {\n Array.from(iterable);\n});\n\n// `Array.from` method\n// https://tc39.github.io/ecma262/#sec-array.from\n$({ target: 'Array', stat: true, forced: INCORRECT_ITERATION }, {\n from: from\n});\n","'use strict';\nvar $ = require('../internals/export');\nvar $includes = require('../internals/array-includes').includes;\nvar addToUnscopables = require('../internals/add-to-unscopables');\nvar arrayMethodUsesToLength = require('../internals/array-method-uses-to-length');\n\nvar USES_TO_LENGTH = arrayMethodUsesToLength('indexOf', { ACCESSORS: true, 1: 0 });\n\n// `Array.prototype.includes` method\n// https://tc39.github.io/ecma262/#sec-array.prototype.includes\n$({ target: 'Array', proto: true, forced: !USES_TO_LENGTH }, {\n includes: function includes(el /* , fromIndex = 0 */) {\n return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);\n }\n});\n\n// https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables\naddToUnscopables('includes');\n","'use strict';\nvar $ = require('../internals/export');\nvar $map = require('../internals/array-iteration').map;\nvar arrayMethodHasSpeciesSupport = require('../internals/array-method-has-species-support');\nvar arrayMethodUsesToLength = require('../internals/array-method-uses-to-length');\n\nvar HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('map');\n// FF49- issue\nvar USES_TO_LENGTH = arrayMethodUsesToLength('map');\n\n// `Array.prototype.map` method\n// https://tc39.github.io/ecma262/#sec-array.prototype.map\n// with adding support of @@species\n$({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT || !USES_TO_LENGTH }, {\n map: function map(callbackfn /* , thisArg */) {\n return $map(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);\n }\n});\n","var isObject = require('../internals/is-object');\nvar setPrototypeOf = require('../internals/object-set-prototype-of');\n\n// makes subclassing work correct for wrapped built-ins\nmodule.exports = function ($this, dummy, Wrapper) {\n var NewTarget, NewTargetPrototype;\n if (\n // it can work only with native `setPrototypeOf`\n setPrototypeOf &&\n // we haven't completely correct pre-ES6 way for getting `new.target`, so use this\n typeof (NewTarget = dummy.constructor) == 'function' &&\n NewTarget !== Wrapper &&\n isObject(NewTargetPrototype = NewTarget.prototype) &&\n NewTargetPrototype !== Wrapper.prototype\n ) setPrototypeOf($this, NewTargetPrototype);\n return $this;\n};\n","// a string of all valid unicode whitespaces\n// eslint-disable-next-line max-len\nmodule.exports = '\\u0009\\u000A\\u000B\\u000C\\u000D\\u0020\\u00A0\\u1680\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u202F\\u205F\\u3000\\u2028\\u2029\\uFEFF';\n","var requireObjectCoercible = require('../internals/require-object-coercible');\nvar whitespaces = require('../internals/whitespaces');\n\nvar whitespace = '[' + whitespaces + ']';\nvar ltrim = RegExp('^' + whitespace + whitespace + '*');\nvar rtrim = RegExp(whitespace + whitespace + '*$');\n\n// `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation\nvar createMethod = function (TYPE) {\n return function ($this) {\n var string = String(requireObjectCoercible($this));\n if (TYPE & 1) string = string.replace(ltrim, '');\n if (TYPE & 2) string = string.replace(rtrim, '');\n return string;\n };\n};\n\nmodule.exports = {\n // `String.prototype.{ trimLeft, trimStart }` methods\n // https://tc39.github.io/ecma262/#sec-string.prototype.trimstart\n start: createMethod(1),\n // `String.prototype.{ trimRight, trimEnd }` methods\n // https://tc39.github.io/ecma262/#sec-string.prototype.trimend\n end: createMethod(2),\n // `String.prototype.trim` method\n // https://tc39.github.io/ecma262/#sec-string.prototype.trim\n trim: createMethod(3)\n};\n","'use strict';\nvar DESCRIPTORS = require('../internals/descriptors');\nvar global = require('../internals/global');\nvar isForced = require('../internals/is-forced');\nvar redefine = require('../internals/redefine');\nvar has = require('../internals/has');\nvar classof = require('../internals/classof-raw');\nvar inheritIfRequired = require('../internals/inherit-if-required');\nvar toPrimitive = require('../internals/to-primitive');\nvar fails = require('../internals/fails');\nvar create = require('../internals/object-create');\nvar getOwnPropertyNames = require('../internals/object-get-own-property-names').f;\nvar getOwnPropertyDescriptor = require('../internals/object-get-own-property-descriptor').f;\nvar defineProperty = require('../internals/object-define-property').f;\nvar trim = require('../internals/string-trim').trim;\n\nvar NUMBER = 'Number';\nvar NativeNumber = global[NUMBER];\nvar NumberPrototype = NativeNumber.prototype;\n\n// Opera ~12 has broken Object#toString\nvar BROKEN_CLASSOF = classof(create(NumberPrototype)) == NUMBER;\n\n// `ToNumber` abstract operation\n// https://tc39.github.io/ecma262/#sec-tonumber\nvar toNumber = function (argument) {\n var it = toPrimitive(argument, false);\n var first, third, radix, maxCode, digits, length, index, code;\n if (typeof it == 'string' && it.length > 2) {\n it = trim(it);\n first = it.charCodeAt(0);\n if (first === 43 || first === 45) {\n third = it.charCodeAt(2);\n if (third === 88 || third === 120) return NaN; // Number('+0x1') should be NaN, old V8 fix\n } else if (first === 48) {\n switch (it.charCodeAt(1)) {\n case 66: case 98: radix = 2; maxCode = 49; break; // fast equal of /^0b[01]+$/i\n case 79: case 111: radix = 8; maxCode = 55; break; // fast equal of /^0o[0-7]+$/i\n default: return +it;\n }\n digits = it.slice(2);\n length = digits.length;\n for (index = 0; index < length; index++) {\n code = digits.charCodeAt(index);\n // parseInt parses a string to a first unavailable symbol\n // but ToNumber should return NaN if a string contains unavailable symbols\n if (code < 48 || code > maxCode) return NaN;\n } return parseInt(digits, radix);\n }\n } return +it;\n};\n\n// `Number` constructor\n// https://tc39.github.io/ecma262/#sec-number-constructor\nif (isForced(NUMBER, !NativeNumber(' 0o1') || !NativeNumber('0b1') || NativeNumber('+0x1'))) {\n var NumberWrapper = function Number(value) {\n var it = arguments.length < 1 ? 0 : value;\n var dummy = this;\n return dummy instanceof NumberWrapper\n // check on 1..constructor(foo) case\n && (BROKEN_CLASSOF ? fails(function () { NumberPrototype.valueOf.call(dummy); }) : classof(dummy) != NUMBER)\n ? inheritIfRequired(new NativeNumber(toNumber(it)), dummy, NumberWrapper) : toNumber(it);\n };\n for (var keys = DESCRIPTORS ? getOwnPropertyNames(NativeNumber) : (\n // ES3:\n 'MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,' +\n // ES2015 (in case, if modules with ES2015 Number statics required before):\n 'EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,' +\n 'MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger'\n ).split(','), j = 0, key; keys.length > j; j++) {\n if (has(NativeNumber, key = keys[j]) && !has(NumberWrapper, key)) {\n defineProperty(NumberWrapper, key, getOwnPropertyDescriptor(NativeNumber, key));\n }\n }\n NumberWrapper.prototype = NumberPrototype;\n NumberPrototype.constructor = NumberWrapper;\n redefine(global, NUMBER, NumberWrapper);\n}\n","var $ = require('../internals/export');\nvar toObject = require('../internals/to-object');\nvar nativeKeys = require('../internals/object-keys');\nvar fails = require('../internals/fails');\n\nvar FAILS_ON_PRIMITIVES = fails(function () { nativeKeys(1); });\n\n// `Object.keys` method\n// https://tc39.github.io/ecma262/#sec-object.keys\n$({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, {\n keys: function keys(it) {\n return nativeKeys(toObject(it));\n }\n});\n","var isRegExp = require('../internals/is-regexp');\n\nmodule.exports = function (it) {\n if (isRegExp(it)) {\n throw TypeError(\"The method doesn't accept regular expressions\");\n } return it;\n};\n","var wellKnownSymbol = require('../internals/well-known-symbol');\n\nvar MATCH = wellKnownSymbol('match');\n\nmodule.exports = function (METHOD_NAME) {\n var regexp = /./;\n try {\n '/./'[METHOD_NAME](regexp);\n } catch (e) {\n try {\n regexp[MATCH] = false;\n return '/./'[METHOD_NAME](regexp);\n } catch (f) { /* empty */ }\n } return false;\n};\n","'use strict';\nvar $ = require('../internals/export');\nvar notARegExp = require('../internals/not-a-regexp');\nvar requireObjectCoercible = require('../internals/require-object-coercible');\nvar correctIsRegExpLogic = require('../internals/correct-is-regexp-logic');\n\n// `String.prototype.includes` method\n// https://tc39.github.io/ecma262/#sec-string.prototype.includes\n$({ target: 'String', proto: true, forced: !correctIsRegExpLogic('includes') }, {\n includes: function includes(searchString /* , position = 0 */) {\n return !!~String(requireObjectCoercible(this))\n .indexOf(notARegExp(searchString), arguments.length > 1 ? arguments[1] : undefined);\n }\n});\n","var fails = require('../internals/fails');\n\nmodule.exports = !fails(function () {\n return Object.isExtensible(Object.preventExtensions({}));\n});\n","var hiddenKeys = require('../internals/hidden-keys');\nvar isObject = require('../internals/is-object');\nvar has = require('../internals/has');\nvar defineProperty = require('../internals/object-define-property').f;\nvar uid = require('../internals/uid');\nvar FREEZING = require('../internals/freezing');\n\nvar METADATA = uid('meta');\nvar id = 0;\n\nvar isExtensible = Object.isExtensible || function () {\n return true;\n};\n\nvar setMetadata = function (it) {\n defineProperty(it, METADATA, { value: {\n objectID: 'O' + ++id, // object ID\n weakData: {} // weak collections IDs\n } });\n};\n\nvar fastKey = function (it, create) {\n // return a primitive with prefix\n if (!isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;\n if (!has(it, METADATA)) {\n // can't set metadata to uncaught frozen object\n if (!isExtensible(it)) return 'F';\n // not necessary to add metadata\n if (!create) return 'E';\n // add missing metadata\n setMetadata(it);\n // return object ID\n } return it[METADATA].objectID;\n};\n\nvar getWeakData = function (it, create) {\n if (!has(it, METADATA)) {\n // can't set metadata to uncaught frozen object\n if (!isExtensible(it)) return true;\n // not necessary to add metadata\n if (!create) return false;\n // add missing metadata\n setMetadata(it);\n // return the store of weak collections IDs\n } return it[METADATA].weakData;\n};\n\n// add metadata on freeze-family methods calling\nvar onFreeze = function (it) {\n if (FREEZING && meta.REQUIRED && isExtensible(it) && !has(it, METADATA)) setMetadata(it);\n return it;\n};\n\nvar meta = module.exports = {\n REQUIRED: false,\n fastKey: fastKey,\n getWeakData: getWeakData,\n onFreeze: onFreeze\n};\n\nhiddenKeys[METADATA] = true;\n","var anObject = require('../internals/an-object');\nvar isArrayIteratorMethod = require('../internals/is-array-iterator-method');\nvar toLength = require('../internals/to-length');\nvar bind = require('../internals/function-bind-context');\nvar getIteratorMethod = require('../internals/get-iterator-method');\nvar callWithSafeIterationClosing = require('../internals/call-with-safe-iteration-closing');\n\nvar Result = function (stopped, result) {\n this.stopped = stopped;\n this.result = result;\n};\n\nvar iterate = module.exports = function (iterable, fn, that, AS_ENTRIES, IS_ITERATOR) {\n var boundFunction = bind(fn, that, AS_ENTRIES ? 2 : 1);\n var iterator, iterFn, index, length, result, next, step;\n\n if (IS_ITERATOR) {\n iterator = iterable;\n } else {\n iterFn = getIteratorMethod(iterable);\n if (typeof iterFn != 'function') throw TypeError('Target is not iterable');\n // optimisation for array iterators\n if (isArrayIteratorMethod(iterFn)) {\n for (index = 0, length = toLength(iterable.length); length > index; index++) {\n result = AS_ENTRIES\n ? boundFunction(anObject(step = iterable[index])[0], step[1])\n : boundFunction(iterable[index]);\n if (result && result instanceof Result) return result;\n } return new Result(false);\n }\n iterator = iterFn.call(iterable);\n }\n\n next = iterator.next;\n while (!(step = next.call(iterator)).done) {\n result = callWithSafeIterationClosing(iterator, boundFunction, step.value, AS_ENTRIES);\n if (typeof result == 'object' && result && result instanceof Result) return result;\n } return new Result(false);\n};\n\niterate.stop = function (result) {\n return new Result(true, result);\n};\n","'use strict';\nvar redefineAll = require('../internals/redefine-all');\nvar getWeakData = require('../internals/internal-metadata').getWeakData;\nvar anObject = require('../internals/an-object');\nvar isObject = require('../internals/is-object');\nvar anInstance = require('../internals/an-instance');\nvar iterate = require('../internals/iterate');\nvar ArrayIterationModule = require('../internals/array-iteration');\nvar $has = require('../internals/has');\nvar InternalStateModule = require('../internals/internal-state');\n\nvar setInternalState = InternalStateModule.set;\nvar internalStateGetterFor = InternalStateModule.getterFor;\nvar find = ArrayIterationModule.find;\nvar findIndex = ArrayIterationModule.findIndex;\nvar id = 0;\n\n// fallback for uncaught frozen keys\nvar uncaughtFrozenStore = function (store) {\n return store.frozen || (store.frozen = new UncaughtFrozenStore());\n};\n\nvar UncaughtFrozenStore = function () {\n this.entries = [];\n};\n\nvar findUncaughtFrozen = function (store, key) {\n return find(store.entries, function (it) {\n return it[0] === key;\n });\n};\n\nUncaughtFrozenStore.prototype = {\n get: function (key) {\n var entry = findUncaughtFrozen(this, key);\n if (entry) return entry[1];\n },\n has: function (key) {\n return !!findUncaughtFrozen(this, key);\n },\n set: function (key, value) {\n var entry = findUncaughtFrozen(this, key);\n if (entry) entry[1] = value;\n else this.entries.push([key, value]);\n },\n 'delete': function (key) {\n var index = findIndex(this.entries, function (it) {\n return it[0] === key;\n });\n if (~index) this.entries.splice(index, 1);\n return !!~index;\n }\n};\n\nmodule.exports = {\n getConstructor: function (wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER) {\n var C = wrapper(function (that, iterable) {\n anInstance(that, C, CONSTRUCTOR_NAME);\n setInternalState(that, {\n type: CONSTRUCTOR_NAME,\n id: id++,\n frozen: undefined\n });\n if (iterable != undefined) iterate(iterable, that[ADDER], that, IS_MAP);\n });\n\n var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME);\n\n var define = function (that, key, value) {\n var state = getInternalState(that);\n var data = getWeakData(anObject(key), true);\n if (data === true) uncaughtFrozenStore(state).set(key, value);\n else data[state.id] = value;\n return that;\n };\n\n redefineAll(C.prototype, {\n // 23.3.3.2 WeakMap.prototype.delete(key)\n // 23.4.3.3 WeakSet.prototype.delete(value)\n 'delete': function (key) {\n var state = getInternalState(this);\n if (!isObject(key)) return false;\n var data = getWeakData(key);\n if (data === true) return uncaughtFrozenStore(state)['delete'](key);\n return data && $has(data, state.id) && delete data[state.id];\n },\n // 23.3.3.4 WeakMap.prototype.has(key)\n // 23.4.3.4 WeakSet.prototype.has(value)\n has: function has(key) {\n var state = getInternalState(this);\n if (!isObject(key)) return false;\n var data = getWeakData(key);\n if (data === true) return uncaughtFrozenStore(state).has(key);\n return data && $has(data, state.id);\n }\n });\n\n redefineAll(C.prototype, IS_MAP ? {\n // 23.3.3.3 WeakMap.prototype.get(key)\n get: function get(key) {\n var state = getInternalState(this);\n if (isObject(key)) {\n var data = getWeakData(key);\n if (data === true) return uncaughtFrozenStore(state).get(key);\n return data ? data[state.id] : undefined;\n }\n },\n // 23.3.3.5 WeakMap.prototype.set(key, value)\n set: function set(key, value) {\n return define(this, key, value);\n }\n } : {\n // 23.4.3.1 WeakSet.prototype.add(value)\n add: function add(value) {\n return define(this, value, true);\n }\n });\n\n return C;\n }\n};\n","'use strict';\nvar $ = require('../internals/export');\nvar $every = require('../internals/array-iteration').every;\nvar arrayMethodIsStrict = require('../internals/array-method-is-strict');\nvar arrayMethodUsesToLength = require('../internals/array-method-uses-to-length');\n\nvar STRICT_METHOD = arrayMethodIsStrict('every');\nvar USES_TO_LENGTH = arrayMethodUsesToLength('every');\n\n// `Array.prototype.every` method\n// https://tc39.github.io/ecma262/#sec-array.prototype.every\n$({ target: 'Array', proto: true, forced: !STRICT_METHOD || !USES_TO_LENGTH }, {\n every: function every(callbackfn /* , thisArg */) {\n return $every(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);\n }\n});\n","'use strict';\nvar global = require('../internals/global');\nvar redefineAll = require('../internals/redefine-all');\nvar InternalMetadataModule = require('../internals/internal-metadata');\nvar collection = require('../internals/collection');\nvar collectionWeak = require('../internals/collection-weak');\nvar isObject = require('../internals/is-object');\nvar enforceIternalState = require('../internals/internal-state').enforce;\nvar NATIVE_WEAK_MAP = require('../internals/native-weak-map');\n\nvar IS_IE11 = !global.ActiveXObject && 'ActiveXObject' in global;\nvar isExtensible = Object.isExtensible;\nvar InternalWeakMap;\n\nvar wrapper = function (init) {\n return function WeakMap() {\n return init(this, arguments.length ? arguments[0] : undefined);\n };\n};\n\n// `WeakMap` constructor\n// https://tc39.github.io/ecma262/#sec-weakmap-constructor\nvar $WeakMap = module.exports = collection('WeakMap', wrapper, collectionWeak);\n\n// IE11 WeakMap frozen keys fix\n// We can't use feature detection because it crash some old IE builds\n// https://github.com/zloirock/core-js/issues/485\nif (NATIVE_WEAK_MAP && IS_IE11) {\n InternalWeakMap = collectionWeak.getConstructor(wrapper, 'WeakMap', true);\n InternalMetadataModule.REQUIRED = true;\n var WeakMapPrototype = $WeakMap.prototype;\n var nativeDelete = WeakMapPrototype['delete'];\n var nativeHas = WeakMapPrototype.has;\n var nativeGet = WeakMapPrototype.get;\n var nativeSet = WeakMapPrototype.set;\n redefineAll(WeakMapPrototype, {\n 'delete': function (key) {\n if (isObject(key) && !isExtensible(key)) {\n var state = enforceIternalState(this);\n if (!state.frozen) state.frozen = new InternalWeakMap();\n return nativeDelete.call(this, key) || state.frozen['delete'](key);\n } return nativeDelete.call(this, key);\n },\n has: function has(key) {\n if (isObject(key) && !isExtensible(key)) {\n var state = enforceIternalState(this);\n if (!state.frozen) state.frozen = new InternalWeakMap();\n return nativeHas.call(this, key) || state.frozen.has(key);\n } return nativeHas.call(this, key);\n },\n get: function get(key) {\n if (isObject(key) && !isExtensible(key)) {\n var state = enforceIternalState(this);\n if (!state.frozen) state.frozen = new InternalWeakMap();\n return nativeHas.call(this, key) ? nativeGet.call(this, key) : state.frozen.get(key);\n } return nativeGet.call(this, key);\n },\n set: function set(key, value) {\n if (isObject(key) && !isExtensible(key)) {\n var state = enforceIternalState(this);\n if (!state.frozen) state.frozen = new InternalWeakMap();\n nativeHas.call(this, key) ? nativeSet.call(this, key, value) : state.frozen.set(key, value);\n } else nativeSet.call(this, key, value);\n return this;\n }\n });\n}\n","'use strict';\nvar $ = require('../internals/export');\nvar global = require('../internals/global');\nvar isForced = require('../internals/is-forced');\nvar redefine = require('../internals/redefine');\nvar InternalMetadataModule = require('../internals/internal-metadata');\nvar iterate = require('../internals/iterate');\nvar anInstance = require('../internals/an-instance');\nvar isObject = require('../internals/is-object');\nvar fails = require('../internals/fails');\nvar checkCorrectnessOfIteration = require('../internals/check-correctness-of-iteration');\nvar setToStringTag = require('../internals/set-to-string-tag');\nvar inheritIfRequired = require('../internals/inherit-if-required');\n\nmodule.exports = function (CONSTRUCTOR_NAME, wrapper, common) {\n var IS_MAP = CONSTRUCTOR_NAME.indexOf('Map') !== -1;\n var IS_WEAK = CONSTRUCTOR_NAME.indexOf('Weak') !== -1;\n var ADDER = IS_MAP ? 'set' : 'add';\n var NativeConstructor = global[CONSTRUCTOR_NAME];\n var NativePrototype = NativeConstructor && NativeConstructor.prototype;\n var Constructor = NativeConstructor;\n var exported = {};\n\n var fixMethod = function (KEY) {\n var nativeMethod = NativePrototype[KEY];\n redefine(NativePrototype, KEY,\n KEY == 'add' ? function add(value) {\n nativeMethod.call(this, value === 0 ? 0 : value);\n return this;\n } : KEY == 'delete' ? function (key) {\n return IS_WEAK && !isObject(key) ? false : nativeMethod.call(this, key === 0 ? 0 : key);\n } : KEY == 'get' ? function get(key) {\n return IS_WEAK && !isObject(key) ? undefined : nativeMethod.call(this, key === 0 ? 0 : key);\n } : KEY == 'has' ? function has(key) {\n return IS_WEAK && !isObject(key) ? false : nativeMethod.call(this, key === 0 ? 0 : key);\n } : function set(key, value) {\n nativeMethod.call(this, key === 0 ? 0 : key, value);\n return this;\n }\n );\n };\n\n // eslint-disable-next-line max-len\n if (isForced(CONSTRUCTOR_NAME, typeof NativeConstructor != 'function' || !(IS_WEAK || NativePrototype.forEach && !fails(function () {\n new NativeConstructor().entries().next();\n })))) {\n // create collection constructor\n Constructor = common.getConstructor(wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER);\n InternalMetadataModule.REQUIRED = true;\n } else if (isForced(CONSTRUCTOR_NAME, true)) {\n var instance = new Constructor();\n // early implementations not supports chaining\n var HASNT_CHAINING = instance[ADDER](IS_WEAK ? {} : -0, 1) != instance;\n // V8 ~ Chromium 40- weak-collections throws on primitives, but should return false\n var THROWS_ON_PRIMITIVES = fails(function () { instance.has(1); });\n // most early implementations doesn't supports iterables, most modern - not close it correctly\n // eslint-disable-next-line no-new\n var ACCEPT_ITERABLES = checkCorrectnessOfIteration(function (iterable) { new NativeConstructor(iterable); });\n // for early implementations -0 and +0 not the same\n var BUGGY_ZERO = !IS_WEAK && fails(function () {\n // V8 ~ Chromium 42- fails only with 5+ elements\n var $instance = new NativeConstructor();\n var index = 5;\n while (index--) $instance[ADDER](index, index);\n return !$instance.has(-0);\n });\n\n if (!ACCEPT_ITERABLES) {\n Constructor = wrapper(function (dummy, iterable) {\n anInstance(dummy, Constructor, CONSTRUCTOR_NAME);\n var that = inheritIfRequired(new NativeConstructor(), dummy, Constructor);\n if (iterable != undefined) iterate(iterable, that[ADDER], that, IS_MAP);\n return that;\n });\n Constructor.prototype = NativePrototype;\n NativePrototype.constructor = Constructor;\n }\n\n if (THROWS_ON_PRIMITIVES || BUGGY_ZERO) {\n fixMethod('delete');\n fixMethod('has');\n IS_MAP && fixMethod('get');\n }\n\n if (BUGGY_ZERO || HASNT_CHAINING) fixMethod(ADDER);\n\n // weak collections should not contains .clear method\n if (IS_WEAK && NativePrototype.clear) delete NativePrototype.clear;\n }\n\n exported[CONSTRUCTOR_NAME] = Constructor;\n $({ global: true, forced: Constructor != NativeConstructor }, exported);\n\n setToStringTag(Constructor, CONSTRUCTOR_NAME);\n\n if (!IS_WEAK) common.setStrong(Constructor, CONSTRUCTOR_NAME, IS_MAP);\n\n return Constructor;\n};\n","var $ = require('../internals/export');\nvar assign = require('../internals/object-assign');\n\n// `Object.assign` method\n// https://tc39.github.io/ecma262/#sec-object.assign\n$({ target: 'Object', stat: true, forced: Object.assign !== assign }, {\n assign: assign\n});\n","var fails = require('../internals/fails');\nvar whitespaces = require('../internals/whitespaces');\n\nvar non = '\\u200B\\u0085\\u180E';\n\n// check that a method works with the correct list\n// of whitespaces and has a correct name\nmodule.exports = function (METHOD_NAME) {\n return fails(function () {\n return !!whitespaces[METHOD_NAME]() || non[METHOD_NAME]() != non || whitespaces[METHOD_NAME].name !== METHOD_NAME;\n });\n};\n","'use strict';\nvar $ = require('../internals/export');\nvar $trim = require('../internals/string-trim').trim;\nvar forcedStringTrimMethod = require('../internals/string-trim-forced');\n\n// `String.prototype.trim` method\n// https://tc39.github.io/ecma262/#sec-string.prototype.trim\n$({ target: 'String', proto: true, forced: forcedStringTrimMethod('trim') }, {\n trim: function trim() {\n return $trim(this);\n }\n});\n","'use strict';\nvar $ = require('../internals/export');\nvar $some = require('../internals/array-iteration').some;\nvar arrayMethodIsStrict = require('../internals/array-method-is-strict');\nvar arrayMethodUsesToLength = require('../internals/array-method-uses-to-length');\n\nvar STRICT_METHOD = arrayMethodIsStrict('some');\nvar USES_TO_LENGTH = arrayMethodUsesToLength('some');\n\n// `Array.prototype.some` method\n// https://tc39.github.io/ecma262/#sec-array.prototype.some\n$({ target: 'Array', proto: true, forced: !STRICT_METHOD || !USES_TO_LENGTH }, {\n some: function some(callbackfn /* , thisArg */) {\n return $some(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);\n }\n});\n","var classof = require('../internals/classof-raw');\n\n// `thisNumberValue` abstract operation\n// https://tc39.github.io/ecma262/#sec-thisnumbervalue\nmodule.exports = function (value) {\n if (typeof value != 'number' && classof(value) != 'Number') {\n throw TypeError('Incorrect invocation');\n }\n return +value;\n};\n","'use strict';\nvar toInteger = require('../internals/to-integer');\nvar requireObjectCoercible = require('../internals/require-object-coercible');\n\n// `String.prototype.repeat` method implementation\n// https://tc39.github.io/ecma262/#sec-string.prototype.repeat\nmodule.exports = ''.repeat || function repeat(count) {\n var str = String(requireObjectCoercible(this));\n var result = '';\n var n = toInteger(count);\n if (n < 0 || n == Infinity) throw RangeError('Wrong number of repetitions');\n for (;n > 0; (n >>>= 1) && (str += str)) if (n & 1) result += str;\n return result;\n};\n","'use strict';\nvar $ = require('../internals/export');\nvar toInteger = require('../internals/to-integer');\nvar thisNumberValue = require('../internals/this-number-value');\nvar repeat = require('../internals/string-repeat');\nvar fails = require('../internals/fails');\n\nvar nativeToFixed = 1.0.toFixed;\nvar floor = Math.floor;\n\nvar pow = function (x, n, acc) {\n return n === 0 ? acc : n % 2 === 1 ? pow(x, n - 1, acc * x) : pow(x * x, n / 2, acc);\n};\n\nvar log = function (x) {\n var n = 0;\n var x2 = x;\n while (x2 >= 4096) {\n n += 12;\n x2 /= 4096;\n }\n while (x2 >= 2) {\n n += 1;\n x2 /= 2;\n } return n;\n};\n\nvar FORCED = nativeToFixed && (\n 0.00008.toFixed(3) !== '0.000' ||\n 0.9.toFixed(0) !== '1' ||\n 1.255.toFixed(2) !== '1.25' ||\n 1000000000000000128.0.toFixed(0) !== '1000000000000000128'\n) || !fails(function () {\n // V8 ~ Android 4.3-\n nativeToFixed.call({});\n});\n\n// `Number.prototype.toFixed` method\n// https://tc39.github.io/ecma262/#sec-number.prototype.tofixed\n$({ target: 'Number', proto: true, forced: FORCED }, {\n // eslint-disable-next-line max-statements\n toFixed: function toFixed(fractionDigits) {\n var number = thisNumberValue(this);\n var fractDigits = toInteger(fractionDigits);\n var data = [0, 0, 0, 0, 0, 0];\n var sign = '';\n var result = '0';\n var e, z, j, k;\n\n var multiply = function (n, c) {\n var index = -1;\n var c2 = c;\n while (++index < 6) {\n c2 += n * data[index];\n data[index] = c2 % 1e7;\n c2 = floor(c2 / 1e7);\n }\n };\n\n var divide = function (n) {\n var index = 6;\n var c = 0;\n while (--index >= 0) {\n c += data[index];\n data[index] = floor(c / n);\n c = (c % n) * 1e7;\n }\n };\n\n var dataToString = function () {\n var index = 6;\n var s = '';\n while (--index >= 0) {\n if (s !== '' || index === 0 || data[index] !== 0) {\n var t = String(data[index]);\n s = s === '' ? t : s + repeat.call('0', 7 - t.length) + t;\n }\n } return s;\n };\n\n if (fractDigits < 0 || fractDigits > 20) throw RangeError('Incorrect fraction digits');\n // eslint-disable-next-line no-self-compare\n if (number != number) return 'NaN';\n if (number <= -1e21 || number >= 1e21) return String(number);\n if (number < 0) {\n sign = '-';\n number = -number;\n }\n if (number > 1e-21) {\n e = log(number * pow(2, 69, 1)) - 69;\n z = e < 0 ? number * pow(2, -e, 1) : number / pow(2, e, 1);\n z *= 0x10000000000000;\n e = 52 - e;\n if (e > 0) {\n multiply(0, z);\n j = fractDigits;\n while (j >= 7) {\n multiply(1e7, 0);\n j -= 7;\n }\n multiply(pow(10, j, 1), 0);\n j = e - 1;\n while (j >= 23) {\n divide(1 << 23);\n j -= 23;\n }\n divide(1 << j);\n multiply(1, 1);\n divide(2);\n result = dataToString();\n } else {\n multiply(0, z);\n multiply(1 << -e, 0);\n result = dataToString() + repeat.call('0', fractDigits);\n }\n }\n if (fractDigits > 0) {\n k = result.length;\n result = sign + (k <= fractDigits\n ? '0.' + repeat.call('0', fractDigits - k) + result\n : result.slice(0, k - fractDigits) + '.' + result.slice(k - fractDigits));\n } else {\n result = sign + result;\n } return result;\n }\n});\n","var DESCRIPTORS = require('../internals/descriptors');\nvar objectKeys = require('../internals/object-keys');\nvar toIndexedObject = require('../internals/to-indexed-object');\nvar propertyIsEnumerable = require('../internals/object-property-is-enumerable').f;\n\n// `Object.{ entries, values }` methods implementation\nvar createMethod = function (TO_ENTRIES) {\n return function (it) {\n var O = toIndexedObject(it);\n var keys = objectKeys(O);\n var length = keys.length;\n var i = 0;\n var result = [];\n var key;\n while (length > i) {\n key = keys[i++];\n if (!DESCRIPTORS || propertyIsEnumerable.call(O, key)) {\n result.push(TO_ENTRIES ? [key, O[key]] : O[key]);\n }\n }\n return result;\n };\n};\n\nmodule.exports = {\n // `Object.entries` method\n // https://tc39.github.io/ecma262/#sec-object.entries\n entries: createMethod(true),\n // `Object.values` method\n // https://tc39.github.io/ecma262/#sec-object.values\n values: createMethod(false)\n};\n","var $ = require('../internals/export');\nvar $entries = require('../internals/object-to-array').entries;\n\n// `Object.entries` method\n// https://tc39.github.io/ecma262/#sec-object.entries\n$({ target: 'Object', stat: true }, {\n entries: function entries(O) {\n return $entries(O);\n }\n});\n","var $ = require('../internals/export');\nvar $values = require('../internals/object-to-array').values;\n\n// `Object.values` method\n// https://tc39.github.io/ecma262/#sec-object.values\n$({ target: 'Object', stat: true }, {\n values: function values(O) {\n return $values(O);\n }\n});\n","var $ = require('../internals/export');\n\n// `Number.isNaN` method\n// https://tc39.github.io/ecma262/#sec-number.isnan\n$({ target: 'Number', stat: true }, {\n isNaN: function isNaN(number) {\n // eslint-disable-next-line no-self-compare\n return number != number;\n }\n});\n","var $ = require('../internals/export');\nvar fails = require('../internals/fails');\nvar toIndexedObject = require('../internals/to-indexed-object');\nvar nativeGetOwnPropertyDescriptor = require('../internals/object-get-own-property-descriptor').f;\nvar DESCRIPTORS = require('../internals/descriptors');\n\nvar FAILS_ON_PRIMITIVES = fails(function () { nativeGetOwnPropertyDescriptor(1); });\nvar FORCED = !DESCRIPTORS || FAILS_ON_PRIMITIVES;\n\n// `Object.getOwnPropertyDescriptor` method\n// https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptor\n$({ target: 'Object', stat: true, forced: FORCED, sham: !DESCRIPTORS }, {\n getOwnPropertyDescriptor: function getOwnPropertyDescriptor(it, key) {\n return nativeGetOwnPropertyDescriptor(toIndexedObject(it), key);\n }\n});\n","function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError(\"Cannot call a class as a function\")}function _defineProperties(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,\"value\"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function _createClass(e,t,n){return t&&_defineProperties(e.prototype,t),n&&_defineProperties(e,n),e}function _defineProperty(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ownKeys(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function _objectSpread2(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(n),!0).forEach((function(t){_defineProperty(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ownKeys(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var defaults={addCSS:!0,thumbWidth:15,watch:!0};function matches(e,t){return function(){return Array.from(document.querySelectorAll(t)).includes(this)}.call(e,t)}function trigger(e,t){if(e&&t){var n=new Event(t,{bubbles:!0});e.dispatchEvent(n)}}var getConstructor=function(e){return null!=e?e.constructor:null},instanceOf=function(e,t){return!!(e&&t&&e instanceof t)},isNullOrUndefined=function(e){return null==e},isObject=function(e){return getConstructor(e)===Object},isNumber=function(e){return getConstructor(e)===Number&&!Number.isNaN(e)},isString=function(e){return getConstructor(e)===String},isBoolean=function(e){return getConstructor(e)===Boolean},isFunction=function(e){return getConstructor(e)===Function},isArray=function(e){return Array.isArray(e)},isNodeList=function(e){return instanceOf(e,NodeList)},isElement=function(e){return instanceOf(e,Element)},isEvent=function(e){return instanceOf(e,Event)},isEmpty=function(e){return isNullOrUndefined(e)||(isString(e)||isArray(e)||isNodeList(e))&&!e.length||isObject(e)&&!Object.keys(e).length},is={nullOrUndefined:isNullOrUndefined,object:isObject,number:isNumber,string:isString,boolean:isBoolean,function:isFunction,array:isArray,nodeList:isNodeList,element:isElement,event:isEvent,empty:isEmpty};function getDecimalPlaces(e){var t=\"\".concat(e).match(/(?:\\.(\\d+))?(?:[eE]([+-]?\\d+))?$/);return t?Math.max(0,(t[1]?t[1].length:0)-(t[2]?+t[2]:0)):0}function round(e,t){if(1>t){var n=getDecimalPlaces(t);return parseFloat(e.toFixed(n))}return Math.round(e/t)*t}var RangeTouch=function(){function e(t,n){_classCallCheck(this,e),is.element(t)?this.element=t:is.string(t)&&(this.element=document.querySelector(t)),is.element(this.element)&&is.empty(this.element.rangeTouch)&&(this.config=_objectSpread2({},defaults,{},n),this.init())}return _createClass(e,[{key:\"init\",value:function(){e.enabled&&(this.config.addCSS&&(this.element.style.userSelect=\"none\",this.element.style.webKitUserSelect=\"none\",this.element.style.touchAction=\"manipulation\"),this.listeners(!0),this.element.rangeTouch=this)}},{key:\"destroy\",value:function(){e.enabled&&(this.config.addCSS&&(this.element.style.userSelect=\"\",this.element.style.webKitUserSelect=\"\",this.element.style.touchAction=\"\"),this.listeners(!1),this.element.rangeTouch=null)}},{key:\"listeners\",value:function(e){var t=this,n=e?\"addEventListener\":\"removeEventListener\";[\"touchstart\",\"touchmove\",\"touchend\"].forEach((function(e){t.element[n](e,(function(e){return t.set(e)}),!1)}))}},{key:\"get\",value:function(t){if(!e.enabled||!is.event(t))return null;var n,r=t.target,i=t.changedTouches[0],o=parseFloat(r.getAttribute(\"min\"))||0,s=parseFloat(r.getAttribute(\"max\"))||100,u=parseFloat(r.getAttribute(\"step\"))||1,c=r.getBoundingClientRect(),a=100/c.width*(this.config.thumbWidth/2)/100;return 0>(n=100/c.width*(i.clientX-c.left))?n=0:100<n&&(n=100),50>n?n-=(100-2*n)*a:50<n&&(n+=2*(n-50)*a),o+round(n/100*(s-o),u)}},{key:\"set\",value:function(t){e.enabled&&is.event(t)&&!t.target.disabled&&(t.preventDefault(),t.target.value=this.get(t),trigger(t.target,\"touchend\"===t.type?\"change\":\"input\"))}}],[{key:\"setup\",value:function(t){var n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},r=null;if(is.empty(t)||is.string(t)?r=Array.from(document.querySelectorAll(is.string(t)?t:'input[type=\"range\"]')):is.element(t)?r=[t]:is.nodeList(t)?r=Array.from(t):is.array(t)&&(r=t.filter(is.element)),is.empty(r))return null;var i=_objectSpread2({},defaults,{},n);if(is.string(t)&&i.watch){var o=new MutationObserver((function(n){Array.from(n).forEach((function(n){Array.from(n.addedNodes).forEach((function(n){is.element(n)&&matches(n,t)&&new e(n,i)}))}))}));o.observe(document.body,{childList:!0,subtree:!0})}return r.map((function(t){return new e(t,n)}))}},{key:\"enabled\",get:function(){return\"ontouchstart\"in document.documentElement}}]),e}();export default RangeTouch;","var $ = require('../internals/export');\nvar DESCRIPTORS = require('../internals/descriptors');\nvar ownKeys = require('../internals/own-keys');\nvar toIndexedObject = require('../internals/to-indexed-object');\nvar getOwnPropertyDescriptorModule = require('../internals/object-get-own-property-descriptor');\nvar createProperty = require('../internals/create-property');\n\n// `Object.getOwnPropertyDescriptors` method\n// https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptors\n$({ target: 'Object', stat: true, sham: !DESCRIPTORS }, {\n getOwnPropertyDescriptors: function getOwnPropertyDescriptors(object) {\n var O = toIndexedObject(object);\n var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;\n var keys = ownKeys(O);\n var result = {};\n var index = 0;\n var key, descriptor;\n while (keys.length > index) {\n descriptor = getOwnPropertyDescriptor(O, key = keys[index++]);\n if (descriptor !== undefined) createProperty(result, key, descriptor);\n }\n return result;\n }\n});\n","'use strict';\nvar fixRegExpWellKnownSymbolLogic = require('../internals/fix-regexp-well-known-symbol-logic');\nvar anObject = require('../internals/an-object');\nvar toLength = require('../internals/to-length');\nvar requireObjectCoercible = require('../internals/require-object-coercible');\nvar advanceStringIndex = require('../internals/advance-string-index');\nvar regExpExec = require('../internals/regexp-exec-abstract');\n\n// @@match logic\nfixRegExpWellKnownSymbolLogic('match', 1, function (MATCH, nativeMatch, maybeCallNative) {\n return [\n // `String.prototype.match` method\n // https://tc39.github.io/ecma262/#sec-string.prototype.match\n function match(regexp) {\n var O = requireObjectCoercible(this);\n var matcher = regexp == undefined ? undefined : regexp[MATCH];\n return matcher !== undefined ? matcher.call(regexp, O) : new RegExp(regexp)[MATCH](String(O));\n },\n // `RegExp.prototype[@@match]` method\n // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@match\n function (regexp) {\n var res = maybeCallNative(nativeMatch, regexp, this);\n if (res.done) return res.value;\n\n var rx = anObject(regexp);\n var S = String(this);\n\n if (!rx.global) return regExpExec(rx, S);\n\n var fullUnicode = rx.unicode;\n rx.lastIndex = 0;\n var A = [];\n var n = 0;\n var result;\n while ((result = regExpExec(rx, S)) !== null) {\n var matchStr = String(result[0]);\n A[n] = matchStr;\n if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);\n n++;\n }\n return n === 0 ? null : A;\n }\n ];\n});\n","var global = require('../internals/global');\nvar fails = require('../internals/fails');\nvar classof = require('../internals/classof-raw');\nvar bind = require('../internals/function-bind-context');\nvar html = require('../internals/html');\nvar createElement = require('../internals/document-create-element');\nvar IS_IOS = require('../internals/engine-is-ios');\n\nvar location = global.location;\nvar set = global.setImmediate;\nvar clear = global.clearImmediate;\nvar process = global.process;\nvar MessageChannel = global.MessageChannel;\nvar Dispatch = global.Dispatch;\nvar counter = 0;\nvar queue = {};\nvar ONREADYSTATECHANGE = 'onreadystatechange';\nvar defer, channel, port;\n\nvar run = function (id) {\n // eslint-disable-next-line no-prototype-builtins\n if (queue.hasOwnProperty(id)) {\n var fn = queue[id];\n delete queue[id];\n fn();\n }\n};\n\nvar runner = function (id) {\n return function () {\n run(id);\n };\n};\n\nvar listener = function (event) {\n run(event.data);\n};\n\nvar post = function (id) {\n // old engines have not location.origin\n global.postMessage(id + '', location.protocol + '//' + location.host);\n};\n\n// Node.js 0.9+ & IE10+ has setImmediate, otherwise:\nif (!set || !clear) {\n set = function setImmediate(fn) {\n var args = [];\n var i = 1;\n while (arguments.length > i) args.push(arguments[i++]);\n queue[++counter] = function () {\n // eslint-disable-next-line no-new-func\n (typeof fn == 'function' ? fn : Function(fn)).apply(undefined, args);\n };\n defer(counter);\n return counter;\n };\n clear = function clearImmediate(id) {\n delete queue[id];\n };\n // Node.js 0.8-\n if (classof(process) == 'process') {\n defer = function (id) {\n process.nextTick(runner(id));\n };\n // Sphere (JS game engine) Dispatch API\n } else if (Dispatch && Dispatch.now) {\n defer = function (id) {\n Dispatch.now(runner(id));\n };\n // Browsers with MessageChannel, includes WebWorkers\n // except iOS - https://github.com/zloirock/core-js/issues/624\n } else if (MessageChannel && !IS_IOS) {\n channel = new MessageChannel();\n port = channel.port2;\n channel.port1.onmessage = listener;\n defer = bind(port.postMessage, port, 1);\n // Browsers with postMessage, skip WebWorkers\n // IE8 has postMessage, but it's sync & typeof its postMessage is 'object'\n } else if (\n global.addEventListener &&\n typeof postMessage == 'function' &&\n !global.importScripts &&\n !fails(post) &&\n location.protocol !== 'file:'\n ) {\n defer = post;\n global.addEventListener('message', listener, false);\n // IE8-\n } else if (ONREADYSTATECHANGE in createElement('script')) {\n defer = function (id) {\n html.appendChild(createElement('script'))[ONREADYSTATECHANGE] = function () {\n html.removeChild(this);\n run(id);\n };\n };\n // Rest old browsers\n } else {\n defer = function (id) {\n setTimeout(runner(id), 0);\n };\n }\n}\n\nmodule.exports = {\n set: set,\n clear: clear\n};\n","var global = require('../internals/global');\n\nmodule.exports = global.Promise;\n","'use strict';\nvar getBuiltIn = require('../internals/get-built-in');\nvar definePropertyModule = require('../internals/object-define-property');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\nvar DESCRIPTORS = require('../internals/descriptors');\n\nvar SPECIES = wellKnownSymbol('species');\n\nmodule.exports = function (CONSTRUCTOR_NAME) {\n var Constructor = getBuiltIn(CONSTRUCTOR_NAME);\n var defineProperty = definePropertyModule.f;\n\n if (DESCRIPTORS && Constructor && !Constructor[SPECIES]) {\n defineProperty(Constructor, SPECIES, {\n configurable: true,\n get: function () { return this; }\n });\n }\n};\n","var userAgent = require('../internals/engine-user-agent');\n\nmodule.exports = /(iphone|ipod|ipad).*applewebkit/i.test(userAgent);\n","var global = require('../internals/global');\nvar getOwnPropertyDescriptor = require('../internals/object-get-own-property-descriptor').f;\nvar classof = require('../internals/classof-raw');\nvar macrotask = require('../internals/task').set;\nvar IS_IOS = require('../internals/engine-is-ios');\n\nvar MutationObserver = global.MutationObserver || global.WebKitMutationObserver;\nvar process = global.process;\nvar Promise = global.Promise;\nvar IS_NODE = classof(process) == 'process';\n// Node.js 11 shows ExperimentalWarning on getting `queueMicrotask`\nvar queueMicrotaskDescriptor = getOwnPropertyDescriptor(global, 'queueMicrotask');\nvar queueMicrotask = queueMicrotaskDescriptor && queueMicrotaskDescriptor.value;\n\nvar flush, head, last, notify, toggle, node, promise, then;\n\n// modern engines have queueMicrotask method\nif (!queueMicrotask) {\n flush = function () {\n var parent, fn;\n if (IS_NODE && (parent = process.domain)) parent.exit();\n while (head) {\n fn = head.fn;\n head = head.next;\n try {\n fn();\n } catch (error) {\n if (head) notify();\n else last = undefined;\n throw error;\n }\n } last = undefined;\n if (parent) parent.enter();\n };\n\n // Node.js\n if (IS_NODE) {\n notify = function () {\n process.nextTick(flush);\n };\n // browsers with MutationObserver, except iOS - https://github.com/zloirock/core-js/issues/339\n } else if (MutationObserver && !IS_IOS) {\n toggle = true;\n node = document.createTextNode('');\n new MutationObserver(flush).observe(node, { characterData: true });\n notify = function () {\n node.data = toggle = !toggle;\n };\n // environments with maybe non-completely correct, but existent Promise\n } else if (Promise && Promise.resolve) {\n // Promise.resolve without an argument throws an error in LG WebOS 2\n promise = Promise.resolve(undefined);\n then = promise.then;\n notify = function () {\n then.call(promise, flush);\n };\n // for other environments - macrotask based on:\n // - setImmediate\n // - MessageChannel\n // - window.postMessag\n // - onreadystatechange\n // - setTimeout\n } else {\n notify = function () {\n // strange IE + webpack dev server bug - use .call(global)\n macrotask.call(global, flush);\n };\n }\n}\n\nmodule.exports = queueMicrotask || function (fn) {\n var task = { fn: fn, next: undefined };\n if (last) last.next = task;\n if (!head) {\n head = task;\n notify();\n } last = task;\n};\n","'use strict';\nvar $ = require('../internals/export');\nvar IS_PURE = require('../internals/is-pure');\nvar global = require('../internals/global');\nvar getBuiltIn = require('../internals/get-built-in');\nvar NativePromise = require('../internals/native-promise-constructor');\nvar redefine = require('../internals/redefine');\nvar redefineAll = require('../internals/redefine-all');\nvar setToStringTag = require('../internals/set-to-string-tag');\nvar setSpecies = require('../internals/set-species');\nvar isObject = require('../internals/is-object');\nvar aFunction = require('../internals/a-function');\nvar anInstance = require('../internals/an-instance');\nvar classof = require('../internals/classof-raw');\nvar inspectSource = require('../internals/inspect-source');\nvar iterate = require('../internals/iterate');\nvar checkCorrectnessOfIteration = require('../internals/check-correctness-of-iteration');\nvar speciesConstructor = require('../internals/species-constructor');\nvar task = require('../internals/task').set;\nvar microtask = require('../internals/microtask');\nvar promiseResolve = require('../internals/promise-resolve');\nvar hostReportErrors = require('../internals/host-report-errors');\nvar newPromiseCapabilityModule = require('../internals/new-promise-capability');\nvar perform = require('../internals/perform');\nvar InternalStateModule = require('../internals/internal-state');\nvar isForced = require('../internals/is-forced');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\nvar V8_VERSION = require('../internals/engine-v8-version');\n\nvar SPECIES = wellKnownSymbol('species');\nvar PROMISE = 'Promise';\nvar getInternalState = InternalStateModule.get;\nvar setInternalState = InternalStateModule.set;\nvar getInternalPromiseState = InternalStateModule.getterFor(PROMISE);\nvar PromiseConstructor = NativePromise;\nvar TypeError = global.TypeError;\nvar document = global.document;\nvar process = global.process;\nvar $fetch = getBuiltIn('fetch');\nvar newPromiseCapability = newPromiseCapabilityModule.f;\nvar newGenericPromiseCapability = newPromiseCapability;\nvar IS_NODE = classof(process) == 'process';\nvar DISPATCH_EVENT = !!(document && document.createEvent && global.dispatchEvent);\nvar UNHANDLED_REJECTION = 'unhandledrejection';\nvar REJECTION_HANDLED = 'rejectionhandled';\nvar PENDING = 0;\nvar FULFILLED = 1;\nvar REJECTED = 2;\nvar HANDLED = 1;\nvar UNHANDLED = 2;\nvar Internal, OwnPromiseCapability, PromiseWrapper, nativeThen;\n\nvar FORCED = isForced(PROMISE, function () {\n var GLOBAL_CORE_JS_PROMISE = inspectSource(PromiseConstructor) !== String(PromiseConstructor);\n if (!GLOBAL_CORE_JS_PROMISE) {\n // V8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables\n // https://bugs.chromium.org/p/chromium/issues/detail?id=830565\n // We can't detect it synchronously, so just check versions\n if (V8_VERSION === 66) return true;\n // Unhandled rejections tracking support, NodeJS Promise without it fails @@species test\n if (!IS_NODE && typeof PromiseRejectionEvent != 'function') return true;\n }\n // We need Promise#finally in the pure version for preventing prototype pollution\n if (IS_PURE && !PromiseConstructor.prototype['finally']) return true;\n // We can't use @@species feature detection in V8 since it causes\n // deoptimization and performance degradation\n // https://github.com/zloirock/core-js/issues/679\n if (V8_VERSION >= 51 && /native code/.test(PromiseConstructor)) return false;\n // Detect correctness of subclassing with @@species support\n var promise = PromiseConstructor.resolve(1);\n var FakePromise = function (exec) {\n exec(function () { /* empty */ }, function () { /* empty */ });\n };\n var constructor = promise.constructor = {};\n constructor[SPECIES] = FakePromise;\n return !(promise.then(function () { /* empty */ }) instanceof FakePromise);\n});\n\nvar INCORRECT_ITERATION = FORCED || !checkCorrectnessOfIteration(function (iterable) {\n PromiseConstructor.all(iterable)['catch'](function () { /* empty */ });\n});\n\n// helpers\nvar isThenable = function (it) {\n var then;\n return isObject(it) && typeof (then = it.then) == 'function' ? then : false;\n};\n\nvar notify = function (promise, state, isReject) {\n if (state.notified) return;\n state.notified = true;\n var chain = state.reactions;\n microtask(function () {\n var value = state.value;\n var ok = state.state == FULFILLED;\n var index = 0;\n // variable length - can't use forEach\n while (chain.length > index) {\n var reaction = chain[index++];\n var handler = ok ? reaction.ok : reaction.fail;\n var resolve = reaction.resolve;\n var reject = reaction.reject;\n var domain = reaction.domain;\n var result, then, exited;\n try {\n if (handler) {\n if (!ok) {\n if (state.rejection === UNHANDLED) onHandleUnhandled(promise, state);\n state.rejection = HANDLED;\n }\n if (handler === true) result = value;\n else {\n if (domain) domain.enter();\n result = handler(value); // can throw\n if (domain) {\n domain.exit();\n exited = true;\n }\n }\n if (result === reaction.promise) {\n reject(TypeError('Promise-chain cycle'));\n } else if (then = isThenable(result)) {\n then.call(result, resolve, reject);\n } else resolve(result);\n } else reject(value);\n } catch (error) {\n if (domain && !exited) domain.exit();\n reject(error);\n }\n }\n state.reactions = [];\n state.notified = false;\n if (isReject && !state.rejection) onUnhandled(promise, state);\n });\n};\n\nvar dispatchEvent = function (name, promise, reason) {\n var event, handler;\n if (DISPATCH_EVENT) {\n event = document.createEvent('Event');\n event.promise = promise;\n event.reason = reason;\n event.initEvent(name, false, true);\n global.dispatchEvent(event);\n } else event = { promise: promise, reason: reason };\n if (handler = global['on' + name]) handler(event);\n else if (name === UNHANDLED_REJECTION) hostReportErrors('Unhandled promise rejection', reason);\n};\n\nvar onUnhandled = function (promise, state) {\n task.call(global, function () {\n var value = state.value;\n var IS_UNHANDLED = isUnhandled(state);\n var result;\n if (IS_UNHANDLED) {\n result = perform(function () {\n if (IS_NODE) {\n process.emit('unhandledRejection', value, promise);\n } else dispatchEvent(UNHANDLED_REJECTION, promise, value);\n });\n // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should\n state.rejection = IS_NODE || isUnhandled(state) ? UNHANDLED : HANDLED;\n if (result.error) throw result.value;\n }\n });\n};\n\nvar isUnhandled = function (state) {\n return state.rejection !== HANDLED && !state.parent;\n};\n\nvar onHandleUnhandled = function (promise, state) {\n task.call(global, function () {\n if (IS_NODE) {\n process.emit('rejectionHandled', promise);\n } else dispatchEvent(REJECTION_HANDLED, promise, state.value);\n });\n};\n\nvar bind = function (fn, promise, state, unwrap) {\n return function (value) {\n fn(promise, state, value, unwrap);\n };\n};\n\nvar internalReject = function (promise, state, value, unwrap) {\n if (state.done) return;\n state.done = true;\n if (unwrap) state = unwrap;\n state.value = value;\n state.state = REJECTED;\n notify(promise, state, true);\n};\n\nvar internalResolve = function (promise, state, value, unwrap) {\n if (state.done) return;\n state.done = true;\n if (unwrap) state = unwrap;\n try {\n if (promise === value) throw TypeError(\"Promise can't be resolved itself\");\n var then = isThenable(value);\n if (then) {\n microtask(function () {\n var wrapper = { done: false };\n try {\n then.call(value,\n bind(internalResolve, promise, wrapper, state),\n bind(internalReject, promise, wrapper, state)\n );\n } catch (error) {\n internalReject(promise, wrapper, error, state);\n }\n });\n } else {\n state.value = value;\n state.state = FULFILLED;\n notify(promise, state, false);\n }\n } catch (error) {\n internalReject(promise, { done: false }, error, state);\n }\n};\n\n// constructor polyfill\nif (FORCED) {\n // 25.4.3.1 Promise(executor)\n PromiseConstructor = function Promise(executor) {\n anInstance(this, PromiseConstructor, PROMISE);\n aFunction(executor);\n Internal.call(this);\n var state = getInternalState(this);\n try {\n executor(bind(internalResolve, this, state), bind(internalReject, this, state));\n } catch (error) {\n internalReject(this, state, error);\n }\n };\n // eslint-disable-next-line no-unused-vars\n Internal = function Promise(executor) {\n setInternalState(this, {\n type: PROMISE,\n done: false,\n notified: false,\n parent: false,\n reactions: [],\n rejection: false,\n state: PENDING,\n value: undefined\n });\n };\n Internal.prototype = redefineAll(PromiseConstructor.prototype, {\n // `Promise.prototype.then` method\n // https://tc39.github.io/ecma262/#sec-promise.prototype.then\n then: function then(onFulfilled, onRejected) {\n var state = getInternalPromiseState(this);\n var reaction = newPromiseCapability(speciesConstructor(this, PromiseConstructor));\n reaction.ok = typeof onFulfilled == 'function' ? onFulfilled : true;\n reaction.fail = typeof onRejected == 'function' && onRejected;\n reaction.domain = IS_NODE ? process.domain : undefined;\n state.parent = true;\n state.reactions.push(reaction);\n if (state.state != PENDING) notify(this, state, false);\n return reaction.promise;\n },\n // `Promise.prototype.catch` method\n // https://tc39.github.io/ecma262/#sec-promise.prototype.catch\n 'catch': function (onRejected) {\n return this.then(undefined, onRejected);\n }\n });\n OwnPromiseCapability = function () {\n var promise = new Internal();\n var state = getInternalState(promise);\n this.promise = promise;\n this.resolve = bind(internalResolve, promise, state);\n this.reject = bind(internalReject, promise, state);\n };\n newPromiseCapabilityModule.f = newPromiseCapability = function (C) {\n return C === PromiseConstructor || C === PromiseWrapper\n ? new OwnPromiseCapability(C)\n : newGenericPromiseCapability(C);\n };\n\n if (!IS_PURE && typeof NativePromise == 'function') {\n nativeThen = NativePromise.prototype.then;\n\n // wrap native Promise#then for native async functions\n redefine(NativePromise.prototype, 'then', function then(onFulfilled, onRejected) {\n var that = this;\n return new PromiseConstructor(function (resolve, reject) {\n nativeThen.call(that, resolve, reject);\n }).then(onFulfilled, onRejected);\n // https://github.com/zloirock/core-js/issues/640\n }, { unsafe: true });\n\n // wrap fetch result\n if (typeof $fetch == 'function') $({ global: true, enumerable: true, forced: true }, {\n // eslint-disable-next-line no-unused-vars\n fetch: function fetch(input /* , init */) {\n return promiseResolve(PromiseConstructor, $fetch.apply(global, arguments));\n }\n });\n }\n}\n\n$({ global: true, wrap: true, forced: FORCED }, {\n Promise: PromiseConstructor\n});\n\nsetToStringTag(PromiseConstructor, PROMISE, false, true);\nsetSpecies(PROMISE);\n\nPromiseWrapper = getBuiltIn(PROMISE);\n\n// statics\n$({ target: PROMISE, stat: true, forced: FORCED }, {\n // `Promise.reject` method\n // https://tc39.github.io/ecma262/#sec-promise.reject\n reject: function reject(r) {\n var capability = newPromiseCapability(this);\n capability.reject.call(undefined, r);\n return capability.promise;\n }\n});\n\n$({ target: PROMISE, stat: true, forced: IS_PURE || FORCED }, {\n // `Promise.resolve` method\n // https://tc39.github.io/ecma262/#sec-promise.resolve\n resolve: function resolve(x) {\n return promiseResolve(IS_PURE && this === PromiseWrapper ? PromiseConstructor : this, x);\n }\n});\n\n$({ target: PROMISE, stat: true, forced: INCORRECT_ITERATION }, {\n // `Promise.all` method\n // https://tc39.github.io/ecma262/#sec-promise.all\n all: function all(iterable) {\n var C = this;\n var capability = newPromiseCapability(C);\n var resolve = capability.resolve;\n var reject = capability.reject;\n var result = perform(function () {\n var $promiseResolve = aFunction(C.resolve);\n var values = [];\n var counter = 0;\n var remaining = 1;\n iterate(iterable, function (promise) {\n var index = counter++;\n var alreadyCalled = false;\n values.push(undefined);\n remaining++;\n $promiseResolve.call(C, promise).then(function (value) {\n if (alreadyCalled) return;\n alreadyCalled = true;\n values[index] = value;\n --remaining || resolve(values);\n }, reject);\n });\n --remaining || resolve(values);\n });\n if (result.error) reject(result.value);\n return capability.promise;\n },\n // `Promise.race` method\n // https://tc39.github.io/ecma262/#sec-promise.race\n race: function race(iterable) {\n var C = this;\n var capability = newPromiseCapability(C);\n var reject = capability.reject;\n var result = perform(function () {\n var $promiseResolve = aFunction(C.resolve);\n iterate(iterable, function (promise) {\n $promiseResolve.call(C, promise).then(capability.resolve, reject);\n });\n });\n if (result.error) reject(result.value);\n return capability.promise;\n }\n});\n","'use strict';\nvar aFunction = require('../internals/a-function');\n\nvar PromiseCapability = function (C) {\n var resolve, reject;\n this.promise = new C(function ($$resolve, $$reject) {\n if (resolve !== undefined || reject !== undefined) throw TypeError('Bad Promise constructor');\n resolve = $$resolve;\n reject = $$reject;\n });\n this.resolve = aFunction(resolve);\n this.reject = aFunction(reject);\n};\n\n// 25.4.1.5 NewPromiseCapability(C)\nmodule.exports.f = function (C) {\n return new PromiseCapability(C);\n};\n","var anObject = require('../internals/an-object');\nvar isObject = require('../internals/is-object');\nvar newPromiseCapability = require('../internals/new-promise-capability');\n\nmodule.exports = function (C, x) {\n anObject(C);\n if (isObject(x) && x.constructor === C) return x;\n var promiseCapability = newPromiseCapability.f(C);\n var resolve = promiseCapability.resolve;\n resolve(x);\n return promiseCapability.promise;\n};\n","module.exports = function (exec) {\n try {\n return { error: false, value: exec() };\n } catch (error) {\n return { error: true, value: error };\n }\n};\n","var global = require('../internals/global');\n\nmodule.exports = function (a, b) {\n var console = global.console;\n if (console && console.error) {\n arguments.length === 1 ? console.error(a) : console.error(a, b);\n }\n};\n","'use strict';\nvar $ = require('../internals/export');\nvar getOwnPropertyDescriptor = require('../internals/object-get-own-property-descriptor').f;\nvar toLength = require('../internals/to-length');\nvar notARegExp = require('../internals/not-a-regexp');\nvar requireObjectCoercible = require('../internals/require-object-coercible');\nvar correctIsRegExpLogic = require('../internals/correct-is-regexp-logic');\nvar IS_PURE = require('../internals/is-pure');\n\nvar nativeStartsWith = ''.startsWith;\nvar min = Math.min;\n\nvar CORRECT_IS_REGEXP_LOGIC = correctIsRegExpLogic('startsWith');\n// https://github.com/zloirock/core-js/pull/702\nvar MDN_POLYFILL_BUG = !IS_PURE && !CORRECT_IS_REGEXP_LOGIC && !!function () {\n var descriptor = getOwnPropertyDescriptor(String.prototype, 'startsWith');\n return descriptor && !descriptor.writable;\n}();\n\n// `String.prototype.startsWith` method\n// https://tc39.github.io/ecma262/#sec-string.prototype.startswith\n$({ target: 'String', proto: true, forced: !MDN_POLYFILL_BUG && !CORRECT_IS_REGEXP_LOGIC }, {\n startsWith: function startsWith(searchString /* , position = 0 */) {\n var that = String(requireObjectCoercible(this));\n notARegExp(searchString);\n var index = toLength(min(arguments.length > 1 ? arguments[1] : undefined, that.length));\n var search = String(searchString);\n return nativeStartsWith\n ? nativeStartsWith.call(that, search, index)\n : that.slice(index, index + search.length) === search;\n }\n});\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) && isFunction(input.then);\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// 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// 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","var aFunction = require('../internals/a-function');\nvar toObject = require('../internals/to-object');\nvar IndexedObject = require('../internals/indexed-object');\nvar toLength = require('../internals/to-length');\n\n// `Array.prototype.{ reduce, reduceRight }` methods implementation\nvar createMethod = function (IS_RIGHT) {\n return function (that, callbackfn, argumentsLength, memo) {\n aFunction(callbackfn);\n var O = toObject(that);\n var self = IndexedObject(O);\n var length = toLength(O.length);\n var index = IS_RIGHT ? length - 1 : 0;\n var i = IS_RIGHT ? -1 : 1;\n if (argumentsLength < 2) while (true) {\n if (index in self) {\n memo = self[index];\n index += i;\n break;\n }\n index += i;\n if (IS_RIGHT ? index < 0 : length <= index) {\n throw TypeError('Reduce of empty array with no initial value');\n }\n }\n for (;IS_RIGHT ? index >= 0 : length > index; index += i) if (index in self) {\n memo = callbackfn(memo, self[index], index, O);\n }\n return memo;\n };\n};\n\nmodule.exports = {\n // `Array.prototype.reduce` method\n // https://tc39.github.io/ecma262/#sec-array.prototype.reduce\n left: createMethod(false),\n // `Array.prototype.reduceRight` method\n // https://tc39.github.io/ecma262/#sec-array.prototype.reduceright\n right: createMethod(true)\n};\n","'use strict';\nvar $ = require('../internals/export');\nvar $reduce = require('../internals/array-reduce').left;\nvar arrayMethodIsStrict = require('../internals/array-method-is-strict');\nvar arrayMethodUsesToLength = require('../internals/array-method-uses-to-length');\n\nvar STRICT_METHOD = arrayMethodIsStrict('reduce');\nvar USES_TO_LENGTH = arrayMethodUsesToLength('reduce', { 1: 0 });\n\n// `Array.prototype.reduce` method\n// https://tc39.github.io/ecma262/#sec-array.prototype.reduce\n$({ target: 'Array', proto: true, forced: !STRICT_METHOD || !USES_TO_LENGTH }, {\n reduce: function reduce(callbackfn /* , initialValue */) {\n return $reduce(this, callbackfn, arguments.length, arguments.length > 1 ? arguments[1] : undefined);\n }\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 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// Closest ancestor element matching selector (also tests element itself)\nexport function closest(element, selector) {\n const { prototype } = Element;\n\n // https://developer.mozilla.org/en-US/docs/Web/API/Element/closest#Polyfill\n function closestElement() {\n let el = this;\n\n do {\n if (matches.matches(el, selector)) return el;\n el = el.parentElement || el.parentNode;\n } while (el !== null && el.nodeType === 1);\n return null;\n }\n\n const method = prototype.closest || closestElement;\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// 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// 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: { ...detail, plyr: this },\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","import is from './is';\n/**\n * Silence a Promise-like object.\n * This is useful for avoiding non-harmful, but potentially confusing \"uncaught\n * play promise\" rejection error messages.\n * @param {Object} value An object that may or may not be `Promise`-like.\n */\nexport function silencePromise(value) {\n if (is.promise(value)) {\n value.then(null, () => {});\n }\n}\n\nexport default { silencePromise };\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 { wrapper } = this.elements;\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 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.config.vimeo.premium && this.supported.ui) {\n const height = (100 / this.media.offsetWidth) * parseInt(window.getComputedStyle(this.media).paddingBottom, 10);\n const offset = (height - padding) / (height / 50);\n\n this.media.style.transform = `translateY(-${offset}%)`;\n } else if (this.isHTML5) {\n 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 { silencePromise } from './utils/promise';\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 // Whether we're forcing all options (e.g. for streaming)\n if (this.config.quality.forced) {\n return this.config.quality.options;\n }\n\n // Get sizes from <source> elements\n return html5.getSources\n .call(this)\n .map(source => Number(source.getAttribute('data-res')))\n .filter(Boolean);\n },\n\n setup() {\n if (!this.isHTML5) {\n return;\n }\n\n const player = this;\n\n // Set speed options from config\n player.options.speed = player.config.speed.options;\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('data-res'));\n },\n set(input) {\n if (player.quality === input) {\n return;\n }\n\n // If we're using an an external handler...\n if (player.config.quality.forced && is.function(player.config.quality.onChange)) {\n player.config.quality.onChange(input);\n } else {\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('data-res')) === input);\n\n // No matching source found\n if (!source) {\n return;\n }\n\n // Get current state\n const { currentTime, paused, preload, readyState, playbackRate } = 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.speed = playbackRate;\n player.currentTime = currentTime;\n\n // Resume playing\n if (!paused) {\n silencePromise(player.play());\n }\n });\n\n // Load new source\n player.media.load();\n }\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","var DESCRIPTORS = require('../internals/descriptors');\nvar global = require('../internals/global');\nvar isForced = require('../internals/is-forced');\nvar inheritIfRequired = require('../internals/inherit-if-required');\nvar defineProperty = require('../internals/object-define-property').f;\nvar getOwnPropertyNames = require('../internals/object-get-own-property-names').f;\nvar isRegExp = require('../internals/is-regexp');\nvar getFlags = require('../internals/regexp-flags');\nvar stickyHelpers = require('../internals/regexp-sticky-helpers');\nvar redefine = require('../internals/redefine');\nvar fails = require('../internals/fails');\nvar setInternalState = require('../internals/internal-state').set;\nvar setSpecies = require('../internals/set-species');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\n\nvar MATCH = wellKnownSymbol('match');\nvar NativeRegExp = global.RegExp;\nvar RegExpPrototype = NativeRegExp.prototype;\nvar re1 = /a/g;\nvar re2 = /a/g;\n\n// \"new\" should create a new object, old webkit bug\nvar CORRECT_NEW = new NativeRegExp(re1) !== re1;\n\nvar UNSUPPORTED_Y = stickyHelpers.UNSUPPORTED_Y;\n\nvar FORCED = DESCRIPTORS && isForced('RegExp', (!CORRECT_NEW || UNSUPPORTED_Y || fails(function () {\n re2[MATCH] = false;\n // RegExp constructor can alter flags and IsRegExp works correct with @@match\n return NativeRegExp(re1) != re1 || NativeRegExp(re2) == re2 || NativeRegExp(re1, 'i') != '/a/i';\n})));\n\n// `RegExp` constructor\n// https://tc39.github.io/ecma262/#sec-regexp-constructor\nif (FORCED) {\n var RegExpWrapper = function RegExp(pattern, flags) {\n var thisIsRegExp = this instanceof RegExpWrapper;\n var patternIsRegExp = isRegExp(pattern);\n var flagsAreUndefined = flags === undefined;\n var sticky;\n\n if (!thisIsRegExp && patternIsRegExp && pattern.constructor === RegExpWrapper && flagsAreUndefined) {\n return pattern;\n }\n\n if (CORRECT_NEW) {\n if (patternIsRegExp && !flagsAreUndefined) pattern = pattern.source;\n } else if (pattern instanceof RegExpWrapper) {\n if (flagsAreUndefined) flags = getFlags.call(pattern);\n pattern = pattern.source;\n }\n\n if (UNSUPPORTED_Y) {\n sticky = !!flags && flags.indexOf('y') > -1;\n if (sticky) flags = flags.replace(/y/g, '');\n }\n\n var result = inheritIfRequired(\n CORRECT_NEW ? new NativeRegExp(pattern, flags) : NativeRegExp(pattern, flags),\n thisIsRegExp ? this : RegExpPrototype,\n RegExpWrapper\n );\n\n if (UNSUPPORTED_Y && sticky) setInternalState(result, { sticky: sticky });\n\n return result;\n };\n var proxy = function (key) {\n key in RegExpWrapper || defineProperty(RegExpWrapper, key, {\n configurable: true,\n get: function () { return NativeRegExp[key]; },\n set: function (it) { NativeRegExp[key] = it; }\n });\n };\n var keys = getOwnPropertyNames(NativeRegExp);\n var index = 0;\n while (keys.length > index) proxy(keys[index++]);\n RegExpPrototype.constructor = RegExpWrapper;\n RegExpWrapper.prototype = RegExpPrototype;\n redefine(global, 'RegExp', RegExpWrapper);\n}\n\n// https://tc39.github.io/ecma262/#sec-get-regexp-@@species\nsetSpecies('RegExp');\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 const replaceAll = (input = '', find = '', replace = '') =>\n input.replace(new RegExp(find.toString().replace(/([.*+?^=!:${}()|[\\]/\\\\])/g, '\\\\$1'), 'g'), replace.toString());\n\n// Convert to title case\nexport const toTitleCase = (input = '') =>\n input.toString().replace(/\\w\\S*/g, text => text.charAt(0).toUpperCase() + text.substr(1).toLowerCase());\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","var $ = require('../internals/export');\n\nvar ceil = Math.ceil;\nvar floor = Math.floor;\n\n// `Math.trunc` method\n// https://tc39.github.io/ecma262/#sec-math.trunc\n$({ target: 'Math', stat: true }, {\n trunc: function trunc(it) {\n return (it > 0 ? floor : ceil)(it);\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(undefined, 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(`.${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);\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 'aria-hidden': 'true',\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 const attributes = { ...attr, class: [attr.class, this.config.classNames.hidden].filter(Boolean).join(' ') };\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.call(\n this,\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.call(this, 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=\"menucaptions\"]');\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() {\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 // Filter out invalid speeds\n this.options.speed = this.options.speed.filter(o => o >= this.minimumSpeed && o <= this.maximumSpeed);\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 (is.array(this.config.controls) && 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(is.array(this.config.controls) ? 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 // Ignored on iOS as it's handled globally\n // https://developer.apple.com/library/safari/documentation/AudioVideo/Conceptual/Using_HTML5_Audio_Video/Device-SpecificConsiderations/Device-SpecificConsiderations.html\n if (control === 'volume' && !browser.isIos) {\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.call(this, 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.call(\n this,\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.call(this, 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 // Menu Captions\n pane.appendChild(\n createElement('div', {\n role: 'menucaptions',\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 // Set download attribute for HTML5 only\n if (this.isHTML5) {\n attributes.download = '';\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 }\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\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 // Note: mode='hidden' forces a track to download. To ensure every track\n // isn't downloaded at once, only 'showing' tracks should be reassigned\n // eslint-disable-next-line no-param-reassign\n if (track.mode === 'showing') {\n // eslint-disable-next-line no-param-reassign\n track.mode = 'hidden';\n }\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 (\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\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 // Wait for the call stack to clear before setting mode='hidden'\n // on the active track - forcing the browser to download it\n setTimeout(() => {\n if (active && this.captions.toggled) {\n this.captions.currentTrackNode.mode = 'hidden';\n }\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: '/theme/modules/plyr/plyr.svg',\n\n // Blank video (used to prevent errors on source change)\n blankVideo: '/theme/modules/plyr/blank.webm',\n\n // Quality default\n quality: {\n default: 576,\n // The options to display in the UI, if available for the source media\n options: [4320, 2880, 2160, 1440, 1080, 720, 576, 480, 360, 240],\n forced: false,\n onChange: null,\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 // The options to display in the UI, if available for the source media (e.g. Vimeo and YouTube only support 0.5x-4x)\n options: [0.5, 0.75, 1, 1.25, 1.5, 1.75, 2, 4],\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 // Selector for the fullscreen container so contextual / non-player content can remain visible in fullscreen mode\n // Non-ancestors of the player element will be ignored\n // container: null, // defaults to the player element\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 pip: 'PIP',\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 // Whether the owner of the video has a Pro or Business account\n // (which allows us to properly hide controls without CSS hacks, etc)\n premium: false,\n // Custom settings from Plyr\n referrerPolicy: null, // https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement/referrerPolicy\n },\n\n // YouTube plugin\n youtube: {\n noCookie: true, // 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 { closest,getElements, hasClass, toggleClass } from './utils/elements';\nimport { on, triggerEvent } from './utils/events';\nimport is from './utils/is';\nimport { silencePromise } from './utils/promise';\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 // Get the fullscreen element\n // Checks container is an ancestor, defaults to null\n this.player.elements.fullscreen =\n player.config.fullscreen.container && closest(this.player.elements.container, player.config.fullscreen.container);\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 this.onChange();\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 // Tap focus when in fullscreen\n on.call(this, this.player.elements.container, 'keydown', event => this.trapFocus(event));\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 && element.shadowRoot ? element === this.target.getRootNode().host : 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.fullscreen || this.player.elements.container;\n }\n\n 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\n 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 this.onChange();\n }\n\n // Trap focus inside container\n trapFocus(event) {\n // Bail if iOS, not active, not the tab key\n if (browser.isIos || !this.active || event.key !== 'Tab' || event.keyCode !== 9) {\n return;\n }\n\n // Get the current focused element\n const focused = document.activeElement;\n const focusable = getElements.call(this.player, 'a[href], button:not(:disabled), input:not(:disabled), [tabindex]');\n const [first] = focusable;\n const last = focusable[focusable.length - 1];\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 // 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 this.toggleFallback(true);\n } else if (!this.prefix) {\n this.target.requestFullscreen({ navigationUI: 'hide' });\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 silencePromise(this.player.play());\n } else if (!Fullscreen.native || this.forceFallback) {\n this.toggleFallback(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","// `Math.sign` method implementation\n// https://tc39.github.io/ecma262/#sec-math.sign\nmodule.exports = Math.sign || function sign(x) {\n // eslint-disable-next-line no-self-compare\n return (x = +x) == 0 || x != x ? x : x < 0 ? -1 : 1;\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\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","var $ = require('../internals/export');\nvar sign = require('../internals/math-sign');\n\n// `Math.sign` method\n// https://tc39.github.io/ecma262/#sec-math.sign\n$({ target: 'Math', stat: true }, {\n sign: sign\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('data-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\n ui.togglePoster.call(this, true);\n\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 target.setAttribute('aria-label', i18n.get(this.playing ? 'pause' : 'play', this.config));\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 || this.loading || this.paused || controlsElement.pressed || controlsElement.hover || recentTouchSeek,\n ),\n );\n }\n },\n\n // Migrate any custom properties from the media to the parent\n migrateStyles() {\n // Loop through values (as they are the keys when the object is spread 🤔)\n Object.values({ ...this.media.style })\n // We're only fussed about Plyr specific properties\n .filter(key => !is.empty(key) && key.startsWith('--plyr'))\n .forEach(key => {\n // Set on the container\n this.elements.container.style.setProperty(key, this.media.style.getPropertyValue(key));\n\n // Clean up from media element\n this.media.style.removeProperty(key);\n });\n\n // Remove attribute if empty\n if (is.empty(this.media.style)) {\n this.media.removeAttribute('style');\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 } from './utils/elements';\nimport { off, on, once, toggleListener, triggerEvent } from './utils/events';\nimport is from './utils/is';\nimport { silencePromise } from './utils/promise';\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 silencePromise(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 if (event.type !== 'focusout') {\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\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 focusout', 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 || player.config.vimeo.premium) {\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 browser fullscreen API, 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 // 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 // Call pause otherwise IE11 will start playing the video again\n player.pause();\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(\n event,\n () => {\n silencePromise(player.play());\n },\n 'play',\n );\n } else {\n this.proxy(\n event,\n () => {\n silencePromise(player.togglePlay());\n },\n 'play',\n );\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 !== false && 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(\n button,\n 'click',\n () => {\n silencePromise(player.togglePlay());\n },\n 'play',\n );\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(\n elements.buttons.settings,\n 'click',\n event => {\n // Prevent the document click listener closing the menu\n event.stopPropagation();\n event.preventDefault();\n\n controls.toggleMenu.call(player, event);\n },\n null,\n false,\n ); // Can't be passive as we're preventing default\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 silencePromise(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 touchend 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 // Also update controls.hover state for any non-player children of fullscreen element (as above)\n if (elements.fullscreen) {\n Array.from(elements.fullscreen.children)\n .filter(c => !c.contains(elements.container))\n .forEach(child => {\n this.bind(child, 'mouseenter mouseleave', event => {\n elements.controls.hover = !player.touch && event.type === 'mouseenter';\n });\n });\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","'use strict';\nvar $ = require('../internals/export');\nvar toAbsoluteIndex = require('../internals/to-absolute-index');\nvar toInteger = require('../internals/to-integer');\nvar toLength = require('../internals/to-length');\nvar toObject = require('../internals/to-object');\nvar arraySpeciesCreate = require('../internals/array-species-create');\nvar createProperty = require('../internals/create-property');\nvar arrayMethodHasSpeciesSupport = require('../internals/array-method-has-species-support');\nvar arrayMethodUsesToLength = require('../internals/array-method-uses-to-length');\n\nvar HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('splice');\nvar USES_TO_LENGTH = arrayMethodUsesToLength('splice', { ACCESSORS: true, 0: 0, 1: 2 });\n\nvar max = Math.max;\nvar min = Math.min;\nvar MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF;\nvar MAXIMUM_ALLOWED_LENGTH_EXCEEDED = 'Maximum allowed length exceeded';\n\n// `Array.prototype.splice` method\n// https://tc39.github.io/ecma262/#sec-array.prototype.splice\n// with adding support of @@species\n$({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT || !USES_TO_LENGTH }, {\n splice: function splice(start, deleteCount /* , ...items */) {\n var O = toObject(this);\n var len = toLength(O.length);\n var actualStart = toAbsoluteIndex(start, len);\n var argumentsLength = arguments.length;\n var insertCount, actualDeleteCount, A, k, from, to;\n if (argumentsLength === 0) {\n insertCount = actualDeleteCount = 0;\n } else if (argumentsLength === 1) {\n insertCount = 0;\n actualDeleteCount = len - actualStart;\n } else {\n insertCount = argumentsLength - 2;\n actualDeleteCount = min(max(toInteger(deleteCount), 0), len - actualStart);\n }\n if (len + insertCount - actualDeleteCount > MAX_SAFE_INTEGER) {\n throw TypeError(MAXIMUM_ALLOWED_LENGTH_EXCEEDED);\n }\n A = arraySpeciesCreate(O, actualDeleteCount);\n for (k = 0; k < actualDeleteCount; k++) {\n from = actualStart + k;\n if (from in O) createProperty(A, k, O[from]);\n }\n A.length = actualDeleteCount;\n if (insertCount < actualDeleteCount) {\n for (k = actualStart; k < len - actualDeleteCount; k++) {\n from = k + actualDeleteCount;\n to = k + insertCount;\n if (from in O) O[to] = O[from];\n else delete O[to];\n }\n for (k = len; k > len - actualDeleteCount + insertCount; k--) delete O[k - 1];\n } else if (insertCount > actualDeleteCount) {\n for (k = len - actualDeleteCount; k > actualStart; k--) {\n from = k + actualDeleteCount - 1;\n to = k + insertCount - 1;\n if (from in O) O[to] = O[from];\n else delete O[to];\n }\n }\n for (k = 0; k < insertCount; k++) {\n O[k + actualStart] = arguments[k + 2];\n }\n O.length = len - actualDeleteCount + insertCount;\n return A;\n }\n});\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 pathname = path.replace(/[\\?|#].*$/, ''),\n pathStripped = path.replace(/^(css|img)!/, ''),\n isLegacyIECss,\n e;\n\n numTries = numTries || 0;\n\n if (/(^css!|\\.css$)/.test(pathname)) {\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|webp)$)/.test(pathname)) {\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 { 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 const player = this;\n\n // Add embed class for responsive\n toggleClass(player.elements.wrapper, player.config.classNames.embed, true);\n\n // Set speed options from config\n player.options.speed = player.config.speed.options;\n\n // Set intial ratio\n setAspectRatio.call(player);\n\n // Load the SDK if not already\n if (!is.object(window.Vimeo)) {\n loadScript(player.config.urls.vimeo.sdk)\n .then(() => {\n vimeo.ready.call(player);\n })\n .catch(error => {\n player.debug.warn('Vimeo SDK (player.js) failed to load', error);\n });\n } else {\n vimeo.ready.call(player);\n }\n },\n\n // API Ready\n ready() {\n const player = this;\n const config = player.config.vimeo;\n const { premium, referrerPolicy, ...frameParams } = config;\n\n // If the owner has a pro or premium account then we can hide controls etc\n if (premium) {\n Object.assign(frameParams, {\n controls: false,\n sidedock: false,\n });\n }\n\n // Get Vimeo params for the iframe\n const params = buildUrlParams({\n loop: player.config.loop.active,\n autoplay: player.autoplay,\n muted: player.muted,\n gesture: 'media',\n playsinline: !this.config.fullscreen.iosNative,\n ...frameParams,\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('allow', 'autoplay,fullscreen,picture-in-picture');\n\n // Set the referrer policy if required\n if (!is.empty(referrerPolicy)) {\n iframe.setAttribute('referrerPolicy', referrerPolicy);\n }\n\n // Inject the package\n const { poster } = player;\n if (premium) {\n iframe.setAttribute('data-poster', poster);\n player.media = replaceElement(iframe, player.media);\n } else {\n const wrapper = createElement('div', { class: player.config.classNames.embedContainer, 'data-poster': poster });\n wrapper.appendChild(iframe);\n player.media = replaceElement(wrapper, player.media);\n }\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(() => {\n // Cannot set Playback Rate, Video is probably not on Pro account\n player.options.speed = [1];\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('bufferstart', () => {\n triggerEvent.call(player, player.media, 'waiting');\n });\n\n player.embed.on('bufferend', () => {\n triggerEvent.call(player, player.media, 'playing');\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, 'data-poster': 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 const speeds = instance.getAvailablePlaybackRates();\n // Filter based on config\n player.options.speed = speeds.filter(s => player.config.speed.options.includes(s));\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 case 3:\n // Trigger waiting event to add loading classes to container as the video buffers.\n triggerEvent.call(player, player.media, 'waiting');\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 // Poster image 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.setup.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 { silencePromise } from '../utils/promise';\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: config.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 // 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 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 // 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 if (this.player.ended) {\n this.loadAds();\n } else {\n // The SDK won't allow new ads to be called without receiving a contentComplete()\n this.loader.contentComplete();\n }\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 silencePromise(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 // Now that the manager has been destroyed set it to also be un-initialized\n this.initialized = false;\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","'use strict';\nvar $ = require('../internals/export');\nvar $findIndex = require('../internals/array-iteration').findIndex;\nvar addToUnscopables = require('../internals/add-to-unscopables');\nvar arrayMethodUsesToLength = require('../internals/array-method-uses-to-length');\n\nvar FIND_INDEX = 'findIndex';\nvar SKIPS_HOLES = true;\n\nvar USES_TO_LENGTH = arrayMethodUsesToLength(FIND_INDEX);\n\n// Shouldn't skip holes\nif (FIND_INDEX in []) Array(1)[FIND_INDEX](function () { SKIPS_HOLES = false; });\n\n// `Array.prototype.findIndex` method\n// https://tc39.github.io/ecma262/#sec-array.prototype.findindex\n$({ target: 'Array', proto: true, forced: SKIPS_HOLES || !USES_TO_LENGTH }, {\n findIndex: function findIndex(callbackfn /* , that = undefined */) {\n return $findIndex(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);\n }\n});\n\n// https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables\naddToUnscopables(FIND_INDEX);\n","'use strict';\nvar toIndexedObject = require('../internals/to-indexed-object');\nvar toInteger = require('../internals/to-integer');\nvar toLength = require('../internals/to-length');\nvar arrayMethodIsStrict = require('../internals/array-method-is-strict');\nvar arrayMethodUsesToLength = require('../internals/array-method-uses-to-length');\n\nvar min = Math.min;\nvar nativeLastIndexOf = [].lastIndexOf;\nvar NEGATIVE_ZERO = !!nativeLastIndexOf && 1 / [1].lastIndexOf(1, -0) < 0;\nvar STRICT_METHOD = arrayMethodIsStrict('lastIndexOf');\n// For preventing possible almost infinite loop in non-standard implementations, test the forward version of the method\nvar USES_TO_LENGTH = arrayMethodUsesToLength('indexOf', { ACCESSORS: true, 1: 0 });\nvar FORCED = NEGATIVE_ZERO || !STRICT_METHOD || !USES_TO_LENGTH;\n\n// `Array.prototype.lastIndexOf` method implementation\n// https://tc39.github.io/ecma262/#sec-array.prototype.lastindexof\nmodule.exports = FORCED ? function lastIndexOf(searchElement /* , fromIndex = @[*-1] */) {\n // convert -0 to +0\n if (NEGATIVE_ZERO) return nativeLastIndexOf.apply(this, arguments) || 0;\n var O = toIndexedObject(this);\n var length = toLength(O.length);\n var index = length - 1;\n if (arguments.length > 1) index = min(index, toInteger(arguments[1]));\n if (index < 0) index = length + index;\n for (;index >= 0; index--) if (index in O && O[index] === searchElement) return index || 0;\n return -1;\n} : nativeLastIndexOf;\n","var $ = require('../internals/export');\nvar lastIndexOf = require('../internals/array-last-index-of');\n\n// `Array.prototype.lastIndexOf` method\n// https://tc39.github.io/ecma262/#sec-array.prototype.lastindexof\n$({ target: 'Array', proto: true, forced: lastIndexOf !== [].lastIndexOf }, {\n lastIndexOf: lastIndexOf\n});\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\nconst fitRatio = (ratio, outer) => {\n const targetRatio = outer.width / outer.height;\n const result = {};\n if (ratio > targetRatio) {\n result.width = outer.width;\n result.height = (1 / ratio) * outer.width;\n } else {\n result.height = outer.height;\n result.width = ratio * outer.height;\n }\n\n return result;\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 // Toggle the 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 // Resolve promise\n const sortAndResolve = () => {\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 // Via callback()\n if (is.function(src)) {\n src(thumbnails => {\n this.thumbnails = thumbnails;\n sortAndResolve();\n });\n }\n // VTT urls\n else {\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 // Resolve\n Promise.all(promises).then(sortAndResolve);\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 does not exist or is false)\n if (is.nullOrUndefined(event.button) || 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 destroy() {\n if (this.elements.thumb.container) {\n this.elements.thumb.container.remove();\n }\n if (this.elements.scrubbing.container) {\n this.elements.scrubbing.container.remove();\n }\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 = () => 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)) 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 const { height } = fitRatio(this.thumbAspectRatio, {\n width: this.player.media.clientWidth,\n height: this.player.media.clientHeight,\n });\n return height;\n }\n\n // If css is used this needs to return the css height for sprites to work (see setImageSizeAndOffset)\n if (this.sizeSpecifiedInCSS) {\n return this.elements.thumb.imageContainer.clientHeight;\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 || this.elements.thumb.imageContainer.clientWidth > 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 } else if (\n this.elements.thumb.imageContainer.clientHeight > 20 &&\n this.elements.thumb.imageContainer.clientWidth < 20\n ) {\n const thumbWidth = Math.floor(this.elements.thumb.imageContainer.clientHeight * this.thumbAspectRatio);\n this.elements.thumb.imageContainer.style.width = `${thumbWidth}px`;\n } else if (\n this.elements.thumb.imageContainer.clientHeight < 20 &&\n this.elements.thumb.imageContainer.clientWidth > 20\n ) {\n const thumbHeight = Math.floor(this.elements.thumb.imageContainer.clientWidth / this.thumbAspectRatio);\n this.elements.thumb.imageContainer.style.height = `${thumbHeight}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 const { width, height } = fitRatio(this.thumbAspectRatio, {\n width: this.player.media.clientWidth,\n height: this.player.media.clientHeight,\n });\n this.elements.scrubbing.container.style.width = `${width}px`;\n this.elements.scrubbing.container.style.height = `${height}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 = `${previewImage.naturalHeight * multiplier}px`;\n // eslint-disable-next-line no-param-reassign\n previewImage.style.width = `${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 PreviewThumbnails from './plugins/preview-thumbnails';\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 // Update previewThumbnails config & reload plugin\n if (!is.empty(input.previewThumbnails)) {\n Object.assign(this.config.previewThumbnails, input.previewThumbnails);\n\n // Cleanup previewThumbnails plugin if it was loaded\n if (this.previewThumbnails && this.previewThumbnails.loaded) {\n this.previewThumbnails.destroy();\n this.previewThumbnails = null;\n }\n\n // Create new instance if it is still enabled\n if (this.config.previewThumbnails.enabled) {\n this.previewThumbnails = new PreviewThumbnails(this);\n }\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.6.2\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 { silencePromise } from './utils/promise';\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 fullscreen: 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 // Migrate custom properties from media to container (so they work 😉)\n ui.migrateStyles.call(this);\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 fullscreen\n this.fullscreen = new Fullscreen(this);\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 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(() => silencePromise(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(() => silencePromise(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 null;\n }\n\n return 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 return this.play();\n }\n\n return this.pause();\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 -= 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 += 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') || this.media.getAttribute('data-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 && is.array(this.config.controls) && 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"]} \ No newline at end of file
diff --git a/youtube/static/modules/plyr/plyr.polyfilled.min.mjs b/youtube/static/modules/plyr/plyr.polyfilled.min.mjs
new file mode 100644
index 0000000..3ede929
--- /dev/null
+++ b/youtube/static/modules/plyr/plyr.polyfilled.min.mjs
@@ -0,0 +1,3 @@
+"object"==typeof navigator&&function(){if("undefined"!=typeof window)try{var e=new window.CustomEvent("test",{cancelable:!0});if(e.preventDefault(),!0!==e.defaultPrevented)throw new Error("Could not prevent default")}catch(e){var t=function(e,t){var n,r;return(t=t||{}).bubbles=!!t.bubbles,t.cancelable=!!t.cancelable,(n=document.createEvent("CustomEvent")).initCustomEvent(e,t.bubbles,t.cancelable,t.detail),r=n.preventDefault,n.preventDefault=function(){r.call(this);try{Object.defineProperty(this,"defaultPrevented",{get:function(){return!0}})}catch(e){this.defaultPrevented=!0}},n};t.prototype=window.Event.prototype,window.CustomEvent=t}}();var commonjsGlobal="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function createCommonjsModule(e,t){return e(t={exports:{}},t.exports),t.exports}var check=function(e){return e&&e.Math==Math&&e},global_1=check("object"==typeof globalThis&&globalThis)||check("object"==typeof window&&window)||check("object"==typeof self&&self)||check("object"==typeof commonjsGlobal&&commonjsGlobal)||Function("return this")(),fails=function(e){try{return!!e()}catch(e){return!0}},descriptors=!fails((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),nativePropertyIsEnumerable={}.propertyIsEnumerable,getOwnPropertyDescriptor=Object.getOwnPropertyDescriptor,NASHORN_BUG=getOwnPropertyDescriptor&&!nativePropertyIsEnumerable.call({1:2},1),f=NASHORN_BUG?function(e){var t=getOwnPropertyDescriptor(this,e);return!!t&&t.enumerable}:nativePropertyIsEnumerable,objectPropertyIsEnumerable={f:f},createPropertyDescriptor=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},toString={}.toString,classofRaw=function(e){return toString.call(e).slice(8,-1)},split="".split,indexedObject=fails((function(){return!Object("z").propertyIsEnumerable(0)}))?function(e){return"String"==classofRaw(e)?split.call(e,""):Object(e)}:Object,requireObjectCoercible=function(e){if(null==e)throw TypeError("Can't call method on "+e);return e},toIndexedObject=function(e){return indexedObject(requireObjectCoercible(e))},isObject=function(e){return"object"==typeof e?null!==e:"function"==typeof e},toPrimitive=function(e,t){if(!isObject(e))return e;var n,r;if(t&&"function"==typeof(n=e.toString)&&!isObject(r=n.call(e)))return r;if("function"==typeof(n=e.valueOf)&&!isObject(r=n.call(e)))return r;if(!t&&"function"==typeof(n=e.toString)&&!isObject(r=n.call(e)))return r;throw TypeError("Can't convert object to primitive value")},hasOwnProperty={}.hasOwnProperty,has=function(e,t){return hasOwnProperty.call(e,t)},document$1=global_1.document,EXISTS=isObject(document$1)&&isObject(document$1.createElement),documentCreateElement=function(e){return EXISTS?document$1.createElement(e):{}},ie8DomDefine=!descriptors&&!fails((function(){return 7!=Object.defineProperty(documentCreateElement("div"),"a",{get:function(){return 7}}).a})),nativeGetOwnPropertyDescriptor=Object.getOwnPropertyDescriptor,f$1=descriptors?nativeGetOwnPropertyDescriptor:function(e,t){if(e=toIndexedObject(e),t=toPrimitive(t,!0),ie8DomDefine)try{return nativeGetOwnPropertyDescriptor(e,t)}catch(e){}if(has(e,t))return createPropertyDescriptor(!objectPropertyIsEnumerable.f.call(e,t),e[t])},objectGetOwnPropertyDescriptor={f:f$1},anObject=function(e){if(!isObject(e))throw TypeError(String(e)+" is not an object");return e},nativeDefineProperty=Object.defineProperty,f$2=descriptors?nativeDefineProperty:function(e,t,n){if(anObject(e),t=toPrimitive(t,!0),anObject(n),ie8DomDefine)try{return nativeDefineProperty(e,t,n)}catch(e){}if("get"in n||"set"in n)throw TypeError("Accessors not supported");return"value"in n&&(e[t]=n.value),e},objectDefineProperty={f:f$2},createNonEnumerableProperty=descriptors?function(e,t,n){return objectDefineProperty.f(e,t,createPropertyDescriptor(1,n))}:function(e,t,n){return e[t]=n,e},setGlobal=function(e,t){try{createNonEnumerableProperty(global_1,e,t)}catch(n){global_1[e]=t}return t},SHARED="__core-js_shared__",store=global_1[SHARED]||setGlobal(SHARED,{}),sharedStore=store,functionToString=Function.toString;"function"!=typeof sharedStore.inspectSource&&(sharedStore.inspectSource=function(e){return functionToString.call(e)});var set,get,has$1,inspectSource=sharedStore.inspectSource,WeakMap$1=global_1.WeakMap,nativeWeakMap="function"==typeof WeakMap$1&&/native code/.test(inspectSource(WeakMap$1)),isPure=!1,shared=createCommonjsModule((function(e){(e.exports=function(e,t){return sharedStore[e]||(sharedStore[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.6.5",mode:"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})})),id=0,postfix=Math.random(),uid=function(e){return"Symbol("+String(void 0===e?"":e)+")_"+(++id+postfix).toString(36)},keys=shared("keys"),sharedKey=function(e){return keys[e]||(keys[e]=uid(e))},hiddenKeys={},WeakMap$2=global_1.WeakMap,enforce=function(e){return has$1(e)?get(e):set(e,{})},getterFor=function(e){return function(t){var n;if(!isObject(t)||(n=get(t)).type!==e)throw TypeError("Incompatible receiver, "+e+" required");return n}};if(nativeWeakMap){var store$1=new WeakMap$2,wmget=store$1.get,wmhas=store$1.has,wmset=store$1.set;set=function(e,t){return wmset.call(store$1,e,t),t},get=function(e){return wmget.call(store$1,e)||{}},has$1=function(e){return wmhas.call(store$1,e)}}else{var STATE=sharedKey("state");hiddenKeys[STATE]=!0,set=function(e,t){return createNonEnumerableProperty(e,STATE,t),t},get=function(e){return has(e,STATE)?e[STATE]:{}},has$1=function(e){return has(e,STATE)}}var activeXDocument,internalState={set:set,get:get,has:has$1,enforce:enforce,getterFor:getterFor},redefine=createCommonjsModule((function(e){var t=internalState.get,n=internalState.enforce,r=String(String).split("String");(e.exports=function(e,t,i,o){var a=!!o&&!!o.unsafe,s=!!o&&!!o.enumerable,l=!!o&&!!o.noTargetGet;"function"==typeof i&&("string"!=typeof t||has(i,"name")||createNonEnumerableProperty(i,"name",t),n(i).source=r.join("string"==typeof t?t:"")),e!==global_1?(a?!l&&e[t]&&(s=!0):delete e[t],s?e[t]=i:createNonEnumerableProperty(e,t,i)):s?e[t]=i:setGlobal(t,i)})(Function.prototype,"toString",(function(){return"function"==typeof this&&t(this).source||inspectSource(this)}))})),path=global_1,aFunction=function(e){return"function"==typeof e?e:void 0},getBuiltIn=function(e,t){return arguments.length<2?aFunction(path[e])||aFunction(global_1[e]):path[e]&&path[e][t]||global_1[e]&&global_1[e][t]},ceil=Math.ceil,floor=Math.floor,toInteger=function(e){return isNaN(e=+e)?0:(e>0?floor:ceil)(e)},min=Math.min,toLength=function(e){return e>0?min(toInteger(e),9007199254740991):0},max=Math.max,min$1=Math.min,toAbsoluteIndex=function(e,t){var n=toInteger(e);return n<0?max(n+t,0):min$1(n,t)},createMethod=function(e){return function(t,n,r){var i,o=toIndexedObject(t),a=toLength(o.length),s=toAbsoluteIndex(r,a);if(e&&n!=n){for(;a>s;)if((i=o[s++])!=i)return!0}else for(;a>s;s++)if((e||s in o)&&o[s]===n)return e||s||0;return!e&&-1}},arrayIncludes={includes:createMethod(!0),indexOf:createMethod(!1)},indexOf=arrayIncludes.indexOf,objectKeysInternal=function(e,t){var n,r=toIndexedObject(e),i=0,o=[];for(n in r)!has(hiddenKeys,n)&&has(r,n)&&o.push(n);for(;t.length>i;)has(r,n=t[i++])&&(~indexOf(o,n)||o.push(n));return o},enumBugKeys=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],hiddenKeys$1=enumBugKeys.concat("length","prototype"),f$3=Object.getOwnPropertyNames||function(e){return objectKeysInternal(e,hiddenKeys$1)},objectGetOwnPropertyNames={f:f$3},f$4=Object.getOwnPropertySymbols,objectGetOwnPropertySymbols={f:f$4},ownKeys=getBuiltIn("Reflect","ownKeys")||function(e){var t=objectGetOwnPropertyNames.f(anObject(e)),n=objectGetOwnPropertySymbols.f;return n?t.concat(n(e)):t},copyConstructorProperties=function(e,t){for(var n=ownKeys(t),r=objectDefineProperty.f,i=objectGetOwnPropertyDescriptor.f,o=0;o<n.length;o++){var a=n[o];has(e,a)||r(e,a,i(t,a))}},replacement=/#|\.prototype\./,isForced=function(e,t){var n=data[normalize(e)];return n==POLYFILL||n!=NATIVE&&("function"==typeof t?fails(t):!!t)},normalize=isForced.normalize=function(e){return String(e).replace(replacement,".").toLowerCase()},data=isForced.data={},NATIVE=isForced.NATIVE="N",POLYFILL=isForced.POLYFILL="P",isForced_1=isForced,getOwnPropertyDescriptor$1=objectGetOwnPropertyDescriptor.f,_export=function(e,t){var n,r,i,o,a,s=e.target,l=e.global,c=e.stat;if(n=l?global_1:c?global_1[s]||setGlobal(s,{}):(global_1[s]||{}).prototype)for(r in t){if(o=t[r],i=e.noTargetGet?(a=getOwnPropertyDescriptor$1(n,r))&&a.value:n[r],!isForced_1(l?r:s+(c?".":"#")+r,e.forced)&&void 0!==i){if(typeof o==typeof i)continue;copyConstructorProperties(o,i)}(e.sham||i&&i.sham)&&createNonEnumerableProperty(o,"sham",!0),redefine(n,r,o,e)}},nativeSymbol=!!Object.getOwnPropertySymbols&&!fails((function(){return!String(Symbol())})),useSymbolAsUid=nativeSymbol&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,isArray=Array.isArray||function(e){return"Array"==classofRaw(e)},toObject=function(e){return Object(requireObjectCoercible(e))},objectKeys=Object.keys||function(e){return objectKeysInternal(e,enumBugKeys)},objectDefineProperties=descriptors?Object.defineProperties:function(e,t){anObject(e);for(var n,r=objectKeys(t),i=r.length,o=0;i>o;)objectDefineProperty.f(e,n=r[o++],t[n]);return e},html=getBuiltIn("document","documentElement"),GT=">",LT="<",PROTOTYPE="prototype",SCRIPT="script",IE_PROTO=sharedKey("IE_PROTO"),EmptyConstructor=function(){},scriptTag=function(e){return LT+SCRIPT+GT+e+LT+"/"+SCRIPT+GT},NullProtoObjectViaActiveX=function(e){e.write(scriptTag("")),e.close();var t=e.parentWindow.Object;return e=null,t},NullProtoObjectViaIFrame=function(){var e,t=documentCreateElement("iframe"),n="java"+SCRIPT+":";return t.style.display="none",html.appendChild(t),t.src=String(n),(e=t.contentWindow.document).open(),e.write(scriptTag("document.F=Object")),e.close(),e.F},NullProtoObject=function(){try{activeXDocument=document.domain&&new ActiveXObject("htmlfile")}catch(e){}NullProtoObject=activeXDocument?NullProtoObjectViaActiveX(activeXDocument):NullProtoObjectViaIFrame();for(var e=enumBugKeys.length;e--;)delete NullProtoObject[PROTOTYPE][enumBugKeys[e]];return NullProtoObject()};hiddenKeys[IE_PROTO]=!0;var objectCreate=Object.create||function(e,t){var n;return null!==e?(EmptyConstructor[PROTOTYPE]=anObject(e),n=new EmptyConstructor,EmptyConstructor[PROTOTYPE]=null,n[IE_PROTO]=e):n=NullProtoObject(),void 0===t?n:objectDefineProperties(n,t)},nativeGetOwnPropertyNames=objectGetOwnPropertyNames.f,toString$1={}.toString,windowNames="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],getWindowNames=function(e){try{return nativeGetOwnPropertyNames(e)}catch(e){return windowNames.slice()}},f$5=function(e){return windowNames&&"[object Window]"==toString$1.call(e)?getWindowNames(e):nativeGetOwnPropertyNames(toIndexedObject(e))},objectGetOwnPropertyNamesExternal={f:f$5},WellKnownSymbolsStore=shared("wks"),Symbol$1=global_1.Symbol,createWellKnownSymbol=useSymbolAsUid?Symbol$1:Symbol$1&&Symbol$1.withoutSetter||uid,wellKnownSymbol=function(e){return has(WellKnownSymbolsStore,e)||(nativeSymbol&&has(Symbol$1,e)?WellKnownSymbolsStore[e]=Symbol$1[e]:WellKnownSymbolsStore[e]=createWellKnownSymbol("Symbol."+e)),WellKnownSymbolsStore[e]},f$6=wellKnownSymbol,wellKnownSymbolWrapped={f:f$6},defineProperty=objectDefineProperty.f,defineWellKnownSymbol=function(e){var t=path.Symbol||(path.Symbol={});has(t,e)||defineProperty(t,e,{value:wellKnownSymbolWrapped.f(e)})},defineProperty$1=objectDefineProperty.f,TO_STRING_TAG=wellKnownSymbol("toStringTag"),setToStringTag=function(e,t,n){e&&!has(e=n?e:e.prototype,TO_STRING_TAG)&&defineProperty$1(e,TO_STRING_TAG,{configurable:!0,value:t})},aFunction$1=function(e){if("function"!=typeof e)throw TypeError(String(e)+" is not a function");return e},functionBindContext=function(e,t,n){if(aFunction$1(e),void 0===t)return e;switch(n){case 0:return function(){return e.call(t)};case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,i){return e.call(t,n,r,i)}}return function(){return e.apply(t,arguments)}},SPECIES=wellKnownSymbol("species"),arraySpeciesCreate=function(e,t){var n;return isArray(e)&&("function"!=typeof(n=e.constructor)||n!==Array&&!isArray(n.prototype)?isObject(n)&&null===(n=n[SPECIES])&&(n=void 0):n=void 0),new(void 0===n?Array:n)(0===t?0:t)},push=[].push,createMethod$1=function(e){var t=1==e,n=2==e,r=3==e,i=4==e,o=6==e,a=5==e||o;return function(s,l,c,u){for(var d,h,p=toObject(s),f=indexedObject(p),m=functionBindContext(l,c,3),g=toLength(f.length),y=0,b=u||arraySpeciesCreate,v=t?b(s,g):n?b(s,0):void 0;g>y;y++)if((a||y in f)&&(h=m(d=f[y],y,p),e))if(t)v[y]=h;else if(h)switch(e){case 3:return!0;case 5:return d;case 6:return y;case 2:push.call(v,d)}else if(i)return!1;return o?-1:r||i?i:v}},arrayIteration={forEach:createMethod$1(0),map:createMethod$1(1),filter:createMethod$1(2),some:createMethod$1(3),every:createMethod$1(4),find:createMethod$1(5),findIndex:createMethod$1(6)},$forEach=arrayIteration.forEach,HIDDEN=sharedKey("hidden"),SYMBOL="Symbol",PROTOTYPE$1="prototype",TO_PRIMITIVE=wellKnownSymbol("toPrimitive"),setInternalState=internalState.set,getInternalState=internalState.getterFor(SYMBOL),ObjectPrototype=Object[PROTOTYPE$1],$Symbol=global_1.Symbol,$stringify=getBuiltIn("JSON","stringify"),nativeGetOwnPropertyDescriptor$1=objectGetOwnPropertyDescriptor.f,nativeDefineProperty$1=objectDefineProperty.f,nativeGetOwnPropertyNames$1=objectGetOwnPropertyNamesExternal.f,nativePropertyIsEnumerable$1=objectPropertyIsEnumerable.f,AllSymbols=shared("symbols"),ObjectPrototypeSymbols=shared("op-symbols"),StringToSymbolRegistry=shared("string-to-symbol-registry"),SymbolToStringRegistry=shared("symbol-to-string-registry"),WellKnownSymbolsStore$1=shared("wks"),QObject=global_1.QObject,USE_SETTER=!QObject||!QObject[PROTOTYPE$1]||!QObject[PROTOTYPE$1].findChild,setSymbolDescriptor=descriptors&&fails((function(){return 7!=objectCreate(nativeDefineProperty$1({},"a",{get:function(){return nativeDefineProperty$1(this,"a",{value:7}).a}})).a}))?function(e,t,n){var r=nativeGetOwnPropertyDescriptor$1(ObjectPrototype,t);r&&delete ObjectPrototype[t],nativeDefineProperty$1(e,t,n),r&&e!==ObjectPrototype&&nativeDefineProperty$1(ObjectPrototype,t,r)}:nativeDefineProperty$1,wrap=function(e,t){var n=AllSymbols[e]=objectCreate($Symbol[PROTOTYPE$1]);return setInternalState(n,{type:SYMBOL,tag:e,description:t}),descriptors||(n.description=t),n},isSymbol=useSymbolAsUid?function(e){return"symbol"==typeof e}:function(e){return Object(e)instanceof $Symbol},$defineProperty=function(e,t,n){e===ObjectPrototype&&$defineProperty(ObjectPrototypeSymbols,t,n),anObject(e);var r=toPrimitive(t,!0);return anObject(n),has(AllSymbols,r)?(n.enumerable?(has(e,HIDDEN)&&e[HIDDEN][r]&&(e[HIDDEN][r]=!1),n=objectCreate(n,{enumerable:createPropertyDescriptor(0,!1)})):(has(e,HIDDEN)||nativeDefineProperty$1(e,HIDDEN,createPropertyDescriptor(1,{})),e[HIDDEN][r]=!0),setSymbolDescriptor(e,r,n)):nativeDefineProperty$1(e,r,n)},$defineProperties=function(e,t){anObject(e);var n=toIndexedObject(t),r=objectKeys(n).concat($getOwnPropertySymbols(n));return $forEach(r,(function(t){descriptors&&!$propertyIsEnumerable.call(n,t)||$defineProperty(e,t,n[t])})),e},$create=function(e,t){return void 0===t?objectCreate(e):$defineProperties(objectCreate(e),t)},$propertyIsEnumerable=function(e){var t=toPrimitive(e,!0),n=nativePropertyIsEnumerable$1.call(this,t);return!(this===ObjectPrototype&&has(AllSymbols,t)&&!has(ObjectPrototypeSymbols,t))&&(!(n||!has(this,t)||!has(AllSymbols,t)||has(this,HIDDEN)&&this[HIDDEN][t])||n)},$getOwnPropertyDescriptor=function(e,t){var n=toIndexedObject(e),r=toPrimitive(t,!0);if(n!==ObjectPrototype||!has(AllSymbols,r)||has(ObjectPrototypeSymbols,r)){var i=nativeGetOwnPropertyDescriptor$1(n,r);return!i||!has(AllSymbols,r)||has(n,HIDDEN)&&n[HIDDEN][r]||(i.enumerable=!0),i}},$getOwnPropertyNames=function(e){var t=nativeGetOwnPropertyNames$1(toIndexedObject(e)),n=[];return $forEach(t,(function(e){has(AllSymbols,e)||has(hiddenKeys,e)||n.push(e)})),n},$getOwnPropertySymbols=function(e){var t=e===ObjectPrototype,n=nativeGetOwnPropertyNames$1(t?ObjectPrototypeSymbols:toIndexedObject(e)),r=[];return $forEach(n,(function(e){!has(AllSymbols,e)||t&&!has(ObjectPrototype,e)||r.push(AllSymbols[e])})),r};if(nativeSymbol||(redefine(($Symbol=function(){if(this instanceof $Symbol)throw TypeError("Symbol is not a constructor");var e=arguments.length&&void 0!==arguments[0]?String(arguments[0]):void 0,t=uid(e),n=function(e){this===ObjectPrototype&&n.call(ObjectPrototypeSymbols,e),has(this,HIDDEN)&&has(this[HIDDEN],t)&&(this[HIDDEN][t]=!1),setSymbolDescriptor(this,t,createPropertyDescriptor(1,e))};return descriptors&&USE_SETTER&&setSymbolDescriptor(ObjectPrototype,t,{configurable:!0,set:n}),wrap(t,e)})[PROTOTYPE$1],"toString",(function(){return getInternalState(this).tag})),redefine($Symbol,"withoutSetter",(function(e){return wrap(uid(e),e)})),objectPropertyIsEnumerable.f=$propertyIsEnumerable,objectDefineProperty.f=$defineProperty,objectGetOwnPropertyDescriptor.f=$getOwnPropertyDescriptor,objectGetOwnPropertyNames.f=objectGetOwnPropertyNamesExternal.f=$getOwnPropertyNames,objectGetOwnPropertySymbols.f=$getOwnPropertySymbols,wellKnownSymbolWrapped.f=function(e){return wrap(wellKnownSymbol(e),e)},descriptors&&(nativeDefineProperty$1($Symbol[PROTOTYPE$1],"description",{configurable:!0,get:function(){return getInternalState(this).description}}),redefine(ObjectPrototype,"propertyIsEnumerable",$propertyIsEnumerable,{unsafe:!0}))),_export({global:!0,wrap:!0,forced:!nativeSymbol,sham:!nativeSymbol},{Symbol:$Symbol}),$forEach(objectKeys(WellKnownSymbolsStore$1),(function(e){defineWellKnownSymbol(e)})),_export({target:SYMBOL,stat:!0,forced:!nativeSymbol},{for:function(e){var t=String(e);if(has(StringToSymbolRegistry,t))return StringToSymbolRegistry[t];var n=$Symbol(t);return StringToSymbolRegistry[t]=n,SymbolToStringRegistry[n]=t,n},keyFor:function(e){if(!isSymbol(e))throw TypeError(e+" is not a symbol");if(has(SymbolToStringRegistry,e))return SymbolToStringRegistry[e]},useSetter:function(){USE_SETTER=!0},useSimple:function(){USE_SETTER=!1}}),_export({target:"Object",stat:!0,forced:!nativeSymbol,sham:!descriptors},{create:$create,defineProperty:$defineProperty,defineProperties:$defineProperties,getOwnPropertyDescriptor:$getOwnPropertyDescriptor}),_export({target:"Object",stat:!0,forced:!nativeSymbol},{getOwnPropertyNames:$getOwnPropertyNames,getOwnPropertySymbols:$getOwnPropertySymbols}),_export({target:"Object",stat:!0,forced:fails((function(){objectGetOwnPropertySymbols.f(1)}))},{getOwnPropertySymbols:function(e){return objectGetOwnPropertySymbols.f(toObject(e))}}),$stringify){var FORCED_JSON_STRINGIFY=!nativeSymbol||fails((function(){var e=$Symbol();return"[null]"!=$stringify([e])||"{}"!=$stringify({a:e})||"{}"!=$stringify(Object(e))}));_export({target:"JSON",stat:!0,forced:FORCED_JSON_STRINGIFY},{stringify:function(e,t,n){for(var r,i=[e],o=1;arguments.length>o;)i.push(arguments[o++]);if(r=t,(isObject(t)||void 0!==e)&&!isSymbol(e))return isArray(t)||(t=function(e,t){if("function"==typeof r&&(t=r.call(this,e,t)),!isSymbol(t))return t}),i[1]=t,$stringify.apply(null,i)}})}$Symbol[PROTOTYPE$1][TO_PRIMITIVE]||createNonEnumerableProperty($Symbol[PROTOTYPE$1],TO_PRIMITIVE,$Symbol[PROTOTYPE$1].valueOf),setToStringTag($Symbol,SYMBOL),hiddenKeys[HIDDEN]=!0;var defineProperty$2=objectDefineProperty.f,NativeSymbol=global_1.Symbol;if(descriptors&&"function"==typeof NativeSymbol&&(!("description"in NativeSymbol.prototype)||void 0!==NativeSymbol().description)){var EmptyStringDescriptionStore={},SymbolWrapper=function(){var e=arguments.length<1||void 0===arguments[0]?void 0:String(arguments[0]),t=this instanceof SymbolWrapper?new NativeSymbol(e):void 0===e?NativeSymbol():NativeSymbol(e);return""===e&&(EmptyStringDescriptionStore[t]=!0),t};copyConstructorProperties(SymbolWrapper,NativeSymbol);var symbolPrototype=SymbolWrapper.prototype=NativeSymbol.prototype;symbolPrototype.constructor=SymbolWrapper;var symbolToString=symbolPrototype.toString,native="Symbol(test)"==String(NativeSymbol("test")),regexp=/^Symbol\((.*)\)[^)]+$/;defineProperty$2(symbolPrototype,"description",{configurable:!0,get:function(){var e=isObject(this)?this.valueOf():this,t=symbolToString.call(e);if(has(EmptyStringDescriptionStore,e))return"";var n=native?t.slice(7,-1):t.replace(regexp,"$1");return""===n?void 0:n}}),_export({global:!0,forced:!0},{Symbol:SymbolWrapper})}defineWellKnownSymbol("iterator");var arrayMethodIsStrict=function(e,t){var n=[][e];return!!n&&fails((function(){n.call(null,t||function(){throw 1},1)}))},defineProperty$3=Object.defineProperty,cache={},thrower=function(e){throw e},arrayMethodUsesToLength=function(e,t){if(has(cache,e))return cache[e];t||(t={});var n=[][e],r=!!has(t,"ACCESSORS")&&t.ACCESSORS,i=has(t,0)?t[0]:thrower,o=has(t,1)?t[1]:void 0;return cache[e]=!!n&&!fails((function(){if(r&&!descriptors)return!0;var e={length:-1};r?defineProperty$3(e,1,{enumerable:!0,get:thrower}):e[1]=1,n.call(e,i,o)}))},$forEach$1=arrayIteration.forEach,STRICT_METHOD=arrayMethodIsStrict("forEach"),USES_TO_LENGTH=arrayMethodUsesToLength("forEach"),arrayForEach=STRICT_METHOD&&USES_TO_LENGTH?[].forEach:function(e){return $forEach$1(this,e,arguments.length>1?arguments[1]:void 0)};_export({target:"Array",proto:!0,forced:[].forEach!=arrayForEach},{forEach:arrayForEach});var $indexOf=arrayIncludes.indexOf,nativeIndexOf=[].indexOf,NEGATIVE_ZERO=!!nativeIndexOf&&1/[1].indexOf(1,-0)<0,STRICT_METHOD$1=arrayMethodIsStrict("indexOf"),USES_TO_LENGTH$1=arrayMethodUsesToLength("indexOf",{ACCESSORS:!0,1:0});_export({target:"Array",proto:!0,forced:NEGATIVE_ZERO||!STRICT_METHOD$1||!USES_TO_LENGTH$1},{indexOf:function(e){return NEGATIVE_ZERO?nativeIndexOf.apply(this,arguments)||0:$indexOf(this,e,arguments.length>1?arguments[1]:void 0)}});var UNSCOPABLES=wellKnownSymbol("unscopables"),ArrayPrototype=Array.prototype;null==ArrayPrototype[UNSCOPABLES]&&objectDefineProperty.f(ArrayPrototype,UNSCOPABLES,{configurable:!0,value:objectCreate(null)});var IteratorPrototype,PrototypeOfArrayIteratorPrototype,arrayIterator,addToUnscopables=function(e){ArrayPrototype[UNSCOPABLES][e]=!0},iterators={},correctPrototypeGetter=!fails((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),IE_PROTO$1=sharedKey("IE_PROTO"),ObjectPrototype$1=Object.prototype,objectGetPrototypeOf=correctPrototypeGetter?Object.getPrototypeOf:function(e){return e=toObject(e),has(e,IE_PROTO$1)?e[IE_PROTO$1]:"function"==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?ObjectPrototype$1:null},ITERATOR=wellKnownSymbol("iterator"),BUGGY_SAFARI_ITERATORS=!1,returnThis=function(){return this};[].keys&&("next"in(arrayIterator=[].keys())?(PrototypeOfArrayIteratorPrototype=objectGetPrototypeOf(objectGetPrototypeOf(arrayIterator)))!==Object.prototype&&(IteratorPrototype=PrototypeOfArrayIteratorPrototype):BUGGY_SAFARI_ITERATORS=!0),null==IteratorPrototype&&(IteratorPrototype={}),has(IteratorPrototype,ITERATOR)||createNonEnumerableProperty(IteratorPrototype,ITERATOR,returnThis);var iteratorsCore={IteratorPrototype:IteratorPrototype,BUGGY_SAFARI_ITERATORS:BUGGY_SAFARI_ITERATORS},IteratorPrototype$1=iteratorsCore.IteratorPrototype,returnThis$1=function(){return this},createIteratorConstructor=function(e,t,n){var r=t+" Iterator";return e.prototype=objectCreate(IteratorPrototype$1,{next:createPropertyDescriptor(1,n)}),setToStringTag(e,r,!1),iterators[r]=returnThis$1,e},aPossiblePrototype=function(e){if(!isObject(e)&&null!==e)throw TypeError("Can't set "+String(e)+" as a prototype");return e},objectSetPrototypeOf=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,n={};try{(e=Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set).call(n,[]),t=n instanceof Array}catch(e){}return function(n,r){return anObject(n),aPossiblePrototype(r),t?e.call(n,r):n.__proto__=r,n}}():void 0),IteratorPrototype$2=iteratorsCore.IteratorPrototype,BUGGY_SAFARI_ITERATORS$1=iteratorsCore.BUGGY_SAFARI_ITERATORS,ITERATOR$1=wellKnownSymbol("iterator"),KEYS="keys",VALUES="values",ENTRIES="entries",returnThis$2=function(){return this},defineIterator=function(e,t,n,r,i,o,a){createIteratorConstructor(n,t,r);var s,l,c,u=function(e){if(e===i&&m)return m;if(!BUGGY_SAFARI_ITERATORS$1&&e in p)return p[e];switch(e){case KEYS:case VALUES:case ENTRIES:return function(){return new n(this,e)}}return function(){return new n(this)}},d=t+" Iterator",h=!1,p=e.prototype,f=p[ITERATOR$1]||p["@@iterator"]||i&&p[i],m=!BUGGY_SAFARI_ITERATORS$1&&f||u(i),g="Array"==t&&p.entries||f;if(g&&(s=objectGetPrototypeOf(g.call(new e)),IteratorPrototype$2!==Object.prototype&&s.next&&(objectGetPrototypeOf(s)!==IteratorPrototype$2&&(objectSetPrototypeOf?objectSetPrototypeOf(s,IteratorPrototype$2):"function"!=typeof s[ITERATOR$1]&&createNonEnumerableProperty(s,ITERATOR$1,returnThis$2)),setToStringTag(s,d,!0))),i==VALUES&&f&&f.name!==VALUES&&(h=!0,m=function(){return f.call(this)}),p[ITERATOR$1]!==m&&createNonEnumerableProperty(p,ITERATOR$1,m),iterators[t]=m,i)if(l={values:u(VALUES),keys:o?m:u(KEYS),entries:u(ENTRIES)},a)for(c in l)(BUGGY_SAFARI_ITERATORS$1||h||!(c in p))&&redefine(p,c,l[c]);else _export({target:t,proto:!0,forced:BUGGY_SAFARI_ITERATORS$1||h},l);return l},ARRAY_ITERATOR="Array Iterator",setInternalState$1=internalState.set,getInternalState$1=internalState.getterFor(ARRAY_ITERATOR),es_array_iterator=defineIterator(Array,"Array",(function(e,t){setInternalState$1(this,{type:ARRAY_ITERATOR,target:toIndexedObject(e),index:0,kind:t})}),(function(){var e=getInternalState$1(this),t=e.target,n=e.kind,r=e.index++;return!t||r>=t.length?(e.target=void 0,{value:void 0,done:!0}):"keys"==n?{value:r,done:!1}:"values"==n?{value:t[r],done:!1}:{value:[r,t[r]],done:!1}}),"values");iterators.Arguments=iterators.Array,addToUnscopables("keys"),addToUnscopables("values"),addToUnscopables("entries");var nativeJoin=[].join,ES3_STRINGS=indexedObject!=Object,STRICT_METHOD$2=arrayMethodIsStrict("join",",");_export({target:"Array",proto:!0,forced:ES3_STRINGS||!STRICT_METHOD$2},{join:function(e){return nativeJoin.call(toIndexedObject(this),void 0===e?",":e)}});var match,version,createProperty=function(e,t,n){var r=toPrimitive(t);r in e?objectDefineProperty.f(e,r,createPropertyDescriptor(0,n)):e[r]=n},engineUserAgent=getBuiltIn("navigator","userAgent")||"",process=global_1.process,versions=process&&process.versions,v8=versions&&versions.v8;v8?version=(match=v8.split("."))[0]+match[1]:engineUserAgent&&(!(match=engineUserAgent.match(/Edge\/(\d+)/))||match[1]>=74)&&(match=engineUserAgent.match(/Chrome\/(\d+)/))&&(version=match[1]);var engineV8Version=version&&+version,SPECIES$1=wellKnownSymbol("species"),arrayMethodHasSpeciesSupport=function(e){return engineV8Version>=51||!fails((function(){var t=[];return(t.constructor={})[SPECIES$1]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},HAS_SPECIES_SUPPORT=arrayMethodHasSpeciesSupport("slice"),USES_TO_LENGTH$2=arrayMethodUsesToLength("slice",{ACCESSORS:!0,0:0,1:2}),SPECIES$2=wellKnownSymbol("species"),nativeSlice=[].slice,max$1=Math.max;_export({target:"Array",proto:!0,forced:!HAS_SPECIES_SUPPORT||!USES_TO_LENGTH$2},{slice:function(e,t){var n,r,i,o=toIndexedObject(this),a=toLength(o.length),s=toAbsoluteIndex(e,a),l=toAbsoluteIndex(void 0===t?a:t,a);if(isArray(o)&&("function"!=typeof(n=o.constructor)||n!==Array&&!isArray(n.prototype)?isObject(n)&&null===(n=n[SPECIES$2])&&(n=void 0):n=void 0,n===Array||void 0===n))return nativeSlice.call(o,s,l);for(r=new(void 0===n?Array:n)(max$1(l-s,0)),i=0;s<l;s++,i++)s in o&&createProperty(r,i,o[s]);return r.length=i,r}});var TO_STRING_TAG$1=wellKnownSymbol("toStringTag"),test={};test[TO_STRING_TAG$1]="z";var toStringTagSupport="[object z]"===String(test),TO_STRING_TAG$2=wellKnownSymbol("toStringTag"),CORRECT_ARGUMENTS="Arguments"==classofRaw(function(){return arguments}()),tryGet=function(e,t){try{return e[t]}catch(e){}},classof=toStringTagSupport?classofRaw:function(e){var t,n,r;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=tryGet(t=Object(e),TO_STRING_TAG$2))?n:CORRECT_ARGUMENTS?classofRaw(t):"Object"==(r=classofRaw(t))&&"function"==typeof t.callee?"Arguments":r},objectToString=toStringTagSupport?{}.toString:function(){return"[object "+classof(this)+"]"};toStringTagSupport||redefine(Object.prototype,"toString",objectToString,{unsafe:!0});var regexpFlags=function(){var e=anObject(this),t="";return e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.sticky&&(t+="y"),t};function RE(e,t){return RegExp(e,t)}var UNSUPPORTED_Y=fails((function(){var e=RE("a","y");return e.lastIndex=2,null!=e.exec("abcd")})),BROKEN_CARET=fails((function(){var e=RE("^r","gy");return e.lastIndex=2,null!=e.exec("str")})),regexpStickyHelpers={UNSUPPORTED_Y:UNSUPPORTED_Y,BROKEN_CARET:BROKEN_CARET},nativeExec=RegExp.prototype.exec,nativeReplace=String.prototype.replace,patchedExec=nativeExec,UPDATES_LAST_INDEX_WRONG=function(){var e=/a/,t=/b*/g;return nativeExec.call(e,"a"),nativeExec.call(t,"a"),0!==e.lastIndex||0!==t.lastIndex}(),UNSUPPORTED_Y$1=regexpStickyHelpers.UNSUPPORTED_Y||regexpStickyHelpers.BROKEN_CARET,NPCG_INCLUDED=void 0!==/()??/.exec("")[1],PATCH=UPDATES_LAST_INDEX_WRONG||NPCG_INCLUDED||UNSUPPORTED_Y$1;PATCH&&(patchedExec=function(e){var t,n,r,i,o=this,a=UNSUPPORTED_Y$1&&o.sticky,s=regexpFlags.call(o),l=o.source,c=0,u=e;return a&&(-1===(s=s.replace("y","")).indexOf("g")&&(s+="g"),u=String(e).slice(o.lastIndex),o.lastIndex>0&&(!o.multiline||o.multiline&&"\n"!==e[o.lastIndex-1])&&(l="(?: "+l+")",u=" "+u,c++),n=new RegExp("^(?:"+l+")",s)),NPCG_INCLUDED&&(n=new RegExp("^"+l+"$(?!\\s)",s)),UPDATES_LAST_INDEX_WRONG&&(t=o.lastIndex),r=nativeExec.call(a?n:o,u),a?r?(r.input=r.input.slice(c),r[0]=r[0].slice(c),r.index=o.lastIndex,o.lastIndex+=r[0].length):o.lastIndex=0:UPDATES_LAST_INDEX_WRONG&&r&&(o.lastIndex=o.global?r.index+r[0].length:t),NPCG_INCLUDED&&r&&r.length>1&&nativeReplace.call(r[0],n,(function(){for(i=1;i<arguments.length-2;i++)void 0===arguments[i]&&(r[i]=void 0)})),r});var regexpExec=patchedExec;_export({target:"RegExp",proto:!0,forced:/./.exec!==regexpExec},{exec:regexpExec});var TO_STRING="toString",RegExpPrototype=RegExp.prototype,nativeToString=RegExpPrototype[TO_STRING],NOT_GENERIC=fails((function(){return"/a/b"!=nativeToString.call({source:"a",flags:"b"})})),INCORRECT_NAME=nativeToString.name!=TO_STRING;(NOT_GENERIC||INCORRECT_NAME)&&redefine(RegExp.prototype,TO_STRING,(function(){var e=anObject(this),t=String(e.source),n=e.flags;return"/"+t+"/"+String(void 0===n&&e instanceof RegExp&&!("flags"in RegExpPrototype)?regexpFlags.call(e):n)}),{unsafe:!0});var createMethod$2=function(e){return function(t,n){var r,i,o=String(requireObjectCoercible(t)),a=toInteger(n),s=o.length;return a<0||a>=s?e?"":void 0:(r=o.charCodeAt(a))<55296||r>56319||a+1===s||(i=o.charCodeAt(a+1))<56320||i>57343?e?o.charAt(a):r:e?o.slice(a,a+2):i-56320+(r-55296<<10)+65536}},stringMultibyte={codeAt:createMethod$2(!1),charAt:createMethod$2(!0)},charAt=stringMultibyte.charAt,STRING_ITERATOR="String Iterator",setInternalState$2=internalState.set,getInternalState$2=internalState.getterFor(STRING_ITERATOR);defineIterator(String,"String",(function(e){setInternalState$2(this,{type:STRING_ITERATOR,string:String(e),index:0})}),(function(){var e,t=getInternalState$2(this),n=t.string,r=t.index;return r>=n.length?{value:void 0,done:!0}:(e=charAt(n,r),t.index+=e.length,{value:e,done:!1})}));var SPECIES$3=wellKnownSymbol("species"),REPLACE_SUPPORTS_NAMED_GROUPS=!fails((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$<a>")})),REPLACE_KEEPS_$0="$0"==="a".replace(/./,"$0"),REPLACE=wellKnownSymbol("replace"),REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE=!!/./[REPLACE]&&""===/./[REPLACE]("a","$0"),SPLIT_WORKS_WITH_OVERWRITTEN_EXEC=!fails((function(){var e=/(?:)/,t=e.exec;e.exec=function(){return t.apply(this,arguments)};var n="ab".split(e);return 2!==n.length||"a"!==n[0]||"b"!==n[1]})),fixRegexpWellKnownSymbolLogic=function(e,t,n,r){var i=wellKnownSymbol(e),o=!fails((function(){var t={};return t[i]=function(){return 7},7!=""[e](t)})),a=o&&!fails((function(){var t=!1,n=/a/;return"split"===e&&((n={}).constructor={},n.constructor[SPECIES$3]=function(){return n},n.flags="",n[i]=/./[i]),n.exec=function(){return t=!0,null},n[i](""),!t}));if(!o||!a||"replace"===e&&(!REPLACE_SUPPORTS_NAMED_GROUPS||!REPLACE_KEEPS_$0||REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE)||"split"===e&&!SPLIT_WORKS_WITH_OVERWRITTEN_EXEC){var s=/./[i],l=n(i,""[e],(function(e,t,n,r,i){return t.exec===regexpExec?o&&!i?{done:!0,value:s.call(t,n,r)}:{done:!0,value:e.call(n,t,r)}:{done:!1}}),{REPLACE_KEEPS_$0:REPLACE_KEEPS_$0,REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE:REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE}),c=l[0],u=l[1];redefine(String.prototype,e,c),redefine(RegExp.prototype,i,2==t?function(e,t){return u.call(e,this,t)}:function(e){return u.call(e,this)})}r&&createNonEnumerableProperty(RegExp.prototype[i],"sham",!0)},charAt$1=stringMultibyte.charAt,advanceStringIndex=function(e,t,n){return t+(n?charAt$1(e,t).length:1)},regexpExecAbstract=function(e,t){var n=e.exec;if("function"==typeof n){var r=n.call(e,t);if("object"!=typeof r)throw TypeError("RegExp exec method returned something other than an Object or null");return r}if("RegExp"!==classofRaw(e))throw TypeError("RegExp#exec called on incompatible receiver");return regexpExec.call(e,t)},max$2=Math.max,min$2=Math.min,floor$1=Math.floor,SUBSTITUTION_SYMBOLS=/\$([$&'`]|\d\d?|<[^>]*>)/g,SUBSTITUTION_SYMBOLS_NO_NAMED=/\$([$&'`]|\d\d?)/g,maybeToString=function(e){return void 0===e?e:String(e)};fixRegexpWellKnownSymbolLogic("replace",2,(function(e,t,n,r){var i=r.REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE,o=r.REPLACE_KEEPS_$0,a=i?"$":"$0";return[function(n,r){var i=requireObjectCoercible(this),o=null==n?void 0:n[e];return void 0!==o?o.call(n,i,r):t.call(String(i),n,r)},function(e,r){if(!i&&o||"string"==typeof r&&-1===r.indexOf(a)){var l=n(t,e,this,r);if(l.done)return l.value}var c=anObject(e),u=String(this),d="function"==typeof r;d||(r=String(r));var h=c.global;if(h){var p=c.unicode;c.lastIndex=0}for(var f=[];;){var m=regexpExecAbstract(c,u);if(null===m)break;if(f.push(m),!h)break;""===String(m[0])&&(c.lastIndex=advanceStringIndex(u,toLength(c.lastIndex),p))}for(var g="",y=0,b=0;b<f.length;b++){m=f[b];for(var v=String(m[0]),E=max$2(min$2(toInteger(m.index),u.length),0),S=[],T=1;T<m.length;T++)S.push(maybeToString(m[T]));var P=m.groups;if(d){var w=[v].concat(S,E,u);void 0!==P&&w.push(P);var O=String(r.apply(void 0,w))}else O=s(v,u,E,S,P,r);E>=y&&(g+=u.slice(y,E)+O,y=E+v.length)}return g+u.slice(y)}];function s(e,n,r,i,o,a){var s=r+e.length,l=i.length,c=SUBSTITUTION_SYMBOLS_NO_NAMED;return void 0!==o&&(o=toObject(o),c=SUBSTITUTION_SYMBOLS),t.call(a,c,(function(t,a){var c;switch(a.charAt(0)){case"$":return"$";case"&":return e;case"`":return n.slice(0,r);case"'":return n.slice(s);case"<":c=o[a.slice(1,-1)];break;default:var u=+a;if(0===u)return t;if(u>l){var d=floor$1(u/10);return 0===d?t:d<=l?void 0===i[d-1]?a.charAt(1):i[d-1]+a.charAt(1):t}c=i[u-1]}return void 0===c?"":c}))}}));var sameValue=Object.is||function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t};fixRegexpWellKnownSymbolLogic("search",1,(function(e,t,n){return[function(t){var n=requireObjectCoercible(this),r=null==t?void 0:t[e];return void 0!==r?r.call(t,n):new RegExp(t)[e](String(n))},function(e){var r=n(t,e,this);if(r.done)return r.value;var i=anObject(e),o=String(this),a=i.lastIndex;sameValue(a,0)||(i.lastIndex=0);var s=regexpExecAbstract(i,o);return sameValue(i.lastIndex,a)||(i.lastIndex=a),null===s?-1:s.index}]}));var MATCH=wellKnownSymbol("match"),isRegexp=function(e){var t;return isObject(e)&&(void 0!==(t=e[MATCH])?!!t:"RegExp"==classofRaw(e))},SPECIES$4=wellKnownSymbol("species"),speciesConstructor=function(e,t){var n,r=anObject(e).constructor;return void 0===r||null==(n=anObject(r)[SPECIES$4])?t:aFunction$1(n)},arrayPush=[].push,min$3=Math.min,MAX_UINT32=4294967295,SUPPORTS_Y=!fails((function(){return!RegExp(MAX_UINT32,"y")}));fixRegexpWellKnownSymbolLogic("split",2,(function(e,t,n){var r;return r="c"=="abbc".split(/(b)*/)[1]||4!="test".split(/(?:)/,-1).length||2!="ab".split(/(?:ab)*/).length||4!=".".split(/(.?)(.?)/).length||".".split(/()()/).length>1||"".split(/.?/).length?function(e,n){var r=String(requireObjectCoercible(this)),i=void 0===n?MAX_UINT32:n>>>0;if(0===i)return[];if(void 0===e)return[r];if(!isRegexp(e))return t.call(r,e,i);for(var o,a,s,l=[],c=(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.unicode?"u":"")+(e.sticky?"y":""),u=0,d=new RegExp(e.source,c+"g");(o=regexpExec.call(d,r))&&!((a=d.lastIndex)>u&&(l.push(r.slice(u,o.index)),o.length>1&&o.index<r.length&&arrayPush.apply(l,o.slice(1)),s=o[0].length,u=a,l.length>=i));)d.lastIndex===o.index&&d.lastIndex++;return u===r.length?!s&&d.test("")||l.push(""):l.push(r.slice(u)),l.length>i?l.slice(0,i):l}:"0".split(void 0,0).length?function(e,n){return void 0===e&&0===n?[]:t.call(this,e,n)}:t,[function(t,n){var i=requireObjectCoercible(this),o=null==t?void 0:t[e];return void 0!==o?o.call(t,i,n):r.call(String(i),t,n)},function(e,i){var o=n(r,e,this,i,r!==t);if(o.done)return o.value;var a=anObject(e),s=String(this),l=speciesConstructor(a,RegExp),c=a.unicode,u=(a.ignoreCase?"i":"")+(a.multiline?"m":"")+(a.unicode?"u":"")+(SUPPORTS_Y?"y":"g"),d=new l(SUPPORTS_Y?a:"^(?:"+a.source+")",u),h=void 0===i?MAX_UINT32:i>>>0;if(0===h)return[];if(0===s.length)return null===regexpExecAbstract(d,s)?[s]:[];for(var p=0,f=0,m=[];f<s.length;){d.lastIndex=SUPPORTS_Y?f:0;var g,y=regexpExecAbstract(d,SUPPORTS_Y?s:s.slice(f));if(null===y||(g=min$3(toLength(d.lastIndex+(SUPPORTS_Y?0:f)),s.length))===p)f=advanceStringIndex(s,f,c);else{if(m.push(s.slice(p,f)),m.length===h)return m;for(var b=1;b<=y.length-1;b++)if(m.push(y[b]),m.length===h)return m;f=p=g}}return m.push(s.slice(p)),m}]}),!SUPPORTS_Y);var domIterables={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0};for(var COLLECTION_NAME in domIterables){var Collection=global_1[COLLECTION_NAME],CollectionPrototype=Collection&&Collection.prototype;if(CollectionPrototype&&CollectionPrototype.forEach!==arrayForEach)try{createNonEnumerableProperty(CollectionPrototype,"forEach",arrayForEach)}catch(e){CollectionPrototype.forEach=arrayForEach}}var ITERATOR$2=wellKnownSymbol("iterator"),TO_STRING_TAG$3=wellKnownSymbol("toStringTag"),ArrayValues=es_array_iterator.values;for(var COLLECTION_NAME$1 in domIterables){var Collection$1=global_1[COLLECTION_NAME$1],CollectionPrototype$1=Collection$1&&Collection$1.prototype;if(CollectionPrototype$1){if(CollectionPrototype$1[ITERATOR$2]!==ArrayValues)try{createNonEnumerableProperty(CollectionPrototype$1,ITERATOR$2,ArrayValues)}catch(e){CollectionPrototype$1[ITERATOR$2]=ArrayValues}if(CollectionPrototype$1[TO_STRING_TAG$3]||createNonEnumerableProperty(CollectionPrototype$1,TO_STRING_TAG$3,COLLECTION_NAME$1),domIterables[COLLECTION_NAME$1])for(var METHOD_NAME in es_array_iterator)if(CollectionPrototype$1[METHOD_NAME]!==es_array_iterator[METHOD_NAME])try{createNonEnumerableProperty(CollectionPrototype$1,METHOD_NAME,es_array_iterator[METHOD_NAME])}catch(e){CollectionPrototype$1[METHOD_NAME]=es_array_iterator[METHOD_NAME]}}}var ITERATOR$3=wellKnownSymbol("iterator"),nativeUrl=!fails((function(){var e=new URL("b?a=1&b=2&c=3","http://a"),t=e.searchParams,n="";return e.pathname="c%20d",t.forEach((function(e,r){t.delete("b"),n+=r+e})),isPure&&!e.toJSON||!t.sort||"http://a/c%20d?a=1&c=3"!==e.href||"3"!==t.get("c")||"a=1"!==String(new URLSearchParams("?a=1"))||!t[ITERATOR$3]||"a"!==new URL("https://a@b").username||"b"!==new URLSearchParams(new URLSearchParams("a=b")).get("a")||"xn--e1aybc"!==new URL("http://тест").host||"#%D0%B1"!==new URL("http://a#б").hash||"a1c3"!==n||"x"!==new URL("http://x",void 0).host})),anInstance=function(e,t,n){if(!(e instanceof t))throw TypeError("Incorrect "+(n?n+" ":"")+"invocation");return e},nativeAssign=Object.assign,defineProperty$4=Object.defineProperty,objectAssign=!nativeAssign||fails((function(){if(descriptors&&1!==nativeAssign({b:1},nativeAssign(defineProperty$4({},"a",{enumerable:!0,get:function(){defineProperty$4(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var e={},t={},n=Symbol();return e[n]=7,"abcdefghijklmnopqrst".split("").forEach((function(e){t[e]=e})),7!=nativeAssign({},e)[n]||"abcdefghijklmnopqrst"!=objectKeys(nativeAssign({},t)).join("")}))?function(e,t){for(var n=toObject(e),r=arguments.length,i=1,o=objectGetOwnPropertySymbols.f,a=objectPropertyIsEnumerable.f;r>i;)for(var s,l=indexedObject(arguments[i++]),c=o?objectKeys(l).concat(o(l)):objectKeys(l),u=c.length,d=0;u>d;)s=c[d++],descriptors&&!a.call(l,s)||(n[s]=l[s]);return n}:nativeAssign,callWithSafeIterationClosing=function(e,t,n,r){try{return r?t(anObject(n)[0],n[1]):t(n)}catch(t){var i=e.return;throw void 0!==i&&anObject(i.call(e)),t}},ITERATOR$4=wellKnownSymbol("iterator"),ArrayPrototype$1=Array.prototype,isArrayIteratorMethod=function(e){return void 0!==e&&(iterators.Array===e||ArrayPrototype$1[ITERATOR$4]===e)},ITERATOR$5=wellKnownSymbol("iterator"),getIteratorMethod=function(e){if(null!=e)return e[ITERATOR$5]||e["@@iterator"]||iterators[classof(e)]},arrayFrom=function(e){var t,n,r,i,o,a,s=toObject(e),l="function"==typeof this?this:Array,c=arguments.length,u=c>1?arguments[1]:void 0,d=void 0!==u,h=getIteratorMethod(s),p=0;if(d&&(u=functionBindContext(u,c>2?arguments[2]:void 0,2)),null==h||l==Array&&isArrayIteratorMethod(h))for(n=new l(t=toLength(s.length));t>p;p++)a=d?u(s[p],p):s[p],createProperty(n,p,a);else for(o=(i=h.call(s)).next,n=new l;!(r=o.call(i)).done;p++)a=d?callWithSafeIterationClosing(i,u,[r.value,p],!0):r.value,createProperty(n,p,a);return n.length=p,n},maxInt=2147483647,base=36,tMin=1,tMax=26,skew=38,damp=700,initialBias=72,initialN=128,delimiter="-",regexNonASCII=/[^\0-\u007E]/,regexSeparators=/[.\u3002\uFF0E\uFF61]/g,OVERFLOW_ERROR="Overflow: input needs wider integers to process",baseMinusTMin=base-tMin,floor$2=Math.floor,stringFromCharCode=String.fromCharCode,ucs2decode=function(e){for(var t=[],n=0,r=e.length;n<r;){var i=e.charCodeAt(n++);if(i>=55296&&i<=56319&&n<r){var o=e.charCodeAt(n++);56320==(64512&o)?t.push(((1023&i)<<10)+(1023&o)+65536):(t.push(i),n--)}else t.push(i)}return t},digitToBasic=function(e){return e+22+75*(e<26)},adapt=function(e,t,n){var r=0;for(e=n?floor$2(e/damp):e>>1,e+=floor$2(e/t);e>baseMinusTMin*tMax>>1;r+=base)e=floor$2(e/baseMinusTMin);return floor$2(r+(baseMinusTMin+1)*e/(e+skew))},encode=function(e){var t,n,r=[],i=(e=ucs2decode(e)).length,o=initialN,a=0,s=initialBias;for(t=0;t<e.length;t++)(n=e[t])<128&&r.push(stringFromCharCode(n));var l=r.length,c=l;for(l&&r.push(delimiter);c<i;){var u=maxInt;for(t=0;t<e.length;t++)(n=e[t])>=o&&n<u&&(u=n);var d=c+1;if(u-o>floor$2((maxInt-a)/d))throw RangeError(OVERFLOW_ERROR);for(a+=(u-o)*d,o=u,t=0;t<e.length;t++){if((n=e[t])<o&&++a>maxInt)throw RangeError(OVERFLOW_ERROR);if(n==o){for(var h=a,p=base;;p+=base){var f=p<=s?tMin:p>=s+tMax?tMax:p-s;if(h<f)break;var m=h-f,g=base-f;r.push(stringFromCharCode(digitToBasic(f+m%g))),h=floor$2(m/g)}r.push(stringFromCharCode(digitToBasic(h))),s=adapt(a,d,c==l),a=0,++c}}++a,++o}return r.join("")},stringPunycodeToAscii=function(e){var t,n,r=[],i=e.toLowerCase().replace(regexSeparators,".").split(".");for(t=0;t<i.length;t++)n=i[t],r.push(regexNonASCII.test(n)?"xn--"+encode(n):n);return r.join(".")},redefineAll=function(e,t,n){for(var r in t)redefine(e,r,t[r],n);return e},getIterator=function(e){var t=getIteratorMethod(e);if("function"!=typeof t)throw TypeError(String(e)+" is not iterable");return anObject(t.call(e))},$fetch=getBuiltIn("fetch"),Headers=getBuiltIn("Headers"),ITERATOR$6=wellKnownSymbol("iterator"),URL_SEARCH_PARAMS="URLSearchParams",URL_SEARCH_PARAMS_ITERATOR=URL_SEARCH_PARAMS+"Iterator",setInternalState$3=internalState.set,getInternalParamsState=internalState.getterFor(URL_SEARCH_PARAMS),getInternalIteratorState=internalState.getterFor(URL_SEARCH_PARAMS_ITERATOR),plus=/\+/g,sequences=Array(4),percentSequence=function(e){return sequences[e-1]||(sequences[e-1]=RegExp("((?:%[\\da-f]{2}){"+e+"})","gi"))},percentDecode=function(e){try{return decodeURIComponent(e)}catch(t){return e}},deserialize=function(e){var t=e.replace(plus," "),n=4;try{return decodeURIComponent(t)}catch(e){for(;n;)t=t.replace(percentSequence(n--),percentDecode);return t}},find=/[!'()~]|%20/g,replace={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},replacer=function(e){return replace[e]},serialize=function(e){return encodeURIComponent(e).replace(find,replacer)},parseSearchParams=function(e,t){if(t)for(var n,r,i=t.split("&"),o=0;o<i.length;)(n=i[o++]).length&&(r=n.split("="),e.push({key:deserialize(r.shift()),value:deserialize(r.join("="))}))},updateSearchParams=function(e){this.entries.length=0,parseSearchParams(this.entries,e)},validateArgumentsLength=function(e,t){if(e<t)throw TypeError("Not enough arguments")},URLSearchParamsIterator=createIteratorConstructor((function(e,t){setInternalState$3(this,{type:URL_SEARCH_PARAMS_ITERATOR,iterator:getIterator(getInternalParamsState(e).entries),kind:t})}),"Iterator",(function(){var e=getInternalIteratorState(this),t=e.kind,n=e.iterator.next(),r=n.value;return n.done||(n.value="keys"===t?r.key:"values"===t?r.value:[r.key,r.value]),n})),URLSearchParamsConstructor=function(){anInstance(this,URLSearchParamsConstructor,URL_SEARCH_PARAMS);var e,t,n,r,i,o,a,s,l,c=arguments.length>0?arguments[0]:void 0,u=this,d=[];if(setInternalState$3(u,{type:URL_SEARCH_PARAMS,entries:d,updateURL:function(){},updateSearchParams:updateSearchParams}),void 0!==c)if(isObject(c))if("function"==typeof(e=getIteratorMethod(c)))for(n=(t=e.call(c)).next;!(r=n.call(t)).done;){if((a=(o=(i=getIterator(anObject(r.value))).next).call(i)).done||(s=o.call(i)).done||!o.call(i).done)throw TypeError("Expected sequence with length 2");d.push({key:a.value+"",value:s.value+""})}else for(l in c)has(c,l)&&d.push({key:l,value:c[l]+""});else parseSearchParams(d,"string"==typeof c?"?"===c.charAt(0)?c.slice(1):c:c+"")},URLSearchParamsPrototype=URLSearchParamsConstructor.prototype;redefineAll(URLSearchParamsPrototype,{append:function(e,t){validateArgumentsLength(arguments.length,2);var n=getInternalParamsState(this);n.entries.push({key:e+"",value:t+""}),n.updateURL()},delete:function(e){validateArgumentsLength(arguments.length,1);for(var t=getInternalParamsState(this),n=t.entries,r=e+"",i=0;i<n.length;)n[i].key===r?n.splice(i,1):i++;t.updateURL()},get:function(e){validateArgumentsLength(arguments.length,1);for(var t=getInternalParamsState(this).entries,n=e+"",r=0;r<t.length;r++)if(t[r].key===n)return t[r].value;return null},getAll:function(e){validateArgumentsLength(arguments.length,1);for(var t=getInternalParamsState(this).entries,n=e+"",r=[],i=0;i<t.length;i++)t[i].key===n&&r.push(t[i].value);return r},has:function(e){validateArgumentsLength(arguments.length,1);for(var t=getInternalParamsState(this).entries,n=e+"",r=0;r<t.length;)if(t[r++].key===n)return!0;return!1},set:function(e,t){validateArgumentsLength(arguments.length,1);for(var n,r=getInternalParamsState(this),i=r.entries,o=!1,a=e+"",s=t+"",l=0;l<i.length;l++)(n=i[l]).key===a&&(o?i.splice(l--,1):(o=!0,n.value=s));o||i.push({key:a,value:s}),r.updateURL()},sort:function(){var e,t,n,r=getInternalParamsState(this),i=r.entries,o=i.slice();for(i.length=0,n=0;n<o.length;n++){for(e=o[n],t=0;t<n;t++)if(i[t].key>e.key){i.splice(t,0,e);break}t===n&&i.push(e)}r.updateURL()},forEach:function(e){for(var t,n=getInternalParamsState(this).entries,r=functionBindContext(e,arguments.length>1?arguments[1]:void 0,3),i=0;i<n.length;)r((t=n[i++]).value,t.key,this)},keys:function(){return new URLSearchParamsIterator(this,"keys")},values:function(){return new URLSearchParamsIterator(this,"values")},entries:function(){return new URLSearchParamsIterator(this,"entries")}},{enumerable:!0}),redefine(URLSearchParamsPrototype,ITERATOR$6,URLSearchParamsPrototype.entries),redefine(URLSearchParamsPrototype,"toString",(function(){for(var e,t=getInternalParamsState(this).entries,n=[],r=0;r<t.length;)e=t[r++],n.push(serialize(e.key)+"="+serialize(e.value));return n.join("&")}),{enumerable:!0}),setToStringTag(URLSearchParamsConstructor,URL_SEARCH_PARAMS),_export({global:!0,forced:!nativeUrl},{URLSearchParams:URLSearchParamsConstructor}),nativeUrl||"function"!=typeof $fetch||"function"!=typeof Headers||_export({global:!0,enumerable:!0,forced:!0},{fetch:function(e){var t,n,r,i=[e];return arguments.length>1&&(isObject(t=arguments[1])&&(n=t.body,classof(n)===URL_SEARCH_PARAMS&&((r=t.headers?new Headers(t.headers):new Headers).has("content-type")||r.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"),t=objectCreate(t,{body:createPropertyDescriptor(0,String(n)),headers:createPropertyDescriptor(0,r)}))),i.push(t)),$fetch.apply(this,i)}});var EOF,web_urlSearchParams={URLSearchParams:URLSearchParamsConstructor,getState:getInternalParamsState},codeAt=stringMultibyte.codeAt,NativeURL=global_1.URL,URLSearchParams$1=web_urlSearchParams.URLSearchParams,getInternalSearchParamsState=web_urlSearchParams.getState,setInternalState$4=internalState.set,getInternalURLState=internalState.getterFor("URL"),floor$3=Math.floor,pow=Math.pow,INVALID_AUTHORITY="Invalid authority",INVALID_SCHEME="Invalid scheme",INVALID_HOST="Invalid host",INVALID_PORT="Invalid port",ALPHA=/[A-Za-z]/,ALPHANUMERIC=/[\d+-.A-Za-z]/,DIGIT=/\d/,HEX_START=/^(0x|0X)/,OCT=/^[0-7]+$/,DEC=/^\d+$/,HEX=/^[\dA-Fa-f]+$/,FORBIDDEN_HOST_CODE_POINT=/[\u0000\u0009\u000A\u000D #%/:?@[\\]]/,FORBIDDEN_HOST_CODE_POINT_EXCLUDING_PERCENT=/[\u0000\u0009\u000A\u000D #/:?@[\\]]/,LEADING_AND_TRAILING_C0_CONTROL_OR_SPACE=/^[\u0000-\u001F ]+|[\u0000-\u001F ]+$/g,TAB_AND_NEW_LINE=/[\u0009\u000A\u000D]/g,parseHost=function(e,t){var n,r,i;if("["==t.charAt(0)){if("]"!=t.charAt(t.length-1))return INVALID_HOST;if(!(n=parseIPv6(t.slice(1,-1))))return INVALID_HOST;e.host=n}else if(isSpecial(e)){if(t=stringPunycodeToAscii(t),FORBIDDEN_HOST_CODE_POINT.test(t))return INVALID_HOST;if(null===(n=parseIPv4(t)))return INVALID_HOST;e.host=n}else{if(FORBIDDEN_HOST_CODE_POINT_EXCLUDING_PERCENT.test(t))return INVALID_HOST;for(n="",r=arrayFrom(t),i=0;i<r.length;i++)n+=percentEncode(r[i],C0ControlPercentEncodeSet);e.host=n}},parseIPv4=function(e){var t,n,r,i,o,a,s,l=e.split(".");if(l.length&&""==l[l.length-1]&&l.pop(),(t=l.length)>4)return e;for(n=[],r=0;r<t;r++){if(""==(i=l[r]))return e;if(o=10,i.length>1&&"0"==i.charAt(0)&&(o=HEX_START.test(i)?16:8,i=i.slice(8==o?1:2)),""===i)a=0;else{if(!(10==o?DEC:8==o?OCT:HEX).test(i))return e;a=parseInt(i,o)}n.push(a)}for(r=0;r<t;r++)if(a=n[r],r==t-1){if(a>=pow(256,5-t))return null}else if(a>255)return null;for(s=n.pop(),r=0;r<n.length;r++)s+=n[r]*pow(256,3-r);return s},parseIPv6=function(e){var t,n,r,i,o,a,s,l=[0,0,0,0,0,0,0,0],c=0,u=null,d=0,h=function(){return e.charAt(d)};if(":"==h()){if(":"!=e.charAt(1))return;d+=2,u=++c}for(;h();){if(8==c)return;if(":"!=h()){for(t=n=0;n<4&&HEX.test(h());)t=16*t+parseInt(h(),16),d++,n++;if("."==h()){if(0==n)return;if(d-=n,c>6)return;for(r=0;h();){if(i=null,r>0){if(!("."==h()&&r<4))return;d++}if(!DIGIT.test(h()))return;for(;DIGIT.test(h());){if(o=parseInt(h(),10),null===i)i=o;else{if(0==i)return;i=10*i+o}if(i>255)return;d++}l[c]=256*l[c]+i,2!=++r&&4!=r||c++}if(4!=r)return;break}if(":"==h()){if(d++,!h())return}else if(h())return;l[c++]=t}else{if(null!==u)return;d++,u=++c}}if(null!==u)for(a=c-u,c=7;0!=c&&a>0;)s=l[c],l[c--]=l[u+a-1],l[u+--a]=s;else if(8!=c)return;return l},findLongestZeroSequence=function(e){for(var t=null,n=1,r=null,i=0,o=0;o<8;o++)0!==e[o]?(i>n&&(t=r,n=i),r=null,i=0):(null===r&&(r=o),++i);return i>n&&(t=r,n=i),t},serializeHost=function(e){var t,n,r,i;if("number"==typeof e){for(t=[],n=0;n<4;n++)t.unshift(e%256),e=floor$3(e/256);return t.join(".")}if("object"==typeof e){for(t="",r=findLongestZeroSequence(e),n=0;n<8;n++)i&&0===e[n]||(i&&(i=!1),r===n?(t+=n?":":"::",i=!0):(t+=e[n].toString(16),n<7&&(t+=":")));return"["+t+"]"}return e},C0ControlPercentEncodeSet={},fragmentPercentEncodeSet=objectAssign({},C0ControlPercentEncodeSet,{" ":1,'"':1,"<":1,">":1,"`":1}),pathPercentEncodeSet=objectAssign({},fragmentPercentEncodeSet,{"#":1,"?":1,"{":1,"}":1}),userinfoPercentEncodeSet=objectAssign({},pathPercentEncodeSet,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),percentEncode=function(e,t){var n=codeAt(e,0);return n>32&&n<127&&!has(t,e)?e:encodeURIComponent(e)},specialSchemes={ftp:21,file:null,http:80,https:443,ws:80,wss:443},isSpecial=function(e){return has(specialSchemes,e.scheme)},includesCredentials=function(e){return""!=e.username||""!=e.password},cannotHaveUsernamePasswordPort=function(e){return!e.host||e.cannotBeABaseURL||"file"==e.scheme},isWindowsDriveLetter=function(e,t){var n;return 2==e.length&&ALPHA.test(e.charAt(0))&&(":"==(n=e.charAt(1))||!t&&"|"==n)},startsWithWindowsDriveLetter=function(e){var t;return e.length>1&&isWindowsDriveLetter(e.slice(0,2))&&(2==e.length||"/"===(t=e.charAt(2))||"\\"===t||"?"===t||"#"===t)},shortenURLsPath=function(e){var t=e.path,n=t.length;!n||"file"==e.scheme&&1==n&&isWindowsDriveLetter(t[0],!0)||t.pop()},isSingleDot=function(e){return"."===e||"%2e"===e.toLowerCase()},isDoubleDot=function(e){return".."===(e=e.toLowerCase())||"%2e."===e||".%2e"===e||"%2e%2e"===e},SCHEME_START={},SCHEME={},NO_SCHEME={},SPECIAL_RELATIVE_OR_AUTHORITY={},PATH_OR_AUTHORITY={},RELATIVE={},RELATIVE_SLASH={},SPECIAL_AUTHORITY_SLASHES={},SPECIAL_AUTHORITY_IGNORE_SLASHES={},AUTHORITY={},HOST={},HOSTNAME={},PORT={},FILE={},FILE_SLASH={},FILE_HOST={},PATH_START={},PATH={},CANNOT_BE_A_BASE_URL_PATH={},QUERY={},FRAGMENT={},parseURL=function(e,t,n,r){var i,o,a,s,l=n||SCHEME_START,c=0,u="",d=!1,h=!1,p=!1;for(n||(e.scheme="",e.username="",e.password="",e.host=null,e.port=null,e.path=[],e.query=null,e.fragment=null,e.cannotBeABaseURL=!1,t=t.replace(LEADING_AND_TRAILING_C0_CONTROL_OR_SPACE,"")),t=t.replace(TAB_AND_NEW_LINE,""),i=arrayFrom(t);c<=i.length;){switch(o=i[c],l){case SCHEME_START:if(!o||!ALPHA.test(o)){if(n)return INVALID_SCHEME;l=NO_SCHEME;continue}u+=o.toLowerCase(),l=SCHEME;break;case SCHEME:if(o&&(ALPHANUMERIC.test(o)||"+"==o||"-"==o||"."==o))u+=o.toLowerCase();else{if(":"!=o){if(n)return INVALID_SCHEME;u="",l=NO_SCHEME,c=0;continue}if(n&&(isSpecial(e)!=has(specialSchemes,u)||"file"==u&&(includesCredentials(e)||null!==e.port)||"file"==e.scheme&&!e.host))return;if(e.scheme=u,n)return void(isSpecial(e)&&specialSchemes[e.scheme]==e.port&&(e.port=null));u="","file"==e.scheme?l=FILE:isSpecial(e)&&r&&r.scheme==e.scheme?l=SPECIAL_RELATIVE_OR_AUTHORITY:isSpecial(e)?l=SPECIAL_AUTHORITY_SLASHES:"/"==i[c+1]?(l=PATH_OR_AUTHORITY,c++):(e.cannotBeABaseURL=!0,e.path.push(""),l=CANNOT_BE_A_BASE_URL_PATH)}break;case NO_SCHEME:if(!r||r.cannotBeABaseURL&&"#"!=o)return INVALID_SCHEME;if(r.cannotBeABaseURL&&"#"==o){e.scheme=r.scheme,e.path=r.path.slice(),e.query=r.query,e.fragment="",e.cannotBeABaseURL=!0,l=FRAGMENT;break}l="file"==r.scheme?FILE:RELATIVE;continue;case SPECIAL_RELATIVE_OR_AUTHORITY:if("/"!=o||"/"!=i[c+1]){l=RELATIVE;continue}l=SPECIAL_AUTHORITY_IGNORE_SLASHES,c++;break;case PATH_OR_AUTHORITY:if("/"==o){l=AUTHORITY;break}l=PATH;continue;case RELATIVE:if(e.scheme=r.scheme,o==EOF)e.username=r.username,e.password=r.password,e.host=r.host,e.port=r.port,e.path=r.path.slice(),e.query=r.query;else if("/"==o||"\\"==o&&isSpecial(e))l=RELATIVE_SLASH;else if("?"==o)e.username=r.username,e.password=r.password,e.host=r.host,e.port=r.port,e.path=r.path.slice(),e.query="",l=QUERY;else{if("#"!=o){e.username=r.username,e.password=r.password,e.host=r.host,e.port=r.port,e.path=r.path.slice(),e.path.pop(),l=PATH;continue}e.username=r.username,e.password=r.password,e.host=r.host,e.port=r.port,e.path=r.path.slice(),e.query=r.query,e.fragment="",l=FRAGMENT}break;case RELATIVE_SLASH:if(!isSpecial(e)||"/"!=o&&"\\"!=o){if("/"!=o){e.username=r.username,e.password=r.password,e.host=r.host,e.port=r.port,l=PATH;continue}l=AUTHORITY}else l=SPECIAL_AUTHORITY_IGNORE_SLASHES;break;case SPECIAL_AUTHORITY_SLASHES:if(l=SPECIAL_AUTHORITY_IGNORE_SLASHES,"/"!=o||"/"!=u.charAt(c+1))continue;c++;break;case SPECIAL_AUTHORITY_IGNORE_SLASHES:if("/"!=o&&"\\"!=o){l=AUTHORITY;continue}break;case AUTHORITY:if("@"==o){d&&(u="%40"+u),d=!0,a=arrayFrom(u);for(var f=0;f<a.length;f++){var m=a[f];if(":"!=m||p){var g=percentEncode(m,userinfoPercentEncodeSet);p?e.password+=g:e.username+=g}else p=!0}u=""}else if(o==EOF||"/"==o||"?"==o||"#"==o||"\\"==o&&isSpecial(e)){if(d&&""==u)return INVALID_AUTHORITY;c-=arrayFrom(u).length+1,u="",l=HOST}else u+=o;break;case HOST:case HOSTNAME:if(n&&"file"==e.scheme){l=FILE_HOST;continue}if(":"!=o||h){if(o==EOF||"/"==o||"?"==o||"#"==o||"\\"==o&&isSpecial(e)){if(isSpecial(e)&&""==u)return INVALID_HOST;if(n&&""==u&&(includesCredentials(e)||null!==e.port))return;if(s=parseHost(e,u))return s;if(u="",l=PATH_START,n)return;continue}"["==o?h=!0:"]"==o&&(h=!1),u+=o}else{if(""==u)return INVALID_HOST;if(s=parseHost(e,u))return s;if(u="",l=PORT,n==HOSTNAME)return}break;case PORT:if(!DIGIT.test(o)){if(o==EOF||"/"==o||"?"==o||"#"==o||"\\"==o&&isSpecial(e)||n){if(""!=u){var y=parseInt(u,10);if(y>65535)return INVALID_PORT;e.port=isSpecial(e)&&y===specialSchemes[e.scheme]?null:y,u=""}if(n)return;l=PATH_START;continue}return INVALID_PORT}u+=o;break;case FILE:if(e.scheme="file","/"==o||"\\"==o)l=FILE_SLASH;else{if(!r||"file"!=r.scheme){l=PATH;continue}if(o==EOF)e.host=r.host,e.path=r.path.slice(),e.query=r.query;else if("?"==o)e.host=r.host,e.path=r.path.slice(),e.query="",l=QUERY;else{if("#"!=o){startsWithWindowsDriveLetter(i.slice(c).join(""))||(e.host=r.host,e.path=r.path.slice(),shortenURLsPath(e)),l=PATH;continue}e.host=r.host,e.path=r.path.slice(),e.query=r.query,e.fragment="",l=FRAGMENT}}break;case FILE_SLASH:if("/"==o||"\\"==o){l=FILE_HOST;break}r&&"file"==r.scheme&&!startsWithWindowsDriveLetter(i.slice(c).join(""))&&(isWindowsDriveLetter(r.path[0],!0)?e.path.push(r.path[0]):e.host=r.host),l=PATH;continue;case FILE_HOST:if(o==EOF||"/"==o||"\\"==o||"?"==o||"#"==o){if(!n&&isWindowsDriveLetter(u))l=PATH;else if(""==u){if(e.host="",n)return;l=PATH_START}else{if(s=parseHost(e,u))return s;if("localhost"==e.host&&(e.host=""),n)return;u="",l=PATH_START}continue}u+=o;break;case PATH_START:if(isSpecial(e)){if(l=PATH,"/"!=o&&"\\"!=o)continue}else if(n||"?"!=o)if(n||"#"!=o){if(o!=EOF&&(l=PATH,"/"!=o))continue}else e.fragment="",l=FRAGMENT;else e.query="",l=QUERY;break;case PATH:if(o==EOF||"/"==o||"\\"==o&&isSpecial(e)||!n&&("?"==o||"#"==o)){if(isDoubleDot(u)?(shortenURLsPath(e),"/"==o||"\\"==o&&isSpecial(e)||e.path.push("")):isSingleDot(u)?"/"==o||"\\"==o&&isSpecial(e)||e.path.push(""):("file"==e.scheme&&!e.path.length&&isWindowsDriveLetter(u)&&(e.host&&(e.host=""),u=u.charAt(0)+":"),e.path.push(u)),u="","file"==e.scheme&&(o==EOF||"?"==o||"#"==o))for(;e.path.length>1&&""===e.path[0];)e.path.shift();"?"==o?(e.query="",l=QUERY):"#"==o&&(e.fragment="",l=FRAGMENT)}else u+=percentEncode(o,pathPercentEncodeSet);break;case CANNOT_BE_A_BASE_URL_PATH:"?"==o?(e.query="",l=QUERY):"#"==o?(e.fragment="",l=FRAGMENT):o!=EOF&&(e.path[0]+=percentEncode(o,C0ControlPercentEncodeSet));break;case QUERY:n||"#"!=o?o!=EOF&&("'"==o&&isSpecial(e)?e.query+="%27":e.query+="#"==o?"%23":percentEncode(o,C0ControlPercentEncodeSet)):(e.fragment="",l=FRAGMENT);break;case FRAGMENT:o!=EOF&&(e.fragment+=percentEncode(o,fragmentPercentEncodeSet))}c++}},URLConstructor=function(e){var t,n,r=anInstance(this,URLConstructor,"URL"),i=arguments.length>1?arguments[1]:void 0,o=String(e),a=setInternalState$4(r,{type:"URL"});if(void 0!==i)if(i instanceof URLConstructor)t=getInternalURLState(i);else if(n=parseURL(t={},String(i)))throw TypeError(n);if(n=parseURL(a,o,null,t))throw TypeError(n);var s=a.searchParams=new URLSearchParams$1,l=getInternalSearchParamsState(s);l.updateSearchParams(a.query),l.updateURL=function(){a.query=String(s)||null},descriptors||(r.href=serializeURL.call(r),r.origin=getOrigin.call(r),r.protocol=getProtocol.call(r),r.username=getUsername.call(r),r.password=getPassword.call(r),r.host=getHost.call(r),r.hostname=getHostname.call(r),r.port=getPort.call(r),r.pathname=getPathname.call(r),r.search=getSearch.call(r),r.searchParams=getSearchParams.call(r),r.hash=getHash.call(r))},URLPrototype=URLConstructor.prototype,serializeURL=function(){var e=getInternalURLState(this),t=e.scheme,n=e.username,r=e.password,i=e.host,o=e.port,a=e.path,s=e.query,l=e.fragment,c=t+":";return null!==i?(c+="//",includesCredentials(e)&&(c+=n+(r?":"+r:"")+"@"),c+=serializeHost(i),null!==o&&(c+=":"+o)):"file"==t&&(c+="//"),c+=e.cannotBeABaseURL?a[0]:a.length?"/"+a.join("/"):"",null!==s&&(c+="?"+s),null!==l&&(c+="#"+l),c},getOrigin=function(){var e=getInternalURLState(this),t=e.scheme,n=e.port;if("blob"==t)try{return new URL(t.path[0]).origin}catch(e){return"null"}return"file"!=t&&isSpecial(e)?t+"://"+serializeHost(e.host)+(null!==n?":"+n:""):"null"},getProtocol=function(){return getInternalURLState(this).scheme+":"},getUsername=function(){return getInternalURLState(this).username},getPassword=function(){return getInternalURLState(this).password},getHost=function(){var e=getInternalURLState(this),t=e.host,n=e.port;return null===t?"":null===n?serializeHost(t):serializeHost(t)+":"+n},getHostname=function(){var e=getInternalURLState(this).host;return null===e?"":serializeHost(e)},getPort=function(){var e=getInternalURLState(this).port;return null===e?"":String(e)},getPathname=function(){var e=getInternalURLState(this),t=e.path;return e.cannotBeABaseURL?t[0]:t.length?"/"+t.join("/"):""},getSearch=function(){var e=getInternalURLState(this).query;return e?"?"+e:""},getSearchParams=function(){return getInternalURLState(this).searchParams},getHash=function(){var e=getInternalURLState(this).fragment;return e?"#"+e:""},accessorDescriptor=function(e,t){return{get:e,set:t,configurable:!0,enumerable:!0}};if(descriptors&&objectDefineProperties(URLPrototype,{href:accessorDescriptor(serializeURL,(function(e){var t=getInternalURLState(this),n=String(e),r=parseURL(t,n);if(r)throw TypeError(r);getInternalSearchParamsState(t.searchParams).updateSearchParams(t.query)})),origin:accessorDescriptor(getOrigin),protocol:accessorDescriptor(getProtocol,(function(e){var t=getInternalURLState(this);parseURL(t,String(e)+":",SCHEME_START)})),username:accessorDescriptor(getUsername,(function(e){var t=getInternalURLState(this),n=arrayFrom(String(e));if(!cannotHaveUsernamePasswordPort(t)){t.username="";for(var r=0;r<n.length;r++)t.username+=percentEncode(n[r],userinfoPercentEncodeSet)}})),password:accessorDescriptor(getPassword,(function(e){var t=getInternalURLState(this),n=arrayFrom(String(e));if(!cannotHaveUsernamePasswordPort(t)){t.password="";for(var r=0;r<n.length;r++)t.password+=percentEncode(n[r],userinfoPercentEncodeSet)}})),host:accessorDescriptor(getHost,(function(e){var t=getInternalURLState(this);t.cannotBeABaseURL||parseURL(t,String(e),HOST)})),hostname:accessorDescriptor(getHostname,(function(e){var t=getInternalURLState(this);t.cannotBeABaseURL||parseURL(t,String(e),HOSTNAME)})),port:accessorDescriptor(getPort,(function(e){var t=getInternalURLState(this);cannotHaveUsernamePasswordPort(t)||(""==(e=String(e))?t.port=null:parseURL(t,e,PORT))})),pathname:accessorDescriptor(getPathname,(function(e){var t=getInternalURLState(this);t.cannotBeABaseURL||(t.path=[],parseURL(t,e+"",PATH_START))})),search:accessorDescriptor(getSearch,(function(e){var t=getInternalURLState(this);""==(e=String(e))?t.query=null:("?"==e.charAt(0)&&(e=e.slice(1)),t.query="",parseURL(t,e,QUERY)),getInternalSearchParamsState(t.searchParams).updateSearchParams(t.query)})),searchParams:accessorDescriptor(getSearchParams),hash:accessorDescriptor(getHash,(function(e){var t=getInternalURLState(this);""!=(e=String(e))?("#"==e.charAt(0)&&(e=e.slice(1)),t.fragment="",parseURL(t,e,FRAGMENT)):t.fragment=null}))}),redefine(URLPrototype,"toJSON",(function(){return serializeURL.call(this)}),{enumerable:!0}),redefine(URLPrototype,"toString",(function(){return serializeURL.call(this)}),{enumerable:!0}),NativeURL){var nativeCreateObjectURL=NativeURL.createObjectURL,nativeRevokeObjectURL=NativeURL.revokeObjectURL;nativeCreateObjectURL&&redefine(URLConstructor,"createObjectURL",(function(e){return nativeCreateObjectURL.apply(NativeURL,arguments)})),nativeRevokeObjectURL&&redefine(URLConstructor,"revokeObjectURL",(function(e){return nativeRevokeObjectURL.apply(NativeURL,arguments)}))}function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function _createClass(e,t,n){return t&&_defineProperties(e.prototype,t),n&&_defineProperties(e,n),e}function _defineProperty(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ownKeys$1(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function _objectSpread2(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ownKeys$1(Object(n),!0).forEach((function(t){_defineProperty(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ownKeys$1(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function _objectWithoutPropertiesLoose(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}function _objectWithoutProperties(e,t){if(null==e)return{};var n,r,i=_objectWithoutPropertiesLoose(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function _slicedToArray(e,t){return _arrayWithHoles(e)||_iterableToArrayLimit(e,t)||_unsupportedIterableToArray(e,t)||_nonIterableRest()}function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _arrayWithHoles(e){if(Array.isArray(e))return e}function _iterableToArray(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}function _iterableToArrayLimit(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],r=!0,i=!1,o=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){i=!0,o=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw o}}return n}}function _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}setToStringTag(URLConstructor,"URL"),_export({global:!0,forced:!nativeUrl,sham:!descriptors},{URL:URLConstructor}),function(e){var t=function(){try{return!!Symbol.iterator}catch(e){return!1}}(),n=function(e){var n={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return t&&(n[Symbol.iterator]=function(){return n}),n},r=function(e){return encodeURIComponent(e).replace(/%20/g,"+")},i=function(e){return decodeURIComponent(String(e).replace(/\+/g," "))};(function(){try{var t=e.URLSearchParams;return"a=1"===new t("?a=1").toString()&&"function"==typeof t.prototype.set}catch(e){return!1}})()||function(){var i=function e(t){Object.defineProperty(this,"_entries",{writable:!0,value:{}});var n=_typeof(t);if("undefined"===n);else if("string"===n)""!==t&&this._fromString(t);else if(t instanceof e){var r=this;t.forEach((function(e,t){r.append(t,e)}))}else{if(null===t||"object"!==n)throw new TypeError("Unsupported input's type for URLSearchParams");if("[object Array]"===Object.prototype.toString.call(t))for(var i=0;i<t.length;i++){var o=t[i];if("[object Array]"!==Object.prototype.toString.call(o)&&2===o.length)throw new TypeError("Expected [string, any] as entry at index "+i+" of URLSearchParams's input");this.append(o[0],o[1])}else for(var a in t)t.hasOwnProperty(a)&&this.append(a,t[a])}},o=i.prototype;o.append=function(e,t){e in this._entries?this._entries[e].push(String(t)):this._entries[e]=[String(t)]},o.delete=function(e){delete this._entries[e]},o.get=function(e){return e in this._entries?this._entries[e][0]:null},o.getAll=function(e){return e in this._entries?this._entries[e].slice(0):[]},o.has=function(e){return e in this._entries},o.set=function(e,t){this._entries[e]=[String(t)]},o.forEach=function(e,t){var n;for(var r in this._entries)if(this._entries.hasOwnProperty(r)){n=this._entries[r];for(var i=0;i<n.length;i++)e.call(t,n[i],r,this)}},o.keys=function(){var e=[];return this.forEach((function(t,n){e.push(n)})),n(e)},o.values=function(){var e=[];return this.forEach((function(t){e.push(t)})),n(e)},o.entries=function(){var e=[];return this.forEach((function(t,n){e.push([n,t])})),n(e)},t&&(o[Symbol.iterator]=o.entries),o.toString=function(){var e=[];return this.forEach((function(t,n){e.push(r(n)+"="+r(t))})),e.join("&")},e.URLSearchParams=i}();var o=e.URLSearchParams.prototype;"function"!=typeof o.sort&&(o.sort=function(){var e=this,t=[];this.forEach((function(n,r){t.push([r,n]),e._entries||e.delete(r)})),t.sort((function(e,t){return e[0]<t[0]?-1:e[0]>t[0]?1:0})),e._entries&&(e._entries={});for(var n=0;n<t.length;n++)this.append(t[n][0],t[n][1])}),"function"!=typeof o._fromString&&Object.defineProperty(o,"_fromString",{enumerable:!1,configurable:!1,writable:!1,value:function(e){if(this._entries)this._entries={};else{var t=[];this.forEach((function(e,n){t.push(n)}));for(var n=0;n<t.length;n++)this.delete(t[n])}var r,o=(e=e.replace(/^\?/,"")).split("&");for(n=0;n<o.length;n++)r=o[n].split("="),this.append(i(r[0]),r.length>1?i(r[1]):"")}})}(void 0!==commonjsGlobal?commonjsGlobal:"undefined"!=typeof window?window:"undefined"!=typeof self?self:commonjsGlobal),function(e){if(function(){try{var t=new e.URL("b","http://a");return t.pathname="c d","http://a/c%20d"===t.href&&t.searchParams}catch(e){return!1}}()||function(){var t=e.URL,n=function(t,n){"string"!=typeof t&&(t=String(t));var r,i=document;if(n&&(void 0===e.location||n!==e.location.href)){(r=(i=document.implementation.createHTMLDocument("")).createElement("base")).href=n,i.head.appendChild(r);try{if(0!==r.href.indexOf(n))throw new Error(r.href)}catch(e){throw new Error("URL unable to set base "+n+" due to "+e)}}var o=i.createElement("a");o.href=t,r&&(i.body.appendChild(o),o.href=o.href);var a=i.createElement("input");if(a.type="url",a.value=t,":"===o.protocol||!/:/.test(o.href)||!a.checkValidity()&&!n)throw new TypeError("Invalid URL");Object.defineProperty(this,"_anchorElement",{value:o});var s=new e.URLSearchParams(this.search),l=!0,c=!0,u=this;["append","delete","set"].forEach((function(e){var t=s[e];s[e]=function(){t.apply(s,arguments),l&&(c=!1,u.search=s.toString(),c=!0)}})),Object.defineProperty(this,"searchParams",{value:s,enumerable:!0});var d=void 0;Object.defineProperty(this,"_updateSearchParams",{enumerable:!1,configurable:!1,writable:!1,value:function(){this.search!==d&&(d=this.search,c&&(l=!1,this.searchParams._fromString(this.search),l=!0))}})},r=n.prototype;["hash","host","hostname","port","protocol"].forEach((function(e){!function(e){Object.defineProperty(r,e,{get:function(){return this._anchorElement[e]},set:function(t){this._anchorElement[e]=t},enumerable:!0})}(e)})),Object.defineProperty(r,"search",{get:function(){return this._anchorElement.search},set:function(e){this._anchorElement.search=e,this._updateSearchParams()},enumerable:!0}),Object.defineProperties(r,{toString:{get:function(){var e=this;return function(){return e.href}}},href:{get:function(){return this._anchorElement.href.replace(/\?$/,"")},set:function(e){this._anchorElement.href=e,this._updateSearchParams()},enumerable:!0},pathname:{get:function(){return this._anchorElement.pathname.replace(/(^\/?)/,"/")},set:function(e){this._anchorElement.pathname=e},enumerable:!0},origin:{get:function(){var e={"http:":80,"https:":443,"ftp:":21}[this._anchorElement.protocol],t=this._anchorElement.port!=e&&""!==this._anchorElement.port;return this._anchorElement.protocol+"//"+this._anchorElement.hostname+(t?":"+this._anchorElement.port:"")},enumerable:!0},password:{get:function(){return""},set:function(e){},enumerable:!0},username:{get:function(){return""},set:function(e){},enumerable:!0}}),n.createObjectURL=function(e){return t.createObjectURL.apply(t,arguments)},n.revokeObjectURL=function(e){return t.revokeObjectURL.apply(t,arguments)},e.URL=n}(),void 0!==e.location&&!("origin"in e.location)){var t=function(){return e.location.protocol+"//"+e.location.hostname+(e.location.port?":"+e.location.port:"")};try{Object.defineProperty(e.location,"origin",{get:t,enumerable:!0})}catch(n){setInterval((function(){e.location.origin=t()}),100)}}}(void 0!==commonjsGlobal?commonjsGlobal:"undefined"!=typeof window?window:"undefined"!=typeof self?self:commonjsGlobal);var IS_CONCAT_SPREADABLE=wellKnownSymbol("isConcatSpreadable"),MAX_SAFE_INTEGER=9007199254740991,MAXIMUM_ALLOWED_INDEX_EXCEEDED="Maximum allowed index exceeded",IS_CONCAT_SPREADABLE_SUPPORT=engineV8Version>=51||!fails((function(){var e=[];return e[IS_CONCAT_SPREADABLE]=!1,e.concat()[0]!==e})),SPECIES_SUPPORT=arrayMethodHasSpeciesSupport("concat"),isConcatSpreadable=function(e){if(!isObject(e))return!1;var t=e[IS_CONCAT_SPREADABLE];return void 0!==t?!!t:isArray(e)},FORCED=!IS_CONCAT_SPREADABLE_SUPPORT||!SPECIES_SUPPORT;_export({target:"Array",proto:!0,forced:FORCED},{concat:function(e){var t,n,r,i,o,a=toObject(this),s=arraySpeciesCreate(a,0),l=0;for(t=-1,r=arguments.length;t<r;t++)if(isConcatSpreadable(o=-1===t?a:arguments[t])){if(l+(i=toLength(o.length))>MAX_SAFE_INTEGER)throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);for(n=0;n<i;n++,l++)n in o&&createProperty(s,l,o[n])}else{if(l>=MAX_SAFE_INTEGER)throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);createProperty(s,l++,o)}return s.length=l,s}});var $filter=arrayIteration.filter,HAS_SPECIES_SUPPORT$1=arrayMethodHasSpeciesSupport("filter"),USES_TO_LENGTH$3=arrayMethodUsesToLength("filter");_export({target:"Array",proto:!0,forced:!HAS_SPECIES_SUPPORT$1||!USES_TO_LENGTH$3},{filter:function(e){return $filter(this,e,arguments.length>1?arguments[1]:void 0)}});var $find=arrayIteration.find,FIND="find",SKIPS_HOLES=!0,USES_TO_LENGTH$4=arrayMethodUsesToLength(FIND);FIND in[]&&Array(1)[FIND]((function(){SKIPS_HOLES=!1})),_export({target:"Array",proto:!0,forced:SKIPS_HOLES||!USES_TO_LENGTH$4},{find:function(e){return $find(this,e,arguments.length>1?arguments[1]:void 0)}}),addToUnscopables(FIND);var ITERATOR$7=wellKnownSymbol("iterator"),SAFE_CLOSING=!1;try{var called=0,iteratorWithReturn={next:function(){return{done:!!called++}},return:function(){SAFE_CLOSING=!0}};iteratorWithReturn[ITERATOR$7]=function(){return this},Array.from(iteratorWithReturn,(function(){throw 2}))}catch(e){}var checkCorrectnessOfIteration=function(e,t){if(!t&&!SAFE_CLOSING)return!1;var n=!1;try{var r={};r[ITERATOR$7]=function(){return{next:function(){return{done:n=!0}}}},e(r)}catch(e){}return n},INCORRECT_ITERATION=!checkCorrectnessOfIteration((function(e){Array.from(e)}));_export({target:"Array",stat:!0,forced:INCORRECT_ITERATION},{from:arrayFrom});var $includes=arrayIncludes.includes,USES_TO_LENGTH$5=arrayMethodUsesToLength("indexOf",{ACCESSORS:!0,1:0});_export({target:"Array",proto:!0,forced:!USES_TO_LENGTH$5},{includes:function(e){return $includes(this,e,arguments.length>1?arguments[1]:void 0)}}),addToUnscopables("includes");var $map=arrayIteration.map,HAS_SPECIES_SUPPORT$2=arrayMethodHasSpeciesSupport("map"),USES_TO_LENGTH$6=arrayMethodUsesToLength("map");_export({target:"Array",proto:!0,forced:!HAS_SPECIES_SUPPORT$2||!USES_TO_LENGTH$6},{map:function(e){return $map(this,e,arguments.length>1?arguments[1]:void 0)}});var inheritIfRequired=function(e,t,n){var r,i;return objectSetPrototypeOf&&"function"==typeof(r=t.constructor)&&r!==n&&isObject(i=r.prototype)&&i!==n.prototype&&objectSetPrototypeOf(e,i),e},whitespaces="\t\n\v\f\r                 \u2028\u2029\ufeff",whitespace="["+whitespaces+"]",ltrim=RegExp("^"+whitespace+whitespace+"*"),rtrim=RegExp(whitespace+whitespace+"*$"),createMethod$3=function(e){return function(t){var n=String(requireObjectCoercible(t));return 1&e&&(n=n.replace(ltrim,"")),2&e&&(n=n.replace(rtrim,"")),n}},stringTrim={start:createMethod$3(1),end:createMethod$3(2),trim:createMethod$3(3)},getOwnPropertyNames=objectGetOwnPropertyNames.f,getOwnPropertyDescriptor$2=objectGetOwnPropertyDescriptor.f,defineProperty$5=objectDefineProperty.f,trim=stringTrim.trim,NUMBER="Number",NativeNumber=global_1[NUMBER],NumberPrototype=NativeNumber.prototype,BROKEN_CLASSOF=classofRaw(objectCreate(NumberPrototype))==NUMBER,toNumber=function(e){var t,n,r,i,o,a,s,l,c=toPrimitive(e,!1);if("string"==typeof c&&c.length>2)if(43===(t=(c=trim(c)).charCodeAt(0))||45===t){if(88===(n=c.charCodeAt(2))||120===n)return NaN}else if(48===t){switch(c.charCodeAt(1)){case 66:case 98:r=2,i=49;break;case 79:case 111:r=8,i=55;break;default:return+c}for(a=(o=c.slice(2)).length,s=0;s<a;s++)if((l=o.charCodeAt(s))<48||l>i)return NaN;return parseInt(o,r)}return+c};if(isForced_1(NUMBER,!NativeNumber(" 0o1")||!NativeNumber("0b1")||NativeNumber("+0x1"))){for(var key,NumberWrapper=function(e){var t=arguments.length<1?0:e,n=this;return n instanceof NumberWrapper&&(BROKEN_CLASSOF?fails((function(){NumberPrototype.valueOf.call(n)})):classofRaw(n)!=NUMBER)?inheritIfRequired(new NativeNumber(toNumber(t)),n,NumberWrapper):toNumber(t)},keys$1=descriptors?getOwnPropertyNames(NativeNumber):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger".split(","),j=0;keys$1.length>j;j++)has(NativeNumber,key=keys$1[j])&&!has(NumberWrapper,key)&&defineProperty$5(NumberWrapper,key,getOwnPropertyDescriptor$2(NativeNumber,key));NumberWrapper.prototype=NumberPrototype,NumberPrototype.constructor=NumberWrapper,redefine(global_1,NUMBER,NumberWrapper)}var FAILS_ON_PRIMITIVES=fails((function(){objectKeys(1)}));_export({target:"Object",stat:!0,forced:FAILS_ON_PRIMITIVES},{keys:function(e){return objectKeys(toObject(e))}});var notARegexp=function(e){if(isRegexp(e))throw TypeError("The method doesn't accept regular expressions");return e},MATCH$1=wellKnownSymbol("match"),correctIsRegexpLogic=function(e){var t=/./;try{"/./"[e](t)}catch(n){try{return t[MATCH$1]=!1,"/./"[e](t)}catch(e){}}return!1};_export({target:"String",proto:!0,forced:!correctIsRegexpLogic("includes")},{includes:function(e){return!!~String(requireObjectCoercible(this)).indexOf(notARegexp(e),arguments.length>1?arguments[1]:void 0)}});var freezing=!fails((function(){return Object.isExtensible(Object.preventExtensions({}))})),internalMetadata=createCommonjsModule((function(e){var t=objectDefineProperty.f,n=uid("meta"),r=0,i=Object.isExtensible||function(){return!0},o=function(e){t(e,n,{value:{objectID:"O"+ ++r,weakData:{}}})},a=e.exports={REQUIRED:!1,fastKey:function(e,t){if(!isObject(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!has(e,n)){if(!i(e))return"F";if(!t)return"E";o(e)}return e[n].objectID},getWeakData:function(e,t){if(!has(e,n)){if(!i(e))return!0;if(!t)return!1;o(e)}return e[n].weakData},onFreeze:function(e){return freezing&&a.REQUIRED&&i(e)&&!has(e,n)&&o(e),e}};hiddenKeys[n]=!0})),internalMetadata_1=internalMetadata.REQUIRED,internalMetadata_2=internalMetadata.fastKey,internalMetadata_3=internalMetadata.getWeakData,internalMetadata_4=internalMetadata.onFreeze,iterate_1=createCommonjsModule((function(e){var t=function(e,t){this.stopped=e,this.result=t};(e.exports=function(e,n,r,i,o){var a,s,l,c,u,d,h,p=functionBindContext(n,r,i?2:1);if(o)a=e;else{if("function"!=typeof(s=getIteratorMethod(e)))throw TypeError("Target is not iterable");if(isArrayIteratorMethod(s)){for(l=0,c=toLength(e.length);c>l;l++)if((u=i?p(anObject(h=e[l])[0],h[1]):p(e[l]))&&u instanceof t)return u;return new t(!1)}a=s.call(e)}for(d=a.next;!(h=d.call(a)).done;)if("object"==typeof(u=callWithSafeIterationClosing(a,p,h.value,i))&&u&&u instanceof t)return u;return new t(!1)}).stop=function(e){return new t(!0,e)}})),collection=function(e,t,n){var r=-1!==e.indexOf("Map"),i=-1!==e.indexOf("Weak"),o=r?"set":"add",a=global_1[e],s=a&&a.prototype,l=a,c={},u=function(e){var t=s[e];redefine(s,e,"add"==e?function(e){return t.call(this,0===e?0:e),this}:"delete"==e?function(e){return!(i&&!isObject(e))&&t.call(this,0===e?0:e)}:"get"==e?function(e){return i&&!isObject(e)?void 0:t.call(this,0===e?0:e)}:"has"==e?function(e){return!(i&&!isObject(e))&&t.call(this,0===e?0:e)}:function(e,n){return t.call(this,0===e?0:e,n),this})};if(isForced_1(e,"function"!=typeof a||!(i||s.forEach&&!fails((function(){(new a).entries().next()})))))l=n.getConstructor(t,e,r,o),internalMetadata.REQUIRED=!0;else if(isForced_1(e,!0)){var d=new l,h=d[o](i?{}:-0,1)!=d,p=fails((function(){d.has(1)})),f=checkCorrectnessOfIteration((function(e){new a(e)})),m=!i&&fails((function(){for(var e=new a,t=5;t--;)e[o](t,t);return!e.has(-0)}));f||((l=t((function(t,n){anInstance(t,l,e);var i=inheritIfRequired(new a,t,l);return null!=n&&iterate_1(n,i[o],i,r),i}))).prototype=s,s.constructor=l),(p||m)&&(u("delete"),u("has"),r&&u("get")),(m||h)&&u(o),i&&s.clear&&delete s.clear}return c[e]=l,_export({global:!0,forced:l!=a},c),setToStringTag(l,e),i||n.setStrong(l,e,r),l},getWeakData=internalMetadata.getWeakData,setInternalState$5=internalState.set,internalStateGetterFor=internalState.getterFor,find$1=arrayIteration.find,findIndex=arrayIteration.findIndex,id$1=0,uncaughtFrozenStore=function(e){return e.frozen||(e.frozen=new UncaughtFrozenStore)},UncaughtFrozenStore=function(){this.entries=[]},findUncaughtFrozen=function(e,t){return find$1(e.entries,(function(e){return e[0]===t}))};UncaughtFrozenStore.prototype={get:function(e){var t=findUncaughtFrozen(this,e);if(t)return t[1]},has:function(e){return!!findUncaughtFrozen(this,e)},set:function(e,t){var n=findUncaughtFrozen(this,e);n?n[1]=t:this.entries.push([e,t])},delete:function(e){var t=findIndex(this.entries,(function(t){return t[0]===e}));return~t&&this.entries.splice(t,1),!!~t}};var collectionWeak={getConstructor:function(e,t,n,r){var i=e((function(e,o){anInstance(e,i,t),setInternalState$5(e,{type:t,id:id$1++,frozen:void 0}),null!=o&&iterate_1(o,e[r],e,n)})),o=internalStateGetterFor(t),a=function(e,t,n){var r=o(e),i=getWeakData(anObject(t),!0);return!0===i?uncaughtFrozenStore(r).set(t,n):i[r.id]=n,e};return redefineAll(i.prototype,{delete:function(e){var t=o(this);if(!isObject(e))return!1;var n=getWeakData(e);return!0===n?uncaughtFrozenStore(t).delete(e):n&&has(n,t.id)&&delete n[t.id]},has:function(e){var t=o(this);if(!isObject(e))return!1;var n=getWeakData(e);return!0===n?uncaughtFrozenStore(t).has(e):n&&has(n,t.id)}}),redefineAll(i.prototype,n?{get:function(e){var t=o(this);if(isObject(e)){var n=getWeakData(e);return!0===n?uncaughtFrozenStore(t).get(e):n?n[t.id]:void 0}},set:function(e,t){return a(this,e,t)}}:{add:function(e){return a(this,e,!0)}}),i}},es_weakMap=createCommonjsModule((function(e){var t,n=internalState.enforce,r=!global_1.ActiveXObject&&"ActiveXObject"in global_1,i=Object.isExtensible,o=function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}},a=e.exports=collection("WeakMap",o,collectionWeak);if(nativeWeakMap&&r){t=collectionWeak.getConstructor(o,"WeakMap",!0),internalMetadata.REQUIRED=!0;var s=a.prototype,l=s.delete,c=s.has,u=s.get,d=s.set;redefineAll(s,{delete:function(e){if(isObject(e)&&!i(e)){var r=n(this);return r.frozen||(r.frozen=new t),l.call(this,e)||r.frozen.delete(e)}return l.call(this,e)},has:function(e){if(isObject(e)&&!i(e)){var r=n(this);return r.frozen||(r.frozen=new t),c.call(this,e)||r.frozen.has(e)}return c.call(this,e)},get:function(e){if(isObject(e)&&!i(e)){var r=n(this);return r.frozen||(r.frozen=new t),c.call(this,e)?u.call(this,e):r.frozen.get(e)}return u.call(this,e)},set:function(e,r){if(isObject(e)&&!i(e)){var o=n(this);o.frozen||(o.frozen=new t),c.call(this,e)?d.call(this,e,r):o.frozen.set(e,r)}else d.call(this,e,r);return this}})}})),$every=arrayIteration.every,STRICT_METHOD$3=arrayMethodIsStrict("every"),USES_TO_LENGTH$7=arrayMethodUsesToLength("every");_export({target:"Array",proto:!0,forced:!STRICT_METHOD$3||!USES_TO_LENGTH$7},{every:function(e){return $every(this,e,arguments.length>1?arguments[1]:void 0)}}),_export({target:"Object",stat:!0,forced:Object.assign!==objectAssign},{assign:objectAssign});var non="​…᠎",stringTrimForced=function(e){return fails((function(){return!!whitespaces[e]()||non[e]()!=non||whitespaces[e].name!==e}))},$trim=stringTrim.trim;_export({target:"String",proto:!0,forced:stringTrimForced("trim")},{trim:function(){return $trim(this)}});var $some=arrayIteration.some,STRICT_METHOD$4=arrayMethodIsStrict("some"),USES_TO_LENGTH$8=arrayMethodUsesToLength("some");_export({target:"Array",proto:!0,forced:!STRICT_METHOD$4||!USES_TO_LENGTH$8},{some:function(e){return $some(this,e,arguments.length>1?arguments[1]:void 0)}});var thisNumberValue=function(e){if("number"!=typeof e&&"Number"!=classofRaw(e))throw TypeError("Incorrect invocation");return+e},stringRepeat="".repeat||function(e){var t=String(requireObjectCoercible(this)),n="",r=toInteger(e);if(r<0||r==1/0)throw RangeError("Wrong number of repetitions");for(;r>0;(r>>>=1)&&(t+=t))1&r&&(n+=t);return n},nativeToFixed=1..toFixed,floor$4=Math.floor,pow$1=function(e,t,n){return 0===t?n:t%2==1?pow$1(e,t-1,n*e):pow$1(e*e,t/2,n)},log=function(e){for(var t=0,n=e;n>=4096;)t+=12,n/=4096;for(;n>=2;)t+=1,n/=2;return t},FORCED$1=nativeToFixed&&("0.000"!==8e-5.toFixed(3)||"1"!==.9.toFixed(0)||"1.25"!==1.255.toFixed(2)||"1000000000000000128"!==(0xde0b6b3a7640080).toFixed(0))||!fails((function(){nativeToFixed.call({})}));_export({target:"Number",proto:!0,forced:FORCED$1},{toFixed:function(e){var t,n,r,i,o=thisNumberValue(this),a=toInteger(e),s=[0,0,0,0,0,0],l="",c="0",u=function(e,t){for(var n=-1,r=t;++n<6;)r+=e*s[n],s[n]=r%1e7,r=floor$4(r/1e7)},d=function(e){for(var t=6,n=0;--t>=0;)n+=s[t],s[t]=floor$4(n/e),n=n%e*1e7},h=function(){for(var e=6,t="";--e>=0;)if(""!==t||0===e||0!==s[e]){var n=String(s[e]);t=""===t?n:t+stringRepeat.call("0",7-n.length)+n}return t};if(a<0||a>20)throw RangeError("Incorrect fraction digits");if(o!=o)return"NaN";if(o<=-1e21||o>=1e21)return String(o);if(o<0&&(l="-",o=-o),o>1e-21)if(n=(t=log(o*pow$1(2,69,1))-69)<0?o*pow$1(2,-t,1):o/pow$1(2,t,1),n*=4503599627370496,(t=52-t)>0){for(u(0,n),r=a;r>=7;)u(1e7,0),r-=7;for(u(pow$1(10,r,1),0),r=t-1;r>=23;)d(1<<23),r-=23;d(1<<r),u(1,1),d(2),c=h()}else u(0,n),u(1<<-t,0),c=h()+stringRepeat.call("0",a);return c=a>0?l+((i=c.length)<=a?"0."+stringRepeat.call("0",a-i)+c:c.slice(0,i-a)+"."+c.slice(i-a)):l+c}});var propertyIsEnumerable=objectPropertyIsEnumerable.f,createMethod$4=function(e){return function(t){for(var n,r=toIndexedObject(t),i=objectKeys(r),o=i.length,a=0,s=[];o>a;)n=i[a++],descriptors&&!propertyIsEnumerable.call(r,n)||s.push(e?[n,r[n]]:r[n]);return s}},objectToArray={entries:createMethod$4(!0),values:createMethod$4(!1)},$entries=objectToArray.entries;_export({target:"Object",stat:!0},{entries:function(e){return $entries(e)}});var $values=objectToArray.values;_export({target:"Object",stat:!0},{values:function(e){return $values(e)}}),_export({target:"Number",stat:!0},{isNaN:function(e){return e!=e}});var nativeGetOwnPropertyDescriptor$2=objectGetOwnPropertyDescriptor.f,FAILS_ON_PRIMITIVES$1=fails((function(){nativeGetOwnPropertyDescriptor$2(1)})),FORCED$2=!descriptors||FAILS_ON_PRIMITIVES$1;function _classCallCheck$1(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties$1(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function _createClass$1(e,t,n){return t&&_defineProperties$1(e.prototype,t),n&&_defineProperties$1(e,n),e}function _defineProperty$1(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ownKeys$2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function _objectSpread2$1(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ownKeys$2(Object(n),!0).forEach((function(t){_defineProperty$1(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ownKeys$2(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}_export({target:"Object",stat:!0,forced:FORCED$2,sham:!descriptors},{getOwnPropertyDescriptor:function(e,t){return nativeGetOwnPropertyDescriptor$2(toIndexedObject(e),t)}}),_export({target:"Object",stat:!0,sham:!descriptors},{getOwnPropertyDescriptors:function(e){for(var t,n,r=toIndexedObject(e),i=objectGetOwnPropertyDescriptor.f,o=ownKeys(r),a={},s=0;o.length>s;)void 0!==(n=i(r,t=o[s++]))&&createProperty(a,t,n);return a}}),fixRegexpWellKnownSymbolLogic("match",1,(function(e,t,n){return[function(t){var n=requireObjectCoercible(this),r=null==t?void 0:t[e];return void 0!==r?r.call(t,n):new RegExp(t)[e](String(n))},function(e){var r=n(t,e,this);if(r.done)return r.value;var i=anObject(e),o=String(this);if(!i.global)return regexpExecAbstract(i,o);var a=i.unicode;i.lastIndex=0;for(var s,l=[],c=0;null!==(s=regexpExecAbstract(i,o));){var u=String(s[0]);l[c]=u,""===u&&(i.lastIndex=advanceStringIndex(o,toLength(i.lastIndex),a)),c++}return 0===c?null:l}]}));var defaults={addCSS:!0,thumbWidth:15,watch:!0};function matches(e,t){return function(){return Array.from(document.querySelectorAll(t)).includes(this)}.call(e,t)}function trigger(e,t){if(e&&t){var n=new Event(t,{bubbles:!0});e.dispatchEvent(n)}}var getConstructor=function(e){return null!=e?e.constructor:null},instanceOf=function(e,t){return!!(e&&t&&e instanceof t)},isNullOrUndefined=function(e){return null==e},isObject$1=function(e){return getConstructor(e)===Object},isNumber=function(e){return getConstructor(e)===Number&&!Number.isNaN(e)},isString=function(e){return getConstructor(e)===String},isBoolean=function(e){return getConstructor(e)===Boolean},isFunction=function(e){return getConstructor(e)===Function},isArray$1=function(e){return Array.isArray(e)},isNodeList=function(e){return instanceOf(e,NodeList)},isElement=function(e){return instanceOf(e,Element)},isEvent=function(e){return instanceOf(e,Event)},isEmpty=function(e){return isNullOrUndefined(e)||(isString(e)||isArray$1(e)||isNodeList(e))&&!e.length||isObject$1(e)&&!Object.keys(e).length},is={nullOrUndefined:isNullOrUndefined,object:isObject$1,number:isNumber,string:isString,boolean:isBoolean,function:isFunction,array:isArray$1,nodeList:isNodeList,element:isElement,event:isEvent,empty:isEmpty};function getDecimalPlaces(e){var t="".concat(e).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);return t?Math.max(0,(t[1]?t[1].length:0)-(t[2]?+t[2]:0)):0}function round(e,t){if(1>t){var n=getDecimalPlaces(t);return parseFloat(e.toFixed(n))}return Math.round(e/t)*t}var defer,channel,port,RangeTouch=function(){function e(t,n){_classCallCheck$1(this,e),is.element(t)?this.element=t:is.string(t)&&(this.element=document.querySelector(t)),is.element(this.element)&&is.empty(this.element.rangeTouch)&&(this.config=_objectSpread2$1({},defaults,{},n),this.init())}return _createClass$1(e,[{key:"init",value:function(){e.enabled&&(this.config.addCSS&&(this.element.style.userSelect="none",this.element.style.webKitUserSelect="none",this.element.style.touchAction="manipulation"),this.listeners(!0),this.element.rangeTouch=this)}},{key:"destroy",value:function(){e.enabled&&(this.config.addCSS&&(this.element.style.userSelect="",this.element.style.webKitUserSelect="",this.element.style.touchAction=""),this.listeners(!1),this.element.rangeTouch=null)}},{key:"listeners",value:function(e){var t=this,n=e?"addEventListener":"removeEventListener";["touchstart","touchmove","touchend"].forEach((function(e){t.element[n](e,(function(e){return t.set(e)}),!1)}))}},{key:"get",value:function(t){if(!e.enabled||!is.event(t))return null;var n,r=t.target,i=t.changedTouches[0],o=parseFloat(r.getAttribute("min"))||0,a=parseFloat(r.getAttribute("max"))||100,s=parseFloat(r.getAttribute("step"))||1,l=r.getBoundingClientRect(),c=100/l.width*(this.config.thumbWidth/2)/100;return 0>(n=100/l.width*(i.clientX-l.left))?n=0:100<n&&(n=100),50>n?n-=(100-2*n)*c:50<n&&(n+=2*(n-50)*c),o+round(n/100*(a-o),s)}},{key:"set",value:function(t){e.enabled&&is.event(t)&&!t.target.disabled&&(t.preventDefault(),t.target.value=this.get(t),trigger(t.target,"touchend"===t.type?"change":"input"))}}],[{key:"setup",value:function(t){var n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},r=null;if(is.empty(t)||is.string(t)?r=Array.from(document.querySelectorAll(is.string(t)?t:'input[type="range"]')):is.element(t)?r=[t]:is.nodeList(t)?r=Array.from(t):is.array(t)&&(r=t.filter(is.element)),is.empty(r))return null;var i=_objectSpread2$1({},defaults,{},n);if(is.string(t)&&i.watch){var o=new MutationObserver((function(n){Array.from(n).forEach((function(n){Array.from(n.addedNodes).forEach((function(n){is.element(n)&&matches(n,t)&&new e(n,i)}))}))}));o.observe(document.body,{childList:!0,subtree:!0})}return r.map((function(t){return new e(t,n)}))}},{key:"enabled",get:function(){return"ontouchstart"in document.documentElement}}]),e}(),nativePromiseConstructor=global_1.Promise,SPECIES$5=wellKnownSymbol("species"),setSpecies=function(e){var t=getBuiltIn(e),n=objectDefineProperty.f;descriptors&&t&&!t[SPECIES$5]&&n(t,SPECIES$5,{configurable:!0,get:function(){return this}})},engineIsIos=/(iphone|ipod|ipad).*applewebkit/i.test(engineUserAgent),location=global_1.location,set$1=global_1.setImmediate,clear=global_1.clearImmediate,process$1=global_1.process,MessageChannel=global_1.MessageChannel,Dispatch=global_1.Dispatch,counter=0,queue={},ONREADYSTATECHANGE="onreadystatechange",run=function(e){if(queue.hasOwnProperty(e)){var t=queue[e];delete queue[e],t()}},runner=function(e){return function(){run(e)}},listener=function(e){run(e.data)},post=function(e){global_1.postMessage(e+"",location.protocol+"//"+location.host)};set$1&&clear||(set$1=function(e){for(var t=[],n=1;arguments.length>n;)t.push(arguments[n++]);return queue[++counter]=function(){("function"==typeof e?e:Function(e)).apply(void 0,t)},defer(counter),counter},clear=function(e){delete queue[e]},"process"==classofRaw(process$1)?defer=function(e){process$1.nextTick(runner(e))}:Dispatch&&Dispatch.now?defer=function(e){Dispatch.now(runner(e))}:MessageChannel&&!engineIsIos?(port=(channel=new MessageChannel).port2,channel.port1.onmessage=listener,defer=functionBindContext(port.postMessage,port,1)):!global_1.addEventListener||"function"!=typeof postMessage||global_1.importScripts||fails(post)||"file:"===location.protocol?defer=ONREADYSTATECHANGE in documentCreateElement("script")?function(e){html.appendChild(documentCreateElement("script"))[ONREADYSTATECHANGE]=function(){html.removeChild(this),run(e)}}:function(e){setTimeout(runner(e),0)}:(defer=post,global_1.addEventListener("message",listener,!1)));var flush,head,last,notify,toggle,node,promise,then,task={set:set$1,clear:clear},getOwnPropertyDescriptor$3=objectGetOwnPropertyDescriptor.f,macrotask=task.set,MutationObserver$1=global_1.MutationObserver||global_1.WebKitMutationObserver,process$2=global_1.process,Promise$1=global_1.Promise,IS_NODE="process"==classofRaw(process$2),queueMicrotaskDescriptor=getOwnPropertyDescriptor$3(global_1,"queueMicrotask"),queueMicrotask=queueMicrotaskDescriptor&&queueMicrotaskDescriptor.value;queueMicrotask||(flush=function(){var e,t;for(IS_NODE&&(e=process$2.domain)&&e.exit();head;){t=head.fn,head=head.next;try{t()}catch(e){throw head?notify():last=void 0,e}}last=void 0,e&&e.enter()},IS_NODE?notify=function(){process$2.nextTick(flush)}:MutationObserver$1&&!engineIsIos?(toggle=!0,node=document.createTextNode(""),new MutationObserver$1(flush).observe(node,{characterData:!0}),notify=function(){node.data=toggle=!toggle}):Promise$1&&Promise$1.resolve?(promise=Promise$1.resolve(void 0),then=promise.then,notify=function(){then.call(promise,flush)}):notify=function(){macrotask.call(global_1,flush)});var Internal,OwnPromiseCapability,PromiseWrapper,nativeThen,microtask=queueMicrotask||function(e){var t={fn:e,next:void 0};last&&(last.next=t),head||(head=t,notify()),last=t},PromiseCapability=function(e){var t,n;this.promise=new e((function(e,r){if(void 0!==t||void 0!==n)throw TypeError("Bad Promise constructor");t=e,n=r})),this.resolve=aFunction$1(t),this.reject=aFunction$1(n)},f$7=function(e){return new PromiseCapability(e)},newPromiseCapability={f:f$7},promiseResolve=function(e,t){if(anObject(e),isObject(t)&&t.constructor===e)return t;var n=newPromiseCapability.f(e);return(0,n.resolve)(t),n.promise},hostReportErrors=function(e,t){var n=global_1.console;n&&n.error&&(1===arguments.length?n.error(e):n.error(e,t))},perform=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}},task$1=task.set,SPECIES$6=wellKnownSymbol("species"),PROMISE="Promise",getInternalState$3=internalState.get,setInternalState$6=internalState.set,getInternalPromiseState=internalState.getterFor(PROMISE),PromiseConstructor=nativePromiseConstructor,TypeError$1=global_1.TypeError,document$2=global_1.document,process$3=global_1.process,$fetch$1=getBuiltIn("fetch"),newPromiseCapability$1=newPromiseCapability.f,newGenericPromiseCapability=newPromiseCapability$1,IS_NODE$1="process"==classofRaw(process$3),DISPATCH_EVENT=!!(document$2&&document$2.createEvent&&global_1.dispatchEvent),UNHANDLED_REJECTION="unhandledrejection",REJECTION_HANDLED="rejectionhandled",PENDING=0,FULFILLED=1,REJECTED=2,HANDLED=1,UNHANDLED=2,FORCED$3=isForced_1(PROMISE,(function(){if(!(inspectSource(PromiseConstructor)!==String(PromiseConstructor))){if(66===engineV8Version)return!0;if(!IS_NODE$1&&"function"!=typeof PromiseRejectionEvent)return!0}if(engineV8Version>=51&&/native code/.test(PromiseConstructor))return!1;var e=PromiseConstructor.resolve(1),t=function(e){e((function(){}),(function(){}))};return(e.constructor={})[SPECIES$6]=t,!(e.then((function(){}))instanceof t)})),INCORRECT_ITERATION$1=FORCED$3||!checkCorrectnessOfIteration((function(e){PromiseConstructor.all(e).catch((function(){}))})),isThenable=function(e){var t;return!(!isObject(e)||"function"!=typeof(t=e.then))&&t},notify$1=function(e,t,n){if(!t.notified){t.notified=!0;var r=t.reactions;microtask((function(){for(var i=t.value,o=t.state==FULFILLED,a=0;r.length>a;){var s,l,c,u=r[a++],d=o?u.ok:u.fail,h=u.resolve,p=u.reject,f=u.domain;try{d?(o||(t.rejection===UNHANDLED&&onHandleUnhandled(e,t),t.rejection=HANDLED),!0===d?s=i:(f&&f.enter(),s=d(i),f&&(f.exit(),c=!0)),s===u.promise?p(TypeError$1("Promise-chain cycle")):(l=isThenable(s))?l.call(s,h,p):h(s)):p(i)}catch(e){f&&!c&&f.exit(),p(e)}}t.reactions=[],t.notified=!1,n&&!t.rejection&&onUnhandled(e,t)}))}},dispatchEvent=function(e,t,n){var r,i;DISPATCH_EVENT?((r=document$2.createEvent("Event")).promise=t,r.reason=n,r.initEvent(e,!1,!0),global_1.dispatchEvent(r)):r={promise:t,reason:n},(i=global_1["on"+e])?i(r):e===UNHANDLED_REJECTION&&hostReportErrors("Unhandled promise rejection",n)},onUnhandled=function(e,t){task$1.call(global_1,(function(){var n,r=t.value;if(isUnhandled(t)&&(n=perform((function(){IS_NODE$1?process$3.emit("unhandledRejection",r,e):dispatchEvent(UNHANDLED_REJECTION,e,r)})),t.rejection=IS_NODE$1||isUnhandled(t)?UNHANDLED:HANDLED,n.error))throw n.value}))},isUnhandled=function(e){return e.rejection!==HANDLED&&!e.parent},onHandleUnhandled=function(e,t){task$1.call(global_1,(function(){IS_NODE$1?process$3.emit("rejectionHandled",e):dispatchEvent(REJECTION_HANDLED,e,t.value)}))},bind=function(e,t,n,r){return function(i){e(t,n,i,r)}},internalReject=function(e,t,n,r){t.done||(t.done=!0,r&&(t=r),t.value=n,t.state=REJECTED,notify$1(e,t,!0))},internalResolve=function(e,t,n,r){if(!t.done){t.done=!0,r&&(t=r);try{if(e===n)throw TypeError$1("Promise can't be resolved itself");var i=isThenable(n);i?microtask((function(){var r={done:!1};try{i.call(n,bind(internalResolve,e,r,t),bind(internalReject,e,r,t))}catch(n){internalReject(e,r,n,t)}})):(t.value=n,t.state=FULFILLED,notify$1(e,t,!1))}catch(n){internalReject(e,{done:!1},n,t)}}};FORCED$3&&(PromiseConstructor=function(e){anInstance(this,PromiseConstructor,PROMISE),aFunction$1(e),Internal.call(this);var t=getInternalState$3(this);try{e(bind(internalResolve,this,t),bind(internalReject,this,t))}catch(e){internalReject(this,t,e)}},(Internal=function(e){setInternalState$6(this,{type:PROMISE,done:!1,notified:!1,parent:!1,reactions:[],rejection:!1,state:PENDING,value:void 0})}).prototype=redefineAll(PromiseConstructor.prototype,{then:function(e,t){var n=getInternalPromiseState(this),r=newPromiseCapability$1(speciesConstructor(this,PromiseConstructor));return r.ok="function"!=typeof e||e,r.fail="function"==typeof t&&t,r.domain=IS_NODE$1?process$3.domain:void 0,n.parent=!0,n.reactions.push(r),n.state!=PENDING&&notify$1(this,n,!1),r.promise},catch:function(e){return this.then(void 0,e)}}),OwnPromiseCapability=function(){var e=new Internal,t=getInternalState$3(e);this.promise=e,this.resolve=bind(internalResolve,e,t),this.reject=bind(internalReject,e,t)},newPromiseCapability.f=newPromiseCapability$1=function(e){return e===PromiseConstructor||e===PromiseWrapper?new OwnPromiseCapability(e):newGenericPromiseCapability(e)},"function"==typeof nativePromiseConstructor&&(nativeThen=nativePromiseConstructor.prototype.then,redefine(nativePromiseConstructor.prototype,"then",(function(e,t){var n=this;return new PromiseConstructor((function(e,t){nativeThen.call(n,e,t)})).then(e,t)}),{unsafe:!0}),"function"==typeof $fetch$1&&_export({global:!0,enumerable:!0,forced:!0},{fetch:function(e){return promiseResolve(PromiseConstructor,$fetch$1.apply(global_1,arguments))}}))),_export({global:!0,wrap:!0,forced:FORCED$3},{Promise:PromiseConstructor}),setToStringTag(PromiseConstructor,PROMISE,!1),setSpecies(PROMISE),PromiseWrapper=getBuiltIn(PROMISE),_export({target:PROMISE,stat:!0,forced:FORCED$3},{reject:function(e){var t=newPromiseCapability$1(this);return t.reject.call(void 0,e),t.promise}}),_export({target:PROMISE,stat:!0,forced:FORCED$3},{resolve:function(e){return promiseResolve(this,e)}}),_export({target:PROMISE,stat:!0,forced:INCORRECT_ITERATION$1},{all:function(e){var t=this,n=newPromiseCapability$1(t),r=n.resolve,i=n.reject,o=perform((function(){var n=aFunction$1(t.resolve),o=[],a=0,s=1;iterate_1(e,(function(e){var l=a++,c=!1;o.push(void 0),s++,n.call(t,e).then((function(e){c||(c=!0,o[l]=e,--s||r(o))}),i)})),--s||r(o)}));return o.error&&i(o.value),n.promise},race:function(e){var t=this,n=newPromiseCapability$1(t),r=n.reject,i=perform((function(){var i=aFunction$1(t.resolve);iterate_1(e,(function(e){i.call(t,e).then(n.resolve,r)}))}));return i.error&&r(i.value),n.promise}});var getOwnPropertyDescriptor$4=objectGetOwnPropertyDescriptor.f,nativeStartsWith="".startsWith,min$4=Math.min,CORRECT_IS_REGEXP_LOGIC=correctIsRegexpLogic("startsWith"),MDN_POLYFILL_BUG=!CORRECT_IS_REGEXP_LOGIC&&!!function(){var e=getOwnPropertyDescriptor$4(String.prototype,"startsWith");return e&&!e.writable}();_export({target:"String",proto:!0,forced:!MDN_POLYFILL_BUG&&!CORRECT_IS_REGEXP_LOGIC},{startsWith:function(e){var t=String(requireObjectCoercible(this));notARegexp(e);var n=toLength(min$4(arguments.length>1?arguments[1]:void 0,t.length)),r=String(e);return nativeStartsWith?nativeStartsWith.call(t,r,n):t.slice(n,n+r.length)===r}});var getConstructor$1=function(e){return null!=e?e.constructor:null},instanceOf$1=function(e,t){return Boolean(e&&t&&e instanceof t)},isNullOrUndefined$1=function(e){return null==e},isObject$2=function(e){return getConstructor$1(e)===Object},isNumber$1=function(e){return getConstructor$1(e)===Number&&!Number.isNaN(e)},isString$1=function(e){return getConstructor$1(e)===String},isBoolean$1=function(e){return getConstructor$1(e)===Boolean},isFunction$1=function(e){return getConstructor$1(e)===Function},isArray$2=function(e){return Array.isArray(e)},isWeakMap=function(e){return instanceOf$1(e,WeakMap)},isNodeList$1=function(e){return instanceOf$1(e,NodeList)},isElement$1=function(e){return instanceOf$1(e,Element)},isTextNode=function(e){return getConstructor$1(e)===Text},isEvent$1=function(e){return instanceOf$1(e,Event)},isKeyboardEvent=function(e){return instanceOf$1(e,KeyboardEvent)},isCue=function(e){return instanceOf$1(e,window.TextTrackCue)||instanceOf$1(e,window.VTTCue)},isTrack=function(e){return instanceOf$1(e,TextTrack)||!isNullOrUndefined$1(e)&&isString$1(e.kind)},isPromise=function(e){return instanceOf$1(e,Promise)&&isFunction$1(e.then)},isEmpty$1=function(e){return isNullOrUndefined$1(e)||(isString$1(e)||isArray$2(e)||isNodeList$1(e))&&!e.length||isObject$2(e)&&!Object.keys(e).length},isUrl=function(e){if(instanceOf$1(e,window.URL))return!0;if(!isString$1(e))return!1;var t=e;e.startsWith("http://")&&e.startsWith("https://")||(t="http://".concat(e));try{return!isEmpty$1(new URL(t).hostname)}catch(e){return!1}},is$1={nullOrUndefined:isNullOrUndefined$1,object:isObject$2,number:isNumber$1,string:isString$1,boolean:isBoolean$1,function:isFunction$1,array:isArray$2,weakMap:isWeakMap,nodeList:isNodeList$1,element:isElement$1,textNode:isTextNode,event:isEvent$1,keyboardEvent:isKeyboardEvent,cue:isCue,track:isTrack,promise:isPromise,url:isUrl,empty:isEmpty$1},transitionEndEvent=function(){var e=document.createElement("span"),t={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"},n=Object.keys(t).find((function(t){return void 0!==e.style[t]}));return!!is$1.string(n)&&t[n]}();function repaint(e,t){setTimeout((function(){try{e.hidden=!0,e.offsetHeight,e.hidden=!1}catch(e){}}),t)}var browser={isIE:
+/* @cc_on!@ */
+!!document.documentMode,isEdge:window.navigator.userAgent.includes("Edge"),isWebkit:"WebkitAppearance"in document.documentElement.style&&!/Edge/.test(navigator.userAgent),isIPhone:/(iPhone|iPod)/gi.test(navigator.platform),isIos:/(iPad|iPhone|iPod)/gi.test(navigator.platform)},createMethod$5=function(e){return function(t,n,r,i){aFunction$1(n);var o=toObject(t),a=indexedObject(o),s=toLength(o.length),l=e?s-1:0,c=e?-1:1;if(r<2)for(;;){if(l in a){i=a[l],l+=c;break}if(l+=c,e?l<0:s<=l)throw TypeError("Reduce of empty array with no initial value")}for(;e?l>=0:s>l;l+=c)l in a&&(i=n(i,a[l],l,o));return i}},arrayReduce={left:createMethod$5(!1),right:createMethod$5(!0)},$reduce=arrayReduce.left,STRICT_METHOD$5=arrayMethodIsStrict("reduce"),USES_TO_LENGTH$9=arrayMethodUsesToLength("reduce",{1:0});function cloneDeep(e){return JSON.parse(JSON.stringify(e))}function getDeep(e,t){return t.split(".").reduce((function(e,t){return e&&e[t]}),e)}function extend(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];if(!n.length)return e;var i=n.shift();return is$1.object(i)?(Object.keys(i).forEach((function(t){is$1.object(i[t])?(Object.keys(e).includes(t)||Object.assign(e,_defineProperty({},t,{})),extend(e[t],i[t])):Object.assign(e,_defineProperty({},t,i[t]))})),extend.apply(void 0,[e].concat(n))):e}function wrap$1(e,t){var n=e.length?e:[e];Array.from(n).reverse().forEach((function(e,n){var r=n>0?t.cloneNode(!0):t,i=e.parentNode,o=e.nextSibling;r.appendChild(e),o?i.insertBefore(r,o):i.appendChild(r)}))}function setAttributes(e,t){is$1.element(e)&&!is$1.empty(t)&&Object.entries(t).filter((function(e){var t=_slicedToArray(e,2)[1];return!is$1.nullOrUndefined(t)})).forEach((function(t){var n=_slicedToArray(t,2),r=n[0],i=n[1];return e.setAttribute(r,i)}))}function createElement(e,t,n){var r=document.createElement(e);return is$1.object(t)&&setAttributes(r,t),is$1.string(n)&&(r.innerText=n),r}function insertAfter(e,t){is$1.element(e)&&is$1.element(t)&&t.parentNode.insertBefore(e,t.nextSibling)}function insertElement(e,t,n,r){is$1.element(t)&&t.appendChild(createElement(e,n,r))}function removeElement(e){is$1.nodeList(e)||is$1.array(e)?Array.from(e).forEach(removeElement):is$1.element(e)&&is$1.element(e.parentNode)&&e.parentNode.removeChild(e)}function emptyElement(e){if(is$1.element(e))for(var t=e.childNodes.length;t>0;)e.removeChild(e.lastChild),t-=1}function replaceElement(e,t){return is$1.element(t)&&is$1.element(t.parentNode)&&is$1.element(e)?(t.parentNode.replaceChild(e,t),e):null}function getAttributesFromSelector(e,t){if(!is$1.string(e)||is$1.empty(e))return{};var n={},r=extend({},t);return e.split(",").forEach((function(e){var t=e.trim(),i=t.replace(".",""),o=t.replace(/[[\]]/g,"").split("="),a=_slicedToArray(o,1)[0],s=o.length>1?o[1].replace(/["']/g,""):"";switch(t.charAt(0)){case".":is$1.string(r.class)?n.class="".concat(r.class," ").concat(i):n.class=i;break;case"#":n.id=t.replace("#","");break;case"[":n[a]=s}})),extend(r,n)}function toggleHidden(e,t){if(is$1.element(e)){var n=t;is$1.boolean(n)||(n=!e.hidden),e.hidden=n}}function toggleClass(e,t,n){if(is$1.nodeList(e))return Array.from(e).map((function(e){return toggleClass(e,t,n)}));if(is$1.element(e)){var r="toggle";return void 0!==n&&(r=n?"add":"remove"),e.classList[r](t),e.classList.contains(t)}return!1}function hasClass(e,t){return is$1.element(e)&&e.classList.contains(t)}function matches$1(e,t){var n=Element.prototype;return(n.matches||n.webkitMatchesSelector||n.mozMatchesSelector||n.msMatchesSelector||function(){return Array.from(document.querySelectorAll(t)).includes(this)}).call(e,t)}function closest(e,t){return(Element.prototype.closest||function(){var e=this;do{if(matches$1.matches(e,t))return e;e=e.parentElement||e.parentNode}while(null!==e&&1===e.nodeType);return null}).call(e,t)}function getElements(e){return this.elements.container.querySelectorAll(e)}function getElement(e){return this.elements.container.querySelector(e)}function setFocus(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];is$1.element(e)&&(e.focus({preventScroll:!0}),t&&toggleClass(e,this.config.classNames.tabFocus))}_export({target:"Array",proto:!0,forced:!STRICT_METHOD$5||!USES_TO_LENGTH$9},{reduce:function(e){return $reduce(this,e,arguments.length,arguments.length>1?arguments[1]:void 0)}});var defaultCodecs={"audio/ogg":"vorbis","audio/wav":"1","video/webm":"vp8, vorbis","video/mp4":"avc1.42E01E, mp4a.40.2","video/ogg":"theora"},support={audio:"canPlayType"in document.createElement("audio"),video:"canPlayType"in document.createElement("video"),check:function(e,t,n){var r=browser.isIPhone&&n&&support.playsinline,i=support[e]||"html5"!==t;return{api:i,ui:i&&support.rangeInput&&("video"!==e||!browser.isIPhone||r)}},pip:!(browser.isIPhone||!is$1.function(createElement("video").webkitSetPresentationMode)&&(!document.pictureInPictureEnabled||createElement("video").disablePictureInPicture)),airplay:is$1.function(window.WebKitPlaybackTargetAvailabilityEvent),playsinline:"playsInline"in document.createElement("video"),mime:function(e){if(is$1.empty(e))return!1;var t=_slicedToArray(e.split("/"),1)[0],n=e;if(!this.isHTML5||t!==this.type)return!1;Object.keys(defaultCodecs).includes(n)&&(n+='; codecs="'.concat(defaultCodecs[e],'"'));try{return Boolean(n&&this.media.canPlayType(n).replace(/no/,""))}catch(e){return!1}},textTracks:"textTracks"in document.createElement("video"),rangeInput:function(){var e=document.createElement("input");return e.type="range","range"===e.type}(),touch:"ontouchstart"in document.documentElement,transitions:!1!==transitionEndEvent,reducedMotion:"matchMedia"in window&&window.matchMedia("(prefers-reduced-motion)").matches},supportsPassiveListeners=function(){var e=!1;try{var t=Object.defineProperty({},"passive",{get:function(){return e=!0,null}});window.addEventListener("test",null,t),window.removeEventListener("test",null,t)}catch(e){}return e}();function toggleListener(e,t,n){var r=this,i=arguments.length>3&&void 0!==arguments[3]&&arguments[3],o=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],a=arguments.length>5&&void 0!==arguments[5]&&arguments[5];if(e&&"addEventListener"in e&&!is$1.empty(t)&&is$1.function(n)){var s=t.split(" "),l=a;supportsPassiveListeners&&(l={passive:o,capture:a}),s.forEach((function(t){r&&r.eventListeners&&i&&r.eventListeners.push({element:e,type:t,callback:n,options:l}),e[i?"addEventListener":"removeEventListener"](t,n,l)}))}}function on(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2?arguments[2]:void 0,r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],i=arguments.length>4&&void 0!==arguments[4]&&arguments[4];toggleListener.call(this,e,t,n,!0,r,i)}function off(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2?arguments[2]:void 0,r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],i=arguments.length>4&&void 0!==arguments[4]&&arguments[4];toggleListener.call(this,e,t,n,!1,r,i)}function once(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=arguments.length>2?arguments[2]:void 0,i=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],o=arguments.length>4&&void 0!==arguments[4]&&arguments[4],a=function a(){off(e,n,a,i,o);for(var s=arguments.length,l=new Array(s),c=0;c<s;c++)l[c]=arguments[c];r.apply(t,l)};toggleListener.call(this,e,n,a,!0,i,o)}function triggerEvent(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(is$1.element(e)&&!is$1.empty(t)){var i=new CustomEvent(t,{bubbles:n,detail:_objectSpread2(_objectSpread2({},r),{},{plyr:this})});e.dispatchEvent(i)}}function unbindListeners(){this&&this.eventListeners&&(this.eventListeners.forEach((function(e){var t=e.element,n=e.type,r=e.callback,i=e.options;t.removeEventListener(n,r,i)})),this.eventListeners=[])}function ready(){var e=this;return new Promise((function(t){return e.ready?setTimeout(t,0):on.call(e,e.elements.container,"ready",t)})).then((function(){}))}function silencePromise(e){is$1.promise(e)&&e.then(null,(function(){}))}function validateRatio(e){return!!(is$1.array(e)||is$1.string(e)&&e.includes(":"))&&(is$1.array(e)?e:e.split(":")).map(Number).every(is$1.number)}function reduceAspectRatio(e){if(!is$1.array(e)||!e.every(is$1.number))return null;var t=_slicedToArray(e,2),n=t[0],r=t[1],i=function e(t,n){return 0===n?t:e(n,t%n)}(n,r);return[n/i,r/i]}function getAspectRatio(e){var t=function(e){return validateRatio(e)?e.split(":").map(Number):null},n=t(e);if(null===n&&(n=t(this.config.ratio)),null===n&&!is$1.empty(this.embed)&&is$1.array(this.embed.ratio)&&(n=this.embed.ratio),null===n&&this.isHTML5){var r=this.media;n=reduceAspectRatio([r.videoWidth,r.videoHeight])}return n}function setAspectRatio(e){if(!this.isVideo)return{};var t=this.elements.wrapper,n=getAspectRatio.call(this,e),r=_slicedToArray(is$1.array(n)?n:[0,0],2),i=100/r[0]*r[1];if(t.style.paddingBottom="".concat(i,"%"),this.isVimeo&&!this.config.vimeo.premium&&this.supported.ui){var o=100/this.media.offsetWidth*parseInt(window.getComputedStyle(this.media).paddingBottom,10),a=(o-i)/(o/50);this.media.style.transform="translateY(-".concat(a,"%)")}else this.isHTML5&&t.classList.toggle(this.config.classNames.videoFixedRatio,null!==n);return{padding:i,ratio:n}}var html5={getSources:function(){var e=this;return this.isHTML5?Array.from(this.media.querySelectorAll("source")).filter((function(t){var n=t.getAttribute("type");return!!is$1.empty(n)||support.mime.call(e,n)})):[]},getQualityOptions:function(){return this.config.quality.forced?this.config.quality.options:html5.getSources.call(this).map((function(e){return Number(e.getAttribute("data-res"))})).filter(Boolean)},setup:function(){if(this.isHTML5){var e=this;e.options.speed=e.config.speed.options,is$1.empty(this.config.ratio)||setAspectRatio.call(e),Object.defineProperty(e.media,"quality",{get:function(){var t=html5.getSources.call(e).find((function(t){return t.getAttribute("src")===e.source}));return t&&Number(t.getAttribute("data-res"))},set:function(t){if(e.quality!==t){if(e.config.quality.forced&&is$1.function(e.config.quality.onChange))e.config.quality.onChange(t);else{var n=html5.getSources.call(e).find((function(e){return Number(e.getAttribute("data-res"))===t}));if(!n)return;var r=e.media,i=r.currentTime,o=r.paused,a=r.preload,s=r.readyState,l=r.playbackRate;e.media.src=n.getAttribute("src"),("none"!==a||s)&&(e.once("loadedmetadata",(function(){e.speed=l,e.currentTime=i,o||silencePromise(e.play())})),e.media.load())}triggerEvent.call(e,e.media,"qualitychange",!1,{quality:t})}}})}},cancelRequests:function(){this.isHTML5&&(removeElement(html5.getSources.call(this)),this.media.setAttribute("src",this.config.blankVideo),this.media.load(),this.debug.log("Cancelled network requests"))}};function dedupe(e){return is$1.array(e)?e.filter((function(t,n){return e.indexOf(t)===n})):e}function closest$1(e,t){return is$1.array(e)&&e.length?e.reduce((function(e,n){return Math.abs(n-t)<Math.abs(e-t)?n:e})):null}var defineProperty$6=objectDefineProperty.f,getOwnPropertyNames$1=objectGetOwnPropertyNames.f,setInternalState$7=internalState.set,MATCH$2=wellKnownSymbol("match"),NativeRegExp=global_1.RegExp,RegExpPrototype$1=NativeRegExp.prototype,re1=/a/g,re2=/a/g,CORRECT_NEW=new NativeRegExp(re1)!==re1,UNSUPPORTED_Y$2=regexpStickyHelpers.UNSUPPORTED_Y,FORCED$4=descriptors&&isForced_1("RegExp",!CORRECT_NEW||UNSUPPORTED_Y$2||fails((function(){return re2[MATCH$2]=!1,NativeRegExp(re1)!=re1||NativeRegExp(re2)==re2||"/a/i"!=NativeRegExp(re1,"i")})));if(FORCED$4){for(var RegExpWrapper=function(e,t){var n,r=this instanceof RegExpWrapper,i=isRegexp(e),o=void 0===t;if(!r&&i&&e.constructor===RegExpWrapper&&o)return e;CORRECT_NEW?i&&!o&&(e=e.source):e instanceof RegExpWrapper&&(o&&(t=regexpFlags.call(e)),e=e.source),UNSUPPORTED_Y$2&&(n=!!t&&t.indexOf("y")>-1)&&(t=t.replace(/y/g,""));var a=inheritIfRequired(CORRECT_NEW?new NativeRegExp(e,t):NativeRegExp(e,t),r?this:RegExpPrototype$1,RegExpWrapper);return UNSUPPORTED_Y$2&&n&&setInternalState$7(a,{sticky:n}),a},proxy=function(e){e in RegExpWrapper||defineProperty$6(RegExpWrapper,e,{configurable:!0,get:function(){return NativeRegExp[e]},set:function(t){NativeRegExp[e]=t}})},keys$2=getOwnPropertyNames$1(NativeRegExp),index=0;keys$2.length>index;)proxy(keys$2[index++]);RegExpPrototype$1.constructor=RegExpWrapper,RegExpWrapper.prototype=RegExpPrototype$1,redefine(global_1,"RegExp",RegExpWrapper)}function generateId(e){return"".concat(e,"-").concat(Math.floor(1e4*Math.random()))}function format(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return is$1.empty(e)?e:e.toString().replace(/{(\d+)}/g,(function(e,t){return n[t].toString()}))}function getPercentage(e,t){return 0===e||0===t||Number.isNaN(e)||Number.isNaN(t)?0:(e/t*100).toFixed(2)}setSpecies("RegExp");var replaceAll=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return e.replace(new RegExp(t.toString().replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1"),"g"),n.toString())},toTitleCase=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return e.toString().replace(/\w\S*/g,(function(e){return e.charAt(0).toUpperCase()+e.substr(1).toLowerCase()}))};function toPascalCase(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=e.toString();return t=replaceAll(t,"-"," "),t=replaceAll(t,"_"," "),t=toTitleCase(t),replaceAll(t," ","")}function toCamelCase(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=e.toString();return(t=toPascalCase(t)).charAt(0).toLowerCase()+t.slice(1)}function stripHTML(e){var t=document.createDocumentFragment(),n=document.createElement("div");return t.appendChild(n),n.innerHTML=e,t.firstChild.innerText}function getHTML(e){var t=document.createElement("div");return t.appendChild(e),t.innerHTML}var resources={pip:"PIP",airplay:"AirPlay",html5:"HTML5",vimeo:"Vimeo",youtube:"YouTube"},i18n={get:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(is$1.empty(e)||is$1.empty(t))return"";var n=getDeep(t.i18n,e);if(is$1.empty(n))return Object.keys(resources).includes(e)?resources[e]:"";var r={"{seektime}":t.seekTime,"{title}":t.title};return Object.entries(r).forEach((function(e){var t=_slicedToArray(e,2),r=t[0],i=t[1];n=replaceAll(n,r,i)})),n}},Storage=function(){function e(t){_classCallCheck(this,e),this.enabled=t.config.storage.enabled,this.key=t.config.storage.key}return _createClass(e,[{key:"get",value:function(t){if(!e.supported||!this.enabled)return null;var n=window.localStorage.getItem(this.key);if(is$1.empty(n))return null;var r=JSON.parse(n);return is$1.string(t)&&t.length?r[t]:r}},{key:"set",value:function(t){if(e.supported&&this.enabled&&is$1.object(t)){var n=this.get();is$1.empty(n)&&(n={}),extend(n,t),window.localStorage.setItem(this.key,JSON.stringify(n))}}}],[{key:"supported",get:function(){try{if(!("localStorage"in window))return!1;return window.localStorage.setItem("___test","___test"),window.localStorage.removeItem("___test"),!0}catch(e){return!1}}}]),e}();function fetch(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"text";return new Promise((function(n,r){try{var i=new XMLHttpRequest;if(!("withCredentials"in i))return;i.addEventListener("load",(function(){if("text"===t)try{n(JSON.parse(i.responseText))}catch(e){n(i.responseText)}else n(i.response)})),i.addEventListener("error",(function(){throw new Error(i.status)})),i.open("GET",e,!0),i.responseType=t,i.send()}catch(e){r(e)}}))}function loadSprite(e,t){if(is$1.string(e)){var n=is$1.string(t),r=function(){return null!==document.getElementById(t)},i=function(e,t){e.innerHTML=t,n&&r()||document.body.insertAdjacentElement("afterbegin",e)};if(!n||!r()){var o=Storage.supported,a=document.createElement("div");if(a.setAttribute("hidden",""),n&&a.setAttribute("id",t),o){var s=window.localStorage.getItem("".concat("cache","-").concat(t));if(null!==s){var l=JSON.parse(s);i(a,l.content)}}fetch(e).then((function(e){is$1.empty(e)||(o&&window.localStorage.setItem("".concat("cache","-").concat(t),JSON.stringify({content:e})),i(a,e))})).catch((function(){}))}}}var ceil$1=Math.ceil,floor$5=Math.floor;_export({target:"Math",stat:!0},{trunc:function(e){return(e>0?floor$5:ceil$1)(e)}});var getHours=function(e){return Math.trunc(e/60/60%60,10)},getMinutes=function(e){return Math.trunc(e/60%60,10)},getSeconds=function(e){return Math.trunc(e%60,10)};function formatTime(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!is$1.number(e))return formatTime(void 0,t,n);var r=function(e){return"0".concat(e).slice(-2)},i=getHours(e),o=getMinutes(e),a=getSeconds(e);return i=t||i>0?"".concat(i,":"):"","".concat(n&&e>0?"-":"").concat(i).concat(r(o),":").concat(r(a))}var controls={getIconUrl:function(){var e=new URL(this.config.iconUrl,window.location).host!==window.location.host||browser.isIE&&!window.svg4everybody;return{url:this.config.iconUrl,cors:e}},findElements:function(){try{return this.elements.controls=getElement.call(this,this.config.selectors.controls.wrapper),this.elements.buttons={play:getElements.call(this,this.config.selectors.buttons.play),pause:getElement.call(this,this.config.selectors.buttons.pause),restart:getElement.call(this,this.config.selectors.buttons.restart),rewind:getElement.call(this,this.config.selectors.buttons.rewind),fastForward:getElement.call(this,this.config.selectors.buttons.fastForward),mute:getElement.call(this,this.config.selectors.buttons.mute),pip:getElement.call(this,this.config.selectors.buttons.pip),airplay:getElement.call(this,this.config.selectors.buttons.airplay),settings:getElement.call(this,this.config.selectors.buttons.settings),captions:getElement.call(this,this.config.selectors.buttons.captions),fullscreen:getElement.call(this,this.config.selectors.buttons.fullscreen)},this.elements.progress=getElement.call(this,this.config.selectors.progress),this.elements.inputs={seek:getElement.call(this,this.config.selectors.inputs.seek),volume:getElement.call(this,this.config.selectors.inputs.volume)},this.elements.display={buffer:getElement.call(this,this.config.selectors.display.buffer),currentTime:getElement.call(this,this.config.selectors.display.currentTime),duration:getElement.call(this,this.config.selectors.display.duration)},is$1.element(this.elements.progress)&&(this.elements.display.seekTooltip=this.elements.progress.querySelector(".".concat(this.config.classNames.tooltip))),!0}catch(e){return this.debug.warn("It looks like there is a problem with your custom controls HTML",e),this.toggleNativeControls(!0),!1}},createIcon:function(e,t){var n=controls.getIconUrl.call(this),r="".concat(n.cors?"":n.url,"#").concat(this.config.iconPrefix),i=document.createElementNS("http://www.w3.org/2000/svg","svg");setAttributes(i,extend(t,{"aria-hidden":"true",focusable:"false"}));var o=document.createElementNS("http://www.w3.org/2000/svg","use"),a="".concat(r,"-").concat(e);return"href"in o&&o.setAttributeNS("http://www.w3.org/1999/xlink","href",a),o.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a),i.appendChild(o),i},createLabel:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=i18n.get(e,this.config),r=_objectSpread2(_objectSpread2({},t),{},{class:[t.class,this.config.classNames.hidden].filter(Boolean).join(" ")});return createElement("span",r,n)},createBadge:function(e){if(is$1.empty(e))return null;var t=createElement("span",{class:this.config.classNames.menu.value});return t.appendChild(createElement("span",{class:this.config.classNames.menu.badge},e)),t},createButton:function(e,t){var n=this,r=extend({},t),i=toCamelCase(e),o={element:"button",toggle:!1,label:null,icon:null,labelPressed:null,iconPressed:null};switch(["element","icon","label"].forEach((function(e){Object.keys(r).includes(e)&&(o[e]=r[e],delete r[e])})),"button"!==o.element||Object.keys(r).includes("type")||(r.type="button"),Object.keys(r).includes("class")?r.class.split(" ").some((function(e){return e===n.config.classNames.control}))||extend(r,{class:"".concat(r.class," ").concat(this.config.classNames.control)}):r.class=this.config.classNames.control,e){case"play":o.toggle=!0,o.label="play",o.labelPressed="pause",o.icon="play",o.iconPressed="pause";break;case"mute":o.toggle=!0,o.label="mute",o.labelPressed="unmute",o.icon="volume",o.iconPressed="muted";break;case"captions":o.toggle=!0,o.label="enableCaptions",o.labelPressed="disableCaptions",o.icon="captions-off",o.iconPressed="captions-on";break;case"fullscreen":o.toggle=!0,o.label="enterFullscreen",o.labelPressed="exitFullscreen",o.icon="enter-fullscreen",o.iconPressed="exit-fullscreen";break;case"play-large":r.class+=" ".concat(this.config.classNames.control,"--overlaid"),i="play",o.label="play",o.icon="play";break;default:is$1.empty(o.label)&&(o.label=i),is$1.empty(o.icon)&&(o.icon=e)}var a=createElement(o.element);return o.toggle?(a.appendChild(controls.createIcon.call(this,o.iconPressed,{class:"icon--pressed"})),a.appendChild(controls.createIcon.call(this,o.icon,{class:"icon--not-pressed"})),a.appendChild(controls.createLabel.call(this,o.labelPressed,{class:"label--pressed"})),a.appendChild(controls.createLabel.call(this,o.label,{class:"label--not-pressed"}))):(a.appendChild(controls.createIcon.call(this,o.icon)),a.appendChild(controls.createLabel.call(this,o.label))),extend(r,getAttributesFromSelector(this.config.selectors.buttons[i],r)),setAttributes(a,r),"play"===i?(is$1.array(this.elements.buttons[i])||(this.elements.buttons[i]=[]),this.elements.buttons[i].push(a)):this.elements.buttons[i]=a,a},createRange:function(e,t){var n=createElement("input",extend(getAttributesFromSelector(this.config.selectors.inputs[e]),{type:"range",min:0,max:100,step:.01,value:0,autocomplete:"off",role:"slider","aria-label":i18n.get(e,this.config),"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":0},t));return this.elements.inputs[e]=n,controls.updateRangeFill.call(this,n),RangeTouch.setup(n),n},createProgress:function(e,t){var n=createElement("progress",extend(getAttributesFromSelector(this.config.selectors.display[e]),{min:0,max:100,value:0,role:"progressbar","aria-hidden":!0},t));if("volume"!==e){n.appendChild(createElement("span",null,"0"));var r={played:"played",buffer:"buffered"}[e],i=r?i18n.get(r,this.config):"";n.innerText="% ".concat(i.toLowerCase())}return this.elements.display[e]=n,n},createTime:function(e,t){var n=getAttributesFromSelector(this.config.selectors.display[e],t),r=createElement("div",extend(n,{class:"".concat(n.class?n.class:""," ").concat(this.config.classNames.display.time," ").trim(),"aria-label":i18n.get(e,this.config)}),"00:00");return this.elements.display[e]=r,r},bindMenuItemShortcuts:function(e,t){var n=this;on.call(this,e,"keydown keyup",(function(r){if([32,38,39,40].includes(r.which)&&(r.preventDefault(),r.stopPropagation(),"keydown"!==r.type)){var i,o=matches$1(e,'[role="menuitemradio"]');if(!o&&[32,39].includes(r.which))controls.showMenuPanel.call(n,t,!0);else 32!==r.which&&(40===r.which||o&&39===r.which?(i=e.nextElementSibling,is$1.element(i)||(i=e.parentNode.firstElementChild)):(i=e.previousElementSibling,is$1.element(i)||(i=e.parentNode.lastElementChild)),setFocus.call(n,i,!0))}}),!1),on.call(this,e,"keyup",(function(e){13===e.which&&controls.focusFirstMenuItem.call(n,null,!0)}))},createMenuItem:function(e){var t=this,n=e.value,r=e.list,i=e.type,o=e.title,a=e.badge,s=void 0===a?null:a,l=e.checked,c=void 0!==l&&l,u=getAttributesFromSelector(this.config.selectors.inputs[i]),d=createElement("button",extend(u,{type:"button",role:"menuitemradio",class:"".concat(this.config.classNames.control," ").concat(u.class?u.class:"").trim(),"aria-checked":c,value:n})),h=createElement("span");h.innerHTML=o,is$1.element(s)&&h.appendChild(s),d.appendChild(h),Object.defineProperty(d,"checked",{enumerable:!0,get:function(){return"true"===d.getAttribute("aria-checked")},set:function(e){e&&Array.from(d.parentNode.children).filter((function(e){return matches$1(e,'[role="menuitemradio"]')})).forEach((function(e){return e.setAttribute("aria-checked","false")})),d.setAttribute("aria-checked",e?"true":"false")}}),this.listeners.bind(d,"click keyup",(function(e){if(!is$1.keyboardEvent(e)||32===e.which){switch(e.preventDefault(),e.stopPropagation(),d.checked=!0,i){case"language":t.currentTrack=Number(n);break;case"quality":t.quality=n;break;case"speed":t.speed=parseFloat(n)}controls.showMenuPanel.call(t,"home",is$1.keyboardEvent(e))}}),i,!1),controls.bindMenuItemShortcuts.call(this,d,i),r.appendChild(d)},formatTime:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!is$1.number(e))return e;var n=getHours(this.duration)>0;return formatTime(e,n,t)},updateTimeDisplay:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];is$1.element(e)&&is$1.number(t)&&(e.innerText=controls.formatTime(t,n))},updateVolume:function(){this.supported.ui&&(is$1.element(this.elements.inputs.volume)&&controls.setRange.call(this,this.elements.inputs.volume,this.muted?0:this.volume),is$1.element(this.elements.buttons.mute)&&(this.elements.buttons.mute.pressed=this.muted||0===this.volume))},setRange:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;is$1.element(e)&&(e.value=t,controls.updateRangeFill.call(this,e))},updateProgress:function(e){var t=this;if(this.supported.ui&&is$1.event(e)){var n=0;if(e)switch(e.type){case"timeupdate":case"seeking":case"seeked":n=getPercentage(this.currentTime,this.duration),"timeupdate"===e.type&&controls.setRange.call(this,this.elements.inputs.seek,n);break;case"playing":case"progress":!function(e,n){var r=is$1.number(n)?n:0,i=is$1.element(e)?e:t.elements.display.buffer;if(is$1.element(i)){i.value=r;var o=i.getElementsByTagName("span")[0];is$1.element(o)&&(o.childNodes[0].nodeValue=r)}}(this.elements.display.buffer,100*this.buffered)}}},updateRangeFill:function(e){var t=is$1.event(e)?e.target:e;if(is$1.element(t)&&"range"===t.getAttribute("type")){if(matches$1(t,this.config.selectors.inputs.seek)){t.setAttribute("aria-valuenow",this.currentTime);var n=controls.formatTime(this.currentTime),r=controls.formatTime(this.duration),i=i18n.get("seekLabel",this.config);t.setAttribute("aria-valuetext",i.replace("{currentTime}",n).replace("{duration}",r))}else if(matches$1(t,this.config.selectors.inputs.volume)){var o=100*t.value;t.setAttribute("aria-valuenow",o),t.setAttribute("aria-valuetext","".concat(o.toFixed(1),"%"))}else t.setAttribute("aria-valuenow",t.value);browser.isWebkit&&t.style.setProperty("--value","".concat(t.value/t.max*100,"%"))}},updateSeekTooltip:function(e){var t=this;if(this.config.tooltips.seek&&is$1.element(this.elements.inputs.seek)&&is$1.element(this.elements.display.seekTooltip)&&0!==this.duration){var n="".concat(this.config.classNames.tooltip,"--visible"),r=function(e){return toggleClass(t.elements.display.seekTooltip,n,e)};if(this.touch)r(!1);else{var i=0,o=this.elements.progress.getBoundingClientRect();if(is$1.event(e))i=100/o.width*(e.pageX-o.left);else{if(!hasClass(this.elements.display.seekTooltip,n))return;i=parseFloat(this.elements.display.seekTooltip.style.left,10)}i<0?i=0:i>100&&(i=100),controls.updateTimeDisplay.call(this,this.elements.display.seekTooltip,this.duration/100*i),this.elements.display.seekTooltip.style.left="".concat(i,"%"),is$1.event(e)&&["mouseenter","mouseleave"].includes(e.type)&&r("mouseenter"===e.type)}}},timeUpdate:function(e){var t=!is$1.element(this.elements.display.duration)&&this.config.invertTime;controls.updateTimeDisplay.call(this,this.elements.display.currentTime,t?this.duration-this.currentTime:this.currentTime,t),e&&"timeupdate"===e.type&&this.media.seeking||controls.updateProgress.call(this,e)},durationUpdate:function(){if(this.supported.ui&&(this.config.invertTime||!this.currentTime)){if(this.duration>=Math.pow(2,32))return toggleHidden(this.elements.display.currentTime,!0),void toggleHidden(this.elements.progress,!0);is$1.element(this.elements.inputs.seek)&&this.elements.inputs.seek.setAttribute("aria-valuemax",this.duration);var e=is$1.element(this.elements.display.duration);!e&&this.config.displayDuration&&this.paused&&controls.updateTimeDisplay.call(this,this.elements.display.currentTime,this.duration),e&&controls.updateTimeDisplay.call(this,this.elements.display.duration,this.duration),controls.updateSeekTooltip.call(this)}},toggleMenuButton:function(e,t){toggleHidden(this.elements.settings.buttons[e],!t)},updateSetting:function(e,t,n){var r=this.elements.settings.panels[e],i=null,o=t;if("captions"===e)i=this.currentTrack;else{if(i=is$1.empty(n)?this[e]:n,is$1.empty(i)&&(i=this.config[e].default),!is$1.empty(this.options[e])&&!this.options[e].includes(i))return void this.debug.warn("Unsupported value of '".concat(i,"' for ").concat(e));if(!this.config[e].options.includes(i))return void this.debug.warn("Disabled value of '".concat(i,"' for ").concat(e))}if(is$1.element(o)||(o=r&&r.querySelector('[role="menu"]')),is$1.element(o)){this.elements.settings.buttons[e].querySelector(".".concat(this.config.classNames.menu.value)).innerHTML=controls.getLabel.call(this,e,i);var a=o&&o.querySelector('[value="'.concat(i,'"]'));is$1.element(a)&&(a.checked=!0)}},getLabel:function(e,t){switch(e){case"speed":return 1===t?i18n.get("normal",this.config):"".concat(t,"&times;");case"quality":if(is$1.number(t)){var n=i18n.get("qualityLabel.".concat(t),this.config);return n.length?n:"".concat(t,"p")}return toTitleCase(t);case"captions":return captions.getLabel.call(this);default:return null}},setQualityMenu:function(e){var t=this;if(is$1.element(this.elements.settings.panels.quality)){var n=this.elements.settings.panels.quality.querySelector('[role="menu"]');is$1.array(e)&&(this.options.quality=dedupe(e).filter((function(e){return t.config.quality.options.includes(e)})));var r=!is$1.empty(this.options.quality)&&this.options.quality.length>1;if(controls.toggleMenuButton.call(this,"quality",r),emptyElement(n),controls.checkMenu.call(this),r){var i=function(e){var n=i18n.get("qualityBadge.".concat(e),t.config);return n.length?controls.createBadge.call(t,n):null};this.options.quality.sort((function(e,n){var r=t.config.quality.options;return r.indexOf(e)>r.indexOf(n)?1:-1})).forEach((function(e){controls.createMenuItem.call(t,{value:e,list:n,type:"quality",title:controls.getLabel.call(t,"quality",e),badge:i(e)})})),controls.updateSetting.call(this,"quality",n)}}},setCaptionsMenu:function(){var e=this;if(is$1.element(this.elements.settings.panels.captions)){var t=this.elements.settings.panels.captions.querySelector('[role="menucaptions"]'),n=captions.getTracks.call(this),r=Boolean(n.length);if(controls.toggleMenuButton.call(this,"captions",r),emptyElement(t),controls.checkMenu.call(this),r){var i=n.map((function(n,r){return{value:r,checked:e.captions.toggled&&e.currentTrack===r,title:captions.getLabel.call(e,n),badge:n.language&&controls.createBadge.call(e,n.language.toUpperCase()),list:t,type:"language"}}));i.unshift({value:-1,checked:!this.captions.toggled,title:i18n.get("disabled",this.config),list:t,type:"language"}),i.forEach(controls.createMenuItem.bind(this)),controls.updateSetting.call(this,"captions",t)}}},setSpeedMenu:function(){var e=this;if(is$1.element(this.elements.settings.panels.speed)){var t=this.elements.settings.panels.speed.querySelector('[role="menu"]');this.options.speed=this.options.speed.filter((function(t){return t>=e.minimumSpeed&&t<=e.maximumSpeed}));var n=!is$1.empty(this.options.speed)&&this.options.speed.length>1;controls.toggleMenuButton.call(this,"speed",n),emptyElement(t),controls.checkMenu.call(this),n&&(this.options.speed.forEach((function(n){controls.createMenuItem.call(e,{value:n,list:t,type:"speed",title:controls.getLabel.call(e,"speed",n)})})),controls.updateSetting.call(this,"speed",t))}},checkMenu:function(){var e=this.elements.settings.buttons,t=!is$1.empty(e)&&Object.values(e).some((function(e){return!e.hidden}));toggleHidden(this.elements.settings.menu,!t)},focusFirstMenuItem:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!this.elements.settings.popup.hidden){var n=e;is$1.element(n)||(n=Object.values(this.elements.settings.panels).find((function(e){return!e.hidden})));var r=n.querySelector('[role^="menuitem"]');setFocus.call(this,r,t)}},toggleMenu:function(e){var t=this.elements.settings.popup,n=this.elements.buttons.settings;if(is$1.element(t)&&is$1.element(n)){var r=t.hidden,i=r;if(is$1.boolean(e))i=e;else if(is$1.keyboardEvent(e)&&27===e.which)i=!1;else if(is$1.event(e)){var o=is$1.function(e.composedPath)?e.composedPath()[0]:e.target,a=t.contains(o);if(a||!a&&e.target!==n&&i)return}n.setAttribute("aria-expanded",i),toggleHidden(t,!i),toggleClass(this.elements.container,this.config.classNames.menu.open,i),i&&is$1.keyboardEvent(e)?controls.focusFirstMenuItem.call(this,null,!0):i||r||setFocus.call(this,n,is$1.keyboardEvent(e))}},getMenuSize:function(e){var t=e.cloneNode(!0);t.style.position="absolute",t.style.opacity=0,t.removeAttribute("hidden"),e.parentNode.appendChild(t);var n=t.scrollWidth,r=t.scrollHeight;return removeElement(t),{width:n,height:r}},showMenuPanel:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=this.elements.container.querySelector("#plyr-settings-".concat(this.id,"-").concat(t));if(is$1.element(r)){var i=r.parentNode,o=Array.from(i.children).find((function(e){return!e.hidden}));if(support.transitions&&!support.reducedMotion){i.style.width="".concat(o.scrollWidth,"px"),i.style.height="".concat(o.scrollHeight,"px");var a=controls.getMenuSize.call(this,r),s=function t(n){n.target===i&&["width","height"].includes(n.propertyName)&&(i.style.width="",i.style.height="",off.call(e,i,transitionEndEvent,t))};on.call(this,i,transitionEndEvent,s),i.style.width="".concat(a.width,"px"),i.style.height="".concat(a.height,"px")}toggleHidden(o,!0),toggleHidden(r,!1),controls.focusFirstMenuItem.call(this,r,n)}},setDownloadUrl:function(){var e=this.elements.buttons.download;is$1.element(e)&&e.setAttribute("href",this.download)},create:function(e){var t=this,n=controls.bindMenuItemShortcuts,r=controls.createButton,i=controls.createProgress,o=controls.createRange,a=controls.createTime,s=controls.setQualityMenu,l=controls.setSpeedMenu,c=controls.showMenuPanel;this.elements.controls=null,is$1.array(this.config.controls)&&this.config.controls.includes("play-large")&&this.elements.container.appendChild(r.call(this,"play-large"));var u=createElement("div",getAttributesFromSelector(this.config.selectors.controls.wrapper));this.elements.controls=u;var d={class:"plyr__controls__item"};return dedupe(is$1.array(this.config.controls)?this.config.controls:[]).forEach((function(s){if("restart"===s&&u.appendChild(r.call(t,"restart",d)),"rewind"===s&&u.appendChild(r.call(t,"rewind",d)),"play"===s&&u.appendChild(r.call(t,"play",d)),"fast-forward"===s&&u.appendChild(r.call(t,"fast-forward",d)),"progress"===s){var l=createElement("div",{class:"".concat(d.class," plyr__progress__container")}),h=createElement("div",getAttributesFromSelector(t.config.selectors.progress));if(h.appendChild(o.call(t,"seek",{id:"plyr-seek-".concat(e.id)})),h.appendChild(i.call(t,"buffer")),t.config.tooltips.seek){var p=createElement("span",{class:t.config.classNames.tooltip},"00:00");h.appendChild(p),t.elements.display.seekTooltip=p}t.elements.progress=h,l.appendChild(t.elements.progress),u.appendChild(l)}if("current-time"===s&&u.appendChild(a.call(t,"currentTime",d)),"duration"===s&&u.appendChild(a.call(t,"duration",d)),"mute"===s||"volume"===s){var f=t.elements.volume;if(is$1.element(f)&&u.contains(f)||(f=createElement("div",extend({},d,{class:"".concat(d.class," plyr__volume").trim()})),t.elements.volume=f,u.appendChild(f)),"mute"===s&&f.appendChild(r.call(t,"mute")),"volume"===s&&!browser.isIos){var m={max:1,step:.05,value:t.config.volume};f.appendChild(o.call(t,"volume",extend(m,{id:"plyr-volume-".concat(e.id)})))}}if("captions"===s&&u.appendChild(r.call(t,"captions",d)),"settings"===s&&!is$1.empty(t.config.settings)){var g=createElement("div",extend({},d,{class:"".concat(d.class," plyr__menu").trim(),hidden:""}));g.appendChild(r.call(t,"settings",{"aria-haspopup":!0,"aria-controls":"plyr-settings-".concat(e.id),"aria-expanded":!1}));var y=createElement("div",{class:"plyr__menu__container",id:"plyr-settings-".concat(e.id),hidden:""}),b=createElement("div"),v=createElement("div",{id:"plyr-settings-".concat(e.id,"-home")}),E=createElement("div",{role:"menu"});v.appendChild(E),b.appendChild(v),t.elements.settings.panels.home=v,t.config.settings.forEach((function(r){var i=createElement("button",extend(getAttributesFromSelector(t.config.selectors.buttons.settings),{type:"button",class:"".concat(t.config.classNames.control," ").concat(t.config.classNames.control,"--forward"),role:"menuitem","aria-haspopup":!0,hidden:""}));n.call(t,i,r),on.call(t,i,"click",(function(){c.call(t,r,!1)}));var o=createElement("span",null,i18n.get(r,t.config)),a=createElement("span",{class:t.config.classNames.menu.value});a.innerHTML=e[r],o.appendChild(a),i.appendChild(o),E.appendChild(i);var s=createElement("div",{id:"plyr-settings-".concat(e.id,"-").concat(r),hidden:""}),l=createElement("button",{type:"button",class:"".concat(t.config.classNames.control," ").concat(t.config.classNames.control,"--back")});l.appendChild(createElement("span",{"aria-hidden":!0},i18n.get(r,t.config))),l.appendChild(createElement("span",{class:t.config.classNames.hidden},i18n.get("menuBack",t.config))),on.call(t,s,"keydown",(function(e){37===e.which&&(e.preventDefault(),e.stopPropagation(),c.call(t,"home",!0))}),!1),on.call(t,l,"click",(function(){c.call(t,"home",!1)})),s.appendChild(l),s.appendChild(createElement("div",{role:"menu"})),s.appendChild(createElement("div",{role:"menucaptions"})),b.appendChild(s),t.elements.settings.buttons[r]=i,t.elements.settings.panels[r]=s})),y.appendChild(b),g.appendChild(y),u.appendChild(g),t.elements.settings.popup=y,t.elements.settings.menu=g}if("pip"===s&&support.pip&&u.appendChild(r.call(t,"pip",d)),"airplay"===s&&support.airplay&&u.appendChild(r.call(t,"airplay",d)),"download"===s){var S=extend({},d,{element:"a",href:t.download,target:"_blank"});t.isHTML5&&(S.download="");var T=t.config.urls.download;!is$1.url(T)&&t.isEmbed&&extend(S,{icon:"logo-".concat(t.provider),label:t.provider}),u.appendChild(r.call(t,"download",S))}"fullscreen"===s&&u.appendChild(r.call(t,"fullscreen",d))})),this.isHTML5&&s.call(this,html5.getQualityOptions.call(this)),l.call(this),u},inject:function(){var e=this;if(this.config.loadSprite){var t=controls.getIconUrl.call(this);t.cors&&loadSprite(t.url,"sprite-plyr")}this.id=Math.floor(1e4*Math.random());var n=null;this.elements.controls=null;var r={id:this.id,seektime:this.config.seekTime,title:this.config.title},i=!0;is$1.function(this.config.controls)&&(this.config.controls=this.config.controls.call(this,r)),this.config.controls||(this.config.controls=[]),is$1.element(this.config.controls)||is$1.string(this.config.controls)?n=this.config.controls:(n=controls.create.call(this,{id:this.id,seektime:this.config.seekTime,speed:this.speed,quality:this.quality,captions:captions.getLabel.call(this)}),i=!1);var o,a;if(i&&is$1.string(this.config.controls)&&(o=n,Object.entries(r).forEach((function(e){var t=_slicedToArray(e,2),n=t[0],r=t[1];o=replaceAll(o,"{".concat(n,"}"),r)})),n=o),is$1.string(this.config.selectors.controls.container)&&(a=document.querySelector(this.config.selectors.controls.container)),is$1.element(a)||(a=this.elements.container),a[is$1.element(n)?"insertAdjacentElement":"insertAdjacentHTML"]("afterbegin",n),is$1.element(this.elements.controls)||controls.findElements.call(this),!is$1.empty(this.elements.buttons)){var s=function(t){var n=e.config.classNames.controlPressed;Object.defineProperty(t,"pressed",{enumerable:!0,get:function(){return hasClass(t,n)},set:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];toggleClass(t,n,e)}})};Object.values(this.elements.buttons).filter(Boolean).forEach((function(e){is$1.array(e)||is$1.nodeList(e)?Array.from(e).filter(Boolean).forEach(s):s(e)}))}if(browser.isEdge&&repaint(a),this.config.tooltips.controls){var l=this.config,c=l.classNames,u=l.selectors,d="".concat(u.controls.wrapper," ").concat(u.labels," .").concat(c.hidden),h=getElements.call(this,d);Array.from(h).forEach((function(t){toggleClass(t,e.config.classNames.hidden,!1),toggleClass(t,e.config.classNames.tooltip,!0)}))}}};function parseUrl(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=e;if(t){var r=document.createElement("a");r.href=n,n=r.href}try{return new URL(n)}catch(e){return null}}function buildUrlParams(e){var t=new URLSearchParams;return is$1.object(e)&&Object.entries(e).forEach((function(e){var n=_slicedToArray(e,2),r=n[0],i=n[1];t.set(r,i)})),t}var captions={setup:function(){if(this.supported.ui)if(!this.isVideo||this.isYouTube||this.isHTML5&&!support.textTracks)is$1.array(this.config.controls)&&this.config.controls.includes("settings")&&this.config.settings.includes("captions")&&controls.setCaptionsMenu.call(this);else{if(is$1.element(this.elements.captions)||(this.elements.captions=createElement("div",getAttributesFromSelector(this.config.selectors.captions)),insertAfter(this.elements.captions,this.elements.wrapper)),browser.isIE&&window.URL){var e=this.media.querySelectorAll("track");Array.from(e).forEach((function(e){var t=e.getAttribute("src"),n=parseUrl(t);null!==n&&n.hostname!==window.location.href.hostname&&["http:","https:"].includes(n.protocol)&&fetch(t,"blob").then((function(t){e.setAttribute("src",window.URL.createObjectURL(t))})).catch((function(){removeElement(e)}))}))}var t=dedupe((navigator.languages||[navigator.language||navigator.userLanguage||"en"]).map((function(e){return e.split("-")[0]}))),n=(this.storage.get("language")||this.config.captions.language||"auto").toLowerCase();if("auto"===n)n=_slicedToArray(t,1)[0];var r=this.storage.get("captions");if(is$1.boolean(r)||(r=this.config.captions.active),Object.assign(this.captions,{toggled:!1,active:r,language:n,languages:t}),this.isHTML5){var i=this.config.captions.update?"addtrack removetrack":"removetrack";on.call(this,this.media.textTracks,i,captions.update.bind(this))}setTimeout(captions.update.bind(this),0)}},update:function(){var e=this,t=captions.getTracks.call(this,!0),n=this.captions,r=n.active,i=n.language,o=n.meta,a=n.currentTrackNode,s=Boolean(t.find((function(e){return e.language===i})));this.isHTML5&&this.isVideo&&t.filter((function(e){return!o.get(e)})).forEach((function(t){e.debug.log("Track added",t),o.set(t,{default:"showing"===t.mode}),"showing"===t.mode&&(t.mode="hidden"),on.call(e,t,"cuechange",(function(){return captions.updateCues.call(e)}))})),(s&&this.language!==i||!t.includes(a))&&(captions.setLanguage.call(this,i),captions.toggle.call(this,r&&s)),toggleClass(this.elements.container,this.config.classNames.captions.enabled,!is$1.empty(t)),is$1.array(this.config.controls)&&this.config.controls.includes("settings")&&this.config.settings.includes("captions")&&controls.setCaptionsMenu.call(this)},toggle:function(e){var t=this,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.supported.ui){var r=this.captions.toggled,i=this.config.classNames.captions.active,o=is$1.nullOrUndefined(e)?!r:e;if(o!==r){if(n||(this.captions.active=o,this.storage.set({captions:o})),!this.language&&o&&!n){var a=captions.getTracks.call(this),s=captions.findTrack.call(this,[this.captions.language].concat(_toConsumableArray(this.captions.languages)),!0);return this.captions.language=s.language,void captions.set.call(this,a.indexOf(s))}this.elements.buttons.captions&&(this.elements.buttons.captions.pressed=o),toggleClass(this.elements.container,i,o),this.captions.toggled=o,controls.updateSetting.call(this,"captions"),triggerEvent.call(this,this.media,o?"captionsenabled":"captionsdisabled")}setTimeout((function(){o&&t.captions.toggled&&(t.captions.currentTrackNode.mode="hidden")}))}},set:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=captions.getTracks.call(this);if(-1!==e)if(is$1.number(e))if(e in n){if(this.captions.currentTrack!==e){this.captions.currentTrack=e;var r=n[e],i=r||{},o=i.language;this.captions.currentTrackNode=r,controls.updateSetting.call(this,"captions"),t||(this.captions.language=o,this.storage.set({language:o})),this.isVimeo&&this.embed.enableTextTrack(o),triggerEvent.call(this,this.media,"languagechange")}captions.toggle.call(this,!0,t),this.isHTML5&&this.isVideo&&captions.updateCues.call(this)}else this.debug.warn("Track not found",e);else this.debug.warn("Invalid caption argument",e);else captions.toggle.call(this,!1,t)},setLanguage:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(is$1.string(e)){var n=e.toLowerCase();this.captions.language=n;var r=captions.getTracks.call(this),i=captions.findTrack.call(this,[n]);captions.set.call(this,r.indexOf(i),t)}else this.debug.warn("Invalid language argument",e)},getTracks:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],n=Array.from((this.media||{}).textTracks||[]);return n.filter((function(n){return!e.isHTML5||t||e.captions.meta.has(n)})).filter((function(e){return["captions","subtitles"].includes(e.kind)}))},findTrack:function(e){var t,n=this,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=captions.getTracks.call(this),o=function(e){return Number((n.captions.meta.get(e)||{}).default)},a=Array.from(i).sort((function(e,t){return o(t)-o(e)}));return e.every((function(e){return!(t=a.find((function(t){return t.language===e})))})),t||(r?a[0]:void 0)},getCurrentTrack:function(){return captions.getTracks.call(this)[this.currentTrack]},getLabel:function(e){var t=e;return!is$1.track(t)&&support.textTracks&&this.captions.toggled&&(t=captions.getCurrentTrack.call(this)),is$1.track(t)?is$1.empty(t.label)?is$1.empty(t.language)?i18n.get("enabled",this.config):e.language.toUpperCase():t.label:i18n.get("disabled",this.config)},updateCues:function(e){if(this.supported.ui)if(is$1.element(this.elements.captions))if(is$1.nullOrUndefined(e)||Array.isArray(e)){var t=e;if(!t){var n=captions.getCurrentTrack.call(this);t=Array.from((n||{}).activeCues||[]).map((function(e){return e.getCueAsHTML()})).map(getHTML)}var r=t.map((function(e){return e.trim()})).join("\n");if(r!==this.elements.captions.innerHTML){emptyElement(this.elements.captions);var i=createElement("span",getAttributesFromSelector(this.config.selectors.caption));i.innerHTML=r,this.elements.captions.appendChild(i),triggerEvent.call(this,this.media,"cuechange")}}else this.debug.warn("updateCues: Invalid input",e);else this.debug.warn("No captions element to render to")}},defaults$1={enabled:!0,title:"",debug:!1,autoplay:!1,autopause:!0,playsinline:!0,seekTime:10,volume:1,muted:!1,duration:null,displayDuration:!0,invertTime:!0,toggleInvert:!0,ratio:null,clickToPlay:!0,hideControls:!0,resetOnEnd:!1,disableContextMenu:!0,loadSprite:!0,iconPrefix:"plyr",iconUrl:"/theme/modules/plyr/plyr.svg",blankVideo:"/theme/modules/plyr/blank.webm",quality:{default:576,options:[4320,2880,2160,1440,1080,720,576,480,360,240],forced:!1,onChange:null},loop:{active:!1},speed:{selected:1,options:[.5,.75,1,1.25,1.5,1.75,2,4]},keyboard:{focused:!0,global:!1},tooltips:{controls:!1,seek:!0},captions:{active:!1,language:"auto",update:!1},fullscreen:{enabled:!0,fallback:!0,iosNative:!1},storage:{enabled:!0,key:"plyr"},controls:["play-large","play","progress","current-time","mute","volume","captions","settings","pip","airplay","fullscreen"],settings:["captions","quality","speed"],i18n:{restart:"Restart",rewind:"Rewind {seektime}s",play:"Play",pause:"Pause",fastForward:"Forward {seektime}s",seek:"Seek",seekLabel:"{currentTime} of {duration}",played:"Played",buffered:"Buffered",currentTime:"Current time",duration:"Duration",volume:"Volume",mute:"Mute",unmute:"Unmute",enableCaptions:"Enable captions",disableCaptions:"Disable captions",download:"Download",enterFullscreen:"Enter fullscreen",exitFullscreen:"Exit fullscreen",frameTitle:"Player for {title}",captions:"Captions",settings:"Settings",pip:"PIP",menuBack:"Go back to previous menu",speed:"Speed",normal:"Normal",quality:"Quality",loop:"Loop",start:"Start",end:"End",all:"All",reset:"Reset",disabled:"Disabled",enabled:"Enabled",advertisement:"Ad",qualityBadge:{2160:"4K",1440:"HD",1080:"HD",720:"HD",576:"SD",480:"SD"}},urls:{download:null,vimeo:{sdk:"https://player.vimeo.com/api/player.js",iframe:"https://player.vimeo.com/video/{0}?{1}",api:"https://vimeo.com/api/v2/video/{0}.json"},youtube:{sdk:"https://www.youtube.com/iframe_api",api:"https://noembed.com/embed?url=https://www.youtube.com/watch?v={0}"},googleIMA:{sdk:"https://imasdk.googleapis.com/js/sdkloader/ima3.js"}},listeners:{seek:null,play:null,pause:null,restart:null,rewind:null,fastForward:null,mute:null,volume:null,captions:null,download:null,fullscreen:null,pip:null,airplay:null,speed:null,quality:null,loop:null,language:null},events:["ended","progress","stalled","playing","waiting","canplay","canplaythrough","loadstart","loadeddata","loadedmetadata","timeupdate","volumechange","play","pause","error","seeking","seeked","emptied","ratechange","cuechange","download","enterfullscreen","exitfullscreen","captionsenabled","captionsdisabled","languagechange","controlshidden","controlsshown","ready","statechange","qualitychange","adsloaded","adscontentpause","adscontentresume","adstarted","adsmidpoint","adscomplete","adsallcomplete","adsimpression","adsclick"],selectors:{editable:"input, textarea, select, [contenteditable]",container:".plyr",controls:{container:null,wrapper:".plyr__controls"},labels:"[data-plyr]",buttons:{play:'[data-plyr="play"]',pause:'[data-plyr="pause"]',restart:'[data-plyr="restart"]',rewind:'[data-plyr="rewind"]',fastForward:'[data-plyr="fast-forward"]',mute:'[data-plyr="mute"]',captions:'[data-plyr="captions"]',download:'[data-plyr="download"]',fullscreen:'[data-plyr="fullscreen"]',pip:'[data-plyr="pip"]',airplay:'[data-plyr="airplay"]',settings:'[data-plyr="settings"]',loop:'[data-plyr="loop"]'},inputs:{seek:'[data-plyr="seek"]',volume:'[data-plyr="volume"]',speed:'[data-plyr="speed"]',language:'[data-plyr="language"]',quality:'[data-plyr="quality"]'},display:{currentTime:".plyr__time--current",duration:".plyr__time--duration",buffer:".plyr__progress__buffer",loop:".plyr__progress__loop",volume:".plyr__volume--display"},progress:".plyr__progress",captions:".plyr__captions",caption:".plyr__caption"},classNames:{type:"plyr--{0}",provider:"plyr--{0}",video:"plyr__video-wrapper",embed:"plyr__video-embed",videoFixedRatio:"plyr__video-wrapper--fixed-ratio",embedContainer:"plyr__video-embed__container",poster:"plyr__poster",posterEnabled:"plyr__poster-enabled",ads:"plyr__ads",control:"plyr__control",controlPressed:"plyr__control--pressed",playing:"plyr--playing",paused:"plyr--paused",stopped:"plyr--stopped",loading:"plyr--loading",hover:"plyr--hover",tooltip:"plyr__tooltip",cues:"plyr__cues",hidden:"plyr__sr-only",hideControls:"plyr--hide-controls",isIos:"plyr--is-ios",isTouch:"plyr--is-touch",uiSupported:"plyr--full-ui",noTransition:"plyr--no-transition",display:{time:"plyr__time"},menu:{value:"plyr__menu__value",badge:"plyr__badge",open:"plyr--menu-open"},captions:{enabled:"plyr--captions-enabled",active:"plyr--captions-active"},fullscreen:{enabled:"plyr--fullscreen-enabled",fallback:"plyr--fullscreen-fallback"},pip:{supported:"plyr--pip-supported",active:"plyr--pip-active"},airplay:{supported:"plyr--airplay-supported",active:"plyr--airplay-active"},tabFocus:"plyr__tab-focus",previewThumbnails:{thumbContainer:"plyr__preview-thumb",thumbContainerShown:"plyr__preview-thumb--is-shown",imageContainer:"plyr__preview-thumb__image-container",timeContainer:"plyr__preview-thumb__time-container",scrubbingContainer:"plyr__preview-scrubbing",scrubbingContainerShown:"plyr__preview-scrubbing--is-shown"}},attributes:{embed:{provider:"data-plyr-provider",id:"data-plyr-embed-id"}},ads:{enabled:!1,publisherId:"",tagUrl:""},previewThumbnails:{enabled:!1,src:""},vimeo:{byline:!1,portrait:!1,title:!1,speed:!0,transparent:!1,premium:!1,referrerPolicy:null},youtube:{noCookie:!0,rel:0,showinfo:0,iv_load_policy:3,modestbranding:1}},pip={active:"picture-in-picture",inactive:"inline"},providers={html5:"html5",youtube:"youtube",vimeo:"vimeo"},types={audio:"audio",video:"video"};function getProviderByUrl(e){return/^(https?:\/\/)?(www\.)?(youtube\.com|youtube-nocookie\.com|youtu\.?be)\/.+$/.test(e)?providers.youtube:/^https?:\/\/player.vimeo.com\/video\/\d{0,9}(?=\b|\/)/.test(e)?providers.vimeo:null}var noop=function(){},Console=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];_classCallCheck(this,e),this.enabled=window.console&&t,this.enabled&&this.log("Debugging enabled")}return _createClass(e,[{key:"log",get:function(){return this.enabled?Function.prototype.bind.call(console.log,console):noop}},{key:"warn",get:function(){return this.enabled?Function.prototype.bind.call(console.warn,console):noop}},{key:"error",get:function(){return this.enabled?Function.prototype.bind.call(console.error,console):noop}}]),e}(),Fullscreen=function(){function e(t){var n=this;_classCallCheck(this,e),this.player=t,this.prefix=e.prefix,this.property=e.property,this.scrollPosition={x:0,y:0},this.forceFallback="force"===t.config.fullscreen.fallback,this.player.elements.fullscreen=t.config.fullscreen.container&&closest(this.player.elements.container,t.config.fullscreen.container),on.call(this.player,document,"ms"===this.prefix?"MSFullscreenChange":"".concat(this.prefix,"fullscreenchange"),(function(){n.onChange()})),on.call(this.player,this.player.elements.container,"dblclick",(function(e){is$1.element(n.player.elements.controls)&&n.player.elements.controls.contains(e.target)||n.toggle()})),on.call(this,this.player.elements.container,"keydown",(function(e){return n.trapFocus(e)})),this.update()}return _createClass(e,[{key:"onChange",value:function(){if(this.enabled){var e=this.player.elements.buttons.fullscreen;is$1.element(e)&&(e.pressed=this.active),triggerEvent.call(this.player,this.target,this.active?"enterfullscreen":"exitfullscreen",!0)}}},{key:"toggleFallback",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(e?this.scrollPosition={x:window.scrollX||0,y:window.scrollY||0}:window.scrollTo(this.scrollPosition.x,this.scrollPosition.y),document.body.style.overflow=e?"hidden":"",toggleClass(this.target,this.player.config.classNames.fullscreen.fallback,e),browser.isIos){var t=document.head.querySelector('meta[name="viewport"]'),n="viewport-fit=cover";t||(t=document.createElement("meta")).setAttribute("name","viewport");var r=is$1.string(t.content)&&t.content.includes(n);e?(this.cleanupViewport=!r,r||(t.content+=",".concat(n))):this.cleanupViewport&&(t.content=t.content.split(",").filter((function(e){return e.trim()!==n})).join(","))}this.onChange()}},{key:"trapFocus",value:function(e){if(!browser.isIos&&this.active&&"Tab"===e.key&&9===e.keyCode){var t=document.activeElement,n=getElements.call(this.player,"a[href], button:not(:disabled), input:not(:disabled), [tabindex]"),r=_slicedToArray(n,1)[0],i=n[n.length-1];t!==i||e.shiftKey?t===r&&e.shiftKey&&(i.focus(),e.preventDefault()):(r.focus(),e.preventDefault())}}},{key:"update",value:function(){var t;this.enabled?(t=this.forceFallback?"Fallback (forced)":e.native?"Native":"Fallback",this.player.debug.log("".concat(t," fullscreen enabled"))):this.player.debug.log("Fullscreen not supported and fallback disabled");toggleClass(this.player.elements.container,this.player.config.classNames.fullscreen.enabled,this.enabled)}},{key:"enter",value:function(){this.enabled&&(browser.isIos&&this.player.config.fullscreen.iosNative?this.target.webkitEnterFullscreen():!e.native||this.forceFallback?this.toggleFallback(!0):this.prefix?is$1.empty(this.prefix)||this.target["".concat(this.prefix,"Request").concat(this.property)]():this.target.requestFullscreen({navigationUI:"hide"}))}},{key:"exit",value:function(){if(this.enabled)if(browser.isIos&&this.player.config.fullscreen.iosNative)this.target.webkitExitFullscreen(),silencePromise(this.player.play());else if(!e.native||this.forceFallback)this.toggleFallback(!1);else if(this.prefix){if(!is$1.empty(this.prefix)){var t="moz"===this.prefix?"Cancel":"Exit";document["".concat(this.prefix).concat(t).concat(this.property)]()}}else(document.cancelFullScreen||document.exitFullscreen).call(document)}},{key:"toggle",value:function(){this.active?this.exit():this.enter()}},{key:"usingNative",get:function(){return e.native&&!this.forceFallback}},{key:"enabled",get:function(){return(e.native||this.player.config.fullscreen.fallback)&&this.player.config.fullscreen.enabled&&this.player.supported.ui&&this.player.isVideo}},{key:"active",get:function(){if(!this.enabled)return!1;if(!e.native||this.forceFallback)return hasClass(this.target,this.player.config.classNames.fullscreen.fallback);var t=this.prefix?document["".concat(this.prefix).concat(this.property,"Element")]:document.fullscreenElement;return t&&t.shadowRoot?t===this.target.getRootNode().host:t===this.target}},{key:"target",get:function(){return browser.isIos&&this.player.config.fullscreen.iosNative?this.player.media:this.player.elements.fullscreen||this.player.elements.container}}],[{key:"native",get:function(){return!!(document.fullscreenEnabled||document.webkitFullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled)}},{key:"prefix",get:function(){if(is$1.function(document.exitFullscreen))return"";var e="";return["webkit","moz","ms"].some((function(t){return!(!is$1.function(document["".concat(t,"ExitFullscreen")])&&!is$1.function(document["".concat(t,"CancelFullScreen")]))&&(e=t,!0)})),e}},{key:"property",get:function(){return"moz"===this.prefix?"FullScreen":"Fullscreen"}}]),e}(),mathSign=Math.sign||function(e){return 0==(e=+e)||e!=e?e:e<0?-1:1};function loadImage(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return new Promise((function(n,r){var i=new Image,o=function(){delete i.onload,delete i.onerror,(i.naturalWidth>=t?n:r)(i)};Object.assign(i,{onload:o,onerror:o,src:e})}))}_export({target:"Math",stat:!0},{sign:mathSign});var ui={addStyleHook:function(){toggleClass(this.elements.container,this.config.selectors.container.replace(".",""),!0),toggleClass(this.elements.container,this.config.classNames.uiSupported,this.supported.ui)},toggleNativeControls:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];e&&this.isHTML5?this.media.setAttribute("controls",""):this.media.removeAttribute("controls")},build:function(){var e=this;if(this.listeners.media(),!this.supported.ui)return this.debug.warn("Basic support only for ".concat(this.provider," ").concat(this.type)),void ui.toggleNativeControls.call(this,!0);is$1.element(this.elements.controls)||(controls.inject.call(this),this.listeners.controls()),ui.toggleNativeControls.call(this),this.isHTML5&&captions.setup.call(this),this.volume=null,this.muted=null,this.loop=null,this.quality=null,this.speed=null,controls.updateVolume.call(this),controls.timeUpdate.call(this),ui.checkPlaying.call(this),toggleClass(this.elements.container,this.config.classNames.pip.supported,support.pip&&this.isHTML5&&this.isVideo),toggleClass(this.elements.container,this.config.classNames.airplay.supported,support.airplay&&this.isHTML5),toggleClass(this.elements.container,this.config.classNames.isIos,browser.isIos),toggleClass(this.elements.container,this.config.classNames.isTouch,this.touch),this.ready=!0,setTimeout((function(){triggerEvent.call(e,e.media,"ready")}),0),ui.setTitle.call(this),this.poster&&ui.setPoster.call(this,this.poster,!1).catch((function(){})),this.config.duration&&controls.durationUpdate.call(this)},setTitle:function(){var e=i18n.get("play",this.config);if(is$1.string(this.config.title)&&!is$1.empty(this.config.title)&&(e+=", ".concat(this.config.title)),Array.from(this.elements.buttons.play||[]).forEach((function(t){t.setAttribute("aria-label",e)})),this.isEmbed){var t=getElement.call(this,"iframe");if(!is$1.element(t))return;var n=is$1.empty(this.config.title)?"video":this.config.title,r=i18n.get("frameTitle",this.config);t.setAttribute("title",r.replace("{title}",n))}},togglePoster:function(e){toggleClass(this.elements.container,this.config.classNames.posterEnabled,e)},setPoster:function(e){var t=this,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return n&&this.poster?Promise.reject(new Error("Poster already set")):(this.media.setAttribute("data-poster",e),ready.call(this).then((function(){return loadImage(e)})).catch((function(n){throw e===t.poster&&ui.togglePoster.call(t,!1),n})).then((function(){if(e!==t.poster)throw new Error("setPoster cancelled by later call to setPoster")})).then((function(){return Object.assign(t.elements.poster.style,{backgroundImage:"url('".concat(e,"')"),backgroundSize:""}),ui.togglePoster.call(t,!0),e})))},checkPlaying:function(e){var t=this;toggleClass(this.elements.container,this.config.classNames.playing,this.playing),toggleClass(this.elements.container,this.config.classNames.paused,this.paused),toggleClass(this.elements.container,this.config.classNames.stopped,this.stopped),Array.from(this.elements.buttons.play||[]).forEach((function(e){Object.assign(e,{pressed:t.playing}),e.setAttribute("aria-label",i18n.get(t.playing?"pause":"play",t.config))})),is$1.event(e)&&"timeupdate"===e.type||ui.toggleControls.call(this)},checkLoading:function(e){var t=this;this.loading=["stalled","waiting"].includes(e.type),clearTimeout(this.timers.loading),this.timers.loading=setTimeout((function(){toggleClass(t.elements.container,t.config.classNames.loading,t.loading),ui.toggleControls.call(t)}),this.loading?250:0)},toggleControls:function(e){var t=this.elements.controls;if(t&&this.config.hideControls){var n=this.touch&&this.lastSeekTime+2e3>Date.now();this.toggleControls(Boolean(e||this.loading||this.paused||t.pressed||t.hover||n))}},migrateStyles:function(){var e=this;Object.values(_objectSpread2({},this.media.style)).filter((function(e){return!is$1.empty(e)&&e.startsWith("--plyr")})).forEach((function(t){e.elements.container.style.setProperty(t,e.media.style.getPropertyValue(t)),e.media.style.removeProperty(t)})),is$1.empty(this.media.style)&&this.media.removeAttribute("style")}},Listeners=function(){function e(t){_classCallCheck(this,e),this.player=t,this.lastKey=null,this.focusTimer=null,this.lastKeyDown=null,this.handleKey=this.handleKey.bind(this),this.toggleMenu=this.toggleMenu.bind(this),this.setTabFocus=this.setTabFocus.bind(this),this.firstTouch=this.firstTouch.bind(this)}return _createClass(e,[{key:"handleKey",value:function(e){var t=this.player,n=t.elements,r=e.keyCode?e.keyCode:e.which,i="keydown"===e.type,o=i&&r===this.lastKey;if(!(e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)&&is$1.number(r)){if(i){var a=document.activeElement;if(is$1.element(a)){var s=t.config.selectors.editable;if(a!==n.inputs.seek&&matches$1(a,s))return;if(32===e.which&&matches$1(a,'button, [role^="menuitem"]'))return}switch([32,37,38,39,40,48,49,50,51,52,53,54,56,57,67,70,73,75,76,77,79].includes(r)&&(e.preventDefault(),e.stopPropagation()),r){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:o||(t.currentTime=t.duration/10*(r-48));break;case 32:case 75:o||silencePromise(t.togglePlay());break;case 38:t.increaseVolume(.1);break;case 40:t.decreaseVolume(.1);break;case 77:o||(t.muted=!t.muted);break;case 39:t.forward();break;case 37:t.rewind();break;case 70:t.fullscreen.toggle();break;case 67:o||t.toggleCaptions();break;case 76:t.loop=!t.loop}27===r&&!t.fullscreen.usingNative&&t.fullscreen.active&&t.fullscreen.toggle(),this.lastKey=r}else this.lastKey=null}}},{key:"toggleMenu",value:function(e){controls.toggleMenu.call(this.player,e)}},{key:"firstTouch",value:function(){var e=this.player,t=e.elements;e.touch=!0,toggleClass(t.container,e.config.classNames.isTouch,!0)}},{key:"setTabFocus",value:function(e){var t=this.player,n=t.elements;if(clearTimeout(this.focusTimer),"keydown"!==e.type||9===e.which){"keydown"===e.type&&(this.lastKeyDown=e.timeStamp);var r,i=e.timeStamp-this.lastKeyDown<=20;if("focus"!==e.type||i)r=t.config.classNames.tabFocus,toggleClass(getElements.call(t,".".concat(r)),r,!1),"focusout"!==e.type&&(this.focusTimer=setTimeout((function(){var e=document.activeElement;n.container.contains(e)&&toggleClass(document.activeElement,t.config.classNames.tabFocus,!0)}),10))}}},{key:"global",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=this.player;t.config.keyboard.global&&toggleListener.call(t,window,"keydown keyup",this.handleKey,e,!1),toggleListener.call(t,document.body,"click",this.toggleMenu,e),once.call(t,document.body,"touchstart",this.firstTouch),toggleListener.call(t,document.body,"keydown focus blur focusout",this.setTabFocus,e,!1,!0)}},{key:"container",value:function(){var e=this.player,t=e.config,n=e.elements,r=e.timers;!t.keyboard.global&&t.keyboard.focused&&on.call(e,n.container,"keydown keyup",this.handleKey,!1),on.call(e,n.container,"mousemove mouseleave touchstart touchmove enterfullscreen exitfullscreen",(function(t){var i=n.controls;i&&"enterfullscreen"===t.type&&(i.pressed=!1,i.hover=!1);var o=0;["touchstart","touchmove","mousemove"].includes(t.type)&&(ui.toggleControls.call(e,!0),o=e.touch?3e3:2e3),clearTimeout(r.controls),r.controls=setTimeout((function(){return ui.toggleControls.call(e,!1)}),o)}));var i=function(t){if(!t)return setAspectRatio.call(e);var r=n.container.getBoundingClientRect(),i=r.width,o=r.height;return setAspectRatio.call(e,"".concat(i,":").concat(o))},o=function(){clearTimeout(r.resized),r.resized=setTimeout(i,50)};on.call(e,n.container,"enterfullscreen exitfullscreen",(function(t){var r=e.fullscreen,a=r.target,s=r.usingNative;if(a===n.container&&(e.isEmbed||!is$1.empty(e.config.ratio))){var l="enterfullscreen"===t.type,c=i(l);c.padding;!function(t,n,r){if(e.isVimeo&&!e.config.vimeo.premium){var i=e.elements.wrapper.firstChild,o=_slicedToArray(t,2)[1],a=_slicedToArray(getAspectRatio.call(e),2),s=a[0],l=a[1];i.style.maxWidth=r?"".concat(o/l*s,"px"):null,i.style.margin=r?"0 auto":null}}(c.ratio,0,l),s||(l?on.call(e,window,"resize",o):off.call(e,window,"resize",o))}}))}},{key:"media",value:function(){var e=this,t=this.player,n=t.elements;if(on.call(t,t.media,"timeupdate seeking seeked",(function(e){return controls.timeUpdate.call(t,e)})),on.call(t,t.media,"durationchange loadeddata loadedmetadata",(function(e){return controls.durationUpdate.call(t,e)})),on.call(t,t.media,"ended",(function(){t.isHTML5&&t.isVideo&&t.config.resetOnEnd&&(t.restart(),t.pause())})),on.call(t,t.media,"progress playing seeking seeked",(function(e){return controls.updateProgress.call(t,e)})),on.call(t,t.media,"volumechange",(function(e){return controls.updateVolume.call(t,e)})),on.call(t,t.media,"playing play pause ended emptied timeupdate",(function(e){return ui.checkPlaying.call(t,e)})),on.call(t,t.media,"waiting canplay seeked playing",(function(e){return ui.checkLoading.call(t,e)})),t.supported.ui&&t.config.clickToPlay&&!t.isAudio){var r=getElement.call(t,".".concat(t.config.classNames.video));if(!is$1.element(r))return;on.call(t,n.container,"click",(function(i){([n.container,r].includes(i.target)||r.contains(i.target))&&(t.touch&&t.config.hideControls||(t.ended?(e.proxy(i,t.restart,"restart"),e.proxy(i,(function(){silencePromise(t.play())}),"play")):e.proxy(i,(function(){silencePromise(t.togglePlay())}),"play")))}))}t.supported.ui&&t.config.disableContextMenu&&on.call(t,n.wrapper,"contextmenu",(function(e){e.preventDefault()}),!1),on.call(t,t.media,"volumechange",(function(){t.storage.set({volume:t.volume,muted:t.muted})})),on.call(t,t.media,"ratechange",(function(){controls.updateSetting.call(t,"speed"),t.storage.set({speed:t.speed})})),on.call(t,t.media,"qualitychange",(function(e){controls.updateSetting.call(t,"quality",null,e.detail.quality)})),on.call(t,t.media,"ready qualitychange",(function(){controls.setDownloadUrl.call(t)}));var i=t.config.events.concat(["keyup","keydown"]).join(" ");on.call(t,t.media,i,(function(e){var r=e.detail,i=void 0===r?{}:r;"error"===e.type&&(i=t.media.error),triggerEvent.call(t,n.container,e.type,!0,i)}))}},{key:"proxy",value:function(e,t,n){var r=this.player,i=r.config.listeners[n],o=!0;is$1.function(i)&&(o=i.call(r,e)),!1!==o&&is$1.function(t)&&t.call(r,e)}},{key:"bind",value:function(e,t,n,r){var i=this,o=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],a=this.player,s=a.config.listeners[r],l=is$1.function(s);on.call(a,e,t,(function(e){return i.proxy(e,n,r)}),o&&!l)}},{key:"controls",value:function(){var e=this,t=this.player,n=t.elements,r=browser.isIE?"change":"input";if(n.buttons.play&&Array.from(n.buttons.play).forEach((function(n){e.bind(n,"click",(function(){silencePromise(t.togglePlay())}),"play")})),this.bind(n.buttons.restart,"click",t.restart,"restart"),this.bind(n.buttons.rewind,"click",t.rewind,"rewind"),this.bind(n.buttons.fastForward,"click",t.forward,"fastForward"),this.bind(n.buttons.mute,"click",(function(){t.muted=!t.muted}),"mute"),this.bind(n.buttons.captions,"click",(function(){return t.toggleCaptions()})),this.bind(n.buttons.download,"click",(function(){triggerEvent.call(t,t.media,"download")}),"download"),this.bind(n.buttons.fullscreen,"click",(function(){t.fullscreen.toggle()}),"fullscreen"),this.bind(n.buttons.pip,"click",(function(){t.pip="toggle"}),"pip"),this.bind(n.buttons.airplay,"click",t.airplay,"airplay"),this.bind(n.buttons.settings,"click",(function(e){e.stopPropagation(),e.preventDefault(),controls.toggleMenu.call(t,e)}),null,!1),this.bind(n.buttons.settings,"keyup",(function(e){var n=e.which;[13,32].includes(n)&&(13!==n?(e.preventDefault(),e.stopPropagation(),controls.toggleMenu.call(t,e)):controls.focusFirstMenuItem.call(t,null,!0))}),null,!1),this.bind(n.settings.menu,"keydown",(function(e){27===e.which&&controls.toggleMenu.call(t,e)})),this.bind(n.inputs.seek,"mousedown mousemove",(function(e){var t=n.progress.getBoundingClientRect(),r=100/t.width*(e.pageX-t.left);e.currentTarget.setAttribute("seek-value",r)})),this.bind(n.inputs.seek,"mousedown mouseup keydown keyup touchstart touchend",(function(e){var n=e.currentTarget,r=e.keyCode?e.keyCode:e.which;if(!is$1.keyboardEvent(e)||39===r||37===r){t.lastSeekTime=Date.now();var i=n.hasAttribute("play-on-seeked"),o=["mouseup","touchend","keyup"].includes(e.type);i&&o?(n.removeAttribute("play-on-seeked"),silencePromise(t.play())):!o&&t.playing&&(n.setAttribute("play-on-seeked",""),t.pause())}})),browser.isIos){var i=getElements.call(t,'input[type="range"]');Array.from(i).forEach((function(t){return e.bind(t,r,(function(e){return repaint(e.target)}))}))}this.bind(n.inputs.seek,r,(function(e){var n=e.currentTarget,r=n.getAttribute("seek-value");is$1.empty(r)&&(r=n.value),n.removeAttribute("seek-value"),t.currentTime=r/n.max*t.duration}),"seek"),this.bind(n.progress,"mouseenter mouseleave mousemove",(function(e){return controls.updateSeekTooltip.call(t,e)})),this.bind(n.progress,"mousemove touchmove",(function(e){var n=t.previewThumbnails;n&&n.loaded&&n.startMove(e)})),this.bind(n.progress,"mouseleave touchend click",(function(){var e=t.previewThumbnails;e&&e.loaded&&e.endMove(!1,!0)})),this.bind(n.progress,"mousedown touchstart",(function(e){var n=t.previewThumbnails;n&&n.loaded&&n.startScrubbing(e)})),this.bind(n.progress,"mouseup touchend",(function(e){var n=t.previewThumbnails;n&&n.loaded&&n.endScrubbing(e)})),browser.isWebkit&&Array.from(getElements.call(t,'input[type="range"]')).forEach((function(n){e.bind(n,"input",(function(e){return controls.updateRangeFill.call(t,e.target)}))})),t.config.toggleInvert&&!is$1.element(n.display.duration)&&this.bind(n.display.currentTime,"click",(function(){0!==t.currentTime&&(t.config.invertTime=!t.config.invertTime,controls.timeUpdate.call(t))})),this.bind(n.inputs.volume,r,(function(e){t.volume=e.target.value}),"volume"),this.bind(n.controls,"mouseenter mouseleave",(function(e){n.controls.hover=!t.touch&&"mouseenter"===e.type})),n.fullscreen&&Array.from(n.fullscreen.children).filter((function(e){return!e.contains(n.container)})).forEach((function(r){e.bind(r,"mouseenter mouseleave",(function(e){n.controls.hover=!t.touch&&"mouseenter"===e.type}))})),this.bind(n.controls,"mousedown mouseup touchstart touchend touchcancel",(function(e){n.controls.pressed=["mousedown","touchstart"].includes(e.type)})),this.bind(n.controls,"focusin",(function(){var r=t.config,i=t.timers;toggleClass(n.controls,r.classNames.noTransition,!0),ui.toggleControls.call(t,!0),setTimeout((function(){toggleClass(n.controls,r.classNames.noTransition,!1)}),0);var o=e.touch?3e3:4e3;clearTimeout(i.controls),i.controls=setTimeout((function(){return ui.toggleControls.call(t,!1)}),o)})),this.bind(n.inputs.volume,"wheel",(function(e){var n=e.webkitDirectionInvertedFromDevice,r=_slicedToArray([e.deltaX,-e.deltaY].map((function(e){return n?-e:e})),2),i=r[0],o=r[1],a=Math.sign(Math.abs(i)>Math.abs(o)?i:o);t.increaseVolume(a/50);var s=t.media.volume;(1===a&&s<1||-1===a&&s>0)&&e.preventDefault()}),"volume",!1)}}]),e}(),HAS_SPECIES_SUPPORT$3=arrayMethodHasSpeciesSupport("splice"),USES_TO_LENGTH$a=arrayMethodUsesToLength("splice",{ACCESSORS:!0,0:0,1:2}),max$3=Math.max,min$5=Math.min,MAX_SAFE_INTEGER$1=9007199254740991,MAXIMUM_ALLOWED_LENGTH_EXCEEDED="Maximum allowed length exceeded";_export({target:"Array",proto:!0,forced:!HAS_SPECIES_SUPPORT$3||!USES_TO_LENGTH$a},{splice:function(e,t){var n,r,i,o,a,s,l=toObject(this),c=toLength(l.length),u=toAbsoluteIndex(e,c),d=arguments.length;if(0===d?n=r=0:1===d?(n=0,r=c-u):(n=d-2,r=min$5(max$3(toInteger(t),0),c-u)),c+n-r>MAX_SAFE_INTEGER$1)throw TypeError(MAXIMUM_ALLOWED_LENGTH_EXCEEDED);for(i=arraySpeciesCreate(l,r),o=0;o<r;o++)(a=u+o)in l&&createProperty(i,o,l[a]);if(i.length=r,n<r){for(o=u;o<c-r;o++)s=o+n,(a=o+r)in l?l[s]=l[a]:delete l[s];for(o=c;o>c-r+n;o--)delete l[o-1]}else if(n>r)for(o=c-r;o>u;o--)s=o+n-1,(a=o+r-1)in l?l[s]=l[a]:delete l[s];for(o=0;o<n;o++)l[o+u]=arguments[o+2];return l.length=c-r+n,i}});var loadjs_umd=createCommonjsModule((function(e,t){e.exports=function(){var e=function(){},t={},n={},r={};function i(e,t){if(e){var i=r[e];if(n[e]=t,i)for(;i.length;)i[0](e,t),i.splice(0,1)}}function o(t,n){t.call&&(t={success:t}),n.length?(t.error||e)(n):(t.success||e)(t)}function a(t,n,r,i){var o,s,l=document,c=r.async,u=(r.numRetries||0)+1,d=r.before||e,h=t.replace(/[\?|#].*$/,""),p=t.replace(/^(css|img)!/,"");i=i||0,/(^css!|\.css$)/.test(h)?((s=l.createElement("link")).rel="stylesheet",s.href=p,(o="hideFocus"in s)&&s.relList&&(o=0,s.rel="preload",s.as="style")):/(^img!|\.(png|gif|jpg|svg|webp)$)/.test(h)?(s=l.createElement("img")).src=p:((s=l.createElement("script")).src=t,s.async=void 0===c||c),s.onload=s.onerror=s.onbeforeload=function(e){var l=e.type[0];if(o)try{s.sheet.cssText.length||(l="e")}catch(e){18!=e.code&&(l="e")}if("e"==l){if((i+=1)<u)return a(t,n,r,i)}else if("preload"==s.rel&&"style"==s.as)return s.rel="stylesheet";n(t,l,e.defaultPrevented)},!1!==d(t,s)&&l.head.appendChild(s)}function s(e,n,r){var s,l;if(n&&n.trim&&(s=n),l=(s?r:n)||{},s){if(s in t)throw"LoadJS";t[s]=!0}function c(t,n){!function(e,t,n){var r,i,o=(e=e.push?e:[e]).length,s=o,l=[];for(r=function(e,n,r){if("e"==n&&l.push(e),"b"==n){if(!r)return;l.push(e)}--o||t(l)},i=0;i<s;i++)a(e[i],r,n)}(e,(function(e){o(l,e),t&&o({success:t,error:n},e),i(s,e)}),l)}if(l.returnPromise)return new Promise(c);c()}return s.ready=function(e,t){return function(e,t){e=e.push?e:[e];var i,o,a,s=[],l=e.length,c=l;for(i=function(e,n){n.length&&s.push(e),--c||t(s)};l--;)o=e[l],(a=n[o])?i(o,a):(r[o]=r[o]||[]).push(i)}(e,(function(e){o(t,e)})),s},s.done=function(e){i(e,[])},s.reset=function(){t={},n={},r={}},s.isDefined=function(e){return e in t},s}()}));function loadScript(e){return new Promise((function(t,n){loadjs_umd(e,{success:t,error:n})}))}function parseId(e){if(is$1.empty(e))return null;if(is$1.number(Number(e)))return e;return e.match(/^.*(vimeo.com\/|video\/)(\d+).*/)?RegExp.$2:e}function assurePlaybackState(e){e&&!this.embed.hasPlayed&&(this.embed.hasPlayed=!0),this.media.paused===e&&(this.media.paused=!e,triggerEvent.call(this,this.media,e?"play":"pause"))}var vimeo={setup:function(){var e=this;toggleClass(e.elements.wrapper,e.config.classNames.embed,!0),e.options.speed=e.config.speed.options,setAspectRatio.call(e),is$1.object(window.Vimeo)?vimeo.ready.call(e):loadScript(e.config.urls.vimeo.sdk).then((function(){vimeo.ready.call(e)})).catch((function(t){e.debug.warn("Vimeo SDK (player.js) failed to load",t)}))},ready:function(){var e=this,t=this,n=t.config.vimeo,r=n.premium,i=n.referrerPolicy,o=_objectWithoutProperties(n,["premium","referrerPolicy"]);r&&Object.assign(o,{controls:!1,sidedock:!1});var a=buildUrlParams(_objectSpread2({loop:t.config.loop.active,autoplay:t.autoplay,muted:t.muted,gesture:"media",playsinline:!this.config.fullscreen.iosNative},o)),s=t.media.getAttribute("src");is$1.empty(s)&&(s=t.media.getAttribute(t.config.attributes.embed.id));var l=parseId(s),c=createElement("iframe"),u=format(t.config.urls.vimeo.iframe,l,a);c.setAttribute("src",u),c.setAttribute("allowfullscreen",""),c.setAttribute("allow","autoplay,fullscreen,picture-in-picture"),is$1.empty(i)||c.setAttribute("referrerPolicy",i);var d=t.poster;if(r)c.setAttribute("data-poster",d),t.media=replaceElement(c,t.media);else{var h=createElement("div",{class:t.config.classNames.embedContainer,"data-poster":d});h.appendChild(c),t.media=replaceElement(h,t.media)}fetch(format(t.config.urls.vimeo.api,l),"json").then((function(e){if(!is$1.empty(e)){var n=new URL(e[0].thumbnail_large);n.pathname="".concat(n.pathname.split("_")[0],".jpg"),ui.setPoster.call(t,n.href).catch((function(){}))}})),t.embed=new window.Vimeo.Player(c,{autopause:t.config.autopause,muted:t.muted}),t.media.paused=!0,t.media.currentTime=0,t.supported.ui&&t.embed.disableTextTrack(),t.media.play=function(){return assurePlaybackState.call(t,!0),t.embed.play()},t.media.pause=function(){return assurePlaybackState.call(t,!1),t.embed.pause()},t.media.stop=function(){t.pause(),t.currentTime=0};var p=t.media.currentTime;Object.defineProperty(t.media,"currentTime",{get:function(){return p},set:function(e){var n=t.embed,r=t.media,i=t.paused,o=t.volume,a=i&&!n.hasPlayed;r.seeking=!0,triggerEvent.call(t,r,"seeking"),Promise.resolve(a&&n.setVolume(0)).then((function(){return n.setCurrentTime(e)})).then((function(){return a&&n.pause()})).then((function(){return a&&n.setVolume(o)})).catch((function(){}))}});var f=t.config.speed.selected;Object.defineProperty(t.media,"playbackRate",{get:function(){return f},set:function(e){t.embed.setPlaybackRate(e).then((function(){f=e,triggerEvent.call(t,t.media,"ratechange")})).catch((function(){t.options.speed=[1]}))}});var m=t.config.volume;Object.defineProperty(t.media,"volume",{get:function(){return m},set:function(e){t.embed.setVolume(e).then((function(){m=e,triggerEvent.call(t,t.media,"volumechange")}))}});var g=t.config.muted;Object.defineProperty(t.media,"muted",{get:function(){return g},set:function(e){var n=!!is$1.boolean(e)&&e;t.embed.setVolume(n?0:t.config.volume).then((function(){g=n,triggerEvent.call(t,t.media,"volumechange")}))}});var y,b=t.config.loop;Object.defineProperty(t.media,"loop",{get:function(){return b},set:function(e){var n=is$1.boolean(e)?e:t.config.loop.active;t.embed.setLoop(n).then((function(){b=n}))}}),t.embed.getVideoUrl().then((function(e){y=e,controls.setDownloadUrl.call(t)})).catch((function(t){e.debug.warn(t)})),Object.defineProperty(t.media,"currentSrc",{get:function(){return y}}),Object.defineProperty(t.media,"ended",{get:function(){return t.currentTime===t.duration}}),Promise.all([t.embed.getVideoWidth(),t.embed.getVideoHeight()]).then((function(n){var r=_slicedToArray(n,2),i=r[0],o=r[1];t.embed.ratio=[i,o],setAspectRatio.call(e)})),t.embed.setAutopause(t.config.autopause).then((function(e){t.config.autopause=e})),t.embed.getVideoTitle().then((function(n){t.config.title=n,ui.setTitle.call(e)})),t.embed.getCurrentTime().then((function(e){p=e,triggerEvent.call(t,t.media,"timeupdate")})),t.embed.getDuration().then((function(e){t.media.duration=e,triggerEvent.call(t,t.media,"durationchange")})),t.embed.getTextTracks().then((function(e){t.media.textTracks=e,captions.setup.call(t)})),t.embed.on("cuechange",(function(e){var n=e.cues,r=(void 0===n?[]:n).map((function(e){return stripHTML(e.text)}));captions.updateCues.call(t,r)})),t.embed.on("loaded",(function(){(t.embed.getPaused().then((function(e){assurePlaybackState.call(t,!e),e||triggerEvent.call(t,t.media,"playing")})),is$1.element(t.embed.element)&&t.supported.ui)&&t.embed.element.setAttribute("tabindex",-1)})),t.embed.on("bufferstart",(function(){triggerEvent.call(t,t.media,"waiting")})),t.embed.on("bufferend",(function(){triggerEvent.call(t,t.media,"playing")})),t.embed.on("play",(function(){assurePlaybackState.call(t,!0),triggerEvent.call(t,t.media,"playing")})),t.embed.on("pause",(function(){assurePlaybackState.call(t,!1)})),t.embed.on("timeupdate",(function(e){t.media.seeking=!1,p=e.seconds,triggerEvent.call(t,t.media,"timeupdate")})),t.embed.on("progress",(function(e){t.media.buffered=e.percent,triggerEvent.call(t,t.media,"progress"),1===parseInt(e.percent,10)&&triggerEvent.call(t,t.media,"canplaythrough"),t.embed.getDuration().then((function(e){e!==t.media.duration&&(t.media.duration=e,triggerEvent.call(t,t.media,"durationchange"))}))})),t.embed.on("seeked",(function(){t.media.seeking=!1,triggerEvent.call(t,t.media,"seeked")})),t.embed.on("ended",(function(){t.media.paused=!0,triggerEvent.call(t,t.media,"ended")})),t.embed.on("error",(function(e){t.media.error=e,triggerEvent.call(t,t.media,"error")})),setTimeout((function(){return ui.build.call(t)}),0)}};function parseId$1(e){if(is$1.empty(e))return null;return e.match(/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*/)?RegExp.$2:e}function assurePlaybackState$1(e){e&&!this.embed.hasPlayed&&(this.embed.hasPlayed=!0),this.media.paused===e&&(this.media.paused=!e,triggerEvent.call(this,this.media,e?"play":"pause"))}function getHost$1(e){return e.noCookie?"https://www.youtube-nocookie.com":"http:"===window.location.protocol?"http://www.youtube.com":void 0}var youtube={setup:function(){var e=this;if(toggleClass(this.elements.wrapper,this.config.classNames.embed,!0),is$1.object(window.YT)&&is$1.function(window.YT.Player))youtube.ready.call(this);else{var t=window.onYouTubeIframeAPIReady;window.onYouTubeIframeAPIReady=function(){is$1.function(t)&&t(),youtube.ready.call(e)},loadScript(this.config.urls.youtube.sdk).catch((function(t){e.debug.warn("YouTube API failed to load",t)}))}},getTitle:function(e){var t=this;fetch(format(this.config.urls.youtube.api,e)).then((function(e){if(is$1.object(e)){var n=e.title,r=e.height,i=e.width;t.config.title=n,ui.setTitle.call(t),t.embed.ratio=[i,r]}setAspectRatio.call(t)})).catch((function(){setAspectRatio.call(t)}))},ready:function(){var e=this,t=e.media&&e.media.getAttribute("id");if(is$1.empty(t)||!t.startsWith("youtube-")){var n=e.media.getAttribute("src");is$1.empty(n)&&(n=e.media.getAttribute(this.config.attributes.embed.id));var r=parseId$1(n),i=generateId(e.provider),o=createElement("div",{id:i,"data-poster":e.poster});e.media=replaceElement(o,e.media);var a=function(e){return"https://i.ytimg.com/vi/".concat(r,"/").concat(e,"default.jpg")};loadImage(a("maxres"),121).catch((function(){return loadImage(a("sd"),121)})).catch((function(){return loadImage(a("hq"))})).then((function(t){return ui.setPoster.call(e,t.src)})).then((function(t){t.includes("maxres")||(e.elements.poster.style.backgroundSize="cover")})).catch((function(){}));var s=e.config.youtube;e.embed=new window.YT.Player(i,{videoId:r,host:getHost$1(s),playerVars:extend({},{autoplay:e.config.autoplay?1:0,hl:e.config.hl,controls:e.supported.ui?0:1,disablekb:1,playsinline:e.config.fullscreen.iosNative?0:1,cc_load_policy:e.captions.active?1:0,cc_lang_pref:e.config.captions.language,widget_referrer:window?window.location.href:null},s),events:{onError:function(t){if(!e.media.error){var n=t.data,r={2:"The request contains an invalid parameter value. For example, this error occurs if you specify a video ID that does not have 11 characters, or if the video ID contains invalid characters, such as exclamation points or asterisks.",5:"The requested content cannot be played in an HTML5 player or another error related to the HTML5 player has occurred.",100:"The video requested was not found. This error occurs when a video has been removed (for any reason) or has been marked as private.",101:"The owner of the requested video does not allow it to be played in embedded players.",150:"The owner of the requested video does not allow it to be played in embedded players."}[n]||"An unknown error occured";e.media.error={code:n,message:r},triggerEvent.call(e,e.media,"error")}},onPlaybackRateChange:function(t){var n=t.target;e.media.playbackRate=n.getPlaybackRate(),triggerEvent.call(e,e.media,"ratechange")},onReady:function(t){if(!is$1.function(e.media.play)){var n=t.target;youtube.getTitle.call(e,r),e.media.play=function(){assurePlaybackState$1.call(e,!0),n.playVideo()},e.media.pause=function(){assurePlaybackState$1.call(e,!1),n.pauseVideo()},e.media.stop=function(){n.stopVideo()},e.media.duration=n.getDuration(),e.media.paused=!0,e.media.currentTime=0,Object.defineProperty(e.media,"currentTime",{get:function(){return Number(n.getCurrentTime())},set:function(t){e.paused&&!e.embed.hasPlayed&&e.embed.mute(),e.media.seeking=!0,triggerEvent.call(e,e.media,"seeking"),n.seekTo(t)}}),Object.defineProperty(e.media,"playbackRate",{get:function(){return n.getPlaybackRate()},set:function(e){n.setPlaybackRate(e)}});var i=e.config.volume;Object.defineProperty(e.media,"volume",{get:function(){return i},set:function(t){i=t,n.setVolume(100*i),triggerEvent.call(e,e.media,"volumechange")}});var o=e.config.muted;Object.defineProperty(e.media,"muted",{get:function(){return o},set:function(t){var r=is$1.boolean(t)?t:o;o=r,n[r?"mute":"unMute"](),triggerEvent.call(e,e.media,"volumechange")}}),Object.defineProperty(e.media,"currentSrc",{get:function(){return n.getVideoUrl()}}),Object.defineProperty(e.media,"ended",{get:function(){return e.currentTime===e.duration}});var a=n.getAvailablePlaybackRates();e.options.speed=a.filter((function(t){return e.config.speed.options.includes(t)})),e.supported.ui&&e.media.setAttribute("tabindex",-1),triggerEvent.call(e,e.media,"timeupdate"),triggerEvent.call(e,e.media,"durationchange"),clearInterval(e.timers.buffering),e.timers.buffering=setInterval((function(){e.media.buffered=n.getVideoLoadedFraction(),(null===e.media.lastBuffered||e.media.lastBuffered<e.media.buffered)&&triggerEvent.call(e,e.media,"progress"),e.media.lastBuffered=e.media.buffered,1===e.media.buffered&&(clearInterval(e.timers.buffering),triggerEvent.call(e,e.media,"canplaythrough"))}),200),setTimeout((function(){return ui.build.call(e)}),50)}},onStateChange:function(t){var n=t.target;switch(clearInterval(e.timers.playing),e.media.seeking&&[1,2].includes(t.data)&&(e.media.seeking=!1,triggerEvent.call(e,e.media,"seeked")),t.data){case-1:triggerEvent.call(e,e.media,"timeupdate"),e.media.buffered=n.getVideoLoadedFraction(),triggerEvent.call(e,e.media,"progress");break;case 0:assurePlaybackState$1.call(e,!1),e.media.loop?(n.stopVideo(),n.playVideo()):triggerEvent.call(e,e.media,"ended");break;case 1:e.config.autoplay||!e.media.paused||e.embed.hasPlayed?(assurePlaybackState$1.call(e,!0),triggerEvent.call(e,e.media,"playing"),e.timers.playing=setInterval((function(){triggerEvent.call(e,e.media,"timeupdate")}),50),e.media.duration!==n.getDuration()&&(e.media.duration=n.getDuration(),triggerEvent.call(e,e.media,"durationchange"))):e.media.pause();break;case 2:e.muted||e.embed.unMute(),assurePlaybackState$1.call(e,!1);break;case 3:triggerEvent.call(e,e.media,"waiting")}triggerEvent.call(e,e.elements.container,"statechange",!1,{code:t.data})}}})}}},media={setup:function(){this.media?(toggleClass(this.elements.container,this.config.classNames.type.replace("{0}",this.type),!0),toggleClass(this.elements.container,this.config.classNames.provider.replace("{0}",this.provider),!0),this.isEmbed&&toggleClass(this.elements.container,this.config.classNames.type.replace("{0}","video"),!0),this.isVideo&&(this.elements.wrapper=createElement("div",{class:this.config.classNames.video}),wrap$1(this.media,this.elements.wrapper),this.elements.poster=createElement("div",{class:this.config.classNames.poster}),this.elements.wrapper.appendChild(this.elements.poster)),this.isHTML5?html5.setup.call(this):this.isYouTube?youtube.setup.call(this):this.isVimeo&&vimeo.setup.call(this)):this.debug.warn("No media element found!")}},destroy=function(e){e.manager&&e.manager.destroy(),e.elements.displayContainer&&e.elements.displayContainer.destroy(),e.elements.container.remove()},Ads=function(){function e(t){var n=this;_classCallCheck(this,e),this.player=t,this.config=t.config.ads,this.playing=!1,this.initialized=!1,this.elements={container:null,displayContainer:null},this.manager=null,this.loader=null,this.cuePoints=null,this.events={},this.safetyTimer=null,this.countdownTimer=null,this.managerPromise=new Promise((function(e,t){n.on("loaded",e),n.on("error",t)})),this.load()}return _createClass(e,[{key:"load",value:function(){var e=this;this.enabled&&(is$1.object(window.google)&&is$1.object(window.google.ima)?this.ready():loadScript(this.player.config.urls.googleIMA.sdk).then((function(){e.ready()})).catch((function(){e.trigger("error",new Error("Google IMA SDK failed to load"))})))}},{key:"ready",value:function(){var e=this;this.enabled||destroy(this),this.startSafetyTimer(12e3,"ready()"),this.managerPromise.then((function(){e.clearSafetyTimer("onAdsManagerLoaded()")})),this.listeners(),this.setupIMA()}},{key:"setupIMA",value:function(){var e=this;this.elements.container=createElement("div",{class:this.player.config.classNames.ads}),this.player.elements.container.appendChild(this.elements.container),google.ima.settings.setVpaidMode(google.ima.ImaSdkSettings.VpaidMode.ENABLED),google.ima.settings.setLocale(this.player.config.ads.language),google.ima.settings.setDisableCustomPlaybackForIOS10Plus(this.player.config.playsinline),this.elements.displayContainer=new google.ima.AdDisplayContainer(this.elements.container,this.player.media),this.loader=new google.ima.AdsLoader(this.elements.displayContainer),this.loader.addEventListener(google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,(function(t){return e.onAdsManagerLoaded(t)}),!1),this.loader.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR,(function(t){return e.onAdError(t)}),!1),this.requestAds()}},{key:"requestAds",value:function(){var e=this.player.elements.container;try{var t=new google.ima.AdsRequest;t.adTagUrl=this.tagUrl,t.linearAdSlotWidth=e.offsetWidth,t.linearAdSlotHeight=e.offsetHeight,t.nonLinearAdSlotWidth=e.offsetWidth,t.nonLinearAdSlotHeight=e.offsetHeight,t.forceNonLinearFullSlot=!1,t.setAdWillPlayMuted(!this.player.muted),this.loader.requestAds(t)}catch(e){this.onAdError(e)}}},{key:"pollCountdown",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!t)return clearInterval(this.countdownTimer),void this.elements.container.removeAttribute("data-badge-text");var n=function(){var t=formatTime(Math.max(e.manager.getRemainingTime(),0)),n="".concat(i18n.get("advertisement",e.player.config)," - ").concat(t);e.elements.container.setAttribute("data-badge-text",n)};this.countdownTimer=setInterval(n,100)}},{key:"onAdsManagerLoaded",value:function(e){var t=this;if(this.enabled){var n=new google.ima.AdsRenderingSettings;n.restoreCustomPlaybackStateOnAdBreakComplete=!0,n.enablePreloading=!0,this.manager=e.getAdsManager(this.player,n),this.cuePoints=this.manager.getCuePoints(),this.manager.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR,(function(e){return t.onAdError(e)})),Object.keys(google.ima.AdEvent.Type).forEach((function(e){t.manager.addEventListener(google.ima.AdEvent.Type[e],(function(e){return t.onAdEvent(e)}))})),this.trigger("loaded")}}},{key:"addCuePoints",value:function(){var e=this;is$1.empty(this.cuePoints)||this.cuePoints.forEach((function(t){if(0!==t&&-1!==t&&t<e.player.duration){var n=e.player.elements.progress;if(is$1.element(n)){var r=100/e.player.duration*t,i=createElement("span",{class:e.player.config.classNames.cues});i.style.left="".concat(r.toString(),"%"),n.appendChild(i)}}}))}},{key:"onAdEvent",value:function(e){var t,n=this,r=this.player.elements.container,i=e.getAd(),o=e.getAdData();switch(t=e.type,triggerEvent.call(n.player,n.player.media,"ads".concat(t.replace(/_/g,"").toLowerCase())),e.type){case google.ima.AdEvent.Type.LOADED:this.trigger("loaded"),this.pollCountdown(!0),i.isLinear()||(i.width=r.offsetWidth,i.height=r.offsetHeight);break;case google.ima.AdEvent.Type.STARTED:this.manager.setVolume(this.player.volume);break;case google.ima.AdEvent.Type.ALL_ADS_COMPLETED:this.player.ended?this.loadAds():this.loader.contentComplete();break;case google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED:this.pauseContent();break;case google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED:this.pollCountdown(),this.resumeContent();break;case google.ima.AdEvent.Type.LOG:o.adError&&this.player.debug.warn("Non-fatal ad error: ".concat(o.adError.getMessage()))}}},{key:"onAdError",value:function(e){this.cancel(),this.player.debug.warn("Ads error",e)}},{key:"listeners",value:function(){var e,t=this,n=this.player.elements.container;this.player.on("canplay",(function(){t.addCuePoints()})),this.player.on("ended",(function(){t.loader.contentComplete()})),this.player.on("timeupdate",(function(){e=t.player.currentTime})),this.player.on("seeked",(function(){var n=t.player.currentTime;is$1.empty(t.cuePoints)||t.cuePoints.forEach((function(r,i){e<r&&r<n&&(t.manager.discardAdBreak(),t.cuePoints.splice(i,1))}))})),window.addEventListener("resize",(function(){t.manager&&t.manager.resize(n.offsetWidth,n.offsetHeight,google.ima.ViewMode.NORMAL)}))}},{key:"play",value:function(){var e=this,t=this.player.elements.container;this.managerPromise||this.resumeContent(),this.managerPromise.then((function(){e.manager.setVolume(e.player.volume),e.elements.displayContainer.initialize();try{e.initialized||(e.manager.init(t.offsetWidth,t.offsetHeight,google.ima.ViewMode.NORMAL),e.manager.start()),e.initialized=!0}catch(t){e.onAdError(t)}})).catch((function(){}))}},{key:"resumeContent",value:function(){this.elements.container.style.zIndex="",this.playing=!1,silencePromise(this.player.media.play())}},{key:"pauseContent",value:function(){this.elements.container.style.zIndex=3,this.playing=!0,this.player.media.pause()}},{key:"cancel",value:function(){this.initialized&&this.resumeContent(),this.trigger("error"),this.loadAds()}},{key:"loadAds",value:function(){var e=this;this.managerPromise.then((function(){e.manager&&e.manager.destroy(),e.managerPromise=new Promise((function(t){e.on("loaded",t),e.player.debug.log(e.manager)})),e.initialized=!1,e.requestAds()})).catch((function(){}))}},{key:"trigger",value:function(e){for(var t=this,n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];var o=this.events[e];is$1.array(o)&&o.forEach((function(e){is$1.function(e)&&e.apply(t,r)}))}},{key:"on",value:function(e,t){return is$1.array(this.events[e])||(this.events[e]=[]),this.events[e].push(t),this}},{key:"startSafetyTimer",value:function(e,t){var n=this;this.player.debug.log("Safety timer invoked from: ".concat(t)),this.safetyTimer=setTimeout((function(){n.cancel(),n.clearSafetyTimer("startSafetyTimer()")}),e)}},{key:"clearSafetyTimer",value:function(e){is$1.nullOrUndefined(this.safetyTimer)||(this.player.debug.log("Safety timer cleared from: ".concat(e)),clearTimeout(this.safetyTimer),this.safetyTimer=null)}},{key:"enabled",get:function(){var e=this.config;return this.player.isHTML5&&this.player.isVideo&&e.enabled&&(!is$1.empty(e.publisherId)||is$1.url(e.tagUrl))}},{key:"tagUrl",get:function(){var e=this.config;if(is$1.url(e.tagUrl))return e.tagUrl;var t={AV_PUBLISHERID:"58c25bb0073ef448b1087ad6",AV_CHANNELID:"5a0458dc28a06145e4519d21",AV_URL:window.location.hostname,cb:Date.now(),AV_WIDTH:640,AV_HEIGHT:480,AV_CDIM2:e.publisherId};return"".concat("https://go.aniview.com/api/adserver6/vast/","?").concat(buildUrlParams(t))}}]),e}(),$findIndex=arrayIteration.findIndex,FIND_INDEX="findIndex",SKIPS_HOLES$1=!0,USES_TO_LENGTH$b=arrayMethodUsesToLength(FIND_INDEX);FIND_INDEX in[]&&Array(1)[FIND_INDEX]((function(){SKIPS_HOLES$1=!1})),_export({target:"Array",proto:!0,forced:SKIPS_HOLES$1||!USES_TO_LENGTH$b},{findIndex:function(e){return $findIndex(this,e,arguments.length>1?arguments[1]:void 0)}}),addToUnscopables(FIND_INDEX);var min$6=Math.min,nativeLastIndexOf=[].lastIndexOf,NEGATIVE_ZERO$1=!!nativeLastIndexOf&&1/[1].lastIndexOf(1,-0)<0,STRICT_METHOD$6=arrayMethodIsStrict("lastIndexOf"),USES_TO_LENGTH$c=arrayMethodUsesToLength("indexOf",{ACCESSORS:!0,1:0}),FORCED$5=NEGATIVE_ZERO$1||!STRICT_METHOD$6||!USES_TO_LENGTH$c,arrayLastIndexOf=FORCED$5?function(e){if(NEGATIVE_ZERO$1)return nativeLastIndexOf.apply(this,arguments)||0;var t=toIndexedObject(this),n=toLength(t.length),r=n-1;for(arguments.length>1&&(r=min$6(r,toInteger(arguments[1]))),r<0&&(r=n+r);r>=0;r--)if(r in t&&t[r]===e)return r||0;return-1}:nativeLastIndexOf;_export({target:"Array",proto:!0,forced:arrayLastIndexOf!==[].lastIndexOf},{lastIndexOf:arrayLastIndexOf});var parseVtt=function(e){var t=[];return e.split(/\r\n\r\n|\n\n|\r\r/).forEach((function(e){var n={};e.split(/\r\n|\n|\r/).forEach((function(e){if(is$1.number(n.startTime)){if(!is$1.empty(e.trim())&&is$1.empty(n.text)){var t=e.trim().split("#xywh="),r=_slicedToArray(t,1);if(n.text=r[0],t[1]){var i=_slicedToArray(t[1].split(","),4);n.x=i[0],n.y=i[1],n.w=i[2],n.h=i[3]}}}else{var o=e.match(/([0-9]{2})?:?([0-9]{2}):([0-9]{2}).([0-9]{2,3})( ?--> ?)([0-9]{2})?:?([0-9]{2}):([0-9]{2}).([0-9]{2,3})/);o&&(n.startTime=60*Number(o[1]||0)*60+60*Number(o[2])+Number(o[3])+Number("0.".concat(o[4])),n.endTime=60*Number(o[6]||0)*60+60*Number(o[7])+Number(o[8])+Number("0.".concat(o[9])))}})),n.text&&t.push(n)})),t},fitRatio=function(e,t){var n={};return e>t.width/t.height?(n.width=t.width,n.height=1/e*t.width):(n.height=t.height,n.width=e*t.height),n},PreviewThumbnails=function(){function e(t){_classCallCheck(this,e),this.player=t,this.thumbnails=[],this.loaded=!1,this.lastMouseMoveTime=Date.now(),this.mouseDown=!1,this.loadedImages=[],this.elements={thumb:{},scrubbing:{}},this.load()}return _createClass(e,[{key:"load",value:function(){var e=this;this.player.elements.display.seekTooltip&&(this.player.elements.display.seekTooltip.hidden=this.enabled),this.enabled&&this.getThumbnails().then((function(){e.enabled&&(e.render(),e.determineContainerAutoSizing(),e.loaded=!0)}))}},{key:"getThumbnails",value:function(){var e=this;return new Promise((function(t){var n=e.player.config.previewThumbnails.src;if(is$1.empty(n))throw new Error("Missing previewThumbnails.src config attribute");var r=function(){e.thumbnails.sort((function(e,t){return e.height-t.height})),e.player.debug.log("Preview thumbnails",e.thumbnails),t()};if(is$1.function(n))n((function(t){e.thumbnails=t,r()}));else{var i=(is$1.string(n)?[n]:n).map((function(t){return e.getThumbnail(t)}));Promise.all(i).then(r)}}))}},{key:"getThumbnail",value:function(e){var t=this;return new Promise((function(n){fetch(e).then((function(r){var i={frames:parseVtt(r),height:null,urlPrefix:""};i.frames[0].text.startsWith("/")||i.frames[0].text.startsWith("http://")||i.frames[0].text.startsWith("https://")||(i.urlPrefix=e.substring(0,e.lastIndexOf("/")+1));var o=new Image;o.onload=function(){i.height=o.naturalHeight,i.width=o.naturalWidth,t.thumbnails.push(i),n()},o.src=i.urlPrefix+i.frames[0].text}))}))}},{key:"startMove",value:function(e){if(this.loaded&&is$1.event(e)&&["touchmove","mousemove"].includes(e.type)&&this.player.media.duration){if("touchmove"===e.type)this.seekTime=this.player.media.duration*(this.player.elements.inputs.seek.value/100);else{var t=this.player.elements.progress.getBoundingClientRect(),n=100/t.width*(e.pageX-t.left);this.seekTime=this.player.media.duration*(n/100),this.seekTime<0&&(this.seekTime=0),this.seekTime>this.player.media.duration-1&&(this.seekTime=this.player.media.duration-1),this.mousePosX=e.pageX,this.elements.thumb.time.innerText=formatTime(this.seekTime)}this.showImageAtCurrentTime()}}},{key:"endMove",value:function(){this.toggleThumbContainer(!1,!0)}},{key:"startScrubbing",value:function(e){(is$1.nullOrUndefined(e.button)||!1===e.button||0===e.button)&&(this.mouseDown=!0,this.player.media.duration&&(this.toggleScrubbingContainer(!0),this.toggleThumbContainer(!1,!0),this.showImageAtCurrentTime()))}},{key:"endScrubbing",value:function(){var e=this;this.mouseDown=!1,Math.ceil(this.lastTime)===Math.ceil(this.player.media.currentTime)?this.toggleScrubbingContainer(!1):once.call(this.player,this.player.media,"timeupdate",(function(){e.mouseDown||e.toggleScrubbingContainer(!1)}))}},{key:"listeners",value:function(){var e=this;this.player.on("play",(function(){e.toggleThumbContainer(!1,!0)})),this.player.on("seeked",(function(){e.toggleThumbContainer(!1)})),this.player.on("timeupdate",(function(){e.lastTime=e.player.media.currentTime}))}},{key:"render",value:function(){this.elements.thumb.container=createElement("div",{class:this.player.config.classNames.previewThumbnails.thumbContainer}),this.elements.thumb.imageContainer=createElement("div",{class:this.player.config.classNames.previewThumbnails.imageContainer}),this.elements.thumb.container.appendChild(this.elements.thumb.imageContainer);var e=createElement("div",{class:this.player.config.classNames.previewThumbnails.timeContainer});this.elements.thumb.time=createElement("span",{},"00:00"),e.appendChild(this.elements.thumb.time),this.elements.thumb.container.appendChild(e),is$1.element(this.player.elements.progress)&&this.player.elements.progress.appendChild(this.elements.thumb.container),this.elements.scrubbing.container=createElement("div",{class:this.player.config.classNames.previewThumbnails.scrubbingContainer}),this.player.elements.wrapper.appendChild(this.elements.scrubbing.container)}},{key:"destroy",value:function(){this.elements.thumb.container&&this.elements.thumb.container.remove(),this.elements.scrubbing.container&&this.elements.scrubbing.container.remove()}},{key:"showImageAtCurrentTime",value:function(){var e=this;this.mouseDown?this.setScrubbingContainerSize():this.setThumbContainerSizeAndPos();var t=this.thumbnails[0].frames.findIndex((function(t){return e.seekTime>=t.startTime&&e.seekTime<=t.endTime})),n=t>=0,r=0;this.mouseDown||this.toggleThumbContainer(n),n&&(this.thumbnails.forEach((function(n,i){e.loadedImages.includes(n.frames[t].text)&&(r=i)})),t!==this.showingThumb&&(this.showingThumb=t,this.loadImage(r)))}},{key:"loadImage",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=this.showingThumb,r=this.thumbnails[t],i=r.urlPrefix,o=r.frames[n],a=r.frames[n].text,s=i+a;if(this.currentImageElement&&this.currentImageElement.dataset.filename===a)this.showImage(this.currentImageElement,o,t,n,a,!1),this.currentImageElement.dataset.index=n,this.removeOldImages(this.currentImageElement);else{this.loadingImage&&this.usingSprites&&(this.loadingImage.onload=null);var l=new Image;l.src=s,l.dataset.index=n,l.dataset.filename=a,this.showingThumbFilename=a,this.player.debug.log("Loading image: ".concat(s)),l.onload=function(){return e.showImage(l,o,t,n,a,!0)},this.loadingImage=l,this.removeOldImages(l)}}},{key:"showImage",value:function(e,t,n,r,i){var o=!(arguments.length>5&&void 0!==arguments[5])||arguments[5];this.player.debug.log("Showing thumb: ".concat(i,". num: ").concat(r,". qual: ").concat(n,". newimg: ").concat(o)),this.setImageSizeAndOffset(e,t),o&&(this.currentImageContainer.appendChild(e),this.currentImageElement=e,this.loadedImages.includes(i)||this.loadedImages.push(i)),this.preloadNearby(r,!0).then(this.preloadNearby(r,!1)).then(this.getHigherQuality(n,e,t,i))}},{key:"removeOldImages",value:function(e){var t=this;Array.from(this.currentImageContainer.children).forEach((function(n){if("img"===n.tagName.toLowerCase()){var r=t.usingSprites?500:1e3;if(n.dataset.index!==e.dataset.index&&!n.dataset.deleting){n.dataset.deleting=!0;var i=t.currentImageContainer;setTimeout((function(){i.removeChild(n),t.player.debug.log("Removing thumb: ".concat(n.dataset.filename))}),r)}}}))}},{key:"preloadNearby",value:function(e){var t=this,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return new Promise((function(r){setTimeout((function(){var i=t.thumbnails[0].frames[e].text;if(t.showingThumbFilename===i){var o;o=n?t.thumbnails[0].frames.slice(e):t.thumbnails[0].frames.slice(0,e).reverse();var a=!1;o.forEach((function(e){var n=e.text;if(n!==i&&!t.loadedImages.includes(n)){a=!0,t.player.debug.log("Preloading thumb filename: ".concat(n));var o=t.thumbnails[0].urlPrefix+n,s=new Image;s.src=o,s.onload=function(){t.player.debug.log("Preloaded thumb filename: ".concat(n)),t.loadedImages.includes(n)||t.loadedImages.push(n),r()}}})),a||r()}}),300)}))}},{key:"getHigherQuality",value:function(e,t,n,r){var i=this;if(e<this.thumbnails.length-1){var o=t.naturalHeight;this.usingSprites&&(o=n.h),o<this.thumbContainerHeight&&setTimeout((function(){i.showingThumbFilename===r&&(i.player.debug.log("Showing higher quality thumb for: ".concat(r)),i.loadImage(e+1))}),300)}}},{key:"toggleThumbContainer",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=this.player.config.classNames.previewThumbnails.thumbContainerShown;this.elements.thumb.container.classList.toggle(n,e),!e&&t&&(this.showingThumb=null,this.showingThumbFilename=null)}},{key:"toggleScrubbingContainer",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.player.config.classNames.previewThumbnails.scrubbingContainerShown;this.elements.scrubbing.container.classList.toggle(t,e),e||(this.showingThumb=null,this.showingThumbFilename=null)}},{key:"determineContainerAutoSizing",value:function(){(this.elements.thumb.imageContainer.clientHeight>20||this.elements.thumb.imageContainer.clientWidth>20)&&(this.sizeSpecifiedInCSS=!0)}},{key:"setThumbContainerSizeAndPos",value:function(){if(this.sizeSpecifiedInCSS){if(this.elements.thumb.imageContainer.clientHeight>20&&this.elements.thumb.imageContainer.clientWidth<20){var e=Math.floor(this.elements.thumb.imageContainer.clientHeight*this.thumbAspectRatio);this.elements.thumb.imageContainer.style.width="".concat(e,"px")}else if(this.elements.thumb.imageContainer.clientHeight<20&&this.elements.thumb.imageContainer.clientWidth>20){var t=Math.floor(this.elements.thumb.imageContainer.clientWidth/this.thumbAspectRatio);this.elements.thumb.imageContainer.style.height="".concat(t,"px")}}else{var n=Math.floor(this.thumbContainerHeight*this.thumbAspectRatio);this.elements.thumb.imageContainer.style.height="".concat(this.thumbContainerHeight,"px"),this.elements.thumb.imageContainer.style.width="".concat(n,"px")}this.setThumbContainerPos()}},{key:"setThumbContainerPos",value:function(){var e=this.player.elements.progress.getBoundingClientRect(),t=this.player.elements.container.getBoundingClientRect(),n=this.elements.thumb.container,r=t.left-e.left+10,i=t.right-e.left-n.clientWidth-10,o=this.mousePosX-e.left-n.clientWidth/2;o<r&&(o=r),o>i&&(o=i),n.style.left="".concat(o,"px")}},{key:"setScrubbingContainerSize",value:function(){var e=fitRatio(this.thumbAspectRatio,{width:this.player.media.clientWidth,height:this.player.media.clientHeight}),t=e.width,n=e.height;this.elements.scrubbing.container.style.width="".concat(t,"px"),this.elements.scrubbing.container.style.height="".concat(n,"px")}},{key:"setImageSizeAndOffset",value:function(e,t){if(this.usingSprites){var n=this.thumbContainerHeight/t.h;e.style.height="".concat(e.naturalHeight*n,"px"),e.style.width="".concat(e.naturalWidth*n,"px"),e.style.left="-".concat(t.x*n,"px"),e.style.top="-".concat(t.y*n,"px")}}},{key:"enabled",get:function(){return this.player.isHTML5&&this.player.isVideo&&this.player.config.previewThumbnails.enabled}},{key:"currentImageContainer",get:function(){return this.mouseDown?this.elements.scrubbing.container:this.elements.thumb.imageContainer}},{key:"usingSprites",get:function(){return Object.keys(this.thumbnails[0].frames[0]).includes("w")}},{key:"thumbAspectRatio",get:function(){return this.usingSprites?this.thumbnails[0].frames[0].w/this.thumbnails[0].frames[0].h:this.thumbnails[0].width/this.thumbnails[0].height}},{key:"thumbContainerHeight",get:function(){return this.mouseDown?fitRatio(this.thumbAspectRatio,{width:this.player.media.clientWidth,height:this.player.media.clientHeight}).height:this.sizeSpecifiedInCSS?this.elements.thumb.imageContainer.clientHeight:Math.floor(this.player.media.clientWidth/this.thumbAspectRatio/4)}},{key:"currentImageElement",get:function(){return this.mouseDown?this.currentScrubbingImageElement:this.currentThumbnailImageElement},set:function(e){this.mouseDown?this.currentScrubbingImageElement=e:this.currentThumbnailImageElement=e}}]),e}(),source={insertElements:function(e,t){var n=this;is$1.string(t)?insertElement(e,this.media,{src:t}):is$1.array(t)&&t.forEach((function(t){insertElement(e,n.media,t)}))},change:function(e){var t=this;getDeep(e,"sources.length")?(html5.cancelRequests.call(this),this.destroy.call(this,(function(){t.options.quality=[],removeElement(t.media),t.media=null,is$1.element(t.elements.container)&&t.elements.container.removeAttribute("class");var n=e.sources,r=e.type,i=_slicedToArray(n,1)[0],o=i.provider,a=void 0===o?providers.html5:o,s=i.src,l="html5"===a?r:"div",c="html5"===a?{}:{src:s};Object.assign(t,{provider:a,type:r,supported:support.check(r,a,t.config.playsinline),media:createElement(l,c)}),t.elements.container.appendChild(t.media),is$1.boolean(e.autoplay)&&(t.config.autoplay=e.autoplay),t.isHTML5&&(t.config.crossorigin&&t.media.setAttribute("crossorigin",""),t.config.autoplay&&t.media.setAttribute("autoplay",""),is$1.empty(e.poster)||(t.poster=e.poster),t.config.loop.active&&t.media.setAttribute("loop",""),t.config.muted&&t.media.setAttribute("muted",""),t.config.playsinline&&t.media.setAttribute("playsinline","")),ui.addStyleHook.call(t),t.isHTML5&&source.insertElements.call(t,"source",n),t.config.title=e.title,media.setup.call(t),t.isHTML5&&Object.keys(e).includes("tracks")&&source.insertElements.call(t,"track",e.tracks),(t.isHTML5||t.isEmbed&&!t.supported.ui)&&ui.build.call(t),t.isHTML5&&t.media.load(),is$1.empty(e.previewThumbnails)||(Object.assign(t.config.previewThumbnails,e.previewThumbnails),t.previewThumbnails&&t.previewThumbnails.loaded&&(t.previewThumbnails.destroy(),t.previewThumbnails=null),t.config.previewThumbnails.enabled&&(t.previewThumbnails=new PreviewThumbnails(t))),t.fullscreen.update()}),!0)):this.debug.warn("Invalid source format")}};function clamp(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:255;return Math.min(Math.max(e,t),n)}var Plyr=function(){function e(t,n){var r=this;if(_classCallCheck(this,e),this.timers={},this.ready=!1,this.loading=!1,this.failed=!1,this.touch=support.touch,this.media=t,is$1.string(this.media)&&(this.media=document.querySelectorAll(this.media)),(window.jQuery&&this.media instanceof jQuery||is$1.nodeList(this.media)||is$1.array(this.media))&&(this.media=this.media[0]),this.config=extend({},defaults$1,e.defaults,n||{},function(){try{return JSON.parse(r.media.getAttribute("data-plyr-config"))}catch(e){return{}}}()),this.elements={container:null,fullscreen:null,captions:null,buttons:{},display:{},progress:{},inputs:{},settings:{popup:null,menu:null,panels:{},buttons:{}}},this.captions={active:null,currentTrack:-1,meta:new WeakMap},this.fullscreen={active:!1},this.options={speed:[],quality:[]},this.debug=new Console(this.config.debug),this.debug.log("Config",this.config),this.debug.log("Support",support),!is$1.nullOrUndefined(this.media)&&is$1.element(this.media))if(this.media.plyr)this.debug.warn("Target already setup");else if(this.config.enabled)if(support.check().api){var i=this.media.cloneNode(!0);i.autoplay=!1,this.elements.original=i;var o=this.media.tagName.toLowerCase(),a=null,s=null;switch(o){case"div":if(a=this.media.querySelector("iframe"),is$1.element(a)){if(s=parseUrl(a.getAttribute("src")),this.provider=getProviderByUrl(s.toString()),this.elements.container=this.media,this.media=a,this.elements.container.className="",s.search.length){var l=["1","true"];l.includes(s.searchParams.get("autoplay"))&&(this.config.autoplay=!0),l.includes(s.searchParams.get("loop"))&&(this.config.loop.active=!0),this.isYouTube?(this.config.playsinline=l.includes(s.searchParams.get("playsinline")),this.config.youtube.hl=s.searchParams.get("hl")):this.config.playsinline=!0}}else this.provider=this.media.getAttribute(this.config.attributes.embed.provider),this.media.removeAttribute(this.config.attributes.embed.provider);if(is$1.empty(this.provider)||!Object.keys(providers).includes(this.provider))return void this.debug.error("Setup failed: Invalid provider");this.type=types.video;break;case"video":case"audio":this.type=o,this.provider=providers.html5,this.media.hasAttribute("crossorigin")&&(this.config.crossorigin=!0),this.media.hasAttribute("autoplay")&&(this.config.autoplay=!0),(this.media.hasAttribute("playsinline")||this.media.hasAttribute("webkit-playsinline"))&&(this.config.playsinline=!0),this.media.hasAttribute("muted")&&(this.config.muted=!0),this.media.hasAttribute("loop")&&(this.config.loop.active=!0);break;default:return void this.debug.error("Setup failed: unsupported type")}this.supported=support.check(this.type,this.provider,this.config.playsinline),this.supported.api?(this.eventListeners=[],this.listeners=new Listeners(this),this.storage=new Storage(this),this.media.plyr=this,is$1.element(this.elements.container)||(this.elements.container=createElement("div",{tabindex:0}),wrap$1(this.media,this.elements.container)),ui.migrateStyles.call(this),ui.addStyleHook.call(this),media.setup.call(this),this.config.debug&&on.call(this,this.elements.container,this.config.events.join(" "),(function(e){r.debug.log("event: ".concat(e.type))})),this.fullscreen=new Fullscreen(this),(this.isHTML5||this.isEmbed&&!this.supported.ui)&&ui.build.call(this),this.listeners.container(),this.listeners.global(),this.config.ads.enabled&&(this.ads=new Ads(this)),this.isHTML5&&this.config.autoplay&&setTimeout((function(){return silencePromise(r.play())}),10),this.lastSeekTime=0,this.config.previewThumbnails.enabled&&(this.previewThumbnails=new PreviewThumbnails(this))):this.debug.error("Setup failed: no support")}else this.debug.error("Setup failed: no support");else this.debug.error("Setup failed: disabled by config");else this.debug.error("Setup failed: no suitable element passed")}return _createClass(e,[{key:"play",value:function(){var e=this;return is$1.function(this.media.play)?(this.ads&&this.ads.enabled&&this.ads.managerPromise.then((function(){return e.ads.play()})).catch((function(){return silencePromise(e.media.play())})),this.media.play()):null}},{key:"pause",value:function(){return this.playing&&is$1.function(this.media.pause)?this.media.pause():null}},{key:"togglePlay",value:function(e){return(is$1.boolean(e)?e:!this.playing)?this.play():this.pause()}},{key:"stop",value:function(){this.isHTML5?(this.pause(),this.restart()):is$1.function(this.media.stop)&&this.media.stop()}},{key:"restart",value:function(){this.currentTime=0}},{key:"rewind",value:function(e){this.currentTime-=is$1.number(e)?e:this.config.seekTime}},{key:"forward",value:function(e){this.currentTime+=is$1.number(e)?e:this.config.seekTime}},{key:"increaseVolume",value:function(e){var t=this.media.muted?0:this.volume;this.volume=t+(is$1.number(e)?e:0)}},{key:"decreaseVolume",value:function(e){this.increaseVolume(-e)}},{key:"toggleCaptions",value:function(e){captions.toggle.call(this,e,!1)}},{key:"airplay",value:function(){support.airplay&&this.media.webkitShowPlaybackTargetPicker()}},{key:"toggleControls",value:function(e){if(this.supported.ui&&!this.isAudio){var t=hasClass(this.elements.container,this.config.classNames.hideControls),n=void 0===e?void 0:!e,r=toggleClass(this.elements.container,this.config.classNames.hideControls,n);if(r&&is$1.array(this.config.controls)&&this.config.controls.includes("settings")&&!is$1.empty(this.config.settings)&&controls.toggleMenu.call(this,!1),r!==t){var i=r?"controlshidden":"controlsshown";triggerEvent.call(this,this.media,i)}return!r}return!1}},{key:"on",value:function(e,t){on.call(this,this.elements.container,e,t)}},{key:"once",value:function(e,t){once.call(this,this.elements.container,e,t)}},{key:"off",value:function(e,t){off(this.elements.container,e,t)}},{key:"destroy",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this.ready){var r=function(){document.body.style.overflow="",t.embed=null,n?(Object.keys(t.elements).length&&(removeElement(t.elements.buttons.play),removeElement(t.elements.captions),removeElement(t.elements.controls),removeElement(t.elements.wrapper),t.elements.buttons.play=null,t.elements.captions=null,t.elements.controls=null,t.elements.wrapper=null),is$1.function(e)&&e()):(unbindListeners.call(t),replaceElement(t.elements.original,t.elements.container),triggerEvent.call(t,t.elements.original,"destroyed",!0),is$1.function(e)&&e.call(t.elements.original),t.ready=!1,setTimeout((function(){t.elements=null,t.media=null}),200))};this.stop(),clearTimeout(this.timers.loading),clearTimeout(this.timers.controls),clearTimeout(this.timers.resized),this.isHTML5?(ui.toggleNativeControls.call(this,!0),r()):this.isYouTube?(clearInterval(this.timers.buffering),clearInterval(this.timers.playing),null!==this.embed&&is$1.function(this.embed.destroy)&&this.embed.destroy(),r()):this.isVimeo&&(null!==this.embed&&this.embed.unload().then(r),setTimeout(r,200))}}},{key:"supports",value:function(e){return support.mime.call(this,e)}},{key:"isHTML5",get:function(){return this.provider===providers.html5}},{key:"isEmbed",get:function(){return this.isYouTube||this.isVimeo}},{key:"isYouTube",get:function(){return this.provider===providers.youtube}},{key:"isVimeo",get:function(){return this.provider===providers.vimeo}},{key:"isVideo",get:function(){return this.type===types.video}},{key:"isAudio",get:function(){return this.type===types.audio}},{key:"playing",get:function(){return Boolean(this.ready&&!this.paused&&!this.ended)}},{key:"paused",get:function(){return Boolean(this.media.paused)}},{key:"stopped",get:function(){return Boolean(this.paused&&0===this.currentTime)}},{key:"ended",get:function(){return Boolean(this.media.ended)}},{key:"currentTime",set:function(e){if(this.duration){var t=is$1.number(e)&&e>0;this.media.currentTime=t?Math.min(e,this.duration):0,this.debug.log("Seeking to ".concat(this.currentTime," seconds"))}},get:function(){return Number(this.media.currentTime)}},{key:"buffered",get:function(){var e=this.media.buffered;return is$1.number(e)?e:e&&e.length&&this.duration>0?e.end(0)/this.duration:0}},{key:"seeking",get:function(){return Boolean(this.media.seeking)}},{key:"duration",get:function(){var e=parseFloat(this.config.duration),t=(this.media||{}).duration,n=is$1.number(t)&&t!==1/0?t:0;return e||n}},{key:"volume",set:function(e){var t=e;is$1.string(t)&&(t=Number(t)),is$1.number(t)||(t=this.storage.get("volume")),is$1.number(t)||(t=this.config.volume),t>1&&(t=1),t<0&&(t=0),this.config.volume=t,this.media.volume=t,!is$1.empty(e)&&this.muted&&t>0&&(this.muted=!1)},get:function(){return Number(this.media.volume)}},{key:"muted",set:function(e){var t=e;is$1.boolean(t)||(t=this.storage.get("muted")),is$1.boolean(t)||(t=this.config.muted),this.config.muted=t,this.media.muted=t},get:function(){return Boolean(this.media.muted)}},{key:"hasAudio",get:function(){return!this.isHTML5||(!!this.isAudio||(Boolean(this.media.mozHasAudio)||Boolean(this.media.webkitAudioDecodedByteCount)||Boolean(this.media.audioTracks&&this.media.audioTracks.length)))}},{key:"speed",set:function(e){var t=this,n=null;is$1.number(e)&&(n=e),is$1.number(n)||(n=this.storage.get("speed")),is$1.number(n)||(n=this.config.speed.selected);var r=this.minimumSpeed,i=this.maximumSpeed;n=clamp(n,r,i),this.config.speed.selected=n,setTimeout((function(){t.media.playbackRate=n}),0)},get:function(){return Number(this.media.playbackRate)}},{key:"minimumSpeed",get:function(){return this.isYouTube?Math.min.apply(Math,_toConsumableArray(this.options.speed)):this.isVimeo?.5:.0625}},{key:"maximumSpeed",get:function(){return this.isYouTube?Math.max.apply(Math,_toConsumableArray(this.options.speed)):this.isVimeo?2:16}},{key:"quality",set:function(e){var t=this.config.quality,n=this.options.quality;if(n.length){var r=[!is$1.empty(e)&&Number(e),this.storage.get("quality"),t.selected,t.default].find(is$1.number),i=!0;if(!n.includes(r)){var o=closest$1(n,r);this.debug.warn("Unsupported quality option: ".concat(r,", using ").concat(o," instead")),r=o,i=!1}t.selected=r,this.media.quality=r,i&&this.storage.set({quality:r})}},get:function(){return this.media.quality}},{key:"loop",set:function(e){var t=is$1.boolean(e)?e:this.config.loop.active;this.config.loop.active=t,this.media.loop=t},get:function(){return Boolean(this.media.loop)}},{key:"source",set:function(e){source.change.call(this,e)},get:function(){return this.media.currentSrc}},{key:"download",get:function(){var e=this.config.urls.download;return is$1.url(e)?e:this.source},set:function(e){is$1.url(e)&&(this.config.urls.download=e,controls.setDownloadUrl.call(this))}},{key:"poster",set:function(e){this.isVideo?ui.setPoster.call(this,e,!1).catch((function(){})):this.debug.warn("Poster can only be set for video")},get:function(){return this.isVideo?this.media.getAttribute("poster")||this.media.getAttribute("data-poster"):null}},{key:"ratio",get:function(){if(!this.isVideo)return null;var e=reduceAspectRatio(getAspectRatio.call(this));return is$1.array(e)?e.join(":"):e},set:function(e){this.isVideo?is$1.string(e)&&validateRatio(e)?(this.config.ratio=e,setAspectRatio.call(this)):this.debug.error("Invalid aspect ratio specified (".concat(e,")")):this.debug.warn("Aspect ratio can only be set for video")}},{key:"autoplay",set:function(e){var t=is$1.boolean(e)?e:this.config.autoplay;this.config.autoplay=t},get:function(){return Boolean(this.config.autoplay)}},{key:"currentTrack",set:function(e){captions.set.call(this,e,!1)},get:function(){var e=this.captions,t=e.toggled,n=e.currentTrack;return t?n:-1}},{key:"language",set:function(e){captions.setLanguage.call(this,e,!1)},get:function(){return(captions.getCurrentTrack.call(this)||{}).language}},{key:"pip",set:function(e){if(support.pip){var t=is$1.boolean(e)?e:!this.pip;is$1.function(this.media.webkitSetPresentationMode)&&this.media.webkitSetPresentationMode(t?pip.active:pip.inactive),is$1.function(this.media.requestPictureInPicture)&&(!this.pip&&t?this.media.requestPictureInPicture():this.pip&&!t&&document.exitPictureInPicture())}},get:function(){return support.pip?is$1.empty(this.media.webkitPresentationMode)?this.media===document.pictureInPictureElement:this.media.webkitPresentationMode===pip.active:null}}],[{key:"supported",value:function(e,t,n){return support.check(e,t,n)}},{key:"loadSprite",value:function(e,t){return loadSprite(e,t)}},{key:"setup",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=null;return is$1.string(t)?r=Array.from(document.querySelectorAll(t)):is$1.nodeList(t)?r=Array.from(t):is$1.array(t)&&(r=t.filter(is$1.element)),is$1.empty(r)?null:r.map((function(t){return new e(t,n)}))}}]),e}();Plyr.defaults=cloneDeep(defaults$1);export default Plyr; \ No newline at end of file
diff --git a/youtube/static/modules/plyr/plyr.polyfilled.min.mjs.map b/youtube/static/modules/plyr/plyr.polyfilled.min.mjs.map
new file mode 100644
index 0000000..59585ce
--- /dev/null
+++ b/youtube/static/modules/plyr/plyr.polyfilled.min.mjs.map
@@ -0,0 +1 @@
+{"version":3,"sources":["plyr.polyfilled.mjs","node_modules/custom-event-polyfill/polyfill.js","node_modules/core-js/internals/global.js","node_modules/core-js/internals/fails.js","node_modules/core-js/internals/descriptors.js","node_modules/core-js/internals/object-property-is-enumerable.js","node_modules/core-js/internals/create-property-descriptor.js","node_modules/core-js/internals/classof-raw.js","node_modules/core-js/internals/indexed-object.js","node_modules/core-js/internals/require-object-coercible.js","node_modules/core-js/internals/to-indexed-object.js","node_modules/core-js/internals/is-object.js","node_modules/core-js/internals/to-primitive.js","node_modules/core-js/internals/has.js","node_modules/core-js/internals/document-create-element.js","node_modules/core-js/internals/ie8-dom-define.js","node_modules/core-js/internals/object-get-own-property-descriptor.js","node_modules/core-js/internals/an-object.js","node_modules/core-js/internals/object-define-property.js","node_modules/core-js/internals/create-non-enumerable-property.js","node_modules/core-js/internals/set-global.js","node_modules/core-js/internals/shared-store.js","node_modules/core-js/internals/inspect-source.js","node_modules/core-js/internals/internal-state.js","node_modules/core-js/internals/native-weak-map.js","node_modules/core-js/internals/is-pure.js","node_modules/core-js/internals/shared.js","node_modules/core-js/internals/uid.js","node_modules/core-js/internals/shared-key.js","node_modules/core-js/internals/hidden-keys.js","node_modules/core-js/internals/object-create.js","node_modules/core-js/internals/redefine.js","node_modules/core-js/internals/path.js","node_modules/core-js/internals/get-built-in.js","node_modules/core-js/internals/to-integer.js","node_modules/core-js/internals/to-length.js","node_modules/core-js/internals/to-absolute-index.js","node_modules/core-js/internals/array-includes.js","node_modules/core-js/internals/object-keys-internal.js","node_modules/core-js/internals/enum-bug-keys.js","node_modules/core-js/internals/object-get-own-property-names.js","node_modules/core-js/internals/object-get-own-property-symbols.js","node_modules/core-js/internals/own-keys.js","node_modules/core-js/internals/copy-constructor-properties.js","node_modules/core-js/internals/is-forced.js","node_modules/core-js/internals/export.js","node_modules/core-js/internals/native-symbol.js","node_modules/core-js/internals/use-symbol-as-uid.js","node_modules/core-js/internals/is-array.js","node_modules/core-js/internals/to-object.js","node_modules/core-js/internals/object-keys.js","node_modules/core-js/internals/object-define-properties.js","node_modules/core-js/internals/html.js","node_modules/core-js/internals/object-get-own-property-names-external.js","node_modules/core-js/internals/well-known-symbol.js","node_modules/core-js/internals/well-known-symbol-wrapped.js","node_modules/core-js/internals/define-well-known-symbol.js","node_modules/core-js/internals/set-to-string-tag.js","node_modules/core-js/internals/a-function.js","node_modules/core-js/internals/function-bind-context.js","node_modules/core-js/internals/array-species-create.js","node_modules/core-js/internals/array-iteration.js","node_modules/core-js/modules/es.symbol.js","node_modules/core-js/modules/es.symbol.description.js","node_modules/core-js/modules/es.symbol.iterator.js","node_modules/core-js/internals/array-method-is-strict.js","node_modules/core-js/internals/array-method-uses-to-length.js","node_modules/core-js/internals/array-for-each.js","node_modules/core-js/modules/es.array.for-each.js","node_modules/core-js/modules/es.array.index-of.js","node_modules/core-js/internals/add-to-unscopables.js","node_modules/core-js/internals/iterators-core.js","node_modules/core-js/internals/iterators.js","node_modules/core-js/internals/correct-prototype-getter.js","node_modules/core-js/internals/object-get-prototype-of.js","node_modules/core-js/internals/create-iterator-constructor.js","node_modules/core-js/internals/a-possible-prototype.js","node_modules/core-js/internals/object-set-prototype-of.js","node_modules/core-js/internals/define-iterator.js","node_modules/core-js/modules/es.array.iterator.js","node_modules/core-js/modules/es.array.join.js","node_modules/core-js/internals/create-property.js","node_modules/core-js/internals/engine-v8-version.js","node_modules/core-js/internals/engine-user-agent.js","node_modules/core-js/internals/array-method-has-species-support.js","node_modules/core-js/modules/es.array.slice.js","node_modules/core-js/internals/to-string-tag-support.js","node_modules/core-js/internals/classof.js","node_modules/core-js/internals/object-to-string.js","node_modules/core-js/modules/es.object.to-string.js","node_modules/core-js/internals/regexp-flags.js","node_modules/core-js/internals/regexp-sticky-helpers.js","node_modules/core-js/internals/regexp-exec.js","node_modules/core-js/modules/es.regexp.exec.js","node_modules/core-js/modules/es.regexp.to-string.js","node_modules/core-js/internals/string-multibyte.js","node_modules/core-js/modules/es.string.iterator.js","node_modules/core-js/internals/fix-regexp-well-known-symbol-logic.js","node_modules/core-js/internals/advance-string-index.js","node_modules/core-js/internals/regexp-exec-abstract.js","node_modules/core-js/modules/es.string.replace.js","node_modules/core-js/internals/same-value.js","node_modules/core-js/modules/es.string.search.js","node_modules/core-js/internals/is-regexp.js","node_modules/core-js/internals/species-constructor.js","node_modules/core-js/modules/es.string.split.js","node_modules/core-js/internals/dom-iterables.js","node_modules/core-js/modules/web.dom-collections.for-each.js","node_modules/core-js/modules/web.dom-collections.iterator.js","node_modules/core-js/internals/native-url.js","node_modules/core-js/internals/an-instance.js","node_modules/core-js/internals/object-assign.js","node_modules/core-js/internals/call-with-safe-iteration-closing.js","node_modules/core-js/internals/is-array-iterator-method.js","node_modules/core-js/internals/get-iterator-method.js","node_modules/core-js/internals/array-from.js","node_modules/core-js/internals/string-punycode-to-ascii.js","node_modules/core-js/internals/redefine-all.js","node_modules/core-js/internals/get-iterator.js","node_modules/core-js/modules/web.url-search-params.js","node_modules/core-js/modules/web.url.js","node_modules/url-polyfill/url-polyfill.js","node_modules/core-js/modules/es.array.concat.js","node_modules/core-js/modules/es.array.filter.js","node_modules/core-js/modules/es.array.find.js","node_modules/core-js/internals/check-correctness-of-iteration.js","node_modules/core-js/modules/es.array.from.js","node_modules/core-js/modules/es.array.includes.js","node_modules/core-js/modules/es.array.map.js","node_modules/core-js/internals/inherit-if-required.js","node_modules/core-js/internals/whitespaces.js","node_modules/core-js/internals/string-trim.js","node_modules/core-js/modules/es.number.constructor.js","node_modules/core-js/modules/es.object.keys.js","node_modules/core-js/internals/not-a-regexp.js","node_modules/core-js/internals/correct-is-regexp-logic.js","node_modules/core-js/modules/es.string.includes.js","node_modules/core-js/internals/freezing.js","node_modules/core-js/internals/internal-metadata.js","node_modules/core-js/internals/iterate.js","node_modules/core-js/internals/collection.js","node_modules/core-js/internals/collection-weak.js","node_modules/core-js/modules/es.weak-map.js","node_modules/core-js/modules/es.array.every.js","node_modules/core-js/modules/es.object.assign.js","node_modules/core-js/internals/string-trim-forced.js","node_modules/core-js/modules/es.string.trim.js","node_modules/core-js/modules/es.array.some.js","node_modules/core-js/internals/this-number-value.js","node_modules/core-js/internals/string-repeat.js","node_modules/core-js/modules/es.number.to-fixed.js","node_modules/core-js/internals/object-to-array.js","node_modules/core-js/modules/es.object.entries.js","node_modules/core-js/modules/es.object.values.js","node_modules/core-js/modules/es.number.is-nan.js","node_modules/core-js/modules/es.object.get-own-property-descriptor.js","node_modules/rangetouch/dist/rangetouch.mjs","node_modules/core-js/modules/es.object.get-own-property-descriptors.js","node_modules/core-js/modules/es.string.match.js","node_modules/core-js/internals/task.js","node_modules/core-js/internals/native-promise-constructor.js","node_modules/core-js/internals/set-species.js","node_modules/core-js/internals/engine-is-ios.js","node_modules/core-js/internals/microtask.js","node_modules/core-js/modules/es.promise.js","node_modules/core-js/internals/new-promise-capability.js","node_modules/core-js/internals/promise-resolve.js","node_modules/core-js/internals/host-report-errors.js","node_modules/core-js/internals/perform.js","node_modules/core-js/modules/es.string.starts-with.js","src/js/utils/is.js","src/js/utils/animation.js","src/js/utils/browser.js","node_modules/core-js/internals/array-reduce.js","node_modules/core-js/modules/es.array.reduce.js","src/js/utils/objects.js","src/js/utils/elements.js","src/js/support.js","src/js/utils/events.js","src/js/utils/promise.js","src/js/utils/style.js","src/js/html5.js","src/js/utils/arrays.js","node_modules/core-js/modules/es.regexp.constructor.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","node_modules/core-js/modules/es.math.trunc.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","node_modules/core-js/internals/math-sign.js","src/js/utils/load-image.js","node_modules/core-js/modules/es.math.sign.js","src/js/ui.js","src/js/listeners.js","node_modules/core-js/modules/es.array.splice.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","node_modules/core-js/modules/es.array.find-index.js","node_modules/core-js/internals/array-last-index-of.js","node_modules/core-js/modules/es.array.last-index-of.js","src/js/plugins/preview-thumbnails.js","src/js/source.js","src/js/utils/numbers.js","src/js/plyr.js"],"names":["navigator","window","ce","CustomEvent","cancelable","preventDefault","defaultPrevented","Error","e","event","params","evt","origPrevent","bubbles","document","createEvent","initCustomEvent","detail","call","this","Object","defineProperty","get","prototype","Event","commonjsGlobal","globalThis","global","self","createCommonjsModule","fn","module","exports","check","it","Math","global_1","Function","fails","exec","error","descriptors","nativePropertyIsEnumerable","propertyIsEnumerable","getOwnPropertyDescriptor","NASHORN_BUG","1","f","V","descriptor","enumerable","objectPropertyIsEnumerable","createPropertyDescriptor","bitmap","value","configurable","writable","toString","classofRaw","slice","split","indexedObject","classof","requireObjectCoercible","undefined","TypeError","toIndexedObject","IndexedObject","isObject","toPrimitive","input","PREFERRED_STRING","val","valueOf","hasOwnProperty","has","key","EXISTS","createElement","documentCreateElement","ie8DomDefine","DESCRIPTORS","a","nativeGetOwnPropertyDescriptor","f$1","O","P","IE8_DOM_DEFINE","propertyIsEnumerableModule","objectGetOwnPropertyDescriptor","anObject","String","nativeDefineProperty","f$2","Attributes","objectDefineProperty","createNonEnumerableProperty","object","definePropertyModule","setGlobal","SHARED","store","sharedStore","functionToString","inspectSource","set","WeakMap","nativeWeakMap","test","isPure","shared","push","version","mode","copyright","id","postfix","random","uid","keys","sharedKey","hiddenKeys","enforce","getterFor","TYPE","state","type","NATIVE_WEAK_MAP","wmget","wmhas","wmset","metadata","STATE","objectHas","activeXDocument","internalState","redefine","getInternalState","InternalStateModule","enforceInternalState","TEMPLATE","options","unsafe","simple","noTargetGet","source","join","path","aFunction","variable","getBuiltIn","namespace","method","arguments","length","ceil","floor","toInteger","argument","isNaN","min","toLength","max","toAbsoluteIndex","index","integer","createMethod","IS_INCLUDES","$this","el","fromIndex","arrayIncludes","includes","indexOf","require$$0","objectKeysInternal","names","i","result","enumBugKeys","concat","f$3","getOwnPropertyNames","internalObjectKeys","objectGetOwnPropertyNames","f$4","getOwnPropertySymbols","objectGetOwnPropertySymbols","ownKeys","getOwnPropertyNamesModule","getOwnPropertySymbolsModule","copyConstructorProperties","target","getOwnPropertyDescriptorModule","replacement","isForced","feature","detection","data","normalize","POLYFILL","NATIVE","string","replace","toLowerCase","isForced_1","_export","targetProperty","sourceProperty","TARGET","GLOBAL","STATIC","stat","forced","sham","nativeSymbol","Symbol","useSymbolAsUid","NATIVE_SYMBOL","iterator","isArray","Array","arg","toObject","objectKeys","objectDefineProperties","defineProperties","Properties","html","GT","LT","PROTOTYPE","SCRIPT","IE_PROTO","EmptyConstructor","scriptTag","content","NullProtoObjectViaActiveX","write","close","temp","parentWindow","NullProtoObjectViaIFrame","iframeDocument","iframe","JS","style","display","appendChild","src","contentWindow","open","F","NullProtoObject","domain","ActiveXObject","objectCreate","create","nativeGetOwnPropertyNames","windowNames","getWindowNames","f$5","objectGetOwnPropertyNamesExternal","WellKnownSymbolsStore","createWellKnownSymbol","USE_SYMBOL_AS_UID","withoutSetter","wellKnownSymbol","name","f$6","wellKnownSymbolWrapped","defineWellKnownSymbol","NAME","wrappedWellKnownSymbolModule","TO_STRING_TAG","setToStringTag","TAG","aFunction$1","functionBindContext","that","b","c","apply","SPECIES","arraySpeciesCreate","originalArray","C","constructor","IS_MAP","IS_FILTER","IS_SOME","IS_EVERY","IS_FIND_INDEX","NO_HOLES","callbackfn","specificCreate","boundFunction","bind","arrayIteration","forEach","map","filter","some","every","find","findIndex","$forEach","HIDDEN","SYMBOL","TO_PRIMITIVE","setInternalState","ObjectPrototype","$Symbol","$stringify","getOwnPropertyNamesExternal","AllSymbols","ObjectPrototypeSymbols","StringToSymbolRegistry","SymbolToStringRegistry","QObject","USE_SETTER","findChild","setSymbolDescriptor","nativeObjectCreate","ObjectPrototypeDescriptor","wrap","tag","description","symbol","isSymbol","$defineProperty","$defineProperties","properties","$getOwnPropertySymbols","$propertyIsEnumerable","$create","$getOwnPropertyDescriptor","$getOwnPropertyNames","IS_OBJECT_PROTOTYPE","setter","$","for","keyFor","sym","useSetter","useSimple","FORCED_JSON_STRINGIFY","stringify","replacer","space","$replacer","args","NativeSymbol","EmptyStringDescriptionStore","SymbolWrapper","symbolPrototype","symbolToString","native","regexp","desc","arrayMethodIsStrict","METHOD_NAME","cache","thrower","arrayMethodUsesToLength","ACCESSORS","argument0","argument1","STRICT_METHOD","USES_TO_LENGTH","arrayForEach","proto","$indexOf","nativeIndexOf","NEGATIVE_ZERO","searchElement","UNSCOPABLES","ArrayPrototype","IteratorPrototype","PrototypeOfArrayIteratorPrototype","arrayIterator","addToUnscopables","iterators","correctPrototypeGetter","getPrototypeOf","objectGetPrototypeOf","CORRECT_PROTOTYPE_GETTER","ITERATOR","BUGGY_SAFARI_ITERATORS","returnThis","iteratorsCore","createIteratorConstructor","IteratorConstructor","next","Iterators","aPossiblePrototype","objectSetPrototypeOf","setPrototypeOf","CORRECT_SETTER","__proto__","IteratorsCore","KEYS","VALUES","ENTRIES","defineIterator","Iterable","DEFAULT","IS_SET","FORCED","CurrentIteratorPrototype","methods","KEY","getIterationMethod","KIND","defaultIterator","IterablePrototype","INCORRECT_VALUES_NAME","nativeIterator","anyNativeIterator","entries","values","ARRAY_ITERATOR","es_array_iterator","iterated","kind","done","Arguments","nativeJoin","ES3_STRINGS","separator","match","createProperty","propertyKey","engineUserAgent","process","versions","v8","userAgent","engineV8Version","arrayMethodHasSpeciesSupport","V8_VERSION","array","foo","Boolean","HAS_SPECIES_SUPPORT","0","nativeSlice","start","end","Constructor","n","k","fin","toStringTagSupport","CORRECT_ARGUMENTS","tryGet","TO_STRING_TAG_SUPPORT","callee","objectToString","regexpFlags","ignoreCase","multiline","dotAll","unicode","sticky","RE","s","RegExp","UNSUPPORTED_Y","re","lastIndex","BROKEN_CARET","regexpStickyHelpers","nativeExec","nativeReplace","patchedExec","UPDATES_LAST_INDEX_WRONG","re1","re2","stickyHelpers","NPCG_INCLUDED","PATCH","str","reCopy","flags","charsAdded","strCopy","regexpExec","TO_STRING","RegExpPrototype","nativeToString","NOT_GENERIC","INCORRECT_NAME","R","p","rf","CONVERT_TO_STRING","pos","first","second","S","position","size","charCodeAt","charAt","stringMultibyte","codeAt","STRING_ITERATOR","point","REPLACE_SUPPORTS_NAMED_GROUPS","groups","REPLACE_KEEPS_$0","REPLACE","REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE","SPLIT_WORKS_WITH_OVERWRITTEN_EXEC","originalExec","fixRegexpWellKnownSymbolLogic","DELEGATES_TO_SYMBOL","DELEGATES_TO_EXEC","execCalled","nativeRegExpMethod","nativeMethod","arg2","forceStringMethod","stringMethod","regexMethod","advanceStringIndex","regexpExecAbstract","SUBSTITUTION_SYMBOLS","SUBSTITUTION_SYMBOLS_NO_NAMED","maybeToString","fixRegExpWellKnownSymbolLogic","maybeCallNative","reason","UNSAFE_SUBSTITUTE","searchValue","replaceValue","res","rx","functionalReplace","fullUnicode","results","regExpExec","accumulatedResult","nextSourcePosition","matched","captures","j","namedCaptures","replacerArgs","getSubstitution","tailPos","m","symbols","ch","capture","sameValue","is","x","y","SEARCH","nativeSearch","searcher","previousLastIndex","MATCH","isRegexp","isRegExp","speciesConstructor","defaultConstructor","arrayPush","MAX_UINT32","SUPPORTS_Y","SPLIT","nativeSplit","internalSplit","limit","lim","lastLength","output","lastLastIndex","separatorCopy","splitter","unicodeMatching","callRegExpExec","q","A","z","domIterables","CSSRuleList","CSSStyleDeclaration","CSSValueList","ClientRectList","DOMRectList","DOMStringList","DOMTokenList","DataTransferItemList","FileList","HTMLAllCollection","HTMLCollection","HTMLFormElement","HTMLSelectElement","MediaList","MimeTypeArray","NamedNodeMap","NodeList","PaintRequestList","Plugin","PluginArray","SVGLengthList","SVGNumberList","SVGPathSegList","SVGPointList","SVGStringList","SVGTransformList","SourceBufferList","StyleSheetList","TextTrackCueList","TextTrackList","TouchList","COLLECTION_NAME","DOMIterables","Collection","CollectionPrototype","ArrayValues","ArrayIteratorMethods","nativeUrl","url","URL","searchParams","pathname","IS_PURE","toJSON","sort","href","URLSearchParams","username","host","hash","anInstance","nativeAssign","assign","objectAssign","B","chr","T","argumentsLength","callWithSafeIterationClosing","returnMethod","isArrayIteratorMethod","getIteratorMethod","arrayFrom","arrayLike","step","mapfn","mapping","iteratorMethod","maxInt","base","tMin","tMax","skew","damp","initialBias","initialN","delimiter","regexNonASCII","regexSeparators","OVERFLOW_ERROR","baseMinusTMin","stringFromCharCode","fromCharCode","ucs2decode","counter","extra","digitToBasic","digit","adapt","delta","numPoints","firstTime","encode","currentValue","inputLength","bias","basicLength","handledCPCount","handledCPCountPlusOne","RangeError","t","qMinusT","baseMinusT","stringPunycodeToAscii","label","encoded","labels","redefineAll","getIterator","$fetch","Headers","URL_SEARCH_PARAMS","URL_SEARCH_PARAMS_ITERATOR","getInternalParamsState","getInternalIteratorState","plus","sequences","percentSequence","bytes","percentDecode","sequence","decodeURIComponent","deserialize","!","'","(",")","~","%20","serialize","encodeURIComponent","parseSearchParams","query","attribute","entry","attributes","shift","updateSearchParams","validateArgumentsLength","passed","required","URLSearchParamsIterator","URLSearchParamsConstructor","entryIterator","entryNext","init","updateURL","hasOwn","URLSearchParamsPrototype","append","delete","splice","getAll","found","entriesIndex","sliceIndex","callback","USE_NATIVE_URL","fetch","body","headers","EOF","web_urlSearchParams","getState","require$$1","NativeURL","URLSearchParamsModule","getInternalSearchParamsState","getInternalURLState","pow","INVALID_AUTHORITY","INVALID_SCHEME","INVALID_HOST","INVALID_PORT","ALPHA","ALPHANUMERIC","DIGIT","HEX_START","OCT","DEC","HEX","FORBIDDEN_HOST_CODE_POINT","FORBIDDEN_HOST_CODE_POINT_EXCLUDING_PERCENT","LEADING_AND_TRAILING_C0_CONTROL_OR_SPACE","TAB_AND_NEW_LINE","parseHost","codePoints","parseIPv6","isSpecial","toASCII","parseIPv4","percentEncode","C0ControlPercentEncodeSet","partsLength","numbers","part","radix","number","ipv4","parts","pop","parseInt","numbersSeen","ipv4Piece","swaps","swap","address","pieceIndex","compress","pointer","char","findLongestZeroSequence","ipv6","maxIndex","maxLength","currStart","currLength","serializeHost","ignore0","unshift","fragmentPercentEncodeSet"," ","\"","<",">","`","pathPercentEncodeSet","#","?","{","}","userinfoPercentEncodeSet","/",":",";","=","@","[","\\","]","^","|","code","specialSchemes","ftp","file","http","https","ws","wss","scheme","includesCredentials","password","cannotHaveUsernamePasswordPort","cannotBeABaseURL","isWindowsDriveLetter","normalized","startsWithWindowsDriveLetter","third","shortenURLsPath","pathSize","isSingleDot","segment","isDoubleDot","SCHEME_START","SCHEME","NO_SCHEME","SPECIAL_RELATIVE_OR_AUTHORITY","PATH_OR_AUTHORITY","RELATIVE","RELATIVE_SLASH","SPECIAL_AUTHORITY_SLASHES","SPECIAL_AUTHORITY_IGNORE_SLASHES","AUTHORITY","HOST","HOSTNAME","PORT","FILE","FILE_SLASH","FILE_HOST","PATH_START","PATH","CANNOT_BE_A_BASE_URL_PATH","QUERY","FRAGMENT","parseURL","stateOverride","bufferCodePoints","failure","buffer","seenAt","seenBracket","seenPasswordToken","port","fragment","codePoint","encodedCodePoints","URLConstructor","baseState","urlString","searchParamsState","serializeURL","origin","getOrigin","protocol","getProtocol","getUsername","getPassword","getHost","hostname","getHostname","getPort","getPathname","search","getSearch","getSearchParams","getHash","URLPrototype","accessorDescriptor","getter","nativeCreateObjectURL","createObjectURL","nativeRevokeObjectURL","revokeObjectURL","blob","_typeof","obj","_classCallCheck","instance","_defineProperties","props","_createClass","protoProps","staticProps","_defineProperty","ownKeys$1","enumerableOnly","_objectSpread2","getOwnPropertyDescriptors","_objectWithoutPropertiesLoose","excluded","sourceKeys","_objectWithoutProperties","sourceSymbolKeys","_slicedToArray","arr","_arrayWithHoles","_iterableToArrayLimit","_unsupportedIterableToArray","_nonIterableRest","_toConsumableArray","_arrayWithoutHoles","_iterableToArray","_nonIterableSpread","_arrayLikeToArray","iter","from","_arr","_n","_d","_e","_s","_i","err","o","minLen","len","arr2","iteratorSupported","checkIfIteratorIsSupported","createIterator","items","serializeParam","deserializeParam","checkIfURLSearchParamsSupported","searchString","typeofSearchString","_fromString","_this","_entries","thisArg","searchArray","polyfillURLSearchParams","u","checkIfURLIsSupported","_URL","baseElement","doc","location","implementation","createHTMLDocument","head","anchorElement","inputElement","checkValidity","enableSearchUpdate","enableSearchParamsUpdate","methodName","attributeName","_anchorElement","linkURLWithAnchorAttribute","_updateSearchParams","expectedPort","http:","https:","ftp:","addPortToOrigin","polyfillURL","setInterval","IS_CONCAT_SPREADABLE","MAX_SAFE_INTEGER","MAXIMUM_ALLOWED_INDEX_EXCEEDED","IS_CONCAT_SPREADABLE_SUPPORT","SPECIES_SUPPORT","isConcatSpreadable","spreadable","E","$filter","$find","FIND","SKIPS_HOLES","SAFE_CLOSING","called","iteratorWithReturn","return","checkCorrectnessOfIteration","SKIP_CLOSING","ITERATION_SUPPORT","INCORRECT_ITERATION","iterable","$includes","$map","inheritIfRequired","dummy","Wrapper","NewTarget","NewTargetPrototype","whitespaces","whitespace","ltrim","rtrim","stringTrim","trim","require$$2","require$$3","NUMBER","NativeNumber","NumberPrototype","BROKEN_CLASSOF","toNumber","maxCode","digits","NaN","NumberWrapper","FAILS_ON_PRIMITIVES","nativeKeys","notARegexp","correctIsRegexpLogic","correctIsRegExpLogic","notARegExp","freezing","isExtensible","preventExtensions","internalMetadata","METADATA","setMetadata","objectID","weakData","meta","REQUIRED","fastKey","getWeakData","onFreeze","FREEZING","internalMetadata_1","internalMetadata_2","internalMetadata_3","internalMetadata_4","iterate_1","Result","stopped","AS_ENTRIES","IS_ITERATOR","iterFn","stop","collection","CONSTRUCTOR_NAME","wrapper","common","IS_WEAK","ADDER","NativeConstructor","NativePrototype","exported","fixMethod","getConstructor","InternalMetadataModule","HASNT_CHAINING","THROWS_ON_PRIMITIVES","ACCEPT_ITERABLES","BUGGY_ZERO","$instance","iterate","clear","setStrong","internalStateGetterFor","ArrayIterationModule","uncaughtFrozenStore","frozen","UncaughtFrozenStore","findUncaughtFrozen","collectionWeak","define","$has","add","es_weakMap","InternalWeakMap","enforceIternalState","IS_IE11","$WeakMap","WeakMapPrototype","nativeDelete","nativeHas","nativeGet","nativeSet","$every","non","stringTrimForced","$trim","forcedStringTrimMethod","$some","thisNumberValue","stringRepeat","repeat","count","Infinity","nativeToFixed","toFixed","acc","log","x2","fractionDigits","fractDigits","sign","multiply","c2","divide","dataToString","TO_ENTRIES","objectToArray","$entries","$values","r","nativeMatch","matcher","matchStr","defaults","addCSS","thumbWidth","watch","matches","querySelectorAll","trigger","dispatchEvent","instanceOf","isNullOrUndefined","isNumber","Number","isString","isBoolean","isFunction","isNodeList","isElement","Element","isEvent","isEmpty","nullOrUndefined","boolean","function","nodeList","element","empty","getDecimalPlaces","round","parseFloat","defer","channel","RangeTouch","querySelector","rangeTouch","config","enabled","userSelect","webKitUserSelect","touchAction","listeners","changedTouches","getAttribute","getBoundingClientRect","width","clientX","left","disabled","MutationObserver","addedNodes","observe","childList","subtree","documentElement","nativePromiseConstructor","Promise","setSpecies","engineIsIos","setImmediate","clearImmediate","MessageChannel","Dispatch","queue","ONREADYSTATECHANGE","run","runner","listener","post","postMessage","nextTick","now","IS_IOS","port2","port1","onmessage","addEventListener","importScripts","removeChild","setTimeout","flush","last","notify","toggle","node","promise","then","task","macrotask","WebKitMutationObserver","IS_NODE","queueMicrotaskDescriptor","queueMicrotask","parent","exit","enter","createTextNode","characterData","resolve","Internal","OwnPromiseCapability","PromiseWrapper","nativeThen","microtask","PromiseCapability","reject","$$resolve","$$reject","f$7","newPromiseCapability","promiseResolve","promiseCapability","hostReportErrors","console","perform","PROMISE","getInternalPromiseState","PromiseConstructor","NativePromise","newPromiseCapabilityModule","newGenericPromiseCapability","DISPATCH_EVENT","UNHANDLED_REJECTION","REJECTION_HANDLED","PENDING","FULFILLED","REJECTED","HANDLED","UNHANDLED","PromiseRejectionEvent","FakePromise","all","isThenable","isReject","notified","chain","reactions","ok","exited","reaction","handler","fail","rejection","onHandleUnhandled","onUnhandled","initEvent","isUnhandled","emit","unwrap","internalReject","internalResolve","executor","onFulfilled","onRejected","catch","capability","$promiseResolve","remaining","alreadyCalled","race","nativeStartsWith","startsWith","CORRECT_IS_REGEXP_LOGIC","MDN_POLYFILL_BUG","isWeakMap","isTextNode","Text","isKeyboardEvent","KeyboardEvent","isCue","TextTrackCue","VTTCue","isTrack","TextTrack","isPromise","isUrl","is$1","weakMap","textNode","keyboardEvent","cue","track","transitionEndEvent","events","WebkitTransition","MozTransition","OTransition","transition","repaint","delay","hidden","offsetHeight","browser","isIE","documentMode","isEdge","isWebkit","isIPhone","platform","isIos","IS_RIGHT","memo","arrayReduce","right","$reduce","cloneDeep","JSON","parse","getDeep","reduce","extend","_len","sources","_key","elements","targets","reverse","child","cloneNode","parentNode","sibling","nextSibling","insertBefore","setAttributes","_ref","_ref3","_ref4","setAttribute","text","innerText","insertAfter","insertElement","removeElement","emptyElement","childNodes","lastChild","replaceElement","newChild","oldChild","replaceChild","getAttributesFromSelector","sel","existingAttributes","existing","selector","className","class","toggleHidden","hide","toggleClass","force","classList","contains","hasClass","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","closest","parentElement","nodeType","getElements","container","getElement","setFocus","tabFocus","focus","preventScroll","classNames","defaultCodecs","audio/ogg","audio/wav","video/webm","video/mp4","video/ogg","support","audio","video","provider","playsinline","canPlayInline","api","ui","rangeInput","pip","webkitSetPresentationMode","pictureInPictureEnabled","disablePictureInPicture","airplay","WebKitPlaybackTargetAvailabilityEvent","mime","mediaType","isHTML5","media","canPlayType","textTracks","range","touch","transitions","reducedMotion","matchMedia","supportsPassiveListeners","supported","removeEventListener","toggleListener","passive","eventListeners","on","off","once","_this2","onceCallback","triggerEvent","plyr","unbindListeners","item","ready","_this3","silencePromise","validateRatio","reduceAspectRatio","ratio","_ratio","height","divider","getDivider","w","h","getAspectRatio","embed","_this$media","videoWidth","videoHeight","setAspectRatio","isVideo","_ref2","padding","paddingBottom","isVimeo","vimeo","premium","offsetWidth","getComputedStyle","offset","transform","videoFixedRatio","html5","getSources","getQualityOptions","quality","setup","player","speed","onChange","_player$media","currentTime","paused","preload","readyState","playbackRate","play","load","cancelRequests","blankVideo","debug","dedupe","prev","curr","abs","NativeRegExp","CORRECT_NEW","RegExpWrapper","pattern","thisIsRegExp","patternIsRegExp","flagsAreUndefined","getFlags","proxy","generateId","prefix","format","getPercentage","current","replaceAll","toTitleCase","toUpperCase","substr","toPascalCase","toCamelCase","stripHTML","createDocumentFragment","innerHTML","firstChild","getHTML","resources","youtube","i18n","{seektime}","seekTime","{title}","title","v","Storage","storage","localStorage","getItem","json","setItem","removeItem","responseType","request","XMLHttpRequest","responseText","response","status","send","loadSprite","hasId","exists","getElementById","update","insertAdjacentElement","useStorage","cached","trunc","getHours","getMinutes","getSeconds","formatTime","time","displayHours","inverted","hours","mins","secs","controls","getIconUrl","cors","iconUrl","svg4everybody","findElements","selectors","buttons","pause","restart","rewind","fastForward","mute","settings","captions","fullscreen","progress","inputs","seek","volume","duration","seekTooltip","tooltip","warn","toggleNativeControls","createIcon","iconPath","iconPrefix","icon","createElementNS","aria-hidden","focusable","use","setAttributeNS","createLabel","attr","createBadge","badge","menu","createButton","buttonType","labelPressed","iconPressed","control","button","createRange","autocomplete","role","aria-label","aria-valuemin","aria-valuemax","aria-valuenow","updateRangeFill","createProgress","suffixKey","played","suffix","createTime","attrs","bindMenuItemShortcuts","menuItem","which","stopPropagation","isRadioButton","showMenuPanel","nextElementSibling","firstElementChild","previousElementSibling","lastElementChild","focusFirstMenuItem","createMenuItem","list","_ref$badge","_ref$checked","checked","aria-checked","flex","children","currentTrack","forceHours","updateTimeDisplay","updateVolume","setRange","muted","pressed","updateProgress","_this4","getElementsByTagName","nodeValue","setProgress","buffered","percent","setProperty","updateSeekTooltip","_this5","tooltips","visible","show","clientRect","pageX","timeUpdate","invert","invertTime","seeking","durationUpdate","hasDuration","displayDuration","toggleMenuButton","setting","updateSetting","pane","panels","default","getLabel","setQualityMenu","_this6","checkMenu","getBadge","sorting","setCaptionsMenu","_this7","tracks","getTracks","toggled","language","setSpeedMenu","_this8","minimumSpeed","maximumSpeed","popup","firstItem","toggleMenu","composedPath","isMenuItem","getMenuSize","tab","clone","opacity","removeAttribute","scrollWidth","scrollHeight","_this9","restore","propertyName","setDownloadUrl","download","_this10","defaultAttributes","progressContainer","aria-haspopup","aria-controls","aria-expanded","inner","home","backButton","urls","isEmbed","inject","_this11","seektime","addProperty","controlPressed","_this$config","parseUrl","safe","parser","buildUrlParams","isYouTube","languages","userLanguage","active","trackEvents","_this$captions","currentTrackNode","languageExists","updateCues","setLanguage","activeClass","findTrack","enableTextTrack","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","reset","advertisement","qualityBadge","2160","1440","1080","720","576","480","sdk","googleIMA","editable","embedContainer","poster","posterEnabled","ads","playing","loading","hover","isTouch","uiSupported","noTransition","previewThumbnails","thumbContainer","thumbContainerShown","imageContainer","timeContainer","scrubbingContainer","scrubbingContainerShown","publisherId","tagUrl","byline","portrait","transparent","referrerPolicy","noCookie","rel","showinfo","iv_load_policy","modestbranding","inactive","providers","types","getProviderByUrl","noop","Console","Fullscreen","property","scrollPosition","forceFallback","trapFocus","scrollX","scrollY","scrollTo","overflow","viewport","hasProperty","cleanupViewport","keyCode","activeElement","shiftKey","webkitEnterFullscreen","toggleFallback","requestFullscreen","navigationUI","webkitExitFullscreen","action","cancelFullScreen","fullscreenElement","shadowRoot","getRootNode","fullscreenEnabled","webkitFullscreenEnabled","mozFullScreenEnabled","msFullscreenEnabled","pre","mathSign","loadImage","minWidth","image","Image","onload","onerror","naturalWidth","addStyleHook","build","checkPlaying","setTitle","setPoster","togglePoster","enable","backgroundImage","backgroundSize","toggleControls","checkLoading","clearTimeout","timers","controlsElement","recentTouchSeek","lastSeekTime","Date","migrateStyles","getPropertyValue","removeProperty","Listeners","lastKey","focusTimer","lastKeyDown","handleKey","setTabFocus","firstTouch","altKey","ctrlKey","metaKey","togglePlay","increaseVolume","decreaseVolume","forward","toggleCaptions","usingNative","timeStamp","wasKeyDown","setPlayerSize","measure","rect","resized","_player$fullscreen","isEnter","_setPlayerSize","_getAspectRatio$call2","videoX","videoY","maxWidth","margin","setGutter","isAudio","ended","proxyEvents","_event$detail","defaultHandler","customHandlerKey","customHandler","returned","hasCustomHandler","inputEvent","currentTarget","hasAttribute","seekTo","loaded","startMove","endMove","startScrubbing","endScrubbing","webkitDirectionInvertedFromDevice","_map2","deltaX","deltaY","direction","MAXIMUM_ALLOWED_LENGTH_EXCEEDED","deleteCount","insertCount","actualDeleteCount","to","actualStart","loadjs_umd","devnull","bundleIdCache","bundleResultCache","bundleCallbackQueue","publish","bundleId","pathsNotFound","executeCallbacks","depsNotFound","success","loadFile","callbackFn","numTries","isLegacyIECss","async","maxTries","numRetries","beforeCallbackFn","before","pathStripped","relList","as","onbeforeload","ev","sheet","cssText","loadjs","paths","arg1","loadFn","numWaiting","loadFiles","returnPromise","deps","bundleIds","subscribe","isDefined","factory","loadScript","parseId","$2","assurePlaybackState","hasPlayed","Vimeo","frameParams","sidedock","gesture","data-poster","thumbnail_large","Player","disableTextTrack","restorePause","setVolume","setCurrentTime","setPlaybackRate","currentSrc","setLoop","getVideoUrl","getVideoWidth","getVideoHeight","dimensions","_dimensions","setAutopause","getVideoTitle","getCurrentTime","getDuration","getTextTracks","_ref$cues","strippedCues","getPaused","seconds","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","getPlaybackRate","onReady","playVideo","pauseVideo","stopVideo","speeds","getAvailablePlaybackRates","clearInterval","buffering","getVideoLoadedFraction","lastBuffered","onStateChange","unMute","destroy","manager","displayContainer","remove","Ads","initialized","loader","cuePoints","safetyTimer","countdownTimer","managerPromise","google","ima","startSafetyTimer","clearSafetyTimer","setupIMA","setVpaidMode","ImaSdkSettings","VpaidMode","ENABLED","setLocale","setDisableCustomPlaybackForIOS10Plus","AdDisplayContainer","AdsLoader","AdsManagerLoadedEvent","Type","ADS_MANAGER_LOADED","onAdsManagerLoaded","AdErrorEvent","AD_ERROR","onAdError","requestAds","AdsRequest","adTagUrl","linearAdSlotWidth","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","contentComplete","CONTENT_PAUSE_REQUESTED","pauseContent","CONTENT_RESUME_REQUESTED","resumeContent","LOG","adError","getMessage","cancel","addCuePoints","seekedTime","discardAdBreak","resize","ViewMode","NORMAL","initialize","zIndex","_this12","handlers","_this13","AV_PUBLISHERID","AV_CHANNELID","AV_URL","cb","AV_WIDTH","AV_HEIGHT","AV_CDIM2","$findIndex","FIND_INDEX","nativeLastIndexOf","lastIndexOf","arrayLastIndexOf","parseVtt","vttDataString","processedList","frame","line","startTime","lineSplit","_lineSplit","_lineSplit$1$split2","matchTimes","endTime","fitRatio","outer","PreviewThumbnails","thumbnails","lastMouseMoveTime","mouseDown","loadedImages","thumb","scrubbing","getThumbnails","render","determineContainerAutoSizing","sortAndResolve","promises","getThumbnail","thumbnail","frames","urlPrefix","substring","tempImage","naturalHeight","percentage","mousePosX","showImageAtCurrentTime","toggleThumbContainer","toggleScrubbingContainer","lastTime","setScrubbingContainerSize","setThumbContainerSizeAndPos","thumbNum","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","clientWidth","sizeSpecifiedInCSS","thumbAspectRatio","thumbHeight","setThumbContainerPos","seekbarRect","plyrRect","minVal","maxVal","previewPos","_fitRatio","multiplier","top","currentScrubbingImageElement","currentThumbnailImageElement","insertElements","change","_sources$","_sources$$provider","crossorigin","clamp","Plyr","failed","jQuery","original","truthy","tabindex","webkitShowPlaybackTargetPicker","isHidden","hiding","eventName","soft","unload","inputIsValid","fauxDuration","realDuration","mozHasAudio","webkitAudioDecodedByteCount","audioTracks","updateStorage","requestPictureInPicture","exitPictureInPicture","webkitPresentationMode","pictureInPictureElement","inline"],"mappings":"AAAqB,iBAAdA,WCMP,WACE,GAAsB,oBAAXC,OAIX,IACE,IAAIC,EAAK,IAAID,OAAOE,YAAY,OAAQ,CAAEC,YAAY,IAEtD,GADAF,EAAGG,kBACyB,IAAxBH,EAAGI,iBAGL,MAAM,IAAIC,MAAM,6BAElB,MAAOC,GACP,IAAIL,EAAc,SAASM,EAAOC,GAChC,IAAIC,EAAKC,EAyBT,OAxBAF,EAASA,GAAU,IACZG,UAAYH,EAAOG,QAC1BH,EAAON,aAAeM,EAAON,YAE7BO,EAAMG,SAASC,YAAY,gBACvBC,gBACFP,EACAC,EAAOG,QACPH,EAAON,WACPM,EAAOO,QAETL,EAAcD,EAAIN,eAClBM,EAAIN,eAAiB,WACnBO,EAAYM,KAAKC,MACjB,IACEC,OAAOC,eAAeF,KAAM,mBAAoB,CAC9CG,IAAK,WACH,OAAO,KAGX,MAAOd,GACPW,KAAKb,kBAAmB,IAGrBK,GAGTR,EAAYoB,UAAYtB,OAAOuB,MAAMD,UACrCtB,OAAOE,YAAcA,GA5CzB,GD8CA,IAAIsB,eAAuC,oBAAfC,WAA6BA,WAA+B,oBAAXzB,OAAyBA,OAA2B,oBAAX0B,OAAyBA,OAAyB,oBAATC,KAAuBA,KAAO,GAE7L,SAASC,qBAAqBC,EAAIC,GACjC,OAAiCD,EAA1BC,EAAS,CAAEC,QAAS,IAAiBD,EAAOC,SAAUD,EAAOC,QEvDrE,IAAIC,MAAQ,SAAUC,GACpB,OAAOA,GAAMA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1B,QAAQv2C,MAAM6F,EAAM6wC,EAAU+0B,KzN4pcpC,CACD9oE,IAAK,aACLtB,MAAO,SyNtpcS4jB,EAAK/f,GACrB,OAAOk6C,WAAWn6B,EAAK/f,KzN8pctB,CACDvC,IAAK,QACLtB,MAAO,SyNxpcIozC,GAAwB,IAAd7tC,EAAcY,UAAAC,OAAA,QAAA1F,IAAAyF,UAAA,GAAAA,UAAA,GAAJ,GAC3BorC,EAAU,KAUd,OARIhyB,KAAGnW,OAAOgqC,GACZ7B,EAAUhnC,MAAMmtB,KAAKl6B,SAAS+mC,iBAAiB6O,IACtC7zB,KAAGkmB,SAAS2N,GACrB7B,EAAUhnC,MAAMmtB,KAAK0b,GACZ7zB,KAAGpH,MAAMi7B,KAClB7B,EAAU6B,EAAS7jC,OAAOgQ,KAAGmmB,UAG3BnmB,KAAGomB,MAAM4L,GACJ,KAGFA,EAAQjiC,KAAI,SAAAoY,GAAC,OAAI,IAAImhD,EAAKnhD,EAAGniB,UzN+pc/BsjE,EyN31eHA,GAgsCNA,KAAK3kC,SAAW2M,UAAU3M,2BzNkqcX2kC","file":"plyr.polyfilled.min.mjs","sourcesContent":["typeof navigator === \"object\" && // Polyfill for creating CustomEvents on IE9/10/11\n// code pulled from:\n// https://github.com/d4tocchini/customevent-polyfill\n// https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent#Polyfill\n(function () {\n if (typeof window === 'undefined') {\n return;\n }\n\n try {\n var ce = new window.CustomEvent('test', {\n cancelable: true\n });\n ce.preventDefault();\n\n if (ce.defaultPrevented !== true) {\n // IE has problems with .preventDefault() on custom events\n // http://stackoverflow.com/questions/23349191\n throw new Error('Could not prevent default');\n }\n } catch (e) {\n var CustomEvent = function CustomEvent(event, params) {\n var evt, origPrevent;\n params = params || {};\n params.bubbles = !!params.bubbles;\n params.cancelable = !!params.cancelable;\n evt = document.createEvent('CustomEvent');\n evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);\n origPrevent = evt.preventDefault;\n\n evt.preventDefault = function () {\n origPrevent.call(this);\n\n try {\n Object.defineProperty(this, 'defaultPrevented', {\n get: function get() {\n return true;\n }\n });\n } catch (e) {\n this.defaultPrevented = true;\n }\n };\n\n return evt;\n };\n\n CustomEvent.prototype = window.Event.prototype;\n window.CustomEvent = CustomEvent; // expose definition to window\n }\n})();\n\nvar commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};\n\nfunction createCommonjsModule(fn, module) {\n\treturn module = { exports: {} }, fn(module, module.exports), module.exports;\n}\n\nvar check = function (it) {\n return it && it.Math == Math && it;\n};\n\n// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028\nvar global_1 =\n // eslint-disable-next-line no-undef\n check(typeof globalThis == 'object' && globalThis) ||\n check(typeof window == 'object' && window) ||\n check(typeof self == 'object' && self) ||\n check(typeof commonjsGlobal == 'object' && commonjsGlobal) ||\n // eslint-disable-next-line no-new-func\n Function('return this')();\n\nvar fails = function (exec) {\n try {\n return !!exec();\n } catch (error) {\n return true;\n }\n};\n\n// Thank's IE8 for his funny defineProperty\nvar descriptors = !fails(function () {\n return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7;\n});\n\nvar nativePropertyIsEnumerable = {}.propertyIsEnumerable;\nvar getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;\n\n// Nashorn ~ JDK8 bug\nvar NASHORN_BUG = getOwnPropertyDescriptor && !nativePropertyIsEnumerable.call({ 1: 2 }, 1);\n\n// `Object.prototype.propertyIsEnumerable` method implementation\n// https://tc39.github.io/ecma262/#sec-object.prototype.propertyisenumerable\nvar f = NASHORN_BUG ? function propertyIsEnumerable(V) {\n var descriptor = getOwnPropertyDescriptor(this, V);\n return !!descriptor && descriptor.enumerable;\n} : nativePropertyIsEnumerable;\n\nvar objectPropertyIsEnumerable = {\n\tf: f\n};\n\nvar createPropertyDescriptor = function (bitmap, value) {\n return {\n enumerable: !(bitmap & 1),\n configurable: !(bitmap & 2),\n writable: !(bitmap & 4),\n value: value\n };\n};\n\nvar toString = {}.toString;\n\nvar classofRaw = function (it) {\n return toString.call(it).slice(8, -1);\n};\n\nvar split = ''.split;\n\n// fallback for non-array-like ES3 and non-enumerable old V8 strings\nvar indexedObject = fails(function () {\n // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346\n // eslint-disable-next-line no-prototype-builtins\n return !Object('z').propertyIsEnumerable(0);\n}) ? function (it) {\n return classofRaw(it) == 'String' ? split.call(it, '') : Object(it);\n} : Object;\n\n// `RequireObjectCoercible` abstract operation\n// https://tc39.github.io/ecma262/#sec-requireobjectcoercible\nvar requireObjectCoercible = function (it) {\n if (it == undefined) throw TypeError(\"Can't call method on \" + it);\n return it;\n};\n\n// toObject with fallback for non-array-like ES3 strings\n\n\n\nvar toIndexedObject = function (it) {\n return indexedObject(requireObjectCoercible(it));\n};\n\nvar isObject = function (it) {\n return typeof it === 'object' ? it !== null : typeof it === 'function';\n};\n\n// `ToPrimitive` abstract operation\n// https://tc39.github.io/ecma262/#sec-toprimitive\n// instead of the ES6 spec version, we didn't implement @@toPrimitive case\n// and the second argument - flag - preferred type is a string\nvar toPrimitive = function (input, PREFERRED_STRING) {\n if (!isObject(input)) return input;\n var fn, val;\n if (PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;\n if (typeof (fn = input.valueOf) == 'function' && !isObject(val = fn.call(input))) return val;\n if (!PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;\n throw TypeError(\"Can't convert object to primitive value\");\n};\n\nvar hasOwnProperty = {}.hasOwnProperty;\n\nvar has = function (it, key) {\n return hasOwnProperty.call(it, key);\n};\n\nvar document$1 = global_1.document;\n// typeof document.createElement is 'object' in old IE\nvar EXISTS = isObject(document$1) && isObject(document$1.createElement);\n\nvar documentCreateElement = function (it) {\n return EXISTS ? document$1.createElement(it) : {};\n};\n\n// Thank's IE8 for his funny defineProperty\nvar ie8DomDefine = !descriptors && !fails(function () {\n return Object.defineProperty(documentCreateElement('div'), 'a', {\n get: function () { return 7; }\n }).a != 7;\n});\n\nvar nativeGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;\n\n// `Object.getOwnPropertyDescriptor` method\n// https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptor\nvar f$1 = descriptors ? nativeGetOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {\n O = toIndexedObject(O);\n P = toPrimitive(P, true);\n if (ie8DomDefine) try {\n return nativeGetOwnPropertyDescriptor(O, P);\n } catch (error) { /* empty */ }\n if (has(O, P)) return createPropertyDescriptor(!objectPropertyIsEnumerable.f.call(O, P), O[P]);\n};\n\nvar objectGetOwnPropertyDescriptor = {\n\tf: f$1\n};\n\nvar anObject = function (it) {\n if (!isObject(it)) {\n throw TypeError(String(it) + ' is not an object');\n } return it;\n};\n\nvar nativeDefineProperty = Object.defineProperty;\n\n// `Object.defineProperty` method\n// https://tc39.github.io/ecma262/#sec-object.defineproperty\nvar f$2 = descriptors ? nativeDefineProperty : function defineProperty(O, P, Attributes) {\n anObject(O);\n P = toPrimitive(P, true);\n anObject(Attributes);\n if (ie8DomDefine) try {\n return nativeDefineProperty(O, P, Attributes);\n } catch (error) { /* empty */ }\n if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported');\n if ('value' in Attributes) O[P] = Attributes.value;\n return O;\n};\n\nvar objectDefineProperty = {\n\tf: f$2\n};\n\nvar createNonEnumerableProperty = descriptors ? function (object, key, value) {\n return objectDefineProperty.f(object, key, createPropertyDescriptor(1, value));\n} : function (object, key, value) {\n object[key] = value;\n return object;\n};\n\nvar setGlobal = function (key, value) {\n try {\n createNonEnumerableProperty(global_1, key, value);\n } catch (error) {\n global_1[key] = value;\n } return value;\n};\n\nvar SHARED = '__core-js_shared__';\nvar store = global_1[SHARED] || setGlobal(SHARED, {});\n\nvar sharedStore = store;\n\nvar functionToString = Function.toString;\n\n// this helper broken in `3.4.1-3.4.4`, so we can't use `shared` helper\nif (typeof sharedStore.inspectSource != 'function') {\n sharedStore.inspectSource = function (it) {\n return functionToString.call(it);\n };\n}\n\nvar inspectSource = sharedStore.inspectSource;\n\nvar WeakMap$1 = global_1.WeakMap;\n\nvar nativeWeakMap = typeof WeakMap$1 === 'function' && /native code/.test(inspectSource(WeakMap$1));\n\nvar isPure = false;\n\nvar shared = createCommonjsModule(function (module) {\n(module.exports = function (key, value) {\n return sharedStore[key] || (sharedStore[key] = value !== undefined ? value : {});\n})('versions', []).push({\n version: '3.6.5',\n mode: 'global',\n copyright: '© 2020 Denis Pushkarev (zloirock.ru)'\n});\n});\n\nvar id = 0;\nvar postfix = Math.random();\n\nvar uid = function (key) {\n return 'Symbol(' + String(key === undefined ? '' : key) + ')_' + (++id + postfix).toString(36);\n};\n\nvar keys = shared('keys');\n\nvar sharedKey = function (key) {\n return keys[key] || (keys[key] = uid(key));\n};\n\nvar hiddenKeys = {};\n\nvar WeakMap$2 = global_1.WeakMap;\nvar set, get, has$1;\n\nvar enforce = function (it) {\n return has$1(it) ? get(it) : set(it, {});\n};\n\nvar getterFor = function (TYPE) {\n return function (it) {\n var state;\n if (!isObject(it) || (state = get(it)).type !== TYPE) {\n throw TypeError('Incompatible receiver, ' + TYPE + ' required');\n } return state;\n };\n};\n\nif (nativeWeakMap) {\n var store$1 = new WeakMap$2();\n var wmget = store$1.get;\n var wmhas = store$1.has;\n var wmset = store$1.set;\n set = function (it, metadata) {\n wmset.call(store$1, it, metadata);\n return metadata;\n };\n get = function (it) {\n return wmget.call(store$1, it) || {};\n };\n has$1 = function (it) {\n return wmhas.call(store$1, it);\n };\n} else {\n var STATE = sharedKey('state');\n hiddenKeys[STATE] = true;\n set = function (it, metadata) {\n createNonEnumerableProperty(it, STATE, metadata);\n return metadata;\n };\n get = function (it) {\n return has(it, STATE) ? it[STATE] : {};\n };\n has$1 = function (it) {\n return has(it, STATE);\n };\n}\n\nvar internalState = {\n set: set,\n get: get,\n has: has$1,\n enforce: enforce,\n getterFor: getterFor\n};\n\nvar redefine = createCommonjsModule(function (module) {\nvar getInternalState = internalState.get;\nvar enforceInternalState = internalState.enforce;\nvar TEMPLATE = String(String).split('String');\n\n(module.exports = function (O, key, value, options) {\n var unsafe = options ? !!options.unsafe : false;\n var simple = options ? !!options.enumerable : false;\n var noTargetGet = options ? !!options.noTargetGet : false;\n if (typeof value == 'function') {\n if (typeof key == 'string' && !has(value, 'name')) createNonEnumerableProperty(value, 'name', key);\n enforceInternalState(value).source = TEMPLATE.join(typeof key == 'string' ? key : '');\n }\n if (O === global_1) {\n if (simple) O[key] = value;\n else setGlobal(key, value);\n return;\n } else if (!unsafe) {\n delete O[key];\n } else if (!noTargetGet && O[key]) {\n simple = true;\n }\n if (simple) O[key] = value;\n else createNonEnumerableProperty(O, key, value);\n// add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative\n})(Function.prototype, 'toString', function toString() {\n return typeof this == 'function' && getInternalState(this).source || inspectSource(this);\n});\n});\n\nvar path = global_1;\n\nvar aFunction = function (variable) {\n return typeof variable == 'function' ? variable : undefined;\n};\n\nvar getBuiltIn = function (namespace, method) {\n return arguments.length < 2 ? aFunction(path[namespace]) || aFunction(global_1[namespace])\n : path[namespace] && path[namespace][method] || global_1[namespace] && global_1[namespace][method];\n};\n\nvar ceil = Math.ceil;\nvar floor = Math.floor;\n\n// `ToInteger` abstract operation\n// https://tc39.github.io/ecma262/#sec-tointeger\nvar toInteger = function (argument) {\n return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor : ceil)(argument);\n};\n\nvar min = Math.min;\n\n// `ToLength` abstract operation\n// https://tc39.github.io/ecma262/#sec-tolength\nvar toLength = function (argument) {\n return argument > 0 ? min(toInteger(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991\n};\n\nvar max = Math.max;\nvar min$1 = Math.min;\n\n// Helper for a popular repeating case of the spec:\n// Let integer be ? ToInteger(index).\n// If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).\nvar toAbsoluteIndex = function (index, length) {\n var integer = toInteger(index);\n return integer < 0 ? max(integer + length, 0) : min$1(integer, length);\n};\n\n// `Array.prototype.{ indexOf, includes }` methods implementation\nvar createMethod = function (IS_INCLUDES) {\n return function ($this, el, fromIndex) {\n var O = toIndexedObject($this);\n var length = toLength(O.length);\n var index = toAbsoluteIndex(fromIndex, length);\n var value;\n // Array#includes uses SameValueZero equality algorithm\n // eslint-disable-next-line no-self-compare\n if (IS_INCLUDES && el != el) while (length > index) {\n value = O[index++];\n // eslint-disable-next-line no-self-compare\n if (value != value) return true;\n // Array#indexOf ignores holes, Array#includes - not\n } else for (;length > index; index++) {\n if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;\n } return !IS_INCLUDES && -1;\n };\n};\n\nvar arrayIncludes = {\n // `Array.prototype.includes` method\n // https://tc39.github.io/ecma262/#sec-array.prototype.includes\n includes: createMethod(true),\n // `Array.prototype.indexOf` method\n // https://tc39.github.io/ecma262/#sec-array.prototype.indexof\n indexOf: createMethod(false)\n};\n\nvar indexOf = arrayIncludes.indexOf;\n\n\nvar objectKeysInternal = function (object, names) {\n var O = toIndexedObject(object);\n var i = 0;\n var result = [];\n var key;\n for (key in O) !has(hiddenKeys, key) && has(O, key) && result.push(key);\n // Don't enum bug & hidden keys\n while (names.length > i) if (has(O, key = names[i++])) {\n ~indexOf(result, key) || result.push(key);\n }\n return result;\n};\n\n// IE8- don't enum bug keys\nvar enumBugKeys = [\n 'constructor',\n 'hasOwnProperty',\n 'isPrototypeOf',\n 'propertyIsEnumerable',\n 'toLocaleString',\n 'toString',\n 'valueOf'\n];\n\nvar hiddenKeys$1 = enumBugKeys.concat('length', 'prototype');\n\n// `Object.getOwnPropertyNames` method\n// https://tc39.github.io/ecma262/#sec-object.getownpropertynames\nvar f$3 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {\n return objectKeysInternal(O, hiddenKeys$1);\n};\n\nvar objectGetOwnPropertyNames = {\n\tf: f$3\n};\n\nvar f$4 = Object.getOwnPropertySymbols;\n\nvar objectGetOwnPropertySymbols = {\n\tf: f$4\n};\n\n// all object keys, includes non-enumerable and symbols\nvar ownKeys = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {\n var keys = objectGetOwnPropertyNames.f(anObject(it));\n var getOwnPropertySymbols = objectGetOwnPropertySymbols.f;\n return getOwnPropertySymbols ? keys.concat(getOwnPropertySymbols(it)) : keys;\n};\n\nvar copyConstructorProperties = function (target, source) {\n var keys = ownKeys(source);\n var defineProperty = objectDefineProperty.f;\n var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;\n for (var i = 0; i < keys.length; i++) {\n var key = keys[i];\n if (!has(target, key)) defineProperty(target, key, getOwnPropertyDescriptor(source, key));\n }\n};\n\nvar replacement = /#|\\.prototype\\./;\n\nvar isForced = function (feature, detection) {\n var value = data[normalize(feature)];\n return value == POLYFILL ? true\n : value == NATIVE ? false\n : typeof detection == 'function' ? fails(detection)\n : !!detection;\n};\n\nvar normalize = isForced.normalize = function (string) {\n return String(string).replace(replacement, '.').toLowerCase();\n};\n\nvar data = isForced.data = {};\nvar NATIVE = isForced.NATIVE = 'N';\nvar POLYFILL = isForced.POLYFILL = 'P';\n\nvar isForced_1 = isForced;\n\nvar getOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f;\n\n\n\n\n\n\n/*\n options.target - name of the target object\n options.global - target is the global object\n options.stat - export as static methods of target\n options.proto - export as prototype methods of target\n options.real - real prototype method for the `pure` version\n options.forced - export even if the native feature is available\n options.bind - bind methods to the target, required for the `pure` version\n options.wrap - wrap constructors to preventing global pollution, required for the `pure` version\n options.unsafe - use the simple assignment of property instead of delete + defineProperty\n options.sham - add a flag to not completely full polyfills\n options.enumerable - export as enumerable property\n options.noTargetGet - prevent calling a getter on target\n*/\nvar _export = function (options, source) {\n var TARGET = options.target;\n var GLOBAL = options.global;\n var STATIC = options.stat;\n var FORCED, target, key, targetProperty, sourceProperty, descriptor;\n if (GLOBAL) {\n target = global_1;\n } else if (STATIC) {\n target = global_1[TARGET] || setGlobal(TARGET, {});\n } else {\n target = (global_1[TARGET] || {}).prototype;\n }\n if (target) for (key in source) {\n sourceProperty = source[key];\n if (options.noTargetGet) {\n descriptor = getOwnPropertyDescriptor$1(target, key);\n targetProperty = descriptor && descriptor.value;\n } else targetProperty = target[key];\n FORCED = isForced_1(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);\n // contained in target\n if (!FORCED && targetProperty !== undefined) {\n if (typeof sourceProperty === typeof targetProperty) continue;\n copyConstructorProperties(sourceProperty, targetProperty);\n }\n // add a flag to not completely full polyfills\n if (options.sham || (targetProperty && targetProperty.sham)) {\n createNonEnumerableProperty(sourceProperty, 'sham', true);\n }\n // extend global\n redefine(target, key, sourceProperty, options);\n }\n};\n\nvar nativeSymbol = !!Object.getOwnPropertySymbols && !fails(function () {\n // Chrome 38 Symbol has incorrect toString conversion\n // eslint-disable-next-line no-undef\n return !String(Symbol());\n});\n\nvar useSymbolAsUid = nativeSymbol\n // eslint-disable-next-line no-undef\n && !Symbol.sham\n // eslint-disable-next-line no-undef\n && typeof Symbol.iterator == 'symbol';\n\n// `IsArray` abstract operation\n// https://tc39.github.io/ecma262/#sec-isarray\nvar isArray = Array.isArray || function isArray(arg) {\n return classofRaw(arg) == 'Array';\n};\n\n// `ToObject` abstract operation\n// https://tc39.github.io/ecma262/#sec-toobject\nvar toObject = function (argument) {\n return Object(requireObjectCoercible(argument));\n};\n\n// `Object.keys` method\n// https://tc39.github.io/ecma262/#sec-object.keys\nvar objectKeys = Object.keys || function keys(O) {\n return objectKeysInternal(O, enumBugKeys);\n};\n\n// `Object.defineProperties` method\n// https://tc39.github.io/ecma262/#sec-object.defineproperties\nvar objectDefineProperties = descriptors ? Object.defineProperties : function defineProperties(O, Properties) {\n anObject(O);\n var keys = objectKeys(Properties);\n var length = keys.length;\n var index = 0;\n var key;\n while (length > index) objectDefineProperty.f(O, key = keys[index++], Properties[key]);\n return O;\n};\n\nvar html = getBuiltIn('document', 'documentElement');\n\nvar GT = '>';\nvar LT = '<';\nvar PROTOTYPE = 'prototype';\nvar SCRIPT = 'script';\nvar IE_PROTO = sharedKey('IE_PROTO');\n\nvar EmptyConstructor = function () { /* empty */ };\n\nvar scriptTag = function (content) {\n return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;\n};\n\n// Create object with fake `null` prototype: use ActiveX Object with cleared prototype\nvar NullProtoObjectViaActiveX = function (activeXDocument) {\n activeXDocument.write(scriptTag(''));\n activeXDocument.close();\n var temp = activeXDocument.parentWindow.Object;\n activeXDocument = null; // avoid memory leak\n return temp;\n};\n\n// Create object with fake `null` prototype: use iframe Object with cleared prototype\nvar NullProtoObjectViaIFrame = function () {\n // Thrash, waste and sodomy: IE GC bug\n var iframe = documentCreateElement('iframe');\n var JS = 'java' + SCRIPT + ':';\n var iframeDocument;\n iframe.style.display = 'none';\n html.appendChild(iframe);\n // https://github.com/zloirock/core-js/issues/475\n iframe.src = String(JS);\n iframeDocument = iframe.contentWindow.document;\n iframeDocument.open();\n iframeDocument.write(scriptTag('document.F=Object'));\n iframeDocument.close();\n return iframeDocument.F;\n};\n\n// Check for document.domain and active x support\n// No need to use active x approach when document.domain is not set\n// see https://github.com/es-shims/es5-shim/issues/150\n// variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346\n// avoid IE GC bug\nvar activeXDocument;\nvar NullProtoObject = function () {\n try {\n /* global ActiveXObject */\n activeXDocument = document.domain && new ActiveXObject('htmlfile');\n } catch (error) { /* ignore */ }\n NullProtoObject = activeXDocument ? NullProtoObjectViaActiveX(activeXDocument) : NullProtoObjectViaIFrame();\n var length = enumBugKeys.length;\n while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];\n return NullProtoObject();\n};\n\nhiddenKeys[IE_PROTO] = true;\n\n// `Object.create` method\n// https://tc39.github.io/ecma262/#sec-object.create\nvar objectCreate = Object.create || function create(O, Properties) {\n var result;\n if (O !== null) {\n EmptyConstructor[PROTOTYPE] = anObject(O);\n result = new EmptyConstructor();\n EmptyConstructor[PROTOTYPE] = null;\n // add \"__proto__\" for Object.getPrototypeOf polyfill\n result[IE_PROTO] = O;\n } else result = NullProtoObject();\n return Properties === undefined ? result : objectDefineProperties(result, Properties);\n};\n\nvar nativeGetOwnPropertyNames = objectGetOwnPropertyNames.f;\n\nvar toString$1 = {}.toString;\n\nvar windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames\n ? Object.getOwnPropertyNames(window) : [];\n\nvar getWindowNames = function (it) {\n try {\n return nativeGetOwnPropertyNames(it);\n } catch (error) {\n return windowNames.slice();\n }\n};\n\n// fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window\nvar f$5 = function getOwnPropertyNames(it) {\n return windowNames && toString$1.call(it) == '[object Window]'\n ? getWindowNames(it)\n : nativeGetOwnPropertyNames(toIndexedObject(it));\n};\n\nvar objectGetOwnPropertyNamesExternal = {\n\tf: f$5\n};\n\nvar WellKnownSymbolsStore = shared('wks');\nvar Symbol$1 = global_1.Symbol;\nvar createWellKnownSymbol = useSymbolAsUid ? Symbol$1 : Symbol$1 && Symbol$1.withoutSetter || uid;\n\nvar wellKnownSymbol = function (name) {\n if (!has(WellKnownSymbolsStore, name)) {\n if (nativeSymbol && has(Symbol$1, name)) WellKnownSymbolsStore[name] = Symbol$1[name];\n else WellKnownSymbolsStore[name] = createWellKnownSymbol('Symbol.' + name);\n } return WellKnownSymbolsStore[name];\n};\n\nvar f$6 = wellKnownSymbol;\n\nvar wellKnownSymbolWrapped = {\n\tf: f$6\n};\n\nvar defineProperty = objectDefineProperty.f;\n\nvar defineWellKnownSymbol = function (NAME) {\n var Symbol = path.Symbol || (path.Symbol = {});\n if (!has(Symbol, NAME)) defineProperty(Symbol, NAME, {\n value: wellKnownSymbolWrapped.f(NAME)\n });\n};\n\nvar defineProperty$1 = objectDefineProperty.f;\n\n\n\nvar TO_STRING_TAG = wellKnownSymbol('toStringTag');\n\nvar setToStringTag = function (it, TAG, STATIC) {\n if (it && !has(it = STATIC ? it : it.prototype, TO_STRING_TAG)) {\n defineProperty$1(it, TO_STRING_TAG, { configurable: true, value: TAG });\n }\n};\n\nvar aFunction$1 = function (it) {\n if (typeof it != 'function') {\n throw TypeError(String(it) + ' is not a function');\n } return it;\n};\n\n// optional / simple context binding\nvar functionBindContext = function (fn, that, length) {\n aFunction$1(fn);\n if (that === undefined) return fn;\n switch (length) {\n case 0: return function () {\n return fn.call(that);\n };\n case 1: return function (a) {\n return fn.call(that, a);\n };\n case 2: return function (a, b) {\n return fn.call(that, a, b);\n };\n case 3: return function (a, b, c) {\n return fn.call(that, a, b, c);\n };\n }\n return function (/* ...args */) {\n return fn.apply(that, arguments);\n };\n};\n\nvar SPECIES = wellKnownSymbol('species');\n\n// `ArraySpeciesCreate` abstract operation\n// https://tc39.github.io/ecma262/#sec-arrayspeciescreate\nvar arraySpeciesCreate = function (originalArray, length) {\n var C;\n if (isArray(originalArray)) {\n C = originalArray.constructor;\n // cross-realm fallback\n if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined;\n else if (isObject(C)) {\n C = C[SPECIES];\n if (C === null) C = undefined;\n }\n } return new (C === undefined ? Array : C)(length === 0 ? 0 : length);\n};\n\nvar push = [].push;\n\n// `Array.prototype.{ forEach, map, filter, some, every, find, findIndex }` methods implementation\nvar createMethod$1 = function (TYPE) {\n var IS_MAP = TYPE == 1;\n var IS_FILTER = TYPE == 2;\n var IS_SOME = TYPE == 3;\n var IS_EVERY = TYPE == 4;\n var IS_FIND_INDEX = TYPE == 6;\n var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;\n return function ($this, callbackfn, that, specificCreate) {\n var O = toObject($this);\n var self = indexedObject(O);\n var boundFunction = functionBindContext(callbackfn, that, 3);\n var length = toLength(self.length);\n var index = 0;\n var create = specificCreate || arraySpeciesCreate;\n var target = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined;\n var value, result;\n for (;length > index; index++) if (NO_HOLES || index in self) {\n value = self[index];\n result = boundFunction(value, index, O);\n if (TYPE) {\n if (IS_MAP) target[index] = result; // map\n else if (result) switch (TYPE) {\n case 3: return true; // some\n case 5: return value; // find\n case 6: return index; // findIndex\n case 2: push.call(target, value); // filter\n } else if (IS_EVERY) return false; // every\n }\n }\n return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target;\n };\n};\n\nvar arrayIteration = {\n // `Array.prototype.forEach` method\n // https://tc39.github.io/ecma262/#sec-array.prototype.foreach\n forEach: createMethod$1(0),\n // `Array.prototype.map` method\n // https://tc39.github.io/ecma262/#sec-array.prototype.map\n map: createMethod$1(1),\n // `Array.prototype.filter` method\n // https://tc39.github.io/ecma262/#sec-array.prototype.filter\n filter: createMethod$1(2),\n // `Array.prototype.some` method\n // https://tc39.github.io/ecma262/#sec-array.prototype.some\n some: createMethod$1(3),\n // `Array.prototype.every` method\n // https://tc39.github.io/ecma262/#sec-array.prototype.every\n every: createMethod$1(4),\n // `Array.prototype.find` method\n // https://tc39.github.io/ecma262/#sec-array.prototype.find\n find: createMethod$1(5),\n // `Array.prototype.findIndex` method\n // https://tc39.github.io/ecma262/#sec-array.prototype.findIndex\n findIndex: createMethod$1(6)\n};\n\nvar $forEach = arrayIteration.forEach;\n\nvar HIDDEN = sharedKey('hidden');\nvar SYMBOL = 'Symbol';\nvar PROTOTYPE$1 = 'prototype';\nvar TO_PRIMITIVE = wellKnownSymbol('toPrimitive');\nvar setInternalState = internalState.set;\nvar getInternalState = internalState.getterFor(SYMBOL);\nvar ObjectPrototype = Object[PROTOTYPE$1];\nvar $Symbol = global_1.Symbol;\nvar $stringify = getBuiltIn('JSON', 'stringify');\nvar nativeGetOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f;\nvar nativeDefineProperty$1 = objectDefineProperty.f;\nvar nativeGetOwnPropertyNames$1 = objectGetOwnPropertyNamesExternal.f;\nvar nativePropertyIsEnumerable$1 = objectPropertyIsEnumerable.f;\nvar AllSymbols = shared('symbols');\nvar ObjectPrototypeSymbols = shared('op-symbols');\nvar StringToSymbolRegistry = shared('string-to-symbol-registry');\nvar SymbolToStringRegistry = shared('symbol-to-string-registry');\nvar WellKnownSymbolsStore$1 = shared('wks');\nvar QObject = global_1.QObject;\n// Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173\nvar USE_SETTER = !QObject || !QObject[PROTOTYPE$1] || !QObject[PROTOTYPE$1].findChild;\n\n// fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687\nvar setSymbolDescriptor = descriptors && fails(function () {\n return objectCreate(nativeDefineProperty$1({}, 'a', {\n get: function () { return nativeDefineProperty$1(this, 'a', { value: 7 }).a; }\n })).a != 7;\n}) ? function (O, P, Attributes) {\n var ObjectPrototypeDescriptor = nativeGetOwnPropertyDescriptor$1(ObjectPrototype, P);\n if (ObjectPrototypeDescriptor) delete ObjectPrototype[P];\n nativeDefineProperty$1(O, P, Attributes);\n if (ObjectPrototypeDescriptor && O !== ObjectPrototype) {\n nativeDefineProperty$1(ObjectPrototype, P, ObjectPrototypeDescriptor);\n }\n} : nativeDefineProperty$1;\n\nvar wrap = function (tag, description) {\n var symbol = AllSymbols[tag] = objectCreate($Symbol[PROTOTYPE$1]);\n setInternalState(symbol, {\n type: SYMBOL,\n tag: tag,\n description: description\n });\n if (!descriptors) symbol.description = description;\n return symbol;\n};\n\nvar isSymbol = useSymbolAsUid ? function (it) {\n return typeof it == 'symbol';\n} : function (it) {\n return Object(it) instanceof $Symbol;\n};\n\nvar $defineProperty = function defineProperty(O, P, Attributes) {\n if (O === ObjectPrototype) $defineProperty(ObjectPrototypeSymbols, P, Attributes);\n anObject(O);\n var key = toPrimitive(P, true);\n anObject(Attributes);\n if (has(AllSymbols, key)) {\n if (!Attributes.enumerable) {\n if (!has(O, HIDDEN)) nativeDefineProperty$1(O, HIDDEN, createPropertyDescriptor(1, {}));\n O[HIDDEN][key] = true;\n } else {\n if (has(O, HIDDEN) && O[HIDDEN][key]) O[HIDDEN][key] = false;\n Attributes = objectCreate(Attributes, { enumerable: createPropertyDescriptor(0, false) });\n } return setSymbolDescriptor(O, key, Attributes);\n } return nativeDefineProperty$1(O, key, Attributes);\n};\n\nvar $defineProperties = function defineProperties(O, Properties) {\n anObject(O);\n var properties = toIndexedObject(Properties);\n var keys = objectKeys(properties).concat($getOwnPropertySymbols(properties));\n $forEach(keys, function (key) {\n if (!descriptors || $propertyIsEnumerable.call(properties, key)) $defineProperty(O, key, properties[key]);\n });\n return O;\n};\n\nvar $create = function create(O, Properties) {\n return Properties === undefined ? objectCreate(O) : $defineProperties(objectCreate(O), Properties);\n};\n\nvar $propertyIsEnumerable = function propertyIsEnumerable(V) {\n var P = toPrimitive(V, true);\n var enumerable = nativePropertyIsEnumerable$1.call(this, P);\n if (this === ObjectPrototype && has(AllSymbols, P) && !has(ObjectPrototypeSymbols, P)) return false;\n return enumerable || !has(this, P) || !has(AllSymbols, P) || has(this, HIDDEN) && this[HIDDEN][P] ? enumerable : true;\n};\n\nvar $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(O, P) {\n var it = toIndexedObject(O);\n var key = toPrimitive(P, true);\n if (it === ObjectPrototype && has(AllSymbols, key) && !has(ObjectPrototypeSymbols, key)) return;\n var descriptor = nativeGetOwnPropertyDescriptor$1(it, key);\n if (descriptor && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key])) {\n descriptor.enumerable = true;\n }\n return descriptor;\n};\n\nvar $getOwnPropertyNames = function getOwnPropertyNames(O) {\n var names = nativeGetOwnPropertyNames$1(toIndexedObject(O));\n var result = [];\n $forEach(names, function (key) {\n if (!has(AllSymbols, key) && !has(hiddenKeys, key)) result.push(key);\n });\n return result;\n};\n\nvar $getOwnPropertySymbols = function getOwnPropertySymbols(O) {\n var IS_OBJECT_PROTOTYPE = O === ObjectPrototype;\n var names = nativeGetOwnPropertyNames$1(IS_OBJECT_PROTOTYPE ? ObjectPrototypeSymbols : toIndexedObject(O));\n var result = [];\n $forEach(names, function (key) {\n if (has(AllSymbols, key) && (!IS_OBJECT_PROTOTYPE || has(ObjectPrototype, key))) {\n result.push(AllSymbols[key]);\n }\n });\n return result;\n};\n\n// `Symbol` constructor\n// https://tc39.github.io/ecma262/#sec-symbol-constructor\nif (!nativeSymbol) {\n $Symbol = function Symbol() {\n if (this instanceof $Symbol) throw TypeError('Symbol is not a constructor');\n var description = !arguments.length || arguments[0] === undefined ? undefined : String(arguments[0]);\n var tag = uid(description);\n var setter = function (value) {\n if (this === ObjectPrototype) setter.call(ObjectPrototypeSymbols, value);\n if (has(this, HIDDEN) && has(this[HIDDEN], tag)) this[HIDDEN][tag] = false;\n setSymbolDescriptor(this, tag, createPropertyDescriptor(1, value));\n };\n if (descriptors && USE_SETTER) setSymbolDescriptor(ObjectPrototype, tag, { configurable: true, set: setter });\n return wrap(tag, description);\n };\n\n redefine($Symbol[PROTOTYPE$1], 'toString', function toString() {\n return getInternalState(this).tag;\n });\n\n redefine($Symbol, 'withoutSetter', function (description) {\n return wrap(uid(description), description);\n });\n\n objectPropertyIsEnumerable.f = $propertyIsEnumerable;\n objectDefineProperty.f = $defineProperty;\n objectGetOwnPropertyDescriptor.f = $getOwnPropertyDescriptor;\n objectGetOwnPropertyNames.f = objectGetOwnPropertyNamesExternal.f = $getOwnPropertyNames;\n objectGetOwnPropertySymbols.f = $getOwnPropertySymbols;\n\n wellKnownSymbolWrapped.f = function (name) {\n return wrap(wellKnownSymbol(name), name);\n };\n\n if (descriptors) {\n // https://github.com/tc39/proposal-Symbol-description\n nativeDefineProperty$1($Symbol[PROTOTYPE$1], 'description', {\n configurable: true,\n get: function description() {\n return getInternalState(this).description;\n }\n });\n {\n redefine(ObjectPrototype, 'propertyIsEnumerable', $propertyIsEnumerable, { unsafe: true });\n }\n }\n}\n\n_export({ global: true, wrap: true, forced: !nativeSymbol, sham: !nativeSymbol }, {\n Symbol: $Symbol\n});\n\n$forEach(objectKeys(WellKnownSymbolsStore$1), function (name) {\n defineWellKnownSymbol(name);\n});\n\n_export({ target: SYMBOL, stat: true, forced: !nativeSymbol }, {\n // `Symbol.for` method\n // https://tc39.github.io/ecma262/#sec-symbol.for\n 'for': function (key) {\n var string = String(key);\n if (has(StringToSymbolRegistry, string)) return StringToSymbolRegistry[string];\n var symbol = $Symbol(string);\n StringToSymbolRegistry[string] = symbol;\n SymbolToStringRegistry[symbol] = string;\n return symbol;\n },\n // `Symbol.keyFor` method\n // https://tc39.github.io/ecma262/#sec-symbol.keyfor\n keyFor: function keyFor(sym) {\n if (!isSymbol(sym)) throw TypeError(sym + ' is not a symbol');\n if (has(SymbolToStringRegistry, sym)) return SymbolToStringRegistry[sym];\n },\n useSetter: function () { USE_SETTER = true; },\n useSimple: function () { USE_SETTER = false; }\n});\n\n_export({ target: 'Object', stat: true, forced: !nativeSymbol, sham: !descriptors }, {\n // `Object.create` method\n // https://tc39.github.io/ecma262/#sec-object.create\n create: $create,\n // `Object.defineProperty` method\n // https://tc39.github.io/ecma262/#sec-object.defineproperty\n defineProperty: $defineProperty,\n // `Object.defineProperties` method\n // https://tc39.github.io/ecma262/#sec-object.defineproperties\n defineProperties: $defineProperties,\n // `Object.getOwnPropertyDescriptor` method\n // https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptors\n getOwnPropertyDescriptor: $getOwnPropertyDescriptor\n});\n\n_export({ target: 'Object', stat: true, forced: !nativeSymbol }, {\n // `Object.getOwnPropertyNames` method\n // https://tc39.github.io/ecma262/#sec-object.getownpropertynames\n getOwnPropertyNames: $getOwnPropertyNames,\n // `Object.getOwnPropertySymbols` method\n // https://tc39.github.io/ecma262/#sec-object.getownpropertysymbols\n getOwnPropertySymbols: $getOwnPropertySymbols\n});\n\n// Chrome 38 and 39 `Object.getOwnPropertySymbols` fails on primitives\n// https://bugs.chromium.org/p/v8/issues/detail?id=3443\n_export({ target: 'Object', stat: true, forced: fails(function () { objectGetOwnPropertySymbols.f(1); }) }, {\n getOwnPropertySymbols: function getOwnPropertySymbols(it) {\n return objectGetOwnPropertySymbols.f(toObject(it));\n }\n});\n\n// `JSON.stringify` method behavior with symbols\n// https://tc39.github.io/ecma262/#sec-json.stringify\nif ($stringify) {\n var FORCED_JSON_STRINGIFY = !nativeSymbol || fails(function () {\n var symbol = $Symbol();\n // MS Edge converts symbol values to JSON as {}\n return $stringify([symbol]) != '[null]'\n // WebKit converts symbol values to JSON as null\n || $stringify({ a: symbol }) != '{}'\n // V8 throws on boxed symbols\n || $stringify(Object(symbol)) != '{}';\n });\n\n _export({ target: 'JSON', stat: true, forced: FORCED_JSON_STRINGIFY }, {\n // eslint-disable-next-line no-unused-vars\n stringify: function stringify(it, replacer, space) {\n var args = [it];\n var index = 1;\n var $replacer;\n while (arguments.length > index) args.push(arguments[index++]);\n $replacer = replacer;\n if (!isObject(replacer) && it === undefined || isSymbol(it)) return; // IE8 returns string on undefined\n if (!isArray(replacer)) replacer = function (key, value) {\n if (typeof $replacer == 'function') value = $replacer.call(this, key, value);\n if (!isSymbol(value)) return value;\n };\n args[1] = replacer;\n return $stringify.apply(null, args);\n }\n });\n}\n\n// `Symbol.prototype[@@toPrimitive]` method\n// https://tc39.github.io/ecma262/#sec-symbol.prototype-@@toprimitive\nif (!$Symbol[PROTOTYPE$1][TO_PRIMITIVE]) {\n createNonEnumerableProperty($Symbol[PROTOTYPE$1], TO_PRIMITIVE, $Symbol[PROTOTYPE$1].valueOf);\n}\n// `Symbol.prototype[@@toStringTag]` property\n// https://tc39.github.io/ecma262/#sec-symbol.prototype-@@tostringtag\nsetToStringTag($Symbol, SYMBOL);\n\nhiddenKeys[HIDDEN] = true;\n\nvar defineProperty$2 = objectDefineProperty.f;\n\n\nvar NativeSymbol = global_1.Symbol;\n\nif (descriptors && typeof NativeSymbol == 'function' && (!('description' in NativeSymbol.prototype) ||\n // Safari 12 bug\n NativeSymbol().description !== undefined\n)) {\n var EmptyStringDescriptionStore = {};\n // wrap Symbol constructor for correct work with undefined description\n var SymbolWrapper = function Symbol() {\n var description = arguments.length < 1 || arguments[0] === undefined ? undefined : String(arguments[0]);\n var result = this instanceof SymbolWrapper\n ? new NativeSymbol(description)\n // in Edge 13, String(Symbol(undefined)) === 'Symbol(undefined)'\n : description === undefined ? NativeSymbol() : NativeSymbol(description);\n if (description === '') EmptyStringDescriptionStore[result] = true;\n return result;\n };\n copyConstructorProperties(SymbolWrapper, NativeSymbol);\n var symbolPrototype = SymbolWrapper.prototype = NativeSymbol.prototype;\n symbolPrototype.constructor = SymbolWrapper;\n\n var symbolToString = symbolPrototype.toString;\n var native = String(NativeSymbol('test')) == 'Symbol(test)';\n var regexp = /^Symbol\\((.*)\\)[^)]+$/;\n defineProperty$2(symbolPrototype, 'description', {\n configurable: true,\n get: function description() {\n var symbol = isObject(this) ? this.valueOf() : this;\n var string = symbolToString.call(symbol);\n if (has(EmptyStringDescriptionStore, symbol)) return '';\n var desc = native ? string.slice(7, -1) : string.replace(regexp, '$1');\n return desc === '' ? undefined : desc;\n }\n });\n\n _export({ global: true, forced: true }, {\n Symbol: SymbolWrapper\n });\n}\n\n// `Symbol.iterator` well-known symbol\n// https://tc39.github.io/ecma262/#sec-symbol.iterator\ndefineWellKnownSymbol('iterator');\n\nvar arrayMethodIsStrict = function (METHOD_NAME, argument) {\n var method = [][METHOD_NAME];\n return !!method && fails(function () {\n // eslint-disable-next-line no-useless-call,no-throw-literal\n method.call(null, argument || function () { throw 1; }, 1);\n });\n};\n\nvar defineProperty$3 = Object.defineProperty;\nvar cache = {};\n\nvar thrower = function (it) { throw it; };\n\nvar arrayMethodUsesToLength = function (METHOD_NAME, options) {\n if (has(cache, METHOD_NAME)) return cache[METHOD_NAME];\n if (!options) options = {};\n var method = [][METHOD_NAME];\n var ACCESSORS = has(options, 'ACCESSORS') ? options.ACCESSORS : false;\n var argument0 = has(options, 0) ? options[0] : thrower;\n var argument1 = has(options, 1) ? options[1] : undefined;\n\n return cache[METHOD_NAME] = !!method && !fails(function () {\n if (ACCESSORS && !descriptors) return true;\n var O = { length: -1 };\n\n if (ACCESSORS) defineProperty$3(O, 1, { enumerable: true, get: thrower });\n else O[1] = 1;\n\n method.call(O, argument0, argument1);\n });\n};\n\nvar $forEach$1 = arrayIteration.forEach;\n\n\n\nvar STRICT_METHOD = arrayMethodIsStrict('forEach');\nvar USES_TO_LENGTH = arrayMethodUsesToLength('forEach');\n\n// `Array.prototype.forEach` method implementation\n// https://tc39.github.io/ecma262/#sec-array.prototype.foreach\nvar arrayForEach = (!STRICT_METHOD || !USES_TO_LENGTH) ? function forEach(callbackfn /* , thisArg */) {\n return $forEach$1(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);\n} : [].forEach;\n\n// `Array.prototype.forEach` method\n// https://tc39.github.io/ecma262/#sec-array.prototype.foreach\n_export({ target: 'Array', proto: true, forced: [].forEach != arrayForEach }, {\n forEach: arrayForEach\n});\n\nvar $indexOf = arrayIncludes.indexOf;\n\n\n\nvar nativeIndexOf = [].indexOf;\n\nvar NEGATIVE_ZERO = !!nativeIndexOf && 1 / [1].indexOf(1, -0) < 0;\nvar STRICT_METHOD$1 = arrayMethodIsStrict('indexOf');\nvar USES_TO_LENGTH$1 = arrayMethodUsesToLength('indexOf', { ACCESSORS: true, 1: 0 });\n\n// `Array.prototype.indexOf` method\n// https://tc39.github.io/ecma262/#sec-array.prototype.indexof\n_export({ target: 'Array', proto: true, forced: NEGATIVE_ZERO || !STRICT_METHOD$1 || !USES_TO_LENGTH$1 }, {\n indexOf: function indexOf(searchElement /* , fromIndex = 0 */) {\n return NEGATIVE_ZERO\n // convert -0 to +0\n ? nativeIndexOf.apply(this, arguments) || 0\n : $indexOf(this, searchElement, arguments.length > 1 ? arguments[1] : undefined);\n }\n});\n\nvar UNSCOPABLES = wellKnownSymbol('unscopables');\nvar ArrayPrototype = Array.prototype;\n\n// Array.prototype[@@unscopables]\n// https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables\nif (ArrayPrototype[UNSCOPABLES] == undefined) {\n objectDefineProperty.f(ArrayPrototype, UNSCOPABLES, {\n configurable: true,\n value: objectCreate(null)\n });\n}\n\n// add a key to Array.prototype[@@unscopables]\nvar addToUnscopables = function (key) {\n ArrayPrototype[UNSCOPABLES][key] = true;\n};\n\nvar iterators = {};\n\nvar correctPrototypeGetter = !fails(function () {\n function F() { /* empty */ }\n F.prototype.constructor = null;\n return Object.getPrototypeOf(new F()) !== F.prototype;\n});\n\nvar IE_PROTO$1 = sharedKey('IE_PROTO');\nvar ObjectPrototype$1 = Object.prototype;\n\n// `Object.getPrototypeOf` method\n// https://tc39.github.io/ecma262/#sec-object.getprototypeof\nvar objectGetPrototypeOf = correctPrototypeGetter ? Object.getPrototypeOf : function (O) {\n O = toObject(O);\n if (has(O, IE_PROTO$1)) return O[IE_PROTO$1];\n if (typeof O.constructor == 'function' && O instanceof O.constructor) {\n return O.constructor.prototype;\n } return O instanceof Object ? ObjectPrototype$1 : null;\n};\n\nvar ITERATOR = wellKnownSymbol('iterator');\nvar BUGGY_SAFARI_ITERATORS = false;\n\nvar returnThis = function () { return this; };\n\n// `%IteratorPrototype%` object\n// https://tc39.github.io/ecma262/#sec-%iteratorprototype%-object\nvar IteratorPrototype, PrototypeOfArrayIteratorPrototype, arrayIterator;\n\nif ([].keys) {\n arrayIterator = [].keys();\n // Safari 8 has buggy iterators w/o `next`\n if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS = true;\n else {\n PrototypeOfArrayIteratorPrototype = objectGetPrototypeOf(objectGetPrototypeOf(arrayIterator));\n if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype = PrototypeOfArrayIteratorPrototype;\n }\n}\n\nif (IteratorPrototype == undefined) IteratorPrototype = {};\n\n// 25.1.2.1.1 %IteratorPrototype%[@@iterator]()\nif ( !has(IteratorPrototype, ITERATOR)) {\n createNonEnumerableProperty(IteratorPrototype, ITERATOR, returnThis);\n}\n\nvar iteratorsCore = {\n IteratorPrototype: IteratorPrototype,\n BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS\n};\n\nvar IteratorPrototype$1 = iteratorsCore.IteratorPrototype;\n\n\n\n\n\nvar returnThis$1 = function () { return this; };\n\nvar createIteratorConstructor = function (IteratorConstructor, NAME, next) {\n var TO_STRING_TAG = NAME + ' Iterator';\n IteratorConstructor.prototype = objectCreate(IteratorPrototype$1, { next: createPropertyDescriptor(1, next) });\n setToStringTag(IteratorConstructor, TO_STRING_TAG, false);\n iterators[TO_STRING_TAG] = returnThis$1;\n return IteratorConstructor;\n};\n\nvar aPossiblePrototype = function (it) {\n if (!isObject(it) && it !== null) {\n throw TypeError(\"Can't set \" + String(it) + ' as a prototype');\n } return it;\n};\n\n// `Object.setPrototypeOf` method\n// https://tc39.github.io/ecma262/#sec-object.setprototypeof\n// Works with __proto__ only. Old v8 can't work with null proto objects.\n/* eslint-disable no-proto */\nvar objectSetPrototypeOf = Object.setPrototypeOf || ('__proto__' in {} ? function () {\n var CORRECT_SETTER = false;\n var test = {};\n var setter;\n try {\n setter = Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set;\n setter.call(test, []);\n CORRECT_SETTER = test instanceof Array;\n } catch (error) { /* empty */ }\n return function setPrototypeOf(O, proto) {\n anObject(O);\n aPossiblePrototype(proto);\n if (CORRECT_SETTER) setter.call(O, proto);\n else O.__proto__ = proto;\n return O;\n };\n}() : undefined);\n\nvar IteratorPrototype$2 = iteratorsCore.IteratorPrototype;\nvar BUGGY_SAFARI_ITERATORS$1 = iteratorsCore.BUGGY_SAFARI_ITERATORS;\nvar ITERATOR$1 = wellKnownSymbol('iterator');\nvar KEYS = 'keys';\nvar VALUES = 'values';\nvar ENTRIES = 'entries';\n\nvar returnThis$2 = function () { return this; };\n\nvar defineIterator = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) {\n createIteratorConstructor(IteratorConstructor, NAME, next);\n\n var getIterationMethod = function (KIND) {\n if (KIND === DEFAULT && defaultIterator) return defaultIterator;\n if (!BUGGY_SAFARI_ITERATORS$1 && KIND in IterablePrototype) return IterablePrototype[KIND];\n switch (KIND) {\n case KEYS: return function keys() { return new IteratorConstructor(this, KIND); };\n case VALUES: return function values() { return new IteratorConstructor(this, KIND); };\n case ENTRIES: return function entries() { return new IteratorConstructor(this, KIND); };\n } return function () { return new IteratorConstructor(this); };\n };\n\n var TO_STRING_TAG = NAME + ' Iterator';\n var INCORRECT_VALUES_NAME = false;\n var IterablePrototype = Iterable.prototype;\n var nativeIterator = IterablePrototype[ITERATOR$1]\n || IterablePrototype['@@iterator']\n || DEFAULT && IterablePrototype[DEFAULT];\n var defaultIterator = !BUGGY_SAFARI_ITERATORS$1 && nativeIterator || getIterationMethod(DEFAULT);\n var anyNativeIterator = NAME == 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator;\n var CurrentIteratorPrototype, methods, KEY;\n\n // fix native\n if (anyNativeIterator) {\n CurrentIteratorPrototype = objectGetPrototypeOf(anyNativeIterator.call(new Iterable()));\n if (IteratorPrototype$2 !== Object.prototype && CurrentIteratorPrototype.next) {\n if ( objectGetPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype$2) {\n if (objectSetPrototypeOf) {\n objectSetPrototypeOf(CurrentIteratorPrototype, IteratorPrototype$2);\n } else if (typeof CurrentIteratorPrototype[ITERATOR$1] != 'function') {\n createNonEnumerableProperty(CurrentIteratorPrototype, ITERATOR$1, returnThis$2);\n }\n }\n // Set @@toStringTag to native iterators\n setToStringTag(CurrentIteratorPrototype, TO_STRING_TAG, true);\n }\n }\n\n // fix Array#{values, @@iterator}.name in V8 / FF\n if (DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES) {\n INCORRECT_VALUES_NAME = true;\n defaultIterator = function values() { return nativeIterator.call(this); };\n }\n\n // define iterator\n if ( IterablePrototype[ITERATOR$1] !== defaultIterator) {\n createNonEnumerableProperty(IterablePrototype, ITERATOR$1, defaultIterator);\n }\n iterators[NAME] = defaultIterator;\n\n // export additional methods\n if (DEFAULT) {\n methods = {\n values: getIterationMethod(VALUES),\n keys: IS_SET ? defaultIterator : getIterationMethod(KEYS),\n entries: getIterationMethod(ENTRIES)\n };\n if (FORCED) for (KEY in methods) {\n if (BUGGY_SAFARI_ITERATORS$1 || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) {\n redefine(IterablePrototype, KEY, methods[KEY]);\n }\n } else _export({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS$1 || INCORRECT_VALUES_NAME }, methods);\n }\n\n return methods;\n};\n\nvar ARRAY_ITERATOR = 'Array Iterator';\nvar setInternalState$1 = internalState.set;\nvar getInternalState$1 = internalState.getterFor(ARRAY_ITERATOR);\n\n// `Array.prototype.entries` method\n// https://tc39.github.io/ecma262/#sec-array.prototype.entries\n// `Array.prototype.keys` method\n// https://tc39.github.io/ecma262/#sec-array.prototype.keys\n// `Array.prototype.values` method\n// https://tc39.github.io/ecma262/#sec-array.prototype.values\n// `Array.prototype[@@iterator]` method\n// https://tc39.github.io/ecma262/#sec-array.prototype-@@iterator\n// `CreateArrayIterator` internal method\n// https://tc39.github.io/ecma262/#sec-createarrayiterator\nvar es_array_iterator = defineIterator(Array, 'Array', function (iterated, kind) {\n setInternalState$1(this, {\n type: ARRAY_ITERATOR,\n target: toIndexedObject(iterated), // target\n index: 0, // next index\n kind: kind // kind\n });\n// `%ArrayIteratorPrototype%.next` method\n// https://tc39.github.io/ecma262/#sec-%arrayiteratorprototype%.next\n}, function () {\n var state = getInternalState$1(this);\n var target = state.target;\n var kind = state.kind;\n var index = state.index++;\n if (!target || index >= target.length) {\n state.target = undefined;\n return { value: undefined, done: true };\n }\n if (kind == 'keys') return { value: index, done: false };\n if (kind == 'values') return { value: target[index], done: false };\n return { value: [index, target[index]], done: false };\n}, 'values');\n\n// argumentsList[@@iterator] is %ArrayProto_values%\n// https://tc39.github.io/ecma262/#sec-createunmappedargumentsobject\n// https://tc39.github.io/ecma262/#sec-createmappedargumentsobject\niterators.Arguments = iterators.Array;\n\n// https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables\naddToUnscopables('keys');\naddToUnscopables('values');\naddToUnscopables('entries');\n\nvar nativeJoin = [].join;\n\nvar ES3_STRINGS = indexedObject != Object;\nvar STRICT_METHOD$2 = arrayMethodIsStrict('join', ',');\n\n// `Array.prototype.join` method\n// https://tc39.github.io/ecma262/#sec-array.prototype.join\n_export({ target: 'Array', proto: true, forced: ES3_STRINGS || !STRICT_METHOD$2 }, {\n join: function join(separator) {\n return nativeJoin.call(toIndexedObject(this), separator === undefined ? ',' : separator);\n }\n});\n\nvar createProperty = function (object, key, value) {\n var propertyKey = toPrimitive(key);\n if (propertyKey in object) objectDefineProperty.f(object, propertyKey, createPropertyDescriptor(0, value));\n else object[propertyKey] = value;\n};\n\nvar engineUserAgent = getBuiltIn('navigator', 'userAgent') || '';\n\nvar process = global_1.process;\nvar versions = process && process.versions;\nvar v8 = versions && versions.v8;\nvar match, version;\n\nif (v8) {\n match = v8.split('.');\n version = match[0] + match[1];\n} else if (engineUserAgent) {\n match = engineUserAgent.match(/Edge\\/(\\d+)/);\n if (!match || match[1] >= 74) {\n match = engineUserAgent.match(/Chrome\\/(\\d+)/);\n if (match) version = match[1];\n }\n}\n\nvar engineV8Version = version && +version;\n\nvar SPECIES$1 = wellKnownSymbol('species');\n\nvar arrayMethodHasSpeciesSupport = function (METHOD_NAME) {\n // We can't use this feature detection in V8 since it causes\n // deoptimization and serious performance degradation\n // https://github.com/zloirock/core-js/issues/677\n return engineV8Version >= 51 || !fails(function () {\n var array = [];\n var constructor = array.constructor = {};\n constructor[SPECIES$1] = function () {\n return { foo: 1 };\n };\n return array[METHOD_NAME](Boolean).foo !== 1;\n });\n};\n\nvar HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('slice');\nvar USES_TO_LENGTH$2 = arrayMethodUsesToLength('slice', { ACCESSORS: true, 0: 0, 1: 2 });\n\nvar SPECIES$2 = wellKnownSymbol('species');\nvar nativeSlice = [].slice;\nvar max$1 = Math.max;\n\n// `Array.prototype.slice` method\n// https://tc39.github.io/ecma262/#sec-array.prototype.slice\n// fallback for not array-like ES3 strings and DOM objects\n_export({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT || !USES_TO_LENGTH$2 }, {\n slice: function slice(start, end) {\n var O = toIndexedObject(this);\n var length = toLength(O.length);\n var k = toAbsoluteIndex(start, length);\n var fin = toAbsoluteIndex(end === undefined ? length : end, length);\n // inline `ArraySpeciesCreate` for usage native `Array#slice` where it's possible\n var Constructor, result, n;\n if (isArray(O)) {\n Constructor = O.constructor;\n // cross-realm fallback\n if (typeof Constructor == 'function' && (Constructor === Array || isArray(Constructor.prototype))) {\n Constructor = undefined;\n } else if (isObject(Constructor)) {\n Constructor = Constructor[SPECIES$2];\n if (Constructor === null) Constructor = undefined;\n }\n if (Constructor === Array || Constructor === undefined) {\n return nativeSlice.call(O, k, fin);\n }\n }\n result = new (Constructor === undefined ? Array : Constructor)(max$1(fin - k, 0));\n for (n = 0; k < fin; k++, n++) if (k in O) createProperty(result, n, O[k]);\n result.length = n;\n return result;\n }\n});\n\nvar TO_STRING_TAG$1 = wellKnownSymbol('toStringTag');\nvar test = {};\n\ntest[TO_STRING_TAG$1] = 'z';\n\nvar toStringTagSupport = String(test) === '[object z]';\n\nvar TO_STRING_TAG$2 = wellKnownSymbol('toStringTag');\n// ES3 wrong here\nvar CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments';\n\n// fallback for IE11 Script Access Denied error\nvar tryGet = function (it, key) {\n try {\n return it[key];\n } catch (error) { /* empty */ }\n};\n\n// getting tag from ES6+ `Object.prototype.toString`\nvar classof = toStringTagSupport ? classofRaw : function (it) {\n var O, tag, result;\n return it === undefined ? 'Undefined' : it === null ? 'Null'\n // @@toStringTag case\n : typeof (tag = tryGet(O = Object(it), TO_STRING_TAG$2)) == 'string' ? tag\n // builtinTag case\n : CORRECT_ARGUMENTS ? classofRaw(O)\n // ES3 arguments fallback\n : (result = classofRaw(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : result;\n};\n\n// `Object.prototype.toString` method implementation\n// https://tc39.github.io/ecma262/#sec-object.prototype.tostring\nvar objectToString = toStringTagSupport ? {}.toString : function toString() {\n return '[object ' + classof(this) + ']';\n};\n\n// `Object.prototype.toString` method\n// https://tc39.github.io/ecma262/#sec-object.prototype.tostring\nif (!toStringTagSupport) {\n redefine(Object.prototype, 'toString', objectToString, { unsafe: true });\n}\n\n// `RegExp.prototype.flags` getter implementation\n// https://tc39.github.io/ecma262/#sec-get-regexp.prototype.flags\nvar regexpFlags = function () {\n var that = anObject(this);\n var result = '';\n if (that.global) result += 'g';\n if (that.ignoreCase) result += 'i';\n if (that.multiline) result += 'm';\n if (that.dotAll) result += 's';\n if (that.unicode) result += 'u';\n if (that.sticky) result += 'y';\n return result;\n};\n\n// babel-minify transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError,\n// so we use an intermediate function.\nfunction RE(s, f) {\n return RegExp(s, f);\n}\n\nvar UNSUPPORTED_Y = fails(function () {\n // babel-minify transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError\n var re = RE('a', 'y');\n re.lastIndex = 2;\n return re.exec('abcd') != null;\n});\n\nvar BROKEN_CARET = fails(function () {\n // https://bugzilla.mozilla.org/show_bug.cgi?id=773687\n var re = RE('^r', 'gy');\n re.lastIndex = 2;\n return re.exec('str') != null;\n});\n\nvar regexpStickyHelpers = {\n\tUNSUPPORTED_Y: UNSUPPORTED_Y,\n\tBROKEN_CARET: BROKEN_CARET\n};\n\nvar nativeExec = RegExp.prototype.exec;\n// This always refers to the native implementation, because the\n// String#replace polyfill uses ./fix-regexp-well-known-symbol-logic.js,\n// which loads this file before patching the method.\nvar nativeReplace = String.prototype.replace;\n\nvar patchedExec = nativeExec;\n\nvar UPDATES_LAST_INDEX_WRONG = (function () {\n var re1 = /a/;\n var re2 = /b*/g;\n nativeExec.call(re1, 'a');\n nativeExec.call(re2, 'a');\n return re1.lastIndex !== 0 || re2.lastIndex !== 0;\n})();\n\nvar UNSUPPORTED_Y$1 = regexpStickyHelpers.UNSUPPORTED_Y || regexpStickyHelpers.BROKEN_CARET;\n\n// nonparticipating capturing group, copied from es5-shim's String#split patch.\nvar NPCG_INCLUDED = /()??/.exec('')[1] !== undefined;\n\nvar PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED || UNSUPPORTED_Y$1;\n\nif (PATCH) {\n patchedExec = function exec(str) {\n var re = this;\n var lastIndex, reCopy, match, i;\n var sticky = UNSUPPORTED_Y$1 && re.sticky;\n var flags = regexpFlags.call(re);\n var source = re.source;\n var charsAdded = 0;\n var strCopy = str;\n\n if (sticky) {\n flags = flags.replace('y', '');\n if (flags.indexOf('g') === -1) {\n flags += 'g';\n }\n\n strCopy = String(str).slice(re.lastIndex);\n // Support anchored sticky behavior.\n if (re.lastIndex > 0 && (!re.multiline || re.multiline && str[re.lastIndex - 1] !== '\\n')) {\n source = '(?: ' + source + ')';\n strCopy = ' ' + strCopy;\n charsAdded++;\n }\n // ^(? + rx + ) is needed, in combination with some str slicing, to\n // simulate the 'y' flag.\n reCopy = new RegExp('^(?:' + source + ')', flags);\n }\n\n if (NPCG_INCLUDED) {\n reCopy = new RegExp('^' + source + '$(?!\\\\s)', flags);\n }\n if (UPDATES_LAST_INDEX_WRONG) lastIndex = re.lastIndex;\n\n match = nativeExec.call(sticky ? reCopy : re, strCopy);\n\n if (sticky) {\n if (match) {\n match.input = match.input.slice(charsAdded);\n match[0] = match[0].slice(charsAdded);\n match.index = re.lastIndex;\n re.lastIndex += match[0].length;\n } else re.lastIndex = 0;\n } else if (UPDATES_LAST_INDEX_WRONG && match) {\n re.lastIndex = re.global ? match.index + match[0].length : lastIndex;\n }\n if (NPCG_INCLUDED && match && match.length > 1) {\n // Fix browsers whose `exec` methods don't consistently return `undefined`\n // for NPCG, like IE8. NOTE: This doesn' work for /(.?)?/\n nativeReplace.call(match[0], reCopy, function () {\n for (i = 1; i < arguments.length - 2; i++) {\n if (arguments[i] === undefined) match[i] = undefined;\n }\n });\n }\n\n return match;\n };\n}\n\nvar regexpExec = patchedExec;\n\n_export({ target: 'RegExp', proto: true, forced: /./.exec !== regexpExec }, {\n exec: regexpExec\n});\n\nvar TO_STRING = 'toString';\nvar RegExpPrototype = RegExp.prototype;\nvar nativeToString = RegExpPrototype[TO_STRING];\n\nvar NOT_GENERIC = fails(function () { return nativeToString.call({ source: 'a', flags: 'b' }) != '/a/b'; });\n// FF44- RegExp#toString has a wrong name\nvar INCORRECT_NAME = nativeToString.name != TO_STRING;\n\n// `RegExp.prototype.toString` method\n// https://tc39.github.io/ecma262/#sec-regexp.prototype.tostring\nif (NOT_GENERIC || INCORRECT_NAME) {\n redefine(RegExp.prototype, TO_STRING, function toString() {\n var R = anObject(this);\n var p = String(R.source);\n var rf = R.flags;\n var f = String(rf === undefined && R instanceof RegExp && !('flags' in RegExpPrototype) ? regexpFlags.call(R) : rf);\n return '/' + p + '/' + f;\n }, { unsafe: true });\n}\n\n// `String.prototype.{ codePointAt, at }` methods implementation\nvar createMethod$2 = function (CONVERT_TO_STRING) {\n return function ($this, pos) {\n var S = String(requireObjectCoercible($this));\n var position = toInteger(pos);\n var size = S.length;\n var first, second;\n if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;\n first = S.charCodeAt(position);\n return first < 0xD800 || first > 0xDBFF || position + 1 === size\n || (second = S.charCodeAt(position + 1)) < 0xDC00 || second > 0xDFFF\n ? CONVERT_TO_STRING ? S.charAt(position) : first\n : CONVERT_TO_STRING ? S.slice(position, position + 2) : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;\n };\n};\n\nvar stringMultibyte = {\n // `String.prototype.codePointAt` method\n // https://tc39.github.io/ecma262/#sec-string.prototype.codepointat\n codeAt: createMethod$2(false),\n // `String.prototype.at` method\n // https://github.com/mathiasbynens/String.prototype.at\n charAt: createMethod$2(true)\n};\n\nvar charAt = stringMultibyte.charAt;\n\n\n\nvar STRING_ITERATOR = 'String Iterator';\nvar setInternalState$2 = internalState.set;\nvar getInternalState$2 = internalState.getterFor(STRING_ITERATOR);\n\n// `String.prototype[@@iterator]` method\n// https://tc39.github.io/ecma262/#sec-string.prototype-@@iterator\ndefineIterator(String, 'String', function (iterated) {\n setInternalState$2(this, {\n type: STRING_ITERATOR,\n string: String(iterated),\n index: 0\n });\n// `%StringIteratorPrototype%.next` method\n// https://tc39.github.io/ecma262/#sec-%stringiteratorprototype%.next\n}, function next() {\n var state = getInternalState$2(this);\n var string = state.string;\n var index = state.index;\n var point;\n if (index >= string.length) return { value: undefined, done: true };\n point = charAt(string, index);\n state.index += point.length;\n return { value: point, done: false };\n});\n\n// TODO: Remove from `core-js@4` since it's moved to entry points\n\n\n\n\n\n\n\nvar SPECIES$3 = wellKnownSymbol('species');\n\nvar REPLACE_SUPPORTS_NAMED_GROUPS = !fails(function () {\n // #replace needs built-in support for named groups.\n // #match works fine because it just return the exec results, even if it has\n // a \"grops\" property.\n var re = /./;\n re.exec = function () {\n var result = [];\n result.groups = { a: '7' };\n return result;\n };\n return ''.replace(re, '$<a>') !== '7';\n});\n\n// IE <= 11 replaces $0 with the whole match, as if it was $&\n// https://stackoverflow.com/questions/6024666/getting-ie-to-replace-a-regex-with-the-literal-string-0\nvar REPLACE_KEEPS_$0 = (function () {\n return 'a'.replace(/./, '$0') === '$0';\n})();\n\nvar REPLACE = wellKnownSymbol('replace');\n// Safari <= 13.0.3(?) substitutes nth capture where n>m with an empty string\nvar REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE = (function () {\n if (/./[REPLACE]) {\n return /./[REPLACE]('a', '$0') === '';\n }\n return false;\n})();\n\n// Chrome 51 has a buggy \"split\" implementation when RegExp#exec !== nativeExec\n// Weex JS has frozen built-in prototypes, so use try / catch wrapper\nvar SPLIT_WORKS_WITH_OVERWRITTEN_EXEC = !fails(function () {\n var re = /(?:)/;\n var originalExec = re.exec;\n re.exec = function () { return originalExec.apply(this, arguments); };\n var result = 'ab'.split(re);\n return result.length !== 2 || result[0] !== 'a' || result[1] !== 'b';\n});\n\nvar fixRegexpWellKnownSymbolLogic = function (KEY, length, exec, sham) {\n var SYMBOL = wellKnownSymbol(KEY);\n\n var DELEGATES_TO_SYMBOL = !fails(function () {\n // String methods call symbol-named RegEp methods\n var O = {};\n O[SYMBOL] = function () { return 7; };\n return ''[KEY](O) != 7;\n });\n\n var DELEGATES_TO_EXEC = DELEGATES_TO_SYMBOL && !fails(function () {\n // Symbol-named RegExp methods call .exec\n var execCalled = false;\n var re = /a/;\n\n if (KEY === 'split') {\n // We can't use real regex here since it causes deoptimization\n // and serious performance degradation in V8\n // https://github.com/zloirock/core-js/issues/306\n re = {};\n // RegExp[@@split] doesn't call the regex's exec method, but first creates\n // a new one. We need to return the patched regex when creating the new one.\n re.constructor = {};\n re.constructor[SPECIES$3] = function () { return re; };\n re.flags = '';\n re[SYMBOL] = /./[SYMBOL];\n }\n\n re.exec = function () { execCalled = true; return null; };\n\n re[SYMBOL]('');\n return !execCalled;\n });\n\n if (\n !DELEGATES_TO_SYMBOL ||\n !DELEGATES_TO_EXEC ||\n (KEY === 'replace' && !(\n REPLACE_SUPPORTS_NAMED_GROUPS &&\n REPLACE_KEEPS_$0 &&\n !REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE\n )) ||\n (KEY === 'split' && !SPLIT_WORKS_WITH_OVERWRITTEN_EXEC)\n ) {\n var nativeRegExpMethod = /./[SYMBOL];\n var methods = exec(SYMBOL, ''[KEY], function (nativeMethod, regexp, str, arg2, forceStringMethod) {\n if (regexp.exec === regexpExec) {\n if (DELEGATES_TO_SYMBOL && !forceStringMethod) {\n // The native String method already delegates to @@method (this\n // polyfilled function), leasing to infinite recursion.\n // We avoid it by directly calling the native @@method method.\n return { done: true, value: nativeRegExpMethod.call(regexp, str, arg2) };\n }\n return { done: true, value: nativeMethod.call(str, regexp, arg2) };\n }\n return { done: false };\n }, {\n REPLACE_KEEPS_$0: REPLACE_KEEPS_$0,\n REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE: REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE\n });\n var stringMethod = methods[0];\n var regexMethod = methods[1];\n\n redefine(String.prototype, KEY, stringMethod);\n redefine(RegExp.prototype, SYMBOL, length == 2\n // 21.2.5.8 RegExp.prototype[@@replace](string, replaceValue)\n // 21.2.5.11 RegExp.prototype[@@split](string, limit)\n ? function (string, arg) { return regexMethod.call(string, this, arg); }\n // 21.2.5.6 RegExp.prototype[@@match](string)\n // 21.2.5.9 RegExp.prototype[@@search](string)\n : function (string) { return regexMethod.call(string, this); }\n );\n }\n\n if (sham) createNonEnumerableProperty(RegExp.prototype[SYMBOL], 'sham', true);\n};\n\nvar charAt$1 = stringMultibyte.charAt;\n\n// `AdvanceStringIndex` abstract operation\n// https://tc39.github.io/ecma262/#sec-advancestringindex\nvar advanceStringIndex = function (S, index, unicode) {\n return index + (unicode ? charAt$1(S, index).length : 1);\n};\n\n// `RegExpExec` abstract operation\n// https://tc39.github.io/ecma262/#sec-regexpexec\nvar regexpExecAbstract = function (R, S) {\n var exec = R.exec;\n if (typeof exec === 'function') {\n var result = exec.call(R, S);\n if (typeof result !== 'object') {\n throw TypeError('RegExp exec method returned something other than an Object or null');\n }\n return result;\n }\n\n if (classofRaw(R) !== 'RegExp') {\n throw TypeError('RegExp#exec called on incompatible receiver');\n }\n\n return regexpExec.call(R, S);\n};\n\nvar max$2 = Math.max;\nvar min$2 = Math.min;\nvar floor$1 = Math.floor;\nvar SUBSTITUTION_SYMBOLS = /\\$([$&'`]|\\d\\d?|<[^>]*>)/g;\nvar SUBSTITUTION_SYMBOLS_NO_NAMED = /\\$([$&'`]|\\d\\d?)/g;\n\nvar maybeToString = function (it) {\n return it === undefined ? it : String(it);\n};\n\n// @@replace logic\nfixRegexpWellKnownSymbolLogic('replace', 2, function (REPLACE, nativeReplace, maybeCallNative, reason) {\n var REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE = reason.REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE;\n var REPLACE_KEEPS_$0 = reason.REPLACE_KEEPS_$0;\n var UNSAFE_SUBSTITUTE = REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE ? '$' : '$0';\n\n return [\n // `String.prototype.replace` method\n // https://tc39.github.io/ecma262/#sec-string.prototype.replace\n function replace(searchValue, replaceValue) {\n var O = requireObjectCoercible(this);\n var replacer = searchValue == undefined ? undefined : searchValue[REPLACE];\n return replacer !== undefined\n ? replacer.call(searchValue, O, replaceValue)\n : nativeReplace.call(String(O), searchValue, replaceValue);\n },\n // `RegExp.prototype[@@replace]` method\n // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@replace\n function (regexp, replaceValue) {\n if (\n (!REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE && REPLACE_KEEPS_$0) ||\n (typeof replaceValue === 'string' && replaceValue.indexOf(UNSAFE_SUBSTITUTE) === -1)\n ) {\n var res = maybeCallNative(nativeReplace, regexp, this, replaceValue);\n if (res.done) return res.value;\n }\n\n var rx = anObject(regexp);\n var S = String(this);\n\n var functionalReplace = typeof replaceValue === 'function';\n if (!functionalReplace) replaceValue = String(replaceValue);\n\n var global = rx.global;\n if (global) {\n var fullUnicode = rx.unicode;\n rx.lastIndex = 0;\n }\n var results = [];\n while (true) {\n var result = regexpExecAbstract(rx, S);\n if (result === null) break;\n\n results.push(result);\n if (!global) break;\n\n var matchStr = String(result[0]);\n if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);\n }\n\n var accumulatedResult = '';\n var nextSourcePosition = 0;\n for (var i = 0; i < results.length; i++) {\n result = results[i];\n\n var matched = String(result[0]);\n var position = max$2(min$2(toInteger(result.index), S.length), 0);\n var captures = [];\n // NOTE: This is equivalent to\n // captures = result.slice(1).map(maybeToString)\n // but for some reason `nativeSlice.call(result, 1, result.length)` (called in\n // the slice polyfill when slicing native arrays) \"doesn't work\" in safari 9 and\n // causes a crash (https://pastebin.com/N21QzeQA) when trying to debug it.\n for (var j = 1; j < result.length; j++) captures.push(maybeToString(result[j]));\n var namedCaptures = result.groups;\n if (functionalReplace) {\n var replacerArgs = [matched].concat(captures, position, S);\n if (namedCaptures !== undefined) replacerArgs.push(namedCaptures);\n var replacement = String(replaceValue.apply(undefined, replacerArgs));\n } else {\n replacement = getSubstitution(matched, S, position, captures, namedCaptures, replaceValue);\n }\n if (position >= nextSourcePosition) {\n accumulatedResult += S.slice(nextSourcePosition, position) + replacement;\n nextSourcePosition = position + matched.length;\n }\n }\n return accumulatedResult + S.slice(nextSourcePosition);\n }\n ];\n\n // https://tc39.github.io/ecma262/#sec-getsubstitution\n function getSubstitution(matched, str, position, captures, namedCaptures, replacement) {\n var tailPos = position + matched.length;\n var m = captures.length;\n var symbols = SUBSTITUTION_SYMBOLS_NO_NAMED;\n if (namedCaptures !== undefined) {\n namedCaptures = toObject(namedCaptures);\n symbols = SUBSTITUTION_SYMBOLS;\n }\n return nativeReplace.call(replacement, symbols, function (match, ch) {\n var capture;\n switch (ch.charAt(0)) {\n case '$': return '$';\n case '&': return matched;\n case '`': return str.slice(0, position);\n case \"'\": return str.slice(tailPos);\n case '<':\n capture = namedCaptures[ch.slice(1, -1)];\n break;\n default: // \\d\\d?\n var n = +ch;\n if (n === 0) return match;\n if (n > m) {\n var f = floor$1(n / 10);\n if (f === 0) return match;\n if (f <= m) return captures[f - 1] === undefined ? ch.charAt(1) : captures[f - 1] + ch.charAt(1);\n return match;\n }\n capture = captures[n - 1];\n }\n return capture === undefined ? '' : capture;\n });\n }\n});\n\n// `SameValue` abstract operation\n// https://tc39.github.io/ecma262/#sec-samevalue\nvar sameValue = Object.is || function is(x, y) {\n // eslint-disable-next-line no-self-compare\n return x === y ? x !== 0 || 1 / x === 1 / y : x != x && y != y;\n};\n\n// @@search logic\nfixRegexpWellKnownSymbolLogic('search', 1, function (SEARCH, nativeSearch, maybeCallNative) {\n return [\n // `String.prototype.search` method\n // https://tc39.github.io/ecma262/#sec-string.prototype.search\n function search(regexp) {\n var O = requireObjectCoercible(this);\n var searcher = regexp == undefined ? undefined : regexp[SEARCH];\n return searcher !== undefined ? searcher.call(regexp, O) : new RegExp(regexp)[SEARCH](String(O));\n },\n // `RegExp.prototype[@@search]` method\n // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@search\n function (regexp) {\n var res = maybeCallNative(nativeSearch, regexp, this);\n if (res.done) return res.value;\n\n var rx = anObject(regexp);\n var S = String(this);\n\n var previousLastIndex = rx.lastIndex;\n if (!sameValue(previousLastIndex, 0)) rx.lastIndex = 0;\n var result = regexpExecAbstract(rx, S);\n if (!sameValue(rx.lastIndex, previousLastIndex)) rx.lastIndex = previousLastIndex;\n return result === null ? -1 : result.index;\n }\n ];\n});\n\nvar MATCH = wellKnownSymbol('match');\n\n// `IsRegExp` abstract operation\n// https://tc39.github.io/ecma262/#sec-isregexp\nvar isRegexp = function (it) {\n var isRegExp;\n return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : classofRaw(it) == 'RegExp');\n};\n\nvar SPECIES$4 = wellKnownSymbol('species');\n\n// `SpeciesConstructor` abstract operation\n// https://tc39.github.io/ecma262/#sec-speciesconstructor\nvar speciesConstructor = function (O, defaultConstructor) {\n var C = anObject(O).constructor;\n var S;\n return C === undefined || (S = anObject(C)[SPECIES$4]) == undefined ? defaultConstructor : aFunction$1(S);\n};\n\nvar arrayPush = [].push;\nvar min$3 = Math.min;\nvar MAX_UINT32 = 0xFFFFFFFF;\n\n// babel-minify transpiles RegExp('x', 'y') -> /x/y and it causes SyntaxError\nvar SUPPORTS_Y = !fails(function () { return !RegExp(MAX_UINT32, 'y'); });\n\n// @@split logic\nfixRegexpWellKnownSymbolLogic('split', 2, function (SPLIT, nativeSplit, maybeCallNative) {\n var internalSplit;\n if (\n 'abbc'.split(/(b)*/)[1] == 'c' ||\n 'test'.split(/(?:)/, -1).length != 4 ||\n 'ab'.split(/(?:ab)*/).length != 2 ||\n '.'.split(/(.?)(.?)/).length != 4 ||\n '.'.split(/()()/).length > 1 ||\n ''.split(/.?/).length\n ) {\n // based on es5-shim implementation, need to rework it\n internalSplit = function (separator, limit) {\n var string = String(requireObjectCoercible(this));\n var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;\n if (lim === 0) return [];\n if (separator === undefined) return [string];\n // If `separator` is not a regex, use native split\n if (!isRegexp(separator)) {\n return nativeSplit.call(string, separator, lim);\n }\n var output = [];\n var flags = (separator.ignoreCase ? 'i' : '') +\n (separator.multiline ? 'm' : '') +\n (separator.unicode ? 'u' : '') +\n (separator.sticky ? 'y' : '');\n var lastLastIndex = 0;\n // Make `global` and avoid `lastIndex` issues by working with a copy\n var separatorCopy = new RegExp(separator.source, flags + 'g');\n var match, lastIndex, lastLength;\n while (match = regexpExec.call(separatorCopy, string)) {\n lastIndex = separatorCopy.lastIndex;\n if (lastIndex > lastLastIndex) {\n output.push(string.slice(lastLastIndex, match.index));\n if (match.length > 1 && match.index < string.length) arrayPush.apply(output, match.slice(1));\n lastLength = match[0].length;\n lastLastIndex = lastIndex;\n if (output.length >= lim) break;\n }\n if (separatorCopy.lastIndex === match.index) separatorCopy.lastIndex++; // Avoid an infinite loop\n }\n if (lastLastIndex === string.length) {\n if (lastLength || !separatorCopy.test('')) output.push('');\n } else output.push(string.slice(lastLastIndex));\n return output.length > lim ? output.slice(0, lim) : output;\n };\n // Chakra, V8\n } else if ('0'.split(undefined, 0).length) {\n internalSplit = function (separator, limit) {\n return separator === undefined && limit === 0 ? [] : nativeSplit.call(this, separator, limit);\n };\n } else internalSplit = nativeSplit;\n\n return [\n // `String.prototype.split` method\n // https://tc39.github.io/ecma262/#sec-string.prototype.split\n function split(separator, limit) {\n var O = requireObjectCoercible(this);\n var splitter = separator == undefined ? undefined : separator[SPLIT];\n return splitter !== undefined\n ? splitter.call(separator, O, limit)\n : internalSplit.call(String(O), separator, limit);\n },\n // `RegExp.prototype[@@split]` method\n // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@split\n //\n // NOTE: This cannot be properly polyfilled in engines that don't support\n // the 'y' flag.\n function (regexp, limit) {\n var res = maybeCallNative(internalSplit, regexp, this, limit, internalSplit !== nativeSplit);\n if (res.done) return res.value;\n\n var rx = anObject(regexp);\n var S = String(this);\n var C = speciesConstructor(rx, RegExp);\n\n var unicodeMatching = rx.unicode;\n var flags = (rx.ignoreCase ? 'i' : '') +\n (rx.multiline ? 'm' : '') +\n (rx.unicode ? 'u' : '') +\n (SUPPORTS_Y ? 'y' : 'g');\n\n // ^(? + rx + ) is needed, in combination with some S slicing, to\n // simulate the 'y' flag.\n var splitter = new C(SUPPORTS_Y ? rx : '^(?:' + rx.source + ')', flags);\n var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;\n if (lim === 0) return [];\n if (S.length === 0) return regexpExecAbstract(splitter, S) === null ? [S] : [];\n var p = 0;\n var q = 0;\n var A = [];\n while (q < S.length) {\n splitter.lastIndex = SUPPORTS_Y ? q : 0;\n var z = regexpExecAbstract(splitter, SUPPORTS_Y ? S : S.slice(q));\n var e;\n if (\n z === null ||\n (e = min$3(toLength(splitter.lastIndex + (SUPPORTS_Y ? 0 : q)), S.length)) === p\n ) {\n q = advanceStringIndex(S, q, unicodeMatching);\n } else {\n A.push(S.slice(p, q));\n if (A.length === lim) return A;\n for (var i = 1; i <= z.length - 1; i++) {\n A.push(z[i]);\n if (A.length === lim) return A;\n }\n q = p = e;\n }\n }\n A.push(S.slice(p));\n return A;\n }\n ];\n}, !SUPPORTS_Y);\n\n// iterable DOM collections\n// flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods\nvar domIterables = {\n CSSRuleList: 0,\n CSSStyleDeclaration: 0,\n CSSValueList: 0,\n ClientRectList: 0,\n DOMRectList: 0,\n DOMStringList: 0,\n DOMTokenList: 1,\n DataTransferItemList: 0,\n FileList: 0,\n HTMLAllCollection: 0,\n HTMLCollection: 0,\n HTMLFormElement: 0,\n HTMLSelectElement: 0,\n MediaList: 0,\n MimeTypeArray: 0,\n NamedNodeMap: 0,\n NodeList: 1,\n PaintRequestList: 0,\n Plugin: 0,\n PluginArray: 0,\n SVGLengthList: 0,\n SVGNumberList: 0,\n SVGPathSegList: 0,\n SVGPointList: 0,\n SVGStringList: 0,\n SVGTransformList: 0,\n SourceBufferList: 0,\n StyleSheetList: 0,\n TextTrackCueList: 0,\n TextTrackList: 0,\n TouchList: 0\n};\n\nfor (var COLLECTION_NAME in domIterables) {\n var Collection = global_1[COLLECTION_NAME];\n var CollectionPrototype = Collection && Collection.prototype;\n // some Chrome versions have non-configurable methods on DOMTokenList\n if (CollectionPrototype && CollectionPrototype.forEach !== arrayForEach) try {\n createNonEnumerableProperty(CollectionPrototype, 'forEach', arrayForEach);\n } catch (error) {\n CollectionPrototype.forEach = arrayForEach;\n }\n}\n\nvar ITERATOR$2 = wellKnownSymbol('iterator');\nvar TO_STRING_TAG$3 = wellKnownSymbol('toStringTag');\nvar ArrayValues = es_array_iterator.values;\n\nfor (var COLLECTION_NAME$1 in domIterables) {\n var Collection$1 = global_1[COLLECTION_NAME$1];\n var CollectionPrototype$1 = Collection$1 && Collection$1.prototype;\n if (CollectionPrototype$1) {\n // some Chrome versions have non-configurable methods on DOMTokenList\n if (CollectionPrototype$1[ITERATOR$2] !== ArrayValues) try {\n createNonEnumerableProperty(CollectionPrototype$1, ITERATOR$2, ArrayValues);\n } catch (error) {\n CollectionPrototype$1[ITERATOR$2] = ArrayValues;\n }\n if (!CollectionPrototype$1[TO_STRING_TAG$3]) {\n createNonEnumerableProperty(CollectionPrototype$1, TO_STRING_TAG$3, COLLECTION_NAME$1);\n }\n if (domIterables[COLLECTION_NAME$1]) for (var METHOD_NAME in es_array_iterator) {\n // some Chrome versions have non-configurable methods on DOMTokenList\n if (CollectionPrototype$1[METHOD_NAME] !== es_array_iterator[METHOD_NAME]) try {\n createNonEnumerableProperty(CollectionPrototype$1, METHOD_NAME, es_array_iterator[METHOD_NAME]);\n } catch (error) {\n CollectionPrototype$1[METHOD_NAME] = es_array_iterator[METHOD_NAME];\n }\n }\n }\n}\n\nvar ITERATOR$3 = wellKnownSymbol('iterator');\n\nvar nativeUrl = !fails(function () {\n var url = new URL('b?a=1&b=2&c=3', 'http://a');\n var searchParams = url.searchParams;\n var result = '';\n url.pathname = 'c%20d';\n searchParams.forEach(function (value, key) {\n searchParams['delete']('b');\n result += key + value;\n });\n return (isPure && !url.toJSON)\n || !searchParams.sort\n || url.href !== 'http://a/c%20d?a=1&c=3'\n || searchParams.get('c') !== '3'\n || String(new URLSearchParams('?a=1')) !== 'a=1'\n || !searchParams[ITERATOR$3]\n // throws in Edge\n || new URL('https://a@b').username !== 'a'\n || new URLSearchParams(new URLSearchParams('a=b')).get('a') !== 'b'\n // not punycoded in Edge\n || new URL('http://тест').host !== 'xn--e1aybc'\n // not escaped in Chrome 62-\n || new URL('http://a#б').hash !== '#%D0%B1'\n // fails in Chrome 66-\n || result !== 'a1c3'\n // throws in Safari\n || new URL('http://x', undefined).host !== 'x';\n});\n\nvar anInstance = function (it, Constructor, name) {\n if (!(it instanceof Constructor)) {\n throw TypeError('Incorrect ' + (name ? name + ' ' : '') + 'invocation');\n } return it;\n};\n\nvar nativeAssign = Object.assign;\nvar defineProperty$4 = Object.defineProperty;\n\n// `Object.assign` method\n// https://tc39.github.io/ecma262/#sec-object.assign\nvar objectAssign = !nativeAssign || fails(function () {\n // should have correct order of operations (Edge bug)\n if (descriptors && nativeAssign({ b: 1 }, nativeAssign(defineProperty$4({}, 'a', {\n enumerable: true,\n get: function () {\n defineProperty$4(this, 'b', {\n value: 3,\n enumerable: false\n });\n }\n }), { b: 2 })).b !== 1) return true;\n // should work with symbols and should have deterministic property order (V8 bug)\n var A = {};\n var B = {};\n // eslint-disable-next-line no-undef\n var symbol = Symbol();\n var alphabet = 'abcdefghijklmnopqrst';\n A[symbol] = 7;\n alphabet.split('').forEach(function (chr) { B[chr] = chr; });\n return nativeAssign({}, A)[symbol] != 7 || objectKeys(nativeAssign({}, B)).join('') != alphabet;\n}) ? function assign(target, source) { // eslint-disable-line no-unused-vars\n var T = toObject(target);\n var argumentsLength = arguments.length;\n var index = 1;\n var getOwnPropertySymbols = objectGetOwnPropertySymbols.f;\n var propertyIsEnumerable = objectPropertyIsEnumerable.f;\n while (argumentsLength > index) {\n var S = indexedObject(arguments[index++]);\n var keys = getOwnPropertySymbols ? objectKeys(S).concat(getOwnPropertySymbols(S)) : objectKeys(S);\n var length = keys.length;\n var j = 0;\n var key;\n while (length > j) {\n key = keys[j++];\n if (!descriptors || propertyIsEnumerable.call(S, key)) T[key] = S[key];\n }\n } return T;\n} : nativeAssign;\n\n// call something on iterator step with safe closing on error\nvar callWithSafeIterationClosing = function (iterator, fn, value, ENTRIES) {\n try {\n return ENTRIES ? fn(anObject(value)[0], value[1]) : fn(value);\n // 7.4.6 IteratorClose(iterator, completion)\n } catch (error) {\n var returnMethod = iterator['return'];\n if (returnMethod !== undefined) anObject(returnMethod.call(iterator));\n throw error;\n }\n};\n\nvar ITERATOR$4 = wellKnownSymbol('iterator');\nvar ArrayPrototype$1 = Array.prototype;\n\n// check on default Array iterator\nvar isArrayIteratorMethod = function (it) {\n return it !== undefined && (iterators.Array === it || ArrayPrototype$1[ITERATOR$4] === it);\n};\n\nvar ITERATOR$5 = wellKnownSymbol('iterator');\n\nvar getIteratorMethod = function (it) {\n if (it != undefined) return it[ITERATOR$5]\n || it['@@iterator']\n || iterators[classof(it)];\n};\n\n// `Array.from` method implementation\n// https://tc39.github.io/ecma262/#sec-array.from\nvar arrayFrom = function from(arrayLike /* , mapfn = undefined, thisArg = undefined */) {\n var O = toObject(arrayLike);\n var C = typeof this == 'function' ? this : Array;\n var argumentsLength = arguments.length;\n var mapfn = argumentsLength > 1 ? arguments[1] : undefined;\n var mapping = mapfn !== undefined;\n var iteratorMethod = getIteratorMethod(O);\n var index = 0;\n var length, result, step, iterator, next, value;\n if (mapping) mapfn = functionBindContext(mapfn, argumentsLength > 2 ? arguments[2] : undefined, 2);\n // if the target is not iterable or it's an array with the default iterator - use a simple case\n if (iteratorMethod != undefined && !(C == Array && isArrayIteratorMethod(iteratorMethod))) {\n iterator = iteratorMethod.call(O);\n next = iterator.next;\n result = new C();\n for (;!(step = next.call(iterator)).done; index++) {\n value = mapping ? callWithSafeIterationClosing(iterator, mapfn, [step.value, index], true) : step.value;\n createProperty(result, index, value);\n }\n } else {\n length = toLength(O.length);\n result = new C(length);\n for (;length > index; index++) {\n value = mapping ? mapfn(O[index], index) : O[index];\n createProperty(result, index, value);\n }\n }\n result.length = index;\n return result;\n};\n\n// based on https://github.com/bestiejs/punycode.js/blob/master/punycode.js\nvar maxInt = 2147483647; // aka. 0x7FFFFFFF or 2^31-1\nvar base = 36;\nvar tMin = 1;\nvar tMax = 26;\nvar skew = 38;\nvar damp = 700;\nvar initialBias = 72;\nvar initialN = 128; // 0x80\nvar delimiter = '-'; // '\\x2D'\nvar regexNonASCII = /[^\\0-\\u007E]/; // non-ASCII chars\nvar regexSeparators = /[.\\u3002\\uFF0E\\uFF61]/g; // RFC 3490 separators\nvar OVERFLOW_ERROR = 'Overflow: input needs wider integers to process';\nvar baseMinusTMin = base - tMin;\nvar floor$2 = Math.floor;\nvar stringFromCharCode = String.fromCharCode;\n\n/**\n * Creates an array containing the numeric code points of each Unicode\n * character in the string. While JavaScript uses UCS-2 internally,\n * this function will convert a pair of surrogate halves (each of which\n * UCS-2 exposes as separate characters) into a single code point,\n * matching UTF-16.\n */\nvar ucs2decode = function (string) {\n var output = [];\n var counter = 0;\n var length = string.length;\n while (counter < length) {\n var value = string.charCodeAt(counter++);\n if (value >= 0xD800 && value <= 0xDBFF && counter < length) {\n // It's a high surrogate, and there is a next character.\n var extra = string.charCodeAt(counter++);\n if ((extra & 0xFC00) == 0xDC00) { // Low surrogate.\n output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);\n } else {\n // It's an unmatched surrogate; only append this code unit, in case the\n // next code unit is the high surrogate of a surrogate pair.\n output.push(value);\n counter--;\n }\n } else {\n output.push(value);\n }\n }\n return output;\n};\n\n/**\n * Converts a digit/integer into a basic code point.\n */\nvar digitToBasic = function (digit) {\n // 0..25 map to ASCII a..z or A..Z\n // 26..35 map to ASCII 0..9\n return digit + 22 + 75 * (digit < 26);\n};\n\n/**\n * Bias adaptation function as per section 3.4 of RFC 3492.\n * https://tools.ietf.org/html/rfc3492#section-3.4\n */\nvar adapt = function (delta, numPoints, firstTime) {\n var k = 0;\n delta = firstTime ? floor$2(delta / damp) : delta >> 1;\n delta += floor$2(delta / numPoints);\n for (; delta > baseMinusTMin * tMax >> 1; k += base) {\n delta = floor$2(delta / baseMinusTMin);\n }\n return floor$2(k + (baseMinusTMin + 1) * delta / (delta + skew));\n};\n\n/**\n * Converts a string of Unicode symbols (e.g. a domain name label) to a\n * Punycode string of ASCII-only symbols.\n */\n// eslint-disable-next-line max-statements\nvar encode = function (input) {\n var output = [];\n\n // Convert the input in UCS-2 to an array of Unicode code points.\n input = ucs2decode(input);\n\n // Cache the length.\n var inputLength = input.length;\n\n // Initialize the state.\n var n = initialN;\n var delta = 0;\n var bias = initialBias;\n var i, currentValue;\n\n // Handle the basic code points.\n for (i = 0; i < input.length; i++) {\n currentValue = input[i];\n if (currentValue < 0x80) {\n output.push(stringFromCharCode(currentValue));\n }\n }\n\n var basicLength = output.length; // number of basic code points.\n var handledCPCount = basicLength; // number of code points that have been handled;\n\n // Finish the basic string with a delimiter unless it's empty.\n if (basicLength) {\n output.push(delimiter);\n }\n\n // Main encoding loop:\n while (handledCPCount < inputLength) {\n // All non-basic code points < n have been handled already. Find the next larger one:\n var m = maxInt;\n for (i = 0; i < input.length; i++) {\n currentValue = input[i];\n if (currentValue >= n && currentValue < m) {\n m = currentValue;\n }\n }\n\n // Increase `delta` enough to advance the decoder's <n,i> state to <m,0>, but guard against overflow.\n var handledCPCountPlusOne = handledCPCount + 1;\n if (m - n > floor$2((maxInt - delta) / handledCPCountPlusOne)) {\n throw RangeError(OVERFLOW_ERROR);\n }\n\n delta += (m - n) * handledCPCountPlusOne;\n n = m;\n\n for (i = 0; i < input.length; i++) {\n currentValue = input[i];\n if (currentValue < n && ++delta > maxInt) {\n throw RangeError(OVERFLOW_ERROR);\n }\n if (currentValue == n) {\n // Represent delta as a generalized variable-length integer.\n var q = delta;\n for (var k = base; /* no condition */; k += base) {\n var t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);\n if (q < t) break;\n var qMinusT = q - t;\n var baseMinusT = base - t;\n output.push(stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT)));\n q = floor$2(qMinusT / baseMinusT);\n }\n\n output.push(stringFromCharCode(digitToBasic(q)));\n bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);\n delta = 0;\n ++handledCPCount;\n }\n }\n\n ++delta;\n ++n;\n }\n return output.join('');\n};\n\nvar stringPunycodeToAscii = function (input) {\n var encoded = [];\n var labels = input.toLowerCase().replace(regexSeparators, '\\u002E').split('.');\n var i, label;\n for (i = 0; i < labels.length; i++) {\n label = labels[i];\n encoded.push(regexNonASCII.test(label) ? 'xn--' + encode(label) : label);\n }\n return encoded.join('.');\n};\n\nvar redefineAll = function (target, src, options) {\n for (var key in src) redefine(target, key, src[key], options);\n return target;\n};\n\nvar getIterator = function (it) {\n var iteratorMethod = getIteratorMethod(it);\n if (typeof iteratorMethod != 'function') {\n throw TypeError(String(it) + ' is not iterable');\n } return anObject(iteratorMethod.call(it));\n};\n\n// TODO: in core-js@4, move /modules/ dependencies to public entries for better optimization by tools like `preset-env`\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nvar $fetch = getBuiltIn('fetch');\nvar Headers = getBuiltIn('Headers');\nvar ITERATOR$6 = wellKnownSymbol('iterator');\nvar URL_SEARCH_PARAMS = 'URLSearchParams';\nvar URL_SEARCH_PARAMS_ITERATOR = URL_SEARCH_PARAMS + 'Iterator';\nvar setInternalState$3 = internalState.set;\nvar getInternalParamsState = internalState.getterFor(URL_SEARCH_PARAMS);\nvar getInternalIteratorState = internalState.getterFor(URL_SEARCH_PARAMS_ITERATOR);\n\nvar plus = /\\+/g;\nvar sequences = Array(4);\n\nvar percentSequence = function (bytes) {\n return sequences[bytes - 1] || (sequences[bytes - 1] = RegExp('((?:%[\\\\da-f]{2}){' + bytes + '})', 'gi'));\n};\n\nvar percentDecode = function (sequence) {\n try {\n return decodeURIComponent(sequence);\n } catch (error) {\n return sequence;\n }\n};\n\nvar deserialize = function (it) {\n var result = it.replace(plus, ' ');\n var bytes = 4;\n try {\n return decodeURIComponent(result);\n } catch (error) {\n while (bytes) {\n result = result.replace(percentSequence(bytes--), percentDecode);\n }\n return result;\n }\n};\n\nvar find = /[!'()~]|%20/g;\n\nvar replace = {\n '!': '%21',\n \"'\": '%27',\n '(': '%28',\n ')': '%29',\n '~': '%7E',\n '%20': '+'\n};\n\nvar replacer = function (match) {\n return replace[match];\n};\n\nvar serialize = function (it) {\n return encodeURIComponent(it).replace(find, replacer);\n};\n\nvar parseSearchParams = function (result, query) {\n if (query) {\n var attributes = query.split('&');\n var index = 0;\n var attribute, entry;\n while (index < attributes.length) {\n attribute = attributes[index++];\n if (attribute.length) {\n entry = attribute.split('=');\n result.push({\n key: deserialize(entry.shift()),\n value: deserialize(entry.join('='))\n });\n }\n }\n }\n};\n\nvar updateSearchParams = function (query) {\n this.entries.length = 0;\n parseSearchParams(this.entries, query);\n};\n\nvar validateArgumentsLength = function (passed, required) {\n if (passed < required) throw TypeError('Not enough arguments');\n};\n\nvar URLSearchParamsIterator = createIteratorConstructor(function Iterator(params, kind) {\n setInternalState$3(this, {\n type: URL_SEARCH_PARAMS_ITERATOR,\n iterator: getIterator(getInternalParamsState(params).entries),\n kind: kind\n });\n}, 'Iterator', function next() {\n var state = getInternalIteratorState(this);\n var kind = state.kind;\n var step = state.iterator.next();\n var entry = step.value;\n if (!step.done) {\n step.value = kind === 'keys' ? entry.key : kind === 'values' ? entry.value : [entry.key, entry.value];\n } return step;\n});\n\n// `URLSearchParams` constructor\n// https://url.spec.whatwg.org/#interface-urlsearchparams\nvar URLSearchParamsConstructor = function URLSearchParams(/* init */) {\n anInstance(this, URLSearchParamsConstructor, URL_SEARCH_PARAMS);\n var init = arguments.length > 0 ? arguments[0] : undefined;\n var that = this;\n var entries = [];\n var iteratorMethod, iterator, next, step, entryIterator, entryNext, first, second, key;\n\n setInternalState$3(that, {\n type: URL_SEARCH_PARAMS,\n entries: entries,\n updateURL: function () { /* empty */ },\n updateSearchParams: updateSearchParams\n });\n\n if (init !== undefined) {\n if (isObject(init)) {\n iteratorMethod = getIteratorMethod(init);\n if (typeof iteratorMethod === 'function') {\n iterator = iteratorMethod.call(init);\n next = iterator.next;\n while (!(step = next.call(iterator)).done) {\n entryIterator = getIterator(anObject(step.value));\n entryNext = entryIterator.next;\n if (\n (first = entryNext.call(entryIterator)).done ||\n (second = entryNext.call(entryIterator)).done ||\n !entryNext.call(entryIterator).done\n ) throw TypeError('Expected sequence with length 2');\n entries.push({ key: first.value + '', value: second.value + '' });\n }\n } else for (key in init) if (has(init, key)) entries.push({ key: key, value: init[key] + '' });\n } else {\n parseSearchParams(entries, typeof init === 'string' ? init.charAt(0) === '?' ? init.slice(1) : init : init + '');\n }\n }\n};\n\nvar URLSearchParamsPrototype = URLSearchParamsConstructor.prototype;\n\nredefineAll(URLSearchParamsPrototype, {\n // `URLSearchParams.prototype.appent` method\n // https://url.spec.whatwg.org/#dom-urlsearchparams-append\n append: function append(name, value) {\n validateArgumentsLength(arguments.length, 2);\n var state = getInternalParamsState(this);\n state.entries.push({ key: name + '', value: value + '' });\n state.updateURL();\n },\n // `URLSearchParams.prototype.delete` method\n // https://url.spec.whatwg.org/#dom-urlsearchparams-delete\n 'delete': function (name) {\n validateArgumentsLength(arguments.length, 1);\n var state = getInternalParamsState(this);\n var entries = state.entries;\n var key = name + '';\n var index = 0;\n while (index < entries.length) {\n if (entries[index].key === key) entries.splice(index, 1);\n else index++;\n }\n state.updateURL();\n },\n // `URLSearchParams.prototype.get` method\n // https://url.spec.whatwg.org/#dom-urlsearchparams-get\n get: function get(name) {\n validateArgumentsLength(arguments.length, 1);\n var entries = getInternalParamsState(this).entries;\n var key = name + '';\n var index = 0;\n for (; index < entries.length; index++) {\n if (entries[index].key === key) return entries[index].value;\n }\n return null;\n },\n // `URLSearchParams.prototype.getAll` method\n // https://url.spec.whatwg.org/#dom-urlsearchparams-getall\n getAll: function getAll(name) {\n validateArgumentsLength(arguments.length, 1);\n var entries = getInternalParamsState(this).entries;\n var key = name + '';\n var result = [];\n var index = 0;\n for (; index < entries.length; index++) {\n if (entries[index].key === key) result.push(entries[index].value);\n }\n return result;\n },\n // `URLSearchParams.prototype.has` method\n // https://url.spec.whatwg.org/#dom-urlsearchparams-has\n has: function has(name) {\n validateArgumentsLength(arguments.length, 1);\n var entries = getInternalParamsState(this).entries;\n var key = name + '';\n var index = 0;\n while (index < entries.length) {\n if (entries[index++].key === key) return true;\n }\n return false;\n },\n // `URLSearchParams.prototype.set` method\n // https://url.spec.whatwg.org/#dom-urlsearchparams-set\n set: function set(name, value) {\n validateArgumentsLength(arguments.length, 1);\n var state = getInternalParamsState(this);\n var entries = state.entries;\n var found = false;\n var key = name + '';\n var val = value + '';\n var index = 0;\n var entry;\n for (; index < entries.length; index++) {\n entry = entries[index];\n if (entry.key === key) {\n if (found) entries.splice(index--, 1);\n else {\n found = true;\n entry.value = val;\n }\n }\n }\n if (!found) entries.push({ key: key, value: val });\n state.updateURL();\n },\n // `URLSearchParams.prototype.sort` method\n // https://url.spec.whatwg.org/#dom-urlsearchparams-sort\n sort: function sort() {\n var state = getInternalParamsState(this);\n var entries = state.entries;\n // Array#sort is not stable in some engines\n var slice = entries.slice();\n var entry, entriesIndex, sliceIndex;\n entries.length = 0;\n for (sliceIndex = 0; sliceIndex < slice.length; sliceIndex++) {\n entry = slice[sliceIndex];\n for (entriesIndex = 0; entriesIndex < sliceIndex; entriesIndex++) {\n if (entries[entriesIndex].key > entry.key) {\n entries.splice(entriesIndex, 0, entry);\n break;\n }\n }\n if (entriesIndex === sliceIndex) entries.push(entry);\n }\n state.updateURL();\n },\n // `URLSearchParams.prototype.forEach` method\n forEach: function forEach(callback /* , thisArg */) {\n var entries = getInternalParamsState(this).entries;\n var boundFunction = functionBindContext(callback, arguments.length > 1 ? arguments[1] : undefined, 3);\n var index = 0;\n var entry;\n while (index < entries.length) {\n entry = entries[index++];\n boundFunction(entry.value, entry.key, this);\n }\n },\n // `URLSearchParams.prototype.keys` method\n keys: function keys() {\n return new URLSearchParamsIterator(this, 'keys');\n },\n // `URLSearchParams.prototype.values` method\n values: function values() {\n return new URLSearchParamsIterator(this, 'values');\n },\n // `URLSearchParams.prototype.entries` method\n entries: function entries() {\n return new URLSearchParamsIterator(this, 'entries');\n }\n}, { enumerable: true });\n\n// `URLSearchParams.prototype[@@iterator]` method\nredefine(URLSearchParamsPrototype, ITERATOR$6, URLSearchParamsPrototype.entries);\n\n// `URLSearchParams.prototype.toString` method\n// https://url.spec.whatwg.org/#urlsearchparams-stringification-behavior\nredefine(URLSearchParamsPrototype, 'toString', function toString() {\n var entries = getInternalParamsState(this).entries;\n var result = [];\n var index = 0;\n var entry;\n while (index < entries.length) {\n entry = entries[index++];\n result.push(serialize(entry.key) + '=' + serialize(entry.value));\n } return result.join('&');\n}, { enumerable: true });\n\nsetToStringTag(URLSearchParamsConstructor, URL_SEARCH_PARAMS);\n\n_export({ global: true, forced: !nativeUrl }, {\n URLSearchParams: URLSearchParamsConstructor\n});\n\n// Wrap `fetch` for correct work with polyfilled `URLSearchParams`\n// https://github.com/zloirock/core-js/issues/674\nif (!nativeUrl && typeof $fetch == 'function' && typeof Headers == 'function') {\n _export({ global: true, enumerable: true, forced: true }, {\n fetch: function fetch(input /* , init */) {\n var args = [input];\n var init, body, headers;\n if (arguments.length > 1) {\n init = arguments[1];\n if (isObject(init)) {\n body = init.body;\n if (classof(body) === URL_SEARCH_PARAMS) {\n headers = init.headers ? new Headers(init.headers) : new Headers();\n if (!headers.has('content-type')) {\n headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8');\n }\n init = objectCreate(init, {\n body: createPropertyDescriptor(0, String(body)),\n headers: createPropertyDescriptor(0, headers)\n });\n }\n }\n args.push(init);\n } return $fetch.apply(this, args);\n }\n });\n}\n\nvar web_urlSearchParams = {\n URLSearchParams: URLSearchParamsConstructor,\n getState: getInternalParamsState\n};\n\n// TODO: in core-js@4, move /modules/ dependencies to public entries for better optimization by tools like `preset-env`\n\n\n\n\n\n\n\n\n\n\n\nvar codeAt = stringMultibyte.codeAt;\n\n\n\n\n\nvar NativeURL = global_1.URL;\nvar URLSearchParams$1 = web_urlSearchParams.URLSearchParams;\nvar getInternalSearchParamsState = web_urlSearchParams.getState;\nvar setInternalState$4 = internalState.set;\nvar getInternalURLState = internalState.getterFor('URL');\nvar floor$3 = Math.floor;\nvar pow = Math.pow;\n\nvar INVALID_AUTHORITY = 'Invalid authority';\nvar INVALID_SCHEME = 'Invalid scheme';\nvar INVALID_HOST = 'Invalid host';\nvar INVALID_PORT = 'Invalid port';\n\nvar ALPHA = /[A-Za-z]/;\nvar ALPHANUMERIC = /[\\d+-.A-Za-z]/;\nvar DIGIT = /\\d/;\nvar HEX_START = /^(0x|0X)/;\nvar OCT = /^[0-7]+$/;\nvar DEC = /^\\d+$/;\nvar HEX = /^[\\dA-Fa-f]+$/;\n// eslint-disable-next-line no-control-regex\nvar FORBIDDEN_HOST_CODE_POINT = /[\\u0000\\u0009\\u000A\\u000D #%/:?@[\\\\]]/;\n// eslint-disable-next-line no-control-regex\nvar FORBIDDEN_HOST_CODE_POINT_EXCLUDING_PERCENT = /[\\u0000\\u0009\\u000A\\u000D #/:?@[\\\\]]/;\n// eslint-disable-next-line no-control-regex\nvar LEADING_AND_TRAILING_C0_CONTROL_OR_SPACE = /^[\\u0000-\\u001F ]+|[\\u0000-\\u001F ]+$/g;\n// eslint-disable-next-line no-control-regex\nvar TAB_AND_NEW_LINE = /[\\u0009\\u000A\\u000D]/g;\nvar EOF;\n\nvar parseHost = function (url, input) {\n var result, codePoints, index;\n if (input.charAt(0) == '[') {\n if (input.charAt(input.length - 1) != ']') return INVALID_HOST;\n result = parseIPv6(input.slice(1, -1));\n if (!result) return INVALID_HOST;\n url.host = result;\n // opaque host\n } else if (!isSpecial(url)) {\n if (FORBIDDEN_HOST_CODE_POINT_EXCLUDING_PERCENT.test(input)) return INVALID_HOST;\n result = '';\n codePoints = arrayFrom(input);\n for (index = 0; index < codePoints.length; index++) {\n result += percentEncode(codePoints[index], C0ControlPercentEncodeSet);\n }\n url.host = result;\n } else {\n input = stringPunycodeToAscii(input);\n if (FORBIDDEN_HOST_CODE_POINT.test(input)) return INVALID_HOST;\n result = parseIPv4(input);\n if (result === null) return INVALID_HOST;\n url.host = result;\n }\n};\n\nvar parseIPv4 = function (input) {\n var parts = input.split('.');\n var partsLength, numbers, index, part, radix, number, ipv4;\n if (parts.length && parts[parts.length - 1] == '') {\n parts.pop();\n }\n partsLength = parts.length;\n if (partsLength > 4) return input;\n numbers = [];\n for (index = 0; index < partsLength; index++) {\n part = parts[index];\n if (part == '') return input;\n radix = 10;\n if (part.length > 1 && part.charAt(0) == '0') {\n radix = HEX_START.test(part) ? 16 : 8;\n part = part.slice(radix == 8 ? 1 : 2);\n }\n if (part === '') {\n number = 0;\n } else {\n if (!(radix == 10 ? DEC : radix == 8 ? OCT : HEX).test(part)) return input;\n number = parseInt(part, radix);\n }\n numbers.push(number);\n }\n for (index = 0; index < partsLength; index++) {\n number = numbers[index];\n if (index == partsLength - 1) {\n if (number >= pow(256, 5 - partsLength)) return null;\n } else if (number > 255) return null;\n }\n ipv4 = numbers.pop();\n for (index = 0; index < numbers.length; index++) {\n ipv4 += numbers[index] * pow(256, 3 - index);\n }\n return ipv4;\n};\n\n// eslint-disable-next-line max-statements\nvar parseIPv6 = function (input) {\n var address = [0, 0, 0, 0, 0, 0, 0, 0];\n var pieceIndex = 0;\n var compress = null;\n var pointer = 0;\n var value, length, numbersSeen, ipv4Piece, number, swaps, swap;\n\n var char = function () {\n return input.charAt(pointer);\n };\n\n if (char() == ':') {\n if (input.charAt(1) != ':') return;\n pointer += 2;\n pieceIndex++;\n compress = pieceIndex;\n }\n while (char()) {\n if (pieceIndex == 8) return;\n if (char() == ':') {\n if (compress !== null) return;\n pointer++;\n pieceIndex++;\n compress = pieceIndex;\n continue;\n }\n value = length = 0;\n while (length < 4 && HEX.test(char())) {\n value = value * 16 + parseInt(char(), 16);\n pointer++;\n length++;\n }\n if (char() == '.') {\n if (length == 0) return;\n pointer -= length;\n if (pieceIndex > 6) return;\n numbersSeen = 0;\n while (char()) {\n ipv4Piece = null;\n if (numbersSeen > 0) {\n if (char() == '.' && numbersSeen < 4) pointer++;\n else return;\n }\n if (!DIGIT.test(char())) return;\n while (DIGIT.test(char())) {\n number = parseInt(char(), 10);\n if (ipv4Piece === null) ipv4Piece = number;\n else if (ipv4Piece == 0) return;\n else ipv4Piece = ipv4Piece * 10 + number;\n if (ipv4Piece > 255) return;\n pointer++;\n }\n address[pieceIndex] = address[pieceIndex] * 256 + ipv4Piece;\n numbersSeen++;\n if (numbersSeen == 2 || numbersSeen == 4) pieceIndex++;\n }\n if (numbersSeen != 4) return;\n break;\n } else if (char() == ':') {\n pointer++;\n if (!char()) return;\n } else if (char()) return;\n address[pieceIndex++] = value;\n }\n if (compress !== null) {\n swaps = pieceIndex - compress;\n pieceIndex = 7;\n while (pieceIndex != 0 && swaps > 0) {\n swap = address[pieceIndex];\n address[pieceIndex--] = address[compress + swaps - 1];\n address[compress + --swaps] = swap;\n }\n } else if (pieceIndex != 8) return;\n return address;\n};\n\nvar findLongestZeroSequence = function (ipv6) {\n var maxIndex = null;\n var maxLength = 1;\n var currStart = null;\n var currLength = 0;\n var index = 0;\n for (; index < 8; index++) {\n if (ipv6[index] !== 0) {\n if (currLength > maxLength) {\n maxIndex = currStart;\n maxLength = currLength;\n }\n currStart = null;\n currLength = 0;\n } else {\n if (currStart === null) currStart = index;\n ++currLength;\n }\n }\n if (currLength > maxLength) {\n maxIndex = currStart;\n maxLength = currLength;\n }\n return maxIndex;\n};\n\nvar serializeHost = function (host) {\n var result, index, compress, ignore0;\n // ipv4\n if (typeof host == 'number') {\n result = [];\n for (index = 0; index < 4; index++) {\n result.unshift(host % 256);\n host = floor$3(host / 256);\n } return result.join('.');\n // ipv6\n } else if (typeof host == 'object') {\n result = '';\n compress = findLongestZeroSequence(host);\n for (index = 0; index < 8; index++) {\n if (ignore0 && host[index] === 0) continue;\n if (ignore0) ignore0 = false;\n if (compress === index) {\n result += index ? ':' : '::';\n ignore0 = true;\n } else {\n result += host[index].toString(16);\n if (index < 7) result += ':';\n }\n }\n return '[' + result + ']';\n } return host;\n};\n\nvar C0ControlPercentEncodeSet = {};\nvar fragmentPercentEncodeSet = objectAssign({}, C0ControlPercentEncodeSet, {\n ' ': 1, '\"': 1, '<': 1, '>': 1, '`': 1\n});\nvar pathPercentEncodeSet = objectAssign({}, fragmentPercentEncodeSet, {\n '#': 1, '?': 1, '{': 1, '}': 1\n});\nvar userinfoPercentEncodeSet = objectAssign({}, pathPercentEncodeSet, {\n '/': 1, ':': 1, ';': 1, '=': 1, '@': 1, '[': 1, '\\\\': 1, ']': 1, '^': 1, '|': 1\n});\n\nvar percentEncode = function (char, set) {\n var code = codeAt(char, 0);\n return code > 0x20 && code < 0x7F && !has(set, char) ? char : encodeURIComponent(char);\n};\n\nvar specialSchemes = {\n ftp: 21,\n file: null,\n http: 80,\n https: 443,\n ws: 80,\n wss: 443\n};\n\nvar isSpecial = function (url) {\n return has(specialSchemes, url.scheme);\n};\n\nvar includesCredentials = function (url) {\n return url.username != '' || url.password != '';\n};\n\nvar cannotHaveUsernamePasswordPort = function (url) {\n return !url.host || url.cannotBeABaseURL || url.scheme == 'file';\n};\n\nvar isWindowsDriveLetter = function (string, normalized) {\n var second;\n return string.length == 2 && ALPHA.test(string.charAt(0))\n && ((second = string.charAt(1)) == ':' || (!normalized && second == '|'));\n};\n\nvar startsWithWindowsDriveLetter = function (string) {\n var third;\n return string.length > 1 && isWindowsDriveLetter(string.slice(0, 2)) && (\n string.length == 2 ||\n ((third = string.charAt(2)) === '/' || third === '\\\\' || third === '?' || third === '#')\n );\n};\n\nvar shortenURLsPath = function (url) {\n var path = url.path;\n var pathSize = path.length;\n if (pathSize && (url.scheme != 'file' || pathSize != 1 || !isWindowsDriveLetter(path[0], true))) {\n path.pop();\n }\n};\n\nvar isSingleDot = function (segment) {\n return segment === '.' || segment.toLowerCase() === '%2e';\n};\n\nvar isDoubleDot = function (segment) {\n segment = segment.toLowerCase();\n return segment === '..' || segment === '%2e.' || segment === '.%2e' || segment === '%2e%2e';\n};\n\n// States:\nvar SCHEME_START = {};\nvar SCHEME = {};\nvar NO_SCHEME = {};\nvar SPECIAL_RELATIVE_OR_AUTHORITY = {};\nvar PATH_OR_AUTHORITY = {};\nvar RELATIVE = {};\nvar RELATIVE_SLASH = {};\nvar SPECIAL_AUTHORITY_SLASHES = {};\nvar SPECIAL_AUTHORITY_IGNORE_SLASHES = {};\nvar AUTHORITY = {};\nvar HOST = {};\nvar HOSTNAME = {};\nvar PORT = {};\nvar FILE = {};\nvar FILE_SLASH = {};\nvar FILE_HOST = {};\nvar PATH_START = {};\nvar PATH = {};\nvar CANNOT_BE_A_BASE_URL_PATH = {};\nvar QUERY = {};\nvar FRAGMENT = {};\n\n// eslint-disable-next-line max-statements\nvar parseURL = function (url, input, stateOverride, base) {\n var state = stateOverride || SCHEME_START;\n var pointer = 0;\n var buffer = '';\n var seenAt = false;\n var seenBracket = false;\n var seenPasswordToken = false;\n var codePoints, char, bufferCodePoints, failure;\n\n if (!stateOverride) {\n url.scheme = '';\n url.username = '';\n url.password = '';\n url.host = null;\n url.port = null;\n url.path = [];\n url.query = null;\n url.fragment = null;\n url.cannotBeABaseURL = false;\n input = input.replace(LEADING_AND_TRAILING_C0_CONTROL_OR_SPACE, '');\n }\n\n input = input.replace(TAB_AND_NEW_LINE, '');\n\n codePoints = arrayFrom(input);\n\n while (pointer <= codePoints.length) {\n char = codePoints[pointer];\n switch (state) {\n case SCHEME_START:\n if (char && ALPHA.test(char)) {\n buffer += char.toLowerCase();\n state = SCHEME;\n } else if (!stateOverride) {\n state = NO_SCHEME;\n continue;\n } else return INVALID_SCHEME;\n break;\n\n case SCHEME:\n if (char && (ALPHANUMERIC.test(char) || char == '+' || char == '-' || char == '.')) {\n buffer += char.toLowerCase();\n } else if (char == ':') {\n if (stateOverride && (\n (isSpecial(url) != has(specialSchemes, buffer)) ||\n (buffer == 'file' && (includesCredentials(url) || url.port !== null)) ||\n (url.scheme == 'file' && !url.host)\n )) return;\n url.scheme = buffer;\n if (stateOverride) {\n if (isSpecial(url) && specialSchemes[url.scheme] == url.port) url.port = null;\n return;\n }\n buffer = '';\n if (url.scheme == 'file') {\n state = FILE;\n } else if (isSpecial(url) && base && base.scheme == url.scheme) {\n state = SPECIAL_RELATIVE_OR_AUTHORITY;\n } else if (isSpecial(url)) {\n state = SPECIAL_AUTHORITY_SLASHES;\n } else if (codePoints[pointer + 1] == '/') {\n state = PATH_OR_AUTHORITY;\n pointer++;\n } else {\n url.cannotBeABaseURL = true;\n url.path.push('');\n state = CANNOT_BE_A_BASE_URL_PATH;\n }\n } else if (!stateOverride) {\n buffer = '';\n state = NO_SCHEME;\n pointer = 0;\n continue;\n } else return INVALID_SCHEME;\n break;\n\n case NO_SCHEME:\n if (!base || (base.cannotBeABaseURL && char != '#')) return INVALID_SCHEME;\n if (base.cannotBeABaseURL && char == '#') {\n url.scheme = base.scheme;\n url.path = base.path.slice();\n url.query = base.query;\n url.fragment = '';\n url.cannotBeABaseURL = true;\n state = FRAGMENT;\n break;\n }\n state = base.scheme == 'file' ? FILE : RELATIVE;\n continue;\n\n case SPECIAL_RELATIVE_OR_AUTHORITY:\n if (char == '/' && codePoints[pointer + 1] == '/') {\n state = SPECIAL_AUTHORITY_IGNORE_SLASHES;\n pointer++;\n } else {\n state = RELATIVE;\n continue;\n } break;\n\n case PATH_OR_AUTHORITY:\n if (char == '/') {\n state = AUTHORITY;\n break;\n } else {\n state = PATH;\n continue;\n }\n\n case RELATIVE:\n url.scheme = base.scheme;\n if (char == EOF) {\n url.username = base.username;\n url.password = base.password;\n url.host = base.host;\n url.port = base.port;\n url.path = base.path.slice();\n url.query = base.query;\n } else if (char == '/' || (char == '\\\\' && isSpecial(url))) {\n state = RELATIVE_SLASH;\n } else if (char == '?') {\n url.username = base.username;\n url.password = base.password;\n url.host = base.host;\n url.port = base.port;\n url.path = base.path.slice();\n url.query = '';\n state = QUERY;\n } else if (char == '#') {\n url.username = base.username;\n url.password = base.password;\n url.host = base.host;\n url.port = base.port;\n url.path = base.path.slice();\n url.query = base.query;\n url.fragment = '';\n state = FRAGMENT;\n } else {\n url.username = base.username;\n url.password = base.password;\n url.host = base.host;\n url.port = base.port;\n url.path = base.path.slice();\n url.path.pop();\n state = PATH;\n continue;\n } break;\n\n case RELATIVE_SLASH:\n if (isSpecial(url) && (char == '/' || char == '\\\\')) {\n state = SPECIAL_AUTHORITY_IGNORE_SLASHES;\n } else if (char == '/') {\n state = AUTHORITY;\n } else {\n url.username = base.username;\n url.password = base.password;\n url.host = base.host;\n url.port = base.port;\n state = PATH;\n continue;\n } break;\n\n case SPECIAL_AUTHORITY_SLASHES:\n state = SPECIAL_AUTHORITY_IGNORE_SLASHES;\n if (char != '/' || buffer.charAt(pointer + 1) != '/') continue;\n pointer++;\n break;\n\n case SPECIAL_AUTHORITY_IGNORE_SLASHES:\n if (char != '/' && char != '\\\\') {\n state = AUTHORITY;\n continue;\n } break;\n\n case AUTHORITY:\n if (char == '@') {\n if (seenAt) buffer = '%40' + buffer;\n seenAt = true;\n bufferCodePoints = arrayFrom(buffer);\n for (var i = 0; i < bufferCodePoints.length; i++) {\n var codePoint = bufferCodePoints[i];\n if (codePoint == ':' && !seenPasswordToken) {\n seenPasswordToken = true;\n continue;\n }\n var encodedCodePoints = percentEncode(codePoint, userinfoPercentEncodeSet);\n if (seenPasswordToken) url.password += encodedCodePoints;\n else url.username += encodedCodePoints;\n }\n buffer = '';\n } else if (\n char == EOF || char == '/' || char == '?' || char == '#' ||\n (char == '\\\\' && isSpecial(url))\n ) {\n if (seenAt && buffer == '') return INVALID_AUTHORITY;\n pointer -= arrayFrom(buffer).length + 1;\n buffer = '';\n state = HOST;\n } else buffer += char;\n break;\n\n case HOST:\n case HOSTNAME:\n if (stateOverride && url.scheme == 'file') {\n state = FILE_HOST;\n continue;\n } else if (char == ':' && !seenBracket) {\n if (buffer == '') return INVALID_HOST;\n failure = parseHost(url, buffer);\n if (failure) return failure;\n buffer = '';\n state = PORT;\n if (stateOverride == HOSTNAME) return;\n } else if (\n char == EOF || char == '/' || char == '?' || char == '#' ||\n (char == '\\\\' && isSpecial(url))\n ) {\n if (isSpecial(url) && buffer == '') return INVALID_HOST;\n if (stateOverride && buffer == '' && (includesCredentials(url) || url.port !== null)) return;\n failure = parseHost(url, buffer);\n if (failure) return failure;\n buffer = '';\n state = PATH_START;\n if (stateOverride) return;\n continue;\n } else {\n if (char == '[') seenBracket = true;\n else if (char == ']') seenBracket = false;\n buffer += char;\n } break;\n\n case PORT:\n if (DIGIT.test(char)) {\n buffer += char;\n } else if (\n char == EOF || char == '/' || char == '?' || char == '#' ||\n (char == '\\\\' && isSpecial(url)) ||\n stateOverride\n ) {\n if (buffer != '') {\n var port = parseInt(buffer, 10);\n if (port > 0xFFFF) return INVALID_PORT;\n url.port = (isSpecial(url) && port === specialSchemes[url.scheme]) ? null : port;\n buffer = '';\n }\n if (stateOverride) return;\n state = PATH_START;\n continue;\n } else return INVALID_PORT;\n break;\n\n case FILE:\n url.scheme = 'file';\n if (char == '/' || char == '\\\\') state = FILE_SLASH;\n else if (base && base.scheme == 'file') {\n if (char == EOF) {\n url.host = base.host;\n url.path = base.path.slice();\n url.query = base.query;\n } else if (char == '?') {\n url.host = base.host;\n url.path = base.path.slice();\n url.query = '';\n state = QUERY;\n } else if (char == '#') {\n url.host = base.host;\n url.path = base.path.slice();\n url.query = base.query;\n url.fragment = '';\n state = FRAGMENT;\n } else {\n if (!startsWithWindowsDriveLetter(codePoints.slice(pointer).join(''))) {\n url.host = base.host;\n url.path = base.path.slice();\n shortenURLsPath(url);\n }\n state = PATH;\n continue;\n }\n } else {\n state = PATH;\n continue;\n } break;\n\n case FILE_SLASH:\n if (char == '/' || char == '\\\\') {\n state = FILE_HOST;\n break;\n }\n if (base && base.scheme == 'file' && !startsWithWindowsDriveLetter(codePoints.slice(pointer).join(''))) {\n if (isWindowsDriveLetter(base.path[0], true)) url.path.push(base.path[0]);\n else url.host = base.host;\n }\n state = PATH;\n continue;\n\n case FILE_HOST:\n if (char == EOF || char == '/' || char == '\\\\' || char == '?' || char == '#') {\n if (!stateOverride && isWindowsDriveLetter(buffer)) {\n state = PATH;\n } else if (buffer == '') {\n url.host = '';\n if (stateOverride) return;\n state = PATH_START;\n } else {\n failure = parseHost(url, buffer);\n if (failure) return failure;\n if (url.host == 'localhost') url.host = '';\n if (stateOverride) return;\n buffer = '';\n state = PATH_START;\n } continue;\n } else buffer += char;\n break;\n\n case PATH_START:\n if (isSpecial(url)) {\n state = PATH;\n if (char != '/' && char != '\\\\') continue;\n } else if (!stateOverride && char == '?') {\n url.query = '';\n state = QUERY;\n } else if (!stateOverride && char == '#') {\n url.fragment = '';\n state = FRAGMENT;\n } else if (char != EOF) {\n state = PATH;\n if (char != '/') continue;\n } break;\n\n case PATH:\n if (\n char == EOF || char == '/' ||\n (char == '\\\\' && isSpecial(url)) ||\n (!stateOverride && (char == '?' || char == '#'))\n ) {\n if (isDoubleDot(buffer)) {\n shortenURLsPath(url);\n if (char != '/' && !(char == '\\\\' && isSpecial(url))) {\n url.path.push('');\n }\n } else if (isSingleDot(buffer)) {\n if (char != '/' && !(char == '\\\\' && isSpecial(url))) {\n url.path.push('');\n }\n } else {\n if (url.scheme == 'file' && !url.path.length && isWindowsDriveLetter(buffer)) {\n if (url.host) url.host = '';\n buffer = buffer.charAt(0) + ':'; // normalize windows drive letter\n }\n url.path.push(buffer);\n }\n buffer = '';\n if (url.scheme == 'file' && (char == EOF || char == '?' || char == '#')) {\n while (url.path.length > 1 && url.path[0] === '') {\n url.path.shift();\n }\n }\n if (char == '?') {\n url.query = '';\n state = QUERY;\n } else if (char == '#') {\n url.fragment = '';\n state = FRAGMENT;\n }\n } else {\n buffer += percentEncode(char, pathPercentEncodeSet);\n } break;\n\n case CANNOT_BE_A_BASE_URL_PATH:\n if (char == '?') {\n url.query = '';\n state = QUERY;\n } else if (char == '#') {\n url.fragment = '';\n state = FRAGMENT;\n } else if (char != EOF) {\n url.path[0] += percentEncode(char, C0ControlPercentEncodeSet);\n } break;\n\n case QUERY:\n if (!stateOverride && char == '#') {\n url.fragment = '';\n state = FRAGMENT;\n } else if (char != EOF) {\n if (char == \"'\" && isSpecial(url)) url.query += '%27';\n else if (char == '#') url.query += '%23';\n else url.query += percentEncode(char, C0ControlPercentEncodeSet);\n } break;\n\n case FRAGMENT:\n if (char != EOF) url.fragment += percentEncode(char, fragmentPercentEncodeSet);\n break;\n }\n\n pointer++;\n }\n};\n\n// `URL` constructor\n// https://url.spec.whatwg.org/#url-class\nvar URLConstructor = function URL(url /* , base */) {\n var that = anInstance(this, URLConstructor, 'URL');\n var base = arguments.length > 1 ? arguments[1] : undefined;\n var urlString = String(url);\n var state = setInternalState$4(that, { type: 'URL' });\n var baseState, failure;\n if (base !== undefined) {\n if (base instanceof URLConstructor) baseState = getInternalURLState(base);\n else {\n failure = parseURL(baseState = {}, String(base));\n if (failure) throw TypeError(failure);\n }\n }\n failure = parseURL(state, urlString, null, baseState);\n if (failure) throw TypeError(failure);\n var searchParams = state.searchParams = new URLSearchParams$1();\n var searchParamsState = getInternalSearchParamsState(searchParams);\n searchParamsState.updateSearchParams(state.query);\n searchParamsState.updateURL = function () {\n state.query = String(searchParams) || null;\n };\n if (!descriptors) {\n that.href = serializeURL.call(that);\n that.origin = getOrigin.call(that);\n that.protocol = getProtocol.call(that);\n that.username = getUsername.call(that);\n that.password = getPassword.call(that);\n that.host = getHost.call(that);\n that.hostname = getHostname.call(that);\n that.port = getPort.call(that);\n that.pathname = getPathname.call(that);\n that.search = getSearch.call(that);\n that.searchParams = getSearchParams.call(that);\n that.hash = getHash.call(that);\n }\n};\n\nvar URLPrototype = URLConstructor.prototype;\n\nvar serializeURL = function () {\n var url = getInternalURLState(this);\n var scheme = url.scheme;\n var username = url.username;\n var password = url.password;\n var host = url.host;\n var port = url.port;\n var path = url.path;\n var query = url.query;\n var fragment = url.fragment;\n var output = scheme + ':';\n if (host !== null) {\n output += '//';\n if (includesCredentials(url)) {\n output += username + (password ? ':' + password : '') + '@';\n }\n output += serializeHost(host);\n if (port !== null) output += ':' + port;\n } else if (scheme == 'file') output += '//';\n output += url.cannotBeABaseURL ? path[0] : path.length ? '/' + path.join('/') : '';\n if (query !== null) output += '?' + query;\n if (fragment !== null) output += '#' + fragment;\n return output;\n};\n\nvar getOrigin = function () {\n var url = getInternalURLState(this);\n var scheme = url.scheme;\n var port = url.port;\n if (scheme == 'blob') try {\n return new URL(scheme.path[0]).origin;\n } catch (error) {\n return 'null';\n }\n if (scheme == 'file' || !isSpecial(url)) return 'null';\n return scheme + '://' + serializeHost(url.host) + (port !== null ? ':' + port : '');\n};\n\nvar getProtocol = function () {\n return getInternalURLState(this).scheme + ':';\n};\n\nvar getUsername = function () {\n return getInternalURLState(this).username;\n};\n\nvar getPassword = function () {\n return getInternalURLState(this).password;\n};\n\nvar getHost = function () {\n var url = getInternalURLState(this);\n var host = url.host;\n var port = url.port;\n return host === null ? ''\n : port === null ? serializeHost(host)\n : serializeHost(host) + ':' + port;\n};\n\nvar getHostname = function () {\n var host = getInternalURLState(this).host;\n return host === null ? '' : serializeHost(host);\n};\n\nvar getPort = function () {\n var port = getInternalURLState(this).port;\n return port === null ? '' : String(port);\n};\n\nvar getPathname = function () {\n var url = getInternalURLState(this);\n var path = url.path;\n return url.cannotBeABaseURL ? path[0] : path.length ? '/' + path.join('/') : '';\n};\n\nvar getSearch = function () {\n var query = getInternalURLState(this).query;\n return query ? '?' + query : '';\n};\n\nvar getSearchParams = function () {\n return getInternalURLState(this).searchParams;\n};\n\nvar getHash = function () {\n var fragment = getInternalURLState(this).fragment;\n return fragment ? '#' + fragment : '';\n};\n\nvar accessorDescriptor = function (getter, setter) {\n return { get: getter, set: setter, configurable: true, enumerable: true };\n};\n\nif (descriptors) {\n objectDefineProperties(URLPrototype, {\n // `URL.prototype.href` accessors pair\n // https://url.spec.whatwg.org/#dom-url-href\n href: accessorDescriptor(serializeURL, function (href) {\n var url = getInternalURLState(this);\n var urlString = String(href);\n var failure = parseURL(url, urlString);\n if (failure) throw TypeError(failure);\n getInternalSearchParamsState(url.searchParams).updateSearchParams(url.query);\n }),\n // `URL.prototype.origin` getter\n // https://url.spec.whatwg.org/#dom-url-origin\n origin: accessorDescriptor(getOrigin),\n // `URL.prototype.protocol` accessors pair\n // https://url.spec.whatwg.org/#dom-url-protocol\n protocol: accessorDescriptor(getProtocol, function (protocol) {\n var url = getInternalURLState(this);\n parseURL(url, String(protocol) + ':', SCHEME_START);\n }),\n // `URL.prototype.username` accessors pair\n // https://url.spec.whatwg.org/#dom-url-username\n username: accessorDescriptor(getUsername, function (username) {\n var url = getInternalURLState(this);\n var codePoints = arrayFrom(String(username));\n if (cannotHaveUsernamePasswordPort(url)) return;\n url.username = '';\n for (var i = 0; i < codePoints.length; i++) {\n url.username += percentEncode(codePoints[i], userinfoPercentEncodeSet);\n }\n }),\n // `URL.prototype.password` accessors pair\n // https://url.spec.whatwg.org/#dom-url-password\n password: accessorDescriptor(getPassword, function (password) {\n var url = getInternalURLState(this);\n var codePoints = arrayFrom(String(password));\n if (cannotHaveUsernamePasswordPort(url)) return;\n url.password = '';\n for (var i = 0; i < codePoints.length; i++) {\n url.password += percentEncode(codePoints[i], userinfoPercentEncodeSet);\n }\n }),\n // `URL.prototype.host` accessors pair\n // https://url.spec.whatwg.org/#dom-url-host\n host: accessorDescriptor(getHost, function (host) {\n var url = getInternalURLState(this);\n if (url.cannotBeABaseURL) return;\n parseURL(url, String(host), HOST);\n }),\n // `URL.prototype.hostname` accessors pair\n // https://url.spec.whatwg.org/#dom-url-hostname\n hostname: accessorDescriptor(getHostname, function (hostname) {\n var url = getInternalURLState(this);\n if (url.cannotBeABaseURL) return;\n parseURL(url, String(hostname), HOSTNAME);\n }),\n // `URL.prototype.port` accessors pair\n // https://url.spec.whatwg.org/#dom-url-port\n port: accessorDescriptor(getPort, function (port) {\n var url = getInternalURLState(this);\n if (cannotHaveUsernamePasswordPort(url)) return;\n port = String(port);\n if (port == '') url.port = null;\n else parseURL(url, port, PORT);\n }),\n // `URL.prototype.pathname` accessors pair\n // https://url.spec.whatwg.org/#dom-url-pathname\n pathname: accessorDescriptor(getPathname, function (pathname) {\n var url = getInternalURLState(this);\n if (url.cannotBeABaseURL) return;\n url.path = [];\n parseURL(url, pathname + '', PATH_START);\n }),\n // `URL.prototype.search` accessors pair\n // https://url.spec.whatwg.org/#dom-url-search\n search: accessorDescriptor(getSearch, function (search) {\n var url = getInternalURLState(this);\n search = String(search);\n if (search == '') {\n url.query = null;\n } else {\n if ('?' == search.charAt(0)) search = search.slice(1);\n url.query = '';\n parseURL(url, search, QUERY);\n }\n getInternalSearchParamsState(url.searchParams).updateSearchParams(url.query);\n }),\n // `URL.prototype.searchParams` getter\n // https://url.spec.whatwg.org/#dom-url-searchparams\n searchParams: accessorDescriptor(getSearchParams),\n // `URL.prototype.hash` accessors pair\n // https://url.spec.whatwg.org/#dom-url-hash\n hash: accessorDescriptor(getHash, function (hash) {\n var url = getInternalURLState(this);\n hash = String(hash);\n if (hash == '') {\n url.fragment = null;\n return;\n }\n if ('#' == hash.charAt(0)) hash = hash.slice(1);\n url.fragment = '';\n parseURL(url, hash, FRAGMENT);\n })\n });\n}\n\n// `URL.prototype.toJSON` method\n// https://url.spec.whatwg.org/#dom-url-tojson\nredefine(URLPrototype, 'toJSON', function toJSON() {\n return serializeURL.call(this);\n}, { enumerable: true });\n\n// `URL.prototype.toString` method\n// https://url.spec.whatwg.org/#URL-stringification-behavior\nredefine(URLPrototype, 'toString', function toString() {\n return serializeURL.call(this);\n}, { enumerable: true });\n\nif (NativeURL) {\n var nativeCreateObjectURL = NativeURL.createObjectURL;\n var nativeRevokeObjectURL = NativeURL.revokeObjectURL;\n // `URL.createObjectURL` method\n // https://developer.mozilla.org/en-US/docs/Web/API/URL/createObjectURL\n // eslint-disable-next-line no-unused-vars\n if (nativeCreateObjectURL) redefine(URLConstructor, 'createObjectURL', function createObjectURL(blob) {\n return nativeCreateObjectURL.apply(NativeURL, arguments);\n });\n // `URL.revokeObjectURL` method\n // https://developer.mozilla.org/en-US/docs/Web/API/URL/revokeObjectURL\n // eslint-disable-next-line no-unused-vars\n if (nativeRevokeObjectURL) redefine(URLConstructor, 'revokeObjectURL', function revokeObjectURL(url) {\n return nativeRevokeObjectURL.apply(NativeURL, arguments);\n });\n}\n\nsetToStringTag(URLConstructor, 'URL');\n\n_export({ global: true, forced: !nativeUrl, sham: !descriptors }, {\n URL: URLConstructor\n});\n\nfunction _typeof(obj) {\n \"@babel/helpers - typeof\";\n\n if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") {\n _typeof = function (obj) {\n return typeof obj;\n };\n } else {\n _typeof = function (obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n };\n }\n\n return _typeof(obj);\n}\n\nfunction _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\n\nfunction _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\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n}\n\nfunction _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\nfunction ownKeys$1(object, enumerableOnly) {\n var keys = Object.keys(object);\n\n if (Object.getOwnPropertySymbols) {\n var symbols = Object.getOwnPropertySymbols(object);\n if (enumerableOnly) symbols = symbols.filter(function (sym) {\n return Object.getOwnPropertyDescriptor(object, sym).enumerable;\n });\n keys.push.apply(keys, symbols);\n }\n\n return keys;\n}\n\nfunction _objectSpread2(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i] != null ? arguments[i] : {};\n\n if (i % 2) {\n ownKeys$1(Object(source), true).forEach(function (key) {\n _defineProperty(target, key, source[key]);\n });\n } else if (Object.getOwnPropertyDescriptors) {\n Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));\n } else {\n ownKeys$1(Object(source)).forEach(function (key) {\n Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));\n });\n }\n }\n\n return target;\n}\n\nfunction _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n\n return target;\n}\n\nfunction _objectWithoutProperties(source, excluded) {\n if (source == null) return {};\n\n var target = _objectWithoutPropertiesLoose(source, excluded);\n\n var key, i;\n\n if (Object.getOwnPropertySymbols) {\n var sourceSymbolKeys = Object.getOwnPropertySymbols(source);\n\n for (i = 0; i < sourceSymbolKeys.length; i++) {\n key = sourceSymbolKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;\n target[key] = source[key];\n }\n }\n\n return target;\n}\n\nfunction _slicedToArray(arr, i) {\n return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();\n}\n\nfunction _toConsumableArray(arr) {\n return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();\n}\n\nfunction _arrayWithoutHoles(arr) {\n if (Array.isArray(arr)) return _arrayLikeToArray(arr);\n}\n\nfunction _arrayWithHoles(arr) {\n if (Array.isArray(arr)) return arr;\n}\n\nfunction _iterableToArray(iter) {\n if (typeof Symbol !== \"undefined\" && Symbol.iterator in Object(iter)) return Array.from(iter);\n}\n\nfunction _iterableToArrayLimit(arr, i) {\n if (typeof Symbol === \"undefined\" || !(Symbol.iterator in Object(arr))) return;\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\nfunction _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return _arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(o);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);\n}\n\nfunction _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n\n for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];\n\n return arr2;\n}\n\nfunction _nonIterableSpread() {\n throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\n\nfunction _nonIterableRest() {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\n\n(function (global) {\n /**\r\n * Polyfill URLSearchParams\r\n *\r\n * Inspired from : https://github.com/WebReflection/url-search-params/blob/master/src/url-search-params.js\r\n */\n var checkIfIteratorIsSupported = function checkIfIteratorIsSupported() {\n try {\n return !!Symbol.iterator;\n } catch (error) {\n return false;\n }\n };\n\n var iteratorSupported = checkIfIteratorIsSupported();\n\n var createIterator = function createIterator(items) {\n var iterator = {\n next: function next() {\n var value = items.shift();\n return {\n done: value === void 0,\n value: value\n };\n }\n };\n\n if (iteratorSupported) {\n iterator[Symbol.iterator] = function () {\n return iterator;\n };\n }\n\n return iterator;\n };\n /**\r\n * Search param name and values should be encoded according to https://url.spec.whatwg.org/#urlencoded-serializing\r\n * encodeURIComponent() produces the same result except encoding spaces as `%20` instead of `+`.\r\n */\n\n\n var serializeParam = function serializeParam(value) {\n return encodeURIComponent(value).replace(/%20/g, '+');\n };\n\n var deserializeParam = function deserializeParam(value) {\n return decodeURIComponent(String(value).replace(/\\+/g, ' '));\n };\n\n var polyfillURLSearchParams = function polyfillURLSearchParams() {\n var URLSearchParams = function URLSearchParams(searchString) {\n Object.defineProperty(this, '_entries', {\n writable: true,\n value: {}\n });\n\n var typeofSearchString = _typeof(searchString);\n\n if (typeofSearchString === 'undefined') ; else if (typeofSearchString === 'string') {\n if (searchString !== '') {\n this._fromString(searchString);\n }\n } else if (searchString instanceof URLSearchParams) {\n var _this = this;\n\n searchString.forEach(function (value, name) {\n _this.append(name, value);\n });\n } else if (searchString !== null && typeofSearchString === 'object') {\n if (Object.prototype.toString.call(searchString) === '[object Array]') {\n for (var i = 0; i < searchString.length; i++) {\n var entry = searchString[i];\n\n if (Object.prototype.toString.call(entry) === '[object Array]' || entry.length !== 2) {\n this.append(entry[0], entry[1]);\n } else {\n throw new TypeError('Expected [string, any] as entry at index ' + i + ' of URLSearchParams\\'s input');\n }\n }\n } else {\n for (var key in searchString) {\n if (searchString.hasOwnProperty(key)) {\n this.append(key, searchString[key]);\n }\n }\n }\n } else {\n throw new TypeError('Unsupported input\\'s type for URLSearchParams');\n }\n };\n\n var proto = URLSearchParams.prototype;\n\n proto.append = function (name, value) {\n if (name in this._entries) {\n this._entries[name].push(String(value));\n } else {\n this._entries[name] = [String(value)];\n }\n };\n\n proto.delete = function (name) {\n delete this._entries[name];\n };\n\n proto.get = function (name) {\n return name in this._entries ? this._entries[name][0] : null;\n };\n\n proto.getAll = function (name) {\n return name in this._entries ? this._entries[name].slice(0) : [];\n };\n\n proto.has = function (name) {\n return name in this._entries;\n };\n\n proto.set = function (name, value) {\n this._entries[name] = [String(value)];\n };\n\n proto.forEach = function (callback, thisArg) {\n var entries;\n\n for (var name in this._entries) {\n if (this._entries.hasOwnProperty(name)) {\n entries = this._entries[name];\n\n for (var i = 0; i < entries.length; i++) {\n callback.call(thisArg, entries[i], name, this);\n }\n }\n }\n };\n\n proto.keys = function () {\n var items = [];\n this.forEach(function (value, name) {\n items.push(name);\n });\n return createIterator(items);\n };\n\n proto.values = function () {\n var items = [];\n this.forEach(function (value) {\n items.push(value);\n });\n return createIterator(items);\n };\n\n proto.entries = function () {\n var items = [];\n this.forEach(function (value, name) {\n items.push([name, value]);\n });\n return createIterator(items);\n };\n\n if (iteratorSupported) {\n proto[Symbol.iterator] = proto.entries;\n }\n\n proto.toString = function () {\n var searchArray = [];\n this.forEach(function (value, name) {\n searchArray.push(serializeParam(name) + '=' + serializeParam(value));\n });\n return searchArray.join('&');\n };\n\n global.URLSearchParams = URLSearchParams;\n };\n\n var checkIfURLSearchParamsSupported = function checkIfURLSearchParamsSupported() {\n try {\n var URLSearchParams = global.URLSearchParams;\n return new URLSearchParams('?a=1').toString() === 'a=1' && typeof URLSearchParams.prototype.set === 'function';\n } catch (e) {\n return false;\n }\n };\n\n if (!checkIfURLSearchParamsSupported()) {\n polyfillURLSearchParams();\n }\n\n var proto = global.URLSearchParams.prototype;\n\n if (typeof proto.sort !== 'function') {\n proto.sort = function () {\n var _this = this;\n\n var items = [];\n this.forEach(function (value, name) {\n items.push([name, value]);\n\n if (!_this._entries) {\n _this.delete(name);\n }\n });\n items.sort(function (a, b) {\n if (a[0] < b[0]) {\n return -1;\n } else if (a[0] > b[0]) {\n return +1;\n } else {\n return 0;\n }\n });\n\n if (_this._entries) {\n // force reset because IE keeps keys index\n _this._entries = {};\n }\n\n for (var i = 0; i < items.length; i++) {\n this.append(items[i][0], items[i][1]);\n }\n };\n }\n\n if (typeof proto._fromString !== 'function') {\n Object.defineProperty(proto, '_fromString', {\n enumerable: false,\n configurable: false,\n writable: false,\n value: function value(searchString) {\n if (this._entries) {\n this._entries = {};\n } else {\n var keys = [];\n this.forEach(function (value, name) {\n keys.push(name);\n });\n\n for (var i = 0; i < keys.length; i++) {\n this.delete(keys[i]);\n }\n }\n\n searchString = searchString.replace(/^\\?/, '');\n var attributes = searchString.split('&');\n var attribute;\n\n for (var i = 0; i < attributes.length; i++) {\n attribute = attributes[i].split('=');\n this.append(deserializeParam(attribute[0]), attribute.length > 1 ? deserializeParam(attribute[1]) : '');\n }\n }\n });\n } // HTMLAnchorElement\n\n})(typeof commonjsGlobal !== 'undefined' ? commonjsGlobal : typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : commonjsGlobal);\n\n(function (global) {\n /**\r\n * Polyfill URL\r\n *\r\n * Inspired from : https://github.com/arv/DOM-URL-Polyfill/blob/master/src/url.js\r\n */\n var checkIfURLIsSupported = function checkIfURLIsSupported() {\n try {\n var u = new global.URL('b', 'http://a');\n u.pathname = 'c d';\n return u.href === 'http://a/c%20d' && u.searchParams;\n } catch (e) {\n return false;\n }\n };\n\n var polyfillURL = function polyfillURL() {\n var _URL = global.URL;\n\n var URL = function URL(url, base) {\n if (typeof url !== 'string') url = String(url); // Only create another document if the base is different from current location.\n\n var doc = document,\n baseElement;\n\n if (base && (global.location === void 0 || base !== global.location.href)) {\n doc = document.implementation.createHTMLDocument('');\n baseElement = doc.createElement('base');\n baseElement.href = base;\n doc.head.appendChild(baseElement);\n\n try {\n if (baseElement.href.indexOf(base) !== 0) throw new Error(baseElement.href);\n } catch (err) {\n throw new Error('URL unable to set base ' + base + ' due to ' + err);\n }\n }\n\n var anchorElement = doc.createElement('a');\n anchorElement.href = url;\n\n if (baseElement) {\n doc.body.appendChild(anchorElement);\n anchorElement.href = anchorElement.href; // force href to refresh\n }\n\n var inputElement = doc.createElement('input');\n inputElement.type = 'url';\n inputElement.value = url;\n\n if (anchorElement.protocol === ':' || !/:/.test(anchorElement.href) || !inputElement.checkValidity() && !base) {\n throw new TypeError('Invalid URL');\n }\n\n Object.defineProperty(this, '_anchorElement', {\n value: anchorElement\n }); // create a linked searchParams which reflect its changes on URL\n\n var searchParams = new global.URLSearchParams(this.search);\n var enableSearchUpdate = true;\n var enableSearchParamsUpdate = true;\n\n var _this = this;\n\n ['append', 'delete', 'set'].forEach(function (methodName) {\n var method = searchParams[methodName];\n\n searchParams[methodName] = function () {\n method.apply(searchParams, arguments);\n\n if (enableSearchUpdate) {\n enableSearchParamsUpdate = false;\n _this.search = searchParams.toString();\n enableSearchParamsUpdate = true;\n }\n };\n });\n Object.defineProperty(this, 'searchParams', {\n value: searchParams,\n enumerable: true\n });\n var search = void 0;\n Object.defineProperty(this, '_updateSearchParams', {\n enumerable: false,\n configurable: false,\n writable: false,\n value: function value() {\n if (this.search !== search) {\n search = this.search;\n\n if (enableSearchParamsUpdate) {\n enableSearchUpdate = false;\n\n this.searchParams._fromString(this.search);\n\n enableSearchUpdate = true;\n }\n }\n }\n });\n };\n\n var proto = URL.prototype;\n\n var linkURLWithAnchorAttribute = function linkURLWithAnchorAttribute(attributeName) {\n Object.defineProperty(proto, attributeName, {\n get: function get() {\n return this._anchorElement[attributeName];\n },\n set: function set(value) {\n this._anchorElement[attributeName] = value;\n },\n enumerable: true\n });\n };\n\n ['hash', 'host', 'hostname', 'port', 'protocol'].forEach(function (attributeName) {\n linkURLWithAnchorAttribute(attributeName);\n });\n Object.defineProperty(proto, 'search', {\n get: function get() {\n return this._anchorElement['search'];\n },\n set: function set(value) {\n this._anchorElement['search'] = value;\n\n this._updateSearchParams();\n },\n enumerable: true\n });\n Object.defineProperties(proto, {\n 'toString': {\n get: function get() {\n var _this = this;\n\n return function () {\n return _this.href;\n };\n }\n },\n 'href': {\n get: function get() {\n return this._anchorElement.href.replace(/\\?$/, '');\n },\n set: function set(value) {\n this._anchorElement.href = value;\n\n this._updateSearchParams();\n },\n enumerable: true\n },\n 'pathname': {\n get: function get() {\n return this._anchorElement.pathname.replace(/(^\\/?)/, '/');\n },\n set: function set(value) {\n this._anchorElement.pathname = value;\n },\n enumerable: true\n },\n 'origin': {\n get: function get() {\n // get expected port from protocol\n var expectedPort = {\n 'http:': 80,\n 'https:': 443,\n 'ftp:': 21\n }[this._anchorElement.protocol]; // add port to origin if, expected port is different than actual port\n // and it is not empty f.e http://foo:8080\n // 8080 != 80 && 8080 != ''\n\n var addPortToOrigin = this._anchorElement.port != expectedPort && this._anchorElement.port !== '';\n return this._anchorElement.protocol + '//' + this._anchorElement.hostname + (addPortToOrigin ? ':' + this._anchorElement.port : '');\n },\n enumerable: true\n },\n 'password': {\n // TODO\n get: function get() {\n return '';\n },\n set: function set(value) {},\n enumerable: true\n },\n 'username': {\n // TODO\n get: function get() {\n return '';\n },\n set: function set(value) {},\n enumerable: true\n }\n });\n\n URL.createObjectURL = function (blob) {\n return _URL.createObjectURL.apply(_URL, arguments);\n };\n\n URL.revokeObjectURL = function (url) {\n return _URL.revokeObjectURL.apply(_URL, arguments);\n };\n\n global.URL = URL;\n };\n\n if (!checkIfURLIsSupported()) {\n polyfillURL();\n }\n\n if (global.location !== void 0 && !('origin' in global.location)) {\n var getOrigin = function getOrigin() {\n return global.location.protocol + '//' + global.location.hostname + (global.location.port ? ':' + global.location.port : '');\n };\n\n try {\n Object.defineProperty(global.location, 'origin', {\n get: getOrigin,\n enumerable: true\n });\n } catch (e) {\n setInterval(function () {\n global.location.origin = getOrigin();\n }, 100);\n }\n }\n})(typeof commonjsGlobal !== 'undefined' ? commonjsGlobal : typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : commonjsGlobal);\n\nvar IS_CONCAT_SPREADABLE = wellKnownSymbol('isConcatSpreadable');\nvar MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF;\nvar MAXIMUM_ALLOWED_INDEX_EXCEEDED = 'Maximum allowed index exceeded';\n\n// We can't use this feature detection in V8 since it causes\n// deoptimization and serious performance degradation\n// https://github.com/zloirock/core-js/issues/679\nvar IS_CONCAT_SPREADABLE_SUPPORT = engineV8Version >= 51 || !fails(function () {\n var array = [];\n array[IS_CONCAT_SPREADABLE] = false;\n return array.concat()[0] !== array;\n});\n\nvar SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('concat');\n\nvar isConcatSpreadable = function (O) {\n if (!isObject(O)) return false;\n var spreadable = O[IS_CONCAT_SPREADABLE];\n return spreadable !== undefined ? !!spreadable : isArray(O);\n};\n\nvar FORCED = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT;\n\n// `Array.prototype.concat` method\n// https://tc39.github.io/ecma262/#sec-array.prototype.concat\n// with adding support of @@isConcatSpreadable and @@species\n_export({ target: 'Array', proto: true, forced: FORCED }, {\n concat: function concat(arg) { // eslint-disable-line no-unused-vars\n var O = toObject(this);\n var A = arraySpeciesCreate(O, 0);\n var n = 0;\n var i, k, length, len, E;\n for (i = -1, length = arguments.length; i < length; i++) {\n E = i === -1 ? O : arguments[i];\n if (isConcatSpreadable(E)) {\n len = toLength(E.length);\n if (n + len > MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);\n for (k = 0; k < len; k++, n++) if (k in E) createProperty(A, n, E[k]);\n } else {\n if (n >= MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);\n createProperty(A, n++, E);\n }\n }\n A.length = n;\n return A;\n }\n});\n\nvar $filter = arrayIteration.filter;\n\n\n\nvar HAS_SPECIES_SUPPORT$1 = arrayMethodHasSpeciesSupport('filter');\n// Edge 14- issue\nvar USES_TO_LENGTH$3 = arrayMethodUsesToLength('filter');\n\n// `Array.prototype.filter` method\n// https://tc39.github.io/ecma262/#sec-array.prototype.filter\n// with adding support of @@species\n_export({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT$1 || !USES_TO_LENGTH$3 }, {\n filter: function filter(callbackfn /* , thisArg */) {\n return $filter(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);\n }\n});\n\nvar $find = arrayIteration.find;\n\n\n\nvar FIND = 'find';\nvar SKIPS_HOLES = true;\n\nvar USES_TO_LENGTH$4 = arrayMethodUsesToLength(FIND);\n\n// Shouldn't skip holes\nif (FIND in []) Array(1)[FIND](function () { SKIPS_HOLES = false; });\n\n// `Array.prototype.find` method\n// https://tc39.github.io/ecma262/#sec-array.prototype.find\n_export({ target: 'Array', proto: true, forced: SKIPS_HOLES || !USES_TO_LENGTH$4 }, {\n find: function find(callbackfn /* , that = undefined */) {\n return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);\n }\n});\n\n// https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables\naddToUnscopables(FIND);\n\nvar ITERATOR$7 = wellKnownSymbol('iterator');\nvar SAFE_CLOSING = false;\n\ntry {\n var called = 0;\n var iteratorWithReturn = {\n next: function () {\n return { done: !!called++ };\n },\n 'return': function () {\n SAFE_CLOSING = true;\n }\n };\n iteratorWithReturn[ITERATOR$7] = function () {\n return this;\n };\n // eslint-disable-next-line no-throw-literal\n Array.from(iteratorWithReturn, function () { throw 2; });\n} catch (error) { /* empty */ }\n\nvar checkCorrectnessOfIteration = function (exec, SKIP_CLOSING) {\n if (!SKIP_CLOSING && !SAFE_CLOSING) return false;\n var ITERATION_SUPPORT = false;\n try {\n var object = {};\n object[ITERATOR$7] = function () {\n return {\n next: function () {\n return { done: ITERATION_SUPPORT = true };\n }\n };\n };\n exec(object);\n } catch (error) { /* empty */ }\n return ITERATION_SUPPORT;\n};\n\nvar INCORRECT_ITERATION = !checkCorrectnessOfIteration(function (iterable) {\n Array.from(iterable);\n});\n\n// `Array.from` method\n// https://tc39.github.io/ecma262/#sec-array.from\n_export({ target: 'Array', stat: true, forced: INCORRECT_ITERATION }, {\n from: arrayFrom\n});\n\nvar $includes = arrayIncludes.includes;\n\n\n\nvar USES_TO_LENGTH$5 = arrayMethodUsesToLength('indexOf', { ACCESSORS: true, 1: 0 });\n\n// `Array.prototype.includes` method\n// https://tc39.github.io/ecma262/#sec-array.prototype.includes\n_export({ target: 'Array', proto: true, forced: !USES_TO_LENGTH$5 }, {\n includes: function includes(el /* , fromIndex = 0 */) {\n return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);\n }\n});\n\n// https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables\naddToUnscopables('includes');\n\nvar $map = arrayIteration.map;\n\n\n\nvar HAS_SPECIES_SUPPORT$2 = arrayMethodHasSpeciesSupport('map');\n// FF49- issue\nvar USES_TO_LENGTH$6 = arrayMethodUsesToLength('map');\n\n// `Array.prototype.map` method\n// https://tc39.github.io/ecma262/#sec-array.prototype.map\n// with adding support of @@species\n_export({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT$2 || !USES_TO_LENGTH$6 }, {\n map: function map(callbackfn /* , thisArg */) {\n return $map(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);\n }\n});\n\n// makes subclassing work correct for wrapped built-ins\nvar inheritIfRequired = function ($this, dummy, Wrapper) {\n var NewTarget, NewTargetPrototype;\n if (\n // it can work only with native `setPrototypeOf`\n objectSetPrototypeOf &&\n // we haven't completely correct pre-ES6 way for getting `new.target`, so use this\n typeof (NewTarget = dummy.constructor) == 'function' &&\n NewTarget !== Wrapper &&\n isObject(NewTargetPrototype = NewTarget.prototype) &&\n NewTargetPrototype !== Wrapper.prototype\n ) objectSetPrototypeOf($this, NewTargetPrototype);\n return $this;\n};\n\n// a string of all valid unicode whitespaces\n// eslint-disable-next-line max-len\nvar whitespaces = '\\u0009\\u000A\\u000B\\u000C\\u000D\\u0020\\u00A0\\u1680\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u202F\\u205F\\u3000\\u2028\\u2029\\uFEFF';\n\nvar whitespace = '[' + whitespaces + ']';\nvar ltrim = RegExp('^' + whitespace + whitespace + '*');\nvar rtrim = RegExp(whitespace + whitespace + '*$');\n\n// `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation\nvar createMethod$3 = function (TYPE) {\n return function ($this) {\n var string = String(requireObjectCoercible($this));\n if (TYPE & 1) string = string.replace(ltrim, '');\n if (TYPE & 2) string = string.replace(rtrim, '');\n return string;\n };\n};\n\nvar stringTrim = {\n // `String.prototype.{ trimLeft, trimStart }` methods\n // https://tc39.github.io/ecma262/#sec-string.prototype.trimstart\n start: createMethod$3(1),\n // `String.prototype.{ trimRight, trimEnd }` methods\n // https://tc39.github.io/ecma262/#sec-string.prototype.trimend\n end: createMethod$3(2),\n // `String.prototype.trim` method\n // https://tc39.github.io/ecma262/#sec-string.prototype.trim\n trim: createMethod$3(3)\n};\n\nvar getOwnPropertyNames = objectGetOwnPropertyNames.f;\nvar getOwnPropertyDescriptor$2 = objectGetOwnPropertyDescriptor.f;\nvar defineProperty$5 = objectDefineProperty.f;\nvar trim = stringTrim.trim;\n\nvar NUMBER = 'Number';\nvar NativeNumber = global_1[NUMBER];\nvar NumberPrototype = NativeNumber.prototype;\n\n// Opera ~12 has broken Object#toString\nvar BROKEN_CLASSOF = classofRaw(objectCreate(NumberPrototype)) == NUMBER;\n\n// `ToNumber` abstract operation\n// https://tc39.github.io/ecma262/#sec-tonumber\nvar toNumber = function (argument) {\n var it = toPrimitive(argument, false);\n var first, third, radix, maxCode, digits, length, index, code;\n if (typeof it == 'string' && it.length > 2) {\n it = trim(it);\n first = it.charCodeAt(0);\n if (first === 43 || first === 45) {\n third = it.charCodeAt(2);\n if (third === 88 || third === 120) return NaN; // Number('+0x1') should be NaN, old V8 fix\n } else if (first === 48) {\n switch (it.charCodeAt(1)) {\n case 66: case 98: radix = 2; maxCode = 49; break; // fast equal of /^0b[01]+$/i\n case 79: case 111: radix = 8; maxCode = 55; break; // fast equal of /^0o[0-7]+$/i\n default: return +it;\n }\n digits = it.slice(2);\n length = digits.length;\n for (index = 0; index < length; index++) {\n code = digits.charCodeAt(index);\n // parseInt parses a string to a first unavailable symbol\n // but ToNumber should return NaN if a string contains unavailable symbols\n if (code < 48 || code > maxCode) return NaN;\n } return parseInt(digits, radix);\n }\n } return +it;\n};\n\n// `Number` constructor\n// https://tc39.github.io/ecma262/#sec-number-constructor\nif (isForced_1(NUMBER, !NativeNumber(' 0o1') || !NativeNumber('0b1') || NativeNumber('+0x1'))) {\n var NumberWrapper = function Number(value) {\n var it = arguments.length < 1 ? 0 : value;\n var dummy = this;\n return dummy instanceof NumberWrapper\n // check on 1..constructor(foo) case\n && (BROKEN_CLASSOF ? fails(function () { NumberPrototype.valueOf.call(dummy); }) : classofRaw(dummy) != NUMBER)\n ? inheritIfRequired(new NativeNumber(toNumber(it)), dummy, NumberWrapper) : toNumber(it);\n };\n for (var keys$1 = descriptors ? getOwnPropertyNames(NativeNumber) : (\n // ES3:\n 'MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,' +\n // ES2015 (in case, if modules with ES2015 Number statics required before):\n 'EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,' +\n 'MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger'\n ).split(','), j = 0, key; keys$1.length > j; j++) {\n if (has(NativeNumber, key = keys$1[j]) && !has(NumberWrapper, key)) {\n defineProperty$5(NumberWrapper, key, getOwnPropertyDescriptor$2(NativeNumber, key));\n }\n }\n NumberWrapper.prototype = NumberPrototype;\n NumberPrototype.constructor = NumberWrapper;\n redefine(global_1, NUMBER, NumberWrapper);\n}\n\nvar FAILS_ON_PRIMITIVES = fails(function () { objectKeys(1); });\n\n// `Object.keys` method\n// https://tc39.github.io/ecma262/#sec-object.keys\n_export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, {\n keys: function keys(it) {\n return objectKeys(toObject(it));\n }\n});\n\nvar notARegexp = function (it) {\n if (isRegexp(it)) {\n throw TypeError(\"The method doesn't accept regular expressions\");\n } return it;\n};\n\nvar MATCH$1 = wellKnownSymbol('match');\n\nvar correctIsRegexpLogic = function (METHOD_NAME) {\n var regexp = /./;\n try {\n '/./'[METHOD_NAME](regexp);\n } catch (e) {\n try {\n regexp[MATCH$1] = false;\n return '/./'[METHOD_NAME](regexp);\n } catch (f) { /* empty */ }\n } return false;\n};\n\n// `String.prototype.includes` method\n// https://tc39.github.io/ecma262/#sec-string.prototype.includes\n_export({ target: 'String', proto: true, forced: !correctIsRegexpLogic('includes') }, {\n includes: function includes(searchString /* , position = 0 */) {\n return !!~String(requireObjectCoercible(this))\n .indexOf(notARegexp(searchString), arguments.length > 1 ? arguments[1] : undefined);\n }\n});\n\nvar freezing = !fails(function () {\n return Object.isExtensible(Object.preventExtensions({}));\n});\n\nvar internalMetadata = createCommonjsModule(function (module) {\nvar defineProperty = objectDefineProperty.f;\n\n\n\nvar METADATA = uid('meta');\nvar id = 0;\n\nvar isExtensible = Object.isExtensible || function () {\n return true;\n};\n\nvar setMetadata = function (it) {\n defineProperty(it, METADATA, { value: {\n objectID: 'O' + ++id, // object ID\n weakData: {} // weak collections IDs\n } });\n};\n\nvar fastKey = function (it, create) {\n // return a primitive with prefix\n if (!isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;\n if (!has(it, METADATA)) {\n // can't set metadata to uncaught frozen object\n if (!isExtensible(it)) return 'F';\n // not necessary to add metadata\n if (!create) return 'E';\n // add missing metadata\n setMetadata(it);\n // return object ID\n } return it[METADATA].objectID;\n};\n\nvar getWeakData = function (it, create) {\n if (!has(it, METADATA)) {\n // can't set metadata to uncaught frozen object\n if (!isExtensible(it)) return true;\n // not necessary to add metadata\n if (!create) return false;\n // add missing metadata\n setMetadata(it);\n // return the store of weak collections IDs\n } return it[METADATA].weakData;\n};\n\n// add metadata on freeze-family methods calling\nvar onFreeze = function (it) {\n if (freezing && meta.REQUIRED && isExtensible(it) && !has(it, METADATA)) setMetadata(it);\n return it;\n};\n\nvar meta = module.exports = {\n REQUIRED: false,\n fastKey: fastKey,\n getWeakData: getWeakData,\n onFreeze: onFreeze\n};\n\nhiddenKeys[METADATA] = true;\n});\nvar internalMetadata_1 = internalMetadata.REQUIRED;\nvar internalMetadata_2 = internalMetadata.fastKey;\nvar internalMetadata_3 = internalMetadata.getWeakData;\nvar internalMetadata_4 = internalMetadata.onFreeze;\n\nvar iterate_1 = createCommonjsModule(function (module) {\nvar Result = function (stopped, result) {\n this.stopped = stopped;\n this.result = result;\n};\n\nvar iterate = module.exports = function (iterable, fn, that, AS_ENTRIES, IS_ITERATOR) {\n var boundFunction = functionBindContext(fn, that, AS_ENTRIES ? 2 : 1);\n var iterator, iterFn, index, length, result, next, step;\n\n if (IS_ITERATOR) {\n iterator = iterable;\n } else {\n iterFn = getIteratorMethod(iterable);\n if (typeof iterFn != 'function') throw TypeError('Target is not iterable');\n // optimisation for array iterators\n if (isArrayIteratorMethod(iterFn)) {\n for (index = 0, length = toLength(iterable.length); length > index; index++) {\n result = AS_ENTRIES\n ? boundFunction(anObject(step = iterable[index])[0], step[1])\n : boundFunction(iterable[index]);\n if (result && result instanceof Result) return result;\n } return new Result(false);\n }\n iterator = iterFn.call(iterable);\n }\n\n next = iterator.next;\n while (!(step = next.call(iterator)).done) {\n result = callWithSafeIterationClosing(iterator, boundFunction, step.value, AS_ENTRIES);\n if (typeof result == 'object' && result && result instanceof Result) return result;\n } return new Result(false);\n};\n\niterate.stop = function (result) {\n return new Result(true, result);\n};\n});\n\nvar collection = function (CONSTRUCTOR_NAME, wrapper, common) {\n var IS_MAP = CONSTRUCTOR_NAME.indexOf('Map') !== -1;\n var IS_WEAK = CONSTRUCTOR_NAME.indexOf('Weak') !== -1;\n var ADDER = IS_MAP ? 'set' : 'add';\n var NativeConstructor = global_1[CONSTRUCTOR_NAME];\n var NativePrototype = NativeConstructor && NativeConstructor.prototype;\n var Constructor = NativeConstructor;\n var exported = {};\n\n var fixMethod = function (KEY) {\n var nativeMethod = NativePrototype[KEY];\n redefine(NativePrototype, KEY,\n KEY == 'add' ? function add(value) {\n nativeMethod.call(this, value === 0 ? 0 : value);\n return this;\n } : KEY == 'delete' ? function (key) {\n return IS_WEAK && !isObject(key) ? false : nativeMethod.call(this, key === 0 ? 0 : key);\n } : KEY == 'get' ? function get(key) {\n return IS_WEAK && !isObject(key) ? undefined : nativeMethod.call(this, key === 0 ? 0 : key);\n } : KEY == 'has' ? function has(key) {\n return IS_WEAK && !isObject(key) ? false : nativeMethod.call(this, key === 0 ? 0 : key);\n } : function set(key, value) {\n nativeMethod.call(this, key === 0 ? 0 : key, value);\n return this;\n }\n );\n };\n\n // eslint-disable-next-line max-len\n if (isForced_1(CONSTRUCTOR_NAME, typeof NativeConstructor != 'function' || !(IS_WEAK || NativePrototype.forEach && !fails(function () {\n new NativeConstructor().entries().next();\n })))) {\n // create collection constructor\n Constructor = common.getConstructor(wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER);\n internalMetadata.REQUIRED = true;\n } else if (isForced_1(CONSTRUCTOR_NAME, true)) {\n var instance = new Constructor();\n // early implementations not supports chaining\n var HASNT_CHAINING = instance[ADDER](IS_WEAK ? {} : -0, 1) != instance;\n // V8 ~ Chromium 40- weak-collections throws on primitives, but should return false\n var THROWS_ON_PRIMITIVES = fails(function () { instance.has(1); });\n // most early implementations doesn't supports iterables, most modern - not close it correctly\n // eslint-disable-next-line no-new\n var ACCEPT_ITERABLES = checkCorrectnessOfIteration(function (iterable) { new NativeConstructor(iterable); });\n // for early implementations -0 and +0 not the same\n var BUGGY_ZERO = !IS_WEAK && fails(function () {\n // V8 ~ Chromium 42- fails only with 5+ elements\n var $instance = new NativeConstructor();\n var index = 5;\n while (index--) $instance[ADDER](index, index);\n return !$instance.has(-0);\n });\n\n if (!ACCEPT_ITERABLES) {\n Constructor = wrapper(function (dummy, iterable) {\n anInstance(dummy, Constructor, CONSTRUCTOR_NAME);\n var that = inheritIfRequired(new NativeConstructor(), dummy, Constructor);\n if (iterable != undefined) iterate_1(iterable, that[ADDER], that, IS_MAP);\n return that;\n });\n Constructor.prototype = NativePrototype;\n NativePrototype.constructor = Constructor;\n }\n\n if (THROWS_ON_PRIMITIVES || BUGGY_ZERO) {\n fixMethod('delete');\n fixMethod('has');\n IS_MAP && fixMethod('get');\n }\n\n if (BUGGY_ZERO || HASNT_CHAINING) fixMethod(ADDER);\n\n // weak collections should not contains .clear method\n if (IS_WEAK && NativePrototype.clear) delete NativePrototype.clear;\n }\n\n exported[CONSTRUCTOR_NAME] = Constructor;\n _export({ global: true, forced: Constructor != NativeConstructor }, exported);\n\n setToStringTag(Constructor, CONSTRUCTOR_NAME);\n\n if (!IS_WEAK) common.setStrong(Constructor, CONSTRUCTOR_NAME, IS_MAP);\n\n return Constructor;\n};\n\nvar getWeakData = internalMetadata.getWeakData;\n\n\n\n\n\n\n\n\nvar setInternalState$5 = internalState.set;\nvar internalStateGetterFor = internalState.getterFor;\nvar find$1 = arrayIteration.find;\nvar findIndex = arrayIteration.findIndex;\nvar id$1 = 0;\n\n// fallback for uncaught frozen keys\nvar uncaughtFrozenStore = function (store) {\n return store.frozen || (store.frozen = new UncaughtFrozenStore());\n};\n\nvar UncaughtFrozenStore = function () {\n this.entries = [];\n};\n\nvar findUncaughtFrozen = function (store, key) {\n return find$1(store.entries, function (it) {\n return it[0] === key;\n });\n};\n\nUncaughtFrozenStore.prototype = {\n get: function (key) {\n var entry = findUncaughtFrozen(this, key);\n if (entry) return entry[1];\n },\n has: function (key) {\n return !!findUncaughtFrozen(this, key);\n },\n set: function (key, value) {\n var entry = findUncaughtFrozen(this, key);\n if (entry) entry[1] = value;\n else this.entries.push([key, value]);\n },\n 'delete': function (key) {\n var index = findIndex(this.entries, function (it) {\n return it[0] === key;\n });\n if (~index) this.entries.splice(index, 1);\n return !!~index;\n }\n};\n\nvar collectionWeak = {\n getConstructor: function (wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER) {\n var C = wrapper(function (that, iterable) {\n anInstance(that, C, CONSTRUCTOR_NAME);\n setInternalState$5(that, {\n type: CONSTRUCTOR_NAME,\n id: id$1++,\n frozen: undefined\n });\n if (iterable != undefined) iterate_1(iterable, that[ADDER], that, IS_MAP);\n });\n\n var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME);\n\n var define = function (that, key, value) {\n var state = getInternalState(that);\n var data = getWeakData(anObject(key), true);\n if (data === true) uncaughtFrozenStore(state).set(key, value);\n else data[state.id] = value;\n return that;\n };\n\n redefineAll(C.prototype, {\n // 23.3.3.2 WeakMap.prototype.delete(key)\n // 23.4.3.3 WeakSet.prototype.delete(value)\n 'delete': function (key) {\n var state = getInternalState(this);\n if (!isObject(key)) return false;\n var data = getWeakData(key);\n if (data === true) return uncaughtFrozenStore(state)['delete'](key);\n return data && has(data, state.id) && delete data[state.id];\n },\n // 23.3.3.4 WeakMap.prototype.has(key)\n // 23.4.3.4 WeakSet.prototype.has(value)\n has: function has$1(key) {\n var state = getInternalState(this);\n if (!isObject(key)) return false;\n var data = getWeakData(key);\n if (data === true) return uncaughtFrozenStore(state).has(key);\n return data && has(data, state.id);\n }\n });\n\n redefineAll(C.prototype, IS_MAP ? {\n // 23.3.3.3 WeakMap.prototype.get(key)\n get: function get(key) {\n var state = getInternalState(this);\n if (isObject(key)) {\n var data = getWeakData(key);\n if (data === true) return uncaughtFrozenStore(state).get(key);\n return data ? data[state.id] : undefined;\n }\n },\n // 23.3.3.5 WeakMap.prototype.set(key, value)\n set: function set(key, value) {\n return define(this, key, value);\n }\n } : {\n // 23.4.3.1 WeakSet.prototype.add(value)\n add: function add(value) {\n return define(this, value, true);\n }\n });\n\n return C;\n }\n};\n\nvar es_weakMap = createCommonjsModule(function (module) {\n\n\n\n\n\n\nvar enforceIternalState = internalState.enforce;\n\n\nvar IS_IE11 = !global_1.ActiveXObject && 'ActiveXObject' in global_1;\nvar isExtensible = Object.isExtensible;\nvar InternalWeakMap;\n\nvar wrapper = function (init) {\n return function WeakMap() {\n return init(this, arguments.length ? arguments[0] : undefined);\n };\n};\n\n// `WeakMap` constructor\n// https://tc39.github.io/ecma262/#sec-weakmap-constructor\nvar $WeakMap = module.exports = collection('WeakMap', wrapper, collectionWeak);\n\n// IE11 WeakMap frozen keys fix\n// We can't use feature detection because it crash some old IE builds\n// https://github.com/zloirock/core-js/issues/485\nif (nativeWeakMap && IS_IE11) {\n InternalWeakMap = collectionWeak.getConstructor(wrapper, 'WeakMap', true);\n internalMetadata.REQUIRED = true;\n var WeakMapPrototype = $WeakMap.prototype;\n var nativeDelete = WeakMapPrototype['delete'];\n var nativeHas = WeakMapPrototype.has;\n var nativeGet = WeakMapPrototype.get;\n var nativeSet = WeakMapPrototype.set;\n redefineAll(WeakMapPrototype, {\n 'delete': function (key) {\n if (isObject(key) && !isExtensible(key)) {\n var state = enforceIternalState(this);\n if (!state.frozen) state.frozen = new InternalWeakMap();\n return nativeDelete.call(this, key) || state.frozen['delete'](key);\n } return nativeDelete.call(this, key);\n },\n has: function has(key) {\n if (isObject(key) && !isExtensible(key)) {\n var state = enforceIternalState(this);\n if (!state.frozen) state.frozen = new InternalWeakMap();\n return nativeHas.call(this, key) || state.frozen.has(key);\n } return nativeHas.call(this, key);\n },\n get: function get(key) {\n if (isObject(key) && !isExtensible(key)) {\n var state = enforceIternalState(this);\n if (!state.frozen) state.frozen = new InternalWeakMap();\n return nativeHas.call(this, key) ? nativeGet.call(this, key) : state.frozen.get(key);\n } return nativeGet.call(this, key);\n },\n set: function set(key, value) {\n if (isObject(key) && !isExtensible(key)) {\n var state = enforceIternalState(this);\n if (!state.frozen) state.frozen = new InternalWeakMap();\n nativeHas.call(this, key) ? nativeSet.call(this, key, value) : state.frozen.set(key, value);\n } else nativeSet.call(this, key, value);\n return this;\n }\n });\n}\n});\n\nvar $every = arrayIteration.every;\n\n\n\nvar STRICT_METHOD$3 = arrayMethodIsStrict('every');\nvar USES_TO_LENGTH$7 = arrayMethodUsesToLength('every');\n\n// `Array.prototype.every` method\n// https://tc39.github.io/ecma262/#sec-array.prototype.every\n_export({ target: 'Array', proto: true, forced: !STRICT_METHOD$3 || !USES_TO_LENGTH$7 }, {\n every: function every(callbackfn /* , thisArg */) {\n return $every(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);\n }\n});\n\n// `Object.assign` method\n// https://tc39.github.io/ecma262/#sec-object.assign\n_export({ target: 'Object', stat: true, forced: Object.assign !== objectAssign }, {\n assign: objectAssign\n});\n\nvar non = '\\u200B\\u0085\\u180E';\n\n// check that a method works with the correct list\n// of whitespaces and has a correct name\nvar stringTrimForced = function (METHOD_NAME) {\n return fails(function () {\n return !!whitespaces[METHOD_NAME]() || non[METHOD_NAME]() != non || whitespaces[METHOD_NAME].name !== METHOD_NAME;\n });\n};\n\nvar $trim = stringTrim.trim;\n\n\n// `String.prototype.trim` method\n// https://tc39.github.io/ecma262/#sec-string.prototype.trim\n_export({ target: 'String', proto: true, forced: stringTrimForced('trim') }, {\n trim: function trim() {\n return $trim(this);\n }\n});\n\nvar $some = arrayIteration.some;\n\n\n\nvar STRICT_METHOD$4 = arrayMethodIsStrict('some');\nvar USES_TO_LENGTH$8 = arrayMethodUsesToLength('some');\n\n// `Array.prototype.some` method\n// https://tc39.github.io/ecma262/#sec-array.prototype.some\n_export({ target: 'Array', proto: true, forced: !STRICT_METHOD$4 || !USES_TO_LENGTH$8 }, {\n some: function some(callbackfn /* , thisArg */) {\n return $some(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);\n }\n});\n\n// `thisNumberValue` abstract operation\n// https://tc39.github.io/ecma262/#sec-thisnumbervalue\nvar thisNumberValue = function (value) {\n if (typeof value != 'number' && classofRaw(value) != 'Number') {\n throw TypeError('Incorrect invocation');\n }\n return +value;\n};\n\n// `String.prototype.repeat` method implementation\n// https://tc39.github.io/ecma262/#sec-string.prototype.repeat\nvar stringRepeat = ''.repeat || function repeat(count) {\n var str = String(requireObjectCoercible(this));\n var result = '';\n var n = toInteger(count);\n if (n < 0 || n == Infinity) throw RangeError('Wrong number of repetitions');\n for (;n > 0; (n >>>= 1) && (str += str)) if (n & 1) result += str;\n return result;\n};\n\nvar nativeToFixed = 1.0.toFixed;\nvar floor$4 = Math.floor;\n\nvar pow$1 = function (x, n, acc) {\n return n === 0 ? acc : n % 2 === 1 ? pow$1(x, n - 1, acc * x) : pow$1(x * x, n / 2, acc);\n};\n\nvar log = function (x) {\n var n = 0;\n var x2 = x;\n while (x2 >= 4096) {\n n += 12;\n x2 /= 4096;\n }\n while (x2 >= 2) {\n n += 1;\n x2 /= 2;\n } return n;\n};\n\nvar FORCED$1 = nativeToFixed && (\n 0.00008.toFixed(3) !== '0.000' ||\n 0.9.toFixed(0) !== '1' ||\n 1.255.toFixed(2) !== '1.25' ||\n 1000000000000000128.0.toFixed(0) !== '1000000000000000128'\n) || !fails(function () {\n // V8 ~ Android 4.3-\n nativeToFixed.call({});\n});\n\n// `Number.prototype.toFixed` method\n// https://tc39.github.io/ecma262/#sec-number.prototype.tofixed\n_export({ target: 'Number', proto: true, forced: FORCED$1 }, {\n // eslint-disable-next-line max-statements\n toFixed: function toFixed(fractionDigits) {\n var number = thisNumberValue(this);\n var fractDigits = toInteger(fractionDigits);\n var data = [0, 0, 0, 0, 0, 0];\n var sign = '';\n var result = '0';\n var e, z, j, k;\n\n var multiply = function (n, c) {\n var index = -1;\n var c2 = c;\n while (++index < 6) {\n c2 += n * data[index];\n data[index] = c2 % 1e7;\n c2 = floor$4(c2 / 1e7);\n }\n };\n\n var divide = function (n) {\n var index = 6;\n var c = 0;\n while (--index >= 0) {\n c += data[index];\n data[index] = floor$4(c / n);\n c = (c % n) * 1e7;\n }\n };\n\n var dataToString = function () {\n var index = 6;\n var s = '';\n while (--index >= 0) {\n if (s !== '' || index === 0 || data[index] !== 0) {\n var t = String(data[index]);\n s = s === '' ? t : s + stringRepeat.call('0', 7 - t.length) + t;\n }\n } return s;\n };\n\n if (fractDigits < 0 || fractDigits > 20) throw RangeError('Incorrect fraction digits');\n // eslint-disable-next-line no-self-compare\n if (number != number) return 'NaN';\n if (number <= -1e21 || number >= 1e21) return String(number);\n if (number < 0) {\n sign = '-';\n number = -number;\n }\n if (number > 1e-21) {\n e = log(number * pow$1(2, 69, 1)) - 69;\n z = e < 0 ? number * pow$1(2, -e, 1) : number / pow$1(2, e, 1);\n z *= 0x10000000000000;\n e = 52 - e;\n if (e > 0) {\n multiply(0, z);\n j = fractDigits;\n while (j >= 7) {\n multiply(1e7, 0);\n j -= 7;\n }\n multiply(pow$1(10, j, 1), 0);\n j = e - 1;\n while (j >= 23) {\n divide(1 << 23);\n j -= 23;\n }\n divide(1 << j);\n multiply(1, 1);\n divide(2);\n result = dataToString();\n } else {\n multiply(0, z);\n multiply(1 << -e, 0);\n result = dataToString() + stringRepeat.call('0', fractDigits);\n }\n }\n if (fractDigits > 0) {\n k = result.length;\n result = sign + (k <= fractDigits\n ? '0.' + stringRepeat.call('0', fractDigits - k) + result\n : result.slice(0, k - fractDigits) + '.' + result.slice(k - fractDigits));\n } else {\n result = sign + result;\n } return result;\n }\n});\n\nvar propertyIsEnumerable = objectPropertyIsEnumerable.f;\n\n// `Object.{ entries, values }` methods implementation\nvar createMethod$4 = function (TO_ENTRIES) {\n return function (it) {\n var O = toIndexedObject(it);\n var keys = objectKeys(O);\n var length = keys.length;\n var i = 0;\n var result = [];\n var key;\n while (length > i) {\n key = keys[i++];\n if (!descriptors || propertyIsEnumerable.call(O, key)) {\n result.push(TO_ENTRIES ? [key, O[key]] : O[key]);\n }\n }\n return result;\n };\n};\n\nvar objectToArray = {\n // `Object.entries` method\n // https://tc39.github.io/ecma262/#sec-object.entries\n entries: createMethod$4(true),\n // `Object.values` method\n // https://tc39.github.io/ecma262/#sec-object.values\n values: createMethod$4(false)\n};\n\nvar $entries = objectToArray.entries;\n\n// `Object.entries` method\n// https://tc39.github.io/ecma262/#sec-object.entries\n_export({ target: 'Object', stat: true }, {\n entries: function entries(O) {\n return $entries(O);\n }\n});\n\nvar $values = objectToArray.values;\n\n// `Object.values` method\n// https://tc39.github.io/ecma262/#sec-object.values\n_export({ target: 'Object', stat: true }, {\n values: function values(O) {\n return $values(O);\n }\n});\n\n// `Number.isNaN` method\n// https://tc39.github.io/ecma262/#sec-number.isnan\n_export({ target: 'Number', stat: true }, {\n isNaN: function isNaN(number) {\n // eslint-disable-next-line no-self-compare\n return number != number;\n }\n});\n\nvar nativeGetOwnPropertyDescriptor$2 = objectGetOwnPropertyDescriptor.f;\n\n\nvar FAILS_ON_PRIMITIVES$1 = fails(function () { nativeGetOwnPropertyDescriptor$2(1); });\nvar FORCED$2 = !descriptors || FAILS_ON_PRIMITIVES$1;\n\n// `Object.getOwnPropertyDescriptor` method\n// https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptor\n_export({ target: 'Object', stat: true, forced: FORCED$2, sham: !descriptors }, {\n getOwnPropertyDescriptor: function getOwnPropertyDescriptor(it, key) {\n return nativeGetOwnPropertyDescriptor$2(toIndexedObject(it), key);\n }\n});\n\n// `Object.getOwnPropertyDescriptors` method\n// https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptors\n_export({ target: 'Object', stat: true, sham: !descriptors }, {\n getOwnPropertyDescriptors: function getOwnPropertyDescriptors(object) {\n var O = toIndexedObject(object);\n var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;\n var keys = ownKeys(O);\n var result = {};\n var index = 0;\n var key, descriptor;\n while (keys.length > index) {\n descriptor = getOwnPropertyDescriptor(O, key = keys[index++]);\n if (descriptor !== undefined) createProperty(result, key, descriptor);\n }\n return result;\n }\n});\n\n// @@match logic\nfixRegexpWellKnownSymbolLogic('match', 1, function (MATCH, nativeMatch, maybeCallNative) {\n return [\n // `String.prototype.match` method\n // https://tc39.github.io/ecma262/#sec-string.prototype.match\n function match(regexp) {\n var O = requireObjectCoercible(this);\n var matcher = regexp == undefined ? undefined : regexp[MATCH];\n return matcher !== undefined ? matcher.call(regexp, O) : new RegExp(regexp)[MATCH](String(O));\n },\n // `RegExp.prototype[@@match]` method\n // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@match\n function (regexp) {\n var res = maybeCallNative(nativeMatch, regexp, this);\n if (res.done) return res.value;\n\n var rx = anObject(regexp);\n var S = String(this);\n\n if (!rx.global) return regexpExecAbstract(rx, S);\n\n var fullUnicode = rx.unicode;\n rx.lastIndex = 0;\n var A = [];\n var n = 0;\n var result;\n while ((result = regexpExecAbstract(rx, S)) !== null) {\n var matchStr = String(result[0]);\n A[n] = matchStr;\n if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);\n n++;\n }\n return n === 0 ? null : A;\n }\n ];\n});\n\nfunction _classCallCheck$1(e, t) {\n if (!(e instanceof t)) throw new TypeError(\"Cannot call a class as a function\");\n}\n\nfunction _defineProperties$1(e, t) {\n for (var n = 0; n < t.length; n++) {\n var r = t[n];\n r.enumerable = r.enumerable || !1, r.configurable = !0, \"value\" in r && (r.writable = !0), Object.defineProperty(e, r.key, r);\n }\n}\n\nfunction _createClass$1(e, t, n) {\n return t && _defineProperties$1(e.prototype, t), n && _defineProperties$1(e, n), e;\n}\n\nfunction _defineProperty$1(e, t, n) {\n return t in e ? Object.defineProperty(e, t, {\n value: n,\n enumerable: !0,\n configurable: !0,\n writable: !0\n }) : e[t] = n, e;\n}\n\nfunction ownKeys$2(e, t) {\n var n = Object.keys(e);\n\n if (Object.getOwnPropertySymbols) {\n var r = Object.getOwnPropertySymbols(e);\n t && (r = r.filter(function (t) {\n return Object.getOwnPropertyDescriptor(e, t).enumerable;\n })), n.push.apply(n, r);\n }\n\n return n;\n}\n\nfunction _objectSpread2$1(e) {\n for (var t = 1; t < arguments.length; t++) {\n var n = null != arguments[t] ? arguments[t] : {};\n t % 2 ? ownKeys$2(Object(n), !0).forEach(function (t) {\n _defineProperty$1(e, t, n[t]);\n }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : ownKeys$2(Object(n)).forEach(function (t) {\n Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(n, t));\n });\n }\n\n return e;\n}\n\nvar defaults = {\n addCSS: !0,\n thumbWidth: 15,\n watch: !0\n};\n\nfunction matches(e, t) {\n return function () {\n return Array.from(document.querySelectorAll(t)).includes(this);\n }.call(e, t);\n}\n\nfunction trigger(e, t) {\n if (e && t) {\n var n = new Event(t, {\n bubbles: !0\n });\n e.dispatchEvent(n);\n }\n}\n\nvar getConstructor = function getConstructor(e) {\n return null != e ? e.constructor : null;\n},\n instanceOf = function instanceOf(e, t) {\n return !!(e && t && e instanceof t);\n},\n isNullOrUndefined = function isNullOrUndefined(e) {\n return null == e;\n},\n isObject$1 = function isObject(e) {\n return getConstructor(e) === Object;\n},\n isNumber = function isNumber(e) {\n return getConstructor(e) === Number && !Number.isNaN(e);\n},\n isString = function isString(e) {\n return getConstructor(e) === String;\n},\n isBoolean = function isBoolean(e) {\n return getConstructor(e) === Boolean;\n},\n isFunction = function isFunction(e) {\n return getConstructor(e) === Function;\n},\n isArray$1 = function isArray(e) {\n return Array.isArray(e);\n},\n isNodeList = function isNodeList(e) {\n return instanceOf(e, NodeList);\n},\n isElement = function isElement(e) {\n return instanceOf(e, Element);\n},\n isEvent = function isEvent(e) {\n return instanceOf(e, Event);\n},\n isEmpty = function isEmpty(e) {\n return isNullOrUndefined(e) || (isString(e) || isArray$1(e) || isNodeList(e)) && !e.length || isObject$1(e) && !Object.keys(e).length;\n},\n is = {\n nullOrUndefined: isNullOrUndefined,\n object: isObject$1,\n number: isNumber,\n string: isString,\n boolean: isBoolean,\n function: isFunction,\n array: isArray$1,\n nodeList: isNodeList,\n element: isElement,\n event: isEvent,\n empty: isEmpty\n};\n\nfunction getDecimalPlaces(e) {\n var t = \"\".concat(e).match(/(?:\\.(\\d+))?(?:[eE]([+-]?\\d+))?$/);\n return t ? Math.max(0, (t[1] ? t[1].length : 0) - (t[2] ? +t[2] : 0)) : 0;\n}\n\nfunction round(e, t) {\n if (1 > t) {\n var n = getDecimalPlaces(t);\n return parseFloat(e.toFixed(n));\n }\n\n return Math.round(e / t) * t;\n}\n\nvar RangeTouch = function () {\n function e(t, n) {\n _classCallCheck$1(this, e), is.element(t) ? this.element = t : is.string(t) && (this.element = document.querySelector(t)), is.element(this.element) && is.empty(this.element.rangeTouch) && (this.config = _objectSpread2$1({}, defaults, {}, n), this.init());\n }\n\n return _createClass$1(e, [{\n key: \"init\",\n value: function value() {\n e.enabled && (this.config.addCSS && (this.element.style.userSelect = \"none\", this.element.style.webKitUserSelect = \"none\", this.element.style.touchAction = \"manipulation\"), this.listeners(!0), this.element.rangeTouch = this);\n }\n }, {\n key: \"destroy\",\n value: function value() {\n e.enabled && (this.config.addCSS && (this.element.style.userSelect = \"\", this.element.style.webKitUserSelect = \"\", this.element.style.touchAction = \"\"), this.listeners(!1), this.element.rangeTouch = null);\n }\n }, {\n key: \"listeners\",\n value: function value(e) {\n var t = this,\n n = e ? \"addEventListener\" : \"removeEventListener\";\n [\"touchstart\", \"touchmove\", \"touchend\"].forEach(function (e) {\n t.element[n](e, function (e) {\n return t.set(e);\n }, !1);\n });\n }\n }, {\n key: \"get\",\n value: function value(t) {\n if (!e.enabled || !is.event(t)) return null;\n var n,\n r = t.target,\n i = t.changedTouches[0],\n o = parseFloat(r.getAttribute(\"min\")) || 0,\n s = parseFloat(r.getAttribute(\"max\")) || 100,\n u = parseFloat(r.getAttribute(\"step\")) || 1,\n c = r.getBoundingClientRect(),\n a = 100 / c.width * (this.config.thumbWidth / 2) / 100;\n return 0 > (n = 100 / c.width * (i.clientX - c.left)) ? n = 0 : 100 < n && (n = 100), 50 > n ? n -= (100 - 2 * n) * a : 50 < n && (n += 2 * (n - 50) * a), o + round(n / 100 * (s - o), u);\n }\n }, {\n key: \"set\",\n value: function value(t) {\n e.enabled && is.event(t) && !t.target.disabled && (t.preventDefault(), t.target.value = this.get(t), trigger(t.target, \"touchend\" === t.type ? \"change\" : \"input\"));\n }\n }], [{\n key: \"setup\",\n value: function value(t) {\n var n = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : {},\n r = null;\n if (is.empty(t) || is.string(t) ? r = Array.from(document.querySelectorAll(is.string(t) ? t : 'input[type=\"range\"]')) : is.element(t) ? r = [t] : is.nodeList(t) ? r = Array.from(t) : is.array(t) && (r = t.filter(is.element)), is.empty(r)) return null;\n\n var i = _objectSpread2$1({}, defaults, {}, n);\n\n if (is.string(t) && i.watch) {\n var o = new MutationObserver(function (n) {\n Array.from(n).forEach(function (n) {\n Array.from(n.addedNodes).forEach(function (n) {\n is.element(n) && matches(n, t) && new e(n, i);\n });\n });\n });\n o.observe(document.body, {\n childList: !0,\n subtree: !0\n });\n }\n\n return r.map(function (t) {\n return new e(t, n);\n });\n }\n }, {\n key: \"enabled\",\n get: function get() {\n return \"ontouchstart\" in document.documentElement;\n }\n }]), e;\n}();\n\nvar nativePromiseConstructor = global_1.Promise;\n\nvar SPECIES$5 = wellKnownSymbol('species');\n\nvar setSpecies = function (CONSTRUCTOR_NAME) {\n var Constructor = getBuiltIn(CONSTRUCTOR_NAME);\n var defineProperty = objectDefineProperty.f;\n\n if (descriptors && Constructor && !Constructor[SPECIES$5]) {\n defineProperty(Constructor, SPECIES$5, {\n configurable: true,\n get: function () { return this; }\n });\n }\n};\n\nvar engineIsIos = /(iphone|ipod|ipad).*applewebkit/i.test(engineUserAgent);\n\nvar location = global_1.location;\nvar set$1 = global_1.setImmediate;\nvar clear = global_1.clearImmediate;\nvar process$1 = global_1.process;\nvar MessageChannel = global_1.MessageChannel;\nvar Dispatch = global_1.Dispatch;\nvar counter = 0;\nvar queue = {};\nvar ONREADYSTATECHANGE = 'onreadystatechange';\nvar defer, channel, port;\n\nvar run = function (id) {\n // eslint-disable-next-line no-prototype-builtins\n if (queue.hasOwnProperty(id)) {\n var fn = queue[id];\n delete queue[id];\n fn();\n }\n};\n\nvar runner = function (id) {\n return function () {\n run(id);\n };\n};\n\nvar listener = function (event) {\n run(event.data);\n};\n\nvar post = function (id) {\n // old engines have not location.origin\n global_1.postMessage(id + '', location.protocol + '//' + location.host);\n};\n\n// Node.js 0.9+ & IE10+ has setImmediate, otherwise:\nif (!set$1 || !clear) {\n set$1 = function setImmediate(fn) {\n var args = [];\n var i = 1;\n while (arguments.length > i) args.push(arguments[i++]);\n queue[++counter] = function () {\n // eslint-disable-next-line no-new-func\n (typeof fn == 'function' ? fn : Function(fn)).apply(undefined, args);\n };\n defer(counter);\n return counter;\n };\n clear = function clearImmediate(id) {\n delete queue[id];\n };\n // Node.js 0.8-\n if (classofRaw(process$1) == 'process') {\n defer = function (id) {\n process$1.nextTick(runner(id));\n };\n // Sphere (JS game engine) Dispatch API\n } else if (Dispatch && Dispatch.now) {\n defer = function (id) {\n Dispatch.now(runner(id));\n };\n // Browsers with MessageChannel, includes WebWorkers\n // except iOS - https://github.com/zloirock/core-js/issues/624\n } else if (MessageChannel && !engineIsIos) {\n channel = new MessageChannel();\n port = channel.port2;\n channel.port1.onmessage = listener;\n defer = functionBindContext(port.postMessage, port, 1);\n // Browsers with postMessage, skip WebWorkers\n // IE8 has postMessage, but it's sync & typeof its postMessage is 'object'\n } else if (\n global_1.addEventListener &&\n typeof postMessage == 'function' &&\n !global_1.importScripts &&\n !fails(post) &&\n location.protocol !== 'file:'\n ) {\n defer = post;\n global_1.addEventListener('message', listener, false);\n // IE8-\n } else if (ONREADYSTATECHANGE in documentCreateElement('script')) {\n defer = function (id) {\n html.appendChild(documentCreateElement('script'))[ONREADYSTATECHANGE] = function () {\n html.removeChild(this);\n run(id);\n };\n };\n // Rest old browsers\n } else {\n defer = function (id) {\n setTimeout(runner(id), 0);\n };\n }\n}\n\nvar task = {\n set: set$1,\n clear: clear\n};\n\nvar getOwnPropertyDescriptor$3 = objectGetOwnPropertyDescriptor.f;\n\nvar macrotask = task.set;\n\n\nvar MutationObserver$1 = global_1.MutationObserver || global_1.WebKitMutationObserver;\nvar process$2 = global_1.process;\nvar Promise$1 = global_1.Promise;\nvar IS_NODE = classofRaw(process$2) == 'process';\n// Node.js 11 shows ExperimentalWarning on getting `queueMicrotask`\nvar queueMicrotaskDescriptor = getOwnPropertyDescriptor$3(global_1, 'queueMicrotask');\nvar queueMicrotask = queueMicrotaskDescriptor && queueMicrotaskDescriptor.value;\n\nvar flush, head, last, notify, toggle, node, promise, then;\n\n// modern engines have queueMicrotask method\nif (!queueMicrotask) {\n flush = function () {\n var parent, fn;\n if (IS_NODE && (parent = process$2.domain)) parent.exit();\n while (head) {\n fn = head.fn;\n head = head.next;\n try {\n fn();\n } catch (error) {\n if (head) notify();\n else last = undefined;\n throw error;\n }\n } last = undefined;\n if (parent) parent.enter();\n };\n\n // Node.js\n if (IS_NODE) {\n notify = function () {\n process$2.nextTick(flush);\n };\n // browsers with MutationObserver, except iOS - https://github.com/zloirock/core-js/issues/339\n } else if (MutationObserver$1 && !engineIsIos) {\n toggle = true;\n node = document.createTextNode('');\n new MutationObserver$1(flush).observe(node, { characterData: true });\n notify = function () {\n node.data = toggle = !toggle;\n };\n // environments with maybe non-completely correct, but existent Promise\n } else if (Promise$1 && Promise$1.resolve) {\n // Promise.resolve without an argument throws an error in LG WebOS 2\n promise = Promise$1.resolve(undefined);\n then = promise.then;\n notify = function () {\n then.call(promise, flush);\n };\n // for other environments - macrotask based on:\n // - setImmediate\n // - MessageChannel\n // - window.postMessag\n // - onreadystatechange\n // - setTimeout\n } else {\n notify = function () {\n // strange IE + webpack dev server bug - use .call(global)\n macrotask.call(global_1, flush);\n };\n }\n}\n\nvar microtask = queueMicrotask || function (fn) {\n var task = { fn: fn, next: undefined };\n if (last) last.next = task;\n if (!head) {\n head = task;\n notify();\n } last = task;\n};\n\nvar PromiseCapability = function (C) {\n var resolve, reject;\n this.promise = new C(function ($$resolve, $$reject) {\n if (resolve !== undefined || reject !== undefined) throw TypeError('Bad Promise constructor');\n resolve = $$resolve;\n reject = $$reject;\n });\n this.resolve = aFunction$1(resolve);\n this.reject = aFunction$1(reject);\n};\n\n// 25.4.1.5 NewPromiseCapability(C)\nvar f$7 = function (C) {\n return new PromiseCapability(C);\n};\n\nvar newPromiseCapability = {\n\tf: f$7\n};\n\nvar promiseResolve = function (C, x) {\n anObject(C);\n if (isObject(x) && x.constructor === C) return x;\n var promiseCapability = newPromiseCapability.f(C);\n var resolve = promiseCapability.resolve;\n resolve(x);\n return promiseCapability.promise;\n};\n\nvar hostReportErrors = function (a, b) {\n var console = global_1.console;\n if (console && console.error) {\n arguments.length === 1 ? console.error(a) : console.error(a, b);\n }\n};\n\nvar perform = function (exec) {\n try {\n return { error: false, value: exec() };\n } catch (error) {\n return { error: true, value: error };\n }\n};\n\nvar task$1 = task.set;\n\n\n\n\n\n\n\n\n\n\nvar SPECIES$6 = wellKnownSymbol('species');\nvar PROMISE = 'Promise';\nvar getInternalState$3 = internalState.get;\nvar setInternalState$6 = internalState.set;\nvar getInternalPromiseState = internalState.getterFor(PROMISE);\nvar PromiseConstructor = nativePromiseConstructor;\nvar TypeError$1 = global_1.TypeError;\nvar document$2 = global_1.document;\nvar process$3 = global_1.process;\nvar $fetch$1 = getBuiltIn('fetch');\nvar newPromiseCapability$1 = newPromiseCapability.f;\nvar newGenericPromiseCapability = newPromiseCapability$1;\nvar IS_NODE$1 = classofRaw(process$3) == 'process';\nvar DISPATCH_EVENT = !!(document$2 && document$2.createEvent && global_1.dispatchEvent);\nvar UNHANDLED_REJECTION = 'unhandledrejection';\nvar REJECTION_HANDLED = 'rejectionhandled';\nvar PENDING = 0;\nvar FULFILLED = 1;\nvar REJECTED = 2;\nvar HANDLED = 1;\nvar UNHANDLED = 2;\nvar Internal, OwnPromiseCapability, PromiseWrapper, nativeThen;\n\nvar FORCED$3 = isForced_1(PROMISE, function () {\n var GLOBAL_CORE_JS_PROMISE = inspectSource(PromiseConstructor) !== String(PromiseConstructor);\n if (!GLOBAL_CORE_JS_PROMISE) {\n // V8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables\n // https://bugs.chromium.org/p/chromium/issues/detail?id=830565\n // We can't detect it synchronously, so just check versions\n if (engineV8Version === 66) return true;\n // Unhandled rejections tracking support, NodeJS Promise without it fails @@species test\n if (!IS_NODE$1 && typeof PromiseRejectionEvent != 'function') return true;\n }\n // We can't use @@species feature detection in V8 since it causes\n // deoptimization and performance degradation\n // https://github.com/zloirock/core-js/issues/679\n if (engineV8Version >= 51 && /native code/.test(PromiseConstructor)) return false;\n // Detect correctness of subclassing with @@species support\n var promise = PromiseConstructor.resolve(1);\n var FakePromise = function (exec) {\n exec(function () { /* empty */ }, function () { /* empty */ });\n };\n var constructor = promise.constructor = {};\n constructor[SPECIES$6] = FakePromise;\n return !(promise.then(function () { /* empty */ }) instanceof FakePromise);\n});\n\nvar INCORRECT_ITERATION$1 = FORCED$3 || !checkCorrectnessOfIteration(function (iterable) {\n PromiseConstructor.all(iterable)['catch'](function () { /* empty */ });\n});\n\n// helpers\nvar isThenable = function (it) {\n var then;\n return isObject(it) && typeof (then = it.then) == 'function' ? then : false;\n};\n\nvar notify$1 = function (promise, state, isReject) {\n if (state.notified) return;\n state.notified = true;\n var chain = state.reactions;\n microtask(function () {\n var value = state.value;\n var ok = state.state == FULFILLED;\n var index = 0;\n // variable length - can't use forEach\n while (chain.length > index) {\n var reaction = chain[index++];\n var handler = ok ? reaction.ok : reaction.fail;\n var resolve = reaction.resolve;\n var reject = reaction.reject;\n var domain = reaction.domain;\n var result, then, exited;\n try {\n if (handler) {\n if (!ok) {\n if (state.rejection === UNHANDLED) onHandleUnhandled(promise, state);\n state.rejection = HANDLED;\n }\n if (handler === true) result = value;\n else {\n if (domain) domain.enter();\n result = handler(value); // can throw\n if (domain) {\n domain.exit();\n exited = true;\n }\n }\n if (result === reaction.promise) {\n reject(TypeError$1('Promise-chain cycle'));\n } else if (then = isThenable(result)) {\n then.call(result, resolve, reject);\n } else resolve(result);\n } else reject(value);\n } catch (error) {\n if (domain && !exited) domain.exit();\n reject(error);\n }\n }\n state.reactions = [];\n state.notified = false;\n if (isReject && !state.rejection) onUnhandled(promise, state);\n });\n};\n\nvar dispatchEvent = function (name, promise, reason) {\n var event, handler;\n if (DISPATCH_EVENT) {\n event = document$2.createEvent('Event');\n event.promise = promise;\n event.reason = reason;\n event.initEvent(name, false, true);\n global_1.dispatchEvent(event);\n } else event = { promise: promise, reason: reason };\n if (handler = global_1['on' + name]) handler(event);\n else if (name === UNHANDLED_REJECTION) hostReportErrors('Unhandled promise rejection', reason);\n};\n\nvar onUnhandled = function (promise, state) {\n task$1.call(global_1, function () {\n var value = state.value;\n var IS_UNHANDLED = isUnhandled(state);\n var result;\n if (IS_UNHANDLED) {\n result = perform(function () {\n if (IS_NODE$1) {\n process$3.emit('unhandledRejection', value, promise);\n } else dispatchEvent(UNHANDLED_REJECTION, promise, value);\n });\n // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should\n state.rejection = IS_NODE$1 || isUnhandled(state) ? UNHANDLED : HANDLED;\n if (result.error) throw result.value;\n }\n });\n};\n\nvar isUnhandled = function (state) {\n return state.rejection !== HANDLED && !state.parent;\n};\n\nvar onHandleUnhandled = function (promise, state) {\n task$1.call(global_1, function () {\n if (IS_NODE$1) {\n process$3.emit('rejectionHandled', promise);\n } else dispatchEvent(REJECTION_HANDLED, promise, state.value);\n });\n};\n\nvar bind = function (fn, promise, state, unwrap) {\n return function (value) {\n fn(promise, state, value, unwrap);\n };\n};\n\nvar internalReject = function (promise, state, value, unwrap) {\n if (state.done) return;\n state.done = true;\n if (unwrap) state = unwrap;\n state.value = value;\n state.state = REJECTED;\n notify$1(promise, state, true);\n};\n\nvar internalResolve = function (promise, state, value, unwrap) {\n if (state.done) return;\n state.done = true;\n if (unwrap) state = unwrap;\n try {\n if (promise === value) throw TypeError$1(\"Promise can't be resolved itself\");\n var then = isThenable(value);\n if (then) {\n microtask(function () {\n var wrapper = { done: false };\n try {\n then.call(value,\n bind(internalResolve, promise, wrapper, state),\n bind(internalReject, promise, wrapper, state)\n );\n } catch (error) {\n internalReject(promise, wrapper, error, state);\n }\n });\n } else {\n state.value = value;\n state.state = FULFILLED;\n notify$1(promise, state, false);\n }\n } catch (error) {\n internalReject(promise, { done: false }, error, state);\n }\n};\n\n// constructor polyfill\nif (FORCED$3) {\n // 25.4.3.1 Promise(executor)\n PromiseConstructor = function Promise(executor) {\n anInstance(this, PromiseConstructor, PROMISE);\n aFunction$1(executor);\n Internal.call(this);\n var state = getInternalState$3(this);\n try {\n executor(bind(internalResolve, this, state), bind(internalReject, this, state));\n } catch (error) {\n internalReject(this, state, error);\n }\n };\n // eslint-disable-next-line no-unused-vars\n Internal = function Promise(executor) {\n setInternalState$6(this, {\n type: PROMISE,\n done: false,\n notified: false,\n parent: false,\n reactions: [],\n rejection: false,\n state: PENDING,\n value: undefined\n });\n };\n Internal.prototype = redefineAll(PromiseConstructor.prototype, {\n // `Promise.prototype.then` method\n // https://tc39.github.io/ecma262/#sec-promise.prototype.then\n then: function then(onFulfilled, onRejected) {\n var state = getInternalPromiseState(this);\n var reaction = newPromiseCapability$1(speciesConstructor(this, PromiseConstructor));\n reaction.ok = typeof onFulfilled == 'function' ? onFulfilled : true;\n reaction.fail = typeof onRejected == 'function' && onRejected;\n reaction.domain = IS_NODE$1 ? process$3.domain : undefined;\n state.parent = true;\n state.reactions.push(reaction);\n if (state.state != PENDING) notify$1(this, state, false);\n return reaction.promise;\n },\n // `Promise.prototype.catch` method\n // https://tc39.github.io/ecma262/#sec-promise.prototype.catch\n 'catch': function (onRejected) {\n return this.then(undefined, onRejected);\n }\n });\n OwnPromiseCapability = function () {\n var promise = new Internal();\n var state = getInternalState$3(promise);\n this.promise = promise;\n this.resolve = bind(internalResolve, promise, state);\n this.reject = bind(internalReject, promise, state);\n };\n newPromiseCapability.f = newPromiseCapability$1 = function (C) {\n return C === PromiseConstructor || C === PromiseWrapper\n ? new OwnPromiseCapability(C)\n : newGenericPromiseCapability(C);\n };\n\n if ( typeof nativePromiseConstructor == 'function') {\n nativeThen = nativePromiseConstructor.prototype.then;\n\n // wrap native Promise#then for native async functions\n redefine(nativePromiseConstructor.prototype, 'then', function then(onFulfilled, onRejected) {\n var that = this;\n return new PromiseConstructor(function (resolve, reject) {\n nativeThen.call(that, resolve, reject);\n }).then(onFulfilled, onRejected);\n // https://github.com/zloirock/core-js/issues/640\n }, { unsafe: true });\n\n // wrap fetch result\n if (typeof $fetch$1 == 'function') _export({ global: true, enumerable: true, forced: true }, {\n // eslint-disable-next-line no-unused-vars\n fetch: function fetch(input /* , init */) {\n return promiseResolve(PromiseConstructor, $fetch$1.apply(global_1, arguments));\n }\n });\n }\n}\n\n_export({ global: true, wrap: true, forced: FORCED$3 }, {\n Promise: PromiseConstructor\n});\n\nsetToStringTag(PromiseConstructor, PROMISE, false);\nsetSpecies(PROMISE);\n\nPromiseWrapper = getBuiltIn(PROMISE);\n\n// statics\n_export({ target: PROMISE, stat: true, forced: FORCED$3 }, {\n // `Promise.reject` method\n // https://tc39.github.io/ecma262/#sec-promise.reject\n reject: function reject(r) {\n var capability = newPromiseCapability$1(this);\n capability.reject.call(undefined, r);\n return capability.promise;\n }\n});\n\n_export({ target: PROMISE, stat: true, forced: FORCED$3 }, {\n // `Promise.resolve` method\n // https://tc39.github.io/ecma262/#sec-promise.resolve\n resolve: function resolve(x) {\n return promiseResolve( this, x);\n }\n});\n\n_export({ target: PROMISE, stat: true, forced: INCORRECT_ITERATION$1 }, {\n // `Promise.all` method\n // https://tc39.github.io/ecma262/#sec-promise.all\n all: function all(iterable) {\n var C = this;\n var capability = newPromiseCapability$1(C);\n var resolve = capability.resolve;\n var reject = capability.reject;\n var result = perform(function () {\n var $promiseResolve = aFunction$1(C.resolve);\n var values = [];\n var counter = 0;\n var remaining = 1;\n iterate_1(iterable, function (promise) {\n var index = counter++;\n var alreadyCalled = false;\n values.push(undefined);\n remaining++;\n $promiseResolve.call(C, promise).then(function (value) {\n if (alreadyCalled) return;\n alreadyCalled = true;\n values[index] = value;\n --remaining || resolve(values);\n }, reject);\n });\n --remaining || resolve(values);\n });\n if (result.error) reject(result.value);\n return capability.promise;\n },\n // `Promise.race` method\n // https://tc39.github.io/ecma262/#sec-promise.race\n race: function race(iterable) {\n var C = this;\n var capability = newPromiseCapability$1(C);\n var reject = capability.reject;\n var result = perform(function () {\n var $promiseResolve = aFunction$1(C.resolve);\n iterate_1(iterable, function (promise) {\n $promiseResolve.call(C, promise).then(capability.resolve, reject);\n });\n });\n if (result.error) reject(result.value);\n return capability.promise;\n }\n});\n\nvar getOwnPropertyDescriptor$4 = objectGetOwnPropertyDescriptor.f;\n\n\n\n\n\n\nvar nativeStartsWith = ''.startsWith;\nvar min$4 = Math.min;\n\nvar CORRECT_IS_REGEXP_LOGIC = correctIsRegexpLogic('startsWith');\n// https://github.com/zloirock/core-js/pull/702\nvar MDN_POLYFILL_BUG = !CORRECT_IS_REGEXP_LOGIC && !!function () {\n var descriptor = getOwnPropertyDescriptor$4(String.prototype, 'startsWith');\n return descriptor && !descriptor.writable;\n}();\n\n// `String.prototype.startsWith` method\n// https://tc39.github.io/ecma262/#sec-string.prototype.startswith\n_export({ target: 'String', proto: true, forced: !MDN_POLYFILL_BUG && !CORRECT_IS_REGEXP_LOGIC }, {\n startsWith: function startsWith(searchString /* , position = 0 */) {\n var that = String(requireObjectCoercible(this));\n notARegexp(searchString);\n var index = toLength(min$4(arguments.length > 1 ? arguments[1] : undefined, that.length));\n var search = String(searchString);\n return nativeStartsWith\n ? nativeStartsWith.call(that, search, index)\n : that.slice(index, index + search.length) === search;\n }\n});\n\n// ==========================================================================\n// Type checking utils\n// ==========================================================================\nvar getConstructor$1 = function getConstructor(input) {\n return input !== null && typeof input !== 'undefined' ? input.constructor : null;\n};\n\nvar instanceOf$1 = function instanceOf(input, constructor) {\n return Boolean(input && constructor && input instanceof constructor);\n};\n\nvar isNullOrUndefined$1 = function isNullOrUndefined(input) {\n return input === null || typeof input === 'undefined';\n};\n\nvar isObject$2 = function isObject(input) {\n return getConstructor$1(input) === Object;\n};\n\nvar isNumber$1 = function isNumber(input) {\n return getConstructor$1(input) === Number && !Number.isNaN(input);\n};\n\nvar isString$1 = function isString(input) {\n return getConstructor$1(input) === String;\n};\n\nvar isBoolean$1 = function isBoolean(input) {\n return getConstructor$1(input) === Boolean;\n};\n\nvar isFunction$1 = function isFunction(input) {\n return getConstructor$1(input) === Function;\n};\n\nvar isArray$2 = function isArray(input) {\n return Array.isArray(input);\n};\n\nvar isWeakMap = function isWeakMap(input) {\n return instanceOf$1(input, WeakMap);\n};\n\nvar isNodeList$1 = function isNodeList(input) {\n return instanceOf$1(input, NodeList);\n};\n\nvar isElement$1 = function isElement(input) {\n return instanceOf$1(input, Element);\n};\n\nvar isTextNode = function isTextNode(input) {\n return getConstructor$1(input) === Text;\n};\n\nvar isEvent$1 = function isEvent(input) {\n return instanceOf$1(input, Event);\n};\n\nvar isKeyboardEvent = function isKeyboardEvent(input) {\n return instanceOf$1(input, KeyboardEvent);\n};\n\nvar isCue = function isCue(input) {\n return instanceOf$1(input, window.TextTrackCue) || instanceOf$1(input, window.VTTCue);\n};\n\nvar isTrack = function isTrack(input) {\n return instanceOf$1(input, TextTrack) || !isNullOrUndefined$1(input) && isString$1(input.kind);\n};\n\nvar isPromise = function isPromise(input) {\n return instanceOf$1(input, Promise) && isFunction$1(input.then);\n};\n\nvar isEmpty$1 = function isEmpty(input) {\n return isNullOrUndefined$1(input) || (isString$1(input) || isArray$2(input) || isNodeList$1(input)) && !input.length || isObject$2(input) && !Object.keys(input).length;\n};\n\nvar 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\nvar is$1 = {\n nullOrUndefined: isNullOrUndefined$1,\n object: isObject$2,\n number: isNumber$1,\n string: isString$1,\n boolean: isBoolean$1,\n function: isFunction$1,\n array: isArray$2,\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\nvar 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\nfunction 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// ==========================================================================\nvar 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// `Array.prototype.{ reduce, reduceRight }` methods implementation\nvar createMethod$5 = function (IS_RIGHT) {\n return function (that, callbackfn, argumentsLength, memo) {\n aFunction$1(callbackfn);\n var O = toObject(that);\n var self = indexedObject(O);\n var length = toLength(O.length);\n var index = IS_RIGHT ? length - 1 : 0;\n var i = IS_RIGHT ? -1 : 1;\n if (argumentsLength < 2) while (true) {\n if (index in self) {\n memo = self[index];\n index += i;\n break;\n }\n index += i;\n if (IS_RIGHT ? index < 0 : length <= index) {\n throw TypeError('Reduce of empty array with no initial value');\n }\n }\n for (;IS_RIGHT ? index >= 0 : length > index; index += i) if (index in self) {\n memo = callbackfn(memo, self[index], index, O);\n }\n return memo;\n };\n};\n\nvar arrayReduce = {\n // `Array.prototype.reduce` method\n // https://tc39.github.io/ecma262/#sec-array.prototype.reduce\n left: createMethod$5(false),\n // `Array.prototype.reduceRight` method\n // https://tc39.github.io/ecma262/#sec-array.prototype.reduceright\n right: createMethod$5(true)\n};\n\nvar $reduce = arrayReduce.left;\n\n\n\nvar STRICT_METHOD$5 = arrayMethodIsStrict('reduce');\nvar USES_TO_LENGTH$9 = arrayMethodUsesToLength('reduce', { 1: 0 });\n\n// `Array.prototype.reduce` method\n// https://tc39.github.io/ecma262/#sec-array.prototype.reduce\n_export({ target: 'Array', proto: true, forced: !STRICT_METHOD$5 || !USES_TO_LENGTH$9 }, {\n reduce: function reduce(callbackfn /* , initialValue */) {\n return $reduce(this, callbackfn, arguments.length, arguments.length > 1 ? arguments[1] : undefined);\n }\n});\n\nfunction cloneDeep(object) {\n return JSON.parse(JSON.stringify(object));\n} // Get a nested value in an object\n\nfunction 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\nfunction 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\nfunction wrap$1(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\nfunction 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\nfunction 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\nfunction 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\nfunction 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\nfunction 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\nfunction 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\nfunction 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\nfunction 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 });\n return extend(existing, attributes);\n} // Toggle hidden\n\nfunction 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\nfunction 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\nfunction hasClass(element, className) {\n return is$1.element(element) && element.classList.contains(className);\n} // Element matches selector\n\nfunction matches$1(element, selector) {\n var _Element = Element,\n prototype = _Element.prototype;\n\n function match() {\n return Array.from(document.querySelectorAll(selector)).includes(this);\n }\n\n var method = prototype.matches || prototype.webkitMatchesSelector || prototype.mozMatchesSelector || prototype.msMatchesSelector || match;\n return method.call(element, selector);\n} // Closest ancestor element matching selector (also tests element itself)\n\nfunction closest(element, selector) {\n var _Element2 = Element,\n prototype = _Element2.prototype; // https://developer.mozilla.org/en-US/docs/Web/API/Element/closest#Polyfill\n\n function closestElement() {\n var el = this;\n\n do {\n if (matches$1.matches(el, selector)) return el;\n el = el.parentElement || el.parentNode;\n } while (el !== null && el.nodeType === 1);\n\n return null;\n }\n\n var method = prototype.closest || closestElement;\n return method.call(element, selector);\n} // Find all elements\n\nfunction getElements(selector) {\n return this.elements.container.querySelectorAll(selector);\n} // Find a single element\n\nfunction getElement(selector) {\n return this.elements.container.querySelector(selector);\n} // Set focus and tab focus class\n\nfunction 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\nvar 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\nvar 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// https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md\n// https://www.youtube.com/watch?v=NPM6172J22g\n\nvar 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\nfunction 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\nfunction 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\nfunction 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\nfunction 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\nfunction 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: _objectSpread2(_objectSpread2({}, detail), {}, {\n plyr: this\n })\n }); // Dispatch the event\n\n element.dispatchEvent(event);\n} // Unbind all cached event listeners\n\nfunction 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\nfunction 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/**\n * Silence a Promise-like object.\n * This is useful for avoiding non-harmful, but potentially confusing \"uncaught\n * play promise\" rejection error messages.\n * @param {Object} value An object that may or may not be `Promise`-like.\n */\n\nfunction silencePromise(value) {\n if (is$1.promise(value)) {\n value.then(null, function () {});\n }\n}\n\nfunction 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}\nfunction 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}\nfunction 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\nfunction setAspectRatio(input) {\n if (!this.isVideo) {\n return {};\n }\n\n var wrapper = this.elements.wrapper;\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 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.config.vimeo.premium && this.supported.ui) {\n var height = 100 / this.media.offsetWidth * parseInt(window.getComputedStyle(this.media).paddingBottom, 10);\n var offset = (height - padding) / (height / 50);\n this.media.style.transform = \"translateY(-\".concat(offset, \"%)\");\n } else if (this.isHTML5) {\n wrapper.classList.toggle(this.config.classNames.videoFixedRatio, ratio !== null);\n }\n\n return {\n padding: padding,\n ratio: ratio\n };\n}\n\nvar 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 // Whether we're forcing all options (e.g. for streaming)\n if (this.config.quality.forced) {\n return this.config.quality.options;\n } // Get sizes from <source> elements\n\n\n return html5.getSources.call(this).map(function (source) {\n return Number(source.getAttribute('data-res'));\n }).filter(Boolean);\n },\n setup: function setup() {\n if (!this.isHTML5) {\n return;\n }\n\n var player = this; // Set speed options from config\n\n player.options.speed = player.config.speed.options; // 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('data-res'));\n },\n set: function set(input) {\n if (player.quality === input) {\n return;\n } // If we're using an an external handler...\n\n\n if (player.config.quality.forced && is$1.function(player.config.quality.onChange)) {\n player.config.quality.onChange(input);\n } else {\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('data-res')) === 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,\n playbackRate = _player$media.playbackRate; // 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.speed = playbackRate;\n player.currentTime = currentTime; // Resume playing\n\n if (!paused) {\n silencePromise(player.play());\n }\n }); // Load new source\n\n player.media.load();\n }\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\nfunction 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\nfunction closest$1(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\nvar defineProperty$6 = objectDefineProperty.f;\nvar getOwnPropertyNames$1 = objectGetOwnPropertyNames.f;\n\n\n\n\n\nvar setInternalState$7 = internalState.set;\n\n\n\nvar MATCH$2 = wellKnownSymbol('match');\nvar NativeRegExp = global_1.RegExp;\nvar RegExpPrototype$1 = NativeRegExp.prototype;\nvar re1 = /a/g;\nvar re2 = /a/g;\n\n// \"new\" should create a new object, old webkit bug\nvar CORRECT_NEW = new NativeRegExp(re1) !== re1;\n\nvar UNSUPPORTED_Y$2 = regexpStickyHelpers.UNSUPPORTED_Y;\n\nvar FORCED$4 = descriptors && isForced_1('RegExp', (!CORRECT_NEW || UNSUPPORTED_Y$2 || fails(function () {\n re2[MATCH$2] = false;\n // RegExp constructor can alter flags and IsRegExp works correct with @@match\n return NativeRegExp(re1) != re1 || NativeRegExp(re2) == re2 || NativeRegExp(re1, 'i') != '/a/i';\n})));\n\n// `RegExp` constructor\n// https://tc39.github.io/ecma262/#sec-regexp-constructor\nif (FORCED$4) {\n var RegExpWrapper = function RegExp(pattern, flags) {\n var thisIsRegExp = this instanceof RegExpWrapper;\n var patternIsRegExp = isRegexp(pattern);\n var flagsAreUndefined = flags === undefined;\n var sticky;\n\n if (!thisIsRegExp && patternIsRegExp && pattern.constructor === RegExpWrapper && flagsAreUndefined) {\n return pattern;\n }\n\n if (CORRECT_NEW) {\n if (patternIsRegExp && !flagsAreUndefined) pattern = pattern.source;\n } else if (pattern instanceof RegExpWrapper) {\n if (flagsAreUndefined) flags = regexpFlags.call(pattern);\n pattern = pattern.source;\n }\n\n if (UNSUPPORTED_Y$2) {\n sticky = !!flags && flags.indexOf('y') > -1;\n if (sticky) flags = flags.replace(/y/g, '');\n }\n\n var result = inheritIfRequired(\n CORRECT_NEW ? new NativeRegExp(pattern, flags) : NativeRegExp(pattern, flags),\n thisIsRegExp ? this : RegExpPrototype$1,\n RegExpWrapper\n );\n\n if (UNSUPPORTED_Y$2 && sticky) setInternalState$7(result, { sticky: sticky });\n\n return result;\n };\n var proxy = function (key) {\n key in RegExpWrapper || defineProperty$6(RegExpWrapper, key, {\n configurable: true,\n get: function () { return NativeRegExp[key]; },\n set: function (it) { NativeRegExp[key] = it; }\n });\n };\n var keys$2 = getOwnPropertyNames$1(NativeRegExp);\n var index = 0;\n while (keys$2.length > index) proxy(keys$2[index++]);\n RegExpPrototype$1.constructor = RegExpWrapper;\n RegExpWrapper.prototype = RegExpPrototype$1;\n redefine(global_1, 'RegExp', RegExpWrapper);\n}\n\n// https://tc39.github.io/ecma262/#sec-get-regexp-@@species\nsetSpecies('RegExp');\n\nfunction generateId(prefix) {\n return \"\".concat(prefix, \"-\").concat(Math.floor(Math.random() * 10000));\n} // Format string\n\nfunction 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\nfunction 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\nvar replaceAll = 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\nvar toTitleCase = 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\nfunction 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\nfunction 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\nfunction 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\nfunction getHTML(element) {\n var wrapper = document.createElement('div');\n wrapper.appendChild(element);\n return wrapper.innerHTML;\n}\n\nvar resources = {\n pip: 'PIP',\n airplay: 'AirPlay',\n html5: 'HTML5',\n vimeo: 'Vimeo',\n youtube: 'YouTube'\n};\nvar 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\nvar Storage = /*#__PURE__*/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// ==========================================================================\nfunction 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\nfunction 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\nvar ceil$1 = Math.ceil;\nvar floor$5 = Math.floor;\n\n// `Math.trunc` method\n// https://tc39.github.io/ecma262/#sec-math.trunc\n_export({ target: 'Math', stat: true }, {\n trunc: function trunc(it) {\n return (it > 0 ? floor$5 : ceil$1)(it);\n }\n});\n\nvar getHours = function getHours(value) {\n return Math.trunc(value / 60 / 60 % 60, 10);\n};\nvar getMinutes = function getMinutes(value) {\n return Math.trunc(value / 60 % 60, 10);\n};\nvar getSeconds = function getSeconds(value) {\n return Math.trunc(value % 60, 10);\n}; // Format time to UI friendly string\n\nfunction 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(undefined, 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\nvar 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 'aria-hidden': 'true',\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\n var attributes = _objectSpread2(_objectSpread2({}, attr), {}, {\n class: [attr.class, this.config.classNames.hidden].filter(Boolean).join(' ')\n });\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.call(this, 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.call(this, 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\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 }\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=\"menucaptions\"]');\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() {\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\"]'); // Filter out invalid speeds\n\n this.options.speed = this.options.speed.filter(function (o) {\n return o >= _this8.minimumSpeed && o <= _this8.maximumSpeed;\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 (is$1.array(this.config.controls) && 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(is$1.array(this.config.controls) ? 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 // Ignored on iOS as it's handled globally\n // https://developer.apple.com/library/safari/documentation/AudioVideo/Conceptual/Using_HTML5_Audio_Video/Device-SpecificConsiderations/Device-SpecificConsiderations.html\n\n\n if (control === 'volume' && !browser.isIos) {\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.call(_this10, 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.call(_this10, 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.call(_this10, 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 })); // Menu Captions\n\n pane.appendChild(createElement('div', {\n role: 'menucaptions'\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 }); // Set download attribute for HTML5 only\n\n\n if (_this10.isHTML5) {\n _attributes.download = '';\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 }\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\nfunction 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\nfunction 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\nvar 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 // Note: mode='hidden' forces a track to download. To ensure every track\n // isn't downloaded at once, only 'showing' tracks should be reassigned\n // eslint-disable-next-line no-param-reassign\n\n if (track.mode === 'showing') {\n // eslint-disable-next-line no-param-reassign\n track.mode = 'hidden';\n } // Add event listener for cue changes\n\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 (is$1.array(this.config.controls) && 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 _this2 = this;\n\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 } // Wait for the call stack to clear before setting mode='hidden'\n // on the active track - forcing the browser to download it\n\n\n setTimeout(function () {\n if (active && _this2.captions.toggled) {\n _this2.captions.currentTrackNode.mode = 'hidden';\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: 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 _this3 = 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 !_this3.isHTML5 || update || _this3.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 _this4 = 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((_this4.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// ==========================================================================\nvar 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: '/theme/modules/plyr/plyr.svg',\n // Blank video (used to prevent errors on source change)\n blankVideo: '/theme/modules/plyr/blank.webm',\n // Quality default\n quality: {\n default: 576,\n // The options to display in the UI, if available for the source media\n options: [4320, 2880, 2160, 1440, 1080, 720, 576, 480, 360, 240],\n forced: false,\n onChange: null\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 // The options to display in the UI, if available for the source media (e.g. Vimeo and YouTube only support 0.5x-4x)\n options: [0.5, 0.75, 1, 1.25, 1.5, 1.75, 2, 4]\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 // Selector for the fullscreen container so contextual / non-player content can remain visible in fullscreen mode\n // Non-ancestors of the player element will be ignored\n // container: null, // defaults to the player element\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 pip: 'PIP',\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 // Whether the owner of the video has a Pro or Business account\n // (which allows us to properly hide controls without CSS hacks, etc)\n premium: false,\n // Custom settings from Plyr\n referrerPolicy: null // https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement/referrerPolicy\n\n },\n // YouTube plugin\n youtube: {\n noCookie: true,\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// ==========================================================================\nvar pip = {\n active: 'picture-in-picture',\n inactive: 'inline'\n};\n\n// ==========================================================================\n// Plyr supported types and providers\n// ==========================================================================\nvar providers = {\n html5: 'html5',\n youtube: 'youtube',\n vimeo: 'vimeo'\n};\nvar types = {\n audio: 'audio',\n video: 'video'\n};\n/**\n * Get provider by URL\n * @param {String} url\n */\n\nfunction 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// ==========================================================================\nvar noop = function noop() {};\n\nvar Console = /*#__PURE__*/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\nvar Fullscreen = /*#__PURE__*/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'; // Get the fullscreen element\n // Checks container is an ancestor, defaults to null\n\n this.player.elements.fullscreen = player.config.fullscreen.container && closest(this.player.elements.container, player.config.fullscreen.container); // 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 _this.onChange();\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 }); // Tap focus when in fullscreen\n\n on.call(this, this.player.elements.container, 'keydown', function (event) {\n return _this.trapFocus(event);\n }); // Update the UI\n\n this.update();\n } // Determine if native supported\n\n\n _createClass(Fullscreen, [{\n key: \"onChange\",\n value: 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);\n }\n }, {\n key: \"toggleFallback\",\n value: 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 this.onChange();\n } // Trap focus inside container\n\n }, {\n key: \"trapFocus\",\n value: function trapFocus(event) {\n // Bail if iOS, not active, not the tab key\n if (browser.isIos || !this.active || event.key !== 'Tab' || event.keyCode !== 9) {\n return;\n } // Get the current focused element\n\n\n var focused = document.activeElement;\n var focusable = getElements.call(this.player, 'a[href], button:not(:disabled), input:not(:disabled), [tabindex]');\n\n var _focusable = _slicedToArray(focusable, 1),\n first = _focusable[0];\n\n var last = focusable[focusable.length - 1];\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 } // Update UI\n\n }, {\n key: \"update\",\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 this.toggleFallback(true);\n } else if (!this.prefix) {\n this.target.requestFullscreen({\n navigationUI: 'hide'\n });\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 silencePromise(this.player.play());\n } else if (!Fullscreen.native || this.forceFallback) {\n this.toggleFallback(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 && element.shadowRoot ? element === this.target.getRootNode().host : 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.fullscreen || 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// `Math.sign` method implementation\n// https://tc39.github.io/ecma262/#sec-math.sign\nvar mathSign = Math.sign || function sign(x) {\n // eslint-disable-next-line no-self-compare\n return (x = +x) == 0 || x != x ? x : x < 0 ? -1 : 1;\n};\n\n// `Math.sign` method\n// https://tc39.github.io/ecma262/#sec-math.sign\n_export({ target: 'Math', stat: true }, {\n sign: mathSign\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// ==========================================================================\nfunction 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\nvar 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('data-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 target.setAttribute('aria-label', i18n.get(_this3.playing ? 'pause' : 'play', _this3.config));\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 // Migrate any custom properties from the media to the parent\n migrateStyles: function migrateStyles() {\n var _this5 = this;\n\n // Loop through values (as they are the keys when the object is spread 🤔)\n Object.values(_objectSpread2({}, this.media.style)) // We're only fussed about Plyr specific properties\n .filter(function (key) {\n return !is$1.empty(key) && key.startsWith('--plyr');\n }).forEach(function (key) {\n // Set on the container\n _this5.elements.container.style.setProperty(key, _this5.media.style.getPropertyValue(key)); // Clean up from media element\n\n\n _this5.media.style.removeProperty(key);\n }); // Remove attribute if empty\n\n if (is$1.empty(this.media.style)) {\n this.media.removeAttribute('style');\n }\n }\n};\n\nvar Listeners = /*#__PURE__*/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 silencePromise(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 } // 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 if (event.type !== 'focusout') {\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 }\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 focusout', 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 || player.config.vimeo.premium) {\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 browser fullscreen API, 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 }); // 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(); // Call pause otherwise IE11 will start playing the video again\n\n player.pause();\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, function () {\n silencePromise(player.play());\n }, 'play');\n } else {\n _this.proxy(event, function () {\n silencePromise(player.togglePlay());\n }, '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 !== false && 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', function () {\n silencePromise(player.togglePlay());\n }, '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 event.preventDefault();\n\n controls.toggleMenu.call(player, event);\n }, null, false); // Can't be passive as we're preventing default\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 silencePromise(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 touchend 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 }); // Also update controls.hover state for any non-player children of fullscreen element (as above)\n\n if (elements.fullscreen) {\n Array.from(elements.fullscreen.children).filter(function (c) {\n return !c.contains(elements.container);\n }).forEach(function (child) {\n _this3.bind(child, 'mouseenter mouseleave', function (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\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\nvar HAS_SPECIES_SUPPORT$3 = arrayMethodHasSpeciesSupport('splice');\nvar USES_TO_LENGTH$a = arrayMethodUsesToLength('splice', { ACCESSORS: true, 0: 0, 1: 2 });\n\nvar max$3 = Math.max;\nvar min$5 = Math.min;\nvar MAX_SAFE_INTEGER$1 = 0x1FFFFFFFFFFFFF;\nvar MAXIMUM_ALLOWED_LENGTH_EXCEEDED = 'Maximum allowed length exceeded';\n\n// `Array.prototype.splice` method\n// https://tc39.github.io/ecma262/#sec-array.prototype.splice\n// with adding support of @@species\n_export({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT$3 || !USES_TO_LENGTH$a }, {\n splice: function splice(start, deleteCount /* , ...items */) {\n var O = toObject(this);\n var len = toLength(O.length);\n var actualStart = toAbsoluteIndex(start, len);\n var argumentsLength = arguments.length;\n var insertCount, actualDeleteCount, A, k, from, to;\n if (argumentsLength === 0) {\n insertCount = actualDeleteCount = 0;\n } else if (argumentsLength === 1) {\n insertCount = 0;\n actualDeleteCount = len - actualStart;\n } else {\n insertCount = argumentsLength - 2;\n actualDeleteCount = min$5(max$3(toInteger(deleteCount), 0), len - actualStart);\n }\n if (len + insertCount - actualDeleteCount > MAX_SAFE_INTEGER$1) {\n throw TypeError(MAXIMUM_ALLOWED_LENGTH_EXCEEDED);\n }\n A = arraySpeciesCreate(O, actualDeleteCount);\n for (k = 0; k < actualDeleteCount; k++) {\n from = actualStart + k;\n if (from in O) createProperty(A, k, O[from]);\n }\n A.length = actualDeleteCount;\n if (insertCount < actualDeleteCount) {\n for (k = actualStart; k < len - actualDeleteCount; k++) {\n from = k + actualDeleteCount;\n to = k + insertCount;\n if (from in O) O[to] = O[from];\n else delete O[to];\n }\n for (k = len; k > len - actualDeleteCount + insertCount; k--) delete O[k - 1];\n } else if (insertCount > actualDeleteCount) {\n for (k = len - actualDeleteCount; k > actualStart; k--) {\n from = k + actualDeleteCount - 1;\n to = k + insertCount - 1;\n if (from in O) O[to] = O[from];\n else delete O[to];\n }\n }\n for (k = 0; k < insertCount; k++) {\n O[k + actualStart] = arguments[k + 2];\n }\n O.length = len - actualDeleteCount + insertCount;\n return A;\n }\n});\n\nvar 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 pathname = path.replace(/[\\?|#].*$/, ''),\n pathStripped = path.replace(/^(css|img)!/, ''),\n isLegacyIECss,\n e;\n numTries = numTries || 0;\n\n if (/(^css!|\\.css$)/.test(pathname)) {\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|webp)$)/.test(pathname)) {\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\nfunction loadScript(url) {\n return new Promise(function (resolve, reject) {\n loadjs_umd(url, {\n success: resolve,\n error: reject\n });\n });\n}\n\nfunction 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\nfunction 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\nvar vimeo = {\n setup: function setup() {\n var player = this; // Add embed class for responsive\n\n toggleClass(player.elements.wrapper, player.config.classNames.embed, true); // Set speed options from config\n\n player.options.speed = player.config.speed.options; // Set intial ratio\n\n setAspectRatio.call(player); // Load the SDK if not already\n\n if (!is$1.object(window.Vimeo)) {\n loadScript(player.config.urls.vimeo.sdk).then(function () {\n vimeo.ready.call(player);\n }).catch(function (error) {\n player.debug.warn('Vimeo SDK (player.js) failed to load', error);\n });\n } else {\n vimeo.ready.call(player);\n }\n },\n // API Ready\n ready: function ready() {\n var _this = this;\n\n var player = this;\n var config = player.config.vimeo;\n\n var premium = config.premium,\n referrerPolicy = config.referrerPolicy,\n frameParams = _objectWithoutProperties(config, [\"premium\", \"referrerPolicy\"]); // If the owner has a pro or premium account then we can hide controls etc\n\n\n if (premium) {\n Object.assign(frameParams, {\n controls: false,\n sidedock: false\n });\n } // Get Vimeo params for the iframe\n\n\n var params = buildUrlParams(_objectSpread2({\n loop: player.config.loop.active,\n autoplay: player.autoplay,\n muted: player.muted,\n gesture: 'media',\n playsinline: !this.config.fullscreen.iosNative\n }, frameParams)); // 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('allow', 'autoplay,fullscreen,picture-in-picture'); // Set the referrer policy if required\n\n if (!is$1.empty(referrerPolicy)) {\n iframe.setAttribute('referrerPolicy', referrerPolicy);\n } // Inject the package\n\n\n var poster = player.poster;\n\n if (premium) {\n iframe.setAttribute('data-poster', poster);\n player.media = replaceElement(iframe, player.media);\n } else {\n var wrapper = createElement('div', {\n class: player.config.classNames.embedContainer,\n 'data-poster': poster\n });\n wrapper.appendChild(iframe);\n player.media = replaceElement(wrapper, player.media);\n } // Get poster image\n\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 () {\n // Cannot set Playback Rate, Video is probably not on Pro account\n player.options.speed = [1];\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 _this.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(_this);\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(_this);\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('bufferstart', function () {\n triggerEvent.call(player, player.media, 'waiting');\n });\n player.embed.on('bufferend', function () {\n triggerEvent.call(player, player.media, 'playing');\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\nfunction 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\nfunction 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\nfunction getHost$1(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\nvar 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 'data-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$1(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 var speeds = instance.getAvailablePlaybackRates(); // Filter based on config\n\n player.options.speed = speeds.filter(function (s) {\n return player.config.speed.options.includes(s);\n }); // 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 case 3:\n // Trigger waiting event to add loading classes to container as the video buffers.\n triggerEvent.call(player, player.media, 'waiting');\n break;\n }\n\n triggerEvent.call(player, player.elements.container, 'statechange', false, {\n code: event.data\n });\n }\n }\n });\n }\n};\n\nvar 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$1(this.media, this.elements.wrapper); // Poster image 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.setup.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\nvar 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\nvar Ads = /*#__PURE__*/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 var _this4 = this;\n\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); // Create ads loader\n\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 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 container = this.player.elements.container;\n\n try {\n // Request video ads\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 if (this.player.ended) {\n this.loadAds();\n } else {\n // The SDK won't allow new ads to be called without receiving a contentComplete()\n this.loader.contentComplete();\n }\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 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 }\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 silencePromise(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 that the manager has been destroyed set it to also be un-initialized\n\n _this11.initialized = false; // 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: config.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\nvar $findIndex = arrayIteration.findIndex;\n\n\n\nvar FIND_INDEX = 'findIndex';\nvar SKIPS_HOLES$1 = true;\n\nvar USES_TO_LENGTH$b = arrayMethodUsesToLength(FIND_INDEX);\n\n// Shouldn't skip holes\nif (FIND_INDEX in []) Array(1)[FIND_INDEX](function () { SKIPS_HOLES$1 = false; });\n\n// `Array.prototype.findIndex` method\n// https://tc39.github.io/ecma262/#sec-array.prototype.findindex\n_export({ target: 'Array', proto: true, forced: SKIPS_HOLES$1 || !USES_TO_LENGTH$b }, {\n findIndex: function findIndex(callbackfn /* , that = undefined */) {\n return $findIndex(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);\n }\n});\n\n// https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables\naddToUnscopables(FIND_INDEX);\n\nvar min$6 = Math.min;\nvar nativeLastIndexOf = [].lastIndexOf;\nvar NEGATIVE_ZERO$1 = !!nativeLastIndexOf && 1 / [1].lastIndexOf(1, -0) < 0;\nvar STRICT_METHOD$6 = arrayMethodIsStrict('lastIndexOf');\n// For preventing possible almost infinite loop in non-standard implementations, test the forward version of the method\nvar USES_TO_LENGTH$c = arrayMethodUsesToLength('indexOf', { ACCESSORS: true, 1: 0 });\nvar FORCED$5 = NEGATIVE_ZERO$1 || !STRICT_METHOD$6 || !USES_TO_LENGTH$c;\n\n// `Array.prototype.lastIndexOf` method implementation\n// https://tc39.github.io/ecma262/#sec-array.prototype.lastindexof\nvar arrayLastIndexOf = FORCED$5 ? function lastIndexOf(searchElement /* , fromIndex = @[*-1] */) {\n // convert -0 to +0\n if (NEGATIVE_ZERO$1) return nativeLastIndexOf.apply(this, arguments) || 0;\n var O = toIndexedObject(this);\n var length = toLength(O.length);\n var index = length - 1;\n if (arguments.length > 1) index = min$6(index, toInteger(arguments[1]));\n if (index < 0) index = length + index;\n for (;index >= 0; index--) if (index in O && O[index] === searchElement) return index || 0;\n return -1;\n} : nativeLastIndexOf;\n\n// `Array.prototype.lastIndexOf` method\n// https://tc39.github.io/ecma262/#sec-array.prototype.lastindexof\n_export({ target: 'Array', proto: true, forced: arrayLastIndexOf !== [].lastIndexOf }, {\n lastIndexOf: arrayLastIndexOf\n});\n\nvar 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\nvar fitRatio = function fitRatio(ratio, outer) {\n var targetRatio = outer.width / outer.height;\n var result = {};\n\n if (ratio > targetRatio) {\n result.width = outer.width;\n result.height = 1 / ratio * outer.width;\n } else {\n result.height = outer.height;\n result.width = ratio * outer.height;\n }\n\n return result;\n};\n\nvar PreviewThumbnails = /*#__PURE__*/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 // Toggle the 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 } // Resolve promise\n\n\n var sortAndResolve = function sortAndResolve() {\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 }; // Via callback()\n\n\n if (is$1.function(src)) {\n src(function (thumbnails) {\n _this2.thumbnails = thumbnails;\n sortAndResolve();\n });\n } // VTT urls\n else {\n // If string, convert into single-element list\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 }); // Resolve\n\n Promise.all(promises).then(sortAndResolve);\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 does not exist or is false)\n if (is$1.nullOrUndefined(event.button) || 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: \"destroy\",\n value: function destroy() {\n if (this.elements.thumb.container) {\n this.elements.thumb.container.remove();\n }\n\n if (this.elements.scrubbing.container) {\n this.elements.scrubbing.container.remove();\n }\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 || this.elements.thumb.imageContainer.clientWidth > 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 } else if (this.elements.thumb.imageContainer.clientHeight > 20 && this.elements.thumb.imageContainer.clientWidth < 20) {\n var _thumbWidth = Math.floor(this.elements.thumb.imageContainer.clientHeight * this.thumbAspectRatio);\n\n this.elements.thumb.imageContainer.style.width = \"\".concat(_thumbWidth, \"px\");\n } else if (this.elements.thumb.imageContainer.clientHeight < 20 && this.elements.thumb.imageContainer.clientWidth > 20) {\n var thumbHeight = Math.floor(this.elements.thumb.imageContainer.clientWidth / this.thumbAspectRatio);\n this.elements.thumb.imageContainer.style.height = \"\".concat(thumbHeight, \"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 var _fitRatio = fitRatio(this.thumbAspectRatio, {\n width: this.player.media.clientWidth,\n height: this.player.media.clientHeight\n }),\n width = _fitRatio.width,\n height = _fitRatio.height;\n\n this.elements.scrubbing.container.style.width = \"\".concat(width, \"px\");\n this.elements.scrubbing.container.style.height = \"\".concat(height, \"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(previewImage.naturalHeight * multiplier, \"px\"); // eslint-disable-next-line no-param-reassign\n\n previewImage.style.width = \"\".concat(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 var _fitRatio2 = fitRatio(this.thumbAspectRatio, {\n width: this.player.media.clientWidth,\n height: this.player.media.clientHeight\n }),\n height = _fitRatio2.height;\n\n return height;\n } // If css is used this needs to return the css height for sprites to work (see setImageSizeAndOffset)\n\n\n if (this.sizeSpecifiedInCSS) {\n return this.elements.thumb.imageContainer.clientHeight;\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\nvar 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 } // Update previewThumbnails config & reload plugin\n\n\n if (!is$1.empty(input.previewThumbnails)) {\n Object.assign(_this2.config.previewThumbnails, input.previewThumbnails); // Cleanup previewThumbnails plugin if it was loaded\n\n if (_this2.previewThumbnails && _this2.previewThumbnails.loaded) {\n _this2.previewThumbnails.destroy();\n\n _this2.previewThumbnails = null;\n } // Create new instance if it is still enabled\n\n\n if (_this2.config.previewThumbnails.enabled) {\n _this2.previewThumbnails = new PreviewThumbnails(_this2);\n }\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 */\nfunction 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\nvar Plyr = /*#__PURE__*/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 fullscreen: 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$1(this.media, this.elements.container);\n } // Migrate custom properties from media to container (so they work 😉)\n\n\n ui.migrateStyles.call(this); // Add style hook\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 fullscreen\n\n\n this.fullscreen = new Fullscreen(this); // Setup interface\n // If embed but not fully supported, build interface now to avoid flash of controls\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 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 silencePromise(_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 silencePromise(_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 null;\n }\n\n return 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 return this.play();\n }\n\n return this.pause();\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 -= 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 += 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 && is$1.array(this.config.controls) && 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$1(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') || this.media.getAttribute('data-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\nPlyr.defaults = cloneDeep(defaults$1);\n\n// ==========================================================================\n\nexport default Plyr;\n","// Polyfill for creating CustomEvents on IE9/10/11\n\n// code pulled from:\n// https://github.com/d4tocchini/customevent-polyfill\n// https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent#Polyfill\n\n(function() {\n if (typeof window === 'undefined') {\n return;\n }\n\n try {\n var ce = new window.CustomEvent('test', { cancelable: true });\n ce.preventDefault();\n if (ce.defaultPrevented !== true) {\n // IE has problems with .preventDefault() on custom events\n // http://stackoverflow.com/questions/23349191\n throw new Error('Could not prevent default');\n }\n } catch (e) {\n var CustomEvent = function(event, params) {\n var evt, origPrevent;\n params = params || {};\n params.bubbles = !!params.bubbles;\n params.cancelable = !!params.cancelable;\n\n evt = document.createEvent('CustomEvent');\n evt.initCustomEvent(\n event,\n params.bubbles,\n params.cancelable,\n params.detail\n );\n origPrevent = evt.preventDefault;\n evt.preventDefault = function() {\n origPrevent.call(this);\n try {\n Object.defineProperty(this, 'defaultPrevented', {\n get: function() {\n return true;\n }\n });\n } catch (e) {\n this.defaultPrevented = true;\n }\n };\n return evt;\n };\n\n CustomEvent.prototype = window.Event.prototype;\n window.CustomEvent = CustomEvent; // expose definition to window\n }\n})();\n","var check = function (it) {\n return it && it.Math == Math && it;\n};\n\n// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028\nmodule.exports =\n // eslint-disable-next-line no-undef\n check(typeof globalThis == 'object' && globalThis) ||\n check(typeof window == 'object' && window) ||\n check(typeof self == 'object' && self) ||\n check(typeof global == 'object' && global) ||\n // eslint-disable-next-line no-new-func\n Function('return this')();\n","module.exports = function (exec) {\n try {\n return !!exec();\n } catch (error) {\n return true;\n }\n};\n","var fails = require('../internals/fails');\n\n// Thank's IE8 for his funny defineProperty\nmodule.exports = !fails(function () {\n return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7;\n});\n","'use strict';\nvar nativePropertyIsEnumerable = {}.propertyIsEnumerable;\nvar getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;\n\n// Nashorn ~ JDK8 bug\nvar NASHORN_BUG = getOwnPropertyDescriptor && !nativePropertyIsEnumerable.call({ 1: 2 }, 1);\n\n// `Object.prototype.propertyIsEnumerable` method implementation\n// https://tc39.github.io/ecma262/#sec-object.prototype.propertyisenumerable\nexports.f = NASHORN_BUG ? function propertyIsEnumerable(V) {\n var descriptor = getOwnPropertyDescriptor(this, V);\n return !!descriptor && descriptor.enumerable;\n} : nativePropertyIsEnumerable;\n","module.exports = function (bitmap, value) {\n return {\n enumerable: !(bitmap & 1),\n configurable: !(bitmap & 2),\n writable: !(bitmap & 4),\n value: value\n };\n};\n","var toString = {}.toString;\n\nmodule.exports = function (it) {\n return toString.call(it).slice(8, -1);\n};\n","var fails = require('../internals/fails');\nvar classof = require('../internals/classof-raw');\n\nvar split = ''.split;\n\n// fallback for non-array-like ES3 and non-enumerable old V8 strings\nmodule.exports = fails(function () {\n // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346\n // eslint-disable-next-line no-prototype-builtins\n return !Object('z').propertyIsEnumerable(0);\n}) ? function (it) {\n return classof(it) == 'String' ? split.call(it, '') : Object(it);\n} : Object;\n","// `RequireObjectCoercible` abstract operation\n// https://tc39.github.io/ecma262/#sec-requireobjectcoercible\nmodule.exports = function (it) {\n if (it == undefined) throw TypeError(\"Can't call method on \" + it);\n return it;\n};\n","// toObject with fallback for non-array-like ES3 strings\nvar IndexedObject = require('../internals/indexed-object');\nvar requireObjectCoercible = require('../internals/require-object-coercible');\n\nmodule.exports = function (it) {\n return IndexedObject(requireObjectCoercible(it));\n};\n","module.exports = function (it) {\n return typeof it === 'object' ? it !== null : typeof it === 'function';\n};\n","var isObject = require('../internals/is-object');\n\n// `ToPrimitive` abstract operation\n// https://tc39.github.io/ecma262/#sec-toprimitive\n// instead of the ES6 spec version, we didn't implement @@toPrimitive case\n// and the second argument - flag - preferred type is a string\nmodule.exports = function (input, PREFERRED_STRING) {\n if (!isObject(input)) return input;\n var fn, val;\n if (PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;\n if (typeof (fn = input.valueOf) == 'function' && !isObject(val = fn.call(input))) return val;\n if (!PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;\n throw TypeError(\"Can't convert object to primitive value\");\n};\n","var hasOwnProperty = {}.hasOwnProperty;\n\nmodule.exports = function (it, key) {\n return hasOwnProperty.call(it, key);\n};\n","var global = require('../internals/global');\nvar isObject = require('../internals/is-object');\n\nvar document = global.document;\n// typeof document.createElement is 'object' in old IE\nvar EXISTS = isObject(document) && isObject(document.createElement);\n\nmodule.exports = function (it) {\n return EXISTS ? document.createElement(it) : {};\n};\n","var DESCRIPTORS = require('../internals/descriptors');\nvar fails = require('../internals/fails');\nvar createElement = require('../internals/document-create-element');\n\n// Thank's IE8 for his funny defineProperty\nmodule.exports = !DESCRIPTORS && !fails(function () {\n return Object.defineProperty(createElement('div'), 'a', {\n get: function () { return 7; }\n }).a != 7;\n});\n","var DESCRIPTORS = require('../internals/descriptors');\nvar propertyIsEnumerableModule = require('../internals/object-property-is-enumerable');\nvar createPropertyDescriptor = require('../internals/create-property-descriptor');\nvar toIndexedObject = require('../internals/to-indexed-object');\nvar toPrimitive = require('../internals/to-primitive');\nvar has = require('../internals/has');\nvar IE8_DOM_DEFINE = require('../internals/ie8-dom-define');\n\nvar nativeGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;\n\n// `Object.getOwnPropertyDescriptor` method\n// https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptor\nexports.f = DESCRIPTORS ? nativeGetOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {\n O = toIndexedObject(O);\n P = toPrimitive(P, true);\n if (IE8_DOM_DEFINE) try {\n return nativeGetOwnPropertyDescriptor(O, P);\n } catch (error) { /* empty */ }\n if (has(O, P)) return createPropertyDescriptor(!propertyIsEnumerableModule.f.call(O, P), O[P]);\n};\n","var isObject = require('../internals/is-object');\n\nmodule.exports = function (it) {\n if (!isObject(it)) {\n throw TypeError(String(it) + ' is not an object');\n } return it;\n};\n","var DESCRIPTORS = require('../internals/descriptors');\nvar IE8_DOM_DEFINE = require('../internals/ie8-dom-define');\nvar anObject = require('../internals/an-object');\nvar toPrimitive = require('../internals/to-primitive');\n\nvar nativeDefineProperty = Object.defineProperty;\n\n// `Object.defineProperty` method\n// https://tc39.github.io/ecma262/#sec-object.defineproperty\nexports.f = DESCRIPTORS ? nativeDefineProperty : function defineProperty(O, P, Attributes) {\n anObject(O);\n P = toPrimitive(P, true);\n anObject(Attributes);\n if (IE8_DOM_DEFINE) try {\n return nativeDefineProperty(O, P, Attributes);\n } catch (error) { /* empty */ }\n if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported');\n if ('value' in Attributes) O[P] = Attributes.value;\n return O;\n};\n","var DESCRIPTORS = require('../internals/descriptors');\nvar definePropertyModule = require('../internals/object-define-property');\nvar createPropertyDescriptor = require('../internals/create-property-descriptor');\n\nmodule.exports = DESCRIPTORS ? function (object, key, value) {\n return definePropertyModule.f(object, key, createPropertyDescriptor(1, value));\n} : function (object, key, value) {\n object[key] = value;\n return object;\n};\n","var global = require('../internals/global');\nvar createNonEnumerableProperty = require('../internals/create-non-enumerable-property');\n\nmodule.exports = function (key, value) {\n try {\n createNonEnumerableProperty(global, key, value);\n } catch (error) {\n global[key] = value;\n } return value;\n};\n","var global = require('../internals/global');\nvar setGlobal = require('../internals/set-global');\n\nvar SHARED = '__core-js_shared__';\nvar store = global[SHARED] || setGlobal(SHARED, {});\n\nmodule.exports = store;\n","var store = require('../internals/shared-store');\n\nvar functionToString = Function.toString;\n\n// this helper broken in `3.4.1-3.4.4`, so we can't use `shared` helper\nif (typeof store.inspectSource != 'function') {\n store.inspectSource = function (it) {\n return functionToString.call(it);\n };\n}\n\nmodule.exports = store.inspectSource;\n","var NATIVE_WEAK_MAP = require('../internals/native-weak-map');\nvar global = require('../internals/global');\nvar isObject = require('../internals/is-object');\nvar createNonEnumerableProperty = require('../internals/create-non-enumerable-property');\nvar objectHas = require('../internals/has');\nvar sharedKey = require('../internals/shared-key');\nvar hiddenKeys = require('../internals/hidden-keys');\n\nvar WeakMap = global.WeakMap;\nvar set, get, has;\n\nvar enforce = function (it) {\n return has(it) ? get(it) : set(it, {});\n};\n\nvar getterFor = function (TYPE) {\n return function (it) {\n var state;\n if (!isObject(it) || (state = get(it)).type !== TYPE) {\n throw TypeError('Incompatible receiver, ' + TYPE + ' required');\n } return state;\n };\n};\n\nif (NATIVE_WEAK_MAP) {\n var store = new WeakMap();\n var wmget = store.get;\n var wmhas = store.has;\n var wmset = store.set;\n set = function (it, metadata) {\n wmset.call(store, it, metadata);\n return metadata;\n };\n get = function (it) {\n return wmget.call(store, it) || {};\n };\n has = function (it) {\n return wmhas.call(store, it);\n };\n} else {\n var STATE = sharedKey('state');\n hiddenKeys[STATE] = true;\n set = function (it, metadata) {\n createNonEnumerableProperty(it, STATE, metadata);\n return metadata;\n };\n get = function (it) {\n return objectHas(it, STATE) ? it[STATE] : {};\n };\n has = function (it) {\n return objectHas(it, STATE);\n };\n}\n\nmodule.exports = {\n set: set,\n get: get,\n has: has,\n enforce: enforce,\n getterFor: getterFor\n};\n","var global = require('../internals/global');\nvar inspectSource = require('../internals/inspect-source');\n\nvar WeakMap = global.WeakMap;\n\nmodule.exports = typeof WeakMap === 'function' && /native code/.test(inspectSource(WeakMap));\n","module.exports = false;\n","var IS_PURE = require('../internals/is-pure');\nvar store = require('../internals/shared-store');\n\n(module.exports = function (key, value) {\n return store[key] || (store[key] = value !== undefined ? value : {});\n})('versions', []).push({\n version: '3.6.5',\n mode: IS_PURE ? 'pure' : 'global',\n copyright: '© 2020 Denis Pushkarev (zloirock.ru)'\n});\n","var id = 0;\nvar postfix = Math.random();\n\nmodule.exports = function (key) {\n return 'Symbol(' + String(key === undefined ? '' : key) + ')_' + (++id + postfix).toString(36);\n};\n","var shared = require('../internals/shared');\nvar uid = require('../internals/uid');\n\nvar keys = shared('keys');\n\nmodule.exports = function (key) {\n return keys[key] || (keys[key] = uid(key));\n};\n","module.exports = {};\n","var anObject = require('../internals/an-object');\nvar defineProperties = require('../internals/object-define-properties');\nvar enumBugKeys = require('../internals/enum-bug-keys');\nvar hiddenKeys = require('../internals/hidden-keys');\nvar html = require('../internals/html');\nvar documentCreateElement = require('../internals/document-create-element');\nvar sharedKey = require('../internals/shared-key');\n\nvar GT = '>';\nvar LT = '<';\nvar PROTOTYPE = 'prototype';\nvar SCRIPT = 'script';\nvar IE_PROTO = sharedKey('IE_PROTO');\n\nvar EmptyConstructor = function () { /* empty */ };\n\nvar scriptTag = function (content) {\n return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;\n};\n\n// Create object with fake `null` prototype: use ActiveX Object with cleared prototype\nvar NullProtoObjectViaActiveX = function (activeXDocument) {\n activeXDocument.write(scriptTag(''));\n activeXDocument.close();\n var temp = activeXDocument.parentWindow.Object;\n activeXDocument = null; // avoid memory leak\n return temp;\n};\n\n// Create object with fake `null` prototype: use iframe Object with cleared prototype\nvar NullProtoObjectViaIFrame = function () {\n // Thrash, waste and sodomy: IE GC bug\n var iframe = documentCreateElement('iframe');\n var JS = 'java' + SCRIPT + ':';\n var iframeDocument;\n iframe.style.display = 'none';\n html.appendChild(iframe);\n // https://github.com/zloirock/core-js/issues/475\n iframe.src = String(JS);\n iframeDocument = iframe.contentWindow.document;\n iframeDocument.open();\n iframeDocument.write(scriptTag('document.F=Object'));\n iframeDocument.close();\n return iframeDocument.F;\n};\n\n// Check for document.domain and active x support\n// No need to use active x approach when document.domain is not set\n// see https://github.com/es-shims/es5-shim/issues/150\n// variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346\n// avoid IE GC bug\nvar activeXDocument;\nvar NullProtoObject = function () {\n try {\n /* global ActiveXObject */\n activeXDocument = document.domain && new ActiveXObject('htmlfile');\n } catch (error) { /* ignore */ }\n NullProtoObject = activeXDocument ? NullProtoObjectViaActiveX(activeXDocument) : NullProtoObjectViaIFrame();\n var length = enumBugKeys.length;\n while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];\n return NullProtoObject();\n};\n\nhiddenKeys[IE_PROTO] = true;\n\n// `Object.create` method\n// https://tc39.github.io/ecma262/#sec-object.create\nmodule.exports = Object.create || function create(O, Properties) {\n var result;\n if (O !== null) {\n EmptyConstructor[PROTOTYPE] = anObject(O);\n result = new EmptyConstructor();\n EmptyConstructor[PROTOTYPE] = null;\n // add \"__proto__\" for Object.getPrototypeOf polyfill\n result[IE_PROTO] = O;\n } else result = NullProtoObject();\n return Properties === undefined ? result : defineProperties(result, Properties);\n};\n","var global = require('../internals/global');\nvar createNonEnumerableProperty = require('../internals/create-non-enumerable-property');\nvar has = require('../internals/has');\nvar setGlobal = require('../internals/set-global');\nvar inspectSource = require('../internals/inspect-source');\nvar InternalStateModule = require('../internals/internal-state');\n\nvar getInternalState = InternalStateModule.get;\nvar enforceInternalState = InternalStateModule.enforce;\nvar TEMPLATE = String(String).split('String');\n\n(module.exports = function (O, key, value, options) {\n var unsafe = options ? !!options.unsafe : false;\n var simple = options ? !!options.enumerable : false;\n var noTargetGet = options ? !!options.noTargetGet : false;\n if (typeof value == 'function') {\n if (typeof key == 'string' && !has(value, 'name')) createNonEnumerableProperty(value, 'name', key);\n enforceInternalState(value).source = TEMPLATE.join(typeof key == 'string' ? key : '');\n }\n if (O === global) {\n if (simple) O[key] = value;\n else setGlobal(key, value);\n return;\n } else if (!unsafe) {\n delete O[key];\n } else if (!noTargetGet && O[key]) {\n simple = true;\n }\n if (simple) O[key] = value;\n else createNonEnumerableProperty(O, key, value);\n// add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative\n})(Function.prototype, 'toString', function toString() {\n return typeof this == 'function' && getInternalState(this).source || inspectSource(this);\n});\n","var global = require('../internals/global');\n\nmodule.exports = global;\n","var path = require('../internals/path');\nvar global = require('../internals/global');\n\nvar aFunction = function (variable) {\n return typeof variable == 'function' ? variable : undefined;\n};\n\nmodule.exports = function (namespace, method) {\n return arguments.length < 2 ? aFunction(path[namespace]) || aFunction(global[namespace])\n : path[namespace] && path[namespace][method] || global[namespace] && global[namespace][method];\n};\n","var ceil = Math.ceil;\nvar floor = Math.floor;\n\n// `ToInteger` abstract operation\n// https://tc39.github.io/ecma262/#sec-tointeger\nmodule.exports = function (argument) {\n return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor : ceil)(argument);\n};\n","var toInteger = require('../internals/to-integer');\n\nvar min = Math.min;\n\n// `ToLength` abstract operation\n// https://tc39.github.io/ecma262/#sec-tolength\nmodule.exports = function (argument) {\n return argument > 0 ? min(toInteger(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991\n};\n","var toInteger = require('../internals/to-integer');\n\nvar max = Math.max;\nvar min = Math.min;\n\n// Helper for a popular repeating case of the spec:\n// Let integer be ? ToInteger(index).\n// If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).\nmodule.exports = function (index, length) {\n var integer = toInteger(index);\n return integer < 0 ? max(integer + length, 0) : min(integer, length);\n};\n","var toIndexedObject = require('../internals/to-indexed-object');\nvar toLength = require('../internals/to-length');\nvar toAbsoluteIndex = require('../internals/to-absolute-index');\n\n// `Array.prototype.{ indexOf, includes }` methods implementation\nvar createMethod = function (IS_INCLUDES) {\n return function ($this, el, fromIndex) {\n var O = toIndexedObject($this);\n var length = toLength(O.length);\n var index = toAbsoluteIndex(fromIndex, length);\n var value;\n // Array#includes uses SameValueZero equality algorithm\n // eslint-disable-next-line no-self-compare\n if (IS_INCLUDES && el != el) while (length > index) {\n value = O[index++];\n // eslint-disable-next-line no-self-compare\n if (value != value) return true;\n // Array#indexOf ignores holes, Array#includes - not\n } else for (;length > index; index++) {\n if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;\n } return !IS_INCLUDES && -1;\n };\n};\n\nmodule.exports = {\n // `Array.prototype.includes` method\n // https://tc39.github.io/ecma262/#sec-array.prototype.includes\n includes: createMethod(true),\n // `Array.prototype.indexOf` method\n // https://tc39.github.io/ecma262/#sec-array.prototype.indexof\n indexOf: createMethod(false)\n};\n","var has = require('../internals/has');\nvar toIndexedObject = require('../internals/to-indexed-object');\nvar indexOf = require('../internals/array-includes').indexOf;\nvar hiddenKeys = require('../internals/hidden-keys');\n\nmodule.exports = function (object, names) {\n var O = toIndexedObject(object);\n var i = 0;\n var result = [];\n var key;\n for (key in O) !has(hiddenKeys, key) && has(O, key) && result.push(key);\n // Don't enum bug & hidden keys\n while (names.length > i) if (has(O, key = names[i++])) {\n ~indexOf(result, key) || result.push(key);\n }\n return result;\n};\n","// IE8- don't enum bug keys\nmodule.exports = [\n 'constructor',\n 'hasOwnProperty',\n 'isPrototypeOf',\n 'propertyIsEnumerable',\n 'toLocaleString',\n 'toString',\n 'valueOf'\n];\n","var internalObjectKeys = require('../internals/object-keys-internal');\nvar enumBugKeys = require('../internals/enum-bug-keys');\n\nvar hiddenKeys = enumBugKeys.concat('length', 'prototype');\n\n// `Object.getOwnPropertyNames` method\n// https://tc39.github.io/ecma262/#sec-object.getownpropertynames\nexports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {\n return internalObjectKeys(O, hiddenKeys);\n};\n","exports.f = Object.getOwnPropertySymbols;\n","var getBuiltIn = require('../internals/get-built-in');\nvar getOwnPropertyNamesModule = require('../internals/object-get-own-property-names');\nvar getOwnPropertySymbolsModule = require('../internals/object-get-own-property-symbols');\nvar anObject = require('../internals/an-object');\n\n// all object keys, includes non-enumerable and symbols\nmodule.exports = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {\n var keys = getOwnPropertyNamesModule.f(anObject(it));\n var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;\n return getOwnPropertySymbols ? keys.concat(getOwnPropertySymbols(it)) : keys;\n};\n","var has = require('../internals/has');\nvar ownKeys = require('../internals/own-keys');\nvar getOwnPropertyDescriptorModule = require('../internals/object-get-own-property-descriptor');\nvar definePropertyModule = require('../internals/object-define-property');\n\nmodule.exports = function (target, source) {\n var keys = ownKeys(source);\n var defineProperty = definePropertyModule.f;\n var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;\n for (var i = 0; i < keys.length; i++) {\n var key = keys[i];\n if (!has(target, key)) defineProperty(target, key, getOwnPropertyDescriptor(source, key));\n }\n};\n","var fails = require('../internals/fails');\n\nvar replacement = /#|\\.prototype\\./;\n\nvar isForced = function (feature, detection) {\n var value = data[normalize(feature)];\n return value == POLYFILL ? true\n : value == NATIVE ? false\n : typeof detection == 'function' ? fails(detection)\n : !!detection;\n};\n\nvar normalize = isForced.normalize = function (string) {\n return String(string).replace(replacement, '.').toLowerCase();\n};\n\nvar data = isForced.data = {};\nvar NATIVE = isForced.NATIVE = 'N';\nvar POLYFILL = isForced.POLYFILL = 'P';\n\nmodule.exports = isForced;\n","var global = require('../internals/global');\nvar getOwnPropertyDescriptor = require('../internals/object-get-own-property-descriptor').f;\nvar createNonEnumerableProperty = require('../internals/create-non-enumerable-property');\nvar redefine = require('../internals/redefine');\nvar setGlobal = require('../internals/set-global');\nvar copyConstructorProperties = require('../internals/copy-constructor-properties');\nvar isForced = require('../internals/is-forced');\n\n/*\n options.target - name of the target object\n options.global - target is the global object\n options.stat - export as static methods of target\n options.proto - export as prototype methods of target\n options.real - real prototype method for the `pure` version\n options.forced - export even if the native feature is available\n options.bind - bind methods to the target, required for the `pure` version\n options.wrap - wrap constructors to preventing global pollution, required for the `pure` version\n options.unsafe - use the simple assignment of property instead of delete + defineProperty\n options.sham - add a flag to not completely full polyfills\n options.enumerable - export as enumerable property\n options.noTargetGet - prevent calling a getter on target\n*/\nmodule.exports = function (options, source) {\n var TARGET = options.target;\n var GLOBAL = options.global;\n var STATIC = options.stat;\n var FORCED, target, key, targetProperty, sourceProperty, descriptor;\n if (GLOBAL) {\n target = global;\n } else if (STATIC) {\n target = global[TARGET] || setGlobal(TARGET, {});\n } else {\n target = (global[TARGET] || {}).prototype;\n }\n if (target) for (key in source) {\n sourceProperty = source[key];\n if (options.noTargetGet) {\n descriptor = getOwnPropertyDescriptor(target, key);\n targetProperty = descriptor && descriptor.value;\n } else targetProperty = target[key];\n FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);\n // contained in target\n if (!FORCED && targetProperty !== undefined) {\n if (typeof sourceProperty === typeof targetProperty) continue;\n copyConstructorProperties(sourceProperty, targetProperty);\n }\n // add a flag to not completely full polyfills\n if (options.sham || (targetProperty && targetProperty.sham)) {\n createNonEnumerableProperty(sourceProperty, 'sham', true);\n }\n // extend global\n redefine(target, key, sourceProperty, options);\n }\n};\n","var fails = require('../internals/fails');\n\nmodule.exports = !!Object.getOwnPropertySymbols && !fails(function () {\n // Chrome 38 Symbol has incorrect toString conversion\n // eslint-disable-next-line no-undef\n return !String(Symbol());\n});\n","var NATIVE_SYMBOL = require('../internals/native-symbol');\n\nmodule.exports = NATIVE_SYMBOL\n // eslint-disable-next-line no-undef\n && !Symbol.sham\n // eslint-disable-next-line no-undef\n && typeof Symbol.iterator == 'symbol';\n","var classof = require('../internals/classof-raw');\n\n// `IsArray` abstract operation\n// https://tc39.github.io/ecma262/#sec-isarray\nmodule.exports = Array.isArray || function isArray(arg) {\n return classof(arg) == 'Array';\n};\n","var requireObjectCoercible = require('../internals/require-object-coercible');\n\n// `ToObject` abstract operation\n// https://tc39.github.io/ecma262/#sec-toobject\nmodule.exports = function (argument) {\n return Object(requireObjectCoercible(argument));\n};\n","var internalObjectKeys = require('../internals/object-keys-internal');\nvar enumBugKeys = require('../internals/enum-bug-keys');\n\n// `Object.keys` method\n// https://tc39.github.io/ecma262/#sec-object.keys\nmodule.exports = Object.keys || function keys(O) {\n return internalObjectKeys(O, enumBugKeys);\n};\n","var DESCRIPTORS = require('../internals/descriptors');\nvar definePropertyModule = require('../internals/object-define-property');\nvar anObject = require('../internals/an-object');\nvar objectKeys = require('../internals/object-keys');\n\n// `Object.defineProperties` method\n// https://tc39.github.io/ecma262/#sec-object.defineproperties\nmodule.exports = DESCRIPTORS ? Object.defineProperties : function defineProperties(O, Properties) {\n anObject(O);\n var keys = objectKeys(Properties);\n var length = keys.length;\n var index = 0;\n var key;\n while (length > index) definePropertyModule.f(O, key = keys[index++], Properties[key]);\n return O;\n};\n","var getBuiltIn = require('../internals/get-built-in');\n\nmodule.exports = getBuiltIn('document', 'documentElement');\n","var toIndexedObject = require('../internals/to-indexed-object');\nvar nativeGetOwnPropertyNames = require('../internals/object-get-own-property-names').f;\n\nvar toString = {}.toString;\n\nvar windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames\n ? Object.getOwnPropertyNames(window) : [];\n\nvar getWindowNames = function (it) {\n try {\n return nativeGetOwnPropertyNames(it);\n } catch (error) {\n return windowNames.slice();\n }\n};\n\n// fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window\nmodule.exports.f = function getOwnPropertyNames(it) {\n return windowNames && toString.call(it) == '[object Window]'\n ? getWindowNames(it)\n : nativeGetOwnPropertyNames(toIndexedObject(it));\n};\n","var global = require('../internals/global');\nvar shared = require('../internals/shared');\nvar has = require('../internals/has');\nvar uid = require('../internals/uid');\nvar NATIVE_SYMBOL = require('../internals/native-symbol');\nvar USE_SYMBOL_AS_UID = require('../internals/use-symbol-as-uid');\n\nvar WellKnownSymbolsStore = shared('wks');\nvar Symbol = global.Symbol;\nvar createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol : Symbol && Symbol.withoutSetter || uid;\n\nmodule.exports = function (name) {\n if (!has(WellKnownSymbolsStore, name)) {\n if (NATIVE_SYMBOL && has(Symbol, name)) WellKnownSymbolsStore[name] = Symbol[name];\n else WellKnownSymbolsStore[name] = createWellKnownSymbol('Symbol.' + name);\n } return WellKnownSymbolsStore[name];\n};\n","var wellKnownSymbol = require('../internals/well-known-symbol');\n\nexports.f = wellKnownSymbol;\n","var path = require('../internals/path');\nvar has = require('../internals/has');\nvar wrappedWellKnownSymbolModule = require('../internals/well-known-symbol-wrapped');\nvar defineProperty = require('../internals/object-define-property').f;\n\nmodule.exports = function (NAME) {\n var Symbol = path.Symbol || (path.Symbol = {});\n if (!has(Symbol, NAME)) defineProperty(Symbol, NAME, {\n value: wrappedWellKnownSymbolModule.f(NAME)\n });\n};\n","var defineProperty = require('../internals/object-define-property').f;\nvar has = require('../internals/has');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\n\nvar TO_STRING_TAG = wellKnownSymbol('toStringTag');\n\nmodule.exports = function (it, TAG, STATIC) {\n if (it && !has(it = STATIC ? it : it.prototype, TO_STRING_TAG)) {\n defineProperty(it, TO_STRING_TAG, { configurable: true, value: TAG });\n }\n};\n","module.exports = function (it) {\n if (typeof it != 'function') {\n throw TypeError(String(it) + ' is not a function');\n } return it;\n};\n","var aFunction = require('../internals/a-function');\n\n// optional / simple context binding\nmodule.exports = function (fn, that, length) {\n aFunction(fn);\n if (that === undefined) return fn;\n switch (length) {\n case 0: return function () {\n return fn.call(that);\n };\n case 1: return function (a) {\n return fn.call(that, a);\n };\n case 2: return function (a, b) {\n return fn.call(that, a, b);\n };\n case 3: return function (a, b, c) {\n return fn.call(that, a, b, c);\n };\n }\n return function (/* ...args */) {\n return fn.apply(that, arguments);\n };\n};\n","var isObject = require('../internals/is-object');\nvar isArray = require('../internals/is-array');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\n\nvar SPECIES = wellKnownSymbol('species');\n\n// `ArraySpeciesCreate` abstract operation\n// https://tc39.github.io/ecma262/#sec-arrayspeciescreate\nmodule.exports = function (originalArray, length) {\n var C;\n if (isArray(originalArray)) {\n C = originalArray.constructor;\n // cross-realm fallback\n if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined;\n else if (isObject(C)) {\n C = C[SPECIES];\n if (C === null) C = undefined;\n }\n } return new (C === undefined ? Array : C)(length === 0 ? 0 : length);\n};\n","var bind = require('../internals/function-bind-context');\nvar IndexedObject = require('../internals/indexed-object');\nvar toObject = require('../internals/to-object');\nvar toLength = require('../internals/to-length');\nvar arraySpeciesCreate = require('../internals/array-species-create');\n\nvar push = [].push;\n\n// `Array.prototype.{ forEach, map, filter, some, every, find, findIndex }` methods implementation\nvar createMethod = function (TYPE) {\n var IS_MAP = TYPE == 1;\n var IS_FILTER = TYPE == 2;\n var IS_SOME = TYPE == 3;\n var IS_EVERY = TYPE == 4;\n var IS_FIND_INDEX = TYPE == 6;\n var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;\n return function ($this, callbackfn, that, specificCreate) {\n var O = toObject($this);\n var self = IndexedObject(O);\n var boundFunction = bind(callbackfn, that, 3);\n var length = toLength(self.length);\n var index = 0;\n var create = specificCreate || arraySpeciesCreate;\n var target = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined;\n var value, result;\n for (;length > index; index++) if (NO_HOLES || index in self) {\n value = self[index];\n result = boundFunction(value, index, O);\n if (TYPE) {\n if (IS_MAP) target[index] = result; // map\n else if (result) switch (TYPE) {\n case 3: return true; // some\n case 5: return value; // find\n case 6: return index; // findIndex\n case 2: push.call(target, value); // filter\n } else if (IS_EVERY) return false; // every\n }\n }\n return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target;\n };\n};\n\nmodule.exports = {\n // `Array.prototype.forEach` method\n // https://tc39.github.io/ecma262/#sec-array.prototype.foreach\n forEach: createMethod(0),\n // `Array.prototype.map` method\n // https://tc39.github.io/ecma262/#sec-array.prototype.map\n map: createMethod(1),\n // `Array.prototype.filter` method\n // https://tc39.github.io/ecma262/#sec-array.prototype.filter\n filter: createMethod(2),\n // `Array.prototype.some` method\n // https://tc39.github.io/ecma262/#sec-array.prototype.some\n some: createMethod(3),\n // `Array.prototype.every` method\n // https://tc39.github.io/ecma262/#sec-array.prototype.every\n every: createMethod(4),\n // `Array.prototype.find` method\n // https://tc39.github.io/ecma262/#sec-array.prototype.find\n find: createMethod(5),\n // `Array.prototype.findIndex` method\n // https://tc39.github.io/ecma262/#sec-array.prototype.findIndex\n findIndex: createMethod(6)\n};\n","'use strict';\nvar $ = require('../internals/export');\nvar global = require('../internals/global');\nvar getBuiltIn = require('../internals/get-built-in');\nvar IS_PURE = require('../internals/is-pure');\nvar DESCRIPTORS = require('../internals/descriptors');\nvar NATIVE_SYMBOL = require('../internals/native-symbol');\nvar USE_SYMBOL_AS_UID = require('../internals/use-symbol-as-uid');\nvar fails = require('../internals/fails');\nvar has = require('../internals/has');\nvar isArray = require('../internals/is-array');\nvar isObject = require('../internals/is-object');\nvar anObject = require('../internals/an-object');\nvar toObject = require('../internals/to-object');\nvar toIndexedObject = require('../internals/to-indexed-object');\nvar toPrimitive = require('../internals/to-primitive');\nvar createPropertyDescriptor = require('../internals/create-property-descriptor');\nvar nativeObjectCreate = require('../internals/object-create');\nvar objectKeys = require('../internals/object-keys');\nvar getOwnPropertyNamesModule = require('../internals/object-get-own-property-names');\nvar getOwnPropertyNamesExternal = require('../internals/object-get-own-property-names-external');\nvar getOwnPropertySymbolsModule = require('../internals/object-get-own-property-symbols');\nvar getOwnPropertyDescriptorModule = require('../internals/object-get-own-property-descriptor');\nvar definePropertyModule = require('../internals/object-define-property');\nvar propertyIsEnumerableModule = require('../internals/object-property-is-enumerable');\nvar createNonEnumerableProperty = require('../internals/create-non-enumerable-property');\nvar redefine = require('../internals/redefine');\nvar shared = require('../internals/shared');\nvar sharedKey = require('../internals/shared-key');\nvar hiddenKeys = require('../internals/hidden-keys');\nvar uid = require('../internals/uid');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\nvar wrappedWellKnownSymbolModule = require('../internals/well-known-symbol-wrapped');\nvar defineWellKnownSymbol = require('../internals/define-well-known-symbol');\nvar setToStringTag = require('../internals/set-to-string-tag');\nvar InternalStateModule = require('../internals/internal-state');\nvar $forEach = require('../internals/array-iteration').forEach;\n\nvar HIDDEN = sharedKey('hidden');\nvar SYMBOL = 'Symbol';\nvar PROTOTYPE = 'prototype';\nvar TO_PRIMITIVE = wellKnownSymbol('toPrimitive');\nvar setInternalState = InternalStateModule.set;\nvar getInternalState = InternalStateModule.getterFor(SYMBOL);\nvar ObjectPrototype = Object[PROTOTYPE];\nvar $Symbol = global.Symbol;\nvar $stringify = getBuiltIn('JSON', 'stringify');\nvar nativeGetOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;\nvar nativeDefineProperty = definePropertyModule.f;\nvar nativeGetOwnPropertyNames = getOwnPropertyNamesExternal.f;\nvar nativePropertyIsEnumerable = propertyIsEnumerableModule.f;\nvar AllSymbols = shared('symbols');\nvar ObjectPrototypeSymbols = shared('op-symbols');\nvar StringToSymbolRegistry = shared('string-to-symbol-registry');\nvar SymbolToStringRegistry = shared('symbol-to-string-registry');\nvar WellKnownSymbolsStore = shared('wks');\nvar QObject = global.QObject;\n// Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173\nvar USE_SETTER = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild;\n\n// fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687\nvar setSymbolDescriptor = DESCRIPTORS && fails(function () {\n return nativeObjectCreate(nativeDefineProperty({}, 'a', {\n get: function () { return nativeDefineProperty(this, 'a', { value: 7 }).a; }\n })).a != 7;\n}) ? function (O, P, Attributes) {\n var ObjectPrototypeDescriptor = nativeGetOwnPropertyDescriptor(ObjectPrototype, P);\n if (ObjectPrototypeDescriptor) delete ObjectPrototype[P];\n nativeDefineProperty(O, P, Attributes);\n if (ObjectPrototypeDescriptor && O !== ObjectPrototype) {\n nativeDefineProperty(ObjectPrototype, P, ObjectPrototypeDescriptor);\n }\n} : nativeDefineProperty;\n\nvar wrap = function (tag, description) {\n var symbol = AllSymbols[tag] = nativeObjectCreate($Symbol[PROTOTYPE]);\n setInternalState(symbol, {\n type: SYMBOL,\n tag: tag,\n description: description\n });\n if (!DESCRIPTORS) symbol.description = description;\n return symbol;\n};\n\nvar isSymbol = USE_SYMBOL_AS_UID ? function (it) {\n return typeof it == 'symbol';\n} : function (it) {\n return Object(it) instanceof $Symbol;\n};\n\nvar $defineProperty = function defineProperty(O, P, Attributes) {\n if (O === ObjectPrototype) $defineProperty(ObjectPrototypeSymbols, P, Attributes);\n anObject(O);\n var key = toPrimitive(P, true);\n anObject(Attributes);\n if (has(AllSymbols, key)) {\n if (!Attributes.enumerable) {\n if (!has(O, HIDDEN)) nativeDefineProperty(O, HIDDEN, createPropertyDescriptor(1, {}));\n O[HIDDEN][key] = true;\n } else {\n if (has(O, HIDDEN) && O[HIDDEN][key]) O[HIDDEN][key] = false;\n Attributes = nativeObjectCreate(Attributes, { enumerable: createPropertyDescriptor(0, false) });\n } return setSymbolDescriptor(O, key, Attributes);\n } return nativeDefineProperty(O, key, Attributes);\n};\n\nvar $defineProperties = function defineProperties(O, Properties) {\n anObject(O);\n var properties = toIndexedObject(Properties);\n var keys = objectKeys(properties).concat($getOwnPropertySymbols(properties));\n $forEach(keys, function (key) {\n if (!DESCRIPTORS || $propertyIsEnumerable.call(properties, key)) $defineProperty(O, key, properties[key]);\n });\n return O;\n};\n\nvar $create = function create(O, Properties) {\n return Properties === undefined ? nativeObjectCreate(O) : $defineProperties(nativeObjectCreate(O), Properties);\n};\n\nvar $propertyIsEnumerable = function propertyIsEnumerable(V) {\n var P = toPrimitive(V, true);\n var enumerable = nativePropertyIsEnumerable.call(this, P);\n if (this === ObjectPrototype && has(AllSymbols, P) && !has(ObjectPrototypeSymbols, P)) return false;\n return enumerable || !has(this, P) || !has(AllSymbols, P) || has(this, HIDDEN) && this[HIDDEN][P] ? enumerable : true;\n};\n\nvar $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(O, P) {\n var it = toIndexedObject(O);\n var key = toPrimitive(P, true);\n if (it === ObjectPrototype && has(AllSymbols, key) && !has(ObjectPrototypeSymbols, key)) return;\n var descriptor = nativeGetOwnPropertyDescriptor(it, key);\n if (descriptor && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key])) {\n descriptor.enumerable = true;\n }\n return descriptor;\n};\n\nvar $getOwnPropertyNames = function getOwnPropertyNames(O) {\n var names = nativeGetOwnPropertyNames(toIndexedObject(O));\n var result = [];\n $forEach(names, function (key) {\n if (!has(AllSymbols, key) && !has(hiddenKeys, key)) result.push(key);\n });\n return result;\n};\n\nvar $getOwnPropertySymbols = function getOwnPropertySymbols(O) {\n var IS_OBJECT_PROTOTYPE = O === ObjectPrototype;\n var names = nativeGetOwnPropertyNames(IS_OBJECT_PROTOTYPE ? ObjectPrototypeSymbols : toIndexedObject(O));\n var result = [];\n $forEach(names, function (key) {\n if (has(AllSymbols, key) && (!IS_OBJECT_PROTOTYPE || has(ObjectPrototype, key))) {\n result.push(AllSymbols[key]);\n }\n });\n return result;\n};\n\n// `Symbol` constructor\n// https://tc39.github.io/ecma262/#sec-symbol-constructor\nif (!NATIVE_SYMBOL) {\n $Symbol = function Symbol() {\n if (this instanceof $Symbol) throw TypeError('Symbol is not a constructor');\n var description = !arguments.length || arguments[0] === undefined ? undefined : String(arguments[0]);\n var tag = uid(description);\n var setter = function (value) {\n if (this === ObjectPrototype) setter.call(ObjectPrototypeSymbols, value);\n if (has(this, HIDDEN) && has(this[HIDDEN], tag)) this[HIDDEN][tag] = false;\n setSymbolDescriptor(this, tag, createPropertyDescriptor(1, value));\n };\n if (DESCRIPTORS && USE_SETTER) setSymbolDescriptor(ObjectPrototype, tag, { configurable: true, set: setter });\n return wrap(tag, description);\n };\n\n redefine($Symbol[PROTOTYPE], 'toString', function toString() {\n return getInternalState(this).tag;\n });\n\n redefine($Symbol, 'withoutSetter', function (description) {\n return wrap(uid(description), description);\n });\n\n propertyIsEnumerableModule.f = $propertyIsEnumerable;\n definePropertyModule.f = $defineProperty;\n getOwnPropertyDescriptorModule.f = $getOwnPropertyDescriptor;\n getOwnPropertyNamesModule.f = getOwnPropertyNamesExternal.f = $getOwnPropertyNames;\n getOwnPropertySymbolsModule.f = $getOwnPropertySymbols;\n\n wrappedWellKnownSymbolModule.f = function (name) {\n return wrap(wellKnownSymbol(name), name);\n };\n\n if (DESCRIPTORS) {\n // https://github.com/tc39/proposal-Symbol-description\n nativeDefineProperty($Symbol[PROTOTYPE], 'description', {\n configurable: true,\n get: function description() {\n return getInternalState(this).description;\n }\n });\n if (!IS_PURE) {\n redefine(ObjectPrototype, 'propertyIsEnumerable', $propertyIsEnumerable, { unsafe: true });\n }\n }\n}\n\n$({ global: true, wrap: true, forced: !NATIVE_SYMBOL, sham: !NATIVE_SYMBOL }, {\n Symbol: $Symbol\n});\n\n$forEach(objectKeys(WellKnownSymbolsStore), function (name) {\n defineWellKnownSymbol(name);\n});\n\n$({ target: SYMBOL, stat: true, forced: !NATIVE_SYMBOL }, {\n // `Symbol.for` method\n // https://tc39.github.io/ecma262/#sec-symbol.for\n 'for': function (key) {\n var string = String(key);\n if (has(StringToSymbolRegistry, string)) return StringToSymbolRegistry[string];\n var symbol = $Symbol(string);\n StringToSymbolRegistry[string] = symbol;\n SymbolToStringRegistry[symbol] = string;\n return symbol;\n },\n // `Symbol.keyFor` method\n // https://tc39.github.io/ecma262/#sec-symbol.keyfor\n keyFor: function keyFor(sym) {\n if (!isSymbol(sym)) throw TypeError(sym + ' is not a symbol');\n if (has(SymbolToStringRegistry, sym)) return SymbolToStringRegistry[sym];\n },\n useSetter: function () { USE_SETTER = true; },\n useSimple: function () { USE_SETTER = false; }\n});\n\n$({ target: 'Object', stat: true, forced: !NATIVE_SYMBOL, sham: !DESCRIPTORS }, {\n // `Object.create` method\n // https://tc39.github.io/ecma262/#sec-object.create\n create: $create,\n // `Object.defineProperty` method\n // https://tc39.github.io/ecma262/#sec-object.defineproperty\n defineProperty: $defineProperty,\n // `Object.defineProperties` method\n // https://tc39.github.io/ecma262/#sec-object.defineproperties\n defineProperties: $defineProperties,\n // `Object.getOwnPropertyDescriptor` method\n // https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptors\n getOwnPropertyDescriptor: $getOwnPropertyDescriptor\n});\n\n$({ target: 'Object', stat: true, forced: !NATIVE_SYMBOL }, {\n // `Object.getOwnPropertyNames` method\n // https://tc39.github.io/ecma262/#sec-object.getownpropertynames\n getOwnPropertyNames: $getOwnPropertyNames,\n // `Object.getOwnPropertySymbols` method\n // https://tc39.github.io/ecma262/#sec-object.getownpropertysymbols\n getOwnPropertySymbols: $getOwnPropertySymbols\n});\n\n// Chrome 38 and 39 `Object.getOwnPropertySymbols` fails on primitives\n// https://bugs.chromium.org/p/v8/issues/detail?id=3443\n$({ target: 'Object', stat: true, forced: fails(function () { getOwnPropertySymbolsModule.f(1); }) }, {\n getOwnPropertySymbols: function getOwnPropertySymbols(it) {\n return getOwnPropertySymbolsModule.f(toObject(it));\n }\n});\n\n// `JSON.stringify` method behavior with symbols\n// https://tc39.github.io/ecma262/#sec-json.stringify\nif ($stringify) {\n var FORCED_JSON_STRINGIFY = !NATIVE_SYMBOL || fails(function () {\n var symbol = $Symbol();\n // MS Edge converts symbol values to JSON as {}\n return $stringify([symbol]) != '[null]'\n // WebKit converts symbol values to JSON as null\n || $stringify({ a: symbol }) != '{}'\n // V8 throws on boxed symbols\n || $stringify(Object(symbol)) != '{}';\n });\n\n $({ target: 'JSON', stat: true, forced: FORCED_JSON_STRINGIFY }, {\n // eslint-disable-next-line no-unused-vars\n stringify: function stringify(it, replacer, space) {\n var args = [it];\n var index = 1;\n var $replacer;\n while (arguments.length > index) args.push(arguments[index++]);\n $replacer = replacer;\n if (!isObject(replacer) && it === undefined || isSymbol(it)) return; // IE8 returns string on undefined\n if (!isArray(replacer)) replacer = function (key, value) {\n if (typeof $replacer == 'function') value = $replacer.call(this, key, value);\n if (!isSymbol(value)) return value;\n };\n args[1] = replacer;\n return $stringify.apply(null, args);\n }\n });\n}\n\n// `Symbol.prototype[@@toPrimitive]` method\n// https://tc39.github.io/ecma262/#sec-symbol.prototype-@@toprimitive\nif (!$Symbol[PROTOTYPE][TO_PRIMITIVE]) {\n createNonEnumerableProperty($Symbol[PROTOTYPE], TO_PRIMITIVE, $Symbol[PROTOTYPE].valueOf);\n}\n// `Symbol.prototype[@@toStringTag]` property\n// https://tc39.github.io/ecma262/#sec-symbol.prototype-@@tostringtag\nsetToStringTag($Symbol, SYMBOL);\n\nhiddenKeys[HIDDEN] = true;\n","// `Symbol.prototype.description` getter\n// https://tc39.github.io/ecma262/#sec-symbol.prototype.description\n'use strict';\nvar $ = require('../internals/export');\nvar DESCRIPTORS = require('../internals/descriptors');\nvar global = require('../internals/global');\nvar has = require('../internals/has');\nvar isObject = require('../internals/is-object');\nvar defineProperty = require('../internals/object-define-property').f;\nvar copyConstructorProperties = require('../internals/copy-constructor-properties');\n\nvar NativeSymbol = global.Symbol;\n\nif (DESCRIPTORS && typeof NativeSymbol == 'function' && (!('description' in NativeSymbol.prototype) ||\n // Safari 12 bug\n NativeSymbol().description !== undefined\n)) {\n var EmptyStringDescriptionStore = {};\n // wrap Symbol constructor for correct work with undefined description\n var SymbolWrapper = function Symbol() {\n var description = arguments.length < 1 || arguments[0] === undefined ? undefined : String(arguments[0]);\n var result = this instanceof SymbolWrapper\n ? new NativeSymbol(description)\n // in Edge 13, String(Symbol(undefined)) === 'Symbol(undefined)'\n : description === undefined ? NativeSymbol() : NativeSymbol(description);\n if (description === '') EmptyStringDescriptionStore[result] = true;\n return result;\n };\n copyConstructorProperties(SymbolWrapper, NativeSymbol);\n var symbolPrototype = SymbolWrapper.prototype = NativeSymbol.prototype;\n symbolPrototype.constructor = SymbolWrapper;\n\n var symbolToString = symbolPrototype.toString;\n var native = String(NativeSymbol('test')) == 'Symbol(test)';\n var regexp = /^Symbol\\((.*)\\)[^)]+$/;\n defineProperty(symbolPrototype, 'description', {\n configurable: true,\n get: function description() {\n var symbol = isObject(this) ? this.valueOf() : this;\n var string = symbolToString.call(symbol);\n if (has(EmptyStringDescriptionStore, symbol)) return '';\n var desc = native ? string.slice(7, -1) : string.replace(regexp, '$1');\n return desc === '' ? undefined : desc;\n }\n });\n\n $({ global: true, forced: true }, {\n Symbol: SymbolWrapper\n });\n}\n","var defineWellKnownSymbol = require('../internals/define-well-known-symbol');\n\n// `Symbol.iterator` well-known symbol\n// https://tc39.github.io/ecma262/#sec-symbol.iterator\ndefineWellKnownSymbol('iterator');\n","'use strict';\nvar fails = require('../internals/fails');\n\nmodule.exports = function (METHOD_NAME, argument) {\n var method = [][METHOD_NAME];\n return !!method && fails(function () {\n // eslint-disable-next-line no-useless-call,no-throw-literal\n method.call(null, argument || function () { throw 1; }, 1);\n });\n};\n","var DESCRIPTORS = require('../internals/descriptors');\nvar fails = require('../internals/fails');\nvar has = require('../internals/has');\n\nvar defineProperty = Object.defineProperty;\nvar cache = {};\n\nvar thrower = function (it) { throw it; };\n\nmodule.exports = function (METHOD_NAME, options) {\n if (has(cache, METHOD_NAME)) return cache[METHOD_NAME];\n if (!options) options = {};\n var method = [][METHOD_NAME];\n var ACCESSORS = has(options, 'ACCESSORS') ? options.ACCESSORS : false;\n var argument0 = has(options, 0) ? options[0] : thrower;\n var argument1 = has(options, 1) ? options[1] : undefined;\n\n return cache[METHOD_NAME] = !!method && !fails(function () {\n if (ACCESSORS && !DESCRIPTORS) return true;\n var O = { length: -1 };\n\n if (ACCESSORS) defineProperty(O, 1, { enumerable: true, get: thrower });\n else O[1] = 1;\n\n method.call(O, argument0, argument1);\n });\n};\n","'use strict';\nvar $forEach = require('../internals/array-iteration').forEach;\nvar arrayMethodIsStrict = require('../internals/array-method-is-strict');\nvar arrayMethodUsesToLength = require('../internals/array-method-uses-to-length');\n\nvar STRICT_METHOD = arrayMethodIsStrict('forEach');\nvar USES_TO_LENGTH = arrayMethodUsesToLength('forEach');\n\n// `Array.prototype.forEach` method implementation\n// https://tc39.github.io/ecma262/#sec-array.prototype.foreach\nmodule.exports = (!STRICT_METHOD || !USES_TO_LENGTH) ? function forEach(callbackfn /* , thisArg */) {\n return $forEach(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);\n} : [].forEach;\n","'use strict';\nvar $ = require('../internals/export');\nvar forEach = require('../internals/array-for-each');\n\n// `Array.prototype.forEach` method\n// https://tc39.github.io/ecma262/#sec-array.prototype.foreach\n$({ target: 'Array', proto: true, forced: [].forEach != forEach }, {\n forEach: forEach\n});\n","'use strict';\nvar $ = require('../internals/export');\nvar $indexOf = require('../internals/array-includes').indexOf;\nvar arrayMethodIsStrict = require('../internals/array-method-is-strict');\nvar arrayMethodUsesToLength = require('../internals/array-method-uses-to-length');\n\nvar nativeIndexOf = [].indexOf;\n\nvar NEGATIVE_ZERO = !!nativeIndexOf && 1 / [1].indexOf(1, -0) < 0;\nvar STRICT_METHOD = arrayMethodIsStrict('indexOf');\nvar USES_TO_LENGTH = arrayMethodUsesToLength('indexOf', { ACCESSORS: true, 1: 0 });\n\n// `Array.prototype.indexOf` method\n// https://tc39.github.io/ecma262/#sec-array.prototype.indexof\n$({ target: 'Array', proto: true, forced: NEGATIVE_ZERO || !STRICT_METHOD || !USES_TO_LENGTH }, {\n indexOf: function indexOf(searchElement /* , fromIndex = 0 */) {\n return NEGATIVE_ZERO\n // convert -0 to +0\n ? nativeIndexOf.apply(this, arguments) || 0\n : $indexOf(this, searchElement, arguments.length > 1 ? arguments[1] : undefined);\n }\n});\n","var wellKnownSymbol = require('../internals/well-known-symbol');\nvar create = require('../internals/object-create');\nvar definePropertyModule = require('../internals/object-define-property');\n\nvar UNSCOPABLES = wellKnownSymbol('unscopables');\nvar ArrayPrototype = Array.prototype;\n\n// Array.prototype[@@unscopables]\n// https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables\nif (ArrayPrototype[UNSCOPABLES] == undefined) {\n definePropertyModule.f(ArrayPrototype, UNSCOPABLES, {\n configurable: true,\n value: create(null)\n });\n}\n\n// add a key to Array.prototype[@@unscopables]\nmodule.exports = function (key) {\n ArrayPrototype[UNSCOPABLES][key] = true;\n};\n","'use strict';\nvar getPrototypeOf = require('../internals/object-get-prototype-of');\nvar createNonEnumerableProperty = require('../internals/create-non-enumerable-property');\nvar has = require('../internals/has');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\nvar IS_PURE = require('../internals/is-pure');\n\nvar ITERATOR = wellKnownSymbol('iterator');\nvar BUGGY_SAFARI_ITERATORS = false;\n\nvar returnThis = function () { return this; };\n\n// `%IteratorPrototype%` object\n// https://tc39.github.io/ecma262/#sec-%iteratorprototype%-object\nvar IteratorPrototype, PrototypeOfArrayIteratorPrototype, arrayIterator;\n\nif ([].keys) {\n arrayIterator = [].keys();\n // Safari 8 has buggy iterators w/o `next`\n if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS = true;\n else {\n PrototypeOfArrayIteratorPrototype = getPrototypeOf(getPrototypeOf(arrayIterator));\n if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype = PrototypeOfArrayIteratorPrototype;\n }\n}\n\nif (IteratorPrototype == undefined) IteratorPrototype = {};\n\n// 25.1.2.1.1 %IteratorPrototype%[@@iterator]()\nif (!IS_PURE && !has(IteratorPrototype, ITERATOR)) {\n createNonEnumerableProperty(IteratorPrototype, ITERATOR, returnThis);\n}\n\nmodule.exports = {\n IteratorPrototype: IteratorPrototype,\n BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS\n};\n","module.exports = {};\n","var fails = require('../internals/fails');\n\nmodule.exports = !fails(function () {\n function F() { /* empty */ }\n F.prototype.constructor = null;\n return Object.getPrototypeOf(new F()) !== F.prototype;\n});\n","var has = require('../internals/has');\nvar toObject = require('../internals/to-object');\nvar sharedKey = require('../internals/shared-key');\nvar CORRECT_PROTOTYPE_GETTER = require('../internals/correct-prototype-getter');\n\nvar IE_PROTO = sharedKey('IE_PROTO');\nvar ObjectPrototype = Object.prototype;\n\n// `Object.getPrototypeOf` method\n// https://tc39.github.io/ecma262/#sec-object.getprototypeof\nmodule.exports = CORRECT_PROTOTYPE_GETTER ? Object.getPrototypeOf : function (O) {\n O = toObject(O);\n if (has(O, IE_PROTO)) return O[IE_PROTO];\n if (typeof O.constructor == 'function' && O instanceof O.constructor) {\n return O.constructor.prototype;\n } return O instanceof Object ? ObjectPrototype : null;\n};\n","'use strict';\nvar IteratorPrototype = require('../internals/iterators-core').IteratorPrototype;\nvar create = require('../internals/object-create');\nvar createPropertyDescriptor = require('../internals/create-property-descriptor');\nvar setToStringTag = require('../internals/set-to-string-tag');\nvar Iterators = require('../internals/iterators');\n\nvar returnThis = function () { return this; };\n\nmodule.exports = function (IteratorConstructor, NAME, next) {\n var TO_STRING_TAG = NAME + ' Iterator';\n IteratorConstructor.prototype = create(IteratorPrototype, { next: createPropertyDescriptor(1, next) });\n setToStringTag(IteratorConstructor, TO_STRING_TAG, false, true);\n Iterators[TO_STRING_TAG] = returnThis;\n return IteratorConstructor;\n};\n","var isObject = require('../internals/is-object');\n\nmodule.exports = function (it) {\n if (!isObject(it) && it !== null) {\n throw TypeError(\"Can't set \" + String(it) + ' as a prototype');\n } return it;\n};\n","var anObject = require('../internals/an-object');\nvar aPossiblePrototype = require('../internals/a-possible-prototype');\n\n// `Object.setPrototypeOf` method\n// https://tc39.github.io/ecma262/#sec-object.setprototypeof\n// Works with __proto__ only. Old v8 can't work with null proto objects.\n/* eslint-disable no-proto */\nmodule.exports = Object.setPrototypeOf || ('__proto__' in {} ? function () {\n var CORRECT_SETTER = false;\n var test = {};\n var setter;\n try {\n setter = Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set;\n setter.call(test, []);\n CORRECT_SETTER = test instanceof Array;\n } catch (error) { /* empty */ }\n return function setPrototypeOf(O, proto) {\n anObject(O);\n aPossiblePrototype(proto);\n if (CORRECT_SETTER) setter.call(O, proto);\n else O.__proto__ = proto;\n return O;\n };\n}() : undefined);\n","'use strict';\nvar $ = require('../internals/export');\nvar createIteratorConstructor = require('../internals/create-iterator-constructor');\nvar getPrototypeOf = require('../internals/object-get-prototype-of');\nvar setPrototypeOf = require('../internals/object-set-prototype-of');\nvar setToStringTag = require('../internals/set-to-string-tag');\nvar createNonEnumerableProperty = require('../internals/create-non-enumerable-property');\nvar redefine = require('../internals/redefine');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\nvar IS_PURE = require('../internals/is-pure');\nvar Iterators = require('../internals/iterators');\nvar IteratorsCore = require('../internals/iterators-core');\n\nvar IteratorPrototype = IteratorsCore.IteratorPrototype;\nvar BUGGY_SAFARI_ITERATORS = IteratorsCore.BUGGY_SAFARI_ITERATORS;\nvar ITERATOR = wellKnownSymbol('iterator');\nvar KEYS = 'keys';\nvar VALUES = 'values';\nvar ENTRIES = 'entries';\n\nvar returnThis = function () { return this; };\n\nmodule.exports = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) {\n createIteratorConstructor(IteratorConstructor, NAME, next);\n\n var getIterationMethod = function (KIND) {\n if (KIND === DEFAULT && defaultIterator) return defaultIterator;\n if (!BUGGY_SAFARI_ITERATORS && KIND in IterablePrototype) return IterablePrototype[KIND];\n switch (KIND) {\n case KEYS: return function keys() { return new IteratorConstructor(this, KIND); };\n case VALUES: return function values() { return new IteratorConstructor(this, KIND); };\n case ENTRIES: return function entries() { return new IteratorConstructor(this, KIND); };\n } return function () { return new IteratorConstructor(this); };\n };\n\n var TO_STRING_TAG = NAME + ' Iterator';\n var INCORRECT_VALUES_NAME = false;\n var IterablePrototype = Iterable.prototype;\n var nativeIterator = IterablePrototype[ITERATOR]\n || IterablePrototype['@@iterator']\n || DEFAULT && IterablePrototype[DEFAULT];\n var defaultIterator = !BUGGY_SAFARI_ITERATORS && nativeIterator || getIterationMethod(DEFAULT);\n var anyNativeIterator = NAME == 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator;\n var CurrentIteratorPrototype, methods, KEY;\n\n // fix native\n if (anyNativeIterator) {\n CurrentIteratorPrototype = getPrototypeOf(anyNativeIterator.call(new Iterable()));\n if (IteratorPrototype !== Object.prototype && CurrentIteratorPrototype.next) {\n if (!IS_PURE && getPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype) {\n if (setPrototypeOf) {\n setPrototypeOf(CurrentIteratorPrototype, IteratorPrototype);\n } else if (typeof CurrentIteratorPrototype[ITERATOR] != 'function') {\n createNonEnumerableProperty(CurrentIteratorPrototype, ITERATOR, returnThis);\n }\n }\n // Set @@toStringTag to native iterators\n setToStringTag(CurrentIteratorPrototype, TO_STRING_TAG, true, true);\n if (IS_PURE) Iterators[TO_STRING_TAG] = returnThis;\n }\n }\n\n // fix Array#{values, @@iterator}.name in V8 / FF\n if (DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES) {\n INCORRECT_VALUES_NAME = true;\n defaultIterator = function values() { return nativeIterator.call(this); };\n }\n\n // define iterator\n if ((!IS_PURE || FORCED) && IterablePrototype[ITERATOR] !== defaultIterator) {\n createNonEnumerableProperty(IterablePrototype, ITERATOR, defaultIterator);\n }\n Iterators[NAME] = defaultIterator;\n\n // export additional methods\n if (DEFAULT) {\n methods = {\n values: getIterationMethod(VALUES),\n keys: IS_SET ? defaultIterator : getIterationMethod(KEYS),\n entries: getIterationMethod(ENTRIES)\n };\n if (FORCED) for (KEY in methods) {\n if (BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) {\n redefine(IterablePrototype, KEY, methods[KEY]);\n }\n } else $({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME }, methods);\n }\n\n return methods;\n};\n","'use strict';\nvar toIndexedObject = require('../internals/to-indexed-object');\nvar addToUnscopables = require('../internals/add-to-unscopables');\nvar Iterators = require('../internals/iterators');\nvar InternalStateModule = require('../internals/internal-state');\nvar defineIterator = require('../internals/define-iterator');\n\nvar ARRAY_ITERATOR = 'Array Iterator';\nvar setInternalState = InternalStateModule.set;\nvar getInternalState = InternalStateModule.getterFor(ARRAY_ITERATOR);\n\n// `Array.prototype.entries` method\n// https://tc39.github.io/ecma262/#sec-array.prototype.entries\n// `Array.prototype.keys` method\n// https://tc39.github.io/ecma262/#sec-array.prototype.keys\n// `Array.prototype.values` method\n// https://tc39.github.io/ecma262/#sec-array.prototype.values\n// `Array.prototype[@@iterator]` method\n// https://tc39.github.io/ecma262/#sec-array.prototype-@@iterator\n// `CreateArrayIterator` internal method\n// https://tc39.github.io/ecma262/#sec-createarrayiterator\nmodule.exports = defineIterator(Array, 'Array', function (iterated, kind) {\n setInternalState(this, {\n type: ARRAY_ITERATOR,\n target: toIndexedObject(iterated), // target\n index: 0, // next index\n kind: kind // kind\n });\n// `%ArrayIteratorPrototype%.next` method\n// https://tc39.github.io/ecma262/#sec-%arrayiteratorprototype%.next\n}, function () {\n var state = getInternalState(this);\n var target = state.target;\n var kind = state.kind;\n var index = state.index++;\n if (!target || index >= target.length) {\n state.target = undefined;\n return { value: undefined, done: true };\n }\n if (kind == 'keys') return { value: index, done: false };\n if (kind == 'values') return { value: target[index], done: false };\n return { value: [index, target[index]], done: false };\n}, 'values');\n\n// argumentsList[@@iterator] is %ArrayProto_values%\n// https://tc39.github.io/ecma262/#sec-createunmappedargumentsobject\n// https://tc39.github.io/ecma262/#sec-createmappedargumentsobject\nIterators.Arguments = Iterators.Array;\n\n// https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables\naddToUnscopables('keys');\naddToUnscopables('values');\naddToUnscopables('entries');\n","'use strict';\nvar $ = require('../internals/export');\nvar IndexedObject = require('../internals/indexed-object');\nvar toIndexedObject = require('../internals/to-indexed-object');\nvar arrayMethodIsStrict = require('../internals/array-method-is-strict');\n\nvar nativeJoin = [].join;\n\nvar ES3_STRINGS = IndexedObject != Object;\nvar STRICT_METHOD = arrayMethodIsStrict('join', ',');\n\n// `Array.prototype.join` method\n// https://tc39.github.io/ecma262/#sec-array.prototype.join\n$({ target: 'Array', proto: true, forced: ES3_STRINGS || !STRICT_METHOD }, {\n join: function join(separator) {\n return nativeJoin.call(toIndexedObject(this), separator === undefined ? ',' : separator);\n }\n});\n","'use strict';\nvar toPrimitive = require('../internals/to-primitive');\nvar definePropertyModule = require('../internals/object-define-property');\nvar createPropertyDescriptor = require('../internals/create-property-descriptor');\n\nmodule.exports = function (object, key, value) {\n var propertyKey = toPrimitive(key);\n if (propertyKey in object) definePropertyModule.f(object, propertyKey, createPropertyDescriptor(0, value));\n else object[propertyKey] = value;\n};\n","var global = require('../internals/global');\nvar userAgent = require('../internals/engine-user-agent');\n\nvar process = global.process;\nvar versions = process && process.versions;\nvar v8 = versions && versions.v8;\nvar match, version;\n\nif (v8) {\n match = v8.split('.');\n version = match[0] + match[1];\n} else if (userAgent) {\n match = userAgent.match(/Edge\\/(\\d+)/);\n if (!match || match[1] >= 74) {\n match = userAgent.match(/Chrome\\/(\\d+)/);\n if (match) version = match[1];\n }\n}\n\nmodule.exports = version && +version;\n","var getBuiltIn = require('../internals/get-built-in');\n\nmodule.exports = getBuiltIn('navigator', 'userAgent') || '';\n","var fails = require('../internals/fails');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\nvar V8_VERSION = require('../internals/engine-v8-version');\n\nvar SPECIES = wellKnownSymbol('species');\n\nmodule.exports = function (METHOD_NAME) {\n // We can't use this feature detection in V8 since it causes\n // deoptimization and serious performance degradation\n // https://github.com/zloirock/core-js/issues/677\n return V8_VERSION >= 51 || !fails(function () {\n var array = [];\n var constructor = array.constructor = {};\n constructor[SPECIES] = function () {\n return { foo: 1 };\n };\n return array[METHOD_NAME](Boolean).foo !== 1;\n });\n};\n","'use strict';\nvar $ = require('../internals/export');\nvar isObject = require('../internals/is-object');\nvar isArray = require('../internals/is-array');\nvar toAbsoluteIndex = require('../internals/to-absolute-index');\nvar toLength = require('../internals/to-length');\nvar toIndexedObject = require('../internals/to-indexed-object');\nvar createProperty = require('../internals/create-property');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\nvar arrayMethodHasSpeciesSupport = require('../internals/array-method-has-species-support');\nvar arrayMethodUsesToLength = require('../internals/array-method-uses-to-length');\n\nvar HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('slice');\nvar USES_TO_LENGTH = arrayMethodUsesToLength('slice', { ACCESSORS: true, 0: 0, 1: 2 });\n\nvar SPECIES = wellKnownSymbol('species');\nvar nativeSlice = [].slice;\nvar max = Math.max;\n\n// `Array.prototype.slice` method\n// https://tc39.github.io/ecma262/#sec-array.prototype.slice\n// fallback for not array-like ES3 strings and DOM objects\n$({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT || !USES_TO_LENGTH }, {\n slice: function slice(start, end) {\n var O = toIndexedObject(this);\n var length = toLength(O.length);\n var k = toAbsoluteIndex(start, length);\n var fin = toAbsoluteIndex(end === undefined ? length : end, length);\n // inline `ArraySpeciesCreate` for usage native `Array#slice` where it's possible\n var Constructor, result, n;\n if (isArray(O)) {\n Constructor = O.constructor;\n // cross-realm fallback\n if (typeof Constructor == 'function' && (Constructor === Array || isArray(Constructor.prototype))) {\n Constructor = undefined;\n } else if (isObject(Constructor)) {\n Constructor = Constructor[SPECIES];\n if (Constructor === null) Constructor = undefined;\n }\n if (Constructor === Array || Constructor === undefined) {\n return nativeSlice.call(O, k, fin);\n }\n }\n result = new (Constructor === undefined ? Array : Constructor)(max(fin - k, 0));\n for (n = 0; k < fin; k++, n++) if (k in O) createProperty(result, n, O[k]);\n result.length = n;\n return result;\n }\n});\n","var wellKnownSymbol = require('../internals/well-known-symbol');\n\nvar TO_STRING_TAG = wellKnownSymbol('toStringTag');\nvar test = {};\n\ntest[TO_STRING_TAG] = 'z';\n\nmodule.exports = String(test) === '[object z]';\n","var TO_STRING_TAG_SUPPORT = require('../internals/to-string-tag-support');\nvar classofRaw = require('../internals/classof-raw');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\n\nvar TO_STRING_TAG = wellKnownSymbol('toStringTag');\n// ES3 wrong here\nvar CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments';\n\n// fallback for IE11 Script Access Denied error\nvar tryGet = function (it, key) {\n try {\n return it[key];\n } catch (error) { /* empty */ }\n};\n\n// getting tag from ES6+ `Object.prototype.toString`\nmodule.exports = TO_STRING_TAG_SUPPORT ? classofRaw : function (it) {\n var O, tag, result;\n return it === undefined ? 'Undefined' : it === null ? 'Null'\n // @@toStringTag case\n : typeof (tag = tryGet(O = Object(it), TO_STRING_TAG)) == 'string' ? tag\n // builtinTag case\n : CORRECT_ARGUMENTS ? classofRaw(O)\n // ES3 arguments fallback\n : (result = classofRaw(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : result;\n};\n","'use strict';\nvar TO_STRING_TAG_SUPPORT = require('../internals/to-string-tag-support');\nvar classof = require('../internals/classof');\n\n// `Object.prototype.toString` method implementation\n// https://tc39.github.io/ecma262/#sec-object.prototype.tostring\nmodule.exports = TO_STRING_TAG_SUPPORT ? {}.toString : function toString() {\n return '[object ' + classof(this) + ']';\n};\n","var TO_STRING_TAG_SUPPORT = require('../internals/to-string-tag-support');\nvar redefine = require('../internals/redefine');\nvar toString = require('../internals/object-to-string');\n\n// `Object.prototype.toString` method\n// https://tc39.github.io/ecma262/#sec-object.prototype.tostring\nif (!TO_STRING_TAG_SUPPORT) {\n redefine(Object.prototype, 'toString', toString, { unsafe: true });\n}\n","'use strict';\nvar anObject = require('../internals/an-object');\n\n// `RegExp.prototype.flags` getter implementation\n// https://tc39.github.io/ecma262/#sec-get-regexp.prototype.flags\nmodule.exports = function () {\n var that = anObject(this);\n var result = '';\n if (that.global) result += 'g';\n if (that.ignoreCase) result += 'i';\n if (that.multiline) result += 'm';\n if (that.dotAll) result += 's';\n if (that.unicode) result += 'u';\n if (that.sticky) result += 'y';\n return result;\n};\n","'use strict';\n\nvar fails = require('./fails');\n\n// babel-minify transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError,\n// so we use an intermediate function.\nfunction RE(s, f) {\n return RegExp(s, f);\n}\n\nexports.UNSUPPORTED_Y = fails(function () {\n // babel-minify transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError\n var re = RE('a', 'y');\n re.lastIndex = 2;\n return re.exec('abcd') != null;\n});\n\nexports.BROKEN_CARET = fails(function () {\n // https://bugzilla.mozilla.org/show_bug.cgi?id=773687\n var re = RE('^r', 'gy');\n re.lastIndex = 2;\n return re.exec('str') != null;\n});\n","'use strict';\nvar regexpFlags = require('./regexp-flags');\nvar stickyHelpers = require('./regexp-sticky-helpers');\n\nvar nativeExec = RegExp.prototype.exec;\n// This always refers to the native implementation, because the\n// String#replace polyfill uses ./fix-regexp-well-known-symbol-logic.js,\n// which loads this file before patching the method.\nvar nativeReplace = String.prototype.replace;\n\nvar patchedExec = nativeExec;\n\nvar UPDATES_LAST_INDEX_WRONG = (function () {\n var re1 = /a/;\n var re2 = /b*/g;\n nativeExec.call(re1, 'a');\n nativeExec.call(re2, 'a');\n return re1.lastIndex !== 0 || re2.lastIndex !== 0;\n})();\n\nvar UNSUPPORTED_Y = stickyHelpers.UNSUPPORTED_Y || stickyHelpers.BROKEN_CARET;\n\n// nonparticipating capturing group, copied from es5-shim's String#split patch.\nvar NPCG_INCLUDED = /()??/.exec('')[1] !== undefined;\n\nvar PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED || UNSUPPORTED_Y;\n\nif (PATCH) {\n patchedExec = function exec(str) {\n var re = this;\n var lastIndex, reCopy, match, i;\n var sticky = UNSUPPORTED_Y && re.sticky;\n var flags = regexpFlags.call(re);\n var source = re.source;\n var charsAdded = 0;\n var strCopy = str;\n\n if (sticky) {\n flags = flags.replace('y', '');\n if (flags.indexOf('g') === -1) {\n flags += 'g';\n }\n\n strCopy = String(str).slice(re.lastIndex);\n // Support anchored sticky behavior.\n if (re.lastIndex > 0 && (!re.multiline || re.multiline && str[re.lastIndex - 1] !== '\\n')) {\n source = '(?: ' + source + ')';\n strCopy = ' ' + strCopy;\n charsAdded++;\n }\n // ^(? + rx + ) is needed, in combination with some str slicing, to\n // simulate the 'y' flag.\n reCopy = new RegExp('^(?:' + source + ')', flags);\n }\n\n if (NPCG_INCLUDED) {\n reCopy = new RegExp('^' + source + '$(?!\\\\s)', flags);\n }\n if (UPDATES_LAST_INDEX_WRONG) lastIndex = re.lastIndex;\n\n match = nativeExec.call(sticky ? reCopy : re, strCopy);\n\n if (sticky) {\n if (match) {\n match.input = match.input.slice(charsAdded);\n match[0] = match[0].slice(charsAdded);\n match.index = re.lastIndex;\n re.lastIndex += match[0].length;\n } else re.lastIndex = 0;\n } else if (UPDATES_LAST_INDEX_WRONG && match) {\n re.lastIndex = re.global ? match.index + match[0].length : lastIndex;\n }\n if (NPCG_INCLUDED && match && match.length > 1) {\n // Fix browsers whose `exec` methods don't consistently return `undefined`\n // for NPCG, like IE8. NOTE: This doesn' work for /(.?)?/\n nativeReplace.call(match[0], reCopy, function () {\n for (i = 1; i < arguments.length - 2; i++) {\n if (arguments[i] === undefined) match[i] = undefined;\n }\n });\n }\n\n return match;\n };\n}\n\nmodule.exports = patchedExec;\n","'use strict';\nvar $ = require('../internals/export');\nvar exec = require('../internals/regexp-exec');\n\n$({ target: 'RegExp', proto: true, forced: /./.exec !== exec }, {\n exec: exec\n});\n","'use strict';\nvar redefine = require('../internals/redefine');\nvar anObject = require('../internals/an-object');\nvar fails = require('../internals/fails');\nvar flags = require('../internals/regexp-flags');\n\nvar TO_STRING = 'toString';\nvar RegExpPrototype = RegExp.prototype;\nvar nativeToString = RegExpPrototype[TO_STRING];\n\nvar NOT_GENERIC = fails(function () { return nativeToString.call({ source: 'a', flags: 'b' }) != '/a/b'; });\n// FF44- RegExp#toString has a wrong name\nvar INCORRECT_NAME = nativeToString.name != TO_STRING;\n\n// `RegExp.prototype.toString` method\n// https://tc39.github.io/ecma262/#sec-regexp.prototype.tostring\nif (NOT_GENERIC || INCORRECT_NAME) {\n redefine(RegExp.prototype, TO_STRING, function toString() {\n var R = anObject(this);\n var p = String(R.source);\n var rf = R.flags;\n var f = String(rf === undefined && R instanceof RegExp && !('flags' in RegExpPrototype) ? flags.call(R) : rf);\n return '/' + p + '/' + f;\n }, { unsafe: true });\n}\n","var toInteger = require('../internals/to-integer');\nvar requireObjectCoercible = require('../internals/require-object-coercible');\n\n// `String.prototype.{ codePointAt, at }` methods implementation\nvar createMethod = function (CONVERT_TO_STRING) {\n return function ($this, pos) {\n var S = String(requireObjectCoercible($this));\n var position = toInteger(pos);\n var size = S.length;\n var first, second;\n if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;\n first = S.charCodeAt(position);\n return first < 0xD800 || first > 0xDBFF || position + 1 === size\n || (second = S.charCodeAt(position + 1)) < 0xDC00 || second > 0xDFFF\n ? CONVERT_TO_STRING ? S.charAt(position) : first\n : CONVERT_TO_STRING ? S.slice(position, position + 2) : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;\n };\n};\n\nmodule.exports = {\n // `String.prototype.codePointAt` method\n // https://tc39.github.io/ecma262/#sec-string.prototype.codepointat\n codeAt: createMethod(false),\n // `String.prototype.at` method\n // https://github.com/mathiasbynens/String.prototype.at\n charAt: createMethod(true)\n};\n","'use strict';\nvar charAt = require('../internals/string-multibyte').charAt;\nvar InternalStateModule = require('../internals/internal-state');\nvar defineIterator = require('../internals/define-iterator');\n\nvar STRING_ITERATOR = 'String Iterator';\nvar setInternalState = InternalStateModule.set;\nvar getInternalState = InternalStateModule.getterFor(STRING_ITERATOR);\n\n// `String.prototype[@@iterator]` method\n// https://tc39.github.io/ecma262/#sec-string.prototype-@@iterator\ndefineIterator(String, 'String', function (iterated) {\n setInternalState(this, {\n type: STRING_ITERATOR,\n string: String(iterated),\n index: 0\n });\n// `%StringIteratorPrototype%.next` method\n// https://tc39.github.io/ecma262/#sec-%stringiteratorprototype%.next\n}, function next() {\n var state = getInternalState(this);\n var string = state.string;\n var index = state.index;\n var point;\n if (index >= string.length) return { value: undefined, done: true };\n point = charAt(string, index);\n state.index += point.length;\n return { value: point, done: false };\n});\n","'use strict';\n// TODO: Remove from `core-js@4` since it's moved to entry points\nrequire('../modules/es.regexp.exec');\nvar redefine = require('../internals/redefine');\nvar fails = require('../internals/fails');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\nvar regexpExec = require('../internals/regexp-exec');\nvar createNonEnumerableProperty = require('../internals/create-non-enumerable-property');\n\nvar SPECIES = wellKnownSymbol('species');\n\nvar REPLACE_SUPPORTS_NAMED_GROUPS = !fails(function () {\n // #replace needs built-in support for named groups.\n // #match works fine because it just return the exec results, even if it has\n // a \"grops\" property.\n var re = /./;\n re.exec = function () {\n var result = [];\n result.groups = { a: '7' };\n return result;\n };\n return ''.replace(re, '$<a>') !== '7';\n});\n\n// IE <= 11 replaces $0 with the whole match, as if it was $&\n// https://stackoverflow.com/questions/6024666/getting-ie-to-replace-a-regex-with-the-literal-string-0\nvar REPLACE_KEEPS_$0 = (function () {\n return 'a'.replace(/./, '$0') === '$0';\n})();\n\nvar REPLACE = wellKnownSymbol('replace');\n// Safari <= 13.0.3(?) substitutes nth capture where n>m with an empty string\nvar REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE = (function () {\n if (/./[REPLACE]) {\n return /./[REPLACE]('a', '$0') === '';\n }\n return false;\n})();\n\n// Chrome 51 has a buggy \"split\" implementation when RegExp#exec !== nativeExec\n// Weex JS has frozen built-in prototypes, so use try / catch wrapper\nvar SPLIT_WORKS_WITH_OVERWRITTEN_EXEC = !fails(function () {\n var re = /(?:)/;\n var originalExec = re.exec;\n re.exec = function () { return originalExec.apply(this, arguments); };\n var result = 'ab'.split(re);\n return result.length !== 2 || result[0] !== 'a' || result[1] !== 'b';\n});\n\nmodule.exports = function (KEY, length, exec, sham) {\n var SYMBOL = wellKnownSymbol(KEY);\n\n var DELEGATES_TO_SYMBOL = !fails(function () {\n // String methods call symbol-named RegEp methods\n var O = {};\n O[SYMBOL] = function () { return 7; };\n return ''[KEY](O) != 7;\n });\n\n var DELEGATES_TO_EXEC = DELEGATES_TO_SYMBOL && !fails(function () {\n // Symbol-named RegExp methods call .exec\n var execCalled = false;\n var re = /a/;\n\n if (KEY === 'split') {\n // We can't use real regex here since it causes deoptimization\n // and serious performance degradation in V8\n // https://github.com/zloirock/core-js/issues/306\n re = {};\n // RegExp[@@split] doesn't call the regex's exec method, but first creates\n // a new one. We need to return the patched regex when creating the new one.\n re.constructor = {};\n re.constructor[SPECIES] = function () { return re; };\n re.flags = '';\n re[SYMBOL] = /./[SYMBOL];\n }\n\n re.exec = function () { execCalled = true; return null; };\n\n re[SYMBOL]('');\n return !execCalled;\n });\n\n if (\n !DELEGATES_TO_SYMBOL ||\n !DELEGATES_TO_EXEC ||\n (KEY === 'replace' && !(\n REPLACE_SUPPORTS_NAMED_GROUPS &&\n REPLACE_KEEPS_$0 &&\n !REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE\n )) ||\n (KEY === 'split' && !SPLIT_WORKS_WITH_OVERWRITTEN_EXEC)\n ) {\n var nativeRegExpMethod = /./[SYMBOL];\n var methods = exec(SYMBOL, ''[KEY], function (nativeMethod, regexp, str, arg2, forceStringMethod) {\n if (regexp.exec === regexpExec) {\n if (DELEGATES_TO_SYMBOL && !forceStringMethod) {\n // The native String method already delegates to @@method (this\n // polyfilled function), leasing to infinite recursion.\n // We avoid it by directly calling the native @@method method.\n return { done: true, value: nativeRegExpMethod.call(regexp, str, arg2) };\n }\n return { done: true, value: nativeMethod.call(str, regexp, arg2) };\n }\n return { done: false };\n }, {\n REPLACE_KEEPS_$0: REPLACE_KEEPS_$0,\n REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE: REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE\n });\n var stringMethod = methods[0];\n var regexMethod = methods[1];\n\n redefine(String.prototype, KEY, stringMethod);\n redefine(RegExp.prototype, SYMBOL, length == 2\n // 21.2.5.8 RegExp.prototype[@@replace](string, replaceValue)\n // 21.2.5.11 RegExp.prototype[@@split](string, limit)\n ? function (string, arg) { return regexMethod.call(string, this, arg); }\n // 21.2.5.6 RegExp.prototype[@@match](string)\n // 21.2.5.9 RegExp.prototype[@@search](string)\n : function (string) { return regexMethod.call(string, this); }\n );\n }\n\n if (sham) createNonEnumerableProperty(RegExp.prototype[SYMBOL], 'sham', true);\n};\n","'use strict';\nvar charAt = require('../internals/string-multibyte').charAt;\n\n// `AdvanceStringIndex` abstract operation\n// https://tc39.github.io/ecma262/#sec-advancestringindex\nmodule.exports = function (S, index, unicode) {\n return index + (unicode ? charAt(S, index).length : 1);\n};\n","var classof = require('./classof-raw');\nvar regexpExec = require('./regexp-exec');\n\n// `RegExpExec` abstract operation\n// https://tc39.github.io/ecma262/#sec-regexpexec\nmodule.exports = function (R, S) {\n var exec = R.exec;\n if (typeof exec === 'function') {\n var result = exec.call(R, S);\n if (typeof result !== 'object') {\n throw TypeError('RegExp exec method returned something other than an Object or null');\n }\n return result;\n }\n\n if (classof(R) !== 'RegExp') {\n throw TypeError('RegExp#exec called on incompatible receiver');\n }\n\n return regexpExec.call(R, S);\n};\n\n","'use strict';\nvar fixRegExpWellKnownSymbolLogic = require('../internals/fix-regexp-well-known-symbol-logic');\nvar anObject = require('../internals/an-object');\nvar toObject = require('../internals/to-object');\nvar toLength = require('../internals/to-length');\nvar toInteger = require('../internals/to-integer');\nvar requireObjectCoercible = require('../internals/require-object-coercible');\nvar advanceStringIndex = require('../internals/advance-string-index');\nvar regExpExec = require('../internals/regexp-exec-abstract');\n\nvar max = Math.max;\nvar min = Math.min;\nvar floor = Math.floor;\nvar SUBSTITUTION_SYMBOLS = /\\$([$&'`]|\\d\\d?|<[^>]*>)/g;\nvar SUBSTITUTION_SYMBOLS_NO_NAMED = /\\$([$&'`]|\\d\\d?)/g;\n\nvar maybeToString = function (it) {\n return it === undefined ? it : String(it);\n};\n\n// @@replace logic\nfixRegExpWellKnownSymbolLogic('replace', 2, function (REPLACE, nativeReplace, maybeCallNative, reason) {\n var REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE = reason.REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE;\n var REPLACE_KEEPS_$0 = reason.REPLACE_KEEPS_$0;\n var UNSAFE_SUBSTITUTE = REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE ? '$' : '$0';\n\n return [\n // `String.prototype.replace` method\n // https://tc39.github.io/ecma262/#sec-string.prototype.replace\n function replace(searchValue, replaceValue) {\n var O = requireObjectCoercible(this);\n var replacer = searchValue == undefined ? undefined : searchValue[REPLACE];\n return replacer !== undefined\n ? replacer.call(searchValue, O, replaceValue)\n : nativeReplace.call(String(O), searchValue, replaceValue);\n },\n // `RegExp.prototype[@@replace]` method\n // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@replace\n function (regexp, replaceValue) {\n if (\n (!REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE && REPLACE_KEEPS_$0) ||\n (typeof replaceValue === 'string' && replaceValue.indexOf(UNSAFE_SUBSTITUTE) === -1)\n ) {\n var res = maybeCallNative(nativeReplace, regexp, this, replaceValue);\n if (res.done) return res.value;\n }\n\n var rx = anObject(regexp);\n var S = String(this);\n\n var functionalReplace = typeof replaceValue === 'function';\n if (!functionalReplace) replaceValue = String(replaceValue);\n\n var global = rx.global;\n if (global) {\n var fullUnicode = rx.unicode;\n rx.lastIndex = 0;\n }\n var results = [];\n while (true) {\n var result = regExpExec(rx, S);\n if (result === null) break;\n\n results.push(result);\n if (!global) break;\n\n var matchStr = String(result[0]);\n if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);\n }\n\n var accumulatedResult = '';\n var nextSourcePosition = 0;\n for (var i = 0; i < results.length; i++) {\n result = results[i];\n\n var matched = String(result[0]);\n var position = max(min(toInteger(result.index), S.length), 0);\n var captures = [];\n // NOTE: This is equivalent to\n // captures = result.slice(1).map(maybeToString)\n // but for some reason `nativeSlice.call(result, 1, result.length)` (called in\n // the slice polyfill when slicing native arrays) \"doesn't work\" in safari 9 and\n // causes a crash (https://pastebin.com/N21QzeQA) when trying to debug it.\n for (var j = 1; j < result.length; j++) captures.push(maybeToString(result[j]));\n var namedCaptures = result.groups;\n if (functionalReplace) {\n var replacerArgs = [matched].concat(captures, position, S);\n if (namedCaptures !== undefined) replacerArgs.push(namedCaptures);\n var replacement = String(replaceValue.apply(undefined, replacerArgs));\n } else {\n replacement = getSubstitution(matched, S, position, captures, namedCaptures, replaceValue);\n }\n if (position >= nextSourcePosition) {\n accumulatedResult += S.slice(nextSourcePosition, position) + replacement;\n nextSourcePosition = position + matched.length;\n }\n }\n return accumulatedResult + S.slice(nextSourcePosition);\n }\n ];\n\n // https://tc39.github.io/ecma262/#sec-getsubstitution\n function getSubstitution(matched, str, position, captures, namedCaptures, replacement) {\n var tailPos = position + matched.length;\n var m = captures.length;\n var symbols = SUBSTITUTION_SYMBOLS_NO_NAMED;\n if (namedCaptures !== undefined) {\n namedCaptures = toObject(namedCaptures);\n symbols = SUBSTITUTION_SYMBOLS;\n }\n return nativeReplace.call(replacement, symbols, function (match, ch) {\n var capture;\n switch (ch.charAt(0)) {\n case '$': return '$';\n case '&': return matched;\n case '`': return str.slice(0, position);\n case \"'\": return str.slice(tailPos);\n case '<':\n capture = namedCaptures[ch.slice(1, -1)];\n break;\n default: // \\d\\d?\n var n = +ch;\n if (n === 0) return match;\n if (n > m) {\n var f = floor(n / 10);\n if (f === 0) return match;\n if (f <= m) return captures[f - 1] === undefined ? ch.charAt(1) : captures[f - 1] + ch.charAt(1);\n return match;\n }\n capture = captures[n - 1];\n }\n return capture === undefined ? '' : capture;\n });\n }\n});\n","// `SameValue` abstract operation\n// https://tc39.github.io/ecma262/#sec-samevalue\nmodule.exports = Object.is || function is(x, y) {\n // eslint-disable-next-line no-self-compare\n return x === y ? x !== 0 || 1 / x === 1 / y : x != x && y != y;\n};\n","'use strict';\nvar fixRegExpWellKnownSymbolLogic = require('../internals/fix-regexp-well-known-symbol-logic');\nvar anObject = require('../internals/an-object');\nvar requireObjectCoercible = require('../internals/require-object-coercible');\nvar sameValue = require('../internals/same-value');\nvar regExpExec = require('../internals/regexp-exec-abstract');\n\n// @@search logic\nfixRegExpWellKnownSymbolLogic('search', 1, function (SEARCH, nativeSearch, maybeCallNative) {\n return [\n // `String.prototype.search` method\n // https://tc39.github.io/ecma262/#sec-string.prototype.search\n function search(regexp) {\n var O = requireObjectCoercible(this);\n var searcher = regexp == undefined ? undefined : regexp[SEARCH];\n return searcher !== undefined ? searcher.call(regexp, O) : new RegExp(regexp)[SEARCH](String(O));\n },\n // `RegExp.prototype[@@search]` method\n // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@search\n function (regexp) {\n var res = maybeCallNative(nativeSearch, regexp, this);\n if (res.done) return res.value;\n\n var rx = anObject(regexp);\n var S = String(this);\n\n var previousLastIndex = rx.lastIndex;\n if (!sameValue(previousLastIndex, 0)) rx.lastIndex = 0;\n var result = regExpExec(rx, S);\n if (!sameValue(rx.lastIndex, previousLastIndex)) rx.lastIndex = previousLastIndex;\n return result === null ? -1 : result.index;\n }\n ];\n});\n","var isObject = require('../internals/is-object');\nvar classof = require('../internals/classof-raw');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\n\nvar MATCH = wellKnownSymbol('match');\n\n// `IsRegExp` abstract operation\n// https://tc39.github.io/ecma262/#sec-isregexp\nmodule.exports = function (it) {\n var isRegExp;\n return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : classof(it) == 'RegExp');\n};\n","var anObject = require('../internals/an-object');\nvar aFunction = require('../internals/a-function');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\n\nvar SPECIES = wellKnownSymbol('species');\n\n// `SpeciesConstructor` abstract operation\n// https://tc39.github.io/ecma262/#sec-speciesconstructor\nmodule.exports = function (O, defaultConstructor) {\n var C = anObject(O).constructor;\n var S;\n return C === undefined || (S = anObject(C)[SPECIES]) == undefined ? defaultConstructor : aFunction(S);\n};\n","'use strict';\nvar fixRegExpWellKnownSymbolLogic = require('../internals/fix-regexp-well-known-symbol-logic');\nvar isRegExp = require('../internals/is-regexp');\nvar anObject = require('../internals/an-object');\nvar requireObjectCoercible = require('../internals/require-object-coercible');\nvar speciesConstructor = require('../internals/species-constructor');\nvar advanceStringIndex = require('../internals/advance-string-index');\nvar toLength = require('../internals/to-length');\nvar callRegExpExec = require('../internals/regexp-exec-abstract');\nvar regexpExec = require('../internals/regexp-exec');\nvar fails = require('../internals/fails');\n\nvar arrayPush = [].push;\nvar min = Math.min;\nvar MAX_UINT32 = 0xFFFFFFFF;\n\n// babel-minify transpiles RegExp('x', 'y') -> /x/y and it causes SyntaxError\nvar SUPPORTS_Y = !fails(function () { return !RegExp(MAX_UINT32, 'y'); });\n\n// @@split logic\nfixRegExpWellKnownSymbolLogic('split', 2, function (SPLIT, nativeSplit, maybeCallNative) {\n var internalSplit;\n if (\n 'abbc'.split(/(b)*/)[1] == 'c' ||\n 'test'.split(/(?:)/, -1).length != 4 ||\n 'ab'.split(/(?:ab)*/).length != 2 ||\n '.'.split(/(.?)(.?)/).length != 4 ||\n '.'.split(/()()/).length > 1 ||\n ''.split(/.?/).length\n ) {\n // based on es5-shim implementation, need to rework it\n internalSplit = function (separator, limit) {\n var string = String(requireObjectCoercible(this));\n var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;\n if (lim === 0) return [];\n if (separator === undefined) return [string];\n // If `separator` is not a regex, use native split\n if (!isRegExp(separator)) {\n return nativeSplit.call(string, separator, lim);\n }\n var output = [];\n var flags = (separator.ignoreCase ? 'i' : '') +\n (separator.multiline ? 'm' : '') +\n (separator.unicode ? 'u' : '') +\n (separator.sticky ? 'y' : '');\n var lastLastIndex = 0;\n // Make `global` and avoid `lastIndex` issues by working with a copy\n var separatorCopy = new RegExp(separator.source, flags + 'g');\n var match, lastIndex, lastLength;\n while (match = regexpExec.call(separatorCopy, string)) {\n lastIndex = separatorCopy.lastIndex;\n if (lastIndex > lastLastIndex) {\n output.push(string.slice(lastLastIndex, match.index));\n if (match.length > 1 && match.index < string.length) arrayPush.apply(output, match.slice(1));\n lastLength = match[0].length;\n lastLastIndex = lastIndex;\n if (output.length >= lim) break;\n }\n if (separatorCopy.lastIndex === match.index) separatorCopy.lastIndex++; // Avoid an infinite loop\n }\n if (lastLastIndex === string.length) {\n if (lastLength || !separatorCopy.test('')) output.push('');\n } else output.push(string.slice(lastLastIndex));\n return output.length > lim ? output.slice(0, lim) : output;\n };\n // Chakra, V8\n } else if ('0'.split(undefined, 0).length) {\n internalSplit = function (separator, limit) {\n return separator === undefined && limit === 0 ? [] : nativeSplit.call(this, separator, limit);\n };\n } else internalSplit = nativeSplit;\n\n return [\n // `String.prototype.split` method\n // https://tc39.github.io/ecma262/#sec-string.prototype.split\n function split(separator, limit) {\n var O = requireObjectCoercible(this);\n var splitter = separator == undefined ? undefined : separator[SPLIT];\n return splitter !== undefined\n ? splitter.call(separator, O, limit)\n : internalSplit.call(String(O), separator, limit);\n },\n // `RegExp.prototype[@@split]` method\n // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@split\n //\n // NOTE: This cannot be properly polyfilled in engines that don't support\n // the 'y' flag.\n function (regexp, limit) {\n var res = maybeCallNative(internalSplit, regexp, this, limit, internalSplit !== nativeSplit);\n if (res.done) return res.value;\n\n var rx = anObject(regexp);\n var S = String(this);\n var C = speciesConstructor(rx, RegExp);\n\n var unicodeMatching = rx.unicode;\n var flags = (rx.ignoreCase ? 'i' : '') +\n (rx.multiline ? 'm' : '') +\n (rx.unicode ? 'u' : '') +\n (SUPPORTS_Y ? 'y' : 'g');\n\n // ^(? + rx + ) is needed, in combination with some S slicing, to\n // simulate the 'y' flag.\n var splitter = new C(SUPPORTS_Y ? rx : '^(?:' + rx.source + ')', flags);\n var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;\n if (lim === 0) return [];\n if (S.length === 0) return callRegExpExec(splitter, S) === null ? [S] : [];\n var p = 0;\n var q = 0;\n var A = [];\n while (q < S.length) {\n splitter.lastIndex = SUPPORTS_Y ? q : 0;\n var z = callRegExpExec(splitter, SUPPORTS_Y ? S : S.slice(q));\n var e;\n if (\n z === null ||\n (e = min(toLength(splitter.lastIndex + (SUPPORTS_Y ? 0 : q)), S.length)) === p\n ) {\n q = advanceStringIndex(S, q, unicodeMatching);\n } else {\n A.push(S.slice(p, q));\n if (A.length === lim) return A;\n for (var i = 1; i <= z.length - 1; i++) {\n A.push(z[i]);\n if (A.length === lim) return A;\n }\n q = p = e;\n }\n }\n A.push(S.slice(p));\n return A;\n }\n ];\n}, !SUPPORTS_Y);\n","// iterable DOM collections\n// flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods\nmodule.exports = {\n CSSRuleList: 0,\n CSSStyleDeclaration: 0,\n CSSValueList: 0,\n ClientRectList: 0,\n DOMRectList: 0,\n DOMStringList: 0,\n DOMTokenList: 1,\n DataTransferItemList: 0,\n FileList: 0,\n HTMLAllCollection: 0,\n HTMLCollection: 0,\n HTMLFormElement: 0,\n HTMLSelectElement: 0,\n MediaList: 0,\n MimeTypeArray: 0,\n NamedNodeMap: 0,\n NodeList: 1,\n PaintRequestList: 0,\n Plugin: 0,\n PluginArray: 0,\n SVGLengthList: 0,\n SVGNumberList: 0,\n SVGPathSegList: 0,\n SVGPointList: 0,\n SVGStringList: 0,\n SVGTransformList: 0,\n SourceBufferList: 0,\n StyleSheetList: 0,\n TextTrackCueList: 0,\n TextTrackList: 0,\n TouchList: 0\n};\n","var global = require('../internals/global');\nvar DOMIterables = require('../internals/dom-iterables');\nvar forEach = require('../internals/array-for-each');\nvar createNonEnumerableProperty = require('../internals/create-non-enumerable-property');\n\nfor (var COLLECTION_NAME in DOMIterables) {\n var Collection = global[COLLECTION_NAME];\n var CollectionPrototype = Collection && Collection.prototype;\n // some Chrome versions have non-configurable methods on DOMTokenList\n if (CollectionPrototype && CollectionPrototype.forEach !== forEach) try {\n createNonEnumerableProperty(CollectionPrototype, 'forEach', forEach);\n } catch (error) {\n CollectionPrototype.forEach = forEach;\n }\n}\n","var global = require('../internals/global');\nvar DOMIterables = require('../internals/dom-iterables');\nvar ArrayIteratorMethods = require('../modules/es.array.iterator');\nvar createNonEnumerableProperty = require('../internals/create-non-enumerable-property');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\n\nvar ITERATOR = wellKnownSymbol('iterator');\nvar TO_STRING_TAG = wellKnownSymbol('toStringTag');\nvar ArrayValues = ArrayIteratorMethods.values;\n\nfor (var COLLECTION_NAME in DOMIterables) {\n var Collection = global[COLLECTION_NAME];\n var CollectionPrototype = Collection && Collection.prototype;\n if (CollectionPrototype) {\n // some Chrome versions have non-configurable methods on DOMTokenList\n if (CollectionPrototype[ITERATOR] !== ArrayValues) try {\n createNonEnumerableProperty(CollectionPrototype, ITERATOR, ArrayValues);\n } catch (error) {\n CollectionPrototype[ITERATOR] = ArrayValues;\n }\n if (!CollectionPrototype[TO_STRING_TAG]) {\n createNonEnumerableProperty(CollectionPrototype, TO_STRING_TAG, COLLECTION_NAME);\n }\n if (DOMIterables[COLLECTION_NAME]) for (var METHOD_NAME in ArrayIteratorMethods) {\n // some Chrome versions have non-configurable methods on DOMTokenList\n if (CollectionPrototype[METHOD_NAME] !== ArrayIteratorMethods[METHOD_NAME]) try {\n createNonEnumerableProperty(CollectionPrototype, METHOD_NAME, ArrayIteratorMethods[METHOD_NAME]);\n } catch (error) {\n CollectionPrototype[METHOD_NAME] = ArrayIteratorMethods[METHOD_NAME];\n }\n }\n }\n}\n","var fails = require('../internals/fails');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\nvar IS_PURE = require('../internals/is-pure');\n\nvar ITERATOR = wellKnownSymbol('iterator');\n\nmodule.exports = !fails(function () {\n var url = new URL('b?a=1&b=2&c=3', 'http://a');\n var searchParams = url.searchParams;\n var result = '';\n url.pathname = 'c%20d';\n searchParams.forEach(function (value, key) {\n searchParams['delete']('b');\n result += key + value;\n });\n return (IS_PURE && !url.toJSON)\n || !searchParams.sort\n || url.href !== 'http://a/c%20d?a=1&c=3'\n || searchParams.get('c') !== '3'\n || String(new URLSearchParams('?a=1')) !== 'a=1'\n || !searchParams[ITERATOR]\n // throws in Edge\n || new URL('https://a@b').username !== 'a'\n || new URLSearchParams(new URLSearchParams('a=b')).get('a') !== 'b'\n // not punycoded in Edge\n || new URL('http://тест').host !== 'xn--e1aybc'\n // not escaped in Chrome 62-\n || new URL('http://a#б').hash !== '#%D0%B1'\n // fails in Chrome 66-\n || result !== 'a1c3'\n // throws in Safari\n || new URL('http://x', undefined).host !== 'x';\n});\n","module.exports = function (it, Constructor, name) {\n if (!(it instanceof Constructor)) {\n throw TypeError('Incorrect ' + (name ? name + ' ' : '') + 'invocation');\n } return it;\n};\n","'use strict';\nvar DESCRIPTORS = require('../internals/descriptors');\nvar fails = require('../internals/fails');\nvar objectKeys = require('../internals/object-keys');\nvar getOwnPropertySymbolsModule = require('../internals/object-get-own-property-symbols');\nvar propertyIsEnumerableModule = require('../internals/object-property-is-enumerable');\nvar toObject = require('../internals/to-object');\nvar IndexedObject = require('../internals/indexed-object');\n\nvar nativeAssign = Object.assign;\nvar defineProperty = Object.defineProperty;\n\n// `Object.assign` method\n// https://tc39.github.io/ecma262/#sec-object.assign\nmodule.exports = !nativeAssign || fails(function () {\n // should have correct order of operations (Edge bug)\n if (DESCRIPTORS && nativeAssign({ b: 1 }, nativeAssign(defineProperty({}, 'a', {\n enumerable: true,\n get: function () {\n defineProperty(this, 'b', {\n value: 3,\n enumerable: false\n });\n }\n }), { b: 2 })).b !== 1) return true;\n // should work with symbols and should have deterministic property order (V8 bug)\n var A = {};\n var B = {};\n // eslint-disable-next-line no-undef\n var symbol = Symbol();\n var alphabet = 'abcdefghijklmnopqrst';\n A[symbol] = 7;\n alphabet.split('').forEach(function (chr) { B[chr] = chr; });\n return nativeAssign({}, A)[symbol] != 7 || objectKeys(nativeAssign({}, B)).join('') != alphabet;\n}) ? function assign(target, source) { // eslint-disable-line no-unused-vars\n var T = toObject(target);\n var argumentsLength = arguments.length;\n var index = 1;\n var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;\n var propertyIsEnumerable = propertyIsEnumerableModule.f;\n while (argumentsLength > index) {\n var S = IndexedObject(arguments[index++]);\n var keys = getOwnPropertySymbols ? objectKeys(S).concat(getOwnPropertySymbols(S)) : objectKeys(S);\n var length = keys.length;\n var j = 0;\n var key;\n while (length > j) {\n key = keys[j++];\n if (!DESCRIPTORS || propertyIsEnumerable.call(S, key)) T[key] = S[key];\n }\n } return T;\n} : nativeAssign;\n","var anObject = require('../internals/an-object');\n\n// call something on iterator step with safe closing on error\nmodule.exports = function (iterator, fn, value, ENTRIES) {\n try {\n return ENTRIES ? fn(anObject(value)[0], value[1]) : fn(value);\n // 7.4.6 IteratorClose(iterator, completion)\n } catch (error) {\n var returnMethod = iterator['return'];\n if (returnMethod !== undefined) anObject(returnMethod.call(iterator));\n throw error;\n }\n};\n","var wellKnownSymbol = require('../internals/well-known-symbol');\nvar Iterators = require('../internals/iterators');\n\nvar ITERATOR = wellKnownSymbol('iterator');\nvar ArrayPrototype = Array.prototype;\n\n// check on default Array iterator\nmodule.exports = function (it) {\n return it !== undefined && (Iterators.Array === it || ArrayPrototype[ITERATOR] === it);\n};\n","var classof = require('../internals/classof');\nvar Iterators = require('../internals/iterators');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\n\nvar ITERATOR = wellKnownSymbol('iterator');\n\nmodule.exports = function (it) {\n if (it != undefined) return it[ITERATOR]\n || it['@@iterator']\n || Iterators[classof(it)];\n};\n","'use strict';\nvar bind = require('../internals/function-bind-context');\nvar toObject = require('../internals/to-object');\nvar callWithSafeIterationClosing = require('../internals/call-with-safe-iteration-closing');\nvar isArrayIteratorMethod = require('../internals/is-array-iterator-method');\nvar toLength = require('../internals/to-length');\nvar createProperty = require('../internals/create-property');\nvar getIteratorMethod = require('../internals/get-iterator-method');\n\n// `Array.from` method implementation\n// https://tc39.github.io/ecma262/#sec-array.from\nmodule.exports = function from(arrayLike /* , mapfn = undefined, thisArg = undefined */) {\n var O = toObject(arrayLike);\n var C = typeof this == 'function' ? this : Array;\n var argumentsLength = arguments.length;\n var mapfn = argumentsLength > 1 ? arguments[1] : undefined;\n var mapping = mapfn !== undefined;\n var iteratorMethod = getIteratorMethod(O);\n var index = 0;\n var length, result, step, iterator, next, value;\n if (mapping) mapfn = bind(mapfn, argumentsLength > 2 ? arguments[2] : undefined, 2);\n // if the target is not iterable or it's an array with the default iterator - use a simple case\n if (iteratorMethod != undefined && !(C == Array && isArrayIteratorMethod(iteratorMethod))) {\n iterator = iteratorMethod.call(O);\n next = iterator.next;\n result = new C();\n for (;!(step = next.call(iterator)).done; index++) {\n value = mapping ? callWithSafeIterationClosing(iterator, mapfn, [step.value, index], true) : step.value;\n createProperty(result, index, value);\n }\n } else {\n length = toLength(O.length);\n result = new C(length);\n for (;length > index; index++) {\n value = mapping ? mapfn(O[index], index) : O[index];\n createProperty(result, index, value);\n }\n }\n result.length = index;\n return result;\n};\n","'use strict';\n// based on https://github.com/bestiejs/punycode.js/blob/master/punycode.js\nvar maxInt = 2147483647; // aka. 0x7FFFFFFF or 2^31-1\nvar base = 36;\nvar tMin = 1;\nvar tMax = 26;\nvar skew = 38;\nvar damp = 700;\nvar initialBias = 72;\nvar initialN = 128; // 0x80\nvar delimiter = '-'; // '\\x2D'\nvar regexNonASCII = /[^\\0-\\u007E]/; // non-ASCII chars\nvar regexSeparators = /[.\\u3002\\uFF0E\\uFF61]/g; // RFC 3490 separators\nvar OVERFLOW_ERROR = 'Overflow: input needs wider integers to process';\nvar baseMinusTMin = base - tMin;\nvar floor = Math.floor;\nvar stringFromCharCode = String.fromCharCode;\n\n/**\n * Creates an array containing the numeric code points of each Unicode\n * character in the string. While JavaScript uses UCS-2 internally,\n * this function will convert a pair of surrogate halves (each of which\n * UCS-2 exposes as separate characters) into a single code point,\n * matching UTF-16.\n */\nvar ucs2decode = function (string) {\n var output = [];\n var counter = 0;\n var length = string.length;\n while (counter < length) {\n var value = string.charCodeAt(counter++);\n if (value >= 0xD800 && value <= 0xDBFF && counter < length) {\n // It's a high surrogate, and there is a next character.\n var extra = string.charCodeAt(counter++);\n if ((extra & 0xFC00) == 0xDC00) { // Low surrogate.\n output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);\n } else {\n // It's an unmatched surrogate; only append this code unit, in case the\n // next code unit is the high surrogate of a surrogate pair.\n output.push(value);\n counter--;\n }\n } else {\n output.push(value);\n }\n }\n return output;\n};\n\n/**\n * Converts a digit/integer into a basic code point.\n */\nvar digitToBasic = function (digit) {\n // 0..25 map to ASCII a..z or A..Z\n // 26..35 map to ASCII 0..9\n return digit + 22 + 75 * (digit < 26);\n};\n\n/**\n * Bias adaptation function as per section 3.4 of RFC 3492.\n * https://tools.ietf.org/html/rfc3492#section-3.4\n */\nvar adapt = function (delta, numPoints, firstTime) {\n var k = 0;\n delta = firstTime ? floor(delta / damp) : delta >> 1;\n delta += floor(delta / numPoints);\n for (; delta > baseMinusTMin * tMax >> 1; k += base) {\n delta = floor(delta / baseMinusTMin);\n }\n return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));\n};\n\n/**\n * Converts a string of Unicode symbols (e.g. a domain name label) to a\n * Punycode string of ASCII-only symbols.\n */\n// eslint-disable-next-line max-statements\nvar encode = function (input) {\n var output = [];\n\n // Convert the input in UCS-2 to an array of Unicode code points.\n input = ucs2decode(input);\n\n // Cache the length.\n var inputLength = input.length;\n\n // Initialize the state.\n var n = initialN;\n var delta = 0;\n var bias = initialBias;\n var i, currentValue;\n\n // Handle the basic code points.\n for (i = 0; i < input.length; i++) {\n currentValue = input[i];\n if (currentValue < 0x80) {\n output.push(stringFromCharCode(currentValue));\n }\n }\n\n var basicLength = output.length; // number of basic code points.\n var handledCPCount = basicLength; // number of code points that have been handled;\n\n // Finish the basic string with a delimiter unless it's empty.\n if (basicLength) {\n output.push(delimiter);\n }\n\n // Main encoding loop:\n while (handledCPCount < inputLength) {\n // All non-basic code points < n have been handled already. Find the next larger one:\n var m = maxInt;\n for (i = 0; i < input.length; i++) {\n currentValue = input[i];\n if (currentValue >= n && currentValue < m) {\n m = currentValue;\n }\n }\n\n // Increase `delta` enough to advance the decoder's <n,i> state to <m,0>, but guard against overflow.\n var handledCPCountPlusOne = handledCPCount + 1;\n if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {\n throw RangeError(OVERFLOW_ERROR);\n }\n\n delta += (m - n) * handledCPCountPlusOne;\n n = m;\n\n for (i = 0; i < input.length; i++) {\n currentValue = input[i];\n if (currentValue < n && ++delta > maxInt) {\n throw RangeError(OVERFLOW_ERROR);\n }\n if (currentValue == n) {\n // Represent delta as a generalized variable-length integer.\n var q = delta;\n for (var k = base; /* no condition */; k += base) {\n var t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);\n if (q < t) break;\n var qMinusT = q - t;\n var baseMinusT = base - t;\n output.push(stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT)));\n q = floor(qMinusT / baseMinusT);\n }\n\n output.push(stringFromCharCode(digitToBasic(q)));\n bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);\n delta = 0;\n ++handledCPCount;\n }\n }\n\n ++delta;\n ++n;\n }\n return output.join('');\n};\n\nmodule.exports = function (input) {\n var encoded = [];\n var labels = input.toLowerCase().replace(regexSeparators, '\\u002E').split('.');\n var i, label;\n for (i = 0; i < labels.length; i++) {\n label = labels[i];\n encoded.push(regexNonASCII.test(label) ? 'xn--' + encode(label) : label);\n }\n return encoded.join('.');\n};\n","var redefine = require('../internals/redefine');\n\nmodule.exports = function (target, src, options) {\n for (var key in src) redefine(target, key, src[key], options);\n return target;\n};\n","var anObject = require('../internals/an-object');\nvar getIteratorMethod = require('../internals/get-iterator-method');\n\nmodule.exports = function (it) {\n var iteratorMethod = getIteratorMethod(it);\n if (typeof iteratorMethod != 'function') {\n throw TypeError(String(it) + ' is not iterable');\n } return anObject(iteratorMethod.call(it));\n};\n","'use strict';\n// TODO: in core-js@4, move /modules/ dependencies to public entries for better optimization by tools like `preset-env`\nrequire('../modules/es.array.iterator');\nvar $ = require('../internals/export');\nvar getBuiltIn = require('../internals/get-built-in');\nvar USE_NATIVE_URL = require('../internals/native-url');\nvar redefine = require('../internals/redefine');\nvar redefineAll = require('../internals/redefine-all');\nvar setToStringTag = require('../internals/set-to-string-tag');\nvar createIteratorConstructor = require('../internals/create-iterator-constructor');\nvar InternalStateModule = require('../internals/internal-state');\nvar anInstance = require('../internals/an-instance');\nvar hasOwn = require('../internals/has');\nvar bind = require('../internals/function-bind-context');\nvar classof = require('../internals/classof');\nvar anObject = require('../internals/an-object');\nvar isObject = require('../internals/is-object');\nvar create = require('../internals/object-create');\nvar createPropertyDescriptor = require('../internals/create-property-descriptor');\nvar getIterator = require('../internals/get-iterator');\nvar getIteratorMethod = require('../internals/get-iterator-method');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\n\nvar $fetch = getBuiltIn('fetch');\nvar Headers = getBuiltIn('Headers');\nvar ITERATOR = wellKnownSymbol('iterator');\nvar URL_SEARCH_PARAMS = 'URLSearchParams';\nvar URL_SEARCH_PARAMS_ITERATOR = URL_SEARCH_PARAMS + 'Iterator';\nvar setInternalState = InternalStateModule.set;\nvar getInternalParamsState = InternalStateModule.getterFor(URL_SEARCH_PARAMS);\nvar getInternalIteratorState = InternalStateModule.getterFor(URL_SEARCH_PARAMS_ITERATOR);\n\nvar plus = /\\+/g;\nvar sequences = Array(4);\n\nvar percentSequence = function (bytes) {\n return sequences[bytes - 1] || (sequences[bytes - 1] = RegExp('((?:%[\\\\da-f]{2}){' + bytes + '})', 'gi'));\n};\n\nvar percentDecode = function (sequence) {\n try {\n return decodeURIComponent(sequence);\n } catch (error) {\n return sequence;\n }\n};\n\nvar deserialize = function (it) {\n var result = it.replace(plus, ' ');\n var bytes = 4;\n try {\n return decodeURIComponent(result);\n } catch (error) {\n while (bytes) {\n result = result.replace(percentSequence(bytes--), percentDecode);\n }\n return result;\n }\n};\n\nvar find = /[!'()~]|%20/g;\n\nvar replace = {\n '!': '%21',\n \"'\": '%27',\n '(': '%28',\n ')': '%29',\n '~': '%7E',\n '%20': '+'\n};\n\nvar replacer = function (match) {\n return replace[match];\n};\n\nvar serialize = function (it) {\n return encodeURIComponent(it).replace(find, replacer);\n};\n\nvar parseSearchParams = function (result, query) {\n if (query) {\n var attributes = query.split('&');\n var index = 0;\n var attribute, entry;\n while (index < attributes.length) {\n attribute = attributes[index++];\n if (attribute.length) {\n entry = attribute.split('=');\n result.push({\n key: deserialize(entry.shift()),\n value: deserialize(entry.join('='))\n });\n }\n }\n }\n};\n\nvar updateSearchParams = function (query) {\n this.entries.length = 0;\n parseSearchParams(this.entries, query);\n};\n\nvar validateArgumentsLength = function (passed, required) {\n if (passed < required) throw TypeError('Not enough arguments');\n};\n\nvar URLSearchParamsIterator = createIteratorConstructor(function Iterator(params, kind) {\n setInternalState(this, {\n type: URL_SEARCH_PARAMS_ITERATOR,\n iterator: getIterator(getInternalParamsState(params).entries),\n kind: kind\n });\n}, 'Iterator', function next() {\n var state = getInternalIteratorState(this);\n var kind = state.kind;\n var step = state.iterator.next();\n var entry = step.value;\n if (!step.done) {\n step.value = kind === 'keys' ? entry.key : kind === 'values' ? entry.value : [entry.key, entry.value];\n } return step;\n});\n\n// `URLSearchParams` constructor\n// https://url.spec.whatwg.org/#interface-urlsearchparams\nvar URLSearchParamsConstructor = function URLSearchParams(/* init */) {\n anInstance(this, URLSearchParamsConstructor, URL_SEARCH_PARAMS);\n var init = arguments.length > 0 ? arguments[0] : undefined;\n var that = this;\n var entries = [];\n var iteratorMethod, iterator, next, step, entryIterator, entryNext, first, second, key;\n\n setInternalState(that, {\n type: URL_SEARCH_PARAMS,\n entries: entries,\n updateURL: function () { /* empty */ },\n updateSearchParams: updateSearchParams\n });\n\n if (init !== undefined) {\n if (isObject(init)) {\n iteratorMethod = getIteratorMethod(init);\n if (typeof iteratorMethod === 'function') {\n iterator = iteratorMethod.call(init);\n next = iterator.next;\n while (!(step = next.call(iterator)).done) {\n entryIterator = getIterator(anObject(step.value));\n entryNext = entryIterator.next;\n if (\n (first = entryNext.call(entryIterator)).done ||\n (second = entryNext.call(entryIterator)).done ||\n !entryNext.call(entryIterator).done\n ) throw TypeError('Expected sequence with length 2');\n entries.push({ key: first.value + '', value: second.value + '' });\n }\n } else for (key in init) if (hasOwn(init, key)) entries.push({ key: key, value: init[key] + '' });\n } else {\n parseSearchParams(entries, typeof init === 'string' ? init.charAt(0) === '?' ? init.slice(1) : init : init + '');\n }\n }\n};\n\nvar URLSearchParamsPrototype = URLSearchParamsConstructor.prototype;\n\nredefineAll(URLSearchParamsPrototype, {\n // `URLSearchParams.prototype.appent` method\n // https://url.spec.whatwg.org/#dom-urlsearchparams-append\n append: function append(name, value) {\n validateArgumentsLength(arguments.length, 2);\n var state = getInternalParamsState(this);\n state.entries.push({ key: name + '', value: value + '' });\n state.updateURL();\n },\n // `URLSearchParams.prototype.delete` method\n // https://url.spec.whatwg.org/#dom-urlsearchparams-delete\n 'delete': function (name) {\n validateArgumentsLength(arguments.length, 1);\n var state = getInternalParamsState(this);\n var entries = state.entries;\n var key = name + '';\n var index = 0;\n while (index < entries.length) {\n if (entries[index].key === key) entries.splice(index, 1);\n else index++;\n }\n state.updateURL();\n },\n // `URLSearchParams.prototype.get` method\n // https://url.spec.whatwg.org/#dom-urlsearchparams-get\n get: function get(name) {\n validateArgumentsLength(arguments.length, 1);\n var entries = getInternalParamsState(this).entries;\n var key = name + '';\n var index = 0;\n for (; index < entries.length; index++) {\n if (entries[index].key === key) return entries[index].value;\n }\n return null;\n },\n // `URLSearchParams.prototype.getAll` method\n // https://url.spec.whatwg.org/#dom-urlsearchparams-getall\n getAll: function getAll(name) {\n validateArgumentsLength(arguments.length, 1);\n var entries = getInternalParamsState(this).entries;\n var key = name + '';\n var result = [];\n var index = 0;\n for (; index < entries.length; index++) {\n if (entries[index].key === key) result.push(entries[index].value);\n }\n return result;\n },\n // `URLSearchParams.prototype.has` method\n // https://url.spec.whatwg.org/#dom-urlsearchparams-has\n has: function has(name) {\n validateArgumentsLength(arguments.length, 1);\n var entries = getInternalParamsState(this).entries;\n var key = name + '';\n var index = 0;\n while (index < entries.length) {\n if (entries[index++].key === key) return true;\n }\n return false;\n },\n // `URLSearchParams.prototype.set` method\n // https://url.spec.whatwg.org/#dom-urlsearchparams-set\n set: function set(name, value) {\n validateArgumentsLength(arguments.length, 1);\n var state = getInternalParamsState(this);\n var entries = state.entries;\n var found = false;\n var key = name + '';\n var val = value + '';\n var index = 0;\n var entry;\n for (; index < entries.length; index++) {\n entry = entries[index];\n if (entry.key === key) {\n if (found) entries.splice(index--, 1);\n else {\n found = true;\n entry.value = val;\n }\n }\n }\n if (!found) entries.push({ key: key, value: val });\n state.updateURL();\n },\n // `URLSearchParams.prototype.sort` method\n // https://url.spec.whatwg.org/#dom-urlsearchparams-sort\n sort: function sort() {\n var state = getInternalParamsState(this);\n var entries = state.entries;\n // Array#sort is not stable in some engines\n var slice = entries.slice();\n var entry, entriesIndex, sliceIndex;\n entries.length = 0;\n for (sliceIndex = 0; sliceIndex < slice.length; sliceIndex++) {\n entry = slice[sliceIndex];\n for (entriesIndex = 0; entriesIndex < sliceIndex; entriesIndex++) {\n if (entries[entriesIndex].key > entry.key) {\n entries.splice(entriesIndex, 0, entry);\n break;\n }\n }\n if (entriesIndex === sliceIndex) entries.push(entry);\n }\n state.updateURL();\n },\n // `URLSearchParams.prototype.forEach` method\n forEach: function forEach(callback /* , thisArg */) {\n var entries = getInternalParamsState(this).entries;\n var boundFunction = bind(callback, arguments.length > 1 ? arguments[1] : undefined, 3);\n var index = 0;\n var entry;\n while (index < entries.length) {\n entry = entries[index++];\n boundFunction(entry.value, entry.key, this);\n }\n },\n // `URLSearchParams.prototype.keys` method\n keys: function keys() {\n return new URLSearchParamsIterator(this, 'keys');\n },\n // `URLSearchParams.prototype.values` method\n values: function values() {\n return new URLSearchParamsIterator(this, 'values');\n },\n // `URLSearchParams.prototype.entries` method\n entries: function entries() {\n return new URLSearchParamsIterator(this, 'entries');\n }\n}, { enumerable: true });\n\n// `URLSearchParams.prototype[@@iterator]` method\nredefine(URLSearchParamsPrototype, ITERATOR, URLSearchParamsPrototype.entries);\n\n// `URLSearchParams.prototype.toString` method\n// https://url.spec.whatwg.org/#urlsearchparams-stringification-behavior\nredefine(URLSearchParamsPrototype, 'toString', function toString() {\n var entries = getInternalParamsState(this).entries;\n var result = [];\n var index = 0;\n var entry;\n while (index < entries.length) {\n entry = entries[index++];\n result.push(serialize(entry.key) + '=' + serialize(entry.value));\n } return result.join('&');\n}, { enumerable: true });\n\nsetToStringTag(URLSearchParamsConstructor, URL_SEARCH_PARAMS);\n\n$({ global: true, forced: !USE_NATIVE_URL }, {\n URLSearchParams: URLSearchParamsConstructor\n});\n\n// Wrap `fetch` for correct work with polyfilled `URLSearchParams`\n// https://github.com/zloirock/core-js/issues/674\nif (!USE_NATIVE_URL && typeof $fetch == 'function' && typeof Headers == 'function') {\n $({ global: true, enumerable: true, forced: true }, {\n fetch: function fetch(input /* , init */) {\n var args = [input];\n var init, body, headers;\n if (arguments.length > 1) {\n init = arguments[1];\n if (isObject(init)) {\n body = init.body;\n if (classof(body) === URL_SEARCH_PARAMS) {\n headers = init.headers ? new Headers(init.headers) : new Headers();\n if (!headers.has('content-type')) {\n headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8');\n }\n init = create(init, {\n body: createPropertyDescriptor(0, String(body)),\n headers: createPropertyDescriptor(0, headers)\n });\n }\n }\n args.push(init);\n } return $fetch.apply(this, args);\n }\n });\n}\n\nmodule.exports = {\n URLSearchParams: URLSearchParamsConstructor,\n getState: getInternalParamsState\n};\n","'use strict';\n// TODO: in core-js@4, move /modules/ dependencies to public entries for better optimization by tools like `preset-env`\nrequire('../modules/es.string.iterator');\nvar $ = require('../internals/export');\nvar DESCRIPTORS = require('../internals/descriptors');\nvar USE_NATIVE_URL = require('../internals/native-url');\nvar global = require('../internals/global');\nvar defineProperties = require('../internals/object-define-properties');\nvar redefine = require('../internals/redefine');\nvar anInstance = require('../internals/an-instance');\nvar has = require('../internals/has');\nvar assign = require('../internals/object-assign');\nvar arrayFrom = require('../internals/array-from');\nvar codeAt = require('../internals/string-multibyte').codeAt;\nvar toASCII = require('../internals/string-punycode-to-ascii');\nvar setToStringTag = require('../internals/set-to-string-tag');\nvar URLSearchParamsModule = require('../modules/web.url-search-params');\nvar InternalStateModule = require('../internals/internal-state');\n\nvar NativeURL = global.URL;\nvar URLSearchParams = URLSearchParamsModule.URLSearchParams;\nvar getInternalSearchParamsState = URLSearchParamsModule.getState;\nvar setInternalState = InternalStateModule.set;\nvar getInternalURLState = InternalStateModule.getterFor('URL');\nvar floor = Math.floor;\nvar pow = Math.pow;\n\nvar INVALID_AUTHORITY = 'Invalid authority';\nvar INVALID_SCHEME = 'Invalid scheme';\nvar INVALID_HOST = 'Invalid host';\nvar INVALID_PORT = 'Invalid port';\n\nvar ALPHA = /[A-Za-z]/;\nvar ALPHANUMERIC = /[\\d+-.A-Za-z]/;\nvar DIGIT = /\\d/;\nvar HEX_START = /^(0x|0X)/;\nvar OCT = /^[0-7]+$/;\nvar DEC = /^\\d+$/;\nvar HEX = /^[\\dA-Fa-f]+$/;\n// eslint-disable-next-line no-control-regex\nvar FORBIDDEN_HOST_CODE_POINT = /[\\u0000\\u0009\\u000A\\u000D #%/:?@[\\\\]]/;\n// eslint-disable-next-line no-control-regex\nvar FORBIDDEN_HOST_CODE_POINT_EXCLUDING_PERCENT = /[\\u0000\\u0009\\u000A\\u000D #/:?@[\\\\]]/;\n// eslint-disable-next-line no-control-regex\nvar LEADING_AND_TRAILING_C0_CONTROL_OR_SPACE = /^[\\u0000-\\u001F ]+|[\\u0000-\\u001F ]+$/g;\n// eslint-disable-next-line no-control-regex\nvar TAB_AND_NEW_LINE = /[\\u0009\\u000A\\u000D]/g;\nvar EOF;\n\nvar parseHost = function (url, input) {\n var result, codePoints, index;\n if (input.charAt(0) == '[') {\n if (input.charAt(input.length - 1) != ']') return INVALID_HOST;\n result = parseIPv6(input.slice(1, -1));\n if (!result) return INVALID_HOST;\n url.host = result;\n // opaque host\n } else if (!isSpecial(url)) {\n if (FORBIDDEN_HOST_CODE_POINT_EXCLUDING_PERCENT.test(input)) return INVALID_HOST;\n result = '';\n codePoints = arrayFrom(input);\n for (index = 0; index < codePoints.length; index++) {\n result += percentEncode(codePoints[index], C0ControlPercentEncodeSet);\n }\n url.host = result;\n } else {\n input = toASCII(input);\n if (FORBIDDEN_HOST_CODE_POINT.test(input)) return INVALID_HOST;\n result = parseIPv4(input);\n if (result === null) return INVALID_HOST;\n url.host = result;\n }\n};\n\nvar parseIPv4 = function (input) {\n var parts = input.split('.');\n var partsLength, numbers, index, part, radix, number, ipv4;\n if (parts.length && parts[parts.length - 1] == '') {\n parts.pop();\n }\n partsLength = parts.length;\n if (partsLength > 4) return input;\n numbers = [];\n for (index = 0; index < partsLength; index++) {\n part = parts[index];\n if (part == '') return input;\n radix = 10;\n if (part.length > 1 && part.charAt(0) == '0') {\n radix = HEX_START.test(part) ? 16 : 8;\n part = part.slice(radix == 8 ? 1 : 2);\n }\n if (part === '') {\n number = 0;\n } else {\n if (!(radix == 10 ? DEC : radix == 8 ? OCT : HEX).test(part)) return input;\n number = parseInt(part, radix);\n }\n numbers.push(number);\n }\n for (index = 0; index < partsLength; index++) {\n number = numbers[index];\n if (index == partsLength - 1) {\n if (number >= pow(256, 5 - partsLength)) return null;\n } else if (number > 255) return null;\n }\n ipv4 = numbers.pop();\n for (index = 0; index < numbers.length; index++) {\n ipv4 += numbers[index] * pow(256, 3 - index);\n }\n return ipv4;\n};\n\n// eslint-disable-next-line max-statements\nvar parseIPv6 = function (input) {\n var address = [0, 0, 0, 0, 0, 0, 0, 0];\n var pieceIndex = 0;\n var compress = null;\n var pointer = 0;\n var value, length, numbersSeen, ipv4Piece, number, swaps, swap;\n\n var char = function () {\n return input.charAt(pointer);\n };\n\n if (char() == ':') {\n if (input.charAt(1) != ':') return;\n pointer += 2;\n pieceIndex++;\n compress = pieceIndex;\n }\n while (char()) {\n if (pieceIndex == 8) return;\n if (char() == ':') {\n if (compress !== null) return;\n pointer++;\n pieceIndex++;\n compress = pieceIndex;\n continue;\n }\n value = length = 0;\n while (length < 4 && HEX.test(char())) {\n value = value * 16 + parseInt(char(), 16);\n pointer++;\n length++;\n }\n if (char() == '.') {\n if (length == 0) return;\n pointer -= length;\n if (pieceIndex > 6) return;\n numbersSeen = 0;\n while (char()) {\n ipv4Piece = null;\n if (numbersSeen > 0) {\n if (char() == '.' && numbersSeen < 4) pointer++;\n else return;\n }\n if (!DIGIT.test(char())) return;\n while (DIGIT.test(char())) {\n number = parseInt(char(), 10);\n if (ipv4Piece === null) ipv4Piece = number;\n else if (ipv4Piece == 0) return;\n else ipv4Piece = ipv4Piece * 10 + number;\n if (ipv4Piece > 255) return;\n pointer++;\n }\n address[pieceIndex] = address[pieceIndex] * 256 + ipv4Piece;\n numbersSeen++;\n if (numbersSeen == 2 || numbersSeen == 4) pieceIndex++;\n }\n if (numbersSeen != 4) return;\n break;\n } else if (char() == ':') {\n pointer++;\n if (!char()) return;\n } else if (char()) return;\n address[pieceIndex++] = value;\n }\n if (compress !== null) {\n swaps = pieceIndex - compress;\n pieceIndex = 7;\n while (pieceIndex != 0 && swaps > 0) {\n swap = address[pieceIndex];\n address[pieceIndex--] = address[compress + swaps - 1];\n address[compress + --swaps] = swap;\n }\n } else if (pieceIndex != 8) return;\n return address;\n};\n\nvar findLongestZeroSequence = function (ipv6) {\n var maxIndex = null;\n var maxLength = 1;\n var currStart = null;\n var currLength = 0;\n var index = 0;\n for (; index < 8; index++) {\n if (ipv6[index] !== 0) {\n if (currLength > maxLength) {\n maxIndex = currStart;\n maxLength = currLength;\n }\n currStart = null;\n currLength = 0;\n } else {\n if (currStart === null) currStart = index;\n ++currLength;\n }\n }\n if (currLength > maxLength) {\n maxIndex = currStart;\n maxLength = currLength;\n }\n return maxIndex;\n};\n\nvar serializeHost = function (host) {\n var result, index, compress, ignore0;\n // ipv4\n if (typeof host == 'number') {\n result = [];\n for (index = 0; index < 4; index++) {\n result.unshift(host % 256);\n host = floor(host / 256);\n } return result.join('.');\n // ipv6\n } else if (typeof host == 'object') {\n result = '';\n compress = findLongestZeroSequence(host);\n for (index = 0; index < 8; index++) {\n if (ignore0 && host[index] === 0) continue;\n if (ignore0) ignore0 = false;\n if (compress === index) {\n result += index ? ':' : '::';\n ignore0 = true;\n } else {\n result += host[index].toString(16);\n if (index < 7) result += ':';\n }\n }\n return '[' + result + ']';\n } return host;\n};\n\nvar C0ControlPercentEncodeSet = {};\nvar fragmentPercentEncodeSet = assign({}, C0ControlPercentEncodeSet, {\n ' ': 1, '\"': 1, '<': 1, '>': 1, '`': 1\n});\nvar pathPercentEncodeSet = assign({}, fragmentPercentEncodeSet, {\n '#': 1, '?': 1, '{': 1, '}': 1\n});\nvar userinfoPercentEncodeSet = assign({}, pathPercentEncodeSet, {\n '/': 1, ':': 1, ';': 1, '=': 1, '@': 1, '[': 1, '\\\\': 1, ']': 1, '^': 1, '|': 1\n});\n\nvar percentEncode = function (char, set) {\n var code = codeAt(char, 0);\n return code > 0x20 && code < 0x7F && !has(set, char) ? char : encodeURIComponent(char);\n};\n\nvar specialSchemes = {\n ftp: 21,\n file: null,\n http: 80,\n https: 443,\n ws: 80,\n wss: 443\n};\n\nvar isSpecial = function (url) {\n return has(specialSchemes, url.scheme);\n};\n\nvar includesCredentials = function (url) {\n return url.username != '' || url.password != '';\n};\n\nvar cannotHaveUsernamePasswordPort = function (url) {\n return !url.host || url.cannotBeABaseURL || url.scheme == 'file';\n};\n\nvar isWindowsDriveLetter = function (string, normalized) {\n var second;\n return string.length == 2 && ALPHA.test(string.charAt(0))\n && ((second = string.charAt(1)) == ':' || (!normalized && second == '|'));\n};\n\nvar startsWithWindowsDriveLetter = function (string) {\n var third;\n return string.length > 1 && isWindowsDriveLetter(string.slice(0, 2)) && (\n string.length == 2 ||\n ((third = string.charAt(2)) === '/' || third === '\\\\' || third === '?' || third === '#')\n );\n};\n\nvar shortenURLsPath = function (url) {\n var path = url.path;\n var pathSize = path.length;\n if (pathSize && (url.scheme != 'file' || pathSize != 1 || !isWindowsDriveLetter(path[0], true))) {\n path.pop();\n }\n};\n\nvar isSingleDot = function (segment) {\n return segment === '.' || segment.toLowerCase() === '%2e';\n};\n\nvar isDoubleDot = function (segment) {\n segment = segment.toLowerCase();\n return segment === '..' || segment === '%2e.' || segment === '.%2e' || segment === '%2e%2e';\n};\n\n// States:\nvar SCHEME_START = {};\nvar SCHEME = {};\nvar NO_SCHEME = {};\nvar SPECIAL_RELATIVE_OR_AUTHORITY = {};\nvar PATH_OR_AUTHORITY = {};\nvar RELATIVE = {};\nvar RELATIVE_SLASH = {};\nvar SPECIAL_AUTHORITY_SLASHES = {};\nvar SPECIAL_AUTHORITY_IGNORE_SLASHES = {};\nvar AUTHORITY = {};\nvar HOST = {};\nvar HOSTNAME = {};\nvar PORT = {};\nvar FILE = {};\nvar FILE_SLASH = {};\nvar FILE_HOST = {};\nvar PATH_START = {};\nvar PATH = {};\nvar CANNOT_BE_A_BASE_URL_PATH = {};\nvar QUERY = {};\nvar FRAGMENT = {};\n\n// eslint-disable-next-line max-statements\nvar parseURL = function (url, input, stateOverride, base) {\n var state = stateOverride || SCHEME_START;\n var pointer = 0;\n var buffer = '';\n var seenAt = false;\n var seenBracket = false;\n var seenPasswordToken = false;\n var codePoints, char, bufferCodePoints, failure;\n\n if (!stateOverride) {\n url.scheme = '';\n url.username = '';\n url.password = '';\n url.host = null;\n url.port = null;\n url.path = [];\n url.query = null;\n url.fragment = null;\n url.cannotBeABaseURL = false;\n input = input.replace(LEADING_AND_TRAILING_C0_CONTROL_OR_SPACE, '');\n }\n\n input = input.replace(TAB_AND_NEW_LINE, '');\n\n codePoints = arrayFrom(input);\n\n while (pointer <= codePoints.length) {\n char = codePoints[pointer];\n switch (state) {\n case SCHEME_START:\n if (char && ALPHA.test(char)) {\n buffer += char.toLowerCase();\n state = SCHEME;\n } else if (!stateOverride) {\n state = NO_SCHEME;\n continue;\n } else return INVALID_SCHEME;\n break;\n\n case SCHEME:\n if (char && (ALPHANUMERIC.test(char) || char == '+' || char == '-' || char == '.')) {\n buffer += char.toLowerCase();\n } else if (char == ':') {\n if (stateOverride && (\n (isSpecial(url) != has(specialSchemes, buffer)) ||\n (buffer == 'file' && (includesCredentials(url) || url.port !== null)) ||\n (url.scheme == 'file' && !url.host)\n )) return;\n url.scheme = buffer;\n if (stateOverride) {\n if (isSpecial(url) && specialSchemes[url.scheme] == url.port) url.port = null;\n return;\n }\n buffer = '';\n if (url.scheme == 'file') {\n state = FILE;\n } else if (isSpecial(url) && base && base.scheme == url.scheme) {\n state = SPECIAL_RELATIVE_OR_AUTHORITY;\n } else if (isSpecial(url)) {\n state = SPECIAL_AUTHORITY_SLASHES;\n } else if (codePoints[pointer + 1] == '/') {\n state = PATH_OR_AUTHORITY;\n pointer++;\n } else {\n url.cannotBeABaseURL = true;\n url.path.push('');\n state = CANNOT_BE_A_BASE_URL_PATH;\n }\n } else if (!stateOverride) {\n buffer = '';\n state = NO_SCHEME;\n pointer = 0;\n continue;\n } else return INVALID_SCHEME;\n break;\n\n case NO_SCHEME:\n if (!base || (base.cannotBeABaseURL && char != '#')) return INVALID_SCHEME;\n if (base.cannotBeABaseURL && char == '#') {\n url.scheme = base.scheme;\n url.path = base.path.slice();\n url.query = base.query;\n url.fragment = '';\n url.cannotBeABaseURL = true;\n state = FRAGMENT;\n break;\n }\n state = base.scheme == 'file' ? FILE : RELATIVE;\n continue;\n\n case SPECIAL_RELATIVE_OR_AUTHORITY:\n if (char == '/' && codePoints[pointer + 1] == '/') {\n state = SPECIAL_AUTHORITY_IGNORE_SLASHES;\n pointer++;\n } else {\n state = RELATIVE;\n continue;\n } break;\n\n case PATH_OR_AUTHORITY:\n if (char == '/') {\n state = AUTHORITY;\n break;\n } else {\n state = PATH;\n continue;\n }\n\n case RELATIVE:\n url.scheme = base.scheme;\n if (char == EOF) {\n url.username = base.username;\n url.password = base.password;\n url.host = base.host;\n url.port = base.port;\n url.path = base.path.slice();\n url.query = base.query;\n } else if (char == '/' || (char == '\\\\' && isSpecial(url))) {\n state = RELATIVE_SLASH;\n } else if (char == '?') {\n url.username = base.username;\n url.password = base.password;\n url.host = base.host;\n url.port = base.port;\n url.path = base.path.slice();\n url.query = '';\n state = QUERY;\n } else if (char == '#') {\n url.username = base.username;\n url.password = base.password;\n url.host = base.host;\n url.port = base.port;\n url.path = base.path.slice();\n url.query = base.query;\n url.fragment = '';\n state = FRAGMENT;\n } else {\n url.username = base.username;\n url.password = base.password;\n url.host = base.host;\n url.port = base.port;\n url.path = base.path.slice();\n url.path.pop();\n state = PATH;\n continue;\n } break;\n\n case RELATIVE_SLASH:\n if (isSpecial(url) && (char == '/' || char == '\\\\')) {\n state = SPECIAL_AUTHORITY_IGNORE_SLASHES;\n } else if (char == '/') {\n state = AUTHORITY;\n } else {\n url.username = base.username;\n url.password = base.password;\n url.host = base.host;\n url.port = base.port;\n state = PATH;\n continue;\n } break;\n\n case SPECIAL_AUTHORITY_SLASHES:\n state = SPECIAL_AUTHORITY_IGNORE_SLASHES;\n if (char != '/' || buffer.charAt(pointer + 1) != '/') continue;\n pointer++;\n break;\n\n case SPECIAL_AUTHORITY_IGNORE_SLASHES:\n if (char != '/' && char != '\\\\') {\n state = AUTHORITY;\n continue;\n } break;\n\n case AUTHORITY:\n if (char == '@') {\n if (seenAt) buffer = '%40' + buffer;\n seenAt = true;\n bufferCodePoints = arrayFrom(buffer);\n for (var i = 0; i < bufferCodePoints.length; i++) {\n var codePoint = bufferCodePoints[i];\n if (codePoint == ':' && !seenPasswordToken) {\n seenPasswordToken = true;\n continue;\n }\n var encodedCodePoints = percentEncode(codePoint, userinfoPercentEncodeSet);\n if (seenPasswordToken) url.password += encodedCodePoints;\n else url.username += encodedCodePoints;\n }\n buffer = '';\n } else if (\n char == EOF || char == '/' || char == '?' || char == '#' ||\n (char == '\\\\' && isSpecial(url))\n ) {\n if (seenAt && buffer == '') return INVALID_AUTHORITY;\n pointer -= arrayFrom(buffer).length + 1;\n buffer = '';\n state = HOST;\n } else buffer += char;\n break;\n\n case HOST:\n case HOSTNAME:\n if (stateOverride && url.scheme == 'file') {\n state = FILE_HOST;\n continue;\n } else if (char == ':' && !seenBracket) {\n if (buffer == '') return INVALID_HOST;\n failure = parseHost(url, buffer);\n if (failure) return failure;\n buffer = '';\n state = PORT;\n if (stateOverride == HOSTNAME) return;\n } else if (\n char == EOF || char == '/' || char == '?' || char == '#' ||\n (char == '\\\\' && isSpecial(url))\n ) {\n if (isSpecial(url) && buffer == '') return INVALID_HOST;\n if (stateOverride && buffer == '' && (includesCredentials(url) || url.port !== null)) return;\n failure = parseHost(url, buffer);\n if (failure) return failure;\n buffer = '';\n state = PATH_START;\n if (stateOverride) return;\n continue;\n } else {\n if (char == '[') seenBracket = true;\n else if (char == ']') seenBracket = false;\n buffer += char;\n } break;\n\n case PORT:\n if (DIGIT.test(char)) {\n buffer += char;\n } else if (\n char == EOF || char == '/' || char == '?' || char == '#' ||\n (char == '\\\\' && isSpecial(url)) ||\n stateOverride\n ) {\n if (buffer != '') {\n var port = parseInt(buffer, 10);\n if (port > 0xFFFF) return INVALID_PORT;\n url.port = (isSpecial(url) && port === specialSchemes[url.scheme]) ? null : port;\n buffer = '';\n }\n if (stateOverride) return;\n state = PATH_START;\n continue;\n } else return INVALID_PORT;\n break;\n\n case FILE:\n url.scheme = 'file';\n if (char == '/' || char == '\\\\') state = FILE_SLASH;\n else if (base && base.scheme == 'file') {\n if (char == EOF) {\n url.host = base.host;\n url.path = base.path.slice();\n url.query = base.query;\n } else if (char == '?') {\n url.host = base.host;\n url.path = base.path.slice();\n url.query = '';\n state = QUERY;\n } else if (char == '#') {\n url.host = base.host;\n url.path = base.path.slice();\n url.query = base.query;\n url.fragment = '';\n state = FRAGMENT;\n } else {\n if (!startsWithWindowsDriveLetter(codePoints.slice(pointer).join(''))) {\n url.host = base.host;\n url.path = base.path.slice();\n shortenURLsPath(url);\n }\n state = PATH;\n continue;\n }\n } else {\n state = PATH;\n continue;\n } break;\n\n case FILE_SLASH:\n if (char == '/' || char == '\\\\') {\n state = FILE_HOST;\n break;\n }\n if (base && base.scheme == 'file' && !startsWithWindowsDriveLetter(codePoints.slice(pointer).join(''))) {\n if (isWindowsDriveLetter(base.path[0], true)) url.path.push(base.path[0]);\n else url.host = base.host;\n }\n state = PATH;\n continue;\n\n case FILE_HOST:\n if (char == EOF || char == '/' || char == '\\\\' || char == '?' || char == '#') {\n if (!stateOverride && isWindowsDriveLetter(buffer)) {\n state = PATH;\n } else if (buffer == '') {\n url.host = '';\n if (stateOverride) return;\n state = PATH_START;\n } else {\n failure = parseHost(url, buffer);\n if (failure) return failure;\n if (url.host == 'localhost') url.host = '';\n if (stateOverride) return;\n buffer = '';\n state = PATH_START;\n } continue;\n } else buffer += char;\n break;\n\n case PATH_START:\n if (isSpecial(url)) {\n state = PATH;\n if (char != '/' && char != '\\\\') continue;\n } else if (!stateOverride && char == '?') {\n url.query = '';\n state = QUERY;\n } else if (!stateOverride && char == '#') {\n url.fragment = '';\n state = FRAGMENT;\n } else if (char != EOF) {\n state = PATH;\n if (char != '/') continue;\n } break;\n\n case PATH:\n if (\n char == EOF || char == '/' ||\n (char == '\\\\' && isSpecial(url)) ||\n (!stateOverride && (char == '?' || char == '#'))\n ) {\n if (isDoubleDot(buffer)) {\n shortenURLsPath(url);\n if (char != '/' && !(char == '\\\\' && isSpecial(url))) {\n url.path.push('');\n }\n } else if (isSingleDot(buffer)) {\n if (char != '/' && !(char == '\\\\' && isSpecial(url))) {\n url.path.push('');\n }\n } else {\n if (url.scheme == 'file' && !url.path.length && isWindowsDriveLetter(buffer)) {\n if (url.host) url.host = '';\n buffer = buffer.charAt(0) + ':'; // normalize windows drive letter\n }\n url.path.push(buffer);\n }\n buffer = '';\n if (url.scheme == 'file' && (char == EOF || char == '?' || char == '#')) {\n while (url.path.length > 1 && url.path[0] === '') {\n url.path.shift();\n }\n }\n if (char == '?') {\n url.query = '';\n state = QUERY;\n } else if (char == '#') {\n url.fragment = '';\n state = FRAGMENT;\n }\n } else {\n buffer += percentEncode(char, pathPercentEncodeSet);\n } break;\n\n case CANNOT_BE_A_BASE_URL_PATH:\n if (char == '?') {\n url.query = '';\n state = QUERY;\n } else if (char == '#') {\n url.fragment = '';\n state = FRAGMENT;\n } else if (char != EOF) {\n url.path[0] += percentEncode(char, C0ControlPercentEncodeSet);\n } break;\n\n case QUERY:\n if (!stateOverride && char == '#') {\n url.fragment = '';\n state = FRAGMENT;\n } else if (char != EOF) {\n if (char == \"'\" && isSpecial(url)) url.query += '%27';\n else if (char == '#') url.query += '%23';\n else url.query += percentEncode(char, C0ControlPercentEncodeSet);\n } break;\n\n case FRAGMENT:\n if (char != EOF) url.fragment += percentEncode(char, fragmentPercentEncodeSet);\n break;\n }\n\n pointer++;\n }\n};\n\n// `URL` constructor\n// https://url.spec.whatwg.org/#url-class\nvar URLConstructor = function URL(url /* , base */) {\n var that = anInstance(this, URLConstructor, 'URL');\n var base = arguments.length > 1 ? arguments[1] : undefined;\n var urlString = String(url);\n var state = setInternalState(that, { type: 'URL' });\n var baseState, failure;\n if (base !== undefined) {\n if (base instanceof URLConstructor) baseState = getInternalURLState(base);\n else {\n failure = parseURL(baseState = {}, String(base));\n if (failure) throw TypeError(failure);\n }\n }\n failure = parseURL(state, urlString, null, baseState);\n if (failure) throw TypeError(failure);\n var searchParams = state.searchParams = new URLSearchParams();\n var searchParamsState = getInternalSearchParamsState(searchParams);\n searchParamsState.updateSearchParams(state.query);\n searchParamsState.updateURL = function () {\n state.query = String(searchParams) || null;\n };\n if (!DESCRIPTORS) {\n that.href = serializeURL.call(that);\n that.origin = getOrigin.call(that);\n that.protocol = getProtocol.call(that);\n that.username = getUsername.call(that);\n that.password = getPassword.call(that);\n that.host = getHost.call(that);\n that.hostname = getHostname.call(that);\n that.port = getPort.call(that);\n that.pathname = getPathname.call(that);\n that.search = getSearch.call(that);\n that.searchParams = getSearchParams.call(that);\n that.hash = getHash.call(that);\n }\n};\n\nvar URLPrototype = URLConstructor.prototype;\n\nvar serializeURL = function () {\n var url = getInternalURLState(this);\n var scheme = url.scheme;\n var username = url.username;\n var password = url.password;\n var host = url.host;\n var port = url.port;\n var path = url.path;\n var query = url.query;\n var fragment = url.fragment;\n var output = scheme + ':';\n if (host !== null) {\n output += '//';\n if (includesCredentials(url)) {\n output += username + (password ? ':' + password : '') + '@';\n }\n output += serializeHost(host);\n if (port !== null) output += ':' + port;\n } else if (scheme == 'file') output += '//';\n output += url.cannotBeABaseURL ? path[0] : path.length ? '/' + path.join('/') : '';\n if (query !== null) output += '?' + query;\n if (fragment !== null) output += '#' + fragment;\n return output;\n};\n\nvar getOrigin = function () {\n var url = getInternalURLState(this);\n var scheme = url.scheme;\n var port = url.port;\n if (scheme == 'blob') try {\n return new URL(scheme.path[0]).origin;\n } catch (error) {\n return 'null';\n }\n if (scheme == 'file' || !isSpecial(url)) return 'null';\n return scheme + '://' + serializeHost(url.host) + (port !== null ? ':' + port : '');\n};\n\nvar getProtocol = function () {\n return getInternalURLState(this).scheme + ':';\n};\n\nvar getUsername = function () {\n return getInternalURLState(this).username;\n};\n\nvar getPassword = function () {\n return getInternalURLState(this).password;\n};\n\nvar getHost = function () {\n var url = getInternalURLState(this);\n var host = url.host;\n var port = url.port;\n return host === null ? ''\n : port === null ? serializeHost(host)\n : serializeHost(host) + ':' + port;\n};\n\nvar getHostname = function () {\n var host = getInternalURLState(this).host;\n return host === null ? '' : serializeHost(host);\n};\n\nvar getPort = function () {\n var port = getInternalURLState(this).port;\n return port === null ? '' : String(port);\n};\n\nvar getPathname = function () {\n var url = getInternalURLState(this);\n var path = url.path;\n return url.cannotBeABaseURL ? path[0] : path.length ? '/' + path.join('/') : '';\n};\n\nvar getSearch = function () {\n var query = getInternalURLState(this).query;\n return query ? '?' + query : '';\n};\n\nvar getSearchParams = function () {\n return getInternalURLState(this).searchParams;\n};\n\nvar getHash = function () {\n var fragment = getInternalURLState(this).fragment;\n return fragment ? '#' + fragment : '';\n};\n\nvar accessorDescriptor = function (getter, setter) {\n return { get: getter, set: setter, configurable: true, enumerable: true };\n};\n\nif (DESCRIPTORS) {\n defineProperties(URLPrototype, {\n // `URL.prototype.href` accessors pair\n // https://url.spec.whatwg.org/#dom-url-href\n href: accessorDescriptor(serializeURL, function (href) {\n var url = getInternalURLState(this);\n var urlString = String(href);\n var failure = parseURL(url, urlString);\n if (failure) throw TypeError(failure);\n getInternalSearchParamsState(url.searchParams).updateSearchParams(url.query);\n }),\n // `URL.prototype.origin` getter\n // https://url.spec.whatwg.org/#dom-url-origin\n origin: accessorDescriptor(getOrigin),\n // `URL.prototype.protocol` accessors pair\n // https://url.spec.whatwg.org/#dom-url-protocol\n protocol: accessorDescriptor(getProtocol, function (protocol) {\n var url = getInternalURLState(this);\n parseURL(url, String(protocol) + ':', SCHEME_START);\n }),\n // `URL.prototype.username` accessors pair\n // https://url.spec.whatwg.org/#dom-url-username\n username: accessorDescriptor(getUsername, function (username) {\n var url = getInternalURLState(this);\n var codePoints = arrayFrom(String(username));\n if (cannotHaveUsernamePasswordPort(url)) return;\n url.username = '';\n for (var i = 0; i < codePoints.length; i++) {\n url.username += percentEncode(codePoints[i], userinfoPercentEncodeSet);\n }\n }),\n // `URL.prototype.password` accessors pair\n // https://url.spec.whatwg.org/#dom-url-password\n password: accessorDescriptor(getPassword, function (password) {\n var url = getInternalURLState(this);\n var codePoints = arrayFrom(String(password));\n if (cannotHaveUsernamePasswordPort(url)) return;\n url.password = '';\n for (var i = 0; i < codePoints.length; i++) {\n url.password += percentEncode(codePoints[i], userinfoPercentEncodeSet);\n }\n }),\n // `URL.prototype.host` accessors pair\n // https://url.spec.whatwg.org/#dom-url-host\n host: accessorDescriptor(getHost, function (host) {\n var url = getInternalURLState(this);\n if (url.cannotBeABaseURL) return;\n parseURL(url, String(host), HOST);\n }),\n // `URL.prototype.hostname` accessors pair\n // https://url.spec.whatwg.org/#dom-url-hostname\n hostname: accessorDescriptor(getHostname, function (hostname) {\n var url = getInternalURLState(this);\n if (url.cannotBeABaseURL) return;\n parseURL(url, String(hostname), HOSTNAME);\n }),\n // `URL.prototype.port` accessors pair\n // https://url.spec.whatwg.org/#dom-url-port\n port: accessorDescriptor(getPort, function (port) {\n var url = getInternalURLState(this);\n if (cannotHaveUsernamePasswordPort(url)) return;\n port = String(port);\n if (port == '') url.port = null;\n else parseURL(url, port, PORT);\n }),\n // `URL.prototype.pathname` accessors pair\n // https://url.spec.whatwg.org/#dom-url-pathname\n pathname: accessorDescriptor(getPathname, function (pathname) {\n var url = getInternalURLState(this);\n if (url.cannotBeABaseURL) return;\n url.path = [];\n parseURL(url, pathname + '', PATH_START);\n }),\n // `URL.prototype.search` accessors pair\n // https://url.spec.whatwg.org/#dom-url-search\n search: accessorDescriptor(getSearch, function (search) {\n var url = getInternalURLState(this);\n search = String(search);\n if (search == '') {\n url.query = null;\n } else {\n if ('?' == search.charAt(0)) search = search.slice(1);\n url.query = '';\n parseURL(url, search, QUERY);\n }\n getInternalSearchParamsState(url.searchParams).updateSearchParams(url.query);\n }),\n // `URL.prototype.searchParams` getter\n // https://url.spec.whatwg.org/#dom-url-searchparams\n searchParams: accessorDescriptor(getSearchParams),\n // `URL.prototype.hash` accessors pair\n // https://url.spec.whatwg.org/#dom-url-hash\n hash: accessorDescriptor(getHash, function (hash) {\n var url = getInternalURLState(this);\n hash = String(hash);\n if (hash == '') {\n url.fragment = null;\n return;\n }\n if ('#' == hash.charAt(0)) hash = hash.slice(1);\n url.fragment = '';\n parseURL(url, hash, FRAGMENT);\n })\n });\n}\n\n// `URL.prototype.toJSON` method\n// https://url.spec.whatwg.org/#dom-url-tojson\nredefine(URLPrototype, 'toJSON', function toJSON() {\n return serializeURL.call(this);\n}, { enumerable: true });\n\n// `URL.prototype.toString` method\n// https://url.spec.whatwg.org/#URL-stringification-behavior\nredefine(URLPrototype, 'toString', function toString() {\n return serializeURL.call(this);\n}, { enumerable: true });\n\nif (NativeURL) {\n var nativeCreateObjectURL = NativeURL.createObjectURL;\n var nativeRevokeObjectURL = NativeURL.revokeObjectURL;\n // `URL.createObjectURL` method\n // https://developer.mozilla.org/en-US/docs/Web/API/URL/createObjectURL\n // eslint-disable-next-line no-unused-vars\n if (nativeCreateObjectURL) redefine(URLConstructor, 'createObjectURL', function createObjectURL(blob) {\n return nativeCreateObjectURL.apply(NativeURL, arguments);\n });\n // `URL.revokeObjectURL` method\n // https://developer.mozilla.org/en-US/docs/Web/API/URL/revokeObjectURL\n // eslint-disable-next-line no-unused-vars\n if (nativeRevokeObjectURL) redefine(URLConstructor, 'revokeObjectURL', function revokeObjectURL(url) {\n return nativeRevokeObjectURL.apply(NativeURL, arguments);\n });\n}\n\nsetToStringTag(URLConstructor, 'URL');\n\n$({ global: true, forced: !USE_NATIVE_URL, sham: !DESCRIPTORS }, {\n URL: URLConstructor\n});\n","(function(global) {\r\n /**\r\n * Polyfill URLSearchParams\r\n *\r\n * Inspired from : https://github.com/WebReflection/url-search-params/blob/master/src/url-search-params.js\r\n */\r\n\r\n var checkIfIteratorIsSupported = function() {\r\n try {\r\n return !!Symbol.iterator;\r\n } catch (error) {\r\n return false;\r\n }\r\n };\r\n\r\n\r\n var iteratorSupported = checkIfIteratorIsSupported();\r\n\r\n var createIterator = function(items) {\r\n var iterator = {\r\n next: function() {\r\n var value = items.shift();\r\n return { done: value === void 0, value: value };\r\n }\r\n };\r\n\r\n if (iteratorSupported) {\r\n iterator[Symbol.iterator] = function() {\r\n return iterator;\r\n };\r\n }\r\n\r\n return iterator;\r\n };\r\n\r\n /**\r\n * Search param name and values should be encoded according to https://url.spec.whatwg.org/#urlencoded-serializing\r\n * encodeURIComponent() produces the same result except encoding spaces as `%20` instead of `+`.\r\n */\r\n var serializeParam = function(value) {\r\n return encodeURIComponent(value).replace(/%20/g, '+');\r\n };\r\n\r\n var deserializeParam = function(value) {\r\n return decodeURIComponent(String(value).replace(/\\+/g, ' '));\r\n };\r\n\r\n var polyfillURLSearchParams = function() {\r\n\r\n var URLSearchParams = function(searchString) {\r\n Object.defineProperty(this, '_entries', { writable: true, value: {} });\r\n var typeofSearchString = typeof searchString;\r\n\r\n if (typeofSearchString === 'undefined') {\r\n // do nothing\r\n } else if (typeofSearchString === 'string') {\r\n if (searchString !== '') {\r\n this._fromString(searchString);\r\n }\r\n } else if (searchString instanceof URLSearchParams) {\r\n var _this = this;\r\n searchString.forEach(function(value, name) {\r\n _this.append(name, value);\r\n });\r\n } else if ((searchString !== null) && (typeofSearchString === 'object')) {\r\n if (Object.prototype.toString.call(searchString) === '[object Array]') {\r\n for (var i = 0; i < searchString.length; i++) {\r\n var entry = searchString[i];\r\n if ((Object.prototype.toString.call(entry) === '[object Array]') || (entry.length !== 2)) {\r\n this.append(entry[0], entry[1]);\r\n } else {\r\n throw new TypeError('Expected [string, any] as entry at index ' + i + ' of URLSearchParams\\'s input');\r\n }\r\n }\r\n } else {\r\n for (var key in searchString) {\r\n if (searchString.hasOwnProperty(key)) {\r\n this.append(key, searchString[key]);\r\n }\r\n }\r\n }\r\n } else {\r\n throw new TypeError('Unsupported input\\'s type for URLSearchParams');\r\n }\r\n };\r\n\r\n var proto = URLSearchParams.prototype;\r\n\r\n proto.append = function(name, value) {\r\n if (name in this._entries) {\r\n this._entries[name].push(String(value));\r\n } else {\r\n this._entries[name] = [String(value)];\r\n }\r\n };\r\n\r\n proto.delete = function(name) {\r\n delete this._entries[name];\r\n };\r\n\r\n proto.get = function(name) {\r\n return (name in this._entries) ? this._entries[name][0] : null;\r\n };\r\n\r\n proto.getAll = function(name) {\r\n return (name in this._entries) ? this._entries[name].slice(0) : [];\r\n };\r\n\r\n proto.has = function(name) {\r\n return (name in this._entries);\r\n };\r\n\r\n proto.set = function(name, value) {\r\n this._entries[name] = [String(value)];\r\n };\r\n\r\n proto.forEach = function(callback, thisArg) {\r\n var entries;\r\n for (var name in this._entries) {\r\n if (this._entries.hasOwnProperty(name)) {\r\n entries = this._entries[name];\r\n for (var i = 0; i < entries.length; i++) {\r\n callback.call(thisArg, entries[i], name, this);\r\n }\r\n }\r\n }\r\n };\r\n\r\n proto.keys = function() {\r\n var items = [];\r\n this.forEach(function(value, name) {\r\n items.push(name);\r\n });\r\n return createIterator(items);\r\n };\r\n\r\n proto.values = function() {\r\n var items = [];\r\n this.forEach(function(value) {\r\n items.push(value);\r\n });\r\n return createIterator(items);\r\n };\r\n\r\n proto.entries = function() {\r\n var items = [];\r\n this.forEach(function(value, name) {\r\n items.push([name, value]);\r\n });\r\n return createIterator(items);\r\n };\r\n\r\n if (iteratorSupported) {\r\n proto[Symbol.iterator] = proto.entries;\r\n }\r\n\r\n proto.toString = function() {\r\n var searchArray = [];\r\n this.forEach(function(value, name) {\r\n searchArray.push(serializeParam(name) + '=' + serializeParam(value));\r\n });\r\n return searchArray.join('&');\r\n };\r\n\r\n\r\n global.URLSearchParams = URLSearchParams;\r\n };\r\n\r\n var checkIfURLSearchParamsSupported = function() {\r\n try {\r\n var URLSearchParams = global.URLSearchParams;\r\n\r\n return (new URLSearchParams('?a=1').toString() === 'a=1') && (typeof URLSearchParams.prototype.set === 'function');\r\n } catch (e) {\r\n return false;\r\n }\r\n };\r\n\r\n if (!checkIfURLSearchParamsSupported()) {\r\n polyfillURLSearchParams();\r\n }\r\n\r\n var proto = global.URLSearchParams.prototype;\r\n\r\n if (typeof proto.sort !== 'function') {\r\n proto.sort = function() {\r\n var _this = this;\r\n var items = [];\r\n this.forEach(function(value, name) {\r\n items.push([name, value]);\r\n if (!_this._entries) {\r\n _this.delete(name);\r\n }\r\n });\r\n items.sort(function(a, b) {\r\n if (a[0] < b[0]) {\r\n return -1;\r\n } else if (a[0] > b[0]) {\r\n return +1;\r\n } else {\r\n return 0;\r\n }\r\n });\r\n if (_this._entries) { // force reset because IE keeps keys index\r\n _this._entries = {};\r\n }\r\n for (var i = 0; i < items.length; i++) {\r\n this.append(items[i][0], items[i][1]);\r\n }\r\n };\r\n }\r\n\r\n if (typeof proto._fromString !== 'function') {\r\n Object.defineProperty(proto, '_fromString', {\r\n enumerable: false,\r\n configurable: false,\r\n writable: false,\r\n value: function(searchString) {\r\n if (this._entries) {\r\n this._entries = {};\r\n } else {\r\n var keys = [];\r\n this.forEach(function(value, name) {\r\n keys.push(name);\r\n });\r\n for (var i = 0; i < keys.length; i++) {\r\n this.delete(keys[i]);\r\n }\r\n }\r\n\r\n searchString = searchString.replace(/^\\?/, '');\r\n var attributes = searchString.split('&');\r\n var attribute;\r\n for (var i = 0; i < attributes.length; i++) {\r\n attribute = attributes[i].split('=');\r\n this.append(\r\n deserializeParam(attribute[0]),\r\n (attribute.length > 1) ? deserializeParam(attribute[1]) : ''\r\n );\r\n }\r\n }\r\n });\r\n }\r\n\r\n // HTMLAnchorElement\r\n\r\n})(\r\n (typeof global !== 'undefined') ? global\r\n : ((typeof window !== 'undefined') ? window\r\n : ((typeof self !== 'undefined') ? self : this))\r\n);\r\n\r\n(function(global) {\r\n /**\r\n * Polyfill URL\r\n *\r\n * Inspired from : https://github.com/arv/DOM-URL-Polyfill/blob/master/src/url.js\r\n */\r\n\r\n var checkIfURLIsSupported = function() {\r\n try {\r\n var u = new global.URL('b', 'http://a');\r\n u.pathname = 'c d';\r\n return (u.href === 'http://a/c%20d') && u.searchParams;\r\n } catch (e) {\r\n return false;\r\n }\r\n };\r\n\r\n\r\n var polyfillURL = function() {\r\n var _URL = global.URL;\r\n\r\n var URL = function(url, base) {\r\n if (typeof url !== 'string') url = String(url);\r\n\r\n // Only create another document if the base is different from current location.\r\n var doc = document, baseElement;\r\n if (base && (global.location === void 0 || base !== global.location.href)) {\r\n doc = document.implementation.createHTMLDocument('');\r\n baseElement = doc.createElement('base');\r\n baseElement.href = base;\r\n doc.head.appendChild(baseElement);\r\n try {\r\n if (baseElement.href.indexOf(base) !== 0) throw new Error(baseElement.href);\r\n } catch (err) {\r\n throw new Error('URL unable to set base ' + base + ' due to ' + err);\r\n }\r\n }\r\n\r\n var anchorElement = doc.createElement('a');\r\n anchorElement.href = url;\r\n if (baseElement) {\r\n doc.body.appendChild(anchorElement);\r\n anchorElement.href = anchorElement.href; // force href to refresh\r\n }\r\n\r\n var inputElement = doc.createElement('input');\r\n inputElement.type = 'url';\r\n inputElement.value = url;\r\n\r\n if (anchorElement.protocol === ':' || !/:/.test(anchorElement.href) || (!inputElement.checkValidity() && !base)) {\r\n throw new TypeError('Invalid URL');\r\n }\r\n\r\n Object.defineProperty(this, '_anchorElement', {\r\n value: anchorElement\r\n });\r\n\r\n\r\n // create a linked searchParams which reflect its changes on URL\r\n var searchParams = new global.URLSearchParams(this.search);\r\n var enableSearchUpdate = true;\r\n var enableSearchParamsUpdate = true;\r\n var _this = this;\r\n ['append', 'delete', 'set'].forEach(function(methodName) {\r\n var method = searchParams[methodName];\r\n searchParams[methodName] = function() {\r\n method.apply(searchParams, arguments);\r\n if (enableSearchUpdate) {\r\n enableSearchParamsUpdate = false;\r\n _this.search = searchParams.toString();\r\n enableSearchParamsUpdate = true;\r\n }\r\n };\r\n });\r\n\r\n Object.defineProperty(this, 'searchParams', {\r\n value: searchParams,\r\n enumerable: true\r\n });\r\n\r\n var search = void 0;\r\n Object.defineProperty(this, '_updateSearchParams', {\r\n enumerable: false,\r\n configurable: false,\r\n writable: false,\r\n value: function() {\r\n if (this.search !== search) {\r\n search = this.search;\r\n if (enableSearchParamsUpdate) {\r\n enableSearchUpdate = false;\r\n this.searchParams._fromString(this.search);\r\n enableSearchUpdate = true;\r\n }\r\n }\r\n }\r\n });\r\n };\r\n\r\n var proto = URL.prototype;\r\n\r\n var linkURLWithAnchorAttribute = function(attributeName) {\r\n Object.defineProperty(proto, attributeName, {\r\n get: function() {\r\n return this._anchorElement[attributeName];\r\n },\r\n set: function(value) {\r\n this._anchorElement[attributeName] = value;\r\n },\r\n enumerable: true\r\n });\r\n };\r\n\r\n ['hash', 'host', 'hostname', 'port', 'protocol']\r\n .forEach(function(attributeName) {\r\n linkURLWithAnchorAttribute(attributeName);\r\n });\r\n\r\n Object.defineProperty(proto, 'search', {\r\n get: function() {\r\n return this._anchorElement['search'];\r\n },\r\n set: function(value) {\r\n this._anchorElement['search'] = value;\r\n this._updateSearchParams();\r\n },\r\n enumerable: true\r\n });\r\n\r\n Object.defineProperties(proto, {\r\n\r\n 'toString': {\r\n get: function() {\r\n var _this = this;\r\n return function() {\r\n return _this.href;\r\n };\r\n }\r\n },\r\n\r\n 'href': {\r\n get: function() {\r\n return this._anchorElement.href.replace(/\\?$/, '');\r\n },\r\n set: function(value) {\r\n this._anchorElement.href = value;\r\n this._updateSearchParams();\r\n },\r\n enumerable: true\r\n },\r\n\r\n 'pathname': {\r\n get: function() {\r\n return this._anchorElement.pathname.replace(/(^\\/?)/, '/');\r\n },\r\n set: function(value) {\r\n this._anchorElement.pathname = value;\r\n },\r\n enumerable: true\r\n },\r\n\r\n 'origin': {\r\n get: function() {\r\n // get expected port from protocol\r\n var expectedPort = { 'http:': 80, 'https:': 443, 'ftp:': 21 }[this._anchorElement.protocol];\r\n // add port to origin if, expected port is different than actual port\r\n // and it is not empty f.e http://foo:8080\r\n // 8080 != 80 && 8080 != ''\r\n var addPortToOrigin = this._anchorElement.port != expectedPort &&\r\n this._anchorElement.port !== '';\r\n\r\n return this._anchorElement.protocol +\r\n '//' +\r\n this._anchorElement.hostname +\r\n (addPortToOrigin ? (':' + this._anchorElement.port) : '');\r\n },\r\n enumerable: true\r\n },\r\n\r\n 'password': { // TODO\r\n get: function() {\r\n return '';\r\n },\r\n set: function(value) {\r\n },\r\n enumerable: true\r\n },\r\n\r\n 'username': { // TODO\r\n get: function() {\r\n return '';\r\n },\r\n set: function(value) {\r\n },\r\n enumerable: true\r\n },\r\n });\r\n\r\n URL.createObjectURL = function(blob) {\r\n return _URL.createObjectURL.apply(_URL, arguments);\r\n };\r\n\r\n URL.revokeObjectURL = function(url) {\r\n return _URL.revokeObjectURL.apply(_URL, arguments);\r\n };\r\n\r\n global.URL = URL;\r\n\r\n };\r\n\r\n if (!checkIfURLIsSupported()) {\r\n polyfillURL();\r\n }\r\n\r\n if ((global.location !== void 0) && !('origin' in global.location)) {\r\n var getOrigin = function() {\r\n return global.location.protocol + '//' + global.location.hostname + (global.location.port ? (':' + global.location.port) : '');\r\n };\r\n\r\n try {\r\n Object.defineProperty(global.location, 'origin', {\r\n get: getOrigin,\r\n enumerable: true\r\n });\r\n } catch (e) {\r\n setInterval(function() {\r\n global.location.origin = getOrigin();\r\n }, 100);\r\n }\r\n }\r\n\r\n})(\r\n (typeof global !== 'undefined') ? global\r\n : ((typeof window !== 'undefined') ? window\r\n : ((typeof self !== 'undefined') ? self : this))\r\n);\r\n","'use strict';\nvar $ = require('../internals/export');\nvar fails = require('../internals/fails');\nvar isArray = require('../internals/is-array');\nvar isObject = require('../internals/is-object');\nvar toObject = require('../internals/to-object');\nvar toLength = require('../internals/to-length');\nvar createProperty = require('../internals/create-property');\nvar arraySpeciesCreate = require('../internals/array-species-create');\nvar arrayMethodHasSpeciesSupport = require('../internals/array-method-has-species-support');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\nvar V8_VERSION = require('../internals/engine-v8-version');\n\nvar IS_CONCAT_SPREADABLE = wellKnownSymbol('isConcatSpreadable');\nvar MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF;\nvar MAXIMUM_ALLOWED_INDEX_EXCEEDED = 'Maximum allowed index exceeded';\n\n// We can't use this feature detection in V8 since it causes\n// deoptimization and serious performance degradation\n// https://github.com/zloirock/core-js/issues/679\nvar IS_CONCAT_SPREADABLE_SUPPORT = V8_VERSION >= 51 || !fails(function () {\n var array = [];\n array[IS_CONCAT_SPREADABLE] = false;\n return array.concat()[0] !== array;\n});\n\nvar SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('concat');\n\nvar isConcatSpreadable = function (O) {\n if (!isObject(O)) return false;\n var spreadable = O[IS_CONCAT_SPREADABLE];\n return spreadable !== undefined ? !!spreadable : isArray(O);\n};\n\nvar FORCED = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT;\n\n// `Array.prototype.concat` method\n// https://tc39.github.io/ecma262/#sec-array.prototype.concat\n// with adding support of @@isConcatSpreadable and @@species\n$({ target: 'Array', proto: true, forced: FORCED }, {\n concat: function concat(arg) { // eslint-disable-line no-unused-vars\n var O = toObject(this);\n var A = arraySpeciesCreate(O, 0);\n var n = 0;\n var i, k, length, len, E;\n for (i = -1, length = arguments.length; i < length; i++) {\n E = i === -1 ? O : arguments[i];\n if (isConcatSpreadable(E)) {\n len = toLength(E.length);\n if (n + len > MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);\n for (k = 0; k < len; k++, n++) if (k in E) createProperty(A, n, E[k]);\n } else {\n if (n >= MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);\n createProperty(A, n++, E);\n }\n }\n A.length = n;\n return A;\n }\n});\n","'use strict';\nvar $ = require('../internals/export');\nvar $filter = require('../internals/array-iteration').filter;\nvar arrayMethodHasSpeciesSupport = require('../internals/array-method-has-species-support');\nvar arrayMethodUsesToLength = require('../internals/array-method-uses-to-length');\n\nvar HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('filter');\n// Edge 14- issue\nvar USES_TO_LENGTH = arrayMethodUsesToLength('filter');\n\n// `Array.prototype.filter` method\n// https://tc39.github.io/ecma262/#sec-array.prototype.filter\n// with adding support of @@species\n$({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT || !USES_TO_LENGTH }, {\n filter: function filter(callbackfn /* , thisArg */) {\n return $filter(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);\n }\n});\n","'use strict';\nvar $ = require('../internals/export');\nvar $find = require('../internals/array-iteration').find;\nvar addToUnscopables = require('../internals/add-to-unscopables');\nvar arrayMethodUsesToLength = require('../internals/array-method-uses-to-length');\n\nvar FIND = 'find';\nvar SKIPS_HOLES = true;\n\nvar USES_TO_LENGTH = arrayMethodUsesToLength(FIND);\n\n// Shouldn't skip holes\nif (FIND in []) Array(1)[FIND](function () { SKIPS_HOLES = false; });\n\n// `Array.prototype.find` method\n// https://tc39.github.io/ecma262/#sec-array.prototype.find\n$({ target: 'Array', proto: true, forced: SKIPS_HOLES || !USES_TO_LENGTH }, {\n find: function find(callbackfn /* , that = undefined */) {\n return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);\n }\n});\n\n// https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables\naddToUnscopables(FIND);\n","var wellKnownSymbol = require('../internals/well-known-symbol');\n\nvar ITERATOR = wellKnownSymbol('iterator');\nvar SAFE_CLOSING = false;\n\ntry {\n var called = 0;\n var iteratorWithReturn = {\n next: function () {\n return { done: !!called++ };\n },\n 'return': function () {\n SAFE_CLOSING = true;\n }\n };\n iteratorWithReturn[ITERATOR] = function () {\n return this;\n };\n // eslint-disable-next-line no-throw-literal\n Array.from(iteratorWithReturn, function () { throw 2; });\n} catch (error) { /* empty */ }\n\nmodule.exports = function (exec, SKIP_CLOSING) {\n if (!SKIP_CLOSING && !SAFE_CLOSING) return false;\n var ITERATION_SUPPORT = false;\n try {\n var object = {};\n object[ITERATOR] = function () {\n return {\n next: function () {\n return { done: ITERATION_SUPPORT = true };\n }\n };\n };\n exec(object);\n } catch (error) { /* empty */ }\n return ITERATION_SUPPORT;\n};\n","var $ = require('../internals/export');\nvar from = require('../internals/array-from');\nvar checkCorrectnessOfIteration = require('../internals/check-correctness-of-iteration');\n\nvar INCORRECT_ITERATION = !checkCorrectnessOfIteration(function (iterable) {\n Array.from(iterable);\n});\n\n// `Array.from` method\n// https://tc39.github.io/ecma262/#sec-array.from\n$({ target: 'Array', stat: true, forced: INCORRECT_ITERATION }, {\n from: from\n});\n","'use strict';\nvar $ = require('../internals/export');\nvar $includes = require('../internals/array-includes').includes;\nvar addToUnscopables = require('../internals/add-to-unscopables');\nvar arrayMethodUsesToLength = require('../internals/array-method-uses-to-length');\n\nvar USES_TO_LENGTH = arrayMethodUsesToLength('indexOf', { ACCESSORS: true, 1: 0 });\n\n// `Array.prototype.includes` method\n// https://tc39.github.io/ecma262/#sec-array.prototype.includes\n$({ target: 'Array', proto: true, forced: !USES_TO_LENGTH }, {\n includes: function includes(el /* , fromIndex = 0 */) {\n return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);\n }\n});\n\n// https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables\naddToUnscopables('includes');\n","'use strict';\nvar $ = require('../internals/export');\nvar $map = require('../internals/array-iteration').map;\nvar arrayMethodHasSpeciesSupport = require('../internals/array-method-has-species-support');\nvar arrayMethodUsesToLength = require('../internals/array-method-uses-to-length');\n\nvar HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('map');\n// FF49- issue\nvar USES_TO_LENGTH = arrayMethodUsesToLength('map');\n\n// `Array.prototype.map` method\n// https://tc39.github.io/ecma262/#sec-array.prototype.map\n// with adding support of @@species\n$({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT || !USES_TO_LENGTH }, {\n map: function map(callbackfn /* , thisArg */) {\n return $map(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);\n }\n});\n","var isObject = require('../internals/is-object');\nvar setPrototypeOf = require('../internals/object-set-prototype-of');\n\n// makes subclassing work correct for wrapped built-ins\nmodule.exports = function ($this, dummy, Wrapper) {\n var NewTarget, NewTargetPrototype;\n if (\n // it can work only with native `setPrototypeOf`\n setPrototypeOf &&\n // we haven't completely correct pre-ES6 way for getting `new.target`, so use this\n typeof (NewTarget = dummy.constructor) == 'function' &&\n NewTarget !== Wrapper &&\n isObject(NewTargetPrototype = NewTarget.prototype) &&\n NewTargetPrototype !== Wrapper.prototype\n ) setPrototypeOf($this, NewTargetPrototype);\n return $this;\n};\n","// a string of all valid unicode whitespaces\n// eslint-disable-next-line max-len\nmodule.exports = '\\u0009\\u000A\\u000B\\u000C\\u000D\\u0020\\u00A0\\u1680\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u202F\\u205F\\u3000\\u2028\\u2029\\uFEFF';\n","var requireObjectCoercible = require('../internals/require-object-coercible');\nvar whitespaces = require('../internals/whitespaces');\n\nvar whitespace = '[' + whitespaces + ']';\nvar ltrim = RegExp('^' + whitespace + whitespace + '*');\nvar rtrim = RegExp(whitespace + whitespace + '*$');\n\n// `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation\nvar createMethod = function (TYPE) {\n return function ($this) {\n var string = String(requireObjectCoercible($this));\n if (TYPE & 1) string = string.replace(ltrim, '');\n if (TYPE & 2) string = string.replace(rtrim, '');\n return string;\n };\n};\n\nmodule.exports = {\n // `String.prototype.{ trimLeft, trimStart }` methods\n // https://tc39.github.io/ecma262/#sec-string.prototype.trimstart\n start: createMethod(1),\n // `String.prototype.{ trimRight, trimEnd }` methods\n // https://tc39.github.io/ecma262/#sec-string.prototype.trimend\n end: createMethod(2),\n // `String.prototype.trim` method\n // https://tc39.github.io/ecma262/#sec-string.prototype.trim\n trim: createMethod(3)\n};\n","'use strict';\nvar DESCRIPTORS = require('../internals/descriptors');\nvar global = require('../internals/global');\nvar isForced = require('../internals/is-forced');\nvar redefine = require('../internals/redefine');\nvar has = require('../internals/has');\nvar classof = require('../internals/classof-raw');\nvar inheritIfRequired = require('../internals/inherit-if-required');\nvar toPrimitive = require('../internals/to-primitive');\nvar fails = require('../internals/fails');\nvar create = require('../internals/object-create');\nvar getOwnPropertyNames = require('../internals/object-get-own-property-names').f;\nvar getOwnPropertyDescriptor = require('../internals/object-get-own-property-descriptor').f;\nvar defineProperty = require('../internals/object-define-property').f;\nvar trim = require('../internals/string-trim').trim;\n\nvar NUMBER = 'Number';\nvar NativeNumber = global[NUMBER];\nvar NumberPrototype = NativeNumber.prototype;\n\n// Opera ~12 has broken Object#toString\nvar BROKEN_CLASSOF = classof(create(NumberPrototype)) == NUMBER;\n\n// `ToNumber` abstract operation\n// https://tc39.github.io/ecma262/#sec-tonumber\nvar toNumber = function (argument) {\n var it = toPrimitive(argument, false);\n var first, third, radix, maxCode, digits, length, index, code;\n if (typeof it == 'string' && it.length > 2) {\n it = trim(it);\n first = it.charCodeAt(0);\n if (first === 43 || first === 45) {\n third = it.charCodeAt(2);\n if (third === 88 || third === 120) return NaN; // Number('+0x1') should be NaN, old V8 fix\n } else if (first === 48) {\n switch (it.charCodeAt(1)) {\n case 66: case 98: radix = 2; maxCode = 49; break; // fast equal of /^0b[01]+$/i\n case 79: case 111: radix = 8; maxCode = 55; break; // fast equal of /^0o[0-7]+$/i\n default: return +it;\n }\n digits = it.slice(2);\n length = digits.length;\n for (index = 0; index < length; index++) {\n code = digits.charCodeAt(index);\n // parseInt parses a string to a first unavailable symbol\n // but ToNumber should return NaN if a string contains unavailable symbols\n if (code < 48 || code > maxCode) return NaN;\n } return parseInt(digits, radix);\n }\n } return +it;\n};\n\n// `Number` constructor\n// https://tc39.github.io/ecma262/#sec-number-constructor\nif (isForced(NUMBER, !NativeNumber(' 0o1') || !NativeNumber('0b1') || NativeNumber('+0x1'))) {\n var NumberWrapper = function Number(value) {\n var it = arguments.length < 1 ? 0 : value;\n var dummy = this;\n return dummy instanceof NumberWrapper\n // check on 1..constructor(foo) case\n && (BROKEN_CLASSOF ? fails(function () { NumberPrototype.valueOf.call(dummy); }) : classof(dummy) != NUMBER)\n ? inheritIfRequired(new NativeNumber(toNumber(it)), dummy, NumberWrapper) : toNumber(it);\n };\n for (var keys = DESCRIPTORS ? getOwnPropertyNames(NativeNumber) : (\n // ES3:\n 'MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,' +\n // ES2015 (in case, if modules with ES2015 Number statics required before):\n 'EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,' +\n 'MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger'\n ).split(','), j = 0, key; keys.length > j; j++) {\n if (has(NativeNumber, key = keys[j]) && !has(NumberWrapper, key)) {\n defineProperty(NumberWrapper, key, getOwnPropertyDescriptor(NativeNumber, key));\n }\n }\n NumberWrapper.prototype = NumberPrototype;\n NumberPrototype.constructor = NumberWrapper;\n redefine(global, NUMBER, NumberWrapper);\n}\n","var $ = require('../internals/export');\nvar toObject = require('../internals/to-object');\nvar nativeKeys = require('../internals/object-keys');\nvar fails = require('../internals/fails');\n\nvar FAILS_ON_PRIMITIVES = fails(function () { nativeKeys(1); });\n\n// `Object.keys` method\n// https://tc39.github.io/ecma262/#sec-object.keys\n$({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, {\n keys: function keys(it) {\n return nativeKeys(toObject(it));\n }\n});\n","var isRegExp = require('../internals/is-regexp');\n\nmodule.exports = function (it) {\n if (isRegExp(it)) {\n throw TypeError(\"The method doesn't accept regular expressions\");\n } return it;\n};\n","var wellKnownSymbol = require('../internals/well-known-symbol');\n\nvar MATCH = wellKnownSymbol('match');\n\nmodule.exports = function (METHOD_NAME) {\n var regexp = /./;\n try {\n '/./'[METHOD_NAME](regexp);\n } catch (e) {\n try {\n regexp[MATCH] = false;\n return '/./'[METHOD_NAME](regexp);\n } catch (f) { /* empty */ }\n } return false;\n};\n","'use strict';\nvar $ = require('../internals/export');\nvar notARegExp = require('../internals/not-a-regexp');\nvar requireObjectCoercible = require('../internals/require-object-coercible');\nvar correctIsRegExpLogic = require('../internals/correct-is-regexp-logic');\n\n// `String.prototype.includes` method\n// https://tc39.github.io/ecma262/#sec-string.prototype.includes\n$({ target: 'String', proto: true, forced: !correctIsRegExpLogic('includes') }, {\n includes: function includes(searchString /* , position = 0 */) {\n return !!~String(requireObjectCoercible(this))\n .indexOf(notARegExp(searchString), arguments.length > 1 ? arguments[1] : undefined);\n }\n});\n","var fails = require('../internals/fails');\n\nmodule.exports = !fails(function () {\n return Object.isExtensible(Object.preventExtensions({}));\n});\n","var hiddenKeys = require('../internals/hidden-keys');\nvar isObject = require('../internals/is-object');\nvar has = require('../internals/has');\nvar defineProperty = require('../internals/object-define-property').f;\nvar uid = require('../internals/uid');\nvar FREEZING = require('../internals/freezing');\n\nvar METADATA = uid('meta');\nvar id = 0;\n\nvar isExtensible = Object.isExtensible || function () {\n return true;\n};\n\nvar setMetadata = function (it) {\n defineProperty(it, METADATA, { value: {\n objectID: 'O' + ++id, // object ID\n weakData: {} // weak collections IDs\n } });\n};\n\nvar fastKey = function (it, create) {\n // return a primitive with prefix\n if (!isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;\n if (!has(it, METADATA)) {\n // can't set metadata to uncaught frozen object\n if (!isExtensible(it)) return 'F';\n // not necessary to add metadata\n if (!create) return 'E';\n // add missing metadata\n setMetadata(it);\n // return object ID\n } return it[METADATA].objectID;\n};\n\nvar getWeakData = function (it, create) {\n if (!has(it, METADATA)) {\n // can't set metadata to uncaught frozen object\n if (!isExtensible(it)) return true;\n // not necessary to add metadata\n if (!create) return false;\n // add missing metadata\n setMetadata(it);\n // return the store of weak collections IDs\n } return it[METADATA].weakData;\n};\n\n// add metadata on freeze-family methods calling\nvar onFreeze = function (it) {\n if (FREEZING && meta.REQUIRED && isExtensible(it) && !has(it, METADATA)) setMetadata(it);\n return it;\n};\n\nvar meta = module.exports = {\n REQUIRED: false,\n fastKey: fastKey,\n getWeakData: getWeakData,\n onFreeze: onFreeze\n};\n\nhiddenKeys[METADATA] = true;\n","var anObject = require('../internals/an-object');\nvar isArrayIteratorMethod = require('../internals/is-array-iterator-method');\nvar toLength = require('../internals/to-length');\nvar bind = require('../internals/function-bind-context');\nvar getIteratorMethod = require('../internals/get-iterator-method');\nvar callWithSafeIterationClosing = require('../internals/call-with-safe-iteration-closing');\n\nvar Result = function (stopped, result) {\n this.stopped = stopped;\n this.result = result;\n};\n\nvar iterate = module.exports = function (iterable, fn, that, AS_ENTRIES, IS_ITERATOR) {\n var boundFunction = bind(fn, that, AS_ENTRIES ? 2 : 1);\n var iterator, iterFn, index, length, result, next, step;\n\n if (IS_ITERATOR) {\n iterator = iterable;\n } else {\n iterFn = getIteratorMethod(iterable);\n if (typeof iterFn != 'function') throw TypeError('Target is not iterable');\n // optimisation for array iterators\n if (isArrayIteratorMethod(iterFn)) {\n for (index = 0, length = toLength(iterable.length); length > index; index++) {\n result = AS_ENTRIES\n ? boundFunction(anObject(step = iterable[index])[0], step[1])\n : boundFunction(iterable[index]);\n if (result && result instanceof Result) return result;\n } return new Result(false);\n }\n iterator = iterFn.call(iterable);\n }\n\n next = iterator.next;\n while (!(step = next.call(iterator)).done) {\n result = callWithSafeIterationClosing(iterator, boundFunction, step.value, AS_ENTRIES);\n if (typeof result == 'object' && result && result instanceof Result) return result;\n } return new Result(false);\n};\n\niterate.stop = function (result) {\n return new Result(true, result);\n};\n","'use strict';\nvar $ = require('../internals/export');\nvar global = require('../internals/global');\nvar isForced = require('../internals/is-forced');\nvar redefine = require('../internals/redefine');\nvar InternalMetadataModule = require('../internals/internal-metadata');\nvar iterate = require('../internals/iterate');\nvar anInstance = require('../internals/an-instance');\nvar isObject = require('../internals/is-object');\nvar fails = require('../internals/fails');\nvar checkCorrectnessOfIteration = require('../internals/check-correctness-of-iteration');\nvar setToStringTag = require('../internals/set-to-string-tag');\nvar inheritIfRequired = require('../internals/inherit-if-required');\n\nmodule.exports = function (CONSTRUCTOR_NAME, wrapper, common) {\n var IS_MAP = CONSTRUCTOR_NAME.indexOf('Map') !== -1;\n var IS_WEAK = CONSTRUCTOR_NAME.indexOf('Weak') !== -1;\n var ADDER = IS_MAP ? 'set' : 'add';\n var NativeConstructor = global[CONSTRUCTOR_NAME];\n var NativePrototype = NativeConstructor && NativeConstructor.prototype;\n var Constructor = NativeConstructor;\n var exported = {};\n\n var fixMethod = function (KEY) {\n var nativeMethod = NativePrototype[KEY];\n redefine(NativePrototype, KEY,\n KEY == 'add' ? function add(value) {\n nativeMethod.call(this, value === 0 ? 0 : value);\n return this;\n } : KEY == 'delete' ? function (key) {\n return IS_WEAK && !isObject(key) ? false : nativeMethod.call(this, key === 0 ? 0 : key);\n } : KEY == 'get' ? function get(key) {\n return IS_WEAK && !isObject(key) ? undefined : nativeMethod.call(this, key === 0 ? 0 : key);\n } : KEY == 'has' ? function has(key) {\n return IS_WEAK && !isObject(key) ? false : nativeMethod.call(this, key === 0 ? 0 : key);\n } : function set(key, value) {\n nativeMethod.call(this, key === 0 ? 0 : key, value);\n return this;\n }\n );\n };\n\n // eslint-disable-next-line max-len\n if (isForced(CONSTRUCTOR_NAME, typeof NativeConstructor != 'function' || !(IS_WEAK || NativePrototype.forEach && !fails(function () {\n new NativeConstructor().entries().next();\n })))) {\n // create collection constructor\n Constructor = common.getConstructor(wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER);\n InternalMetadataModule.REQUIRED = true;\n } else if (isForced(CONSTRUCTOR_NAME, true)) {\n var instance = new Constructor();\n // early implementations not supports chaining\n var HASNT_CHAINING = instance[ADDER](IS_WEAK ? {} : -0, 1) != instance;\n // V8 ~ Chromium 40- weak-collections throws on primitives, but should return false\n var THROWS_ON_PRIMITIVES = fails(function () { instance.has(1); });\n // most early implementations doesn't supports iterables, most modern - not close it correctly\n // eslint-disable-next-line no-new\n var ACCEPT_ITERABLES = checkCorrectnessOfIteration(function (iterable) { new NativeConstructor(iterable); });\n // for early implementations -0 and +0 not the same\n var BUGGY_ZERO = !IS_WEAK && fails(function () {\n // V8 ~ Chromium 42- fails only with 5+ elements\n var $instance = new NativeConstructor();\n var index = 5;\n while (index--) $instance[ADDER](index, index);\n return !$instance.has(-0);\n });\n\n if (!ACCEPT_ITERABLES) {\n Constructor = wrapper(function (dummy, iterable) {\n anInstance(dummy, Constructor, CONSTRUCTOR_NAME);\n var that = inheritIfRequired(new NativeConstructor(), dummy, Constructor);\n if (iterable != undefined) iterate(iterable, that[ADDER], that, IS_MAP);\n return that;\n });\n Constructor.prototype = NativePrototype;\n NativePrototype.constructor = Constructor;\n }\n\n if (THROWS_ON_PRIMITIVES || BUGGY_ZERO) {\n fixMethod('delete');\n fixMethod('has');\n IS_MAP && fixMethod('get');\n }\n\n if (BUGGY_ZERO || HASNT_CHAINING) fixMethod(ADDER);\n\n // weak collections should not contains .clear method\n if (IS_WEAK && NativePrototype.clear) delete NativePrototype.clear;\n }\n\n exported[CONSTRUCTOR_NAME] = Constructor;\n $({ global: true, forced: Constructor != NativeConstructor }, exported);\n\n setToStringTag(Constructor, CONSTRUCTOR_NAME);\n\n if (!IS_WEAK) common.setStrong(Constructor, CONSTRUCTOR_NAME, IS_MAP);\n\n return Constructor;\n};\n","'use strict';\nvar redefineAll = require('../internals/redefine-all');\nvar getWeakData = require('../internals/internal-metadata').getWeakData;\nvar anObject = require('../internals/an-object');\nvar isObject = require('../internals/is-object');\nvar anInstance = require('../internals/an-instance');\nvar iterate = require('../internals/iterate');\nvar ArrayIterationModule = require('../internals/array-iteration');\nvar $has = require('../internals/has');\nvar InternalStateModule = require('../internals/internal-state');\n\nvar setInternalState = InternalStateModule.set;\nvar internalStateGetterFor = InternalStateModule.getterFor;\nvar find = ArrayIterationModule.find;\nvar findIndex = ArrayIterationModule.findIndex;\nvar id = 0;\n\n// fallback for uncaught frozen keys\nvar uncaughtFrozenStore = function (store) {\n return store.frozen || (store.frozen = new UncaughtFrozenStore());\n};\n\nvar UncaughtFrozenStore = function () {\n this.entries = [];\n};\n\nvar findUncaughtFrozen = function (store, key) {\n return find(store.entries, function (it) {\n return it[0] === key;\n });\n};\n\nUncaughtFrozenStore.prototype = {\n get: function (key) {\n var entry = findUncaughtFrozen(this, key);\n if (entry) return entry[1];\n },\n has: function (key) {\n return !!findUncaughtFrozen(this, key);\n },\n set: function (key, value) {\n var entry = findUncaughtFrozen(this, key);\n if (entry) entry[1] = value;\n else this.entries.push([key, value]);\n },\n 'delete': function (key) {\n var index = findIndex(this.entries, function (it) {\n return it[0] === key;\n });\n if (~index) this.entries.splice(index, 1);\n return !!~index;\n }\n};\n\nmodule.exports = {\n getConstructor: function (wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER) {\n var C = wrapper(function (that, iterable) {\n anInstance(that, C, CONSTRUCTOR_NAME);\n setInternalState(that, {\n type: CONSTRUCTOR_NAME,\n id: id++,\n frozen: undefined\n });\n if (iterable != undefined) iterate(iterable, that[ADDER], that, IS_MAP);\n });\n\n var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME);\n\n var define = function (that, key, value) {\n var state = getInternalState(that);\n var data = getWeakData(anObject(key), true);\n if (data === true) uncaughtFrozenStore(state).set(key, value);\n else data[state.id] = value;\n return that;\n };\n\n redefineAll(C.prototype, {\n // 23.3.3.2 WeakMap.prototype.delete(key)\n // 23.4.3.3 WeakSet.prototype.delete(value)\n 'delete': function (key) {\n var state = getInternalState(this);\n if (!isObject(key)) return false;\n var data = getWeakData(key);\n if (data === true) return uncaughtFrozenStore(state)['delete'](key);\n return data && $has(data, state.id) && delete data[state.id];\n },\n // 23.3.3.4 WeakMap.prototype.has(key)\n // 23.4.3.4 WeakSet.prototype.has(value)\n has: function has(key) {\n var state = getInternalState(this);\n if (!isObject(key)) return false;\n var data = getWeakData(key);\n if (data === true) return uncaughtFrozenStore(state).has(key);\n return data && $has(data, state.id);\n }\n });\n\n redefineAll(C.prototype, IS_MAP ? {\n // 23.3.3.3 WeakMap.prototype.get(key)\n get: function get(key) {\n var state = getInternalState(this);\n if (isObject(key)) {\n var data = getWeakData(key);\n if (data === true) return uncaughtFrozenStore(state).get(key);\n return data ? data[state.id] : undefined;\n }\n },\n // 23.3.3.5 WeakMap.prototype.set(key, value)\n set: function set(key, value) {\n return define(this, key, value);\n }\n } : {\n // 23.4.3.1 WeakSet.prototype.add(value)\n add: function add(value) {\n return define(this, value, true);\n }\n });\n\n return C;\n }\n};\n","'use strict';\nvar global = require('../internals/global');\nvar redefineAll = require('../internals/redefine-all');\nvar InternalMetadataModule = require('../internals/internal-metadata');\nvar collection = require('../internals/collection');\nvar collectionWeak = require('../internals/collection-weak');\nvar isObject = require('../internals/is-object');\nvar enforceIternalState = require('../internals/internal-state').enforce;\nvar NATIVE_WEAK_MAP = require('../internals/native-weak-map');\n\nvar IS_IE11 = !global.ActiveXObject && 'ActiveXObject' in global;\nvar isExtensible = Object.isExtensible;\nvar InternalWeakMap;\n\nvar wrapper = function (init) {\n return function WeakMap() {\n return init(this, arguments.length ? arguments[0] : undefined);\n };\n};\n\n// `WeakMap` constructor\n// https://tc39.github.io/ecma262/#sec-weakmap-constructor\nvar $WeakMap = module.exports = collection('WeakMap', wrapper, collectionWeak);\n\n// IE11 WeakMap frozen keys fix\n// We can't use feature detection because it crash some old IE builds\n// https://github.com/zloirock/core-js/issues/485\nif (NATIVE_WEAK_MAP && IS_IE11) {\n InternalWeakMap = collectionWeak.getConstructor(wrapper, 'WeakMap', true);\n InternalMetadataModule.REQUIRED = true;\n var WeakMapPrototype = $WeakMap.prototype;\n var nativeDelete = WeakMapPrototype['delete'];\n var nativeHas = WeakMapPrototype.has;\n var nativeGet = WeakMapPrototype.get;\n var nativeSet = WeakMapPrototype.set;\n redefineAll(WeakMapPrototype, {\n 'delete': function (key) {\n if (isObject(key) && !isExtensible(key)) {\n var state = enforceIternalState(this);\n if (!state.frozen) state.frozen = new InternalWeakMap();\n return nativeDelete.call(this, key) || state.frozen['delete'](key);\n } return nativeDelete.call(this, key);\n },\n has: function has(key) {\n if (isObject(key) && !isExtensible(key)) {\n var state = enforceIternalState(this);\n if (!state.frozen) state.frozen = new InternalWeakMap();\n return nativeHas.call(this, key) || state.frozen.has(key);\n } return nativeHas.call(this, key);\n },\n get: function get(key) {\n if (isObject(key) && !isExtensible(key)) {\n var state = enforceIternalState(this);\n if (!state.frozen) state.frozen = new InternalWeakMap();\n return nativeHas.call(this, key) ? nativeGet.call(this, key) : state.frozen.get(key);\n } return nativeGet.call(this, key);\n },\n set: function set(key, value) {\n if (isObject(key) && !isExtensible(key)) {\n var state = enforceIternalState(this);\n if (!state.frozen) state.frozen = new InternalWeakMap();\n nativeHas.call(this, key) ? nativeSet.call(this, key, value) : state.frozen.set(key, value);\n } else nativeSet.call(this, key, value);\n return this;\n }\n });\n}\n","'use strict';\nvar $ = require('../internals/export');\nvar $every = require('../internals/array-iteration').every;\nvar arrayMethodIsStrict = require('../internals/array-method-is-strict');\nvar arrayMethodUsesToLength = require('../internals/array-method-uses-to-length');\n\nvar STRICT_METHOD = arrayMethodIsStrict('every');\nvar USES_TO_LENGTH = arrayMethodUsesToLength('every');\n\n// `Array.prototype.every` method\n// https://tc39.github.io/ecma262/#sec-array.prototype.every\n$({ target: 'Array', proto: true, forced: !STRICT_METHOD || !USES_TO_LENGTH }, {\n every: function every(callbackfn /* , thisArg */) {\n return $every(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);\n }\n});\n","var $ = require('../internals/export');\nvar assign = require('../internals/object-assign');\n\n// `Object.assign` method\n// https://tc39.github.io/ecma262/#sec-object.assign\n$({ target: 'Object', stat: true, forced: Object.assign !== assign }, {\n assign: assign\n});\n","var fails = require('../internals/fails');\nvar whitespaces = require('../internals/whitespaces');\n\nvar non = '\\u200B\\u0085\\u180E';\n\n// check that a method works with the correct list\n// of whitespaces and has a correct name\nmodule.exports = function (METHOD_NAME) {\n return fails(function () {\n return !!whitespaces[METHOD_NAME]() || non[METHOD_NAME]() != non || whitespaces[METHOD_NAME].name !== METHOD_NAME;\n });\n};\n","'use strict';\nvar $ = require('../internals/export');\nvar $trim = require('../internals/string-trim').trim;\nvar forcedStringTrimMethod = require('../internals/string-trim-forced');\n\n// `String.prototype.trim` method\n// https://tc39.github.io/ecma262/#sec-string.prototype.trim\n$({ target: 'String', proto: true, forced: forcedStringTrimMethod('trim') }, {\n trim: function trim() {\n return $trim(this);\n }\n});\n","'use strict';\nvar $ = require('../internals/export');\nvar $some = require('../internals/array-iteration').some;\nvar arrayMethodIsStrict = require('../internals/array-method-is-strict');\nvar arrayMethodUsesToLength = require('../internals/array-method-uses-to-length');\n\nvar STRICT_METHOD = arrayMethodIsStrict('some');\nvar USES_TO_LENGTH = arrayMethodUsesToLength('some');\n\n// `Array.prototype.some` method\n// https://tc39.github.io/ecma262/#sec-array.prototype.some\n$({ target: 'Array', proto: true, forced: !STRICT_METHOD || !USES_TO_LENGTH }, {\n some: function some(callbackfn /* , thisArg */) {\n return $some(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);\n }\n});\n","var classof = require('../internals/classof-raw');\n\n// `thisNumberValue` abstract operation\n// https://tc39.github.io/ecma262/#sec-thisnumbervalue\nmodule.exports = function (value) {\n if (typeof value != 'number' && classof(value) != 'Number') {\n throw TypeError('Incorrect invocation');\n }\n return +value;\n};\n","'use strict';\nvar toInteger = require('../internals/to-integer');\nvar requireObjectCoercible = require('../internals/require-object-coercible');\n\n// `String.prototype.repeat` method implementation\n// https://tc39.github.io/ecma262/#sec-string.prototype.repeat\nmodule.exports = ''.repeat || function repeat(count) {\n var str = String(requireObjectCoercible(this));\n var result = '';\n var n = toInteger(count);\n if (n < 0 || n == Infinity) throw RangeError('Wrong number of repetitions');\n for (;n > 0; (n >>>= 1) && (str += str)) if (n & 1) result += str;\n return result;\n};\n","'use strict';\nvar $ = require('../internals/export');\nvar toInteger = require('../internals/to-integer');\nvar thisNumberValue = require('../internals/this-number-value');\nvar repeat = require('../internals/string-repeat');\nvar fails = require('../internals/fails');\n\nvar nativeToFixed = 1.0.toFixed;\nvar floor = Math.floor;\n\nvar pow = function (x, n, acc) {\n return n === 0 ? acc : n % 2 === 1 ? pow(x, n - 1, acc * x) : pow(x * x, n / 2, acc);\n};\n\nvar log = function (x) {\n var n = 0;\n var x2 = x;\n while (x2 >= 4096) {\n n += 12;\n x2 /= 4096;\n }\n while (x2 >= 2) {\n n += 1;\n x2 /= 2;\n } return n;\n};\n\nvar FORCED = nativeToFixed && (\n 0.00008.toFixed(3) !== '0.000' ||\n 0.9.toFixed(0) !== '1' ||\n 1.255.toFixed(2) !== '1.25' ||\n 1000000000000000128.0.toFixed(0) !== '1000000000000000128'\n) || !fails(function () {\n // V8 ~ Android 4.3-\n nativeToFixed.call({});\n});\n\n// `Number.prototype.toFixed` method\n// https://tc39.github.io/ecma262/#sec-number.prototype.tofixed\n$({ target: 'Number', proto: true, forced: FORCED }, {\n // eslint-disable-next-line max-statements\n toFixed: function toFixed(fractionDigits) {\n var number = thisNumberValue(this);\n var fractDigits = toInteger(fractionDigits);\n var data = [0, 0, 0, 0, 0, 0];\n var sign = '';\n var result = '0';\n var e, z, j, k;\n\n var multiply = function (n, c) {\n var index = -1;\n var c2 = c;\n while (++index < 6) {\n c2 += n * data[index];\n data[index] = c2 % 1e7;\n c2 = floor(c2 / 1e7);\n }\n };\n\n var divide = function (n) {\n var index = 6;\n var c = 0;\n while (--index >= 0) {\n c += data[index];\n data[index] = floor(c / n);\n c = (c % n) * 1e7;\n }\n };\n\n var dataToString = function () {\n var index = 6;\n var s = '';\n while (--index >= 0) {\n if (s !== '' || index === 0 || data[index] !== 0) {\n var t = String(data[index]);\n s = s === '' ? t : s + repeat.call('0', 7 - t.length) + t;\n }\n } return s;\n };\n\n if (fractDigits < 0 || fractDigits > 20) throw RangeError('Incorrect fraction digits');\n // eslint-disable-next-line no-self-compare\n if (number != number) return 'NaN';\n if (number <= -1e21 || number >= 1e21) return String(number);\n if (number < 0) {\n sign = '-';\n number = -number;\n }\n if (number > 1e-21) {\n e = log(number * pow(2, 69, 1)) - 69;\n z = e < 0 ? number * pow(2, -e, 1) : number / pow(2, e, 1);\n z *= 0x10000000000000;\n e = 52 - e;\n if (e > 0) {\n multiply(0, z);\n j = fractDigits;\n while (j >= 7) {\n multiply(1e7, 0);\n j -= 7;\n }\n multiply(pow(10, j, 1), 0);\n j = e - 1;\n while (j >= 23) {\n divide(1 << 23);\n j -= 23;\n }\n divide(1 << j);\n multiply(1, 1);\n divide(2);\n result = dataToString();\n } else {\n multiply(0, z);\n multiply(1 << -e, 0);\n result = dataToString() + repeat.call('0', fractDigits);\n }\n }\n if (fractDigits > 0) {\n k = result.length;\n result = sign + (k <= fractDigits\n ? '0.' + repeat.call('0', fractDigits - k) + result\n : result.slice(0, k - fractDigits) + '.' + result.slice(k - fractDigits));\n } else {\n result = sign + result;\n } return result;\n }\n});\n","var DESCRIPTORS = require('../internals/descriptors');\nvar objectKeys = require('../internals/object-keys');\nvar toIndexedObject = require('../internals/to-indexed-object');\nvar propertyIsEnumerable = require('../internals/object-property-is-enumerable').f;\n\n// `Object.{ entries, values }` methods implementation\nvar createMethod = function (TO_ENTRIES) {\n return function (it) {\n var O = toIndexedObject(it);\n var keys = objectKeys(O);\n var length = keys.length;\n var i = 0;\n var result = [];\n var key;\n while (length > i) {\n key = keys[i++];\n if (!DESCRIPTORS || propertyIsEnumerable.call(O, key)) {\n result.push(TO_ENTRIES ? [key, O[key]] : O[key]);\n }\n }\n return result;\n };\n};\n\nmodule.exports = {\n // `Object.entries` method\n // https://tc39.github.io/ecma262/#sec-object.entries\n entries: createMethod(true),\n // `Object.values` method\n // https://tc39.github.io/ecma262/#sec-object.values\n values: createMethod(false)\n};\n","var $ = require('../internals/export');\nvar $entries = require('../internals/object-to-array').entries;\n\n// `Object.entries` method\n// https://tc39.github.io/ecma262/#sec-object.entries\n$({ target: 'Object', stat: true }, {\n entries: function entries(O) {\n return $entries(O);\n }\n});\n","var $ = require('../internals/export');\nvar $values = require('../internals/object-to-array').values;\n\n// `Object.values` method\n// https://tc39.github.io/ecma262/#sec-object.values\n$({ target: 'Object', stat: true }, {\n values: function values(O) {\n return $values(O);\n }\n});\n","var $ = require('../internals/export');\n\n// `Number.isNaN` method\n// https://tc39.github.io/ecma262/#sec-number.isnan\n$({ target: 'Number', stat: true }, {\n isNaN: function isNaN(number) {\n // eslint-disable-next-line no-self-compare\n return number != number;\n }\n});\n","var $ = require('../internals/export');\nvar fails = require('../internals/fails');\nvar toIndexedObject = require('../internals/to-indexed-object');\nvar nativeGetOwnPropertyDescriptor = require('../internals/object-get-own-property-descriptor').f;\nvar DESCRIPTORS = require('../internals/descriptors');\n\nvar FAILS_ON_PRIMITIVES = fails(function () { nativeGetOwnPropertyDescriptor(1); });\nvar FORCED = !DESCRIPTORS || FAILS_ON_PRIMITIVES;\n\n// `Object.getOwnPropertyDescriptor` method\n// https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptor\n$({ target: 'Object', stat: true, forced: FORCED, sham: !DESCRIPTORS }, {\n getOwnPropertyDescriptor: function getOwnPropertyDescriptor(it, key) {\n return nativeGetOwnPropertyDescriptor(toIndexedObject(it), key);\n }\n});\n","function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError(\"Cannot call a class as a function\")}function _defineProperties(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,\"value\"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function _createClass(e,t,n){return t&&_defineProperties(e.prototype,t),n&&_defineProperties(e,n),e}function _defineProperty(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ownKeys(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function _objectSpread2(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(n),!0).forEach((function(t){_defineProperty(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ownKeys(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var defaults={addCSS:!0,thumbWidth:15,watch:!0};function matches(e,t){return function(){return Array.from(document.querySelectorAll(t)).includes(this)}.call(e,t)}function trigger(e,t){if(e&&t){var n=new Event(t,{bubbles:!0});e.dispatchEvent(n)}}var getConstructor=function(e){return null!=e?e.constructor:null},instanceOf=function(e,t){return!!(e&&t&&e instanceof t)},isNullOrUndefined=function(e){return null==e},isObject=function(e){return getConstructor(e)===Object},isNumber=function(e){return getConstructor(e)===Number&&!Number.isNaN(e)},isString=function(e){return getConstructor(e)===String},isBoolean=function(e){return getConstructor(e)===Boolean},isFunction=function(e){return getConstructor(e)===Function},isArray=function(e){return Array.isArray(e)},isNodeList=function(e){return instanceOf(e,NodeList)},isElement=function(e){return instanceOf(e,Element)},isEvent=function(e){return instanceOf(e,Event)},isEmpty=function(e){return isNullOrUndefined(e)||(isString(e)||isArray(e)||isNodeList(e))&&!e.length||isObject(e)&&!Object.keys(e).length},is={nullOrUndefined:isNullOrUndefined,object:isObject,number:isNumber,string:isString,boolean:isBoolean,function:isFunction,array:isArray,nodeList:isNodeList,element:isElement,event:isEvent,empty:isEmpty};function getDecimalPlaces(e){var t=\"\".concat(e).match(/(?:\\.(\\d+))?(?:[eE]([+-]?\\d+))?$/);return t?Math.max(0,(t[1]?t[1].length:0)-(t[2]?+t[2]:0)):0}function round(e,t){if(1>t){var n=getDecimalPlaces(t);return parseFloat(e.toFixed(n))}return Math.round(e/t)*t}var RangeTouch=function(){function e(t,n){_classCallCheck(this,e),is.element(t)?this.element=t:is.string(t)&&(this.element=document.querySelector(t)),is.element(this.element)&&is.empty(this.element.rangeTouch)&&(this.config=_objectSpread2({},defaults,{},n),this.init())}return _createClass(e,[{key:\"init\",value:function(){e.enabled&&(this.config.addCSS&&(this.element.style.userSelect=\"none\",this.element.style.webKitUserSelect=\"none\",this.element.style.touchAction=\"manipulation\"),this.listeners(!0),this.element.rangeTouch=this)}},{key:\"destroy\",value:function(){e.enabled&&(this.config.addCSS&&(this.element.style.userSelect=\"\",this.element.style.webKitUserSelect=\"\",this.element.style.touchAction=\"\"),this.listeners(!1),this.element.rangeTouch=null)}},{key:\"listeners\",value:function(e){var t=this,n=e?\"addEventListener\":\"removeEventListener\";[\"touchstart\",\"touchmove\",\"touchend\"].forEach((function(e){t.element[n](e,(function(e){return t.set(e)}),!1)}))}},{key:\"get\",value:function(t){if(!e.enabled||!is.event(t))return null;var n,r=t.target,i=t.changedTouches[0],o=parseFloat(r.getAttribute(\"min\"))||0,s=parseFloat(r.getAttribute(\"max\"))||100,u=parseFloat(r.getAttribute(\"step\"))||1,c=r.getBoundingClientRect(),a=100/c.width*(this.config.thumbWidth/2)/100;return 0>(n=100/c.width*(i.clientX-c.left))?n=0:100<n&&(n=100),50>n?n-=(100-2*n)*a:50<n&&(n+=2*(n-50)*a),o+round(n/100*(s-o),u)}},{key:\"set\",value:function(t){e.enabled&&is.event(t)&&!t.target.disabled&&(t.preventDefault(),t.target.value=this.get(t),trigger(t.target,\"touchend\"===t.type?\"change\":\"input\"))}}],[{key:\"setup\",value:function(t){var n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},r=null;if(is.empty(t)||is.string(t)?r=Array.from(document.querySelectorAll(is.string(t)?t:'input[type=\"range\"]')):is.element(t)?r=[t]:is.nodeList(t)?r=Array.from(t):is.array(t)&&(r=t.filter(is.element)),is.empty(r))return null;var i=_objectSpread2({},defaults,{},n);if(is.string(t)&&i.watch){var o=new MutationObserver((function(n){Array.from(n).forEach((function(n){Array.from(n.addedNodes).forEach((function(n){is.element(n)&&matches(n,t)&&new e(n,i)}))}))}));o.observe(document.body,{childList:!0,subtree:!0})}return r.map((function(t){return new e(t,n)}))}},{key:\"enabled\",get:function(){return\"ontouchstart\"in document.documentElement}}]),e}();export default RangeTouch;","var $ = require('../internals/export');\nvar DESCRIPTORS = require('../internals/descriptors');\nvar ownKeys = require('../internals/own-keys');\nvar toIndexedObject = require('../internals/to-indexed-object');\nvar getOwnPropertyDescriptorModule = require('../internals/object-get-own-property-descriptor');\nvar createProperty = require('../internals/create-property');\n\n// `Object.getOwnPropertyDescriptors` method\n// https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptors\n$({ target: 'Object', stat: true, sham: !DESCRIPTORS }, {\n getOwnPropertyDescriptors: function getOwnPropertyDescriptors(object) {\n var O = toIndexedObject(object);\n var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;\n var keys = ownKeys(O);\n var result = {};\n var index = 0;\n var key, descriptor;\n while (keys.length > index) {\n descriptor = getOwnPropertyDescriptor(O, key = keys[index++]);\n if (descriptor !== undefined) createProperty(result, key, descriptor);\n }\n return result;\n }\n});\n","'use strict';\nvar fixRegExpWellKnownSymbolLogic = require('../internals/fix-regexp-well-known-symbol-logic');\nvar anObject = require('../internals/an-object');\nvar toLength = require('../internals/to-length');\nvar requireObjectCoercible = require('../internals/require-object-coercible');\nvar advanceStringIndex = require('../internals/advance-string-index');\nvar regExpExec = require('../internals/regexp-exec-abstract');\n\n// @@match logic\nfixRegExpWellKnownSymbolLogic('match', 1, function (MATCH, nativeMatch, maybeCallNative) {\n return [\n // `String.prototype.match` method\n // https://tc39.github.io/ecma262/#sec-string.prototype.match\n function match(regexp) {\n var O = requireObjectCoercible(this);\n var matcher = regexp == undefined ? undefined : regexp[MATCH];\n return matcher !== undefined ? matcher.call(regexp, O) : new RegExp(regexp)[MATCH](String(O));\n },\n // `RegExp.prototype[@@match]` method\n // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@match\n function (regexp) {\n var res = maybeCallNative(nativeMatch, regexp, this);\n if (res.done) return res.value;\n\n var rx = anObject(regexp);\n var S = String(this);\n\n if (!rx.global) return regExpExec(rx, S);\n\n var fullUnicode = rx.unicode;\n rx.lastIndex = 0;\n var A = [];\n var n = 0;\n var result;\n while ((result = regExpExec(rx, S)) !== null) {\n var matchStr = String(result[0]);\n A[n] = matchStr;\n if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);\n n++;\n }\n return n === 0 ? null : A;\n }\n ];\n});\n","var global = require('../internals/global');\nvar fails = require('../internals/fails');\nvar classof = require('../internals/classof-raw');\nvar bind = require('../internals/function-bind-context');\nvar html = require('../internals/html');\nvar createElement = require('../internals/document-create-element');\nvar IS_IOS = require('../internals/engine-is-ios');\n\nvar location = global.location;\nvar set = global.setImmediate;\nvar clear = global.clearImmediate;\nvar process = global.process;\nvar MessageChannel = global.MessageChannel;\nvar Dispatch = global.Dispatch;\nvar counter = 0;\nvar queue = {};\nvar ONREADYSTATECHANGE = 'onreadystatechange';\nvar defer, channel, port;\n\nvar run = function (id) {\n // eslint-disable-next-line no-prototype-builtins\n if (queue.hasOwnProperty(id)) {\n var fn = queue[id];\n delete queue[id];\n fn();\n }\n};\n\nvar runner = function (id) {\n return function () {\n run(id);\n };\n};\n\nvar listener = function (event) {\n run(event.data);\n};\n\nvar post = function (id) {\n // old engines have not location.origin\n global.postMessage(id + '', location.protocol + '//' + location.host);\n};\n\n// Node.js 0.9+ & IE10+ has setImmediate, otherwise:\nif (!set || !clear) {\n set = function setImmediate(fn) {\n var args = [];\n var i = 1;\n while (arguments.length > i) args.push(arguments[i++]);\n queue[++counter] = function () {\n // eslint-disable-next-line no-new-func\n (typeof fn == 'function' ? fn : Function(fn)).apply(undefined, args);\n };\n defer(counter);\n return counter;\n };\n clear = function clearImmediate(id) {\n delete queue[id];\n };\n // Node.js 0.8-\n if (classof(process) == 'process') {\n defer = function (id) {\n process.nextTick(runner(id));\n };\n // Sphere (JS game engine) Dispatch API\n } else if (Dispatch && Dispatch.now) {\n defer = function (id) {\n Dispatch.now(runner(id));\n };\n // Browsers with MessageChannel, includes WebWorkers\n // except iOS - https://github.com/zloirock/core-js/issues/624\n } else if (MessageChannel && !IS_IOS) {\n channel = new MessageChannel();\n port = channel.port2;\n channel.port1.onmessage = listener;\n defer = bind(port.postMessage, port, 1);\n // Browsers with postMessage, skip WebWorkers\n // IE8 has postMessage, but it's sync & typeof its postMessage is 'object'\n } else if (\n global.addEventListener &&\n typeof postMessage == 'function' &&\n !global.importScripts &&\n !fails(post) &&\n location.protocol !== 'file:'\n ) {\n defer = post;\n global.addEventListener('message', listener, false);\n // IE8-\n } else if (ONREADYSTATECHANGE in createElement('script')) {\n defer = function (id) {\n html.appendChild(createElement('script'))[ONREADYSTATECHANGE] = function () {\n html.removeChild(this);\n run(id);\n };\n };\n // Rest old browsers\n } else {\n defer = function (id) {\n setTimeout(runner(id), 0);\n };\n }\n}\n\nmodule.exports = {\n set: set,\n clear: clear\n};\n","var global = require('../internals/global');\n\nmodule.exports = global.Promise;\n","'use strict';\nvar getBuiltIn = require('../internals/get-built-in');\nvar definePropertyModule = require('../internals/object-define-property');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\nvar DESCRIPTORS = require('../internals/descriptors');\n\nvar SPECIES = wellKnownSymbol('species');\n\nmodule.exports = function (CONSTRUCTOR_NAME) {\n var Constructor = getBuiltIn(CONSTRUCTOR_NAME);\n var defineProperty = definePropertyModule.f;\n\n if (DESCRIPTORS && Constructor && !Constructor[SPECIES]) {\n defineProperty(Constructor, SPECIES, {\n configurable: true,\n get: function () { return this; }\n });\n }\n};\n","var userAgent = require('../internals/engine-user-agent');\n\nmodule.exports = /(iphone|ipod|ipad).*applewebkit/i.test(userAgent);\n","var global = require('../internals/global');\nvar getOwnPropertyDescriptor = require('../internals/object-get-own-property-descriptor').f;\nvar classof = require('../internals/classof-raw');\nvar macrotask = require('../internals/task').set;\nvar IS_IOS = require('../internals/engine-is-ios');\n\nvar MutationObserver = global.MutationObserver || global.WebKitMutationObserver;\nvar process = global.process;\nvar Promise = global.Promise;\nvar IS_NODE = classof(process) == 'process';\n// Node.js 11 shows ExperimentalWarning on getting `queueMicrotask`\nvar queueMicrotaskDescriptor = getOwnPropertyDescriptor(global, 'queueMicrotask');\nvar queueMicrotask = queueMicrotaskDescriptor && queueMicrotaskDescriptor.value;\n\nvar flush, head, last, notify, toggle, node, promise, then;\n\n// modern engines have queueMicrotask method\nif (!queueMicrotask) {\n flush = function () {\n var parent, fn;\n if (IS_NODE && (parent = process.domain)) parent.exit();\n while (head) {\n fn = head.fn;\n head = head.next;\n try {\n fn();\n } catch (error) {\n if (head) notify();\n else last = undefined;\n throw error;\n }\n } last = undefined;\n if (parent) parent.enter();\n };\n\n // Node.js\n if (IS_NODE) {\n notify = function () {\n process.nextTick(flush);\n };\n // browsers with MutationObserver, except iOS - https://github.com/zloirock/core-js/issues/339\n } else if (MutationObserver && !IS_IOS) {\n toggle = true;\n node = document.createTextNode('');\n new MutationObserver(flush).observe(node, { characterData: true });\n notify = function () {\n node.data = toggle = !toggle;\n };\n // environments with maybe non-completely correct, but existent Promise\n } else if (Promise && Promise.resolve) {\n // Promise.resolve without an argument throws an error in LG WebOS 2\n promise = Promise.resolve(undefined);\n then = promise.then;\n notify = function () {\n then.call(promise, flush);\n };\n // for other environments - macrotask based on:\n // - setImmediate\n // - MessageChannel\n // - window.postMessag\n // - onreadystatechange\n // - setTimeout\n } else {\n notify = function () {\n // strange IE + webpack dev server bug - use .call(global)\n macrotask.call(global, flush);\n };\n }\n}\n\nmodule.exports = queueMicrotask || function (fn) {\n var task = { fn: fn, next: undefined };\n if (last) last.next = task;\n if (!head) {\n head = task;\n notify();\n } last = task;\n};\n","'use strict';\nvar $ = require('../internals/export');\nvar IS_PURE = require('../internals/is-pure');\nvar global = require('../internals/global');\nvar getBuiltIn = require('../internals/get-built-in');\nvar NativePromise = require('../internals/native-promise-constructor');\nvar redefine = require('../internals/redefine');\nvar redefineAll = require('../internals/redefine-all');\nvar setToStringTag = require('../internals/set-to-string-tag');\nvar setSpecies = require('../internals/set-species');\nvar isObject = require('../internals/is-object');\nvar aFunction = require('../internals/a-function');\nvar anInstance = require('../internals/an-instance');\nvar classof = require('../internals/classof-raw');\nvar inspectSource = require('../internals/inspect-source');\nvar iterate = require('../internals/iterate');\nvar checkCorrectnessOfIteration = require('../internals/check-correctness-of-iteration');\nvar speciesConstructor = require('../internals/species-constructor');\nvar task = require('../internals/task').set;\nvar microtask = require('../internals/microtask');\nvar promiseResolve = require('../internals/promise-resolve');\nvar hostReportErrors = require('../internals/host-report-errors');\nvar newPromiseCapabilityModule = require('../internals/new-promise-capability');\nvar perform = require('../internals/perform');\nvar InternalStateModule = require('../internals/internal-state');\nvar isForced = require('../internals/is-forced');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\nvar V8_VERSION = require('../internals/engine-v8-version');\n\nvar SPECIES = wellKnownSymbol('species');\nvar PROMISE = 'Promise';\nvar getInternalState = InternalStateModule.get;\nvar setInternalState = InternalStateModule.set;\nvar getInternalPromiseState = InternalStateModule.getterFor(PROMISE);\nvar PromiseConstructor = NativePromise;\nvar TypeError = global.TypeError;\nvar document = global.document;\nvar process = global.process;\nvar $fetch = getBuiltIn('fetch');\nvar newPromiseCapability = newPromiseCapabilityModule.f;\nvar newGenericPromiseCapability = newPromiseCapability;\nvar IS_NODE = classof(process) == 'process';\nvar DISPATCH_EVENT = !!(document && document.createEvent && global.dispatchEvent);\nvar UNHANDLED_REJECTION = 'unhandledrejection';\nvar REJECTION_HANDLED = 'rejectionhandled';\nvar PENDING = 0;\nvar FULFILLED = 1;\nvar REJECTED = 2;\nvar HANDLED = 1;\nvar UNHANDLED = 2;\nvar Internal, OwnPromiseCapability, PromiseWrapper, nativeThen;\n\nvar FORCED = isForced(PROMISE, function () {\n var GLOBAL_CORE_JS_PROMISE = inspectSource(PromiseConstructor) !== String(PromiseConstructor);\n if (!GLOBAL_CORE_JS_PROMISE) {\n // V8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables\n // https://bugs.chromium.org/p/chromium/issues/detail?id=830565\n // We can't detect it synchronously, so just check versions\n if (V8_VERSION === 66) return true;\n // Unhandled rejections tracking support, NodeJS Promise without it fails @@species test\n if (!IS_NODE && typeof PromiseRejectionEvent != 'function') return true;\n }\n // We need Promise#finally in the pure version for preventing prototype pollution\n if (IS_PURE && !PromiseConstructor.prototype['finally']) return true;\n // We can't use @@species feature detection in V8 since it causes\n // deoptimization and performance degradation\n // https://github.com/zloirock/core-js/issues/679\n if (V8_VERSION >= 51 && /native code/.test(PromiseConstructor)) return false;\n // Detect correctness of subclassing with @@species support\n var promise = PromiseConstructor.resolve(1);\n var FakePromise = function (exec) {\n exec(function () { /* empty */ }, function () { /* empty */ });\n };\n var constructor = promise.constructor = {};\n constructor[SPECIES] = FakePromise;\n return !(promise.then(function () { /* empty */ }) instanceof FakePromise);\n});\n\nvar INCORRECT_ITERATION = FORCED || !checkCorrectnessOfIteration(function (iterable) {\n PromiseConstructor.all(iterable)['catch'](function () { /* empty */ });\n});\n\n// helpers\nvar isThenable = function (it) {\n var then;\n return isObject(it) && typeof (then = it.then) == 'function' ? then : false;\n};\n\nvar notify = function (promise, state, isReject) {\n if (state.notified) return;\n state.notified = true;\n var chain = state.reactions;\n microtask(function () {\n var value = state.value;\n var ok = state.state == FULFILLED;\n var index = 0;\n // variable length - can't use forEach\n while (chain.length > index) {\n var reaction = chain[index++];\n var handler = ok ? reaction.ok : reaction.fail;\n var resolve = reaction.resolve;\n var reject = reaction.reject;\n var domain = reaction.domain;\n var result, then, exited;\n try {\n if (handler) {\n if (!ok) {\n if (state.rejection === UNHANDLED) onHandleUnhandled(promise, state);\n state.rejection = HANDLED;\n }\n if (handler === true) result = value;\n else {\n if (domain) domain.enter();\n result = handler(value); // can throw\n if (domain) {\n domain.exit();\n exited = true;\n }\n }\n if (result === reaction.promise) {\n reject(TypeError('Promise-chain cycle'));\n } else if (then = isThenable(result)) {\n then.call(result, resolve, reject);\n } else resolve(result);\n } else reject(value);\n } catch (error) {\n if (domain && !exited) domain.exit();\n reject(error);\n }\n }\n state.reactions = [];\n state.notified = false;\n if (isReject && !state.rejection) onUnhandled(promise, state);\n });\n};\n\nvar dispatchEvent = function (name, promise, reason) {\n var event, handler;\n if (DISPATCH_EVENT) {\n event = document.createEvent('Event');\n event.promise = promise;\n event.reason = reason;\n event.initEvent(name, false, true);\n global.dispatchEvent(event);\n } else event = { promise: promise, reason: reason };\n if (handler = global['on' + name]) handler(event);\n else if (name === UNHANDLED_REJECTION) hostReportErrors('Unhandled promise rejection', reason);\n};\n\nvar onUnhandled = function (promise, state) {\n task.call(global, function () {\n var value = state.value;\n var IS_UNHANDLED = isUnhandled(state);\n var result;\n if (IS_UNHANDLED) {\n result = perform(function () {\n if (IS_NODE) {\n process.emit('unhandledRejection', value, promise);\n } else dispatchEvent(UNHANDLED_REJECTION, promise, value);\n });\n // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should\n state.rejection = IS_NODE || isUnhandled(state) ? UNHANDLED : HANDLED;\n if (result.error) throw result.value;\n }\n });\n};\n\nvar isUnhandled = function (state) {\n return state.rejection !== HANDLED && !state.parent;\n};\n\nvar onHandleUnhandled = function (promise, state) {\n task.call(global, function () {\n if (IS_NODE) {\n process.emit('rejectionHandled', promise);\n } else dispatchEvent(REJECTION_HANDLED, promise, state.value);\n });\n};\n\nvar bind = function (fn, promise, state, unwrap) {\n return function (value) {\n fn(promise, state, value, unwrap);\n };\n};\n\nvar internalReject = function (promise, state, value, unwrap) {\n if (state.done) return;\n state.done = true;\n if (unwrap) state = unwrap;\n state.value = value;\n state.state = REJECTED;\n notify(promise, state, true);\n};\n\nvar internalResolve = function (promise, state, value, unwrap) {\n if (state.done) return;\n state.done = true;\n if (unwrap) state = unwrap;\n try {\n if (promise === value) throw TypeError(\"Promise can't be resolved itself\");\n var then = isThenable(value);\n if (then) {\n microtask(function () {\n var wrapper = { done: false };\n try {\n then.call(value,\n bind(internalResolve, promise, wrapper, state),\n bind(internalReject, promise, wrapper, state)\n );\n } catch (error) {\n internalReject(promise, wrapper, error, state);\n }\n });\n } else {\n state.value = value;\n state.state = FULFILLED;\n notify(promise, state, false);\n }\n } catch (error) {\n internalReject(promise, { done: false }, error, state);\n }\n};\n\n// constructor polyfill\nif (FORCED) {\n // 25.4.3.1 Promise(executor)\n PromiseConstructor = function Promise(executor) {\n anInstance(this, PromiseConstructor, PROMISE);\n aFunction(executor);\n Internal.call(this);\n var state = getInternalState(this);\n try {\n executor(bind(internalResolve, this, state), bind(internalReject, this, state));\n } catch (error) {\n internalReject(this, state, error);\n }\n };\n // eslint-disable-next-line no-unused-vars\n Internal = function Promise(executor) {\n setInternalState(this, {\n type: PROMISE,\n done: false,\n notified: false,\n parent: false,\n reactions: [],\n rejection: false,\n state: PENDING,\n value: undefined\n });\n };\n Internal.prototype = redefineAll(PromiseConstructor.prototype, {\n // `Promise.prototype.then` method\n // https://tc39.github.io/ecma262/#sec-promise.prototype.then\n then: function then(onFulfilled, onRejected) {\n var state = getInternalPromiseState(this);\n var reaction = newPromiseCapability(speciesConstructor(this, PromiseConstructor));\n reaction.ok = typeof onFulfilled == 'function' ? onFulfilled : true;\n reaction.fail = typeof onRejected == 'function' && onRejected;\n reaction.domain = IS_NODE ? process.domain : undefined;\n state.parent = true;\n state.reactions.push(reaction);\n if (state.state != PENDING) notify(this, state, false);\n return reaction.promise;\n },\n // `Promise.prototype.catch` method\n // https://tc39.github.io/ecma262/#sec-promise.prototype.catch\n 'catch': function (onRejected) {\n return this.then(undefined, onRejected);\n }\n });\n OwnPromiseCapability = function () {\n var promise = new Internal();\n var state = getInternalState(promise);\n this.promise = promise;\n this.resolve = bind(internalResolve, promise, state);\n this.reject = bind(internalReject, promise, state);\n };\n newPromiseCapabilityModule.f = newPromiseCapability = function (C) {\n return C === PromiseConstructor || C === PromiseWrapper\n ? new OwnPromiseCapability(C)\n : newGenericPromiseCapability(C);\n };\n\n if (!IS_PURE && typeof NativePromise == 'function') {\n nativeThen = NativePromise.prototype.then;\n\n // wrap native Promise#then for native async functions\n redefine(NativePromise.prototype, 'then', function then(onFulfilled, onRejected) {\n var that = this;\n return new PromiseConstructor(function (resolve, reject) {\n nativeThen.call(that, resolve, reject);\n }).then(onFulfilled, onRejected);\n // https://github.com/zloirock/core-js/issues/640\n }, { unsafe: true });\n\n // wrap fetch result\n if (typeof $fetch == 'function') $({ global: true, enumerable: true, forced: true }, {\n // eslint-disable-next-line no-unused-vars\n fetch: function fetch(input /* , init */) {\n return promiseResolve(PromiseConstructor, $fetch.apply(global, arguments));\n }\n });\n }\n}\n\n$({ global: true, wrap: true, forced: FORCED }, {\n Promise: PromiseConstructor\n});\n\nsetToStringTag(PromiseConstructor, PROMISE, false, true);\nsetSpecies(PROMISE);\n\nPromiseWrapper = getBuiltIn(PROMISE);\n\n// statics\n$({ target: PROMISE, stat: true, forced: FORCED }, {\n // `Promise.reject` method\n // https://tc39.github.io/ecma262/#sec-promise.reject\n reject: function reject(r) {\n var capability = newPromiseCapability(this);\n capability.reject.call(undefined, r);\n return capability.promise;\n }\n});\n\n$({ target: PROMISE, stat: true, forced: IS_PURE || FORCED }, {\n // `Promise.resolve` method\n // https://tc39.github.io/ecma262/#sec-promise.resolve\n resolve: function resolve(x) {\n return promiseResolve(IS_PURE && this === PromiseWrapper ? PromiseConstructor : this, x);\n }\n});\n\n$({ target: PROMISE, stat: true, forced: INCORRECT_ITERATION }, {\n // `Promise.all` method\n // https://tc39.github.io/ecma262/#sec-promise.all\n all: function all(iterable) {\n var C = this;\n var capability = newPromiseCapability(C);\n var resolve = capability.resolve;\n var reject = capability.reject;\n var result = perform(function () {\n var $promiseResolve = aFunction(C.resolve);\n var values = [];\n var counter = 0;\n var remaining = 1;\n iterate(iterable, function (promise) {\n var index = counter++;\n var alreadyCalled = false;\n values.push(undefined);\n remaining++;\n $promiseResolve.call(C, promise).then(function (value) {\n if (alreadyCalled) return;\n alreadyCalled = true;\n values[index] = value;\n --remaining || resolve(values);\n }, reject);\n });\n --remaining || resolve(values);\n });\n if (result.error) reject(result.value);\n return capability.promise;\n },\n // `Promise.race` method\n // https://tc39.github.io/ecma262/#sec-promise.race\n race: function race(iterable) {\n var C = this;\n var capability = newPromiseCapability(C);\n var reject = capability.reject;\n var result = perform(function () {\n var $promiseResolve = aFunction(C.resolve);\n iterate(iterable, function (promise) {\n $promiseResolve.call(C, promise).then(capability.resolve, reject);\n });\n });\n if (result.error) reject(result.value);\n return capability.promise;\n }\n});\n","'use strict';\nvar aFunction = require('../internals/a-function');\n\nvar PromiseCapability = function (C) {\n var resolve, reject;\n this.promise = new C(function ($$resolve, $$reject) {\n if (resolve !== undefined || reject !== undefined) throw TypeError('Bad Promise constructor');\n resolve = $$resolve;\n reject = $$reject;\n });\n this.resolve = aFunction(resolve);\n this.reject = aFunction(reject);\n};\n\n// 25.4.1.5 NewPromiseCapability(C)\nmodule.exports.f = function (C) {\n return new PromiseCapability(C);\n};\n","var anObject = require('../internals/an-object');\nvar isObject = require('../internals/is-object');\nvar newPromiseCapability = require('../internals/new-promise-capability');\n\nmodule.exports = function (C, x) {\n anObject(C);\n if (isObject(x) && x.constructor === C) return x;\n var promiseCapability = newPromiseCapability.f(C);\n var resolve = promiseCapability.resolve;\n resolve(x);\n return promiseCapability.promise;\n};\n","var global = require('../internals/global');\n\nmodule.exports = function (a, b) {\n var console = global.console;\n if (console && console.error) {\n arguments.length === 1 ? console.error(a) : console.error(a, b);\n }\n};\n","module.exports = function (exec) {\n try {\n return { error: false, value: exec() };\n } catch (error) {\n return { error: true, value: error };\n }\n};\n","'use strict';\nvar $ = require('../internals/export');\nvar getOwnPropertyDescriptor = require('../internals/object-get-own-property-descriptor').f;\nvar toLength = require('../internals/to-length');\nvar notARegExp = require('../internals/not-a-regexp');\nvar requireObjectCoercible = require('../internals/require-object-coercible');\nvar correctIsRegExpLogic = require('../internals/correct-is-regexp-logic');\nvar IS_PURE = require('../internals/is-pure');\n\nvar nativeStartsWith = ''.startsWith;\nvar min = Math.min;\n\nvar CORRECT_IS_REGEXP_LOGIC = correctIsRegExpLogic('startsWith');\n// https://github.com/zloirock/core-js/pull/702\nvar MDN_POLYFILL_BUG = !IS_PURE && !CORRECT_IS_REGEXP_LOGIC && !!function () {\n var descriptor = getOwnPropertyDescriptor(String.prototype, 'startsWith');\n return descriptor && !descriptor.writable;\n}();\n\n// `String.prototype.startsWith` method\n// https://tc39.github.io/ecma262/#sec-string.prototype.startswith\n$({ target: 'String', proto: true, forced: !MDN_POLYFILL_BUG && !CORRECT_IS_REGEXP_LOGIC }, {\n startsWith: function startsWith(searchString /* , position = 0 */) {\n var that = String(requireObjectCoercible(this));\n notARegExp(searchString);\n var index = toLength(min(arguments.length > 1 ? arguments[1] : undefined, that.length));\n var search = String(searchString);\n return nativeStartsWith\n ? nativeStartsWith.call(that, search, index)\n : that.slice(index, index + search.length) === search;\n }\n});\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) && isFunction(input.then);\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// 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// 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","var aFunction = require('../internals/a-function');\nvar toObject = require('../internals/to-object');\nvar IndexedObject = require('../internals/indexed-object');\nvar toLength = require('../internals/to-length');\n\n// `Array.prototype.{ reduce, reduceRight }` methods implementation\nvar createMethod = function (IS_RIGHT) {\n return function (that, callbackfn, argumentsLength, memo) {\n aFunction(callbackfn);\n var O = toObject(that);\n var self = IndexedObject(O);\n var length = toLength(O.length);\n var index = IS_RIGHT ? length - 1 : 0;\n var i = IS_RIGHT ? -1 : 1;\n if (argumentsLength < 2) while (true) {\n if (index in self) {\n memo = self[index];\n index += i;\n break;\n }\n index += i;\n if (IS_RIGHT ? index < 0 : length <= index) {\n throw TypeError('Reduce of empty array with no initial value');\n }\n }\n for (;IS_RIGHT ? index >= 0 : length > index; index += i) if (index in self) {\n memo = callbackfn(memo, self[index], index, O);\n }\n return memo;\n };\n};\n\nmodule.exports = {\n // `Array.prototype.reduce` method\n // https://tc39.github.io/ecma262/#sec-array.prototype.reduce\n left: createMethod(false),\n // `Array.prototype.reduceRight` method\n // https://tc39.github.io/ecma262/#sec-array.prototype.reduceright\n right: createMethod(true)\n};\n","'use strict';\nvar $ = require('../internals/export');\nvar $reduce = require('../internals/array-reduce').left;\nvar arrayMethodIsStrict = require('../internals/array-method-is-strict');\nvar arrayMethodUsesToLength = require('../internals/array-method-uses-to-length');\n\nvar STRICT_METHOD = arrayMethodIsStrict('reduce');\nvar USES_TO_LENGTH = arrayMethodUsesToLength('reduce', { 1: 0 });\n\n// `Array.prototype.reduce` method\n// https://tc39.github.io/ecma262/#sec-array.prototype.reduce\n$({ target: 'Array', proto: true, forced: !STRICT_METHOD || !USES_TO_LENGTH }, {\n reduce: function reduce(callbackfn /* , initialValue */) {\n return $reduce(this, callbackfn, arguments.length, arguments.length > 1 ? arguments[1] : undefined);\n }\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 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// Closest ancestor element matching selector (also tests element itself)\nexport function closest(element, selector) {\n const { prototype } = Element;\n\n // https://developer.mozilla.org/en-US/docs/Web/API/Element/closest#Polyfill\n function closestElement() {\n let el = this;\n\n do {\n if (matches.matches(el, selector)) return el;\n el = el.parentElement || el.parentNode;\n } while (el !== null && el.nodeType === 1);\n return null;\n }\n\n const method = prototype.closest || closestElement;\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// 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// 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: { ...detail, plyr: this },\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","import is from './is';\n/**\n * Silence a Promise-like object.\n * This is useful for avoiding non-harmful, but potentially confusing \"uncaught\n * play promise\" rejection error messages.\n * @param {Object} value An object that may or may not be `Promise`-like.\n */\nexport function silencePromise(value) {\n if (is.promise(value)) {\n value.then(null, () => {});\n }\n}\n\nexport default { silencePromise };\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 { wrapper } = this.elements;\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 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.config.vimeo.premium && this.supported.ui) {\n const height = (100 / this.media.offsetWidth) * parseInt(window.getComputedStyle(this.media).paddingBottom, 10);\n const offset = (height - padding) / (height / 50);\n\n this.media.style.transform = `translateY(-${offset}%)`;\n } else if (this.isHTML5) {\n 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 { silencePromise } from './utils/promise';\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 // Whether we're forcing all options (e.g. for streaming)\n if (this.config.quality.forced) {\n return this.config.quality.options;\n }\n\n // Get sizes from <source> elements\n return html5.getSources\n .call(this)\n .map(source => Number(source.getAttribute('data-res')))\n .filter(Boolean);\n },\n\n setup() {\n if (!this.isHTML5) {\n return;\n }\n\n const player = this;\n\n // Set speed options from config\n player.options.speed = player.config.speed.options;\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('data-res'));\n },\n set(input) {\n if (player.quality === input) {\n return;\n }\n\n // If we're using an an external handler...\n if (player.config.quality.forced && is.function(player.config.quality.onChange)) {\n player.config.quality.onChange(input);\n } else {\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('data-res')) === input);\n\n // No matching source found\n if (!source) {\n return;\n }\n\n // Get current state\n const { currentTime, paused, preload, readyState, playbackRate } = 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.speed = playbackRate;\n player.currentTime = currentTime;\n\n // Resume playing\n if (!paused) {\n silencePromise(player.play());\n }\n });\n\n // Load new source\n player.media.load();\n }\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","var DESCRIPTORS = require('../internals/descriptors');\nvar global = require('../internals/global');\nvar isForced = require('../internals/is-forced');\nvar inheritIfRequired = require('../internals/inherit-if-required');\nvar defineProperty = require('../internals/object-define-property').f;\nvar getOwnPropertyNames = require('../internals/object-get-own-property-names').f;\nvar isRegExp = require('../internals/is-regexp');\nvar getFlags = require('../internals/regexp-flags');\nvar stickyHelpers = require('../internals/regexp-sticky-helpers');\nvar redefine = require('../internals/redefine');\nvar fails = require('../internals/fails');\nvar setInternalState = require('../internals/internal-state').set;\nvar setSpecies = require('../internals/set-species');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\n\nvar MATCH = wellKnownSymbol('match');\nvar NativeRegExp = global.RegExp;\nvar RegExpPrototype = NativeRegExp.prototype;\nvar re1 = /a/g;\nvar re2 = /a/g;\n\n// \"new\" should create a new object, old webkit bug\nvar CORRECT_NEW = new NativeRegExp(re1) !== re1;\n\nvar UNSUPPORTED_Y = stickyHelpers.UNSUPPORTED_Y;\n\nvar FORCED = DESCRIPTORS && isForced('RegExp', (!CORRECT_NEW || UNSUPPORTED_Y || fails(function () {\n re2[MATCH] = false;\n // RegExp constructor can alter flags and IsRegExp works correct with @@match\n return NativeRegExp(re1) != re1 || NativeRegExp(re2) == re2 || NativeRegExp(re1, 'i') != '/a/i';\n})));\n\n// `RegExp` constructor\n// https://tc39.github.io/ecma262/#sec-regexp-constructor\nif (FORCED) {\n var RegExpWrapper = function RegExp(pattern, flags) {\n var thisIsRegExp = this instanceof RegExpWrapper;\n var patternIsRegExp = isRegExp(pattern);\n var flagsAreUndefined = flags === undefined;\n var sticky;\n\n if (!thisIsRegExp && patternIsRegExp && pattern.constructor === RegExpWrapper && flagsAreUndefined) {\n return pattern;\n }\n\n if (CORRECT_NEW) {\n if (patternIsRegExp && !flagsAreUndefined) pattern = pattern.source;\n } else if (pattern instanceof RegExpWrapper) {\n if (flagsAreUndefined) flags = getFlags.call(pattern);\n pattern = pattern.source;\n }\n\n if (UNSUPPORTED_Y) {\n sticky = !!flags && flags.indexOf('y') > -1;\n if (sticky) flags = flags.replace(/y/g, '');\n }\n\n var result = inheritIfRequired(\n CORRECT_NEW ? new NativeRegExp(pattern, flags) : NativeRegExp(pattern, flags),\n thisIsRegExp ? this : RegExpPrototype,\n RegExpWrapper\n );\n\n if (UNSUPPORTED_Y && sticky) setInternalState(result, { sticky: sticky });\n\n return result;\n };\n var proxy = function (key) {\n key in RegExpWrapper || defineProperty(RegExpWrapper, key, {\n configurable: true,\n get: function () { return NativeRegExp[key]; },\n set: function (it) { NativeRegExp[key] = it; }\n });\n };\n var keys = getOwnPropertyNames(NativeRegExp);\n var index = 0;\n while (keys.length > index) proxy(keys[index++]);\n RegExpPrototype.constructor = RegExpWrapper;\n RegExpWrapper.prototype = RegExpPrototype;\n redefine(global, 'RegExp', RegExpWrapper);\n}\n\n// https://tc39.github.io/ecma262/#sec-get-regexp-@@species\nsetSpecies('RegExp');\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 const replaceAll = (input = '', find = '', replace = '') =>\n input.replace(new RegExp(find.toString().replace(/([.*+?^=!:${}()|[\\]/\\\\])/g, '\\\\$1'), 'g'), replace.toString());\n\n// Convert to title case\nexport const toTitleCase = (input = '') =>\n input.toString().replace(/\\w\\S*/g, text => text.charAt(0).toUpperCase() + text.substr(1).toLowerCase());\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","var $ = require('../internals/export');\n\nvar ceil = Math.ceil;\nvar floor = Math.floor;\n\n// `Math.trunc` method\n// https://tc39.github.io/ecma262/#sec-math.trunc\n$({ target: 'Math', stat: true }, {\n trunc: function trunc(it) {\n return (it > 0 ? floor : ceil)(it);\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(undefined, 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(`.${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);\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 'aria-hidden': 'true',\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 const attributes = { ...attr, class: [attr.class, this.config.classNames.hidden].filter(Boolean).join(' ') };\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.call(\n this,\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.call(this, 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=\"menucaptions\"]');\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() {\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 // Filter out invalid speeds\n this.options.speed = this.options.speed.filter(o => o >= this.minimumSpeed && o <= this.maximumSpeed);\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 (is.array(this.config.controls) && 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(is.array(this.config.controls) ? 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 // Ignored on iOS as it's handled globally\n // https://developer.apple.com/library/safari/documentation/AudioVideo/Conceptual/Using_HTML5_Audio_Video/Device-SpecificConsiderations/Device-SpecificConsiderations.html\n if (control === 'volume' && !browser.isIos) {\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.call(this, 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.call(\n this,\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.call(this, 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 // Menu Captions\n pane.appendChild(\n createElement('div', {\n role: 'menucaptions',\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 // Set download attribute for HTML5 only\n if (this.isHTML5) {\n attributes.download = '';\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 }\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\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 // Note: mode='hidden' forces a track to download. To ensure every track\n // isn't downloaded at once, only 'showing' tracks should be reassigned\n // eslint-disable-next-line no-param-reassign\n if (track.mode === 'showing') {\n // eslint-disable-next-line no-param-reassign\n track.mode = 'hidden';\n }\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 (\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\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 // Wait for the call stack to clear before setting mode='hidden'\n // on the active track - forcing the browser to download it\n setTimeout(() => {\n if (active && this.captions.toggled) {\n this.captions.currentTrackNode.mode = 'hidden';\n }\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: '/theme/modules/plyr/plyr.svg',\n\n // Blank video (used to prevent errors on source change)\n blankVideo: '/theme/modules/plyr/blank.webm',\n\n // Quality default\n quality: {\n default: 576,\n // The options to display in the UI, if available for the source media\n options: [4320, 2880, 2160, 1440, 1080, 720, 576, 480, 360, 240],\n forced: false,\n onChange: null,\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 // The options to display in the UI, if available for the source media (e.g. Vimeo and YouTube only support 0.5x-4x)\n options: [0.5, 0.75, 1, 1.25, 1.5, 1.75, 2, 4],\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 // Selector for the fullscreen container so contextual / non-player content can remain visible in fullscreen mode\n // Non-ancestors of the player element will be ignored\n // container: null, // defaults to the player element\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 pip: 'PIP',\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 // Whether the owner of the video has a Pro or Business account\n // (which allows us to properly hide controls without CSS hacks, etc)\n premium: false,\n // Custom settings from Plyr\n referrerPolicy: null, // https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement/referrerPolicy\n },\n\n // YouTube plugin\n youtube: {\n noCookie: true, // 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 { closest,getElements, hasClass, toggleClass } from './utils/elements';\nimport { on, triggerEvent } from './utils/events';\nimport is from './utils/is';\nimport { silencePromise } from './utils/promise';\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 // Get the fullscreen element\n // Checks container is an ancestor, defaults to null\n this.player.elements.fullscreen =\n player.config.fullscreen.container && closest(this.player.elements.container, player.config.fullscreen.container);\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 this.onChange();\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 // Tap focus when in fullscreen\n on.call(this, this.player.elements.container, 'keydown', event => this.trapFocus(event));\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 && element.shadowRoot ? element === this.target.getRootNode().host : 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.fullscreen || this.player.elements.container;\n }\n\n 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\n 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 this.onChange();\n }\n\n // Trap focus inside container\n trapFocus(event) {\n // Bail if iOS, not active, not the tab key\n if (browser.isIos || !this.active || event.key !== 'Tab' || event.keyCode !== 9) {\n return;\n }\n\n // Get the current focused element\n const focused = document.activeElement;\n const focusable = getElements.call(this.player, 'a[href], button:not(:disabled), input:not(:disabled), [tabindex]');\n const [first] = focusable;\n const last = focusable[focusable.length - 1];\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 // 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 this.toggleFallback(true);\n } else if (!this.prefix) {\n this.target.requestFullscreen({ navigationUI: 'hide' });\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 silencePromise(this.player.play());\n } else if (!Fullscreen.native || this.forceFallback) {\n this.toggleFallback(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","// `Math.sign` method implementation\n// https://tc39.github.io/ecma262/#sec-math.sign\nmodule.exports = Math.sign || function sign(x) {\n // eslint-disable-next-line no-self-compare\n return (x = +x) == 0 || x != x ? x : x < 0 ? -1 : 1;\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\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","var $ = require('../internals/export');\nvar sign = require('../internals/math-sign');\n\n// `Math.sign` method\n// https://tc39.github.io/ecma262/#sec-math.sign\n$({ target: 'Math', stat: true }, {\n sign: sign\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('data-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\n ui.togglePoster.call(this, true);\n\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 target.setAttribute('aria-label', i18n.get(this.playing ? 'pause' : 'play', this.config));\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 || this.loading || this.paused || controlsElement.pressed || controlsElement.hover || recentTouchSeek,\n ),\n );\n }\n },\n\n // Migrate any custom properties from the media to the parent\n migrateStyles() {\n // Loop through values (as they are the keys when the object is spread 🤔)\n Object.values({ ...this.media.style })\n // We're only fussed about Plyr specific properties\n .filter(key => !is.empty(key) && key.startsWith('--plyr'))\n .forEach(key => {\n // Set on the container\n this.elements.container.style.setProperty(key, this.media.style.getPropertyValue(key));\n\n // Clean up from media element\n this.media.style.removeProperty(key);\n });\n\n // Remove attribute if empty\n if (is.empty(this.media.style)) {\n this.media.removeAttribute('style');\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 } from './utils/elements';\nimport { off, on, once, toggleListener, triggerEvent } from './utils/events';\nimport is from './utils/is';\nimport { silencePromise } from './utils/promise';\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 silencePromise(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 if (event.type !== 'focusout') {\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\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 focusout', 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 || player.config.vimeo.premium) {\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 browser fullscreen API, 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 // 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 // Call pause otherwise IE11 will start playing the video again\n player.pause();\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(\n event,\n () => {\n silencePromise(player.play());\n },\n 'play',\n );\n } else {\n this.proxy(\n event,\n () => {\n silencePromise(player.togglePlay());\n },\n 'play',\n );\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 !== false && 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(\n button,\n 'click',\n () => {\n silencePromise(player.togglePlay());\n },\n 'play',\n );\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(\n elements.buttons.settings,\n 'click',\n event => {\n // Prevent the document click listener closing the menu\n event.stopPropagation();\n event.preventDefault();\n\n controls.toggleMenu.call(player, event);\n },\n null,\n false,\n ); // Can't be passive as we're preventing default\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 silencePromise(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 touchend 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 // Also update controls.hover state for any non-player children of fullscreen element (as above)\n if (elements.fullscreen) {\n Array.from(elements.fullscreen.children)\n .filter(c => !c.contains(elements.container))\n .forEach(child => {\n this.bind(child, 'mouseenter mouseleave', event => {\n elements.controls.hover = !player.touch && event.type === 'mouseenter';\n });\n });\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","'use strict';\nvar $ = require('../internals/export');\nvar toAbsoluteIndex = require('../internals/to-absolute-index');\nvar toInteger = require('../internals/to-integer');\nvar toLength = require('../internals/to-length');\nvar toObject = require('../internals/to-object');\nvar arraySpeciesCreate = require('../internals/array-species-create');\nvar createProperty = require('../internals/create-property');\nvar arrayMethodHasSpeciesSupport = require('../internals/array-method-has-species-support');\nvar arrayMethodUsesToLength = require('../internals/array-method-uses-to-length');\n\nvar HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('splice');\nvar USES_TO_LENGTH = arrayMethodUsesToLength('splice', { ACCESSORS: true, 0: 0, 1: 2 });\n\nvar max = Math.max;\nvar min = Math.min;\nvar MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF;\nvar MAXIMUM_ALLOWED_LENGTH_EXCEEDED = 'Maximum allowed length exceeded';\n\n// `Array.prototype.splice` method\n// https://tc39.github.io/ecma262/#sec-array.prototype.splice\n// with adding support of @@species\n$({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT || !USES_TO_LENGTH }, {\n splice: function splice(start, deleteCount /* , ...items */) {\n var O = toObject(this);\n var len = toLength(O.length);\n var actualStart = toAbsoluteIndex(start, len);\n var argumentsLength = arguments.length;\n var insertCount, actualDeleteCount, A, k, from, to;\n if (argumentsLength === 0) {\n insertCount = actualDeleteCount = 0;\n } else if (argumentsLength === 1) {\n insertCount = 0;\n actualDeleteCount = len - actualStart;\n } else {\n insertCount = argumentsLength - 2;\n actualDeleteCount = min(max(toInteger(deleteCount), 0), len - actualStart);\n }\n if (len + insertCount - actualDeleteCount > MAX_SAFE_INTEGER) {\n throw TypeError(MAXIMUM_ALLOWED_LENGTH_EXCEEDED);\n }\n A = arraySpeciesCreate(O, actualDeleteCount);\n for (k = 0; k < actualDeleteCount; k++) {\n from = actualStart + k;\n if (from in O) createProperty(A, k, O[from]);\n }\n A.length = actualDeleteCount;\n if (insertCount < actualDeleteCount) {\n for (k = actualStart; k < len - actualDeleteCount; k++) {\n from = k + actualDeleteCount;\n to = k + insertCount;\n if (from in O) O[to] = O[from];\n else delete O[to];\n }\n for (k = len; k > len - actualDeleteCount + insertCount; k--) delete O[k - 1];\n } else if (insertCount > actualDeleteCount) {\n for (k = len - actualDeleteCount; k > actualStart; k--) {\n from = k + actualDeleteCount - 1;\n to = k + insertCount - 1;\n if (from in O) O[to] = O[from];\n else delete O[to];\n }\n }\n for (k = 0; k < insertCount; k++) {\n O[k + actualStart] = arguments[k + 2];\n }\n O.length = len - actualDeleteCount + insertCount;\n return A;\n }\n});\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 pathname = path.replace(/[\\?|#].*$/, ''),\n pathStripped = path.replace(/^(css|img)!/, ''),\n isLegacyIECss,\n e;\n\n numTries = numTries || 0;\n\n if (/(^css!|\\.css$)/.test(pathname)) {\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|webp)$)/.test(pathname)) {\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 { 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 const player = this;\n\n // Add embed class for responsive\n toggleClass(player.elements.wrapper, player.config.classNames.embed, true);\n\n // Set speed options from config\n player.options.speed = player.config.speed.options;\n\n // Set intial ratio\n setAspectRatio.call(player);\n\n // Load the SDK if not already\n if (!is.object(window.Vimeo)) {\n loadScript(player.config.urls.vimeo.sdk)\n .then(() => {\n vimeo.ready.call(player);\n })\n .catch(error => {\n player.debug.warn('Vimeo SDK (player.js) failed to load', error);\n });\n } else {\n vimeo.ready.call(player);\n }\n },\n\n // API Ready\n ready() {\n const player = this;\n const config = player.config.vimeo;\n const { premium, referrerPolicy, ...frameParams } = config;\n\n // If the owner has a pro or premium account then we can hide controls etc\n if (premium) {\n Object.assign(frameParams, {\n controls: false,\n sidedock: false,\n });\n }\n\n // Get Vimeo params for the iframe\n const params = buildUrlParams({\n loop: player.config.loop.active,\n autoplay: player.autoplay,\n muted: player.muted,\n gesture: 'media',\n playsinline: !this.config.fullscreen.iosNative,\n ...frameParams,\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('allow', 'autoplay,fullscreen,picture-in-picture');\n\n // Set the referrer policy if required\n if (!is.empty(referrerPolicy)) {\n iframe.setAttribute('referrerPolicy', referrerPolicy);\n }\n\n // Inject the package\n const { poster } = player;\n if (premium) {\n iframe.setAttribute('data-poster', poster);\n player.media = replaceElement(iframe, player.media);\n } else {\n const wrapper = createElement('div', { class: player.config.classNames.embedContainer, 'data-poster': poster });\n wrapper.appendChild(iframe);\n player.media = replaceElement(wrapper, player.media);\n }\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(() => {\n // Cannot set Playback Rate, Video is probably not on Pro account\n player.options.speed = [1];\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('bufferstart', () => {\n triggerEvent.call(player, player.media, 'waiting');\n });\n\n player.embed.on('bufferend', () => {\n triggerEvent.call(player, player.media, 'playing');\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, 'data-poster': 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 const speeds = instance.getAvailablePlaybackRates();\n // Filter based on config\n player.options.speed = speeds.filter(s => player.config.speed.options.includes(s));\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 case 3:\n // Trigger waiting event to add loading classes to container as the video buffers.\n triggerEvent.call(player, player.media, 'waiting');\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 // Poster image 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.setup.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 { silencePromise } from '../utils/promise';\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: config.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 // 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 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 // 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 if (this.player.ended) {\n this.loadAds();\n } else {\n // The SDK won't allow new ads to be called without receiving a contentComplete()\n this.loader.contentComplete();\n }\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 silencePromise(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 // Now that the manager has been destroyed set it to also be un-initialized\n this.initialized = false;\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","'use strict';\nvar $ = require('../internals/export');\nvar $findIndex = require('../internals/array-iteration').findIndex;\nvar addToUnscopables = require('../internals/add-to-unscopables');\nvar arrayMethodUsesToLength = require('../internals/array-method-uses-to-length');\n\nvar FIND_INDEX = 'findIndex';\nvar SKIPS_HOLES = true;\n\nvar USES_TO_LENGTH = arrayMethodUsesToLength(FIND_INDEX);\n\n// Shouldn't skip holes\nif (FIND_INDEX in []) Array(1)[FIND_INDEX](function () { SKIPS_HOLES = false; });\n\n// `Array.prototype.findIndex` method\n// https://tc39.github.io/ecma262/#sec-array.prototype.findindex\n$({ target: 'Array', proto: true, forced: SKIPS_HOLES || !USES_TO_LENGTH }, {\n findIndex: function findIndex(callbackfn /* , that = undefined */) {\n return $findIndex(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);\n }\n});\n\n// https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables\naddToUnscopables(FIND_INDEX);\n","'use strict';\nvar toIndexedObject = require('../internals/to-indexed-object');\nvar toInteger = require('../internals/to-integer');\nvar toLength = require('../internals/to-length');\nvar arrayMethodIsStrict = require('../internals/array-method-is-strict');\nvar arrayMethodUsesToLength = require('../internals/array-method-uses-to-length');\n\nvar min = Math.min;\nvar nativeLastIndexOf = [].lastIndexOf;\nvar NEGATIVE_ZERO = !!nativeLastIndexOf && 1 / [1].lastIndexOf(1, -0) < 0;\nvar STRICT_METHOD = arrayMethodIsStrict('lastIndexOf');\n// For preventing possible almost infinite loop in non-standard implementations, test the forward version of the method\nvar USES_TO_LENGTH = arrayMethodUsesToLength('indexOf', { ACCESSORS: true, 1: 0 });\nvar FORCED = NEGATIVE_ZERO || !STRICT_METHOD || !USES_TO_LENGTH;\n\n// `Array.prototype.lastIndexOf` method implementation\n// https://tc39.github.io/ecma262/#sec-array.prototype.lastindexof\nmodule.exports = FORCED ? function lastIndexOf(searchElement /* , fromIndex = @[*-1] */) {\n // convert -0 to +0\n if (NEGATIVE_ZERO) return nativeLastIndexOf.apply(this, arguments) || 0;\n var O = toIndexedObject(this);\n var length = toLength(O.length);\n var index = length - 1;\n if (arguments.length > 1) index = min(index, toInteger(arguments[1]));\n if (index < 0) index = length + index;\n for (;index >= 0; index--) if (index in O && O[index] === searchElement) return index || 0;\n return -1;\n} : nativeLastIndexOf;\n","var $ = require('../internals/export');\nvar lastIndexOf = require('../internals/array-last-index-of');\n\n// `Array.prototype.lastIndexOf` method\n// https://tc39.github.io/ecma262/#sec-array.prototype.lastindexof\n$({ target: 'Array', proto: true, forced: lastIndexOf !== [].lastIndexOf }, {\n lastIndexOf: lastIndexOf\n});\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\nconst fitRatio = (ratio, outer) => {\n const targetRatio = outer.width / outer.height;\n const result = {};\n if (ratio > targetRatio) {\n result.width = outer.width;\n result.height = (1 / ratio) * outer.width;\n } else {\n result.height = outer.height;\n result.width = ratio * outer.height;\n }\n\n return result;\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 // Toggle the 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 // Resolve promise\n const sortAndResolve = () => {\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 // Via callback()\n if (is.function(src)) {\n src(thumbnails => {\n this.thumbnails = thumbnails;\n sortAndResolve();\n });\n }\n // VTT urls\n else {\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 // Resolve\n Promise.all(promises).then(sortAndResolve);\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 does not exist or is false)\n if (is.nullOrUndefined(event.button) || 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 destroy() {\n if (this.elements.thumb.container) {\n this.elements.thumb.container.remove();\n }\n if (this.elements.scrubbing.container) {\n this.elements.scrubbing.container.remove();\n }\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 = () => 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)) 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 const { height } = fitRatio(this.thumbAspectRatio, {\n width: this.player.media.clientWidth,\n height: this.player.media.clientHeight,\n });\n return height;\n }\n\n // If css is used this needs to return the css height for sprites to work (see setImageSizeAndOffset)\n if (this.sizeSpecifiedInCSS) {\n return this.elements.thumb.imageContainer.clientHeight;\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 || this.elements.thumb.imageContainer.clientWidth > 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 } else if (\n this.elements.thumb.imageContainer.clientHeight > 20 &&\n this.elements.thumb.imageContainer.clientWidth < 20\n ) {\n const thumbWidth = Math.floor(this.elements.thumb.imageContainer.clientHeight * this.thumbAspectRatio);\n this.elements.thumb.imageContainer.style.width = `${thumbWidth}px`;\n } else if (\n this.elements.thumb.imageContainer.clientHeight < 20 &&\n this.elements.thumb.imageContainer.clientWidth > 20\n ) {\n const thumbHeight = Math.floor(this.elements.thumb.imageContainer.clientWidth / this.thumbAspectRatio);\n this.elements.thumb.imageContainer.style.height = `${thumbHeight}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 const { width, height } = fitRatio(this.thumbAspectRatio, {\n width: this.player.media.clientWidth,\n height: this.player.media.clientHeight,\n });\n this.elements.scrubbing.container.style.width = `${width}px`;\n this.elements.scrubbing.container.style.height = `${height}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 = `${previewImage.naturalHeight * multiplier}px`;\n // eslint-disable-next-line no-param-reassign\n previewImage.style.width = `${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 PreviewThumbnails from './plugins/preview-thumbnails';\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 // Update previewThumbnails config & reload plugin\n if (!is.empty(input.previewThumbnails)) {\n Object.assign(this.config.previewThumbnails, input.previewThumbnails);\n\n // Cleanup previewThumbnails plugin if it was loaded\n if (this.previewThumbnails && this.previewThumbnails.loaded) {\n this.previewThumbnails.destroy();\n this.previewThumbnails = null;\n }\n\n // Create new instance if it is still enabled\n if (this.config.previewThumbnails.enabled) {\n this.previewThumbnails = new PreviewThumbnails(this);\n }\n }\n\n // Update the fullscreen support\n this.fullscreen.update();\n },\n true,\n );\n },\n};\n\nexport default source;\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","// ==========================================================================\n// Plyr\n// plyr.js v3.6.2\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 { silencePromise } from './utils/promise';\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 fullscreen: 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 // Migrate custom properties from media to container (so they work 😉)\n ui.migrateStyles.call(this);\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 fullscreen\n this.fullscreen = new Fullscreen(this);\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 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(() => silencePromise(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(() => silencePromise(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 null;\n }\n\n return 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 return this.play();\n }\n\n return this.pause();\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 -= 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 += 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') || this.media.getAttribute('data-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 && is.array(this.config.controls) && 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"]} \ No newline at end of file
diff --git a/youtube/static/modules/plyr/plyr.polyfilled.mjs b/youtube/static/modules/plyr/plyr.polyfilled.mjs
new file mode 100644
index 0000000..09d775a
--- /dev/null
+++ b/youtube/static/modules/plyr/plyr.polyfilled.mjs
@@ -0,0 +1,15753 @@
+typeof navigator === "object" && // Polyfill for creating CustomEvents on IE9/10/11
+// code pulled from:
+// https://github.com/d4tocchini/customevent-polyfill
+// https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent#Polyfill
+(function () {
+ if (typeof window === 'undefined') {
+ return;
+ }
+
+ try {
+ var ce = new window.CustomEvent('test', {
+ cancelable: true
+ });
+ ce.preventDefault();
+
+ if (ce.defaultPrevented !== true) {
+ // IE has problems with .preventDefault() on custom events
+ // http://stackoverflow.com/questions/23349191
+ throw new Error('Could not prevent default');
+ }
+ } catch (e) {
+ var CustomEvent = function CustomEvent(event, params) {
+ var evt, origPrevent;
+ params = params || {};
+ params.bubbles = !!params.bubbles;
+ params.cancelable = !!params.cancelable;
+ evt = document.createEvent('CustomEvent');
+ evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);
+ origPrevent = evt.preventDefault;
+
+ evt.preventDefault = function () {
+ origPrevent.call(this);
+
+ try {
+ Object.defineProperty(this, 'defaultPrevented', {
+ get: function get() {
+ return true;
+ }
+ });
+ } catch (e) {
+ this.defaultPrevented = true;
+ }
+ };
+
+ return evt;
+ };
+
+ CustomEvent.prototype = window.Event.prototype;
+ window.CustomEvent = CustomEvent; // expose definition to window
+ }
+})();
+
+var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
+
+function createCommonjsModule(fn, module) {
+ return module = { exports: {} }, fn(module, module.exports), module.exports;
+}
+
+var check = function (it) {
+ return it && it.Math == Math && it;
+};
+
+// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
+var global_1 =
+ // eslint-disable-next-line no-undef
+ check(typeof globalThis == 'object' && globalThis) ||
+ check(typeof window == 'object' && window) ||
+ check(typeof self == 'object' && self) ||
+ check(typeof commonjsGlobal == 'object' && commonjsGlobal) ||
+ // eslint-disable-next-line no-new-func
+ Function('return this')();
+
+var fails = function (exec) {
+ try {
+ return !!exec();
+ } catch (error) {
+ return true;
+ }
+};
+
+// Thank's IE8 for his funny defineProperty
+var descriptors = !fails(function () {
+ return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7;
+});
+
+var nativePropertyIsEnumerable = {}.propertyIsEnumerable;
+var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
+
+// Nashorn ~ JDK8 bug
+var NASHORN_BUG = getOwnPropertyDescriptor && !nativePropertyIsEnumerable.call({ 1: 2 }, 1);
+
+// `Object.prototype.propertyIsEnumerable` method implementation
+// https://tc39.github.io/ecma262/#sec-object.prototype.propertyisenumerable
+var f = NASHORN_BUG ? function propertyIsEnumerable(V) {
+ var descriptor = getOwnPropertyDescriptor(this, V);
+ return !!descriptor && descriptor.enumerable;
+} : nativePropertyIsEnumerable;
+
+var objectPropertyIsEnumerable = {
+ f: f
+};
+
+var createPropertyDescriptor = function (bitmap, value) {
+ return {
+ enumerable: !(bitmap & 1),
+ configurable: !(bitmap & 2),
+ writable: !(bitmap & 4),
+ value: value
+ };
+};
+
+var toString = {}.toString;
+
+var classofRaw = function (it) {
+ return toString.call(it).slice(8, -1);
+};
+
+var split = ''.split;
+
+// fallback for non-array-like ES3 and non-enumerable old V8 strings
+var indexedObject = fails(function () {
+ // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
+ // eslint-disable-next-line no-prototype-builtins
+ return !Object('z').propertyIsEnumerable(0);
+}) ? function (it) {
+ return classofRaw(it) == 'String' ? split.call(it, '') : Object(it);
+} : Object;
+
+// `RequireObjectCoercible` abstract operation
+// https://tc39.github.io/ecma262/#sec-requireobjectcoercible
+var requireObjectCoercible = function (it) {
+ if (it == undefined) throw TypeError("Can't call method on " + it);
+ return it;
+};
+
+// toObject with fallback for non-array-like ES3 strings
+
+
+
+var toIndexedObject = function (it) {
+ return indexedObject(requireObjectCoercible(it));
+};
+
+var isObject = function (it) {
+ return typeof it === 'object' ? it !== null : typeof it === 'function';
+};
+
+// `ToPrimitive` abstract operation
+// https://tc39.github.io/ecma262/#sec-toprimitive
+// instead of the ES6 spec version, we didn't implement @@toPrimitive case
+// and the second argument - flag - preferred type is a string
+var toPrimitive = function (input, PREFERRED_STRING) {
+ if (!isObject(input)) return input;
+ var fn, val;
+ if (PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
+ if (typeof (fn = input.valueOf) == 'function' && !isObject(val = fn.call(input))) return val;
+ if (!PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
+ throw TypeError("Can't convert object to primitive value");
+};
+
+var hasOwnProperty = {}.hasOwnProperty;
+
+var has = function (it, key) {
+ return hasOwnProperty.call(it, key);
+};
+
+var document$1 = global_1.document;
+// typeof document.createElement is 'object' in old IE
+var EXISTS = isObject(document$1) && isObject(document$1.createElement);
+
+var documentCreateElement = function (it) {
+ return EXISTS ? document$1.createElement(it) : {};
+};
+
+// Thank's IE8 for his funny defineProperty
+var ie8DomDefine = !descriptors && !fails(function () {
+ return Object.defineProperty(documentCreateElement('div'), 'a', {
+ get: function () { return 7; }
+ }).a != 7;
+});
+
+var nativeGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
+
+// `Object.getOwnPropertyDescriptor` method
+// https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptor
+var f$1 = descriptors ? nativeGetOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
+ O = toIndexedObject(O);
+ P = toPrimitive(P, true);
+ if (ie8DomDefine) try {
+ return nativeGetOwnPropertyDescriptor(O, P);
+ } catch (error) { /* empty */ }
+ if (has(O, P)) return createPropertyDescriptor(!objectPropertyIsEnumerable.f.call(O, P), O[P]);
+};
+
+var objectGetOwnPropertyDescriptor = {
+ f: f$1
+};
+
+var anObject = function (it) {
+ if (!isObject(it)) {
+ throw TypeError(String(it) + ' is not an object');
+ } return it;
+};
+
+var nativeDefineProperty = Object.defineProperty;
+
+// `Object.defineProperty` method
+// https://tc39.github.io/ecma262/#sec-object.defineproperty
+var f$2 = descriptors ? nativeDefineProperty : function defineProperty(O, P, Attributes) {
+ anObject(O);
+ P = toPrimitive(P, true);
+ anObject(Attributes);
+ if (ie8DomDefine) try {
+ return nativeDefineProperty(O, P, Attributes);
+ } catch (error) { /* empty */ }
+ if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported');
+ if ('value' in Attributes) O[P] = Attributes.value;
+ return O;
+};
+
+var objectDefineProperty = {
+ f: f$2
+};
+
+var createNonEnumerableProperty = descriptors ? function (object, key, value) {
+ return objectDefineProperty.f(object, key, createPropertyDescriptor(1, value));
+} : function (object, key, value) {
+ object[key] = value;
+ return object;
+};
+
+var setGlobal = function (key, value) {
+ try {
+ createNonEnumerableProperty(global_1, key, value);
+ } catch (error) {
+ global_1[key] = value;
+ } return value;
+};
+
+var SHARED = '__core-js_shared__';
+var store = global_1[SHARED] || setGlobal(SHARED, {});
+
+var sharedStore = store;
+
+var functionToString = Function.toString;
+
+// this helper broken in `3.4.1-3.4.4`, so we can't use `shared` helper
+if (typeof sharedStore.inspectSource != 'function') {
+ sharedStore.inspectSource = function (it) {
+ return functionToString.call(it);
+ };
+}
+
+var inspectSource = sharedStore.inspectSource;
+
+var WeakMap$1 = global_1.WeakMap;
+
+var nativeWeakMap = typeof WeakMap$1 === 'function' && /native code/.test(inspectSource(WeakMap$1));
+
+var isPure = false;
+
+var shared = createCommonjsModule(function (module) {
+(module.exports = function (key, value) {
+ return sharedStore[key] || (sharedStore[key] = value !== undefined ? value : {});
+})('versions', []).push({
+ version: '3.6.5',
+ mode: 'global',
+ copyright: '© 2020 Denis Pushkarev (zloirock.ru)'
+});
+});
+
+var id = 0;
+var postfix = Math.random();
+
+var uid = function (key) {
+ return 'Symbol(' + String(key === undefined ? '' : key) + ')_' + (++id + postfix).toString(36);
+};
+
+var keys = shared('keys');
+
+var sharedKey = function (key) {
+ return keys[key] || (keys[key] = uid(key));
+};
+
+var hiddenKeys = {};
+
+var WeakMap$2 = global_1.WeakMap;
+var set, get, has$1;
+
+var enforce = function (it) {
+ return has$1(it) ? get(it) : set(it, {});
+};
+
+var getterFor = function (TYPE) {
+ return function (it) {
+ var state;
+ if (!isObject(it) || (state = get(it)).type !== TYPE) {
+ throw TypeError('Incompatible receiver, ' + TYPE + ' required');
+ } return state;
+ };
+};
+
+if (nativeWeakMap) {
+ var store$1 = new WeakMap$2();
+ var wmget = store$1.get;
+ var wmhas = store$1.has;
+ var wmset = store$1.set;
+ set = function (it, metadata) {
+ wmset.call(store$1, it, metadata);
+ return metadata;
+ };
+ get = function (it) {
+ return wmget.call(store$1, it) || {};
+ };
+ has$1 = function (it) {
+ return wmhas.call(store$1, it);
+ };
+} else {
+ var STATE = sharedKey('state');
+ hiddenKeys[STATE] = true;
+ set = function (it, metadata) {
+ createNonEnumerableProperty(it, STATE, metadata);
+ return metadata;
+ };
+ get = function (it) {
+ return has(it, STATE) ? it[STATE] : {};
+ };
+ has$1 = function (it) {
+ return has(it, STATE);
+ };
+}
+
+var internalState = {
+ set: set,
+ get: get,
+ has: has$1,
+ enforce: enforce,
+ getterFor: getterFor
+};
+
+var redefine = createCommonjsModule(function (module) {
+var getInternalState = internalState.get;
+var enforceInternalState = internalState.enforce;
+var TEMPLATE = String(String).split('String');
+
+(module.exports = function (O, key, value, options) {
+ var unsafe = options ? !!options.unsafe : false;
+ var simple = options ? !!options.enumerable : false;
+ var noTargetGet = options ? !!options.noTargetGet : false;
+ if (typeof value == 'function') {
+ if (typeof key == 'string' && !has(value, 'name')) createNonEnumerableProperty(value, 'name', key);
+ enforceInternalState(value).source = TEMPLATE.join(typeof key == 'string' ? key : '');
+ }
+ if (O === global_1) {
+ if (simple) O[key] = value;
+ else setGlobal(key, value);
+ return;
+ } else if (!unsafe) {
+ delete O[key];
+ } else if (!noTargetGet && O[key]) {
+ simple = true;
+ }
+ if (simple) O[key] = value;
+ else createNonEnumerableProperty(O, key, value);
+// add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
+})(Function.prototype, 'toString', function toString() {
+ return typeof this == 'function' && getInternalState(this).source || inspectSource(this);
+});
+});
+
+var path = global_1;
+
+var aFunction = function (variable) {
+ return typeof variable == 'function' ? variable : undefined;
+};
+
+var getBuiltIn = function (namespace, method) {
+ return arguments.length < 2 ? aFunction(path[namespace]) || aFunction(global_1[namespace])
+ : path[namespace] && path[namespace][method] || global_1[namespace] && global_1[namespace][method];
+};
+
+var ceil = Math.ceil;
+var floor = Math.floor;
+
+// `ToInteger` abstract operation
+// https://tc39.github.io/ecma262/#sec-tointeger
+var toInteger = function (argument) {
+ return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor : ceil)(argument);
+};
+
+var min = Math.min;
+
+// `ToLength` abstract operation
+// https://tc39.github.io/ecma262/#sec-tolength
+var toLength = function (argument) {
+ return argument > 0 ? min(toInteger(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
+};
+
+var max = Math.max;
+var min$1 = Math.min;
+
+// Helper for a popular repeating case of the spec:
+// Let integer be ? ToInteger(index).
+// If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
+var toAbsoluteIndex = function (index, length) {
+ var integer = toInteger(index);
+ return integer < 0 ? max(integer + length, 0) : min$1(integer, length);
+};
+
+// `Array.prototype.{ indexOf, includes }` methods implementation
+var createMethod = function (IS_INCLUDES) {
+ return function ($this, el, fromIndex) {
+ var O = toIndexedObject($this);
+ var length = toLength(O.length);
+ var index = toAbsoluteIndex(fromIndex, length);
+ var value;
+ // Array#includes uses SameValueZero equality algorithm
+ // eslint-disable-next-line no-self-compare
+ if (IS_INCLUDES && el != el) while (length > index) {
+ value = O[index++];
+ // eslint-disable-next-line no-self-compare
+ if (value != value) return true;
+ // Array#indexOf ignores holes, Array#includes - not
+ } else for (;length > index; index++) {
+ if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
+ } return !IS_INCLUDES && -1;
+ };
+};
+
+var arrayIncludes = {
+ // `Array.prototype.includes` method
+ // https://tc39.github.io/ecma262/#sec-array.prototype.includes
+ includes: createMethod(true),
+ // `Array.prototype.indexOf` method
+ // https://tc39.github.io/ecma262/#sec-array.prototype.indexof
+ indexOf: createMethod(false)
+};
+
+var indexOf = arrayIncludes.indexOf;
+
+
+var objectKeysInternal = function (object, names) {
+ var O = toIndexedObject(object);
+ var i = 0;
+ var result = [];
+ var key;
+ for (key in O) !has(hiddenKeys, key) && has(O, key) && result.push(key);
+ // Don't enum bug & hidden keys
+ while (names.length > i) if (has(O, key = names[i++])) {
+ ~indexOf(result, key) || result.push(key);
+ }
+ return result;
+};
+
+// IE8- don't enum bug keys
+var enumBugKeys = [
+ 'constructor',
+ 'hasOwnProperty',
+ 'isPrototypeOf',
+ 'propertyIsEnumerable',
+ 'toLocaleString',
+ 'toString',
+ 'valueOf'
+];
+
+var hiddenKeys$1 = enumBugKeys.concat('length', 'prototype');
+
+// `Object.getOwnPropertyNames` method
+// https://tc39.github.io/ecma262/#sec-object.getownpropertynames
+var f$3 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
+ return objectKeysInternal(O, hiddenKeys$1);
+};
+
+var objectGetOwnPropertyNames = {
+ f: f$3
+};
+
+var f$4 = Object.getOwnPropertySymbols;
+
+var objectGetOwnPropertySymbols = {
+ f: f$4
+};
+
+// all object keys, includes non-enumerable and symbols
+var ownKeys = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
+ var keys = objectGetOwnPropertyNames.f(anObject(it));
+ var getOwnPropertySymbols = objectGetOwnPropertySymbols.f;
+ return getOwnPropertySymbols ? keys.concat(getOwnPropertySymbols(it)) : keys;
+};
+
+var copyConstructorProperties = function (target, source) {
+ var keys = ownKeys(source);
+ var defineProperty = objectDefineProperty.f;
+ var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
+ for (var i = 0; i < keys.length; i++) {
+ var key = keys[i];
+ if (!has(target, key)) defineProperty(target, key, getOwnPropertyDescriptor(source, key));
+ }
+};
+
+var replacement = /#|\.prototype\./;
+
+var isForced = function (feature, detection) {
+ var value = data[normalize(feature)];
+ return value == POLYFILL ? true
+ : value == NATIVE ? false
+ : typeof detection == 'function' ? fails(detection)
+ : !!detection;
+};
+
+var normalize = isForced.normalize = function (string) {
+ return String(string).replace(replacement, '.').toLowerCase();
+};
+
+var data = isForced.data = {};
+var NATIVE = isForced.NATIVE = 'N';
+var POLYFILL = isForced.POLYFILL = 'P';
+
+var isForced_1 = isForced;
+
+var getOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f;
+
+
+
+
+
+
+/*
+ options.target - name of the target object
+ options.global - target is the global object
+ options.stat - export as static methods of target
+ options.proto - export as prototype methods of target
+ options.real - real prototype method for the `pure` version
+ options.forced - export even if the native feature is available
+ options.bind - bind methods to the target, required for the `pure` version
+ options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
+ options.unsafe - use the simple assignment of property instead of delete + defineProperty
+ options.sham - add a flag to not completely full polyfills
+ options.enumerable - export as enumerable property
+ options.noTargetGet - prevent calling a getter on target
+*/
+var _export = function (options, source) {
+ var TARGET = options.target;
+ var GLOBAL = options.global;
+ var STATIC = options.stat;
+ var FORCED, target, key, targetProperty, sourceProperty, descriptor;
+ if (GLOBAL) {
+ target = global_1;
+ } else if (STATIC) {
+ target = global_1[TARGET] || setGlobal(TARGET, {});
+ } else {
+ target = (global_1[TARGET] || {}).prototype;
+ }
+ if (target) for (key in source) {
+ sourceProperty = source[key];
+ if (options.noTargetGet) {
+ descriptor = getOwnPropertyDescriptor$1(target, key);
+ targetProperty = descriptor && descriptor.value;
+ } else targetProperty = target[key];
+ FORCED = isForced_1(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
+ // contained in target
+ if (!FORCED && targetProperty !== undefined) {
+ if (typeof sourceProperty === typeof targetProperty) continue;
+ copyConstructorProperties(sourceProperty, targetProperty);
+ }
+ // add a flag to not completely full polyfills
+ if (options.sham || (targetProperty && targetProperty.sham)) {
+ createNonEnumerableProperty(sourceProperty, 'sham', true);
+ }
+ // extend global
+ redefine(target, key, sourceProperty, options);
+ }
+};
+
+var nativeSymbol = !!Object.getOwnPropertySymbols && !fails(function () {
+ // Chrome 38 Symbol has incorrect toString conversion
+ // eslint-disable-next-line no-undef
+ return !String(Symbol());
+});
+
+var useSymbolAsUid = nativeSymbol
+ // eslint-disable-next-line no-undef
+ && !Symbol.sham
+ // eslint-disable-next-line no-undef
+ && typeof Symbol.iterator == 'symbol';
+
+// `IsArray` abstract operation
+// https://tc39.github.io/ecma262/#sec-isarray
+var isArray = Array.isArray || function isArray(arg) {
+ return classofRaw(arg) == 'Array';
+};
+
+// `ToObject` abstract operation
+// https://tc39.github.io/ecma262/#sec-toobject
+var toObject = function (argument) {
+ return Object(requireObjectCoercible(argument));
+};
+
+// `Object.keys` method
+// https://tc39.github.io/ecma262/#sec-object.keys
+var objectKeys = Object.keys || function keys(O) {
+ return objectKeysInternal(O, enumBugKeys);
+};
+
+// `Object.defineProperties` method
+// https://tc39.github.io/ecma262/#sec-object.defineproperties
+var objectDefineProperties = descriptors ? Object.defineProperties : function defineProperties(O, Properties) {
+ anObject(O);
+ var keys = objectKeys(Properties);
+ var length = keys.length;
+ var index = 0;
+ var key;
+ while (length > index) objectDefineProperty.f(O, key = keys[index++], Properties[key]);
+ return O;
+};
+
+var html = getBuiltIn('document', 'documentElement');
+
+var GT = '>';
+var LT = '<';
+var PROTOTYPE = 'prototype';
+var SCRIPT = 'script';
+var IE_PROTO = sharedKey('IE_PROTO');
+
+var EmptyConstructor = function () { /* empty */ };
+
+var scriptTag = function (content) {
+ return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
+};
+
+// Create object with fake `null` prototype: use ActiveX Object with cleared prototype
+var NullProtoObjectViaActiveX = function (activeXDocument) {
+ activeXDocument.write(scriptTag(''));
+ activeXDocument.close();
+ var temp = activeXDocument.parentWindow.Object;
+ activeXDocument = null; // avoid memory leak
+ return temp;
+};
+
+// Create object with fake `null` prototype: use iframe Object with cleared prototype
+var NullProtoObjectViaIFrame = function () {
+ // Thrash, waste and sodomy: IE GC bug
+ var iframe = documentCreateElement('iframe');
+ var JS = 'java' + SCRIPT + ':';
+ var iframeDocument;
+ iframe.style.display = 'none';
+ html.appendChild(iframe);
+ // https://github.com/zloirock/core-js/issues/475
+ iframe.src = String(JS);
+ iframeDocument = iframe.contentWindow.document;
+ iframeDocument.open();
+ iframeDocument.write(scriptTag('document.F=Object'));
+ iframeDocument.close();
+ return iframeDocument.F;
+};
+
+// Check for document.domain and active x support
+// No need to use active x approach when document.domain is not set
+// see https://github.com/es-shims/es5-shim/issues/150
+// variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346
+// avoid IE GC bug
+var activeXDocument;
+var NullProtoObject = function () {
+ try {
+ /* global ActiveXObject */
+ activeXDocument = document.domain && new ActiveXObject('htmlfile');
+ } catch (error) { /* ignore */ }
+ NullProtoObject = activeXDocument ? NullProtoObjectViaActiveX(activeXDocument) : NullProtoObjectViaIFrame();
+ var length = enumBugKeys.length;
+ while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];
+ return NullProtoObject();
+};
+
+hiddenKeys[IE_PROTO] = true;
+
+// `Object.create` method
+// https://tc39.github.io/ecma262/#sec-object.create
+var objectCreate = Object.create || function create(O, Properties) {
+ var result;
+ if (O !== null) {
+ EmptyConstructor[PROTOTYPE] = anObject(O);
+ result = new EmptyConstructor();
+ EmptyConstructor[PROTOTYPE] = null;
+ // add "__proto__" for Object.getPrototypeOf polyfill
+ result[IE_PROTO] = O;
+ } else result = NullProtoObject();
+ return Properties === undefined ? result : objectDefineProperties(result, Properties);
+};
+
+var nativeGetOwnPropertyNames = objectGetOwnPropertyNames.f;
+
+var toString$1 = {}.toString;
+
+var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames
+ ? Object.getOwnPropertyNames(window) : [];
+
+var getWindowNames = function (it) {
+ try {
+ return nativeGetOwnPropertyNames(it);
+ } catch (error) {
+ return windowNames.slice();
+ }
+};
+
+// fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window
+var f$5 = function getOwnPropertyNames(it) {
+ return windowNames && toString$1.call(it) == '[object Window]'
+ ? getWindowNames(it)
+ : nativeGetOwnPropertyNames(toIndexedObject(it));
+};
+
+var objectGetOwnPropertyNamesExternal = {
+ f: f$5
+};
+
+var WellKnownSymbolsStore = shared('wks');
+var Symbol$1 = global_1.Symbol;
+var createWellKnownSymbol = useSymbolAsUid ? Symbol$1 : Symbol$1 && Symbol$1.withoutSetter || uid;
+
+var wellKnownSymbol = function (name) {
+ if (!has(WellKnownSymbolsStore, name)) {
+ if (nativeSymbol && has(Symbol$1, name)) WellKnownSymbolsStore[name] = Symbol$1[name];
+ else WellKnownSymbolsStore[name] = createWellKnownSymbol('Symbol.' + name);
+ } return WellKnownSymbolsStore[name];
+};
+
+var f$6 = wellKnownSymbol;
+
+var wellKnownSymbolWrapped = {
+ f: f$6
+};
+
+var defineProperty = objectDefineProperty.f;
+
+var defineWellKnownSymbol = function (NAME) {
+ var Symbol = path.Symbol || (path.Symbol = {});
+ if (!has(Symbol, NAME)) defineProperty(Symbol, NAME, {
+ value: wellKnownSymbolWrapped.f(NAME)
+ });
+};
+
+var defineProperty$1 = objectDefineProperty.f;
+
+
+
+var TO_STRING_TAG = wellKnownSymbol('toStringTag');
+
+var setToStringTag = function (it, TAG, STATIC) {
+ if (it && !has(it = STATIC ? it : it.prototype, TO_STRING_TAG)) {
+ defineProperty$1(it, TO_STRING_TAG, { configurable: true, value: TAG });
+ }
+};
+
+var aFunction$1 = function (it) {
+ if (typeof it != 'function') {
+ throw TypeError(String(it) + ' is not a function');
+ } return it;
+};
+
+// optional / simple context binding
+var functionBindContext = function (fn, that, length) {
+ aFunction$1(fn);
+ if (that === undefined) return fn;
+ switch (length) {
+ case 0: return function () {
+ return fn.call(that);
+ };
+ case 1: return function (a) {
+ return fn.call(that, a);
+ };
+ case 2: return function (a, b) {
+ return fn.call(that, a, b);
+ };
+ case 3: return function (a, b, c) {
+ return fn.call(that, a, b, c);
+ };
+ }
+ return function (/* ...args */) {
+ return fn.apply(that, arguments);
+ };
+};
+
+var SPECIES = wellKnownSymbol('species');
+
+// `ArraySpeciesCreate` abstract operation
+// https://tc39.github.io/ecma262/#sec-arrayspeciescreate
+var arraySpeciesCreate = function (originalArray, length) {
+ var C;
+ if (isArray(originalArray)) {
+ C = originalArray.constructor;
+ // cross-realm fallback
+ if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined;
+ else if (isObject(C)) {
+ C = C[SPECIES];
+ if (C === null) C = undefined;
+ }
+ } return new (C === undefined ? Array : C)(length === 0 ? 0 : length);
+};
+
+var push = [].push;
+
+// `Array.prototype.{ forEach, map, filter, some, every, find, findIndex }` methods implementation
+var createMethod$1 = function (TYPE) {
+ var IS_MAP = TYPE == 1;
+ var IS_FILTER = TYPE == 2;
+ var IS_SOME = TYPE == 3;
+ var IS_EVERY = TYPE == 4;
+ var IS_FIND_INDEX = TYPE == 6;
+ var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
+ return function ($this, callbackfn, that, specificCreate) {
+ var O = toObject($this);
+ var self = indexedObject(O);
+ var boundFunction = functionBindContext(callbackfn, that, 3);
+ var length = toLength(self.length);
+ var index = 0;
+ var create = specificCreate || arraySpeciesCreate;
+ var target = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined;
+ var value, result;
+ for (;length > index; index++) if (NO_HOLES || index in self) {
+ value = self[index];
+ result = boundFunction(value, index, O);
+ if (TYPE) {
+ if (IS_MAP) target[index] = result; // map
+ else if (result) switch (TYPE) {
+ case 3: return true; // some
+ case 5: return value; // find
+ case 6: return index; // findIndex
+ case 2: push.call(target, value); // filter
+ } else if (IS_EVERY) return false; // every
+ }
+ }
+ return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target;
+ };
+};
+
+var arrayIteration = {
+ // `Array.prototype.forEach` method
+ // https://tc39.github.io/ecma262/#sec-array.prototype.foreach
+ forEach: createMethod$1(0),
+ // `Array.prototype.map` method
+ // https://tc39.github.io/ecma262/#sec-array.prototype.map
+ map: createMethod$1(1),
+ // `Array.prototype.filter` method
+ // https://tc39.github.io/ecma262/#sec-array.prototype.filter
+ filter: createMethod$1(2),
+ // `Array.prototype.some` method
+ // https://tc39.github.io/ecma262/#sec-array.prototype.some
+ some: createMethod$1(3),
+ // `Array.prototype.every` method
+ // https://tc39.github.io/ecma262/#sec-array.prototype.every
+ every: createMethod$1(4),
+ // `Array.prototype.find` method
+ // https://tc39.github.io/ecma262/#sec-array.prototype.find
+ find: createMethod$1(5),
+ // `Array.prototype.findIndex` method
+ // https://tc39.github.io/ecma262/#sec-array.prototype.findIndex
+ findIndex: createMethod$1(6)
+};
+
+var $forEach = arrayIteration.forEach;
+
+var HIDDEN = sharedKey('hidden');
+var SYMBOL = 'Symbol';
+var PROTOTYPE$1 = 'prototype';
+var TO_PRIMITIVE = wellKnownSymbol('toPrimitive');
+var setInternalState = internalState.set;
+var getInternalState = internalState.getterFor(SYMBOL);
+var ObjectPrototype = Object[PROTOTYPE$1];
+var $Symbol = global_1.Symbol;
+var $stringify = getBuiltIn('JSON', 'stringify');
+var nativeGetOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f;
+var nativeDefineProperty$1 = objectDefineProperty.f;
+var nativeGetOwnPropertyNames$1 = objectGetOwnPropertyNamesExternal.f;
+var nativePropertyIsEnumerable$1 = objectPropertyIsEnumerable.f;
+var AllSymbols = shared('symbols');
+var ObjectPrototypeSymbols = shared('op-symbols');
+var StringToSymbolRegistry = shared('string-to-symbol-registry');
+var SymbolToStringRegistry = shared('symbol-to-string-registry');
+var WellKnownSymbolsStore$1 = shared('wks');
+var QObject = global_1.QObject;
+// Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173
+var USE_SETTER = !QObject || !QObject[PROTOTYPE$1] || !QObject[PROTOTYPE$1].findChild;
+
+// fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687
+var setSymbolDescriptor = descriptors && fails(function () {
+ return objectCreate(nativeDefineProperty$1({}, 'a', {
+ get: function () { return nativeDefineProperty$1(this, 'a', { value: 7 }).a; }
+ })).a != 7;
+}) ? function (O, P, Attributes) {
+ var ObjectPrototypeDescriptor = nativeGetOwnPropertyDescriptor$1(ObjectPrototype, P);
+ if (ObjectPrototypeDescriptor) delete ObjectPrototype[P];
+ nativeDefineProperty$1(O, P, Attributes);
+ if (ObjectPrototypeDescriptor && O !== ObjectPrototype) {
+ nativeDefineProperty$1(ObjectPrototype, P, ObjectPrototypeDescriptor);
+ }
+} : nativeDefineProperty$1;
+
+var wrap = function (tag, description) {
+ var symbol = AllSymbols[tag] = objectCreate($Symbol[PROTOTYPE$1]);
+ setInternalState(symbol, {
+ type: SYMBOL,
+ tag: tag,
+ description: description
+ });
+ if (!descriptors) symbol.description = description;
+ return symbol;
+};
+
+var isSymbol = useSymbolAsUid ? function (it) {
+ return typeof it == 'symbol';
+} : function (it) {
+ return Object(it) instanceof $Symbol;
+};
+
+var $defineProperty = function defineProperty(O, P, Attributes) {
+ if (O === ObjectPrototype) $defineProperty(ObjectPrototypeSymbols, P, Attributes);
+ anObject(O);
+ var key = toPrimitive(P, true);
+ anObject(Attributes);
+ if (has(AllSymbols, key)) {
+ if (!Attributes.enumerable) {
+ if (!has(O, HIDDEN)) nativeDefineProperty$1(O, HIDDEN, createPropertyDescriptor(1, {}));
+ O[HIDDEN][key] = true;
+ } else {
+ if (has(O, HIDDEN) && O[HIDDEN][key]) O[HIDDEN][key] = false;
+ Attributes = objectCreate(Attributes, { enumerable: createPropertyDescriptor(0, false) });
+ } return setSymbolDescriptor(O, key, Attributes);
+ } return nativeDefineProperty$1(O, key, Attributes);
+};
+
+var $defineProperties = function defineProperties(O, Properties) {
+ anObject(O);
+ var properties = toIndexedObject(Properties);
+ var keys = objectKeys(properties).concat($getOwnPropertySymbols(properties));
+ $forEach(keys, function (key) {
+ if (!descriptors || $propertyIsEnumerable.call(properties, key)) $defineProperty(O, key, properties[key]);
+ });
+ return O;
+};
+
+var $create = function create(O, Properties) {
+ return Properties === undefined ? objectCreate(O) : $defineProperties(objectCreate(O), Properties);
+};
+
+var $propertyIsEnumerable = function propertyIsEnumerable(V) {
+ var P = toPrimitive(V, true);
+ var enumerable = nativePropertyIsEnumerable$1.call(this, P);
+ if (this === ObjectPrototype && has(AllSymbols, P) && !has(ObjectPrototypeSymbols, P)) return false;
+ return enumerable || !has(this, P) || !has(AllSymbols, P) || has(this, HIDDEN) && this[HIDDEN][P] ? enumerable : true;
+};
+
+var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(O, P) {
+ var it = toIndexedObject(O);
+ var key = toPrimitive(P, true);
+ if (it === ObjectPrototype && has(AllSymbols, key) && !has(ObjectPrototypeSymbols, key)) return;
+ var descriptor = nativeGetOwnPropertyDescriptor$1(it, key);
+ if (descriptor && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key])) {
+ descriptor.enumerable = true;
+ }
+ return descriptor;
+};
+
+var $getOwnPropertyNames = function getOwnPropertyNames(O) {
+ var names = nativeGetOwnPropertyNames$1(toIndexedObject(O));
+ var result = [];
+ $forEach(names, function (key) {
+ if (!has(AllSymbols, key) && !has(hiddenKeys, key)) result.push(key);
+ });
+ return result;
+};
+
+var $getOwnPropertySymbols = function getOwnPropertySymbols(O) {
+ var IS_OBJECT_PROTOTYPE = O === ObjectPrototype;
+ var names = nativeGetOwnPropertyNames$1(IS_OBJECT_PROTOTYPE ? ObjectPrototypeSymbols : toIndexedObject(O));
+ var result = [];
+ $forEach(names, function (key) {
+ if (has(AllSymbols, key) && (!IS_OBJECT_PROTOTYPE || has(ObjectPrototype, key))) {
+ result.push(AllSymbols[key]);
+ }
+ });
+ return result;
+};
+
+// `Symbol` constructor
+// https://tc39.github.io/ecma262/#sec-symbol-constructor
+if (!nativeSymbol) {
+ $Symbol = function Symbol() {
+ if (this instanceof $Symbol) throw TypeError('Symbol is not a constructor');
+ var description = !arguments.length || arguments[0] === undefined ? undefined : String(arguments[0]);
+ var tag = uid(description);
+ var setter = function (value) {
+ if (this === ObjectPrototype) setter.call(ObjectPrototypeSymbols, value);
+ if (has(this, HIDDEN) && has(this[HIDDEN], tag)) this[HIDDEN][tag] = false;
+ setSymbolDescriptor(this, tag, createPropertyDescriptor(1, value));
+ };
+ if (descriptors && USE_SETTER) setSymbolDescriptor(ObjectPrototype, tag, { configurable: true, set: setter });
+ return wrap(tag, description);
+ };
+
+ redefine($Symbol[PROTOTYPE$1], 'toString', function toString() {
+ return getInternalState(this).tag;
+ });
+
+ redefine($Symbol, 'withoutSetter', function (description) {
+ return wrap(uid(description), description);
+ });
+
+ objectPropertyIsEnumerable.f = $propertyIsEnumerable;
+ objectDefineProperty.f = $defineProperty;
+ objectGetOwnPropertyDescriptor.f = $getOwnPropertyDescriptor;
+ objectGetOwnPropertyNames.f = objectGetOwnPropertyNamesExternal.f = $getOwnPropertyNames;
+ objectGetOwnPropertySymbols.f = $getOwnPropertySymbols;
+
+ wellKnownSymbolWrapped.f = function (name) {
+ return wrap(wellKnownSymbol(name), name);
+ };
+
+ if (descriptors) {
+ // https://github.com/tc39/proposal-Symbol-description
+ nativeDefineProperty$1($Symbol[PROTOTYPE$1], 'description', {
+ configurable: true,
+ get: function description() {
+ return getInternalState(this).description;
+ }
+ });
+ {
+ redefine(ObjectPrototype, 'propertyIsEnumerable', $propertyIsEnumerable, { unsafe: true });
+ }
+ }
+}
+
+_export({ global: true, wrap: true, forced: !nativeSymbol, sham: !nativeSymbol }, {
+ Symbol: $Symbol
+});
+
+$forEach(objectKeys(WellKnownSymbolsStore$1), function (name) {
+ defineWellKnownSymbol(name);
+});
+
+_export({ target: SYMBOL, stat: true, forced: !nativeSymbol }, {
+ // `Symbol.for` method
+ // https://tc39.github.io/ecma262/#sec-symbol.for
+ 'for': function (key) {
+ var string = String(key);
+ if (has(StringToSymbolRegistry, string)) return StringToSymbolRegistry[string];
+ var symbol = $Symbol(string);
+ StringToSymbolRegistry[string] = symbol;
+ SymbolToStringRegistry[symbol] = string;
+ return symbol;
+ },
+ // `Symbol.keyFor` method
+ // https://tc39.github.io/ecma262/#sec-symbol.keyfor
+ keyFor: function keyFor(sym) {
+ if (!isSymbol(sym)) throw TypeError(sym + ' is not a symbol');
+ if (has(SymbolToStringRegistry, sym)) return SymbolToStringRegistry[sym];
+ },
+ useSetter: function () { USE_SETTER = true; },
+ useSimple: function () { USE_SETTER = false; }
+});
+
+_export({ target: 'Object', stat: true, forced: !nativeSymbol, sham: !descriptors }, {
+ // `Object.create` method
+ // https://tc39.github.io/ecma262/#sec-object.create
+ create: $create,
+ // `Object.defineProperty` method
+ // https://tc39.github.io/ecma262/#sec-object.defineproperty
+ defineProperty: $defineProperty,
+ // `Object.defineProperties` method
+ // https://tc39.github.io/ecma262/#sec-object.defineproperties
+ defineProperties: $defineProperties,
+ // `Object.getOwnPropertyDescriptor` method
+ // https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptors
+ getOwnPropertyDescriptor: $getOwnPropertyDescriptor
+});
+
+_export({ target: 'Object', stat: true, forced: !nativeSymbol }, {
+ // `Object.getOwnPropertyNames` method
+ // https://tc39.github.io/ecma262/#sec-object.getownpropertynames
+ getOwnPropertyNames: $getOwnPropertyNames,
+ // `Object.getOwnPropertySymbols` method
+ // https://tc39.github.io/ecma262/#sec-object.getownpropertysymbols
+ getOwnPropertySymbols: $getOwnPropertySymbols
+});
+
+// Chrome 38 and 39 `Object.getOwnPropertySymbols` fails on primitives
+// https://bugs.chromium.org/p/v8/issues/detail?id=3443
+_export({ target: 'Object', stat: true, forced: fails(function () { objectGetOwnPropertySymbols.f(1); }) }, {
+ getOwnPropertySymbols: function getOwnPropertySymbols(it) {
+ return objectGetOwnPropertySymbols.f(toObject(it));
+ }
+});
+
+// `JSON.stringify` method behavior with symbols
+// https://tc39.github.io/ecma262/#sec-json.stringify
+if ($stringify) {
+ var FORCED_JSON_STRINGIFY = !nativeSymbol || fails(function () {
+ var symbol = $Symbol();
+ // MS Edge converts symbol values to JSON as {}
+ return $stringify([symbol]) != '[null]'
+ // WebKit converts symbol values to JSON as null
+ || $stringify({ a: symbol }) != '{}'
+ // V8 throws on boxed symbols
+ || $stringify(Object(symbol)) != '{}';
+ });
+
+ _export({ target: 'JSON', stat: true, forced: FORCED_JSON_STRINGIFY }, {
+ // eslint-disable-next-line no-unused-vars
+ stringify: function stringify(it, replacer, space) {
+ var args = [it];
+ var index = 1;
+ var $replacer;
+ while (arguments.length > index) args.push(arguments[index++]);
+ $replacer = replacer;
+ if (!isObject(replacer) && it === undefined || isSymbol(it)) return; // IE8 returns string on undefined
+ if (!isArray(replacer)) replacer = function (key, value) {
+ if (typeof $replacer == 'function') value = $replacer.call(this, key, value);
+ if (!isSymbol(value)) return value;
+ };
+ args[1] = replacer;
+ return $stringify.apply(null, args);
+ }
+ });
+}
+
+// `Symbol.prototype[@@toPrimitive]` method
+// https://tc39.github.io/ecma262/#sec-symbol.prototype-@@toprimitive
+if (!$Symbol[PROTOTYPE$1][TO_PRIMITIVE]) {
+ createNonEnumerableProperty($Symbol[PROTOTYPE$1], TO_PRIMITIVE, $Symbol[PROTOTYPE$1].valueOf);
+}
+// `Symbol.prototype[@@toStringTag]` property
+// https://tc39.github.io/ecma262/#sec-symbol.prototype-@@tostringtag
+setToStringTag($Symbol, SYMBOL);
+
+hiddenKeys[HIDDEN] = true;
+
+var defineProperty$2 = objectDefineProperty.f;
+
+
+var NativeSymbol = global_1.Symbol;
+
+if (descriptors && typeof NativeSymbol == 'function' && (!('description' in NativeSymbol.prototype) ||
+ // Safari 12 bug
+ NativeSymbol().description !== undefined
+)) {
+ var EmptyStringDescriptionStore = {};
+ // wrap Symbol constructor for correct work with undefined description
+ var SymbolWrapper = function Symbol() {
+ var description = arguments.length < 1 || arguments[0] === undefined ? undefined : String(arguments[0]);
+ var result = this instanceof SymbolWrapper
+ ? new NativeSymbol(description)
+ // in Edge 13, String(Symbol(undefined)) === 'Symbol(undefined)'
+ : description === undefined ? NativeSymbol() : NativeSymbol(description);
+ if (description === '') EmptyStringDescriptionStore[result] = true;
+ return result;
+ };
+ copyConstructorProperties(SymbolWrapper, NativeSymbol);
+ var symbolPrototype = SymbolWrapper.prototype = NativeSymbol.prototype;
+ symbolPrototype.constructor = SymbolWrapper;
+
+ var symbolToString = symbolPrototype.toString;
+ var native = String(NativeSymbol('test')) == 'Symbol(test)';
+ var regexp = /^Symbol\((.*)\)[^)]+$/;
+ defineProperty$2(symbolPrototype, 'description', {
+ configurable: true,
+ get: function description() {
+ var symbol = isObject(this) ? this.valueOf() : this;
+ var string = symbolToString.call(symbol);
+ if (has(EmptyStringDescriptionStore, symbol)) return '';
+ var desc = native ? string.slice(7, -1) : string.replace(regexp, '$1');
+ return desc === '' ? undefined : desc;
+ }
+ });
+
+ _export({ global: true, forced: true }, {
+ Symbol: SymbolWrapper
+ });
+}
+
+// `Symbol.iterator` well-known symbol
+// https://tc39.github.io/ecma262/#sec-symbol.iterator
+defineWellKnownSymbol('iterator');
+
+var arrayMethodIsStrict = function (METHOD_NAME, argument) {
+ var method = [][METHOD_NAME];
+ return !!method && fails(function () {
+ // eslint-disable-next-line no-useless-call,no-throw-literal
+ method.call(null, argument || function () { throw 1; }, 1);
+ });
+};
+
+var defineProperty$3 = Object.defineProperty;
+var cache = {};
+
+var thrower = function (it) { throw it; };
+
+var arrayMethodUsesToLength = function (METHOD_NAME, options) {
+ if (has(cache, METHOD_NAME)) return cache[METHOD_NAME];
+ if (!options) options = {};
+ var method = [][METHOD_NAME];
+ var ACCESSORS = has(options, 'ACCESSORS') ? options.ACCESSORS : false;
+ var argument0 = has(options, 0) ? options[0] : thrower;
+ var argument1 = has(options, 1) ? options[1] : undefined;
+
+ return cache[METHOD_NAME] = !!method && !fails(function () {
+ if (ACCESSORS && !descriptors) return true;
+ var O = { length: -1 };
+
+ if (ACCESSORS) defineProperty$3(O, 1, { enumerable: true, get: thrower });
+ else O[1] = 1;
+
+ method.call(O, argument0, argument1);
+ });
+};
+
+var $forEach$1 = arrayIteration.forEach;
+
+
+
+var STRICT_METHOD = arrayMethodIsStrict('forEach');
+var USES_TO_LENGTH = arrayMethodUsesToLength('forEach');
+
+// `Array.prototype.forEach` method implementation
+// https://tc39.github.io/ecma262/#sec-array.prototype.foreach
+var arrayForEach = (!STRICT_METHOD || !USES_TO_LENGTH) ? function forEach(callbackfn /* , thisArg */) {
+ return $forEach$1(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
+} : [].forEach;
+
+// `Array.prototype.forEach` method
+// https://tc39.github.io/ecma262/#sec-array.prototype.foreach
+_export({ target: 'Array', proto: true, forced: [].forEach != arrayForEach }, {
+ forEach: arrayForEach
+});
+
+var $indexOf = arrayIncludes.indexOf;
+
+
+
+var nativeIndexOf = [].indexOf;
+
+var NEGATIVE_ZERO = !!nativeIndexOf && 1 / [1].indexOf(1, -0) < 0;
+var STRICT_METHOD$1 = arrayMethodIsStrict('indexOf');
+var USES_TO_LENGTH$1 = arrayMethodUsesToLength('indexOf', { ACCESSORS: true, 1: 0 });
+
+// `Array.prototype.indexOf` method
+// https://tc39.github.io/ecma262/#sec-array.prototype.indexof
+_export({ target: 'Array', proto: true, forced: NEGATIVE_ZERO || !STRICT_METHOD$1 || !USES_TO_LENGTH$1 }, {
+ indexOf: function indexOf(searchElement /* , fromIndex = 0 */) {
+ return NEGATIVE_ZERO
+ // convert -0 to +0
+ ? nativeIndexOf.apply(this, arguments) || 0
+ : $indexOf(this, searchElement, arguments.length > 1 ? arguments[1] : undefined);
+ }
+});
+
+var UNSCOPABLES = wellKnownSymbol('unscopables');
+var ArrayPrototype = Array.prototype;
+
+// Array.prototype[@@unscopables]
+// https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables
+if (ArrayPrototype[UNSCOPABLES] == undefined) {
+ objectDefineProperty.f(ArrayPrototype, UNSCOPABLES, {
+ configurable: true,
+ value: objectCreate(null)
+ });
+}
+
+// add a key to Array.prototype[@@unscopables]
+var addToUnscopables = function (key) {
+ ArrayPrototype[UNSCOPABLES][key] = true;
+};
+
+var iterators = {};
+
+var correctPrototypeGetter = !fails(function () {
+ function F() { /* empty */ }
+ F.prototype.constructor = null;
+ return Object.getPrototypeOf(new F()) !== F.prototype;
+});
+
+var IE_PROTO$1 = sharedKey('IE_PROTO');
+var ObjectPrototype$1 = Object.prototype;
+
+// `Object.getPrototypeOf` method
+// https://tc39.github.io/ecma262/#sec-object.getprototypeof
+var objectGetPrototypeOf = correctPrototypeGetter ? Object.getPrototypeOf : function (O) {
+ O = toObject(O);
+ if (has(O, IE_PROTO$1)) return O[IE_PROTO$1];
+ if (typeof O.constructor == 'function' && O instanceof O.constructor) {
+ return O.constructor.prototype;
+ } return O instanceof Object ? ObjectPrototype$1 : null;
+};
+
+var ITERATOR = wellKnownSymbol('iterator');
+var BUGGY_SAFARI_ITERATORS = false;
+
+var returnThis = function () { return this; };
+
+// `%IteratorPrototype%` object
+// https://tc39.github.io/ecma262/#sec-%iteratorprototype%-object
+var IteratorPrototype, PrototypeOfArrayIteratorPrototype, arrayIterator;
+
+if ([].keys) {
+ arrayIterator = [].keys();
+ // Safari 8 has buggy iterators w/o `next`
+ if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS = true;
+ else {
+ PrototypeOfArrayIteratorPrototype = objectGetPrototypeOf(objectGetPrototypeOf(arrayIterator));
+ if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype = PrototypeOfArrayIteratorPrototype;
+ }
+}
+
+if (IteratorPrototype == undefined) IteratorPrototype = {};
+
+// 25.1.2.1.1 %IteratorPrototype%[@@iterator]()
+if ( !has(IteratorPrototype, ITERATOR)) {
+ createNonEnumerableProperty(IteratorPrototype, ITERATOR, returnThis);
+}
+
+var iteratorsCore = {
+ IteratorPrototype: IteratorPrototype,
+ BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS
+};
+
+var IteratorPrototype$1 = iteratorsCore.IteratorPrototype;
+
+
+
+
+
+var returnThis$1 = function () { return this; };
+
+var createIteratorConstructor = function (IteratorConstructor, NAME, next) {
+ var TO_STRING_TAG = NAME + ' Iterator';
+ IteratorConstructor.prototype = objectCreate(IteratorPrototype$1, { next: createPropertyDescriptor(1, next) });
+ setToStringTag(IteratorConstructor, TO_STRING_TAG, false);
+ iterators[TO_STRING_TAG] = returnThis$1;
+ return IteratorConstructor;
+};
+
+var aPossiblePrototype = function (it) {
+ if (!isObject(it) && it !== null) {
+ throw TypeError("Can't set " + String(it) + ' as a prototype');
+ } return it;
+};
+
+// `Object.setPrototypeOf` method
+// https://tc39.github.io/ecma262/#sec-object.setprototypeof
+// Works with __proto__ only. Old v8 can't work with null proto objects.
+/* eslint-disable no-proto */
+var objectSetPrototypeOf = Object.setPrototypeOf || ('__proto__' in {} ? function () {
+ var CORRECT_SETTER = false;
+ var test = {};
+ var setter;
+ try {
+ setter = Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set;
+ setter.call(test, []);
+ CORRECT_SETTER = test instanceof Array;
+ } catch (error) { /* empty */ }
+ return function setPrototypeOf(O, proto) {
+ anObject(O);
+ aPossiblePrototype(proto);
+ if (CORRECT_SETTER) setter.call(O, proto);
+ else O.__proto__ = proto;
+ return O;
+ };
+}() : undefined);
+
+var IteratorPrototype$2 = iteratorsCore.IteratorPrototype;
+var BUGGY_SAFARI_ITERATORS$1 = iteratorsCore.BUGGY_SAFARI_ITERATORS;
+var ITERATOR$1 = wellKnownSymbol('iterator');
+var KEYS = 'keys';
+var VALUES = 'values';
+var ENTRIES = 'entries';
+
+var returnThis$2 = function () { return this; };
+
+var defineIterator = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) {
+ createIteratorConstructor(IteratorConstructor, NAME, next);
+
+ var getIterationMethod = function (KIND) {
+ if (KIND === DEFAULT && defaultIterator) return defaultIterator;
+ if (!BUGGY_SAFARI_ITERATORS$1 && KIND in IterablePrototype) return IterablePrototype[KIND];
+ switch (KIND) {
+ case KEYS: return function keys() { return new IteratorConstructor(this, KIND); };
+ case VALUES: return function values() { return new IteratorConstructor(this, KIND); };
+ case ENTRIES: return function entries() { return new IteratorConstructor(this, KIND); };
+ } return function () { return new IteratorConstructor(this); };
+ };
+
+ var TO_STRING_TAG = NAME + ' Iterator';
+ var INCORRECT_VALUES_NAME = false;
+ var IterablePrototype = Iterable.prototype;
+ var nativeIterator = IterablePrototype[ITERATOR$1]
+ || IterablePrototype['@@iterator']
+ || DEFAULT && IterablePrototype[DEFAULT];
+ var defaultIterator = !BUGGY_SAFARI_ITERATORS$1 && nativeIterator || getIterationMethod(DEFAULT);
+ var anyNativeIterator = NAME == 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator;
+ var CurrentIteratorPrototype, methods, KEY;
+
+ // fix native
+ if (anyNativeIterator) {
+ CurrentIteratorPrototype = objectGetPrototypeOf(anyNativeIterator.call(new Iterable()));
+ if (IteratorPrototype$2 !== Object.prototype && CurrentIteratorPrototype.next) {
+ if ( objectGetPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype$2) {
+ if (objectSetPrototypeOf) {
+ objectSetPrototypeOf(CurrentIteratorPrototype, IteratorPrototype$2);
+ } else if (typeof CurrentIteratorPrototype[ITERATOR$1] != 'function') {
+ createNonEnumerableProperty(CurrentIteratorPrototype, ITERATOR$1, returnThis$2);
+ }
+ }
+ // Set @@toStringTag to native iterators
+ setToStringTag(CurrentIteratorPrototype, TO_STRING_TAG, true);
+ }
+ }
+
+ // fix Array#{values, @@iterator}.name in V8 / FF
+ if (DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES) {
+ INCORRECT_VALUES_NAME = true;
+ defaultIterator = function values() { return nativeIterator.call(this); };
+ }
+
+ // define iterator
+ if ( IterablePrototype[ITERATOR$1] !== defaultIterator) {
+ createNonEnumerableProperty(IterablePrototype, ITERATOR$1, defaultIterator);
+ }
+ iterators[NAME] = defaultIterator;
+
+ // export additional methods
+ if (DEFAULT) {
+ methods = {
+ values: getIterationMethod(VALUES),
+ keys: IS_SET ? defaultIterator : getIterationMethod(KEYS),
+ entries: getIterationMethod(ENTRIES)
+ };
+ if (FORCED) for (KEY in methods) {
+ if (BUGGY_SAFARI_ITERATORS$1 || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) {
+ redefine(IterablePrototype, KEY, methods[KEY]);
+ }
+ } else _export({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS$1 || INCORRECT_VALUES_NAME }, methods);
+ }
+
+ return methods;
+};
+
+var ARRAY_ITERATOR = 'Array Iterator';
+var setInternalState$1 = internalState.set;
+var getInternalState$1 = internalState.getterFor(ARRAY_ITERATOR);
+
+// `Array.prototype.entries` method
+// https://tc39.github.io/ecma262/#sec-array.prototype.entries
+// `Array.prototype.keys` method
+// https://tc39.github.io/ecma262/#sec-array.prototype.keys
+// `Array.prototype.values` method
+// https://tc39.github.io/ecma262/#sec-array.prototype.values
+// `Array.prototype[@@iterator]` method
+// https://tc39.github.io/ecma262/#sec-array.prototype-@@iterator
+// `CreateArrayIterator` internal method
+// https://tc39.github.io/ecma262/#sec-createarrayiterator
+var es_array_iterator = defineIterator(Array, 'Array', function (iterated, kind) {
+ setInternalState$1(this, {
+ type: ARRAY_ITERATOR,
+ target: toIndexedObject(iterated), // target
+ index: 0, // next index
+ kind: kind // kind
+ });
+// `%ArrayIteratorPrototype%.next` method
+// https://tc39.github.io/ecma262/#sec-%arrayiteratorprototype%.next
+}, function () {
+ var state = getInternalState$1(this);
+ var target = state.target;
+ var kind = state.kind;
+ var index = state.index++;
+ if (!target || index >= target.length) {
+ state.target = undefined;
+ return { value: undefined, done: true };
+ }
+ if (kind == 'keys') return { value: index, done: false };
+ if (kind == 'values') return { value: target[index], done: false };
+ return { value: [index, target[index]], done: false };
+}, 'values');
+
+// argumentsList[@@iterator] is %ArrayProto_values%
+// https://tc39.github.io/ecma262/#sec-createunmappedargumentsobject
+// https://tc39.github.io/ecma262/#sec-createmappedargumentsobject
+iterators.Arguments = iterators.Array;
+
+// https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables
+addToUnscopables('keys');
+addToUnscopables('values');
+addToUnscopables('entries');
+
+var nativeJoin = [].join;
+
+var ES3_STRINGS = indexedObject != Object;
+var STRICT_METHOD$2 = arrayMethodIsStrict('join', ',');
+
+// `Array.prototype.join` method
+// https://tc39.github.io/ecma262/#sec-array.prototype.join
+_export({ target: 'Array', proto: true, forced: ES3_STRINGS || !STRICT_METHOD$2 }, {
+ join: function join(separator) {
+ return nativeJoin.call(toIndexedObject(this), separator === undefined ? ',' : separator);
+ }
+});
+
+var createProperty = function (object, key, value) {
+ var propertyKey = toPrimitive(key);
+ if (propertyKey in object) objectDefineProperty.f(object, propertyKey, createPropertyDescriptor(0, value));
+ else object[propertyKey] = value;
+};
+
+var engineUserAgent = getBuiltIn('navigator', 'userAgent') || '';
+
+var process = global_1.process;
+var versions = process && process.versions;
+var v8 = versions && versions.v8;
+var match, version;
+
+if (v8) {
+ match = v8.split('.');
+ version = match[0] + match[1];
+} else if (engineUserAgent) {
+ match = engineUserAgent.match(/Edge\/(\d+)/);
+ if (!match || match[1] >= 74) {
+ match = engineUserAgent.match(/Chrome\/(\d+)/);
+ if (match) version = match[1];
+ }
+}
+
+var engineV8Version = version && +version;
+
+var SPECIES$1 = wellKnownSymbol('species');
+
+var arrayMethodHasSpeciesSupport = function (METHOD_NAME) {
+ // We can't use this feature detection in V8 since it causes
+ // deoptimization and serious performance degradation
+ // https://github.com/zloirock/core-js/issues/677
+ return engineV8Version >= 51 || !fails(function () {
+ var array = [];
+ var constructor = array.constructor = {};
+ constructor[SPECIES$1] = function () {
+ return { foo: 1 };
+ };
+ return array[METHOD_NAME](Boolean).foo !== 1;
+ });
+};
+
+var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('slice');
+var USES_TO_LENGTH$2 = arrayMethodUsesToLength('slice', { ACCESSORS: true, 0: 0, 1: 2 });
+
+var SPECIES$2 = wellKnownSymbol('species');
+var nativeSlice = [].slice;
+var max$1 = Math.max;
+
+// `Array.prototype.slice` method
+// https://tc39.github.io/ecma262/#sec-array.prototype.slice
+// fallback for not array-like ES3 strings and DOM objects
+_export({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT || !USES_TO_LENGTH$2 }, {
+ slice: function slice(start, end) {
+ var O = toIndexedObject(this);
+ var length = toLength(O.length);
+ var k = toAbsoluteIndex(start, length);
+ var fin = toAbsoluteIndex(end === undefined ? length : end, length);
+ // inline `ArraySpeciesCreate` for usage native `Array#slice` where it's possible
+ var Constructor, result, n;
+ if (isArray(O)) {
+ Constructor = O.constructor;
+ // cross-realm fallback
+ if (typeof Constructor == 'function' && (Constructor === Array || isArray(Constructor.prototype))) {
+ Constructor = undefined;
+ } else if (isObject(Constructor)) {
+ Constructor = Constructor[SPECIES$2];
+ if (Constructor === null) Constructor = undefined;
+ }
+ if (Constructor === Array || Constructor === undefined) {
+ return nativeSlice.call(O, k, fin);
+ }
+ }
+ result = new (Constructor === undefined ? Array : Constructor)(max$1(fin - k, 0));
+ for (n = 0; k < fin; k++, n++) if (k in O) createProperty(result, n, O[k]);
+ result.length = n;
+ return result;
+ }
+});
+
+var TO_STRING_TAG$1 = wellKnownSymbol('toStringTag');
+var test = {};
+
+test[TO_STRING_TAG$1] = 'z';
+
+var toStringTagSupport = String(test) === '[object z]';
+
+var TO_STRING_TAG$2 = wellKnownSymbol('toStringTag');
+// ES3 wrong here
+var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments';
+
+// fallback for IE11 Script Access Denied error
+var tryGet = function (it, key) {
+ try {
+ return it[key];
+ } catch (error) { /* empty */ }
+};
+
+// getting tag from ES6+ `Object.prototype.toString`
+var classof = toStringTagSupport ? classofRaw : function (it) {
+ var O, tag, result;
+ return it === undefined ? 'Undefined' : it === null ? 'Null'
+ // @@toStringTag case
+ : typeof (tag = tryGet(O = Object(it), TO_STRING_TAG$2)) == 'string' ? tag
+ // builtinTag case
+ : CORRECT_ARGUMENTS ? classofRaw(O)
+ // ES3 arguments fallback
+ : (result = classofRaw(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : result;
+};
+
+// `Object.prototype.toString` method implementation
+// https://tc39.github.io/ecma262/#sec-object.prototype.tostring
+var objectToString = toStringTagSupport ? {}.toString : function toString() {
+ return '[object ' + classof(this) + ']';
+};
+
+// `Object.prototype.toString` method
+// https://tc39.github.io/ecma262/#sec-object.prototype.tostring
+if (!toStringTagSupport) {
+ redefine(Object.prototype, 'toString', objectToString, { unsafe: true });
+}
+
+// `RegExp.prototype.flags` getter implementation
+// https://tc39.github.io/ecma262/#sec-get-regexp.prototype.flags
+var regexpFlags = function () {
+ var that = anObject(this);
+ var result = '';
+ if (that.global) result += 'g';
+ if (that.ignoreCase) result += 'i';
+ if (that.multiline) result += 'm';
+ if (that.dotAll) result += 's';
+ if (that.unicode) result += 'u';
+ if (that.sticky) result += 'y';
+ return result;
+};
+
+// babel-minify transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError,
+// so we use an intermediate function.
+function RE(s, f) {
+ return RegExp(s, f);
+}
+
+var UNSUPPORTED_Y = fails(function () {
+ // babel-minify transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError
+ var re = RE('a', 'y');
+ re.lastIndex = 2;
+ return re.exec('abcd') != null;
+});
+
+var BROKEN_CARET = fails(function () {
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=773687
+ var re = RE('^r', 'gy');
+ re.lastIndex = 2;
+ return re.exec('str') != null;
+});
+
+var regexpStickyHelpers = {
+ UNSUPPORTED_Y: UNSUPPORTED_Y,
+ BROKEN_CARET: BROKEN_CARET
+};
+
+var nativeExec = RegExp.prototype.exec;
+// This always refers to the native implementation, because the
+// String#replace polyfill uses ./fix-regexp-well-known-symbol-logic.js,
+// which loads this file before patching the method.
+var nativeReplace = String.prototype.replace;
+
+var patchedExec = nativeExec;
+
+var UPDATES_LAST_INDEX_WRONG = (function () {
+ var re1 = /a/;
+ var re2 = /b*/g;
+ nativeExec.call(re1, 'a');
+ nativeExec.call(re2, 'a');
+ return re1.lastIndex !== 0 || re2.lastIndex !== 0;
+})();
+
+var UNSUPPORTED_Y$1 = regexpStickyHelpers.UNSUPPORTED_Y || regexpStickyHelpers.BROKEN_CARET;
+
+// nonparticipating capturing group, copied from es5-shim's String#split patch.
+var NPCG_INCLUDED = /()??/.exec('')[1] !== undefined;
+
+var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED || UNSUPPORTED_Y$1;
+
+if (PATCH) {
+ patchedExec = function exec(str) {
+ var re = this;
+ var lastIndex, reCopy, match, i;
+ var sticky = UNSUPPORTED_Y$1 && re.sticky;
+ var flags = regexpFlags.call(re);
+ var source = re.source;
+ var charsAdded = 0;
+ var strCopy = str;
+
+ if (sticky) {
+ flags = flags.replace('y', '');
+ if (flags.indexOf('g') === -1) {
+ flags += 'g';
+ }
+
+ strCopy = String(str).slice(re.lastIndex);
+ // Support anchored sticky behavior.
+ if (re.lastIndex > 0 && (!re.multiline || re.multiline && str[re.lastIndex - 1] !== '\n')) {
+ source = '(?: ' + source + ')';
+ strCopy = ' ' + strCopy;
+ charsAdded++;
+ }
+ // ^(? + rx + ) is needed, in combination with some str slicing, to
+ // simulate the 'y' flag.
+ reCopy = new RegExp('^(?:' + source + ')', flags);
+ }
+
+ if (NPCG_INCLUDED) {
+ reCopy = new RegExp('^' + source + '$(?!\\s)', flags);
+ }
+ if (UPDATES_LAST_INDEX_WRONG) lastIndex = re.lastIndex;
+
+ match = nativeExec.call(sticky ? reCopy : re, strCopy);
+
+ if (sticky) {
+ if (match) {
+ match.input = match.input.slice(charsAdded);
+ match[0] = match[0].slice(charsAdded);
+ match.index = re.lastIndex;
+ re.lastIndex += match[0].length;
+ } else re.lastIndex = 0;
+ } else if (UPDATES_LAST_INDEX_WRONG && match) {
+ re.lastIndex = re.global ? match.index + match[0].length : lastIndex;
+ }
+ if (NPCG_INCLUDED && match && match.length > 1) {
+ // Fix browsers whose `exec` methods don't consistently return `undefined`
+ // for NPCG, like IE8. NOTE: This doesn' work for /(.?)?/
+ nativeReplace.call(match[0], reCopy, function () {
+ for (i = 1; i < arguments.length - 2; i++) {
+ if (arguments[i] === undefined) match[i] = undefined;
+ }
+ });
+ }
+
+ return match;
+ };
+}
+
+var regexpExec = patchedExec;
+
+_export({ target: 'RegExp', proto: true, forced: /./.exec !== regexpExec }, {
+ exec: regexpExec
+});
+
+var TO_STRING = 'toString';
+var RegExpPrototype = RegExp.prototype;
+var nativeToString = RegExpPrototype[TO_STRING];
+
+var NOT_GENERIC = fails(function () { return nativeToString.call({ source: 'a', flags: 'b' }) != '/a/b'; });
+// FF44- RegExp#toString has a wrong name
+var INCORRECT_NAME = nativeToString.name != TO_STRING;
+
+// `RegExp.prototype.toString` method
+// https://tc39.github.io/ecma262/#sec-regexp.prototype.tostring
+if (NOT_GENERIC || INCORRECT_NAME) {
+ redefine(RegExp.prototype, TO_STRING, function toString() {
+ var R = anObject(this);
+ var p = String(R.source);
+ var rf = R.flags;
+ var f = String(rf === undefined && R instanceof RegExp && !('flags' in RegExpPrototype) ? regexpFlags.call(R) : rf);
+ return '/' + p + '/' + f;
+ }, { unsafe: true });
+}
+
+// `String.prototype.{ codePointAt, at }` methods implementation
+var createMethod$2 = function (CONVERT_TO_STRING) {
+ return function ($this, pos) {
+ var S = String(requireObjectCoercible($this));
+ var position = toInteger(pos);
+ var size = S.length;
+ var first, second;
+ if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;
+ first = S.charCodeAt(position);
+ return first < 0xD800 || first > 0xDBFF || position + 1 === size
+ || (second = S.charCodeAt(position + 1)) < 0xDC00 || second > 0xDFFF
+ ? CONVERT_TO_STRING ? S.charAt(position) : first
+ : CONVERT_TO_STRING ? S.slice(position, position + 2) : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;
+ };
+};
+
+var stringMultibyte = {
+ // `String.prototype.codePointAt` method
+ // https://tc39.github.io/ecma262/#sec-string.prototype.codepointat
+ codeAt: createMethod$2(false),
+ // `String.prototype.at` method
+ // https://github.com/mathiasbynens/String.prototype.at
+ charAt: createMethod$2(true)
+};
+
+var charAt = stringMultibyte.charAt;
+
+
+
+var STRING_ITERATOR = 'String Iterator';
+var setInternalState$2 = internalState.set;
+var getInternalState$2 = internalState.getterFor(STRING_ITERATOR);
+
+// `String.prototype[@@iterator]` method
+// https://tc39.github.io/ecma262/#sec-string.prototype-@@iterator
+defineIterator(String, 'String', function (iterated) {
+ setInternalState$2(this, {
+ type: STRING_ITERATOR,
+ string: String(iterated),
+ index: 0
+ });
+// `%StringIteratorPrototype%.next` method
+// https://tc39.github.io/ecma262/#sec-%stringiteratorprototype%.next
+}, function next() {
+ var state = getInternalState$2(this);
+ var string = state.string;
+ var index = state.index;
+ var point;
+ if (index >= string.length) return { value: undefined, done: true };
+ point = charAt(string, index);
+ state.index += point.length;
+ return { value: point, done: false };
+});
+
+// TODO: Remove from `core-js@4` since it's moved to entry points
+
+
+
+
+
+
+
+var SPECIES$3 = wellKnownSymbol('species');
+
+var REPLACE_SUPPORTS_NAMED_GROUPS = !fails(function () {
+ // #replace needs built-in support for named groups.
+ // #match works fine because it just return the exec results, even if it has
+ // a "grops" property.
+ var re = /./;
+ re.exec = function () {
+ var result = [];
+ result.groups = { a: '7' };
+ return result;
+ };
+ return ''.replace(re, '$<a>') !== '7';
+});
+
+// IE <= 11 replaces $0 with the whole match, as if it was $&
+// https://stackoverflow.com/questions/6024666/getting-ie-to-replace-a-regex-with-the-literal-string-0
+var REPLACE_KEEPS_$0 = (function () {
+ return 'a'.replace(/./, '$0') === '$0';
+})();
+
+var REPLACE = wellKnownSymbol('replace');
+// Safari <= 13.0.3(?) substitutes nth capture where n>m with an empty string
+var REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE = (function () {
+ if (/./[REPLACE]) {
+ return /./[REPLACE]('a', '$0') === '';
+ }
+ return false;
+})();
+
+// Chrome 51 has a buggy "split" implementation when RegExp#exec !== nativeExec
+// Weex JS has frozen built-in prototypes, so use try / catch wrapper
+var SPLIT_WORKS_WITH_OVERWRITTEN_EXEC = !fails(function () {
+ var re = /(?:)/;
+ var originalExec = re.exec;
+ re.exec = function () { return originalExec.apply(this, arguments); };
+ var result = 'ab'.split(re);
+ return result.length !== 2 || result[0] !== 'a' || result[1] !== 'b';
+});
+
+var fixRegexpWellKnownSymbolLogic = function (KEY, length, exec, sham) {
+ var SYMBOL = wellKnownSymbol(KEY);
+
+ var DELEGATES_TO_SYMBOL = !fails(function () {
+ // String methods call symbol-named RegEp methods
+ var O = {};
+ O[SYMBOL] = function () { return 7; };
+ return ''[KEY](O) != 7;
+ });
+
+ var DELEGATES_TO_EXEC = DELEGATES_TO_SYMBOL && !fails(function () {
+ // Symbol-named RegExp methods call .exec
+ var execCalled = false;
+ var re = /a/;
+
+ if (KEY === 'split') {
+ // We can't use real regex here since it causes deoptimization
+ // and serious performance degradation in V8
+ // https://github.com/zloirock/core-js/issues/306
+ re = {};
+ // RegExp[@@split] doesn't call the regex's exec method, but first creates
+ // a new one. We need to return the patched regex when creating the new one.
+ re.constructor = {};
+ re.constructor[SPECIES$3] = function () { return re; };
+ re.flags = '';
+ re[SYMBOL] = /./[SYMBOL];
+ }
+
+ re.exec = function () { execCalled = true; return null; };
+
+ re[SYMBOL]('');
+ return !execCalled;
+ });
+
+ if (
+ !DELEGATES_TO_SYMBOL ||
+ !DELEGATES_TO_EXEC ||
+ (KEY === 'replace' && !(
+ REPLACE_SUPPORTS_NAMED_GROUPS &&
+ REPLACE_KEEPS_$0 &&
+ !REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE
+ )) ||
+ (KEY === 'split' && !SPLIT_WORKS_WITH_OVERWRITTEN_EXEC)
+ ) {
+ var nativeRegExpMethod = /./[SYMBOL];
+ var methods = exec(SYMBOL, ''[KEY], function (nativeMethod, regexp, str, arg2, forceStringMethod) {
+ if (regexp.exec === regexpExec) {
+ if (DELEGATES_TO_SYMBOL && !forceStringMethod) {
+ // The native String method already delegates to @@method (this
+ // polyfilled function), leasing to infinite recursion.
+ // We avoid it by directly calling the native @@method method.
+ return { done: true, value: nativeRegExpMethod.call(regexp, str, arg2) };
+ }
+ return { done: true, value: nativeMethod.call(str, regexp, arg2) };
+ }
+ return { done: false };
+ }, {
+ REPLACE_KEEPS_$0: REPLACE_KEEPS_$0,
+ REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE: REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE
+ });
+ var stringMethod = methods[0];
+ var regexMethod = methods[1];
+
+ redefine(String.prototype, KEY, stringMethod);
+ redefine(RegExp.prototype, SYMBOL, length == 2
+ // 21.2.5.8 RegExp.prototype[@@replace](string, replaceValue)
+ // 21.2.5.11 RegExp.prototype[@@split](string, limit)
+ ? function (string, arg) { return regexMethod.call(string, this, arg); }
+ // 21.2.5.6 RegExp.prototype[@@match](string)
+ // 21.2.5.9 RegExp.prototype[@@search](string)
+ : function (string) { return regexMethod.call(string, this); }
+ );
+ }
+
+ if (sham) createNonEnumerableProperty(RegExp.prototype[SYMBOL], 'sham', true);
+};
+
+var charAt$1 = stringMultibyte.charAt;
+
+// `AdvanceStringIndex` abstract operation
+// https://tc39.github.io/ecma262/#sec-advancestringindex
+var advanceStringIndex = function (S, index, unicode) {
+ return index + (unicode ? charAt$1(S, index).length : 1);
+};
+
+// `RegExpExec` abstract operation
+// https://tc39.github.io/ecma262/#sec-regexpexec
+var regexpExecAbstract = function (R, S) {
+ var exec = R.exec;
+ if (typeof exec === 'function') {
+ var result = exec.call(R, S);
+ if (typeof result !== 'object') {
+ throw TypeError('RegExp exec method returned something other than an Object or null');
+ }
+ return result;
+ }
+
+ if (classofRaw(R) !== 'RegExp') {
+ throw TypeError('RegExp#exec called on incompatible receiver');
+ }
+
+ return regexpExec.call(R, S);
+};
+
+var max$2 = Math.max;
+var min$2 = Math.min;
+var floor$1 = Math.floor;
+var SUBSTITUTION_SYMBOLS = /\$([$&'`]|\d\d?|<[^>]*>)/g;
+var SUBSTITUTION_SYMBOLS_NO_NAMED = /\$([$&'`]|\d\d?)/g;
+
+var maybeToString = function (it) {
+ return it === undefined ? it : String(it);
+};
+
+// @@replace logic
+fixRegexpWellKnownSymbolLogic('replace', 2, function (REPLACE, nativeReplace, maybeCallNative, reason) {
+ var REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE = reason.REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE;
+ var REPLACE_KEEPS_$0 = reason.REPLACE_KEEPS_$0;
+ var UNSAFE_SUBSTITUTE = REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE ? '$' : '$0';
+
+ return [
+ // `String.prototype.replace` method
+ // https://tc39.github.io/ecma262/#sec-string.prototype.replace
+ function replace(searchValue, replaceValue) {
+ var O = requireObjectCoercible(this);
+ var replacer = searchValue == undefined ? undefined : searchValue[REPLACE];
+ return replacer !== undefined
+ ? replacer.call(searchValue, O, replaceValue)
+ : nativeReplace.call(String(O), searchValue, replaceValue);
+ },
+ // `RegExp.prototype[@@replace]` method
+ // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@replace
+ function (regexp, replaceValue) {
+ if (
+ (!REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE && REPLACE_KEEPS_$0) ||
+ (typeof replaceValue === 'string' && replaceValue.indexOf(UNSAFE_SUBSTITUTE) === -1)
+ ) {
+ var res = maybeCallNative(nativeReplace, regexp, this, replaceValue);
+ if (res.done) return res.value;
+ }
+
+ var rx = anObject(regexp);
+ var S = String(this);
+
+ var functionalReplace = typeof replaceValue === 'function';
+ if (!functionalReplace) replaceValue = String(replaceValue);
+
+ var global = rx.global;
+ if (global) {
+ var fullUnicode = rx.unicode;
+ rx.lastIndex = 0;
+ }
+ var results = [];
+ while (true) {
+ var result = regexpExecAbstract(rx, S);
+ if (result === null) break;
+
+ results.push(result);
+ if (!global) break;
+
+ var matchStr = String(result[0]);
+ if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
+ }
+
+ var accumulatedResult = '';
+ var nextSourcePosition = 0;
+ for (var i = 0; i < results.length; i++) {
+ result = results[i];
+
+ var matched = String(result[0]);
+ var position = max$2(min$2(toInteger(result.index), S.length), 0);
+ var captures = [];
+ // NOTE: This is equivalent to
+ // captures = result.slice(1).map(maybeToString)
+ // but for some reason `nativeSlice.call(result, 1, result.length)` (called in
+ // the slice polyfill when slicing native arrays) "doesn't work" in safari 9 and
+ // causes a crash (https://pastebin.com/N21QzeQA) when trying to debug it.
+ for (var j = 1; j < result.length; j++) captures.push(maybeToString(result[j]));
+ var namedCaptures = result.groups;
+ if (functionalReplace) {
+ var replacerArgs = [matched].concat(captures, position, S);
+ if (namedCaptures !== undefined) replacerArgs.push(namedCaptures);
+ var replacement = String(replaceValue.apply(undefined, replacerArgs));
+ } else {
+ replacement = getSubstitution(matched, S, position, captures, namedCaptures, replaceValue);
+ }
+ if (position >= nextSourcePosition) {
+ accumulatedResult += S.slice(nextSourcePosition, position) + replacement;
+ nextSourcePosition = position + matched.length;
+ }
+ }
+ return accumulatedResult + S.slice(nextSourcePosition);
+ }
+ ];
+
+ // https://tc39.github.io/ecma262/#sec-getsubstitution
+ function getSubstitution(matched, str, position, captures, namedCaptures, replacement) {
+ var tailPos = position + matched.length;
+ var m = captures.length;
+ var symbols = SUBSTITUTION_SYMBOLS_NO_NAMED;
+ if (namedCaptures !== undefined) {
+ namedCaptures = toObject(namedCaptures);
+ symbols = SUBSTITUTION_SYMBOLS;
+ }
+ return nativeReplace.call(replacement, symbols, function (match, ch) {
+ var capture;
+ switch (ch.charAt(0)) {
+ case '$': return '$';
+ case '&': return matched;
+ case '`': return str.slice(0, position);
+ case "'": return str.slice(tailPos);
+ case '<':
+ capture = namedCaptures[ch.slice(1, -1)];
+ break;
+ default: // \d\d?
+ var n = +ch;
+ if (n === 0) return match;
+ if (n > m) {
+ var f = floor$1(n / 10);
+ if (f === 0) return match;
+ if (f <= m) return captures[f - 1] === undefined ? ch.charAt(1) : captures[f - 1] + ch.charAt(1);
+ return match;
+ }
+ capture = captures[n - 1];
+ }
+ return capture === undefined ? '' : capture;
+ });
+ }
+});
+
+// `SameValue` abstract operation
+// https://tc39.github.io/ecma262/#sec-samevalue
+var sameValue = Object.is || function is(x, y) {
+ // eslint-disable-next-line no-self-compare
+ return x === y ? x !== 0 || 1 / x === 1 / y : x != x && y != y;
+};
+
+// @@search logic
+fixRegexpWellKnownSymbolLogic('search', 1, function (SEARCH, nativeSearch, maybeCallNative) {
+ return [
+ // `String.prototype.search` method
+ // https://tc39.github.io/ecma262/#sec-string.prototype.search
+ function search(regexp) {
+ var O = requireObjectCoercible(this);
+ var searcher = regexp == undefined ? undefined : regexp[SEARCH];
+ return searcher !== undefined ? searcher.call(regexp, O) : new RegExp(regexp)[SEARCH](String(O));
+ },
+ // `RegExp.prototype[@@search]` method
+ // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@search
+ function (regexp) {
+ var res = maybeCallNative(nativeSearch, regexp, this);
+ if (res.done) return res.value;
+
+ var rx = anObject(regexp);
+ var S = String(this);
+
+ var previousLastIndex = rx.lastIndex;
+ if (!sameValue(previousLastIndex, 0)) rx.lastIndex = 0;
+ var result = regexpExecAbstract(rx, S);
+ if (!sameValue(rx.lastIndex, previousLastIndex)) rx.lastIndex = previousLastIndex;
+ return result === null ? -1 : result.index;
+ }
+ ];
+});
+
+var MATCH = wellKnownSymbol('match');
+
+// `IsRegExp` abstract operation
+// https://tc39.github.io/ecma262/#sec-isregexp
+var isRegexp = function (it) {
+ var isRegExp;
+ return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : classofRaw(it) == 'RegExp');
+};
+
+var SPECIES$4 = wellKnownSymbol('species');
+
+// `SpeciesConstructor` abstract operation
+// https://tc39.github.io/ecma262/#sec-speciesconstructor
+var speciesConstructor = function (O, defaultConstructor) {
+ var C = anObject(O).constructor;
+ var S;
+ return C === undefined || (S = anObject(C)[SPECIES$4]) == undefined ? defaultConstructor : aFunction$1(S);
+};
+
+var arrayPush = [].push;
+var min$3 = Math.min;
+var MAX_UINT32 = 0xFFFFFFFF;
+
+// babel-minify transpiles RegExp('x', 'y') -> /x/y and it causes SyntaxError
+var SUPPORTS_Y = !fails(function () { return !RegExp(MAX_UINT32, 'y'); });
+
+// @@split logic
+fixRegexpWellKnownSymbolLogic('split', 2, function (SPLIT, nativeSplit, maybeCallNative) {
+ var internalSplit;
+ if (
+ 'abbc'.split(/(b)*/)[1] == 'c' ||
+ 'test'.split(/(?:)/, -1).length != 4 ||
+ 'ab'.split(/(?:ab)*/).length != 2 ||
+ '.'.split(/(.?)(.?)/).length != 4 ||
+ '.'.split(/()()/).length > 1 ||
+ ''.split(/.?/).length
+ ) {
+ // based on es5-shim implementation, need to rework it
+ internalSplit = function (separator, limit) {
+ var string = String(requireObjectCoercible(this));
+ var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;
+ if (lim === 0) return [];
+ if (separator === undefined) return [string];
+ // If `separator` is not a regex, use native split
+ if (!isRegexp(separator)) {
+ return nativeSplit.call(string, separator, lim);
+ }
+ var output = [];
+ var flags = (separator.ignoreCase ? 'i' : '') +
+ (separator.multiline ? 'm' : '') +
+ (separator.unicode ? 'u' : '') +
+ (separator.sticky ? 'y' : '');
+ var lastLastIndex = 0;
+ // Make `global` and avoid `lastIndex` issues by working with a copy
+ var separatorCopy = new RegExp(separator.source, flags + 'g');
+ var match, lastIndex, lastLength;
+ while (match = regexpExec.call(separatorCopy, string)) {
+ lastIndex = separatorCopy.lastIndex;
+ if (lastIndex > lastLastIndex) {
+ output.push(string.slice(lastLastIndex, match.index));
+ if (match.length > 1 && match.index < string.length) arrayPush.apply(output, match.slice(1));
+ lastLength = match[0].length;
+ lastLastIndex = lastIndex;
+ if (output.length >= lim) break;
+ }
+ if (separatorCopy.lastIndex === match.index) separatorCopy.lastIndex++; // Avoid an infinite loop
+ }
+ if (lastLastIndex === string.length) {
+ if (lastLength || !separatorCopy.test('')) output.push('');
+ } else output.push(string.slice(lastLastIndex));
+ return output.length > lim ? output.slice(0, lim) : output;
+ };
+ // Chakra, V8
+ } else if ('0'.split(undefined, 0).length) {
+ internalSplit = function (separator, limit) {
+ return separator === undefined && limit === 0 ? [] : nativeSplit.call(this, separator, limit);
+ };
+ } else internalSplit = nativeSplit;
+
+ return [
+ // `String.prototype.split` method
+ // https://tc39.github.io/ecma262/#sec-string.prototype.split
+ function split(separator, limit) {
+ var O = requireObjectCoercible(this);
+ var splitter = separator == undefined ? undefined : separator[SPLIT];
+ return splitter !== undefined
+ ? splitter.call(separator, O, limit)
+ : internalSplit.call(String(O), separator, limit);
+ },
+ // `RegExp.prototype[@@split]` method
+ // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@split
+ //
+ // NOTE: This cannot be properly polyfilled in engines that don't support
+ // the 'y' flag.
+ function (regexp, limit) {
+ var res = maybeCallNative(internalSplit, regexp, this, limit, internalSplit !== nativeSplit);
+ if (res.done) return res.value;
+
+ var rx = anObject(regexp);
+ var S = String(this);
+ var C = speciesConstructor(rx, RegExp);
+
+ var unicodeMatching = rx.unicode;
+ var flags = (rx.ignoreCase ? 'i' : '') +
+ (rx.multiline ? 'm' : '') +
+ (rx.unicode ? 'u' : '') +
+ (SUPPORTS_Y ? 'y' : 'g');
+
+ // ^(? + rx + ) is needed, in combination with some S slicing, to
+ // simulate the 'y' flag.
+ var splitter = new C(SUPPORTS_Y ? rx : '^(?:' + rx.source + ')', flags);
+ var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;
+ if (lim === 0) return [];
+ if (S.length === 0) return regexpExecAbstract(splitter, S) === null ? [S] : [];
+ var p = 0;
+ var q = 0;
+ var A = [];
+ while (q < S.length) {
+ splitter.lastIndex = SUPPORTS_Y ? q : 0;
+ var z = regexpExecAbstract(splitter, SUPPORTS_Y ? S : S.slice(q));
+ var e;
+ if (
+ z === null ||
+ (e = min$3(toLength(splitter.lastIndex + (SUPPORTS_Y ? 0 : q)), S.length)) === p
+ ) {
+ q = advanceStringIndex(S, q, unicodeMatching);
+ } else {
+ A.push(S.slice(p, q));
+ if (A.length === lim) return A;
+ for (var i = 1; i <= z.length - 1; i++) {
+ A.push(z[i]);
+ if (A.length === lim) return A;
+ }
+ q = p = e;
+ }
+ }
+ A.push(S.slice(p));
+ return A;
+ }
+ ];
+}, !SUPPORTS_Y);
+
+// iterable DOM collections
+// flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods
+var domIterables = {
+ CSSRuleList: 0,
+ CSSStyleDeclaration: 0,
+ CSSValueList: 0,
+ ClientRectList: 0,
+ DOMRectList: 0,
+ DOMStringList: 0,
+ DOMTokenList: 1,
+ DataTransferItemList: 0,
+ FileList: 0,
+ HTMLAllCollection: 0,
+ HTMLCollection: 0,
+ HTMLFormElement: 0,
+ HTMLSelectElement: 0,
+ MediaList: 0,
+ MimeTypeArray: 0,
+ NamedNodeMap: 0,
+ NodeList: 1,
+ PaintRequestList: 0,
+ Plugin: 0,
+ PluginArray: 0,
+ SVGLengthList: 0,
+ SVGNumberList: 0,
+ SVGPathSegList: 0,
+ SVGPointList: 0,
+ SVGStringList: 0,
+ SVGTransformList: 0,
+ SourceBufferList: 0,
+ StyleSheetList: 0,
+ TextTrackCueList: 0,
+ TextTrackList: 0,
+ TouchList: 0
+};
+
+for (var COLLECTION_NAME in domIterables) {
+ var Collection = global_1[COLLECTION_NAME];
+ var CollectionPrototype = Collection && Collection.prototype;
+ // some Chrome versions have non-configurable methods on DOMTokenList
+ if (CollectionPrototype && CollectionPrototype.forEach !== arrayForEach) try {
+ createNonEnumerableProperty(CollectionPrototype, 'forEach', arrayForEach);
+ } catch (error) {
+ CollectionPrototype.forEach = arrayForEach;
+ }
+}
+
+var ITERATOR$2 = wellKnownSymbol('iterator');
+var TO_STRING_TAG$3 = wellKnownSymbol('toStringTag');
+var ArrayValues = es_array_iterator.values;
+
+for (var COLLECTION_NAME$1 in domIterables) {
+ var Collection$1 = global_1[COLLECTION_NAME$1];
+ var CollectionPrototype$1 = Collection$1 && Collection$1.prototype;
+ if (CollectionPrototype$1) {
+ // some Chrome versions have non-configurable methods on DOMTokenList
+ if (CollectionPrototype$1[ITERATOR$2] !== ArrayValues) try {
+ createNonEnumerableProperty(CollectionPrototype$1, ITERATOR$2, ArrayValues);
+ } catch (error) {
+ CollectionPrototype$1[ITERATOR$2] = ArrayValues;
+ }
+ if (!CollectionPrototype$1[TO_STRING_TAG$3]) {
+ createNonEnumerableProperty(CollectionPrototype$1, TO_STRING_TAG$3, COLLECTION_NAME$1);
+ }
+ if (domIterables[COLLECTION_NAME$1]) for (var METHOD_NAME in es_array_iterator) {
+ // some Chrome versions have non-configurable methods on DOMTokenList
+ if (CollectionPrototype$1[METHOD_NAME] !== es_array_iterator[METHOD_NAME]) try {
+ createNonEnumerableProperty(CollectionPrototype$1, METHOD_NAME, es_array_iterator[METHOD_NAME]);
+ } catch (error) {
+ CollectionPrototype$1[METHOD_NAME] = es_array_iterator[METHOD_NAME];
+ }
+ }
+ }
+}
+
+var ITERATOR$3 = wellKnownSymbol('iterator');
+
+var nativeUrl = !fails(function () {
+ var url = new URL('b?a=1&b=2&c=3', 'http://a');
+ var searchParams = url.searchParams;
+ var result = '';
+ url.pathname = 'c%20d';
+ searchParams.forEach(function (value, key) {
+ searchParams['delete']('b');
+ result += key + value;
+ });
+ return (isPure && !url.toJSON)
+ || !searchParams.sort
+ || url.href !== 'http://a/c%20d?a=1&c=3'
+ || searchParams.get('c') !== '3'
+ || String(new URLSearchParams('?a=1')) !== 'a=1'
+ || !searchParams[ITERATOR$3]
+ // throws in Edge
+ || new URL('https://a@b').username !== 'a'
+ || new URLSearchParams(new URLSearchParams('a=b')).get('a') !== 'b'
+ // not punycoded in Edge
+ || new URL('http://тест').host !== 'xn--e1aybc'
+ // not escaped in Chrome 62-
+ || new URL('http://a#б').hash !== '#%D0%B1'
+ // fails in Chrome 66-
+ || result !== 'a1c3'
+ // throws in Safari
+ || new URL('http://x', undefined).host !== 'x';
+});
+
+var anInstance = function (it, Constructor, name) {
+ if (!(it instanceof Constructor)) {
+ throw TypeError('Incorrect ' + (name ? name + ' ' : '') + 'invocation');
+ } return it;
+};
+
+var nativeAssign = Object.assign;
+var defineProperty$4 = Object.defineProperty;
+
+// `Object.assign` method
+// https://tc39.github.io/ecma262/#sec-object.assign
+var objectAssign = !nativeAssign || fails(function () {
+ // should have correct order of operations (Edge bug)
+ if (descriptors && nativeAssign({ b: 1 }, nativeAssign(defineProperty$4({}, 'a', {
+ enumerable: true,
+ get: function () {
+ defineProperty$4(this, 'b', {
+ value: 3,
+ enumerable: false
+ });
+ }
+ }), { b: 2 })).b !== 1) return true;
+ // should work with symbols and should have deterministic property order (V8 bug)
+ var A = {};
+ var B = {};
+ // eslint-disable-next-line no-undef
+ var symbol = Symbol();
+ var alphabet = 'abcdefghijklmnopqrst';
+ A[symbol] = 7;
+ alphabet.split('').forEach(function (chr) { B[chr] = chr; });
+ return nativeAssign({}, A)[symbol] != 7 || objectKeys(nativeAssign({}, B)).join('') != alphabet;
+}) ? function assign(target, source) { // eslint-disable-line no-unused-vars
+ var T = toObject(target);
+ var argumentsLength = arguments.length;
+ var index = 1;
+ var getOwnPropertySymbols = objectGetOwnPropertySymbols.f;
+ var propertyIsEnumerable = objectPropertyIsEnumerable.f;
+ while (argumentsLength > index) {
+ var S = indexedObject(arguments[index++]);
+ var keys = getOwnPropertySymbols ? objectKeys(S).concat(getOwnPropertySymbols(S)) : objectKeys(S);
+ var length = keys.length;
+ var j = 0;
+ var key;
+ while (length > j) {
+ key = keys[j++];
+ if (!descriptors || propertyIsEnumerable.call(S, key)) T[key] = S[key];
+ }
+ } return T;
+} : nativeAssign;
+
+// call something on iterator step with safe closing on error
+var callWithSafeIterationClosing = function (iterator, fn, value, ENTRIES) {
+ try {
+ return ENTRIES ? fn(anObject(value)[0], value[1]) : fn(value);
+ // 7.4.6 IteratorClose(iterator, completion)
+ } catch (error) {
+ var returnMethod = iterator['return'];
+ if (returnMethod !== undefined) anObject(returnMethod.call(iterator));
+ throw error;
+ }
+};
+
+var ITERATOR$4 = wellKnownSymbol('iterator');
+var ArrayPrototype$1 = Array.prototype;
+
+// check on default Array iterator
+var isArrayIteratorMethod = function (it) {
+ return it !== undefined && (iterators.Array === it || ArrayPrototype$1[ITERATOR$4] === it);
+};
+
+var ITERATOR$5 = wellKnownSymbol('iterator');
+
+var getIteratorMethod = function (it) {
+ if (it != undefined) return it[ITERATOR$5]
+ || it['@@iterator']
+ || iterators[classof(it)];
+};
+
+// `Array.from` method implementation
+// https://tc39.github.io/ecma262/#sec-array.from
+var arrayFrom = function from(arrayLike /* , mapfn = undefined, thisArg = undefined */) {
+ var O = toObject(arrayLike);
+ var C = typeof this == 'function' ? this : Array;
+ var argumentsLength = arguments.length;
+ var mapfn = argumentsLength > 1 ? arguments[1] : undefined;
+ var mapping = mapfn !== undefined;
+ var iteratorMethod = getIteratorMethod(O);
+ var index = 0;
+ var length, result, step, iterator, next, value;
+ if (mapping) mapfn = functionBindContext(mapfn, argumentsLength > 2 ? arguments[2] : undefined, 2);
+ // if the target is not iterable or it's an array with the default iterator - use a simple case
+ if (iteratorMethod != undefined && !(C == Array && isArrayIteratorMethod(iteratorMethod))) {
+ iterator = iteratorMethod.call(O);
+ next = iterator.next;
+ result = new C();
+ for (;!(step = next.call(iterator)).done; index++) {
+ value = mapping ? callWithSafeIterationClosing(iterator, mapfn, [step.value, index], true) : step.value;
+ createProperty(result, index, value);
+ }
+ } else {
+ length = toLength(O.length);
+ result = new C(length);
+ for (;length > index; index++) {
+ value = mapping ? mapfn(O[index], index) : O[index];
+ createProperty(result, index, value);
+ }
+ }
+ result.length = index;
+ return result;
+};
+
+// based on https://github.com/bestiejs/punycode.js/blob/master/punycode.js
+var maxInt = 2147483647; // aka. 0x7FFFFFFF or 2^31-1
+var base = 36;
+var tMin = 1;
+var tMax = 26;
+var skew = 38;
+var damp = 700;
+var initialBias = 72;
+var initialN = 128; // 0x80
+var delimiter = '-'; // '\x2D'
+var regexNonASCII = /[^\0-\u007E]/; // non-ASCII chars
+var regexSeparators = /[.\u3002\uFF0E\uFF61]/g; // RFC 3490 separators
+var OVERFLOW_ERROR = 'Overflow: input needs wider integers to process';
+var baseMinusTMin = base - tMin;
+var floor$2 = Math.floor;
+var stringFromCharCode = String.fromCharCode;
+
+/**
+ * Creates an array containing the numeric code points of each Unicode
+ * character in the string. While JavaScript uses UCS-2 internally,
+ * this function will convert a pair of surrogate halves (each of which
+ * UCS-2 exposes as separate characters) into a single code point,
+ * matching UTF-16.
+ */
+var ucs2decode = function (string) {
+ var output = [];
+ var counter = 0;
+ var length = string.length;
+ while (counter < length) {
+ var value = string.charCodeAt(counter++);
+ if (value >= 0xD800 && value <= 0xDBFF && counter < length) {
+ // It's a high surrogate, and there is a next character.
+ var extra = string.charCodeAt(counter++);
+ if ((extra & 0xFC00) == 0xDC00) { // Low surrogate.
+ output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
+ } else {
+ // It's an unmatched surrogate; only append this code unit, in case the
+ // next code unit is the high surrogate of a surrogate pair.
+ output.push(value);
+ counter--;
+ }
+ } else {
+ output.push(value);
+ }
+ }
+ return output;
+};
+
+/**
+ * Converts a digit/integer into a basic code point.
+ */
+var digitToBasic = function (digit) {
+ // 0..25 map to ASCII a..z or A..Z
+ // 26..35 map to ASCII 0..9
+ return digit + 22 + 75 * (digit < 26);
+};
+
+/**
+ * Bias adaptation function as per section 3.4 of RFC 3492.
+ * https://tools.ietf.org/html/rfc3492#section-3.4
+ */
+var adapt = function (delta, numPoints, firstTime) {
+ var k = 0;
+ delta = firstTime ? floor$2(delta / damp) : delta >> 1;
+ delta += floor$2(delta / numPoints);
+ for (; delta > baseMinusTMin * tMax >> 1; k += base) {
+ delta = floor$2(delta / baseMinusTMin);
+ }
+ return floor$2(k + (baseMinusTMin + 1) * delta / (delta + skew));
+};
+
+/**
+ * Converts a string of Unicode symbols (e.g. a domain name label) to a
+ * Punycode string of ASCII-only symbols.
+ */
+// eslint-disable-next-line max-statements
+var encode = function (input) {
+ var output = [];
+
+ // Convert the input in UCS-2 to an array of Unicode code points.
+ input = ucs2decode(input);
+
+ // Cache the length.
+ var inputLength = input.length;
+
+ // Initialize the state.
+ var n = initialN;
+ var delta = 0;
+ var bias = initialBias;
+ var i, currentValue;
+
+ // Handle the basic code points.
+ for (i = 0; i < input.length; i++) {
+ currentValue = input[i];
+ if (currentValue < 0x80) {
+ output.push(stringFromCharCode(currentValue));
+ }
+ }
+
+ var basicLength = output.length; // number of basic code points.
+ var handledCPCount = basicLength; // number of code points that have been handled;
+
+ // Finish the basic string with a delimiter unless it's empty.
+ if (basicLength) {
+ output.push(delimiter);
+ }
+
+ // Main encoding loop:
+ while (handledCPCount < inputLength) {
+ // All non-basic code points < n have been handled already. Find the next larger one:
+ var m = maxInt;
+ for (i = 0; i < input.length; i++) {
+ currentValue = input[i];
+ if (currentValue >= n && currentValue < m) {
+ m = currentValue;
+ }
+ }
+
+ // Increase `delta` enough to advance the decoder's <n,i> state to <m,0>, but guard against overflow.
+ var handledCPCountPlusOne = handledCPCount + 1;
+ if (m - n > floor$2((maxInt - delta) / handledCPCountPlusOne)) {
+ throw RangeError(OVERFLOW_ERROR);
+ }
+
+ delta += (m - n) * handledCPCountPlusOne;
+ n = m;
+
+ for (i = 0; i < input.length; i++) {
+ currentValue = input[i];
+ if (currentValue < n && ++delta > maxInt) {
+ throw RangeError(OVERFLOW_ERROR);
+ }
+ if (currentValue == n) {
+ // Represent delta as a generalized variable-length integer.
+ var q = delta;
+ for (var k = base; /* no condition */; k += base) {
+ var t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
+ if (q < t) break;
+ var qMinusT = q - t;
+ var baseMinusT = base - t;
+ output.push(stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT)));
+ q = floor$2(qMinusT / baseMinusT);
+ }
+
+ output.push(stringFromCharCode(digitToBasic(q)));
+ bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);
+ delta = 0;
+ ++handledCPCount;
+ }
+ }
+
+ ++delta;
+ ++n;
+ }
+ return output.join('');
+};
+
+var stringPunycodeToAscii = function (input) {
+ var encoded = [];
+ var labels = input.toLowerCase().replace(regexSeparators, '\u002E').split('.');
+ var i, label;
+ for (i = 0; i < labels.length; i++) {
+ label = labels[i];
+ encoded.push(regexNonASCII.test(label) ? 'xn--' + encode(label) : label);
+ }
+ return encoded.join('.');
+};
+
+var redefineAll = function (target, src, options) {
+ for (var key in src) redefine(target, key, src[key], options);
+ return target;
+};
+
+var getIterator = function (it) {
+ var iteratorMethod = getIteratorMethod(it);
+ if (typeof iteratorMethod != 'function') {
+ throw TypeError(String(it) + ' is not iterable');
+ } return anObject(iteratorMethod.call(it));
+};
+
+// TODO: in core-js@4, move /modules/ dependencies to public entries for better optimization by tools like `preset-env`
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+var $fetch = getBuiltIn('fetch');
+var Headers = getBuiltIn('Headers');
+var ITERATOR$6 = wellKnownSymbol('iterator');
+var URL_SEARCH_PARAMS = 'URLSearchParams';
+var URL_SEARCH_PARAMS_ITERATOR = URL_SEARCH_PARAMS + 'Iterator';
+var setInternalState$3 = internalState.set;
+var getInternalParamsState = internalState.getterFor(URL_SEARCH_PARAMS);
+var getInternalIteratorState = internalState.getterFor(URL_SEARCH_PARAMS_ITERATOR);
+
+var plus = /\+/g;
+var sequences = Array(4);
+
+var percentSequence = function (bytes) {
+ return sequences[bytes - 1] || (sequences[bytes - 1] = RegExp('((?:%[\\da-f]{2}){' + bytes + '})', 'gi'));
+};
+
+var percentDecode = function (sequence) {
+ try {
+ return decodeURIComponent(sequence);
+ } catch (error) {
+ return sequence;
+ }
+};
+
+var deserialize = function (it) {
+ var result = it.replace(plus, ' ');
+ var bytes = 4;
+ try {
+ return decodeURIComponent(result);
+ } catch (error) {
+ while (bytes) {
+ result = result.replace(percentSequence(bytes--), percentDecode);
+ }
+ return result;
+ }
+};
+
+var find = /[!'()~]|%20/g;
+
+var replace = {
+ '!': '%21',
+ "'": '%27',
+ '(': '%28',
+ ')': '%29',
+ '~': '%7E',
+ '%20': '+'
+};
+
+var replacer = function (match) {
+ return replace[match];
+};
+
+var serialize = function (it) {
+ return encodeURIComponent(it).replace(find, replacer);
+};
+
+var parseSearchParams = function (result, query) {
+ if (query) {
+ var attributes = query.split('&');
+ var index = 0;
+ var attribute, entry;
+ while (index < attributes.length) {
+ attribute = attributes[index++];
+ if (attribute.length) {
+ entry = attribute.split('=');
+ result.push({
+ key: deserialize(entry.shift()),
+ value: deserialize(entry.join('='))
+ });
+ }
+ }
+ }
+};
+
+var updateSearchParams = function (query) {
+ this.entries.length = 0;
+ parseSearchParams(this.entries, query);
+};
+
+var validateArgumentsLength = function (passed, required) {
+ if (passed < required) throw TypeError('Not enough arguments');
+};
+
+var URLSearchParamsIterator = createIteratorConstructor(function Iterator(params, kind) {
+ setInternalState$3(this, {
+ type: URL_SEARCH_PARAMS_ITERATOR,
+ iterator: getIterator(getInternalParamsState(params).entries),
+ kind: kind
+ });
+}, 'Iterator', function next() {
+ var state = getInternalIteratorState(this);
+ var kind = state.kind;
+ var step = state.iterator.next();
+ var entry = step.value;
+ if (!step.done) {
+ step.value = kind === 'keys' ? entry.key : kind === 'values' ? entry.value : [entry.key, entry.value];
+ } return step;
+});
+
+// `URLSearchParams` constructor
+// https://url.spec.whatwg.org/#interface-urlsearchparams
+var URLSearchParamsConstructor = function URLSearchParams(/* init */) {
+ anInstance(this, URLSearchParamsConstructor, URL_SEARCH_PARAMS);
+ var init = arguments.length > 0 ? arguments[0] : undefined;
+ var that = this;
+ var entries = [];
+ var iteratorMethod, iterator, next, step, entryIterator, entryNext, first, second, key;
+
+ setInternalState$3(that, {
+ type: URL_SEARCH_PARAMS,
+ entries: entries,
+ updateURL: function () { /* empty */ },
+ updateSearchParams: updateSearchParams
+ });
+
+ if (init !== undefined) {
+ if (isObject(init)) {
+ iteratorMethod = getIteratorMethod(init);
+ if (typeof iteratorMethod === 'function') {
+ iterator = iteratorMethod.call(init);
+ next = iterator.next;
+ while (!(step = next.call(iterator)).done) {
+ entryIterator = getIterator(anObject(step.value));
+ entryNext = entryIterator.next;
+ if (
+ (first = entryNext.call(entryIterator)).done ||
+ (second = entryNext.call(entryIterator)).done ||
+ !entryNext.call(entryIterator).done
+ ) throw TypeError('Expected sequence with length 2');
+ entries.push({ key: first.value + '', value: second.value + '' });
+ }
+ } else for (key in init) if (has(init, key)) entries.push({ key: key, value: init[key] + '' });
+ } else {
+ parseSearchParams(entries, typeof init === 'string' ? init.charAt(0) === '?' ? init.slice(1) : init : init + '');
+ }
+ }
+};
+
+var URLSearchParamsPrototype = URLSearchParamsConstructor.prototype;
+
+redefineAll(URLSearchParamsPrototype, {
+ // `URLSearchParams.prototype.appent` method
+ // https://url.spec.whatwg.org/#dom-urlsearchparams-append
+ append: function append(name, value) {
+ validateArgumentsLength(arguments.length, 2);
+ var state = getInternalParamsState(this);
+ state.entries.push({ key: name + '', value: value + '' });
+ state.updateURL();
+ },
+ // `URLSearchParams.prototype.delete` method
+ // https://url.spec.whatwg.org/#dom-urlsearchparams-delete
+ 'delete': function (name) {
+ validateArgumentsLength(arguments.length, 1);
+ var state = getInternalParamsState(this);
+ var entries = state.entries;
+ var key = name + '';
+ var index = 0;
+ while (index < entries.length) {
+ if (entries[index].key === key) entries.splice(index, 1);
+ else index++;
+ }
+ state.updateURL();
+ },
+ // `URLSearchParams.prototype.get` method
+ // https://url.spec.whatwg.org/#dom-urlsearchparams-get
+ get: function get(name) {
+ validateArgumentsLength(arguments.length, 1);
+ var entries = getInternalParamsState(this).entries;
+ var key = name + '';
+ var index = 0;
+ for (; index < entries.length; index++) {
+ if (entries[index].key === key) return entries[index].value;
+ }
+ return null;
+ },
+ // `URLSearchParams.prototype.getAll` method
+ // https://url.spec.whatwg.org/#dom-urlsearchparams-getall
+ getAll: function getAll(name) {
+ validateArgumentsLength(arguments.length, 1);
+ var entries = getInternalParamsState(this).entries;
+ var key = name + '';
+ var result = [];
+ var index = 0;
+ for (; index < entries.length; index++) {
+ if (entries[index].key === key) result.push(entries[index].value);
+ }
+ return result;
+ },
+ // `URLSearchParams.prototype.has` method
+ // https://url.spec.whatwg.org/#dom-urlsearchparams-has
+ has: function has(name) {
+ validateArgumentsLength(arguments.length, 1);
+ var entries = getInternalParamsState(this).entries;
+ var key = name + '';
+ var index = 0;
+ while (index < entries.length) {
+ if (entries[index++].key === key) return true;
+ }
+ return false;
+ },
+ // `URLSearchParams.prototype.set` method
+ // https://url.spec.whatwg.org/#dom-urlsearchparams-set
+ set: function set(name, value) {
+ validateArgumentsLength(arguments.length, 1);
+ var state = getInternalParamsState(this);
+ var entries = state.entries;
+ var found = false;
+ var key = name + '';
+ var val = value + '';
+ var index = 0;
+ var entry;
+ for (; index < entries.length; index++) {
+ entry = entries[index];
+ if (entry.key === key) {
+ if (found) entries.splice(index--, 1);
+ else {
+ found = true;
+ entry.value = val;
+ }
+ }
+ }
+ if (!found) entries.push({ key: key, value: val });
+ state.updateURL();
+ },
+ // `URLSearchParams.prototype.sort` method
+ // https://url.spec.whatwg.org/#dom-urlsearchparams-sort
+ sort: function sort() {
+ var state = getInternalParamsState(this);
+ var entries = state.entries;
+ // Array#sort is not stable in some engines
+ var slice = entries.slice();
+ var entry, entriesIndex, sliceIndex;
+ entries.length = 0;
+ for (sliceIndex = 0; sliceIndex < slice.length; sliceIndex++) {
+ entry = slice[sliceIndex];
+ for (entriesIndex = 0; entriesIndex < sliceIndex; entriesIndex++) {
+ if (entries[entriesIndex].key > entry.key) {
+ entries.splice(entriesIndex, 0, entry);
+ break;
+ }
+ }
+ if (entriesIndex === sliceIndex) entries.push(entry);
+ }
+ state.updateURL();
+ },
+ // `URLSearchParams.prototype.forEach` method
+ forEach: function forEach(callback /* , thisArg */) {
+ var entries = getInternalParamsState(this).entries;
+ var boundFunction = functionBindContext(callback, arguments.length > 1 ? arguments[1] : undefined, 3);
+ var index = 0;
+ var entry;
+ while (index < entries.length) {
+ entry = entries[index++];
+ boundFunction(entry.value, entry.key, this);
+ }
+ },
+ // `URLSearchParams.prototype.keys` method
+ keys: function keys() {
+ return new URLSearchParamsIterator(this, 'keys');
+ },
+ // `URLSearchParams.prototype.values` method
+ values: function values() {
+ return new URLSearchParamsIterator(this, 'values');
+ },
+ // `URLSearchParams.prototype.entries` method
+ entries: function entries() {
+ return new URLSearchParamsIterator(this, 'entries');
+ }
+}, { enumerable: true });
+
+// `URLSearchParams.prototype[@@iterator]` method
+redefine(URLSearchParamsPrototype, ITERATOR$6, URLSearchParamsPrototype.entries);
+
+// `URLSearchParams.prototype.toString` method
+// https://url.spec.whatwg.org/#urlsearchparams-stringification-behavior
+redefine(URLSearchParamsPrototype, 'toString', function toString() {
+ var entries = getInternalParamsState(this).entries;
+ var result = [];
+ var index = 0;
+ var entry;
+ while (index < entries.length) {
+ entry = entries[index++];
+ result.push(serialize(entry.key) + '=' + serialize(entry.value));
+ } return result.join('&');
+}, { enumerable: true });
+
+setToStringTag(URLSearchParamsConstructor, URL_SEARCH_PARAMS);
+
+_export({ global: true, forced: !nativeUrl }, {
+ URLSearchParams: URLSearchParamsConstructor
+});
+
+// Wrap `fetch` for correct work with polyfilled `URLSearchParams`
+// https://github.com/zloirock/core-js/issues/674
+if (!nativeUrl && typeof $fetch == 'function' && typeof Headers == 'function') {
+ _export({ global: true, enumerable: true, forced: true }, {
+ fetch: function fetch(input /* , init */) {
+ var args = [input];
+ var init, body, headers;
+ if (arguments.length > 1) {
+ init = arguments[1];
+ if (isObject(init)) {
+ body = init.body;
+ if (classof(body) === URL_SEARCH_PARAMS) {
+ headers = init.headers ? new Headers(init.headers) : new Headers();
+ if (!headers.has('content-type')) {
+ headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8');
+ }
+ init = objectCreate(init, {
+ body: createPropertyDescriptor(0, String(body)),
+ headers: createPropertyDescriptor(0, headers)
+ });
+ }
+ }
+ args.push(init);
+ } return $fetch.apply(this, args);
+ }
+ });
+}
+
+var web_urlSearchParams = {
+ URLSearchParams: URLSearchParamsConstructor,
+ getState: getInternalParamsState
+};
+
+// TODO: in core-js@4, move /modules/ dependencies to public entries for better optimization by tools like `preset-env`
+
+
+
+
+
+
+
+
+
+
+
+var codeAt = stringMultibyte.codeAt;
+
+
+
+
+
+var NativeURL = global_1.URL;
+var URLSearchParams$1 = web_urlSearchParams.URLSearchParams;
+var getInternalSearchParamsState = web_urlSearchParams.getState;
+var setInternalState$4 = internalState.set;
+var getInternalURLState = internalState.getterFor('URL');
+var floor$3 = Math.floor;
+var pow = Math.pow;
+
+var INVALID_AUTHORITY = 'Invalid authority';
+var INVALID_SCHEME = 'Invalid scheme';
+var INVALID_HOST = 'Invalid host';
+var INVALID_PORT = 'Invalid port';
+
+var ALPHA = /[A-Za-z]/;
+var ALPHANUMERIC = /[\d+-.A-Za-z]/;
+var DIGIT = /\d/;
+var HEX_START = /^(0x|0X)/;
+var OCT = /^[0-7]+$/;
+var DEC = /^\d+$/;
+var HEX = /^[\dA-Fa-f]+$/;
+// eslint-disable-next-line no-control-regex
+var FORBIDDEN_HOST_CODE_POINT = /[\u0000\u0009\u000A\u000D #%/:?@[\\]]/;
+// eslint-disable-next-line no-control-regex
+var FORBIDDEN_HOST_CODE_POINT_EXCLUDING_PERCENT = /[\u0000\u0009\u000A\u000D #/:?@[\\]]/;
+// eslint-disable-next-line no-control-regex
+var LEADING_AND_TRAILING_C0_CONTROL_OR_SPACE = /^[\u0000-\u001F ]+|[\u0000-\u001F ]+$/g;
+// eslint-disable-next-line no-control-regex
+var TAB_AND_NEW_LINE = /[\u0009\u000A\u000D]/g;
+var EOF;
+
+var parseHost = function (url, input) {
+ var result, codePoints, index;
+ if (input.charAt(0) == '[') {
+ if (input.charAt(input.length - 1) != ']') return INVALID_HOST;
+ result = parseIPv6(input.slice(1, -1));
+ if (!result) return INVALID_HOST;
+ url.host = result;
+ // opaque host
+ } else if (!isSpecial(url)) {
+ if (FORBIDDEN_HOST_CODE_POINT_EXCLUDING_PERCENT.test(input)) return INVALID_HOST;
+ result = '';
+ codePoints = arrayFrom(input);
+ for (index = 0; index < codePoints.length; index++) {
+ result += percentEncode(codePoints[index], C0ControlPercentEncodeSet);
+ }
+ url.host = result;
+ } else {
+ input = stringPunycodeToAscii(input);
+ if (FORBIDDEN_HOST_CODE_POINT.test(input)) return INVALID_HOST;
+ result = parseIPv4(input);
+ if (result === null) return INVALID_HOST;
+ url.host = result;
+ }
+};
+
+var parseIPv4 = function (input) {
+ var parts = input.split('.');
+ var partsLength, numbers, index, part, radix, number, ipv4;
+ if (parts.length && parts[parts.length - 1] == '') {
+ parts.pop();
+ }
+ partsLength = parts.length;
+ if (partsLength > 4) return input;
+ numbers = [];
+ for (index = 0; index < partsLength; index++) {
+ part = parts[index];
+ if (part == '') return input;
+ radix = 10;
+ if (part.length > 1 && part.charAt(0) == '0') {
+ radix = HEX_START.test(part) ? 16 : 8;
+ part = part.slice(radix == 8 ? 1 : 2);
+ }
+ if (part === '') {
+ number = 0;
+ } else {
+ if (!(radix == 10 ? DEC : radix == 8 ? OCT : HEX).test(part)) return input;
+ number = parseInt(part, radix);
+ }
+ numbers.push(number);
+ }
+ for (index = 0; index < partsLength; index++) {
+ number = numbers[index];
+ if (index == partsLength - 1) {
+ if (number >= pow(256, 5 - partsLength)) return null;
+ } else if (number > 255) return null;
+ }
+ ipv4 = numbers.pop();
+ for (index = 0; index < numbers.length; index++) {
+ ipv4 += numbers[index] * pow(256, 3 - index);
+ }
+ return ipv4;
+};
+
+// eslint-disable-next-line max-statements
+var parseIPv6 = function (input) {
+ var address = [0, 0, 0, 0, 0, 0, 0, 0];
+ var pieceIndex = 0;
+ var compress = null;
+ var pointer = 0;
+ var value, length, numbersSeen, ipv4Piece, number, swaps, swap;
+
+ var char = function () {
+ return input.charAt(pointer);
+ };
+
+ if (char() == ':') {
+ if (input.charAt(1) != ':') return;
+ pointer += 2;
+ pieceIndex++;
+ compress = pieceIndex;
+ }
+ while (char()) {
+ if (pieceIndex == 8) return;
+ if (char() == ':') {
+ if (compress !== null) return;
+ pointer++;
+ pieceIndex++;
+ compress = pieceIndex;
+ continue;
+ }
+ value = length = 0;
+ while (length < 4 && HEX.test(char())) {
+ value = value * 16 + parseInt(char(), 16);
+ pointer++;
+ length++;
+ }
+ if (char() == '.') {
+ if (length == 0) return;
+ pointer -= length;
+ if (pieceIndex > 6) return;
+ numbersSeen = 0;
+ while (char()) {
+ ipv4Piece = null;
+ if (numbersSeen > 0) {
+ if (char() == '.' && numbersSeen < 4) pointer++;
+ else return;
+ }
+ if (!DIGIT.test(char())) return;
+ while (DIGIT.test(char())) {
+ number = parseInt(char(), 10);
+ if (ipv4Piece === null) ipv4Piece = number;
+ else if (ipv4Piece == 0) return;
+ else ipv4Piece = ipv4Piece * 10 + number;
+ if (ipv4Piece > 255) return;
+ pointer++;
+ }
+ address[pieceIndex] = address[pieceIndex] * 256 + ipv4Piece;
+ numbersSeen++;
+ if (numbersSeen == 2 || numbersSeen == 4) pieceIndex++;
+ }
+ if (numbersSeen != 4) return;
+ break;
+ } else if (char() == ':') {
+ pointer++;
+ if (!char()) return;
+ } else if (char()) return;
+ address[pieceIndex++] = value;
+ }
+ if (compress !== null) {
+ swaps = pieceIndex - compress;
+ pieceIndex = 7;
+ while (pieceIndex != 0 && swaps > 0) {
+ swap = address[pieceIndex];
+ address[pieceIndex--] = address[compress + swaps - 1];
+ address[compress + --swaps] = swap;
+ }
+ } else if (pieceIndex != 8) return;
+ return address;
+};
+
+var findLongestZeroSequence = function (ipv6) {
+ var maxIndex = null;
+ var maxLength = 1;
+ var currStart = null;
+ var currLength = 0;
+ var index = 0;
+ for (; index < 8; index++) {
+ if (ipv6[index] !== 0) {
+ if (currLength > maxLength) {
+ maxIndex = currStart;
+ maxLength = currLength;
+ }
+ currStart = null;
+ currLength = 0;
+ } else {
+ if (currStart === null) currStart = index;
+ ++currLength;
+ }
+ }
+ if (currLength > maxLength) {
+ maxIndex = currStart;
+ maxLength = currLength;
+ }
+ return maxIndex;
+};
+
+var serializeHost = function (host) {
+ var result, index, compress, ignore0;
+ // ipv4
+ if (typeof host == 'number') {
+ result = [];
+ for (index = 0; index < 4; index++) {
+ result.unshift(host % 256);
+ host = floor$3(host / 256);
+ } return result.join('.');
+ // ipv6
+ } else if (typeof host == 'object') {
+ result = '';
+ compress = findLongestZeroSequence(host);
+ for (index = 0; index < 8; index++) {
+ if (ignore0 && host[index] === 0) continue;
+ if (ignore0) ignore0 = false;
+ if (compress === index) {
+ result += index ? ':' : '::';
+ ignore0 = true;
+ } else {
+ result += host[index].toString(16);
+ if (index < 7) result += ':';
+ }
+ }
+ return '[' + result + ']';
+ } return host;
+};
+
+var C0ControlPercentEncodeSet = {};
+var fragmentPercentEncodeSet = objectAssign({}, C0ControlPercentEncodeSet, {
+ ' ': 1, '"': 1, '<': 1, '>': 1, '`': 1
+});
+var pathPercentEncodeSet = objectAssign({}, fragmentPercentEncodeSet, {
+ '#': 1, '?': 1, '{': 1, '}': 1
+});
+var userinfoPercentEncodeSet = objectAssign({}, pathPercentEncodeSet, {
+ '/': 1, ':': 1, ';': 1, '=': 1, '@': 1, '[': 1, '\\': 1, ']': 1, '^': 1, '|': 1
+});
+
+var percentEncode = function (char, set) {
+ var code = codeAt(char, 0);
+ return code > 0x20 && code < 0x7F && !has(set, char) ? char : encodeURIComponent(char);
+};
+
+var specialSchemes = {
+ ftp: 21,
+ file: null,
+ http: 80,
+ https: 443,
+ ws: 80,
+ wss: 443
+};
+
+var isSpecial = function (url) {
+ return has(specialSchemes, url.scheme);
+};
+
+var includesCredentials = function (url) {
+ return url.username != '' || url.password != '';
+};
+
+var cannotHaveUsernamePasswordPort = function (url) {
+ return !url.host || url.cannotBeABaseURL || url.scheme == 'file';
+};
+
+var isWindowsDriveLetter = function (string, normalized) {
+ var second;
+ return string.length == 2 && ALPHA.test(string.charAt(0))
+ && ((second = string.charAt(1)) == ':' || (!normalized && second == '|'));
+};
+
+var startsWithWindowsDriveLetter = function (string) {
+ var third;
+ return string.length > 1 && isWindowsDriveLetter(string.slice(0, 2)) && (
+ string.length == 2 ||
+ ((third = string.charAt(2)) === '/' || third === '\\' || third === '?' || third === '#')
+ );
+};
+
+var shortenURLsPath = function (url) {
+ var path = url.path;
+ var pathSize = path.length;
+ if (pathSize && (url.scheme != 'file' || pathSize != 1 || !isWindowsDriveLetter(path[0], true))) {
+ path.pop();
+ }
+};
+
+var isSingleDot = function (segment) {
+ return segment === '.' || segment.toLowerCase() === '%2e';
+};
+
+var isDoubleDot = function (segment) {
+ segment = segment.toLowerCase();
+ return segment === '..' || segment === '%2e.' || segment === '.%2e' || segment === '%2e%2e';
+};
+
+// States:
+var SCHEME_START = {};
+var SCHEME = {};
+var NO_SCHEME = {};
+var SPECIAL_RELATIVE_OR_AUTHORITY = {};
+var PATH_OR_AUTHORITY = {};
+var RELATIVE = {};
+var RELATIVE_SLASH = {};
+var SPECIAL_AUTHORITY_SLASHES = {};
+var SPECIAL_AUTHORITY_IGNORE_SLASHES = {};
+var AUTHORITY = {};
+var HOST = {};
+var HOSTNAME = {};
+var PORT = {};
+var FILE = {};
+var FILE_SLASH = {};
+var FILE_HOST = {};
+var PATH_START = {};
+var PATH = {};
+var CANNOT_BE_A_BASE_URL_PATH = {};
+var QUERY = {};
+var FRAGMENT = {};
+
+// eslint-disable-next-line max-statements
+var parseURL = function (url, input, stateOverride, base) {
+ var state = stateOverride || SCHEME_START;
+ var pointer = 0;
+ var buffer = '';
+ var seenAt = false;
+ var seenBracket = false;
+ var seenPasswordToken = false;
+ var codePoints, char, bufferCodePoints, failure;
+
+ if (!stateOverride) {
+ url.scheme = '';
+ url.username = '';
+ url.password = '';
+ url.host = null;
+ url.port = null;
+ url.path = [];
+ url.query = null;
+ url.fragment = null;
+ url.cannotBeABaseURL = false;
+ input = input.replace(LEADING_AND_TRAILING_C0_CONTROL_OR_SPACE, '');
+ }
+
+ input = input.replace(TAB_AND_NEW_LINE, '');
+
+ codePoints = arrayFrom(input);
+
+ while (pointer <= codePoints.length) {
+ char = codePoints[pointer];
+ switch (state) {
+ case SCHEME_START:
+ if (char && ALPHA.test(char)) {
+ buffer += char.toLowerCase();
+ state = SCHEME;
+ } else if (!stateOverride) {
+ state = NO_SCHEME;
+ continue;
+ } else return INVALID_SCHEME;
+ break;
+
+ case SCHEME:
+ if (char && (ALPHANUMERIC.test(char) || char == '+' || char == '-' || char == '.')) {
+ buffer += char.toLowerCase();
+ } else if (char == ':') {
+ if (stateOverride && (
+ (isSpecial(url) != has(specialSchemes, buffer)) ||
+ (buffer == 'file' && (includesCredentials(url) || url.port !== null)) ||
+ (url.scheme == 'file' && !url.host)
+ )) return;
+ url.scheme = buffer;
+ if (stateOverride) {
+ if (isSpecial(url) && specialSchemes[url.scheme] == url.port) url.port = null;
+ return;
+ }
+ buffer = '';
+ if (url.scheme == 'file') {
+ state = FILE;
+ } else if (isSpecial(url) && base && base.scheme == url.scheme) {
+ state = SPECIAL_RELATIVE_OR_AUTHORITY;
+ } else if (isSpecial(url)) {
+ state = SPECIAL_AUTHORITY_SLASHES;
+ } else if (codePoints[pointer + 1] == '/') {
+ state = PATH_OR_AUTHORITY;
+ pointer++;
+ } else {
+ url.cannotBeABaseURL = true;
+ url.path.push('');
+ state = CANNOT_BE_A_BASE_URL_PATH;
+ }
+ } else if (!stateOverride) {
+ buffer = '';
+ state = NO_SCHEME;
+ pointer = 0;
+ continue;
+ } else return INVALID_SCHEME;
+ break;
+
+ case NO_SCHEME:
+ if (!base || (base.cannotBeABaseURL && char != '#')) return INVALID_SCHEME;
+ if (base.cannotBeABaseURL && char == '#') {
+ url.scheme = base.scheme;
+ url.path = base.path.slice();
+ url.query = base.query;
+ url.fragment = '';
+ url.cannotBeABaseURL = true;
+ state = FRAGMENT;
+ break;
+ }
+ state = base.scheme == 'file' ? FILE : RELATIVE;
+ continue;
+
+ case SPECIAL_RELATIVE_OR_AUTHORITY:
+ if (char == '/' && codePoints[pointer + 1] == '/') {
+ state = SPECIAL_AUTHORITY_IGNORE_SLASHES;
+ pointer++;
+ } else {
+ state = RELATIVE;
+ continue;
+ } break;
+
+ case PATH_OR_AUTHORITY:
+ if (char == '/') {
+ state = AUTHORITY;
+ break;
+ } else {
+ state = PATH;
+ continue;
+ }
+
+ case RELATIVE:
+ url.scheme = base.scheme;
+ if (char == EOF) {
+ url.username = base.username;
+ url.password = base.password;
+ url.host = base.host;
+ url.port = base.port;
+ url.path = base.path.slice();
+ url.query = base.query;
+ } else if (char == '/' || (char == '\\' && isSpecial(url))) {
+ state = RELATIVE_SLASH;
+ } else if (char == '?') {
+ url.username = base.username;
+ url.password = base.password;
+ url.host = base.host;
+ url.port = base.port;
+ url.path = base.path.slice();
+ url.query = '';
+ state = QUERY;
+ } else if (char == '#') {
+ url.username = base.username;
+ url.password = base.password;
+ url.host = base.host;
+ url.port = base.port;
+ url.path = base.path.slice();
+ url.query = base.query;
+ url.fragment = '';
+ state = FRAGMENT;
+ } else {
+ url.username = base.username;
+ url.password = base.password;
+ url.host = base.host;
+ url.port = base.port;
+ url.path = base.path.slice();
+ url.path.pop();
+ state = PATH;
+ continue;
+ } break;
+
+ case RELATIVE_SLASH:
+ if (isSpecial(url) && (char == '/' || char == '\\')) {
+ state = SPECIAL_AUTHORITY_IGNORE_SLASHES;
+ } else if (char == '/') {
+ state = AUTHORITY;
+ } else {
+ url.username = base.username;
+ url.password = base.password;
+ url.host = base.host;
+ url.port = base.port;
+ state = PATH;
+ continue;
+ } break;
+
+ case SPECIAL_AUTHORITY_SLASHES:
+ state = SPECIAL_AUTHORITY_IGNORE_SLASHES;
+ if (char != '/' || buffer.charAt(pointer + 1) != '/') continue;
+ pointer++;
+ break;
+
+ case SPECIAL_AUTHORITY_IGNORE_SLASHES:
+ if (char != '/' && char != '\\') {
+ state = AUTHORITY;
+ continue;
+ } break;
+
+ case AUTHORITY:
+ if (char == '@') {
+ if (seenAt) buffer = '%40' + buffer;
+ seenAt = true;
+ bufferCodePoints = arrayFrom(buffer);
+ for (var i = 0; i < bufferCodePoints.length; i++) {
+ var codePoint = bufferCodePoints[i];
+ if (codePoint == ':' && !seenPasswordToken) {
+ seenPasswordToken = true;
+ continue;
+ }
+ var encodedCodePoints = percentEncode(codePoint, userinfoPercentEncodeSet);
+ if (seenPasswordToken) url.password += encodedCodePoints;
+ else url.username += encodedCodePoints;
+ }
+ buffer = '';
+ } else if (
+ char == EOF || char == '/' || char == '?' || char == '#' ||
+ (char == '\\' && isSpecial(url))
+ ) {
+ if (seenAt && buffer == '') return INVALID_AUTHORITY;
+ pointer -= arrayFrom(buffer).length + 1;
+ buffer = '';
+ state = HOST;
+ } else buffer += char;
+ break;
+
+ case HOST:
+ case HOSTNAME:
+ if (stateOverride && url.scheme == 'file') {
+ state = FILE_HOST;
+ continue;
+ } else if (char == ':' && !seenBracket) {
+ if (buffer == '') return INVALID_HOST;
+ failure = parseHost(url, buffer);
+ if (failure) return failure;
+ buffer = '';
+ state = PORT;
+ if (stateOverride == HOSTNAME) return;
+ } else if (
+ char == EOF || char == '/' || char == '?' || char == '#' ||
+ (char == '\\' && isSpecial(url))
+ ) {
+ if (isSpecial(url) && buffer == '') return INVALID_HOST;
+ if (stateOverride && buffer == '' && (includesCredentials(url) || url.port !== null)) return;
+ failure = parseHost(url, buffer);
+ if (failure) return failure;
+ buffer = '';
+ state = PATH_START;
+ if (stateOverride) return;
+ continue;
+ } else {
+ if (char == '[') seenBracket = true;
+ else if (char == ']') seenBracket = false;
+ buffer += char;
+ } break;
+
+ case PORT:
+ if (DIGIT.test(char)) {
+ buffer += char;
+ } else if (
+ char == EOF || char == '/' || char == '?' || char == '#' ||
+ (char == '\\' && isSpecial(url)) ||
+ stateOverride
+ ) {
+ if (buffer != '') {
+ var port = parseInt(buffer, 10);
+ if (port > 0xFFFF) return INVALID_PORT;
+ url.port = (isSpecial(url) && port === specialSchemes[url.scheme]) ? null : port;
+ buffer = '';
+ }
+ if (stateOverride) return;
+ state = PATH_START;
+ continue;
+ } else return INVALID_PORT;
+ break;
+
+ case FILE:
+ url.scheme = 'file';
+ if (char == '/' || char == '\\') state = FILE_SLASH;
+ else if (base && base.scheme == 'file') {
+ if (char == EOF) {
+ url.host = base.host;
+ url.path = base.path.slice();
+ url.query = base.query;
+ } else if (char == '?') {
+ url.host = base.host;
+ url.path = base.path.slice();
+ url.query = '';
+ state = QUERY;
+ } else if (char == '#') {
+ url.host = base.host;
+ url.path = base.path.slice();
+ url.query = base.query;
+ url.fragment = '';
+ state = FRAGMENT;
+ } else {
+ if (!startsWithWindowsDriveLetter(codePoints.slice(pointer).join(''))) {
+ url.host = base.host;
+ url.path = base.path.slice();
+ shortenURLsPath(url);
+ }
+ state = PATH;
+ continue;
+ }
+ } else {
+ state = PATH;
+ continue;
+ } break;
+
+ case FILE_SLASH:
+ if (char == '/' || char == '\\') {
+ state = FILE_HOST;
+ break;
+ }
+ if (base && base.scheme == 'file' && !startsWithWindowsDriveLetter(codePoints.slice(pointer).join(''))) {
+ if (isWindowsDriveLetter(base.path[0], true)) url.path.push(base.path[0]);
+ else url.host = base.host;
+ }
+ state = PATH;
+ continue;
+
+ case FILE_HOST:
+ if (char == EOF || char == '/' || char == '\\' || char == '?' || char == '#') {
+ if (!stateOverride && isWindowsDriveLetter(buffer)) {
+ state = PATH;
+ } else if (buffer == '') {
+ url.host = '';
+ if (stateOverride) return;
+ state = PATH_START;
+ } else {
+ failure = parseHost(url, buffer);
+ if (failure) return failure;
+ if (url.host == 'localhost') url.host = '';
+ if (stateOverride) return;
+ buffer = '';
+ state = PATH_START;
+ } continue;
+ } else buffer += char;
+ break;
+
+ case PATH_START:
+ if (isSpecial(url)) {
+ state = PATH;
+ if (char != '/' && char != '\\') continue;
+ } else if (!stateOverride && char == '?') {
+ url.query = '';
+ state = QUERY;
+ } else if (!stateOverride && char == '#') {
+ url.fragment = '';
+ state = FRAGMENT;
+ } else if (char != EOF) {
+ state = PATH;
+ if (char != '/') continue;
+ } break;
+
+ case PATH:
+ if (
+ char == EOF || char == '/' ||
+ (char == '\\' && isSpecial(url)) ||
+ (!stateOverride && (char == '?' || char == '#'))
+ ) {
+ if (isDoubleDot(buffer)) {
+ shortenURLsPath(url);
+ if (char != '/' && !(char == '\\' && isSpecial(url))) {
+ url.path.push('');
+ }
+ } else if (isSingleDot(buffer)) {
+ if (char != '/' && !(char == '\\' && isSpecial(url))) {
+ url.path.push('');
+ }
+ } else {
+ if (url.scheme == 'file' && !url.path.length && isWindowsDriveLetter(buffer)) {
+ if (url.host) url.host = '';
+ buffer = buffer.charAt(0) + ':'; // normalize windows drive letter
+ }
+ url.path.push(buffer);
+ }
+ buffer = '';
+ if (url.scheme == 'file' && (char == EOF || char == '?' || char == '#')) {
+ while (url.path.length > 1 && url.path[0] === '') {
+ url.path.shift();
+ }
+ }
+ if (char == '?') {
+ url.query = '';
+ state = QUERY;
+ } else if (char == '#') {
+ url.fragment = '';
+ state = FRAGMENT;
+ }
+ } else {
+ buffer += percentEncode(char, pathPercentEncodeSet);
+ } break;
+
+ case CANNOT_BE_A_BASE_URL_PATH:
+ if (char == '?') {
+ url.query = '';
+ state = QUERY;
+ } else if (char == '#') {
+ url.fragment = '';
+ state = FRAGMENT;
+ } else if (char != EOF) {
+ url.path[0] += percentEncode(char, C0ControlPercentEncodeSet);
+ } break;
+
+ case QUERY:
+ if (!stateOverride && char == '#') {
+ url.fragment = '';
+ state = FRAGMENT;
+ } else if (char != EOF) {
+ if (char == "'" && isSpecial(url)) url.query += '%27';
+ else if (char == '#') url.query += '%23';
+ else url.query += percentEncode(char, C0ControlPercentEncodeSet);
+ } break;
+
+ case FRAGMENT:
+ if (char != EOF) url.fragment += percentEncode(char, fragmentPercentEncodeSet);
+ break;
+ }
+
+ pointer++;
+ }
+};
+
+// `URL` constructor
+// https://url.spec.whatwg.org/#url-class
+var URLConstructor = function URL(url /* , base */) {
+ var that = anInstance(this, URLConstructor, 'URL');
+ var base = arguments.length > 1 ? arguments[1] : undefined;
+ var urlString = String(url);
+ var state = setInternalState$4(that, { type: 'URL' });
+ var baseState, failure;
+ if (base !== undefined) {
+ if (base instanceof URLConstructor) baseState = getInternalURLState(base);
+ else {
+ failure = parseURL(baseState = {}, String(base));
+ if (failure) throw TypeError(failure);
+ }
+ }
+ failure = parseURL(state, urlString, null, baseState);
+ if (failure) throw TypeError(failure);
+ var searchParams = state.searchParams = new URLSearchParams$1();
+ var searchParamsState = getInternalSearchParamsState(searchParams);
+ searchParamsState.updateSearchParams(state.query);
+ searchParamsState.updateURL = function () {
+ state.query = String(searchParams) || null;
+ };
+ if (!descriptors) {
+ that.href = serializeURL.call(that);
+ that.origin = getOrigin.call(that);
+ that.protocol = getProtocol.call(that);
+ that.username = getUsername.call(that);
+ that.password = getPassword.call(that);
+ that.host = getHost.call(that);
+ that.hostname = getHostname.call(that);
+ that.port = getPort.call(that);
+ that.pathname = getPathname.call(that);
+ that.search = getSearch.call(that);
+ that.searchParams = getSearchParams.call(that);
+ that.hash = getHash.call(that);
+ }
+};
+
+var URLPrototype = URLConstructor.prototype;
+
+var serializeURL = function () {
+ var url = getInternalURLState(this);
+ var scheme = url.scheme;
+ var username = url.username;
+ var password = url.password;
+ var host = url.host;
+ var port = url.port;
+ var path = url.path;
+ var query = url.query;
+ var fragment = url.fragment;
+ var output = scheme + ':';
+ if (host !== null) {
+ output += '//';
+ if (includesCredentials(url)) {
+ output += username + (password ? ':' + password : '') + '@';
+ }
+ output += serializeHost(host);
+ if (port !== null) output += ':' + port;
+ } else if (scheme == 'file') output += '//';
+ output += url.cannotBeABaseURL ? path[0] : path.length ? '/' + path.join('/') : '';
+ if (query !== null) output += '?' + query;
+ if (fragment !== null) output += '#' + fragment;
+ return output;
+};
+
+var getOrigin = function () {
+ var url = getInternalURLState(this);
+ var scheme = url.scheme;
+ var port = url.port;
+ if (scheme == 'blob') try {
+ return new URL(scheme.path[0]).origin;
+ } catch (error) {
+ return 'null';
+ }
+ if (scheme == 'file' || !isSpecial(url)) return 'null';
+ return scheme + '://' + serializeHost(url.host) + (port !== null ? ':' + port : '');
+};
+
+var getProtocol = function () {
+ return getInternalURLState(this).scheme + ':';
+};
+
+var getUsername = function () {
+ return getInternalURLState(this).username;
+};
+
+var getPassword = function () {
+ return getInternalURLState(this).password;
+};
+
+var getHost = function () {
+ var url = getInternalURLState(this);
+ var host = url.host;
+ var port = url.port;
+ return host === null ? ''
+ : port === null ? serializeHost(host)
+ : serializeHost(host) + ':' + port;
+};
+
+var getHostname = function () {
+ var host = getInternalURLState(this).host;
+ return host === null ? '' : serializeHost(host);
+};
+
+var getPort = function () {
+ var port = getInternalURLState(this).port;
+ return port === null ? '' : String(port);
+};
+
+var getPathname = function () {
+ var url = getInternalURLState(this);
+ var path = url.path;
+ return url.cannotBeABaseURL ? path[0] : path.length ? '/' + path.join('/') : '';
+};
+
+var getSearch = function () {
+ var query = getInternalURLState(this).query;
+ return query ? '?' + query : '';
+};
+
+var getSearchParams = function () {
+ return getInternalURLState(this).searchParams;
+};
+
+var getHash = function () {
+ var fragment = getInternalURLState(this).fragment;
+ return fragment ? '#' + fragment : '';
+};
+
+var accessorDescriptor = function (getter, setter) {
+ return { get: getter, set: setter, configurable: true, enumerable: true };
+};
+
+if (descriptors) {
+ objectDefineProperties(URLPrototype, {
+ // `URL.prototype.href` accessors pair
+ // https://url.spec.whatwg.org/#dom-url-href
+ href: accessorDescriptor(serializeURL, function (href) {
+ var url = getInternalURLState(this);
+ var urlString = String(href);
+ var failure = parseURL(url, urlString);
+ if (failure) throw TypeError(failure);
+ getInternalSearchParamsState(url.searchParams).updateSearchParams(url.query);
+ }),
+ // `URL.prototype.origin` getter
+ // https://url.spec.whatwg.org/#dom-url-origin
+ origin: accessorDescriptor(getOrigin),
+ // `URL.prototype.protocol` accessors pair
+ // https://url.spec.whatwg.org/#dom-url-protocol
+ protocol: accessorDescriptor(getProtocol, function (protocol) {
+ var url = getInternalURLState(this);
+ parseURL(url, String(protocol) + ':', SCHEME_START);
+ }),
+ // `URL.prototype.username` accessors pair
+ // https://url.spec.whatwg.org/#dom-url-username
+ username: accessorDescriptor(getUsername, function (username) {
+ var url = getInternalURLState(this);
+ var codePoints = arrayFrom(String(username));
+ if (cannotHaveUsernamePasswordPort(url)) return;
+ url.username = '';
+ for (var i = 0; i < codePoints.length; i++) {
+ url.username += percentEncode(codePoints[i], userinfoPercentEncodeSet);
+ }
+ }),
+ // `URL.prototype.password` accessors pair
+ // https://url.spec.whatwg.org/#dom-url-password
+ password: accessorDescriptor(getPassword, function (password) {
+ var url = getInternalURLState(this);
+ var codePoints = arrayFrom(String(password));
+ if (cannotHaveUsernamePasswordPort(url)) return;
+ url.password = '';
+ for (var i = 0; i < codePoints.length; i++) {
+ url.password += percentEncode(codePoints[i], userinfoPercentEncodeSet);
+ }
+ }),
+ // `URL.prototype.host` accessors pair
+ // https://url.spec.whatwg.org/#dom-url-host
+ host: accessorDescriptor(getHost, function (host) {
+ var url = getInternalURLState(this);
+ if (url.cannotBeABaseURL) return;
+ parseURL(url, String(host), HOST);
+ }),
+ // `URL.prototype.hostname` accessors pair
+ // https://url.spec.whatwg.org/#dom-url-hostname
+ hostname: accessorDescriptor(getHostname, function (hostname) {
+ var url = getInternalURLState(this);
+ if (url.cannotBeABaseURL) return;
+ parseURL(url, String(hostname), HOSTNAME);
+ }),
+ // `URL.prototype.port` accessors pair
+ // https://url.spec.whatwg.org/#dom-url-port
+ port: accessorDescriptor(getPort, function (port) {
+ var url = getInternalURLState(this);
+ if (cannotHaveUsernamePasswordPort(url)) return;
+ port = String(port);
+ if (port == '') url.port = null;
+ else parseURL(url, port, PORT);
+ }),
+ // `URL.prototype.pathname` accessors pair
+ // https://url.spec.whatwg.org/#dom-url-pathname
+ pathname: accessorDescriptor(getPathname, function (pathname) {
+ var url = getInternalURLState(this);
+ if (url.cannotBeABaseURL) return;
+ url.path = [];
+ parseURL(url, pathname + '', PATH_START);
+ }),
+ // `URL.prototype.search` accessors pair
+ // https://url.spec.whatwg.org/#dom-url-search
+ search: accessorDescriptor(getSearch, function (search) {
+ var url = getInternalURLState(this);
+ search = String(search);
+ if (search == '') {
+ url.query = null;
+ } else {
+ if ('?' == search.charAt(0)) search = search.slice(1);
+ url.query = '';
+ parseURL(url, search, QUERY);
+ }
+ getInternalSearchParamsState(url.searchParams).updateSearchParams(url.query);
+ }),
+ // `URL.prototype.searchParams` getter
+ // https://url.spec.whatwg.org/#dom-url-searchparams
+ searchParams: accessorDescriptor(getSearchParams),
+ // `URL.prototype.hash` accessors pair
+ // https://url.spec.whatwg.org/#dom-url-hash
+ hash: accessorDescriptor(getHash, function (hash) {
+ var url = getInternalURLState(this);
+ hash = String(hash);
+ if (hash == '') {
+ url.fragment = null;
+ return;
+ }
+ if ('#' == hash.charAt(0)) hash = hash.slice(1);
+ url.fragment = '';
+ parseURL(url, hash, FRAGMENT);
+ })
+ });
+}
+
+// `URL.prototype.toJSON` method
+// https://url.spec.whatwg.org/#dom-url-tojson
+redefine(URLPrototype, 'toJSON', function toJSON() {
+ return serializeURL.call(this);
+}, { enumerable: true });
+
+// `URL.prototype.toString` method
+// https://url.spec.whatwg.org/#URL-stringification-behavior
+redefine(URLPrototype, 'toString', function toString() {
+ return serializeURL.call(this);
+}, { enumerable: true });
+
+if (NativeURL) {
+ var nativeCreateObjectURL = NativeURL.createObjectURL;
+ var nativeRevokeObjectURL = NativeURL.revokeObjectURL;
+ // `URL.createObjectURL` method
+ // https://developer.mozilla.org/en-US/docs/Web/API/URL/createObjectURL
+ // eslint-disable-next-line no-unused-vars
+ if (nativeCreateObjectURL) redefine(URLConstructor, 'createObjectURL', function createObjectURL(blob) {
+ return nativeCreateObjectURL.apply(NativeURL, arguments);
+ });
+ // `URL.revokeObjectURL` method
+ // https://developer.mozilla.org/en-US/docs/Web/API/URL/revokeObjectURL
+ // eslint-disable-next-line no-unused-vars
+ if (nativeRevokeObjectURL) redefine(URLConstructor, 'revokeObjectURL', function revokeObjectURL(url) {
+ return nativeRevokeObjectURL.apply(NativeURL, arguments);
+ });
+}
+
+setToStringTag(URLConstructor, 'URL');
+
+_export({ global: true, forced: !nativeUrl, sham: !descriptors }, {
+ URL: URLConstructor
+});
+
+function _typeof(obj) {
+ "@babel/helpers - typeof";
+
+ if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
+ _typeof = function (obj) {
+ return typeof obj;
+ };
+ } else {
+ _typeof = function (obj) {
+ return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
+ };
+ }
+
+ return _typeof(obj);
+}
+
+function _classCallCheck(instance, Constructor) {
+ if (!(instance instanceof Constructor)) {
+ throw new TypeError("Cannot call a class as a function");
+ }
+}
+
+function _defineProperties(target, props) {
+ for (var i = 0; i < props.length; i++) {
+ var descriptor = props[i];
+ descriptor.enumerable = descriptor.enumerable || false;
+ descriptor.configurable = true;
+ if ("value" in descriptor) descriptor.writable = true;
+ Object.defineProperty(target, descriptor.key, descriptor);
+ }
+}
+
+function _createClass(Constructor, protoProps, staticProps) {
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
+ if (staticProps) _defineProperties(Constructor, staticProps);
+ return Constructor;
+}
+
+function _defineProperty(obj, key, value) {
+ if (key in obj) {
+ Object.defineProperty(obj, key, {
+ value: value,
+ enumerable: true,
+ configurable: true,
+ writable: true
+ });
+ } else {
+ obj[key] = value;
+ }
+
+ return obj;
+}
+
+function ownKeys$1(object, enumerableOnly) {
+ var keys = Object.keys(object);
+
+ if (Object.getOwnPropertySymbols) {
+ var symbols = Object.getOwnPropertySymbols(object);
+ if (enumerableOnly) symbols = symbols.filter(function (sym) {
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
+ });
+ keys.push.apply(keys, symbols);
+ }
+
+ return keys;
+}
+
+function _objectSpread2(target) {
+ for (var i = 1; i < arguments.length; i++) {
+ var source = arguments[i] != null ? arguments[i] : {};
+
+ if (i % 2) {
+ ownKeys$1(Object(source), true).forEach(function (key) {
+ _defineProperty(target, key, source[key]);
+ });
+ } else if (Object.getOwnPropertyDescriptors) {
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
+ } else {
+ ownKeys$1(Object(source)).forEach(function (key) {
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
+ });
+ }
+ }
+
+ return target;
+}
+
+function _objectWithoutPropertiesLoose(source, excluded) {
+ if (source == null) return {};
+ var target = {};
+ var sourceKeys = Object.keys(source);
+ var key, i;
+
+ for (i = 0; i < sourceKeys.length; i++) {
+ key = sourceKeys[i];
+ if (excluded.indexOf(key) >= 0) continue;
+ target[key] = source[key];
+ }
+
+ return target;
+}
+
+function _objectWithoutProperties(source, excluded) {
+ if (source == null) return {};
+
+ var target = _objectWithoutPropertiesLoose(source, excluded);
+
+ var key, i;
+
+ if (Object.getOwnPropertySymbols) {
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
+
+ for (i = 0; i < sourceSymbolKeys.length; i++) {
+ key = sourceSymbolKeys[i];
+ if (excluded.indexOf(key) >= 0) continue;
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
+ target[key] = source[key];
+ }
+ }
+
+ return target;
+}
+
+function _slicedToArray(arr, i) {
+ return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
+}
+
+function _toConsumableArray(arr) {
+ return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
+}
+
+function _arrayWithoutHoles(arr) {
+ if (Array.isArray(arr)) return _arrayLikeToArray(arr);
+}
+
+function _arrayWithHoles(arr) {
+ if (Array.isArray(arr)) return arr;
+}
+
+function _iterableToArray(iter) {
+ if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
+}
+
+function _iterableToArrayLimit(arr, i) {
+ if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
+ var _arr = [];
+ var _n = true;
+ var _d = false;
+ var _e = undefined;
+
+ try {
+ for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
+ _arr.push(_s.value);
+
+ if (i && _arr.length === i) break;
+ }
+ } catch (err) {
+ _d = true;
+ _e = err;
+ } finally {
+ try {
+ if (!_n && _i["return"] != null) _i["return"]();
+ } finally {
+ if (_d) throw _e;
+ }
+ }
+
+ return _arr;
+}
+
+function _unsupportedIterableToArray(o, minLen) {
+ if (!o) return;
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
+ var n = Object.prototype.toString.call(o).slice(8, -1);
+ if (n === "Object" && o.constructor) n = o.constructor.name;
+ if (n === "Map" || n === "Set") return Array.from(o);
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
+}
+
+function _arrayLikeToArray(arr, len) {
+ if (len == null || len > arr.length) len = arr.length;
+
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
+
+ return arr2;
+}
+
+function _nonIterableSpread() {
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
+}
+
+function _nonIterableRest() {
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
+}
+
+(function (global) {
+ /**
+ * Polyfill URLSearchParams
+ *
+ * Inspired from : https://github.com/WebReflection/url-search-params/blob/master/src/url-search-params.js
+ */
+ var checkIfIteratorIsSupported = function checkIfIteratorIsSupported() {
+ try {
+ return !!Symbol.iterator;
+ } catch (error) {
+ return false;
+ }
+ };
+
+ var iteratorSupported = checkIfIteratorIsSupported();
+
+ var createIterator = function createIterator(items) {
+ var iterator = {
+ next: function next() {
+ var value = items.shift();
+ return {
+ done: value === void 0,
+ value: value
+ };
+ }
+ };
+
+ if (iteratorSupported) {
+ iterator[Symbol.iterator] = function () {
+ return iterator;
+ };
+ }
+
+ return iterator;
+ };
+ /**
+ * Search param name and values should be encoded according to https://url.spec.whatwg.org/#urlencoded-serializing
+ * encodeURIComponent() produces the same result except encoding spaces as `%20` instead of `+`.
+ */
+
+
+ var serializeParam = function serializeParam(value) {
+ return encodeURIComponent(value).replace(/%20/g, '+');
+ };
+
+ var deserializeParam = function deserializeParam(value) {
+ return decodeURIComponent(String(value).replace(/\+/g, ' '));
+ };
+
+ var polyfillURLSearchParams = function polyfillURLSearchParams() {
+ var URLSearchParams = function URLSearchParams(searchString) {
+ Object.defineProperty(this, '_entries', {
+ writable: true,
+ value: {}
+ });
+
+ var typeofSearchString = _typeof(searchString);
+
+ if (typeofSearchString === 'undefined') ; else if (typeofSearchString === 'string') {
+ if (searchString !== '') {
+ this._fromString(searchString);
+ }
+ } else if (searchString instanceof URLSearchParams) {
+ var _this = this;
+
+ searchString.forEach(function (value, name) {
+ _this.append(name, value);
+ });
+ } else if (searchString !== null && typeofSearchString === 'object') {
+ if (Object.prototype.toString.call(searchString) === '[object Array]') {
+ for (var i = 0; i < searchString.length; i++) {
+ var entry = searchString[i];
+
+ if (Object.prototype.toString.call(entry) === '[object Array]' || entry.length !== 2) {
+ this.append(entry[0], entry[1]);
+ } else {
+ throw new TypeError('Expected [string, any] as entry at index ' + i + ' of URLSearchParams\'s input');
+ }
+ }
+ } else {
+ for (var key in searchString) {
+ if (searchString.hasOwnProperty(key)) {
+ this.append(key, searchString[key]);
+ }
+ }
+ }
+ } else {
+ throw new TypeError('Unsupported input\'s type for URLSearchParams');
+ }
+ };
+
+ var proto = URLSearchParams.prototype;
+
+ proto.append = function (name, value) {
+ if (name in this._entries) {
+ this._entries[name].push(String(value));
+ } else {
+ this._entries[name] = [String(value)];
+ }
+ };
+
+ proto.delete = function (name) {
+ delete this._entries[name];
+ };
+
+ proto.get = function (name) {
+ return name in this._entries ? this._entries[name][0] : null;
+ };
+
+ proto.getAll = function (name) {
+ return name in this._entries ? this._entries[name].slice(0) : [];
+ };
+
+ proto.has = function (name) {
+ return name in this._entries;
+ };
+
+ proto.set = function (name, value) {
+ this._entries[name] = [String(value)];
+ };
+
+ proto.forEach = function (callback, thisArg) {
+ var entries;
+
+ for (var name in this._entries) {
+ if (this._entries.hasOwnProperty(name)) {
+ entries = this._entries[name];
+
+ for (var i = 0; i < entries.length; i++) {
+ callback.call(thisArg, entries[i], name, this);
+ }
+ }
+ }
+ };
+
+ proto.keys = function () {
+ var items = [];
+ this.forEach(function (value, name) {
+ items.push(name);
+ });
+ return createIterator(items);
+ };
+
+ proto.values = function () {
+ var items = [];
+ this.forEach(function (value) {
+ items.push(value);
+ });
+ return createIterator(items);
+ };
+
+ proto.entries = function () {
+ var items = [];
+ this.forEach(function (value, name) {
+ items.push([name, value]);
+ });
+ return createIterator(items);
+ };
+
+ if (iteratorSupported) {
+ proto[Symbol.iterator] = proto.entries;
+ }
+
+ proto.toString = function () {
+ var searchArray = [];
+ this.forEach(function (value, name) {
+ searchArray.push(serializeParam(name) + '=' + serializeParam(value));
+ });
+ return searchArray.join('&');
+ };
+
+ global.URLSearchParams = URLSearchParams;
+ };
+
+ var checkIfURLSearchParamsSupported = function checkIfURLSearchParamsSupported() {
+ try {
+ var URLSearchParams = global.URLSearchParams;
+ return new URLSearchParams('?a=1').toString() === 'a=1' && typeof URLSearchParams.prototype.set === 'function';
+ } catch (e) {
+ return false;
+ }
+ };
+
+ if (!checkIfURLSearchParamsSupported()) {
+ polyfillURLSearchParams();
+ }
+
+ var proto = global.URLSearchParams.prototype;
+
+ if (typeof proto.sort !== 'function') {
+ proto.sort = function () {
+ var _this = this;
+
+ var items = [];
+ this.forEach(function (value, name) {
+ items.push([name, value]);
+
+ if (!_this._entries) {
+ _this.delete(name);
+ }
+ });
+ items.sort(function (a, b) {
+ if (a[0] < b[0]) {
+ return -1;
+ } else if (a[0] > b[0]) {
+ return +1;
+ } else {
+ return 0;
+ }
+ });
+
+ if (_this._entries) {
+ // force reset because IE keeps keys index
+ _this._entries = {};
+ }
+
+ for (var i = 0; i < items.length; i++) {
+ this.append(items[i][0], items[i][1]);
+ }
+ };
+ }
+
+ if (typeof proto._fromString !== 'function') {
+ Object.defineProperty(proto, '_fromString', {
+ enumerable: false,
+ configurable: false,
+ writable: false,
+ value: function value(searchString) {
+ if (this._entries) {
+ this._entries = {};
+ } else {
+ var keys = [];
+ this.forEach(function (value, name) {
+ keys.push(name);
+ });
+
+ for (var i = 0; i < keys.length; i++) {
+ this.delete(keys[i]);
+ }
+ }
+
+ searchString = searchString.replace(/^\?/, '');
+ var attributes = searchString.split('&');
+ var attribute;
+
+ for (var i = 0; i < attributes.length; i++) {
+ attribute = attributes[i].split('=');
+ this.append(deserializeParam(attribute[0]), attribute.length > 1 ? deserializeParam(attribute[1]) : '');
+ }
+ }
+ });
+ } // HTMLAnchorElement
+
+})(typeof commonjsGlobal !== 'undefined' ? commonjsGlobal : typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : commonjsGlobal);
+
+(function (global) {
+ /**
+ * Polyfill URL
+ *
+ * Inspired from : https://github.com/arv/DOM-URL-Polyfill/blob/master/src/url.js
+ */
+ var checkIfURLIsSupported = function checkIfURLIsSupported() {
+ try {
+ var u = new global.URL('b', 'http://a');
+ u.pathname = 'c d';
+ return u.href === 'http://a/c%20d' && u.searchParams;
+ } catch (e) {
+ return false;
+ }
+ };
+
+ var polyfillURL = function polyfillURL() {
+ var _URL = global.URL;
+
+ var URL = function URL(url, base) {
+ if (typeof url !== 'string') url = String(url); // Only create another document if the base is different from current location.
+
+ var doc = document,
+ baseElement;
+
+ if (base && (global.location === void 0 || base !== global.location.href)) {
+ doc = document.implementation.createHTMLDocument('');
+ baseElement = doc.createElement('base');
+ baseElement.href = base;
+ doc.head.appendChild(baseElement);
+
+ try {
+ if (baseElement.href.indexOf(base) !== 0) throw new Error(baseElement.href);
+ } catch (err) {
+ throw new Error('URL unable to set base ' + base + ' due to ' + err);
+ }
+ }
+
+ var anchorElement = doc.createElement('a');
+ anchorElement.href = url;
+
+ if (baseElement) {
+ doc.body.appendChild(anchorElement);
+ anchorElement.href = anchorElement.href; // force href to refresh
+ }
+
+ var inputElement = doc.createElement('input');
+ inputElement.type = 'url';
+ inputElement.value = url;
+
+ if (anchorElement.protocol === ':' || !/:/.test(anchorElement.href) || !inputElement.checkValidity() && !base) {
+ throw new TypeError('Invalid URL');
+ }
+
+ Object.defineProperty(this, '_anchorElement', {
+ value: anchorElement
+ }); // create a linked searchParams which reflect its changes on URL
+
+ var searchParams = new global.URLSearchParams(this.search);
+ var enableSearchUpdate = true;
+ var enableSearchParamsUpdate = true;
+
+ var _this = this;
+
+ ['append', 'delete', 'set'].forEach(function (methodName) {
+ var method = searchParams[methodName];
+
+ searchParams[methodName] = function () {
+ method.apply(searchParams, arguments);
+
+ if (enableSearchUpdate) {
+ enableSearchParamsUpdate = false;
+ _this.search = searchParams.toString();
+ enableSearchParamsUpdate = true;
+ }
+ };
+ });
+ Object.defineProperty(this, 'searchParams', {
+ value: searchParams,
+ enumerable: true
+ });
+ var search = void 0;
+ Object.defineProperty(this, '_updateSearchParams', {
+ enumerable: false,
+ configurable: false,
+ writable: false,
+ value: function value() {
+ if (this.search !== search) {
+ search = this.search;
+
+ if (enableSearchParamsUpdate) {
+ enableSearchUpdate = false;
+
+ this.searchParams._fromString(this.search);
+
+ enableSearchUpdate = true;
+ }
+ }
+ }
+ });
+ };
+
+ var proto = URL.prototype;
+
+ var linkURLWithAnchorAttribute = function linkURLWithAnchorAttribute(attributeName) {
+ Object.defineProperty(proto, attributeName, {
+ get: function get() {
+ return this._anchorElement[attributeName];
+ },
+ set: function set(value) {
+ this._anchorElement[attributeName] = value;
+ },
+ enumerable: true
+ });
+ };
+
+ ['hash', 'host', 'hostname', 'port', 'protocol'].forEach(function (attributeName) {
+ linkURLWithAnchorAttribute(attributeName);
+ });
+ Object.defineProperty(proto, 'search', {
+ get: function get() {
+ return this._anchorElement['search'];
+ },
+ set: function set(value) {
+ this._anchorElement['search'] = value;
+
+ this._updateSearchParams();
+ },
+ enumerable: true
+ });
+ Object.defineProperties(proto, {
+ 'toString': {
+ get: function get() {
+ var _this = this;
+
+ return function () {
+ return _this.href;
+ };
+ }
+ },
+ 'href': {
+ get: function get() {
+ return this._anchorElement.href.replace(/\?$/, '');
+ },
+ set: function set(value) {
+ this._anchorElement.href = value;
+
+ this._updateSearchParams();
+ },
+ enumerable: true
+ },
+ 'pathname': {
+ get: function get() {
+ return this._anchorElement.pathname.replace(/(^\/?)/, '/');
+ },
+ set: function set(value) {
+ this._anchorElement.pathname = value;
+ },
+ enumerable: true
+ },
+ 'origin': {
+ get: function get() {
+ // get expected port from protocol
+ var expectedPort = {
+ 'http:': 80,
+ 'https:': 443,
+ 'ftp:': 21
+ }[this._anchorElement.protocol]; // add port to origin if, expected port is different than actual port
+ // and it is not empty f.e http://foo:8080
+ // 8080 != 80 && 8080 != ''
+
+ var addPortToOrigin = this._anchorElement.port != expectedPort && this._anchorElement.port !== '';
+ return this._anchorElement.protocol + '//' + this._anchorElement.hostname + (addPortToOrigin ? ':' + this._anchorElement.port : '');
+ },
+ enumerable: true
+ },
+ 'password': {
+ // TODO
+ get: function get() {
+ return '';
+ },
+ set: function set(value) {},
+ enumerable: true
+ },
+ 'username': {
+ // TODO
+ get: function get() {
+ return '';
+ },
+ set: function set(value) {},
+ enumerable: true
+ }
+ });
+
+ URL.createObjectURL = function (blob) {
+ return _URL.createObjectURL.apply(_URL, arguments);
+ };
+
+ URL.revokeObjectURL = function (url) {
+ return _URL.revokeObjectURL.apply(_URL, arguments);
+ };
+
+ global.URL = URL;
+ };
+
+ if (!checkIfURLIsSupported()) {
+ polyfillURL();
+ }
+
+ if (global.location !== void 0 && !('origin' in global.location)) {
+ var getOrigin = function getOrigin() {
+ return global.location.protocol + '//' + global.location.hostname + (global.location.port ? ':' + global.location.port : '');
+ };
+
+ try {
+ Object.defineProperty(global.location, 'origin', {
+ get: getOrigin,
+ enumerable: true
+ });
+ } catch (e) {
+ setInterval(function () {
+ global.location.origin = getOrigin();
+ }, 100);
+ }
+ }
+})(typeof commonjsGlobal !== 'undefined' ? commonjsGlobal : typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : commonjsGlobal);
+
+var IS_CONCAT_SPREADABLE = wellKnownSymbol('isConcatSpreadable');
+var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF;
+var MAXIMUM_ALLOWED_INDEX_EXCEEDED = 'Maximum allowed index exceeded';
+
+// We can't use this feature detection in V8 since it causes
+// deoptimization and serious performance degradation
+// https://github.com/zloirock/core-js/issues/679
+var IS_CONCAT_SPREADABLE_SUPPORT = engineV8Version >= 51 || !fails(function () {
+ var array = [];
+ array[IS_CONCAT_SPREADABLE] = false;
+ return array.concat()[0] !== array;
+});
+
+var SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('concat');
+
+var isConcatSpreadable = function (O) {
+ if (!isObject(O)) return false;
+ var spreadable = O[IS_CONCAT_SPREADABLE];
+ return spreadable !== undefined ? !!spreadable : isArray(O);
+};
+
+var FORCED = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT;
+
+// `Array.prototype.concat` method
+// https://tc39.github.io/ecma262/#sec-array.prototype.concat
+// with adding support of @@isConcatSpreadable and @@species
+_export({ target: 'Array', proto: true, forced: FORCED }, {
+ concat: function concat(arg) { // eslint-disable-line no-unused-vars
+ var O = toObject(this);
+ var A = arraySpeciesCreate(O, 0);
+ var n = 0;
+ var i, k, length, len, E;
+ for (i = -1, length = arguments.length; i < length; i++) {
+ E = i === -1 ? O : arguments[i];
+ if (isConcatSpreadable(E)) {
+ len = toLength(E.length);
+ if (n + len > MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
+ for (k = 0; k < len; k++, n++) if (k in E) createProperty(A, n, E[k]);
+ } else {
+ if (n >= MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
+ createProperty(A, n++, E);
+ }
+ }
+ A.length = n;
+ return A;
+ }
+});
+
+var $filter = arrayIteration.filter;
+
+
+
+var HAS_SPECIES_SUPPORT$1 = arrayMethodHasSpeciesSupport('filter');
+// Edge 14- issue
+var USES_TO_LENGTH$3 = arrayMethodUsesToLength('filter');
+
+// `Array.prototype.filter` method
+// https://tc39.github.io/ecma262/#sec-array.prototype.filter
+// with adding support of @@species
+_export({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT$1 || !USES_TO_LENGTH$3 }, {
+ filter: function filter(callbackfn /* , thisArg */) {
+ return $filter(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
+ }
+});
+
+var $find = arrayIteration.find;
+
+
+
+var FIND = 'find';
+var SKIPS_HOLES = true;
+
+var USES_TO_LENGTH$4 = arrayMethodUsesToLength(FIND);
+
+// Shouldn't skip holes
+if (FIND in []) Array(1)[FIND](function () { SKIPS_HOLES = false; });
+
+// `Array.prototype.find` method
+// https://tc39.github.io/ecma262/#sec-array.prototype.find
+_export({ target: 'Array', proto: true, forced: SKIPS_HOLES || !USES_TO_LENGTH$4 }, {
+ find: function find(callbackfn /* , that = undefined */) {
+ return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
+ }
+});
+
+// https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables
+addToUnscopables(FIND);
+
+var ITERATOR$7 = wellKnownSymbol('iterator');
+var SAFE_CLOSING = false;
+
+try {
+ var called = 0;
+ var iteratorWithReturn = {
+ next: function () {
+ return { done: !!called++ };
+ },
+ 'return': function () {
+ SAFE_CLOSING = true;
+ }
+ };
+ iteratorWithReturn[ITERATOR$7] = function () {
+ return this;
+ };
+ // eslint-disable-next-line no-throw-literal
+ Array.from(iteratorWithReturn, function () { throw 2; });
+} catch (error) { /* empty */ }
+
+var checkCorrectnessOfIteration = function (exec, SKIP_CLOSING) {
+ if (!SKIP_CLOSING && !SAFE_CLOSING) return false;
+ var ITERATION_SUPPORT = false;
+ try {
+ var object = {};
+ object[ITERATOR$7] = function () {
+ return {
+ next: function () {
+ return { done: ITERATION_SUPPORT = true };
+ }
+ };
+ };
+ exec(object);
+ } catch (error) { /* empty */ }
+ return ITERATION_SUPPORT;
+};
+
+var INCORRECT_ITERATION = !checkCorrectnessOfIteration(function (iterable) {
+ Array.from(iterable);
+});
+
+// `Array.from` method
+// https://tc39.github.io/ecma262/#sec-array.from
+_export({ target: 'Array', stat: true, forced: INCORRECT_ITERATION }, {
+ from: arrayFrom
+});
+
+var $includes = arrayIncludes.includes;
+
+
+
+var USES_TO_LENGTH$5 = arrayMethodUsesToLength('indexOf', { ACCESSORS: true, 1: 0 });
+
+// `Array.prototype.includes` method
+// https://tc39.github.io/ecma262/#sec-array.prototype.includes
+_export({ target: 'Array', proto: true, forced: !USES_TO_LENGTH$5 }, {
+ includes: function includes(el /* , fromIndex = 0 */) {
+ return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
+ }
+});
+
+// https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables
+addToUnscopables('includes');
+
+var $map = arrayIteration.map;
+
+
+
+var HAS_SPECIES_SUPPORT$2 = arrayMethodHasSpeciesSupport('map');
+// FF49- issue
+var USES_TO_LENGTH$6 = arrayMethodUsesToLength('map');
+
+// `Array.prototype.map` method
+// https://tc39.github.io/ecma262/#sec-array.prototype.map
+// with adding support of @@species
+_export({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT$2 || !USES_TO_LENGTH$6 }, {
+ map: function map(callbackfn /* , thisArg */) {
+ return $map(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
+ }
+});
+
+// makes subclassing work correct for wrapped built-ins
+var inheritIfRequired = function ($this, dummy, Wrapper) {
+ var NewTarget, NewTargetPrototype;
+ if (
+ // it can work only with native `setPrototypeOf`
+ objectSetPrototypeOf &&
+ // we haven't completely correct pre-ES6 way for getting `new.target`, so use this
+ typeof (NewTarget = dummy.constructor) == 'function' &&
+ NewTarget !== Wrapper &&
+ isObject(NewTargetPrototype = NewTarget.prototype) &&
+ NewTargetPrototype !== Wrapper.prototype
+ ) objectSetPrototypeOf($this, NewTargetPrototype);
+ return $this;
+};
+
+// a string of all valid unicode whitespaces
+// eslint-disable-next-line max-len
+var whitespaces = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF';
+
+var whitespace = '[' + whitespaces + ']';
+var ltrim = RegExp('^' + whitespace + whitespace + '*');
+var rtrim = RegExp(whitespace + whitespace + '*$');
+
+// `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation
+var createMethod$3 = function (TYPE) {
+ return function ($this) {
+ var string = String(requireObjectCoercible($this));
+ if (TYPE & 1) string = string.replace(ltrim, '');
+ if (TYPE & 2) string = string.replace(rtrim, '');
+ return string;
+ };
+};
+
+var stringTrim = {
+ // `String.prototype.{ trimLeft, trimStart }` methods
+ // https://tc39.github.io/ecma262/#sec-string.prototype.trimstart
+ start: createMethod$3(1),
+ // `String.prototype.{ trimRight, trimEnd }` methods
+ // https://tc39.github.io/ecma262/#sec-string.prototype.trimend
+ end: createMethod$3(2),
+ // `String.prototype.trim` method
+ // https://tc39.github.io/ecma262/#sec-string.prototype.trim
+ trim: createMethod$3(3)
+};
+
+var getOwnPropertyNames = objectGetOwnPropertyNames.f;
+var getOwnPropertyDescriptor$2 = objectGetOwnPropertyDescriptor.f;
+var defineProperty$5 = objectDefineProperty.f;
+var trim = stringTrim.trim;
+
+var NUMBER = 'Number';
+var NativeNumber = global_1[NUMBER];
+var NumberPrototype = NativeNumber.prototype;
+
+// Opera ~12 has broken Object#toString
+var BROKEN_CLASSOF = classofRaw(objectCreate(NumberPrototype)) == NUMBER;
+
+// `ToNumber` abstract operation
+// https://tc39.github.io/ecma262/#sec-tonumber
+var toNumber = function (argument) {
+ var it = toPrimitive(argument, false);
+ var first, third, radix, maxCode, digits, length, index, code;
+ if (typeof it == 'string' && it.length > 2) {
+ it = trim(it);
+ first = it.charCodeAt(0);
+ if (first === 43 || first === 45) {
+ third = it.charCodeAt(2);
+ if (third === 88 || third === 120) return NaN; // Number('+0x1') should be NaN, old V8 fix
+ } else if (first === 48) {
+ switch (it.charCodeAt(1)) {
+ case 66: case 98: radix = 2; maxCode = 49; break; // fast equal of /^0b[01]+$/i
+ case 79: case 111: radix = 8; maxCode = 55; break; // fast equal of /^0o[0-7]+$/i
+ default: return +it;
+ }
+ digits = it.slice(2);
+ length = digits.length;
+ for (index = 0; index < length; index++) {
+ code = digits.charCodeAt(index);
+ // parseInt parses a string to a first unavailable symbol
+ // but ToNumber should return NaN if a string contains unavailable symbols
+ if (code < 48 || code > maxCode) return NaN;
+ } return parseInt(digits, radix);
+ }
+ } return +it;
+};
+
+// `Number` constructor
+// https://tc39.github.io/ecma262/#sec-number-constructor
+if (isForced_1(NUMBER, !NativeNumber(' 0o1') || !NativeNumber('0b1') || NativeNumber('+0x1'))) {
+ var NumberWrapper = function Number(value) {
+ var it = arguments.length < 1 ? 0 : value;
+ var dummy = this;
+ return dummy instanceof NumberWrapper
+ // check on 1..constructor(foo) case
+ && (BROKEN_CLASSOF ? fails(function () { NumberPrototype.valueOf.call(dummy); }) : classofRaw(dummy) != NUMBER)
+ ? inheritIfRequired(new NativeNumber(toNumber(it)), dummy, NumberWrapper) : toNumber(it);
+ };
+ for (var keys$1 = descriptors ? getOwnPropertyNames(NativeNumber) : (
+ // ES3:
+ 'MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,' +
+ // ES2015 (in case, if modules with ES2015 Number statics required before):
+ 'EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,' +
+ 'MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger'
+ ).split(','), j = 0, key; keys$1.length > j; j++) {
+ if (has(NativeNumber, key = keys$1[j]) && !has(NumberWrapper, key)) {
+ defineProperty$5(NumberWrapper, key, getOwnPropertyDescriptor$2(NativeNumber, key));
+ }
+ }
+ NumberWrapper.prototype = NumberPrototype;
+ NumberPrototype.constructor = NumberWrapper;
+ redefine(global_1, NUMBER, NumberWrapper);
+}
+
+var FAILS_ON_PRIMITIVES = fails(function () { objectKeys(1); });
+
+// `Object.keys` method
+// https://tc39.github.io/ecma262/#sec-object.keys
+_export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, {
+ keys: function keys(it) {
+ return objectKeys(toObject(it));
+ }
+});
+
+var notARegexp = function (it) {
+ if (isRegexp(it)) {
+ throw TypeError("The method doesn't accept regular expressions");
+ } return it;
+};
+
+var MATCH$1 = wellKnownSymbol('match');
+
+var correctIsRegexpLogic = function (METHOD_NAME) {
+ var regexp = /./;
+ try {
+ '/./'[METHOD_NAME](regexp);
+ } catch (e) {
+ try {
+ regexp[MATCH$1] = false;
+ return '/./'[METHOD_NAME](regexp);
+ } catch (f) { /* empty */ }
+ } return false;
+};
+
+// `String.prototype.includes` method
+// https://tc39.github.io/ecma262/#sec-string.prototype.includes
+_export({ target: 'String', proto: true, forced: !correctIsRegexpLogic('includes') }, {
+ includes: function includes(searchString /* , position = 0 */) {
+ return !!~String(requireObjectCoercible(this))
+ .indexOf(notARegexp(searchString), arguments.length > 1 ? arguments[1] : undefined);
+ }
+});
+
+var freezing = !fails(function () {
+ return Object.isExtensible(Object.preventExtensions({}));
+});
+
+var internalMetadata = createCommonjsModule(function (module) {
+var defineProperty = objectDefineProperty.f;
+
+
+
+var METADATA = uid('meta');
+var id = 0;
+
+var isExtensible = Object.isExtensible || function () {
+ return true;
+};
+
+var setMetadata = function (it) {
+ defineProperty(it, METADATA, { value: {
+ objectID: 'O' + ++id, // object ID
+ weakData: {} // weak collections IDs
+ } });
+};
+
+var fastKey = function (it, create) {
+ // return a primitive with prefix
+ if (!isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;
+ if (!has(it, METADATA)) {
+ // can't set metadata to uncaught frozen object
+ if (!isExtensible(it)) return 'F';
+ // not necessary to add metadata
+ if (!create) return 'E';
+ // add missing metadata
+ setMetadata(it);
+ // return object ID
+ } return it[METADATA].objectID;
+};
+
+var getWeakData = function (it, create) {
+ if (!has(it, METADATA)) {
+ // can't set metadata to uncaught frozen object
+ if (!isExtensible(it)) return true;
+ // not necessary to add metadata
+ if (!create) return false;
+ // add missing metadata
+ setMetadata(it);
+ // return the store of weak collections IDs
+ } return it[METADATA].weakData;
+};
+
+// add metadata on freeze-family methods calling
+var onFreeze = function (it) {
+ if (freezing && meta.REQUIRED && isExtensible(it) && !has(it, METADATA)) setMetadata(it);
+ return it;
+};
+
+var meta = module.exports = {
+ REQUIRED: false,
+ fastKey: fastKey,
+ getWeakData: getWeakData,
+ onFreeze: onFreeze
+};
+
+hiddenKeys[METADATA] = true;
+});
+var internalMetadata_1 = internalMetadata.REQUIRED;
+var internalMetadata_2 = internalMetadata.fastKey;
+var internalMetadata_3 = internalMetadata.getWeakData;
+var internalMetadata_4 = internalMetadata.onFreeze;
+
+var iterate_1 = createCommonjsModule(function (module) {
+var Result = function (stopped, result) {
+ this.stopped = stopped;
+ this.result = result;
+};
+
+var iterate = module.exports = function (iterable, fn, that, AS_ENTRIES, IS_ITERATOR) {
+ var boundFunction = functionBindContext(fn, that, AS_ENTRIES ? 2 : 1);
+ var iterator, iterFn, index, length, result, next, step;
+
+ if (IS_ITERATOR) {
+ iterator = iterable;
+ } else {
+ iterFn = getIteratorMethod(iterable);
+ if (typeof iterFn != 'function') throw TypeError('Target is not iterable');
+ // optimisation for array iterators
+ if (isArrayIteratorMethod(iterFn)) {
+ for (index = 0, length = toLength(iterable.length); length > index; index++) {
+ result = AS_ENTRIES
+ ? boundFunction(anObject(step = iterable[index])[0], step[1])
+ : boundFunction(iterable[index]);
+ if (result && result instanceof Result) return result;
+ } return new Result(false);
+ }
+ iterator = iterFn.call(iterable);
+ }
+
+ next = iterator.next;
+ while (!(step = next.call(iterator)).done) {
+ result = callWithSafeIterationClosing(iterator, boundFunction, step.value, AS_ENTRIES);
+ if (typeof result == 'object' && result && result instanceof Result) return result;
+ } return new Result(false);
+};
+
+iterate.stop = function (result) {
+ return new Result(true, result);
+};
+});
+
+var collection = function (CONSTRUCTOR_NAME, wrapper, common) {
+ var IS_MAP = CONSTRUCTOR_NAME.indexOf('Map') !== -1;
+ var IS_WEAK = CONSTRUCTOR_NAME.indexOf('Weak') !== -1;
+ var ADDER = IS_MAP ? 'set' : 'add';
+ var NativeConstructor = global_1[CONSTRUCTOR_NAME];
+ var NativePrototype = NativeConstructor && NativeConstructor.prototype;
+ var Constructor = NativeConstructor;
+ var exported = {};
+
+ var fixMethod = function (KEY) {
+ var nativeMethod = NativePrototype[KEY];
+ redefine(NativePrototype, KEY,
+ KEY == 'add' ? function add(value) {
+ nativeMethod.call(this, value === 0 ? 0 : value);
+ return this;
+ } : KEY == 'delete' ? function (key) {
+ return IS_WEAK && !isObject(key) ? false : nativeMethod.call(this, key === 0 ? 0 : key);
+ } : KEY == 'get' ? function get(key) {
+ return IS_WEAK && !isObject(key) ? undefined : nativeMethod.call(this, key === 0 ? 0 : key);
+ } : KEY == 'has' ? function has(key) {
+ return IS_WEAK && !isObject(key) ? false : nativeMethod.call(this, key === 0 ? 0 : key);
+ } : function set(key, value) {
+ nativeMethod.call(this, key === 0 ? 0 : key, value);
+ return this;
+ }
+ );
+ };
+
+ // eslint-disable-next-line max-len
+ if (isForced_1(CONSTRUCTOR_NAME, typeof NativeConstructor != 'function' || !(IS_WEAK || NativePrototype.forEach && !fails(function () {
+ new NativeConstructor().entries().next();
+ })))) {
+ // create collection constructor
+ Constructor = common.getConstructor(wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER);
+ internalMetadata.REQUIRED = true;
+ } else if (isForced_1(CONSTRUCTOR_NAME, true)) {
+ var instance = new Constructor();
+ // early implementations not supports chaining
+ var HASNT_CHAINING = instance[ADDER](IS_WEAK ? {} : -0, 1) != instance;
+ // V8 ~ Chromium 40- weak-collections throws on primitives, but should return false
+ var THROWS_ON_PRIMITIVES = fails(function () { instance.has(1); });
+ // most early implementations doesn't supports iterables, most modern - not close it correctly
+ // eslint-disable-next-line no-new
+ var ACCEPT_ITERABLES = checkCorrectnessOfIteration(function (iterable) { new NativeConstructor(iterable); });
+ // for early implementations -0 and +0 not the same
+ var BUGGY_ZERO = !IS_WEAK && fails(function () {
+ // V8 ~ Chromium 42- fails only with 5+ elements
+ var $instance = new NativeConstructor();
+ var index = 5;
+ while (index--) $instance[ADDER](index, index);
+ return !$instance.has(-0);
+ });
+
+ if (!ACCEPT_ITERABLES) {
+ Constructor = wrapper(function (dummy, iterable) {
+ anInstance(dummy, Constructor, CONSTRUCTOR_NAME);
+ var that = inheritIfRequired(new NativeConstructor(), dummy, Constructor);
+ if (iterable != undefined) iterate_1(iterable, that[ADDER], that, IS_MAP);
+ return that;
+ });
+ Constructor.prototype = NativePrototype;
+ NativePrototype.constructor = Constructor;
+ }
+
+ if (THROWS_ON_PRIMITIVES || BUGGY_ZERO) {
+ fixMethod('delete');
+ fixMethod('has');
+ IS_MAP && fixMethod('get');
+ }
+
+ if (BUGGY_ZERO || HASNT_CHAINING) fixMethod(ADDER);
+
+ // weak collections should not contains .clear method
+ if (IS_WEAK && NativePrototype.clear) delete NativePrototype.clear;
+ }
+
+ exported[CONSTRUCTOR_NAME] = Constructor;
+ _export({ global: true, forced: Constructor != NativeConstructor }, exported);
+
+ setToStringTag(Constructor, CONSTRUCTOR_NAME);
+
+ if (!IS_WEAK) common.setStrong(Constructor, CONSTRUCTOR_NAME, IS_MAP);
+
+ return Constructor;
+};
+
+var getWeakData = internalMetadata.getWeakData;
+
+
+
+
+
+
+
+
+var setInternalState$5 = internalState.set;
+var internalStateGetterFor = internalState.getterFor;
+var find$1 = arrayIteration.find;
+var findIndex = arrayIteration.findIndex;
+var id$1 = 0;
+
+// fallback for uncaught frozen keys
+var uncaughtFrozenStore = function (store) {
+ return store.frozen || (store.frozen = new UncaughtFrozenStore());
+};
+
+var UncaughtFrozenStore = function () {
+ this.entries = [];
+};
+
+var findUncaughtFrozen = function (store, key) {
+ return find$1(store.entries, function (it) {
+ return it[0] === key;
+ });
+};
+
+UncaughtFrozenStore.prototype = {
+ get: function (key) {
+ var entry = findUncaughtFrozen(this, key);
+ if (entry) return entry[1];
+ },
+ has: function (key) {
+ return !!findUncaughtFrozen(this, key);
+ },
+ set: function (key, value) {
+ var entry = findUncaughtFrozen(this, key);
+ if (entry) entry[1] = value;
+ else this.entries.push([key, value]);
+ },
+ 'delete': function (key) {
+ var index = findIndex(this.entries, function (it) {
+ return it[0] === key;
+ });
+ if (~index) this.entries.splice(index, 1);
+ return !!~index;
+ }
+};
+
+var collectionWeak = {
+ getConstructor: function (wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER) {
+ var C = wrapper(function (that, iterable) {
+ anInstance(that, C, CONSTRUCTOR_NAME);
+ setInternalState$5(that, {
+ type: CONSTRUCTOR_NAME,
+ id: id$1++,
+ frozen: undefined
+ });
+ if (iterable != undefined) iterate_1(iterable, that[ADDER], that, IS_MAP);
+ });
+
+ var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME);
+
+ var define = function (that, key, value) {
+ var state = getInternalState(that);
+ var data = getWeakData(anObject(key), true);
+ if (data === true) uncaughtFrozenStore(state).set(key, value);
+ else data[state.id] = value;
+ return that;
+ };
+
+ redefineAll(C.prototype, {
+ // 23.3.3.2 WeakMap.prototype.delete(key)
+ // 23.4.3.3 WeakSet.prototype.delete(value)
+ 'delete': function (key) {
+ var state = getInternalState(this);
+ if (!isObject(key)) return false;
+ var data = getWeakData(key);
+ if (data === true) return uncaughtFrozenStore(state)['delete'](key);
+ return data && has(data, state.id) && delete data[state.id];
+ },
+ // 23.3.3.4 WeakMap.prototype.has(key)
+ // 23.4.3.4 WeakSet.prototype.has(value)
+ has: function has$1(key) {
+ var state = getInternalState(this);
+ if (!isObject(key)) return false;
+ var data = getWeakData(key);
+ if (data === true) return uncaughtFrozenStore(state).has(key);
+ return data && has(data, state.id);
+ }
+ });
+
+ redefineAll(C.prototype, IS_MAP ? {
+ // 23.3.3.3 WeakMap.prototype.get(key)
+ get: function get(key) {
+ var state = getInternalState(this);
+ if (isObject(key)) {
+ var data = getWeakData(key);
+ if (data === true) return uncaughtFrozenStore(state).get(key);
+ return data ? data[state.id] : undefined;
+ }
+ },
+ // 23.3.3.5 WeakMap.prototype.set(key, value)
+ set: function set(key, value) {
+ return define(this, key, value);
+ }
+ } : {
+ // 23.4.3.1 WeakSet.prototype.add(value)
+ add: function add(value) {
+ return define(this, value, true);
+ }
+ });
+
+ return C;
+ }
+};
+
+var es_weakMap = createCommonjsModule(function (module) {
+
+
+
+
+
+
+var enforceIternalState = internalState.enforce;
+
+
+var IS_IE11 = !global_1.ActiveXObject && 'ActiveXObject' in global_1;
+var isExtensible = Object.isExtensible;
+var InternalWeakMap;
+
+var wrapper = function (init) {
+ return function WeakMap() {
+ return init(this, arguments.length ? arguments[0] : undefined);
+ };
+};
+
+// `WeakMap` constructor
+// https://tc39.github.io/ecma262/#sec-weakmap-constructor
+var $WeakMap = module.exports = collection('WeakMap', wrapper, collectionWeak);
+
+// IE11 WeakMap frozen keys fix
+// We can't use feature detection because it crash some old IE builds
+// https://github.com/zloirock/core-js/issues/485
+if (nativeWeakMap && IS_IE11) {
+ InternalWeakMap = collectionWeak.getConstructor(wrapper, 'WeakMap', true);
+ internalMetadata.REQUIRED = true;
+ var WeakMapPrototype = $WeakMap.prototype;
+ var nativeDelete = WeakMapPrototype['delete'];
+ var nativeHas = WeakMapPrototype.has;
+ var nativeGet = WeakMapPrototype.get;
+ var nativeSet = WeakMapPrototype.set;
+ redefineAll(WeakMapPrototype, {
+ 'delete': function (key) {
+ if (isObject(key) && !isExtensible(key)) {
+ var state = enforceIternalState(this);
+ if (!state.frozen) state.frozen = new InternalWeakMap();
+ return nativeDelete.call(this, key) || state.frozen['delete'](key);
+ } return nativeDelete.call(this, key);
+ },
+ has: function has(key) {
+ if (isObject(key) && !isExtensible(key)) {
+ var state = enforceIternalState(this);
+ if (!state.frozen) state.frozen = new InternalWeakMap();
+ return nativeHas.call(this, key) || state.frozen.has(key);
+ } return nativeHas.call(this, key);
+ },
+ get: function get(key) {
+ if (isObject(key) && !isExtensible(key)) {
+ var state = enforceIternalState(this);
+ if (!state.frozen) state.frozen = new InternalWeakMap();
+ return nativeHas.call(this, key) ? nativeGet.call(this, key) : state.frozen.get(key);
+ } return nativeGet.call(this, key);
+ },
+ set: function set(key, value) {
+ if (isObject(key) && !isExtensible(key)) {
+ var state = enforceIternalState(this);
+ if (!state.frozen) state.frozen = new InternalWeakMap();
+ nativeHas.call(this, key) ? nativeSet.call(this, key, value) : state.frozen.set(key, value);
+ } else nativeSet.call(this, key, value);
+ return this;
+ }
+ });
+}
+});
+
+var $every = arrayIteration.every;
+
+
+
+var STRICT_METHOD$3 = arrayMethodIsStrict('every');
+var USES_TO_LENGTH$7 = arrayMethodUsesToLength('every');
+
+// `Array.prototype.every` method
+// https://tc39.github.io/ecma262/#sec-array.prototype.every
+_export({ target: 'Array', proto: true, forced: !STRICT_METHOD$3 || !USES_TO_LENGTH$7 }, {
+ every: function every(callbackfn /* , thisArg */) {
+ return $every(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
+ }
+});
+
+// `Object.assign` method
+// https://tc39.github.io/ecma262/#sec-object.assign
+_export({ target: 'Object', stat: true, forced: Object.assign !== objectAssign }, {
+ assign: objectAssign
+});
+
+var non = '\u200B\u0085\u180E';
+
+// check that a method works with the correct list
+// of whitespaces and has a correct name
+var stringTrimForced = function (METHOD_NAME) {
+ return fails(function () {
+ return !!whitespaces[METHOD_NAME]() || non[METHOD_NAME]() != non || whitespaces[METHOD_NAME].name !== METHOD_NAME;
+ });
+};
+
+var $trim = stringTrim.trim;
+
+
+// `String.prototype.trim` method
+// https://tc39.github.io/ecma262/#sec-string.prototype.trim
+_export({ target: 'String', proto: true, forced: stringTrimForced('trim') }, {
+ trim: function trim() {
+ return $trim(this);
+ }
+});
+
+var $some = arrayIteration.some;
+
+
+
+var STRICT_METHOD$4 = arrayMethodIsStrict('some');
+var USES_TO_LENGTH$8 = arrayMethodUsesToLength('some');
+
+// `Array.prototype.some` method
+// https://tc39.github.io/ecma262/#sec-array.prototype.some
+_export({ target: 'Array', proto: true, forced: !STRICT_METHOD$4 || !USES_TO_LENGTH$8 }, {
+ some: function some(callbackfn /* , thisArg */) {
+ return $some(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
+ }
+});
+
+// `thisNumberValue` abstract operation
+// https://tc39.github.io/ecma262/#sec-thisnumbervalue
+var thisNumberValue = function (value) {
+ if (typeof value != 'number' && classofRaw(value) != 'Number') {
+ throw TypeError('Incorrect invocation');
+ }
+ return +value;
+};
+
+// `String.prototype.repeat` method implementation
+// https://tc39.github.io/ecma262/#sec-string.prototype.repeat
+var stringRepeat = ''.repeat || function repeat(count) {
+ var str = String(requireObjectCoercible(this));
+ var result = '';
+ var n = toInteger(count);
+ if (n < 0 || n == Infinity) throw RangeError('Wrong number of repetitions');
+ for (;n > 0; (n >>>= 1) && (str += str)) if (n & 1) result += str;
+ return result;
+};
+
+var nativeToFixed = 1.0.toFixed;
+var floor$4 = Math.floor;
+
+var pow$1 = function (x, n, acc) {
+ return n === 0 ? acc : n % 2 === 1 ? pow$1(x, n - 1, acc * x) : pow$1(x * x, n / 2, acc);
+};
+
+var log = function (x) {
+ var n = 0;
+ var x2 = x;
+ while (x2 >= 4096) {
+ n += 12;
+ x2 /= 4096;
+ }
+ while (x2 >= 2) {
+ n += 1;
+ x2 /= 2;
+ } return n;
+};
+
+var FORCED$1 = nativeToFixed && (
+ 0.00008.toFixed(3) !== '0.000' ||
+ 0.9.toFixed(0) !== '1' ||
+ 1.255.toFixed(2) !== '1.25' ||
+ 1000000000000000128.0.toFixed(0) !== '1000000000000000128'
+) || !fails(function () {
+ // V8 ~ Android 4.3-
+ nativeToFixed.call({});
+});
+
+// `Number.prototype.toFixed` method
+// https://tc39.github.io/ecma262/#sec-number.prototype.tofixed
+_export({ target: 'Number', proto: true, forced: FORCED$1 }, {
+ // eslint-disable-next-line max-statements
+ toFixed: function toFixed(fractionDigits) {
+ var number = thisNumberValue(this);
+ var fractDigits = toInteger(fractionDigits);
+ var data = [0, 0, 0, 0, 0, 0];
+ var sign = '';
+ var result = '0';
+ var e, z, j, k;
+
+ var multiply = function (n, c) {
+ var index = -1;
+ var c2 = c;
+ while (++index < 6) {
+ c2 += n * data[index];
+ data[index] = c2 % 1e7;
+ c2 = floor$4(c2 / 1e7);
+ }
+ };
+
+ var divide = function (n) {
+ var index = 6;
+ var c = 0;
+ while (--index >= 0) {
+ c += data[index];
+ data[index] = floor$4(c / n);
+ c = (c % n) * 1e7;
+ }
+ };
+
+ var dataToString = function () {
+ var index = 6;
+ var s = '';
+ while (--index >= 0) {
+ if (s !== '' || index === 0 || data[index] !== 0) {
+ var t = String(data[index]);
+ s = s === '' ? t : s + stringRepeat.call('0', 7 - t.length) + t;
+ }
+ } return s;
+ };
+
+ if (fractDigits < 0 || fractDigits > 20) throw RangeError('Incorrect fraction digits');
+ // eslint-disable-next-line no-self-compare
+ if (number != number) return 'NaN';
+ if (number <= -1e21 || number >= 1e21) return String(number);
+ if (number < 0) {
+ sign = '-';
+ number = -number;
+ }
+ if (number > 1e-21) {
+ e = log(number * pow$1(2, 69, 1)) - 69;
+ z = e < 0 ? number * pow$1(2, -e, 1) : number / pow$1(2, e, 1);
+ z *= 0x10000000000000;
+ e = 52 - e;
+ if (e > 0) {
+ multiply(0, z);
+ j = fractDigits;
+ while (j >= 7) {
+ multiply(1e7, 0);
+ j -= 7;
+ }
+ multiply(pow$1(10, j, 1), 0);
+ j = e - 1;
+ while (j >= 23) {
+ divide(1 << 23);
+ j -= 23;
+ }
+ divide(1 << j);
+ multiply(1, 1);
+ divide(2);
+ result = dataToString();
+ } else {
+ multiply(0, z);
+ multiply(1 << -e, 0);
+ result = dataToString() + stringRepeat.call('0', fractDigits);
+ }
+ }
+ if (fractDigits > 0) {
+ k = result.length;
+ result = sign + (k <= fractDigits
+ ? '0.' + stringRepeat.call('0', fractDigits - k) + result
+ : result.slice(0, k - fractDigits) + '.' + result.slice(k - fractDigits));
+ } else {
+ result = sign + result;
+ } return result;
+ }
+});
+
+var propertyIsEnumerable = objectPropertyIsEnumerable.f;
+
+// `Object.{ entries, values }` methods implementation
+var createMethod$4 = function (TO_ENTRIES) {
+ return function (it) {
+ var O = toIndexedObject(it);
+ var keys = objectKeys(O);
+ var length = keys.length;
+ var i = 0;
+ var result = [];
+ var key;
+ while (length > i) {
+ key = keys[i++];
+ if (!descriptors || propertyIsEnumerable.call(O, key)) {
+ result.push(TO_ENTRIES ? [key, O[key]] : O[key]);
+ }
+ }
+ return result;
+ };
+};
+
+var objectToArray = {
+ // `Object.entries` method
+ // https://tc39.github.io/ecma262/#sec-object.entries
+ entries: createMethod$4(true),
+ // `Object.values` method
+ // https://tc39.github.io/ecma262/#sec-object.values
+ values: createMethod$4(false)
+};
+
+var $entries = objectToArray.entries;
+
+// `Object.entries` method
+// https://tc39.github.io/ecma262/#sec-object.entries
+_export({ target: 'Object', stat: true }, {
+ entries: function entries(O) {
+ return $entries(O);
+ }
+});
+
+var $values = objectToArray.values;
+
+// `Object.values` method
+// https://tc39.github.io/ecma262/#sec-object.values
+_export({ target: 'Object', stat: true }, {
+ values: function values(O) {
+ return $values(O);
+ }
+});
+
+// `Number.isNaN` method
+// https://tc39.github.io/ecma262/#sec-number.isnan
+_export({ target: 'Number', stat: true }, {
+ isNaN: function isNaN(number) {
+ // eslint-disable-next-line no-self-compare
+ return number != number;
+ }
+});
+
+var nativeGetOwnPropertyDescriptor$2 = objectGetOwnPropertyDescriptor.f;
+
+
+var FAILS_ON_PRIMITIVES$1 = fails(function () { nativeGetOwnPropertyDescriptor$2(1); });
+var FORCED$2 = !descriptors || FAILS_ON_PRIMITIVES$1;
+
+// `Object.getOwnPropertyDescriptor` method
+// https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptor
+_export({ target: 'Object', stat: true, forced: FORCED$2, sham: !descriptors }, {
+ getOwnPropertyDescriptor: function getOwnPropertyDescriptor(it, key) {
+ return nativeGetOwnPropertyDescriptor$2(toIndexedObject(it), key);
+ }
+});
+
+// `Object.getOwnPropertyDescriptors` method
+// https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptors
+_export({ target: 'Object', stat: true, sham: !descriptors }, {
+ getOwnPropertyDescriptors: function getOwnPropertyDescriptors(object) {
+ var O = toIndexedObject(object);
+ var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
+ var keys = ownKeys(O);
+ var result = {};
+ var index = 0;
+ var key, descriptor;
+ while (keys.length > index) {
+ descriptor = getOwnPropertyDescriptor(O, key = keys[index++]);
+ if (descriptor !== undefined) createProperty(result, key, descriptor);
+ }
+ return result;
+ }
+});
+
+// @@match logic
+fixRegexpWellKnownSymbolLogic('match', 1, function (MATCH, nativeMatch, maybeCallNative) {
+ return [
+ // `String.prototype.match` method
+ // https://tc39.github.io/ecma262/#sec-string.prototype.match
+ function match(regexp) {
+ var O = requireObjectCoercible(this);
+ var matcher = regexp == undefined ? undefined : regexp[MATCH];
+ return matcher !== undefined ? matcher.call(regexp, O) : new RegExp(regexp)[MATCH](String(O));
+ },
+ // `RegExp.prototype[@@match]` method
+ // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@match
+ function (regexp) {
+ var res = maybeCallNative(nativeMatch, regexp, this);
+ if (res.done) return res.value;
+
+ var rx = anObject(regexp);
+ var S = String(this);
+
+ if (!rx.global) return regexpExecAbstract(rx, S);
+
+ var fullUnicode = rx.unicode;
+ rx.lastIndex = 0;
+ var A = [];
+ var n = 0;
+ var result;
+ while ((result = regexpExecAbstract(rx, S)) !== null) {
+ var matchStr = String(result[0]);
+ A[n] = matchStr;
+ if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
+ n++;
+ }
+ return n === 0 ? null : A;
+ }
+ ];
+});
+
+function _classCallCheck$1(e, t) {
+ if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function");
+}
+
+function _defineProperties$1(e, t) {
+ for (var n = 0; n < t.length; n++) {
+ var r = t[n];
+ r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r);
+ }
+}
+
+function _createClass$1(e, t, n) {
+ return t && _defineProperties$1(e.prototype, t), n && _defineProperties$1(e, n), e;
+}
+
+function _defineProperty$1(e, t, n) {
+ return t in e ? Object.defineProperty(e, t, {
+ value: n,
+ enumerable: !0,
+ configurable: !0,
+ writable: !0
+ }) : e[t] = n, e;
+}
+
+function ownKeys$2(e, t) {
+ var n = Object.keys(e);
+
+ if (Object.getOwnPropertySymbols) {
+ var r = Object.getOwnPropertySymbols(e);
+ t && (r = r.filter(function (t) {
+ return Object.getOwnPropertyDescriptor(e, t).enumerable;
+ })), n.push.apply(n, r);
+ }
+
+ return n;
+}
+
+function _objectSpread2$1(e) {
+ for (var t = 1; t < arguments.length; t++) {
+ var n = null != arguments[t] ? arguments[t] : {};
+ t % 2 ? ownKeys$2(Object(n), !0).forEach(function (t) {
+ _defineProperty$1(e, t, n[t]);
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : ownKeys$2(Object(n)).forEach(function (t) {
+ Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(n, t));
+ });
+ }
+
+ return e;
+}
+
+var defaults = {
+ addCSS: !0,
+ thumbWidth: 15,
+ watch: !0
+};
+
+function matches(e, t) {
+ return function () {
+ return Array.from(document.querySelectorAll(t)).includes(this);
+ }.call(e, t);
+}
+
+function trigger(e, t) {
+ if (e && t) {
+ var n = new Event(t, {
+ bubbles: !0
+ });
+ e.dispatchEvent(n);
+ }
+}
+
+var getConstructor = function getConstructor(e) {
+ return null != e ? e.constructor : null;
+},
+ instanceOf = function instanceOf(e, t) {
+ return !!(e && t && e instanceof t);
+},
+ isNullOrUndefined = function isNullOrUndefined(e) {
+ return null == e;
+},
+ isObject$1 = function isObject(e) {
+ return getConstructor(e) === Object;
+},
+ isNumber = function isNumber(e) {
+ return getConstructor(e) === Number && !Number.isNaN(e);
+},
+ isString = function isString(e) {
+ return getConstructor(e) === String;
+},
+ isBoolean = function isBoolean(e) {
+ return getConstructor(e) === Boolean;
+},
+ isFunction = function isFunction(e) {
+ return getConstructor(e) === Function;
+},
+ isArray$1 = function isArray(e) {
+ return Array.isArray(e);
+},
+ isNodeList = function isNodeList(e) {
+ return instanceOf(e, NodeList);
+},
+ isElement = function isElement(e) {
+ return instanceOf(e, Element);
+},
+ isEvent = function isEvent(e) {
+ return instanceOf(e, Event);
+},
+ isEmpty = function isEmpty(e) {
+ return isNullOrUndefined(e) || (isString(e) || isArray$1(e) || isNodeList(e)) && !e.length || isObject$1(e) && !Object.keys(e).length;
+},
+ is = {
+ nullOrUndefined: isNullOrUndefined,
+ object: isObject$1,
+ number: isNumber,
+ string: isString,
+ boolean: isBoolean,
+ function: isFunction,
+ array: isArray$1,
+ nodeList: isNodeList,
+ element: isElement,
+ event: isEvent,
+ empty: isEmpty
+};
+
+function getDecimalPlaces(e) {
+ var t = "".concat(e).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);
+ return t ? Math.max(0, (t[1] ? t[1].length : 0) - (t[2] ? +t[2] : 0)) : 0;
+}
+
+function round(e, t) {
+ if (1 > t) {
+ var n = getDecimalPlaces(t);
+ return parseFloat(e.toFixed(n));
+ }
+
+ return Math.round(e / t) * t;
+}
+
+var RangeTouch = function () {
+ function e(t, n) {
+ _classCallCheck$1(this, e), is.element(t) ? this.element = t : is.string(t) && (this.element = document.querySelector(t)), is.element(this.element) && is.empty(this.element.rangeTouch) && (this.config = _objectSpread2$1({}, defaults, {}, n), this.init());
+ }
+
+ return _createClass$1(e, [{
+ key: "init",
+ value: function value() {
+ e.enabled && (this.config.addCSS && (this.element.style.userSelect = "none", this.element.style.webKitUserSelect = "none", this.element.style.touchAction = "manipulation"), this.listeners(!0), this.element.rangeTouch = this);
+ }
+ }, {
+ key: "destroy",
+ value: function value() {
+ e.enabled && (this.config.addCSS && (this.element.style.userSelect = "", this.element.style.webKitUserSelect = "", this.element.style.touchAction = ""), this.listeners(!1), this.element.rangeTouch = null);
+ }
+ }, {
+ key: "listeners",
+ value: function value(e) {
+ var t = this,
+ n = e ? "addEventListener" : "removeEventListener";
+ ["touchstart", "touchmove", "touchend"].forEach(function (e) {
+ t.element[n](e, function (e) {
+ return t.set(e);
+ }, !1);
+ });
+ }
+ }, {
+ key: "get",
+ value: function value(t) {
+ if (!e.enabled || !is.event(t)) return null;
+ var n,
+ r = t.target,
+ i = t.changedTouches[0],
+ o = parseFloat(r.getAttribute("min")) || 0,
+ s = parseFloat(r.getAttribute("max")) || 100,
+ u = parseFloat(r.getAttribute("step")) || 1,
+ c = r.getBoundingClientRect(),
+ a = 100 / c.width * (this.config.thumbWidth / 2) / 100;
+ return 0 > (n = 100 / c.width * (i.clientX - c.left)) ? n = 0 : 100 < n && (n = 100), 50 > n ? n -= (100 - 2 * n) * a : 50 < n && (n += 2 * (n - 50) * a), o + round(n / 100 * (s - o), u);
+ }
+ }, {
+ key: "set",
+ value: function value(t) {
+ e.enabled && is.event(t) && !t.target.disabled && (t.preventDefault(), t.target.value = this.get(t), trigger(t.target, "touchend" === t.type ? "change" : "input"));
+ }
+ }], [{
+ key: "setup",
+ value: function value(t) {
+ var n = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : {},
+ r = null;
+ if (is.empty(t) || is.string(t) ? r = Array.from(document.querySelectorAll(is.string(t) ? t : 'input[type="range"]')) : is.element(t) ? r = [t] : is.nodeList(t) ? r = Array.from(t) : is.array(t) && (r = t.filter(is.element)), is.empty(r)) return null;
+
+ var i = _objectSpread2$1({}, defaults, {}, n);
+
+ if (is.string(t) && i.watch) {
+ var o = new MutationObserver(function (n) {
+ Array.from(n).forEach(function (n) {
+ Array.from(n.addedNodes).forEach(function (n) {
+ is.element(n) && matches(n, t) && new e(n, i);
+ });
+ });
+ });
+ o.observe(document.body, {
+ childList: !0,
+ subtree: !0
+ });
+ }
+
+ return r.map(function (t) {
+ return new e(t, n);
+ });
+ }
+ }, {
+ key: "enabled",
+ get: function get() {
+ return "ontouchstart" in document.documentElement;
+ }
+ }]), e;
+}();
+
+var nativePromiseConstructor = global_1.Promise;
+
+var SPECIES$5 = wellKnownSymbol('species');
+
+var setSpecies = function (CONSTRUCTOR_NAME) {
+ var Constructor = getBuiltIn(CONSTRUCTOR_NAME);
+ var defineProperty = objectDefineProperty.f;
+
+ if (descriptors && Constructor && !Constructor[SPECIES$5]) {
+ defineProperty(Constructor, SPECIES$5, {
+ configurable: true,
+ get: function () { return this; }
+ });
+ }
+};
+
+var engineIsIos = /(iphone|ipod|ipad).*applewebkit/i.test(engineUserAgent);
+
+var location = global_1.location;
+var set$1 = global_1.setImmediate;
+var clear = global_1.clearImmediate;
+var process$1 = global_1.process;
+var MessageChannel = global_1.MessageChannel;
+var Dispatch = global_1.Dispatch;
+var counter = 0;
+var queue = {};
+var ONREADYSTATECHANGE = 'onreadystatechange';
+var defer, channel, port;
+
+var run = function (id) {
+ // eslint-disable-next-line no-prototype-builtins
+ if (queue.hasOwnProperty(id)) {
+ var fn = queue[id];
+ delete queue[id];
+ fn();
+ }
+};
+
+var runner = function (id) {
+ return function () {
+ run(id);
+ };
+};
+
+var listener = function (event) {
+ run(event.data);
+};
+
+var post = function (id) {
+ // old engines have not location.origin
+ global_1.postMessage(id + '', location.protocol + '//' + location.host);
+};
+
+// Node.js 0.9+ & IE10+ has setImmediate, otherwise:
+if (!set$1 || !clear) {
+ set$1 = function setImmediate(fn) {
+ var args = [];
+ var i = 1;
+ while (arguments.length > i) args.push(arguments[i++]);
+ queue[++counter] = function () {
+ // eslint-disable-next-line no-new-func
+ (typeof fn == 'function' ? fn : Function(fn)).apply(undefined, args);
+ };
+ defer(counter);
+ return counter;
+ };
+ clear = function clearImmediate(id) {
+ delete queue[id];
+ };
+ // Node.js 0.8-
+ if (classofRaw(process$1) == 'process') {
+ defer = function (id) {
+ process$1.nextTick(runner(id));
+ };
+ // Sphere (JS game engine) Dispatch API
+ } else if (Dispatch && Dispatch.now) {
+ defer = function (id) {
+ Dispatch.now(runner(id));
+ };
+ // Browsers with MessageChannel, includes WebWorkers
+ // except iOS - https://github.com/zloirock/core-js/issues/624
+ } else if (MessageChannel && !engineIsIos) {
+ channel = new MessageChannel();
+ port = channel.port2;
+ channel.port1.onmessage = listener;
+ defer = functionBindContext(port.postMessage, port, 1);
+ // Browsers with postMessage, skip WebWorkers
+ // IE8 has postMessage, but it's sync & typeof its postMessage is 'object'
+ } else if (
+ global_1.addEventListener &&
+ typeof postMessage == 'function' &&
+ !global_1.importScripts &&
+ !fails(post) &&
+ location.protocol !== 'file:'
+ ) {
+ defer = post;
+ global_1.addEventListener('message', listener, false);
+ // IE8-
+ } else if (ONREADYSTATECHANGE in documentCreateElement('script')) {
+ defer = function (id) {
+ html.appendChild(documentCreateElement('script'))[ONREADYSTATECHANGE] = function () {
+ html.removeChild(this);
+ run(id);
+ };
+ };
+ // Rest old browsers
+ } else {
+ defer = function (id) {
+ setTimeout(runner(id), 0);
+ };
+ }
+}
+
+var task = {
+ set: set$1,
+ clear: clear
+};
+
+var getOwnPropertyDescriptor$3 = objectGetOwnPropertyDescriptor.f;
+
+var macrotask = task.set;
+
+
+var MutationObserver$1 = global_1.MutationObserver || global_1.WebKitMutationObserver;
+var process$2 = global_1.process;
+var Promise$1 = global_1.Promise;
+var IS_NODE = classofRaw(process$2) == 'process';
+// Node.js 11 shows ExperimentalWarning on getting `queueMicrotask`
+var queueMicrotaskDescriptor = getOwnPropertyDescriptor$3(global_1, 'queueMicrotask');
+var queueMicrotask = queueMicrotaskDescriptor && queueMicrotaskDescriptor.value;
+
+var flush, head, last, notify, toggle, node, promise, then;
+
+// modern engines have queueMicrotask method
+if (!queueMicrotask) {
+ flush = function () {
+ var parent, fn;
+ if (IS_NODE && (parent = process$2.domain)) parent.exit();
+ while (head) {
+ fn = head.fn;
+ head = head.next;
+ try {
+ fn();
+ } catch (error) {
+ if (head) notify();
+ else last = undefined;
+ throw error;
+ }
+ } last = undefined;
+ if (parent) parent.enter();
+ };
+
+ // Node.js
+ if (IS_NODE) {
+ notify = function () {
+ process$2.nextTick(flush);
+ };
+ // browsers with MutationObserver, except iOS - https://github.com/zloirock/core-js/issues/339
+ } else if (MutationObserver$1 && !engineIsIos) {
+ toggle = true;
+ node = document.createTextNode('');
+ new MutationObserver$1(flush).observe(node, { characterData: true });
+ notify = function () {
+ node.data = toggle = !toggle;
+ };
+ // environments with maybe non-completely correct, but existent Promise
+ } else if (Promise$1 && Promise$1.resolve) {
+ // Promise.resolve without an argument throws an error in LG WebOS 2
+ promise = Promise$1.resolve(undefined);
+ then = promise.then;
+ notify = function () {
+ then.call(promise, flush);
+ };
+ // for other environments - macrotask based on:
+ // - setImmediate
+ // - MessageChannel
+ // - window.postMessag
+ // - onreadystatechange
+ // - setTimeout
+ } else {
+ notify = function () {
+ // strange IE + webpack dev server bug - use .call(global)
+ macrotask.call(global_1, flush);
+ };
+ }
+}
+
+var microtask = queueMicrotask || function (fn) {
+ var task = { fn: fn, next: undefined };
+ if (last) last.next = task;
+ if (!head) {
+ head = task;
+ notify();
+ } last = task;
+};
+
+var PromiseCapability = function (C) {
+ var resolve, reject;
+ this.promise = new C(function ($$resolve, $$reject) {
+ if (resolve !== undefined || reject !== undefined) throw TypeError('Bad Promise constructor');
+ resolve = $$resolve;
+ reject = $$reject;
+ });
+ this.resolve = aFunction$1(resolve);
+ this.reject = aFunction$1(reject);
+};
+
+// 25.4.1.5 NewPromiseCapability(C)
+var f$7 = function (C) {
+ return new PromiseCapability(C);
+};
+
+var newPromiseCapability = {
+ f: f$7
+};
+
+var promiseResolve = function (C, x) {
+ anObject(C);
+ if (isObject(x) && x.constructor === C) return x;
+ var promiseCapability = newPromiseCapability.f(C);
+ var resolve = promiseCapability.resolve;
+ resolve(x);
+ return promiseCapability.promise;
+};
+
+var hostReportErrors = function (a, b) {
+ var console = global_1.console;
+ if (console && console.error) {
+ arguments.length === 1 ? console.error(a) : console.error(a, b);
+ }
+};
+
+var perform = function (exec) {
+ try {
+ return { error: false, value: exec() };
+ } catch (error) {
+ return { error: true, value: error };
+ }
+};
+
+var task$1 = task.set;
+
+
+
+
+
+
+
+
+
+
+var SPECIES$6 = wellKnownSymbol('species');
+var PROMISE = 'Promise';
+var getInternalState$3 = internalState.get;
+var setInternalState$6 = internalState.set;
+var getInternalPromiseState = internalState.getterFor(PROMISE);
+var PromiseConstructor = nativePromiseConstructor;
+var TypeError$1 = global_1.TypeError;
+var document$2 = global_1.document;
+var process$3 = global_1.process;
+var $fetch$1 = getBuiltIn('fetch');
+var newPromiseCapability$1 = newPromiseCapability.f;
+var newGenericPromiseCapability = newPromiseCapability$1;
+var IS_NODE$1 = classofRaw(process$3) == 'process';
+var DISPATCH_EVENT = !!(document$2 && document$2.createEvent && global_1.dispatchEvent);
+var UNHANDLED_REJECTION = 'unhandledrejection';
+var REJECTION_HANDLED = 'rejectionhandled';
+var PENDING = 0;
+var FULFILLED = 1;
+var REJECTED = 2;
+var HANDLED = 1;
+var UNHANDLED = 2;
+var Internal, OwnPromiseCapability, PromiseWrapper, nativeThen;
+
+var FORCED$3 = isForced_1(PROMISE, function () {
+ var GLOBAL_CORE_JS_PROMISE = inspectSource(PromiseConstructor) !== String(PromiseConstructor);
+ if (!GLOBAL_CORE_JS_PROMISE) {
+ // V8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables
+ // https://bugs.chromium.org/p/chromium/issues/detail?id=830565
+ // We can't detect it synchronously, so just check versions
+ if (engineV8Version === 66) return true;
+ // Unhandled rejections tracking support, NodeJS Promise without it fails @@species test
+ if (!IS_NODE$1 && typeof PromiseRejectionEvent != 'function') return true;
+ }
+ // We can't use @@species feature detection in V8 since it causes
+ // deoptimization and performance degradation
+ // https://github.com/zloirock/core-js/issues/679
+ if (engineV8Version >= 51 && /native code/.test(PromiseConstructor)) return false;
+ // Detect correctness of subclassing with @@species support
+ var promise = PromiseConstructor.resolve(1);
+ var FakePromise = function (exec) {
+ exec(function () { /* empty */ }, function () { /* empty */ });
+ };
+ var constructor = promise.constructor = {};
+ constructor[SPECIES$6] = FakePromise;
+ return !(promise.then(function () { /* empty */ }) instanceof FakePromise);
+});
+
+var INCORRECT_ITERATION$1 = FORCED$3 || !checkCorrectnessOfIteration(function (iterable) {
+ PromiseConstructor.all(iterable)['catch'](function () { /* empty */ });
+});
+
+// helpers
+var isThenable = function (it) {
+ var then;
+ return isObject(it) && typeof (then = it.then) == 'function' ? then : false;
+};
+
+var notify$1 = function (promise, state, isReject) {
+ if (state.notified) return;
+ state.notified = true;
+ var chain = state.reactions;
+ microtask(function () {
+ var value = state.value;
+ var ok = state.state == FULFILLED;
+ var index = 0;
+ // variable length - can't use forEach
+ while (chain.length > index) {
+ var reaction = chain[index++];
+ var handler = ok ? reaction.ok : reaction.fail;
+ var resolve = reaction.resolve;
+ var reject = reaction.reject;
+ var domain = reaction.domain;
+ var result, then, exited;
+ try {
+ if (handler) {
+ if (!ok) {
+ if (state.rejection === UNHANDLED) onHandleUnhandled(promise, state);
+ state.rejection = HANDLED;
+ }
+ if (handler === true) result = value;
+ else {
+ if (domain) domain.enter();
+ result = handler(value); // can throw
+ if (domain) {
+ domain.exit();
+ exited = true;
+ }
+ }
+ if (result === reaction.promise) {
+ reject(TypeError$1('Promise-chain cycle'));
+ } else if (then = isThenable(result)) {
+ then.call(result, resolve, reject);
+ } else resolve(result);
+ } else reject(value);
+ } catch (error) {
+ if (domain && !exited) domain.exit();
+ reject(error);
+ }
+ }
+ state.reactions = [];
+ state.notified = false;
+ if (isReject && !state.rejection) onUnhandled(promise, state);
+ });
+};
+
+var dispatchEvent = function (name, promise, reason) {
+ var event, handler;
+ if (DISPATCH_EVENT) {
+ event = document$2.createEvent('Event');
+ event.promise = promise;
+ event.reason = reason;
+ event.initEvent(name, false, true);
+ global_1.dispatchEvent(event);
+ } else event = { promise: promise, reason: reason };
+ if (handler = global_1['on' + name]) handler(event);
+ else if (name === UNHANDLED_REJECTION) hostReportErrors('Unhandled promise rejection', reason);
+};
+
+var onUnhandled = function (promise, state) {
+ task$1.call(global_1, function () {
+ var value = state.value;
+ var IS_UNHANDLED = isUnhandled(state);
+ var result;
+ if (IS_UNHANDLED) {
+ result = perform(function () {
+ if (IS_NODE$1) {
+ process$3.emit('unhandledRejection', value, promise);
+ } else dispatchEvent(UNHANDLED_REJECTION, promise, value);
+ });
+ // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should
+ state.rejection = IS_NODE$1 || isUnhandled(state) ? UNHANDLED : HANDLED;
+ if (result.error) throw result.value;
+ }
+ });
+};
+
+var isUnhandled = function (state) {
+ return state.rejection !== HANDLED && !state.parent;
+};
+
+var onHandleUnhandled = function (promise, state) {
+ task$1.call(global_1, function () {
+ if (IS_NODE$1) {
+ process$3.emit('rejectionHandled', promise);
+ } else dispatchEvent(REJECTION_HANDLED, promise, state.value);
+ });
+};
+
+var bind = function (fn, promise, state, unwrap) {
+ return function (value) {
+ fn(promise, state, value, unwrap);
+ };
+};
+
+var internalReject = function (promise, state, value, unwrap) {
+ if (state.done) return;
+ state.done = true;
+ if (unwrap) state = unwrap;
+ state.value = value;
+ state.state = REJECTED;
+ notify$1(promise, state, true);
+};
+
+var internalResolve = function (promise, state, value, unwrap) {
+ if (state.done) return;
+ state.done = true;
+ if (unwrap) state = unwrap;
+ try {
+ if (promise === value) throw TypeError$1("Promise can't be resolved itself");
+ var then = isThenable(value);
+ if (then) {
+ microtask(function () {
+ var wrapper = { done: false };
+ try {
+ then.call(value,
+ bind(internalResolve, promise, wrapper, state),
+ bind(internalReject, promise, wrapper, state)
+ );
+ } catch (error) {
+ internalReject(promise, wrapper, error, state);
+ }
+ });
+ } else {
+ state.value = value;
+ state.state = FULFILLED;
+ notify$1(promise, state, false);
+ }
+ } catch (error) {
+ internalReject(promise, { done: false }, error, state);
+ }
+};
+
+// constructor polyfill
+if (FORCED$3) {
+ // 25.4.3.1 Promise(executor)
+ PromiseConstructor = function Promise(executor) {
+ anInstance(this, PromiseConstructor, PROMISE);
+ aFunction$1(executor);
+ Internal.call(this);
+ var state = getInternalState$3(this);
+ try {
+ executor(bind(internalResolve, this, state), bind(internalReject, this, state));
+ } catch (error) {
+ internalReject(this, state, error);
+ }
+ };
+ // eslint-disable-next-line no-unused-vars
+ Internal = function Promise(executor) {
+ setInternalState$6(this, {
+ type: PROMISE,
+ done: false,
+ notified: false,
+ parent: false,
+ reactions: [],
+ rejection: false,
+ state: PENDING,
+ value: undefined
+ });
+ };
+ Internal.prototype = redefineAll(PromiseConstructor.prototype, {
+ // `Promise.prototype.then` method
+ // https://tc39.github.io/ecma262/#sec-promise.prototype.then
+ then: function then(onFulfilled, onRejected) {
+ var state = getInternalPromiseState(this);
+ var reaction = newPromiseCapability$1(speciesConstructor(this, PromiseConstructor));
+ reaction.ok = typeof onFulfilled == 'function' ? onFulfilled : true;
+ reaction.fail = typeof onRejected == 'function' && onRejected;
+ reaction.domain = IS_NODE$1 ? process$3.domain : undefined;
+ state.parent = true;
+ state.reactions.push(reaction);
+ if (state.state != PENDING) notify$1(this, state, false);
+ return reaction.promise;
+ },
+ // `Promise.prototype.catch` method
+ // https://tc39.github.io/ecma262/#sec-promise.prototype.catch
+ 'catch': function (onRejected) {
+ return this.then(undefined, onRejected);
+ }
+ });
+ OwnPromiseCapability = function () {
+ var promise = new Internal();
+ var state = getInternalState$3(promise);
+ this.promise = promise;
+ this.resolve = bind(internalResolve, promise, state);
+ this.reject = bind(internalReject, promise, state);
+ };
+ newPromiseCapability.f = newPromiseCapability$1 = function (C) {
+ return C === PromiseConstructor || C === PromiseWrapper
+ ? new OwnPromiseCapability(C)
+ : newGenericPromiseCapability(C);
+ };
+
+ if ( typeof nativePromiseConstructor == 'function') {
+ nativeThen = nativePromiseConstructor.prototype.then;
+
+ // wrap native Promise#then for native async functions
+ redefine(nativePromiseConstructor.prototype, 'then', function then(onFulfilled, onRejected) {
+ var that = this;
+ return new PromiseConstructor(function (resolve, reject) {
+ nativeThen.call(that, resolve, reject);
+ }).then(onFulfilled, onRejected);
+ // https://github.com/zloirock/core-js/issues/640
+ }, { unsafe: true });
+
+ // wrap fetch result
+ if (typeof $fetch$1 == 'function') _export({ global: true, enumerable: true, forced: true }, {
+ // eslint-disable-next-line no-unused-vars
+ fetch: function fetch(input /* , init */) {
+ return promiseResolve(PromiseConstructor, $fetch$1.apply(global_1, arguments));
+ }
+ });
+ }
+}
+
+_export({ global: true, wrap: true, forced: FORCED$3 }, {
+ Promise: PromiseConstructor
+});
+
+setToStringTag(PromiseConstructor, PROMISE, false);
+setSpecies(PROMISE);
+
+PromiseWrapper = getBuiltIn(PROMISE);
+
+// statics
+_export({ target: PROMISE, stat: true, forced: FORCED$3 }, {
+ // `Promise.reject` method
+ // https://tc39.github.io/ecma262/#sec-promise.reject
+ reject: function reject(r) {
+ var capability = newPromiseCapability$1(this);
+ capability.reject.call(undefined, r);
+ return capability.promise;
+ }
+});
+
+_export({ target: PROMISE, stat: true, forced: FORCED$3 }, {
+ // `Promise.resolve` method
+ // https://tc39.github.io/ecma262/#sec-promise.resolve
+ resolve: function resolve(x) {
+ return promiseResolve( this, x);
+ }
+});
+
+_export({ target: PROMISE, stat: true, forced: INCORRECT_ITERATION$1 }, {
+ // `Promise.all` method
+ // https://tc39.github.io/ecma262/#sec-promise.all
+ all: function all(iterable) {
+ var C = this;
+ var capability = newPromiseCapability$1(C);
+ var resolve = capability.resolve;
+ var reject = capability.reject;
+ var result = perform(function () {
+ var $promiseResolve = aFunction$1(C.resolve);
+ var values = [];
+ var counter = 0;
+ var remaining = 1;
+ iterate_1(iterable, function (promise) {
+ var index = counter++;
+ var alreadyCalled = false;
+ values.push(undefined);
+ remaining++;
+ $promiseResolve.call(C, promise).then(function (value) {
+ if (alreadyCalled) return;
+ alreadyCalled = true;
+ values[index] = value;
+ --remaining || resolve(values);
+ }, reject);
+ });
+ --remaining || resolve(values);
+ });
+ if (result.error) reject(result.value);
+ return capability.promise;
+ },
+ // `Promise.race` method
+ // https://tc39.github.io/ecma262/#sec-promise.race
+ race: function race(iterable) {
+ var C = this;
+ var capability = newPromiseCapability$1(C);
+ var reject = capability.reject;
+ var result = perform(function () {
+ var $promiseResolve = aFunction$1(C.resolve);
+ iterate_1(iterable, function (promise) {
+ $promiseResolve.call(C, promise).then(capability.resolve, reject);
+ });
+ });
+ if (result.error) reject(result.value);
+ return capability.promise;
+ }
+});
+
+var getOwnPropertyDescriptor$4 = objectGetOwnPropertyDescriptor.f;
+
+
+
+
+
+
+var nativeStartsWith = ''.startsWith;
+var min$4 = Math.min;
+
+var CORRECT_IS_REGEXP_LOGIC = correctIsRegexpLogic('startsWith');
+// https://github.com/zloirock/core-js/pull/702
+var MDN_POLYFILL_BUG = !CORRECT_IS_REGEXP_LOGIC && !!function () {
+ var descriptor = getOwnPropertyDescriptor$4(String.prototype, 'startsWith');
+ return descriptor && !descriptor.writable;
+}();
+
+// `String.prototype.startsWith` method
+// https://tc39.github.io/ecma262/#sec-string.prototype.startswith
+_export({ target: 'String', proto: true, forced: !MDN_POLYFILL_BUG && !CORRECT_IS_REGEXP_LOGIC }, {
+ startsWith: function startsWith(searchString /* , position = 0 */) {
+ var that = String(requireObjectCoercible(this));
+ notARegexp(searchString);
+ var index = toLength(min$4(arguments.length > 1 ? arguments[1] : undefined, that.length));
+ var search = String(searchString);
+ return nativeStartsWith
+ ? nativeStartsWith.call(that, search, index)
+ : that.slice(index, index + search.length) === search;
+ }
+});
+
+// ==========================================================================
+// Type checking utils
+// ==========================================================================
+var getConstructor$1 = function getConstructor(input) {
+ return input !== null && typeof input !== 'undefined' ? input.constructor : null;
+};
+
+var instanceOf$1 = function instanceOf(input, constructor) {
+ return Boolean(input && constructor && input instanceof constructor);
+};
+
+var isNullOrUndefined$1 = function isNullOrUndefined(input) {
+ return input === null || typeof input === 'undefined';
+};
+
+var isObject$2 = function isObject(input) {
+ return getConstructor$1(input) === Object;
+};
+
+var isNumber$1 = function isNumber(input) {
+ return getConstructor$1(input) === Number && !Number.isNaN(input);
+};
+
+var isString$1 = function isString(input) {
+ return getConstructor$1(input) === String;
+};
+
+var isBoolean$1 = function isBoolean(input) {
+ return getConstructor$1(input) === Boolean;
+};
+
+var isFunction$1 = function isFunction(input) {
+ return getConstructor$1(input) === Function;
+};
+
+var isArray$2 = function isArray(input) {
+ return Array.isArray(input);
+};
+
+var isWeakMap = function isWeakMap(input) {
+ return instanceOf$1(input, WeakMap);
+};
+
+var isNodeList$1 = function isNodeList(input) {
+ return instanceOf$1(input, NodeList);
+};
+
+var isElement$1 = function isElement(input) {
+ return instanceOf$1(input, Element);
+};
+
+var isTextNode = function isTextNode(input) {
+ return getConstructor$1(input) === Text;
+};
+
+var isEvent$1 = function isEvent(input) {
+ return instanceOf$1(input, Event);
+};
+
+var isKeyboardEvent = function isKeyboardEvent(input) {
+ return instanceOf$1(input, KeyboardEvent);
+};
+
+var isCue = function isCue(input) {
+ return instanceOf$1(input, window.TextTrackCue) || instanceOf$1(input, window.VTTCue);
+};
+
+var isTrack = function isTrack(input) {
+ return instanceOf$1(input, TextTrack) || !isNullOrUndefined$1(input) && isString$1(input.kind);
+};
+
+var isPromise = function isPromise(input) {
+ return instanceOf$1(input, Promise) && isFunction$1(input.then);
+};
+
+var isEmpty$1 = function isEmpty(input) {
+ return isNullOrUndefined$1(input) || (isString$1(input) || isArray$2(input) || isNodeList$1(input)) && !input.length || isObject$2(input) && !Object.keys(input).length;
+};
+
+var isUrl = function isUrl(input) {
+ // Accept a URL object
+ if (instanceOf$1(input, window.URL)) {
+ return true;
+ } // Must be string from here
+
+
+ if (!isString$1(input)) {
+ return false;
+ } // Add the protocol if required
+
+
+ var string = input;
+
+ if (!input.startsWith('http://') || !input.startsWith('https://')) {
+ string = "http://".concat(input);
+ }
+
+ try {
+ return !isEmpty$1(new URL(string).hostname);
+ } catch (e) {
+ return false;
+ }
+};
+
+var is$1 = {
+ nullOrUndefined: isNullOrUndefined$1,
+ object: isObject$2,
+ number: isNumber$1,
+ string: isString$1,
+ boolean: isBoolean$1,
+ function: isFunction$1,
+ array: isArray$2,
+ weakMap: isWeakMap,
+ nodeList: isNodeList$1,
+ element: isElement$1,
+ textNode: isTextNode,
+ event: isEvent$1,
+ keyboardEvent: isKeyboardEvent,
+ cue: isCue,
+ track: isTrack,
+ promise: isPromise,
+ url: isUrl,
+ empty: isEmpty$1
+};
+
+var transitionEndEvent = function () {
+ var element = document.createElement('span');
+ var events = {
+ WebkitTransition: 'webkitTransitionEnd',
+ MozTransition: 'transitionend',
+ OTransition: 'oTransitionEnd otransitionend',
+ transition: 'transitionend'
+ };
+ var type = Object.keys(events).find(function (event) {
+ return element.style[event] !== undefined;
+ });
+ return is$1.string(type) ? events[type] : false;
+}(); // Force repaint of element
+
+function repaint(element, delay) {
+ setTimeout(function () {
+ try {
+ // eslint-disable-next-line no-param-reassign
+ element.hidden = true; // eslint-disable-next-line no-unused-expressions
+
+ element.offsetHeight; // eslint-disable-next-line no-param-reassign
+
+ element.hidden = false;
+ } catch (e) {// Do nothing
+ }
+ }, delay);
+}
+
+// ==========================================================================
+// Browser sniffing
+// Unfortunately, due to mixed support, UA sniffing is required
+// ==========================================================================
+var browser = {
+ isIE:
+ /* @cc_on!@ */
+ !!document.documentMode,
+ isEdge: window.navigator.userAgent.includes('Edge'),
+ isWebkit: 'WebkitAppearance' in document.documentElement.style && !/Edge/.test(navigator.userAgent),
+ isIPhone: /(iPhone|iPod)/gi.test(navigator.platform),
+ isIos: /(iPad|iPhone|iPod)/gi.test(navigator.platform)
+};
+
+// `Array.prototype.{ reduce, reduceRight }` methods implementation
+var createMethod$5 = function (IS_RIGHT) {
+ return function (that, callbackfn, argumentsLength, memo) {
+ aFunction$1(callbackfn);
+ var O = toObject(that);
+ var self = indexedObject(O);
+ var length = toLength(O.length);
+ var index = IS_RIGHT ? length - 1 : 0;
+ var i = IS_RIGHT ? -1 : 1;
+ if (argumentsLength < 2) while (true) {
+ if (index in self) {
+ memo = self[index];
+ index += i;
+ break;
+ }
+ index += i;
+ if (IS_RIGHT ? index < 0 : length <= index) {
+ throw TypeError('Reduce of empty array with no initial value');
+ }
+ }
+ for (;IS_RIGHT ? index >= 0 : length > index; index += i) if (index in self) {
+ memo = callbackfn(memo, self[index], index, O);
+ }
+ return memo;
+ };
+};
+
+var arrayReduce = {
+ // `Array.prototype.reduce` method
+ // https://tc39.github.io/ecma262/#sec-array.prototype.reduce
+ left: createMethod$5(false),
+ // `Array.prototype.reduceRight` method
+ // https://tc39.github.io/ecma262/#sec-array.prototype.reduceright
+ right: createMethod$5(true)
+};
+
+var $reduce = arrayReduce.left;
+
+
+
+var STRICT_METHOD$5 = arrayMethodIsStrict('reduce');
+var USES_TO_LENGTH$9 = arrayMethodUsesToLength('reduce', { 1: 0 });
+
+// `Array.prototype.reduce` method
+// https://tc39.github.io/ecma262/#sec-array.prototype.reduce
+_export({ target: 'Array', proto: true, forced: !STRICT_METHOD$5 || !USES_TO_LENGTH$9 }, {
+ reduce: function reduce(callbackfn /* , initialValue */) {
+ return $reduce(this, callbackfn, arguments.length, arguments.length > 1 ? arguments[1] : undefined);
+ }
+});
+
+function cloneDeep(object) {
+ return JSON.parse(JSON.stringify(object));
+} // Get a nested value in an object
+
+function getDeep(object, path) {
+ return path.split('.').reduce(function (obj, key) {
+ return obj && obj[key];
+ }, object);
+} // Deep extend destination object with N more objects
+
+function extend() {
+ var target = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
+
+ for (var _len = arguments.length, sources = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
+ sources[_key - 1] = arguments[_key];
+ }
+
+ if (!sources.length) {
+ return target;
+ }
+
+ var source = sources.shift();
+
+ if (!is$1.object(source)) {
+ return target;
+ }
+
+ Object.keys(source).forEach(function (key) {
+ if (is$1.object(source[key])) {
+ if (!Object.keys(target).includes(key)) {
+ Object.assign(target, _defineProperty({}, key, {}));
+ }
+
+ extend(target[key], source[key]);
+ } else {
+ Object.assign(target, _defineProperty({}, key, source[key]));
+ }
+ });
+ return extend.apply(void 0, [target].concat(sources));
+}
+
+function wrap$1(elements, wrapper) {
+ // Convert `elements` to an array, if necessary.
+ var targets = elements.length ? elements : [elements]; // Loops backwards to prevent having to clone the wrapper on the
+ // first element (see `child` below).
+
+ Array.from(targets).reverse().forEach(function (element, index) {
+ var child = index > 0 ? wrapper.cloneNode(true) : wrapper; // Cache the current parent and sibling.
+
+ var parent = element.parentNode;
+ var sibling = element.nextSibling; // Wrap the element (is automatically removed from its current
+ // parent).
+
+ child.appendChild(element); // If the element had a sibling, insert the wrapper before
+ // the sibling to maintain the HTML structure; otherwise, just
+ // append it to the parent.
+
+ if (sibling) {
+ parent.insertBefore(child, sibling);
+ } else {
+ parent.appendChild(child);
+ }
+ });
+} // Set attributes
+
+function setAttributes(element, attributes) {
+ if (!is$1.element(element) || is$1.empty(attributes)) {
+ return;
+ } // Assume null and undefined attributes should be left out,
+ // Setting them would otherwise convert them to "null" and "undefined"
+
+
+ Object.entries(attributes).filter(function (_ref) {
+ var _ref2 = _slicedToArray(_ref, 2),
+ value = _ref2[1];
+
+ return !is$1.nullOrUndefined(value);
+ }).forEach(function (_ref3) {
+ var _ref4 = _slicedToArray(_ref3, 2),
+ key = _ref4[0],
+ value = _ref4[1];
+
+ return element.setAttribute(key, value);
+ });
+} // Create a DocumentFragment
+
+function createElement(type, attributes, text) {
+ // Create a new <element>
+ var element = document.createElement(type); // Set all passed attributes
+
+ if (is$1.object(attributes)) {
+ setAttributes(element, attributes);
+ } // Add text node
+
+
+ if (is$1.string(text)) {
+ element.innerText = text;
+ } // Return built element
+
+
+ return element;
+} // Inaert an element after another
+
+function insertAfter(element, target) {
+ if (!is$1.element(element) || !is$1.element(target)) {
+ return;
+ }
+
+ target.parentNode.insertBefore(element, target.nextSibling);
+} // Insert a DocumentFragment
+
+function insertElement(type, parent, attributes, text) {
+ if (!is$1.element(parent)) {
+ return;
+ }
+
+ parent.appendChild(createElement(type, attributes, text));
+} // Remove element(s)
+
+function removeElement(element) {
+ if (is$1.nodeList(element) || is$1.array(element)) {
+ Array.from(element).forEach(removeElement);
+ return;
+ }
+
+ if (!is$1.element(element) || !is$1.element(element.parentNode)) {
+ return;
+ }
+
+ element.parentNode.removeChild(element);
+} // Remove all child elements
+
+function emptyElement(element) {
+ if (!is$1.element(element)) {
+ return;
+ }
+
+ var length = element.childNodes.length;
+
+ while (length > 0) {
+ element.removeChild(element.lastChild);
+ length -= 1;
+ }
+} // Replace element
+
+function replaceElement(newChild, oldChild) {
+ if (!is$1.element(oldChild) || !is$1.element(oldChild.parentNode) || !is$1.element(newChild)) {
+ return null;
+ }
+
+ oldChild.parentNode.replaceChild(newChild, oldChild);
+ return newChild;
+} // Get an attribute object from a string selector
+
+function getAttributesFromSelector(sel, existingAttributes) {
+ // For example:
+ // '.test' to { class: 'test' }
+ // '#test' to { id: 'test' }
+ // '[data-test="test"]' to { 'data-test': 'test' }
+ if (!is$1.string(sel) || is$1.empty(sel)) {
+ return {};
+ }
+
+ var attributes = {};
+ var existing = extend({}, existingAttributes);
+ sel.split(',').forEach(function (s) {
+ // Remove whitespace
+ var selector = s.trim();
+ var className = selector.replace('.', '');
+ var stripped = selector.replace(/[[\]]/g, ''); // Get the parts and value
+
+ var parts = stripped.split('=');
+
+ var _parts = _slicedToArray(parts, 1),
+ key = _parts[0];
+
+ var value = parts.length > 1 ? parts[1].replace(/["']/g, '') : ''; // Get the first character
+
+ var start = selector.charAt(0);
+
+ switch (start) {
+ case '.':
+ // Add to existing classname
+ if (is$1.string(existing.class)) {
+ attributes.class = "".concat(existing.class, " ").concat(className);
+ } else {
+ attributes.class = className;
+ }
+
+ break;
+
+ case '#':
+ // ID selector
+ attributes.id = selector.replace('#', '');
+ break;
+
+ case '[':
+ // Attribute selector
+ attributes[key] = value;
+ break;
+ }
+ });
+ return extend(existing, attributes);
+} // Toggle hidden
+
+function toggleHidden(element, hidden) {
+ if (!is$1.element(element)) {
+ return;
+ }
+
+ var hide = hidden;
+
+ if (!is$1.boolean(hide)) {
+ hide = !element.hidden;
+ } // eslint-disable-next-line no-param-reassign
+
+
+ element.hidden = hide;
+} // Mirror Element.classList.toggle, with IE compatibility for "force" argument
+
+function toggleClass(element, className, force) {
+ if (is$1.nodeList(element)) {
+ return Array.from(element).map(function (e) {
+ return toggleClass(e, className, force);
+ });
+ }
+
+ if (is$1.element(element)) {
+ var method = 'toggle';
+
+ if (typeof force !== 'undefined') {
+ method = force ? 'add' : 'remove';
+ }
+
+ element.classList[method](className);
+ return element.classList.contains(className);
+ }
+
+ return false;
+} // Has class name
+
+function hasClass(element, className) {
+ return is$1.element(element) && element.classList.contains(className);
+} // Element matches selector
+
+function matches$1(element, selector) {
+ var _Element = Element,
+ prototype = _Element.prototype;
+
+ function match() {
+ return Array.from(document.querySelectorAll(selector)).includes(this);
+ }
+
+ var method = prototype.matches || prototype.webkitMatchesSelector || prototype.mozMatchesSelector || prototype.msMatchesSelector || match;
+ return method.call(element, selector);
+} // Closest ancestor element matching selector (also tests element itself)
+
+function closest(element, selector) {
+ var _Element2 = Element,
+ prototype = _Element2.prototype; // https://developer.mozilla.org/en-US/docs/Web/API/Element/closest#Polyfill
+
+ function closestElement() {
+ var el = this;
+
+ do {
+ if (matches$1.matches(el, selector)) return el;
+ el = el.parentElement || el.parentNode;
+ } while (el !== null && el.nodeType === 1);
+
+ return null;
+ }
+
+ var method = prototype.closest || closestElement;
+ return method.call(element, selector);
+} // Find all elements
+
+function getElements(selector) {
+ return this.elements.container.querySelectorAll(selector);
+} // Find a single element
+
+function getElement(selector) {
+ return this.elements.container.querySelector(selector);
+} // Set focus and tab focus class
+
+function setFocus() {
+ var element = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
+ var tabFocus = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
+
+ if (!is$1.element(element)) {
+ return;
+ } // Set regular focus
+
+
+ element.focus({
+ preventScroll: true
+ }); // If we want to mimic keyboard focus via tab
+
+ if (tabFocus) {
+ toggleClass(element, this.config.classNames.tabFocus);
+ }
+}
+
+var defaultCodecs = {
+ 'audio/ogg': 'vorbis',
+ 'audio/wav': '1',
+ 'video/webm': 'vp8, vorbis',
+ 'video/mp4': 'avc1.42E01E, mp4a.40.2',
+ 'video/ogg': 'theora'
+}; // Check for feature support
+
+var support = {
+ // Basic support
+ audio: 'canPlayType' in document.createElement('audio'),
+ video: 'canPlayType' in document.createElement('video'),
+ // Check for support
+ // Basic functionality vs full UI
+ check: function check(type, provider, playsinline) {
+ var canPlayInline = browser.isIPhone && playsinline && support.playsinline;
+ var api = support[type] || provider !== 'html5';
+ var ui = api && support.rangeInput && (type !== 'video' || !browser.isIPhone || canPlayInline);
+ return {
+ api: api,
+ ui: ui
+ };
+ },
+ // Picture-in-picture support
+ // Safari & Chrome only currently
+ pip: function () {
+ if (browser.isIPhone) {
+ return false;
+ } // Safari
+ // https://developer.apple.com/documentation/webkitjs/adding_picture_in_picture_to_your_safari_media_controls
+
+
+ if (is$1.function(createElement('video').webkitSetPresentationMode)) {
+ return true;
+ } // Chrome
+ // https://developers.google.com/web/updates/2018/10/watch-video-using-picture-in-picture
+
+
+ if (document.pictureInPictureEnabled && !createElement('video').disablePictureInPicture) {
+ return true;
+ }
+
+ return false;
+ }(),
+ // Airplay support
+ // Safari only currently
+ airplay: is$1.function(window.WebKitPlaybackTargetAvailabilityEvent),
+ // Inline playback support
+ // https://webkit.org/blog/6784/new-video-policies-for-ios/
+ playsinline: 'playsInline' in document.createElement('video'),
+ // Check for mime type support against a player instance
+ // Credits: http://diveintohtml5.info/everything.html
+ // Related: http://www.leanbackplayer.com/test/h5mt.html
+ mime: function mime(input) {
+ if (is$1.empty(input)) {
+ return false;
+ }
+
+ var _input$split = input.split('/'),
+ _input$split2 = _slicedToArray(_input$split, 1),
+ mediaType = _input$split2[0];
+
+ var type = input; // Verify we're using HTML5 and there's no media type mismatch
+
+ if (!this.isHTML5 || mediaType !== this.type) {
+ return false;
+ } // Add codec if required
+
+
+ if (Object.keys(defaultCodecs).includes(type)) {
+ type += "; codecs=\"".concat(defaultCodecs[input], "\"");
+ }
+
+ try {
+ return Boolean(type && this.media.canPlayType(type).replace(/no/, ''));
+ } catch (e) {
+ return false;
+ }
+ },
+ // Check for textTracks support
+ textTracks: 'textTracks' in document.createElement('video'),
+ // <input type="range"> Sliders
+ rangeInput: function () {
+ var range = document.createElement('input');
+ range.type = 'range';
+ return range.type === 'range';
+ }(),
+ // Touch
+ // NOTE: Remember a device can be mouse + touch enabled so we check on first touch event
+ touch: 'ontouchstart' in document.documentElement,
+ // Detect transitions support
+ transitions: transitionEndEvent !== false,
+ // Reduced motion iOS & MacOS setting
+ // https://webkit.org/blog/7551/responsive-design-for-motion/
+ reducedMotion: 'matchMedia' in window && window.matchMedia('(prefers-reduced-motion)').matches
+};
+
+// https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md
+// https://www.youtube.com/watch?v=NPM6172J22g
+
+var supportsPassiveListeners = function () {
+ // Test via a getter in the options object to see if the passive property is accessed
+ var supported = false;
+
+ try {
+ var options = Object.defineProperty({}, 'passive', {
+ get: function get() {
+ supported = true;
+ return null;
+ }
+ });
+ window.addEventListener('test', null, options);
+ window.removeEventListener('test', null, options);
+ } catch (e) {// Do nothing
+ }
+
+ return supported;
+}(); // Toggle event listener
+
+
+function toggleListener(element, event, callback) {
+ var _this = this;
+
+ var toggle = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
+ var passive = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
+ var capture = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
+
+ // Bail if no element, event, or callback
+ if (!element || !('addEventListener' in element) || is$1.empty(event) || !is$1.function(callback)) {
+ return;
+ } // Allow multiple events
+
+
+ var events = event.split(' '); // Build options
+ // Default to just the capture boolean for browsers with no passive listener support
+
+ var options = capture; // If passive events listeners are supported
+
+ if (supportsPassiveListeners) {
+ options = {
+ // Whether the listener can be passive (i.e. default never prevented)
+ passive: passive,
+ // Whether the listener is a capturing listener or not
+ capture: capture
+ };
+ } // If a single node is passed, bind the event listener
+
+
+ events.forEach(function (type) {
+ if (_this && _this.eventListeners && toggle) {
+ // Cache event listener
+ _this.eventListeners.push({
+ element: element,
+ type: type,
+ callback: callback,
+ options: options
+ });
+ }
+
+ element[toggle ? 'addEventListener' : 'removeEventListener'](type, callback, options);
+ });
+} // Bind event handler
+
+function on(element) {
+ var events = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
+ var callback = arguments.length > 2 ? arguments[2] : undefined;
+ var passive = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
+ var capture = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
+ toggleListener.call(this, element, events, callback, true, passive, capture);
+} // Unbind event handler
+
+function off(element) {
+ var events = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
+ var callback = arguments.length > 2 ? arguments[2] : undefined;
+ var passive = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
+ var capture = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
+ toggleListener.call(this, element, events, callback, false, passive, capture);
+} // Bind once-only event handler
+
+function once(element) {
+ var _this2 = this;
+
+ var events = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
+ var callback = arguments.length > 2 ? arguments[2] : undefined;
+ var passive = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
+ var capture = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
+
+ var onceCallback = function onceCallback() {
+ off(element, events, onceCallback, passive, capture);
+
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
+ args[_key] = arguments[_key];
+ }
+
+ callback.apply(_this2, args);
+ };
+
+ toggleListener.call(this, element, events, onceCallback, true, passive, capture);
+} // Trigger event
+
+function triggerEvent(element) {
+ var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
+ var bubbles = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
+ var detail = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
+
+ // Bail if no element
+ if (!is$1.element(element) || is$1.empty(type)) {
+ return;
+ } // Create and dispatch the event
+
+
+ var event = new CustomEvent(type, {
+ bubbles: bubbles,
+ detail: _objectSpread2(_objectSpread2({}, detail), {}, {
+ plyr: this
+ })
+ }); // Dispatch the event
+
+ element.dispatchEvent(event);
+} // Unbind all cached event listeners
+
+function unbindListeners() {
+ if (this && this.eventListeners) {
+ this.eventListeners.forEach(function (item) {
+ var element = item.element,
+ type = item.type,
+ callback = item.callback,
+ options = item.options;
+ element.removeEventListener(type, callback, options);
+ });
+ this.eventListeners = [];
+ }
+} // Run method when / if player is ready
+
+function ready() {
+ var _this3 = this;
+
+ return new Promise(function (resolve) {
+ return _this3.ready ? setTimeout(resolve, 0) : on.call(_this3, _this3.elements.container, 'ready', resolve);
+ }).then(function () {});
+}
+
+/**
+ * Silence a Promise-like object.
+ * This is useful for avoiding non-harmful, but potentially confusing "uncaught
+ * play promise" rejection error messages.
+ * @param {Object} value An object that may or may not be `Promise`-like.
+ */
+
+function silencePromise(value) {
+ if (is$1.promise(value)) {
+ value.then(null, function () {});
+ }
+}
+
+function validateRatio(input) {
+ if (!is$1.array(input) && (!is$1.string(input) || !input.includes(':'))) {
+ return false;
+ }
+
+ var ratio = is$1.array(input) ? input : input.split(':');
+ return ratio.map(Number).every(is$1.number);
+}
+function reduceAspectRatio(ratio) {
+ if (!is$1.array(ratio) || !ratio.every(is$1.number)) {
+ return null;
+ }
+
+ var _ratio = _slicedToArray(ratio, 2),
+ width = _ratio[0],
+ height = _ratio[1];
+
+ var getDivider = function getDivider(w, h) {
+ return h === 0 ? w : getDivider(h, w % h);
+ };
+
+ var divider = getDivider(width, height);
+ return [width / divider, height / divider];
+}
+function getAspectRatio(input) {
+ var parse = function parse(ratio) {
+ return validateRatio(ratio) ? ratio.split(':').map(Number) : null;
+ }; // Try provided ratio
+
+
+ var ratio = parse(input); // Get from config
+
+ if (ratio === null) {
+ ratio = parse(this.config.ratio);
+ } // Get from embed
+
+
+ if (ratio === null && !is$1.empty(this.embed) && is$1.array(this.embed.ratio)) {
+ ratio = this.embed.ratio;
+ } // Get from HTML5 video
+
+
+ if (ratio === null && this.isHTML5) {
+ var _this$media = this.media,
+ videoWidth = _this$media.videoWidth,
+ videoHeight = _this$media.videoHeight;
+ ratio = reduceAspectRatio([videoWidth, videoHeight]);
+ }
+
+ return ratio;
+} // Set aspect ratio for responsive container
+
+function setAspectRatio(input) {
+ if (!this.isVideo) {
+ return {};
+ }
+
+ var wrapper = this.elements.wrapper;
+ var ratio = getAspectRatio.call(this, input);
+
+ var _ref = is$1.array(ratio) ? ratio : [0, 0],
+ _ref2 = _slicedToArray(_ref, 2),
+ w = _ref2[0],
+ h = _ref2[1];
+
+ var padding = 100 / w * h;
+ wrapper.style.paddingBottom = "".concat(padding, "%"); // For Vimeo we have an extra <div> to hide the standard controls and UI
+
+ if (this.isVimeo && !this.config.vimeo.premium && this.supported.ui) {
+ var height = 100 / this.media.offsetWidth * parseInt(window.getComputedStyle(this.media).paddingBottom, 10);
+ var offset = (height - padding) / (height / 50);
+ this.media.style.transform = "translateY(-".concat(offset, "%)");
+ } else if (this.isHTML5) {
+ wrapper.classList.toggle(this.config.classNames.videoFixedRatio, ratio !== null);
+ }
+
+ return {
+ padding: padding,
+ ratio: ratio
+ };
+}
+
+var html5 = {
+ getSources: function getSources() {
+ var _this = this;
+
+ if (!this.isHTML5) {
+ return [];
+ }
+
+ var sources = Array.from(this.media.querySelectorAll('source')); // Filter out unsupported sources (if type is specified)
+
+ return sources.filter(function (source) {
+ var type = source.getAttribute('type');
+
+ if (is$1.empty(type)) {
+ return true;
+ }
+
+ return support.mime.call(_this, type);
+ });
+ },
+ // Get quality levels
+ getQualityOptions: function getQualityOptions() {
+ // Whether we're forcing all options (e.g. for streaming)
+ if (this.config.quality.forced) {
+ return this.config.quality.options;
+ } // Get sizes from <source> elements
+
+
+ return html5.getSources.call(this).map(function (source) {
+ return Number(source.getAttribute('data-res'));
+ }).filter(Boolean);
+ },
+ setup: function setup() {
+ if (!this.isHTML5) {
+ return;
+ }
+
+ var player = this; // Set speed options from config
+
+ player.options.speed = player.config.speed.options; // Set aspect ratio if fixed
+
+ if (!is$1.empty(this.config.ratio)) {
+ setAspectRatio.call(player);
+ } // Quality
+
+
+ Object.defineProperty(player.media, 'quality', {
+ get: function get() {
+ // Get sources
+ var sources = html5.getSources.call(player);
+ var source = sources.find(function (s) {
+ return s.getAttribute('src') === player.source;
+ }); // Return size, if match is found
+
+ return source && Number(source.getAttribute('data-res'));
+ },
+ set: function set(input) {
+ if (player.quality === input) {
+ return;
+ } // If we're using an an external handler...
+
+
+ if (player.config.quality.forced && is$1.function(player.config.quality.onChange)) {
+ player.config.quality.onChange(input);
+ } else {
+ // Get sources
+ var sources = html5.getSources.call(player); // Get first match for requested size
+
+ var source = sources.find(function (s) {
+ return Number(s.getAttribute('data-res')) === input;
+ }); // No matching source found
+
+ if (!source) {
+ return;
+ } // Get current state
+
+
+ var _player$media = player.media,
+ currentTime = _player$media.currentTime,
+ paused = _player$media.paused,
+ preload = _player$media.preload,
+ readyState = _player$media.readyState,
+ playbackRate = _player$media.playbackRate; // Set new source
+
+ player.media.src = source.getAttribute('src'); // Prevent loading if preload="none" and the current source isn't loaded (#1044)
+
+ if (preload !== 'none' || readyState) {
+ // Restore time
+ player.once('loadedmetadata', function () {
+ player.speed = playbackRate;
+ player.currentTime = currentTime; // Resume playing
+
+ if (!paused) {
+ silencePromise(player.play());
+ }
+ }); // Load new source
+
+ player.media.load();
+ }
+ } // Trigger change event
+
+
+ triggerEvent.call(player, player.media, 'qualitychange', false, {
+ quality: input
+ });
+ }
+ });
+ },
+ // Cancel current network requests
+ // See https://github.com/sampotts/plyr/issues/174
+ cancelRequests: function cancelRequests() {
+ if (!this.isHTML5) {
+ return;
+ } // Remove child sources
+
+
+ removeElement(html5.getSources.call(this)); // Set blank video src attribute
+ // This is to prevent a MEDIA_ERR_SRC_NOT_SUPPORTED error
+ // Info: http://stackoverflow.com/questions/32231579/how-to-properly-dispose-of-an-html5-video-and-close-socket-or-connection
+
+ this.media.setAttribute('src', this.config.blankVideo); // Load the new empty source
+ // This will cancel existing requests
+ // See https://github.com/sampotts/plyr/issues/174
+
+ this.media.load(); // Debugging
+
+ this.debug.log('Cancelled network requests');
+ }
+};
+
+function dedupe(array) {
+ if (!is$1.array(array)) {
+ return array;
+ }
+
+ return array.filter(function (item, index) {
+ return array.indexOf(item) === index;
+ });
+} // Get the closest value in an array
+
+function closest$1(array, value) {
+ if (!is$1.array(array) || !array.length) {
+ return null;
+ }
+
+ return array.reduce(function (prev, curr) {
+ return Math.abs(curr - value) < Math.abs(prev - value) ? curr : prev;
+ });
+}
+
+var defineProperty$6 = objectDefineProperty.f;
+var getOwnPropertyNames$1 = objectGetOwnPropertyNames.f;
+
+
+
+
+
+var setInternalState$7 = internalState.set;
+
+
+
+var MATCH$2 = wellKnownSymbol('match');
+var NativeRegExp = global_1.RegExp;
+var RegExpPrototype$1 = NativeRegExp.prototype;
+var re1 = /a/g;
+var re2 = /a/g;
+
+// "new" should create a new object, old webkit bug
+var CORRECT_NEW = new NativeRegExp(re1) !== re1;
+
+var UNSUPPORTED_Y$2 = regexpStickyHelpers.UNSUPPORTED_Y;
+
+var FORCED$4 = descriptors && isForced_1('RegExp', (!CORRECT_NEW || UNSUPPORTED_Y$2 || fails(function () {
+ re2[MATCH$2] = false;
+ // RegExp constructor can alter flags and IsRegExp works correct with @@match
+ return NativeRegExp(re1) != re1 || NativeRegExp(re2) == re2 || NativeRegExp(re1, 'i') != '/a/i';
+})));
+
+// `RegExp` constructor
+// https://tc39.github.io/ecma262/#sec-regexp-constructor
+if (FORCED$4) {
+ var RegExpWrapper = function RegExp(pattern, flags) {
+ var thisIsRegExp = this instanceof RegExpWrapper;
+ var patternIsRegExp = isRegexp(pattern);
+ var flagsAreUndefined = flags === undefined;
+ var sticky;
+
+ if (!thisIsRegExp && patternIsRegExp && pattern.constructor === RegExpWrapper && flagsAreUndefined) {
+ return pattern;
+ }
+
+ if (CORRECT_NEW) {
+ if (patternIsRegExp && !flagsAreUndefined) pattern = pattern.source;
+ } else if (pattern instanceof RegExpWrapper) {
+ if (flagsAreUndefined) flags = regexpFlags.call(pattern);
+ pattern = pattern.source;
+ }
+
+ if (UNSUPPORTED_Y$2) {
+ sticky = !!flags && flags.indexOf('y') > -1;
+ if (sticky) flags = flags.replace(/y/g, '');
+ }
+
+ var result = inheritIfRequired(
+ CORRECT_NEW ? new NativeRegExp(pattern, flags) : NativeRegExp(pattern, flags),
+ thisIsRegExp ? this : RegExpPrototype$1,
+ RegExpWrapper
+ );
+
+ if (UNSUPPORTED_Y$2 && sticky) setInternalState$7(result, { sticky: sticky });
+
+ return result;
+ };
+ var proxy = function (key) {
+ key in RegExpWrapper || defineProperty$6(RegExpWrapper, key, {
+ configurable: true,
+ get: function () { return NativeRegExp[key]; },
+ set: function (it) { NativeRegExp[key] = it; }
+ });
+ };
+ var keys$2 = getOwnPropertyNames$1(NativeRegExp);
+ var index = 0;
+ while (keys$2.length > index) proxy(keys$2[index++]);
+ RegExpPrototype$1.constructor = RegExpWrapper;
+ RegExpWrapper.prototype = RegExpPrototype$1;
+ redefine(global_1, 'RegExp', RegExpWrapper);
+}
+
+// https://tc39.github.io/ecma262/#sec-get-regexp-@@species
+setSpecies('RegExp');
+
+function generateId(prefix) {
+ return "".concat(prefix, "-").concat(Math.floor(Math.random() * 10000));
+} // Format string
+
+function format(input) {
+ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
+ args[_key - 1] = arguments[_key];
+ }
+
+ if (is$1.empty(input)) {
+ return input;
+ }
+
+ return input.toString().replace(/{(\d+)}/g, function (match, i) {
+ return args[i].toString();
+ });
+} // Get percentage
+
+function getPercentage(current, max) {
+ if (current === 0 || max === 0 || Number.isNaN(current) || Number.isNaN(max)) {
+ return 0;
+ }
+
+ return (current / max * 100).toFixed(2);
+} // Replace all occurances of a string in a string
+
+var replaceAll = function replaceAll() {
+ var input = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
+ var find = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
+ var replace = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
+ return input.replace(new RegExp(find.toString().replace(/([.*+?^=!:${}()|[\]/\\])/g, '\\$1'), 'g'), replace.toString());
+}; // Convert to title case
+
+var toTitleCase = function toTitleCase() {
+ var input = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
+ return input.toString().replace(/\w\S*/g, function (text) {
+ return text.charAt(0).toUpperCase() + text.substr(1).toLowerCase();
+ });
+}; // Convert string to pascalCase
+
+function toPascalCase() {
+ var input = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
+ var string = input.toString(); // Convert kebab case
+
+ string = replaceAll(string, '-', ' '); // Convert snake case
+
+ string = replaceAll(string, '_', ' '); // Convert to title case
+
+ string = toTitleCase(string); // Convert to pascal case
+
+ return replaceAll(string, ' ', '');
+} // Convert string to pascalCase
+
+function toCamelCase() {
+ var input = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
+ var string = input.toString(); // Convert to pascal case
+
+ string = toPascalCase(string); // Convert first character to lowercase
+
+ return string.charAt(0).toLowerCase() + string.slice(1);
+} // Remove HTML from a string
+
+function stripHTML(source) {
+ var fragment = document.createDocumentFragment();
+ var element = document.createElement('div');
+ fragment.appendChild(element);
+ element.innerHTML = source;
+ return fragment.firstChild.innerText;
+} // Like outerHTML, but also works for DocumentFragment
+
+function getHTML(element) {
+ var wrapper = document.createElement('div');
+ wrapper.appendChild(element);
+ return wrapper.innerHTML;
+}
+
+var resources = {
+ pip: 'PIP',
+ airplay: 'AirPlay',
+ html5: 'HTML5',
+ vimeo: 'Vimeo',
+ youtube: 'YouTube'
+};
+var i18n = {
+ get: function get() {
+ var key = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
+ var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
+
+ if (is$1.empty(key) || is$1.empty(config)) {
+ return '';
+ }
+
+ var string = getDeep(config.i18n, key);
+
+ if (is$1.empty(string)) {
+ if (Object.keys(resources).includes(key)) {
+ return resources[key];
+ }
+
+ return '';
+ }
+
+ var replace = {
+ '{seektime}': config.seekTime,
+ '{title}': config.title
+ };
+ Object.entries(replace).forEach(function (_ref) {
+ var _ref2 = _slicedToArray(_ref, 2),
+ k = _ref2[0],
+ v = _ref2[1];
+
+ string = replaceAll(string, k, v);
+ });
+ return string;
+ }
+};
+
+var Storage = /*#__PURE__*/function () {
+ function Storage(player) {
+ _classCallCheck(this, Storage);
+
+ this.enabled = player.config.storage.enabled;
+ this.key = player.config.storage.key;
+ } // Check for actual support (see if we can use it)
+
+
+ _createClass(Storage, [{
+ key: "get",
+ value: function get(key) {
+ if (!Storage.supported || !this.enabled) {
+ return null;
+ }
+
+ var store = window.localStorage.getItem(this.key);
+
+ if (is$1.empty(store)) {
+ return null;
+ }
+
+ var json = JSON.parse(store);
+ return is$1.string(key) && key.length ? json[key] : json;
+ }
+ }, {
+ key: "set",
+ value: function set(object) {
+ // Bail if we don't have localStorage support or it's disabled
+ if (!Storage.supported || !this.enabled) {
+ return;
+ } // Can only store objectst
+
+
+ if (!is$1.object(object)) {
+ return;
+ } // Get current storage
+
+
+ var storage = this.get(); // Default to empty object
+
+ if (is$1.empty(storage)) {
+ storage = {};
+ } // Update the working copy of the values
+
+
+ extend(storage, object); // Update storage
+
+ window.localStorage.setItem(this.key, JSON.stringify(storage));
+ }
+ }], [{
+ key: "supported",
+ get: function get() {
+ try {
+ if (!('localStorage' in window)) {
+ return false;
+ }
+
+ var test = '___test'; // Try to use it (it might be disabled, e.g. user is in private mode)
+ // see: https://github.com/sampotts/plyr/issues/131
+
+ window.localStorage.setItem(test, test);
+ window.localStorage.removeItem(test);
+ return true;
+ } catch (e) {
+ return false;
+ }
+ }
+ }]);
+
+ return Storage;
+}();
+
+// ==========================================================================
+// Fetch wrapper
+// Using XHR to avoid issues with older browsers
+// ==========================================================================
+function fetch(url) {
+ var responseType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'text';
+ return new Promise(function (resolve, reject) {
+ try {
+ var request = new XMLHttpRequest(); // Check for CORS support
+
+ if (!('withCredentials' in request)) {
+ return;
+ }
+
+ request.addEventListener('load', function () {
+ if (responseType === 'text') {
+ try {
+ resolve(JSON.parse(request.responseText));
+ } catch (e) {
+ resolve(request.responseText);
+ }
+ } else {
+ resolve(request.response);
+ }
+ });
+ request.addEventListener('error', function () {
+ throw new Error(request.status);
+ });
+ request.open('GET', url, true); // Set the required response type
+
+ request.responseType = responseType;
+ request.send();
+ } catch (e) {
+ reject(e);
+ }
+ });
+}
+
+// ==========================================================================
+
+function loadSprite(url, id) {
+ if (!is$1.string(url)) {
+ return;
+ }
+
+ var prefix = 'cache';
+ var hasId = is$1.string(id);
+ var isCached = false;
+
+ var exists = function exists() {
+ return document.getElementById(id) !== null;
+ };
+
+ var update = function update(container, data) {
+ // eslint-disable-next-line no-param-reassign
+ container.innerHTML = data; // Check again incase of race condition
+
+ if (hasId && exists()) {
+ return;
+ } // Inject the SVG to the body
+
+
+ document.body.insertAdjacentElement('afterbegin', container);
+ }; // Only load once if ID set
+
+
+ if (!hasId || !exists()) {
+ var useStorage = Storage.supported; // Create container
+
+ var container = document.createElement('div');
+ container.setAttribute('hidden', '');
+
+ if (hasId) {
+ container.setAttribute('id', id);
+ } // Check in cache
+
+
+ if (useStorage) {
+ var cached = window.localStorage.getItem("".concat(prefix, "-").concat(id));
+ isCached = cached !== null;
+
+ if (isCached) {
+ var data = JSON.parse(cached);
+ update(container, data.content);
+ }
+ } // Get the sprite
+
+
+ fetch(url).then(function (result) {
+ if (is$1.empty(result)) {
+ return;
+ }
+
+ if (useStorage) {
+ window.localStorage.setItem("".concat(prefix, "-").concat(id), JSON.stringify({
+ content: result
+ }));
+ }
+
+ update(container, result);
+ }).catch(function () {});
+ }
+}
+
+var ceil$1 = Math.ceil;
+var floor$5 = Math.floor;
+
+// `Math.trunc` method
+// https://tc39.github.io/ecma262/#sec-math.trunc
+_export({ target: 'Math', stat: true }, {
+ trunc: function trunc(it) {
+ return (it > 0 ? floor$5 : ceil$1)(it);
+ }
+});
+
+var getHours = function getHours(value) {
+ return Math.trunc(value / 60 / 60 % 60, 10);
+};
+var getMinutes = function getMinutes(value) {
+ return Math.trunc(value / 60 % 60, 10);
+};
+var getSeconds = function getSeconds(value) {
+ return Math.trunc(value % 60, 10);
+}; // Format time to UI friendly string
+
+function formatTime() {
+ var time = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
+ var displayHours = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
+ var inverted = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
+
+ // Bail if the value isn't a number
+ if (!is$1.number(time)) {
+ return formatTime(undefined, displayHours, inverted);
+ } // Format time component to add leading zero
+
+
+ var format = function format(value) {
+ return "0".concat(value).slice(-2);
+ }; // Breakdown to hours, mins, secs
+
+
+ var hours = getHours(time);
+ var mins = getMinutes(time);
+ var secs = getSeconds(time); // Do we need to display hours?
+
+ if (displayHours || hours > 0) {
+ hours = "".concat(hours, ":");
+ } else {
+ hours = '';
+ } // Render
+
+
+ return "".concat(inverted && time > 0 ? '-' : '').concat(hours).concat(format(mins), ":").concat(format(secs));
+}
+
+var controls = {
+ // Get icon URL
+ getIconUrl: function getIconUrl() {
+ var url = new URL(this.config.iconUrl, window.location);
+ var cors = url.host !== window.location.host || browser.isIE && !window.svg4everybody;
+ return {
+ url: this.config.iconUrl,
+ cors: cors
+ };
+ },
+ // Find the UI controls
+ findElements: function findElements() {
+ try {
+ this.elements.controls = getElement.call(this, this.config.selectors.controls.wrapper); // Buttons
+
+ this.elements.buttons = {
+ play: getElements.call(this, this.config.selectors.buttons.play),
+ pause: getElement.call(this, this.config.selectors.buttons.pause),
+ restart: getElement.call(this, this.config.selectors.buttons.restart),
+ rewind: getElement.call(this, this.config.selectors.buttons.rewind),
+ fastForward: getElement.call(this, this.config.selectors.buttons.fastForward),
+ mute: getElement.call(this, this.config.selectors.buttons.mute),
+ pip: getElement.call(this, this.config.selectors.buttons.pip),
+ airplay: getElement.call(this, this.config.selectors.buttons.airplay),
+ settings: getElement.call(this, this.config.selectors.buttons.settings),
+ captions: getElement.call(this, this.config.selectors.buttons.captions),
+ fullscreen: getElement.call(this, this.config.selectors.buttons.fullscreen)
+ }; // Progress
+
+ this.elements.progress = getElement.call(this, this.config.selectors.progress); // Inputs
+
+ this.elements.inputs = {
+ seek: getElement.call(this, this.config.selectors.inputs.seek),
+ volume: getElement.call(this, this.config.selectors.inputs.volume)
+ }; // Display
+
+ this.elements.display = {
+ buffer: getElement.call(this, this.config.selectors.display.buffer),
+ currentTime: getElement.call(this, this.config.selectors.display.currentTime),
+ duration: getElement.call(this, this.config.selectors.display.duration)
+ }; // Seek tooltip
+
+ if (is$1.element(this.elements.progress)) {
+ this.elements.display.seekTooltip = this.elements.progress.querySelector(".".concat(this.config.classNames.tooltip));
+ }
+
+ return true;
+ } catch (error) {
+ // Log it
+ this.debug.warn('It looks like there is a problem with your custom controls HTML', error); // Restore native video controls
+
+ this.toggleNativeControls(true);
+ return false;
+ }
+ },
+ // Create <svg> icon
+ createIcon: function createIcon(type, attributes) {
+ var namespace = 'http://www.w3.org/2000/svg';
+ var iconUrl = controls.getIconUrl.call(this);
+ var iconPath = "".concat(!iconUrl.cors ? iconUrl.url : '', "#").concat(this.config.iconPrefix); // Create <svg>
+
+ var icon = document.createElementNS(namespace, 'svg');
+ setAttributes(icon, extend(attributes, {
+ 'aria-hidden': 'true',
+ focusable: 'false'
+ })); // Create the <use> to reference sprite
+
+ var use = document.createElementNS(namespace, 'use');
+ var path = "".concat(iconPath, "-").concat(type); // Set `href` attributes
+ // https://github.com/sampotts/plyr/issues/460
+ // https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/xlink:href
+
+ if ('href' in use) {
+ use.setAttributeNS('http://www.w3.org/1999/xlink', 'href', path);
+ } // Always set the older attribute even though it's "deprecated" (it'll be around for ages)
+
+
+ use.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', path); // Add <use> to <svg>
+
+ icon.appendChild(use);
+ return icon;
+ },
+ // Create hidden text label
+ createLabel: function createLabel(key) {
+ var attr = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
+ var text = i18n.get(key, this.config);
+
+ var attributes = _objectSpread2(_objectSpread2({}, attr), {}, {
+ class: [attr.class, this.config.classNames.hidden].filter(Boolean).join(' ')
+ });
+
+ return createElement('span', attributes, text);
+ },
+ // Create a badge
+ createBadge: function createBadge(text) {
+ if (is$1.empty(text)) {
+ return null;
+ }
+
+ var badge = createElement('span', {
+ class: this.config.classNames.menu.value
+ });
+ badge.appendChild(createElement('span', {
+ class: this.config.classNames.menu.badge
+ }, text));
+ return badge;
+ },
+ // Create a <button>
+ createButton: function createButton(buttonType, attr) {
+ var _this = this;
+
+ var attributes = extend({}, attr);
+ var type = toCamelCase(buttonType);
+ var props = {
+ element: 'button',
+ toggle: false,
+ label: null,
+ icon: null,
+ labelPressed: null,
+ iconPressed: null
+ };
+ ['element', 'icon', 'label'].forEach(function (key) {
+ if (Object.keys(attributes).includes(key)) {
+ props[key] = attributes[key];
+ delete attributes[key];
+ }
+ }); // Default to 'button' type to prevent form submission
+
+ if (props.element === 'button' && !Object.keys(attributes).includes('type')) {
+ attributes.type = 'button';
+ } // Set class name
+
+
+ if (Object.keys(attributes).includes('class')) {
+ if (!attributes.class.split(' ').some(function (c) {
+ return c === _this.config.classNames.control;
+ })) {
+ extend(attributes, {
+ class: "".concat(attributes.class, " ").concat(this.config.classNames.control)
+ });
+ }
+ } else {
+ attributes.class = this.config.classNames.control;
+ } // Large play button
+
+
+ switch (buttonType) {
+ case 'play':
+ props.toggle = true;
+ props.label = 'play';
+ props.labelPressed = 'pause';
+ props.icon = 'play';
+ props.iconPressed = 'pause';
+ break;
+
+ case 'mute':
+ props.toggle = true;
+ props.label = 'mute';
+ props.labelPressed = 'unmute';
+ props.icon = 'volume';
+ props.iconPressed = 'muted';
+ break;
+
+ case 'captions':
+ props.toggle = true;
+ props.label = 'enableCaptions';
+ props.labelPressed = 'disableCaptions';
+ props.icon = 'captions-off';
+ props.iconPressed = 'captions-on';
+ break;
+
+ case 'fullscreen':
+ props.toggle = true;
+ props.label = 'enterFullscreen';
+ props.labelPressed = 'exitFullscreen';
+ props.icon = 'enter-fullscreen';
+ props.iconPressed = 'exit-fullscreen';
+ break;
+
+ case 'play-large':
+ attributes.class += " ".concat(this.config.classNames.control, "--overlaid");
+ type = 'play';
+ props.label = 'play';
+ props.icon = 'play';
+ break;
+
+ default:
+ if (is$1.empty(props.label)) {
+ props.label = type;
+ }
+
+ if (is$1.empty(props.icon)) {
+ props.icon = buttonType;
+ }
+
+ }
+
+ var button = createElement(props.element); // Setup toggle icon and labels
+
+ if (props.toggle) {
+ // Icon
+ button.appendChild(controls.createIcon.call(this, props.iconPressed, {
+ class: 'icon--pressed'
+ }));
+ button.appendChild(controls.createIcon.call(this, props.icon, {
+ class: 'icon--not-pressed'
+ })); // Label/Tooltip
+
+ button.appendChild(controls.createLabel.call(this, props.labelPressed, {
+ class: 'label--pressed'
+ }));
+ button.appendChild(controls.createLabel.call(this, props.label, {
+ class: 'label--not-pressed'
+ }));
+ } else {
+ button.appendChild(controls.createIcon.call(this, props.icon));
+ button.appendChild(controls.createLabel.call(this, props.label));
+ } // Merge and set attributes
+
+
+ extend(attributes, getAttributesFromSelector(this.config.selectors.buttons[type], attributes));
+ setAttributes(button, attributes); // We have multiple play buttons
+
+ if (type === 'play') {
+ if (!is$1.array(this.elements.buttons[type])) {
+ this.elements.buttons[type] = [];
+ }
+
+ this.elements.buttons[type].push(button);
+ } else {
+ this.elements.buttons[type] = button;
+ }
+
+ return button;
+ },
+ // Create an <input type='range'>
+ createRange: function createRange(type, attributes) {
+ // Seek input
+ var input = createElement('input', extend(getAttributesFromSelector(this.config.selectors.inputs[type]), {
+ type: 'range',
+ min: 0,
+ max: 100,
+ step: 0.01,
+ value: 0,
+ autocomplete: 'off',
+ // A11y fixes for https://github.com/sampotts/plyr/issues/905
+ role: 'slider',
+ 'aria-label': i18n.get(type, this.config),
+ 'aria-valuemin': 0,
+ 'aria-valuemax': 100,
+ 'aria-valuenow': 0
+ }, attributes));
+ this.elements.inputs[type] = input; // Set the fill for webkit now
+
+ controls.updateRangeFill.call(this, input); // Improve support on touch devices
+
+ RangeTouch.setup(input);
+ return input;
+ },
+ // Create a <progress>
+ createProgress: function createProgress(type, attributes) {
+ var progress = createElement('progress', extend(getAttributesFromSelector(this.config.selectors.display[type]), {
+ min: 0,
+ max: 100,
+ value: 0,
+ role: 'progressbar',
+ 'aria-hidden': true
+ }, attributes)); // Create the label inside
+
+ if (type !== 'volume') {
+ progress.appendChild(createElement('span', null, '0'));
+ var suffixKey = {
+ played: 'played',
+ buffer: 'buffered'
+ }[type];
+ var suffix = suffixKey ? i18n.get(suffixKey, this.config) : '';
+ progress.innerText = "% ".concat(suffix.toLowerCase());
+ }
+
+ this.elements.display[type] = progress;
+ return progress;
+ },
+ // Create time display
+ createTime: function createTime(type, attrs) {
+ var attributes = getAttributesFromSelector(this.config.selectors.display[type], attrs);
+ var container = createElement('div', extend(attributes, {
+ class: "".concat(attributes.class ? attributes.class : '', " ").concat(this.config.classNames.display.time, " ").trim(),
+ 'aria-label': i18n.get(type, this.config)
+ }), '00:00'); // Reference for updates
+
+ this.elements.display[type] = container;
+ return container;
+ },
+ // Bind keyboard shortcuts for a menu item
+ // We have to bind to keyup otherwise Firefox triggers a click when a keydown event handler shifts focus
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=1220143
+ bindMenuItemShortcuts: function bindMenuItemShortcuts(menuItem, type) {
+ var _this2 = this;
+
+ // Navigate through menus via arrow keys and space
+ on.call(this, menuItem, 'keydown keyup', function (event) {
+ // We only care about space and ⬆️ ⬇️️ ➡️
+ if (![32, 38, 39, 40].includes(event.which)) {
+ return;
+ } // Prevent play / seek
+
+
+ event.preventDefault();
+ event.stopPropagation(); // We're just here to prevent the keydown bubbling
+
+ if (event.type === 'keydown') {
+ return;
+ }
+
+ var isRadioButton = matches$1(menuItem, '[role="menuitemradio"]'); // Show the respective menu
+
+ if (!isRadioButton && [32, 39].includes(event.which)) {
+ controls.showMenuPanel.call(_this2, type, true);
+ } else {
+ var target;
+
+ if (event.which !== 32) {
+ if (event.which === 40 || isRadioButton && event.which === 39) {
+ target = menuItem.nextElementSibling;
+
+ if (!is$1.element(target)) {
+ target = menuItem.parentNode.firstElementChild;
+ }
+ } else {
+ target = menuItem.previousElementSibling;
+
+ if (!is$1.element(target)) {
+ target = menuItem.parentNode.lastElementChild;
+ }
+ }
+
+ setFocus.call(_this2, target, true);
+ }
+ }
+ }, false); // Enter will fire a `click` event but we still need to manage focus
+ // So we bind to keyup which fires after and set focus here
+
+ on.call(this, menuItem, 'keyup', function (event) {
+ if (event.which !== 13) {
+ return;
+ }
+
+ controls.focusFirstMenuItem.call(_this2, null, true);
+ });
+ },
+ // Create a settings menu item
+ createMenuItem: function createMenuItem(_ref) {
+ var _this3 = this;
+
+ var value = _ref.value,
+ list = _ref.list,
+ type = _ref.type,
+ title = _ref.title,
+ _ref$badge = _ref.badge,
+ badge = _ref$badge === void 0 ? null : _ref$badge,
+ _ref$checked = _ref.checked,
+ checked = _ref$checked === void 0 ? false : _ref$checked;
+ var attributes = getAttributesFromSelector(this.config.selectors.inputs[type]);
+ var menuItem = createElement('button', extend(attributes, {
+ type: 'button',
+ role: 'menuitemradio',
+ class: "".concat(this.config.classNames.control, " ").concat(attributes.class ? attributes.class : '').trim(),
+ 'aria-checked': checked,
+ value: value
+ }));
+ var flex = createElement('span'); // We have to set as HTML incase of special characters
+
+ flex.innerHTML = title;
+
+ if (is$1.element(badge)) {
+ flex.appendChild(badge);
+ }
+
+ menuItem.appendChild(flex); // Replicate radio button behaviour
+
+ Object.defineProperty(menuItem, 'checked', {
+ enumerable: true,
+ get: function get() {
+ return menuItem.getAttribute('aria-checked') === 'true';
+ },
+ set: function set(check) {
+ // Ensure exclusivity
+ if (check) {
+ Array.from(menuItem.parentNode.children).filter(function (node) {
+ return matches$1(node, '[role="menuitemradio"]');
+ }).forEach(function (node) {
+ return node.setAttribute('aria-checked', 'false');
+ });
+ }
+
+ menuItem.setAttribute('aria-checked', check ? 'true' : 'false');
+ }
+ });
+ this.listeners.bind(menuItem, 'click keyup', function (event) {
+ if (is$1.keyboardEvent(event) && event.which !== 32) {
+ return;
+ }
+
+ event.preventDefault();
+ event.stopPropagation();
+ menuItem.checked = true;
+
+ switch (type) {
+ case 'language':
+ _this3.currentTrack = Number(value);
+ break;
+
+ case 'quality':
+ _this3.quality = value;
+ break;
+
+ case 'speed':
+ _this3.speed = parseFloat(value);
+ break;
+ }
+
+ controls.showMenuPanel.call(_this3, 'home', is$1.keyboardEvent(event));
+ }, type, false);
+ controls.bindMenuItemShortcuts.call(this, menuItem, type);
+ list.appendChild(menuItem);
+ },
+ // Format a time for display
+ formatTime: function formatTime$1() {
+ var time = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
+ var inverted = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
+
+ // Bail if the value isn't a number
+ if (!is$1.number(time)) {
+ return time;
+ } // Always display hours if duration is over an hour
+
+
+ var forceHours = getHours(this.duration) > 0;
+ return formatTime(time, forceHours, inverted);
+ },
+ // Update the displayed time
+ updateTimeDisplay: function updateTimeDisplay() {
+ var target = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
+ var time = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
+ var inverted = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
+
+ // Bail if there's no element to display or the value isn't a number
+ if (!is$1.element(target) || !is$1.number(time)) {
+ return;
+ } // eslint-disable-next-line no-param-reassign
+
+
+ target.innerText = controls.formatTime(time, inverted);
+ },
+ // Update volume UI and storage
+ updateVolume: function updateVolume() {
+ if (!this.supported.ui) {
+ return;
+ } // Update range
+
+
+ if (is$1.element(this.elements.inputs.volume)) {
+ controls.setRange.call(this, this.elements.inputs.volume, this.muted ? 0 : this.volume);
+ } // Update mute state
+
+
+ if (is$1.element(this.elements.buttons.mute)) {
+ this.elements.buttons.mute.pressed = this.muted || this.volume === 0;
+ }
+ },
+ // Update seek value and lower fill
+ setRange: function setRange(target) {
+ var value = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
+
+ if (!is$1.element(target)) {
+ return;
+ } // eslint-disable-next-line
+
+
+ target.value = value; // Webkit range fill
+
+ controls.updateRangeFill.call(this, target);
+ },
+ // Update <progress> elements
+ updateProgress: function updateProgress(event) {
+ var _this4 = this;
+
+ if (!this.supported.ui || !is$1.event(event)) {
+ return;
+ }
+
+ var value = 0;
+
+ var setProgress = function setProgress(target, input) {
+ var val = is$1.number(input) ? input : 0;
+ var progress = is$1.element(target) ? target : _this4.elements.display.buffer; // Update value and label
+
+ if (is$1.element(progress)) {
+ progress.value = val; // Update text label inside
+
+ var label = progress.getElementsByTagName('span')[0];
+
+ if (is$1.element(label)) {
+ label.childNodes[0].nodeValue = val;
+ }
+ }
+ };
+
+ if (event) {
+ switch (event.type) {
+ // Video playing
+ case 'timeupdate':
+ case 'seeking':
+ case 'seeked':
+ value = getPercentage(this.currentTime, this.duration); // Set seek range value only if it's a 'natural' time event
+
+ if (event.type === 'timeupdate') {
+ controls.setRange.call(this, this.elements.inputs.seek, value);
+ }
+
+ break;
+ // Check buffer status
+
+ case 'playing':
+ case 'progress':
+ setProgress(this.elements.display.buffer, this.buffered * 100);
+ break;
+ }
+ }
+ },
+ // Webkit polyfill for lower fill range
+ updateRangeFill: function updateRangeFill(target) {
+ // Get range from event if event passed
+ var range = is$1.event(target) ? target.target : target; // Needs to be a valid <input type='range'>
+
+ if (!is$1.element(range) || range.getAttribute('type') !== 'range') {
+ return;
+ } // Set aria values for https://github.com/sampotts/plyr/issues/905
+
+
+ if (matches$1(range, this.config.selectors.inputs.seek)) {
+ range.setAttribute('aria-valuenow', this.currentTime);
+ var currentTime = controls.formatTime(this.currentTime);
+ var duration = controls.formatTime(this.duration);
+ var format = i18n.get('seekLabel', this.config);
+ range.setAttribute('aria-valuetext', format.replace('{currentTime}', currentTime).replace('{duration}', duration));
+ } else if (matches$1(range, this.config.selectors.inputs.volume)) {
+ var percent = range.value * 100;
+ range.setAttribute('aria-valuenow', percent);
+ range.setAttribute('aria-valuetext', "".concat(percent.toFixed(1), "%"));
+ } else {
+ range.setAttribute('aria-valuenow', range.value);
+ } // WebKit only
+
+
+ if (!browser.isWebkit) {
+ return;
+ } // Set CSS custom property
+
+
+ range.style.setProperty('--value', "".concat(range.value / range.max * 100, "%"));
+ },
+ // Update hover tooltip for seeking
+ updateSeekTooltip: function updateSeekTooltip(event) {
+ var _this5 = this;
+
+ // Bail if setting not true
+ if (!this.config.tooltips.seek || !is$1.element(this.elements.inputs.seek) || !is$1.element(this.elements.display.seekTooltip) || this.duration === 0) {
+ return;
+ }
+
+ var visible = "".concat(this.config.classNames.tooltip, "--visible");
+
+ var toggle = function toggle(show) {
+ return toggleClass(_this5.elements.display.seekTooltip, visible, show);
+ }; // Hide on touch
+
+
+ if (this.touch) {
+ toggle(false);
+ return;
+ } // Determine percentage, if already visible
+
+
+ var percent = 0;
+ var clientRect = this.elements.progress.getBoundingClientRect();
+
+ if (is$1.event(event)) {
+ percent = 100 / clientRect.width * (event.pageX - clientRect.left);
+ } else if (hasClass(this.elements.display.seekTooltip, visible)) {
+ percent = parseFloat(this.elements.display.seekTooltip.style.left, 10);
+ } else {
+ return;
+ } // Set bounds
+
+
+ if (percent < 0) {
+ percent = 0;
+ } else if (percent > 100) {
+ percent = 100;
+ } // Display the time a click would seek to
+
+
+ controls.updateTimeDisplay.call(this, this.elements.display.seekTooltip, this.duration / 100 * percent); // Set position
+
+ this.elements.display.seekTooltip.style.left = "".concat(percent, "%"); // Show/hide the tooltip
+ // If the event is a moues in/out and percentage is inside bounds
+
+ if (is$1.event(event) && ['mouseenter', 'mouseleave'].includes(event.type)) {
+ toggle(event.type === 'mouseenter');
+ }
+ },
+ // Handle time change event
+ timeUpdate: function timeUpdate(event) {
+ // Only invert if only one time element is displayed and used for both duration and currentTime
+ var invert = !is$1.element(this.elements.display.duration) && this.config.invertTime; // Duration
+
+ controls.updateTimeDisplay.call(this, this.elements.display.currentTime, invert ? this.duration - this.currentTime : this.currentTime, invert); // Ignore updates while seeking
+
+ if (event && event.type === 'timeupdate' && this.media.seeking) {
+ return;
+ } // Playing progress
+
+
+ controls.updateProgress.call(this, event);
+ },
+ // Show the duration on metadataloaded or durationchange events
+ durationUpdate: function durationUpdate() {
+ // Bail if no UI or durationchange event triggered after playing/seek when invertTime is false
+ if (!this.supported.ui || !this.config.invertTime && this.currentTime) {
+ return;
+ } // 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.
+ // https://github.com/video-dev/hls.js/blob/5820d29d3c4c8a46e8b75f1e3afa3e68c1a9a2db/src/controller/buffer-controller.js#L415
+ // https://github.com/google/shaka-player/blob/4d889054631f4e1cf0fbd80ddd2b71887c02e232/lib/media/streaming_engine.js#L1062
+ // https://github.com/Dash-Industry-Forum/dash.js/blob/69859f51b969645b234666800d4cb596d89c602d/src/dash/models/DashManifestModel.js#L338
+
+
+ if (this.duration >= Math.pow(2, 32)) {
+ toggleHidden(this.elements.display.currentTime, true);
+ toggleHidden(this.elements.progress, true);
+ return;
+ } // Update ARIA values
+
+
+ if (is$1.element(this.elements.inputs.seek)) {
+ this.elements.inputs.seek.setAttribute('aria-valuemax', this.duration);
+ } // If there's a spot to display duration
+
+
+ var hasDuration = is$1.element(this.elements.display.duration); // If there's only one time display, display duration there
+
+ if (!hasDuration && this.config.displayDuration && this.paused) {
+ controls.updateTimeDisplay.call(this, this.elements.display.currentTime, this.duration);
+ } // If there's a duration element, update content
+
+
+ if (hasDuration) {
+ controls.updateTimeDisplay.call(this, this.elements.display.duration, this.duration);
+ } // Update the tooltip (if visible)
+
+
+ controls.updateSeekTooltip.call(this);
+ },
+ // Hide/show a tab
+ toggleMenuButton: function toggleMenuButton(setting, toggle) {
+ toggleHidden(this.elements.settings.buttons[setting], !toggle);
+ },
+ // Update the selected setting
+ updateSetting: function updateSetting(setting, container, input) {
+ var pane = this.elements.settings.panels[setting];
+ var value = null;
+ var list = container;
+
+ if (setting === 'captions') {
+ value = this.currentTrack;
+ } else {
+ value = !is$1.empty(input) ? input : this[setting]; // Get default
+
+ if (is$1.empty(value)) {
+ value = this.config[setting].default;
+ } // Unsupported value
+
+
+ if (!is$1.empty(this.options[setting]) && !this.options[setting].includes(value)) {
+ this.debug.warn("Unsupported value of '".concat(value, "' for ").concat(setting));
+ return;
+ } // Disabled value
+
+
+ if (!this.config[setting].options.includes(value)) {
+ this.debug.warn("Disabled value of '".concat(value, "' for ").concat(setting));
+ return;
+ }
+ } // Get the list if we need to
+
+
+ if (!is$1.element(list)) {
+ list = pane && pane.querySelector('[role="menu"]');
+ } // If there's no list it means it's not been rendered...
+
+
+ if (!is$1.element(list)) {
+ return;
+ } // Update the label
+
+
+ var label = this.elements.settings.buttons[setting].querySelector(".".concat(this.config.classNames.menu.value));
+ label.innerHTML = controls.getLabel.call(this, setting, value); // Find the radio option and check it
+
+ var target = list && list.querySelector("[value=\"".concat(value, "\"]"));
+
+ if (is$1.element(target)) {
+ target.checked = true;
+ }
+ },
+ // Translate a value into a nice label
+ getLabel: function getLabel(setting, value) {
+ switch (setting) {
+ case 'speed':
+ return value === 1 ? i18n.get('normal', this.config) : "".concat(value, "&times;");
+
+ case 'quality':
+ if (is$1.number(value)) {
+ var label = i18n.get("qualityLabel.".concat(value), this.config);
+
+ if (!label.length) {
+ return "".concat(value, "p");
+ }
+
+ return label;
+ }
+
+ return toTitleCase(value);
+
+ case 'captions':
+ return captions.getLabel.call(this);
+
+ default:
+ return null;
+ }
+ },
+ // Set the quality menu
+ setQualityMenu: function setQualityMenu(options) {
+ var _this6 = this;
+
+ // Menu required
+ if (!is$1.element(this.elements.settings.panels.quality)) {
+ return;
+ }
+
+ var type = 'quality';
+ var list = this.elements.settings.panels.quality.querySelector('[role="menu"]'); // Set options if passed and filter based on uniqueness and config
+
+ if (is$1.array(options)) {
+ this.options.quality = dedupe(options).filter(function (quality) {
+ return _this6.config.quality.options.includes(quality);
+ });
+ } // Toggle the pane and tab
+
+
+ var toggle = !is$1.empty(this.options.quality) && this.options.quality.length > 1;
+ controls.toggleMenuButton.call(this, type, toggle); // Empty the menu
+
+ emptyElement(list); // Check if we need to toggle the parent
+
+ controls.checkMenu.call(this); // If we're hiding, nothing more to do
+
+ if (!toggle) {
+ return;
+ } // Get the badge HTML for HD, 4K etc
+
+
+ var getBadge = function getBadge(quality) {
+ var label = i18n.get("qualityBadge.".concat(quality), _this6.config);
+
+ if (!label.length) {
+ return null;
+ }
+
+ return controls.createBadge.call(_this6, label);
+ }; // Sort options by the config and then render options
+
+
+ this.options.quality.sort(function (a, b) {
+ var sorting = _this6.config.quality.options;
+ return sorting.indexOf(a) > sorting.indexOf(b) ? 1 : -1;
+ }).forEach(function (quality) {
+ controls.createMenuItem.call(_this6, {
+ value: quality,
+ list: list,
+ type: type,
+ title: controls.getLabel.call(_this6, 'quality', quality),
+ badge: getBadge(quality)
+ });
+ });
+ controls.updateSetting.call(this, type, list);
+ },
+ // Set the looping options
+
+ /* setLoopMenu() {
+ // Menu required
+ if (!is.element(this.elements.settings.panels.loop)) {
+ return;
+ }
+ const options = ['start', 'end', 'all', 'reset'];
+ const list = this.elements.settings.panels.loop.querySelector('[role="menu"]');
+ // Show the pane and tab
+ toggleHidden(this.elements.settings.buttons.loop, false);
+ toggleHidden(this.elements.settings.panels.loop, false);
+ // Toggle the pane and tab
+ const toggle = !is.empty(this.loop.options);
+ controls.toggleMenuButton.call(this, 'loop', toggle);
+ // Empty the menu
+ emptyElement(list);
+ options.forEach(option => {
+ const item = createElement('li');
+ const button = createElement(
+ 'button',
+ extend(getAttributesFromSelector(this.config.selectors.buttons.loop), {
+ type: 'button',
+ class: this.config.classNames.control,
+ 'data-plyr-loop-action': option,
+ }),
+ i18n.get(option, this.config)
+ );
+ if (['start', 'end'].includes(option)) {
+ const badge = controls.createBadge.call(this, '00:00');
+ button.appendChild(badge);
+ }
+ item.appendChild(button);
+ list.appendChild(item);
+ });
+ }, */
+ // Get current selected caption language
+ // TODO: rework this to user the getter in the API?
+ // Set a list of available captions languages
+ setCaptionsMenu: function setCaptionsMenu() {
+ var _this7 = this;
+
+ // Menu required
+ if (!is$1.element(this.elements.settings.panels.captions)) {
+ return;
+ } // TODO: Captions or language? Currently it's mixed
+
+
+ var type = 'captions';
+ var list = this.elements.settings.panels.captions.querySelector('[role="menucaptions"]');
+ var tracks = captions.getTracks.call(this);
+ var toggle = Boolean(tracks.length); // Toggle the pane and tab
+
+ controls.toggleMenuButton.call(this, type, toggle); // Empty the menu
+
+ emptyElement(list); // Check if we need to toggle the parent
+
+ controls.checkMenu.call(this); // If there's no captions, bail
+
+ if (!toggle) {
+ return;
+ } // Generate options data
+
+
+ var options = tracks.map(function (track, value) {
+ return {
+ value: value,
+ checked: _this7.captions.toggled && _this7.currentTrack === value,
+ title: captions.getLabel.call(_this7, track),
+ badge: track.language && controls.createBadge.call(_this7, track.language.toUpperCase()),
+ list: list,
+ type: 'language'
+ };
+ }); // Add the "Disabled" option to turn off captions
+
+ options.unshift({
+ value: -1,
+ checked: !this.captions.toggled,
+ title: i18n.get('disabled', this.config),
+ list: list,
+ type: 'language'
+ }); // Generate options
+
+ options.forEach(controls.createMenuItem.bind(this));
+ controls.updateSetting.call(this, type, list);
+ },
+ // Set a list of available captions languages
+ setSpeedMenu: function setSpeedMenu() {
+ var _this8 = this;
+
+ // Menu required
+ if (!is$1.element(this.elements.settings.panels.speed)) {
+ return;
+ }
+
+ var type = 'speed';
+ var list = this.elements.settings.panels.speed.querySelector('[role="menu"]'); // Filter out invalid speeds
+
+ this.options.speed = this.options.speed.filter(function (o) {
+ return o >= _this8.minimumSpeed && o <= _this8.maximumSpeed;
+ }); // Toggle the pane and tab
+
+ var toggle = !is$1.empty(this.options.speed) && this.options.speed.length > 1;
+ controls.toggleMenuButton.call(this, type, toggle); // Empty the menu
+
+ emptyElement(list); // Check if we need to toggle the parent
+
+ controls.checkMenu.call(this); // If we're hiding, nothing more to do
+
+ if (!toggle) {
+ return;
+ } // Create items
+
+
+ this.options.speed.forEach(function (speed) {
+ controls.createMenuItem.call(_this8, {
+ value: speed,
+ list: list,
+ type: type,
+ title: controls.getLabel.call(_this8, 'speed', speed)
+ });
+ });
+ controls.updateSetting.call(this, type, list);
+ },
+ // Check if we need to hide/show the settings menu
+ checkMenu: function checkMenu() {
+ var buttons = this.elements.settings.buttons;
+ var visible = !is$1.empty(buttons) && Object.values(buttons).some(function (button) {
+ return !button.hidden;
+ });
+ toggleHidden(this.elements.settings.menu, !visible);
+ },
+ // Focus the first menu item in a given (or visible) menu
+ focusFirstMenuItem: function focusFirstMenuItem(pane) {
+ var tabFocus = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
+
+ if (this.elements.settings.popup.hidden) {
+ return;
+ }
+
+ var target = pane;
+
+ if (!is$1.element(target)) {
+ target = Object.values(this.elements.settings.panels).find(function (p) {
+ return !p.hidden;
+ });
+ }
+
+ var firstItem = target.querySelector('[role^="menuitem"]');
+ setFocus.call(this, firstItem, tabFocus);
+ },
+ // Show/hide menu
+ toggleMenu: function toggleMenu(input) {
+ var popup = this.elements.settings.popup;
+ var button = this.elements.buttons.settings; // Menu and button are required
+
+ if (!is$1.element(popup) || !is$1.element(button)) {
+ return;
+ } // True toggle by default
+
+
+ var hidden = popup.hidden;
+ var show = hidden;
+
+ if (is$1.boolean(input)) {
+ show = input;
+ } else if (is$1.keyboardEvent(input) && input.which === 27) {
+ show = false;
+ } else if (is$1.event(input)) {
+ // If Plyr is in a shadowDOM, the event target is set to the component, instead of the
+ // Element in the shadowDOM. The path, if available, is complete.
+ var target = is$1.function(input.composedPath) ? input.composedPath()[0] : input.target;
+ var isMenuItem = popup.contains(target); // If the click was inside the menu or if the click
+ // wasn't the button or menu item and we're trying to
+ // show the menu (a doc click shouldn't show the menu)
+
+ if (isMenuItem || !isMenuItem && input.target !== button && show) {
+ return;
+ }
+ } // Set button attributes
+
+
+ button.setAttribute('aria-expanded', show); // Show the actual popup
+
+ toggleHidden(popup, !show); // Add class hook
+
+ toggleClass(this.elements.container, this.config.classNames.menu.open, show); // Focus the first item if key interaction
+
+ if (show && is$1.keyboardEvent(input)) {
+ controls.focusFirstMenuItem.call(this, null, true);
+ } else if (!show && !hidden) {
+ // If closing, re-focus the button
+ setFocus.call(this, button, is$1.keyboardEvent(input));
+ }
+ },
+ // Get the natural size of a menu panel
+ getMenuSize: function getMenuSize(tab) {
+ var clone = tab.cloneNode(true);
+ clone.style.position = 'absolute';
+ clone.style.opacity = 0;
+ clone.removeAttribute('hidden'); // Append to parent so we get the "real" size
+
+ tab.parentNode.appendChild(clone); // Get the sizes before we remove
+
+ var width = clone.scrollWidth;
+ var height = clone.scrollHeight; // Remove from the DOM
+
+ removeElement(clone);
+ return {
+ width: width,
+ height: height
+ };
+ },
+ // Show a panel in the menu
+ showMenuPanel: function showMenuPanel() {
+ var _this9 = this;
+
+ var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
+ var tabFocus = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
+ var target = this.elements.container.querySelector("#plyr-settings-".concat(this.id, "-").concat(type)); // Nothing to show, bail
+
+ if (!is$1.element(target)) {
+ return;
+ } // Hide all other panels
+
+
+ var container = target.parentNode;
+ var current = Array.from(container.children).find(function (node) {
+ return !node.hidden;
+ }); // If we can do fancy animations, we'll animate the height/width
+
+ if (support.transitions && !support.reducedMotion) {
+ // Set the current width as a base
+ container.style.width = "".concat(current.scrollWidth, "px");
+ container.style.height = "".concat(current.scrollHeight, "px"); // Get potential sizes
+
+ var size = controls.getMenuSize.call(this, target); // Restore auto height/width
+
+ var restore = function restore(event) {
+ // We're only bothered about height and width on the container
+ if (event.target !== container || !['width', 'height'].includes(event.propertyName)) {
+ return;
+ } // Revert back to auto
+
+
+ container.style.width = '';
+ container.style.height = ''; // Only listen once
+
+ off.call(_this9, container, transitionEndEvent, restore);
+ }; // Listen for the transition finishing and restore auto height/width
+
+
+ on.call(this, container, transitionEndEvent, restore); // Set dimensions to target
+
+ container.style.width = "".concat(size.width, "px");
+ container.style.height = "".concat(size.height, "px");
+ } // Set attributes on current tab
+
+
+ toggleHidden(current, true); // Set attributes on target
+
+ toggleHidden(target, false); // Focus the first item
+
+ controls.focusFirstMenuItem.call(this, target, tabFocus);
+ },
+ // Set the download URL
+ setDownloadUrl: function setDownloadUrl() {
+ var button = this.elements.buttons.download; // Bail if no button
+
+ if (!is$1.element(button)) {
+ return;
+ } // Set attribute
+
+
+ button.setAttribute('href', this.download);
+ },
+ // Build the default HTML
+ create: function create(data) {
+ var _this10 = this;
+
+ var bindMenuItemShortcuts = controls.bindMenuItemShortcuts,
+ createButton = controls.createButton,
+ createProgress = controls.createProgress,
+ createRange = controls.createRange,
+ createTime = controls.createTime,
+ setQualityMenu = controls.setQualityMenu,
+ setSpeedMenu = controls.setSpeedMenu,
+ showMenuPanel = controls.showMenuPanel;
+ this.elements.controls = null; // Larger overlaid play button
+
+ if (is$1.array(this.config.controls) && this.config.controls.includes('play-large')) {
+ this.elements.container.appendChild(createButton.call(this, 'play-large'));
+ } // Create the container
+
+
+ var container = createElement('div', getAttributesFromSelector(this.config.selectors.controls.wrapper));
+ this.elements.controls = container; // Default item attributes
+
+ var defaultAttributes = {
+ class: 'plyr__controls__item'
+ }; // Loop through controls in order
+
+ dedupe(is$1.array(this.config.controls) ? this.config.controls : []).forEach(function (control) {
+ // Restart button
+ if (control === 'restart') {
+ container.appendChild(createButton.call(_this10, 'restart', defaultAttributes));
+ } // Rewind button
+
+
+ if (control === 'rewind') {
+ container.appendChild(createButton.call(_this10, 'rewind', defaultAttributes));
+ } // Play/Pause button
+
+
+ if (control === 'play') {
+ container.appendChild(createButton.call(_this10, 'play', defaultAttributes));
+ } // Fast forward button
+
+
+ if (control === 'fast-forward') {
+ container.appendChild(createButton.call(_this10, 'fast-forward', defaultAttributes));
+ } // Progress
+
+
+ if (control === 'progress') {
+ var progressContainer = createElement('div', {
+ class: "".concat(defaultAttributes.class, " plyr__progress__container")
+ });
+ var progress = createElement('div', getAttributesFromSelector(_this10.config.selectors.progress)); // Seek range slider
+
+ progress.appendChild(createRange.call(_this10, 'seek', {
+ id: "plyr-seek-".concat(data.id)
+ })); // Buffer progress
+
+ progress.appendChild(createProgress.call(_this10, 'buffer')); // TODO: Add loop display indicator
+ // Seek tooltip
+
+ if (_this10.config.tooltips.seek) {
+ var tooltip = createElement('span', {
+ class: _this10.config.classNames.tooltip
+ }, '00:00');
+ progress.appendChild(tooltip);
+ _this10.elements.display.seekTooltip = tooltip;
+ }
+
+ _this10.elements.progress = progress;
+ progressContainer.appendChild(_this10.elements.progress);
+ container.appendChild(progressContainer);
+ } // Media current time display
+
+
+ if (control === 'current-time') {
+ container.appendChild(createTime.call(_this10, 'currentTime', defaultAttributes));
+ } // Media duration display
+
+
+ if (control === 'duration') {
+ container.appendChild(createTime.call(_this10, 'duration', defaultAttributes));
+ } // Volume controls
+
+
+ if (control === 'mute' || control === 'volume') {
+ var volume = _this10.elements.volume; // Create the volume container if needed
+
+ if (!is$1.element(volume) || !container.contains(volume)) {
+ volume = createElement('div', extend({}, defaultAttributes, {
+ class: "".concat(defaultAttributes.class, " plyr__volume").trim()
+ }));
+ _this10.elements.volume = volume;
+ container.appendChild(volume);
+ } // Toggle mute button
+
+
+ if (control === 'mute') {
+ volume.appendChild(createButton.call(_this10, 'mute'));
+ } // Volume range control
+ // Ignored on iOS as it's handled globally
+ // https://developer.apple.com/library/safari/documentation/AudioVideo/Conceptual/Using_HTML5_Audio_Video/Device-SpecificConsiderations/Device-SpecificConsiderations.html
+
+
+ if (control === 'volume' && !browser.isIos) {
+ // Set the attributes
+ var attributes = {
+ max: 1,
+ step: 0.05,
+ value: _this10.config.volume
+ }; // Create the volume range slider
+
+ volume.appendChild(createRange.call(_this10, 'volume', extend(attributes, {
+ id: "plyr-volume-".concat(data.id)
+ })));
+ }
+ } // Toggle captions button
+
+
+ if (control === 'captions') {
+ container.appendChild(createButton.call(_this10, 'captions', defaultAttributes));
+ } // Settings button / menu
+
+
+ if (control === 'settings' && !is$1.empty(_this10.config.settings)) {
+ var wrapper = createElement('div', extend({}, defaultAttributes, {
+ class: "".concat(defaultAttributes.class, " plyr__menu").trim(),
+ hidden: ''
+ }));
+ wrapper.appendChild(createButton.call(_this10, 'settings', {
+ 'aria-haspopup': true,
+ 'aria-controls': "plyr-settings-".concat(data.id),
+ 'aria-expanded': false
+ }));
+ var popup = createElement('div', {
+ class: 'plyr__menu__container',
+ id: "plyr-settings-".concat(data.id),
+ hidden: ''
+ });
+ var inner = createElement('div');
+ var home = createElement('div', {
+ id: "plyr-settings-".concat(data.id, "-home")
+ }); // Create the menu
+
+ var menu = createElement('div', {
+ role: 'menu'
+ });
+ home.appendChild(menu);
+ inner.appendChild(home);
+ _this10.elements.settings.panels.home = home; // Build the menu items
+
+ _this10.config.settings.forEach(function (type) {
+ // TODO: bundle this with the createMenuItem helper and bindings
+ var menuItem = createElement('button', extend(getAttributesFromSelector(_this10.config.selectors.buttons.settings), {
+ type: 'button',
+ class: "".concat(_this10.config.classNames.control, " ").concat(_this10.config.classNames.control, "--forward"),
+ role: 'menuitem',
+ 'aria-haspopup': true,
+ hidden: ''
+ })); // Bind menu shortcuts for keyboard users
+
+ bindMenuItemShortcuts.call(_this10, menuItem, type); // Show menu on click
+
+ on.call(_this10, menuItem, 'click', function () {
+ showMenuPanel.call(_this10, type, false);
+ });
+ var flex = createElement('span', null, i18n.get(type, _this10.config));
+ var value = createElement('span', {
+ class: _this10.config.classNames.menu.value
+ }); // Speed contains HTML entities
+
+ value.innerHTML = data[type];
+ flex.appendChild(value);
+ menuItem.appendChild(flex);
+ menu.appendChild(menuItem); // Build the panes
+
+ var pane = createElement('div', {
+ id: "plyr-settings-".concat(data.id, "-").concat(type),
+ hidden: ''
+ }); // Back button
+
+ var backButton = createElement('button', {
+ type: 'button',
+ class: "".concat(_this10.config.classNames.control, " ").concat(_this10.config.classNames.control, "--back")
+ }); // Visible label
+
+ backButton.appendChild(createElement('span', {
+ 'aria-hidden': true
+ }, i18n.get(type, _this10.config))); // Screen reader label
+
+ backButton.appendChild(createElement('span', {
+ class: _this10.config.classNames.hidden
+ }, i18n.get('menuBack', _this10.config))); // Go back via keyboard
+
+ on.call(_this10, pane, 'keydown', function (event) {
+ // We only care about <-
+ if (event.which !== 37) {
+ return;
+ } // Prevent seek
+
+
+ event.preventDefault();
+ event.stopPropagation(); // Show the respective menu
+
+ showMenuPanel.call(_this10, 'home', true);
+ }, false); // Go back via button click
+
+ on.call(_this10, backButton, 'click', function () {
+ showMenuPanel.call(_this10, 'home', false);
+ }); // Add to pane
+
+ pane.appendChild(backButton); // Menu
+
+ pane.appendChild(createElement('div', {
+ role: 'menu'
+ })); // Menu Captions
+
+ pane.appendChild(createElement('div', {
+ role: 'menucaptions'
+ }));
+ inner.appendChild(pane);
+ _this10.elements.settings.buttons[type] = menuItem;
+ _this10.elements.settings.panels[type] = pane;
+ });
+
+ popup.appendChild(inner);
+ wrapper.appendChild(popup);
+ container.appendChild(wrapper);
+ _this10.elements.settings.popup = popup;
+ _this10.elements.settings.menu = wrapper;
+ } // Picture in picture button
+
+
+ if (control === 'pip' && support.pip) {
+ container.appendChild(createButton.call(_this10, 'pip', defaultAttributes));
+ } // Airplay button
+
+
+ if (control === 'airplay' && support.airplay) {
+ container.appendChild(createButton.call(_this10, 'airplay', defaultAttributes));
+ } // Download button
+
+
+ if (control === 'download') {
+ var _attributes = extend({}, defaultAttributes, {
+ element: 'a',
+ href: _this10.download,
+ target: '_blank'
+ }); // Set download attribute for HTML5 only
+
+
+ if (_this10.isHTML5) {
+ _attributes.download = '';
+ }
+
+ var download = _this10.config.urls.download;
+
+ if (!is$1.url(download) && _this10.isEmbed) {
+ extend(_attributes, {
+ icon: "logo-".concat(_this10.provider),
+ label: _this10.provider
+ });
+ }
+
+ container.appendChild(createButton.call(_this10, 'download', _attributes));
+ } // Toggle fullscreen button
+
+
+ if (control === 'fullscreen') {
+ container.appendChild(createButton.call(_this10, 'fullscreen', defaultAttributes));
+ }
+ }); // Set available quality levels
+
+ if (this.isHTML5) {
+ setQualityMenu.call(this, html5.getQualityOptions.call(this));
+ }
+
+ setSpeedMenu.call(this);
+ return container;
+ },
+ // Insert controls
+ inject: function inject() {
+ var _this11 = this;
+
+ // Sprite
+ if (this.config.loadSprite) {
+ var icon = controls.getIconUrl.call(this); // Only load external sprite using AJAX
+
+ if (icon.cors) {
+ loadSprite(icon.url, 'sprite-plyr');
+ }
+ } // Create a unique ID
+
+
+ this.id = Math.floor(Math.random() * 10000); // Null by default
+
+ var container = null;
+ this.elements.controls = null; // Set template properties
+
+ var props = {
+ id: this.id,
+ seektime: this.config.seekTime,
+ title: this.config.title
+ };
+ var update = true; // If function, run it and use output
+
+ if (is$1.function(this.config.controls)) {
+ this.config.controls = this.config.controls.call(this, props);
+ } // Convert falsy controls to empty array (primarily for empty strings)
+
+
+ if (!this.config.controls) {
+ this.config.controls = [];
+ }
+
+ if (is$1.element(this.config.controls) || is$1.string(this.config.controls)) {
+ // HTMLElement or Non-empty string passed as the option
+ container = this.config.controls;
+ } else {
+ // Create controls
+ container = controls.create.call(this, {
+ id: this.id,
+ seektime: this.config.seekTime,
+ speed: this.speed,
+ quality: this.quality,
+ captions: captions.getLabel.call(this) // TODO: Looping
+ // loop: 'None',
+
+ });
+ update = false;
+ } // Replace props with their value
+
+
+ var replace = function replace(input) {
+ var result = input;
+ Object.entries(props).forEach(function (_ref2) {
+ var _ref3 = _slicedToArray(_ref2, 2),
+ key = _ref3[0],
+ value = _ref3[1];
+
+ result = replaceAll(result, "{".concat(key, "}"), value);
+ });
+ return result;
+ }; // Update markup
+
+
+ if (update) {
+ if (is$1.string(this.config.controls)) {
+ container = replace(container);
+ }
+ } // Controls container
+
+
+ var target; // Inject to custom location
+
+ if (is$1.string(this.config.selectors.controls.container)) {
+ target = document.querySelector(this.config.selectors.controls.container);
+ } // Inject into the container by default
+
+
+ if (!is$1.element(target)) {
+ target = this.elements.container;
+ } // Inject controls HTML (needs to be before captions, hence "afterbegin")
+
+
+ var insertMethod = is$1.element(container) ? 'insertAdjacentElement' : 'insertAdjacentHTML';
+ target[insertMethod]('afterbegin', container); // Find the elements if need be
+
+ if (!is$1.element(this.elements.controls)) {
+ controls.findElements.call(this);
+ } // Add pressed property to buttons
+
+
+ if (!is$1.empty(this.elements.buttons)) {
+ var addProperty = function addProperty(button) {
+ var className = _this11.config.classNames.controlPressed;
+ Object.defineProperty(button, 'pressed', {
+ enumerable: true,
+ get: function get() {
+ return hasClass(button, className);
+ },
+ set: function set() {
+ var pressed = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
+ toggleClass(button, className, pressed);
+ }
+ });
+ }; // Toggle classname when pressed property is set
+
+
+ Object.values(this.elements.buttons).filter(Boolean).forEach(function (button) {
+ if (is$1.array(button) || is$1.nodeList(button)) {
+ Array.from(button).filter(Boolean).forEach(addProperty);
+ } else {
+ addProperty(button);
+ }
+ });
+ } // Edge sometimes doesn't finish the paint so force a repaint
+
+
+ if (browser.isEdge) {
+ repaint(target);
+ } // Setup tooltips
+
+
+ if (this.config.tooltips.controls) {
+ var _this$config = this.config,
+ classNames = _this$config.classNames,
+ selectors = _this$config.selectors;
+ var selector = "".concat(selectors.controls.wrapper, " ").concat(selectors.labels, " .").concat(classNames.hidden);
+ var labels = getElements.call(this, selector);
+ Array.from(labels).forEach(function (label) {
+ toggleClass(label, _this11.config.classNames.hidden, false);
+ toggleClass(label, _this11.config.classNames.tooltip, true);
+ });
+ }
+ }
+};
+
+/**
+ * Parse a string to a URL object
+ * @param {String} input - the URL to be parsed
+ * @param {Boolean} safe - failsafe parsing
+ */
+
+function parseUrl(input) {
+ var safe = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
+ var url = input;
+
+ if (safe) {
+ var parser = document.createElement('a');
+ parser.href = url;
+ url = parser.href;
+ }
+
+ try {
+ return new URL(url);
+ } catch (e) {
+ return null;
+ }
+} // Convert object to URLSearchParams
+
+function buildUrlParams(input) {
+ var params = new URLSearchParams();
+
+ if (is$1.object(input)) {
+ Object.entries(input).forEach(function (_ref) {
+ var _ref2 = _slicedToArray(_ref, 2),
+ key = _ref2[0],
+ value = _ref2[1];
+
+ params.set(key, value);
+ });
+ }
+
+ return params;
+}
+
+var captions = {
+ // Setup captions
+ setup: function setup() {
+ // Requires UI support
+ if (!this.supported.ui) {
+ return;
+ } // Only Vimeo and HTML5 video supported at this point
+
+
+ if (!this.isVideo || this.isYouTube || this.isHTML5 && !support.textTracks) {
+ // Clear menu and hide
+ if (is$1.array(this.config.controls) && this.config.controls.includes('settings') && this.config.settings.includes('captions')) {
+ controls.setCaptionsMenu.call(this);
+ }
+
+ return;
+ } // Inject the container
+
+
+ if (!is$1.element(this.elements.captions)) {
+ this.elements.captions = createElement('div', getAttributesFromSelector(this.config.selectors.captions));
+ insertAfter(this.elements.captions, this.elements.wrapper);
+ } // Fix IE captions if CORS is used
+ // Fetch captions and inject as blobs instead (data URIs not supported!)
+
+
+ if (browser.isIE && window.URL) {
+ var elements = this.media.querySelectorAll('track');
+ Array.from(elements).forEach(function (track) {
+ var src = track.getAttribute('src');
+ var url = parseUrl(src);
+
+ if (url !== null && url.hostname !== window.location.href.hostname && ['http:', 'https:'].includes(url.protocol)) {
+ fetch(src, 'blob').then(function (blob) {
+ track.setAttribute('src', window.URL.createObjectURL(blob));
+ }).catch(function () {
+ removeElement(track);
+ });
+ }
+ });
+ } // Get and set initial data
+ // The "preferred" options are not realized unless / until the wanted language has a match
+ // * languages: Array of user's browser languages.
+ // * language: The language preferred by user settings or config
+ // * active: The state preferred by user settings or config
+ // * toggled: The real captions state
+
+
+ var browserLanguages = navigator.languages || [navigator.language || navigator.userLanguage || 'en'];
+ var languages = dedupe(browserLanguages.map(function (language) {
+ return language.split('-')[0];
+ }));
+ var language = (this.storage.get('language') || this.config.captions.language || 'auto').toLowerCase(); // Use first browser language when language is 'auto'
+
+ if (language === 'auto') {
+ var _languages = _slicedToArray(languages, 1);
+
+ language = _languages[0];
+ }
+
+ var active = this.storage.get('captions');
+
+ if (!is$1.boolean(active)) {
+ active = this.config.captions.active;
+ }
+
+ Object.assign(this.captions, {
+ toggled: false,
+ active: active,
+ language: language,
+ languages: languages
+ }); // Watch changes to textTracks and update captions menu
+
+ if (this.isHTML5) {
+ var trackEvents = this.config.captions.update ? 'addtrack removetrack' : 'removetrack';
+ on.call(this, this.media.textTracks, trackEvents, captions.update.bind(this));
+ } // Update available languages in list next tick (the event must not be triggered before the listeners)
+
+
+ setTimeout(captions.update.bind(this), 0);
+ },
+ // Update available language options in settings based on tracks
+ update: function update() {
+ var _this = this;
+
+ var tracks = captions.getTracks.call(this, true); // Get the wanted language
+
+ var _this$captions = this.captions,
+ active = _this$captions.active,
+ language = _this$captions.language,
+ meta = _this$captions.meta,
+ currentTrackNode = _this$captions.currentTrackNode;
+ var languageExists = Boolean(tracks.find(function (track) {
+ return track.language === language;
+ })); // Handle tracks (add event listener and "pseudo"-default)
+
+ if (this.isHTML5 && this.isVideo) {
+ tracks.filter(function (track) {
+ return !meta.get(track);
+ }).forEach(function (track) {
+ _this.debug.log('Track added', track); // Attempt to store if the original dom element was "default"
+
+
+ meta.set(track, {
+ default: track.mode === 'showing'
+ }); // Turn off native caption rendering to avoid double captions
+ // Note: mode='hidden' forces a track to download. To ensure every track
+ // isn't downloaded at once, only 'showing' tracks should be reassigned
+ // eslint-disable-next-line no-param-reassign
+
+ if (track.mode === 'showing') {
+ // eslint-disable-next-line no-param-reassign
+ track.mode = 'hidden';
+ } // Add event listener for cue changes
+
+
+ on.call(_this, track, 'cuechange', function () {
+ return captions.updateCues.call(_this);
+ });
+ });
+ } // Update language first time it matches, or if the previous matching track was removed
+
+
+ if (languageExists && this.language !== language || !tracks.includes(currentTrackNode)) {
+ captions.setLanguage.call(this, language);
+ captions.toggle.call(this, active && languageExists);
+ } // Enable or disable captions based on track length
+
+
+ toggleClass(this.elements.container, this.config.classNames.captions.enabled, !is$1.empty(tracks)); // Update available languages in list
+
+ if (is$1.array(this.config.controls) && this.config.controls.includes('settings') && this.config.settings.includes('captions')) {
+ controls.setCaptionsMenu.call(this);
+ }
+ },
+ // Toggle captions display
+ // Used internally for the toggleCaptions method, with the passive option forced to false
+ toggle: function toggle(input) {
+ var _this2 = this;
+
+ var passive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
+
+ // If there's no full support
+ if (!this.supported.ui) {
+ return;
+ }
+
+ var toggled = this.captions.toggled; // Current state
+
+ var activeClass = this.config.classNames.captions.active; // Get the next state
+ // If the method is called without parameter, toggle based on current value
+
+ var active = is$1.nullOrUndefined(input) ? !toggled : input; // Update state and trigger event
+
+ if (active !== toggled) {
+ // When passive, don't override user preferences
+ if (!passive) {
+ this.captions.active = active;
+ this.storage.set({
+ captions: active
+ });
+ } // Force language if the call isn't passive and there is no matching language to toggle to
+
+
+ if (!this.language && active && !passive) {
+ var tracks = captions.getTracks.call(this);
+ 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
+
+ this.captions.language = track.language; // Set caption, but don't store in localStorage as user preference
+
+ captions.set.call(this, tracks.indexOf(track));
+ return;
+ } // Toggle button if it's enabled
+
+
+ if (this.elements.buttons.captions) {
+ this.elements.buttons.captions.pressed = active;
+ } // Add class hook
+
+
+ toggleClass(this.elements.container, activeClass, active);
+ this.captions.toggled = active; // Update settings menu
+
+ controls.updateSetting.call(this, 'captions'); // Trigger event (not used internally)
+
+ triggerEvent.call(this, this.media, active ? 'captionsenabled' : 'captionsdisabled');
+ } // Wait for the call stack to clear before setting mode='hidden'
+ // on the active track - forcing the browser to download it
+
+
+ setTimeout(function () {
+ if (active && _this2.captions.toggled) {
+ _this2.captions.currentTrackNode.mode = 'hidden';
+ }
+ });
+ },
+ // Set captions by track index
+ // Used internally for the currentTrack setter with the passive option forced to false
+ set: function set(index) {
+ var passive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
+ var tracks = captions.getTracks.call(this); // Disable captions if setting to -1
+
+ if (index === -1) {
+ captions.toggle.call(this, false, passive);
+ return;
+ }
+
+ if (!is$1.number(index)) {
+ this.debug.warn('Invalid caption argument', index);
+ return;
+ }
+
+ if (!(index in tracks)) {
+ this.debug.warn('Track not found', index);
+ return;
+ }
+
+ if (this.captions.currentTrack !== index) {
+ this.captions.currentTrack = index;
+ var track = tracks[index];
+
+ var _ref = track || {},
+ language = _ref.language; // Store reference to node for invalidation on remove
+
+
+ this.captions.currentTrackNode = track; // Update settings menu
+
+ controls.updateSetting.call(this, 'captions'); // When passive, don't override user preferences
+
+ if (!passive) {
+ this.captions.language = language;
+ this.storage.set({
+ language: language
+ });
+ } // Handle Vimeo captions
+
+
+ if (this.isVimeo) {
+ this.embed.enableTextTrack(language);
+ } // Trigger event
+
+
+ triggerEvent.call(this, this.media, 'languagechange');
+ } // Show captions
+
+
+ captions.toggle.call(this, true, passive);
+
+ if (this.isHTML5 && this.isVideo) {
+ // If we change the active track while a cue is already displayed we need to update it
+ captions.updateCues.call(this);
+ }
+ },
+ // Set captions by language
+ // Used internally for the language setter with the passive option forced to false
+ setLanguage: function setLanguage(input) {
+ var passive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
+
+ if (!is$1.string(input)) {
+ this.debug.warn('Invalid language argument', input);
+ return;
+ } // Normalize
+
+
+ var language = input.toLowerCase();
+ this.captions.language = language; // Set currentTrack
+
+ var tracks = captions.getTracks.call(this);
+ var track = captions.findTrack.call(this, [language]);
+ captions.set.call(this, tracks.indexOf(track), passive);
+ },
+ // Get current valid caption tracks
+ // If update is false it will also ignore tracks without metadata
+ // This is used to "freeze" the language options when captions.update is false
+ getTracks: function getTracks() {
+ var _this3 = this;
+
+ var update = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
+ // Handle media or textTracks missing or null
+ var tracks = Array.from((this.media || {}).textTracks || []); // For HTML5, use cache instead of current tracks when it exists (if captions.update is false)
+ // Filter out removed tracks and tracks that aren't captions/subtitles (for example metadata)
+
+ return tracks.filter(function (track) {
+ return !_this3.isHTML5 || update || _this3.captions.meta.has(track);
+ }).filter(function (track) {
+ return ['captions', 'subtitles'].includes(track.kind);
+ });
+ },
+ // Match tracks based on languages and get the first
+ findTrack: function findTrack(languages) {
+ var _this4 = this;
+
+ var force = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
+ var tracks = captions.getTracks.call(this);
+
+ var sortIsDefault = function sortIsDefault(track) {
+ return Number((_this4.captions.meta.get(track) || {}).default);
+ };
+
+ var sorted = Array.from(tracks).sort(function (a, b) {
+ return sortIsDefault(b) - sortIsDefault(a);
+ });
+ var track;
+ languages.every(function (language) {
+ track = sorted.find(function (t) {
+ return t.language === language;
+ });
+ return !track; // Break iteration if there is a match
+ }); // If no match is found but is required, get first
+
+ return track || (force ? sorted[0] : undefined);
+ },
+ // Get the current track
+ getCurrentTrack: function getCurrentTrack() {
+ return captions.getTracks.call(this)[this.currentTrack];
+ },
+ // Get UI label for track
+ getLabel: function getLabel(track) {
+ var currentTrack = track;
+
+ if (!is$1.track(currentTrack) && support.textTracks && this.captions.toggled) {
+ currentTrack = captions.getCurrentTrack.call(this);
+ }
+
+ if (is$1.track(currentTrack)) {
+ if (!is$1.empty(currentTrack.label)) {
+ return currentTrack.label;
+ }
+
+ if (!is$1.empty(currentTrack.language)) {
+ return track.language.toUpperCase();
+ }
+
+ return i18n.get('enabled', this.config);
+ }
+
+ return i18n.get('disabled', this.config);
+ },
+ // Update captions using current track's active cues
+ // Also optional array argument in case there isn't any track (ex: vimeo)
+ updateCues: function updateCues(input) {
+ // Requires UI
+ if (!this.supported.ui) {
+ return;
+ }
+
+ if (!is$1.element(this.elements.captions)) {
+ this.debug.warn('No captions element to render to');
+ return;
+ } // Only accept array or empty input
+
+
+ if (!is$1.nullOrUndefined(input) && !Array.isArray(input)) {
+ this.debug.warn('updateCues: Invalid input', input);
+ return;
+ }
+
+ var cues = input; // Get cues from track
+
+ if (!cues) {
+ var track = captions.getCurrentTrack.call(this);
+ cues = Array.from((track || {}).activeCues || []).map(function (cue) {
+ return cue.getCueAsHTML();
+ }).map(getHTML);
+ } // Set new caption text
+
+
+ var content = cues.map(function (cueText) {
+ return cueText.trim();
+ }).join('\n');
+ var changed = content !== this.elements.captions.innerHTML;
+
+ if (changed) {
+ // Empty the container and create a new child element
+ emptyElement(this.elements.captions);
+ var caption = createElement('span', getAttributesFromSelector(this.config.selectors.caption));
+ caption.innerHTML = content;
+ this.elements.captions.appendChild(caption); // Trigger event
+
+ triggerEvent.call(this, this.media, 'cuechange');
+ }
+ }
+};
+
+// ==========================================================================
+// Plyr default config
+// ==========================================================================
+var defaults$1 = {
+ // Disable
+ enabled: true,
+ // Custom media title
+ title: '',
+ // Logging to console
+ debug: false,
+ // Auto play (if supported)
+ autoplay: false,
+ // Only allow one media playing at once (vimeo only)
+ autopause: true,
+ // Allow inline playback on iOS (this effects YouTube/Vimeo - HTML5 requires the attribute present)
+ // TODO: Remove iosNative fullscreen option in favour of this (logic needs work)
+ playsinline: true,
+ // Default time to skip when rewind/fast forward
+ seekTime: 10,
+ // Default volume
+ volume: 1,
+ muted: false,
+ // Pass a custom duration
+ duration: null,
+ // Display the media duration on load in the current time position
+ // If you have opted to display both duration and currentTime, this is ignored
+ displayDuration: true,
+ // Invert the current time to be a countdown
+ invertTime: true,
+ // Clicking the currentTime inverts it's value to show time left rather than elapsed
+ toggleInvert: true,
+ // Force an aspect ratio
+ // The format must be `'w:h'` (e.g. `'16:9'`)
+ ratio: null,
+ // Click video container to play/pause
+ clickToPlay: true,
+ // Auto hide the controls
+ hideControls: true,
+ // Reset to start when playback ended
+ resetOnEnd: false,
+ // Disable the standard context menu
+ disableContextMenu: true,
+ // Sprite (for icons)
+ loadSprite: true,
+ iconPrefix: 'plyr',
+ iconUrl: '/theme/modules/plyr/plyr.svg',
+ // Blank video (used to prevent errors on source change)
+ blankVideo: '/theme/modules/plyr/blank.webm',
+ // Quality default
+ quality: {
+ default: 576,
+ // The options to display in the UI, if available for the source media
+ options: [4320, 2880, 2160, 1440, 1080, 720, 576, 480, 360, 240],
+ forced: false,
+ onChange: null
+ },
+ // Set loops
+ loop: {
+ active: false // start: null,
+ // end: null,
+
+ },
+ // Speed default and options to display
+ speed: {
+ selected: 1,
+ // The options to display in the UI, if available for the source media (e.g. Vimeo and YouTube only support 0.5x-4x)
+ options: [0.5, 0.75, 1, 1.25, 1.5, 1.75, 2, 4]
+ },
+ // Keyboard shortcut settings
+ keyboard: {
+ focused: true,
+ global: false
+ },
+ // Display tooltips
+ tooltips: {
+ controls: false,
+ seek: true
+ },
+ // Captions settings
+ captions: {
+ active: false,
+ language: 'auto',
+ // Listen to new tracks added after Plyr is initialized.
+ // This is needed for streaming captions, but may result in unselectable options
+ update: false
+ },
+ // Fullscreen settings
+ fullscreen: {
+ enabled: true,
+ // Allow fullscreen?
+ fallback: true,
+ // Fallback using full viewport/window
+ iosNative: false // Use the native fullscreen in iOS (disables custom controls)
+ // Selector for the fullscreen container so contextual / non-player content can remain visible in fullscreen mode
+ // Non-ancestors of the player element will be ignored
+ // container: null, // defaults to the player element
+
+ },
+ // Local storage
+ storage: {
+ enabled: true,
+ key: 'plyr'
+ },
+ // Default controls
+ controls: ['play-large', // 'restart',
+ // 'rewind',
+ 'play', // 'fast-forward',
+ 'progress', 'current-time', // 'duration',
+ 'mute', 'volume', 'captions', 'settings', 'pip', 'airplay', // 'download',
+ 'fullscreen'],
+ settings: ['captions', 'quality', 'speed'],
+ // Localisation
+ i18n: {
+ restart: 'Restart',
+ rewind: 'Rewind {seektime}s',
+ play: 'Play',
+ pause: 'Pause',
+ fastForward: 'Forward {seektime}s',
+ seek: 'Seek',
+ seekLabel: '{currentTime} of {duration}',
+ played: 'Played',
+ buffered: 'Buffered',
+ currentTime: 'Current time',
+ duration: 'Duration',
+ volume: 'Volume',
+ mute: 'Mute',
+ unmute: 'Unmute',
+ enableCaptions: 'Enable captions',
+ disableCaptions: 'Disable captions',
+ download: 'Download',
+ enterFullscreen: 'Enter fullscreen',
+ exitFullscreen: 'Exit fullscreen',
+ frameTitle: 'Player for {title}',
+ captions: 'Captions',
+ settings: 'Settings',
+ pip: 'PIP',
+ menuBack: 'Go back to previous menu',
+ speed: 'Speed',
+ normal: 'Normal',
+ quality: 'Quality',
+ loop: 'Loop',
+ start: 'Start',
+ end: 'End',
+ all: 'All',
+ reset: 'Reset',
+ disabled: 'Disabled',
+ enabled: 'Enabled',
+ advertisement: 'Ad',
+ qualityBadge: {
+ 2160: '4K',
+ 1440: 'HD',
+ 1080: 'HD',
+ 720: 'HD',
+ 576: 'SD',
+ 480: 'SD'
+ }
+ },
+ // URLs
+ urls: {
+ download: null,
+ vimeo: {
+ sdk: 'https://player.vimeo.com/api/player.js',
+ iframe: 'https://player.vimeo.com/video/{0}?{1}',
+ api: 'https://vimeo.com/api/v2/video/{0}.json'
+ },
+ youtube: {
+ sdk: 'https://www.youtube.com/iframe_api',
+ api: 'https://noembed.com/embed?url=https://www.youtube.com/watch?v={0}'
+ },
+ googleIMA: {
+ sdk: 'https://imasdk.googleapis.com/js/sdkloader/ima3.js'
+ }
+ },
+ // Custom control listeners
+ listeners: {
+ seek: null,
+ play: null,
+ pause: null,
+ restart: null,
+ rewind: null,
+ fastForward: null,
+ mute: null,
+ volume: null,
+ captions: null,
+ download: null,
+ fullscreen: null,
+ pip: null,
+ airplay: null,
+ speed: null,
+ quality: null,
+ loop: null,
+ language: null
+ },
+ // Events to watch and bubble
+ events: [// Events to watch on HTML5 media elements and bubble
+ // https://developer.mozilla.org/en/docs/Web/Guide/Events/Media_events
+ 'ended', 'progress', 'stalled', 'playing', 'waiting', 'canplay', 'canplaythrough', 'loadstart', 'loadeddata', 'loadedmetadata', 'timeupdate', 'volumechange', 'play', 'pause', 'error', 'seeking', 'seeked', 'emptied', 'ratechange', 'cuechange', // Custom events
+ 'download', 'enterfullscreen', 'exitfullscreen', 'captionsenabled', 'captionsdisabled', 'languagechange', 'controlshidden', 'controlsshown', 'ready', // YouTube
+ 'statechange', // Quality
+ 'qualitychange', // Ads
+ 'adsloaded', 'adscontentpause', 'adscontentresume', 'adstarted', 'adsmidpoint', 'adscomplete', 'adsallcomplete', 'adsimpression', 'adsclick'],
+ // Selectors
+ // Change these to match your template if using custom HTML
+ selectors: {
+ editable: 'input, textarea, select, [contenteditable]',
+ container: '.plyr',
+ controls: {
+ container: null,
+ wrapper: '.plyr__controls'
+ },
+ labels: '[data-plyr]',
+ buttons: {
+ play: '[data-plyr="play"]',
+ pause: '[data-plyr="pause"]',
+ restart: '[data-plyr="restart"]',
+ rewind: '[data-plyr="rewind"]',
+ fastForward: '[data-plyr="fast-forward"]',
+ mute: '[data-plyr="mute"]',
+ captions: '[data-plyr="captions"]',
+ download: '[data-plyr="download"]',
+ fullscreen: '[data-plyr="fullscreen"]',
+ pip: '[data-plyr="pip"]',
+ airplay: '[data-plyr="airplay"]',
+ settings: '[data-plyr="settings"]',
+ loop: '[data-plyr="loop"]'
+ },
+ inputs: {
+ seek: '[data-plyr="seek"]',
+ volume: '[data-plyr="volume"]',
+ speed: '[data-plyr="speed"]',
+ language: '[data-plyr="language"]',
+ quality: '[data-plyr="quality"]'
+ },
+ display: {
+ currentTime: '.plyr__time--current',
+ duration: '.plyr__time--duration',
+ buffer: '.plyr__progress__buffer',
+ loop: '.plyr__progress__loop',
+ // Used later
+ volume: '.plyr__volume--display'
+ },
+ progress: '.plyr__progress',
+ captions: '.plyr__captions',
+ caption: '.plyr__caption'
+ },
+ // Class hooks added to the player in different states
+ classNames: {
+ type: 'plyr--{0}',
+ provider: 'plyr--{0}',
+ video: 'plyr__video-wrapper',
+ embed: 'plyr__video-embed',
+ videoFixedRatio: 'plyr__video-wrapper--fixed-ratio',
+ embedContainer: 'plyr__video-embed__container',
+ poster: 'plyr__poster',
+ posterEnabled: 'plyr__poster-enabled',
+ ads: 'plyr__ads',
+ control: 'plyr__control',
+ controlPressed: 'plyr__control--pressed',
+ playing: 'plyr--playing',
+ paused: 'plyr--paused',
+ stopped: 'plyr--stopped',
+ loading: 'plyr--loading',
+ hover: 'plyr--hover',
+ tooltip: 'plyr__tooltip',
+ cues: 'plyr__cues',
+ hidden: 'plyr__sr-only',
+ hideControls: 'plyr--hide-controls',
+ isIos: 'plyr--is-ios',
+ isTouch: 'plyr--is-touch',
+ uiSupported: 'plyr--full-ui',
+ noTransition: 'plyr--no-transition',
+ display: {
+ time: 'plyr__time'
+ },
+ menu: {
+ value: 'plyr__menu__value',
+ badge: 'plyr__badge',
+ open: 'plyr--menu-open'
+ },
+ captions: {
+ enabled: 'plyr--captions-enabled',
+ active: 'plyr--captions-active'
+ },
+ fullscreen: {
+ enabled: 'plyr--fullscreen-enabled',
+ fallback: 'plyr--fullscreen-fallback'
+ },
+ pip: {
+ supported: 'plyr--pip-supported',
+ active: 'plyr--pip-active'
+ },
+ airplay: {
+ supported: 'plyr--airplay-supported',
+ active: 'plyr--airplay-active'
+ },
+ tabFocus: 'plyr__tab-focus',
+ previewThumbnails: {
+ // Tooltip thumbs
+ thumbContainer: 'plyr__preview-thumb',
+ thumbContainerShown: 'plyr__preview-thumb--is-shown',
+ imageContainer: 'plyr__preview-thumb__image-container',
+ timeContainer: 'plyr__preview-thumb__time-container',
+ // Scrubbing
+ scrubbingContainer: 'plyr__preview-scrubbing',
+ scrubbingContainerShown: 'plyr__preview-scrubbing--is-shown'
+ }
+ },
+ // Embed attributes
+ attributes: {
+ embed: {
+ provider: 'data-plyr-provider',
+ id: 'data-plyr-embed-id'
+ }
+ },
+ // Advertisements plugin
+ // Register for an account here: http://vi.ai/publisher-video-monetization/?aid=plyrio
+ ads: {
+ enabled: false,
+ publisherId: '',
+ tagUrl: ''
+ },
+ // Preview Thumbnails plugin
+ previewThumbnails: {
+ enabled: false,
+ src: ''
+ },
+ // Vimeo plugin
+ vimeo: {
+ byline: false,
+ portrait: false,
+ title: false,
+ speed: true,
+ transparent: false,
+ // Whether the owner of the video has a Pro or Business account
+ // (which allows us to properly hide controls without CSS hacks, etc)
+ premium: false,
+ // Custom settings from Plyr
+ referrerPolicy: null // https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement/referrerPolicy
+
+ },
+ // YouTube plugin
+ youtube: {
+ noCookie: true,
+ // Whether to use an alternative version of YouTube without cookies
+ rel: 0,
+ // No related vids
+ showinfo: 0,
+ // Hide info
+ iv_load_policy: 3,
+ // Hide annotations
+ modestbranding: 1 // Hide logos as much as possible (they still show one in the corner when paused)
+
+ }
+};
+
+// ==========================================================================
+// Plyr states
+// ==========================================================================
+var pip = {
+ active: 'picture-in-picture',
+ inactive: 'inline'
+};
+
+// ==========================================================================
+// Plyr supported types and providers
+// ==========================================================================
+var providers = {
+ html5: 'html5',
+ youtube: 'youtube',
+ vimeo: 'vimeo'
+};
+var types = {
+ audio: 'audio',
+ video: 'video'
+};
+/**
+ * Get provider by URL
+ * @param {String} url
+ */
+
+function getProviderByUrl(url) {
+ // YouTube
+ if (/^(https?:\/\/)?(www\.)?(youtube\.com|youtube-nocookie\.com|youtu\.?be)\/.+$/.test(url)) {
+ return providers.youtube;
+ } // Vimeo
+
+
+ if (/^https?:\/\/player.vimeo.com\/video\/\d{0,9}(?=\b|\/)/.test(url)) {
+ return providers.vimeo;
+ }
+
+ return null;
+}
+
+// ==========================================================================
+// Console wrapper
+// ==========================================================================
+var noop = function noop() {};
+
+var Console = /*#__PURE__*/function () {
+ function Console() {
+ var enabled = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
+
+ _classCallCheck(this, Console);
+
+ this.enabled = window.console && enabled;
+
+ if (this.enabled) {
+ this.log('Debugging enabled');
+ }
+ }
+
+ _createClass(Console, [{
+ key: "log",
+ get: function get() {
+ // eslint-disable-next-line no-console
+ return this.enabled ? Function.prototype.bind.call(console.log, console) : noop;
+ }
+ }, {
+ key: "warn",
+ get: function get() {
+ // eslint-disable-next-line no-console
+ return this.enabled ? Function.prototype.bind.call(console.warn, console) : noop;
+ }
+ }, {
+ key: "error",
+ get: function get() {
+ // eslint-disable-next-line no-console
+ return this.enabled ? Function.prototype.bind.call(console.error, console) : noop;
+ }
+ }]);
+
+ return Console;
+}();
+
+var Fullscreen = /*#__PURE__*/function () {
+ function Fullscreen(player) {
+ var _this = this;
+
+ _classCallCheck(this, Fullscreen);
+
+ // Keep reference to parent
+ this.player = player; // Get prefix
+
+ this.prefix = Fullscreen.prefix;
+ this.property = Fullscreen.property; // Scroll position
+
+ this.scrollPosition = {
+ x: 0,
+ y: 0
+ }; // Force the use of 'full window/browser' rather than fullscreen
+
+ this.forceFallback = player.config.fullscreen.fallback === 'force'; // Get the fullscreen element
+ // Checks container is an ancestor, defaults to null
+
+ this.player.elements.fullscreen = player.config.fullscreen.container && closest(this.player.elements.container, player.config.fullscreen.container); // Register event listeners
+ // Handle event (incase user presses escape etc)
+
+ on.call(this.player, document, this.prefix === 'ms' ? 'MSFullscreenChange' : "".concat(this.prefix, "fullscreenchange"), function () {
+ // TODO: Filter for target??
+ _this.onChange();
+ }); // Fullscreen toggle on double click
+
+ on.call(this.player, this.player.elements.container, 'dblclick', function (event) {
+ // Ignore double click in controls
+ if (is$1.element(_this.player.elements.controls) && _this.player.elements.controls.contains(event.target)) {
+ return;
+ }
+
+ _this.toggle();
+ }); // Tap focus when in fullscreen
+
+ on.call(this, this.player.elements.container, 'keydown', function (event) {
+ return _this.trapFocus(event);
+ }); // Update the UI
+
+ this.update();
+ } // Determine if native supported
+
+
+ _createClass(Fullscreen, [{
+ key: "onChange",
+ value: function onChange() {
+ if (!this.enabled) {
+ return;
+ } // Update toggle button
+
+
+ var button = this.player.elements.buttons.fullscreen;
+
+ if (is$1.element(button)) {
+ button.pressed = this.active;
+ } // Trigger an event
+
+
+ triggerEvent.call(this.player, this.target, this.active ? 'enterfullscreen' : 'exitfullscreen', true);
+ }
+ }, {
+ key: "toggleFallback",
+ value: function toggleFallback() {
+ var toggle = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
+
+ // Store or restore scroll position
+ if (toggle) {
+ this.scrollPosition = {
+ x: window.scrollX || 0,
+ y: window.scrollY || 0
+ };
+ } else {
+ window.scrollTo(this.scrollPosition.x, this.scrollPosition.y);
+ } // Toggle scroll
+
+
+ document.body.style.overflow = toggle ? 'hidden' : ''; // Toggle class hook
+
+ toggleClass(this.target, this.player.config.classNames.fullscreen.fallback, toggle); // Force full viewport on iPhone X+
+
+ if (browser.isIos) {
+ var viewport = document.head.querySelector('meta[name="viewport"]');
+ var property = 'viewport-fit=cover'; // Inject the viewport meta if required
+
+ if (!viewport) {
+ viewport = document.createElement('meta');
+ viewport.setAttribute('name', 'viewport');
+ } // Check if the property already exists
+
+
+ var hasProperty = is$1.string(viewport.content) && viewport.content.includes(property);
+
+ if (toggle) {
+ this.cleanupViewport = !hasProperty;
+
+ if (!hasProperty) {
+ viewport.content += ",".concat(property);
+ }
+ } else if (this.cleanupViewport) {
+ viewport.content = viewport.content.split(',').filter(function (part) {
+ return part.trim() !== property;
+ }).join(',');
+ }
+ } // Toggle button and fire events
+
+
+ this.onChange();
+ } // Trap focus inside container
+
+ }, {
+ key: "trapFocus",
+ value: function trapFocus(event) {
+ // Bail if iOS, not active, not the tab key
+ if (browser.isIos || !this.active || event.key !== 'Tab' || event.keyCode !== 9) {
+ return;
+ } // Get the current focused element
+
+
+ var focused = document.activeElement;
+ var focusable = getElements.call(this.player, 'a[href], button:not(:disabled), input:not(:disabled), [tabindex]');
+
+ var _focusable = _slicedToArray(focusable, 1),
+ first = _focusable[0];
+
+ var last = focusable[focusable.length - 1];
+
+ if (focused === last && !event.shiftKey) {
+ // Move focus to first element that can be tabbed if Shift isn't used
+ first.focus();
+ event.preventDefault();
+ } else if (focused === first && event.shiftKey) {
+ // Move focus to last element that can be tabbed if Shift is used
+ last.focus();
+ event.preventDefault();
+ }
+ } // Update UI
+
+ }, {
+ key: "update",
+ value: function update() {
+ if (this.enabled) {
+ var mode;
+
+ if (this.forceFallback) {
+ mode = 'Fallback (forced)';
+ } else if (Fullscreen.native) {
+ mode = 'Native';
+ } else {
+ mode = 'Fallback';
+ }
+
+ this.player.debug.log("".concat(mode, " fullscreen enabled"));
+ } else {
+ this.player.debug.log('Fullscreen not supported and fallback disabled');
+ } // Add styling hook to show button
+
+
+ toggleClass(this.player.elements.container, this.player.config.classNames.fullscreen.enabled, this.enabled);
+ } // Make an element fullscreen
+
+ }, {
+ key: "enter",
+ value: function enter() {
+ if (!this.enabled) {
+ return;
+ } // iOS native fullscreen doesn't need the request step
+
+
+ if (browser.isIos && this.player.config.fullscreen.iosNative) {
+ this.target.webkitEnterFullscreen();
+ } else if (!Fullscreen.native || this.forceFallback) {
+ this.toggleFallback(true);
+ } else if (!this.prefix) {
+ this.target.requestFullscreen({
+ navigationUI: 'hide'
+ });
+ } else if (!is$1.empty(this.prefix)) {
+ this.target["".concat(this.prefix, "Request").concat(this.property)]();
+ }
+ } // Bail from fullscreen
+
+ }, {
+ key: "exit",
+ value: function exit() {
+ if (!this.enabled) {
+ return;
+ } // iOS native fullscreen
+
+
+ if (browser.isIos && this.player.config.fullscreen.iosNative) {
+ this.target.webkitExitFullscreen();
+ silencePromise(this.player.play());
+ } else if (!Fullscreen.native || this.forceFallback) {
+ this.toggleFallback(false);
+ } else if (!this.prefix) {
+ (document.cancelFullScreen || document.exitFullscreen).call(document);
+ } else if (!is$1.empty(this.prefix)) {
+ var action = this.prefix === 'moz' ? 'Cancel' : 'Exit';
+ document["".concat(this.prefix).concat(action).concat(this.property)]();
+ }
+ } // Toggle state
+
+ }, {
+ key: "toggle",
+ value: function toggle() {
+ if (!this.active) {
+ this.enter();
+ } else {
+ this.exit();
+ }
+ }
+ }, {
+ key: "usingNative",
+ // If we're actually using native
+ get: function get() {
+ return Fullscreen.native && !this.forceFallback;
+ } // Get the prefix for handlers
+
+ }, {
+ key: "enabled",
+ // Determine if fullscreen is enabled
+ get: function get() {
+ return (Fullscreen.native || this.player.config.fullscreen.fallback) && this.player.config.fullscreen.enabled && this.player.supported.ui && this.player.isVideo;
+ } // Get active state
+
+ }, {
+ key: "active",
+ get: function get() {
+ if (!this.enabled) {
+ return false;
+ } // Fallback using classname
+
+
+ if (!Fullscreen.native || this.forceFallback) {
+ return hasClass(this.target, this.player.config.classNames.fullscreen.fallback);
+ }
+
+ var element = !this.prefix ? document.fullscreenElement : document["".concat(this.prefix).concat(this.property, "Element")];
+ return element && element.shadowRoot ? element === this.target.getRootNode().host : element === this.target;
+ } // Get target element
+
+ }, {
+ key: "target",
+ get: function get() {
+ return browser.isIos && this.player.config.fullscreen.iosNative ? this.player.media : this.player.elements.fullscreen || this.player.elements.container;
+ }
+ }], [{
+ key: "native",
+ get: function get() {
+ return !!(document.fullscreenEnabled || document.webkitFullscreenEnabled || document.mozFullScreenEnabled || document.msFullscreenEnabled);
+ }
+ }, {
+ key: "prefix",
+ get: function get() {
+ // No prefix
+ if (is$1.function(document.exitFullscreen)) {
+ return '';
+ } // Check for fullscreen support by vendor prefix
+
+
+ var value = '';
+ var prefixes = ['webkit', 'moz', 'ms'];
+ prefixes.some(function (pre) {
+ if (is$1.function(document["".concat(pre, "ExitFullscreen")]) || is$1.function(document["".concat(pre, "CancelFullScreen")])) {
+ value = pre;
+ return true;
+ }
+
+ return false;
+ });
+ return value;
+ }
+ }, {
+ key: "property",
+ get: function get() {
+ return this.prefix === 'moz' ? 'FullScreen' : 'Fullscreen';
+ }
+ }]);
+
+ return Fullscreen;
+}();
+
+// `Math.sign` method implementation
+// https://tc39.github.io/ecma262/#sec-math.sign
+var mathSign = Math.sign || function sign(x) {
+ // eslint-disable-next-line no-self-compare
+ return (x = +x) == 0 || x != x ? x : x < 0 ? -1 : 1;
+};
+
+// `Math.sign` method
+// https://tc39.github.io/ecma262/#sec-math.sign
+_export({ target: 'Math', stat: true }, {
+ sign: mathSign
+});
+
+// ==========================================================================
+// Load image avoiding xhr/fetch CORS issues
+// Server status can't be obtained this way unfortunately, so this uses "naturalWidth" to determine if the image has loaded
+// By default it checks if it is at least 1px, but you can add a second argument to change this
+// ==========================================================================
+function loadImage(src) {
+ var minWidth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
+ return new Promise(function (resolve, reject) {
+ var image = new Image();
+
+ var handler = function handler() {
+ delete image.onload;
+ delete image.onerror;
+ (image.naturalWidth >= minWidth ? resolve : reject)(image);
+ };
+
+ Object.assign(image, {
+ onload: handler,
+ onerror: handler,
+ src: src
+ });
+ });
+}
+
+var ui = {
+ addStyleHook: function addStyleHook() {
+ toggleClass(this.elements.container, this.config.selectors.container.replace('.', ''), true);
+ toggleClass(this.elements.container, this.config.classNames.uiSupported, this.supported.ui);
+ },
+ // Toggle native HTML5 media controls
+ toggleNativeControls: function toggleNativeControls() {
+ var toggle = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
+
+ if (toggle && this.isHTML5) {
+ this.media.setAttribute('controls', '');
+ } else {
+ this.media.removeAttribute('controls');
+ }
+ },
+ // Setup the UI
+ build: function build() {
+ var _this = this;
+
+ // Re-attach media element listeners
+ // TODO: Use event bubbling?
+ this.listeners.media(); // Don't setup interface if no support
+
+ if (!this.supported.ui) {
+ this.debug.warn("Basic support only for ".concat(this.provider, " ").concat(this.type)); // Restore native controls
+
+ ui.toggleNativeControls.call(this, true); // Bail
+
+ return;
+ } // Inject custom controls if not present
+
+
+ if (!is$1.element(this.elements.controls)) {
+ // Inject custom controls
+ controls.inject.call(this); // Re-attach control listeners
+
+ this.listeners.controls();
+ } // Remove native controls
+
+
+ ui.toggleNativeControls.call(this); // Setup captions for HTML5
+
+ if (this.isHTML5) {
+ captions.setup.call(this);
+ } // Reset volume
+
+
+ this.volume = null; // Reset mute state
+
+ this.muted = null; // Reset loop state
+
+ this.loop = null; // Reset quality setting
+
+ this.quality = null; // Reset speed
+
+ this.speed = null; // Reset volume display
+
+ controls.updateVolume.call(this); // Reset time display
+
+ controls.timeUpdate.call(this); // Update the UI
+
+ ui.checkPlaying.call(this); // Check for picture-in-picture support
+
+ toggleClass(this.elements.container, this.config.classNames.pip.supported, support.pip && this.isHTML5 && this.isVideo); // Check for airplay support
+
+ toggleClass(this.elements.container, this.config.classNames.airplay.supported, support.airplay && this.isHTML5); // Add iOS class
+
+ toggleClass(this.elements.container, this.config.classNames.isIos, browser.isIos); // Add touch class
+
+ toggleClass(this.elements.container, this.config.classNames.isTouch, this.touch); // Ready for API calls
+
+ this.ready = true; // Ready event at end of execution stack
+
+ setTimeout(function () {
+ triggerEvent.call(_this, _this.media, 'ready');
+ }, 0); // Set the title
+
+ ui.setTitle.call(this); // Assure the poster image is set, if the property was added before the element was created
+
+ if (this.poster) {
+ ui.setPoster.call(this, this.poster, false).catch(function () {});
+ } // Manually set the duration if user has overridden it.
+ // The event listeners for it doesn't get called if preload is disabled (#701)
+
+
+ if (this.config.duration) {
+ controls.durationUpdate.call(this);
+ }
+ },
+ // Setup aria attribute for play and iframe title
+ setTitle: function setTitle() {
+ // Find the current text
+ var label = i18n.get('play', this.config); // If there's a media title set, use that for the label
+
+ if (is$1.string(this.config.title) && !is$1.empty(this.config.title)) {
+ label += ", ".concat(this.config.title);
+ } // If there's a play button, set label
+
+
+ Array.from(this.elements.buttons.play || []).forEach(function (button) {
+ button.setAttribute('aria-label', label);
+ }); // Set iframe title
+ // https://github.com/sampotts/plyr/issues/124
+
+ if (this.isEmbed) {
+ var iframe = getElement.call(this, 'iframe');
+
+ if (!is$1.element(iframe)) {
+ return;
+ } // Default to media type
+
+
+ var title = !is$1.empty(this.config.title) ? this.config.title : 'video';
+ var format = i18n.get('frameTitle', this.config);
+ iframe.setAttribute('title', format.replace('{title}', title));
+ }
+ },
+ // Toggle poster
+ togglePoster: function togglePoster(enable) {
+ toggleClass(this.elements.container, this.config.classNames.posterEnabled, enable);
+ },
+ // Set the poster image (async)
+ // Used internally for the poster setter, with the passive option forced to false
+ setPoster: function setPoster(poster) {
+ var _this2 = this;
+
+ var passive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
+
+ // Don't override if call is passive
+ if (passive && this.poster) {
+ return Promise.reject(new Error('Poster already set'));
+ } // Set property synchronously to respect the call order
+
+
+ this.media.setAttribute('data-poster', poster); // Wait until ui is ready
+
+ return ready.call(this) // Load image
+ .then(function () {
+ return loadImage(poster);
+ }).catch(function (err) {
+ // Hide poster on error unless it's been set by another call
+ if (poster === _this2.poster) {
+ ui.togglePoster.call(_this2, false);
+ } // Rethrow
+
+
+ throw err;
+ }).then(function () {
+ // Prevent race conditions
+ if (poster !== _this2.poster) {
+ throw new Error('setPoster cancelled by later call to setPoster');
+ }
+ }).then(function () {
+ Object.assign(_this2.elements.poster.style, {
+ backgroundImage: "url('".concat(poster, "')"),
+ // Reset backgroundSize as well (since it can be set to "cover" for padded thumbnails for youtube)
+ backgroundSize: ''
+ });
+ ui.togglePoster.call(_this2, true);
+ return poster;
+ });
+ },
+ // Check playing state
+ checkPlaying: function checkPlaying(event) {
+ var _this3 = this;
+
+ // Class hooks
+ toggleClass(this.elements.container, this.config.classNames.playing, this.playing);
+ toggleClass(this.elements.container, this.config.classNames.paused, this.paused);
+ toggleClass(this.elements.container, this.config.classNames.stopped, this.stopped); // Set state
+
+ Array.from(this.elements.buttons.play || []).forEach(function (target) {
+ Object.assign(target, {
+ pressed: _this3.playing
+ });
+ target.setAttribute('aria-label', i18n.get(_this3.playing ? 'pause' : 'play', _this3.config));
+ }); // Only update controls on non timeupdate events
+
+ if (is$1.event(event) && event.type === 'timeupdate') {
+ return;
+ } // Toggle controls
+
+
+ ui.toggleControls.call(this);
+ },
+ // Check if media is loading
+ checkLoading: function checkLoading(event) {
+ var _this4 = this;
+
+ this.loading = ['stalled', 'waiting'].includes(event.type); // Clear timer
+
+ clearTimeout(this.timers.loading); // Timer to prevent flicker when seeking
+
+ this.timers.loading = setTimeout(function () {
+ // Update progress bar loading class state
+ toggleClass(_this4.elements.container, _this4.config.classNames.loading, _this4.loading); // Update controls visibility
+
+ ui.toggleControls.call(_this4);
+ }, this.loading ? 250 : 0);
+ },
+ // Toggle controls based on state and `force` argument
+ toggleControls: function toggleControls(force) {
+ var controlsElement = this.elements.controls;
+
+ if (controlsElement && this.config.hideControls) {
+ // 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.)
+ var recentTouchSeek = this.touch && this.lastSeekTime + 2000 > Date.now(); // Show controls if force, loading, paused, button interaction, or recent seek, otherwise hide
+
+ this.toggleControls(Boolean(force || this.loading || this.paused || controlsElement.pressed || controlsElement.hover || recentTouchSeek));
+ }
+ },
+ // Migrate any custom properties from the media to the parent
+ migrateStyles: function migrateStyles() {
+ var _this5 = this;
+
+ // Loop through values (as they are the keys when the object is spread 🤔)
+ Object.values(_objectSpread2({}, this.media.style)) // We're only fussed about Plyr specific properties
+ .filter(function (key) {
+ return !is$1.empty(key) && key.startsWith('--plyr');
+ }).forEach(function (key) {
+ // Set on the container
+ _this5.elements.container.style.setProperty(key, _this5.media.style.getPropertyValue(key)); // Clean up from media element
+
+
+ _this5.media.style.removeProperty(key);
+ }); // Remove attribute if empty
+
+ if (is$1.empty(this.media.style)) {
+ this.media.removeAttribute('style');
+ }
+ }
+};
+
+var Listeners = /*#__PURE__*/function () {
+ function Listeners(player) {
+ _classCallCheck(this, Listeners);
+
+ this.player = player;
+ this.lastKey = null;
+ this.focusTimer = null;
+ this.lastKeyDown = null;
+ this.handleKey = this.handleKey.bind(this);
+ this.toggleMenu = this.toggleMenu.bind(this);
+ this.setTabFocus = this.setTabFocus.bind(this);
+ this.firstTouch = this.firstTouch.bind(this);
+ } // Handle key presses
+
+
+ _createClass(Listeners, [{
+ key: "handleKey",
+ value: function handleKey(event) {
+ var player = this.player;
+ var elements = player.elements;
+ var code = event.keyCode ? event.keyCode : event.which;
+ var pressed = event.type === 'keydown';
+ var repeat = pressed && code === this.lastKey; // Bail if a modifier key is set
+
+ if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) {
+ return;
+ } // If the event is bubbled from the media element
+ // Firefox doesn't get the keycode for whatever reason
+
+
+ if (!is$1.number(code)) {
+ return;
+ } // Seek by the number keys
+
+
+ var seekByKey = function seekByKey() {
+ // Divide the max duration into 10th's and times by the number value
+ player.currentTime = player.duration / 10 * (code - 48);
+ }; // Handle the key on keydown
+ // Reset on keyup
+
+
+ if (pressed) {
+ // Check focused element
+ // and if the focused element is not editable (e.g. text input)
+ // and any that accept key input http://webaim.org/techniques/keyboard/
+ var focused = document.activeElement;
+
+ if (is$1.element(focused)) {
+ var editable = player.config.selectors.editable;
+ var seek = elements.inputs.seek;
+
+ if (focused !== seek && matches$1(focused, editable)) {
+ return;
+ }
+
+ if (event.which === 32 && matches$1(focused, 'button, [role^="menuitem"]')) {
+ return;
+ }
+ } // Which keycodes should we prevent default
+
+
+ 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)
+
+ if (preventDefault.includes(code)) {
+ event.preventDefault();
+ event.stopPropagation();
+ }
+
+ switch (code) {
+ case 48:
+ case 49:
+ case 50:
+ case 51:
+ case 52:
+ case 53:
+ case 54:
+ case 55:
+ case 56:
+ case 57:
+ // 0-9
+ if (!repeat) {
+ seekByKey();
+ }
+
+ break;
+
+ case 32:
+ case 75:
+ // Space and K key
+ if (!repeat) {
+ silencePromise(player.togglePlay());
+ }
+
+ break;
+
+ case 38:
+ // Arrow up
+ player.increaseVolume(0.1);
+ break;
+
+ case 40:
+ // Arrow down
+ player.decreaseVolume(0.1);
+ break;
+
+ case 77:
+ // M key
+ if (!repeat) {
+ player.muted = !player.muted;
+ }
+
+ break;
+
+ case 39:
+ // Arrow forward
+ player.forward();
+ break;
+
+ case 37:
+ // Arrow back
+ player.rewind();
+ break;
+
+ case 70:
+ // F key
+ player.fullscreen.toggle();
+ break;
+
+ case 67:
+ // C key
+ if (!repeat) {
+ player.toggleCaptions();
+ }
+
+ break;
+
+ case 76:
+ // L key
+ player.loop = !player.loop;
+ break;
+ } // Escape is handle natively when in full screen
+ // So we only need to worry about non native
+
+
+ if (code === 27 && !player.fullscreen.usingNative && player.fullscreen.active) {
+ player.fullscreen.toggle();
+ } // Store last code for next cycle
+
+
+ this.lastKey = code;
+ } else {
+ this.lastKey = null;
+ }
+ } // Toggle menu
+
+ }, {
+ key: "toggleMenu",
+ value: function toggleMenu(event) {
+ controls.toggleMenu.call(this.player, event);
+ } // Device is touch enabled
+
+ }, {
+ key: "firstTouch",
+ value: function firstTouch() {
+ var player = this.player;
+ var elements = player.elements;
+ player.touch = true; // Add touch class
+
+ toggleClass(elements.container, player.config.classNames.isTouch, true);
+ }
+ }, {
+ key: "setTabFocus",
+ value: function setTabFocus(event) {
+ var player = this.player;
+ var elements = player.elements;
+ clearTimeout(this.focusTimer); // Ignore any key other than tab
+
+ if (event.type === 'keydown' && event.which !== 9) {
+ return;
+ } // Store reference to event timeStamp
+
+
+ if (event.type === 'keydown') {
+ this.lastKeyDown = event.timeStamp;
+ } // Remove current classes
+
+
+ var removeCurrent = function removeCurrent() {
+ var className = player.config.classNames.tabFocus;
+ var current = getElements.call(player, ".".concat(className));
+ toggleClass(current, className, false);
+ }; // Determine if a key was pressed to trigger this event
+
+
+ var wasKeyDown = event.timeStamp - this.lastKeyDown <= 20; // Ignore focus events if a key was pressed prior
+
+ if (event.type === 'focus' && !wasKeyDown) {
+ return;
+ } // Remove all current
+
+
+ removeCurrent(); // Delay the adding of classname until the focus has changed
+ // This event fires before the focusin event
+
+ if (event.type !== 'focusout') {
+ this.focusTimer = setTimeout(function () {
+ var focused = document.activeElement; // Ignore if current focus element isn't inside the player
+
+ if (!elements.container.contains(focused)) {
+ return;
+ }
+
+ toggleClass(document.activeElement, player.config.classNames.tabFocus, true);
+ }, 10);
+ }
+ } // Global window & document listeners
+
+ }, {
+ key: "global",
+ value: function global() {
+ var toggle = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
+ var player = this.player; // Keyboard shortcuts
+
+ if (player.config.keyboard.global) {
+ toggleListener.call(player, window, 'keydown keyup', this.handleKey, toggle, false);
+ } // Click anywhere closes menu
+
+
+ toggleListener.call(player, document.body, 'click', this.toggleMenu, toggle); // Detect touch by events
+
+ once.call(player, document.body, 'touchstart', this.firstTouch); // Tab focus detection
+
+ toggleListener.call(player, document.body, 'keydown focus blur focusout', this.setTabFocus, toggle, false, true);
+ } // Container listeners
+
+ }, {
+ key: "container",
+ value: function container() {
+ var player = this.player;
+ var config = player.config,
+ elements = player.elements,
+ timers = player.timers; // Keyboard shortcuts
+
+ if (!config.keyboard.global && config.keyboard.focused) {
+ on.call(player, elements.container, 'keydown keyup', this.handleKey, false);
+ } // Toggle controls on mouse events and entering fullscreen
+
+
+ on.call(player, elements.container, 'mousemove mouseleave touchstart touchmove enterfullscreen exitfullscreen', function (event) {
+ var controlsElement = elements.controls; // Remove button states for fullscreen
+
+ if (controlsElement && event.type === 'enterfullscreen') {
+ controlsElement.pressed = false;
+ controlsElement.hover = false;
+ } // Show, then hide after a timeout unless another control event occurs
+
+
+ var show = ['touchstart', 'touchmove', 'mousemove'].includes(event.type);
+ var delay = 0;
+
+ if (show) {
+ ui.toggleControls.call(player, true); // Use longer timeout for touch devices
+
+ delay = player.touch ? 3000 : 2000;
+ } // Clear timer
+
+
+ clearTimeout(timers.controls); // Set new timer to prevent flicker when seeking
+
+ timers.controls = setTimeout(function () {
+ return ui.toggleControls.call(player, false);
+ }, delay);
+ }); // Set a gutter for Vimeo
+
+ var setGutter = function setGutter(ratio, padding, toggle) {
+ if (!player.isVimeo || player.config.vimeo.premium) {
+ return;
+ }
+
+ var target = player.elements.wrapper.firstChild;
+
+ var _ratio = _slicedToArray(ratio, 2),
+ y = _ratio[1];
+
+ var _getAspectRatio$call = getAspectRatio.call(player),
+ _getAspectRatio$call2 = _slicedToArray(_getAspectRatio$call, 2),
+ videoX = _getAspectRatio$call2[0],
+ videoY = _getAspectRatio$call2[1];
+
+ target.style.maxWidth = toggle ? "".concat(y / videoY * videoX, "px") : null;
+ target.style.margin = toggle ? '0 auto' : null;
+ }; // Resize on fullscreen change
+
+
+ var setPlayerSize = function setPlayerSize(measure) {
+ // If we don't need to measure the viewport
+ if (!measure) {
+ return setAspectRatio.call(player);
+ }
+
+ var rect = elements.container.getBoundingClientRect();
+ var width = rect.width,
+ height = rect.height;
+ return setAspectRatio.call(player, "".concat(width, ":").concat(height));
+ };
+
+ var resized = function resized() {
+ clearTimeout(timers.resized);
+ timers.resized = setTimeout(setPlayerSize, 50);
+ };
+
+ on.call(player, elements.container, 'enterfullscreen exitfullscreen', function (event) {
+ var _player$fullscreen = player.fullscreen,
+ target = _player$fullscreen.target,
+ usingNative = _player$fullscreen.usingNative; // Ignore events not from target
+
+ if (target !== elements.container) {
+ return;
+ } // If it's not an embed and no ratio specified
+
+
+ if (!player.isEmbed && is$1.empty(player.config.ratio)) {
+ return;
+ }
+
+ var isEnter = event.type === 'enterfullscreen'; // Set the player size when entering fullscreen to viewport size
+
+ var _setPlayerSize = setPlayerSize(isEnter),
+ padding = _setPlayerSize.padding,
+ ratio = _setPlayerSize.ratio; // Set Vimeo gutter
+
+
+ setGutter(ratio, padding, isEnter); // If not using native browser fullscreen API, we need to check for resizes of viewport
+
+ if (!usingNative) {
+ if (isEnter) {
+ on.call(player, window, 'resize', resized);
+ } else {
+ off.call(player, window, 'resize', resized);
+ }
+ }
+ });
+ } // Listen for media events
+
+ }, {
+ key: "media",
+ value: function media() {
+ var _this = this;
+
+ var player = this.player;
+ var elements = player.elements; // Time change on media
+
+ on.call(player, player.media, 'timeupdate seeking seeked', function (event) {
+ return controls.timeUpdate.call(player, event);
+ }); // Display duration
+
+ on.call(player, player.media, 'durationchange loadeddata loadedmetadata', function (event) {
+ return controls.durationUpdate.call(player, event);
+ }); // Handle the media finishing
+
+ on.call(player, player.media, 'ended', function () {
+ // Show poster on end
+ if (player.isHTML5 && player.isVideo && player.config.resetOnEnd) {
+ // Restart
+ player.restart(); // Call pause otherwise IE11 will start playing the video again
+
+ player.pause();
+ }
+ }); // Check for buffer progress
+
+ on.call(player, player.media, 'progress playing seeking seeked', function (event) {
+ return controls.updateProgress.call(player, event);
+ }); // Handle volume changes
+
+ on.call(player, player.media, 'volumechange', function (event) {
+ return controls.updateVolume.call(player, event);
+ }); // Handle play/pause
+
+ on.call(player, player.media, 'playing play pause ended emptied timeupdate', function (event) {
+ return ui.checkPlaying.call(player, event);
+ }); // Loading state
+
+ on.call(player, player.media, 'waiting canplay seeked playing', function (event) {
+ return ui.checkLoading.call(player, event);
+ }); // Click video
+
+ if (player.supported.ui && player.config.clickToPlay && !player.isAudio) {
+ // Re-fetch the wrapper
+ var wrapper = getElement.call(player, ".".concat(player.config.classNames.video)); // Bail if there's no wrapper (this should never happen)
+
+ if (!is$1.element(wrapper)) {
+ return;
+ } // On click play, pause or restart
+
+
+ on.call(player, elements.container, 'click', function (event) {
+ var targets = [elements.container, wrapper]; // Ignore if click if not container or in video wrapper
+
+ if (!targets.includes(event.target) && !wrapper.contains(event.target)) {
+ return;
+ } // Touch devices will just show controls (if hidden)
+
+
+ if (player.touch && player.config.hideControls) {
+ return;
+ }
+
+ if (player.ended) {
+ _this.proxy(event, player.restart, 'restart');
+
+ _this.proxy(event, function () {
+ silencePromise(player.play());
+ }, 'play');
+ } else {
+ _this.proxy(event, function () {
+ silencePromise(player.togglePlay());
+ }, 'play');
+ }
+ });
+ } // Disable right click
+
+
+ if (player.supported.ui && player.config.disableContextMenu) {
+ on.call(player, elements.wrapper, 'contextmenu', function (event) {
+ event.preventDefault();
+ }, false);
+ } // Volume change
+
+
+ on.call(player, player.media, 'volumechange', function () {
+ // Save to storage
+ player.storage.set({
+ volume: player.volume,
+ muted: player.muted
+ });
+ }); // Speed change
+
+ on.call(player, player.media, 'ratechange', function () {
+ // Update UI
+ controls.updateSetting.call(player, 'speed'); // Save to storage
+
+
+ player.storage.set({
+ speed: player.speed
+ });
+ }); // Quality change
+
+ on.call(player, player.media, 'qualitychange', function (event) {
+ // Update UI
+ controls.updateSetting.call(player, 'quality', null, event.detail.quality);
+ }); // Update download link when ready and if quality changes
+
+ on.call(player, player.media, 'ready qualitychange', function () {
+ controls.setDownloadUrl.call(player);
+ }); // Proxy events to container
+ // Bubble up key events for Edge
+
+ var proxyEvents = player.config.events.concat(['keyup', 'keydown']).join(' ');
+ on.call(player, player.media, proxyEvents, function (event) {
+ var _event$detail = event.detail,
+ detail = _event$detail === void 0 ? {} : _event$detail; // Get error details from media
+
+ if (event.type === 'error') {
+ detail = player.media.error;
+ }
+
+ triggerEvent.call(player, elements.container, event.type, true, detail);
+ });
+ } // Run default and custom handlers
+
+ }, {
+ key: "proxy",
+ value: function proxy(event, defaultHandler, customHandlerKey) {
+ var player = this.player;
+ var customHandler = player.config.listeners[customHandlerKey];
+ var hasCustomHandler = is$1.function(customHandler);
+ var returned = true; // Execute custom handler
+
+ if (hasCustomHandler) {
+ returned = customHandler.call(player, event);
+ } // Only call default handler if not prevented in custom handler
+
+
+ if (returned !== false && is$1.function(defaultHandler)) {
+ defaultHandler.call(player, event);
+ }
+ } // Trigger custom and default handlers
+
+ }, {
+ key: "bind",
+ value: function bind(element, type, defaultHandler, customHandlerKey) {
+ var _this2 = this;
+
+ var passive = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
+ var player = this.player;
+ var customHandler = player.config.listeners[customHandlerKey];
+ var hasCustomHandler = is$1.function(customHandler);
+ on.call(player, element, type, function (event) {
+ return _this2.proxy(event, defaultHandler, customHandlerKey);
+ }, passive && !hasCustomHandler);
+ } // Listen for control events
+
+ }, {
+ key: "controls",
+ value: function controls$1() {
+ var _this3 = this;
+
+ var player = this.player;
+ var elements = player.elements; // IE doesn't support input event, so we fallback to change
+
+ var inputEvent = browser.isIE ? 'change' : 'input'; // Play/pause toggle
+
+ if (elements.buttons.play) {
+ Array.from(elements.buttons.play).forEach(function (button) {
+ _this3.bind(button, 'click', function () {
+ silencePromise(player.togglePlay());
+ }, 'play');
+ });
+ } // Pause
+
+
+ this.bind(elements.buttons.restart, 'click', player.restart, 'restart'); // Rewind
+
+ this.bind(elements.buttons.rewind, 'click', player.rewind, 'rewind'); // Rewind
+
+ this.bind(elements.buttons.fastForward, 'click', player.forward, 'fastForward'); // Mute toggle
+
+ this.bind(elements.buttons.mute, 'click', function () {
+ player.muted = !player.muted;
+ }, 'mute'); // Captions toggle
+
+ this.bind(elements.buttons.captions, 'click', function () {
+ return player.toggleCaptions();
+ }); // Download
+
+ this.bind(elements.buttons.download, 'click', function () {
+ triggerEvent.call(player, player.media, 'download');
+ }, 'download'); // Fullscreen toggle
+
+ this.bind(elements.buttons.fullscreen, 'click', function () {
+ player.fullscreen.toggle();
+ }, 'fullscreen'); // Picture-in-Picture
+
+ this.bind(elements.buttons.pip, 'click', function () {
+ player.pip = 'toggle';
+ }, 'pip'); // Airplay
+
+ this.bind(elements.buttons.airplay, 'click', player.airplay, 'airplay'); // Settings menu - click toggle
+
+ this.bind(elements.buttons.settings, 'click', function (event) {
+ // Prevent the document click listener closing the menu
+ event.stopPropagation();
+ event.preventDefault();
+
+ controls.toggleMenu.call(player, event);
+ }, null, false); // Can't be passive as we're preventing default
+ // Settings menu - keyboard toggle
+ // We have to bind to keyup otherwise Firefox triggers a click when a keydown event handler shifts focus
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=1220143
+
+ this.bind(elements.buttons.settings, 'keyup', function (event) {
+ var code = event.which; // We only care about space and return
+
+ if (![13, 32].includes(code)) {
+ return;
+ } // Because return triggers a click anyway, all we need to do is set focus
+
+
+ if (code === 13) {
+ controls.focusFirstMenuItem.call(player, null, true);
+
+ return;
+ } // Prevent scroll
+
+
+ event.preventDefault(); // Prevent playing video (Firefox)
+
+ event.stopPropagation(); // Toggle menu
+
+ controls.toggleMenu.call(player, event);
+ }, null, false // Can't be passive as we're preventing default
+ ); // Escape closes menu
+
+ this.bind(elements.settings.menu, 'keydown', function (event) {
+ if (event.which === 27) {
+ controls.toggleMenu.call(player, event);
+ }
+ }); // Set range input alternative "value", which matches the tooltip time (#954)
+
+ this.bind(elements.inputs.seek, 'mousedown mousemove', function (event) {
+ var rect = elements.progress.getBoundingClientRect();
+ var percent = 100 / rect.width * (event.pageX - rect.left);
+ event.currentTarget.setAttribute('seek-value', percent);
+ }); // Pause while seeking
+
+ this.bind(elements.inputs.seek, 'mousedown mouseup keydown keyup touchstart touchend', function (event) {
+ var seek = event.currentTarget;
+ var code = event.keyCode ? event.keyCode : event.which;
+ var attribute = 'play-on-seeked';
+
+ if (is$1.keyboardEvent(event) && code !== 39 && code !== 37) {
+ return;
+ } // Record seek time so we can prevent hiding controls for a few seconds after seek
+
+
+ player.lastSeekTime = Date.now(); // Was playing before?
+
+ var play = seek.hasAttribute(attribute); // Done seeking
+
+ var done = ['mouseup', 'touchend', 'keyup'].includes(event.type); // If we're done seeking and it was playing, resume playback
+
+ if (play && done) {
+ seek.removeAttribute(attribute);
+ silencePromise(player.play());
+ } else if (!done && player.playing) {
+ seek.setAttribute(attribute, '');
+ player.pause();
+ }
+ }); // Fix range inputs on iOS
+ // Super weird iOS bug where after you interact with an <input type="range">,
+ // it takes over further interactions on the page. This is a hack
+
+ if (browser.isIos) {
+ var inputs = getElements.call(player, 'input[type="range"]');
+ Array.from(inputs).forEach(function (input) {
+ return _this3.bind(input, inputEvent, function (event) {
+ return repaint(event.target);
+ });
+ });
+ } // Seek
+
+
+ this.bind(elements.inputs.seek, inputEvent, function (event) {
+ var seek = event.currentTarget; // If it exists, use seek-value instead of "value" for consistency with tooltip time (#954)
+
+ var seekTo = seek.getAttribute('seek-value');
+
+ if (is$1.empty(seekTo)) {
+ seekTo = seek.value;
+ }
+
+ seek.removeAttribute('seek-value');
+ player.currentTime = seekTo / seek.max * player.duration;
+ }, 'seek'); // Seek tooltip
+
+ this.bind(elements.progress, 'mouseenter mouseleave mousemove', function (event) {
+ return controls.updateSeekTooltip.call(player, event);
+ }); // Preview thumbnails plugin
+ // TODO: Really need to work on some sort of plug-in wide event bus or pub-sub for this
+
+ this.bind(elements.progress, 'mousemove touchmove', function (event) {
+ var previewThumbnails = player.previewThumbnails;
+
+ if (previewThumbnails && previewThumbnails.loaded) {
+ previewThumbnails.startMove(event);
+ }
+ }); // Hide thumbnail preview - on mouse click, mouse leave, and video play/seek. All four are required, e.g., for buffering
+
+ this.bind(elements.progress, 'mouseleave touchend click', function () {
+ var previewThumbnails = player.previewThumbnails;
+
+ if (previewThumbnails && previewThumbnails.loaded) {
+ previewThumbnails.endMove(false, true);
+ }
+ }); // Show scrubbing preview
+
+ this.bind(elements.progress, 'mousedown touchstart', function (event) {
+ var previewThumbnails = player.previewThumbnails;
+
+ if (previewThumbnails && previewThumbnails.loaded) {
+ previewThumbnails.startScrubbing(event);
+ }
+ });
+ this.bind(elements.progress, 'mouseup touchend', function (event) {
+ var previewThumbnails = player.previewThumbnails;
+
+ if (previewThumbnails && previewThumbnails.loaded) {
+ previewThumbnails.endScrubbing(event);
+ }
+ }); // Polyfill for lower fill in <input type="range"> for webkit
+
+ if (browser.isWebkit) {
+ Array.from(getElements.call(player, 'input[type="range"]')).forEach(function (element) {
+ _this3.bind(element, 'input', function (event) {
+ return controls.updateRangeFill.call(player, event.target);
+ });
+ });
+ } // Current time invert
+ // Only if one time element is used for both currentTime and duration
+
+
+ if (player.config.toggleInvert && !is$1.element(elements.display.duration)) {
+ this.bind(elements.display.currentTime, 'click', function () {
+ // Do nothing if we're at the start
+ if (player.currentTime === 0) {
+ return;
+ }
+
+ player.config.invertTime = !player.config.invertTime;
+
+ controls.timeUpdate.call(player);
+ });
+ } // Volume
+
+
+ this.bind(elements.inputs.volume, inputEvent, function (event) {
+ player.volume = event.target.value;
+ }, 'volume'); // Update controls.hover state (used for ui.toggleControls to avoid hiding when interacting)
+
+ this.bind(elements.controls, 'mouseenter mouseleave', function (event) {
+ elements.controls.hover = !player.touch && event.type === 'mouseenter';
+ }); // Also update controls.hover state for any non-player children of fullscreen element (as above)
+
+ if (elements.fullscreen) {
+ Array.from(elements.fullscreen.children).filter(function (c) {
+ return !c.contains(elements.container);
+ }).forEach(function (child) {
+ _this3.bind(child, 'mouseenter mouseleave', function (event) {
+ elements.controls.hover = !player.touch && event.type === 'mouseenter';
+ });
+ });
+ } // Update controls.pressed state (used for ui.toggleControls to avoid hiding when interacting)
+
+
+ this.bind(elements.controls, 'mousedown mouseup touchstart touchend touchcancel', function (event) {
+ elements.controls.pressed = ['mousedown', 'touchstart'].includes(event.type);
+ }); // Show controls when they receive focus (e.g., when using keyboard tab key)
+
+ this.bind(elements.controls, 'focusin', function () {
+ var config = player.config,
+ timers = player.timers; // Skip transition to prevent focus from scrolling the parent element
+
+ toggleClass(elements.controls, config.classNames.noTransition, true); // Toggle
+
+ ui.toggleControls.call(player, true); // Restore transition
+
+ setTimeout(function () {
+ toggleClass(elements.controls, config.classNames.noTransition, false);
+ }, 0); // Delay a little more for mouse users
+
+ var delay = _this3.touch ? 3000 : 4000; // Clear timer
+
+ clearTimeout(timers.controls); // Hide again after delay
+
+ timers.controls = setTimeout(function () {
+ return ui.toggleControls.call(player, false);
+ }, delay);
+ }); // Mouse wheel for volume
+
+ this.bind(elements.inputs.volume, 'wheel', function (event) {
+ // Detect "natural" scroll - suppored on OS X Safari only
+ // Other browsers on OS X will be inverted until support improves
+ var inverted = event.webkitDirectionInvertedFromDevice; // Get delta from event. Invert if `inverted` is true
+
+ var _map = [event.deltaX, -event.deltaY].map(function (value) {
+ return inverted ? -value : value;
+ }),
+ _map2 = _slicedToArray(_map, 2),
+ x = _map2[0],
+ y = _map2[1]; // Using the biggest delta, normalize to 1 or -1 (or 0 if no delta)
+
+
+ var direction = Math.sign(Math.abs(x) > Math.abs(y) ? x : y); // Change the volume by 2%
+
+ player.increaseVolume(direction / 50); // Don't break page scrolling at max and min
+
+ var volume = player.media.volume;
+
+ if (direction === 1 && volume < 1 || direction === -1 && volume > 0) {
+ event.preventDefault();
+ }
+ }, 'volume', false);
+ }
+ }]);
+
+ return Listeners;
+}();
+
+var HAS_SPECIES_SUPPORT$3 = arrayMethodHasSpeciesSupport('splice');
+var USES_TO_LENGTH$a = arrayMethodUsesToLength('splice', { ACCESSORS: true, 0: 0, 1: 2 });
+
+var max$3 = Math.max;
+var min$5 = Math.min;
+var MAX_SAFE_INTEGER$1 = 0x1FFFFFFFFFFFFF;
+var MAXIMUM_ALLOWED_LENGTH_EXCEEDED = 'Maximum allowed length exceeded';
+
+// `Array.prototype.splice` method
+// https://tc39.github.io/ecma262/#sec-array.prototype.splice
+// with adding support of @@species
+_export({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT$3 || !USES_TO_LENGTH$a }, {
+ splice: function splice(start, deleteCount /* , ...items */) {
+ var O = toObject(this);
+ var len = toLength(O.length);
+ var actualStart = toAbsoluteIndex(start, len);
+ var argumentsLength = arguments.length;
+ var insertCount, actualDeleteCount, A, k, from, to;
+ if (argumentsLength === 0) {
+ insertCount = actualDeleteCount = 0;
+ } else if (argumentsLength === 1) {
+ insertCount = 0;
+ actualDeleteCount = len - actualStart;
+ } else {
+ insertCount = argumentsLength - 2;
+ actualDeleteCount = min$5(max$3(toInteger(deleteCount), 0), len - actualStart);
+ }
+ if (len + insertCount - actualDeleteCount > MAX_SAFE_INTEGER$1) {
+ throw TypeError(MAXIMUM_ALLOWED_LENGTH_EXCEEDED);
+ }
+ A = arraySpeciesCreate(O, actualDeleteCount);
+ for (k = 0; k < actualDeleteCount; k++) {
+ from = actualStart + k;
+ if (from in O) createProperty(A, k, O[from]);
+ }
+ A.length = actualDeleteCount;
+ if (insertCount < actualDeleteCount) {
+ for (k = actualStart; k < len - actualDeleteCount; k++) {
+ from = k + actualDeleteCount;
+ to = k + insertCount;
+ if (from in O) O[to] = O[from];
+ else delete O[to];
+ }
+ for (k = len; k > len - actualDeleteCount + insertCount; k--) delete O[k - 1];
+ } else if (insertCount > actualDeleteCount) {
+ for (k = len - actualDeleteCount; k > actualStart; k--) {
+ from = k + actualDeleteCount - 1;
+ to = k + insertCount - 1;
+ if (from in O) O[to] = O[from];
+ else delete O[to];
+ }
+ }
+ for (k = 0; k < insertCount; k++) {
+ O[k + actualStart] = arguments[k + 2];
+ }
+ O.length = len - actualDeleteCount + insertCount;
+ return A;
+ }
+});
+
+var loadjs_umd = createCommonjsModule(function (module, exports) {
+ (function (root, factory) {
+ {
+ module.exports = factory();
+ }
+ })(commonjsGlobal, function () {
+ /**
+ * Global dependencies.
+ * @global {Object} document - DOM
+ */
+ var devnull = function devnull() {},
+ bundleIdCache = {},
+ bundleResultCache = {},
+ bundleCallbackQueue = {};
+ /**
+ * Subscribe to bundle load event.
+ * @param {string[]} bundleIds - Bundle ids
+ * @param {Function} callbackFn - The callback function
+ */
+
+
+ function subscribe(bundleIds, callbackFn) {
+ // listify
+ bundleIds = bundleIds.push ? bundleIds : [bundleIds];
+ var depsNotFound = [],
+ i = bundleIds.length,
+ numWaiting = i,
+ fn,
+ bundleId,
+ r,
+ q; // define callback function
+
+ fn = function fn(bundleId, pathsNotFound) {
+ if (pathsNotFound.length) depsNotFound.push(bundleId);
+ numWaiting--;
+ if (!numWaiting) callbackFn(depsNotFound);
+ }; // register callback
+
+
+ while (i--) {
+ bundleId = bundleIds[i]; // execute callback if in result cache
+
+ r = bundleResultCache[bundleId];
+
+ if (r) {
+ fn(bundleId, r);
+ continue;
+ } // add to callback queue
+
+
+ q = bundleCallbackQueue[bundleId] = bundleCallbackQueue[bundleId] || [];
+ q.push(fn);
+ }
+ }
+ /**
+ * Publish bundle load event.
+ * @param {string} bundleId - Bundle id
+ * @param {string[]} pathsNotFound - List of files not found
+ */
+
+
+ function publish(bundleId, pathsNotFound) {
+ // exit if id isn't defined
+ if (!bundleId) return;
+ var q = bundleCallbackQueue[bundleId]; // cache result
+
+ bundleResultCache[bundleId] = pathsNotFound; // exit if queue is empty
+
+ if (!q) return; // empty callback queue
+
+ while (q.length) {
+ q[0](bundleId, pathsNotFound);
+ q.splice(0, 1);
+ }
+ }
+ /**
+ * Execute callbacks.
+ * @param {Object or Function} args - The callback args
+ * @param {string[]} depsNotFound - List of dependencies not found
+ */
+
+
+ function executeCallbacks(args, depsNotFound) {
+ // accept function as argument
+ if (args.call) args = {
+ success: args
+ }; // success and error callbacks
+
+ if (depsNotFound.length) (args.error || devnull)(depsNotFound);else (args.success || devnull)(args);
+ }
+ /**
+ * Load individual file.
+ * @param {string} path - The file path
+ * @param {Function} callbackFn - The callback function
+ */
+
+
+ function loadFile(path, callbackFn, args, numTries) {
+ var doc = document,
+ async = args.async,
+ maxTries = (args.numRetries || 0) + 1,
+ beforeCallbackFn = args.before || devnull,
+ pathname = path.replace(/[\?|#].*$/, ''),
+ pathStripped = path.replace(/^(css|img)!/, ''),
+ isLegacyIECss,
+ e;
+ numTries = numTries || 0;
+
+ if (/(^css!|\.css$)/.test(pathname)) {
+ // css
+ e = doc.createElement('link');
+ e.rel = 'stylesheet';
+ e.href = pathStripped; // tag IE9+
+
+ isLegacyIECss = 'hideFocus' in e; // use preload in IE Edge (to detect load errors)
+
+ if (isLegacyIECss && e.relList) {
+ isLegacyIECss = 0;
+ e.rel = 'preload';
+ e.as = 'style';
+ }
+ } else if (/(^img!|\.(png|gif|jpg|svg|webp)$)/.test(pathname)) {
+ // image
+ e = doc.createElement('img');
+ e.src = pathStripped;
+ } else {
+ // javascript
+ e = doc.createElement('script');
+ e.src = path;
+ e.async = async === undefined ? true : async;
+ }
+
+ e.onload = e.onerror = e.onbeforeload = function (ev) {
+ var result = ev.type[0]; // treat empty stylesheets as failures to get around lack of onerror
+ // support in IE9-11
+
+ if (isLegacyIECss) {
+ try {
+ if (!e.sheet.cssText.length) result = 'e';
+ } catch (x) {
+ // sheets objects created from load errors don't allow access to
+ // `cssText` (unless error is Code:18 SecurityError)
+ if (x.code != 18) result = 'e';
+ }
+ } // handle retries in case of load failure
+
+
+ if (result == 'e') {
+ // increment counter
+ numTries += 1; // exit function and try again
+
+ if (numTries < maxTries) {
+ return loadFile(path, callbackFn, args, numTries);
+ }
+ } else if (e.rel == 'preload' && e.as == 'style') {
+ // activate preloaded stylesheets
+ return e.rel = 'stylesheet'; // jshint ignore:line
+ } // execute callback
+
+
+ callbackFn(path, result, ev.defaultPrevented);
+ }; // add to document (unless callback returns `false`)
+
+
+ if (beforeCallbackFn(path, e) !== false) doc.head.appendChild(e);
+ }
+ /**
+ * Load multiple files.
+ * @param {string[]} paths - The file paths
+ * @param {Function} callbackFn - The callback function
+ */
+
+
+ function loadFiles(paths, callbackFn, args) {
+ // listify paths
+ paths = paths.push ? paths : [paths];
+ var numWaiting = paths.length,
+ x = numWaiting,
+ pathsNotFound = [],
+ fn,
+ i; // define callback function
+
+ fn = function fn(path, result, defaultPrevented) {
+ // handle error
+ if (result == 'e') pathsNotFound.push(path); // handle beforeload event. If defaultPrevented then that means the load
+ // will be blocked (ex. Ghostery/ABP on Safari)
+
+ if (result == 'b') {
+ if (defaultPrevented) pathsNotFound.push(path);else return;
+ }
+
+ numWaiting--;
+ if (!numWaiting) callbackFn(pathsNotFound);
+ }; // load scripts
+
+
+ for (i = 0; i < x; i++) {
+ loadFile(paths[i], fn, args);
+ }
+ }
+ /**
+ * Initiate script load and register bundle.
+ * @param {(string|string[])} paths - The file paths
+ * @param {(string|Function|Object)} [arg1] - The (1) bundleId or (2) success
+ * callback or (3) object literal with success/error arguments, numRetries,
+ * etc.
+ * @param {(Function|Object)} [arg2] - The (1) success callback or (2) object
+ * literal with success/error arguments, numRetries, etc.
+ */
+
+
+ function loadjs(paths, arg1, arg2) {
+ var bundleId, args; // bundleId (if string)
+
+ if (arg1 && arg1.trim) bundleId = arg1; // args (default is {})
+
+ args = (bundleId ? arg2 : arg1) || {}; // throw error if bundle is already defined
+
+ if (bundleId) {
+ if (bundleId in bundleIdCache) {
+ throw "LoadJS";
+ } else {
+ bundleIdCache[bundleId] = true;
+ }
+ }
+
+ function loadFn(resolve, reject) {
+ loadFiles(paths, function (pathsNotFound) {
+ // execute callbacks
+ executeCallbacks(args, pathsNotFound); // resolve Promise
+
+ if (resolve) {
+ executeCallbacks({
+ success: resolve,
+ error: reject
+ }, pathsNotFound);
+ } // publish bundle load event
+
+
+ publish(bundleId, pathsNotFound);
+ }, args);
+ }
+
+ if (args.returnPromise) return new Promise(loadFn);else loadFn();
+ }
+ /**
+ * Execute callbacks when dependencies have been satisfied.
+ * @param {(string|string[])} deps - List of bundle ids
+ * @param {Object} args - success/error arguments
+ */
+
+
+ loadjs.ready = function ready(deps, args) {
+ // subscribe to bundle load event
+ subscribe(deps, function (depsNotFound) {
+ // execute callbacks
+ executeCallbacks(args, depsNotFound);
+ });
+ return loadjs;
+ };
+ /**
+ * Manually satisfy bundle dependencies.
+ * @param {string} bundleId - The bundle id
+ */
+
+
+ loadjs.done = function done(bundleId) {
+ publish(bundleId, []);
+ };
+ /**
+ * Reset loadjs dependencies statuses
+ */
+
+
+ loadjs.reset = function reset() {
+ bundleIdCache = {};
+ bundleResultCache = {};
+ bundleCallbackQueue = {};
+ };
+ /**
+ * Determine if bundle has already been defined
+ * @param String} bundleId - The bundle id
+ */
+
+
+ loadjs.isDefined = function isDefined(bundleId) {
+ return bundleId in bundleIdCache;
+ }; // export
+
+
+ return loadjs;
+ });
+});
+
+function loadScript(url) {
+ return new Promise(function (resolve, reject) {
+ loadjs_umd(url, {
+ success: resolve,
+ error: reject
+ });
+ });
+}
+
+function parseId(url) {
+ if (is$1.empty(url)) {
+ return null;
+ }
+
+ if (is$1.number(Number(url))) {
+ return url;
+ }
+
+ var regex = /^.*(vimeo.com\/|video\/)(\d+).*/;
+ return url.match(regex) ? RegExp.$2 : url;
+} // Set playback state and trigger change (only on actual change)
+
+
+function assurePlaybackState(play) {
+ if (play && !this.embed.hasPlayed) {
+ this.embed.hasPlayed = true;
+ }
+
+ if (this.media.paused === play) {
+ this.media.paused = !play;
+ triggerEvent.call(this, this.media, play ? 'play' : 'pause');
+ }
+}
+
+var vimeo = {
+ setup: function setup() {
+ var player = this; // Add embed class for responsive
+
+ toggleClass(player.elements.wrapper, player.config.classNames.embed, true); // Set speed options from config
+
+ player.options.speed = player.config.speed.options; // Set intial ratio
+
+ setAspectRatio.call(player); // Load the SDK if not already
+
+ if (!is$1.object(window.Vimeo)) {
+ loadScript(player.config.urls.vimeo.sdk).then(function () {
+ vimeo.ready.call(player);
+ }).catch(function (error) {
+ player.debug.warn('Vimeo SDK (player.js) failed to load', error);
+ });
+ } else {
+ vimeo.ready.call(player);
+ }
+ },
+ // API Ready
+ ready: function ready() {
+ var _this = this;
+
+ var player = this;
+ var config = player.config.vimeo;
+
+ var premium = config.premium,
+ referrerPolicy = config.referrerPolicy,
+ frameParams = _objectWithoutProperties(config, ["premium", "referrerPolicy"]); // If the owner has a pro or premium account then we can hide controls etc
+
+
+ if (premium) {
+ Object.assign(frameParams, {
+ controls: false,
+ sidedock: false
+ });
+ } // Get Vimeo params for the iframe
+
+
+ var params = buildUrlParams(_objectSpread2({
+ loop: player.config.loop.active,
+ autoplay: player.autoplay,
+ muted: player.muted,
+ gesture: 'media',
+ playsinline: !this.config.fullscreen.iosNative
+ }, frameParams)); // Get the source URL or ID
+
+ var source = player.media.getAttribute('src'); // Get from <div> if needed
+
+ if (is$1.empty(source)) {
+ source = player.media.getAttribute(player.config.attributes.embed.id);
+ }
+
+ var id = parseId(source); // Build an iframe
+
+ var iframe = createElement('iframe');
+ var src = format(player.config.urls.vimeo.iframe, id, params);
+ iframe.setAttribute('src', src);
+ iframe.setAttribute('allowfullscreen', '');
+ iframe.setAttribute('allow', 'autoplay,fullscreen,picture-in-picture'); // Set the referrer policy if required
+
+ if (!is$1.empty(referrerPolicy)) {
+ iframe.setAttribute('referrerPolicy', referrerPolicy);
+ } // Inject the package
+
+
+ var poster = player.poster;
+
+ if (premium) {
+ iframe.setAttribute('data-poster', poster);
+ player.media = replaceElement(iframe, player.media);
+ } else {
+ var wrapper = createElement('div', {
+ class: player.config.classNames.embedContainer,
+ 'data-poster': poster
+ });
+ wrapper.appendChild(iframe);
+ player.media = replaceElement(wrapper, player.media);
+ } // Get poster image
+
+
+ fetch(format(player.config.urls.vimeo.api, id), 'json').then(function (response) {
+ if (is$1.empty(response)) {
+ return;
+ } // Get the URL for thumbnail
+
+
+ var url = new URL(response[0].thumbnail_large); // Get original image
+
+ url.pathname = "".concat(url.pathname.split('_')[0], ".jpg"); // Set and show poster
+
+ ui.setPoster.call(player, url.href).catch(function () {});
+ }); // Setup instance
+ // https://github.com/vimeo/player.js
+
+ player.embed = new window.Vimeo.Player(iframe, {
+ autopause: player.config.autopause,
+ muted: player.muted
+ });
+ player.media.paused = true;
+ player.media.currentTime = 0; // Disable native text track rendering
+
+ if (player.supported.ui) {
+ player.embed.disableTextTrack();
+ } // Create a faux HTML5 API using the Vimeo API
+
+
+ player.media.play = function () {
+ assurePlaybackState.call(player, true);
+ return player.embed.play();
+ };
+
+ player.media.pause = function () {
+ assurePlaybackState.call(player, false);
+ return player.embed.pause();
+ };
+
+ player.media.stop = function () {
+ player.pause();
+ player.currentTime = 0;
+ }; // Seeking
+
+
+ var currentTime = player.media.currentTime;
+ Object.defineProperty(player.media, 'currentTime', {
+ get: function get() {
+ return currentTime;
+ },
+ set: function set(time) {
+ // Vimeo will automatically play on seek if the video hasn't been played before
+ // Get current paused state and volume etc
+ var embed = player.embed,
+ media = player.media,
+ paused = player.paused,
+ volume = player.volume;
+ var restorePause = paused && !embed.hasPlayed; // Set seeking state and trigger event
+
+ media.seeking = true;
+ triggerEvent.call(player, media, 'seeking'); // If paused, mute until seek is complete
+
+ Promise.resolve(restorePause && embed.setVolume(0)) // Seek
+ .then(function () {
+ return embed.setCurrentTime(time);
+ }) // Restore paused
+ .then(function () {
+ return restorePause && embed.pause();
+ }) // Restore volume
+ .then(function () {
+ return restorePause && embed.setVolume(volume);
+ }).catch(function () {// Do nothing
+ });
+ }
+ }); // Playback speed
+
+ var speed = player.config.speed.selected;
+ Object.defineProperty(player.media, 'playbackRate', {
+ get: function get() {
+ return speed;
+ },
+ set: function set(input) {
+ player.embed.setPlaybackRate(input).then(function () {
+ speed = input;
+ triggerEvent.call(player, player.media, 'ratechange');
+ }).catch(function () {
+ // Cannot set Playback Rate, Video is probably not on Pro account
+ player.options.speed = [1];
+ });
+ }
+ }); // Volume
+
+ var volume = player.config.volume;
+ Object.defineProperty(player.media, 'volume', {
+ get: function get() {
+ return volume;
+ },
+ set: function set(input) {
+ player.embed.setVolume(input).then(function () {
+ volume = input;
+ triggerEvent.call(player, player.media, 'volumechange');
+ });
+ }
+ }); // Muted
+
+ var muted = player.config.muted;
+ Object.defineProperty(player.media, 'muted', {
+ get: function get() {
+ return muted;
+ },
+ set: function set(input) {
+ var toggle = is$1.boolean(input) ? input : false;
+ player.embed.setVolume(toggle ? 0 : player.config.volume).then(function () {
+ muted = toggle;
+ triggerEvent.call(player, player.media, 'volumechange');
+ });
+ }
+ }); // Loop
+
+ var loop = player.config.loop;
+ Object.defineProperty(player.media, 'loop', {
+ get: function get() {
+ return loop;
+ },
+ set: function set(input) {
+ var toggle = is$1.boolean(input) ? input : player.config.loop.active;
+ player.embed.setLoop(toggle).then(function () {
+ loop = toggle;
+ });
+ }
+ }); // Source
+
+ var currentSrc;
+ player.embed.getVideoUrl().then(function (value) {
+ currentSrc = value;
+ controls.setDownloadUrl.call(player);
+ }).catch(function (error) {
+ _this.debug.warn(error);
+ });
+ Object.defineProperty(player.media, 'currentSrc', {
+ get: function get() {
+ return currentSrc;
+ }
+ }); // Ended
+
+ Object.defineProperty(player.media, 'ended', {
+ get: function get() {
+ return player.currentTime === player.duration;
+ }
+ }); // Set aspect ratio based on video size
+
+ Promise.all([player.embed.getVideoWidth(), player.embed.getVideoHeight()]).then(function (dimensions) {
+ var _dimensions = _slicedToArray(dimensions, 2),
+ width = _dimensions[0],
+ height = _dimensions[1];
+
+ player.embed.ratio = [width, height];
+ setAspectRatio.call(_this);
+ }); // Set autopause
+
+ player.embed.setAutopause(player.config.autopause).then(function (state) {
+ player.config.autopause = state;
+ }); // Get title
+
+ player.embed.getVideoTitle().then(function (title) {
+ player.config.title = title;
+ ui.setTitle.call(_this);
+ }); // Get current time
+
+ player.embed.getCurrentTime().then(function (value) {
+ currentTime = value;
+ triggerEvent.call(player, player.media, 'timeupdate');
+ }); // Get duration
+
+ player.embed.getDuration().then(function (value) {
+ player.media.duration = value;
+ triggerEvent.call(player, player.media, 'durationchange');
+ }); // Get captions
+
+ player.embed.getTextTracks().then(function (tracks) {
+ player.media.textTracks = tracks;
+ captions.setup.call(player);
+ });
+ player.embed.on('cuechange', function (_ref) {
+ var _ref$cues = _ref.cues,
+ cues = _ref$cues === void 0 ? [] : _ref$cues;
+ var strippedCues = cues.map(function (cue) {
+ return stripHTML(cue.text);
+ });
+ captions.updateCues.call(player, strippedCues);
+ });
+ player.embed.on('loaded', function () {
+ // Assure state and events are updated on autoplay
+ player.embed.getPaused().then(function (paused) {
+ assurePlaybackState.call(player, !paused);
+
+ if (!paused) {
+ triggerEvent.call(player, player.media, 'playing');
+ }
+ });
+
+ if (is$1.element(player.embed.element) && player.supported.ui) {
+ var frame = player.embed.element; // Fix keyboard focus issues
+ // https://github.com/sampotts/plyr/issues/317
+
+ frame.setAttribute('tabindex', -1);
+ }
+ });
+ player.embed.on('bufferstart', function () {
+ triggerEvent.call(player, player.media, 'waiting');
+ });
+ player.embed.on('bufferend', function () {
+ triggerEvent.call(player, player.media, 'playing');
+ });
+ player.embed.on('play', function () {
+ assurePlaybackState.call(player, true);
+ triggerEvent.call(player, player.media, 'playing');
+ });
+ player.embed.on('pause', function () {
+ assurePlaybackState.call(player, false);
+ });
+ player.embed.on('timeupdate', function (data) {
+ player.media.seeking = false;
+ currentTime = data.seconds;
+ triggerEvent.call(player, player.media, 'timeupdate');
+ });
+ player.embed.on('progress', function (data) {
+ player.media.buffered = data.percent;
+ triggerEvent.call(player, player.media, 'progress'); // Check all loaded
+
+ if (parseInt(data.percent, 10) === 1) {
+ triggerEvent.call(player, player.media, 'canplaythrough');
+ } // Get duration as if we do it before load, it gives an incorrect value
+ // https://github.com/sampotts/plyr/issues/891
+
+
+ player.embed.getDuration().then(function (value) {
+ if (value !== player.media.duration) {
+ player.media.duration = value;
+ triggerEvent.call(player, player.media, 'durationchange');
+ }
+ });
+ });
+ player.embed.on('seeked', function () {
+ player.media.seeking = false;
+ triggerEvent.call(player, player.media, 'seeked');
+ });
+ player.embed.on('ended', function () {
+ player.media.paused = true;
+ triggerEvent.call(player, player.media, 'ended');
+ });
+ player.embed.on('error', function (detail) {
+ player.media.error = detail;
+ triggerEvent.call(player, player.media, 'error');
+ }); // Rebuild UI
+
+ setTimeout(function () {
+ return ui.build.call(player);
+ }, 0);
+ }
+};
+
+function parseId$1(url) {
+ if (is$1.empty(url)) {
+ return null;
+ }
+
+ var regex = /^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*/;
+ return url.match(regex) ? RegExp.$2 : url;
+} // Set playback state and trigger change (only on actual change)
+
+
+function assurePlaybackState$1(play) {
+ if (play && !this.embed.hasPlayed) {
+ this.embed.hasPlayed = true;
+ }
+
+ if (this.media.paused === play) {
+ this.media.paused = !play;
+ triggerEvent.call(this, this.media, play ? 'play' : 'pause');
+ }
+}
+
+function getHost$1(config) {
+ if (config.noCookie) {
+ return 'https://www.youtube-nocookie.com';
+ }
+
+ if (window.location.protocol === 'http:') {
+ return 'http://www.youtube.com';
+ } // Use YouTube's default
+
+
+ return undefined;
+}
+
+var youtube = {
+ setup: function setup() {
+ var _this = this;
+
+ // Add embed class for responsive
+ toggleClass(this.elements.wrapper, this.config.classNames.embed, true); // Setup API
+
+ if (is$1.object(window.YT) && is$1.function(window.YT.Player)) {
+ youtube.ready.call(this);
+ } else {
+ // Reference current global callback
+ var callback = window.onYouTubeIframeAPIReady; // Set callback to process queue
+
+ window.onYouTubeIframeAPIReady = function () {
+ // Call global callback if set
+ if (is$1.function(callback)) {
+ callback();
+ }
+
+ youtube.ready.call(_this);
+ }; // Load the SDK
+
+
+ loadScript(this.config.urls.youtube.sdk).catch(function (error) {
+ _this.debug.warn('YouTube API failed to load', error);
+ });
+ }
+ },
+ // Get the media title
+ getTitle: function getTitle(videoId) {
+ var _this2 = this;
+
+ var url = format(this.config.urls.youtube.api, videoId);
+ fetch(url).then(function (data) {
+ if (is$1.object(data)) {
+ var title = data.title,
+ height = data.height,
+ width = data.width; // Set title
+
+ _this2.config.title = title;
+ ui.setTitle.call(_this2); // Set aspect ratio
+
+ _this2.embed.ratio = [width, height];
+ }
+
+ setAspectRatio.call(_this2);
+ }).catch(function () {
+ // Set aspect ratio
+ setAspectRatio.call(_this2);
+ });
+ },
+ // API ready
+ ready: function ready() {
+ var player = this; // Ignore already setup (race condition)
+
+ var currentId = player.media && player.media.getAttribute('id');
+
+ if (!is$1.empty(currentId) && currentId.startsWith('youtube-')) {
+ return;
+ } // Get the source URL or ID
+
+
+ var source = player.media.getAttribute('src'); // Get from <div> if needed
+
+ if (is$1.empty(source)) {
+ source = player.media.getAttribute(this.config.attributes.embed.id);
+ } // Replace the <iframe> with a <div> due to YouTube API issues
+
+
+ var videoId = parseId$1(source);
+ var id = generateId(player.provider); // Get poster, if already set
+
+ var poster = player.poster; // Replace media element
+
+ var container = createElement('div', {
+ id: id,
+ 'data-poster': poster
+ });
+ player.media = replaceElement(container, player.media); // Id to poster wrapper
+
+ var posterSrc = function posterSrc(s) {
+ return "https://i.ytimg.com/vi/".concat(videoId, "/").concat(s, "default.jpg");
+ }; // Check thumbnail images in order of quality, but reject fallback thumbnails (120px wide)
+
+
+ loadImage(posterSrc('maxres'), 121) // Higest quality and unpadded
+ .catch(function () {
+ return loadImage(posterSrc('sd'), 121);
+ }) // 480p padded 4:3
+ .catch(function () {
+ return loadImage(posterSrc('hq'));
+ }) // 360p padded 4:3. Always exists
+ .then(function (image) {
+ return ui.setPoster.call(player, image.src);
+ }).then(function (src) {
+ // If the image is padded, use background-size "cover" instead (like youtube does too with their posters)
+ if (!src.includes('maxres')) {
+ player.elements.poster.style.backgroundSize = 'cover';
+ }
+ }).catch(function () {});
+ var config = player.config.youtube; // Setup instance
+ // https://developers.google.com/youtube/iframe_api_reference
+
+ player.embed = new window.YT.Player(id, {
+ videoId: videoId,
+ host: getHost$1(config),
+ playerVars: extend({}, {
+ autoplay: player.config.autoplay ? 1 : 0,
+ // Autoplay
+ hl: player.config.hl,
+ // iframe interface language
+ controls: player.supported.ui ? 0 : 1,
+ // Only show controls if not fully supported
+ disablekb: 1,
+ // Disable keyboard as we handle it
+ playsinline: !player.config.fullscreen.iosNative ? 1 : 0,
+ // Allow iOS inline playback
+ // Captions are flaky on YouTube
+ cc_load_policy: player.captions.active ? 1 : 0,
+ cc_lang_pref: player.config.captions.language,
+ // Tracking for stats
+ widget_referrer: window ? window.location.href : null
+ }, config),
+ events: {
+ onError: function onError(event) {
+ // YouTube may fire onError twice, so only handle it once
+ if (!player.media.error) {
+ var code = event.data; // Messages copied from https://developers.google.com/youtube/iframe_api_reference#onError
+
+ var message = {
+ 2: 'The request contains an invalid parameter value. For example, this error occurs if you specify a video ID that does not have 11 characters, or if the video ID contains invalid characters, such as exclamation points or asterisks.',
+ 5: 'The requested content cannot be played in an HTML5 player or another error related to the HTML5 player has occurred.',
+ 100: 'The video requested was not found. This error occurs when a video has been removed (for any reason) or has been marked as private.',
+ 101: 'The owner of the requested video does not allow it to be played in embedded players.',
+ 150: 'The owner of the requested video does not allow it to be played in embedded players.'
+ }[code] || 'An unknown error occured';
+ player.media.error = {
+ code: code,
+ message: message
+ };
+ triggerEvent.call(player, player.media, 'error');
+ }
+ },
+ onPlaybackRateChange: function onPlaybackRateChange(event) {
+ // Get the instance
+ var instance = event.target; // Get current speed
+
+ player.media.playbackRate = instance.getPlaybackRate();
+ triggerEvent.call(player, player.media, 'ratechange');
+ },
+ onReady: function onReady(event) {
+ // Bail if onReady has already been called. See issue #1108
+ if (is$1.function(player.media.play)) {
+ return;
+ } // Get the instance
+
+
+ var instance = event.target; // Get the title
+
+ youtube.getTitle.call(player, videoId); // Create a faux HTML5 API using the YouTube API
+
+ player.media.play = function () {
+ assurePlaybackState$1.call(player, true);
+ instance.playVideo();
+ };
+
+ player.media.pause = function () {
+ assurePlaybackState$1.call(player, false);
+ instance.pauseVideo();
+ };
+
+ player.media.stop = function () {
+ instance.stopVideo();
+ };
+
+ player.media.duration = instance.getDuration();
+ player.media.paused = true; // Seeking
+
+ player.media.currentTime = 0;
+ Object.defineProperty(player.media, 'currentTime', {
+ get: function get() {
+ return Number(instance.getCurrentTime());
+ },
+ set: function set(time) {
+ // If paused and never played, mute audio preventively (YouTube starts playing on seek if the video hasn't been played yet).
+ if (player.paused && !player.embed.hasPlayed) {
+ player.embed.mute();
+ } // Set seeking state and trigger event
+
+
+ player.media.seeking = true;
+ triggerEvent.call(player, player.media, 'seeking'); // Seek after events sent
+
+ instance.seekTo(time);
+ }
+ }); // Playback speed
+
+ Object.defineProperty(player.media, 'playbackRate', {
+ get: function get() {
+ return instance.getPlaybackRate();
+ },
+ set: function set(input) {
+ instance.setPlaybackRate(input);
+ }
+ }); // Volume
+
+ var volume = player.config.volume;
+ Object.defineProperty(player.media, 'volume', {
+ get: function get() {
+ return volume;
+ },
+ set: function set(input) {
+ volume = input;
+ instance.setVolume(volume * 100);
+ triggerEvent.call(player, player.media, 'volumechange');
+ }
+ }); // Muted
+
+ var muted = player.config.muted;
+ Object.defineProperty(player.media, 'muted', {
+ get: function get() {
+ return muted;
+ },
+ set: function set(input) {
+ var toggle = is$1.boolean(input) ? input : muted;
+ muted = toggle;
+ instance[toggle ? 'mute' : 'unMute']();
+ triggerEvent.call(player, player.media, 'volumechange');
+ }
+ }); // Source
+
+ Object.defineProperty(player.media, 'currentSrc', {
+ get: function get() {
+ return instance.getVideoUrl();
+ }
+ }); // Ended
+
+ Object.defineProperty(player.media, 'ended', {
+ get: function get() {
+ return player.currentTime === player.duration;
+ }
+ }); // Get available speeds
+
+ var speeds = instance.getAvailablePlaybackRates(); // Filter based on config
+
+ player.options.speed = speeds.filter(function (s) {
+ return player.config.speed.options.includes(s);
+ }); // Set the tabindex to avoid focus entering iframe
+
+ if (player.supported.ui) {
+ player.media.setAttribute('tabindex', -1);
+ }
+
+ triggerEvent.call(player, player.media, 'timeupdate');
+ triggerEvent.call(player, player.media, 'durationchange'); // Reset timer
+
+ clearInterval(player.timers.buffering); // Setup buffering
+
+ player.timers.buffering = setInterval(function () {
+ // Get loaded % from YouTube
+ player.media.buffered = instance.getVideoLoadedFraction(); // Trigger progress only when we actually buffer something
+
+ if (player.media.lastBuffered === null || player.media.lastBuffered < player.media.buffered) {
+ triggerEvent.call(player, player.media, 'progress');
+ } // Set last buffer point
+
+
+ player.media.lastBuffered = player.media.buffered; // Bail if we're at 100%
+
+ if (player.media.buffered === 1) {
+ clearInterval(player.timers.buffering); // Trigger event
+
+ triggerEvent.call(player, player.media, 'canplaythrough');
+ }
+ }, 200); // Rebuild UI
+
+ setTimeout(function () {
+ return ui.build.call(player);
+ }, 50);
+ },
+ onStateChange: function onStateChange(event) {
+ // Get the instance
+ var instance = event.target; // Reset timer
+
+ clearInterval(player.timers.playing);
+ var seeked = player.media.seeking && [1, 2].includes(event.data);
+
+ if (seeked) {
+ // Unset seeking and fire seeked event
+ player.media.seeking = false;
+ triggerEvent.call(player, player.media, 'seeked');
+ } // Handle events
+ // -1 Unstarted
+ // 0 Ended
+ // 1 Playing
+ // 2 Paused
+ // 3 Buffering
+ // 5 Video cued
+
+
+ switch (event.data) {
+ case -1:
+ // Update scrubber
+ triggerEvent.call(player, player.media, 'timeupdate'); // Get loaded % from YouTube
+
+ player.media.buffered = instance.getVideoLoadedFraction();
+ triggerEvent.call(player, player.media, 'progress');
+ break;
+
+ case 0:
+ assurePlaybackState$1.call(player, false); // YouTube doesn't support loop for a single video, so mimick it.
+
+ if (player.media.loop) {
+ // YouTube needs a call to `stopVideo` before playing again
+ instance.stopVideo();
+ instance.playVideo();
+ } else {
+ triggerEvent.call(player, player.media, 'ended');
+ }
+
+ break;
+
+ case 1:
+ // Restore paused state (YouTube starts playing on seek if the video hasn't been played yet)
+ if (!player.config.autoplay && player.media.paused && !player.embed.hasPlayed) {
+ player.media.pause();
+ } else {
+ assurePlaybackState$1.call(player, true);
+ triggerEvent.call(player, player.media, 'playing'); // Poll to get playback progress
+
+ player.timers.playing = setInterval(function () {
+ triggerEvent.call(player, player.media, 'timeupdate');
+ }, 50); // Check duration again due to YouTube bug
+ // https://github.com/sampotts/plyr/issues/374
+ // https://code.google.com/p/gdata-issues/issues/detail?id=8690
+
+ if (player.media.duration !== instance.getDuration()) {
+ player.media.duration = instance.getDuration();
+ triggerEvent.call(player, player.media, 'durationchange');
+ }
+ }
+
+ break;
+
+ case 2:
+ // Restore audio (YouTube starts playing on seek if the video hasn't been played yet)
+ if (!player.muted) {
+ player.embed.unMute();
+ }
+
+ assurePlaybackState$1.call(player, false);
+ break;
+
+ case 3:
+ // Trigger waiting event to add loading classes to container as the video buffers.
+ triggerEvent.call(player, player.media, 'waiting');
+ break;
+ }
+
+ triggerEvent.call(player, player.elements.container, 'statechange', false, {
+ code: event.data
+ });
+ }
+ }
+ });
+ }
+};
+
+var media = {
+ // Setup media
+ setup: function setup() {
+ // If there's no media, bail
+ if (!this.media) {
+ this.debug.warn('No media element found!');
+ return;
+ } // Add type class
+
+
+ toggleClass(this.elements.container, this.config.classNames.type.replace('{0}', this.type), true); // Add provider class
+
+ toggleClass(this.elements.container, this.config.classNames.provider.replace('{0}', this.provider), true); // Add video class for embeds
+ // This will require changes if audio embeds are added
+
+ if (this.isEmbed) {
+ toggleClass(this.elements.container, this.config.classNames.type.replace('{0}', 'video'), true);
+ } // Inject the player wrapper
+
+
+ if (this.isVideo) {
+ // Create the wrapper div
+ this.elements.wrapper = createElement('div', {
+ class: this.config.classNames.video
+ }); // Wrap the video in a container
+
+ wrap$1(this.media, this.elements.wrapper); // Poster image container
+
+ this.elements.poster = createElement('div', {
+ class: this.config.classNames.poster
+ });
+ this.elements.wrapper.appendChild(this.elements.poster);
+ }
+
+ if (this.isHTML5) {
+ html5.setup.call(this);
+ } else if (this.isYouTube) {
+ youtube.setup.call(this);
+ } else if (this.isVimeo) {
+ vimeo.setup.call(this);
+ }
+ }
+};
+
+var destroy = function destroy(instance) {
+ // Destroy our adsManager
+ if (instance.manager) {
+ instance.manager.destroy();
+ } // Destroy our adsManager
+
+
+ if (instance.elements.displayContainer) {
+ instance.elements.displayContainer.destroy();
+ }
+
+ instance.elements.container.remove();
+};
+
+var Ads = /*#__PURE__*/function () {
+ /**
+ * Ads constructor.
+ * @param {Object} player
+ * @return {Ads}
+ */
+ function Ads(player) {
+ var _this = this;
+
+ _classCallCheck(this, Ads);
+
+ this.player = player;
+ this.config = player.config.ads;
+ this.playing = false;
+ this.initialized = false;
+ this.elements = {
+ container: null,
+ displayContainer: null
+ };
+ this.manager = null;
+ this.loader = null;
+ this.cuePoints = null;
+ this.events = {};
+ this.safetyTimer = null;
+ this.countdownTimer = null; // Setup a promise to resolve when the IMA manager is ready
+
+ this.managerPromise = new Promise(function (resolve, reject) {
+ // The ad is loaded and ready
+ _this.on('loaded', resolve); // Ads failed
+
+
+ _this.on('error', reject);
+ });
+ this.load();
+ }
+
+ _createClass(Ads, [{
+ key: "load",
+
+ /**
+ * Load the IMA SDK
+ */
+ value: function load() {
+ var _this2 = this;
+
+ if (!this.enabled) {
+ return;
+ } // Check if the Google IMA3 SDK is loaded or load it ourselves
+
+
+ if (!is$1.object(window.google) || !is$1.object(window.google.ima)) {
+ loadScript(this.player.config.urls.googleIMA.sdk).then(function () {
+ _this2.ready();
+ }).catch(function () {
+ // Script failed to load or is blocked
+ _this2.trigger('error', new Error('Google IMA SDK failed to load'));
+ });
+ } else {
+ this.ready();
+ }
+ }
+ /**
+ * Get the ads instance ready
+ */
+
+ }, {
+ key: "ready",
+ value: function ready() {
+ var _this3 = this;
+
+ // Double check we're enabled
+ if (!this.enabled) {
+ destroy(this);
+ } // Start ticking our safety timer. If the whole advertisement
+ // thing doesn't resolve within our set time; we bail
+
+
+ this.startSafetyTimer(12000, 'ready()'); // Clear the safety timer
+
+ this.managerPromise.then(function () {
+ _this3.clearSafetyTimer('onAdsManagerLoaded()');
+ }); // Set listeners on the Plyr instance
+
+ this.listeners(); // Setup the IMA SDK
+
+ this.setupIMA();
+ } // Build the tag URL
+
+ }, {
+ key: "setupIMA",
+
+ /**
+ * In order for the SDK to display ads for our video, we need to tell it where to put them,
+ * so here we define our ad container. This div is set up to render on top of the video player.
+ * Using the code below, we tell the SDK to render ads within that div. We also provide a
+ * handle to the content video player - the SDK will poll the current time of our player to
+ * properly place mid-rolls. After we create the ad display container, we initialize it. On
+ * mobile devices, this initialization is done as the result of a user action.
+ */
+ value: function setupIMA() {
+ var _this4 = this;
+
+ // Create the container for our advertisements
+ this.elements.container = createElement('div', {
+ class: this.player.config.classNames.ads
+ });
+ this.player.elements.container.appendChild(this.elements.container); // So we can run VPAID2
+
+ google.ima.settings.setVpaidMode(google.ima.ImaSdkSettings.VpaidMode.ENABLED); // Set language
+
+ google.ima.settings.setLocale(this.player.config.ads.language); // Set playback for iOS10+
+
+ 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
+
+ this.elements.displayContainer = new google.ima.AdDisplayContainer(this.elements.container, this.player.media); // Create ads loader
+
+ this.loader = new google.ima.AdsLoader(this.elements.displayContainer); // Listen and respond to ads loaded and error events
+
+ this.loader.addEventListener(google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED, function (event) {
+ return _this4.onAdsManagerLoaded(event);
+ }, false);
+ this.loader.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR, function (error) {
+ return _this4.onAdError(error);
+ }, false); // Request video ads to be pre-loaded
+
+ this.requestAds();
+ }
+ /**
+ * Request advertisements
+ */
+
+ }, {
+ key: "requestAds",
+ value: function requestAds() {
+ var container = this.player.elements.container;
+
+ try {
+ // Request video ads
+ var request = new google.ima.AdsRequest();
+ request.adTagUrl = this.tagUrl; // Specify the linear and nonlinear slot sizes. This helps the SDK
+ // to select the correct creative if multiple are returned
+
+ request.linearAdSlotWidth = container.offsetWidth;
+ request.linearAdSlotHeight = container.offsetHeight;
+ request.nonLinearAdSlotWidth = container.offsetWidth;
+ request.nonLinearAdSlotHeight = container.offsetHeight; // We only overlay ads as we only support video.
+
+ request.forceNonLinearFullSlot = false; // Mute based on current state
+
+ request.setAdWillPlayMuted(!this.player.muted);
+ this.loader.requestAds(request);
+ } catch (e) {
+ this.onAdError(e);
+ }
+ }
+ /**
+ * Update the ad countdown
+ * @param {Boolean} start
+ */
+
+ }, {
+ key: "pollCountdown",
+ value: function pollCountdown() {
+ var _this5 = this;
+
+ var start = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
+
+ if (!start) {
+ clearInterval(this.countdownTimer);
+ this.elements.container.removeAttribute('data-badge-text');
+ return;
+ }
+
+ var update = function update() {
+ var time = formatTime(Math.max(_this5.manager.getRemainingTime(), 0));
+ var label = "".concat(i18n.get('advertisement', _this5.player.config), " - ").concat(time);
+
+ _this5.elements.container.setAttribute('data-badge-text', label);
+ };
+
+ this.countdownTimer = setInterval(update, 100);
+ }
+ /**
+ * This method is called whenever the ads are ready inside the AdDisplayContainer
+ * @param {Event} adsManagerLoadedEvent
+ */
+
+ }, {
+ key: "onAdsManagerLoaded",
+ value: function onAdsManagerLoaded(event) {
+ var _this6 = this;
+
+ // Load could occur after a source change (race condition)
+ if (!this.enabled) {
+ return;
+ } // Get the ads manager
+
+
+ var settings = new google.ima.AdsRenderingSettings(); // Tell the SDK to save and restore content video state on our behalf
+
+ settings.restoreCustomPlaybackStateOnAdBreakComplete = true;
+ settings.enablePreloading = true; // The SDK is polling currentTime on the contentPlayback. And needs a duration
+ // so it can determine when to start the mid- and post-roll
+
+ this.manager = event.getAdsManager(this.player, settings); // Get the cue points for any mid-rolls by filtering out the pre- and post-roll
+
+ this.cuePoints = this.manager.getCuePoints(); // Add listeners to the required events
+ // Advertisement error events
+
+ this.manager.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR, function (error) {
+ return _this6.onAdError(error);
+ }); // Advertisement regular events
+
+ Object.keys(google.ima.AdEvent.Type).forEach(function (type) {
+ _this6.manager.addEventListener(google.ima.AdEvent.Type[type], function (e) {
+ return _this6.onAdEvent(e);
+ });
+ }); // Resolve our adsManager
+
+ this.trigger('loaded');
+ }
+ }, {
+ key: "addCuePoints",
+ value: function addCuePoints() {
+ var _this7 = this;
+
+ // Add advertisement cue's within the time line if available
+ if (!is$1.empty(this.cuePoints)) {
+ this.cuePoints.forEach(function (cuePoint) {
+ if (cuePoint !== 0 && cuePoint !== -1 && cuePoint < _this7.player.duration) {
+ var seekElement = _this7.player.elements.progress;
+
+ if (is$1.element(seekElement)) {
+ var cuePercentage = 100 / _this7.player.duration * cuePoint;
+ var cue = createElement('span', {
+ class: _this7.player.config.classNames.cues
+ });
+ cue.style.left = "".concat(cuePercentage.toString(), "%");
+ seekElement.appendChild(cue);
+ }
+ }
+ });
+ }
+ }
+ /**
+ * This is where all the event handling takes place. Retrieve the ad from the event. Some
+ * events (e.g. ALL_ADS_COMPLETED) don't have the ad object associated
+ * https://developers.google.com/interactive-media-ads/docs/sdks/html5/v3/apis#ima.AdEvent.Type
+ * @param {Event} event
+ */
+
+ }, {
+ key: "onAdEvent",
+ value: function onAdEvent(event) {
+ var _this8 = this;
+
+ var container = this.player.elements.container; // Retrieve the ad from the event. Some events (e.g. ALL_ADS_COMPLETED)
+ // don't have ad object associated
+
+ var ad = event.getAd();
+ var adData = event.getAdData(); // Proxy event
+
+ var dispatchEvent = function dispatchEvent(type) {
+ triggerEvent.call(_this8.player, _this8.player.media, "ads".concat(type.replace(/_/g, '').toLowerCase()));
+ }; // Bubble the event
+
+
+ dispatchEvent(event.type);
+
+ switch (event.type) {
+ case google.ima.AdEvent.Type.LOADED:
+ // This is the first event sent for an ad - it is possible to determine whether the
+ // ad is a video ad or an overlay
+ this.trigger('loaded'); // Start countdown
+
+ this.pollCountdown(true);
+
+ if (!ad.isLinear()) {
+ // Position AdDisplayContainer correctly for overlay
+ ad.width = container.offsetWidth;
+ ad.height = container.offsetHeight;
+ } // console.info('Ad type: ' + event.getAd().getAdPodInfo().getPodIndex());
+ // console.info('Ad time: ' + event.getAd().getAdPodInfo().getTimeOffset());
+
+
+ break;
+
+ case google.ima.AdEvent.Type.STARTED:
+ // Set volume to match player
+ this.manager.setVolume(this.player.volume);
+ break;
+
+ case google.ima.AdEvent.Type.ALL_ADS_COMPLETED:
+ // All ads for the current videos are done. We can now request new advertisements
+ // in case the video is re-played
+ // TODO: Example for what happens when a next video in a playlist would be loaded.
+ // So here we load a new video when all ads are done.
+ // Then we load new ads within a new adsManager. When the video
+ // Is started - after - the ads are loaded, then we get ads.
+ // You can also easily test cancelling and reloading by running
+ // player.ads.cancel() and player.ads.play from the console I guess.
+ // this.player.source = {
+ // type: 'video',
+ // title: 'View From A Blue Moon',
+ // sources: [{
+ // src:
+ // 'https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.mp4', type:
+ // 'video/mp4', }], poster:
+ // 'https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.jpg', tracks:
+ // [ { kind: 'captions', label: 'English', srclang: 'en', src:
+ // 'https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.en.vtt',
+ // default: true, }, { kind: 'captions', label: 'French', srclang: 'fr', src:
+ // 'https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.fr.vtt', }, ],
+ // };
+ // TODO: So there is still this thing where a video should only be allowed to start
+ // playing when the IMA SDK is ready or has failed
+ if (this.player.ended) {
+ this.loadAds();
+ } else {
+ // The SDK won't allow new ads to be called without receiving a contentComplete()
+ this.loader.contentComplete();
+ }
+
+ break;
+
+ case google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED:
+ // This event indicates the ad has started - the video player can adjust the UI,
+ // for example display a pause button and remaining time. Fired when content should
+ // be paused. This usually happens right before an ad is about to cover the content
+ this.pauseContent();
+ break;
+
+ case google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED:
+ // This event indicates the ad has finished - the video player can perform
+ // appropriate UI actions, such as removing the timer for remaining time detection.
+ // Fired when content should be resumed. This usually happens when an ad finishes
+ // or collapses
+ this.pollCountdown();
+ this.resumeContent();
+ break;
+
+ case google.ima.AdEvent.Type.LOG:
+ if (adData.adError) {
+ this.player.debug.warn("Non-fatal ad error: ".concat(adData.adError.getMessage()));
+ }
+
+ break;
+ }
+ }
+ /**
+ * Any ad error handling comes through here
+ * @param {Event} event
+ */
+
+ }, {
+ key: "onAdError",
+ value: function onAdError(event) {
+ this.cancel();
+ this.player.debug.warn('Ads error', event);
+ }
+ /**
+ * Setup hooks for Plyr and window events. This ensures
+ * the mid- and post-roll launch at the correct time. And
+ * resize the advertisement when the player resizes
+ */
+
+ }, {
+ key: "listeners",
+ value: function listeners() {
+ var _this9 = this;
+
+ var container = this.player.elements.container;
+ var time;
+ this.player.on('canplay', function () {
+ _this9.addCuePoints();
+ });
+ this.player.on('ended', function () {
+ _this9.loader.contentComplete();
+ });
+ this.player.on('timeupdate', function () {
+ time = _this9.player.currentTime;
+ });
+ this.player.on('seeked', function () {
+ var seekedTime = _this9.player.currentTime;
+
+ if (is$1.empty(_this9.cuePoints)) {
+ return;
+ }
+
+ _this9.cuePoints.forEach(function (cuePoint, index) {
+ if (time < cuePoint && cuePoint < seekedTime) {
+ _this9.manager.discardAdBreak();
+
+ _this9.cuePoints.splice(index, 1);
+ }
+ });
+ }); // Listen to the resizing of the window. And resize ad accordingly
+ // TODO: eventually implement ResizeObserver
+
+ window.addEventListener('resize', function () {
+ if (_this9.manager) {
+ _this9.manager.resize(container.offsetWidth, container.offsetHeight, google.ima.ViewMode.NORMAL);
+ }
+ });
+ }
+ /**
+ * Initialize the adsManager and start playing advertisements
+ */
+
+ }, {
+ key: "play",
+ value: function play() {
+ var _this10 = this;
+
+ var container = this.player.elements.container;
+
+ if (!this.managerPromise) {
+ this.resumeContent();
+ } // Play the requested advertisement whenever the adsManager is ready
+
+
+ this.managerPromise.then(function () {
+ // Set volume to match player
+ _this10.manager.setVolume(_this10.player.volume); // Initialize the container. Must be done via a user action on mobile devices
+
+
+ _this10.elements.displayContainer.initialize();
+
+ try {
+ if (!_this10.initialized) {
+ // Initialize the ads manager. Ad rules playlist will start at this time
+ _this10.manager.init(container.offsetWidth, container.offsetHeight, google.ima.ViewMode.NORMAL); // Call play to start showing the ad. Single video and overlay ads will
+ // start at this time; the call will be ignored for ad rules
+
+
+ _this10.manager.start();
+ }
+
+ _this10.initialized = true;
+ } catch (adError) {
+ // An error may be thrown if there was a problem with the
+ // VAST response
+ _this10.onAdError(adError);
+ }
+ }).catch(function () {});
+ }
+ /**
+ * Resume our video
+ */
+
+ }, {
+ key: "resumeContent",
+ value: function resumeContent() {
+ // Hide the advertisement container
+ this.elements.container.style.zIndex = ''; // Ad is stopped
+
+ this.playing = false; // Play video
+
+ silencePromise(this.player.media.play());
+ }
+ /**
+ * Pause our video
+ */
+
+ }, {
+ key: "pauseContent",
+ value: function pauseContent() {
+ // Show the advertisement container
+ this.elements.container.style.zIndex = 3; // Ad is playing
+
+ this.playing = true; // Pause our video.
+
+ this.player.media.pause();
+ }
+ /**
+ * Destroy the adsManager so we can grab new ads after this. If we don't then we're not
+ * allowed to call new ads based on google policies, as they interpret this as an accidental
+ * video requests. https://developers.google.com/interactive-
+ * media-ads/docs/sdks/android/faq#8
+ */
+
+ }, {
+ key: "cancel",
+ value: function cancel() {
+ // Pause our video
+ if (this.initialized) {
+ this.resumeContent();
+ } // Tell our instance that we're done for now
+
+
+ this.trigger('error'); // Re-create our adsManager
+
+ this.loadAds();
+ }
+ /**
+ * Re-create our adsManager
+ */
+
+ }, {
+ key: "loadAds",
+ value: function loadAds() {
+ var _this11 = this;
+
+ // Tell our adsManager to go bye bye
+ this.managerPromise.then(function () {
+ // Destroy our adsManager
+ if (_this11.manager) {
+ _this11.manager.destroy();
+ } // Re-set our adsManager promises
+
+
+ _this11.managerPromise = new Promise(function (resolve) {
+ _this11.on('loaded', resolve);
+
+ _this11.player.debug.log(_this11.manager);
+ }); // Now that the manager has been destroyed set it to also be un-initialized
+
+ _this11.initialized = false; // Now request some new advertisements
+
+ _this11.requestAds();
+ }).catch(function () {});
+ }
+ /**
+ * Handles callbacks after an ad event was invoked
+ * @param {String} event - Event type
+ */
+
+ }, {
+ key: "trigger",
+ value: function trigger(event) {
+ var _this12 = this;
+
+ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
+ args[_key - 1] = arguments[_key];
+ }
+
+ var handlers = this.events[event];
+
+ if (is$1.array(handlers)) {
+ handlers.forEach(function (handler) {
+ if (is$1.function(handler)) {
+ handler.apply(_this12, args);
+ }
+ });
+ }
+ }
+ /**
+ * Add event listeners
+ * @param {String} event - Event type
+ * @param {Function} callback - Callback for when event occurs
+ * @return {Ads}
+ */
+
+ }, {
+ key: "on",
+ value: function on(event, callback) {
+ if (!is$1.array(this.events[event])) {
+ this.events[event] = [];
+ }
+
+ this.events[event].push(callback);
+ return this;
+ }
+ /**
+ * Setup a safety timer for when the ad network doesn't respond for whatever reason.
+ * The advertisement has 12 seconds to get its things together. We stop this timer when the
+ * advertisement is playing, or when a user action is required to start, then we clear the
+ * timer on ad ready
+ * @param {Number} time
+ * @param {String} from
+ */
+
+ }, {
+ key: "startSafetyTimer",
+ value: function startSafetyTimer(time, from) {
+ var _this13 = this;
+
+ this.player.debug.log("Safety timer invoked from: ".concat(from));
+ this.safetyTimer = setTimeout(function () {
+ _this13.cancel();
+
+ _this13.clearSafetyTimer('startSafetyTimer()');
+ }, time);
+ }
+ /**
+ * Clear our safety timer(s)
+ * @param {String} from
+ */
+
+ }, {
+ key: "clearSafetyTimer",
+ value: function clearSafetyTimer(from) {
+ if (!is$1.nullOrUndefined(this.safetyTimer)) {
+ this.player.debug.log("Safety timer cleared from: ".concat(from));
+ clearTimeout(this.safetyTimer);
+ this.safetyTimer = null;
+ }
+ }
+ }, {
+ key: "enabled",
+ get: function get() {
+ var config = this.config;
+ return this.player.isHTML5 && this.player.isVideo && config.enabled && (!is$1.empty(config.publisherId) || is$1.url(config.tagUrl));
+ }
+ }, {
+ key: "tagUrl",
+ get: function get() {
+ var config = this.config;
+
+ if (is$1.url(config.tagUrl)) {
+ return config.tagUrl;
+ }
+
+ var params = {
+ AV_PUBLISHERID: '58c25bb0073ef448b1087ad6',
+ AV_CHANNELID: '5a0458dc28a06145e4519d21',
+ AV_URL: window.location.hostname,
+ cb: Date.now(),
+ AV_WIDTH: 640,
+ AV_HEIGHT: 480,
+ AV_CDIM2: config.publisherId
+ };
+ var base = 'https://go.aniview.com/api/adserver6/vast/';
+ return "".concat(base, "?").concat(buildUrlParams(params));
+ }
+ }]);
+
+ return Ads;
+}();
+
+var $findIndex = arrayIteration.findIndex;
+
+
+
+var FIND_INDEX = 'findIndex';
+var SKIPS_HOLES$1 = true;
+
+var USES_TO_LENGTH$b = arrayMethodUsesToLength(FIND_INDEX);
+
+// Shouldn't skip holes
+if (FIND_INDEX in []) Array(1)[FIND_INDEX](function () { SKIPS_HOLES$1 = false; });
+
+// `Array.prototype.findIndex` method
+// https://tc39.github.io/ecma262/#sec-array.prototype.findindex
+_export({ target: 'Array', proto: true, forced: SKIPS_HOLES$1 || !USES_TO_LENGTH$b }, {
+ findIndex: function findIndex(callbackfn /* , that = undefined */) {
+ return $findIndex(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
+ }
+});
+
+// https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables
+addToUnscopables(FIND_INDEX);
+
+var min$6 = Math.min;
+var nativeLastIndexOf = [].lastIndexOf;
+var NEGATIVE_ZERO$1 = !!nativeLastIndexOf && 1 / [1].lastIndexOf(1, -0) < 0;
+var STRICT_METHOD$6 = arrayMethodIsStrict('lastIndexOf');
+// For preventing possible almost infinite loop in non-standard implementations, test the forward version of the method
+var USES_TO_LENGTH$c = arrayMethodUsesToLength('indexOf', { ACCESSORS: true, 1: 0 });
+var FORCED$5 = NEGATIVE_ZERO$1 || !STRICT_METHOD$6 || !USES_TO_LENGTH$c;
+
+// `Array.prototype.lastIndexOf` method implementation
+// https://tc39.github.io/ecma262/#sec-array.prototype.lastindexof
+var arrayLastIndexOf = FORCED$5 ? function lastIndexOf(searchElement /* , fromIndex = @[*-1] */) {
+ // convert -0 to +0
+ if (NEGATIVE_ZERO$1) return nativeLastIndexOf.apply(this, arguments) || 0;
+ var O = toIndexedObject(this);
+ var length = toLength(O.length);
+ var index = length - 1;
+ if (arguments.length > 1) index = min$6(index, toInteger(arguments[1]));
+ if (index < 0) index = length + index;
+ for (;index >= 0; index--) if (index in O && O[index] === searchElement) return index || 0;
+ return -1;
+} : nativeLastIndexOf;
+
+// `Array.prototype.lastIndexOf` method
+// https://tc39.github.io/ecma262/#sec-array.prototype.lastindexof
+_export({ target: 'Array', proto: true, forced: arrayLastIndexOf !== [].lastIndexOf }, {
+ lastIndexOf: arrayLastIndexOf
+});
+
+var parseVtt = function parseVtt(vttDataString) {
+ var processedList = [];
+ var frames = vttDataString.split(/\r\n\r\n|\n\n|\r\r/);
+ frames.forEach(function (frame) {
+ var result = {};
+ var lines = frame.split(/\r\n|\n|\r/);
+ lines.forEach(function (line) {
+ if (!is$1.number(result.startTime)) {
+ // The line with start and end times on it is the first line of interest
+ 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
+
+ if (matchTimes) {
+ result.startTime = Number(matchTimes[1] || 0) * 60 * 60 + Number(matchTimes[2]) * 60 + Number(matchTimes[3]) + Number("0.".concat(matchTimes[4]));
+ result.endTime = Number(matchTimes[6] || 0) * 60 * 60 + Number(matchTimes[7]) * 60 + Number(matchTimes[8]) + Number("0.".concat(matchTimes[9]));
+ }
+ } else if (!is$1.empty(line.trim()) && is$1.empty(result.text)) {
+ // If we already have the startTime, then we're definitely up to the text line(s)
+ var lineSplit = line.trim().split('#xywh=');
+
+ var _lineSplit = _slicedToArray(lineSplit, 1);
+
+ result.text = _lineSplit[0];
+
+ // If there's content in lineSplit[1], then we have sprites. If not, then it's just one frame per image
+ if (lineSplit[1]) {
+ var _lineSplit$1$split = lineSplit[1].split(',');
+
+ var _lineSplit$1$split2 = _slicedToArray(_lineSplit$1$split, 4);
+
+ result.x = _lineSplit$1$split2[0];
+ result.y = _lineSplit$1$split2[1];
+ result.w = _lineSplit$1$split2[2];
+ result.h = _lineSplit$1$split2[3];
+ }
+ }
+ });
+
+ if (result.text) {
+ processedList.push(result);
+ }
+ });
+ return processedList;
+};
+/**
+ * Preview thumbnails for seek hover and scrubbing
+ * Seeking: Hover over the seek bar (desktop only): shows a small preview container above the seek bar
+ * 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
+ *
+ * Notes:
+ * - 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
+ * - 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
+ * - 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
+ */
+
+
+var fitRatio = function fitRatio(ratio, outer) {
+ var targetRatio = outer.width / outer.height;
+ var result = {};
+
+ if (ratio > targetRatio) {
+ result.width = outer.width;
+ result.height = 1 / ratio * outer.width;
+ } else {
+ result.height = outer.height;
+ result.width = ratio * outer.height;
+ }
+
+ return result;
+};
+
+var PreviewThumbnails = /*#__PURE__*/function () {
+ /**
+ * PreviewThumbnails constructor.
+ * @param {Plyr} player
+ * @return {PreviewThumbnails}
+ */
+ function PreviewThumbnails(player) {
+ _classCallCheck(this, PreviewThumbnails);
+
+ this.player = player;
+ this.thumbnails = [];
+ this.loaded = false;
+ this.lastMouseMoveTime = Date.now();
+ this.mouseDown = false;
+ this.loadedImages = [];
+ this.elements = {
+ thumb: {},
+ scrubbing: {}
+ };
+ this.load();
+ }
+
+ _createClass(PreviewThumbnails, [{
+ key: "load",
+ value: function load() {
+ var _this = this;
+
+ // Toggle the regular seek tooltip
+ if (this.player.elements.display.seekTooltip) {
+ this.player.elements.display.seekTooltip.hidden = this.enabled;
+ }
+
+ if (!this.enabled) {
+ return;
+ }
+
+ this.getThumbnails().then(function () {
+ if (!_this.enabled) {
+ return;
+ } // Render DOM elements
+
+
+ _this.render(); // Check to see if thumb container size was specified manually in CSS
+
+
+ _this.determineContainerAutoSizing();
+
+ _this.loaded = true;
+ });
+ } // Download VTT files and parse them
+
+ }, {
+ key: "getThumbnails",
+ value: function getThumbnails() {
+ var _this2 = this;
+
+ return new Promise(function (resolve) {
+ var src = _this2.player.config.previewThumbnails.src;
+
+ if (is$1.empty(src)) {
+ throw new Error('Missing previewThumbnails.src config attribute');
+ } // Resolve promise
+
+
+ var sortAndResolve = function sortAndResolve() {
+ // Sort smallest to biggest (e.g., [120p, 480p, 1080p])
+ _this2.thumbnails.sort(function (x, y) {
+ return x.height - y.height;
+ });
+
+ _this2.player.debug.log('Preview thumbnails', _this2.thumbnails);
+
+ resolve();
+ }; // Via callback()
+
+
+ if (is$1.function(src)) {
+ src(function (thumbnails) {
+ _this2.thumbnails = thumbnails;
+ sortAndResolve();
+ });
+ } // VTT urls
+ else {
+ // If string, convert into single-element list
+ 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
+
+ var promises = urls.map(function (u) {
+ return _this2.getThumbnail(u);
+ }); // Resolve
+
+ Promise.all(promises).then(sortAndResolve);
+ }
+ });
+ } // Process individual VTT file
+
+ }, {
+ key: "getThumbnail",
+ value: function getThumbnail(url) {
+ var _this3 = this;
+
+ return new Promise(function (resolve) {
+ fetch(url).then(function (response) {
+ var thumbnail = {
+ frames: parseVtt(response),
+ height: null,
+ urlPrefix: ''
+ }; // If the URLs don't start with '/', then we need to set their relative path to be the location of the VTT file
+ // If the URLs do start with '/', then they obviously don't need a prefix, so it will remain blank
+ // 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
+
+ if (!thumbnail.frames[0].text.startsWith('/') && !thumbnail.frames[0].text.startsWith('http://') && !thumbnail.frames[0].text.startsWith('https://')) {
+ thumbnail.urlPrefix = url.substring(0, url.lastIndexOf('/') + 1);
+ } // Download the first frame, so that we can determine/set the height of this thumbnailsDef
+
+
+ var tempImage = new Image();
+
+ tempImage.onload = function () {
+ thumbnail.height = tempImage.naturalHeight;
+ thumbnail.width = tempImage.naturalWidth;
+
+ _this3.thumbnails.push(thumbnail);
+
+ resolve();
+ };
+
+ tempImage.src = thumbnail.urlPrefix + thumbnail.frames[0].text;
+ });
+ });
+ }
+ }, {
+ key: "startMove",
+ value: function startMove(event) {
+ if (!this.loaded) {
+ return;
+ }
+
+ if (!is$1.event(event) || !['touchmove', 'mousemove'].includes(event.type)) {
+ return;
+ } // Wait until media has a duration
+
+
+ if (!this.player.media.duration) {
+ return;
+ }
+
+ if (event.type === 'touchmove') {
+ // Calculate seek hover position as approx video seconds
+ this.seekTime = this.player.media.duration * (this.player.elements.inputs.seek.value / 100);
+ } else {
+ // Calculate seek hover position as approx video seconds
+ var clientRect = this.player.elements.progress.getBoundingClientRect();
+ var percentage = 100 / clientRect.width * (event.pageX - clientRect.left);
+ this.seekTime = this.player.media.duration * (percentage / 100);
+
+ if (this.seekTime < 0) {
+ // The mousemove fires for 10+px out to the left
+ this.seekTime = 0;
+ }
+
+ if (this.seekTime > this.player.media.duration - 1) {
+ // Took 1 second off the duration for safety, because different players can disagree on the real duration of a video
+ this.seekTime = this.player.media.duration - 1;
+ }
+
+ this.mousePosX = event.pageX; // Set time text inside image container
+
+ this.elements.thumb.time.innerText = formatTime(this.seekTime);
+ } // Download and show image
+
+
+ this.showImageAtCurrentTime();
+ }
+ }, {
+ key: "endMove",
+ value: function endMove() {
+ this.toggleThumbContainer(false, true);
+ }
+ }, {
+ key: "startScrubbing",
+ value: function startScrubbing(event) {
+ // Only act on left mouse button (0), or touch device (event.button does not exist or is false)
+ if (is$1.nullOrUndefined(event.button) || event.button === false || event.button === 0) {
+ this.mouseDown = true; // Wait until media has a duration
+
+ if (this.player.media.duration) {
+ this.toggleScrubbingContainer(true);
+ this.toggleThumbContainer(false, true); // Download and show image
+
+ this.showImageAtCurrentTime();
+ }
+ }
+ }
+ }, {
+ key: "endScrubbing",
+ value: function endScrubbing() {
+ var _this4 = this;
+
+ this.mouseDown = false; // Hide scrubbing preview. But wait until the video has successfully seeked before hiding the scrubbing preview
+
+ if (Math.ceil(this.lastTime) === Math.ceil(this.player.media.currentTime)) {
+ // The video was already seeked/loaded at the chosen time - hide immediately
+ this.toggleScrubbingContainer(false);
+ } else {
+ // The video hasn't seeked yet. Wait for that
+ once.call(this.player, this.player.media, 'timeupdate', function () {
+ // Re-check mousedown - we might have already started scrubbing again
+ if (!_this4.mouseDown) {
+ _this4.toggleScrubbingContainer(false);
+ }
+ });
+ }
+ }
+ /**
+ * Setup hooks for Plyr and window events
+ */
+
+ }, {
+ key: "listeners",
+ value: function listeners() {
+ var _this5 = this;
+
+ // 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
+ this.player.on('play', function () {
+ _this5.toggleThumbContainer(false, true);
+ });
+ this.player.on('seeked', function () {
+ _this5.toggleThumbContainer(false);
+ });
+ this.player.on('timeupdate', function () {
+ _this5.lastTime = _this5.player.media.currentTime;
+ });
+ }
+ /**
+ * Create HTML elements for image containers
+ */
+
+ }, {
+ key: "render",
+ value: function render() {
+ // Create HTML element: plyr__preview-thumbnail-container
+ this.elements.thumb.container = createElement('div', {
+ class: this.player.config.classNames.previewThumbnails.thumbContainer
+ }); // Wrapper for the image for styling
+
+ this.elements.thumb.imageContainer = createElement('div', {
+ class: this.player.config.classNames.previewThumbnails.imageContainer
+ });
+ this.elements.thumb.container.appendChild(this.elements.thumb.imageContainer); // Create HTML element, parent+span: time text (e.g., 01:32:00)
+
+ var timeContainer = createElement('div', {
+ class: this.player.config.classNames.previewThumbnails.timeContainer
+ });
+ this.elements.thumb.time = createElement('span', {}, '00:00');
+ timeContainer.appendChild(this.elements.thumb.time);
+ this.elements.thumb.container.appendChild(timeContainer); // Inject the whole thumb
+
+ if (is$1.element(this.player.elements.progress)) {
+ this.player.elements.progress.appendChild(this.elements.thumb.container);
+ } // Create HTML element: plyr__preview-scrubbing-container
+
+
+ this.elements.scrubbing.container = createElement('div', {
+ class: this.player.config.classNames.previewThumbnails.scrubbingContainer
+ });
+ this.player.elements.wrapper.appendChild(this.elements.scrubbing.container);
+ }
+ }, {
+ key: "destroy",
+ value: function destroy() {
+ if (this.elements.thumb.container) {
+ this.elements.thumb.container.remove();
+ }
+
+ if (this.elements.scrubbing.container) {
+ this.elements.scrubbing.container.remove();
+ }
+ }
+ }, {
+ key: "showImageAtCurrentTime",
+ value: function showImageAtCurrentTime() {
+ var _this6 = this;
+
+ if (this.mouseDown) {
+ this.setScrubbingContainerSize();
+ } else {
+ this.setThumbContainerSizeAndPos();
+ } // Find the desired thumbnail index
+ // TODO: Handle a video longer than the thumbs where thumbNum is null
+
+
+ var thumbNum = this.thumbnails[0].frames.findIndex(function (frame) {
+ return _this6.seekTime >= frame.startTime && _this6.seekTime <= frame.endTime;
+ });
+ var hasThumb = thumbNum >= 0;
+ var qualityIndex = 0; // Show the thumb container if we're not scrubbing
+
+ if (!this.mouseDown) {
+ this.toggleThumbContainer(hasThumb);
+ } // No matching thumb found
+
+
+ if (!hasThumb) {
+ return;
+ } // Check to see if we've already downloaded higher quality versions of this image
+
+
+ this.thumbnails.forEach(function (thumbnail, index) {
+ if (_this6.loadedImages.includes(thumbnail.frames[thumbNum].text)) {
+ qualityIndex = index;
+ }
+ }); // Only proceed if either thumbnum or thumbfilename has changed
+
+ if (thumbNum !== this.showingThumb) {
+ this.showingThumb = thumbNum;
+ this.loadImage(qualityIndex);
+ }
+ } // Show the image that's currently specified in this.showingThumb
+
+ }, {
+ key: "loadImage",
+ value: function loadImage() {
+ var _this7 = this;
+
+ var qualityIndex = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
+ var thumbNum = this.showingThumb;
+ var thumbnail = this.thumbnails[qualityIndex];
+ var urlPrefix = thumbnail.urlPrefix;
+ var frame = thumbnail.frames[thumbNum];
+ var thumbFilename = thumbnail.frames[thumbNum].text;
+ var thumbUrl = urlPrefix + thumbFilename;
+
+ if (!this.currentImageElement || this.currentImageElement.dataset.filename !== thumbFilename) {
+ // If we're already loading a previous image, remove its onload handler - we don't want it to load after this one
+ // Only do this if not using sprites. Without sprites we really want to show as many images as possible, as a best-effort
+ if (this.loadingImage && this.usingSprites) {
+ this.loadingImage.onload = null;
+ } // We're building and adding a new image. In other implementations of similar functionality (YouTube), background image
+ // is instead used. But this causes issues with larger images in Firefox and Safari - switching between background
+ // images causes a flicker. Putting a new image over the top does not
+
+
+ var previewImage = new Image();
+ previewImage.src = thumbUrl;
+ previewImage.dataset.index = thumbNum;
+ previewImage.dataset.filename = thumbFilename;
+ this.showingThumbFilename = thumbFilename;
+ 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...
+
+ previewImage.onload = function () {
+ return _this7.showImage(previewImage, frame, qualityIndex, thumbNum, thumbFilename, true);
+ };
+
+ this.loadingImage = previewImage;
+ this.removeOldImages(previewImage);
+ } else {
+ // Update the existing image
+ this.showImage(this.currentImageElement, frame, qualityIndex, thumbNum, thumbFilename, false);
+ this.currentImageElement.dataset.index = thumbNum;
+ this.removeOldImages(this.currentImageElement);
+ }
+ }
+ }, {
+ key: "showImage",
+ value: function showImage(previewImage, frame, qualityIndex, thumbNum, thumbFilename) {
+ var newImage = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : true;
+ this.player.debug.log("Showing thumb: ".concat(thumbFilename, ". num: ").concat(thumbNum, ". qual: ").concat(qualityIndex, ". newimg: ").concat(newImage));
+ this.setImageSizeAndOffset(previewImage, frame);
+
+ if (newImage) {
+ this.currentImageContainer.appendChild(previewImage);
+ this.currentImageElement = previewImage;
+
+ if (!this.loadedImages.includes(thumbFilename)) {
+ this.loadedImages.push(thumbFilename);
+ }
+ } // Preload images before and after the current one
+ // Show higher quality of the same frame
+ // 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
+
+
+ this.preloadNearby(thumbNum, true).then(this.preloadNearby(thumbNum, false)).then(this.getHigherQuality(qualityIndex, previewImage, frame, thumbFilename));
+ } // Remove all preview images that aren't the designated current image
+
+ }, {
+ key: "removeOldImages",
+ value: function removeOldImages(currentImage) {
+ var _this8 = this;
+
+ // Get a list of all images, convert it from a DOM list to an array
+ Array.from(this.currentImageContainer.children).forEach(function (image) {
+ if (image.tagName.toLowerCase() !== 'img') {
+ return;
+ }
+
+ var removeDelay = _this8.usingSprites ? 500 : 1000;
+
+ if (image.dataset.index !== currentImage.dataset.index && !image.dataset.deleting) {
+ // 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
+ // First set attribute 'deleting' to prevent multi-handling of this on repeat firing of this function
+ // eslint-disable-next-line no-param-reassign
+ image.dataset.deleting = true; // This has to be set before the timeout - to prevent issues switching between hover and scrub
+
+ var currentImageContainer = _this8.currentImageContainer;
+ setTimeout(function () {
+ currentImageContainer.removeChild(image);
+
+ _this8.player.debug.log("Removing thumb: ".concat(image.dataset.filename));
+ }, removeDelay);
+ }
+ });
+ } // Preload images before and after the current one. Only if the user is still hovering/seeking the same frame
+ // This will only preload the lowest quality
+
+ }, {
+ key: "preloadNearby",
+ value: function preloadNearby(thumbNum) {
+ var _this9 = this;
+
+ var forward = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
+ return new Promise(function (resolve) {
+ setTimeout(function () {
+ var oldThumbFilename = _this9.thumbnails[0].frames[thumbNum].text;
+
+ if (_this9.showingThumbFilename === oldThumbFilename) {
+ // 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
+ var thumbnailsClone;
+
+ if (forward) {
+ thumbnailsClone = _this9.thumbnails[0].frames.slice(thumbNum);
+ } else {
+ thumbnailsClone = _this9.thumbnails[0].frames.slice(0, thumbNum).reverse();
+ }
+
+ var foundOne = false;
+ thumbnailsClone.forEach(function (frame) {
+ var newThumbFilename = frame.text;
+
+ if (newThumbFilename !== oldThumbFilename) {
+ // Found one with a different filename. Make sure it hasn't already been loaded on this page visit
+ if (!_this9.loadedImages.includes(newThumbFilename)) {
+ foundOne = true;
+
+ _this9.player.debug.log("Preloading thumb filename: ".concat(newThumbFilename));
+
+ var urlPrefix = _this9.thumbnails[0].urlPrefix;
+ var thumbURL = urlPrefix + newThumbFilename;
+ var previewImage = new Image();
+ previewImage.src = thumbURL;
+
+ previewImage.onload = function () {
+ _this9.player.debug.log("Preloaded thumb filename: ".concat(newThumbFilename));
+
+ if (!_this9.loadedImages.includes(newThumbFilename)) _this9.loadedImages.push(newThumbFilename); // We don't resolve until the thumb is loaded
+
+ resolve();
+ };
+ }
+ }
+ }); // If there are none to preload then we want to resolve immediately
+
+ if (!foundOne) {
+ resolve();
+ }
+ }
+ }, 300);
+ });
+ } // If user has been hovering current image for half a second, look for a higher quality one
+
+ }, {
+ key: "getHigherQuality",
+ value: function getHigherQuality(currentQualityIndex, previewImage, frame, thumbFilename) {
+ var _this10 = this;
+
+ if (currentQualityIndex < this.thumbnails.length - 1) {
+ // 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
+ var previewImageHeight = previewImage.naturalHeight;
+
+ if (this.usingSprites) {
+ previewImageHeight = frame.h;
+ }
+
+ if (previewImageHeight < this.thumbContainerHeight) {
+ // Recurse back to the loadImage function - show a higher quality one, but only if the viewer is on this frame for a while
+ setTimeout(function () {
+ // Make sure the mouse hasn't already moved on and started hovering at another image
+ if (_this10.showingThumbFilename === thumbFilename) {
+ _this10.player.debug.log("Showing higher quality thumb for: ".concat(thumbFilename));
+
+ _this10.loadImage(currentQualityIndex + 1);
+ }
+ }, 300);
+ }
+ }
+ }
+ }, {
+ key: "toggleThumbContainer",
+ value: function toggleThumbContainer() {
+ var toggle = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
+ var clearShowing = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
+ var className = this.player.config.classNames.previewThumbnails.thumbContainerShown;
+ this.elements.thumb.container.classList.toggle(className, toggle);
+
+ if (!toggle && clearShowing) {
+ this.showingThumb = null;
+ this.showingThumbFilename = null;
+ }
+ }
+ }, {
+ key: "toggleScrubbingContainer",
+ value: function toggleScrubbingContainer() {
+ var toggle = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
+ var className = this.player.config.classNames.previewThumbnails.scrubbingContainerShown;
+ this.elements.scrubbing.container.classList.toggle(className, toggle);
+
+ if (!toggle) {
+ this.showingThumb = null;
+ this.showingThumbFilename = null;
+ }
+ }
+ }, {
+ key: "determineContainerAutoSizing",
+ value: function determineContainerAutoSizing() {
+ if (this.elements.thumb.imageContainer.clientHeight > 20 || this.elements.thumb.imageContainer.clientWidth > 20) {
+ // This will prevent auto sizing in this.setThumbContainerSizeAndPos()
+ this.sizeSpecifiedInCSS = true;
+ }
+ } // 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
+
+ }, {
+ key: "setThumbContainerSizeAndPos",
+ value: function setThumbContainerSizeAndPos() {
+ if (!this.sizeSpecifiedInCSS) {
+ var thumbWidth = Math.floor(this.thumbContainerHeight * this.thumbAspectRatio);
+ this.elements.thumb.imageContainer.style.height = "".concat(this.thumbContainerHeight, "px");
+ this.elements.thumb.imageContainer.style.width = "".concat(thumbWidth, "px");
+ } else if (this.elements.thumb.imageContainer.clientHeight > 20 && this.elements.thumb.imageContainer.clientWidth < 20) {
+ var _thumbWidth = Math.floor(this.elements.thumb.imageContainer.clientHeight * this.thumbAspectRatio);
+
+ this.elements.thumb.imageContainer.style.width = "".concat(_thumbWidth, "px");
+ } else if (this.elements.thumb.imageContainer.clientHeight < 20 && this.elements.thumb.imageContainer.clientWidth > 20) {
+ var thumbHeight = Math.floor(this.elements.thumb.imageContainer.clientWidth / this.thumbAspectRatio);
+ this.elements.thumb.imageContainer.style.height = "".concat(thumbHeight, "px");
+ }
+
+ this.setThumbContainerPos();
+ }
+ }, {
+ key: "setThumbContainerPos",
+ value: function setThumbContainerPos() {
+ var seekbarRect = this.player.elements.progress.getBoundingClientRect();
+ var plyrRect = this.player.elements.container.getBoundingClientRect();
+ 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
+
+ var minVal = plyrRect.left - seekbarRect.left + 10;
+ var maxVal = plyrRect.right - seekbarRect.left - container.clientWidth - 10; // Set preview container position to: mousepos, minus seekbar.left, minus half of previewContainer.clientWidth
+
+ var previewPos = this.mousePosX - seekbarRect.left - container.clientWidth / 2;
+
+ if (previewPos < minVal) {
+ previewPos = minVal;
+ }
+
+ if (previewPos > maxVal) {
+ previewPos = maxVal;
+ }
+
+ container.style.left = "".concat(previewPos, "px");
+ } // Can't use 100% width, in case the video is a different aspect ratio to the video container
+
+ }, {
+ key: "setScrubbingContainerSize",
+ value: function setScrubbingContainerSize() {
+ var _fitRatio = fitRatio(this.thumbAspectRatio, {
+ width: this.player.media.clientWidth,
+ height: this.player.media.clientHeight
+ }),
+ width = _fitRatio.width,
+ height = _fitRatio.height;
+
+ this.elements.scrubbing.container.style.width = "".concat(width, "px");
+ this.elements.scrubbing.container.style.height = "".concat(height, "px");
+ } // Sprites need to be offset to the correct location
+
+ }, {
+ key: "setImageSizeAndOffset",
+ value: function setImageSizeAndOffset(previewImage, frame) {
+ if (!this.usingSprites) {
+ return;
+ } // Find difference between height and preview container height
+
+
+ var multiplier = this.thumbContainerHeight / frame.h; // eslint-disable-next-line no-param-reassign
+
+ previewImage.style.height = "".concat(previewImage.naturalHeight * multiplier, "px"); // eslint-disable-next-line no-param-reassign
+
+ previewImage.style.width = "".concat(previewImage.naturalWidth * multiplier, "px"); // eslint-disable-next-line no-param-reassign
+
+ previewImage.style.left = "-".concat(frame.x * multiplier, "px"); // eslint-disable-next-line no-param-reassign
+
+ previewImage.style.top = "-".concat(frame.y * multiplier, "px");
+ }
+ }, {
+ key: "enabled",
+ get: function get() {
+ return this.player.isHTML5 && this.player.isVideo && this.player.config.previewThumbnails.enabled;
+ }
+ }, {
+ key: "currentImageContainer",
+ get: function get() {
+ if (this.mouseDown) {
+ return this.elements.scrubbing.container;
+ }
+
+ return this.elements.thumb.imageContainer;
+ }
+ }, {
+ key: "usingSprites",
+ get: function get() {
+ return Object.keys(this.thumbnails[0].frames[0]).includes('w');
+ }
+ }, {
+ key: "thumbAspectRatio",
+ get: function get() {
+ if (this.usingSprites) {
+ return this.thumbnails[0].frames[0].w / this.thumbnails[0].frames[0].h;
+ }
+
+ return this.thumbnails[0].width / this.thumbnails[0].height;
+ }
+ }, {
+ key: "thumbContainerHeight",
+ get: function get() {
+ if (this.mouseDown) {
+ var _fitRatio2 = fitRatio(this.thumbAspectRatio, {
+ width: this.player.media.clientWidth,
+ height: this.player.media.clientHeight
+ }),
+ height = _fitRatio2.height;
+
+ return height;
+ } // If css is used this needs to return the css height for sprites to work (see setImageSizeAndOffset)
+
+
+ if (this.sizeSpecifiedInCSS) {
+ return this.elements.thumb.imageContainer.clientHeight;
+ }
+
+ return Math.floor(this.player.media.clientWidth / this.thumbAspectRatio / 4);
+ }
+ }, {
+ key: "currentImageElement",
+ get: function get() {
+ if (this.mouseDown) {
+ return this.currentScrubbingImageElement;
+ }
+
+ return this.currentThumbnailImageElement;
+ },
+ set: function set(element) {
+ if (this.mouseDown) {
+ this.currentScrubbingImageElement = element;
+ } else {
+ this.currentThumbnailImageElement = element;
+ }
+ }
+ }]);
+
+ return PreviewThumbnails;
+}();
+
+var source = {
+ // Add elements to HTML5 media (source, tracks, etc)
+ insertElements: function insertElements(type, attributes) {
+ var _this = this;
+
+ if (is$1.string(attributes)) {
+ insertElement(type, this.media, {
+ src: attributes
+ });
+ } else if (is$1.array(attributes)) {
+ attributes.forEach(function (attribute) {
+ insertElement(type, _this.media, attribute);
+ });
+ }
+ },
+ // Update source
+ // Sources are not checked for support so be careful
+ change: function change(input) {
+ var _this2 = this;
+
+ if (!getDeep(input, 'sources.length')) {
+ this.debug.warn('Invalid source format');
+ return;
+ } // Cancel current network requests
+
+
+ html5.cancelRequests.call(this); // Destroy instance and re-setup
+
+ this.destroy.call(this, function () {
+ // Reset quality options
+ _this2.options.quality = []; // Remove elements
+
+ removeElement(_this2.media);
+ _this2.media = null; // Reset class name
+
+ if (is$1.element(_this2.elements.container)) {
+ _this2.elements.container.removeAttribute('class');
+ } // Set the type and provider
+
+
+ var sources = input.sources,
+ type = input.type;
+
+ var _sources = _slicedToArray(sources, 1),
+ _sources$ = _sources[0],
+ _sources$$provider = _sources$.provider,
+ provider = _sources$$provider === void 0 ? providers.html5 : _sources$$provider,
+ src = _sources$.src;
+
+ var tagName = provider === 'html5' ? type : 'div';
+ var attributes = provider === 'html5' ? {} : {
+ src: src
+ };
+ Object.assign(_this2, {
+ provider: provider,
+ type: type,
+ // Check for support
+ supported: support.check(type, provider, _this2.config.playsinline),
+ // Create new element
+ media: createElement(tagName, attributes)
+ }); // Inject the new element
+
+ _this2.elements.container.appendChild(_this2.media); // Autoplay the new source?
+
+
+ if (is$1.boolean(input.autoplay)) {
+ _this2.config.autoplay = input.autoplay;
+ } // Set attributes for audio and video
+
+
+ if (_this2.isHTML5) {
+ if (_this2.config.crossorigin) {
+ _this2.media.setAttribute('crossorigin', '');
+ }
+
+ if (_this2.config.autoplay) {
+ _this2.media.setAttribute('autoplay', '');
+ }
+
+ if (!is$1.empty(input.poster)) {
+ _this2.poster = input.poster;
+ }
+
+ if (_this2.config.loop.active) {
+ _this2.media.setAttribute('loop', '');
+ }
+
+ if (_this2.config.muted) {
+ _this2.media.setAttribute('muted', '');
+ }
+
+ if (_this2.config.playsinline) {
+ _this2.media.setAttribute('playsinline', '');
+ }
+ } // Restore class hook
+
+
+ ui.addStyleHook.call(_this2); // Set new sources for html5
+
+ if (_this2.isHTML5) {
+ source.insertElements.call(_this2, 'source', sources);
+ } // Set video title
+
+
+ _this2.config.title = input.title; // Set up from scratch
+
+ media.setup.call(_this2); // HTML5 stuff
+
+ if (_this2.isHTML5) {
+ // Setup captions
+ if (Object.keys(input).includes('tracks')) {
+ source.insertElements.call(_this2, 'track', input.tracks);
+ }
+ } // If HTML5 or embed but not fully supported, setupInterface and call ready now
+
+
+ if (_this2.isHTML5 || _this2.isEmbed && !_this2.supported.ui) {
+ // Setup interface
+ ui.build.call(_this2);
+ } // Load HTML5 sources
+
+
+ if (_this2.isHTML5) {
+ _this2.media.load();
+ } // Update previewThumbnails config & reload plugin
+
+
+ if (!is$1.empty(input.previewThumbnails)) {
+ Object.assign(_this2.config.previewThumbnails, input.previewThumbnails); // Cleanup previewThumbnails plugin if it was loaded
+
+ if (_this2.previewThumbnails && _this2.previewThumbnails.loaded) {
+ _this2.previewThumbnails.destroy();
+
+ _this2.previewThumbnails = null;
+ } // Create new instance if it is still enabled
+
+
+ if (_this2.config.previewThumbnails.enabled) {
+ _this2.previewThumbnails = new PreviewThumbnails(_this2);
+ }
+ } // Update the fullscreen support
+
+
+ _this2.fullscreen.update();
+ }, true);
+ }
+};
+
+/**
+ * Returns a number whose value is limited to the given range.
+ *
+ * Example: limit the output of this computation to between 0 and 255
+ * (x * 255).clamp(0, 255)
+ *
+ * @param {Number} input
+ * @param {Number} min The lower boundary of the output range
+ * @param {Number} max The upper boundary of the output range
+ * @returns A number in the range [min, max]
+ * @type Number
+ */
+function clamp() {
+ var input = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
+ var min = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
+ var max = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 255;
+ return Math.min(Math.max(input, min), max);
+}
+
+// TODO: Use a WeakMap for private globals
+// const globals = new WeakMap();
+// Plyr instance
+
+var Plyr = /*#__PURE__*/function () {
+ function Plyr(target, options) {
+ var _this = this;
+
+ _classCallCheck(this, Plyr);
+
+ this.timers = {}; // State
+
+ this.ready = false;
+ this.loading = false;
+ this.failed = false; // Touch device
+
+ this.touch = support.touch; // Set the media element
+
+ this.media = target; // String selector passed
+
+ if (is$1.string(this.media)) {
+ this.media = document.querySelectorAll(this.media);
+ } // jQuery, NodeList or Array passed, use first element
+
+
+ if (window.jQuery && this.media instanceof jQuery || is$1.nodeList(this.media) || is$1.array(this.media)) {
+ // eslint-disable-next-line
+ this.media = this.media[0];
+ } // Set config
+
+
+ this.config = extend({}, defaults$1, Plyr.defaults, options || {}, function () {
+ try {
+ return JSON.parse(_this.media.getAttribute('data-plyr-config'));
+ } catch (e) {
+ return {};
+ }
+ }()); // Elements cache
+
+ this.elements = {
+ container: null,
+ fullscreen: null,
+ captions: null,
+ buttons: {},
+ display: {},
+ progress: {},
+ inputs: {},
+ settings: {
+ popup: null,
+ menu: null,
+ panels: {},
+ buttons: {}
+ }
+ }; // Captions
+
+ this.captions = {
+ active: null,
+ currentTrack: -1,
+ meta: new WeakMap()
+ }; // Fullscreen
+
+ this.fullscreen = {
+ active: false
+ }; // Options
+
+ this.options = {
+ speed: [],
+ quality: []
+ }; // Debugging
+ // TODO: move to globals
+
+ this.debug = new Console(this.config.debug); // Log config options and support
+
+ this.debug.log('Config', this.config);
+ this.debug.log('Support', support); // We need an element to setup
+
+ if (is$1.nullOrUndefined(this.media) || !is$1.element(this.media)) {
+ this.debug.error('Setup failed: no suitable element passed');
+ return;
+ } // Bail if the element is initialized
+
+
+ if (this.media.plyr) {
+ this.debug.warn('Target already setup');
+ return;
+ } // Bail if not enabled
+
+
+ if (!this.config.enabled) {
+ this.debug.error('Setup failed: disabled by config');
+ return;
+ } // Bail if disabled or no basic support
+ // You may want to disable certain UAs etc
+
+
+ if (!support.check().api) {
+ this.debug.error('Setup failed: no support');
+ return;
+ } // Cache original element state for .destroy()
+
+
+ var clone = this.media.cloneNode(true);
+ clone.autoplay = false;
+ this.elements.original = clone; // Set media type based on tag or data attribute
+ // Supported: video, audio, vimeo, youtube
+
+ var type = this.media.tagName.toLowerCase(); // Embed properties
+
+ var iframe = null;
+ var url = null; // Different setup based on type
+
+ switch (type) {
+ case 'div':
+ // Find the frame
+ iframe = this.media.querySelector('iframe'); // <iframe> type
+
+ if (is$1.element(iframe)) {
+ // Detect provider
+ url = parseUrl(iframe.getAttribute('src'));
+ this.provider = getProviderByUrl(url.toString()); // Rework elements
+
+ this.elements.container = this.media;
+ this.media = iframe; // Reset classname
+
+ this.elements.container.className = ''; // Get attributes from URL and set config
+
+ if (url.search.length) {
+ var truthy = ['1', 'true'];
+
+ if (truthy.includes(url.searchParams.get('autoplay'))) {
+ this.config.autoplay = true;
+ }
+
+ if (truthy.includes(url.searchParams.get('loop'))) {
+ this.config.loop.active = true;
+ } // TODO: replace fullscreen.iosNative with this playsinline config option
+ // YouTube requires the playsinline in the URL
+
+
+ if (this.isYouTube) {
+ this.config.playsinline = truthy.includes(url.searchParams.get('playsinline'));
+ this.config.youtube.hl = url.searchParams.get('hl'); // TODO: Should this be setting language?
+ } else {
+ this.config.playsinline = true;
+ }
+ }
+ } else {
+ // <div> with attributes
+ this.provider = this.media.getAttribute(this.config.attributes.embed.provider); // Remove attribute
+
+ this.media.removeAttribute(this.config.attributes.embed.provider);
+ } // Unsupported or missing provider
+
+
+ if (is$1.empty(this.provider) || !Object.keys(providers).includes(this.provider)) {
+ this.debug.error('Setup failed: Invalid provider');
+ return;
+ } // Audio will come later for external providers
+
+
+ this.type = types.video;
+ break;
+
+ case 'video':
+ case 'audio':
+ this.type = type;
+ this.provider = providers.html5; // Get config from attributes
+
+ if (this.media.hasAttribute('crossorigin')) {
+ this.config.crossorigin = true;
+ }
+
+ if (this.media.hasAttribute('autoplay')) {
+ this.config.autoplay = true;
+ }
+
+ if (this.media.hasAttribute('playsinline') || this.media.hasAttribute('webkit-playsinline')) {
+ this.config.playsinline = true;
+ }
+
+ if (this.media.hasAttribute('muted')) {
+ this.config.muted = true;
+ }
+
+ if (this.media.hasAttribute('loop')) {
+ this.config.loop.active = true;
+ }
+
+ break;
+
+ default:
+ this.debug.error('Setup failed: unsupported type');
+ return;
+ } // Check for support again but with type
+
+
+ this.supported = support.check(this.type, this.provider, this.config.playsinline); // If no support for even API, bail
+
+ if (!this.supported.api) {
+ this.debug.error('Setup failed: no support');
+ return;
+ }
+
+ this.eventListeners = []; // Create listeners
+
+ this.listeners = new Listeners(this); // Setup local storage for user settings
+
+ this.storage = new Storage(this); // Store reference
+
+ this.media.plyr = this; // Wrap media
+
+ if (!is$1.element(this.elements.container)) {
+ this.elements.container = createElement('div', {
+ tabindex: 0
+ });
+ wrap$1(this.media, this.elements.container);
+ } // Migrate custom properties from media to container (so they work 😉)
+
+
+ ui.migrateStyles.call(this); // Add style hook
+
+ ui.addStyleHook.call(this); // Setup media
+
+ media.setup.call(this); // Listen for events if debugging
+
+ if (this.config.debug) {
+ on.call(this, this.elements.container, this.config.events.join(' '), function (event) {
+ _this.debug.log("event: ".concat(event.type));
+ });
+ } // Setup fullscreen
+
+
+ this.fullscreen = new Fullscreen(this); // Setup interface
+ // If embed but not fully supported, build interface now to avoid flash of controls
+
+ if (this.isHTML5 || this.isEmbed && !this.supported.ui) {
+ ui.build.call(this);
+ } // Container listeners
+
+
+ this.listeners.container(); // Global listeners
+
+ this.listeners.global(); // Setup ads if provided
+
+ if (this.config.ads.enabled) {
+ this.ads = new Ads(this);
+ } // Autoplay if required
+
+
+ if (this.isHTML5 && this.config.autoplay) {
+ setTimeout(function () {
+ return silencePromise(_this.play());
+ }, 10);
+ } // Seek time will be recorded (in listeners.js) so we can prevent hiding controls for a few seconds after seek
+
+
+ this.lastSeekTime = 0; // Setup preview thumbnails if enabled
+
+ if (this.config.previewThumbnails.enabled) {
+ this.previewThumbnails = new PreviewThumbnails(this);
+ }
+ } // ---------------------------------------
+ // API
+ // ---------------------------------------
+
+ /**
+ * Types and provider helpers
+ */
+
+
+ _createClass(Plyr, [{
+ key: "play",
+
+ /**
+ * Play the media, or play the advertisement (if they are not blocked)
+ */
+ value: function play() {
+ var _this2 = this;
+
+ if (!is$1.function(this.media.play)) {
+ return null;
+ } // Intecept play with ads
+
+
+ if (this.ads && this.ads.enabled) {
+ this.ads.managerPromise.then(function () {
+ return _this2.ads.play();
+ }).catch(function () {
+ return silencePromise(_this2.media.play());
+ });
+ } // Return the promise (for HTML5)
+
+
+ return this.media.play();
+ }
+ /**
+ * Pause the media
+ */
+
+ }, {
+ key: "pause",
+ value: function pause() {
+ if (!this.playing || !is$1.function(this.media.pause)) {
+ return null;
+ }
+
+ return this.media.pause();
+ }
+ /**
+ * Get playing state
+ */
+
+ }, {
+ key: "togglePlay",
+
+ /**
+ * Toggle playback based on current status
+ * @param {Boolean} input
+ */
+ value: function togglePlay(input) {
+ // Toggle based on current state if nothing passed
+ var toggle = is$1.boolean(input) ? input : !this.playing;
+
+ if (toggle) {
+ return this.play();
+ }
+
+ return this.pause();
+ }
+ /**
+ * Stop playback
+ */
+
+ }, {
+ key: "stop",
+ value: function stop() {
+ if (this.isHTML5) {
+ this.pause();
+ this.restart();
+ } else if (is$1.function(this.media.stop)) {
+ this.media.stop();
+ }
+ }
+ /**
+ * Restart playback
+ */
+
+ }, {
+ key: "restart",
+ value: function restart() {
+ this.currentTime = 0;
+ }
+ /**
+ * Rewind
+ * @param {Number} seekTime - how far to rewind in seconds. Defaults to the config.seekTime
+ */
+
+ }, {
+ key: "rewind",
+ value: function rewind(seekTime) {
+ this.currentTime -= is$1.number(seekTime) ? seekTime : this.config.seekTime;
+ }
+ /**
+ * Fast forward
+ * @param {Number} seekTime - how far to fast forward in seconds. Defaults to the config.seekTime
+ */
+
+ }, {
+ key: "forward",
+ value: function forward(seekTime) {
+ this.currentTime += is$1.number(seekTime) ? seekTime : this.config.seekTime;
+ }
+ /**
+ * Seek to a time
+ * @param {Number} input - where to seek to in seconds. Defaults to 0 (the start)
+ */
+
+ }, {
+ key: "increaseVolume",
+
+ /**
+ * Increase volume
+ * @param {Boolean} step - How much to decrease by (between 0 and 1)
+ */
+ value: function increaseVolume(step) {
+ var volume = this.media.muted ? 0 : this.volume;
+ this.volume = volume + (is$1.number(step) ? step : 0);
+ }
+ /**
+ * Decrease volume
+ * @param {Boolean} step - How much to decrease by (between 0 and 1)
+ */
+
+ }, {
+ key: "decreaseVolume",
+ value: function decreaseVolume(step) {
+ this.increaseVolume(-step);
+ }
+ /**
+ * Set muted state
+ * @param {Boolean} mute
+ */
+
+ }, {
+ key: "toggleCaptions",
+
+ /**
+ * Toggle captions
+ * @param {Boolean} input - Whether to enable captions
+ */
+ value: function toggleCaptions(input) {
+ captions.toggle.call(this, input, false);
+ }
+ /**
+ * Set the caption track by index
+ * @param {Number} - Caption index
+ */
+
+ }, {
+ key: "airplay",
+
+ /**
+ * Trigger the airplay dialog
+ * TODO: update player with state, support, enabled
+ */
+ value: function airplay() {
+ // Show dialog if supported
+ if (support.airplay) {
+ this.media.webkitShowPlaybackTargetPicker();
+ }
+ }
+ /**
+ * Toggle the player controls
+ * @param {Boolean} [toggle] - Whether to show the controls
+ */
+
+ }, {
+ key: "toggleControls",
+ value: function toggleControls(toggle) {
+ // Don't toggle if missing UI support or if it's audio
+ if (this.supported.ui && !this.isAudio) {
+ // Get state before change
+ var isHidden = hasClass(this.elements.container, this.config.classNames.hideControls); // Negate the argument if not undefined since adding the class to hides the controls
+
+ var force = typeof toggle === 'undefined' ? undefined : !toggle; // Apply and get updated state
+
+ var hiding = toggleClass(this.elements.container, this.config.classNames.hideControls, force); // Close menu
+
+ if (hiding && is$1.array(this.config.controls) && this.config.controls.includes('settings') && !is$1.empty(this.config.settings)) {
+ controls.toggleMenu.call(this, false);
+ } // Trigger event on change
+
+
+ if (hiding !== isHidden) {
+ var eventName = hiding ? 'controlshidden' : 'controlsshown';
+ triggerEvent.call(this, this.media, eventName);
+ }
+
+ return !hiding;
+ }
+
+ return false;
+ }
+ /**
+ * Add event listeners
+ * @param {String} event - Event type
+ * @param {Function} callback - Callback for when event occurs
+ */
+
+ }, {
+ key: "on",
+ value: function on$1(event, callback) {
+ on.call(this, this.elements.container, event, callback);
+ }
+ /**
+ * Add event listeners once
+ * @param {String} event - Event type
+ * @param {Function} callback - Callback for when event occurs
+ */
+
+ }, {
+ key: "once",
+ value: function once$1(event, callback) {
+ once.call(this, this.elements.container, event, callback);
+ }
+ /**
+ * Remove event listeners
+ * @param {String} event - Event type
+ * @param {Function} callback - Callback for when event occurs
+ */
+
+ }, {
+ key: "off",
+ value: function off$1(event, callback) {
+ off(this.elements.container, event, callback);
+ }
+ /**
+ * Destroy an instance
+ * Event listeners are removed when elements are removed
+ * http://stackoverflow.com/questions/12528049/if-a-dom-element-is-removed-are-its-listeners-also-removed-from-memory
+ * @param {Function} callback - Callback for when destroy is complete
+ * @param {Boolean} soft - Whether it's a soft destroy (for source changes etc)
+ */
+
+ }, {
+ key: "destroy",
+ value: function destroy(callback) {
+ var _this3 = this;
+
+ var soft = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
+
+ if (!this.ready) {
+ return;
+ }
+
+ var done = function done() {
+ // Reset overflow (incase destroyed while in fullscreen)
+ document.body.style.overflow = ''; // GC for embed
+
+ _this3.embed = null; // If it's a soft destroy, make minimal changes
+
+ if (soft) {
+ if (Object.keys(_this3.elements).length) {
+ // Remove elements
+ removeElement(_this3.elements.buttons.play);
+ removeElement(_this3.elements.captions);
+ removeElement(_this3.elements.controls);
+ removeElement(_this3.elements.wrapper); // Clear for GC
+
+ _this3.elements.buttons.play = null;
+ _this3.elements.captions = null;
+ _this3.elements.controls = null;
+ _this3.elements.wrapper = null;
+ } // Callback
+
+
+ if (is$1.function(callback)) {
+ callback();
+ }
+ } else {
+ // Unbind listeners
+ unbindListeners.call(_this3); // Replace the container with the original element provided
+
+ replaceElement(_this3.elements.original, _this3.elements.container); // Event
+
+ triggerEvent.call(_this3, _this3.elements.original, 'destroyed', true); // Callback
+
+ if (is$1.function(callback)) {
+ callback.call(_this3.elements.original);
+ } // Reset state
+
+
+ _this3.ready = false; // Clear for garbage collection
+
+ setTimeout(function () {
+ _this3.elements = null;
+ _this3.media = null;
+ }, 200);
+ }
+ }; // Stop playback
+
+
+ this.stop(); // Clear timeouts
+
+ clearTimeout(this.timers.loading);
+ clearTimeout(this.timers.controls);
+ clearTimeout(this.timers.resized); // Provider specific stuff
+
+ if (this.isHTML5) {
+ // Restore native video controls
+ ui.toggleNativeControls.call(this, true); // Clean up
+
+ done();
+ } else if (this.isYouTube) {
+ // Clear timers
+ clearInterval(this.timers.buffering);
+ clearInterval(this.timers.playing); // Destroy YouTube API
+
+ if (this.embed !== null && is$1.function(this.embed.destroy)) {
+ this.embed.destroy();
+ } // Clean up
+
+
+ done();
+ } else if (this.isVimeo) {
+ // Destroy Vimeo API
+ // then clean up (wait, to prevent postmessage errors)
+ if (this.embed !== null) {
+ this.embed.unload().then(done);
+ } // Vimeo does not always return
+
+
+ setTimeout(done, 200);
+ }
+ }
+ /**
+ * Check for support for a mime type (HTML5 only)
+ * @param {String} type - Mime type
+ */
+
+ }, {
+ key: "supports",
+ value: function supports(type) {
+ return support.mime.call(this, type);
+ }
+ /**
+ * Check for support
+ * @param {String} type - Player type (audio/video)
+ * @param {String} provider - Provider (html5/youtube/vimeo)
+ * @param {Boolean} inline - Where player has `playsinline` sttribute
+ */
+
+ }, {
+ key: "isHTML5",
+ get: function get() {
+ return this.provider === providers.html5;
+ }
+ }, {
+ key: "isEmbed",
+ get: function get() {
+ return this.isYouTube || this.isVimeo;
+ }
+ }, {
+ key: "isYouTube",
+ get: function get() {
+ return this.provider === providers.youtube;
+ }
+ }, {
+ key: "isVimeo",
+ get: function get() {
+ return this.provider === providers.vimeo;
+ }
+ }, {
+ key: "isVideo",
+ get: function get() {
+ return this.type === types.video;
+ }
+ }, {
+ key: "isAudio",
+ get: function get() {
+ return this.type === types.audio;
+ }
+ }, {
+ key: "playing",
+ get: function get() {
+ return Boolean(this.ready && !this.paused && !this.ended);
+ }
+ /**
+ * Get paused state
+ */
+
+ }, {
+ key: "paused",
+ get: function get() {
+ return Boolean(this.media.paused);
+ }
+ /**
+ * Get stopped state
+ */
+
+ }, {
+ key: "stopped",
+ get: function get() {
+ return Boolean(this.paused && this.currentTime === 0);
+ }
+ /**
+ * Get ended state
+ */
+
+ }, {
+ key: "ended",
+ get: function get() {
+ return Boolean(this.media.ended);
+ }
+ }, {
+ key: "currentTime",
+ set: function set(input) {
+ // Bail if media duration isn't available yet
+ if (!this.duration) {
+ return;
+ } // Validate input
+
+
+ var inputIsValid = is$1.number(input) && input > 0; // Set
+
+ this.media.currentTime = inputIsValid ? Math.min(input, this.duration) : 0; // Logging
+
+ this.debug.log("Seeking to ".concat(this.currentTime, " seconds"));
+ }
+ /**
+ * Get current time
+ */
+ ,
+ get: function get() {
+ return Number(this.media.currentTime);
+ }
+ /**
+ * Get buffered
+ */
+
+ }, {
+ key: "buffered",
+ get: function get() {
+ var buffered = this.media.buffered; // YouTube / Vimeo return a float between 0-1
+
+ if (is$1.number(buffered)) {
+ return buffered;
+ } // HTML5
+ // TODO: Handle buffered chunks of the media
+ // (i.e. seek to another section buffers only that section)
+
+
+ if (buffered && buffered.length && this.duration > 0) {
+ return buffered.end(0) / this.duration;
+ }
+
+ return 0;
+ }
+ /**
+ * Get seeking status
+ */
+
+ }, {
+ key: "seeking",
+ get: function get() {
+ return Boolean(this.media.seeking);
+ }
+ /**
+ * Get the duration of the current media
+ */
+
+ }, {
+ key: "duration",
+ get: function get() {
+ // Faux duration set via config
+ var fauxDuration = parseFloat(this.config.duration); // Media duration can be NaN or Infinity before the media has loaded
+
+ var realDuration = (this.media || {}).duration;
+ var duration = !is$1.number(realDuration) || realDuration === Infinity ? 0 : realDuration; // If config duration is funky, use regular duration
+
+ return fauxDuration || duration;
+ }
+ /**
+ * Set the player volume
+ * @param {Number} value - must be between 0 and 1. Defaults to the value from local storage and config.volume if not set in storage
+ */
+
+ }, {
+ key: "volume",
+ set: function set(value) {
+ var volume = value;
+ var max = 1;
+ var min = 0;
+
+ if (is$1.string(volume)) {
+ volume = Number(volume);
+ } // Load volume from storage if no value specified
+
+
+ if (!is$1.number(volume)) {
+ volume = this.storage.get('volume');
+ } // Use config if all else fails
+
+
+ if (!is$1.number(volume)) {
+ volume = this.config.volume;
+ } // Maximum is volumeMax
+
+
+ if (volume > max) {
+ volume = max;
+ } // Minimum is volumeMin
+
+
+ if (volume < min) {
+ volume = min;
+ } // Update config
+
+
+ this.config.volume = volume; // Set the player volume
+
+ this.media.volume = volume; // If muted, and we're increasing volume manually, reset muted state
+
+ if (!is$1.empty(value) && this.muted && volume > 0) {
+ this.muted = false;
+ }
+ }
+ /**
+ * Get the current player volume
+ */
+ ,
+ get: function get() {
+ return Number(this.media.volume);
+ }
+ }, {
+ key: "muted",
+ set: function set(mute) {
+ var toggle = mute; // Load muted state from storage
+
+ if (!is$1.boolean(toggle)) {
+ toggle = this.storage.get('muted');
+ } // Use config if all else fails
+
+
+ if (!is$1.boolean(toggle)) {
+ toggle = this.config.muted;
+ } // Update config
+
+
+ this.config.muted = toggle; // Set mute on the player
+
+ this.media.muted = toggle;
+ }
+ /**
+ * Get current muted state
+ */
+ ,
+ get: function get() {
+ return Boolean(this.media.muted);
+ }
+ /**
+ * Check if the media has audio
+ */
+
+ }, {
+ key: "hasAudio",
+ get: function get() {
+ // Assume yes for all non HTML5 (as we can't tell...)
+ if (!this.isHTML5) {
+ return true;
+ }
+
+ if (this.isAudio) {
+ return true;
+ } // Get audio tracks
+
+
+ return Boolean(this.media.mozHasAudio) || Boolean(this.media.webkitAudioDecodedByteCount) || Boolean(this.media.audioTracks && this.media.audioTracks.length);
+ }
+ /**
+ * Set playback speed
+ * @param {Number} speed - the speed of playback (0.5-2.0)
+ */
+
+ }, {
+ key: "speed",
+ set: function set(input) {
+ var _this4 = this;
+
+ var speed = null;
+
+ if (is$1.number(input)) {
+ speed = input;
+ }
+
+ if (!is$1.number(speed)) {
+ speed = this.storage.get('speed');
+ }
+
+ if (!is$1.number(speed)) {
+ speed = this.config.speed.selected;
+ } // Clamp to min/max
+
+
+ var min = this.minimumSpeed,
+ max = this.maximumSpeed;
+ speed = clamp(speed, min, max); // Update config
+
+ this.config.speed.selected = speed; // Set media speed
+
+ setTimeout(function () {
+ _this4.media.playbackRate = speed;
+ }, 0);
+ }
+ /**
+ * Get current playback speed
+ */
+ ,
+ get: function get() {
+ return Number(this.media.playbackRate);
+ }
+ /**
+ * Get the minimum allowed speed
+ */
+
+ }, {
+ key: "minimumSpeed",
+ get: function get() {
+ if (this.isYouTube) {
+ // https://developers.google.com/youtube/iframe_api_reference#setPlaybackRate
+ return Math.min.apply(Math, _toConsumableArray(this.options.speed));
+ }
+
+ if (this.isVimeo) {
+ // https://github.com/vimeo/player.js/#setplaybackrateplaybackrate-number-promisenumber-rangeerrorerror
+ return 0.5;
+ } // https://stackoverflow.com/a/32320020/1191319
+
+
+ return 0.0625;
+ }
+ /**
+ * Get the maximum allowed speed
+ */
+
+ }, {
+ key: "maximumSpeed",
+ get: function get() {
+ if (this.isYouTube) {
+ // https://developers.google.com/youtube/iframe_api_reference#setPlaybackRate
+ return Math.max.apply(Math, _toConsumableArray(this.options.speed));
+ }
+
+ if (this.isVimeo) {
+ // https://github.com/vimeo/player.js/#setplaybackrateplaybackrate-number-promisenumber-rangeerrorerror
+ return 2;
+ } // https://stackoverflow.com/a/32320020/1191319
+
+
+ return 16;
+ }
+ /**
+ * Set playback quality
+ * Currently HTML5 & YouTube only
+ * @param {Number} input - Quality level
+ */
+
+ }, {
+ key: "quality",
+ set: function set(input) {
+ var config = this.config.quality;
+ var options = this.options.quality;
+
+ if (!options.length) {
+ return;
+ }
+
+ var quality = [!is$1.empty(input) && Number(input), this.storage.get('quality'), config.selected, config.default].find(is$1.number);
+ var updateStorage = true;
+
+ if (!options.includes(quality)) {
+ var value = closest$1(options, quality);
+ this.debug.warn("Unsupported quality option: ".concat(quality, ", using ").concat(value, " instead"));
+ quality = value; // Don't update storage if quality is not supported
+
+ updateStorage = false;
+ } // Update config
+
+
+ config.selected = quality; // Set quality
+
+ this.media.quality = quality; // Save to storage
+
+ if (updateStorage) {
+ this.storage.set({
+ quality: quality
+ });
+ }
+ }
+ /**
+ * Get current quality level
+ */
+ ,
+ get: function get() {
+ return this.media.quality;
+ }
+ /**
+ * Toggle loop
+ * TODO: Finish fancy new logic. Set the indicator on load as user may pass loop as config
+ * @param {Boolean} input - Whether to loop or not
+ */
+
+ }, {
+ key: "loop",
+ set: function set(input) {
+ var toggle = is$1.boolean(input) ? input : this.config.loop.active;
+ this.config.loop.active = toggle;
+ this.media.loop = toggle; // Set default to be a true toggle
+
+ /* const type = ['start', 'end', 'all', 'none', 'toggle'].includes(input) ? input : 'toggle';
+ switch (type) {
+ case 'start':
+ if (this.config.loop.end && this.config.loop.end <= this.currentTime) {
+ this.config.loop.end = null;
+ }
+ this.config.loop.start = this.currentTime;
+ // this.config.loop.indicator.start = this.elements.display.played.value;
+ break;
+ case 'end':
+ if (this.config.loop.start >= this.currentTime) {
+ return this;
+ }
+ this.config.loop.end = this.currentTime;
+ // this.config.loop.indicator.end = this.elements.display.played.value;
+ break;
+ case 'all':
+ this.config.loop.start = 0;
+ this.config.loop.end = this.duration - 2;
+ this.config.loop.indicator.start = 0;
+ this.config.loop.indicator.end = 100;
+ break;
+ case 'toggle':
+ if (this.config.loop.active) {
+ this.config.loop.start = 0;
+ this.config.loop.end = null;
+ } else {
+ this.config.loop.start = 0;
+ this.config.loop.end = this.duration - 2;
+ }
+ break;
+ default:
+ this.config.loop.start = 0;
+ this.config.loop.end = null;
+ break;
+ } */
+ }
+ /**
+ * Get current loop state
+ */
+ ,
+ get: function get() {
+ return Boolean(this.media.loop);
+ }
+ /**
+ * Set new media source
+ * @param {Object} input - The new source object (see docs)
+ */
+
+ }, {
+ key: "source",
+ set: function set(input) {
+ source.change.call(this, input);
+ }
+ /**
+ * Get current source
+ */
+ ,
+ get: function get() {
+ return this.media.currentSrc;
+ }
+ /**
+ * Get a download URL (either source or custom)
+ */
+
+ }, {
+ key: "download",
+ get: function get() {
+ var download = this.config.urls.download;
+ return is$1.url(download) ? download : this.source;
+ }
+ /**
+ * Set the download URL
+ */
+ ,
+ set: function set(input) {
+ if (!is$1.url(input)) {
+ return;
+ }
+
+ this.config.urls.download = input;
+ controls.setDownloadUrl.call(this);
+ }
+ /**
+ * Set the poster image for a video
+ * @param {String} input - the URL for the new poster image
+ */
+
+ }, {
+ key: "poster",
+ set: function set(input) {
+ if (!this.isVideo) {
+ this.debug.warn('Poster can only be set for video');
+ return;
+ }
+
+ ui.setPoster.call(this, input, false).catch(function () {});
+ }
+ /**
+ * Get the current poster image
+ */
+ ,
+ get: function get() {
+ if (!this.isVideo) {
+ return null;
+ }
+
+ return this.media.getAttribute('poster') || this.media.getAttribute('data-poster');
+ }
+ /**
+ * Get the current aspect ratio in use
+ */
+
+ }, {
+ key: "ratio",
+ get: function get() {
+ if (!this.isVideo) {
+ return null;
+ }
+
+ var ratio = reduceAspectRatio(getAspectRatio.call(this));
+ return is$1.array(ratio) ? ratio.join(':') : ratio;
+ }
+ /**
+ * Set video aspect ratio
+ */
+ ,
+ set: function set(input) {
+ if (!this.isVideo) {
+ this.debug.warn('Aspect ratio can only be set for video');
+ return;
+ }
+
+ if (!is$1.string(input) || !validateRatio(input)) {
+ this.debug.error("Invalid aspect ratio specified (".concat(input, ")"));
+ return;
+ }
+
+ this.config.ratio = input;
+ setAspectRatio.call(this);
+ }
+ /**
+ * Set the autoplay state
+ * @param {Boolean} input - Whether to autoplay or not
+ */
+
+ }, {
+ key: "autoplay",
+ set: function set(input) {
+ var toggle = is$1.boolean(input) ? input : this.config.autoplay;
+ this.config.autoplay = toggle;
+ }
+ /**
+ * Get the current autoplay state
+ */
+ ,
+ get: function get() {
+ return Boolean(this.config.autoplay);
+ }
+ }, {
+ key: "currentTrack",
+ set: function set(input) {
+ captions.set.call(this, input, false);
+ }
+ /**
+ * Get the current caption track index (-1 if disabled)
+ */
+ ,
+ get: function get() {
+ var _this$captions = this.captions,
+ toggled = _this$captions.toggled,
+ currentTrack = _this$captions.currentTrack;
+ return toggled ? currentTrack : -1;
+ }
+ /**
+ * Set the wanted language for captions
+ * Since tracks can be added later it won't update the actual caption track until there is a matching track
+ * @param {String} - Two character ISO language code (e.g. EN, FR, PT, etc)
+ */
+
+ }, {
+ key: "language",
+ set: function set(input) {
+ captions.setLanguage.call(this, input, false);
+ }
+ /**
+ * Get the current track's language
+ */
+ ,
+ get: function get() {
+ return (captions.getCurrentTrack.call(this) || {}).language;
+ }
+ /**
+ * Toggle picture-in-picture playback on WebKit/MacOS
+ * TODO: update player with state, support, enabled
+ * TODO: detect outside changes
+ */
+
+ }, {
+ key: "pip",
+ set: function set(input) {
+ // Bail if no support
+ if (!support.pip) {
+ return;
+ } // Toggle based on current state if not passed
+
+
+ var toggle = is$1.boolean(input) ? input : !this.pip; // Toggle based on current state
+ // Safari
+
+ if (is$1.function(this.media.webkitSetPresentationMode)) {
+ this.media.webkitSetPresentationMode(toggle ? pip.active : pip.inactive);
+ } // Chrome
+
+
+ if (is$1.function(this.media.requestPictureInPicture)) {
+ if (!this.pip && toggle) {
+ this.media.requestPictureInPicture();
+ } else if (this.pip && !toggle) {
+ document.exitPictureInPicture();
+ }
+ }
+ }
+ /**
+ * Get the current picture-in-picture state
+ */
+ ,
+ get: function get() {
+ if (!support.pip) {
+ return null;
+ } // Safari
+
+
+ if (!is$1.empty(this.media.webkitPresentationMode)) {
+ return this.media.webkitPresentationMode === pip.active;
+ } // Chrome
+
+
+ return this.media === document.pictureInPictureElement;
+ }
+ }], [{
+ key: "supported",
+ value: function supported(type, provider, inline) {
+ return support.check(type, provider, inline);
+ }
+ /**
+ * Load an SVG sprite into the page
+ * @param {String} url - URL for the SVG sprite
+ * @param {String} [id] - Unique ID
+ */
+
+ }, {
+ key: "loadSprite",
+ value: function loadSprite$1(url, id) {
+ return loadSprite(url, id);
+ }
+ /**
+ * Setup multiple instances
+ * @param {*} selector
+ * @param {Object} options
+ */
+
+ }, {
+ key: "setup",
+ value: function setup(selector) {
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
+ var targets = null;
+
+ if (is$1.string(selector)) {
+ targets = Array.from(document.querySelectorAll(selector));
+ } else if (is$1.nodeList(selector)) {
+ targets = Array.from(selector);
+ } else if (is$1.array(selector)) {
+ targets = selector.filter(is$1.element);
+ }
+
+ if (is$1.empty(targets)) {
+ return null;
+ }
+
+ return targets.map(function (t) {
+ return new Plyr(t, options);
+ });
+ }
+ }]);
+
+ return Plyr;
+}();
+
+Plyr.defaults = cloneDeep(defaults$1);
+
+// ==========================================================================
+
+export default Plyr;
diff --git a/youtube/static/modules/plyr/plyr.svg b/youtube/static/modules/plyr/plyr.svg
new file mode 100644
index 0000000..62ab257
--- /dev/null
+++ b/youtube/static/modules/plyr/plyr.svg
@@ -0,0 +1 @@
+<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><symbol id="plyr-airplay" viewBox="0 0 18 18"><path d="M16 1H2a1 1 0 00-1 1v10a1 1 0 001 1h3v-2H3V3h12v8h-2v2h3a1 1 0 001-1V2a1 1 0 00-1-1z"/><path d="M4 17h10l-5-6z"/></symbol><symbol id="plyr-captions-off" viewBox="0 0 18 18"><path d="M1 1c-.6 0-1 .4-1 1v11c0 .6.4 1 1 1h4.6l2.7 2.7c.2.2.4.3.7.3.3 0 .5-.1.7-.3l2.7-2.7H17c.6 0 1-.4 1-1V2c0-.6-.4-1-1-1H1zm4.52 10.15c1.99 0 3.01-1.32 3.28-2.41l-1.29-.39c-.19.66-.78 1.45-1.99 1.45-1.14 0-2.2-.83-2.2-2.34 0-1.61 1.12-2.37 2.18-2.37 1.23 0 1.78.75 1.95 1.43l1.3-.41C8.47 4.96 7.46 3.76 5.5 3.76c-1.9 0-3.61 1.44-3.61 3.7 0 2.26 1.65 3.69 3.63 3.69zm7.57 0c1.99 0 3.01-1.32 3.28-2.41l-1.29-.39c-.19.66-.78 1.45-1.99 1.45-1.14 0-2.2-.83-2.2-2.34 0-1.61 1.12-2.37 2.18-2.37 1.23 0 1.78.75 1.95 1.43l1.3-.41c-.28-1.15-1.29-2.35-3.25-2.35-1.9 0-3.61 1.44-3.61 3.7 0 2.26 1.65 3.69 3.63 3.69z" fill-rule="evenodd" fill-opacity=".5"/></symbol><symbol id="plyr-captions-on" viewBox="0 0 18 18"><path d="M1 1c-.6 0-1 .4-1 1v11c0 .6.4 1 1 1h4.6l2.7 2.7c.2.2.4.3.7.3.3 0 .5-.1.7-.3l2.7-2.7H17c.6 0 1-.4 1-1V2c0-.6-.4-1-1-1H1zm4.52 10.15c1.99 0 3.01-1.32 3.28-2.41l-1.29-.39c-.19.66-.78 1.45-1.99 1.45-1.14 0-2.2-.83-2.2-2.34 0-1.61 1.12-2.37 2.18-2.37 1.23 0 1.78.75 1.95 1.43l1.3-.41C8.47 4.96 7.46 3.76 5.5 3.76c-1.9 0-3.61 1.44-3.61 3.7 0 2.26 1.65 3.69 3.63 3.69zm7.57 0c1.99 0 3.01-1.32 3.28-2.41l-1.29-.39c-.19.66-.78 1.45-1.99 1.45-1.14 0-2.2-.83-2.2-2.34 0-1.61 1.12-2.37 2.18-2.37 1.23 0 1.78.75 1.95 1.43l1.3-.41c-.28-1.15-1.29-2.35-3.25-2.35-1.9 0-3.61 1.44-3.61 3.7 0 2.26 1.65 3.69 3.63 3.69z" fill-rule="evenodd"/></symbol><symbol id="plyr-download" viewBox="0 0 18 18"><path d="M9 13c.3 0 .5-.1.7-.3L15.4 7 14 5.6l-4 4V1H8v8.6l-4-4L2.6 7l5.7 5.7c.2.2.4.3.7.3zm-7 2h14v2H2z"/></symbol><symbol id="plyr-enter-fullscreen" viewBox="0 0 18 18"><path d="M10 3h3.6l-4 4L11 8.4l4-4V8h2V1h-7zM7 9.6l-4 4V10H1v7h7v-2H4.4l4-4z"/></symbol><symbol id="plyr-exit-fullscreen" viewBox="0 0 18 18"><path d="M1 12h3.6l-4 4L2 17.4l4-4V17h2v-7H1zM16 .6l-4 4V1h-2v7h7V6h-3.6l4-4z"/></symbol><symbol id="plyr-fast-forward" viewBox="0 0 18 18"><path d="M7.875 7.171L0 1v16l7.875-6.171V17L18 9 7.875 1z"/></symbol><symbol id="plyr-logo-vimeo" viewBox="0 0 18 18"><path d="M17 5.3c-.1 1.6-1.2 3.7-3.3 6.4-2.2 2.8-4 4.2-5.5 4.2-.9 0-1.7-.9-2.4-2.6C5 10.9 4.4 6 3 6c-.1 0-.5.3-1.2.8l-.8-1c.8-.7 3.5-3.4 4.7-3.5 1.2-.1 2 .7 2.3 2.5.3 2 .8 6.1 1.8 6.1.9 0 2.5-3.4 2.6-4 .1-.9-.3-1.9-2.3-1.1.8-2.6 2.3-3.8 4.5-3.8 1.7.1 2.5 1.2 2.4 3.3z"/></symbol><symbol id="plyr-logo-youtube" viewBox="0 0 18 18"><path d="M16.8 5.8c-.2-1.3-.8-2.2-2.2-2.4C12.4 3 9 3 9 3s-3.4 0-5.6.4C2 3.6 1.3 4.5 1.2 5.8 1 7.1 1 9 1 9s0 1.9.2 3.2c.2 1.3.8 2.2 2.2 2.4C5.6 15 9 15 9 15s3.4 0 5.6-.4c1.4-.3 2-1.1 2.2-2.4.2-1.3.2-3.2.2-3.2s0-1.9-.2-3.2zM7 12V6l5 3-5 3z"/></symbol><symbol id="plyr-muted" viewBox="0 0 18 18"><path d="M12.4 12.5l2.1-2.1 2.1 2.1 1.4-1.4L15.9 9 18 6.9l-1.4-1.4-2.1 2.1-2.1-2.1L11 6.9 13.1 9 11 11.1zM3.786 6.008H.714C.286 6.008 0 6.31 0 6.76v4.512c0 .452.286.752.714.752h3.072l4.071 3.858c.5.3 1.143 0 1.143-.602V2.752c0-.601-.643-.977-1.143-.601L3.786 6.008z"/></symbol><symbol id="plyr-pause" viewBox="0 0 18 18"><path d="M6 1H3c-.6 0-1 .4-1 1v14c0 .6.4 1 1 1h3c.6 0 1-.4 1-1V2c0-.6-.4-1-1-1zm6 0c-.6 0-1 .4-1 1v14c0 .6.4 1 1 1h3c.6 0 1-.4 1-1V2c0-.6-.4-1-1-1h-3z"/></symbol><symbol id="plyr-pip" viewBox="0 0 18 18"><path d="M13.293 3.293L7.022 9.564l1.414 1.414 6.271-6.271L17 7V1h-6z"/><path d="M13 15H3V5h5V3H2a1 1 0 00-1 1v12a1 1 0 001 1h12a1 1 0 001-1v-6h-2v5z"/></symbol><symbol id="plyr-play" viewBox="0 0 18 18"><path d="M15.562 8.1L3.87.225c-.818-.562-1.87 0-1.87.9v15.75c0 .9 1.052 1.462 1.87.9L15.563 9.9c.584-.45.584-1.35 0-1.8z"/></symbol><symbol id="plyr-restart" viewBox="0 0 18 18"><path d="M9.7 1.2l.7 6.4 2.1-2.1c1.9 1.9 1.9 5.1 0 7-.9 1-2.2 1.5-3.5 1.5-1.3 0-2.6-.5-3.5-1.5-1.9-1.9-1.9-5.1 0-7 .6-.6 1.4-1.1 2.3-1.3l-.6-1.9C6 2.6 4.9 3.2 4 4.1 1.3 6.8 1.3 11.2 4 14c1.3 1.3 3.1 2 4.9 2 1.9 0 3.6-.7 4.9-2 2.7-2.7 2.7-7.1 0-9.9L16 1.9l-6.3-.7z"/></symbol><symbol id="plyr-rewind" viewBox="0 0 18 18"><path d="M10.125 1L0 9l10.125 8v-6.171L18 17V1l-7.875 6.171z"/></symbol><symbol id="plyr-settings" viewBox="0 0 18 18"><path d="M16.135 7.784a2 2 0 01-1.23-2.969c.322-.536.225-.998-.094-1.316l-.31-.31c-.318-.318-.78-.415-1.316-.094a2 2 0 01-2.969-1.23C10.065 1.258 9.669 1 9.219 1h-.438c-.45 0-.845.258-.997.865a2 2 0 01-2.969 1.23c-.536-.322-.999-.225-1.317.093l-.31.31c-.318.318-.415.781-.093 1.317a2 2 0 01-1.23 2.969C1.26 7.935 1 8.33 1 8.781v.438c0 .45.258.845.865.997a2 2 0 011.23 2.969c-.322.536-.225.998.094 1.316l.31.31c.319.319.782.415 1.316.094a2 2 0 012.969 1.23c.151.607.547.865.997.865h.438c.45 0 .845-.258.997-.865a2 2 0 012.969-1.23c.535.321.997.225 1.316-.094l.31-.31c.318-.318.415-.781.094-1.316a2 2 0 011.23-2.969c.607-.151.865-.547.865-.997v-.438c0-.451-.26-.846-.865-.997zM9 12a3 3 0 110-6 3 3 0 010 6z"/></symbol><symbol id="plyr-volume" viewBox="0 0 18 18"><path d="M15.6 3.3c-.4-.4-1-.4-1.4 0-.4.4-.4 1 0 1.4C15.4 5.9 16 7.4 16 9c0 1.6-.6 3.1-1.8 4.3-.4.4-.4 1 0 1.4.2.2.5.3.7.3.3 0 .5-.1.7-.3C17.1 13.2 18 11.2 18 9s-.9-4.2-2.4-5.7z"/><path d="M11.282 5.282a.909.909 0 000 1.316c.735.735.995 1.458.995 2.402 0 .936-.425 1.917-.995 2.487a.909.909 0 000 1.316c.145.145.636.262 1.018.156a.725.725 0 00.298-.156C13.773 11.733 14.13 10.16 14.13 9c0-.17-.002-.34-.011-.51-.053-.992-.319-2.005-1.522-3.208a.909.909 0 00-1.316 0zm-7.496.726H.714C.286 6.008 0 6.31 0 6.76v4.512c0 .452.286.752.714.752h3.072l4.071 3.858c.5.3 1.143 0 1.143-.602V2.752c0-.601-.643-.977-1.143-.601L3.786 6.008z"/></symbol></svg> \ No newline at end of file
diff --git a/youtube/static/watch.css b/youtube/static/watch.css
index 8d23017..b141b91 100644
--- a/youtube/static/watch.css
+++ b/youtube/static/watch.css
@@ -30,6 +30,20 @@ video {
max-height: 480px;
}
+/* plyr fix */
+.plyr:-moz-full-screen video {
+ max-height: initial;
+}
+.plyr:-webkit-full-screen video {
+ max-height: initial;
+}
+.plyr:-ms-fullscreen video {
+ max-height: initial;
+}
+.plyr:fullscreen video {
+ max-height: initial;
+}
+
a:link {
color: var(--link);
}
diff --git a/youtube/templates/licenses.html b/youtube/templates/licenses.html
index dc883a8..60b76fb 100644
--- a/youtube/templates/licenses.html
+++ b/youtube/templates/licenses.html
@@ -35,6 +35,11 @@
<td data-label="Source"><a href="/youtube.com/static/js/playlistadd.js">playlistadd.js</a></td>
</tr>
<tr>
+ <td data-label="File"><a href="/youtube.com/static/modules/plyr/plyr.min.js">plyr.min.js</a></td>
+ <td data-label="License"><a href="https://www.freebsd.org/copyright/freebsd-license.html">Expat</a></td>
+ <td data-label="Source"><a href="/youtube.com/static/modules/plyr/plyr.js">plyr.js</a></td>
+ </tr>
+ <tr>
<td data-label="File"><a href="/youtube.com/static/js/speedyplay.js">speedyplay.js</a></td>
<td data-label="License"><a href="http://www.gnu.org/licenses/agpl-3.0.html">AGPL-3.0 or later</a></td>
<td data-label="Source"><a href="/youtube.com/static/js/speedyplay.js">speedyplay.js</a></td>
diff --git a/youtube/templates/watch.html b/youtube/templates/watch.html
index 7184872..993befc 100644
--- a/youtube/templates/watch.html
+++ b/youtube/templates/watch.html
@@ -5,6 +5,9 @@
{% block style %}
<link href="/youtube.com/static/message_box.css" rel="stylesheet"/>
<link href="/youtube.com/static/watch.css" rel="stylesheet"/>
+ <!-- plyr -->
+ <link href="/youtube.com/static/modules/plyr/plyr.css" rel="stylesheet"/>
+ <!--/ plyr -->
{% endblock style %}
{% block main %}
@@ -30,7 +33,7 @@
<figure class="sc-video">
<video id="js-video-player" playsinline controls>
{% for video_source in video_sources %}
- <source src="{{ video_source['src'] }}" type="{{ video_source['type'] }}">
+ <source src="{{ video_source['src'] }}" type="{{ video_source['type'] }}" data-res="{{ video_source['quality'] }}">
{% endfor %}
{% for source in subtitle_sources %}
@@ -347,6 +350,12 @@
</script>
<script src="/youtube.com/static/js/common.js"></script>
<script src="/youtube.com/static/js/transcript-table.js"></script>
+ <!-- plyr -->
+ <script src="/youtube.com/static/modules/plyr/plyr.min.js"
+ integrity="sha512-l6ZzdXpfMHRfifqaR79wbYCEWjLDMI9DnROvb+oLkKq6d7MGroGpMbI7HFpicvmAH/2aQO+vJhewq8rhysrImw=="
+ crossorigin="anonymous"></script>
+ <script src="/youtube.com/static/js/plyr-start.js"></script>
+ <!-- /plyr -->
{% if settings.use_video_hotkeys %} <script src="/youtube.com/static/js/hotkeys.js"></script> {% endif %}
{% if settings.use_comments_js %} <script src="/youtube.com/static/js/comments.js"></script> {% endif %}
{% if settings.use_sponsorblock_js %} <script src="/youtube.com/static/js/sponsorblock.js"></script> {% endif %}