Files
ArtPlayer/docs/compiled/artplayer-plugin-vast.js
T

8 lines
24 KiB
JavaScript

/*!
* artplayer-plugin-vast.js v1.0.0
* Github: https://github.com/zhw2590582/ArtPlayer
* (c) 2017-2024 Harvey Zack
* Released under the MIT License.
*/
!function(e,t,i,n,s){var r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},o="function"==typeof r[n]&&r[n],a=o.cache||{},u="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function d(t,i){if(!a[t]){if(!e[t]){var s="function"==typeof r[n]&&r[n];if(!i&&s)return s(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var h=Error("Cannot find module '"+t+"'");throw h.code="MODULE_NOT_FOUND",h}c.resolve=function(i){var n=e[t][1][i];return null!=n?n:i},c.cache={};var l=a[t]=new d.Module(t);e[t][0].call(l.exports,c,l,l.exports,this)}return a[t].exports;function c(e){var t=c.resolve(e);return!1===t?{}:d(t)}}d.isParcelRequire=!0,d.Module=function(e){this.id=e,this.bundle=d,this.exports={}},d.modules=e,d.cache=a,d.parent=o,d.register=function(t,i){e[t]=[function(e,t){t.exports=i},{}]},Object.defineProperty(d,"root",{get:function(){return r[n]}}),r[n]=d;for(var h=0;h<t.length;h++)d(t[h]);if(i){var l=d(i);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd&&define(function(){return l})}}({iW4Tm:[function(e,t,i){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(i),n.export(i,"default",()=>r);var s=e("@glomex/vast-ima-player");function r(e){return async t=>{let{template:i,constructor:n}=t,{createElement:r,setStyles:o,append:a}=n.utils,{$video:u,$player:d}=i;await (0,s.loadImaSdk)();let h=window.google.ima,l=new h.AdsRenderingSettings,c=new s.PlayerOptions,f=`art-${Date.now()}`,p=r("div");a(d,p),p.id=f,o(p,{position:"absolute",inset:"0",width:"100%",height:"100%",zIndex:"150",display:"none"});let v=new s.Player(h,u,p,l,c);return"function"==typeof e&&await e({art:t,id:f,ima:h,imaPlayer:v,$container:p,playUrl:function(e){let t=new h.AdsRequest;t.adTagUrl=e,v.playAds(t)},playRes:function(e){let t=new h.AdsRequest;t.adsResponse=e,v.playAds(t)}}),{name:"artplayerPluginVast"}}}"undefined"!=typeof window&&(window.artplayerPluginVast=r)},{"@glomex/vast-ima-player":"bQPGX","@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}],bQPGX:[function(e,t,i){var n,s,r=e("@parcel/transformer-js/src/esmodule-helpers.js");r.defineInteropFlag(i),r.export(i,"Player",()=>eu),r.export(i,"PlayerError",()=>j),r.export(i,"PlayerEvent",()=>k),r.export(i,"PlayerOptions",()=>M),r.export(i,"loadImaSdk",()=>u);var o=null,a=function(){o=null},u=function(){var e=window;return e.google&&e.google.ima?Promise.resolve(e.google.ima):o||((o=new Promise(function(e,t){var i=document.createElement("script");i.async=!0,i.src="https://imasdk.googleapis.com/js/sdkloader/ima3.js",i.onload=e,i.onerror=t,document.body.appendChild(i)}).then(function(){return e.google.ima})).then(a).catch(a),o)};function d(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function h(e,t,i){return t&&d(e.prototype,t),i&&d(e,i),e}function l(){return(l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n])}return e}).apply(this,arguments)}function c(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,p(e,t)}function f(e){return(f=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function p(e,t){return(p=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function v(e,t,i){return(v=!function(){if("undefined"==typeof Reflect||!Reflect.construct||Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}()?function(e,t,i){var n=[null];n.push.apply(n,t);var s=new(Function.bind.apply(e,n));return i&&p(s,i.prototype),s}:Reflect.construct).apply(null,arguments)}function y(e){var t="function"==typeof Map?new Map:void 0;return(y=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,i)}function i(){return v(e,arguments,f(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),p(i,e)})(e)}function E(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function m(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);i<t;i++)n[i]=e[i];return n}var A=0;function b(e){return"__private_"+A+++"_"+e}function g(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw TypeError("attempted to use private field on non-instance");return e}var O={};O.CustomEvent="function"==typeof CustomEvent?CustomEvent:function(e){return t[e]=new t("").constructor[e],t;function t(e,t){t||(t={});var i=document.createEvent("CustomEvent");return i.initCustomEvent(e,!!t.bubbles,!!t.cancelable,t.detail),i}}("prototype");var w,P,T=O.CustomEvent,R=b("mediaElement"),D=b("currentTime"),S=b("enabled"),_=function(){function e(e){Object.defineProperty(this,R,{writable:!0,value:void 0}),Object.defineProperty(this,D,{writable:!0,value:void 0}),Object.defineProperty(this,S,{writable:!0,value:void 0}),this.seeking=void 0,g(this,R)[R]=e,g(this,D)[D]=0,g(this,S)[S]=!1,this.seeking=!1,this.t=this.t.bind(this),this.i=this.i.bind(this),this.h=this.h.bind(this),this.enable()}var t=e.prototype;return t.i=function(){this.seeking=!0},t.h=function(){this.seeking=!1},t.t=function(){var e,t;this.seeking||null!=(e=g(this,R)[R])&&e.paused||(g(this,D)[D]=null==(t=g(this,R)[R])?void 0:t.currentTime)},t.enable=function(){var e,t,i;g(this,S)[S]||(null==(e=g(this,R)[R])||e.addEventListener("seeking",this.i),null==(t=g(this,R)[R])||t.addEventListener("seeked",this.h),null==(i=g(this,R)[R])||i.addEventListener("timeupdate",this.t),g(this,S)[S]=!0)},t.disable=function(){var e,t,i;g(this,S)[S]&&(null==(e=g(this,R)[R])||e.removeEventListener("seeking",this.i),null==(t=g(this,R)[R])||t.removeEventListener("seeked",this.h),null==(i=g(this,R)[R])||i.removeEventListener("timeupdate",this.t),g(this,S)[S]=!1)},t.play=function(){var e=this;return new Promise(function(t){var i;t(null==(i=g(e,R)[R])?void 0:i.play())})},t.pause=function(){var e;null==(e=g(this,R)[R])||e.pause()},t.reset=function(){g(this,D)[D]=0,g(this,S)[S]=!1,this.seeking=!1,this.enable()},t.destroy=function(){g(this,D)[D]=0,g(this,S)[S]=!1,this.seeking=!1,this.disable(),g(this,R)[R]=void 0},h(e,[{key:"enabled",get:function(){return g(this,S)[S]}},{key:"currentTime",get:function(){return g(this,D)[D]}},{key:"duration",get:function(){var e;return null==(e=g(this,R)[R])?void 0:e.duration}},{key:"muted",get:function(){var e;return null==(e=g(this,R)[R])?void 0:e.muted}},{key:"volume",get:function(){var e;return null==(e=g(this,R)[R])?void 0:e.volume}}]),e}(),C=function(){function e(){this.delegate=document.createDocumentFragment()}var t=e.prototype;return t.addEventListener=function(){this.delegate.addEventListener.apply(this.delegate,[].slice.call(arguments))},t.dispatchEvent=function(){return this.delegate.dispatchEvent.apply(this.delegate,[].slice.call(arguments))},t.removeEventListener=function(){return this.delegate.removeEventListener.apply(this.delegate,[].slice.call(arguments))},e}(),I=["abort","canplay","canplaythrough","durationchange","emptied","ended","error","loadeddata","loadedmetadata","loadstart","pause","play","playing","progress","ratechange","seeked","seeking","stalled","suspend","timeupdate","volumechange","waiting"];(n=w||(w={})).MEDIA_START="MediaStart",n.MEDIA_IMPRESSION="MediaImpression",n.MEDIA_STOP="MediaStop",n.MEDIA_CUE_POINTS_CHANGE="MediaCuePointsChange",n.MEDIA_RESUMED="MediaResumed",(s=P||(P={})).AD_ERROR="AdError",s.AD_BUFFERING="AdBuffering",s.LOADED="AdLoaded",s.IMPRESSION="AdImpression",s.STARTED="AdStarted",s.FIRST_QUARTILE="AdFirstQuartile",s.MIDPOINT="AdMidpoint",s.THIRD_QUARTILE="AdThirdQuartile",s.AD_PROGRESS="AdProgress",s.COMPLETE="AdComplete",s.CLICK="AdClick",s.PAUSED="AdPaused",s.RESUMED="AdResumed",s.SKIPPED="AdSkipped",s.SKIPPABLE_STATE_CHANGED="AdSkippableStateChanged",s.VOLUME_CHANGED="AdVolumeChanged",s.VOLUME_MUTED="AdMuted",s.AD_METADATA="AdMetadata",s.AD_BREAK_READY="AdBreakReady",s.CONTENT_PAUSE_REQUESTED="AdContentPauseRequested",s.CONTENT_RESUME_REQUESTED="AdContentResumeRequested",s.ALL_ADS_COMPLETED="AdAllAdsCompleted",s.DURATION_CHANGE="AdDurationChange",s.INTERACTION="AdInteraction",s.LINEAR_CHANGED="AdLinearChanged",s.LOG="AdLog",s.USER_CLOSE="AdUserClose",s.AD_CAN_PLAY="AdCanPlay",s.EXPANDED_CHANGED="AdExpandedChanged",s.VIEWABLE_IMPRESSION="AdViewableImpression";var k=l({},P,w),M=function(){this.disableCustomPlaybackForIOS10Plus=!1,this.autoResize=!0,this.clickTrackingElement=void 0},j=function(e){function t(){var t;return(t=e.call.apply(e,[this].concat([].slice.call(arguments)))||this).errorCode=void 0,t.innerError=void 0,t.type=void 0,t.vastErrorCode=void 0,t}return c(t,e),t}(y(Error));j.ERROR_CODE_ADS_MANAGER_LOADED_TIMEOUT=9e3,j.ERROR_CODE_REQUEST_ADS_TIMEOUT=9001;var L=b("mediaElement"),N=b("adElement"),x=b("customPlayhead"),U=b("adsRenderingSettings"),z=b("ima"),B=b("adDisplayContainer"),V=b("adsManager"),F=b("width"),G=b("height"),H=b("adsLoader"),W=b("playerOptions"),q=b("resizeObserver"),Q=b("currentAd"),Y=b("loadedAd"),K=b("mediaStartTriggered"),X=b("mediaImpressionTriggered"),$=b("mediaInActivation"),Z=b("customPlaybackTimeAdjustedOnEnded"),J=b("cuePoints"),ee=b("adCurrentTime"),et=b("adDuration"),ei=b("startAdCallback"),en=b("adsManagerLoadedTimeout"),es=b("requestAdsTimeout"),er=b("wasExternallyPaused"),eo=b("lastNonZeroAdVolume"),ea=b("activatePromise"),eu=function(e){function t(t,i,n,s,r){void 0===s&&(s=new t.AdsRenderingSettings),void 0===r&&(r=new M),Object.defineProperty(E(o=e.call(this)||this),L,{writable:!0,value:void 0}),Object.defineProperty(E(o),N,{writable:!0,value:void 0}),Object.defineProperty(E(o),x,{writable:!0,value:void 0}),Object.defineProperty(E(o),U,{writable:!0,value:void 0}),Object.defineProperty(E(o),z,{writable:!0,value:void 0}),Object.defineProperty(E(o),B,{writable:!0,value:void 0}),Object.defineProperty(E(o),V,{writable:!0,value:void 0}),Object.defineProperty(E(o),F,{writable:!0,value:void 0}),Object.defineProperty(E(o),G,{writable:!0,value:void 0}),Object.defineProperty(E(o),H,{writable:!0,value:void 0}),Object.defineProperty(E(o),W,{writable:!0,value:void 0}),Object.defineProperty(E(o),q,{writable:!0,value:void 0}),Object.defineProperty(E(o),Q,{writable:!0,value:void 0}),Object.defineProperty(E(o),Y,{writable:!0,value:void 0}),Object.defineProperty(E(o),K,{writable:!0,value:!1}),Object.defineProperty(E(o),X,{writable:!0,value:!1}),Object.defineProperty(E(o),$,{writable:!0,value:!1}),Object.defineProperty(E(o),Z,{writable:!0,value:!1}),Object.defineProperty(E(o),J,{writable:!0,value:[]}),Object.defineProperty(E(o),ee,{writable:!0,value:void 0}),Object.defineProperty(E(o),et,{writable:!0,value:void 0}),Object.defineProperty(E(o),ei,{writable:!0,value:void 0}),Object.defineProperty(E(o),en,{writable:!0,value:void 0}),Object.defineProperty(E(o),es,{writable:!0,value:void 0}),Object.defineProperty(E(o),er,{writable:!0,value:!1}),Object.defineProperty(E(o),eo,{writable:!0,value:1}),Object.defineProperty(E(o),ea,{writable:!0,value:Promise.resolve()}),g(E(o),L)[L]=i,g(E(o),N)[N]=n,g(E(o),z)[z]=t,g(E(o),W)[W]=r,g(E(o),U)[U]=s,g(E(o),U)[U].restoreCustomPlaybackStateOnAdBreakComplete=!0,r.disableCustomPlaybackForIOS10Plus&&!g(E(o),L)[L].hasAttribute("playsinline")&&g(E(o),L)[L].setAttribute("playsinline",""),g(E(o),z)[z].settings.setDisableCustomPlaybackForIOS10Plus(r.disableCustomPlaybackForIOS10Plus),g(E(o),x)[x]=new _(g(E(o),L)[L]),o.o=o.o.bind(E(o)),I.forEach(function(e){g(E(o),L)[L].addEventListener(e,o.o)}),o.u=o.u.bind(E(o)),o.l=o.l.bind(E(o));var o,a=g(E(o),L)[L],u=a.offsetHeight,d=a.offsetWidth;return g(E(o),F)[F]=d,g(E(o),G)[G]=u,r.autoResize&&window.ResizeObserver&&(g(E(o),q)[q]=new window.ResizeObserver(function(e){return o.v(e)}),g(E(o),q)[q].observe(g(E(o),L)[L])),o}c(t,e);var i=t.prototype;return i.activate=function(){var e=this;if(!g(this,K)[K]&&!g(this,$)[$]&&(g(this,$)[$]=!0,g(this,L)[L].paused)){var t=function(){return g(e,L)[L].pause(),new Promise(function(t){setTimeout(function(){g(e,$)[$]=!1,t()},1)})};g(this,ea)[ea]=new Promise(function(t){return t(g(e,L)[L].play())}).then(t).catch(t)}},i.playAds=function(e){this.m(e)},i.loadAds=function(e,t){this.m(e,!1,t)},i.p=function(){var e=this;return g(this,ea)[ea].then(function(){return new Promise(function(t){return t(g(e,L)[L].play())})})},i.m=function(e,t,i){var n=this;void 0===t&&(t=!0),this.reset(),this.O(),g(this,z)[z].settings.setAutoPlayAdBreaks(t),g(this,L)[L].ended&&(g(this,x)[x].reset(),g(this,L)[L].currentTime=0),g(this,ei)[ei]=i,e.linearAdSlotWidth=g(this,F)[F],e.linearAdSlotHeight=g(this,G)[G],e.nonLinearAdSlotWidth=g(this,F)[F],e.nonLinearAdSlotHeight=g(this,G)[G],null==e.contentDuration&&(e.contentDuration=-3),g(this,en)[en]=window.setTimeout(function(){var e=new j("No adsManagerLoadedEvent within 5000ms.");e.errorCode=j.ERROR_CODE_ADS_MANAGER_LOADED_TIMEOUT,n.j(e)},5e3),g(this,es)[es]=window.setTimeout(function(){var e=new j("No response for ads-request within 10000ms.");e.errorCode=j.ERROR_CODE_REQUEST_ADS_TIMEOUT,n.j(e)},1e4),g(this,H)[H].requestAds(e)},i.O=function(){g(this,B)[B]=new(g(this,z))[z].AdDisplayContainer(g(this,N)[N],g(this,W)[W].disableCustomPlaybackForIOS10Plus?void 0:g(this,L)[L],g(this,W)[W].clickTrackingElement),g(this,H)[H]=new(g(this,z))[z].AdsLoader(g(this,B)[B]),g(this,H)[H].addEventListener(g(this,z)[z].AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,this.u,!1),g(this,H)[H].addEventListener(g(this,z)[z].AdErrorEvent.Type.AD_ERROR,this.l,!1)},i.skipAd=function(){g(this,V)[V]&&g(this,V)[V].skip()},i.discardAdBreak=function(){g(this,V)[V]&&g(this,V)[V].discardAdBreak()},i.play=function(){var e=this;g(this,er)[er]=!1,!g(this,x)[x].enabled&&g(this,V)[V]?g(this,V)[V].resume():g(this,en)[en]||this.p().then(function(){}).catch(function(){e.dispatchEvent(new T("pause"))})},i.pause=function(){g(this,er)[er]=!0,!g(this,x)[x].enabled&&g(this,V)[V]?g(this,V)[V].pause():g(this,L)[L].pause()},i.g=function(e){g(this,J)[J]=[].concat(e),this.dispatchEvent(new T(k.MEDIA_CUE_POINTS_CHANGE,{detail:{cuePoints:[].concat(g(this,J)[J])}}))},i.A=function(e){var t=this.cuePoints.indexOf(e);t>-1&&(g(this,J)[J].splice(t,1),this.g(g(this,J)[J]))},i.resizeAd=function(e,t){g(this,F)[F]=e,g(this,G)[G]=t,g(this,V)[V]&&g(this,V)[V].resize(e,t,this.k()),g(this,N)[N].style.width=e+"px",g(this,N)[N].style.height=t+"px"},i.reset=function(e){void 0===e&&(e=!1),e&&(g(this,X)[X]=!1,g(this,K)[K]=!1,g(this,Z)[Z]=!1),this.C(),g(this,J)[J]=[],g(this,er)[er]=!1,g(this,ei)[ei]=void 0,g(this,V)[V]&&g(this,V)[V].destroy(),g(this,V)[V]=void 0,g(this,z)[z].settings.setAutoPlayAdBreaks(!0),e&&this.P(),g(this,N)[N].style.display="none"},i.P=function(){g(this,H)[H]&&(g(this,H)[H].removeEventListener(g(this,z)[z].AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,this.u,!1),g(this,H)[H].removeEventListener(g(this,z)[z].AdErrorEvent.Type.AD_ERROR,this.l,!1),g(this,H)[H].destroy()),g(this,B)[B]&&g(this,B)[B].destroy()},i.destroy=function(){var e,t,i,n,s=this;this.reset(!0),g(this,x)[x].destroy(),I.forEach(function(e){g(s,L)[L].removeEventListener(e,s.o)}),null==(e=g(this,H)[H])||e.removeEventListener(g(this,z)[z].AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,this.u,!1),null==(t=g(this,B)[B])||t.destroy(),null==(i=g(this,H)[H])||i.destroy(),g(this,X)[X]=!1,g(this,Z)[Z]=!1,g(this,K)[K]=!1,null==(n=g(this,q)[q])||n.disconnect()},i.isCustomPlaybackUsed=function(){return!1===g(this,z)[z].settings.getDisableCustomPlaybackForIOS10Plus()&&!g(this,N)[N].querySelector("video")},i.C=function(){window.clearTimeout(g(this,en)[en]),window.clearTimeout(g(this,es)[es]),g(this,en)[en]=void 0,g(this,es)[es]=void 0,g(this,Q)[Q]=void 0,g(this,ee)[ee]=void 0,g(this,et)[et]=void 0,g(this,N)[N].style.display="none",g(this,N)[N].classList.remove("nonlinear"),g(this,V)[V]&&this.R()},i.o=function(e){var t=this;if(g(this,x)[x].enabled||"volumechange"===e.type){if("timeupdate"===e.type){if(g(this,L)[L].currentTime<.5)return;if(g(this,V)[V]){var i=g(this,V)[V].getCuePoints().filter(function(e){return e>=0&&e<g(t,x)[x].currentTime}).pop();this.A(i)}!g(this,X)[X]&&g(this,K)[K]&&(this.dispatchEvent(new T(k.MEDIA_IMPRESSION)),g(this,X)[X]=!0)}if("play"!==e.type||g(this,K)[K]||g(this,$)[$]||(this.dispatchEvent(new T(k.MEDIA_START)),g(this,K)[K]=!0),"ended"===e.type&&(this.isCustomPlaybackUsed()&&g(this,L)[L].currentTime===g(this,L)[L].duration&&g(this,J)[J].indexOf(-1)>-1&&(g(this,L)[L].currentTime=g(this,L)[L].duration-1e-5,g(this,Z)[Z]=!0),g(this,H)[H].contentComplete(),g(this,V)[V]||this.T()),!window.ResizeObserver&&g(this,W)[W].autoResize&&"loadedmetadata"===e.type){var n=g(this,L)[L],s=n.offsetHeight,r=n.offsetWidth;g(this,F)[F]=r,g(this,G)[G]=s,this.R()}g(this,$)[$]&&"volumechange"!==e.type||this.dispatchEvent(new T(e.type))}},i.S=function(e){var t=this,i=g(this,z)[z].AdEvent;switch(e.type){case i.Type.LOADED:var n=e.getAd();g(this,ei)[ei]&&0===g(this,J)[J].length?g(this,ei)[ei]({ad:n,start:function(){t.M(),g(t,ei)[ei]=void 0},startWithoutReset:function(){t.M()}}):g(this,Y)[Y]=n;break;case i.Type.AD_BREAK_READY:this.C(),g(this,ei)[ei]?(g(this,ei)[ei]({ad:g(this,Y)[Y],adBreakTime:e.getAdData().adBreakTime,start:function(){t.M(),g(t,ei)[ei]=void 0},startWithoutReset:function(){t.M()}}),g(this,Y)[Y]=void 0):this.M();break;case i.Type.STARTED:var s=g(this,Q)[Q]=e.getAd();s.getAdPodInfo().getAdPosition()>1&&g(this,V)[V].setVolume(g(this,V)[V].getVolume()),g(this,N)[N].classList.remove("nonlinear"),this.R(),s.isLinear()?(g(this,x)[x].disable(),g(this,et)[et]=s.getDuration(),g(this,ee)[ee]=0):(g(this,N)[N].classList.add("nonlinear"),this.I()),g(this,N)[N].style.display="",g(this,er)[er]&&(g(this,er)[er]=!1,g(this,V)[V].pause());break;case i.Type.ALL_ADS_COMPLETED:if(g(this,Z)[Z])return;this.isCustomPlaybackUsed()&&g(this,Q)[Q]&&-1!==g(this,Q)[Q].getAdPodInfo().getTimeOffset()&&this.I(),this.reset();break;case i.Type.CONTENT_PAUSE_REQUESTED:this.C(),g(this,Q)[Q]=e.getAd(),g(this,N)[N].style.display="",g(this,L)[L].pause(),this.R(),g(this,Q)[Q]&&this.A(g(this,Q)[Q].getAdPodInfo().getTimeOffset()),g(this,V)[V].setVolume(g(this,L)[L].muted?0:g(this,L)[L].volume),g(this,x)[x].disable(),g(this,et)[et]=g(this,Q)[Q].getDuration(),g(this,ee)[ee]=0;break;case i.Type.CONTENT_RESUME_REQUESTED:var r=!!g(this,Q)[Q];if(r){var o=g(this,V)[V].getVolume();g(this,L)[L].muted=0===o,g(this,L)[L].volume=g(this,eo)[eo]}g(this,Z)[Z]&&(g(this,L)[L].currentTime=g(this,L)[L].duration+1,g(this,Z)[Z]=!1),g(this,L)[L].ended?(this.reset(),this.T()):this.C(),r&&(g(this,er)[er]=!1,this.I());break;case i.Type.AD_METADATA:this.g(g(this,V)[V].getCuePoints()),-1===g(this,J)[J].indexOf(0)&&(g(this,ei)[ei]?g(this,ei)[ei]({start:function(){t.I(),g(t,ei)[ei]=void 0},startWithoutReset:function(){t.I()}}):this.I());break;case i.Type.AD_PROGRESS:var a=e.getAdData();g(this,ee)[ee]=a.currentTime,g(this,et)[et]=a.duration;break;case i.Type.LOG:var u=e.getAdData();g(this,ei)[ei]?g(this,ei)[ei]({start:function(){t.I(),g(t,ei)[ei]=void 0},startWithoutReset:function(){t.I()}}):u.adError&&!g(this,Q)[Q]&&this.I();break;case i.Type.VOLUME_CHANGED:var d=g(this,V)[V].getVolume();d>0&&(g(this,eo)[eo]=d)}},i.l=function(e){this.j(this.B(e))},i.u=function(e){var t,i=this,n=g(this,z)[z],s=n.AdEvent,r=n.AdErrorEvent.Type.AD_ERROR;window.clearTimeout(g(this,en)[en]);var o=g(this,V)[V]=e.getAdsManager(g(this,x)[x],g(this,U)[U]);Object.keys(s.Type).forEach(function(e){o.addEventListener(s.Type[e],function(t){if(i.S(t),k[e]){var n=["LOG","AD_PROGRESS"].indexOf(e)>-1;i.dispatchEvent(new T(k[e],{detail:{ad:t.getAd()||g(i,Q)[Q],adData:n?t.getAdData():{}}}))}})}),o.addEventListener(r,function(e){return i.j(i.B(e))});try{o.init(g(this,F)[F],g(this,G)[G],this.k()),o.setVolume(g(this,L)[L].muted?0:g(this,L)[L].volume),null==(t=g(this,B)[B])||t.initialize(),g(this,ei)[ei]||this.M()}catch(e){this.j(new j(e.message))}},i.M=function(){if(g(this,K)[K]||(this.dispatchEvent(new T(k.MEDIA_START)),g(this,K)[K]=!0),g(this,V)[V])try{g(this,V)[V].start()}catch(e){this.j(new j(e.message))}else this.I()},i.T=function(){var e=this;setTimeout(function(){g(e,X)[X]=!1,g(e,K)[K]=!1,g(e,Z)[Z]=!1,e.dispatchEvent(new T(k.MEDIA_STOP))},1)},i.v=function(e){for(var t,i=function(e,t){var i="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(i)return(i=i.call(e)).next.bind(i);if(Array.isArray(e)||(i=function(e,t){if(e){if("string"==typeof e)return m(e,void 0);var i=Object.prototype.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?m(e,void 0):void 0}}(e))){i&&(e=i);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(e);!(t=i()).done;){var n=t.value;n.contentBoxSize&&1===n.contentBoxSize.length?(g(this,F)[F]=n.contentBoxSize[0].inlineSize,g(this,G)[G]=n.contentBoxSize[0].blockSize):n.contentBoxSize&&n.contentBoxSize.inlineSize?(g(this,F)[F]=n.contentBoxSize.inlineSize,g(this,G)[G]=n.contentBoxSize.blockSize):(g(this,F)[F]=n.contentRect.width,g(this,G)[G]=n.contentRect.height)}this.R()},i.R=function(){if(g(this,W)[W].autoResize&&g(this,V)[V]){var e=g(this,Q)[Q],t=this.k();e&&!e.isLinear()?e&&(e.getWidth()>g(this,F)[F]||e.getHeight()>g(this,G)[G]?this.resizeAd(g(this,F)[F],g(this,G)[G]):(g(this,V)[V].resize(e.getWidth(),e.getHeight()+20,t),g(this,N)[N].style.width=e.getWidth()+"px",g(this,N)[N].style.height=e.getHeight()+20+"px")):this.resizeAd(g(this,F)[F],g(this,G)[G])}},i.k=function(){return document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement||g(this,L)[L].webkitDisplayingFullscreen?g(this,z)[z].ViewMode.FULLSCREEN:g(this,z)[z].ViewMode.NORMAL},i.I=function(){var e=this;g(this,N)[N].style.display="none",g(this,L)[L].ended||(g(this,x)[x].enable(),g(this,er)[er]?(g(this,L)[L].pause(),this.dispatchEvent(new T("pause"))):(this.p().then(function(){}).catch(function(){e.dispatchEvent(new T("pause"))}),this.dispatchEvent(new T("play")),this.dispatchEvent(new T(k.MEDIA_RESUMED))),g(this,er)[er]=!1)},i.B=function(e){var t=e.getError(),i=new j(t.getMessage());return i.type=t.getType(),i.errorCode=t.getErrorCode(),i.vastErrorCode=t.getVastErrorCode&&t.getVastErrorCode(),i.innerError=t.getInnerError(),i},i.j=function(e){var t=this;this.dispatchEvent(new T(k.AD_ERROR,{detail:{error:e}})),this.C(),g(this,ei)[ei]?g(this,ei)[ei]({start:function(){t.I(),g(t,ei)[ei]=void 0},startWithoutReset:function(){t.I()}}):this.I()},h(t,[{key:"volume",get:function(){return!g(this,x)[x].enabled&&g(this,V)[V]?g(this,V)[V].getVolume():g(this,L)[L].volume},set:function(e){!g(this,x)[x].enabled&&g(this,V)[V]&&g(this,V)[V].setVolume(e),g(this,L)[L].volume=e}},{key:"muted",get:function(){return!g(this,x)[x].enabled&&g(this,V)[V]?0===g(this,V)[V].getVolume():g(this,L)[L].muted},set:function(e){!g(this,x)[x].enabled&&g(this,V)[V]&&g(this,V)[V].setVolume(e?0:g(this,eo)[eo]),g(this,L)[L].muted=e}},{key:"currentTime",get:function(){return void 0!==g(this,ee)[ee]?g(this,ee)[ee]:g(this,L)[L].currentTime},set:function(e){g(this,x)[x].enabled&&(g(this,L)[L].currentTime=e)}},{key:"duration",get:function(){return void 0!==g(this,et)[et]?g(this,et)[et]:g(this,L)[L].duration}},{key:"cuePoints",get:function(){return[].concat(g(this,J)[J])}}]),t}(C)},{"@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}],"9pCYc":[function(e,t,i){i.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},i.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},i.exportAll=function(e,t){return Object.keys(e).forEach(function(i){"default"===i||"__esModule"===i||Object.prototype.hasOwnProperty.call(t,i)||Object.defineProperty(t,i,{enumerable:!0,get:function(){return e[i]}})}),t},i.export=function(e,t,i){Object.defineProperty(e,t,{enumerable:!0,get:i})}},{}]},["iW4Tm"],"iW4Tm","parcelRequire4dc0");