mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-08 10:56:15 -08:00
8 lines
28 KiB
JavaScript
8 lines
28 KiB
JavaScript
|
|
/*!
|
|
* artplayer-plugin-vast.js v1.1.0
|
|
* Github: https://github.com/zhw2590582/ArtPlayer
|
|
* (c) 2017-2026 Harvey Zhao
|
|
* Released under the MIT License.
|
|
*/
|
|
!function(e,t,i,n,r){var s="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},o="function"==typeof s[n]&&s[n],a=o.i||{},u=o.cache||{},l="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function d(t,i){if(!u[t]){if(!e[t]){if(r[t])return r[t];var a="function"==typeof s[n]&&s[n];if(!i&&a)return a(t,!0);if(o)return o(t,!0);if(l&&"string"==typeof t)return l(t);var h=Error("Cannot find module '"+t+"'");throw h.code="MODULE_NOT_FOUND",h}f.resolve=function(i){var n=e[t][1][i];return null!=n?n:i},f.cache={};var c=u[t]=new d.Module(t);e[t][0].call(c.exports,f,c,c.exports,s)}return u[t].exports;function f(e){var t=f.resolve(e);if(!1===t)return{};if(Array.isArray(t)){var i={__esModule:!0};return t.forEach(function(e){var t=e[0],n=e[1],r=e[2]||e[0],s=d(n);"*"===t?Object.keys(s).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(i,e)||Object.defineProperty(i,e,{enumerable:!0,get:function(){return s[e]}})}):"*"===r?Object.defineProperty(i,t,{enumerable:!0,value:s}):Object.defineProperty(i,t,{enumerable:!0,get:function(){return"default"===r?s.__esModule?s.default:s:s[r]}})}),i}return d(t)}}d.isParcelRequire=!0,d.Module=function(e){this.id=e,this.bundle=d,this.require=l,this.exports={}},d.modules=e,d.cache=u,d.parent=o,d.distDir=void 0,d.publicUrl=void 0,d.devServer=void 0,d.i=a,d.register=function(t,i){e[t]=[function(e,t){t.exports=i},{}]},Object.defineProperty(d,"root",{get:function(){return s[n]}}),s[n]=d;for(var h=0;h<t.length;h++)d(t[h]);if(i){var c=d(i);"object"==typeof exports&&"u">typeof module?module.exports=c:"function"==typeof define&&define.amd&&define(function(){return c})}}({bxP13:[function(e,t,i,n){var r=e("@parcel/transformer-js/src/esmodule-helpers.js");r.defineInteropFlag(i),r.export(i,"default",function(){return u});var s=e("@swc/helpers/cjs/_async_to_generator.cjs"),o=e("@swc/helpers/cjs/_ts_generator.cjs"),a=e("@glomex/vast-ima-player");function u(e){return function(t){return(0,s._)(function(){var i,n,r,s,u,l,d,h,c,f,p,v;function y(){var e;return p?p:((e=r("div")).id="art-vast-".concat(Date.now()),s(e,{position:"absolute",inset:"0",width:"100%",height:"100%",zIndex:"150",backgroundColor:"black",display:"none",pointerEvents:"auto"}),v=e,l.appendChild(v),(p=new(0,a.Player)(d,u,v,h,c)).addEventListener("AdContentPauseRequested",function(){f=!0,v.style.display="block"}),p.addEventListener("AdContentResumeRequested",function(){f=!1,v.style.display="none"}),p.addEventListener("AdStarted",function(){f=!0,v.style.display="block"}),p.addEventListener("AdError",function(e){console.error("VAST Ad Error:",e.detail),f=!1,v.style.display="none"}),p)}function E(){(null==p?void 0:p.destroy)&&p.destroy(),(null==v?void 0:v.parentNode)&&v.parentNode.removeChild(v),v=null,p=null}function b(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!f){p||y();var i=new d.AdsRequest;for(var n in i.adTagUrl=e,t)i[n]=t[n];p.playAds(i)}}function m(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!f){p||y();var i=new d.AdsRequest;for(var n in i.adsResponse=e,t)i[n]=t[n];p.playAds(i)}}return(0,o._)(this,function(o){switch(o.label){case 0:return i=t.template,r=(n=t.constructor.utils).createElement,s=n.setStyles,u=i.$video,l=i.$player,[4,(0,a.loadImaSdk)()];case 1:if(o.sent(),(h=new(d=window.google.ima).AdsRenderingSettings).restoreCustomPlaybackStateOnAdBreakComplete=!0,h.enablePreloading=!0,c=new(0,a.PlayerOptions),f=!1,p=null,v=null,"function"!=typeof e)return[3,3];return[4,e({art:t,playUrl:b,playRes:m,init:y,ima:d,adsRenderingSettings:h,playerOptions:c,get imaPlayer(){return p},get container(){return v}})];case 2:o.sent(),o.label=3;case 3:return[2,{name:"artplayerPluginVast",destroy:E}]}})})()}}"u">typeof window&&(window.artplayerPluginVast=u)},{"@swc/helpers/cjs/_async_to_generator.cjs":"cZn0e","@swc/helpers/cjs/_ts_generator.cjs":"eltGh","@glomex/vast-ima-player":"f25He","@parcel/transformer-js/src/esmodule-helpers.js":"qpMMf"}],cZn0e:[function(e,t,i,n){"use strict";function r(e,t,i,n,r,s,o){try{var a=e[s](o),u=a.value}catch(e){i(e);return}a.done?t(u):Promise.resolve(u).then(n,r)}i._=function(e){return function(){var t=this,i=arguments;return new Promise(function(n,s){var o=e.apply(t,i);function a(e){r(o,n,s,a,u,"next",e)}function u(e){r(o,n,s,a,u,"throw",e)}a(void 0)})}}},{}],eltGh:[function(e,t,i,n){"use strict";i._=function(e,t){var i,n,r,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),a=Object.defineProperty;return a(o,"next",{value:u(0)}),a(o,"throw",{value:u(1)}),a(o,"return",{value:u(2)}),"function"==typeof Symbol&&a(o,Symbol.iterator,{value:function(){return this}}),o;function u(a){return function(u){var l=[a,u];if(i)throw TypeError("Generator is already executing.");for(;o&&(o=0,l[0]&&(s=0)),s;)try{if(i=1,n&&(r=2&l[0]?n.return:l[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,l[1])).done)return r;switch(n=0,r&&(l=[2&l[0],r.value]),l[0]){case 0:case 1:r=l;break;case 4:return s.label++,{value:l[1],done:!1};case 5:s.label++,n=l[1],l=[0];continue;case 7:l=s.ops.pop(),s.trys.pop();continue;default:if(!(r=(r=s.trys).length>0&&r[r.length-1])&&(6===l[0]||2===l[0])){s=0;continue}if(3===l[0]&&(!r||l[1]>r[0]&&l[1]<r[3])){s.label=l[1];break}if(6===l[0]&&s.label<r[1]){s.label=r[1],r=l;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(l);break}r[2]&&s.ops.pop(),s.trys.pop();continue}l=t.call(e,s)}catch(e){l=[6,e],n=0}finally{i=r=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}},{}],f25He:[function(e,t,i,n){var r,s,o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(i),o.export(i,"Player",function(){return el}),o.export(i,"PlayerError",function(){return L}),o.export(i,"PlayerEvent",function(){return M}),o.export(i,"PlayerOptions",function(){return I}),o.export(i,"loadImaSdk",function(){return l});var a=null,u=function(){a=null},l=function(){var e=window;return e.google&&e.google.ima?Promise.resolve(e.google.ima):a||((a=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(u).catch(u),a)};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 c(){return(c=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 f(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,v(e,t)}function p(e){return(p=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function v(e,t){return(v=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function y(e,t,i){return(y=!function(){if("u"<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 r=new(Function.bind.apply(e,n));return i&&v(r,i.prototype),r}:Reflect.construct).apply(null,arguments)}function E(e){var t="function"==typeof Map?new Map:void 0;return(E=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 y(e,arguments,p(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),v(i,e)})(e)}function b(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 g(e){return"__private_"+A+++"_"+e}function O(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw TypeError("attempted to use private field on non-instance");return e}var w={};w.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 P,_,R=w.CustomEvent,T=g("mediaElement"),S=g("currentTime"),D=g("enabled"),C=function(){function e(e){Object.defineProperty(this,T,{writable:!0,value:void 0}),Object.defineProperty(this,S,{writable:!0,value:void 0}),Object.defineProperty(this,D,{writable:!0,value:void 0}),this.seeking=void 0,O(this,T)[T]=e,O(this,S)[S]=0,O(this,D)[D]=!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=O(this,T)[T])&&e.paused||(O(this,S)[S]=null==(t=O(this,T)[T])?void 0:t.currentTime)},t.enable=function(){var e,t,i;O(this,D)[D]||(null==(e=O(this,T)[T])||e.addEventListener("seeking",this.i),null==(t=O(this,T)[T])||t.addEventListener("seeked",this.h),null==(i=O(this,T)[T])||i.addEventListener("timeupdate",this.t),O(this,D)[D]=!0)},t.disable=function(){var e,t,i;O(this,D)[D]&&(null==(e=O(this,T)[T])||e.removeEventListener("seeking",this.i),null==(t=O(this,T)[T])||t.removeEventListener("seeked",this.h),null==(i=O(this,T)[T])||i.removeEventListener("timeupdate",this.t),O(this,D)[D]=!1)},t.play=function(){var e=this;return new Promise(function(t){var i;t(null==(i=O(e,T)[T])?void 0:i.play())})},t.pause=function(){var e;null==(e=O(this,T)[T])||e.pause()},t.reset=function(){O(this,S)[S]=0,O(this,D)[D]=!1,this.seeking=!1,this.enable()},t.destroy=function(){O(this,S)[S]=0,O(this,D)[D]=!1,this.seeking=!1,this.disable(),O(this,T)[T]=void 0},h(e,[{key:"enabled",get:function(){return O(this,D)[D]}},{key:"currentTime",get:function(){return O(this,S)[S]}},{key:"duration",get:function(){var e;return null==(e=O(this,T)[T])?void 0:e.duration}},{key:"muted",get:function(){var e;return null==(e=O(this,T)[T])?void 0:e.muted}},{key:"volume",get:function(){var e;return null==(e=O(this,T)[T])?void 0:e.volume}}]),e}(),k=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}(),j=["abort","canplay","canplaythrough","durationchange","emptied","ended","error","loadeddata","loadedmetadata","loadstart","pause","play","playing","progress","ratechange","seeked","seeking","stalled","suspend","timeupdate","volumechange","waiting"];(r=P||(P={})).MEDIA_START="MediaStart",r.MEDIA_IMPRESSION="MediaImpression",r.MEDIA_STOP="MediaStop",r.MEDIA_CUE_POINTS_CHANGE="MediaCuePointsChange",r.MEDIA_RESUMED="MediaResumed",(s=_||(_={})).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 M=c({},_,P),I=function(){this.disableCustomPlaybackForIOS10Plus=!1,this.autoResize=!0,this.clickTrackingElement=void 0},L=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 f(t,e),t}(E(Error));L.ERROR_CODE_ADS_MANAGER_LOADED_TIMEOUT=9e3,L.ERROR_CODE_REQUEST_ADS_TIMEOUT=9001;var x=g("mediaElement"),N=g("adElement"),U=g("customPlayhead"),z=g("adsRenderingSettings"),B=g("ima"),V=g("adDisplayContainer"),G=g("adsManager"),F=g("width"),q=g("height"),H=g("adsLoader"),W=g("playerOptions"),Q=g("resizeObserver"),K=g("currentAd"),Y=g("loadedAd"),Z=g("mediaStartTriggered"),$=g("mediaImpressionTriggered"),X=g("mediaInActivation"),J=g("customPlaybackTimeAdjustedOnEnded"),ee=g("cuePoints"),et=g("adCurrentTime"),ei=g("adDuration"),en=g("startAdCallback"),er=g("adsManagerLoadedTimeout"),es=g("requestAdsTimeout"),eo=g("wasExternallyPaused"),ea=g("lastNonZeroAdVolume"),eu=g("activatePromise"),el=function(e){function t(t,i,n,r,s){void 0===r&&(r=new t.AdsRenderingSettings),void 0===s&&(s=new I),Object.defineProperty(b(o=e.call(this)||this),x,{writable:!0,value:void 0}),Object.defineProperty(b(o),N,{writable:!0,value:void 0}),Object.defineProperty(b(o),U,{writable:!0,value:void 0}),Object.defineProperty(b(o),z,{writable:!0,value:void 0}),Object.defineProperty(b(o),B,{writable:!0,value:void 0}),Object.defineProperty(b(o),V,{writable:!0,value:void 0}),Object.defineProperty(b(o),G,{writable:!0,value:void 0}),Object.defineProperty(b(o),F,{writable:!0,value:void 0}),Object.defineProperty(b(o),q,{writable:!0,value:void 0}),Object.defineProperty(b(o),H,{writable:!0,value:void 0}),Object.defineProperty(b(o),W,{writable:!0,value:void 0}),Object.defineProperty(b(o),Q,{writable:!0,value:void 0}),Object.defineProperty(b(o),K,{writable:!0,value:void 0}),Object.defineProperty(b(o),Y,{writable:!0,value:void 0}),Object.defineProperty(b(o),Z,{writable:!0,value:!1}),Object.defineProperty(b(o),$,{writable:!0,value:!1}),Object.defineProperty(b(o),X,{writable:!0,value:!1}),Object.defineProperty(b(o),J,{writable:!0,value:!1}),Object.defineProperty(b(o),ee,{writable:!0,value:[]}),Object.defineProperty(b(o),et,{writable:!0,value:void 0}),Object.defineProperty(b(o),ei,{writable:!0,value:void 0}),Object.defineProperty(b(o),en,{writable:!0,value:void 0}),Object.defineProperty(b(o),er,{writable:!0,value:void 0}),Object.defineProperty(b(o),es,{writable:!0,value:void 0}),Object.defineProperty(b(o),eo,{writable:!0,value:!1}),Object.defineProperty(b(o),ea,{writable:!0,value:1}),Object.defineProperty(b(o),eu,{writable:!0,value:Promise.resolve()}),O(b(o),x)[x]=i,O(b(o),N)[N]=n,O(b(o),B)[B]=t,O(b(o),W)[W]=s,O(b(o),z)[z]=r,O(b(o),z)[z].restoreCustomPlaybackStateOnAdBreakComplete=!0,s.disableCustomPlaybackForIOS10Plus&&!O(b(o),x)[x].hasAttribute("playsinline")&&O(b(o),x)[x].setAttribute("playsinline",""),O(b(o),B)[B].settings.setDisableCustomPlaybackForIOS10Plus(s.disableCustomPlaybackForIOS10Plus),O(b(o),U)[U]=new C(O(b(o),x)[x]),o.o=o.o.bind(b(o)),j.forEach(function(e){O(b(o),x)[x].addEventListener(e,o.o)}),o.u=o.u.bind(b(o)),o.l=o.l.bind(b(o));var o,a=O(b(o),x)[x],u=a.offsetHeight,l=a.offsetWidth;return O(b(o),F)[F]=l,O(b(o),q)[q]=u,s.autoResize&&window.ResizeObserver&&(O(b(o),Q)[Q]=new window.ResizeObserver(function(e){return o.v(e)}),O(b(o),Q)[Q].observe(O(b(o),x)[x])),o}f(t,e);var i=t.prototype;return i.activate=function(){var e=this;if(!O(this,Z)[Z]&&!O(this,X)[X]&&(O(this,X)[X]=!0,O(this,x)[x].paused)){var t=function(){return O(e,x)[x].pause(),new Promise(function(t){setTimeout(function(){O(e,X)[X]=!1,t()},1)})};O(this,eu)[eu]=new Promise(function(t){return t(O(e,x)[x].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 O(this,eu)[eu].then(function(){return new Promise(function(t){return t(O(e,x)[x].play())})})},i.m=function(e,t,i){var n=this;void 0===t&&(t=!0),this.reset(),this.O(),O(this,B)[B].settings.setAutoPlayAdBreaks(t),O(this,x)[x].ended&&(O(this,U)[U].reset(),O(this,x)[x].currentTime=0),O(this,en)[en]=i,e.linearAdSlotWidth=O(this,F)[F],e.linearAdSlotHeight=O(this,q)[q],e.nonLinearAdSlotWidth=O(this,F)[F],e.nonLinearAdSlotHeight=O(this,q)[q],null==e.contentDuration&&(e.contentDuration=-3),O(this,er)[er]=window.setTimeout(function(){var e=new L("No adsManagerLoadedEvent within 5000ms.");e.errorCode=L.ERROR_CODE_ADS_MANAGER_LOADED_TIMEOUT,n.j(e)},5e3),O(this,es)[es]=window.setTimeout(function(){var e=new L("No response for ads-request within 10000ms.");e.errorCode=L.ERROR_CODE_REQUEST_ADS_TIMEOUT,n.j(e)},1e4),O(this,H)[H].requestAds(e)},i.O=function(){O(this,V)[V]=new(O(this,B))[B].AdDisplayContainer(O(this,N)[N],O(this,W)[W].disableCustomPlaybackForIOS10Plus?void 0:O(this,x)[x],O(this,W)[W].clickTrackingElement),O(this,H)[H]=new(O(this,B))[B].AdsLoader(O(this,V)[V]),O(this,H)[H].addEventListener(O(this,B)[B].AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,this.u,!1),O(this,H)[H].addEventListener(O(this,B)[B].AdErrorEvent.Type.AD_ERROR,this.l,!1)},i.skipAd=function(){O(this,G)[G]&&O(this,G)[G].skip()},i.discardAdBreak=function(){O(this,G)[G]&&O(this,G)[G].discardAdBreak()},i.play=function(){var e=this;O(this,eo)[eo]=!1,!O(this,U)[U].enabled&&O(this,G)[G]?O(this,G)[G].resume():O(this,er)[er]||this.p().then(function(){}).catch(function(){e.dispatchEvent(new R("pause"))})},i.pause=function(){O(this,eo)[eo]=!0,!O(this,U)[U].enabled&&O(this,G)[G]?O(this,G)[G].pause():O(this,x)[x].pause()},i.g=function(e){O(this,ee)[ee]=[].concat(e),this.dispatchEvent(new R(M.MEDIA_CUE_POINTS_CHANGE,{detail:{cuePoints:[].concat(O(this,ee)[ee])}}))},i.A=function(e){var t=this.cuePoints.indexOf(e);t>-1&&(O(this,ee)[ee].splice(t,1),this.g(O(this,ee)[ee]))},i.resizeAd=function(e,t){O(this,F)[F]=e,O(this,q)[q]=t,O(this,G)[G]&&O(this,G)[G].resize(e,t,this.k()),O(this,N)[N].style.width=e+"px",O(this,N)[N].style.height=t+"px"},i.reset=function(e){void 0===e&&(e=!1),e&&(O(this,$)[$]=!1,O(this,Z)[Z]=!1,O(this,J)[J]=!1),this.C(),O(this,ee)[ee]=[],O(this,eo)[eo]=!1,O(this,en)[en]=void 0,O(this,G)[G]&&O(this,G)[G].destroy(),O(this,G)[G]=void 0,O(this,B)[B].settings.setAutoPlayAdBreaks(!0),e&&this.P(),O(this,N)[N].style.display="none"},i.P=function(){O(this,H)[H]&&(O(this,H)[H].removeEventListener(O(this,B)[B].AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,this.u,!1),O(this,H)[H].removeEventListener(O(this,B)[B].AdErrorEvent.Type.AD_ERROR,this.l,!1),O(this,H)[H].destroy()),O(this,V)[V]&&O(this,V)[V].destroy()},i.destroy=function(){var e,t,i,n,r=this;this.reset(!0),O(this,U)[U].destroy(),j.forEach(function(e){O(r,x)[x].removeEventListener(e,r.o)}),null==(e=O(this,H)[H])||e.removeEventListener(O(this,B)[B].AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,this.u,!1),null==(t=O(this,V)[V])||t.destroy(),null==(i=O(this,H)[H])||i.destroy(),O(this,$)[$]=!1,O(this,J)[J]=!1,O(this,Z)[Z]=!1,null==(n=O(this,Q)[Q])||n.disconnect()},i.isCustomPlaybackUsed=function(){return!1===O(this,B)[B].settings.getDisableCustomPlaybackForIOS10Plus()&&!O(this,N)[N].querySelector("video")},i.C=function(){window.clearTimeout(O(this,er)[er]),window.clearTimeout(O(this,es)[es]),O(this,er)[er]=void 0,O(this,es)[es]=void 0,O(this,K)[K]=void 0,O(this,et)[et]=void 0,O(this,ei)[ei]=void 0,O(this,N)[N].style.display="none",O(this,N)[N].classList.remove("nonlinear"),O(this,G)[G]&&this.R()},i.o=function(e){var t=this;if(O(this,U)[U].enabled||"volumechange"===e.type){if("timeupdate"===e.type){if(O(this,G)[G]){var i=O(this,G)[G].getCuePoints().filter(function(e){return e>=0&&e<O(t,U)[U].currentTime}).pop();this.A(i)}!O(this,$)[$]&&O(this,Z)[Z]&&O(this,x)[x].currentTime>=.5&&(this.dispatchEvent(new R(M.MEDIA_IMPRESSION)),O(this,$)[$]=!0)}if("play"!==e.type||O(this,Z)[Z]||O(this,X)[X]||(this.dispatchEvent(new R(M.MEDIA_START)),O(this,Z)[Z]=!0),"ended"===e.type&&(this.isCustomPlaybackUsed()&&O(this,x)[x].currentTime===O(this,x)[x].duration&&O(this,ee)[ee].indexOf(-1)>-1&&(O(this,x)[x].currentTime=O(this,x)[x].duration-1e-5,O(this,J)[J]=!0),O(this,H)[H].contentComplete(),O(this,G)[G]||this.T()),!window.ResizeObserver&&O(this,W)[W].autoResize&&"loadedmetadata"===e.type){var n=O(this,x)[x],r=n.offsetHeight,s=n.offsetWidth;O(this,F)[F]=s,O(this,q)[q]=r,this.R()}O(this,X)[X]&&"volumechange"!==e.type||this.dispatchEvent(new R(e.type))}},i.S=function(e){var t=this,i=O(this,B)[B].AdEvent;switch(e.type){case i.Type.LOADED:var n=e.getAd();O(this,en)[en]&&0===O(this,ee)[ee].length?O(this,en)[en]({ad:n,start:function(){t.M(),O(t,en)[en]=void 0},startWithoutReset:function(){t.M()}}):O(this,Y)[Y]=n;break;case i.Type.AD_BREAK_READY:this.C(),O(this,en)[en]?(O(this,en)[en]({ad:O(this,Y)[Y],adBreakTime:e.getAdData().adBreakTime,start:function(){t.M(),O(t,en)[en]=void 0},startWithoutReset:function(){t.M()}}),O(this,Y)[Y]=void 0):this.M();break;case i.Type.STARTED:var r=O(this,K)[K]=e.getAd();r.getAdPodInfo().getAdPosition()>1&&O(this,G)[G].setVolume(O(this,G)[G].getVolume()),O(this,N)[N].classList.remove("nonlinear"),this.R(),r.isLinear()?(O(this,U)[U].disable(),O(this,ei)[ei]=r.getDuration(),O(this,et)[et]=0):(O(this,N)[N].classList.add("nonlinear"),this.I()),O(this,N)[N].style.display="",O(this,eo)[eo]&&(O(this,eo)[eo]=!1,O(this,G)[G].pause());break;case i.Type.ALL_ADS_COMPLETED:if(O(this,J)[J])return;this.isCustomPlaybackUsed()&&O(this,K)[K]&&-1!==O(this,K)[K].getAdPodInfo().getTimeOffset()&&this.I(),this.reset();break;case i.Type.CONTENT_PAUSE_REQUESTED:this.C(),O(this,K)[K]=e.getAd(),O(this,N)[N].style.display="",O(this,x)[x].pause(),this.R(),O(this,K)[K]&&this.A(O(this,K)[K].getAdPodInfo().getTimeOffset()),O(this,G)[G].setVolume(O(this,x)[x].muted?0:O(this,x)[x].volume),O(this,U)[U].disable(),O(this,ei)[ei]=O(this,K)[K].getDuration(),O(this,et)[et]=0;break;case i.Type.CONTENT_RESUME_REQUESTED:var s=!!O(this,K)[K];if(s){var o=O(this,G)[G].getVolume();O(this,x)[x].muted=0===o,O(this,x)[x].volume=O(this,ea)[ea]}O(this,J)[J]&&(O(this,x)[x].currentTime=O(this,x)[x].duration+1,O(this,J)[J]=!1),O(this,x)[x].ended?(this.reset(),this.T()):this.C(),s&&(O(this,eo)[eo]=!1,this.I());break;case i.Type.AD_METADATA:this.g(O(this,G)[G].getCuePoints()),-1===O(this,ee)[ee].indexOf(0)&&(O(this,en)[en]?O(this,en)[en]({start:function(){t.I(),O(t,en)[en]=void 0},startWithoutReset:function(){t.I()}}):this.I());break;case i.Type.AD_PROGRESS:var a=e.getAdData();O(this,et)[et]=a.currentTime,O(this,ei)[ei]=a.duration;break;case i.Type.LOG:var u=e.getAdData();O(this,en)[en]?O(this,en)[en]({start:function(){t.I(),O(t,en)[en]=void 0},startWithoutReset:function(){t.I()}}):u.adError&&!O(this,K)[K]&&this.I();break;case i.Type.VOLUME_CHANGED:var l=O(this,G)[G].getVolume();l>0&&(O(this,ea)[ea]=l)}},i.l=function(e){this.j(this.B(e))},i.u=function(e){var t,i=this,n=O(this,B)[B],r=n.AdEvent,s=n.AdErrorEvent.Type.AD_ERROR;window.clearTimeout(O(this,er)[er]);var o=O(this,G)[G]=e.getAdsManager(O(this,U)[U],O(this,z)[z]);Object.keys(r.Type).forEach(function(e){o.addEventListener(r.Type[e],function(t){if(i.S(t),M[e]){var n=["LOG","AD_PROGRESS"].indexOf(e)>-1;i.dispatchEvent(new R(M[e],{detail:{ad:t.getAd()||O(i,K)[K],adData:n?t.getAdData():{}}}))}})}),o.addEventListener(s,function(e){return i.j(i.B(e))});try{o.init(O(this,F)[F],O(this,q)[q],this.k()),o.setVolume(O(this,x)[x].muted?0:O(this,x)[x].volume),null==(t=O(this,V)[V])||t.initialize(),O(this,en)[en]||this.M()}catch(e){this.j(new L(e.message))}},i.M=function(){if(O(this,Z)[Z]||(this.dispatchEvent(new R(M.MEDIA_START)),O(this,Z)[Z]=!0),O(this,G)[G])try{O(this,G)[G].start()}catch(e){this.j(new L(e.message))}else this.I()},i.T=function(){var e=this;setTimeout(function(){O(e,$)[$]=!1,O(e,Z)[Z]=!1,O(e,J)[J]=!1,e.dispatchEvent(new R(M.MEDIA_STOP))},1)},i.v=function(e){for(var t,i=function(e){var t="u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(t)return(t=t.call(e)).next.bind(t);if(Array.isArray(e)||(t=function(e){if(e){if("string"==typeof e)return m(e,void 0);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?m(e,void 0):void 0}}(e))){t&&(e=t);var i=0;return function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}}}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?(O(this,F)[F]=n.contentBoxSize[0].inlineSize,O(this,q)[q]=n.contentBoxSize[0].blockSize):n.contentBoxSize&&n.contentBoxSize.inlineSize?(O(this,F)[F]=n.contentBoxSize.inlineSize,O(this,q)[q]=n.contentBoxSize.blockSize):(O(this,F)[F]=n.contentRect.width,O(this,q)[q]=n.contentRect.height)}this.R()},i.R=function(){if(O(this,W)[W].autoResize&&O(this,G)[G]){var e=O(this,K)[K],t=this.k();e&&!e.isLinear()?e&&(e.getWidth()>O(this,F)[F]||e.getHeight()>O(this,q)[q]?this.resizeAd(O(this,F)[F],O(this,q)[q]):(O(this,G)[G].resize(e.getWidth(),e.getHeight()+20,t),O(this,N)[N].style.width=e.getWidth()+"px",O(this,N)[N].style.height=e.getHeight()+20+"px")):this.resizeAd(O(this,F)[F],O(this,q)[q])}},i.k=function(){return document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement||O(this,x)[x].webkitDisplayingFullscreen?O(this,B)[B].ViewMode.FULLSCREEN:O(this,B)[B].ViewMode.NORMAL},i.I=function(){var e=this;O(this,N)[N].style.display="none",O(this,x)[x].ended||(O(this,U)[U].enable(),O(this,eo)[eo]?(O(this,x)[x].pause(),this.dispatchEvent(new R("pause"))):(this.p().then(function(){}).catch(function(){e.dispatchEvent(new R("pause"))}),this.dispatchEvent(new R("play")),this.dispatchEvent(new R(M.MEDIA_RESUMED))),O(this,eo)[eo]=!1)},i.B=function(e){var t=e.getError(),i=new L(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 R(M.AD_ERROR,{detail:{error:e}})),this.C(),O(this,en)[en]?O(this,en)[en]({start:function(){t.I(),O(t,en)[en]=void 0},startWithoutReset:function(){t.I()}}):this.I()},h(t,[{key:"volume",get:function(){return!O(this,U)[U].enabled&&O(this,G)[G]?O(this,G)[G].getVolume():O(this,x)[x].volume},set:function(e){!O(this,U)[U].enabled&&O(this,G)[G]&&O(this,G)[G].setVolume(e),O(this,x)[x].volume=e}},{key:"muted",get:function(){return!O(this,U)[U].enabled&&O(this,G)[G]?0===O(this,G)[G].getVolume():O(this,x)[x].muted},set:function(e){!O(this,U)[U].enabled&&O(this,G)[G]&&O(this,G)[G].setVolume(e?0:O(this,ea)[ea]),O(this,x)[x].muted=e}},{key:"currentTime",get:function(){return void 0!==O(this,et)[et]?O(this,et)[et]:O(this,x)[x].currentTime},set:function(e){O(this,U)[U].enabled&&(O(this,x)[x].currentTime=e)}},{key:"duration",get:function(){return void 0!==O(this,ei)[ei]?O(this,ei)[ei]:O(this,x)[x].duration}},{key:"cuePoints",get:function(){return[].concat(O(this,ee)[ee])}}]),t}(k)},{"@parcel/transformer-js/src/esmodule-helpers.js":"qpMMf"}],qpMMf:[function(e,t,i,n){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})}},{}]},["bxP13"],"bxP13","parcelRequire4dc0",{}); |