UNPKG

@m10s/cmp

Version:

Package containing scripts used by Schibsteds' sites to integrate with Sourcepoint CMP

2 lines (1 loc) 24.9 kB
!function(){var e=["jsSdkVersion","id","realm","clientId","pulseTracker","referrer","state","pulseObjectName","showInWebview","identityObject","identityObjectName","disableSentry","disableNativeConsentCheck","enableUserCentric","groupId"],t=["jsSdkVersion","id","realm","clientId","pulseTracker","referrer","state","pulseObjectName","showInWebview","identityObject","identityObjectName","disableSentry","disableNativeConsentCheck","enableUserCentric","groupId"];function n(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */n=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",c=i.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,n){return e[t]=n}}function l(e,t,n,r){var i=t&&t.prototype instanceof d?t:d,a=Object.create(i.prototype),s=new S(r||[]);return o(a,"_invoke",{value:C(e,n,s)}),a}function p(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=l;var f={};function d(){}function y(){}function g(){}var v={};u(v,a,(function(){return this}));var h=Object.getPrototypeOf,m=h&&h(h(j([])));m&&m!==t&&r.call(m,a)&&(v=m);var b=g.prototype=d.prototype=Object.create(v);function w(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function _(e,t){function n(o,i,a,s){var c=p(e[o],e,i);if("throw"!==c.type){var u=c.arg,l=u.value;return l&&"object"==typeof l&&r.call(l,"__await")?t.resolve(l.__await).then((function(e){n("next",e,a,s)}),(function(e){n("throw",e,a,s)})):t.resolve(l).then((function(e){u.value=e,a(u)}),(function(e){return n("throw",e,a,s)}))}s(c.arg)}var i;o(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,o){n(e,r,t,o)}))}return i=i?i.then(o,o):o()}})}function C(e,t,n){var r="suspendedStart";return function(o,i){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===o)throw i;return M()}for(n.method=o,n.arg=i;;){var a=n.delegate;if(a){var s=P(a,n);if(s){if(s===f)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var c=p(e,t,n);if("normal"===c.type){if(r=n.done?"completed":"suspendedYield",c.arg===f)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(r="completed",n.method="throw",n.arg=c.arg)}}}function P(e,t){var n=t.method,r=e.iterator[n];if(void 0===r)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,P(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),f;var o=p(r,e.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,f;var i=o.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,f):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,f)}function I(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function O(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function S(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(I,this),this.reset(!0)}function j(e){if(e){var t=e[a];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,o=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return o.next=o}}return{next:M}}function M(){return{value:void 0,done:!0}}return y.prototype=g,o(b,"constructor",{value:g,configurable:!0}),o(g,"constructor",{value:y,configurable:!0}),y.displayName=u(g,c,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===y||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,g):(e.__proto__=g,u(e,c,"GeneratorFunction")),e.prototype=Object.create(b),e},e.awrap=function(e){return{__await:e}},w(_.prototype),u(_.prototype,s,(function(){return this})),e.AsyncIterator=_,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new _(l(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},w(b),u(b,c,"Generator"),u(b,a,(function(){return this})),u(b,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},e.values=j,S.prototype={constructor:S,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(O),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(n,r){return a.type="throw",a.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(s&&c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,f):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),f},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),O(n),f}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;O(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:j(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),f}},e}function r(e,t,n,r,o,i,a){try{var s=e[i](a),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,o)}function o(e){return function(){var t=this,n=arguments;return new Promise((function(o,i){var a=e.apply(t,n);function s(e){r(a,o,i,s,c,"next",e)}function c(e){r(a,o,i,s,c,"throw",e)}s(void 0)}))}}function i(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}var a="__CONFIGURATION_PLACEHOLDER__";function s(){var e;"undefined"!=typeof document&&document.location.href.indexOf("sp_debug=1")>0&&(e=console).debug.apply(e,["[CMP]"].concat(Array.prototype.slice.call(arguments)))}function c(e,t,n,r,o){var i=new URL(e);i.searchParams.append("utm_source","cmp"),i.searchParams.append("utm_medium","psi"),i.searchParams.append("referrer",r||window.location.href),n&&i.searchParams.append("client_id",n),t&&i.searchParams.append("environment_id",t),o&&i.searchParams.append("state",o),window.location.href=i.href}function u(e){return null===e?null:Boolean(parseInt(e))}function l(e,t,n){var r=new Date;r.setTime(r.getTime()+24*n*60*60*1e3);var o="expires="+r.toUTCString();document.cookie=e+"="+t+";"+o+";path=/"}function p(e){for(var t=e+"=",n=decodeURIComponent(document.cookie).split(";"),r=0;r<n.length;r++){for(var o=n[r];" "==o.charAt(0);)o=o.substring(1);if(0==o.indexOf(t))return o.substring(t.length,o.length)}return""}function f(e){document.cookie=e+"=; Max-Age=-99999999;"}var d=["Mixed","PSI","SCC","TCF","PMC"],y="default",g="cmp",v="cache",h="account",m="accepted",b="rejected",w="unknown",_=Object.freeze({purposes:{CMP_ANALYTICS:{optIn:!1,status:w},CMP_MARKETING:{optIn:!1,status:w},CMP_ADVERTISING:{optIn:!1,status:w},CMP_PERSONALIZATION:{optIn:!1,status:w}},source:y});function C(e,t,n,r){s("Pulse: "+n+"(actor, data):",t,r),P(e,(function(e){e&&"function"==typeof e.track&&e.track(n,{schema:"http://schema.schibsted.com/events/tracker-event.json/348.json",object:Object.assign({},r,C.pulseCommonData),provider:{component:"CMP-Marketplaces"},actor:t})}))}function P(e,t){if(e.psi.pulseTracker)return t(e.psi.pulseTracker);var n=e.psi.pulseObjectName||"pulse";return"function"!=typeof e[n]?console.error("No Pulse integration detected. Aborting."):e[n]((function(e){"function"==typeof t&&t(e)}))}function I(){var e,t=null==(e=C.pulseCommonData)?void 0:e.messageName;if(t)return d.find((function(e){return t.includes(e)}))}function O(e){return"CMP_"+("personalisation"===e?"personalization":e).toUpperCase()}function S(e,t,n){var r=Object.keys(j(e)).filter((function(t){return j(e)[t]})),o=Object.keys(j(e)).filter((function(t){return!j(e)[t]}));return r.map((function(e){var n=t.purposes[O(e)];n.optIn=!0,n.status=m})),o.map((function(e){t.purposes[O(e)].status=b})),t.source=n,t}function j(e){var t,n=u((e._scc_||e._tcf_).getPermissionSync("CMP:advertising")),r=u((e._scc_||e._tcf_).getPermissionSync("CMP:analytics")),o=u((e._scc_||e._tcf_).getPermissionSync("CMP:marketing")),i=u((e._scc_||e._tcf_).getPermissionSync("CMP:personalisation"));return t={advertising:n,analytics:r,marketing:o,personalisation:i},Object.entries(t).filter((function(e){return e[0],null!=e[1]})).reduce((function(e,t){var n,r=t[0],o=t[1];return Object.assign({},e,((n={})[r]=o,n))}),{})}function M(e,t){var n=t.performance.now();return e?Math.round((n-e)/1e3):null}var k=null,L=!1,T=!1;function E(e,t,n){if(t&&("object"!=typeof(r=t)||r.constructor!==Object))return console.error("Provided object is incorrect");var r;if(0===Object.keys(j(e)).length){if(!t)return _;var o=JSON.parse(JSON.stringify(t));return o.source=y,o}var i=JSON.parse(JSON.stringify(t||_));return S(e,i,n?h:v)}function x(e,t){t.events=t.events||{};var n,r=t.events.onMessageReceiveData,o=t.events.onMessageChoiceSelect,i=t.events.onMessageReady,a=t.events.onPrivacyManagerAction,c=t.events.onConsentReady,u=!0,l={id:t.userId,realm:t.realm};t.events.onMessageReceiveData=function(e,n){s("Sourcepoint: onMessageReceiveData(data)",n),k=!0,C.pulseCommonData={"@id":"sdrn:privacy:cmp:"+(n.messageId||""),"@type":"CMP",messageName:n.msgDescription||"",propertyId:t.propertyId,messageId:n.messageId||void 0,bucket:n.bucket||void 0,jsSdkVersion:t.jsSdkVersion,partitionId:n.prtnUUID||"",language:t.consentLanguage},"function"==typeof r&&r(n)},t.events.onMessageReady=function(){var t,r;null==(t=window._tcf_)||null==(r=t.TCFCallbacks)||r.map((function(e){e()})),s("Sourcepoint: onMessageReady()");var o=I();if(s("Pulse: Detected message type: "+o),!k)return C(e,l,"View",{name:"CMP: Privacy Manager displayed",messageType:I()});n=e.performance.now(),C(e,l,"View",{name:"CMP: Message displayed",messageType:o}),"function"==typeof i&&i()},t.events.onMessageChoiceSelect=function(t,r,i){if(s("Sourcepoint: onMessageReady(choice_id="+r+", choice_type_id="+i+")"),5===i){var a=M(n,e);C(e,l,"engagementEvent",Object.assign({name:"CMP: Link to Privacy / Cookie Policy clicked",elementType:"anchor",isFirstLayer:k,messageType:I()},a&&{duration:a})),k=null}if(9===i){u=!1,k=null;var c=M(n,e);C(e,l,"engagementEvent",Object.assign({name:"CMP: Open Privacy Settings",elementType:"button",messageType:I()},c&&{duration:c}))}if(11===i&&(u=!0),12===i&&(k=!1),15===i){var p=M(n,e);C(e,l,"engagementEvent",Object.assign({name:"CMP: Dismiss message",elementType:"button",messageType:I()},p&&{duration:p}))}"function"==typeof o&&o(r,i)},t.events.onPrivacyManagerAction=function(e,t){s("Sourcepoint: onPrivacyManagerAction()"),L=!0,k=!1,"none"===t.purposeConsent?(T=!0,u=!1):(T=!1,u=!0),"function"==typeof a&&a()},t.events.onConsentReady=function(t,r,o,i){var a,p,f,d;null==(a=window._tcf_)||null==(p=a.consentedCallback)||p.map((function(e){e(i.consentedToAll)})),null==(f=window._tcf_)||null==(d=f.TCFCallbacks)||d.map((function(e){e()})),s("Sourcepoint: onConsentReady(message_type="+t+", consentUUID="+r+", euconsent)",o),s("Sourcepoint: getMessageType() "+I());var y=M(n,e);if(void 0!==I()||L){var v="PSI"===I()?null:j(e);if(function(e){var t=JSON.parse(JSON.stringify(_));P(e,(function(n){try{n.setConsents(S(e,t,g))}catch(e){console.error("Consents couldn't be set. The provided version of Pulse SDK does not support the setConsents event")}}))}(e),T&&C(e,l,"engagementEvent",Object.assign({name:"CMP: Reject all",elementType:"button",messageType:I()},y&&{duration:y})),!u)return!1;C(e,l,"engagementEvent",Object.assign({name:"CMP: Accept",elementType:"button",messageType:I(),consentedToAll:null==i?void 0:i.consentedToAll,isFirstLayer:k||!!k},v&&{consents:v},y&&{duration:y})),k=null,L=!1,T=!1,"function"==typeof c&&c(t,r,o,i)}}}function N(e,t,n){var r;if(!t||!t.groupPmId)throw new Error("groupPmId is required");var o="CMP:advertising",i="CMP:analytics",a="CMP:marketing",c="CMP:personalisation",u="CMP:performance_marketing",l={};function p(t){return s(n+": getPermissionFromCache(category="+t+")"),e.localStorage.getItem(t)}l[o]=[],l[i]=[],l[a]=[],l[c]=[],l[u]=[];var f,d={subscribers:l,consentedCallback:[],TCFCallbacks:[],showPrivacyManager:function(){s("${type}: showPrivacyManager()"),C.pulseCommonData.messageName="",L=!0,k=!1,e._sp_.gdpr.loadPrivacyManagerModal()},getPermissionSync:function(e){return s(n+": getPermissionSync(category="+e+")"),p(e)},getPermission:function(e,t){s(n+": getPermission(category="+e+")");var r,o=d.subscribe(e,(r=!1,function(e){r?"function"==typeof o&&o():(r=!0,t(e),t=function(){})}))},notify:(r={},r[o]=p(o),r[i]=p(i),r[a]=p(a),r[c]=p(c),r[u]=p(u),f=r,function(e,t){if(f[e]!==t){s(n+": notify(category="+e+", value="+t+")"),f[e]=t;for(var r=d.subscribers[e],o=0;o<r.length;o++)r[o](t)}else s(n+": notify(category="+e+", value="+t+") - IGNORED")}),subscribe:function(e,t){if(s(n+": subscribe(category="+e+")"),d.subscribers[e]){d.subscribers[e].push(t);var r=p(e);return null!==r&&t(r),function(){d.subscribers[e]=d.subscribers[e].filter((function(e){return e!==t}))}}console.error("Unable to subscribe - undefined consent category!")},getCachedOrDefaultConsentsForPulse:function(n){return E(e,n,t.authId)},isConsentedToAll:function(e){d.consentedCallback.push(e)},getConsentedToAllSync:function(){var e=p("_sp_user_consent_"+t.propertyId);try{var n,r;if(0===Object.keys(localStorage).filter((function(e){return e.startsWith("CMP:")})).length)return null;var o=null==(n=JSON.parse(e))||null==(r=n.gdpr)?void 0:r.consentStatus;if((null==o?void 0:o.vendorListAdditions)||(null==o?void 0:o.legalBasisChanges))return null;var i=null==o?void 0:o.consentedAll;return void 0===i?null:i}catch(e){return null}},onTcfReady:function(e){d.TCFCallbacks.push(e)},clearCMPData:function(){["_sp_user_consent_"+t.propertyId,"_sp_non_keyed_local_state","_sp_local_state","CMP:advertising","CMP:analytics","CMP:marketing","CMP:personalisation"].forEach((function(e){localStorage.removeItem(e),sessionStorage.removeItem(e)})),["consentUUID","euconsent-v2","consentDate"].forEach((function(e){document.cookie=e+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;"}))}};return e._SourcePoint_Consent_Callback=d.notify,d}function A(e,t){var n,r;if(null!=(n=e.psi)&&n.identityObject)return e.psi.identityObject;if(null!=t&&t.identityObject)return t.identityObject;var o=(null==(r=e.psi)?void 0:r.identityObjectName)||(null==t?void 0:t.identityObjectName)||"Identity";return e[o]?e[o]:console.warn("No Schibsted Account integration detected.")}function U(e){var t=Array.from({length:20},(function(){return String.fromCharCode(Math.floor(25*Math.random()+97))})).join(""),n=btoa(JSON.stringify(t));A(e)&&A(e).login({state:n})}var R=function(e){if("number"==typeof e||void 0===e)return config.userId=e;throw new Error("Id value "+e+" is invalid")},D=function(e){return function(e){try{return Boolean(new URL(e))}catch(e){return!1}}(e)?window.psi.isLoggedInUser?c(e,null,window.psi.clientId,window.psi.referrer,window.psi.state):P(window,(function(t){t.getEnvironmentId().then((function(t){c(e,t,window.psi.clientId,window.psi.referrer,window.psi.state)}))})):console.error("The URL passed to the configuration is invalid. Please, correct it.")},F=function(){return U(window)},G=function(e,t,n){e.targetingParams=e.targetingParams||{},e.targetingParams[t]=n};var V,J,W=["Hermes","_app_","tv.nu","FinnApp","Omni"];function H(e){return W.some((function(t){return e.userAgent.includes(t)}))}function z(e,t,n){return!new URLSearchParams(null==(r=e.location)?void 0:r.search).has("_sp_pass_consent")&&H(t)&&!n.disableNativeConsentCheck;var r}function B(){return(B=o(n().mark((function e(r,o,a,s,c){var u,d,y,g,v;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Y(r,o,a,s,c),s.jsSdkVersion,s.id,s.realm,s.clientId,s.pulseTracker,s.referrer,s.state,s.pulseObjectName,s.showInWebview,s.identityObject,s.identityObjectName,s.disableSentry,s.disableNativeConsentCheck,s.enableUserCentric,s.groupId,u=i(s,t),e.prev=2,d=A(r),e.t0=p("CMP:isLoggedIn"),e.t0){e.next=9;break}return e.next=8,d.isLoggedIn();case 8:e.t0=e.sent;case 9:if(e.t0){e.next=12;break}return e.abrupt("return",K(r,u));case 12:return d.on("logout",(function(){f("CMP:isLoggedIn")})),p("CMP:isLoggedIn")||l("CMP:isLoggedIn",!0),G(s,"loggedin",!0),y={externalParty:"sourcepoint",optionalSuffix:s.groupId},e.next=18,d.getExternalId(y.externalParty,y.optionalSuffix);case 18:g=e.sent,v=G(s,"enableUserCentric",!0),K(r,Object.assign({authId:g,targetingParams:v},u)),e.next=27;break;case 23:e.prev=23,e.t1=e.catch(2),console.error("Identity: ",e.t1),K(r,u);case 27:case"end":return e.stop()}}),e,null,[[2,23]])})))).apply(this,arguments)}function Y(e,t,n,r,o){var i,a,s;if(!(r&&r.baseEndpoint&&r.propertyId&&r.consentLanguage))throw new Error("One of missing: baseEndpoint, propertyId, consentLanguage");x(e,r),function(e){e.events=e.events||{},e.events.onError=function(t,n,r){try{t&&window._cmp_.sentry.setTag("message_type",t),n&&window._cmp_.sentry.setTag("errorCode",n),window._cmp_.sentry.setTag("propertyId",e.propertyId),window._cmp_.sentry.captureException(r)}catch(e){console.error("Can not send the error to Sentry, "+e)}},e.events.onMessageChoiceError=function(e,t){try{e&&window._cmp_.sentry.setTag("message_type",e),window._cmp_.sentry.captureException(t)}catch(t){console.error("Can not send the error to Sentry, "+t)}}}(r),r.accountId=r.accountId||1960,r.custom={},"psi"!==o&&(r.gdpr={includeTcfApi:"tcf"===o}),r.propertyHref&&(r.joinHref=!0);var c=r.userId||(null==(i=A(e,r))?void 0:i._session.userId);c&&G(r,"loggedin","true");var u=r.clientId||(null==(a=A(window,r))?void 0:a.clientId);H(n)&&G(r,"mobile-webview",!r.showInWebview||r.showInWebview);var l,p=null==t||null==(s=t.referrer)?void 0:s.split("/")[2];p&&G(r,"referrer-hostname",p),l=/(_sch_cmp_[_a-z0-9]+)=(.+)/i,t.cookie.split(";").filter((function(e){return l.test(e)})).map((function(e){return e.split("=").map((function(e){return e.trim()}))})).forEach((function(e){var t=e[0],n=e[1];return G(r,t,n)})),r.propertyHref&&t.location.search&&-1===r.propertyHref.indexOf("?")&&(r.propertyHref+=t.location.search);var f=r.pulseTracker,d=r.referrer,y=r.state,g=r.pulseObjectName,v=r.showInWebview,h=r.identityObject,m=r.identityObjectName,b=r.enableUserCentric,w=r.groupId;e.psi=e.psi||{},e.psi.isLoggedInUser=!!c,e.psi.setUserId=R,e.psi.openPrivacySettings=D,e.psi.pulseTracker=f,e.psi.clientId=u,e.psi.referrer=d,e.psi.state=y,e.psi.pulseObjectName=g,e.psi.showInWebview=v,e.psi.identityObject=h,e.psi.identityObjectName=m,e.psi.triggerLogin=F,e.psi.enableUserCentric=b,e.psi.groupId=w}function K(e,t){e._sp_=e._sp_||{},e._sp_.config=t,s("Sourcepoint initiated with config: ",t)}function q(e,t){if(!t.disableSentry){var n,r,o=e.createElement("script");n=o,r={async:!0,type:"module",src:"https://static.pro.cmp.m10s.io/dist/index.js",fetchPriority:"low"},Object.keys(r).filter((function(e){return void 0!==n[e]})).forEach((function(e){return"object"==typeof r[e]?Object.keys(r[e]).forEach((function(t){return n[e][t]=r[e][t]})):n[e]=r[e]})),e.head.appendChild(o)}}function Z(){return(Z=o(n().mark((function e(t,r){var o,i,a;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,o="https://cdn.privacy-mgmt.com/consent/tcfv2/consent/v3/history/"+r.propertyId+"?authId="+r.authId,e.next=4,fetch(o);case 4:if((i=e.sent).ok){e.next=7;break}throw new Error("HTTP "+i.status);case 7:return e.next=9,i.json();case 9:0===(a=e.sent).length&&C(t,r.userId,"View",{"@id":"sdrn:privacy:cmp:"+r.propertyId,"@type":"CMP",name:"CMP: First save to account",language:r.consentLanguage}),a.length>0&&(C(t,r.userId,"View",{"@id":"sdrn:privacy:cmp:"+r.propertyId,"@type":"CMP",name:"CMP: Account already has saved choices",language:r.consentLanguage}),$(r)),l("CMP:stickyConsent",!0,400),e.next=18;break;case 15:e.prev=15,e.t0=e.catch(0),console.warn("[SP] Fetching consent history error:",e.t0);case 18:case"end":return e.stop()}}),e,null,[[0,15]])})))).apply(this,arguments)}function $(e){var t,n,r,o,i=document.createElement("script");i.src="https://static.pro.cmp.m10s.io/dist/retrieve.js",document.body.appendChild(i);var a,s,c=document.createElement("retrieve-message");a=c,s=Object.assign({isWeb:!0,lang:e.consentLanguage},(null==(t=e.consentStatusMessage)?void 0:t.verticalPosition)&&{verticalPosition:null==(n=e.consentStatusMessage)?void 0:n.verticalPosition},(null==(r=e.consentStatusMessage)?void 0:r.horizontalPosition)&&{horizontalPosition:null==(o=e.consentStatusMessage)?void 0:o.horizontalPosition}),Object.entries(s).forEach((function(e){return a.setAttribute.apply(a,e)})),document.body.appendChild(c)}z(window,navigator,a)?(console.warn("CMP: Native consent is not passed. Sourcepoint will not be initialized."),window._sp_={config:{accountId:1960,baseEndpoint:"https://cdn.privacy-mgmt.com"}}):(V=document,(J=V.createElement("script")).innerHTML='"use strict";function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}!function(){var t=function(){var t,e,o=[],n=window,r=n;for(;r;){try{if(r.frames.__tcfapiLocator){t=r;break}}catch(t){}if(r===n.top)break;r=r.parent}t||(!function t(){var e=n.document,o=!!n.frames.__tcfapiLocator;if(!o)if(e.body){var r=e.createElement("iframe");r.style.cssText="display:none",r.name="__tcfapiLocator",e.body.appendChild(r)}else setTimeout(t,5);return!o}(),n.__tcfapi=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];if(!n.length)return o;"setGdprApplies"===n[0]?n.length>3&&2===parseInt(n[1],10)&&"boolean"==typeof n[3]&&(e=n[3],"function"==typeof n[2]&&n[2]("set",!0)):"ping"===n[0]?"function"==typeof n[2]&&n[2]({gdprApplies:e,cmpLoaded:!1,cmpStatus:"stub"}):o.push(n)},n.addEventListener("message",(function(t){var e="string"==typeof t.data,o={};if(e)try{o=JSON.parse(t.data)}catch(t){}else o=t.data;var n="object"===_typeof(o)&&null!==o?o.__tcfapiCall:null;n&&window.__tcfapi(n.command,n.version,(function(o,r){var a={__tcfapiReturn:{returnValue:o,success:r,callId:n.callId}};t&&t.source&&t.source.postMessage&&t.source.postMessage(e?JSON.stringify(a):a,"*")}),n.parameter)}),!1))};"undefined"!=typeof module?module.exports=t:t()}();',V.head.appendChild(J),q(document,a),function(e,t){e._tcf_=N(e,t)}(window,a),a.enableUserCentric?function(e,t,n,r,o){B.apply(this,arguments)}(window,document,navigator,a,"tcf"):(function(t,n,r,o,a){Y(t,n,r,o,a),o.jsSdkVersion,o.id,o.realm,o.clientId,o.pulseTracker,o.referrer,o.state,o.pulseObjectName,o.showInWebview,o.identityObject,o.identityObjectName,o.disableSentry,o.disableNativeConsentCheck,o.enableUserCentric,o.groupId,K(t,i(o,e))}(window,document,navigator,a,"tcf"),a.authId&&!p("CMP:stickyConsent")&&function(e,t){Z.apply(this,arguments)}(window,a)))}();