/** * Vidazoo Consent SDK * Version: 1.0.1 * Date: 2024-03-12T16:34:16.498Z */ (()=>{var I=Object.defineProperty;var _=Object.getOwnPropertySymbols;var b=Object.prototype.hasOwnProperty,D=Object.prototype.propertyIsEnumerable;var v=(i,t,e)=>t in i?I(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,h=(i,t)=>{for(var e in t||(t={}))b.call(t,e)&&v(i,e,t[e]);if(_)for(var e of _(t))D.call(t,e)&&v(i,e,t[e]);return i};var n=(i,t,e)=>(v(i,typeof t!="symbol"?t+"":t,e),e);var f=(i,t,e)=>new Promise((r,o)=>{var l=s=>{try{p(e.next(s))}catch(g){o(g)}},d=s=>{try{p(e.throw(s))}catch(g){o(g)}},p=s=>s.done?r(s.value):Promise.resolve(s.value).then(l,d);p((e=e.apply(i,t)).next())});function y(i){return typeof i!="undefined"}function G(i){return y(i)&&typeof i=="function"}function m(i){i=i||window;try{if(i.parent!=i&&i.parent.document.URL)return m(i.parent)}catch(t){}return i}function w(...i){}var a=class a{constructor(){n(this,"_topWindow");this._topWindow=m()}static getInstance(){return a._instance||(a._instance=new a),a._instance}get isGPPExists(){return"__gpp"in this._topWindow&&G(this._topWindow.__gpp)}getGPPData(){let t=null;if(this.isGPPExists){let e=this.ping();if(e.gppVersion==="1.0")t=this._topWindow.__gpp("getGPPData");else{let r;this.on(o=>{o.eventName==="listenerRegistered"&&(r=o.listenerId,t=e)}),this.off(r)}}return t}ping(){if(!this.isGPPExists)return null;let t;try{t=this._topWindow.__gpp("ping")}catch(e){}return t||this._topWindow.__gpp("ping",e=>{t=e}),t}on(t){return this.isGPPExists?this._topWindow.__gpp("addEventListener",t):null}off(t){this.isGPPExists&&this._topWindow.__gpp("removeEventListener",w,t)}};n(a,"_instance");var P=a;var u=class{constructor(t,e,r){this.isValidResolver=t;this.interval=e;this.totalIntervals=r;n(this,"_promise");n(this,"_resolve");n(this,"_reject");n(this,"_counter");n(this,"_timer");this._counter=0,this._promise=new Promise((o,l)=>{this._resolve=o,this._reject=l}),this._nextRun()}get promise(){return this._promise}_nextRun(){if(this.isValidResolver()){this._resolve();return}this._counter++,this._counterthis._nextRun(),this.interval):this._reject(new Error("timeout"))}destroy(){window.clearTimeout(this._timer)}};var c=class{constructor(t){n(this,"_options");this._options=t}get gppService(){return P.getInstance()}getGPPString(){return f(this,null,function*(){if(this.gppService.isGPPExists){let t=this.gppService.ping();if(this._isDataLoaded(t))return this.gppService.getGPPData().gppString}if(this._options.waitForGPPString)try{return(yield this._waitForGPPData()).gppString}catch(t){}return""})}_isDataLoaded(t){return t.cmpStatus==="loaded"&&(t.cmpDisplayStatus==="hidden"||["visible","disabled"].includes(t.cmpDisplayStatus)&&!this._options.waitForGPPString)}_waitForGPPData(){return f(this,null,function*(){return this.gppService.isGPPExists?new Promise((t,e)=>{let r,o=d=>{if(d.listenerId===r&&this._isDataLoaded(d.pingData)){this.gppService.off(r);let p=this.gppService.getGPPData();t(p)}};r=this.gppService.on(o).listenerId}):this._waitForGPPApiToExist().then(()=>this._waitForGPPData())})}_waitForGPPApiToExist(){return new u(()=>this.gppService.isGPPExists,this._options.waitForGPPApiInterval,this._options.waitForGPPApiTotalIntervals).promise}};function x(i){return h({waitForGPPString:!1,waitForGPPApiInterval:1e3,waitForGPPApiTotalIntervals:600},i)}window.vdzCmp={version:"1.0.1",create(i){return i=x(i),new c(i)}};})();