summaryrefslogtreecommitdiff
path: root/miniany/doc/Můžeme věřit překladačům_ Projekty řešící schéma „důvěřivé důvěry“ - Root.cz_files/cpex-package.min.js
diff options
context:
space:
mode:
Diffstat (limited to 'miniany/doc/Můžeme věřit překladačům_ Projekty řešící schéma „důvěřivé důvěry“ - Root.cz_files/cpex-package.min.js')
-rw-r--r--miniany/doc/Můžeme věřit překladačům_ Projekty řešící schéma „důvěřivé důvěry“ - Root.cz_files/cpex-package.min.js2
1 files changed, 2 insertions, 0 deletions
diff --git a/miniany/doc/Můžeme věřit překladačům_ Projekty řešící schéma „důvěřivé důvěry“ - Root.cz_files/cpex-package.min.js b/miniany/doc/Můžeme věřit překladačům_ Projekty řešící schéma „důvěřivé důvěry“ - Root.cz_files/cpex-package.min.js
new file mode 100644
index 0000000..e01fdf5
--- /dev/null
+++ b/miniany/doc/Můžeme věřit překladačům_ Projekty řešící schéma „důvěřivé důvěry“ - Root.cz_files/cpex-package.min.js
@@ -0,0 +1,2 @@
+var CpexPackage=function(){"use strict";("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{}).SENTRY_RELEASE={id:"3.7.4"};let e=Date.now();function t(){return window.cpexPackage||window.cpexPackageFormats}function i(e){(e=[].slice.call(e)).unshift("display: inline-block; color: #fff; background: #555; padding: 1px 4px; border-radius: 3px;");e.unshift("%cCPEx Package");return e}function s(e){return e?JSON.parse(JSON.stringify(e)):e}function n(){if(t().debugMode){const t=Date.now();Array.prototype.push.call(arguments,t-e);e=t;console.log.apply(this,i(arguments))}}function d(e){console.log("%cCPEx Package%c "+e,"display: inline-block; color: #fff; background: #555; padding: 1px 4px; border-radius: 3px;","font-size: 15px; padding-top: 10px; font-weight: bold; border-bottom: none")}function a(){console.warn.apply(this,i(arguments))}function r(e,s){s instanceof Error?s.message=e+", reason: "+s.message:s=new Error(e||"missing error message");const n=t();window.Sentry&&!0===n.settingsLoaded&&window.Sentry.captureException(s);console.error.apply(this,i(arguments));return s}function o(e){return"object"==typeof e&&null!==e&&!1===Array.isArray(e)}function c(e){return Array.isArray(e)&&e.length>0}function l(e){return!!o(e)&&o(e.ball)}function h(e,t){const i=new RegExp(t+"=(?<value>[^a-zA-Z]+)(/| )","gm").exec(e);if(i&&i.groups)return i.groups.value}function g(e){const t=e.match(/<!--(?<value>.+?)-->/m);if(t&&t.groups)return t.groups.value}function p(e,t){return new Promise(((i,s)=>{if("string"!=typeof e){n("LoadScript: URL for "+t+" not given, is it intentional?");return i()}const d=document.createElement("script");d.onload=()=>{i()};d.onerror=e=>{s(e)};d.src=e;document.head.appendChild(d)}))}function m(e){const t=document.createElement("style");t.innerHTML=e;document.head.appendChild(t);return t}function u(e,t){if("object"!=typeof e||"object"!=typeof t)return!1;for(const i in t)I(t[i])?e[i]=t[i]:t.hasOwnProperty(i)&&(i in e?"object"!=typeof e[i]||"object"!=typeof t[i]||e[i].concat&&t[i].concat?e[i]=t[i]:e[i]=u(e[i],t[i]):e[i]=t[i]);return e}function f(){window.gdprAppliesGlobally=!0;!function(e,t,i,s,n){function d(e,i,s,d){if("function"!=typeof s)return;window[t]||(window[t]=[]);let a=!1;n&&(a=n(e,d,s));a||window[t].push({command:e,version:i,callback:s,parameter:d})}d.stub=!0;d.stubVersion=2;function a(t){if(!window[e]||!0!==window[e].stub)return;if(!t.data)return;const n="string"==typeof t.data;let d;try{d=n?JSON.parse(t.data):t.data}catch(a){return}if(d[i]){const r=d[i];function o(e,i){const d={};d[s]={returnValue:e,success:i,callId:r.callId};t.source.postMessage(n?JSON.stringify(d):d,"*")}window[e](r.command,r.version,o,r.parameter)}}if("function"!=typeof window[e]){window[e]=d;window.addEventListener?window.addEventListener("message",a,!1):window.attachEvent("onmessage",a)}}("__tcfapi","__tcfapiBuffer","__tcfapiCall","__tcfapiReturn");!function e(t){if(!window.frames[t])if(document.body&&document.body.firstChild){const e=document.createElement("iframe");e.style.display="none";e.name=t;e.title=t;document.body.insertBefore(e,document.body.firstChild)}else setTimeout((function(){e(t)}),5)}("__tcfapiLocator")}function w(e,t){let i=document.getElementById(e);if(!i)return a("Element not found",i);const s=i.getAttribute("data-target-id-moved");document.getElementById(s)&&(i=document.getElementById(s));if(i){let e,s,n,d=i.getElementsByClassName("debugTags")[0];if(d){e=d.children[0];s=i.getElementsByClassName("regularTags")[0];n=i.getElementsByClassName("extraTags")[0]}else{d=document.createElement("div");d.classList.add("debugTags");d.style.cssText="position: relative; display: block; height: 0px";i.prepend(d);e=document.createElement("div");e.style.cssText="position: absolute; top: 0px; left: 0px; padding: 10px; z-index: 214748365";d.appendChild(e);s=document.createElement("span");s.classList.add("regularTags");e.appendChild(s);n=document.createElement("span");n.classList.add("extraTags");e.appendChild(n)}for(const[e,i]of Object.entries(t)){const t=document.createElement("span");switch(e){case"hb":t.innerHTML="<b>HB</b>, bidder: <b>"+i.bidder+"</b>, cpm: <b>"+Math.round(100*i.cpm)/100+"</b>, size: <b>"+i.size+"</b>";i.hbkey&&(t.innerHTML+=", <b>hbKey:</b> "+i.hbkey);t.style.cssText="color: black; font-size: 8px; display: inline-block; padding: 4px; margin: 1px; border-radius: 3px; background: #1a73e8; color: #fff; box-shadow: 0px 0px 2px #888A";n.appendChild(t);break;case"json":t.innerHTML="<b>JSON</b>";t.style.cssText="color: black; font-size: 8px; display: inline-block; padding: 4px; margin: 1px; border-radius: 3px; background: #8fe81a; color: #fff; box-shadow: 0px 0px 2px #888A";n.appendChild(t);break;case"customType":if(!n.querySelector(".customType")){t.innerHTML="CPEx Format: <b>"+i+"</b>";t.style.cssText="color: black; font-size: 8px; display: inline-block; padding: 4px; margin: 1px; border-radius: 3px; background: #ee2024; color: #fff; box-shadow: 0px 0px 2px #888A";t.classList.add("customType");n.appendChild(t)}break;default:t.innerHTML=e+": <b>"+i+"</b>";t.style.cssText="color: black; font-size: 8px; display: inline-block; padding: 4px; margin: 1px; border-radius: 3px; background: #eee; box-shadow: 0px 0px 2px #888A";s.appendChild(t)}}}}function b(){return navigator.userAgent.match(/Mobi/)}function v(){return new Promise((e=>"loading"!==document.readyState?e():document.addEventListener("DOMContentLoaded",e))).catch((e=>r("DOM loaded failed",e)))}function y(e,t,i){const s=document.createElement("iframe");s.style.cssText="border:none; display:block; overflow:hidden; border:none; margin:auto;";e.appendChild(s);"function"==typeof i&&(s.onload=()=>{i(s)});Object.assign(s,t);s.setAttribute("scrolling","no");s.setAttribute("marginwidth","0");s.setAttribute("marginheight","0");return s}function A(e,t){e.open("text/html","replace");e.write(t);e.close()}function x(e){if(document.getElementById(e)){const t=document.getElementById(e).children;for(const e of t)e.classList.contains("debugTags")||(e.style.display="none")}}function I(e){return e instanceof Element}function S(e){const t=document.createElement("img");t.setAttribute("src",e);t.style.width="1px";t.style.height="1px";t.style.position="absolute";t.style.bottom="0px";t.style.right="0px";t.style.border="none";document.body.appendChild(t)}function C(e){return decodeURIComponent(window.atob(e).split("").map((function(e){return"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)})).join(""))}function k(e,t){return e.replace(/\${(.*?)}/g,((e,i)=>t[i]))}function E(e,t){return e.length>t?e.substring(0,t)+"...":e}function T(e,t,i){return k(t,{link:e.link.url,title:E(e.assets[0].title.text,i?.titleLength||45),desc:E(e.assets[1].data.value,i?.descLength||90),img:e.assets[2].img.url,sponsor:""})}function L(e){function t(e){e&&(Array.isArray(e)?e.forEach((e=>{S(e)})):"string"==typeof e&&S(e))}e.measurePixel&&t(e.measurePixel);if(e.data.native){e.data.native.impressionTrackers&&t(e.data.native.impressionTrackers);e.data.native.javascriptTrackers&&t(e.data.native.javascriptTrackers)}}function B(){return!("object"!=typeof window.pbjs||!window.pbjs.version)}function P(e,t,i){const s=document.createElement(e);Object.assign(s,i);void 0!==i&&i.class&&s.setAttribute("class",i.class);return t.appendChild(s)}class j{constructor(e){this.main=e;this.loaded=!1;this.main.settings.cmp.enabled?this.addDidomi():window.__tcfapi||f()}addDidomi(){if(window.Didomi){a("CMP: Didomi already present");this.loaded=!0}else if(window.__tcfapi){a("CMP: Generic CMP already present");this.loaded=!0}else{f();p("https://sdk.privacy-center.org/"+"9a8e2159-3781-4da1-9590-fbf86806f86e"+"/loader.js?target="+(this.main.localhost?"cpex.cz":document.location.hostname),"Didomi loader for SDK");window.didomiOnReady=window.didomiOnReady||[];window.didomiOnReady.push((()=>{this.loaded=!0;n("CMP: Didomi loaded");!1===window.Didomi.isTCFEnabled()&&r("TCF compliance disabled in Didomi console");this.fireConsentPixels();this.addCloseButton()}))}}fireConsentPixels(e){window.didomiEventListeners.push({event:"consent.changed",listener:()=>{this.fireConsentPixels(!0)}});const t=window.localStorage.getItem("pixelsLastFired")||0,i=Date.now();i-864e5>t||e?Array.isArray(this.main.settings.cmp.pixelList)&&window.__tcfapi("addEventListener",2,((e,t)=>{if(!1!==t&&e.vendor.consents)if(Object.keys(e.vendor.consents).length>0){this.main.settings.cmp.pixelList.forEach((t=>{S(t.replace("%CONSENT%",e.tcString))}));window.localStorage.setItem("pixelsLastFired",i);n("CMP: Added consent pixels")}else a("CMP: Missing consent for calling pixels")})):n("CMP: 24 hours have not yet passed, based on pixelsLastFired in local storage")}addCloseButton(){if(void 0!==window.cpexCmpAllowCloseButton||-1!==window.location.href.indexOf("cpexCmpAllowCloseButton")){const e=document.getElementById("didomi-notice")||document.getElementsByClassName("didomi-popup-notice-logo-container")[0];if(e){const t=document.createElement("div");t.textContent="×";t.style.cssText="position: absolute; top: 10px; right: 10px; width: 40px; height: 40px; cursor: pointer; font-size: 20pt; text-align: center; line-height: 40px;";t.addEventListener("click",(function(){window.Didomi.notice.hide()}));e.appendChild(t)}}}}class M{constructor(e){this.main=e;this.dependenciesLoading=!1;this.adapter="googletag";this.displayed=!1;this.slots=[]}load(){n("Adserver: GoogleTag adapter loading");this.pubAdsReady=new Promise((e=>{const t=setInterval((()=>{if(window.googletag.pubadsReady){clearInterval(t);e()}}),100)}));const e=[this.pubAdsReady];window.googletag=window.googletag||{cmd:[]};if(this.main.settings.adserver.loadPrerequisites&&!0!==this.dependenciesLoading){this.dependenciesLoading=!0;if(window.googletag&&"function"==typeof window.googletag.getVersion)a("Adserver: GPT already present, version: ",window.googletag.getVersion());else{const t=p("https://securepubads.g.doubleclick.net/tag/js/gpt.js","GPT").then((()=>{window.googletag.cmd.unshift((()=>{window.googletag.pubads().disableInitialLoad()}))}));e.push(t)}e.push(new Promise(((e,t)=>{window.googletag.cmd.push((()=>{window.googletag.pubads().disableInitialLoad();window.googletag.pubads().enableSingleRequest();window.googletag.pubads().enableAsyncRendering();window.googletag.enableServices();this.dependenciesLoading=!1;e()}))})).catch((e=>r("Googletag que init failed",e))))}if(this.main.settings.adserver.defineSlots){window.googletag.cmd.push((()=>{window.googletag.destroySlots()}));this.slotsDefined=new Promise(((e,t)=>{this.main.settings.adserver.defineSlots.forEach((e=>{document.getElementById(e.elementId)?window.googletag.cmd.push((()=>{window.googletag.defineSlot(e.path,e.sizes,e.elementId).addService(window.googletag.pubads())})):n(e.elementId+" not found in the page, probably intended")}));window.googletag.cmd.push((()=>{e()}))}));e.push(this.slotsDefined)}this.loading=Promise.all(e).then((()=>{n("Adserver: Googletag adapter loaded")})).catch((e=>r("Googletag failed to load",e)));return this.loading}async getAdsList(){await this.loading;return window.googletag.pubads().getSlots().map((e=>e.getSlotElementId()))}async call(){await this.loading;this.main.debugMode&&this.logSlotTable();this.eventHandler&&window.googletag.pubads().removeEventListener("slotRenderEnded",this.eventHandler);window.googletag.pubads().getSlots().forEach((e=>{const t=e.getSlotElementId();!1===this.displayed&&window.googletag.display(t);this.main.headerbidding&&B()&&this.addBid(t,e);this.main.regularAds[t]={element:document.getElementById(t),slot:e};this.slots[e.getAdUnitPath()]=e}));this.eventHandler=e=>this.adRenderDebug(e);window.googletag.pubads().addEventListener("slotRenderEnded",this.eventHandler);n("Adserver: GoogleTag display/refresh called");window.googletag.pubads().refresh();this.displayed=!0}async getElementId(e){return(await this.getAdsList()).includes(e)?e:null}adRenderDebug(e){if(this.main.debugMode){const t=e.slot.getSlotElementId();n("AdServer: googletag rendered into elementId "+t,e);setTimeout((()=>{this.prepareMetaData(t,e)}),1e3)}}addBid(e,t){const i=window.pbjs.getHighestCpmBids(e)[0];if(i){t.setTargeting("hb_pb_"+i.bidder,i.adserverTargeting.hb_pb.toString());t.setTargeting("pos",t.getAdUnitPath())}}gamReRender(e){const t=e.split("/");2===t.length&&r("GAM returns only id part of path, this suggests that defineSlot names dont match. First slot will be used");const i=t[t.length-1],s=Object.keys(this.slots).filter((e=>-1!==e.indexOf(i)));if(s.length>0){const e=this.slots[s[0]];e.fromHB=!0;const t=e.getSlotElementId();this.main.headerbidding.reRender(t)}else r("Adserver: Slot not found")}prepareMetaData(e,t){const i={adapter:this.adapter,id:e,size:t.size,creativeId:t.creativeId};this.main.customAds[e]&&(i.customType=this.main.customAds[e].type);w(e,i)}logSlotTable(){const e=window.googletag.pubads().getSlots();if(e.length>0){d("Adserver: Found these GAM slots:");const t=[];e.forEach((e=>{let i="";e.getSizes().forEach((e=>{i+=`[${e.width},${e.height}], `}));t.push({path:e.getAdUnitPath(),element:e.getSlotElementId(),sizes:i.slice(0,-2)})}));console.table(t)}else a("Adserver: No GAM slots found")}}class R{constructor(e){this.adapter="sastracker";this.main=e;this.dependenciesLoading=!1;this.areaKey=e.settings.adserver.areaKey||"area";this.debugRenderAttempts=0;window.top.sasTracker=window.top.sasTracker||{};window.top.sasTracker.que=window.top.sasTracker.que||[]}load(){n("AdServer: SAStracker adapter loading");this.domLoaded=v();"vlm"===this.main.settings.publisher.code&&window.addEventListener("cpexAdRendered",(e=>{e.detail.element.dataset.loaded=!0}));if(this.main.settings.adserver.loadPrerequisites&&!0!==this.dependenciesLoading){this.dependenciesLoading=!0;if(window.postscribe){a("Adserver: Postscribe already present");this.postscribeLoaded=Promise.resolve()}else this.postscribeLoaded=p("https://cdn.cpex.cz/package/prerequisites/postscribe.min.js","Postscribe").then((()=>{this.dependenciesLoading=!1}));this.loading=Promise.all([this.domLoaded,this.postscribeLoaded]).catch((e=>r("Loading requirements failed",e)))}else this.loading=this.domLoaded;this.loading.then((()=>{n("AdServer: SAStracker adapter loaded")}));return this.loading}async getAdsList(){const e=[];for(const t in window.AdsObject)"ball"!==t&&e.push(window.AdsObject[t][this.areaKey]);return e}async call(e){await this.loading;if(this.main.settings.adserver.delayCall){n("AdServer: Adserver call delayed by "+this.main.settings.adserver.delayCall);await new Promise((e=>setTimeout(e,this.main.settings.adserver.delayCall))).catch((e=>r("Delay timeout failed",e)))}if(!l(window.AdsObject))return r("AdServer: Missing window.AdsObject or ball property on it, call will fail");let t;if(c(e)){t=s(window.AdsObject);window.AdsObject=Object.fromEntries(Object.entries(window.AdsObject).filter((([t,i])=>e.includes(i[this.areaKey]))));window.AdsObject.ball=t.ball}this.main.settings.adserver.addConsent&&await this.addConsent();if(this.main.headerbidding&&B()){this.addBids();window.dispatchEvent(new window.Event("cpexBidsAdded"))}if(window.iinfo)window.iinfo.adverts.sas.sas.onCpexSasTrackerTrack();else if("echo"!==this.main.settings.publisher.code){"function"==typeof window.top.sasTracker.track?window.top.sasTracker.track():window.top.sasTracker.que.push((()=>{window.top.sasTracker.track()}));n("AdServer: SAS called with this AdsObject: ",window.AdsObject)}t&&(window.AdsObject=t)}async getElementId(e){return(await this.getAdsList()).includes(e)?e:null}adRenderDebug(e,t){if(this.main.debugMode)if(window.top.sasTracker.rr&&window.top.sasTracker.rr[e]&&document.getElementById(e)){const i=window.top.sasTracker.rr[e];n("AdServer: SAS rendered this ad:",i);"{"===i.res[0]&&(t.json=!0);const s=document.getElementById(e).getAttribute("data-target-id-moved");document.getElementById(s)&&(e=s);this.prepareMetaData(e,t,i.res)}else if(this.debugRenderAttempts<=5){this.debugRenderAttempts++;setTimeout((()=>{this.adRenderDebug(e,t)}),250)}}async refresh(e){if(!l(window.AdsObject)){r("AdServer: Missing window.AdsObject or ball property on it, call will fail");return!1}this.main.headerbidding&&await this.main.headerbidding.refresh(e);this.call(e);n("AdServer: SAS refreshed with this AdsObject: ",window.AdsObject);return!0}isFromHB(e){return g(e)?.includes("HB")}render(e,t,i,s){n(`AdServer: SAStracker returned creative for ${e}, size: ${i}x${s}`);i=parseInt(i);s=parseInt(s);const d=this.isFromHB(t),a=parseInt(h(t,"SASF_ADVERTISERID"));try{setTimeout((()=>{this.adRenderDebug(e,{width:i,height:s,fromHB:d,sspId:a})}),250)}catch(e){console.error("Debug tags failed to render",e)}const r=!Object.values(this.main.settings.adserver.allowedSSPs).map((e=>parseInt(e))).includes(a);if(d||r){this.main.regularAds[e]={element:document.getElementById(e)};return!1}return this.main.render(e,t,i,s)}addBids(){for(const e in window.AdsObject){if("ball"===e)continue;const t=window.AdsObject[e],i=window.pbjs.getHighestCpmBids(t[this.areaKey])[0];if(i){t.hbid=i.cpm;t.bidTier=i.adserverTargeting.hb_pb;t.hbid_v=this.main.settings.adserver.bidderTable[i.bidderCode]||"unknown";t.bidderCode=i.bidderCode;i.size&&(t.bidderSize=i.size);i.dealId&&(t.bidDealId=i.dealId)}else["hbid","bidTier","hbid_v","bidderCode","bidderSize","bidDealId"].forEach((e=>delete t[e]))}const e=window.pbjs.getUserIds();e.pubcid&&(window.AdsObject.ball.pcid=e.pubcid);e.id5id&&(window.AdsObject.ball.id5=e.id5id.uid);this.main.ab.group&&this.main.ab.sasKey&&(window.AdsObject.ball[this.main.ab.sasKey]=this.main.ab.group)}addConsent(){return new Promise(((e,t)=>{try{window.__tcfapi("addEventListener",2,((i,s)=>{if(s&&i&&i.tcString){window.AdsObject.ball.gdpr="1";window.AdsObject.ball.consent=i.tcString;e()}else t()}))}catch(e){r("AdServer: CMP not responding properly",e);t(e)}}))}prepareMetaData(e,t,i){const s={adapter:"sasTracker "+window.sasTracker.version?.substring(0,3),id:e+", fcid: "+h(i,"SASF_FCID"),size:t.width+"x"+t.height,sspId:t.sspId};t.json&&(s.json=!0);this.main.customAds[e]&&(s.customType=this.main.customAds[e].type);w(e,s)}}class O{constructor(e){this.main=e;this.adapter="sasic"}load(){n("Adserver: Sasic adapter loading");this.loading=v();this.loading.then((()=>{n("Adserver: Sasic adapter loaded")}));window._sasic_queue.push(["customRender",e=>{const t=h(e.code,"SASF_WIDTH"),i=h(e.code,"SASF_HEIGHT");return this.render(e.elementId,e.code,t,i)}]);return this.loading}async getAdsList(){return window._sasic.getAllPositions().map((e=>e.options.hb_key)).filter((e=>!!e))}async call(){await this.loading;const e={};if(B())for(const t of await this.getAdsList()){const i=window.pbjs.getHighestCpmBids(t)[0];i&&(e[i.adUnitCode]={hbid:i.cpm,hbid_v:this.main.settings.adserver.bidderTable[i.bidderCode]||"unknown"})}window._sasic_queue.push(["loadAllHb",e]);n("AdServer: SAS called with these AdUnits: ",e)}async getElementId(e){return Object.values(window._sasic.get(["groups"])).map((e=>Object.values(e.positions))).flat().filter((e=>!!e)).find((t=>t.options.hb_key===e))?.elementId}async sasicReRender(e){this.main.headerbidding.reRender(await this.getElementId(e),e)}getElementsList(){return window._sasic.getAllPositions().map((e=>e.elementId))}isFromHB(e){return g(e).includes("HB")}render(e,t,i,s){n(`AdServer: Sashic returned creative for ${e}, size: ${i}x${s}`);i=parseInt(i);s=parseInt(s);const d=this.isFromHB(t),a=parseInt(h(t,"ADVID"));if(this.main.debugMode)try{n("AdServer: SAS rendered this ad: ",e);const r=h(t,"FCID"),o=t.match(/hb_key: (?<value>\S+)/m)?.groups?.value;setTimeout((()=>{this.prepareMetaData(e,{width:i,height:s,fromHB:d,sspId:a,fcId:r,hbKey:o})}),1e3)}catch(e){console.error("Debug tags failed to render",e)}const r=!Object.values(this.main.settings.adserver.allowedSSPs).includes(a);if(d||r){this.main.regularAds[e]={element:document.getElementById(e)};return!1}return this.main.render(e,t,i,s)}prepareMetaData(e,t){const i={adapter:"sasic",id:e+", fcid: "+t.fcId,size:t.width+"x"+t.height,advid:t.sspId};this.main.customAds[e]&&(i.customType=this.main.customAds[e].type);w(e,i)}}class H{constructor(e){this.main=e;this.adapter="paticka";this.loading=!0}load(){n("Adserver: Paticka adapter loading");this.loading=v();this.loading.then((()=>{n("Adserver: Paticka adapter loaded")}));return this.loading}async getAdsList(){return Object.keys(window.Unidata.biddingData[0])}async call(){await this.loading;if(window.Unidata?.biddingData){window.sasBidding=window.sasBidding||{};if(this.main.headerbidding&&B())for(const e of await this.getAdsList()){const t=window.pbjs.getHighestCpmBids(e)[0];t&&(window.sasBidding[e]={bidTier:t.adserverTargeting.hb_pb,hbid:t.cpm,hbid_v:this.main.settings.adserver.bidderTable[t.bidderCode]||"unknown"})}}else r("Missing Unidata.biddingData");"function"==typeof window.sasBiddingDone?window.sasBiddingDone():r("sasBiddingDone function not present");n("AdServer: SAS called with these AdUnits: ",window.sasBidding)}async getElementId(e){return(await this.getAdsList()).includes(e)?e:null}patickaReRender(e){this.main.regularAds[e]={element:document.getElementById(e)};this.main.headerbidding.reRender(e);this.main.debugMode&&setTimeout((()=>{this.prepareMetaData(e)}),250)}prepareMetaData(e){const t={adapter:"paticka",id:e};this.main.customAds[e]&&(t.customType=this.main.customAds[e].type);w(e,t)}}class D{constructor(e){this.main=e;this.adapter="test";this.creatives={banner:"<img src='https://playground.cpex.cz/creatives/square.jpg'>",interscroller:"<img src='https://playground.cpex.cz/creatives/interscroller.jpg'>",skin:"<img src='https://playground.cpex.cz/creatives/skin.jpg'>",native:"<script>\n window.postMessage({\n clickTag: 'https://www.cpex.cz',\n creativeType: 'native',\n data: 'ewogICJuYXRpdmUiOiB7CiAgICAidmVyIjogIjEuMiIsCiAgICAibGluayI6IHsKICAgICAgInVybCI6ICJodHRwczovL3d3dy5jcGV4LmN6LyIKICAgIH0sCiAgICAiYXNzZXRzIjogWwogICAgewogICAgICAicmVxdWlyZWQiOiAxLAogICAgICAidGl0bGUiOiB7CiAgICAgICAgInRleHQiOiAiQ1BFeCBOYXRpdmUgRXhhbXBsZSBBZCBIZWFkbGluZSIsCiAgICAgICAgImxlbiI6IDMxCiAgICAgIH0KICAgIH0sIHsKICAgICAgImRhdGEiOiB7CiAgICAgICAgInR5cGUiOiAyLAogICAgICAgICJ2YWx1ZSI6ICJCYXNlZCBvbiBpYWIgT3BlblJUQiBEeW5hbWljIE5hdGl2ZSBBZHMgQVBJIDEuMiBzcGVjaWZpY2F0aW9uLCBmb3IgYnJvYWQgcmV1c2FiaWxpdHkuIgogICAgICB9CiAgICB9LCB7CiAgICAgICJpbWciOiB7CiAgICAgICAgInR5cGUiOiAzLAogICAgICAgICJ1cmwiOiAiaHR0cHM6Ly9wbGF5Z3JvdW5kLmNwZXguY3ovY3JlYXRpdmVzL25hdGl2ZS5qcGciLAogICAgICAgICJ3IjogNDAwLAogICAgICAgICJoIjogMzAwCiAgICAgIH0KICAgIH1dCiAgfQp9'\n }, '*')\n <\/script>",slideup:"<img src='https://playground.cpex.cz/creatives/billboard.jpg'>"}}load(){n("Adserver: Test adapter loading");this.main.settings.headerbidding.enabled=!1;if(window.AdsObject||window.googletag){const e=window.AdsObject?new R(this.main):new M(this.main);this.loading=e.load().catch((e=>r("TempAdapter failed to load",e))).then((()=>{n("Adserver: Test adapter loaded")}));return this.loading}r("Adserver: Cannot find SAS or GAM adUnits")}async call(){this.skinFound=!1;window.googletag&&await v();await this.loading;n("Adserver: Called Test adserver");if(this.main.settings.adserver.delayCall){n("AdServer: Adserver call delayed by "+this.main.settings.adserver.delayCall);await new Promise((e=>setTimeout(e,this.main.settings.adserver.delayCall))).catch((e=>r("Delay timeout failed",e)))}if(window.AdsObject)for(const e in window.AdsObject)"ball"!==e&&this.testRender(window.AdsObject[e].area);else window.googletag?window.googletag.pubads().getSlots().forEach((e=>{const t=e.getSlotElementId();this.slots[e.getAdUnitPath()]=t;this.testRender(t)})):r("Adserver: Cannot find SAS or GAM setup. Have to get adUnits from somewhere")}showMetaData(e,t){setTimeout((()=>{const i={adapter:"test",area:e,size:t.width+"x"+t.height};this.main.customAds[e]&&(i.customType=this.main.customAds[e].type);w(e,i)}),500)}testRender(e){const t=(e,t,i,s)=>{this.main.renderAny(e,t,i,s);this.showMetaData(e,{width:i,height:s})};if(void 0!==this.main.settings.formats&&o(this.main.settings.formats.testCreatives)&&o(this.main.settings.formats.testCreatives[e])){const i=this.main.settings.formats.testCreatives[e];i.preset&&this.creatives[i.preset]?t(e,this.creatives[i.preset],i.width,i.height):i.html&&t(e,i.html,i.width,i.height)}else if(e.indexOf("rect")>-1||e.indexOf("square")>-1)t(e,this.creatives.banner,300,300);else if(e.indexOf("interscroller")>-1)t(e,this.creatives.interscroller,480,820);else if((e.indexOf("leaderboard")>-1||e.indexOf("skin")>-1)&&!1===this.skinFound){t(e,this.creatives.skin,2e3,1400);this.skinFound=!0}else e.indexOf("native")>-1?t(e,this.creatives.native,548,150):e.indexOf("slideup")>-1?t(e,this.creatives.slideup,970,250):e.indexOf("vignette")>-1&&t(e,this.creatives.native,300,300)}render(e,t,i,s){}gamReRender(e){}}class U{constructor(e){this.main=e;this.aliases={};this.adUnits=[];this.prebidLoaded=!1;this.prebidLoadedPromise=new Promise(((e,t)=>{this.loadedResolve=e;this.loadedReject=t}))}async load(){this.pbjs=window.pbjs=window.pbjs||{};window.pbjs.que=window.pbjs.que||[];window.pbjs.que.push((()=>{this.prebidLoaded=!0;this.loadedResolve();n("Headerbidding: Loaded")}));this.prebidLoaded||(B()?a("Headerbidding: Publisher using own Prebid, version: ",window.pbjs.version):await p(this.main.settings.headerbidding.prebidPath,"Prebid").catch((e=>{(t=this.main.settings.headerbidding.prebidPath,new Promise(((e,i)=>{try{const i=new window.XMLHttpRequest;i.onreadystatechange=()=>{if(4===i.readyState)switch(i.status){case 0:return e(!0);case 200:return e(!1)}};i.open("GET",t,!0);i.setRequestHeader("Cache-Control","no-cache");i.setRequestHeader("Access-Control-Allow-Origin","*");i.send()}catch(e){i(a("AdBlock testing failed",e))}}))).then((t=>{t?this.hasAdblock=this.main.hasAdblock=!0:r("Prebid failed to load, probably wrong path",e);this.loadedResolve()})).catch((e=>{a("Adblock blocked Prebid from loading")}));var t})))}async configure(){if(this.hasAdblock)return;if(!this.pbjs||!this.pbjs.setConfig){this.load().catch((e=>r("Loading of Prebid failed",e)));await this.prebidLoadedPromise}const e=document.querySelector('meta[name="keywords"]');this.keywords=[...e?.content?e.content.split(","):[],...window.s_keywords?window.s_keywords:[],...window.AdsObject?.ball?.geneawords?window.AdsObject.ball.geneawords.split(","):[]];this.keywords=this.keywords.map((e=>e.trim()));if(this.pbjs.configured){this.pbjs.removeAdUnit();n("Headerbidding: Reset")}else{try{await new Promise((e=>{window.__tcfapi("addEventListener",2,((t,i)=>{t&&i&&(this.cpexConsent=t.vendor.consents[570]);e()}),[570]);setTimeout(e,1e3)}))}catch(e){r("TCF API not available",e)}const e={debug:this.main.debugMode,bidderTimeout:this.main.settings.headerbidding.auctionTimeoutMs||1e3,consentManagement:{gdpr:{cmpApi:"iab",defaultGdprScope:!0,rules:[{purpose:"storage",enforcePurpose:!1,enforceVendor:!1},{purpose:"basicAds",enforcePurpose:!1,enforceVendor:!1}],timeout:this.main.settings.headerbidding.cmpLoadTimeoutMs||2e3,actionTimeout:this.main.settings.headerbidding.cmpActionTimeoutMs||0}},currency:{adServerCurrency:this.main.settings.headerbidding.currency,defaultRates:{USD:{USD:1,CZK:23},EUR:{USD:1,CZK:24}}},schain:{config:{nodes:[{sid:this.main.settings.publisher.sellerId,asi:"cpex.cz",hp:1}],ver:"1.0",complete:1},validation:"strict"},cache:{url:"https://prebid.adnxs.com/pbc/v1/cache"},appnexusAuctionKeywords:{keyword:this.keywords},ortb2:{}},t=this.main.settings.headerbidding.userIDs;if(Array.isArray(t)&&t.length&&this.pbjs.installedModules.includes("userId")){e.userSync={userIds:[],filterSettings:{iframe:{bidders:["connectad"],filter:"include"}}};const i={id5Id:{name:"id5Id",storage:{name:"id5id",type:"html5",expires:365,refreshInSeconds:28800}},sharedId:{name:"sharedId",storage:{name:"_sharedid",type:"cookie",expires:365,refreshInSeconds:28800}},criteo:{name:"criteo"},czechAdId:{name:"czechAdId"}};if(t.includes("id5Id")){i.id5Id.params={partner:"mafra"===this.main.settings.publisher.code?469:250};if(this.cpexConsent)try{i.id5Id.params.pd=await async function(){let e=window.localStorage.getItem("pdRaw");if(e)return window.btoa(e);{const t={9:window.location.hostname,8:window.location.href,12:navigator.userAgent};await window.fetch("https://api64.ipify.org?format=json").then((async i=>{if(200===i.status){const e=await i.json();4===e.ip.split(".").length?t[10]=e.ip:8===e.ip.split(":").length&&(t[11]=e.ip)}e=Object.keys(t).map((e=>e+"="+encodeURIComponent(t[e]))).join("&");window.localStorage.setItem("pdRaw",e);return window.btoa(e)})).catch((e=>{console.error("Fetching of IP address failed",e)}))}}()}catch(e){r("ID5 partner data not loaded",e)}}t.forEach((t=>{t in i&&e.userSync.userIds.push(i[t])}))}if(o(window.sellerDefinedAudiences))if(window.sellerDefinedAudiences.site){e.ortb2=window.sellerDefinedAudiences;if(Array.isArray(window.sellerDefinedAudiences.site.content?.data[0]?.segment)){this.sda=window.sellerDefinedAudiences.site.content.data[0].segment.map((e=>e.id)).join();e.appnexusAuctionKeywords.sda=this.sda}}else e.ortb2={site:{content:{data:[window.sellerDefinedAudiences]}}};if(this.main.ab.group){e.ortb2.user=e.ortb2.user??{};e.ortb2.user.ext=e.ortb2.user.ext??{};e.ortb2.user.ext.data=e.ortb2.user.ext.data??{};e.ortb2.user.ext.data.cpexAB=this.main.ab.group;e.appnexusAuctionKeywords.cpexAB=this.main.ab.group}this.pbjs.setConfig(e);if("mafra"===this.main.settings.publisher.code){this.pbjs.setBidderConfig({bidders:["adform"],config:{schain:{validation:"relaxed",config:{ver:"1.0",complete:1,nodes:[{asi:"adform.com",sid:"2723",hp:1}]}}}});this.pbjs.setBidderConfig({bidders:["omg-adform"],config:{schain:{validation:"relaxed",config:{ver:"1.0",complete:1,nodes:[{asi:"adform.com",sid:"2700",hp:1}]}}}});this.pbjs.setBidderConfig({bidders:["fragile-adform"],config:{schain:{validation:"relaxed",config:{ver:"1.0",complete:1,nodes:[{asi:"adform.com",sid:"2950",hp:1}]}}}})}this.main.settings.headerbidding.analytics.includes("id5Analytics")&&this.pbjs.installedModules.includes("id5AnalyticsAdapter")&&this.pbjs.enableAnalytics({provider:"id5Analytics",options:{partnerId:250,eventsToTrack:["auctionEnd","bidWon"]}});this.main.settings.headerbidding.analytics.includes("cpexAnalytics")&&this.pbjs.installedModules.includes("cpexAnalyticsAdapter")&&this.pbjs.enableAnalytics({provider:"cpexAnalytics"});this.pbjs.configured=!0}this.pbjs.onEvent("beforeRequestBids",(e=>{this.pbjs.bidderSettings={standard:{adserverTargeting:[{key:"hb_pb",val:e=>this.setBidTier(e)},{key:"hb_adid",val:e=>e.adId}]},criteo:{storageAllowed:!0}};this.main.settings.headerbidding.bidderSettings&&(this.pbjs.bidderSettings={...this.pbjs.bidderSettings,...this.main.settings.headerbidding.bidderSettings});const t=this.pbjs.getUserIds();e.forEach((e=>{e.bids.forEach((e=>{"rubicon"!==e.bidder&&"rubicon"!==e.bidderModuleName||this.fillRubiconInventory(e,t)}))}))}));await this.setAdUnits().catch((e=>r("Setting of ad units failed",e)));n("Headerbidding: Configured")}calculateBucket(e){const t=e-7;if(t<=0)return 1;return function(e,t,i){return e>i?i:e<=t?t:e}(Math.round(Math.log(t)/Math.log(1.39)),1,16)}getBucket(e){const t=this.main.settings.headerbidding.customBuckets,i=t.findIndex((t=>e<t));return-1===i?t.length+1:i+1}setBidTier(e){const t="CZK"===this.main.settings.headerbidding.currency?e.cpm:this.pbjs.convertCurrency(e.cpm,this.main.settings.headerbidding.currency,"CZK");if("number"==typeof t)return Array.isArray(this.main.settings.headerbidding.customBuckets)?this.getBucket(t):this.calculateBucket(t);r("cpmCZK is not a number")}call(){n("Headerbidding: Called");if(this.hasAdblock)return this.callAdserverIfEnabled();const e=new Promise((e=>setTimeout(e,this.main.settings.headerbidding.cmpLoadTimeoutMs+this.main.settings.headerbidding.cmpActionTimeoutMs+this.main.settings.headerbidding.auctionTimeoutMs)));if(c(this.adUnits)){const t=this.pbjs.requestBids();Promise.race([t,e]).then((e=>{if(e&&e.bids)this.bidsBack(!0,e.bids);else{r("Headerbidding: Prebid failed to return bids");this.callAdserverIfEnabled()}}))}else{a("Headerbidding: No adUnits, skipping auction");this.callAdserverIfEnabled()}}callAdserverIfEnabled(){this.main.adserver&&!0===this.main.settings.adserver.enabled&&this.main.adserver.call()}async refresh(e){n("Headerbidding: Called");const t=await this.pbjs.requestBids({adUnitCodes:e}),i=await Promise.all(e.map((async e=>await this.main.adserver.getElementId(e))));this.main.clearAds(i);this.bidsBack(!1,t.bids);return!0}filterAdUnitsBeforeAuction(e){const t=e=>{return t=e.cookie,(t=new RegExp("(?:^|;\\s*)"+(""+t).replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")+"=([^;]*)").exec(document.cookie))&&t[1];var t},i=(e,t)=>{n("Headerbidding: Filtered out "+e.code+", reason: "+t,e)};return e.filter((e=>{if(o(e.filter)){if((s=e.filter).maxWidth&&window.innerWidth>parseInt(s.maxWidth)){i(e,"Is above specified maximum width");return!1}if((e=>!!e.minWidth&&window.innerWidth<parseInt(e.minWidth))(e.filter)){i(e,"Is below specified minimum width");return!1}if((e=>!!e.urlIs&&void 0!==e.urlIs.split(",").find((e=>e===window.location.host+window.location.pathname)))(e.filter)){i(e,"URL is one of the location strings");return!1}if((e=>!!e.urlIsNot&&void 0===e.urlIsNot.split(",").find((e=>e===window.location.host+window.location.pathname)))(e.filter)){i(e,"URL is not one of the location strings");return!1}if((e=>!!e.urlHas&&void 0!==e.urlHas.split(",").find((e=>-1!==window.location.href.indexOf(e))))(e.filter)){i(e,"URL contains at least one of the strings");return!1}if((e=>!!e.urlHasNot&&e.urlHasNot.split(",").every((e=>-1===window.location.href.indexOf(e))))(e.filter)){i(e,"URL does not contain any of the strings");return!1}if((e=>!(!window.cpexAdUnitParam||!e.variable)&&window.cpexAdUnitParam===e.variable)(e.filter)){i(e,"Page does not contain required variable");return!1}if(t(e.filter)){i(e,"Page contains filtering cookie");return!1}}var s;return!0}))}filterAdUnitsAfterAuction(e){this.adUnits.forEach((t=>{if(o(t.filter)&&t.filter.skin){if(e.find((e=>this.main.formats.isSkin(e.width,e.height)))){this.pbjs.removeAdUnit(t.code);n("Headerbidding: Filtered out an adUnit, reason: Skin present",t)}}}))}async setAdUnits(){this.isDomReady="interactive"===document.readyState||"complete"===document.readyState;this.adUnitsReady=Date.now()-performance.timeOrigin;this.adUnits=[];if(!this.main.settings.headerbidding.adUnits)return r("Headerbidding: Failed, no AdUnits found");if(!Array.isArray(this.main.settings.headerbidding.adUnits))return r("Headerbidding: Failed, AdUnits are not an array");const e=this.filterAdUnitsBeforeAuction(s(this.main.settings.headerbidding.adUnits));let t=[];this.main.adserver&&(t=await this.main.adserver.getAdsList().catch((e=>r("Ads list not returned",e))));t.length>0?t.forEach((t=>{const i=e.find((e=>e.code===t));if(i){Object.keys(i.mediaTypes).includes("native")&&(i.mediaTypes.native={ortb:{ver:"1.2",context:1,plcmttype:1,assets:[{id:1,required:1,img:{type:3,wmin:199,hmin:199}},{id:2,required:1,title:{len:90}},{id:3,required:0,data:{type:2}},{id:4,required:0,data:{type:1}}],eventtrackers:[{event:1,methods:[1]}],privacy:1}});if(Object.keys(i.mediaTypes).includes("video")){i.mediaTypes.video={plcmt:1,startdelay:0,context:"instream",mimes:["video/mp4","video/x-flv"],protocols:[1,2,3,4,5,6,7,8],api:[1,2,3,4,5],linearity:1,...i.mediaTypes.video};this.pbjs.setConfig({video:{providers:[{divId:i.video.divId,vendorCode:2,playerConfig:{params:{adPluginConfig:{numRedirects:10,debug:!0},vendorConfig:{controls:!0,autoplay:!1,preload:"auto"}}}}]}});this.pbjs.onEvent("videoSetupFailed",(e=>{a("Player setup failed: ",e)}));this.pbjs.onEvent("videoBidError",(e=>{a("An Ad Error came from a Bid: ",e)}))}this.adUnits.push(i)}})):this.adUnits=e;for(const e of this.adUnits)for(const t of e.bids){"r2b2"===t.bidder&&this.main.adserver.getElementId&&(t.params.element="#"+await this.main.adserver.getElementId(e.code));if(t.bidderModuleName&&!this.aliases[t.bidder]){this.aliases[t.bidder]=t.bidderModuleName;this.pbjs.aliasBidder(t.bidderModuleName,t.bidder)}}n("AdUnits for Prebid added",this.adUnits);this.pbjs.addAdUnits(this.adUnits);this.pbjs.CPEX_adUnits=this.adUnits}fillRubiconInventory(e,t){e.params.inventory={domain:[window.location.hostname],gdpr:this.cpexConsent?[1]:[0]};this.keywords.length>0&&(e.params.inventory.keyword=[this.keywords.join(",")]);this.sda&&(e.params.inventory.iab_cont=this.sda);0!==Object.keys(t).length&&(e.params.inventory={...e.params.inventory,crid:[t.criteoId?1:0],shid:[t.sharedid?1:0],pcid:[t.pubcid?1:0],id5:[void 0!==t.id5id&&"0"!==t.id5id.uid&&window.localStorage.getItem("id5id")?1:0]});this.main.ab.group&&(e.params.inventory.cpexAB=this.main.ab.group)}bidsBack(e,t,i,s){const d=this.pbjs.getHighestCpmBids();this.filterAdUnitsAfterAuction(d);this.saveBids(t);!1===this.main.settings.adserver.enabled?this.adUnits.forEach((e=>{const t=e.code,i=document.getElementById(t);if(i){this.main.regularAds[t]={element:i};const e=this.winningBids[t],s=this.main.settings.headerbidding.passbacks[t];e?this.reRender(t):"function"==typeof s&&s()}else a("Headerbidding: Element for rendering not found")})):e&&this.main.adserver.call();n("Headerbidding: BidsBack")}saveBids(e){this.winningBids={};this.adUnits.forEach((e=>{const t=this.pbjs.getHighestCpmBids(e.code)[0];t&&(this.winningBids[e.code]=t)}));this.pbjs.winningBids=this.winningBids;if(this.main.debugMode){const t=[];Object.values(this.winningBids).forEach((e=>{t.push({adUnit:e.adUnitCode,bidderCode:e.bidderCode,width:e.width,height:e.height,domain:e.meta?.advertiserDomains?.[0],cpm:e.cpm,originalCpm:e.originalCpm,adId:e.adId,currency:e.currency,ttl:e.ttl})}));d(`Headerbidding: All winning bids (cache included) (${Object.keys(this.winningBids).length}):`);console.table(t);const i=[];Array.isArray(e)&&Object.values(e).forEach((e=>{let t={cpm:0};e.bids.forEach((e=>{e.cpm>t.cpm&&(t=e)}));t.adUnitCode&&i.push({adUnit:t.adUnitCode,bidderCode:t.bidderCode,width:t.width,height:t.height,domain:t.meta?.advertiserDomains?.[0],cpm:t.cpm,originalCpm:t.originalCpm,adId:t.adId,currency:t.currency,ttl:t.ttl})}));d(`Headerbidding: Last auction winning bids (${Object.keys(i).length}):`);console.table(i)}}reRender(e,t){const i=t||e;e=e||t;if(document.getElementById(e)){const t=this.main.regularAds[e]||this.main.registerAd(e),s=this.winningBids[i];if(s.adId){if(s.native){const t=this.main.formats.create("native",e,s.width,s.height);this.main.customAds[e]=t;t.render(s.native);t.addPrebidEvents(s);n("Headerbidding: True Native Ad reRendered from HB: ",s.adUnitCode)}else{const n=this.main.formats.match(e,s.width,s.height);x(e);const d=n?this.main.formats.prepareIframe(n,e,s.width,s.height,i):this.prepareIframe(e,t,s.width,s.height);this.pbjs.renderAd(d.contentWindow.document,s.adId)}n("Headerbidding: Ad reRendered from Prebid adUnit: ",i);window.dispatchEvent(new window.CustomEvent("cpexAdReRendered",{detail:t}))}else a("Headerbidding: Winning bid is missing adId");this.main.debugMode&&setTimeout((()=>{this.prepareMetaData(s,e)}),50)}else r("Headerbidding: Element for "+i+" not found, cannot update it with HB creative")}prepareIframe(e,t,i,s,n){t.iframe=y(t.element,{id:e+"-hb-iframe",width:i,height:s,...n});t.iframeCSS&&(t.iframe.style.cssText=t.iframeCSS);return t.iframe}prepareMetaData(e,t,i={}){e&&(i.hb={bidder:e.bidder,cpm:e.cpm,size:(e.width||"0")+"×"+(e.height||"O")});this.main.customAds[t]&&(i.customType=this.main.customAds[t].type);w(t,i)}}class z{constructor(e,t,i,s){this.type="skin";this.elementId=e;this.settings=t;this.settings.backgroundEl=this.settings.backgroundEl||document.body;this.width=i;this.height=s;this.loaded=!1;this.hidden=[];this.offset=0;this.iframeCSS="width: 2000px; height: 1400px; border:none; display:block; overflow:hidden; margin-left: 50%; transform: translateX(-50%); max-width: initial; ";n("Skin: Caught Skin custom format, in elementId "+e)}prepareIframe(){if(!this.validateSettings(this.settings))return r("Skin: Incorrect skin settings: "+JSON.stringify(this.settings));this.backgroundEl=this.settings.backgroundEl||document.body;if(I(this.settings.contentEl)){this.contentEl=this.settings.contentEl;this.contentStyleBackup=window.getComputedStyle(this.contentEl)}this.settings.generalCSS&&(this.generalCSSEl=m(this.settings.generalCSS));Array.isArray(this.settings.hide)&&this.settings.hide.length>0&&this.settings.hide.forEach((e=>{if(I(e)){this.hidden.push({element:e,display:e.style.display});e.style.display="none"}}));this.element=document.createElement("div");this.element.id="cpex-skin";this.getOffset();this.element.style.cssText=`position: fixed; top: ${this.offset}px; left: 0px; width: 100%; ${"number"==typeof this.settings.zIndex?"z-index:"+this.settings.zIndex:""};`;this.backgroundEl.prepend(this.element);const e=document.getElementById(this.elementId);e&&e.setAttribute("data-target-id-moved",this.element.id);this.contentEl&&(this.contentEl.style.cssText=this.settings.contentCSS);this.iframe=y(this.element,{id:this.elementId+"-iframe"},(e=>{this.loaded=!0;n("Skin: Rendered into ",this.backgroundEl)}));this.iframe.style.cssText=this.iframeCSS;if(this.settings.offset&&this.settings.offsetScroll){this.updateOffset();window.addEventListener("scroll",(()=>{this.updateOffset()}))}return this.iframe}getOffset(){"function"==typeof this.settings.offset?this.offset=this.settings.offset():"number"==typeof this.settings.offset&&(this.offset=this.settings.offset)}updateOffset(){this.element.style.top=window.scrollY<this.offset?this.offset-window.scrollY+"px":"0px"}reset(){this.element.remove();this.contentEl&&(this.contentEl.style=this.contentStyleBackup);if(this.generalCSSEl){this.generalCSSEl.remove();delete this.generalCSSEl}this.hidden.forEach((e=>{e.element.style.display=e.display}));const e=window.cpexPackage.customAds;e&&delete e[this.elementId]}validateSettings(e){return o(e)&&I(e.backgroundEl)}}class N{constructor(e,t,i,s){this.type="interscroller";this.elementId=e;this.settings=t;this.width=i;this.height=s;this.loaded=!1;this.iframeCSS=`width: ${this.width}px; height: ${this.height}px`;window.addEventListener("resize",(()=>{this.resize()}));n("Interscroller: Caught Interscroller custom format, in elementId "+e)}resize(){if(this.wrapper){const e=this.wrapper.getBoundingClientRect();this.wrapper.style.marginLeft=-1*e.left+"px";const t=document.documentElement.clientWidth||window.innerWidth,i=document.documentElement.clientHeight||window.innerHeight,s=t/this.width,n=i/this.height,d=n<s?n:s;this.iframe.style.transform="scale("+d+")";const a=(e.width-this.width)/2;this.iframe.style.left=a+"px"}}prepareIframe(){const e=document.createElement("style");document.head.appendChild(e);e.sheet.insertRule("@keyframes ios-clip-hack { from { top: 0 } to { top: 0.01px } }");e.sheet.insertRule(".cpex-interscroller-wrapper { position: absolute; top: 0px; left: 0px; width: 100vw; height: 100%; clip: rect(0px, auto, auto, 0px) }");e.sheet.insertRule(".cpex-interscroller-iframe { position: fixed; top: 0px; margin: auto; display: block; border: none; animation: ios-clip-hack .1s infinite }");this.element=document.getElementById(this.elementId);if(this.element){this.originalHeight=this.element.style.height;this.finalHeight=void 0!==this.settings&&this.settings.height?this.settings.height:"75vh";this.element.style.cssText="position: relative; height: "+this.finalHeight;this.wrapper=document.createElement("div");this.wrapper.classList.add("cpex-interscroller-wrapper");this.element.appendChild(this.wrapper);this.iframe=y(this.wrapper,{id:this.elementId+"-iframe"},(e=>{this.loaded=!0;n("Interscroller: Rendered into ",this.elementId)}));this.iframe.classList.add("cpex-interscroller-iframe");this.iframe.style.cssText=this.iframeCSS;b&&(this.iframe.style.transformOrigin="50% 0");setTimeout((()=>{this.resize()}),0);return this.iframe}r(`Interscroller: Target element '${this.elementId}' not found`)}reset(){this.wrapper.remove();this.element.style.height=this.originalHeight;const e=window.cpexPackage.customAds;e&&delete e[this.elementId]}}class _{constructor(e,t,i,s,d){this.type="native";this.loaded=!1;this.elementId=e;this.adUnit=d;this.settings=t;this.width=i;this.height=s;this.config=t.adUnitConfig?t.adUnitConfig[d||e]:null;this.processDataAd=this.processDataAd.bind(this);window.addEventListener("message",this.processDataAd,!1);n("Native: Caught Native custom format, in elementId "+e)}render(e){this.element=document.getElementById(this.elementId);const t=this.getTemplate();this.element.innerHTML+=(i=e,s=t,n=this.config,k(s,{link:i.clickUrl,title:E(i.title,n?.titleLength||45),desc:i.body?E(i.body,n?.descLength||90):"",img:i.image?.url,sponsor:i.sponsoredBy||i.sponsored||""}));var i,s,n}addPrebidEvents(e){const t={message:"Prebid Native",adId:e.adId};window.postMessage(JSON.stringify(t));this.element.querySelector("a").addEventListener("click",(()=>{window.postMessage(JSON.stringify({action:"click",...t}))}))}getTemplate(){let e=F;if(this.settings.templates){let t=!1;for(const i in this.settings.templates){const s=i.split(",");for(const n of s)if(n===this.elementId){t=!0;e=this.settings.templates[i];e in this.settings.templates&&(e=this.settings.templates[e])}}!1===t&&this.settings.templates.generic&&(e=this.settings.templates.generic)}return e}processDataAd(e){if(this.iframe&&e.source===this.iframe.contentWindow&&void 0!==e.data&&"native"===e.data.creativeType){if(void 0!==e.data.data){n("Native: Correct postMessage received");const t=JSON.parse(C(e.data.data));if(t.native){const i=this.getTemplate();e.data.clickTag&&(t.native.link.url=e.data.clickTag);x(this.element);this.element.innerHTML+=T(t.native,i,this.config);L(e.data)}else r("Native: Missing Native data")}else r("Native: Ad is missing base64 encoded creative data in postMessage");window.removeEventListener("message",this.processDataAd,!1)}}prepareIframe(){this.element=document.getElementById(this.elementId);if(this.element){this.iframe=y(this.element,{width:548,height:150,id:this.elementId+"-iframe"},(e=>{this.loaded=!0;n("Native: Rendered into "+this.elementId);this.iframe.contentWindow.postMessage({response:"cpexHTML5",caf:!0},"*")}));return this.iframe}r(`Native: Target element '${this.elementId}' not found`)}reset(){const e=window.cpexPackage.customAds;e&&delete e[this.elementId];window.removeEventListener("message",this.processDataAd,!1)}}const F="<style>\n .cpex-native a { display: flex; text-decoration: none; color: inherit }\n .cpex-native img { width: 200px; object-fit: cover }\n .cpex-native .text { padding-left: 20px }\n</style>\n<div class='cpex-native'>\n <a href='${link}' target='_blank' id='cpexNativeLink' rel='sponsored noopener' >\n <img src='${img}'>\n <div class='text'>\n <h2>${title}</h2>\n <p>${desc}</p>\n </div>\n </a>\n</div>";class W{constructor(e,t,i,s){this.type="slideup";this.loaded=!1;this.elementId=e;this.settings=t;this.width=i;this.height=s;this.iframeCSS="margin:auto; border:none; display:block; overflow:hidden; background-color:#FFF; max-width: initial; ";n("Slideup: Caught Slideup custom format, in elementId "+e)}resize(){const e=document.documentElement.clientWidth||window.innerWidth;if(this.adWidth>e){const t=e/this.adWidth,i=Math.ceil(this.adHeight*t);this.element.style.height=i+"px";this.wrapper.style.width=this.adWidth+"px";this.wrapper.style.transform=`scale(${t})`;this.wrapper.style.transformOrigin="right top";this.closeButton.style.transform="scale("+1/t+")";this.closeButton.style.transformOrigin="right bottom"}}prepareIframe(e,t){this.adWidth=e;this.adHeight=t||this.settings.emptyHeight;this.iframeCSS+=`width: ${e}px; height: ${t}px`;const i=this.settings.animationSpeed||.2,s=this.settings.backgroundEl||document.body;m(`\n .cpex-slideup-open { transform: translateY(${-this.adHeight}px); transition: transform ${i}s ease-out }\n .cpex-slideup-close { transform: translateY(${this.adHeight}px); transition: transform ${i}s ease-in }\n `);this.element=document.createElement("div");this.element.id="cpex-slideup";this.element.style.cssText=`position: fixed; bottom: 0px; margin-bottom: -${this.adHeight}px; right: 0px; width: ${this.adWidth}`;s.appendChild(this.element);this.wrapper=document.createElement("div");this.wrapper.id="cpex-slideup-wrapper";this.wrapper.style.cssText="position: relative; margin: auto";this.element.appendChild(this.wrapper);this.originalElement=document.getElementById(this.elementId);this.originalElement.setAttribute("data-target-id-moved",this.element.id);this.originalElement.style.display="none";this.iframe=y(this.wrapper,{id:this.elementId+"-iframe"},(e=>{this.loaded=!0;this.closeButton=document.createElement("span");this.closeButton.id="cpex-slideup-close";this.closeButton.tabIndex=0;this.closeButton.innerHTML=this.settings.closeTextHTML||G;this.closeButton.onclick=()=>this.close();this.closeButton.addEventListener("click",(()=>{this.close()}));this.closeButton.addEventListener("keyup",(e=>{13!==e.keyCode&&32!==e.keyCode||this.close()}));this.wrapper.appendChild(this.closeButton);this.element.classList.add("cpex-slideup-open");m(void 0!==this.settings&&this.settings.css||$);this.resize();window.addEventListener("resize",(()=>this.resize()));n("Slideup: Rendered")}));this.iframe.style.cssText=this.iframeCSS;return this.iframe}close(){window.dispatchEvent(new window.CustomEvent("cpexSlideupClosed",{detail:this}));this.element.classList.add("cpex-slideup-close");this.element.addEventListener("transitionend",(()=>{this.reset()}))}reset(){const e=window.cpexPackage.customAds;e&&delete e[this.elementId];this.element.remove()}}const $="\n #cpex-slideup {\n background-color: #FFF8;\n z-index: 9999;\n }\n #cpex-slideup-close {\n box-sizing: border-box;\n display: inline-block;\n cursor: pointer;\n position: absolute;\n top: -40px;\n right: 0px;\n height: 40px;\n padding: 10px;\n background-color: #0008;\n font-size: 12pt;\n color: #fff;\n }\n #cpex-slideup-close:hover {\n background-color: #000;\n }\n",G="Zavřít&nbsp;&nbsp;✕";class q{constructor(e,t,i,s){this.type="vignette";this.loaded=!1;this.elementId=e;this.settings=t;this.width=i;this.height=s;this.iframeCSS="margin:auto; border:none; display:block; overflow:hidden; position:relative; top:50%; transform:translateY(-50%);";this.processNativeData=this.processNativeData.bind(this);window.addEventListener("message",this.processNativeData,!1);n("Vignette: Caught Vignette custom format, in elementId "+e)}processNativeData(e){if(void 0!==e.data&&"native"===e.data.creativeType){if(void 0!==e.data.data){n("Vignette: Correct postMessage received");const t=JSON.parse(C(e.data.data));if(t.native){const i=T(t.native,K);this.renderNativeVignette(i);L(e.data)}else r("Vignette: Missing Native data")}else r("Vignette: Ad is missing base64 encoded creative data in postMessage");window.removeEventListener("message",this.processDataAd,!1)}}renderNativeVignette(e){const t=document.createElement("div");t.id="cpex-vignette-native-wrapper";t.innerHTML=e;this.element.appendChild(t);this.iframe.style.display="none"}resize(){const e=document.documentElement.clientWidth||window.innerWidth;if(this.adWidth>e){const t=e/this.adWidth;this.iframe.style.transform=`scale(${t}) translateY(-50%)`;this.iframe.style.transformOrigin="left top"}}prepareIframe(e,t){this.adWidth=e;this.adHeight=t;this.iframeCSS+=`width: ${e}px; height: ${t}px`;const i=this.settings.backgroundEl||document.body;this.element=P("div",i,{id:"cpex-vignette"});this.element.style.cssText="position: fixed; top: 0px; left: 0px; width: 100%; height: 100%; text-align: center";const s=document.getElementById(this.elementId);s.setAttribute("data-target-id-moved",this.element.id);s.style.display="none";m(void 0!==this.settings&&this.settings.css||V);this.header=P("div",this.element,{id:"cpex-vignette-header",innerHTML:"reklama"});this.closeButton=P("button",this.element,{id:"cpex-vignette-close",tabIndex:0,innerHTML:this.settings.closeTextHTML});this.closeButton.focus();this.closeButton.addEventListener("click",(()=>{this.reset()}));this.closeButton.addEventListener("keyup",(e=>{"Enter"!==e.key&&"Spacebar"!==e.key&&"Escape"!==e.key||this.reset()}));this.iframe=y(this.element,{id:this.elementId+"-iframe"},(e=>{this.loaded=!0;n("Vignette: Rendered");this.iframe.contentWindow.postMessage({response:"cpexHTML5",caf:!0},"*");this.resize();window.addEventListener("resize",(()=>this.resize()))}));this.iframe.style.cssText=this.iframeCSS;this.settings.cookieName&&this.settings.cookieDuration&&function(e,t,i="true",s){const n=new Date;n.setTime(n.getTime()+1e3*t);if(s)s+="; SameSite=None; Secure";else{const e=location.hostname.split(".");e.shift();s=e.join(".")}const d=e+"="+i+"; expires="+n.toUTCString()+"; path=/; domain="+s;document.cookie=d}(this.settings.cookieName,this.settings.cookieDuration);return this.iframe}reset(){const e=window.cpexPackage.customAds;e&&delete e[this.elementId];this.element.remove()}}const V="\n #cpex-vignette {\n background-color: #000D;\n z-index: 2147483642;\n }\n #cpex-vignette-header {\n display: none;\n }\n #cpex-vignette-close {\n position: fixed;\n right: 20px;\n top: 20px;\n box-sizing: border-box;\n display: inline-block;\n cursor: pointer;\n height: 40px;\n padding: 10px;\n font-size: 12pt;\n border: none;\n background-color: #FFFC;\n border-radius: 4px;\n color: #000;\n }\n #cpex-vignette-close:hover {\n background-color: #FFF;\n }\n",K="\n <style>\n #cpex-vignette-native { position: absolute; top: 0px; left: 0px; width: 100%; height: 100%; z-index: 100 }\n #cpex-vignette-native center { position: relative; top: 50%; transform: translateY(-50%) }\n #cpex-vignette-native a { display: block; text-decoration: none; color: inherit }\n #cpex-vignette-native img { width: 400px; object-fit: cover }\n #cpex-vignette-native p { color: white; margin: 1em; margin-bottom: 2em }\n #cpex-vignette-native span { box-sizing: border-box; display: inline-block; cursor: pointer; height: 40px; padding: 10px; font-size: 12pt; border: none; background-color: #FFFC; color: #000; border-radius: 4px }\n #cpex-vignette-native span:hover { background-color: #FFF }\n </style>\n <div id='cpex-vignette-native'>\n <center>\n <a href='${link}' target='_blank' >\n <img src='${img}'>\n <p>\n <h2>${title}</h2>\n <p>${desc}</p>\n </p>\n <span>Zobrazit více</span>\n </a>\n <center>\n </div>";class X{constructor(e,t,i,s){this.type="responsive";this.loaded=!1;this.elementId=e;this.settings=t;this.width=i;this.height=s;this.iframeCSS=`width: ${i}px; max-width: ${i}px; height: ${s}px; max-height: ${s}px; margin:auto; border:none; display:block; overflow:hidden; background-color:#FFF; `;n("Responsive: Caught Responsive custom format, in elementId "+e)}resize(){if(this.adWidth>document.documentElement.clientWidth){this.wrapper.style.transformOrigin="left top";const e=this.actualWidth/this.adWidth;this.wrapper.style.transform="scale("+e+")";this.wrapper.style.width=this.adWidth*e+"px";this.wrapper.style.height=this.adHeight*e+"px"}else this.wrapper.style.transform="scale(1)"}prepareIframe(e,t){this.element=document.getElementById(this.elementId);this.wrapper=document.createElement("div");this.wrapper.style.display="inline-block";this.element.appendChild(this.wrapper);this.adWidth=e;this.adHeight=t;this.element.style.width="100%";this.actualWidth=this.element.clientWidth;this.iframe=y(this.wrapper,{id:this.elementId+"-iframe",width:this.width,height:this.height},(e=>{this.loaded=!0;this.resize();window.addEventListener("resize",(()=>this.resize()));n("Responsive: Rendered")}));this.iframe.style.cssText=this.iframeCSS;return this.iframe}}class J{constructor(e){this.main=e}match(e,t,i){let s=!1;this.isSkin(t,i)&&(s="skin");this.isInterscroller(t,i,e)&&(s="interscroller");this.isNative(t,i)&&(s="native");this.isVignette(e)&&(s="vignette");this.isSlideup(e)&&(s="slideup");this.isResponsive(e,t,i)&&(s="responsive");return s}isSkin(e,t){return 2e3===e&&1400===t}isInterscroller(e,t,i){const s=480===e&&820===t||720===e&&1280===t||768===e&&1230===t;return this.main.settings.formats.interscroller?.adUnits?this.main.settings.formats.interscroller?.adUnits.includes(i)&&s:s}isNative(e,t){return 548===e&&150===t}isVignette(e){return this.main.settings.formats.vignette?.adUnits?.includes(e)}isSlideup(e){return this.main.settings.formats.slideup?.adUnits?.includes(e)}isResponsive(e,t,i){return this.main.settings.formats.responsive?.adUnits?.includes(e)&&this.main.settings.formats.responsive.width===t&&this.main.settings.formats.responsive.height===i}create(e,t,i,s,n){const d=this.main.settings.formats;switch(e){case"skin":return new z(t,d.skin,i,s);case"native":return new _(t,d.native,i,s,n);case"slideup":return new W(t,d.slideup,i,s);case"vignette":return new q(t,d.vignette,i,s);case"interscroller":return new N(t,d.interscroller,i,s);case"responsive":return new X(t,d.responsive,i,s)}}dmMatchAndPrepare(e,t,i){const s=function(e){for(const t of window.googletag.pubads().getSlots())if(t.getSlotId().getName()===e)return t}(e),n=s.getSlotElementId(),d=this.match(n,t,i);return!!d&&this.prepareIframe(d,n,t,i,null,e)}prepareIframe(e,t,i,s,d,a){n("Formats: Rendering CPEx custom format: "+e);const r=this.create(e,t,i,s,a);this.main.customAds[t]=r;window.dispatchEvent(new window.Event("cpexCustomFormatAdded",{detail:r}));this.main.regularAds[t]&&delete this.main.regularAds[t];r.iframe=r.prepareIframe(i,s);Object.assign(r.iframe,d);return r.iframe}}class Z{constructor(){this.loaded=!1;this.settingsLoaded=!1;this.loading=new Promise(((e,t)=>{this.loadResolve=e;this.loadReject=t}));this.version="3.7.4 - 12. 1. 2024";this.localhost=window.location.href.indexOf("localhost:")>-1;this.playground=window.location.href.indexOf("playground.cpex.cz")>-1;this.debugMode=!!window.localStorage.getItem("cpexPackage")||this.localhost||this.playground||window.location.href.indexOf("debug")>-1;this.hasAdblock=!1;this.settings={};this.loadedSettings={};this.settingsDefault={publisher:{sellerId:"0"},website:{},general:{autoRun:!0},ab:{enabled:!1,sasKey:"cpexAB"},adserver:{enabled:!0,loadPrerequisites:!1,addConsent:!0,allowedSSPs:{pubmatic:1,index:3,magnite:4,xandr:5},bidderTable:{stroeerCore:"stroeer",appnexus:"xandr_hb",pubmatic:"pubmatic_hb",rubicon:"magnite_hb","rubicon-mask":"magnite_hb",adform:"adform","im-adform":"im-adform",r2b2:"r2b2",triplelift:"triplelift_hb",ix:"index_hb",smart:"smart",teads:"teads",rtbhouse:"rtbhouse"}},headerbidding:{enabled:!0,currency:"USD",auctionTimeoutMs:1e3,cmpLoadTimeoutMs:1e3,cmpActionTimeoutMs:2e3,adUnits:[],passbacks:{},prebidPath:"https://cdn.cpex.cz/hb/prebid/prebid.min.js",analytics:["cpexAnalytics"],userIDs:["id5Id","sharedId","criteo"]},formats:{slideup:{defaultHeight:0},vignette:{closeTextHTML:"Zavřít&nbsp;reklamu&nbsp;&nbsp;✕"},skin:{contentCSS:"position: relative; margin-top: 200px"},interscroller:{},native:{},responsive:{}},cmp:{enabled:!0,pixelList:["https://a.slunecnice.cz/slunecnice/SETSV/TTL=33696000/consent=%CONSENT%/GDPR=1","https://a.denik.cz/vlm/SETSV/TTL=33696000/consent=%CONSENT%/GDPR=1","https://a.1gr.cz/mafra/SETSV/TTL=33696000/consent=%CONSENT%/GDPR=1","https://a.centrum.cz/cent/SETSV/TTL=33696000/consent=%CONSENT%/GDPR=1","https://a.csfd.cz/csfd/SETSV/TTL=33696000/consent=%CONSENT%/GDPR=1"]}};u(this.settings,window.structuredClone(this.settingsDefault));this.ab={};this.regularAds={};this.customAds={};this.utils={addElement:P}}async init(){n("Main: CpexPackage init, version: "+window.cpexPackage.version);await this.load().catch((e=>r("Settings load failed",e)));this.settings.general.autoRun?this.run().catch((e=>r("Running failed",e))):"function"==typeof this.settings.general.customRun&&this.settings.general.customRun()}async load(){try{this.settingsLoaded=await this.loadSettings(1).catch((async e=>{await this.loadSettings(2).catch((e=>{r("Settings not loaded, tried two times",e)}))}));this.settingsLoaded&&n("Main: Settings have been loaded succesfully: ",this.settings);this.runQueue();"function"==typeof this.settings.general.beforeLoad&&this.settings.general.beforeLoad();this.overrideFromLocalStorage();if(this.settings.ab.enabled){this.ab.sasKey=this.settings.ab.sasKey;"function"==typeof this.settings.ab.selectGroup&&(this.ab.group=this.settings.ab.selectGroup());if(!this.ab.group){const e=Math.random();let t=0;for(const[i,{probability:s}]of Object.entries(this.settings.ab.groupList)){t+=s;t>1&&r("Main: Sum of AB testing probabilities is higher than 1");if(e<t){this.ab.group=i;this.ab.path=this.settings.ab.groupList[i].websiteSettings;break}}if(this.ab.path!==window.cpexPackageConfig.websiteSettingsPath){await p(this.ab.path,"Website settings").catch((e=>{console.error("AB Settings loading failed",e)}));this.reloadSettings()}}a(`Main: AB test enabled, current group: ${this.ab.group} (cpexPackage.ab.group)`)}this.formats=new J(this);this.cmp||(this.cmp=new j(this));if(this.settings.adserver.enabled){this.setAdServer();if(!this.adserver)return!1;this.adserver.load();if(this.settings.headerbidding.enabled){this.headerbidding=new U(this);this.headerbidding.load().catch((e=>r("Headerbidding loading failed",e)));await this.headerbidding.prebidLoadedPromise}else this.headerbidding=void 0}else if(this.settings.headerbidding.enabled){this.headerbidding=new U(this);this.headerbidding.load().catch((e=>r("Headerbidding loading failed",e)));await this.headerbidding.prebidLoadedPromise}window.dispatchEvent(new window.Event("cpexPackageLoaded"));"function"==typeof this.settings.general.onLoad&&this.settings.general.onLoad();!function(){window.cX=window.cX||{};window.cX.callQueue=window.cX.callQueue||[];window.cX.callQueue.push(["invoke",()=>{window.__tcfapi("addEventListener",2,((e,t)=>{if(!1!==t&&e.vendor.consents[570]&&window.Didomi.getUserConsentStatusForVendor("c:pomomedia-HZQX3YWL")){const e=window.cX.getUserSegmentIds({persistedQueryId:"51ff14b454af0cf4aedc891fee56b86c1aa69a31"});c(e)&&P("iframe",document.body,{src:"https://cdn.cpex.cz/cookies/save.html?name=exc&time=1209600&data="+encodeURIComponent(e.toString()),width:0,height:0})}}))}])}();!function(){window.cX=window.cX||{};window.cX.callQueue=window.cX.callQueue||[];window.cX.callQueue.push(["invoke",()=>{window.__tcfapi("addEventListener",2,((e,t)=>{if(!1!==t&&e.vendor.consents[570]){const e=window.cX.getCxenseUserId();e&&P("iframe",document.body,{src:"https://cdn.cpex.cz/cookies/save.html?name=excp&time=1209600&data="+encodeURIComponent(e),width:0,height:0})}}))}])}();n("Main: CpexPackage loaded");this.loaded=!0;this.loadResolve();return!0}catch(e){r("Loading failed",e);this.loadReject(e)}}async run(){n("Main: CpexPackage running");if(this.headerbidding&&this.settings.headerbidding.enabled&&"test"!==this.settings.adserver.adapter){await this.headerbidding.configure().catch((e=>r("HB configuration failed",e)));this.headerbidding.call()}else this.adserver&&this.settings.adserver.enabled?this.adserver.call():console.error("cpexPackage: Adserver failed to load")}async refresh(){n("Main: CpexPackage refreshing ads");this.clearAds();await this.loading;this.run().catch((e=>r("Refresh failed",e)))}async reload(){this.clearAds();n("Main: CpexPackage reloading");this.loaded=!1;this.loading=new Promise(((e,t)=>{this.loadResolve=e;this.loadReject=t}));await this.load().catch((e=>r("Settings reload failed",e)));this.run().catch((e=>r("Refresh failed",e)))}reloadSettings(){this.settings={};this.loadedSettings={};u(this.settings,window.structuredClone(this.settingsDefault));u(this.settings,window.cpexPublisherSettings);u(this.settings,window.cpexWebsiteSettings);u(this.loadedSettings,this.settings)}clearAds(e){if(e)e.forEach((e=>{if(e){const t=this.customAds[e];t&&t.reset();const i=this.regularAds[e];i&&i.element&&(i.element.innerHTML="");n("Main: "+e+" cleared")}}));else{for(const e in this.customAds){const t=this.customAds[e];t.reset&&t.reset()}this.customAds={};for(const e in this.regularAds){const t=this.regularAds[e];t.element&&(t.element.innerHTML="")}this.regularAds={};n("Main: Ads cleared")}}registerAd(e){return this.regularAds[e]={element:document.getElementById(e)}}async loadSettings(e){this.settings={};this.loadedSettings={};u(this.settings,window.structuredClone(this.settingsDefault));const t=window.cpexPackageConfig;if(o(t))try{if(!t.publisherSettingsPath&&!t.websiteSettingsPath)throw new Error("Main: Config is missing paths");await Promise.all([p(t.publisherSettingsPath,"Publisher settings"),p(t.websiteSettingsPath,"Website settings")]).catch((e=>console.error("Settings loading failed",e)));if(!window.cpexPublisherSettings||!window.cpexPublisherSettings){2===e?r("Both setting files not loaded, tried two times"):console.error("Both settings not loaded");return!1}window.cpexPublisherSettings?u(this.settings,window.cpexPublisherSettings):r("Production error in publisher settings");window.cpexWebsiteSettings?u(this.settings,window.cpexWebsiteSettings):r("Production error in website settings");u(this.loadedSettings,this.settings);this.settingsLoaded=!0;return!0}catch(e){throw function(){return new Error(i(arguments))}("Main: Failed to load settings. Error: ",e)}else r("Main: Missing window.cpexPackageConfig object, using default settings")}overrideFromLocalStorage(){try{const e=JSON.parse(window.localStorage.getItem("cpexPackage"));if(o(e)){u(this.settings,e);a('Main: Settings overriden from LocalStorage (key "cpexPackage")')}}catch(e){r("Main: LocalStorage parsing failed. Error: ",e)}}setAdServer(){if(!this.adserver||this.adserver.adapter!==this.settings.adserver.adapter)switch(this.settings.adserver.adapter){case"googletag":this.adserver=new M(this);break;case"sastracker":this.adserver=new R(this);break;case"sasic":this.adserver=new O(this);break;case"paticka":this.adserver=new H(this);break;case"test":this.adserver=new D(this);break;default:a("Main: Missing or unexpected adserver adapter name: "+this.settings.adserver.adapter)}}runQueue(){if(Array.isArray(window.cpexPackageQueue)){window.cpexPackageQueue.forEach((e=>{"function"==typeof e&&e()}));window.cpexPackageQueue=[]}}render(e,t,i,s){i=parseInt(i);s=parseInt(s);!1===this.settingsLoaded&&r("Trying to render while not fully loaded");const d=this.formats.match(e,i,s);if(d){if(this.settings.formats[d].enabled){if(document.getElementById(e)){A(this.formats.prepareIframe(d,e,i,s).contentWindow.document,t);window.dispatchEvent(new window.CustomEvent("cpexAdRendered",{detail:this.customAds[e]}))}else r(`Target element '${e}' for custom format rendering not found`);return!0}n(`Found ad that could be ${d} (CPEx custom format), but it's not enabled in settings`);return!1}this.regularAds[e]={element:document.getElementById(e)};window.dispatchEvent(new window.CustomEvent("cpexAdRendered",{detail:this.regularAds[e]}));return!1}renderAny(e,t,i,s){if(this.loaded){if(!1===this.render(e,t,i,s)){const n=document.getElementById(e),d=e+"-iframe",a=y(n,{width:parseInt(i),height:parseInt(s),id:d});this.regularAds[e]={type:"banner",elementId:e,element:n,iframe:a};A(a.contentWindow.document,t)}return!0}a("Trying to render while not fully loaded, adding to queue");window.cpexPackageQueue.push((()=>{window.cpexPackage.renderAny(e,t,i,s)}))}}if(window.cpexPackage)n("Main: CpexPackage already present");else{window.cpexPackage=new Z;window.dispatchEvent(new window.Event("cpexPackageAdded"));!1!==window.cpexPackageConfig?.autoInit&&window.cpexPackage.init()}n("Main: CpexPackage script added");v().then((()=>{n("Main: DOM loaded")}));return Z}();
+//# sourceMappingURL=cpex-package.min.js.map