!function(n,t){var define;"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["teads-fellow"]=t():n["teads-fellow"]=t()}(this,(()=>(()=>{"use strict";var n,t,e={},o={};function i(n){var t=o[n];if(void 0!==t)return t.exports;var a=o[n]={exports:{}};return e[n](a,a.exports,i),a.exports}i.m=e,i.d=(n,t)=>{for(var e in t)i.o(t,e)&&!i.o(n,e)&&Object.defineProperty(n,e,{enumerable:!0,get:t[e]})},i.f={},i.e=n=>Promise.all(Object.keys(i.f).reduce(((t,e)=>(i.f[e](n,t),t)),[])),i.u=n=>n+".js",i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(n){if("object"==typeof window)return window}}(),i.o=(n,t)=>Object.prototype.hasOwnProperty.call(n,t),n={},t="performance-tracker:",i.l=(e,o,a,r)=>{if(n[e])n[e].push(o);else{var c,s;if(void 0!==a)for(var d=document.getElementsByTagName("script"),u=0;u{c.onerror=c.onload=null,clearTimeout(w);var i=n[e];if(delete n[e],c.parentNode&&c.parentNode.removeChild(c),i&&i.forEach((n=>n(o))),t)return t(o)},w=setTimeout(p.bind(null,void 0,{type:"timeout",target:c}),12e4);c.onerror=p.bind(null,c.onerror),c.onload=p.bind(null,c.onload),s&&document.head.appendChild(c)}},i.r=n=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})},(()=>{var n;i.g.importScripts&&(n=i.g.location+"");var t=i.g.document;if(!n&&t&&(t.currentScript&&(n=t.currentScript.src),!n)){var e=t.getElementsByTagName("script");if(e.length)for(var o=e.length-1;o>-1&&(!n||!/^http(s?):/.test(n));)n=e[o--].src}if(!n)throw new Error("Automatic publicPath is not supported in this browser");n=n.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),i.p=n})(),(()=>{var n={284:0};i.f.j=(t,e)=>{var o=i.o(n,t)?n[t]:void 0;if(0!==o)if(o)e.push(o[2]);else{var a=new Promise(((e,i)=>o=n[t]=[e,i]));e.push(o[2]=a);var r=i.p+i.u(t),c=new Error;i.l(r,(e=>{if(i.o(n,t)&&(0!==(o=n[t])&&(n[t]=void 0),o)){var a=e&&("load"===e.type?"missing":e.type),r=e&&e.target&&e.target.src;c.message="Loading chunk "+t+" failed.\n("+a+": "+r+")",c.name="ChunkLoadError",c.type=a,c.request=r,o[1](c)}}),"chunk-"+t,t)}};var t=(t,e)=>{var o,a,[r,c,s]=e,d=0;if(r.some((t=>0!==n[t]))){for(o in c)i.o(c,o)&&(i.m[o]=c[o]);s&&s(i)}for(t&&t(e);d{m=n};function z(){if(void 0!==window.teads&&void 0!==window.teads.advertiserId){if("number"==typeof window.teads.advertiserId)return window.teads.advertiserId}else{if(void 0===window.teads_cv||void 0===window.teads_cv.advertiserId)return window.teads_adv_id;if("number"==typeof window.teads_cv.advertiserId)return window.teads_cv.advertiserId}}function Z(){return window.teads_env&&[f,g].includes(window.teads_env)?window.teads_env:f}const Y="https://l.teads.tv/performance/http-source",$={INTERNAL:"internal",BAD_INTEGRATION:"bad_integration"};function H(n){return"[object Function]"===toString.call(n)}function Q(n){let t="";const e=function(n){let t=n,e=!1;try{for(let n=0;t.parent.document!==t.document||n<50;n+=1){if(!t.parent.document){e=!0;break}t=t.parent}}catch(n){e=!0}return{topFrame:t,err:e}}(n),{topFrame:o}=e;if(e.err)try{t=o.top.location.href}catch(n){t=o.location.href}else t=o.location.href;return t}function nn(n,t,e){try{const o={errorMessage:n,topUrl:Q(window),userAgent:void 0!==window.navigator&&void 0!==window.navigator.userAgent?window.navigator.userAgent:"",exception:t||"",version:r,type:e||$.BAD_INTEGRATION};n=JSON.stringify(o)}catch(n){}document.createElement("img").src="".concat(Y,"?").concat(encodeURIComponent(n))}function tn(n){const t=["account","password","pass","secret","secretkey","username","user","login","ordernumber","orderid","email","mail","user.email","user.password","user.name","user.mail","user.lastname","user.firstname","user.phone","user.phonenumber","lastname","firstname","name","address","phonenumber","phone","client_secret","guid"];if(""!==n){const e=n.split("?").length>1?n.split("?")[1]:void 0;if(void 0!==e){let o="".concat(n.split("?")[0],"?");const i=e.split("&");for(let n=0;n=0?"XXXXXXXX":e[1])}n=o}}return n}function en(n){try{const t=new RegExp("(?:\\?|&|%3F|%26)auctid(?:=|%3D)([0-9a-zA-Z-_]*)").exec(n);if(t&&t.length>=2)return t[1]}catch(n){nn("Error when extracting Auction ID from url",null==n?void 0:n.message,$.INTERNAL)}}function on(n,t){var e,o;const i=z(),a=y(),c=Z(),s=function(n){const t=[];return Object.keys(n).forEach((e=>{t.push("".concat(e,"=").concat(encodeURIComponent(n[e])))})),t.join("&")}(t),u=Q(window),l=function(n){let t=M();if(!t){let e=n;n||(e=Q(window)),t=en(e),t&&(F(t),V("url"))}return t}(u),p=function(){const n=window.teads_auction_id_forwarded_by;return n?Object.keys(n).join(","):void 0}(),w=B(),_=J(),v=E(),f=P(),g=x(),m=j(),h=tn(u),b=function(){if(void 0!==window.teads_has_consent)return{hasConsent:window.teads_has_consent,type:window.teads_consent_handler_type}}();let I="?action=".concat(n,"&env=").concat(encodeURIComponent(c),"&tag_version=").concat(encodeURIComponent(r),"&provider=").concat(d);if(s.length>0&&(I="".concat(I,"&").concat(s)),void 0!==a?I="".concat(I,"&buyer_pixel_id=").concat(encodeURIComponent(a)):void 0!==i&&(I="".concat(I,"&advertiser_id=").concat(encodeURIComponent(i))),I="".concat(I,"&referer=").concat(encodeURIComponent(h)),("pageView"===n||"conversion"===n)&&document.referrer){const n=rn(document.referrer),t=rn(u);""!==n&&""!==t&&n!==t&&(I="".concat(I,"&prev_referrer=").concat(encodeURIComponent(n)))}return void 0!==l&&(I="".concat(I,"&auctid=").concat(l)),void 0!==p&&(I="".concat(I,"&cohort_id=").concat(p)),void 0!==w&&(I="".concat(I,"&user_session_id=").concat(w)),void 0!==_&&(I="".concat(I,"&firstPartyCookieTeadsId=").concat(_)),void 0!==(null==v||null===(e=v.data)||void 0===e?void 0:e.tcString)&&(I="".concat(I,"&gdpr_consent=").concat(v.data.tcString)),null!=g&&g.apply?I="".concat(I,"&gdpr_status=12"):void 0!==(null==g?void 0:g.apply)&&(I="".concat(I,"&gdpr_status=0")),g&&(void 0!==g.apply&&(I="".concat(I,"&gdpr_apply=").concat(g.apply)),void 0!==g.teadsConsent&&(I="".concat(I,">c=").concat(g.teadsConsent)),void 0!==g.isServiceSpecific&&(I="".concat(I,"&gdpr_is_service_specific=").concat(g.isServiceSpecific)),void 0!==g.cmpId&&(I="".concat(I,"&gdpr_cmp_id=").concat(g.cmpId)),void 0!==g.apiVersion&&(I="".concat(I,"&gdpr_api_version=").concat(g.apiVersion))),void 0!==(null==f||null===(o=f.data)||void 0===o?void 0:o.usPrivacy)&&(I="".concat(I,"&ccpa_consent=").concat(f.data.usPrivacy)),m&&(void 0!==m.apply&&(I="".concat(I,"&ca=").concat(m.apply)),void 0!==m.teadsConsent&&(I="".concat(I,"&ctc=").concat(m.teadsConsent))),b&&(I="".concat(I,"&hasConsent=").concat(b.hasConsent),I="".concat(I,"&cht=").concat(b.type)),I}const an=n=>(document.getElementsByTagName("head")[0]||document.getElementsByTagName("body")[0]||document.getElementsByTagName("script")[0].parentNode).insertBefore(n,null);function rn(n){try{return new URL(n).hostname}catch(n){return""}}const cn={auctionId:{key:"tfpai",maxAge:2592e3,isJson:!0},sessionId:{key:"tfpsi",maxAge:1800,isJson:!1},viewerId:{key:"tfpvi",maxAge:7776e3,isJson:!1}};function sn(n){try{_n(n,"",h(),0,"/","none",!0)}catch(t){nn('Error while deleting cookie on domain with key "'.concat(n,'"'),null==t?void 0:t.message,$.INTERNAL)}}function dn(n,t,e){try{_n(n,t,h(),e,"/","none",!0)}catch(t){nn('Error while setting cookie on domain with key "'.concat(n,'"'),null==t?void 0:t.message,$.INTERNAL)}}function un(n){const t="".concat(n,"="),e=document.cookie.split(";");for(let n=0;n1&&void 0!==arguments[1]?arguments[1]:{};return{type:n,id:null===(t=window)||void 0===t?void 0:t.name,ts:Date.now(),host:null===(e=window)||void 0===e||null===(e=e.location)||void 0===e?void 0:e.host,...o}}function mn(n){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"*";try{var o,i;const a=(null===(o=window)||void 0===o||null===(o=o.opener)||void 0===o?void 0:o.top)||(null===(i=window)||void 0===i?void 0:i.opener);H(a.postMessage)&&a.postMessage(gn(n,t),e)}catch(n){}}function hn(n){var t;let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"/";if(H(null===(t=window)||void 0===t?void 0:t.postMessage))try{window.postMessage(gn(n,e),o)}catch(n){}}function yn(n){var t,e,o,i,a;null!==(t=window)&&void 0!==t&&t.opener&&((null==n||null===(o=n.data)||void 0===o?void 0:o.type)===fn.PIXEL_DEBUG&&(window.teads_post_message_event_to_opener=true),(null==n||null===(i=n.data)||void 0===i?void 0:i.type)===fn.SDK_PARAMETERS&&null!=n&&null!==(a=n.data)&&void 0!==a&&a.teadsClickId&&(F(n.data.teadsClickId),V("postMessage"),pn())),(null==n||null===(e=n.data)||void 0===e?void 0:e.type)===fn.ASK_PIXEL_INFO&&(hn(fn.PIXEL_INFO,{buyerPixelId:y(),advertiserId:z(),trackingAllowed:X(),firstPartyCookieAllowed:W(),gdprAdvertiser:x(),ccpaAdvertiser:j(),advertiserDomain:h(),auctionId:M(),env:Z(),iabData:E(),uspData:P(),gppIabData:k(),referer:tn(Q(window)),trackingEventsSent:window.teads_tracking_events_sent||[],request:n.data}),window.teads_post_message_event_to_window=!0)}function bn(n){!function(n){const t=document.createElement("img");t.width=0,t.height=0,t.alt="",t.style.position="absolute",t.src=n,an(t)}(n),b()&&mn(fn.PIXEL_EVENT,{trackingUrl:n}),I()&&hn(fn.PIXEL_EVENT,{trackingUrl:n})}async function In(n,t){try{await fetch(n,{browsingTopics:!0,cache:"no-cache",credentials:"include",keepalive:!0}).then((()=>{b()&&mn(fn.PIXEL_EVENT,{trackingUrl:n}),I()&&hn(fn.PIXEL_EVENT,{trackingUrl:n})}))}catch(e){!1===t?nn("Unable to fire a log using fetch API",null==e?void 0:e.message,$.BAD_INTEGRATION):bn(n)}}function Cn(n,t,e){let o,i,a=e;for(;!o;){try{if("function"==typeof a[n]){i=a[n],o=a;break}}catch(n){}try{if(a.frames[t]){o=a;break}}catch(n){}if(a===e.top)break;a=a.parent}return{cmpFrame:o,cmpFunction:i}}function En(n){let{hasConsent:t,type:e}=n;!function(n){let{hasConsent:t,type:e}=n;window.teads_has_consent||(window.teads_has_consent=t,window.teads_consent_handler_type=e,t&&!window.teads_tracking_allowed&&(window.teads_tracking_allowed=!0))}({hasConsent:t,type:e})}function An(n,t){let e=!1;function o(e,o){o?!1!==e.gdprApplies&&"tcloaded"!==e.eventStatus&&"useractioncomplete"!==e.eventStatus||(function(n){var t;null!==(t=n.vendor)&&void 0!==t&&t.consents&&!n.vendor.consents[w]||!function(n){if(null==n||!n.consents)return!0;for(const t of v)if(!1===n.consents[t])return!1;return!0}(n.purpose)?En({hasConsent:!1}):En({hasConsent:!0,type:"tcf"})}(e),n(e)):t("CMP unable to register callback function. Please check CMP setup.")}const i="__tcfapi",a={};function r(n){const t="".concat(i,"Return"),e="string"==typeof n.data&&"".concat(n.data).includes(t)?JSON.parse(n.data):n.data;if(e[t]&&e[t].callId){const n=e[t];void 0!==a[n.callId]&&a[n.callId](n.returnValue,n.success)}}function c(n,t,o){const c="".concat(i,"Call");window[i]=(n,e,o,i)=>{const r="".concat(Math.random()),s={[c]:{command:n,version:e,parameter:i,callId:r}};a[r]=o,t.postMessage(s,"*")},e||window.addEventListener("message",r,!1),window[i](n,2,o)}const{cmpFrame:s,cmpFunction:d}=Cn("__tcfapi","__tcfapiLocator",window);return!!s&&(new Promise(((n,t)=>{H(d)?d("ping",2,(()=>n())):c("ping",s,(()=>n())),setTimeout((()=>t()),p)})).catch((()=>t("Unable to ping the CMP"))),e||(e=!0,H(d)?d("addEventListener",2,o):c("addEventListener",s,o)),!0)}function kn(n,t){const e={};function o(n){const t=n&&n.data&&n.data.__uspapiReturn;t&&t.callId&&void 0!==e[t.callId]&&(e[t.callId](t.returnValue,t.success),delete e[t.callId])}let i=!1;function a(n,t,a){i||(window.addEventListener("message",o,!1),i=!0),function(n,o,i){const a="".concat(Math.random()),r={__uspapiCall:{command:n,version:1,callId:a}};e[a]=i,t.postMessage(r,"*")}(n,0,a)}const{cmpFrame:r,cmpFunction:c}=Cn("__uspapi","__uspapiLocator",window);if(!r)return!1;new Promise(((n,t)=>{H(c)?c("getUSPData",1,(()=>n())):a("getUSPData",r,(()=>n())),setTimeout((()=>t()),p)})).catch((()=>t("Unable to ping the USP")));const s=function(){const e={};return{consentDataCallback:(o,i)=>{i&&o.uspString&&(e.usPrivacy=o.uspString,function(n,t){let{uspString:e}=n;!t||function(n){return["1NYN","1YYN"].some((t=>t===(null==n?void 0:n.toUpperCase())))}(e)?En({hasConsent:!1}):En({hasConsent:!0,type:"ccpa"})}(o,i)),e.usPrivacy?n(e):t("Unable to get USP consent string.")}}}();return H(c)?c("getUSPData",1,s.consentDataCallback):a("getUSPData",r,s.consentDataCallback),!0}let Sn=function(n){return n.Ping="ping",n.AddEventListener="addEventListener",n.RemoveEventListener="removeEventListener",n}({}),Pn=function(n){return n.Ready="ready",n.NotReady="Not ready",n}({});function Ln(n,t,e){return new Promise(((o,i)=>{if(void 0!==n)switch(t){case Sn.Ping:n(t,((n,t)=>{t?o(n):i(new Error("Ping command failed"))}));break;case Sn.AddEventListener:n(t,((n,t)=>{t?o(n):i(new Error("AddEventListener command failed"))}));break;case Sn.RemoveEventListener:"number"==typeof e&&n(t,e,(()=>{}));break;default:i(new Error("Invalid GPP command"))}}))}const Tn=n=>n===Pn.Ready,Nn=n=>null!=n;class On{constructor(){var n,t,e;n=this,e=!1,(t=function(n){var t=function(n,t){if("object"!=typeof n||!n)return n;var e=n[Symbol.toPrimitive];if(void 0!==e){var o=e.call(n,"string");if("object"!=typeof o)return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}(n);return"symbol"==typeof t?t:t+""}(t="isGppAvailable"))in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e;const{cmpFunction:o,cmpFrame:i}=Cn("__gpp","__gppLocator",window);H(o)?this.gpp=o:i&&(this.gpp=On.buildCmpFunctionWithPostMessage(i)),this.isGppAvailable="function"==typeof this.gpp}static buildCmpFunctionWithPostMessage(n){const t={},e="__gpp",o="".concat(e,"Call");return n.addEventListener("message",(function(n){const o="".concat(e,"Return"),i="string"==typeof n.data&&"".concat(n.data).includes(o)?JSON.parse(n.data):n.data;if(i[o]&&i[o].callId){const n=i[o];"function"==typeof t[n.callId]&&t[n.callId](n.returnValue,n.success)}}),!1),(e,i,a)=>{const r="".concat(Math.random()),c={[o]:{command:e,version:"1.1",callId:r}};e===Sn.RemoveEventListener?t[r]=a:t[r]=i,n.postMessage(c,"*")}}async retrieveConsent(n,t){if(this.isGppAvailable)try{let e;const o=await Promise.race([Ln(this.gpp,Sn.Ping),new Promise(((n,o)=>{e=setTimeout((()=>{t("GPP ping timed out"),o("Unable to ping the GPP CMP")}),p)}))]);if(clearTimeout(e),Tn(o.signalStatus)&&Nn(o.gppString))return n({applicableSections:o.applicableSections,gppString:o.gppString}),void this.parseGppString(o,n,t);const i=await Ln(this.gpp,Sn.AddEventListener);Ln(this.gpp,Sn.RemoveEventListener,i.listenerId);const{pingData:a}=i;if(!Tn(a.signalStatus))return void t("CMP is expecting changes, consent data is not available yet");if(!Nn(a.gppString))return void t("Expected gppString to be a string but got null or undefined");const r=i.pingData;n({applicableSections:r.applicableSections,gppString:r.gppString}),this.parseGppString(r,n,t)}catch(n){t("Error during GPP command call: ".concat(n))}}async parseGppString(n,t,e){if(!this.iabLib)try{this.iabLib=await i.e(854).then(i.bind(i,854))}catch(n){return En({hasConsent:!1}),void e("Failed to load iab library: ".concat(n))}const o=this.parseString(n.gppString);En({hasConsent:null!=o&&o,type:o?"gpp":void 0}),t({applicableSections:n.applicableSections,gppString:n.gppString})}parseString(n){try{return this.hasConsent(n)}catch(t){if(n.startsWith("D"))try{const t=n.substring(n.indexOf("~")+1);return this.hasConsent(t)}catch(n){}return}}hasConsent(n){const t=this.iabLib.TCString.decode(n);if(t.vendorConsents.has(w))return t.purposeConsents.has(1)}retrieveConsentWithoutHolding(n,t){let e=!1,o=!1;this.retrieveConsent((t=>{o||(e=!0,n(t))}),(n=>{e||(o=!0,t(n))}))}}function Un(n,t){const e=new On;return e.isGppAvailable&&e.retrieveConsentWithoutHolding(n,t),e.isGppAvailable}function Dn(n,t){const e=["ad_storage","ad_user_data"];let o=!1;function i(){return e.every((n=>{var t;return!0===(null===(t=window.google_tag_data)||void 0===t||null===(t=t.ics)||void 0===t||null===(t=t.entries[n])||void 0===t?void 0:t.update)}))}if(window.google_tag_data){var a;const c=window.google_tag_data;return null!=c&&null!==(a=c.ics)&&void 0!==a&&a.entries?(En({hasConsent:i(),type:"gtm"}),o||i()||null===(r=window.google_tag_data)||void 0===r||null===(r=r.ics)||void 0===r||!r.addListener||(o=!0,window.google_tag_data.ics.addListener(e,(function(){En({hasConsent:i(),type:"gtm"}),n({hasConsent:i()})}))),n({hasConsent:i()}),!0):(t("Unable to get consent data from GTM"),!1)}var r;return!1}function Rn(n){if(window.didomiState){const t=window.didomiState;if(!t)return!1;t.didomiPurposesConsent||(En({hasConsent:!1,type:"di"}),n({hasConsent:!1}));const e=t.didomiPurposesConsent.indexOf("cookies")>-1&&t.didomiPurposesConsent.indexOf("measure_ad_performance")>-1;return En({hasConsent:e,type:"di"}),n({hasConsent:e}),!0}return!1}function xn(n){let t=!1;if(window.Cookiebot){const i=window.Cookiebot;if(i){var e,o;const a=null!==(e=null===(o=i.consent)||void 0===o?void 0:o.marketing)&&void 0!==e&&e;return En({hasConsent:a,type:"cb"}),t||(t=!0,window.addEventListener("CookiebotOnAccept",(()=>{En({hasConsent:!0,type:"cb"})}),!1)),n({hasConsent:a}),!0}return!1}return!1}function jn(n){let t=!1;function e(){var n,t;const e=null===(n=window.OnetrustActiveGroups)||void 0===n?void 0:n.toUpperCase();return null!==(t=(null==e?void 0:e.indexOf("C0004"))>-1)&&void 0!==t&&t}var o,i;return!!window.OnetrustActiveGroups&&(!!(null===(o=window.OnetrustActiveGroups)||void 0===o?void 0:o.toUpperCase())&&(e()?(En({hasConsent:!0,type:"ot"}),n({hasConsent:!0})):"OneTrust"in window&&!t&&null!==(i=window.OneTrust)&&void 0!==i&&i.OnConsentChanged&&(t=!0,window.OneTrust.OnConsentChanged((()=>{En({hasConsent:e(),type:e()?"ot":void 0}),n({hasConsent:e()})}))),n({hasConsent:e()}),!0))}function Xn(n){return!!function(){const n=decodeURIComponent(document.location.href.toLowerCase());return n.includes("gcs=g111")||n.includes("gcs=g11-")||n.includes("gcs=g1-1")}()&&(En({hasConsent:!0,type:"g111"}),n({hasConsent:!0}),!0)}function Fn(n){if(!window.UC_UI)return!1;let t=!1;function e(){n({hasConsent:o()})}function o(){const n=window.UC_UI;return n.areAllConsentsAccepted()||!(null===(t=n.getServicesBaseInfo().find((n=>{var t;return(null===(t=n.name)||void 0===t?void 0:t.toLowerCase())===_})))||void 0===t||null===(t=t.consent)||void 0===t||!t.status);var t}return t||(t=!0,window.addEventListener("UC_UI_CMP_EVENT",(function(n){const{type:t}=n.detail;["ACCEPT_ALL","DENY_ALL","SAVE"].includes(t)&&e()}))),e(),!0}function Mn(n){function t(){var n;return!(null===(n=window.teads_e)||void 0===n||!n.some((n=>{const{shopifyEvent:t}=n;return"boolean"!=typeof t&&!!t&&function(n){let{analyticsProcessingAllowed:t,marketingAllowed:e,saleOfDataAllowed:o}=n;return t&&e&&o}(t)})))}return!!function(){const n=document.cookie,t=!!n&&["_shopify_ga","_shopify_y","_shopify_s","_shopify_fs","_shopify_sa_p","_shopify_sa_t","_shopify_country","_shopify_essential"].some((t=>n.includes(t))),e=document.location.href.toLowerCase().includes("/custom/web-pixel-");return t||e}()&&(null!==(e=window.teads_e)&&void 0!==e&&e.length&&window.teads_e.some((n=>{const{shopifyEvent:t}=n;return!!t&&"boolean"!=typeof t}))?(En({hasConsent:t(),type:"shopify"}),n({hasConsent:t()}),!0):(En({hasConsent:!1,type:"shopify"}),n({hasConsent:!1}),!0));var e}function Vn(n,t){return new Promise((e=>{n((n=>{t({data:n}),e()}),(n=>{t({error:n}),e()}))||e()}))}function Gn(){return Promise.all([Vn(An,C),Vn(kn,S),Vn(Un,A),Vn(xn,N),Vn(Dn,L),Vn(Rn,T),Vn(jn,O),Vn(Fn,D),Vn(Mn,R),Vn(Xn,U)])}const Bn={zone:function(n){return n.Default="all",n.EuZone1="euZone1",n.EuZone2="euZone2",n}({}).Default},Jn={conversionType:"conversion_type",price:"aepp",currency:"aepc",name:"aepn"};async function Wn(n){if(!X())return;const t=function(n,t){const e={};return Object.keys(n).forEach((t=>{const o=t,i=n[t];Object.prototype.hasOwnProperty.call(Jn,o)?e[Jn[o]]=i+"":nn("Invalid parameter specified in event: ".concat(o))})),e}(n),e=c+on("conversion",t);bn(e),K(e),async function(n){if(window.obApi&&function(n){return["AddToCart","AddToWishlist","CompleteRegistration","InitiateCheckout","Lead","Purchase","ViewContent","Search"].includes(n.conversionType)}(n)){const t={...n};n.price&&(t.orderValue="".concat(n.price)),"Purchase"===n.conversionType&&(t.orderId=n.name),delete t.conversionType,Object.keys(t).length>0?window.obApi("track",n.conversionType,t):window.obApi("track",n.conversionType)}}(n)}async function Kn(){const n=[];for(;null!==(t=window.teads_e)&&void 0!==t&&t.length;){var t;n.push(Wn(window.teads_e.shift()))}try{return await Promise.all(n)}catch(n){nn("Error while sending event based conversion",null==n?void 0:n.message,$.INTERNAL)}}const qn=n=>{const{auctionId:t,gdpr:e,ccpa:o,firstPartyCookieAllowed:i,domain:a,trackingAllowed:r}=n;var c,s,d,u;c=i,window.first_party_cookie_allowed=c,s=r,window.teads_tracking_allowed=s,e&&(d=e,window.teads_gdpr_advertiser=d),o&&function(n){window.teads_ccpa_advertiser=n}(o),a&&(u=a,window.advertiser_domain=u),t&&(F(t),V("url"))},zn=n=>{if(n){const n=vn(cn.auctionId);if(n){const t=M();t&&t!==n||V("cookie"),t||F(n)}return pn(),n}return sn(cn.auctionId.key),null},Zn=(n,t,e,o)=>{if(n){const n=vn(cn.sessionId);t&&e&&t!==e?G(o):n?G(n):o&&G(o),wn()}else o&&G(o),sn(cn.sessionId.key)},Yn=(n,t)=>{if(t&&n){const n=vn(cn.viewerId);e=n||t,window.teads_viewer_id=e,function(){const n=J();W()&&n&&dn(cn.viewerId.key,n,cn.viewerId.maxAge)}()}else sn(cn.viewerId.key);var e};async function $n(){try{const n=await async function(){const n=Q(window),t=function(n){var t,e,o;const i=z(),a=y();let r="referer=".concat(encodeURIComponent(n));void 0!==a?r+="&buyer_pixel_id=".concat(encodeURIComponent(a)):void 0!==i&&(r+="&advertiser_id=".concat(encodeURIComponent(i)));const c=E();var s,d;c&&(void 0!==(null==c||null===(s=c.data)||void 0===s?void 0:s.gdprApplies)&&(r+="&gdpr_applies=".concat(encodeURIComponent(c.data.gdprApplies))),null!=c&&null!==(d=c.data)&&void 0!==d&&d.tcString&&(r+="&gdpr_consent=".concat(encodeURIComponent(c.data.tcString))),null!=c&&c.error&&(r+="&gdpr_error=".concat(encodeURIComponent(c.error))));const u=P();null!=u&&null!==(t=u.data)&&void 0!==t&&t.usPrivacy&&(r+="&ccpa_consent=".concat(encodeURIComponent(u.data.usPrivacy))),null!=u&&u.error&&(r+="&ccpa_error=".concat(encodeURIComponent(u.error)));const l=k();null!=l&&null!==(e=l.data)&&void 0!==e&&e.applicableSections&&(r+="&gpp_applicable_sections=".concat(encodeURIComponent(l.data.applicableSections.join(",")))),null!=l&&null!==(o=l.data)&&void 0!==o&&o.gppString&&(r+="&gpp_consent=".concat(encodeURIComponent(l.data.gppString))),null!=l&&l.error&&(r+="&gpp_error=".concat(encodeURIComponent(l.error)));const p=function(){const n=un("optout");if(n)return"1"===n}();void 0!==p&&(r+="&web_opt_out=".concat(encodeURIComponent(p)));const w=window.teads_gtm_consent_data;w&&(w.data&&(r+=">m_consent=".concat(encodeURIComponent(w.data.hasConsent))),w.error&&(r+=">m_error=".concat(encodeURIComponent(w.error))));const _=window.teads_didomi_consent_data;_&&(_.data&&(r+="&didomi_consent=".concat(encodeURIComponent(_.data.hasConsent))),_.error&&(r+="&didomi_error=".concat(encodeURIComponent(_.error))));const v=window.teads_cookiebot_consent_data;v&&(v.data&&(r+="&cookiebot_consent=".concat(encodeURIComponent(v.data.hasConsent))),v.error&&(r+="&cookiebot_error=".concat(encodeURIComponent(v.error))));const f=window.teads_onetrust_consent_data;return f&&(f.data&&(r+="&onetrust_consent=".concat(encodeURIComponent(f.data.hasConsent))),f.error&&(r+="&onetrust_error=".concat(encodeURIComponent(f.error)))),r}(n);try{const n=await fetch("".concat(s,"?").concat(t),{cache:"no-cache"});if(200===(null==n?void 0:n.status)){var e,o,i,a,r,c,d,u;const t=await n.json();return{trackingAllowed:!1!==(null==t?void 0:t.tracking_allowed),firstPartyCookieAllowed:!0===(null==t?void 0:t.first_party_cookie_allowed),sessionId:null==t?void 0:t.session_id,auctionId:null==t?void 0:t.auction_id,viewerId:null==t?void 0:t.user_id,domain:null==t?void 0:t.domain,ccpa:null!=t&&t.ccpa?{apply:null===(e=t.ccpa)||void 0===e?void 0:e.apply,teadsConsent:null===(o=t.ccpa)||void 0===o?void 0:o.teads_consent}:void 0,gpp:null!=t&&t.gpp?{apply:null===(i=t.gpp)||void 0===i?void 0:i.apply,teadsConsent:null===(a=t.gpp)||void 0===a?void 0:a.teads_consent}:void 0,gdpr:null!=t&&t.gdpr?{apply:null===(r=t.gdpr)||void 0===r?void 0:r.apply,teadsConsent:null===(c=t.gdpr)||void 0===c?void 0:c.teads_consent,apiVersion:null===(d=t.gdpr)||void 0===d?void 0:d.api_version,cmpId:null===(u=t.gdpr)||void 0===u?void 0:u.cmp_id,isServiceSpecific:null==t?void 0:t.gdpr.is_service_specific}:void 0,outbrainAdvertiserId:null==t?void 0:t.outbrain_advertiser_id}}}catch(n){nn("Error while trigger API to know advertiser information",null==n?void 0:n.message,$.INTERNAL)}const l=en(n);return l?{trackingAllowed:!0,firstPartyCookieAllowed:!1,auctionId:l}:{trackingAllowed:!0,firstPartyCookieAllowed:!1}}(),{sessionId:t,auctionId:e,viewerId:o,outbrainAdvertiserId:i}=n;i&&async function(n){const t='\n !function(_window, _document) {\n var OB_ADV_ID = "'.concat(n,"\";\n if (_window.obApi) {\n var toArray = function(object) {\n return Object.prototype.toString.call(object) === '[object Array]' ? object : [object];\n };\n _window.obApi.marketerId = toArray(_window.obApi.marketerId).concat(toArray(OB_ADV_ID));\n return;\n }\n var api = _window.obApi = function() {\n api.dispatch ? api.dispatch.apply(api, arguments) : api.queue.push(arguments);\n };\n api.version = '3.0';\n api.loaded = true;\n api.loadedBy = 'teads';\n api.marketerId = OB_ADV_ID;\n api.queue = [];\n var tag = _document.createElement('script');\n tag.async = true;\n tag.src = '//p.teads.tv/obtp/cp/obtp.js';\n tag.type = 'text/javascript';\n var script = _document.getElementsByTagName('script')[0];\n script.parentNode.insertBefore(tag, script);\n }(window, document);\n\n obApi('track', 'PAGE_VIEW');\n "),e=document.createElement("script");e.textContent=t,e.async=!0,e.defer=!0,e.type="text/javascript",document.head.appendChild(e)}(i).catch((n=>nn("Error while injecting Outbrain pixel",null==n?void 0:n.message))),qn(n);const a=W(),r=zn(a);Zn(a,r,e,t),Yn(a,o),I()&&hn(fn.CONSENT_INFO_LOADED,{trackingAllowed:X(),firstPartyCookieAllowed:W(),gdprAdvertiser:x(),ccpaAdvertiser:j(),advertiserDomain:h(),auctionId:M(),iabData:E(),uspData:P()})}catch(n){nn("Error while initializing advertiser",null==n?void 0:n.message,$.INTERNAL)}}const Hn=async()=>{const n=c+on("pageView",{});bn(n),K(n),await In(c+on("browser-topics",{}),!1)},Qn=()=>{const n=on("timeSpent",{}),t=c+n;q(!1),document.addEventListener("visibilitychange",(n=>()=>{"hidden"===document.visibilityState&&!0!==m&&(q(!0),async function(n,t){try{const t=navigator.sendBeacon&&navigator.sendBeacon.bind(navigator);if(!t||!t(n))throw new Error("Beacon not sent");b()&&mn(fn.PIXEL_EVENT,{trackingUrl:n}),I()&&hn(fn.PIXEL_EVENT,{trackingUrl:n})}catch(t){await In(n,!0)}}(n),wn(),K(n))})(t))},nt=()=>{const n=window.teads_e||[];window.teads_e=[],window.teads_e.push=function(){for(var n=arguments.length,t=new Array(n),e=0;e{await Gn(),X()&&(clearInterval(t),await Kn()),n--,0===n&&clearInterval(t)}),500)}(),wn()):nn("The event queue is not defined.")}(),window.teads_e.length},window.teads_e.push(...n)};async function tt(){const n=z(),t=y();"number"!=typeof n&&"number"!=typeof t||(await $n(),await async function(){X()&&(await Hn(),await Qn(),nt())}())}async function et(){try{window.teads_adv_id||Object.defineProperty(window,"teads_adv_id",{set(n){this._teads_adv_id=n,tt()},get(){return this._teads_adv_id},configurable:!0}),window.teads_buyer_pixel_id||Object.defineProperty(window,"teads_buyer_pixel_id",{set(n){this._teads_buyer_pixel_id=n,tt()},get(){return this._teads_buyer_pixel_id},configurable:!0})}catch(n){nn("Error while binding advertiser and pixel ids",null==n?void 0:n.message)}try{window.teads_setOutbrainCookieOnTeads||(window.teads_setOutbrainCookieOnTeads=function(n){const t=ln(),e=JSON.parse(t);e[u]=n,dn(cn.auctionId.key,btoa(JSON.stringify(e)),cn.auctionId.maxAge)}),window.teads_getOutbrainCookieFromTeads||(window.teads_getOutbrainCookieFromTeads=function(){const n=ln();return JSON.parse(n)[u]})}catch(n){nn("Error while loading Outbrain",null==n?void 0:n.message)}await tt()}return async function(n){try{"undefined"!=typeof window&&(window.teads_zone=Bn.zone,H(null===(t=window)||void 0===t?void 0:t.addEventListener)&&(mn(fn.PIXEL_LOADED),hn(fn.PIXEL_LOADED),window.addEventListener("message",yn)),await new Promise(((n,t)=>{setTimeout((()=>{Gn().then((()=>et())).then(n).catch(t)}),0)})))}catch(n){nn("Unhandled exception",null==n?void 0:n.message,$.INTERNAL)}var t}(),a})()));