!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).VideoBillboardVmaxAd=t()}(this,(function(){"use strict";function e(e,t,i,n){return new(i||(i=Promise))((function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((n=n.apply(e,t||[])).next())}))}function t(e,t,i,n){if("a"===i&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?n:"a"===i?n.call(e):n?n.value:t.get(e)}function i(e,t,i,n,r){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?r.call(e,i):r?r.value=i:t.set(e,i),i}function n(e,t){return r(e,t)||t}function r(e,t){const i=navigator.userAgent.match(/Android/i),n=navigator.userAgent.match(/Chrome/i);if(!(e&&i&&n))return!1;const r=function(e,t){try{const i=e.split("://"),n=i[0];return`intent://${i[1]}/#Intent;scheme=${n};S.browser_fallback_url=${t||""};end`}catch(e){return!1}}(e,t);return r||!1}var s;"function"==typeof SuppressedError&&SuppressedError,function(e){e.WRAPPER="[vmax-default-instream-video]",e.REMAINING_TIME='[ad="vmax_video_remaining_time"]',e.MUTE_UNMUTE='[ad="vmax_video_volume_icon"]',e.PLAY_PAUSE='[ad="vmax_video_playback_icon"]',e.SKIP='[ad="vmax_video_skip_button"]',e.PROGRESS_BAR='[ad="vmax_video_progresscount"]',e.SKIP_COUNTER='[ad="vmax_video_skip_counter"]',e.SKIP_THUMBNAIL='img[ad="vmax_video_skip_thumbnail"]',e.CTA='[ad="vmax_video_cta"]',e.FULLSCREEN='[ad="vmax_video_resize_icon"]'}(s||(s={}));var o=s;function a(e){const{layout:t,layoutTemplate:i,defaultLayout:n,containerId:r=""}=e,s=i instanceof HTMLTemplateElement&&"TEMPLATE"===i.nodeName,o="string"==typeof t&&t.length>0,a="string"==typeof n&&n.length>0;if(!s&&!o&&!a)throw new Error("No layout or Invalid provided");const d=s?function(e,t){const i=document.createElement("div");return i.id=t,i.style.position="relative",i.style.width="100%",i.style.height="100%",i.appendChild(e.content.cloneNode(!0)),i}(i,r):function(e,t){const i=document.createElement("div");i.innerHTML=e;const n=document.createElement("div");return n.id=t,n.style.position="relative",n.style.width="100%",n.style.height="100%",i.childNodes.forEach((e=>{e instanceof HTMLElement&&(null==n||n.appendChild(e))})),n}(t||n||"",r);return[d,l(d)]}function l(e){const{PLAY_PAUSE:t,MUTE_UNMUTE:i,SKIP:n,REMAINING_TIME:r,PROGRESS_BAR:s,CTA:a,FULLSCREEN:l,SKIP_COUNTER:d,SKIP_THUMBNAIL:h,WRAPPER:c}=o;return{container:e,wrapper:e.querySelector(c),playPause:e.querySelector(t),muteUnmute:e.querySelector(i),skip:e.querySelector(n),remainingTime:e.querySelector(r),progressBar:e.querySelector(s),cta:e.querySelector(a),fullscreen:e.querySelector(l),skipCounter:e.querySelector(d),skipThumbnail:e.querySelector(h)}}function d(...e){console.error.apply(console,e)}var h,c,u,f,v,p,m,E,A,g,R,y,w,T,b,k,I;class C{constructor(e){var n;(h.add(this),c.set(this,void 0),u.set(this,void 0),f.set(this,[]),v.set(this,[]),p.set(this,[]),m.set(this,[]),E.set(this,"hidden"),A.set(this,null),g.set(this,null),R.set(this,!0),y.set(this,null),e instanceof HTMLElement)?(i(this,c,(n=t(this,h,"m",w).bind(this),new IntersectionObserver(n,{root:null,rootMargin:"0px",threshold:.5})),"f"),i(this,u,e,"f"),t(this,c,"f").observe(e),i(this,E,function(e){let t="hidden",i="visibilitychange";const n=window.document;return void 0!==n[t]?(t="hidden",i="visibilitychange"):void 0!==n.msHidden?(t="msHidden",i="msvisibilitychange"):void 0!==n.webkitHidden?(t="webkitHidden",i="webkitvisibilitychange"):void 0!==n.oHidden?(t="oHidden",i="ovisibilitychange"):void 0!==n.mozHidden?(t="mozHidden",i="mozvisibilitychange"):void 0!==n.khtmlHidden&&(t="khtmlHidden",i="khtmlvisibilitychange"),n.addEventListener(i,e,!0),t}(t(this,h,"m",T).bind(this)),"f"),function(e){window.addEventListener("focus",e),window.addEventListener("pageshow",e)}(t(this,h,"m",b).bind(this)),function(e){window.addEventListener("blur",e),window.addEventListener("pagehide",e)}(t(this,h,"m",k).bind(this)),this.check()):function(...e){console.warn.apply(console,e)}("Container must be a valid HTMLElement")}destroy(){var e;null===(e=t(this,c,"f"))||void 0===e||e.unobserve(t(this,u,"f")),i(this,f,[],"f"),i(this,v,[],"f"),i(this,p,[],"f"),i(this,m,[],"f"),i(this,A,null,"f"),i(this,g,null,"f"),i(this,R,null,"f"),clearInterval(t(this,y,"f"))}check(){t(this,h,"m",T).call(this)}enter(e){if("function"!=typeof e)throw new Error("Callback must be a function");return t(this,f,"f").push(e),this}exit(e){if("function"!=typeof e)throw new Error("Callback must be a function");return t(this,v,"f").push(e),this}enterOnce(e){if("function"!=typeof e)throw new Error("Callback must be a function");return t(this,p,"f").push(e),this}exitOnce(e){if("function"!=typeof e)throw new Error("Callback must be a function");return t(this,m,"f").push(e),this}}c=new WeakMap,u=new WeakMap,f=new WeakMap,v=new WeakMap,p=new WeakMap,m=new WeakMap,E=new WeakMap,A=new WeakMap,g=new WeakMap,R=new WeakMap,y=new WeakMap,h=new WeakSet,w=function(e){var n;const r=null===(n=null==e?void 0:e[0])||void 0===n?void 0:n.isIntersecting;"boolean"==typeof r&&(i(this,A,!0===r,"f"),t(this,h,"m",I).call(this))},T=function(){const e=window.document;i(this,g,!1===(null==e?void 0:e[t(this,E,"f")])||"visible"===(null==e?void 0:e.visibilityState),"f"),t(this,h,"m",I).call(this)},b=function(){i(this,g,!0,"f"),t(this,h,"m",I).call(this)},k=function(){const e=window.document;clearInterval(t(this,y,"f")),i(this,y,setTimeout((()=>{!1===(!1===(null==e?void 0:e[t(this,E,"f")])||"visible"===(null==e?void 0:e.visibilityState))&&(i(this,g,!1,"f"),t(this,h,"m",I).call(this))}),1),"f")},I=function(){const e=t(this,A,"f")&&t(this,g,"f");if(t(this,R,"f")===e)return;const n=t(this,A,"f")&&t(this,g,"f"),r=t(this,n?f:v,"f"),s=t(this,n?p:m,"f");r.forEach((e=>e())),s.forEach((e=>e())),i(this,n?p:m,[],"f"),i(this,R,e,"f")};const S=Object.freeze({XML_PARSING_ERROR:{code:100,message:"XML parsing error."},VAST_SCHEMA_VALIDATION_ERROR:{code:101,message:"VAST schema validation error."},VAST_VERSION_NOT_SUPPORTED:{code:102,message:"VAST version of response not supported."},TRAFFICKING_ERROR:{code:200,message:"Video player received an Ad type that it was not expecting and/or cannot display."},LINEARITY_ERROR:{code:201,message:"Video player expecting different linearity."},DURATION_ERROR:{code:202,message:"Video player expecting different duration."},SIZE_ERROR:{code:203,message:"Video player expecting different size."},GENERAL_WRAPPER_ERROR:{code:300,message:"General Wrapper error."},TIMEOUT_ERROR:{code:301,message:"Timeout of VAST URI provided in Wrapper element, or of VAST URI provided in a subsequent Wrapper element. (URI was either unavailable or reached a timeout as defined by the video player.)"},WRAPPER_LIMIT_ERROR:{code:302,message:"Wrapper limit reached, as defined by the video player. Too many Wrapper responses have been received with no InLine response."},NO_ADS_ERROR:{code:303,message:"No Ads VAST response after one or more Wrappers."},INLINE_TIMEOUT_ERROR:{code:304,message:"InLine response returned ad unit that failed to result in ad display within defined time limit."},GENERAL_LINEAR_ERROR:{code:400,message:"General Linear error. Video player is unable to display the Linear Ad."},FILE_NOT_FOUND_ERROR:{code:401,message:"File not found. Unable to find Linear/MediaFile from URI."},MEDIAFILE_TIMEOUT_ERROR:{code:402,message:"Video Prepare failed because of Media Timeout"},MEDIAFILE_UNSUPPORTED_ERROR:{code:403,message:"Couldn't find MediaFile that is supported by this video player, based on the attributes of the MediaFile element."},MEDIAFILE_DISPLAY_ERROR:{code:405,message:"Problem displaying MediaFile. Video player found a MediaFile with supported type but couldn't display it. MediaFile may include: unsupported codecs, different MIME type than MediaFile@type, unsupported delivery method, etc."},GENERAL_NONLINEAR_ERROR:{code:500,message:"General NonLinearAds error."},NONLINEAR_SIZE_ERROR:{code:501,message:"Unable to display NonLinear Ad because creative dimensions do not align with creative display area (i.e. creative dimension too large)."},NONLINEAR_RESOURCE_ERROR:{code:502,message:"Unable to fetch NonLinearAds/NonLinear resource."},NONLINEAR_UNSUPPORTED_ERROR:{code:503,message:"Couldn't find NonLinear resource with supported type."},GENERAL_COMPANION_ERROR:{code:600,message:"General CompanionAds error."},COMPANION_SIZE_ERROR:{code:601,message:"Unable to display Companion because creative dimensions do not fit within Companion display area (i.e., no available space)."},REQUIRED_COMPANION_ERROR:{code:602,message:"Unable to display Required Companion."},COMPANION_RESOURCE_ERROR:{code:603,message:"Unable to fetch CompanionAds/Companion resource."},COMPANION_UNSUPPORTED_ERROR:{code:604,message:"Couldn't find Companion resource with supported type."},UNDEFINED_ERROR:{code:900,message:"Undefined Error."}});function M(e,t){const i=e.filter((e=>"application/x-mpegURL"===e.type));if(i.length>0){return i[Math.floor(Math.random()*i.length)]}const n=e.filter((e=>"video/mp4"===e.type));if(0===n.length)return null;if(t){return n.reduce(((e,i)=>Math.abs(parseInt(i.bitrate)-t)(e.textContent||"").trim()))}function O(e,t,i){var n;return null===e?"":((null===(n=e.querySelector(t||""))||void 0===n?void 0:n.getAttribute(i))||"").trim()}function L(e){if(null===e)return[];return Array.from(e.querySelectorAll("MediaFile")).map((e=>({delivery:(e.getAttribute("delivery")||"").trim(),type:(e.getAttribute("type")||"").trim(),width:(e.getAttribute("width")||"").trim(),height:(e.getAttribute("height")||"").trim(),bitrate:(e.getAttribute("bitrate")||"").trim(),url:(e.textContent||"").trim()})))}function U(e){if(null===e)return{};return Array.from(e.querySelectorAll("Tracking")).reduce(((e,t)=>{const i=(t.getAttribute("event")||"").trim(),n=(t.textContent||"").trim();return i&&n&&(e[i]||(e[i]=[]),e[i].push(n)),e}),{})}function N(e){if(null===e)return"";return Array.from(e.querySelectorAll("Verification")).map((e=>{const t=(e.getAttribute("vendor")||"").trim(),i={verificationScriptUrl:"",vendorKey:"",verificationParameters:""};i.vendorKey=t;const n=e.querySelector("JavaScriptResource")||"",r=e.querySelector("VerificationParameters")||"";let s;try{s=r&&r.textContent||""}catch(e){return console.warn("invalid verification parameters"),null}return i.verificationScriptUrl=n&&(null==n?void 0:n.textContent)||"",i.verificationParameters=s||"",i})).filter(Boolean)}function D(e){let t={companions:[],companionResourceUrls:[]};if(null===e)return t;const i=e.querySelector("CompanionAds")||null;if(null===i)return t;const n=Array.from(i.querySelectorAll("Companion")||[]);if(0===n.length)return t;for(let e=0;et(this,Q,"f").abort()),t(this,W,"f")),"f");return fetch(n,{signal:e}).then((e=>e.ok&&e.text()||Promise.reject(S.INLINE_TIMEOUT_ERROR))).catch((e=>"AbortError"===e.name?Promise.reject(S.TIMEOUT_ERROR):Promise.reject(S.NO_ADS_ERROR)))}))}}V=new WeakMap,Q=new WeakMap,F=new WeakMap,W=new WeakMap,H=new WeakMap,x=new WeakSet,J=function i(n){return e(this,void 0,void 0,(function*(){var e;try{const r=(new DOMParser).parseFromString(n,"application/xml");if(r.getElementsByTagName("parsererror").length>0)return Promise.reject(S.VAST_SCHEMA_VALIDATION_ERROR);if(function(e){var t;return null!==(null===(t=e.querySelector("Ad"))||void 0===t?void 0:t.querySelector("InLine"))}(r))t(this,x,"m",K).call(this,r);else{if(!function(e){var t,i,n;const r=null!==(null===(t=e.querySelector("Ad"))||void 0===t?void 0:t.querySelector("Wrapper")),s=((null===(n=null===(i=e.querySelector("Ad"))||void 0===i?void 0:i.querySelector("VASTAdTagURI"))||void 0===n?void 0:n.textContent)||"").trim();return r&&!!s}(r))return Promise.reject(S.UNDEFINED_ERROR);{t(this,x,"m",B).call(this,r);const n=((null===(e=r.querySelector("VASTAdTagURI"))||void 0===e?void 0:e.textContent)||"").trim();if(!1==!!n)return Promise.reject(S.XML_PARSING_ERROR);const s=yield this.fetchXmlFromUrl(n);yield t(this,x,"m",i).call(this,s)}}return Promise.resolve(t(this,V,"f"))}catch(e){return Promise.reject(S.UNDEFINED_ERROR)}}))},j=function(e){const i=Object.assign({},e);return i.error=[...t(this,V,"f").error,...e.error],i.impression=[...t(this,V,"f").impression,...e.impression],i.clickTracking=[...t(this,V,"f").clickTracking,...e.clickTracking],i.adVerification=[...t(this,V,"f").adVerification,...e.adVerification],i.trackingEvents=Array.from(Object.keys(e.trackingEvents)).reduce(((i,n)=>(i[n]||(i[n]=[]),i[n]=[...t(this,V,"f").trackingEvents[n],...e.trackingEvents[n]],i)),t(this,V,"f").trackingEvents),i.companions=[...t(this,V,"f").companions,...e.companions],i.companionResourceUrls=[...t(this,V,"f").companionResourceUrls,...e.companionResourceUrls],i},B=function(e){const n=e.querySelector("Ad"),r=D(n);return i(this,V,t(this,x,"m",j).call(this,Object.assign(Object.assign({},t(this,V,"f")),{error:_(n,"Error"),impression:_(n,"Impression"),clickTracking:_(n,"ClickTracking"),trackingEvents:U(n),adVerification:N(n),companions:r.companions,companionResourceUrls:r.companionResourceUrls})),"f"),!0},K=function(e){const n=e.querySelector("Ad"),r=D(n);return i(this,V,t(this,x,"m",j).call(this,Object.assign(Object.assign({},t(this,V,"f")),{adSystem:P(n,"AdSystem"),adTitle:P(n,"AdTitle"),description:P(n,"Description"),linear:{skipoffset:O(n,"Linear","skipoffset")},duration:P(n,"Duration"),clickThrough:P(n,"ClickThrough"),deepLinkUrl:P(n,"deeplinkurl"),mediaFiles:M(L(n),t(this,H,"f")),trackingEvents:U(n),adVerification:N(n),error:_(n,"Error"),impression:_(n,"Impression"),clickTracking:_(n,"ClickTracking"),companions:r.companions,companionResourceUrls:r.companionResourceUrls})),"f"),!0};class z{constructor(){G.set(this,new Map),Y.set(this,new Map)}addEventListener(e,i){var n;if("string"!=typeof e)throw new Error("Invalid Event");if("function"!=typeof i)throw new Error("Invalid Callback");t(this,G,"f").has(e)||t(this,G,"f").set(e,[]),null===(n=t(this,G,"f").get(e))||void 0===n||n.push(i)}addEventListenerOnce(e,i){var n;if("string"!=typeof e)throw new Error("Invalid Event");if("function"!=typeof i)throw new Error("Invalid Callback");t(this,Y,"f").has(e)||t(this,Y,"f").set(e,[]),null===(n=t(this,Y,"f").get(e))||void 0===n||n.push(i)}removeEventListener(e,i){var n,r;if("string"!=typeof e)throw new Error("Invalid Event");if("function"!=typeof i)throw new Error("Invalid Callback");if(!t(this,G,"f").has(e)&&!t(this,Y,"f").get(e))return;const s=t(this,G,"f").get(e),o=t(this,Y,"f").get(e),a=null!==(n=null==s?void 0:s.indexOf(i))&&void 0!==n?n:-1,l=null!==(r=null==o?void 0:o.indexOf(i))&&void 0!==r?r:-1;a>-1&&(null==s||s.splice(a,1)),l>-1&&(null==o||o.splice(l,1)),t(this,G,"f").set(e,s||[]),t(this,Y,"f").set(e,o||[]),-1===a&&-1===l&&console.warn("Eventlistener: Callback not found")}removeAllEventListeners(e){if("string"!=typeof e)throw new Error("Invalid Event");t(this,G,"f").has(e)&&t(this,G,"f").delete(e),t(this,Y,"f").has(e)&&t(this,Y,"f").delete(e)}dispatchEvent(e,...i){if("string"!=typeof e)throw new Error("Invalid Event");if(!t(this,G,"f").has(e)&&!t(this,Y,"f").get(e))return;const n=t(this,G,"f").get(e),r=t(this,Y,"f").get(e);null==n||n.forEach((e=>e(...i))),null==r||r.forEach((e=>e(...i))),t(this,Y,"f").set(e,[])}}G=new WeakMap,Y=new WeakMap;const Z=t=>e(void 0,void 0,void 0,(function*(){const i=new Event("long-pause");return new Promise(((n,r)=>e(void 0,void 0,void 0,(function*(){var e,s;if(!t)return r("Invalid meta");try{const{mediaUrl:o="",posterUrl:a="",loop:l=!1,volume:d=1,objectFit:h="contain",preload:c="auto",className:u=""}=t;if("string"!=typeof o||!o.trim())return r(S.MEDIAFILE_DISPLAY_ERROR);let f=null===(e=window.Hls)||void 0===e?void 0:e.isSupported();const v=null==o?void 0:o.includes(".m3u8");let p;const m=document.createElement("video");if(m.preload=c||"auto",m.volume=null!=d?d:1,m.setAttribute("playsinline","true"),m.setAttribute("webkit-playsinline","true"),m.setAttribute("loop",l.toString()),m.loop=l,m.setAttribute("preload",c),m.preload=c,m.style.objectFit=h||"contain",m.style.width="100%",m.style.height="100%",m.style.display="block",a.trim()&&(m.poster=a),u.trim()&&(m.className=u),v){if(f||(yield new Promise(((e,t)=>{const i=document.createElement("script");i.src="https://cdn.jsdelivr.net/npm/hls.js@1",i.addEventListener("load",(()=>e())),i.addEventListener("error",(()=>t())),document.head.appendChild(i)}))),f=null===(s=window.Hls)||void 0===s?void 0:s.isSupported(),!f)return r(S.MEDIAFILE_UNSUPPORTED_ERROR);p=new window.Hls({maxBufferLength:14,defaultAudioCodec:"mp4a.40.2",enableSoftwareAES:!1,enableWorker:!1}),p.loadSource(o),p.attachMedia(m),p.once(window.Hls.Events.MEDIA_ATTACHED,(()=>n({hls:p,video:m}))),p.once(window.Hls.Events.ERROR,((e,t)=>{if(t.fatal)switch(t.type){case window.Hls.ErrorTypes.MEDIA_ERROR:console.debug("VideoPlayer(warning): Fatal media error encountered, try to recover"),p.recoverMediaError();break;case window.Hls.ErrorTypes.NETWORK_ERROR:t.details===window.Hls.ErrorDetails.MANIFEST_LOAD_ERROR&&(console.debug("VideoPlayer: Fatal network error encountered. Cannot load primary manifest file."),r(S.MEDIAFILE_DISPLAY_ERROR));break;default:p.destroy(),console.debug("VideoPlayer: Cannot recover"),r(S.MEDIAFILE_UNSUPPORTED_ERROR)}}))}else m.src=o,n({hls:null,video:m});m.addEventListener("timeupdate",(()=>{clearTimeout(null==m?void 0:m._longPauseEventTimeout),m._longPauseEventTimeout=setTimeout((()=>{m.dispatchEvent(i)}),500)}))}catch(e){return r(e)}}))))}));var X,$,ee,te,ie,ne,re,se,oe,ae,le,de,he,ce,ue,fe,ve,pe,me,Ee,Ae,ge,Re,ye,we,Te,be,ke,Ie,Ce,Se,Me,Pe,_e,Oe,Le,Ue;!function(e){e.metaDataLoaded="loadedmetadata",e.start="start",e.timeUpdate="timeupdate",e.ended="ended",e.finished="finished",e.paused="pause",e.resumed="resume",e.playing="playing",e.suspended="suspend",e.volumeChange="volumechange",e.muted="mute",e.unmuted="unmute",e.firstQuartile="firstQuartile",e.midpoint="midpoint",e.thirdQuartile="thirdQuartile",e.complete="complete",e.click="click",e.error="error",e.ctaClick="ctaClick"}(X||(X={})),function(e){e.PLAYING="playing",e.PAUSED="paused",e.ENDED="ended",e.LOADING="loading",e.ERROR="error",e.CAN_SKIP="can-skip",e.CANNOT_SKIP="cannot-skip",e.MUTED="muted",e.UNMUTED="unmuted",e.FULLSCREEN="fullscreen",e.NOT_FULLSCREEN="not-fullscreen",e.NO_CTA="no-cta"}($||($={})),function(e){e.VIDEO_CONTROLS="video-controls",e.PLAY_PAUSE="play-pause",e.MUTE_UNMUTE="mute-unmute",e.FULLSCREEN="fullscreen",e.CTA="cta",e.REMAINING_TIME="remaining-time",e.SKIP="skip",e.PROGRESS_BAR="progress-bar",e.SKIP_COUNTER="skip-counter",e.SKIP_THUMBNAIL="skip-thumbnail"}(ee||(ee={}));class Ne extends z{constructor(){super(...arguments),te.add(this),ie.set(this,{container:null,mediaUrl:"",type:"application/x-mpegURL",posterUrl:"",autoplay:!1,loop:!1,volume:1,objectFit:"contain",preload:"auto",className:""}),ne.set(this,null),re.set(this,void 0),se.set(this,!1),oe.set(this,!1),ae.set(this,null),le.set(this,!1),de.set(this,!1),he.set(this,{firstQuartile:!1,midpoint:!1,thirdQuartile:!1,complete:!1}),ce.set(this,!1),ue.set(this,!1),fe.set(this,!1),ve.set(this,!1),pe.set(this,!1),this.isStreamingMedia=!1,this.Event=X,me.set(this,!1),Ee.set(this,!1)}prepare(n){return e(this,void 0,void 0,(function*(){return n?t(this,de,"f")?Promise.reject("VideoPlayer: Media already started"):t(this,le,"f")?Promise.reject("VideoPlayer: Media already prepared"):(i(this,ie,Object.assign(Object.assign({},t(this,ie,"f")),(e=>{const t={},{container:i,mediaUrl:n,type:r,posterUrl:s,autoplay:o,loop:a,volume:l,objectFit:d,preload:h,className:c,skipOffset:u=30,clickThrough:f}=e;if("string"!=typeof n)throw new Error("VideoPlayer: mediaUrl is required");return t.mediaUrl=n,i instanceof HTMLElement||(t.container=i),["application/x-mpegURL","video/mp4"].includes(r)||(t.type=r),"string"==typeof s&&s.length&&(t.posterUrl=s.trim()),"boolean"==typeof o&&(t.autoplay=o),"boolean"==typeof a&&(t.loop=a),"number"==typeof l&&l>=0&&l<=1&&(t.volume=l),"string"==typeof d&&d.length&&(t.objectFit=d.trim()),"string"==typeof h&&h.length&&(t.preload=h.trim()),"string"==typeof c&&c.length&&(t.className=c.trim()),"string"==typeof f&&f.length&&(t.clickThrough=f.trim()),t.skipOffset="number"==typeof u&&u>30?u:30,t})(n)),"f"),this.isStreamingMedia=t(this,ie,"f").mediaUrl.endsWith(".m3u8"),Z(t(this,ie,"f")).then((e=>{const{hls:n=null,video:r}=e;i(this,ae,n,"f"),i(this,ne,r,"f"),!0===t(this,ie,"f").loop&&(t(this,ne,"f").loop=!0,t(this,ne,"f").setAttribute("loop","true")),t(this,te,"m",ge).call(this),i(this,le,!0,"f")})).catch((e=>Promise.reject(e)))):Promise.reject("VideoPlayer: Invalid meta")}))}start(i){var n;try{if(!t(this,ne,"f"))return Promise.reject("VideoPlayer: Video not prepared");const{container:r}=i||{};if(t(this,de,"f"))return Promise.reject("VideoPlayer: Media already started");const s=t(this,ie,"f").container instanceof HTMLElement,o=r instanceof HTMLElement;if(!s&&!o)throw new Error("VideoPlayer: Invalid container");!s&&o&&(t(this,ie,"f").container=r),null===(n=t(this,ie,"f").container)||void 0===n||n.appendChild(t(this,ne,"f")),t(this,te,"m",Ae).call(this);const{volume:a}=t(this,ie,"f");return((t,i)=>e(void 0,void 0,void 0,(function*(){if(!(t instanceof HTMLVideoElement))return Promise.reject(new Error("StartMediaPlay: video is not an instance of HTMLVideoElement"));if("number"!=typeof i||i<0||i>1)return Promise.reject(new Error("StartMediaPlay: volume is not a number between 0 and 1"));try{console.debug('VideoPlayer: Attempt 1 - With volume "user defined" or default 1');try{yield t.play()}catch(e){console.log("Media Not allowed to play",e)}return Promise.resolve({attempt:1,volume:i})}catch(e){const n=0===i&&"NotAllowedError"===(null==e?void 0:e.name);if(n)return Promise.reject("VideoPlayer: Not allowed to play");try{return console.debug("VideoPlayer: Attempt 2 - With volume 0"),t.volume=0,t.muted=!0,t.setAttribute("muted","true"),yield null==t?void 0:t.play(),Promise.resolve({attempt:2,volume:0})}catch(e){return n?Promise.reject("VideoPlayer: Not allowed to play"):Promise.reject(e)}}})))(t(this,ne,"f"),a).then((e=>{const{attempt:i,volume:n}=e;return 1===i?Promise.resolve():(2===i&&"number"==typeof n&&(t(this,ie,"f").volume=n,t(this,te,"m",Ae).call(this)),e)}))}catch(e){return Promise.reject(e)}}play(){var e;return t(this,ue,"f")?Promise.reject("VideoPlayer: Do not play"):t(this,ne,"f")?(i(this,ce,!1,"f"),null===(e=t(this,ne,"f"))||void 0===e?void 0:e.play()):Promise.reject("VideoPlayer: Video not prepared")}pause(){var e;return t(this,ne,"f")?(i(this,ce,!0,"f"),Promise.resolve(null===(e=t(this,ne,"f"))||void 0===e?void 0:e.pause())):Promise.reject("VideoPlayer: Video not prepared")}playFromStart(){var e,n;return t(this,ne,"f")?(t(this,ne,"f").currentTime=.1,i(this,me,!0,"f"),i(this,Ee,!1,"f"),null===(n=null===(e=t(this,ne,"f"))||void 0===e?void 0:e.play)||void 0===n?void 0:n.call(e)):Promise.reject("VideoPlayer: Video not prepared")}stop(){}setVolume(e){if(!t(this,ne,"f"))return;"number"==typeof e&&e>=0&&e<=1&&(t(this,ie,"f").volume=e,t(this,ne,"f").volume=e,t(this,te,"m",Ae).call(this))}get videoElement(){return t(this,ne,"f")}set doNotPlay(e){"boolean"==typeof e&&i(this,ue,e,"f")}get doNotPlay(){return t(this,ue,"f")}get volume(){var e;return null!==(e=t(this,ie,"f").volume)&&void 0!==e?e:1}get isPaused(){var e;return(null===(e=t(this,ne,"f"))||void 0===e?void 0:e.paused)||!1}get remainingTime(){if(!t(this,ne,"f"))return"";if(!t(this,te,"a",Ie)&&!t(this,te,"a",Ce))return"";const{currentTime:e,duration:i}=t(this,ne,"f");return t(this,te,"m",ke).call(this,i-e)}get currentTime(){var e,i;return null!==(i=null===(e=t(this,ne,"f"))||void 0===e?void 0:e.currentTime)&&void 0!==i?i:0}get duration(){var e,i;return null!==(i=null===(e=t(this,ne,"f"))||void 0===e?void 0:e.duration)&&void 0!==i?i:0}get hasVideoEnded(){var e,i,n,r;return Math.floor(null!==(i=null===(e=t(this,ne,"f"))||void 0===e?void 0:e.currentTime)&&void 0!==i?i:0)===Math.floor(null!==(r=null===(n=t(this,ne,"f"))||void 0===n?void 0:n.duration)&&void 0!==r?r:0)}get progress(){if(!t(this,ne,"f"))return 0;if(!t(this,te,"a",Ie)&&!t(this,te,"a",Ce))return 0;const{currentTime:e,duration:i}=t(this,ne,"f");return e/i*100}get isCompleted(){return t(this,he,"f").complete||!1}get isVideoReplaying(){return t(this,me,"f")}get hasError(){return t(this,ve,"f")}destroy(){var e,n,r,s,o,a;null===(e=t(this,ae,"f"))||void 0===e||e.destroy(),i(this,fe,!0,"f"),null===(n=t(this,ne,"f"))||void 0===n||n.pause(),null===(r=t(this,ne,"f"))||void 0===r||r.setAttribute("src",""),(null===(s=t(this,ne,"f"))||void 0===s?void 0:s.src)&&(t(this,ne,"f").src=""),null===(o=t(this,ne,"f"))||void 0===o||o.load(),null===(a=t(this,ne,"f"))||void 0===a||a.remove()}set hasEnded(e){i(this,fe,e,"f")}}ie=new WeakMap,ne=new WeakMap,re=new WeakMap,se=new WeakMap,oe=new WeakMap,ae=new WeakMap,le=new WeakMap,de=new WeakMap,he=new WeakMap,ce=new WeakMap,ue=new WeakMap,fe=new WeakMap,ve=new WeakMap,pe=new WeakMap,me=new WeakMap,Ee=new WeakMap,te=new WeakSet,Ae=function(){const{volume:e}=t(this,ie,"f");t(this,ne,"f")&&(t(this,ne,"f").muted=0===e,t(this,ne,"f").setAttribute("muted",0===e?"true":"false"),t(this,ne,"f").volume=null!=e?e:1,0===e?$.MUTED:$.UNMUTED,this.dispatchEvent(X.volumeChange),0===e?this.dispatchEvent(X.muted):this.dispatchEvent(X.unmuted))},ge=function(){t(this,ne,"f")&&(t(this,ne,"f").addEventListener("play",t(this,te,"m",we).bind(this)),t(this,ne,"f").addEventListener("timeupdate",t(this,te,"m",Te).bind(this)),t(this,ne,"f").addEventListener("waiting",(()=>{t(this,oe,"f")||t(this,se,"f")&&(console.debug("VideoPlayer: Cannot recover. Fragment error!"),i(this,oe,!0,"f"),this.dispatchEvent(X.error,S.MEDIAFILE_DISPLAY_ERROR))})),t(this,ne,"f").addEventListener("long-pause",(()=>{t(this,ce,"f")||t(this,oe,"f")||(t(this,se,"f")&&(console.debug("VideoPlayer: Long pause detected, and cannot recover. Fragment error!"),i(this,ve,!0,"f"),i(this,oe,!0,"f"),this.dispatchEvent(X.error,S.MEDIAFILE_DISPLAY_ERROR)),!t(this,fe,"f")&&t(this,he,"f").complete&&(this.dispatchEvent(X.ended),i(this,fe,!0,"f")))})),t(this,ne,"f").addEventListener("ended",(()=>{t(this,fe,"f")||(i(this,fe,!0,"f"),this.dispatchEvent(X.ended))})),t(this,ne,"f").addEventListener("error",(()=>{t(this,ce,"f")||t(this,fe,"f")||t(this,ve,"f")||(i(this,ve,!0,"f"),this.dispatchEvent(X.error,S.MEDIAFILE_DISPLAY_ERROR))})),t(this,ne,"f").addEventListener("pause",(()=>{t(this,te,"m",Re).call(this),t(this,fe,"f")||t(this,ve,"f")||(i(this,pe,!0,"f"),this.dispatchEvent(X.paused))})),t(this,ne,"f").addEventListener("playing",(()=>{t(this,de,"f")&&(t(this,fe,"f")||t(this,ve,"f")||(t(this,pe,"f")&&this.dispatchEvent(X.resumed),i(this,pe,!1,"f")))})),t(this,te,"m",ye).call(this,"loadedmetadata",X.metaDataLoaded),t(this,te,"m",ye).call(this,"click",X.click),t(this,ne,"f").addEventListener("timeupdate",(()=>{t(this,fe,"f")||this.dispatchEvent(X.timeUpdate)})),t(this,ae,"f")&&t(this,ae,"f").on(window.Hls.Events.ERROR,t(this,te,"m",be).bind(this)))},Re=function(){if(!t(this,ne,"f")||!t(this,me,"f"))return;Math.floor(t(this,ne,"f").currentTime)===Math.floor(t(this,ne,"f").duration)&&!t(this,Ee,"f")&&(this.dispatchEvent(X.finished),i(this,Ee,!0,"f"))},ye=function(e,i,n={}){t(this,ne,"f")&&"string"==typeof e&&"string"==typeof i&&t(this,ne,"f").addEventListener(e,(()=>{this.dispatchEvent(i)}))},we=function(){t(this,de,"f")?this.dispatchEvent(X.playing):(i(this,de,!0,"f"),this.dispatchEvent(X.start))},Te=function(){t(this,te,"m",Re).call(this);let{duration:e,currentTime:i}=t(this,ne,"f");if(e=Math.floor(isFinite(e)&&e||0),i=Math.floor(isFinite(i)&&i||0),!e&&!i)return;const{firstQuartile:n,midpoint:r,thirdQuartile:s,complete:o}=t(this,he,"f"),a=!r&&i>=.5*e,l=!s&&i>=.75*e,d=!o&&i>=e;!n&&i>=.25*e&&(t(this,he,"f").firstQuartile=!0,this.dispatchEvent(X.firstQuartile)),a&&(t(this,he,"f").midpoint=!0,this.dispatchEvent(X.midpoint)),l&&(t(this,he,"f").thirdQuartile=!0,this.dispatchEvent(X.thirdQuartile)),d&&(t(this,he,"f").complete=!0,this.dispatchEvent(X.complete))},be=function(e,n){if(null==n?void 0:n.fatal)if(n.type===window.Hls.ErrorTypes.NETWORK_ERROR)n.details===window.Hls.ErrorDetails.FRAG_LOAD_ERROR?i(this,se,!0,"f"):this.dispatchEvent(X.error,S.MEDIAFILE_UNSUPPORTED_ERROR);else t(this,ae,"f").destroy(),console.debug("VideoPlayer: Cannot recover"),this.dispatchEvent(X.error,S.MEDIAFILE_UNSUPPORTED_ERROR)},ke=function(e){if("number"!=typeof e)return"00:00";const t=Math.floor(e/60),i=Math.ceil(e%60);return`${t<10?`0${t}`:`${t}`}:${i<10?`0${i}`:`${i}`}`},Ie=function(){if(!t(this,ne,"f"))return!1;const{duration:e}=t(this,ne,"f");return"number"==typeof e&&isFinite(e)&&e>0},Ce=function(){if(!t(this,ne,"f"))return!1;const{currentTime:e}=t(this,ne,"f");return"number"==typeof e&&isFinite(e)&&e>0},function(e){e.AD_READY="adReady",e.AD_IMPRESSION="adImpression",e.AD_RENDERED="adRendered",e.AD_REFRESHED="adRefreshed",e.AD_ERROR="adError",e.AD_CLOSED="adClosed",e.AD_CLICKED="adClicked",e.AD_SKIPPED="adSkipped",e.AD_SKIPPABLE_STATE_CHANGE="adSkippableStateChange",e.AD_PAUSED="adPaused",e.AD_RESUMED="adResumed",e.AD_VIDEO_START="adVideoStart",e.AD_VIDEO_FIRST_QUARTILE="adVideoFirstQuartile",e.AD_VIDEO_MIDPOINT="adVideoMidpoint",e.AD_VIDEO_THIRD_QUARTILE="adVideoThirdQuartile",e.AD_VIDEO_COMPLETE="adVideoComplete",e.AD_VOLUME_CHANGED="adVolumeChanged",e.AD_MUTED="adMuted",e.AD_UNMUTED="adUnmuted",e.AD_PROGRESS="adProgress",e.AD_USER_CLOSE="adUserClose",e.AD_INSERTION_START="adInsertionStart",e.AD_INSERTION_END="adInsertionEnd",e.AD_MEDIA_EXPAND="onFullScreen",e.AD_MEDIA_COLLAPSE="onExitFullScreen"}(Se||(Se={})),function(e){e.PERSONAL_COMPUTER="2",e.CONNECTED_TV="3",e.PHONE="4",e.TABLET="5",e.CONNECTED_DEVICE="6",e.SET_TOP_BOX="7"}(Me||(Me={})),function(e){e.GEO_PROFILE="geoProfile",e.USER_PROFILE="userProfile"}(Pe||(Pe={})),function(e){e.APP_ID="appId",e.ACCOUNT_KEY="accountKey",e.SECRET_KEY="secretKey",e.SDK_INITIALIZED="sdkInitialized",e.GEO_PROFILE="geoProfile",e.USER_PROFILE="userProfile",e.IS_APP="isApp",e.SOURCE_CONFIG_DATA="sourceConfig",e.ABORT="abort",e.PRIVATE_KEY="privateKey",e.KEY_ID="keyId",e.UPS_ENDPOINT="upsEndpoint",e.UPS_XAUTH="upsXAuth",e.DGS_ENDPOINT="dgsEndpoint",e.DGS_XAUTH="dgsXAuth",e.AS_ENDPOINT="adspotEndpoint",e.AS_XAUTH="adspotXAuth",e.UPS_FIRST_FETCH_DONE="upsFirstFetchDone",e.UPS_SERVICE_CALL="UPSServiceCall",e.DGS_SERVICE_CALL="DGSServiceCall"}(_e||(_e={})),function(e){e.UID="uid",e.GENDER="gender",e.AGE="age",e.COUNTRY="country",e.REGION="region",e.CITY="city",e.ZIPCODE="zip",e.KEYWORDS="keywords"}(Oe||(Oe={})),function(e){e.PLAY_ONCE="play_once",e.REPEAT="repeat"}(Le||(Le={}));class De{constructor(){Ue.set(this,new Map)}static getInstance(){return De.instance}set(e,i){"object"!=typeof e?t(this,Ue,"f").set(e,i):Object.entries(e).forEach((([e,i])=>{t(this,Ue,"f").set(e,i)}))}get(e){var i;return"string"!=typeof e||0==e.length?t(this,Ue,"f"):null!==(i=t(this,Ue,"f").get(e))&&void 0!==i?i:null}get isSDKInitialized(){return Boolean(t(this,Ue,"f").get(_e.SDK_INITIALIZED))}}Ue=new WeakMap,De.instance=new De;const xe=De.getInstance();var Ve,Qe,Fe,We,He;!function(e){e.errorCode="{errorcode}",e.noFill="",e.noFillError="[nofill.error]",e.demandPartnerSDKVersion="[demand.partner.sdkversion]",e.eventName="[event.name]",e.vastErrorCode="[vast.error]",e.OmidSDKVersion="[omid.partner.sdkversion]",e.eventAttribute1="[event.attribute1]",e.eventAttribute2="[event.attribute2]",e.eventAttribute3="[event.attribute3]",e.randomCcb="[random.ccb]",e.deviceIFA="[device.ifa]"}(Ve||(Ve={}));class Je{static post(t){return e(this,void 0,void 0,(function*(){const{url:e,payload:i,headers:n={},credentials:r}=t||{};let s={method:"POST",body:JSON.stringify(i)};r&&(s.credentials=r),n&&(s.headers=n);const o=new AbortController;s.signal=o.signal;return[fetch(e,s).then((e=>e.ok?e.json().catch((()=>Promise.reject(d("Invalid JSON response")))):e.text().then((t=>Promise.reject({message:`Error: ${e.status}`,status:e.status,body:t}))))).catch((e=>(function(...e){console.log.apply(console,e)}("Error in Fetch.post",e),Promise.reject(e)))),o]}))}static get(t){return e(this,arguments,void 0,(function*(e,t={}){return fetch(e,t).then((e=>e.json()))}))}static getPlainResponse(t){return e(this,arguments,void 0,(function*(e,t={}){return fetch(e,t)}))}static DeviceGeoService(){const e=xe.get(_e.ACCOUNT_KEY),t=xe.get(_e.DGS_ENDPOINT);xe.get(_e.DGS_XAUTH);const i=(t||"").replace("ACCOUNT_KEY",e);return Qe.get(i)}static UserProfileService(t){return e(this,void 0,void 0,(function*(){const e=xe.get(_e.ACCOUNT_KEY),i=xe.get(_e.UPS_ENDPOINT),n=xe.get(_e.UPS_XAUTH),r=(i||"").replace("ACCOUNT_KEY",e),[s]=yield Qe.post({url:r,headers:{"X-AUTH":n},payload:t});return s}))}static AdQuery(e){const{ACCOUNT_KEY:t,AS_ENDPOINT:i}=_e,n=xe.get(t)||"",r=xe.get(i);return Qe.post({url:r.replace("ACCOUNT_KEY",n),payload:e,credentials:"include"})}static replaceAllMacros(e,t){const i=Object.keys(Ve);if(0===i.length)return e;const{ifa:n=""}=window.VmaxAdManager.getDevice().getPayload();return i.forEach((i=>{var r;const s=Ve[i];let o;o=s===Ve.randomCcb?Date.now().toString():s===Ve.deviceIFA?n:t&&(null===(r=t[s])||void 0===r?void 0:r.toString())||"";const a=new RegExp(this.escapeRegExp(s),"g");e=e.replace(a,o)})),t||i.forEach((t=>{const i=Ve[t],n=new RegExp(this.escapeRegExp(i),"g");e=e.replace(n,"")})),e}static escapeRegExp(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}static FireTracker(i,n){return e(this,void 0,void 0,(function*(){if(!(e=i,"string"==typeof e&&e.length>0||(e=>Array.isArray(e))(i)))return Promise.reject("No url to fire tracker");var e;for(let e of i)e=this.replaceAllMacros(e,n),yield t(Qe,Qe,"m",Fe).call(Qe,e)}))}}Qe=Je,Fe=function(t){return e(this,void 0,void 0,(function*(){try{const e=window.VmaxAdManager.getSite().getPayload(),{pageUrl:i,referrerUrl:n}=e,r=yield fetch(t,{method:"GET",headers:{Connection:"keep-alive","X-Requested-with":`${i}`},credentials:"include"});r.ok||d("Tracker request failed:",r.status,r.statusText)}catch(e){d("Error while firing the tracker:",e)}}))};class je{constructor(e=new Map){We.set(this,new Map),i(this,We,e,"f")}fireTracker(e,i){const n=t(this,We,"f").get(e);n&&Je.FireTracker(n,i)}}We=new WeakMap,function(e){e.IMPRESSION="impression",e.NO_FILL="nofill",e.FILL="fill",e.CLICK="click",e.ERROR="error",e.START="start",e.FIRST_QUARTILE="firstQuartile",e.MIDPOINT="midpoint",e.THIRD_QUARTILE="thirdQuartile",e.COMPLETE="complete",e.PAUSE="pause",e.RESUME="resume",e.SKIP="skip",e.MUTE="mute",e.UNMUTE="unmute",e.SKIPPABLE_STATE_CHANGE="skippableStateChange"}(He||(He={}));var Be,Ke,Ge,Ye,qe,ze,Ze,Xe,$e,et,tt,it,nt,rt,st,ot,at,lt,dt,ht,ct,ut,ft,vt,pt,mt,Et,At,gt,Rt=He;function yt(e){if("number"==typeof e)return e;try{const[t,i,n]=e.split(":"),r=60*parseInt(t)*60,s=60*parseInt(i);return r+s+parseInt(n)}catch(e){return function(...e){console.debug.apply(console,e)}("videoInstreamVmaxAd: Wrong time specified in vast parser",e),0}}function wt(e){var t,i,r,s,o,a;const{bid:l,vast:d,hasVideoAdElement:h=!1,imaCompanions:c={companions:[],companionResourceUrls:[]}}=e,{ext:u={},w:f=null,h:v=null}=l||{},p=null!==(t=null==u?void 0:u["ad-meta"])&&void 0!==t?t:{},{id:m=null,name:E=null,"campaign-meta":A={}}=p,{id:g=null,name:R=null,marketer:y={},order:w={}}=A,{id:T=null,name:b=null,agency:k=null,brand:I=null}=y||{},{id:C=null,name:S=null}=w,M=e=>"number"==typeof e&&e>=0?e:-1,P=function(e){try{return JSON.parse(e)}catch(e){return{}}}((null==l?void 0:l.adm)||"{}"),_=(null==P?void 0:P.title)||"",O=(null==P?void 0:P.ctaText)||"",L=!!(null==P?void 0:P.linkUrl)||!!(null==P?void 0:P.linkFallback),U=n((null==P?void 0:P.linkUrl)||"",(null==P?void 0:P.linkFallback)||""),N=(null==d?void 0:d.adSystem)||"",D=(null==d?void 0:d.adTitle)||"",x=(null==d?void 0:d.description)||"",V=(null===(i=null==d?void 0:d.linear)||void 0===i?void 0:i.skipoffset)||(null==d?void 0:d.skipOffset)?M(yt((null===(r=null==d?void 0:d.linear)||void 0===r?void 0:r.skipoffset)||(null==d?void 0:d.skipOffset)||"")):"",Q=(null==d?void 0:d.duration)?M(yt(null==d?void 0:d.duration)):"",F=!!(null==d?void 0:d.deepLinkUrl)||!!(null==d?void 0:d.clickThrough);let W=(null==d?void 0:d.companions)||[],H=(null==d?void 0:d.companionResourceUrls)||[];const J=n((null==d?void 0:d.deepLinkUrl)||"",(null==d?void 0:d.clickThrough)||""),{companions:j=[],companionResourceUrls:B=[]}=c;j.length&&(W=[...j],H=[...B]);return{adId:m,adName:E,campaignId:g,campaignName:R,marketerId:T,marketerName:b,brand:I,agency:k,orderId:C,orderName:S,qualifiedSignature:(null===(a=null===(o=null===(s=null==l?void 0:l.ext)||void 0===s?void 0:s.modules)||void 0===o?void 0:o.render)||void 0===a?void 0:a.signature)||"",width:f,height:v,adSystem:N,adTitle:_||D,adDescription:x,ctaText:O,skipOffset:V,adDuration:Q,isCTAAvailable:L||F,adClickUrl:U||J,companionResourceUrls:H,hasVideoAdElement:h,companions:W}}const Tt=document.currentScript;class bt{constructor(){Be.add(this),Ke.set(this,void 0),Ge.set(this,void 0),Ye.set(this,void 0),qe.set(this,void 0),ze.set(this,void 0),Ze.set(this,!1),Xe.set(this,!1),$e.set(this,void 0),et.set(this,void 0),tt.set(this,void 0),it.set(this,void 0),nt.set(this,void 0),rt.set(this,void 0),st.set(this,void 0),ot.set(this,void 0),at.set(this,"external/omweb-v1.js"),lt.set(this,"external/omid-session-client-v1.js"),dt.set(this,"VMAX"),ht.set(this,"1.4.0"),ct.set(this,"full"),this.BEGIN_TO_RENDER="beginToRender",ut.set(this,Tt.src.split("/VmaxAdHelper")[0])}initSessionClient(e,n){return new Promise(((r,s)=>{0!==e.length?t(this,Be,"m",ft).call(this).then((()=>{const o=window.OmidSessionClient;o?(i(this,Ke,o.default,"f"),i(this,$e,t(this,Ke,"f").AdSession,"f"),i(this,nt,t(this,Ke,"f").Partner,"f"),i(this,tt,t(this,Ke,"f").Context,"f"),i(this,rt,t(this,Ke,"f").VerificationScriptResource,"f"),i(this,et,t(this,Ke,"f").AdEvents,"f"),i(this,it,t(this,Ke,"f").MediaEvents,"f"),i(this,Ge,e,"f"),i(this,Ye,n,"f"),i(this,qe,t(this,Be,"m",gt).call(this),"f"),t(this,qe,"f").addEventListener("load",(()=>{t(this,Be,"m",At).call(this),r(!0)})),document.body.appendChild(t(this,qe,"f"))):s(new Error("OMID session client is not available"))})).catch((e=>s(e))):s(new Error("No ad verification present"))}))}get adEvents(){return t(this,Ze,"f")}get mediaEvents(){return t(this,Xe,"f")}destroy(){setTimeout((()=>{var e,i;null===(e=t(this,ze,"f"))||void 0===e||e.finish(),null===(i=t(this,qe,"f"))||void 0===i||i.remove()}),3e3)}}var kt,It,Ct,St,Mt,Pt,_t,Ot,Lt,Ut,Nt,Dt,xt,Vt,Qt,Ft,Wt,Ht,Jt,jt,Bt,Kt,Gt,Yt,qt,zt,Zt,Xt,$t,ei,ti,ii,ni,ri,si,oi,ai,li;Ke=new WeakMap,Ge=new WeakMap,Ye=new WeakMap,qe=new WeakMap,ze=new WeakMap,Ze=new WeakMap,Xe=new WeakMap,$e=new WeakMap,et=new WeakMap,tt=new WeakMap,it=new WeakMap,nt=new WeakMap,rt=new WeakMap,st=new WeakMap,ot=new WeakMap,at=new WeakMap,lt=new WeakMap,dt=new WeakMap,ht=new WeakMap,ct=new WeakMap,ut=new WeakMap,Be=new WeakSet,ft=function(){return new Promise(((e,i)=>{if(null===window||void 0===window?void 0:window.OmidSessionClient)return void e();const n=document.createElement("script");n.src=`${t(this,ut,"f")}/${t(this,lt,"f")}`,n.onload=()=>e(),n.onerror=()=>i(new Error("Failed to load OMID client session script")),document.head.appendChild(n)}))},vt=function(){return new(t(this,$e,"f"))(t(this,ot,"f"))},pt=function(){return new(t(this,nt,"f"))(t(this,dt,"f"),t(this,ht,"f"))},mt=function(){return t(this,Ge,"f").map((e=>{const i=e.verificationScriptUrl;return new(t(this,rt,"f"))(i,e.vendorKey,e.verificationParameters,t(this,ct,"f"))}))},Et=function(){const e=t(this,Be,"m",mt).call(this);return new(t(this,tt,"f"))(t(this,st,"f"),e,null,"")},At=function(){i(this,st,t(this,Be,"m",pt).call(this),"f"),i(this,ot,t(this,Be,"m",Et).call(this),"f"),t(this,ot,"f").setVideoElement(t(this,Ye,"f"));const e=t(this,qe,"f").contentWindow;e?(t(this,ot,"f").setServiceWindow(e),i(this,ze,t(this,Be,"m",vt).call(this),"f"),t(this,ze,"f")&&t(this,ze,"f").isSupported&&t(this,ze,"f").isSupported()?(t(this,ze,"f").setCreativeType("video"),t(this,ze,"f").setImpressionType(this.BEGIN_TO_RENDER),t(this,ze,"f").start(),i(this,Ze,new(t(this,et,"f"))(t(this,ze,"f")),"f"),i(this,Xe,new(t(this,it,"f"))(t(this,ze,"f")),"f")):console.warn("adSession not present")):console.warn("OM SDK iframe content window not available.")},gt=function(){const e=document.createElement("iframe");return e.setAttribute("sandbox","allow-scripts allow-same-origin"),e.style.display="none",e.srcdoc=`