diff --git a/dist/ads-manager.es.js b/dist/ads-manager.es.js index 25bda29..e28f923 100644 --- a/dist/ads-manager.es.js +++ b/dist/ads-manager.es.js @@ -1 +1 @@ -var e={686:function(e,t){!function(e){function t(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,r)}return i}function i(e){for(var i=1;ie.length)&&(t=e.length);for(var i=0,r=new Array(t);i0&&void 0!==arguments[0]?arguments[0]:{};return{id:e.id||null,adId:e.adId||null,sequence:e.sequence||null,apiFramework:e.apiFramework||null,universalAdIds:[],creativeExtensions:[]}}var f=["ADCATEGORIES","ADCOUNT","ADPLAYHEAD","ADSERVINGID","ADTYPE","APIFRAMEWORKS","APPBUNDLE","ASSETURI","BLOCKEDADCATEGORIES","BREAKMAXADLENGTH","BREAKMAXADS","BREAKMAXDURATION","BREAKMINADLENGTH","BREAKMINDURATION","BREAKPOSITION","CLICKPOS","CLICKTYPE","CLIENTUA","CONTENTID","CONTENTPLAYHEAD","CONTENTURI","DEVICEIP","DEVICEUA","DOMAIN","EXTENSIONS","GDPRCONSENT","IFA","IFATYPE","INVENTORYSTATE","LATLONG","LIMITADTRACKING","MEDIAMIME","MEDIAPLAYHEAD","OMIDPARTNER","PAGEURL","PLACEMENTTYPE","PLAYERCAPABILITIES","PLAYERSIZE","PLAYERSTATE","PODSEQUENCE","REGULATIONS","SERVERSIDE","SERVERUA","TRANSACTIONID","UNIVERSALADID","VASTVERSIONS","VERIFICATIONVENDORS"];function A(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=[],n=E(e);for(var a in!t.ERRORCODE||i.isCustomCode||/^[0-9]{3}$/.test(t.ERRORCODE)||(t.ERRORCODE=900),t.CACHEBUSTING=R(Math.round(1e8*Math.random()).toString()),t.TIMESTAMP=(new Date).toISOString(),t.RANDOM=t.random=t.CACHEBUSTING,t)t[a]=_(t[a]);for(var s in n){var o=n[s];"string"==typeof o&&r.push(g(o,t))}return r}function g(e,t){var i=(e=T(e,t)).match(/[^[\]]+(?=])/g);if(!i)return e;var r=i.filter((function(e){return f.indexOf(e)>-1}));return 0===r.length?e:T(e,r=r.reduce((function(e,t){return e[t]=-1,e}),{}))}function T(e,t){var i=e;for(var r in t){var n=t[r];i=i.replace(new RegExp("(?:\\[|%%)(".concat(r,")(?:\\]|%%)"),"g"),n)}return i}function E(e){return Array.isArray(e)?e.map((function(e){return e&&e.hasOwnProperty("url")?e.url:e})):e}function y(e,t){for(var i=0;i1&&void 0!==arguments[1]?arguments[1]:8,i=String(e);return i.lengtha;n?s++:s--)r.push(s);return r}var C={track:function(e,t,i){A(e,t,i).forEach((function(e){"undefined"!=typeof window&&null!==window&&((new Image).src=e)}))},resolveURLTemplates:A,extractURLsFromTemplates:E,containsTemplateObject:y,isTemplateObjectEqual:k,encodeURIComponentRFC3986:_,replaceUrlMacros:g,leftpad:R,range:b,isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},flatten:function e(t){return t.reduce((function(t,i){return t.concat(Array.isArray(i)?e(i):i)}),[])},joinArrayOfUniqueTemplateObjs:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=Array.isArray(e)?e:[],r=Array.isArray(t)?t:[];return i.concat(r).reduce((function(e,t){return y(t,e)||e.push(t),e}),[])}};function S(e){return-1!==["true","TRUE","True","1"].indexOf(e)}var V={childByName:function(e,t){var i=e.childNodes;for(var r in i){var n=i[r];if(n.nodeName===t)return n}},childrenByName:function(e,t){var i=[],r=e.childNodes;for(var n in r){var a=r[n];a.nodeName===t&&i.push(a)}return i},resolveVastAdTagURI:function(e,t){if(!t)return e;if(0===e.indexOf("//")){var i=location.protocol;return"".concat(i).concat(e)}if(-1===e.indexOf("://")){var r=t.slice(0,t.lastIndexOf("/"));return"".concat(r,"/").concat(e)}return e},parseBoolean:S,parseNodeText:function(e){return e&&(e.textContent||e.text||"").trim()},copyNodeAttribute:function(e,t,i){var r=t.getAttribute(e);r&&i.setAttribute(e,r)},parseAttributes:function(e){for(var t=e.attributes,i={},r=0;r3600||r>60?-1:a+n+r},splitVAST:function(e){var t=[],i=null;return e.forEach((function(r,n){if(r.sequence&&(r.sequence=parseInt(r.sequence,10)),r.sequence>1){var a=e[n-1];if(a&&a.sequence===r.sequence-1)return void(i&&i.push(r));delete r.sequence}i=[r],t.push(i)})),t},assignAttributes:function(e,t){if(e)for(var i in e){var r=e[i];if(r.nodeName&&r.nodeValue&&t.hasOwnProperty(r.nodeName)){var n=r.nodeValue;"boolean"==typeof t[r.nodeName]&&(n=S(n)),t[r.nodeName]=n}}},mergeWrapperAdData:function(e,t){e.errorURLTemplates=t.errorURLTemplates.concat(e.errorURLTemplates),e.impressionURLTemplates=t.impressionURLTemplates.concat(e.impressionURLTemplates),e.extensions=t.extensions.concat(e.extensions),t.viewableImpression.length>0&&(e.viewableImpression=[].concat(p(e.viewableImpression),p(t.viewableImpression))),e.followAdditionalWrappers=t.followAdditionalWrappers,e.allowMultipleAds=t.allowMultipleAds,e.fallbackOnNoAd=t.fallbackOnNoAd;var i=(t.creatives||[]).filter((function(e){return e&&"companion"===e.type})),r=i.reduce((function(e,t){return(t.variations||[]).forEach((function(t){(t.companionClickTrackingURLTemplates||[]).forEach((function(t){C.containsTemplateObject(t,e)||e.push(t)}))})),e}),[]);e.creatives=i.concat(e.creatives);var n=t.videoClickTrackingURLTemplates&&t.videoClickTrackingURLTemplates.length,a=t.videoCustomClickURLTemplates&&t.videoCustomClickURLTemplates.length;e.creatives.forEach((function(e){if(t.trackingEvents&&t.trackingEvents[e.type])for(var i in t.trackingEvents[e.type]){var s=t.trackingEvents[e.type][i];Array.isArray(e.trackingEvents[i])||(e.trackingEvents[i]=[]),e.trackingEvents[i]=e.trackingEvents[i].concat(s)}"linear"===e.type&&(n&&(e.videoClickTrackingURLTemplates=e.videoClickTrackingURLTemplates.concat(t.videoClickTrackingURLTemplates)),a&&(e.videoCustomClickURLTemplates=e.videoCustomClickURLTemplates.concat(t.videoCustomClickURLTemplates)),!t.videoClickThroughURLTemplate||null!==e.videoClickThroughURLTemplate&&void 0!==e.videoClickThroughURLTemplate||(e.videoClickThroughURLTemplate=t.videoClickThroughURLTemplate)),"companion"===e.type&&r.length&&(e.variations||[]).forEach((function(e){e.companionClickTrackingURLTemplates=C.joinArrayOfUniqueTemplateObjs(e.companionClickTrackingURLTemplates,r)}))})),t.adVerifications&&(e.adVerifications=e.adVerifications.concat(t.adVerifications)),t.blockedAdCategories&&(e.blockedAdCategories=e.blockedAdCategories.concat(t.blockedAdCategories))}};function N(e,t){var i=function(){var e=m(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{});return{id:e.id,adId:e.adId,sequence:e.sequence,apiFramework:e.apiFramework,type:"companion",required:null,variations:[]}}(t);return i.required=e.getAttribute("required")||null,i.variations=V.childrenByName(e,"Companion").map((function(e){var t=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{id:e.id||null,adType:"companionAd",width:e.width||0,height:e.height||0,assetWidth:e.assetWidth||null,assetHeight:e.assetHeight||null,expandedWidth:e.expandedWidth||null,expandedHeight:e.expandedHeight||null,apiFramework:e.apiFramework||null,adSlotID:e.adSlotID||null,pxratio:e.pxratio||"1",renderingMode:e.renderingMode||"default",staticResources:[],htmlResources:[],iframeResources:[],adParameters:null,xmlEncoded:null,altText:null,companionClickThroughURLTemplate:null,companionClickTrackingURLTemplates:[],trackingEvents:{}}}(V.parseAttributes(e));t.htmlResources=V.childrenByName(e,"HTMLResource").reduce((function(e,t){var i=V.parseNodeText(t);return i?e.concat(i):e}),[]),t.iframeResources=V.childrenByName(e,"IFrameResource").reduce((function(e,t){var i=V.parseNodeText(t);return i?e.concat(i):e}),[]),t.staticResources=V.childrenByName(e,"StaticResource").reduce((function(e,t){var i=V.parseNodeText(t);return i?e.concat({url:i,creativeType:t.getAttribute("creativeType")||null}):e}),[]),t.altText=V.parseNodeText(V.childByName(e,"AltText"))||null;var i=V.childByName(e,"TrackingEvents");i&&V.childrenByName(i,"Tracking").forEach((function(e){var i=e.getAttribute("event"),r=V.parseNodeText(e);i&&r&&(Array.isArray(t.trackingEvents[i])||(t.trackingEvents[i]=[]),t.trackingEvents[i].push(r))})),t.companionClickTrackingURLTemplates=V.childrenByName(e,"CompanionClickTracking").map((function(e){return{id:e.getAttribute("id")||null,url:V.parseNodeText(e)}})),t.companionClickThroughURLTemplate=V.parseNodeText(V.childByName(e,"CompanionClickThrough"))||null;var r=V.childByName(e,"AdParameters");return r&&(t.adParameters=V.parseNodeText(r),t.xmlEncoded=r.getAttribute("xmlEncoded")||null),t})),i}function I(e){return"linear"===e.type}function L(e,t){var i,r=function(){var e=m(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{});return{id:e.id,adId:e.adId,sequence:e.sequence,apiFramework:e.apiFramework,type:"linear",duration:0,skipDelay:null,mediaFiles:[],mezzanine:null,interactiveCreativeFile:null,closedCaptionFiles:[],videoClickThroughURLTemplate:null,videoClickTrackingURLTemplates:[],videoCustomClickURLTemplates:[],adParameters:null,icons:[],trackingEvents:{}}}(t);r.duration=V.parseDuration(V.parseNodeText(V.childByName(e,"Duration")));var n=e.getAttribute("skipoffset");if(null==n)r.skipDelay=null;else if("%"===n.charAt(n.length-1)&&-1!==r.duration){var a=parseInt(n,10);r.skipDelay=r.duration*(a/100)}else r.skipDelay=V.parseDuration(n);var s=V.childByName(e,"VideoClicks");if(s){var o=V.childByName(s,"ClickThrough");r.videoClickThroughURLTemplate=o?{id:o.getAttribute("id")||null,url:V.parseNodeText(o)}:null,V.childrenByName(s,"ClickTracking").forEach((function(e){r.videoClickTrackingURLTemplates.push({id:e.getAttribute("id")||null,url:V.parseNodeText(e)})})),V.childrenByName(s,"CustomClick").forEach((function(e){r.videoCustomClickURLTemplates.push({id:e.getAttribute("id")||null,url:V.parseNodeText(e)})}))}var l=V.childByName(e,"AdParameters");l&&(r.adParameters=V.parseNodeText(l)),V.childrenByName(e,"TrackingEvents").forEach((function(e){V.childrenByName(e,"Tracking").forEach((function(e){var t=e.getAttribute("event"),n=V.parseNodeText(e);if(t&&n){if("progress"===t){if(!(i=e.getAttribute("offset")))return;t="%"===i.charAt(i.length-1)?"progress-".concat(i):"progress-".concat(Math.round(V.parseDuration(i)))}Array.isArray(r.trackingEvents[t])||(r.trackingEvents[t]=[]),r.trackingEvents[t].push(n)}}))})),V.childrenByName(e,"MediaFiles").forEach((function(e){V.childrenByName(e,"MediaFile").forEach((function(e){r.mediaFiles.push(function(e){var t={id:null,fileURL:null,fileSize:0,deliveryType:"progressive",mimeType:null,mediaType:null,codec:null,bitrate:0,minBitrate:0,maxBitrate:0,width:0,height:0,apiFramework:null,scalable:null,maintainAspectRatio:null};t.id=e.getAttribute("id"),t.fileURL=V.parseNodeText(e),t.deliveryType=e.getAttribute("delivery"),t.codec=e.getAttribute("codec"),t.mimeType=e.getAttribute("type"),t.mediaType=e.getAttribute("mediaType")||"2D",t.apiFramework=e.getAttribute("apiFramework"),t.fileSize=parseInt(e.getAttribute("fileSize")||0),t.bitrate=parseInt(e.getAttribute("bitrate")||0),t.minBitrate=parseInt(e.getAttribute("minBitrate")||0),t.maxBitrate=parseInt(e.getAttribute("maxBitrate")||0),t.width=parseInt(e.getAttribute("width")||0),t.height=parseInt(e.getAttribute("height")||0);var i=e.getAttribute("scalable");i&&"string"==typeof i&&(t.scalable=V.parseBoolean(i));var r=e.getAttribute("maintainAspectRatio");return r&&"string"==typeof r&&(t.maintainAspectRatio=V.parseBoolean(r)),t}(e))}));var t=V.childByName(e,"InteractiveCreativeFile");t&&(r.interactiveCreativeFile=function(e){var t=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{type:e.type||null,apiFramework:e.apiFramework||null,variableDuration:V.parseBoolean(e.variableDuration),fileURL:null}}(V.parseAttributes(e));return t.fileURL=V.parseNodeText(e),t}(t));var i=V.childByName(e,"ClosedCaptionFiles");i&&V.childrenByName(i,"ClosedCaptionFile").forEach((function(e){var t=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{type:e.type||null,language:e.language||null,fileURL:null}}(V.parseAttributes(e));t.fileURL=V.parseNodeText(e),r.closedCaptionFiles.push(t)}));var n,a,s,o=V.childByName(e,"Mezzanine"),l=(n=o,a={},s=!1,["delivery","type","width","height"].forEach((function(e){n&&n.getAttribute(e)?a[e]=n.getAttribute(e):s=!0})),s?null:a);if(l){var d={id:null,fileURL:null,delivery:null,codec:null,type:null,width:0,height:0,fileSize:0,mediaType:"2D"};d.id=o.getAttribute("id"),d.fileURL=V.parseNodeText(o),d.delivery=l.delivery,d.codec=o.getAttribute("codec"),d.type=l.type,d.width=parseInt(l.width,10),d.height=parseInt(l.height,10),d.fileSize=parseInt(o.getAttribute("fileSize"),10),d.mediaType=o.getAttribute("mediaType")||"2D",r.mezzanine=d}}));var d=V.childByName(e,"Icons");return d&&V.childrenByName(d,"Icon").forEach((function(e){r.icons.push(function(e){var t={program:null,height:0,width:0,xPosition:0,yPosition:0,apiFramework:null,offset:null,duration:0,type:null,staticResource:null,htmlResource:null,iframeResource:null,pxratio:"1",iconClickThroughURLTemplate:null,iconClickTrackingURLTemplates:[],iconViewTrackingURLTemplate:null};t.program=e.getAttribute("program"),t.height=parseInt(e.getAttribute("height")||0),t.width=parseInt(e.getAttribute("width")||0),t.xPosition=function(e){return-1!==["left","right"].indexOf(e)?e:parseInt(e||0)}(e.getAttribute("xPosition")),t.yPosition=function(e){return-1!==["top","bottom"].indexOf(e)?e:parseInt(e||0)}(e.getAttribute("yPosition")),t.apiFramework=e.getAttribute("apiFramework"),t.pxratio=e.getAttribute("pxratio")||"1",t.offset=V.parseDuration(e.getAttribute("offset")),t.duration=V.parseDuration(e.getAttribute("duration")),V.childrenByName(e,"HTMLResource").forEach((function(e){t.type=e.getAttribute("creativeType")||"text/html",t.htmlResource=V.parseNodeText(e)})),V.childrenByName(e,"IFrameResource").forEach((function(e){t.type=e.getAttribute("creativeType")||0,t.iframeResource=V.parseNodeText(e)})),V.childrenByName(e,"StaticResource").forEach((function(e){t.type=e.getAttribute("creativeType")||0,t.staticResource=V.parseNodeText(e)}));var i=V.childByName(e,"IconClicks");return i&&(t.iconClickThroughURLTemplate=V.parseNodeText(V.childByName(i,"IconClickThrough")),V.childrenByName(i,"IconClickTracking").forEach((function(e){t.iconClickTrackingURLTemplates.push({id:e.getAttribute("id")||null,url:V.parseNodeText(e)})}))),t.iconViewTrackingURLTemplate=V.parseNodeText(V.childByName(e,"IconViewTracking")),t}(e))})),r}function w(e,t){var i=function(){var e=m(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{});return{id:e.id,adId:e.adId,sequence:e.sequence,apiFramework:e.apiFramework,type:"nonlinear",variations:[],trackingEvents:{}}}(t);return V.childrenByName(e,"TrackingEvents").forEach((function(e){var t,r;V.childrenByName(e,"Tracking").forEach((function(e){t=e.getAttribute("event"),r=V.parseNodeText(e),t&&r&&(Array.isArray(i.trackingEvents[t])||(i.trackingEvents[t]=[]),i.trackingEvents[t].push(r))}))})),V.childrenByName(e,"NonLinear").forEach((function(e){var t={id:null,width:0,height:0,expandedWidth:0,expandedHeight:0,scalable:!0,maintainAspectRatio:!0,minSuggestedDuration:0,apiFramework:"static",adType:"nonLinearAd",type:null,staticResource:null,htmlResource:null,iframeResource:null,nonlinearClickThroughURLTemplate:null,nonlinearClickTrackingURLTemplates:[],adParameters:null};t.id=e.getAttribute("id")||null,t.width=e.getAttribute("width"),t.height=e.getAttribute("height"),t.expandedWidth=e.getAttribute("expandedWidth"),t.expandedHeight=e.getAttribute("expandedHeight"),t.scalable=V.parseBoolean(e.getAttribute("scalable")),t.maintainAspectRatio=V.parseBoolean(e.getAttribute("maintainAspectRatio")),t.minSuggestedDuration=V.parseDuration(e.getAttribute("minSuggestedDuration")),t.apiFramework=e.getAttribute("apiFramework"),V.childrenByName(e,"HTMLResource").forEach((function(e){t.type=e.getAttribute("creativeType")||"text/html",t.htmlResource=V.parseNodeText(e)})),V.childrenByName(e,"IFrameResource").forEach((function(e){t.type=e.getAttribute("creativeType")||0,t.iframeResource=V.parseNodeText(e)})),V.childrenByName(e,"StaticResource").forEach((function(e){t.type=e.getAttribute("creativeType")||0,t.staticResource=V.parseNodeText(e)}));var r=V.childByName(e,"AdParameters");r&&(t.adParameters=V.parseNodeText(r)),t.nonlinearClickThroughURLTemplate=V.parseNodeText(V.childByName(e,"NonLinearClickThrough")),V.childrenByName(e,"NonLinearClickTracking").forEach((function(e){t.nonlinearClickTrackingURLTemplates.push({id:e.getAttribute("id")||null,url:V.parseNodeText(e)})})),i.variations.push(t)})),i}function O(e){var t=[];return e.forEach((function(e){var i=D(e);i&&t.push(i)})),t}function D(e){if("#comment"===e.nodeName)return null;var t,i={name:null,value:null,attributes:{},children:[]},r=e.attributes,n=e.childNodes;if(i.name=e.nodeName,e.attributes)for(var a in r)if(r.hasOwnProperty(a)){var s=r[a];s.nodeName&&s.nodeValue&&(i.attributes[s.nodeName]=s.nodeValue)}for(var o in n)if(n.hasOwnProperty(o)){var l=D(n[o]);l&&i.children.push(l)}if(0===i.children.length||1===i.children.length&&["#cdata-section","#text"].indexOf(i.children[0].name)>=0){var d=V.parseNodeText(e);""!==d&&(i.value=d),i.children=[]}return null===(t=i).value&&0===Object.keys(t.attributes).length&&0===t.children.length?null:i}function U(e){var t=[];return e.forEach((function(e){var i,r={id:e.getAttribute("id")||null,adId:P(e),sequence:e.getAttribute("sequence")||null,apiFramework:e.getAttribute("apiFramework")||null},n=[];V.childrenByName(e,"UniversalAdId").forEach((function(e){var t={idRegistry:e.getAttribute("idRegistry")||"unknown",value:V.parseNodeText(e)};n.push(t)}));var a=V.childByName(e,"CreativeExtensions");for(var s in a&&(i=O(V.childrenByName(a,"CreativeExtension"))),e.childNodes){var o=e.childNodes[s],l=void 0;switch(o.nodeName){case"Linear":l=L(o,r);break;case"NonLinearAds":l=w(o,r);break;case"CompanionAds":l=N(o,r)}l&&(n&&(l.universalAdIds=n),i&&(l.creativeExtensions=i),t.push(l))}})),t}function P(e){return e.getAttribute("AdID")||e.getAttribute("adID")||e.getAttribute("adId")||null}var x={Wrapper:{subElements:["VASTAdTagURI","Impression"]},BlockedAdCategories:{attributes:["authority"]},InLine:{subElements:["AdSystem","AdTitle","Impression","AdServingId","Creatives"]},Category:{attributes:["authority"]},Pricing:{attributes:["model","currency"]},Verification:{oneOfinLineResources:["JavaScriptResource","ExecutableResource"],attributes:["vendor"]},UniversalAdId:{attributes:["idRegistry"]},JavaScriptResource:{attributes:["apiFramework","browserOptional"]},ExecutableResource:{attributes:["apiFramework","type"]},Tracking:{attributes:["event"]},Creatives:{subElements:["Creative"]},Creative:{subElements:["UniversalAdId"]},Linear:{subElements:["MediaFiles","Duration"]},MediaFiles:{subElements:["MediaFile"]},MediaFile:{attributes:["delivery","type","width","height"]},Mezzanine:{attributes:["delivery","type","width","height"]},NonLinear:{oneOfinLineResources:["StaticResource","IFrameResource","HTMLResource"],attributes:["width","height"]},Companion:{oneOfinLineResources:["StaticResource","IFrameResource","HTMLResource"],attributes:["width","height"]},StaticResource:{attributes:["creativeType"]},Icons:{subElements:["Icon"]},Icon:{oneOfinLineResources:["StaticResource","IFrameResource","HTMLResource"]}};function M(e,t){if(x[e.nodeName]&&x[e.nodeName].attributes){var i=x[e.nodeName].attributes.filter((function(t){return!e.getAttribute(t)}));i.length>0&&W({name:e.nodeName,parentName:e.parentNode.nodeName,attributes:i},t)}}function F(e,t,i){var r=x[e.nodeName],n=!i&&"Wrapper"!==e.nodeName;if(r&&!n){if(r.subElements){var a=r.subElements.filter((function(t){return!V.childByName(e,t)}));a.length>0&&W({name:e.nodeName,parentName:e.parentNode.nodeName,subElements:a},t)}i&&r.oneOfinLineResources&&(r.oneOfinLineResources.some((function(t){return V.childByName(e,t)}))||W({name:e.nodeName,parentName:e.parentNode.nodeName,oneOfResources:r.oneOfinLineResources},t))}}function B(e){return e.children&&0!==e.children.length}function W(e,t){var i=e.name,r=e.parentName,n=e.attributes,a=e.subElements,s=e.oneOfResources,o="Element '".concat(i,"'");t("VAST-warning",{message:o+=n?" missing required attribute(s) '".concat(n.join(", "),"' "):a?" missing required sub element(s) '".concat(a.join(", "),"' "):s?" must provide one of the following '".concat(s.join(", "),"' "):" is empty",parentElement:r,specVersion:4.1})}var j={verifyRequiredValues:function e(t,i,r){if(t&&t.nodeName)if("InLine"===t.nodeName&&(r=!0),M(t,i),B(t)){F(t,i,r);for(var n=0;n2&&void 0!==arguments[2]?arguments[2]:{},r=i.allowMultipleAds,n=i.followAdditionalWrappers,a=e.childNodes;for(var s in a){var o=a[s];if(-1!==["Wrapper","InLine"].indexOf(o.nodeName)&&("Wrapper"!==o.nodeName||!1!==n)){if(V.copyNodeAttribute("id",e,o),V.copyNodeAttribute("sequence",e,o),V.copyNodeAttribute("adType",e,o),"Wrapper"===o.nodeName)return{ad:z(o,t),type:"WRAPPER"};if("InLine"===o.nodeName)return{ad:H(o,t,{allowMultipleAds:r}),type:"INLINE"}}}}function H(e,t){return!1===(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).allowMultipleAds&&e.getAttribute("sequence")?null:Q(e,t)}function Q(e,t){var i=[];t&&j.verifyRequiredValues(e,t);var r=e.childNodes,n=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{id:e.id||null,sequence:e.sequence||null,adType:e.adType||null,adServingId:null,categories:[],expires:null,viewableImpression:[],system:null,title:null,description:null,advertiser:null,pricing:null,survey:null,errorURLTemplates:[],impressionURLTemplates:[],creatives:[],extensions:[],adVerifications:[],blockedAdCategories:[],followAdditionalWrappers:!0,allowMultipleAds:!1,fallbackOnNoAd:null}}(V.parseAttributes(e));for(var a in r){var s=r[a];switch(s.nodeName){case"Error":n.errorURLTemplates.push(V.parseNodeText(s));break;case"Impression":n.impressionURLTemplates.push({id:s.getAttribute("id")||null,url:V.parseNodeText(s)});break;case"Creatives":n.creatives=U(V.childrenByName(s,"Creative"));break;case"Extensions":var o=V.childrenByName(s,"Extension");n.extensions=O(o),n.adVerifications.length||(i=G(o));break;case"AdVerifications":n.adVerifications=Y(V.childrenByName(s,"Verification"));break;case"AdSystem":n.system={value:V.parseNodeText(s),version:s.getAttribute("version")||null};break;case"AdTitle":n.title=V.parseNodeText(s);break;case"AdServingId":n.adServingId=V.parseNodeText(s);break;case"Category":n.categories.push({authority:s.getAttribute("authority")||null,value:V.parseNodeText(s)});break;case"Expires":n.expires=parseInt(V.parseNodeText(s),10);break;case"ViewableImpression":n.viewableImpression.push(K(s));break;case"Description":n.description=V.parseNodeText(s);break;case"Advertiser":n.advertiser={id:s.getAttribute("id")||null,value:V.parseNodeText(s)};break;case"Pricing":n.pricing={value:V.parseNodeText(s),model:s.getAttribute("model")||null,currency:s.getAttribute("currency")||null};break;case"Survey":n.survey=V.parseNodeText(s);break;case"BlockedAdCategories":n.blockedAdCategories.push({authority:s.getAttribute("authority")||null,value:V.parseNodeText(s)})}}return i.length&&(n.adVerifications=n.adVerifications.concat(i)),n}function z(e,t){var i=Q(e,t),r=e.getAttribute("followAdditionalWrappers"),n=e.getAttribute("allowMultipleAds"),a=e.getAttribute("fallbackOnNoAd");i.followAdditionalWrappers=!r||V.parseBoolean(r),i.allowMultipleAds=!!n&&V.parseBoolean(n),i.fallbackOnNoAd=a?V.parseBoolean(a):null;var s=V.childByName(e,"VASTAdTagURI");if(s?i.nextWrapperURL=V.parseNodeText(s):(s=V.childByName(e,"VASTAdTagURL"))&&(i.nextWrapperURL=V.parseNodeText(V.childByName(s,"URL"))),i.creatives.forEach((function(e){if(-1!==["linear","nonlinear"].indexOf(e.type)){if(e.trackingEvents){i.trackingEvents||(i.trackingEvents={}),i.trackingEvents[e.type]||(i.trackingEvents[e.type]={});var t=function(t){var r=e.trackingEvents[t];Array.isArray(i.trackingEvents[e.type][t])||(i.trackingEvents[e.type][t]=[]),r.forEach((function(r){i.trackingEvents[e.type][t].push(r)}))};for(var r in e.trackingEvents)t(r)}e.videoClickTrackingURLTemplates&&(Array.isArray(i.videoClickTrackingURLTemplates)||(i.videoClickTrackingURLTemplates=[]),e.videoClickTrackingURLTemplates.forEach((function(e){i.videoClickTrackingURLTemplates.push(e)}))),e.videoClickThroughURLTemplate&&(i.videoClickThroughURLTemplate=e.videoClickThroughURLTemplate),e.videoCustomClickURLTemplates&&(Array.isArray(i.videoCustomClickURLTemplates)||(i.videoCustomClickURLTemplates=[]),e.videoCustomClickURLTemplates.forEach((function(e){i.videoCustomClickURLTemplates.push(e)})))}})),i.nextWrapperURL)return i}function Y(e){var t=[];return e.forEach((function(e){var i={resource:null,vendor:null,browserOptional:!1,apiFramework:null,type:null,parameters:null,trackingEvents:{}},r=e.childNodes;for(var n in V.assignAttributes(e.attributes,i),r){var a=r[n];switch(a.nodeName){case"JavaScriptResource":case"ExecutableResource":i.resource=V.parseNodeText(a),V.assignAttributes(a.attributes,i);break;case"VerificationParameters":i.parameters=V.parseNodeText(a)}}var s=V.childByName(e,"TrackingEvents");s&&V.childrenByName(s,"Tracking").forEach((function(e){var t=e.getAttribute("event"),r=V.parseNodeText(e);t&&r&&(Array.isArray(i.trackingEvents[t])||(i.trackingEvents[t]=[]),i.trackingEvents[t].push(r))})),t.push(i)})),t}function G(e){var t=null,i=[];return e.some((function(e){return t=V.childByName(e,"AdVerifications")})),t&&(i=Y(V.childrenByName(t,"Verification"))),i}function K(e){var t={};t.id=e.getAttribute("id")||null;var i=e.childNodes;for(var r in i){var n=i[r],a=n.nodeName,s=V.parseNodeText(n);if(("Viewable"===a||"NotViewable"===a||"ViewUndetermined"===a)&&s){var o=a.toLowerCase();Array.isArray(t[o])||(t[o]=[]),t[o].push(s)}}return t}var X=function(){function e(){n(this,e),this._handlers=[]}return s(e,[{key:"on",value:function(e,t){if("function"!=typeof t)throw new TypeError("The handler argument must be of type Function. Received type ".concat(r(t)));if(!e)throw new TypeError("The event argument must be of type String. Received type ".concat(r(e)));return this._handlers.push({event:e,handler:t}),this}},{key:"once",value:function(e,t){return this.on(e,function(e,t,i){var r={fired:!1,wrapFn:void 0};function n(){r.fired||(e.off(t,r.wrapFn),r.fired=!0,i.bind(e).apply(void 0,arguments))}return r.wrapFn=n,n}(this,e,t))}},{key:"off",value:function(e,t){return this._handlers=this._handlers.filter((function(i){return i.event!==e||i.handler!==t})),this}},{key:"emit",value:function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r2?i-2:0),n=2;n1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;return new Promise((function(a,s){t.URLTemplateFilters.forEach((function(t){e=t(e)})),t.parentURLs.push(e);var o=Date.now();t.emit("VAST-resolving",{url:e,previousUrl:r,wrapperDepth:i,maxWrapperDepth:t.maxWrapperDepth,timeout:t.fetchingOptions.timeout,wrapperAd:n}),t.urlHandler.get(e,t.fetchingOptions,(function(n,l){var d=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},u=Math.round(Date.now()-o),c=Object.assign({url:e,previousUrl:r,wrapperDepth:i,error:n,duration:u},d);t.emit("VAST-resolved",c),ae(d.byteLength,u),n?s(n):a(l)}))}))}},{key:"initParsingStatus",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.errorURLTemplates=[],this.fetchingOptions={timeout:e.timeout||$,withCredentials:e.withCredentials},this.maxWrapperDepth=e.wrapperLimit||10,this.parentURLs=[],this.parsingOptions={allowMultipleAds:e.allowMultipleAds},this.remainingAds=[],this.rootErrorURLTemplates=[],this.rootURL="",this.urlHandler=e.urlHandler||e.urlhandler||ie,this.vastVersion=null,ae(e.byteLength,e.requestDuration)}},{key:"getRemainingAds",value:function(e){var t=this;if(0===this.remainingAds.length)return Promise.reject(new Error("No more ads are available for the given VAST"));var i=e?C.flatten(this.remainingAds):this.remainingAds.shift();return this.errorURLTemplates=[],this.parentURLs=[],this.resolveAds(i,{wrapperDepth:0,url:this.rootURL}).then((function(e){return t.buildVASTResponse(e)}))}},{key:"getAndParseVAST",value:function(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.initParsingStatus(i),this.URLTemplateFilters.forEach((function(t){e=t(e)})),this.rootURL=e,this.fetchVAST(e).then((function(r){return i.previousUrl=e,i.isRootVAST=!0,i.url=e,t.parse(r,i).then((function(e){return t.buildVASTResponse(e)}))}))}},{key:"parseVAST",value:function(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.initParsingStatus(i),i.isRootVAST=!0,this.parse(e,i).then((function(e){return t.buildVASTResponse(e)}))}},{key:"buildVASTResponse",value:function(e){var t,i={ads:(t={ads:e,errorURLTemplates:this.getErrorURLTemplates(),version:this.vastVersion}).ads||[],errorURLTemplates:t.errorURLTemplates||[],version:t.version||null};return this.completeWrapperResolving(i),i}},{key:"parseVastXml",value:function(e,t){var i=t.isRootVAST,r=void 0!==i&&i,n=t.url,a=void 0===n?null:n,s=t.wrapperDepth,o=void 0===s?0:s,l=t.allowMultipleAds,d=t.followAdditionalWrappers;if(!e||!e.documentElement||"VAST"!==e.documentElement.nodeName)throw this.emit("VAST-ad-parsed",{type:"ERROR",url:a,wrapperDepth:o}),new Error("Invalid VAST XMLDocument");var u=[],c=e.documentElement.childNodes,h=e.documentElement.getAttribute("version");for(var p in r&&h&&(this.vastVersion=h),c){var v=c[p];if("Error"===v.nodeName){var m=V.parseNodeText(v);r?this.rootErrorURLTemplates.push(m):this.errorURLTemplates.push(m)}else if("Ad"===v.nodeName){if(this.vastVersion&&parseFloat(this.vastVersion)<3)l=!0;else if(!1===l&&u.length>1)break;var f=q(v,this.emit.bind(this),{allowMultipleAds:l,followAdditionalWrappers:d});f.ad?(u.push(f.ad),this.emit("VAST-ad-parsed",{type:f.type,url:a,wrapperDepth:o,adIndex:u.length-1,vastVersion:h})):this.trackVastError(this.getErrorURLTemplates(),{ERRORCODE:101})}}return u}},{key:"parse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=t.url,r=void 0===i?null:i,n=t.resolveAll,a=void 0===n||n,s=t.wrapperSequence,o=void 0===s?null:s,l=t.previousUrl,d=void 0===l?null:l,u=t.wrapperDepth,c=void 0===u?0:u,h=t.isRootVAST,p=void 0!==h&&h,v=t.followAdditionalWrappers,m=t.allowMultipleAds,f=[];this.vastVersion&&parseFloat(this.vastVersion)<3&&p&&(m=!0);try{f=this.parseVastXml(e,{isRootVAST:p,url:r,wrapperDepth:c,allowMultipleAds:m,followAdditionalWrappers:v})}catch(e){return Promise.reject(e)}return 1===f.length&&null!=o&&(f[0].sequence=o),!1===a&&(this.remainingAds=V.splitVAST(f),f=this.remainingAds.shift()),this.resolveAds(f,{wrapperDepth:c,previousUrl:d,url:r})}},{key:"resolveAds",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],i=arguments.length>1?arguments[1]:void 0,r=i.wrapperDepth,n=i.previousUrl,a=i.url,s=[];return n=a,t.forEach((function(t){var i=e.resolveWrappers(t,r,n);s.push(i)})),Promise.all(s).then((function(t){var i=C.flatten(t);if(!i&&e.remainingAds.length>0){var s=e.remainingAds.shift();return e.resolveAds(s,{wrapperDepth:r,previousUrl:n,url:a})}return i}))}},{key:"resolveWrappers",value:function(e,t,i){var r=this;return new Promise((function(n){var a;if(t++,!e.nextWrapperURL)return delete e.nextWrapperURL,n(e);if(t>=r.maxWrapperDepth||-1!==r.parentURLs.indexOf(e.nextWrapperURL))return e.errorCode=302,delete e.nextWrapperURL,n(e);e.nextWrapperURL=V.resolveVastAdTagURI(e.nextWrapperURL,i),r.URLTemplateFilters.forEach((function(t){e.nextWrapperURL=t(e.nextWrapperURL)}));var s=null!==(a=r.parsingOptions.allowMultipleAds)&&void 0!==a?a:e.allowMultipleAds,o=e.sequence;r.fetchVAST(e.nextWrapperURL,t,i,e).then((function(a){return r.parse(a,{url:e.nextWrapperURL,previousUrl:i,wrapperSequence:o,wrapperDepth:t,followAdditionalWrappers:e.followAdditionalWrappers,allowMultipleAds:s}).then((function(t){if(delete e.nextWrapperURL,0===t.length)return e.creatives=[],n(e);t.forEach((function(t){t&&V.mergeWrapperAdData(t,e)})),n(t)}))})).catch((function(t){e.errorCode=301,e.errorMessage=t.message,n(e)}))}))}},{key:"completeWrapperResolving",value:function(e){if(0===e.ads.length)this.trackVastError(e.errorURLTemplates,{ERRORCODE:303});else for(var t=e.ads.length-1;t>=0;t--){var i=e.ads[t];(i.errorCode||0===i.creatives.length)&&(this.trackVastError(i.errorURLTemplates.concat(e.errorURLTemplates),{ERRORCODE:i.errorCode||303},{ERRORMESSAGE:i.errorMessage||""},{extensions:i.extensions},{system:i.system}),e.ads.splice(t,1))}}}]),i}(X),le=null,de={data:{},length:0,getItem:function(e){return this.data[e]},setItem:function(e,t){this.data[e]=t,this.length=Object.keys(this.data).length},removeItem:function(e){delete this.data[e],this.length=Object.keys(this.data).length},clear:function(){this.data={},this.length=0}},ue=function(){function e(){n(this,e),this.storage=this.initStorage()}return s(e,[{key:"initStorage",value:function(){if(le)return le;try{le="undefined"!=typeof window&&null!==window?window.localStorage||window.sessionStorage:null}catch(e){le=null}return le&&!this.isStorageDisabled(le)||(le=de).clear(),le}},{key:"isStorageDisabled",value:function(e){var t="__VASTStorage__";try{if(e.setItem(t,t),e.getItem(t)!==t)return e.removeItem(t),!0}catch(e){return!0}return e.removeItem(t),!1}},{key:"getItem",value:function(e){return this.storage.getItem(e)}},{key:"setItem",value:function(e,t){return this.storage.setItem(e,t)}},{key:"removeItem",value:function(e){return this.storage.removeItem(e)}},{key:"clear",value:function(){return this.storage.clear()}}]),e}(),ce=function(){function e(t,i,r){n(this,e),this.cappingFreeLunch=t||0,this.cappingMinimumTimeInterval=i||0,this.defaultOptions={withCredentials:!1,timeout:0},this.vastParser=new oe,this.storage=r||new ue,void 0===this.lastSuccessfulAd&&(this.lastSuccessfulAd=0),void 0===this.totalCalls&&(this.totalCalls=0),void 0===this.totalCallsTimeout&&(this.totalCallsTimeout=0)}return s(e,[{key:"getParser",value:function(){return this.vastParser}},{key:"lastSuccessfulAd",get:function(){return this.storage.getItem("vast-client-last-successful-ad")},set:function(e){this.storage.setItem("vast-client-last-successful-ad",e)}},{key:"totalCalls",get:function(){return this.storage.getItem("vast-client-total-calls")},set:function(e){this.storage.setItem("vast-client-total-calls",e)}},{key:"totalCallsTimeout",get:function(){return this.storage.getItem("vast-client-total-calls-timeout")},set:function(e){this.storage.setItem("vast-client-total-calls-timeout",e)}},{key:"hasRemainingAds",value:function(){return this.vastParser.remainingAds.length>0}},{key:"getNextAds",value:function(e){return this.vastParser.getRemainingAds(e)}},{key:"get",value:function(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=Date.now();return(i=Object.assign({},this.defaultOptions,i)).hasOwnProperty("resolveAll")||(i.resolveAll=!1),this.totalCallsTimeout=t.totalCalls)return a(new Error("VAST call canceled – FreeLunch capping not reached yet ".concat(t.totalCalls,"/").concat(t.cappingFreeLunch)));var s=r-t.lastSuccessfulAd;if(s<0)t.lastSuccessfulAd=0;else if(s3&&void 0!==arguments[3]?arguments[3]:null;for(var l in n(this,r),(s=t.call(this)).ad=i,s.creative=a,s.variation=o,s.muted=!1,s.impressed=!1,s.skippable=!1,s.trackingEvents={},s.lastPercentage=0,s._alreadyTriggeredQuartiles={},s.emitAlwaysEvents=["creativeView","start","firstQuartile","midpoint","thirdQuartile","complete","resume","pause","rewind","skip","closeLinear","close"],s.creative.trackingEvents){var d=s.creative.trackingEvents[l];s.trackingEvents[l]=d.slice(0)}return I(s.creative)?s._initLinearTracking():s._initVariationTracking(),e&&s.on("start",(function(){e.lastSuccessfulAd=Date.now()})),s}return s(r,[{key:"_initLinearTracking",value:function(){this.linear=!0,this.skipDelay=this.creative.skipDelay,this.setDuration(this.creative.duration),this.clickThroughURLTemplate=this.creative.videoClickThroughURLTemplate,this.clickTrackingURLTemplates=this.creative.videoClickTrackingURLTemplates}},{key:"_initVariationTracking",value:function(){if(this.linear=!1,this.skipDelay=-1,this.variation){for(var e in this.variation.trackingEvents){var t=this.variation.trackingEvents[e];this.trackingEvents[e]?this.trackingEvents[e]=this.trackingEvents[e].concat(t.slice(0)):this.trackingEvents[e]=t.slice(0)}"nonLinearAd"===this.variation.adType?(this.clickThroughURLTemplate=this.variation.nonlinearClickThroughURLTemplate,this.clickTrackingURLTemplates=this.variation.nonlinearClickTrackingURLTemplates,this.setDuration(this.variation.minSuggestedDuration)):function(e){return"companionAd"===e.adType}(this.variation)&&(this.clickThroughURLTemplate=this.variation.companionClickThroughURLTemplate,this.clickTrackingURLTemplates=this.variation.companionClickTrackingURLTemplates)}}},{key:"setDuration",value:function(e){this.assetDuration=e,this.quartiles={firstQuartile:Math.round(25*this.assetDuration)/100,midpoint:Math.round(50*this.assetDuration)/100,thirdQuartile:Math.round(75*this.assetDuration)/100}}},{key:"setProgress",value:function(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=this.skipDelay||-1;if(-1===r||this.skippable||(r>e?this.emit("skip-countdown",r-e):(this.skippable=!0,this.emit("skip-countdown",0))),this.assetDuration>0){var n=Math.round(e/this.assetDuration*100),a=[];if(e>0){a.push("start");for(var s=this.lastPercentage;s1&&void 0!==arguments[1]?arguments[1]:{};this.muted!==e&&this.track(e?"mute":"unmute",{macros:t}),this.muted=e}},{key:"setPaused",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.paused!==e&&this.track(e?"pause":"resume",{macros:t}),this.paused=e}},{key:"setFullscreen",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.fullscreen!==e&&this.track(e?"fullscreen":"exitFullscreen",{macros:t}),this.fullscreen=e}},{key:"setExpand",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.expanded!==e&&(this.track(e?"expand":"collapse",{macros:t}),this.track(e?"playerExpand":"playerCollapse",{macros:t})),this.expanded=e}},{key:"setSkipDelay",value:function(e){"number"==typeof e&&(this.skipDelay=e)}},{key:"trackImpression",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.impressed||(this.impressed=!0,this.trackURLs(this.ad.impressionURLTemplates,e),this.track("creativeView",{macros:e}))}},{key:"error",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.trackURLs(this.ad.errorURLTemplates,e,{isCustomCode:t})}},{key:"errorWithCode",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.error({ERRORCODE:e},t)}},{key:"complete",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.track("complete",{macros:e})}},{key:"notUsed",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.track("notUsed",{macros:e}),this.trackingEvents=[]}},{key:"otherAdInteraction",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.track("otherAdInteraction",{macros:e})}},{key:"acceptInvitation",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.track("acceptInvitation",{macros:e})}},{key:"adExpand",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.track("adExpand",{macros:e})}},{key:"adCollapse",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.track("adCollapse",{macros:e})}},{key:"minimize",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.track("minimize",{macros:e})}},{key:"verificationNotExecuted",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!this.ad||!this.ad.adVerifications||!this.ad.adVerifications.length)throw new Error("No adVerifications provided");if(!e)throw new Error("No vendor provided, unable to find associated verificationNotExecuted");var i=this.ad.adVerifications.find((function(t){return t.vendor===e}));if(!i)throw new Error("No associated verification element found for vendor: ".concat(e));var r=i.trackingEvents;if(r&&r.verificationNotExecuted){var n=r.verificationNotExecuted;this.trackURLs(n,t),this.emit("verificationNotExecuted",{trackingURLTemplates:n})}}},{key:"overlayViewDuration",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t.ADPLAYHEAD=e,this.track("overlayViewDuration",{macros:t})}},{key:"close",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.track(this.linear?"closeLinear":"close",{macros:e})}},{key:"skip",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.track("skip",{macros:e})}},{key:"load",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.track("loaded",{macros:e})}},{key:"click",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.clickTrackingURLTemplates&&this.clickTrackingURLTemplates.length&&this.trackURLs(this.clickTrackingURLTemplates,t);var r=this.clickThroughURLTemplate||e,n=i({},t);if(r){this.progress&&(n.ADPLAYHEAD=this.progressFormatted());var a=C.resolveURLTemplates([r],n)[0];this.emit("clickthrough",a)}}},{key:"track",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=t.macros,r=void 0===i?{}:i,n=t.once,a=void 0!==n&&n;"closeLinear"===e&&!this.trackingEvents[e]&&this.trackingEvents.close&&(e="close");var s=this.trackingEvents[e],o=this.emitAlwaysEvents.indexOf(e)>-1;s?(this.emit(e,{trackingURLTemplates:s}),this.trackURLs(s,r)):o&&this.emit(e,null),a&&(delete this.trackingEvents[e],o&&this.emitAlwaysEvents.splice(this.emitAlwaysEvents.indexOf(e),1))}},{key:"trackURLs",value:function(e){var t,r,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=i({},arguments.length>1&&void 0!==arguments[1]?arguments[1]:{});this.linear&&(this.creative&&this.creative.mediaFiles&&this.creative.mediaFiles[0]&&this.creative.mediaFiles[0].fileURL&&(a.ASSETURI=this.creative.mediaFiles[0].fileURL),this.progress&&(a.ADPLAYHEAD=this.progressFormatted())),null!==(t=this.creative)&&void 0!==t&&null!==(r=t.universalAdIds)&&void 0!==r&&r.length&&(a.UNIVERSALADID=this.creative.universalAdIds.map((function(e){return e.idRegistry.concat(" ",e.value)})).join(",")),this.ad&&(this.ad.sequence&&(a.PODSEQUENCE=this.ad.sequence),this.ad.adType&&(a.ADTYPE=this.ad.adType),this.ad.adServingId&&(a.ADSERVINGID=this.ad.adServingId),this.ad.categories&&this.ad.categories.length&&(a.ADCATEGORIES=this.ad.categories.map((function(e){return e.value})).join(",")),this.ad.blockedAdCategories&&this.ad.blockedAdCategories.length&&(a.BLOCKEDADCATEGORIES=this.ad.blockedAdCategories)),C.track(e,a,n)}},{key:"convertToTimecode",value:function(e){var t=1e3*e,i=Math.floor(t/36e5),r=Math.floor(t/6e4%60),n=Math.floor(t/1e3%60),a=Math.floor(t%1e3);return"".concat(C.leftpad(i,2),":").concat(C.leftpad(r,2),":").concat(C.leftpad(n,2),".").concat(C.leftpad(a,3))}},{key:"progressFormatted",value:function(){return this.convertToTimecode(this.progress)}}]),r}(X);e.VASTClient=ce,e.VASTParser=oe,e.VASTTracker=he,Object.defineProperty(e,"__esModule",{value:!0})}(t)}},t={};function i(r){var n=t[r];if(void 0!==n)return n.exports;var a=t[r]={exports:{}};return e[r].call(a.exports,a,a.exports,i),a.exports}i.d=(e,t)=>{for(var r in t)i.o(t,r)&&!i.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var r={};(()=>{i.d(r,{h:()=>a});var e=i(686);const t=function(e,t,i){this.errorCode=e,this.message=t,this.innerError=i};t.prototype.getErrorCode=function(){return this.errorCode},t.prototype.getMessage=function(){return this.message},t.prototype.getInnerError=function(){return this.innerError instanceof Object?this.innerError:null},t.prototype.formatMessage=function(...e){return this.message=function(e,...t){try{t.forEach(((t,i)=>{e=e.replace(new RegExp("\\{"+i+"}","g"),t)}))}catch(e){}return e}(this.message,e),this},t.prototype.toString=function(){return"AdError "+this.getErrorCode()+": "+this.getMessage()+(null!=this.getInnerError()?" Caused by: "+this.getInnerError():"")};const n=t,a=function(e){if(!(e instanceof Element||e instanceof HTMLDocument))throw new Error("ad container is not defined");this._adContainer=e,this._slot=null,this._videoSlot=null,this.createSlot(),this.EVENTS={AdsManagerLoaded:"AdsManagerLoaded",AdStarted:"AdStarted",AdStopped:"AdStopped",AdSkipped:"AdSkipped",AdLoaded:"AdLoaded",AdLinearChange:"AdLinearChange",AdSizeChange:"AdSizeChange",AdExpandedChange:"AdExpandedChange",AdSkippableStateChange:"AdSkippableStateChange",AdDurationChange:"AdDurationChange",AdRemainingTimeChange:"AdRemainingTimeChange",AdVolumeChange:"AdVolumeChange",AdImpression:"AdImpression",AdClickThru:"AdClickThru",AdInteraction:"AdInteraction",AdVideoStart:"AdVideoStart",AdVideoFirstQuartile:"AdVideoFirstQuartile",AdVideoMidpoint:"AdVideoMidpoint",AdVideoThirdQuartile:"AdVideoThirdQuartile",AdVideoComplete:"AdVideoComplete",AdUserAcceptInvitation:"AdUserAcceptInvitation",AdUserMinimize:"AdUserMinimize",AdUserClose:"AdUserClose",AdPaused:"AdPaused",AdPlaying:"AdPlaying",AdError:"AdError",AdLog:"AdLog",AllAdsCompleted:"AllAdsCompleted"},this._eventCallbacks={},this._creativeEventCallbacks={},this._attributes={width:300,height:154,viewMode:"normal",desiredBitrate:268,duration:10,remainingTime:10,currentTime:0,volume:0,version:"1.1.4"},this._quartileEvents=[{event:"AdImpression",value:0},{event:"AdVideoStart",value:0},{event:"AdVideoFirstQuartile",value:25},{event:"AdVideoMidpoint",value:50},{event:"AdVideoThirdQuartile",value:75},{event:"AdVideoComplete",value:100}],this._nextQuartileIndex=0,this._defaultEventCallbacks={AdImpression:this.onAdImpression.bind(this),AdVideoStart:this.onAdVideoStart.bind(this),AdVideoFirstQuartile:this.onAdVideoFirstQuartile.bind(this),AdVideoMidpoint:this.onAdVideoMidpoint.bind(this),AdVideoThirdQuartile:this.onAdVideoThirdQuartile.bind(this),AdVideoComplete:this.onAdVideoComplete.bind(this)},this._options={autoplay:!0,muted:!0,vastLoadTimeout:23e3,loadVideoTimeout:8e3,withCredentials:!1,wrapperLimit:10,resolveAll:!0},this.ERROR_CODES={ADS_REQUEST_NETWORK_ERROR:1012,FAILED_TO_REQUEST_ADS:1005,UNKNOWN_AD_RESPONSE:1010,VAST_ASSET_NOT_FOUND:1007,VAST_EMPTY_RESPONSE:1009,VAST_LINEAR_ASSET_MISMATCH:403,VAST_LOAD_TIMEOUT:301,VAST_MEDIA_LOAD_TIMEOUT:402,VIDEO_PLAY_ERROR:400,VPAID_ERROR:901},this.ERROR_MESSAGES={ADS_REQUEST_ERROR:"Unable to request ads from server. Cause: {0}.",ADS_REQUEST_NETWORK_ERROR:"Unable to request ads from server due to network error.",FAILED_TO_REQUEST_ADS:"The was a problem requesting ads from the server.",NO_ADS_FOUND:"The response does not contain any valid ads.",UNKNOWN_AD_RESPONSE:"The ad response was not understood and cannot be parsed.",VAST_ASSET_NOT_FOUND:"No assets were found in the VAST ad response.",VAST_EMPTY_RESPONSE:"The VAST response document is empty.",VAST_LINEAR_ASSET_MISMATCH:"Linear assets were found in the VAST ad response, but none of them matched the player's capabilities.",VAST_LOAD_TIMEOUT:"Ad request reached a timeout.",VAST_MEDIA_LOAD_TIMEOUT:"VAST media file loading reached a timeout of {0} seconds.",VIDEO_PLAY_ERROR:"There was an error playing the video ad.",VPAID_CREATIVE_ERROR:"An unexpected error occurred within the VPAID creative. Refer to the inner error for more info."},this.ERRORS={VAST_EMPTY_RESPONSE:new n(this.ERROR_CODES.VAST_EMPTY_RESPONSE,this.ERROR_MESSAGES.VAST_EMPTY_RESPONSE),VAST_ASSET_NOT_FOUND:new n(this.ERROR_CODES.VAST_ASSET_NOT_FOUND,this.ERROR_MESSAGES.VAST_ASSET_NOT_FOUND),VAST_LINEAR_ASSET_MISMATCH:new n(this.ERROR_CODES.VAST_LINEAR_ASSET_MISMATCH,this.ERROR_MESSAGES.VAST_LINEAR_ASSET_MISMATCH),VAST_LOAD_TIMEOUT:new n(this.ERROR_CODES.VAST_LOAD_TIMEOUT,this.ERROR_MESSAGES.VAST_LOAD_TIMEOUT),VAST_MEDIA_LOAD_TIMEOUT:new n(this.ERROR_CODES.VAST_MEDIA_LOAD_TIMEOUT,this.ERROR_MESSAGES.VAST_MEDIA_LOAD_TIMEOUT),VIDEO_PLAY_ERROR:new n(this.ERROR_CODES.VIDEO_PLAY_ERROR,this.ERROR_MESSAGES.VIDEO_PLAY_ERROR)},this._vastClient=null,this._vastParser=null,this._vastTracker=null,this._ad=null,this._adPod=null,this._creative=null,this._mediaFiles=null,this._mediaFileIndex=0,this._mediaFile=null,this._isVPAID=!1,this._vpaidCreative=null,this._vastMediaLoadTimeoutId=null,this._vpaidProgressCounter=null,this.SUPPORTED_CREATIVE_VPAID_VERSION_MIN=2,this._hasLoaded=!1,this._hasError=!1,this._hasImpression=!1,this._hasStarted=!1};a.prototype.createSlot=function(){this._slot=document.createElement("div"),this._slot.style.position="absolute",this._slot.style.display="none",this._adContainer.appendChild(this._slot),this.createVideoSlot()},a.prototype.removeSlot=function(){this._slot.parentNode.removeChild(this._slot),this.createSlot()},a.prototype.showSlot=function(){""===this._videoSlot.src&&this.hideVideoSlot(),this._slot.style.display="block"},a.prototype.resizeSlot=function(e,t){this._slot.style.width=e+"px",this._slot.style.height=t+"px"},a.prototype.createVideoSlot=function(){this._videoSlot=document.createElement("video"),this._videoSlot.setAttribute("webkit-playsinline",!0),this._videoSlot.setAttribute("playsinline",!0),this._videoSlot.style.width="100%",this._videoSlot.style.height="100%",this._videoSlot.style.backgroundColor="rgb(0, 0, 0)",this._slot.appendChild(this._videoSlot)},a.prototype.hideVideoSlot=function(){this._videoSlot.style.display="none"},a.prototype.stopVASTMediaLoadTimeout=function(){this._vastMediaLoadTimeoutId&&(clearTimeout(this._vastMediaLoadTimeoutId),this._vastMediaLoadTimeoutId=null)},a.prototype.startVASTMediaLoadTimeout=function(){this.stopVASTMediaLoadTimeout(),this._vastMediaLoadTimeoutId=setTimeout((()=>{this.onAdError(this.ERRORS.VAST_MEDIA_LOAD_TIMEOUT.formatMessage(this._options.loadVideoTimeout))}),this._options.loadVideoTimeout)},a.prototype.updateVPAIDProgress=function(){this._attributes.remainingTime=this._isCreativeFunctionInvokable("getAdRemainingTime")?this._vpaidCreative.getAdRemainingTime():-1,isNaN(this._attributes.remainingTime)||1===this._attributes.remainingTime||(this._attributes.currentTime=this._attributes.duration-this._attributes.remainingTime,this._vastTracker.setProgress(this._attributes.currentTime))},a.prototype.startVPAIDProgress=function(){this.stopVPAIDProgress(),this._vpaidProgressCounter=setInterval((()=>{this._isVPAID&&this._vpaidCreative&&this._vastTracker?this.updateVPAIDProgress():this.stopVPAIDProgress()}),1e3)},a.prototype.stopVPAIDProgress=function(){this._vpaidProgressCounter&&(clearInterval(this._vpaidProgressCounter),this._vpaidProgressCounter=null)},a.prototype.addEventListener=function(e,t,i){const r=t.bind(i);this._eventCallbacks[e]=r},a.prototype.removeEventListener=function(e){this._eventCallbacks[e]=null},a.prototype.onAdsManagerLoaded=function(){this.EVENTS.AdsManagerLoaded in this._eventCallbacks&&"function"==typeof this._eventCallbacks[this.EVENTS.AdsManagerLoaded]&&this._eventCallbacks[this.EVENTS.AdsManagerLoaded]()},a.prototype.onAdLoaded=function(){this.stopVASTMediaLoadTimeout(),this.EVENTS.AdLoaded in this._eventCallbacks&&"function"==typeof this._eventCallbacks[this.EVENTS.AdLoaded]&&this._eventCallbacks[this.EVENTS.AdLoaded](this._creative)},a.prototype.onAdDurationChange=function(){this._isVPAID&&this._vpaidCreative&&this._vastTracker&&(this._attributes.duration=this._isCreativeFunctionInvokable("getAdDuration")?this._vpaidCreative.getAdDuration():-1,-1!==this._attributes.duration&&this._vastTracker.setDuration(this._attributes.duration)),this.EVENTS.AdDurationChange in this._eventCallbacks&&"function"==typeof this._eventCallbacks[this.EVENTS.AdDurationChange]&&this._eventCallbacks[this.EVENTS.AdDurationChange]()},a.prototype.onAdSizeChange=function(){this.EVENTS.AdSizeChange in this._eventCallbacks&&"function"==typeof this._eventCallbacks[this.EVENTS.AdSizeChange]&&this._eventCallbacks[this.EVENTS.AdSizeChange]()},a.prototype.onAdStarted=function(){this.showSlot(),this.EVENTS.AdStarted in this._eventCallbacks&&"function"==typeof this._eventCallbacks[this.EVENTS.AdStarted]&&this._eventCallbacks[this.EVENTS.AdStarted]()},a.prototype.onAdVideoStart=function(){this._isVPAID&&this._vpaidCreative&&this._vastTracker&&this.updateVPAIDProgress(),this.EVENTS.AdVideoStart in this._eventCallbacks&&"function"==typeof this._eventCallbacks[this.EVENTS.AdVideoStart]&&this._eventCallbacks[this.EVENTS.AdVideoStart]()},a.prototype.onAdStopped=function(){this.EVENTS.AdStopped in this._eventCallbacks&&"function"==typeof this._eventCallbacks[this.EVENTS.AdStopped]&&this._eventCallbacks[this.EVENTS.AdStopped](),this.destroyAd()},a.prototype.onAdSkipped=function(){this.EVENTS.AdSkipped in this._eventCallbacks&&"function"==typeof this._eventCallbacks[this.EVENTS.AdSkipped]&&this._eventCallbacks[this.EVENTS.AdSkipped](),this.destroyAd()},a.prototype.onAdVolumeChange=function(){this.EVENTS.AdVolumeChange in this._eventCallbacks&&"function"==typeof this._eventCallbacks[this.EVENTS.AdVolumeChange]&&this._eventCallbacks[this.EVENTS.AdVolumeChange]()},a.prototype.onAdImpression=function(){this._isVPAID&&this._vpaidCreative&&this._vastTracker&&(this._hasImpression||(this._attributes.duration=this._isCreativeFunctionInvokable("getAdDuration")?this._vpaidCreative.getAdDuration():-1,-1!==this._attributes.duration&&this._vastTracker.setDuration(this._attributes.duration),this._vastTracker.trackImpression(),this.startVPAIDProgress(),this._hasImpression=!0)),this.EVENTS.AdImpression in this._eventCallbacks&&"function"==typeof this._eventCallbacks[this.EVENTS.AdImpression]&&this._eventCallbacks[this.EVENTS.AdImpression]()},a.prototype.onAdClickThru=function(e,t,i){this._isVPAID&&this._vpaidCreative&&this._vastTracker&&this._vastTracker.click(),this.EVENTS.AdClickThru in this._eventCallbacks&&"function"==typeof this._eventCallbacks[this.EVENTS.AdClickThru]&&this._eventCallbacks[this.EVENTS.AdClickThru](e,t,i)},a.prototype.onAdVideoFirstQuartile=function(){this._isVPAID&&this._vpaidCreative&&this._vastTracker&&this.updateVPAIDProgress(),this.EVENTS.AdVideoFirstQuartile in this._eventCallbacks&&"function"==typeof this._eventCallbacks[this.EVENTS.AdVideoFirstQuartile]&&this._eventCallbacks[this.EVENTS.AdVideoFirstQuartile]()},a.prototype.onAdVideoMidpoint=function(){this._isVPAID&&this._vpaidCreative&&this._vastTracker&&this.updateVPAIDProgress(),this.EVENTS.AdVideoMidpoint in this._eventCallbacks&&"function"==typeof this._eventCallbacks[this.EVENTS.AdVideoMidpoint]&&this._eventCallbacks[this.EVENTS.AdVideoMidpoint]()},a.prototype.onAdVideoThirdQuartile=function(){this._isVPAID&&this._vpaidCreative&&this._vastTracker&&this.updateVPAIDProgress(),this.EVENTS.AdVideoThirdQuartile in this._eventCallbacks&&"function"==typeof this._eventCallbacks[this.EVENTS.AdVideoThirdQuartile]&&this._eventCallbacks[this.EVENTS.AdVideoThirdQuartile]()},a.prototype.onAdPaused=function(){this._vastTracker&&this._vastTracker.setPaused(!0),this.EVENTS.AdPaused in this._eventCallbacks&&"function"==typeof this._eventCallbacks[this.EVENTS.AdPaused]&&this._eventCallbacks[this.EVENTS.AdPaused]()},a.prototype.onAdPlaying=function(){this._vastTracker&&this._vastTracker.setPaused(!1),this.EVENTS.AdPlaying in this._eventCallbacks&&"function"==typeof this._eventCallbacks[this.EVENTS.AdPlaying]&&this._eventCallbacks[this.EVENTS.AdPlaying]()},a.prototype.onAdVideoComplete=function(){this._isVPAID&&this._vpaidCreative&&this._vastTracker&&this._vastTracker.complete(),this.EVENTS.AdVideoComplete in this._eventCallbacks&&"function"==typeof this._eventCallbacks[this.EVENTS.AdVideoComplete]&&this._eventCallbacks[this.EVENTS.AdVideoComplete]()},a.prototype.onAllAdsCompleted=function(){this.EVENTS.AllAdsCompleted in this._eventCallbacks&&"function"==typeof this._eventCallbacks[this.EVENTS.AllAdsCompleted]&&this._eventCallbacks[this.EVENTS.AllAdsCompleted]()},a.prototype.onAdError=function(e){this._hasError=!0,this.stopVASTMediaLoadTimeout(),this.stopVPAIDProgress(),this.EVENTS.AdError in this._eventCallbacks&&"function"==typeof this._eventCallbacks[this.EVENTS.AdError]&&this._eventCallbacks[this.EVENTS.AdError](e)},a.prototype.onAdLog=function(e){this.EVENTS.AdLog in this._eventCallbacks&&"function"==typeof this._eventCallbacks[this.EVENTS.AdLog]&&this._eventCallbacks[this.EVENTS.AdLog](e)},a.prototype.processVASTResponse=function(t){const i=t.ads;0!=i.length?(i.length>1?(this._adPod=i.sort((function(e,t){let i=e.sequence,r=t.sequence;return i===r?0:null===i?1:null===r||ir?1:0})),this._ad=i[0]):this._ad=i[0],this._ad&&(this._creative=i[0].creatives.filter((e=>"linear"===e.type))[0],this._creative&&(0!=this._creative.mediaFiles.length?(this._mediaFiles=this._creative.mediaFiles.filter((e=>this.canPlayVideoType(e.mimeType)||"application/javascript"===e.mimeType?e:void 0)),this._mediaFiles.sort((function(e,t){let i=e.height,r=t.height;return ir?1:0})),this._mediaFiles&&0!=this._mediaFiles.length?(this._vastTracker=new e.VASTTracker(null,this._ad,this._creative),this._vastTracker.load(),this.onAdsManagerLoaded()):this.onAdError(this.ERRORS.VAST_LINEAR_ASSET_MISMATCH)):this.onAdError(this.ERRORS.VAST_ASSET_NOT_FOUND)))):this.onAdError(this.ERRORS.VAST_EMPTY_RESPONSE)},a.prototype.requestAds=function(t,i={}){Object.assign(this._options,i);const r={timeout:this._options.vastLoadTimeout,withCredentials:this._options.withCredentials,wrapperLimit:this._options.wrapperLimit,resolveAll:this._options.resolveAll};if(this.destroy(),t&&"string"==typeof t){let i=!1;try{new URL(t),i=!0}catch(e){}if(i)this._vastClient=new e.VASTClient,this._vastClient.get(t,r).then((e=>{this.processVASTResponse(e)})).catch((e=>{this.onAdError(e.message)}));else{const i=(new window.DOMParser).parseFromString(t,"text/xml");this._vastParser=new e.VASTParser,this._vastParser.parseVAST(i,r).then((e=>{this.processVASTResponse(e)})).catch((e=>{this.onAdError(e.message)}))}}else this.onAdError("VAST URL/XML is empty")},a.prototype.canPlayVideoType=function(e){return!("video/3gpp"!==e||!this.supportsThreeGPVideo())||(!("video/webm"!==e||!this.supportsWebmVideo())||(!("video/ogg"!==e||!this.supportsOggTheoraVideo())||!("video/mp4"!==e||!this.supportsH264BaselineVideo())))},a.prototype.supportsVideo=function(){return!!document.createElement("video").canPlayType},a.prototype.supportsH264BaselineVideo=function(){return!!this.supportsVideo()&&document.createElement("video").canPlayType('video/mp4; codecs="avc1.42E01E, mp4a.40.2"')},a.prototype.supportsOggTheoraVideo=function(){return!!this.supportsVideo()&&document.createElement("video").canPlayType('video/ogg; codecs="theora, vorbis"')},a.prototype.supportsWebmVideo=function(){return!!this.supportsVideo()&&document.createElement("video").canPlayType('video/webm; codecs="vp8, vorbis"')},a.prototype.supportsThreeGPVideo=function(){return!!this.supportsVideo()&&document.createElement("video").canPlayType('video/3gpp; codecs="mp4v.20.8, samr"')},a.prototype.handshakeVersion=function(e){return this._vpaidCreative.handshakeVersion(e)},a.prototype._isCreativeFunctionInvokable=function(e){return!!this._vpaidCreative&&((e=this._vpaidCreative[e])&&"function"==typeof e)},a.prototype.checkVPAIDInterface=function(e){const t={passed:!0,missingInterfaces:""};for(let i=e.length-1;0<=i;i--)this._isCreativeFunctionInvokable(e[i])||(t.passed=!1,t.missingInterfaces+=e[i]+" ");return t},a.prototype.setCallbacksForCreative=function(e,t){for(const i in e)e.hasOwnProperty(i)&&this._vpaidCreative.subscribe(e[i],i,t)},a.prototype.removeCallbacksForCreative=function(e){for(const t in e)e.hasOwnProperty(t)&&this._vpaidCreative.unsubscribe(t)},a.prototype.creativeAssetLoaded=function(){if(function(e){const t=e.checkVPAIDInterface("handshakeVersion initAd startAd stopAd subscribe unsubscribe getAdLinear".split(" "));return t.passed||e.onAdError("Missing interfaces in the VPAID creative: "+t.missingInterfaces),t.passed}(this)&&(()=>{const e=this.handshakeVersion(this.SUPPORTED_CREATIVE_VPAID_VERSION_MIN.toFixed(1));return e?!(parseFloat(e)= "+this.SUPPORTED_CREATIVE_VPAID_VERSION_MIN.toFixed(1)),!1):(this.onAdError("Cannot get VPAID version from the creative"),!1)})()){this._creativeEventCallbacks={AdStarted:this.onAdStarted,AdStopped:this.onAdStopped,AdSkipped:this.onAdSkipped,AdLoaded:this.onAdLoaded,AdSizeChange:this.onAdSizeChange,AdDurationChange:this.onAdDurationChange,AdVolumeChange:this.onAdVolumeChange,AdImpression:this.onAdImpression,AdClickThru:this.onAdClickThru,AdVideoStart:this.onAdVideoStart,AdVideoFirstQuartile:this.onAdVideoFirstQuartile,AdVideoMidpoint:this.onAdVideoMidpoint,AdVideoThirdQuartile:this.onAdVideoThirdQuartile,AdVideoComplete:this.onAdVideoComplete,AdPaused:this.onAdPaused,AdPlaying:this.onAdPlaying,AdError:this.onAdError,AdLog:this.onAdLog},this.setCallbacksForCreative(this._creativeEventCallbacks,this);const e=this._attributes.width,t=this._attributes.height,i={AdParameters:this._creative.adParameters},r={slot:this._slot,videoSlot:this._videoSlot,videoSlotCanAutoPlay:!0};this.startVASTMediaLoadTimeout(),this._vpaidCreative.initAd(e,t,this._attributes.viewMode,this._attributes.desiredBitrate,i,r)}},a.prototype.loadCreativeAsset=function(e){const t=document.getElementById("vpaidIframe"),i=document.createElement("iframe");i.id="vpaidIframe",null==t?this._adContainer.appendChild(i):this._adContainer.replaceChild(i,t),i.width=0,i.height=0,i.style.display="none",i.setAttribute("allowfullscreen",""),i.setAttribute("sandbox","allow-scripts allow-same-origin"),i.setAttribute("allow","autoplay;"),i.tabIndex=-1,i.contentWindow.document.open(),i.contentWindow.document.write('