(()=>{if(window.embiInterstitialLoaded)return void console.warn("EMBI Interstitial script ya estΓ‘ cargado. Abortando ejecuciΓ³n duplicada.");window.embiInterstitialLoaded=!0;const e=(window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth)<=768,t=3e4,n="100% 0px",i=!1,s={fetchMarginPercent:200,renderMarginPercent:100,mobileScaling:1},r={enabled:!0,loadDelay:100},d=(...e)=>i&&console.log(...e),o=(...e)=>console.warn(...e),a=(...e)=>console.error(...e),l=[];function c(e){try{const t=e.split(",");for(const e of t){const t=h(e);if(t)return t}return null}catch(t){return a("Error getting first location available with selectors:",e,t),null}}function h(e){try{return document.querySelector(e)}catch(t){return a("Error getting element with selector:",e,t),null}}function p(t,n=null){let i=0,s=0;if(t&&t.length>0&&t.forEach(e=>{if(Array.isArray(e)&&2===e.length){const[t,n]=e;t>i&&(i=t),n>s&&(s=n)}}),n){const t=e?n.adunitMobile:n.adunitDesktop;if(t&&t.mediaTypes&&t.mediaTypes.video&&t.mediaTypes.video.playerSize){t.mediaTypes.video.playerSize.forEach(e=>{if(Array.isArray(e)&&2===e.length){const[t,n]=e;t>i&&(i=t),n>s&&(s=n)}})}}return{maxWidth:i>0?`${i}px`:"none",maxHeight:s>0?`${s}px`:"none"}}!function(e,t){if(!document.querySelector(`script[src='${e}']`)){const n=document.createElement("script");n.async=t,n.type="text/javascript",n.src=e,document.head.appendChild(n)}}("https://securepubads.g.doubleclick.net/tag/js/gpt.js");var f=window.googletag=window.googletag||{};f.cmd=f.cmd||[];const m={visibleAds:new Set,hiddenAdsInViewport:new Set,sentinelObserver:null,refreshInterval:null,sentinels:new Map,lastRefreshTime:new Map,displayedAds:new Set,createSentinel(e,t){try{const n=document.createElement("div");return n.id=`sentinel_${e}`,n.className="ad-sentinel",n.style.cssText="\n position: absolute;\n width: 1px;\n height: 1px;\n opacity: 0;\n pointer-events: none;\n ",t.parentNode.insertBefore(n,t.nextSibling),this.sentinels.set(e,n),d(`Created sentinel for: ${e}`),n}catch(t){return a(`Error creating sentinel for ${e}:`,t),null}},shouldRefreshAd(e){if(!(this.visibleAds.has(e)||this.hiddenAdsInViewport.has(e)))return d(` ❌ ${e} not in viewport (visible or hidden)`),!1;const n=this.hiddenAdsInViewport.has(e);d(` πŸ“ ${e} is ${n?"hidden":"visible"} in viewport`);const i=this.lastRefreshTime.get(e);if(!i)return d(` βœ… ${e} ready for first refresh (never refreshed before)`),!0;const s=Date.now()-i,r=s>=t;return d(` ${r?"βœ…":"⏳"} ${e} time since refresh: ${Math.round(s/1e3)}s / ${t/1e3}s`),r},markDisplayed(e){if(!this.displayedAds.has(e)){this.displayedAds.add(e),d(`πŸ“Ί Ad marked as displayed: ${e}`);const t=document.getElementById(e);if(t){const n=t.getBoundingClientRect(),i=n.top0,s=0===n.width&&0===n.height;d(` - In viewport: ${i}, Hidden: ${s}, Size: ${n.width}x${n.height}`),i&&!s?(this.visibleAds.add(e),d(" - Added to visible ads immediately")):i&&s&&(this.hiddenAdsInViewport.add(e),d(" - Added to hidden ads in viewport"))}}},triggerAdRefresh(e,t="entered viewport"){try{l.find(t=>t.tagId===e);if(this.shouldRefreshAd(e)){d(`🎯 Triggering immediate refresh for ${e} (${t})`);const n=l.find(t=>t.tagId===e||t.tagId2===e);n&&(e===n.tagId&&n.adSlot?(f.pubads().refresh([n.adSlot]),this.lastRefreshTime.set(e,Date.now())):e===n.tagId2&&n.adSlotB&&(f.pubads().refresh([n.adSlotB]),this.lastRefreshTime.set(e,Date.now())))}else if(this.displayedAds.has(e)){const t=this.lastRefreshTime.get(e),n=Math.round((Date.now()-t)/1e3);d(`⏭️ Skipping refresh for ${e} (refreshed ${n}s ago)`)}else d(`⏭️ Skipping refresh for ${e} (not displayed yet)`)}catch(t){a(`Error triggering refresh for ${e}:`,t)}},initialize(){try{this.sentinelObserver=new IntersectionObserver(e=>{e.forEach(e=>{const t=e.target.id.replace("sentinel_","");if(d(`πŸ” Sentinel check: ${t}, intersecting: ${e.isIntersecting}`),e.isIntersecting){const e=document.getElementById(t);if(e){const n=e.getBoundingClientRect(),i=0===n.width&&0===n.height;if(d(` - Ad dimensions: ${n.width}x${n.height}, isHidden: ${i}`),i){const e=this.hiddenAdsInViewport.has(t);this.hiddenAdsInViewport.add(t),this.visibleAds.delete(t),d(`πŸ” Hidden ad in viewport: ${t}`),!e&&this.shouldRefreshAd(t)&&this.triggerAdRefresh(t,"hidden ad entered viewport")}else{const e=this.visibleAds.has(t);this.visibleAds.add(t),this.hiddenAdsInViewport.delete(t),d(`πŸ” Visible ad in viewport: ${t}`),!e&&this.shouldRefreshAd(t)&&this.triggerAdRefresh(t,"visible ad entered viewport")}}}else this.hiddenAdsInViewport.delete(t),this.visibleAds.delete(t),d(`πŸ” Ad left viewport: ${t}`)}),d(`βœ… Visible ads: ${this.visibleAds.size}, Hidden in viewport: ${this.hiddenAdsInViewport.size}`)},{rootMargin:n,threshold:0});const e=function(){const e=[];return l.forEach(t=>{t.tagId&&e.push(t.tagId),t.tagId2&&e.push(t.tagId2)}),e}();let i=0;e.forEach(e=>{const t=document.getElementById(e);if(t){const n=this.createSentinel(e,t);n&&(this.sentinelObserver.observe(n),i++,d(`πŸ‘οΈ Observing sentinel for: ${e}`))}else o(`⚠️ Element not found for observation: ${e}`)}),this.startRefreshTimer(),d(`βœ… Fast refresh system initialized: ${i}/${e.length} ad units observed (GPT-only, sentinel-only)`),d(` - Refresh interval: ${t/1e3}s`),d(` - Observer margin: ${n}`)}catch(e){a("Error initializing refresh manager:",e)}},startRefreshTimer(){this.refreshInterval=setInterval(()=>{this.refreshVisibleAds()},t)},refreshVisibleAds(){try{const e=new Set;if(this.visibleAds.forEach(t=>e.add(t)),this.hiddenAdsInViewport.forEach(t=>e.add(t)),0===e.size)return void d("⏭️ No ads in refresh range");d(`πŸ”„ Periodic refresh: ${e.size} ad(s) (${this.visibleAds.size} visible + ${this.hiddenAdsInViewport.size} hidden)`),e.forEach(e=>{try{const n=document.getElementById(e),i=this.shouldRefreshAd(e);if(d(`πŸ” Checking ${e}: element=${!!n}, shouldRefresh=${i}, displayed=${this.displayedAds.has(e)}`),n&&i){d(`βœ… Refreshing ad: ${e}`);const t=l.find(t=>t.tagId===e||t.tagId2===e);t?e===t.tagId&&t.adSlot?(f.pubads().refresh([t.adSlot]),this.lastRefreshTime.set(e,Date.now()),d(`βœ… Refreshed successfully: ${e} (slot 1)`)):e===t.tagId2&&t.adSlotB?(f.pubads().refresh([t.adSlotB]),this.lastRefreshTime.set(e,Date.now()),d(`βœ… Refreshed successfully: ${e} (slot 2)`)):o(`⚠️ No matching adSlot found for ${e}`):o(`⚠️ No product found for ${e}`)}else if(n)if(this.displayedAds.has(e)){const n=this.lastRefreshTime.get(e),i=Math.round((Date.now()-n)/1e3);d(`⏭️ Skipping ${e} (refreshed ${i}s ago, interval: ${t/1e3}s)`)}else d(`⏭️ Skipping ${e} (not displayed yet)`);else o(`⚠️ Element not found: ${e}`)}catch(t){a(`Error refreshing ${e}:`,t)}})}catch(e){a("Error in refreshVisibleAds:",e)}},destroy(){this.sentinelObserver&&this.sentinelObserver.disconnect(),this.refreshInterval&&clearInterval(this.refreshInterval),this.sentinels.forEach(e=>{try{e&&e.parentNode&&e.parentNode.removeChild(e)}catch(e){a("Error removing sentinel:",e)}}),this.sentinels.clear(),this.lastRefreshTime.clear(),this.displayedAds.clear(),this.visibleAds.clear(),this.hiddenAdsInViewport.clear(),d("RefreshManager cleanup complete")}};function u(t){try{if(t.manualInsertion&&"TABOOLA_INTEGRATION"!==t.type){const s=t.tagId;new MutationObserver((e,t)=>{document.getElementById(s)&&(f.cmd.push(function(){f.display(s)}),t.disconnect())}).observe(document.body,{childList:!0,subtree:!0})}else{const r=t.type,d=t.position,l=t.ubication,h=t.tagId,m=t.offset;function n(e,t){const n=document.createElement("script");n.textContent=`\n googletag.cmd.push(function() {\n googletag.display('${t}');\n });\n `,e.appendChild(n)}try{if("TABOOLA_INTEGRATION"===r)createTaboolaContainer(t);else if("HIGH_IMPACT"===r)INTERSTITIAL_CONTAINER=createInterstitialContainer(h);else if("DISPLAY_VIDEO_STICKY"===r)cornerContainer=createCornerContainer(h,d,m);else if("FOOTER_INTOP"===r)footerInTopContainer=createfooterInTopContainer(h,d);else if("DOUBLE_BOX"===r){const u=c(`${l}`);if(!u)return a(`Elemento con clase '${l}' no encontrado en el DOM para el anuncio ${h}. No se pudo insertar el DIV.`),!1;const g=t.tagId2,y=e?t.mobileSizes:t.desktopSizes,{maxWidth:v,maxHeight:I}=p(y,t),E=document.createElement("div");E.id=`container_${h}`,(i=E).style.display="flex",i.style.flexDirection=e?"column":"row",i.style.gap="24px",i.style.marginBottom="24px",i.style.background="transparent",i.style.justifyContent="center";const b=document.createElement("div");b.id=`wrapper_${h}`,b.className="ad-slot-wrapper",b.style.maxWidth=v,b.style.maxHeight=I,b.style.overflow="hidden",b.style.display="flex",b.style.justifyContent="center",b.style.alignItems="center";const w=document.createElement("div");w.id=h,w.className="ad-slot",w.style.minHeight="1px";const $=document.createElement("script");$.textContent=`\n googletag.cmd.push(function() {\n googletag.display('${h}');\n });\n `,w.appendChild($),b.appendChild(w),E.appendChild(b);const A=document.createElement("div");A.id=`wrapper_${g}`,A.className="ad-slot-wrapper",A.style.maxWidth=v,A.style.maxHeight=I,A.style.overflow="hidden",A.style.display="flex",A.style.justifyContent="center",A.style.alignItems="center";const S=document.createElement("div");S.id=g,S.className="ad-slot",S.style.minHeight="1px";const T=document.createElement("script");switch(T.textContent=`\n googletag.cmd.push(function() {\n googletag.display('${g}');\n });\n `,S.appendChild(T),A.appendChild(S),E.appendChild(A),d){case"INSERT_BEFORE":u.insertAdjacentElement("beforebegin",E);break;case"INSERT_AFTER":u.insertAdjacentElement("afterend",E);break;default:u.appendChild(E)}}else if("DISPLAY_VIDEO"===r){const x=c(`${l}`);if(!x)return void a(`Elemento con clase '${l}' no encontrado en el DOM para el anuncio ${h}.`);const R=e?t.mobileSizes:t.desktopSizes,{maxWidth:N,maxHeight:C}=p(R,t),O=document.createElement("div");O.id=`wrapper_${h}`,O.className="ad-slot-wrapper",O.style.maxWidth=N,O.style.maxHeight=C,O.style.overflow="hidden",O.style.margin="0 auto 24px",O.style.display="flex",O.style.justifyContent="center",O.style.alignItems="center";const B=document.createElement("div");switch(B.id=h,B.className="ad-slot",B.style.minHeight="1px",n(B,h),O.appendChild(B),d){case"INSERT_BEFORE":x.insertAdjacentElement("beforebegin",O);break;case"INSERT_AFTER":x.insertAdjacentElement("afterend",O);break;default:x.appendChild(O)}}else if(t.isSticky)cornerContainer=createCornerContainer(h,d),n(cornerContainer,h);else{const _=c(`${l}`);if(!_)return void a(`Elemento con clase '${l}' no encontrado en el DOM para el anuncio ${h}.`);const z=e?t.mobileSizes:t.desktopSizes,{maxWidth:D,maxHeight:k}=p(z,t),M=document.createElement("div");M.id=`wrapper_${h}`,M.className="ad-slot-wrapper",M.style.maxWidth=D,M.style.maxHeight=k,M.style.overflow="hidden",M.style.margin="0 auto 24px",M.style.display="flex",M.style.justifyContent="center",M.style.alignItems="center";const L=document.createElement("div");switch(L.id=h,L.className="ad-slot",L.style.minHeight="1px",n(L,h),M.appendChild(L),d){case"INSERT_BEFORE":_.insertAdjacentElement("beforebegin",M);break;case"INSERT_AFTER":_.insertAdjacentElement("afterend",M);break;default:_.appendChild(M)}}}catch(V){a(`Error procesando el anuncio ${h}:`,V)}}}catch(H){o("Error rendering adunit for product",t.tagId,H)}var i}function g(){try{l.map(e=>{u(e)}),setTimeout(()=>{d("πŸ”„ Initializing fast refresh system (GPT-only)..."),m.initialize()},r.loadDelay)}catch(e){a("Error in mainInitialization:",e)}finally{d("βœ… EMBI ad system initialized successfully (GPT-only)")}}f.cmd.push(function(){if(l.filter(e=>"TABOOLA_INTEGRATION"!==e.type).forEach(t=>{try{const n=e?t.mobileSizes:t.desktopSizes;t.adSlot=f.defineSlot(t.slot,n,t.tagId).setForceSafeFrame(!1).addService(f.pubads()),"DOUBLE_BOX"===t.type&&(t.adSlotB=f.defineSlot(t.slot2,n,t.tagId2).setForceSafeFrame(!1).addService(f.pubads())),d(`GPT slot defined: ${t.tagId}`)}catch(e){a("Error creating GPT slot for product",t.tagId,e)}}),r.enabled){l.some(e=>e.loadImmediately)&&(f.pubads().enableSingleRequest(),d("Single Request enabled for priority ads"))}f.pubads().enableLazyLoad(s),f.pubads().collapseEmptyDivs(!0),f.pubads().setCentering(!0),f.enableServices(),d("GPT configuration complete")}),"loading"===document.readyState?document.addEventListener("DOMContentLoaded",g):g()})(),function(){const{adId:e,selector:t,position:n,width:i,height:s,lazyLoad:r,lazyLoadMargin:d}={adId:"18380",selector:"div > div.entry-content > div.wprt-container > p:nth-child(2)",position:"INSERT_AFTER",width:"auto",height:"auto",lazyLoad:!0,lazyLoadMargin:"600px"};if(!e)throw new Error("adId is required");const o=isNaN(i)?i:`${i}px`,a=isNaN(s)?s:`${s}px`,l=`_vidverto-${e}-${Math.random().toString(36).substring(2,15)}`;var c=null;if(!t)c=document.currentScript;function h(){var i=document.createElement("script");if(i.id=l,i.innerHTML='!function(v,t,o){var a=t.createElement("script");a.src="https://ad.vidverto.io/vidverto/js/aries/v1/invocation.js",a.setAttribute("fetchpriority","high");var r=v.top;r.document.head.appendChild(a),v.self!==v.top&&(v.frameElement.style.cssText="width:0px!important;height:0px!important;"),r.aries=r.aries||{},r.aries.v1=r.aries.v1||{commands:[]};var c=r.aries.v1;c.commands.push((function(){var d=document.getElementById("'+l+'");if(d){d.setAttribute("id",(d.getAttribute("id")+(new Date()).getTime()));var t=v.frameElement||d;c.mount("'+e+'",t,{width:"'+o+'",height:"'+a+'"})}}))}(window,document);',t){var s=document.querySelector(t);if(!s)return void console.warn("VidVerto: Element not found: "+t);switch(n){case"INSERT_AFTER":s.parentNode.insertBefore(i,s.nextSibling);break;case"INSERT_INSIDE":s.appendChild(i);break;default:s.parentNode.insertBefore(i,s)}}else c&&c.parentNode?c.parentNode.insertBefore(i,c.nextSibling):document.body.appendChild(i)}if(r){function p(){if("IntersectionObserver"in window){var e=document.createElement("div");if(e.style.cssText="width:1px;height:1px;visibility:hidden;pointer-events:none;",t){var i=document.querySelector(t);if(!i)return void console.warn("VidVerto: Element not found: "+t);switch(n){case"INSERT_AFTER":i.parentNode.insertBefore(e,i.nextSibling);break;case"INSERT_INSIDE":i.appendChild(e);break;default:i.parentNode.insertBefore(e,i)}}else c&&c.parentNode?c.parentNode.insertBefore(e,c.nextSibling):document.body.appendChild(e);var s=new IntersectionObserver(function(t){t.forEach(function(t){t.isIntersecting&&(console.log("Ad is visible, loading..."),s.disconnect(),e.remove(),h())})},{rootMargin:d});s.observe(e)}else h()}"loading"===document.readyState?document.addEventListener("DOMContentLoaded",p):p()}else"loading"===document.readyState?document.addEventListener("DOMContentLoaded",h):h()}();