/*! * artplayer-plugin-vast.js v1.0.0 * Github: https://github.com/zhw2590582/ArtPlayer * (c) 2017-2025 Harvey Zack * Released under the MIT License. */ !function(e,t,r,n,i,o,s,a){var u="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},c="function"==typeof u[n]&&u[n],l=c.i||{},d=c.cache||{},h="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function f(t,r){if(!d[t]){if(!e[t]){if(i[t])return i[t];var o="function"==typeof u[n]&&u[n];if(!r&&o)return o(t,!0);if(c)return c(t,!0);if(h&&"string"==typeof t)return h(t);var s=Error("Cannot find module '"+t+"'");throw s.code="MODULE_NOT_FOUND",s}l.resolve=function(r){var n=e[t][1][r];return null!=n?n:r},l.cache={};var a=d[t]=new f.Module(t);e[t][0].call(a.exports,l,a,a.exports,u)}return d[t].exports;function l(e){var t=l.resolve(e);return!1===t?{}:f(t)}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.require=h,this.exports={}},f.modules=e,f.cache=d,f.parent=c,f.distDir=void 0,f.publicUrl=void 0,f.devServer=void 0,f.i=l,f.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(f,"root",{get:function(){return u[n]}}),u[n]=f;for(var p=0;pt.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,n=Object.getOwnPropertySymbols(e);it.indexOf(n[i])&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r}function l(e,t,r,n){var i,s=arguments.length,a=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if(("undefined"==typeof Reflect?"undefined":(0,o._)(Reflect))==="object"&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var u=e.length-1;u>=0;u--)(i=e[u])&&(a=(s<3?i(a):s>3?i(t,r,a):i(t,r))||a);return s>3&&a&&Object.defineProperty(t,r,a),a}function d(e,t){return function(r,n){t(r,n,e)}}function h(e,t,r,n,i,s){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var u,c=n.kind,l="getter"===c?"get":"setter"===c?"set":"value",d=!t&&e?n.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,n.name):{}),f=!1,p=r.length-1;p>=0;p--){var v={};for(var y in n)v[y]="access"===y?{}:n[y];for(var y in n.access)v.access[y]=n.access[y];v.addInitializer=function(e){if(f)throw TypeError("Cannot add initializers after decoration has completed");s.push(a(e||null))};var m=(0,r[p])("accessor"===c?{get:h.get,set:h.set}:h[l],v);if("accessor"===c){if(void 0===m)continue;if(null===m||(void 0===m?"undefined":(0,o._)(m))!=="object")throw TypeError("Object expected");(u=a(m.get))&&(h.get=u),(u=a(m.set))&&(h.set=u),(u=a(m.init))&&i.unshift(u)}else(u=a(m))&&("field"===c?i.unshift(u):h[l]=u)}d&&Object.defineProperty(d,n.name,h),f=!0}function f(e,t,r){for(var n=arguments.length>2,i=0;i0&&i[i.length-1])&&(6===c[0]||2===c[0])){o=0;continue}if(3===c[0]&&(!i||c[1]>i[0]&&c[1]=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function A(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s}function w(){for(var e=[],t=0;t1||a(e,t)})},t&&(n[e]=t(n[e])))}function a(e,t){try{var r;(r=i[e](t)).value instanceof S?Promise.resolve(r.value.v).then(u,c):l(o[0][2],r)}catch(e){l(o[0][3],e)}}function u(e){a("next",e)}function c(e){a("throw",e)}function l(e,t){e(t),o.shift(),o.length&&a(o[0][0],o[0][1])}}function j(e){var t,r;return t={},n("next"),n("throw",function(e){throw e}),n("return"),t[Symbol.iterator]=function(){return this},t;function n(n,i){t[n]=e[n]?function(t){return(r=!r)?{value:S(e[n](t)),done:!1}:i?i(t):t}:i}}function D(e){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=g(e),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(r){t[r]=e[r]&&function(t){return new Promise(function(n,i){var o,s,a;o=n,s=i,a=(t=e[r](t)).done,Promise.resolve(t.value).then(function(e){o({value:e,done:a})},s)})}}}function R(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var I=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t},x=function(e){return(x=Object.getOwnPropertyNames||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[t.length]=r);return t})(e)};function k(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r=x(e),n=0;ne.length)&&(t=e.length);for(var r=0,n=Array(t);r-1&&(A(this,ee)[ee].splice(t,1),this.g(A(this,ee)[ee]))},r.resizeAd=function(e,t){A(this,V)[V]=e,A(this,H)[H]=t,A(this,G)[G]&&A(this,G)[G].resize(e,t,this.k()),A(this,N)[N].style.width=e+"px",A(this,N)[N].style.height=t+"px"},r.reset=function(e){void 0===e&&(e=!1),e&&(A(this,Y)[Y]=!1,A(this,X)[X]=!1,A(this,J)[J]=!1),this.C(),A(this,ee)[ee]=[],A(this,es)[es]=!1,A(this,en)[en]=void 0,A(this,G)[G]&&A(this,G)[G].destroy(),A(this,G)[G]=void 0,A(this,z)[z].settings.setAutoPlayAdBreaks(!0),e&&this.P(),A(this,N)[N].style.display="none"},r.P=function(){A(this,W)[W]&&(A(this,W)[W].removeEventListener(A(this,z)[z].AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,this.u,!1),A(this,W)[W].removeEventListener(A(this,z)[z].AdErrorEvent.Type.AD_ERROR,this.l,!1),A(this,W)[W].destroy()),A(this,B)[B]&&A(this,B)[B].destroy()},r.destroy=function(){var e,t,r,n,i=this;this.reset(!0),A(this,U)[U].destroy(),x.forEach(function(e){A(i,L)[L].removeEventListener(e,i.o)}),null==(e=A(this,W)[W])||e.removeEventListener(A(this,z)[z].AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,this.u,!1),null==(t=A(this,B)[B])||t.destroy(),null==(r=A(this,W)[W])||r.destroy(),A(this,Y)[Y]=!1,A(this,J)[J]=!1,A(this,X)[X]=!1,null==(n=A(this,Q)[Q])||n.disconnect()},r.isCustomPlaybackUsed=function(){return!1===A(this,z)[z].settings.getDisableCustomPlaybackForIOS10Plus()&&!A(this,N)[N].querySelector("video")},r.C=function(){window.clearTimeout(A(this,ei)[ei]),window.clearTimeout(A(this,eo)[eo]),A(this,ei)[ei]=void 0,A(this,eo)[eo]=void 0,A(this,K)[K]=void 0,A(this,et)[et]=void 0,A(this,er)[er]=void 0,A(this,N)[N].style.display="none",A(this,N)[N].classList.remove("nonlinear"),A(this,G)[G]&&this.R()},r.o=function(e){var t=this;if(A(this,U)[U].enabled||"volumechange"===e.type){if("timeupdate"===e.type){if(A(this,G)[G]){var r=A(this,G)[G].getCuePoints().filter(function(e){return e>=0&&e=.5&&(this.dispatchEvent(new S(k.MEDIA_IMPRESSION)),A(this,Y)[Y]=!0)}if("play"!==e.type||A(this,X)[X]||A(this,Z)[Z]||(this.dispatchEvent(new S(k.MEDIA_START)),A(this,X)[X]=!0),"ended"===e.type&&(this.isCustomPlaybackUsed()&&A(this,L)[L].currentTime===A(this,L)[L].duration&&A(this,ee)[ee].indexOf(-1)>-1&&(A(this,L)[L].currentTime=A(this,L)[L].duration-1e-5,A(this,J)[J]=!0),A(this,W)[W].contentComplete(),A(this,G)[G]||this.T()),!window.ResizeObserver&&A(this,q)[q].autoResize&&"loadedmetadata"===e.type){var n=A(this,L)[L],i=n.offsetHeight,o=n.offsetWidth;A(this,V)[V]=o,A(this,H)[H]=i,this.R()}A(this,Z)[Z]&&"volumechange"!==e.type||this.dispatchEvent(new S(e.type))}},r.S=function(e){var t=this,r=A(this,z)[z].AdEvent;switch(e.type){case r.Type.LOADED:var n=e.getAd();A(this,en)[en]&&0===A(this,ee)[ee].length?A(this,en)[en]({ad:n,start:function(){t.M(),A(t,en)[en]=void 0},startWithoutReset:function(){t.M()}}):A(this,$)[$]=n;break;case r.Type.AD_BREAK_READY:this.C(),A(this,en)[en]?(A(this,en)[en]({ad:A(this,$)[$],adBreakTime:e.getAdData().adBreakTime,start:function(){t.M(),A(t,en)[en]=void 0},startWithoutReset:function(){t.M()}}),A(this,$)[$]=void 0):this.M();break;case r.Type.STARTED:var i=A(this,K)[K]=e.getAd();i.getAdPodInfo().getAdPosition()>1&&A(this,G)[G].setVolume(A(this,G)[G].getVolume()),A(this,N)[N].classList.remove("nonlinear"),this.R(),i.isLinear()?(A(this,U)[U].disable(),A(this,er)[er]=i.getDuration(),A(this,et)[et]=0):(A(this,N)[N].classList.add("nonlinear"),this.I()),A(this,N)[N].style.display="",A(this,es)[es]&&(A(this,es)[es]=!1,A(this,G)[G].pause());break;case r.Type.ALL_ADS_COMPLETED:if(A(this,J)[J])return;this.isCustomPlaybackUsed()&&A(this,K)[K]&&-1!==A(this,K)[K].getAdPodInfo().getTimeOffset()&&this.I(),this.reset();break;case r.Type.CONTENT_PAUSE_REQUESTED:this.C(),A(this,K)[K]=e.getAd(),A(this,N)[N].style.display="",A(this,L)[L].pause(),this.R(),A(this,K)[K]&&this.A(A(this,K)[K].getAdPodInfo().getTimeOffset()),A(this,G)[G].setVolume(A(this,L)[L].muted?0:A(this,L)[L].volume),A(this,U)[U].disable(),A(this,er)[er]=A(this,K)[K].getDuration(),A(this,et)[et]=0;break;case r.Type.CONTENT_RESUME_REQUESTED:var o=!!A(this,K)[K];if(o){var s=A(this,G)[G].getVolume();A(this,L)[L].muted=0===s,A(this,L)[L].volume=A(this,ea)[ea]}A(this,J)[J]&&(A(this,L)[L].currentTime=A(this,L)[L].duration+1,A(this,J)[J]=!1),A(this,L)[L].ended?(this.reset(),this.T()):this.C(),o&&(A(this,es)[es]=!1,this.I());break;case r.Type.AD_METADATA:this.g(A(this,G)[G].getCuePoints()),-1===A(this,ee)[ee].indexOf(0)&&(A(this,en)[en]?A(this,en)[en]({start:function(){t.I(),A(t,en)[en]=void 0},startWithoutReset:function(){t.I()}}):this.I());break;case r.Type.AD_PROGRESS:var a=e.getAdData();A(this,et)[et]=a.currentTime,A(this,er)[er]=a.duration;break;case r.Type.LOG:var u=e.getAdData();A(this,en)[en]?A(this,en)[en]({start:function(){t.I(),A(t,en)[en]=void 0},startWithoutReset:function(){t.I()}}):u.adError&&!A(this,K)[K]&&this.I();break;case r.Type.VOLUME_CHANGED:var c=A(this,G)[G].getVolume();c>0&&(A(this,ea)[ea]=c)}},r.l=function(e){this.j(this.B(e))},r.u=function(e){var t,r=this,n=A(this,z)[z],i=n.AdEvent,o=n.AdErrorEvent.Type.AD_ERROR;window.clearTimeout(A(this,ei)[ei]);var s=A(this,G)[G]=e.getAdsManager(A(this,U)[U],A(this,F)[F]);Object.keys(i.Type).forEach(function(e){s.addEventListener(i.Type[e],function(t){if(r.S(t),k[e]){var n=["LOG","AD_PROGRESS"].indexOf(e)>-1;r.dispatchEvent(new S(k[e],{detail:{ad:t.getAd()||A(r,K)[K],adData:n?t.getAdData():{}}}))}})}),s.addEventListener(o,function(e){return r.j(r.B(e))});try{s.init(A(this,V)[V],A(this,H)[H],this.k()),s.setVolume(A(this,L)[L].muted?0:A(this,L)[L].volume),null==(t=A(this,B)[B])||t.initialize(),A(this,en)[en]||this.M()}catch(e){this.j(new M(e.message))}},r.M=function(){if(A(this,X)[X]||(this.dispatchEvent(new S(k.MEDIA_START)),A(this,X)[X]=!0),A(this,G)[G])try{A(this,G)[G].start()}catch(e){this.j(new M(e.message))}else this.I()},r.T=function(){var e=this;setTimeout(function(){A(e,Y)[Y]=!1,A(e,X)[X]=!1,A(e,J)[J]=!1,e.dispatchEvent(new S(k.MEDIA_STOP))},1)},r.v=function(e){for(var t,r=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return _(e,void 0);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_(e,void 0):void 0}}(e))){r&&(e=r);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=r()).done;){var n=t.value;n.contentBoxSize&&1===n.contentBoxSize.length?(A(this,V)[V]=n.contentBoxSize[0].inlineSize,A(this,H)[H]=n.contentBoxSize[0].blockSize):n.contentBoxSize&&n.contentBoxSize.inlineSize?(A(this,V)[V]=n.contentBoxSize.inlineSize,A(this,H)[H]=n.contentBoxSize.blockSize):(A(this,V)[V]=n.contentRect.width,A(this,H)[H]=n.contentRect.height)}this.R()},r.R=function(){if(A(this,q)[q].autoResize&&A(this,G)[G]){var e=A(this,K)[K],t=this.k();e&&!e.isLinear()?e&&(e.getWidth()>A(this,V)[V]||e.getHeight()>A(this,H)[H]?this.resizeAd(A(this,V)[V],A(this,H)[H]):(A(this,G)[G].resize(e.getWidth(),e.getHeight()+20,t),A(this,N)[N].style.width=e.getWidth()+"px",A(this,N)[N].style.height=e.getHeight()+20+"px")):this.resizeAd(A(this,V)[V],A(this,H)[H])}},r.k=function(){return document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement||A(this,L)[L].webkitDisplayingFullscreen?A(this,z)[z].ViewMode.FULLSCREEN:A(this,z)[z].ViewMode.NORMAL},r.I=function(){var e=this;A(this,N)[N].style.display="none",A(this,L)[L].ended||(A(this,U)[U].enable(),A(this,es)[es]?(A(this,L)[L].pause(),this.dispatchEvent(new S("pause"))):(this.p().then(function(){}).catch(function(){e.dispatchEvent(new S("pause"))}),this.dispatchEvent(new S("play")),this.dispatchEvent(new S(k.MEDIA_RESUMED))),A(this,es)[es]=!1)},r.B=function(e){var t=e.getError(),r=new M(t.getMessage());return r.type=t.getType(),r.errorCode=t.getErrorCode(),r.vastErrorCode=t.getVastErrorCode&&t.getVastErrorCode(),r.innerError=t.getInnerError(),r},r.j=function(e){var t=this;this.dispatchEvent(new S(k.AD_ERROR,{detail:{error:e}})),this.C(),A(this,en)[en]?A(this,en)[en]({start:function(){t.I(),A(t,en)[en]=void 0},startWithoutReset:function(){t.I()}}):this.I()},d(t,[{key:"volume",get:function(){return!A(this,U)[U].enabled&&A(this,G)[G]?A(this,G)[G].getVolume():A(this,L)[L].volume},set:function(e){!A(this,U)[U].enabled&&A(this,G)[G]&&A(this,G)[G].setVolume(e),A(this,L)[L].volume=e}},{key:"muted",get:function(){return!A(this,U)[U].enabled&&A(this,G)[G]?0===A(this,G)[G].getVolume():A(this,L)[L].muted},set:function(e){!A(this,U)[U].enabled&&A(this,G)[G]&&A(this,G)[G].setVolume(e?0:A(this,ea)[ea]),A(this,L)[L].muted=e}},{key:"currentTime",get:function(){return void 0!==A(this,et)[et]?A(this,et)[et]:A(this,L)[L].currentTime},set:function(e){A(this,U)[U].enabled&&(A(this,L)[L].currentTime=e)}},{key:"duration",get:function(){return void 0!==A(this,er)[er]?A(this,er)[er]:A(this,L)[L].duration}},{key:"cuePoints",get:function(){return[].concat(A(this,ee)[ee])}}]),t}(I)},{"@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}]},["lmDdD"],"lmDdD","parcelRequire4dc0",{});