/*! For license information please see tracking.min.js.LICENSE.txt */ var a1tracker;!function(){var e={23:function(e){var t,n,r=9007199254740991,i=/^(?:0|[1-9]\d*)$/,o=Object.prototype,s=o.hasOwnProperty,a=o.toString,c=o.propertyIsEnumerable,u=(t=Object.keys,n=Object,function(e){return t(n(e))}),l=Math.max,h=!c.call({valueOf:1},"valueOf");function d(e,t,n){var r=e[t];s.call(e,t)&&g(r,n)&&(void 0!==n||t in e)||(e[t]=n)}function f(e,t){return!!(t=null==t?r:t)&&("number"==typeof e||i.test(e))&&e>-1&&e%1==0&&e-1&&e%1==0&&e<=r}(e.length)&&!function(e){var t=_(e)?a.call(e):"";return"[object Function]"==t||"[object GeneratorFunction]"==t}(e)}function _(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}var y,b=(y=function(e,t){if(h||p(t)||v(t))!function(e,t,n){n||(n={});for(var r=-1,i=t.length;++r1?t[r-1]:void 0,o=r>2?t[2]:void 0;for(i=y.length>3&&"function"==typeof i?(r--,i):void 0,o&&function(e,t,n){if(!_(n))return!1;var r=typeof t;return!!("number"==r?v(n)&&f(t,n.length):"string"==r&&t in n)&&g(n[t],e)}(t[0],t[1],o)&&(i=r<3?void 0:i,r=1),e=Object(e);++n=0?l:0),n=l,t=m(t),e.slice(n,n+t.length)==t}},111:function(e){var t=1/0,n=9007199254740991,r=/^\s+|\s+$/g,i=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,s=/^0o[0-7]+$/i,a=/^(?:0|[1-9]\d*)$/,c=parseInt;function u(e){return e!=e}var l,h,d=Object.prototype,f=d.hasOwnProperty,p=d.toString,g=d.propertyIsEnumerable,m=(l=Object.keys,h=Object,function(e){return l(h(e))}),v=Math.max;function _(e,t){return!!(t=null==t?n:t)&&("number"==typeof e||a.test(e))&&e>-1&&e%1==0&&e-1&&e%1==0&&e<=n}(e.length)&&!function(e){var t=w(e)?p.call(e):"";return"[object Function]"==t||"[object GeneratorFunction]"==t}(e)}function w(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function I(e){return!!e&&"object"==typeof e}e.exports=function(e,n,a,l){var h;e=b(e)?e:(h=e)?function(e,t){return function(t){for(var n=-1,r=t?t.length:0,i=Array(r);++n-1:!!S&&function(e,t,n){if(t!=t)return function(e,t,n){for(var r=e.length,i=n+-1;++i-1}},157:function(e,t,n){var r="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,i="object"==typeof self&&self&&self.Object===Object&&self,o=(r||i||Function("return this")()).isFinite;e.exports=function(e){return"number"==typeof e&&o(e)}},193:function(e,t,n){e=n.nmd(e);var r="__lodash_hash_undefined__",i=9007199254740991,o="[object Arguments]",s="[object Boolean]",a="[object Date]",c="[object Function]",u="[object GeneratorFunction]",l="[object Map]",h="[object Number]",d="[object Object]",f="[object Promise]",p="[object RegExp]",g="[object Set]",m="[object String]",v="[object Symbol]",_="[object WeakMap]",y="[object ArrayBuffer]",b="[object DataView]",w="[object Float32Array]",I="[object Float64Array]",S="[object Int8Array]",C="[object Int16Array]",E="[object Int32Array]",D="[object Uint8Array]",A="[object Uint8ClampedArray]",O="[object Uint16Array]",P="[object Uint32Array]",j=/\w*$/,T=/^\[object .+?Constructor\]$/,k=/^(?:0|[1-9]\d*)$/,x={};x[o]=x["[object Array]"]=x[y]=x[b]=x[s]=x[a]=x[w]=x[I]=x[S]=x[C]=x[E]=x[l]=x[h]=x[d]=x[p]=x[g]=x[m]=x[v]=x[D]=x[A]=x[O]=x[P]=!0,x["[object Error]"]=x[c]=x[_]=!1;var R="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,U="object"==typeof self&&self&&self.Object===Object&&self,F=R||U||Function("return this")(),N=t&&!t.nodeType&&t,M=N&&e&&!e.nodeType&&e,L=M&&M.exports===N;function V(e,t){return e.set(t[0],t[1]),e}function G(e,t){return e.add(t),e}function W(e,t,n,r){var i=-1,o=e?e.length:0;for(r&&o&&(n=e[++i]);++i-1},Ae.prototype.set=function(e,t){var n=this.__data__,r=Te(n,e);return r<0?n.push([e,t]):n[r][1]=t,this},Oe.prototype.clear=function(){this.__data__={hash:new De,map:new(pe||Ae),string:new De}},Oe.prototype.delete=function(e){return Ue(this,e).delete(e)},Oe.prototype.get=function(e){return Ue(this,e).get(e)},Oe.prototype.has=function(e){return Ue(this,e).has(e)},Oe.prototype.set=function(e,t){return Ue(this,e).set(e,t),this},Pe.prototype.clear=function(){this.__data__=new Ae},Pe.prototype.delete=function(e){return this.__data__.delete(e)},Pe.prototype.get=function(e){return this.__data__.get(e)},Pe.prototype.has=function(e){return this.__data__.has(e)},Pe.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Ae){var r=n.__data__;if(!pe||r.length<199)return r.push([e,t]),this;n=this.__data__=new Oe(r)}return n.set(e,t),this};var Ne=le?z(le,Object):function(){return[]},Me=function(e){return te.call(e)};function Le(e,t){return!!(t=null==t?i:t)&&("number"==typeof e||k.test(e))&&e>-1&&e%1==0&&e-1&&e%1==0&&e<=i}(e.length)&&!He(e)}var ze=he||function(){return!1};function He(e){var t=Be(e)?te.call(e):"";return t==c||t==u}function Be(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function Je(e){return qe(e)?function(e,t){var n=$e(e)||function(e){return function(e){return function(e){return!!e&&"object"==typeof e}(e)&&qe(e)}(e)&&ee.call(e,"callee")&&(!ce.call(e,"callee")||te.call(e)==o)}(e)?function(e,t){for(var n=-1,r=Array(e);++n0&&n(c)?t>1?f(c,t-1,n,r,i):s(i,c):r||(i[i.length]=c)}return i}function p(e){return g(e)||function(e){return function(e){return function(e){return!!e&&"object"==typeof e}(e)&&function(e){return null!=e&&function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}(e.length)&&!function(e){var t=function(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}(e)?u.call(e):"";return"[object Function]"==t||"[object GeneratorFunction]"==t}(e)}(e)}(e)&&c.call(e,"callee")&&(!h.call(e,"callee")||"[object Arguments]"==u.call(e))}(e)||!!(d&&e&&e[d])}var g=Array.isArray;e.exports=function(e){return e&&e.length?f(e,1):[]}},322:function(e,t,n){var r="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,i="object"==typeof self&&self&&self.Object===Object&&self,o=r||i||Function("return this")();function s(e,t){for(var n=-1,r=t.length,i=e.length;++n0&&n(c)?t>1?p(c,t-1,n,r,i):s(i,c):r||(i[i.length]=c)}return i}function g(e){return _(e)||function(e){return function(e){return function(e){return!!e&&"object"==typeof e}(e)&&function(e){return null!=e&&function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}(e.length)&&!function(e){var t=function(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}(e)?u.call(e):"";return"[object Function]"==t||"[object GeneratorFunction]"==t}(e)}(e)}(e)&&c.call(e,"callee")&&(!h.call(e,"callee")||"[object Arguments]"==u.call(e))}(e)||!!(d&&e&&e[d])}var m,v,_=Array.isArray,y=(m=function(e){for(var t=(e=p(e,1)).length,n=t;n--;)if("function"!=typeof e[n])throw new TypeError("Expected a function");return function(){for(var n=0,r=t?e[n].apply(this,arguments):arguments[0];++n-1&&e%1==0&&e<=9007199254740991}(e.length)&&!B(e)}var H=O||function(){return!1};function B(e){var t=J(e)?C.call(e):"";return"[object Function]"==t||"[object GeneratorFunction]"==t}function J(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}e.exports=function(e){if(z(e)&&(q(e)||"string"==typeof e||"function"==typeof e.splice||H(e)||function(e){return function(e){return function(e){return!!e&&"object"==typeof e}(e)&&z(e)}(e)&&S.call(e,"callee")&&(!A.call(e,"callee")||"[object Arguments]"==C.call(e))}(e)))return!e.length;var t=W(e);if(t==s||t==c)return!e.size;if(U||function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||y)}(e))return!P(e).length;for(var n in e)if(S.call(e,n))return!1;return!0}},404:function(e,t,n){var r=1/0,i=/^\s+|\s+$/g,o=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,a=/^0o[0-7]+$/i,c=parseInt,u="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,l="object"==typeof self&&self&&self.Object===Object&&self,h=u||l||Function("return this")(),d=Object.prototype.toString,f=h.Symbol,p=f?f.prototype:void 0,g=p?p.toString:void 0;function m(e){if("string"==typeof e)return e;if(_(e))return g?g.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function v(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function _(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Symbol]"==d.call(e)}e.exports=function(e,t,n){var u;e=null==(u=e)?"":m(u),t=m(t);var l,h,d=e.length,f=n=void 0===n?d:(l=function(e){var t=function(e){return e?(e=function(e){if("number"==typeof e)return e;if(_(e))return NaN;if(v(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=v(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(i,"");var n=s.test(e);return n||a.test(e)?c(e.slice(2),n?2:8):o.test(e)?NaN:+e}(e))===r||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}(e),n=t%1;return t==t?n?t-n:t:0}(n),h=d,l==l&&(void 0!==h&&(l=l<=h?l:h),l=l>=0?l:0),l);return(n-=t.length)>=0&&e.slice(n,f)==t}},639:function(e){var t=Object.prototype.toString;e.exports=function(e){return"number"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Number]"==t.call(e)}},814:function(e,t,n){var r=/^\s+|\s+$/g,i="\\ud800-\\udfff",o="\\u0300-\\u036f\\ufe20-\\ufe23",s="\\u20d0-\\u20f0",a="\\ufe0e\\ufe0f",c="["+i+"]",u="["+o+s+"]",l="\\ud83c[\\udffb-\\udfff]",h="[^"+i+"]",d="(?:\\ud83c[\\udde6-\\uddff]){2}",f="[\\ud800-\\udbff][\\udc00-\\udfff]",p="\\u200d",g="(?:"+u+"|"+l+")?",m="["+a+"]?",v=m+g+"(?:"+p+"(?:"+[h,d,f].join("|")+")"+m+g+")*",_="(?:"+[h+u+"?",u,d,f,c].join("|")+")",y=RegExp(l+"(?="+l+")|"+_+v,"g"),b=RegExp("["+p+i+o+s+a+"]"),w="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,I="object"==typeof self&&self&&self.Object===Object&&self,S=w||I||Function("return this")();function C(e,t,n){if(t!=t)return function(e,t,n){for(var r=e.length,i=n+-1;++i-1;);return n}(o,s),c=function(e,t){for(var n=e.length;n--&&C(t,e[n],0)>-1;);return n}(o,s)+1;return function(e,t,n){var r=e.length;return n=void 0===n?r:n,!t&&n>=r?e:function(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),(n=n>i?i:n)<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var o=Array(i);++r{let n=t.data;if(void 0!==t.data&&t.data._isId5Message){if(t.data.src===e._id)return;if(void 0!==t.data.dst&&t.data.dst!==e._id)return;try{[o,n.type].forEach((r=>{let i=e._handlers[r];i&&i.forEach((e=>e(n,t.source)))}))}catch(t){e._log.error("Error while handling message",n,t)}}}),{capture:!1,signal:t})}unregister(){this._abortController&&this._abortController.abort()}onAnyMessage(e){return this.onMessage(o,e)}onMessage(e,t){const n=this._handlers[e];return n?n.push(t):this._handlers[e]=[t],this}broadcastMessage(e,t){this._log.debug("Broadcasting message",t,e),this._postMessage(this._messageFactory.createBroadcastMessage(e,t))}sendResponseMessage(e,t,n=t.constructor.name){this._log.debug("Sending response message",e,n,t),this._postMessage(this._messageFactory.createResponse(e,t,n))}unicastMessage(e,t,n=t.constructor.name){this._log.debug("Sending message to",e,n,t),this._postMessage(this._messageFactory.createUnicastMessage(e,t,n))}_postToWindow(e,t){try{e.postMessage(t,"*")}catch(e){this._log.error("Could not post message to window",e)}}_postMessage(e){let t=this,n=function(r){try{t._postToWindow(r,e);let i=r.frames;if(i)for(let e=0;e{if(void 0===t.dst)return this._countInvalidMessage(t,"no-destination-proxy"),void this._log.error("Received invalid RemoteMethodCallMessage message",JSON.stringify(t),"Ignoring it....");e._handle(Object.assign(new h,t.payload))}))}_countInvalidMessage(e,t){const n=e=>null!=e;void 0!==this._metrics?.instanceInvalidMsgCounter&&this._metrics.instanceInvalidMsgCounter({reason:t,hasDestination:n(e.dst),hasSource:n(e.src),hasPayload:n(e.payload),hasRequest:n(e.request),hasTimestamp:n(e.timestamp)}).inc()}}function p(e,t){let n="^\\d+(\\.\\d+(\\.\\d+){0,1}){0,1}$";if(!e.match(n)||!t.match(n))return;let r=e.split("."),i=t.split("."),o=e=>parseInt(e)||0,s=(e,t)=>{let n=e-t;return 0===n?0:n<0?-1:1},a=s(o(r[0]),o(i[0]));if(0===a){let e=s(o(r[1]),o(i[1]));return 0===e?s(o(r[2]),o(i[2])):e}return a}const g=Object.prototype.toString;function m(e,t){return g.call(e)==="[object "+t+"]"}function v(e){return m(e,"Function")}function _(e){return m(e,"String")}function y(e){return m(e,"Array")}function b(e){return m(e,"Number")}function w(e){return m(e,"Object")}function I(e){return void 0!==e}function S(e,t){if(function(e){if(!e)return!0;if(y(e)||_(e))return!(e.length>0);for(let t in e)if(hasOwnProperty.call(e,t))return!1;return!0}(e))return;if(v(e.forEach))return e.forEach(t,this);let n=0,r=e.length;if(r>0)for(;n=200&&e<300||304===e?u.success(t.responseText,t):u.error(t.statusText,t)}},t.ontimeout=function(){o.error("ajax","xhr timeout after ",t.timeout,"ms")},"GET"===c&&r){let t=function(e,t){let n=document.createElement("a");t&&"noDecodeWholeURL"in t&&t.noDecodeWholeURL?n.href=e:n.href=decodeURIComponent(e);let r=t&&"decodeSearchAsString"in t&&t.decodeSearchAsString;return{href:n.href,protocol:(n.protocol||"").replace(/:$/,""),hostname:n.hostname,port:+n.port,pathname:n.pathname.replace(/^(?!\/)/,"/"),search:r?n.search:(i=n.search||"",i?i.replace(/^\?/,"").split("&").reduce(((e,t)=>{let[n,r]=t.split("=");return/\[\]$/.test(n)?(n=n.replace("[]",""),e[n]=e[n]||[],e[n].push(r)):e[n]=r||"",e}),{}):{}),hash:(n.hash||"").replace(/^#/,""),host:n.host||window.location.host};var i}(e,i);Object.assign(t.search,r),e=((s=t).protocol||"http")+"://"+(s.host||s.hostname+(s.port?`:${s.port}`:""))+(s.pathname||"")+(s.search?`?${a=s.search||"",Object.keys(a).map((e=>Array.isArray(a[e])?a[e].map((t=>`${e}[]=${t}`)).join("&"):`${e}=${a[e]}`)).join("&")}`:"")+(s.hash?`#${s.hash}`:"")}t.open(c,e,!0),i.withCredentials&&(t.withCredentials=!0),S(i.customHeaders,((e,n)=>{t.setRequestHeader(n,e)})),i.preflight&&t.setRequestHeader("X-Requested-With","XMLHttpRequest"),t.setRequestHeader("Content-Type",i.contentType||"text/plain"),"POST"===c&&r?t.send(r):t.send()}catch(e){o.error("ajax","xhr construction",e)}var s,a}function E(e,t=0){let n=function(e,t){if(v(Math.imul))return Math.imul(e,t);var n=(4194303&e)*(t|=0);return 4290772992&e&&(n+=(4290772992&e)*t|0),0|n},r=3735928559^t,i=1103547991^t;for(let t,o=0;o>>16,2246822507)^n(i^i>>>13,3266489909),i=n(i^i>>>16,2246822507)^n(r^r>>>13,3266489909),(4294967296*(2097151&i)+(r>>>0)).toString()}const D=Object.freeze({cmp:"cmp",partner:"partner",prebid:"prebid"}),A="131",O=Object.freeze({NONE:"none",TCF_V1:"TCFv1",TCF_V2:"TCFv2",USP_V1:"USPv1",ID5_ALLOWED_VENDORS:"ID5",PREBID:"PBJS",GPP_V1_0:"GPPv1.0",GPP_V1_1:"GPPv1.1"});class P{version;localStoragePurposeConsent;applicableSections;gppString;vendorsConsentForId5Granted;constructor(e=void 0,t=void 0,n=void 0,r=void 0,i=void 0){this.version=e,this.localStoragePurposeConsent=t,this.applicableSections=r,this.gppString=i,this.vendorsConsentForId5Granted=n}isGranted(){return!this.applicableSections.includes(2)||!0===this.localStoragePurposeConsent&&!1!==this.vendorsConsentForId5Granted}}class j{apiTypes;gdprApplies;consentString;localStoragePurposeConsent;allowedVendors;ccpaString;forcedGrantByConfig;gppData;source;vendorsConsentForId5Granted;constructor(){this.apiTypes=[],this.gdprApplies=!1,this.consentString=void 0,this.localStoragePurposeConsent=!1,this.ccpaString=void 0,this.allowedVendors=void 0,this.forcedGrantByConfig=!1,this.gppData=void 0}localStorageGrant(){return!0===this.forcedGrantByConfig?new k(!0,T.FORCE_ALLOWED_BY_CONFIG):0===this.apiTypes.length?new k(!0,T.PROVISIONAL):this._getLocalStorageGrantFromApi()}_getLocalStorageGrantFromApi(){const e=this.apiTypes,t={},n={};e.includes(O.TCF_V1)&&(t[O.TCF_V1]=this._isGranted(),this._addToDebugInfo(O.TCF_V1,this,n)),e.includes(O.TCF_V2)&&(t[O.TCF_V2]=this._isGranted(),this._addToDebugInfo(O.TCF_V2,this,n)),e.includes(O.ID5_ALLOWED_VENDORS)&&(t[O.ID5_ALLOWED_VENDORS]=this.allowedVendors.includes(A)),e.includes(O.USP_V1)&&(t[O.USP_V1]=!0),e.includes(O.GPP_V1_0)&&(t[O.GPP_V1_0]=this.gppData.isGranted(),this._addToDebugInfo(O.GPP_V1_0,this.gppData,n)),e.includes(O.GPP_V1_1)&&(t[O.GPP_V1_1]=this.gppData.isGranted(),this._addToDebugInfo(O.GPP_V1_1,this.gppData,n));const r=Object.keys(t).map((e=>t[e])).reduce(((e,t)=>e&&t),!0);return new k(r,T.CONSENT_API,t,n)}_addToDebugInfo(e,t,n){return void 0!==t.localStoragePurposeConsent&&(n[e+"-localStoragePurposeConsent"]=t.localStoragePurposeConsent),void 0!==t.vendorsConsentForId5Granted&&(n[e+"-vendorsConsentForId5Granted"]=t.vendorsConsentForId5Granted),n}_isGranted(){return!1===this.gdprApplies||!0===this.localStoragePurposeConsent&&!1!==this.vendorsConsentForId5Granted}hashCode(){const{localStoragePurposeConsent:e,ccpaString:t,...n}=this;return E(JSON.stringify(n))}static createFrom(e){const t=Object.assign(new j,e);return I(t.api)&&(t.apiTypes=function(e){const t=e.api;if(t===O.NONE)return[];if(t===O.PREBID){const t=[];return(I(e.gdprApplies)||I(e.consentString))&&t.push(O.TCF_V2),I(e.ccpaString)&&t.push(O.USP_V1),I(e.gppData)&&I(e.gppData.version)&&t.push(e.gppData.version),t}return[t]}(e),t.api=void 0),w(t.gppData)&&(t.gppData=Object.assign(new P,t.gppData)),t}getApiTypeData(e){if(this.apiTypes.includes(e)){if(e===O.USP_V1)return{ccpaString:this.ccpaString};if(e===O.TCF_V2)return{consentString:this.consentString,gdprApplies:this.gdprApplies,localStoragePurposeConsent:this.localStoragePurposeConsent};if(e===O.GPP_V1_1||e===O.GPP_V1_0)return this.gppData;if(e===O.ID5_ALLOWED_VENDORS)return{allowedVendors:this.allowedVendors}}}}const T=Object.freeze({FORCE_ALLOWED_BY_CONFIG:"force_allowed_by_config",ID5_CONSENT:"id5_consent",PROVISIONAL:"provisional",JURISDICTION:"jurisdiction",CONSENT_API:"consent_api"});class k{allowed=!1;grantType=T.NONE;api={};_debugInfo={};constructor(e,t,n={},r={}){this.allowed=e,this.grantType=t,this.api=n,this._debugInfo=r}isDefinitivelyAllowed(){return this.allowed&&this.grantType!==T.PROVISIONAL}}class x{getConsentData(){}localStorageGrant(){}setStoredPrivacy(){}}var R=Object.freeze({STORAGE_CONFIG:{ID5:{name:"id5id",expiresDays:90},ID5_V2:{name:"id5id_v2",expiresDays:15},LAST:{name:"id5id_last",expiresDays:90},CONSENT_DATA:{name:"id5id_cached_consent_data",expiresDays:30},PRIVACY:{name:"id5id_privacy",expiresDays:30},EXTENSIONS:{name:"id5id_extensions",expiresDays:8/24}},LEGACY_COOKIE_NAMES:["id5.1st","id5id.1st"],PRIVACY:{JURISDICTIONS:{gdpr:!0,ccpa:!1,lgpd:!0,other:!1}},ID5_EIDS_SOURCE:"id5-sync.com"});class U{constructor(e,t){this.name=e,this.expiresDays=t}withNameSuffixed(...e){let t=this.name;for(const n of e)t+=`_${n}`;return new U(t,this.expiresDays)}}class F{constructor(e=void 0){let t=R.STORAGE_CONFIG,n=function(t){let n=void 0!==e?Math.max(1,e):t.expiresDays;return new U(t.name,n)};this.ID5=n(t.ID5),this.ID5_V2=n(t.ID5_V2),this.LAST=n(t.LAST),this.CONSENT_DATA=n(t.CONSENT_DATA),this.PRIVACY=n(t.PRIVACY),this.EXTENSIONS=new U(t.EXTENSIONS.name,t.EXTENSIONS.expiresDays)}static DEFAULT=new F}class N{_clientStore;_trueLinkAdapter;constructor(e,t){this._clientStore=e,this._trueLinkAdapter=t}hasConsentChanged(e){return e&&!this._clientStore.storedConsentDataMatchesConsentData(e)}storeConsent(e){this._clientStore.putHashedConsentData(e)}incNb(e,t=1){this._clientStore.incNbV2(e,t)}updateNbs(e){for(const[t,n]of e){const e=n?.nb;e>0&&this.incNb(t,-e)}}storeResponse(e,t){this._clientStore.putResponseV1(t.getGenericResponse()),this._clientStore.setResponseDateTimeV1(new Date(t.timestamp).toUTCString());const n=new Set;e.forEach((e=>{const r=e.cacheId;if(!n.has(r)){const i=t.getResponseFor(e.integrationId);i&&(this._clientStore.storeResponseV2(r,i,t.timestamp),n.add(r))}})),this._trueLinkAdapter.setPrivacy(t.getGenericResponse()?.privacy)}clearAll(e){this._clientStore.clearResponse(),this._clientStore.clearDateTime(),e.forEach((e=>{const t=e.cacheId;this._clientStore.clearResponseV2(t)})),this._clientStore.clearHashedConsentData(),this._trueLinkAdapter.clearPrivacy(),this._clientStore.clearExtensions()}getCachedResponse(e){const t=this._clientStore.getStoredResponseV2(e);if(t)return new M(t.response,t.responseTimestamp,t.nb)}getCachedExtensions(){return this._clientStore.getExtensions()}storeExtensions(e){let t=b(e.ttl)?e.ttl/86400:F.DEFAULT.EXTENSIONS.expiresDays,n=new U(F.DEFAULT.EXTENSIONS.name,t);return this._clientStore.storeExtensions(e,n)}}class M{response;timestamp;nb;constructor(e,t,n=0){this.response=e,this.timestamp=t,this.nb=n}isExpired(){const e=this.getMaxAge();return!(b(e)&&e>0)||this._isOlderThanSec(e)}_isOlderThanSec(e){return this.timestamp<=0||this.getAgeSec()>e}isStale(){return!this.timestamp||this._isOlderThanSec(1209600)}isResponseComplete(){return w(this.response)&&_(this.response.universal_uid)&&_(this.response.signature)}isValid(){return this.isResponseComplete()&&!this.isStale()}getMaxAge(){return this.response?.cache_control?.max_age_sec}getAgeSec(){return(Date.now()-this.timestamp)/1e3|0}}const L="_exp",V=864e5;class G{storage;_log;constructor(e,n=t){this.storage=e,this._log=n}getItem(e){try{return this.storage.getItem(e)}catch(e){}}setItem(e,t){try{this.storage.setItem(e,t)}catch(e){}}removeItem(e){try{this.storage.removeItem(e)}catch(e){}}removeExpiredObjectWithPrefix(e,t=!1){this._log.info("Check, prefix",e);try{const n=this.storage.getKeysWithPrefix(e);let r=0;for(const e of n)if(t)this._log.info("Found",e," remove it"),this.removeItem(e);else{const t=this.getObjectWithExpiration({name:e}),n=t?.expireAt;n&&n0)return t.data;t?.expireAt&&this.removeItem(e)}catch(t){this._log.error("Error while getting ",e,"object from storage",t)}}updateObjectWithExpiration({name:e,expiresDays:t},n){try{const r=n(this.getObjectWithExpiration({name:e}));return this.setObjectWithExpiration({name:e,expiresDays:t},r),r}catch(t){this._log.error("Error while updating object with ",e,t)}}}class W{getItem(){}removeItem(){}setItem(){}getKeysWithPrefix(){return[]}}const $=new W;class q extends W{_writingEnabled;_underlying;constructor(e,t=!0){super(),this._writingEnabled=t;try{this._underlying=e.localStorage}catch(e){}}getItem(e){try{return this._underlying.getItem(e)}catch(e){}}removeItem(e){try{this._underlying.removeItem(e)}catch(e){}}setItem(e,t){try{this._writingEnabled&&this._underlying.setItem(e,t)}catch(e){}}getKeysWithPrefix(e){try{const t=this._underlying.length;if(this._writingEnabled){const n=[];for(let r=0;r{t.removeItem(e)};this._replicas.forEach(t),this._lastKeyOperation[e]=t}setItem(e,t){this._primaryStorage.setItem(e,t);const n=n=>{n.setItem(e,t)};this._replicas.forEach(n),this._lastKeyOperation[e]=n}addReplica(e){Object.values(this._lastKeyOperation).forEach((t=>t(e))),this._replicas.push(e)}getKeysWithPrefix(e){return this._primaryStorage.getKeysWithPrefix(e)}}const H="undefined"!=typeof Promise&&"undefined"!=typeof fetch;class B{constructor(e,t=void 0){this.url=e||"https://diagnostics.id5-sync.com/measurements",this._metadata=t}publish(e,t=void 0){return e&&e.length>0?(e.forEach((e=>{return t=e.tags,void Object.keys(t).forEach((function(e){let n=t[e];n&&(t[e]=n instanceof Object?JSON.stringify(n):`${n}`)}));var t})),fetch(this.url,{method:"POST",headers:{"Content-Type":"text/plain"},mode:"no-cors",body:JSON.stringify({metadata:{...this._metadata,...t},measurements:e})})):Promise.resolve()}}const J=Object.freeze({});var K=function(e){return e?e instanceof Map?Object.fromEntries(e):e:J},Y=function(e){return Array.from(Object.entries(e),(([e,t])=>`${e}=${t}`)).sort().toString()};const X=Object.freeze({TIMER:"TIMER",SUMMARY:"SUMMARY",COUNTER:"COUNTER"});class Q{name;tags;values;constructor(e,t,n){this.name=e,this.tags=K(t),this.type=n,this.values=[]}reset(){this.values=[]}}class Z extends Q{constructor(e,t=void 0){super(e,t,X.TIMER)}startMeasurement(){try{return new ee(this)}catch(e){return}}record(e){try{isNaN(e)||this.values.push({value:e,timestamp:Date.now()})}catch(e){}}recordNow(){try{this.record(0|performance?.now())}catch(e){}}}class ee{constructor(e=void 0){this.timer=e,this.startTime=performance.now()}record(e=void 0){try{let t=performance.now()-this.startTime|0,n=e||this.timer;return n&&n.record(t),t}catch(e){return}}}class te extends Q{constructor(e,t=void 0){super(e,t,X.COUNTER)}inc(e=1){try{return 0===this.values.length?this.values.push({value:e,timestamp:Date.now()}):(this.values[0].value+=e,this.values[0].timestamp=Date.now()),this.values[0].value}catch(e){}}}class ne extends Q{constructor(e,t=void 0){super(e,t,X.SUMMARY)}record(e){try{this.values.push({value:e,timestamp:Date.now()})}catch(e){}}}class re{has(e){return void 0!==this[e]}set(e,t){return this[e]=t,this}get(e){return this[e]}values(){return Object.entries(this).map((([,e])=>e))}}class ie{_registry;commonTags;_scheduled;constructor(e=void 0,t=void 0){this._registry=new re,this.commonTags=K(e),this.commonPrefix=t}getOrCreate(e,t,n){let r={...t,...this.commonTags},i=this.commonPrefix?this.commonPrefix+"."+e:e;const o=`${i}[${Y(r)}]`;return this._registry.has(o)||this._registry.set(o,n(i,r)),this._registry.get(o)}getAllMeasurements(){return this._registry.values().map((e=>({name:e.name,type:e.type,tags:e.tags,values:e.values}))).filter((function(e){return e.values&&e.values.length>0}))}reset(){Array.from(this._registry.values()).forEach((e=>e.reset()))}addCommonTags(e){this.commonTags={...this.commonTags,...K(e)}}timer(e,t={}){return this.getOrCreate(e,t,((e,t)=>new Z(e,t)))}counter(e,t={}){return this.getOrCreate(e,t,((e,t)=>new te(e,t)))}summary(e,t={}){return this.getOrCreate(e,t,((e,t)=>new ne(e,t)))}publish(e=e=>e,t=void 0){return Promise.resolve(this.getAllMeasurements()).then((n=>e(n,t))).then((()=>this.reset()))}schedulePublishAfterMsec(e,t){if(!this._scheduled){let n=this;setTimeout((()=>(n._scheduled=!1,n.publish(t,{trigger:"fixed-time",fixed_time_msec:e}))),e),this._scheduled=!0}return this}schedulePublishBeforeUnload(e){const t=this,n="undefined"!=typeof AbortController?new AbortController:void 0;return n&&(n.publisher=e,addEventListener("beforeunload",(()=>t.publish(e,{trigger:"beforeunload"})),{capture:!1,signal:n.signal}),this._onUnloadPublishAbortController=n),this}unregister(){const e=this._onUnloadPublishAbortController;if(e)return e.abort(),this.publish(e.publisher,{trigger:"unregister"})}}function oe(){return new ee}function se(e){return{partner:e}}class ae extends ie{constructor(e,t,n=void 0,r=void 0){super({source:e,version:t,...se(n),...r},"id5.api")}loadDelayTimer(e={}){return this.timer("instance.load.delay",e)}fetchCallTimer(e,t={}){return this.timer("fetch.call.time",{status:e,...t})}fetchFailureCallTimer(e={}){return this.fetchCallTimer("fail",e)}fetchSuccessfulCallTimer(e={}){return this.fetchCallTimer("success",e)}extensionsCallTimer(e,t,n={}){return this.timer("extensions.call.time",{extensionType:e,status:t?"success":"fail",...n})}consentRequestTimer(e,t={}){return this.timer("consent.request.time",{requestType:e,...t})}invocationCountSummary(e={}){return this.summary("invocation.count",e)}instanceCounter(e,t={}){return this.counter("instance.count",{instanceId:e,...t})}instanceUniqueDomainsCounter(e,t={}){return this.counter("instance.domains.count",{instanceId:e,...t})}instanceUniqWindowsCounter(e,t={}){return this.counter("instance.windows.count",{instanceId:e,...t})}instanceUniqPartnersCounter(e,t={}){return this.counter("instance.partners.count",{instanceId:e,...t})}instanceJoinDelayTimer(e={}){return this.timer("instance.join.delay.time",e)}instanceLateJoinCounter(e,t={}){return this.counter("instance.lateJoin.count",{instanceId:e,...t})}instanceLateJoinDelayTimer(e={}){return this.timer("instance.lateJoin.delay",{...e})}instanceLastJoinDelayTimer(e={}){return this.timer("instance.lastJoin.delay",{...e})}instanceMsgDeliveryTimer(e={}){return this.timer("instance.message.delivery.time",e)}instanceInvalidMsgCounter(e={}){return this.counter("instance.message.invalid.count",e)}userIdProvisioningDelayTimer(e,t={}){return this.timer("userid.provisioning.delay",{cachedResponseUsed:e,...t})}userIdNotificationDeliveryDelayTimer(e={}){return this.timer("userid.provisioning.delivery.delay",{...e})}userIdProvisioningDuplicateTimer(e={}){return this.timer("userid.provisioning.duplicate",{...e})}cachedUserIdAge(e={}){return this.summary("userid.cached.age",{...e})}consentChangeCounter(e={}){return this.counter("leader.consent.change.count",e)}consentIgnoreCounter(e={}){return this.counter("leader.consent.ignore.count",e)}storageAllKeysCounter(e={}){return this.summary("storage.keys.all.count",e)}storageExpiredKeysCounter(e={}){return this.summary("storage.keys.expired.count",e)}instanceSurvivalTime(e={}){return this.timer("instance.survival.time",e)}localStorageGrantCounter(e={}){return this.counter("consent.lsg.count",e)}consentDiscrepancyCounter(e={}){return this.counter("consent.discrepancy.count",e)}refreshCallCounter(e,t={}){return this.counter("refresh.call.count",{target:e,...t})}}class ce{timestamp;response;constructor(e,t=Date.now()){this.response=e,this.timestamp=t}getGenericResponse(){return this.response.generic}getResponseFor(e){if(this.response?.responses&&this.response?.responses[e])return{...this.response.generic,...this.response.responses[e]}}}class ue{_extensionsProvider;_metrics;_log;constructor(e,t,n){this._extensionsProvider=n,this._metrics=e,this._log=t}fetchId(e,t,n){return this._extensionsProvider.gather(e).then((r=>{const i=e.map((e=>{const i=e.cacheData,o=i?.response?.signature,s=i?.nb,a=i?.getMaxAge();return this._createRequest(t,e,o,s,a,r,n)})),o=this._log,s=this._metrics,a=this;return new Promise(((e,t)=>{const n=oe(),r="https://id5-sync.com/gm/v3";o.info("Fetching ID5 ID from:",r,i),C(r,{success:function(r){o.info("Success at fetch call:",r),n.record(s?.fetchSuccessfulCallTimer());try{e(new ce(a._validateResponse(r)))}catch(e){t(e)}},error:function(e){n.record(s?.fetchFailureCallTimer()),t(e)}},JSON.stringify({requests:i}),{method:"POST",withCredentials:!0},o)}))}))}_validateResponse(e){if(!e||!_(e)||e.length<1)throw new Error(`Empty fetch response from ID5 servers: "${e}"`);const t=JSON.parse(e);if(!w(t.generic))throw new Error(`Server response failed to validate: ${e}`);return this._log.info("Valid json response from ID5 received",t),t}_createRequest(e,t,n,r,i,o,s){this._log.info("Create request data for",{fetchIdData:t,consentData:e,signature:n,nbValue:r,refreshInSecondUsed:i,extensions:o});const a=t.partnerId,c={requestId:t.integrationId,requestCount:t.requestCount,role:t.role,cacheId:t.cacheId,refresh:t.refresh,source:t.source,sourceVersion:t.sourceVersion,partner:a,v:t.originVersion,o:t.origin,tml:t.refererInfo?.topmostLocation,ref:t.refererInfo?.ref,cu:t.refererInfo?.canonicalUrl,u:t.refererInfo?.stack[0]||window.location.href,top:t.refererInfo?.reachedTop?1:0,localStorage:!0===s?1:0,nbPage:r,id5cdn:t.isUsingCdn,ua:window.navigator.userAgent,att:t.att},u=e.gdprApplies;I(u)&&(c.gdpr=u?1:0);const l=e.consentString;I(l)&&(c.gdpr_consent=l),I(t.allowedVendors)?c.allowed_vendors=t.allowedVendors:I(e.allowedVendors)&&(c.allowed_vendors=e.allowedVendors),I(e.gppData)&&(c.gpp_string=e.gppData.gppString,c.gpp_sid=e.gppData.applicableSections.join(",")),I(n)&&(c.s=n);const h=t.uaHints;I(h)&&(c.ua_hints=h),I(e.ccpaString)&&""!==e.ccpaString&&(c.us_privacy=e.ccpaString),function(e){let t=Object.keys(e),n=t.length,r=new Array(n);for(;n--;)r[n]=[t[n],e[t[n]]];return r}({pd:"pd",partnerUserId:"puid",provider:"provider",segments:"segments",trueLink:"true_link"}).forEach((e=>{const[n,r]=e;I(t[n])&&(c[r]=t[n])}));const d=t.abTesting;d&&!0===d.enabled&&(c.ab_testing={enabled:!0,control_group_pct:d.controlGroupPct});const f=t.invalidSegmentsCount;return f&&f>0&&(c._invalid_segments=f),t.trace&&(c._trace=!0),c.provided_options={refresh_in_seconds:t.providedRefreshInSeconds},c.used_refresh_in_seconds=i,c.extensions=o,c}}const le=Object.freeze({CONSENT_UPDATED:"consent_updated",USER_ID_READY:"user_id_ready",CASCADE_NEEDED:"fire_sync_pixel",USER_ID_FETCH_CANCELED:"user_id_fetch_canceled",USER_ID_FETCH_FAILED:"user_id_fetch_failed"}),he=Object.freeze({ID5_MESSAGE_RECEIVED:"message",ID5_INSTANCE_JOINED:"instance-joined",ID5_LEADER_ELECTED:"leader-elected"}),de=Object.freeze([...Object.values(he),...Object.values(le)]);class fe{_handlers;_log;constructor(e=t){this._log=e,this._handlers={}}_dispatch(e,...t){const n=this._handlers[e];if(n)for(const r of n)try{r(...t)}catch(t){this._log.error(`Event ${e} handler execution failed.`,t)}}emit(e,...t){void 0!==e&&de.includes(e)?this._dispatch(e,...t):this._log.warn("Unsupported event",e)}on(e,t){void 0!==e&&de.includes(e)?(this._handlers[e]||(this._handlers[e]=[]),this._handlers[e].push(t)):this._log.warn("Unsupported event",e)}}const pe=Object.freeze({DIRECT_METHOD:"direct_method",POST_MESSAGE:"post_message"});class ge{_instanceProperties;_log;callType;_instanceWindow;constructor(e,n,r,i=t){this._instanceWindow=n,this._instanceProperties=r,this._log=i,this.callType=e}getId(){return this._instanceProperties.id}getFetchIdData(){return this._instanceProperties.fetchIdData}updateFetchIdData(e){Object.assign(this._instanceProperties.fetchIdData,e)}getCacheId(){const e=this._instanceProperties.fetchIdData,t={partnerId:e.partnerId,att:e.att,pd:e.pd,provider:e.provider,abTesting:e.abTesting,segments:JSON.stringify(e.segments),providedRefresh:e.providedRefreshInSeconds,trueLink:e.trueLink?.id};return E(JSON.stringify(t))}getDeclaredConsentSource(){return this._instanceProperties.fetchIdData.consentSource||D.cmp}getSourceVersion(){return this._instanceProperties.sourceVersion}getSource(){return this._instanceProperties.source}notifyUidReady(){}notifyFetchUidCanceled(){}notifyCascadeNeeded(){}canDoCascade(){return!0===this._instanceProperties.canDoCascade}getStorage(){return $}getWindow(){return this._instanceWindow}}class me extends ge{_dispatcher;_provisionedUids;_metrics;constructor(e,n,r,i=t,o){super(pe.DIRECT_METHOD,e,n,i),this._dispatcher=r,this._metrics=o,this._provisionedUids=new Map}notifyUidReady(e,t){const n=e?.responseObj?.universal_uid;if(n)if(this._provisionedUids.has(n)){const e=this._provisionedUids.get(n);this._metrics.userIdProvisioningDuplicateTimer({provisioner:t.provisioner,firstProvisioner:e.provisioner}).record(performance.now()-e.time)}else this._provisionedUids.set(n,{provisioner:t.provisioner,time:performance.now()}),this._dispatcher.emit(le.USER_ID_READY,e,t)}notifyFetchUidCanceled(e){this._dispatcher.emit(le.USER_ID_FETCH_CANCELED,e)}notifyCascadeNeeded(e){this._dispatcher.emit(le.CASCADE_NEEDED,e)}}class ve extends W{_messenger;_destinationId;constructor(e,t){super(),this._messanger=e,this._destinationId=t}getItem(){}removeItem(e){this._remoteCall("removeItem",[e])}setItem(e,t){this._remoteCall("setItem",[e,t])}_remoteCall(e,t){this._messanger.callProxyMethod(this._destinationId,l.STORAGE,e,t)}}class _e extends ge{_messenger;constructor(e,n,r=t){super(pe.POST_MESSAGE,e.getWindow(),e.properties,r),this._messenger=n}_callProxy(e,t){this._messenger.callProxyMethod(this.getId(),l.FOLLOWER,e,t)}notifyUidReady(e,t){this._callProxy("notifyUidReady",[e,t])}notifyFetchUidCanceled(e){this._callProxy("notifyFetchUidCanceled",[e])}notifyCascadeNeeded(e){this._callProxy("notifyCascadeNeeded",[e])}getStorage(){return new ve(this._messenger,this.getId())}}class ye{_store;_log;_provisioner;_meter;constructor(e,t,n,r){this._provisioner=e,this._store=t,this._log=n,this._meter=r}provisionFromCache(e,t=void 0){try{const n=this._log,r=e.getCacheId(),i=this._store.getCachedResponse(r),o=!i||!i.isValid()||i.isExpired();let s=!1;if(i){const e=i.getAgeSec();this._meter.cachedUserIdAge({expired:i.isExpired(),valid:i.isValid(),provisioner:this._provisioner,maxAge:i.getMaxAge()}).record(isNaN(e)?0:e)}return i&&i.isValid()?(n.info("Found valid cached response for instance ",JSON.stringify({id:e.getId(),cacheId:e.getCacheId(),provisioner:this._provisioner,responseFromCache:i})),e.notifyUidReady({timestamp:i.timestamp,responseObj:i.response,isFromCache:!0,willBeRefreshed:!!o},{timestamp:Date.now(),provisioner:this._provisioner,tags:{callType:e.callType,...t}}),s=!0):n.info("Couldn't find response for cacheId",e.getCacheId()),{cacheId:r,responseFromCache:i,refreshRequired:o,provisioned:s}}catch(e){return this._log.error("Cached UserId provisioning failure",e),{refreshRequired:!0,provisioned:!1}}}}class be{lateJoiner=!1;uniqueLateJoiner=!1;constructor(e=!1,t=!1){this.lateJoiner=e,this.uniqueLateJoiner=t}}class we{updateConsent(){}updateFetchIdData(){}refreshUid(){}addFollower(){}getProperties(){}}class Ie extends we{_followers;_followersRequests={};_refreshRequired={};_fetcher;_log;_consentManager;_inProgressFetch;_queuedRefreshArgs;_lastConsentDataSet;_metrics;_leaderStorage;_store;constructor(e,n,r,i,o,s,a=t,c){super(),this._followers=[],this._fetcher=c,this._properties=n,this._consentManager=o,this._metrics=s,this._window=e,this._leaderStorage=r,this._log=a,this._store=i,this._firstFetchTriggered=!1,this._cachedIdProvider=new ye("leader",this._store,this._log,this._metrics)}_handleRefreshResult(e,t,n,r){const i=this._log,o=this._consentManager,s=this._store;if(void 0!==r){o.setStoredPrivacy(r.getGenericResponse()?.privacy);const a=o.localStorageGrant("fetcher-after-response");a.isDefinitivelyAllowed()?(i.info("Storing ID and request hashes in cache"),s.updateNbs(t),s.storeResponse(e,r)):(i.info("Cannot use local storage to cache ID",a),s.clearAll(e));for(const t of e){const e=t.integrationId;this._followersRequests[e]=(this._followersRequests[e]||0)+1}const c=[];for(const e of this._followers){const t=r.getResponseFor(e.getId());void 0!==t&&(this._log.debug("Notify uid ready.","Follower:",e.getId(),"Uid:",t),this._refreshRequired[e.getId()]=!1,this._notifyUidReady(e,{timestamp:r.timestamp,responseObj:t,isFromCache:!1}),!0===t.cascade_needed&&c.push(e.getId()))}void 0!==n&&c.length>0&&this._consentManager.localStorageGrant("leader-before-cascade").isDefinitivelyAllowed()&&this._handleCascade(c,r,n)}}_notifyUidReady(e,t){const n={timestamp:Date.now(),provisioner:"leader",tags:{callType:e.callType}};e.notifyUidReady(t,n)}_handleCascade(e,t,n){const r=this._followers.filter((t=>void 0!==e.find((e=>t.getId()===e))&&t.canDoCascade())).sort(((e,t)=>{const n=function(e){return e.getFetchIdData().refererInfo?.stack?.length||Number.MAX_SAFE_INTEGER};return n(e)-n(t)}));if(r.length>0){const e=r[0];e.notifyCascadeNeeded({partnerId:e.getFetchIdData().partnerId,userId:t.getResponseFor(e.getId()).universal_uid,gdprApplies:n.gdprApplies,consentString:n.consentString,gppString:n.gppData?.gppString,gppSid:n.gppData?.applicableSections?.join(",")})}else this._log.error("Couldn't find cascade eligible follower")}_handleCancel(e){for(const t of this._followers)t.notifyFetchUidCanceled({reason:e})}_getId(e=!1){const t=this._log;this._waitForConsent().then((n=>{const r=this._consentManager.localStorageGrant("fetch-before-request");if(t.info("Local storage grant",r),r.allowed){const i=this._store.hasConsentChanged(n);r.isDefinitivelyAllowed()&&this._store.storeConsent(n);const o=q.checkIfAccessible(),s=new Map;let a=e;const c=this._followers.map((e=>{const t=e.getId(),n=(this._followersRequests[t]||0)+1,r=this._properties.id,i=!0===this._refreshRequired[e.getId()];a=a||i;const o=e.getCacheId();if(!s.has(o)){const e=this._store.getCachedResponse(o);e&&s.set(o,e)}return{...e.getFetchIdData(),integrationId:t,requestCount:n,refresh:i,role:r===e.getId()?"leader":"follower",cacheId:o,cacheData:s.get(o),sourceVersion:e.getSourceVersion(),source:e.getSource()}}));i||a?(t.info("Decided to fetch a fresh ID5 ID",{consentHasChanged:i,shouldRefresh:a}),t.info(`Fetching ID5 ID (forceFetch:${e})`),this._inProgressFetch=!0,this._firstFetchTriggered=!0,this._fetcher.fetchId(c,n,o).then((e=>{this._handleRefreshResult(c,s,n,e),this._handleFetchCompleted()})).catch((e=>{this._handleFailed(e),this._handleFetchCompleted()}))):(t.info("Not decided to refresh ID5 ID",{consentHasChanged:i,shouldRefresh:a}),this._handleFetchCompleted())}else t.info("No legal basis to use ID5",n),this._store.clearAll(this._followers.map((e=>({cacheId:e.getCacheId()})))),this._handleCancel("No legal basis to use ID5")}))}_waitForConsent(){const e=this._log,t=this._consentManager,n=this._metrics;e.info("Waiting for consent");const r=n.timer("fetch.consent.wait.time");return t.getConsentData().then((t=>(e.info("Consent received",t),r&&r.recordNow(),t)))}start(){!0!==this._started&&(this._getId(!1),this._started=!0)}refreshUid(e={},t){const n=!0===e.forceFetch;if(t)if(n)this._refreshRequired[t]=!0;else{const e=this._followers.find((e=>e.getId()===t));e&&this._provisionFromCache(e)}this._metrics.refreshCallCounter("leader",{overwrites:void 0===this._queuedRefreshArgs}).inc(),this._callRefresh(e,t)}_callRefresh(e={},t){this._inProgressFetch?this._queuedRefreshArgs=[e,t]:(!0===e.resetConsent&&(this._consentManager.resetConsentData(!0===e.forceAllowLocalStorageGrant),this._awaitedConsentFrom=t),this._getId(!0===e.forceFetch))}updateConsent(e,t){if(this._consentManager.hasConsentSet())this._handleIgnoredConsentUpdate(e);else{const n=new Set(this._followers.map((e=>e.getDeclaredConsentSource()))),r=e.source||D.cmp,i=1===n.size&&n.has(D.partner);this._awaitedConsentFrom?this._awaitedConsentFrom===t?(this._consentManager.setConsentData(e),this._awaitedConsentFrom=void 0):this._handleIgnoredConsent(e,"awaited"):r!==D.partner||i?this._consentManager.setConsentData(e):this._handleIgnoredConsent(e,"partner")}}_handleIgnoredConsentUpdate(e){try{const t=this._consentManager._consentDataHolder.getValue();if(t){const n={},r=j.createFrom(e);Object.values(O).forEach((e=>{if(r.apiTypes.includes(e)&&t.apiTypes.includes(e)){const i=JSON.stringify(t.getApiTypeData(e)),o=JSON.stringify(r.getApiTypeData(e));n[e]=i===o?"same":"different"}else r.apiTypes.includes(e)?n[e]="added":t.apiTypes.includes(e)&&(n[e]="missed")})),this._metrics.consentChangeCounter(n).inc()}}catch(e){this._log.error(e)}}_handleIgnoredConsent(e,t){try{const n={reason:t,source:e.source};e.apiTypes.forEach((e=>n[e]=!0)),this._metrics.consentIgnoreCounter(n)}catch(e){this._log.error(e)}}updateFetchIdData(e,t){const n=this._followers.find((t=>t.getId()===e)),r=n.getCacheId();n.updateFetchIdData(t);const i=n.getCacheId();i!==r&&(this._log.info("Follower",n.getId(),"cacheId changed from",r," to",i,"required refresh"),this._refreshRequired[n.getId()]=!0)}addFollower(e){const t=this._log,n=void 0===this._followers.find((t=>t.getCacheId()===e.getCacheId()));if(this._followers.push(e),t.info("Added follower",e.getId(),"cacheId",e.getCacheId()),this._window!==e.getWindow()){const n=e.getStorage();t.info("Adding follower's",e.getId(),"storage as replica"),this._leaderStorage.addReplica(n)}const r=this._provisionFromCache(e);let i=new be;return!0===this._firstFetchTriggered&&(i.lateJoiner=!0,i.uniqueLateJoiner=n,r&&this._callRefresh({forceFetch:!0})),i}_provisionFromCache(e){const t=this._cachedIdProvider.provisionFromCache(e);return this._refreshRequired[e.getId()]=t.refreshRequired,t.provisioned&&this._store.incNb(t.cacheId),t.refreshRequired}getProperties(){return this._properties}_handleFetchCompleted(){this._inProgressFetch=void 0,this._queuedRefreshArgs&&(this._callRefresh(...this._queuedRefreshArgs),this._queuedRefreshArgs=void 0)}_handleFailed(e){this._log.error("Fetch id failed",e);for(const e of this._followers)e.notifyFetchUidCanceled({reason:"error"})}}class Se extends we{_messenger;_leaderInstanceProperties;constructor(e,t){super(),this._messenger=e,this._leaderInstanceProperties=t}_sendToLeader(e,t){this._messenger.callProxyMethod(this._leaderInstanceProperties.id,l.LEADER,e,t)}updateConsent(e,t){this._sendToLeader("updateConsent",[e,t])}refreshUid(e,t){this._sendToLeader("refreshUid",[e,t])}updateFetchIdData(e,t){this._sendToLeader("updateFetchIdData",[e,t])}getProperties(){return this._leaderInstanceProperties}}class Ce extends we{_callsQueue=[];_assignedLeader;updateConsent(e,t){this._callOrBuffer("updateConsent",[e,t])}updateFetchIdData(e,t){this._callOrBuffer("updateFetchIdData",[e,t])}refreshUid(e,t){this._callOrBuffer("refreshUid",[e,t])}addFollower(e){return this._callOrBuffer("addFollower",[e])}getProperties(){if(this._assignedLeader)return this._assignedLeader.getProperties()}assignLeader(e){this._assignedLeader=e;for(const e of this._callsQueue)this._callAssignedLeader(e.name,e.args);this._callsQueue=[]}_callOrBuffer(e,t){return this._assignedLeader?this._callAssignedLeader(e,t):void this._callsQueue.push({name:e,args:t})}_callAssignedLeader(e,t){return this._assignedLeader[e](...t)}}class Ee{_valuePromise;_value;_resolve;_hasValue;constructor(){this.reset()}reset(){this._value=void 0,this._hasValue=!1,this._valuePromise=new Promise((e=>{this._resolve=e}))}set(e){this._hasValue?this._valuePromise=Promise.resolve(e):(this._hasValue=!0,this._resolve(e)),this._value=e}getValuePromise(){return this._valuePromise}hasValue(){return this._hasValue}getValue(){return this._value}}class De extends x{_consentDataHolder;storedPrivacyData;localStorage;_forceAllowLocalStorageGrant;constructor(e,t,n,r,i){super(),this._log=r,this.localStorage=e,this.storageConfig=t,this._consentDataHolder=new Ee,this._forceAllowLocalStorageGrant=n,this._metrics=i}isForceAllowLocalStorageGrant(){return this._forceAllowLocalStorageGrant}resetConsentData(e){this._consentDataHolder.reset(),this.storedPrivacyData=void 0,this._forceAllowLocalStorageGrant=e}localStorageGrant(e="unknown"){const t=this._getLocalStorageGrant();return this._metrics?.localStorageGrantCounter({allowed:t.allowed,grantType:t.grantType,lsgContext:e,consentSet:this._consentDataHolder?.hasValue(),...t.api,...t._debugInfo})?.inc(),t}_getLocalStorageGrant(){const e=this._log;if(!0===this._forceAllowLocalStorageGrant)return e.warn("cmpApi: Local storage access granted by configuration override, consent will not be checked"),new k(!0,T.FORCE_ALLOWED_BY_CONFIG);if(!this._consentDataHolder.hasValue()||0===this._consentDataHolder.getValue().apiTypes.length){if(!w(this.storedPrivacyData)){const t=this.localStorage.getItemWithExpiration(this.storageConfig.PRIVACY);this.storedPrivacyData=t&&JSON.parse(t),e.info("cmpApi: Loaded stored privacy data from local storage",this.storedPrivacyData)}if(this.storedPrivacyData&&!0===this.storedPrivacyData.id5_consent)return new k(!0,T.ID5_CONSENT);if(!this.storedPrivacyData||!I(this.storedPrivacyData.jurisdiction))return new k(!0,T.PROVISIONAL);const t=this.storedPrivacyData.jurisdiction,n=t in R.PRIVACY.JURISDICTIONS&&R.PRIVACY.JURISDICTIONS[t];return new k(!1===n,T.JURISDICTION)}return this._consentDataHolder.getValue().localStorageGrant()}setStoredPrivacy(e){const t=this._log;try{w(e)?(this.storedPrivacyData=e,this.localStorage.setItemWithExpiration(this.storageConfig.PRIVACY,JSON.stringify(e))):t.error("cmpApi: Cannot store privacy data if it is not an object",e)}catch(e){t.error("cmpApi: Error while storing privacy data",e)}}setConsentData(e){this._log.debug("Set consent data",e);let t=j.createFrom(e);this._consentDataHolder.set(t)}getConsentData(){return this._consentDataHolder.getValuePromise()}hasConsentSet(){return this._consentDataHolder.hasValue()}}class Ae{localStorageGrantChecker;localStorage;_log;constructor(e,t,n,r){this.localStorageGrantChecker=e,this.localStorage=t,this.storageConfig=n,this._log=r}get(e){const t=this._log;try{const n=this.localStorageGrant();if(n.isDefinitivelyAllowed()){let n=this.localStorage.getItemWithExpiration(e);return t.info(`Local storage get key=${e.name} value=${n}`),n}t.warn("clientStore.get() has been called without definitive grant",n)}catch(e){t.error(e)}}_getObject(e){const t=this._log;try{const n=this.localStorageGrant();if(n.isDefinitivelyAllowed()){let n=this.localStorage.getObjectWithExpiration(e);return t.info(`Local storage get key=${e.name} value=${n}`),n}t.warn("clientStore.get() has been called without definitive grant",n)}catch(e){t.error(e)}}clear(e){const t=this._log;try{this.localStorage.removeItemWithExpiration(e)}catch(e){t.error(e)}}scheduleGC(e){const t=this.localStorageGrant(),n=this.localStorage,r=this.storageConfig.ID5_V2.name;setTimeout((function(){if(t.isDefinitivelyAllowed()){const t=n.removeExpiredObjectWithPrefix(r);e.storageAllKeysCounter().record(t?.all||0),e.storageExpiredKeysCounter().record(t?.expired||0)}}),0)}_clearObject(e){const t=this._log;try{this.localStorage.removeItem(e.name)}catch(e){t.error(e)}}_put(e,t){const n=this._log;try{const r=this.localStorageGrant();r.isDefinitivelyAllowed()?(n.info(`Local storage put key=${e.name} value=${t}`),this.localStorage.setItemWithExpiration(e,t)):n.warn("clientStore._put() has been called without definitive grant",r)}catch(e){n.error(e)}}_updateObject(e,t){const n=this._log;try{const r=this.localStorageGrant();if(r.isDefinitivelyAllowed())return this.localStorage.updateObjectWithExpiration(e,t);n.warn("clientStore._updateObject() has been called without definitive grant",r)}catch(e){n.error(e)}}localStorageGrant(){return this.localStorageGrantChecker()}getResponse(){let e=this.get(this.storageConfig.ID5);return e?JSON.parse(decodeURIComponent(e)):e}clearResponse(){this.clear(this.storageConfig.ID5)}clearResponseV2(e){this._clearObject(this.storageConfig.ID5_V2.withNameSuffixed(e))}putResponseV1(e){this._put(this.storageConfig.ID5,encodeURIComponent(_(e)?e:JSON.stringify(e)))}getHashedConsentData(){return this.get(this.storageConfig.CONSENT_DATA)}clearHashedConsentData(){this.clear(this.storageConfig.CONSENT_DATA)}putHashedConsentData(e){e!==new j&&this._put(this.storageConfig.CONSENT_DATA,e.hashCode())}clearDateTime(){this.clear(this.storageConfig.LAST)}setResponseDateTimeV1(e){this._put(this.storageConfig.LAST,e)}storeResponseV2(e,t,n=Date.now()){return this._updateObject(this.storageConfig.ID5_V2.withNameSuffixed(e),(e=>({...e,response:t,responseTimestamp:n})))}getStoredResponseV2(e){return this._getObject(this.storageConfig.ID5_V2.withNameSuffixed(e))}incNbV2(e,t=1){return this._updateObject(this.storageConfig.ID5_V2.withNameSuffixed(e),(e=>{const n=Math.max(0,b(e?.nb)?Math.round(e.nb)+t:t);return{...e,nb:n}}))}static storedDataMatchesCurrentData(e,t){return null==e||e===t}storedConsentDataMatchesConsentData(e){return Ae.storedDataMatchesCurrentData(this.getHashedConsentData(),e.hashCode())}getExtensions(){return this._getObject(this.storageConfig.EXTENSIONS)}storeExtensions(e,t){return this._updateObject(t,(()=>e))}clearExtensions(){return this.clear(this.storageConfig.EXTENSIONS)}}class Oe{_metrics;_log;_store;constructor(e,t,n){this._metrics=e,this._log=t,this._store=n}static CHUNKS_CONFIGS=Object.freeze({devChunks:{name:"devChunks",urlVersion:3,length:8,version:4},groupChunks:{name:"groupChunks",urlVersion:4,length:8,version:4}});static DEFAULT_RESPONSE={lbCDN:"%%LB_CDN%%"};static getChunkUrl(e,t){return`https://d${e}.eu-${t}-id5-sync.com`}submitExtensionCall(e,t,n=void 0){let r=oe();return fetch(e,n).then((n=>{if(n.ok)return r.record(this._metrics.extensionsCallTimer(t,!0)),n.json();{r.record(this._metrics.extensionsCallTimer(t,!1));let i=`The call to get extensions at ${e} was not ok, status: ${n.status}, statusText: ${n.statusText}`;return this._log.warn(i),Promise.reject(new Error(i))}})).catch((n=>(r.record(this._metrics.extensionsCallTimer(t,!1)),this._log.warn(`Got error from ${e} endpoint`,n),{})))}gatherChunks(e,t){if(e){let e=oe();return Promise.all(Array.from({length:t.length},((e,n)=>{const r=Oe.getChunkUrl(n,t.urlVersion);return fetch(r).then((e=>{if(e.ok)return e.text();throw new Error(`The call to get ${t.name} was not ok, status: ${e.status}, statusText: ${e.statusText}`)}))}))).then((n=>(e.record(this._metrics.extensionsCallTimer(t.name,!0)),{[t.name]:n,[t.name+"Version"]:`${t.version}`}))).catch((n=>(e.record(this._metrics.extensionsCallTimer(t.name,!1)),this._log.warn(`Got error when getting ${t.name}`,n),{})))}return Promise.resolve({})}gather(e){let t=this._store.getCachedExtensions();if(void 0!==t)return Promise.resolve(t);let n=oe(),r=this._submitBounce(e);return this.submitExtensionCall("https://lb.eu-1-id5-sync.com/lb/v1","lb").then((e=>{let t=this.getChunksEnabled(e);return Promise.allSettled([Promise.resolve(e),this.gatherChunks(t,Oe.CHUNKS_CONFIGS.devChunks),this.gatherChunks(t,Oe.CHUNKS_CONFIGS.groupChunks),r])})).then((e=>{n.record(this._metrics.extensionsCallTimer("all",!0));let t=Oe.DEFAULT_RESPONSE;return e.forEach((e=>{e.value&&(t={...t,...e.value})})),this._store.storeExtensions(t),t})).catch((e=>(n.record(this._metrics.extensionsCallTimer("all",!1)),this._log.error(`Got error ${e} when gathering extensions data`),Oe.DEFAULT_RESPONSE)))}_submitBounce(e){return e.some((e=>I(e.cacheData?.signature)))?Promise.resolve({}):this.submitExtensionCall("https://id5-sync.com/bounce","bounce",{credentials:"include"})}getChunksEnabled(e){let t=e?.chunks;return 0!==t&&t}}const Pe=Object.freeze({UNKNOWN:"unknown",LEADER:"leader",FOLLOWER:"follower"}),je=Object.freeze({MULTIPLEXING:"multiplexing",SINGLETON:"singleton"}),Te=Object.freeze({AWAITING_SCHEDULE:"awaiting_schedule",SKIPPED:"skipped",SCHEDULED:"scheduled",COMPLETED:"completed",CANCELED:"canceled"});class ke{properties;knownState;_joinTime;_window;constructor(e,t,n){this.properties=e,this.knownState=t,this._window=n,this._joinTime=performance.now()}getId(){return this.properties.id}isMultiplexingPartyAllowed(){return this.knownState?.operatingMode===je.MULTIPLEXING}getInstanceMultiplexingLeader(){if(this.knownState?.operatingMode===je.MULTIPLEXING)return this.knownState?.multiplexing?.leader}getWindow(){return this._window}}class xe{_knownValues=[];_counter;constructor(e){this._counter=e}add(e){e&&-1===this._knownValues.indexOf(e)&&(this._counter.inc(),this._knownValues.push(e))}}class Re{_instancesCounter;_domainsCounter;_windowsCounter;_partnersCounter;constructor(e,t){let n=t.id;this._instancesCounter=e.instanceCounter(t.id),this._windowsCounter=new xe(e.instanceUniqWindowsCounter(n)),this._partnersCounter=new xe(e.instanceUniqPartnersCounter(n)),this._domainsCounter=new xe(e.instanceUniqueDomainsCounter(n))}addInstance(e){this._instancesCounter.inc(),this._partnersCounter.add(e?.fetchIdData?.partnerId|e?.sourceConfiguration?.options?.partnerId),this._domainsCounter.add(e?.domain),this._windowsCounter.add(e?.href)}}class Ue{_scheduleTime;_closeTime;_timeoutId;_state=Te.AWAITING_SCHEDULE;_delayMs;_instance;constructor(e){this._instance=e}schedule(e){const t=this;t._delayMs=e,this._timeoutId=setTimeout((()=>{t._timeoutId&&(t._timeoutId=void 0,t._instance._doElection(),t._closeWithState(Te.COMPLETED))}),t._delayMs),t._state=Te.SCHEDULED,t._scheduleTime=performance.now()}skip(){this._closeWithState(Te.SKIPPED)}cancel(){this._timeoutId&&(clearTimeout(this._timeoutId),this._timeoutId=void 0),this._closeWithState(Te.CANCELED)}_closeWithState(e){this._state=e,this._closeTime=performance.now()}}class Fe{properties;_messenger;_knownInstances=new Map;_lastJoinedInstance;role;_leader;_mode;_metrics;_logger;_instanceCounters;_election;_window;_storage;_trueLinkAdapter;_cachedIdProvider;constructor(e,t,n,r,i,o,s){const a=I(globalThis)&&I(globalThis.crypto)&&v(globalThis.crypto.randomUUID)?globalThis.crypto.randomUUID():""+(1e6*Math.random()|0);this.properties=Object.assign({id:a,version:"1.0.33",href:e.location?.href,domain:e.location?.hostname},t),this.role=Pe.UNKNOWN,this._metrics=r,this._instanceCounters=new Re(r,this.properties),this._loadTime=performance.now(),this._logger=new Ne(i,this),this._window=e,this._dispatcher=new fe(this._logger),this._leader=new Ce,this._followerRole=new me(this._window,this.properties,this._dispatcher,this._logger,this._metrics),this._election=new Ue(this),this._storage=n,this._trueLinkAdapter=o,this._cachedIdProvider=new ye("self",new N(s,o),this._logger,this._metrics)}updateConfig(e){Object.assign(this.properties,e)}init(e=500){let t=this,n=t._window;t._mode=!0===t.properties.singletonMode?je.SINGLETON:je.MULTIPLEXING,t._instanceCounters.addInstance(t.properties),function(e){const t=e._metrics;[100,200,500,1e3,2e3,3e3,5e3].forEach((n=>{setTimeout((()=>{const r=(e._knownInstances?.size||0)+1;t.summary("instance.partySize",{after:n,electionState:e._election._state}).record(r)}),n)}))}(t),t._messenger=new f(t.properties.id,n,t._logger,t._metrics),t._messenger.onAnyMessage(((e,r)=>{let i=Date.now()-e.timestamp|0;t._metrics.instanceMsgDeliveryTimer({messageType:e.type,sameWindow:n===r}).record(i),t._logger.debug("Message received",e),t._doFireEvent(he.ID5_MESSAGE_RECEIVED,e)})).onMessage(u.TYPE,((e,n)=>{let r=Object.assign(new u,e.payload);void 0===r.isResponse&&(r.isResponse=e.dst!==s),t._handleHelloMessage(r,e,n)})).onProxyMethodCall(new d(this._logger).registerTarget(l.LEADER,t._leader).registerTarget(l.FOLLOWER,t._followerRole).registerTarget(l.STORAGE,t._storage)),t._mode===je.SINGLETON?(t._election.skip(),t._onLeaderElected(t.properties)):t._mode===je.MULTIPLEXING&&t._election.schedule(e),t._messenger.broadcastMessage(t._createHelloMessage(!1),u.TYPE)}register(e){try{this.updateConfig(e),this.init()}catch(e){this._logger.error("Failed to register integration instance",e)}return this}_handleHelloMessage(e,t,n){this._joinInstance(e,t,n)}unregister(){this._logger.info("Unregistering"),this._messenger&&this._messenger.unregister()}on(e,t){return this._dispatcher.on(e,t),this}_joinInstance(e,t,n){const r=e.isResponse,i=new ke(e.instance,e.instanceState,n);if(this._knownInstances.get(i.getId()))this._logger.debug("Instance already known",i.getId());else{if(this._knownInstances.set(i.getId(),i),this._lastJoinedInstance=i,this._instanceCounters.addInstance(i.properties),this._metrics.instanceJoinDelayTimer({election:this._election._state}).record(performance.now()-this._loadTime|0),r){const e=i.getInstanceMultiplexingLeader();this._mode===je.MULTIPLEXING&&this.role===Pe.UNKNOWN&&void 0!==e&&(this._logger.info("Joined late, elected leader is",e),this._election.cancel(),this._onLeaderElected(e))}else this._messenger.sendResponseMessage(t,this._createHelloMessage(!0),u.TYPE),this._mode===je.MULTIPLEXING&&this.role!==Pe.UNKNOWN&&this._handleLateJoiner(i);this._logger.debug("Instance joined",i.getId()),this._doFireEvent(he.ID5_INSTANCE_JOINED,i.properties)}}_createHelloMessage(e=!1){let t={operatingMode:this._mode,knownInstances:Array.from(this._knownInstances.values()).map((e=>e.properties))};return this._mode===je.MULTIPLEXING&&(t.multiplexing={role:this.role,electionState:this._election?._state,leader:this._leader.getProperties()}),new u(this.properties,e,t)}_handleLateJoiner(e){this._logger.info("Late joiner detected",e.properties);const t=this._metrics.instanceLateJoinCounter(this.properties.id,{scope:"party"}).inc();if(this._metrics.instanceLateJoinDelayTimer({election:this._election._state,isFirst:1===t}).record(performance.now()-this._election._closeTime),e.isMultiplexingPartyAllowed()&&this.role===Pe.LEADER){let t=this._leader.addFollower(new _e(e,this._messenger,this._logger));!0===t?.lateJoiner&&this._metrics.instanceLateJoinCounter(this.properties.id,{scope:"leader",unique:!0===t?.uniqueLateJoiner}).inc()}}_doFireEvent(e,...t){this._dispatcher.emit(e,...t)}_actAsLeader(){const e=this.properties,t=this._logger,n=this._metrics,r=new z(this._storage),i=new G(r),o=new F(e.storageExpirationDays),s=new De(i,o,e.forceAllowLocalStorageGrant,t,n),a=new N(new Ae((()=>s.localStorageGrant("client-store")),i,o,t),this._trueLinkAdapter),c=new ue(n,t,function(e,t,n){return new Oe(e,t,n)}(n,t,a)),u=new Ie(this._window,e,r,a,s,n,t,c);u.addFollower(this._followerRole),this._leader.assignLeader(u),this._mode===je.MULTIPLEXING&&Array.from(this._knownInstances.values()).filter((e=>e.isMultiplexingPartyAllowed())).map((e=>u.addFollower(new _e(e,this._messenger,t)))),u.start()}_followRemoteLeader(e){this._leader.assignLeader(new Se(this._messenger,e)),this._logger.info("Following remote leader ",e)}updateConsent(e){this._leader.updateConsent(e,this.properties.id)}updateFetchIdData(e){this._leader.updateFetchIdData(this.properties.id,e),Object.assign(this.properties.fetchIdData,e)}refreshUid(e){this._leader.refreshUid(e,this.properties.id)}_doElection(){const e=this._election,t=this._knownInstances;let n=Array.from(t.values()).filter((e=>e.isMultiplexingPartyAllowed())).map((e=>e.properties));n.push(this.properties),this._onLeaderElected(function(e){if(e&&0!==e.length)return e.sort(((e,t)=>{let n=-(0|p(e.version,t.version));return 0===n&&(n=e.source.localeCompare(t.source),0===n&&(n=-(0|p(e.sourceVersion,t.sourceVersion))),0===n&&(n=(e.fetchIdData?.refererInfo?.numIframes||Number.MAX_SAFE_INTEGER)-(t.fetchIdData?.refererInfo?.numIframes||Number.MAX_SAFE_INTEGER)),0===n&&(n=e.id.localeCompare(t.id))),n}))[0]}(n));const r=this._lastJoinedInstance;r&&this._metrics.instanceLastJoinDelayTimer().record(Math.max(r._joinTime-e._scheduleTime,0))}_onLeaderElected(e){const t=this;t.role=e.id===t.properties.id?Pe.LEADER:Pe.FOLLOWER,t.role===Pe.LEADER?t._actAsLeader():t.role===Pe.FOLLOWER&&t._followRemoteLeader(e),t._logger.debug("Leader elected",e.id,"my role",t.role),t._doFireEvent(he.ID5_LEADER_ELECTED,t.role,t._leader.getProperties())}getId(){return this.properties.id}lookupForCachedId(){return this._logger.info("Self lookup for cachedId triggered"),this._cachedIdProvider.provisionFromCache(this._followerRole)}}class Ne extends e{_instance;constructor(e,n){super(),this._delegate=e||t,this._instance=n}_prefix(){return`Instance(id=${this._instance.getId()}, role=${this._instance.role})`}debug(...e){this._delegate.debug((new Date).toISOString(),this._prefix(),...e)}info(...e){this._delegate.info((new Date).toISOString(),this._prefix(),...e)}warn(...e){this._delegate.warn((new Date).toISOString(),this._prefix(),...e)}error(...e){this._delegate.error((new Date).toISOString(),this._prefix(),...e)}}var Me=new class{createInstance(e,t,n,r,i,o){return new Fe(e,{},r,n,t,i,o)}};const Le="TRUE"===Be("id5_debug").toUpperCase(),Ve="TRACE"===Be("id5_debug").toUpperCase(),Ge=Boolean(window.console);let We=!1;function $e(e,t,n,r,i){ze()&&Ge&&e&&e.apply(console,[`%cID5 - ${t}#${n}`,"color: #fff; background: #1c307e; padding: 1px 4px; border-radius: 3px;",r].concat(i))}function qe(e){We=!!e}function ze(){return Le||Ve||We}class He extends e{_invocationId;_origin;constructor(e,t){super(),this._invocationId=t,this._origin=e}debug(...e){!function(e,t,...n){$e(console.info,e,t,"DEBUG",n)}(this._origin,this._invocationId,...e)}info(...e){!function(e,t,...n){$e(console.info,e,t,"INFO",n)}(this._origin,this._invocationId,...e)}warn(...e){!function(e,t,...n){$e(console.warn,e,t,"WARNING",n)}(this._origin,this._invocationId,...e)}error(...e){!function(e,t,...n){$e(console.error,e,t,"ERROR",n)}(this._origin,this._invocationId,...e)}}function Be(e){const t=new RegExp("[\\?&]"+e+"=([^&#]*)").exec(window.location.search);return null===t?"":decodeURIComponent(t[1].replace(/\+/g," "))}const Je=m,Ke=v,Ye=_,Xe=y,Qe=b,Ze=w,et=function(e){return m(e,"Boolean")},tt=I;function nt(e){(new Image).src=e}function rt(e,t,n,r,i){for(t=t.split?t.split("."):t,r=0;rnull!=e&&"object"==typeof e;function ot(e,t){if(!it(e)||!it(t))return e===t;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(!ot(e[r],t[r]))return!1;return!0}const st=function(e){function t(e){try{let t=e.querySelector("link[rel='canonical']");if(null!==t)return t.href}catch(e){}return null}return function(){try{let n,r,i=function(){let n=function(){let n,r=[];do{try{n=n?n.parent:e;try{let i=n===e.top,o={referrer:n.document.referrer||null,location:n.location.href||null,isTop:i};i&&(o=Object.assign(o,{canonicalUrl:t(n.document)})),r.push(o)}catch(t){r.push({referrer:null,location:null,isTop:n===e.top})}}catch(e){return r.push({referrer:null,location:null,isTop:!1}),r}}while(n!==e.top);return r}(),r=function(){try{if(!e.location.ancestorOrigins)return;return e.location.ancestorOrigins}catch(e){}}();if(r)for(let e=0,t=r.length;e0&&null!==i[o-1].referrer,a=function(e){let t,n=[],r=null,i=null,o=null,s=null,a=null;for(t=e.length-1;t>=0;t--){try{r=e[t].location}catch(e){}if(r)n.push(r),a||(a=r);else if(0!==t){i=e[t-1];try{o=i.referrer,s=i.ancestor}catch(e){}o?(n.push(o),a||(a=o)):s?(n.push(s),a||(a=s)):n.push(null)}else n.push(null)}return{stack:n,detectedRefererUrl:a}}(i);i[i.length-1].canonicalUrl&&(n=i[i.length-1].canonicalUrl);try{r=e.top.document.referrer}catch(e){}return{topmostLocation:a.detectedRefererUrl,ref:r||null,reachedTop:s,numIframes:o,stack:a.stack,canonicalUrl:n}}catch(e){}}}(window),at={A:0,B:1,C:2,D:3,E:4,F:5,G:6,H:7,I:8,J:9,K:10,L:11,M:12,N:13,O:14,P:15,Q:16,R:17,S:18,T:19,U:20,V:21,W:22,X:23,Y:24,Z:25,a:26,b:27,c:28,d:29,e:30,f:31,g:32,h:33,i:34,j:35,k:36,l:37,m:38,n:39,o:40,p:41,q:42,r:43,s:44,t:45,u:46,v:47,w:48,x:49,y:50,z:51,0:52,1:53,2:54,3:55,4:56,5:57,6:58,7:59,8:60,9:61,"-":62,_:63,"+":62,"/":63},ct=Object.freeze({tcfv2:{objName:"__tcfapiCall",objKeys:["command","version"],returnObjName:"__tcfapiReturn"},uspv1:{objName:"__uspapiCall",objKeys:["command","version"],returnObjName:"__uspapiReturn"},gppv1:{objName:"__gppCall",objKeys:["command","parameter"],returnObjName:"__gppReturn"}}),ut=Object.freeze({TCF:0,USP:1,GPP:2});class lt{direct;version;constructor(e,t){this.direct=e,this.version=t}async getConsentData(){return this.getClientConsentData()}static async create(e){const{cmpApiFrame:t,cmpApiFunction:n}=pt._findCmpApi("__gpp");let r,i=!1;if(!t)return e.warn("cmpApi: GPP not found! Using defaults."),Promise.resolve();if(Ke(n))i=!0,e.info("cmpApi: Detected GPP is directly accessible, calling it now."),r=n;else{e.info("cmpApi: Detected GPP is outside the current iframe. Using message passing.");const n=pt._buildCmpSurrogate(ct.gppv1,t);r=function(e,t,r){n(e,r,t)}}const o=await new Promise((e=>{const t=r("ping",(function(t){e(t)}));t&&e(t)}));switch(o.gppVersion){case ht.version:return new ht(o,r,i);case ft.version:return new ft(o,r,i);default:{const t=`Unsupported version of gpp: ${o.gppVersion}`;return e.warn(t),Promise.reject(t)}}}static tcfDataHasLocalStorageGrant(e){let t=lt.#e(e,"PurposeConsent","PurposeConsents");return Xe(t)&&!0===t[0]}static tcfDataHasID5VendorConsented(e){let t=lt.#e(e,"VendorConsent","VendorConsents");return void 0!==t?.find((e=>e==A))}static#e(e,t,n){return t in e?e[t]:e[n]}static getTcfData(e){const t=e?.tcfeuv2;let n;return Xe(t)&&Ze(t[0])?n=t[0]:Ze(t)&&(n=t),n}}class ht extends lt{static version="1.0";gppFn;ready;constructor(e,t,n){super(n,ht.version),this.gppFn=t,this.ready=this.isReady(e)}isReady(e){return"loaded"===e.cmpStatus&&"visible"!==e.cmpDisplayStatus}async getClientConsentData(){this.ready||(this.ready=await new Promise((e=>{this.gppFn("addEventListener",(t=>{if(!this.isReady(t.pingData))return!1;e(!0)}))})));const e=new Promise((e=>{this.gppFn("getGPPData",(t=>{e(t)}))})),t=new Promise((e=>{this.gppFn("getSection",(t=>{e(t)}),"tcfeuv2")})),[n,r]=await Promise.all([e,t]),i=new P;return i.version=O.GPP_V1_0,i.gppString=n.gppString,i.applicableSections=n.applicableSections,r&&(i.localStoragePurposeConsent=lt.tcfDataHasLocalStorageGrant(r),i.vendorsConsentForId5Granted=lt.tcfDataHasID5VendorConsented(r)),i}}function dt(e,t,n){n&&(e.apiTypes.push(t),Object.assign(e,n))}class ft extends lt{static version="1.1";gppFn;readyPingData;constructor(e,t,n){super(n,ft.version),this.gppFn=t,"ready"===e.signalStatus&&(this.readyPingData=e)}async getClientConsentData(){return new Promise((e=>{this.readyPingData?e(this.parsePingData(this.readyPingData)):this.gppFn("addEventListener",(t=>{if("ready"!==t.pingData.signalStatus)return!1;e(this.parsePingData(t.pingData))}))}))}parsePingData(e){const t=new P;t.gppString=e.gppString,t.version=O.GPP_V1_1,t.applicableSections=e.applicableSections;let n=lt.getTcfData(e.parsedSections);return n&&(t.localStoragePurposeConsent=lt.tcfDataHasLocalStorageGrant(n),t.vendorsConsentForId5Granted=lt.tcfDataHasID5VendorConsented(n)),t}}class pt{_lookupInProgress;_log;_metrics;_consentDataPromise;constructor(e,n=t){this._metrics=e,this._log=n}refreshConsentData(e,t,n){const r=this;return r._lookupInProgress||(r._lookupInProgress=!0,r._consentDataPromise=this._lookupConsentData(e,t,n).finally((()=>{r._lookupInProgress=!1}))),this._consentDataPromise}_lookupConsentData(e,t,n){if(e){this._log.warn("cmpApi: ID5 is operating in forced consent mode and will not retrieve any consent signals from the CMP");let e=new j;return e.forcedGrantByConfig=!0,e.source=D.partner,Promise.resolve(e)}switch(t){case"static":return new Promise((e=>{this._parseStaticConsentData(n,e)}));case"iab":return new Promise((e=>{this._lookupIabConsent(e)}));default:return this._log.error(`cmpApi: Unknown consent API: ${t}`),Promise.reject(new Error(`Unknown consent API: ${t}`))}}_parseStaticConsentData(e,t){e=e||{};let n=new j;if(n.source=D.partner,Ze(e.getTCData)){const t=this._parseTcfData(e.getTCData);dt(n,O.TCF_V2,t);try{const e=this._metrics;this._lookupTcf((n=>{e.consentDiscrepancyCounter({apiType:O.TCF_V2,sameString:n?.consentString===t?.consentString,sameLSPC:n?.localStoragePurposeConsent===t?.localStoragePurposeConsent,sameVendorsConsentForId5Granted:n?.vendorsConsentForId5Granted===t?.vendorsConsentForId5Granted,sameGdpr:n?.gdprApplies===t?.gdprApplies}).inc()}))}catch(e){}}if(Xe(e.allowedVendors)&&dt(n,O.ID5_ALLOWED_VENDORS,{allowedVendors:e.allowedVendors.map((e=>e.toString())),gdprApplies:!0}),Ze(e.getUSPData)){const t=this._parseUspData(e.getUSPData);dt(n,O.USP_V1,t);try{const e=this._metrics;this._lookupUsp((n=>{e.consentDiscrepancyCounter({apiType:O.USP_V1,sameString:n?.ccpaString===t?.ccpaString}).inc()}))}catch(e){}}0===n.apiTypes.length&&this._log.warn("cmpApi: No static consent data detected! Using defaults."),this._log.info(`cmpApi: Detected APIs '${n.apiTypes}' from static consent data`,e),t(n)}_lookupIabConsent(e){const t=[];let n=new j;n.source=D.cmp;const r=r=>(t[r]=0,(i,o)=>{t[r]||(t[r]=Date.now(),i&&dt(n,o,i),t.every((e=>e>0))&&e(n))}),i=r(ut.TCF),o=r(ut.USP),s=r(ut.GPP);this._lookupGpp(s),this._lookupTcf(i),this._lookupUsp(o)}_lookupUsp(e){const{cmpApiFrame:t,cmpApiFunction:n}=pt._findCmpApi("__uspapi");let r;if(!t)return this._log.warn("cmpApi: USP not found! Using defaults for CCPA."),void e();Ke(n)?(this._log.info("cmpApi: Detected USP is directly accessible, calling it now."),r=n):(this._log.info("cmpApi: Detected USP is outside the current iframe. Using message passing."),r=pt._buildCmpSurrogate(ct.uspv1,t)),r("getUSPData",1,((t,n)=>{n?e(this._parseUspData(t),O.USP_V1):(this._log.error("cmpApi: USP callback not successful. Using defaults for CCPA."),e())}))}async _lookupGpp(e){const t=Date.now();try{let n=await lt.create(this._log);if(n){let r={gppVersion:n.version,directCmp:n.direct};try{let i=await n.getConsentData();e({gppData:i},i.version);let o=Date.now();this._metrics.timer("gpp.delay",r).record(o-t)}catch(t){this._metrics.counter("gpp.failure",Object.assign({type:"CONSENT"},r)).inc(),this._log.error("cmpApi: getting GPP consent not successful. Using defaults for Gpp."),e()}}else e()}catch(t){this._metrics.counter("gpp.failure",{type:"CLIENT"}).inc(),this._log.error("cmpApi: creating GPP client not successful. Using defaults for Gpp."),e()}}static _buildCmpSurrogate(e,t){return(n,r,i)=>{const o=Math.random()+"",s={},a={};a[e.objKeys[0]]=n,a[e.objKeys[1]]=r,a.callId=o,s[e.objName]=a;const c=t=>{const n=rt(t,`data.${e.returnObjName}`);if(n&&n.callId===o){const e=i(n.returnValue,n.success);void 0!==e&&!0!==e||window.removeEventListener("message",c)}};window.addEventListener("message",c,!1),t.postMessage(s,"*")}}_lookupTcf(e){const{cmpFrame:t,cmpFunction:n}=pt._findTCF();if(!t)return this._log.warn("cmpApi: TCF not found! Using defaults for GDPR."),void e();Ke(n)?this._lookupDirectTcf(n,e):(this._log.info("cmpApi: Detected TCF is outside the current iframe. Using message passing."),this._lookupMessageTcf(t,e))}_lookupMessageTcf(e,t){const n=pt._buildCmpSurrogate(ct.tcfv2,e);this._lookupDirectTcf(n,t)}_lookupDirectTcf(e,t){const n=this._log;e("addEventListener",2,((e,r)=>{return i=e,n.info("cmpApi: TCFv2 - Received a call back: event",i),r?!(!e||!1!==e.gdprApplies&&"tcloaded"!==e.eventStatus&&"useractioncomplete"!==e.eventStatus)&&void t(this._parseTcfData(e),O.TCF_V2):(n.error("cmpApi: TCFv2 - Received insuccess: addEventListener. Please check your CMP setup. Using defaults for GDPR."),void t());var i}))}_parseUspData(e){if(Ze(e)&&Ye(e.uspString))return{ccpaString:e.uspString};this._log.error("cmpApi: No or malformed USP data. Using defaults for CCPA.")}_parseTcfData(e){let t,n,r=this._log;if(t=pt._isValidV2ConsentObject,n=pt._normalizeV2Data,t(e))return n(e);r.error("cmpApi: Invalid CMP data. Using defaults for GDPR.",e)}static _isValidV2ConsentObject(e){const t=e&&e.gdprApplies,n=e&&e.tcString;return!1===t||Ye(n)}static _tcfDataHasID5VendorConsented(e){return!0===e?.vendor?.consents?.[A]}static _normalizeV2Data(e){let t=rt(e,"purpose.consents.1");et(t)||(t=function(e){if(!e||"C"!==e.charAt(0)||e.length<=25)return;let t=e.charAt(25),n=at[t];return void 0!==n?!!(8&n):void 0}(e.tcString));let n=pt._tcfDataHasID5VendorConsented(e);return{consentString:e.tcString,localStoragePurposeConsent:t,gdprApplies:e.gdprApplies,vendorsConsentForId5Granted:n}}static _findTCF(){let e,t,n=window;for(;!e;){try{if("function"==typeof n.__tcfapi){t=n.__tcfapi,e=n;break}}catch(e){}try{if(n.frames.__tcfapiLocator){e=n;break}}catch(e){}if(n===window.top)break;n=n.parent}return{cmpFrame:e,cmpFunction:t}}static _findCmpApi(e){let t,n,r=window;for(;!t;){try{if("function"==typeof r[e]){n=r[e],t=r;break}}catch(e){}try{if(r.frames[`${e}Locator`]){t=r;break}}catch(e){}if(r===window.top)break;r=r.parent}return{cmpApiFrame:t,cmpApiFunction:n}}}const gt="1.0.76";class mt{static async gatherUaHints(e,t){if(!I(window.navigator.userAgentData)||e)return;let n;try{n=await window.navigator.userAgentData.getHighEntropyValues(["architecture","fullVersionList","model","platformVersion"])}catch(e){return void t.error("Error while calling navigator.userAgentData.getHighEntropyValues()",e)}return mt.filterUaHints(n)}static filterUaHints(e){if(!I(e))return;const t=/[()-.:;=?_/]/g;return y(e.brands)&&(e.brands=e.brands.filter((e=>_(e.brand)&&e.brand.search(t)<0))),y(e.fullVersionList)&&(e.fullVersionList=e.fullVersionList.filter((e=>_(e.brand)&&e.brand.search(t)<0))),e}}const vt=Object.freeze({NEVER:"never",AFTER_UID_SET:"after-uid-set",ASAP:"asap"}),_t=Object.freeze({allowGCReclaim:Object.values(vt)});class yt{invocationId;options;providedOptions;invalidSegments;static configTypes={debugBypassConsent:"Boolean",allowLocalStorageWithoutConsentApi:"Boolean",cmpApi:"String",consentData:"Object",refreshInSeconds:"Number",partnerUserId:"String",callbackOnAvailable:"Function",callbackOnUpdates:"Function",callbackTimeoutInMs:"Number",pd:"String",abTesting:"Object",provider:"String",maxCascades:"Number",applyCreativeRestrictions:"Boolean",acr:"Boolean",disableUaHints:"Boolean",storageExpirationDays:"Number",att:"Number",diagnostics:"Object",multiplexing:"Object",dynamicConfig:"Object",allowGCReclaim:"String"};constructor(e,n=t){if(this._log=n,this.options={debugBypassConsent:!1,allowLocalStorageWithoutConsentApi:!1,cmpApi:"iab",consentData:{},refreshInSeconds:7200,partnerId:void 0,partnerUserId:void 0,callbackOnAvailable:void 0,callbackOnUpdates:void 0,callbackTimeoutInMs:void 0,pd:void 0,abTesting:{enabled:!1,controlGroupPct:0},provider:void 0,maxCascades:8,applyCreativeRestrictions:!1,acr:!1,segments:void 0,disableUaHints:!1,storageExpirationDays:void 0,att:void 0,diagnostics:{publishingDisabled:!1,publishAfterLoadInMsec:3e4,publishBeforeWindowUnload:!0,publishingSampleRatio:.01},multiplexing:{_disabled:!1},allowGCReclaim:vt.AFTER_UID_SET},this.providedOptions={},!Qe(e.partnerId)&&!Ye(e.partnerId))throw new Error("partnerId is required and must be a number or a string");this.invalidSegments=0,this.updOptions(e),this.storageConfig=new F(e.storageExpirationDays)}getOptions(){return this.options}getProvidedOptions(){return this.providedOptions}getInvalidSegments(){return this.invalidSegments}hasCreativeRestrictions(){return this.options.applyCreativeRestrictions||this.options.acr}updOptions(e){const t=this,n=t._log;if(!Ze(e))return void n.error("Config options must be an object");this.setPartnerId(e.partnerId);const r=(e,t)=>{this.options[e]=t,this.providedOptions[e]=t};Object.keys(e).forEach((i=>{if("segments"===i){const o=e[i],s=[];if(!I(o))return;if(!Xe(o))return void bt(n,i,"Array",o);o.forEach(((e,r)=>{const i=`segments[${r}]`;return Xe(e.ids)&&function(e,t){let n=!0;return S(e,(e=>n=n&&t(e))),n}(e.ids,Ye)?e.ids.length<1?(n.error(`Config option ${i}.ids should contain at least one segment ID`),void(t.invalidSegments+=1)):Ye(e.destination)?void s.push(e):(bt(n,`${i}.destination`,"String",e.destination),void(t.invalidSegments+=1)):(bt(n,`${i}.ids`,"Array of String",e.ids),void(t.invalidSegments+=1))})),r(i,s)}else if("diagnostics"===i){const t=this.options.diagnostics,n=e.diagnostics;if(Je(n,yt.configTypes.diagnostics)){let e={...t};Object.keys(n).forEach((r=>{void 0!==t[r]&&typeof t[r]==typeof n[r]&&(e[r]=n[r])})),this.options[i]=e}this.providedOptions[i]=e[i]}else if(void 0!==_t[i]){const t=e[i];t&&_t[i].includes(t)&&r(i,t)}else if("partnerId"!==i){const t=yt.configTypes[i],o=e[i];I(o)&&(Je(o,t)?r(i,o):bt(n,i,t,o))}}))}setPartnerId(e){let t;if(Ye(e)){if(t=parseInt(e),isNaN(t)||t<0)throw new Error("partnerId is required and must parse to a positive integer")}else Qe(e)&&(t=e);if(Qe(t)){if(Qe(this.options.partnerId)&&t!==this.options.partnerId)throw new Error("Cannot update config with a different partnerId");this.options.partnerId=t,this.providedOptions.partnerId=e}}}function bt(e,t,n,r){e.error(`Config option ${t} must be of type ${n} but was ${toString.call(r)}. Ignoring...`)}class wt{_called;_callbackFn;_callbackArgs;_beforeTrigger;_watchdog;_log;_metrics;_callbackName;constructor(e,t,n,r,i,o,s,...a){this._callbackName=e,this._log=t,this._metrics=n,this._callbackFn=r,this._callbackArgs=a,this._beforeTrigger=s,this._called=!1,this._callbackTriggerTimer=oe(),this._timeout=i,o?this._watchdog=setTimeout((()=>this._trigger("immediate")),0):i>0&&(this._watchdog=setTimeout((()=>this._trigger("timeout")),i))}_trigger(e="unknown"){this._watchdog=void 0;let t=this._callbackTriggerTimer.record(this._metrics.timer("callback.trigger.time",{trigger:e,callbackName:this._callbackName,timeout:this._timeout}));this._called||(this._called=!0,setTimeout((()=>{this._log.debug(`Firing ${this._callbackName} callback after ${t}ms. Triggered by ${e}, configured timeoutMs=${this._timeout}`),this._beforeTrigger(),this._callbackFn.call(globalThis,...this._callbackArgs)}),0))}triggerNow(e="eventOccurred"){this.disableWatchdog(),this._trigger(e)}disableWatchdog(){this._watchdog&&(clearTimeout(this._watchdog),this._watchdog=void 0)}}class It{refererInfo;apiVersion;isUsingCdn;constructor(e,t,n){this.refererInfo=e,this.apiVersion=t,this.isUsingCdn=n}}class St{_targets;_metrics;_survivalTimer;constructor(e,t){this._targets=[e,t],this._metrics=t,this._survivalTimer=oe()}unregister(e){this._survivalTimer&&this._metrics&&this._survivalTimer.record(this._metrics.instanceSurvivalTime({unregisterTrigger:e})),this._targets.forEach((e=>{try{tt(e)&&Ke(e.unregister)&&e.unregister()}catch(e){}}))}}globalThis.__id5_finalization_registry||(globalThis.__id5_finalization_registry=new class{_finalizationRegistry;_instancesHolder;constructor(){this._instancesHolder=new Set;try{this._finalizationRegistry=new FinalizationRegistry((e=>{try{tt(e)&&Ke(e.unregister)&&e.unregister("gc-reclaim")}catch(e){}}))}catch(e){}}register(e){try{e.getOptions().allowGCReclaim!==vt.ASAP&&this._instancesHolder.add(e),this._finalizationRegistry.register(e,e._unregisterTargets,e)}catch(e){}}unregister(e){try{this.releaseInstance(e,!0),this._finalizationRegistry.unregister(e)}catch(e){}}releaseInstance(e,t=!1){(!e.getOptions().allowGCReclaim!==vt.NEVER||t)&&this._instancesHolder.delete(e)}});const Ct=globalThis.__id5_finalization_registry;class Et{_ref;constructor(e){this._ref=e}deref(){return this._ref}}class Dt{_availableCallback;_updateCallback;_refreshCallback;_isExposed;_fromCache;_isRefreshing=!1;_isRefreshingWithFetch=!1;_userId;_ext;_userIdAvailable=!1;_userIdAvailablePromise;_userIdAvailablePromiseResolver;invocationId;config;clientStore;consentManagement;_consentDataProvider;_metrics;_log;_multiplexingInstance;_pageLevelInfo;_trueLinkAdapter;_publisherTrueLinkId;_gpId;_origin;getOptions(){return this.config.getOptions()}getProvidedOptions(){return this.config.getProvidedOptions()}getInvalidSegments(){return this.config.getInvalidSegments()}getUserId(){return!1===this._isExposed?"0":this._userId}getGpId(){return!1===this._isExposed?void 0:this._gpId}getLinkType(){return!1===this._isExposed?0:this.getExt().linkType}getExt(){let e=!1===this._isExposed?{}:this._ext;return Object.assign({abTestingControlGroup:!this.exposeUserId()},e)}getPublisherTrueLinkId(){return!1===this._isExposed?void 0:this._publisherTrueLinkId}isFromCache(){return this._fromCache}exposeUserId(){return this._isExposed}getUserIdAsEid(){return{source:R.ID5_EIDS_SOURCE,uids:[{atype:1,id:this.getUserId(),ext:this.getExt()}]}}onAvailable(e,t){if(!Ke(e))throw new Error("onAvailable expects a function");return this._availableCallback?this._log.warn("onAvailable was already called, ignoring"):this._availableCallback=new wt("onAvailable",this._log,this._metrics,e,t,this._userIdAvailable,(()=>{}),this),this}onUpdate(e){if(!Ke(e))throw new Error("onUpdate expects a function");return this._updateCallback=e,this._userIdAvailable&&this._fireOnUpdate(),this}onRefresh(e,t){if(!Ke(e))throw new Error("onRefresh expects a function");this._refreshCallback&&this._refreshCallback.disableWatchdog();const n=!0===this._isRefreshing&&!1===this._isRefreshingWithFetch&&this._userIdAvailable;return this._refreshCallback=new wt("onRefresh",this._log,this._metrics,e,t,n,(()=>{this._isRefreshing=!1,this._isRefreshingWithFetch=!1}),this),this}unregister(){try{this._unregisterTargets.unregister("api-call"),Ct.unregister(this)}catch(e){}}collectEvent(e,t){const n=n=>{const r=new Request("https://id5-sync.com/event",{method:"POST",mode:"no-cors",body:JSON.stringify({partnerId:this.config.getOptions().partnerId,id5id:n,eventType:e,metadata:t})});return this._log.info("Sending event",r),fetch(r).catch((t=>this._log.error("Error while sending event to ID5 of type "+e,t)))};return this._userIdAvailable?n(this._userId):this._userIdAvailablePromise.then((e=>n(e)))}constructor(e,t,n,r,o,s,a,c,u,l){this.config=e,this.clientStore=t,this.consentManagement=n,this._metrics=r,this._consentDataProvider=o,this._log=new i("Id5Instance:",s),this._multiplexingInstance=a,this._userIdAvailablePromise=new Promise((e=>{this._userIdAvailablePromiseResolver=e})),this._pageLevelInfo=c,this._unregisterTargets=new St(this._multiplexingInstance,this._metrics),this._trueLinkAdapter=u,this._origin=l||"api",Ct.register(this)}bootstrap(){const e=oe(),t=this.config.getOptions(),n=this._ref();this._multiplexingInstance.on(le.CASCADE_NEEDED,(e=>{const t=n.deref();t&&t._doCascade(e)})).on(le.USER_ID_READY,((t,r)=>{const i=n.deref();if(i){try{const n=r?.tags?{...r.tags}:{},o=i._metrics;r?.timestamp&&o.userIdNotificationDeliveryDelayTimer(n).record(Date.now()-r.timestamp),e.record(o.userIdProvisioningDelayTimer(t.isFromCache,{...n,isUpdate:i._userIdAvailable,hasOnAvailable:void 0!==i._availableCallback,hasOnRefresh:void 0!==i._refreshCallback,hasOnUpdate:void 0!==i._updateCallback,provisioner:r?.provisioner||"leader",hasChanged:i._userId!==t.responseObj.universal_uid}))}catch(e){i._log.error("Failed to measure provisioning metrics",e)}i._setUserId(t.responseObj,t.isFromCache,t.willBeRefreshed)}})).on(le.USER_ID_FETCH_CANCELED,(e=>{const t=n.deref();t&&t._log.info("ID5 User ID fetch canceled:",e.reason)})),this._log.info(`bootstrapped for partner ${t.partnerId} with referer ${this._refererInfo} and options`,this.getProvidedOptions())}firstFetch(){const e=this.config.getOptions(),t=this._gatherFetchIdData().then((t=>{this._multiplexingInstance.register({source:this._origin,sourceVersion:gt,sourceConfiguration:{options:e},fetchIdData:t,singletonMode:!0===e?.multiplexing?._disabled,canDoCascade:!this.config.hasCreativeRestrictions(),forceAllowLocalStorageGrant:this.consentManagement.isForceAllowLocalStorageGrant(),storageExpirationDays:e.storageExpirationDays})})),n=this._submitRefreshConsent().then((e=>{e&&this.consentManagement.setConsentData(e)}));return t.then((()=>{this._multiplexingInstance.lookupForCachedId().provisioned||(this._log.info("Couldn't find cached userId. Will try again when consent is resolved"),n.then((()=>{this._log.info("Consent resolved. Looking for cached id again"),this._multiplexingInstance.lookupForCachedId()})))})),Promise.allSettled([t,n])}refreshId(e,t){let n,r;this._log.info(`ID refresh requested (force=${e}) with additional options `,t);try{this._isRefreshing=!0,this._isRefreshingWithFetch=e,this.config.updOptions(t);const i=this.config.getOptions(),o=i.allowLocalStorageWithoutConsentApi||i.debugBypassConsent;n=this._gatherFetchIdData().then((t=>{this._multiplexingInstance.updateFetchIdData(t),this._multiplexingInstance.refreshUid({resetConsent:!0,forceAllowLocalStorageGrant:o,forceFetch:e}),r=this._submitRefreshConsent()})),this._metrics.refreshCallCounter("public-api").inc()}catch(e){return this._log.error("Exception caught from refreshId()",e),Promise.reject(e)}return Promise.allSettled([n,r])}_doCascade(e){const t=this.config.getOptions();if(e.partnerId===t.partnerId&&t.maxCascades>=0&&!this.config.hasCreativeRestrictions()){const r=t.partnerUserId&&t.partnerUserId.length>0,i=new URL(`/${r?"s":"i"}/${t.partnerId}/${t.maxCascades}.gif`,"https://id5-sync.com"),o=i.searchParams;o.set("o","api"),o.set("id5id",e.userId),o.set("gdpr_consent",e.consentString),o.set("gdpr",e.gdprApplies),e.gppString&&(o.set("gpp",e.gppString),o.set("gpp_sid",e.gppSid)),r&&o.set("puid",t.partnerUserId),this._log.info("Opportunities to cascade available",i.href),n=i.href,"loading"!==document.readyState?nt(n):document.addEventListener("DOMContentLoaded",(function(){nt(n)}))}var n}async _gatherFetchIdData(){const e=this.config.getOptions(),t=await mt.gatherUaHints(e.disableUaHints,this._log);return{partnerId:e.partnerId,refererInfo:this._pageLevelInfo.refererInfo,origin:this._origin,originVersion:this._pageLevelInfo.apiVersion,isUsingCdn:this._pageLevelInfo.isUsingCdn,att:e.att,uaHints:t,abTesting:e.abTesting,segments:e.segments,invalidSegmentsCount:this.getInvalidSegments(),provider:e.provider,pd:e.pd,partnerUserId:e.partnerUserId,refreshInSeconds:e.refreshInSeconds,providedRefreshInSeconds:this.getProvidedOptions().refreshInSeconds,trace:Ve,allowedVendors:e.consentData?.allowedVendors,consentSource:"iab"===e.cmpApi&&!0!==e.debugBypassConsent?D.cmp:D.partner,trueLink:this._trueLinkAdapter.getTrueLink()}}_ref(){return"undefined"!=typeof WeakRef?new WeakRef(this):new Et(this)}async _submitRefreshConsent(){const e=this.config.getOptions();let t,n=oe(),r=e.debugBypassConsent?"bypass":e.cmpApi;try{t=await this._consentDataProvider.refreshConsentData(e.debugBypassConsent,e.cmpApi,e.consentData);const i={};t.apiTypes.forEach((e=>i[e]=!0)),n.record(this._metrics.consentRequestTimer(r,{success:!0,...i})),this._multiplexingInstance.updateConsent(t)}catch(e){this._log.error("Couldn't get consent data",e),n.record(this._metrics.consentRequestTimer(r,{success:!1,error:e.message}))}return t}_setUserId(e,t,n=!1){const r=e.universal_uid;if(this._isExposed=!0,Ze(e.ab_testing))switch(e.ab_testing.result){case"normal":break;default:case"error":this._log.error("There was an error with A/B Testing. Make sure controlGroupRatio is a number >= 0 and <= 1");break;case"control":this._isExposed=!1,this._log.info("User is in control group!")}const i=this._userId!==r||!1===ot(this._ext,e.ext);this._userIdAvailable=!0,this._userId=r,this._gpId=e.gp,this._userIdAvailablePromiseResolver(r),this._ext=e.ext,this._publisherTrueLinkId=e.publisherTrueLinkId,this._fromCache=t,this._log.info("User id updated",{hasChanged:i,fromCache:t}),this._availableCallback&&this._availableCallback.triggerNow(),this._isRefreshing&&this._refreshCallback&&(!1===t||!1===this._isRefreshingWithFetch)&&this._refreshCallback.triggerNow(),i&&this._fireOnUpdate(),this.getOptions().allowGCReclaim!==vt.AFTER_UID_SET||t&&n||Ct.releaseInstance(this)}_fireOnUpdate(){setTimeout((()=>{Ke(this._updateCallback)&&(this._log.debug("Firing onUpdate"),this._updateCallback(this))}),0)}localStorageGrant(){return this.clientStore.localStorageGrant()}}class At{isBooted(){return w(window.id5Bootstrap)}getTrueLink(){return this.isBooted()?window.id5Bootstrap.getTrueLinkInfo():{booted:!1}}setPrivacy(e){this.isBooted()&&window.id5Bootstrap.setPrivacy&&window.id5Bootstrap.setPrivacy(e)}clearPrivacy(){this.setPrivacy(void 0)}}const Ot=new class{origin;loaded=!1;set debug(e){qe(e)}get debug(){return ze()}_isUsingCdn=!1;_referer=!1;_version=gt;versions={};invocationId=0;constructor(e="api"){this.loaded=!0,this._isUsingCdn=!!(document&&document.currentScript&&document.currentScript.src&&0===document.currentScript.src.indexOf("https://cdn.id5-sync.com")),this._referer=st(),this.versions[gt]=!0,this.origin=e}init(e){this.invocationId+=1;const t=new He(this.origin,this.invocationId);try{t.info(`ID5 API version ${this._version}. Invoking init()`,e);const n=new yt(e,t),r=n.getOptions(),i=this._configureDiagnostics(r,t);i&&(i.loadDelayTimer().recordNow(),i.invocationCountSummary().record(this.invocationId,{fenced:"function"==typeof window.Fence&&window.fence instanceof window.Fence}));const o=new q(window,!n.hasCreativeRestrictions()),s=new G(o,t),a=r.allowLocalStorageWithoutConsentApi||r.debugBypassConsent,c=new De(s,n.storageConfig,a,t,i),u=new Ae((()=>c.localStorageGrant()),s,n.storageConfig,t),l=new At,h=Me.createInstance(window,t,i,o,l,u),d=new pt(i,t),f=new It(this._referer,this._version,this._isUsingCdn),p=new Dt(n,u,c,i,d,t,h,f,l,this.origin);return p.bootstrap(),p.firstFetch(),u.scheduleGC(i),p}catch(e){t.error("Exception caught during init()",e)}}refreshId(e,t=!1,n={}){if(!et(t))throw new Error("Invalid usage of refreshId(): second parameter must be a boolean");return e.refreshId(t,n),e}_configureDiagnostics(e,t){try{const t=e.partnerId,r=new ae(this.origin,gt),i=e.diagnostics;if(r.addCommonTags({...se(t),tml:this._referer.topmostLocation,provider:e.provider?e.provider:"default"}),!i?.publishingDisabled){let e=(n=i.publishingSampleRatio,Math.random()new B(undefined,{sampling:n}).publish(e,t):e=>e);i?.publishAfterLoadInMsec&&i.publishAfterLoadInMsec>0&&r.schedulePublishAfterMsec(i.publishAfterLoadInMsec,e),i?.publishBeforeWindowUnload&&r.schedulePublishBeforeUnload(e)}return r}catch(e){return void t.error("Failed to configure diagnostics",e)}var n}};var Pt=Ot;function jt(e){return jt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},jt(e)}function Tt(e,t){for(var n=0;n2&&void 0!==arguments[2])||arguments[2];if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),en(this,on,void 0),en(this,sn,void 0),n="number"==typeof n?String(n):n,!t||void 0===n)throw new Error("name and/or value are madatory: name=".concat(t,", value=").concat(n));nn(on,this,t&&encodeURIComponent(t)),nn(sn,this,n&&r?encodeURIComponent(n):n)}return t=e,r=[{key:"create",value:function(t,n){return Array.isArray(n)?n.map((function(n){return new e(t,n)})):[new e(t,n)]}}],(n=[{key:"rawQuery",value:function(){return tn(sn,this)&&"".concat(tn(on,this),"=").concat(tn(sn,this))}}])&&Qt(t.prototype,n),r&&Qt(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,n,r}();function cn(e){return cn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},cn(e)}function un(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ln(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:null;if(un(this,e),fn(this,vn,void 0),!Sn(t))throw new Error("Invalid status: ".concat(t));gn(vn,this,t)}),[{key:"status",get:function(){return pn(vn,this)},set:function(e){Sn(e)&&gn(vn,this,e)}},{key:"isDenied",value:function(){return"denied"===pn(vn,this)}},{key:"isGranted",value:function(){return"granted"===pn(vn,this)}},{key:"buildParamValue",value:function(){return this.isGranted()?1:this.isDenied()?0:null}}])}(),yn=new WeakMap,bn=new WeakMap,wn=new WeakMap,In=function(){function e(t){var n=t.analytics,r=void 0===n?null:n,i=t.connect,o=void 0===i?null:i,s=t.discovery,a=void 0===s?null:s;un(this,e),fn(this,yn,void 0),fn(this,bn,void 0),fn(this,wn,void 0),gn(yn,this,new _n(r)),gn(bn,this,new _n(o)),gn(wn,this,new _n(a))}return hn(e,[{key:"analytics",get:function(){return pn(yn,this)}},{key:"connect",get:function(){return pn(bn,this)}},{key:"discovery",get:function(){return pn(wn,this)}},{key:"permissions",get:function(){return{analytics:pn(yn,this).status,connect:pn(bn,this).status,discovery:pn(wn,this).status}}},{key:"update",value:function(e){pn(yn,this).status=e.analytics,pn(bn,this).status=e.connect,pn(wn,this).status=e.discovery}},{key:"buildQueryParams",value:function(){return[new an("csa",pn(yn,this).buildParamValue()),new an("csc",pn(bn,this).buildParamValue()),new an("csd",pn(wn,this).buildParamValue())]}}],[{key:"default",value:function(){return new e({})}}])}(),Sn=function(e){return"granted"===e||"denied"===e||null===e},Cn=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))},En=function(e){return/^[\da-f]{8}(?:-[\da-f]{4}){3}-[\da-f]{12}$/.test(e)};function Dn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=function(e){var t,n=e.getFuid(),r=null!==(t=null==n?void 0:n.toLowerCase())&&void 0!==t?t:"";return En(r)?r:Cn()}(e);return e.storeFuid(n,t)?n:null}function An(e){return An="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},An(e)}function On(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Pn(e,t,n){return(t=Tn(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function jn(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:function(){};Rn(Fn,this,xn(Fn,this)+10);var t="_".concat(xn(Fn,this));return xn(Nn,this)[t]=e,t}}],t&&jn(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();function Ln(e){return Ln="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ln(e)}function Vn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Gn(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:function(){return null};Vn(this,e),qn(this,Xn,void 0),qn(this,Qn,void 0),Hn(Qn,this,t)}),[{key:"value",get:function(){return zn(Xn,this)},set:function(e){Hn(Xn,this,e)}},{key:"evalValue",value:function(){var e="function"==typeof zn(Xn,this)?zn(Xn,this).call(this):zn(Xn,this);return void 0===e?zn(Qn,this).call(this):e}}])}(),er=new WeakMap,tr=new WeakMap,nr=new WeakMap,rr=new WeakMap,ir=new WeakMap,or=new WeakMap,sr=new WeakMap,ar=new WeakMap,cr=new WeakMap,ur=new WeakMap,lr=new WeakMap,hr=new WeakMap,dr=new WeakMap,fr=new WeakMap,pr=new WeakMap,gr=function(){function e(t){Vn(this,e),qn(this,er,void 0),qn(this,tr,void 0),qn(this,nr,void 0),qn(this,rr,void 0),qn(this,ir,void 0),qn(this,or,void 0),qn(this,sr,void 0),qn(this,ar,void 0),qn(this,cr,void 0),qn(this,ur,void 0),qn(this,lr,void 0),qn(this,hr,void 0),qn(this,dr,void 0),qn(this,fr,(function(e){return Array.isArray(e)&&!e.some((function(e){return!Yt.isString(e)}))})),qn(this,pr,(function(e){return Yt.isString(e)||"function"==typeof e||null===e})),Hn(er,this,t),this.init()}return Wn(e,[{key:"dl",get:function(){return zn(tr,this).evalValue()},set:function(e){zn(pr,this).call(this,e)&&(zn(tr,this).value=e)}},{key:"url",get:function(){return zn(nr,this).evalValue()},set:function(e){zn(pr,this).call(this,e)&&(zn(nr,this).value=e)}},{key:"referrer",get:function(){return zn(rr,this).evalValue()},set:function(e){zn(pr,this).call(this,e)&&(zn(rr,this).value=e)}},{key:"metadescription",get:function(){return zn(ir,this).evalValue()},set:function(e){zn(pr,this).call(this,e)&&(zn(ir,this).value=e)}},{key:"metakeywords",get:function(){return zn(or,this).evalValue()},set:function(e){zn(fr,this).call(this,e)&&(zn(or,this).value=e)}},{key:"language",get:function(){return zn(sr,this).evalValue()},set:function(e){zn(pr,this).call(this,e)&&(zn(sr,this).value=e)}},{key:"screensize",get:function(){return zn(ar,this).evalValue()},set:function(e){zn(pr,this).call(this,e)&&(zn(ar,this).value=e)}},{key:"viewport",get:function(){return zn(cr,this).evalValue()},set:function(e){zn(pr,this).call(this,e)&&(zn(cr,this).value=e)}},{key:"colordepth",get:function(){return zn(ur,this).evalValue()},set:function(e){zn(pr,this).call(this,e)&&(zn(ur,this).value=e)}},{key:"tagsource",get:function(){return zn(lr,this).evalValue()},set:function(e){zn(pr,this).call(this,e)&&(zn(lr,this).value=e)}},{key:"title",get:function(){return zn(hr,this).evalValue()},set:function(e){zn(pr,this).call(this,e)&&(zn(hr,this).value=e)}},{key:"textfragment",get:function(){return zn(dr,this).evalValue()},set:function(e){zn(pr,this).call(this,e)&&(zn(dr,this).value=e)}},{key:"init",value:function(){var e=this;Hn(tr,this,new Zn((function(){return zn(er,e).document.URL||""}))),Hn(nr,this,new Zn((function(){return zn(er,e).location.href||""}))),Hn(rr,this,new Zn((function(){return zn(er,e).document.referrer||""}))),Hn(ir,this,new Zn((function(){return Jn(zn(er,e),"description")}))),Hn(or,this,new Zn((function(){var t=Jn(zn(er,e),"keywords");return t&&t.split(",").map((function(e){return Yt.trim(e)}))||[]}))),Hn(sr,this,new Zn((function(){return zn(er,e).navigator&&(zn(er,e).navigator.language||zn(er,e).navigator.browserLanguage||"").toLowerCase()}))),Hn(ar,this,new Zn((function(){return zn(er,e).screen?"".concat(zn(er,e).screen.width,"x").concat(zn(er,e).screen.height):""}))),Hn(cr,this,new Zn((function(){return"".concat(zn(er,e).innerWidth,"x").concat(zn(er,e).innerHeight)}))),Hn(ur,this,new Zn((function(){return zn(er,e).screen?"".concat(zn(er,e).screen.colorDepth,"-bit"):""}))),Hn(lr,this,new Zn((function(){return"a1common"}))),Hn(hr,this,new Zn((function(){return zn(er,e).document.title}))),Hn(dr,this,new Zn((function(){var t,n,r,i=function(e){if(!e||!Yt.startsWith(e,"http"))return"";var t=new URL(e).hash.match(/:~:(.*)/);return t?t[1]:""};return i(null===(t=zn(er,e).navigation)||void 0===t||null===(t=t.currentEntry)||void 0===t?void 0:t.url)||i(null!==(n=zn(er,e).performance)&&void 0!==n&&n.getEntriesByType?null===(r=zn(er,e).performance)||void 0===r||null===(r=r.getEntriesByType("navigation")[0])||void 0===r?void 0:r.name:"")})))}},{key:"setAll",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Object.keys(t).filter((function(e){return Kn[e]})).forEach((function(n){e[n]=t[n]}))}},{key:"getAll",value:function(){for(var e=this,t=arguments.length,n=new Array(t),r=0;r3&&void 0!==arguments[3]&&arguments[3];if(/(?:\d*\.){3}\d*$/.test(a)||"localhost"===a)return _r.set(e,t,{expires:r,path:o,domain:a}),_r.get(e)===t;for(var f=d?[a]:a.split("."),p="".concat(e,"_____"),g=f.length-1;g>=0;g--){var m=f.slice(g).join(".");try{if(_r.remove(p,{path:o,domain:m}),_r.set(p,t,{expires:30,path:o,domain:m,sameSite:u,secure:h}),_r.get(p)===t&&(_r.set(e,t,{expires:r,path:o,domain:m,sameSite:u,secure:h}),_r.get(e)===t))return!0}finally{_r.remove(p,{path:o,domain:m})}}return!1}function br(e){return Yt.isNumber(e)&&Yt.isFinite(e)&&e>=Number.MIN_VALUE}function wr(e){return wr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},wr(e)}function Ir(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n0&&void 0!==arguments[0])||arguments[0];Sr(this,e),Ar(this,Nr,void 0),Pr(Nr,this,t)}),[{key:"build",value:function(e){var t,n,r=e.expires,i=e.path,o=void 0===i?"/":i,s=e.domain,a=void 0===s?window.location.hostname:s,c=(t=Or(Nr,this)?["None",!0]:["Lax",!1],n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,s,a=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(a.push(r.value),a.length!==t);c=!0);}catch(e){u=!0,i=e}finally{try{if(!c&&null!=n.return&&(s=n.return(),Object(s)!==s))return}finally{if(u)throw i}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return Ir(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ir(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}());return{expires:r,path:o,domain:a,sameSite:c[0],secure:c[1]}}}])}(),Lr=new WeakMap,Vr=new WeakMap,Gr=function(){return Er((function e(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];Sr(this,e),Ar(this,Lr,void 0),Ar(this,Vr,void 0),Pr(Lr,this,new Mr(t)),Pr(Vr,this,n)}),[{key:"forOwner",value:function(e){return new zr(this,Or(Lr,this),e)}},{key:"storeFuid",value:function(e){return yr(Tr,e,Or(Lr,this).build({expires:730}),Or(Vr,this))}},{key:"getFuid",value:function(){var e;return null!==(e=_r.get(Tr))&&void 0!==e?e:null}},{key:"storeSegmentIds",value:function(e,t){if(!function(e){return!("object"!==wr(e)||!Yt.isString(e.cookieName)||!Yt.isString(e.delimiter)||Yt.includes(Ur,e.cookieName)||!br(e.expire)||e.expire<=0)}(t))return!1;for(var n=!0;e.length>0||n;){if(n=!1,yr(t.cookieName,e.join(t.delimiter),Or(Lr,this).build({expires:t.expire}),Or(Vr,this)))return!0;e.pop()}return!1}},{key:"storeSync",value:function(e){yr(xr,e,Or(Lr,this).build({expires:730}),Or(Vr,this))}},{key:"getSync",value:function(){var e;return null!==(e=_r.get(xr))&&void 0!==e?e:null}},{key:"fullDomain",get:function(){return Or(Vr,this)},set:function(e){Pr(Vr,this,e)}}])}(),Wr=new WeakMap,$r=new WeakMap,qr=new WeakMap,zr=function(){return Er((function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Gr,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Mr,r=arguments.length>2?arguments[2]:void 0;Sr(this,e),Ar(this,Wr,void 0),Ar(this,$r,void 0),Ar(this,qr,void 0),Pr(Wr,this,t),Pr($r,this,n),Pr(qr,this,r)}),[{key:"storeUser",value:function(e,t){var n=t.storeAoneId||{},r=Fr(Yt.isString(n.cookieName)&&!Yt.includes(Ur,n.cookieName)?n.cookieName:kr,Or(qr,this)),i=(e.uid?br(n.expireHours)?n.expireHours:24:1)/24;yr(r,JSON.stringify(e),Or($r,this).build({expires:i}),Or(Wr,this).fullDomain)}},{key:"getUser",value:function(e){var t,n=Fr((e.storeAoneId||{}).cookieName||kr,Or(qr,this)),r=null!==(t=_r.get(n))&&void 0!==t?t:null;return r&&function(){try{return JSON.parse(r)}catch(e){return null}}()}},{key:"storeSendMarker",value:function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).hours;if(!e)throw new Error("not found the hours to throttle");if(!br(e))throw new TypeError("given hours is not a positive finite number: ".concat(e));yr(Fr(Rr,Or(qr,this)),"1",Or($r,this).build({expires:e/24}),Or(Wr,this).fullDomain)}},{key:"getSendMarker",value:function(){return _r.get(Fr(Rr,Or(qr,this)))}},{key:"storeFuid",value:function(e){return Or(Wr,this).storeFuid(e)}},{key:"getFuid",value:function(){return Or(Wr,this).getFuid()}},{key:"storeSegmentIds",value:function(e,t){return Or(Wr,this).storeSegmentIds(e,t)}},{key:"storeSync",value:function(e){return Or(Wr,this).storeSync(e)}},{key:"getSync",value:function(){return Or(Wr,this).getSync()}}])}(),Hr=n(964);function Br(e){return Br="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Br(e)}function Jr(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=Array(t);n0&&void 0!==arguments[0]?arguments[0]:"";!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),function(e,t,n){(function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.set(e,n)}(this,ri,void 0),t=ri,n="aopb_".concat(r),t.set(Yr(t,this),n)},t=[{key:"piggybacks",value:function(){var e,t,n,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];e=function(e,t,n){var r=document.createElement("iframe");return r.setAttribute("id",e),r.setAttribute("frameBorder","0"),r.setAttribute("scrolling","no"),r.setAttribute("width","1"),r.setAttribute("height","1"),r.setAttribute("style","display: none"),function(e){if(!e.postMessage)return!1;if(void 0===e.addEventListener)return!1;var t=e.navigator.userAgent.toLowerCase(),n=e.navigator.appVersion.toLowerCase();return!(Yt.includes(t,"msie")&&Yt.includes(n,"msie 9."))}(window)&&(r.src=t),r.addEventListener("load",n(r)),r}((t=ri).get(Yr(t,this)),r,(n=i,function(e){return function(){var t=function(e,t,n){var r=[],i=function(e){return{baseUrl:e,queries:[],len:25}},o={};return n.forEach((function(t){var n=t.type,s=Xr(t.url.split("?"),2),a=s[0],c=s[1];if(o[n]||(o[n]=[i(a)]),a.replace(/^https?:/,"")!==e||!c)return r.push(t);for(var u=[],l=c.split("&"),h=0;h0){var n="".concat(t.baseUrl,"?").concat(t.queries.join("&"));r.push({type:e,url:n})}}))})),r}("//m.one.impact-ad.jp/pix",0,n);if(e.src)return e.contentWindow.postMessage(t,e.src);!function(e,t){var n=t.contentWindow.document;e.forEach((function(e){switch(e.type){case"script":n.body.appendChild(Zr(ni(e.url)));break;case"image":n.body.appendChild(ei(ni(e.url)))}}))}(t,e)}})),document.body.appendChild(e)}},{key:"img",value:function(){ti(ei(arguments.length>0&&void 0!==arguments[0]?arguments[0]:""))}},{key:"js",value:function(){ti(Zr(arguments.length>0&&void 0!==arguments[0]?arguments[0]:""))}}],t&&Jr(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();function oi(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);ne.length)&&(t=e.length);for(var n=0,r=Array(t);n0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=Yt.flow((t||[]).map((function(e){return t=function(){var t;return null!==(t=e.rawQuery())&&void 0!==t?t:""},function(e){var n=t();if(""===n)return e;var r=Yt.endsWith(e,"?")?"".concat(e).concat(n):"".concat(e,"&").concat(n);return r.length<=7e3?r:e};var t})))("".concat(e,"?"));return Hr.resolve(n)}var mi=new WeakMap,vi=new WeakMap,_i=new WeakMap,yi=new WeakMap,bi=new WeakMap,wi=function(){return e=function e(t,n){var r=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new gr,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:In.default();!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),hi(this,mi,void 0),hi(this,vi,void 0),hi(this,_i,void 0),hi(this,yi,void 0),hi(this,bi,(function(){return new an("oid",fi(vi,r))})),di(mi,this,t),di(vi,this,n),di(_i,this,i),di(yi,this,o)},t=[{key:"oid",get:function(){return fi(vi,this)}},{key:"combo",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",r=new an("fu",arguments.length>1&&void 0!==arguments[1]?arguments[1]:""),i=new an("i5",n),o=new an("dd_rft","k"),s=new an("dd_jsonp","a1tracker.cb.".concat(e)),a=["dl","url","referrer","language","screensize","viewport","colordepth","tagsource","metadescription","metakeywords","title","textfragment"],c=fi(_i,this).dl===fi(_i,this).url?a.filter((function(e){return"dl"!==e})):a,u=an.create("evt",t.slice(0,150)),l=[fi(bi,this).call(this),o,s,r,i].concat(ai(u),ai(fi(_i,this).buildQueryParams(c)),ai(fi(yi,this).buildQueryParams()));return gi("".concat(fi(mi,this).urlPrefix,"/combo"),l)}},{key:"dc",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",r=[fi(bi,this).call(this),new an("evt",e),new an("fu",t),new an("i5",n)].concat(ai(fi(_i,this).buildQueryParams(["dl","language","screensize","viewport","colordepth","tagsource","metadescription","title","textfragment"])),ai(fi(yi,this).buildQueryParams()));return gi("".concat(fi(mi,this).urlPrefix,"/dc"),r)}},{key:"dd",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",r=[fi(bi,this).call(this),new an("rft","k"),new an("jsonp","a1tracker.cb.".concat(e)),new an("fu",t),new an("i5",n)].concat(ai(fi(_i,this).buildQueryParams(["language","screensize","viewport","colordepth","tagsource"])),ai(fi(yi,this).buildQueryParams()));return gi("".concat(fi(mi,this).urlPrefix,"/dd"),r)}},{key:"audience",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",n=new an("fu",arguments.length>1&&void 0!==arguments[1]?arguments[1]:""),r=new an("i5",t),i=new an("jsonp","a1tracker.cb.".concat(e)),o=[fi(bi,this).call(this),i,n,r];return gi("".concat(fi(mi,this).urlPrefix,"/aud"),o)}},{key:"uid",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=[fi(bi,this).call(this),new an("callback","a1tracker.cb.".concat(e))];return gi("".concat(fi(mi,this).awUrlPrefix,"/c/u/"),t)}},{key:"idMapping",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",i=arguments.length>4&&void 0!==arguments[4]&&arguments[4],o=[fi(bi,this).call(this),new an("cid",e,!1),new an("sp",t),new an("fu",n),new an("i5",r)].concat(ai(fi(_i,this).buildQueryParams(["dl"])),ai(i?fi(yi,this).buildQueryParams():[]));return gi("".concat(fi(mi,this).awUrlPrefix,"/c/map/"),o)}},{key:"piggyback",value:function(){return"".concat(window.location.protocol).concat(fi(mi,this).piggybacks)}}],t&&ui(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();function Ii(e){return Ii="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ii(e)}function Si(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new wi,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Mn,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:new ii,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:In.default(),s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:new zr;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Ei(this,Pi,void 0),Ei(this,ji,void 0),Ei(this,Ti,void 0),Ei(this,ki,void 0),Ei(this,xi,void 0),Ei(this,Ri,void 0),Ei(this,Ui,void 0),Ai(Pi,this,t),Ai(Ri,this,n),Ai(ji,this,r),Ai(ki,this,i),Ai(Ti,this,o),Ai(Ui,this,s)}return t=e,n=[{key:"segment",set:function(e){Ai(xi,this,e)}},{key:"send",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(){},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";try{!function(t,n,r){if(!(r&&r.throttle&&Di(Ui,e).getSendMarker())){var o=Di(ji,e).registerCallback((function(n){r&&r.throttle&&Di(Ui,e).storeSendMarker(r.throttle),n||(n={}),Di(Pi,e).aoneuid=n.aoneuid||"",Ai(xi,e,Yt.cloneDeep(n)),Di(Ti,e).discovery.isDenied()&&(n.segmentIds=[],n.aonesegments={}),"function"==typeof t&&window.setTimeout((function(){t(null,{segments:Yt.cloneDeep(n.segmentIds)||[],aoneuid:n.aoneuid||"",aonesegments:Yt.cloneDeep(n.aonesegments)||{}})}),0),Yt.isEmpty(n)||(Yt.isEmpty(n.piggybacks)||Di(ki,e).piggybacks(Di(Ri,e).piggyback(),n.piggybacks),!Di(Ti,e).discovery.isDenied()&&r&&r.storeSegmentIds&&Di(Ui,e).storeSegmentIds(Yt.cloneDeep(n.segmentIds)||[],r.storeSegmentIds))})),s=Dn(Di(Ui,e));Di(Ri,e).combo(o,s,n,i).then((function(t){return Di(ki,e).js(t)})).catch((function(e){if("function"==typeof t)return t(e)}))}}(t,n,r)}catch(e){if("function"==typeof t)return t(e)}}},{key:"sendEvent",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";try{var r=Dn(Di(Ui,this));return Di(Ri,this).dc(t,r,n).then((function(t){return Di(ki,e).img(t)})).catch((function(e){}))}catch(e){return Hr.reject(e)}}},{key:"sendCustomerId",value:function(e,t,n,r,i){var o=this,s=function(e,t){return e.split("!").reduce((function(e,n){var r=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,s,a=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(a.push(r.value),a.length!==t);c=!0);}catch(e){u=!0,i=e}finally{try{if(!c&&null!=n.return&&(s=n.return(),Object(s)!==s))return}finally{if(u)throw i}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return oi(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?oi(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(n.split("|"),2),i=r[0],o=r[1];if(!i||!o)return e;var s=Number(o);return!Yt.isInteger(s)||t>s||(e[i]=o),e}),{})}(Di(Ui,this).getSync()||"",r);if(s[t])return Hr.resolve();var a=Dn(Di(Ui,this));return Di(Ri,this).idMapping(e,t,a,i).then((function(e){return Di(ki,o).img(e)})).then((function(){var e=function(e,t,n,r){var i=24*r*60*60*1e3;return e[n]=String(t+i),Object.keys(e).reduce((function(t,n){return"".concat(t,"!").concat(n,"|").concat(e[n])}),"")}(s,r,t,n);Di(Ui,o).storeSync(e)})).catch((function(e){}))}},{key:"getSegments",value:function(e,t){var n=this,r=Yt.cloneDeep(Di(xi,this))||{};if(r.segmentIds)return Di(Ti,this).discovery.isDenied()&&(r.segmentIds=[],r.aonesegments={}),new Hr((function(t){e(null,{segments:Yt.cloneDeep(r.segmentIds)||[],aoneuid:r.aoneuid||"",aonesegments:Yt.cloneDeep(r.aonesegments)||{}}),t()}));var i=Di(ji,this).registerCallback((function(t){Di(Pi,n).aoneuid=t.aoneuid||"",Ai(xi,n,Yt.cloneDeep(t)),Di(Ti,n).discovery.isDenied()&&(t.segmentIds=[],t.aonesegments={}),"function"==typeof e&&window.setTimeout((function(){e(null,{segments:Yt.cloneDeep(t.segmentIds)||[],aoneuid:t.aoneuid||"",aonesegments:Yt.cloneDeep(t.aonesegments)||{}})}),0)}));return new Hr((function(e){e(Dn(Di(Ui,n)))})).then((function(e){return Di(Ri,n).dd(i,e,t).then((function(e){return Di(ki,n).js(e)}))})).catch((function(t){e(t)}))}},{key:"getUserId",value:function(e){var t=this,n=Di(Pi,this).aoneuid;if(n)return e(n),Hr.resolve();var r=Di(ji,this).registerCallback((function(t){"function"==typeof e&&window.setTimeout((function(){return e(t)}),0)}));return Di(Ri,this).uid(r).then((function(e){return Di(ki,t).js(e)})).catch((function(e){}))}},{key:"getAoneId",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",i=Di(Ui,this).getUser(n);if(i){var o=i.error?new Error(i.error):null,s=i.uid||"";return window.setTimeout((function(){return e(o,s)})),Hr.resolve()}var a=Dn(Di(Ui,this));if(null===a)return window.setTimeout((function(){return e(null,"")})),Hr.resolve();var c=Di(ji,this).registerCallback((function(r){var i=r.error?new Error(r.error):null,o=r.uid||"";Di(Ui,t).storeUser(r,n),"function"==typeof e&&window.setTimeout((function(){return e(i,o)}),0)}));return Di(Ri,this).audience(c,a,r).then((function(e){return Di(ki,t).js(e)})).catch((function(t){e(t)}))}}],r=[{key:"newInstance",value:function(t){var n=t.oid,r=t.params,i=t.consent,o=t.tracked,s=t.config,a=t.jsonp,c=t.store;return new e(o,new wi(s,n,r,i),a,new ii(n),i,c.forOwner(n))}}],n&&Si(t.prototype,n),r&&Si(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,n,r}();function Ni(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Li(this,e),$i(this,Ji,void 0),$i(this,Ki,void 0),$i(this,Yi,void 0),$i(this,Xi,void 0),$i(this,Qi,void 0),$i(this,Zi,{}),$i(this,eo,{}),$i(this,to,new Mn),$i(this,no,void 0),zi(Ji,this,t),zi(Ki,this,n.newTag||Fi.newInstance),zi(Yi,this,n.newParams||gr.default),zi(Xi,this,n.newConsent||In.default),zi(no,this,n.newStore?n.newStore():new Gr("https:"===window.location.protocol)),zi(Qi,this,r)}return Gi(e,[{key:"_owner",value:function(t){var n=this;return qi(eo,this)[t]||function(){if(!e.validOid(t))return null;var r=qi(Yi,n).call(n),i=qi(Xi,n).call(n),o=qi(Ki,n).call(n,{oid:t,params:r,consent:i,tracked:qi(Zi,n),config:qi(Ji,n),jsonp:qi(to,n),store:qi(no,n)});return qi(eo,n)[t]=new ao(o,r,i),qi(eo,n)[t]}()}},{key:"initialized",get:function(){return qi(Qi,this).initialized}},{key:"VERSION",get:function(){return"v1.9.0"}},{key:"jsonp",get:function(){return qi(to,this)}},{key:"ready",value:function(e){var t=this;"function"==typeof e&&e({VERSION:this.VERSION,send:function(){return t.send.apply(t,arguments)},sendEvent:function(){return t.sendEvent.apply(t,arguments)},setParams:function(){return t.setParams.apply(t,arguments)},getParams:function(){return t.getParams.apply(t,arguments)},initParams:function(){return t.initParams.apply(t,arguments)},sendCustomerId:function(){return t.sendCustomerId.apply(t,arguments)},getSegments:function(){return t.getSegments.apply(t,arguments)},getUserId:function(){return t.getUserId.apply(t,arguments)},getAoneId:function(){return t.getAoneId.apply(t,arguments)},setConsent:function(){return t.setConsent.apply(t,arguments)},getConsent:function(){return t.getConsent.apply(t,arguments)},useFullDomainCookies:function(){return t.useFullDomainCookies.apply(t,arguments)},getId5UserId:function(){return t.getId5UserId.apply(t,arguments)},refreshId5UserId:function(){return t.refreshId5UserId.apply(t,arguments)}})}},{key:"send",value:function(e,t,n){var r=[];Array.isArray(t)&&(r=t,t=(arguments.length>2?arguments[2]:null)||function(){},n=arguments.length>3?arguments[3]:null);var i=this._owner(e);if(null===i)return"function"==typeof t?t(new Error("oid is not valid")):void 0;i.tag.send(t,r,n,qi(Qi,this).userId)}},{key:"sendEvent",value:function(t,n){var r=this._owner(t);null!==r&&e.validEventName(n)&&r.tag.sendEvent(n,qi(Qi,this).userId)}},{key:"setParams",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",r=this._owner(e);if(null!==r){var i=function(){switch(Mi(t)){case"string":return e={},i=n,(r=Wi(r=t))in e?Object.defineProperty(e,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[r]=i,e;case"object":return t;default:return null}var e,r,i}();i&&r.params.setAll(i)}}},{key:"getParams",value:function(e,t){for(var n,r=arguments.length,i=new Array(r>2?r-2:0),o=2;o1?n-1:0),i=1;i0&&void 0!==arguments[0]?arguments[0]:"";return Yt.isString(e)&&!Yt.isEmpty(e)}},{key:"validEventName",value:function(e){return!Yt.isEmpty(e)&&Bi.test(e)}}])}(),io=new WeakMap,oo=new WeakMap,so=new WeakMap,ao=function(){return Gi((function e(t,n,r){Li(this,e),$i(this,io,void 0),$i(this,oo,void 0),$i(this,so,void 0),zi(io,this,t),zi(oo,this,n),zi(so,this,r)}),[{key:"tag",get:function(){return qi(io,this)}},{key:"params",get:function(){return qi(oo,this)}},{key:"consentPermissions",get:function(){return qi(so,this)}}])}();function co(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n