Results
26.06.2024
trinion_suo 1.0.x-dev ::
js/plyr.min.js
"object"==typeof navigator&&function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define("Plyr",t):(e="undefined"!=typeof globalThis?globalThis:e||self).Plyr=t()}(this,(function(){"use strict";function e(e,t,i){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var s=i.call(e,t||"default");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function t(e,t){for(var i=0;i<t.length;i++){var s=t[i];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,s.key,s)}}function i(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function s(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,s)}return i}function n(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?s(Object(n),!0).forEach((function(t){i(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):s(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var a={addCSS:!0,thumbWidth:15,watch:!0};var l=function(e){return null!=e?e.constructor:null},r=function(e,t){return!!(e&&t&&e instanceof t)},o=function(e){return null==e},c=function(e){return l(e)===Object},u=function(e){return l(e)===String},h=function(e){return Array.isArray(e)},d=function(e){return r(e,NodeList)},m={nullOrUndefined:o,object:c,number:function(e){return l(e)===Number&&!Number.isNaN(e)},string:u,boolean:function(e){return l(e)===Boolean},function:function(e){return l(e)===Function},array:h,nodeList:d,element:function(e){return r(e,Element)},event:function(e){return r(e,Event)},empty:function(e){return o(e)||(u(e)||h(e)||d(e))&&!e.length||c(e)&&!Object.keys(e).length}};function p(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 g=function(){function e(t,i){(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,e),m.element(t)?this.element=t:m.string(t)&&(this.element=document.querySelector(t)),m.element(this.element)&&m.empty(this.element.rangeTouch)&&(this.config=n({},a,{},i),this.init())}return function(e,i,s){i&&t(e.prototype,i),s&&t(e,s)}(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||!m.event(t))return null;var i,s=t.target,n=t.changedTouches[0],a=parseFloat(s.getAttribute("min"))||0,l=parseFloat(s.getAttribute("max"))||100,r=parseFloat(s.getAttribute("step"))||1,o=s.getBoundingClientRect(),c=100/o.width*(this.config.thumbWidth/2)/100;return 0>(i=100/o.width*(n.clientX-o.left))?i=0:100<i&&(i=100),50>i?i-=(100-2*i)*c:50<i&&(i+=2*(i-50)*c),a+p(i/100*(l-a),r)}},{key:"set",value:function(t){e.enabled&&m.event(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]:{},s=null;if(m.empty(t)||m.string(t)?s=Array.from(document.querySelectorAll(m.string(t)?t:'input[type="range"]')):m.element(t)?s=[t]:m.nodeList(t)?s=Array.from(t):m.array(t)&&(s=t.filter(m.element)),m.empty(s))return null;var l=n({},a,{},i);if(m.string(t)&&l.watch){var r=new MutationObserver((function(i){Array.from(i).forEach((function(i){Array.from(i.addedNodes).forEach((function(i){m.element(i)&&function(e,t){return function(){return Array.from(document.querySelectorAll(t)).includes(this)}.call(e,t)}(i,t)&&new e(i,l)}))}))}));r.observe(document.body,{childList:!0,subtree:!0})}return s.map((function(t){return new e(t,i)}))}},{key:"enabled",get:function(){return"ontouchstart"in document.documentElement}}]),e}();const f=e=>null!=e?e.constructor:null,y=(e,t)=>Boolean(e&&t&&e instanceof t),b=e=>null==e,v=e=>f(e)===Object,w=e=>f(e)===String,T=e=>"function"==typeof e,k=e=>Array.isArray(e),C=e=>y(e,NodeList),A=e=>b(e)||(w(e)||k(e)||C(e))&&!e.length||v(e)&&!Object.keys(e).length;var S={nullOrUndefined:b,object:v,number:e=>f(e)===Number&&!Number.isNaN(e),string:w,boolean:e=>f(e)===Boolean,function:T,array:k,weakMap:e=>y(e,WeakMap),nodeList:C,element:e=>null!==e&&"object"==typeof e&&1===e.nodeType&&"object"==typeof e.style&&"object"==typeof e.ownerDocument,textNode:e=>f(e)===Text,event:e=>y(e,Event),keyboardEvent:e=>y(e,KeyboardEvent),cue:e=>y(e,window.TextTrackCue)||y(e,window.VTTCue),track:e=>y(e,TextTrack)||!b(e)&&w(e.kind),promise:e=>y(e,Promise)&&T(e.then),url:e=>{if(y(e,window.URL))return!0;if(!w(e))return!1;let t=e;e.startsWith("http://")&&e.startsWith("https://")||(t=`http://${e}`);try{return!A(new URL(t).hostname)}catch(e){return!1}},empty:A};const E=(()=>{const e=document.createElement("span"),t={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"},i=Object.keys(t).find((t=>void 0!==e.style[t]));return!!S.string(i)&&t[i]})();function P(e,t){setTimeout((()=>{try{e.hidden=!0,e.offsetHeight,e.hidden=!1}catch(e){}}),t)}var M={isIE:Boolean(window.document.documentMode),isEdge:/Edge/g.test(navigator.userAgent),isWebKit:"WebkitAppearance"in document.documentElement.style&&!/Edge/g.test(navigator.userAgent),isIPhone:/iPhone|iPod/gi.test(navigator.userAgent)&&navigator.maxTouchPoints>1,isIPadOS:"MacIntel"===navigator.platform&&navigator.maxTouchPoints>1,isIos:/iPad|iPhone|iPod/gi.test(navigator.userAgent)&&navigator.maxTouchPoints>1};function N(e,t){return t.split(".").reduce(((e,t)=>e&&e[t]),e)}function x(e={},...t){if(!t.length)return e;const i=t.shift();return S.object(i)?(Object.keys(i).forEach((t=>{S.object(i[t])?(Object.keys(e).includes(t)||Object.assign(e,{[t]:{}}),x(e[t],i[t])):Object.assign(e,{[t]:i[t]})})),x(e,...t)):e}function L(e,t){const i=e.length?e:[e];Array.from(i).reverse().forEach(((e,i)=>{const s=i>0?t.cloneNode(!0):t,n=e.parentNode,a=e.nextSibling;s.appendChild(e),a?n.insertBefore(s,a):n.appendChild(s)}))}function I(e,t){S.element(e)&&!S.empty(t)&&Object.entries(t).filter((([,e])=>!S.nullOrUndefined(e))).forEach((([t,i])=>e.setAttribute(t,i)))}function $(e,t,i){const s=document.createElement(e);return S.object(t)&&I(s,t),S.string(i)&&(s.innerText=i),s}function _(e,t,i,s){S.element(t)&&t.appendChild($(e,i,s))}function O(e){S.nodeList(e)||S.array(e)?Array.from(e).forEach(O):S.element(e)&&S.element(e.parentNode)&&e.parentNode.removeChild(e)}function j(e){if(!S.element(e))return;let{length:t}=e.childNodes;for(;t>0;)e.removeChild(e.lastChild),t-=1}function q(e,t){return S.element(t)&&S.element(t.parentNode)&&S.element(e)?(t.parentNode.replaceChild(e,t),e):null}function D(e,t){if(!S.string(e)||S.empty(e))return{};const i={},s=x({},t);return e.split(",").forEach((e=>{const t=e.trim(),n=t.replace(".",""),a=t.replace(/[[\]]/g,"").split("="),[l]=a,r=a.length>1?a[1].replace(/["']/g,""):"";switch(t.charAt(0)){case".":S.string(s.class)?i.class=`${s.class} ${n}`:i.class=n;break;case"#":i.id=t.replace("#","");break;case"[":i[l]=r}})),x(s,i)}function H(e,t){if(!S.element(e))return;let i=t;S.boolean(i)||(i=!e.hidden),e.hidden=i}function R(e,t,i){if(S.nodeList(e))return Array.from(e).map((e=>R(e,t,i)));if(S.element(e)){let s="toggle";return void 0!==i&&(s=i?"add":"remove"),e.classList[s](t),e.classList.contains(t)}return!1}function F(e,t){return S.element(e)&&e.classList.contains(t)}function V(e,t){const{prototype:i}=Element;return(i.matches||i.webkitMatchesSelector||i.mozMatchesSelector||i.msMatchesSelector||function(){return Array.from(document.querySelectorAll(t)).includes(this)}).call(e,t)}function U(e){return this.elements.container.querySelectorAll(e)}function B(e){return this.elements.container.querySelector(e)}function W(e=null,t=!1){S.element(e)&&e.focus({preventScroll:!0,focusVisible:t})}const z={"audio/ogg":"vorbis","audio/wav":"1","video/webm":"vp8, vorbis","video/mp4":"avc1.42E01E, mp4a.40.2","video/ogg":"theora"},K={audio:"canPlayType"in document.createElement("audio"),video:"canPlayType"in document.createElement("video"),check(e,t){const i=K[e]||"html5"!==t;return{api:i,ui:i&&K.rangeInput}},pip:!(M.isIPhone||!S.function($("video").webkitSetPresentationMode)&&(!document.pictureInPictureEnabled||$("video").disablePictureInPicture)),airplay:S.function(window.WebKitPlaybackTargetAvailabilityEvent),playsinline:"playsInline"in document.createElement("video"),mime(e){if(S.empty(e))return!1;const[t]=e.split("/");let i=e;if(!this.isHTML5||t!==this.type)return!1;Object.keys(z).includes(i)&&(i+=`; codecs="${z[e]}"`);try{return Boolean(i&&this.media.canPlayType(i).replace(/no/,""))}catch(e){return!1}},textTracks:"textTracks"in document.createElement("video"),rangeInput:(()=>{const e=document.createElement("input");return e.type="range","range"===e.type})(),touch:"ontouchstart"in document.documentElement,transitions:!1!==E,reducedMotion:"matchMedia"in window&&window.matchMedia("(prefers-reduced-motion)").matches},Y=(()=>{let e=!1;try{const t=Object.defineProperty({},"passive",{get:()=>(e=!0,null)});window.addEventListener("test",null,t),window.removeEventListener("test",null,t)}catch(e){}return e})();function Q(e,t,i,s=!1,n=!0,a=!1){if(!e||!("addEventListener"in e)||S.empty(t)||!S.function(i))return;const l=t.split(" ");let r=a;Y&&(r={passive:n,capture:a}),l.forEach((t=>{this&&this.eventListeners&&s&&this.eventListeners.push({element:e,type:t,callback:i,options:r}),e[s?"addEventListener":"removeEventListener"](t,i,r)}))}function X(e,t="",i,s=!0,n=!1){Q.call(this,e,t,i,!0,s,n)}function J(e,t="",i,s=!0,n=!1){Q.call(this,e,t,i,!1,s,n)}function G(e,t="",i,s=!0,n=!1){const a=(...l)=>{J(e,t,a,s,n),i.apply(this,l)};Q.call(this,e,t,a,!0,s,n)}function Z(e,t="",i=!1,s={}){if(!S.element(e)||S.empty(t))return;const n=new CustomEvent(t,{bubbles:i,detail:{...s,plyr:this}});e.dispatchEvent(n)}function ee(){this&&this.eventListeners&&(this.eventListeners.forEach((e=>{const{element:t,type:i,callback:s,options:n}=e;t.removeEventListener(i,s,n)})),this.eventListeners=[])}function te(){return new Promise((e=>this.ready?setTimeout(e,0):X.call(this,this.elements.container,"ready",e))).then((()=>{}))}function ie(e){S.promise(e)&&e.then(null,(()=>{}))}function se(e){return S.array(e)?e.filter(((t,i)=>e.indexOf(t)===i)):e}function ne(e,t){return S.array(e)&&e.length?e.reduce(((e,i)=>Math.abs(i-t)<Math.abs(e-t)?i:e)):null}function ae(e){return!(!window||!window.CSS)&&window.CSS.supports(e)}const le=[[1,1],[4,3],[3,4],[5,4],[4,5],[3,2],[2,3],[16,10],[10,16],[16,9],[9,16],[21,9],[9,21],[32,9],[9,32]].reduce(((e,[t,i])=>({...e,[t/i]:[t,i]})),{});function re(e){if(!(S.array(e)||S.string(e)&&e.includes(":")))return!1;return(S.array(e)?e:e.split(":")).map(Number).every(S.number)}function oe(e){if(!S.array(e)||!e.every(S.number))return null;const[t,i]=e,s=(e,t)=>0===t?e:s(t,e%t),n=s(t,i);return[t/n,i/n]}function ce(e){const t=e=>re(e)?e.split(":").map(Number):null;let i=t(e);if(null===i&&(i=t(this.config.ratio)),null===i&&!S.empty(this.embed)&&S.array(this.embed.ratio)&&({ratio:i}=this.embed),null===i&&this.isHTML5){const{videoWidth:e,videoHeight:t}=this.media;i=[e,t]}return oe(i)}function ue(e){if(!this.isVideo)return{};const{wrapper:t}=this.elements,i=ce.call(this,e);if(!S.array(i))return{};const[s,n]=oe(i),a=100/s*n;if(ae(`aspect-ratio: ${s}/${n}`)?t.style.aspectRatio=`${s}/${n}`:t.style.paddingBottom=`${a}%`,this.isVimeo&&!this.config.vimeo.premium&&this.supported.ui){const e=100/this.media.offsetWidth*parseInt(window.getComputedStyle(this.media).paddingBottom,10),i=(e-a)/(e/50);this.fullscreen.active?t.style.paddingBottom=null:this.media.style.transform=`translateY(-${i}%)`}else this.isHTML5&&t.classList.add(this.config.classNames.videoFixedRatio);return{padding:a,ratio:i}}function he(e,t,i=.05){const s=e/t,n=ne(Object.keys(le),s);return Math.abs(n-s)<=i?le[n]:[e,t]}const de={getSources(){if(!this.isHTML5)return[];return Array.from(this.media.querySelectorAll("source")).filter((e=>{const t=e.getAttribute("type");return!!S.empty(t)||K.mime.call(this,t)}))},getQualityOptions(){return this.config.quality.forced?this.config.quality.options:de.getSources.call(this).map((e=>Number(e.getAttribute("size")))).filter(Boolean)},setup(){if(!this.isHTML5)return;const e=this;e.options.speed=e.config.speed.options,S.empty(this.config.ratio)||ue.call(e),Object.defineProperty(e.media,"quality",{get(){const t=de.getSources.call(e).find((t=>t.getAttribute("src")===e.source));return t&&Number(t.getAttribute("size"))},set(t){if(e.quality!==t){if(e.config.quality.forced&&S.function(e.config.quality.onChange))e.config.quality.onChange(t);else{const i=de.getSources.call(e).find((e=>Number(e.getAttribute("size"))===t));if(!i)return;const{currentTime:s,paused:n,preload:a,readyState:l,playbackRate:r}=e.media;e.media.src=i.getAttribute("src"),("none"!==a||l)&&(e.once("loadedmetadata",(()=>{e.speed=r,e.currentTime=s,n||ie(e.play())})),e.media.load())}Z.call(e,e.media,"qualitychange",!1,{quality:t})}}})},cancelRequests(){this.isHTML5&&(O(de.getSources.call(this)),this.media.setAttribute("src",this.config.blankVideo),this.media.load(),this.debug.log("Cancelled network requests"))}};function me(e,...t){return S.empty(e)?e:e.toString().replace(/{(\d+)}/g,((e,i)=>t[i].toString()))}const pe=(e="",t="",i="")=>e.replace(new RegExp(t.toString().replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1"),"g"),i.toString()),ge=(e="")=>e.toString().replace(/\w\S*/g,(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()));function fe(e=""){let t=e.toString();return t=function(e=""){let t=e.toString();return t=pe(t,"-"," "),t=pe(t,"_"," "),t=ge(t),pe(t," ","")}(t),t.charAt(0).toLowerCase()+t.slice(1)}function ye(e){const t=document.createElement("div");return t.appendChild(e),t.innerHTML}const be={pip:"PIP",airplay:"AirPlay",html5:"HTML5",vimeo:"Vimeo",youtube:"YouTube"},ve={get(e="",t={}){if(S.empty(e)||S.empty(t))return"";let i=N(t.i18n,e);if(S.empty(i))return Object.keys(be).includes(e)?be[e]:"";const s={"{seektime}":t.seekTime,"{title}":t.title};return Object.entries(s).forEach((([e,t])=>{i=pe(i,e,t)})),i}};class we{constructor(t){e(this,"get",(e=>{if(!we.supported||!this.enabled)return null;const t=window.localStorage.getItem(this.key);if(S.empty(t))return null;const i=JSON.parse(t);return S.string(e)&&e.length?i[e]:i})),e(this,"set",(e=>{if(!we.supported||!this.enabled)return;if(!S.object(e))return;let t=this.get();S.empty(t)&&(t={}),x(t,e);try{window.localStorage.setItem(this.key,JSON.stringify(t))}catch(e){}})),this.enabled=t.config.storage.enabled,this.key=t.config.storage.key}static get supported(){try{if(!("localStorage"in window))return!1;const e="___test";return window.localStorage.setItem(e,e),window.localStorage.removeItem(e),!0}catch(e){return!1}}}function Te(e,t="text"){return new Promise(((i,s)=>{try{const s=new XMLHttpRequest;if(!("withCredentials"in s))return;s.addEventListener("load",(()=>{if("text"===t)try{i(JSON.parse(s.responseText))}catch(e){i(s.responseText)}else i(s.response)})),s.addEventListener("error",(()=>{throw new Error(s.status)})),s.open("GET",e,!0),s.responseType=t,s.send()}catch(e){s(e)}}))}function ke(e,t){if(!S.string(e))return;const i="cache",s=S.string(t);let n=!1;const a=()=>null!==document.getElementById(t),l=(e,t)=>{e.innerHTML=t,s&&a()||document.body.insertAdjacentElement("afterbegin",e)};if(!s||!a()){const a=we.supported,r=document.createElement("div");if(r.setAttribute("hidden",""),s&&r.setAttribute("id",t),a){const e=window.localStorage.getItem(`${i}-${t}`);if(n=null!==e,n){const t=JSON.parse(e);l(r,t.content)}}Te(e).then((e=>{if(!S.empty(e)){if(a)try{window.localStorage.setItem(`${i}-${t}`,JSON.stringify({content:e}))}catch(e){}l(r,e)}})).catch((()=>{}))}}const Ce=e=>Math.trunc(e/60/60%60,10),Ae=e=>Math.trunc(e/60%60,10),Se=e=>Math.trunc(e%60,10);function Ee(e=0,t=!1,i=!1){if(!S.number(e))return Ee(void 0,t,i);const s=e=>`0${e}`.slice(-2);let n=Ce(e);const a=Ae(e),l=Se(e);return n=t||n>0?`${n}:`:"",`${i&&e>0?"-":""}${n}${s(a)}:${s(l)}`}const Pe={getIconUrl(){const e=new URL(this.config.iconUrl,window.location),t=window.location.host?window.location.host:window.top.location.host,i=e.host!==t||M.isIE&&!window.svg4everybody;return{url:this.config.iconUrl,cors:i}},findElements(){try{return this.elements.controls=B.call(this,this.config.selectors.controls.wrapper),this.elements.buttons={play:U.call(this,this.config.selectors.buttons.play),pause:B.call(this,this.config.selectors.buttons.pause),restart:B.call(this,this.config.selectors.buttons.restart),rewind:B.call(this,this.config.selectors.buttons.rewind),fastForward:B.call(this,this.config.selectors.buttons.fastForward),mute:B.call(this,this.config.selectors.buttons.mute),pip:B.call(this,this.config.selectors.buttons.pip),airplay:B.call(this,this.config.selectors.buttons.airplay),settings:B.call(this,this.config.selectors.buttons.settings),captions:B.call(this,this.config.selectors.buttons.captions),fullscreen:B.call(this,this.config.selectors.buttons.fullscreen)},this.elements.progress=B.call(this,this.config.selectors.progress),this.elements.inputs={seek:B.call(this,this.config.selectors.inputs.seek),volume:B.call(this,this.config.selectors.inputs.volume)},this.elements.display={buffer:B.call(this,this.config.selectors.display.buffer),currentTime:B.call(this,this.config.selectors.display.currentTime),duration:B.call(this,this.config.selectors.display.duration)},S.element(this.elements.progress)&&(this.elements.display.seekTooltip=this.elements.progress.querySelector(`.${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(e,t){const i="http://www.w3.org/2000/svg",s=Pe.getIconUrl.call(this),n=`${s.cors?"":s.url}#${this.config.iconPrefix}`,a=document.createElementNS(i,"svg");I(a,x(t,{"aria-hidden":"true",focusable:"false"}));const l=document.createElementNS(i,"use"),r=`${n}-${e}`;return"href"in l&&l.setAttributeNS("http://www.w3.org/1999/xlink","href",r),l.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",r),a.appendChild(l),a},createLabel(e,t={}){const i=ve.get(e,this.config);return $("span",{...t,class:[t.class,this.config.classNames.hidden].filter(Boolean).join(" ")},i)},createBadge(e){if(S.empty(e))return null;const t=$("span",{class:this.config.classNames.menu.value});return t.appendChild($("span",{class:this.config.classNames.menu.badge},e)),t},createButton(e,t){const i=x({},t);let s=fe(e);const n={element:"button",toggle:!1,label:null,icon:null,labelPressed:null,iconPressed:null};switch(["element","icon","label"].forEach((e=>{Object.keys(i).includes(e)&&(n[e]=i[e],delete i[e])})),"button"!==n.element||Object.keys(i).includes("type")||(i.type="button"),Object.keys(i).includes("class")?i.class.split(" ").some((e=>e===this.config.classNames.control))||x(i,{class:`${i.class} ${this.config.classNames.control}`}):i.class=this.config.classNames.control,e){case"play":n.toggle=!0,n.label="play",n.labelPressed="pause",n.icon="play",n.iconPressed="pause";break;case"mute":n.toggle=!0,n.label="mute",n.labelPressed="unmute",n.icon="volume",n.iconPressed="muted";break;case"captions":n.toggle=!0,n.label="enableCaptions",n.labelPressed="disableCaptions",n.icon="captions-off",n.iconPressed="captions-on";break;case"fullscreen":n.toggle=!0,n.label="enterFullscreen",n.labelPressed="exitFullscreen",n.icon="enter-fullscreen",n.iconPressed="exit-fullscreen";break;case"play-large":i.class+=` ${this.config.classNames.control}--overlaid`,s="play",n.label="play",n.icon="play";break;default:S.empty(n.label)&&(n.label=s),S.empty(n.icon)&&(n.icon=e)}const a=$(n.element);return n.toggle?(a.appendChild(Pe.createIcon.call(this,n.iconPressed,{class:"icon--pressed"})),a.appendChild(Pe.createIcon.call(this,n.icon,{class:"icon--not-pressed"})),a.appendChild(Pe.createLabel.call(this,n.labelPressed,{class:"label--pressed"})),a.appendChild(Pe.createLabel.call(this,n.label,{class:"label--not-pressed"}))):(a.appendChild(Pe.createIcon.call(this,n.icon)),a.appendChild(Pe.createLabel.call(this,n.label))),x(i,D(this.config.selectors.buttons[s],i)),I(a,i),"play"===s?(S.array(this.elements.buttons[s])||(this.elements.buttons[s]=[]),this.elements.buttons[s].push(a)):this.elements.buttons[s]=a,a},createRange(e,t){const i=$("input",x(D(this.config.selectors.inputs[e]),{type:"range",min:0,max:100,step:.01,value:0,autocomplete:"off",role:"slider","aria-label":ve.get(e,this.config),"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":0},t));return this.elements.inputs[e]=i,Pe.updateRangeFill.call(this,i),g.setup(i),i},createProgress(e,t){const i=$("progress",x(D(this.config.selectors.display[e]),{min:0,max:100,value:0,role:"progressbar","aria-hidden":!0},t));if("volume"!==e){i.appendChild($("span",null,"0"));const t={played:"played",buffer:"buffered"}[e],s=t?ve.get(t,this.config):"";i.innerText=`% ${s.toLowerCase()}`}return this.elements.display[e]=i,i},createTime(e,t){const i=D(this.config.selectors.display[e],t),s=$("div",x(i,{class:`${i.class?i.class:""} ${this.config.classNames.display.time} `.trim(),"aria-label":ve.get(e,this.config),role:"timer"}),"00:00");return this.elements.display[e]=s,s},bindMenuItemShortcuts(e,t){X.call(this,e,"keydown keyup",(i=>{if(![" ","ArrowUp","ArrowDown","ArrowRight"].includes(i.key))return;if(i.preventDefault(),i.stopPropagation(),"keydown"===i.type)return;const s=V(e,'[role="menuitemradio"]');if(!s&&[" ","ArrowRight"].includes(i.key))Pe.showMenuPanel.call(this,t,!0);else{let t;" "!==i.key&&("ArrowDown"===i.key||s&&"ArrowRight"===i.key?(t=e.nextElementSibling,S.element(t)||(t=e.parentNode.firstElementChild)):(t=e.previousElementSibling,S.element(t)||(t=e.parentNode.lastElementChild)),W.call(this,t,!0))}}),!1),X.call(this,e,"keyup",(e=>{"Return"===e.key&&Pe.focusFirstMenuItem.call(this,null,!0)}))},createMenuItem({value:e,list:t,type:i,title:s,badge:n=null,checked:a=!1}){const l=D(this.config.selectors.inputs[i]),r=$("button",x(l,{type:"button",role:"menuitemradio",class:`${this.config.classNames.control} ${l.class?l.class:""}`.trim(),"aria-checked":a,value:e})),o=$("span");o.innerHTML=s,S.element(n)&&o.appendChild(n),r.appendChild(o),Object.defineProperty(r,"checked",{enumerable:!0,get:()=>"true"===r.getAttribute("aria-checked"),set(e){e&&Array.from(r.parentNode.children).filter((e=>V(e,'[role="menuitemradio"]'))).forEach((e=>e.setAttribute("aria-checked","false"))),r.setAttribute("aria-checked",e?"true":"false")}}),this.listeners.bind(r,"click keyup",(t=>{if(!S.keyboardEvent(t)||" "===t.key){switch(t.preventDefault(),t.stopPropagation(),r.checked=!0,i){case"language":this.currentTrack=Number(e);break;case"quality":this.quality=e;break;case"speed":this.speed=parseFloat(e)}Pe.showMenuPanel.call(this,"home",S.keyboardEvent(t))}}),i,!1),Pe.bindMenuItemShortcuts.call(this,r,i),t.appendChild(r)},formatTime(e=0,t=!1){if(!S.number(e))return e;return Ee(e,Ce(this.duration)>0,t)},updateTimeDisplay(e=null,t=0,i=!1){S.element(e)&&S.number(t)&&(e.innerText=Pe.formatTime(t,i))},updateVolume(){this.supported.ui&&(S.element(this.elements.inputs.volume)&&Pe.setRange.call(this,this.elements.inputs.volume,this.muted?0:this.volume),S.element(this.elements.buttons.mute)&&(this.elements.buttons.mute.pressed=this.muted||0===this.volume))},setRange(e,t=0){S.element(e)&&(e.value=t,Pe.updateRangeFill.call(this,e))},updateProgress(e){if(!this.supported.ui||!S.event(e))return;let t=0;const i=(e,t)=>{const i=S.number(t)?t:0,s=S.element(e)?e:this.elements.display.buffer;if(S.element(s)){s.value=i;const e=s.getElementsByTagName("span")[0];S.element(e)&&(e.childNodes[0].nodeValue=i)}};if(e)switch(e.type){case"timeupdate":case"seeking":case"seeked":s=this.currentTime,n=this.duration,t=0===s||0===n||Number.isNaN(s)||Number.isNaN(n)?0:(s/n*100).toFixed(2),"timeupdate"===e.type&&Pe.setRange.call(this,this.elements.inputs.seek,t);break;case"playing":case"progress":i(this.elements.display.buffer,100*this.buffered)}var s,n},updateRangeFill(e){const t=S.event(e)?e.target:e;if(S.element(t)&&"range"===t.getAttribute("type")){if(V(t,this.config.selectors.inputs.seek)){t.setAttribute("aria-valuenow",this.currentTime);const e=Pe.formatTime(this.currentTime),i=Pe.formatTime(this.duration),s=ve.get("seekLabel",this.config);t.setAttribute("aria-valuetext",s.replace("{currentTime}",e).replace("{duration}",i))}else if(V(t,this.config.selectors.inputs.volume)){const e=100*t.value;t.setAttribute("aria-valuenow",e),t.setAttribute("aria-valuetext",`${e.toFixed(1)}%`)}else t.setAttribute("aria-valuenow",t.value);(M.isWebKit||M.isIPadOS)&&t.style.setProperty("--value",t.value/t.max*100+"%")}},updateSeekTooltip(e){var t,i;if(!this.config.tooltips.seek||!S.element(this.elements.inputs.seek)||!S.element(this.elements.display.seekTooltip)||0===this.duration)return;const s=this.elements.display.seekTooltip,n=`${this.config.classNames.tooltip}--visible`,a=e=>R(s,n,e);if(this.touch)return void a(!1);let l=0;const r=this.elements.progress.getBoundingClientRect();if(S.event(e))l=100/r.width*(e.pageX-r.left);else{if(!F(s,n))return;l=parseFloat(s.style.left,10)}l<0?l=0:l>100&&(l=100);const o=this.duration/100*l;s.innerText=Pe.formatTime(o);const c=null===(t=this.config.markers)||void 0===t||null===(i=t.points)||void 0===i?void 0:i.find((({time:e})=>e===Math.round(o)));c&&s.insertAdjacentHTML("afterbegin",`${c.label}<br>`),s.style.left=`${l}%`,S.event(e)&&["mouseenter","mouseleave"].includes(e.type)&&a("mouseenter"===e.type)},timeUpdate(e){const t=!S.element(this.elements.display.duration)&&this.config.invertTime;Pe.updateTimeDisplay.call(this,this.elements.display.currentTime,t?this.duration-this.currentTime:this.currentTime,t),e&&"timeupdate"===e.type&&this.media.seeking||Pe.updateProgress.call(this,e)},durationUpdate(){if(!this.supported.ui||!this.config.invertTime&&this.currentTime)return;if(this.duration>=2**32)return H(this.elements.display.currentTime,!0),void H(this.elements.progress,!0);S.element(this.elements.inputs.seek)&&this.elements.inputs.seek.setAttribute("aria-valuemax",this.duration);const e=S.element(this.elements.display.duration);!e&&this.config.displayDuration&&this.paused&&Pe.updateTimeDisplay.call(this,this.elements.display.currentTime,this.duration),e&&Pe.updateTimeDisplay.call(this,this.elements.display.duration,this.duration),this.config.markers.enabled&&Pe.setMarkers.call(this),Pe.updateSeekTooltip.call(this)},toggleMenuButton(e,t){H(this.elements.settings.buttons[e],!t)},updateSetting(e,t,i){const s=this.elements.settings.panels[e];let n=null,a=t;if("captions"===e)n=this.currentTrack;else{if(n=S.empty(i)?this[e]:i,S.empty(n)&&(n=this.config[e].default),!S.empty(this.options[e])&&!this.options[e].includes(n))return void this.debug.warn(`Unsupported value of '${n}' for ${e}`);if(!this.config[e].options.includes(n))return void this.debug.warn(`Disabled value of '${n}' for ${e}`)}if(S.element(a)||(a=s&&s.querySelector('[role="menu"]')),!S.element(a))return;this.elements.settings.buttons[e].querySelector(`.${this.config.classNames.menu.value}`).innerHTML=Pe.getLabel.call(this,e,n);const l=a&&a.querySelector(`[value="${n}"]`);S.element(l)&&(l.checked=!0)},getLabel(e,t){switch(e){case"speed":return 1===t?ve.get("normal",this.config):`${t}×`;case"quality":if(S.number(t)){const e=ve.get(`qualityLabel.${t}`,this.config);return e.length?e:`${t}p`}return ge(t);case"captions":return xe.getLabel.call(this);default:return null}},setQualityMenu(e){if(!S.element(this.elements.settings.panels.quality))return;const t="quality",i=this.elements.settings.panels.quality.querySelector('[role="menu"]');S.array(e)&&(this.options.quality=se(e).filter((e=>this.config.quality.options.includes(e))));const s=!S.empty(this.options.quality)&&this.options.quality.length>1;if(Pe.toggleMenuButton.call(this,t,s),j(i),Pe.checkMenu.call(this),!s)return;const n=e=>{const t=ve.get(`qualityBadge.${e}`,this.config);return t.length?Pe.createBadge.call(this,t):null};this.options.quality.sort(((e,t)=>{const i=this.config.quality.options;return i.indexOf(e)>i.indexOf(t)?1:-1})).forEach((e=>{Pe.createMenuItem.call(this,{value:e,list:i,type:t,title:Pe.getLabel.call(this,"quality",e),badge:n(e)})})),Pe.updateSetting.call(this,t,i)},setCaptionsMenu(){if(!S.element(this.elements.settings.panels.captions))return;const e="captions",t=this.elements.settings.panels.captions.querySelector('[role="menu"]'),i=xe.getTracks.call(this),s=Boolean(i.length);if(Pe.toggleMenuButton.call(this,e,s),j(t),Pe.checkMenu.call(this),!s)return;const n=i.map(((e,i)=>({value:i,checked:this.captions.toggled&&this.currentTrack===i,title:xe.getLabel.call(this,e),badge:e.language&&Pe.createBadge.call(this,e.language.toUpperCase()),list:t,type:"language"})));n.unshift({value:-1,checked:!this.captions.toggled,title:ve.get("disabled",this.config),list:t,type:"language"}),n.forEach(Pe.createMenuItem.bind(this)),Pe.updateSetting.call(this,e,t)},setSpeedMenu(){if(!S.element(this.elements.settings.panels.speed))return;const e="speed",t=this.elements.settings.panels.speed.querySelector('[role="menu"]');this.options.speed=this.options.speed.filter((e=>e>=this.minimumSpeed&&e<=this.maximumSpeed));const i=!S.empty(this.options.speed)&&this.options.speed.length>1;Pe.toggleMenuButton.call(this,e,i),j(t),Pe.checkMenu.call(this),i&&(this.options.speed.forEach((i=>{Pe.createMenuItem.call(this,{value:i,list:t,type:e,title:Pe.getLabel.call(this,"speed",i)})})),Pe.updateSetting.call(this,e,t))},checkMenu(){const{buttons:e}=this.elements.settings,t=!S.empty(e)&&Object.values(e).some((e=>!e.hidden));H(this.elements.settings.menu,!t)},focusFirstMenuItem(e,t=!1){if(this.elements.settings.popup.hidden)return;let i=e;S.element(i)||(i=Object.values(this.elements.settings.panels).find((e=>!e.hidden)));const s=i.querySelector('[role^="menuitem"]');W.call(this,s,t)},toggleMenu(e){const{popup:t}=this.elements.settings,i=this.elements.buttons.settings;if(!S.element(t)||!S.element(i))return;const{hidden:s}=t;let n=s;if(S.boolean(e))n=e;else if(S.keyboardEvent(e)&&"Escape"===e.key)n=!1;else if(S.event(e)){const s=S.function(e.composedPath)?e.composedPath()[0]:e.target,a=t.contains(s);if(a||!a&&e.target!==i&&n)return}i.setAttribute("aria-expanded",n),H(t,!n),R(this.elements.container,this.config.classNames.menu.open,n),n&&S.keyboardEvent(e)?Pe.focusFirstMenuItem.call(this,null,!0):n||s||W.call(this,i,S.keyboardEvent(e))},getMenuSize(e){const t=e.cloneNode(!0);t.style.position="absolute",t.style.opacity=0,t.removeAttribute("hidden"),e.parentNode.appendChild(t);const i=t.scrollWidth,s=t.scrollHeight;return O(t),{width:i,height:s}},showMenuPanel(e="",t=!1){const i=this.elements.container.querySelector(`#plyr-settings-${this.id}-${e}`);if(!S.element(i))return;const s=i.parentNode,n=Array.from(s.children).find((e=>!e.hidden));if(K.transitions&&!K.reducedMotion){s.style.width=`${n.scrollWidth}px`,s.style.height=`${n.scrollHeight}px`;const e=Pe.getMenuSize.call(this,i),t=e=>{e.target===s&&["width","height"].includes(e.propertyName)&&(s.style.width="",s.style.height="",J.call(this,s,E,t))};X.call(this,s,E,t),s.style.width=`${e.width}px`,s.style.height=`${e.height}px`}H(n,!0),H(i,!1),Pe.focusFirstMenuItem.call(this,i,t)},setDownloadUrl(){const e=this.elements.buttons.download;S.element(e)&&e.setAttribute("href",this.download)},create(e){const{bindMenuItemShortcuts:t,createButton:i,createProgress:s,createRange:n,createTime:a,setQualityMenu:l,setSpeedMenu:r,showMenuPanel:o}=Pe;this.elements.controls=null,S.array(this.config.controls)&&this.config.controls.includes("play-large")&&this.elements.container.appendChild(i.call(this,"play-large"));const c=$("div",D(this.config.selectors.controls.wrapper));this.elements.controls=c;const u={class:"plyr__controls__item"};return se(S.array(this.config.controls)?this.config.controls:[]).forEach((l=>{if("restart"===l&&c.appendChild(i.call(this,"restart",u)),"rewind"===l&&c.appendChild(i.call(this,"rewind",u)),"play"===l&&c.appendChild(i.call(this,"play",u)),"fast-forward"===l&&c.appendChild(i.call(this,"fast-forward",u)),"progress"===l){const t=$("div",{class:`${u.class} plyr__progress__container`}),i=$("div",D(this.config.selectors.progress));if(i.appendChild(n.call(this,"seek",{id:`plyr-seek-${e.id}`})),i.appendChild(s.call(this,"buffer")),this.config.tooltips.seek){const e=$("span",{class:this.config.classNames.tooltip},"00:00");i.appendChild(e),this.elements.display.seekTooltip=e}this.elements.progress=i,t.appendChild(this.elements.progress),c.appendChild(t)}if("current-time"===l&&c.appendChild(a.call(this,"currentTime",u)),"duration"===l&&c.appendChild(a.call(this,"duration",u)),"mute"===l||"volume"===l){let{volume:t}=this.elements;if(S.element(t)&&c.contains(t)||(t=$("div",x({},u,{class:`${u.class} plyr__volume`.trim()})),this.elements.volume=t,c.appendChild(t)),"mute"===l&&t.appendChild(i.call(this,"mute")),"volume"===l&&!M.isIos&&!M.isIPadOS){const i={max:1,step:.05,value:this.config.volume};t.appendChild(n.call(this,"volume",x(i,{id:`plyr-volume-${e.id}`})))}}if("captions"===l&&c.appendChild(i.call(this,"captions",u)),"settings"===l&&!S.empty(this.config.settings)){const s=$("div",x({},u,{class:`${u.class} plyr__menu`.trim(),hidden:""}));s.appendChild(i.call(this,"settings",{"aria-haspopup":!0,"aria-controls":`plyr-settings-${e.id}`,"aria-expanded":!1}));const n=$("div",{class:"plyr__menu__container",id:`plyr-settings-${e.id}`,hidden:""}),a=$("div"),l=$("div",{id:`plyr-settings-${e.id}-home`}),r=$("div",{role:"menu"});l.appendChild(r),a.appendChild(l),this.elements.settings.panels.home=l,this.config.settings.forEach((i=>{const s=$("button",x(D(this.config.selectors.buttons.settings),{type:"button",class:`${this.config.classNames.control} ${this.config.classNames.control}--forward`,role:"menuitem","aria-haspopup":!0,hidden:""}));t.call(this,s,i),X.call(this,s,"click",(()=>{o.call(this,i,!1)}));const n=$("span",null,ve.get(i,this.config)),l=$("span",{class:this.config.classNames.menu.value});l.innerHTML=e[i],n.appendChild(l),s.appendChild(n),r.appendChild(s);const c=$("div",{id:`plyr-settings-${e.id}-${i}`,hidden:""}),u=$("button",{type:"button",class:`${this.config.classNames.control} ${this.config.classNames.control}--back`});u.appendChild($("span",{"aria-hidden":!0},ve.get(i,this.config))),u.appendChild($("span",{class:this.config.classNames.hidden},ve.get("menuBack",this.config))),X.call(this,c,"keydown",(e=>{"ArrowLeft"===e.key&&(e.preventDefault(),e.stopPropagation(),o.call(this,"home",!0))}),!1),X.call(this,u,"click",(()=>{o.call(this,"home",!1)})),c.appendChild(u),c.appendChild($("div",{role:"menu"})),a.appendChild(c),this.elements.settings.buttons[i]=s,this.elements.settings.panels[i]=c})),n.appendChild(a),s.appendChild(n),c.appendChild(s),this.elements.settings.popup=n,this.elements.settings.menu=s}if("pip"===l&&K.pip&&c.appendChild(i.call(this,"pip",u)),"airplay"===l&&K.airplay&&c.appendChild(i.call(this,"airplay",u)),"download"===l){const e=x({},u,{element:"a",href:this.download,target:"_blank"});this.isHTML5&&(e.download="");const{download:t}=this.config.urls;!S.url(t)&&this.isEmbed&&x(e,{icon:`logo-${this.provider}`,label:this.provider}),c.appendChild(i.call(this,"download",e))}"fullscreen"===l&&c.appendChild(i.call(this,"fullscreen",u))})),this.isHTML5&&l.call(this,de.getQualityOptions.call(this)),r.call(this),c},inject(){if(this.config.loadSprite){const e=Pe.getIconUrl.call(this);e.cors&&ke(e.url,"sprite-plyr")}this.id=Math.floor(1e4*Math.random());let e=null;this.elements.controls=null;const t={id:this.id,seektime:this.config.seekTime,title:this.config.title};let i=!0;S.function(this.config.controls)&&(this.config.controls=this.config.controls.call(this,t)),this.config.controls||(this.config.controls=[]),S.element(this.config.controls)||S.string(this.config.controls)?e=this.config.controls:(e=Pe.create.call(this,{id:this.id,seektime:this.config.seekTime,speed:this.speed,quality:this.quality,captions:xe.getLabel.call(this)}),i=!1);let s;i&&S.string(this.config.controls)&&(e=(e=>{let i=e;return Object.entries(t).forEach((([e,t])=>{i=pe(i,`{${e}}`,t)})),i})(e)),S.string(this.config.selectors.controls.container)&&(s=document.querySelector(this.config.selectors.controls.container)),S.element(s)||(s=this.elements.container);if(s[S.element(e)?"insertAdjacentElement":"insertAdjacentHTML"]("afterbegin",e),S.element(this.elements.controls)||Pe.findElements.call(this),!S.empty(this.elements.buttons)){const e=e=>{const t=this.config.classNames.controlPressed;e.setAttribute("aria-pressed","false"),Object.defineProperty(e,"pressed",{configurable:!0,enumerable:!0,get:()=>F(e,t),set(i=!1){R(e,t,i),e.setAttribute("aria-pressed",i?"true":"false")}})};Object.values(this.elements.buttons).filter(Boolean).forEach((t=>{S.array(t)||S.nodeList(t)?Array.from(t).filter(Boolean).forEach(e):e(t)}))}if(M.isEdge&&P(s),this.config.tooltips.controls){const{classNames:e,selectors:t}=this.config,i=`${t.controls.wrapper} ${t.labels} .${e.hidden}`,s=U.call(this,i);Array.from(s).forEach((e=>{R(e,this.config.classNames.hidden,!1),R(e,this.config.classNames.tooltip,!0)}))}},setMediaMetadata(){try{"mediaSession"in navigator&&(navigator.mediaSession.metadata=new window.MediaMetadata({title:this.config.mediaMetadata.title,artist:this.config.mediaMetadata.artist,album:this.config.mediaMetadata.album,artwork:this.config.mediaMetadata.artwork}))}catch(e){}},setMarkers(){var e,t;if(!this.duration||this.elements.markers)return;const i=null===(e=this.config.markers)||void 0===e||null===(t=e.points)||void 0===t?void 0:t.filter((({time:e})=>e>0&&e<this.duration));if(null==i||!i.length)return;const s=document.createDocumentFragment(),n=document.createDocumentFragment();let a=null;const l=`${this.config.classNames.tooltip}--visible`,r=e=>R(a,l,e);i.forEach((e=>{const t=$("span",{class:this.config.classNames.marker},""),i=e.time/this.duration*100+"%";a&&(t.addEventListener("mouseenter",(()=>{e.label||(a.style.left=i,a.innerHTML=e.label,r(!0))})),t.addEventListener("mouseleave",(()=>{r(!1)}))),t.addEventListener("click",(()=>{this.currentTime=e.time})),t.style.left=i,n.appendChild(t)})),s.appendChild(n),this.config.tooltips.seek||(a=$("span",{class:this.config.classNames.tooltip},""),s.appendChild(a)),this.elements.markers={points:n,tip:a},this.elements.progress.appendChild(s)}};function Me(e,t=!0){let i=e;if(t){const e=document.createElement("a");e.href=i,i=e.href}try{return new URL(i)}catch(e){return null}}function Ne(e){const t=new URLSearchParams;return S.object(e)&&Object.entries(e).forEach((([e,i])=>{t.set(e,i)})),t}const xe={setup(){if(!this.supported.ui)return;if(!this.isVideo||this.isYouTube||this.isHTML5&&!K.textTracks)return void(S.array(this.config.controls)&&this.config.controls.includes("settings")&&this.config.settings.includes("captions")&&Pe.setCaptionsMenu.call(this));var e,t;if(S.element(this.elements.captions)||(this.elements.captions=$("div",D(this.config.selectors.captions)),this.elements.captions.setAttribute("dir","auto"),e=this.elements.captions,t=this.elements.wrapper,S.element(e)&&S.element(t)&&t.parentNode.insertBefore(e,t.nextSibling)),M.isIE&&window.URL){const e=this.media.querySelectorAll("track");Array.from(e).forEach((e=>{const t=e.getAttribute("src"),i=Me(t);null!==i&&i.hostname!==window.location.href.hostname&&["http:","https:"].includes(i.protocol)&&Te(t,"blob").then((t=>{e.setAttribute("src",window.URL.createObjectURL(t))})).catch((()=>{O(e)}))}))}const i=se((navigator.languages||[navigator.language||navigator.userLanguage||"en"]).map((e=>e.split("-")[0])));let s=(this.storage.get("language")||this.config.captions.language||"auto").toLowerCase();"auto"===s&&([s]=i);let n=this.storage.get("captions");if(S.boolean(n)||({active:n}=this.config.captions),Object.assign(this.captions,{toggled:!1,active:n,language:s,languages:i}),this.isHTML5){const e=this.config.captions.update?"addtrack removetrack":"removetrack";X.call(this,this.media.textTracks,e,xe.update.bind(this))}setTimeout(xe.update.bind(this),0)},update(){const e=xe.getTracks.call(this,!0),{active:t,language:i,meta:s,currentTrackNode:n}=this.captions,a=Boolean(e.find((e=>e.language===i)));this.isHTML5&&this.isVideo&&e.filter((e=>!s.get(e))).forEach((e=>{this.debug.log("Track added",e),s.set(e,{default:"showing"===e.mode}),"showing"===e.mode&&(e.mode="hidden"),X.call(this,e,"cuechange",(()=>xe.updateCues.call(this)))})),(a&&this.language!==i||!e.includes(n))&&(xe.setLanguage.call(this,i),xe.toggle.call(this,t&&a)),this.elements&&R(this.elements.container,this.config.classNames.captions.enabled,!S.empty(e)),S.array(this.config.controls)&&this.config.controls.includes("settings")&&this.config.settings.includes("captions")&&Pe.setCaptionsMenu.call(this)},toggle(e,t=!0){if(!this.supported.ui)return;const{toggled:i}=this.captions,s=this.config.classNames.captions.active,n=S.nullOrUndefined(e)?!i:e;if(n!==i){if(t||(this.captions.active=n,this.storage.set({captions:n})),!this.language&&n&&!t){const e=xe.getTracks.call(this),t=xe.findTrack.call(this,[this.captions.language,...this.captions.languages],!0);return this.captions.language=t.language,void xe.set.call(this,e.indexOf(t))}this.elements.buttons.captions&&(this.elements.buttons.captions.pressed=n),R(this.elements.container,s,n),this.captions.toggled=n,Pe.updateSetting.call(this,"captions"),Z.call(this,this.media,n?"captionsenabled":"captionsdisabled")}setTimeout((()=>{n&&this.captions.toggled&&(this.captions.currentTrackNode.mode="hidden")}))},set(e,t=!0){const i=xe.getTracks.call(this);if(-1!==e)if(S.number(e))if(e in i){if(this.captions.currentTrack!==e){this.captions.currentTrack=e;const s=i[e],{language:n}=s||{};this.captions.currentTrackNode=s,Pe.updateSetting.call(this,"captions"),t||(this.captions.language=n,this.storage.set({language:n})),this.isVimeo&&this.embed.enableTextTrack(n),Z.call(this,this.media,"languagechange")}xe.toggle.call(this,!0,t),this.isHTML5&&this.isVideo&&xe.updateCues.call(this)}else this.debug.warn("Track not found",e);else this.debug.warn("Invalid caption argument",e);else xe.toggle.call(this,!1,t)},setLanguage(e,t=!0){if(!S.string(e))return void this.debug.warn("Invalid language argument",e);const i=e.toLowerCase();this.captions.language=i;const s=xe.getTracks.call(this),n=xe.findTrack.call(this,[i]);xe.set.call(this,s.indexOf(n),t)},getTracks(e=!1){return Array.from((this.media||{}).textTracks||[]).filter((t=>!this.isHTML5||e||this.captions.meta.has(t))).filter((e=>["captions","subtitles"].includes(e.kind)))},findTrack(e,t=!1){const i=xe.getTracks.call(this),s=e=>Number((this.captions.meta.get(e)||{}).default),n=Array.from(i).sort(((e,t)=>s(t)-s(e)));let a;return e.every((e=>(a=n.find((t=>t.language===e)),!a))),a||(t?n[0]:void 0)},getCurrentTrack(){return xe.getTracks.call(this)[this.currentTrack]},getLabel(e){let t=e;return!S.track(t)&&K.textTracks&&this.captions.toggled&&(t=xe.getCurrentTrack.call(this)),S.track(t)?S.empty(t.label)?S.empty(t.language)?ve.get("enabled",this.config):e.language.toUpperCase():t.label:ve.get("disabled",this.config)},updateCues(e){if(!this.supported.ui)return;if(!S.element(this.elements.captions))return void this.debug.warn("No captions element to render to");if(!S.nullOrUndefined(e)&&!Array.isArray(e))return void this.debug.warn("updateCues: Invalid input",e);let t=e;if(!t){const e=xe.getCurrentTrack.call(this);t=Array.from((e||{}).activeCues||[]).map((e=>e.getCueAsHTML())).map(ye)}const i=t.map((e=>e.trim())).join("\n");if(i!==this.elements.captions.innerHTML){j(this.elements.captions);const e=$("span",D(this.config.selectors.caption));e.innerHTML=i,this.elements.captions.appendChild(e),Z.call(this,this.media,"cuechange")}}},Le={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:"https://cdn.plyr.io/3.7.8/plyr.svg",blankVideo:"https://cdn.plyr.io/static/blank.mp4",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/oembed.json?url={0}"},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",marker:"plyr__progress__marker",hidden:"plyr__sr-only",hideControls:"plyr--hide-controls",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"},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",hash:"data-plyr-embed-hash"}},ads:{enabled:!1,publisherId:"",tagUrl:""},previewThumbnails:{enabled:!1,src:""},vimeo:{byline:!1,portrait:!1,title:!1,speed:!0,transparent:!1,customControls:!0,referrerPolicy:null,premium:!1},youtube:{rel:0,showinfo:0,iv_load_policy:3,modestbranding:1,customControls:!0,noCookie:!1},mediaMetadata:{title:"",artist:"",album:"",artwork:[]},markers:{enabled:!1,points:[]}},Ie="picture-in-picture",$e="inline",_e={html5:"html5",youtube:"youtube",vimeo:"vimeo"},Oe="audio",je="video";const qe=()=>{};class De{constructor(e=!1){this.enabled=window.console&&e,this.enabled&&this.log("Debugging enabled")}get log(){return this.enabled?Function.prototype.bind.call(console.log,console):qe}get warn(){return this.enabled?Function.prototype.bind.call(console.warn,console):qe}get error(){return this.enabled?Function.prototype.bind.call(console.error,console):qe}}class He{constructor(t){e(this,"onChange",(()=>{if(!this.supported)return;const e=this.player.elements.buttons.fullscreen;S.element(e)&&(e.pressed=this.active);const t=this.target===this.player.media?this.target:this.player.elements.container;Z.call(this.player,t,this.active?"enterfullscreen":"exitfullscreen",!0)})),e(this,"toggleFallback",((e=!1)=>{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":"",R(this.target,this.player.config.classNames.fullscreen.fallback,e),M.isIos){let t=document.head.querySelector('meta[name="viewport"]');const i="viewport-fit=cover";t||(t=document.createElement("meta"),t.setAttribute("name","viewport"));const s=S.string(t.content)&&t.content.includes(i);e?(this.cleanupViewport=!s,s||(t.content+=`,${i}`)):this.cleanupViewport&&(t.content=t.content.split(",").filter((e=>e.trim()!==i)).join(","))}this.onChange()})),e(this,"trapFocus",(e=>{if(M.isIos||M.isIPadOS||!this.active||"Tab"!==e.key)return;const t=document.activeElement,i=U.call(this.player,"a[href], button:not(:disabled), input:not(:disabled), [tabindex]"),[s]=i,n=i[i.length-1];t!==n||e.shiftKey?t===s&&e.shiftKey&&(n.focus(),e.preventDefault()):(s.focus(),e.preventDefault())})),e(this,"update",(()=>{if(this.supported){let e;e=this.forceFallback?"Fallback (forced)":He.nativeSupported?"Native":"Fallback",this.player.debug.log(`${e} fullscreen enabled`)}else this.player.debug.log("Fullscreen not supported and fallback disabled");R(this.player.elements.container,this.player.config.classNames.fullscreen.enabled,this.supported)})),e(this,"enter",(()=>{this.supported&&(M.isIos&&this.player.config.fullscreen.iosNative?this.player.isVimeo?this.player.embed.requestFullscreen():this.target.webkitEnterFullscreen():!He.nativeSupported||this.forceFallback?this.toggleFallback(!0):this.prefix?S.empty(this.prefix)||this.target[`${this.prefix}Request${this.property}`]():this.target.requestFullscreen({navigationUI:"hide"}))})),e(this,"exit",(()=>{if(this.supported)if(M.isIos&&this.player.config.fullscreen.iosNative)this.player.isVimeo?this.player.embed.exitFullscreen():this.target.webkitEnterFullscreen(),ie(this.player.play());else if(!He.nativeSupported||this.forceFallback)this.toggleFallback(!1);else if(this.prefix){if(!S.empty(this.prefix)){const e="moz"===this.prefix?"Cancel":"Exit";document[`${this.prefix}${e}${this.property}`]()}}else(document.cancelFullScreen||document.exitFullscreen).call(document)})),e(this,"toggle",(()=>{this.active?this.exit():this.enter()})),this.player=t,this.prefix=He.prefix,this.property=He.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){const{prototype:i}=Element;return(i.closest||function(){let e=this;do{if(V.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),X.call(this.player,document,"ms"===this.prefix?"MSFullscreenChange":`${this.prefix}fullscreenchange`,(()=>{this.onChange()})),X.call(this.player,this.player.elements.container,"dblclick",(e=>{S.element(this.player.elements.controls)&&this.player.elements.controls.contains(e.target)||this.player.listeners.proxy(e,this.toggle,"fullscreen")})),X.call(this,this.player.elements.container,"keydown",(e=>this.trapFocus(e))),this.update()}static get nativeSupported(){return!!(document.fullscreenEnabled||document.webkitFullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled)}get useNative(){return He.nativeSupported&&!this.forceFallback}static get prefix(){if(S.function(document.exitFullscreen))return"";let e="";return["webkit","moz","ms"].some((t=>!(!S.function(document[`${t}ExitFullscreen`])&&!S.function(document[`${t}CancelFullScreen`]))&&(e=t,!0))),e}static get property(){return"moz"===this.prefix?"FullScreen":"Fullscreen"}get supported(){return[this.player.config.fullscreen.enabled,this.player.isVideo,He.nativeSupported||this.player.config.fullscreen.fallback,!this.player.isYouTube||He.nativeSupported||!M.isIos||this.player.config.playsinline&&!this.player.config.fullscreen.iosNative].every(Boolean)}get active(){if(!this.supported)return!1;if(!He.nativeSupported||this.forceFallback)return F(this.target,this.player.config.classNames.fullscreen.fallback);const e=this.prefix?this.target.getRootNode()[`${this.prefix}${this.property}Element`]:this.target.getRootNode().fullscreenElement;return e&&e.shadowRoot?e===this.target.getRootNode().host:e===this.target}get target(){return M.isIos&&this.player.config.fullscreen.iosNative?this.player.media:this.player.elements.fullscreen??this.player.elements.container}}function Re(e,t=1){return new Promise(((i,s)=>{const n=new Image,a=()=>{delete n.onload,delete n.onerror,(n.naturalWidth>=t?i:s)(n)};Object.assign(n,{onload:a,onerror:a,src:e})}))}const Fe={addStyleHook(){R(this.elements.container,this.config.selectors.container.replace(".",""),!0),R(this.elements.container,this.config.classNames.uiSupported,this.supported.ui)},toggleNativeControls(e=!1){e&&this.isHTML5?this.media.setAttribute("controls",""):this.media.removeAttribute("controls")},build(){if(this.listeners.media(),!this.supported.ui)return this.debug.warn(`Basic support only for ${this.provider} ${this.type}`),void Fe.toggleNativeControls.call(this,!0);S.element(this.elements.controls)||(Pe.inject.call(this),this.listeners.controls()),Fe.toggleNativeControls.call(this),this.isHTML5&&xe.setup.call(this),this.volume=null,this.muted=null,this.loop=null,this.quality=null,this.speed=null,Pe.updateVolume.call(this),Pe.timeUpdate.call(this),Pe.durationUpdate.call(this),Fe.checkPlaying.call(this),R(this.elements.container,this.config.classNames.pip.supported,K.pip&&this.isHTML5&&this.isVideo),R(this.elements.container,this.config.classNames.airplay.supported,K.airplay&&this.isHTML5),R(this.elements.container,this.config.classNames.isTouch,this.touch),this.ready=!0,setTimeout((()=>{Z.call(this,this.media,"ready")}),0),Fe.setTitle.call(this),this.poster&&Fe.setPoster.call(this,this.poster,!1).catch((()=>{})),this.config.duration&&Pe.durationUpdate.call(this),this.config.mediaMetadata&&Pe.setMediaMetadata.call(this)},setTitle(){let e=ve.get("play",this.config);if(S.string(this.config.title)&&!S.empty(this.config.title)&&(e+=`, ${this.config.title}`),Array.from(this.elements.buttons.play||[]).forEach((t=>{t.setAttribute("aria-label",e)})),this.isEmbed){const e=B.call(this,"iframe");if(!S.element(e))return;const t=S.empty(this.config.title)?"video":this.config.title,i=ve.get("frameTitle",this.config);e.setAttribute("title",i.replace("{title}",t))}},togglePoster(e){R(this.elements.container,this.config.classNames.posterEnabled,e)},setPoster(e,t=!0){return t&&this.poster?Promise.reject(new Error("Poster already set")):(this.media.setAttribute("data-poster",e),this.elements.poster.removeAttribute("hidden"),te.call(this).then((()=>Re(e))).catch((t=>{throw e===this.poster&&Fe.togglePoster.call(this,!1),t})).then((()=>{if(e!==this.poster)throw new Error("setPoster cancelled by later call to setPoster")})).then((()=>(Object.assign(this.elements.poster.style,{backgroundImage:`url('${e}')`,backgroundSize:""}),Fe.togglePoster.call(this,!0),e))))},checkPlaying(e){R(this.elements.container,this.config.classNames.playing,this.playing),R(this.elements.container,this.config.classNames.paused,this.paused),R(this.elements.container,this.config.classNames.stopped,this.stopped),Array.from(this.elements.buttons.play||[]).forEach((e=>{Object.assign(e,{pressed:this.playing}),e.setAttribute("aria-label",ve.get(this.playing?"pause":"play",this.config))})),S.event(e)&&"timeupdate"===e.type||Fe.toggleControls.call(this)},checkLoading(e){this.loading=["stalled","waiting"].includes(e.type),clearTimeout(this.timers.loading),this.timers.loading=setTimeout((()=>{R(this.elements.container,this.config.classNames.loading,this.loading),Fe.toggleControls.call(this)}),this.loading?250:0)},toggleControls(e){const{controls:t}=this.elements;if(t&&this.config.hideControls){const i=this.touch&&this.lastSeekTime+2e3>Date.now();this.toggleControls(Boolean(e||this.loading||this.paused||t.pressed||t.hover||i))}},migrateStyles(){Object.values({...this.media.style}).filter((e=>!S.empty(e)&&S.string(e)&&e.startsWith("--plyr"))).forEach((e=>{this.elements.container.style.setProperty(e,this.media.style.getPropertyValue(e)),this.media.style.removeProperty(e)})),S.empty(this.media.style)&&this.media.removeAttribute("style")}};class Ve{constructor(t){e(this,"firstTouch",(()=>{const{player:e}=this,{elements:t}=e;e.touch=!0,R(t.container,e.config.classNames.isTouch,!0)})),e(this,"global",((e=!0)=>{const{player:t}=this;t.config.keyboard.global&&Q.call(t,window,"keydown keyup",this.handleKey,e,!1),Q.call(t,document.body,"click",this.toggleMenu,e),G.call(t,document.body,"touchstart",this.firstTouch)})),e(this,"container",(()=>{const{player:e}=this,{config:t,elements:i,timers:s}=e;!t.keyboard.global&&t.keyboard.focused&&X.call(e,i.container,"keydown keyup",this.handleKey,!1),X.call(e,i.container,"mousemove mouseleave touchstart touchmove enterfullscreen exitfullscreen",(t=>{const{controls:n}=i;n&&"enterfullscreen"===t.type&&(n.pressed=!1,n.hover=!1);let a=0;["touchstart","touchmove","mousemove"].includes(t.type)&&(Fe.toggleControls.call(e,!0),a=e.touch?3e3:2e3),clearTimeout(s.controls),s.controls=setTimeout((()=>Fe.toggleControls.call(e,!1)),a)}));const n=()=>{if(!e.isVimeo||e.config.vimeo.premium)return;const t=i.wrapper,{active:s}=e.fullscreen,[n,a]=ce.call(e),l=ae(`aspect-ratio: ${n} / ${a}`);if(!s)return void(l?(t.style.width=null,t.style.height=null):(t.style.maxWidth=null,t.style.margin=null));const[r,o]=[Math.max(document.documentElement.clientWidth||0,window.innerWidth||0),Math.max(document.documentElement.clientHeight||0,window.innerHeight||0)],c=r/o>n/a;l?(t.style.width=c?"auto":"100%",t.style.height=c?"100%":"auto"):(t.style.maxWidth=c?o/a*n+"px":null,t.style.margin=c?"0 auto":null)},a=()=>{clearTimeout(s.resized),s.resized=setTimeout(n,50)};X.call(e,i.container,"enterfullscreen exitfullscreen",(t=>{const{target:s}=e.fullscreen;if(s!==i.container)return;if(!e.isEmbed&&S.empty(e.config.ratio))return;n();("enterfullscreen"===t.type?X:J).call(e,window,"resize",a)}))})),e(this,"media",(()=>{const{player:e}=this,{elements:t}=e;if(X.call(e,e.media,"timeupdate seeking seeked",(t=>Pe.timeUpdate.call(e,t))),X.call(e,e.media,"durationchange loadeddata loadedmetadata",(t=>Pe.durationUpdate.call(e,t))),X.call(e,e.media,"ended",(()=>{e.isHTML5&&e.isVideo&&e.config.resetOnEnd&&(e.restart(),e.pause())})),X.call(e,e.media,"progress playing seeking seeked",(t=>Pe.updateProgress.call(e,t))),X.call(e,e.media,"volumechange",(t=>Pe.updateVolume.call(e,t))),X.call(e,e.media,"playing play pause ended emptied timeupdate",(t=>Fe.checkPlaying.call(e,t))),X.call(e,e.media,"waiting canplay seeked playing",(t=>Fe.checkLoading.call(e,t))),e.supported.ui&&e.config.clickToPlay&&!e.isAudio){const i=B.call(e,`.${e.config.classNames.video}`);if(!S.element(i))return;X.call(e,t.container,"click",(s=>{([t.container,i].includes(s.target)||i.contains(s.target))&&(e.touch&&e.config.hideControls||(e.ended?(this.proxy(s,e.restart,"restart"),this.proxy(s,(()=>{ie(e.play())}),"play")):this.proxy(s,(()=>{ie(e.togglePlay())}),"play")))}))}e.supported.ui&&e.config.disableContextMenu&&X.call(e,t.wrapper,"contextmenu",(e=>{e.preventDefault()}),!1),X.call(e,e.media,"volumechange",(()=>{e.storage.set({volume:e.volume,muted:e.muted})})),X.call(e,e.media,"ratechange",(()=>{Pe.updateSetting.call(e,"speed"),e.storage.set({speed:e.speed})})),X.call(e,e.media,"qualitychange",(t=>{Pe.updateSetting.call(e,"quality",null,t.detail.quality)})),X.call(e,e.media,"ready qualitychange",(()=>{Pe.setDownloadUrl.call(e)}));const i=e.config.events.concat(["keyup","keydown"]).join(" ");X.call(e,e.media,i,(i=>{let{detail:s={}}=i;"error"===i.type&&(s=e.media.error),Z.call(e,t.container,i.type,!0,s)}))})),e(this,"proxy",((e,t,i)=>{const{player:s}=this,n=s.config.listeners[i];let a=!0;S.function(n)&&(a=n.call(s,e)),!1!==a&&S.function(t)&&t.call(s,e)})),e(this,"bind",((e,t,i,s,n=!0)=>{const{player:a}=this,l=a.config.listeners[s],r=S.function(l);X.call(a,e,t,(e=>this.proxy(e,i,s)),n&&!r)})),e(this,"controls",(()=>{const{player:e}=this,{elements:t}=e,i=M.isIE?"change":"input";if(t.buttons.play&&Array.from(t.buttons.play).forEach((t=>{this.bind(t,"click",(()=>{ie(e.togglePlay())}),"play")})),this.bind(t.buttons.restart,"click",e.restart,"restart"),this.bind(t.buttons.rewind,"click",(()=>{e.lastSeekTime=Date.now(),e.rewind()}),"rewind"),this.bind(t.buttons.fastForward,"click",(()=>{e.lastSeekTime=Date.now(),e.forward()}),"fastForward"),this.bind(t.buttons.mute,"click",(()=>{e.muted=!e.muted}),"mute"),this.bind(t.buttons.captions,"click",(()=>e.toggleCaptions())),this.bind(t.buttons.download,"click",(()=>{Z.call(e,e.media,"download")}),"download"),this.bind(t.buttons.fullscreen,"click",(()=>{e.fullscreen.toggle()}),"fullscreen"),this.bind(t.buttons.pip,"click",(()=>{e.pip="toggle"}),"pip"),this.bind(t.buttons.airplay,"click",e.airplay,"airplay"),this.bind(t.buttons.settings,"click",(t=>{t.stopPropagation(),t.preventDefault(),Pe.toggleMenu.call(e,t)}),null,!1),this.bind(t.buttons.settings,"keyup",(t=>{[" ","Enter"].includes(t.key)&&("Enter"!==t.key?(t.preventDefault(),t.stopPropagation(),Pe.toggleMenu.call(e,t)):Pe.focusFirstMenuItem.call(e,null,!0))}),null,!1),this.bind(t.settings.menu,"keydown",(t=>{"Escape"===t.key&&Pe.toggleMenu.call(e,t)})),this.bind(t.inputs.seek,"mousedown mousemove",(e=>{const i=t.progress.getBoundingClientRect(),s=100/i.width*(e.pageX-i.left);e.currentTarget.setAttribute("seek-value",s)})),this.bind(t.inputs.seek,"mousedown mouseup keydown keyup touchstart touchend",(t=>{const i=t.currentTarget,s="play-on-seeked";if(S.keyboardEvent(t)&&!["ArrowLeft","ArrowRight"].includes(t.key))return;e.lastSeekTime=Date.now();const n=i.hasAttribute(s),a=["mouseup","touchend","keyup"].includes(t.type);n&&a?(i.removeAttribute(s),ie(e.play())):!a&&e.playing&&(i.setAttribute(s,""),e.pause())})),M.isIos){const t=U.call(e,'input[type="range"]');Array.from(t).forEach((e=>this.bind(e,i,(e=>P(e.target)))))}this.bind(t.inputs.seek,i,(t=>{const i=t.currentTarget;let s=i.getAttribute("seek-value");S.empty(s)&&(s=i.value),i.removeAttribute("seek-value"),e.currentTime=s/i.max*e.duration}),"seek"),this.bind(t.progress,"mouseenter mouseleave mousemove",(t=>Pe.updateSeekTooltip.call(e,t))),this.bind(t.progress,"mousemove touchmove",(t=>{const{previewThumbnails:i}=e;i&&i.loaded&&i.startMove(t)})),this.bind(t.progress,"mouseleave touchend click",(()=>{const{previewThumbnails:t}=e;t&&t.loaded&&t.endMove(!1,!0)})),this.bind(t.progress,"mousedown touchstart",(t=>{const{previewThumbnails:i}=e;i&&i.loaded&&i.startScrubbing(t)})),this.bind(t.progress,"mouseup touchend",(t=>{const{previewThumbnails:i}=e;i&&i.loaded&&i.endScrubbing(t)})),M.isWebKit&&Array.from(U.call(e,'input[type="range"]')).forEach((t=>{this.bind(t,"input",(t=>Pe.updateRangeFill.call(e,t.target)))})),e.config.toggleInvert&&!S.element(t.display.duration)&&this.bind(t.display.currentTime,"click",(()=>{0!==e.currentTime&&(e.config.invertTime=!e.config.invertTime,Pe.timeUpdate.call(e))})),this.bind(t.inputs.volume,i,(t=>{e.volume=t.target.value}),"volume"),this.bind(t.controls,"mouseenter mouseleave",(i=>{t.controls.hover=!e.touch&&"mouseenter"===i.type})),t.fullscreen&&Array.from(t.fullscreen.children).filter((e=>!e.contains(t.container))).forEach((i=>{this.bind(i,"mouseenter mouseleave",(i=>{t.controls&&(t.controls.hover=!e.touch&&"mouseenter"===i.type)}))})),this.bind(t.controls,"mousedown mouseup touchstart touchend touchcancel",(e=>{t.controls.pressed=["mousedown","touchstart"].includes(e.type)})),this.bind(t.controls,"focusin",(()=>{const{config:i,timers:s}=e;R(t.controls,i.classNames.noTransition,!0),Fe.toggleControls.call(e,!0),setTimeout((()=>{R(t.controls,i.classNames.noTransition,!1)}),0);const n=this.touch?3e3:4e3;clearTimeout(s.controls),s.controls=setTimeout((()=>Fe.toggleControls.call(e,!1)),n)})),this.bind(t.inputs.volume,"wheel",(t=>{const i=t.webkitDirectionInvertedFromDevice,[s,n]=[t.deltaX,-t.deltaY].map((e=>i?-e:e)),a=Math.sign(Math.abs(s)>Math.abs(n)?s:n);e.increaseVolume(a/50);const{volume:l}=e.media;(1===a&&l<1||-1===a&&l>0)&&t.preventDefault()}),"volume",!1)})),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.firstTouch=this.firstTouch.bind(this)}handleKey(e){const{player:t}=this,{elements:i}=t,{key:s,type:n,altKey:a,ctrlKey:l,metaKey:r,shiftKey:o}=e,c="keydown"===n,u=c&&s===this.lastKey;if(a||l||r||o)return;if(!s)return;if(c){const n=document.activeElement;if(S.element(n)){const{editable:s}=t.config.selectors,{seek:a}=i.inputs;if(n!==a&&V(n,s))return;if(" "===e.key&&V(n,'button, [role^="menuitem"]'))return}switch([" ","ArrowLeft","ArrowUp","ArrowRight","ArrowDown","0","1","2","3","4","5","6","7","8","9","c","f","k","l","m"].includes(s)&&(e.preventDefault(),e.stopPropagation()),s){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":u||(h=parseInt(s,10),t.currentTime=t.duration/10*h);break;case" ":case"k":u||ie(t.togglePlay());break;case"ArrowUp":t.increaseVolume(.1);break;case"ArrowDown":t.decreaseVolume(.1);break;case"m":u||(t.muted=!t.muted);break;case"ArrowRight":t.forward();break;case"ArrowLeft":t.rewind();break;case"f":t.fullscreen.toggle();break;case"c":u||t.toggleCaptions();break;case"l":t.loop=!t.loop}"Escape"===s&&!t.fullscreen.usingNative&&t.fullscreen.active&&t.fullscreen.toggle(),this.lastKey=s}else this.lastKey=null;var h}toggleMenu(e){Pe.toggleMenu.call(this.player,e)}}"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;var Ue=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(e,t){e.exports=function(){var e=function(){},t={},i={},s={};function n(e,t){e=e.push?e:[e];var n,a,l,r=[],o=e.length,c=o;for(n=function(e,i){i.length&&r.push(e),--c||t(r)};o--;)a=e[o],(l=i[a])?n(a,l):(s[a]=s[a]||[]).push(n)}function a(e,t){if(e){var n=s[e];if(i[e]=t,n)for(;n.length;)n[0](e,t),n.splice(0,1)}}function l(t,i){t.call&&(t={success:t}),i.length?(t.error||e)(i):(t.success||e)(t)}function r(t,i,s,n){var a,l,o=document,c=s.async,u=(s.numRetries||0)+1,h=s.before||e,d=t.replace(/[\?|#].*$/,""),m=t.replace(/^(css|img)!/,"");n=n||0,/(^css!|\.css$)/.test(d)?((l=o.createElement("link")).rel="stylesheet",l.href=m,(a="hideFocus"in l)&&l.relList&&(a=0,l.rel="preload",l.as="style")):/(^img!|\.(png|gif|jpg|svg|webp)$)/.test(d)?(l=o.createElement("img")).src=m:((l=o.createElement("script")).src=t,l.async=void 0===c||c),l.onload=l.onerror=l.onbeforeload=function(e){var o=e.type[0];if(a)try{l.sheet.cssText.length||(o="e")}catch(e){18!=e.code&&(o="e")}if("e"==o){if((n+=1)<u)return r(t,i,s,n)}else if("preload"==l.rel&&"style"==l.as)return l.rel="stylesheet";i(t,o,e.defaultPrevented)},!1!==h(t,l)&&o.head.appendChild(l)}function o(e,t,i){var s,n,a=(e=e.push?e:[e]).length,l=a,o=[];for(s=function(e,i,s){if("e"==i&&o.push(e),"b"==i){if(!s)return;o.push(e)}--a||t(o)},n=0;n<l;n++)r(e[n],s,i)}function c(e,i,s){var n,r;if(i&&i.trim&&(n=i),r=(n?s:i)||{},n){if(n in t)throw"LoadJS";t[n]=!0}function c(t,i){o(e,(function(e){l(r,e),t&&l({success:t,error:i},e),a(n,e)}),r)}if(r.returnPromise)return new Promise(c);c()}return c.ready=function(e,t){return n(e,(function(e){l(t,e)})),c},c.done=function(e){a(e,[])},c.reset=function(){t={},i={},s={}},c.isDefined=function(e){return e in t},c}()}));function Be(e){return new Promise(((t,i)=>{Ue(e,{success:t,error:i})}))}function We(e){e&&!this.embed.hasPlayed&&(this.embed.hasPlayed=!0),this.media.paused===e&&(this.media.paused=!e,Z.call(this,this.media,e?"play":"pause"))}const ze={setup(){const e=this;R(e.elements.wrapper,e.config.classNames.embed,!0),e.options.speed=e.config.speed.options,ue.call(e),S.object(window.Vimeo)?ze.ready.call(e):Be(e.config.urls.vimeo.sdk).then((()=>{ze.ready.call(e)})).catch((t=>{e.debug.warn("Vimeo SDK (player.js) failed to load",t)}))},ready(){const e=this,t=e.config.vimeo,{premium:i,referrerPolicy:s,...n}=t;let a=e.media.getAttribute("src"),l="";S.empty(a)?(a=e.media.getAttribute(e.config.attributes.embed.id),l=e.media.getAttribute(e.config.attributes.embed.hash)):l=function(e){const t=e.match(/^.*(vimeo.com\/|video\/)(\d+)(\?.*&*h=|\/)+([\d,a-f]+)/);return t&&5===t.length?t[4]:null}(a);const r=l?{h:l}:{};i&&Object.assign(n,{controls:!1,sidedock:!1});const o=Ne({loop:e.config.loop.active,autoplay:e.autoplay,muted:e.muted,gesture:"media",playsinline:e.config.playsinline,...r,...n}),c=(u=a,S.empty(u)?null:S.number(Number(u))?u:u.match(/^.*(vimeo.com\/|video\/)(\d+).*/)?RegExp.$2:u);var u;const h=$("iframe"),d=me(e.config.urls.vimeo.iframe,c,o);if(h.setAttribute("src",d),h.setAttribute("allowfullscreen",""),h.setAttribute("allow",["autoplay","fullscreen","picture-in-picture","encrypted-media","accelerometer","gyroscope"].join("; ")),S.empty(s)||h.setAttribute("referrerPolicy",s),i||!t.customControls)h.setAttribute("data-poster",e.poster),e.media=q(h,e.media);else{const t=$("div",{class:e.config.classNames.embedContainer,"data-poster":e.poster});t.appendChild(h),e.media=q(t,e.media)}t.customControls||Te(me(e.config.urls.vimeo.api,d)).then((t=>{!S.empty(t)&&t.thumbnail_url&&Fe.setPoster.call(e,t.thumbnail_url).catch((()=>{}))})),e.embed=new window.Vimeo.Player(h,{autopause:e.config.autopause,muted:e.muted}),e.media.paused=!0,e.media.currentTime=0,e.supported.ui&&e.embed.disableTextTrack(),e.media.play=()=>(We.call(e,!0),e.embed.play()),e.media.pause=()=>(We.call(e,!1),e.embed.pause()),e.media.stop=()=>{e.pause(),e.currentTime=0};let{currentTime:m}=e.media;Object.defineProperty(e.media,"currentTime",{get:()=>m,set(t){const{embed:i,media:s,paused:n,volume:a}=e,l=n&&!i.hasPlayed;s.seeking=!0,Z.call(e,s,"seeking"),Promise.resolve(l&&i.setVolume(0)).then((()=>i.setCurrentTime(t))).then((()=>l&&i.pause())).then((()=>l&&i.setVolume(a))).catch((()=>{}))}});let p=e.config.speed.selected;Object.defineProperty(e.media,"playbackRate",{get:()=>p,set(t){e.embed.setPlaybackRate(t).then((()=>{p=t,Z.call(e,e.media,"ratechange")})).catch((()=>{e.options.speed=[1]}))}});let{volume:g}=e.config;Object.defineProperty(e.media,"volume",{get:()=>g,set(t){e.embed.setVolume(t).then((()=>{g=t,Z.call(e,e.media,"volumechange")}))}});let{muted:f}=e.config;Object.defineProperty(e.media,"muted",{get:()=>f,set(t){const i=!!S.boolean(t)&&t;e.embed.setMuted(!!i||e.config.muted).then((()=>{f=i,Z.call(e,e.media,"volumechange")}))}});let y,{loop:b}=e.config;Object.defineProperty(e.media,"loop",{get:()=>b,set(t){const i=S.boolean(t)?t:e.config.loop.active;e.embed.setLoop(i).then((()=>{b=i}))}}),e.embed.getVideoUrl().then((t=>{y=t,Pe.setDownloadUrl.call(e)})).catch((e=>{this.debug.warn(e)})),Object.defineProperty(e.media,"currentSrc",{get:()=>y}),Object.defineProperty(e.media,"ended",{get:()=>e.currentTime===e.duration}),Promise.all([e.embed.getVideoWidth(),e.embed.getVideoHeight()]).then((t=>{const[i,s]=t;e.embed.ratio=he(i,s),ue.call(this)})),e.embed.setAutopause(e.config.autopause).then((t=>{e.config.autopause=t})),e.embed.getVideoTitle().then((t=>{e.config.title=t,Fe.setTitle.call(this)})),e.embed.getCurrentTime().then((t=>{m=t,Z.call(e,e.media,"timeupdate")})),e.embed.getDuration().then((t=>{e.media.duration=t,Z.call(e,e.media,"durationchange")})),e.embed.getTextTracks().then((t=>{e.media.textTracks=t,xe.setup.call(e)})),e.embed.on("cuechange",(({cues:t=[]})=>{const i=t.map((e=>function(e){const t=document.createDocumentFragment(),i=document.createElement("div");return t.appendChild(i),i.innerHTML=e,t.firstChild.innerText}(e.text)));xe.updateCues.call(e,i)})),e.embed.on("loaded",(()=>{if(e.embed.getPaused().then((t=>{We.call(e,!t),t||Z.call(e,e.media,"playing")})),S.element(e.embed.element)&&e.supported.ui){e.embed.element.setAttribute("tabindex",-1)}})),e.embed.on("bufferstart",(()=>{Z.call(e,e.media,"waiting")})),e.embed.on("bufferend",(()=>{Z.call(e,e.media,"playing")})),e.embed.on("play",(()=>{We.call(e,!0),Z.call(e,e.media,"playing")})),e.embed.on("pause",(()=>{We.call(e,!1)})),e.embed.on("timeupdate",(t=>{e.media.seeking=!1,m=t.seconds,Z.call(e,e.media,"timeupdate")})),e.embed.on("progress",(t=>{e.media.buffered=t.percent,Z.call(e,e.media,"progress"),1===parseInt(t.percent,10)&&Z.call(e,e.media,"canplaythrough"),e.embed.getDuration().then((t=>{t!==e.media.duration&&(e.media.duration=t,Z.call(e,e.media,"durationchange"))}))})),e.embed.on("seeked",(()=>{e.media.seeking=!1,Z.call(e,e.media,"seeked")})),e.embed.on("ended",(()=>{e.media.paused=!0,Z.call(e,e.media,"ended")})),e.embed.on("error",(t=>{e.media.error=t,Z.call(e,e.media,"error")})),t.customControls&&setTimeout((()=>Fe.build.call(e)),0)}};function Ke(e){e&&!this.embed.hasPlayed&&(this.embed.hasPlayed=!0),this.media.paused===e&&(this.media.paused=!e,Z.call(this,this.media,e?"play":"pause"))}function Ye(e){return e.noCookie?"https://www.youtube-nocookie.com":"http:"===window.location.protocol?"http://www.youtube.com":void 0}const Qe={setup(){if(R(this.elements.wrapper,this.config.classNames.embed,!0),S.object(window.YT)&&S.function(window.YT.Player))Qe.ready.call(this);else{const e=window.onYouTubeIframeAPIReady;window.onYouTubeIframeAPIReady=()=>{S.function(e)&&e(),Qe.ready.call(this)},Be(this.config.urls.youtube.sdk).catch((e=>{this.debug.warn("YouTube API failed to load",e)}))}},getTitle(e){Te(me(this.config.urls.youtube.api,e)).then((e=>{if(S.object(e)){const{title:t,height:i,width:s}=e;this.config.title=t,Fe.setTitle.call(this),this.embed.ratio=he(s,i)}ue.call(this)})).catch((()=>{ue.call(this)}))},ready(){const e=this,t=e.config.youtube,i=e.media&&e.media.getAttribute("id");if(!S.empty(i)&&i.startsWith("youtube-"))return;let s=e.media.getAttribute("src");S.empty(s)&&(s=e.media.getAttribute(this.config.attributes.embed.id));const n=(a=s,S.empty(a)?null:a.match(/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*/)?RegExp.$2:a);var a;const l=$("div",{id:`${e.provider}-${Math.floor(1e4*Math.random())}`,"data-poster":t.customControls?e.poster:void 0});if(e.media=q(l,e.media),t.customControls){const t=e=>`https://i.ytimg.com/vi/${n}/${e}default.jpg`;Re(t("maxres"),121).catch((()=>Re(t("sd"),121))).catch((()=>Re(t("hq")))).then((t=>Fe.setPoster.call(e,t.src))).then((t=>{t.includes("maxres")||(e.elements.poster.style.backgroundSize="cover")})).catch((()=>{}))}e.embed=new window.YT.Player(e.media,{videoId:n,host:Ye(t),playerVars:x({},{autoplay:e.config.autoplay?1:0,hl:e.config.hl,controls:e.supported.ui&&t.customControls?0:1,disablekb:1,playsinline:e.config.playsinline&&!e.config.fullscreen.iosNative?1:0,cc_load_policy:e.captions.active?1:0,cc_lang_pref:e.config.captions.language,widget_referrer:window?window.location.href:null},t),events:{onError(t){if(!e.media.error){const i=t.data,s={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 occurred";e.media.error={code:i,message:s},Z.call(e,e.media,"error")}},onPlaybackRateChange(t){const i=t.target;e.media.playbackRate=i.getPlaybackRate(),Z.call(e,e.media,"ratechange")},onReady(i){if(S.function(e.media.play))return;const s=i.target;Qe.getTitle.call(e,n),e.media.play=()=>{Ke.call(e,!0),s.playVideo()},e.media.pause=()=>{Ke.call(e,!1),s.pauseVideo()},e.media.stop=()=>{s.stopVideo()},e.media.duration=s.getDuration(),e.media.paused=!0,e.media.currentTime=0,Object.defineProperty(e.media,"currentTime",{get:()=>Number(s.getCurrentTime()),set(t){e.paused&&!e.embed.hasPlayed&&e.embed.mute(),e.media.seeking=!0,Z.call(e,e.media,"seeking"),s.seekTo(t)}}),Object.defineProperty(e.media,"playbackRate",{get:()=>s.getPlaybackRate(),set(e){s.setPlaybackRate(e)}});let{volume:a}=e.config;Object.defineProperty(e.media,"volume",{get:()=>a,set(t){a=t,s.setVolume(100*a),Z.call(e,e.media,"volumechange")}});let{muted:l}=e.config;Object.defineProperty(e.media,"muted",{get:()=>l,set(t){const i=S.boolean(t)?t:l;l=i,s[i?"mute":"unMute"](),s.setVolume(100*a),Z.call(e,e.media,"volumechange")}}),Object.defineProperty(e.media,"currentSrc",{get:()=>s.getVideoUrl()}),Object.defineProperty(e.media,"ended",{get:()=>e.currentTime===e.duration});const r=s.getAvailablePlaybackRates();e.options.speed=r.filter((t=>e.config.speed.options.includes(t))),e.supported.ui&&t.customControls&&e.media.setAttribute("tabindex",-1),Z.call(e,e.media,"timeupdate"),Z.call(e,e.media,"durationchange"),clearInterval(e.timers.buffering),e.timers.buffering=setInterval((()=>{e.media.buffered=s.getVideoLoadedFraction(),(null===e.media.lastBuffered||e.media.lastBuffered<e.media.buffered)&&Z.call(e,e.media,"progress"),e.media.lastBuffered=e.media.buffered,1===e.media.buffered&&(clearInterval(e.timers.buffering),Z.call(e,e.media,"canplaythrough"))}),200),t.customControls&&setTimeout((()=>Fe.build.call(e)),50)},onStateChange(i){const s=i.target;clearInterval(e.timers.playing);switch(e.media.seeking&&[1,2].includes(i.data)&&(e.media.seeking=!1,Z.call(e,e.media,"seeked")),i.data){case-1:Z.call(e,e.media,"timeupdate"),e.media.buffered=s.getVideoLoadedFraction(),Z.call(e,e.media,"progress");break;case 0:Ke.call(e,!1),e.media.loop?(s.stopVideo(),s.playVideo()):Z.call(e,e.media,"ended");break;case 1:t.customControls&&!e.config.autoplay&&e.media.paused&&!e.embed.hasPlayed?e.media.pause():(Ke.call(e,!0),Z.call(e,e.media,"playing"),e.timers.playing=setInterval((()=>{Z.call(e,e.media,"timeupdate")}),50),e.media.duration!==s.getDuration()&&(e.media.duration=s.getDuration(),Z.call(e,e.media,"durationchange")));break;case 2:e.muted||e.embed.unMute(),Ke.call(e,!1);break;case 3:Z.call(e,e.media,"waiting")}Z.call(e,e.elements.container,"statechange",!1,{code:i.data})}}})}},Xe={setup(){this.media?(R(this.elements.container,this.config.classNames.type.replace("{0}",this.type),!0),R(this.elements.container,this.config.classNames.provider.replace("{0}",this.provider),!0),this.isEmbed&&R(this.elements.container,this.config.classNames.type.replace("{0}","video"),!0),this.isVideo&&(this.elements.wrapper=$("div",{class:this.config.classNames.video}),L(this.media,this.elements.wrapper),this.elements.poster=$("div",{class:this.config.classNames.poster}),this.elements.wrapper.appendChild(this.elements.poster)),this.isHTML5?de.setup.call(this):this.isYouTube?Qe.setup.call(this):this.isVimeo&&ze.setup.call(this)):this.debug.warn("No media element found!")}};class Je{constructor(t){e(this,"load",(()=>{this.enabled&&(S.object(window.google)&&S.object(window.google.ima)?this.ready():Be(this.player.config.urls.googleIMA.sdk).then((()=>{this.ready()})).catch((()=>{this.trigger("error",new Error("Google IMA SDK failed to load"))})))})),e(this,"ready",(()=>{var e;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((()=>{this.clearSafetyTimer("onAdsManagerLoaded()")})),this.listeners(),this.setupIMA()})),e(this,"setupIMA",(()=>{this.elements.container=$("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,(e=>this.onAdsManagerLoaded(e)),!1),this.loader.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR,(e=>this.onAdError(e)),!1),this.requestAds()})),e(this,"requestAds",(()=>{const{container:e}=this.player.elements;try{const 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)}})),e(this,"pollCountdown",((e=!1)=>{if(!e)return clearInterval(this.countdownTimer),void this.elements.container.removeAttribute("data-badge-text");this.countdownTimer=setInterval((()=>{const e=Ee(Math.max(this.manager.getRemainingTime(),0)),t=`${ve.get("advertisement",this.player.config)} - ${e}`;this.elements.container.setAttribute("data-badge-text",t)}),100)})),e(this,"onAdsManagerLoaded",(e=>{if(!this.enabled)return;const t=new google.ima.AdsRenderingSettings;t.restoreCustomPlaybackStateOnAdBreakComplete=!0,t.enablePreloading=!0,this.manager=e.getAdsManager(this.player,t),this.cuePoints=this.manager.getCuePoints(),this.manager.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR,(e=>this.onAdError(e))),Object.keys(google.ima.AdEvent.Type).forEach((e=>{this.manager.addEventListener(google.ima.AdEvent.Type[e],(e=>this.onAdEvent(e)))})),this.trigger("loaded")})),e(this,"addCuePoints",(()=>{S.empty(this.cuePoints)||this.cuePoints.forEach((e=>{if(0!==e&&-1!==e&&e<this.player.duration){const t=this.player.elements.progress;if(S.element(t)){const i=100/this.player.duration*e,s=$("span",{class:this.player.config.classNames.cues});s.style.left=`${i.toString()}%`,t.appendChild(s)}}}))})),e(this,"onAdEvent",(e=>{const{container:t}=this.player.elements,i=e.getAd(),s=e.getAdData();switch((e=>{Z.call(this.player,this.player.media,`ads${e.replace(/_/g,"").toLowerCase()}`)})(e.type),e.type){case google.ima.AdEvent.Type.LOADED:this.trigger("loaded"),this.pollCountdown(!0),i.isLinear()||(i.width=t.offsetWidth,i.height=t.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:s.adError&&this.player.debug.warn(`Non-fatal ad error: ${s.adError.getMessage()}`)}})),e(this,"onAdError",(e=>{this.cancel(),this.player.debug.warn("Ads error",e)})),e(this,"listeners",(()=>{const{container:e}=this.player.elements;let t;this.player.on("canplay",(()=>{this.addCuePoints()})),this.player.on("ended",(()=>{this.loader.contentComplete()})),this.player.on("timeupdate",(()=>{t=this.player.currentTime})),this.player.on("seeked",(()=>{const e=this.player.currentTime;S.empty(this.cuePoints)||this.cuePoints.forEach(((i,s)=>{t<i&&i<e&&(this.manager.discardAdBreak(),this.cuePoints.splice(s,1))}))})),window.addEventListener("resize",(()=>{this.manager&&this.manager.resize(e.offsetWidth,e.offsetHeight,google.ima.ViewMode.NORMAL)}))})),e(this,"play",(()=>{const{container:e}=this.player.elements;this.managerPromise||this.resumeContent(),this.managerPromise.then((()=>{this.manager.setVolume(this.player.volume),this.elements.displayContainer.initialize();try{this.initialized||(this.manager.init(e.offsetWidth,e.offsetHeight,google.ima.ViewMode.NORMAL),this.manager.start()),this.initialized=!0}catch(e){this.onAdError(e)}})).catch((()=>{}))})),e(this,"resumeContent",(()=>{this.elements.container.style.zIndex="",this.playing=!1,ie(this.player.media.play())})),e(this,"pauseContent",(()=>{this.elements.container.style.zIndex=3,this.playing=!0,this.player.media.pause()})),e(this,"cancel",(()=>{this.initialized&&this.resumeContent(),this.trigger("error"),this.loadAds()})),e(this,"loadAds",(()=>{this.managerPromise.then((()=>{this.manager&&this.manager.destroy(),this.managerPromise=new Promise((e=>{this.on("loaded",e),this.player.debug.log(this.manager)})),this.initialized=!1,this.requestAds()})).catch((()=>{}))})),e(this,"trigger",((e,...t)=>{const i=this.events[e];S.array(i)&&i.forEach((e=>{S.function(e)&&e.apply(this,t)}))})),e(this,"on",((e,t)=>(S.array(this.events[e])||(this.events[e]=[]),this.events[e].push(t),this))),e(this,"startSafetyTimer",((e,t)=>{this.player.debug.log(`Safety timer invoked from: ${t}`),this.safetyTimer=setTimeout((()=>{this.cancel(),this.clearSafetyTimer("startSafetyTimer()")}),e)})),e(this,"clearSafetyTimer",(e=>{S.nullOrUndefined(this.safetyTimer)||(this.player.debug.log(`Safety timer cleared from: ${e}`),clearTimeout(this.safetyTimer),this.safetyTimer=null)})),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(((e,t)=>{this.on("loaded",e),this.on("error",t)})),this.load()}get enabled(){const{config:e}=this;return this.player.isHTML5&&this.player.isVideo&&e.enabled&&(!S.empty(e.publisherId)||S.url(e.tagUrl))}get tagUrl(){const{config:e}=this;if(S.url(e.tagUrl))return e.tagUrl;return`https://go.aniview.com/api/adserver6/vast/?${Ne({AV_PUBLISHERID:"58c25bb0073ef448b1087ad6",AV_CHANNELID:"5a0458dc28a06145e4519d21",AV_URL:window.location.hostname,cb:Date.now(),AV_WIDTH:640,AV_HEIGHT:480,AV_CDIM2:e.publisherId})}`}}function Ge(e=0,t=0,i=255){return Math.min(Math.max(e,t),i)}const Ze=e=>{const t=[];return e.split(/\r\n\r\n|\n\n|\r\r/).forEach((e=>{const i={};e.split(/\r\n|\n|\r/).forEach((e=>{if(S.number(i.startTime)){if(!S.empty(e.trim())&&S.empty(i.text)){const t=e.trim().split("#xywh=");[i.text]=t,t[1]&&([i.x,i.y,i.w,i.h]=t[1].split(","))}}else{const t=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})/);t&&(i.startTime=60*Number(t[1]||0)*60+60*Number(t[2])+Number(t[3])+Number(`0.${t[4]}`),i.endTime=60*Number(t[6]||0)*60+60*Number(t[7])+Number(t[8])+Number(`0.${t[9]}`))}})),i.text&&t.push(i)})),t},et=(e,t)=>{const 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};class tt{constructor(t){e(this,"load",(()=>{this.player.elements.display.seekTooltip&&(this.player.elements.display.seekTooltip.hidden=this.enabled),this.enabled&&this.getThumbnails().then((()=>{this.enabled&&(this.render(),this.determineContainerAutoSizing(),this.listeners(),this.loaded=!0)}))})),e(this,"getThumbnails",(()=>new Promise((e=>{const{src:t}=this.player.config.previewThumbnails;if(S.empty(t))throw new Error("Missing previewThumbnails.src config attribute");const i=()=>{this.thumbnails.sort(((e,t)=>e.height-t.height)),this.player.debug.log("Preview thumbnails",this.thumbnails),e()};if(S.function(t))t((e=>{this.thumbnails=e,i()}));else{const e=(S.string(t)?[t]:t).map((e=>this.getThumbnail(e)));Promise.all(e).then(i)}})))),e(this,"getThumbnail",(e=>new Promise((t=>{Te(e).then((i=>{const s={frames:Ze(i),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));const n=new Image;n.onload=()=>{s.height=n.naturalHeight,s.width=n.naturalWidth,this.thumbnails.push(s),t()},n.src=s.urlPrefix+s.frames[0].text}))})))),e(this,"startMove",(e=>{if(this.loaded&&S.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,i;const s=this.player.elements.progress.getBoundingClientRect(),n=100/s.width*(e.pageX-s.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=Ee(this.seekTime);const a=null===(t=this.player.config.markers)||void 0===t||null===(i=t.points)||void 0===i?void 0:i.find((({time:e})=>e===Math.round(this.seekTime)));a&&this.elements.thumb.time.insertAdjacentHTML("afterbegin",`${a.label}<br>`)}this.showImageAtCurrentTime()}})),e(this,"endMove",(()=>{this.toggleThumbContainer(!1,!0)})),e(this,"startScrubbing",(e=>{(S.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()))})),e(this,"endScrubbing",(()=>{this.mouseDown=!1,Math.ceil(this.lastTime)===Math.ceil(this.player.media.currentTime)?this.toggleScrubbingContainer(!1):G.call(this.player,this.player.media,"timeupdate",(()=>{this.mouseDown||this.toggleScrubbingContainer(!1)}))})),e(this,"listeners",(()=>{this.player.on("play",(()=>{this.toggleThumbContainer(!1,!0)})),this.player.on("seeked",(()=>{this.toggleThumbContainer(!1)})),this.player.on("timeupdate",(()=>{this.lastTime=this.player.media.currentTime}))})),e(this,"render",(()=>{this.elements.thumb.container=$("div",{class:this.player.config.classNames.previewThumbnails.thumbContainer}),this.elements.thumb.imageContainer=$("div",{class:this.player.config.classNames.previewThumbnails.imageContainer}),this.elements.thumb.container.appendChild(this.elements.thumb.imageContainer);const e=$("div",{class:this.player.config.classNames.previewThumbnails.timeContainer});this.elements.thumb.time=$("span",{},"00:00"),e.appendChild(this.elements.thumb.time),this.elements.thumb.imageContainer.appendChild(e),S.element(this.player.elements.progress)&&this.player.elements.progress.appendChild(this.elements.thumb.container),this.elements.scrubbing.container=$("div",{class:this.player.config.classNames.previewThumbnails.scrubbingContainer}),this.player.elements.wrapper.appendChild(this.elements.scrubbing.container)})),e(this,"destroy",(()=>{this.elements.thumb.container&&this.elements.thumb.container.remove(),this.elements.scrubbing.container&&this.elements.scrubbing.container.remove()})),e(this,"showImageAtCurrentTime",(()=>{this.mouseDown?this.setScrubbingContainerSize():this.setThumbContainerSizeAndPos();const e=this.thumbnails[0].frames.findIndex((e=>this.seekTime>=e.startTime&&this.seekTime<=e.endTime)),t=e>=0;let i=0;this.mouseDown||this.toggleThumbContainer(t),t&&(this.thumbnails.forEach(((t,s)=>{this.loadedImages.includes(t.frames[e].text)&&(i=s)})),e!==this.showingThumb&&(this.showingThumb=e,this.loadImage(i)))})),e(this,"loadImage",((e=0)=>{const t=this.showingThumb,i=this.thumbnails[e],{urlPrefix:s}=i,n=i.frames[t],a=i.frames[t].text,l=s+a;if(this.currentImageElement&&this.currentImageElement.dataset.filename===a)this.showImage(this.currentImageElement,n,e,t,a,!1),this.currentImageElement.dataset.index=t,this.removeOldImages(this.currentImageElement);else{this.loadingImage&&this.usingSprites&&(this.loadingImage.onload=null);const i=new Image;i.src=l,i.dataset.index=t,i.dataset.filename=a,this.showingThumbFilename=a,this.player.debug.log(`Loading image: ${l}`),i.onload=()=>this.showImage(i,n,e,t,a,!0),this.loadingImage=i,this.removeOldImages(i)}})),e(this,"showImage",((e,t,i,s,n,a=!0)=>{this.player.debug.log(`Showing thumb: ${n}. num: ${s}. qual: ${i}. newimg: ${a}`),this.setImageSizeAndOffset(e,t),a&&(this.currentImageContainer.appendChild(e),this.currentImageElement=e,this.loadedImages.includes(n)||this.loadedImages.push(n)),this.preloadNearby(s,!0).then(this.preloadNearby(s,!1)).then(this.getHigherQuality(i,e,t,n))})),e(this,"removeOldImages",(e=>{Array.from(this.currentImageContainer.children).forEach((t=>{if("img"!==t.tagName.toLowerCase())return;const i=this.usingSprites?500:1e3;if(t.dataset.index!==e.dataset.index&&!t.dataset.deleting){t.dataset.deleting=!0;const{currentImageContainer:e}=this;setTimeout((()=>{e.removeChild(t),this.player.debug.log(`Removing thumb: ${t.dataset.filename}`)}),i)}}))})),e(this,"preloadNearby",((e,t=!0)=>new Promise((i=>{setTimeout((()=>{const s=this.thumbnails[0].frames[e].text;if(this.showingThumbFilename===s){let n;n=t?this.thumbnails[0].frames.slice(e):this.thumbnails[0].frames.slice(0,e).reverse();let a=!1;n.forEach((e=>{const t=e.text;if(t!==s&&!this.loadedImages.includes(t)){a=!0,this.player.debug.log(`Preloading thumb filename: ${t}`);const{urlPrefix:e}=this.thumbnails[0],s=e+t,n=new Image;n.src=s,n.onload=()=>{this.player.debug.log(`Preloaded thumb filename: ${t}`),this.loadedImages.includes(t)||this.loadedImages.push(t),i()}}})),a||i()}}),300)})))),e(this,"getHigherQuality",((e,t,i,s)=>{if(e<this.thumbnails.length-1){let n=t.naturalHeight;this.usingSprites&&(n=i.h),n<this.thumbContainerHeight&&setTimeout((()=>{this.showingThumbFilename===s&&(this.player.debug.log(`Showing higher quality thumb for: ${s}`),this.loadImage(e+1))}),300)}})),e(this,"toggleThumbContainer",((e=!1,t=!1)=>{const i=this.player.config.classNames.previewThumbnails.thumbContainerShown;this.elements.thumb.container.classList.toggle(i,e),!e&&t&&(this.showingThumb=null,this.showingThumbFilename=null)})),e(this,"toggleScrubbingContainer",((e=!1)=>{const t=this.player.config.classNames.previewThumbnails.scrubbingContainerShown;this.elements.scrubbing.container.classList.toggle(t,e),e||(this.showingThumb=null,this.showingThumbFilename=null)})),e(this,"determineContainerAutoSizing",(()=>{(this.elements.thumb.imageContainer.clientHeight>20||this.elements.thumb.imageContainer.clientWidth>20)&&(this.sizeSpecifiedInCSS=!0)})),e(this,"setThumbContainerSizeAndPos",(()=>{const{imageContainer:e}=this.elements.thumb;if(this.sizeSpecifiedInCSS){if(e.clientHeight>20&&e.clientWidth<20){const t=Math.floor(e.clientHeight*this.thumbAspectRatio);e.style.width=`${t}px`}else if(e.clientHeight<20&&e.clientWidth>20){const t=Math.floor(e.clientWidth/this.thumbAspectRatio);e.style.height=`${t}px`}}else{const t=Math.floor(this.thumbContainerHeight*this.thumbAspectRatio);e.style.height=`${this.thumbContainerHeight}px`,e.style.width=`${t}px`}this.setThumbContainerPos()})),e(this,"setThumbContainerPos",(()=>{const e=this.player.elements.progress.getBoundingClientRect(),t=this.player.elements.container.getBoundingClientRect(),{container:i}=this.elements.thumb,s=t.left-e.left+10,n=t.right-e.left-i.clientWidth-10,a=this.mousePosX-e.left-i.clientWidth/2,l=Ge(a,s,n);i.style.left=`${l}px`,i.style.setProperty("--preview-arrow-offset",a-l+"px")})),e(this,"setScrubbingContainerSize",(()=>{const{width:e,height:t}=et(this.thumbAspectRatio,{width:this.player.media.clientWidth,height:this.player.media.clientHeight});this.elements.scrubbing.container.style.width=`${e}px`,this.elements.scrubbing.container.style.height=`${t}px`})),e(this,"setImageSizeAndOffset",((e,t)=>{if(!this.usingSprites)return;const i=this.thumbContainerHeight/t.h;e.style.height=e.naturalHeight*i+"px",e.style.width=e.naturalWidth*i+"px",e.style.left=`-${t.x*i}px`,e.style.top=`-${t.y*i}px`})),this.player=t,this.thumbnails=[],this.loaded=!1,this.lastMouseMoveTime=Date.now(),this.mouseDown=!1,this.loadedImages=[],this.elements={thumb:{},scrubbing:{}},this.load()}get enabled(){return this.player.isHTML5&&this.player.isVideo&&this.player.config.previewThumbnails.enabled}get currentImageContainer(){return this.mouseDown?this.elements.scrubbing.container:this.elements.thumb.imageContainer}get usingSprites(){return Object.keys(this.thumbnails[0].frames[0]).includes("w")}get thumbAspectRatio(){return this.usingSprites?this.thumbnails[0].frames[0].w/this.thumbnails[0].frames[0].h:this.thumbnails[0].width/this.thumbnails[0].height}get thumbContainerHeight(){if(this.mouseDown){const{height:e}=et(this.thumbAspectRatio,{width:this.player.media.clientWidth,height:this.player.media.clientHeight});return e}return this.sizeSpecifiedInCSS?this.elements.thumb.imageContainer.clientHeight:Math.floor(this.player.media.clientWidth/this.thumbAspectRatio/4)}get currentImageElement(){return this.mouseDown?this.currentScrubbingImageElement:this.currentThumbnailImageElement}set currentImageElement(e){this.mouseDown?this.currentScrubbingImageElement=e:this.currentThumbnailImageElement=e}}const it={insertElements(e,t){S.string(t)?_(e,this.media,{src:t}):S.array(t)&&t.forEach((t=>{_(e,this.media,t)}))},change(e){N(e,"sources.length")?(de.cancelRequests.call(this),this.destroy.call(this,(()=>{this.options.quality=[],O(this.media),this.media=null,S.element(this.elements.container)&&this.elements.container.removeAttribute("class");const{sources:t,type:i}=e,[{provider:s=_e.html5,src:n}]=t,a="html5"===s?i:"div",l="html5"===s?{}:{src:n};Object.assign(this,{provider:s,type:i,supported:K.check(i,s,this.config.playsinline),media:$(a,l)}),this.elements.container.appendChild(this.media),S.boolean(e.autoplay)&&(this.config.autoplay=e.autoplay),this.isHTML5&&(this.config.crossorigin&&this.media.setAttribute("crossorigin",""),this.config.autoplay&&this.media.setAttribute("autoplay",""),S.empty(e.poster)||(this.poster=e.poster),this.config.loop.active&&this.media.setAttribute("loop",""),this.config.muted&&this.media.setAttribute("muted",""),this.config.playsinline&&this.media.setAttribute("playsinline","")),Fe.addStyleHook.call(this),this.isHTML5&&it.insertElements.call(this,"source",t),this.config.title=e.title,Xe.setup.call(this),this.isHTML5&&Object.keys(e).includes("tracks")&&it.insertElements.call(this,"track",e.tracks),(this.isHTML5||this.isEmbed&&!this.supported.ui)&&Fe.build.call(this),this.isHTML5&&this.media.load(),S.empty(e.previewThumbnails)||(Object.assign(this.config.previewThumbnails,e.previewThumbnails),this.previewThumbnails&&this.previewThumbnails.loaded&&(this.previewThumbnails.destroy(),this.previewThumbnails=null),this.config.previewThumbnails.enabled&&(this.previewThumbnails=new tt(this))),this.fullscreen.update()}),!0)):this.debug.warn("Invalid source format")}};class st{constructor(t,i){if(e(this,"play",(()=>S.function(this.media.play)?(this.ads&&this.ads.enabled&&this.ads.managerPromise.then((()=>this.ads.play())).catch((()=>ie(this.media.play()))),this.media.play()):null)),e(this,"pause",(()=>this.playing&&S.function(this.media.pause)?this.media.pause():null)),e(this,"togglePlay",(e=>(S.boolean(e)?e:!this.playing)?this.play():this.pause())),e(this,"stop",(()=>{this.isHTML5?(this.pause(),this.restart()):S.function(this.media.stop)&&this.media.stop()})),e(this,"restart",(()=>{this.currentTime=0})),e(this,"rewind",(e=>{this.currentTime-=S.number(e)?e:this.config.seekTime})),e(this,"forward",(e=>{this.currentTime+=S.number(e)?e:this.config.seekTime})),e(this,"increaseVolume",(e=>{const t=this.media.muted?0:this.volume;this.volume=t+(S.number(e)?e:0)})),e(this,"decreaseVolume",(e=>{this.increaseVolume(-e)})),e(this,"airplay",(()=>{K.airplay&&this.media.webkitShowPlaybackTargetPicker()})),e(this,"toggleControls",(e=>{if(this.supported.ui&&!this.isAudio){const t=F(this.elements.container,this.config.classNames.hideControls),i=void 0===e?void 0:!e,s=R(this.elements.container,this.config.classNames.hideControls,i);if(s&&S.array(this.config.controls)&&this.config.controls.includes("settings")&&!S.empty(this.config.settings)&&Pe.toggleMenu.call(this,!1),s!==t){const e=s?"controlshidden":"controlsshown";Z.call(this,this.media,e)}return!s}return!1})),e(this,"on",((e,t)=>{X.call(this,this.elements.container,e,t)})),e(this,"once",((e,t)=>{G.call(this,this.elements.container,e,t)})),e(this,"off",((e,t)=>{J(this.elements.container,e,t)})),e(this,"destroy",((e,t=!1)=>{if(!this.ready)return;const i=()=>{document.body.style.overflow="",this.embed=null,t?(Object.keys(this.elements).length&&(O(this.elements.buttons.play),O(this.elements.captions),O(this.elements.controls),O(this.elements.wrapper),this.elements.buttons.play=null,this.elements.captions=null,this.elements.controls=null,this.elements.wrapper=null),S.function(e)&&e()):(ee.call(this),de.cancelRequests.call(this),q(this.elements.original,this.elements.container),Z.call(this,this.elements.original,"destroyed",!0),S.function(e)&&e.call(this.elements.original),this.ready=!1,setTimeout((()=>{this.elements=null,this.media=null}),200))};this.stop(),clearTimeout(this.timers.loading),clearTimeout(this.timers.controls),clearTimeout(this.timers.resized),this.isHTML5?(Fe.toggleNativeControls.call(this,!0),i()):this.isYouTube?(clearInterval(this.timers.buffering),clearInterval(this.timers.playing),null!==this.embed&&S.function(this.embed.destroy)&&this.embed.destroy(),i()):this.isVimeo&&(null!==this.embed&&this.embed.unload().then(i),setTimeout(i,200))})),e(this,"supports",(e=>K.mime.call(this,e))),this.timers={},this.ready=!1,this.loading=!1,this.failed=!1,this.touch=K.touch,this.media=t,S.string(this.media)&&(this.media=document.querySelectorAll(this.media)),(window.jQuery&&this.media instanceof jQuery||S.nodeList(this.media)||S.array(this.media))&&(this.media=this.media[0]),this.config=x({},Le,st.defaults,i||{},(()=>{try{return JSON.parse(this.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 De(this.config.debug),this.debug.log("Config",this.config),this.debug.log("Support",K),S.nullOrUndefined(this.media)||!S.element(this.media))return void this.debug.error("Setup failed: no suitable element passed");if(this.media.plyr)return void this.debug.warn("Target already setup");if(!this.config.enabled)return void this.debug.error("Setup failed: disabled by config");if(!K.check().api)return void this.debug.error("Setup failed: no support");const s=this.media.cloneNode(!0);s.autoplay=!1,this.elements.original=s;const n=this.media.tagName.toLowerCase();let a=null,l=null;switch(n){case"div":if(a=this.media.querySelector("iframe"),S.element(a)){if(l=Me(a.getAttribute("src")),this.provider=function(e){return/^(https?:\/\/)?(www\.)?(youtube\.com|youtube-nocookie\.com|youtu\.?be)\/.+$/.test(e)?_e.youtube:/^https?:\/\/player.vimeo.com\/video\/\d{0,9}(?=\b|\/)/.test(e)?_e.vimeo:null}(l.toString()),this.elements.container=this.media,this.media=a,this.elements.container.className="",l.search.length){const e=["1","true"];e.includes(l.searchParams.get("autoplay"))&&(this.config.autoplay=!0),e.includes(l.searchParams.get("loop"))&&(this.config.loop.active=!0),this.isYouTube?(this.config.playsinline=e.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(S.empty(this.provider)||!Object.values(_e).includes(this.provider))return void this.debug.error("Setup failed: Invalid provider");this.type=je;break;case"video":case"audio":this.type=n,this.provider=_e.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=K.check(this.type,this.provider),this.supported.api?(this.eventListeners=[],this.listeners=new Ve(this),this.storage=new we(this),this.media.plyr=this,S.element(this.elements.container)||(this.elements.container=$("div"),L(this.media,this.elements.container)),Fe.migrateStyles.call(this),Fe.addStyleHook.call(this),Xe.setup.call(this),this.config.debug&&X.call(this,this.elements.container,this.config.events.join(" "),(e=>{this.debug.log(`event: ${e.type}`)})),this.fullscreen=new He(this),(this.isHTML5||this.isEmbed&&!this.supported.ui)&&Fe.build.call(this),this.listeners.container(),this.listeners.global(),this.config.ads.enabled&&(this.ads=new Je(this)),this.isHTML5&&this.config.autoplay&&this.once("canplay",(()=>ie(this.play()))),this.lastSeekTime=0,this.config.previewThumbnails.enabled&&(this.previewThumbnails=new tt(this))):this.debug.error("Setup failed: no support")}get isHTML5(){return this.provider===_e.html5}get isEmbed(){return this.isYouTube||this.isVimeo}get isYouTube(){return this.provider===_e.youtube}get isVimeo(){return this.provider===_e.vimeo}get isVideo(){return this.type===je}get isAudio(){return this.type===Oe}get playing(){return Boolean(this.ready&&!this.paused&&!this.ended)}get paused(){return Boolean(this.media.paused)}get stopped(){return Boolean(this.paused&&0===this.currentTime)}get ended(){return Boolean(this.media.ended)}set currentTime(e){if(!this.duration)return;const t=S.number(e)&&e>0;this.media.currentTime=t?Math.min(e,this.duration):0,this.debug.log(`Seeking to ${this.currentTime} seconds`)}get currentTime(){return Number(this.media.currentTime)}get buffered(){const{buffered:e}=this.media;return S.number(e)?e:e&&e.length&&this.duration>0?e.end(0)/this.duration:0}get seeking(){return Boolean(this.media.seeking)}get duration(){const e=parseFloat(this.config.duration),t=(this.media||{}).duration,i=S.number(t)&&t!==1/0?t:0;return e||i}set volume(e){let t=e;S.string(t)&&(t=Number(t)),S.number(t)||(t=this.storage.get("volume")),S.number(t)||({volume:t}=this.config),t>1&&(t=1),t<0&&(t=0),this.config.volume=t,this.media.volume=t,!S.empty(e)&&this.muted&&t>0&&(this.muted=!1)}get volume(){return Number(this.media.volume)}set muted(e){let t=e;S.boolean(t)||(t=this.storage.get("muted")),S.boolean(t)||(t=this.config.muted),this.config.muted=t,this.media.muted=t}get muted(){return Boolean(this.media.muted)}get hasAudio(){return!this.isHTML5||(!!this.isAudio||(Boolean(this.media.mozHasAudio)||Boolean(this.media.webkitAudioDecodedByteCount)||Boolean(this.media.audioTracks&&this.media.audioTracks.length)))}set speed(e){let t=null;S.number(e)&&(t=e),S.number(t)||(t=this.storage.get("speed")),S.number(t)||(t=this.config.speed.selected);const{minimumSpeed:i,maximumSpeed:s}=this;t=Ge(t,i,s),this.config.speed.selected=t,setTimeout((()=>{this.media&&(this.media.playbackRate=t)}),0)}get speed(){return Number(this.media.playbackRate)}get minimumSpeed(){return this.isYouTube?Math.min(...this.options.speed):this.isVimeo?.5:.0625}get maximumSpeed(){return this.isYouTube?Math.max(...this.options.speed):this.isVimeo?2:16}set quality(e){const t=this.config.quality,i=this.options.quality;if(!i.length)return;let s=[!S.empty(e)&&Number(e),this.storage.get("quality"),t.selected,t.default].find(S.number),n=!0;if(!i.includes(s)){const e=ne(i,s);this.debug.warn(`Unsupported quality option: ${s}, using ${e} instead`),s=e,n=!1}t.selected=s,this.media.quality=s,n&&this.storage.set({quality:s})}get quality(){return this.media.quality}set loop(e){const t=S.boolean(e)?e:this.config.loop.active;this.config.loop.active=t,this.media.loop=t}get loop(){return Boolean(this.media.loop)}set source(e){it.change.call(this,e)}get source(){return this.media.currentSrc}get download(){const{download:e}=this.config.urls;return S.url(e)?e:this.source}set download(e){S.url(e)&&(this.config.urls.download=e,Pe.setDownloadUrl.call(this))}set poster(e){this.isVideo?Fe.setPoster.call(this,e,!1).catch((()=>{})):this.debug.warn("Poster can only be set for video")}get poster(){return this.isVideo?this.media.getAttribute("poster")||this.media.getAttribute("data-poster"):null}get ratio(){if(!this.isVideo)return null;const e=oe(ce.call(this));return S.array(e)?e.join(":"):e}set ratio(e){this.isVideo?S.string(e)&&re(e)?(this.config.ratio=oe(e),ue.call(this)):this.debug.error(`Invalid aspect ratio specified (${e})`):this.debug.warn("Aspect ratio can only be set for video")}set autoplay(e){this.config.autoplay=S.boolean(e)?e:this.config.autoplay}get autoplay(){return Boolean(this.config.autoplay)}toggleCaptions(e){xe.toggle.call(this,e,!1)}set currentTrack(e){xe.set.call(this,e,!1),xe.setup.call(this)}get currentTrack(){const{toggled:e,currentTrack:t}=this.captions;return e?t:-1}set language(e){xe.setLanguage.call(this,e,!1)}get language(){return(xe.getCurrentTrack.call(this)||{}).language}set pip(e){if(!K.pip)return;const t=S.boolean(e)?e:!this.pip;S.function(this.media.webkitSetPresentationMode)&&this.media.webkitSetPresentationMode(t?Ie:$e),S.function(this.media.requestPictureInPicture)&&(!this.pip&&t?this.media.requestPictureInPicture():this.pip&&!t&&document.exitPictureInPicture())}get pip(){return K.pip?S.empty(this.media.webkitPresentationMode)?this.media===document.pictureInPictureElement:this.media.webkitPresentationMode===Ie:null}setPreviewThumbnails(e){this.previewThumbnails&&this.previewThumbnails.loaded&&(this.previewThumbnails.destroy(),this.previewThumbnails=null),Object.assign(this.config.previewThumbnails,e),this.config.previewThumbnails.enabled&&(this.previewThumbnails=new tt(this))}static supported(e,t){return K.check(e,t)}static loadSprite(e,t){return ke(e,t)}static setup(e,t={}){let i=null;return S.string(e)?i=Array.from(document.querySelectorAll(e)):S.nodeList(e)?i=Array.from(e):S.array(e)&&(i=e.filter(S.element)),S.empty(i)?null:i.map((e=>new st(e,t)))}}var nt;return st.defaults=(nt=Le,JSON.parse(JSON.stringify(nt))),st}));
//# sourceMappingURL=plyr.min.js.map 21.08.2024
ui_suite_daisyui 4.0.x-dev ::
templates/menu/menu--account.html.twig
{% for item in items %}
{{ include('ui_suite_daisyui:button', {
url: item.url.toString(),
label: item.title,
}, with_context: false) }}
{% endfor %} 15.03.2019
uppy 8.x-1.x-dev ::
js/uppy.min.js
!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).Uppy=t()}}(function(){var t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},e=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},n={limit:1,onStart:function(){},onProgress:function(){},onPartComplete:function(){},onSuccess:function(){},onError:function(t){throw t}};function r(t,e){var n=t.indexOf(e);-1!==n&&t.splice(n,1)}var o=function(){function o(t,r){!function(t,e){if(!(t instanceof o))throw new TypeError("Cannot call a class as a function")}(this),this.options=e({},n,r),this.file=t,this.key=this.options.key||null,this.uploadId=this.options.uploadId||null,this.parts=this.options.parts||[],this.isPaused=!1,this.chunks=null,this.chunkState=null,this.uploading=[],this._initChunks()}return o.prototype._initChunks=function(){for(var t=[],e=Math.max(Math.ceil(this.file.size/1e4),5242880),n=0;n<this.file.size;n+=e){var r=Math.min(this.file.size,n+e);t.push(this.file.slice(n,r))}this.chunks=t,this.chunkState=t.map(function(){return{uploaded:0,busy:!1,done:!1}})},o.prototype._createUpload=function(){var e=this;return Promise.resolve().then(function(){return e.options.createMultipartUpload()}).then(function(e){if("object"!==(void 0===e?"undefined":t(e))||!e||"string"!=typeof e.uploadId||"string"!=typeof e.key)throw new TypeError("AwsS3/Multipart: Got incorrect result from 'createMultipartUpload()', expected an object '{ uploadId, key }'.");return e}).then(function(t){e.key=t.key,e.uploadId=t.uploadId,e.options.onStart(t)}).then(function(){e._uploadParts()}).catch(function(t){e._onError(t)})},o.prototype._resumeUpload=function(){var t=this;return Promise.resolve().then(function(){return t.options.listParts({uploadId:t.uploadId,key:t.key})}).then(function(e){e.forEach(function(e){var n=e.PartNumber-1;t.chunkState[n]={uploaded:e.Size,etag:e.ETag,done:!0},t.parts.some(function(t){return t.PartNumber===e.PartNumber})||t.parts.push({PartNumber:e.PartNumber,ETag:e.ETag})}),t._uploadParts()}).catch(function(e){t._onError(e)})},o.prototype._uploadParts=function(){var t=this;if(!this.isPaused){var e=this.options.limit-this.uploading.length;if(0!==e)if(this.chunkState.every(function(t){return t.done}))this._completeUpload();else{for(var n=[],r=0;r<this.chunkState.length;r++){var o=this.chunkState[r];if(!o.done&&!o.busy&&(n.push(r),n.length>=e))break}n.forEach(function(e){t._uploadPart(e)})}}},o.prototype._uploadPart=function(e){var n=this,r=this.chunks[e];return this.chunkState[e].busy=!0,Promise.resolve().then(function(){return n.options.prepareUploadPart({key:n.key,uploadId:n.uploadId,body:r,number:e+1})}).then(function(e){if("object"!==(void 0===e?"undefined":t(e))||!e||"string"!=typeof e.url)throw new TypeError("AwsS3/Multipart: Got incorrect result from 'prepareUploadPart()', expected an object '{ url }'.");return e}).then(function(t){var r=t.url;n._uploadPartBytes(e,r)},function(t){n._onError(t)})},o.prototype._onPartProgress=function(t,e,n){this.chunkState[t].uploaded=e;var r=this.chunkState.reduce(function(t,e){return t+e.uploaded},0);this.options.onProgress(r,this.file.size)},o.prototype._onPartComplete=function(t,e){this.chunkState[t].etag=e,this.chunkState[t].done=!0;var n={PartNumber:t+1,ETag:e};this.parts.push(n),this.options.onPartComplete(n),this._uploadParts()},o.prototype._uploadPartBytes=function(t,e){var n=this,o=this.chunks[t],i=new XMLHttpRequest;i.open("PUT",e,!0),i.responseType="text",this.uploading.push(i),i.upload.addEventListener("progress",function(e){e.lengthComputable&&n._onPartProgress(t,e.loaded,e.total)}),i.addEventListener("abort",function(e){r(n.uploading,e.target),n.chunkState[t].busy=!1}),i.addEventListener("load",function(e){if(r(n.uploading,e.target),n.chunkState[t].busy=!1,e.target.status<200||e.target.status>=300)n._onError(new Error("Non 2xx"));else{n._onPartProgress(t,o.size,o.size);var i=e.target.getResponseHeader("ETag");null!==i?n._onPartComplete(t,i):n._onError(new Error("AwsS3/Multipart: Could not read the ETag header. This likely means CORS is not configured correctly on the S3 Bucket. Seee https://uppy.io/docs/aws-s3-multipart#S3-Bucket-Configuration for instructions."))}}),i.addEventListener("error",function(e){r(n.uploading,e.target),n.chunkState[t].busy=!1;var o=new Error("Unknown error");o.source=e.target,n._onError(o)}),i.send(o)},o.prototype._completeUpload=function(){var t=this;return this.parts.sort(function(t,e){return t.PartNumber-e.PartNumber}),Promise.resolve().then(function(){return t.options.completeMultipartUpload({key:t.key,uploadId:t.uploadId,parts:t.parts})}).then(function(e){t.options.onSuccess(e)},function(e){t._onError(e)})},o.prototype._abortUpload=function(){this.uploading.slice().forEach(function(t){t.abort()}),this.options.abortMultipartUpload({key:this.key,uploadId:this.uploadId}),this.uploading=[]},o.prototype._onError=function(t){this.options.onError(t)},o.prototype.start=function(){this.isPaused=!1,this.uploadId?this._resumeUpload():this._createUpload()},o.prototype.pause=function(){this.uploading.slice().forEach(function(t){t.abort()}),this.isPaused=!0},o.prototype.abort=function(){if(!(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).really)return this.pause();this._abortUpload()},o}(),i=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},s=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),a=function(){function t(e,n){!function(e,n){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this),this.uppy=e,this.opts=n,this.onReceiveResponse=this.onReceiveResponse.bind(this)}return t.prototype.onReceiveResponse=function(t){var e,n=this.uppy.getState().companion||{},r=this.opts.serverUrl,o=t.headers;return o.has("i-am")&&o.get("i-am")!==n[r]&&this.uppy.setState({companion:i({},n,(e={},e[r]=o.get("i-am"),e))}),t},t.prototype._getUrl=function(t){return/^(https?:|)\/\//.test(t)?t:this.hostname+"/"+t},t.prototype.get=function(t){var e=this;return fetch(this._getUrl(t),{method:"get",headers:this.headers,credentials:"same-origin"}).then(this.onReceiveResponse).then(function(t){return t.json()}).catch(function(n){throw new Error("Could not get "+e._getUrl(t)+". "+n)})},t.prototype.post=function(t,e){var n=this;return fetch(this._getUrl(t),{method:"post",headers:this.headers,credentials:"same-origin",body:JSON.stringify(e)}).then(this.onReceiveResponse).then(function(e){if(e.status<200||e.status>300)throw new Error("Could not post "+n._getUrl(t)+". "+e.statusText);return e.json()}).catch(function(e){throw new Error("Could not post "+n._getUrl(t)+". "+e)})},t.prototype.delete=function(t,e){var n=this;return fetch(this.hostname+"/"+t,{method:"delete",headers:this.headers,credentials:"same-origin",body:e?JSON.stringify(e):null}).then(this.onReceiveResponse).then(function(t){return t.json()}).catch(function(e){throw new Error("Could not delete "+n._getUrl(t)+". "+e)})},s(t,[{key:"hostname",get:function(){var t=this.uppy.getState().companion,e=this.opts.serverUrl;return(t&&t[e]?t[e]:e).replace(/\/$/,"")}},{key:"defaultHeaders",get:function(){return{Accept:"application/json","Content-Type":"application/json"}}},{key:"headers",get:function(){return i({},this.defaultHeaders,this.opts.serverHeaders||{})}}]),t}(),l=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},u=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),p=function(t){return t.split("-").map(function(t){return t.charAt(0).toUpperCase()+t.slice(1)}).join(" ")},c=function(t){function e(n,r){!function(t,n){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this);var o=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.call(this,n,r));return o.provider=r.provider,o.id=o.provider,o.authProvider=r.authProvider||o.provider,o.name=o.opts.name||p(o.id),o.tokenKey="companion-"+o.id+"-auth-token",o}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.setAuthToken=function(t){localStorage.setItem(this.tokenKey,t)},e.prototype.checkAuth=function(){return this.get(this.id+"/authorized").then(function(t){return t.authenticated})},e.prototype.authUrl=function(){return this.hostname+"/"+this.id+"/connect"},e.prototype.fileUrl=function(t){return this.hostname+"/"+this.id+"/get/"+t},e.prototype.list=function(t){return this.get(this.id+"/list/"+(t||""))},e.prototype.logout=function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:location.href;return this.get(this.id+"/logout?redirect="+e).then(function(e){return localStorage.removeItem(t.tokenKey),e})},e.initPlugin=function(t,e,n){if(t.type="acquirer",t.files=[],n&&(t.opts=l({},n,e)),e.serverPattern){var r=e.serverPattern;if(!("string"==typeof r||Array.isArray(r)||r instanceof RegExp))throw new TypeError(t.id+': the option "serverPattern" must be one of string, Array, RegExp');t.opts.serverPattern=r}else/^(?!https?:\/\/).*$/.test(e.serverUrl)?t.opts.serverPattern=location.protocol+"//"+e.serverUrl.replace(/^\/\//,""):t.opts.serverPattern=e.serverUrl},u(e,[{key:"defaultHeaders",get:function(){return l({},t.prototype.defaultHeaders,{"uppy-auth-token":localStorage.getItem(this.tokenKey)})}}]),e}(a),h=function(){var t={},e=t._fns={};return t.emit=function(t,n,r,o,i,s,a){var l=function(t){for(var n=e[t]?e[t]:[],r=t.indexOf(":"),o=-1===r?[t]:[t.substring(0,r),t.substring(r+1)],i=Object.keys(e),s=0,a=i.length;s<a;s++){var l=i[s];if("*"===l&&(n=n.concat(e[l])),2===o.length&&o[0]===l){n=n.concat(e[l]);break}}return n}(t);l.length&&function(t,e,n){for(var r=0,o=e.length;r<o&&e[r];r++)e[r].event=t,e[r].apply(e[r],n)}(t,l,[n,r,o,i,s,a])},t.on=function(t,n){e[t]||(e[t]=[]),e[t].push(n)},t.once=function(e,n){this.on(e,function r(){n.apply(this,arguments),t.off(e,r)})},t.off=function(t,e){var n=[];if(t&&e)for(var r=this._fns[t],o=0,i=r?r.length:0;o<i;o++)r[o]!==e&&n.push(r[o]);n.length?this._fns[t]=n:delete this._fns[t]},t},d={RequestClient:a,Provider:c,Socket:function(){function t(e){var n=this;!function(e,n){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this),this.queued=[],this.isOpen=!1,this.socket=new WebSocket(e.target),this.emitter=h(),this.socket.onopen=function(t){for(n.isOpen=!0;n.queued.length>0&&n.isOpen;){var e=n.queued[0];n.send(e.action,e.payload),n.queued=n.queued.slice(1)}},this.socket.onclose=function(t){n.isOpen=!1},this._handleMessage=this._handleMessage.bind(this),this.socket.onmessage=this._handleMessage,this.close=this.close.bind(this),this.emit=this.emit.bind(this),this.on=this.on.bind(this),this.once=this.once.bind(this),this.send=this.send.bind(this)}return t.prototype.close=function(){return this.socket.close()},t.prototype.send=function(t,e){this.isOpen?this.socket.send(JSON.stringify({action:t,payload:e})):this.queued.push({action:t,payload:e})},t.prototype.on=function(t,e){this.emitter.on(t,e)},t.prototype.emit=function(t,e){this.emitter.emit(t,e)},t.prototype.once=function(t,e){this.emitter.once(t,e)},t.prototype._handleMessage=function(t){try{var e=JSON.parse(t.data);this.emit(e.action,e.payload)}catch(t){console.log(t)}},t}()},f=function(t,e){var n="000000000"+t;return n.substr(n.length-e)},y="object"==typeof window?window:self,g=Object.keys(y).length,m=f(((navigator.mimeTypes?navigator.mimeTypes.length:0)+navigator.userAgent.length).toString(36)+g.toString(36),4),v=function(){return m},b={},w=0,S=4,_=36,P=Math.pow(_,S);function E(){return f((Math.random()*P<<0).toString(_),S)}function k(){return w=w<P?w:0,++w-1}function C(){return"c"+(new Date).getTime().toString(_)+f(k().toString(_),S)+v()+(E()+E())}C.slug=function(){var t=(new Date).getTime().toString(36),e=k().toString(36).slice(-4),n=v().slice(0,1)+v().slice(-1),r=E().slice(-2);return t.slice(-2)+e+n+r},C.isCuid=function(t){return"string"==typeof t&&!!t.startsWith("c")},C.isSlug=function(t){if("string"!=typeof t)return!1;var e=t.length;return e>=7&&e<=10},C.fingerprint=v,b=C;var T={};function O(t,e){this.text=t=t||"",this.hasWild=~t.indexOf("*"),this.separator=e,this.parts=t.split(e)}O.prototype.match=function(t){var e,n,r=!0,o=this.parts,i=o.length;if("string"==typeof t||t instanceof String)if(this.hasWild||this.text==t){for(n=(t||"").split(this.separator),e=0;r&&e<i;e++)"*"!==o[e]&&(r=e<n.length&&o[e]===n[e]);r=r&&n}else r=!1;else if("function"==typeof t.splice)for(r=[],e=t.length;e--;)this.match(t[e])&&(r[r.length]=t[e]);else if("object"==typeof t)for(var s in r={},t)this.match(s)&&(r[s]=t[s]);return r},T=function(t,e,n){var r=new O(t,n||/[\/\.]/);return void 0!==e?r.match(e):r};var U=/[\/\+\.]/,F=function(t){if("number"!=typeof t||isNaN(t))throw new TypeError("Expected a number, got "+typeof t);var e=t<0,n=["B","KB","MB","GB","TB","PB","EB","ZB","YB"];if(e&&(t=-t),t<1)return(e?"-":"")+t+" B";var r=Math.min(Math.floor(Math.log(t)/Math.log(1e3)),n.length-1);t=Number(t/Math.pow(1e3,r));var o=n[r];return t>=10||t%1==0?(e?"-":"")+t.toFixed(0)+" "+o:(e?"-":"")+t.toFixed(1)+" "+o},A={exports:{}};!function(){"use strict";function t(t,e){var n,r,o,i,s=_;for(i=arguments.length;i-- >2;)S.push(arguments[i]);for(e&&null!=e.children&&(S.length||S.push(e.children),delete e.children);S.length;)if((r=S.pop())&&void 0!==r.pop)for(i=r.length;i--;)S.push(r[i]);else"boolean"==typeof r&&(r=null),(o="function"!=typeof t)&&(null==r?r="":"number"==typeof r?r=String(r):"string"!=typeof r&&(o=!1)),o&&n?s[s.length-1]+=r:s===_?s=[r]:s.push(r),n=o;var a=new b;return a.nodeName=t,a.children=s,a.attributes=null==e?void 0:e,a.key=null==e?void 0:e.key,void 0!==w.vnode&&w.vnode(a),a}function e(t,e){for(var n in e)t[n]=e[n];return t}function n(t){!t.__d&&(t.__d=!0)&&1==k.push(t)&&(w.debounceRendering||P)(r)}function r(){var t,e=k;for(k=[];t=e.pop();)t.__d&&g(t)}function o(t,e){return t.__n===e||t.nodeName.toLowerCase()===e.toLowerCase()}function i(t){var n=e({},t.attributes);n.children=t.children;var r=t.nodeName.defaultProps;if(void 0!==r)for(var o in r)void 0===n[o]&&(n[o]=r[o]);return n}function s(t){var e=t.parentNode;e&&e.removeChild(t)}function a(t,e,n,r,o){if("className"===e&&(e="class"),"key"===e);else if("ref"===e)n&&n(null),r&&r(t);else if("class"!==e||o)if("style"===e){if(r&&"string"!=typeof r&&"string"!=typeof n||(t.style.cssText=r||""),r&&"object"==typeof r){if("string"!=typeof n)for(var i in n)i in r||(t.style[i]="");for(var i in r)t.style[i]="number"==typeof r[i]&&!1===E.test(i)?r[i]+"px":r[i]}}else if("dangerouslySetInnerHTML"===e)r&&(t.innerHTML=r.__html||"");else if("o"==e[0]&&"n"==e[1]){var s=e!==(e=e.replace(/Capture$/,""));e=e.toLowerCase().substring(2),r?n||t.addEventListener(e,l,s):t.removeEventListener(e,l,s),(t.__l||(t.__l={}))[e]=r}else if("list"!==e&&"type"!==e&&!o&&e in t){try{t[e]=null==r?"":r}catch(t){}null!=r&&!1!==r||"spellcheck"==e||t.removeAttribute(e)}else{var a=o&&e!==(e=e.replace(/^xlink:?/,""));null==r||!1===r?a?t.removeAttributeNS("http://www.w3.org/1999/xlink",e.toLowerCase()):t.removeAttribute(e):"function"!=typeof r&&(a?t.setAttributeNS("http://www.w3.org/1999/xlink",e.toLowerCase(),r):t.setAttribute(e,r))}else t.className=r||""}function l(t){return this.__l[t.type](w.event&&w.event(t)||t)}function u(){for(var t;t=C.pop();)w.afterMount&&w.afterMount(t),t.componentDidMount&&t.componentDidMount()}function p(t,e,n,r,l,p){T++||(O=null!=l&&void 0!==l.ownerSVGElement,U=null!=t&&!("__preactattr_"in t));var h=function t(e,n,r,l,u){var p=e,h=O;if(null!=n&&"boolean"!=typeof n||(n=""),"string"==typeof n||"number"==typeof n)return e&&void 0!==e.splitText&&e.parentNode&&(!e._component||u)?e.nodeValue!=n&&(e.nodeValue=n):(p=document.createTextNode(n),e&&(e.parentNode&&e.parentNode.replaceChild(p,e),c(e,!0))),p.__preactattr_=!0,p;var f,g,v=n.nodeName;if("function"==typeof v)return function(t,e,n,r){for(var o=t&&t._component,s=o,a=t,l=o&&t._componentConstructor===e.nodeName,u=l,p=i(e);o&&!u&&(o=o.__u);)u=o.constructor===e.nodeName;return o&&u&&(!r||o._component)?(y(o,p,3,n,r),t=o.base):(s&&!l&&(m(s),t=a=null),o=d(e.nodeName,p,n),t&&!o.__b&&(o.__b=t,a=null),y(o,p,1,n,r),t=o.base,a&&t!==a&&(a._component=null,c(a,!1))),t}(e,n,r,l);if(O="svg"===v||"foreignObject"!==v&&O,v=String(v),(!e||!o(e,v))&&(f=v,(g=O?document.createElementNS("http://www.w3.org/2000/svg",f):document.createElement(f)).__n=f,p=g,e)){for(;e.firstChild;)p.appendChild(e.firstChild);e.parentNode&&e.parentNode.replaceChild(p,e),c(e,!0)}var b=p.firstChild,w=p.__preactattr_,S=n.children;if(null==w){w=p.__preactattr_={};for(var _=p.attributes,P=_.length;P--;)w[_[P].name]=_[P].value}return!U&&S&&1===S.length&&"string"==typeof S[0]&&null!=b&&void 0!==b.splitText&&null==b.nextSibling?b.nodeValue!=S[0]&&(b.nodeValue=S[0]):(S&&S.length||null!=b)&&function(e,n,r,i,a){var l,u,p,h,d,f,y,g,m=e.childNodes,v=[],b={},w=0,S=0,_=m.length,P=0,E=n?n.length:0;if(0!==_)for(var k=0;k<_;k++){var C=m[k],T=C.__preactattr_,O=E&&T?C._component?C._component.__k:T.key:null;null!=O?(w++,b[O]=C):(T||(void 0!==C.splitText?!a||C.nodeValue.trim():a))&&(v[P++]=C)}if(0!==E)for(var k=0;k<E;k++){h=n[k],d=null;var O=h.key;if(null!=O)w&&void 0!==b[O]&&(d=b[O],b[O]=void 0,w--);else if(S<P)for(l=S;l<P;l++)if(void 0!==v[l]&&(f=u=v[l],g=a,"string"==typeof(y=h)||"number"==typeof y?void 0!==f.splitText:"string"==typeof y.nodeName?!f._componentConstructor&&o(f,y.nodeName):g||f._componentConstructor===y.nodeName)){d=u,v[l]=void 0,l===P-1&&P--,l===S&&S++;break}d=t(d,h,r,i),p=m[k],d&&d!==e&&d!==p&&(null==p?e.appendChild(d):d===p.nextSibling?s(p):e.insertBefore(d,p))}if(w)for(var k in b)void 0!==b[k]&&c(b[k],!1);for(;S<=P;)void 0!==(d=v[P--])&&c(d,!1)}(p,S,r,l,U||null!=w.dangerouslySetInnerHTML),function(t,e,n){var r;for(r in n)e&&null!=e[r]||null==n[r]||a(t,r,n[r],n[r]=void 0,O);for(r in e)"children"===r||"innerHTML"===r||r in n&&e[r]===("value"===r||"checked"===r?t[r]:n[r])||a(t,r,n[r],n[r]=e[r],O)}(p,n.attributes,w),O=h,p}(t,e,n,r,p);return l&&h.parentNode!==l&&l.appendChild(h),--T||(U=!1,p||u()),h}function c(t,e){var n=t._component;n?m(n):(null!=t.__preactattr_&&t.__preactattr_.ref&&t.__preactattr_.ref(null),!1!==e&&null!=t.__preactattr_||s(t),h(t))}function h(t){for(t=t.lastChild;t;){var e=t.previousSibling;c(t,!0),t=e}}function d(t,e,n){var r,o=F.length;for(t.prototype&&t.prototype.render?(r=new t(e,n),v.call(r,e,n)):((r=new v(e,n)).constructor=t,r.render=f);o--;)if(F[o].constructor===t)return r.__b=F[o].__b,F.splice(o,1),r;return r}function f(t,e,n){return this.constructor(t,n)}function y(t,e,r,o,i){t.__x||(t.__x=!0,t.__r=e.ref,t.__k=e.key,delete e.ref,delete e.key,void 0===t.constructor.getDerivedStateFromProps&&(!t.base||i?t.componentWillMount&&t.componentWillMount():t.componentWillReceiveProps&&t.componentWillReceiveProps(e,o)),o&&o!==t.context&&(t.__c||(t.__c=t.context),t.context=o),t.__p||(t.__p=t.props),t.props=e,t.__x=!1,0!==r&&(1!==r&&!1===w.syncComponentUpdates&&t.base?n(t):g(t,1,i)),t.__r&&t.__r(t))}function g(t,n,r,o){if(!t.__x){var s,a,l,h=t.props,f=t.state,v=t.context,b=t.__p||h,S=t.__s||f,_=t.__c||v,P=t.base,E=t.__b,k=P||E,O=t._component,U=!1,F=_;if(t.constructor.getDerivedStateFromProps&&(f=e(e({},f),t.constructor.getDerivedStateFromProps(h,f)),t.state=f),P&&(t.props=b,t.state=S,t.context=_,2!==n&&t.shouldComponentUpdate&&!1===t.shouldComponentUpdate(h,f,v)?U=!0:t.componentWillUpdate&&t.componentWillUpdate(h,f,v),t.props=h,t.state=f,t.context=v),t.__p=t.__s=t.__c=t.__b=null,t.__d=!1,!U){s=t.render(h,f,v),t.getChildContext&&(v=e(e({},v),t.getChildContext())),P&&t.getSnapshotBeforeUpdate&&(F=t.getSnapshotBeforeUpdate(b,S));var A,x,D=s&&s.nodeName;if("function"==typeof D){var R=i(s);(a=O)&&a.constructor===D&&R.key==a.__k?y(a,R,1,v,!1):(A=a,t._component=a=d(D,R,v),a.__b=a.__b||E,a.__u=t,y(a,R,0,v,!1),g(a,1,r,!0)),x=a.base}else l=k,(A=O)&&(l=t._component=null),(k||1===n)&&(l&&(l._component=null),x=p(l,s,v,r||!P,k&&k.parentNode,!0));if(k&&x!==k&&a!==O){var I=k.parentNode;I&&x!==I&&(I.replaceChild(x,k),A||(k._component=null,c(k,!1)))}if(A&&m(A),t.base=x,x&&!o){for(var B=t,j=t;j=j.__u;)(B=j).base=x;x._component=B,x._componentConstructor=B.constructor}}for(!P||r?C.unshift(t):U||(t.componentDidUpdate&&t.componentDidUpdate(b,S,F),w.afterUpdate&&w.afterUpdate(t));t.__h.length;)t.__h.pop().call(t);T||o||u()}}function m(t){w.beforeUnmount&&w.beforeUnmount(t);var e=t.base;t.__x=!0,t.componentWillUnmount&&t.componentWillUnmount(),t.base=null;var n=t._component;n?m(n):e&&(e.__preactattr_&&e.__preactattr_.ref&&e.__preactattr_.ref(null),t.__b=e,s(e),F.push(t),h(e)),t.__r&&t.__r(null)}function v(t,e){this.__d=!0,this.context=e,this.props=t,this.state=this.state||{},this.__h=[]}var b=function(){},w={},S=[],_=[],P="function"==typeof Promise?Promise.resolve().then.bind(Promise.resolve()):setTimeout,E=/acit|ex(?:s|g|n|p|$)|rph|ows|mnc|ntw|ine[ch]|zoo|^ord/i,k=[],C=[],T=0,O=!1,U=!1,F=[];e(v.prototype,{setState:function(t,r){this.__s||(this.__s=this.state),this.state=e(e({},this.state),"function"==typeof t?t(this.state,this.props):t),r&&this.__h.push(r),n(this)},forceUpdate:function(t){t&&this.__h.push(t),g(this,2)},render:function(){}});var x={h:t,createElement:t,cloneElement:function(n,r){return t(n.nodeName,e(e({},n.attributes),r),arguments.length>2?[].slice.call(arguments,2):n.children)},Component:v,render:function(t,e,n){return p(n,t,{},!1,e,!1)},rerender:r,options:w};A.exports=x}(),A=A.exports;var x="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},D=function(t){return t&&"object"===(void 0===t?"undefined":x(t))&&t.nodeType===Node.ELEMENT_NODE},R="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},I=function(t){return"string"==typeof t?document.querySelector(t):"object"===(void 0===t?"undefined":R(t))&&D(t)?t:void 0},B="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},j=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},L=function(){function t(e,n){!function(e,n){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this),this.uppy=e,this.opts=n||{},this.update=this.update.bind(this),this.mount=this.mount.bind(this),this.install=this.install.bind(this),this.uninstall=this.uninstall.bind(this)}return t.prototype.getPluginState=function(){return this.uppy.getState().plugins[this.id]||{}},t.prototype.setPluginState=function(t){var e,n=this.uppy.getState().plugins;this.uppy.setState({plugins:j({},n,(e={},e[this.id]=j({},n[this.id],t),e))})},t.prototype.update=function(t){void 0!==this.el&&this._updateUI&&this._updateUI(t)},t.prototype.onMount=function(){},t.prototype.mount=function(e,n){var r,o,i,s=this,a=n.id,l=I(e);if(l)return this.isTargetDOMEl=!0,this.rerender=function(t){s.uppy.getPlugin(s.id)&&(s.el=A.render(s.render(t),l,s.el))},this._updateUI=(r=this.rerender,o=null,i=null,function(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];return i=e,o||(o=Promise.resolve().then(function(){return o=null,r.apply(void 0,i)})),o}),this.uppy.log("Installing "+a+" to a DOM element"),this.opts.replaceTargetContent&&(l.innerHTML=""),this.el=A.render(this.render(this.uppy.getState()),l),this.onMount(),this.el;var u=void 0;if("object"===(void 0===e?"undefined":B(e))&&e instanceof t)u=e;else if("function"==typeof e){var p=e;this.uppy.iteratePlugins(function(t){if(t instanceof p)return u=t,!1})}if(u)return this.uppy.log("Installing "+a+" to "+u.id),this.parent=u,this.el=u.addTarget(n),this.onMount(),this.el;throw this.uppy.log("Not installing "+a),new Error("Invalid target option given to "+a+". Please make sure that the element \n exists on the page, or that the plugin you are targeting has been installed. Check that the <script> tag initializing Uppy \n comes at the bottom of the page, before the closing </body> tag (see https://github.com/transloadit/uppy/issues/1042).")},t.prototype.render=function(t){throw new Error("Extend the render method to add your plugin to a DOM element")},t.prototype.addTarget=function(t){throw new Error("Extend the addTarget method to add your plugin to another plugin's target")},t.prototype.unmount=function(){this.isTargetDOMEl&&this.el&&this.el.parentNode&&this.el.parentNode.removeChild(this.el)},t.prototype.install=function(){},t.prototype.uninstall=function(){this.unmount()},t}(),M=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},N=function(){function t(){!function(e,n){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this),this.state={},this.callbacks=[]}return t.prototype.getState=function(){return this.state},t.prototype.setState=function(t){var e=M({},this.state),n=M({},this.state,t);this.state=n,this._publish(e,n,t)},t.prototype.subscribe=function(t){var e=this;return this.callbacks.push(t),function(){e.callbacks.splice(e.callbacks.indexOf(t),1)}},t.prototype._publish=function(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];this.callbacks.forEach(function(t){t.apply(void 0,e)})},t}(),z=function(){return new N},q=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},H=function(){function t(e){!function(e,n){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this);var n={locale:{strings:{},pluralize:function(t){return 1===t?0:1}}};this.opts=q({},n,e),this.locale=q({},n.locale,e.locale)}return t.prototype.interpolate=function(t,e){var n=String.prototype,r=n.split,o=n.replace,i=/\$/g,s=[t];for(var a in e)if("_"!==a&&e.hasOwnProperty(a)){var l=e[a];"string"==typeof l&&(l=o.call(e[a],i,"$$$$")),s=u(s,new RegExp("%\\{"+a+"\\}","g"),l)}return s;function u(t,e,n){var o=[];return t.forEach(function(t){r.call(t,e).forEach(function(t,e,r){""!==t&&o.push(t),e<r.length-1&&o.push(n)})}),o}},t.prototype.translate=function(t,e){return this.translateArray(t,e).join("")},t.prototype.translateArray=function(t,e){if(e&&void 0!==e.smart_count){var n=this.locale.pluralize(e.smart_count);return this.interpolate(this.opts.locale.strings[t][n],e)}return this.interpolate(this.opts.locale.strings[t],e)},t}(),W=function(t){return["uppy",t.name?t.name.toLowerCase().replace(/[^A-Z0-9]/gi,""):"",t.type,t.data.size,t.data.lastModified].filter(function(t){return t}).join("-")},X=function(t){var e=/(?:\.([^.]+))?$/.exec(t)[1];return{name:t.replace("."+e,""),extension:e}},V={md:"text/markdown",markdown:"text/markdown",mp4:"video/mp4",mp3:"audio/mp3",svg:"image/svg+xml",jpg:"image/jpeg",png:"image/png",gif:"image/gif",yaml:"text/yaml",yml:"text/yaml",csv:"text/csv",avi:"video/x-msvideo",mks:"video/x-matroska",mkv:"video/x-matroska",mov:"video/quicktime",doc:"application/msword",docm:"application/vnd.ms-word.document.macroenabled.12",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",dot:"application/msword",dotm:"application/vnd.ms-word.template.macroenabled.12",dotx:"application/vnd.openxmlformats-officedocument.wordprocessingml.template",xla:"application/vnd.ms-excel",xlam:"application/vnd.ms-excel.addin.macroenabled.12",xlc:"application/vnd.ms-excel",xlf:"application/x-xliff+xml",xlm:"application/vnd.ms-excel",xls:"application/vnd.ms-excel",xlsb:"application/vnd.ms-excel.sheet.binary.macroenabled.12",xlsm:"application/vnd.ms-excel.sheet.macroenabled.12",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",xlt:"application/vnd.ms-excel",xltm:"application/vnd.ms-excel.template.macroenabled.12",xltx:"application/vnd.openxmlformats-officedocument.spreadsheetml.template",xlw:"application/vnd.ms-excel"},G=function(t){var e=t.name?X(t.name).extension:null;return t.isRemote?t.type?t.type:V[e]:t.type?t.type:e&&V[e]?V[e]:"application/octet-stream"};function K(t){return 2!==t.length?0+t:t}var Y,J=function(){var t=new Date;return K(t.getHours().toString())+":"+K(t.getMinutes().toString())+":"+K(t.getSeconds().toString())},$="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Q=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Z=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),tt=function(){function t(e){var n=this;!function(e,n){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this);var r={strings:{youCanOnlyUploadX:{0:"You can only upload %{smart_count} file",1:"You can only upload %{smart_count} files"},youHaveToAtLeastSelectX:{0:"You have to select at least %{smart_count} file",1:"You have to select at least %{smart_count} files"},exceedsSize:"This file exceeds maximum allowed size of",youCanOnlyUploadFileTypes:"You can only upload:",companionError:"Connection with Companion failed",failedToUpload:"Failed to upload %{file}",noInternetConnection:"No Internet connection",connectedToInternet:"Connected to the Internet",noFilesFound:"You have no files or folders here",selectXFiles:{0:"Select %{smart_count} file",1:"Select %{smart_count} files"},cancel:"Cancel",logOut:"Log out"}},o={id:"uppy",autoProceed:!1,debug:!1,restrictions:{maxFileSize:null,maxNumberOfFiles:null,minNumberOfFiles:null,allowedFileTypes:null},meta:{},onBeforeFileAdded:function(t,e){return t},onBeforeUpload:function(t){return t},locale:r,store:z()};this.opts=Q({},o,e),this.opts.restrictions=Q({},o.restrictions,this.opts.restrictions),this.locale=Q({},r,this.opts.locale),this.locale.strings=Q({},r.strings,this.opts.locale.strings),this.translator=new H({locale:this.locale}),this.i18n=this.translator.translate.bind(this.translator),this.plugins={},this.getState=this.getState.bind(this),this.getPlugin=this.getPlugin.bind(this),this.setFileMeta=this.setFileMeta.bind(this),this.setFileState=this.setFileState.bind(this),this.log=this.log.bind(this),this.info=this.info.bind(this),this.hideInfo=this.hideInfo.bind(this),this.addFile=this.addFile.bind(this),this.removeFile=this.removeFile.bind(this),this.pauseResume=this.pauseResume.bind(this),this._calculateProgress=this._calculateProgress.bind(this),this.updateOnlineStatus=this.updateOnlineStatus.bind(this),this.resetProgress=this.resetProgress.bind(this),this.pauseAll=this.pauseAll.bind(this),this.resumeAll=this.resumeAll.bind(this),this.retryAll=this.retryAll.bind(this),this.cancelAll=this.cancelAll.bind(this),this.retryUpload=this.retryUpload.bind(this),this.upload=this.upload.bind(this),this.emitter=h(),this.on=this.on.bind(this),this.off=this.off.bind(this),this.once=this.emitter.once.bind(this.emitter),this.emit=this.emitter.emit.bind(this.emitter),this.preProcessors=[],this.uploaders=[],this.postProcessors=[],this.store=this.opts.store,this.setState({plugins:{},files:{},currentUploads:{},capabilities:{resumableUploads:!1},totalProgress:0,meta:Q({},this.opts.meta),info:{isHidden:!0,type:"info",message:""}}),this._storeUnsubscribe=this.store.subscribe(function(t,e,r){n.emit("state-update",t,e,r),n.updateAll(e)}),this.opts.debug&&"undefined"!=typeof window&&(window.uppyLog="",window[this.opts.id]=this),this._addListeners()}return t.prototype.on=function(t,e){return this.emitter.on(t,e),this},t.prototype.off=function(t,e){return this.emitter.off(t,e),this},t.prototype.updateAll=function(t){this.iteratePlugins(function(e){e.update(t)})},t.prototype.setState=function(t){this.store.setState(t)},t.prototype.getState=function(){return this.store.getState()},t.prototype.setFileState=function(t,e){var n;if(!this.getState().files[t])throw new Error("Can\u2019t set state for "+t+" (the file could have been removed)");this.setState({files:Q({},this.getState().files,(n={},n[t]=Q({},this.getState().files[t],e),n))})},t.prototype.resetProgress=function(){var t={percentage:0,bytesUploaded:0,uploadComplete:!1,uploadStarted:!1},e=Q({},this.getState().files),n={};Object.keys(e).forEach(function(r){var o=Q({},e[r]);o.progress=Q({},o.progress,t),n[r]=o}),this.setState({files:n,totalProgress:0}),this.emit("reset-progress")},t.prototype.addPreProcessor=function(t){this.preProcessors.push(t)},t.prototype.removePreProcessor=function(t){var e=this.preProcessors.indexOf(t);-1!==e&&this.preProcessors.splice(e,1)},t.prototype.addPostProcessor=function(t){this.postProcessors.push(t)},t.prototype.removePostProcessor=function(t){var e=this.postProcessors.indexOf(t);-1!==e&&this.postProcessors.splice(e,1)},t.prototype.addUploader=function(t){this.uploaders.push(t)},t.prototype.removeUploader=function(t){var e=this.uploaders.indexOf(t);-1!==e&&this.uploaders.splice(e,1)},t.prototype.setMeta=function(t){var e=Q({},this.getState().meta,t),n=Q({},this.getState().files);Object.keys(n).forEach(function(e){n[e]=Q({},n[e],{meta:Q({},n[e].meta,t)})}),this.log("Adding metadata:"),this.log(t),this.setState({meta:e,files:n})},t.prototype.setFileMeta=function(t,e){var n=Q({},this.getState().files);if(n[t]){var r=Q({},n[t].meta,e);n[t]=Q({},n[t],{meta:r}),this.setState({files:n})}else this.log("Was trying to set metadata for a file that\u2019s not with us anymore: ",t)},t.prototype.getFile=function(t){return this.getState().files[t]},t.prototype.getFiles=function(){var t=this.getState().files;return Object.keys(t).map(function(e){return t[e]})},t.prototype._checkMinNumberOfFiles=function(t){var e=this.opts.restrictions.minNumberOfFiles;if(Object.keys(t).length<e)throw new Error(""+this.i18n("youHaveToAtLeastSelectX",{smart_count:e}))},t.prototype._checkRestrictions=function(t){var e=this.opts.restrictions,n=e.maxFileSize,r=e.maxNumberOfFiles,o=e.allowedFileTypes;if(r&&Object.keys(this.getState().files).length+1>r)throw new Error(""+this.i18n("youCanOnlyUploadX",{smart_count:r}));if(o&&!(o.filter(function(e){return e.indexOf("/")>-1?!!t.type&&function(t,e){function n(e){var n=T(e,t,U);return n&&n.length>=2}return e?n(e.split(";")[0]):n}(t.type,e):"."===e[0]&&t.extension===e.substr(1)?t.extension:void 0}).length>0)){var i=o.join(", ");throw new Error(this.i18n("youCanOnlyUploadFileTypes")+" "+i)}if(n&&t.data.size>n)throw new Error(this.i18n("exceedsSize")+" "+F(n))},t.prototype.addFile=function(t){var e,n=this,r=this.getState().files,o=this.opts.onBeforeFileAdded(t,r);if(!1!==o){if("object"===(void 0===o?"undefined":$(o))&&o){if(o.then)throw new TypeError("onBeforeFileAdded() returned a Promise, but this is no longer supported. It must be synchronous.");t=o}var i,s=G(t);i=t.name?t.name:"image"===s.split("/")[0]?s.split("/")[0]+"."+s.split("/")[1]:"noname";var a=X(i).extension,l=t.isRemote||!1,u=W(t),p=t.meta||{};p.name=i,p.type=s;var c={source:t.source||"",id:u,name:i,extension:a||"",meta:Q({},this.getState().meta,p),type:s,data:t.data,progress:{percentage:0,bytesUploaded:0,bytesTotal:t.data.size||0,uploadComplete:!1,uploadStarted:!1},size:t.data.size||0,isRemote:l,remote:t.remote||"",preview:t.preview};try{this._checkRestrictions(c)}catch(t){!function(t){var e="object"===(void 0===t?"undefined":$(t))?t:new Error(t);throw n.log(e.message),n.info(e.message,"error",5e3),e}(t)}this.setState({files:Q({},r,(e={},e[u]=c,e))}),this.emit("file-added",c),this.log("Added file: "+i+", "+u+", mime type: "+s),this.opts.autoProceed&&!this.scheduledAutoProceed&&(this.scheduledAutoProceed=setTimeout(function(){n.scheduledAutoProceed=null,n.upload().catch(function(t){console.error(t.stack||t.message||t)})},4))}else this.log("Not adding file because onBeforeFileAdded returned false")},t.prototype.removeFile=function(t){var e=this,n=this.getState(),r=n.files,o=n.currentUploads,i=Q({},r),s=i[t];delete i[t];var a=Q({},o),l=[];Object.keys(a).forEach(function(e){var n=o[e].fileIDs.filter(function(e){return e!==t});0!==n.length?a[e]=Q({},o[e],{fileIDs:n}):l.push(e)}),this.setState({currentUploads:a,files:i}),l.forEach(function(t){e._removeUpload(t)}),this._calculateTotalProgress(),this.emit("file-removed",s),this.log("File removed: "+s.id),s.preview&&0===s.preview.indexOf("blob:")&&URL.revokeObjectURL(s.preview)},t.prototype.pauseResume=function(t){if(!this.getFile(t).uploadComplete){var e=!this.getFile(t).isPaused;return this.setFileState(t,{isPaused:e}),this.emit("upload-pause",t,e),e}},t.prototype.pauseAll=function(){var t=Q({},this.getState().files);Object.keys(t).filter(function(e){return!t[e].progress.uploadComplete&&t[e].progress.uploadStarted}).forEach(function(e){var n=Q({},t[e],{isPaused:!0});t[e]=n}),this.setState({files:t}),this.emit("pause-all")},t.prototype.resumeAll=function(){var t=Q({},this.getState().files);Object.keys(t).filter(function(e){return!t[e].progress.uploadComplete&&t[e].progress.uploadStarted}).forEach(function(e){var n=Q({},t[e],{isPaused:!1,error:null});t[e]=n}),this.setState({files:t}),this.emit("resume-all")},t.prototype.retryAll=function(){var t=Q({},this.getState().files),e=Object.keys(t).filter(function(e){return t[e].error});e.forEach(function(e){var n=Q({},t[e],{isPaused:!1,error:null});t[e]=n}),this.setState({files:t,error:null}),this.emit("retry-all",e);var n=this._createUpload(e);return this._runUpload(n)},t.prototype.cancelAll=function(){var t=this;this.emit("cancel-all"),Object.keys(this.getState().files).forEach(function(e){t.removeFile(e)}),this.setState({totalProgress:0,error:null})},t.prototype.retryUpload=function(t){var e=Q({},this.getState().files),n=Q({},e[t],{error:null,isPaused:!1});e[t]=n,this.setState({files:e}),this.emit("upload-retry",t);var r=this._createUpload([t]);return this._runUpload(r)},t.prototype.reset=function(){this.cancelAll()},t.prototype._calculateProgress=function(t,e){this.getFile(t.id)?(this.setFileState(t.id,{progress:Q({},this.getFile(t.id).progress,{bytesUploaded:e.bytesUploaded,bytesTotal:e.bytesTotal,percentage:Math.floor((e.bytesUploaded/e.bytesTotal*100).toFixed(2))})}),this._calculateTotalProgress()):this.log("Not setting progress for a file that has been removed: "+t.id)},t.prototype._calculateTotalProgress=function(){var t=Q({},this.getState().files),e=Object.keys(t).filter(function(e){return t[e].progress.uploadStarted}),n=100*e.length,r=0;e.forEach(function(e){r+=t[e].progress.percentage});var o=0===n?0:Math.floor((100*r/n).toFixed(2));this.setState({totalProgress:o})},t.prototype._addListeners=function(){var t=this;this.on("error",function(e){t.setState({error:e.message})}),this.on("upload-error",function(e,n){t.setFileState(e.id,{error:n.message}),t.setState({error:n.message});var r=t.i18n("failedToUpload",{file:e.name});"object"===(void 0===n?"undefined":$(n))&&n.message&&(r={message:r,details:n.message}),t.info(r,"error",5e3)}),this.on("upload",function(){t.setState({error:null})}),this.on("upload-started",function(e,n){t.getFile(e.id)?t.setFileState(e.id,{progress:{uploadStarted:Date.now(),uploadComplete:!1,percentage:0,bytesUploaded:0,bytesTotal:e.size}}):t.log("Not setting progress for a file that has been removed: "+e.id)}),this.on("upload-progress",this._calculateProgress),this.on("upload-success",function(e,n,r){var o=t.getFile(e.id).progress;t.setFileState(e.id,{progress:Q({},o,{uploadComplete:!0,percentage:100,bytesUploaded:o.bytesTotal}),uploadURL:r,isPaused:!1}),t._calculateTotalProgress()}),this.on("preprocess-progress",function(e,n){t.getFile(e.id)?t.setFileState(e.id,{progress:Q({},t.getFile(e.id).progress,{preprocess:n})}):t.log("Not setting progress for a file that has been removed: "+e.id)}),this.on("preprocess-complete",function(e){if(t.getFile(e.id)){var n=Q({},t.getState().files);n[e.id]=Q({},n[e.id],{progress:Q({},n[e.id].progress)}),delete n[e.id].progress.preprocess,t.setState({files:n})}else t.log("Not setting progress for a file that has been removed: "+e.id)}),this.on("postprocess-progress",function(e,n){t.getFile(e.id)?t.setFileState(e.id,{progress:Q({},t.getState().files[e.id].progress,{postprocess:n})}):t.log("Not setting progress for a file that has been removed: "+e.id)}),this.on("postprocess-complete",function(e){if(t.getFile(e.id)){var n=Q({},t.getState().files);n[e.id]=Q({},n[e.id],{progress:Q({},n[e.id].progress)}),delete n[e.id].progress.postprocess,t.setState({files:n})}else t.log("Not setting progress for a file that has been removed: "+e.id)}),this.on("restored",function(){t._calculateTotalProgress()}),"undefined"!=typeof window&&window.addEventListener&&(window.addEventListener("online",function(){return t.updateOnlineStatus()}),window.addEventListener("offline",function(){return t.updateOnlineStatus()}),setTimeout(function(){return t.updateOnlineStatus()},3e3))},t.prototype.updateOnlineStatus=function(){void 0===window.navigator.onLine||window.navigator.onLine?(this.emit("is-online"),this.wasOffline&&(this.emit("back-online"),this.info(this.i18n("connectedToInternet"),"success",3e3),this.wasOffline=!1)):(this.emit("is-offline"),this.info(this.i18n("noInternetConnection"),"error",0),this.wasOffline=!0)},t.prototype.getID=function(){return this.opts.id},t.prototype.use=function(t,e){if("function"!=typeof t){var n="Expected a plugin class, but got "+(null===t?"null":void 0===t?"undefined":$(t))+". Please verify that the plugin was imported and spelled correctly.";throw new TypeError(n)}var r=new t(this,e),o=r.id;if(this.plugins[r.type]=this.plugins[r.type]||[],!o)throw new Error("Your plugin must have an id");if(!r.type)throw new Error("Your plugin must have a type");var i=this.getPlugin(o);if(i){var s="Already found a plugin named '"+i.id+"'. Tried to use: '"+o+"'.\nUppy plugins must have unique 'id' options. See https://uppy.io/docs/plugins/#id.";throw new Error(s)}return this.plugins[r.type].push(r),r.install(),this},t.prototype.getPlugin=function(t){var e=null;return this.iteratePlugins(function(n){if(n.id===t)return e=n,!1}),e},t.prototype.iteratePlugins=function(t){var e=this;Object.keys(this.plugins).forEach(function(n){e.plugins[n].forEach(t)})},t.prototype.removePlugin=function(t){this.log("Removing plugin "+t.id),this.emit("plugin-remove",t),t.uninstall&&t.uninstall();var e=this.plugins[t.type].slice(),n=e.indexOf(t);-1!==n&&(e.splice(n,1),this.plugins[t.type]=e);var r=this.getState();delete r.plugins[t.id],this.setState(r)},t.prototype.close=function(){var t=this;this.log("Closing Uppy instance "+this.opts.id+": removing all files and uninstalling plugins"),this.reset(),this._storeUnsubscribe(),this.iteratePlugins(function(e){t.removePlugin(e)})},t.prototype.info=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"info",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:3e3,r="object"===(void 0===t?"undefined":$(t));this.setState({info:{isHidden:!1,type:e,message:r?t.message:t,details:r?t.details:null}}),this.emit("info-visible"),clearTimeout(this.infoTimeoutID),this.infoTimeoutID=0!==n?setTimeout(this.hideInfo,n):void 0},t.prototype.hideInfo=function(){var t=Q({},this.getState().info,{isHidden:!0});this.setState({info:t}),this.emit("info-hidden")},t.prototype.log=function(t,e){if(this.opts.debug){var n="[Uppy] ["+J()+"] "+t;window.uppyLog=window.uppyLog+"\nDEBUG LOG: "+t,"error"!==e?"warning"!==e?t===""+t?console.log(n):(n="[Uppy] ["+J()+"]",console.log(n),console.dir(t)):console.warn(n):console.error(n)}},t.prototype.run=function(){return this.log("Calling run() is no longer necessary.","warning"),this},t.prototype.restore=function(t){return this.log('Core: attempting to restore upload "'+t+'"'),this.getState().currentUploads[t]?this._runUpload(t):(this._removeUpload(t),Promise.reject(new Error("Nonexistent upload")))},t.prototype._createUpload=function(t){var e,n=b();return this.emit("upload",{id:n,fileIDs:t}),this.setState({currentUploads:Q({},this.getState().currentUploads,(e={},e[n]={fileIDs:t,step:0,result:{}},e))}),n},t.prototype._getUpload=function(t){return this.getState().currentUploads[t]},t.prototype.addResultData=function(t,e){var n;if(this._getUpload(t)){var r=this.getState().currentUploads,o=Q({},r[t],{result:Q({},r[t].result,e)});this.setState({currentUploads:Q({},r,(n={},n[t]=o,n))})}else this.log("Not setting result for an upload that has been removed: "+t)},t.prototype._removeUpload=function(t){var e=Q({},this.getState().currentUploads);delete e[t],this.setState({currentUploads:e})},t.prototype._runUpload=function(t){var e=this,n=this.getState().currentUploads[t],r=n.fileIDs,o=n.step,i=[].concat(this.preProcessors,this.uploaders,this.postProcessors),s=Promise.resolve();return i.forEach(function(n,i){i<o||(s=s.then(function(){var o,s=e.getState().currentUploads,a=Q({},s[t],{step:i});return e.setState({currentUploads:Q({},s,(o={},o[t]=a,o))}),n(r,t)}).then(function(t){return null}))}),s.catch(function(n){e.emit("error",n,t),e._removeUpload(t)}),s.then(function(){var n=r.map(function(t){return e.getFile(t)}),o=n.filter(function(t){return t&&!t.error}),i=n.filter(function(t){return t&&t.error});e.addResultData(t,{successful:o,failed:i,uploadID:t});var s=e.getState().currentUploads;if(s[t]){var a=s[t].result;return e.emit("complete",a),e._removeUpload(t),a}e.log("Not setting result for an upload that has been removed: "+t)})},t.prototype.upload=function(){var t=this;this.plugins.uploader||this.log("No uploader type plugins are used","warning");var e=this.getState().files,n=this.opts.onBeforeUpload(e);if(!1===n)return Promise.reject(new Error("Not starting the upload because onBeforeUpload returned false"));if(n&&"object"===(void 0===n?"undefined":$(n))){if(n.then)throw new TypeError("onBeforeUpload() returned a Promise, but this is no longer supported. It must be synchronous.");e=n}return Promise.resolve().then(function(){return t._checkMinNumberOfFiles(e)}).then(function(){var n=t.getState().currentUploads,r=Object.keys(n).reduce(function(t,e){return t.concat(n[e].fileIDs)},[]),o=[];Object.keys(e).forEach(function(e){var n=t.getFile(e);n.progress.uploadStarted||-1!==r.indexOf(e)||o.push(n.id)});var i=t._createUpload(o);return t._runUpload(i)}).catch(function(e){var n="object"===(void 0===e?"undefined":$(e))?e.message:e,r="object"===(void 0===e?"undefined":$(e))?e.details:null;return t.log(n+" "+r),t.info({message:n,details:r},"error",4e3),Promise.reject("object"===(void 0===e?"undefined":$(e))?e:new Error(e))})},Z(t,[{key:"state",get:function(){return this.getState()}}]),t}();(Y=function(t){return new tt(t)}).Uppy=tt,Y.Plugin=L;var et={};(function(t){var e="Expected a function",n=NaN,r="[object Symbol]",o=/^\s+|\s+$/g,i=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,a=/^0o[0-7]+$/i,l=parseInt,u="object"==typeof t&&t&&t.Object===Object&&t,p="object"==typeof self&&self&&self.Object===Object&&self,c=u||p||Function("return this")(),h=Object.prototype.toString,d=Math.max,f=Math.min,y=function(){return c.Date.now()};function g(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function m(t){if("number"==typeof t)return t;if(function(t){return"symbol"==typeof t||function(t){return!!t&&"object"==typeof t}(t)&&h.call(t)==r}(t))return n;if(g(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=g(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(o,"");var u=s.test(t);return u||a.test(t)?l(t.slice(2),u?2:8):i.test(t)?n:+t}et=function(t,n,r){var o=!0,i=!0;if("function"!=typeof t)throw new TypeError(e);return g(r)&&(o="leading"in r?!!r.leading:o,i="trailing"in r?!!r.trailing:i),function(t,n,r){var o,i,s,a,l,u,p=0,c=!1,h=!1,v=!0;if("function"!=typeof t)throw new TypeError(e);function b(e){var n=o,r=i;return o=i=void 0,p=e,a=t.apply(r,n)}function w(t){var e=t-u;return void 0===u||e>=n||e<0||h&&t-p>=s}function S(){var t=y();if(w(t))return _(t);l=setTimeout(S,function(t){var e=n-(t-u);return h?f(e,s-(t-p)):e}(t))}function _(t){return l=void 0,v&&o?b(t):(o=i=void 0,a)}function P(){var t=y(),e=w(t);if(o=arguments,i=this,u=t,e){if(void 0===l)return function(t){return p=t,l=setTimeout(S,n),c?b(t):a}(u);if(h)return l=setTimeout(S,n),b(u)}return void 0===l&&(l=setTimeout(S,n)),a}return n=m(n)||0,g(r)&&(c=!!r.leading,s=(h="maxWait"in r)?d(m(r.maxWait)||0,n):s,v="trailing"in r?!!r.trailing:v),P.cancel=function(){void 0!==l&&clearTimeout(l),p=0,o=u=i=l=void 0},P.flush=function(){return void 0===l?a:_(y())},P}(t,n,{leading:o,maxWait:n,trailing:i})}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});var nt=et(function(t,e,n){var r=e.progress,o=e.bytesUploaded,i=e.bytesTotal;r&&(t.uppy.log("Upload progress: "+r),t.uppy.emit("upload-progress",n,{uploader:t,bytesUploaded:o,bytesTotal:i}))},300,{leading:!0,trailing:!0}),rt=function(t){var e=/^(?:https?:\/\/|\/\/)?(?:[^@\n]+@)?(?:www\.)?([^\n]+)/.exec(t)[1];return("https:"===location.protocol?"wss":"ws")+"://"+e},ot=function(t){var e=0,n=[];return function(o){return function(){for(var i=arguments.length,s=Array(i),a=0;a<i;a++)s[a]=arguments[a];var l=function(){e++;var t=o.apply(void 0,s);return t.then(r,r),t};return e>=t?new Promise(function(t,e){n.push(function(){l().then(t,e)})}):l()}};function r(){e--;var t=n.shift();t&&t()}},it=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},st=d.Socket,at=d.RequestClient;function lt(t){var e=[];return{on:function(n,r){return e.push([n,r]),t.on(n,r)},remove:function(){e.forEach(function(e){var n=e[0],r=e[1];t.off(n,r)})}}}function ut(t){if(t&&t.error){var e=new Error(t.message);throw it(e,t.error),e}return t}var pt,ct=function(t){function e(n,r){!function(t,n){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this);var o=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.call(this,n,r));o.type="uploader",o.id="AwsS3Multipart",o.title="AWS S3 Multipart",o.client=new at(n,r);var i={timeout:3e4,limit:0,createMultipartUpload:o.createMultipartUpload.bind(o),listParts:o.listParts.bind(o),prepareUploadPart:o.prepareUploadPart.bind(o),abortMultipartUpload:o.abortMultipartUpload.bind(o),completeMultipartUpload:o.completeMultipartUpload.bind(o)};return o.opts=it({},i,r),o.upload=o.upload.bind(o),"number"==typeof o.opts.limit&&0!==o.opts.limit?o.limitRequests=ot(o.opts.limit):o.limitRequests=function(t){return t},o.uploaders=Object.create(null),o.uploaderEvents=Object.create(null),o.uploaderSockets=Object.create(null),o}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.resetUploaderReferences=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.uploaders[t]&&(this.uploaders[t].abort({really:e.abort||!1}),this.uploaders[t]=null),this.uploaderEvents[t]&&(this.uploaderEvents[t].remove(),this.uploaderEvents[t]=null),this.uploaderSockets[t]&&(this.uploaderSockets[t].close(),this.uploaderSockets[t]=null)},e.prototype.assertHost=function(){if(!this.opts.serverUrl)throw new Error("Expected a `serverUrl` option containing a Companion address.")},e.prototype.createMultipartUpload=function(t){return this.assertHost(),this.client.post("s3/multipart",{filename:t.name,type:t.type}).then(ut)},e.prototype.listParts=function(t,e){var n=e.key,r=e.uploadId;this.assertHost();var o=encodeURIComponent(n);return this.client.get("s3/multipart/"+r+"?key="+o).then(ut)},e.prototype.prepareUploadPart=function(t,e){var n=e.key,r=e.uploadId,o=e.number;this.assertHost();var i=encodeURIComponent(n);return this.client.get("s3/multipart/"+r+"/"+o+"?key="+i).then(ut)},e.prototype.completeMultipartUpload=function(t,e){var n=e.key,r=e.uploadId,o=e.parts;this.assertHost();var i=encodeURIComponent(n),s=encodeURIComponent(r);return this.client.post("s3/multipart/"+s+"/complete?key="+i,{parts:o}).then(ut)},e.prototype.abortMultipartUpload=function(t,e){var n=e.key,r=e.uploadId;this.assertHost();var o=encodeURIComponent(n),i=encodeURIComponent(r);return this.client.delete("s3/multipart/"+i+"?key="+o).then(ut)},e.prototype.uploadFile=function(t){var e=this;return new Promise(function(n,r){var i=new o(t.data,it({createMultipartUpload:e.limitRequests(e.opts.createMultipartUpload.bind(e,t)),listParts:e.limitRequests(e.opts.listParts.bind(e,t)),prepareUploadPart:e.opts.prepareUploadPart.bind(e,t),completeMultipartUpload:e.limitRequests(e.opts.completeMultipartUpload.bind(e,t)),abortMultipartUpload:e.limitRequests(e.opts.abortMultipartUpload.bind(e,t)),limit:e.opts.limit||5,onStart:function(n){var r=e.uppy.getFile(t.id);e.uppy.setFileState(t.id,{s3Multipart:it({},r.s3Multipart,{key:n.key,uploadId:n.uploadId,parts:[]})})},onProgress:function(n,r){e.uppy.emit("upload-progress",t,{uploader:e,bytesUploaded:n,bytesTotal:r})},onError:function(n){e.uppy.log(n),e.uppy.emit("upload-error",t,n),n.message="Failed because: "+n.message,e.resetUploaderReferences(t.id),r(n)},onSuccess:function(r){e.uppy.emit("upload-success",t,i,r.location),r.location&&e.uppy.log("Download "+i.file.name+" from "+r.location),e.resetUploaderReferences(t.id),n(i)},onPartComplete:function(n){var r=e.uppy.getFile(t.id);r&&(e.uppy.setFileState(t.id,{s3Multipart:it({},r.s3Multipart,{parts:[].concat(r.s3Multipart.parts,[n])})}),e.uppy.emit("s3-multipart:part-uploaded",r,n))}},t.s3Multipart));e.uploaders[t.id]=i,e.uploaderEvents[t.id]=lt(e.uppy),e.onFileRemove(t.id,function(r){e.resetUploaderReferences(t.id,{abort:!0}),n("upload "+r.id+" was removed")}),e.onFilePause(t.id,function(t){t?i.pause():i.start()}),e.onPauseAll(t.id,function(){i.pause()}),e.onResumeAll(t.id,function(){i.start()}),t.isPaused||i.start(),t.isRestored||e.uppy.emit("upload-started",t,i)})},e.prototype.uploadRemote=function(t){var e=this;return this.resetUploaderReferences(t.id),new Promise(function(n,r){if(t.serverToken)return e.connectToServerSocket(t).then(function(){return n()}).catch(r);e.uppy.emit("upload-started",t),fetch(t.remote.url,{method:"post",credentials:"include",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(it({},t.remote.body,{protocol:"s3-multipart",size:t.data.size,metadata:t.meta}))}).then(function(n){return n.status<200||n.status>300?r(n.statusText):n.json().then(function(n){return e.uppy.setFileState(t.id,{serverToken:n.token}),e.uppy.getFile(t.id)})}).then(function(t){return e.connectToServerSocket(t)}).then(function(){n()}).catch(function(t){r(new Error(t))})})},e.prototype.connectToServerSocket=function(t){var e=this;return new Promise(function(n,r){var o=t.serverToken,i=rt(t.remote.serverUrl),s=new st({target:i+"/api/"+o});e.uploaderSockets[s]=s,e.uploaderEvents[t.id]=lt(e.uppy),e.onFileRemove(t.id,function(r){e.resetUploaderReferences(t.id,{abort:!0}),n("upload "+t.id+" was removed")}),e.onFilePause(t.id,function(t){s.send(t?"pause":"resume",{})}),e.onPauseAll(t.id,function(){return s.send("pause",{})}),e.onResumeAll(t.id,function(){t.error&&s.send("pause",{}),s.send("resume",{})}),e.onRetry(t.id,function(){s.send("pause",{}),s.send("resume",{})}),e.onRetryAll(t.id,function(){s.send("pause",{}),s.send("resume",{})}),t.isPaused&&s.send("pause",{}),s.on("progress",function(n){return nt(e,n,t)}),s.on("error",function(n){e.uppy.emit("upload-error",t,new Error(n.error)),r(new Error(n.error))}),s.on("success",function(r){e.uppy.emit("upload-success",t,r,r.url),n()})})},e.prototype.upload=function(t){var e=this;if(0===t.length)return Promise.resolve();var n=t.map(function(t){var n=e.uppy.getFile(t);return n.isRemote?e.uploadRemote(n):e.uploadFile(n)});return Promise.all(n)},e.prototype.onFileRemove=function(t,e){this.uploaderEvents[t].on("file-removed",function(n){t===n.id&&e(n.id)})},e.prototype.onFilePause=function(t,e){this.uploaderEvents[t].on("upload-pause",function(n,r){t===n&&e(r)})},e.prototype.onRetry=function(t,e){this.uploaderEvents[t].on("upload-retry",function(n){t===n&&e()})},e.prototype.onRetryAll=function(t,e){var n=this;this.uploaderEvents[t].on("retry-all",function(r){n.uppy.getFile(t)&&e()})},e.prototype.onPauseAll=function(t,e){var n=this;this.uploaderEvents[t].on("pause-all",function(){n.uppy.getFile(t)&&e()})},e.prototype.onResumeAll=function(t,e){var n=this;this.uploaderEvents[t].on("resume-all",function(){n.uppy.getFile(t)&&e()})},e.prototype.install=function(){var t=this,e=this.uppy.getState().capabilities;this.uppy.setState({capabilities:it({},e,{resumableUploads:!0})}),this.uppy.addUploader(this.upload),this.uppy.on("cancel-all",function(){t.uppy.getFiles().forEach(function(e){t.resetUploaderReferences(e.id,{abort:!0})})})},e.prototype.uninstall=function(){this.uppy.setState({capabilities:it({},this.uppy.getState().capabilities,{resumableUploads:!1})}),this.uppy.removeUploader(this.upload)},e}(Y.Plugin),ht={};pt=function(){return function(){var t=arguments.length;if(0===t)throw new Error("resolveUrl requires at least one argument; got none.");var e=document.createElement("base");if(e.href=arguments[0],1===t)return e.href;var n=document.getElementsByTagName("head")[0];n.insertBefore(e,n.firstChild);for(var r,o=document.createElement("a"),i=1;i<t;i++)o.href=arguments[i],r=o.href,e.href=r;return n.removeChild(e),r}},"object"==typeof ht?ht=pt():this.resolveUrl=pt();var dt=function(t){var e=[],n=[];function r(t){e.push(t)}function o(t){n.push(t)}return Promise.all(t.map(function(t){return t.then(r,o)})).then(function(){return{successful:e,failed:n}})},ft=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},yt=d.Provider,gt=d.Socket;function mt(t,e){return e||(e=new Error("Upload error")),"string"==typeof e&&(e=new Error(e)),e instanceof Error||(e=ft(new Error("Upload error"),{data:e})),e.request=t,e}var vt=function(t){function e(n,r){!function(t,n){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this);var o=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.call(this,n,r));o.type="uploader",o.id="XHRUpload",o.title="XHRUpload";var i={strings:{timedOut:"Upload stalled for %{seconds} seconds, aborting."}},s={formData:!0,fieldName:"files[]",method:"post",metaFields:null,responseUrlFieldName:"url",bundle:!1,headers:{},locale:i,timeout:3e4,limit:0,withCredentials:!1,getResponseData:function(t,e){var n={};try{n=JSON.parse(t)}catch(t){console.log(t)}return n},getResponseError:function(t,e){return new Error("Upload error")}};if(o.opts=ft({},s,r),o.locale=ft({},i,o.opts.locale),o.locale.strings=ft({},i.strings,o.opts.locale.strings),o.translator=new H({locale:o.locale}),o.i18n=o.translator.translate.bind(o.translator),o.handleUpload=o.handleUpload.bind(o),"number"==typeof o.opts.limit&&0!==o.opts.limit?o.limitUploads=ot(o.opts.limit):o.limitUploads=function(t){return t},o.opts.bundle&&!o.opts.formData)throw new Error("`opts.formData` must be true when `opts.bundle` is enabled.");return o}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.getOptions=function(t){var e=this.uppy.getState().xhrUpload,n=ft({},this.opts,e||{},t.xhrUpload||{});return n.headers={},ft(n.headers,this.opts.headers),e&&ft(n.headers,e.headers),t.xhrUpload&&ft(n.headers,t.xhrUpload.headers),n},e.prototype.createProgressTimeout=function(t,e){var n=this.uppy,r=this,o=!1;function i(){n.log("[XHRUpload] timed out");var o=new Error(r.i18n("timedOut",{seconds:Math.ceil(t/1e3)}));e(o)}var s=null;return{progress:function(){o||t>0&&(s&&clearTimeout(s),s=setTimeout(i,t))},done:function(){n.log("[XHRUpload] timer done"),s&&(clearTimeout(s),s=null),o=!0}}},e.prototype.createFormDataUpload=function(t,e){var n=new FormData;return(Array.isArray(e.metaFields)?e.metaFields:Object.keys(t.meta)).forEach(function(e){n.append(e,t.meta[e])}),t.name?n.append(e.fieldName,t.data,t.name):n.append(e.fieldName,t.data),n},e.prototype.createBareUpload=function(t,e){return t.data},e.prototype.upload=function(t,e,n){var r=this,o=this.getOptions(t);return this.uppy.log("uploading "+e+" of "+n),new Promise(function(e,n){var i=o.formData?r.createFormDataUpload(t,o):r.createBareUpload(t,o),s=r.createProgressTimeout(o.timeout,function(e){a.abort(),r.uppy.emit("upload-error",t,e),n(e)}),a=new XMLHttpRequest,l=b();a.upload.addEventListener("loadstart",function(t){r.uppy.log("[XHRUpload] "+l+" started"),s.progress()}),a.upload.addEventListener("progress",function(e){r.uppy.log("[XHRUpload] "+l+" progress: "+e.loaded+" / "+e.total),s.progress(),e.lengthComputable&&r.uppy.emit("upload-progress",t,{uploader:r,bytesUploaded:e.loaded,bytesTotal:e.total})}),a.addEventListener("load",function(i){if(r.uppy.log("[XHRUpload] "+l+" finished"),s.done(),i.target.status>=200&&i.target.status<300){var u=o.getResponseData(a.responseText,a),p=u[o.responseUrlFieldName],c={status:i.target.status,body:u,uploadURL:p};return r.uppy.setFileState(t.id,{response:c}),r.uppy.emit("upload-success",t,u,p),p&&r.uppy.log("Download "+t.name+" from "+t.uploadURL),e(t)}var h=o.getResponseData(a.responseText,a),d=mt(a,o.getResponseError(a.responseText,a)),f={status:i.target.status,body:h};return r.uppy.setFileState(t.id,{response:f}),r.uppy.emit("upload-error",t,d),n(d)}),a.addEventListener("error",function(e){r.uppy.log("[XHRUpload] "+l+" errored"),s.done();var i=mt(a,o.getResponseError(a.responseText,a));return r.uppy.emit("upload-error",t,i),n(i)}),a.open(o.method.toUpperCase(),o.endpoint,!0),a.withCredentials=o.withCredentials,Object.keys(o.headers).forEach(function(t){a.setRequestHeader(t,o.headers[t])}),a.send(i),r.uppy.on("file-removed",function(e){e.id===t.id&&(s.done(),a.abort())}),r.uppy.on("upload-cancel",function(e){e===t.id&&(s.done(),a.abort())}),r.uppy.on("cancel-all",function(){s.done(),a.abort()})})},e.prototype.uploadRemote=function(t,e,n){var r=this,o=this.getOptions(t);return new Promise(function(e,n){var i={};(Array.isArray(o.metaFields)?o.metaFields:Object.keys(t.meta)).forEach(function(e){i[e]=t.meta[e]}),new yt(r.uppy,t.remote.providerOptions).post(t.remote.url,ft({},t.remote.body,{endpoint:o.endpoint,size:t.data.size,fieldname:o.fieldName,metadata:i,headers:o.headers})).then(function(i){var s=i.token,a=rt(t.remote.serverUrl),l=new gt({target:a+"/api/"+s});l.on("progress",function(e){return nt(r,e,t)}),l.on("success",function(n){var i=o.getResponseData(n.response.responseText,n.response),s=i[o.responseUrlFieldName];return r.uppy.emit("upload-success",t,i,s),l.close(),e()}),l.on("error",function(e){var i=e.response,s=i?o.getResponseError(i.responseText,i):ft(new Error(e.error.message),{cause:e.error});r.uppy.emit("upload-error",t,s),n(s)})})})},e.prototype.uploadBundle=function(t){var e=this;return new Promise(function(n,r){var o=e.opts.endpoint,i=e.opts.method,s=new FormData;t.forEach(function(t,n){var r=e.getOptions(t);s.append(r.fieldName,t.data)});var a=new XMLHttpRequest;a.withCredentials=e.opts.withCredentials;var l=e.createProgressTimeout(e.opts.timeout,function(t){a.abort(),u(t),r(t)}),u=function(n){t.forEach(function(t){e.uppy.emit("upload-error",t,n)})};a.upload.addEventListener("loadstart",function(t){e.uppy.log("[XHRUpload] started uploading bundle"),l.progress()}),a.upload.addEventListener("progress",function(n){l.progress(),n.lengthComputable&&t.forEach(function(t){e.uppy.emit("upload-progress",t,{uploader:e,bytesUploaded:n.loaded/n.total*t.size,bytesTotal:t.size})})}),a.addEventListener("load",function(o){if(l.done(),o.target.status>=200&&o.target.status<300){var i=e.opts.getResponseData(a.responseText,a);return t.forEach(function(t){e.uppy.emit("upload-success",t,i)}),n()}var s=e.opts.getResponseError(a.responseText,a)||new Error("Upload error");return s.request=a,u(s),r(s)}),a.addEventListener("error",function(t){l.done();var n=e.opts.getResponseError(a.responseText,a)||new Error("Upload error");return u(n),r(n)}),e.uppy.on("cancel-all",function(){l.done(),a.abort()}),a.open(i.toUpperCase(),o,!0),a.withCredentials=e.opts.withCredentials,Object.keys(e.opts.headers).forEach(function(t){a.setRequestHeader(t,e.opts.headers[t])}),a.send(s),t.forEach(function(t){e.uppy.emit("upload-started",t)})})},e.prototype.uploadFiles=function(t){var e=this,n=t.map(function(n,r){var o=parseInt(r,10)+1,i=t.length;return n.error?function(){return Promise.reject(new Error(n.error))}:n.isRemote?(e.uppy.emit("upload-started",n),e.uploadRemote.bind(e,n,o,i)):(e.uppy.emit("upload-started",n),e.upload.bind(e,n,o,i))}).map(function(t){return e.limitUploads(t)()});return dt(n)},e.prototype.handleUpload=function(t){var e=this;if(0===t.length)return this.uppy.log("[XHRUpload] No files to upload!"),Promise.resolve();this.uppy.log("[XHRUpload] Uploading...");var n=t.map(function(t){return e.uppy.getFile(t)});return this.opts.bundle?this.uploadBundle(n):this.uploadFiles(n).then(function(){return null})},e.prototype.install=function(){this.opts.bundle&&this.uppy.setState({capabilities:ft({},this.uppy.getState().capabilities,{bundled:!0})}),this.uppy.addUploader(this.handleUpload)},e.prototype.uninstall=function(){this.opts.bundle&&this.uppy.setState({capabilities:ft({},this.uppy.getState().capabilities,{bundled:!0})}),this.uppy.removeUploader(this.handleUpload)},e}(Y.Plugin),bt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},wt=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t};function St(t){var e=t.headers?t.headers["content-type"]:t.getResponseHeader("Content-Type");return"string"==typeof e&&"application/xml"===e.toLowerCase()}var _t,Pt,Et,kt=function(t){function e(n,r){!function(t,n){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this);var o=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.call(this,n,r));o.type="uploader",o.id="AwsS3",o.title="AWS S3";var i={strings:{preparingUpload:"Preparing upload..."}},s={timeout:3e4,limit:0,getUploadParameters:o.getUploadParameters.bind(o),locale:i};return o.opts=wt({},s,r),o.locale=wt({},i,o.opts.locale),o.locale.strings=wt({},i.strings,o.opts.locale.strings),o.translator=new H({locale:o.locale}),o.i18n=o.translator.translate.bind(o.translator),o.prepareUpload=o.prepareUpload.bind(o),"number"==typeof o.opts.limit&&0!==o.opts.limit?o.limitRequests=ot(o.opts.limit):o.limitRequests=function(t){return t},o}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.getUploadParameters=function(t){if(!this.opts.serverUrl)throw new Error("Expected a `serverUrl` option containing a Companion address.");var e=encodeURIComponent(t.name),n=encodeURIComponent(t.type);return fetch(this.opts.serverUrl+"/s3/params?filename="+e+"&type="+n,{method:"get",headers:{accept:"application/json"}}).then(function(t){return t.json()})},e.prototype.validateParameters=function(t,e){if("object"!==(void 0===e?"undefined":bt(e))||!e||"string"!=typeof e.url||"object"!==bt(e.fields)&&null!=e.fields||null!=e.method&&!/^(put|post)$/i.test(e.method)){var n=new TypeError("AwsS3: got incorrect result from 'getUploadParameters()' for file '"+t.name+"', expected an object '{ url, method, fields, headers }'.\nSee https://uppy.io/docs/aws-s3/#getUploadParameters-file for more on the expected format.");throw console.error(n),n}return e},e.prototype.prepareUpload=function(t){var e=this;t.forEach(function(t){var n=e.uppy.getFile(t);e.uppy.emit("preprocess-progress",n,{mode:"determinate",message:e.i18n("preparingUpload"),value:0})});var n=this.limitRequests(this.opts.getUploadParameters);return Promise.all(t.map(function(t){var r=e.uppy.getFile(t);return Promise.resolve().then(function(){return n(r)}).then(function(t){return e.validateParameters(r,t)}).then(function(t){return e.uppy.emit("preprocess-progress",r,{mode:"determinate",message:e.i18n("preparingUpload"),value:1}),t}).catch(function(t){e.uppy.emit("upload-error",r,t)})})).then(function(n){var r={};t.forEach(function(t,o){var i=e.uppy.getFile(t);if(!i.error){var s=n[o],a=s.method,l=void 0===a?"post":a,u=s.url,p=s.fields,c=s.headers,h={method:l,formData:"post"===l.toLowerCase(),endpoint:u,metaFields:Object.keys(p)};c&&(h.headers=c);var d=wt({},i,{meta:wt({},i.meta,p),xhrUpload:h});r[t]=d}}),e.uppy.setState({files:wt({},e.uppy.getState().files,r)}),t.forEach(function(t){var n=e.uppy.getFile(t);e.uppy.emit("preprocess-complete",n)})})},e.prototype.install=function(){var t=this.uppy.log;this.uppy.addPreProcessor(this.prepareUpload);var e=!1;this.uppy.use(vt,{fieldName:"file",responseUrlFieldName:"location",timeout:this.opts.timeout,limit:this.opts.limit,getResponseData:function(n,r){if(!St(r))return"POST"===this.method.toUpperCase()?(e||(t("[AwsS3] No response data found, make sure to set the success_action_status AWS SDK option to 201. See https://uppy.io/docs/aws-s3/#POST-Uploads","warning"),e=!0),{location:null}):r.responseURL?{location:r.responseURL.replace(/\?.*$/,"")}:{location:null};var o=function(){return""};return r.responseXML&&(o=function(t){var e=r.responseXML.querySelector(t);return e?e.textContent:""}),r.responseText&&(o=function(t){var e=r.responseText.indexOf("<"+t+">"),n=r.responseText.indexOf("</"+t+">");return-1!==e&&-1!==n?r.responseText.slice(e+t.length+2,n):""}),{location:ht(r.responseURL,o("Location")),bucket:o("Bucket"),key:o("Key"),etag:o("ETag")}},getResponseError:function(t,e){if(St(e)){var n=e.responseXML.querySelector("Error > Message");return new Error(n.textContent)}}})},e.prototype.uninstall=function(){var t=this.uppy.getPlugin("XHRUpload");this.uppy.removePlugin(t),this.uppy.removePreProcessor(this.prepareUpload)},e}(Y.Plugin),Ct=function(t,e){return(e="number"==typeof e?e:1/0)?function t(n,r){return n.reduce(function(n,o){return Array.isArray(o)&&r<e?n.concat(t(o,r+1)):n.concat(o)},[])}(t,1):Array.isArray(t)?t.map(function(t){return t}):t},Tt=_t={};function Ot(){throw new Error("setTimeout has not been defined")}function Ut(){throw new Error("clearTimeout has not been defined")}function Ft(t){if(Pt===setTimeout)return setTimeout(t,0);if((Pt===Ot||!Pt)&&setTimeout)return Pt=setTimeout,setTimeout(t,0);try{return Pt(t,0)}catch(e){try{return Pt.call(null,t,0)}catch(e){return Pt.call(this,t,0)}}}!function(){try{Pt="function"==typeof setTimeout?setTimeout:Ot}catch(t){Pt=Ot}try{Et="function"==typeof clearTimeout?clearTimeout:Ut}catch(t){Et=Ut}}();var At,xt=[],Dt=!1,Rt=-1;function It(){Dt&&At&&(Dt=!1,At.length?xt=At.concat(xt):Rt=-1,xt.length&&Bt())}function Bt(){if(!Dt){var t=Ft(It);Dt=!0;for(var e=xt.length;e;){for(At=xt,xt=[];++Rt<e;)At&&At[Rt].run();Rt=-1,e=xt.length}At=null,Dt=!1,function(t){if(Et===clearTimeout)return clearTimeout(t);if((Et===Ut||!Et)&&clearTimeout)return Et=clearTimeout,clearTimeout(t);try{Et(t)}catch(e){try{return Et.call(null,t)}catch(e){return Et.call(this,t)}}}(t)}}function jt(t,e){this.fun=t,this.array=e}function Lt(){}Tt.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];xt.push(new jt(t,e)),1!==xt.length||Dt||Ft(Bt)},jt.prototype.run=function(){this.fun.apply(null,this.array)},Tt.title="browser",Tt.browser=!0,Tt.env={},Tt.argv=[],Tt.version="",Tt.versions={},Tt.on=Lt,Tt.addListener=Lt,Tt.once=Lt,Tt.off=Lt,Tt.removeListener=Lt,Tt.removeAllListeners=Lt,Tt.emit=Lt,Tt.prependListener=Lt,Tt.prependOnceListener=Lt,Tt.listeners=function(t){return[]},Tt.binding=function(t){throw new Error("process.binding is not supported")},Tt.cwd=function(){return"/"},Tt.chdir=function(t){throw new Error("process.chdir is not supported")},Tt.umask=function(){return 0};var Mt={};(function(t){Mt=function(e,n){var r,o,i,s=!0;function a(e){function o(){n&&n(e,r),n=null}s?t.nextTick(o):o()}function l(t,e,n){r[t]=n,(0==--o||e)&&a(e)}Array.isArray(e)?(r=[],o=e.length):(i=Object.keys(e),r={},o=i.length),o?i?i.forEach(function(t){e[t](function(e,n){l(t,e,n)})}):e.forEach(function(t,e){t(function(t,n){l(e,t,n)})}):a(null),s=!1}}).call(this,_t);var Nt=function(t,e){if("string"==typeof t){var n=t;if(!(t=window.document.querySelector(t)))throw new Error('"'+n+'" does not match any HTML elements')}if(!t)throw new Error('"'+t+'" is not a valid HTML element');var r;return"function"==typeof e&&(e={onDrop:e}),t.addEventListener("dragenter",o,!1),t.addEventListener("dragover",i,!1),t.addEventListener("dragleave",s,!1),t.addEventListener("drop",a,!1),function(){l(),t.removeEventListener("dragenter",o,!1),t.removeEventListener("dragover",i,!1),t.removeEventListener("dragleave",s,!1),t.removeEventListener("drop",a,!1)};function o(t){return e.onDragEnter&&e.onDragEnter(t),t.stopPropagation(),t.preventDefault(),!1}function i(n){if(n.stopPropagation(),n.preventDefault(),n.dataTransfer.items){var o=qt(n.dataTransfer.items),i=o.filter(function(t){return"file"===t.kind}),s=o.filter(function(t){return"string"===t.kind});if(0===i.length&&!e.onDropText)return;if(0===s.length&&!e.onDrop)return;if(0===i.length&&0===s.length)return}return t.classList.add("drag"),clearTimeout(r),e.onDragOver&&e.onDragOver(n),n.dataTransfer.dropEffect="copy",!1}function s(t){return t.stopPropagation(),t.preventDefault(),e.onDragLeave&&e.onDragLeave(t),clearTimeout(r),r=setTimeout(l,50),!1}function a(t){t.stopPropagation(),t.preventDefault(),e.onDragLeave&&e.onDragLeave(t),clearTimeout(r),l();var n={x:t.clientX,y:t.clientY},o=t.dataTransfer.getData("text");if(o&&e.onDropText&&e.onDropText(o,n),t.dataTransfer.items){var i=qt(t.dataTransfer.items).filter(function(t){return"file"===t.kind});if(0===i.length)return;Mt(i.map(function(t){return function(e){!function(t,e){var n=[];if(t.isFile)t.file(function(n){n.fullPath=t.fullPath,e(null,n)},function(t){e(t)});else if(t.isDirectory){var r=t.createReader();!function t(){r.readEntries(function(r){r.length>0?(n=n.concat(qt(r)),t()):Mt(n.map(function(t){return function(e){!function(t,e){var n=[];if(t.isFile)t.file(function(n){n.fullPath=t.fullPath,e(null,n)},function(t){e(t)});else if(t.isDirectory){var r=t.createReader();!function t(){r.readEntries(function(r){r.length>0?(n=n.concat(qt(r)),t()):Mt(n.map(function(t){return function(e){zt(t,e)}}),e)})}()}}(t,e)}}),e)})}()}}(t.webkitGetAsEntry(),e)}}),function(t,r){if(t)throw t;e.onDrop&&e.onDrop(Ct(r),n)})}else{var s=qt(t.dataTransfer.files);if(0===s.length)return;s.forEach(function(t){t.fullPath="/"+t.name}),e.onDrop&&e.onDrop(s,n)}return!1}function l(){t.classList.remove("drag")}};function zt(t,e){var n=[];if(t.isFile){t.file(function(n){n.fullPath=t.fullPath;e(null,n)},function(t){e(t)})}else if(t.isDirectory){var r=t.createReader();o()}function o(){r.readEntries(function(t){if(t.length>0){n=n.concat(qt(t));o()}else{i()}})}function i(){Mt(n.map(function(t){return function(e){zt(t,e)}}),e)}}function qt(t){return Array.prototype.slice.call(t||[],0)}var Ht={exports:{}};(function(t){!function(t,e){"object"==typeof Ht.exports?Ht.exports=e():t.ResizeObserver=e()}(this,function(){"use strict";var e=function(){if("undefined"!=typeof Map)return Map;function t(t,e){var n=-1;return t.some(function(t,r){return t[0]===e&&(n=r,!0)}),n}return function(){function e(){this.__entries__=[]}var n={size:{configurable:!0}};return n.size.get=function(){return this.__entries__.length},e.prototype.get=function(e){var n=t(this.__entries__,e),r=this.__entries__[n];return r&&r[1]},e.prototype.set=function(e,n){var r=t(this.__entries__,e);~r?this.__entries__[r][1]=n:this.__entries__.push([e,n])},e.prototype.delete=function(e){var n=this.__entries__,r=t(n,e);~r&&n.splice(r,1)},e.prototype.has=function(e){return!!~t(this.__entries__,e)},e.prototype.clear=function(){this.__entries__.splice(0)},e.prototype.forEach=function(t,e){void 0===e&&(e=null);for(var n=0,r=this.__entries__;n<r.length;n+=1){var o=r[n];t.call(e,o[1],o[0])}},Object.defineProperties(e.prototype,n),e}()}(),n="undefined"!=typeof window&&"undefined"!=typeof document&&window.document===document,r=void 0!==t&&t.Math===Math?t:"undefined"!=typeof self&&self.Math===Math?self:"undefined"!=typeof window&&window.Math===Math?window:Function("return this")(),o="function"==typeof requestAnimationFrame?requestAnimationFrame.bind(r):function(t){return setTimeout(function(){return t(Date.now())},1e3/60)},i=2,s=["top","right","bottom","left","width","height","size","weight"],a="undefined"!=typeof MutationObserver,l=function(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=function(t,e){var n=!1,r=!1,s=0;function a(){n&&(n=!1,t()),r&&u()}function l(){o(a)}function u(){var t=Date.now();if(n){if(t-s<i)return;r=!0}else n=!0,r=!1,setTimeout(l,e);s=t}return u}(this.refresh.bind(this),20)};l.prototype.addObserver=function(t){~this.observers_.indexOf(t)||this.observers_.push(t),this.connected_||this.connect_()},l.prototype.removeObserver=function(t){var e=this.observers_,n=e.indexOf(t);~n&&e.splice(n,1),!e.length&&this.connected_&&this.disconnect_()},l.prototype.refresh=function(){this.updateObservers_()&&this.refresh()},l.prototype.updateObservers_=function(){var t=this.observers_.filter(function(t){return t.gatherActive(),t.hasActive()});return t.forEach(function(t){return t.broadcastActive()}),t.length>0},l.prototype.connect_=function(){n&&!this.connected_&&(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),a?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},l.prototype.disconnect_=function(){n&&this.connected_&&(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},l.prototype.onTransitionEnd_=function(t){var e=t.propertyName;void 0===e&&(e=""),s.some(function(t){return!!~e.indexOf(t)})&&this.refresh()},l.getInstance=function(){return this.instance_||(this.instance_=new l),this.instance_},l.instance_=null;var u=function(t,e){for(var n=0,r=Object.keys(e);n<r.length;n+=1){var o=r[n];Object.defineProperty(t,o,{value:e[o],enumerable:!1,writable:!1,configurable:!0})}return t},p=function(t){return t&&t.ownerDocument&&t.ownerDocument.defaultView||r},c=g(0,0,0,0);function h(t){return parseFloat(t)||0}function d(t){for(var e=[],n=arguments.length-1;n-- >0;)e[n]=arguments[n+1];return e.reduce(function(e,n){return e+h(t["border-"+n+"-width"])},0)}var f="undefined"!=typeof SVGGraphicsElement?function(t){return t instanceof p(t).SVGGraphicsElement}:function(t){return t instanceof p(t).SVGElement&&"function"==typeof t.getBBox};function y(t){return n?f(t)?function(t){var e=t.getBBox();return g(0,0,e.width,e.height)}(t):function(t){var e=t.clientWidth,n=t.clientHeight;if(!e&&!n)return c;var r=p(t).getComputedStyle(t),o=function(t){for(var e={},n=0,r=["top","right","bottom","left"];n<r.length;n+=1){var o=r[n],i=t["padding-"+o];e[o]=h(i)}return e}(r),i=o.left+o.right,s=o.top+o.bottom,a=h(r.width),l=h(r.height);if("border-box"===r.boxSizing&&(Math.round(a+i)!==e&&(a-=d(r,"left","right")+i),Math.round(l+s)!==n&&(l-=d(r,"top","bottom")+s)),!function(t){return t===p(t).document.documentElement}(t)){var u=Math.round(a+i)-e,f=Math.round(l+s)-n;1!==Math.abs(u)&&(a-=u),1!==Math.abs(f)&&(l-=f)}return g(o.left,o.top,a,l)}(t):c}function g(t,e,n,r){return{x:t,y:e,width:n,height:r}}var m=function(t){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=g(0,0,0,0),this.target=t};m.prototype.isActive=function(){var t=y(this.target);return this.contentRect_=t,t.width!==this.broadcastWidth||t.height!==this.broadcastHeight},m.prototype.broadcastRect=function(){var t=this.contentRect_;return this.broadcastWidth=t.width,this.broadcastHeight=t.height,t};var v=function(t,e){var n,r,o,i,s,a,l,p=(r=(n=e).x,o=n.y,i=n.width,s=n.height,a="undefined"!=typeof DOMRectReadOnly?DOMRectReadOnly:Object,l=Object.create(a.prototype),u(l,{x:r,y:o,width:i,height:s,top:o,right:r+i,bottom:s+o,left:r}),l);u(this,{target:t,contentRect:p})},b=function(t,n,r){if(this.activeObservations_=[],this.observations_=new e,"function"!=typeof t)throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=t,this.controller_=n,this.callbackCtx_=r};b.prototype.observe=function(t){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if("undefined"!=typeof Element&&Element instanceof Object){if(!(t instanceof p(t).Element))throw new TypeError('parameter 1 is not of type "Element".');var e=this.observations_;e.has(t)||(e.set(t,new m(t)),this.controller_.addObserver(this),this.controller_.refresh())}},b.prototype.unobserve=function(t){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if("undefined"!=typeof Element&&Element instanceof Object){if(!(t instanceof p(t).Element))throw new TypeError('parameter 1 is not of type "Element".');var e=this.observations_;e.has(t)&&(e.delete(t),e.size||this.controller_.removeObserver(this))}},b.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},b.prototype.gatherActive=function(){var t=this;this.clearActive(),this.observations_.forEach(function(e){e.isActive()&&t.activeObservations_.push(e)})},b.prototype.broadcastActive=function(){if(this.hasActive()){var t=this.callbackCtx_,e=this.activeObservations_.map(function(t){return new v(t.target,t.broadcastRect())});this.callback_.call(t,e,t),this.clearActive()}},b.prototype.clearActive=function(){this.activeObservations_.splice(0)},b.prototype.hasActive=function(){return this.activeObservations_.length>0};var w="undefined"!=typeof WeakMap?new WeakMap:new e,S=function(t){if(!(this instanceof S))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var e=l.getInstance(),n=new b(t,e,this);w.set(this,n)};return["observe","unobserve","disconnect"].forEach(function(t){S.prototype[t]=function(){return(e=w.get(this))[t].apply(e,arguments);var e}}),void 0!==r.ResizeObserver?r.ResizeObserver:S})}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{}),Ht=Ht.exports;var Wt={exports:{}};!function(){"use strict";var t={}.hasOwnProperty;function e(){for(var n=[],r=0;r<arguments.length;r++){var o=arguments[r];if(o){var i=typeof o;if("string"===i||"number"===i)n.push(o);else if(Array.isArray(o)&&o.length){var s=e.apply(null,o);s&&n.push(s)}else if("object"===i)for(var a in o)t.call(o,a)&&o[a]&&n.push(a)}}return n.join(" ")}Wt.exports?(e.default=e,Wt.exports=e):window.classNames=e}(),Wt=Wt.exports;var Xt,Vt={exports:{}};Xt=function(t){"use strict";function e(t){return t.attributes&&t.attributes.key}function n(t){return t.base}function r(t){return t&&t.filter(function(t){return null!==t})}function o(t,e){for(var n=t.length;n--;)if(e(t[n]))return!0;return!1}function i(t,n){return o(t,function(t){return e(t)===n})}function s(t,n){return i(t,e(n))}function a(t,n,r){return o(t,function(t){return e(t)===n&&t.props[r]})}function l(t,n,r){return a(t,e(n),r)}var u=" ",p=/[\n\t\r]+/g,c=function(t){return(u+t+u).replace(p,u)};function h(t,e){var n;t.classList?(n=t.classList).add.apply(n,e.split(" ")):t.className+=" "+e}function d(t,e){if(e=e.trim(),t.classList){var n;(n=t.classList).remove.apply(n,e.split(" "))}else{var r=t.className.trim(),o=c(r);for(e=u+e+u;o.indexOf(e)>=0;)o=o.replace(e,u);t.className=o.trim()}}var f={transitionend:{transition:"transitionend",WebkitTransition:"webkitTransitionEnd",MozTransition:"mozTransitionEnd",OTransition:"oTransitionEnd",msTransition:"MSTransitionEnd"},animationend:{animation:"animationend",WebkitAnimation:"webkitAnimationEnd",MozAnimation:"mozAnimationEnd",OAnimation:"oAnimationEnd",msAnimation:"MSAnimationEnd"}},y=[];"undefined"!=typeof window&&function(){var t=document.createElement("div").style;for(var e in"AnimationEvent"in window||delete f.animationend.animation,"TransitionEvent"in window||delete f.transitionend.transition,f){var n=f[e];for(var r in n)if(r in t){y.push(n[r]);break}}}();var g=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},m=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)},v=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e},b=function(t){function e(){var r,o;g(this,e);for(var i=arguments.length,s=Array(i),a=0;a<i;a++)s[a]=arguments[a];return r=o=v(this,t.call.apply(t,[this].concat(s))),o.flushClassNameQueue=function(){n(o)&&h(n(o),o.classNameQueue.join(" ")),o.classNameQueue.length=0,o.timeout=null},v(o,r)}return m(e,t),e.prototype.transition=function(t,e,r){var o=this,i=n(this),s=this.props.name[t]||this.props.name+"-"+t,a=this.props.name[t+"Active"]||s+"-active",l=null;this.endListener&&this.endListener(),this.endListener=function(t){t&&t.target!==i||(clearTimeout(l),d(i,s),d(i,a),function(t,e){y.length&&y.forEach(function(n){t.removeEventListener(n,e,!1)})}(i,o.endListener),o.endListener=null,e&&e())},r?(l=setTimeout(this.endListener,r),this.transitionTimeouts.push(l)):function(t,e){if(!y.length)return window.setTimeout(e,0);y.forEach(function(n){t.addEventListener(n,e,!1)})}(i,this.endListener),h(i,s),this.queueClass(a)},e.prototype.queueClass=function(t){this.classNameQueue.push(t),this.timeout||(this.timeout=setTimeout(this.flushClassNameQueue,17))},e.prototype.stop=function(){this.timeout&&(clearTimeout(this.timeout),this.classNameQueue.length=0,this.timeout=null),this.endListener&&this.endListener()},e.prototype.componentWillMount=function(){this.classNameQueue=[],this.transitionTimeouts=[]},e.prototype.componentWillUnmount=function(){this.timeout&&clearTimeout(this.timeout),this.transitionTimeouts.forEach(function(t){clearTimeout(t)})},e.prototype.componentWillEnter=function(t){this.props.enter?this.transition("enter",t,this.props.enterTimeout):t()},e.prototype.componentWillLeave=function(t){this.props.leave?this.transition("leave",t,this.props.leaveTimeout):t()},e.prototype.render=function(){return(t=this.props.children)&&t[0];var t},e}(t.Component),w=function(n){function o(r){g(this,o);var i=v(this,n.call(this));return i.renderChild=function(n){var r=i.props,o=r.transitionName,s=r.transitionEnter,a=r.transitionLeave,l=r.transitionEnterTimeout,u=r.transitionLeaveTimeout,p=e(n);return t.h(b,{key:p,ref:function(t){(i.refs[p]=t)||(n=null)},name:o,enter:s,leave:a,enterTimeout:l,leaveTimeout:u},n)},i.refs={},i.state={children:(r.children||[]).slice()},i}return m(o,n),o.prototype.shouldComponentUpdate=function(t,e){return e.children!==this.state.children},o.prototype.componentWillMount=function(){this.currentlyTransitioningKeys={},this.keysToEnter=[],this.keysToLeave=[]},o.prototype.componentWillReceiveProps=function(n){var o,a,u,p,c=this,h=n.children,d=n.exclusive,f=n.showProp,y=r(h||[]).slice(),g=r(d?this.props.children:this.state.children),m=(o=y,a=[],u={},p=[],g.forEach(function(t){var n=e(t);i(o,n)?p.length&&(u[n]=p,p=[]):p.push(t)}),o.forEach(function(t){var n=e(t);u.hasOwnProperty(n)&&(a=a.concat(u[n])),a.push(t)}),a.concat(p));f&&(m=m.map(function(e){var n;return!e.props[f]&&l(g,e,f)&&(e=t.cloneElement(e,((n={})[f]=!0,n))),e})),d&&m.forEach(function(t){return c.stop(e(t))}),this.setState({children:m}),this.forceUpdate(),y.forEach(function(t){var e=t.key,n=g&&s(g,t);if(f){if(n){var r=l(g,t,f),o=t.props[f];r||!o||c.currentlyTransitioningKeys[e]||c.keysToEnter.push(e)}}else n||c.currentlyTransitioningKeys[e]||c.keysToEnter.push(e)}),g.forEach(function(t){var e=t.key,n=y&&s(y,t);if(f){if(n){var r=l(y,t,f),o=t.props[f];r||!o||c.currentlyTransitioningKeys[e]||c.keysToLeave.push(e)}}else n||c.currentlyTransitioningKeys[e]||c.keysToLeave.push(e)})},o.prototype.performEnter=function(t){var e=this;this.currentlyTransitioningKeys[t]=!0;var n=this.refs[t];n.componentWillEnter?n.componentWillEnter(function(){return e._handleDoneEntering(t)}):this._handleDoneEntering(t)},o.prototype._handleDoneEntering=function(t){delete this.currentlyTransitioningKeys[t];var e=r(this.props.children),n=this.props.showProp;!e||!n&&!i(e,t)||n&&!a(e,t,n)?this.performLeave(t):this.setState({children:e})},o.prototype.stop=function(t){delete this.currentlyTransitioningKeys[t];var e=this.refs[t];e&&e.stop()},o.prototype.performLeave=function(t){var e=this;this.currentlyTransitioningKeys[t]=!0;var n=this.refs[t];n&&n.componentWillLeave?n.componentWillLeave(function(){return e._handleDoneLeaving(t)}):this._handleDoneLeaving(t)},o.prototype._handleDoneLeaving=function(t){delete this.currentlyTransitioningKeys[t];var e=this.props.showProp,n=r(this.props.children);e&&n&&a(n,t,e)?this.performEnter(t):!e&&n&&i(n,t)?this.performEnter(t):this.setState({children:n})},o.prototype.componentDidUpdate=function(){var t=this,e=this.keysToEnter,n=this.keysToLeave;this.keysToEnter=[],e.forEach(function(e){return t.performEnter(e)}),this.keysToLeave=[],n.forEach(function(e){return t.performLeave(e)})},o.prototype.render=function(e,n){var o=e.component,i=(e.transitionName,e.transitionEnter,e.transitionLeave,e.transitionEnterTimeout,e.transitionLeaveTimeout,e.children,function(t,e){var n={};for(var r in t)e.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n}(e,["component","transitionName","transitionEnter","transitionLeave","transitionEnterTimeout","transitionLeaveTimeout","children"])),s=n.children;return t.h(o,i,r(s).map(this.renderChild))},o}(t.Component);return w.defaultProps={component:"span",transitionEnter:!0,transitionLeave:!0},w},"object"==typeof Vt.exports?Vt.exports=Xt(A):this.PreactCSSTransitionGroup=Xt(this.preact),Vt=Vt.exports;var Gt=A.h,Kt=function(t){function e(n){!function(t,n){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this);var r=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.call(this,n));return r.handleClick=r.handleClick.bind(r),r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.handleClick=function(t){this.input.click()},e.prototype.render=function(){var t=this,e=Gt("button",{type:"button",class:"uppy-Dashboard-browse",onclick:this.handleClick},this.props.i18n("browse"));return Gt("div",{class:"uppy-Dashboard-dropFilesTitle"},0===this.props.acquirers.length?this.props.i18nArray("dropPaste",{browse:e}):this.props.i18nArray("dropPasteImport",{browse:e}),Gt("input",{class:"uppy-Dashboard-input",hidden:!0,"aria-hidden":"true",tabindex:-1,type:"file",name:"files[]",multiple:1!==this.props.maxNumberOfFiles,onchange:this.props.handleInputChange,accept:this.props.allowedFileTypes,value:"",ref:function(e){t.input=e}}))},e}(A.Component),Yt=A.h,Jt=function(){return Yt("svg",{"aria-hidden":"true",width:"30",height:"30",viewBox:"0 0 30 30"},Yt("path",{d:"M15 30c8.284 0 15-6.716 15-15 0-8.284-6.716-15-15-15C6.716 0 0 6.716 0 15c0 8.284 6.716 15 15 15zm4.258-12.676v6.846h-8.426v-6.846H5.204l9.82-12.364 9.82 12.364H19.26z"}))},$t=function(){return Yt("svg",{"aria-hidden":"true",class:"UppyIcon",width:"51",height:"51",viewBox:"0 0 51 51"},Yt("path",{d:"M17.21 45.765a5.394 5.394 0 0 1-7.62 0l-4.12-4.122a5.393 5.393 0 0 1 0-7.618l6.774-6.775-2.404-2.404-6.775 6.776c-3.424 3.427-3.424 9 0 12.426l4.12 4.123a8.766 8.766 0 0 0 6.216 2.57c2.25 0 4.5-.858 6.214-2.57l13.55-13.552a8.72 8.72 0 0 0 2.575-6.213 8.73 8.73 0 0 0-2.575-6.213l-4.123-4.12-2.404 2.404 4.123 4.12a5.352 5.352 0 0 1 1.58 3.81c0 1.438-.562 2.79-1.58 3.808l-13.55 13.55z"}),Yt("path",{d:"M44.256 2.858A8.728 8.728 0 0 0 38.043.283h-.002a8.73 8.73 0 0 0-6.212 2.574l-13.55 13.55a8.725 8.725 0 0 0-2.575 6.214 8.73 8.73 0 0 0 2.574 6.216l4.12 4.12 2.405-2.403-4.12-4.12a5.357 5.357 0 0 1-1.58-3.812c0-1.437.562-2.79 1.58-3.808l13.55-13.55a5.348 5.348 0 0 1 3.81-1.58c1.44 0 2.792.562 3.81 1.58l4.12 4.12c2.1 2.1 2.1 5.518 0 7.617L39.2 23.775l2.404 2.404 6.775-6.777c3.426-3.427 3.426-9 0-12.426l-4.12-4.12z"}))},Qt=function(){return Yt("svg",{"aria-hidden":"true",class:"UppyIcon retry",width:"28",height:"31",viewBox:"0 0 16 19",xmlns:"http://www.w3.org/2000/svg"},Yt("path",{d:"M16 11a8 8 0 1 1-8-8v2a6 6 0 1 0 6 6h2z"}),Yt("path",{d:"M7.9 3H10v2H7.9z"}),Yt("path",{d:"M8.536.5l3.535 3.536-1.414 1.414L7.12 1.914z"}),Yt("path",{d:"M10.657 2.621l1.414 1.415L8.536 7.57 7.12 6.157z"}))},Zt=function(){return Yt("svg",{"aria-hidden":"true",class:"UppyIcon",width:"55",height:"55",viewBox:"0 0 55 55"},Yt("path",{d:"M52.66.25c-.216-.19-.5-.276-.79-.242l-31 4.01a1 1 0 0 0-.87.992V40.622C18.174 38.428 15.273 37 12 37c-5.514 0-10 4.037-10 9s4.486 9 10 9 10-4.037 10-9c0-.232-.02-.46-.04-.687.014-.065.04-.124.04-.192V16.12l29-3.753v18.257C49.174 28.428 46.273 27 43 27c-5.514 0-10 4.037-10 9s4.486 9 10 9c5.464 0 9.913-3.966 9.993-8.867 0-.013.007-.024.007-.037V1a.998.998 0 0 0-.34-.75zM12 53c-4.41 0-8-3.14-8-7s3.59-7 8-7 8 3.14 8 7-3.59 7-8 7zm31-10c-4.41 0-8-3.14-8-7s3.59-7 8-7 8 3.14 8 7-3.59 7-8 7zM22 14.1V5.89l29-3.753v8.21l-29 3.754z"}))},te=function(){return Yt("svg",{"aria-hidden":"true",class:"UppyIcon",viewBox:"0 0 58 58"},Yt("path",{d:"M36.537 28.156l-11-7a1.005 1.005 0 0 0-1.02-.033C24.2 21.3 24 21.635 24 22v14a1 1 0 0 0 1.537.844l11-7a1.002 1.002 0 0 0 0-1.688zM26 34.18V23.82L34.137 29 26 34.18z"}),Yt("path",{d:"M57 6H1a1 1 0 0 0-1 1v44a1 1 0 0 0 1 1h56a1 1 0 0 0 1-1V7a1 1 0 0 0-1-1zM10 28H2v-9h8v9zm-8 2h8v9H2v-9zm10 10V8h34v42H12V40zm44-12h-8v-9h8v9zm-8 2h8v9h-8v-9zm8-22v9h-8V8h8zM2 8h8v9H2V8zm0 42v-9h8v9H2zm54 0h-8v-9h8v9z"}))},ee=function(){return Yt("svg",{"aria-hidden":"true",class:"UppyIcon",viewBox:"0 0 342 335"},Yt("path",{d:"M329.337 227.84c-2.1 1.3-8.1 2.1-11.9 2.1-12.4 0-27.6-5.7-49.1-14.9 8.3-.6 15.8-.9 22.6-.9 12.4 0 16 0 28.2 3.1 12.1 3 12.2 9.3 10.2 10.6zm-215.1 1.9c4.8-8.4 9.7-17.3 14.7-26.8 12.2-23.1 20-41.3 25.7-56.2 11.5 20.9 25.8 38.6 42.5 52.8 2.1 1.8 4.3 3.5 6.7 5.3-34.1 6.8-63.6 15-89.6 24.9zm39.8-218.9c6.8 0 10.7 17.06 11 33.16.3 16-3.4 27.2-8.1 35.6-3.9-12.4-5.7-31.8-5.7-44.5 0 0-.3-24.26 2.8-24.26zm-133.4 307.2c3.9-10.5 19.1-31.3 41.6-49.8 1.4-1.1 4.9-4.4 8.1-7.4-23.5 37.6-39.3 52.5-49.7 57.2zm315.2-112.3c-6.8-6.7-22-10.2-45-10.5-15.6-.2-34.3 1.2-54.1 3.9-8.8-5.1-17.9-10.6-25.1-17.3-19.2-18-35.2-42.9-45.2-70.3.6-2.6 1.2-4.8 1.7-7.1 0 0 10.8-61.5 7.9-82.3-.4-2.9-.6-3.7-1.4-5.9l-.9-2.5c-2.9-6.76-8.7-13.96-17.8-13.57l-5.3-.17h-.1c-10.1 0-18.4 5.17-20.5 12.84-6.6 24.3.2 60.5 12.5 107.4l-3.2 7.7c-8.8 21.4-19.8 43-29.5 62l-1.3 2.5c-10.2 20-19.5 37-27.9 51.4l-8.7 4.6c-.6.4-15.5 8.2-19 10.3-29.6 17.7-49.28 37.8-52.54 53.8-1.04 5-.26 11.5 5.01 14.6l8.4 4.2c3.63 1.8 7.53 2.7 11.43 2.7 21.1 0 45.6-26.2 79.3-85.1 39-12.7 83.4-23.3 122.3-29.1 29.6 16.7 66 28.3 89 28.3 4.1 0 7.6-.4 10.5-1.2 4.4-1.1 8.1-3.6 10.4-7.1 4.4-6.7 5.4-15.9 4.1-25.4-.3-2.8-2.6-6.3-5-8.7z"}))},ne=function(){return Yt("svg",{"aria-hidden":"true",class:"UppyIcon",width:"62",height:"62",viewBox:"0 0 62 62",xmlns:"http://www.w3.org/2000/svg"},Yt("path",{d:"M4.309 4.309h24.912v53.382h-6.525v3.559h16.608v-3.559h-6.525V4.309h24.912v10.676h3.559V.75H.75v14.235h3.559z","fill-rule":"nonzero",fill:"#000"}))},re=function(){return Yt("svg",{"aria-hidden":"true",fill:"#607d8b",width:"27",height:"25",viewBox:"0 0 27 25"},Yt("path",{d:"M5.586 9.288a.313.313 0 0 0 .282.176h4.84v3.922c0 1.514 1.25 2.24 2.792 2.24 1.54 0 2.79-.726 2.79-2.24V9.464h4.84c.122 0 .23-.068.284-.176a.304.304 0 0 0-.046-.324L13.735.106a.316.316 0 0 0-.472 0l-7.63 8.857a.302.302 0 0 0-.047.325z"}),Yt("path",{d:"M24.3 5.093c-.218-.76-.54-1.187-1.208-1.187h-4.856l1.018 1.18h3.948l2.043 11.038h-7.193v2.728H9.114v-2.725h-7.36l2.66-11.04h3.33l1.018-1.18H3.907c-.668 0-1.06.46-1.21 1.186L0 16.456v7.062C0 24.338.676 25 1.51 25h23.98c.833 0 1.51-.663 1.51-1.482v-7.062L24.3 5.093z"}))},oe=A.h,ie=A.Component,se=function(t){function e(n){!function(t,n){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this);var r=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.call(this,n));return r.handleClick=r.handleClick.bind(r),r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.handleClick=function(t){this.input.click()},e.prototype.render=function(){var t=this,e=0!==this.props.acquirers.length;return oe("div",{class:"uppy-DashboarAddFiles"},e?oe("div",{class:"uppy-DashboardTabs"},oe(Kt,{acquirers:this.props.acquirers,handleInputChange:this.props.handleInputChange,i18n:this.props.i18n,i18nArray:this.props.i18nArray,allowedFileTypes:this.props.allowedFileTypes,maxNumberOfFiles:this.props.maxNumberOfFiles}),oe("div",{class:"uppy-DashboardTabs-list",role:"tablist"},oe("div",{class:"uppy-DashboardTab",role:"presentation"},oe("button",{type:"button",class:"uppy-DashboardTab-btn",role:"tab",tabindex:0,onclick:this.handleClick},re(),oe("div",{class:"uppy-DashboardTab-name"},this.props.i18n("myDevice"))),oe("input",{class:"uppy-Dashboard-input",hidden:!0,"aria-hidden":"true",tabindex:-1,type:"file",name:"files[]",multiple:1!==this.props.maxNumberOfFiles,accept:this.props.allowedFileTypes,onchange:this.props.handleInputChange,value:"",ref:function(e){t.input=e}})),this.props.acquirers.map(function(e){return oe("div",{class:"uppy-DashboardTab",role:"presentation"},oe("button",{class:"uppy-DashboardTab-btn",type:"button",role:"tab",tabindex:0,"aria-controls":"uppy-DashboardContent-panel--"+e.id,"aria-selected":t.props.activePanel.id===e.id,onclick:function(){return t.props.showPanel(e.id)}},e.icon(),oe("div",{class:"uppy-DashboardTab-name"},e.name)))}))):oe("div",{class:"uppy-DashboardTabs"},oe(Kt,{acquirers:this.props.acquirers,handleInputChange:this.props.handleInputChange,i18n:this.props.i18n,i18nArray:this.props.i18nArray,allowedFileTypes:this.props.allowedFileTypes,maxNumberOfFiles:this.props.maxNumberOfFiles})),oe("div",{class:"uppy-DashboarAddFiles-info"},this.props.note&&oe("div",{class:"uppy-Dashboard-note"},this.props.note),this.props.proudlyDisplayPoweredByUppy&&(this.props,oe("a",{tabindex:"-1",href:"https://uppy.io",rel:"noreferrer noopener",target:"_blank",class:"uppy-Dashboard-poweredBy"},"Powered by ",oe("svg",{"aria-hidden":"true",class:"UppyIcon uppy-Dashboard-poweredByIcon",width:"11",height:"11",viewBox:"0 0 11 11",xmlns:"http://www.w3.org/2000/svg"},oe("path",{d:"M7.365 10.5l-.01-4.045h2.612L5.5.806l-4.467 5.65h2.604l.01 4.044h3.718z","fill-rule":"evenodd"})),oe("span",{class:"uppy-Dashboard-poweredByUppy"},"Uppy")))))},e}(ie),ae=A.h,le=function(t){return ae("div",{class:"uppy-Dashboard-AddFilesPanel","aria-hidden":t.showAddFilesPanel},ae("div",{class:"uppy-DashboardContent-bar"},ae("div",{class:"uppy-DashboardContent-title",role:"heading","aria-level":"h1"},t.i18n("addingMoreFiles")),ae("button",{class:"uppy-DashboardContent-back",type:"button",onclick:function(e){return t.toggleAddFilesPanel(!1)}},t.i18n("back"))),ae(se,t))},ue=ne,pe=Zt,ce=te,he=ee,de=function(t){var e={color:"#cbcbcb",icon:""};if(!t)return e;var n=t.split("/")[0],r=t.split("/")[1];return"text"===n?{color:"#cbcbcb",icon:ue()}:"audio"===n?{color:"#1abc9c",icon:pe()}:"video"===n?{color:"#2980b9",icon:ce()}:"application"===n&&"pdf"===r?{color:"#e74c3c",icon:he()}:"image"===n?{color:"#f2f2f2",icon:""}:e},fe=A.h,ye=function(t){var e=t.file;if(e.preview)return fe("img",{class:"uppy-DashboardItem-previewImg",alt:e.name,src:e.preview});var n=de(e.type),r=n.color,o=n.icon;return fe("div",{class:"uppy-DashboardItem-previewIconWrap"},fe("span",{class:"uppy-DashboardItem-previewIcon",style:{color:r}},o),fe("svg",{class:"uppy-DashboardItem-previewIconBg",width:"72",height:"93",viewBox:"0 0 72 93"},fe("g",null,fe("path",{d:"M24.08 5h38.922A2.997 2.997 0 0 1 66 8.003v74.994A2.997 2.997 0 0 1 63.004 86H8.996A2.998 2.998 0 0 1 6 83.01V22.234L24.08 5z",fill:"#FFF"}),fe("path",{d:"M24 5L6 22.248h15.007A2.995 2.995 0 0 0 24 19.244V5z",fill:"#E4E4E4"}))))},ge=function(t){var e=t.target.tagName;"INPUT"!==e&&"TEXTAREA"!==e?(t.preventDefault(),t.stopPropagation()):t.stopPropagation()},me=A.h,ve=function(t){function e(n){!function(t,n){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this);var r=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.call(this,n));return r.meta={},r.tempStoreMetaOrSubmit=r.tempStoreMetaOrSubmit.bind(r),r.renderMetaFields=r.renderMetaFields.bind(r),r.handleSave=r.handleSave.bind(r),r.handleCancel=r.handleCancel.bind(r),r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.componentDidMount=function(){var t=this;setTimeout(function(){t.firstInput&&t.firstInput.focus({preventScroll:!0})},150)},e.prototype.tempStoreMetaOrSubmit=function(t){var e=this.props.files[this.props.fileCardFor];if(13===t.keyCode)return t.stopPropagation(),t.preventDefault(),void this.props.saveFileCard(this.meta,e.id);var n=t.target.value,r=t.target.dataset.name;this.meta[r]=n},e.prototype.renderMetaFields=function(t){var e=this;return(this.props.metaFields||[]).map(function(n,r){return me("fieldset",{class:"uppy-DashboardFileCard-fieldset"},me("label",{class:"uppy-DashboardFileCard-label"},n.name),me("input",{class:"uppy-c-textInput uppy-DashboardFileCard-input",type:"text","data-name":n.id,value:t.meta[n.id],placeholder:n.placeholder,onkeyup:e.tempStoreMetaOrSubmit,onkeydown:e.tempStoreMetaOrSubmit,onkeypress:e.tempStoreMetaOrSubmit,ref:function(t){0===r&&(e.firstInput=t)}}))})},e.prototype.handleSave=function(t){var e=this.props.fileCardFor;this.props.saveFileCard(this.meta,e)},e.prototype.handleCancel=function(t){this.meta={},this.props.toggleFileCard()},e.prototype.render=function(){var t=this.props.files[this.props.fileCardFor];return me("div",{class:"uppy-DashboardFileCard",onDragOver:ge,onDragLeave:ge,onDrop:ge,onPaste:ge},me("div",{class:"uppy-DashboardContent-bar"},me("div",{class:"uppy-DashboardContent-title",role:"heading","aria-level":"h1"},this.props.i18nArray("editing",{file:me("span",{class:"uppy-DashboardContent-titleFile"},t.meta?t.meta.name:t.name)})),me("button",{class:"uppy-DashboardContent-back",type:"button",title:this.props.i18n("finishEditingFile"),onclick:this.handleSave},this.props.i18n("done"))),me("div",{class:"uppy-DashboardFileCard-inner"},me("div",{class:"uppy-DashboardFileCard-preview",style:{backgroundColor:de(t.type).color}},me(ye,{file:t})),me("div",{class:"uppy-DashboardFileCard-info"},this.renderMetaFields(t)),me("div",{class:"uppy-Dashboard-actions"},me("button",{class:"uppy-u-reset uppy-c-btn uppy-c-btn-primary uppy-Dashboard-actionsBtn",type:"button",onclick:this.handleSave},this.props.i18n("saveChanges")),me("button",{class:"uppy-u-reset uppy-c-btn uppy-c-btn-link uppy-Dashboard-actionsBtn",type:"button",onclick:this.handleCancel},this.props.i18n("cancel")))))},e}(A.Component),be=A.h,we=2*Math.PI*15,Se=function(t){return be("svg",{width:"70",height:"70",viewBox:"0 0 36 36",class:"UppyIcon UppyIcon-progressCircle"},be("g",{class:"progress-group"},be("circle",{class:"bg",r:"15",cx:"18",cy:"18","stroke-width":"2",fill:"none"}),be("circle",{class:"progress",r:"15",cx:"18",cy:"18",transform:"rotate(-90, 18, 18)","stroke-width":"2",fill:"none","stroke-dasharray":we,"stroke-dashoffset":we-we/100*t.progress})),t.hidePauseResumeCancelButtons||t.bundled?null:be("g",null,be("polygon",{class:"play",transform:"translate(3, 3)",points:"12 20 12 10 20 15"}),be("g",{class:"pause",transform:"translate(14.5, 13)"},be("rect",{x:"0",y:"0",width:"2",height:"10",rx:"0"}),be("rect",{x:"5",y:"0",width:"2",height:"10",rx:"0"})),be("polygon",{class:"cancel",transform:"translate(2, 2)",points:"19.8856516 11.0625 16 14.9481516 12.1019737 11.0625 11.0625 12.1143484 14.9481516 16 11.0625 19.8980263 12.1019737 20.9375 16 17.0518484 19.8856516 20.9375 20.9375 19.8980263 17.0518484 16 20.9375 12"})),be("polygon",{class:"check",transform:"translate(2, 3)",points:"14 22.5 7 15.2457065 8.99985857 13.1732815 14 18.3547104 22.9729883 9 25 11.1005634"}))},_e=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Pe=$t,Ee=Qt,ke=A.h;function Ce(t){if(!t.hideRetryButton||!t.error)return t.isUploaded||t.bundled||t.hidePauseResumeCancelButtons&&!t.error?ke("div",{class:"uppy-DashboardItem-progressIndicator"},ke(Se,{progress:t.file.progress.percentage,fileID:t.file.id,hidePauseResumeCancelButtons:t.hidePauseResumeCancelButtons,bundled:t.bundled})):ke("button",{class:"uppy-DashboardItem-progressIndicator",type:"button","aria-label":t.progressIndicatorTitle,title:t.progressIndicatorTitle,onclick:t.onPauseResumeCancelRetry},t.error?t.hideRetryButton?null:Ee():ke(Se,{progress:t.file.progress.percentage,fileID:t.file.id,hidePauseResumeCancelButtons:t.hidePauseResumeCancelButtons}))}var Te=function(t){var e,n,r=t.file,o=t.acquirers,i=r.progress.preprocess||r.progress.postprocess,s=r.progress.uploadComplete&&!i&&!r.error,a=r.progress.uploadStarted||i,l=r.progress.uploadStarted&&!r.progress.uploadComplete||i,u=r.isPaused||!1,p=r.error||!1,c=X(r.meta.name).name,h=t.isWide?(n=30,(e=c).length>n?e.substr(0,n/2)+"..."+e.substr(e.length-n/4,e.length):e):c,d=Wt("uppy-DashboardItem",{"is-inprogress":l},{"is-processing":i},{"is-complete":s},{"is-paused":u},{"is-error":p},{"is-resumable":t.resumableUploads},{"is-bundled":t.bundledUpload});return ke("li",{class:d,id:"uppy_"+r.id,title:r.meta.name},ke("div",{class:"uppy-DashboardItem-preview"},ke("div",{class:"uppy-DashboardItem-previewInnerWrap",style:{backgroundColor:de(r.type).color}},t.showLinkToFileUploadResult&&r.uploadURL?ke("a",{class:"uppy-DashboardItem-previewLink",href:r.uploadURL,rel:"noreferrer noopener",target:"_blank"}):null,ke(ye,{file:r})),ke("div",{class:"uppy-DashboardItem-progress"},ke(Ce,_e({progressIndicatorTitle:function(t){return s?t.i18n("uploadComplete"):p?t.i18n("retryUpload"):t.resumableUploads?r.isPaused?t.i18n("resumeUpload"):t.i18n("pauseUpload"):t.i18n("cancelUpload")}(t),onPauseResumeCancelRetry:function(e){s||(!p||t.hideRetryButton?t.hidePauseResumeCancelButtons||(t.resumableUploads?t.pauseUpload(r.id):t.cancelUpload(r.id)):t.retryUpload(r.id))},file:r,error:p},t)))),ke("div",{class:"uppy-DashboardItem-info"},ke("div",{class:"uppy-DashboardItem-name",title:c},t.showLinkToFileUploadResult&&r.uploadURL?ke("a",{href:r.uploadURL,rel:"noreferrer noopener",target:"_blank"},r.extension?h+"."+r.extension:h):r.extension?h+"."+r.extension:h),ke("div",{class:"uppy-DashboardItem-status"},r.data.size?ke("div",{class:"uppy-DashboardItem-statusSize"},F(r.data.size)):null,r.source&&r.source!==t.id&&ke("div",{class:"uppy-DashboardItem-sourceIcon"},o.map(function(e){if(e.id===r.source)return ke("span",{title:t.i18n("fileSource",{name:e.name})},e.icon())})),!a&&t.metaFields&&t.metaFields.length?ke("button",{class:"uppy-DashboardItem-edit",type:"button","aria-label":t.i18n("editFile"),title:t.i18n("editFile"),onclick:function(e){return t.toggleFileCard(r.id)}},t.i18n("edit")):null,t.showLinkToFileUploadResult&&r.uploadURL?ke("button",{class:"uppy-DashboardItem-copyLink",type:"button","aria-label":t.i18n("copyLink"),title:t.i18n("copyLink"),onclick:function(){var e,n;(e=r.uploadURL,n=t.i18n("copyLinkToClipboardFallback"),n=n||"Copy the URL below",new Promise(function(t){var r=document.createElement("textarea");r.setAttribute("style",{position:"fixed",top:0,left:0,width:"2em",height:"2em",padding:0,border:"none",outline:"none",boxShadow:"none",background:"transparent"}),r.value=e,document.body.appendChild(r),r.select();var o=function(){document.body.removeChild(r),window.prompt(n,e),t()};try{return document.execCommand("copy")?(document.body.removeChild(r),t()):o()}catch(t){return document.body.removeChild(r),o()}})).then(function(){t.log("Link copied to clipboard."),t.info(t.i18n("copyLinkToClipboardSuccess"),"info",3e3)}).catch(t.log)}},Pe()):"")),ke("div",{class:"uppy-DashboardItem-action"},!s&&ke("button",{class:"uppy-DashboardItem-remove",type:"button","aria-label":t.i18n("removeFile"),title:t.i18n("removeFile"),onclick:function(){return t.removeFile(r.id)}},ke("svg",{"aria-hidden":"true",class:"UppyIcon",width:"60",height:"60",viewBox:"0 0 60 60",xmlns:"http://www.w3.org/2000/svg"},ke("path",{stroke:"#FFF","stroke-width":"1","fill-rule":"nonzero","vector-effect":"non-scaling-stroke",d:"M30 1C14 1 1 14 1 30s13 29 29 29 29-13 29-29S46 1 30 1z"}),ke("path",{fill:"#FFF","vector-effect":"non-scaling-stroke",d:"M42 39.667L39.667 42 30 32.333 20.333 42 18 39.667 27.667 30 18 20.333 20.333 18 30 27.667 39.667 18 42 20.333 32.333 30z"})))))},Oe=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Ue=A.h,Fe=function(t){var e=0===t.totalFileCount,n=Wt("uppy-Dashboard-files",{"uppy-Dashboard-files--noFiles":e});return Ue("ul",{class:n},Object.keys(t.files).map(function(e){return Ue(Te,Oe({},t,{acquirers:t.acquirers,file:t.files[e]}))}))},Ae=A.h,xe=function(t){return Ae("div",{class:"uppy-DashboardContent-panel",role:"tabpanel",id:t.activePanel&&"uppy-DashboardContent-panel--"+t.activePanel.id,onDragOver:ge,onDragLeave:ge,onDrop:ge,onPaste:ge},Ae("div",{class:"uppy-DashboardContent-bar"},Ae("div",{class:"uppy-DashboardContent-title",role:"heading","aria-level":"h1"},t.i18n("importFrom",{name:t.activePanel.name})),Ae("button",{class:"uppy-DashboardContent-back",type:"button",onclick:t.hideAllPanels},t.i18n("done"))),Ae("div",{class:"uppy-DashboardContent-panelBody"},t.getPlugin(t.activePanel.id).render(t.state)))},De=A.h;function Re(t){if(t.newFiles.length)return t.i18n("xFilesSelected",{smart_count:t.newFiles.length})}var Ie=function(t){var e=!t.maxNumberOfFiles||t.totalFileCount<t.maxNumberOfFiles;return De("div",{class:"uppy-DashboardContent-bar"},De("button",{class:"uppy-DashboardContent-back",type:"button",onclick:t.cancelAll},t.i18n("cancel")),De("div",{class:"uppy-DashboardContent-title",role:"heading","aria-level":"h1"},De(Re,t)),e&&De("button",{class:"uppy-DashboardContent-addMore",type:"button","aria-label":t.i18n("addMoreFiles"),title:t.i18n("addMoreFiles"),onclick:function(){return t.toggleAddFilesPanel(!0)}},De("svg",{class:"UppyIcon",width:"15",height:"15",viewBox:"0 0 13 13",version:"1.1",xmlns:"http://www.w3.org/2000/svg"},De("path",{d:"M7,6 L13,6 L13,7 L7,7 L7,13 L6,13 L6,7 L0,7 L0,6 L6,6 L6,0 L7,0 L7,6 Z"}))))},Be=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},je=A.h,Le=function(t){var e=0===t.totalFileCount,n=Wt({"uppy-Root":t.isTargetDOMEl},"uppy-Dashboard",{"Uppy--isTouchDevice":"ontouchstart"in window||navigator.maxTouchPoints},{"uppy-Dashboard--animateOpenClose":t.animateOpenClose},{"uppy-Dashboard--isClosing":t.isClosing},{"uppy-Dashboard--modal":!t.inline},{"uppy-size--md":t.containerWidth>576},{"uppy-size--lg":t.containerWidth>700},{"uppy-Dashboard--isAddFilesPanelVisible":t.showAddFilesPanel});return je("div",{class:n,"aria-hidden":t.inline?"false":t.modal.isHidden,"aria-label":t.inline?t.i18n("dashboardTitle"):t.i18n("dashboardWindowTitle"),onpaste:t.handlePaste},je("div",{class:"uppy-Dashboard-overlay",tabindex:-1,onclick:t.handleClickOutside}),je("div",{class:"uppy-Dashboard-inner","aria-modal":!t.inline&&"true",role:!t.inline&&"dialog",style:{width:t.inline&&t.width?t.width:"",height:t.inline&&t.height?t.height:""}},je("button",{class:"uppy-Dashboard-close",type:"button","aria-label":t.i18n("closeModal"),title:t.i18n("closeModal"),onclick:t.closeModal},je("span",{"aria-hidden":"true"},"\xd7")),je("div",{class:"uppy-Dashboard-innerWrap"},!e&&t.showSelectedFiles&&je(Ie,t),t.showSelectedFiles?je(e?se:Fe,t):je(se,t),je(Vt,{transitionName:"uppy-transition-slideDownUp",transitionEnterTimeout:250,transitionLeaveTimeout:250},t.showAddFilesPanel?je(le,Be({key:"AddFilesPanel"},t)):null),je(Vt,{transitionName:"uppy-transition-slideDownUp",transitionEnterTimeout:250,transitionLeaveTimeout:250},t.fileCardFor?je(ve,Be({key:"FileCard"},t)):null),je(Vt,{transitionName:"uppy-transition-slideDownUp",transitionEnterTimeout:250,transitionLeaveTimeout:250},t.activePanel?je(xe,Be({key:"PanelContent"},t)):null),je("div",{class:"uppy-Dashboard-progressindicators"},t.progressindicators.map(function(e){return t.getPlugin(e.id).render(t.state)})))))},Me=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Ne=Y.Plugin,ze=A.h,qe=function(t){function e(n,r){!function(t,n){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this);var o=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.call(this,n,r));return o.type="progressindicator",o.id=o.opts.id||"Informer",o.title="Informer",o.opts=Me({},{typeColors:{info:{text:"#fff",bg:"#000"},warning:{text:"#fff",bg:"#F6A623"},error:{text:"#fff",bg:"#D32F2F"},success:{text:"#fff",bg:"#1BB240"}}},r),o.render=o.render.bind(o),o}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.render=function(t){var e=t.info,n=e.isHidden,r=e.message,o=e.details;return ze("div",{class:"uppy uppy-Informer","aria-hidden":n},ze("p",{role:"alert"},r," ",o&&ze("span",{"aria-label":o,"data-microtip-position":"top","data-microtip-size":"large",role:"tooltip"},"?")))},e.prototype.install=function(){var t=this.opts.target;t&&this.mount(t,this)},e}(Ne),He="error",We="waiting",Xe="preprocessing",Ve="uploading",Ge="postprocessing",Ke="complete",Ye=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Je=A.h,$e=function(t){var e=Wt("uppy-u-reset","uppy-c-btn","uppy-StatusBar-actionBtn","uppy-StatusBar-actionBtn--upload",{"uppy-c-btn-primary":t.uploadState===We});return Je("button",{type:"button",class:e,"aria-label":t.i18n("uploadXFiles",{smart_count:t.newFiles}),onclick:t.startUpload},t.newFiles&&t.uploadStarted?t.i18n("uploadXNewFiles",{smart_count:t.newFiles}):t.i18n("uploadXFiles",{smart_count:t.newFiles}))},Qe=function(t){return Je("button",{type:"button",class:"uppy-u-reset uppy-c-btn uppy-StatusBar-actionBtn uppy-StatusBar-actionBtn--retry","aria-label":t.i18n("retryUpload"),onclick:t.retryAll},t.i18n("retry"))},Ze=function(t){return Je("button",{type:"button",class:"uppy-u-reset uppy-c-btn uppy-StatusBar-actionBtn uppy-StatusBar-actionBtn--cancel","aria-label":t.i18n("cancel"),onclick:t.cancelAll},t.i18n("cancel"))},tn=function(t){var e=t.resumableUploads,n=t.isAllPaused,r=(0,t.i18n)(e?n?"resumeUpload":"pauseUpload":"cancelUpload");return Je("button",{title:r,class:"uppy-u-reset uppy-StatusBar-statusIndicator",type:"button",onclick:function(){return function(t){if(!t.isAllComplete)return t.resumableUploads?t.isAllPaused?t.resumeAll():t.pauseAll():t.cancelAll()}(t)}},e?n?Je("svg",{"aria-hidden":"true",class:"UppyIcon",width:"15",height:"17",viewBox:"0 0 11 13"},Je("path",{d:"M1.26 12.534a.67.67 0 0 1-.674.012.67.67 0 0 1-.336-.583v-11C.25.724.38.5.586.382a.658.658 0 0 1 .673.012l9.165 5.5a.66.66 0 0 1 .325.57.66.66 0 0 1-.325.573l-9.166 5.5z"})):Je("svg",{"aria-hidden":"true",class:"UppyIcon",width:"16",height:"17",viewBox:"0 0 12 13"},Je("path",{d:"M4.888.81v11.38c0 .446-.324.81-.722.81H2.722C2.324 13 2 12.636 2 12.19V.81c0-.446.324-.81.722-.81h1.444c.398 0 .722.364.722.81zM9.888.81v11.38c0 .446-.324.81-.722.81H7.722C7.324 13 7 12.636 7 12.19V.81c0-.446.324-.81.722-.81h1.444c.398 0 .722.364.722.81z"})):Je("svg",{"aria-hidden":"true",class:"UppyIcon",width:"16px",height:"16px",viewBox:"0 0 19 19"},Je("path",{d:"M17.318 17.232L9.94 9.854 9.586 9.5l-.354.354-7.378 7.378h.707l-.62-.62v.706L9.318 9.94l.354-.354-.354-.354L1.94 1.854v.707l.62-.62h-.706l7.378 7.378.354.354.354-.354 7.378-7.378h-.707l.622.62v-.706L9.854 9.232l-.354.354.354.354 7.378 7.378.708-.707-7.38-7.378v.708l7.38-7.38.353-.353-.353-.353-.622-.622-.353-.353-.354.352-7.378 7.38h.708L2.56 1.23 2.208.88l-.353.353-.622.62-.353.355.352.353 7.38 7.38v-.708l-7.38 7.38-.353.353.352.353.622.622.353.353.354-.353 7.38-7.38h-.708l7.38 7.38z"})))},en=function(t){var e=Math.round(100*t.value);return Je("div",{class:"uppy-StatusBar-content"},"determinate"===t.mode?e+"% \xb7 ":"",t.message)},nn=et(function(t){return Je("div",{class:"uppy-StatusBar-statusSecondary"},t.numUploads>1&&t.i18n("filesUploadedOfTotal",{complete:t.complete,smart_count:t.numUploads})+" \xb7 ",t.i18n("dataUploadedOfTotal",{complete:t.totalUploadedSize,total:t.totalSize})+" \xb7 ",t.i18n("xTimeLeft",{time:t.totalETA}))},500,{leading:!0,trailing:!0}),rn=function(t){if(!t.isUploadStarted||t.isAllComplete)return null;var e=t.isAllPaused?t.i18n("paused"):t.i18n("uploading");return Je("div",{class:"uppy-StatusBar-content","aria-label":e,title:e},!t.hidePauseResumeCancelButtons&&Je(tn,t),Je("div",{class:"uppy-StatusBar-status"},Je("div",{class:"uppy-StatusBar-statusPrimary"},e,": ",t.totalProgress,"%"),!t.isAllPaused&&Je(nn,t)))},on=function(t){t.totalProgress;var e=t.i18n;return Je("div",{class:"uppy-StatusBar-content",role:"status",title:e("complete")},Je("svg",{"aria-hidden":"true",class:"uppy-StatusBar-statusIndicator UppyIcon",width:"18",height:"17",viewBox:"0 0 23 17"},Je("path",{d:"M8.944 17L0 7.865l2.555-2.61 6.39 6.525L20.41 0 23 2.645z"})),e("complete"))},sn=function(t){var e=t.error,n=(t.retryAll,t.hideRetryButton),r=t.i18n;return Je("div",{class:"uppy-StatusBar-content",role:"alert"},Je("span",{class:"uppy-StatusBar-contentPadding"},r("uploadFailed"),"."),!n&&Je("span",{class:"uppy-StatusBar-contentPadding"},r("pleasePressRetry")),Je("span",{class:"uppy-StatusBar-details","aria-label":e,"data-microtip-position":"top","data-microtip-size":"large",role:"tooltip"},"?"))},an=function(t){var e,n=(e=t,{hours:Math.floor(e/3600)%24,minutes:Math.floor(e/60)%60,seconds:Math.floor(e%60)}),r=n.hours?n.hours+"h ":"",o=n.hours?("0"+n.minutes).substr(-2):n.minutes;return r+(o?o+"m ":"")+(o?("0"+n.seconds).substr(-2):n.seconds)+"s"},ln=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},un=function(t){function e(n,r){!function(t,n){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this);var o=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.call(this,n,r));o.id=o.opts.id||"StatusBar",o.title="StatusBar",o.type="progressindicator";var i={strings:{uploading:"Uploading",complete:"Complete",uploadFailed:"Upload failed",pleasePressRetry:"Please press Retry to upload again",paused:"Paused",error:"Error",retry:"Retry",cancel:"Cancel",pressToRetry:"Press to retry",retryUpload:"Retry upload",resumeUpload:"Resume upload",cancelUpload:"Cancel upload",pauseUpload:"Pause upload",filesUploadedOfTotal:{0:"%{complete} of %{smart_count} file uploaded",1:"%{complete} of %{smart_count} files uploaded"},dataUploadedOfTotal:"%{complete} of %{total}",xTimeLeft:"%{time} left",uploadXFiles:{0:"Upload %{smart_count} file",1:"Upload %{smart_count} files"},uploadXNewFiles:{0:"Upload +%{smart_count} file",1:"Upload +%{smart_count} files"}}},s={target:"body",hideUploadButton:!1,hideRetryButton:!1,hidePauseResumeCancelButtons:!1,showProgressDetails:!1,locale:i,hideAfterFinish:!0};return o.opts=ln({},s,r),o.locale=ln({},i,o.opts.locale),o.locale.strings=ln({},i.strings,o.opts.locale.strings),o.translator=new H({locale:o.locale}),o.i18n=o.translator.translate.bind(o.translator),o.startUpload=o.startUpload.bind(o),o.render=o.render.bind(o),o.install=o.install.bind(o),o}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.getTotalSpeed=function(t){var e=0;return t.forEach(function(t){e+=function(t){if(!t.bytesUploaded)return 0;var e=new Date-t.uploadStarted;return t.bytesUploaded/(e/1e3)}(t.progress)}),e},e.prototype.getTotalETA=function(t){var e=this.getTotalSpeed(t);if(0===e)return 0;var n=t.reduce(function(t,e){return t+((n=e.progress).bytesTotal-n.bytesUploaded);var n},0);return Math.round(n/e*10)/10},e.prototype.startUpload=function(){var t=this;return this.uppy.upload().catch(function(e){t.uppy.log(e.stack||e.message||e)})},e.prototype.getUploadingState=function(t,e,n){if(t)return He;if(e)return Ke;for(var r=We,o=Object.keys(n),i=0;i<o.length;i++){var s=n[o[i]].progress;if(s.uploadStarted&&!s.uploadComplete)return Ve;s.preprocess&&r!==Ve&&(r=Xe),s.postprocess&&r!==Ve&&r!==Xe&&(r=Ge)}return r},e.prototype.render=function(t){var e=t.files,n=Object.keys(e).filter(function(t){return e[t].progress.uploadStarted}),r=Object.keys(e).filter(function(t){return!e[t].progress.uploadStarted&&!e[t].progress.preprocess&&!e[t].progress.postprocess}),o=Object.keys(e).filter(function(t){return e[t].progress.uploadComplete}),i=Object.keys(e).filter(function(t){return e[t].error}),s=Object.keys(e).filter(function(t){return!e[t].progress.uploadComplete&&e[t].progress.uploadStarted&&!e[t].isPaused}),a=Object.keys(e).filter(function(t){return e[t].progress.uploadStarted||e[t].progress.preprocess||e[t].progress.postprocess}),l=Object.keys(e).filter(function(t){return e[t].progress.preprocess||e[t].progress.postprocess}),u=s.map(function(t){return e[t]}),p=F(this.getTotalSpeed(u)),c=an(this.getTotalETA(u)),h=0,d=0;u.forEach(function(t){h+=t.progress.bytesTotal||0,d+=t.progress.bytesUploaded||0}),h=F(h),d=F(d);var f=n.length>0,y=100===t.totalProgress&&o.length===Object.keys(e).length&&0===l.length,g=f&&i.length===n.length,m=0===s.length&&!y&&!g&&n.length>0,v=t.capabilities.resumableUploads||!1;return function(t){var e=(t=t||{}).uploadState,n=t.totalProgress,r=void 0,o=void 0;if(e===Xe||e===Ge){var i=function(t){var e=[];Object.keys(t).forEach(function(n){var r=t[n].progress;r.preprocess&&e.push(r.preprocess),r.postprocess&&e.push(r.postprocess)});var n=e[0];return{mode:n.mode,message:n.message,value:e.filter(function(t){return"determinate"===t.mode}).reduce(function(t,e,n,r){return t+e.value/r.length},0)}}(t.files);"determinate"===(r=i.mode)&&(n=100*i.value),o=en(i)}else e===Ke?o=on(t):e===Ve?o=rn(t):e===He&&(n=void 0,o=sn(t));var s="number"==typeof n?n:100,a=e===We&&t.hideUploadButton||e===We&&!t.newFiles>0||e===Ke&&t.hideAfterFinish,l="uppy-StatusBar-progress\n "+(r?"is-"+r:""),u=Wt({"uppy-Root":t.isTargetDOMEl},"uppy-StatusBar","is-"+e,{"uppy-StatusBar--detailedProgress":t.showProgressDetails});return Je("div",{class:u,"aria-hidden":a},Je("div",{class:l,style:{width:s+"%"},role:"progressbar","aria-valuemin":"0","aria-valuemax":"100","aria-valuenow":n}),o,Je("div",{class:"uppy-StatusBar-actions"},t.newFiles&&!t.hideUploadButton?Je($e,Ye({},t,{uploadState:e})):null,t.error&&!t.hideRetryButton?Je(Qe,t):null,t.hidePauseResumeCancelButtons||e===We||e===Ke?null:Je(Ze,t)))}({error:t.error,uploadState:this.getUploadingState(g,y,t.files||{}),totalProgress:t.totalProgress,totalSize:h,totalUploadedSize:d,uploadStarted:n.length,isAllComplete:y,isAllPaused:m,isAllErrored:g,isUploadStarted:f,complete:o.length,newFiles:r.length,numUploads:a.length,totalSpeed:p,totalETA:c,files:t.files,i18n:this.i18n,pauseAll:this.uppy.pauseAll,resumeAll:this.uppy.resumeAll,retryAll:this.uppy.retryAll,cancelAll:this.uppy.cancelAll,startUpload:this.startUpload,resumableUploads:v,showProgressDetails:this.opts.showProgressDetails,hideUploadButton:this.opts.hideUploadButton,hideRetryButton:this.opts.hideRetryButton,hidePauseResumeCancelButtons:this.opts.hidePauseResumeCancelButtons,hideAfterFinish:this.opts.hideAfterFinish,isTargetDOMEl:this.isTargetDOMEl})},e.prototype.install=function(){var t=this.opts.target;t&&this.mount(t,this)},e.prototype.uninstall=function(){this.unmount()},e}(Y.Plugin),pn=function(t,e,n){var r=t.split(",")[1],o=e.mimeType||t.split(",")[0].split(":")[1].split(";")[0];null==o&&(o="plain/text");for(var i=atob(r),s=[],a=0;a<i.length;a++)s.push(i.charCodeAt(a));return n?new File([new Uint8Array(s)],e.name||"",{type:o}):new Blob([new Uint8Array(s)],{type:o})},cn=function(t){if(!t)return!1;var e=t.split("/")[1];return!!/^(jpeg|gif|png|svg|svg\+xml|bmp)$/.test(e)},hn=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},dn=function(t){function e(n,r){!function(t,n){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this);var o=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.call(this,n,r));return o.type="thumbnail",o.id=o.opts.id||"ThumbnailGenerator",o.title="Thumbnail Generator",o.queue=[],o.queueProcessing=!1,o.opts=hn({},{thumbnailWidth:200},r),o.addToQueue=o.addToQueue.bind(o),o.onRestored=o.onRestored.bind(o),o}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.createThumbnail=function(t,e){var n=this,r=URL.createObjectURL(t.data);return new Promise(function(t,e){var n=new Image;n.src=r,n.onload=function(){URL.revokeObjectURL(r),t(n)},n.onerror=function(){URL.revokeObjectURL(r),e(new Error("Could not create thumbnail"))}}).then(function(t){var r=n.getProportionalHeight(t,e),o=n.resizeImage(t,e,r);return n.canvasToBlob(o,"image/png")}).then(function(t){return URL.createObjectURL(t)})},e.prototype.protect=function(t){var e=t.width/t.height,n=Math.floor(Math.sqrt(5e6*e)),r=Math.floor(5e6/Math.sqrt(5e6*e));if(n>4096&&(n=4096,r=Math.round(n/e)),r>4096&&(r=4096,n=Math.round(e*r)),t.width>n){var o=document.createElement("canvas");o.width=n,o.height=r,o.getContext("2d").drawImage(t,0,0,n,r),t=o}return t},e.prototype.resizeImage=function(t,e,n){t=this.protect(t);var r=Math.ceil(Math.log(t.width/e)*Math.LOG2E);r<1&&(r=1);for(var o=e*Math.pow(2,r-1),i=n*Math.pow(2,r-1);r--;){var s=document.createElement("canvas");s.width=o,s.height=i,s.getContext("2d").drawImage(t,0,0,o,i),t=s,o=Math.round(o/2),i=Math.round(i/2)}return t},e.prototype.canvasToBlob=function(t,e,n){return t.toBlob?new Promise(function(r){t.toBlob(r,e,n)}):Promise.resolve().then(function(){return pn(t.toDataURL(e,n),{})})},e.prototype.getProportionalHeight=function(t,e){var n=t.width/t.height;return Math.round(e/n)},e.prototype.setPreviewURL=function(t,e){this.uppy.setFileState(t,{preview:e})},e.prototype.addToQueue=function(t){this.queue.push(t),!1===this.queueProcessing&&this.processQueue()},e.prototype.processQueue=function(){var t=this;if(this.queueProcessing=!0,this.queue.length>0){var e=this.queue.shift();return this.requestThumbnail(e).catch(function(t){}).then(function(){return t.processQueue()})}this.queueProcessing=!1},e.prototype.requestThumbnail=function(t){var e=this;return cn(t.type)&&!t.isRemote?this.createThumbnail(t,this.opts.thumbnailWidth).then(function(n){e.setPreviewURL(t.id,n)}).catch(function(t){console.warn(t.stack||t.message)}):Promise.resolve()},e.prototype.onRestored=function(){var t=this;Object.keys(this.uppy.getState().files).forEach(function(e){var n=t.uppy.getFile(e);n.isRestored&&(n.preview&&!/^blob:/.test(n.preview)||t.addToQueue(n))})},e.prototype.install=function(){this.uppy.on("file-added",this.addToQueue),this.uppy.on("restored",this.onRestored)},e.prototype.uninstall=function(){this.uppy.off("file-added",this.addToQueue),this.uppy.off("restored",this.onRestored)},e}(Y.Plugin),fn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},yn=function(t){if("string"==typeof t){var e=[].slice.call(document.querySelectorAll(t));return e.length>0?e:null}if("object"===(void 0===t?"undefined":fn(t))&&D(t))return[t]},gn=function(t){return Array.prototype.slice.call(t||[],0)},mn=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},vn=Y.Plugin,bn=Ht.default||Ht,wn=Jt,Sn=['a[href]:not([tabindex^="-"]):not([inert]):not([aria-hidden])','area[href]:not([tabindex^="-"]):not([inert]):not([aria-hidden])',"input:not([disabled]):not([inert]):not([aria-hidden])","select:not([disabled]):not([inert]):not([aria-hidden])","textarea:not([disabled]):not([inert]):not([aria-hidden])","button:not([disabled]):not([inert]):not([aria-hidden])",'iframe:not([tabindex^="-"]):not([inert]):not([aria-hidden])','object:not([tabindex^="-"]):not([inert]):not([aria-hidden])','embed:not([tabindex^="-"]):not([inert]):not([aria-hidden])','[contenteditable]:not([tabindex^="-"]):not([inert]):not([aria-hidden])','[tabindex]:not([tabindex^="-"]):not([inert]):not([aria-hidden])'],_n=function(t){function e(n,r){!function(t,n){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this);var o=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.call(this,n,r));o.id=o.opts.id||"Dashboard",o.title="Dashboard",o.type="orchestrator",o.modalName="uppy-Dashboard";var i={strings:{selectToUpload:"Select files to upload",closeModal:"Close Modal",upload:"Upload",importFrom:"Import from %{name}",addingMoreFiles:"Adding more files",addMoreFiles:"Add more files",dashboardWindowTitle:"Uppy Dashboard Window (Press escape to close)",dashboardTitle:"Uppy Dashboard",copyLinkToClipboardSuccess:"Link copied to clipboard",copyLinkToClipboardFallback:"Copy the URL below",copyLink:"Copy link",fileSource:"File source: %{name}",done:"Done",back:"Back",name:"Name",removeFile:"Remove file",editFile:"Edit file",editing:"Editing %{file}",edit:"Edit",finishEditingFile:"Finish editing file",saveChanges:"Save changes",cancel:"Cancel",localDisk:"Local Disk",myDevice:"My Device",dropPasteImport:"Drop files here, paste, %{browse} or import from",dropPaste:"Drop files here, paste or %{browse}",browse:"browse",fileProgress:"File progress: upload speed and ETA",numberOfSelectedFiles:"Number of selected files",uploadAllNewFiles:"Upload all new files",emptyFolderAdded:"No files were added from empty folder",uploadComplete:"Upload complete",resumeUpload:"Resume upload",pauseUpload:"Pause upload",retryUpload:"Retry upload",cancelUpload:"Cancel upload",xFilesSelected:{0:"%{smart_count} file selected",1:"%{smart_count} files selected"},uploadXFiles:{0:"Upload %{smart_count} file",1:"Upload %{smart_count} files"},uploadXNewFiles:{0:"Upload +%{smart_count} file",1:"Upload +%{smart_count} files"},folderAdded:{0:"Added %{smart_count} file from %{folder}",1:"Added %{smart_count} files from %{folder}"}}},s={target:"body",metaFields:[],trigger:"#uppy-select-files",inline:!1,width:750,height:550,thumbnailWidth:280,defaultTabIcon:wn,showLinkToFileUploadResult:!0,showProgressDetails:!1,hideUploadButton:!1,hideRetryButton:!1,hidePauseResumeCancelButtons:!1,hideProgressAfterFinish:!1,note:null,closeModalOnClickOutside:!1,disableStatusBar:!1,disableInformer:!1,disableThumbnailGenerator:!1,disablePageScrollWhenModalOpen:!0,animateOpenClose:!0,proudlyDisplayPoweredByUppy:!0,onRequestCloseModal:function(){return o.closeModal()},showSelectedFiles:!0,locale:i,browserBackButtonClose:!1};return o.opts=mn({},s,r),o.locale=mn({},i,o.opts.locale),o.locale.strings=mn({},i.strings,o.opts.locale.strings),o.translator=new H({locale:o.locale}),o.i18n=o.translator.translate.bind(o.translator),o.i18nArray=o.translator.translateArray.bind(o.translator),o.openModal=o.openModal.bind(o),o.closeModal=o.closeModal.bind(o),o.requestCloseModal=o.requestCloseModal.bind(o),o.isModalOpen=o.isModalOpen.bind(o),o.addTarget=o.addTarget.bind(o),o.removeTarget=o.removeTarget.bind(o),o.hideAllPanels=o.hideAllPanels.bind(o),o.showPanel=o.showPanel.bind(o),o.getFocusableNodes=o.getFocusableNodes.bind(o),o.setFocusToFirstNode=o.setFocusToFirstNode.bind(o),o.handlePopState=o.handlePopState.bind(o),o.maintainFocus=o.maintainFocus.bind(o),o.initEvents=o.initEvents.bind(o),o.onKeydown=o.onKeydown.bind(o),o.handleClickOutside=o.handleClickOutside.bind(o),o.toggleFileCard=o.toggleFileCard.bind(o),o.toggleAddFilesPanel=o.toggleAddFilesPanel.bind(o),o.handleDrop=o.handleDrop.bind(o),o.handlePaste=o.handlePaste.bind(o),o.handleInputChange=o.handleInputChange.bind(o),o.render=o.render.bind(o),o.install=o.install.bind(o),o}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.removeTarget=function(t){var e=this.getPluginState().targets.filter(function(e){return e.id!==t.id});this.setPluginState({targets:e})},e.prototype.addTarget=function(t){var e=t.id||t.constructor.name,n=t.title||e,r=t.type;if("acquirer"===r||"progressindicator"===r||"presenter"===r){var o={id:e,name:n,type:r},i=this.getPluginState().targets.slice();return i.push(o),this.setPluginState({targets:i}),this.el}this.uppy.log("Dashboard: Modal can only be used by plugins of types: acquirer, progressindicator, presenter")},e.prototype.hideAllPanels=function(){this.setPluginState({activePanel:!1,showAddFilesPanel:!1})},e.prototype.showPanel=function(t){var e=this.getPluginState().targets.filter(function(e){return"acquirer"===e.type&&e.id===t})[0];this.setPluginState({activePanel:e})},e.prototype.requestCloseModal=function(){if(this.opts.onRequestCloseModal)return this.opts.onRequestCloseModal();this.closeModal()},e.prototype.getFocusableNodes=function(){var t=this.el.querySelectorAll(Sn);return Object.keys(t).map(function(e){return t[e]})},e.prototype.setFocusToFirstNode=function(){var t=this.getFocusableNodes();t.length&&t[0].focus()},e.prototype.updateBrowserHistory=function(){var t;history.state&&history.state[this.modalName]||history.pushState(((t={})[this.modalName]=!0,t),""),window.addEventListener("popstate",this.handlePopState,!1)},e.prototype.handlePopState=function(t){t.state&&t.state[this.modalName]||this.closeModal({manualClose:!1}),!this.isModalOpen()&&t.state&&t.state[this.modalName]&&history.go(-1)},e.prototype.setFocusToBrowse=function(){var t=this.el.querySelector(".uppy-Dashboard-browse");t&&t.focus()},e.prototype.maintainFocus=function(t){var e=this.getFocusableNodes(),n=e.indexOf(document.activeElement);t.shiftKey&&0===n&&(e[e.length-1].focus(),t.preventDefault()),t.shiftKey||n!==e.length-1||(e[0].focus(),t.preventDefault())},e.prototype.openModal=function(){var t=this;this.savedScrollPosition=window.scrollY,this.savedActiveElement=document.activeElement,this.opts.disablePageScrollWhenModalOpen&&document.body.classList.add("uppy-Dashboard-isFixed"),this.opts.animateOpenClose&&this.getPluginState().isClosing?this.el.addEventListener("animationend",function e(){t.setPluginState({isHidden:!1}),t.el.removeEventListener("animationend",e,!1)},!1):this.setPluginState({isHidden:!1}),this.opts.browserBackButtonClose&&this.updateBrowserHistory(),document.addEventListener("keydown",this.onKeydown),this.setFocusToBrowse()},e.prototype.closeModal=function(){var t=this,e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).manualClose,n=void 0===e||e;this.opts.disablePageScrollWhenModalOpen&&document.body.classList.remove("uppy-Dashboard-isFixed"),this.opts.animateOpenClose?(this.setPluginState({isClosing:!0}),this.el.addEventListener("animationend",function e(){t.setPluginState({isHidden:!0,isClosing:!1}),t.el.removeEventListener("animationend",e,!1)},!1)):this.setPluginState({isHidden:!0}),document.removeEventListener("keydown",this.onKeydown),this.savedActiveElement.focus(),n&&this.opts.browserBackButtonClose&&history.state&&history.state[this.modalName]&&history.go(-1)},e.prototype.isModalOpen=function(){return!this.getPluginState().isHidden||!1},e.prototype.onKeydown=function(t){27===t.keyCode&&this.requestCloseModal(t),9===t.keyCode&&this.maintainFocus(t)},e.prototype.handleClickOutside=function(){this.opts.closeModalOnClickOutside&&this.requestCloseModal()},e.prototype.handlePaste=function(t){var e=this;gn(t.clipboardData.items).forEach(function(t){if("file"===t.kind){var n=t.getAsFile();if(!n)return e.uppy.log("[Dashboard] File pasted, but the file blob is empty"),void e.uppy.info("Error pasting file","error");e.uppy.log("[Dashboard] File pasted");try{e.uppy.addFile({source:e.id,name:t.name,type:t.type,data:n})}catch(t){}}})},e.prototype.handleInputChange=function(t){var e=this;t.preventDefault(),gn(t.target.files).forEach(function(t){try{e.uppy.addFile({source:e.id,name:t.name,type:t.type,data:t})}catch(t){}})},e.prototype.initEvents=function(){var t=this,e=yn(this.opts.trigger);!this.opts.inline&&e&&e.forEach(function(e){return e.addEventListener("click",t.openModal)}),this.opts.inline||e||this.uppy.log("Dashboard modal trigger not found. Make sure `trigger` is set in Dashboard options unless you are planning to call openModal() method yourself"),this.removeDragDropListener=Nt(this.el,function(e){t.handleDrop(e)}),this.ro=new bn(function(e,n){var r=e,o=Array.isArray(r),i=0;for(r=o?r:r[Symbol.iterator]();;){var s;if(o){if(i>=r.length)break;s=r[i++]}else{if((i=r.next()).done)break;s=i.value}var a=s.contentRect,l=a.width,u=a.height;t.uppy.log("[Dashboard] resized: "+l+" / "+u),t.setPluginState({containerWidth:l,containerHeight:u})}}),this.ro.observe(this.el.querySelector(".uppy-Dashboard-inner")),this.uppy.on("plugin-remove",this.removeTarget),this.uppy.on("file-added",function(e){t.toggleAddFilesPanel(!1),t.hideAllPanels()})},e.prototype.removeEvents=function(){var t=this,e=yn(this.opts.trigger);!this.opts.inline&&e&&e.forEach(function(e){return e.removeEventListener("click",t.openModal)}),this.ro.unobserve(this.el.querySelector(".uppy-Dashboard-inner")),this.removeDragDropListener(),window.removeEventListener("popstate",this.handlePopState,!1),this.uppy.off("plugin-remove",this.removeTarget),this.uppy.off("file-added",function(e){return t.toggleAddFilesPanel(!1)})},e.prototype.toggleFileCard=function(t){this.setPluginState({fileCardFor:t||!1})},e.prototype.toggleAddFilesPanel=function(t){this.setPluginState({showAddFilesPanel:t})},e.prototype.handleDrop=function(t){var e=this;this.uppy.log("[Dashboard] Files were dropped"),t.forEach(function(t){try{e.uppy.addFile({source:e.id,name:t.name,type:t.type,data:t})}catch(t){}})},e.prototype.render=function(t){var e=this,n=this.getPluginState(),r=t.files,o=t.capabilities,i=Object.keys(r).filter(function(t){return!r[t].progress.uploadStarted}),s=Object.keys(r).filter(function(t){return!r[t].progress.uploadComplete&&r[t].progress.uploadStarted&&!r[t].isPaused}),a=[];s.forEach(function(t){a.push(r[t])});var l=0,u=0;a.forEach(function(t){l+=t.progress.bytesTotal||0,u+=t.progress.bytesUploaded||0}),l=F(l),u=F(u);var p=function(t){var n=e.uppy.getPlugin(t.id);return mn({},t,{icon:n.icon||e.opts.defaultTabIcon,render:n.render})},c=n.targets.filter(function(t){return"acquirer"===t.type&&function(t){var n=e.uppy.getPlugin(t.id);return"function"!=typeof n.isSupported||n.isSupported()}(t)}).map(p),h=n.targets.filter(function(t){return"progressindicator"===t.type}).map(p);return Le({state:t,modal:n,newFiles:i,files:r,totalFileCount:Object.keys(r).length,totalProgress:t.totalProgress,acquirers:c,activePanel:n.activePanel,animateOpenClose:this.opts.animateOpenClose,isClosing:n.isClosing,getPlugin:this.uppy.getPlugin,progressindicators:h,autoProceed:this.uppy.opts.autoProceed,hideUploadButton:this.opts.hideUploadButton,hideRetryButton:this.opts.hideRetryButton,hidePauseResumeCancelButtons:this.opts.hidePauseResumeCancelButtons,id:this.id,closeModal:this.requestCloseModal,handleClickOutside:this.handleClickOutside,handleInputChange:this.handleInputChange,handlePaste:this.handlePaste,inline:this.opts.inline,showPanel:this.showPanel,hideAllPanels:this.hideAllPanels,log:this.uppy.log,i18n:this.i18n,i18nArray:this.i18nArray,addFile:this.uppy.addFile,removeFile:this.uppy.removeFile,info:this.uppy.info,note:this.opts.note,metaFields:n.metaFields,resumableUploads:o.resumableUploads||!1,bundled:o.bundled||!1,startUpload:function(t){e.uppy.upload().catch(function(t){e.uppy.log(t.stack||t.message||t)})},pauseUpload:this.uppy.pauseResume,retryUpload:this.uppy.retryUpload,cancelUpload:function(t){e.uppy.emit("upload-cancel",t),e.uppy.removeFile(t)},cancelAll:this.uppy.cancelAll,fileCardFor:n.fileCardFor,toggleFileCard:this.toggleFileCard,toggleAddFilesPanel:this.toggleAddFilesPanel,showAddFilesPanel:n.showAddFilesPanel,saveFileCard:function(t,n){e.uppy.setFileMeta(n,t),e.toggleFileCard()},width:this.opts.width,height:this.opts.height,showLinkToFileUploadResult:this.opts.showLinkToFileUploadResult,proudlyDisplayPoweredByUppy:this.opts.proudlyDisplayPoweredByUppy,currentWidth:n.containerWidth,isWide:n.containerWidth>400,containerWidth:n.containerWidth,isTargetDOMEl:this.isTargetDOMEl,allowedFileTypes:this.uppy.opts.restrictions.allowedFileTypes,maxNumberOfFiles:this.uppy.opts.restrictions.maxNumberOfFiles,showSelectedFiles:this.opts.showSelectedFiles})},e.prototype.discoverProviderPlugins=function(){var t=this;this.uppy.iteratePlugins(function(e){e&&!e.target&&e.opts&&e.opts.target===t.constructor&&t.addTarget(e)})},e.prototype.install=function(){var t=this;this.setPluginState({isHidden:!0,showFileCard:!1,showAddFilesPanel:!1,activePanel:!1,metaFields:this.opts.metaFields,targets:[]});var e=this.opts.target;e&&this.mount(e,this),(this.opts.plugins||[]).forEach(function(e){var n=t.uppy.getPlugin(e);n&&n.mount(t,n)}),this.opts.disableStatusBar||this.uppy.use(un,{id:this.id+":StatusBar",target:this,hideUploadButton:this.opts.hideUploadButton,hideRetryButton:this.opts.hideRetryButton,hidePauseResumeCancelButtons:this.opts.hidePauseResumeCancelButtons,showProgressDetails:this.opts.showProgressDetails,hideAfterFinish:this.opts.hideProgressAfterFinish,locale:this.opts.locale}),this.opts.disableInformer||this.uppy.use(qe,{id:this.id+":Informer",target:this}),this.opts.disableThumbnailGenerator||this.uppy.use(dn,{id:this.id+":ThumbnailGenerator",thumbnailWidth:this.opts.thumbnailWidth}),this.discoverProviderPlugins(),this.initEvents()},e.prototype.uninstall=function(){var t=this;if(!this.opts.disableInformer){var e=this.uppy.getPlugin(this.id+":Informer");e&&this.uppy.removePlugin(e)}if(!this.opts.disableStatusBar){var n=this.uppy.getPlugin(this.id+":StatusBar");n&&this.uppy.removePlugin(n)}if(!this.opts.disableThumbnailGenerator){var r=this.uppy.getPlugin(this.id+":ThumbnailGenerator");r&&this.uppy.removePlugin(r)}(this.opts.plugins||[]).forEach(function(e){var n=t.uppy.getPlugin(e);n&&n.unmount()}),this.unmount(),this.removeEvents()},e}(vn),Pn=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},En=Y.Plugin,kn=A.h,Cn=function(t){function e(n,r){!function(t,n){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this);var o=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.call(this,n,r));o.type="acquirer",o.id=o.opts.id||"DragDrop",o.title="Drag & Drop";var i={strings:{dropHereOr:"Drop files here or %{browse}",browse:"browse"}},s={target:null,inputName:"files[]",width:"100%",height:"100%",note:null,locale:i};return o.opts=Pn({},s,r),o.isDragDropSupported=o.checkDragDropSupport(),o.locale=Pn({},i,o.opts.locale),o.locale.strings=Pn({},i.strings,o.opts.locale.strings),o.translator=new H({locale:o.locale}),o.i18n=o.translator.translate.bind(o.translator),o.i18nArray=o.translator.translateArray.bind(o.translator),o.handleDrop=o.handleDrop.bind(o),o.handleInputChange=o.handleInputChange.bind(o),o.checkDragDropSupport=o.checkDragDropSupport.bind(o),o.render=o.render.bind(o),o}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.checkDragDropSupport=function(){var t=document.createElement("div");return"draggable"in t&&"ondragstart"in t&&"ondrop"in t&&"FormData"in window&&"FileReader"in window},e.prototype.handleDrop=function(t){var e=this;this.uppy.log("[DragDrop] Files dropped"),t.forEach(function(t){try{e.uppy.addFile({source:e.id,name:t.name,type:t.type,data:t})}catch(t){}})},e.prototype.handleInputChange=function(t){var e=this;this.uppy.log("[DragDrop] Files selected through input"),gn(t.target.files).forEach(function(t){try{e.uppy.addFile({source:e.id,name:t.name,type:t.type,data:t})}catch(t){}})},e.prototype.render=function(t){var e=this,n="uppy-Root uppy-DragDrop-container "+(this.isDragDropSupported?"uppy-DragDrop--is-dragdrop-supported":""),r={width:this.opts.width,height:this.opts.height},o=this.uppy.opts.restrictions;return kn("div",{class:n,style:r},kn("div",{class:"uppy-DragDrop-inner"},kn("svg",{"aria-hidden":"true",class:"UppyIcon uppy-DragDrop-arrow",width:"16",height:"16",viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg"},kn("path",{d:"M11 10V0H5v10H2l6 6 6-6h-3zm0 0","fill-rule":"evenodd"})),kn("label",{class:"uppy-DragDrop-label"},kn("input",{style:{width:"0.1px",height:"0.1px",opacity:0,overflow:"hidden",position:"absolute",zIndex:-1},class:"uppy-DragDrop-input",type:"file",name:this.opts.inputName,multiple:1!==o.maxNumberOfFiles,accept:o.allowedFileTypes,ref:function(t){e.input=t},onchange:this.handleInputChange,value:""}),this.i18nArray("dropHereOr",{browse:kn("span",{class:"uppy-DragDrop-dragText"},this.i18n("browse"))})),kn("span",{class:"uppy-DragDrop-note"},this.opts.note)))},e.prototype.install=function(){var t=this,e=this.opts.target;e&&this.mount(e,this),this.removeDragDropListener=Nt(this.el,function(e){t.handleDrop(e),t.uppy.log(e)})},e.prototype.uninstall=function(){this.unmount(),this.removeDragDropListener()},e}(En),Tn=A.h,On=function(t){return Tn("div",{class:"uppy-Provider-loading"},Tn("span",null,"Loading..."))};function Un(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Fn(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function An(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var xn=A.h,Dn=A.Component,Rn=function(t){function e(){return Un(this,e),Fn(this,t.apply(this,arguments))}return An(e,t),e.prototype.componentDidMount=function(){var t=this;setTimeout(function(){t.connectButton&&t.connectButton.focus({preventScroll:!0})},150)},e.prototype.render=function(){var t=this;return xn("div",{class:"uppy-Provider-auth"},xn("div",{class:"uppy-Provider-authIcon"},this.props.pluginIcon()),xn("h1",{class:"uppy-Provider-authTitle"},"Please authenticate with ",xn("span",{class:"uppy-Provider-authTitleName"},this.props.pluginName),xn("br",null)," to select files"),xn("button",{type:"button",class:"uppy-u-reset uppy-c-btn uppy-c-btn-primary uppy-Provider-authBtn",onclick:this.props.handleAuth,ref:function(e){t.connectButton=e}},"Connect to ",this.props.pluginName),this.props.demo&&xn("button",{class:"uppy-u-reset uppy-c-btn uppy-c-btn-primary uppy-Provider-authBtn",onclick:this.props.handleDemoAuth},"Proceed with Demo Account"))},e}(Dn),In=function(t){function e(){return Un(this,e),Fn(this,t.apply(this,arguments))}return An(e,t),e.prototype.componentDidMount=function(){this.props.checkAuth()},e.prototype.render=function(){return this.props.checkAuthInProgress?xn(On,null):xn(Rn,this.props)},e}(Dn),Bn=A.h,jn=A.h,Ln=function(t){function e(n){!function(t,n){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this);var r=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.call(this,n));return r.isEmpty=!0,r.handleKeyPress=r.handleKeyPress.bind(r),r.handleClear=r.handleClear.bind(r),r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.handleKeyPress=function(t){if(13===t.keyCode)return t.stopPropagation(),void t.preventDefault();this.isEmpty=!this.input.value.length>0,this.props.filterQuery(t)},e.prototype.handleClear=function(t){this.input.value="",this.props.filterQuery()},e.prototype.render=function(){var t=this;return jn("div",{class:"uppy-u-reset uppy-ProviderBrowser-search"},jn("svg",{class:"UppyIcon uppy-ProviderBrowser-searchIcon",viewBox:"0 0 100 100"},jn("path",{d:"M87.533 80.03L62.942 55.439c3.324-4.587 5.312-10.207 5.312-16.295 0-.312-.043-.611-.092-.908.05-.301.093-.605.093-.922 0-15.36-12.497-27.857-27.857-27.857-.273 0-.536.043-.799.08-.265-.037-.526-.08-.799-.08-15.361 0-27.858 12.497-27.858 27.857 0 .312.042.611.092.909a5.466 5.466 0 0 0-.093.921c0 15.36 12.496 27.858 27.857 27.858.273 0 .535-.043.8-.081.263.038.524.081.798.081 5.208 0 10.071-1.464 14.245-3.963L79.582 87.98a5.603 5.603 0 0 0 3.976 1.647 5.621 5.621 0 0 0 3.975-9.597zM39.598 55.838c-.265-.038-.526-.081-.8-.081-9.16 0-16.612-7.452-16.612-16.612 0-.312-.042-.611-.092-.908.051-.301.093-.605.093-.922 0-9.16 7.453-16.612 16.613-16.612.272 0 .534-.042.799-.079.263.037.525.079.799.079 9.16 0 16.612 7.452 16.612 16.612 0 .312.043.611.092.909-.05.301-.094.604-.094.921 0 9.16-7.452 16.612-16.612 16.612-.274 0-.536.043-.798.081z"})),jn("input",{class:"uppy-u-reset uppy-ProviderBrowser-searchInput",type:"text",placeholder:"Filter","aria-label":"Filter",onkeyup:this.handleKeyPress,onkeydown:this.handleKeyPress,onkeypress:this.handleKeyPress,value:this.props.filterInput,ref:function(e){t.input=e}}),!this.isEmpty&&jn("button",{class:"uppy-u-reset uppy-ProviderBrowser-searchClose",type:"button",onclick:this.handleClear},jn("svg",{class:"UppyIcon",viewBox:"0 0 19 19"},jn("path",{d:"M17.318 17.232L9.94 9.854 9.586 9.5l-.354.354-7.378 7.378h.707l-.62-.62v.706L9.318 9.94l.354-.354-.354-.354L1.94 1.854v.707l.62-.62h-.706l7.378 7.378.354.354.354-.354 7.378-7.378h-.707l.622.62v-.706L9.854 9.232l-.354.354.354.354 7.378 7.378.708-.707-7.38-7.378v.708l7.38-7.38.353-.353-.353-.353-.622-.622-.353-.353-.354.352-7.378 7.38h.708L2.56 1.23 2.208.88l-.353.353-.622.62-.353.355.352.353 7.38 7.38v-.708l-7.38 7.38-.353.353.352.353.622.622.353.353.354-.353 7.38-7.38h-.708l7.38 7.38z"}))))},e}(A.Component),Mn=A.h,Nn=function(t){return Mn("div",{class:"uppy-ProviderBrowser-footer"},Mn("button",{class:"uppy-u-reset uppy-c-btn uppy-c-btn-primary",onclick:t.done},t.i18n("selectXFiles",{smart_count:t.selected})),Mn("button",{class:"uppy-u-reset uppy-c-btn uppy-c-btn-link",onclick:t.cancel},t.i18n("cancel")))},zn=A.h,qn=function(t){var e=function(t){13===t.keyCode&&(t.stopPropagation(),t.preventDefault())},n=t.getItemIcon();return zn("li",{class:"uppy-ProviderBrowserItem"+(t.isChecked?" uppy-ProviderBrowserItem--selected":"")+("video"===n?" uppy-ProviderBrowserItem--noPreview":"")},zn("div",{class:"uppy-ProviderBrowserItem-checkbox"},zn("input",{type:"checkbox",role:"option",tabindex:0,"aria-label":"Select "+t.title,id:t.id,checked:t.isChecked,disabled:t.isDisabled,onchange:t.handleClick,onkeyup:e,onkeydown:e,onkeypress:e}),zn("label",{for:t.id,onclick:t.handleClick})),zn("button",{type:"button",class:"uppy-ProviderBrowserItem-inner","aria-label":"Select "+t.title,tabindex:0,onclick:function(e){if(e.preventDefault(),"folder"===t.type)return t.handleFolderClick(e);t.handleClick(e)}},function(t){if(null!==t)switch(t){case"file":return zn("svg",{"aria-hidden":"true",class:"UppyIcon",width:11,height:14.5,viewBox:"0 0 44 58"},zn("path",{d:"M27.437.517a1 1 0 0 0-.094.03H4.25C2.037.548.217 2.368.217 4.58v48.405c0 2.212 1.82 4.03 4.03 4.03H39.03c2.21 0 4.03-1.818 4.03-4.03V15.61a1 1 0 0 0-.03-.28 1 1 0 0 0 0-.093 1 1 0 0 0-.03-.032 1 1 0 0 0 0-.03 1 1 0 0 0-.032-.063 1 1 0 0 0-.03-.063 1 1 0 0 0-.032 0 1 1 0 0 0-.03-.063 1 1 0 0 0-.032-.03 1 1 0 0 0-.03-.063 1 1 0 0 0-.063-.062l-14.593-14a1 1 0 0 0-.062-.062A1 1 0 0 0 28 .708a1 1 0 0 0-.374-.157 1 1 0 0 0-.156 0 1 1 0 0 0-.03-.03l-.003-.003zM4.25 2.547h22.218v9.97c0 2.21 1.82 4.03 4.03 4.03h10.564v36.438a2.02 2.02 0 0 1-2.032 2.032H4.25c-1.13 0-2.032-.9-2.032-2.032V4.58c0-1.13.902-2.032 2.03-2.032zm24.218 1.345l10.375 9.937.75.718H30.5c-1.13 0-2.032-.9-2.032-2.03V3.89z"}));case"folder":return zn("svg",{"aria-hidden":"true",class:"UppyIcon",style:{width:16,marginRight:3},viewBox:"0 0 276.157 276.157"},zn("path",{d:"M273.08 101.378c-3.3-4.65-8.86-7.32-15.254-7.32h-24.34V67.59c0-10.2-8.3-18.5-18.5-18.5h-85.322c-3.63 0-9.295-2.875-11.436-5.805l-6.386-8.735c-4.982-6.814-15.104-11.954-23.546-11.954H58.73c-9.292 0-18.638 6.608-21.737 15.372l-2.033 5.752c-.958 2.71-4.72 5.37-7.596 5.37H18.5C8.3 49.09 0 57.39 0 67.59v167.07c0 .886.16 1.73.443 2.52.152 3.306 1.18 6.424 3.053 9.064 3.3 4.652 8.86 7.32 15.255 7.32h188.487c11.395 0 23.27-8.425 27.035-19.18l40.677-116.188c2.11-6.035 1.43-12.164-1.87-16.816zM18.5 64.088h8.864c9.295 0 18.64-6.607 21.738-15.37l2.032-5.75c.96-2.712 4.722-5.373 7.597-5.373h29.565c3.63 0 9.295 2.876 11.437 5.806l6.386 8.735c4.982 6.815 15.104 11.954 23.546 11.954h85.322c1.898 0 3.5 1.602 3.5 3.5v26.47H69.34c-11.395 0-23.27 8.423-27.035 19.178L15 191.23V67.59c0-1.898 1.603-3.5 3.5-3.5zm242.29 49.15l-40.676 116.188c-1.674 4.78-7.812 9.135-12.877 9.135H18.75c-1.447 0-2.576-.372-3.02-.997-.442-.625-.422-1.814.057-3.18l40.677-116.19c1.674-4.78 7.812-9.134 12.877-9.134h188.487c1.448 0 2.577.372 3.02.997.443.625.423 1.814-.056 3.18z"}));case"video":return zn("svg",{"aria-hidden":"true",viewBox:"0 0 58 58"},zn("path",{d:"M36.537 28.156l-11-7a1.005 1.005 0 0 0-1.02-.033C24.2 21.3 24 21.635 24 22v14a1 1 0 0 0 1.537.844l11-7a1.002 1.002 0 0 0 0-1.688zM26 34.18V23.82L34.137 29 26 34.18z"}),zn("path",{d:"M57 6H1a1 1 0 0 0-1 1v44a1 1 0 0 0 1 1h56a1 1 0 0 0 1-1V7a1 1 0 0 0-1-1zM10 28H2v-9h8v9zm-8 2h8v9H2v-9zm10 10V8h34v42H12V40zm44-12h-8v-9h8v9zm-8 2h8v9h-8v-9zm8-22v9h-8V8h8zM2 8h8v9H2V8zm0 42v-9h8v9H2zm54 0h-8v-9h8v9z"}));default:return zn("img",{src:t})}}(t.getItemIcon()),t.showTitles&&t.title))},Hn=A.h,Wn=function(t){return t.folders.length||t.files.length?Hn("div",{class:"uppy-ProviderBrowser-body"},Hn("ul",{class:"uppy-ProviderBrowser-list",onscroll:t.handleScroll,role:"listbox","aria-label":"List of files from "+t.title},t.folders.map(function(e){var n=!1,r=t.isChecked(e);return r&&(n=r.loading),qn({title:t.getItemName(e),id:t.getItemId(e),type:"folder",getItemIcon:function(){return t.getItemIcon(e)},isDisabled:n,isChecked:r,handleFolderClick:function(){return t.handleFolderClick(e)},handleClick:function(n){return t.toggleCheckbox(n,e)},columns:t.columns,showTitles:t.showTitles})}),t.files.map(function(e){return qn({title:t.getItemName(e),id:t.getItemId(e),type:"file",getItemIcon:function(){return t.getItemIcon(e)},isDisabled:!1,isChecked:t.isChecked(e),handleClick:function(n){return t.toggleCheckbox(n,e)},columns:t.columns,showTitles:t.showTitles})}))):Hn("div",{class:"uppy-Provider-empty"},t.i18n("noFilesFound"))},Xn=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Vn=A.h,Gn=function(t){var e=t.folders,n=t.files;""!==t.filterInput&&(e=t.filterItems(t.folders),n=t.filterItems(t.files));var r=t.currentSelection.length;return Vn("div",{class:Wt("uppy-ProviderBrowser","uppy-ProviderBrowser-viewType--"+t.viewType)},Vn("div",{class:"uppy-ProviderBrowser-header"},Vn("div",{class:Wt("uppy-ProviderBrowser-headerBar",!t.showBreadcrumbs&&"uppy-ProviderBrowser-headerBar--simple")},Vn("div",{class:"uppy-Provider-breadcrumbsWrap"},Vn("div",{class:"uppy-Provider-breadcrumbsIcon"},t.pluginIcon&&t.pluginIcon()),t.showBreadcrumbs&&function(t){return Bn("div",{class:"uppy-Provider-breadcrumbs"},t.directories.map(function(e,n){return function(t){return Bn("button",{type:"button",onclick:t.getFolder},t.title)}({getFolder:function(){return t.getFolder(e.id)},title:0===n?t.title:e.title})}))}({getFolder:t.getFolder,directories:t.directories,title:t.title})),Vn("span",{class:"uppy-ProviderBrowser-user"},t.username),Vn("button",{type:"button",onclick:t.logout,class:"uppy-ProviderBrowser-userLogout"},t.i18n("logOut")))),t.showFilter&&Vn(Ln,t),Vn(Wn,{columns:[{name:"Name",key:"title"}],folders:e,files:n,activeRow:t.isActiveRow,sortByTitle:t.sortByTitle,sortByDate:t.sortByDate,isChecked:t.isChecked,handleFolderClick:t.getNextFolder,toggleCheckbox:t.toggleCheckbox,getItemName:t.getItemName,getItemIcon:t.getItemIcon,handleScroll:t.handleScroll,title:t.title,showTitles:t.showTitles,getItemId:t.getItemId,i18n:t.i18n}),r>0&&Vn(Nn,Xn({selected:r},t)))},Kn=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t};function Yn(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var Jn=A.h,$n=function(t){function e(){return Yn(this,e),function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.apply(this,arguments))}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.componentWillUnmount=function(){this.props.onUnmount()},e.prototype.render=function(){return this.props.children[0]},e}(A.Component),Qn=function(){function t(e,n){Yn(this,t),this.plugin=e,this.Provider=e[e.id],this.opts=Kn({},{viewType:"list",showTitles:!0,showFilter:!0,showBreadcrumbs:!0},n),this.addFile=this.addFile.bind(this),this.filterItems=this.filterItems.bind(this),this.filterQuery=this.filterQuery.bind(this),this.toggleSearch=this.toggleSearch.bind(this),this.getFolder=this.getFolder.bind(this),this.getNextFolder=this.getNextFolder.bind(this),this.logout=this.logout.bind(this),this.checkAuth=this.checkAuth.bind(this),this.handleAuth=this.handleAuth.bind(this),this.handleDemoAuth=this.handleDemoAuth.bind(this),this.sortByTitle=this.sortByTitle.bind(this),this.sortByDate=this.sortByDate.bind(this),this.isActiveRow=this.isActiveRow.bind(this),this.isChecked=this.isChecked.bind(this),this.toggleCheckbox=this.toggleCheckbox.bind(this),this.handleError=this.handleError.bind(this),this.handleScroll=this.handleScroll.bind(this),this.donePicking=this.donePicking.bind(this),this.cancelPicking=this.cancelPicking.bind(this),this.clearSelection=this.clearSelection.bind(this),this.render=this.render.bind(this),this.clearSelection()}return t.prototype.tearDown=function(){},t.prototype._updateFilesAndFolders=function(t,e,n){var r=this;this.plugin.getItemSubList(t).forEach(function(t){r.plugin.isFolder(t)?n.push(t):e.push(t)}),this.plugin.setPluginState({folders:n,files:e})},t.prototype.checkAuth=function(){var t=this;this.plugin.setPluginState({checkAuthInProgress:!0}),this.Provider.checkAuth().then(function(e){t.plugin.setPluginState({checkAuthInProgress:!1}),t.plugin.onAuth(e)}).catch(function(e){t.plugin.setPluginState({checkAuthInProgress:!1}),t.handleError(e)})},t.prototype.getFolder=function(t,e){var n=this;return this._loaderWrapper(this.Provider.list(t),function(r){var o,i=n.plugin.getPluginState(),s=function(e,n){for(var r=0;r<e.length;r++)if(o=e[r],t===o.id)return r;var o;return-1}(i.directories);o=-1!==s?i.directories.slice(0,s+1):i.directories.concat([{id:t,title:e||n.plugin.getItemName(r)}]),n.username=n.username?n.username:n.plugin.getUsername(r),n._updateFilesAndFolders(r,[],[]),n.plugin.setPluginState({directories:o})},this.handleError)},t.prototype.getNextFolder=function(t){var e=this.plugin.getItemRequestPath(t);this.getFolder(e,this.plugin.getItemName(t)),this.lastCheckbox=void 0},t.prototype.addFile=function(t){var e={id:this.providerFileToId(t),source:this.plugin.id,data:this.plugin.getItemData(t),name:this.plugin.getItemName(t)||this.plugin.getItemId(t),type:this.plugin.getMimeType(t),isRemote:!0,body:{fileId:this.plugin.getItemId(t)},remote:{serverUrl:this.plugin.opts.serverUrl,url:""+this.Provider.fileUrl(this.plugin.getItemRequestPath(t)),body:{fileId:this.plugin.getItemId(t)},providerOptions:this.Provider.opts}},n=G(e);n&&cn(n)&&(e.preview=this.plugin.getItemThumbnailUrl(t)),this.plugin.uppy.log("Adding remote file");try{this.plugin.uppy.addFile(e)}catch(t){}},t.prototype.removeFile=function(t){var e=this.plugin.getPluginState().currentSelection;this.plugin.setPluginState({currentSelection:e.filter(function(e){return e.id!==t})})},t.prototype.logout=function(){var t=this;this.Provider.logout(location.href).then(function(e){e.ok&&t.plugin.setPluginState({authenticated:!1,files:[],folders:[],directories:[]})}).catch(this.handleError)},t.prototype.filterQuery=function(t){var e=this.plugin.getPluginState();this.plugin.setPluginState(Kn({},e,{filterInput:t?t.target.value:""}))},t.prototype.toggleSearch=function(t){var e=this.plugin.getPluginState();this.plugin.setPluginState({isSearchVisible:!e.isSearchVisible,filterInput:""})},t.prototype.filterItems=function(t){var e=this,n=this.plugin.getPluginState();return""===n.filterInput?t:t.filter(function(t){return-1!==e.plugin.getItemName(t).toLowerCase().indexOf(n.filterInput.toLowerCase())})},t.prototype.sortByTitle=function(){var t=this,e=Kn({},this.plugin.getPluginState()),n=e.files,r=e.folders,o=e.sorting,i=n.sort(function(e,n){return"titleDescending"===o?t.plugin.getItemName(n).localeCompare(t.plugin.getItemName(e)):t.plugin.getItemName(e).localeCompare(t.plugin.getItemName(n))}),s=r.sort(function(e,n){return"titleDescending"===o?t.plugin.getItemName(n).localeCompare(t.plugin.getItemName(e)):t.plugin.getItemName(e).localeCompare(t.plugin.getItemName(n))});this.plugin.setPluginState(Kn({},e,{files:i,folders:s,sorting:"titleDescending"===o?"titleAscending":"titleDescending"}))},t.prototype.sortByDate=function(){var t=this,e=Kn({},this.plugin.getPluginState()),n=e.files,r=e.folders,o=e.sorting,i=n.sort(function(e,n){var r=new Date(t.plugin.getItemModifiedDate(e)),i=new Date(t.plugin.getItemModifiedDate(n));return"dateDescending"===o?r>i?-1:r<i?1:0:r>i?1:r<i?-1:0}),s=r.sort(function(e,n){var r=new Date(t.plugin.getItemModifiedDate(e)),i=new Date(t.plugin.getItemModifiedDate(n));return"dateDescending"===o?r>i?-1:r<i?1:0:r>i?1:r<i?-1:0});this.plugin.setPluginState(Kn({},e,{files:i,folders:s,sorting:"dateDescending"===o?"dateAscending":"dateDescending"}))},t.prototype.sortBySize=function(){var t=this,e=Kn({},this.plugin.getPluginState()),n=e.files,r=e.sorting;if(n.length&&this.plugin.getItemData(n[0]).size){var o=n.sort(function(e,n){var o=t.plugin.getItemData(e).size,i=t.plugin.getItemData(n).size;return"sizeDescending"===r?o>i?-1:o<i?1:0:o>i?1:o<i?-1:0});this.plugin.setPluginState(Kn({},e,{files:o,sorting:"sizeDescending"===r?"sizeAscending":"sizeDescending"}))}},t.prototype.isActiveRow=function(t){return this.plugin.getPluginState().activeRow===this.plugin.getItemId(t)},t.prototype.isChecked=function(t){return this.plugin.getPluginState().currentSelection.some(function(e){return e===t})},t.prototype.addFolder=function(t){var e=this,n=this.providerFileToId(t),r=this.plugin.getPluginState(),o=r.selectedFolders||{};if(!(n in o&&o[n].loading))return o[n]={loading:!0,files:[]},this.plugin.setPluginState({selectedFolders:o}),this.Provider.list(this.plugin.getItemRequestPath(t)).then(function(i){var s=[];e.plugin.getItemSubList(i).forEach(function(t){e.plugin.isFolder(t)||(e.addFile(t),s.push(e.providerFileToId(t)))}),(r=e.plugin.getPluginState()).selectedFolders[n]={loading:!1,files:s},e.plugin.setPluginState({selectedFolders:o});var a,l=e.plugin.uppy.getPlugin("Dashboard");a=s.length?l.i18n("folderAdded",{smart_count:s.length,folder:e.plugin.getItemName(t)}):l.i18n("emptyFolderAdded"),e.plugin.uppy.info(a)}).catch(function(t){delete(r=e.plugin.getPluginState()).selectedFolders[n],e.plugin.setPluginState({selectedFolders:r.selectedFolders}),e.handleError(t)})},t.prototype.toggleCheckbox=function(t,e){t.stopPropagation(),t.preventDefault();var n=this.plugin.getPluginState(),r=n.folders,o=n.files,i=this.filterItems(r.concat(o));if(this.lastCheckbox&&t.shiftKey){var s,a=i.indexOf(this.lastCheckbox),l=i.indexOf(e);return s=a<l?i.slice(a,l+1):i.slice(l,a+1),void this.plugin.setPluginState({currentSelection:s})}this.lastCheckbox=e;var u=this.plugin.getPluginState().currentSelection;this.isChecked(e)?this.plugin.setPluginState({currentSelection:u.filter(function(t){return t!==e})}):this.plugin.setPluginState({currentSelection:u.concat([e])})},t.prototype.providerFileToId=function(t){return W({data:this.plugin.getItemData(t),name:this.plugin.getItemName(t)||this.plugin.getItemId(t),type:this.plugin.getMimeType(t)})},t.prototype.handleDemoAuth=function(){var t=this.plugin.getPluginState();this.plugin.setPluginState({},t,{authenticated:!0})},t.prototype.handleAuth=function(){var t=this,e=btoa(JSON.stringify({origin:location.origin})),n=this.Provider.authUrl()+"?state="+e,r=window.open(n,"_blank");window.addEventListener("message",function e(n){t._isOriginAllowed(n.origin,t.plugin.opts.serverPattern)&&n.source===r?(r.close(),window.removeEventListener("message",e),t.Provider.setAuthToken(n.data.token),t._loaderWrapper(t.Provider.checkAuth(),t.plugin.onAuth,t.handleError)):t.plugin.uppy.log("rejecting event from "+n.origin+" vs allowed pattern "+t.plugin.opts.serverPattern)})},t.prototype._isOriginAllowed=function(t,e){var n=function(t){return"string"==typeof t?new RegExp("^"+t+"$"):t instanceof RegExp?t:void 0};return(Array.isArray(e)?e.map(n):[n(e)]).filter(function(t){return null!==t}).some(function(e){return e.test(t)})},t.prototype.handleError=function(t){var e=this.plugin.uppy,n=e.i18n("companionError");e.log(t.toString()),e.info({message:n,details:t.toString()},"error",5e3)},t.prototype.handleScroll=function(t){var e=this,n=t.target.scrollHeight-(t.target.scrollTop+t.target.offsetHeight),r=this.plugin.getNextPagePath?this.plugin.getNextPagePath():null;n<50&&r&&!this._isHandlingScroll&&(this.Provider.list(r).then(function(t){var n=e.plugin.getPluginState(),r=n.files,o=n.folders;e._updateFilesAndFolders(t,r,o)}).catch(this.handleError).then(function(){e._isHandlingScroll=!1}),this._isHandlingScroll=!0)},t.prototype.donePicking=function(){var t=this,e=this.plugin.getPluginState().currentSelection.map(function(e){return t.plugin.isFolder(e)?t.addFolder(e):t.addFile(e)});this._loaderWrapper(Promise.all(e),function(){t.clearSelection();var e=t.plugin.uppy.getPlugin("Dashboard");e&&e.hideAllPanels()},function(){})},t.prototype.cancelPicking=function(){this.clearSelection();var t=this.plugin.uppy.getPlugin("Dashboard");t&&t.hideAllPanels()},t.prototype.clearSelection=function(){this.plugin.setPluginState({currentSelection:[]})},t.prototype._loaderWrapper=function(t,e,n){var r=this;t.then(function(t){r.plugin.setPluginState({loading:!1}),e(t)}).catch(function(t){r.plugin.setPluginState({loading:!1}),n(t)}),this.plugin.setPluginState({loading:!0})},t.prototype.render=function(t){var e=this.plugin.getPluginState(),n=e.authenticated,r=e.checkAuthInProgress;if(e.loading)return Jn($n,{onUnmount:this.clearSelection},Jn(On,null));if(!n)return Jn($n,{onUnmount:this.clearSelection},Jn(In,{pluginName:this.plugin.title,pluginIcon:this.plugin.icon,demo:this.plugin.opts.demo,checkAuth:this.checkAuth,handleAuth:this.handleAuth,handleDemoAuth:this.handleDemoAuth,checkAuthInProgress:r}));var o=Kn({},this.plugin.getPluginState(),{username:this.username,getNextFolder:this.getNextFolder,getFolder:this.getFolder,filterItems:this.filterItems,filterQuery:this.filterQuery,toggleSearch:this.toggleSearch,sortByTitle:this.sortByTitle,sortByDate:this.sortByDate,logout:this.logout,demo:this.plugin.opts.demo,isActiveRow:this.isActiveRow,isChecked:this.isChecked,toggleCheckbox:this.toggleCheckbox,getItemId:this.plugin.getItemId,getItemName:this.plugin.getItemName,getItemIcon:this.plugin.getItemIcon,handleScroll:this.handleScroll,done:this.donePicking,cancel:this.cancelPicking,title:this.plugin.title,viewType:this.opts.viewType,showTitles:this.opts.showTitles,showFilter:this.opts.showFilter,showBreadcrumbs:this.opts.showBreadcrumbs,pluginIcon:this.plugin.icon,i18n:this.plugin.uppy.i18n});return Jn($n,{onUnmount:this.clearSelection},Jn(Gn,o))},t}(),Zn=Y.Plugin,tr=d.Provider,er=A.h,nr=function(t){function e(n,r){!function(t,n){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this);var o=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.call(this,n,r));return o.id=o.opts.id||"Dropbox",tr.initPlugin(o,r),o.title=o.opts.title||"Dropbox",o.icon=function(){return er("svg",{"aria-hidden":"true",fill:"#0060ff",width:"128",height:"118",viewBox:"0 0 128 118"},er("path",{d:"M38.145.777L1.108 24.96l25.608 20.507 37.344-23.06z"}),er("path",{d:"M1.108 65.975l37.037 24.183L64.06 68.525l-37.343-23.06zM64.06 68.525l25.917 21.633 37.036-24.183-25.61-20.51z"}),er("path",{d:"M127.014 24.96L89.977.776 64.06 22.407l37.345 23.06zM64.136 73.18l-25.99 21.567-11.122-7.262v8.142l37.112 22.256 37.114-22.256v-8.142l-11.12 7.262z"}))},o[o.id]=new tr(n,{serverUrl:o.opts.serverUrl,serverHeaders:o.opts.serverHeaders,provider:"dropbox"}),o.onAuth=o.onAuth.bind(o),o.render=o.render.bind(o),o}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.install=function(){this.view=new Qn(this),this.setPluginState({authenticated:!1,files:[],folders:[],directories:[],activeRow:-1,filterInput:"",isSearchVisible:!1});var t=this.opts.target;t&&this.mount(t,this)},e.prototype.uninstall=function(){this.view.tearDown(),this.unmount()},e.prototype.onAuth=function(t){this.setPluginState({authenticated:t}),t&&this.view.getFolder()},e.prototype.getUsername=function(t){return t.user_email},e.prototype.isFolder=function(t){return"folder"===t[".tag"]},e.prototype.getItemData=function(t){return t},e.prototype.getItemIcon=function(t){return t[".tag"]},e.prototype.getItemSubList=function(t){return t.entries},e.prototype.getItemName=function(t){return t.name||""},e.prototype.getMimeType=function(t){return null},e.prototype.getItemId=function(t){return t.id},e.prototype.getItemRequestPath=function(t){return encodeURIComponent(t.path_lower)},e.prototype.getItemModifiedDate=function(t){return t.server_modified},e.prototype.getItemThumbnailUrl=function(t){return this.opts.serverUrl+"/"+this.Dropbox.id+"/thumbnail/"+this.getItemRequestPath(t)},e.prototype.render=function(t){return this.view.render(t)},e}(Zn),rr=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},or=Y.Plugin,ir=A.h,sr=function(t){function e(n,r){!function(t,n){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this);var o=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.call(this,n,r));o.id=o.opts.id||"FileInput",o.title="File Input",o.type="acquirer";var i={strings:{chooseFiles:"Choose files"}},s={target:null,pretty:!0,inputName:"files[]",locale:i};return o.opts=rr({},s,r),o.locale=rr({},i,o.opts.locale),o.locale.strings=rr({},i.strings,o.opts.locale.strings),o.translator=new H({locale:o.locale}),o.i18n=o.translator.translate.bind(o.translator),o.render=o.render.bind(o),o.handleInputChange=o.handleInputChange.bind(o),o.handleClick=o.handleClick.bind(o),o}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.handleInputChange=function(t){var e=this;this.uppy.log("[FileInput] Something selected through input..."),gn(t.target.files).forEach(function(t){try{e.uppy.addFile({source:e.id,name:t.name,type:t.type,data:t})}catch(t){}})},e.prototype.handleClick=function(t){this.input.click()},e.prototype.render=function(t){var e=this,n=this.uppy.opts.restrictions;return ir("div",{class:"uppy-Root uppy-FileInput-container"},ir("input",{class:"uppy-FileInput-input",style:this.opts.pretty&&{width:"0.1px",height:"0.1px",opacity:0,overflow:"hidden",position:"absolute",zIndex:-1},type:"file",name:this.opts.inputName,onchange:this.handleInputChange,multiple:1!==n.maxNumberOfFiles,accept:n.allowedFileTypes,ref:function(t){e.input=t},value:""}),this.opts.pretty&&ir("button",{class:"uppy-FileInput-btn",type:"button",onclick:this.handleClick},this.i18n("chooseFiles")))},e.prototype.install=function(){var t=this.opts.target;t&&this.mount(t,this)},e.prototype.uninstall=function(){this.unmount()},e}(or),ar={__esModule:!0};ar.default=fr,ar.getFieldData=yr;var lr={"[object HTMLCollection]":!0,"[object NodeList]":!0,"[object RadioNodeList]":!0},ur={button:!0,fieldset:!0,reset:!0,submit:!0},pr={checkbox:!0,radio:!0},cr=/^\s+|\s+$/g,hr=Array.prototype.slice,dr=Object.prototype.toString;function fr(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{trim:!1};if(!t)throw new Error("A form is required by getFormData, was given form="+t);for(var n={},r=void 0,o=[],i={},s=0,a=t.elements.length;s<a;s++){var l=t.elements[s];ur[l.type]||l.disabled||(r=l.name||l.id)&&!i[r]&&(o.push(r),i[r]=!0)}for(var u=0,p=o.length;u<p;u++){var c=yr(t,r=o[u],e);null!=c&&(n[r]=c)}return n}function yr(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{trim:!1};if(!t)throw new Error("A form is required by getFieldData, was given form="+t);if(!e&&"[object String]"!==dr.call(e))throw new Error("A field name is required by getFieldData, was given fieldName="+e);var r=t.elements[e];if(!r||r.disabled)return null;if(!lr[dr.call(r)])return gr(r,n.trim);for(var o=[],i=!0,s=0,a=r.length;s<a;s++)if(!r[s].disabled){i&&"radio"!==r[s].type&&(i=!1);var l=gr(r[s],n.trim);null!=l&&(o=o.concat(l))}return i&&1===o.length?o[0]:o.length>0?o:null}function gr(t,e){var n=null,r=t.type;if("select-one"===r)return t.options.length&&(n=t.options[t.selectedIndex].value),n;if("select-multiple"===r){n=[];for(var o=0,i=t.options.length;o<i;o++)t.options[o].selected&&n.push(t.options[o].value);return 0===n.length&&(n=null),n}return"file"===r&&"files"in t?(t.multiple?0===(n=hr.call(t.files)).length&&(n=null):n=t.files[0],n):(pr[r]?t.checked&&(n=t.value):n=e?t.value.replace(cr,""):t.value,n)}fr.getFieldData=yr;var mr=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},vr=Y.Plugin,br=ar.default||ar,wr=function(t){function e(n,r){!function(t,n){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this);var o=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.call(this,n,r));return o.type="acquirer",o.id="Form",o.title="Form",o.opts=mr({},{target:null,resultName:"uppyResult",getMetaFromForm:!0,addResultToForm:!0,submitOnSuccess:!1,triggerUploadOnSubmit:!1},r),o.handleFormSubmit=o.handleFormSubmit.bind(o),o.handleUploadStart=o.handleUploadStart.bind(o),o.handleSuccess=o.handleSuccess.bind(o),o.addResultToForm=o.addResultToForm.bind(o),o.getMetaFromForm=o.getMetaFromForm.bind(o),o}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.handleUploadStart=function(){this.opts.getMetaFromForm&&this.getMetaFromForm()},e.prototype.handleSuccess=function(t){this.opts.addResultToForm&&this.addResultToForm(t),this.opts.submitOnSuccess&&this.form.submit()},e.prototype.handleFormSubmit=function(t){var e=this;this.opts.triggerUploadOnSubmit&&(t.preventDefault(),this.uppy.upload().catch(function(t){e.uppy.log(t.stack||t.message||t)}))},e.prototype.addResultToForm=function(t){this.uppy.log("[Form] Adding result to the original form:"),this.uppy.log(t);var e=this.form.querySelector('[name="'+this.opts.resultName+'"]');e?e.value=JSON.stringify(t):((e=document.createElement("input")).name=this.opts.resultName,e.type="hidden",e.value=JSON.stringify(t),this.form.appendChild(e))},e.prototype.getMetaFromForm=function(){var t=br(this.form);this.uppy.setMeta(t)},e.prototype.install=function(){this.form=I(this.opts.target),this.form&&"FORM"!==!this.form.nodeName?(this.form.addEventListener("submit",this.handleFormSubmit),this.uppy.on("upload",this.handleUploadStart),this.uppy.on("complete",this.handleSuccess)):console.error("Form plugin requires a <form> target element passed in options to operate, none was found","error")},e.prototype.uninstall=function(){this.form.removeEventListener("submit",this.handleFormSubmit),this.uppy.off("upload",this.handleUploadStart),this.uppy.off("complete",this.handleSuccess)},e}(vr),Sr={},_r=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Pr="undefined"!=typeof window&&(window.indexedDB||window.webkitIndexedDB||window.mozIndexedDB||window.OIndexedDB||window.msIndexedDB),Er=!!Pr,kr="uppy-blobs",Cr="files",Tr=864e5,Or=3;function Ur(t){var e=Pr.open(t,Or);return new Promise(function(t,n){e.onupgradeneeded=function(e){var n=e.target.result,r=e.currentTarget.transaction;if(e.oldVersion<2&&n.createObjectStore(Cr,{keyPath:"id"}).createIndex("store","store",{unique:!1}),e.oldVersion<3){var o=r.objectStore(Cr);o.createIndex("expires","expires",{unique:!1}),o.openCursor().onsuccess=function(t){var e=t.target.result;if(e){var n=e.value;n.expires=Date.now()+Tr,e.update(n)}}}r.oncomplete=function(){t(n)}},e.onsuccess=function(e){t(e.target.result)},e.onerror=n})}function Fr(t){return new Promise(function(e,n){t.onsuccess=function(t){e(t.target.result)},t.onerror=n})}var Ar=!1,xr=function(){function t(e){var n=this;!function(e,n){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this),this.opts=_r({dbName:kr,storeName:"default",expires:Tr,maxFileSize:10485760,maxTotalSize:314572800},e),this.name=this.opts.storeName;var r=function(){return Ur(n.opts.dbName)};Ar?this.ready=r():(Ar=!0,this.ready=t.cleanup().then(r,r))}return t.prototype.key=function(t){return this.name+"!"+t},t.prototype.list=function(){var t=this;return this.ready.then(function(e){return Fr(e.transaction([Cr],"readonly").objectStore(Cr).index("store").getAll(IDBKeyRange.only(t.name)))}).then(function(t){var e={};return t.forEach(function(t){e[t.fileID]=t.data}),e})},t.prototype.get=function(t){var e=this;return this.ready.then(function(n){return Fr(n.transaction([Cr],"readonly").objectStore(Cr).get(e.key(t)))}).then(function(t){return{id:t.data.fileID,data:t.data.data}})},t.prototype.getSize=function(){var t=this;return this.ready.then(function(e){var n=e.transaction([Cr],"readonly").objectStore(Cr).index("store").openCursor(IDBKeyRange.only(t.name));return new Promise(function(t,e){var r=0;n.onsuccess=function(e){var n=e.target.result;n?(r+=n.value.data.size,n.continue()):t(r)},n.onerror=function(){e(new Error("Could not retrieve stored blobs size"))}})})},t.prototype.put=function(t){var e=this;return t.data.size>this.opts.maxFileSize?Promise.reject(new Error("File is too big to store.")):this.getSize().then(function(t){return t>e.opts.maxTotalSize?Promise.reject(new Error("No space left")):e.ready}).then(function(n){return Fr(n.transaction([Cr],"readwrite").objectStore(Cr).add({id:e.key(t.id),fileID:t.id,store:e.name,expires:Date.now()+e.opts.expires,data:t.data}))})},t.prototype.delete=function(t){var e=this;return this.ready.then(function(n){return Fr(n.transaction([Cr],"readwrite").objectStore(Cr).delete(e.key(t)))})},t.cleanup=function(){return Ur(kr).then(function(t){var e=t.transaction([Cr],"readwrite").objectStore(Cr).index("expires").openCursor(IDBKeyRange.upperBound(Date.now()));return new Promise(function(n,r){e.onsuccess=function(e){var r=e.target.result;if(r){var o=r.value;console.log("[IndexedDBStore] Deleting record",o.fileID,"of size",F(o.data.size),"- expired on",new Date(o.expires)),r.delete(),r.continue()}else n(t)},e.onerror=r})}).then(function(t){t.close()})},t}();xr.isSupported=Er,Sr=xr;var Dr=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t};function Rr(t){try{return JSON.parse(t)}catch(t){return null}}var Ir=!1,Br=function(){function t(e){!function(e,n){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this),this.opts=Dr({expires:864e5},e),this.name="uppyState:"+e.storeName,Ir||(Ir=!0,t.cleanup())}return t.prototype.load=function(){var t=localStorage.getItem(this.name);if(!t)return null;var e=Rr(t);return e?e.metadata?e.metadata:(this.save(e),e):null},t.prototype.save=function(t){var e=Date.now()+this.opts.expires,n=JSON.stringify({metadata:t,expires:e});localStorage.setItem(this.name,n)},t.cleanup=function(){var t=function(){for(var t=[],e=0;e<localStorage.length;e++){var n=localStorage.key(e);/^uppyState:/.test(n)&&t.push(n.slice("uppyState:".length))}return t}(),e=Date.now();t.forEach(function(t){var n=localStorage.getItem("uppyState:"+t);if(!n)return null;var r=Rr(n);if(!r)return null;r.expires&&r.expires<e&&localStorage.removeItem("uppyState:"+t)})},t}(),jr={},Lr="undefined"!=typeof navigator&&"serviceWorker"in navigator,Mr=function(){function t(e){!function(e,n){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this),this.ready=new Promise(function(t,e){Lr?navigator.serviceWorker.controller?t():navigator.serviceWorker.addEventListener("controllerchange",function(){t()}):e(new Error("Unsupported"))}),this.name=e.storeName}return t.prototype.list=function(){var t=this,e={},n=new Promise(function(t,n){e.resolve=t,e.reject=n});console.log("Loading stored blobs from Service Worker");var r=function n(r){if(r.data.store===t.name)switch(r.data.type){case"uppy/ALL_FILES":e.resolve(r.data.files),navigator.serviceWorker.removeEventListener("message",n)}};return this.ready.then(function(){navigator.serviceWorker.addEventListener("message",r),navigator.serviceWorker.controller.postMessage({type:"uppy/GET_FILES",store:t.name})}),n},t.prototype.put=function(t){var e=this;return this.ready.then(function(){navigator.serviceWorker.controller.postMessage({type:"uppy/ADD_FILE",store:e.name,file:t})})},t.prototype.delete=function(t){var e=this;return this.ready.then(function(){navigator.serviceWorker.controller.postMessage({type:"uppy/REMOVE_FILE",store:e.name,fileID:t})})},t}();Mr.isSupported=Lr,jr=Mr;var Nr,zr=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},qr=function(t){function e(n,r){!function(t,n){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this);var o=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.call(this,n,r));return o.type="debugger",o.id="GoldenRetriever",o.title="Golden Retriever",o.opts=zr({},{expires:864e5,serviceWorker:!1},r),o.MetaDataStore=new Br({expires:o.opts.expires,storeName:n.getID()}),o.ServiceWorkerStore=null,o.opts.serviceWorker&&(o.ServiceWorkerStore=new jr({storeName:n.getID()})),o.IndexedDBStore=new Sr(zr({expires:o.opts.expires},r.indexedDB||{},{storeName:n.getID()})),o.saveFilesStateToLocalStorage=o.saveFilesStateToLocalStorage.bind(o),o.loadFilesStateFromLocalStorage=o.loadFilesStateFromLocalStorage.bind(o),o.loadFileBlobsFromServiceWorker=o.loadFileBlobsFromServiceWorker.bind(o),o.loadFileBlobsFromIndexedDB=o.loadFileBlobsFromIndexedDB.bind(o),o.onBlobsLoaded=o.onBlobsLoaded.bind(o),o}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.loadFilesStateFromLocalStorage=function(){var t=this.MetaDataStore.load();t&&(this.uppy.log("[GoldenRetriever] Recovered some state from Local Storage"),this.uppy.setState({currentUploads:t.currentUploads||{},files:t.files||{}}),this.savedPluginData=t.pluginData)},e.prototype.getWaitingFiles=function(){var t={};return this.uppy.getFiles().forEach(function(e){e.progress&&e.progress.uploadStarted||(t[e.id]=e)}),t},e.prototype.getUploadingFiles=function(){var t=this,e={},n=this.uppy.getState().currentUploads;return n&&Object.keys(n).forEach(function(r){n[r].fileIDs.forEach(function(n){e[n]=t.uppy.getFile(n)})}),e},e.prototype.saveFilesStateToLocalStorage=function(){var t=zr(this.getWaitingFiles(),this.getUploadingFiles()),e={};this.uppy.emit("restore:get-data",function(t){zr(e,t)});var n=this.uppy.getState().currentUploads;this.MetaDataStore.save({currentUploads:n,files:t,pluginData:e})},e.prototype.loadFileBlobsFromServiceWorker=function(){var t=this;this.ServiceWorkerStore.list().then(function(e){var n=Object.keys(e).length;return n===t.uppy.getFiles().length?(t.uppy.log("[GoldenRetriever] Successfully recovered "+n+" blobs from Service Worker!"),t.uppy.info("Successfully recovered "+n+" files","success",3e3),t.onBlobsLoaded(e)):(t.uppy.log("[GoldenRetriever] No blobs found in Service Worker, trying IndexedDB now..."),t.loadFileBlobsFromIndexedDB())}).catch(function(e){t.uppy.log("[GoldenRetriever] Failed to recover blobs from Service Worker","warning"),t.uppy.log(e)})},e.prototype.loadFileBlobsFromIndexedDB=function(){var t=this;this.IndexedDBStore.list().then(function(e){var n=Object.keys(e).length;if(n>0)return t.uppy.log("[GoldenRetriever] Successfully recovered "+n+" blobs from IndexedDB!"),t.uppy.info("Successfully recovered "+n+" files","success",3e3),t.onBlobsLoaded(e);t.uppy.log("[GoldenRetriever] No blobs found in IndexedDB")}).catch(function(e){t.uppy.log("[GoldenRetriever] Failed to recover blobs from IndexedDB","warning"),t.uppy.log(e)})},e.prototype.onBlobsLoaded=function(t){var e=this,n=[],r=zr({},this.uppy.getState().files);Object.keys(t).forEach(function(o){var i=e.uppy.getFile(o);if(i){var s=t[o],a=zr({},i,{data:s,isRestored:!0});r[o]=a}else n.push(o)}),this.uppy.setState({files:r}),this.uppy.emit("restored",this.savedPluginData),n.length&&this.deleteBlobs(n).then(function(){e.uppy.log("[GoldenRetriever] Cleaned up "+n.length+" old files")}).catch(function(t){e.uppy.log("[GoldenRetriever] Could not clean up "+n.length+" old files","warning"),e.uppy.log(t)})},e.prototype.deleteBlobs=function(t){var e=this,n=[];return t.forEach(function(t){e.ServiceWorkerStore&&n.push(e.ServiceWorkerStore.delete(t)),e.IndexedDBStore&&n.push(e.IndexedDBStore.delete(t))}),Promise.all(n)},e.prototype.install=function(){var t=this;this.loadFilesStateFromLocalStorage(),this.uppy.getFiles().length>0?this.ServiceWorkerStore?(this.uppy.log("[GoldenRetriever] Attempting to load files from Service Worker..."),this.loadFileBlobsFromServiceWorker()):(this.uppy.log("[GoldenRetriever] Attempting to load files from Indexed DB..."),this.loadFileBlobsFromIndexedDB()):(this.uppy.log("[GoldenRetriever] No files need to be loaded, only restoring processing state..."),this.onBlobsLoaded([])),this.uppy.on("file-added",function(e){e.isRemote||(t.ServiceWorkerStore&&t.ServiceWorkerStore.put(e).catch(function(e){t.uppy.log("[GoldenRetriever] Could not store file","warning"),t.uppy.log(e)}),t.IndexedDBStore.put(e).catch(function(e){t.uppy.log("[GoldenRetriever] Could not store file","warning"),t.uppy.log(e)}))}),this.uppy.on("file-removed",function(e){t.ServiceWorkerStore&&t.ServiceWorkerStore.delete(e.id).catch(function(e){t.uppy.log("[GoldenRetriever] Failed to remove file","warning"),t.uppy.log(e)}),t.IndexedDBStore.delete(e.id).catch(function(e){t.uppy.log("[GoldenRetriever] Failed to remove file","warning"),t.uppy.log(e)})}),this.uppy.on("complete",function(e){var n=e.successful,r=n.map(function(t){return t.id});t.deleteBlobs(r).then(function(){t.uppy.log("[GoldenRetriever] Removed "+n.length+" files that finished uploading")}).catch(function(e){t.uppy.log("[GoldenRetriever] Could not remove "+n.length+" files that finished uploading","warning"),t.uppy.log(e)})}),this.uppy.on("state-update",this.saveFilesStateToLocalStorage),this.uppy.on("restored",function(){var e=t.uppy.getState().currentUploads;e&&Object.keys(e).forEach(function(n){t.uppy.restore(n,e[n])})})},e}(Y.Plugin),Hr=function(t){function e(){return function(t,n){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this),function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.apply(this,arguments))}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.toggleCheckbox=function(e,n){e.stopPropagation(),e.preventDefault(),"drive#teamDrive"!==n.kind&&t.prototype.toggleCheckbox.call(this,e,n)},e}(Qn),Wr=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Xr=Y.Plugin,Vr=d.Provider,Gr=A.h,Kr=function(t){function e(n,r){!function(t,n){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this);var o=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.call(this,n,r));return o.id=o.opts.id||"GoogleDrive",o.title=o.opts.title||"Google Drive",Vr.initPlugin(o,r),o.title=o.opts.title||"Google Drive",o.icon=function(){return Gr("svg",{"aria-hidden":"true",width:"18px",height:"16px",viewBox:"0 0 18 16",version:"1.1",xmlns:"http://www.w3.org/2000/svg"},Gr("g",{"fill-rule":"evenodd"},Gr("polygon",{fill:"#3089FC",points:"6.32475 10.2 18 10.2 14.999625 15.3 3.324375 15.3"}),Gr("polygon",{fill:"#00A85D",points:"3.000375 15.3 0 10.2 5.83875 0.275974026 8.838 5.37597403 5.999625 10.2"}),Gr("polygon",{fill:"#FFD024",points:"11.838375 9.92402597 5.999625 0 12.000375 0 17.839125 9.92402597"})))},o[o.id]=new Vr(n,{serverUrl:o.opts.serverUrl,serverHeaders:o.opts.serverHeaders,provider:"drive",authProvider:"google"}),o.onAuth=o.onAuth.bind(o),o.render=o.render.bind(o),o}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.install=function(){this.view=new Hr(this),this.setPluginState({authenticated:!1,files:[],folders:[],directories:[],activeRow:-1,filterInput:"",isSearchVisible:!1,hasTeamDrives:!1,teamDrives:[],teamDriveId:""});var t=this.opts.target;t&&this.mount(t,this)},e.prototype.uninstall=function(){this.view.tearDown(),this.unmount()},e.prototype.onAuth=function(t){this.setPluginState({authenticated:t}),t&&(this.view.getFolder("root"),this.getTeamDrives())},e.prototype.getTeamDrives=function(){var t=this;this[this.id].get(this.GoogleDrive.id+"/list/?listTeamDrives=true").then(function(e){e.teamDrives&&e.teamDrives.length&&t.setPluginState({hasTeamDrives:!0,teamDrives:e.teamDrives})})},e.prototype.getUsername=function(t){var e=t.files,n=Array.isArray(e),r=0;for(e=n?e:e[Symbol.iterator]();;){var o;if(n){if(r>=e.length)break;o=e[r++]}else{if((r=e.next()).done)break;o=r.value}var i=o;if(i.ownedByMe){var s=i.permissions,a=Array.isArray(s),l=0;for(s=a?s:s[Symbol.iterator]();;){var u;if(a){if(l>=s.length)break;u=s[l++]}else{if((l=s.next()).done)break;u=l.value}var p=u;if("owner"===p.role)return p.emailAddress}}}},e.prototype.isFolder=function(t){return"application/vnd.google-apps.folder"===t.mimeType},e.prototype.getItemData=function(t){return Wr({},t,{size:parseFloat(t.size)})},e.prototype.getItemIcon=function(t){return t.iconLink},e.prototype.getItemSubList=function(t){var e=this;return t.files.filter(function(t){return e.isFolder(t)||!t.mimeType.startsWith("application/vnd.google")})},e.prototype.getItemName=function(t){return t.name?t.name:"/"},e.prototype.getMimeType=function(t){return t.mimeType},e.prototype.getItemId=function(t){return t.id},e.prototype.getItemRequestPath=function(t){return t.teamDriveId&&(t.id+="?teamDriveId="+t.teamDriveId,delete t.teamDriveId),this.getItemId(t)},e.prototype.getItemModifiedDate=function(t){return t.modifiedTime},e.prototype.getItemThumbnailUrl=function(t){return this.opts.serverUrl+"/"+this.GoogleDrive.id+"/thumbnail/"+this.getItemRequestPath(t)},e.prototype.render=function(t){var e=this.getPluginState();if(e.hasTeamDrives){var n=e.folders;n=n.filter(function(t){return"drive#teamDrive"!==t.kind}),1===e.directories.length&&e.teamDrives.forEach(function(t){n.splice(0,0,{id:"?teamDriveId="+t.id,name:t.name,kind:t.kind,iconLink:t.backgroundImageLink+"=w16-h16-n"})}),e.folders=n}return this.view.render(t)},e}(Xr),Yr=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Jr=Y.Plugin,$r=d.Provider,Qr=A.h,Zr=function(t){function e(n,r){!function(t,n){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this);var o=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.call(this,n,r));return o.id=o.opts.id||"Instagram",$r.initPlugin(o,r),o.title=o.opts.title||"Instagram",o.icon=function(){return Qr("svg",{"aria-hidden":"true",fill:"#DE3573",width:"28",height:"28",viewBox:"0 0 512 512"},Qr("path",{d:"M256,49.471c67.266,0,75.233.257,101.8,1.469,24.562,1.121,37.9,5.224,46.778,8.674a78.052,78.052,0,0,1,28.966,18.845,78.052,78.052,0,0,1,18.845,28.966c3.45,8.877,7.554,22.216,8.674,46.778,1.212,26.565,1.469,34.532,1.469,101.8s-0.257,75.233-1.469,101.8c-1.121,24.562-5.225,37.9-8.674,46.778a83.427,83.427,0,0,1-47.811,47.811c-8.877,3.45-22.216,7.554-46.778,8.674-26.56,1.212-34.527,1.469-101.8,1.469s-75.237-.257-101.8-1.469c-24.562-1.121-37.9-5.225-46.778-8.674a78.051,78.051,0,0,1-28.966-18.845,78.053,78.053,0,0,1-18.845-28.966c-3.45-8.877-7.554-22.216-8.674-46.778-1.212-26.564-1.469-34.532-1.469-101.8s0.257-75.233,1.469-101.8c1.121-24.562,5.224-37.9,8.674-46.778A78.052,78.052,0,0,1,78.458,78.458a78.053,78.053,0,0,1,28.966-18.845c8.877-3.45,22.216-7.554,46.778-8.674,26.565-1.212,34.532-1.469,101.8-1.469m0-45.391c-68.418,0-77,.29-103.866,1.516-26.815,1.224-45.127,5.482-61.151,11.71a123.488,123.488,0,0,0-44.62,29.057A123.488,123.488,0,0,0,17.3,90.982C11.077,107.007,6.819,125.319,5.6,152.134,4.369,179,4.079,187.582,4.079,256S4.369,333,5.6,359.866c1.224,26.815,5.482,45.127,11.71,61.151a123.489,123.489,0,0,0,29.057,44.62,123.486,123.486,0,0,0,44.62,29.057c16.025,6.228,34.337,10.486,61.151,11.71,26.87,1.226,35.449,1.516,103.866,1.516s77-.29,103.866-1.516c26.815-1.224,45.127-5.482,61.151-11.71a128.817,128.817,0,0,0,73.677-73.677c6.228-16.025,10.486-34.337,11.71-61.151,1.226-26.87,1.516-35.449,1.516-103.866s-0.29-77-1.516-103.866c-1.224-26.815-5.482-45.127-11.71-61.151a123.486,123.486,0,0,0-29.057-44.62A123.487,123.487,0,0,0,421.018,17.3C404.993,11.077,386.681,6.819,359.866,5.6,333,4.369,324.418,4.079,256,4.079h0Z"}),Qr("path",{d:"M256,126.635A129.365,129.365,0,1,0,385.365,256,129.365,129.365,0,0,0,256,126.635Zm0,213.338A83.973,83.973,0,1,1,339.974,256,83.974,83.974,0,0,1,256,339.973Z"}),Qr("circle",{cx:"390.476",cy:"121.524",r:"30.23"}))},o[o.id]=new $r(n,{serverUrl:o.opts.serverUrl,serverHeaders:o.opts.serverHeaders,provider:"instagram",authProvider:"instagram"}),o.onAuth=o.onAuth.bind(o),o.render=o.render.bind(o),o}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.install=function(){this.view=new Qn(this,{viewType:"grid",showTitles:!1,showFilter:!1,showBreadcrumbs:!1}),this.setPluginState({authenticated:!1,files:[],folders:[],directories:[],activeRow:-1,filterInput:"",isSearchVisible:!1});var t=this.opts.target;t&&this.mount(t,this)},e.prototype.uninstall=function(){this.view.tearDown(),this.unmount()},e.prototype.onAuth=function(t){this.setPluginState({authenticated:t}),t&&this.view.getFolder("recent")},e.prototype.getUsername=function(t){return t.data[0].user.username},e.prototype.isFolder=function(t){return!1},e.prototype.getItemData=function(t){return t},e.prototype.getItemIcon=function(t){return t.images?t.images.low_resolution.url:"video"},e.prototype.getItemSubList=function(t){var e=[];return t.data.forEach(function(t){t.carousel_media?t.carousel_media.forEach(function(n,r){var o=t.id,i=t.created_time,s=Yr({},n,{id:o,created_time:i});s.carousel_id=r,e.push(s)}):e.push(t)}),e},e.prototype.getItemName=function(t){if(t&&t.created_time){var e="video"===t.type?"mp4":"jpeg",n=new Date(1e3*t.created_time);return"Instagram "+(n=n.toLocaleDateString([],{year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"numeric"}))+(t.carousel_id?" "+t.carousel_id:"")+"."+e}return""},e.prototype.getMimeType=function(t){return"video"===t.type?"video/mp4":"image/jpeg"},e.prototype.getItemId=function(t){return""+t.id+(t.carousel_id||"")},e.prototype.getItemRequestPath=function(t){var e=isNaN(t.carousel_id)?"":"?carousel_id="+t.carousel_id;return""+t.id+e},e.prototype.getItemModifiedDate=function(t){return t.created_time},e.prototype.getItemThumbnailUrl=function(t){return t.images.thumbnail.url},e.prototype.getNextPagePath=function(){var t=this.getPluginState().files;return"recent?max_id="+this.getItemId(t[t.length-1])},e.prototype.render=function(t){return this.view.render(t)},e}(Jr),to=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},eo=Y.Plugin,no=A.h,ro=function(t){function e(n,r){!function(t,n){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this);var o=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.call(this,n,r));return o.id=o.opts.id||"ProgressBar",o.title="Progress Bar",o.type="progressindicator",o.opts=to({},{target:"body",replaceTargetContent:!1,fixed:!1,hideAfterFinish:!0},r),o.render=o.render.bind(o),o}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.render=function(t){var e=t.totalProgress||0,n=100===e&&this.opts.hideAfterFinish;return no("div",{class:"uppy uppy-ProgressBar",style:{position:this.opts.fixed?"fixed":"initial"},"aria-hidden":n},no("div",{class:"uppy-ProgressBar-inner",style:{width:e+"%"}}),no("div",{class:"uppy-ProgressBar-percentage"},e))},e.prototype.install=function(){var t=this.opts.target;t&&this.mount(t,this)},e.prototype.uninstall=function(){this.unmount()},e}(eo),oo=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},io=function(t){function e(n,r){!function(t,n){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this);var o=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.call(this,n,r));return o.type="debugger",o.id="ReduxDevTools",o.title="Redux DevTools",o.opts=oo({},{},r),o.handleStateChange=o.handleStateChange.bind(o),o.initDevTools=o.initDevTools.bind(o),o}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.handleStateChange=function(t,e,n){this.devTools.send("UPPY_STATE_UPDATE",e)},e.prototype.initDevTools=function(){var t=this;this.devTools=window.devToolsExtension.connect(),this.devToolsUnsubscribe=this.devTools.subscribe(function(e){if("DISPATCH"===e.type)switch(console.log(e.payload.type),e.payload.type){case"RESET":return void t.uppy.reset();case"IMPORT_STATE":var n=e.payload.nextLiftedState.computedStates;return t.uppy.store.state=oo({},t.uppy.getState(),n[n.length-1].state),void t.uppy.updateAll(t.uppy.getState());case"JUMP_TO_STATE":case"JUMP_TO_ACTION":t.uppy.store.state=oo({},t.uppy.getState(),JSON.parse(e.state)),t.uppy.updateAll(t.uppy.getState())}})},e.prototype.install=function(){this.withDevTools="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__,this.withDevTools&&(this.initDevTools(),this.uppy.on("state-update",this.handleStateChange))},e.prototype.uninstall=function(){this.withDevTools&&(this.devToolsUnsubscribe(),this.uppy.off("state-update",this.handleStateUpdate))},e}(Y.Plugin),so=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},ao=function(t){return function(e){return e.uppy[t]}},lo=function(){function t(e){!function(e,n){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this),this._store=e.store,this._id=e.id||b(),this._selector=e.selector||ao(this._id),this.setState({})}return t.prototype.setState=function(t){this._store.dispatch({type:"uppy/STATE_UPDATE",id:this._id,payload:t})},t.prototype.getState=function(){return this._selector(this._store.getState())},t.prototype.subscribe=function(t){var e=this,n=this.getState();return this._store.subscribe(function(){var r=e.getState();if(n!==r){var o=function(t,e){var n=Object.keys(e),r={};return n.forEach(function(n){t[n]!==e[n]&&(r[n]=e[n])}),r}(n,r);t(n,r,o),n=r}})},t}();(Nr=function(t){return new lo(t)}).STATE_UPDATE="uppy/STATE_UPDATE",Nr.reducer=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments[1];if("uppy/STATE_UPDATE"===e.type){var n,r=so({},t[e.id],e.payload);return so({},t,((n={})[e.id]=r,n))}return t},Nr.middleware=function(){return function(){return function(t){return function(e){t(e)}}}};var uo={exports:{}};function po(t){if(t)return function(t){for(var e in po.prototype)t[e]=po.prototype[e];return t}(t)}uo.exports=po,po.prototype.on=po.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},po.prototype.once=function(t,e){function n(){this.off(t,n),e.apply(this,arguments)}return n.fn=e,this.on(t,n),this},po.prototype.off=po.prototype.removeListener=po.prototype.removeAllListeners=po.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n,r=this._callbacks["$"+t];if(!r)return this;if(1==arguments.length)return delete this._callbacks["$"+t],this;for(var o=0;o<r.length;o++)if((n=r[o])===e||n.fn===e){r.splice(o,1);break}return this},po.prototype.emit=function(t){this._callbacks=this._callbacks||{};var e=[].slice.call(arguments,1),n=this._callbacks["$"+t];if(n)for(var r=0,o=(n=n.slice(0)).length;r<o;++r)n[r].apply(this,e);return this},po.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]},po.prototype.hasListeners=function(t){return!!this.listeners(t).length},uo=uo.exports;var co={};function ho(t){t=t||{},this.ms=t.min||100,this.max=t.max||1e4,this.factor=t.factor||2,this.jitter=t.jitter>0&&t.jitter<=1?t.jitter:0,this.attempts=0}co=ho,ho.prototype.duration=function(){var t=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),n=Math.floor(e*this.jitter*t);t=0==(1&Math.floor(10*e))?t-n:t+n}return 0|Math.min(t,this.max)},ho.prototype.reset=function(){this.attempts=0},ho.prototype.setMin=function(t){this.ms=t},ho.prototype.setMax=function(t){this.max=t},ho.prototype.setJitter=function(t){this.jitter=t};for(var fo=[].slice,yo=function(t,e){if("string"==typeof e&&(e=t[e]),"function"!=typeof e)throw new Error("bind() requires a function");var n=fo.call(arguments,2);return function(){return e.apply(t,n.concat(fo.call(arguments)))}},go=[].indexOf,mo=function(t,e){if(go)return t.indexOf(e);for(var n=0;n<t.length;++n)if(t[n]===e)return n;return-1},vo=function(t,e,n){return t.on(e,n),{destroy:function(){t.removeListener(e,n)}}},bo={toByteArray:function(t){var e,n,r,o,i,s,a=t.length;i=Co(t),s=new _o(3*a/4-i),r=i>0?a-4:a;var l=0;for(e=0,n=0;e<r;e+=4,n+=3)o=So[t.charCodeAt(e)]<<18|So[t.charCodeAt(e+1)]<<12|So[t.charCodeAt(e+2)]<<6|So[t.charCodeAt(e+3)],s[l++]=o>>16&255,s[l++]=o>>8&255,s[l++]=255&o;return 2===i?(o=So[t.charCodeAt(e)]<<2|So[t.charCodeAt(e+1)]>>4,s[l++]=255&o):1===i&&(o=So[t.charCodeAt(e)]<<10|So[t.charCodeAt(e+1)]<<4|So[t.charCodeAt(e+2)]>>2,s[l++]=o>>8&255,s[l++]=255&o),s},fromByteArray:function(t){for(var e,n=t.length,r=n%3,o="",i=[],s=0,a=n-r;s<a;s+=16383)i.push(To(t,s,s+16383>a?a:s+16383));return 1===r?(e=t[n-1],o+=wo[e>>2],o+=wo[e<<4&63],o+="=="):2===r&&(e=(t[n-2]<<8)+t[n-1],o+=wo[e>>10],o+=wo[e>>4&63],o+=wo[e<<2&63],o+="="),i.push(o),i.join("")}},wo=[],So=[],_o="undefined"!=typeof Uint8Array?Uint8Array:Array,Po="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Eo=0,ko=Po.length;Eo<ko;++Eo)wo[Eo]=Po[Eo],So[Po.charCodeAt(Eo)]=Eo;function Co(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===t[e-2]?2:"="===t[e-1]?1:0}function To(t,e,n){for(var r,o,i=[],s=e;s<n;s+=3)r=(t[s]<<16)+(t[s+1]<<8)+t[s+2],i.push(wo[(o=r)>>18&63]+wo[o>>12&63]+wo[o>>6&63]+wo[63&o]);return i.join("")}So["-".charCodeAt(0)]=62,So["_".charCodeAt(0)]=63;var Oo={read:function(t,e,n,r,o){var i,s,a=8*o-r-1,l=(1<<a)-1,u=l>>1,p=-7,c=n?o-1:0,h=n?-1:1,d=t[e+c];for(c+=h,i=d&(1<<-p)-1,d>>=-p,p+=a;p>0;i=256*i+t[e+c],c+=h,p-=8);for(s=i&(1<<-p)-1,i>>=-p,p+=r;p>0;s=256*s+t[e+c],c+=h,p-=8);if(0===i)i=1-u;else{if(i===l)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,r),i-=u}return(d?-1:1)*s*Math.pow(2,i-r)},write:function(t,e,n,r,o,i){var s,a,l,u=8*i-o-1,p=(1<<u)-1,c=p>>1,h=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:i-1,f=r?1:-1,y=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=p):(s=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-s))<1&&(s--,l*=2),(e+=s+c>=1?h/l:h*Math.pow(2,1-c))*l>=2&&(s++,l/=2),s+c>=p?(a=0,s=p):s+c>=1?(a=(e*l-1)*Math.pow(2,o),s+=c):(a=e*Math.pow(2,c-1)*Math.pow(2,o),s=0));o>=8;t[n+d]=255&a,d+=f,a/=256,o-=8);for(s=s<<o|a,u+=o;u>0;t[n+d]=255&s,d+=f,s/=256,u-=8);t[n+d-f]|=128*y}},Uo={};Uo.Buffer=xo,Uo.INSPECT_MAX_BYTES=50;var Fo=2147483647;function Ao(t){if(t>Fo)throw new RangeError("Invalid typed array length");var e=new Uint8Array(t);return e.__proto__=xo.prototype,e}function xo(t,e,n){if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return Io(t)}return Do(t,e,n)}function Do(t,e,n){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return pi(t)||t&&pi(t.buffer)?function(t,e,n){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(n||0))throw new RangeError('"length" is outside of buffer bounds');var r;return(r=void 0===e&&void 0===n?new Uint8Array(t):void 0===n?new Uint8Array(t,e):new Uint8Array(t,e,n)).__proto__=xo.prototype,r}(t,e,n):"string"==typeof t?function(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!xo.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var n=0|Lo(t,e),r=Ao(n),o=r.write(t,e);return o!==n&&(r=r.slice(0,o)),r}(t,e):function(t){if(xo.isBuffer(t)){var e=0|jo(t.length),n=Ao(e);return 0===n.length?n:(t.copy(n,0,0,e),n)}if(t){if(ArrayBuffer.isView(t)||"length"in t)return"number"!=typeof t.length||ci(t.length)?Ao(0):Bo(t);if("Buffer"===t.type&&Array.isArray(t.data))return Bo(t.data)}throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object.")}(t)}function Ro(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('"size" argument must not be negative')}function Io(t){return Ro(t),Ao(t<0?0:0|jo(t))}function Bo(t){for(var e=t.length<0?0:0|jo(t.length),n=Ao(e),r=0;r<e;r+=1)n[r]=255&t[r];return n}function jo(t){if(t>=Fo)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Fo.toString(16)+" bytes");return 0|t}function Lo(t,e){if(xo.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||pi(t))return t.byteLength;"string"!=typeof t&&(t=""+t);var n=t.length;if(0===n)return 0;for(var r=!1;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return ai(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return li(t).length;default:if(r)return ai(t).length;e=(""+e).toLowerCase(),r=!0}}function Mo(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function No(t,e,n,r,o){if(0===t.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),ci(n=+n)&&(n=o?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(o)return-1;n=t.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof e&&(e=xo.from(e,r)),xo.isBuffer(e))return 0===e.length?-1:zo(t,e,n,r,o);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):zo(t,[e],n,r,o);throw new TypeError("val must be string, number or Buffer")}function zo(t,e,n,r,o){var i,s=1,a=t.length,l=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;s=2,a/=2,l/=2,n/=2}function u(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(o){var p=-1;for(i=n;i<a;i++)if(u(t,i)===u(e,-1===p?0:i-p)){if(-1===p&&(p=i),i-p+1===l)return p*s}else-1!==p&&(i-=i-p),p=-1}else for(n+l>a&&(n=a-l),i=n;i>=0;i--){for(var c=!0,h=0;h<l;h++)if(u(t,i+h)!==u(e,h)){c=!1;break}if(c)return i}return-1}function qo(t,e,n,r){n=Number(n)||0;var o=t.length-n;r?(r=Number(r))>o&&(r=o):r=o;var i=e.length;r>i/2&&(r=i/2);for(var s=0;s<r;++s){var a=parseInt(e.substr(2*s,2),16);if(ci(a))return s;t[n+s]=a}return s}function Ho(t,e,n,r){return ui(ai(e,t.length-n),t,n,r)}function Wo(t,e,n,r){return ui(function(t){for(var e=[],n=0;n<t.length;++n)e.push(255&t.charCodeAt(n));return e}(e),t,n,r)}function Xo(t,e,n,r){return Wo(t,e,n,r)}function Vo(t,e,n,r){return ui(li(e),t,n,r)}function Go(t,e,n,r){return ui(function(t,e){for(var n,r,o,i=[],s=0;s<t.length&&!((e-=2)<0);++s)r=(n=t.charCodeAt(s))>>8,o=n%256,i.push(o),i.push(r);return i}(e,t.length-n),t,n,r)}function Ko(t,e,n){return 0===e&&n===t.length?bo.fromByteArray(t):bo.fromByteArray(t.slice(e,n))}function Yo(t,e,n){n=Math.min(t.length,n);for(var r=[],o=e;o<n;){var i,s,a,l,u=t[o],p=null,c=u>239?4:u>223?3:u>191?2:1;if(o+c<=n)switch(c){case 1:u<128&&(p=u);break;case 2:128==(192&(i=t[o+1]))&&(l=(31&u)<<6|63&i)>127&&(p=l);break;case 3:i=t[o+1],s=t[o+2],128==(192&i)&&128==(192&s)&&(l=(15&u)<<12|(63&i)<<6|63&s)>2047&&(l<55296||l>57343)&&(p=l);break;case 4:i=t[o+1],s=t[o+2],a=t[o+3],128==(192&i)&&128==(192&s)&&128==(192&a)&&(l=(15&u)<<18|(63&i)<<12|(63&s)<<6|63&a)>65535&&l<1114112&&(p=l)}null===p?(p=65533,c=1):p>65535&&(p-=65536,r.push(p>>>10&1023|55296),p=56320|1023&p),r.push(p),o+=c}return function(t){var e=t.length;if(e<=Jo)return String.fromCharCode.apply(String,t);for(var n="",r=0;r<e;)n+=String.fromCharCode.apply(String,t.slice(r,r+=Jo));return n}(r)}xo.TYPED_ARRAY_SUPPORT=function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()}catch(t){return!1}}(),xo.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(xo.prototype,"parent",{get:function(){if(this instanceof xo)return this.buffer}}),Object.defineProperty(xo.prototype,"offset",{get:function(){if(this instanceof xo)return this.byteOffset}}),"undefined"!=typeof Symbol&&Symbol.species&&xo[Symbol.species]===xo&&Object.defineProperty(xo,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),xo.poolSize=8192,xo.from=function(t,e,n){return Do(t,e,n)},xo.prototype.__proto__=Uint8Array.prototype,xo.__proto__=Uint8Array,xo.alloc=function(t,e,n){return function(t,e,n){return Ro(t),t<=0?Ao(t):void 0!==e?"string"==typeof n?Ao(t).fill(e,n):Ao(t).fill(e):Ao(t)}(t,e,n)},xo.allocUnsafe=function(t){return Io(t)},xo.allocUnsafeSlow=function(t){return Io(t)},xo.isBuffer=function(t){return null!=t&&!0===t._isBuffer},xo.compare=function(t,e){if(!xo.isBuffer(t)||!xo.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var n=t.length,r=e.length,o=0,i=Math.min(n,r);o<i;++o)if(t[o]!==e[o]){n=t[o],r=e[o];break}return n<r?-1:r<n?1:0},xo.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},xo.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return xo.alloc(0);var n;if(void 0===e)for(e=0,n=0;n<t.length;++n)e+=t[n].length;var r=xo.allocUnsafe(e),o=0;for(n=0;n<t.length;++n){var i=t[n];if(ArrayBuffer.isView(i)&&(i=xo.from(i)),!xo.isBuffer(i))throw new TypeError('"list" argument must be an Array of Buffers');i.copy(r,o),o+=i.length}return r},xo.byteLength=Lo,xo.prototype._isBuffer=!0,xo.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)Mo(this,e,e+1);return this},xo.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)Mo(this,e,e+3),Mo(this,e+1,e+2);return this},xo.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)Mo(this,e,e+7),Mo(this,e+1,e+6),Mo(this,e+2,e+5),Mo(this,e+3,e+4);return this},xo.prototype.toString=function(){var t=this.length;return 0===t?"":0===arguments.length?Yo(this,0,t):function(t,e,n){var r=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return Zo(this,e,n);case"utf8":case"utf-8":return Yo(this,e,n);case"ascii":return $o(this,e,n);case"latin1":case"binary":return Qo(this,e,n);case"base64":return Ko(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ti(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}.apply(this,arguments)},xo.prototype.toLocaleString=xo.prototype.toString,xo.prototype.equals=function(t){if(!xo.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===xo.compare(this,t)},xo.prototype.inspect=function(){var t="",e=Uo.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(t+=" ... ")),"<Buffer "+t+">"},xo.prototype.compare=function(t,e,n,r,o){if(!xo.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===r&&(r=0),void 0===o&&(o=this.length),e<0||n>t.length||r<0||o>this.length)throw new RangeError("out of range index");if(r>=o&&e>=n)return 0;if(r>=o)return-1;if(e>=n)return 1;if(this===t)return 0;for(var i=(o>>>=0)-(r>>>=0),s=(n>>>=0)-(e>>>=0),a=Math.min(i,s),l=this.slice(r,o),u=t.slice(e,n),p=0;p<a;++p)if(l[p]!==u[p]){i=l[p],s=u[p];break}return i<s?-1:s<i?1:0},xo.prototype.includes=function(t,e,n){return-1!==this.indexOf(t,e,n)},xo.prototype.indexOf=function(t,e,n){return No(this,t,e,n,!0)},xo.prototype.lastIndexOf=function(t,e,n){return No(this,t,e,n,!1)},xo.prototype.write=function(t,e,n,r){if(void 0===e)r="utf8",n=this.length,e=0;else if(void 0===n&&"string"==typeof e)r=e,n=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var o=this.length-e;if((void 0===n||n>o)&&(n=o),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var i=!1;;)switch(r){case"hex":return qo(this,t,e,n);case"utf8":case"utf-8":return Ho(this,t,e,n);case"ascii":return Wo(this,t,e,n);case"latin1":case"binary":return Xo(this,t,e,n);case"base64":return Vo(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Go(this,t,e,n);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),i=!0}},xo.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Jo=4096;function $o(t,e,n){var r="";n=Math.min(t.length,n);for(var o=e;o<n;++o)r+=String.fromCharCode(127&t[o]);return r}function Qo(t,e,n){var r="";n=Math.min(t.length,n);for(var o=e;o<n;++o)r+=String.fromCharCode(t[o]);return r}function Zo(t,e,n){var r,o=t.length;(!e||e<0)&&(e=0),(!n||n<0||n>o)&&(n=o);for(var i="",s=e;s<n;++s)i+=(r=t[s])<16?"0"+r.toString(16):r.toString(16);return i}function ti(t,e,n){for(var r=t.slice(e,n),o="",i=0;i<r.length;i+=2)o+=String.fromCharCode(r[i]+256*r[i+1]);return o}function ei(t,e,n){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>n)throw new RangeError("Trying to access beyond buffer length")}function ni(t,e,n,r,o,i){if(!xo.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>o||e<i)throw new RangeError('"value" argument is out of bounds');if(n+r>t.length)throw new RangeError("Index out of range")}function ri(t,e,n,r,o,i){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function oi(t,e,n,r,o){return e=+e,n>>>=0,o||ri(t,0,n,4),Oo.write(t,e,n,r,23,4),n+4}function ii(t,e,n,r,o){return e=+e,n>>>=0,o||ri(t,0,n,8),Oo.write(t,e,n,r,52,8),n+8}xo.prototype.slice=function(t,e){var n=this.length;(t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e<t&&(e=t);var r=this.subarray(t,e);return r.__proto__=xo.prototype,r},xo.prototype.readUIntLE=function(t,e,n){t>>>=0,e>>>=0,n||ei(t,e,this.length);for(var r=this[t],o=1,i=0;++i<e&&(o*=256);)r+=this[t+i]*o;return r},xo.prototype.readUIntBE=function(t,e,n){t>>>=0,e>>>=0,n||ei(t,e,this.length);for(var r=this[t+--e],o=1;e>0&&(o*=256);)r+=this[t+--e]*o;return r},xo.prototype.readUInt8=function(t,e){return t>>>=0,e||ei(t,1,this.length),this[t]},xo.prototype.readUInt16LE=function(t,e){return t>>>=0,e||ei(t,2,this.length),this[t]|this[t+1]<<8},xo.prototype.readUInt16BE=function(t,e){return t>>>=0,e||ei(t,2,this.length),this[t]<<8|this[t+1]},xo.prototype.readUInt32LE=function(t,e){return t>>>=0,e||ei(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},xo.prototype.readUInt32BE=function(t,e){return t>>>=0,e||ei(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},xo.prototype.readIntLE=function(t,e,n){t>>>=0,e>>>=0,n||ei(t,e,this.length);for(var r=this[t],o=1,i=0;++i<e&&(o*=256);)r+=this[t+i]*o;return r>=(o*=128)&&(r-=Math.pow(2,8*e)),r},xo.prototype.readIntBE=function(t,e,n){t>>>=0,e>>>=0,n||ei(t,e,this.length);for(var r=e,o=1,i=this[t+--r];r>0&&(o*=256);)i+=this[t+--r]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*e)),i},xo.prototype.readInt8=function(t,e){return t>>>=0,e||ei(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},xo.prototype.readInt16LE=function(t,e){t>>>=0,e||ei(t,2,this.length);var n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},xo.prototype.readInt16BE=function(t,e){t>>>=0,e||ei(t,2,this.length);var n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},xo.prototype.readInt32LE=function(t,e){return t>>>=0,e||ei(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},xo.prototype.readInt32BE=function(t,e){return t>>>=0,e||ei(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},xo.prototype.readFloatLE=function(t,e){return t>>>=0,e||ei(t,4,this.length),Oo.read(this,t,!0,23,4)},xo.prototype.readFloatBE=function(t,e){return t>>>=0,e||ei(t,4,this.length),Oo.read(this,t,!1,23,4)},xo.prototype.readDoubleLE=function(t,e){return t>>>=0,e||ei(t,8,this.length),Oo.read(this,t,!0,52,8)},xo.prototype.readDoubleBE=function(t,e){return t>>>=0,e||ei(t,8,this.length),Oo.read(this,t,!1,52,8)},xo.prototype.writeUIntLE=function(t,e,n,r){t=+t,e>>>=0,n>>>=0,r||ni(this,t,e,n,Math.pow(2,8*n)-1,0);var o=1,i=0;for(this[e]=255&t;++i<n&&(o*=256);)this[e+i]=t/o&255;return e+n},xo.prototype.writeUIntBE=function(t,e,n,r){t=+t,e>>>=0,n>>>=0,r||ni(this,t,e,n,Math.pow(2,8*n)-1,0);var o=n-1,i=1;for(this[e+o]=255&t;--o>=0&&(i*=256);)this[e+o]=t/i&255;return e+n},xo.prototype.writeUInt8=function(t,e,n){return t=+t,e>>>=0,n||ni(this,t,e,1,255,0),this[e]=255&t,e+1},xo.prototype.writeUInt16LE=function(t,e,n){return t=+t,e>>>=0,n||ni(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},xo.prototype.writeUInt16BE=function(t,e,n){return t=+t,e>>>=0,n||ni(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},xo.prototype.writeUInt32LE=function(t,e,n){return t=+t,e>>>=0,n||ni(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},xo.prototype.writeUInt32BE=function(t,e,n){return t=+t,e>>>=0,n||ni(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},xo.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e>>>=0,!r){var o=Math.pow(2,8*n-1);ni(this,t,e,n,o-1,-o)}var i=0,s=1,a=0;for(this[e]=255&t;++i<n&&(s*=256);)t<0&&0===a&&0!==this[e+i-1]&&(a=1),this[e+i]=(t/s>>0)-a&255;return e+n},xo.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e>>>=0,!r){var o=Math.pow(2,8*n-1);ni(this,t,e,n,o-1,-o)}var i=n-1,s=1,a=0;for(this[e+i]=255&t;--i>=0&&(s*=256);)t<0&&0===a&&0!==this[e+i+1]&&(a=1),this[e+i]=(t/s>>0)-a&255;return e+n},xo.prototype.writeInt8=function(t,e,n){return t=+t,e>>>=0,n||ni(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},xo.prototype.writeInt16LE=function(t,e,n){return t=+t,e>>>=0,n||ni(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},xo.prototype.writeInt16BE=function(t,e,n){return t=+t,e>>>=0,n||ni(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},xo.prototype.writeInt32LE=function(t,e,n){return t=+t,e>>>=0,n||ni(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},xo.prototype.writeInt32BE=function(t,e,n){return t=+t,e>>>=0,n||ni(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},xo.prototype.writeFloatLE=function(t,e,n){return oi(this,t,e,!0,n)},xo.prototype.writeFloatBE=function(t,e,n){return oi(this,t,e,!1,n)},xo.prototype.writeDoubleLE=function(t,e,n){return ii(this,t,e,!0,n)},xo.prototype.writeDoubleBE=function(t,e,n){return ii(this,t,e,!1,n)},xo.prototype.copy=function(t,e,n,r){if(!xo.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e<r-n&&(r=t.length-e+n);var o=r-n;if(this===t&&"function"==typeof Uint8Array.prototype.copyWithin)this.copyWithin(e,n,r);else if(this===t&&n<e&&e<r)for(var i=o-1;i>=0;--i)t[i+e]=this[i+n];else Uint8Array.prototype.set.call(t,this.subarray(n,r),e);return o},xo.prototype.fill=function(t,e,n,r){if("string"==typeof t){if("string"==typeof e?(r=e,e=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!xo.isEncoding(r))throw new TypeError("Unknown encoding: "+r);if(1===t.length){var o=t.charCodeAt(0);("utf8"===r&&o<128||"latin1"===r)&&(t=o)}}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;var i;if(e>>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(i=e;i<n;++i)this[i]=t;else{var s=xo.isBuffer(t)?t:new xo(t,r),a=s.length;if(0===a)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(i=0;i<n-e;++i)this[i+e]=s[i%a]}return this};var si=/[^+\/0-9A-Za-z-_]/g;function ai(t,e){var n;e=e||1/0;for(var r=t.length,o=null,i=[],s=0;s<r;++s){if((n=t.charCodeAt(s))>55295&&n<57344){if(!o){if(n>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(s+1===r){(e-=3)>-1&&i.push(239,191,189);continue}o=n;continue}if(n<56320){(e-=3)>-1&&i.push(239,191,189),o=n;continue}n=65536+(o-55296<<10|n-56320)}else o&&(e-=3)>-1&&i.push(239,191,189);if(o=null,n<128){if((e-=1)<0)break;i.push(n)}else if(n<2048){if((e-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;i.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function li(t){return bo.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(si,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function ui(t,e,n,r){for(var o=0;o<r&&!(o+n>=e.length||o>=t.length);++o)e[o+n]=t[o];return o}function pi(t){return t instanceof ArrayBuffer||null!=t&&null!=t.constructor&&"ArrayBuffer"===t.constructor.name&&"number"==typeof t.byteLength}function ci(t){return t!=t}var hi={}.toString,di=Array.isArray||function(t){return"[object Array]"==hi.call(t)},fi={};(function(t){var e=Object.prototype.toString,n="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===e.call(Blob),r="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===e.call(File);fi=function e(o){if(!o||"object"!=typeof o)return!1;if(di(o)){for(var i=0,s=o.length;i<s;i++)if(e(o[i]))return!0;return!1}if("function"==typeof t&&t.isBuffer&&t.isBuffer(o)||"function"==typeof ArrayBuffer&&o instanceof ArrayBuffer||n&&o instanceof Blob||r&&o instanceof File)return!0;if(o.toJSON&&"function"==typeof o.toJSON&&1===arguments.length)return e(o.toJSON(),!0);for(var a in o)if(Object.prototype.hasOwnProperty.call(o,a)&&e(o[a]))return!0;return!1}}).call(this,Uo.Buffer);var yi={encode:function(t){var e="";for(var n in t)t.hasOwnProperty(n)&&(e.length&&(e+="&"),e+=encodeURIComponent(n)+"="+encodeURIComponent(t[n]));return e},decode:function(t){for(var e={},n=t.split("&"),r=0,o=n.length;r<o;r++){var i=n[r].split("=");e[decodeURIComponent(i[0])]=decodeURIComponent(i[1])}return e}},gi=1e3,mi=6e4,vi=864e5;function bi(t,e,n){if(!(t<e))return t<1.5*e?Math.floor(t/e)+" "+n:Math.ceil(t/e)+" "+n+"s"}var wi={};function Si(t){var e;function n(){if(n.enabled){var t=n,r=+new Date,o=r-(e||r);t.diff=o,t.prev=e,t.curr=r,e=r;for(var i=new Array(arguments.length),s=0;s<i.length;s++)i[s]=arguments[s];i[0]=wi.coerce(i[0]),"string"!=typeof i[0]&&i.unshift("%O");var a=0;i[0]=i[0].replace(/%([a-zA-Z%])/g,function(e,n){if("%%"===e)return e;a++;var r=wi.formatters[n];if("function"==typeof r){var o=i[a];e=r.call(t,o),i.splice(a,1),a--}return e}),wi.formatArgs.call(t,i),(n.log||wi.log||console.log.bind(console)).apply(t,i)}}return n.namespace=t,n.enabled=wi.enabled(t),n.useColors=wi.useColors(),n.color=function(t){var e,n=0;for(e in t)n=(n<<5)-n+t.charCodeAt(e),n|=0;return wi.colors[Math.abs(n)%wi.colors.length]}(t),n.destroy=_i,"function"==typeof wi.init&&wi.init(n),wi.instances.push(n),n}function _i(){var t=wi.instances.indexOf(this);return-1!==t&&(wi.instances.splice(t,1),!0)}(wi=wi=Si.debug=Si.default=Si).coerce=function(t){return t instanceof Error?t.stack||t.message:t},wi.disable=function(){wi.enable("")},wi.enable=function(t){var e;wi.save(t),wi.names=[],wi.skips=[];var n=("string"==typeof t?t:"").split(/[\s,]+/),r=n.length;for(e=0;e<r;e++)n[e]&&("-"===(t=n[e].replace(/\*/g,".*?"))[0]?wi.skips.push(new RegExp("^"+t.substr(1)+"$")):wi.names.push(new RegExp("^"+t+"$")));for(e=0;e<wi.instances.length;e++){var o=wi.instances[e];o.enabled=wi.enabled(o.namespace)}},wi.enabled=function(t){if("*"===t[t.length-1])return!0;var e,n;for(e=0,n=wi.skips.length;e<n;e++)if(wi.skips[e].test(t))return!1;for(e=0,n=wi.names.length;e<n;e++)if(wi.names[e].test(t))return!0;return!1},wi.humanize=function(t,e){e=e||{};var n,r=typeof t;if("string"===r&&t.length>0)return function(t){if(!((t=String(t)).length>100)){var e=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(t);if(e){var n=parseFloat(e[1]);switch((e[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*n;case"days":case"day":case"d":return n*vi;case"hours":case"hour":case"hrs":case"hr":case"h":return 36e5*n;case"minutes":case"minute":case"mins":case"min":case"m":return n*mi;case"seconds":case"second":case"secs":case"sec":case"s":return n*gi;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}(t);if("number"===r&&!1===isNaN(t))return e.long?bi(n=t,vi,"day")||bi(n,36e5,"hour")||bi(n,mi,"minute")||bi(n,gi,"second")||n+" ms":function(t){return t>=vi?Math.round(t/vi)+"d":t>=36e5?Math.round(t/36e5)+"h":t>=mi?Math.round(t/mi)+"m":t>=gi?Math.round(t/gi)+"s":t+"ms"}(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))},wi.instances=[],wi.names=[],wi.skips=[],wi.formatters={};var Pi={};(function(t){function e(){var e;try{e=Pi.storage.debug}catch(t){}return!e&&void 0!==t&&"env"in t&&(e=t.env.DEBUG),e}(Pi=Pi=wi).log=function(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)},Pi.formatArgs=function(t){var e=this.useColors;if(t[0]=(e?"%c":"")+this.namespace+(e?" %c":" ")+t[0]+(e?"%c ":" ")+"+"+Pi.humanize(this.diff),e){var n="color: "+this.color;t.splice(1,0,n,"color: inherit");var r=0,o=0;t[0].replace(/%[a-zA-Z%]/g,function(t){"%%"!==t&&(r++,"%c"===t&&(o=r))}),t.splice(o,0,n)}},Pi.save=function(t){try{null==t?Pi.storage.removeItem("debug"):Pi.storage.debug=t}catch(t){}},Pi.load=e,Pi.useColors=function(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},Pi.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(t){}}(),Pi.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],Pi.formatters.j=function(t){try{return JSON.stringify(t)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}},Pi.enable(e())}).call(this,_t);var Ei={};(function(t){Ei=function(o){return e&&t.Buffer.isBuffer(o)||n&&(o instanceof t.ArrayBuffer||r(o))};var e="function"==typeof t.Buffer&&"function"==typeof t.Buffer.isBuffer,n="function"==typeof t.ArrayBuffer,r=n&&"function"==typeof t.ArrayBuffer.isView?t.ArrayBuffer.isView:function(e){return e.buffer instanceof t.ArrayBuffer}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});var ki={};(function(t){var e=Object.prototype.toString,n="function"==typeof t.Blob||"[object BlobConstructor]"===e.call(t.Blob),r="function"==typeof t.File||"[object FileConstructor]"===e.call(t.File);ki.deconstructPacket=function(t){var e=[],n=t.data,r=t;return r.data=function t(e,n){if(!e)return e;if(Ei(e)){var r={_placeholder:!0,num:n.length};return n.push(e),r}if(di(e)){for(var o=new Array(e.length),i=0;i<e.length;i++)o[i]=t(e[i],n);return o}if("object"==typeof e&&!(e instanceof Date)){o={};for(var s in e)o[s]=t(e[s],n);return o}return e}(n,e),r.attachments=e.length,{packet:r,buffers:e}},ki.reconstructPacket=function(t,e){return t.data=function t(e,n){if(!e)return e;if(e&&e._placeholder)return n[e.num];if(di(e))for(var r=0;r<e.length;r++)e[r]=t(e[r],n);else if("object"==typeof e)for(var o in e)e[o]=t(e[o],n);return e}(t.data,e),t.attachments=void 0,t},ki.removeBlobs=function(t,e){var o=0,i=t;!function t(s,a,l){if(!s)return s;if(n&&s instanceof Blob||r&&s instanceof File){o++;var u=new FileReader;u.onload=function(){l?l[a]=this.result:i=this.result,--o||e(i)},u.readAsArrayBuffer(s)}else if(di(s))for(var p=0;p<s.length;p++)t(s[p],p,s);else if("object"==typeof s&&!Ei(s))for(var c in s)t(s[c],c,s)}(i),o||e(i)}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});var Ci={},Ti=Pi("socket.io-parser");function Oi(){}Ci.protocol=4,Ci.types=["CONNECT","DISCONNECT","EVENT","ACK","ERROR","BINARY_EVENT","BINARY_ACK"],Ci.CONNECT=0,Ci.DISCONNECT=1,Ci.EVENT=2,Ci.ACK=3,Ci.ERROR=4,Ci.BINARY_EVENT=5,Ci.BINARY_ACK=6,Ci.Encoder=Oi,Ci.Decoder=Ai;var Ui=Ci.ERROR+'"encode error"';function Fi(t){var e=""+t.type;if(Ci.BINARY_EVENT!==t.type&&Ci.BINARY_ACK!==t.type||(e+=t.attachments+"-"),t.nsp&&"/"!==t.nsp&&(e+=t.nsp+","),null!=t.id&&(e+=t.id),null!=t.data){var n=function(t){try{return JSON.stringify(t)}catch(t){return!1}}(t.data);if(!1===n)return Ui;e+=n}return Ti("encoded %j as %s",t,e),e}function Ai(){this.reconstructor=null}function xi(t){this.reconPack=t,this.buffers=[]}function Di(t){return{type:Ci.ERROR,data:"parser error: "+t}}Oi.prototype.encode=function(t,e){Ti("encoding packet %j",t),Ci.BINARY_EVENT===t.type||Ci.BINARY_ACK===t.type?function(t,e){ki.removeBlobs(t,function(t){var n=ki.deconstructPacket(t),r=Fi(n.packet),o=n.buffers;o.unshift(r),e(o)})}(t,e):e([Fi(t)])},uo(Ai.prototype),Ai.prototype.add=function(t){var e;if("string"==typeof t)e=function(t){var e=0,n={type:Number(t.charAt(0))};if(null==Ci.types[n.type])return Di("unknown packet type "+n.type);if(Ci.BINARY_EVENT===n.type||Ci.BINARY_ACK===n.type){for(var r="";"-"!==t.charAt(++e)&&(r+=t.charAt(e),e!=t.length););if(r!=Number(r)||"-"!==t.charAt(e))throw new Error("Illegal attachments");n.attachments=Number(r)}if("/"===t.charAt(e+1))for(n.nsp="";++e;){if(","===(i=t.charAt(e)))break;if(n.nsp+=i,e===t.length)break}else n.nsp="/";var o=t.charAt(e+1);if(""!==o&&Number(o)==o){for(n.id="";++e;){var i;if(null==(i=t.charAt(e))||Number(i)!=i){--e;break}if(n.id+=t.charAt(e),e===t.length)break}n.id=Number(n.id)}if(t.charAt(++e)){var s=function(t){try{return JSON.parse(t)}catch(t){return!1}}(t.substr(e));if(!(!1!==s&&(n.type===Ci.ERROR||di(s))))return Di("invalid payload");n.data=s}return Ti("decoded %s as %j",t,n),n}(t),Ci.BINARY_EVENT===e.type||Ci.BINARY_ACK===e.type?(this.reconstructor=new xi(e),0===this.reconstructor.reconPack.attachments&&this.emit("decoded",e)):this.emit("decoded",e);else{if(!Ei(t)&&!t.base64)throw new Error("Unknown type: "+t);if(!this.reconstructor)throw new Error("got binary data when not reconstructing a packet");(e=this.reconstructor.takeBinaryData(t))&&(this.reconstructor=null,this.emit("decoded",e))}},Ai.prototype.destroy=function(){this.reconstructor&&this.reconstructor.finishedReconstruction()},xi.prototype.takeBinaryData=function(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){var e=ki.reconstructPacket(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null},xi.prototype.finishedReconstruction=function(){this.reconPack=null,this.buffers=[]};var Ri=function(t,e){for(var n=[],r=(e=e||0)||0;r<t.length;r++)n[r-e]=t[r];return n},Ii={},Bi=Pi("socket.io-client:socket");Ii=Ii=Mi;var ji={connect:1,connect_error:1,connect_timeout:1,connecting:1,disconnect:1,error:1,reconnect:1,reconnect_attempt:1,reconnect_failed:1,reconnect_error:1,reconnecting:1,ping:1,pong:1},Li=uo.prototype.emit;function Mi(t,e,n){this.io=t,this.nsp=e,this.json=this,this.ids=0,this.acks={},this.receiveBuffer=[],this.sendBuffer=[],this.connected=!1,this.disconnected=!0,this.flags={},n&&n.query&&(this.query=n.query),this.io.autoConnect&&this.open()}function Ni(){}uo(Mi.prototype),Mi.prototype.subEvents=function(){if(!this.subs){var t=this.io;this.subs=[vo(t,"open",yo(this,"onopen")),vo(t,"packet",yo(this,"onpacket")),vo(t,"close",yo(this,"onclose"))]}},Mi.prototype.open=Mi.prototype.connect=function(){return this.connected?this:(this.subEvents(),this.io.open(),"open"===this.io.readyState&&this.onopen(),this.emit("connecting"),this)},Mi.prototype.send=function(){var t=Ri(arguments);return t.unshift("message"),this.emit.apply(this,t),this},Mi.prototype.emit=function(t){if(ji.hasOwnProperty(t))return Li.apply(this,arguments),this;var e=Ri(arguments),n={type:(void 0!==this.flags.binary?this.flags.binary:fi(e))?Ci.BINARY_EVENT:Ci.EVENT,data:e,options:{}};return n.options.compress=!this.flags||!1!==this.flags.compress,"function"==typeof e[e.length-1]&&(Bi("emitting packet with ack id %d",this.ids),this.acks[this.ids]=e.pop(),n.id=this.ids++),this.connected?this.packet(n):this.sendBuffer.push(n),this.flags={},this},Mi.prototype.packet=function(t){t.nsp=this.nsp,this.io.packet(t)},Mi.prototype.onopen=function(){if(Bi("transport is open - connecting"),"/"!==this.nsp)if(this.query){var t="object"==typeof this.query?yi.encode(this.query):this.query;Bi("sending connect packet with query %s",t),this.packet({type:Ci.CONNECT,query:t})}else this.packet({type:Ci.CONNECT})},Mi.prototype.onclose=function(t){Bi("close (%s)",t),this.connected=!1,this.disconnected=!0,delete this.id,this.emit("disconnect",t)},Mi.prototype.onpacket=function(t){var e=t.nsp===this.nsp,n=t.type===Ci.ERROR&&"/"===t.nsp;if(e||n)switch(t.type){case Ci.CONNECT:this.onconnect();break;case Ci.EVENT:case Ci.BINARY_EVENT:this.onevent(t);break;case Ci.ACK:case Ci.BINARY_ACK:this.onack(t);break;case Ci.DISCONNECT:this.ondisconnect();break;case Ci.ERROR:this.emit("error",t.data)}},Mi.prototype.onevent=function(t){var e=t.data||[];Bi("emitting event %j",e),null!=t.id&&(Bi("attaching ack callback to event"),e.push(this.ack(t.id))),this.connected?Li.apply(this,e):this.receiveBuffer.push(e)},Mi.prototype.ack=function(t){var e=this,n=!1;return function(){if(!n){n=!0;var r=Ri(arguments);Bi("sending ack %j",r),e.packet({type:fi(r)?Ci.BINARY_ACK:Ci.ACK,id:t,data:r})}}},Mi.prototype.onack=function(t){var e=this.acks[t.id];"function"==typeof e?(Bi("calling ack %s with %j",t.id,t.data),e.apply(this,t.data),delete this.acks[t.id]):Bi("bad ack %s",t.id)},Mi.prototype.onconnect=function(){this.connected=!0,this.disconnected=!1,this.emit("connect"),this.emitBuffered()},Mi.prototype.emitBuffered=function(){var t;for(t=0;t<this.receiveBuffer.length;t++)Li.apply(this,this.receiveBuffer[t]);for(this.receiveBuffer=[],t=0;t<this.sendBuffer.length;t++)this.packet(this.sendBuffer[t]);this.sendBuffer=[]},Mi.prototype.ondisconnect=function(){Bi("server disconnect (%s)",this.nsp),this.destroy(),this.onclose("io server disconnect")},Mi.prototype.destroy=function(){if(this.subs){for(var t=0;t<this.subs.length;t++)this.subs[t].destroy();this.subs=null}this.io.destroy(this)},Mi.prototype.close=Mi.prototype.disconnect=function(){return this.connected&&(Bi("performing disconnect (%s)",this.nsp),this.packet({type:Ci.DISCONNECT})),this.destroy(),this.connected&&this.onclose("io client disconnect"),this},Mi.prototype.compress=function(t){return this.flags.compress=t,this},Mi.prototype.binary=function(t){return this.flags.binary=t,this};var zi=function(t,e,n){var r=!1;return n=n||Ni,o.count=t,0===t?e():o;function o(t,i){if(o.count<=0)throw new Error("after called too many times");--o.count,t?(r=!0,e(t),e=n):0!==o.count||r||e(null,i)}},qi=function(t,e,n){var r=t.byteLength;if(e=e||0,n=n||r,t.slice)return t.slice(e,n);if(e<0&&(e+=r),n<0&&(n+=r),n>r&&(n=r),e>=r||e>=n||0===r)return new ArrayBuffer(0);for(var o=new Uint8Array(t),i=new Uint8Array(n-e),s=e,a=0;s<n;s++,a++)i[a]=o[s];return i.buffer},Hi={};!function(){"use strict";for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e=new Uint8Array(256),n=0;n<t.length;n++)e[t.charCodeAt(n)]=n;Hi.encode=function(e){var n,r=new Uint8Array(e),o=r.length,i="";for(n=0;n<o;n+=3)i+=t[r[n]>>2],i+=t[(3&r[n])<<4|r[n+1]>>4],i+=t[(15&r[n+1])<<2|r[n+2]>>6],i+=t[63&r[n+2]];return o%3==2?i=i.substring(0,i.length-1)+"=":o%3==1&&(i=i.substring(0,i.length-2)+"=="),i},Hi.decode=function(t){var n,r,o,i,s,a=.75*t.length,l=t.length,u=0;"="===t[t.length-1]&&(a--,"="===t[t.length-2]&&a--);var p=new ArrayBuffer(a),c=new Uint8Array(p);for(n=0;n<l;n+=4)r=e[t.charCodeAt(n)],o=e[t.charCodeAt(n+1)],i=e[t.charCodeAt(n+2)],s=e[t.charCodeAt(n+3)],c[u++]=r<<2|o>>4,c[u++]=(15&o)<<4|i>>2,c[u++]=(3&i)<<6|63&s;return p}}();var Wi={};(function(t){var e=t.BlobBuilder||t.WebKitBlobBuilder||t.MSBlobBuilder||t.MozBlobBuilder,n=function(){try{return 2===new Blob(["hi"]).size}catch(t){return!1}}(),r=n&&function(){try{return 2===new Blob([new Uint8Array([1,2])]).size}catch(t){return!1}}(),o=e&&e.prototype.append&&e.prototype.getBlob;function i(t){for(var e=0;e<t.length;e++){var n=t[e];if(n.buffer instanceof ArrayBuffer){var r=n.buffer;if(n.byteLength!==r.byteLength){var o=new Uint8Array(n.byteLength);o.set(new Uint8Array(r,n.byteOffset,n.byteLength)),r=o.buffer}t[e]=r}}}Wi=n?r?t.Blob:function(t,e){return i(t),new Blob(t,e||{})}:o?function(t,n){n=n||{};var r=new e;i(t);for(var o=0;o<t.length;o++)r.append(t[o]);return n.type?r.getBlob(n.type):r.getBlob()}:void 0}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});var Xi=Object.keys||function(t){var e=[],n=Object.prototype.hasOwnProperty;for(var r in t)n.call(t,r)&&e.push(r);return e},Vi={exports:{}};(function(t){!function(e){var n="object"==typeof Vi.exports&&Vi.exports,r=Vi&&Vi.exports==n&&Vi,o="object"==typeof t&&t;o.global!==o&&o.window!==o||(e=o);var i,s,a,l=String.fromCharCode;function u(t){for(var e,n,r=[],o=0,i=t.length;o<i;)(e=t.charCodeAt(o++))>=55296&&e<=56319&&o<i?56320==(64512&(n=t.charCodeAt(o++)))?r.push(((1023&e)<<10)+(1023&n)+65536):(r.push(e),o--):r.push(e);return r}function p(t,e){if(t>=55296&&t<=57343){if(e)throw Error("Lone surrogate U+"+t.toString(16).toUpperCase()+" is not a scalar value");return!1}return!0}function c(t,e){return l(t>>e&63|128)}function h(t,e){if(0==(4294967168&t))return l(t);var n="";return 0==(4294965248&t)?n=l(t>>6&31|192):0==(4294901760&t)?(p(t,e)||(t=65533),n=l(t>>12&15|224),n+=c(t,6)):0==(4292870144&t)&&(n=l(t>>18&7|240),n+=c(t,12),n+=c(t,6)),n+l(63&t|128)}function d(){if(a>=s)throw Error("Invalid byte index");var t=255&i[a];if(a++,128==(192&t))return 63&t;throw Error("Invalid continuation byte")}function f(t){var e,n;if(a>s)throw Error("Invalid byte index");if(a==s)return!1;if(e=255&i[a],a++,0==(128&e))return e;if(192==(224&e)){if((n=(31&e)<<6|d())>=128)return n;throw Error("Invalid continuation byte")}if(224==(240&e)){if((n=(15&e)<<12|d()<<6|d())>=2048)return p(n,t)?n:65533;throw Error("Invalid continuation byte")}if(240==(248&e)&&(n=(7&e)<<18|d()<<12|d()<<6|d())>=65536&&n<=1114111)return n;throw Error("Invalid UTF-8 detected")}var y={version:"2.1.2",encode:function(t,e){for(var n=!1!==(e=e||{}).strict,r=u(t),o=r.length,i=-1,s="";++i<o;)s+=h(r[i],n);return s},decode:function(t,e){var n=!1!==(e=e||{}).strict;i=u(t),s=i.length,a=0;for(var r,o=[];!1!==(r=f(n));)o.push(r);return function(t){for(var e,n=t.length,r=-1,o="";++r<n;)(e=t[r])>65535&&(o+=l((e-=65536)>>>10&1023|55296),e=56320|1023&e),o+=l(e);return o}(o)}};if(n&&!n.nodeType)if(r)r.exports=y;else{var g={}.hasOwnProperty;for(var m in y)g.call(y,m)&&(n[m]=y[m])}else e.utf8=y}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{}),Vi=Vi.exports;var Gi={};(function(t){var e;t&&t.ArrayBuffer&&(e=Hi);var n="undefined"!=typeof navigator&&/Android/i.test(navigator.userAgent),r="undefined"!=typeof navigator&&/PhantomJS/i.test(navigator.userAgent),o=n||r;Gi.protocol=3;var i=Gi.packets={open:0,close:1,ping:2,pong:3,message:4,upgrade:5,noop:6},s=Xi(i),a={type:"error",data:"parser error"};function l(t,e,n){for(var r=new Array(t.length),o=zi(t.length,n),i=function(t,n,o){e(n,function(e,n){r[t]=n,o(e,r)})},s=0;s<t.length;s++)i(s,t[s],o)}Gi.encodePacket=function(e,n,r,s){"function"==typeof n&&(s=n,n=!1),"function"==typeof r&&(s=r,r=null);var a=void 0===e.data?void 0:e.data.buffer||e.data;if(t.ArrayBuffer&&a instanceof ArrayBuffer)return function(t,e,n){if(!e)return Gi.encodeBase64Packet(t,n);var r=t.data,o=new Uint8Array(r),s=new Uint8Array(1+r.byteLength);s[0]=i[t.type];for(var a=0;a<o.length;a++)s[a+1]=o[a];return n(s.buffer)}(e,n,s);if(Wi&&a instanceof t.Blob)return function(t,e,n){if(!e)return Gi.encodeBase64Packet(t,n);if(o)return function(t,e,n){if(!e)return Gi.encodeBase64Packet(t,n);var r=new FileReader;return r.onload=function(){t.data=r.result,Gi.encodePacket(t,e,!0,n)},r.readAsArrayBuffer(t.data)}(t,e,n);var r=new Uint8Array(1);return r[0]=i[t.type],n(new Wi([r.buffer,t.data]))}(e,n,s);if(a&&a.base64)return function(t,e){return e("b"+Gi.packets[t.type]+t.data.data)}(e,s);var l=i[e.type];return void 0!==e.data&&(l+=r?Vi.encode(String(e.data),{strict:!1}):String(e.data)),s(""+l)},Gi.encodeBase64Packet=function(e,n){var r,o="b"+Gi.packets[e.type];if(Wi&&e.data instanceof t.Blob){var i=new FileReader;return i.onload=function(){var t=i.result.split(",")[1];n(o+t)},i.readAsDataURL(e.data)}try{r=String.fromCharCode.apply(null,new Uint8Array(e.data))}catch(t){for(var s=new Uint8Array(e.data),a=new Array(s.length),l=0;l<s.length;l++)a[l]=s[l];r=String.fromCharCode.apply(null,a)}return o+=t.btoa(r),n(o)},Gi.decodePacket=function(t,e,n){if(void 0===t)return a;if("string"==typeof t){if("b"===t.charAt(0))return Gi.decodeBase64Packet(t.substr(1),e);if(n&&!1===(t=function(t){try{t=Vi.decode(t,{strict:!1})}catch(t){return!1}return t}(t)))return a;var r=t.charAt(0);return Number(r)==r&&s[r]?t.length>1?{type:s[r],data:t.substring(1)}:{type:s[r]}:a}r=new Uint8Array(t)[0];var o=qi(t,1);return Wi&&"blob"===e&&(o=new Wi([o])),{type:s[r],data:o}},Gi.decodeBase64Packet=function(t,n){var r=s[t.charAt(0)];if(!e)return{type:r,data:{base64:!0,data:t.substr(1)}};var o=e.decode(t.substr(1));return"blob"===n&&Wi&&(o=new Wi([o])),{type:r,data:o}},Gi.encodePayload=function(t,e,n){"function"==typeof e&&(n=e,e=null);var r=fi(t);return e&&r?Wi&&!o?Gi.encodePayloadAsBlob(t,n):Gi.encodePayloadAsArrayBuffer(t,n):t.length?void l(t,function(t,n){Gi.encodePacket(t,!!r&&e,!1,function(t){n(null,function(t){return t.length+":"+t}(t))})},function(t,e){return n(e.join(""))}):n("0:")},Gi.decodePayload=function(t,e,n){if("string"!=typeof t)return Gi.decodePayloadAsBinary(t,e,n);var r;if("function"==typeof e&&(n=e,e=null),""===t)return n(a,0,1);for(var o,i,s="",l=0,u=t.length;l<u;l++){var p=t.charAt(l);if(":"===p){if(""===s||s!=(o=Number(s)))return n(a,0,1);if(s!=(i=t.substr(l+1,o)).length)return n(a,0,1);if(i.length){if(r=Gi.decodePacket(i,e,!1),a.type===r.type&&a.data===r.data)return n(a,0,1);if(!1===n(r,l+o,u))return}l+=o,s=""}else s+=p}return""!==s?n(a,0,1):void 0},Gi.encodePayloadAsArrayBuffer=function(t,e){if(!t.length)return e(new ArrayBuffer(0));l(t,function(t,e){Gi.encodePacket(t,!0,!0,function(t){return e(null,t)})},function(t,n){var r=n.reduce(function(t,e){var n;return t+(n="string"==typeof e?e.length:e.byteLength).toString().length+n+2},0),o=new Uint8Array(r),i=0;return n.forEach(function(t){var e="string"==typeof t,n=t;if(e){for(var r=new Uint8Array(t.length),s=0;s<t.length;s++)r[s]=t.charCodeAt(s);n=r.buffer}o[i++]=e?0:1;var a=n.byteLength.toString();for(s=0;s<a.length;s++)o[i++]=parseInt(a[s]);for(o[i++]=255,r=new Uint8Array(n),s=0;s<r.length;s++)o[i++]=r[s]}),e(o.buffer)})},Gi.encodePayloadAsBlob=function(t,e){l(t,function(t,e){Gi.encodePacket(t,!0,!0,function(t){var n=new Uint8Array(1);if(n[0]=1,"string"==typeof t){for(var r=new Uint8Array(t.length),o=0;o<t.length;o++)r[o]=t.charCodeAt(o);t=r.buffer,n[0]=0}var i=(t instanceof ArrayBuffer?t.byteLength:t.size).toString(),s=new Uint8Array(i.length+1);for(o=0;o<i.length;o++)s[o]=parseInt(i[o]);if(s[i.length]=255,Wi){var a=new Wi([n.buffer,s.buffer,t]);e(null,a)}})},function(t,n){return e(new Wi(n))})},Gi.decodePayloadAsBinary=function(t,e,n){"function"==typeof e&&(n=e,e=null);for(var r=t,o=[];r.byteLength>0;){for(var i=new Uint8Array(r),s=0===i[0],l="",u=1;255!==i[u];u++){if(l.length>310)return n(a,0,1);l+=i[u]}r=qi(r,2+l.length),l=parseInt(l);var p=qi(r,0,l);if(s)try{p=String.fromCharCode.apply(null,new Uint8Array(p))}catch(t){var c=new Uint8Array(p);for(p="",u=0;u<c.length;u++)p+=String.fromCharCode(c[u])}o.push(p),r=qi(r,l)}var h=o.length;o.forEach(function(t,r){n(Gi.decodePacket(t,e,!0),r,h)})}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});var Ki=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,Yi=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],Ji=function(t){var e=t,n=t.indexOf("["),r=t.indexOf("]");-1!=n&&-1!=r&&(t=t.substring(0,n)+t.substring(n,r).replace(/:/g,";")+t.substring(r,t.length));for(var o=Ki.exec(t||""),i={},s=14;s--;)i[Yi[s]]=o[s]||"";return-1!=n&&-1!=r&&(i.source=e,i.host=i.host.substring(1,i.host.length-1).replace(/;/g,":"),i.authority=i.authority.replace("[","").replace("]","").replace(/;/g,":"),i.ipv6uri=!0),i},$i={};function Qi(t){this.path=t.path,this.hostname=t.hostname,this.port=t.port,this.secure=t.secure,this.query=t.query,this.timestampParam=t.timestampParam,this.timestampRequests=t.timestampRequests,this.readyState="",this.agent=t.agent||!1,this.socket=t.socket,this.enablesXDR=t.enablesXDR,this.pfx=t.pfx,this.key=t.key,this.passphrase=t.passphrase,this.cert=t.cert,this.ca=t.ca,this.ciphers=t.ciphers,this.rejectUnauthorized=t.rejectUnauthorized,this.forceNode=t.forceNode,this.extraHeaders=t.extraHeaders,this.localAddress=t.localAddress}$i=Qi,uo(Qi.prototype),Qi.prototype.onError=function(t,e){var n=new Error(t);return n.type="TransportError",n.description=e,this.emit("error",n),this},Qi.prototype.open=function(){return"closed"!==this.readyState&&""!==this.readyState||(this.readyState="opening",this.doOpen()),this},Qi.prototype.close=function(){return"opening"!==this.readyState&&"open"!==this.readyState||(this.doClose(),this.onClose()),this},Qi.prototype.send=function(t){if("open"!==this.readyState)throw new Error("Transport not open");this.write(t)},Qi.prototype.onOpen=function(){this.readyState="open",this.writable=!0,this.emit("open")},Qi.prototype.onData=function(t){var e=Gi.decodePacket(t,this.socket.binaryType);this.onPacket(e)},Qi.prototype.onPacket=function(t){this.emit("packet",t)},Qi.prototype.onClose=function(){this.readyState="closed",this.emit("close")};var Zi=function(t,e){var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t},ts={};try{ts="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(t){ts=!1}var es={};(function(t){es=function(e){var n=e.xdomain,r=e.xscheme,o=e.enablesXDR;try{if("undefined"!=typeof XMLHttpRequest&&(!n||ts))return new XMLHttpRequest}catch(t){}try{if("undefined"!=typeof XDomainRequest&&!r&&o)return new XDomainRequest}catch(t){}if(!n)try{return new(t[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(t){}}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});var ns,rs={},os="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),is=64,ss={},as=0,ls=0;function us(t){var e="";do{e=os[t%is]+e,t=Math.floor(t/is)}while(t>0);return e}function ps(){var t=us(+new Date);return t!==ns?(as=0,ns=t):t+"."+us(as++)}for(;ls<is;ls++)ss[os[ls]]=ls;ps.encode=us,ps.decode=function(t){var e=0;for(ls=0;ls<t.length;ls++)e=e*is+ss[t.charAt(ls)];return e},rs=ps;var cs=Pi("engine.io-client:polling"),hs=fs,ds=null!=new es({xdomain:!1}).responseType;function fs(t){var e=t&&t.forceBase64;ds&&!e||(this.supportsBinary=!1),$i.call(this,t)}Zi(fs,$i),fs.prototype.name="polling",fs.prototype.doOpen=function(){this.poll()},fs.prototype.pause=function(t){var e=this;function n(){cs("paused"),e.readyState="paused",t()}if(this.readyState="pausing",this.polling||!this.writable){var r=0;this.polling&&(cs("we are currently polling - waiting to pause"),r++,this.once("pollComplete",function(){cs("pre-pause polling complete"),--r||n()})),this.writable||(cs("we are currently writing - waiting to pause"),r++,this.once("drain",function(){cs("pre-pause writing complete"),--r||n()}))}else n()},fs.prototype.poll=function(){cs("polling"),this.polling=!0,this.doPoll(),this.emit("poll")},fs.prototype.onData=function(t){var e=this;cs("polling got data %s",t),Gi.decodePayload(t,this.socket.binaryType,function(t,n,r){if("opening"===e.readyState&&e.onOpen(),"close"===t.type)return e.onClose(),!1;e.onPacket(t)}),"closed"!==this.readyState&&(this.polling=!1,this.emit("pollComplete"),"open"===this.readyState?this.poll():cs('ignoring poll - transport state "%s"',this.readyState))},fs.prototype.doClose=function(){var t=this;function e(){cs("writing close packet"),t.write([{type:"close"}])}"open"===this.readyState?(cs("transport open - closing"),e()):(cs("transport not open - deferring close"),this.once("open",e))},fs.prototype.write=function(t){var e=this;this.writable=!1;var n=function(){e.writable=!0,e.emit("drain")};Gi.encodePayload(t,this.supportsBinary,function(t){e.doWrite(t,n)})},fs.prototype.uri=function(){var t=this.query||{},e=this.secure?"https":"http",n="";return!1!==this.timestampRequests&&(t[this.timestampParam]=rs()),this.supportsBinary||t.sid||(t.b64=1),t=yi.encode(t),this.port&&("https"===e&&443!==Number(this.port)||"http"===e&&80!==Number(this.port))&&(n=":"+this.port),t.length&&(t="?"+t),e+"://"+(-1!==this.hostname.indexOf(":")?"["+this.hostname+"]":this.hostname)+n+this.path+t};var ys={};(function(t){ys=i;var e,n=/\n/g,r=/\\n/g;function o(){}function i(n){hs.call(this,n),this.query=this.query||{},e||(t.___eio||(t.___eio=[]),e=t.___eio),this.index=e.length;var r=this;e.push(function(t){r.onData(t)}),this.query.j=this.index,t.document&&t.addEventListener&&t.addEventListener("beforeunload",function(){r.script&&(r.script.onerror=o)},!1)}Zi(i,hs),i.prototype.supportsBinary=!1,i.prototype.doClose=function(){this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),this.form&&(this.form.parentNode.removeChild(this.form),this.form=null,this.iframe=null),hs.prototype.doClose.call(this)},i.prototype.doPoll=function(){var t=this,e=document.createElement("script");this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),e.async=!0,e.src=this.uri(),e.onerror=function(e){t.onError("jsonp poll error",e)};var n=document.getElementsByTagName("script")[0];n?n.parentNode.insertBefore(e,n):(document.head||document.body).appendChild(e),this.script=e,"undefined"!=typeof navigator&&/gecko/i.test(navigator.userAgent)&&setTimeout(function(){var t=document.createElement("iframe");document.body.appendChild(t),document.body.removeChild(t)},100)},i.prototype.doWrite=function(t,e){var o=this;if(!this.form){var i,s=document.createElement("form"),a=document.createElement("textarea"),l=this.iframeId="eio_iframe_"+this.index;s.className="socketio",s.style.position="absolute",s.style.top="-1000px",s.style.left="-1000px",s.target=l,s.method="POST",s.setAttribute("accept-charset","utf-8"),a.name="d",s.appendChild(a),document.body.appendChild(s),this.form=s,this.area=a}function u(){p(),e()}function p(){if(o.iframe)try{o.form.removeChild(o.iframe)}catch(t){o.onError("jsonp polling iframe removal error",t)}try{var t='<iframe src="javascript:0" name="'+o.iframeId+'">';i=document.createElement(t)}catch(t){(i=document.createElement("iframe")).name=o.iframeId,i.src="javascript:0"}i.id=o.iframeId,o.form.appendChild(i),o.iframe=i}this.form.action=this.uri(),p(),t=t.replace(r,"\\\n"),this.area.value=t.replace(n,"\\n");try{this.form.submit()}catch(t){}this.iframe.attachEvent?this.iframe.onreadystatechange=function(){"complete"===o.iframe.readyState&&u()}:this.iframe.onload=u}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});var gs={};(function(t){var e=Pi("engine.io-client:polling-xhr");function n(){}function r(e){if(hs.call(this,e),this.requestTimeout=e.requestTimeout,this.extraHeaders=e.extraHeaders,t.location){var n="https:"===location.protocol,r=location.port;r||(r=n?443:80),this.xd=e.hostname!==t.location.hostname||r!==e.port,this.xs=e.secure!==n}}function o(t){this.method=t.method||"GET",this.uri=t.uri,this.xd=!!t.xd,this.xs=!!t.xs,this.async=!1!==t.async,this.data=void 0!==t.data?t.data:null,this.agent=t.agent,this.isBinary=t.isBinary,this.supportsBinary=t.supportsBinary,this.enablesXDR=t.enablesXDR,this.requestTimeout=t.requestTimeout,this.pfx=t.pfx,this.key=t.key,this.passphrase=t.passphrase,this.cert=t.cert,this.ca=t.ca,this.ciphers=t.ciphers,this.rejectUnauthorized=t.rejectUnauthorized,this.extraHeaders=t.extraHeaders,this.create()}function i(){for(var t in o.requests)o.requests.hasOwnProperty(t)&&o.requests[t].abort()}(gs=r).Request=o,Zi(r,hs),r.prototype.supportsBinary=!0,r.prototype.request=function(t){return(t=t||{}).uri=this.uri(),t.xd=this.xd,t.xs=this.xs,t.agent=this.agent||!1,t.supportsBinary=this.supportsBinary,t.enablesXDR=this.enablesXDR,t.pfx=this.pfx,t.key=this.key,t.passphrase=this.passphrase,t.cert=this.cert,t.ca=this.ca,t.ciphers=this.ciphers,t.rejectUnauthorized=this.rejectUnauthorized,t.requestTimeout=this.requestTimeout,t.extraHeaders=this.extraHeaders,new o(t)},r.prototype.doWrite=function(t,e){var n="string"!=typeof t&&void 0!==t,r=this.request({method:"POST",data:t,isBinary:n}),o=this;r.on("success",e),r.on("error",function(t){o.onError("xhr post error",t)}),this.sendXhr=r},r.prototype.doPoll=function(){e("xhr poll");var t=this.request(),n=this;t.on("data",function(t){n.onData(t)}),t.on("error",function(t){n.onError("xhr poll error",t)}),this.pollXhr=t},uo(o.prototype),o.prototype.create=function(){var n={agent:this.agent,xdomain:this.xd,xscheme:this.xs,enablesXDR:this.enablesXDR};n.pfx=this.pfx,n.key=this.key,n.passphrase=this.passphrase,n.cert=this.cert,n.ca=this.ca,n.ciphers=this.ciphers,n.rejectUnauthorized=this.rejectUnauthorized;var r=this.xhr=new es(n),i=this;try{e("xhr open %s: %s",this.method,this.uri),r.open(this.method,this.uri,this.async);try{if(this.extraHeaders)for(var s in r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0),this.extraHeaders)this.extraHeaders.hasOwnProperty(s)&&r.setRequestHeader(s,this.extraHeaders[s])}catch(t){}if("POST"===this.method)try{this.isBinary?r.setRequestHeader("Content-type","application/octet-stream"):r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(t){}try{r.setRequestHeader("Accept","*/*")}catch(t){}"withCredentials"in r&&(r.withCredentials=!0),this.requestTimeout&&(r.timeout=this.requestTimeout),this.hasXDR()?(r.onload=function(){i.onLoad()},r.onerror=function(){i.onError(r.responseText)}):r.onreadystatechange=function(){if(2===r.readyState)try{var t=r.getResponseHeader("Content-Type");i.supportsBinary&&"application/octet-stream"===t&&(r.responseType="arraybuffer")}catch(t){}4===r.readyState&&(200===r.status||1223===r.status?i.onLoad():setTimeout(function(){i.onError(r.status)},0))},e("xhr data %s",this.data),r.send(this.data)}catch(t){return void setTimeout(function(){i.onError(t)},0)}t.document&&(this.index=o.requestsCount++,o.requests[this.index]=this)},o.prototype.onSuccess=function(){this.emit("success"),this.cleanup()},o.prototype.onData=function(t){this.emit("data",t),this.onSuccess()},o.prototype.onError=function(t){this.emit("error",t),this.cleanup(!0)},o.prototype.cleanup=function(e){if(void 0!==this.xhr&&null!==this.xhr){if(this.hasXDR()?this.xhr.onload=this.xhr.onerror=n:this.xhr.onreadystatechange=n,e)try{this.xhr.abort()}catch(t){}t.document&&delete o.requests[this.index],this.xhr=null}},o.prototype.onLoad=function(){var t;try{var e;try{e=this.xhr.getResponseHeader("Content-Type")}catch(t){}t="application/octet-stream"===e&&this.xhr.response||this.xhr.responseText}catch(t){this.onError(t)}null!=t&&this.onData(t)},o.prototype.hasXDR=function(){return void 0!==t.XDomainRequest&&!this.xs&&this.enablesXDR},o.prototype.abort=function(){this.cleanup()},o.requestsCount=0,o.requests={},t.document&&(t.attachEvent?t.attachEvent("onunload",i):t.addEventListener&&t.addEventListener("beforeunload",i,!1))}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});var ms={},vs={};(function(t){var e,n=Pi("engine.io-client:websocket"),r=t.WebSocket||t.MozWebSocket;if("undefined"==typeof window)try{e=ms}catch(t){}var o=r;function i(t){t&&t.forceBase64&&(this.supportsBinary=!1),this.perMessageDeflate=t.perMessageDeflate,this.usingBrowserWebSocket=r&&!t.forceNode,this.protocols=t.protocols,this.usingBrowserWebSocket||(o=e),$i.call(this,t)}o||"undefined"!=typeof window||(o=e),vs=i,Zi(i,$i),i.prototype.name="websocket",i.prototype.supportsBinary=!0,i.prototype.doOpen=function(){if(this.check()){var t=this.uri(),e=this.protocols,n={agent:this.agent,perMessageDeflate:this.perMessageDeflate};n.pfx=this.pfx,n.key=this.key,n.passphrase=this.passphrase,n.cert=this.cert,n.ca=this.ca,n.ciphers=this.ciphers,n.rejectUnauthorized=this.rejectUnauthorized,this.extraHeaders&&(n.headers=this.extraHeaders),this.localAddress&&(n.localAddress=this.localAddress);try{this.ws=this.usingBrowserWebSocket?e?new o(t,e):new o(t):new o(t,e,n)}catch(t){return this.emit("error",t)}void 0===this.ws.binaryType&&(this.supportsBinary=!1),this.ws.supports&&this.ws.supports.binary?(this.supportsBinary=!0,this.ws.binaryType="nodebuffer"):this.ws.binaryType="arraybuffer",this.addEventListeners()}},i.prototype.addEventListeners=function(){var t=this;this.ws.onopen=function(){t.onOpen()},this.ws.onclose=function(){t.onClose()},this.ws.onmessage=function(e){t.onData(e.data)},this.ws.onerror=function(e){t.onError("websocket error",e)}},i.prototype.write=function(e){var r=this;this.writable=!1;for(var o=e.length,i=0,s=o;i<s;i++)!function(e){Gi.encodePacket(e,r.supportsBinary,function(i){if(!r.usingBrowserWebSocket){var s={};e.options&&(s.compress=e.options.compress),r.perMessageDeflate&&("string"==typeof i?t.Buffer.byteLength(i):i.length)<r.perMessageDeflate.threshold&&(s.compress=!1)}try{r.usingBrowserWebSocket?r.ws.send(i):r.ws.send(i,s)}catch(t){n("websocket closed before onclose event")}--o||(r.emit("flush"),setTimeout(function(){r.writable=!0,r.emit("drain")},0))})}(e[i])},i.prototype.onClose=function(){$i.prototype.onClose.call(this)},i.prototype.doClose=function(){void 0!==this.ws&&this.ws.close()},i.prototype.uri=function(){var t=this.query||{},e=this.secure?"wss":"ws",n="";return this.port&&("wss"===e&&443!==Number(this.port)||"ws"===e&&80!==Number(this.port))&&(n=":"+this.port),this.timestampRequests&&(t[this.timestampParam]=rs()),this.supportsBinary||(t.b64=1),(t=yi.encode(t)).length&&(t="?"+t),e+"://"+(-1!==this.hostname.indexOf(":")?"["+this.hostname+"]":this.hostname)+n+this.path+t},i.prototype.check=function(){return!(!o||"__initialize"in o&&this.name===i.prototype.name)}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});var bs={};(function(t){bs.polling=function(e){var n=!1,r=!1,o=!1!==e.jsonp;if(t.location){var i="https:"===location.protocol,s=location.port;s||(s=i?443:80),n=e.hostname!==location.hostname||s!==e.port,r=e.secure!==i}if(e.xdomain=n,e.xscheme=r,"open"in new es(e)&&!e.forceJSONP)return new gs(e);if(!o)throw new Error("JSONP disabled");return new ys(e)},bs.websocket=vs}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});var ws={};(function(t){var e=Pi("engine.io-client:socket");function n(e,r){if(!(this instanceof n))return new n(e,r);r=r||{},e&&"object"==typeof e&&(r=e,e=null),e?(e=Ji(e),r.hostname=e.host,r.secure="https"===e.protocol||"wss"===e.protocol,r.port=e.port,e.query&&(r.query=e.query)):r.host&&(r.hostname=Ji(r.host).host),this.secure=null!=r.secure?r.secure:t.location&&"https:"===location.protocol,r.hostname&&!r.port&&(r.port=this.secure?"443":"80"),this.agent=r.agent||!1,this.hostname=r.hostname||(t.location?location.hostname:"localhost"),this.port=r.port||(t.location&&location.port?location.port:this.secure?443:80),this.query=r.query||{},"string"==typeof this.query&&(this.query=yi.decode(this.query)),this.upgrade=!1!==r.upgrade,this.path=(r.path||"/engine.io").replace(/\/$/,"")+"/",this.forceJSONP=!!r.forceJSONP,this.jsonp=!1!==r.jsonp,this.forceBase64=!!r.forceBase64,this.enablesXDR=!!r.enablesXDR,this.timestampParam=r.timestampParam||"t",this.timestampRequests=r.timestampRequests,this.transports=r.transports||["polling","websocket"],this.transportOptions=r.transportOptions||{},this.readyState="",this.writeBuffer=[],this.prevBufferLen=0,this.policyPort=r.policyPort||843,this.rememberUpgrade=r.rememberUpgrade||!1,this.binaryType=null,this.onlyBinaryUpgrades=r.onlyBinaryUpgrades,this.perMessageDeflate=!1!==r.perMessageDeflate&&(r.perMessageDeflate||{}),!0===this.perMessageDeflate&&(this.perMessageDeflate={}),this.perMessageDeflate&&null==this.perMessageDeflate.threshold&&(this.perMessageDeflate.threshold=1024),this.pfx=r.pfx||null,this.key=r.key||null,this.passphrase=r.passphrase||null,this.cert=r.cert||null,this.ca=r.ca||null,this.ciphers=r.ciphers||null,this.rejectUnauthorized=void 0===r.rejectUnauthorized||r.rejectUnauthorized,this.forceNode=!!r.forceNode;var o="object"==typeof t&&t;o.global===o&&(r.extraHeaders&&Object.keys(r.extraHeaders).length>0&&(this.extraHeaders=r.extraHeaders),r.localAddress&&(this.localAddress=r.localAddress)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingIntervalTimer=null,this.pingTimeoutTimer=null,this.open()}ws=n,n.priorWebsocketSuccess=!1,uo(n.prototype),n.protocol=Gi.protocol,n.Socket=n,n.Transport=$i,n.transports=bs,n.parser=Gi,n.prototype.createTransport=function(t){e('creating transport "%s"',t);var n=function(t){var e={};for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e}(this.query);n.EIO=Gi.protocol,n.transport=t;var r=this.transportOptions[t]||{};return this.id&&(n.sid=this.id),new bs[t]({query:n,socket:this,agent:r.agent||this.agent,hostname:r.hostname||this.hostname,port:r.port||this.port,secure:r.secure||this.secure,path:r.path||this.path,forceJSONP:r.forceJSONP||this.forceJSONP,jsonp:r.jsonp||this.jsonp,forceBase64:r.forceBase64||this.forceBase64,enablesXDR:r.enablesXDR||this.enablesXDR,timestampRequests:r.timestampRequests||this.timestampRequests,timestampParam:r.timestampParam||this.timestampParam,policyPort:r.policyPort||this.policyPort,pfx:r.pfx||this.pfx,key:r.key||this.key,passphrase:r.passphrase||this.passphrase,cert:r.cert||this.cert,ca:r.ca||this.ca,ciphers:r.ciphers||this.ciphers,rejectUnauthorized:r.rejectUnauthorized||this.rejectUnauthorized,perMessageDeflate:r.perMessageDeflate||this.perMessageDeflate,extraHeaders:r.extraHeaders||this.extraHeaders,forceNode:r.forceNode||this.forceNode,localAddress:r.localAddress||this.localAddress,requestTimeout:r.requestTimeout||this.requestTimeout,protocols:r.protocols||void 0})},n.prototype.open=function(){var t;if(this.rememberUpgrade&&n.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket"))t="websocket";else{if(0===this.transports.length){var e=this;return void setTimeout(function(){e.emit("error","No transports available")},0)}t=this.transports[0]}this.readyState="opening";try{t=this.createTransport(t)}catch(t){return this.transports.shift(),void this.open()}t.open(),this.setTransport(t)},n.prototype.setTransport=function(t){e("setting transport %s",t.name);var n=this;this.transport&&(e("clearing existing transport %s",this.transport.name),this.transport.removeAllListeners()),this.transport=t,t.on("drain",function(){n.onDrain()}).on("packet",function(t){n.onPacket(t)}).on("error",function(t){n.onError(t)}).on("close",function(){n.onClose("transport close")})},n.prototype.probe=function(t){e('probing transport "%s"',t);var r=this.createTransport(t,{probe:1}),o=!1,i=this;function s(){if(i.onlyBinaryUpgrades){var s=!this.supportsBinary&&i.transport.supportsBinary;o=o||s}o||(e('probe transport "%s" opened',t),r.send([{type:"ping",data:"probe"}]),r.once("packet",function(s){if(!o)if("pong"===s.type&&"probe"===s.data){if(e('probe transport "%s" pong',t),i.upgrading=!0,i.emit("upgrading",r),!r)return;n.priorWebsocketSuccess="websocket"===r.name,e('pausing current transport "%s"',i.transport.name),i.transport.pause(function(){o||"closed"!==i.readyState&&(e("changing transport and sending upgrade packet"),h(),i.setTransport(r),r.send([{type:"upgrade"}]),i.emit("upgrade",r),r=null,i.upgrading=!1,i.flush())})}else{e('probe transport "%s" failed',t);var a=new Error("probe error");a.transport=r.name,i.emit("upgradeError",a)}}))}function a(){o||(o=!0,h(),r.close(),r=null)}function l(n){var o=new Error("probe error: "+n);o.transport=r.name,a(),e('probe transport "%s" failed because of error: %s',t,n),i.emit("upgradeError",o)}function u(){l("transport closed")}function p(){l("socket closed")}function c(t){r&&t.name!==r.name&&(e('"%s" works - aborting "%s"',t.name,r.name),a())}function h(){r.removeListener("open",s),r.removeListener("error",l),r.removeListener("close",u),i.removeListener("close",p),i.removeListener("upgrading",c)}n.priorWebsocketSuccess=!1,r.once("open",s),r.once("error",l),r.once("close",u),this.once("close",p),this.once("upgrading",c),r.open()},n.prototype.onOpen=function(){if(e("socket open"),this.readyState="open",n.priorWebsocketSuccess="websocket"===this.transport.name,this.emit("open"),this.flush(),"open"===this.readyState&&this.upgrade&&this.transport.pause){e("starting upgrade probes");for(var t=0,r=this.upgrades.length;t<r;t++)this.probe(this.upgrades[t])}},n.prototype.onPacket=function(t){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState)switch(e('socket receive: type "%s", data "%s"',t.type,t.data),this.emit("packet",t),this.emit("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"pong":this.setPing(),this.emit("pong");break;case"error":var n=new Error("server error");n.code=t.data,this.onError(n);break;case"message":this.emit("data",t.data),this.emit("message",t.data)}else e('packet received with socket readyState "%s"',this.readyState)},n.prototype.onHandshake=function(t){this.emit("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this.upgrades=this.filterUpgrades(t.upgrades),this.pingInterval=t.pingInterval,this.pingTimeout=t.pingTimeout,this.onOpen(),"closed"!==this.readyState&&(this.setPing(),this.removeListener("heartbeat",this.onHeartbeat),this.on("heartbeat",this.onHeartbeat))},n.prototype.onHeartbeat=function(t){clearTimeout(this.pingTimeoutTimer);var e=this;e.pingTimeoutTimer=setTimeout(function(){"closed"!==e.readyState&&e.onClose("ping timeout")},t||e.pingInterval+e.pingTimeout)},n.prototype.setPing=function(){var t=this;clearTimeout(t.pingIntervalTimer),t.pingIntervalTimer=setTimeout(function(){e("writing ping packet - expecting pong within %sms",t.pingTimeout),t.ping(),t.onHeartbeat(t.pingTimeout)},t.pingInterval)},n.prototype.ping=function(){var t=this;this.sendPacket("ping",function(){t.emit("ping")})},n.prototype.onDrain=function(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,0===this.writeBuffer.length?this.emit("drain"):this.flush()},n.prototype.flush=function(){"closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length&&(e("flushing %d packets in socket",this.writeBuffer.length),this.transport.send(this.writeBuffer),this.prevBufferLen=this.writeBuffer.length,this.emit("flush"))},n.prototype.write=n.prototype.send=function(t,e,n){return this.sendPacket("message",t,e,n),this},n.prototype.sendPacket=function(t,e,n,r){if("function"==typeof e&&(r=e,e=void 0),"function"==typeof n&&(r=n,n=null),"closing"!==this.readyState&&"closed"!==this.readyState){(n=n||{}).compress=!1!==n.compress;var o={type:t,data:e,options:n};this.emit("packetCreate",o),this.writeBuffer.push(o),r&&this.once("flush",r),this.flush()}},n.prototype.close=function(){if("opening"===this.readyState||"open"===this.readyState){this.readyState="closing";var t=this;this.writeBuffer.length?this.once("drain",function(){this.upgrading?o():n()}):this.upgrading?o():n()}function n(){t.onClose("forced close"),e("socket closing - telling transport to close"),t.transport.close()}function r(){t.removeListener("upgrade",r),t.removeListener("upgradeError",r),n()}function o(){t.once("upgrade",r),t.once("upgradeError",r)}return this},n.prototype.onError=function(t){e("socket error %j",t),n.priorWebsocketSuccess=!1,this.emit("error",t),this.onClose("transport error",t)},n.prototype.onClose=function(t,n){"opening"!==this.readyState&&"open"!==this.readyState&&"closing"!==this.readyState||(e('socket close with reason: "%s"',t),clearTimeout(this.pingIntervalTimer),clearTimeout(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),this.readyState="closed",this.id=null,this.emit("close",t,n),this.writeBuffer=[],this.prevBufferLen=0)},n.prototype.filterUpgrades=function(t){for(var e=[],n=0,r=t.length;n<r;n++)~mo(this.transports,t[n])&&e.push(t[n]);return e}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});var Ss={};(Ss=ws).parser=Gi;var _s={},Ps=Pi("socket.io-client:manager"),Es=Object.prototype.hasOwnProperty;function ks(t,e){if(!(this instanceof ks))return new ks(t,e);t&&"object"==typeof t&&(e=t,t=void 0),(e=e||{}).path=e.path||"/socket.io",this.nsps={},this.subs=[],this.opts=e,this.reconnection(!1!==e.reconnection),this.reconnectionAttempts(e.reconnectionAttempts||1/0),this.reconnectionDelay(e.reconnectionDelay||1e3),this.reconnectionDelayMax(e.reconnectionDelayMax||5e3),this.randomizationFactor(e.randomizationFactor||.5),this.backoff=new co({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==e.timeout?2e4:e.timeout),this.readyState="closed",this.uri=t,this.connecting=[],this.lastPing=null,this.encoding=!1,this.packetBuffer=[];var n=e.parser||Ci;this.encoder=new n.Encoder,this.decoder=new n.Decoder,this.autoConnect=!1!==e.autoConnect,this.autoConnect&&this.open()}_s=ks,ks.prototype.emitAll=function(){for(var t in this.emit.apply(this,arguments),this.nsps)Es.call(this.nsps,t)&&this.nsps[t].emit.apply(this.nsps[t],arguments)},ks.prototype.updateSocketIds=function(){for(var t in this.nsps)Es.call(this.nsps,t)&&(this.nsps[t].id=this.generateId(t))},ks.prototype.generateId=function(t){return("/"===t?"":t+"#")+this.engine.id},uo(ks.prototype),ks.prototype.reconnection=function(t){return arguments.length?(this._reconnection=!!t,this):this._reconnection},ks.prototype.reconnectionAttempts=function(t){return arguments.length?(this._reconnectionAttempts=t,this):this._reconnectionAttempts},ks.prototype.reconnectionDelay=function(t){return arguments.length?(this._reconnectionDelay=t,this.backoff&&this.backoff.setMin(t),this):this._reconnectionDelay},ks.prototype.randomizationFactor=function(t){return arguments.length?(this._randomizationFactor=t,this.backoff&&this.backoff.setJitter(t),this):this._randomizationFactor},ks.prototype.reconnectionDelayMax=function(t){return arguments.length?(this._reconnectionDelayMax=t,this.backoff&&this.backoff.setMax(t),this):this._reconnectionDelayMax},ks.prototype.timeout=function(t){return arguments.length?(this._timeout=t,this):this._timeout},ks.prototype.maybeReconnectOnOpen=function(){!this.reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()},ks.prototype.open=ks.prototype.connect=function(t,e){if(Ps("readyState %s",this.readyState),~this.readyState.indexOf("open"))return this;Ps("opening %s",this.uri),this.engine=Ss(this.uri,this.opts);var n=this.engine,r=this;this.readyState="opening",this.skipReconnect=!1;var o=vo(n,"open",function(){r.onopen(),t&&t()}),i=vo(n,"error",function(e){if(Ps("connect_error"),r.cleanup(),r.readyState="closed",r.emitAll("connect_error",e),t){var n=new Error("Connection error");n.data=e,t(n)}else r.maybeReconnectOnOpen()});if(!1!==this._timeout){var s=this._timeout;Ps("connect attempt will timeout after %d",s);var a=setTimeout(function(){Ps("connect attempt timed out after %d",s),o.destroy(),n.close(),n.emit("error","timeout"),r.emitAll("connect_timeout",s)},s);this.subs.push({destroy:function(){clearTimeout(a)}})}return this.subs.push(o),this.subs.push(i),this},ks.prototype.onopen=function(){Ps("open"),this.cleanup(),this.readyState="open",this.emit("open");var t=this.engine;this.subs.push(vo(t,"data",yo(this,"ondata"))),this.subs.push(vo(t,"ping",yo(this,"onping"))),this.subs.push(vo(t,"pong",yo(this,"onpong"))),this.subs.push(vo(t,"error",yo(this,"onerror"))),this.subs.push(vo(t,"close",yo(this,"onclose"))),this.subs.push(vo(this.decoder,"decoded",yo(this,"ondecoded")))},ks.prototype.onping=function(){this.lastPing=new Date,this.emitAll("ping")},ks.prototype.onpong=function(){this.emitAll("pong",new Date-this.lastPing)},ks.prototype.ondata=function(t){this.decoder.add(t)},ks.prototype.ondecoded=function(t){this.emit("packet",t)},ks.prototype.onerror=function(t){Ps("error",t),this.emitAll("error",t)},ks.prototype.socket=function(t,e){var n=this.nsps[t];if(!n){n=new Ii(this,t,e),this.nsps[t]=n;var r=this;n.on("connecting",o),n.on("connect",function(){n.id=r.generateId(t)}),this.autoConnect&&o()}function o(){~mo(r.connecting,n)||r.connecting.push(n)}return n},ks.prototype.destroy=function(t){var e=mo(this.connecting,t);~e&&this.connecting.splice(e,1),this.connecting.length||this.close()},ks.prototype.packet=function(t){Ps("writing packet %j",t);var e=this;t.query&&0===t.type&&(t.nsp+="?"+t.query),e.encoding?e.packetBuffer.push(t):(e.encoding=!0,this.encoder.encode(t,function(n){for(var r=0;r<n.length;r++)e.engine.write(n[r],t.options);e.encoding=!1,e.processPacketQueue()}))},ks.prototype.processPacketQueue=function(){if(this.packetBuffer.length>0&&!this.encoding){var t=this.packetBuffer.shift();this.packet(t)}},ks.prototype.cleanup=function(){Ps("cleanup");for(var t=this.subs.length,e=0;e<t;e++)this.subs.shift().destroy();this.packetBuffer=[],this.encoding=!1,this.lastPing=null,this.decoder.destroy()},ks.prototype.close=ks.prototype.disconnect=function(){Ps("disconnect"),this.skipReconnect=!0,this.reconnecting=!1,"opening"===this.readyState&&this.cleanup(),this.backoff.reset(),this.readyState="closed",this.engine&&this.engine.close()},ks.prototype.onclose=function(t){Ps("onclose"),this.cleanup(),this.backoff.reset(),this.readyState="closed",this.emit("close",t),this._reconnection&&!this.skipReconnect&&this.reconnect()},ks.prototype.reconnect=function(){if(this.reconnecting||this.skipReconnect)return this;var t=this;if(this.backoff.attempts>=this._reconnectionAttempts)Ps("reconnect failed"),this.backoff.reset(),this.emitAll("reconnect_failed"),this.reconnecting=!1;else{var e=this.backoff.duration();Ps("will wait %dms before reconnect attempt",e),this.reconnecting=!0;var n=setTimeout(function(){t.skipReconnect||(Ps("attempting reconnect"),t.emitAll("reconnect_attempt",t.backoff.attempts),t.emitAll("reconnecting",t.backoff.attempts),t.skipReconnect||t.open(function(e){e?(Ps("reconnect attempt error"),t.reconnecting=!1,t.reconnect(),t.emitAll("reconnect_error",e.data)):(Ps("reconnect success"),t.onreconnect())}))},e);this.subs.push({destroy:function(){clearTimeout(n)}})}},ks.prototype.onreconnect=function(){var t=this.backoff.attempts;this.reconnecting=!1,this.backoff.reset(),this.updateSocketIds(),this.emitAll("reconnect",t)};var Cs={};(function(t){var e=Pi("socket.io-client:url");Cs=function(n,r){var o=n;r=r||t.location,null==n&&(n=r.protocol+"//"+r.host),"string"==typeof n&&("/"===n.charAt(0)&&(n="/"===n.charAt(1)?r.protocol+n:r.host+n),/^(https?|wss?):\/\//.test(n)||(e("protocol-less url %s",n),n=void 0!==r?r.protocol+"//"+n:"https://"+n),e("parse %s",n),o=Ji(n)),o.port||(/^(http|ws)$/.test(o.protocol)?o.port="80":/^(http|ws)s$/.test(o.protocol)&&(o.port="443")),o.path=o.path||"/";var i=-1!==o.host.indexOf(":")?"["+o.host+"]":o.host;return o.id=o.protocol+"://"+i+":"+o.port,o.href=o.protocol+"://"+i+(r&&r.port===o.port?"":":"+o.port),o}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});var Ts={},Os=Pi("socket.io-client"),Us=(Ts=Ts=Fs).managers={};function Fs(t,e){"object"==typeof t&&(e=t,t=void 0),e=e||{};var n,r=Cs(t),o=r.source,i=r.id,s=r.path,a=Us[i]&&s in Us[i].nsps;return e.forceNew||e["force new connection"]||!1===e.multiplex||a?(Os("ignoring socket cache for %s",o),n=_s(o,e)):(Us[i]||(Os("new io instance for %s",o),Us[i]=_s(o,e)),n=Us[i]),r.query&&!e.query&&(e.query=r.query),n.socket(r.path,e)}Ts.protocol=Ci.protocol,Ts.connect=Fs,Ts.Manager=_s,Ts.Socket=Ii;var As=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},xs=void 0,Ds=["ASSEMBLY_UPLOADING","ASSEMBLY_EXECUTING","ASSEMBLY_COMPLETED"];function Rs(t,e){return Ds.indexOf(t)>=Ds.indexOf(e)}var Is=function(t){function e(n){!function(t,n){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this);var r=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.call(this));return r.status=n,r.socket=null,r.pollInterval=null,r.closed=!1,r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.connect=function(){this._connectSocket(),this._beginPolling()},e.prototype._onFinished=function(){this.emit("finished"),this.close()},e.prototype._connectSocket=function(){var t=this,e=function(t){var e=/^\w+:\/\//.exec(t),n=0;e&&(n=e[0].length+1);var r=t.indexOf("/",n);return-1===r?{origin:t,pathname:"/"}:{origin:t.slice(0,r),pathname:t.slice(r)}}(this.status.websocket_url),n=(xs||(xs=Ts),xs).connect(e.origin,{transports:["websocket"],path:e.pathname});n.on("connect",function(){n.emit("assembly_connect",{id:t.status.assembly_id}),t.emit("connect")}),n.on("error",function(){n.disconnect(),t.socket=null}),n.on("assembly_finished",function(){t._onFinished()}),n.on("assembly_upload_finished",function(e){t.emit("upload",e),t._fetchStatus({diff:!1})}),n.on("assembly_uploading_finished",function(){t.emit("executing"),t._fetchStatus({diff:!1})}),n.on("assembly_upload_meta_data_extracted",function(){t.emit("metadata"),t._fetchStatus({diff:!1})}),n.on("assembly_result_finished",function(e,n){t.emit("result",e,n),t._fetchStatus({diff:!1})}),n.on("assembly_error",function(e){t._onError(e),t._fetchStatus({diff:!1})}),this.socket=n},e.prototype._onError=function(t){this.emit("error",As(new Error(t.message),t))},e.prototype._beginPolling=function(){var t=this;this.pollInterval=setInterval(function(){t.socket&&t.socket.connected||t._fetchStatus()},2e3)},e.prototype._fetchStatus=function(){var t=this,e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).diff,n=void 0===e||e;return fetch(this.status.assembly_ssl_url).then(function(t){return t.json()}).then(function(e){t.closed||(t.emit("status",e),n?t.updateStatus(e):t.status=e)})},e.prototype.update=function(){return this._fetchStatus({diff:!0})},e.prototype.updateStatus=function(t){this._diffStatus(this.status,t),this.status=t},e.prototype._diffStatus=function(t,e){var n=this,r=t.ok,o=e.ok;if(e.error&&!t.error)return this._onError(e);var i=Rs(o,"ASSEMBLY_EXECUTING")&&!Rs(r,"ASSEMBLY_EXECUTING");i&&this.emit("executing"),Object.keys(e.uploads).filter(function(e){return!t.uploads.hasOwnProperty(e)}).map(function(t){return e.uploads[t]}).forEach(function(t){n.emit("upload",t)}),i&&this.emit("metadata"),Object.keys(e.results).forEach(function(r){var o=e.results[r],i=t.results[r];o.filter(function(t){return!i||!i.some(function(e){return e.id===t.id})}).forEach(function(t){n.emit("result",r,t)})}),Rs(o,"ASSEMBLY_COMPLETED")&&!Rs(r,"ASSEMBLY_COMPLETED")&&this.emit("finished")},e.prototype.close=function(){this.closed=!0,this.socket&&(this.socket.disconnect(),this.socket=null),clearInterval(this.pollInterval)},e}(uo);function Bs(t){if(!t)throw new Error("Transloadit: The `params` option is required.");if("string"==typeof t)try{t=JSON.parse(t)}catch(t){throw t.message="Transloadit: The `params` option is a malformed JSON string: "+t.message,t}if(!t.auth||!t.auth.key)throw new Error("Transloadit: The `params.auth.key` option is required. You can find your Transloadit API key at https://transloadit.com/accounts/credentials.")}var js=(Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t})(function(){function t(e,n){!function(e,n){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this),this.files=e,this.opts=n}return t.prototype._normalizeAssemblyOptions=function(t,e){if(Array.isArray(e.fields)){var n=e.fields;e.fields={},n.forEach(function(n){e.fields[n]=t.meta[n]})}return e.fields||(e.fields={}),e},t.prototype._getAssemblyOptions=function(t){var e=this,n=this.opts;return Promise.resolve().then(function(){return n.getAssemblyOptions(t,n)}).then(function(n){return e._normalizeAssemblyOptions(t,n)}).then(function(e){return Bs(e.params),{fileIDs:[t.id],options:e}})},t.prototype._dedupe=function(t){var e=Object.create(null);return t.forEach(function(t){var n,r=t.fileIDs,o=t.options,i=JSON.stringify(o);e[i]?(n=e[i].fileIDs).push.apply(n,r):e[i]={options:o,fileIDs:[].concat(r)}}),Object.keys(e).map(function(t){return e[t]})},t.prototype.build=function(){var t=this,e=this.opts;return this.files.length>0?Promise.all(this.files.map(function(e){return t._getAssemblyOptions(e)})).then(function(e){return t._dedupe(e)}):e.alwaysRunAssembly?Promise.resolve(e.getAssemblyOptions(null,e)).then(function(e){return Bs(e.params),[{fileIDs:t.files.map(function(t){return t.id}),options:e}]}):Promise.resolve([])},t}(),{validateParams:Bs}),Ls=function(t){function e(n,r){!function(t,n){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this);var o=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.call(this));return o._uppy=n,o._assemblyIDs=r,o._remaining=r.length,o.promise=new Promise(function(t,e){o._resolve=t,o._reject=e}),o._onAssemblyComplete=o._onAssemblyComplete.bind(o),o._onAssemblyError=o._onAssemblyError.bind(o),o._onImportError=o._onImportError.bind(o),o._addListeners(),o}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype._watching=function(t){return-1!==this._assemblyIDs.indexOf(t)},e.prototype._onAssemblyComplete=function(t){this._watching(t.assembly_id)&&(this._uppy.log("[Transloadit] AssemblyWatcher: Got Assembly finish "+t.assembly_id),this.emit("assembly-complete",t.assembly_id),this._checkAllComplete())},e.prototype._onAssemblyError=function(t,e){this._watching(t.assembly_id)&&(this._uppy.log("[Transloadit] AssemblyWatcher: Got Assembly error "+t.assembly_id),this._uppy.log(e),this.emit("assembly-error",t.assembly_id,e),this._checkAllComplete())},e.prototype._onImportError=function(t,e,n){this._watching(t.assembly_id)&&this._onAssemblyError(t,n)},e.prototype._checkAllComplete=function(){this._remaining-=1,0===this._remaining&&(this._removeListeners(),this._resolve())},e.prototype._removeListeners=function(){this._uppy.off("transloadit:complete",this._onAssemblyComplete),this._uppy.off("transloadit:assembly-error",this._onAssemblyError),this._uppy.off("transloadit:import-error",this._onImportError)},e.prototype._addListeners=function(){this._uppy.on("transloadit:complete",this._onAssemblyComplete),this._uppy.on("transloadit:assembly-error",this._onAssemblyError),this._uppy.on("transloadit:import-error",this._onImportError)},e}(uo),Ms=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function(e,n){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this),this.opts=e}return t.prototype.createAssembly=function(t){t.templateId;var e=t.params,n=t.fields,r=t.signature,o=t.expectedFiles,i=new FormData;return i.append("params","string"==typeof e?e:JSON.stringify(e)),r&&i.append("signature",r),Object.keys(n).forEach(function(t){i.append(t,n[t])}),i.append("num_expected_upload_files",o),fetch(this.opts.service+"/assemblies",{method:"post",body:i}).then(function(t){return t.json()}).then(function(t){if(t.error){var e=new Error(t.error);throw e.message=t.error,e.details=t.reason,e}return t})},t.prototype.reserveFile=function(t,e){var n=encodeURIComponent(e.size);return fetch(t.assembly_ssl_url+"/reserve_file?size="+n,{method:"post"}).then(function(t){return t.json()})},t.prototype.addFile=function(t,e){if(!e.uploadURL)return Promise.reject(new Error("File does not have an `uploadURL`."));var n=encodeURIComponent(e.size),r=encodeURIComponent(e.uploadURL),o="size="+n+"&filename="+encodeURIComponent(e.name)+"&fieldname=file&s3Url="+r;return fetch(t.assembly_ssl_url+"/add_file?"+o,{method:"post"}).then(function(t){return t.json()})},t.prototype.getAssemblyStatus=function(t){return fetch(t).then(function(t){return t.json()})},t}(),Ns={};Object.defineProperty(Ns,"__esModule",{value:!0}),Ns.setItem=function(t,e){if(zs)return localStorage.setItem(t,e)},Ns.getItem=function(t){if(zs)return localStorage.getItem(t)},Ns.removeItem=function(t){if(zs)return localStorage.removeItem(t)};var zs=!1;try{zs="localStorage"in window;var qs="tusSupport";localStorage.setItem(qs,localStorage.getItem(qs))}catch(t){if(t.code!==t.SECURITY_ERR&&t.code!==t.QUOTA_EXCEEDED_ERR)throw t;zs=!1}Ns.canStoreURLs=zs;var Hs=Object.prototype.hasOwnProperty,Ws=Object.prototype.toString,Xs=function(t){return"function"==typeof Array.isArray?Array.isArray(t):"[object Array]"===Ws.call(t)},Vs=function(t){if(!t||"[object Object]"!==Ws.call(t))return!1;var e,n=Hs.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&Hs.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;for(e in t);return void 0===e||Hs.call(t,e)},Gs={};Object.defineProperty(Gs,"__esModule",{value:!0}),Gs.encode=function(t){return Ks(unescape(encodeURIComponent(t)))};var Ks=window.btoa;Gs.isSupported="btoa"in window;var Ys={};Object.defineProperty(Ys,"__esModule",{value:!0}),Ys.newRequest=function(){return new window.XMLHttpRequest},Ys.resolveUrl=function(t,e){return(0,$s.default)(t,e)};var Js,$s=(Js=ht)&&Js.__esModule?Js:{default:Js},Qs={},Zs=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}();Object.defineProperty(Qs,"__esModule",{value:!0}),Qs.getSource=function(t){if("function"==typeof t.slice&&void 0!==t.size)return new ta(t);throw new Error("source object may only be an instance of File or Blob in this environment")};var ta=function(){function t(e){!function(e,n){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this),this._file=e,this.size=e.size}return Zs(t,[{key:"slice",value:function(t,e){return this._file.slice(t,e)}},{key:"close",value:function(){}}]),t}(),ea={};Object.defineProperty(ea,"__esModule",{value:!0});var na=function(t){function e(t){var n=arguments.length<=1||void 0===arguments[1]?null:arguments[1],r=arguments.length<=2||void 0===arguments[2]?null:arguments[2];!function(t,n){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this);var o=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,Object.getPrototypeOf(e).call(this,t.message));o.originalRequest=r,o.causingError=n;var i=t.message;return null!=n&&(i+=", caused by "+n.toString()),null!=r&&(i+=", originated from request (response code: "+r.status+", response text: "+r.responseText+")"),o.message=i,o}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,Error),e}();ea.default=na;var ra={};Object.defineProperty(ra,"__esModule",{value:!0}),ra.default=function(t,e){return["tus",t.name,t.type,t.size,t.lastModified,e.endpoint].join("-")};var oa={},ia=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}();Object.defineProperty(oa,"__esModule",{value:!0});var sa=ha(ra),aa=ha(ea),la=ha(function t(){var e,n,r,o,i,s,a=arguments[0],l=1,u=arguments.length,p=!1;for("boolean"==typeof a&&(p=a,a=arguments[1]||{},l=2),(null==a||"object"!=typeof a&&"function"!=typeof a)&&(a={});l<u;++l)if(null!=(e=arguments[l]))for(n in e)r=a[n],a!==(o=e[n])&&(p&&o&&(Vs(o)||(i=Xs(o)))?(i?(i=!1,s=r&&Xs(r)?r:[]):s=r&&Vs(r)?r:{},a[n]=t(p,s,o)):void 0!==o&&(a[n]=o));return a}),ua=ca(Gs),pa=ca(Ns);function ca(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}function ha(t){return t&&t.__esModule?t:{default:t}}var da={endpoint:null,fingerprint:sa.default,resume:!0,onProgress:null,onChunkComplete:null,onSuccess:null,onError:null,headers:{},chunkSize:1/0,withCredentials:!1,uploadUrl:null,uploadSize:null,overridePatchMethod:!1,retryDelays:null,removeFingerprintOnSuccess:!1},fa=function(){function t(e,n){!function(e,n){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this),this.options=(0,la.default)(!0,{},da,n),this.file=e,this.url=null,this._xhr=null,this._fingerprint=null,this._offset=null,this._aborted=!1,this._size=null,this._source=null,this._retryAttempt=0,this._retryTimeout=null,this._offsetBeforeRetry=0}return ia(t,[{key:"start",value:function(){var t=this,e=this.file;if(e)if(this.options.endpoint||this.options.uploadUrl){var n=this._source=(0,Qs.getSource)(e,this.options.chunkSize);if(null!=this.options.uploadSize){var r=+this.options.uploadSize;if(isNaN(r))throw new Error("tus: cannot convert `uploadSize` option into a number");this._size=r}else{if(null==(r=n.size))throw new Error("tus: cannot automatically derive upload's size from input and must be specified manually using the `uploadSize` option");this._size=r}var o,i=this.options.retryDelays;if(null!=i){if("[object Array]"!==Object.prototype.toString.call(i))throw new Error("tus: the `retryDelays` option must either be an array or null");o=t.options.onError,t.options.onError=function(e){t.options.onError=o,null!=t._offset&&t._offset>t._offsetBeforeRetry&&(t._retryAttempt=0);var n=!0;if("undefined"!=typeof window&&"navigator"in window&&!1===window.navigator.onLine&&(n=!1),t._retryAttempt<i.length&&null!=e.originalRequest&&!ya(e.originalRequest.status,400)&&n){var r=i[t._retryAttempt++];t._offsetBeforeRetry=t._offset,t.options.uploadUrl=t.url,t._retryTimeout=setTimeout(function(){t.start()},r)}else t._emitError(e)}}if(this._aborted=!1,null==this.url){if(null!=this.options.uploadUrl)return this.url=this.options.uploadUrl,void this._resumeUpload();if(this.options.resume){this._fingerprint=this.options.fingerprint(e,this.options);var s=pa.getItem(this._fingerprint);if(null!=s)return this.url=s,void this._resumeUpload()}this._createUpload()}else this._resumeUpload()}else this._emitError(new Error("tus: neither an endpoint or an upload URL is provided"));else this._emitError(new Error("tus: no file or stream to upload provided"))}},{key:"abort",value:function(){null!==this._xhr&&(this._xhr.abort(),this._source.close(),this._aborted=!0),null!=this._retryTimeout&&(clearTimeout(this._retryTimeout),this._retryTimeout=null)}},{key:"_emitXhrError",value:function(t,e,n){this._emitError(new aa.default(e,n,t))}},{key:"_emitError",value:function(t){if("function"!=typeof this.options.onError)throw t;this.options.onError(t)}},{key:"_emitSuccess",value:function(){"function"==typeof this.options.onSuccess&&this.options.onSuccess()}},{key:"_emitProgress",value:function(t,e){"function"==typeof this.options.onProgress&&this.options.onProgress(t,e)}},{key:"_emitChunkComplete",value:function(t,e,n){"function"==typeof this.options.onChunkComplete&&this.options.onChunkComplete(t,e,n)}},{key:"_setupXHR",value:function(t){this._xhr=t,t.setRequestHeader("Tus-Resumable","1.0.0");var e=this.options.headers;for(var n in e)t.setRequestHeader(n,e[n]);t.withCredentials=this.options.withCredentials}},{key:"_createUpload",value:function(){var t=this;if(this.options.endpoint){var e=(0,Ys.newRequest)();e.open("POST",this.options.endpoint,!0),e.onload=function(){if(ya(e.status,200)){var n=e.getResponseHeader("Location");if(null!=n){if(t.url=(0,Ys.resolveUrl)(t.options.endpoint,n),0===t._size)return t._emitSuccess(),void t._source.close();t.options.resume&&pa.setItem(t._fingerprint,t.url),t._offset=0,t._startUpload()}else t._emitXhrError(e,new Error("tus: invalid or missing Location header"))}else t._emitXhrError(e,new Error("tus: unexpected response while creating upload"))},e.onerror=function(n){t._emitXhrError(e,new Error("tus: failed to create upload"),n)},this._setupXHR(e),e.setRequestHeader("Upload-Length",this._size);var n=function(t){if(!ua.isSupported)return"";var e=[];for(var n in t)e.push(n+" "+ua.encode(t[n]));return e.join(",")}(this.options.metadata);""!==n&&e.setRequestHeader("Upload-Metadata",n),e.send(null)}else this._emitError(new Error("tus: unable to create upload because no endpoint is provided"))}},{key:"_resumeUpload",value:function(){var t=this,e=(0,Ys.newRequest)();e.open("HEAD",this.url,!0),e.onload=function(){if(!ya(e.status,200))return t.options.resume&&ya(e.status,400)&&pa.removeItem(t._fingerprint),423===e.status?void t._emitXhrError(e,new Error("tus: upload is currently locked; retry later")):t.options.endpoint?(t.url=null,void t._createUpload()):void t._emitXhrError(e,new Error("tus: unable to resume upload (new upload cannot be created without an endpoint)"));var n=parseInt(e.getResponseHeader("Upload-Offset"),10);if(isNaN(n))t._emitXhrError(e,new Error("tus: invalid or missing offset value"));else{var r=parseInt(e.getResponseHeader("Upload-Length"),10);if(isNaN(r))t._emitXhrError(e,new Error("tus: invalid or missing length value"));else{if(n===r)return t._emitProgress(r,r),void t._emitSuccess();t._offset=n,t._startUpload()}}},e.onerror=function(n){t._emitXhrError(e,new Error("tus: failed to resume upload"),n)},this._setupXHR(e),e.send(null)}},{key:"_startUpload",value:function(){var t=this;if(!this._aborted){var e=(0,Ys.newRequest)();this.options.overridePatchMethod?(e.open("POST",this.url,!0),e.setRequestHeader("X-HTTP-Method-Override","PATCH")):e.open("PATCH",this.url,!0),e.onload=function(){if(ya(e.status,200)){var n=parseInt(e.getResponseHeader("Upload-Offset"),10);if(isNaN(n))t._emitXhrError(e,new Error("tus: invalid or missing offset value"));else{if(t._emitProgress(n,t._size),t._emitChunkComplete(n-t._offset,n,t._size),t._offset=n,n==t._size)return t.options.removeFingerprintOnSuccess&&t.options.resume&&pa.removeItem(t._fingerprint),t._emitSuccess(),void t._source.close();t._startUpload()}}else t._emitXhrError(e,new Error("tus: unexpected response while uploading chunk"))},e.onerror=function(n){t._aborted||t._emitXhrError(e,new Error("tus: failed to upload chunk at offset "+t._offset),n)},"upload"in e&&(e.upload.onprogress=function(e){e.lengthComputable&&t._emitProgress(n+e.loaded,t._size)}),this._setupXHR(e),e.setRequestHeader("Upload-Offset",this._offset),e.setRequestHeader("Content-Type","application/offset+octet-stream");var n=this._offset,r=this._offset+this.options.chunkSize;(r===1/0||r>this._size)&&(r=this._size),e.send(this._source.slice(n,r)),this._emitProgress(this._offset,this._size)}}}]),t}();function ya(t,e){return t>=e&&t<e+100}fa.defaultOptions=da,oa.default=fa;var ga,ma=(ga=oa)&&ga.__esModule?ga:{default:ga};ma.default.defaultOptions;if("undefined"!=typeof window){var va=window,ba=va.XMLHttpRequest,wa=va.Blob;ba&&wa&&wa.prototype.slice}else!0;var Sa={Upload:ma.default},_a=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Pa=d.Provider,Ea=d.RequestClient,ka=d.Socket,Ca={endpoint:"",resume:!0,onProgress:null,onChunkComplete:null,onSuccess:null,onError:null,headers:{},chunkSize:1/0,withCredentials:!1,uploadUrl:null,uploadSize:null,overridePatchMethod:!1,retryDelays:null};function Ta(t){var e=[];return{on:function(n,r){return e.push([n,r]),t.on(n,r)},remove:function(){e.forEach(function(e){var n=e[0],r=e[1];t.off(n,r)})}}}var Oa=function(t){function e(n,r){!function(t,n){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this);var o=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.call(this,n,r));return o.type="uploader",o.id="Tus",o.title="Tus",o.opts=_a({},{resume:!0,autoRetry:!0,useFastRemoteRetry:!0,limit:0,retryDelays:[0,1e3,3e3,5e3]},r),"number"==typeof o.opts.limit&&0!==o.opts.limit?o.limitUploads=ot(o.opts.limit):o.limitUploads=function(t){return t},o.uploaders=Object.create(null),o.uploaderEvents=Object.create(null),o.uploaderSockets=Object.create(null),o.handleResetProgress=o.handleResetProgress.bind(o),o.handleUpload=o.handleUpload.bind(o),o}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.handleResetProgress=function(){var t=_a({},this.uppy.getState().files);Object.keys(t).forEach(function(e){if(t[e].tus&&t[e].tus.uploadUrl){var n=_a({},t[e].tus);delete n.uploadUrl,t[e]=_a({},t[e],{tus:n})}}),this.uppy.setState({files:t})},e.prototype.resetUploaderReferences=function(t){this.uploaders[t]&&(this.uploaders[t].abort(),this.uploaders[t]=null),this.uploaderEvents[t]&&(this.uploaderEvents[t].remove(),this.uploaderEvents[t]=null),this.uploaderSockets[t]&&(this.uploaderSockets[t].close(),this.uploaderSockets[t]=null)},e.prototype.upload=function(t,e,n){var r=this;return this.resetUploaderReferences(t.id),new Promise(function(e,n){var o=_a({},Ca,r.opts,t.tus||{});o.onError=function(e){r.uppy.log(e),r.uppy.emit("upload-error",t,e),e.message="Failed because: "+e.message,r.resetUploaderReferences(t.id),n(e)},o.onProgress=function(e,n){r.onReceiveUploadUrl(t,a.url),r.uppy.emit("upload-progress",t,{uploader:r,bytesUploaded:e,bytesTotal:n})},o.onSuccess=function(){r.uppy.emit("upload-success",t,a,a.url),a.url&&r.uppy.log("Download "+a.file.name+" from "+a.url),r.resetUploaderReferences(t.id),e(a)};var i=function(t,e,n){Object.prototype.hasOwnProperty.call(t,e)&&!Object.prototype.hasOwnProperty.call(t,n)&&(t[n]=t[e])},s=_a({},t.meta);i(s,"type","filetype"),i(s,"name","filename"),o.metadata=s;var a=new Sa.Upload(t.data,o);r.uploaders[t.id]=a,r.uploaderEvents[t.id]=Ta(r.uppy),r.onFileRemove(t.id,function(n){r.resetUploaderReferences(t.id),e("upload "+n+" was removed")}),r.onPause(t.id,function(t){t?a.abort():a.start()}),r.onPauseAll(t.id,function(){a.abort()}),r.onCancelAll(t.id,function(){r.resetUploaderReferences(t.id)}),r.onResumeAll(t.id,function(){t.error&&a.abort(),a.start()}),t.isPaused||a.start()})},e.prototype.uploadRemote=function(t,e,n){var r=this;this.resetUploaderReferences(t.id);var o=_a({},this.opts,t.tus||{});return new Promise(function(e,n){if(r.uppy.log(t.remote.url),t.serverToken)return r.connectToServerSocket(t).then(function(){return e()}).catch(n);r.uppy.emit("upload-started",t),new(t.remote.providerOptions.provider?Pa:Ea)(r.uppy,t.remote.providerOptions).post(t.remote.url,_a({},t.remote.body,{endpoint:o.endpoint,uploadUrl:o.uploadUrl,protocol:"tus",size:t.data.size,metadata:t.meta})).then(function(e){return r.uppy.setFileState(t.id,{serverToken:e.token}),t=r.uppy.getFile(t.id)}).then(function(t){return r.connectToServerSocket(t)}).then(function(){e()}).catch(function(t){n(new Error(t))})})},e.prototype.connectToServerSocket=function(t){var e=this;return new Promise(function(n,r){var o=t.serverToken,i=rt(t.remote.serverUrl),s=new ka({target:i+"/api/"+o});e.uploaderSockets[t.id]=s,e.uploaderEvents[t.id]=Ta(e.uppy),e.onFileRemove(t.id,function(){s.send("pause",{}),n("upload "+t.id+" was removed")}),e.onPause(t.id,function(t){t?s.send("pause",{}):s.send("resume",{})}),e.onPauseAll(t.id,function(){return s.send("pause",{})}),e.onCancelAll(t.id,function(){return s.send("pause",{})}),e.onResumeAll(t.id,function(){t.error&&s.send("pause",{}),s.send("resume",{})}),e.onRetry(t.id,function(){s.send("pause",{}),s.send("resume",{})}),e.onRetryAll(t.id,function(){s.send("pause",{}),s.send("resume",{})}),t.isPaused&&s.send("pause",{}),s.on("progress",function(n){return nt(e,n,t)}),s.on("error",function(n){var o=n.error.message,i=_a(new Error(o),{cause:n.error});e.opts.useFastRemoteRetry||(e.resetUploaderReferences(t.id),e.uppy.setFileState(t.id,{serverToken:null})),e.uppy.emit("upload-error",t,i),r(i)}),s.on("success",function(r){e.uppy.emit("upload-success",t,r,r.url),e.resetUploaderReferences(t.id),n()})})},e.prototype.onReceiveUploadUrl=function(t,e){var n=this.uppy.getFile(t.id);n&&(n.tus&&n.tus.uploadUrl===e||(this.uppy.log("[Tus] Storing upload url"),this.uppy.setFileState(n.id,{tus:_a({},n.tus,{uploadUrl:e})})))},e.prototype.onFileRemove=function(t,e){this.uploaderEvents[t].on("file-removed",function(n){t===n.id&&e(n.id)})},e.prototype.onPause=function(t,e){this.uploaderEvents[t].on("upload-pause",function(n,r){t===n&&e(r)})},e.prototype.onRetry=function(t,e){this.uploaderEvents[t].on("upload-retry",function(n){t===n&&e()})},e.prototype.onRetryAll=function(t,e){var n=this;this.uploaderEvents[t].on("retry-all",function(r){n.uppy.getFile(t)&&e()})},e.prototype.onPauseAll=function(t,e){var n=this;this.uploaderEvents[t].on("pause-all",function(){n.uppy.getFile(t)&&e()})},e.prototype.onCancelAll=function(t,e){var n=this;this.uploaderEvents[t].on("cancel-all",function(){n.uppy.getFile(t)&&e()})},e.prototype.onResumeAll=function(t,e){var n=this;this.uploaderEvents[t].on("resume-all",function(){n.uppy.getFile(t)&&e()})},e.prototype.uploadFiles=function(t){var e=this,n=t.map(function(n,r){var o=parseInt(r,10)+1,i=t.length;return n.error?function(){return Promise.reject(new Error(n.error))}:n.isRemote?(e.uppy.emit("upload-started",n),e.uploadRemote.bind(e,n,o,i)):(e.uppy.emit("upload-started",n),e.upload.bind(e,n,o,i))}).map(function(t){return e.limitUploads(t)()});return dt(n)},e.prototype.handleUpload=function(t){var e=this;if(0===t.length)return this.uppy.log("Tus: no files to upload!"),Promise.resolve();this.uppy.log("Tus is uploading...");var n=t.map(function(t){return e.uppy.getFile(t)});return this.uploadFiles(n).then(function(){return null})},e.prototype.install=function(){this.uppy.setState({capabilities:_a({},this.uppy.getState().capabilities,{resumableUploads:!0})}),this.uppy.addUploader(this.handleUpload),this.uppy.on("reset-progress",this.handleResetProgress),this.opts.autoRetry&&this.uppy.on("back-online",this.uppy.retryAll)},e.prototype.uninstall=function(){this.uppy.setState({capabilities:_a({},this.uppy.getState().capabilities,{resumableUploads:!1})}),this.uppy.removeUploader(this.handleUpload),this.opts.autoRetry&&this.uppy.off("back-online",this.uppy.retryAll)},e}(Y.Plugin),Ua={},Fa=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t};function Aa(t,e){return{params:e.params,signature:e.signature,fields:e.fields}}var xa="https://api2.transloadit.com/companion",Da=/https?:\/\/api2(?:-\w+)?\.transloadit\.com\/companion/,Ra=/https?:\/\/api2(?:-\w+)?\.transloadit\.com\/uppy-server/;(Ua=function(t){function e(n,r){!function(t,n){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this);var o=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.call(this,n,r));o.type="uploader",o.id="Transloadit",o.title="Transloadit";var i={strings:{creatingAssembly:"Preparing upload...",creatingAssemblyFailed:"Transloadit: Could not create Assembly",encoding:"Encoding..."}},s={service:"https://api2.transloadit.com",waitForEncoding:!1,waitForMetadata:!1,alwaysRunAssembly:!1,importFromUploadURLs:!1,signature:null,params:null,fields:{},getAssemblyOptions:Aa,locale:i};return o.opts=Fa({},s,r),o.locale=Fa({},i,o.opts.locale),o.locale.strings=Fa({},i.strings,o.opts.locale.strings),o.translator=new H({locale:o.locale}),o.i18n=o.translator.translate.bind(o.translator),o._prepareUpload=o._prepareUpload.bind(o),o._afterUpload=o._afterUpload.bind(o),o._handleError=o._handleError.bind(o),o._onFileUploadURLAvailable=o._onFileUploadURLAvailable.bind(o),o._onRestored=o._onRestored.bind(o),o._getPersistentData=o._getPersistentData.bind(o),o.opts.params&&js.validateParams(o.opts.params),o.client=new Ms({service:o.opts.service}),o.activeAssemblies={},o}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype._attachAssemblyMetadata=function(t,e){var n=Fa({},t.meta,{assembly_url:e.assembly_url,filename:t.name,fieldname:"file"}),r=Fa({},t.tus,{endpoint:e.tus_url}),o=t.remote;if(t.remote&&Ra.test(t.remote.serverUrl)){var i=new Error("The https://api2.transloadit.com/uppy-server endpoint was renamed to https://api2.transloadit.com/companion, please update your `serverUrl` options accordingly.");throw this.uppy.log(i),i}if(t.remote&&Da.test(t.remote.serverUrl)){var s=e.companion_url.replace(/\/$/,""),a=t.remote.url.replace(t.remote.serverUrl,"").replace(/^\//,"");o=Fa({},t.remote,{serverUrl:s,url:s+"/"+a})}var l=Fa({},t,{transloadit:{assembly:e.assembly_id}});return this.opts.importFromUploadURLs||Fa(l,{meta:n,tus:r,remote:o}),l},e.prototype._createAssembly=function(t,e,n){var r=this;return this.uppy.log("[Transloadit] create Assembly"),this.client.createAssembly({params:n.params,fields:n.fields,expectedFiles:t.length,signature:n.signature}).then(function(n){var o,i,s=new Is(n),a=s.status,l=r.getPluginState(),u=l.assemblies,p=l.uploadsAssemblies;r.setPluginState({assemblies:Fa({},u,(o={},o[a.assembly_id]=a,o)),uploadsAssemblies:Fa({},p,(i={},i[e]=[].concat(p[e],[a.assembly_id]),i))});var c=r.uppy.getState().files,h={};return t.forEach(function(t){h[t]=r._attachAssemblyMetadata(r.uppy.getFile(t),a)}),r.uppy.setState({files:Fa({},c,h)}),r.uppy.emit("transloadit:assembly-created",a,t),r._connectAssembly(s),r.uppy.log("[Transloadit] Created Assembly "+a.assembly_id),s}).catch(function(t){throw t.message=r.i18n("creatingAssemblyFailed")+": "+t.message,t})},e.prototype._shouldWaitAfterUpload=function(){return this.opts.waitForEncoding||this.opts.waitForMetadata},e.prototype._reserveFiles=function(t,e){var n=this;return Promise.all(e.map(function(e){var r=n.uppy.getFile(e);return n.client.reserveFile(t,r)}))},e.prototype._onFileUploadURLAvailable=function(t){var e=this;if(t&&t.transloadit&&t.transloadit.assembly){var n=this.getPluginState().assemblies[t.transloadit.assembly];this.client.addFile(n,t).catch(function(r){e.uppy.log(r),e.uppy.emit("transloadit:import-error",n,t.id,r)})}},e.prototype._findFile=function(t){for(var e=this.uppy.getFiles(),n=0;n<e.length;n++){var r=e[n];if(r.uploadURL===t.tus_upload_url)return r;if(r.tus&&r.tus.uploadUrl===t.tus_upload_url)return r;if(!t.is_tus_file&&r.name===t.name&&r.size===t.size)return r}},e.prototype._onFileUploadComplete=function(t,e){var n,r=this.getPluginState(),o=this._findFile(e);o?(this.setPluginState({files:Fa({},r.files,(n={},n[e.id]={assembly:t,id:o.id,uploadedFile:e},n))}),this.uppy.emit("transloadit:upload",e,this.getAssembly(t))):this.uppy.log("[Transloadit] Couldn\u2019t file the file, it was likely removed in the process")},e.prototype._onResult=function(t,e,n){var r=this.getPluginState(),o=r.files[n.original_id];n.localId=o?o.id:null;var i={result:n,stepName:e,id:n.id,assembly:t};this.setPluginState({results:[].concat(r.results,[i])}),this.uppy.emit("transloadit:result",e,n,this.getAssembly(t))},e.prototype._onAssemblyFinished=function(t){var e=this,n=t.assembly_ssl_url;this.client.getAssemblyStatus(n).then(function(t){var n,r=e.getPluginState();e.setPluginState({assemblies:Fa({},r.assemblies,(n={},n[t.assembly_id]=t,n))}),e.uppy.emit("transloadit:complete",t)})},e.prototype._getPersistentData=function(t){var e,n=this.getPluginState(),r=n.assemblies,o=n.uploadsAssemblies;t(((e={})[this.id]={assemblies:r,uploadsAssemblies:o},e))},e.prototype._onRestored=function(t){var e=this,n=t&&t[this.id]?t[this.id]:{},r=n.assemblies||{},o=n.uploadsAssemblies||{};0!==Object.keys(o).length&&(this.restored=Promise.resolve().then(function(){var t,n,i;return t=r,n={},i=[],Object.keys(t).forEach(function(r){var o=t[r];o.uploads.forEach(function(t){var o=e._findFile(t);n[t.id]={id:o.id,assembly:r,uploadedFile:t}});var s=e.getPluginState();Object.keys(o.results).forEach(function(t){o.results[t].forEach(function(e){var n=s.files[e.original_id];e.localId=n?n.id:null,i.push({id:e.id,result:e,stepName:t,assembly:r})})})}),e.setPluginState({assemblies:t,files:n,results:i,uploadsAssemblies:o}),function(){var t=e.getPluginState().assemblies;Object.keys(t).forEach(function(n){var r=new Is(t[n]);e._connectAssembly(r)})}(),function(){var t=e.getPluginState().assemblies;return Promise.all(Object.keys(t).map(function(t){return e.activeAssemblies[t].update()}))}()}),this.restored.then(function(){e.restored=null}))},e.prototype._connectAssembly=function(t){var e=this,n=t.status.assembly_id;return this.activeAssemblies[n]=t,t.on("status",function(t){var r,o=e.getPluginState().assemblies;e.setPluginState({assemblies:Fa({},o,(r={},r[n]=t,r))})}),t.on("upload",function(t){e._onFileUploadComplete(n,t)}),t.on("error",function(n){e.uppy.emit("transloadit:assembly-error",t.status,n)}),t.on("executing",function(){e.uppy.emit("transloadit:assembly-executing",t.status)}),this.opts.waitForEncoding&&t.on("result",function(t,r){e._onResult(n,t,r)}),this.opts.waitForEncoding?t.on("finished",function(){e._onAssemblyFinished(t.status)}):this.opts.waitForMetadata&&t.on("metadata",function(){e._onAssemblyFinished(t.status)}),"ASSEMBLY_COMPLETE"===t.ok?t:(new Promise(function(e,n){t.once("connect",e),t.once("status",e),t.once("error",n)}).then(function(){e.uppy.log("[Transloadit] Socket is ready")}),t.connect(),t)},e.prototype._prepareUpload=function(t,e){var n,r=this;(t=t.filter(function(t){return!t.error})).forEach(function(t){var e=r.uppy.getFile(t);r.uppy.emit("preprocess-progress",e,{mode:"indeterminate",message:r.i18n("creatingAssembly")})});var o=function(t){var n=t.fileIDs,o=t.options;return r._createAssembly(n,e,o).then(function(t){if(r.opts.importFromUploadURLs)return r._reserveFiles(t,n)}).then(function(){n.forEach(function(t){var e=r.uppy.getFile(t);r.uppy.emit("preprocess-complete",e)})}).catch(function(t){throw n.forEach(function(e){var n=r.uppy.getFile(e);r.uppy.emit("preprocess-complete",n),r.uppy.emit("upload-error",n,t)}),t})},i=this.getPluginState().uploadsAssemblies;this.setPluginState({uploadsAssemblies:Fa({},i,(n={},n[e]=[],n))});var s=t.map(function(t){return r.uppy.getFile(t)});return new js(s,this.opts).build().then(function(t){return Promise.all(t.map(o))},function(e){throw t.forEach(function(t){var n=r.uppy.getFile(t);r.uppy.emit("preprocess-complete",n),r.uppy.emit("upload-error",n,e)}),e})},e.prototype._afterUpload=function(t,e){var n=this;t=t.filter(function(t){return!t.error});var r=this.getPluginState();if(this.restored)return this.restored.then(function(){return n._afterUpload(t,e)});var o=r.uploadsAssemblies[e];if(!this._shouldWaitAfterUpload()){o.forEach(function(t){n.activeAssemblies[t].close(),delete n.activeAssemblies[t]});var i=o.map(function(t){return n.getAssembly(t)});return this.uppy.addResultData(e,{transloadit:i}),Promise.resolve()}if(0===o.length)return this.uppy.addResultData(e,{transloadit:[]}),Promise.resolve();var s=new Ls(this.uppy,o);return t.forEach(function(t){var e=n.uppy.getFile(t);n.uppy.emit("postprocess-progress",e,{mode:"indeterminate",message:n.i18n("encoding")})}),s.on("assembly-complete",function(t){n.getAssemblyFiles(t).forEach(function(t){n.uppy.emit("postprocess-complete",t)})}),s.on("assembly-error",function(t,e){n.getAssemblyFiles(t).forEach(function(t){n.uppy.emit("upload-error",t,e),n.uppy.emit("postprocess-complete",t)})}),s.promise.then(function(){var t=o.map(function(t){return n.getAssembly(t)}),r=n.getPluginState(),i=Fa({},r.uploadsAssemblies);delete i[e],n.setPluginState({uploadsAssemblies:i}),n.uppy.addResultData(e,{transloadit:t})})},e.prototype._handleError=function(t,e){var n=this;this.uppy.log("[Transloadit] _handleError in upload "+e),this.uppy.log(t),this.getPluginState().uploadsAssemblies[e].forEach(function(t){n.activeAssemblies[t]&&n.activeAssemblies[t].close()})},e.prototype.install=function(){this.uppy.addPreProcessor(this._prepareUpload),this.uppy.addPostProcessor(this._afterUpload),this.uppy.on("error",this._handleError),this.opts.importFromUploadURLs?this.uppy.on("upload-success",this._onFileUploadURLAvailable):this.uppy.use(Oa,{resume:!1,useFastRemoteRetry:!1,metaFields:["assembly_url","filename","fieldname"]}),this.uppy.on("restore:get-data",this._getPersistentData),this.uppy.on("restored",this._onRestored),this.setPluginState({assemblies:{},uploadsAssemblies:{},files:{},results:[]})},e.prototype.uninstall=function(){this.uppy.removePreProcessor(this._prepareUpload),this.uppy.removePostProcessor(this._afterUpload),this.uppy.off("error",this._handleError),this.opts.importFromUploadURLs&&this.uppy.off("upload-success",this._onFileUploadURLAvailable)},e.prototype.getAssembly=function(t){return this.getPluginState().assemblies[t]},e.prototype.getAssemblyFiles=function(t){return this.uppy.getFiles().filter(function(e){return e&&e.transloadit&&e.transloadit.assembly===t})},e}(Y.Plugin)).COMPANION=xa,Ua.UPPY_SERVER=xa;var Ia=A.h,Ba=function(t){function e(n){!function(t,n){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this);var r=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.call(this,n));return r.handleKeyPress=r.handleKeyPress.bind(r),r.handleClick=r.handleClick.bind(r),r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.componentDidMount=function(){var t=this;this.input.value="",setTimeout(function(){t.input&&t.input.focus({preventScroll:!0})},150)},e.prototype.handleKeyPress=function(t){13===t.keyCode&&this.props.addFile(this.input.value)},e.prototype.handleClick=function(){this.props.addFile(this.input.value)},e.prototype.render=function(){var t=this;return Ia("div",{class:"uppy-Url"},Ia("input",{class:"uppy-c-textInput uppy-Url-input",type:"text",placeholder:this.props.i18n("enterUrlToImport"),onkeyup:this.handleKeyPress,ref:function(e){t.input=e}}),Ia("button",{class:"uppy-u-reset uppy-c-btn uppy-c-btn-primary uppy-Url-importButton",type:"button","aria-label":this.props.i18n("import"),onclick:this.handleClick},this.props.i18n("import")))},e}(A.Component),ja=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},La=Y.Plugin,Ma=A.h,Na=d.RequestClient,za=function(t){function e(n,r){!function(t,n){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this);var o=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.call(this,n,r));o.id=o.opts.id||"Url",o.title=o.opts.title||"Link",o.type="acquirer",o.icon=function(){return Ma("svg",{"aria-hidden":"true",width:"23",height:"23",viewBox:"0 0 23 23",xmlns:"http://www.w3.org/2000/svg"},Ma("path",{d:"M20.485 11.236l-2.748 2.737c-.184.182-.367.365-.642.547-1.007.73-2.107 1.095-3.298 1.095-1.65 0-3.298-.73-4.398-2.19-.275-.365-.183-1.003.183-1.277.367-.273 1.008-.182 1.283.183 1.191 1.642 3.482 1.915 5.13.73a.714.714 0 0 0 .367-.365l2.75-2.737c1.373-1.46 1.373-3.74-.093-5.108a3.72 3.72 0 0 0-5.13 0L12.33 6.4a.888.888 0 0 1-1.283 0 .88.88 0 0 1 0-1.277l1.558-1.55a5.38 5.38 0 0 1 7.605 0c2.29 2.006 2.382 5.564.274 7.662zm-8.979 6.294L9.95 19.081a3.72 3.72 0 0 1-5.13 0c-1.467-1.368-1.467-3.74-.093-5.108l2.75-2.737.366-.365c.824-.547 1.74-.82 2.748-.73 1.008.183 1.833.639 2.382 1.46.275.365.917.456 1.283.182.367-.273.458-.912.183-1.277-.916-1.186-2.199-1.915-3.573-2.098-1.374-.273-2.84.091-4.031 1.004l-.55.547-2.749 2.737c-2.107 2.189-2.015 5.655.092 7.753C4.727 21.453 6.101 22 7.475 22c1.374 0 2.749-.547 3.848-1.55l1.558-1.551a.88.88 0 0 0 0-1.278c-.367-.364-1.008-.456-1.375-.09z",fill:"#FF814F","fill-rule":"nonzero"}))};var i={strings:{import:"Import",enterUrlToImport:"Enter URL to import a file",failedToFetch:"Companion failed to fetch this URL, please make sure it\u2019s correct",enterCorrectUrl:"Incorrect URL: Please make sure you are entering a direct link to a file"}},s={locale:i};if(o.opts=ja({},s,r),o.locale=ja({},i,o.opts.locale),o.locale.strings=ja({},i.strings,o.opts.locale.strings),o.translator=new H({locale:o.locale}),o.i18n=o.translator.translate.bind(o.translator),o.hostname=o.opts.serverUrl,!o.hostname)throw new Error("Companion hostname is required, please consult https://uppy.io/docs/companion");return o.getMeta=o.getMeta.bind(o),o.addFile=o.addFile.bind(o),o.handleDrop=o.handleDrop.bind(o),o.handleDragOver=o.handleDragOver.bind(o),o.handleDragLeave=o.handleDragLeave.bind(o),o.handlePaste=o.handlePaste.bind(o),o.client=new Na(n,{serverUrl:o.opts.serverUrl,serverHeaders:o.opts.serverHeaders}),o}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.getFileNameFromUrl=function(t){return t.substring(t.lastIndexOf("/")+1)},e.prototype.checkIfCorrectURL=function(t){if(!t)return!1;var e=t.match(/^([a-z0-9]+):\/\//)[1];return"http"===e||"https"===e},e.prototype.addProtocolToURL=function(t){return/^[a-z0-9]+:\/\//.test(t)?t:"http://"+t},e.prototype.getMeta=function(t){var e=this;return this.client.post("url/meta",{url:t}).then(function(t){if(t.error)throw e.uppy.log("[URL] Error:"),e.uppy.log(t.error),new Error("Failed to fetch the file");return t})},e.prototype.addFile=function(t){var e=this;return t=this.addProtocolToURL(t),this.checkIfCorrectURL(t)?this.getMeta(t).then(function(n){return{source:e.id,name:e.getFileNameFromUrl(t),type:n.type,data:{size:n.size},isRemote:!0,body:{url:t},remote:{serverUrl:e.opts.serverUrl,url:e.hostname+"/url/get",body:{fileId:t,url:t},providerOptions:e.client.opts}}}).then(function(t){e.uppy.log("[Url] Adding remote file");try{e.uppy.addFile(t)}catch(t){}}).then(function(){}).catch(function(t){e.uppy.log(t),e.uppy.info({message:e.i18n("failedToFetch"),details:t},"error",4e3)}):(this.uppy.log("[URL] Incorrect URL entered: "+t),void this.uppy.info(this.i18n("enterCorrectUrl"),"error",4e3))},e.prototype.handleDrop=function(t){var e=this;t.preventDefault(),t.dataTransfer.items&&gn(t.dataTransfer.items).forEach(function(t){"string"===t.kind&&"text/uri-list"===t.type&&t.getAsString(function(t){e.uppy.log("[URL] Adding file from dropped url: "+t),e.addFile(t)})})},e.prototype.handleDragOver=function(t){t.preventDefault(),this.el.classList.add("drag")},e.prototype.handleDragLeave=function(t){t.preventDefault(),this.el.classList.remove("drag")},e.prototype.handlePaste=function(t){var e=this;if(t.clipboardData.items){var n=gn(t.clipboardData.items);n.filter(function(t){return"file"===t.kind}).length>0||n.forEach(function(t){"string"===t.kind&&"text/plain"===t.type&&t.getAsString(function(t){e.uppy.log("[URL] Adding file from pasted url: "+t),e.addFile(t)})})}},e.prototype.render=function(t){return Ma(Ba,{i18n:this.i18n,addFile:this.addFile})},e.prototype.onMount=function(){this.el&&(this.el.addEventListener("drop",this.handleDrop),this.el.addEventListener("dragover",this.handleDragOver),this.el.addEventListener("dragleave",this.handleDragLeave),this.el.addEventListener("paste",this.handlePaste))},e.prototype.install=function(){var t=this.opts.target;t&&this.mount(t,this)},e.prototype.uninstall=function(){this.el&&(this.el.removeEventListener("drop",this.handleDrop),this.el.removeEventListener("dragover",this.handleDragOver),this.el.removeEventListener("dragleave",this.handleDragLeave),this.el.removeEventListener("paste",this.handlePaste)),this.unmount()},e}(La),qa={"video/ogg":"ogv","audio/ogg":"ogg","video/webm":"webm","audio/webm":"webm","video/mp4":"mp4","audio/mp3":"mp3"},Ha=A.h,Wa=function(t){return Ha("svg",{"aria-hidden":"true",fill:"#0097DC",width:"66",height:"55",viewBox:"0 0 66 55",xmlns:"http://www.w3.org/2000/svg"},Ha("path",{d:"M57.3 8.433c4.59 0 8.1 3.51 8.1 8.1v29.7c0 4.59-3.51 8.1-8.1 8.1H8.7c-4.59 0-8.1-3.51-8.1-8.1v-29.7c0-4.59 3.51-8.1 8.1-8.1h9.45l4.59-7.02c.54-.54 1.35-1.08 2.16-1.08h16.2c.81 0 1.62.54 2.16 1.08l4.59 7.02h9.45zM33 14.64c-8.62 0-15.393 6.773-15.393 15.393 0 8.62 6.773 15.393 15.393 15.393 8.62 0 15.393-6.773 15.393-15.393 0-8.62-6.773-15.393-15.393-15.393zM33 40c-5.648 0-9.966-4.319-9.966-9.967 0-5.647 4.318-9.966 9.966-9.966s9.966 4.319 9.966 9.966C42.966 35.681 38.648 40 33 40z","fill-rule":"evenodd"}))},Xa=A.h,Va=A.h,Ga=A.h;function Ka(t,e){return-1!==t.indexOf(e)}var Ya=function(t){function e(){return function(t,n){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this),function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.apply(this,arguments))}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.componentDidMount=function(){this.props.onFocus(),this.btnContainer.firstChild.focus()},e.prototype.componentWillUnmount=function(){this.props.onStop()},e.prototype.render=function(){var t,e,n,r=this,o=this.props.supportsRecording&&(Ka(this.props.modes,"video-only")||Ka(this.props.modes,"audio-only")||Ka(this.props.modes,"video-audio")),i=Ka(this.props.modes,"picture");return Ga("div",{class:"uppy uppy-Webcam-container"},Ga("div",{class:"uppy-Webcam-videoContainer"},Ga("video",{class:"uppy-Webcam-video "+(this.props.mirror?"uppy-Webcam-video--mirrored":""),autoplay:!0,muted:!0,playsinline:!0,srcObject:this.props.src||""})),Ga("div",{class:"uppy-Webcam-buttonContainer",ref:function(t){r.btnContainer=t}},i?(t=this.props,e=t.onSnapshot,n=t.i18n,Va("button",{class:"uppy-u-reset uppy-c-btn uppy-Webcam-button uppy-Webcam-button--picture",type:"button",title:n("takePicture"),"aria-label":n("takePicture"),onclick:e},Wa())):null," ",o?function(t){var e=t.recording,n=t.onStartRecording,r=t.onStopRecording,o=t.i18n;return console.log("is recording",e),e?Xa("button",{class:"uppy-u-reset uppy-c-btn uppy-Webcam-button uppy-Webcam-button--video",type:"button",title:o("stopRecording"),"aria-label":o("stopRecording"),onclick:r},Xa("svg",{"aria-hidden":"true",class:"UppyIcon",width:"100",height:"100",viewBox:"0 0 100 100"},Xa("rect",{x:"15",y:"15",width:"70",height:"70"}))):Xa("button",{class:"uppy-u-reset uppy-c-btn uppy-Webcam-button uppy-Webcam-button--video",type:"button",title:o("startRecording"),"aria-label":o("startRecording"),onclick:n},Xa("svg",{"aria-hidden":"true",class:"UppyIcon",width:"100",height:"100",viewBox:"0 0 100 100"},Xa("circle",{cx:"50",cy:"50",r:"40"})))}(this.props):null))},e}(A.Component),Ja=A.h,$a=function(t){return Ja("div",{class:"uppy-Webcam-permissons"},Ja("div",{class:"uppy-Webcam-permissonsIcon"},t.icon()),Ja("h1",{class:"uppy-Webcam-title"},t.i18n("allowAccessTitle")),Ja("p",null,t.i18n("allowAccessDescription")))},Qa="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Za=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},tl=A.h,el=function(t){function e(n,r){!function(t,n){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this);var o=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.call(this,n,r));o.mediaDevices=function(){if(navigator.mediaDevices&&navigator.mediaDevices.getUserMedia)return navigator.mediaDevices;var t=navigator.mozGetUserMedia||navigator.webkitGetUserMedia;return t?{getUserMedia:function(e){return new Promise(function(n,r){t.call(navigator,e,n,r)})}}:null}(),o.supportsUserMedia=!!o.mediaDevices,o.protocol=location.protocol.match(/https/i)?"https":"http",o.id=o.opts.id||"Webcam",o.title=o.opts.title||"Camera",o.type="acquirer",o.icon=Wa;var i={strings:{smile:"Smile!",takePicture:"Take a picture",startRecording:"Begin video recording",stopRecording:"Stop video recording",allowAccessTitle:"Please allow access to your camera",allowAccessDescription:"In order to take pictures or record video with your camera, please allow camera access for this site."}},s={onBeforeSnapshot:function(){return Promise.resolve()},countdown:!1,locale:i,modes:["video-audio","video-only","audio-only","picture"],mirror:!0,facingMode:"user"};return o.opts=Za({},s,r),o.locale=Za({},i,o.opts.locale),o.locale.strings=Za({},i.strings,o.opts.locale.strings),o.translator=new H({locale:o.locale}),o.i18n=o.translator.translate.bind(o.translator),o.install=o.install.bind(o),o.setPluginState=o.setPluginState.bind(o),o.render=o.render.bind(o),o.start=o.start.bind(o),o.stop=o.stop.bind(o),o.takeSnapshot=o.takeSnapshot.bind(o),o.startRecording=o.startRecording.bind(o),o.stopRecording=o.stopRecording.bind(o),o.oneTwoThreeSmile=o.oneTwoThreeSmile.bind(o),o.focus=o.focus.bind(o),o.webcamActive=!1,o.opts.countdown&&(o.opts.onBeforeSnapshot=o.oneTwoThreeSmile),o}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.isSupported=function(){return!!this.mediaDevices},e.prototype.getConstraints=function(){return{audio:-1!==this.opts.modes.indexOf("video-audio")||-1!==this.opts.modes.indexOf("audio-only"),video:!(-1===this.opts.modes.indexOf("video-audio")&&-1===this.opts.modes.indexOf("video-only")&&-1===this.opts.modes.indexOf("picture"))&&{facingMode:this.opts.facingMode}}},e.prototype.start=function(){var t=this;if(!this.isSupported())return Promise.reject(new Error("Webcam access not supported"));this.webcamActive=!0;var e=this.getConstraints();return this.mediaDevices.getUserMedia(e).then(function(e){t.stream=e,t.setPluginState({cameraReady:!0})}).catch(function(e){t.setPluginState({cameraError:e})})},e.prototype.startRecording=function(){var t=this;this.recorder=new MediaRecorder(this.stream),this.recordingChunks=[],this.recorder.addEventListener("dataavailable",function(e){t.recordingChunks.push(e.data)}),this.recorder.start(),this.setPluginState({isRecording:!0})},e.prototype.stopRecording=function(){var t=this;return new Promise(function(e,n){t.recorder.addEventListener("stop",function(){e()}),t.recorder.stop()}).then(function(){return t.setPluginState({isRecording:!1}),t.getVideo()}).then(function(e){try{t.uppy.addFile(e)}catch(t){}}).then(function(){t.recordingChunks=null,t.recorder=null},function(e){throw t.recordingChunks=null,t.recorder=null,e})},e.prototype.stop=function(){this.stream.getAudioTracks().forEach(function(t){t.stop()}),this.stream.getVideoTracks().forEach(function(t){t.stop()}),this.webcamActive=!1,this.stream=null},e.prototype.getVideoElement=function(){return this.el.querySelector(".uppy-Webcam-video")},e.prototype.oneTwoThreeSmile=function(){var t=this;return new Promise(function(e,n){var r=t.opts.countdown,o=setInterval(function(){if(!t.webcamActive)return clearInterval(o),t.captureInProgress=!1,n(new Error("Webcam is not active"));r>0?(t.uppy.info(r+"...","warning",800),r--):(clearInterval(o),t.uppy.info(t.i18n("smile"),"success",1500),setTimeout(function(){return e()},1500))},1e3)})},e.prototype.takeSnapshot=function(){var t=this;this.captureInProgress||(this.captureInProgress=!0,this.opts.onBeforeSnapshot().catch(function(e){var n="object"===(void 0===e?"undefined":Qa(e))?e.message:e;return t.uppy.info(n,"error",5e3),Promise.reject(new Error("onBeforeSnapshot: "+n))}).then(function(){return t.getImage()}).then(function(e){t.captureInProgress=!1;try{t.uppy.addFile(e)}catch(t){}},function(e){throw t.captureInProgress=!1,e}))},e.prototype.getImage=function(){var t=this,e=this.getVideoElement();if(!e)return Promise.reject(new Error("No video element found, likely due to the Webcam tab being closed."));var n="webcam-"+Date.now()+".jpg",r=e.videoWidth,o=e.videoHeight,i=document.createElement("canvas");return i.width=r,i.height=o,i.getContext("2d").drawImage(e,0,0),function(t,e,n){return t.toBlob?new Promise(function(r){t.toBlob(r,e,n)}):Promise.resolve().then(function(){return pn(t.toDataURL(e,n),{})})}(i,"image/jpeg").then(function(e){return{source:t.id,name:n,data:new Blob([e],{type:"image/jpeg"}),type:"image/jpeg"}})},e.prototype.getVideo=function(){var t=this.recordingChunks[0].type,e=function(t){return qa[t]||null}(t);if(!e)return Promise.reject(new Error('Could not retrieve recording: Unsupported media type "'+t+'"'));var n="webcam-"+Date.now()+"."+e,r=new Blob(this.recordingChunks,{type:t}),o={source:this.id,name:n,data:new Blob([r],{type:t}),type:t};return Promise.resolve(o)},e.prototype.focus=function(){var t=this;this.opts.countdown||setTimeout(function(){t.uppy.info(t.i18n("smile"),"success",1500)},1e3)},e.prototype.render=function(t){this.webcamActive||this.start();var e=this.getPluginState();return e.cameraReady?tl(Ya,Za({},e,{onSnapshot:this.takeSnapshot,onStartRecording:this.startRecording,onStopRecording:this.stopRecording,onFocus:this.focus,onStop:this.stop,i18n:this.i18n,modes:this.opts.modes,supportsRecording:"function"==typeof MediaRecorder&&!!MediaRecorder.prototype&&"function"==typeof MediaRecorder.prototype.start,recording:e.isRecording,mirror:this.opts.mirror,src:this.stream})):tl($a,{icon:Wa,i18n:this.i18n})},e.prototype.install=function(){this.setPluginState({cameraReady:!1});var t=this.opts.target;t&&this.mount(t,this)},e.prototype.uninstall=function(){this.stream&&this.stop(),this.unmount()},e}(Y.Plugin),nl={};return nl.Core=Y,nl.server=d,nl.views={ProviderView:Qn},nl.DefaultStore=z,nl.ReduxStore=Nr,nl.Dashboard=_n,nl.DragDrop=Cn,nl.FileInput=sr,nl.Informer=qe,nl.ProgressBar=ro,nl.StatusBar=un,nl.Dropbox=nr,nl.GoogleDrive=Kr,nl.Instagram=Zr,nl.Url=za,nl.Webcam=el,nl.AwsS3=kt,nl.AwsS3Multipart=ct,nl.Transloadit=Ua,nl.Tus=Oa,nl.XHRUpload=vt,nl.Form=wr,nl.GoldenRetriever=qr,nl.ReduxDevTools=io,nl.ThumbnailGenerator=dn,nl});
//# sourceMappingURL=uppy.min.js.map 15.03.2019
uppy 8.x-1.x-dev ::
js/uppy_integration.js
function uppySendTusComplete (resp, fidTarget) {
var uploadKey = resp.url.split('/').slice(-1).pop();
var ajax_settings = {
type: 'POST',
contentType: 'application/json;charset=utf-8',
dataType: 'json',
processData: false, 28.05.2020
usfedgov_google_analytics 8.x-1.2 ::
js/8.0.0/Universal-Federated-Analytics.js
function createTracker(a) {
var m, n, o = /^\/.*$/i;
try { m = ((oCONFIG.USE_CUSTOM_URL && o.test(custom_dap_data.url)) ? location.protocol + "//" + location.hostname + custom_dap_data.url.replace(location.protocol + "//" + location.hostname, "") : document.location.href); n = ((oCONFIG.USE_CUSTOM_TITLE) ? custom_dap_data.title : document.title); } catch (error) { m = document.location.href; n = document.title; }
var c = m.split(document.location.hostname)[1];
-1 !== document.title.search(/404|not found/i) &&
(c = ("/vpv404/" + c).replace(/\/\//g, "/") + ((document.referrer) ? "/" + document.referrer : document.referrer));
var p = ((-1 !== document.title.search(/404|not found/ig))? document.location.protocol + "//" + document.location.hostname + c : m);
var ur = _URIHandler(_scrubbedURL(p));
var r = {}; 28.05.2020
usfedgov_google_analytics 8.x-1.2 ::
js/8.0.0/Universal-Federated-Analytics-Min.js
event_action:c,event_label:void 0===f?"":f,event_value:void 0===g||""===g||isNaN(g)?0:parseInt(g),non_interaction:a})}catch(k){}else-1==b.toLowerCase().indexOf("dimension")&&b.toLowerCase().indexOf("metric")}function _sendViewSearchResult(a){_sendEvent("view_search_results",a);isSearch=!1}
function _isExcludedReferrer(){if(""!==document.referrer){var a=document.referrer.replace(/https?:\/\//i,"").split("/")[0].replace(/^www\./i,"");return oCONFIG.SUBDOMAIN_BASED?-1!=a.indexOf(oCONFIG.COOKIE_DOMAIN)?!0:!1:a===oCONFIG.COOKIE_DOMAIN?!0:!1}}
function createTracker(a){a=/^\/.*$/i;try{var b=oCONFIG.USE_CUSTOM_URL&&a.test(custom_dap_data.url)?location.protocol+"//"+location.hostname+custom_dap_data.url.replace(location.protocol+"//"+location.hostname,""):document.location.href;var d=oCONFIG.USE_CUSTOM_TITLE?custom_dap_data.title:document.title}catch(f){b=document.location.href,d=document.title}a=b.split(document.location.hostname)[1];-1!==document.title.search(/404|not found/i)&&(a=("/vpv404/"+a).replace(/\/\//g,"/")+(document.referrer?
"/"+document.referrer:document.referrer));b=-1!==document.title.search(/404|not found/ig)?document.location.protocol+"//"+document.location.hostname+a:b;b=_URIHandler(_scrubbedURL(b));for(a=0;a<oCONFIG.GWT_GA4ID.length;a++){if(0===a){var c={};c=(c.groups=oCONFIG.GA4_NAME+a,c.cookie_expires=parseInt(oCONFIG.COOKIE_TIMEOUT),c.page_location=b,c.page_title=d,c[oCONFIG.MAIN_AGENCY_DIMENSION]=oCONFIG.AGENCY.toUpperCase(),c[oCONFIG.MAIN_SUBAGENCY_DIMENSION]=oCONFIG.SUB_AGENCY.toUpperCase(),c[oCONFIG.MAIN_SITE_TOPIC_DIMENSION]=
oCONFIG.SITE_TOPIC.toLowerCase(),c[oCONFIG.MAIN_SITE_PLATFORM_DIMENSION]=oCONFIG.SITE_PLATFORM.toLowerCase(),c[oCONFIG.MAIN_SCRIPT_SOURCE_URL_DIMENSION]=oCONFIG.SCRIPT_SOURCE.toLowerCase(),c[oCONFIG.MAIN_CODEVERSION_DIMENSION]=oCONFIG.VERSION.toLowerCase(),c[oCONFIG.MAIN_URL_PROTOCOL_DIMENSION]=oCONFIG.URL_PROTOCOL.toLowerCase(),c[oCONFIG.MAIN_USING_PARALLEL_DIMENSION]=oCONFIG.USING_PARALLEL_TRACKER.toLowerCase(),c)}else 0<a&&oCONFIG.USE_PARALLEL_CUSTOM_DIMENSIONS?(c={},c=(c.groups=oCONFIG.GA4_NAME+
a,c.cookie_expires=parseInt(oCONFIG.COOKIE_TIMEOUT),c.page_location=b,c.page_title=d,c[oCONFIG.PARALLEL_AGENCY_DIMENSION]=oCONFIG.AGENCY.toUpperCase(),c[oCONFIG.PARALLEL_SUBAGENCY_DIMENSION]=oCONFIG.SUB_AGENCY.toUpperCase(),c[oCONFIG.PARALLEL_SITE_TOPIC_DIMENSION]=oCONFIG.SITE_TOPIC.toLowerCase(),c[oCONFIG.PARALLEL_SITE_PLATFORM_DIMENSION]=oCONFIG.SITE_PLATFORM.toLowerCase(),c[oCONFIG.PARALLEL_SCRIPT_SOURCE_URL_DIMENSION]=oCONFIG.SCRIPT_SOURCE.toLowerCase(),c[oCONFIG.PARALLEL_CODEVERSION_DIMENSION]=
oCONFIG.VERSION.toLowerCase(),c[oCONFIG.PARALLEL_URL_PROTOCOL_DIMENSION]=oCONFIG.URL_PROTOCOL.toLowerCase(),c[oCONFIG.PARALLEL_USING_PARALLEL_DIMENSION]=oCONFIG.USING_PARALLEL_TRACKER.toLowerCase(),c)):c={groups:oCONFIG.GA4_NAME+a,cookie_expires:parseInt(oCONFIG.COOKIE_TIMEOUT),page_location:b,page_title:d};document.referrer&&-1!==document.referrer.search(location.hostname)?c.page_referrer=_scrubbedURL(document.referrer):document.referrer;c=_piiRedactor(_objToQuery(c),"default");c=_queryToJSON(c);
c=_unflattenJSON(c);gtag("config",oCONFIG.GWT_GA4ID[a],c)}isSearch?_sendViewSearchResult({search_term:isSearch}):""}
function _initAutoTracker(){var a=function(a){a=a.href.toLowerCase().replace(/[#?&].*/,"").split(a.hostname)[1].split(".");a=a[a.length-1];return null!=a.match(new RegExp("^("+oCONFIG.EXTS+")$"))?a:!1},b=function(a){try{var b=JSON.stringify(a);return JSON.parse(b.toLowerCase())}catch(g){}},d=function(c){try{if("mousedown"===c.type||"keydown"===c.type&&13===c.keyCode)if("A"===c.target.nodeName||null!==c.target.closest("a")){var d=oCONFIG.COOKIE_DOMAIN,g="",h="",k="",l=/^mailto:[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}/i, 28.05.2020
usfedgov_google_analytics 8.x-1.2 ::
js/8.6.0/Universal-Federated-Analytics.js
function createTracker(a) {
var m, n, o = /^\/.*$/i;
try { m = ((oCONFIG.USE_CUSTOM_URL && o.test(custom_dap_data.url)) ? location.protocol + "//" + location.hostname + custom_dap_data.url.replace(location.protocol + "//" + location.hostname, "") : document.location.href); n = ((oCONFIG.USE_CUSTOM_TITLE) ? custom_dap_data.title : document.title); } catch (error) { m = document.location.href; n = document.title; }
var c = m.split(document.location.hostname)[1];
-1 !== document.title.search(/404|not found/i) &&
(c = ("/vpv404/" + c).replace(/\/\//g, "/") + ((document.referrer) ? "/" + document.referrer : document.referrer));
var p = ((-1 !== document.title.search(/404|not found/ig)) ? document.location.protocol + "//" + document.location.hostname + c : m);
var ur = _URIHandler(_scrubbedURL(p));
var r = {}; 28.05.2020
usfedgov_google_analytics 8.x-1.2 ::
js/8.6.0/Universal-Federated-Analytics-Min.js
d.SITE_PLATFORM=d.SITE_PLATFORM||"unspecified:"+d.COOKIE_DOMAIN;(function(){var a={"default":"utm_id utm_source utm_medium utm_campaign utm_term utm_content utm_source_platform utm_creative_format utm_marketing_tactic gbraid wbraid _gl gclid dclid gclsrc affiliate dap-dev-env v lat lon".split(" "),gsa:["challenge","state"],dhs:["appreceiptnum"],doc:"station meas start atlc epac cpac basin fdays cone tswind120 gm_track 50wind120 hwind120 mltoa34 swath radii wsurge key_messages inundation rainqpf ero gage wfo spanish_key_messages key_messages sid lan office pil product product1 site issuedby wwa".split(" "),
hhs:["s_cid","selectedfacets"],hud:["postid"],nasa:["feature","productid","selectedfacets","topic","titleid"],nps:["gid","mapid","site","webcam","id"],nsf:"meas start atlc epac cpac basin fdays cone tswind120 gm_track 50wind120 hwind120 mltoa34 swath radii wsurge key_messages inundation rainqpf ero gage wfo spanish_key_messages key_messages sid".split(" "),va:["id"],dod:["p"],opm:"l soc jt j rmi smin hp g d a".split(" ")};J=a.default.concat(a[d.AGENCY.toLowerCase()]).concat(d.SEARCH_PARAMS.toLowerCase().split("|"))})();
(function(a){a=/^\/.*$/i;try{var b=d.USE_CUSTOM_URL&&a.test(custom_dap_data.url)?location.protocol+"//"+location.hostname+custom_dap_data.url.replace(location.protocol+"//"+location.hostname,""):document.location.href;var c=d.USE_CUSTOM_TITLE?custom_dap_data.title:document.title}catch(h){b=document.location.href,c=document.title}a=b.split(document.location.hostname)[1];-1!==document.title.search(/404|not found/i)&&(a=("/vpv404/"+a).replace(/\/\//g,"/")+(document.referrer?"/"+document.referrer:document.referrer));
b=-1!==document.title.search(/404|not found/ig)?document.location.protocol+"//"+document.location.hostname+a:b;b=K(C(b));for(a=0;a<d.GWT_GA4ID.length;a++){if(0===a){var e={groups:d.GA4_NAME+a,cookie_expires:parseInt(d.COOKIE_TIMEOUT),page_location:b,page_title:c,[d.MAIN_AGENCY_DIMENSION]:d.AGENCY.toUpperCase(),[d.MAIN_SUBAGENCY_DIMENSION]:d.SUB_AGENCY.toUpperCase(),[d.MAIN_SITE_TOPIC_DIMENSION]:d.SITE_TOPIC.toLowerCase(),[d.MAIN_SITE_PLATFORM_DIMENSION]:d.SITE_PLATFORM.toLowerCase(),[d.MAIN_SCRIPT_SOURCE_URL_DIMENSION]:d.SCRIPT_SOURCE.toLowerCase(),
[d.MAIN_CODEVERSION_DIMENSION]:d.VERSION.toLowerCase(),[d.MAIN_URL_PROTOCOL_DIMENSION]:d.URL_PROTOCOL.toLowerCase(),[d.MAIN_USING_PARALLEL_DIMENSION]:d.USING_PARALLEL_TRACKER.toLowerCase(),[d.MAIN_HOSTNAME_DIMENSION]:d.HOSTNAME.toLowerCase()};document.referrer&&-1!==document.referrer.search(location.hostname)?e.page_referrer=C(document.referrer):e.page_referrer=document.referrer;e=z(F(e),"default")}else e=0<a&&d.USE_PARALLEL_CUSTOM_DIMENSIONS?{groups:d.GA4_NAME+a,cookie_expires:parseInt(d.COOKIE_TIMEOUT),
page_location:b,page_title:c,[d.PARALLEL_AGENCY_DIMENSION]:d.AGENCY.toUpperCase(),[d.PARALLEL_SUBAGENCY_DIMENSION]:d.SUB_AGENCY.toUpperCase(),[d.PARALLEL_SITE_TOPIC_DIMENSION]:d.SITE_TOPIC.toLowerCase(),[d.PARALLEL_SITE_PLATFORM_DIMENSION]:d.SITE_PLATFORM.toLowerCase(),[d.PARALLEL_SCRIPT_SOURCE_URL_DIMENSION]:d.SCRIPT_SOURCE.toLowerCase(),[d.PARALLEL_CODEVERSION_DIMENSION]:d.VERSION.toLowerCase(),[d.PARALLEL_URL_PROTOCOL_DIMENSION]:d.URL_PROTOCOL.toLowerCase(),[d.PARALLEL_USING_PARALLEL_DIMENSION]:d.USING_PARALLEL_TRACKER.toLowerCase(),
[d.PARALLEL_HOSTNAME_DIMENSION]:d.HOSTNAME.toLowerCase()}:{groups:d.GA4_NAME+a,cookie_expires:parseInt(d.COOKIE_TIMEOUT),page_location:b,page_title:c},document.referrer&&-1!==document.referrer.search(location.hostname)?e.page_referrer=C(document.referrer):e.page_referrer=document.referrer,e=z(F(e),"default");e=N(e);e=O(e);E("config",d.GWT_GA4ID[a],e)}x?H({search_term:x}):""})();var R=1;if(d.YOUTUBE){G=document.createElement("script");G.src="https://www.youtube.com/iframe_api";A=document.getElementsByTagName("script")[0];
A.parentNode.insertBefore(G,A);var D=[],p=[],u=[],B=d.YT_MILESTONE,L=[];onYouTubeIframeAPIReady=function(){for(var a=0;a<D.length;a++)p[a]=new YT.Player(D[a],{events:{onReady:onPlayerReady,onStateChange:onPlayerStateChange,onError:onPlayerError}})};onPlayerReady=function(a){};onPlayerError=function(a){r("video_error",{videotitle:void 0!==a.target.playerInfo?a.target.playerInfo.videoData.title:a.target.getVideoData().title})};onPlayerStateChange=function(a){try{for(var b=0,c=void 0!==a.target.playerInfo?
a.target.playerInfo.videoData.video_id:a.target.getVideoData().video_id,e=0;e<D.length;e++)D[e]==c&&(b=e);var h=void 0!==p[b].playerInfo?Math.round(p[b].playerInfo.currentTime):Math.round(p[b].getCurrentTime()),m=void 0!==p[b].playerInfo?Math.round(p[b].playerInfo.duration):Math.round(p[b].getDuration()),g={video_current_time:h,video_duration:m,video_percent:(h/m*100).toFixed(),video_provider:"youtube",video_title:void 0!==p[b].playerInfo?p[b].playerInfo.videoData.title:p[b].getVideoData().title, 28.05.2020
usfedgov_google_analytics 8.x-1.2 ::
js/8.5.0/Universal-Federated-Analytics.js
function createTracker(a) {
var m, n, o = /^\/.*$/i;
try { m = ((oCONFIG.USE_CUSTOM_URL && o.test(custom_dap_data.url)) ? location.protocol + "//" + location.hostname + custom_dap_data.url.replace(location.protocol + "//" + location.hostname, "") : document.location.href); n = ((oCONFIG.USE_CUSTOM_TITLE) ? custom_dap_data.title : document.title); } catch (error) { m = document.location.href; n = document.title; }
var c = m.split(document.location.hostname)[1];
-1 !== document.title.search(/404|not found/i) &&
(c = ("/vpv404/" + c).replace(/\/\//g, "/") + ((document.referrer) ? "/" + document.referrer : document.referrer));
var p = ((-1 !== document.title.search(/404|not found/ig)) ? document.location.protocol + "//" + document.location.hostname + c : m);
var ur = _URIHandler(_scrubbedURL(p));
var r = {}; 28.05.2020
usfedgov_google_analytics 8.x-1.2 ::
js/8.5.0/Universal-Federated-Analytics-Min.js
d.SUBDOMAIN_BASED=!0):(d.COOKIE_DOMAIN=location.hostname.toLowerCase().replace(/^www\./i,""),d.SUBDOMAIN_BASED=!1);d.AGENCY=d.AGENCY||"unspecified:"+d.COOKIE_DOMAIN;d.SUB_AGENCY=d.SUB_AGENCY||""+d.COOKIE_DOMAIN;d.SITE_TOPIC=d.SITE_TOPIC||"unspecified:"+d.COOKIE_DOMAIN;d.SITE_PLATFORM=d.SITE_PLATFORM||"unspecified:"+d.COOKIE_DOMAIN;(function(){var a={"default":"utm_id utm_source utm_medium utm_campaign utm_term utm_content utm_source_platform utm_creative_format utm_marketing_tactic gbraid wbraid _gl gclid dclid gclsrc affiliate dap-dev-env v".split(" "),
gsa:["challenge","state"],dhs:["appreceiptnum"],doc:"station meas start atlc epac cpac basin fdays cone tswind120 gm_track 50wind120 hwind120 mltoa34 swath radii wsurge key_messages inundation rainqpf ero gage wfo spanish_key_messages key_messages sid lan office pil product site lat lon issuedby wwa".split(" "),hhs:["s_cid","selectedfacets"],hud:["postid"],nasa:["feature","productid","selectedfacets"],nps:["gid","mapid","site","webcam","id"],nsf:"meas start atlc epac cpac basin fdays cone tswind120 gm_track 50wind120 hwind120 mltoa34 swath radii wsurge key_messages inundation rainqpf ero gage wfo spanish_key_messages key_messages sid".split(" "),
va:["id"],dod:["p"],opm:"l soc jt j rmi smin hp g d a".split(" ")};I=a.default.concat(a[d.AGENCY.toLowerCase()]).concat(d.SEARCH_PARAMS.toLowerCase().split("|"))})();(function(a){a=/^\/.*$/i;try{var b=d.USE_CUSTOM_URL&&a.test(custom_dap_data.url)?location.protocol+"//"+location.hostname+custom_dap_data.url.replace(location.protocol+"//"+location.hostname,""):document.location.href;var c=d.USE_CUSTOM_TITLE?custom_dap_data.title:document.title}catch(h){b=document.location.href,c=document.title}a=b.split(document.location.hostname)[1];
-1!==document.title.search(/404|not found/i)&&(a=("/vpv404/"+a).replace(/\/\//g,"/")+(document.referrer?"/"+document.referrer:document.referrer));b=-1!==document.title.search(/404|not found/ig)?document.location.protocol+"//"+document.location.hostname+a:b;b=J(B(b));for(a=0;a<d.GWT_GA4ID.length;a++){if(0===a){var e={groups:d.GA4_NAME+a,cookie_expires:parseInt(d.COOKIE_TIMEOUT),page_location:b,page_title:c,[d.MAIN_AGENCY_DIMENSION]:d.AGENCY.toUpperCase(),[d.MAIN_SUBAGENCY_DIMENSION]:d.SUB_AGENCY.toUpperCase(),
[d.MAIN_SITE_TOPIC_DIMENSION]:d.SITE_TOPIC.toLowerCase(),[d.MAIN_SITE_PLATFORM_DIMENSION]:d.SITE_PLATFORM.toLowerCase(),[d.MAIN_SCRIPT_SOURCE_URL_DIMENSION]:d.SCRIPT_SOURCE.toLowerCase(),[d.MAIN_CODEVERSION_DIMENSION]:d.VERSION.toLowerCase(),[d.MAIN_URL_PROTOCOL_DIMENSION]:d.URL_PROTOCOL.toLowerCase(),[d.MAIN_USING_PARALLEL_DIMENSION]:d.USING_PARALLEL_TRACKER.toLowerCase()};document.referrer&&-1!==document.referrer.search(location.hostname)?e.page_referrer=B(document.referrer):document.referrer;e=
y(E(e),"default")}else e=0<a&&d.USE_PARALLEL_CUSTOM_DIMENSIONS?{groups:d.GA4_NAME+a,cookie_expires:parseInt(d.COOKIE_TIMEOUT),page_location:b,page_title:c,[d.PARALLEL_AGENCY_DIMENSION]:d.AGENCY.toUpperCase(),[d.PARALLEL_SUBAGENCY_DIMENSION]:d.SUB_AGENCY.toUpperCase(),[d.PARALLEL_SITE_TOPIC_DIMENSION]:d.SITE_TOPIC.toLowerCase(),[d.PARALLEL_SITE_PLATFORM_DIMENSION]:d.SITE_PLATFORM.toLowerCase(),[d.PARALLEL_SCRIPT_SOURCE_URL_DIMENSION]:d.SCRIPT_SOURCE.toLowerCase(),[d.PARALLEL_CODEVERSION_DIMENSION]:d.VERSION.toLowerCase(),
[d.PARALLEL_URL_PROTOCOL_DIMENSION]:d.URL_PROTOCOL.toLowerCase(),[d.PARALLEL_USING_PARALLEL_DIMENSION]:d.USING_PARALLEL_TRACKER.toLowerCase()}:{groups:d.GA4_NAME+a,cookie_expires:parseInt(d.COOKIE_TIMEOUT),page_location:b,page_title:c},document.referrer&&-1!==document.referrer.search(location.hostname)?e.page_referrer=B(document.referrer):document.referrer,e=y(E(e),"default");e=M(e);e=N(e);D("config",d.GWT_GA4ID[a],e)}x?G({search_term:x}):""})();var R=1;if(d.YOUTUBE){F=document.createElement("script");
F.src="https://www.youtube.com/iframe_api";z=document.getElementsByTagName("script")[0];z.parentNode.insertBefore(F,z);var C=[],p=[],u=[],A=d.YT_MILESTONE,K=[];onYouTubeIframeAPIReady=function(){for(var a=0;a<C.length;a++)p[a]=new YT.Player(C[a],{events:{onReady:onPlayerReady,onStateChange:onPlayerStateChange,onError:onPlayerError}})};onPlayerReady=function(a){};onPlayerError=function(a){q("video_error",{videotitle:void 0!==a.target.playerInfo?a.target.playerInfo.videoData.title:a.target.getVideoData().title})};
onPlayerStateChange=function(a){try{for(var b=0,c=void 0!==a.target.playerInfo?a.target.playerInfo.videoData.video_id:a.target.getVideoData().video_id,e=0;e<C.length;e++)C[e]==c&&(b=e);var h=void 0!==p[b].playerInfo?Math.round(p[b].playerInfo.currentTime):Math.round(p[b].getCurrentTime()),l=void 0!==p[b].playerInfo?Math.round(p[b].playerInfo.duration):Math.round(p[b].getDuration()),g={video_current_time:h,video_duration:l,video_percent:(h/l*100).toFixed(),video_provider:"youtube",video_title:void 0!== 22.09.2020
uswds 8.x-2.1-rc1 ::
templates/system/menu/menu--primary_menu.html.twig
{# Sets a variable to store if link is present or not #}
{% set noLink = (parent.url.routed and parent.url.routename == "<nolink>")%}
{# If there is no link then display only title in the span. #}
{% if not noLink %}<a href="{{ parent.url }}">{% endif %}
<span><h3>{{ parent.title }}</h3></span>
{% if not noLink %}</a>{% endif %}
</div>
{% if item.below and mega_display_second %}
<div class="usa-nav__submenu-item">
{% set noLink = (item.url.routed and item.url.routename == "<nolink>")%}
{% if not noLink %}
<a href="{{ item.url }}" class="usa-nav__link">
{% endif %}
<span><strong>{{ item.title }}</strong></span>
{% if not noLink %}</a>{% endif %}
</div>
{% endif %}
{% set noLink = (item.url.routed and item.url.routename == "<nolink>")%}
{% if not noLink %}
<a href="{{ item.url }}"{% if menu_level == 0 %} class="usa-nav__link{% if item.in_active_trail %} usa-current{% endif %}" {% endif %}>
{% endif %}
<span>{{ item.title }}</span>
{% if not noLink %}
</a> 04.08.2022
vartheme_bs5 2.0.x-dev ::
src/components/molecules/dropdown/dropdown-menu.twig
item.in_active_trail ? 'active' : ''
] %}
{% if item.url.options.attributes.class is iterable %}
{% set nav_link_classes = nav_link_classes|merge(item.url.options.attributes.class) %}
{% elseif item.url.options.attributes.class %}
{% set nav_link_classes = nav_link_classes|merge([item.url.options.attributes.class]) %}
{% endif %}
<a href="{{ item.url }}" class="{{ nav_link_classes|join(' ') }}">{{ item.title }}</a>
{% endfor %}
</div> 04.08.2022
vartheme_bs5 2.0.x-dev ::
src/components/organisms/nav/nav.twig
] %}
{% set nav_link_classes = ['nav-link'] %}
{% if item.url.options.attributes.class is iterable %}
{% set nav_link_classes = nav_link_classes|merge(item.url.options.attributes.class) %}
{% elseif item.url.options.attributes.class %}
{% set nav_link_classes = nav_link_classes|merge([item.url.options.attributes.class]) %}
{% endif %}
<li class="{{ nav_item_classes|join(' ') }}">
{% if item.is_expanded and item.below %}
<a href="{{ item.url }}" class="{{ nav_link_classes|merge(['dropdown-toggle'])|join(' ') }}" data-bs-toggle="dropdown">{{ item.title }}</a>
{% if item.below %}
{% include '@vartheme_bs5/molecules/dropdown/dropdown-menu.twig' with { 24.04.2020
video_embed_field_plyr 8.x-1.2 ::
assets/plyr/plyr.polyfilled.min.js
"object"==typeof navigator&&function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define("Plyr",t):(e="undefined"!=typeof globalThis?globalThis: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 i,s;return(t=t||{}).bubbles=!!t.bubbles,t.cancelable=!!t.cancelable,(i=document.createEvent("CustomEvent")).initCustomEvent(e,t.bubbles,t.cancelable,t.detail),s=i.preventDefault,i.preventDefault=function(){s.call(this);try{Object.defineProperty(this,"defaultPrevented",{get:function(){return!0}})}catch(e){this.defaultPrevented=!0}},i};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,i){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var s=i.call(e,t||"default");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function i(e,t){for(var i=0;i<t.length;i++){var s=t[i];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,s.key,s)}}function s(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function n(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,s)}return i}function a(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?n(Object(i),!0).forEach((function(t){s(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):n(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}!function(e){var t=function(){try{return!!Symbol.iterator}catch(e){return!1}}(),i=function(e){var i={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return t&&(i[Symbol.iterator]=function(){return i}),i},s=function(e){return encodeURIComponent(e).replace(/%20/g,"+")},n=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&&"function"==typeof t.prototype.entries}catch(e){return!1}})()||function(){var n=function(e){Object.defineProperty(this,"_entries",{writable:!0,value:{}});var t=typeof e;if("undefined"===t);else if("string"===t)""!==e&&this._fromString(e);else if(e instanceof n){var i=this;e.forEach((function(e,t){i.append(t,e)}))}else{if(null===e||"object"!==t)throw new TypeError("Unsupported input's type for URLSearchParams");if("[object Array]"===Object.prototype.toString.call(e))for(var s=0;s<e.length;s++){var a=e[s];if("[object Array]"!==Object.prototype.toString.call(a)&&2===a.length)throw new TypeError("Expected [string, any] as entry at index "+s+" of URLSearchParams's input");this.append(a[0],a[1])}else for(var r in e)e.hasOwnProperty(r)&&this.append(r,e[r])}},a=n.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 i;for(var s in this._entries)if(this._entries.hasOwnProperty(s)){i=this._entries[s];for(var n=0;n<i.length;n++)e.call(t,i[n],s,this)}},a.keys=function(){var e=[];return this.forEach((function(t,i){e.push(i)})),i(e)},a.values=function(){var e=[];return this.forEach((function(t){e.push(t)})),i(e)},a.entries=function(){var e=[];return this.forEach((function(t,i){e.push([i,t])})),i(e)},t&&(a[Symbol.iterator]=a.entries),a.toString=function(){var e=[];return this.forEach((function(t,i){e.push(s(i)+"="+s(t))})),e.join("&")},e.URLSearchParams=n}();var a=e.URLSearchParams.prototype;"function"!=typeof a.sort&&(a.sort=function(){var e=this,t=[];this.forEach((function(i,s){t.push([s,i]),e._entries||e.delete(s)})),t.sort((function(e,t){return e[0]<t[0]?-1:e[0]>t[0]?1:0})),e._entries&&(e._entries={});for(var i=0;i<t.length;i++)this.append(t[i][0],t[i][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,i){t.push(i)}));for(var i=0;i<t.length;i++)this.delete(t[i])}var s,a=(e=e.replace(/^\?/,"")).split("&");for(i=0;i<a.length;i++)s=a[i].split("="),this.append(n(s[0]),s.length>1?n(s[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,i=function(t,i){"string"!=typeof t&&(t=String(t)),i&&"string"!=typeof i&&(i=String(i));var s,n=document;if(i&&(void 0===e.location||i!==e.location.href)){i=i.toLowerCase(),(s=(n=document.implementation.createHTMLDocument("")).createElement("base")).href=i,n.head.appendChild(s);try{if(0!==s.href.indexOf(i))throw new Error(s.href)}catch(e){throw new Error("URL unable to set base "+i+" due to "+e)}}var a=n.createElement("a");a.href=t,s&&(n.body.appendChild(a),a.href=a.href);var r=n.createElement("input");if(r.type="url",r.value=t,":"===a.protocol||!/:/.test(a.href)||!r.checkValidity()&&!i)throw new TypeError("Invalid URL");Object.defineProperty(this,"_anchorElement",{value:a});var o=new e.URLSearchParams(this.search),l=!0,c=!0,u=this;["append","delete","set"].forEach((function(e){var t=o[e];o[e]=function(){t.apply(o,arguments),l&&(c=!1,u.search=o.toString(),c=!0)}})),Object.defineProperty(this,"searchParams",{value:o,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))}})},s=i.prototype;["hash","host","hostname","port","protocol"].forEach((function(e){!function(e){Object.defineProperty(s,e,{get:function(){return this._anchorElement[e]},set:function(t){this._anchorElement[e]=t},enumerable:!0})}(e)})),Object.defineProperty(s,"search",{get:function(){return this._anchorElement.search},set:function(e){this._anchorElement.search=e,this._updateSearchParams()},enumerable:!0}),Object.defineProperties(s,{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}}),i.createObjectURL=function(e){return t.createObjectURL.apply(t,arguments)},i.revokeObjectURL=function(e){return t.revokeObjectURL.apply(t,arguments)},e.URL=i}(),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(i){setInterval((function(){e.location.origin=t()}),100)}}}(void 0!==e?e:"undefined"!=typeof window?window:"undefined"!=typeof self?self:e);var r={addCSS:!0,thumbWidth:15,watch:!0};var o=function(e){return null!=e?e.constructor:null},l=function(e,t){return!!(e&&t&&e instanceof t)},c=function(e){return null==e},u=function(e){return o(e)===Object},h=function(e){return o(e)===String},d=function(e){return Array.isArray(e)},m=function(e){return l(e,NodeList)},p={nullOrUndefined:c,object:u,number:function(e){return o(e)===Number&&!Number.isNaN(e)},string:h,boolean:function(e){return o(e)===Boolean},function:function(e){return o(e)===Function},array:d,nodeList:m,element:function(e){return l(e,Element)},event:function(e){return l(e,Event)},empty:function(e){return c(e)||(h(e)||d(e)||m(e))&&!e.length||u(e)&&!Object.keys(e).length}};function g(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 f=function(){function e(t,i){(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,e),p.element(t)?this.element=t:p.string(t)&&(this.element=document.querySelector(t)),p.element(this.element)&&p.empty(this.element.rangeTouch)&&(this.config=a({},r,{},i),this.init())}return function(e,t,s){t&&i(e.prototype,t),s&&i(e,s)}(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||!p.event(t))return null;var i,s=t.target,n=t.changedTouches[0],a=parseFloat(s.getAttribute("min"))||0,r=parseFloat(s.getAttribute("max"))||100,o=parseFloat(s.getAttribute("step"))||1,l=s.getBoundingClientRect(),c=100/l.width*(this.config.thumbWidth/2)/100;return 0>(i=100/l.width*(n.clientX-l.left))?i=0:100<i&&(i=100),50>i?i-=(100-2*i)*c:50<i&&(i+=2*(i-50)*c),a+g(i/100*(r-a),o)}},{key:"set",value:function(t){e.enabled&&p.event(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]:{},s=null;if(p.empty(t)||p.string(t)?s=Array.from(document.querySelectorAll(p.string(t)?t:'input[type="range"]')):p.element(t)?s=[t]:p.nodeList(t)?s=Array.from(t):p.array(t)&&(s=t.filter(p.element)),p.empty(s))return null;var n=a({},r,{},i);if(p.string(t)&&n.watch){var o=new MutationObserver((function(i){Array.from(i).forEach((function(i){Array.from(i.addedNodes).forEach((function(i){p.element(i)&&function(e,t){return function(){return Array.from(document.querySelectorAll(t)).includes(this)}.call(e,t)}(i,t)&&new e(i,n)}))}))}));o.observe(document.body,{childList:!0,subtree:!0})}return s.map((function(t){return new e(t,i)}))}},{key:"enabled",get:function(){return"ontouchstart"in document.documentElement}}]),e}();const y=e=>null!=e?e.constructor:null,b=(e,t)=>Boolean(e&&t&&e instanceof t),v=e=>null==e,w=e=>y(e)===Object,T=e=>y(e)===String,k=e=>"function"==typeof e,E=e=>Array.isArray(e),C=e=>b(e,NodeList),S=e=>v(e)||(T(e)||E(e)||C(e))&&!e.length||w(e)&&!Object.keys(e).length;var A={nullOrUndefined:v,object:w,number:e=>y(e)===Number&&!Number.isNaN(e),string:T,boolean:e=>y(e)===Boolean,function:k,array:E,weakMap:e=>b(e,WeakMap),nodeList:C,element:e=>null!==e&&"object"==typeof e&&1===e.nodeType&&"object"==typeof e.style&&"object"==typeof e.ownerDocument,textNode:e=>y(e)===Text,event:e=>b(e,Event),keyboardEvent:e=>b(e,KeyboardEvent),cue:e=>b(e,window.TextTrackCue)||b(e,window.VTTCue),track:e=>b(e,TextTrack)||!v(e)&&T(e.kind),promise:e=>b(e,Promise)&&k(e.then),url:e=>{if(b(e,window.URL))return!0;if(!T(e))return!1;let t=e;e.startsWith("http://")&&e.startsWith("https://")||(t=`http://${e}`);try{return!S(new URL(t).hostname)}catch(e){return!1}},empty:S};const P=(()=>{const e=document.createElement("span"),t={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"},i=Object.keys(t).find((t=>void 0!==e.style[t]));return!!A.string(i)&&t[i]})();function M(e,t){setTimeout((()=>{try{e.hidden=!0,e.offsetHeight,e.hidden=!1}catch(e){}}),t)}var x={isIE:Boolean(window.document.documentMode),isEdge:/Edge/g.test(navigator.userAgent),isWebKit:"WebkitAppearance"in document.documentElement.style&&!/Edge/g.test(navigator.userAgent),isIPhone:/iPhone|iPod/gi.test(navigator.userAgent)&&navigator.maxTouchPoints>1,isIPadOS:"MacIntel"===navigator.platform&&navigator.maxTouchPoints>1,isIos:/iPad|iPhone|iPod/gi.test(navigator.userAgent)&&navigator.maxTouchPoints>1};function L(e,t){return t.split(".").reduce(((e,t)=>e&&e[t]),e)}function N(e={},...t){if(!t.length)return e;const i=t.shift();return A.object(i)?(Object.keys(i).forEach((t=>{A.object(i[t])?(Object.keys(e).includes(t)||Object.assign(e,{[t]:{}}),N(e[t],i[t])):Object.assign(e,{[t]:i[t]})})),N(e,...t)):e}function _(e,t){const i=e.length?e:[e];Array.from(i).reverse().forEach(((e,i)=>{const s=i>0?t.cloneNode(!0):t,n=e.parentNode,a=e.nextSibling;s.appendChild(e),a?n.insertBefore(s,a):n.appendChild(s)}))}function I(e,t){A.element(e)&&!A.empty(t)&&Object.entries(t).filter((([,e])=>!A.nullOrUndefined(e))).forEach((([t,i])=>e.setAttribute(t,i)))}function O(e,t,i){const s=document.createElement(e);return A.object(t)&&I(s,t),A.string(i)&&(s.innerText=i),s}function $(e,t,i,s){A.element(t)&&t.appendChild(O(e,i,s))}function j(e){A.nodeList(e)||A.array(e)?Array.from(e).forEach(j):A.element(e)&&A.element(e.parentNode)&&e.parentNode.removeChild(e)}function R(e){if(!A.element(e))return;let{length:t}=e.childNodes;for(;t>0;)e.removeChild(e.lastChild),t-=1}function D(e,t){return A.element(t)&&A.element(t.parentNode)&&A.element(e)?(t.parentNode.replaceChild(e,t),e):null}function q(e,t){if(!A.string(e)||A.empty(e))return{};const i={},s=N({},t);return e.split(",").forEach((e=>{const t=e.trim(),n=t.replace(".",""),a=t.replace(/[[\]]/g,"").split("="),[r]=a,o=a.length>1?a[1].replace(/["']/g,""):"";switch(t.charAt(0)){case".":A.string(s.class)?i.class=`${s.class} ${n}`:i.class=n;break;case"#":i.id=t.replace("#","");break;case"[":i[r]=o}})),N(s,i)}function H(e,t){if(!A.element(e))return;let i=t;A.boolean(i)||(i=!e.hidden),e.hidden=i}function F(e,t,i){if(A.nodeList(e))return Array.from(e).map((e=>F(e,t,i)));if(A.element(e)){let s="toggle";return void 0!==i&&(s=i?"add":"remove"),e.classList[s](t),e.classList.contains(t)}return!1}function U(e,t){return A.element(e)&&e.classList.contains(t)}function V(e,t){const{prototype:i}=Element;return(i.matches||i.webkitMatchesSelector||i.mozMatchesSelector||i.msMatchesSelector||function(){return Array.from(document.querySelectorAll(t)).includes(this)}).call(e,t)}function B(e){return this.elements.container.querySelectorAll(e)}function W(e){return this.elements.container.querySelector(e)}function z(e=null,t=!1){A.element(e)&&e.focus({preventScroll:!0,focusVisible:t})}const K={"audio/ogg":"vorbis","audio/wav":"1","video/webm":"vp8, vorbis","video/mp4":"avc1.42E01E, mp4a.40.2","video/ogg":"theora"},Y={audio:"canPlayType"in document.createElement("audio"),video:"canPlayType"in document.createElement("video"),check(e,t){const i=Y[e]||"html5"!==t;return{api:i,ui:i&&Y.rangeInput}},pip:!(x.isIPhone||!A.function(O("video").webkitSetPresentationMode)&&(!document.pictureInPictureEnabled||O("video").disablePictureInPicture)),airplay:A.function(window.WebKitPlaybackTargetAvailabilityEvent),playsinline:"playsInline"in document.createElement("video"),mime(e){if(A.empty(e))return!1;const[t]=e.split("/");let i=e;if(!this.isHTML5||t!==this.type)return!1;Object.keys(K).includes(i)&&(i+=`; codecs="${K[e]}"`);try{return Boolean(i&&this.media.canPlayType(i).replace(/no/,""))}catch(e){return!1}},textTracks:"textTracks"in document.createElement("video"),rangeInput:(()=>{const e=document.createElement("input");return e.type="range","range"===e.type})(),touch:"ontouchstart"in document.documentElement,transitions:!1!==P,reducedMotion:"matchMedia"in window&&window.matchMedia("(prefers-reduced-motion)").matches},Q=(()=>{let e=!1;try{const t=Object.defineProperty({},"passive",{get:()=>(e=!0,null)});window.addEventListener("test",null,t),window.removeEventListener("test",null,t)}catch(e){}return e})();function X(e,t,i,s=!1,n=!0,a=!1){if(!e||!("addEventListener"in e)||A.empty(t)||!A.function(i))return;const r=t.split(" ");let o=a;Q&&(o={passive:n,capture:a}),r.forEach((t=>{this&&this.eventListeners&&s&&this.eventListeners.push({element:e,type:t,callback:i,options:o}),e[s?"addEventListener":"removeEventListener"](t,i,o)}))}function J(e,t="",i,s=!0,n=!1){X.call(this,e,t,i,!0,s,n)}function G(e,t="",i,s=!0,n=!1){X.call(this,e,t,i,!1,s,n)}function Z(e,t="",i,s=!0,n=!1){const a=(...r)=>{G(e,t,a,s,n),i.apply(this,r)};X.call(this,e,t,a,!0,s,n)}function ee(e,t="",i=!1,s={}){if(!A.element(e)||A.empty(t))return;const n=new CustomEvent(t,{bubbles:i,detail:{...s,plyr:this}});e.dispatchEvent(n)}function te(){this&&this.eventListeners&&(this.eventListeners.forEach((e=>{const{element:t,type:i,callback:s,options:n}=e;t.removeEventListener(i,s,n)})),this.eventListeners=[])}function ie(){return new Promise((e=>this.ready?setTimeout(e,0):J.call(this,this.elements.container,"ready",e))).then((()=>{}))}function se(e){A.promise(e)&&e.then(null,(()=>{}))}function ne(e){return A.array(e)?e.filter(((t,i)=>e.indexOf(t)===i)):e}function ae(e,t){return A.array(e)&&e.length?e.reduce(((e,i)=>Math.abs(i-t)<Math.abs(e-t)?i:e)):null}function re(e){return!(!window||!window.CSS)&&window.CSS.supports(e)}const oe=[[1,1],[4,3],[3,4],[5,4],[4,5],[3,2],[2,3],[16,10],[10,16],[16,9],[9,16],[21,9],[9,21],[32,9],[9,32]].reduce(((e,[t,i])=>({...e,[t/i]:[t,i]})),{});function le(e){if(!(A.array(e)||A.string(e)&&e.includes(":")))return!1;return(A.array(e)?e:e.split(":")).map(Number).every(A.number)}function ce(e){if(!A.array(e)||!e.every(A.number))return null;const[t,i]=e,s=(e,t)=>0===t?e:s(t,e%t),n=s(t,i);return[t/n,i/n]}function ue(e){const t=e=>le(e)?e.split(":").map(Number):null;let i=t(e);if(null===i&&(i=t(this.config.ratio)),null===i&&!A.empty(this.embed)&&A.array(this.embed.ratio)&&({ratio:i}=this.embed),null===i&&this.isHTML5){const{videoWidth:e,videoHeight:t}=this.media;i=[e,t]}return ce(i)}function he(e){if(!this.isVideo)return{};const{wrapper:t}=this.elements,i=ue.call(this,e);if(!A.array(i))return{};const[s,n]=ce(i),a=100/s*n;if(re(`aspect-ratio: ${s}/${n}`)?t.style.aspectRatio=`${s}/${n}`:t.style.paddingBottom=`${a}%`,this.isVimeo&&!this.config.vimeo.premium&&this.supported.ui){const e=100/this.media.offsetWidth*parseInt(window.getComputedStyle(this.media).paddingBottom,10),i=(e-a)/(e/50);this.fullscreen.active?t.style.paddingBottom=null:this.media.style.transform=`translateY(-${i}%)`}else this.isHTML5&&t.classList.add(this.config.classNames.videoFixedRatio);return{padding:a,ratio:i}}function de(e,t,i=.05){const s=e/t,n=ae(Object.keys(oe),s);return Math.abs(n-s)<=i?oe[n]:[e,t]}const me={getSources(){if(!this.isHTML5)return[];return Array.from(this.media.querySelectorAll("source")).filter((e=>{const t=e.getAttribute("type");return!!A.empty(t)||Y.mime.call(this,t)}))},getQualityOptions(){return this.config.quality.forced?this.config.quality.options:me.getSources.call(this).map((e=>Number(e.getAttribute("size")))).filter(Boolean)},setup(){if(!this.isHTML5)return;const e=this;e.options.speed=e.config.speed.options,A.empty(this.config.ratio)||he.call(e),Object.defineProperty(e.media,"quality",{get(){const t=me.getSources.call(e).find((t=>t.getAttribute("src")===e.source));return t&&Number(t.getAttribute("size"))},set(t){if(e.quality!==t){if(e.config.quality.forced&&A.function(e.config.quality.onChange))e.config.quality.onChange(t);else{const i=me.getSources.call(e).find((e=>Number(e.getAttribute("size"))===t));if(!i)return;const{currentTime:s,paused:n,preload:a,readyState:r,playbackRate:o}=e.media;e.media.src=i.getAttribute("src"),("none"!==a||r)&&(e.once("loadedmetadata",(()=>{e.speed=o,e.currentTime=s,n||se(e.play())})),e.media.load())}ee.call(e,e.media,"qualitychange",!1,{quality:t})}}})},cancelRequests(){this.isHTML5&&(j(me.getSources.call(this)),this.media.setAttribute("src",this.config.blankVideo),this.media.load(),this.debug.log("Cancelled network requests"))}};function pe(e,...t){return A.empty(e)?e:e.toString().replace(/{(\d+)}/g,((e,i)=>t[i].toString()))}const ge=(e="",t="",i="")=>e.replace(new RegExp(t.toString().replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1"),"g"),i.toString()),fe=(e="")=>e.toString().replace(/\w\S*/g,(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()));function ye(e=""){let t=e.toString();return t=function(e=""){let t=e.toString();return t=ge(t,"-"," "),t=ge(t,"_"," "),t=fe(t),ge(t," ","")}(t),t.charAt(0).toLowerCase()+t.slice(1)}function be(e){const t=document.createElement("div");return t.appendChild(e),t.innerHTML}const ve={pip:"PIP",airplay:"AirPlay",html5:"HTML5",vimeo:"Vimeo",youtube:"YouTube"},we={get(e="",t={}){if(A.empty(e)||A.empty(t))return"";let i=L(t.i18n,e);if(A.empty(i))return Object.keys(ve).includes(e)?ve[e]:"";const s={"{seektime}":t.seekTime,"{title}":t.title};return Object.entries(s).forEach((([e,t])=>{i=ge(i,e,t)})),i}};class Te{constructor(e){t(this,"get",(e=>{if(!Te.supported||!this.enabled)return null;const t=window.localStorage.getItem(this.key);if(A.empty(t))return null;const i=JSON.parse(t);return A.string(e)&&e.length?i[e]:i})),t(this,"set",(e=>{if(!Te.supported||!this.enabled)return;if(!A.object(e))return;let t=this.get();A.empty(t)&&(t={}),N(t,e);try{window.localStorage.setItem(this.key,JSON.stringify(t))}catch(e){}})),this.enabled=e.config.storage.enabled,this.key=e.config.storage.key}static get supported(){try{if(!("localStorage"in window))return!1;const e="___test";return window.localStorage.setItem(e,e),window.localStorage.removeItem(e),!0}catch(e){return!1}}}function ke(e,t="text"){return new Promise(((i,s)=>{try{const s=new XMLHttpRequest;if(!("withCredentials"in s))return;s.addEventListener("load",(()=>{if("text"===t)try{i(JSON.parse(s.responseText))}catch(e){i(s.responseText)}else i(s.response)})),s.addEventListener("error",(()=>{throw new Error(s.status)})),s.open("GET",e,!0),s.responseType=t,s.send()}catch(e){s(e)}}))}function Ee(e,t){if(!A.string(e))return;const i="cache",s=A.string(t);let n=!1;const a=()=>null!==document.getElementById(t),r=(e,t)=>{e.innerHTML=t,s&&a()||document.body.insertAdjacentElement("afterbegin",e)};if(!s||!a()){const a=Te.supported,o=document.createElement("div");if(o.setAttribute("hidden",""),s&&o.setAttribute("id",t),a){const e=window.localStorage.getItem(`${i}-${t}`);if(n=null!==e,n){const t=JSON.parse(e);r(o,t.content)}}ke(e).then((e=>{if(!A.empty(e)){if(a)try{window.localStorage.setItem(`${i}-${t}`,JSON.stringify({content:e}))}catch(e){}r(o,e)}})).catch((()=>{}))}}const Ce=e=>Math.trunc(e/60/60%60,10),Se=e=>Math.trunc(e/60%60,10),Ae=e=>Math.trunc(e%60,10);function Pe(e=0,t=!1,i=!1){if(!A.number(e))return Pe(void 0,t,i);const s=e=>`0${e}`.slice(-2);let n=Ce(e);const a=Se(e),r=Ae(e);return n=t||n>0?`${n}:`:"",`${i&&e>0?"-":""}${n}${s(a)}:${s(r)}`}const Me={getIconUrl(){const e=new URL(this.config.iconUrl,window.location),t=window.location.host?window.location.host:window.top.location.host,i=e.host!==t||x.isIE&&!window.svg4everybody;return{url:this.config.iconUrl,cors:i}},findElements(){try{return this.elements.controls=W.call(this,this.config.selectors.controls.wrapper),this.elements.buttons={play:B.call(this,this.config.selectors.buttons.play),pause:W.call(this,this.config.selectors.buttons.pause),restart:W.call(this,this.config.selectors.buttons.restart),rewind:W.call(this,this.config.selectors.buttons.rewind),fastForward:W.call(this,this.config.selectors.buttons.fastForward),mute:W.call(this,this.config.selectors.buttons.mute),pip:W.call(this,this.config.selectors.buttons.pip),airplay:W.call(this,this.config.selectors.buttons.airplay),settings:W.call(this,this.config.selectors.buttons.settings),captions:W.call(this,this.config.selectors.buttons.captions),fullscreen:W.call(this,this.config.selectors.buttons.fullscreen)},this.elements.progress=W.call(this,this.config.selectors.progress),this.elements.inputs={seek:W.call(this,this.config.selectors.inputs.seek),volume:W.call(this,this.config.selectors.inputs.volume)},this.elements.display={buffer:W.call(this,this.config.selectors.display.buffer),currentTime:W.call(this,this.config.selectors.display.currentTime),duration:W.call(this,this.config.selectors.display.duration)},A.element(this.elements.progress)&&(this.elements.display.seekTooltip=this.elements.progress.querySelector(`.${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(e,t){const i="http://www.w3.org/2000/svg",s=Me.getIconUrl.call(this),n=`${s.cors?"":s.url}#${this.config.iconPrefix}`,a=document.createElementNS(i,"svg");I(a,N(t,{"aria-hidden":"true",focusable:"false"}));const r=document.createElementNS(i,"use"),o=`${n}-${e}`;return"href"in r&&r.setAttributeNS("http://www.w3.org/1999/xlink","href",o),r.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",o),a.appendChild(r),a},createLabel(e,t={}){const i=we.get(e,this.config);return O("span",{...t,class:[t.class,this.config.classNames.hidden].filter(Boolean).join(" ")},i)},createBadge(e){if(A.empty(e))return null;const t=O("span",{class:this.config.classNames.menu.value});return t.appendChild(O("span",{class:this.config.classNames.menu.badge},e)),t},createButton(e,t){const i=N({},t);let s=ye(e);const n={element:"button",toggle:!1,label:null,icon:null,labelPressed:null,iconPressed:null};switch(["element","icon","label"].forEach((e=>{Object.keys(i).includes(e)&&(n[e]=i[e],delete i[e])})),"button"!==n.element||Object.keys(i).includes("type")||(i.type="button"),Object.keys(i).includes("class")?i.class.split(" ").some((e=>e===this.config.classNames.control))||N(i,{class:`${i.class} ${this.config.classNames.control}`}):i.class=this.config.classNames.control,e){case"play":n.toggle=!0,n.label="play",n.labelPressed="pause",n.icon="play",n.iconPressed="pause";break;case"mute":n.toggle=!0,n.label="mute",n.labelPressed="unmute",n.icon="volume",n.iconPressed="muted";break;case"captions":n.toggle=!0,n.label="enableCaptions",n.labelPressed="disableCaptions",n.icon="captions-off",n.iconPressed="captions-on";break;case"fullscreen":n.toggle=!0,n.label="enterFullscreen",n.labelPressed="exitFullscreen",n.icon="enter-fullscreen",n.iconPressed="exit-fullscreen";break;case"play-large":i.class+=` ${this.config.classNames.control}--overlaid`,s="play",n.label="play",n.icon="play";break;default:A.empty(n.label)&&(n.label=s),A.empty(n.icon)&&(n.icon=e)}const a=O(n.element);return n.toggle?(a.appendChild(Me.createIcon.call(this,n.iconPressed,{class:"icon--pressed"})),a.appendChild(Me.createIcon.call(this,n.icon,{class:"icon--not-pressed"})),a.appendChild(Me.createLabel.call(this,n.labelPressed,{class:"label--pressed"})),a.appendChild(Me.createLabel.call(this,n.label,{class:"label--not-pressed"}))):(a.appendChild(Me.createIcon.call(this,n.icon)),a.appendChild(Me.createLabel.call(this,n.label))),N(i,q(this.config.selectors.buttons[s],i)),I(a,i),"play"===s?(A.array(this.elements.buttons[s])||(this.elements.buttons[s]=[]),this.elements.buttons[s].push(a)):this.elements.buttons[s]=a,a},createRange(e,t){const i=O("input",N(q(this.config.selectors.inputs[e]),{type:"range",min:0,max:100,step:.01,value:0,autocomplete:"off",role:"slider","aria-label":we.get(e,this.config),"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":0},t));return this.elements.inputs[e]=i,Me.updateRangeFill.call(this,i),f.setup(i),i},createProgress(e,t){const i=O("progress",N(q(this.config.selectors.display[e]),{min:0,max:100,value:0,role:"progressbar","aria-hidden":!0},t));if("volume"!==e){i.appendChild(O("span",null,"0"));const t={played:"played",buffer:"buffered"}[e],s=t?we.get(t,this.config):"";i.innerText=`% ${s.toLowerCase()}`}return this.elements.display[e]=i,i},createTime(e,t){const i=q(this.config.selectors.display[e],t),s=O("div",N(i,{class:`${i.class?i.class:""} ${this.config.classNames.display.time} `.trim(),"aria-label":we.get(e,this.config),role:"timer"}),"00:00");return this.elements.display[e]=s,s},bindMenuItemShortcuts(e,t){J.call(this,e,"keydown keyup",(i=>{if(![" ","ArrowUp","ArrowDown","ArrowRight"].includes(i.key))return;if(i.preventDefault(),i.stopPropagation(),"keydown"===i.type)return;const s=V(e,'[role="menuitemradio"]');if(!s&&[" ","ArrowRight"].includes(i.key))Me.showMenuPanel.call(this,t,!0);else{let t;" "!==i.key&&("ArrowDown"===i.key||s&&"ArrowRight"===i.key?(t=e.nextElementSibling,A.element(t)||(t=e.parentNode.firstElementChild)):(t=e.previousElementSibling,A.element(t)||(t=e.parentNode.lastElementChild)),z.call(this,t,!0))}}),!1),J.call(this,e,"keyup",(e=>{"Return"===e.key&&Me.focusFirstMenuItem.call(this,null,!0)}))},createMenuItem({value:e,list:t,type:i,title:s,badge:n=null,checked:a=!1}){const r=q(this.config.selectors.inputs[i]),o=O("button",N(r,{type:"button",role:"menuitemradio",class:`${this.config.classNames.control} ${r.class?r.class:""}`.trim(),"aria-checked":a,value:e})),l=O("span");l.innerHTML=s,A.element(n)&&l.appendChild(n),o.appendChild(l),Object.defineProperty(o,"checked",{enumerable:!0,get:()=>"true"===o.getAttribute("aria-checked"),set(e){e&&Array.from(o.parentNode.children).filter((e=>V(e,'[role="menuitemradio"]'))).forEach((e=>e.setAttribute("aria-checked","false"))),o.setAttribute("aria-checked",e?"true":"false")}}),this.listeners.bind(o,"click keyup",(t=>{if(!A.keyboardEvent(t)||" "===t.key){switch(t.preventDefault(),t.stopPropagation(),o.checked=!0,i){case"language":this.currentTrack=Number(e);break;case"quality":this.quality=e;break;case"speed":this.speed=parseFloat(e)}Me.showMenuPanel.call(this,"home",A.keyboardEvent(t))}}),i,!1),Me.bindMenuItemShortcuts.call(this,o,i),t.appendChild(o)},formatTime(e=0,t=!1){if(!A.number(e))return e;return Pe(e,Ce(this.duration)>0,t)},updateTimeDisplay(e=null,t=0,i=!1){A.element(e)&&A.number(t)&&(e.innerText=Me.formatTime(t,i))},updateVolume(){this.supported.ui&&(A.element(this.elements.inputs.volume)&&Me.setRange.call(this,this.elements.inputs.volume,this.muted?0:this.volume),A.element(this.elements.buttons.mute)&&(this.elements.buttons.mute.pressed=this.muted||0===this.volume))},setRange(e,t=0){A.element(e)&&(e.value=t,Me.updateRangeFill.call(this,e))},updateProgress(e){if(!this.supported.ui||!A.event(e))return;let t=0;const i=(e,t)=>{const i=A.number(t)?t:0,s=A.element(e)?e:this.elements.display.buffer;if(A.element(s)){s.value=i;const e=s.getElementsByTagName("span")[0];A.element(e)&&(e.childNodes[0].nodeValue=i)}};if(e)switch(e.type){case"timeupdate":case"seeking":case"seeked":s=this.currentTime,n=this.duration,t=0===s||0===n||Number.isNaN(s)||Number.isNaN(n)?0:(s/n*100).toFixed(2),"timeupdate"===e.type&&Me.setRange.call(this,this.elements.inputs.seek,t);break;case"playing":case"progress":i(this.elements.display.buffer,100*this.buffered)}var s,n},updateRangeFill(e){const t=A.event(e)?e.target:e;if(A.element(t)&&"range"===t.getAttribute("type")){if(V(t,this.config.selectors.inputs.seek)){t.setAttribute("aria-valuenow",this.currentTime);const e=Me.formatTime(this.currentTime),i=Me.formatTime(this.duration),s=we.get("seekLabel",this.config);t.setAttribute("aria-valuetext",s.replace("{currentTime}",e).replace("{duration}",i))}else if(V(t,this.config.selectors.inputs.volume)){const e=100*t.value;t.setAttribute("aria-valuenow",e),t.setAttribute("aria-valuetext",`${e.toFixed(1)}%`)}else t.setAttribute("aria-valuenow",t.value);(x.isWebKit||x.isIPadOS)&&t.style.setProperty("--value",t.value/t.max*100+"%")}},updateSeekTooltip(e){var t,i;if(!this.config.tooltips.seek||!A.element(this.elements.inputs.seek)||!A.element(this.elements.display.seekTooltip)||0===this.duration)return;const s=this.elements.display.seekTooltip,n=`${this.config.classNames.tooltip}--visible`,a=e=>F(s,n,e);if(this.touch)return void a(!1);let r=0;const o=this.elements.progress.getBoundingClientRect();if(A.event(e))r=100/o.width*(e.pageX-o.left);else{if(!U(s,n))return;r=parseFloat(s.style.left,10)}r<0?r=0:r>100&&(r=100);const l=this.duration/100*r;s.innerText=Me.formatTime(l);const c=null===(t=this.config.markers)||void 0===t||null===(i=t.points)||void 0===i?void 0:i.find((({time:e})=>e===Math.round(l)));c&&s.insertAdjacentHTML("afterbegin",`${c.label}<br>`),s.style.left=`${r}%`,A.event(e)&&["mouseenter","mouseleave"].includes(e.type)&&a("mouseenter"===e.type)},timeUpdate(e){const t=!A.element(this.elements.display.duration)&&this.config.invertTime;Me.updateTimeDisplay.call(this,this.elements.display.currentTime,t?this.duration-this.currentTime:this.currentTime,t),e&&"timeupdate"===e.type&&this.media.seeking||Me.updateProgress.call(this,e)},durationUpdate(){if(!this.supported.ui||!this.config.invertTime&&this.currentTime)return;if(this.duration>=2**32)return H(this.elements.display.currentTime,!0),void H(this.elements.progress,!0);A.element(this.elements.inputs.seek)&&this.elements.inputs.seek.setAttribute("aria-valuemax",this.duration);const e=A.element(this.elements.display.duration);!e&&this.config.displayDuration&&this.paused&&Me.updateTimeDisplay.call(this,this.elements.display.currentTime,this.duration),e&&Me.updateTimeDisplay.call(this,this.elements.display.duration,this.duration),this.config.markers.enabled&&Me.setMarkers.call(this),Me.updateSeekTooltip.call(this)},toggleMenuButton(e,t){H(this.elements.settings.buttons[e],!t)},updateSetting(e,t,i){const s=this.elements.settings.panels[e];let n=null,a=t;if("captions"===e)n=this.currentTrack;else{if(n=A.empty(i)?this[e]:i,A.empty(n)&&(n=this.config[e].default),!A.empty(this.options[e])&&!this.options[e].includes(n))return void this.debug.warn(`Unsupported value of '${n}' for ${e}`);if(!this.config[e].options.includes(n))return void this.debug.warn(`Disabled value of '${n}' for ${e}`)}if(A.element(a)||(a=s&&s.querySelector('[role="menu"]')),!A.element(a))return;this.elements.settings.buttons[e].querySelector(`.${this.config.classNames.menu.value}`).innerHTML=Me.getLabel.call(this,e,n);const r=a&&a.querySelector(`[value="${n}"]`);A.element(r)&&(r.checked=!0)},getLabel(e,t){switch(e){case"speed":return 1===t?we.get("normal",this.config):`${t}×`;case"quality":if(A.number(t)){const e=we.get(`qualityLabel.${t}`,this.config);return e.length?e:`${t}p`}return fe(t);case"captions":return Ne.getLabel.call(this);default:return null}},setQualityMenu(e){if(!A.element(this.elements.settings.panels.quality))return;const t="quality",i=this.elements.settings.panels.quality.querySelector('[role="menu"]');A.array(e)&&(this.options.quality=ne(e).filter((e=>this.config.quality.options.includes(e))));const s=!A.empty(this.options.quality)&&this.options.quality.length>1;if(Me.toggleMenuButton.call(this,t,s),R(i),Me.checkMenu.call(this),!s)return;const n=e=>{const t=we.get(`qualityBadge.${e}`,this.config);return t.length?Me.createBadge.call(this,t):null};this.options.quality.sort(((e,t)=>{const i=this.config.quality.options;return i.indexOf(e)>i.indexOf(t)?1:-1})).forEach((e=>{Me.createMenuItem.call(this,{value:e,list:i,type:t,title:Me.getLabel.call(this,"quality",e),badge:n(e)})})),Me.updateSetting.call(this,t,i)},setCaptionsMenu(){if(!A.element(this.elements.settings.panels.captions))return;const e="captions",t=this.elements.settings.panels.captions.querySelector('[role="menu"]'),i=Ne.getTracks.call(this),s=Boolean(i.length);if(Me.toggleMenuButton.call(this,e,s),R(t),Me.checkMenu.call(this),!s)return;const n=i.map(((e,i)=>({value:i,checked:this.captions.toggled&&this.currentTrack===i,title:Ne.getLabel.call(this,e),badge:e.language&&Me.createBadge.call(this,e.language.toUpperCase()),list:t,type:"language"})));n.unshift({value:-1,checked:!this.captions.toggled,title:we.get("disabled",this.config),list:t,type:"language"}),n.forEach(Me.createMenuItem.bind(this)),Me.updateSetting.call(this,e,t)},setSpeedMenu(){if(!A.element(this.elements.settings.panels.speed))return;const e="speed",t=this.elements.settings.panels.speed.querySelector('[role="menu"]');this.options.speed=this.options.speed.filter((e=>e>=this.minimumSpeed&&e<=this.maximumSpeed));const i=!A.empty(this.options.speed)&&this.options.speed.length>1;Me.toggleMenuButton.call(this,e,i),R(t),Me.checkMenu.call(this),i&&(this.options.speed.forEach((i=>{Me.createMenuItem.call(this,{value:i,list:t,type:e,title:Me.getLabel.call(this,"speed",i)})})),Me.updateSetting.call(this,e,t))},checkMenu(){const{buttons:e}=this.elements.settings,t=!A.empty(e)&&Object.values(e).some((e=>!e.hidden));H(this.elements.settings.menu,!t)},focusFirstMenuItem(e,t=!1){if(this.elements.settings.popup.hidden)return;let i=e;A.element(i)||(i=Object.values(this.elements.settings.panels).find((e=>!e.hidden)));const s=i.querySelector('[role^="menuitem"]');z.call(this,s,t)},toggleMenu(e){const{popup:t}=this.elements.settings,i=this.elements.buttons.settings;if(!A.element(t)||!A.element(i))return;const{hidden:s}=t;let n=s;if(A.boolean(e))n=e;else if(A.keyboardEvent(e)&&"Escape"===e.key)n=!1;else if(A.event(e)){const s=A.function(e.composedPath)?e.composedPath()[0]:e.target,a=t.contains(s);if(a||!a&&e.target!==i&&n)return}i.setAttribute("aria-expanded",n),H(t,!n),F(this.elements.container,this.config.classNames.menu.open,n),n&&A.keyboardEvent(e)?Me.focusFirstMenuItem.call(this,null,!0):n||s||z.call(this,i,A.keyboardEvent(e))},getMenuSize(e){const t=e.cloneNode(!0);t.style.position="absolute",t.style.opacity=0,t.removeAttribute("hidden"),e.parentNode.appendChild(t);const i=t.scrollWidth,s=t.scrollHeight;return j(t),{width:i,height:s}},showMenuPanel(e="",t=!1){const i=this.elements.container.querySelector(`#plyr-settings-${this.id}-${e}`);if(!A.element(i))return;const s=i.parentNode,n=Array.from(s.children).find((e=>!e.hidden));if(Y.transitions&&!Y.reducedMotion){s.style.width=`${n.scrollWidth}px`,s.style.height=`${n.scrollHeight}px`;const e=Me.getMenuSize.call(this,i),t=e=>{e.target===s&&["width","height"].includes(e.propertyName)&&(s.style.width="",s.style.height="",G.call(this,s,P,t))};J.call(this,s,P,t),s.style.width=`${e.width}px`,s.style.height=`${e.height}px`}H(n,!0),H(i,!1),Me.focusFirstMenuItem.call(this,i,t)},setDownloadUrl(){const e=this.elements.buttons.download;A.element(e)&&e.setAttribute("href",this.download)},create(e){const{bindMenuItemShortcuts:t,createButton:i,createProgress:s,createRange:n,createTime:a,setQualityMenu:r,setSpeedMenu:o,showMenuPanel:l}=Me;this.elements.controls=null,A.array(this.config.controls)&&this.config.controls.includes("play-large")&&this.elements.container.appendChild(i.call(this,"play-large"));const c=O("div",q(this.config.selectors.controls.wrapper));this.elements.controls=c;const u={class:"plyr__controls__item"};return ne(A.array(this.config.controls)?this.config.controls:[]).forEach((r=>{if("restart"===r&&c.appendChild(i.call(this,"restart",u)),"rewind"===r&&c.appendChild(i.call(this,"rewind",u)),"play"===r&&c.appendChild(i.call(this,"play",u)),"fast-forward"===r&&c.appendChild(i.call(this,"fast-forward",u)),"progress"===r){const t=O("div",{class:`${u.class} plyr__progress__container`}),i=O("div",q(this.config.selectors.progress));if(i.appendChild(n.call(this,"seek",{id:`plyr-seek-${e.id}`})),i.appendChild(s.call(this,"buffer")),this.config.tooltips.seek){const e=O("span",{class:this.config.classNames.tooltip},"00:00");i.appendChild(e),this.elements.display.seekTooltip=e}this.elements.progress=i,t.appendChild(this.elements.progress),c.appendChild(t)}if("current-time"===r&&c.appendChild(a.call(this,"currentTime",u)),"duration"===r&&c.appendChild(a.call(this,"duration",u)),"mute"===r||"volume"===r){let{volume:t}=this.elements;if(A.element(t)&&c.contains(t)||(t=O("div",N({},u,{class:`${u.class} plyr__volume`.trim()})),this.elements.volume=t,c.appendChild(t)),"mute"===r&&t.appendChild(i.call(this,"mute")),"volume"===r&&!x.isIos&&!x.isIPadOS){const i={max:1,step:.05,value:this.config.volume};t.appendChild(n.call(this,"volume",N(i,{id:`plyr-volume-${e.id}`})))}}if("captions"===r&&c.appendChild(i.call(this,"captions",u)),"settings"===r&&!A.empty(this.config.settings)){const s=O("div",N({},u,{class:`${u.class} plyr__menu`.trim(),hidden:""}));s.appendChild(i.call(this,"settings",{"aria-haspopup":!0,"aria-controls":`plyr-settings-${e.id}`,"aria-expanded":!1}));const n=O("div",{class:"plyr__menu__container",id:`plyr-settings-${e.id}`,hidden:""}),a=O("div"),r=O("div",{id:`plyr-settings-${e.id}-home`}),o=O("div",{role:"menu"});r.appendChild(o),a.appendChild(r),this.elements.settings.panels.home=r,this.config.settings.forEach((i=>{const s=O("button",N(q(this.config.selectors.buttons.settings),{type:"button",class:`${this.config.classNames.control} ${this.config.classNames.control}--forward`,role:"menuitem","aria-haspopup":!0,hidden:""}));t.call(this,s,i),J.call(this,s,"click",(()=>{l.call(this,i,!1)}));const n=O("span",null,we.get(i,this.config)),r=O("span",{class:this.config.classNames.menu.value});r.innerHTML=e[i],n.appendChild(r),s.appendChild(n),o.appendChild(s);const c=O("div",{id:`plyr-settings-${e.id}-${i}`,hidden:""}),u=O("button",{type:"button",class:`${this.config.classNames.control} ${this.config.classNames.control}--back`});u.appendChild(O("span",{"aria-hidden":!0},we.get(i,this.config))),u.appendChild(O("span",{class:this.config.classNames.hidden},we.get("menuBack",this.config))),J.call(this,c,"keydown",(e=>{"ArrowLeft"===e.key&&(e.preventDefault(),e.stopPropagation(),l.call(this,"home",!0))}),!1),J.call(this,u,"click",(()=>{l.call(this,"home",!1)})),c.appendChild(u),c.appendChild(O("div",{role:"menu"})),a.appendChild(c),this.elements.settings.buttons[i]=s,this.elements.settings.panels[i]=c})),n.appendChild(a),s.appendChild(n),c.appendChild(s),this.elements.settings.popup=n,this.elements.settings.menu=s}if("pip"===r&&Y.pip&&c.appendChild(i.call(this,"pip",u)),"airplay"===r&&Y.airplay&&c.appendChild(i.call(this,"airplay",u)),"download"===r){const e=N({},u,{element:"a",href:this.download,target:"_blank"});this.isHTML5&&(e.download="");const{download:t}=this.config.urls;!A.url(t)&&this.isEmbed&&N(e,{icon:`logo-${this.provider}`,label:this.provider}),c.appendChild(i.call(this,"download",e))}"fullscreen"===r&&c.appendChild(i.call(this,"fullscreen",u))})),this.isHTML5&&r.call(this,me.getQualityOptions.call(this)),o.call(this),c},inject(){if(this.config.loadSprite){const e=Me.getIconUrl.call(this);e.cors&&Ee(e.url,"sprite-plyr")}this.id=Math.floor(1e4*Math.random());let e=null;this.elements.controls=null;const t={id:this.id,seektime:this.config.seekTime,title:this.config.title};let i=!0;A.function(this.config.controls)&&(this.config.controls=this.config.controls.call(this,t)),this.config.controls||(this.config.controls=[]),A.element(this.config.controls)||A.string(this.config.controls)?e=this.config.controls:(e=Me.create.call(this,{id:this.id,seektime:this.config.seekTime,speed:this.speed,quality:this.quality,captions:Ne.getLabel.call(this)}),i=!1);let s;i&&A.string(this.config.controls)&&(e=(e=>{let i=e;return Object.entries(t).forEach((([e,t])=>{i=ge(i,`{${e}}`,t)})),i})(e)),A.string(this.config.selectors.controls.container)&&(s=document.querySelector(this.config.selectors.controls.container)),A.element(s)||(s=this.elements.container);if(s[A.element(e)?"insertAdjacentElement":"insertAdjacentHTML"]("afterbegin",e),A.element(this.elements.controls)||Me.findElements.call(this),!A.empty(this.elements.buttons)){const e=e=>{const t=this.config.classNames.controlPressed;e.setAttribute("aria-pressed","false"),Object.defineProperty(e,"pressed",{configurable:!0,enumerable:!0,get:()=>U(e,t),set(i=!1){F(e,t,i),e.setAttribute("aria-pressed",i?"true":"false")}})};Object.values(this.elements.buttons).filter(Boolean).forEach((t=>{A.array(t)||A.nodeList(t)?Array.from(t).filter(Boolean).forEach(e):e(t)}))}if(x.isEdge&&M(s),this.config.tooltips.controls){const{classNames:e,selectors:t}=this.config,i=`${t.controls.wrapper} ${t.labels} .${e.hidden}`,s=B.call(this,i);Array.from(s).forEach((e=>{F(e,this.config.classNames.hidden,!1),F(e,this.config.classNames.tooltip,!0)}))}},setMediaMetadata(){try{"mediaSession"in navigator&&(navigator.mediaSession.metadata=new window.MediaMetadata({title:this.config.mediaMetadata.title,artist:this.config.mediaMetadata.artist,album:this.config.mediaMetadata.album,artwork:this.config.mediaMetadata.artwork}))}catch(e){}},setMarkers(){var e,t;if(!this.duration||this.elements.markers)return;const i=null===(e=this.config.markers)||void 0===e||null===(t=e.points)||void 0===t?void 0:t.filter((({time:e})=>e>0&&e<this.duration));if(null==i||!i.length)return;const s=document.createDocumentFragment(),n=document.createDocumentFragment();let a=null;const r=`${this.config.classNames.tooltip}--visible`,o=e=>F(a,r,e);i.forEach((e=>{const t=O("span",{class:this.config.classNames.marker},""),i=e.time/this.duration*100+"%";a&&(t.addEventListener("mouseenter",(()=>{e.label||(a.style.left=i,a.innerHTML=e.label,o(!0))})),t.addEventListener("mouseleave",(()=>{o(!1)}))),t.addEventListener("click",(()=>{this.currentTime=e.time})),t.style.left=i,n.appendChild(t)})),s.appendChild(n),this.config.tooltips.seek||(a=O("span",{class:this.config.classNames.tooltip},""),s.appendChild(a)),this.elements.markers={points:n,tip:a},this.elements.progress.appendChild(s)}};function xe(e,t=!0){let i=e;if(t){const e=document.createElement("a");e.href=i,i=e.href}try{return new URL(i)}catch(e){return null}}function Le(e){const t=new URLSearchParams;return A.object(e)&&Object.entries(e).forEach((([e,i])=>{t.set(e,i)})),t}const Ne={setup(){if(!this.supported.ui)return;if(!this.isVideo||this.isYouTube||this.isHTML5&&!Y.textTracks)return void(A.array(this.config.controls)&&this.config.controls.includes("settings")&&this.config.settings.includes("captions")&&Me.setCaptionsMenu.call(this));var e,t;if(A.element(this.elements.captions)||(this.elements.captions=O("div",q(this.config.selectors.captions)),this.elements.captions.setAttribute("dir","auto"),e=this.elements.captions,t=this.elements.wrapper,A.element(e)&&A.element(t)&&t.parentNode.insertBefore(e,t.nextSibling)),x.isIE&&window.URL){const e=this.media.querySelectorAll("track");Array.from(e).forEach((e=>{const t=e.getAttribute("src"),i=xe(t);null!==i&&i.hostname!==window.location.href.hostname&&["http:","https:"].includes(i.protocol)&&ke(t,"blob").then((t=>{e.setAttribute("src",window.URL.createObjectURL(t))})).catch((()=>{j(e)}))}))}const i=ne((navigator.languages||[navigator.language||navigator.userLanguage||"en"]).map((e=>e.split("-")[0])));let s=(this.storage.get("language")||this.config.captions.language||"auto").toLowerCase();"auto"===s&&([s]=i);let n=this.storage.get("captions");if(A.boolean(n)||({active:n}=this.config.captions),Object.assign(this.captions,{toggled:!1,active:n,language:s,languages:i}),this.isHTML5){const e=this.config.captions.update?"addtrack removetrack":"removetrack";J.call(this,this.media.textTracks,e,Ne.update.bind(this))}setTimeout(Ne.update.bind(this),0)},update(){const e=Ne.getTracks.call(this,!0),{active:t,language:i,meta:s,currentTrackNode:n}=this.captions,a=Boolean(e.find((e=>e.language===i)));this.isHTML5&&this.isVideo&&e.filter((e=>!s.get(e))).forEach((e=>{this.debug.log("Track added",e),s.set(e,{default:"showing"===e.mode}),"showing"===e.mode&&(e.mode="hidden"),J.call(this,e,"cuechange",(()=>Ne.updateCues.call(this)))})),(a&&this.language!==i||!e.includes(n))&&(Ne.setLanguage.call(this,i),Ne.toggle.call(this,t&&a)),this.elements&&F(this.elements.container,this.config.classNames.captions.enabled,!A.empty(e)),A.array(this.config.controls)&&this.config.controls.includes("settings")&&this.config.settings.includes("captions")&&Me.setCaptionsMenu.call(this)},toggle(e,t=!0){if(!this.supported.ui)return;const{toggled:i}=this.captions,s=this.config.classNames.captions.active,n=A.nullOrUndefined(e)?!i:e;if(n!==i){if(t||(this.captions.active=n,this.storage.set({captions:n})),!this.language&&n&&!t){const e=Ne.getTracks.call(this),t=Ne.findTrack.call(this,[this.captions.language,...this.captions.languages],!0);return this.captions.language=t.language,void Ne.set.call(this,e.indexOf(t))}this.elements.buttons.captions&&(this.elements.buttons.captions.pressed=n),F(this.elements.container,s,n),this.captions.toggled=n,Me.updateSetting.call(this,"captions"),ee.call(this,this.media,n?"captionsenabled":"captionsdisabled")}setTimeout((()=>{n&&this.captions.toggled&&(this.captions.currentTrackNode.mode="hidden")}))},set(e,t=!0){const i=Ne.getTracks.call(this);if(-1!==e)if(A.number(e))if(e in i){if(this.captions.currentTrack!==e){this.captions.currentTrack=e;const s=i[e],{language:n}=s||{};this.captions.currentTrackNode=s,Me.updateSetting.call(this,"captions"),t||(this.captions.language=n,this.storage.set({language:n})),this.isVimeo&&this.embed.enableTextTrack(n),ee.call(this,this.media,"languagechange")}Ne.toggle.call(this,!0,t),this.isHTML5&&this.isVideo&&Ne.updateCues.call(this)}else this.debug.warn("Track not found",e);else this.debug.warn("Invalid caption argument",e);else Ne.toggle.call(this,!1,t)},setLanguage(e,t=!0){if(!A.string(e))return void this.debug.warn("Invalid language argument",e);const i=e.toLowerCase();this.captions.language=i;const s=Ne.getTracks.call(this),n=Ne.findTrack.call(this,[i]);Ne.set.call(this,s.indexOf(n),t)},getTracks(e=!1){return Array.from((this.media||{}).textTracks||[]).filter((t=>!this.isHTML5||e||this.captions.meta.has(t))).filter((e=>["captions","subtitles"].includes(e.kind)))},findTrack(e,t=!1){const i=Ne.getTracks.call(this),s=e=>Number((this.captions.meta.get(e)||{}).default),n=Array.from(i).sort(((e,t)=>s(t)-s(e)));let a;return e.every((e=>(a=n.find((t=>t.language===e)),!a))),a||(t?n[0]:void 0)},getCurrentTrack(){return Ne.getTracks.call(this)[this.currentTrack]},getLabel(e){let t=e;return!A.track(t)&&Y.textTracks&&this.captions.toggled&&(t=Ne.getCurrentTrack.call(this)),A.track(t)?A.empty(t.label)?A.empty(t.language)?we.get("enabled",this.config):e.language.toUpperCase():t.label:we.get("disabled",this.config)},updateCues(e){if(!this.supported.ui)return;if(!A.element(this.elements.captions))return void this.debug.warn("No captions element to render to");if(!A.nullOrUndefined(e)&&!Array.isArray(e))return void this.debug.warn("updateCues: Invalid input",e);let t=e;if(!t){const e=Ne.getCurrentTrack.call(this);t=Array.from((e||{}).activeCues||[]).map((e=>e.getCueAsHTML())).map(be)}const i=t.map((e=>e.trim())).join("\n");if(i!==this.elements.captions.innerHTML){R(this.elements.captions);const e=O("span",q(this.config.selectors.caption));e.innerHTML=i,this.elements.captions.appendChild(e),ee.call(this,this.media,"cuechange")}}},_e={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:"https://cdn.plyr.io/3.7.8/plyr.svg",blankVideo:"https://cdn.plyr.io/static/blank.mp4",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/oembed.json?url={0}"},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",marker:"plyr__progress__marker",hidden:"plyr__sr-only",hideControls:"plyr--hide-controls",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"},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",hash:"data-plyr-embed-hash"}},ads:{enabled:!1,publisherId:"",tagUrl:""},previewThumbnails:{enabled:!1,src:""},vimeo:{byline:!1,portrait:!1,title:!1,speed:!0,transparent:!1,customControls:!0,referrerPolicy:null,premium:!1},youtube:{rel:0,showinfo:0,iv_load_policy:3,modestbranding:1,customControls:!0,noCookie:!1},mediaMetadata:{title:"",artist:"",album:"",artwork:[]},markers:{enabled:!1,points:[]}},Ie="picture-in-picture",Oe="inline",$e={html5:"html5",youtube:"youtube",vimeo:"vimeo"},je="audio",Re="video";const De=()=>{};class qe{constructor(e=!1){this.enabled=window.console&&e,this.enabled&&this.log("Debugging enabled")}get log(){return this.enabled?Function.prototype.bind.call(console.log,console):De}get warn(){return this.enabled?Function.prototype.bind.call(console.warn,console):De}get error(){return this.enabled?Function.prototype.bind.call(console.error,console):De}}class He{constructor(e){t(this,"onChange",(()=>{if(!this.supported)return;const e=this.player.elements.buttons.fullscreen;A.element(e)&&(e.pressed=this.active);const t=this.target===this.player.media?this.target:this.player.elements.container;ee.call(this.player,t,this.active?"enterfullscreen":"exitfullscreen",!0)})),t(this,"toggleFallback",((e=!1)=>{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":"",F(this.target,this.player.config.classNames.fullscreen.fallback,e),x.isIos){let t=document.head.querySelector('meta[name="viewport"]');const i="viewport-fit=cover";t||(t=document.createElement("meta"),t.setAttribute("name","viewport"));const s=A.string(t.content)&&t.content.includes(i);e?(this.cleanupViewport=!s,s||(t.content+=`,${i}`)):this.cleanupViewport&&(t.content=t.content.split(",").filter((e=>e.trim()!==i)).join(","))}this.onChange()})),t(this,"trapFocus",(e=>{if(x.isIos||x.isIPadOS||!this.active||"Tab"!==e.key)return;const t=document.activeElement,i=B.call(this.player,"a[href], button:not(:disabled), input:not(:disabled), [tabindex]"),[s]=i,n=i[i.length-1];t!==n||e.shiftKey?t===s&&e.shiftKey&&(n.focus(),e.preventDefault()):(s.focus(),e.preventDefault())})),t(this,"update",(()=>{if(this.supported){let e;e=this.forceFallback?"Fallback (forced)":He.nativeSupported?"Native":"Fallback",this.player.debug.log(`${e} fullscreen enabled`)}else this.player.debug.log("Fullscreen not supported and fallback disabled");F(this.player.elements.container,this.player.config.classNames.fullscreen.enabled,this.supported)})),t(this,"enter",(()=>{this.supported&&(x.isIos&&this.player.config.fullscreen.iosNative?this.player.isVimeo?this.player.embed.requestFullscreen():this.target.webkitEnterFullscreen():!He.nativeSupported||this.forceFallback?this.toggleFallback(!0):this.prefix?A.empty(this.prefix)||this.target[`${this.prefix}Request${this.property}`]():this.target.requestFullscreen({navigationUI:"hide"}))})),t(this,"exit",(()=>{if(this.supported)if(x.isIos&&this.player.config.fullscreen.iosNative)this.player.isVimeo?this.player.embed.exitFullscreen():this.target.webkitEnterFullscreen(),se(this.player.play());else if(!He.nativeSupported||this.forceFallback)this.toggleFallback(!1);else if(this.prefix){if(!A.empty(this.prefix)){const e="moz"===this.prefix?"Cancel":"Exit";document[`${this.prefix}${e}${this.property}`]()}}else(document.cancelFullScreen||document.exitFullscreen).call(document)})),t(this,"toggle",(()=>{this.active?this.exit():this.enter()})),this.player=e,this.prefix=He.prefix,this.property=He.property,this.scrollPosition={x:0,y:0},this.forceFallback="force"===e.config.fullscreen.fallback,this.player.elements.fullscreen=e.config.fullscreen.container&&function(e,t){const{prototype:i}=Element;return(i.closest||function(){let e=this;do{if(V.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,e.config.fullscreen.container),J.call(this.player,document,"ms"===this.prefix?"MSFullscreenChange":`${this.prefix}fullscreenchange`,(()=>{this.onChange()})),J.call(this.player,this.player.elements.container,"dblclick",(e=>{A.element(this.player.elements.controls)&&this.player.elements.controls.contains(e.target)||this.player.listeners.proxy(e,this.toggle,"fullscreen")})),J.call(this,this.player.elements.container,"keydown",(e=>this.trapFocus(e))),this.update()}static get nativeSupported(){return!!(document.fullscreenEnabled||document.webkitFullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled)}get useNative(){return He.nativeSupported&&!this.forceFallback}static get prefix(){if(A.function(document.exitFullscreen))return"";let e="";return["webkit","moz","ms"].some((t=>!(!A.function(document[`${t}ExitFullscreen`])&&!A.function(document[`${t}CancelFullScreen`]))&&(e=t,!0))),e}static get property(){return"moz"===this.prefix?"FullScreen":"Fullscreen"}get supported(){return[this.player.config.fullscreen.enabled,this.player.isVideo,He.nativeSupported||this.player.config.fullscreen.fallback,!this.player.isYouTube||He.nativeSupported||!x.isIos||this.player.config.playsinline&&!this.player.config.fullscreen.iosNative].every(Boolean)}get active(){if(!this.supported)return!1;if(!He.nativeSupported||this.forceFallback)return U(this.target,this.player.config.classNames.fullscreen.fallback);const e=this.prefix?this.target.getRootNode()[`${this.prefix}${this.property}Element`]:this.target.getRootNode().fullscreenElement;return e&&e.shadowRoot?e===this.target.getRootNode().host:e===this.target}get target(){return x.isIos&&this.player.config.fullscreen.iosNative?this.player.media:this.player.elements.fullscreen??this.player.elements.container}}function Fe(e,t=1){return new Promise(((i,s)=>{const n=new Image,a=()=>{delete n.onload,delete n.onerror,(n.naturalWidth>=t?i:s)(n)};Object.assign(n,{onload:a,onerror:a,src:e})}))}const Ue={addStyleHook(){F(this.elements.container,this.config.selectors.container.replace(".",""),!0),F(this.elements.container,this.config.classNames.uiSupported,this.supported.ui)},toggleNativeControls(e=!1){e&&this.isHTML5?this.media.setAttribute("controls",""):this.media.removeAttribute("controls")},build(){if(this.listeners.media(),!this.supported.ui)return this.debug.warn(`Basic support only for ${this.provider} ${this.type}`),void Ue.toggleNativeControls.call(this,!0);A.element(this.elements.controls)||(Me.inject.call(this),this.listeners.controls()),Ue.toggleNativeControls.call(this),this.isHTML5&&Ne.setup.call(this),this.volume=null,this.muted=null,this.loop=null,this.quality=null,this.speed=null,Me.updateVolume.call(this),Me.timeUpdate.call(this),Me.durationUpdate.call(this),Ue.checkPlaying.call(this),F(this.elements.container,this.config.classNames.pip.supported,Y.pip&&this.isHTML5&&this.isVideo),F(this.elements.container,this.config.classNames.airplay.supported,Y.airplay&&this.isHTML5),F(this.elements.container,this.config.classNames.isTouch,this.touch),this.ready=!0,setTimeout((()=>{ee.call(this,this.media,"ready")}),0),Ue.setTitle.call(this),this.poster&&Ue.setPoster.call(this,this.poster,!1).catch((()=>{})),this.config.duration&&Me.durationUpdate.call(this),this.config.mediaMetadata&&Me.setMediaMetadata.call(this)},setTitle(){let e=we.get("play",this.config);if(A.string(this.config.title)&&!A.empty(this.config.title)&&(e+=`, ${this.config.title}`),Array.from(this.elements.buttons.play||[]).forEach((t=>{t.setAttribute("aria-label",e)})),this.isEmbed){const e=W.call(this,"iframe");if(!A.element(e))return;const t=A.empty(this.config.title)?"video":this.config.title,i=we.get("frameTitle",this.config);e.setAttribute("title",i.replace("{title}",t))}},togglePoster(e){F(this.elements.container,this.config.classNames.posterEnabled,e)},setPoster(e,t=!0){return t&&this.poster?Promise.reject(new Error("Poster already set")):(this.media.setAttribute("data-poster",e),this.elements.poster.removeAttribute("hidden"),ie.call(this).then((()=>Fe(e))).catch((t=>{throw e===this.poster&&Ue.togglePoster.call(this,!1),t})).then((()=>{if(e!==this.poster)throw new Error("setPoster cancelled by later call to setPoster")})).then((()=>(Object.assign(this.elements.poster.style,{backgroundImage:`url('${e}')`,backgroundSize:""}),Ue.togglePoster.call(this,!0),e))))},checkPlaying(e){F(this.elements.container,this.config.classNames.playing,this.playing),F(this.elements.container,this.config.classNames.paused,this.paused),F(this.elements.container,this.config.classNames.stopped,this.stopped),Array.from(this.elements.buttons.play||[]).forEach((e=>{Object.assign(e,{pressed:this.playing}),e.setAttribute("aria-label",we.get(this.playing?"pause":"play",this.config))})),A.event(e)&&"timeupdate"===e.type||Ue.toggleControls.call(this)},checkLoading(e){this.loading=["stalled","waiting"].includes(e.type),clearTimeout(this.timers.loading),this.timers.loading=setTimeout((()=>{F(this.elements.container,this.config.classNames.loading,this.loading),Ue.toggleControls.call(this)}),this.loading?250:0)},toggleControls(e){const{controls:t}=this.elements;if(t&&this.config.hideControls){const i=this.touch&&this.lastSeekTime+2e3>Date.now();this.toggleControls(Boolean(e||this.loading||this.paused||t.pressed||t.hover||i))}},migrateStyles(){Object.values({...this.media.style}).filter((e=>!A.empty(e)&&A.string(e)&&e.startsWith("--plyr"))).forEach((e=>{this.elements.container.style.setProperty(e,this.media.style.getPropertyValue(e)),this.media.style.removeProperty(e)})),A.empty(this.media.style)&&this.media.removeAttribute("style")}};class Ve{constructor(e){t(this,"firstTouch",(()=>{const{player:e}=this,{elements:t}=e;e.touch=!0,F(t.container,e.config.classNames.isTouch,!0)})),t(this,"global",((e=!0)=>{const{player:t}=this;t.config.keyboard.global&&X.call(t,window,"keydown keyup",this.handleKey,e,!1),X.call(t,document.body,"click",this.toggleMenu,e),Z.call(t,document.body,"touchstart",this.firstTouch)})),t(this,"container",(()=>{const{player:e}=this,{config:t,elements:i,timers:s}=e;!t.keyboard.global&&t.keyboard.focused&&J.call(e,i.container,"keydown keyup",this.handleKey,!1),J.call(e,i.container,"mousemove mouseleave touchstart touchmove enterfullscreen exitfullscreen",(t=>{const{controls:n}=i;n&&"enterfullscreen"===t.type&&(n.pressed=!1,n.hover=!1);let a=0;["touchstart","touchmove","mousemove"].includes(t.type)&&(Ue.toggleControls.call(e,!0),a=e.touch?3e3:2e3),clearTimeout(s.controls),s.controls=setTimeout((()=>Ue.toggleControls.call(e,!1)),a)}));const n=()=>{if(!e.isVimeo||e.config.vimeo.premium)return;const t=i.wrapper,{active:s}=e.fullscreen,[n,a]=ue.call(e),r=re(`aspect-ratio: ${n} / ${a}`);if(!s)return void(r?(t.style.width=null,t.style.height=null):(t.style.maxWidth=null,t.style.margin=null));const[o,l]=[Math.max(document.documentElement.clientWidth||0,window.innerWidth||0),Math.max(document.documentElement.clientHeight||0,window.innerHeight||0)],c=o/l>n/a;r?(t.style.width=c?"auto":"100%",t.style.height=c?"100%":"auto"):(t.style.maxWidth=c?l/a*n+"px":null,t.style.margin=c?"0 auto":null)},a=()=>{clearTimeout(s.resized),s.resized=setTimeout(n,50)};J.call(e,i.container,"enterfullscreen exitfullscreen",(t=>{const{target:s}=e.fullscreen;if(s!==i.container)return;if(!e.isEmbed&&A.empty(e.config.ratio))return;n();("enterfullscreen"===t.type?J:G).call(e,window,"resize",a)}))})),t(this,"media",(()=>{const{player:e}=this,{elements:t}=e;if(J.call(e,e.media,"timeupdate seeking seeked",(t=>Me.timeUpdate.call(e,t))),J.call(e,e.media,"durationchange loadeddata loadedmetadata",(t=>Me.durationUpdate.call(e,t))),J.call(e,e.media,"ended",(()=>{e.isHTML5&&e.isVideo&&e.config.resetOnEnd&&(e.restart(),e.pause())})),J.call(e,e.media,"progress playing seeking seeked",(t=>Me.updateProgress.call(e,t))),J.call(e,e.media,"volumechange",(t=>Me.updateVolume.call(e,t))),J.call(e,e.media,"playing play pause ended emptied timeupdate",(t=>Ue.checkPlaying.call(e,t))),J.call(e,e.media,"waiting canplay seeked playing",(t=>Ue.checkLoading.call(e,t))),e.supported.ui&&e.config.clickToPlay&&!e.isAudio){const i=W.call(e,`.${e.config.classNames.video}`);if(!A.element(i))return;J.call(e,t.container,"click",(s=>{([t.container,i].includes(s.target)||i.contains(s.target))&&(e.touch&&e.config.hideControls||(e.ended?(this.proxy(s,e.restart,"restart"),this.proxy(s,(()=>{se(e.play())}),"play")):this.proxy(s,(()=>{se(e.togglePlay())}),"play")))}))}e.supported.ui&&e.config.disableContextMenu&&J.call(e,t.wrapper,"contextmenu",(e=>{e.preventDefault()}),!1),J.call(e,e.media,"volumechange",(()=>{e.storage.set({volume:e.volume,muted:e.muted})})),J.call(e,e.media,"ratechange",(()=>{Me.updateSetting.call(e,"speed"),e.storage.set({speed:e.speed})})),J.call(e,e.media,"qualitychange",(t=>{Me.updateSetting.call(e,"quality",null,t.detail.quality)})),J.call(e,e.media,"ready qualitychange",(()=>{Me.setDownloadUrl.call(e)}));const i=e.config.events.concat(["keyup","keydown"]).join(" ");J.call(e,e.media,i,(i=>{let{detail:s={}}=i;"error"===i.type&&(s=e.media.error),ee.call(e,t.container,i.type,!0,s)}))})),t(this,"proxy",((e,t,i)=>{const{player:s}=this,n=s.config.listeners[i];let a=!0;A.function(n)&&(a=n.call(s,e)),!1!==a&&A.function(t)&&t.call(s,e)})),t(this,"bind",((e,t,i,s,n=!0)=>{const{player:a}=this,r=a.config.listeners[s],o=A.function(r);J.call(a,e,t,(e=>this.proxy(e,i,s)),n&&!o)})),t(this,"controls",(()=>{const{player:e}=this,{elements:t}=e,i=x.isIE?"change":"input";if(t.buttons.play&&Array.from(t.buttons.play).forEach((t=>{this.bind(t,"click",(()=>{se(e.togglePlay())}),"play")})),this.bind(t.buttons.restart,"click",e.restart,"restart"),this.bind(t.buttons.rewind,"click",(()=>{e.lastSeekTime=Date.now(),e.rewind()}),"rewind"),this.bind(t.buttons.fastForward,"click",(()=>{e.lastSeekTime=Date.now(),e.forward()}),"fastForward"),this.bind(t.buttons.mute,"click",(()=>{e.muted=!e.muted}),"mute"),this.bind(t.buttons.captions,"click",(()=>e.toggleCaptions())),this.bind(t.buttons.download,"click",(()=>{ee.call(e,e.media,"download")}),"download"),this.bind(t.buttons.fullscreen,"click",(()=>{e.fullscreen.toggle()}),"fullscreen"),this.bind(t.buttons.pip,"click",(()=>{e.pip="toggle"}),"pip"),this.bind(t.buttons.airplay,"click",e.airplay,"airplay"),this.bind(t.buttons.settings,"click",(t=>{t.stopPropagation(),t.preventDefault(),Me.toggleMenu.call(e,t)}),null,!1),this.bind(t.buttons.settings,"keyup",(t=>{[" ","Enter"].includes(t.key)&&("Enter"!==t.key?(t.preventDefault(),t.stopPropagation(),Me.toggleMenu.call(e,t)):Me.focusFirstMenuItem.call(e,null,!0))}),null,!1),this.bind(t.settings.menu,"keydown",(t=>{"Escape"===t.key&&Me.toggleMenu.call(e,t)})),this.bind(t.inputs.seek,"mousedown mousemove",(e=>{const i=t.progress.getBoundingClientRect(),s=100/i.width*(e.pageX-i.left);e.currentTarget.setAttribute("seek-value",s)})),this.bind(t.inputs.seek,"mousedown mouseup keydown keyup touchstart touchend",(t=>{const i=t.currentTarget,s="play-on-seeked";if(A.keyboardEvent(t)&&!["ArrowLeft","ArrowRight"].includes(t.key))return;e.lastSeekTime=Date.now();const n=i.hasAttribute(s),a=["mouseup","touchend","keyup"].includes(t.type);n&&a?(i.removeAttribute(s),se(e.play())):!a&&e.playing&&(i.setAttribute(s,""),e.pause())})),x.isIos){const t=B.call(e,'input[type="range"]');Array.from(t).forEach((e=>this.bind(e,i,(e=>M(e.target)))))}this.bind(t.inputs.seek,i,(t=>{const i=t.currentTarget;let s=i.getAttribute("seek-value");A.empty(s)&&(s=i.value),i.removeAttribute("seek-value"),e.currentTime=s/i.max*e.duration}),"seek"),this.bind(t.progress,"mouseenter mouseleave mousemove",(t=>Me.updateSeekTooltip.call(e,t))),this.bind(t.progress,"mousemove touchmove",(t=>{const{previewThumbnails:i}=e;i&&i.loaded&&i.startMove(t)})),this.bind(t.progress,"mouseleave touchend click",(()=>{const{previewThumbnails:t}=e;t&&t.loaded&&t.endMove(!1,!0)})),this.bind(t.progress,"mousedown touchstart",(t=>{const{previewThumbnails:i}=e;i&&i.loaded&&i.startScrubbing(t)})),this.bind(t.progress,"mouseup touchend",(t=>{const{previewThumbnails:i}=e;i&&i.loaded&&i.endScrubbing(t)})),x.isWebKit&&Array.from(B.call(e,'input[type="range"]')).forEach((t=>{this.bind(t,"input",(t=>Me.updateRangeFill.call(e,t.target)))})),e.config.toggleInvert&&!A.element(t.display.duration)&&this.bind(t.display.currentTime,"click",(()=>{0!==e.currentTime&&(e.config.invertTime=!e.config.invertTime,Me.timeUpdate.call(e))})),this.bind(t.inputs.volume,i,(t=>{e.volume=t.target.value}),"volume"),this.bind(t.controls,"mouseenter mouseleave",(i=>{t.controls.hover=!e.touch&&"mouseenter"===i.type})),t.fullscreen&&Array.from(t.fullscreen.children).filter((e=>!e.contains(t.container))).forEach((i=>{this.bind(i,"mouseenter mouseleave",(i=>{t.controls&&(t.controls.hover=!e.touch&&"mouseenter"===i.type)}))})),this.bind(t.controls,"mousedown mouseup touchstart touchend touchcancel",(e=>{t.controls.pressed=["mousedown","touchstart"].includes(e.type)})),this.bind(t.controls,"focusin",(()=>{const{config:i,timers:s}=e;F(t.controls,i.classNames.noTransition,!0),Ue.toggleControls.call(e,!0),setTimeout((()=>{F(t.controls,i.classNames.noTransition,!1)}),0);const n=this.touch?3e3:4e3;clearTimeout(s.controls),s.controls=setTimeout((()=>Ue.toggleControls.call(e,!1)),n)})),this.bind(t.inputs.volume,"wheel",(t=>{const i=t.webkitDirectionInvertedFromDevice,[s,n]=[t.deltaX,-t.deltaY].map((e=>i?-e:e)),a=Math.sign(Math.abs(s)>Math.abs(n)?s:n);e.increaseVolume(a/50);const{volume:r}=e.media;(1===a&&r<1||-1===a&&r>0)&&t.preventDefault()}),"volume",!1)})),this.player=e,this.lastKey=null,this.focusTimer=null,this.lastKeyDown=null,this.handleKey=this.handleKey.bind(this),this.toggleMenu=this.toggleMenu.bind(this),this.firstTouch=this.firstTouch.bind(this)}handleKey(e){const{player:t}=this,{elements:i}=t,{key:s,type:n,altKey:a,ctrlKey:r,metaKey:o,shiftKey:l}=e,c="keydown"===n,u=c&&s===this.lastKey;if(a||r||o||l)return;if(!s)return;if(c){const n=document.activeElement;if(A.element(n)){const{editable:s}=t.config.selectors,{seek:a}=i.inputs;if(n!==a&&V(n,s))return;if(" "===e.key&&V(n,'button, [role^="menuitem"]'))return}switch([" ","ArrowLeft","ArrowUp","ArrowRight","ArrowDown","0","1","2","3","4","5","6","7","8","9","c","f","k","l","m"].includes(s)&&(e.preventDefault(),e.stopPropagation()),s){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":u||(h=parseInt(s,10),t.currentTime=t.duration/10*h);break;case" ":case"k":u||se(t.togglePlay());break;case"ArrowUp":t.increaseVolume(.1);break;case"ArrowDown":t.decreaseVolume(.1);break;case"m":u||(t.muted=!t.muted);break;case"ArrowRight":t.forward();break;case"ArrowLeft":t.rewind();break;case"f":t.fullscreen.toggle();break;case"c":u||t.toggleCaptions();break;case"l":t.loop=!t.loop}"Escape"===s&&!t.fullscreen.usingNative&&t.fullscreen.active&&t.fullscreen.toggle(),this.lastKey=s}else this.lastKey=null;var h}toggleMenu(e){Me.toggleMenu.call(this.player,e)}}var Be=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(e,t){e.exports=function(){var e=function(){},t={},i={},s={};function n(e,t){e=e.push?e:[e];var n,a,r,o=[],l=e.length,c=l;for(n=function(e,i){i.length&&o.push(e),--c||t(o)};l--;)a=e[l],(r=i[a])?n(a,r):(s[a]=s[a]||[]).push(n)}function a(e,t){if(e){var n=s[e];if(i[e]=t,n)for(;n.length;)n[0](e,t),n.splice(0,1)}}function r(t,i){t.call&&(t={success:t}),i.length?(t.error||e)(i):(t.success||e)(t)}function o(t,i,s,n){var a,r,l=document,c=s.async,u=(s.numRetries||0)+1,h=s.before||e,d=t.replace(/[\?|#].*$/,""),m=t.replace(/^(css|img)!/,"");n=n||0,/(^css!|\.css$)/.test(d)?((r=l.createElement("link")).rel="stylesheet",r.href=m,(a="hideFocus"in r)&&r.relList&&(a=0,r.rel="preload",r.as="style")):/(^img!|\.(png|gif|jpg|svg|webp)$)/.test(d)?(r=l.createElement("img")).src=m:((r=l.createElement("script")).src=t,r.async=void 0===c||c),r.onload=r.onerror=r.onbeforeload=function(e){var l=e.type[0];if(a)try{r.sheet.cssText.length||(l="e")}catch(e){18!=e.code&&(l="e")}if("e"==l){if((n+=1)<u)return o(t,i,s,n)}else if("preload"==r.rel&&"style"==r.as)return r.rel="stylesheet";i(t,l,e.defaultPrevented)},!1!==h(t,r)&&l.head.appendChild(r)}function l(e,t,i){var s,n,a=(e=e.push?e:[e]).length,r=a,l=[];for(s=function(e,i,s){if("e"==i&&l.push(e),"b"==i){if(!s)return;l.push(e)}--a||t(l)},n=0;n<r;n++)o(e[n],s,i)}function c(e,i,s){var n,o;if(i&&i.trim&&(n=i),o=(n?s:i)||{},n){if(n in t)throw"LoadJS";t[n]=!0}function c(t,i){l(e,(function(e){r(o,e),t&&r({success:t,error:i},e),a(n,e)}),o)}if(o.returnPromise)return new Promise(c);c()}return c.ready=function(e,t){return n(e,(function(e){r(t,e)})),c},c.done=function(e){a(e,[])},c.reset=function(){t={},i={},s={}},c.isDefined=function(e){return e in t},c}()}));function We(e){return new Promise(((t,i)=>{Be(e,{success:t,error:i})}))}function ze(e){e&&!this.embed.hasPlayed&&(this.embed.hasPlayed=!0),this.media.paused===e&&(this.media.paused=!e,ee.call(this,this.media,e?"play":"pause"))}const Ke={setup(){const e=this;F(e.elements.wrapper,e.config.classNames.embed,!0),e.options.speed=e.config.speed.options,he.call(e),A.object(window.Vimeo)?Ke.ready.call(e):We(e.config.urls.vimeo.sdk).then((()=>{Ke.ready.call(e)})).catch((t=>{e.debug.warn("Vimeo SDK (player.js) failed to load",t)}))},ready(){const e=this,t=e.config.vimeo,{premium:i,referrerPolicy:s,...n}=t;let a=e.media.getAttribute("src"),r="";A.empty(a)?(a=e.media.getAttribute(e.config.attributes.embed.id),r=e.media.getAttribute(e.config.attributes.embed.hash)):r=function(e){const t=e.match(/^.*(vimeo.com\/|video\/)(\d+)(\?.*&*h=|\/)+([\d,a-f]+)/);return t&&5===t.length?t[4]:null}(a);const o=r?{h:r}:{};i&&Object.assign(n,{controls:!1,sidedock:!1});const l=Le({loop:e.config.loop.active,autoplay:e.autoplay,muted:e.muted,gesture:"media",playsinline:e.config.playsinline,...o,...n}),c=(u=a,A.empty(u)?null:A.number(Number(u))?u:u.match(/^.*(vimeo.com\/|video\/)(\d+).*/)?RegExp.$2:u);var u;const h=O("iframe"),d=pe(e.config.urls.vimeo.iframe,c,l);if(h.setAttribute("src",d),h.setAttribute("allowfullscreen",""),h.setAttribute("allow",["autoplay","fullscreen","picture-in-picture","encrypted-media","accelerometer","gyroscope"].join("; ")),A.empty(s)||h.setAttribute("referrerPolicy",s),i||!t.customControls)h.setAttribute("data-poster",e.poster),e.media=D(h,e.media);else{const t=O("div",{class:e.config.classNames.embedContainer,"data-poster":e.poster});t.appendChild(h),e.media=D(t,e.media)}t.customControls||ke(pe(e.config.urls.vimeo.api,d)).then((t=>{!A.empty(t)&&t.thumbnail_url&&Ue.setPoster.call(e,t.thumbnail_url).catch((()=>{}))})),e.embed=new window.Vimeo.Player(h,{autopause:e.config.autopause,muted:e.muted}),e.media.paused=!0,e.media.currentTime=0,e.supported.ui&&e.embed.disableTextTrack(),e.media.play=()=>(ze.call(e,!0),e.embed.play()),e.media.pause=()=>(ze.call(e,!1),e.embed.pause()),e.media.stop=()=>{e.pause(),e.currentTime=0};let{currentTime:m}=e.media;Object.defineProperty(e.media,"currentTime",{get:()=>m,set(t){const{embed:i,media:s,paused:n,volume:a}=e,r=n&&!i.hasPlayed;s.seeking=!0,ee.call(e,s,"seeking"),Promise.resolve(r&&i.setVolume(0)).then((()=>i.setCurrentTime(t))).then((()=>r&&i.pause())).then((()=>r&&i.setVolume(a))).catch((()=>{}))}});let p=e.config.speed.selected;Object.defineProperty(e.media,"playbackRate",{get:()=>p,set(t){e.embed.setPlaybackRate(t).then((()=>{p=t,ee.call(e,e.media,"ratechange")})).catch((()=>{e.options.speed=[1]}))}});let{volume:g}=e.config;Object.defineProperty(e.media,"volume",{get:()=>g,set(t){e.embed.setVolume(t).then((()=>{g=t,ee.call(e,e.media,"volumechange")}))}});let{muted:f}=e.config;Object.defineProperty(e.media,"muted",{get:()=>f,set(t){const i=!!A.boolean(t)&&t;e.embed.setMuted(!!i||e.config.muted).then((()=>{f=i,ee.call(e,e.media,"volumechange")}))}});let y,{loop:b}=e.config;Object.defineProperty(e.media,"loop",{get:()=>b,set(t){const i=A.boolean(t)?t:e.config.loop.active;e.embed.setLoop(i).then((()=>{b=i}))}}),e.embed.getVideoUrl().then((t=>{y=t,Me.setDownloadUrl.call(e)})).catch((e=>{this.debug.warn(e)})),Object.defineProperty(e.media,"currentSrc",{get:()=>y}),Object.defineProperty(e.media,"ended",{get:()=>e.currentTime===e.duration}),Promise.all([e.embed.getVideoWidth(),e.embed.getVideoHeight()]).then((t=>{const[i,s]=t;e.embed.ratio=de(i,s),he.call(this)})),e.embed.setAutopause(e.config.autopause).then((t=>{e.config.autopause=t})),e.embed.getVideoTitle().then((t=>{e.config.title=t,Ue.setTitle.call(this)})),e.embed.getCurrentTime().then((t=>{m=t,ee.call(e,e.media,"timeupdate")})),e.embed.getDuration().then((t=>{e.media.duration=t,ee.call(e,e.media,"durationchange")})),e.embed.getTextTracks().then((t=>{e.media.textTracks=t,Ne.setup.call(e)})),e.embed.on("cuechange",(({cues:t=[]})=>{const i=t.map((e=>function(e){const t=document.createDocumentFragment(),i=document.createElement("div");return t.appendChild(i),i.innerHTML=e,t.firstChild.innerText}(e.text)));Ne.updateCues.call(e,i)})),e.embed.on("loaded",(()=>{if(e.embed.getPaused().then((t=>{ze.call(e,!t),t||ee.call(e,e.media,"playing")})),A.element(e.embed.element)&&e.supported.ui){e.embed.element.setAttribute("tabindex",-1)}})),e.embed.on("bufferstart",(()=>{ee.call(e,e.media,"waiting")})),e.embed.on("bufferend",(()=>{ee.call(e,e.media,"playing")})),e.embed.on("play",(()=>{ze.call(e,!0),ee.call(e,e.media,"playing")})),e.embed.on("pause",(()=>{ze.call(e,!1)})),e.embed.on("timeupdate",(t=>{e.media.seeking=!1,m=t.seconds,ee.call(e,e.media,"timeupdate")})),e.embed.on("progress",(t=>{e.media.buffered=t.percent,ee.call(e,e.media,"progress"),1===parseInt(t.percent,10)&&ee.call(e,e.media,"canplaythrough"),e.embed.getDuration().then((t=>{t!==e.media.duration&&(e.media.duration=t,ee.call(e,e.media,"durationchange"))}))})),e.embed.on("seeked",(()=>{e.media.seeking=!1,ee.call(e,e.media,"seeked")})),e.embed.on("ended",(()=>{e.media.paused=!0,ee.call(e,e.media,"ended")})),e.embed.on("error",(t=>{e.media.error=t,ee.call(e,e.media,"error")})),t.customControls&&setTimeout((()=>Ue.build.call(e)),0)}};function Ye(e){e&&!this.embed.hasPlayed&&(this.embed.hasPlayed=!0),this.media.paused===e&&(this.media.paused=!e,ee.call(this,this.media,e?"play":"pause"))}function Qe(e){return e.noCookie?"https://www.youtube-nocookie.com":"http:"===window.location.protocol?"http://www.youtube.com":void 0}const Xe={setup(){if(F(this.elements.wrapper,this.config.classNames.embed,!0),A.object(window.YT)&&A.function(window.YT.Player))Xe.ready.call(this);else{const e=window.onYouTubeIframeAPIReady;window.onYouTubeIframeAPIReady=()=>{A.function(e)&&e(),Xe.ready.call(this)},We(this.config.urls.youtube.sdk).catch((e=>{this.debug.warn("YouTube API failed to load",e)}))}},getTitle(e){ke(pe(this.config.urls.youtube.api,e)).then((e=>{if(A.object(e)){const{title:t,height:i,width:s}=e;this.config.title=t,Ue.setTitle.call(this),this.embed.ratio=de(s,i)}he.call(this)})).catch((()=>{he.call(this)}))},ready(){const e=this,t=e.config.youtube,i=e.media&&e.media.getAttribute("id");if(!A.empty(i)&&i.startsWith("youtube-"))return;let s=e.media.getAttribute("src");A.empty(s)&&(s=e.media.getAttribute(this.config.attributes.embed.id));const n=(a=s,A.empty(a)?null:a.match(/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*/)?RegExp.$2:a);var a;const r=O("div",{id:`${e.provider}-${Math.floor(1e4*Math.random())}`,"data-poster":t.customControls?e.poster:void 0});if(e.media=D(r,e.media),t.customControls){const t=e=>`https://i.ytimg.com/vi/${n}/${e}default.jpg`;Fe(t("maxres"),121).catch((()=>Fe(t("sd"),121))).catch((()=>Fe(t("hq")))).then((t=>Ue.setPoster.call(e,t.src))).then((t=>{t.includes("maxres")||(e.elements.poster.style.backgroundSize="cover")})).catch((()=>{}))}e.embed=new window.YT.Player(e.media,{videoId:n,host:Qe(t),playerVars:N({},{autoplay:e.config.autoplay?1:0,hl:e.config.hl,controls:e.supported.ui&&t.customControls?0:1,disablekb:1,playsinline:e.config.playsinline&&!e.config.fullscreen.iosNative?1:0,cc_load_policy:e.captions.active?1:0,cc_lang_pref:e.config.captions.language,widget_referrer:window?window.location.href:null},t),events:{onError(t){if(!e.media.error){const i=t.data,s={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 occurred";e.media.error={code:i,message:s},ee.call(e,e.media,"error")}},onPlaybackRateChange(t){const i=t.target;e.media.playbackRate=i.getPlaybackRate(),ee.call(e,e.media,"ratechange")},onReady(i){if(A.function(e.media.play))return;const s=i.target;Xe.getTitle.call(e,n),e.media.play=()=>{Ye.call(e,!0),s.playVideo()},e.media.pause=()=>{Ye.call(e,!1),s.pauseVideo()},e.media.stop=()=>{s.stopVideo()},e.media.duration=s.getDuration(),e.media.paused=!0,e.media.currentTime=0,Object.defineProperty(e.media,"currentTime",{get:()=>Number(s.getCurrentTime()),set(t){e.paused&&!e.embed.hasPlayed&&e.embed.mute(),e.media.seeking=!0,ee.call(e,e.media,"seeking"),s.seekTo(t)}}),Object.defineProperty(e.media,"playbackRate",{get:()=>s.getPlaybackRate(),set(e){s.setPlaybackRate(e)}});let{volume:a}=e.config;Object.defineProperty(e.media,"volume",{get:()=>a,set(t){a=t,s.setVolume(100*a),ee.call(e,e.media,"volumechange")}});let{muted:r}=e.config;Object.defineProperty(e.media,"muted",{get:()=>r,set(t){const i=A.boolean(t)?t:r;r=i,s[i?"mute":"unMute"](),s.setVolume(100*a),ee.call(e,e.media,"volumechange")}}),Object.defineProperty(e.media,"currentSrc",{get:()=>s.getVideoUrl()}),Object.defineProperty(e.media,"ended",{get:()=>e.currentTime===e.duration});const o=s.getAvailablePlaybackRates();e.options.speed=o.filter((t=>e.config.speed.options.includes(t))),e.supported.ui&&t.customControls&&e.media.setAttribute("tabindex",-1),ee.call(e,e.media,"timeupdate"),ee.call(e,e.media,"durationchange"),clearInterval(e.timers.buffering),e.timers.buffering=setInterval((()=>{e.media.buffered=s.getVideoLoadedFraction(),(null===e.media.lastBuffered||e.media.lastBuffered<e.media.buffered)&&ee.call(e,e.media,"progress"),e.media.lastBuffered=e.media.buffered,1===e.media.buffered&&(clearInterval(e.timers.buffering),ee.call(e,e.media,"canplaythrough"))}),200),t.customControls&&setTimeout((()=>Ue.build.call(e)),50)},onStateChange(i){const s=i.target;clearInterval(e.timers.playing);switch(e.media.seeking&&[1,2].includes(i.data)&&(e.media.seeking=!1,ee.call(e,e.media,"seeked")),i.data){case-1:ee.call(e,e.media,"timeupdate"),e.media.buffered=s.getVideoLoadedFraction(),ee.call(e,e.media,"progress");break;case 0:Ye.call(e,!1),e.media.loop?(s.stopVideo(),s.playVideo()):ee.call(e,e.media,"ended");break;case 1:t.customControls&&!e.config.autoplay&&e.media.paused&&!e.embed.hasPlayed?e.media.pause():(Ye.call(e,!0),ee.call(e,e.media,"playing"),e.timers.playing=setInterval((()=>{ee.call(e,e.media,"timeupdate")}),50),e.media.duration!==s.getDuration()&&(e.media.duration=s.getDuration(),ee.call(e,e.media,"durationchange")));break;case 2:e.muted||e.embed.unMute(),Ye.call(e,!1);break;case 3:ee.call(e,e.media,"waiting")}ee.call(e,e.elements.container,"statechange",!1,{code:i.data})}}})}},Je={setup(){this.media?(F(this.elements.container,this.config.classNames.type.replace("{0}",this.type),!0),F(this.elements.container,this.config.classNames.provider.replace("{0}",this.provider),!0),this.isEmbed&&F(this.elements.container,this.config.classNames.type.replace("{0}","video"),!0),this.isVideo&&(this.elements.wrapper=O("div",{class:this.config.classNames.video}),_(this.media,this.elements.wrapper),this.elements.poster=O("div",{class:this.config.classNames.poster}),this.elements.wrapper.appendChild(this.elements.poster)),this.isHTML5?me.setup.call(this):this.isYouTube?Xe.setup.call(this):this.isVimeo&&Ke.setup.call(this)):this.debug.warn("No media element found!")}};class Ge{constructor(e){t(this,"load",(()=>{this.enabled&&(A.object(window.google)&&A.object(window.google.ima)?this.ready():We(this.player.config.urls.googleIMA.sdk).then((()=>{this.ready()})).catch((()=>{this.trigger("error",new Error("Google IMA SDK failed to load"))})))})),t(this,"ready",(()=>{var e;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((()=>{this.clearSafetyTimer("onAdsManagerLoaded()")})),this.listeners(),this.setupIMA()})),t(this,"setupIMA",(()=>{this.elements.container=O("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,(e=>this.onAdsManagerLoaded(e)),!1),this.loader.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR,(e=>this.onAdError(e)),!1),this.requestAds()})),t(this,"requestAds",(()=>{const{container:e}=this.player.elements;try{const 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)}})),t(this,"pollCountdown",((e=!1)=>{if(!e)return clearInterval(this.countdownTimer),void this.elements.container.removeAttribute("data-badge-text");this.countdownTimer=setInterval((()=>{const e=Pe(Math.max(this.manager.getRemainingTime(),0)),t=`${we.get("advertisement",this.player.config)} - ${e}`;this.elements.container.setAttribute("data-badge-text",t)}),100)})),t(this,"onAdsManagerLoaded",(e=>{if(!this.enabled)return;const t=new google.ima.AdsRenderingSettings;t.restoreCustomPlaybackStateOnAdBreakComplete=!0,t.enablePreloading=!0,this.manager=e.getAdsManager(this.player,t),this.cuePoints=this.manager.getCuePoints(),this.manager.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR,(e=>this.onAdError(e))),Object.keys(google.ima.AdEvent.Type).forEach((e=>{this.manager.addEventListener(google.ima.AdEvent.Type[e],(e=>this.onAdEvent(e)))})),this.trigger("loaded")})),t(this,"addCuePoints",(()=>{A.empty(this.cuePoints)||this.cuePoints.forEach((e=>{if(0!==e&&-1!==e&&e<this.player.duration){const t=this.player.elements.progress;if(A.element(t)){const i=100/this.player.duration*e,s=O("span",{class:this.player.config.classNames.cues});s.style.left=`${i.toString()}%`,t.appendChild(s)}}}))})),t(this,"onAdEvent",(e=>{const{container:t}=this.player.elements,i=e.getAd(),s=e.getAdData();switch((e=>{ee.call(this.player,this.player.media,`ads${e.replace(/_/g,"").toLowerCase()}`)})(e.type),e.type){case google.ima.AdEvent.Type.LOADED:this.trigger("loaded"),this.pollCountdown(!0),i.isLinear()||(i.width=t.offsetWidth,i.height=t.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:s.adError&&this.player.debug.warn(`Non-fatal ad error: ${s.adError.getMessage()}`)}})),t(this,"onAdError",(e=>{this.cancel(),this.player.debug.warn("Ads error",e)})),t(this,"listeners",(()=>{const{container:e}=this.player.elements;let t;this.player.on("canplay",(()=>{this.addCuePoints()})),this.player.on("ended",(()=>{this.loader.contentComplete()})),this.player.on("timeupdate",(()=>{t=this.player.currentTime})),this.player.on("seeked",(()=>{const e=this.player.currentTime;A.empty(this.cuePoints)||this.cuePoints.forEach(((i,s)=>{t<i&&i<e&&(this.manager.discardAdBreak(),this.cuePoints.splice(s,1))}))})),window.addEventListener("resize",(()=>{this.manager&&this.manager.resize(e.offsetWidth,e.offsetHeight,google.ima.ViewMode.NORMAL)}))})),t(this,"play",(()=>{const{container:e}=this.player.elements;this.managerPromise||this.resumeContent(),this.managerPromise.then((()=>{this.manager.setVolume(this.player.volume),this.elements.displayContainer.initialize();try{this.initialized||(this.manager.init(e.offsetWidth,e.offsetHeight,google.ima.ViewMode.NORMAL),this.manager.start()),this.initialized=!0}catch(e){this.onAdError(e)}})).catch((()=>{}))})),t(this,"resumeContent",(()=>{this.elements.container.style.zIndex="",this.playing=!1,se(this.player.media.play())})),t(this,"pauseContent",(()=>{this.elements.container.style.zIndex=3,this.playing=!0,this.player.media.pause()})),t(this,"cancel",(()=>{this.initialized&&this.resumeContent(),this.trigger("error"),this.loadAds()})),t(this,"loadAds",(()=>{this.managerPromise.then((()=>{this.manager&&this.manager.destroy(),this.managerPromise=new Promise((e=>{this.on("loaded",e),this.player.debug.log(this.manager)})),this.initialized=!1,this.requestAds()})).catch((()=>{}))})),t(this,"trigger",((e,...t)=>{const i=this.events[e];A.array(i)&&i.forEach((e=>{A.function(e)&&e.apply(this,t)}))})),t(this,"on",((e,t)=>(A.array(this.events[e])||(this.events[e]=[]),this.events[e].push(t),this))),t(this,"startSafetyTimer",((e,t)=>{this.player.debug.log(`Safety timer invoked from: ${t}`),this.safetyTimer=setTimeout((()=>{this.cancel(),this.clearSafetyTimer("startSafetyTimer()")}),e)})),t(this,"clearSafetyTimer",(e=>{A.nullOrUndefined(this.safetyTimer)||(this.player.debug.log(`Safety timer cleared from: ${e}`),clearTimeout(this.safetyTimer),this.safetyTimer=null)})),this.player=e,this.config=e.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(((e,t)=>{this.on("loaded",e),this.on("error",t)})),this.load()}get enabled(){const{config:e}=this;return this.player.isHTML5&&this.player.isVideo&&e.enabled&&(!A.empty(e.publisherId)||A.url(e.tagUrl))}get tagUrl(){const{config:e}=this;if(A.url(e.tagUrl))return e.tagUrl;return`https://go.aniview.com/api/adserver6/vast/?${Le({AV_PUBLISHERID:"58c25bb0073ef448b1087ad6",AV_CHANNELID:"5a0458dc28a06145e4519d21",AV_URL:window.location.hostname,cb:Date.now(),AV_WIDTH:640,AV_HEIGHT:480,AV_CDIM2:e.publisherId})}`}}function Ze(e=0,t=0,i=255){return Math.min(Math.max(e,t),i)}const et=e=>{const t=[];return e.split(/\r\n\r\n|\n\n|\r\r/).forEach((e=>{const i={};e.split(/\r\n|\n|\r/).forEach((e=>{if(A.number(i.startTime)){if(!A.empty(e.trim())&&A.empty(i.text)){const t=e.trim().split("#xywh=");[i.text]=t,t[1]&&([i.x,i.y,i.w,i.h]=t[1].split(","))}}else{const t=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})/);t&&(i.startTime=60*Number(t[1]||0)*60+60*Number(t[2])+Number(t[3])+Number(`0.${t[4]}`),i.endTime=60*Number(t[6]||0)*60+60*Number(t[7])+Number(t[8])+Number(`0.${t[9]}`))}})),i.text&&t.push(i)})),t},tt=(e,t)=>{const 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};class it{constructor(e){t(this,"load",(()=>{this.player.elements.display.seekTooltip&&(this.player.elements.display.seekTooltip.hidden=this.enabled),this.enabled&&this.getThumbnails().then((()=>{this.enabled&&(this.render(),this.determineContainerAutoSizing(),this.listeners(),this.loaded=!0)}))})),t(this,"getThumbnails",(()=>new Promise((e=>{const{src:t}=this.player.config.previewThumbnails;if(A.empty(t))throw new Error("Missing previewThumbnails.src config attribute");const i=()=>{this.thumbnails.sort(((e,t)=>e.height-t.height)),this.player.debug.log("Preview thumbnails",this.thumbnails),e()};if(A.function(t))t((e=>{this.thumbnails=e,i()}));else{const e=(A.string(t)?[t]:t).map((e=>this.getThumbnail(e)));Promise.all(e).then(i)}})))),t(this,"getThumbnail",(e=>new Promise((t=>{ke(e).then((i=>{const s={frames:et(i),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));const n=new Image;n.onload=()=>{s.height=n.naturalHeight,s.width=n.naturalWidth,this.thumbnails.push(s),t()},n.src=s.urlPrefix+s.frames[0].text}))})))),t(this,"startMove",(e=>{if(this.loaded&&A.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,i;const s=this.player.elements.progress.getBoundingClientRect(),n=100/s.width*(e.pageX-s.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=Pe(this.seekTime);const a=null===(t=this.player.config.markers)||void 0===t||null===(i=t.points)||void 0===i?void 0:i.find((({time:e})=>e===Math.round(this.seekTime)));a&&this.elements.thumb.time.insertAdjacentHTML("afterbegin",`${a.label}<br>`)}this.showImageAtCurrentTime()}})),t(this,"endMove",(()=>{this.toggleThumbContainer(!1,!0)})),t(this,"startScrubbing",(e=>{(A.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()))})),t(this,"endScrubbing",(()=>{this.mouseDown=!1,Math.ceil(this.lastTime)===Math.ceil(this.player.media.currentTime)?this.toggleScrubbingContainer(!1):Z.call(this.player,this.player.media,"timeupdate",(()=>{this.mouseDown||this.toggleScrubbingContainer(!1)}))})),t(this,"listeners",(()=>{this.player.on("play",(()=>{this.toggleThumbContainer(!1,!0)})),this.player.on("seeked",(()=>{this.toggleThumbContainer(!1)})),this.player.on("timeupdate",(()=>{this.lastTime=this.player.media.currentTime}))})),t(this,"render",(()=>{this.elements.thumb.container=O("div",{class:this.player.config.classNames.previewThumbnails.thumbContainer}),this.elements.thumb.imageContainer=O("div",{class:this.player.config.classNames.previewThumbnails.imageContainer}),this.elements.thumb.container.appendChild(this.elements.thumb.imageContainer);const e=O("div",{class:this.player.config.classNames.previewThumbnails.timeContainer});this.elements.thumb.time=O("span",{},"00:00"),e.appendChild(this.elements.thumb.time),this.elements.thumb.imageContainer.appendChild(e),A.element(this.player.elements.progress)&&this.player.elements.progress.appendChild(this.elements.thumb.container),this.elements.scrubbing.container=O("div",{class:this.player.config.classNames.previewThumbnails.scrubbingContainer}),this.player.elements.wrapper.appendChild(this.elements.scrubbing.container)})),t(this,"destroy",(()=>{this.elements.thumb.container&&this.elements.thumb.container.remove(),this.elements.scrubbing.container&&this.elements.scrubbing.container.remove()})),t(this,"showImageAtCurrentTime",(()=>{this.mouseDown?this.setScrubbingContainerSize():this.setThumbContainerSizeAndPos();const e=this.thumbnails[0].frames.findIndex((e=>this.seekTime>=e.startTime&&this.seekTime<=e.endTime)),t=e>=0;let i=0;this.mouseDown||this.toggleThumbContainer(t),t&&(this.thumbnails.forEach(((t,s)=>{this.loadedImages.includes(t.frames[e].text)&&(i=s)})),e!==this.showingThumb&&(this.showingThumb=e,this.loadImage(i)))})),t(this,"loadImage",((e=0)=>{const t=this.showingThumb,i=this.thumbnails[e],{urlPrefix:s}=i,n=i.frames[t],a=i.frames[t].text,r=s+a;if(this.currentImageElement&&this.currentImageElement.dataset.filename===a)this.showImage(this.currentImageElement,n,e,t,a,!1),this.currentImageElement.dataset.index=t,this.removeOldImages(this.currentImageElement);else{this.loadingImage&&this.usingSprites&&(this.loadingImage.onload=null);const i=new Image;i.src=r,i.dataset.index=t,i.dataset.filename=a,this.showingThumbFilename=a,this.player.debug.log(`Loading image: ${r}`),i.onload=()=>this.showImage(i,n,e,t,a,!0),this.loadingImage=i,this.removeOldImages(i)}})),t(this,"showImage",((e,t,i,s,n,a=!0)=>{this.player.debug.log(`Showing thumb: ${n}. num: ${s}. qual: ${i}. newimg: ${a}`),this.setImageSizeAndOffset(e,t),a&&(this.currentImageContainer.appendChild(e),this.currentImageElement=e,this.loadedImages.includes(n)||this.loadedImages.push(n)),this.preloadNearby(s,!0).then(this.preloadNearby(s,!1)).then(this.getHigherQuality(i,e,t,n))})),t(this,"removeOldImages",(e=>{Array.from(this.currentImageContainer.children).forEach((t=>{if("img"!==t.tagName.toLowerCase())return;const i=this.usingSprites?500:1e3;if(t.dataset.index!==e.dataset.index&&!t.dataset.deleting){t.dataset.deleting=!0;const{currentImageContainer:e}=this;setTimeout((()=>{e.removeChild(t),this.player.debug.log(`Removing thumb: ${t.dataset.filename}`)}),i)}}))})),t(this,"preloadNearby",((e,t=!0)=>new Promise((i=>{setTimeout((()=>{const s=this.thumbnails[0].frames[e].text;if(this.showingThumbFilename===s){let n;n=t?this.thumbnails[0].frames.slice(e):this.thumbnails[0].frames.slice(0,e).reverse();let a=!1;n.forEach((e=>{const t=e.text;if(t!==s&&!this.loadedImages.includes(t)){a=!0,this.player.debug.log(`Preloading thumb filename: ${t}`);const{urlPrefix:e}=this.thumbnails[0],s=e+t,n=new Image;n.src=s,n.onload=()=>{this.player.debug.log(`Preloaded thumb filename: ${t}`),this.loadedImages.includes(t)||this.loadedImages.push(t),i()}}})),a||i()}}),300)})))),t(this,"getHigherQuality",((e,t,i,s)=>{if(e<this.thumbnails.length-1){let n=t.naturalHeight;this.usingSprites&&(n=i.h),n<this.thumbContainerHeight&&setTimeout((()=>{this.showingThumbFilename===s&&(this.player.debug.log(`Showing higher quality thumb for: ${s}`),this.loadImage(e+1))}),300)}})),t(this,"toggleThumbContainer",((e=!1,t=!1)=>{const i=this.player.config.classNames.previewThumbnails.thumbContainerShown;this.elements.thumb.container.classList.toggle(i,e),!e&&t&&(this.showingThumb=null,this.showingThumbFilename=null)})),t(this,"toggleScrubbingContainer",((e=!1)=>{const t=this.player.config.classNames.previewThumbnails.scrubbingContainerShown;this.elements.scrubbing.container.classList.toggle(t,e),e||(this.showingThumb=null,this.showingThumbFilename=null)})),t(this,"determineContainerAutoSizing",(()=>{(this.elements.thumb.imageContainer.clientHeight>20||this.elements.thumb.imageContainer.clientWidth>20)&&(this.sizeSpecifiedInCSS=!0)})),t(this,"setThumbContainerSizeAndPos",(()=>{const{imageContainer:e}=this.elements.thumb;if(this.sizeSpecifiedInCSS){if(e.clientHeight>20&&e.clientWidth<20){const t=Math.floor(e.clientHeight*this.thumbAspectRatio);e.style.width=`${t}px`}else if(e.clientHeight<20&&e.clientWidth>20){const t=Math.floor(e.clientWidth/this.thumbAspectRatio);e.style.height=`${t}px`}}else{const t=Math.floor(this.thumbContainerHeight*this.thumbAspectRatio);e.style.height=`${this.thumbContainerHeight}px`,e.style.width=`${t}px`}this.setThumbContainerPos()})),t(this,"setThumbContainerPos",(()=>{const e=this.player.elements.progress.getBoundingClientRect(),t=this.player.elements.container.getBoundingClientRect(),{container:i}=this.elements.thumb,s=t.left-e.left+10,n=t.right-e.left-i.clientWidth-10,a=this.mousePosX-e.left-i.clientWidth/2,r=Ze(a,s,n);i.style.left=`${r}px`,i.style.setProperty("--preview-arrow-offset",a-r+"px")})),t(this,"setScrubbingContainerSize",(()=>{const{width:e,height:t}=tt(this.thumbAspectRatio,{width:this.player.media.clientWidth,height:this.player.media.clientHeight});this.elements.scrubbing.container.style.width=`${e}px`,this.elements.scrubbing.container.style.height=`${t}px`})),t(this,"setImageSizeAndOffset",((e,t)=>{if(!this.usingSprites)return;const i=this.thumbContainerHeight/t.h;e.style.height=e.naturalHeight*i+"px",e.style.width=e.naturalWidth*i+"px",e.style.left=`-${t.x*i}px`,e.style.top=`-${t.y*i}px`})),this.player=e,this.thumbnails=[],this.loaded=!1,this.lastMouseMoveTime=Date.now(),this.mouseDown=!1,this.loadedImages=[],this.elements={thumb:{},scrubbing:{}},this.load()}get enabled(){return this.player.isHTML5&&this.player.isVideo&&this.player.config.previewThumbnails.enabled}get currentImageContainer(){return this.mouseDown?this.elements.scrubbing.container:this.elements.thumb.imageContainer}get usingSprites(){return Object.keys(this.thumbnails[0].frames[0]).includes("w")}get thumbAspectRatio(){return this.usingSprites?this.thumbnails[0].frames[0].w/this.thumbnails[0].frames[0].h:this.thumbnails[0].width/this.thumbnails[0].height}get thumbContainerHeight(){if(this.mouseDown){const{height:e}=tt(this.thumbAspectRatio,{width:this.player.media.clientWidth,height:this.player.media.clientHeight});return e}return this.sizeSpecifiedInCSS?this.elements.thumb.imageContainer.clientHeight:Math.floor(this.player.media.clientWidth/this.thumbAspectRatio/4)}get currentImageElement(){return this.mouseDown?this.currentScrubbingImageElement:this.currentThumbnailImageElement}set currentImageElement(e){this.mouseDown?this.currentScrubbingImageElement=e:this.currentThumbnailImageElement=e}}const st={insertElements(e,t){A.string(t)?$(e,this.media,{src:t}):A.array(t)&&t.forEach((t=>{$(e,this.media,t)}))},change(e){L(e,"sources.length")?(me.cancelRequests.call(this),this.destroy.call(this,(()=>{this.options.quality=[],j(this.media),this.media=null,A.element(this.elements.container)&&this.elements.container.removeAttribute("class");const{sources:t,type:i}=e,[{provider:s=$e.html5,src:n}]=t,a="html5"===s?i:"div",r="html5"===s?{}:{src:n};Object.assign(this,{provider:s,type:i,supported:Y.check(i,s,this.config.playsinline),media:O(a,r)}),this.elements.container.appendChild(this.media),A.boolean(e.autoplay)&&(this.config.autoplay=e.autoplay),this.isHTML5&&(this.config.crossorigin&&this.media.setAttribute("crossorigin",""),this.config.autoplay&&this.media.setAttribute("autoplay",""),A.empty(e.poster)||(this.poster=e.poster),this.config.loop.active&&this.media.setAttribute("loop",""),this.config.muted&&this.media.setAttribute("muted",""),this.config.playsinline&&this.media.setAttribute("playsinline","")),Ue.addStyleHook.call(this),this.isHTML5&&st.insertElements.call(this,"source",t),this.config.title=e.title,Je.setup.call(this),this.isHTML5&&Object.keys(e).includes("tracks")&&st.insertElements.call(this,"track",e.tracks),(this.isHTML5||this.isEmbed&&!this.supported.ui)&&Ue.build.call(this),this.isHTML5&&this.media.load(),A.empty(e.previewThumbnails)||(Object.assign(this.config.previewThumbnails,e.previewThumbnails),this.previewThumbnails&&this.previewThumbnails.loaded&&(this.previewThumbnails.destroy(),this.previewThumbnails=null),this.config.previewThumbnails.enabled&&(this.previewThumbnails=new it(this))),this.fullscreen.update()}),!0)):this.debug.warn("Invalid source format")}};class nt{constructor(e,i){if(t(this,"play",(()=>A.function(this.media.play)?(this.ads&&this.ads.enabled&&this.ads.managerPromise.then((()=>this.ads.play())).catch((()=>se(this.media.play()))),this.media.play()):null)),t(this,"pause",(()=>this.playing&&A.function(this.media.pause)?this.media.pause():null)),t(this,"togglePlay",(e=>(A.boolean(e)?e:!this.playing)?this.play():this.pause())),t(this,"stop",(()=>{this.isHTML5?(this.pause(),this.restart()):A.function(this.media.stop)&&this.media.stop()})),t(this,"restart",(()=>{this.currentTime=0})),t(this,"rewind",(e=>{this.currentTime-=A.number(e)?e:this.config.seekTime})),t(this,"forward",(e=>{this.currentTime+=A.number(e)?e:this.config.seekTime})),t(this,"increaseVolume",(e=>{const t=this.media.muted?0:this.volume;this.volume=t+(A.number(e)?e:0)})),t(this,"decreaseVolume",(e=>{this.increaseVolume(-e)})),t(this,"airplay",(()=>{Y.airplay&&this.media.webkitShowPlaybackTargetPicker()})),t(this,"toggleControls",(e=>{if(this.supported.ui&&!this.isAudio){const t=U(this.elements.container,this.config.classNames.hideControls),i=void 0===e?void 0:!e,s=F(this.elements.container,this.config.classNames.hideControls,i);if(s&&A.array(this.config.controls)&&this.config.controls.includes("settings")&&!A.empty(this.config.settings)&&Me.toggleMenu.call(this,!1),s!==t){const e=s?"controlshidden":"controlsshown";ee.call(this,this.media,e)}return!s}return!1})),t(this,"on",((e,t)=>{J.call(this,this.elements.container,e,t)})),t(this,"once",((e,t)=>{Z.call(this,this.elements.container,e,t)})),t(this,"off",((e,t)=>{G(this.elements.container,e,t)})),t(this,"destroy",((e,t=!1)=>{if(!this.ready)return;const i=()=>{document.body.style.overflow="",this.embed=null,t?(Object.keys(this.elements).length&&(j(this.elements.buttons.play),j(this.elements.captions),j(this.elements.controls),j(this.elements.wrapper),this.elements.buttons.play=null,this.elements.captions=null,this.elements.controls=null,this.elements.wrapper=null),A.function(e)&&e()):(te.call(this),me.cancelRequests.call(this),D(this.elements.original,this.elements.container),ee.call(this,this.elements.original,"destroyed",!0),A.function(e)&&e.call(this.elements.original),this.ready=!1,setTimeout((()=>{this.elements=null,this.media=null}),200))};this.stop(),clearTimeout(this.timers.loading),clearTimeout(this.timers.controls),clearTimeout(this.timers.resized),this.isHTML5?(Ue.toggleNativeControls.call(this,!0),i()):this.isYouTube?(clearInterval(this.timers.buffering),clearInterval(this.timers.playing),null!==this.embed&&A.function(this.embed.destroy)&&this.embed.destroy(),i()):this.isVimeo&&(null!==this.embed&&this.embed.unload().then(i),setTimeout(i,200))})),t(this,"supports",(e=>Y.mime.call(this,e))),this.timers={},this.ready=!1,this.loading=!1,this.failed=!1,this.touch=Y.touch,this.media=e,A.string(this.media)&&(this.media=document.querySelectorAll(this.media)),(window.jQuery&&this.media instanceof jQuery||A.nodeList(this.media)||A.array(this.media))&&(this.media=this.media[0]),this.config=N({},_e,nt.defaults,i||{},(()=>{try{return JSON.parse(this.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 qe(this.config.debug),this.debug.log("Config",this.config),this.debug.log("Support",Y),A.nullOrUndefined(this.media)||!A.element(this.media))return void this.debug.error("Setup failed: no suitable element passed");if(this.media.plyr)return void this.debug.warn("Target already setup");if(!this.config.enabled)return void this.debug.error("Setup failed: disabled by config");if(!Y.check().api)return void this.debug.error("Setup failed: no support");const s=this.media.cloneNode(!0);s.autoplay=!1,this.elements.original=s;const n=this.media.tagName.toLowerCase();let a=null,r=null;switch(n){case"div":if(a=this.media.querySelector("iframe"),A.element(a)){if(r=xe(a.getAttribute("src")),this.provider=function(e){return/^(https?:\/\/)?(www\.)?(youtube\.com|youtube-nocookie\.com|youtu\.?be)\/.+$/.test(e)?$e.youtube:/^https?:\/\/player.vimeo.com\/video\/\d{0,9}(?=\b|\/)/.test(e)?$e.vimeo:null}(r.toString()),this.elements.container=this.media,this.media=a,this.elements.container.className="",r.search.length){const e=["1","true"];e.includes(r.searchParams.get("autoplay"))&&(this.config.autoplay=!0),e.includes(r.searchParams.get("loop"))&&(this.config.loop.active=!0),this.isYouTube?(this.config.playsinline=e.includes(r.searchParams.get("playsinline")),this.config.youtube.hl=r.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(A.empty(this.provider)||!Object.values($e).includes(this.provider))return void this.debug.error("Setup failed: Invalid provider");this.type=Re;break;case"video":case"audio":this.type=n,this.provider=$e.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=Y.check(this.type,this.provider),this.supported.api?(this.eventListeners=[],this.listeners=new Ve(this),this.storage=new Te(this),this.media.plyr=this,A.element(this.elements.container)||(this.elements.container=O("div"),_(this.media,this.elements.container)),Ue.migrateStyles.call(this),Ue.addStyleHook.call(this),Je.setup.call(this),this.config.debug&&J.call(this,this.elements.container,this.config.events.join(" "),(e=>{this.debug.log(`event: ${e.type}`)})),this.fullscreen=new He(this),(this.isHTML5||this.isEmbed&&!this.supported.ui)&&Ue.build.call(this),this.listeners.container(),this.listeners.global(),this.config.ads.enabled&&(this.ads=new Ge(this)),this.isHTML5&&this.config.autoplay&&this.once("canplay",(()=>se(this.play()))),this.lastSeekTime=0,this.config.previewThumbnails.enabled&&(this.previewThumbnails=new it(this))):this.debug.error("Setup failed: no support")}get isHTML5(){return this.provider===$e.html5}get isEmbed(){return this.isYouTube||this.isVimeo}get isYouTube(){return this.provider===$e.youtube}get isVimeo(){return this.provider===$e.vimeo}get isVideo(){return this.type===Re}get isAudio(){return this.type===je}get playing(){return Boolean(this.ready&&!this.paused&&!this.ended)}get paused(){return Boolean(this.media.paused)}get stopped(){return Boolean(this.paused&&0===this.currentTime)}get ended(){return Boolean(this.media.ended)}set currentTime(e){if(!this.duration)return;const t=A.number(e)&&e>0;this.media.currentTime=t?Math.min(e,this.duration):0,this.debug.log(`Seeking to ${this.currentTime} seconds`)}get currentTime(){return Number(this.media.currentTime)}get buffered(){const{buffered:e}=this.media;return A.number(e)?e:e&&e.length&&this.duration>0?e.end(0)/this.duration:0}get seeking(){return Boolean(this.media.seeking)}get duration(){const e=parseFloat(this.config.duration),t=(this.media||{}).duration,i=A.number(t)&&t!==1/0?t:0;return e||i}set volume(e){let t=e;A.string(t)&&(t=Number(t)),A.number(t)||(t=this.storage.get("volume")),A.number(t)||({volume:t}=this.config),t>1&&(t=1),t<0&&(t=0),this.config.volume=t,this.media.volume=t,!A.empty(e)&&this.muted&&t>0&&(this.muted=!1)}get volume(){return Number(this.media.volume)}set muted(e){let t=e;A.boolean(t)||(t=this.storage.get("muted")),A.boolean(t)||(t=this.config.muted),this.config.muted=t,this.media.muted=t}get muted(){return Boolean(this.media.muted)}get hasAudio(){return!this.isHTML5||(!!this.isAudio||(Boolean(this.media.mozHasAudio)||Boolean(this.media.webkitAudioDecodedByteCount)||Boolean(this.media.audioTracks&&this.media.audioTracks.length)))}set speed(e){let t=null;A.number(e)&&(t=e),A.number(t)||(t=this.storage.get("speed")),A.number(t)||(t=this.config.speed.selected);const{minimumSpeed:i,maximumSpeed:s}=this;t=Ze(t,i,s),this.config.speed.selected=t,setTimeout((()=>{this.media&&(this.media.playbackRate=t)}),0)}get speed(){return Number(this.media.playbackRate)}get minimumSpeed(){return this.isYouTube?Math.min(...this.options.speed):this.isVimeo?.5:.0625}get maximumSpeed(){return this.isYouTube?Math.max(...this.options.speed):this.isVimeo?2:16}set quality(e){const t=this.config.quality,i=this.options.quality;if(!i.length)return;let s=[!A.empty(e)&&Number(e),this.storage.get("quality"),t.selected,t.default].find(A.number),n=!0;if(!i.includes(s)){const e=ae(i,s);this.debug.warn(`Unsupported quality option: ${s}, using ${e} instead`),s=e,n=!1}t.selected=s,this.media.quality=s,n&&this.storage.set({quality:s})}get quality(){return this.media.quality}set loop(e){const t=A.boolean(e)?e:this.config.loop.active;this.config.loop.active=t,this.media.loop=t}get loop(){return Boolean(this.media.loop)}set source(e){st.change.call(this,e)}get source(){return this.media.currentSrc}get download(){const{download:e}=this.config.urls;return A.url(e)?e:this.source}set download(e){A.url(e)&&(this.config.urls.download=e,Me.setDownloadUrl.call(this))}set poster(e){this.isVideo?Ue.setPoster.call(this,e,!1).catch((()=>{})):this.debug.warn("Poster can only be set for video")}get poster(){return this.isVideo?this.media.getAttribute("poster")||this.media.getAttribute("data-poster"):null}get ratio(){if(!this.isVideo)return null;const e=ce(ue.call(this));return A.array(e)?e.join(":"):e}set ratio(e){this.isVideo?A.string(e)&&le(e)?(this.config.ratio=ce(e),he.call(this)):this.debug.error(`Invalid aspect ratio specified (${e})`):this.debug.warn("Aspect ratio can only be set for video")}set autoplay(e){this.config.autoplay=A.boolean(e)?e:this.config.autoplay}get autoplay(){return Boolean(this.config.autoplay)}toggleCaptions(e){Ne.toggle.call(this,e,!1)}set currentTrack(e){Ne.set.call(this,e,!1),Ne.setup.call(this)}get currentTrack(){const{toggled:e,currentTrack:t}=this.captions;return e?t:-1}set language(e){Ne.setLanguage.call(this,e,!1)}get language(){return(Ne.getCurrentTrack.call(this)||{}).language}set pip(e){if(!Y.pip)return;const t=A.boolean(e)?e:!this.pip;A.function(this.media.webkitSetPresentationMode)&&this.media.webkitSetPresentationMode(t?Ie:Oe),A.function(this.media.requestPictureInPicture)&&(!this.pip&&t?this.media.requestPictureInPicture():this.pip&&!t&&document.exitPictureInPicture())}get pip(){return Y.pip?A.empty(this.media.webkitPresentationMode)?this.media===document.pictureInPictureElement:this.media.webkitPresentationMode===Ie:null}setPreviewThumbnails(e){this.previewThumbnails&&this.previewThumbnails.loaded&&(this.previewThumbnails.destroy(),this.previewThumbnails=null),Object.assign(this.config.previewThumbnails,e),this.config.previewThumbnails.enabled&&(this.previewThumbnails=new it(this))}static supported(e,t){return Y.check(e,t)}static loadSprite(e,t){return Ee(e,t)}static setup(e,t={}){let i=null;return A.string(e)?i=Array.from(document.querySelectorAll(e)):A.nodeList(e)?i=Array.from(e):A.array(e)&&(i=e.filter(A.element)),A.empty(i)?null:i.map((e=>new nt(e,t)))}}var at;return nt.defaults=(at=_e,JSON.parse(JSON.stringify(at))),nt})); 24.04.2020
video_embed_field_plyr 8.x-1.2 ::
assets/plyr/plyr.min.js
"object"==typeof navigator&&function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define("Plyr",t):(e="undefined"!=typeof globalThis?globalThis:e||self).Plyr=t()}(this,(function(){"use strict";function e(e,t,i){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var s=i.call(e,t||"default");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function t(e,t){for(var i=0;i<t.length;i++){var s=t[i];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,s.key,s)}}function i(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function s(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,s)}return i}function n(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?s(Object(n),!0).forEach((function(t){i(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):s(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var a={addCSS:!0,thumbWidth:15,watch:!0};var l=function(e){return null!=e?e.constructor:null},r=function(e,t){return!!(e&&t&&e instanceof t)},o=function(e){return null==e},c=function(e){return l(e)===Object},u=function(e){return l(e)===String},h=function(e){return Array.isArray(e)},d=function(e){return r(e,NodeList)},m={nullOrUndefined:o,object:c,number:function(e){return l(e)===Number&&!Number.isNaN(e)},string:u,boolean:function(e){return l(e)===Boolean},function:function(e){return l(e)===Function},array:h,nodeList:d,element:function(e){return r(e,Element)},event:function(e){return r(e,Event)},empty:function(e){return o(e)||(u(e)||h(e)||d(e))&&!e.length||c(e)&&!Object.keys(e).length}};function p(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 g=function(){function e(t,i){(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,e),m.element(t)?this.element=t:m.string(t)&&(this.element=document.querySelector(t)),m.element(this.element)&&m.empty(this.element.rangeTouch)&&(this.config=n({},a,{},i),this.init())}return function(e,i,s){i&&t(e.prototype,i),s&&t(e,s)}(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||!m.event(t))return null;var i,s=t.target,n=t.changedTouches[0],a=parseFloat(s.getAttribute("min"))||0,l=parseFloat(s.getAttribute("max"))||100,r=parseFloat(s.getAttribute("step"))||1,o=s.getBoundingClientRect(),c=100/o.width*(this.config.thumbWidth/2)/100;return 0>(i=100/o.width*(n.clientX-o.left))?i=0:100<i&&(i=100),50>i?i-=(100-2*i)*c:50<i&&(i+=2*(i-50)*c),a+p(i/100*(l-a),r)}},{key:"set",value:function(t){e.enabled&&m.event(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]:{},s=null;if(m.empty(t)||m.string(t)?s=Array.from(document.querySelectorAll(m.string(t)?t:'input[type="range"]')):m.element(t)?s=[t]:m.nodeList(t)?s=Array.from(t):m.array(t)&&(s=t.filter(m.element)),m.empty(s))return null;var l=n({},a,{},i);if(m.string(t)&&l.watch){var r=new MutationObserver((function(i){Array.from(i).forEach((function(i){Array.from(i.addedNodes).forEach((function(i){m.element(i)&&function(e,t){return function(){return Array.from(document.querySelectorAll(t)).includes(this)}.call(e,t)}(i,t)&&new e(i,l)}))}))}));r.observe(document.body,{childList:!0,subtree:!0})}return s.map((function(t){return new e(t,i)}))}},{key:"enabled",get:function(){return"ontouchstart"in document.documentElement}}]),e}();const f=e=>null!=e?e.constructor:null,y=(e,t)=>Boolean(e&&t&&e instanceof t),b=e=>null==e,v=e=>f(e)===Object,w=e=>f(e)===String,T=e=>"function"==typeof e,k=e=>Array.isArray(e),C=e=>y(e,NodeList),A=e=>b(e)||(w(e)||k(e)||C(e))&&!e.length||v(e)&&!Object.keys(e).length;var S={nullOrUndefined:b,object:v,number:e=>f(e)===Number&&!Number.isNaN(e),string:w,boolean:e=>f(e)===Boolean,function:T,array:k,weakMap:e=>y(e,WeakMap),nodeList:C,element:e=>null!==e&&"object"==typeof e&&1===e.nodeType&&"object"==typeof e.style&&"object"==typeof e.ownerDocument,textNode:e=>f(e)===Text,event:e=>y(e,Event),keyboardEvent:e=>y(e,KeyboardEvent),cue:e=>y(e,window.TextTrackCue)||y(e,window.VTTCue),track:e=>y(e,TextTrack)||!b(e)&&w(e.kind),promise:e=>y(e,Promise)&&T(e.then),url:e=>{if(y(e,window.URL))return!0;if(!w(e))return!1;let t=e;e.startsWith("http://")&&e.startsWith("https://")||(t=`http://${e}`);try{return!A(new URL(t).hostname)}catch(e){return!1}},empty:A};const E=(()=>{const e=document.createElement("span"),t={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"},i=Object.keys(t).find((t=>void 0!==e.style[t]));return!!S.string(i)&&t[i]})();function P(e,t){setTimeout((()=>{try{e.hidden=!0,e.offsetHeight,e.hidden=!1}catch(e){}}),t)}var M={isIE:Boolean(window.document.documentMode),isEdge:/Edge/g.test(navigator.userAgent),isWebKit:"WebkitAppearance"in document.documentElement.style&&!/Edge/g.test(navigator.userAgent),isIPhone:/iPhone|iPod/gi.test(navigator.userAgent)&&navigator.maxTouchPoints>1,isIPadOS:"MacIntel"===navigator.platform&&navigator.maxTouchPoints>1,isIos:/iPad|iPhone|iPod/gi.test(navigator.userAgent)&&navigator.maxTouchPoints>1};function N(e,t){return t.split(".").reduce(((e,t)=>e&&e[t]),e)}function x(e={},...t){if(!t.length)return e;const i=t.shift();return S.object(i)?(Object.keys(i).forEach((t=>{S.object(i[t])?(Object.keys(e).includes(t)||Object.assign(e,{[t]:{}}),x(e[t],i[t])):Object.assign(e,{[t]:i[t]})})),x(e,...t)):e}function L(e,t){const i=e.length?e:[e];Array.from(i).reverse().forEach(((e,i)=>{const s=i>0?t.cloneNode(!0):t,n=e.parentNode,a=e.nextSibling;s.appendChild(e),a?n.insertBefore(s,a):n.appendChild(s)}))}function I(e,t){S.element(e)&&!S.empty(t)&&Object.entries(t).filter((([,e])=>!S.nullOrUndefined(e))).forEach((([t,i])=>e.setAttribute(t,i)))}function $(e,t,i){const s=document.createElement(e);return S.object(t)&&I(s,t),S.string(i)&&(s.innerText=i),s}function _(e,t,i,s){S.element(t)&&t.appendChild($(e,i,s))}function O(e){S.nodeList(e)||S.array(e)?Array.from(e).forEach(O):S.element(e)&&S.element(e.parentNode)&&e.parentNode.removeChild(e)}function j(e){if(!S.element(e))return;let{length:t}=e.childNodes;for(;t>0;)e.removeChild(e.lastChild),t-=1}function q(e,t){return S.element(t)&&S.element(t.parentNode)&&S.element(e)?(t.parentNode.replaceChild(e,t),e):null}function D(e,t){if(!S.string(e)||S.empty(e))return{};const i={},s=x({},t);return e.split(",").forEach((e=>{const t=e.trim(),n=t.replace(".",""),a=t.replace(/[[\]]/g,"").split("="),[l]=a,r=a.length>1?a[1].replace(/["']/g,""):"";switch(t.charAt(0)){case".":S.string(s.class)?i.class=`${s.class} ${n}`:i.class=n;break;case"#":i.id=t.replace("#","");break;case"[":i[l]=r}})),x(s,i)}function H(e,t){if(!S.element(e))return;let i=t;S.boolean(i)||(i=!e.hidden),e.hidden=i}function R(e,t,i){if(S.nodeList(e))return Array.from(e).map((e=>R(e,t,i)));if(S.element(e)){let s="toggle";return void 0!==i&&(s=i?"add":"remove"),e.classList[s](t),e.classList.contains(t)}return!1}function F(e,t){return S.element(e)&&e.classList.contains(t)}function V(e,t){const{prototype:i}=Element;return(i.matches||i.webkitMatchesSelector||i.mozMatchesSelector||i.msMatchesSelector||function(){return Array.from(document.querySelectorAll(t)).includes(this)}).call(e,t)}function U(e){return this.elements.container.querySelectorAll(e)}function B(e){return this.elements.container.querySelector(e)}function W(e=null,t=!1){S.element(e)&&e.focus({preventScroll:!0,focusVisible:t})}const z={"audio/ogg":"vorbis","audio/wav":"1","video/webm":"vp8, vorbis","video/mp4":"avc1.42E01E, mp4a.40.2","video/ogg":"theora"},K={audio:"canPlayType"in document.createElement("audio"),video:"canPlayType"in document.createElement("video"),check(e,t){const i=K[e]||"html5"!==t;return{api:i,ui:i&&K.rangeInput}},pip:!(M.isIPhone||!S.function($("video").webkitSetPresentationMode)&&(!document.pictureInPictureEnabled||$("video").disablePictureInPicture)),airplay:S.function(window.WebKitPlaybackTargetAvailabilityEvent),playsinline:"playsInline"in document.createElement("video"),mime(e){if(S.empty(e))return!1;const[t]=e.split("/");let i=e;if(!this.isHTML5||t!==this.type)return!1;Object.keys(z).includes(i)&&(i+=`; codecs="${z[e]}"`);try{return Boolean(i&&this.media.canPlayType(i).replace(/no/,""))}catch(e){return!1}},textTracks:"textTracks"in document.createElement("video"),rangeInput:(()=>{const e=document.createElement("input");return e.type="range","range"===e.type})(),touch:"ontouchstart"in document.documentElement,transitions:!1!==E,reducedMotion:"matchMedia"in window&&window.matchMedia("(prefers-reduced-motion)").matches},Y=(()=>{let e=!1;try{const t=Object.defineProperty({},"passive",{get:()=>(e=!0,null)});window.addEventListener("test",null,t),window.removeEventListener("test",null,t)}catch(e){}return e})();function Q(e,t,i,s=!1,n=!0,a=!1){if(!e||!("addEventListener"in e)||S.empty(t)||!S.function(i))return;const l=t.split(" ");let r=a;Y&&(r={passive:n,capture:a}),l.forEach((t=>{this&&this.eventListeners&&s&&this.eventListeners.push({element:e,type:t,callback:i,options:r}),e[s?"addEventListener":"removeEventListener"](t,i,r)}))}function X(e,t="",i,s=!0,n=!1){Q.call(this,e,t,i,!0,s,n)}function J(e,t="",i,s=!0,n=!1){Q.call(this,e,t,i,!1,s,n)}function G(e,t="",i,s=!0,n=!1){const a=(...l)=>{J(e,t,a,s,n),i.apply(this,l)};Q.call(this,e,t,a,!0,s,n)}function Z(e,t="",i=!1,s={}){if(!S.element(e)||S.empty(t))return;const n=new CustomEvent(t,{bubbles:i,detail:{...s,plyr:this}});e.dispatchEvent(n)}function ee(){this&&this.eventListeners&&(this.eventListeners.forEach((e=>{const{element:t,type:i,callback:s,options:n}=e;t.removeEventListener(i,s,n)})),this.eventListeners=[])}function te(){return new Promise((e=>this.ready?setTimeout(e,0):X.call(this,this.elements.container,"ready",e))).then((()=>{}))}function ie(e){S.promise(e)&&e.then(null,(()=>{}))}function se(e){return S.array(e)?e.filter(((t,i)=>e.indexOf(t)===i)):e}function ne(e,t){return S.array(e)&&e.length?e.reduce(((e,i)=>Math.abs(i-t)<Math.abs(e-t)?i:e)):null}function ae(e){return!(!window||!window.CSS)&&window.CSS.supports(e)}const le=[[1,1],[4,3],[3,4],[5,4],[4,5],[3,2],[2,3],[16,10],[10,16],[16,9],[9,16],[21,9],[9,21],[32,9],[9,32]].reduce(((e,[t,i])=>({...e,[t/i]:[t,i]})),{});function re(e){if(!(S.array(e)||S.string(e)&&e.includes(":")))return!1;return(S.array(e)?e:e.split(":")).map(Number).every(S.number)}function oe(e){if(!S.array(e)||!e.every(S.number))return null;const[t,i]=e,s=(e,t)=>0===t?e:s(t,e%t),n=s(t,i);return[t/n,i/n]}function ce(e){const t=e=>re(e)?e.split(":").map(Number):null;let i=t(e);if(null===i&&(i=t(this.config.ratio)),null===i&&!S.empty(this.embed)&&S.array(this.embed.ratio)&&({ratio:i}=this.embed),null===i&&this.isHTML5){const{videoWidth:e,videoHeight:t}=this.media;i=[e,t]}return oe(i)}function ue(e){if(!this.isVideo)return{};const{wrapper:t}=this.elements,i=ce.call(this,e);if(!S.array(i))return{};const[s,n]=oe(i),a=100/s*n;if(ae(`aspect-ratio: ${s}/${n}`)?t.style.aspectRatio=`${s}/${n}`:t.style.paddingBottom=`${a}%`,this.isVimeo&&!this.config.vimeo.premium&&this.supported.ui){const e=100/this.media.offsetWidth*parseInt(window.getComputedStyle(this.media).paddingBottom,10),i=(e-a)/(e/50);this.fullscreen.active?t.style.paddingBottom=null:this.media.style.transform=`translateY(-${i}%)`}else this.isHTML5&&t.classList.add(this.config.classNames.videoFixedRatio);return{padding:a,ratio:i}}function he(e,t,i=.05){const s=e/t,n=ne(Object.keys(le),s);return Math.abs(n-s)<=i?le[n]:[e,t]}const de={getSources(){if(!this.isHTML5)return[];return Array.from(this.media.querySelectorAll("source")).filter((e=>{const t=e.getAttribute("type");return!!S.empty(t)||K.mime.call(this,t)}))},getQualityOptions(){return this.config.quality.forced?this.config.quality.options:de.getSources.call(this).map((e=>Number(e.getAttribute("size")))).filter(Boolean)},setup(){if(!this.isHTML5)return;const e=this;e.options.speed=e.config.speed.options,S.empty(this.config.ratio)||ue.call(e),Object.defineProperty(e.media,"quality",{get(){const t=de.getSources.call(e).find((t=>t.getAttribute("src")===e.source));return t&&Number(t.getAttribute("size"))},set(t){if(e.quality!==t){if(e.config.quality.forced&&S.function(e.config.quality.onChange))e.config.quality.onChange(t);else{const i=de.getSources.call(e).find((e=>Number(e.getAttribute("size"))===t));if(!i)return;const{currentTime:s,paused:n,preload:a,readyState:l,playbackRate:r}=e.media;e.media.src=i.getAttribute("src"),("none"!==a||l)&&(e.once("loadedmetadata",(()=>{e.speed=r,e.currentTime=s,n||ie(e.play())})),e.media.load())}Z.call(e,e.media,"qualitychange",!1,{quality:t})}}})},cancelRequests(){this.isHTML5&&(O(de.getSources.call(this)),this.media.setAttribute("src",this.config.blankVideo),this.media.load(),this.debug.log("Cancelled network requests"))}};function me(e,...t){return S.empty(e)?e:e.toString().replace(/{(\d+)}/g,((e,i)=>t[i].toString()))}const pe=(e="",t="",i="")=>e.replace(new RegExp(t.toString().replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1"),"g"),i.toString()),ge=(e="")=>e.toString().replace(/\w\S*/g,(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()));function fe(e=""){let t=e.toString();return t=function(e=""){let t=e.toString();return t=pe(t,"-"," "),t=pe(t,"_"," "),t=ge(t),pe(t," ","")}(t),t.charAt(0).toLowerCase()+t.slice(1)}function ye(e){const t=document.createElement("div");return t.appendChild(e),t.innerHTML}const be={pip:"PIP",airplay:"AirPlay",html5:"HTML5",vimeo:"Vimeo",youtube:"YouTube"},ve={get(e="",t={}){if(S.empty(e)||S.empty(t))return"";let i=N(t.i18n,e);if(S.empty(i))return Object.keys(be).includes(e)?be[e]:"";const s={"{seektime}":t.seekTime,"{title}":t.title};return Object.entries(s).forEach((([e,t])=>{i=pe(i,e,t)})),i}};class we{constructor(t){e(this,"get",(e=>{if(!we.supported||!this.enabled)return null;const t=window.localStorage.getItem(this.key);if(S.empty(t))return null;const i=JSON.parse(t);return S.string(e)&&e.length?i[e]:i})),e(this,"set",(e=>{if(!we.supported||!this.enabled)return;if(!S.object(e))return;let t=this.get();S.empty(t)&&(t={}),x(t,e);try{window.localStorage.setItem(this.key,JSON.stringify(t))}catch(e){}})),this.enabled=t.config.storage.enabled,this.key=t.config.storage.key}static get supported(){try{if(!("localStorage"in window))return!1;const e="___test";return window.localStorage.setItem(e,e),window.localStorage.removeItem(e),!0}catch(e){return!1}}}function Te(e,t="text"){return new Promise(((i,s)=>{try{const s=new XMLHttpRequest;if(!("withCredentials"in s))return;s.addEventListener("load",(()=>{if("text"===t)try{i(JSON.parse(s.responseText))}catch(e){i(s.responseText)}else i(s.response)})),s.addEventListener("error",(()=>{throw new Error(s.status)})),s.open("GET",e,!0),s.responseType=t,s.send()}catch(e){s(e)}}))}function ke(e,t){if(!S.string(e))return;const i="cache",s=S.string(t);let n=!1;const a=()=>null!==document.getElementById(t),l=(e,t)=>{e.innerHTML=t,s&&a()||document.body.insertAdjacentElement("afterbegin",e)};if(!s||!a()){const a=we.supported,r=document.createElement("div");if(r.setAttribute("hidden",""),s&&r.setAttribute("id",t),a){const e=window.localStorage.getItem(`${i}-${t}`);if(n=null!==e,n){const t=JSON.parse(e);l(r,t.content)}}Te(e).then((e=>{if(!S.empty(e)){if(a)try{window.localStorage.setItem(`${i}-${t}`,JSON.stringify({content:e}))}catch(e){}l(r,e)}})).catch((()=>{}))}}const Ce=e=>Math.trunc(e/60/60%60,10),Ae=e=>Math.trunc(e/60%60,10),Se=e=>Math.trunc(e%60,10);function Ee(e=0,t=!1,i=!1){if(!S.number(e))return Ee(void 0,t,i);const s=e=>`0${e}`.slice(-2);let n=Ce(e);const a=Ae(e),l=Se(e);return n=t||n>0?`${n}:`:"",`${i&&e>0?"-":""}${n}${s(a)}:${s(l)}`}const Pe={getIconUrl(){const e=new URL(this.config.iconUrl,window.location),t=window.location.host?window.location.host:window.top.location.host,i=e.host!==t||M.isIE&&!window.svg4everybody;return{url:this.config.iconUrl,cors:i}},findElements(){try{return this.elements.controls=B.call(this,this.config.selectors.controls.wrapper),this.elements.buttons={play:U.call(this,this.config.selectors.buttons.play),pause:B.call(this,this.config.selectors.buttons.pause),restart:B.call(this,this.config.selectors.buttons.restart),rewind:B.call(this,this.config.selectors.buttons.rewind),fastForward:B.call(this,this.config.selectors.buttons.fastForward),mute:B.call(this,this.config.selectors.buttons.mute),pip:B.call(this,this.config.selectors.buttons.pip),airplay:B.call(this,this.config.selectors.buttons.airplay),settings:B.call(this,this.config.selectors.buttons.settings),captions:B.call(this,this.config.selectors.buttons.captions),fullscreen:B.call(this,this.config.selectors.buttons.fullscreen)},this.elements.progress=B.call(this,this.config.selectors.progress),this.elements.inputs={seek:B.call(this,this.config.selectors.inputs.seek),volume:B.call(this,this.config.selectors.inputs.volume)},this.elements.display={buffer:B.call(this,this.config.selectors.display.buffer),currentTime:B.call(this,this.config.selectors.display.currentTime),duration:B.call(this,this.config.selectors.display.duration)},S.element(this.elements.progress)&&(this.elements.display.seekTooltip=this.elements.progress.querySelector(`.${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(e,t){const i="http://www.w3.org/2000/svg",s=Pe.getIconUrl.call(this),n=`${s.cors?"":s.url}#${this.config.iconPrefix}`,a=document.createElementNS(i,"svg");I(a,x(t,{"aria-hidden":"true",focusable:"false"}));const l=document.createElementNS(i,"use"),r=`${n}-${e}`;return"href"in l&&l.setAttributeNS("http://www.w3.org/1999/xlink","href",r),l.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",r),a.appendChild(l),a},createLabel(e,t={}){const i=ve.get(e,this.config);return $("span",{...t,class:[t.class,this.config.classNames.hidden].filter(Boolean).join(" ")},i)},createBadge(e){if(S.empty(e))return null;const t=$("span",{class:this.config.classNames.menu.value});return t.appendChild($("span",{class:this.config.classNames.menu.badge},e)),t},createButton(e,t){const i=x({},t);let s=fe(e);const n={element:"button",toggle:!1,label:null,icon:null,labelPressed:null,iconPressed:null};switch(["element","icon","label"].forEach((e=>{Object.keys(i).includes(e)&&(n[e]=i[e],delete i[e])})),"button"!==n.element||Object.keys(i).includes("type")||(i.type="button"),Object.keys(i).includes("class")?i.class.split(" ").some((e=>e===this.config.classNames.control))||x(i,{class:`${i.class} ${this.config.classNames.control}`}):i.class=this.config.classNames.control,e){case"play":n.toggle=!0,n.label="play",n.labelPressed="pause",n.icon="play",n.iconPressed="pause";break;case"mute":n.toggle=!0,n.label="mute",n.labelPressed="unmute",n.icon="volume",n.iconPressed="muted";break;case"captions":n.toggle=!0,n.label="enableCaptions",n.labelPressed="disableCaptions",n.icon="captions-off",n.iconPressed="captions-on";break;case"fullscreen":n.toggle=!0,n.label="enterFullscreen",n.labelPressed="exitFullscreen",n.icon="enter-fullscreen",n.iconPressed="exit-fullscreen";break;case"play-large":i.class+=` ${this.config.classNames.control}--overlaid`,s="play",n.label="play",n.icon="play";break;default:S.empty(n.label)&&(n.label=s),S.empty(n.icon)&&(n.icon=e)}const a=$(n.element);return n.toggle?(a.appendChild(Pe.createIcon.call(this,n.iconPressed,{class:"icon--pressed"})),a.appendChild(Pe.createIcon.call(this,n.icon,{class:"icon--not-pressed"})),a.appendChild(Pe.createLabel.call(this,n.labelPressed,{class:"label--pressed"})),a.appendChild(Pe.createLabel.call(this,n.label,{class:"label--not-pressed"}))):(a.appendChild(Pe.createIcon.call(this,n.icon)),a.appendChild(Pe.createLabel.call(this,n.label))),x(i,D(this.config.selectors.buttons[s],i)),I(a,i),"play"===s?(S.array(this.elements.buttons[s])||(this.elements.buttons[s]=[]),this.elements.buttons[s].push(a)):this.elements.buttons[s]=a,a},createRange(e,t){const i=$("input",x(D(this.config.selectors.inputs[e]),{type:"range",min:0,max:100,step:.01,value:0,autocomplete:"off",role:"slider","aria-label":ve.get(e,this.config),"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":0},t));return this.elements.inputs[e]=i,Pe.updateRangeFill.call(this,i),g.setup(i),i},createProgress(e,t){const i=$("progress",x(D(this.config.selectors.display[e]),{min:0,max:100,value:0,role:"progressbar","aria-hidden":!0},t));if("volume"!==e){i.appendChild($("span",null,"0"));const t={played:"played",buffer:"buffered"}[e],s=t?ve.get(t,this.config):"";i.innerText=`% ${s.toLowerCase()}`}return this.elements.display[e]=i,i},createTime(e,t){const i=D(this.config.selectors.display[e],t),s=$("div",x(i,{class:`${i.class?i.class:""} ${this.config.classNames.display.time} `.trim(),"aria-label":ve.get(e,this.config),role:"timer"}),"00:00");return this.elements.display[e]=s,s},bindMenuItemShortcuts(e,t){X.call(this,e,"keydown keyup",(i=>{if(![" ","ArrowUp","ArrowDown","ArrowRight"].includes(i.key))return;if(i.preventDefault(),i.stopPropagation(),"keydown"===i.type)return;const s=V(e,'[role="menuitemradio"]');if(!s&&[" ","ArrowRight"].includes(i.key))Pe.showMenuPanel.call(this,t,!0);else{let t;" "!==i.key&&("ArrowDown"===i.key||s&&"ArrowRight"===i.key?(t=e.nextElementSibling,S.element(t)||(t=e.parentNode.firstElementChild)):(t=e.previousElementSibling,S.element(t)||(t=e.parentNode.lastElementChild)),W.call(this,t,!0))}}),!1),X.call(this,e,"keyup",(e=>{"Return"===e.key&&Pe.focusFirstMenuItem.call(this,null,!0)}))},createMenuItem({value:e,list:t,type:i,title:s,badge:n=null,checked:a=!1}){const l=D(this.config.selectors.inputs[i]),r=$("button",x(l,{type:"button",role:"menuitemradio",class:`${this.config.classNames.control} ${l.class?l.class:""}`.trim(),"aria-checked":a,value:e})),o=$("span");o.innerHTML=s,S.element(n)&&o.appendChild(n),r.appendChild(o),Object.defineProperty(r,"checked",{enumerable:!0,get:()=>"true"===r.getAttribute("aria-checked"),set(e){e&&Array.from(r.parentNode.children).filter((e=>V(e,'[role="menuitemradio"]'))).forEach((e=>e.setAttribute("aria-checked","false"))),r.setAttribute("aria-checked",e?"true":"false")}}),this.listeners.bind(r,"click keyup",(t=>{if(!S.keyboardEvent(t)||" "===t.key){switch(t.preventDefault(),t.stopPropagation(),r.checked=!0,i){case"language":this.currentTrack=Number(e);break;case"quality":this.quality=e;break;case"speed":this.speed=parseFloat(e)}Pe.showMenuPanel.call(this,"home",S.keyboardEvent(t))}}),i,!1),Pe.bindMenuItemShortcuts.call(this,r,i),t.appendChild(r)},formatTime(e=0,t=!1){if(!S.number(e))return e;return Ee(e,Ce(this.duration)>0,t)},updateTimeDisplay(e=null,t=0,i=!1){S.element(e)&&S.number(t)&&(e.innerText=Pe.formatTime(t,i))},updateVolume(){this.supported.ui&&(S.element(this.elements.inputs.volume)&&Pe.setRange.call(this,this.elements.inputs.volume,this.muted?0:this.volume),S.element(this.elements.buttons.mute)&&(this.elements.buttons.mute.pressed=this.muted||0===this.volume))},setRange(e,t=0){S.element(e)&&(e.value=t,Pe.updateRangeFill.call(this,e))},updateProgress(e){if(!this.supported.ui||!S.event(e))return;let t=0;const i=(e,t)=>{const i=S.number(t)?t:0,s=S.element(e)?e:this.elements.display.buffer;if(S.element(s)){s.value=i;const e=s.getElementsByTagName("span")[0];S.element(e)&&(e.childNodes[0].nodeValue=i)}};if(e)switch(e.type){case"timeupdate":case"seeking":case"seeked":s=this.currentTime,n=this.duration,t=0===s||0===n||Number.isNaN(s)||Number.isNaN(n)?0:(s/n*100).toFixed(2),"timeupdate"===e.type&&Pe.setRange.call(this,this.elements.inputs.seek,t);break;case"playing":case"progress":i(this.elements.display.buffer,100*this.buffered)}var s,n},updateRangeFill(e){const t=S.event(e)?e.target:e;if(S.element(t)&&"range"===t.getAttribute("type")){if(V(t,this.config.selectors.inputs.seek)){t.setAttribute("aria-valuenow",this.currentTime);const e=Pe.formatTime(this.currentTime),i=Pe.formatTime(this.duration),s=ve.get("seekLabel",this.config);t.setAttribute("aria-valuetext",s.replace("{currentTime}",e).replace("{duration}",i))}else if(V(t,this.config.selectors.inputs.volume)){const e=100*t.value;t.setAttribute("aria-valuenow",e),t.setAttribute("aria-valuetext",`${e.toFixed(1)}%`)}else t.setAttribute("aria-valuenow",t.value);(M.isWebKit||M.isIPadOS)&&t.style.setProperty("--value",t.value/t.max*100+"%")}},updateSeekTooltip(e){var t,i;if(!this.config.tooltips.seek||!S.element(this.elements.inputs.seek)||!S.element(this.elements.display.seekTooltip)||0===this.duration)return;const s=this.elements.display.seekTooltip,n=`${this.config.classNames.tooltip}--visible`,a=e=>R(s,n,e);if(this.touch)return void a(!1);let l=0;const r=this.elements.progress.getBoundingClientRect();if(S.event(e))l=100/r.width*(e.pageX-r.left);else{if(!F(s,n))return;l=parseFloat(s.style.left,10)}l<0?l=0:l>100&&(l=100);const o=this.duration/100*l;s.innerText=Pe.formatTime(o);const c=null===(t=this.config.markers)||void 0===t||null===(i=t.points)||void 0===i?void 0:i.find((({time:e})=>e===Math.round(o)));c&&s.insertAdjacentHTML("afterbegin",`${c.label}<br>`),s.style.left=`${l}%`,S.event(e)&&["mouseenter","mouseleave"].includes(e.type)&&a("mouseenter"===e.type)},timeUpdate(e){const t=!S.element(this.elements.display.duration)&&this.config.invertTime;Pe.updateTimeDisplay.call(this,this.elements.display.currentTime,t?this.duration-this.currentTime:this.currentTime,t),e&&"timeupdate"===e.type&&this.media.seeking||Pe.updateProgress.call(this,e)},durationUpdate(){if(!this.supported.ui||!this.config.invertTime&&this.currentTime)return;if(this.duration>=2**32)return H(this.elements.display.currentTime,!0),void H(this.elements.progress,!0);S.element(this.elements.inputs.seek)&&this.elements.inputs.seek.setAttribute("aria-valuemax",this.duration);const e=S.element(this.elements.display.duration);!e&&this.config.displayDuration&&this.paused&&Pe.updateTimeDisplay.call(this,this.elements.display.currentTime,this.duration),e&&Pe.updateTimeDisplay.call(this,this.elements.display.duration,this.duration),this.config.markers.enabled&&Pe.setMarkers.call(this),Pe.updateSeekTooltip.call(this)},toggleMenuButton(e,t){H(this.elements.settings.buttons[e],!t)},updateSetting(e,t,i){const s=this.elements.settings.panels[e];let n=null,a=t;if("captions"===e)n=this.currentTrack;else{if(n=S.empty(i)?this[e]:i,S.empty(n)&&(n=this.config[e].default),!S.empty(this.options[e])&&!this.options[e].includes(n))return void this.debug.warn(`Unsupported value of '${n}' for ${e}`);if(!this.config[e].options.includes(n))return void this.debug.warn(`Disabled value of '${n}' for ${e}`)}if(S.element(a)||(a=s&&s.querySelector('[role="menu"]')),!S.element(a))return;this.elements.settings.buttons[e].querySelector(`.${this.config.classNames.menu.value}`).innerHTML=Pe.getLabel.call(this,e,n);const l=a&&a.querySelector(`[value="${n}"]`);S.element(l)&&(l.checked=!0)},getLabel(e,t){switch(e){case"speed":return 1===t?ve.get("normal",this.config):`${t}×`;case"quality":if(S.number(t)){const e=ve.get(`qualityLabel.${t}`,this.config);return e.length?e:`${t}p`}return ge(t);case"captions":return xe.getLabel.call(this);default:return null}},setQualityMenu(e){if(!S.element(this.elements.settings.panels.quality))return;const t="quality",i=this.elements.settings.panels.quality.querySelector('[role="menu"]');S.array(e)&&(this.options.quality=se(e).filter((e=>this.config.quality.options.includes(e))));const s=!S.empty(this.options.quality)&&this.options.quality.length>1;if(Pe.toggleMenuButton.call(this,t,s),j(i),Pe.checkMenu.call(this),!s)return;const n=e=>{const t=ve.get(`qualityBadge.${e}`,this.config);return t.length?Pe.createBadge.call(this,t):null};this.options.quality.sort(((e,t)=>{const i=this.config.quality.options;return i.indexOf(e)>i.indexOf(t)?1:-1})).forEach((e=>{Pe.createMenuItem.call(this,{value:e,list:i,type:t,title:Pe.getLabel.call(this,"quality",e),badge:n(e)})})),Pe.updateSetting.call(this,t,i)},setCaptionsMenu(){if(!S.element(this.elements.settings.panels.captions))return;const e="captions",t=this.elements.settings.panels.captions.querySelector('[role="menu"]'),i=xe.getTracks.call(this),s=Boolean(i.length);if(Pe.toggleMenuButton.call(this,e,s),j(t),Pe.checkMenu.call(this),!s)return;const n=i.map(((e,i)=>({value:i,checked:this.captions.toggled&&this.currentTrack===i,title:xe.getLabel.call(this,e),badge:e.language&&Pe.createBadge.call(this,e.language.toUpperCase()),list:t,type:"language"})));n.unshift({value:-1,checked:!this.captions.toggled,title:ve.get("disabled",this.config),list:t,type:"language"}),n.forEach(Pe.createMenuItem.bind(this)),Pe.updateSetting.call(this,e,t)},setSpeedMenu(){if(!S.element(this.elements.settings.panels.speed))return;const e="speed",t=this.elements.settings.panels.speed.querySelector('[role="menu"]');this.options.speed=this.options.speed.filter((e=>e>=this.minimumSpeed&&e<=this.maximumSpeed));const i=!S.empty(this.options.speed)&&this.options.speed.length>1;Pe.toggleMenuButton.call(this,e,i),j(t),Pe.checkMenu.call(this),i&&(this.options.speed.forEach((i=>{Pe.createMenuItem.call(this,{value:i,list:t,type:e,title:Pe.getLabel.call(this,"speed",i)})})),Pe.updateSetting.call(this,e,t))},checkMenu(){const{buttons:e}=this.elements.settings,t=!S.empty(e)&&Object.values(e).some((e=>!e.hidden));H(this.elements.settings.menu,!t)},focusFirstMenuItem(e,t=!1){if(this.elements.settings.popup.hidden)return;let i=e;S.element(i)||(i=Object.values(this.elements.settings.panels).find((e=>!e.hidden)));const s=i.querySelector('[role^="menuitem"]');W.call(this,s,t)},toggleMenu(e){const{popup:t}=this.elements.settings,i=this.elements.buttons.settings;if(!S.element(t)||!S.element(i))return;const{hidden:s}=t;let n=s;if(S.boolean(e))n=e;else if(S.keyboardEvent(e)&&"Escape"===e.key)n=!1;else if(S.event(e)){const s=S.function(e.composedPath)?e.composedPath()[0]:e.target,a=t.contains(s);if(a||!a&&e.target!==i&&n)return}i.setAttribute("aria-expanded",n),H(t,!n),R(this.elements.container,this.config.classNames.menu.open,n),n&&S.keyboardEvent(e)?Pe.focusFirstMenuItem.call(this,null,!0):n||s||W.call(this,i,S.keyboardEvent(e))},getMenuSize(e){const t=e.cloneNode(!0);t.style.position="absolute",t.style.opacity=0,t.removeAttribute("hidden"),e.parentNode.appendChild(t);const i=t.scrollWidth,s=t.scrollHeight;return O(t),{width:i,height:s}},showMenuPanel(e="",t=!1){const i=this.elements.container.querySelector(`#plyr-settings-${this.id}-${e}`);if(!S.element(i))return;const s=i.parentNode,n=Array.from(s.children).find((e=>!e.hidden));if(K.transitions&&!K.reducedMotion){s.style.width=`${n.scrollWidth}px`,s.style.height=`${n.scrollHeight}px`;const e=Pe.getMenuSize.call(this,i),t=e=>{e.target===s&&["width","height"].includes(e.propertyName)&&(s.style.width="",s.style.height="",J.call(this,s,E,t))};X.call(this,s,E,t),s.style.width=`${e.width}px`,s.style.height=`${e.height}px`}H(n,!0),H(i,!1),Pe.focusFirstMenuItem.call(this,i,t)},setDownloadUrl(){const e=this.elements.buttons.download;S.element(e)&&e.setAttribute("href",this.download)},create(e){const{bindMenuItemShortcuts:t,createButton:i,createProgress:s,createRange:n,createTime:a,setQualityMenu:l,setSpeedMenu:r,showMenuPanel:o}=Pe;this.elements.controls=null,S.array(this.config.controls)&&this.config.controls.includes("play-large")&&this.elements.container.appendChild(i.call(this,"play-large"));const c=$("div",D(this.config.selectors.controls.wrapper));this.elements.controls=c;const u={class:"plyr__controls__item"};return se(S.array(this.config.controls)?this.config.controls:[]).forEach((l=>{if("restart"===l&&c.appendChild(i.call(this,"restart",u)),"rewind"===l&&c.appendChild(i.call(this,"rewind",u)),"play"===l&&c.appendChild(i.call(this,"play",u)),"fast-forward"===l&&c.appendChild(i.call(this,"fast-forward",u)),"progress"===l){const t=$("div",{class:`${u.class} plyr__progress__container`}),i=$("div",D(this.config.selectors.progress));if(i.appendChild(n.call(this,"seek",{id:`plyr-seek-${e.id}`})),i.appendChild(s.call(this,"buffer")),this.config.tooltips.seek){const e=$("span",{class:this.config.classNames.tooltip},"00:00");i.appendChild(e),this.elements.display.seekTooltip=e}this.elements.progress=i,t.appendChild(this.elements.progress),c.appendChild(t)}if("current-time"===l&&c.appendChild(a.call(this,"currentTime",u)),"duration"===l&&c.appendChild(a.call(this,"duration",u)),"mute"===l||"volume"===l){let{volume:t}=this.elements;if(S.element(t)&&c.contains(t)||(t=$("div",x({},u,{class:`${u.class} plyr__volume`.trim()})),this.elements.volume=t,c.appendChild(t)),"mute"===l&&t.appendChild(i.call(this,"mute")),"volume"===l&&!M.isIos&&!M.isIPadOS){const i={max:1,step:.05,value:this.config.volume};t.appendChild(n.call(this,"volume",x(i,{id:`plyr-volume-${e.id}`})))}}if("captions"===l&&c.appendChild(i.call(this,"captions",u)),"settings"===l&&!S.empty(this.config.settings)){const s=$("div",x({},u,{class:`${u.class} plyr__menu`.trim(),hidden:""}));s.appendChild(i.call(this,"settings",{"aria-haspopup":!0,"aria-controls":`plyr-settings-${e.id}`,"aria-expanded":!1}));const n=$("div",{class:"plyr__menu__container",id:`plyr-settings-${e.id}`,hidden:""}),a=$("div"),l=$("div",{id:`plyr-settings-${e.id}-home`}),r=$("div",{role:"menu"});l.appendChild(r),a.appendChild(l),this.elements.settings.panels.home=l,this.config.settings.forEach((i=>{const s=$("button",x(D(this.config.selectors.buttons.settings),{type:"button",class:`${this.config.classNames.control} ${this.config.classNames.control}--forward`,role:"menuitem","aria-haspopup":!0,hidden:""}));t.call(this,s,i),X.call(this,s,"click",(()=>{o.call(this,i,!1)}));const n=$("span",null,ve.get(i,this.config)),l=$("span",{class:this.config.classNames.menu.value});l.innerHTML=e[i],n.appendChild(l),s.appendChild(n),r.appendChild(s);const c=$("div",{id:`plyr-settings-${e.id}-${i}`,hidden:""}),u=$("button",{type:"button",class:`${this.config.classNames.control} ${this.config.classNames.control}--back`});u.appendChild($("span",{"aria-hidden":!0},ve.get(i,this.config))),u.appendChild($("span",{class:this.config.classNames.hidden},ve.get("menuBack",this.config))),X.call(this,c,"keydown",(e=>{"ArrowLeft"===e.key&&(e.preventDefault(),e.stopPropagation(),o.call(this,"home",!0))}),!1),X.call(this,u,"click",(()=>{o.call(this,"home",!1)})),c.appendChild(u),c.appendChild($("div",{role:"menu"})),a.appendChild(c),this.elements.settings.buttons[i]=s,this.elements.settings.panels[i]=c})),n.appendChild(a),s.appendChild(n),c.appendChild(s),this.elements.settings.popup=n,this.elements.settings.menu=s}if("pip"===l&&K.pip&&c.appendChild(i.call(this,"pip",u)),"airplay"===l&&K.airplay&&c.appendChild(i.call(this,"airplay",u)),"download"===l){const e=x({},u,{element:"a",href:this.download,target:"_blank"});this.isHTML5&&(e.download="");const{download:t}=this.config.urls;!S.url(t)&&this.isEmbed&&x(e,{icon:`logo-${this.provider}`,label:this.provider}),c.appendChild(i.call(this,"download",e))}"fullscreen"===l&&c.appendChild(i.call(this,"fullscreen",u))})),this.isHTML5&&l.call(this,de.getQualityOptions.call(this)),r.call(this),c},inject(){if(this.config.loadSprite){const e=Pe.getIconUrl.call(this);e.cors&&ke(e.url,"sprite-plyr")}this.id=Math.floor(1e4*Math.random());let e=null;this.elements.controls=null;const t={id:this.id,seektime:this.config.seekTime,title:this.config.title};let i=!0;S.function(this.config.controls)&&(this.config.controls=this.config.controls.call(this,t)),this.config.controls||(this.config.controls=[]),S.element(this.config.controls)||S.string(this.config.controls)?e=this.config.controls:(e=Pe.create.call(this,{id:this.id,seektime:this.config.seekTime,speed:this.speed,quality:this.quality,captions:xe.getLabel.call(this)}),i=!1);let s;i&&S.string(this.config.controls)&&(e=(e=>{let i=e;return Object.entries(t).forEach((([e,t])=>{i=pe(i,`{${e}}`,t)})),i})(e)),S.string(this.config.selectors.controls.container)&&(s=document.querySelector(this.config.selectors.controls.container)),S.element(s)||(s=this.elements.container);if(s[S.element(e)?"insertAdjacentElement":"insertAdjacentHTML"]("afterbegin",e),S.element(this.elements.controls)||Pe.findElements.call(this),!S.empty(this.elements.buttons)){const e=e=>{const t=this.config.classNames.controlPressed;e.setAttribute("aria-pressed","false"),Object.defineProperty(e,"pressed",{configurable:!0,enumerable:!0,get:()=>F(e,t),set(i=!1){R(e,t,i),e.setAttribute("aria-pressed",i?"true":"false")}})};Object.values(this.elements.buttons).filter(Boolean).forEach((t=>{S.array(t)||S.nodeList(t)?Array.from(t).filter(Boolean).forEach(e):e(t)}))}if(M.isEdge&&P(s),this.config.tooltips.controls){const{classNames:e,selectors:t}=this.config,i=`${t.controls.wrapper} ${t.labels} .${e.hidden}`,s=U.call(this,i);Array.from(s).forEach((e=>{R(e,this.config.classNames.hidden,!1),R(e,this.config.classNames.tooltip,!0)}))}},setMediaMetadata(){try{"mediaSession"in navigator&&(navigator.mediaSession.metadata=new window.MediaMetadata({title:this.config.mediaMetadata.title,artist:this.config.mediaMetadata.artist,album:this.config.mediaMetadata.album,artwork:this.config.mediaMetadata.artwork}))}catch(e){}},setMarkers(){var e,t;if(!this.duration||this.elements.markers)return;const i=null===(e=this.config.markers)||void 0===e||null===(t=e.points)||void 0===t?void 0:t.filter((({time:e})=>e>0&&e<this.duration));if(null==i||!i.length)return;const s=document.createDocumentFragment(),n=document.createDocumentFragment();let a=null;const l=`${this.config.classNames.tooltip}--visible`,r=e=>R(a,l,e);i.forEach((e=>{const t=$("span",{class:this.config.classNames.marker},""),i=e.time/this.duration*100+"%";a&&(t.addEventListener("mouseenter",(()=>{e.label||(a.style.left=i,a.innerHTML=e.label,r(!0))})),t.addEventListener("mouseleave",(()=>{r(!1)}))),t.addEventListener("click",(()=>{this.currentTime=e.time})),t.style.left=i,n.appendChild(t)})),s.appendChild(n),this.config.tooltips.seek||(a=$("span",{class:this.config.classNames.tooltip},""),s.appendChild(a)),this.elements.markers={points:n,tip:a},this.elements.progress.appendChild(s)}};function Me(e,t=!0){let i=e;if(t){const e=document.createElement("a");e.href=i,i=e.href}try{return new URL(i)}catch(e){return null}}function Ne(e){const t=new URLSearchParams;return S.object(e)&&Object.entries(e).forEach((([e,i])=>{t.set(e,i)})),t}const xe={setup(){if(!this.supported.ui)return;if(!this.isVideo||this.isYouTube||this.isHTML5&&!K.textTracks)return void(S.array(this.config.controls)&&this.config.controls.includes("settings")&&this.config.settings.includes("captions")&&Pe.setCaptionsMenu.call(this));var e,t;if(S.element(this.elements.captions)||(this.elements.captions=$("div",D(this.config.selectors.captions)),this.elements.captions.setAttribute("dir","auto"),e=this.elements.captions,t=this.elements.wrapper,S.element(e)&&S.element(t)&&t.parentNode.insertBefore(e,t.nextSibling)),M.isIE&&window.URL){const e=this.media.querySelectorAll("track");Array.from(e).forEach((e=>{const t=e.getAttribute("src"),i=Me(t);null!==i&&i.hostname!==window.location.href.hostname&&["http:","https:"].includes(i.protocol)&&Te(t,"blob").then((t=>{e.setAttribute("src",window.URL.createObjectURL(t))})).catch((()=>{O(e)}))}))}const i=se((navigator.languages||[navigator.language||navigator.userLanguage||"en"]).map((e=>e.split("-")[0])));let s=(this.storage.get("language")||this.config.captions.language||"auto").toLowerCase();"auto"===s&&([s]=i);let n=this.storage.get("captions");if(S.boolean(n)||({active:n}=this.config.captions),Object.assign(this.captions,{toggled:!1,active:n,language:s,languages:i}),this.isHTML5){const e=this.config.captions.update?"addtrack removetrack":"removetrack";X.call(this,this.media.textTracks,e,xe.update.bind(this))}setTimeout(xe.update.bind(this),0)},update(){const e=xe.getTracks.call(this,!0),{active:t,language:i,meta:s,currentTrackNode:n}=this.captions,a=Boolean(e.find((e=>e.language===i)));this.isHTML5&&this.isVideo&&e.filter((e=>!s.get(e))).forEach((e=>{this.debug.log("Track added",e),s.set(e,{default:"showing"===e.mode}),"showing"===e.mode&&(e.mode="hidden"),X.call(this,e,"cuechange",(()=>xe.updateCues.call(this)))})),(a&&this.language!==i||!e.includes(n))&&(xe.setLanguage.call(this,i),xe.toggle.call(this,t&&a)),this.elements&&R(this.elements.container,this.config.classNames.captions.enabled,!S.empty(e)),S.array(this.config.controls)&&this.config.controls.includes("settings")&&this.config.settings.includes("captions")&&Pe.setCaptionsMenu.call(this)},toggle(e,t=!0){if(!this.supported.ui)return;const{toggled:i}=this.captions,s=this.config.classNames.captions.active,n=S.nullOrUndefined(e)?!i:e;if(n!==i){if(t||(this.captions.active=n,this.storage.set({captions:n})),!this.language&&n&&!t){const e=xe.getTracks.call(this),t=xe.findTrack.call(this,[this.captions.language,...this.captions.languages],!0);return this.captions.language=t.language,void xe.set.call(this,e.indexOf(t))}this.elements.buttons.captions&&(this.elements.buttons.captions.pressed=n),R(this.elements.container,s,n),this.captions.toggled=n,Pe.updateSetting.call(this,"captions"),Z.call(this,this.media,n?"captionsenabled":"captionsdisabled")}setTimeout((()=>{n&&this.captions.toggled&&(this.captions.currentTrackNode.mode="hidden")}))},set(e,t=!0){const i=xe.getTracks.call(this);if(-1!==e)if(S.number(e))if(e in i){if(this.captions.currentTrack!==e){this.captions.currentTrack=e;const s=i[e],{language:n}=s||{};this.captions.currentTrackNode=s,Pe.updateSetting.call(this,"captions"),t||(this.captions.language=n,this.storage.set({language:n})),this.isVimeo&&this.embed.enableTextTrack(n),Z.call(this,this.media,"languagechange")}xe.toggle.call(this,!0,t),this.isHTML5&&this.isVideo&&xe.updateCues.call(this)}else this.debug.warn("Track not found",e);else this.debug.warn("Invalid caption argument",e);else xe.toggle.call(this,!1,t)},setLanguage(e,t=!0){if(!S.string(e))return void this.debug.warn("Invalid language argument",e);const i=e.toLowerCase();this.captions.language=i;const s=xe.getTracks.call(this),n=xe.findTrack.call(this,[i]);xe.set.call(this,s.indexOf(n),t)},getTracks(e=!1){return Array.from((this.media||{}).textTracks||[]).filter((t=>!this.isHTML5||e||this.captions.meta.has(t))).filter((e=>["captions","subtitles"].includes(e.kind)))},findTrack(e,t=!1){const i=xe.getTracks.call(this),s=e=>Number((this.captions.meta.get(e)||{}).default),n=Array.from(i).sort(((e,t)=>s(t)-s(e)));let a;return e.every((e=>(a=n.find((t=>t.language===e)),!a))),a||(t?n[0]:void 0)},getCurrentTrack(){return xe.getTracks.call(this)[this.currentTrack]},getLabel(e){let t=e;return!S.track(t)&&K.textTracks&&this.captions.toggled&&(t=xe.getCurrentTrack.call(this)),S.track(t)?S.empty(t.label)?S.empty(t.language)?ve.get("enabled",this.config):e.language.toUpperCase():t.label:ve.get("disabled",this.config)},updateCues(e){if(!this.supported.ui)return;if(!S.element(this.elements.captions))return void this.debug.warn("No captions element to render to");if(!S.nullOrUndefined(e)&&!Array.isArray(e))return void this.debug.warn("updateCues: Invalid input",e);let t=e;if(!t){const e=xe.getCurrentTrack.call(this);t=Array.from((e||{}).activeCues||[]).map((e=>e.getCueAsHTML())).map(ye)}const i=t.map((e=>e.trim())).join("\n");if(i!==this.elements.captions.innerHTML){j(this.elements.captions);const e=$("span",D(this.config.selectors.caption));e.innerHTML=i,this.elements.captions.appendChild(e),Z.call(this,this.media,"cuechange")}}},Le={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:"https://cdn.plyr.io/3.7.8/plyr.svg",blankVideo:"https://cdn.plyr.io/static/blank.mp4",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/oembed.json?url={0}"},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",marker:"plyr__progress__marker",hidden:"plyr__sr-only",hideControls:"plyr--hide-controls",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"},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",hash:"data-plyr-embed-hash"}},ads:{enabled:!1,publisherId:"",tagUrl:""},previewThumbnails:{enabled:!1,src:""},vimeo:{byline:!1,portrait:!1,title:!1,speed:!0,transparent:!1,customControls:!0,referrerPolicy:null,premium:!1},youtube:{rel:0,showinfo:0,iv_load_policy:3,modestbranding:1,customControls:!0,noCookie:!1},mediaMetadata:{title:"",artist:"",album:"",artwork:[]},markers:{enabled:!1,points:[]}},Ie="picture-in-picture",$e="inline",_e={html5:"html5",youtube:"youtube",vimeo:"vimeo"},Oe="audio",je="video";const qe=()=>{};class De{constructor(e=!1){this.enabled=window.console&&e,this.enabled&&this.log("Debugging enabled")}get log(){return this.enabled?Function.prototype.bind.call(console.log,console):qe}get warn(){return this.enabled?Function.prototype.bind.call(console.warn,console):qe}get error(){return this.enabled?Function.prototype.bind.call(console.error,console):qe}}class He{constructor(t){e(this,"onChange",(()=>{if(!this.supported)return;const e=this.player.elements.buttons.fullscreen;S.element(e)&&(e.pressed=this.active);const t=this.target===this.player.media?this.target:this.player.elements.container;Z.call(this.player,t,this.active?"enterfullscreen":"exitfullscreen",!0)})),e(this,"toggleFallback",((e=!1)=>{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":"",R(this.target,this.player.config.classNames.fullscreen.fallback,e),M.isIos){let t=document.head.querySelector('meta[name="viewport"]');const i="viewport-fit=cover";t||(t=document.createElement("meta"),t.setAttribute("name","viewport"));const s=S.string(t.content)&&t.content.includes(i);e?(this.cleanupViewport=!s,s||(t.content+=`,${i}`)):this.cleanupViewport&&(t.content=t.content.split(",").filter((e=>e.trim()!==i)).join(","))}this.onChange()})),e(this,"trapFocus",(e=>{if(M.isIos||M.isIPadOS||!this.active||"Tab"!==e.key)return;const t=document.activeElement,i=U.call(this.player,"a[href], button:not(:disabled), input:not(:disabled), [tabindex]"),[s]=i,n=i[i.length-1];t!==n||e.shiftKey?t===s&&e.shiftKey&&(n.focus(),e.preventDefault()):(s.focus(),e.preventDefault())})),e(this,"update",(()=>{if(this.supported){let e;e=this.forceFallback?"Fallback (forced)":He.nativeSupported?"Native":"Fallback",this.player.debug.log(`${e} fullscreen enabled`)}else this.player.debug.log("Fullscreen not supported and fallback disabled");R(this.player.elements.container,this.player.config.classNames.fullscreen.enabled,this.supported)})),e(this,"enter",(()=>{this.supported&&(M.isIos&&this.player.config.fullscreen.iosNative?this.player.isVimeo?this.player.embed.requestFullscreen():this.target.webkitEnterFullscreen():!He.nativeSupported||this.forceFallback?this.toggleFallback(!0):this.prefix?S.empty(this.prefix)||this.target[`${this.prefix}Request${this.property}`]():this.target.requestFullscreen({navigationUI:"hide"}))})),e(this,"exit",(()=>{if(this.supported)if(M.isIos&&this.player.config.fullscreen.iosNative)this.player.isVimeo?this.player.embed.exitFullscreen():this.target.webkitEnterFullscreen(),ie(this.player.play());else if(!He.nativeSupported||this.forceFallback)this.toggleFallback(!1);else if(this.prefix){if(!S.empty(this.prefix)){const e="moz"===this.prefix?"Cancel":"Exit";document[`${this.prefix}${e}${this.property}`]()}}else(document.cancelFullScreen||document.exitFullscreen).call(document)})),e(this,"toggle",(()=>{this.active?this.exit():this.enter()})),this.player=t,this.prefix=He.prefix,this.property=He.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){const{prototype:i}=Element;return(i.closest||function(){let e=this;do{if(V.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),X.call(this.player,document,"ms"===this.prefix?"MSFullscreenChange":`${this.prefix}fullscreenchange`,(()=>{this.onChange()})),X.call(this.player,this.player.elements.container,"dblclick",(e=>{S.element(this.player.elements.controls)&&this.player.elements.controls.contains(e.target)||this.player.listeners.proxy(e,this.toggle,"fullscreen")})),X.call(this,this.player.elements.container,"keydown",(e=>this.trapFocus(e))),this.update()}static get nativeSupported(){return!!(document.fullscreenEnabled||document.webkitFullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled)}get useNative(){return He.nativeSupported&&!this.forceFallback}static get prefix(){if(S.function(document.exitFullscreen))return"";let e="";return["webkit","moz","ms"].some((t=>!(!S.function(document[`${t}ExitFullscreen`])&&!S.function(document[`${t}CancelFullScreen`]))&&(e=t,!0))),e}static get property(){return"moz"===this.prefix?"FullScreen":"Fullscreen"}get supported(){return[this.player.config.fullscreen.enabled,this.player.isVideo,He.nativeSupported||this.player.config.fullscreen.fallback,!this.player.isYouTube||He.nativeSupported||!M.isIos||this.player.config.playsinline&&!this.player.config.fullscreen.iosNative].every(Boolean)}get active(){if(!this.supported)return!1;if(!He.nativeSupported||this.forceFallback)return F(this.target,this.player.config.classNames.fullscreen.fallback);const e=this.prefix?this.target.getRootNode()[`${this.prefix}${this.property}Element`]:this.target.getRootNode().fullscreenElement;return e&&e.shadowRoot?e===this.target.getRootNode().host:e===this.target}get target(){return M.isIos&&this.player.config.fullscreen.iosNative?this.player.media:this.player.elements.fullscreen??this.player.elements.container}}function Re(e,t=1){return new Promise(((i,s)=>{const n=new Image,a=()=>{delete n.onload,delete n.onerror,(n.naturalWidth>=t?i:s)(n)};Object.assign(n,{onload:a,onerror:a,src:e})}))}const Fe={addStyleHook(){R(this.elements.container,this.config.selectors.container.replace(".",""),!0),R(this.elements.container,this.config.classNames.uiSupported,this.supported.ui)},toggleNativeControls(e=!1){e&&this.isHTML5?this.media.setAttribute("controls",""):this.media.removeAttribute("controls")},build(){if(this.listeners.media(),!this.supported.ui)return this.debug.warn(`Basic support only for ${this.provider} ${this.type}`),void Fe.toggleNativeControls.call(this,!0);S.element(this.elements.controls)||(Pe.inject.call(this),this.listeners.controls()),Fe.toggleNativeControls.call(this),this.isHTML5&&xe.setup.call(this),this.volume=null,this.muted=null,this.loop=null,this.quality=null,this.speed=null,Pe.updateVolume.call(this),Pe.timeUpdate.call(this),Pe.durationUpdate.call(this),Fe.checkPlaying.call(this),R(this.elements.container,this.config.classNames.pip.supported,K.pip&&this.isHTML5&&this.isVideo),R(this.elements.container,this.config.classNames.airplay.supported,K.airplay&&this.isHTML5),R(this.elements.container,this.config.classNames.isTouch,this.touch),this.ready=!0,setTimeout((()=>{Z.call(this,this.media,"ready")}),0),Fe.setTitle.call(this),this.poster&&Fe.setPoster.call(this,this.poster,!1).catch((()=>{})),this.config.duration&&Pe.durationUpdate.call(this),this.config.mediaMetadata&&Pe.setMediaMetadata.call(this)},setTitle(){let e=ve.get("play",this.config);if(S.string(this.config.title)&&!S.empty(this.config.title)&&(e+=`, ${this.config.title}`),Array.from(this.elements.buttons.play||[]).forEach((t=>{t.setAttribute("aria-label",e)})),this.isEmbed){const e=B.call(this,"iframe");if(!S.element(e))return;const t=S.empty(this.config.title)?"video":this.config.title,i=ve.get("frameTitle",this.config);e.setAttribute("title",i.replace("{title}",t))}},togglePoster(e){R(this.elements.container,this.config.classNames.posterEnabled,e)},setPoster(e,t=!0){return t&&this.poster?Promise.reject(new Error("Poster already set")):(this.media.setAttribute("data-poster",e),this.elements.poster.removeAttribute("hidden"),te.call(this).then((()=>Re(e))).catch((t=>{throw e===this.poster&&Fe.togglePoster.call(this,!1),t})).then((()=>{if(e!==this.poster)throw new Error("setPoster cancelled by later call to setPoster")})).then((()=>(Object.assign(this.elements.poster.style,{backgroundImage:`url('${e}')`,backgroundSize:""}),Fe.togglePoster.call(this,!0),e))))},checkPlaying(e){R(this.elements.container,this.config.classNames.playing,this.playing),R(this.elements.container,this.config.classNames.paused,this.paused),R(this.elements.container,this.config.classNames.stopped,this.stopped),Array.from(this.elements.buttons.play||[]).forEach((e=>{Object.assign(e,{pressed:this.playing}),e.setAttribute("aria-label",ve.get(this.playing?"pause":"play",this.config))})),S.event(e)&&"timeupdate"===e.type||Fe.toggleControls.call(this)},checkLoading(e){this.loading=["stalled","waiting"].includes(e.type),clearTimeout(this.timers.loading),this.timers.loading=setTimeout((()=>{R(this.elements.container,this.config.classNames.loading,this.loading),Fe.toggleControls.call(this)}),this.loading?250:0)},toggleControls(e){const{controls:t}=this.elements;if(t&&this.config.hideControls){const i=this.touch&&this.lastSeekTime+2e3>Date.now();this.toggleControls(Boolean(e||this.loading||this.paused||t.pressed||t.hover||i))}},migrateStyles(){Object.values({...this.media.style}).filter((e=>!S.empty(e)&&S.string(e)&&e.startsWith("--plyr"))).forEach((e=>{this.elements.container.style.setProperty(e,this.media.style.getPropertyValue(e)),this.media.style.removeProperty(e)})),S.empty(this.media.style)&&this.media.removeAttribute("style")}};class Ve{constructor(t){e(this,"firstTouch",(()=>{const{player:e}=this,{elements:t}=e;e.touch=!0,R(t.container,e.config.classNames.isTouch,!0)})),e(this,"global",((e=!0)=>{const{player:t}=this;t.config.keyboard.global&&Q.call(t,window,"keydown keyup",this.handleKey,e,!1),Q.call(t,document.body,"click",this.toggleMenu,e),G.call(t,document.body,"touchstart",this.firstTouch)})),e(this,"container",(()=>{const{player:e}=this,{config:t,elements:i,timers:s}=e;!t.keyboard.global&&t.keyboard.focused&&X.call(e,i.container,"keydown keyup",this.handleKey,!1),X.call(e,i.container,"mousemove mouseleave touchstart touchmove enterfullscreen exitfullscreen",(t=>{const{controls:n}=i;n&&"enterfullscreen"===t.type&&(n.pressed=!1,n.hover=!1);let a=0;["touchstart","touchmove","mousemove"].includes(t.type)&&(Fe.toggleControls.call(e,!0),a=e.touch?3e3:2e3),clearTimeout(s.controls),s.controls=setTimeout((()=>Fe.toggleControls.call(e,!1)),a)}));const n=()=>{if(!e.isVimeo||e.config.vimeo.premium)return;const t=i.wrapper,{active:s}=e.fullscreen,[n,a]=ce.call(e),l=ae(`aspect-ratio: ${n} / ${a}`);if(!s)return void(l?(t.style.width=null,t.style.height=null):(t.style.maxWidth=null,t.style.margin=null));const[r,o]=[Math.max(document.documentElement.clientWidth||0,window.innerWidth||0),Math.max(document.documentElement.clientHeight||0,window.innerHeight||0)],c=r/o>n/a;l?(t.style.width=c?"auto":"100%",t.style.height=c?"100%":"auto"):(t.style.maxWidth=c?o/a*n+"px":null,t.style.margin=c?"0 auto":null)},a=()=>{clearTimeout(s.resized),s.resized=setTimeout(n,50)};X.call(e,i.container,"enterfullscreen exitfullscreen",(t=>{const{target:s}=e.fullscreen;if(s!==i.container)return;if(!e.isEmbed&&S.empty(e.config.ratio))return;n();("enterfullscreen"===t.type?X:J).call(e,window,"resize",a)}))})),e(this,"media",(()=>{const{player:e}=this,{elements:t}=e;if(X.call(e,e.media,"timeupdate seeking seeked",(t=>Pe.timeUpdate.call(e,t))),X.call(e,e.media,"durationchange loadeddata loadedmetadata",(t=>Pe.durationUpdate.call(e,t))),X.call(e,e.media,"ended",(()=>{e.isHTML5&&e.isVideo&&e.config.resetOnEnd&&(e.restart(),e.pause())})),X.call(e,e.media,"progress playing seeking seeked",(t=>Pe.updateProgress.call(e,t))),X.call(e,e.media,"volumechange",(t=>Pe.updateVolume.call(e,t))),X.call(e,e.media,"playing play pause ended emptied timeupdate",(t=>Fe.checkPlaying.call(e,t))),X.call(e,e.media,"waiting canplay seeked playing",(t=>Fe.checkLoading.call(e,t))),e.supported.ui&&e.config.clickToPlay&&!e.isAudio){const i=B.call(e,`.${e.config.classNames.video}`);if(!S.element(i))return;X.call(e,t.container,"click",(s=>{([t.container,i].includes(s.target)||i.contains(s.target))&&(e.touch&&e.config.hideControls||(e.ended?(this.proxy(s,e.restart,"restart"),this.proxy(s,(()=>{ie(e.play())}),"play")):this.proxy(s,(()=>{ie(e.togglePlay())}),"play")))}))}e.supported.ui&&e.config.disableContextMenu&&X.call(e,t.wrapper,"contextmenu",(e=>{e.preventDefault()}),!1),X.call(e,e.media,"volumechange",(()=>{e.storage.set({volume:e.volume,muted:e.muted})})),X.call(e,e.media,"ratechange",(()=>{Pe.updateSetting.call(e,"speed"),e.storage.set({speed:e.speed})})),X.call(e,e.media,"qualitychange",(t=>{Pe.updateSetting.call(e,"quality",null,t.detail.quality)})),X.call(e,e.media,"ready qualitychange",(()=>{Pe.setDownloadUrl.call(e)}));const i=e.config.events.concat(["keyup","keydown"]).join(" ");X.call(e,e.media,i,(i=>{let{detail:s={}}=i;"error"===i.type&&(s=e.media.error),Z.call(e,t.container,i.type,!0,s)}))})),e(this,"proxy",((e,t,i)=>{const{player:s}=this,n=s.config.listeners[i];let a=!0;S.function(n)&&(a=n.call(s,e)),!1!==a&&S.function(t)&&t.call(s,e)})),e(this,"bind",((e,t,i,s,n=!0)=>{const{player:a}=this,l=a.config.listeners[s],r=S.function(l);X.call(a,e,t,(e=>this.proxy(e,i,s)),n&&!r)})),e(this,"controls",(()=>{const{player:e}=this,{elements:t}=e,i=M.isIE?"change":"input";if(t.buttons.play&&Array.from(t.buttons.play).forEach((t=>{this.bind(t,"click",(()=>{ie(e.togglePlay())}),"play")})),this.bind(t.buttons.restart,"click",e.restart,"restart"),this.bind(t.buttons.rewind,"click",(()=>{e.lastSeekTime=Date.now(),e.rewind()}),"rewind"),this.bind(t.buttons.fastForward,"click",(()=>{e.lastSeekTime=Date.now(),e.forward()}),"fastForward"),this.bind(t.buttons.mute,"click",(()=>{e.muted=!e.muted}),"mute"),this.bind(t.buttons.captions,"click",(()=>e.toggleCaptions())),this.bind(t.buttons.download,"click",(()=>{Z.call(e,e.media,"download")}),"download"),this.bind(t.buttons.fullscreen,"click",(()=>{e.fullscreen.toggle()}),"fullscreen"),this.bind(t.buttons.pip,"click",(()=>{e.pip="toggle"}),"pip"),this.bind(t.buttons.airplay,"click",e.airplay,"airplay"),this.bind(t.buttons.settings,"click",(t=>{t.stopPropagation(),t.preventDefault(),Pe.toggleMenu.call(e,t)}),null,!1),this.bind(t.buttons.settings,"keyup",(t=>{[" ","Enter"].includes(t.key)&&("Enter"!==t.key?(t.preventDefault(),t.stopPropagation(),Pe.toggleMenu.call(e,t)):Pe.focusFirstMenuItem.call(e,null,!0))}),null,!1),this.bind(t.settings.menu,"keydown",(t=>{"Escape"===t.key&&Pe.toggleMenu.call(e,t)})),this.bind(t.inputs.seek,"mousedown mousemove",(e=>{const i=t.progress.getBoundingClientRect(),s=100/i.width*(e.pageX-i.left);e.currentTarget.setAttribute("seek-value",s)})),this.bind(t.inputs.seek,"mousedown mouseup keydown keyup touchstart touchend",(t=>{const i=t.currentTarget,s="play-on-seeked";if(S.keyboardEvent(t)&&!["ArrowLeft","ArrowRight"].includes(t.key))return;e.lastSeekTime=Date.now();const n=i.hasAttribute(s),a=["mouseup","touchend","keyup"].includes(t.type);n&&a?(i.removeAttribute(s),ie(e.play())):!a&&e.playing&&(i.setAttribute(s,""),e.pause())})),M.isIos){const t=U.call(e,'input[type="range"]');Array.from(t).forEach((e=>this.bind(e,i,(e=>P(e.target)))))}this.bind(t.inputs.seek,i,(t=>{const i=t.currentTarget;let s=i.getAttribute("seek-value");S.empty(s)&&(s=i.value),i.removeAttribute("seek-value"),e.currentTime=s/i.max*e.duration}),"seek"),this.bind(t.progress,"mouseenter mouseleave mousemove",(t=>Pe.updateSeekTooltip.call(e,t))),this.bind(t.progress,"mousemove touchmove",(t=>{const{previewThumbnails:i}=e;i&&i.loaded&&i.startMove(t)})),this.bind(t.progress,"mouseleave touchend click",(()=>{const{previewThumbnails:t}=e;t&&t.loaded&&t.endMove(!1,!0)})),this.bind(t.progress,"mousedown touchstart",(t=>{const{previewThumbnails:i}=e;i&&i.loaded&&i.startScrubbing(t)})),this.bind(t.progress,"mouseup touchend",(t=>{const{previewThumbnails:i}=e;i&&i.loaded&&i.endScrubbing(t)})),M.isWebKit&&Array.from(U.call(e,'input[type="range"]')).forEach((t=>{this.bind(t,"input",(t=>Pe.updateRangeFill.call(e,t.target)))})),e.config.toggleInvert&&!S.element(t.display.duration)&&this.bind(t.display.currentTime,"click",(()=>{0!==e.currentTime&&(e.config.invertTime=!e.config.invertTime,Pe.timeUpdate.call(e))})),this.bind(t.inputs.volume,i,(t=>{e.volume=t.target.value}),"volume"),this.bind(t.controls,"mouseenter mouseleave",(i=>{t.controls.hover=!e.touch&&"mouseenter"===i.type})),t.fullscreen&&Array.from(t.fullscreen.children).filter((e=>!e.contains(t.container))).forEach((i=>{this.bind(i,"mouseenter mouseleave",(i=>{t.controls&&(t.controls.hover=!e.touch&&"mouseenter"===i.type)}))})),this.bind(t.controls,"mousedown mouseup touchstart touchend touchcancel",(e=>{t.controls.pressed=["mousedown","touchstart"].includes(e.type)})),this.bind(t.controls,"focusin",(()=>{const{config:i,timers:s}=e;R(t.controls,i.classNames.noTransition,!0),Fe.toggleControls.call(e,!0),setTimeout((()=>{R(t.controls,i.classNames.noTransition,!1)}),0);const n=this.touch?3e3:4e3;clearTimeout(s.controls),s.controls=setTimeout((()=>Fe.toggleControls.call(e,!1)),n)})),this.bind(t.inputs.volume,"wheel",(t=>{const i=t.webkitDirectionInvertedFromDevice,[s,n]=[t.deltaX,-t.deltaY].map((e=>i?-e:e)),a=Math.sign(Math.abs(s)>Math.abs(n)?s:n);e.increaseVolume(a/50);const{volume:l}=e.media;(1===a&&l<1||-1===a&&l>0)&&t.preventDefault()}),"volume",!1)})),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.firstTouch=this.firstTouch.bind(this)}handleKey(e){const{player:t}=this,{elements:i}=t,{key:s,type:n,altKey:a,ctrlKey:l,metaKey:r,shiftKey:o}=e,c="keydown"===n,u=c&&s===this.lastKey;if(a||l||r||o)return;if(!s)return;if(c){const n=document.activeElement;if(S.element(n)){const{editable:s}=t.config.selectors,{seek:a}=i.inputs;if(n!==a&&V(n,s))return;if(" "===e.key&&V(n,'button, [role^="menuitem"]'))return}switch([" ","ArrowLeft","ArrowUp","ArrowRight","ArrowDown","0","1","2","3","4","5","6","7","8","9","c","f","k","l","m"].includes(s)&&(e.preventDefault(),e.stopPropagation()),s){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":u||(h=parseInt(s,10),t.currentTime=t.duration/10*h);break;case" ":case"k":u||ie(t.togglePlay());break;case"ArrowUp":t.increaseVolume(.1);break;case"ArrowDown":t.decreaseVolume(.1);break;case"m":u||(t.muted=!t.muted);break;case"ArrowRight":t.forward();break;case"ArrowLeft":t.rewind();break;case"f":t.fullscreen.toggle();break;case"c":u||t.toggleCaptions();break;case"l":t.loop=!t.loop}"Escape"===s&&!t.fullscreen.usingNative&&t.fullscreen.active&&t.fullscreen.toggle(),this.lastKey=s}else this.lastKey=null;var h}toggleMenu(e){Pe.toggleMenu.call(this.player,e)}}"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;var Ue=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(e,t){e.exports=function(){var e=function(){},t={},i={},s={};function n(e,t){e=e.push?e:[e];var n,a,l,r=[],o=e.length,c=o;for(n=function(e,i){i.length&&r.push(e),--c||t(r)};o--;)a=e[o],(l=i[a])?n(a,l):(s[a]=s[a]||[]).push(n)}function a(e,t){if(e){var n=s[e];if(i[e]=t,n)for(;n.length;)n[0](e,t),n.splice(0,1)}}function l(t,i){t.call&&(t={success:t}),i.length?(t.error||e)(i):(t.success||e)(t)}function r(t,i,s,n){var a,l,o=document,c=s.async,u=(s.numRetries||0)+1,h=s.before||e,d=t.replace(/[\?|#].*$/,""),m=t.replace(/^(css|img)!/,"");n=n||0,/(^css!|\.css$)/.test(d)?((l=o.createElement("link")).rel="stylesheet",l.href=m,(a="hideFocus"in l)&&l.relList&&(a=0,l.rel="preload",l.as="style")):/(^img!|\.(png|gif|jpg|svg|webp)$)/.test(d)?(l=o.createElement("img")).src=m:((l=o.createElement("script")).src=t,l.async=void 0===c||c),l.onload=l.onerror=l.onbeforeload=function(e){var o=e.type[0];if(a)try{l.sheet.cssText.length||(o="e")}catch(e){18!=e.code&&(o="e")}if("e"==o){if((n+=1)<u)return r(t,i,s,n)}else if("preload"==l.rel&&"style"==l.as)return l.rel="stylesheet";i(t,o,e.defaultPrevented)},!1!==h(t,l)&&o.head.appendChild(l)}function o(e,t,i){var s,n,a=(e=e.push?e:[e]).length,l=a,o=[];for(s=function(e,i,s){if("e"==i&&o.push(e),"b"==i){if(!s)return;o.push(e)}--a||t(o)},n=0;n<l;n++)r(e[n],s,i)}function c(e,i,s){var n,r;if(i&&i.trim&&(n=i),r=(n?s:i)||{},n){if(n in t)throw"LoadJS";t[n]=!0}function c(t,i){o(e,(function(e){l(r,e),t&&l({success:t,error:i},e),a(n,e)}),r)}if(r.returnPromise)return new Promise(c);c()}return c.ready=function(e,t){return n(e,(function(e){l(t,e)})),c},c.done=function(e){a(e,[])},c.reset=function(){t={},i={},s={}},c.isDefined=function(e){return e in t},c}()}));function Be(e){return new Promise(((t,i)=>{Ue(e,{success:t,error:i})}))}function We(e){e&&!this.embed.hasPlayed&&(this.embed.hasPlayed=!0),this.media.paused===e&&(this.media.paused=!e,Z.call(this,this.media,e?"play":"pause"))}const ze={setup(){const e=this;R(e.elements.wrapper,e.config.classNames.embed,!0),e.options.speed=e.config.speed.options,ue.call(e),S.object(window.Vimeo)?ze.ready.call(e):Be(e.config.urls.vimeo.sdk).then((()=>{ze.ready.call(e)})).catch((t=>{e.debug.warn("Vimeo SDK (player.js) failed to load",t)}))},ready(){const e=this,t=e.config.vimeo,{premium:i,referrerPolicy:s,...n}=t;let a=e.media.getAttribute("src"),l="";S.empty(a)?(a=e.media.getAttribute(e.config.attributes.embed.id),l=e.media.getAttribute(e.config.attributes.embed.hash)):l=function(e){const t=e.match(/^.*(vimeo.com\/|video\/)(\d+)(\?.*&*h=|\/)+([\d,a-f]+)/);return t&&5===t.length?t[4]:null}(a);const r=l?{h:l}:{};i&&Object.assign(n,{controls:!1,sidedock:!1});const o=Ne({loop:e.config.loop.active,autoplay:e.autoplay,muted:e.muted,gesture:"media",playsinline:e.config.playsinline,...r,...n}),c=(u=a,S.empty(u)?null:S.number(Number(u))?u:u.match(/^.*(vimeo.com\/|video\/)(\d+).*/)?RegExp.$2:u);var u;const h=$("iframe"),d=me(e.config.urls.vimeo.iframe,c,o);if(h.setAttribute("src",d),h.setAttribute("allowfullscreen",""),h.setAttribute("allow",["autoplay","fullscreen","picture-in-picture","encrypted-media","accelerometer","gyroscope"].join("; ")),S.empty(s)||h.setAttribute("referrerPolicy",s),i||!t.customControls)h.setAttribute("data-poster",e.poster),e.media=q(h,e.media);else{const t=$("div",{class:e.config.classNames.embedContainer,"data-poster":e.poster});t.appendChild(h),e.media=q(t,e.media)}t.customControls||Te(me(e.config.urls.vimeo.api,d)).then((t=>{!S.empty(t)&&t.thumbnail_url&&Fe.setPoster.call(e,t.thumbnail_url).catch((()=>{}))})),e.embed=new window.Vimeo.Player(h,{autopause:e.config.autopause,muted:e.muted}),e.media.paused=!0,e.media.currentTime=0,e.supported.ui&&e.embed.disableTextTrack(),e.media.play=()=>(We.call(e,!0),e.embed.play()),e.media.pause=()=>(We.call(e,!1),e.embed.pause()),e.media.stop=()=>{e.pause(),e.currentTime=0};let{currentTime:m}=e.media;Object.defineProperty(e.media,"currentTime",{get:()=>m,set(t){const{embed:i,media:s,paused:n,volume:a}=e,l=n&&!i.hasPlayed;s.seeking=!0,Z.call(e,s,"seeking"),Promise.resolve(l&&i.setVolume(0)).then((()=>i.setCurrentTime(t))).then((()=>l&&i.pause())).then((()=>l&&i.setVolume(a))).catch((()=>{}))}});let p=e.config.speed.selected;Object.defineProperty(e.media,"playbackRate",{get:()=>p,set(t){e.embed.setPlaybackRate(t).then((()=>{p=t,Z.call(e,e.media,"ratechange")})).catch((()=>{e.options.speed=[1]}))}});let{volume:g}=e.config;Object.defineProperty(e.media,"volume",{get:()=>g,set(t){e.embed.setVolume(t).then((()=>{g=t,Z.call(e,e.media,"volumechange")}))}});let{muted:f}=e.config;Object.defineProperty(e.media,"muted",{get:()=>f,set(t){const i=!!S.boolean(t)&&t;e.embed.setMuted(!!i||e.config.muted).then((()=>{f=i,Z.call(e,e.media,"volumechange")}))}});let y,{loop:b}=e.config;Object.defineProperty(e.media,"loop",{get:()=>b,set(t){const i=S.boolean(t)?t:e.config.loop.active;e.embed.setLoop(i).then((()=>{b=i}))}}),e.embed.getVideoUrl().then((t=>{y=t,Pe.setDownloadUrl.call(e)})).catch((e=>{this.debug.warn(e)})),Object.defineProperty(e.media,"currentSrc",{get:()=>y}),Object.defineProperty(e.media,"ended",{get:()=>e.currentTime===e.duration}),Promise.all([e.embed.getVideoWidth(),e.embed.getVideoHeight()]).then((t=>{const[i,s]=t;e.embed.ratio=he(i,s),ue.call(this)})),e.embed.setAutopause(e.config.autopause).then((t=>{e.config.autopause=t})),e.embed.getVideoTitle().then((t=>{e.config.title=t,Fe.setTitle.call(this)})),e.embed.getCurrentTime().then((t=>{m=t,Z.call(e,e.media,"timeupdate")})),e.embed.getDuration().then((t=>{e.media.duration=t,Z.call(e,e.media,"durationchange")})),e.embed.getTextTracks().then((t=>{e.media.textTracks=t,xe.setup.call(e)})),e.embed.on("cuechange",(({cues:t=[]})=>{const i=t.map((e=>function(e){const t=document.createDocumentFragment(),i=document.createElement("div");return t.appendChild(i),i.innerHTML=e,t.firstChild.innerText}(e.text)));xe.updateCues.call(e,i)})),e.embed.on("loaded",(()=>{if(e.embed.getPaused().then((t=>{We.call(e,!t),t||Z.call(e,e.media,"playing")})),S.element(e.embed.element)&&e.supported.ui){e.embed.element.setAttribute("tabindex",-1)}})),e.embed.on("bufferstart",(()=>{Z.call(e,e.media,"waiting")})),e.embed.on("bufferend",(()=>{Z.call(e,e.media,"playing")})),e.embed.on("play",(()=>{We.call(e,!0),Z.call(e,e.media,"playing")})),e.embed.on("pause",(()=>{We.call(e,!1)})),e.embed.on("timeupdate",(t=>{e.media.seeking=!1,m=t.seconds,Z.call(e,e.media,"timeupdate")})),e.embed.on("progress",(t=>{e.media.buffered=t.percent,Z.call(e,e.media,"progress"),1===parseInt(t.percent,10)&&Z.call(e,e.media,"canplaythrough"),e.embed.getDuration().then((t=>{t!==e.media.duration&&(e.media.duration=t,Z.call(e,e.media,"durationchange"))}))})),e.embed.on("seeked",(()=>{e.media.seeking=!1,Z.call(e,e.media,"seeked")})),e.embed.on("ended",(()=>{e.media.paused=!0,Z.call(e,e.media,"ended")})),e.embed.on("error",(t=>{e.media.error=t,Z.call(e,e.media,"error")})),t.customControls&&setTimeout((()=>Fe.build.call(e)),0)}};function Ke(e){e&&!this.embed.hasPlayed&&(this.embed.hasPlayed=!0),this.media.paused===e&&(this.media.paused=!e,Z.call(this,this.media,e?"play":"pause"))}function Ye(e){return e.noCookie?"https://www.youtube-nocookie.com":"http:"===window.location.protocol?"http://www.youtube.com":void 0}const Qe={setup(){if(R(this.elements.wrapper,this.config.classNames.embed,!0),S.object(window.YT)&&S.function(window.YT.Player))Qe.ready.call(this);else{const e=window.onYouTubeIframeAPIReady;window.onYouTubeIframeAPIReady=()=>{S.function(e)&&e(),Qe.ready.call(this)},Be(this.config.urls.youtube.sdk).catch((e=>{this.debug.warn("YouTube API failed to load",e)}))}},getTitle(e){Te(me(this.config.urls.youtube.api,e)).then((e=>{if(S.object(e)){const{title:t,height:i,width:s}=e;this.config.title=t,Fe.setTitle.call(this),this.embed.ratio=he(s,i)}ue.call(this)})).catch((()=>{ue.call(this)}))},ready(){const e=this,t=e.config.youtube,i=e.media&&e.media.getAttribute("id");if(!S.empty(i)&&i.startsWith("youtube-"))return;let s=e.media.getAttribute("src");S.empty(s)&&(s=e.media.getAttribute(this.config.attributes.embed.id));const n=(a=s,S.empty(a)?null:a.match(/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*/)?RegExp.$2:a);var a;const l=$("div",{id:`${e.provider}-${Math.floor(1e4*Math.random())}`,"data-poster":t.customControls?e.poster:void 0});if(e.media=q(l,e.media),t.customControls){const t=e=>`https://i.ytimg.com/vi/${n}/${e}default.jpg`;Re(t("maxres"),121).catch((()=>Re(t("sd"),121))).catch((()=>Re(t("hq")))).then((t=>Fe.setPoster.call(e,t.src))).then((t=>{t.includes("maxres")||(e.elements.poster.style.backgroundSize="cover")})).catch((()=>{}))}e.embed=new window.YT.Player(e.media,{videoId:n,host:Ye(t),playerVars:x({},{autoplay:e.config.autoplay?1:0,hl:e.config.hl,controls:e.supported.ui&&t.customControls?0:1,disablekb:1,playsinline:e.config.playsinline&&!e.config.fullscreen.iosNative?1:0,cc_load_policy:e.captions.active?1:0,cc_lang_pref:e.config.captions.language,widget_referrer:window?window.location.href:null},t),events:{onError(t){if(!e.media.error){const i=t.data,s={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 occurred";e.media.error={code:i,message:s},Z.call(e,e.media,"error")}},onPlaybackRateChange(t){const i=t.target;e.media.playbackRate=i.getPlaybackRate(),Z.call(e,e.media,"ratechange")},onReady(i){if(S.function(e.media.play))return;const s=i.target;Qe.getTitle.call(e,n),e.media.play=()=>{Ke.call(e,!0),s.playVideo()},e.media.pause=()=>{Ke.call(e,!1),s.pauseVideo()},e.media.stop=()=>{s.stopVideo()},e.media.duration=s.getDuration(),e.media.paused=!0,e.media.currentTime=0,Object.defineProperty(e.media,"currentTime",{get:()=>Number(s.getCurrentTime()),set(t){e.paused&&!e.embed.hasPlayed&&e.embed.mute(),e.media.seeking=!0,Z.call(e,e.media,"seeking"),s.seekTo(t)}}),Object.defineProperty(e.media,"playbackRate",{get:()=>s.getPlaybackRate(),set(e){s.setPlaybackRate(e)}});let{volume:a}=e.config;Object.defineProperty(e.media,"volume",{get:()=>a,set(t){a=t,s.setVolume(100*a),Z.call(e,e.media,"volumechange")}});let{muted:l}=e.config;Object.defineProperty(e.media,"muted",{get:()=>l,set(t){const i=S.boolean(t)?t:l;l=i,s[i?"mute":"unMute"](),s.setVolume(100*a),Z.call(e,e.media,"volumechange")}}),Object.defineProperty(e.media,"currentSrc",{get:()=>s.getVideoUrl()}),Object.defineProperty(e.media,"ended",{get:()=>e.currentTime===e.duration});const r=s.getAvailablePlaybackRates();e.options.speed=r.filter((t=>e.config.speed.options.includes(t))),e.supported.ui&&t.customControls&&e.media.setAttribute("tabindex",-1),Z.call(e,e.media,"timeupdate"),Z.call(e,e.media,"durationchange"),clearInterval(e.timers.buffering),e.timers.buffering=setInterval((()=>{e.media.buffered=s.getVideoLoadedFraction(),(null===e.media.lastBuffered||e.media.lastBuffered<e.media.buffered)&&Z.call(e,e.media,"progress"),e.media.lastBuffered=e.media.buffered,1===e.media.buffered&&(clearInterval(e.timers.buffering),Z.call(e,e.media,"canplaythrough"))}),200),t.customControls&&setTimeout((()=>Fe.build.call(e)),50)},onStateChange(i){const s=i.target;clearInterval(e.timers.playing);switch(e.media.seeking&&[1,2].includes(i.data)&&(e.media.seeking=!1,Z.call(e,e.media,"seeked")),i.data){case-1:Z.call(e,e.media,"timeupdate"),e.media.buffered=s.getVideoLoadedFraction(),Z.call(e,e.media,"progress");break;case 0:Ke.call(e,!1),e.media.loop?(s.stopVideo(),s.playVideo()):Z.call(e,e.media,"ended");break;case 1:t.customControls&&!e.config.autoplay&&e.media.paused&&!e.embed.hasPlayed?e.media.pause():(Ke.call(e,!0),Z.call(e,e.media,"playing"),e.timers.playing=setInterval((()=>{Z.call(e,e.media,"timeupdate")}),50),e.media.duration!==s.getDuration()&&(e.media.duration=s.getDuration(),Z.call(e,e.media,"durationchange")));break;case 2:e.muted||e.embed.unMute(),Ke.call(e,!1);break;case 3:Z.call(e,e.media,"waiting")}Z.call(e,e.elements.container,"statechange",!1,{code:i.data})}}})}},Xe={setup(){this.media?(R(this.elements.container,this.config.classNames.type.replace("{0}",this.type),!0),R(this.elements.container,this.config.classNames.provider.replace("{0}",this.provider),!0),this.isEmbed&&R(this.elements.container,this.config.classNames.type.replace("{0}","video"),!0),this.isVideo&&(this.elements.wrapper=$("div",{class:this.config.classNames.video}),L(this.media,this.elements.wrapper),this.elements.poster=$("div",{class:this.config.classNames.poster}),this.elements.wrapper.appendChild(this.elements.poster)),this.isHTML5?de.setup.call(this):this.isYouTube?Qe.setup.call(this):this.isVimeo&&ze.setup.call(this)):this.debug.warn("No media element found!")}};class Je{constructor(t){e(this,"load",(()=>{this.enabled&&(S.object(window.google)&&S.object(window.google.ima)?this.ready():Be(this.player.config.urls.googleIMA.sdk).then((()=>{this.ready()})).catch((()=>{this.trigger("error",new Error("Google IMA SDK failed to load"))})))})),e(this,"ready",(()=>{var e;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((()=>{this.clearSafetyTimer("onAdsManagerLoaded()")})),this.listeners(),this.setupIMA()})),e(this,"setupIMA",(()=>{this.elements.container=$("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,(e=>this.onAdsManagerLoaded(e)),!1),this.loader.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR,(e=>this.onAdError(e)),!1),this.requestAds()})),e(this,"requestAds",(()=>{const{container:e}=this.player.elements;try{const 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)}})),e(this,"pollCountdown",((e=!1)=>{if(!e)return clearInterval(this.countdownTimer),void this.elements.container.removeAttribute("data-badge-text");this.countdownTimer=setInterval((()=>{const e=Ee(Math.max(this.manager.getRemainingTime(),0)),t=`${ve.get("advertisement",this.player.config)} - ${e}`;this.elements.container.setAttribute("data-badge-text",t)}),100)})),e(this,"onAdsManagerLoaded",(e=>{if(!this.enabled)return;const t=new google.ima.AdsRenderingSettings;t.restoreCustomPlaybackStateOnAdBreakComplete=!0,t.enablePreloading=!0,this.manager=e.getAdsManager(this.player,t),this.cuePoints=this.manager.getCuePoints(),this.manager.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR,(e=>this.onAdError(e))),Object.keys(google.ima.AdEvent.Type).forEach((e=>{this.manager.addEventListener(google.ima.AdEvent.Type[e],(e=>this.onAdEvent(e)))})),this.trigger("loaded")})),e(this,"addCuePoints",(()=>{S.empty(this.cuePoints)||this.cuePoints.forEach((e=>{if(0!==e&&-1!==e&&e<this.player.duration){const t=this.player.elements.progress;if(S.element(t)){const i=100/this.player.duration*e,s=$("span",{class:this.player.config.classNames.cues});s.style.left=`${i.toString()}%`,t.appendChild(s)}}}))})),e(this,"onAdEvent",(e=>{const{container:t}=this.player.elements,i=e.getAd(),s=e.getAdData();switch((e=>{Z.call(this.player,this.player.media,`ads${e.replace(/_/g,"").toLowerCase()}`)})(e.type),e.type){case google.ima.AdEvent.Type.LOADED:this.trigger("loaded"),this.pollCountdown(!0),i.isLinear()||(i.width=t.offsetWidth,i.height=t.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:s.adError&&this.player.debug.warn(`Non-fatal ad error: ${s.adError.getMessage()}`)}})),e(this,"onAdError",(e=>{this.cancel(),this.player.debug.warn("Ads error",e)})),e(this,"listeners",(()=>{const{container:e}=this.player.elements;let t;this.player.on("canplay",(()=>{this.addCuePoints()})),this.player.on("ended",(()=>{this.loader.contentComplete()})),this.player.on("timeupdate",(()=>{t=this.player.currentTime})),this.player.on("seeked",(()=>{const e=this.player.currentTime;S.empty(this.cuePoints)||this.cuePoints.forEach(((i,s)=>{t<i&&i<e&&(this.manager.discardAdBreak(),this.cuePoints.splice(s,1))}))})),window.addEventListener("resize",(()=>{this.manager&&this.manager.resize(e.offsetWidth,e.offsetHeight,google.ima.ViewMode.NORMAL)}))})),e(this,"play",(()=>{const{container:e}=this.player.elements;this.managerPromise||this.resumeContent(),this.managerPromise.then((()=>{this.manager.setVolume(this.player.volume),this.elements.displayContainer.initialize();try{this.initialized||(this.manager.init(e.offsetWidth,e.offsetHeight,google.ima.ViewMode.NORMAL),this.manager.start()),this.initialized=!0}catch(e){this.onAdError(e)}})).catch((()=>{}))})),e(this,"resumeContent",(()=>{this.elements.container.style.zIndex="",this.playing=!1,ie(this.player.media.play())})),e(this,"pauseContent",(()=>{this.elements.container.style.zIndex=3,this.playing=!0,this.player.media.pause()})),e(this,"cancel",(()=>{this.initialized&&this.resumeContent(),this.trigger("error"),this.loadAds()})),e(this,"loadAds",(()=>{this.managerPromise.then((()=>{this.manager&&this.manager.destroy(),this.managerPromise=new Promise((e=>{this.on("loaded",e),this.player.debug.log(this.manager)})),this.initialized=!1,this.requestAds()})).catch((()=>{}))})),e(this,"trigger",((e,...t)=>{const i=this.events[e];S.array(i)&&i.forEach((e=>{S.function(e)&&e.apply(this,t)}))})),e(this,"on",((e,t)=>(S.array(this.events[e])||(this.events[e]=[]),this.events[e].push(t),this))),e(this,"startSafetyTimer",((e,t)=>{this.player.debug.log(`Safety timer invoked from: ${t}`),this.safetyTimer=setTimeout((()=>{this.cancel(),this.clearSafetyTimer("startSafetyTimer()")}),e)})),e(this,"clearSafetyTimer",(e=>{S.nullOrUndefined(this.safetyTimer)||(this.player.debug.log(`Safety timer cleared from: ${e}`),clearTimeout(this.safetyTimer),this.safetyTimer=null)})),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(((e,t)=>{this.on("loaded",e),this.on("error",t)})),this.load()}get enabled(){const{config:e}=this;return this.player.isHTML5&&this.player.isVideo&&e.enabled&&(!S.empty(e.publisherId)||S.url(e.tagUrl))}get tagUrl(){const{config:e}=this;if(S.url(e.tagUrl))return e.tagUrl;return`https://go.aniview.com/api/adserver6/vast/?${Ne({AV_PUBLISHERID:"58c25bb0073ef448b1087ad6",AV_CHANNELID:"5a0458dc28a06145e4519d21",AV_URL:window.location.hostname,cb:Date.now(),AV_WIDTH:640,AV_HEIGHT:480,AV_CDIM2:e.publisherId})}`}}function Ge(e=0,t=0,i=255){return Math.min(Math.max(e,t),i)}const Ze=e=>{const t=[];return e.split(/\r\n\r\n|\n\n|\r\r/).forEach((e=>{const i={};e.split(/\r\n|\n|\r/).forEach((e=>{if(S.number(i.startTime)){if(!S.empty(e.trim())&&S.empty(i.text)){const t=e.trim().split("#xywh=");[i.text]=t,t[1]&&([i.x,i.y,i.w,i.h]=t[1].split(","))}}else{const t=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})/);t&&(i.startTime=60*Number(t[1]||0)*60+60*Number(t[2])+Number(t[3])+Number(`0.${t[4]}`),i.endTime=60*Number(t[6]||0)*60+60*Number(t[7])+Number(t[8])+Number(`0.${t[9]}`))}})),i.text&&t.push(i)})),t},et=(e,t)=>{const 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};class tt{constructor(t){e(this,"load",(()=>{this.player.elements.display.seekTooltip&&(this.player.elements.display.seekTooltip.hidden=this.enabled),this.enabled&&this.getThumbnails().then((()=>{this.enabled&&(this.render(),this.determineContainerAutoSizing(),this.listeners(),this.loaded=!0)}))})),e(this,"getThumbnails",(()=>new Promise((e=>{const{src:t}=this.player.config.previewThumbnails;if(S.empty(t))throw new Error("Missing previewThumbnails.src config attribute");const i=()=>{this.thumbnails.sort(((e,t)=>e.height-t.height)),this.player.debug.log("Preview thumbnails",this.thumbnails),e()};if(S.function(t))t((e=>{this.thumbnails=e,i()}));else{const e=(S.string(t)?[t]:t).map((e=>this.getThumbnail(e)));Promise.all(e).then(i)}})))),e(this,"getThumbnail",(e=>new Promise((t=>{Te(e).then((i=>{const s={frames:Ze(i),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));const n=new Image;n.onload=()=>{s.height=n.naturalHeight,s.width=n.naturalWidth,this.thumbnails.push(s),t()},n.src=s.urlPrefix+s.frames[0].text}))})))),e(this,"startMove",(e=>{if(this.loaded&&S.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,i;const s=this.player.elements.progress.getBoundingClientRect(),n=100/s.width*(e.pageX-s.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=Ee(this.seekTime);const a=null===(t=this.player.config.markers)||void 0===t||null===(i=t.points)||void 0===i?void 0:i.find((({time:e})=>e===Math.round(this.seekTime)));a&&this.elements.thumb.time.insertAdjacentHTML("afterbegin",`${a.label}<br>`)}this.showImageAtCurrentTime()}})),e(this,"endMove",(()=>{this.toggleThumbContainer(!1,!0)})),e(this,"startScrubbing",(e=>{(S.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()))})),e(this,"endScrubbing",(()=>{this.mouseDown=!1,Math.ceil(this.lastTime)===Math.ceil(this.player.media.currentTime)?this.toggleScrubbingContainer(!1):G.call(this.player,this.player.media,"timeupdate",(()=>{this.mouseDown||this.toggleScrubbingContainer(!1)}))})),e(this,"listeners",(()=>{this.player.on("play",(()=>{this.toggleThumbContainer(!1,!0)})),this.player.on("seeked",(()=>{this.toggleThumbContainer(!1)})),this.player.on("timeupdate",(()=>{this.lastTime=this.player.media.currentTime}))})),e(this,"render",(()=>{this.elements.thumb.container=$("div",{class:this.player.config.classNames.previewThumbnails.thumbContainer}),this.elements.thumb.imageContainer=$("div",{class:this.player.config.classNames.previewThumbnails.imageContainer}),this.elements.thumb.container.appendChild(this.elements.thumb.imageContainer);const e=$("div",{class:this.player.config.classNames.previewThumbnails.timeContainer});this.elements.thumb.time=$("span",{},"00:00"),e.appendChild(this.elements.thumb.time),this.elements.thumb.imageContainer.appendChild(e),S.element(this.player.elements.progress)&&this.player.elements.progress.appendChild(this.elements.thumb.container),this.elements.scrubbing.container=$("div",{class:this.player.config.classNames.previewThumbnails.scrubbingContainer}),this.player.elements.wrapper.appendChild(this.elements.scrubbing.container)})),e(this,"destroy",(()=>{this.elements.thumb.container&&this.elements.thumb.container.remove(),this.elements.scrubbing.container&&this.elements.scrubbing.container.remove()})),e(this,"showImageAtCurrentTime",(()=>{this.mouseDown?this.setScrubbingContainerSize():this.setThumbContainerSizeAndPos();const e=this.thumbnails[0].frames.findIndex((e=>this.seekTime>=e.startTime&&this.seekTime<=e.endTime)),t=e>=0;let i=0;this.mouseDown||this.toggleThumbContainer(t),t&&(this.thumbnails.forEach(((t,s)=>{this.loadedImages.includes(t.frames[e].text)&&(i=s)})),e!==this.showingThumb&&(this.showingThumb=e,this.loadImage(i)))})),e(this,"loadImage",((e=0)=>{const t=this.showingThumb,i=this.thumbnails[e],{urlPrefix:s}=i,n=i.frames[t],a=i.frames[t].text,l=s+a;if(this.currentImageElement&&this.currentImageElement.dataset.filename===a)this.showImage(this.currentImageElement,n,e,t,a,!1),this.currentImageElement.dataset.index=t,this.removeOldImages(this.currentImageElement);else{this.loadingImage&&this.usingSprites&&(this.loadingImage.onload=null);const i=new Image;i.src=l,i.dataset.index=t,i.dataset.filename=a,this.showingThumbFilename=a,this.player.debug.log(`Loading image: ${l}`),i.onload=()=>this.showImage(i,n,e,t,a,!0),this.loadingImage=i,this.removeOldImages(i)}})),e(this,"showImage",((e,t,i,s,n,a=!0)=>{this.player.debug.log(`Showing thumb: ${n}. num: ${s}. qual: ${i}. newimg: ${a}`),this.setImageSizeAndOffset(e,t),a&&(this.currentImageContainer.appendChild(e),this.currentImageElement=e,this.loadedImages.includes(n)||this.loadedImages.push(n)),this.preloadNearby(s,!0).then(this.preloadNearby(s,!1)).then(this.getHigherQuality(i,e,t,n))})),e(this,"removeOldImages",(e=>{Array.from(this.currentImageContainer.children).forEach((t=>{if("img"!==t.tagName.toLowerCase())return;const i=this.usingSprites?500:1e3;if(t.dataset.index!==e.dataset.index&&!t.dataset.deleting){t.dataset.deleting=!0;const{currentImageContainer:e}=this;setTimeout((()=>{e.removeChild(t),this.player.debug.log(`Removing thumb: ${t.dataset.filename}`)}),i)}}))})),e(this,"preloadNearby",((e,t=!0)=>new Promise((i=>{setTimeout((()=>{const s=this.thumbnails[0].frames[e].text;if(this.showingThumbFilename===s){let n;n=t?this.thumbnails[0].frames.slice(e):this.thumbnails[0].frames.slice(0,e).reverse();let a=!1;n.forEach((e=>{const t=e.text;if(t!==s&&!this.loadedImages.includes(t)){a=!0,this.player.debug.log(`Preloading thumb filename: ${t}`);const{urlPrefix:e}=this.thumbnails[0],s=e+t,n=new Image;n.src=s,n.onload=()=>{this.player.debug.log(`Preloaded thumb filename: ${t}`),this.loadedImages.includes(t)||this.loadedImages.push(t),i()}}})),a||i()}}),300)})))),e(this,"getHigherQuality",((e,t,i,s)=>{if(e<this.thumbnails.length-1){let n=t.naturalHeight;this.usingSprites&&(n=i.h),n<this.thumbContainerHeight&&setTimeout((()=>{this.showingThumbFilename===s&&(this.player.debug.log(`Showing higher quality thumb for: ${s}`),this.loadImage(e+1))}),300)}})),e(this,"toggleThumbContainer",((e=!1,t=!1)=>{const i=this.player.config.classNames.previewThumbnails.thumbContainerShown;this.elements.thumb.container.classList.toggle(i,e),!e&&t&&(this.showingThumb=null,this.showingThumbFilename=null)})),e(this,"toggleScrubbingContainer",((e=!1)=>{const t=this.player.config.classNames.previewThumbnails.scrubbingContainerShown;this.elements.scrubbing.container.classList.toggle(t,e),e||(this.showingThumb=null,this.showingThumbFilename=null)})),e(this,"determineContainerAutoSizing",(()=>{(this.elements.thumb.imageContainer.clientHeight>20||this.elements.thumb.imageContainer.clientWidth>20)&&(this.sizeSpecifiedInCSS=!0)})),e(this,"setThumbContainerSizeAndPos",(()=>{const{imageContainer:e}=this.elements.thumb;if(this.sizeSpecifiedInCSS){if(e.clientHeight>20&&e.clientWidth<20){const t=Math.floor(e.clientHeight*this.thumbAspectRatio);e.style.width=`${t}px`}else if(e.clientHeight<20&&e.clientWidth>20){const t=Math.floor(e.clientWidth/this.thumbAspectRatio);e.style.height=`${t}px`}}else{const t=Math.floor(this.thumbContainerHeight*this.thumbAspectRatio);e.style.height=`${this.thumbContainerHeight}px`,e.style.width=`${t}px`}this.setThumbContainerPos()})),e(this,"setThumbContainerPos",(()=>{const e=this.player.elements.progress.getBoundingClientRect(),t=this.player.elements.container.getBoundingClientRect(),{container:i}=this.elements.thumb,s=t.left-e.left+10,n=t.right-e.left-i.clientWidth-10,a=this.mousePosX-e.left-i.clientWidth/2,l=Ge(a,s,n);i.style.left=`${l}px`,i.style.setProperty("--preview-arrow-offset",a-l+"px")})),e(this,"setScrubbingContainerSize",(()=>{const{width:e,height:t}=et(this.thumbAspectRatio,{width:this.player.media.clientWidth,height:this.player.media.clientHeight});this.elements.scrubbing.container.style.width=`${e}px`,this.elements.scrubbing.container.style.height=`${t}px`})),e(this,"setImageSizeAndOffset",((e,t)=>{if(!this.usingSprites)return;const i=this.thumbContainerHeight/t.h;e.style.height=e.naturalHeight*i+"px",e.style.width=e.naturalWidth*i+"px",e.style.left=`-${t.x*i}px`,e.style.top=`-${t.y*i}px`})),this.player=t,this.thumbnails=[],this.loaded=!1,this.lastMouseMoveTime=Date.now(),this.mouseDown=!1,this.loadedImages=[],this.elements={thumb:{},scrubbing:{}},this.load()}get enabled(){return this.player.isHTML5&&this.player.isVideo&&this.player.config.previewThumbnails.enabled}get currentImageContainer(){return this.mouseDown?this.elements.scrubbing.container:this.elements.thumb.imageContainer}get usingSprites(){return Object.keys(this.thumbnails[0].frames[0]).includes("w")}get thumbAspectRatio(){return this.usingSprites?this.thumbnails[0].frames[0].w/this.thumbnails[0].frames[0].h:this.thumbnails[0].width/this.thumbnails[0].height}get thumbContainerHeight(){if(this.mouseDown){const{height:e}=et(this.thumbAspectRatio,{width:this.player.media.clientWidth,height:this.player.media.clientHeight});return e}return this.sizeSpecifiedInCSS?this.elements.thumb.imageContainer.clientHeight:Math.floor(this.player.media.clientWidth/this.thumbAspectRatio/4)}get currentImageElement(){return this.mouseDown?this.currentScrubbingImageElement:this.currentThumbnailImageElement}set currentImageElement(e){this.mouseDown?this.currentScrubbingImageElement=e:this.currentThumbnailImageElement=e}}const it={insertElements(e,t){S.string(t)?_(e,this.media,{src:t}):S.array(t)&&t.forEach((t=>{_(e,this.media,t)}))},change(e){N(e,"sources.length")?(de.cancelRequests.call(this),this.destroy.call(this,(()=>{this.options.quality=[],O(this.media),this.media=null,S.element(this.elements.container)&&this.elements.container.removeAttribute("class");const{sources:t,type:i}=e,[{provider:s=_e.html5,src:n}]=t,a="html5"===s?i:"div",l="html5"===s?{}:{src:n};Object.assign(this,{provider:s,type:i,supported:K.check(i,s,this.config.playsinline),media:$(a,l)}),this.elements.container.appendChild(this.media),S.boolean(e.autoplay)&&(this.config.autoplay=e.autoplay),this.isHTML5&&(this.config.crossorigin&&this.media.setAttribute("crossorigin",""),this.config.autoplay&&this.media.setAttribute("autoplay",""),S.empty(e.poster)||(this.poster=e.poster),this.config.loop.active&&this.media.setAttribute("loop",""),this.config.muted&&this.media.setAttribute("muted",""),this.config.playsinline&&this.media.setAttribute("playsinline","")),Fe.addStyleHook.call(this),this.isHTML5&&it.insertElements.call(this,"source",t),this.config.title=e.title,Xe.setup.call(this),this.isHTML5&&Object.keys(e).includes("tracks")&&it.insertElements.call(this,"track",e.tracks),(this.isHTML5||this.isEmbed&&!this.supported.ui)&&Fe.build.call(this),this.isHTML5&&this.media.load(),S.empty(e.previewThumbnails)||(Object.assign(this.config.previewThumbnails,e.previewThumbnails),this.previewThumbnails&&this.previewThumbnails.loaded&&(this.previewThumbnails.destroy(),this.previewThumbnails=null),this.config.previewThumbnails.enabled&&(this.previewThumbnails=new tt(this))),this.fullscreen.update()}),!0)):this.debug.warn("Invalid source format")}};class st{constructor(t,i){if(e(this,"play",(()=>S.function(this.media.play)?(this.ads&&this.ads.enabled&&this.ads.managerPromise.then((()=>this.ads.play())).catch((()=>ie(this.media.play()))),this.media.play()):null)),e(this,"pause",(()=>this.playing&&S.function(this.media.pause)?this.media.pause():null)),e(this,"togglePlay",(e=>(S.boolean(e)?e:!this.playing)?this.play():this.pause())),e(this,"stop",(()=>{this.isHTML5?(this.pause(),this.restart()):S.function(this.media.stop)&&this.media.stop()})),e(this,"restart",(()=>{this.currentTime=0})),e(this,"rewind",(e=>{this.currentTime-=S.number(e)?e:this.config.seekTime})),e(this,"forward",(e=>{this.currentTime+=S.number(e)?e:this.config.seekTime})),e(this,"increaseVolume",(e=>{const t=this.media.muted?0:this.volume;this.volume=t+(S.number(e)?e:0)})),e(this,"decreaseVolume",(e=>{this.increaseVolume(-e)})),e(this,"airplay",(()=>{K.airplay&&this.media.webkitShowPlaybackTargetPicker()})),e(this,"toggleControls",(e=>{if(this.supported.ui&&!this.isAudio){const t=F(this.elements.container,this.config.classNames.hideControls),i=void 0===e?void 0:!e,s=R(this.elements.container,this.config.classNames.hideControls,i);if(s&&S.array(this.config.controls)&&this.config.controls.includes("settings")&&!S.empty(this.config.settings)&&Pe.toggleMenu.call(this,!1),s!==t){const e=s?"controlshidden":"controlsshown";Z.call(this,this.media,e)}return!s}return!1})),e(this,"on",((e,t)=>{X.call(this,this.elements.container,e,t)})),e(this,"once",((e,t)=>{G.call(this,this.elements.container,e,t)})),e(this,"off",((e,t)=>{J(this.elements.container,e,t)})),e(this,"destroy",((e,t=!1)=>{if(!this.ready)return;const i=()=>{document.body.style.overflow="",this.embed=null,t?(Object.keys(this.elements).length&&(O(this.elements.buttons.play),O(this.elements.captions),O(this.elements.controls),O(this.elements.wrapper),this.elements.buttons.play=null,this.elements.captions=null,this.elements.controls=null,this.elements.wrapper=null),S.function(e)&&e()):(ee.call(this),de.cancelRequests.call(this),q(this.elements.original,this.elements.container),Z.call(this,this.elements.original,"destroyed",!0),S.function(e)&&e.call(this.elements.original),this.ready=!1,setTimeout((()=>{this.elements=null,this.media=null}),200))};this.stop(),clearTimeout(this.timers.loading),clearTimeout(this.timers.controls),clearTimeout(this.timers.resized),this.isHTML5?(Fe.toggleNativeControls.call(this,!0),i()):this.isYouTube?(clearInterval(this.timers.buffering),clearInterval(this.timers.playing),null!==this.embed&&S.function(this.embed.destroy)&&this.embed.destroy(),i()):this.isVimeo&&(null!==this.embed&&this.embed.unload().then(i),setTimeout(i,200))})),e(this,"supports",(e=>K.mime.call(this,e))),this.timers={},this.ready=!1,this.loading=!1,this.failed=!1,this.touch=K.touch,this.media=t,S.string(this.media)&&(this.media=document.querySelectorAll(this.media)),(window.jQuery&&this.media instanceof jQuery||S.nodeList(this.media)||S.array(this.media))&&(this.media=this.media[0]),this.config=x({},Le,st.defaults,i||{},(()=>{try{return JSON.parse(this.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 De(this.config.debug),this.debug.log("Config",this.config),this.debug.log("Support",K),S.nullOrUndefined(this.media)||!S.element(this.media))return void this.debug.error("Setup failed: no suitable element passed");if(this.media.plyr)return void this.debug.warn("Target already setup");if(!this.config.enabled)return void this.debug.error("Setup failed: disabled by config");if(!K.check().api)return void this.debug.error("Setup failed: no support");const s=this.media.cloneNode(!0);s.autoplay=!1,this.elements.original=s;const n=this.media.tagName.toLowerCase();let a=null,l=null;switch(n){case"div":if(a=this.media.querySelector("iframe"),S.element(a)){if(l=Me(a.getAttribute("src")),this.provider=function(e){return/^(https?:\/\/)?(www\.)?(youtube\.com|youtube-nocookie\.com|youtu\.?be)\/.+$/.test(e)?_e.youtube:/^https?:\/\/player.vimeo.com\/video\/\d{0,9}(?=\b|\/)/.test(e)?_e.vimeo:null}(l.toString()),this.elements.container=this.media,this.media=a,this.elements.container.className="",l.search.length){const e=["1","true"];e.includes(l.searchParams.get("autoplay"))&&(this.config.autoplay=!0),e.includes(l.searchParams.get("loop"))&&(this.config.loop.active=!0),this.isYouTube?(this.config.playsinline=e.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(S.empty(this.provider)||!Object.values(_e).includes(this.provider))return void this.debug.error("Setup failed: Invalid provider");this.type=je;break;case"video":case"audio":this.type=n,this.provider=_e.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=K.check(this.type,this.provider),this.supported.api?(this.eventListeners=[],this.listeners=new Ve(this),this.storage=new we(this),this.media.plyr=this,S.element(this.elements.container)||(this.elements.container=$("div"),L(this.media,this.elements.container)),Fe.migrateStyles.call(this),Fe.addStyleHook.call(this),Xe.setup.call(this),this.config.debug&&X.call(this,this.elements.container,this.config.events.join(" "),(e=>{this.debug.log(`event: ${e.type}`)})),this.fullscreen=new He(this),(this.isHTML5||this.isEmbed&&!this.supported.ui)&&Fe.build.call(this),this.listeners.container(),this.listeners.global(),this.config.ads.enabled&&(this.ads=new Je(this)),this.isHTML5&&this.config.autoplay&&this.once("canplay",(()=>ie(this.play()))),this.lastSeekTime=0,this.config.previewThumbnails.enabled&&(this.previewThumbnails=new tt(this))):this.debug.error("Setup failed: no support")}get isHTML5(){return this.provider===_e.html5}get isEmbed(){return this.isYouTube||this.isVimeo}get isYouTube(){return this.provider===_e.youtube}get isVimeo(){return this.provider===_e.vimeo}get isVideo(){return this.type===je}get isAudio(){return this.type===Oe}get playing(){return Boolean(this.ready&&!this.paused&&!this.ended)}get paused(){return Boolean(this.media.paused)}get stopped(){return Boolean(this.paused&&0===this.currentTime)}get ended(){return Boolean(this.media.ended)}set currentTime(e){if(!this.duration)return;const t=S.number(e)&&e>0;this.media.currentTime=t?Math.min(e,this.duration):0,this.debug.log(`Seeking to ${this.currentTime} seconds`)}get currentTime(){return Number(this.media.currentTime)}get buffered(){const{buffered:e}=this.media;return S.number(e)?e:e&&e.length&&this.duration>0?e.end(0)/this.duration:0}get seeking(){return Boolean(this.media.seeking)}get duration(){const e=parseFloat(this.config.duration),t=(this.media||{}).duration,i=S.number(t)&&t!==1/0?t:0;return e||i}set volume(e){let t=e;S.string(t)&&(t=Number(t)),S.number(t)||(t=this.storage.get("volume")),S.number(t)||({volume:t}=this.config),t>1&&(t=1),t<0&&(t=0),this.config.volume=t,this.media.volume=t,!S.empty(e)&&this.muted&&t>0&&(this.muted=!1)}get volume(){return Number(this.media.volume)}set muted(e){let t=e;S.boolean(t)||(t=this.storage.get("muted")),S.boolean(t)||(t=this.config.muted),this.config.muted=t,this.media.muted=t}get muted(){return Boolean(this.media.muted)}get hasAudio(){return!this.isHTML5||(!!this.isAudio||(Boolean(this.media.mozHasAudio)||Boolean(this.media.webkitAudioDecodedByteCount)||Boolean(this.media.audioTracks&&this.media.audioTracks.length)))}set speed(e){let t=null;S.number(e)&&(t=e),S.number(t)||(t=this.storage.get("speed")),S.number(t)||(t=this.config.speed.selected);const{minimumSpeed:i,maximumSpeed:s}=this;t=Ge(t,i,s),this.config.speed.selected=t,setTimeout((()=>{this.media&&(this.media.playbackRate=t)}),0)}get speed(){return Number(this.media.playbackRate)}get minimumSpeed(){return this.isYouTube?Math.min(...this.options.speed):this.isVimeo?.5:.0625}get maximumSpeed(){return this.isYouTube?Math.max(...this.options.speed):this.isVimeo?2:16}set quality(e){const t=this.config.quality,i=this.options.quality;if(!i.length)return;let s=[!S.empty(e)&&Number(e),this.storage.get("quality"),t.selected,t.default].find(S.number),n=!0;if(!i.includes(s)){const e=ne(i,s);this.debug.warn(`Unsupported quality option: ${s}, using ${e} instead`),s=e,n=!1}t.selected=s,this.media.quality=s,n&&this.storage.set({quality:s})}get quality(){return this.media.quality}set loop(e){const t=S.boolean(e)?e:this.config.loop.active;this.config.loop.active=t,this.media.loop=t}get loop(){return Boolean(this.media.loop)}set source(e){it.change.call(this,e)}get source(){return this.media.currentSrc}get download(){const{download:e}=this.config.urls;return S.url(e)?e:this.source}set download(e){S.url(e)&&(this.config.urls.download=e,Pe.setDownloadUrl.call(this))}set poster(e){this.isVideo?Fe.setPoster.call(this,e,!1).catch((()=>{})):this.debug.warn("Poster can only be set for video")}get poster(){return this.isVideo?this.media.getAttribute("poster")||this.media.getAttribute("data-poster"):null}get ratio(){if(!this.isVideo)return null;const e=oe(ce.call(this));return S.array(e)?e.join(":"):e}set ratio(e){this.isVideo?S.string(e)&&re(e)?(this.config.ratio=oe(e),ue.call(this)):this.debug.error(`Invalid aspect ratio specified (${e})`):this.debug.warn("Aspect ratio can only be set for video")}set autoplay(e){this.config.autoplay=S.boolean(e)?e:this.config.autoplay}get autoplay(){return Boolean(this.config.autoplay)}toggleCaptions(e){xe.toggle.call(this,e,!1)}set currentTrack(e){xe.set.call(this,e,!1),xe.setup.call(this)}get currentTrack(){const{toggled:e,currentTrack:t}=this.captions;return e?t:-1}set language(e){xe.setLanguage.call(this,e,!1)}get language(){return(xe.getCurrentTrack.call(this)||{}).language}set pip(e){if(!K.pip)return;const t=S.boolean(e)?e:!this.pip;S.function(this.media.webkitSetPresentationMode)&&this.media.webkitSetPresentationMode(t?Ie:$e),S.function(this.media.requestPictureInPicture)&&(!this.pip&&t?this.media.requestPictureInPicture():this.pip&&!t&&document.exitPictureInPicture())}get pip(){return K.pip?S.empty(this.media.webkitPresentationMode)?this.media===document.pictureInPictureElement:this.media.webkitPresentationMode===Ie:null}setPreviewThumbnails(e){this.previewThumbnails&&this.previewThumbnails.loaded&&(this.previewThumbnails.destroy(),this.previewThumbnails=null),Object.assign(this.config.previewThumbnails,e),this.config.previewThumbnails.enabled&&(this.previewThumbnails=new tt(this))}static supported(e,t){return K.check(e,t)}static loadSprite(e,t){return ke(e,t)}static setup(e,t={}){let i=null;return S.string(e)?i=Array.from(document.querySelectorAll(e)):S.nodeList(e)?i=Array.from(e):S.array(e)&&(i=e.filter(S.element)),S.empty(i)?null:i.map((e=>new st(e,t)))}}var nt;return st.defaults=(nt=Le,JSON.parse(JSON.stringify(nt))),st})); 24.04.2020
views_ajax_get 8.x-1.0-rc2 ::
views_ajax_get.js
// If this is for a view, switch to GET.
if (options.url &&
options.url.indexOf('/views/ajax') !== -1 &&
drupalSettings.viewsAjaxGet &&
typeof drupalSettings.viewsAjaxGet[options.data.view_name] !== 'undefined') {
// @See Drupal.Ajax.prototype.beforeSerialize
if (this.form) {
var settings = this.settings || drupalSettings; 29.04.2020
views_ajax_history 8.x-1.5 ::
js/views_ajax_history.js
// Prepare ajax url
var ajaxUrl = options.url.split('?')[0];
var ajaxQuery = parseQueryString(options.url);
// Remove the page number from the query string, as a new filter has been
// applied and should return new results.
if ($.inArray("page", Object.keys(currentQuery)) !== -1) {
delete currentQuery.page; 09.11.2022
vwo 8.x-1.1 ::
vwo.module
var w=window,
d=document;
if (d.URL.indexOf('__vwo_disable__') > -1 || w._vwo_code) {
return;
}
var account_id={$settings['id']},
version=2.2,
settings_tolerance={$settings['timeout_setting']},
hide_element='body', 12.10.2020
webform_civicrm 8.x-5.0-beta3 ::
js/jquery.tokeninput.js
function computeURL() {
var settings = $(input).data("settings");
return typeof settings.url == 'function' ? settings.url.call(settings) : settings.url;
}
// Bring browser focus to the specified object.
// Use of setTimeout is to get around an IE bug.
// (See, e.g., http://stackoverflow.com/questions/2600186/focus-doesnt-work-in-ie)
// 25.05.2024
webtheme_admin 11.0.x-dev ::
templates/admin/entity-add-list.html.twig
This is needed for keeping the original attributes of the link's url.
#}
{% set bundle_attributes = bundle.add_link.url.getOption('attributes') ?: {} %}
{% set link_attributes = create_attribute(bundle_attributes).addClass('admin-item__link') %}
{% set description_id = bundle.add_link.text|clean_id ~ '-desc' %}
<div{{ create_attribute({ class: item_classes }) }}>
<a class="admin-item__link" title="{{ bundle.add_link.text }}" href="{{ bundle.add_link.url }}"></a>
<div class="admin-item__title"{% if bundle.description %} aria-details="{{ description_id }}"{% endif %}>
{{ bundle.add_link.text }} 