// Bundle time - 2026-10-09T00:43:47Z - SalesforceInteractions // SDK - npm/@salesforce/interactions/2.0/target/dist/scripts/interactions-bundle.min.js [2.0.12] /* regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE js-cookie v3.0.8 | MIT */ 'use strict';var SalesforceInteractions=function(e){function ma(b,a){(null==a||a>b.length)&&(a=b.length);for(var c=0,d=Array(a);c=b.length?{done:!0}:{done:!1,value:b[d++]}},e:function(a){throw a;},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}var f,h=!0,l=!1;return{s:function(){c=c.call(b)},n:function(){var a=c.next();return h=a.done,a},e:function(a){l=!0;f=a},f:function(){try{h||null==c.return||c.return()}finally{if(l)throw f; }}}}function X(b,a,c){return(a=db(a))in b?Object.defineProperty(b,a,{value:c,enumerable:!0,configurable:!0,writable:!0}):b[a]=c,b}function pa(){return pa="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(b,a,c){var d;for(d=b;!{}.hasOwnProperty.call(d,a)&&null!==(d=L(d)););if(d)return d=Object.getOwnPropertyDescriptor(d,a),d.get?d.get.call(3>arguments.length?b:c):d.value},pa.apply(null,arguments)}function L(b){return L=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(a){return a.__proto__|| Object.getPrototypeOf(a)},L(b)}function lc(b,a){if("function"!=typeof a&&null!==a)throw new TypeError("Super expression must either be null or a function");b.prototype=Object.create(a&&a.prototype,{constructor:{value:b,writable:!0,configurable:!0}});Object.defineProperty(b,"prototype",{writable:!1});a&&qa(b,a)}function bb(){try{var b=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(a){}return(bb=function(){return!!b})()}function eb(b,a){var c=Object.keys(b);if(Object.getOwnPropertySymbols){var d= Object.getOwnPropertySymbols(b);a&&(d=d.filter(function(a){return Object.getOwnPropertyDescriptor(b,a).enumerable}));c.push.apply(c,d)}return c}function q(b){for(var a=1;a>2]|=e.charCodeAt(p)<<8*~p--;for(a=p=0;ap;c=[c[4]+(f[p]=16>p?~~l[a+p]:2*e|0>e)+1518500249+[d&g|~d&k,e=341275144+(d^g^k),882459459+(d&g|d&k|g&k),e+1535694389][p++/5>>2]+((e=c[0])<<5|e>>>27),e,d<<30|d>>>2,g,k]){e=f[p-3]^f[p-8]^f[p-14]^f[p-16];d=c[1];var g=c[2];var k=c[3]}for(p=5;p;)h[--p]+= c[p]}for(e="";40>p;)e+=(h[p>>3]>>4*(7-p++)&15).toString(16);return e}function Z(b){for(var a=1;ab.indexOf(a)})}function vc(b,a,c,d,f){f.guid=f.guid||k.guid++;var h=b.___ce=b.___ce||{};h[a]=h[a]||[];h[a].push([c,d,f]);b.addEventListener(a,f)}function Ba(b){b=b.split(".");return[b[0],b.slice(1).sort()]}function da(b,a,c,d,f){var h=b.___ce=b.___ce||{};if(a)h[a]&&(h[a]=h[a].filter(function(l){var h=Y(l,3);l=h[0];var e=h[1];h=h[2];if(f&&h.guid!==f.guid||!rb(l,c)||d&&d!==e)return!0;b.removeEventListener(a,h)}));else for(a in h)da(b,a,c,d,f)}function sb(b){return b.multiple&& b.options?B(xa.call(b.options,function(a){return a.selected&&!a.disabled&&!a.parentNode.disabled}),"value"):b.value||""}function tb(b){if(!u(b))return[];if(wc.test(b))return[J(RegExp.$1)];var a=xc.test(b)&&RegExp.$1;a=ub[a]||ub["*"];a.innerHTML=b;return k(a.childNodes).detach().get()}function yc(b,a){b=k(b);b.filter("script").add(b.find("script")).each(function(b,d){if(zc.test(d.type)&&Ca.contains(d)){var c=J("script");c.text=d.textContent.replace(Ac,"");t(Bc,function(a,b){d[b]&&(c[b]=d[b])});a.head.insertBefore(c, null);a.head.removeChild(c)}})}function E(b,a,c,d,f,h,l,e){t(b,function(b,h){t(k(h),function(b,h){t(k(a),function(a,b){var l=c?b:h;b=c?h:b;a=a?l.cloneNode(!0):l;f?b.insertBefore(a,d?b.firstElementChild:null):b.parentNode.insertBefore(a,d?b:b.nextElementSibling);yc(a,b.ownerDocument)},e)},l)},h);return a}function Cc(b){var a=b.pageTypeDefault;b=0/,oc=/^\w+$/,ba=function(){function b(a){var c=1a?0:1;carguments.length?this[0]&&this[0][b]:this.each(function(c,f){f[b]=a});for(var c in b)this.prop(c,b[c]);return this}};g.get=function(b){return void 0===b?Ib.call(this):this[0>b?b+this.length:b]};g.eq=function(b){return k(this.get(b))};g.first=function(){return this.eq(0)}; g.last=function(){return this.eq(-1)};g.filter=function(b){var a=wa(b);return k(xa.call(this,function(b,d){return a.call(b,d,b)}))};var qc=/\S+/g;g.hasClass=function(b){return!!b&&Aa.call(this,function(a){return a.classList.contains(b)})};g.removeAttr=function(b){var a=ca(b);return this.each(function(b,d){t(a,function(a,b){d.removeAttribute(b)})})};g.attr=function(b,a){if(b){if(u(b)){if(2>arguments.length){if(!this[0])return;var c=this[0].getAttribute(b);return null===c?void 0:c}return void 0===a? this:null===a?this.removeAttr(b):this.each(function(c,f){f.setAttribute(b,a)})}for(c in b)this.attr(c,b[c]);return this}};g.toggleClass=function(b,a){var c=ca(b),d=void 0!==a;return this.each(function(b,h){t(c,function(b,c){d?a?h.classList.add(c):h.classList.remove(c):h.classList.toggle(c)})})};g.addClass=function(b){return this.toggleClass(b,!0)};g.removeClass=function(b){return arguments.length?this.toggleClass(b,!1):this.attr("class","")};k.unique=A;g.add=function(b,a){return k(A(this.get().concat(k(b, a).get())))};var ya=/^--/,za={},tc=Gb.style,sc=["webkit","moz","ms"];k.prefixedProp=nb;var uc={animationIterationCount:!0,columnCount:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0};g.css=function(b,a){if(u(b)){var c=ya.test(b);b=nb(b,c);if(2>arguments.length)return this[0]&&I(this[0],b,c);if(!b)return this;a=ob(b,a,c);return this.each(function(d,h){h&&1===h.nodeType&&(c?h.style.setProperty(b,a):h.style[b]=a)})}for(var d in b)this.css(d, b[d]);return this};g.data=function(b,a){if(!b){if(!this[0])return;var c={},d;for(d in this[0].dataset)c[d]=pb(this[0],d);return c}if(u(b))return 2>arguments.length?this[0]&&pb(this[0],b):this.each(function(c,d){c=a;try{c=JSON.stringify(c)}catch(l){}d.dataset[S(b)]=c});for(c in b)this.data(c,b[c]);return this};t([!0,!1],function(b,a){t(["Width","Height"],function(b,d){var c="".concat(a?"outer":"inner").concat(d);g[c]=function(f){if(this[0])return va(this[0])?T[c]:this[0]["".concat(a?"offset":"client").concat(d)]+ (f&&a?P(this[0],"margin".concat(b?"Top":"Left"))+P(this[0],"margin".concat(b?"Bottom":"Right")):0)}})});t(["width","height"],function(b,a){g[a]=function(c){if(!this[0])return void 0===c?void 0:this;if(!arguments.length)return va(this[0])?this[0][S("outer-".concat(a))]:this[0].getBoundingClientRect()[a]-qb(this[0],!b);var d=parseInt(c,10);return this.each(function(c,h){h&&1===h.nodeType&&(c=I(h,"boxSizing"),h.style[a]=ob(a,d+("border-box"===c?qb(h,!b):0)))})}});var Na={};g.toggle=function(b){return this.each(function(a, c){if(void 0===b?"none"===I(c,"display"):b){if(c.style.display=c.___cd||"","none"===I(c,"display")){a=c.style;c=c.tagName;if(Na[c])c=Na[c];else{var d=J(c);z.body.insertBefore(d,null);var f=I(d,"display");z.body.removeChild(d);c=Na[c]="none"!==f?f:"block"}a.display=c}}else c.___cd=I(c,"display"),c.style.display="none"})};g.hide=function(){return this.toggle(!1)};g.show=function(){return this.toggle(!0)};var Oa={focus:"focusin",blur:"focusout"},Jb={mouseenter:"mouseover",mouseleave:"mouseout"},Mc=/^(mouse|pointer|contextmenu|drag|drop|click|dblclick)/i; g.off=function(b,a,c){var d=this;if(void 0===b)this.each(function(a,b){da(b)});else if(u(b))H(a)&&(c=a,a=""),t(ca(b),function(b,f){b=Ba(Jb[f]||Oa[f]||f);b=Y(b,2);var l=b[0],h=b[1];d.each(function(b,d){da(d,l,h,a,c)})});else for(var f in b)this.off(f,b[f]);return this};g.on=function(b,a,c,d){var f=this;if(!u(b)){for(var h in b)this.on(h,a,b[h]);return this}H(a)&&(c=a,a="");t(ca(b),function(b,h){b=Ba(Jb[h]||Oa[h]||h);b=Y(b,2);var l=b[0],e=b[1];f.each(function(b,f){var h=function(b){if(!b.namespace|| rb(e,b.namespace.split("."))){var g=f;if(a){for(var k=b.target;!ua(k,a);){if(k===f)return;k=k.parentNode;if(!k)return}g=k;b.___cd=!0}b.___cd&&Object.defineProperty(b,"currentTarget",{configurable:!0,get:function(){return g}});k=c.call(g,b,b.data);d&&da(f,l,e,a,h);!1===k&&(b.preventDefault(),b.stopPropagation())}};h.guid=c.guid=c.guid||k.guid++;vc(f,l,e,a,h)})});return this};g.one=function(b,a,c){return this.on(b,a,c,!0)};g.ready=function(b){"loading"!==z.readyState?b(k):z.addEventListener("DOMContentLoaded", function(){b(k)});return this};g.trigger=function(b,a){if(u(b)){var c=Ba(b),d=Y(c,2);c=d[0];d=d[1];var f=Mc.test(c)?"MouseEvents":"HTMLEvents";b=z.createEvent(f);b.initEvent(c,!0,!0);b.namespace=d.join(".")}b.data=a;var h=b.type in Oa;return this.each(function(a,c){if(h&&H(c[b.type]))c[b.type]();else c.dispatchEvent(b)})};var Nc=/%20/g,Oc=/file|reset|submit|button|image/i,Pc=/radio|checkbox/i;g.serialize=function(){var b="";this.each(function(a,c){t(c.elements||[c],function(a,c){c.disabled||!c.name|| "FIELDSET"===c.tagName||Oc.test(c.type)||Pc.test(c.type)&&!c.checked||(a=sb(c),void 0!==a&&(a=Ma(a)?a:[a],t(a,function(a,d){a=b;d="&".concat(encodeURIComponent(c.name),"=").concat(encodeURIComponent(d).replace(Nc,"+"));b=a+d})))})});return b.slice(1)};g.val=function(b){return void 0===b?this[0]&&sb(this[0]):this.each(function(a,c){if("SELECT"===c.tagName){var d=Ma(b)?b:null===b?[]:[b];t(c.options,function(a,b){b.selected=0<=d.indexOf(b.value)})}else c.value=null===b?"":b})};g.clone=function(){return this.map(function(b, a){return a.cloneNode(!0)})};g.detach=function(){return this.each(function(b,a){a.parentNode&&a.parentNode.removeChild(a)})};var xc=/^\s*<(\w+)[^>]*>/,wc=/^\s*<(\w+)\s*\/?>(?:<\/\1>)?\s*$/,ub={"*":Gb,tr:Hc,td:Hb,th:Hb,thead:La,tbody:La,tfoot:La};k.parseHTML=tb;g.empty=function(){return this.each(function(b,a){for(;a.firstChild;)a.removeChild(a.firstChild)})};g.html=function(b){return void 0===b?this[0]&&this[0].innerHTML:this.each(function(a,c){c.innerHTML=b})};g.remove=function(){return this.detach().off()}; g.text=function(b){return void 0===b?this[0]?this[0].textContent:"":this.each(function(a,c){c.textContent=b})};g.unwrap=function(){this.parent().each(function(b,a){b=k(a);b.replaceWith(b.children())});return this};g.offset=function(){var b=this[0];if(b)return b=b.getBoundingClientRect(),{top:b.top+T.pageYOffset-Ca.clientTop,left:b.left+T.pageXOffset-Ca.clientLeft}};g.offsetParent=function(){return k(this[0]&&this[0].offsetParent)};g.position=function(){var b=this[0];if(b)return{left:b.offsetLeft, top:b.offsetTop}};g.children=function(b){return O(k(A(B(this,function(a){return a.children}))),b)};g.contents=function(){return k(A(B(this,function(b){return"IFRAME"===b.tagName?[b.contentDocument]:b.childNodes})))};g.find=function(b){return k(A(B(this,function(a){return ta(b,a)})))};var Ac=/^\s*\s*$/g,zc=/^$|^module$|\/(java|ecma)script/i,Bc=["type","src","nonce","noModule"];g.after=function(){return E(arguments,this,!1,!1,!1,!0,!0)};g.append=function(){return E(arguments, this,!1,!1,!0)};g.appendTo=function(b){return E(arguments,this,!0,!1,!0)};g.before=function(){return E(arguments,this,!1,!0)};g.insertAfter=function(b){return E(arguments,this,!0,!1,!1,!1,!1,!0)};g.insertBefore=function(b){return E(arguments,this,!0,!0)};g.prepend=function(){return E(arguments,this,!1,!0,!0,!0,!0)};g.prependTo=function(b){return E(arguments,this,!0,!0,!0,!1,!1,!0)};g.replaceWith=function(b){return this.before(b).remove()};g.replaceAll=function(b){k(b).replaceWith(this);return this}; g.wrapAll=function(b){b=k(b);for(var a=b[0];a.children.length;)a=a.firstElementChild;this.first().before(b);return this.appendTo(a)};g.wrap=function(b){return this.each(function(a,c){var d=k(b)[0];k(c).wrapAll(a?d.cloneNode(!0):d)})};g.wrapInner=function(b){return this.each(function(a,c){a=k(c);c=a.contents();c.length?c.wrapAll(b):a.append(b)})};g.has=function(b){var a=u(b)?function(a,d){return ta(b,d).length}:function(a,d){return d.contains(b)};return this.filter(a)};g.is=function(b){var a=wa(b); return Aa.call(this,function(b,d){return a.call(b,d,b)})};g.next=function(b,a){return O(k(A(B(this,"nextElementSibling",a))),b)};g.nextAll=function(b){return this.next(b,!0)};g.not=function(b){var a=wa(b);return this.filter(function(b,d){return!a.call(d,b,d)})};g.parent=function(b){return O(k(A(B(this,"parentNode"))),b)};g.index=function(b){var a=b?k(b)[0]:this[0];b=b?this:k(a).parent().children();return mb.call(b,a)};g.closest=function(b){var a=this.filter(b);if(a.length)return a;var c=this.parent(); return c.length?c.closest(b):a};g.parents=function(b){return O(k(A(B(this,"parentElement",!0))),b)};g.prev=function(b,a){return O(k(A(B(this,"previousElementSibling",a))),b)};g.prevAll=function(b){return this.prev(b,!0)};g.siblings=function(b){return O(k(A(B(this,function(a){return k(a).parent().children().not(a)}))),b)};var ja=function(){function b(){M(this,b);this.listeners=[]}return N(b,[{key:"on",value:function(a){var b=this;(this.listeners=this.listeners||[]).push(a);return function(){b.listeners= b.listeners.filter(function(b){return b!==a})}}},{key:"once",value:function(a){var b=this;return this.on(function(){b.unbindAll();try{for(var c=arguments.length,f=Array(c),h=0;h=d&&(W(c),e(!1))}catch(fb){W(c),l(fb)}},f);G[c]=function(){clearInterval(g)}})},unbind:W,getBindings:function(){return G},clearBindings:function(){for(var a in G)G.hasOwnProperty(a)&&"function"=== typeof G[a]&&W(a)}}},bc=function(a){a.global=a.global||{};"object"!=x(a.global)&&n.onFireException.emit(Error("The global config has a type of ".concat(x(a.global),", but it must be an object")),"Sitewide Javascript");Object.assign(m.config,q({},a));n.onInitSitemap.emit(m.config)},Wa=function(a){ad(a);return!0},ec=function(a){Ra(a.pageTypes).then(cc).then(dc).catch(function(a){"sitemap_reinit"!==a&&n.onFireException.emit(Error("Unhandled exception: ".concat(a)),"Site-wide Javascript")})},dc=function(a){m.result.matchedConfig= q(q({},a),{},{listeners:bd(a)});m.result.currentPage=q(q({},m.result.currentPage||{}),{},{source:{pageType:a.name,locale:cd(a)},user:{anonymousId:null},interaction:null,pageView:!0});return a.interaction?Zc(a).then(function(a){m.result.currentPage.interaction=a}):Promise.resolve()},bd=function(a){return(a.listeners||[]).map(function(a){return Va(a)})},cd=function(a){return"function"===typeof a.locale?a.locale():a.locale},fc=function(){for(var a=arguments.length,c=Array(a),d=0;d"+f,e);d[c]=function(){m&&m.disconnect()}})},pageElementVisible:function(f,g){var l=g||0;if("string"!==typeof f||""===f||"number"!==typeof l||0>l||1"+f,e);d[c]=function(){m.disconnect()}})},pageExit:function(f){f=f||0;if("number"!==typeof f||0>f)throw Error("[pageExit] Invalid arguments");return new Promise(function(g){function l(a){clearTimeout(n);10>=a.pageY-window.pageYOffset&&(n=0",e);d[c]=function(){m.off("mousemove",l)}})},pageInactive:function(f){function g(a,d){var e=new Promise(function(e){function f(a){a=a||new Event("pageInactive");c&&!d.isSubscribe?h.unbind(c):l.off("mousemove click scroll keyup keydown",g);e(a)}function g(c){clearTimeout(k);k=setTimeout(f.bind(this,c),a)}var l=y(document),k;g();l.on("mousemove click scroll keyup keydown", g)});e.subscribe=function(f){delete e.subscribe;d.isSubscribe=!0;e.then(function(e){e.disconnect=function(){c?h.unbind(c):d.isDisconnected=!0};f(e);!d.isDisconnected&&g(a,d).subscribe(f)});return e};return e}if("number"!==typeof f||0>=f)throw Error("[pageInactive] Invalid arguments");var l={isDisconnected:!1,isSubscribe:!1};c=a(c,"",e);d[c]=function(){l.isDisconnected=!0};return g(f,l)},pageScroll:function(f){if("number"!==typeof f||0>f||1=f&&(g(a),c?h.unbind(c):k.off("scroll",l))}var k=y(document);k.on("scroll",l);c=a(c,"",e);d[c]=function(){k.off("scroll",l)}})}}}var d={},e=c(null,!0),h=function(){return{bind:function(a){a&&d[a]&&(d[a](),delete d[a]);return c(a)},unbind:function(a){if(!a||"string"!==typeof a||"function"!==typeof d[a])return null;d[a]();delete d[a]},getBindings:function(){return d},clearBindings:function(){for(var a in d)d.hasOwnProperty(a)&& (d[a](),delete d[a])}}}();return Object.assign(e,h)}(),jc=function(){function a(c){var d=this;M(this,a);this.clearRateLimiter=function(){d.sentEvents=[]};this.eventWithinLimitTimeRange=function(a,c,d){return d-c.timef)?(r.info("Event rate limit exceeded. More than ".concat(f," events ")+"sent in ".concat(e,"ms.")),!0):!1};this.checkLimits=function(a,c){return d.checkGlobalLimits(a,c.time)};this.sentEvents=[];this.eventRateLimiterConfig=c}return N(a,[{key:"resetCounters",value:function(){this.globalCounter=0}},{key:"isTriggerLimitExceeded", value:function(a){var c=Date.now();a=q(q({},a),{},{time:c});this.sentEvents.push(a);this.removeOldEvents(c);this.resetCounters();for(c=this.sentEvents.length-1;0<=c;c--)if(this.checkLimits(c,a))return!0;return!1}}])}(),fd=function(a){function c(a){M(this,c);var d=kc(this,c,[a]);d.getTimeRangeMax=function(){return d.eventRateLimiterConfig.perInteractionTimeRange?Math.max(d.eventRateLimiterConfig.globalTimeRange,d.eventRateLimiterConfig.perInteractionTimeRange):d.eventRateLimiterConfig.globalTimeRange}; d.checkInteractionLimits=function(a,c,e){return d.eventRateLimiterConfig.perInteractionLimit&&d.eventRateLimiterConfig.perInteractionTimeRange&&d.eventWithinLimitTimeRange(d.eventRateLimiterConfig.perInteractionTimeRange,d.sentEvents[a],c)&&d.sentEvents[a].name===e&&(d.perEventCounter++,d.perEventCounter>d.eventRateLimiterConfig.perInteractionLimit)?(r.info("Event rate limit exceeded. More than ".concat(d.eventRateLimiterConfig.perInteractionLimit," events ")+"with interaction name of ".concat(e, " sent in ").concat(d.eventRateLimiterConfig.perInteractionTimeRange,"ms.")),!0):!1};d.checkLimits=function(a,c){return d.checkGlobalLimits(a,c.time)||d.checkInteractionLimits(a,c.time,c.name)};return d}lc(c,a);return N(c,[{key:"resetCounters",value:function(){gb(c,"resetCounters",this,3)([]);this.perEventCounter=0}},{key:"isTriggerLimitExceeded",value:function(a){return gb(c,"isTriggerLimitExceeded",this,3)([a])}}])}(jc),Da,Ea,Fa,Ga,$a=function(){var a=0{if(null==e||!1===Object.prototype.hasOwnProperty.call(e,t)||null==e[t])throw new Error(`missing required option "${String(t)}"`)})}function n(e,t){const n=new CustomEvent(e,{detail:t});document.dispatchEvent(n)}async function i(e){return await new Promise((t,n)=>{const i=new XMLHttpRequest;i.onload=()=>t(i),i.onerror=()=>t(i),i.abort=()=>n(new Error("Request aborted")),e(i)})}async function o(e){await new Promise(t=>{setTimeout(t,e)})}function a(e){return 200===(null==e?void 0:e.status)||204===(null==e?void 0:e.status)}function r(){return window.SalesforceInteractions}function s(){const e=r().getAnonymousId();if(null==e||""===e)throw new Error("sessionId is missing");return e}function l(e){var t;return null!==(t=e.deviceId)&&void 0!==t?t:s()}function c(e){var t,n;const r=e.tenantSpecificEndpoint+"/web/v2/authentication",s=null!==(t=e.authenticator.maxAttempts)&&void 0!==t?t:5,c=null!==(n=e.authenticator.retryDelay)&&void 0!==n?n:5;let u=!1,d=!1;return async()=>{if(u)return!0;if(d)return!1;const t=async()=>{const t=await i(t=>{const n=btoa(JSON.stringify({appSourceId:e.authenticator.appSourceId,deviceId:l(e)}));t.open("POST",r),t.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),t.send(`auth=${n}`)});if(401===t.status)throw d=!0,new Error("Unauthorized");return a(t)};for(let e=s;e>0;e--)try{if(u=await t(),u)return!0}finally{!(u||d)&&e>1&&await o(c)}throw d=!0,new Error("No more authentication retries")}}function u(e){return btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,(e,t)=>{const n=t.toString();return String.fromCharCode(parseInt(`0x${n}`,16))}))}var d;let v;!function(e){e.OnBeforeEventSend="dataCloud:onBeforeEventSend",e.OnEventSend="dataCloud:onEventSend"}(d||(d={})),null!=window.SalesforceInteractions&&(window.SalesforceInteractions.DataCloud={CustomEvents:d,profileHasChanged:!1});const m=new Uint8Array(16);function p(){if(!v&&(v="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!v))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return v(m)}const g=[];for(let e=0;e<256;++e)g.push((e+256).toString(16).slice(1));var h={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function f(e,t,n){if(h.randomUUID&&!e)return h.randomUUID();const i=(e=e||{}).random||(e.rng||p)();return i[6]=15&i[6]|64,i[8]=63&i[8]|128,function(e,t=0){return g[e[t+0]]+g[e[t+1]]+g[e[t+2]]+g[e[t+3]]+"-"+g[e[t+4]]+g[e[t+5]]+"-"+g[e[t+6]]+g[e[t+7]]+"-"+g[e[t+8]]+g[e[t+9]]+"-"+g[e[t+10]]+g[e[t+11]]+g[e[t+12]]+g[e[t+13]]+g[e[t+14]]+g[e[t+15]]}(i)}function T(e){return("number"==typeof(null==e?void 0:e.time)?new Date(e.time):new Date).toISOString()}function y(e,t){return{eventId:f(),dateTime:T(e),sessionId:s(),deviceId:l(t)}}function b(t,n){var i;const o=null!==(i=t.consents)&&void 0!==i?i:[];if(0===o.length)return[];const a=[];return o.forEach(i=>{const o=function(t,n,i){try{let o;if(t.status===e.ConsentStatus.OptIn)o="opt-in";else{if(t.status!==e.ConsentStatus.OptOut)return r().log.error(`Consent value should be either "${e.ConsentStatus.OptIn}" or "${e.ConsentStatus.OptOut}"`,n),null;o="opt-out"}return Object.assign(Object.assign({},y(n,i)),{eventType:"consentLog",category:"Engagement",purpose:t.purpose,provider:t.provider,status:o})}catch(e){const t=e instanceof Error?e.message:"Unknown error occurred during consent extraction";return r().log.error(t),null}}(i,t,n);null!=o&&a.push(o)}),a}function E(e){var t,n,i,o,a,r;return{interactionName:null===(t=null==e?void 0:e.interaction)||void 0===t?void 0:t.name,pageView:null==e?void 0:e.pageView,sourceUrl:null===(n=null==e?void 0:e.source)||void 0===n?void 0:n.url,sourceUrlReferrer:null===(i=null==e?void 0:e.source)||void 0===i?void 0:i.urlReferrer,sourceChannel:null===(o=null==e?void 0:e.source)||void 0===o?void 0:o.channel,sourceLocale:null===(a=null==e?void 0:e.source)||void 0===a?void 0:a.locale,sourcePageType:null===(r=null==e?void 0:e.source)||void 0===r?void 0:r.pageType}}const w=/^[a-zA-Z](?!.*__)(?!.*_$)\w{0,79}$/;function I(e,{logInvalid:t=!0}={}){return"string"==typeof e&&w.test(e)?e:(t&&r().log.warn(`[Invalid eventType: "${e}"] Must begin with a letter (a-zA-Z) and can only contain alphanumeric characters and underscores (no spaces.) Also cannot end with or have consecutive underscores. Max 80 characters.`),null)}function O(e){return{eventId:f(),category:e.category,dateTime:e.dateTime,deviceId:e.deviceId,sessionId:e.sessionId,eventType:"",interactionName:e.interactionName}}function x(e){return null!=(null==e?void 0:e.catalogObjectId)&&null!=(null==e?void 0:e.catalogObjectType)&&null!=(null==e?void 0:e.quantity)}function S(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var C,j={exports:{}};var L=function(){if(C)return j.exports;C=1;const e=/[\p{Lu}]/u,t=/[\p{Ll}]/u,n=/^[\p{Lu}](?![\p{Lu}])/gu,i=/([\p{Alpha}\p{N}_]|$)/u,o=/[_.\- ]+/,a=new RegExp("^"+o.source),r=new RegExp(o.source+i.source,"gu"),s=new RegExp("\\d+"+i.source,"gu"),l=(i,o)=>{if("string"!=typeof i&&!Array.isArray(i))throw new TypeError("Expected the input to be `string | string[]`");if(o={pascalCase:!1,preserveConsecutiveUppercase:!1,...o},0===(i=Array.isArray(i)?i.map(e=>e.trim()).filter(e=>e.length).join("-"):i.trim()).length)return"";const l=!1===o.locale?e=>e.toLowerCase():e=>e.toLocaleLowerCase(o.locale),c=!1===o.locale?e=>e.toUpperCase():e=>e.toLocaleUpperCase(o.locale);if(1===i.length)return o.pascalCase?c(i):l(i);return i!==l(i)&&(i=((n,i,o)=>{let a=!1,r=!1,s=!1;for(let l=0;l(n.lastIndex=0,e.replace(n,e=>t(e))))(i,l):l(i),o.pascalCase&&(i=c(i.charAt(0))+i.slice(1)),((e,t)=>(r.lastIndex=0,s.lastIndex=0,e.replace(r,(e,n)=>t(n)).replace(s,e=>t(e))))(i,c)};return j.exports=l,j.exports.default=l,j.exports}(),A=S(L);function k(e,t,n={}){return null==e||("object"==typeof e?Object.keys(e).forEach(i=>k(e[i],A(null!=t?t+"."+i:i),n)):null!=t&&(n[t]=e)),n}function R(e){return t(e,"catalogObjectType","catalogObjectId","quantity"),Object.assign({catalogObjectType:e.catalogObjectType,catalogObjectId:e.catalogObjectId,price:e.price,quantity:e.quantity,currency:e.currency},k(e.attributes,"attribute"))}function P(e,t,n){const i=function(e,t){return Object.assign(Object.assign(Object.assign({},y(e,t)),E(e)),{category:"Engagement",eventType:"cart"})}(e,n);return[i,...D(i,t)]}function D(n,i){const o=[];if(function(t){return t.name===e.CartInteractionName.AddToCart}(i)||function(t){return t.name===e.CartInteractionName.RemoveFromCart}(i)){t(i,"lineItem");const e=M(n,i.lineItem);null!=e&&o.push(e)}else!function(t){return t.name===e.CartInteractionName.ReplaceCart}(i)?new Set(i.lineItems).add(i.lineItem).forEach(e=>{if(x(e)){const t=M(n,e);null!=t&&o.push(t)}}):(t(i,"lineItems"),i.lineItems.forEach(e=>{const t=M(n,e);null!=t&&o.push(t)}));return o}function M(e,t){try{return Object.assign(Object.assign(Object.assign({},O(e)),R(t)),{eventType:"cartItem",cartEventId:e.eventId})}catch(e){const t=e instanceof Error?e.message:"Unknown error occurred during cart event extraction";return r().log.error(t),null}}function N(e,n,i){t(n,"catalogObject");return[$(e,n.catalogObject,i)]}function $(e,n,i){return t(n,"id","type"),Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},y(e,i)),E(e)),k(n.attributes,"attribute")),k(n.relatedCatalogObjects,"relatedCatalogObject")),{category:"Engagement",eventType:"catalog",id:n.id,type:n.type})}function U(e,n,i){t(n,"order");const o=n.order,a=function(e,n,i){return t(n,"id"),Object.assign(Object.assign(Object.assign(Object.assign({},y(e,i)),E(e)),k(n.attributes,"attribute")),{category:"Engagement",eventType:"order",orderId:n.id,orderCurrency:n.currency,orderTotalValue:n.totalValue})}(e,o,i);return[a,...F(a,o)]}function F(e,t){if(null==t.lineItems)return[];const n=[];return t.lineItems.forEach(t=>{const i=function(e,t){try{return Object.assign(Object.assign(Object.assign({},O(e)),R(t)),{eventType:"orderItem",orderEventId:e.eventId})}catch(e){const t=e instanceof Error?e.message:"Unknown error occurred during order event extraction";return r().log.error(t),null}}(e,t);null!=i&&n.push(i)}),n}const H="timeTracking",V=["pageViewId","pingSequence","pageStartTime","lastActivityTime","activeTime","totalActiveTime","threshold"];function q(e){if(!("eventType"in e)||!("name"in e))return!1;const t=e.eventType,n=e.name;return"string"==typeof t&&(t===H||t.endsWith("Time"))&&("timeOnPage"===n||"pageExit"===n)}function B(e,t,n){var i;const o=I(null!==(i=t.eventType)&&void 0!==i?i:t.name);if(null==o)return[];const a=Object.keys(e.interaction).reduce((e,n)=>("name"!==n&&(e[n]=t[n]),e),{});return[Object.assign(Object.assign(Object.assign(Object.assign({},k(a)),y(e,n)),E(e)),{eventType:o,category:"Engagement"})]}function W(e,t,n){return null==(null==t?void 0:t.eventType)?[..._(e,t,n),...z(e,t,n),...J(e,t,n)]:[]}function _(e,t,n){return function(e){return t=null==e?void 0:e.order,null!=(null==t?void 0:t.id);var t}(t)?U(e,t,n):[]}function z(e,t,n){return function(e){return t=null==e?void 0:e.catalogObject,null!=(null==t?void 0:t.id)&&null!=(null==t?void 0:t.type);var t}(t)?N(e,t,n):[]}function J(e,t,n){return function(e){var t;return x(null==e?void 0:e.lineItem)||(null===(t=null==e?void 0:e.lineItems)||void 0===t?void 0:t.some(x))}(t)?P(e,t,n):[]}function K(n,i){var o,a;const r=null==n?void 0:n.interaction;if(null==r)return[];let s=[];t(n.interaction,"name"),s=function(t){return e.OrderInteractionName.Return===t.name||e.OrderInteractionName.Ship===t.name||e.OrderInteractionName.Preorder===t.name||e.OrderInteractionName.Cancel===t.name||e.OrderInteractionName.Exchange===t.name||e.OrderInteractionName.Purchase===t.name||e.OrderInteractionName.Deliver===t.name}(r)?U(n,r,i):function(t){return e.CatalogObjectInteractionName.ViewCatalogObject===t.name||e.CatalogObjectInteractionName.CommentCatalogObject===t.name||e.CatalogObjectInteractionName.FavoriteCatalogObject===t.name||e.CatalogObjectInteractionName.ReviewCatalogObject===t.name||e.CatalogObjectInteractionName.ShareCatalogObject===t.name||e.CatalogObjectInteractionName.QuickViewCatalogObject===t.name||e.CatalogObjectInteractionName.ViewCatalogObjectDetail===t.name}(r)?N(n,r,i):function(t){return e.CartInteractionName.ReplaceCart===t.name||e.CartInteractionName.AddToCart===t.name||e.CartInteractionName.RemoveFromCart===t.name}(r)?P(n,r,i):q(r)?function(e,t,n){if(!q(t))return[];const i=t,o=I(i.eventType);if(null==o)return[];const a=V.reduce((e,t)=>{const n=i[t];return void 0!==n&&(e[t]=n),e},{}),r={};for(const[e,t]of Object.entries(i))void 0!==t&&"name"!==e&&"eventType"!==e&&(V.includes(e)||(r[e]=t));const s=Object.assign(Object.assign({},a),r);return[Object.assign(Object.assign(Object.assign(Object.assign({},k(s)),y(e,n)),E(e)),{eventType:o,category:"Engagement"})]}(n,r,i):function(e,t,n){return[...W(e,t,n),...B(e,t,n)]}(n,r,i);const l=null===(a=null===(o=n.account)||void 0===o?void 0:o.id)||void 0===a?void 0:a.trim();return null!=l&&""!==l&&s.forEach(e=>{e.accountId=l}),s}const Z=["identity","partyIdentification","contactPointAddress","contactPointPhone","contactPointEmail"],G={profileOnlyEventTypes:Z};function Q(e,t){var n,i,o,a;if(!function(e,t){var n,i,o,a,s;const l=null==e?void 0:e.interaction;if(null==l)return!0;const c=null===(i=null!==(n=l.eventType)&&void 0!==n?n:l.name)||void 0===i?void 0:i.toLowerCase();if(!c)return!0;const u=null===(a=null===(o=null==e?void 0:e.user)||void 0===o?void 0:o.attributes)||void 0===a?void 0:a.eventType;return"string"==typeof u&&u.toLowerCase()===c?(r().log.error(`[Invalid sendEvent] The same eventType "${u}" appears in both the interaction block (Engagement) and user.attributes (Profile). This would produce two events with conflicting categories. No events will be sent. Move the profile event to user.attributes only, or use a different eventType for the interaction.`),!1):!t.map(e=>e.toLowerCase()).includes(c)||(r().log.error(`[Invalid sendEvent] The eventType "${null!==(s=l.eventType)&&void 0!==s?s:l.name}" is a profile-only event type and cannot be used in the interaction block. Use user.attributes.eventType instead. No events will be sent.`),!1)}(e,null!==(i=null===(n=t.profileValidation)||void 0===n?void 0:n.profileOnlyEventTypes)&&void 0!==i?i:Z))return[];const s=b(e,t);if(function(e){return e.length>0&&e.every(e=>"opt-out"===e.status)}(s))return s;const c=function(e,t){var n;const i=null===(n=null==e?void 0:e.user)||void 0===n?void 0:n.attributes;if("object"!=typeof i)return[];const o=I(null==i?void 0:i.eventType);if(null==o)throw new Error(`Missing or invalid required "user.attributes.eventType" string in action: ${JSON.stringify(e,null,"\t")}`);return[Object.assign(Object.assign(Object.assign(Object.assign({},y(e,t)),E(e)),i),{eventType:o,category:"Profile"})]}(e,t);return(null===(a=null===(o=r())||void 0===o?void 0:o.DataCloud)||void 0===a?void 0:a.profileHasChanged)&&(0===c.length&&(c.push(Object.assign(Object.assign({},y(e,t)),{category:"Profile",eventType:"identity",isAnonymous:1})),r().log.debug(`Attaching new anonymous identity: ${l(t)}`)),r().DataCloud.profileHasChanged=!1),[...s,...c,...K(e,t)]}function X(e,t){return"boolean"==typeof t?t?1:0:t}const Y="application/json, text/javascript, */*; q=0.01",ee="Rate Limit Telemetry",te="rateLimitTelemetry",ne="blocked";async function ie(e,t,o){const s=function(e,t,n,i){if(!i||0===Object.keys(i).length)return n;const o={time:Date.now(),source:e.source,interaction:{name:ee,eventType:te,[ne]:i}},a=Q(o,t);if(0===a.length)return n;return n.concat(a)}(e,t,Q(e,t),o),l={actionEvent:e,events:s};(null==e?void 0:e.suppressDataCloudSend)&&(l.suppressDataCloudSend=!0);const c=!document.dispatchEvent(new CustomEvent(d.OnBeforeEventSend,{detail:l,cancelable:!0}));if(r().getLoggingLevel()>=4&&r().log.debug(`Events translated for Data Cloud: ${JSON.stringify(s,X,"\t")}`),!l.suppressDataCloudSend&&!(null==e?void 0:e.suppressDataCloudSend)&&s.length>0&&!c){const e=t.tenantSpecificEndpoint+"/web/events/"+t.authenticator.appSourceId,o={events:s},r=JSON.stringify(o,X);n(d.OnEventSend,JSON.parse(r)),await async function(e,t){!function(){if("function"!=typeof window.fetch)return!1;try{return!!new Request("_",{keepalive:!0}).keepalive}catch(e){return!1}}()?await async function(e,t){const n=await i(n=>{const i=encodeURIComponent(u(t));n.open("POST",e,!0),n.setRequestHeader("Accept",Y),n.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),n.send(`event=${i}`)});if(!a(n)){const e=new Error(`Response was not OK: ${n.responseText}`);throw Object.assign(e,{status:n.status,statusText:n.statusText}),e}}(e,t):await async function(e,t){const n=encodeURIComponent(u(t)),i=new Headers;i.append("Accept",Y),i.append("Content-Type","application/x-www-form-urlencoded");const o={method:"POST",headers:i,body:`event=${n}`,credentials:"omit",keepalive:!0},a=await fetch(e,o);if(await a.text(),!a.ok){const e=new Error(`Response was not OK. Type: ${a.type}, status: ${a.status} (${a.statusText})`);throw Object.assign(e,{status:a.status,statusText:a.statusText,type:a.type}),e}}(e,t)}(e,r)}}const oe=1e4,ae=1e3,re=36e5,se={enabled:!0,enableBlockedEventTelemetry:!0,globalLimit:200,globalTimeRange:6e4,perInteractionLimit:60,perInteractionTimeRange:6e4};function le(t,n){var i;const o=null!=n?n:c(t);let a=null;const s=null!==(i=t.rateLimiting)&&void 0!==i?i:se,l=s.enabled,u=s.enableBlockedEventTelemetry;let d={};if(l){const t={globalLimit:s.globalLimit,globalTimeRange:s.globalTimeRange,perInteractionLimit:s.perInteractionLimit,perInteractionTimeRange:s.perInteractionTimeRange};a=new e.InteractionEventRateLimiter(t)}else r().log.info("Rate limiting is disabled. All events will be sent.");return async e=>{const n=e.interaction,i=(null==n?void 0:n.eventType)||(null==n?void 0:n.name)||"unknown";if(a&&a.isTriggerLimitExceeded({name:i})){if(u){const e=i,t=!(e in d);if(d[e]=(d[e]||0)+1,t){const e=Object.keys(d);if(e.length>100){const t=e[0];delete d[t]}}}return void r().log.warn(`Event rate limit exceeded for interaction "${i}". Event dropped.`)}if(await o()){let n;u&&Object.keys(d).length>0&&(n=Object.assign({},d),d={}),await ie(e,t,n)}}}function ce(){return r().getConsents().findIndex(t=>t.consent.status===e.ConsentStatus.OptIn)>=0}const ue={enabled:!1,activityTimeoutMillis:5e3,minimumActivityTimeToRegister:300,maxSessionDurationMillis:36e5,eventTypes:["catalog"],thresholds:[{label:"LOW_INTEREST",threshold:3e4},{label:"HIGH_INTEREST",threshold:6e4}],sendPageExitWithoutThreshold:!1,maxEventsPerSession:20};class de{getEffectiveConfig(){return this.config}getTotalActiveTime(){return this.snapshot.totalActiveTime}constructor(e){this.intervalId=null,this.lastFlushedTotalActiveTime=0,this.pageHidden=!1,this.pingSequence=0,this.capturedContextEvent=null,this.capturedEventType=null,this.activityListeners=[],this.nextThresholdIndex=0,this.hasSentInitialThreshold=!1,this.onPageHideHandler=null,this.options=e,this.config=this.withDefaults(e.timeTracking);const t=Date.now();this.snapshot={pageStartTime:t,lastActivityTime:t,totalActiveTime:0},this.pageViewId=f()}start(){this.config.enabled&&(this.bindActivityListeners(),this.bindUnloadListeners(),this.intervalId=window.setInterval(()=>this.onTick(),1e3),this.trace("TimeTracking: started",{intervalMs:1e3,activityTimeout:this.config.activityTimeoutMillis}))}stop(){null!=this.intervalId&&(window.clearInterval(this.intervalId),this.intervalId=null),this.unbindActivityListeners(),this.handlePageExit(),this.unbindUnloadListeners(),this.trace("TimeTracking: stopped")}observeOutgoingAction(e,t=[]){try{const n=null==e?void 0:e.interaction;if(this.isTimeTrackingEvent(n))return;if(this.capturedContextEvent)return;for(const e of this.config.eventTypes){const n=t.find(t=>t.eventType===e);if(n)return void this.captureContextEvent(n)}}catch(e){this.trace("TimeTracking: error observing action",e)}}isTimeTrackingEvent(e){const t=null==e?void 0:e.eventType,n=null==e?void 0:e.name;return"string"==typeof t&&t.trim().length>0&&(t===H||t.endsWith("Time"))&&("timeOnPage"===n||"pageExit"===n)}captureContextEvent(e){const t=Object.assign({},e);this.capturedEventType=e.eventType;if(["category","dateTime","deviceId","eventId","eventType","sessionId","interactionName","pageView","sourceChannel","sourceLocale","sourcePageType","sourceUrl","sourceUrlReferrer"].forEach(e=>{delete t[e]}),e.eventType&&e.eventId){const n=`${e.eventType}EventId`;t[n]=e.eventId}this.capturedContextEvent=t,this.trace("TimeTracking: captured context",this.capturedContextEvent)}onTick(){const e=Date.now();if(e-this.snapshot.pageStartTime>this.config.maxSessionDurationMillis)return void this.resetSession(e,"max duration exceeded");const t=e-this.snapshot.lastActivityTime,n=t<=this.config.activityTimeoutMillis;if(this.trace("TimeTracking: tick",{sinceLast:t,isActive:n,totalActiveTime:this.snapshot.totalActiveTime}),n)for(this.addActiveTime(e);this.nextThresholdIndex=this.config.thresholds[this.nextThresholdIndex].threshold;){const e=this.config.thresholds[this.nextThresholdIndex];this.trace("TimeTracking: threshold reached",e),this.sendTimeTrackingEvent("timeOnPage",e.label),this.nextThresholdIndex++}else this.snapshot.activeSince=void 0}resetSession(e,t){const n=e-this.snapshot.pageStartTime;this.flushActiveTime(),this.sendTimeTrackingEvent("timeOnPage","pageExit"),this.snapshot.pageStartTime=e,this.snapshot.totalActiveTime=0,this.lastFlushedTotalActiveTime=0,this.pageViewId=f(),this.pingSequence=0,this.nextThresholdIndex=0,this.hasSentInitialThreshold=!1,this.capturedContextEvent=null,this.capturedEventType=null,this.trace(`TimeTracking: session reset (${t})`,{sessionDuration:n,maxDuration:this.config.maxSessionDurationMillis})}bindActivityListeners(){const e=()=>{const e=Date.now();null==this.snapshot.activeSince&&(this.snapshot.activeSince=e,this.trace("TimeTracking: activity resumed")),this.snapshot.lastActivityTime=e};[{element:document,event:"mousemove",handler:e,options:{passive:!0}},{element:document,event:"click",handler:e,options:{passive:!0}},{element:document,event:"scroll",handler:e,options:{passive:!0}},{element:document,event:"wheel",handler:e,options:{passive:!0}},{element:document,event:"mousedown",handler:e,options:{passive:!0}},{element:document,event:"keydown",handler:e,options:{passive:!0}},{element:document,event:"touchstart",handler:e,options:{passive:!0}},{element:document,event:"touchmove",handler:e,options:{passive:!0}},{element:window,event:"focus",handler:e,options:{passive:!0}},{element:window,event:"blur",handler:()=>{this.trace("TimeTracking: blur -> flush"),this.flushActiveTime(),this.markFlushPoint()},options:{passive:!0}},{element:document,event:"visibilitychange",handler:()=>{if("hidden"===document.visibilityState)this.trace("TimeTracking: visibility hidden -> flush"),this.flushActiveTime(),this.markFlushPoint();else if("visible"===document.visibilityState){const e=Date.now();this.snapshot.activeSince=e,this.snapshot.lastActivityTime=e,this.trace("TimeTracking: visibility visible -> resume")}},options:{passive:!0}},{element:document,event:d.OnBeforeEventSend,handler:e=>{const t=e,{actionEvent:n,events:i}=t.detail||{};n&&this.observeOutgoingAction(n,i)}}].forEach(({element:e,event:t,handler:n,options:i})=>{void 0!==i?e.addEventListener(t,n,i):e.addEventListener(t,n),this.activityListeners.push({element:e,event:t,handler:n})})}unbindActivityListeners(){this.activityListeners.forEach(({element:e,event:t,handler:n})=>{e.removeEventListener(t,n)}),this.activityListeners=[]}bindUnloadListeners(){this.onPageHideHandler=()=>this.handlePageExit(),window.addEventListener("pagehide",this.onPageHideHandler)}unbindUnloadListeners(){this.onPageHideHandler&&(window.removeEventListener("pagehide",this.onPageHideHandler),this.onPageHideHandler=null)}handlePageExit(){this.pageHidden||(this.pageHidden=!0,this.capturedContextEvent?this.hasSentInitialThreshold||this.config.sendPageExitWithoutThreshold?(this.flushActiveTime(),this.trace("TimeTracking: pageExit",{totalActiveTime:this.snapshot.totalActiveTime}),this.sendTimeTrackingEvent("pageExit","pageExit")):this.trace("TimeTracking: pageExit skipped (no threshold sent and sendPageExitWithoutThreshold is false)"):this.trace("TimeTracking: pageExit skipped (no context)"))}flushActiveTime(){const e=Date.now();this.addActiveTime(e),this.snapshot.activeSince=void 0,this.trace("TimeTracking: flushed",{totalActiveTime:this.snapshot.totalActiveTime})}markFlushPoint(){this.lastFlushedTotalActiveTime=this.snapshot.totalActiveTime}addActiveTime(e){var t;if(null==this.snapshot.activeSince)return;const n=e-this.snapshot.activeSince,i=Math.max(3e5,this.config.activityTimeoutMillis);if(n<0||n>i)return r().log.debug("TimeTracking: rejected delta",{delta:n,reason:n<0?"negative":"excessive",maxActivityDelta:i}),void(this.snapshot.activeSince=e);n>=(null!==(t=this.config.minimumActivityTimeToRegister)&&void 0!==t?t:0)&&(this.snapshot.totalActiveTime+=n,this.snapshot.activeSince=e)}buildTimeTrackingInteraction(e,t,n,i){const o={name:e,eventType:`${this.capturedEventType}Time`,pageViewId:this.pageViewId,pingSequence:++this.pingSequence,pageStartTime:new Date(this.snapshot.pageStartTime).toISOString(),lastActivityTime:new Date(this.snapshot.lastActivityTime).toISOString(),activeTime:t,totalActiveTime:n,threshold:i};if(this.capturedContextEvent)for(const e in this.capturedContextEvent)Object.prototype.hasOwnProperty.call(this.capturedContextEvent,e)&&(Object.prototype.hasOwnProperty.call(o,e)?r().log.warn(`TimeTracking: context field collision '${e}' - ignoring context value`):o[e]=this.capturedContextEvent[e]);return o}sendTimeTrackingEvent(t,i){var o;if(!this.capturedContextEvent)return;if(this.pingSequence>=this.config.maxEventsPerSession)return void r().log.warn("TimeTracking: max events limit reached, skipping send",{limit:this.config.maxEventsPerSession,sent:this.pingSequence});"timeOnPage"===t&&(this.hasSentInitialThreshold=!0);const a=Date.now(),s=this.snapshot.totalActiveTime,l=Math.max(0,s-this.lastFlushedTotalActiveTime);if("timeOnPage"===t&&l<=0)return void this.trace("TimeTracking: suppress timeOnPage (no new active time)",{deltaSinceFlush:l,totalActiveTime:s});const c=this.buildTimeTrackingInteraction(t,l,s,i),d={time:a,source:{url:null===(o=window.location)||void 0===o?void 0:o.href,urlReferrer:document.referrer},interaction:c};if("pageExit"===t&&"undefined"!=typeof navigator&&"function"==typeof navigator.sendBeacon)try{if(!ce())return void this.trace("TimeTracking: pageExit beacon skipped (no consent)");const t=Q(d,this.options);if(t.length>0){const i=JSON.stringify({events:t},X),o=function(e,t){try{if("undefined"==typeof navigator||"function"!=typeof navigator.sendBeacon)return!1;const n=e.tenantSpecificEndpoint+"/web/events/"+e.authenticator.appSourceId,i=encodeURIComponent(u(t)),o=new Blob([`event=${i}`],{type:"application/x-www-form-urlencoded"});return o.size>65536&&r().log.warn(`navigator.sendBeacon payload too large (${o.size} bytes). Limit is 64KB. Beacon will likely fail.`),navigator.sendBeacon(n,o)}catch(e){return r().log.warn("Beacon send failed:",e),!1}}(this.options,i);if(this.trace("TimeTracking: pageExit beacon attempt",{events:t.length,queued:o}),o){this.markFlushPoint();return d.suppressDataCloudSend=!0,void n(e.CustomEvents.OnEventSend,{actionEvent:d})}}}catch(e){}n(e.CustomEvents.OnEventSend,{actionEvent:d}),this.markFlushPoint()}withDefaults(e){var t,n,i,o,a,r,s,l;if(void 0===e)return ue;const c=e,u=[...null!==(t=c.thresholds)&&void 0!==t?t:ue.thresholds].sort((e,t)=>e.threshold-t.threshold),d=null!==(n=c.maxEventsPerSession)&&void 0!==n?n:ue.maxEventsPerSession;return this.validateConfiguration(u,d),{enabled:null!==(i=c.enabled)&&void 0!==i?i:ue.enabled,activityTimeoutMillis:Math.max(1e3,null!==(o=c.activityTimeoutMillis)&&void 0!==o?o:ue.activityTimeoutMillis),minimumActivityTimeToRegister:null!==(a=c.minimumActivityTimeToRegister)&&void 0!==a?a:ue.minimumActivityTimeToRegister,maxSessionDurationMillis:null!==(r=c.maxSessionDurationMillis)&&void 0!==r?r:ue.maxSessionDurationMillis,eventTypes:null!==(s=c.eventTypes)&&void 0!==s?s:ue.eventTypes,thresholds:u,sendPageExitWithoutThreshold:null!==(l=c.sendPageExitWithoutThreshold)&&void 0!==l?l:ue.sendPageExitWithoutThreshold,maxEventsPerSession:d}}validateConfiguration(e,t){try{const n=e.length+1;tr(),window.getSalesforceInteractionsName=()=>"SalesforceInteractions",function(i){t(i,"tenantSpecificEndpoint","authenticator"),t(i.authenticator,"appSourceId"),i.tenantSpecificEndpoint=function(e,t=""){const n="https://";try{e=e.trim(),/^.+:\/\/.*/.test(e)||(e=n+e),e=n+new URL(e).hostname}catch(n){if(e="",""!==t)throw new Error(t)}return e}(i.tenantSpecificEndpoint,"tenantSpecificEndpoint is invalid");let o=Object.assign(Object.assign(Object.assign(Object.assign({},i),void 0===i.timeTracking&&{timeTracking:ue}),void 0===i.rateLimiting&&{rateLimiting:se}),void 0===i.profileValidation&&{profileValidation:G});const a=c(o);let s=le(o,a),l=null;try{l=new de(o),l.start(),window.addEventListener("pagehide",()=>{try{null==l||l.stop()}catch(e){}}),ve(e.CustomEvents.OnShutDown,async()=>{try{null==l||l.stop()}catch(e){}l=null}),r().DataCloud.stopTimeTracking=()=>{try{null==l||l.stop()}catch(e){r().log.error("Error stopping time tracking service via global method",e)}}}catch(e){r().log.error("Failed to initialize time tracking service",e)}function u(e,t){const n=function(e){if(!e)return;const t=r().log,n=e,i=[],o={};if("enabled"in n&&("boolean"!=typeof n.enabled?i.push('"enabled" must be a boolean, got '+typeof n.enabled):o.enabled=n.enabled),"activityTimeoutMillis"in n&&("number"!=typeof n.activityTimeoutMillis||!Number.isFinite(n.activityTimeoutMillis)||n.activityTimeoutMillis<0?i.push('"activityTimeoutMillis" must be a non-negative number, got '+typeof n.activityTimeoutMillis):o.activityTimeoutMillis=Math.max(1e3,n.activityTimeoutMillis)),"minimumActivityTimeToRegister"in n&&("number"!=typeof n.minimumActivityTimeToRegister||!Number.isFinite(n.minimumActivityTimeToRegister)||n.minimumActivityTimeToRegister<0?i.push('"minimumActivityTimeToRegister" must be a non-negative number, got '+typeof n.minimumActivityTimeToRegister):o.minimumActivityTimeToRegister=n.minimumActivityTimeToRegister),"maxSessionDurationMillis"in n&&("number"!=typeof n.maxSessionDurationMillis||!Number.isFinite(n.maxSessionDurationMillis)||n.maxSessionDurationMillis<0?i.push('"maxSessionDurationMillis" must be a non-negative number, got '+typeof n.maxSessionDurationMillis):o.maxSessionDurationMillis=n.maxSessionDurationMillis),"eventTypes"in n)if(Array.isArray(n.eventTypes)){const e=[],t=[];for(const i of n.eventTypes)if("string"!=typeof i)e.push(String(i));else{const n=I(i);null===n?e.push(i):t.push(n)}e.length>0?i.push(`"eventTypes" contains invalid entries: ${e.join(", ")}`):o.eventTypes=t}else i.push('"eventTypes" must be an array of strings, got '+typeof n.eventTypes);if("thresholds"in n)if(Array.isArray(n.thresholds)){const e=[],t=[],a=new Set,r=new Set;for(let i=0;i 0)`);continue}const c=s.trim();a.has(c)?e.push(`entry at index ${i} (duplicate label "${c}")`):r.has(l)?e.push(`entry at index ${i} (duplicate threshold ${l})`):(a.add(c),r.add(l),t.push({label:c,threshold:l}))}e.length>0?i.push(`"thresholds" contains invalid entries: ${e.join("; ")}`):t.length>0&&(t.sort((e,t)=>e.threshold-t.threshold),o.thresholds=t)}else i.push('"thresholds" must be an array, got '+typeof n.thresholds);if("sendPageExitWithoutThreshold"in n&&("boolean"!=typeof n.sendPageExitWithoutThreshold?i.push('"sendPageExitWithoutThreshold" must be a boolean, got '+typeof n.sendPageExitWithoutThreshold):o.sendPageExitWithoutThreshold=n.sendPageExitWithoutThreshold),"maxEventsPerSession"in n&&("number"!=typeof n.maxEventsPerSession||!Number.isFinite(n.maxEventsPerSession)||n.maxEventsPerSession<0?i.push('"maxEventsPerSession" must be a non-negative number, got '+typeof n.maxEventsPerSession):o.maxEventsPerSession=n.maxEventsPerSession),!(i.length>0))return o;t.error("TimeTracking: Invalid configuration provided. All values must have correct types. Keeping existing configuration.",{errors:i,providedConfig:n})}(t);return void 0===n?e:Object.assign(Object.assign({},e),n)}function d(e,t){const n=function(e){if(!e)return;const t=r().log,n=[],i={};if(void 0!==e.enabled&&("boolean"!=typeof e.enabled?n.push('"enabled" must be a boolean, got '+typeof e.enabled):i.enabled=e.enabled),void 0!==e.enableBlockedEventTelemetry&&("boolean"!=typeof e.enableBlockedEventTelemetry?n.push('"enableBlockedEventTelemetry" must be a boolean, got '+typeof e.enableBlockedEventTelemetry):i.enableBlockedEventTelemetry=e.enableBlockedEventTelemetry),void 0!==e.globalLimit&&("number"!=typeof e.globalLimit||!Number.isFinite(e.globalLimit)||e.globalLimit<1||e.globalLimit>oe?n.push('"globalLimit" must be a number between 1 and 10000, got '+typeof e.globalLimit):i.globalLimit=Math.floor(e.globalLimit)),void 0!==e.globalTimeRange&&("number"!=typeof e.globalTimeRange||!Number.isFinite(e.globalTimeRange)||e.globalTimeRangere?n.push('"globalTimeRange" must be a number between 1000 and 3600000, got '+typeof e.globalTimeRange):i.globalTimeRange=Math.floor(e.globalTimeRange)),void 0!==e.perInteractionLimit&&("number"!=typeof e.perInteractionLimit||!Number.isFinite(e.perInteractionLimit)||e.perInteractionLimit<1||e.perInteractionLimit>oe?n.push('"perInteractionLimit" must be a number between 1 and 10000, got '+typeof e.perInteractionLimit):i.perInteractionLimit=Math.floor(e.perInteractionLimit)),void 0!==e.perInteractionTimeRange&&("number"!=typeof e.perInteractionTimeRange||!Number.isFinite(e.perInteractionTimeRange)||e.perInteractionTimeRangere?n.push('"perInteractionTimeRange" must be a number between 1000 and 3600000, got '+typeof e.perInteractionTimeRange):i.perInteractionTimeRange=Math.floor(e.perInteractionTimeRange)),!(n.length>0))return void 0!==i.perInteractionLimit&&void 0!==i.globalLimit&&i.perInteractionLimit>i.globalLimit&&t.warn(`RateLimiting: perInteractionLimit (${i.perInteractionLimit}) exceeds globalLimit (${i.globalLimit}). This may not behave as expected.`,{perInteractionLimit:i.perInteractionLimit,globalLimit:i.globalLimit}),void 0!==i.perInteractionTimeRange&&void 0!==i.globalTimeRange&&i.perInteractionTimeRange>i.globalTimeRange&&t.warn(`RateLimiting: perInteractionTimeRange (${i.perInteractionTimeRange}ms) exceeds globalTimeRange (${i.globalTimeRange}ms). This may not behave as expected.`,{perInteractionTimeRange:i.perInteractionTimeRange,globalTimeRange:i.globalTimeRange}),i;t.error("RateLimiting: Invalid configuration provided. All values must have correct types and be within bounds. Keeping existing configuration.",{errors:n,providedConfig:e})}(t);return void 0===n?e:Object.assign(Object.assign({},e),n)}function v(e,t){const n=function(e){if(!e)return;const t=r().log,n=e,i=[],o={};if("profileOnlyEventTypes"in n)if(Array.isArray(n.profileOnlyEventTypes)){const e=[],t=[];for(const i of n.profileOnlyEventTypes)if("string"!=typeof i)e.push(String(i));else{const n=I(i,{logInvalid:!1});null===n?e.push(i):t.push(n)}e.length>0?i.push(`"profileOnlyEventTypes" contains invalid entries: ${e.join(", ")}`):o.profileOnlyEventTypes=t}else i.push('"profileOnlyEventTypes" must be an array of strings, got '+typeof n.profileOnlyEventTypes);if(!(i.length>0))return o;t.error("ProfileValidation: Invalid configuration provided. All values must have correct types. Keeping existing configuration.",{errors:i,providedConfig:n})}(t);return void 0===n?e:Object.assign(Object.assign({},e),n)}function m(){try{s=le(o,a)}catch(e){r().log.error("Failed to reconfigure rate limiting",e)}}function p(e){var t,n,i;const a=null==e?void 0:e.dataCloud;let s,c,p;if(void 0!==(null==a?void 0:a.timeTracking)){s=u(null!==(t=o.timeTracking)&&void 0!==t?t:ue,a.timeTracking)}if(void 0!==(null==a?void 0:a.rateLimiting)){c=d(null!==(n=o.rateLimiting)&&void 0!==n?n:se,a.rateLimiting)}if(void 0!==(null==a?void 0:a.profileValidation)){p=v(null!==(i=o.profileValidation)&&void 0!==i?i:G,a.profileValidation)}void 0===s&&void 0===c&&void 0===p||(o=Object.assign(Object.assign(Object.assign(Object.assign({},o),void 0!==s&&{timeTracking:s}),void 0!==c&&{rateLimiting:c}),void 0!==p&&{profileValidation:p})),e.dataCloud=Object.assign(Object.assign(Object.assign(Object.assign({},o),void 0!==s&&{timeTracking:s}),void 0!==c&&{rateLimiting:c}),void 0!==p&&{profileValidation:p}),void 0!==s&&function(){const e=l;try{null==l||l.stop(),l=new de(o),l.start()}catch(t){l=e,r().log.error("Failed to reconfigure time tracking service",t)}}(),void 0!==c&&m(),void 0!==p&&void 0===c&&m()}ve(e.CustomEvents.OnBeforeInit,async e=>{void 0!==(null==e?void 0:e.detail.sdkConfig)&&p(e.detail.sdkConfig)}),ve(e.CustomEvents.OnSetAnonymousId,async e=>{const{newAnonymousId:t,previousAnonymousId:n}=e.detail;"previousAnonymousId"in e.detail&&"newAnonymousId"in e.detail&&t!==n&&(r().DataCloud.profileHasChanged=!0,r().log.debug(`deviceId has changed from "${String(n)}" to "${String(t)}"`))}),ve(e.CustomEvents.OnEventSend,async t=>{try{const n=t.detail.actionEvent;ce()||function(t){var n;return(null===(n=null==t?void 0:t.interaction)||void 0===n?void 0:n.name)===e.MetadataUpdateInteractionName.MetadataUpdate&&Array.isArray(t.consents)&&t.consents.some(t=>t.status===e.ConsentStatus.OptOut)}(n)?await s(n):r().log.debug("event not sent to CDP because consent was not given")}catch(t){const i=t instanceof Error?t.message:"Unknown error occurred during event send";r().log.error(i),n(e.CustomEvents.OnException,{error:t})}})}}(SalesforceInteractions); try { cdpEventReceiver({ tenantSpecificEndpoint: "https://gm3w8yrzm02d1mlfg0ytgzjrgr.c360a.salesforce.com", authenticator: { appSourceId: "d88074bf-0922-4358-9be8-e3dbe7d63472" } }); } catch (e) { console.error("[Salesforce Data Cloud] Error initializing Web SDK:", e); } })(); // SITEMAP AND INIT try { (function () { })() } catch (e) { console.error("[Salesforce Data Cloud] Error loading sitemap:", e); }