@mparticle/web-sdk 3.25.0 → 3.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/mparticle.common.js +1 -1
- package/dist/mparticle.esm.js +1 -1
- package/dist/mparticle.js +44 -18
- package/dist/types/src/buttonTracking/checkoutIntent.d.ts +1 -0
- package/dist/types/src/roktManager.d.ts +1 -0
- package/package.json +1 -1
- package/src/buttonTracking/buttonTracker.ts +19 -7
- package/src/buttonTracking/checkoutIntent.ts +14 -8
- package/src/roktManager.ts +12 -3
package/dist/mparticle.common.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"undefined"!=typeof globalThis&&(globalThis.regeneratorRuntime=void 0);var e={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encode:function(e){try{if(window.btoa&&window.atob)return window.btoa(unescape(encodeURIComponent(e)))}catch(e){console.error("Error encoding cookie values into Base64:"+e)}return this._encode(e)},_encode:function(n){var r,i,o,s,a,u,c,l="",d=0;for(n=t.encode(n);d<n.length;)s=(r=n.charCodeAt(d++))>>2,a=(3&r)<<4|(i=n.charCodeAt(d++))>>4,u=(15&i)<<2|(o=n.charCodeAt(d++))>>6,c=63&o,isNaN(i)?u=c=64:isNaN(o)&&(c=64),l=l+e._keyStr.charAt(s)+e._keyStr.charAt(a)+e._keyStr.charAt(u)+e._keyStr.charAt(c);return l},decode:function(t){try{if(window.btoa&&window.atob)return decodeURIComponent(escape(window.atob(t)))}catch(e){}return e._decode(t)},_decode:function(n){var r,i,o,s,a,u,c="",l=0;for(n=n.replace(/[^A-Za-z0-9\+\/\=]/g,"");l<n.length;)r=e._keyStr.indexOf(n.charAt(l++))<<2|(s=e._keyStr.indexOf(n.charAt(l++)))>>4,i=(15&s)<<4|(a=e._keyStr.indexOf(n.charAt(l++)))>>2,o=(3&a)<<6|(u=e._keyStr.indexOf(n.charAt(l++))),c+=String.fromCharCode(r),64!==a&&(c+=String.fromCharCode(i)),64!==u&&(c+=String.fromCharCode(o));return c=t.decode(c)}},t={encode:function(e){for(var t="",n=0;n<e.length;n++){var r=e.charCodeAt(n);r<128?t+=String.fromCharCode(r):r>127&&r<2048?(t+=String.fromCharCode(r>>6|192),t+=String.fromCharCode(63&r|128)):(t+=String.fromCharCode(r>>12|224),t+=String.fromCharCode(r>>6&63|128),t+=String.fromCharCode(63&r|128))}return t},decode:function(e){for(var t="",n=0,r=0,i=0,o=0;n<e.length;)(r=e.charCodeAt(n))<128?(t+=String.fromCharCode(r),n++):r>191&&r<224?(i=e.charCodeAt(n+1),t+=String.fromCharCode((31&r)<<6|63&i),n+=2):(i=e.charCodeAt(n+1),o=e.charCodeAt(n+2),t+=String.fromCharCode((15&r)<<12|(63&i)<<6|63&o),n+=3);return t}},n={forEach:function(e,t){var n,r;if(null==this)throw new TypeError(" this is null or not defined");var i=Object(this),o=i.length>>>0;if("function"!=typeof e)throw new TypeError(e+" is not a function");for(arguments.length>1&&(n=t),r=0;r<o;){var s=void 0;r in i&&(s=i[r],e.call(n,s,r,i)),r++}},map:function(e,t){var n,r,i;if(null===this)throw new TypeError(" this is null or not defined");var o=Object(this),s=o.length>>>0;if("function"!=typeof e)throw new TypeError(e+" is not a function");for(arguments.length>1&&(n=t),r=new Array(s),i=0;i<s;){var a=void 0,u=void 0;i in o&&(a=o[i],u=e.call(n,a,i,o),r[i]=u),i++}return r},filter:function(e){if(null==this)throw new TypeError;var t=Object(this),n=t.length>>>0;if("function"!=typeof e)throw new TypeError;for(var r=[],i=arguments.length>=2?arguments[1]:void 0,o=0;o<n;o++)if(o in t){var s=t[o];e.call(i,s,o,t)&&r.push(s)}return r},isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},Base64:e},r={sdkVersion:"3.25.0",sdkVendor:"mparticle",platform:"web",Messages:{DeprecationMessages:{MethodHasBeenDeprecated:"has been deprecated.",MethodMarkedForDeprecationPostfix:"is a deprecated method and will be removed in future releases.",AlternativeMethodPrefix:"Please use the alternate method:"},ErrorMessages:{NoToken:"A token must be specified.",EventNameInvalidType:"Event name must be a valid string value.",EventDataInvalidType:"Event data must be a valid object hash.",LoggingDisabled:"Event logging is currently disabled.",CookieParseError:"Could not parse cookie",EventEmpty:"Event object is null or undefined, cancelling send",APIRequestEmpty:"APIRequest is null or undefined, cancelling send",NoEventType:"Event type must be specified.",TransactionIdRequired:"Transaction ID is required",TransactionRequired:"A transaction attributes object is required",PromotionIdRequired:"Promotion ID is required",BadAttribute:"Attribute value cannot be object or array",BadKey:"Key value cannot be object or array",BadLogPurchase:"Transaction attributes and a product are both required to log a purchase, https://docs.mparticle.com/?javascript#measuring-transactions",AudienceAPINotEnabled:"Your workspace is not enabled to retrieve user audiences."},InformationMessages:{CookieSearch:"Searching for cookie",CookieFound:"Cookie found, parsing values",CookieNotFound:"Cookies not found",CookieSet:"Setting cookie",CookieSync:"Performing cookie sync",SendBegin:"Starting to send event",SendIdentityBegin:"Starting to send event to identity server",SendWindowsPhone:"Sending event to Windows Phone container",SendIOS:"Calling iOS path: ",SendAndroid:"Calling Android JS interface method: ",SendHttp:"Sending event to mParticle HTTP service",SendAliasHttp:"Sending alias request to mParticle HTTP service",SendIdentityHttp:"Sending event to mParticle HTTP service",StartingNewSession:"Starting new Session",StartingLogEvent:"Starting to log event",StartingLogOptOut:"Starting to log user opt in/out",StartingEndSession:"Starting to end session",StartingInitialization:"Starting to initialize",StartingLogCommerceEvent:"Starting to log commerce event",StartingAliasRequest:"Starting to Alias MPIDs",LoadingConfig:"Loading configuration options",AbandonLogEvent:"Cannot log event, logging disabled or developer token not set",AbandonAliasUsers:"Cannot Alias Users, logging disabled or developer token not set",AbandonStartSession:"Cannot start session, logging disabled or developer token not set",AbandonEndSession:"Cannot end session, logging disabled or developer token not set",NoSessionToEnd:"Cannot end session, no active session found"},ValidationMessages:{ModifyIdentityRequestUserIdentitiesPresent:"identityRequests to modify require userIdentities to be present. Request not sent to server. Please fix and try again",IdentityRequesetInvalidKey:"There is an invalid key on your identityRequest object. It can only contain a `userIdentities` object and a `onUserAlias` function. Request not sent to server. Please fix and try again.",OnUserAliasType:"The onUserAlias value must be a function.",UserIdentities:"The userIdentities key must be an object with keys of identityTypes and values of strings. Request not sent to server. Please fix and try again.",UserIdentitiesInvalidKey:"There is an invalid identity key on your `userIdentities` object within the identityRequest. Request not sent to server. Please fix and try again.",UserIdentitiesInvalidValues:"All user identity values must be strings or null. Request not sent to server. Please fix and try again.",AliasMissingMpid:"Alias Request must contain both a destinationMpid and a sourceMpid",AliasNonUniqueMpid:"Alias Request's destinationMpid and sourceMpid must be unique",AliasMissingTime:"Alias Request must have both a startTime and an endTime",AliasStartBeforeEndTime:"Alias Request's endTime must be later than its startTime"}},NativeSdkPaths:{LogEvent:"logEvent",SetUserTag:"setUserTag",RemoveUserTag:"removeUserTag",SetUserAttribute:"setUserAttribute",RemoveUserAttribute:"removeUserAttribute",SetSessionAttribute:"setSessionAttribute",LogOut:"logOut",SetUserAttributeList:"setUserAttributeList",RemoveAllUserAttributes:"removeAllUserAttributes",GetUserAttributesLists:"getUserAttributesLists",GetAllUserAttributes:"getAllUserAttributes",Identify:"identify",Logout:"logout",Login:"login",Modify:"modify",Alias:"aliasUsers",Upload:"upload"},StorageNames:{localStorageName:"mprtcl-api",localStorageNameV3:"mprtcl-v3",cookieName:"mprtcl-api",cookieNameV2:"mprtcl-v2",cookieNameV3:"mprtcl-v3",localStorageNameV4:"mprtcl-v4",cookieNameV4:"mprtcl-v4",currentStorageName:"mprtcl-v4"},DefaultConfig:{cookieDomain:null,cookieExpiration:365,logLevel:null,timeout:300,sessionTimeout:30,forwarderStatsTimeout:5e3,integrationDelayTimeout:5e3,maxCookieSize:3e3,aliasMaxWindow:90,uploadInterval:0},DefaultBaseUrls:{v1SecureServiceUrl:"jssdks.mparticle.com/v1/JS/",v2SecureServiceUrl:"jssdks.mparticle.com/v2/JS/",v3SecureServiceUrl:"jssdks.mparticle.com/v3/JS/",configUrl:"jssdkcdns.mparticle.com/JS/v2/",identityUrl:"identity.mparticle.com/v1/",aliasUrl:"jssdks.mparticle.com/v1/identity/",userAudienceUrl:"nativesdks.mparticle.com/v1/"},CNAMEUrlPaths:{v1SecureServiceUrl:"/webevents/v1/JS/",v2SecureServiceUrl:"/webevents/v2/JS/",v3SecureServiceUrl:"/webevents/v3/JS/",configUrl:"/tags/JS/v2/",identityUrl:"/identity/v1/",aliasUrl:"/webevents/v1/identity/"},Base64CookieKeys:{csm:1,sa:1,ss:1,lsa:1,ua:1,ui:1,csd:1,ia:1,con:1},SDKv2NonMPIDCookieKeys:{gs:1,cu:1,l:1,globalSettings:1,currentUserMPID:1},HTTPCodes:{noHttpCoverage:-1,activeIdentityRequest:-2,activeSession:-3,validationIssue:-4,nativeIdentityRequest:-5,loggingDisabledOrMissingAPIKey:-6,tooManyRequests:429},FeatureFlags:{ReportBatching:"reportBatching",EventBatchingIntervalMillis:"eventBatchingIntervalMillis",OfflineStorage:"offlineStorage",DirectUrlRouting:"directURLRouting",CacheIdentity:"cacheIdentity",AudienceAPI:"audienceAPI",CaptureIntegrationSpecificIds:"captureIntegrationSpecificIds",CaptureIntegrationSpecificIdsV2:"captureIntegrationSpecificIds.V2",AstBackgroundEvents:"astBackgroundEvents",AutoLogPageView:"autoLogPageView",AutoButtonTracking:"autoButtonTracking",AutoLinkTracking:"autoLinkTracking"},DefaultInstance:"default_instance",CCPAPurpose:"data_sale_opt_out",IdentityMethods:{Modify:"modify",Logout:"logout",Login:"login",Identify:"identify"},Environment:{Development:"development",Production:"production"},CaptureIntegrationSpecificIdsV2Modes:{All:"all",None:"none",RoktOnly:"roktonly"},Rokt:{LauncherInstanceGuidKey:"__rokt_li_guid__"}},i="$NoTargeting",o=200,s=202,a=400,u=500;function c(e){return c="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},c(e)}var l=function(e,t){return l=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},l(e,t)};function d(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}l(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var p=function(){return p=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},p.apply(this,arguments)};function g(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))}function h(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}}function v(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;i<o;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var f=r.Messages,m=function(e){return T(D(e))},y=function(e){return k(E(e))},b=function(e,t){if(!e)return!1;var n=0;if(Array.prototype.indexOf)return e.indexOf(t,0)>=0;for(var r=e.length;n<r;n++)if(n in e&&e[n]===t)return!0;return!1},S=function(e,t){if(t&&e)for(var n in e)if(W(e,n)&&n.toLowerCase()===t.toLowerCase())return n;return null},I=function(e,t,n,r){var i=[e];return t?i.push(f.DeprecationMessages.MethodHasBeenDeprecated):i.push(f.DeprecationMessages.MethodMarkedForDeprecationPostfix),n&&(i.push(f.DeprecationMessages.AlternativeMethodPrefix),i.push(n+".")),r&&i.push("See - "+r),i.join(" ")};function _(e){var t=0;if(null==e)return 0;if(e=e.toString().toLowerCase(),Array.prototype.reduce)return e.split("").reduce((function(e,t){return(e=(e<<5)-e+t.charCodeAt(0))&e}),0);if(0===e.length)return t;for(var n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t&=t;return t}var w=function(e){return void 0===e&&(e=""),e?function(e){var t,n;return window.crypto&&window.crypto.getRandomValues&&(t=window.crypto.getRandomValues(new Uint8Array(1))),t?(n^t[0]%16>>NaN).toString(16):(n^16*Math.random()>>NaN).toString(16)}():"".concat(1e7,"-").concat(1e3,"-").concat(4e3,"-").concat(8e3,"-").concat(1e11).replace(/[018]/g,w)},P=function(e){var t=Object.prototype.toString.call(e);return"[object Object]"===t||"[object Error]"===t},C=function(e){if(isNaN(e)||!isFinite(e))return 0;var t=parseFloat(e);return isNaN(t)?0:t},A=function(e){return j(e)?e:null},T=function(e){return e.replace(/,/g,"|")},k=function(e){return e.replace(/\|/g,",")},E=function(e){return e.replace(/\'/g,'"')},D=function(e){return e.replace(/\"/g,"'")},O=function(e,t){return e.replace("%%mpid%%",t)},M=function(e){return e.replace(/&/g,"&")},L=function(e,t,n,r,i){var o=M(t),s=n?M(n):null,a=O(o,e),u=s?O(s,e):"",c=a+encodeURIComponent(u);if(r){var l=c.includes("?")?"&":"?";c+="".concat(l,"domain=").concat(r)}if(i){l=c.includes("?")?"&":"?";c+="".concat(l,"google_hm=").concat(i)}return c},F={"+":"-","/":"_","=":""},U=function(e){return function(e){return!/[^\u0000-\u00ff]/.test(e)}(e)?btoa(e).replace(/[+/=]/g,(function(e){return F[e]})):void 0},N=function(e){return"false"!==e&&"0"!==e&&Boolean(e)},R=function(e){return decodeURIComponent(e.replace(/\+/g," "))},V=function(e){return 0===e.indexOf('"')&&(e=e.slice(1,-1).replace(/\\"/g,'"').replace(/\\\\/g,"\\")),e},x=function(e){return"string"==typeof e},H=function(e){return"number"==typeof e},K=function(e){return"function"==typeof e},B=function(e){return H(e)||x(e)||function(e){return"boolean"==typeof e}(e)},q=function(e){return e===(j(t=e)?t.toString().toLowerCase().replace(/[^0-9a-zA-Z]+/g,"_"):"");var t},j=function(e){return x(e)||H(e)},z=function(e){return null==e||!(Object.keys(e)||e).length},Q=function(e,t){return e.slice(0,t).concat(e.slice(t+1),e[t])},W=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},J=function(e){return"__proto__"===e||"constructor"===e},G=function(e){return J(e)||"prototype"===e},$=function(e,t){var n;void 0===t&&(t=[]);var r={},i={};if(!e)return r;if("undefined"!=typeof URL&&"undefined"!=typeof URLSearchParams){var o=new URL(e);n=new URLSearchParams(o.search)}else n=Y(e);return n.forEach((function(e,t){i[t.toLowerCase()]=e})),z(t)?i:(t.forEach((function(e){var t=e.toLowerCase();W(i,t)&&i[t]&&(r[e]=i[t])})),r)},Y=function(e){var t={};return(e.split("#")[0].split("?")[1]||"").split("&").forEach((function(e){var n=e.split("="),r=n[0],i=n.slice(1).join("=");if(r&&void 0!==i)try{t[r]=decodeURIComponent(i||"")}catch(e){console.error("Failed to decode value for key ".concat(r,": ").concat(e))}})),{get:function(e){return t[e]},forEach:function(e){for(var n in t)W(t,n)&&e(t[n],n)}}},X=function(){return"undefined"!=typeof window&&window.location?window.location.href:""},Z=function(e,t,n){var r,i={};if(!z(e))for(var o in e)if(W(e,o)&&(!J(r=o)&&"hasOwnProperty"!==r)){var s=n(o);b(t,s)||(i[o]=e[o])}return i},ee=function(e,t,n){var r;return(null===(r=e.kitConfigs)||void 0===r?void 0:r.find((function(e){return e.name===t&&e.moduleId===n})))||null},te=function(e){if(null==e)return e;if(Array.isArray(e))return e.map((function(e){return te(e)}));if(P(e)){var t={};for(var n in e)e.hasOwnProperty(n)&&(t[n]=te(e[n]));return t}return c(e)},ne=function(e,t){return t?e:te(e)};function re(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n,r,i,o,s,a,u={hasOwn:Object.prototype.hasOwnProperty,class2type:{},type:function(e){return null==e?String(e):u.class2type[Object.prototype.toString.call(e)]||"object"},isPlainObject:function(e){if(!e||"object"!==u.type(e)||e.nodeType||u.isWindow(e))return!1;try{if(e.constructor&&!u.hasOwn.call(e,"constructor")&&!u.hasOwn.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(e){return!1}var t;for(t in e);return void 0===t||u.hasOwn.call(e,t)},isArray:Array.isArray||function(e){return"array"===u.type(e)},isFunction:function(e){return"function"===u.type(e)},isWindow:function(e){return null!=e&&e==e.window}},l=e[0]||{},d=1,p=!1,g=e.length;for("boolean"==typeof l&&(p=l,l=e[1]||{},d=2),"object"===c(l)||u.isFunction(l)||(l={}),g===d&&(l={},--d);d<g;d++)if(null!=(n=e[d]))for(r in n)G(r)||Object.prototype.hasOwnProperty.call(n,r)&&(i=l[r],l!==(o=n[r])&&(p&&o&&(u.isPlainObject(o)||(s=u.isArray(o)))?(s?(s=!1,a=i&&u.isArray(i)?i:[]):a=i&&u.isPlainObject(i)?i:{},l[r]=re(p,a,o)):void 0!==o&&(l[r]=o)));return l}var ie=function(e,t){return void 0===t&&(t="unknown error"),e instanceof Error?e.message:"string"==typeof e?e:e&&"object"===c(e)&&"string"==typeof e.message?e.message:t},oe={SessionStart:1,SessionEnd:2,PageView:3,PageEvent:4,CrashReport:5,OptOut:6,AppStateTransition:10,Profile:14,Commerce:16,Media:20,UserAttributeChange:17,UserIdentityChange:18},se={Unknown:0,Navigation:1,Location:2,Search:3,Transaction:4,UserContent:5,UserPreference:6,Social:7,Other:8,Media:9,getName:function(e){switch(e){case se.Unknown:return"Unknown";case se.Navigation:return"Navigation";case se.Location:return"Location";case se.Search:return"Search";case se.Transaction:return"Transaction";case se.UserContent:return"User Content";case se.UserPreference:return"User Preference";case se.Social:return"Social";case ae.ProductAddToCart:return"Product Added to Cart";case ae.ProductAddToWishlist:return"Product Added to Wishlist";case ae.ProductCheckout:return"Product Checkout";case ae.ProductCheckoutOption:return"Product Checkout Options";case ae.ProductClick:return"Product Click";case ae.ProductImpression:return"Product Impression";case ae.ProductPurchase:return"Product Purchased";case ae.ProductRefund:return"Product Refunded";case ae.ProductRemoveFromCart:return"Product Removed From Cart";case ae.ProductRemoveFromWishlist:return"Product Removed from Wishlist";case ae.ProductViewDetail:return"Product View Details";case ae.PromotionClick:return"Promotion Click";case ae.PromotionView:return"Promotion View";default:return"Other"}}},ae={ProductAddToCart:10,ProductRemoveFromCart:11,ProductCheckout:12,ProductCheckoutOption:13,ProductClick:14,ProductViewDetail:15,ProductPurchase:16,ProductRefund:17,PromotionView:18,PromotionClick:19,ProductAddToWishlist:20,ProductRemoveFromWishlist:21,ProductImpression:22},ue={Other:0,CustomerId:1,Facebook:2,Twitter:3,Google:4,Microsoft:5,Yahoo:6,Email:7,FacebookCustomAudienceId:9,Other2:10,Other3:11,Other4:12,Other5:13,Other6:14,Other7:15,Other8:16,Other9:17,Other10:18,MobileNumber:19,PhoneNumber2:20,PhoneNumber3:21,isValid:function(e){if("number"==typeof e)for(var t in ue)if(ue.hasOwnProperty(t)&&ue[t]===e)return!0;return!1},getName:function(e){switch(e){case window.mParticle.IdentityType.CustomerId:return"Customer ID";case window.mParticle.IdentityType.Facebook:return"Facebook ID";case window.mParticle.IdentityType.Twitter:return"Twitter ID";case window.mParticle.IdentityType.Google:return"Google ID";case window.mParticle.IdentityType.Microsoft:return"Microsoft ID";case window.mParticle.IdentityType.Yahoo:return"Yahoo ID";case window.mParticle.IdentityType.Email:return"Email";case window.mParticle.IdentityType.FacebookCustomAudienceId:return"Facebook App User ID";default:return"Other ID"}},getIdentityType:function(e){switch(e){case"other":case"email_sha256":return ue.Other;case"customerid":return ue.CustomerId;case"facebook":return ue.Facebook;case"twitter":return ue.Twitter;case"google":return ue.Google;case"microsoft":return ue.Microsoft;case"yahoo":return ue.Yahoo;case"email":return ue.Email;case"facebookcustomaudienceid":return ue.FacebookCustomAudienceId;case"other2":case"mobile_sha256":return ue.Other2;case"other3":return ue.Other3;case"other4":return ue.Other4;case"other5":return ue.Other5;case"other6":return ue.Other6;case"other7":return ue.Other7;case"other8":return ue.Other8;case"other9":return ue.Other9;case"other10":return ue.Other10;case"mobile_number":return ue.MobileNumber;case"phone_number_2":return ue.PhoneNumber2;case"phone_number_3":return ue.PhoneNumber3;default:return!1}},getIdentityName:function(e){switch(e){case ue.Other:return"other";case ue.CustomerId:return"customerid";case ue.Facebook:return"facebook";case ue.Twitter:return"twitter";case ue.Google:return"google";case ue.Microsoft:return"microsoft";case ue.Yahoo:return"yahoo";case ue.Email:return"email";case ue.FacebookCustomAudienceId:return"facebookcustomaudienceid";case ue.Other2:return"other2";case ue.Other3:return"other3";case ue.Other4:return"other4";case ue.Other5:return"other5";case ue.Other6:return"other6";case ue.Other7:return"other7";case ue.Other8:return"other8";case ue.Other9:return"other9";case ue.Other10:return"other10";case ue.MobileNumber:return"mobile_number";case ue.PhoneNumber2:return"phone_number_2";case ue.PhoneNumber3:return"phone_number_3";default:return null}},getValuesAsStrings:function(){return Object.values(ue).map((function(e){return H(e)?e.toString():void 0})).filter((function(e){return void 0!==e}))},getNewIdentitiesByName:function(e){var t={},n=ue.getValuesAsStrings();for(var r in e){if(n.includes(r))t[ue.getIdentityName(C(r))]=e[r]}return t}},ce={Unknown:0,AddToCart:1,RemoveFromCart:2,Checkout:3,CheckoutOption:4,Click:5,ViewDetail:6,Purchase:7,Refund:8,AddToWishlist:9,RemoveFromWishlist:10,ViewCart:11,AddShippingInfo:12,AddPaymentInfo:13,PaymentMethodSelected:14,PaymentAttempted:15,PaymentSucceeded:16,PaymentFailed:17,RefundInitiated:18,isRoktCommerceType:function(e){return e>=ce.ViewCart&&e<=ce.RefundInitiated},getName:function(e){switch(e){case ce.AddToCart:return"Add to Cart";case ce.RemoveFromCart:return"Remove from Cart";case ce.Checkout:return"Checkout";case ce.CheckoutOption:return"Checkout Option";case ce.Click:return"Click";case ce.ViewDetail:return"View Detail";case ce.Purchase:return"Purchase";case ce.Refund:return"Refund";case ce.AddToWishlist:return"Add to Wishlist";case ce.RemoveFromWishlist:return"Remove from Wishlist";case ce.ViewCart:return"View Cart";case ce.AddShippingInfo:return"Add Shipping Info";case ce.AddPaymentInfo:return"Add Payment Info";case ce.PaymentMethodSelected:return"Payment Method Selected";case ce.PaymentAttempted:return"Payment Attempted";case ce.PaymentSucceeded:return"Payment Succeeded";case ce.PaymentFailed:return"Payment Failed";case ce.RefundInitiated:return"Refund Initiated";default:return"Unknown"}},getExpansionName:function(e){switch(e){case ce.AddToCart:return"add_to_cart";case ce.RemoveFromCart:return"remove_from_cart";case ce.Checkout:return"checkout";case ce.CheckoutOption:return"checkout_option";case ce.Click:return"click";case ce.ViewDetail:return"view_detail";case ce.Purchase:return"purchase";case ce.Refund:return"refund";case ce.AddToWishlist:return"add_to_wishlist";case ce.RemoveFromWishlist:return"remove_from_wishlist";case ce.ViewCart:return"view_cart";case ce.AddShippingInfo:return"add_shipping_info";case ce.AddPaymentInfo:return"add_payment_info";case ce.PaymentMethodSelected:return"payment_method_selected";case ce.PaymentAttempted:return"payment_attempted";case ce.PaymentSucceeded:return"payment_succeeded";case ce.PaymentFailed:return"payment_failed";case ce.RefundInitiated:return"refund_initiated";default:return"unknown"}}},le={SignUp:"sign_up",Subscribe:"subscribe",StartTrial:"start_trial",GenerateLead:"generate_lead",Search:"search",Upsell:"upsell",EarnVirtualCurrency:"earn_virtual_currency",DwellTime:"dwell_time",Hover:"hover",Scroll:"scroll",ClickToExpand:"click_to_expand"},de={Unknown:0,PromotionView:1,PromotionClick:2,getName:function(e){switch(e){case de.PromotionView:return"view";case de.PromotionClick:return"click";default:return"unknown"}},getExpansionName:function(e){switch(e){case de.PromotionView:return"view";case de.PromotionClick:return"click";default:return"unknown"}}},pe="mp:sdkStart",ge="mp:jointSdkSelectPlacements",he="mp:jointSdkRoktKitInit";function ve(e){var t=C(e);return String(t)===e&&ue.isValid(t)?t:null}var fe,me={MessageType:oe,EventType:se,CommerceEventType:ae,IdentityType:ue,ProfileMessageType:{Logout:3},ApplicationTransitionType:{AppInit:1},ProductActionType:ce,PromotionActionType:de,RoktEvents:le,Environment:r.Environment};!function(e){e[e.Unknown=0]="Unknown",e[e.AddToCart=1]="AddToCart",e[e.RemoveFromCart=2]="RemoveFromCart",e[e.Checkout=3]="Checkout",e[e.CheckoutOption=4]="CheckoutOption",e[e.Click=5]="Click",e[e.ViewDetail=6]="ViewDetail",e[e.Purchase=7]="Purchase",e[e.Refund=8]="Refund",e[e.AddToWishlist=9]="AddToWishlist",e[e.RemoveFromWishlist=10]="RemoveFromWishlist",e[e.ViewCart=11]="ViewCart",e[e.AddShippingInfo=12]="AddShippingInfo",e[e.AddPaymentInfo=13]="AddPaymentInfo",e[e.PaymentMethodSelected=14]="PaymentMethodSelected",e[e.PaymentAttempted=15]="PaymentAttempted",e[e.PaymentSucceeded=16]="PaymentSucceeded",e[e.PaymentFailed=17]="PaymentFailed",e[e.RefundInitiated=18]="RefundInitiated"}(fe||(fe={}));var ye,be,Se,Ie,_e,we,Pe,Ce,Ae,Te,ke,Ee,De,Oe,Me,Le,Fe,Ue,Ne,Re="none",Ve="verbose",xe="warning",He={};ye=He,Object.defineProperty(ye,"__esModule",{value:!0}),(be=ye.ApplicationInformationOsEnum||(ye.ApplicationInformationOsEnum={})).unknown="Unknown",be.iOS="IOS",be.android="Android",be.windowsPhone="WindowsPhone",be.mobileWeb="MobileWeb",be.unityIOS="UnityIOS",be.unityAndroid="UnityAndroid",be.desktop="Desktop",be.tvOS="TVOS",be.roku="Roku",be.outOfBand="OutOfBand",be.alexa="Alexa",be.smartTV="SmartTV",be.fireTV="FireTV",be.xbox="Xbox",(ye.ApplicationStateTransitionEventEventTypeEnum||(ye.ApplicationStateTransitionEventEventTypeEnum={})).applicationStateTransition="application_state_transition",(Se=ye.ApplicationStateTransitionEventDataApplicationTransitionTypeEnum||(ye.ApplicationStateTransitionEventDataApplicationTransitionTypeEnum={})).applicationInitialized="application_initialized",Se.applicationExit="application_exit",Se.applicationBackground="application_background",Se.applicationForeground="application_foreground",(Ie=ye.BatchEnvironmentEnum||(ye.BatchEnvironmentEnum={})).unknown="unknown",Ie.development="development",Ie.production="production",(ye.BreadcrumbEventEventTypeEnum||(ye.BreadcrumbEventEventTypeEnum={})).breadcrumb="breadcrumb",(ye.CommerceEventEventTypeEnum||(ye.CommerceEventEventTypeEnum={})).commerceEvent="commerce_event",(_e=ye.CommerceEventDataCustomEventTypeEnum||(ye.CommerceEventDataCustomEventTypeEnum={})).addToCart="add_to_cart",_e.removeFromCart="remove_from_cart",_e.checkout="checkout",_e.checkoutOption="checkout_option",_e.click="click",_e.viewDetail="view_detail",_e.purchase="purchase",_e.refund="refund",_e.promotionView="promotion_view",_e.promotionClick="promotion_click",_e.addToWishlist="add_to_wishlist",_e.removeFromWishlist="remove_from_wishlist",_e.impression="impression",(ye.CrashReportEventEventTypeEnum||(ye.CrashReportEventEventTypeEnum={})).crashReport="crash_report",(ye.CustomEventEventTypeEnum||(ye.CustomEventEventTypeEnum={})).customEvent="custom_event",(we=ye.CustomEventDataCustomEventTypeEnum||(ye.CustomEventDataCustomEventTypeEnum={})).navigation="navigation",we.location="location",we.search="search",we.transaction="transaction",we.userContent="user_content",we.userPreference="user_preference",we.social="social",we.media="media",we.other="other",we.unknown="unknown",(Pe=ye.DeviceCurrentStateDeviceOrientationEnum||(ye.DeviceCurrentStateDeviceOrientationEnum={})).portrait="portrait",Pe.portraitUpsideDown="portrait_upside_down",Pe.landscape="landscape",Pe.landscapeLeft="LandscapeLeft",Pe.landscapeRight="LandscapeRight",Pe.faceUp="FaceUp",Pe.faceDown="FaceDown",Pe.square="Square",(Ce=ye.DeviceCurrentStateStatusBarOrientationEnum||(ye.DeviceCurrentStateStatusBarOrientationEnum={})).portrait="portrait",Ce.portraitUpsideDown="portrait_upside_down",Ce.landscape="landscape",Ce.landscapeLeft="LandscapeLeft",Ce.landscapeRight="LandscapeRight",Ce.faceUp="FaceUp",Ce.faceDown="FaceDown",Ce.square="Square",(Ae=ye.DeviceInformationPlatformEnum||(ye.DeviceInformationPlatformEnum={})).iOS="iOS",Ae.android="Android",Ae.web="web",Ae.desktop="desktop",Ae.tvOS="tvOS",Ae.roku="roku",Ae.outOfBand="out_of_band",Ae.smartTV="smart_tv",Ae.xbox="xbox",(Te=ye.EventTypeEnum||(ye.EventTypeEnum={})).unknown="unknown",Te.sessionStart="session_start",Te.sessionEnd="session_end",Te.screenView="screen_view",Te.customEvent="custom_event",Te.crashReport="crash_report",Te.optOut="opt_out",Te.firstRun="first_run",Te.preAttribution="pre_attribution",Te.pushRegistration="push_registration",Te.applicationStateTransition="application_state_transition",Te.pushMessage="push_message",Te.networkPerformance="network_performance",Te.breadcrumb="breadcrumb",Te.profile="profile",Te.pushReaction="push_reaction",Te.commerceEvent="commerce_event",Te.userAttributeChange="user_attribute_change",Te.userIdentityChange="user_identity_change",Te.uninstall="uninstall",Te.validationResult="validation_result",(ke=ye.IdentityTypeEnum||(ye.IdentityTypeEnum={})).other="other",ke.customerId="customer_id",ke.facebook="facebook",ke.twitter="twitter",ke.google="google",ke.microsoft="microsoft",ke.yahoo="yahoo",ke.email="email",ke.alias="alias",ke.facebookCustomAudienceId="facebook_custom_audience_id",ke.otherId2="other_id_2",ke.otherId3="other_id_3",ke.otherId4="other_id_4",ke.otherId5="other_id_5",ke.otherId6="other_id_6",ke.otherId7="other_id_7",ke.otherId8="other_id_8",ke.otherId9="other_id_9",ke.otherId10="other_id_10",ke.mobileNumber="mobile_number",ke.phoneNumber2="phone_number_2",ke.phoneNumber3="phone_number_3",(ye.NetworkPerformanceEventEventTypeEnum||(ye.NetworkPerformanceEventEventTypeEnum={})).networkPerformance="network_performance",(ye.OptOutEventEnum||(ye.OptOutEventEnum={})).optOut="opt_out",(Ee=ye.ProductActionActionEnum||(ye.ProductActionActionEnum={})).unknown="unknown",Ee.addToCart="add_to_cart",Ee.removeFromCart="remove_from_cart",Ee.checkout="checkout",Ee.checkoutOption="checkout_option",Ee.click="click",Ee.viewDetail="view_detail",Ee.purchase="purchase",Ee.refund="refund",Ee.addToWishlist="add_to_wishlist",Ee.removeFromWishlist="remove_from_wish_list",(ye.ProfileEventEventTypeEnum||(ye.ProfileEventEventTypeEnum={})).profile="profile",(De=ye.ProfileEventDataProfileEventTypeEnum||(ye.ProfileEventDataProfileEventTypeEnum={})).signup="signup",De.login="login",De.logout="logout",De.update="update",De.delete="delete",(Oe=ye.PromotionActionActionEnum||(ye.PromotionActionActionEnum={})).view="view",Oe.click="click",(ye.PushMessageEventEventTypeEnum||(ye.PushMessageEventEventTypeEnum={})).pushMessage="push_message",(Me=ye.PushMessageEventDataPushMessageTypeEnum||(ye.PushMessageEventDataPushMessageTypeEnum={})).sent="sent",Me.received="received",Me.action="action",(Le=ye.PushMessageEventDataApplicationStateEnum||(ye.PushMessageEventDataApplicationStateEnum={})).notRunning="not_running",Le.background="background",Le.foreground="foreground",(Fe=ye.PushMessageEventDataPushMessageBehaviorEnum||(ye.PushMessageEventDataPushMessageBehaviorEnum={})).received="Received",Fe.directOpen="DirectOpen",Fe.read="Read",Fe.influencedOpen="InfluencedOpen",Fe.displayed="Displayed",(ye.PushRegistrationEventEventTypeEnum||(ye.PushRegistrationEventEventTypeEnum={})).pushRegistration="push_registration",(ye.SessionEndEventEventTypeEnum||(ye.SessionEndEventEventTypeEnum={})).sessionEnd="session_end",(ye.SessionStartEventEventTypeEnum||(ye.SessionStartEventEventTypeEnum={})).sessionStart="session_start",(Ue=ye.SourceInformationChannelEnum||(ye.SourceInformationChannelEnum={})).native="native",Ue.javascript="javascript",Ue.pixel="pixel",Ue.desktop="desktop",Ue.partner="partner",Ue.serverToServer="server_to_server",(ye.UserAttributeChangeEventEventTypeEnum||(ye.UserAttributeChangeEventEventTypeEnum={})).userAttributeChange="user_attribute_change",(ye.UserIdentityChangeEventEventTypeEnum||(ye.UserIdentityChangeEventEventTypeEnum={})).userIdentityChange="user_identity_change",function(e){e.other="other",e.customerId="customerid",e.facebook="facebook",e.twitter="twitter",e.google="google",e.microsoft="microsoft",e.yahoo="yahoo",e.email="email",e.alias="alias",e.facebookCustomAudienceId="facebookcustomaudienceid",e.otherId2="other2",e.otherId3="other3",e.otherId4="other4",e.otherId5="other5",e.otherId6="other6",e.otherId7="other7",e.otherId8="other8",e.otherId9="other9",e.otherId10="other10",e.mobileNumber="mobile_number",e.phoneNumber2="phone_number_2",e.phoneNumber3="phone_number_3"}(Ne||(Ne={}));var Ke="custom_flags",Be="partner_identities",qe="integration_attributes",je={fbclid:{mappedKey:"Facebook.ClickId",processor:function(e,t,n){if(!e||!t)return"";var r=null==t?void 0:t.split("//");if(!r)return"";var i=1;r[1].split("/")[0].split(".").length>=3&&(i=2);var o=n||Date.now();return"fb.".concat(i,".").concat(o,".").concat(e)},output:Ke},_fbp:{mappedKey:"Facebook.BrowserId",output:Ke},_fbc:{mappedKey:"Facebook.ClickId",output:Ke},gclid:{mappedKey:"GoogleEnhancedConversions.Gclid",output:Ke},gbraid:{mappedKey:"GoogleEnhancedConversions.Gbraid",output:Ke},wbraid:{mappedKey:"GoogleEnhancedConversions.Wbraid",output:Ke},ttclid:{mappedKey:"TikTok.Callback",output:Ke},_ttp:{mappedKey:"tiktok_cookie_id",output:Be},ScCid:{mappedKey:"SnapchatConversions.ClickId",output:Ke},epik:{mappedKey:"Pinterest.click_id",output:Ke},_epik:{mappedKey:"Pinterest.click_id",output:Ke},_scid:{mappedKey:"SnapchatConversions.Cookie1",output:Ke}},ze={rtid:{mappedKey:"passbackconversiontrackingid",output:qe,moduleId:1277},rclid:{mappedKey:"passbackconversiontrackingid",output:qe,moduleId:1277},RoktTransactionId:{mappedKey:"passbackconversiontrackingid",output:qe,moduleId:1277}};function Qe(e){if(!e)return!1;var t=e(r.FeatureFlags.CaptureIntegrationSpecificIds),n=e(r.FeatureFlags.CaptureIntegrationSpecificIdsV2);return!!n&&n!==r.CaptureIntegrationSpecificIdsV2Modes.None||!0===t}var We=function(){function e(e){this.initialTimestamp=Date.now(),this.captureMode=e,this.filteredPartnerIdentityMappings=this.filterMappings(Be),this.filteredCustomFlagMappings=this.filterMappings(Ke),this.filteredIntegrationAttributeMappings=this.filterMappings(qe)}return e.prototype.capture=function(){var e=this.captureQueryParams()||{},t=this.captureCookies()||{},n=this.captureLocalStorage()||{};this.normalizePinterestClickId(e),this.normalizePinterestClickId(n),this.normalizePinterestClickId(t),this.applySourcePrecedence([e,n,t,this.clickIds||{}]),this.clickIds=p(p(p(p({},this.clickIds),t),n),e)},e.prototype.captureCookies=function(){var e,t=this.getAllowedKeysForMode(),n=(e=t,function(e,t){for(var n={},r=0,i=e;r<i.length;r++){var o=i[r].split("="),s=o[0],a=o[1];t&&!t.includes(s)||(n[s]=a)}return n}(function(){try{return"undefined"==typeof window?[]:window.document.cookie.split(";").map((function(e){return e.trim()}))}catch(e){return console.error("Unable to parse cookies",e),[]}}(),e));return this.applyProcessors(n,X(),this.initialTimestamp)},e.prototype.captureQueryParams=function(){var e=this.getQueryParams();return this.applyProcessors(e,X(),this.initialTimestamp)},e.prototype.captureLocalStorage=function(){for(var e={},t=0,n=this.getAllowedKeysForMode();t<n.length;t++){var r=n[t],i=localStorage.getItem(r);i&&(e[r]=i)}return this.applyProcessors(e,X(),this.initialTimestamp)},e.prototype.getQueryParams=function(){var e=this.getAllowedKeysForMode();return $(X(),e)},e.prototype.getClickIdsAsCustomFlags=function(){return this.getClickIds(this.clickIds,this.filteredCustomFlagMappings)},e.prototype.getClickIdsAsPartnerIdentities=function(){return this.getClickIds(this.clickIds,this.filteredPartnerIdentityMappings)},e.prototype.getClickIdsAsIntegrationAttributes=function(){var e,t,n,r={};for(var i in this.clickIds)if(this.clickIds.hasOwnProperty(i)){var o=this.clickIds[i],s=null===(t=this.filteredIntegrationAttributeMappings[i])||void 0===t?void 0:t.mappedKey;if(!z(s)){var a=null===(n=this.filteredIntegrationAttributeMappings[i])||void 0===n?void 0:n.moduleId;a&&!r[a]&&(r[a]=((e={})[s]=o,e))}}return r},e.prototype.getClickIds=function(e,t){var n,r={};if(!e)return r;for(var i in e)if(e.hasOwnProperty(i)){var o=e[i],s=null===(n=t[i])||void 0===n?void 0:n.mappedKey;z(s)||(r[s]=o)}return r},e.prototype.normalizePinterestClickId=function(e){z(null==e?void 0:e._epik)||z(null==e?void 0:e.epik)||delete e.epik},e.prototype.applySourcePrecedence=function(e){for(var t=this.getActiveIntegrationMapping(),n=function(e){var n;return(null===(n=t[e])||void 0===n?void 0:n.mappedKey)||e},r=[],i=0,o=e;i<o.length;i++){var s=o[i],a=[];for(var u in s){var c=n(u);-1!==r.indexOf(c)?delete s[u]:z(s[u])||a.push(c)}r.push.apply(r,a)}},e.prototype.applyProcessors=function(e,t,n){var r,i={},o=this.getActiveIntegrationMapping();for(var s in e)if(e.hasOwnProperty(s)){var a=e[s],u=null===(r=o[s])||void 0===r?void 0:r.processor;i[s]=u?u(a,t,n):a}return i},e.prototype.filterMappings=function(e){var t={},n=this.getActiveIntegrationMapping();for(var r in n)n[r].output===e&&(t[r]=n[r]);return t},e.prototype.getAllowedKeysForMode=function(){return Object.keys(this.getActiveIntegrationMapping())},e.prototype.getActiveIntegrationMapping=function(){return this.captureMode===r.CaptureIntegrationSpecificIdsV2Modes.RoktOnly?ze:this.captureMode===r.CaptureIntegrationSpecificIdsV2Modes.All?p(p({},je),ze):{}},e}();function Je(e,t,n){if(!e)return null;if(!t||t.length<1)return null;for(var r=n._IntegrationCapture,i=n._Helpers.getFeatureFlag,o=n.Identity.getCurrentUser(),s=[],a=null,u=0,c=t;u<c.length;u++){var l=c[u];if(l){a=l;var d=Ze(l);d&&s.push(d)}}if(!a)return null;var p=null;z(a.ConsentState)?z(o)||(p=o.getConsentState()):p=a.ConsentState;var g={source_request_id:n._Helpers.generateUniqueId(),mpid:e,timestamp_unixtime_ms:(new Date).getTime(),environment:a.Debug?He.BatchEnvironmentEnum.development:He.BatchEnvironmentEnum.production,events:s,mp_deviceid:a.DeviceId,sdk_version:a.SDKVersion,application_info:{application_version:a.AppVersion,application_name:a.AppName,package:a.Package,sideloaded_kits_count:n._Store.sideloadedKitsCount},device_info:{platform:He.DeviceInformationPlatformEnum.web,screen_width:"undefined"!=typeof window&&void 0!==window.screen?window.screen.width:0,screen_height:"undefined"!=typeof window&&void 0!==window.screen?window.screen.height:0},user_attributes:a.UserAttributes,user_identities:Xe(a.UserIdentities),consent_state:Ge(p),integration_attributes:a.IntegrationAttributes};if(a.DataPlan&&a.DataPlan.PlanId&&(g.context={data_plan:{plan_id:a.DataPlan.PlanId,plan_version:a.DataPlan.PlanVersion||void 0}}),Qe(i)){null==r||r.capture();var h=null==r?void 0:r.getClickIdsAsPartnerIdentities();z(h)||(g.partner_identities=h)}return g}function Ge(e){return z(e)?null:{gdpr:$e(e.getGDPRConsentState()),ccpa:Ye(e.getCCPAConsentState())}}function $e(e){if(!e)return null;var t={};for(var n in e)e.hasOwnProperty(n)&&(t[n]={consented:e[n].Consented,hardware_id:e[n].HardwareId,document:e[n].ConsentDocument,timestamp_unixtime_ms:e[n].Timestamp,location:e[n].Location});return t}function Ye(e){return e?{data_sale_opt_out:{consented:e.Consented,hardware_id:e.HardwareId,document:e.ConsentDocument,timestamp_unixtime_ms:e.Timestamp,location:e.Location}}:null}function Xe(e){if(!e||!e.length)return null;for(var t={},n=0,r=e;n<r.length;n++){var i=r[n];switch(i.Type){case me.IdentityType.CustomerId:t.customer_id=i.Identity;break;case me.IdentityType.Email:t.email=i.Identity;break;case me.IdentityType.Facebook:t.facebook=i.Identity;break;case me.IdentityType.FacebookCustomAudienceId:t.facebook_custom_audience_id=i.Identity;break;case me.IdentityType.Google:t.google=i.Identity;break;case me.IdentityType.Microsoft:t.microsoft=i.Identity;break;case me.IdentityType.Other:t.other=i.Identity;break;case me.IdentityType.Other2:t.other_id_2=i.Identity;break;case me.IdentityType.Other3:t.other_id_3=i.Identity;break;case me.IdentityType.Other4:t.other_id_4=i.Identity;break;case me.IdentityType.Other5:t.other_id_5=i.Identity;break;case me.IdentityType.Other6:t.other_id_6=i.Identity;break;case me.IdentityType.Other7:t.other_id_7=i.Identity;break;case me.IdentityType.Other8:t.other_id_8=i.Identity;break;case me.IdentityType.Other9:t.other_id_9=i.Identity;break;case me.IdentityType.Other10:t.other_id_10=i.Identity;break;case me.IdentityType.MobileNumber:t.mobile_number=i.Identity;break;case me.IdentityType.PhoneNumber2:t.phone_number_2=i.Identity;break;case me.IdentityType.PhoneNumber3:t.phone_number_3=i.Identity}}return t}function Ze(e){if(!e)return null;switch(e.EventDataType){case me.MessageType.AppStateTransition:return function(e){var t=at(e),n=He.ApplicationStateTransitionEventDataApplicationTransitionTypeEnum,r=n.applicationBackground,i=n.applicationInitialized,o=e.IsBackgroundAST?r:i,s={application_transition_type:o,is_first_run:e.IsFirstRun,is_upgrade:!1,launch_referral:e.LaunchReferral};return s=Object.assign(s,t),{event_type:He.EventTypeEnum.applicationStateTransition,data:s}}(e);case me.MessageType.Commerce:return function(e){var t=at(e),n={custom_flags:e.CustomFlags,product_action:tt(e),promotion_action:rt(e),product_impressions:ot(e),currency_code:e.CurrencyCode};return n=Object.assign(n,t),{event_type:He.EventTypeEnum.commerceEvent,data:n}}(e);case me.MessageType.CrashReport:return function(e){var t=at(e),n={message:e.EventName};return n=Object.assign(n,t),{event_type:He.EventTypeEnum.crashReport,data:n}}(e);case me.MessageType.OptOut:return function(e){var t=at(e),n={is_opted_out:e.OptOut};return n=Object.assign(n,t),{event_type:He.EventTypeEnum.optOut,data:n}}(e);case me.MessageType.PageEvent:return function(e){var t=at(e),n={custom_event_type:st(e.EventCategory),custom_flags:e.CustomFlags,event_name:e.EventName};return n=Object.assign(n,t),{event_type:He.EventTypeEnum.customEvent,data:n}}(e);case me.MessageType.PageView:return function(e){var t=at(e),n={custom_flags:e.CustomFlags,screen_name:e.EventName};return n=Object.assign(n,t),{event_type:He.EventTypeEnum.screenView,data:n}}(e);case me.MessageType.Profile:return null;case me.MessageType.SessionEnd:return function(e){var t=at(e),n={session_duration_ms:e.SessionLength};return n=Object.assign(n,t),{event_type:He.EventTypeEnum.sessionEnd,data:n}}(e);case me.MessageType.SessionStart:return function(e){var t=at(e),n={};return n=Object.assign(n,t),{event_type:He.EventTypeEnum.sessionStart,data:n}}(e);case me.MessageType.UserAttributeChange:return function(e){var t=at(e),n={user_attribute_name:e.UserAttributeChanges.UserAttributeName,new:e.UserAttributeChanges.New,old:e.UserAttributeChanges.Old,deleted:e.UserAttributeChanges.Deleted,is_new_attribute:e.UserAttributeChanges.IsNewAttribute};return n=p(p({},n),t),{event_type:He.EventTypeEnum.userAttributeChange,data:n}}(e);case me.MessageType.UserIdentityChange:return function(e){var t=at(e),n={new:{identity_type:ct(e.UserIdentityChanges.New.IdentityType),identity:e.UserIdentityChanges.New.Identity||null,timestamp_unixtime_ms:e.Timestamp,created_this_batch:e.UserIdentityChanges.New.CreatedThisBatch},old:{identity_type:ct(e.UserIdentityChanges.Old.IdentityType),identity:e.UserIdentityChanges.Old.Identity||null,timestamp_unixtime_ms:e.Timestamp,created_this_batch:e.UserIdentityChanges.Old.CreatedThisBatch}};return n=Object.assign(n,t),{event_type:He.EventTypeEnum.userIdentityChange,data:n}}(e)}return null}function et(e){if(!e)return He.ProductActionActionEnum.unknown;switch(e){case fe.AddToCart:return He.ProductActionActionEnum.addToCart;case fe.AddToWishlist:return He.ProductActionActionEnum.addToWishlist;case fe.Checkout:return He.ProductActionActionEnum.checkout;case fe.CheckoutOption:return He.ProductActionActionEnum.checkoutOption;case fe.Click:return He.ProductActionActionEnum.click;case fe.Purchase:return He.ProductActionActionEnum.purchase;case fe.Refund:return He.ProductActionActionEnum.refund;case fe.RemoveFromCart:return He.ProductActionActionEnum.removeFromCart;case fe.RemoveFromWishlist:return He.ProductActionActionEnum.removeFromWishlist;case fe.ViewDetail:return He.ProductActionActionEnum.viewDetail;default:return He.ProductActionActionEnum.unknown}}function tt(e){return e.ProductAction?{action:et(e.ProductAction.ProductActionType),checkout_step:e.ProductAction.CheckoutStep,checkout_options:e.ProductAction.CheckoutOptions,transaction_id:e.ProductAction.TransactionId,affiliation:e.ProductAction.Affiliation,total_amount:e.ProductAction.TotalAmount,tax_amount:e.ProductAction.TaxAmount,shipping_amount:e.ProductAction.ShippingAmount,coupon_code:e.ProductAction.CouponCode,products:nt(e.ProductAction.ProductList)}:null}function nt(e){if(!e||!e.length)return null;for(var t=[],n=0,r=e;n<r.length;n++){var i=r[n],o={id:i.Sku,name:i.Name,brand:i.Brand,category:i.Category,variant:i.Variant,total_product_amount:i.TotalAmount,position:i.Position,price:i.Price,quantity:i.Quantity,coupon_code:i.CouponCode,custom_attributes:i.Attributes};t.push(o)}return t}function rt(e){return e.PromotionAction?{action:e.PromotionAction.PromotionActionType,promotions:it(e.PromotionAction.PromotionList)}:null}function it(e){if(!e||!e.length)return null;for(var t=[],n=0,r=e;n<r.length;n++){var i=r[n],o={id:i.Id,name:i.Name,creative:i.Creative,position:i.Position};t.push(o)}return t}function ot(e){if(!e.ProductImpressions)return null;for(var t=[],n=0,r=e.ProductImpressions;n<r.length;n++){var i=r[n],o={product_impression_list:i.ProductImpressionList,products:nt(i.ProductList)};t.push(o)}return t}function st(e){switch(e){case me.EventType.Other:return He.CustomEventDataCustomEventTypeEnum.other;case me.EventType.Location:return He.CustomEventDataCustomEventTypeEnum.location;case me.EventType.Navigation:return He.CustomEventDataCustomEventTypeEnum.navigation;case me.EventType.Search:return He.CustomEventDataCustomEventTypeEnum.search;case me.EventType.Social:return He.CustomEventDataCustomEventTypeEnum.social;case me.EventType.Transaction:return He.CustomEventDataCustomEventTypeEnum.transaction;case me.EventType.UserContent:return He.CustomEventDataCustomEventTypeEnum.userContent;case me.EventType.UserPreference:return He.CustomEventDataCustomEventTypeEnum.userPreference;case me.EventType.Media:return He.CustomEventDataCustomEventTypeEnum.media;case me.CommerceEventType.ProductAddToCart:return He.CommerceEventDataCustomEventTypeEnum.addToCart;case me.CommerceEventType.ProductAddToWishlist:return He.CommerceEventDataCustomEventTypeEnum.addToWishlist;case me.CommerceEventType.ProductCheckout:return He.CommerceEventDataCustomEventTypeEnum.checkout;case me.CommerceEventType.ProductCheckoutOption:return He.CommerceEventDataCustomEventTypeEnum.checkoutOption;case me.CommerceEventType.ProductClick:return He.CommerceEventDataCustomEventTypeEnum.click;case me.CommerceEventType.ProductImpression:return He.CommerceEventDataCustomEventTypeEnum.impression;case me.CommerceEventType.ProductPurchase:return He.CommerceEventDataCustomEventTypeEnum.purchase;case me.CommerceEventType.ProductRefund:return He.CommerceEventDataCustomEventTypeEnum.refund;case me.CommerceEventType.ProductRemoveFromCart:return He.CommerceEventDataCustomEventTypeEnum.removeFromCart;case me.CommerceEventType.ProductRemoveFromWishlist:return He.CommerceEventDataCustomEventTypeEnum.removeFromWishlist;case me.CommerceEventType.ProductViewDetail:return He.CommerceEventDataCustomEventTypeEnum.viewDetail;case me.CommerceEventType.PromotionClick:return He.CommerceEventDataCustomEventTypeEnum.promotionClick;case me.CommerceEventType.PromotionView:return He.CommerceEventDataCustomEventTypeEnum.promotionView;default:return He.CustomEventDataCustomEventTypeEnum.unknown}}function at(e){return{timestamp_unixtime_ms:e.Timestamp,session_uuid:e.SessionId,session_start_unixtime_ms:e.SessionStartDate,custom_attributes:e.EventAttributes,location:ut(e.Location),source_message_id:e.SourceMessageId,active_time_on_site_ms:e.ActiveTimeOnSite,total_time_on_site_ms:e.TotalTimeOnSite,page_url:e.PageUrl}}function ut(e){return e&&Object.keys(e).length?{latitude:e.lat,longitude:e.lng}:null}function ct(e){switch(e){case Ne.other:return He.IdentityTypeEnum.other;case Ne.customerId:return He.IdentityTypeEnum.customerId;case Ne.facebook:return He.IdentityTypeEnum.facebook;case Ne.twitter:return He.IdentityTypeEnum.twitter;case Ne.google:return He.IdentityTypeEnum.google;case Ne.microsoft:return He.IdentityTypeEnum.microsoft;case Ne.yahoo:return He.IdentityTypeEnum.yahoo;case Ne.email:return He.IdentityTypeEnum.email;case Ne.alias:return He.IdentityTypeEnum.alias;case Ne.facebookCustomAudienceId:return He.IdentityTypeEnum.facebookCustomAudienceId;case Ne.otherId2:return He.IdentityTypeEnum.otherId2;case Ne.otherId3:return He.IdentityTypeEnum.otherId3;case Ne.otherId4:return He.IdentityTypeEnum.otherId4;case Ne.otherId5:return He.IdentityTypeEnum.otherId5;case Ne.otherId6:return He.IdentityTypeEnum.otherId6;case Ne.otherId7:return He.IdentityTypeEnum.otherId7;case Ne.otherId8:return He.IdentityTypeEnum.otherId8;case Ne.otherId9:return He.IdentityTypeEnum.otherId9;case Ne.otherId10:return He.IdentityTypeEnum.otherId10;case Ne.mobileNumber:return He.IdentityTypeEnum.mobileNumber;case Ne.phoneNumber2:return He.IdentityTypeEnum.phoneNumber2;case Ne.phoneNumber3:return He.IdentityTypeEnum.phoneNumber3}}var lt,dt=["pushState","replaceState"],pt="__mpApvWrapped__",gt=function(e){return!!e&&void 0!==e.history&&"function"==typeof e.history.pushState&&"function"==typeof e.addEventListener},ht="__mpRouteMonitor__",vt=function(){var e=window;return e[ht]||(e[ht]={listeners:{},undoHistoryPatch:null,popStateListener:null}),e[ht]},ft=function(e){Object.values(vt().listeners).forEach((function(t){try{t(e)}catch(e){}}))},mt=function(e,t){e.undoHistoryPatch||e.popStateListener||(e.undoHistoryPatch=function(e,t){if(window.history.pushState[pt])return t("[patch] history already wrapped, skipping to avoid double-wrap \u2014 STACKED WRAPPER DETECTED"),null;var n={},r={};dt.forEach((function(t){var i=window.history[t];n[t]=i;var o=function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];var o=i.apply(this,n);return e(t),o};Object.defineProperty(o,pt,{value:!0,enumerable:!1}),r[t]=o}));var i=function(){return dt.forEach((function(e){window.history[e]===r[e]?(window.history[e]=n[e],t("[teardown] restored original ".concat(e))):t("[teardown] ".concat(e," no longer ours; leaving in place, gating callback to no-op"))}))};try{dt.forEach((function(e){window.history[e]=r[e]}))}catch(e){t("[error] failed to patch history methods (frozen/sealed), rolling back: ".concat(e));try{i()}catch(e){t("[error] failed to restore history methods after patch failure: ".concat(e))}return null}return i}(ft,t),e.popStateListener=function(){return ft("popstate")},window.addEventListener("popstate",e.popStateListener))},yt=function(e,t,n){if(void 0===n&&(n=function(){}),!gt("undefined"==typeof window?null:window))return function(){};var r=vt();return r.listeners[e]=t,mt(r,n),function(){r.listeners[e]===t&&(delete r.listeners[e],0===Object.keys(r.listeners).length&&function(e){e.popStateListener&&(window.removeEventListener("popstate",e.popStateListener),e.popStateListener=null),e.undoHistoryPatch&&(e.undoHistoryPatch(),e.undoHistoryPatch=null)}(r))}},bt="__mpApv__",St=["page","limit","offset","cursor","per_page","q","s","oq","search","query","keyword","keywords","term","text","searchTerm","searchText","search_query","search_text","Ntt","pid","productId","sku","skuId","variant","color","colour","size","category","ref","referrer"],It="is_auto_page_view",_t=["hostname","title","path",It].concat(["constructor","__proto__","prototype"],["true","false"]),wt=St.map((function(e){return e.toLowerCase()})),Pt=function(e){return-1!==wt.indexOf(e.toLowerCase())},Ct=/^[a-z0-9_][a-z0-9_.-]{0,63}$/,At=["dwvar_"],Tt=function(e){return At.some((function(t){return 0===e.indexOf(t)}))},kt=function(e){var t=[],n=[],r=0;return e?((Array.isArray(e)?e:String(e).split(",")).forEach((function(e,i){var o=i+1,s=String(e).trim().toLowerCase();s&&(Ct.test(s)&&-1===_t.indexOf(s)?Pt(s)||-1!==t.indexOf(s)||(t.length>=25?r++:t.push(s)):n.push(o))})),{allowed:t,rejectedPositions:n,overLimit:r}):{allowed:t,rejectedPositions:n,overLimit:r}},Et=function(e,t){return e<t?-1:e>t?1:0},Dt=function(e,t){void 0===t&&(t=[]);var n=function(e){return void 0===e&&(e=[]),St.concat(e.filter((function(e){return!Pt(e)})).sort(Et))}(t),r=$(e,n);return n.filter((function(e){return W(r,e)})).filter((function(e){return function(e,t){return Pt(e)||t.length<=512}(e,r[e])})).map((function(e){return{name:e,value:r[e]}})).concat(function(e,t){var n=$(e);return Object.keys(n).filter((function(e){return Tt(e)&&n[e]&&-1===t.indexOf(e)})).sort(Et).map((function(e){return{name:e,value:n[e]}}))}(e,n))},Ot=function(e){var t={};return e.forEach((function(e){var n=e.name,r=e.value;t[n]=r})),t},Mt=function(e){var t;return e?((t={})[It]=!0,t):{}},Lt=function(e){var t=e.params.map((function(e){var t=e.name,n=e.value;return"".concat(t,"=").concat(encodeURIComponent(n))})).join("&");return t?"".concat(e.path,"?").concat(t):e.path},Ft=function(){return"undefined"==typeof window?null:window},Ut=function(){var e=Ft();return e?e[bt]:void 0},Nt=function(){var e=Ft();return e?(e[bt]||(e[bt]={initialPageViewFired:!1}),e[bt]):null},Rt=function(){var e=Ut();return e?e.tracker:void 0},Vt=function(){var e=Ut();return!(!e||!e.initialPageViewFired)},xt=function(){var e=Nt();e&&(e.initialPageViewFired=!0)},Ht=function(){var e=Ft();if(e){var t=Rt();t&&t.teardown(),e[bt]={initialPageViewFired:!1}}},Kt=function(e){return{path:window.location.pathname,params:Dt(X(),e)}},Bt=function(e){if(!e)return"";var t=e.params.map((function(e){return e.name}));return t.length?"".concat(e.path," (params: ").concat(t.join(),")"):e.path},qt=function(){function e(e,t){this.lastPage=null,this.active=!1,this.customQueryParams=[],this.pendingNavigations=[],this.undoHistoryPatch=null,this.mpInstance=e,this.isAutoPageView=!(!t||!t.isAutoPageView)}return Object.defineProperty(e.prototype,"isActive",{get:function(){return this.active},enumerable:!1,configurable:!0}),e.prototype.init=function(){var e=this;if(this.log("[init] PageViewTracker Init"),gt(Ft())){var t,n,r=Rt(),i=this.retire(r);this.active&&r!==this&&(i=i.concat(this.retire(this))),this.active=!0,this.customQueryParams=this.readCustomQueryParams(),this.lastPage=Kt(this.customQueryParams),this.log("[init] seeded lastPage: ".concat(Bt(this.lastPage))),this.undoHistoryPatch=yt("pageView",(function(t){return e.safeHandleNavigation(t)}),(function(t){return e.log(t)})),t=this,(n=Nt())&&(n.tracker=t),this.log("[init] patched pushState/replaceState + listening for popstate"),i.forEach((function(t){return e.scheduleFire(t)}))}else this.log("[init] unsupported environment (no History API), not starting")},e.prototype.teardown=function(){var e,t;this.takePendingNavigations(),this.undoHistoryPatch&&(this.undoHistoryPatch(),this.undoHistoryPatch=null),this.active=!1,e=this,(t=Ut())&&t.tracker===e&&(t.tracker=void 0)},e.prototype.readCustomQueryParams=function(){var e=this.mpInstance._Store.SDKConfig.autoLogPageViewQueryParams||{},t=e.allowed,n=void 0===t?[]:t,r=e.rejectedPositions,i=void 0===r?[]:r,o=e.overLimit,s=void 0===o?0:o;return i.length&&this.mpInstance.Logger.warning("mParticle APV: ignoring invalid additional page view query "+"parameters at positions ".concat(i.join(", "))),s&&this.mpInstance.Logger.warning("mParticle APV: ignoring ".concat(s," additional page view ")+"query parameters beyond the limit of "+"".concat(25)),n.length&&this.log("[init] additional query params: ".concat(n.join())),n},e.prototype.retire=function(e){if(!e)return[];this.log(e===this?"[init] retiring this tracker for a repeat mParticle.init() \u2014 transferring pending navigations and tearing down":"[init] retiring a tracker from a previous module load \u2014 transferring pending navigations and tearing down");var t=e.takePendingNavigations();return e.teardown(),t},e.prototype.takePendingNavigations=function(){var e=this.pendingNavigations;return this.pendingNavigations=[],e.forEach((function(e){var t=e.timeoutId;return clearTimeout(t)})),e.map((function(e){return e.page}))},e.prototype.safeHandleNavigation=function(e){if(this.active)try{this.handleNavigation(e)}catch(t){this.log("[error] navigation handler threw (".concat(e,"), page view skipped: ").concat(t))}},e.prototype.handleNavigation=function(e){var t=Kt(this.customQueryParams),n=this.lastPage?Lt(this.lastPage):null;this.log("[detect] navigation signal (source: ".concat(e,", candidate: ").concat(Bt(t),", last: ").concat(Bt(this.lastPage),")")),function(e,t){return t!==e}(n,Lt(t))?(this.log("[accept] page changed, scheduling fire (source: ".concat(e,", from: ").concat(Bt(this.lastPage),", to: ").concat(Bt(t),")")),this.lastPage=t,this.scheduleFire(t)):this.log("[dedupe] page unchanged, skipping (source: ".concat(e,", page: ").concat(Bt(t),")"))},e.prototype.scheduleFire=function(e){var t=this,n=setTimeout((function(){t.pendingNavigations=t.pendingNavigations.filter((function(e){return e.timeoutId!==n})),t.active?(t.mpInstance._SessionManager.resetSessionTimer(),t.firePageView(e)):t.log("[defer] fire aborted, tracker inactive (torn down before flush)")}),0);this.pendingNavigations.push({page:e,timeoutId:n})},e.prototype.firePageView=function(e){var t=window.document.title,n=function(e){var t=e.params,n=e.hostname,r=e.title,i=e.path,o=e.isAutoPageView;return{messageType:oe.PageView,name:"PageView",data:p(p(p({},Ot(t)),{hostname:n,title:r,path:i}),Mt(o)),eventType:se.Unknown}}(p(p({},e),{hostname:window.location.hostname,title:t,isAutoPageView:this.isAutoPageView}));this.log("[fire] deferred flush -> _Events.logEvent(PageView) (page: ".concat(Bt(e),", title: ").concat(t,")")),this.mpInstance._Events.logEvent(n)},e.prototype.log=function(e){this.mpInstance.Logger.verbose("mParticle APV: ".concat(e))},e}(),jt="path",zt="full",Qt=["utm_source","utm_medium","utm_campaign","utm_term","utm_content","utm_id","utm_source_platform","utm_creative_format","utm_marketing_tactic","gad_source","gad_campaignid","mc_cid","gclid","gbraid","wbraid","fbclid","msclkid","ttclid","twclid","li_fat_id","dclid","srsltid","epik","ScCid","irclickid","rtid","rclid"].map((function(e){return e.toLowerCase()})),Wt=function(e){return function(e){return Pt(e)||Tt(e.toLowerCase())}(e)||-1!==Qt.indexOf(e.toLowerCase())},Jt=["client_id","redirect_uri","response_type","scope","state","code","nonce"],Gt=Jt.concat(["access_token","id_token","refresh_token","provider_token","provider_refresh_token"]),$t=["ref","referrer"],Yt=/^((?:[a-z][a-z0-9+.-]*:)?\/\/)[^/]*@/i,Xt=function(e){return decodeURIComponent(e.replace(/\+/g," "))},Zt=function(e){var t,n=e.indexOf("="),r=-1===n?e:e.slice(0,n);try{t=Xt(r)}catch(e){return null}var i,o=t.toLowerCase();if(!t||!Wt(t)||-1!==Jt.indexOf(o))return null;if(-1===n||-1===$t.indexOf(o))return e;try{i=Xt(e.slice(n+1))}catch(e){return null}var s=nn(i,jt);return s===i?e:"".concat(r,"=").concat(encodeURIComponent(s))},en=function(e){return e.split("&").map(Zt).filter((function(e){return null!==e})).join("&")},tn=function(e){try{var t=Xt(e.split("=")[0]);return-1===Gt.indexOf(t.toLowerCase())}catch(e){return!1}},nn=function(e,t){if("string"!=typeof e||!e)return"";var n=e.indexOf("#"),r=-1===n?"":e.slice(n),i=-1===n?e:e.slice(0,n),o=i.indexOf("?"),s=(-1===o?i:i.slice(0,o)).replace(Yt,"$1");if(t!==zt)return s;var a=-1===o?"":en(i.slice(o+1));return s+(a?"?".concat(a):"")+function(e){var t=e.indexOf("?"),n=-1===t?e:e.slice(0,t);if((/^#[/!]/.test(e)||-1!==t&&-1===n.indexOf("="))&&-1!==t){var r=en(e.slice(t+1));return n+(r?"?".concat(r):"")}if(-1===e.indexOf("="))return e;var i=e.slice(1).split("&").filter(tn).join("&");return i?"#".concat(i):""}(r)},rn=function(){return nn(X(),zt)};!function(e){e.Success="Success",e.QuotaExceeded="QuotaExceeded",e.Unavailable="Unavailable"}(lt||(lt={}));var on=function(){function e(e,t){this._storageKey=e,this.storageObject=t,this.contents=this.retrieve()}return e.prototype.store=function(e){var t;try{return t=H(e)||!z(e)?JSON.stringify(e):"",this.storageObject.setItem(this._storageKey,t),this.contents=e,lt.Success}catch(e){return function(e){return e instanceof DOMException&&(22===e.code||1014===e.code||"QuotaExceededError"===e.name||"NS_ERROR_DOM_QUOTA_REACHED"===e.name)}(e)?lt.QuotaExceeded:lt.Unavailable}},e.prototype.retrieve=function(){try{var e=this.storageObject.getItem(this._storageKey);this.contents=e?JSON.parse(e):null}catch(e){this.contents=null}return this.contents},e.prototype.purge=function(){this.contents=null;try{this.storageObject.removeItem(this._storageKey)}catch(e){}},e}(),sn=function(e){function t(t){return e.call(this,t,window.localStorage)||this}return d(t,e),t}(on),an=function(e){function t(t){return e.call(this,t,window.sessionStorage)||this}return d(t,e),t}(on),un=function(e){function t(t){var n=e.call(this,t,window.localStorage)||this;return n.contents=null,n.storageObject.removeItem(n._storageKey),n}return d(t,e),t.prototype.store=function(e){return this.contents=null,lt.Success},t.prototype.retrieve=function(){return this.contents},t.prototype.purge=function(){this.contents=null},t}(on),cn=function(e){this.url=e},ln=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return d(t,e),t.prototype.upload=function(e,t){return g(this,void 0,void 0,(function(){var n;return h(this,(function(r){switch(r.label){case 0:return n=t||this.url,[4,fetch(n,e)];case 1:return[2,r.sent()]}}))}))},t}(cn),dn=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return d(t,e),t.prototype.upload=function(e){return g(this,void 0,void 0,(function(){return h(this,(function(t){switch(t.label){case 0:return[4,this.makeRequest(this.url,e.body,e.method,e.headers)];case 1:return[2,t.sent()]}}))}))},t.prototype.makeRequest=function(e,t,n,r){return void 0===n&&(n="post"),void 0===r&&(r={}),g(this,void 0,void 0,(function(){var i;return h(this,(function(o){return i=new XMLHttpRequest,[2,new Promise((function(o,s){for(var a in i.onreadystatechange=function(){4===i.readyState&&o(i)},i.onerror=function(){s(i)},i.open(n,e),r)r.hasOwnProperty(a)&&i.setRequestHeader(a,r[a]);i.send(t)}))]}))}))},t}(cn);function pn(e,t){if(t){if(!e)return t.MPID=null,t.ConsentState=null,t.UserAttributes=null,void(t.UserIdentities=null);if(!t.MPID||t.MPID!==e.getMPID()){t.MPID=e.getMPID(),t.ConsentState=e.getConsentState(),t.UserAttributes=e.getAllUserAttributes();var n=e.getUserIdentities().userIdentities,r={};for(var i in n){var o=me.IdentityType.getIdentityType(i);!1!==o&&(r[o]=n[i])}var s=[];if(P(r)&&Object.keys(r).length)for(var a in r){var u={};u.Identity=r[a],u.Type=C(a),s.push(u)}t.UserIdentities=s}}}var gn=function(){function e(t,n){var r,i,o;this.offlineStorageEnabled=!1,this.lastASTEventTime=0,this.AST_DEBOUNCE_MS=1e3,this.uploadIntervalTimerId=null,this.exitHandler=null,this.visibilityChangeHandler=null,this.destroyed=!1,this.batchOrder=new Map,this.nextBatchOrder=0,this.mpInstance=t,this.uploadIntervalMillis=n,this.batchingEnabled=n>=e.MINIMUM_INTERVAL_MILLIS,this.uploadIntervalMillis<e.MINIMUM_INTERVAL_MILLIS&&(this.uploadIntervalMillis=e.MINIMUM_INTERVAL_MILLIS),this.eventsQueuedForProcessing=[],this.batchesQueuedForProcessing=[],this.offlineStorageEnabled=this.isOfflineStorageAvailable();var s=null===(i=t._CookieConsentManager)||void 0===i?void 0:i.getNoFunctional();this.offlineStorageEnabled&&!s&&(this.eventVault=new an("".concat(t._Store.storageName,"-events")),this.batchVault=new sn("".concat(t._Store.storageName,"-batches")),(r=this.eventsQueuedForProcessing).push.apply(r,null!==(o=this.eventVault.retrieve())&&void 0!==o?o:[]));var a=this.mpInstance._Store,u=a.SDKConfig,c=a.devToken,l=this.mpInstance._Helpers.createServiceUrl(u.v3SecureServiceUrl,c);this.uploadUrl="".concat(l,"/events"),this.uploader=window.fetch?new ln(this.uploadUrl):new dn(this.uploadUrl),this.triggerUploadInterval(!0,!1),this.addEventListeners()}return e.prototype.destroy=function(){this.destroyed=!0,null!==this.uploadIntervalTimerId&&(clearTimeout(this.uploadIntervalTimerId),this.uploadIntervalTimerId=null),this.visibilityChangeHandler&&document.removeEventListener("visibilitychange",this.visibilityChangeHandler),this.exitHandler&&(window.removeEventListener("beforeunload",this.exitHandler),window.removeEventListener("pagehide",this.exitHandler)),this.exitHandler=null,this.visibilityChangeHandler=null},e.prototype.isOfflineStorageAvailable=function(){var e=this.mpInstance,t=e._Helpers.getFeatureFlag,n=e._Store.deviceId,i=t(r.FeatureFlags.OfflineStorage);return parseInt(i,10)>=function(e){if(!e)return 100;var t=_(e);return Math.abs(t%100)+1}(n)},e.prototype.shouldDebounceAndUpdateLastASTTime=function(){var e=Date.now();return e-this.lastASTEventTime<this.AST_DEBOUNCE_MS||(this.lastASTEventTime=e,!1)},e.prototype.createBackgroundASTEvent=function(){var e,t=Date.now(),n=this.mpInstance,i=n._Store,o=n.Identity,s=n._timeOnSiteTimer,a=n._Helpers,u=i.sessionId,c=i.deviceId,l=i.sessionStartDate,d=i.SDKConfig,g=a.generateUniqueId,h=a.getFeatureFlag,v=o.getCurrentUser,f={AppName:d.appName,AppVersion:d.appVersion,Package:d.package,EventDataType:oe.AppStateTransition,Timestamp:t,SessionId:u,DeviceId:c,IsFirstRun:!1,SourceMessageId:g(),SDKVersion:r.sdkVersion,CustomFlags:{},EventAttributes:{},SessionStartDate:(null==l?void 0:l.getTime())||t,Debug:d.isDevelopmentMode,ActiveTimeOnSite:(null==s?void 0:s.getTimeInForeground())||0,TotalTimeOnSite:(null===(e=i.getTotalTimeOnSite)||void 0===e?void 0:e.call(i))||0,PageUrl:rn()||null,IsBackgroundAST:!0},m=p({},f.CustomFlags),y=i.integrationAttributes;if(Qe(h)){this.mpInstance._IntegrationCapture.capture();var b=this.mpInstance._IntegrationCapture.getClickIdsAsCustomFlags();m=p(p({},b),m);var S=this.mpInstance._IntegrationCapture.getClickIdsAsIntegrationAttributes();y=p(p({},S),y)}return f.CustomFlags=m,f.IntegrationAttributes=y,pn(v(),f),f},e.prototype.addEventListeners=function(){var e=this,t=this,n=function(){if((0,e.mpInstance._Helpers.getFeatureFlag)(r.FeatureFlags.AstBackgroundEvents)){if(t.shouldDebounceAndUpdateLastASTTime())return;var n=t.createBackgroundASTEvent();t.queueEvent(n)}t.prepareAndUpload(!1,t.isBeaconAvailable())};this.exitHandler=n,this.visibilityChangeHandler=function(){"hidden"===document.visibilityState&&n()},document.addEventListener("visibilitychange",this.visibilityChangeHandler),window.addEventListener("beforeunload",n),window.addEventListener("pagehide",n)},e.prototype.isBeaconAvailable=function(){return!!navigator.sendBeacon},e.prototype.triggerUploadInterval=function(e,t){var n=this;void 0===e&&(e=!1),void 0===t&&(t=!1),this.uploadIntervalTimerId=setTimeout((function(){n.prepareAndUpload(e,t)}),this.uploadIntervalMillis)},e.prototype.queueEvent=function(e){if(!z(e)){if(this.eventsQueuedForProcessing.push(e),this.offlineStorageEnabled&&this.eventVault&&this.eventVault.store(this.eventsQueuedForProcessing),this.mpInstance.Logger.isVerbose()){var t=ne(e,this.mpInstance._Store.SDKConfig.isDevelopmentMode);this.mpInstance.Logger.verbose("Queuing event: ".concat(JSON.stringify(t))),this.mpInstance.Logger.verbose("Queued event count: ".concat(this.eventsQueuedForProcessing.length))}this.shouldTriggerImmediateUpload(e.EventDataType)&&this.prepareAndUpload(!1,!1)}},e.prototype.shouldTriggerImmediateUpload=function(e){var t=[oe.Commerce,oe.UserIdentityChange];return!this.batchingEnabled||t.includes(e)},e.createNewBatches=function(e,t,n){if(!t||!e||!e.length)return null;for(var r=[],i=new Map,o=0,s=e;o<s.length;o++){if(!(f=s[o]).MPID){var a=t.getMPID();f.MPID=a}(v=i.get(f.MPID))||(v=[]),v.push(f),i.set(f.MPID,v)}for(var u=0,c=Array.from(i.entries());u<c.length;u++){for(var l=c[u],d=(a=l[0],l[1]),p=new Map,g=0,h=d;g<h.length;g++){var v,f=h[g];(v=p.get(f.SessionId))||(v=[]),v.push(f),p.set(f.SessionId,v)}for(var m=0,y=Array.from(p.entries());m<y.length;m++){var b=Je(a,y[m][1],n),S=n._Store.SDKConfig.onCreateBatch;S&&((b=S(b))?b.modified=!0:n.Logger.warning("Skiping batch upload because no batch was returned from onCreateBatch callback")),b&&r.push(b)}}return r},e.prototype.prepareAndUpload=function(t,n){var r;return void 0===t&&(t=!1),void 0===n&&(n=!1),g(this,void 0,void 0,(function(){var i,o,s,a,u,c,l,d,p,g=this;return h(this,(function(h){switch(h.label){case 0:return i=this.mpInstance.Identity.getCurrentUser(),o=this.eventsQueuedForProcessing,this.eventsQueuedForProcessing=[],this.offlineStorageEnabled&&this.eventVault&&this.eventVault.store([]),s=[],z(o)||(s=e.createNewBatches(o,i,this.mpInstance)),this.offlineStorageEnabled&&this.batchVault&&((l=this.batchesQueuedForProcessing).unshift.apply(l,null!==(r=this.batchVault.retrieve())&&void 0!==r?r:[]),this.batchVault.purge()),z(s)||(d=this.batchesQueuedForProcessing).push.apply(d,s),a=this.batchesQueuedForProcessing,this.batchesQueuedForProcessing=[],a.forEach((function(e){g.batchOrder.has(e.source_request_id)||g.batchOrder.set(e.source_request_id,g.nextBatchOrder++)})),[4,this.uploadBatches(a,n)];case 1:return u=h.sent(),c=(u||[]).map((function(e){return e.source_request_id})),a.forEach((function(e){-1===c.indexOf(e.source_request_id)&&g.batchOrder.delete(e.source_request_id)})),z(u)||(p=this.batchesQueuedForProcessing).unshift.apply(p,u),!n&&this.offlineStorageEnabled&&this.batchVault&&this.storeBatchesQueuedForProcessing(),t&&!this.destroyed&&this.triggerUploadInterval(t,!1),[2]}}))}))},e.prototype.storeBatchesQueuedForProcessing=function(){var e,t=this,n=function(e){var n;return null!==(n=t.batchOrder.get(e.source_request_id))&&void 0!==n?n:-1},r=v(v([],this.batchesQueuedForProcessing,!0),null!==(e=this.batchVault.retrieve())&&void 0!==e?e:[],!0).sort((function(e,t){var r,i;return n(e)-n(t)||(null!==(r=e.timestamp_unixtime_ms)&&void 0!==r?r:0)-(null!==(i=t.timestamp_unixtime_ms)&&void 0!==i?i:0)}));if(z(r))return this.batchVault.store([]),void(this.batchesQueuedForProcessing=[]);for(var i=0;i<r.length;i++){var o=this.batchVault.store(r.slice(i));if(o===lt.Success)return this.logDroppedOfflineBatches(i),void(this.batchesQueuedForProcessing=[]);if(o===lt.Unavailable)return void this.mpInstance.Logger.warning("Offline batch storage is unavailable. Retaining batches in memory.")}this.mpInstance.Logger.warning("Offline batch storage is over quota. Retaining batches in memory.")},e.prototype.logDroppedOfflineBatches=function(e){e>0&&this.mpInstance.Logger.warning("Offline batch storage is over quota. Dropped "+"".concat(e," oldest batch(es)."))},e.prototype.uploadBatches=function(t,n){return g(this,void 0,void 0,(function(){var r,i,o,s,a,u,c;return h(this,(function(l){switch(l.label){case 0:if(r=t.filter((function(e){return!z(e.events)})),z(r))return[2,null];this.mpInstance.Logger.isVerbose()&&(i=ne(r,this.mpInstance._Store.SDKConfig.isDevelopmentMode),this.mpInstance.Logger.verbose("Uploading batches: ".concat(JSON.stringify(i))),this.mpInstance.Logger.verbose("Batch count: ".concat(r.length))),o=0,l.label=1;case 1:return o<r.length?(s={method:"POST",headers:{Accept:e.CONTENT_TYPE,"Content-Type":"text/plain;charset=UTF-8"},body:JSON.stringify(r[o])},n&&this.isBeaconAvailable()?(a=new Blob([s.body],{type:"text/plain;charset=UTF-8"}),navigator.sendBeacon(this.uploadUrl,a),[3,5]):[3,2]):[3,6];case 2:return l.trys.push([2,4,,5]),[4,this.uploader.upload(s)];case 3:if(!((u=l.sent()).status>=200&&u.status<300)){if(u.status>=500||429===u.status)return this.mpInstance.Logger.error("HTTP error status ".concat(u.status," received")),[2,r.slice(o,r.length)];if(u.status>=401)return this.mpInstance.Logger.error("HTTP error status ".concat(u.status," while uploading - please verify your API key.")),[2,null];throw console.error("HTTP error status ".concat(u.status," while uploading events."),u),new Error("Uncaught HTTP Error ".concat(u.status,". Batch upload will be re-attempted."))}return this.mpInstance.Logger.verbose("Upload success for request ID: ".concat(r[o].source_request_id)),[3,5];case 4:return c=l.sent(),this.mpInstance.Logger.error("Error sending event to mParticle servers. ".concat(c)),[2,r.slice(o,r.length)];case 5:return o++,[3,1];case 6:return[2,null]}}))}))},e.CONTENT_TYPE="text/plain;charset=UTF-8",e.MINIMUM_INTERVAL_MILLIS=500,e}(),hn={UNKNOWN_ERROR:"UNKNOWN_ERROR",UNHANDLED_EXCEPTION:"UNHANDLED_EXCEPTION",IDENTITY_REQUEST:"IDENTITY_REQUEST",IDENTITY_MISMATCH:"IDENTITY_MISMATCH",MP_DEPRECATED_METHOD_USAGE:"MP_DEPRECATED_METHOD_USAGE"},vn={ERROR:"ERROR",INFO:"INFO",WARNING:"WARNING"},fn=r.IdentityMethods.Modify,mn={isNumber:H,isFunction:K,isStringOrNumber:j,isValidAttributeValue:function(e){return void 0!==e&&!P(e)&&!Array.isArray(e)},isValidKeyValue:function(e){return Boolean(e&&!P(e)&&!Array.isArray(e)&&!this.isFunction(e))},removeFalsyIdentityValues:function(e,t){if(!e||!e.userIdentities)return e;var n={},r=p({},e.userIdentities);for(var i in e.userIdentities)if(e.userIdentities.hasOwnProperty(i)){var o=e.userIdentities[i];null===o||o||(t.warning("Identity value for '".concat(i,"' is falsy (").concat(o,"). This value will be removed from the request.")),delete r[i])}return n.userIdentities=r,n},validateIdentities:function(e,t){var n={userIdentities:1,onUserAlias:1,copyUserAttributes:1};if(e){if(t===fn&&(P(e.userIdentities)&&!Object.keys(e.userIdentities).length||!P(e.userIdentities)))return{valid:!1,error:r.Messages.ValidationMessages.ModifyIdentityRequestUserIdentitiesPresent};for(var i in e)if(e.hasOwnProperty(i)){if(!n[i])return{valid:!1,error:r.Messages.ValidationMessages.IdentityRequesetInvalidKey};if("onUserAlias"===i&&!mn.isFunction(e[i]))return{valid:!1,error:r.Messages.ValidationMessages.OnUserAliasType}}if(0===Object.keys(e).length)return{valid:!0};if(void 0===e.userIdentities)return{valid:!1,error:r.Messages.ValidationMessages.UserIdentities};if(null!==e.userIdentities&&!P(e.userIdentities))return{valid:!1,error:r.Messages.ValidationMessages.UserIdentities};if(P(e.userIdentities)&&Object.keys(e.userIdentities).length)for(var o in e.userIdentities)if(e.userIdentities.hasOwnProperty(o)){if(!1===me.IdentityType.getIdentityType(o))return{valid:!1,error:r.Messages.ValidationMessages.UserIdentitiesInvalidKey};if("string"!=typeof e.userIdentities[o]&&null!==e.userIdentities[o])return{valid:!1,error:r.Messages.ValidationMessages.UserIdentitiesInvalidValues}}}return{valid:!0}}},yn=r.HTTPCodes,bn=r.IdentityMethods,Sn=bn.Identify,In=bn.Modify,_n=bn.Login,wn=bn.Logout,Pn=r.HTTPCodes,Cn=r.Messages,An="x-mp-max-age",Tn=function(e,t,n,r,i){if(!i){var o=Fn(null==r?void 0:r.cacheMaxAge);switch(e){case _n:case Sn:kn(e,t,o,n,r);break;case In:case wn:n.purge()}}},kn=function(e,t,n,r,i){var o=i.responseText,s=i.status,a=r.retrieve()||{},u=_(En(e,t)),c={mpid:o.mpid,is_logged_in:o.is_logged_in};a[u]={responseText:JSON.stringify(c),status:s,expireTimestamp:n},r.store(a)},En=function(e,t){var n="device_application_stamp",r="".concat(e,":").concat(n,"=").concat(t.device_application_stamp,";"),i="";if(Object.keys(t).length){var o=new Array;for(var s in t)s!==n&&(o[me.IdentityType.getIdentityType(s)]=t[s]);i=o.reduce((function(e,t,n){var r=me.IdentityType.getIdentityName(n);return"".concat(e).concat(r,"=").concat(t,";")}),r)}return i},Dn=function(e,t,n){var r=_(En(e,t)),i=n.retrieve(),o=i?i[r]:null;return{responseText:Un(o.responseText),expireTimestamp:o.expireTimestamp,status:o.status}},On=function(e,t){var n={};if(P(null==e?void 0:e.userIdentities))for(var r in e.userIdentities)n[r]=e.userIdentities[r];return n.device_application_stamp=t,n},Mn=function(e){var t=e.retrieve()||{},n=(new Date).getTime();for(var r in t)t[r].expireTimestamp<n&&delete t[r];e.store(t)},Ln=function(e,t,n,r,i,o,s){var a=function(e,t,n){var r=null==n?void 0:n.retrieve();if(!r)return!1;var i=_(En(e,t));return!(!W(r,i)||r[i].expireTimestamp<(new Date).getTime())}(s,e,t);return!!a&&(n(Dn(s,e,t),r,i,o,s,e,!0),!0)},Fn=function(e){return void 0===e&&(e=86400),(new Date).getTime()+1e3*e},Un=function(e){return e?JSON.parse(e):{}},Nn={email_sha256:"other",mobile_sha256:"other2"},Rn=function(e){var t=p({},e);return Object.keys(Nn).forEach((function(e){if(e in t){var n=t[e];delete t[e],t[Nn[e]]=n}})),t},Vn=function(e,t){if(!e||!(null==t?void 0:t.userIdentities))return!1;var n,r,i,o,s=e.getUserIdentities().userIdentities,a=Rn(t.userIdentities);return n=s,r=a,i=Object.keys(null!=n?n:{}),o=Object.keys(null!=r?r:{}),!(i.length===o.length&&i.every((function(e){return n[e]===r[e]})))},xn=function(e){var t,n,r,i=null===(n=null===(t=null==e?void 0:e.SDKConfig)||void 0===t?void 0:t.identifyRequest)||void 0===n?void 0:n.userIdentities;return!(!i||!P(i)||z(i)||!Object.values(i).some(Boolean))||!!(null===(r=null==e?void 0:e.SDKConfig)||void 0===r?void 0:r.deviceId)},Hn=function(e,t,n,i){var s=e._Helpers,a=e._Store,u=e.Logger,c=e._ErrorReportingDispatcher,l=a.SDKConfig,d=l.identityUrl,v=l.isDevelopmentMode;if(s.canLog()){var f=s.createServiceUrl(d),m=v?"development":"production";!function(e,t,n,r,i,s,a,u){g(void 0,void 0,void 0,(function(){var c,l,d,g,v,f,m,y,b,S,I,_;return h(this,(function(h){switch(h.label){case 0:if(!K(i))return s.error("search called without a callback function; skipping request."),[2];if(c=function(e){try{i(e)}catch(e){s.error("Error invoking search callback: "+ie(e))}},l=mn.removeFalsyIdentityValues({userIdentities:null!=e?e:{}},s).userIdentities,!Object.values(null!=l?l:{}).some((function(e){return"string"==typeof e&&e.length>0})))return s.verbose("Identity search called with empty identifiers; skipping request."),c({httpCode:yn.noHttpCoverage}),[2];if(!t)return s.verbose("search called without a workspace API key; skipping request."),c({httpCode:yn.noHttpCoverage}),[2];h.label=1;case 1:return h.trys.push([1,9,,10]),d=n(),g=p(p({},d),{known_identities:p({},l)}),v={method:"post",headers:{Accept:"application/json","Content-Type":"application/json","x-mp-key":t},body:JSON.stringify(g)},f=a||(window.fetch?new ln(r):new dn(r)),s.verbose("Sending search request to "+r),[4,f.upload(v,r)];case 2:if(m=h.sent(),y=void 0,!K(m.json))return[3,7];h.label=3;case 3:return h.trys.push([3,5,,6]),[4,m.json()];case 4:return y=h.sent(),[3,6];case 5:return h.sent(),s.verbose("search response had no parseable JSON body."),[3,6];case 6:return[3,8];case 7:if(null==(b=m)?void 0:b.responseText)try{y=JSON.parse(b.responseText)}catch(e){s.verbose("search XHR response was not valid JSON.")}h.label=8;case 8:return m.status===o?s.verbose("search received 200 OK."):404===m.status?s.verbose("search received 404 (no match)."):s.verbose("search received non-success status "+m.status),c({httpCode:m.status,body:y}),[3,10];case 9:return S=h.sent(),I=ie(S),_="Error sending search request: "+I,s.error(_),null==u||u.report({message:_,code:hn.IDENTITY_REQUEST,severity:vn.ERROR}),c({httpCode:yn.noHttpCoverage}),[3,10];case 10:return[2]}}))}))}(n,t,(function(){return function(e){return{client_sdk:{platform:r.platform,sdk_vendor:r.sdkVendor,sdk_version:r.sdkVersion},environment:e,request_id:w(),request_timestamp_ms:Date.now()}}(m)}),f+"search?cb=1",i,u,void 0,c)}else if(u.verbose(Cn.InformationMessages.AbandonLogEvent),K(i))try{i({httpCode:Pn.loggingDisabledOrMissingAPIKey})}catch(e){u.error("Error invoking search callback: "+ie(e))}};function Kn(e,t){this.uploader=null;var n=this;this.queueEventForBatchUpload=function(t){if(!this.uploader){var n=C(e._Helpers.getFeatureFlag(r.FeatureFlags.EventBatchingIntervalMillis));this.uploader=new gn(e,n)}this.uploader.queueEvent(t),e._Persistence.update()},this.processQueuedEvents=function(){var t,r=e.Identity.getCurrentUser();if(r&&(t=r.getMPID()),e._Store.eventQueue.length&&t){var i=e._Store.eventQueue;e._Store.eventQueue=[],this.appendUserInfoToEvents(r,i),i.forEach((function(e){n.sendEventToServer(e)}))}},this.appendUserInfoToEvents=function(e,t){t.forEach((function(t){t.MPID||pn(e,t)}))};this.sendEventToServer=function(n,i){var o=re({shouldUploadEvent:!0},i);if(e._Store.webviewBridgeEnabled)e._NativeSdkHelpers.sendToNative(r.NativeSdkPaths.LogEvent,JSON.stringify(n));else{var s,a=e.Identity.getCurrentUser();if(a&&(s=a.getMPID()),e._Store.requireDelay=e._Helpers.isDelayedByIntegration(e._preInit.integrationDelays,e._Store.integrationDelayTimeoutStart,Date.now()),!function(n,r){var i;if(!(null===(i=e._CookieConsentManager)||void 0===i?void 0:i.getNoFunctional())||xn(e._Store)||r||!e._Store.configurationLoaded||e._Store.requireDelay)return!1;var o=n;return(null==t?void 0:t.kitBlockingEnabled)&&(o=t.createBlockedEvent(n)),o&&(e._Forwarders.sendEventToForwarders(o),n.AlreadySentToForwarders=!0),e.Logger.verbose("noFunctional event forwarded to kits and queued for MP server upload when MPID is available."),e._Store.eventQueue.push(n),!0}(n,s)){if(!s||e._Store.requireDelay||!e._Store.configurationLoaded)return e.Logger.verbose("Event was added to eventQueue. eventQueue will be processed once a valid MPID is returned or there is no more integration imposed delay."),void e._Store.eventQueue.push(n);this.processQueuedEvents(),z(n)||(o.shouldUploadEvent&&this.queueEventForBatchUpload(n),n.EventName!==String(me.MessageType.AppStateTransition)&&(t&&t.kitBlockingEnabled&&(n=t.createBlockedEvent(n)),n&&!n.AlreadySentToForwarders&&e._Forwarders.sendEventToForwarders(n)))}}},this.sendBatchForwardingStatsToServer=function(t,n){var r,i;try{r=e._Helpers.createServiceUrl(e._Store.SDKConfig.v2SecureServiceUrl,e._Store.devToken),i={uuid:e._Helpers.generateUniqueId(),data:t},n&&(n.open("post",r+"/Forwarding"),n.send(JSON.stringify(i)))}catch(t){e.Logger.error("Error sending forwarding stats to mParticle servers.")}},this.initializeForwarderStatsUploader=function(){var t=e._Store.SDKConfig.v1SecureServiceUrl,n=e._Store.devToken,r="https://".concat(t).concat(n,"/Forwarding");return window.fetch?new ln(r):new dn(r)},this.prepareForwardingStats=function(t,n){var i,o=e._Forwarders.getForwarderStatsQueue();if(t&&t.isVisible){i={mid:t.id,esid:t.eventSubscriptionId,n:n.EventName,attrs:n.EventAttributes,sdk:n.SDKVersion,dt:n.EventDataType,et:n.EventCategory,dbg:n.Debug,ct:n.Timestamp,eec:n.ExpandedEventCount,dp:n.DataPlan};var s=e._Forwarders,a=s.sendSingleForwardingStatsToServer,u=s.setForwarderStatsQueue;e._Helpers.getFeatureFlag(r.FeatureFlags.ReportBatching)?(o.push(i),u(o)):a(i)}}}var Bn=function(){function e(){}var t;return e.hashEventType=function(e){return _(e)},e.hashEventName=function(e,t){return _(t+e)},e.hashEventAttributeKey=function(e,t,n){return _(e+t+n)},e.hashUserAttribute=function(e){return _(e)},e.hashUserIdentity=function(e){return e},e.hashConsentPurpose=function(e,t){return _(e+t)},e.hashAttributeConditionalForwarding=function(e){return _(e).toString()},e.hashConsentPurposeConditionalForwarding=function(e,t){return this.hashConsentPurpose(e,t).toString()},t=e,e.filterUserAttributes=function(e,n){return Z(e,n,(function(e){return t.hashUserAttribute(e)}))},e.filterUserIdentities=function(e,n){return Z(e,n,(function(e){return t.hashUserIdentity(ue.getIdentityType(e))}))},e.isFilteredUserAttribute=function(e,n){var r=t.hashUserAttribute(e);return n&&b(n,r)},e}(),qn=r.StorageNames;function jn(e,t,n){n===me.IdentityType.CustomerId?e.unshift(t):e.push(t)}function zn(e){var t=this;this.canLog=function(){return!(!e._Store.isEnabled||!e._Store.devToken&&!e._Store.webviewBridgeEnabled)},this.getFeatureFlag=function(t){return e._Store.SDKConfig.flags.hasOwnProperty(t)?e._Store.SDKConfig.flags[t]:null},this.invokeCallback=function(n,r,i,o,s){n||e.Logger.warning("There is no callback provided");try{t.Validators.isFunction(n)&&n({httpCode:r,body:i,getUser:function(){return o||e.Identity.getCurrentUser()},getPreviousUser:function(){if(s)return(null==(r=o||e.Identity.getCurrentUser())?void 0:r.getMPID())===s?null:e.Identity.getUser(s);var t=e.Identity.getUsers(),n=t.shift(),r=o||e.Identity.getCurrentUser();return n&&r&&n.getMPID()===r.getMPID()&&(n=t.shift()),n||null}})}catch(t){e.Logger.error("There was an error with your callback: "+t)}},this.invokeAliasCallback=function(n,r,i){n||e.Logger.warning("There is no callback provided");try{if(t.Validators.isFunction(n)){var o={httpCode:r};i&&(o.message=i),n(o)}}catch(t){e.Logger.error("There was an error with your callback: "+t)}},this.extend=re,this.createServiceUrl=function(t,n){var r,i=window.mParticle&&e._Store.SDKConfig.forceHttps?"https://":window.location.protocol+"//";return r=e._Store.SDKConfig.forceHttps?"https://"+t:i+t,n&&(r+=n),r},this.createXHR=function(t){var n;try{n=new window.XMLHttpRequest}catch(t){e.Logger.error("Error creating XMLHttpRequest object.")}if(n&&t&&"withCredentials"in n)n.onreadystatechange=t;else if(void 0!==window.XDomainRequest){e.Logger.verbose("Creating XDomainRequest object");try{(n=new window.XDomainRequest).onload=t}catch(t){e.Logger.error("Error creating XDomainRequest object")}}return n},this.filterUserIdentities=function(e,n){return function(e,t,n){var r=[];if(!e||!Object.keys(e).length)return r;for(var i in e)if(e.hasOwnProperty(i)){var o=me.IdentityType.getIdentityType(i);!1===o||n(t,o)||jn(r,{Type:o,Identity:e[i]},o)}return r}(e,n,t.inArray)},this.filterUserIdentitiesForForwarders=Bn.filterUserIdentities,this.filterUserAttributes=Bn.filterUserAttributes,this.isEventType=function(e){for(var t in me.EventType)if(me.EventType.hasOwnProperty(t)&&me.EventType[t]===e)return!0;return!1},this.sanitizeAttributes=function(n,r){if(!n||!t.isObject(n))return null;var i={};for(var o in n)n.hasOwnProperty(o)&&t.Validators.isValidAttributeValue(n[o])?i[o]=n[o]:e.Logger.warning("For '"+r+"', the corresponding attribute value of '"+o+"' must be a string, number, boolean, or null.");return i},this.isDelayedByIntegration=function(t,n,r){if(r-n>e._Store.SDKConfig.integrationDelayTimeout)return!1;for(var i in t)if(!0===t[i])return!0;return!1},this.createMainStorageName=function(e){return e?qn.currentStorageName+"_"+e:qn.currentStorageName},this.converted=V,this.findKeyInObject=S,this.parseNumber=C,this.inArray=b,this.isObject=P,this.decoded=R,this.parseStringOrNumber=A,this.generateHash=_,this.generateUniqueId=w,this.Validators=mn}var Qn=r.Messages,Wn="mParticleAndroid",Jn="mParticle";function Gn(e){if(Object.prototype.hasOwnProperty.call(window,e))return window[e]}function $n(e){var t=this;this.initializeSessionAttributes=function(e){var n=r.NativeSdkPaths.SetSessionAttribute,i=JSON.stringify({key:"$src_env",value:"webview"}),o=JSON.stringify({key:"$src_key",value:e});t.sendToNative(n,i),e&&t.sendToNative(n,o)},this.isBridgeV2Available=function(e){var t,n;if(!e)return!1;var r=Wn+"_"+e+"_v2",i=Jn+"_"+e+"_v2";return!!(null===(n=null===(t=window.webkit)||void 0===t?void 0:t.messageHandlers)||void 0===n?void 0:n.hasOwnProperty(i))||(!(!window.mParticle||!window.mParticle.uiwebviewBridgeName||window.mParticle.uiwebviewBridgeName!==i)||!!window.hasOwnProperty(r))},this.isWebviewEnabled=function(n,r){return e._Store.bridgeV2Available=t.isBridgeV2Available(n),e._Store.bridgeV1Available=t.isBridgeV1Available(),2===r?e._Store.bridgeV2Available:(!window.mParticle||!window.mParticle.uiwebviewBridgeName||window.mParticle.uiwebviewBridgeName===Jn+"_"+n+"_v2")&&(r<2&&(e._Store.bridgeV2Available||e._Store.bridgeV1Available))},this.isBridgeV1Available=function(){return!!(e._Store.SDKConfig.useNativeSdk||Gn(Wn)||e._Store.SDKConfig.isIOS)},this.sendToNative=function(n,r){e._Store.bridgeV2Available&&2===e._Store.SDKConfig.minWebviewBridgeVersion||e._Store.bridgeV2Available&&e._Store.SDKConfig.minWebviewBridgeVersion<2?t.sendViaBridgeV2(n,r,e._Store.SDKConfig.requiredWebviewBridgeName):e._Store.bridgeV1Available&&e._Store.SDKConfig.minWebviewBridgeVersion<2&&t.sendViaBridgeV1(n,r)},this.sendViaBridgeV1=function(n,r){var i=Gn(Wn);i&&i.hasOwnProperty(n)?(e.Logger.verbose(Qn.InformationMessages.SendAndroid+n),i[n](r)):e._Store.SDKConfig.isIOS&&(e.Logger.verbose(Qn.InformationMessages.SendIOS+n),t.sendViaIframeToIOS(n,r))},this.sendViaIframeToIOS=function(e,t){var n=document.createElement("IFRAME");n.setAttribute("src","mp-sdk://"+e+"/"+encodeURIComponent(t)),document.documentElement.appendChild(n),n.parentNode.removeChild(n)},this.sendViaBridgeV2=function(n,r,i){var o,s;if(i){var a,u,c=Gn(Wn+"_"+i+"_v2"),l=Jn+"_"+i+"_v2";if((null===(s=null===(o=window.webkit)||void 0===o?void 0:o.messageHandlers)||void 0===s?void 0:s[l])&&(a=window.webkit.messageHandlers[l]),e.uiwebviewBridgeName===l&&(u=e[l]),c&&c.hasOwnProperty(n))return e.Logger.verbose(Qn.InformationMessages.SendAndroid+n),void c[n](r);a?(e.Logger.verbose(Qn.InformationMessages.SendIOS+n),a.postMessage(JSON.stringify({path:n,value:r?JSON.parse(r):null}))):u&&(e.Logger.verbose(Qn.InformationMessages.SendIOS+n),t.sendViaIframeToIOS(n,r))}}}var Yn=r.Messages.InformationMessages,Xn={AdobeEventForwarder:11,DoubleclickDFP:41,AppNexus:50,Lotame:58,TradeDesk:103,VerizonMedia:155,Rokt:1277};function Zn(e){var t=this;this.attemptCookieSync=function(n,r){var i,o=e._Store,s=o.pixelConfigurations,a=o.webviewBridgeEnabled;if(n&&!a&&!(null===(i=e._CookieConsentManager)||void 0===i?void 0:i.getNoFunctional())){var u=e._Persistence.getPersistence();z(u)||s.forEach((function(i){var o,s,a;try{var c=!1,l=i.filteringConsentRuleValues,d=i.pixelUrl,p=i.redirectUrl,g=i.moduleId,h=i.settings,v=i.frequencyCap,f=(l||{}).values;if(z(d))return;if(z(f)||(c=!0),c&&r)return;if(g===Xn.Rokt){var m="undefined"==typeof navigator?void 0:navigator;if(e._CookieConsentManager.getNoTargeting()||e._CookieConsentManager.getDoNotShareOrSell()||m&&!0===m.globalPrivacyControl)return}if(!(0,e._Consent.isEnabledForUserConsent)(l,e.Identity.getCurrentUser()))return;var y=null!==(s=null===(o=u[n])||void 0===o?void 0:o.csd)&&void 0!==s?s:{},b=y[g]||null;if(!er(v,b))return;var S=g===Xn.TradeDesk?window.location.hostname:void 0,I="true"===(null===(a=null==h?void 0:h.enableHmTag)||void 0===a?void 0:a.toLowerCase()),_=g===Xn.DoubleclickDFP&&I,w=_?U(n):void 0;_&&!w&&e.Logger.warning("Unable to base64 encode the current MPID; omitting the google_hm parameter from this cookie sync");var P=L(n,d,p,S,w);t.performCookieSync(P,g.toString(),n,y)}catch(t){e.Logger.error("Error performing cookie sync: "+t)}}))}},this.performCookieSync=function(t,n,r,i){var o=document.createElement("img");e.Logger.verbose(Yn.CookieSync),o.onload=function(){i[n]=(new Date).getTime(),e._Persistence.saveUserCookieSyncDatesToPersistence(r,i)},o.src=t}}var er=function(e,t){return!t||(new Date).getTime()>new Date(t).getTime()+864e5*e};function tr(e,t,n){t.warning(e.warningMessage),null==n||n.report({message:e.methodName,code:hn.MP_DEPRECATED_METHOD_USAGE,severity:vn.WARNING})}var nr=r.Messages;function rr(e){var t=this;function n(e,t){if(!e||!t||t<=0)return!1;var n=6e4*t;return Date.now()-e>=n}function r(){var t;e._Events.logEvent({messageType:me.MessageType.SessionEnd}),e._Store.nullifySession(),null===(t=e._timeOnSiteTimer)||void 0===t||t.resetTimer()}this.initialize=function(){var r;if(e._Store.sessionId){var i=e._Store,o=i.dateLastEventSent,s=i.SDKConfig,a=s.sessionTimeout;if(n(null==o?void 0:o.getTime(),a))t.endSession(),t.startNewSession();else{var u=e.Identity.getCurrentUser(),c=s.identifyRequest;!((null===(r=e._CookieConsentManager)||void 0===r?void 0:r.getNoFunctional())&&!xn(e._Store))&&Vn(u,c)&&(e.Identity.identify(c,s.identityCallback),e._Store.identifyCalled=!0,e._Store.SDKConfig.identityCallback=null)}}else t.startNewSession()},this.getSession=function(){return tr({methodName:"SessionManager.getSession()",warningMessage:I("SessionManager.getSession()",!1,"SessionManager.getSessionId()")},e.Logger,e._ErrorReportingDispatcher),this.getSessionId()},this.getSessionId=function(){return e._Store.sessionId},this.startNewSession=function(){var n;if(e.Logger.verbose(nr.InformationMessages.StartingNewSession),e._Helpers.canLog()){e._Store.sessionId=e._Helpers.generateUniqueId().toUpperCase();var r=e.Identity.getCurrentUser(),i=r?r.getMPID():null;if(i&&(e._Store.currentSessionMPIDs=[i]),!e._Store.sessionStartDate){var o=new Date;e._Store.sessionStartDate=o,e._Store.dateLastEventSent=o}t.setSessionTimer();var s=(null===(n=e._CookieConsentManager)||void 0===n?void 0:n.getNoFunctional())&&!xn(e._Store);e._Store.identifyCalled||s||(e.Identity.identify(e._Store.SDKConfig.identifyRequest,e._Store.SDKConfig.identityCallback),e._Store.identifyCalled=!0,e._Store.SDKConfig.identityCallback=null),e._Events.logEvent({messageType:me.MessageType.SessionStart})}else e.Logger.verbose(nr.InformationMessages.AbandonStartSession)},this.endSession=function(i){var o,s,a,u;if(e.Logger.verbose(nr.InformationMessages.StartingEndSession),i)r();else{if(!e._Helpers.canLog())return e.Logger.verbose(nr.InformationMessages.AbandonEndSession),void(null===(o=e._timeOnSiteTimer)||void 0===o||o.resetTimer());var c=e._Persistence.getPersistence();if(!c||c.gs&&!c.gs.sid)return e.Logger.verbose(nr.InformationMessages.NoSessionToEnd),void(null===(s=e._timeOnSiteTimer)||void 0===s||s.resetTimer());if(c.gs.sid&&e._Store.sessionId!==c.gs.sid&&(e._Store.sessionId=c.gs.sid),null===(a=null==c?void 0:c.gs)||void 0===a?void 0:a.les){var l=e._Store.SDKConfig.sessionTimeout;n(c.gs.les,l)?r():(t.setSessionTimer(),null===(u=e._timeOnSiteTimer)||void 0===u||u.resetTimer())}}},this.setSessionTimer=function(){var n=6e4*e._Store.SDKConfig.sessionTimeout;e._Store.globalTimer=window.setTimeout((function(){t.endSession()}),n)},this.resetSessionTimer=function(){e._Store.webviewBridgeEnabled||(e._Store.sessionId||t.startNewSession(),t.clearSessionTimeout(),t.setSessionTimer()),t.startNewSessionIfNeeded()},this.clearSessionTimeout=function(){clearTimeout(e._Store.globalTimer)},this.startNewSessionIfNeeded=function(){if(!e._Store.webviewBridgeEnabled){var n=e._Persistence.getPersistence();!e._Store.sessionId&&n&&(n.sid?e._Store.sessionId=n.sid:t.startNewSession())}}}var ir=r.Messages;function or(e){var t=this;this.convertTransactionAttributesToProductAction=function(e,t){e.hasOwnProperty("Id")&&(t.TransactionId=e.Id),e.hasOwnProperty("Affiliation")&&(t.Affiliation=e.Affiliation),e.hasOwnProperty("CouponCode")&&(t.CouponCode=e.CouponCode),e.hasOwnProperty("Revenue")&&(t.TotalAmount=this.sanitizeAmount(e.Revenue,"Revenue")),e.hasOwnProperty("Shipping")&&(t.ShippingAmount=this.sanitizeAmount(e.Shipping,"Shipping")),e.hasOwnProperty("Tax")&&(t.TaxAmount=this.sanitizeAmount(e.Tax,"Tax")),e.hasOwnProperty("Step")&&(t.CheckoutStep=e.Step),e.hasOwnProperty("Option")&&(t.CheckoutOptions=e.Option)},this.calculateProductActionTotalAmount=function(e){if(!e||null!=e.TotalAmount)return e;var t=0;return Array.isArray(e.ProductList)&&e.ProductList.forEach((function(e){t+=C(e.Quantity)*C(e.Price)})),t+=C(e.ShippingAmount)+C(e.TaxAmount),e.TotalAmount=t,e},this.getProductActionEventName=function(e){switch(e){case me.ProductActionType.AddToCart:return"AddToCart";case me.ProductActionType.AddToWishlist:return"AddToWishlist";case me.ProductActionType.Checkout:return"Checkout";case me.ProductActionType.CheckoutOption:return"CheckoutOption";case me.ProductActionType.Click:return"Click";case me.ProductActionType.Purchase:return"Purchase";case me.ProductActionType.Refund:return"Refund";case me.ProductActionType.RemoveFromCart:return"RemoveFromCart";case me.ProductActionType.RemoveFromWishlist:return"RemoveFromWishlist";case me.ProductActionType.ViewDetail:return"ViewDetail";case me.ProductActionType.ViewCart:return"ViewCart";case me.ProductActionType.AddShippingInfo:return"AddShippingInfo";case me.ProductActionType.AddPaymentInfo:return"AddPaymentInfo";case me.ProductActionType.PaymentMethodSelected:return"PaymentMethodSelected";case me.ProductActionType.PaymentAttempted:return"PaymentAttempted";case me.ProductActionType.PaymentSucceeded:return"PaymentSucceeded";case me.ProductActionType.PaymentFailed:return"PaymentFailed";case me.ProductActionType.RefundInitiated:return"RefundInitiated";case me.ProductActionType.Unknown:default:return"Unknown"}},this.getPromotionActionEventName=function(e){switch(e){case me.PromotionActionType.PromotionClick:return"PromotionClick";case me.PromotionActionType.PromotionView:return"PromotionView";default:return"Unknown"}},this.convertProductActionToEventType=function(t){switch(t){case me.ProductActionType.AddToCart:return me.CommerceEventType.ProductAddToCart;case me.ProductActionType.AddToWishlist:return me.CommerceEventType.ProductAddToWishlist;case me.ProductActionType.Checkout:return me.CommerceEventType.ProductCheckout;case me.ProductActionType.CheckoutOption:return me.CommerceEventType.ProductCheckoutOption;case me.ProductActionType.Click:return me.CommerceEventType.ProductClick;case me.ProductActionType.Purchase:return me.CommerceEventType.ProductPurchase;case me.ProductActionType.Refund:return me.CommerceEventType.ProductRefund;case me.ProductActionType.RemoveFromCart:return me.CommerceEventType.ProductRemoveFromCart;case me.ProductActionType.RemoveFromWishlist:return me.CommerceEventType.ProductRemoveFromWishlist;case me.ProductActionType.Unknown:return me.EventType.Unknown;case me.ProductActionType.ViewDetail:return me.CommerceEventType.ProductViewDetail;case me.ProductActionType.ViewCart:case me.ProductActionType.AddShippingInfo:case me.ProductActionType.AddPaymentInfo:case me.ProductActionType.PaymentMethodSelected:case me.ProductActionType.PaymentAttempted:case me.ProductActionType.PaymentSucceeded:case me.ProductActionType.PaymentFailed:case me.ProductActionType.RefundInitiated:return me.EventType.Unknown;default:return e.Logger.error("Could not convert product action type "+t+" to event type"),null}},this.convertPromotionActionToEventType=function(t){switch(t){case me.PromotionActionType.PromotionClick:return me.CommerceEventType.PromotionClick;case me.PromotionActionType.PromotionView:return me.CommerceEventType.PromotionView;default:return e.Logger.error("Could not convert promotion action type "+t+" to event type"),null}},this.generateExpandedEcommerceName=function(e,t){return"eCommerce - "+e+" - "+(t?"Total":"Item")},this.extractProductAttributes=function(e,t){t.CouponCode&&(e["Coupon Code"]=t.CouponCode),t.Brand&&(e.Brand=t.Brand),t.Category&&(e.Category=t.Category),t.Name&&(e.Name=t.Name),t.Sku&&(e.Id=t.Sku),t.Price&&(e["Item Price"]=t.Price),t.Quantity&&(e.Quantity=t.Quantity),t.Position&&(e.Position=t.Position),t.Variant&&(e.Variant=t.Variant),e["Total Product Amount"]=t.TotalAmount||0},this.extractTransactionId=function(e,t){t.TransactionId&&(e["Transaction Id"]=t.TransactionId)},this.extractActionAttributes=function(e,n){t.extractTransactionId(e,n),n.Affiliation&&(e.Affiliation=n.Affiliation),n.CouponCode&&(e["Coupon Code"]=n.CouponCode),n.TotalAmount&&(e["Total Amount"]=n.TotalAmount),n.ShippingAmount&&(e["Shipping Amount"]=n.ShippingAmount),n.TaxAmount&&(e["Tax Amount"]=n.TaxAmount),n.CheckoutOptions&&(e["Checkout Options"]=n.CheckoutOptions),n.CheckoutStep&&(e["Checkout Step"]=n.CheckoutStep)},this.extractPromotionAttributes=function(e,t){t.Id&&(e.Id=t.Id),t.Creative&&(e.Creative=t.Creative),t.Name&&(e.Name=t.Name),t.Position&&(e.Position=t.Position)},this.createProduct=function(t,n,r,i,o,s,a,u,c,l){return l=e._Helpers.sanitizeAttributes(l,t),"string"!=typeof t?(e.Logger.error("Name is required when creating a product"),null):e._Helpers.Validators.isStringOrNumber(n)?e._Helpers.Validators.isStringOrNumber(r)?(r=e._Helpers.parseNumber(r),u&&!e._Helpers.Validators.isNumber(u)&&(e.Logger.error("Position must be a number, it will be set to null."),u=null),{Name:t,Sku:n,Price:r,Quantity:i=e._Helpers.Validators.isStringOrNumber(i)?e._Helpers.parseNumber(i):1,Brand:a,Variant:o,Category:s,Position:u,CouponCode:c,TotalAmount:i*r,Attributes:l}):(e.Logger.error("Price is required when creating a product, and must be a string or a number"),null):(e.Logger.error("SKU is required when creating a product, and must be a string or a number"),null)},this.createPromotion=function(t,n,r,i){return e._Helpers.Validators.isStringOrNumber(t)?{Id:t,Creative:n,Name:r,Position:i}:(e.Logger.error(ir.ErrorMessages.PromotionIdRequired),null)},this.createImpression=function(t,n){return"string"!=typeof t?(e.Logger.error("Name is required when creating an impression."),null):n?{Name:t,Product:n}:(e.Logger.error("Product is required when creating an impression."),null)},this.createTransactionAttributes=function(t,n,r,i,o,s){return e._Helpers.Validators.isStringOrNumber(t)?{Id:t,Affiliation:n,CouponCode:r,Revenue:i,Shipping:o,Tax:s}:(e.Logger.error(ir.ErrorMessages.TransactionIdRequired),null)},this.expandProductImpression=function(n){var r=[];return n.ProductImpressions?(n.ProductImpressions.forEach((function(i){i.ProductList&&i.ProductList.forEach((function(o){var s=re(!1,{},n.EventAttributes);if(o.Attributes)for(var a in o.Attributes)s[a]=o.Attributes[a];t.extractProductAttributes(s,o),i.ProductImpressionList&&(s["Product Impression List"]=i.ProductImpressionList);var u=e._ServerModel.createEventObject({messageType:me.MessageType.PageEvent,name:t.generateExpandedEcommerceName("Impression"),data:s,eventType:me.EventType.Transaction});r.push(u)}))})),r):r},this.expandCommerceEvent=function(e){return e?t.expandProductAction(e).concat(t.expandPromotionAction(e)).concat(t.expandProductImpression(e)):null},this.expandPromotionAction=function(n){var r=[];return n.PromotionAction?(n.PromotionAction.PromotionList.forEach((function(i){var o=re(!1,{},n.EventAttributes);t.extractPromotionAttributes(o,i);var s=e._ServerModel.createEventObject({messageType:me.MessageType.PageEvent,name:t.generateExpandedEcommerceName(me.PromotionActionType.getExpansionName(n.PromotionAction.PromotionActionType)),data:o,eventType:me.EventType.Transaction});r.push(s)})),r):r},this.expandProductAction=function(n){var r=[];if(!n.ProductAction)return r;var i=!1;if(n.ProductAction.ProductActionType===me.ProductActionType.Purchase||n.ProductAction.ProductActionType===me.ProductActionType.Refund){var o=re(!1,{},n.EventAttributes);o["Product Count"]=n.ProductAction.ProductList?n.ProductAction.ProductList.length:0,t.extractActionAttributes(o,n.ProductAction),n.CurrencyCode&&(o["Currency Code"]=n.CurrencyCode);var s=e._ServerModel.createEventObject({messageType:me.MessageType.PageEvent,name:t.generateExpandedEcommerceName(me.ProductActionType.getExpansionName(n.ProductAction.ProductActionType),!0),data:o,eventType:me.EventType.Transaction});r.push(s)}else i=!0;var a=n.ProductAction.ProductList;return a?(a.forEach((function(o){var s=re(!1,n.EventAttributes,o.Attributes);i?t.extractActionAttributes(s,n.ProductAction):t.extractTransactionId(s,n.ProductAction),t.extractProductAttributes(s,o);var a=e._ServerModel.createEventObject({messageType:me.MessageType.PageEvent,name:t.generateExpandedEcommerceName(me.ProductActionType.getExpansionName(n.ProductAction.ProductActionType)),data:s,eventType:me.EventType.Transaction});r.push(a)})),r):r},this.createCommerceEventObject=function(t,n){var r,i=e._Helpers.extend;return e.Logger.verbose(ir.InformationMessages.StartingLogCommerceEvent),e._Helpers.canLog()?((r=e._ServerModel.createEventObject({messageType:me.MessageType.Commerce,sourceMessageId:null==n?void 0:n.sourceMessageId})).EventName="eCommerce - ",r.CurrencyCode=e._Store.currencyCode,r.CustomFlags=i(r.CustomFlags,t),r):(e.Logger.verbose(ir.InformationMessages.AbandonLogEvent),null)},this.sanitizeAmount=function(t,n){if(!e._Helpers.Validators.isStringOrNumber(t)){var r=[n,"must be of type number. A",c(t),"was passed. Converting to 0"].join(" ");return e.Logger.warning(r),0}return e._Helpers.parseNumber(t)}}var sr=function(){function e(e,t){void 0===t&&(t=!1),this.noFunctional=t,this.isTrackerActive=!1,this.localStorageName="",this.startTime=0,this.totalTime=0,this.localStorageName="mprtcl-tos-".concat(e),this.timerVault=new sn(this.localStorageName),this.noFunctional||this.loadTimeFromStorage(),this.addHandlers(),!1===document.hidden&&this.startTracking()}return e.prototype.addHandlers=function(){var e=this;document.addEventListener("visibilitychange",(function(){return e.handleVisibilityChange()})),window.addEventListener("blur",(function(){return e.handleWindowBlur()})),window.addEventListener("focus",(function(){return e.handleWindowFocus()})),window.addEventListener("storage",(function(t){return e.syncAcrossTabs(t)})),window.addEventListener("beforeunload",(function(){return e.updateTimeInPersistence()}))},e.prototype.handleVisibilityChange=function(){document.hidden?this.stopTracking():this.startTracking()},e.prototype.handleWindowBlur=function(){this.isTrackerActive&&this.stopTracking()},e.prototype.handleWindowFocus=function(){this.isTrackerActive||this.startTracking()},e.prototype.syncAcrossTabs=function(e){if(e.key===this.localStorageName&&null!==e.newValue){var t=parseFloat(e.newValue)||0;this.totalTime=t}},e.prototype.updateTimeInPersistence=function(){this.isTrackerActive&&!this.noFunctional&&this.timerVault.store(Math.round(this.totalTime))},e.prototype.loadTimeFromStorage=function(){var e=this.timerVault.retrieve();H(e)&&null!==e&&(this.totalTime=e)},e.prototype.startTracking=function(){document.hidden||(this.startTime=Math.floor(performance.now()),this.isTrackerActive=!0)},e.prototype.stopTracking=function(){this.isTrackerActive&&(this.setTotalTime(),this.updateTimeInPersistence(),this.isTrackerActive=!1)},e.prototype.setTotalTime=function(){if(this.isTrackerActive){var e=Math.floor(performance.now());this.totalTime+=e-this.startTime,this.startTime=e}},e.prototype.getTimeInForeground=function(){return this.setTotalTime(),this.updateTimeInPersistence(),this.totalTime},e.prototype.resetTimer=function(){this.totalTime=0,this.updateTimeInPersistence()},e}();function ar(e){var t=e?p({},e):{};return(!0===t.noDeviceId||!0===t.noDeviceID)&&(t.noDeviceId=!0,t.noFunctional=!0,t.noTargeting=!0),t}function ur(e,t,n){var i=this,o=t._Helpers.createMainStorageName,s=t._NativeSdkHelpers.isWebviewEnabled,a={isEnabled:!0,sessionAttributes:{},localSessionAttributes:{},currentSessionMPIDs:[],consentState:null,sessionId:null,isFirstRun:null,clientId:null,deviceId:null,devToken:null,serverSettings:{},dateLastEventSent:null,sessionStartDate:null,currentPosition:null,isTracking:!1,watchPositionId:null,cartProducts:[],eventQueue:[],currencyCode:null,globalTimer:null,context:null,configurationLoaded:!1,identityCallInFlight:!1,identityCallFailed:!1,identifyRequestCount:0,SDKConfig:{},nonCurrentUserMPIDs:{},identifyCalled:!1,isLoggedIn:!1,cookieSyncDates:{},integrationAttributes:{},requireDelay:!0,isLocalStorageAvailable:null,storageName:null,activeForwarders:[],kits:{},sideloadedKits:[],configuredForwarders:[],pixelConfigurations:[],wrapperSDKInfo:{name:"none",version:null,isInfoSet:!1},roktAccountId:null,integrationName:null,persistenceData:{gs:{}}};for(var u in a)this[u]=a[u];if(this.devToken=n||null,this.integrationDelayTimeoutStart=Date.now(),this.SDKConfig=function(e){var t={};for(var n in r.DefaultConfig)r.DefaultConfig.hasOwnProperty(n)&&(t[n]=r.DefaultConfig[n]);if(e)for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);for(var n in r.DefaultBaseUrls)t[n]=r.DefaultBaseUrls[n];return t.flags=t.flags||{},t}(e),e){e.hasOwnProperty("flags")||(this.SDKConfig.flags={}),this.SDKConfig.flags=cr(e),this.SDKConfig.autoLogPageViewQueryParams=kt(e.autoLogPageViewQueryParams),e.deviceId&&(this.deviceId=e.deviceId),e.hasOwnProperty("isDevelopmentMode")?this.SDKConfig.isDevelopmentMode=N(e.isDevelopmentMode):this.SDKConfig.isDevelopmentMode=!1;var l=lr(e,this.SDKConfig.flags,n);for(var d in l)this.SDKConfig[d]=l[d];if(this.SDKConfig.useNativeSdk=!!e.useNativeSdk,this.SDKConfig.kits=e.kits||{},this.SDKConfig.sideloadedKits=e.sideloadedKits||[],e.hasOwnProperty("isIOS")?this.SDKConfig.isIOS=e.isIOS:this.SDKConfig.isIOS=!(!window.mParticle||!window.mParticle.isIOS)&&window.mParticle.isIOS,e.hasOwnProperty("useCookieStorage")?this.SDKConfig.useCookieStorage=e.useCookieStorage:this.SDKConfig.useCookieStorage=!1,e.hasOwnProperty("maxCookieSize")?this.SDKConfig.maxCookieSize=e.maxCookieSize:this.SDKConfig.maxCookieSize=r.DefaultConfig.maxCookieSize,e.hasOwnProperty("appName")&&(this.SDKConfig.appName=e.appName),e.hasOwnProperty("package")&&(this.SDKConfig.package=e.package),e.hasOwnProperty("integrationDelayTimeout")?this.SDKConfig.integrationDelayTimeout=e.integrationDelayTimeout:this.SDKConfig.integrationDelayTimeout=r.DefaultConfig.integrationDelayTimeout,e.hasOwnProperty("identifyRequest")&&(this.SDKConfig.identifyRequest=e.identifyRequest),e.hasOwnProperty("identityCallback")){var g=e.identityCallback;t._Helpers.Validators.isFunction(g)?this.SDKConfig.identityCallback=e.identityCallback:t.Logger.warning("The optional callback must be a function. You tried entering a(n) "+c(g)+" . Callback not set. Please set your callback again.")}if(e.hasOwnProperty("appVersion")&&(this.SDKConfig.appVersion=e.appVersion),e.hasOwnProperty("appName")&&(this.SDKConfig.appName=e.appName),e.hasOwnProperty("sessionTimeout")&&(this.SDKConfig.sessionTimeout=e.sessionTimeout),e.hasOwnProperty("dataPlan")){this.SDKConfig.dataPlan={PlanVersion:null,PlanId:null};var h=e.dataPlan;h.planId&&(q(h.planId)?this.SDKConfig.dataPlan.PlanId=h.planId:t.Logger.error("Your data plan id must be a string and match the data plan slug format (i.e. under_case_slug)")),h.planVersion&&(H(h.planVersion)?this.SDKConfig.dataPlan.PlanVersion=h.planVersion:t.Logger.error("Your data plan version must be a number"))}else this.SDKConfig.dataPlan={};if(e.hasOwnProperty("forceHttps")?this.SDKConfig.forceHttps=e.forceHttps:this.SDKConfig.forceHttps=!0,this.SDKConfig.customFlags=e.customFlags||{},e.hasOwnProperty("minWebviewBridgeVersion")?this.SDKConfig.minWebviewBridgeVersion=e.minWebviewBridgeVersion:this.SDKConfig.minWebviewBridgeVersion=1,e.hasOwnProperty("aliasMaxWindow")?this.SDKConfig.aliasMaxWindow=e.aliasMaxWindow:this.SDKConfig.aliasMaxWindow=r.DefaultConfig.aliasMaxWindow,e.hasOwnProperty("dataPlanOptions")){var v=e.dataPlanOptions;v.hasOwnProperty("dataPlanVersion")&&v.hasOwnProperty("blockUserAttributes")&&v.hasOwnProperty("blockEventAttributes")&&v.hasOwnProperty("blockEvents")&&v.hasOwnProperty("blockUserIdentities")||t.Logger.error('Ensure your config.dataPlanOptions object has the following keys: a "dataPlanVersion" object, and "blockUserAttributes", "blockEventAttributes", "blockEvents", "blockUserIdentities" booleans')}e.hasOwnProperty("onCreateBatch")&&("function"==typeof e.onCreateBatch?this.SDKConfig.onCreateBatch=e.onCreateBatch:(t.Logger.error("config.onCreateBatch must be a function"),this.SDKConfig.onCreateBatch=void 0))}this._getFromPersistence=function(e,t){return e?(i.syncPersistenceData(),i.persistenceData&&i.persistenceData[e]&&i.persistenceData[e][t]?i.persistenceData[e][t]:null):null},this._setPersistence=function(e,n,r){var o;e&&(i.syncPersistenceData(),i.persistenceData&&(P(i.persistenceData[e])?i.persistenceData[e][n]=r:i.persistenceData[e]=((o={})[n]=r,o),P(i.persistenceData[e][n])&&z(i.persistenceData[e][n])&&delete i.persistenceData[e][n],t._Persistence.savePersistence(i.persistenceData)))},this.hasInvalidIdentifyRequest=function(){var e=i.SDKConfig.identifyRequest;return P(e)&&P(e.userIdentities)&&z(e.userIdentities)||!e},this.getConsentState=function(e){var n=t._Consent.ConsentSerialization.fromMinifiedJsonObject,r=i._getFromPersistence(e,"con");return z(r)?null:n(r)},this.setConsentState=function(e,n){var r=t._Consent.ConsentSerialization.toMinifiedJsonObject;(n||null===n)&&i._setPersistence(e,"con",r(n))},this.getDeviceId=function(){return i.deviceId},this.setDeviceId=function(e){i.deviceId=e,i.persistenceData.gs.das=e,t._Persistence.update()},this.getFirstSeenTime=function(e){return i._getFromPersistence(e,"fst")},this.setFirstSeenTime=function(e,t){if(e){var n=t||(new Date).getTime();i._setPersistence(e,"fst",n)}},this.getLastSeenTime=function(e){if(!e)return null;var n=t.Identity.getCurrentUser();return e===(null==n?void 0:n.getMPID())?(new Date).getTime():i._getFromPersistence(e,"lst")},this.setLastSeenTime=function(e,t){if(e){var n=t||(new Date).getTime();i._setPersistence(e,"lst",n)}},this.getLocalSessionAttributes=function(){return i.localSessionAttributes||{}},this.setLocalSessionAttribute=function(e,n){var r;i.localSessionAttributes[e]=n,i.persistenceData.gs.lsa=p(p({},i.persistenceData.gs.lsa||{}),((r={})[e]=n,r)),t._Persistence.savePersistence(i.persistenceData)},this.syncPersistenceData=function(){var e=t._Persistence.getPersistence();i.persistenceData=re({},i.persistenceData,e)},this.getUserAttributes=function(e){return i._getFromPersistence(e,"ua")||{}},this.setUserAttributes=function(e,t){return i._setPersistence(e,"ua",t)},this.getUserIdentities=function(e){return i._getFromPersistence(e,"ui")||{}},this.setUserIdentities=function(e,t){i._setPersistence(e,"ui",t)},this.getRoktAccountId=function(){return i.roktAccountId},this.setRoktAccountId=function(e){i.roktAccountId=e},this.getIntegrationName=function(){return i.integrationName},this.setIntegrationName=function(e){i.integrationName=e},this.getTimeOnSite=function(){var e;return null===(e=t._timeOnSiteTimer)||void 0===e?void 0:e.getTimeInForeground()},this.getTotalTimeOnSite=function(){return i.sessionStartDate?Date.now()-i.sessionStartDate.getTime():void 0},this.addMpidToSessionHistory=function(e,t){var n=i.currentSessionMPIDs.indexOf(e);e&&t!==e&&n<0?i.currentSessionMPIDs.push(e):n>=0&&(i.currentSessionMPIDs=Q(i.currentSessionMPIDs,n))},this.nullifySession=function(){i.sessionId=null,i.dateLastEventSent=null,i.sessionStartDate=null,i.sessionAttributes={},i.localSessionAttributes={},t._Persistence.update()},this.processConfig=function(e){var r=e.workspaceToken,a=e.requiredWebviewBridgeName;e.flags&&(i.SDKConfig.flags=cr(e)),i.SDKConfig.autoLogPageViewQueryParams=kt(e.autoLogPageViewQueryParams);var u=lr(e,i.SDKConfig.flags,n);for(var c in u)i.SDKConfig[c]=u[c];if(r){i.SDKConfig.workspaceToken=r;var l=ar(null==e?void 0:e.launcherOptions).noFunctional;t._timeOnSiteTimer=new sr(r,l)}else t.Logger.warning("You should have a workspaceToken on your config object for security purposes.");i.storageName=o(r),i.SDKConfig.requiredWebviewBridgeName=a||r,i.webviewBridgeEnabled=s(i.SDKConfig.requiredWebviewBridgeName,i.SDKConfig.minWebviewBridgeVersion),i.configurationLoaded=!0}}function cr(e){var t={},n=r.FeatureFlags,i=n.ReportBatching,o=n.EventBatchingIntervalMillis,s=n.OfflineStorage,a=n.DirectUrlRouting,u=n.CacheIdentity,c=n.AudienceAPI,l=n.CaptureIntegrationSpecificIds,d=n.CaptureIntegrationSpecificIdsV2,p=n.AstBackgroundEvents,g=n.AutoLogPageView,h=n.AutoButtonTracking,v=n.AutoLinkTracking;return e.flags?(t[i]=e.flags[i]||!1,t[o]=C(e.flags[o])||r.DefaultConfig.uploadInterval,t[s]=e.flags[s]||"0",t[a]="True"===e.flags[a],t[u]="True"===e.flags[u],t[c]="True"===e.flags[c],t[l]="True"===e.flags[l],t[d]=e.flags[d]||"none",t[p]="True"===e.flags[p],t[g]="True"===e.flags[g],t[h]="True"===e.flags[h],t[v]="True"===e.flags[v],t):{}}function lr(e,t,n){return n?z(e.domain)&&t.directURLRouting?function(e,t){var n=r.DefaultBaseUrls,i={},o="us1",s=t.split("-"),a=s.length<=1?o:s[0];for(var u in n)if("configUrl"!==u)if(e.hasOwnProperty(u))i[u]=e[u];else{var c=n[u].split(".");i[u]=v([c[0],a],c.slice(1),!0).join(".")}else i[u]=e[u]||n[u];return i}(e,n):dr(e):{}}function dr(e){var t=r.DefaultBaseUrls,n=r.CNAMEUrlPaths,i={};if(!z(e.domain)){for(var o in n)i[o]="".concat(e.domain).concat(n[o]);return i}for(var s in t)i[s]=e[s]||t[s];return i}var pr=function(){function e(e){var t,n;this.logLevel=null!==(t=e.logLevel)&&void 0!==t?t:xe,this.logger=null!==(n=e.logger)&&void 0!==n?n:new gr}return e.prototype.verbose=function(e){this.logLevel!==Re&&this.logger.verbose&&this.logLevel===Ve&&this.logger.verbose(e)},e.prototype.warning=function(e){this.logLevel!==Re&&(!this.logger.warning||this.logLevel!==Ve&&this.logLevel!==xe||this.logger.warning(e))},e.prototype.error=function(e){this.logLevel!==Re&&this.logger.error&&this.logger.error(e)},e.prototype.isVerbose=function(){return this.logLevel===Ve},e.prototype.setLogLevel=function(e){this.logLevel=e},e}(),gr=function(){function e(){}return e.prototype.verbose=function(e){console&&console.info&&console.info(e)},e.prototype.error=function(e){console&&console.error&&console.error(e)},e.prototype.warning=function(e){console&&console.warn&&console.warn(e)},e}(),hr=n.Base64,vr=r.Messages,fr=r.Base64CookieKeys,mr=r.SDKv2NonMPIDCookieKeys,yr=r.StorageNames;function br(){return window.mParticle}function Sr(e){var t=this;function n(n,r,i){var o;return r?(o=function(e,t){return e&&t?re(!1,e,t):e||t}(r,i),n.removeItem(e._Store.storageName)):i&&(o=i),t.storeDataInMemory(o),o}function r(r,i){if(e._Store.isLocalStorageAvailable)return e._Store.SDKConfig.useCookieStorage?n(window.localStorage,r,i):function(n,r){if(r){var i=n||r;return t.storeDataInMemory(i),t.expireCookies(e._Store.storageName),i}t.storeDataInMemory(n)}(r,i);t.storeDataInMemory(i)}function i(t){var n=e._Store;return t.gs.sid=n.sessionId,t.gs.ie=n.isEnabled,t.gs.sa=n.sessionAttributes,t.gs.lsa=n.localSessionAttributes,t.gs.ss=n.serverSettings,t.gs.dt=n.devToken,t.gs.les=n.dateLastEventSent?n.dateLastEventSent.getTime():null,t.gs.av=n.SDKConfig.appVersion,t.gs.cgid=n.clientId,t.gs.das=n.deviceId,t.gs.c=n.context,t.gs.ssd=n.sessionStartDate?n.sessionStartDate.getTime():0,t.gs.ia=n.integrationAttributes,t}function o(n){var r=t.decodePersistence(n);if(!r)return null;var i=JSON.parse(r);return e._Helpers.isObject(i)&&Object.keys(i).length?i:null}function s(e,t){return e.length>t}function a(t,n,r){if(t[n])return e.Logger.verbose("Size of new encoded cookie is larger than maxCookieSize setting of "+r+". Removing from cookie the earliest logged in MPID containing: "+JSON.stringify(t[n],null,2)),void delete t[n];e.Logger.error("Unable to save MPID data to cookies because the resulting encoded cookie is larger than the maxCookieSize setting of "+r+". We recommend using a maxCookieSize of 1500.")}function u(e){var t="https:"===window.location.protocol;window.document.cookie=t?e+";Secure":e}function c(e,n,r){return t.encodePersistence(JSON.stringify(e))+";expires="+n+";path=/"+r}function l(t,n){var r;t[n]&&(r=t[n],Array.isArray(r)?r.length>0:e._Helpers.isObject(r)&&Object.keys(r).length>0)?t[n]=hr.encode(JSON.stringify(t[n])):delete t[n]}function d(t,n){var r=t[n];e._Helpers.isObject(r)&&Object.keys(r).length?t[n]=hr.encode(JSON.stringify(r)):delete t[n]}function p(e){for(var t in e)e.hasOwnProperty(t)&&fr[t]&&d(e,t)}function g(e){for(var t in e)e.hasOwnProperty(t)&&fr[t]&&e[t].length&&(e[t]=JSON.parse(hr.decode(e[t])))}this.useLocalStorage=function(){return!e._Store.SDKConfig.useCookieStorage&&e._Store.isLocalStorageAvailable},this.initializeStorage=function(){var n,i=null;try{var o=t.getLocalStorage();(function(t,n){if(!t&&!n)return e._Store.isFirstRun=!0,void(e._Store.mpid=0);e._Store.isFirstRun=!1})(o,i=t.getCookie()),e._Store.isLocalStorageAvailable||(e._Store.SDKConfig.useCookieStorage=!0),!function(t){for(var n in t)t.hasOwnProperty(n)&&!mr[n]&&(e._Store.nonCurrentUserMPIDs[n]=t[n])}(r(o,i)),t.update()}catch(r){n=Boolean(i),t.useLocalStorage()&&e._Store.isLocalStorageAvailable?n||localStorage.removeItem(e._Store.storageName):t.expireCookies(e._Store.storageName),e.Logger.error("Error initializing storage: "+r)}},this.update=function(){e._Store.webviewBridgeEnabled||(e._Store.SDKConfig.useCookieStorage&&t.setCookie(),t.setLocalStorage())},this.storeDataInMemory=function(t,n){try{if(!t)return e.Logger.verbose(vr.InformationMessages.CookieNotFound),e._Store.clientId=e._Store.clientId||e._Helpers.generateUniqueId(),void(e._Store.deviceId=e._Store.deviceId||e._Helpers.generateUniqueId());!function(t,n){e._Store.mpid=n||t.cu||0,t.gs=t.gs||{},e._Store.sessionId=t.gs.sid||e._Store.sessionId,e._Store.isEnabled=void 0!==t.gs.ie?t.gs.ie:e._Store.isEnabled,e._Store.sessionAttributes=t.gs.sa||e._Store.sessionAttributes,e._Store.localSessionAttributes=t.gs.lsa||e._Store.localSessionAttributes,e._Store.serverSettings=t.gs.ss||e._Store.serverSettings,e._Store.devToken=e._Store.devToken||t.gs.dt,e._Store.SDKConfig.appVersion=e._Store.SDKConfig.appVersion||t.gs.av,e._Store.clientId=t.gs.cgid||e._Store.clientId||e._Helpers.generateUniqueId(),e._Store.deviceId=e._Store.deviceId||t.gs.das||e._Helpers.generateUniqueId(),e._Store.integrationAttributes=t.gs.ia||{},e._Store.context=t.gs.c||e._Store.context,e._Store.currentSessionMPIDs=t.gs.csm||e._Store.currentSessionMPIDs,e._Store.isLoggedIn=!0===t.l,t.gs.les&&(e._Store.dateLastEventSent=new Date(t.gs.les)),e._Store.sessionStartDate=t.gs.ssd?new Date(t.gs.ssd):new Date,t=n?t[n]:t[t.cu]}(t,n)}catch(t){e.Logger.error(vr.ErrorMessages.CookieParseError)}},this.determineLocalStorageAvailability=function(e){var t=br();if(null==t?void 0:t._forceNoLocalStorage)return!1;try{e.setItem("mparticle","test");var n="test"===e.getItem("mparticle");return e.removeItem("mparticle"),Boolean(n&&e)}catch(e){return!1}},this.setLocalStorage=function(){var n;if(e._Store.isLocalStorageAvailable&&!(null===(n=e._CookieConsentManager)||void 0===n?void 0:n.getNoFunctional())){var r=e._Store.storageName,o=t.getLocalStorage()||{},s=e.Identity.getCurrentUser(),a=s?s.getMPID():null;if(!e._Store.SDKConfig.useCookieStorage){o.gs=o.gs||{},o.l=e._Store.isLoggedIn?1:0,e._Store.sessionId&&(o.gs.csm=e._Store.currentSessionMPIDs),o.gs.ie=e._Store.isEnabled,a&&(o.cu=a),Object.keys(e._Store.nonCurrentUserMPIDs).length&&(o=re({},o,e._Store.nonCurrentUserMPIDs),e._Store.nonCurrentUserMPIDs={}),o=i(o);try{window.localStorage.setItem(encodeURIComponent(r),t.encodePersistence(JSON.stringify(o)))}catch(t){e.Logger.error("Error with setting localStorage item.")}}}},this.getLocalStorage=function(){return e._Store.isLocalStorageAvailable?o(window.localStorage.getItem(e._Store.storageName)):null},this.expireCookies=function(e){var n,r,i=new Date;n=""===(r=t.getCookieDomain())?"":";domain="+r,i.setTime(i.getTime()-864e5),u(e+"="+("; expires="+i.toUTCString())+"; path=/"+n)},this.getCookie=function(){var t,n,r,i,s,a,u=e._Store.storageName;e.Logger.verbose(vr.InformationMessages.CookieSearch);try{t=window.document.cookie.split("; ")}catch(t){return e.Logger.verbose("Unable to parse undefined cookie"),null}for(n=0,r=t.length;n<r;n++){try{s=(i=t[n].split("=")).shift(),a=i.join("=")}catch(t){e.Logger.verbose("Unable to parse cookie: "+s+". Skipping.")}if(u&&u===s){var c=o(e._Helpers.converted(a));if(c)return e.Logger.verbose(vr.InformationMessages.CookieFound),c}}return null},this.setCookie=function(){var n;if(!(null===(n=e._CookieConsentManager)||void 0===n?void 0:n.getNoFunctional())){var r,o=e.Identity.getCurrentUser();o&&(r=o.getMPID());var s,a,c,l=new Date,d=e._Store.storageName,p=t.getCookie()||{},g=new Date(l.getTime()+24*e._Store.SDKConfig.cookieExpiration*60*60*1e3).toUTCString();a=""===(s=t.getCookieDomain())?"":";domain="+s,p.gs=p.gs||{},e._Store.sessionId&&(p.gs.csm=e._Store.currentSessionMPIDs),r&&(p.cu=r),p.l=e._Store.isLoggedIn?1:0,p=i(p),Object.keys(e._Store.nonCurrentUserMPIDs).length&&(p=re({},p,e._Store.nonCurrentUserMPIDs),e._Store.nonCurrentUserMPIDs={}),c=t.reduceAndEncodePersistence(p,g,a,e._Store.SDKConfig.maxCookieSize),e.Logger.verbose(vr.InformationMessages.CookieSet),u(encodeURIComponent(d)+"="+c)}},this.reduceAndEncodePersistence=function(e,t,n,r){var i=e.gs.csm?e.gs.csm:[];if(!i.length)return function(e,t,n,r){var i;for(var o in e)e.hasOwnProperty(o)&&s(i=c(e,t,n),r)&&(mr[o]||o===e.cu||delete e[o]);return i}(e,t,n,r);var o=function(e){var t={};for(var n in e)e.hasOwnProperty(n)&&(mr[n]||n===e.cu||(t[n]=1));return t}(e);return Object.keys(o).length&&function(e,t,n,r,i,o){var a;for(var u in t)s(a=c(e,r,i),o)&&t.hasOwnProperty(u)&&-1===n.indexOf(u)&&delete e[u]}(e,o,i,t,n,r),function(e,t,n,r,i){for(var o,u=0;u<t.length&&s(o=c(e,n,r),i);u++)a(e,t[u],i);return o}(e,i,t,n,r)},this.encodePersistence=function(e){var t=JSON.parse(e);return function(e){for(var t in e)e.hasOwnProperty(t)&&(fr[t]?l(e,t):"ie"!==t?e[t]||delete e[t]:e[t]=e[t]?1:0)}(t.gs),function(e){for(var t in e)e.hasOwnProperty(t)&&(mr[t]||p(e[t]))}(t),m(JSON.stringify(t))},this.decodePersistence=function(t){try{if(!t)return;var n=JSON.parse(y(t));return e._Helpers.isObject(n)&&Object.keys(n).length&&(function(e){for(var t in e)e.hasOwnProperty(t)&&(fr[t]?(e[t]=JSON.parse(hr.decode(e[t])),"csm"!==t||Array.isArray(e[t])||delete e[t]):"ie"===t&&(e[t]=Boolean(e[t])))}(n.gs),function(t){for(var n in t)if(t.hasOwnProperty(n))if(mr[n])"l"===n&&(t[n]=Boolean(t[n]));else{if(!e._Helpers.isObject(t[n])){delete t[n];continue}g(t[n])}}(n)),JSON.stringify(n)}catch(t){e.Logger.error("Problem with decoding cookie")}},this.getCookieDomain=function(){if(e._Store.SDKConfig.cookieDomain)return e._Store.SDKConfig.cookieDomain;var n=t.getDomain(document,location.hostname);return""===n?"":"."+n},this.getDomain=function(e,t){var n,r,i="mptest=cookie",o=t.split(".");for(n=o.length-1;n>=0;n--)if(r=o.slice(n).join("."),e.cookie=i+";domain=."+r+";",e.cookie.indexOf(i)>-1)return e.cookie=i.split("=")[0]+"=;domain=."+r+";expires=Thu, 01 Jan 1970 00:00:01 GMT;",r;return""},this.saveUserCookieSyncDatesToPersistence=function(n,r){if(r){var i=t.getPersistence();i&&(e._Helpers.isObject(i[n])?i[n].csd=r:i[n]={csd:r}),t.savePersistence(i)}},this.swapCurrentUser=function(e,n,r){if(e&&n&&e!==n){var i=t.getPersistence();i&&(i.cu=n,i.gs.csm=r,t.savePersistence(i))}},this.savePersistence=function(n){var r;if(!(null===(r=e._CookieConsentManager)||void 0===r?void 0:r.getNoFunctional())){var i,o=t.encodePersistence(JSON.stringify(n)),s=new Date,a=e._Store.storageName,c=new Date(s.getTime()+24*e._Store.SDKConfig.cookieExpiration*60*60*1e3).toUTCString(),l=t.getCookieDomain();if(i=""===l?"":";domain="+l,e._Store.SDKConfig.useCookieStorage){var d=t.reduceAndEncodePersistence(n,c,i,e._Store.SDKConfig.maxCookieSize);u(encodeURIComponent(a)+"="+d)}else if(e._Store.isLocalStorageAvailable)try{localStorage.setItem(e._Store.storageName,o)}catch(t){e.Logger.error("Error saving persistence to localStorage.")}}},this.getPersistence=function(){return this.useLocalStorage()?this.getLocalStorage():this.getCookie()},this.getFirstSeenTime=function(e){if(!e)return null;var n=t.getPersistence();return n&&n[e]&&n[e].fst?n[e].fst:null},this.setFirstSeenTime=function(n,r){if(n){r||(r=(new Date).getTime());var i=t.getPersistence();i&&(e._Helpers.isObject(i[n])||(i[n]={}),i[n].fst||(i[n].fst=r,t.savePersistence(i)))}},this.getLastSeenTime=function(n){if(!n)return null;if(n===e.Identity.getCurrentUser().getMPID())return(new Date).getTime();var r=t.getPersistence();return r&&r[n]&&r[n].lst?r[n].lst:null},this.setLastSeenTime=function(n,r){if(n){r||(r=(new Date).getTime());var i=t.getPersistence();i&&e._Helpers.isObject(i[n])&&(i[n].lst=r,t.savePersistence(i))}},this.getDeviceId=function(){return e._Store.deviceId},this.setDeviceId=function(n){e._Store.deviceId=n,t.update()},this.resetPersistence=function(){localStorage.clear(),t.expireCookies(yr.cookieName),t.expireCookies(yr.cookieNameV2),t.expireCookies(yr.cookieNameV3),t.expireCookies(yr.cookieNameV4),t.expireCookies(e._Store.storageName);var n=br();if(null==n?void 0:n._isTestEnv){var r="abcdef";localStorage.removeItem(e._Helpers.createMainStorageName(r)),t.expireCookies(e._Helpers.createMainStorageName(r))}},this.forwardingStatsBatches={uploadsTable:{},forwardingStatsEventQueue:[]}}var Ir=r.Messages;function _r(e){var t=this;this.logEvent=function(t,n){if(e.Logger.verbose(Ir.InformationMessages.StartingLogEvent+": "+t.name),e._Helpers.canLog()){var r=e._ServerModel.createEventObject(t);e._APIClient.sendEventToServer(r,n)}else e.Logger.verbose(Ir.InformationMessages.AbandonLogEvent)},this.startTracking=function(t){if(e._Store.isTracking){var n={coords:{latitude:e._Store.currentPosition.lat,longitude:e._Store.currentPosition.lng}};r(t,n)}else"geolocation"in navigator&&(e._Store.watchPositionId=navigator.geolocation.watchPosition((function(n){e._Store.currentPosition={lat:n.coords.latitude,lng:n.coords.longitude},r(t,n),t=null,e._Store.isTracking=!0}),(function(){r(t),t=null,e._Store.isTracking=!1})));function r(t,n){if(t)try{n?t(n):t()}catch(t){e.Logger.error("Error invoking the callback passed to startTrackingLocation."),e.Logger.error(t)}}},this.stopTracking=function(){e._Store.isTracking&&(navigator.geolocation.clearWatch(e._Store.watchPositionId),e._Store.currentPosition=null,e._Store.isTracking=!1)},this.logOptOut=function(){e.Logger.verbose(Ir.InformationMessages.StartingLogOptOut);var t=e._ServerModel.createEventObject({messageType:me.MessageType.OptOut,eventType:me.EventType.Other});e._APIClient.sendEventToServer(t)},this.logAST=function(){t.logEvent({messageType:me.MessageType.AppStateTransition})},this.logPageView=function(n){var r;t.logEvent({messageType:me.MessageType.PageView,name:"PageView",data:p(p(p({},Ot(Dt(X(),null===(r=e._Store.SDKConfig.autoLogPageViewQueryParams)||void 0===r?void 0:r.allowed))),{hostname:window.location.hostname,title:window.document.title}),Mt(n&&n.isAutoPageView)),eventType:me.EventType.Unknown})},this.logProductActionEvent=function(n,r,i,o,s,a){var u=e._Ecommerce.createCommerceEventObject(o,a),c=Array.isArray(r)?r:[r];c.forEach((function(t){t.TotalAmount&&(t.TotalAmount=e._Ecommerce.sanitizeAmount(t.TotalAmount,"TotalAmount")),t.Position&&(t.Position=e._Ecommerce.sanitizeAmount(t.Position,"Position")),t.Price&&(t.Price=e._Ecommerce.sanitizeAmount(t.Price,"Price")),t.Quantity&&(t.Quantity=e._Ecommerce.sanitizeAmount(t.Quantity,"Quantity"))})),u&&(u.EventCategory=e._Ecommerce.convertProductActionToEventType(n),u.EventName+=e._Ecommerce.getProductActionEventName(n),u.ProductAction={ProductActionType:n,ProductList:c},me.ProductActionType.isRoktCommerceType(n)&&(u.CustomFlags=u.CustomFlags||{},u.CustomFlags["Rokt.CommerceEventType"]=me.ProductActionType.getExpansionName(n)),e._Helpers.isObject(s)&&e._Ecommerce.convertTransactionAttributesToProductAction(s,u.ProductAction),t.logCommerceEvent(u,i,a))},this.logPurchaseEvent=function(n,r,i,o){var s=e._Ecommerce.createCommerceEventObject(o);s&&(s.EventName+=e._Ecommerce.getProductActionEventName(me.ProductActionType.Purchase),s.EventCategory=me.CommerceEventType.ProductPurchase,s.ProductAction={ProductActionType:me.ProductActionType.Purchase,ProductList:Array.isArray(r)?r:[r]},e._Ecommerce.convertTransactionAttributesToProductAction(n,s.ProductAction),t.logCommerceEvent(s,i))},this.logPromotionEvent=function(n,r,i,o,s){var a=e._Ecommerce.createCommerceEventObject(o);a&&(a.EventName+=e._Ecommerce.getPromotionActionEventName(n),a.EventCategory=e._Ecommerce.convertPromotionActionToEventType(n),a.PromotionAction={PromotionActionType:n,PromotionList:Array.isArray(r)?r:[r]},t.logCommerceEvent(a,i,s))},this.logImpressionEvent=function(n,r,i,o){var s=e._Ecommerce.createCommerceEventObject(i);s&&(s.EventName+="Impression",s.EventCategory=me.CommerceEventType.ProductImpression,Array.isArray(n)||(n=[n]),s.ProductImpressions=[],n.forEach((function(e){s.ProductImpressions.push({ProductImpressionList:e.Name,ProductList:Array.isArray(e.Product)?e.Product:[e.Product]})})),t.logCommerceEvent(s,r,o))},this.logCommerceEvent=function(t,n,r){if(e.Logger.verbose(Ir.InformationMessages.StartingLogCommerceEvent),t.ProductAction&&null===t.EventCategory)e.Logger.error("Commerce event not sent. The mParticle.ProductActionType you passed was invalid. Re-check your code.");else{var i=e._Helpers.sanitizeAttributes(n,t.EventName);e._Helpers.canLog()?(i&&(t.EventAttributes=i),t.ProductAction&&e._Ecommerce.calculateProductActionTotalAmount(t.ProductAction),e._APIClient.sendEventToServer(t,r),e._Persistence.update()):e.Logger.verbose(Ir.InformationMessages.AbandonLogEvent)}},this.addEventHandler=function(n,r,i,o,s){var a,u=[];if(r)if("string"==typeof r?u=document.querySelectorAll(r):r.nodeType&&(u=[r]),u.length){e.Logger.verbose("Found "+u.length+" element"+(u.length>1?"s":"")+", attaching event handlers");var c=function(){var r=u[a],c=function(n){!function(n,r){e.Logger.verbose("DOM event triggered, handling event"),t.logEvent({messageType:me.MessageType.PageEvent,name:"function"==typeof i?i(r):i,data:"function"==typeof o?o(r):o,eventType:s||me.EventType.Other}),(r.href&&"_blank"!==r.target||r.submit)&&(n.preventDefault?n.preventDefault():n.returnValue=!1,setTimeout((function(){r.href?window.location.href=r.href:r.submit&&r.submit()}),e._Store.SDKConfig.timeout))}(n,r)};r.addEventListener?r.addEventListener(n,c,!1):r.attachEvent?r.attachEvent("on"+n,c):r["on"+n]=c};for(a=0;a<u.length;a++)c()}else e.Logger.verbose("No elements found");else e.Logger.error("Can't bind event, selector is required")}}function wr(e,t){return!(null==e?void 0:e.isAttributeKeyBlocked(t))}function Pr(e,t){return!(null==e?void 0:e.isIdentityBlocked(t))}function Cr(e,t,n,r){function i(){var i=function(e,t){var n,r={};if(!e)return r;for(var i in e)W(e,i)&&!J(i)&&wr(t,i)&&(r[i]=(n=e[i],Array.isArray(n)?n.slice():n));return r}(n._Store.getUserAttributes(e),r);return n._Helpers.filterUserAttributes(i,t.userAttributeFilters)}return{getUserIdentities:function(){var i=function(e,t){var n={},r=e;for(var i in r)if(W(r,i)){var o=ve(i);if(null!==o){var s=me.IdentityType.getIdentityName(o);Pr(t,s)&&(n[s]=r[i])}}return n}(n._Store.getUserIdentities(e),r);return{userIdentities:i=n._Helpers.filterUserIdentitiesForForwarders(i,t.userIdentityFilters)}},getMPID:function(){return e},getUserAttributesLists:function(e){var t=function(e,t){var n={};for(var r in e)W(e,r)&&!J(r)&&Array.isArray(e[r])&&wr(t,r)&&(n[r]=e[r].slice());return n}(i(),r);return n._Helpers.filterUserAttributes(t,e.userAttributeFilters)},getAllUserAttributes:i}}var Ar,Tr=[me.MessageType.PageEvent,me.MessageType.PageView,me.MessageType.Commerce];function kr(e,t){return!(!e||!e.length)&&b(e,t)}function Er(e,t,n){var r=n&&n.kitBlockingEnabled?n.createBlockedEvent(e):e;if(!r)return!1;if(function(e,t,n){if(!(Tr.includes(e)&&n.filteringEventAttributeValue&&n.filteringEventAttributeValue.eventAttributeName&&n.filteringEventAttributeValue.eventAttributeValue))return!1;var r=null;if(t)for(var i in t)if(t.hasOwnProperty(i)){var o=Bn.hashAttributeConditionalForwarding(i);if(o===n.filteringEventAttributeValue.eventAttributeName){r={name:o,value:Bn.hashAttributeConditionalForwarding(t[i])};break}}var s=null!==r&&r.value===n.filteringEventAttributeValue.eventAttributeValue;return!(!0===n.filteringEventAttributeValue.includeOnMatch?s:!s)}(r.EventDataType,r.EventAttributes,t))return!1;var i=r.EventCategory;return!function(e,t,n,r){return!(e!==me.MessageType.PageEvent||!kr(r.eventNameFilters,t)&&!kr(r.eventTypeFilters,n))||!(e!==me.MessageType.Commerce||!kr(r.eventTypeFilters,n))||!(e!==me.MessageType.PageView||!kr(r.screenNameFilters,t))}(r.EventDataType,Bn.hashEventName(r.EventName,i),Bn.hashEventType(i),t)}var Dr=r.IdentityMethods,Or=Dr.Modify,Mr=Dr.Identify,Lr=Dr.Login,Fr=Dr.Logout,Ur=((Ar={})[Mr]="onIdentifyComplete",Ar[Lr]="onLoginComplete",Ar[Fr]="onLogoutComplete",Ar[Or]="onModifyComplete",Ar);function Nr(e,t){var n=e,r={};for(var i in n)n.hasOwnProperty(i)&&Pr(t,i)&&(r[i]=n[i]);return r}function Rr(e,t){var n=this,r=this;this.forwarderStatsUploader=new Kn(e,t).initializeForwarderStatsUploader();var i="setUserAttribute",o="removeUserAttribute";this.initForwarders=function(n,i){var o=e.Identity.getCurrentUser();if(!e._Store.webviewBridgeEnabled&&e._Store.configuredForwarders){var s=Nr(n,t);e._Store.configuredForwarders.sort((function(e,t){return e.settings.PriorityValue=e.settings.PriorityValue||0,t.settings.PriorityValue=t.settings.PriorityValue||0,-1*(e.settings.PriorityValue-t.settings.PriorityValue)})),e._Store.activeForwarders=e._Store.configuredForwarders.filter((function(n){if(!e._Consent.isEnabledForUserConsent(n.filteringConsentRuleValues,o))return!1;if(!r.isEnabledForUserAttributes(n.filteringUserAttributeValue,o))return!1;if(!r.isEnabledForUnknownUser(n.excludeAnonymousUser,o))return!1;var a=e._Helpers.filterUserIdentities(s,n.userIdentityFilters),u=o?Cr(o.getMPID(),n,e,t).getAllUserAttributes():{};return n.initialized||(n.logger=e.Logger,n.init(n.settings,i,!1,null,u,a,e._Store.SDKConfig.appVersion,e._Store.SDKConfig.appName,e._Store.SDKConfig.customFlags,e._Store.clientId),n.initialized=!0),!0}))}},this.isEnabledForUserAttributes=function(t,n){if(!t||!e._Helpers.isObject(t)||!Object.keys(t).length)return!0;if(!n)return!1;var r=n.getAllUserAttributes();try{var i=!!(r&&e._Helpers.isObject(r)&&Object.keys(r).length>0)&&function(e,t){for(var n in e)if(W(e,n)){var r=Bn.hashAttributeConditionalForwarding(n),i=Bn.hashAttributeConditionalForwarding(e[n]);if(r===t.userAttributeName&&i===t.userAttributeValue)return!0}return!1}(r,t);return t.includeOnMatch===i}catch(e){return!0}},this.isEnabledForUnknownUser=function(e,t){return!!(t&&t.isLoggedIn()||!e)},this.applyToForwarders=function(t,n){e._Store.activeForwarders.length&&e._Store.activeForwarders.forEach((function(r){if(r[t])try{var i=r[t](n);i&&e.Logger.verbose(i)}catch(t){e.Logger.verbose(t)}}))},this.sendEventToForwarders=function(t){if(!e._Store.webviewBridgeEnabled&&e._Store.activeForwarders){var n=function(n){if(Er(t,n)){var r,i,o=re(!0,{},t);if(o.EventAttributes=function(e,t,n,r,i){if(!r)return r;var o;if(e===me.MessageType.PageEvent?o=i.attributeFilters:e===me.MessageType.PageView&&(o=i.screenAttributeFilters),!o)return r;var s={};for(var a in r)if(r.hasOwnProperty(a)){var u=Bn.hashEventAttributeKey(t,n,a);b(o,u)||(s[a]=r[a])}return s}(t.EventDataType,t.EventCategory,t.EventName,o.EventAttributes,n),o.UserIdentities=(r=o.UserIdentities,i=n.userIdentityFilters,r&&r.length?r.filter((function(e){return!b(i,Bn.hashUserIdentity(e.Type))})):r||[]),o.UserAttributes=Bn.filterUserAttributes(o.UserAttributes,n.userAttributeFilters),n.process){e.Logger.verbose("Sending message to forwarder: "+n.name);var s=n.process(o);s&&e.Logger.verbose(s)}}};e._Store.activeForwarders.forEach((function(e){n(e)}))}},this.handleForwarderUserAttributes=function(n,r,s){t&&t.isAttributeKeyBlocked(r)||!e._Store.activeForwarders.length||e._Store.activeForwarders.forEach((function(t){if(t[n]&&!Bn.isFilteredUserAttribute(r,t.userAttributeFilters))try{var a=void 0;n===i?a=t.setUserAttribute(r,s):n===o&&(a=t.removeUserAttribute(r)),a&&e.Logger.verbose(a)}catch(t){e.Logger.error(t)}}))},this.setForwarderUserIdentities=function(n){var r=Nr(n,t);e._Store.activeForwarders.forEach((function(t){var n=e._Helpers.filterUserIdentities(r,t.userIdentityFilters);t.setUserIdentity&&n.forEach((function(n){var r=t.setUserIdentity(n.Identity,n.Type);r&&e.Logger.verbose(r)}))}))},this.setForwarderOnUserIdentified=function(n){e._Store.activeForwarders.forEach((function(r){var i=Cr(n.getMPID(),r,e,t);if(r.onUserIdentified){var o=r.onUserIdentified(i);o&&e.Logger.verbose(o)}}))},this.setForwarderOnIdentityComplete=function(n,r){var i=Ur[r];i&&e._Store.activeForwarders.forEach((function(r){var o=r[i];if(o){var s=Cr(n.getMPID(),r,e,t),a=o.call(r,s,s.getUserIdentities());a&&e.Logger.verbose(a)}}))},this.getForwarderStatsQueue=function(){return e._Persistence.forwardingStatsBatches.forwardingStatsEventQueue},this.setForwarderStatsQueue=function(t){e._Persistence.forwardingStatsBatches.forwardingStatsEventQueue=t},this.processForwarders=function(t,n){t?(this.processUIEnabledKits(t),this.processSideloadedKits(t),r.initForwarders(e._Store.SDKConfig.identifyRequest.userIdentities,n)):e.Logger.warning("No config was passed. Cannot process forwarders")},this.processUIEnabledKits=function(t){var n=this.returnKitConstructors();try{Array.isArray(t.kitConfigs)&&t.kitConfigs.length&&t.kitConfigs.forEach((function(e){r.configureUIEnabledKit(e,n)}))}catch(t){e.Logger.error("MP Kits not configured propertly. Kits may not be initialized. "+t)}},this.returnKitConstructors=function(){var t={};return z(e._Store.SDKConfig.kits)?z(e._preInit.forwarderConstructors)||e._preInit.forwarderConstructors.forEach((function(e){if(e.suffix){var n="".concat(e.name,"-").concat(e.suffix);t[n]=e}else t[e.name]=e})):t=e._Store.SDKConfig.kits,t},this.configureUIEnabledKit=function(t,n){var r=null,i=t;for(var o in n){var s=void 0;if(i.suffix&&(s="".concat(i.name,"-").concat(i.suffix)),!(o!==s&&o!==i.name||i.isDebug!==e._Store.SDKConfig.isDevelopmentMode&&i.isSandbox!==e._Store.SDKConfig.isDevelopmentMode)){r=this.returnConfiguredKit(n[o],i),e._Store.configuredForwarders.push(r);break}}},this.processSideloadedKits=function(t){try{if(Array.isArray(t.sideloadedKits)){var n={kits:{}},i=t.sideloadedKits;for(var o in i.forEach((function(e){try{e.kitInstance.register(n);var t=e.kitInstance.name;n.kits[t].filters=e.filterDictionary}catch(t){console.error("Error registering sideloaded kit "+e.kitInstance.name)}})),n.kits){var s=n.kits[o];r.configureSideloadedKit(s)}if(!z(n.kits)){var a=Object.keys(n.kits);e._Store.sideloadedKitsCount=a.length}}}catch(t){e.Logger.error("Sideloaded Kits not configured propertly. Kits may not be initialized. "+t)}},this.configureSideloadedKit=function(t){e._Store.configuredForwarders.push(this.returnConfiguredKit(t,t.filters))},this.returnConfiguredKit=function(e,t){void 0===t&&(t={});var n=new e.constructor;return n.id=t.moduleId,n.isSandbox=t.isDebug||t.isSandbox,n.hasSandbox="true"===t.hasDebugString,n.isVisible=t.isVisible||!0,n.settings=t.settings||{},n.eventNameFilters=t.eventNameFilters||[],n.eventTypeFilters=t.eventTypeFilters||[],n.attributeFilters=t.attributeFilters||[],n.screenNameFilters=t.screenNameFilters||[],n.screenAttributeFilters=t.screenAttributeFilters||[],n.userIdentityFilters=t.userIdentityFilters||[],n.userAttributeFilters=t.userAttributeFilters||[],n.filteringEventAttributeValue=t.filteringEventAttributeValue||{},n.filteringUserAttributeValue=t.filteringUserAttributeValue||{},n.eventSubscriptionId=t.eventSubscriptionId||null,n.filteringConsentRuleValues=t.filteringConsentRuleValues||{},n.excludeAnonymousUser=t.excludeAnonymousUser||!1,n},this.configurePixel=function(t){t.isDebug!==e._Store.SDKConfig.isDevelopmentMode&&t.isProduction===e._Store.SDKConfig.isDevelopmentMode||e._Store.pixelConfigurations.push(t)},this.processPixelConfigs=function(t){try{z(t.pixelConfigs)||t.pixelConfigs.forEach((function(e){r.configurePixel(e)}))}catch(t){e.Logger.error("Cookie Sync configs not configured propertly. Cookie Sync may not be initialized. "+t)}},this.sendSingleForwardingStatsToServer=function(t){return g(n,void 0,void 0,(function(){var n,r,i,o;return h(this,(function(s){switch(s.label){case 0:return n={method:"post",body:JSON.stringify(t),headers:{Accept:"text/plain;charset=UTF-8","Content-Type":"text/plain;charset=UTF-8"}},[4,this.forwarderStatsUploader.upload(n)];case 1:return r=s.sent(),i=202===r.status?"Successfully sent forwarding stats to mParticle Servers":"Issue with forwarding stats to mParticle Servers, received HTTP Code of "+r.statusText,null===(o=null==e?void 0:e.Logger)||void 0===o||o.verbose(i),[2]}}))}))}}var Vr=me.MessageType,xr=me.ApplicationTransitionType;function Hr(e){return e?e.map((function(e){return function(e){return{id:A(e.Sku),nm:A(e.Name),pr:C(e.Price),qt:C(e.Quantity),br:A(e.Brand),va:A(e.Variant),ca:A(e.Category),ps:C(e.Position),cc:A(e.CouponCode),tpa:C(e.TotalAmount),attrs:e.Attributes}}(e)})):[]}function Kr(e){var t=this;this.convertToConsentStateV2DTO=function(e){if(!e)return null;var t={},n=e.getGDPRConsentState();if(n){var r={};for(var i in t.gdpr=r,n)if(n.hasOwnProperty(i)){var o=n[i];t.gdpr[i]={},"boolean"==typeof o.Consented&&(r[i].c=o.Consented),"number"==typeof o.Timestamp&&(r[i].ts=o.Timestamp),"string"==typeof o.ConsentDocument&&(r[i].d=o.ConsentDocument),"string"==typeof o.Location&&(r[i].l=o.Location),"string"==typeof o.HardwareId&&(r[i].h=o.HardwareId)}}var s=e.getCCPAConsentState();return s&&(t.ccpa={data_sale_opt_out:{c:s.Consented,ts:s.Timestamp,d:s.ConsentDocument,l:s.Location,h:s.HardwareId}}),t},this.createEventObject=function(t,n){var i,o,s,a={},u={},c=t.messageType===me.MessageType.OptOut?!e._Store.isEnabled:null;if(e._Store.sessionId||t.messageType===me.MessageType.OptOut||e._Store.webviewBridgeEnabled){var l=p({},t.customFlags),d=e._Store.integrationAttributes;if(Qe(e._Helpers.getFeatureFlag)){e._IntegrationCapture.capture();var g=e._IntegrationCapture.getClickIdsAsCustomFlags();l=p(p({},g),l);var h=e._IntegrationCapture.getClickIdsAsIntegrationAttributes();d=p(p({},h),d)}return u=t.hasOwnProperty("toEventAPIObject")?t.toEventAPIObject():{EventName:t.name||String(t.messageType),EventCategory:t.eventType,EventAttributes:e._Helpers.sanitizeAttributes(t.data,t.name),ActiveTimeOnSite:null===(i=e._timeOnSiteTimer)||void 0===i?void 0:i.getTimeInForeground(),TotalTimeOnSite:null===(s=(o=e._Store).getTotalTimeOnSite)||void 0===s?void 0:s.call(o),PageUrl:rn()||null,SourceMessageId:t.sourceMessageId||e._Helpers.generateUniqueId(),EventDataType:t.messageType,CustomFlags:l,UserAttributeChanges:t.userAttributeChanges,UserIdentityChanges:t.userIdentityChanges},t.messageType!==me.MessageType.SessionEnd&&(e._Store.dateLastEventSent=new Date),a={Store:e._Store.serverSettings,SDKVersion:r.sdkVersion,SessionId:e._Store.sessionId,SessionStartDate:e._Store.sessionStartDate?e._Store.sessionStartDate.getTime():0,Debug:e._Store.SDKConfig.isDevelopmentMode,Location:e._Store.currentPosition,OptOut:c,ExpandedEventCount:0,AppVersion:e.getAppVersion(),AppName:e.getAppName(),Package:e._Store.SDKConfig.package,ClientGeneratedId:e._Store.clientId,DeviceId:e._Store.deviceId,IntegrationAttributes:d,CurrencyCode:e._Store.currencyCode,DataPlan:e._Store.SDKConfig.dataPlan?e._Store.SDKConfig.dataPlan:{}},u.EventDataType===Vr.AppStateTransition&&(u.IsFirstRun=e._Store.isFirstRun,u.LaunchReferral=rn()||null),u.CurrencyCode=e._Store.currencyCode,pn(n||e.Identity.getCurrentUser(),u),t.messageType===me.MessageType.SessionEnd&&(u.SessionLength=e._Store.dateLastEventSent.getTime()-e._Store.sessionStartDate.getTime(),u.currentSessionMPIDs=e._Store.currentSessionMPIDs,u.EventAttributes=e._Store.sessionAttributes,e._Store.currentSessionMPIDs=[],e._Store.sessionStartDate=null),a.Timestamp=e._Store.dateLastEventSent.getTime(),re({},u,a)}return null},this.convertEventToV2DTO=function(n){var r={n:n.EventName,et:n.EventCategory,ua:n.UserAttributes,ui:n.UserIdentities,ia:n.IntegrationAttributes,str:n.Store,attrs:n.EventAttributes,sdk:n.SDKVersion,sid:n.SessionId,sl:n.SessionLength,ssd:n.SessionStartDate,dt:n.EventDataType,dbg:n.Debug,ct:n.Timestamp,lc:n.Location,o:n.OptOut,eec:n.ExpandedEventCount,av:n.AppVersion,cgid:n.ClientGeneratedId,das:n.DeviceId,mpid:n.MPID,smpids:n.currentSessionMPIDs};n.DataPlan&&n.DataPlan.PlanId&&(r.dp_id=n.DataPlan.PlanId,n.DataPlan.PlanVersion&&(r.dp_v=n.DataPlan.PlanVersion));var i=t.convertToConsentStateV2DTO(n.ConsentState);return i&&(r.con=i),n.EventDataType===Vr.AppStateTransition&&(r.fr=n.IsFirstRun,r.iu=!1,r.at=xr.AppInit,r.lr=n.LaunchReferral,r.attrs=null),n.CustomFlags&&function(e,t){var n=[];for(var r in t.flags={},e.CustomFlags)n=[],e.CustomFlags.hasOwnProperty(r)&&(Array.isArray(e.CustomFlags[r])?e.CustomFlags[r].forEach((function(e){B(e)&&n.push(e.toString())})):B(e.CustomFlags[r])&&n.push(e.CustomFlags[r].toString()),n.length&&(t.flags[r]=n))}(n,r),n.EventDataType===Vr.Commerce?(r.cu=n.CurrencyCode,n.ProductAction?r.pd={an:n.ProductAction.ProductActionType,cs:e._Helpers.parseNumber(n.ProductAction.CheckoutStep),co:n.ProductAction.CheckoutOptions,pl:Hr(n.ProductAction.ProductList),ti:n.ProductAction.TransactionId,ta:n.ProductAction.Affiliation,tcc:n.ProductAction.CouponCode,tr:e._Helpers.parseNumber(n.ProductAction.TotalAmount),ts:e._Helpers.parseNumber(n.ProductAction.ShippingAmount),tt:e._Helpers.parseNumber(n.ProductAction.TaxAmount)}:n.PromotionAction?r.pm={an:n.PromotionAction.PromotionActionType,pl:n.PromotionAction.PromotionList.map((function(e){return{id:e.Id,nm:e.Name,cr:e.Creative,ps:e.Position?e.Position:0}}))}:n.ProductImpressions&&(r.pi=n.ProductImpressions.map((function(e){return{pil:e.ProductImpressionList,pl:Hr(e.ProductList)}})))):n.EventDataType===Vr.Profile&&(r.pet=n.ProfileMessageType),r}}function Br(e){this.startForwardingStatsTimer=function(){window.mParticle._forwardingStatsTimer=setInterval((function(){!function(){var t=e._Forwarders.getForwarderStatsQueue(),n=e._Persistence.forwardingStatsBatches.uploadsTable,r=Date.now();t.length&&(n[r]={uploading:!1,data:t},e._Forwarders.setForwarderStatsQueue([]));for(var i in n)!function(t){if(n.hasOwnProperty(t)&&!1===n[t].uploading){var r=function(){4===i.readyState&&(200===i.status||202===i.status?(e.Logger.verbose("Successfully sent "+i.statusText+" from server"),delete n[t]):"4"===i.status.toString()[0]?429!==i.status&&delete n[t]:n[t].uploading=!1)},i=e._Helpers.createXHR(r),o=n[t].data;n[t].uploading=!0,e._APIClient.sendBatchForwardingStatsToServer(o,i)}}(i)}()}),e._Store.SDKConfig.forwarderStatsTimeout)}}var qr=function(){function e(e,t,n){this.url="",this.logger=n,this.url="https://".concat(e).concat(t,"/audience"),this.userAudienceAPI=window.fetch?new ln(this.url):new dn(this.url)}return e.prototype.sendGetUserAudienceRequest=function(e,t){return g(this,void 0,void 0,(function(){var n,r,i,o,s,a;return h(this,(function(u){switch(u.label){case 0:this.logger.verbose("Fetching user audiences from server"),n={method:"GET",headers:{Accept:"*/*"}},r="".concat(this.url,"?mpid=").concat(e),u.label=1;case 1:return u.trys.push([1,6,,7]),[4,this.userAudienceAPI.upload(n,r)];case 2:return(i=u.sent()).status>=200&&i.status<300?(this.logger.verbose("User Audiences successfully received"),[4,i.json()]):[3,4];case 3:o=u.sent(),s={currentAudienceMemberships:null==o?void 0:o.audience_memberships};try{t(s)}catch(e){throw new Error("Error invoking callback on user audience response.")}return[3,5];case 4:throw 401===i.status?new Error("`HTTP error status ${userAudiencePromise.status} while retrieving User Audiences - please verify your API key.`"):403===i.status?new Error("`HTTP error status ${userAudiencePromise.status} while retrieving User Audiences - please verify your workspace is enabled for audiences.`"):new Error("Uncaught HTTP Error ".concat(i.status,"."));case 5:return[3,7];case 6:return a=u.sent(),this.logger.error("Error retrieving audiences. ".concat(a)),[3,7];case 7:return[2]}}))}))},e}(),jr=function(e,t){return z(e)||e.splice(0,e.length).forEach((function(e){try{K(e)?e():Array.isArray(e)&&zr(e)}catch(e){t.error("Error processing ready queue item: "+ie(e))}})),[]},zr=function(e){var t=e.slice(),n=t.splice(0,1)[0];if("string"==typeof n&&0!==n.length)if("undefined"!=typeof window&&window.mParticle&&window.mParticle[t[0]])window.mParticle[n].apply(window.mParticle,t);else{var r=n.split(".");try{for(var i=window.mParticle,o=window.mParticle,s=0,a=r;s<a.length;s++){var u=a[s];o=i,i=i[u]}i.apply(o,t)}catch(e){throw new Error("Unable to compute proper mParticle function "+e)}}},Qr=r.Messages,Wr=r.HTTPCodes,Jr=r.FeatureFlags,Gr=r.IdentityMethods,$r=Qr.ErrorMessages,Yr=Jr.CacheIdentity,Xr=Gr.Identify,Zr=Gr.Modify,ei=Gr.Login,ti=Gr.Logout;function ni(e){var t=e._Helpers,n=t.getFeatureFlag,i=t.extend,s=this;this.idCache=null,this.audienceManager=null,this.IdentityRequest={preProcessIdentityRequest:function(t,n,r){e.Logger.verbose(Qr.InformationMessages.StartingLogEvent+": "+r);var i=e._Helpers.Validators.removeFalsyIdentityValues(t,e.Logger),o=(null==i?void 0:i.userIdentities)?p(p({},i),{userIdentities:Rn(i.userIdentities)}):i,s=e._Helpers.Validators.validateIdentities(o,r);if(!s.valid)return e.Logger.error("ERROR: "+s.error),{valid:!1,error:s.error};if(n&&!e._Helpers.Validators.isFunction(n)){var a="The optional callback must be a function. You tried entering a(n) "+c(n);return e.Logger.error(a),{valid:!1,error:a}}return{valid:!0,cleanedIdentities:o}},createIdentityRequest:function(t,n,r,i,o,s,a){return{client_sdk:{platform:n,sdk_vendor:r,sdk_version:i},context:s,environment:e._Store.SDKConfig.isDevelopmentMode?"development":"production",request_id:e._Helpers.generateUniqueId(),request_timestamp_ms:(new Date).getTime(),previous_mpid:a||null,known_identities:On(t,o)}},createModifyIdentityRequest:function(t,n,r,i,o,s){return{client_sdk:{platform:r,sdk_vendor:i,sdk_version:o},context:s,environment:e._Store.SDKConfig.isDevelopmentMode?"development":"production",request_id:e._Helpers.generateUniqueId(),request_timestamp_ms:(new Date).getTime(),identity_changes:this.createIdentityChanges(t,n)}},createIdentityChanges:function(e,t){var n=[];if(t&&P(t)&&e&&P(e))for(var r in t)n.push({old_value:e[r]||null,new_value:t[r],identity_type:r});return n},combineUserIdentities:function(e,t){var n={},r=i({},e,t);for(var o in r){var s=me.IdentityType.getIdentityType(o);!1!==s&&s>=0&&(n[me.IdentityType.getIdentityType(o)]=r[o])}return n},createAliasNetworkRequest:function(t){return{request_id:e._Helpers.generateUniqueId(),request_type:"alias",environment:e._Store.SDKConfig.isDevelopmentMode?"development":"production",api_key:e._Store.devToken,data:{destination_mpid:t.destinationMpid,source_mpid:t.sourceMpid,start_unixtime_ms:t.startTime,end_unixtime_ms:t.endTime,scope:t.scope,device_application_stamp:e._Store.deviceId}}},convertAliasToNative:function(e){return{DestinationMpid:e.destinationMpid,SourceMpid:e.sourceMpid,StartUnixtimeMs:e.startTime,EndUnixtimeMs:e.endTime,Scope:e.scope}},convertToNative:function(e){var t=[];if(null==e?void 0:e.userIdentities){for(var n in e.userIdentities)e.userIdentities.hasOwnProperty(n)&&t.push({Type:me.IdentityType.getIdentityType(n),Identity:e.userIdentities[n]});return{UserIdentities:t}}}},this.IdentityAPI={HTTPCodes:Wr,identify:function(t,n){var i,o=e.Identity.getCurrentUser(),a=e._Identity.IdentityRequest.preProcessIdentityRequest(t,n,Xr);if(o&&(i=o.getMPID()),a.valid){var u=e._Identity.IdentityRequest.createIdentityRequest(a.cleanedIdentities,r.platform,r.sdkVendor,r.sdkVersion,e._Store.deviceId,e._Store.context,i);if(e._Helpers.getFeatureFlag(r.FeatureFlags.CacheIdentity))if(Ln(u.known_identities,s.idCache,s.parseIdentityResponse,i,n,t,Xr))return;e._Helpers.canLog()?e._Store.webviewBridgeEnabled?(e._NativeSdkHelpers.sendToNative(r.NativeSdkPaths.Identify,JSON.stringify(e._Identity.IdentityRequest.convertToNative(t))),e._Helpers.invokeCallback(n,Wr.nativeIdentityRequest,"Identify request sent to native sdk")):e._IdentityAPIClient.sendIdentityRequest(u,Xr,n,t,s.parseIdentityResponse,i,u.known_identities):(e._Helpers.invokeCallback(n,Wr.loggingDisabledOrMissingAPIKey,Qr.InformationMessages.AbandonLogEvent),e.Logger.verbose(Qr.InformationMessages.AbandonLogEvent))}else e._Helpers.invokeCallback(n,Wr.validationIssue,a.error),e.Logger.verbose(a)},logout:function(t,n){var i,o=e.Identity.getCurrentUser(),a=e._Identity.IdentityRequest.preProcessIdentityRequest(t,n,ti);if(o&&(i=o.getMPID()),a.valid){var u,c=e._Identity.IdentityRequest.createIdentityRequest(a.cleanedIdentities,r.platform,r.sdkVendor,r.sdkVersion,e._Store.deviceId,e._Store.context,i);e._Helpers.canLog()?e._Store.webviewBridgeEnabled?(e._NativeSdkHelpers.sendToNative(r.NativeSdkPaths.Logout,JSON.stringify(e._Identity.IdentityRequest.convertToNative(t))),e._Helpers.invokeCallback(n,Wr.nativeIdentityRequest,"Logout request sent to native sdk")):(e._IdentityAPIClient.sendIdentityRequest(c,ti,n,t,s.parseIdentityResponse,i),(u=e._ServerModel.createEventObject({messageType:me.MessageType.Profile})).ProfileMessageType=me.ProfileMessageType.Logout,e._Store.activeForwarders.length&&e._Store.activeForwarders.forEach((function(e){var t=e;t.logOut&&t.logOut(u)}))):(e._Helpers.invokeCallback(n,Wr.loggingDisabledOrMissingAPIKey,Qr.InformationMessages.AbandonLogEvent),e.Logger.verbose(Qr.InformationMessages.AbandonLogEvent))}else e._Helpers.invokeCallback(n,Wr.validationIssue,a.error),e.Logger.verbose(a)},login:function(t,n){var i,o=e.Identity.getCurrentUser(),a=e._Identity.IdentityRequest.preProcessIdentityRequest(t,n,ei);if(o&&(i=o.getMPID()),a.valid){var u=e._Identity.IdentityRequest.createIdentityRequest(a.cleanedIdentities,r.platform,r.sdkVendor,r.sdkVersion,e._Store.deviceId,e._Store.context,i);if(e._Helpers.getFeatureFlag(r.FeatureFlags.CacheIdentity))if(Ln(u.known_identities,s.idCache,s.parseIdentityResponse,i,n,t,ei))return;e._Helpers.canLog()?e._Store.webviewBridgeEnabled?(e._NativeSdkHelpers.sendToNative(r.NativeSdkPaths.Login,JSON.stringify(e._Identity.IdentityRequest.convertToNative(t))),e._Helpers.invokeCallback(n,Wr.nativeIdentityRequest,"Login request sent to native sdk")):e._IdentityAPIClient.sendIdentityRequest(u,ei,n,t,s.parseIdentityResponse,i,u.known_identities):(e._Helpers.invokeCallback(n,Wr.loggingDisabledOrMissingAPIKey,Qr.InformationMessages.AbandonLogEvent),e.Logger.verbose(Qr.InformationMessages.AbandonLogEvent))}else e._Helpers.invokeCallback(n,Wr.validationIssue,a.error),e.Logger.verbose(a)},modify:function(t,n){var i,o=e.Identity.getCurrentUser(),a=e._Identity.IdentityRequest.preProcessIdentityRequest(t,n,Zr);if(o&&(i=o.getMPID()),a.valid){var u=(null==t?void 0:t.userIdentities)?a.cleanedIdentities.userIdentities:{},c=e._Identity.IdentityRequest.createModifyIdentityRequest(o?o.getUserIdentities().userIdentities:{},u,r.platform,r.sdkVendor,r.sdkVersion,e._Store.context);e._Helpers.canLog()?e._Store.webviewBridgeEnabled?(e._NativeSdkHelpers.sendToNative(r.NativeSdkPaths.Modify,JSON.stringify(e._Identity.IdentityRequest.convertToNative(t))),e._Helpers.invokeCallback(n,Wr.nativeIdentityRequest,"Modify request sent to native sdk")):e._IdentityAPIClient.sendIdentityRequest(c,Zr,n,t,s.parseIdentityResponse,i):(e._Helpers.invokeCallback(n,Wr.loggingDisabledOrMissingAPIKey,Qr.InformationMessages.AbandonLogEvent),e.Logger.verbose(Qr.InformationMessages.AbandonLogEvent))}else e._Helpers.invokeCallback(n,Wr.validationIssue,a.error),e.Logger.verbose(a)},getCurrentUser:function(){var t;return e._Store?(t=e._Store.mpid)?(t=e._Store.mpid.slice(),s.mParticleUser(t,e._Store.isLoggedIn)):e._Store.webviewBridgeEnabled?s.mParticleUser():null:null},getUser:function(t){var n=e._Persistence.getPersistence();return n&&n[t]&&!r.SDKv2NonMPIDCookieKeys.hasOwnProperty(t)?s.mParticleUser(t):null},getUsers:function(){var t=e._Persistence.getPersistence(),n=[];if(t)for(var i in t)r.SDKv2NonMPIDCookieKeys.hasOwnProperty(i)||n.push(s.mParticleUser(i));return n.sort((function(e,t){return(e.getLastSeenTime()||0)>(t.getLastSeenTime()||0)?-1:1})),n},aliasUsers:function(t,n){var i;if(t.destinationMpid&&t.sourceMpid||(i=Qr.ValidationMessages.AliasMissingMpid),t.destinationMpid===t.sourceMpid&&(i=Qr.ValidationMessages.AliasNonUniqueMpid),t.startTime&&t.endTime||(i=Qr.ValidationMessages.AliasMissingTime),t.startTime>t.endTime&&(i=Qr.ValidationMessages.AliasStartBeforeEndTime),i)return e.Logger.warning(i),void e._Helpers.invokeAliasCallback(n,Wr.validationIssue,i);if(e._Helpers.canLog())if(e._Store.webviewBridgeEnabled)e._NativeSdkHelpers.sendToNative(r.NativeSdkPaths.Alias,JSON.stringify(e._Identity.IdentityRequest.convertAliasToNative(t))),e._Helpers.invokeAliasCallback(n,Wr.nativeIdentityRequest,"Alias request sent to native sdk");else{e.Logger.verbose(Qr.InformationMessages.StartingAliasRequest+": "+t.sourceMpid+" -> "+t.destinationMpid);var o=e._Identity.IdentityRequest.createAliasNetworkRequest(t);e._IdentityAPIClient.sendAliasRequest(o,n)}else e._Helpers.invokeAliasCallback(n,Wr.loggingDisabledOrMissingAPIKey,Qr.InformationMessages.AbandonAliasUsers),e.Logger.verbose(Qr.InformationMessages.AbandonAliasUsers)},search:function(t,n,r){Hn(e,t,n,r)},createAliasRequest:function(t,n,r){try{if(!n||!t)return e.Logger.error("'destinationUser' and 'sourceUser' must both be present"),null;var i=t.getFirstSeenTime();i||e.Identity.getUsers().forEach((function(e){e.getFirstSeenTime()&&(!i||e.getFirstSeenTime()<i)&&(i=e.getFirstSeenTime())}));var o=(new Date).getTime()-24*e._Store.SDKConfig.aliasMaxWindow*60*60*1e3,s=t.getLastSeenTime()||(new Date).getTime();return i<o&&s<(i=o)&&e.Logger.warning("Source User has not been seen in the last "+e._Store.SDKConfig.maxAliasWindow+" days, Alias Request will likely fail"),{destinationMpid:n.getMPID(),sourceMpid:t.getMPID(),startTime:i,endTime:s,scope:r||"device"}}catch(t){return e.Logger.error("There was a problem with creating an alias request: "+t),null}}},this.mParticleUser=function(t,n){return{getUserIdentities:function(){var n={},r=e._Store.getUserIdentities(t);for(var i in r)if(W(r,i)){var o=ve(i);null!==o&&(n[me.IdentityType.getIdentityName(o)]=r[i])}return{userIdentities:n}},getMPID:function(){return t},setUserTag:function(t){e._Helpers.Validators.isValidKeyValue(t)?this.setUserAttribute(t,null):e.Logger.error(Qr.ErrorMessages.BadKey)},removeUserTag:function(t){e._Helpers.Validators.isValidKeyValue(t)?this.removeUserAttribute(t):e.Logger.error(Qr.ErrorMessages.BadKey)},setUserAttribute:function(n,i){if(e._SessionManager.resetSessionTimer(),e._Helpers.canLog()){if(!e._Helpers.Validators.isValidAttributeValue(i))return void e.Logger.error(Qr.ErrorMessages.BadAttribute);if(!e._Helpers.Validators.isValidKeyValue(n))return void e.Logger.error(Qr.ErrorMessages.BadKey);if(e._Store.webviewBridgeEnabled)e._NativeSdkHelpers.sendToNative(r.NativeSdkPaths.SetUserAttribute,JSON.stringify({key:n,value:i}));else{var o=this.getAllUserAttributes(),a=void 0,u=void 0,c=e._Helpers.findKeyInObject(o,n);c?(u=!1,a=o[c],delete o[c]):u=!0,o[n]=i,e._Store.setUserAttributes(t,o),s.sendUserAttributeChangeEvent(n,i,a,u,!1,this),e._Forwarders.initForwarders(s.IdentityAPI.getCurrentUser().getUserIdentities().userIdentities,e._APIClient.prepareForwardingStats),e._Forwarders.handleForwarderUserAttributes("setUserAttribute",n,i)}}},setUserAttributes:function(t){if(e._SessionManager.resetSessionTimer(),P(t)){if(e._Helpers.canLog())for(var n in t)t.hasOwnProperty(n)&&this.setUserAttribute(n,t[n])}else e.Logger.error("Must pass an object into setUserAttributes. You passed a "+c(t))},removeUserAttribute:function(n){var i,o;if(e._SessionManager.resetSessionTimer(),e._Helpers.Validators.isValidKeyValue(n))if(e._Store.webviewBridgeEnabled)e._NativeSdkHelpers.sendToNative(r.NativeSdkPaths.RemoveUserAttribute,JSON.stringify({key:n,value:null}));else{i=e._Persistence.getPersistence(),o=this.getAllUserAttributes();var a=e._Helpers.findKeyInObject(o,n);a&&(n=a);var u=o[n]?o[n].toString():null;delete o[n],i&&P(i[t])&&(i[t].ua=o,e._Persistence.savePersistence(i)),s.sendUserAttributeChangeEvent(n,null,u,!1,!0,this),e._Forwarders.initForwarders(s.IdentityAPI.getCurrentUser().getUserIdentities().userIdentities,e._APIClient.prepareForwardingStats),e._Forwarders.handleForwarderUserAttributes("removeUserAttribute",n,null)}else e.Logger.error(Qr.ErrorMessages.BadKey)},setUserAttributeList:function(n,i){if(e._SessionManager.resetSessionTimer(),e._Helpers.Validators.isValidKeyValue(n))if(Array.isArray(i)){var o=i.slice();if(e._Store.webviewBridgeEnabled)e._NativeSdkHelpers.sendToNative(r.NativeSdkPaths.SetUserAttributeList,JSON.stringify({key:n,value:o}));else{var a=this.getAllUserAttributes(),u=void 0,l=void 0,d=void 0,p=e._Helpers.findKeyInObject(a,n);if(p?(l=!1,u=a[p],delete a[p]):l=!0,a[n]=o,e._Store.setUserAttributes(t,a),u&&Array.isArray(u)){if(i.length!==u.length)d=!0;else for(var g=0;g<i.length;g++)if(u[g]!==i[g]){d=!0;break}}else d=!0;d&&s.sendUserAttributeChangeEvent(n,i,u,l,!1,this),e._Forwarders.initForwarders(s.IdentityAPI.getCurrentUser().getUserIdentities().userIdentities,e._APIClient.prepareForwardingStats),e._Forwarders.handleForwarderUserAttributes("setUserAttribute",n,o)}}else e.Logger.error("The value you passed in to setUserAttributeList must be an array. You passed in a "+c(i));else e.Logger.error(Qr.ErrorMessages.BadKey)},removeAllUserAttributes:function(){var t;if(e._SessionManager.resetSessionTimer(),e._Store.webviewBridgeEnabled)e._NativeSdkHelpers.sendToNative(r.NativeSdkPaths.RemoveAllUserAttributes);else if(t=this.getAllUserAttributes(),e._Forwarders.initForwarders(s.IdentityAPI.getCurrentUser().getUserIdentities().userIdentities,e._APIClient.prepareForwardingStats),t)for(var n in t)W(t,n)&&e._Forwarders.handleForwarderUserAttributes("removeUserAttribute",n,null),this.removeUserAttribute(n)},getUserAttributesLists:function(){var e,t={};for(var n in e=this.getAllUserAttributes())W(e,n)&&!J(n)&&Array.isArray(e[n])&&(t[n]=e[n].slice());return t},getAllUserAttributes:function(){var n={},r=(0,e._Store.getUserAttributes)(t);if(r)for(var i in r)if(W(r,i)&&!J(i)){var o=r[i];Array.isArray(o)?n[i]=o.slice():n[i]=o}return n},getConsentState:function(){return e._Store.getConsentState(t)},setConsentState:function(n){e._Store.setConsentState(t,n),e._Forwarders.initForwarders(this.getUserIdentities().userIdentities,e._APIClient.prepareForwardingStats),e._CookieSyncManager.attemptCookieSync(this.getMPID())},isLoggedIn:function(){return n},getLastSeenTime:function(){return e._Persistence.getLastSeenTime(t)},getFirstSeenTime:function(){return e._Persistence.getFirstSeenTime(t)},getUserAudiences:function(n){e._Helpers.getFeatureFlag(Jr.AudienceAPI)?(null===s.audienceManager&&(s.audienceManager=new qr(e._Store.SDKConfig.userAudienceUrl,e._Store.devToken,e.Logger)),s.audienceManager.sendGetUserAudienceRequest(t,n)):e.Logger.error($r.AudienceAPINotEnabled)}}},this.parseIdentityResponse=function(t,r,i,a,u,c,l){var d,p,g,h,v,f,m=e.Identity.getUser(r),y=m?m.getMPID():null,b=m?m.getUserIdentities().userIdentities:{},S={};e._Store.identityCallInFlight=!1;try{if(e.Logger.verbose('Parsing "'+u+'" identity response from server'),v=null!==(d=t.responseText)&&void 0!==d?d:null,e._Store.isLoggedIn=(null==v?void 0:v.is_logged_in)||!1,function(e,t){return!e||e.getMPID()&&t.mpid&&t.mpid!==e.getMPID()}(m,v)&&(e._Store.mpid=v.mpid,m&&e._Persistence.setLastSeenTime(r),h=!e._Persistence.getFirstSeenTime(v.mpid),e._Persistence.setFirstSeenTime(v.mpid)),t.status===o){n(Yr)&&Tn(u,c,s.idCache,t,l);var _=s.IdentityAPI.getUser(v.mpid),w=_?_.getUserIdentities().userIdentities:{};u===Zr?(S=e._Identity.IdentityRequest.combineUserIdentities(b,a.userIdentities),e._Store.setUserIdentities(r,S)):(u===Xr&&m&&v.mpid===y&&e._Persistence.setFirstSeenTime(v.mpid),e._Store.addMpidToSessionHistory(v.mpid,r),e._CookieSyncManager.attemptCookieSync(v.mpid,h),e._Persistence.swapCurrentUser(r,v.mpid,e._Store.currentSessionMPIDs),a&&!z(a.userIdentities)&&(S=s.IdentityRequest.combineUserIdentities(w,a.userIdentities)),e._Store.setUserIdentities(v.mpid,S),e._Persistence.update(),e._Store.syncPersistenceData(),e._Store.context=v.context||e._Store.context),function(e,t,n,r,i){if(n&&n.onUserAlias&&K(n.onUserAlias))try{tr({methodName:"onUserAlias",warningMessage:I("onUserAlias")},r,i),n.onUserAlias(e,t)}catch(e){r.error("There was an error with your onUserAlias function - "+e)}}(m,f=e.Identity.getCurrentUser(),a,e.Logger,e._ErrorReportingDispatcher);var P=e._Persistence.getPersistence();f&&(e._Persistence.storeDataInMemory(P,f.getMPID()),s.reinitForwardersOnUserChange(m,f),s.setForwarderCallbacks(f,u));var C=ue.getNewIdentitiesByName(S),A=u===Zr?b:w;null===(p=e._CookieConsentManager)||void 0===p||p.syncNoTargetingAttribute(f),s.sendUserIdentityChangeEvent(C,u,v.mpid,A)}if(i){var T=0===t.status?Wr.noHttpCoverage:t.status;e._Helpers.invokeCallback(i,T,v||null,f,r)}else v&&!z(v.errors)&&e.Logger.error("Received HTTP response code of "+t.status+" - "+v.errors[0].message);e.Logger.verbose("Successfully parsed Identity Response"),null===(g=e._APIClient)||void 0===g||g.processQueuedEvents()}catch(n){i&&e._Helpers.invokeCallback(i,t.status,v||null),e.Logger.error("Error parsing JSON response from Identity server: "+n)}e._Store.isInitialized=!0,e._RoktManager.onIdentityComplete(),e._preInit.readyQueue=jr(e._preInit.readyQueue,e.Logger)},this.sendUserIdentityChangeEvent=function(t,n,r,i){var o;if(r||n===Zr){var a=this.IdentityAPI.getUser(r);for(var u in t)if(i[u]!==t[u]){var c=!i[u],l=s.createUserIdentityChange(u,t[u],i[u],c,a);null===(o=e._APIClient)||void 0===o||o.sendEventToServer(l)}}},this.createUserIdentityChange=function(t,n,r,i,o){return e._ServerModel.createEventObject({messageType:me.MessageType.UserIdentityChange,userIdentityChanges:{New:{IdentityType:t,Identity:n,CreatedThisBatch:i},Old:{IdentityType:t,Identity:r,CreatedThisBatch:!1}},userInMemory:o})},this.sendUserAttributeChangeEvent=function(t,n,r,i,o,a){var u,c=s.createUserAttributeChange(t,n,r,i,o,a);c&&(null===(u=e._APIClient)||void 0===u||u.sendEventToServer(c))},this.createUserAttributeChange=function(t,n,r,i,o,s){var a;return void 0===r&&(r=null),n!==r&&(a=e._ServerModel.createEventObject({messageType:me.MessageType.UserAttributeChange,userAttributeChanges:{UserAttributeName:t,New:n,Old:r,Deleted:o,IsNewAttribute:i}},s)),a},this.reinitForwardersOnUserChange=function(t,n){var r;(function(e,t){return!e||t.getMPID()!==e.getMPID()||e.isLoggedIn()!==t.isLoggedIn()})(t,n)&&(null===(r=e._Forwarders)||void 0===r||r.initForwarders(n.getUserIdentities().userIdentities,e._APIClient.prepareForwardingStats))},this.setForwarderCallbacks=function(t,n){var r,i,o;null===(r=e._Forwarders)||void 0===r||r.setForwarderUserIdentities(t.getUserIdentities().userIdentities),null===(i=e._Forwarders)||void 0===i||i.setForwarderOnIdentityComplete(t,n),null===(o=e._Forwarders)||void 0===o||o.setForwarderOnUserIdentified(t)}}var ri=r.CCPAPurpose;function ii(e){var t=this;function n(e){return P(e)?t.createPrivacyConsent(e.c,e.ts,e.d,e.l,e.h):null}this.isEnabledForUserConsent=function(e,t){if(!e||!e.values||!e.values.length)return!0;if(!t)return!1;var n,r={},i=t.getConsentState();if(i){var o=i.getGDPRConsentState();if(o)for(var s in o)o.hasOwnProperty(s)&&(n=Bn.hashConsentPurposeConditionalForwarding("1",s),r[n]=o[s].Consented);var a=i.getCCPAConsentState();a&&(n=Bn.hashConsentPurposeConditionalForwarding("2",ri),r[n]=a.Consented)}var u=e.values.some((function(e){var t=e.consentPurpose,n=e.hasConsented;return!!r.hasOwnProperty(t)&&r[t]===n}));return e.includeOnMatch===u},this.createPrivacyConsent=function(t,n,r,i,o){if("boolean"!=typeof t)return e.Logger.error("Consented boolean is required when constructing a Consent object."),null;var s=n instanceof Date;return s&&(n=n.getTime()),(n||s)&&("number"!=typeof n&&"string"!=typeof n||isNaN(n))?(e.Logger.error("Timestamp must be a valid number when constructing a Consent object."),null):r&&"string"!=typeof r?(e.Logger.error("Document must be a valid string when constructing a Consent object."),null):i&&"string"!=typeof i?(e.Logger.error("Location must be a valid string when constructing a Consent object."),null):o&&"string"!=typeof o?(e.Logger.error("Hardware ID must be a valid string when constructing a Consent object."),null):{Consented:t,Timestamp:n||Date.now(),ConsentDocument:r,Location:i,HardwareId:o}},this.ConsentSerialization={toMinifiedJsonObject:function(e){var t,n={};if(e){var r=e.getGDPRConsentState();if(r)for(var i in n.gdpr={},r)if(r.hasOwnProperty(i)){var o=r[i];n.gdpr[i]={},"boolean"==typeof o.Consented&&(n.gdpr[i].c=o.Consented),"number"==typeof o.Timestamp&&(n.gdpr[i].ts=o.Timestamp),"string"==typeof o.ConsentDocument&&(n.gdpr[i].d=o.ConsentDocument),"string"==typeof o.Location&&(n.gdpr[i].l=o.Location),"string"==typeof o.HardwareId&&(n.gdpr[i].h=o.HardwareId)}var s=e.getCCPAConsentState();s&&(n.ccpa=((t={})[ri]={},t),"boolean"==typeof s.Consented&&(n.ccpa[ri].c=s.Consented),"number"==typeof s.Timestamp&&(n.ccpa[ri].ts=s.Timestamp),"string"==typeof s.ConsentDocument&&(n.ccpa[ri].d=s.ConsentDocument),"string"==typeof s.Location&&(n.ccpa[ri].l=s.Location),"string"==typeof s.HardwareId&&(n.ccpa[ri].h=s.HardwareId))}return n},fromMinifiedJsonObject:function(e){var r=t.createConsentState();if(!P(e))return r;if(P(e.gdpr))for(var i in e.gdpr)W(e.gdpr,i)&&r.addGDPRConsentState(i,n(e.gdpr[i]));return P(e.ccpa)&&W(e.ccpa,ri)&&r.setCCPAConsentState(n(e.ccpa[ri])),r}},this.createConsentState=function(n){var r={},i={};if(n){var o=t.createConsentState();return o.setGDPRConsentState(n.getGDPRConsentState()),o.setCCPAConsentState(n.getCCPAConsentState()),o}function s(e){if("string"!=typeof e)return null;var t=e.trim();return t.length?t.toLowerCase():null}return{setGDPRConsentState:function(e){if(e){if(P(e))for(var t in r={},e)e.hasOwnProperty(t)&&this.addGDPRConsentState(t,e[t])}else r={};return this},addGDPRConsentState:function(n,i){var o=s(n);if(!o)return e.Logger.error("Purpose must be a string."),this;if(!P(i))return e.Logger.error("Invoked with a bad or empty consent object."),this;var a=t.createPrivacyConsent(i.Consented,i.Timestamp,i.ConsentDocument,i.Location,i.HardwareId);return a&&(r[o]=a),this},setCCPAConsentState:function(n){if(!P(n))return e.Logger.error("Invoked with a bad or empty CCPA consent object."),this;var r=t.createPrivacyConsent(n.Consented,n.Timestamp,n.ConsentDocument,n.Location,n.HardwareId);return r&&(i[ri]=r),this},getCCPAConsentState:function(){return i[ri]},getGDPRConsentState:function(){return Object.assign({},r)},removeGDPRConsentState:function(e){var t=s(e);return t?(delete r[t],this):this},removeCCPAConsentState:function(){return delete i[ri],this}}}}var oi={ScreenView:"screen_view",CustomEvent:"custom_event",Commerce:"commerce",UserAttributes:"user_attributes",UserIdentities:"user_identities",ProductAction:"product_action",PromotionAction:"promotion_action",ProductImpression:"product_impression"},si=function(e){return e},ai=function(e){return p(p({},e),{UserAttributes:{}})},ui=function(e){return p(p({},e),{UserIdentities:[]})},ci=function(){function e(e,t){var n,r,i,o,s,a,u,c,l,d,p,g,h,v,f,m=this;if(this.dataPlanMatchLookups={},this.blockEvents=!1,this.blockEventAttributes=!1,this.blockUserAttributes=!1,this.blockUserIdentities=!1,this.kitBlockingEnabled=!1,!e||e.document){this.kitBlockingEnabled=!0,this.mpInstance=t,this.blockEvents=null===(i=null===(r=null===(n=null==e?void 0:e.document)||void 0===n?void 0:n.dtpn)||void 0===r?void 0:r.blok)||void 0===i?void 0:i.ev,this.blockEventAttributes=null===(a=null===(s=null===(o=null==e?void 0:e.document)||void 0===o?void 0:o.dtpn)||void 0===s?void 0:s.blok)||void 0===a?void 0:a.ea,this.blockUserAttributes=null===(l=null===(c=null===(u=null==e?void 0:e.document)||void 0===u?void 0:u.dtpn)||void 0===c?void 0:c.blok)||void 0===l?void 0:l.ua,this.blockUserIdentities=null===(g=null===(p=null===(d=null==e?void 0:e.document)||void 0===d?void 0:d.dtpn)||void 0===p?void 0:p.blok)||void 0===g?void 0:g.id;var y=null===(f=null===(v=null===(h=null==e?void 0:e.document)||void 0===h?void 0:h.dtpn)||void 0===v?void 0:v.vers)||void 0===f?void 0:f.version_document,b=null==y?void 0:y.data_points;if(y)try{(null==b?void 0:b.length)>0&&b.forEach((function(e){return m.addToMatchLookups(e)}))}catch(e){this.mpInstance.Logger.error("There was an issue with the data plan: "+e)}}else this.kitBlockingEnabled=!1}return e.prototype.addToMatchLookups=function(e){var t,n,r;if(e.match&&e.validator){var i=this.generateMatchKey(e.match),o=this.getPlannedProperties(e.match.type,e.validator);this.dataPlanMatchLookups[i]=o,(null===(t=null==e?void 0:e.match)||void 0===t?void 0:t.type)!==oi.ProductImpression&&(null===(n=null==e?void 0:e.match)||void 0===n?void 0:n.type)!==oi.ProductAction&&(null===(r=null==e?void 0:e.match)||void 0===r?void 0:r.type)!==oi.PromotionAction||(i=this.generateProductAttributeMatchKey(e.match),o=this.getProductProperties(e.match.type,e.validator),this.dataPlanMatchLookups[i]=o)}else this.mpInstance.Logger.warning("Data Plan Point is not valid' + ".concat(e))},e.prototype.generateMatchKey=function(e){var t=e.criteria||"";switch(e.type){case oi.CustomEvent:var n=t;return[oi.CustomEvent,n.custom_event_type,n.event_name].join(":");case oi.ScreenView:var r=t;return[oi.ScreenView,"",r.screen_name].join(":");case oi.ProductAction:var i=t;return[e.type,i.action].join(":");case oi.PromotionAction:var o=t;return[e.type,o.action].join(":");case oi.ProductImpression:var s=t;return[e.type,s.action].join(":");case oi.UserIdentities:case oi.UserAttributes:return[e.type].join(":");default:return null}},e.prototype.generateProductAttributeMatchKey=function(e){var t=e.criteria||"";switch(e.type){case oi.ProductAction:var n=t;return[e.type,n.action,"ProductAttributes"].join(":");case oi.PromotionAction:var r=t;return[e.type,r.action,"ProductAttributes"].join(":");case oi.ProductImpression:return[e.type,"ProductAttributes"].join(":");default:return null}},e.prototype.getPlannedProperties=function(e,t){var n,r,i,o,s,a,u,c,l,d;switch(e){case oi.CustomEvent:case oi.ScreenView:case oi.ProductAction:case oi.PromotionAction:case oi.ProductImpression:if(l=null===(o=null===(i=null===(r=null===(n=null==t?void 0:t.definition)||void 0===n?void 0:n.properties)||void 0===r?void 0:r.data)||void 0===i?void 0:i.properties)||void 0===o?void 0:o.custom_attributes){if(!0===l.additionalProperties||void 0===l.additionalProperties)return!0;for(var p={},g=0,h=Object.keys(l.properties);g<h.length;g++){p[h[g]]=!0}return p}return!1!==(null===(u=null===(a=null===(s=null==t?void 0:t.definition)||void 0===s?void 0:s.properties)||void 0===a?void 0:a.data)||void 0===u?void 0:u.additionalProperties)||{};case oi.UserAttributes:case oi.UserIdentities:if(!0===(d=null===(c=null==t?void 0:t.definition)||void 0===c?void 0:c.additionalProperties)||void 0===d)return!0;p={};for(var v=t.definition.properties,f=0,m=Object.keys(v);f<m.length;f++){p[m[f]]=!0}return p;default:return null}},e.prototype.getProductProperties=function(e,t){var n,r,i,o,s,a,u,c,l,d,p,g,h,v,f,m,y,b,S,I;switch(e){case oi.ProductImpression:if(!1===(null==(I=null===(d=null===(l=null===(c=null===(u=null===(a=null===(s=null===(o=null===(i=null===(r=null===(n=null==t?void 0:t.definition)||void 0===n?void 0:n.properties)||void 0===r?void 0:r.data)||void 0===i?void 0:i.properties)||void 0===o?void 0:o.product_impressions)||void 0===s?void 0:s.items)||void 0===a?void 0:a.properties)||void 0===u?void 0:u.products)||void 0===c?void 0:c.items)||void 0===l?void 0:l.properties)||void 0===d?void 0:d.custom_attributes)?void 0:I.additionalProperties)){for(var _={},w=0,P=Object.keys(null==I?void 0:I.properties);w<P.length;w++){_[P[w]]=!0}return _}return!0;case oi.ProductAction:case oi.PromotionAction:if((I=null===(S=null===(b=null===(y=null===(m=null===(f=null===(v=null===(h=null===(g=null===(p=null==t?void 0:t.definition)||void 0===p?void 0:p.properties)||void 0===g?void 0:g.data)||void 0===h?void 0:h.properties)||void 0===v?void 0:v.product_action)||void 0===f?void 0:f.properties)||void 0===m?void 0:m.products)||void 0===y?void 0:y.items)||void 0===b?void 0:b.properties)||void 0===S?void 0:S.custom_attributes)&&!1===I.additionalProperties){_={};for(var C=0,A=Object.keys(null==I?void 0:I.properties);C<A.length;C++){_[A[C]]=!0}return _}return!0;default:return null}},e.prototype.getMatchKey=function(e){switch(e.event_type){case He.EventTypeEnum.screenView:var t=e;return t.data?["screen_view","",t.data.screen_name].join(":"):null;case He.EventTypeEnum.commerceEvent:var n=e,r=[];if(n&&n.data){var i=n.data,o=i.product_action,s=i.product_impressions,a=i.promotion_action;o?(r.push(oi.ProductAction),r.push(o.action)):a?(r.push(oi.PromotionAction),r.push(a.action)):s&&r.push(oi.ProductImpression)}return r.join(":");case He.EventTypeEnum.customEvent:var u=e;return u.data?["custom_event",u.data.custom_event_type,u.data.event_name].join(":"):null;default:return null}},e.prototype.getProductAttributeMatchKey=function(e){if(e.event_type===He.EventTypeEnum.commerceEvent){var t=[],n=e.data,r=n.product_action,i=n.product_impressions,o=n.promotion_action;return r?(t.push(oi.ProductAction),t.push(r.action),t.push("ProductAttributes")):o?(t.push(oi.PromotionAction),t.push(o.action),t.push("ProductAttributes")):i&&(t.push(oi.ProductImpression),t.push("ProductAttributes")),t.join(":")}return null},e.prototype.createBlockedEvent=function(e){return e&&(e=this.applyBlockingStep("the event and its attributes",this.transformEventAndEventAttributes,e,si)),e&&e.EventDataType===me.MessageType.Commerce&&(e=this.applyBlockingStep("product attributes",this.transformProductAttributes,e,si)),e&&(e=this.applyBlockingStep("user attributes",this.transformUserAttributes,e,ai),e=this.applyBlockingStep("user identities",this.transformUserIdentities,e,ui)),e},e.prototype.applyBlockingStep=function(e,t,n,r){try{return t.call(this,n)}catch(t){var i=r(n);return this.reportFailedStep(e,t),i}},e.prototype.reportFailedStep=function(e,t){try{this.mpInstance.Logger.error("Kit blocking could not filter "+e+": "+t)}catch(e){}},e.prototype.transformEventAndEventAttributes=function(e){var t=p({},e),n=Ze(t);if(!n)return t;var r=this.getMatchKey(n),i=this.dataPlanMatchLookups[r];if(this.blockEvents&&!i)return null;if(this.blockEventAttributes){if(!0===i)return t;if(i){if(t.EventAttributes){for(var o={},s=0,a=Object.keys(t.EventAttributes);s<a.length;s++){var u=a[s];!0===i[u]&&(o[u]=t.EventAttributes[u])}t.EventAttributes=o}return t}return t}return t},e.prototype.transformProductAttributes=function(e){var t=p({},e),n=Ze(t),r=this.getProductAttributeMatchKey(n),i=this.dataPlanMatchLookups[r];function o(e,t){return null==t?void 0:t.map((function(t){if(!t.Attributes)return t;for(var n={},r=0,i=Object.keys(t.Attributes);r<i.length;r++){var o=i[r];!0===e[o]&&(n[o]=t.Attributes[o])}return p(p({},t),{Attributes:n})}))}return this.blockEvents&&!i?null:this.blockEventAttributes?!0===i?t:i?(t.ProductAction?t.ProductAction=p(p({},t.ProductAction),{ProductList:o(i,t.ProductAction.ProductList)}):t.ProductImpressions?t.ProductImpressions=t.ProductImpressions.map((function(e){return p(p({},e),{ProductList:o(i,e.ProductList)})})):this.mpInstance.Logger.warning("Product Not Supported "),t):t:t},e.prototype.transformUserAttributes=function(e){var t=p({},e);if(this.blockUserAttributes){var n=this.dataPlanMatchLookups.user_attributes;if(this.mpInstance._Helpers.isObject(n)&&t.UserAttributes){for(var r={},i=0,o=Object.keys(t.UserAttributes);i<o.length;i++){var s=o[i];!0===n[s]&&(r[s]=t.UserAttributes[s])}t.UserAttributes=r}}return t},e.prototype.isAttributeKeyBlocked=function(e){if(!this.blockUserAttributes)return!1;var t=this.dataPlanMatchLookups.user_attributes;return("boolean"!=typeof t||!t)&&("object"===c(t)&&!0!==t[e])},e.prototype.isIdentityBlocked=function(e){if(!this.blockUserIdentities)return!1;if(!this.blockUserIdentities)return!1;var t=this.dataPlanMatchLookups.user_identities;return!(!0===t||!t)&&!t[e]},e.prototype.transformUserIdentities=function(e){var t,n=this,r=p({},e);if(this.blockUserIdentities){var i=this.dataPlanMatchLookups.user_identities;this.mpInstance._Helpers.isObject(i)&&(null===(t=null==r?void 0:r.UserIdentities)||void 0===t?void 0:t.length)&&(r.UserIdentities=r.UserIdentities.filter((function(e){var t=me.IdentityType.getIdentityName(n.mpInstance._Helpers.parseNumber(e.Type));return i[t]})))}return r},e}(),li=function(e,t,n,r){var i=e+t+"/config",o=["env=".concat(r?"1":"0")],s=n||{},a=s.planId,u=s.planVersion;return a&&o.push("plan_id=".concat(a)),u&&o.push("plan_version=".concat(u)),"".concat(i,"?").concat(o.join("&"))};function di(e,t,n){var r=this,i="https://"+n._Store.SDKConfig.configUrl,o=t.isDevelopmentMode,s=t.dataPlan,a=li(i,e,s,o),u=window.fetch?new ln(a):new dn(a);this.getSDKConfiguration=function(){return g(r,void 0,void 0,(function(){var e,r,i,o,s,a;return h(this,(function(c){switch(c.label){case 0:e={method:"get",headers:{Accept:"text/plain;charset=UTF-8","Content-Type":"text/plain;charset=UTF-8"},body:null},c.label=1;case 1:return c.trys.push([1,6,,7]),[4,u.upload(e)];case 2:return 200!==(r=c.sent()).status?[3,5]:(null===(o=null==n?void 0:n.Logger)||void 0===o||o.verbose("Successfully received configuration from server"),r.json?[4,r.json()]:[3,4]);case 3:return[2,c.sent()];case 4:return i=r,[2,JSON.parse(i.responseText)];case 5:return null===(s=null==n?void 0:n.Logger)||void 0===s||s.verbose("Issue with receiving configuration from server, received HTTP Code of "+r.statusText),[3,7];case 6:return c.sent(),null===(a=null==n?void 0:n.Logger)||void 0===a||a.error("Error getting forwarder configuration from mParticle servers."),[3,7];case 7:return[2,t]}}))}))}}var pi=r.HTTPCodes,gi=r.Messages,hi=r.IdentityMethods.Modify;function vi(e){this.sendAliasRequest=function(t,n){return g(this,void 0,void 0,(function(){var r,i,u,c,l,d,p,g,v,f,m,y,b,S;return h(this,(function(h){switch(h.label){case 0:r=e.Logger,i=e._Helpers.invokeAliasCallback,u=e._Store.SDKConfig.aliasUrl,c=e._Store.devToken,r.verbose(gi.InformationMessages.SendAliasHttp),l="https://".concat(u).concat(c,"/Alias"),d=window.fetch?new ln(l):new dn(l),p={method:"post",headers:{Accept:"text/plain;charset=UTF-8","Content-Type":"application/json"},body:JSON.stringify(t)},h.label=1;case 1:return h.trys.push([1,13,,14]),[4,d.upload(p)];case 2:switch(g=h.sent(),v=void 0,f=void 0,S=void 0,g.status){case s:case o:return[3,3];case a:return[3,4]}return[3,11];case 3:return f="Received Alias Response from server: "+JSON.stringify(g.status),[3,12];case 4:if(!g.json)return[3,9];h.label=5;case 5:return h.trys.push([5,7,,8]),[4,g.json()];case 6:return v=h.sent(),[3,8];case 7:return h.sent(),r.verbose("The request has no response body"),[3,8];case 8:return[3,10];case 9:v=(m=g).responseText?JSON.parse(m.responseText):"",h.label=10;case 10:return(null==(y=v)?void 0:y.message)&&(S=y.message),f="Issue with sending Alias Request to mParticle Servers, received HTTP Code of "+g.status,(null==y?void 0:y.code)&&(f+=" - "+y.code),[3,12];case 11:throw new Error("Received HTTP Code of "+g.status);case 12:return r.verbose(f),i(n,g.status,S),[3,14];case 13:return b=h.sent(),S=ie(b),r.error("Error sending alias request to mParticle servers. "+S),i(n,pi.noHttpCoverage,S),[3,14];case 14:return[2]}}))}))},this.sendIdentityRequest=function(t,n,r,i,c,l,d){var v,f,m,y;return g(this,void 0,void 0,(function(){var g,b,S,I,_,w,P,C,A,T,k,E,D,O,M,L,F,U,N;return h(this,(function(h){switch(h.label){case 0:if((null===(v=e._RoktManager)||void 0===v?void 0:v.isInitialized)&&(e._Store.identifyRequestCount=(e._Store.identifyRequestCount||0)+1,F=e._Store.identifyRequestCount,e.captureTiming("".concat(F,"-identityRequestStart"))),g=e._Helpers.invokeCallback,b=e.Logger,S=e._ErrorReportingDispatcher,b.verbose(gi.InformationMessages.SendIdentityBegin),!t)return b.error(gi.ErrorMessages.APIRequestEmpty),[2];if(b.verbose(gi.InformationMessages.SendIdentityHttp),e._Store.identityCallInFlight)return g(r,pi.activeIdentityRequest,"There is currently an Identity request processing. Please wait for this to return before requesting again"),[2];I=l||null,_=this.getUploadUrl(n,l),w=window.fetch?new ln(_):new dn(_),P={method:"post",headers:{Accept:"text/plain;charset=UTF-8","Content-Type":"application/json","x-mp-key":e._Store.devToken},body:JSON.stringify(t)},e._Store.identityCallInFlight=!0,h.label=1;case 1:return h.trys.push([1,9,,10]),[4,w.upload(P)];case 2:switch(C=h.sent(),A=void 0,T=void 0,C.status){case s:case o:case a:return[3,3]}return[3,7];case 3:return C.json?[4,C.json()]:[3,5];case 4:return k=h.sent(),A=this.getIdentityResponseFromFetch(C,k),[3,6];case 5:A=this.getIdentityResponseFromXHR(C),h.label=6;case 6:return A.status===a?(E=A.responseText,T="Issue with sending Identity Request to mParticle Servers, received HTTP Code of "+A.status,(null==E?void 0:E.Errors)&&(U=E.Errors.map((function(e){return e.message})).join(", "),T+=" - "+U)):b.isVerbose()&&(D=A.responseText,O=e._Store.SDKConfig.isDevelopmentMode,M=D,!O&&(null==D?void 0:D.matched_identities)&&(M=p(p({},D),{matched_identities:te(D.matched_identities)})),T="Received Identity Response from server: "+JSON.stringify(M)),[3,8];case 7:if(C.status>=u)throw new Error("Received HTTP Code of "+C.status);return e._Store.identityCallInFlight=!1,e._Store.identityCallFailed=!1,U="Received HTTP Code of "+C.status,b.error("Error sending identity request to servers - "+U),g(r,pi.noHttpCoverage,U),[2];case 8:return e._Store.identityCallInFlight=!1,e._Store.identityCallFailed=!1,T&&b.verbose(T),(null===(f=e._RoktManager)||void 0===f?void 0:f.isInitialized)&&(F=e._Store.identifyRequestCount,e.captureTiming("".concat(F,"-identityRequestEnd"))),c(A,I,r,i,n,d,!1),[3,10];case 9:return L=h.sent(),e._Store.identityCallInFlight=!1,e._Store.identityCallFailed=!0,(null===(m=e._RoktManager)||void 0===m?void 0:m.isInitialized)&&(F=e._Store.identifyRequestCount,e.captureTiming("".concat(F,"-identityRequestEnd"))),U=ie(L),N="Error sending identity request to servers - "+U,b.error(N),null==S||S.report({message:N,code:hn.IDENTITY_REQUEST,severity:vn.ERROR}),null===(y=e.processQueueOnIdentityFailure)||void 0===y||y.call(e),g(r,pi.noHttpCoverage,U),[3,10];case 10:return[2]}}))}))},this.getUploadUrl=function(t,n){var r=e._Helpers.createServiceUrl(e._Store.SDKConfig.identityUrl);return t===hi?r+n+"/"+t:r+t},this.getIdentityResponseFromFetch=function(e,t){return{status:e.status,responseText:t,cacheMaxAge:parseInt(e.headers.get(An))||0,expireTimestamp:0}},this.getIdentityResponseFromXHR=function(e){return{status:e.status,responseText:e.responseText?JSON.parse(e.responseText):{},cacheMaxAge:C(e.getResponseHeader(An)||""),expireTimestamp:0}}}var fi="passbackconversiontrackingid",mi=function(){function e(e){this.instanceName=e,this.kit=null,this.filters={},this.currentUser=null,this.messageQueue=new Map,this.sandbox=null,this.placementAttributesMapping=[],this.onReadyCallback=null,this.initialized=!1,this.isShoppableAdsLoaded=!1,this.stopRouteChangeWatch=null,this.pendingCheckoutIntents=[],this.autoButtonClicksForwarded=!1}return e.prototype.setOnReadyCallback=function(e){this.onReadyCallback=e},e.prototype.init=function(e,t,n,r,i,o,s,a,u,c,l){var d,g,h=e||{},v=h.userAttributeFilters,f=h.settings||{},m=f.placementAttributesMapping,y=f.hashedEmailUserIdentityType;this.mappedEmailShaIdentityType=null!==(d=null==y?void 0:y.toLowerCase())&&void 0!==d?d:null,this.identityService=n,this.store=r,this.logger=i,this.errorReporter=a,this.loggingService=u,this.captureTiming=s,this.integrationCapture=c,this.createFilteredUser=l,null===(g=this.captureTiming)||void 0===g||g.call(this,he),this.filters={userAttributeFilters:v,filterUserAttributes:Bn.filterUserAttributes,filteredUser:t};try{this.placementAttributesMapping=function(e){try{return e?JSON.parse(e.replace(/"/g,'"')):[]}catch(e){throw new Error("Settings string contains invalid JSON")}}(m)}catch(e){this.logger.error("Error parsing placement attributes mapping from config: "+e)}var b=(null==o?void 0:o.sandbox)||!1,S=ar(null==o?void 0:o.launcherOptions);this.launcherOptions=p({sandbox:b},S),(null==o?void 0:o.domain)&&(this.domain=o.domain),this.initialized=!0},Object.defineProperty(e.prototype,"isInitialized",{get:function(){return this.initialized},enumerable:!1,configurable:!0}),e.prototype.attachKit=function(e){var t,n,r,i;this.kit=e,this.watchRouteChanges(),this.flushCheckoutIntents(),(null===(t=e.settings)||void 0===t?void 0:t.accountId)&&this.store.setRoktAccountId(e.settings.accountId),e.integrationName&&(null===(n=this.store)||void 0===n||n.setIntegrationName(e.integrationName)),this.processMessageQueue();try{null===(r=this.onReadyCallback)||void 0===r||r.call(this)}catch(e){null===(i=this.logger)||void 0===i||i.error("RoktManager: Error in onReadyCallback: "+e)}},e.prototype.watchRouteChanges=function(){var e,t,n,r=this;if(!K(null===(e=this.kit)||void 0===e?void 0:e.onRouteChange))return null===(t=this.stopRouteChangeWatch)||void 0===t||t.call(this),void(this.stopRouteChangeWatch=null);this.isAutoLogPageViewEnabled()?(null===(n=this.stopRouteChangeWatch)||void 0===n||n.call(this),this.stopRouteChangeWatch=null):this.stopRouteChangeWatch||(this.stopRouteChangeWatch=yt("rokt:".concat(this.instanceName),(function(){return r.notifyRouteChange()}))),this.notifyRouteChange()},e.prototype.notifyRouteChange=function(){var e,t,n;try{null===(t=null===(e=this.kit)||void 0===e?void 0:e.onRouteChange)||void 0===t||t.call(e)}catch(e){null===(n=this.logger)||void 0===n||n.error("RoktManager: Error in onRouteChange: ".concat(ie(e)))}},e.prototype.setAutoButtonClicksForwarded=function(e){this.autoButtonClicksForwarded=e},e.prototype.hasTargetingOptOut=function(){var e=this.launcherOptions||{};if(e.noTargeting||e.doNotShareOrSell)return!0;var t="undefined"==typeof navigator?void 0:navigator;return!!t&&!0===t.globalPrivacyControl},e.prototype.isCheckoutIntentSuppressed=function(){var e,t,n,i=null===(t=null===(e=this.store)||void 0===e?void 0:e.SDKConfig)||void 0===t?void 0:t.flags;return!(i&&!0===i[r.FeatureFlags.AutoButtonTracking]&&this.store.isEnabled&&this.autoButtonClicksForwarded)||(!!(null===(n=this.launcherOptions)||void 0===n?void 0:n.noFunctional)||this.hasTargetingOptOut())},e.prototype.isCheckoutIntentLive=function(){return!this.isCheckoutIntentSuppressed()&&("undefined"!=typeof Event&&K(Event.prototype.composedPath))},e.prototype.notifyCheckoutIntent=function(e,t){var n;if(void 0===t&&(t=window.location.pathname),!this.isCheckoutIntentSuppressed()){var r=this.kit;if(r)try{K(r.onCheckoutIntent)&&r.onCheckoutIntent(e)}catch(e){null===(n=this.logger)||void 0===n||n.error("RoktManager: Error in onCheckoutIntent: ".concat(ie(e)))}else this.pendingCheckoutIntents=this.pendingCheckoutIntents.filter((function(t){return t.signal.kind!==e.kind})).concat({signal:e,pathname:t}).slice(-5)}},e.prototype.discardCheckoutIntents=function(){this.pendingCheckoutIntents=[]},e.prototype.notifyPaymentPick=function(e){var t;if(!this.isCheckoutIntentSuppressed()){var n=this.kit;try{n&&K(n.onPaymentPick)&&n.onPaymentPick(e)}catch(e){null===(t=this.logger)||void 0===t||t.error("RoktManager: Error in onPaymentPick: ".concat(ie(e)))}}},e.prototype.flushCheckoutIntents=function(){var e=this,t=this.pendingCheckoutIntents;this.pendingCheckoutIntents=[];var n=Date.now(),r=window.location.pathname;t.filter((function(e){var t=e.signal,i=e.pathname;return n-t.t<3e4&&i===r})).sort((function(e,t){return e.signal.t-t.signal.t})).forEach((function(t){var n=t.signal;return e.notifyCheckoutIntent(n)}))},e.prototype.isAutoLogPageViewEnabled=function(){var e,t,n;return!0===(null===(n=null===(t=null===(e=this.store)||void 0===e?void 0:e.SDKConfig)||void 0===t?void 0:t.flags)||void 0===n?void 0:n[r.FeatureFlags.AutoLogPageView])},e.prototype.selectPlacements=function(e){var t,n,r,i,o,s,a,u,c,l,d,v,f,m,y,b,S;return g(this,void 0,void 0,(function(){var g,I,_,w,P,C,A,T,k,E,D,O,M,L,F,U,N,R,V,x,H,K,B,q,j=this;return h(this,(function(h){if(null===(t=this.captureTiming)||void 0===t||t.call(this,ge),!this.isReady()||(null===(n=this.store)||void 0===n?void 0:n.identityCallInFlight))return[2,this.deferredCall("selectPlacements",e)];try{if(g=e.attributes,I=(null==g?void 0:g.sandbox)||null,_=this.mapPlacementAttributes(g,this.placementAttributesMapping),(null===(r=this.logger)||void 0===r?void 0:r.isVerbose())&&(w=ne(g,null===(o=null===(i=this.store)||void 0===i?void 0:i.SDKConfig)||void 0===o?void 0:o.isDevelopmentMode),this.logger.verbose("mParticle.Rokt selectPlacements called with attributes:\n".concat(JSON.stringify(w,null,2)))),this.currentUser=this.identityService.getCurrentUser(),P=(null===(a=null===(s=this.currentUser)||void 0===s?void 0:s.getUserIdentities())||void 0===a?void 0:a.userIdentities)||{},C=P.email,A=_.email,T=void 0,k=void 0,(E=this.mappedEmailShaIdentityType&&!1!==ue.getIdentityType(this.mappedEmailShaIdentityType))&&(T=P[this.mappedEmailShaIdentityType],k=_.emailsha256||_[this.mappedEmailShaIdentityType]||void 0),D=this.hasIdentityChanged(C,A),O=this.hasIdentityChanged(T,k),M={},D&&(M.email=A,A&&(L="Email mismatch detected. Current email differs from email passed to selectPlacements call. Proceeding to call identify with email from selectPlacements call. Please verify your implementation.",this.logger.warning(L),null===(u=this.errorReporter)||void 0===u||u.report({message:L,code:hn.IDENTITY_MISMATCH,severity:vn.WARNING}))),O&&(M[this.mappedEmailShaIdentityType]=k,L="emailsha256 mismatch detected. Current mParticle hashedEmail differs from hashedEmail passed to selectPlacements call. Proceeding to call identify with hashedEmail from selectPlacements call. Please verify your implementation.",this.logger.warning(L),null===(c=this.errorReporter)||void 0===c||c.report({message:L,code:hn.IDENTITY_MISMATCH,severity:vn.WARNING})),F=this.toUserAttributes(_),z(M))this.setUserAttributes(this.currentUser,F);else try{this.identityService.identify({userIdentities:p(p({},P),M)},(function(e){var t,n=Number(null==e?void 0:e.httpCode);n&&(n>=400||n<0)&&j.logger.error("Background identify failed with HTTP "+n),j.setUserAttributes(null===(t=null==e?void 0:e.getUser)||void 0===t?void 0:t.call(e),F,M),j.processMessageQueue()}))}catch(e){this.logger.error("Background identify threw an error: "+ie(e)),this.setUserAttributes(this.identityService.getCurrentUser(),F,M)}return U=this.currentUser&&this.createFilteredUser?this.createFilteredUser(this.currentUser.getMPID()):null,N=(null===(l=null==U?void 0:U.getUserIdentities())||void 0===l?void 0:l.userIdentities)||{},R=null===(v=null===(d=this.store)||void 0===d?void 0:d.getTimeOnSite)||void 0===v?void 0:v.call(d),V=null===(m=null===(f=this.store)||void 0===f?void 0:f.getTotalTimeOnSite)||void 0===m?void 0:m.call(f),(x=p(p(p(p({},_),null!==I?{sandbox:I}:{}),R?{active_time_on_site_ms:R}:{}),V?{total_time_on_site_ms:V}:{})).email||(N.email?x.email=N.email:P.email&&this.logFilteredIdentity("email")),!E||x.emailsha256||x[this.mappedEmailShaIdentityType]||((H=N[this.mappedEmailShaIdentityType])?x.emailsha256=H:P[this.mappedEmailShaIdentityType]&&this.logFilteredIdentity(this.mappedEmailShaIdentityType)),x[fi]||(null===(y=this.integrationCapture)||void 0===y||y.capture(),K=null===(b=this.integrationCapture)||void 0===b?void 0:b.getClickIdsAsIntegrationAttributes(),(B=null===(S=null==K?void 0:K[Xn.Rokt])||void 0===S?void 0:S[fi])&&(x[fi]=B)),this.filters.filteredUser=U||this.filters.filteredUser||null,q=p(p({},e),{attributes:x}),[2,this.kit.selectPlacements(q)]}catch(e){return[2,Promise.reject(e instanceof Error?e:new Error("Unknown error occurred"))]}return[2]}))}))},e.prototype.logFilteredIdentity=function(e){var t;null===(t=this.logger)||void 0===t||t.verbose("mParticle.Rokt selectPlacements did not add the ".concat(e," user identity to the attributes because the Rokt connection does not allow it"))},e.prototype.hashAttributes=function(e){return g(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,u,l,d,p,v=this;return h(this,(function(f){switch(f.label){case 0:return f.trys.push([0,2,,3]),e&&"object"===c(e)?0===(t=Object.keys(e)).length?[2,{}]:(n=t.map((function(t){return g(v,void 0,void 0,(function(){var n,r;return h(this,(function(i){switch(i.label){case 0:return n=e[t],[4,this.hashSha256(n)];case 1:return r=i.sent(),[2,{key:t,attributeValue:n,hashedValue:r}]}}))}))})),[4,Promise.all(n)]):[2,{}];case 1:for(r=f.sent(),i={},o=0,s=r;o<s.length;o++)a=s[o],u=a.key,l=a.attributeValue,d=a.hashedValue,i[u]=l,d&&(i["".concat(u,"sha256")]=d);return[2,i];case 2:return p=f.sent(),this.logger.error("Failed to hashAttributes, returning an empty object: ".concat(ie(p))),[2,{}];case 3:return[2]}}))}))},e.prototype.setExtensionData=function(e){if(this.isReady())try{this.kit.setExtensionData(e)}catch(e){throw new Error("Error setting extension data: "+ie(e))}else this.deferredCall("setExtensionData",e)},e.prototype.use=function(e){if(!this.isReady())return this.deferredCall("use",e);try{return this.kit.use(e)}catch(t){return Promise.reject(t instanceof Error?t:new Error("Error using extension: "+e))}},e.prototype.terminate=function(){var e,t,n;return g(this,void 0,void 0,(function(){var r;return h(this,(function(i){switch(i.label){case 0:if(!this.isReady())return null===(e=this.logger)||void 0===e||e.verbose("mParticle.Rokt.terminate called before the Rokt kit was ready. Nothing to terminate."),[2];if(!K(this.kit.terminate))return null===(t=this.logger)||void 0===t||t.error("mParticle.Rokt.terminate is not supported by the attached Rokt Kit version."),[2];i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this.kit.terminate()];case 2:return i.sent(),[3,4];case 3:return r=i.sent(),null===(n=this.logger)||void 0===n||n.error("Failed to terminate the Rokt launcher: ".concat(ie(r))),[3,4];case 4:return[2]}}))}))},e.prototype.onShoppableAdsReady=function(e){if(this.kit&&this.isShoppableAdsLoaded)try{this.kit.onShoppableAdsReady(e)}catch(e){this.logger.error("Failed to register onShoppableAdsReady callback: ".concat(ie(e)))}else this.deferredCall("onShoppableAdsReady",e)},e.prototype.flushOnShoppableAdsReadyMessageQueue=function(e){var t=this;this.kit=e,this.messageQueue.forEach((function(n,r){var i;if("onShoppableAdsReady"===n.methodName){try{e.onShoppableAdsReady(n.payload)}catch(e){null===(i=t.logger)||void 0===i||i.error("RoktManager: Error flushing onShoppableAdsReady: "+e)}t.messageQueue.delete(r)}})),this.isShoppableAdsLoaded=!0},e.prototype.hashSha256=function(e){return g(this,void 0,void 0,(function(){var t,n;return h(this,(function(r){switch(r.label){case 0:if(null==e)return this.logger.warning("hashSha256 received null/undefined as input"),[2,e];r.label=1;case 1:return r.trys.push([1,3,,4]),t=String(e).trim().toLocaleLowerCase(),[4,this.sha256Hex(t)];case 2:return[2,r.sent()];case 3:return n=r.sent(),this.logger.error("Failed to hashSha256, returning undefined: ".concat(ie(n))),[2,void 0];case 4:return[2]}}))}))},e.prototype.getLocalSessionAttributes=function(){return this.store.getLocalSessionAttributes()},e.prototype.setLocalSessionAttribute=function(e,t){this.store.setLocalSessionAttribute(e,t)},e.prototype.isReady=function(){return Boolean(this.kit&&this.kit.launcher)},e.prototype.toUserAttributes=function(e){var t=["sandbox"],n={};for(var r in e)if(e.hasOwnProperty(r)&&-1===t.indexOf(r)){var i=e[r];n[r]=Array.isArray(i)?JSON.stringify(i):i}return n},e.prototype.setUserAttributes=function(e,t,n){if(void 0===n&&(n={}),e)try{if(this.hasContradictingIdentity(e,n))return void this.logger.warning("selectPlacements attributes were not set because identify did not resolve to a user with the passed email or hashed email.");e.setUserAttributes(t)}catch(e){this.logger.error("Error setting user attributes: "+e)}else this.logger.warning("selectPlacements attributes were not set because there is no user to set them on.")},e.prototype.hasContradictingIdentity=function(e,t){return Object.keys(t).some((function(n){var r,i,o=null===(i=null===(r=e.getUserIdentities())||void 0===r?void 0:r.userIdentities)||void 0===i?void 0:i[n];return Boolean(o)&&o!==t[n]}))},e.prototype.mapPlacementAttributes=function(e,t){for(var n={},r=0,i=t;r<i.length;r++){var o=i[r];n[o.map]=o.value}var s={};for(var a in e){if(e.hasOwnProperty(a))s[n[a]||a]=e[a]}return s},e.prototype.onIdentityComplete=function(){this.isReady()&&(this.currentUser=this.identityService.getCurrentUser(),this.processMessageQueue())},e.prototype.processMessageQueue=function(){var e,t=this;if(this.isReady()&&0!==this.messageQueue.size){null===(e=this.logger)||void 0===e||e.verbose("RoktManager: Processing ".concat(this.messageQueue.size," queued messages"));var n=Array.from(this.messageQueue.values());this.messageQueue.clear(),n.forEach((function(e){var n,r,i,o;if(e.methodName in t&&K(t[e.methodName])){if(null===(r=t.logger)||void 0===r?void 0:r.isVerbose()){var s=ne(e.payload,null===(o=null===(i=t.store)||void 0===i?void 0:i.SDKConfig)||void 0===o?void 0:o.isDevelopmentMode);t.logger.verbose("RoktManager: Processing queued message: ".concat(e.methodName," with payload: ").concat(JSON.stringify(s)))}var a=e.resolve,u=e.reject,c=function(n){var r;null===(r=t.logger)||void 0===r||r.error("RoktManager: Error processing message '".concat(e.methodName,"': ").concat(ie(n))),u&&u(n)};try{var l=t[e.methodName](e.payload);Promise.resolve(l).then((function(e){a&&a(e)})).catch(c)}catch(e){c(e)}}else null===(n=t.logger)||void 0===n||n.error("RoktManager: Method ".concat(e.methodName," not found"))}))}},e.prototype.queueMessage=function(e){this.messageQueue.set(e.messageId,e)},e.prototype.deferredCall=function(e,t){var n=this;return new Promise((function(r,i){var o="".concat(e,"_").concat(w());n.queueMessage({messageId:o,methodName:e,payload:t,resolve:r,reject:i})}))},e.prototype.sha256Hex=function(e){return g(this,void 0,void 0,(function(){var t,n,r;return h(this,(function(i){switch(i.label){case 0:return t=new TextEncoder,n=t.encode(e),[4,crypto.subtle.digest("SHA-256",n)];case 1:return r=i.sent(),[2,this.arrayBufferToHex(r)]}}))}))},e.prototype.arrayBufferToHex=function(e){for(var t=new Uint8Array(e),n="",r=0;r<t.length;r++){n+=t[r].toString(16).padStart(2,"0")}return n},e.prototype.hasIdentityChanged=function(e,t){return!!t&&(!e||e!==t)},e}(),yi=function(){function e(e){this.flags=e,this.flags={noFunctional:!0===e.noFunctional,noTargeting:!0===e.noTargeting,doNotShareOrSell:!0===e.doNotShareOrSell}}return e.prototype.getNoTargeting=function(){return this.flags.noTargeting},e.prototype.getNoFunctional=function(){return this.flags.noFunctional},e.prototype.getDoNotShareOrSell=function(){return this.flags.doNotShareOrSell},e.prototype.syncNoTargetingAttribute=function(e){e&&(this.flags.noTargeting?e.setUserAttribute(i,!0):W(e.getAllUserAttributes(),i)&&e.removeUserAttribute(i))},e}(),bi=function(){function e(){this.services=[]}return e.prototype.register=function(e){this.services.push(e)},e.prototype.report=function(e){var t=this;this.services.forEach((function(n){var r;try{n.report(e)}catch(e){null===(r=t.logger)||void 0===r||r.error("Error in ErrorReportingService: "+e)}}))},e}(),Si=function(){function e(){this.services=[]}return e.prototype.register=function(e){this.services.push(e)},e.prototype.log=function(e){var t=this;this.services.forEach((function(n){var r;try{n.log(e)}catch(e){null===(r=t.logger)||void 0===r||r.error("Error in LoggingService: "+e)}}))},e}(),Ii="is_auto_button_click",_i="Auto Button Click",wi="is_auto_link_click",Pi="Auto Link Click",Ci=function(e,t){for(var n={label_source:e.labelSource,element:e.element,type:e.type,path:t,hostname:window.location.hostname},r={label:e.label,aria_label:e.ariaLabel,icon:e.icon,element_id:e.elementId,element_name:e.elementName,test_id:e.testId,controls:e.controls,form:e.form,link_type:e.linkType,link_domain:e.linkDomain,file_extension:e.fileExtension},i=0,o=Object.keys(r);i<o.length;i++){var s=o[i];r[s]&&(n[s]=r[s])}return void 0!==e.checked&&(n.checked=e.checked),n},Ai=["label_source","element","type","path","label","aria_label","icon","element_id","element_name","test_id","controls","form","link_type","link_domain","file_extension","checked"],Ti=function(e,t,n){void 0===n&&(n=!1);var r=e.filteringEventAttributeValue;if(r&&r.eventAttributeValue&&Ai.some((function(e){return Bn.hashAttributeConditionalForwarding(e)===r.eventAttributeName})))return"forwarding rule";var i={hostname:window.location.hostname};i[n?wi:Ii]=!0;var o={EventName:n?Pi:_i,EventCategory:se.Other,EventDataType:oe.PageEvent,EventAttributes:i},s=[["data plan",{}],["forwarding rule",{filteringEventAttributeValue:r}],["event name filter",{eventNameFilters:e.eventNameFilters}],["event type filter",{eventTypeFilters:e.eventTypeFilters}]].find((function(e){var n=e[1];return!Er(o,n,t)}));return s?s[0]:void 0},ki='button, input[type="submit"], input[type="button"], input[type="image"], [role="button"]',Ei='[contenteditable]:not([contenteditable="false"])';function Di(e){var t=K(e.getRootNode)?e.getRootNode():null;return e.assignedSlot||e.parentElement||t&&t.host||null}function Oi(e,t,n){for(var r=e;r&&r!==n;){if(t(r))return!0;r=Di(r)}return!1}function Mi(e,t){return Oi(e,(function(e){return e.matches(t)}))}var Li="[data-core-type], #rokt-controller-frame";function Fi(e){var t=e.getAttribute("src");if(!t)return!1;try{return-1!==new URL(t,"https://example.test").pathname.indexOf("/wsdk/")}catch(e){return!1}}var Ui=["apple-pay-button",".apple-pay-button",".gpay-button",".gpay-card-info-container","#gpay-button-online-api-id","paypal-button","venmo-button","paypal-pay-later-button","paypal-credit-button","shop-pay-button","shop-pay-wallet-button","shopify-accelerated-checkout","shopify-accelerated-checkout-cart","shopify-apple-pay-button","shopify-google-pay-button","shopify-paypal-button","shopify-amazon-pay-button",".amazonpay-button-focusable","#AmazonPayButton","[data-amazon-pay-button]","[data-afterpay-entry-point]"].join(", "),Ni="paypal-basic-card-button",Ri=Ui+", "+Ni,Vi=["set-up","add-money","reload","top-up"].map((function(e){return'apple-pay-button[type="'+e+'"]'})).join(", ");function xi(e){var t=e.matches(Ri)?e:null;if(!t){var n=K(e.getRootNode)?e.getRootNode():null;t=n&&n.host&&n.host.matches(Ri)?n.host:null}if(t)return t.matches(Vi)?"none":t.matches(Ni)?"checkout_step":"wallet"}var Hi=/(?:^| )(?:apple ?pay|google ?pay|g ?pay|amazon ?pay|cash ?app|venmo|pay ?pal|shop ?pay|klarna|after ?pay|clear ?pay|sezzle|samsung ?pay)(?= |$)/,Ki=/(?:^| )affirm(?= |$)/,Bi=/(?:^| )(?:pay|payment|checkout)(?= |$)/,qi=/(?:^| )(?:btn|button)(?= |$)/,ji=/(?:^| )(?:logo|icon|image|img|label|text|caption|message|messaging|info|tooltip|help|learn|terms|promo|banner|container|wrapper|wrap|placeholder|form|section|panel|modal|list|group|select|option|tab|toggle|radio|choice|method)(?= |$)/;function zi(e){return(e||"").slice(0,64).replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[^A-Za-z0-9]+/g," ").trim().toLowerCase()}function Qi(e){return[e.getAttribute("id"),e.getAttribute("data-testid")].map(zi).some((function(e){return(Hi.test(e)||Ki.test(e)&&Bi.test(e))&&qi.test(e)&&!ji.test(e)}))}var Wi='input[type="radio"], input[type="checkbox"], label, [role="radio"], [role="tab"], [role="option"], [role="checkbox"], [role="switch"], [role="menuitemradio"], [role="menuitemcheckbox"], [aria-checked], [aria-selected]',Ji='[role="radiogroup"], [role="tablist"], [role="listbox"]',Gi="klarna-placement, afterpay-placement, square-placement, .affirm-as-low-as, .affirm-site-modal, .affirm-product-modal, [data-pp-message]";function $i(e,t,n){return void 0===n&&(n=!1),!!e.matches(Wi)||(!!Mi(e,Ji)||(!(t||!(!n&&e.hasAttribute("aria-expanded")||e.hasAttribute("aria-pressed")))||Mi(e,Gi)))}var Yi=Wi+", "+Ji+', input:not([type="hidden"]):not([type="submit"]):not([type="button"]):not([type="image"]), select, textarea, option, optgroup, datalist, [aria-expanded], [aria-pressed], '+Ei,Xi=Wi+", "+ki+", a[href], "+Ri+", [aria-expanded], [aria-pressed], "+Ei;function Zi(e){if(!Qi(e)||e.matches(Yi))return!1;for(var t=Di(e);t;t=Di(t))if(t.matches(Xi)||Qi(t))return!1;var n=e.shadowRoot;return!(e.querySelector(Yi)||n&&n.querySelector(Yi))}function eo(e){for(var t,n=e.slice(0,12),r=0,i=n;r<i.length;r++){if((a=i[r])instanceof Element){t=a;break}}if(!t||Mi(t,Li+", [data-mp-no-track]"))return!0;for(var o=0,s=n;o<s.length;o++){var a;if((a=s[o])instanceof Element&&Fi(a))return!0}return!1}function to(e,t){if(void 0===t&&(t=!1),t||!eo(e)){for(var n,r,i=!1,o=0,s=e.slice(0,12);o<s.length;o++){var a=s[o];if(n)break;a instanceof Element&&(a.matches(ki+", a[href], "+Ri)||!i&&Zi(a)?n=a:(!r&&a.matches('input[type="checkbox"], input[type="radio"]')&&(r=a),i=i||a.matches(Yi)))}if(!(!(n=n||r)||n.matches(':disabled, [aria-disabled="true"]')||n.classList.contains("disabled")&&Qi(n)))return n}}function no(e,t){var n="input, select, textarea, [data-mp-no-track], "+Ei;return e.matches("input, select, textarea, option, optgroup, datalist, "+Ei)||(t?Array.from(e.querySelectorAll(n)).some((function(e){return e!==t})):!!e.querySelector(n))||Mi(e,"select, datalist, textarea, [data-mp-no-track], "+Ei)}var ro=function(){try{return{run:new RegExp("\\p{Nd}{6,}","u"),number:new RegExp("\\p{Nd}+(?:[.,\u060c\u066b\u066c]\\p{Nd}+)*","gu")}}catch(e){return}}(),io=128;function oo(e){if(e&&!(e.length>io)&&ro){var t=e.replace(/\s+/g," ").trim().toLowerCase();if(t&&-1===t.indexOf("@")&&!ro.run.test(t.replace(/[\s()\-\u2010-\u2015]/g,"")))return t.replace(ro.number,"#").slice(0,64).trim()||void 0}}var so=/\.(pdf|zip|csv|txt|ics|docx?|xlsx?|pptx?|dmg|exe|apk|mp3|mp4)$/i;function ao(e){if("wallet"===xi(t=e)||Zi(t))return"wallet";var t,n=e.tagName.toLowerCase();return"button"===n||"input"===n?n:e.matches('a[href]:not([role="button"])')?"link":"role"}var uo='script, style, template, [hidden], [aria-hidden="true"], [inert]',co=64;function lo(e){var t=e;return K(t.assignedNodes)?t.assignedNodes():[]}function po(e){return!!(e.matches(uo)||(t=e,n=t.parentElement,n&&(n.shadowRoot?!t.assignedSlot:lo(n).length>0)))||!(e instanceof SVGTitleElement)&&"none"===window.getComputedStyle(e).display;var t,n}function go(e){var t=window.getComputedStyle(e).visibility;return"hidden"!==t&&"collapse"!==t}function ho(e,t){return!Oi(e,po,t)}function vo(e,t){var n=e.assignedSlot;return!!n&&ho(n,t)}function fo(e){return!(/\S/.test(e.textContent||"")||e instanceof Element&&(e.matches("slot")||e.querySelector("slot")))}function mo(e){var t="",n=0,r=function(e){t=(t+e).replace(/\s+/g," ")},i=function(e){if(po(e))return!0;for(var o=lo(e),s=o.length?o:e.childNodes,a=0;a<s.length;a++){var u=s[a],c=u.nodeType===Node.TEXT_NODE;if(c||u instanceof Element)if(fo(u))r(u.textContent);else{if(++n>co)return!1;if(!e.shadowRoot||vo(u,e)){if(c)go(u.assignedSlot||e)&&r(u.nodeValue);else if(o.length&&no(u)||!i(u))return!1;if(t.trim().length>io)return!1}}}return!0};return i(e)?t.trim():void 0}function yo(e){for(var t=e.querySelectorAll("img[alt]"),n=0;n<t.length&&n<co;n++)if(ho(t[n],e)&&go(t[n]))return bo(t[n].getAttribute("alt"))}function bo(e){return e&&e.trim()?e:void 0}function So(e){var t=e.getAttribute("aria-labelledby");if(t){var n=K(e.getRootNode)?e.getRootNode():document,r=t.split(/\s+/).map((function(e){return(t=n.getElementById?n.getElementById(e):null)&&!no(t)&&ho(t)?mo(t):"";var t}));if(-1!==r.indexOf(void 0))return{source:"none"};if(u=r.filter((function(e){return!!e})).join(" "))return{raw:u,source:"labelledby"}}var i=bo(e.getAttribute("aria-label"));if(i)return{raw:i,source:"aria"};var o=e.children.length<=4&&!no(e);if(e instanceof HTMLInputElement){var s=e.type;if("image"===s){if(c=bo(e.getAttribute("alt")))return{raw:c,source:"alt"}}else if("submit"===s||"button"===s||"reset"===s){var a=bo(e.value);if(a)return{raw:a,source:"value"};if("button"!==s)return{raw:s,source:"value"}}}else if(o&&ho(e)){var u,c;if(void 0===(u=mo(e)))return{source:"none"};if(u)return{raw:u,source:"text"};if(c=yo(e))return{raw:c,source:"alt"}}var l=bo(e.getAttribute("title"));return l?{raw:l,source:"title"}:{source:"none"}}var Io=/^(?:fa|fas|far|fal|icon|bi|glyphicon|ti|mdi|ri|la|lucide|ion|feather|ph)-([a-z][a-z-]{1,31})$/,_o=/^(?:solid|regular|light|thin|duotone|brands|sharp|fw|lg|xs|sm|xl|spin|pulse|border|inverse|stack|flip(?:-[a-z]+)?|rotate(?:-[a-z]+)?|pull-[a-z]+)$/;function wo(e){var t=function(e){return!Mi(e,"[data-mp-no-track]")},n=Array.from(e.querySelectorAll("use")).filter(t)[0];if(n){var r=n.getAttribute("href")||n.getAttribute("xlink:href")||"",i=r.indexOf("#"),o=function(e){if(e){var t=e.toLowerCase().replace(/^icon-/,"");return/^[a-z][a-z-]{1,31}$/.test(t)?t:void 0}}(-1===i?null:r.slice(i+1));if(o)return o}for(var s=0,a=[e].concat(Array.from(e.querySelectorAll("i, span, svg"))).filter(t).slice(0,5);s<a.length;s++)for(var u=0,c=(a[s].getAttribute("class")||"").split(/\s+/);u<c.length;u++){var l=c[u],d=Io.exec(l.toLowerCase());if(d&&!_o.test(d[1]))return d[1]}}var Po=/^[A-Za-z]+[0-9]{0,3}(?:[-_](?:[A-Za-z]+[0-9]{0,3}|[0-9]{1,3}))*$/;function Co(e){if(e){var t=e.trim(),n=t.replace(/[^0-9]/g,"").length;return t.length<=64&&n<=3&&Po.test(t)?t:void 0}}var Ao=["data-testid","data-test-id","data-test","data-qa","data-cy"];function To(e,t){for(var n=0,r=t;n<r.length;n++){var i=r[n],o=Co(e.getAttribute(i));if(o)return o}}function ko(e){var t=e.getAttribute("aria-controls");return Co(t?t.trim().split(/\s+/)[0]:null)||To(e,["popovertarget","commandfor"])}function Eo(e){var t=e instanceof HTMLButtonElement||e instanceof HTMLInputElement?e.form:null;return t?Co(t.getAttribute("id")):void 0}function Do(e){var t=e.tagName.toLowerCase();return"button"===t||"input"===t?e.type:"button"}function Oo(e){var t=(e.getAttribute("href")||"").trim();if(!t||"#"===t.charAt(0))return{type:"same_page"};if(e instanceof HTMLAnchorElement){var n=e.protocol.toLowerCase();if("javascript:"===n)return{type:"same_page"};if("http:"===n||"https:"===n){var r=e.hostname!==window.location.hostname?e.hostname.toLowerCase():void 0,i=so.exec(e.pathname);return e.hasAttribute("download")||i?{type:"download",domain:r,fileExtension:i?i[1].toLowerCase():void 0}:r?{type:"outbound",domain:r}:e.pathname===window.location.pathname&&e.search===window.location.search?{type:"same_page"}:{type:"internal"}}}}var Mo='input[type="checkbox"], input[type="radio"], [role~="checkbox"], [role~="radio"], [role~="switch"], [role~="menuitemcheckbox"], [role~="menuitemradio"]',Lo='[role~="radio"], [role~="menuitemradio"]';function Fo(e){var t=e instanceof HTMLLabelElement?e.control:e;return t&&t.matches(Mo)?t:null}function Uo(e){return e instanceof HTMLInputElement?"radio"===e.type:!!e&&e.matches(Lo)}function No(e,t){for(var n=0,r=t;n<r.length;n++){var i=r[n];if(i===e)break;var o=i instanceof Element?Fo(i):null;if(o)return o}return Fo(e)||e.querySelector(Mo)}var Ro=/(?:^| )(?:pay|payment\w*|tenders?|gateways?)(?: |$)/,Vo='[role="radiogroup"], fieldset';function xo(e,t){void 0===t&&(t=[]);var n=No(e,t);if(Uo(n)&&!Mi(n,"[data-mp-no-track]")&&(i=(r=n).getAttribute("name"),((o=i?null:r.closest(Vo))?[o.getAttribute("id"),o.getAttribute("name"),o.getAttribute("aria-label")]:[i]).some((function(e){return Ro.test(zi(e))})))){var r,i,o,s=function(e){var t=[oo(So(e).raw)];return(e instanceof HTMLInputElement&&e.labels?Array.from(e.labels).slice(0,2):[]).forEach((function(n){ho(n)&&!no(n,e)&&(t.push(oo(mo(n))),t.push(oo(yo(n))))})),t.push(Co(e.getAttribute("id")),To(e,Ao)),t.filter((function(e,n){return!!e&&t.indexOf(e)===n}))}(n);return s.length?{radio:n,names:s}:void 0}}var Ho=/(?:^|\/)(?:checkouts?|payment|order|kasse|paiement|commander?|pago)(?:\/|$)/i,Ko=new RegExp("\\b(?:coupon|promo(?: code)?|newsletter|sign in|sign up|log in|login|add to (?:cart|bag|basket)|gift card balance|(?:add|apply|redeem|check|enter|use) (?:a |an |your )?gift card|pay later|interest free|as low as|learn more|prequalify|apply (?:now|for)|payment plan|available|accepted|we accept|set up|add money|reload|top up|add to (?:apple|google) wallet|connect|link your|unlink|remove|delete|edit|change|manage|use a different|switch)\\b|^pay in$|\\bpay in (?:installments|instalments)\\b"),Bo=new RegExp(["gutschein|anmelden|warenkorb|bon cadeau|connexion|panier|cup\xf3n|iniciar sesi\xf3n|carrito","carrello|codice sconto|accedi|buono regalo|winkelwagen|kortingscode|inloggen|cadeaubon|achteraf betalen","\u30ab\u30fc\u30c8|\u30af\u30fc\u30dd\u30f3|\u30ed\u30b0\u30a4\u30f3|\u4f1a\u54e1\u767b\u9332|\u30ae\u30d5\u30c8|\u5f8c\u6255\u3044|\u30e1\u30eb\u30de\u30ac"].join("|")),qo=["(?:jetzt )?(?:zahlungs|kosten)pflichtig (?:bestellen|buchen)|(?:jetzt )?bezahlen|kauf abschlie\xdfen|bestellung abschlie\xdfen","commander et payer|payer(?: maintenant)?|(?:confirmer|finaliser) (?:ma |la )?commande","valider et payer|confirmer et payer|commande avec obligation de paiement|finaliser l'achat","(?:realizar|confirmar|completar) (?:el |mi |la )?(?:pedido|compra|reserva)|finalizar (?:el |mi )?pedido|pagar(?: ahora)?","pedido con obligaci\xf3n de pago","(?:effettua|conferma|concludi|completa) (?:l'|il )?(?:ordine|acquisto)|ordine con obbligo di pagamento","paga(?: ora| adesso)?|ordina e paga","(?:nu )?betalen|bestellen en betalen|bestelling plaatsen|plaats bestelling|bestelling afronden","bestelling met betalingsverplichting","(?:\u3053\u306e\u5185\u5bb9\u3067|\u4e0a\u8a18\u306e?\u5185\u5bb9\u3067)?\u3054?(?:\u6ce8\u6587|\u8cfc\u5165|\u4e88\u7d04|\u6c7a\u6e08|\u304a?\u652f\u6255\u3044?)\u3092?(?:\u78ba\u5b9a|\u5b8c\u4e86)(?:\u3059\u308b)?","(?:\u3053\u306e\u5185\u5bb9\u3067|\u4e0a\u8a18\u306e?\u5185\u5bb9\u3067)\u3054?(?:\u6ce8\u6587|\u8cfc\u5165|\u4e88\u7d04)\u3059\u308b|\u3054?\u6ce8\u6587\u3059\u308b|\u6c7a\u6e08\u3059\u308b|(?:\u4eca\u3059\u3050|\u3092)?\u652f\u6255\u3046"].join("|"),jo=new RegExp("^(?:(?:(?:agree|accept|review) and )?(?:place|submit|complete|confirm|finali[sz]e)(?!(?: [^ ]+){0,2} (?:another|new|next)(?: |$))(?! (?:[^ ]+ )?gift card)(?: [^ ]+){0,2} (?:order|purchase|booking|reservation|payment|checkout|transaction)(?: now| securely| and pay| (?:with|using) [^ ]+(?: [^ ]+)?)?(?: (?:total|subtotal|items?|tickets?))?|pay(?: securely)?(?: now)?|(?:confirm|agree|accept|submit|order|book) and pay|pay and place (?:my |your )?order|order with obligation to pay|"+qo+")$"),zo=new RegExp("^(?:(?:place|submit|complete)(?!(?: [^ ]+){0,2} (?:another|new|next)(?: |$))(?: [^ ]+){0,2} (?:order|purchase)|"+qo+")$"),Qo=new RegExp("^(?:buy now|purchase|jetzt kaufen|kaufen|commander|(?:passer|valider) (?:la |ma )?commande|finalizar (?:la |mi )?compra|comprar ahora|acquista ora|nu kopen|\u4eca\u3059\u3050\u8cfc\u5165|\u8cfc\u5165\u3059\u308b|\u3053\u306e\u5185\u5bb9\u3067\u7533\u3057\u8fbc\u3080)$"),Wo=new RegExp("^(?:"+["(?:let's |lets |go to |proceed to |secure )?(?:check ?out|checkout)(?: now| securely| as guest)?","(?:continue|proceed) to (?:payment|review|billing|shipping|delivery|order review)|review (?:my |your )?order","guest checkout|(?:pay|continue|check ?out) (?:with|by) (?:card|credit card|debit card|credit or debit card)","zur kasse|zur kasse gehen|auschecken|weiter zur zahlung","passer \xe0 la caisse|continuer vers le paiement|proc\xe9der au paiement","ir a caja|continuar al pago|tramitar pedido","procedi al checkout|procedi all'acquisto|procedi al pagamento|vai alla cassa","afrekenen|verder naar betalen|doorgaan naar betalen","\u30ec\u30b8\u306b\u9032\u3080|\u3054?(?:\u8cfc\u5165|\u6ce8\u6587)\u624b\u7d9a\u304d(?:\u3078|\u306b)(?:\u9032\u3080)?|\u304a?\u652f\u6255\u3044(?:\u3078|\u306b)\u9032\u3080|(?:\u3054\u6ce8\u6587\u5185\u5bb9\u306e)?\u78ba\u8a8d\u753b\u9762\u3078(?:\u9032\u3080)?"].join("|")+")$"),Jo="(?:(?:my|your|the) )?(?:shopping )?(?:cart|bag|basket)",Go=new RegExp("^add(?: [^ ]+){0,5} to "+Jo+"$"),$o=new RegExp("^(?:(?:(?:view|open|go to) )?"+Jo+"(?: items?)?|items? in "+Jo+")$"),Yo="apple pay|google pay|paypal|venmo|amazon pay|shop pay|klarna|afterpay|clearpay|cash app(?: pay)?|affirm|sezzle|samsung pay",Xo=new RegExp("^(?:(?:pay|buy|purchase|order|book|donate|subscribe|check ?out|checkout|express checkout|continue|proceed|complete purchase|place (?:my |your )?order)(?: now| securely)? (?:with|using|via|through|by) (?:"+Yo+")(?: express(?: checkout)?| checkout)?|(?:continue|proceed|go) (?:to|with) (?:"+Yo+"))$"),Zo=new RegExp("^(?:"+Yo+")(?: (?:checkout|check out|express(?: checkout)?|express pay|buy now|pay now|pay|now)| (?:logo|icon|mark|button)(?: (?:logo|icon|mark|button))*)?$"),es={"pay.google.com":"google_pay","applepay.cdn-apple.com":"apple_pay","payments.amazon.com":"amazon_pay","pay.shopify.com":"shop_pay"},ts=new Set(["www.paypal.com","www.sandbox.paypal.com"]),ns=/^\/smart\/(?:buttons|menu)(?:\/|$)/,rs=/^\/smart\/card-fields?(?:\/|$)/,is=/^__zoid__paypal_/,os=/^__zoid__paypal_(?:buttons|menu)__/,ss=/\/elements-inner-(?:payment-request|express-checkout)-/,as=/\/elements-inner-card\b/,us=["adyen.com","braintreegateway.com","cybersource.com","squarecdn.com","checkout.com"],cs=/[\u2019\u2018]/g,ls=/[0-9\uFF10-\uFF19$\u20AC\u00A3\u00A5\uFFE5\u20B9\u5186.,\uFF0C]/g,ds=/\([^()]*\)|\[[^[\]]*\]|\uFF08[^\uFF08\uFF09]*\uFF09|\uFF3B[^\uFF3B\uFF3D]*\uFF3D|\u3010[^\u3010\u3011]*\u3011/g,ps="[\\s!-/:-@\\[-`{-~\\u00A1-\\u00BF\\u00D7\\u00F7\\u2000-\\u206F\\u20A0-\\u20CF\\u2190-\\u2BFF\\u3000-\\u3003\\u3008-\\u3011\\u3014-\\u301F\\u30FB\\uD800-\\uDFFF\\uFE00-\\uFE0F\\uFF01-\\uFF0F\\uFF1A-\\uFF20\\uFF3B-\\uFF40\\uFF5B-\\uFF65]+",gs=new RegExp("^"+ps+"|"+ps+"$","g");var hs=/[-_|\xb7\u2022]/g,vs=/(?:^| )(?:usd|aud|cad|nzd|gbp|eur|chf|sgd|hkd|jpy|inr|mxn)(?= |$)|\b(?:a|au|ca|c|us|nz|hk|s)\$/g,fs=[[/\bapplepay\b/g,"apple pay"],[/\bg ?pay\b/g,"google pay"],[/\bamazonpay\b/g,"amazon pay"],[/\bshoppay\b/g,"shop pay"],[/\bcashapp\b/g,"cash app"]],ms=8;function ys(e){if(e&&!(e.length>128)){var t=e.toLowerCase().replace(cs,"'").replace(/[&+]/g," and ").replace(hs," ").replace(vs," ").replace(ls,"").replace(/\s+/g," ").trim();return fs.forEach((function(e){var n=e[0],r=e[1];t=t.replace(n,r)})),t.split(" ").length>ms?void 0:t}}function bs(e){return e.replace(ds," ").replace(/\s+/g," ").replace(gs,"")||e.replace(gs,"")}function Ss(e){return function(e){if(e instanceof HTMLInputElement){var t=e.type,n=null;return"submit"===t||"button"===t?n=e.value:"image"===t&&(n=e.getAttribute("alt")),[e.getAttribute("aria-label"),n]}return e.children.length>4||no(e)?[e.getAttribute("aria-label")]:[e.getAttribute("aria-label"),e.textContent]}(e).map(ys).filter((function(e){return!!e}))}function Is(e,t,n){return t?zo.test(e):jo.test(e)||Qo.test(e)&&"checkout_path"===function(e){return Ho.test(e)?"checkout_path":"other"}(n)}function _s(e,t){var n=xi(e);if("none"!==n){if(n)return $i(e,"wallet"===n)?void 0:{kind:n,source:"vendor"};var r=Ss(e),i=r.map(bs),o=function(e,t){var n=t.length?void 0:ys(e.getAttribute("title")),r=n?[bs(n)]:t;return!!r.some((function(e){return Go.test(e)}))||(e.hasAttribute("aria-expanded")||e.hasAttribute("aria-haspopup"))&&r.some((function(e){return $o.test(e)}))}(e,i)?{kind:"cart",source:"label"}:void 0;if(!$i(e,!1,!!o)){if(o&&e.hasAttribute("aria-expanded"))return o;var s=e.matches('a[href]:not([role="button"])');if(i.some((function(e){return Is(e,s,t)})))return{kind:"commit",source:"label"};if(r.concat(i).some((function(e){return Ko.test(e)||Bo.test(e)})))return o;if(Zi(e))return{kind:"wallet",source:"name"};for(var a=!s&&e.matches(ki),u=0,c=i;u<c.length;u++){var l=c[u];if(a&&Xo.test(l))return{kind:"wallet",source:"label"};if(a&&Zo.test(l))return{kind:"wallet",source:"brand"};if(Wo.test(l))return{kind:"checkout_step",source:"label"}}return o}}}function ws(e,t){if("visible"===t.document.visibilityState&&e instanceof HTMLIFrameElement&&!(Mi(n=e,Li)||Fi(n)||Mi(e,"[data-mp-no-track]"))){var n;if((!e.src||"about:blank"===e.src)&&is.test(e.name))return os.test(e.name)?{kind:"wallet"}:{kind:"frame"};try{var r=new URL(e.src),i="https:"===r.protocol?r.hostname:"";if(ts.has(i))return ns.test(r.pathname)?{kind:"wallet"}:rs.test(r.pathname)?{kind:"frame",family:"card"}:{kind:"frame"};if(Object.prototype.hasOwnProperty.call(es,i))return{kind:"wallet",family:es[i]};if("js.stripe.com"===i)return ss.test(r.pathname)?{kind:"wallet"}:as.test(r.pathname)?{kind:"frame",family:"card"}:{kind:"frame"};if(us.some((function(e){return function(e,t){return e===t||e.length>t.length&&e.slice(e.length-t.length-1)==="."+t}(i,e)})))return{kind:"frame"}}catch(e){}}}var Ps="__mpBtn__",Cs=function(){return"undefined"==typeof window?null:window},As=function(){var e=Cs(),t=e?e[Ps]:void 0;return t?t.tracker:void 0},Ts=function(){var e=Cs();if(e){var t=As();t&&t.teardown(),e[Ps]={}}},ks="__mpApplePayHook__",Es=function(e){var t=e.ApplePaySession;return t&&t.prototype},Ds={capture:!0,passive:!0},Os={passive:!0},Ms=function(){function e(e){var t=this;this.active=!1,this.hasRoktKit=!1,this.logButtons=!1,this.logLinks=!1,this.generation=0,this.lastCommitClick=-1/0,this.lastClick=null,this.lastSent={},this.pagePath=null,this.pageEvents=0,this.pending=[],this.uploadTimerId=null,this.uploadHeld=!1,this.leaving=!1,this.drain=function(){var e=t.pending;t.pending=[],e.forEach((function(e){return e()}))},this.onHide=function(e){if("beforeunload"===e.type||"pagehide"===e.type||"hidden"===document.visibilityState){t.leaving=!0;try{t.drain()}finally{t.leaving=!1}t.cancelUpload()}},this.onPageShow=function(e){e.persisted&&t.reset()},this.onEvent=function(e){try{t.observe(e)}catch(e){t.log("[error] event handler threw: "+e)}},this.mpInstance=e}return Object.defineProperty(e.prototype,"isActive",{get:function(){return this.active},enumerable:!1,configurable:!0}),e.prototype.init=function(e){var t=Cs();if(t){var n=As();n&&n.teardown(),this.active&&this.teardown(),this.hasRoktKit=e.hasRoktKit,this.logButtons=e.logButtons,this.logLinks=e.logLinks,(this.logButtons||this.logLinks)&&this.eventsEnabled()||!this.isKitSuppressed()?(t.document.addEventListener("click",this.onEvent,Ds),t.document.addEventListener("submit",this.onEvent,Ds),t.addEventListener("blur",this.onEvent,Os),t.addEventListener("pageshow",this.onPageShow,Os),t.addEventListener("beforeunload",this.onHide,Ds),t.addEventListener("pagehide",this.onHide,Ds),t.document.addEventListener("visibilitychange",this.onHide,Ds),this.active=!0,t[Ps]||(t[Ps]={}),t[Ps].tracker=this,this.isKitSuppressed()||function(e){try{var t=Es(e),n=t&&t.begin;if(!K(n)||n[ks])return;var r=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=n.apply(this,e);try{var i=As();i&&i.onApplePayBegin()}catch(e){}return r};Object.defineProperty(r,ks,{value:n}),t.begin=r}catch(e){}}(t),this.log("listening")):this.log("opted out, not starting")}},e.prototype.onApplePayBegin=function(){var e=this,t=Date.now(),n=this.lastClick;if(!(!this.active||!n||n.excluded||"commit"===n.kind||t-n.t>1e3||this.isKitSuppressed())){var r=window.location.pathname,i=this.generation;setTimeout((function(){if(i===e.generation)try{e.emit("wallet","wallet"===n.kind?n.source:"api","apple_pay",t,r)}catch(t){e.log("[error] Apple Pay delivery threw: "+t)}}),0)}},e.prototype.teardown=function(){var e=Cs();if(e){e.document.removeEventListener("click",this.onEvent,!0),e.document.removeEventListener("submit",this.onEvent,!0),e.removeEventListener("blur",this.onEvent),e.removeEventListener("pageshow",this.onPageShow),e.removeEventListener("beforeunload",this.onHide,!0),e.removeEventListener("pagehide",this.onHide,!0),e.document.removeEventListener("visibilitychange",this.onHide,!0);var t=e[Ps];t&&t.tracker===this&&(t.tracker=void 0,function(e){try{var t=Es(e),n=t&&t.begin;K(n)&&K(n[ks])&&(t.begin=n[ks])}catch(e){}}(e))}this.active=!1,this.clearPending()},e.prototype.clearPending=function(){this.reset();var e=this.mpInstance._RoktManager;e&&e.discardCheckoutIntents()},e.prototype.reset=function(){this.generation++,this.pending=[],this.lastCommitClick=-1/0,this.lastClick=null,this.lastSent={},this.pagePath=null,this.pageEvents=0,this.cancelUpload()},e.prototype.enqueue=function(e){var t;this.pending.push(e),1===this.pending.length&&(t=this.drain,K(window.requestAnimationFrame)&&"hidden"!==document.visibilityState?requestAnimationFrame((function(){setTimeout(t,0)})):setTimeout(t,0))},e.prototype.observe=function(e){var t=this;if(this.active&&e.isTrusted){var n=e.type,r="click"===n&&(this.logButtons||this.logLinks)&&this.eventsEnabled()&&!this.hasTargetingOptOut(),i=!this.isKitSuppressed();if(r||i){var o,s,a,u,c,l,d=Date.now(),p=window.location.pathname,g=!1,h=!1;if("click"===n){var v=K(e.composedPath)?e.composedPath().slice(0,12):[],f=eo(v);if(S=f?void 0:to(v,!0)){if(o=r&&(this.logButtons||S.matches("a[href]"))?function(e,t){var n;if(void 0===t&&(t=[]),e.matches('a[href]:not([role="button"])')){if(!(n=Oo(e)))return}else e.matches("a[href]")&&(n=Oo(e))&&"same_page"===n.type&&(n=void 0);var r=ao(e),i=e instanceof HTMLInputElement&&("checkbox"===e.type||"radio"===e.type)?e:void 0,o=i||No(e,t),s=Uo(o),a=s?o instanceof HTMLInputElement?o:null:e,u=o?void 0:So(e),c=u?oo(u.raw):void 0;return{label:c,labelSource:c?u.source:"none",ariaLabel:o?void 0:oo(e.getAttribute("aria-label")),icon:o?void 0:wo(e),elementId:s?void 0:Co(e.getAttribute("id")),elementName:Co(a&&a.getAttribute("name")),testId:s?void 0:To(e,Ao),controls:s?void 0:ko(e),form:Eo(e),element:r,type:Do(e),linkType:n?n.type:void 0,linkDomain:n?n.domain:void 0,fileExtension:n?n.fileExtension:void 0,checked:i?i.checked:void 0}}(S,v):void 0,o){g=this.logLinks&&function(e){return!!e.linkType&&"same_page"!==e.linkType}(o);var m=this.logButtons&&!g&&!("internal"===o.linkType&&S.matches('a[href]:not([role="button"])'));g||m||(o=void 0)}o&&void 0!==o.checked&&(s=S);var y=i?_s(S,p):void 0;a=y?y.kind:void 0,u=y?y.source:void 0,c=i?xo(S,v):void 0}this.lastClick={t:d,excluded:f,kind:a,source:u}}else if("submit"===n){var b=e.submitter,S=b?to([b]):void 0;if(b){if(S){y=_s(S,p);a=y?y.kind:void 0,u=y?y.source:void 0}}else a="commit",u="submit";h=!b}var I=this.generation;this.enqueue((function(){var i;if(I===t.generation)try{if("blur"===n){var v=ws(document.activeElement,window);a=v?v.kind:void 0,l=v?v.family:void 0,u="frame"}else h&&d-t.lastCommitClick>1e3&&(a=void 0);o&&r&&(s&&e.defaultPrevented&&(o.checked="checkbox"===s.type?!o.checked:s.checked),t.logClick(o,p,g)),c&&((i=c.radio)instanceof HTMLInputElement?i.checked:"true"===i.getAttribute("aria-checked"))?t.pickPayment(d,p,c.names):l&&t.pickPayment(d,p,void 0,l),a&&t.emit(a,u,n,d,p)}catch(e){t.log("[error] delivery threw: "+e)}}))}}},e.prototype.logClick=function(e,t,n){if(this.eventsEnabled()&&!this.hasTargetingOptOut()&&(t!==this.pagePath&&(this.pagePath=t,this.pageEvents=0),!(this.pageEvents>=100))){this.pageEvents++,this.mpInstance._SessionManager.resetSessionTimer();var r=this.queuedForUpload();this.mpInstance._Events.logEvent(n?function(e,t){var n=Ci("internal"===e.linkType&&"link"===e.element?p(p({},e),{label:void 0,labelSource:"none",ariaLabel:void 0}):e,t);return n[wi]=!0,{messageType:oe.PageEvent,name:Pi,data:n,eventType:se.Other}}(e,t):function(e,t){var n=Ci(e,t);return n[Ii]=!0,{messageType:oe.PageEvent,name:_i,data:n,eventType:se.Other}}(e,t)),!this.leaving&&void 0===e.checked&&this.queuedForUpload()>r&&this.uploadNow()}},e.prototype.queuedForUpload=function(){var e=this.mpInstance._APIClient.uploader;return e?e.eventsQueuedForProcessing.length:0},e.prototype.uploadNow=function(){var e=this;null===this.uploadTimerId?this.mpInstance.upload():(clearTimeout(this.uploadTimerId),this.uploadHeld=!0),this.uploadTimerId=setTimeout((function(){e.uploadTimerId=null,e.uploadHeld&&(e.uploadHeld=!1,e.mpInstance.upload())}),100)},e.prototype.cancelUpload=function(){null!==this.uploadTimerId&&(clearTimeout(this.uploadTimerId),this.uploadTimerId=null),this.uploadHeld=!1},e.prototype.emit=function(e,t,n,r,i){if(!this.isKitSuppressed()){"commit"===e&&"click"===n&&(this.lastCommitClick=r);var o=this.lastSent[e];o&&o.pathname===i&&r-o.t<2e3||(this.lastSent[e]={t:r,pathname:i},this.mpInstance._RoktManager.notifyCheckoutIntent(Object.freeze({kind:e,t:r,source:t,pathname:i}),i))}},e.prototype.pickPayment=function(e,t,n,r){this.isKitSuppressed()||this.mpInstance._RoktManager.notifyPaymentPick(Object.freeze({t:e,pathname:t,names:n?Object.freeze(n.slice()):void 0,family:r}))},e.prototype.eventsEnabled=function(){var e=this.mpInstance._Store;return!!e&&e.isEnabled},e.prototype.hasTargetingOptOut=function(){var e=this.mpInstance._RoktManager;return this.hasRoktKit&&!!e&&e.hasTargetingOptOut()},e.prototype.isKitSuppressed=function(){var e=this.mpInstance._RoktManager;return!this.hasRoktKit||!e||e.isCheckoutIntentSuppressed()},e.prototype.log=function(e){this.mpInstance.Logger.verbose("mParticle button tracking: "+e)},e}(),Ls=r.Messages,Fs=r.HTTPCodes,Us=r.FeatureFlags,Ns=r.CaptureIntegrationSpecificIdsV2Modes,Rs=Us.ReportBatching,Vs=Us.CaptureIntegrationSpecificIds,xs=Us.CaptureIntegrationSpecificIdsV2,Hs=Ls.InformationMessages.StartingInitialization;function Ks(e){var t=this;this._instanceName=e,this._NativeSdkHelpers=new $n(this),this._SessionManager=new rr(this),this._Persistence=new Sr(this),this._Helpers=new zn(this),this._Events=new _r(this),this._CookieSyncManager=new Zn(this),this._ServerModel=new Kr(this),this._Ecommerce=new or(this),this._ForwardingStatsUploader=new Br(this),this._Consent=new ii(this),this._IdentityAPIClient=new vi(this),this._preInit={readyQueue:[],integrationDelays:{},forwarderConstructors:[]},this._ErrorReportingDispatcher=new bi,this._LoggingDispatcher=new Si,this._RoktManager=new mi(e),this._RoktManager.setOnReadyCallback((function(){t.processQueueOnIdentityFailure()})),this.processQueueOnIdentityFailure=function(){var e,n,r;(null===(e=t._Store)||void 0===e?void 0:e.isInitialized)||(null===(n=t._Store)||void 0===n?void 0:n.identityCallFailed)&&(null===(r=t._RoktManager)||void 0===r?void 0:r.isReady())&&(t._RoktManager.processMessageQueue(),t._preInit.readyQueue=jr(t._preInit.readyQueue,t.Logger))},this.processQueueOnNoFunctional=function(){var e,n;(null===(e=t._Store)||void 0===e?void 0:e.isInitialized)||(null===(n=t._CookieConsentManager)||void 0===n?void 0:n.getNoFunctional())&&!xn(t._Store)&&(t._preInit.readyQueue=jr(t._preInit.readyQueue,t.Logger))},this.IdentityType=ue,this.EventType=se,this.CommerceEventType=ae,this.PromotionType=de,this.ProductActionType=ce,this.RoktEvents=le,this._Identity=new ni(this),this.Identity=this._Identity.IdentityAPI,this.generateHash=this._Helpers.generateHash,this.getDeviceId=this._Persistence.getDeviceId,"undefined"!=typeof window&&window.mParticle&&window.mParticle.config&&window.mParticle.config.hasOwnProperty("rq")&&(this._preInit.readyQueue=window.mParticle.config.rq),this.init=function(e,t){var n=this;(t||console.warn("You did not pass a config object to init(). mParticle will not initialize properly"),function(e,t,n){e.Logger=new pr(n),e._ErrorReportingDispatcher.logger=e.Logger,e._LoggingDispatcher.logger=e.Logger,e._Store=new ur(n,e,t),window.mParticle.Store=e._Store,Ts(),e.Logger.verbose(Hs);var r=ar(null==n?void 0:n.launcherOptions),i=r.noFunctional,o=r.noTargeting,s=r.doNotShareOrSell;e._CookieConsentManager=new yi({noFunctional:i,noTargeting:o,doNotShareOrSell:s});try{e._Store.isLocalStorageAvailable=e._Persistence.determineLocalStorageAvailability(window.localStorage)}catch(t){e.Logger.warning("localStorage is not available, using cookies if available"),e._Store.isLocalStorageAvailable=!1}}(this,e,t),t)?!t.hasOwnProperty("requestConfig")||t.requestConfig?new di(e,t,this).getSDKConfiguration().then((function(r){var i=re({},t,r);Bs(e,i,n)})):Bs(e,t,this):console.error("No config available on the window, please pass a config object to mParticle.init()")},this.setLogLevel=function(e){t.Logger.setLogLevel(e)},this.reset=function(e){try{e._Persistence.resetPersistence(),Ts(),e._ButtonTracker=void 0,e._Store&&delete e._Store}catch(e){console.error("Cannot reset mParticle",e)}},this._resetForTests=function(e,t,n){n._Store&&delete n._Store,n._ErrorReportingDispatcher=new bi,n._LoggingDispatcher=new Si,n.Logger=new pr(e),n._ErrorReportingDispatcher.logger=n.Logger,n._LoggingDispatcher.logger=n.Logger,n._Store=new ur(e,n),n._Store.isLocalStorageAvailable=n._Persistence.determineLocalStorageAvailability(window.localStorage),n._Events.stopTracking(),Ht(),n._PageViewTracker=void 0,Ts(),n._ButtonTracker=void 0,t||n._Persistence.resetPersistence(),n._Persistence.forwardingStatsBatches.uploadsTable={},n._Persistence.forwardingStatsBatches.forwardingStatsEventQueue=[],n._preInit={readyQueue:[],pixelConfigurations:[],integrationDelays:{},forwarderConstructors:[],isDevelopmentMode:!1}},this.ready=function(e){var n,r,i,o=(null===(n=t._CookieConsentManager)||void 0===n?void 0:n.getNoFunctional())&&!xn(t._Store);K(e)&&((null===(r=t._Store)||void 0===r?void 0:r.isInitialized)||(null===(i=t._Store)||void 0===i?void 0:i.identityCallFailed)&&t._RoktManager.isReady()||o)?e():t._preInit.readyQueue.push(e)},this.getEnvironment=function(){return t._Store.SDKConfig.isDevelopmentMode?r.Environment.Development:r.Environment.Production},this.getVersion=function(){return r.sdkVersion},this.setAppVersion=function(e){qs((function(){t.setAppVersion(e)}),t)||(t._Store.SDKConfig.appVersion=e,t._Persistence.update())},this.setDeviceId=function(e){qs((function(){t.setDeviceId(e)}),t)||this._Store.setDeviceId(e)},this.isInitialized=function(){return!!t._Store&&t._Store.isInitialized},this.getAppName=function(){return t._Store.SDKConfig.appName},this.setAppName=function(e){qs((function(){t.setAppName(e)}),t)||(t._Store.SDKConfig.appName=e)},this.getAppVersion=function(){return t._Store.SDKConfig.appVersion},this.stopTrackingLocation=function(){t._SessionManager.resetSessionTimer(),t._Events.stopTracking()},this.startTrackingLocation=function(e){K(e)||t.Logger.warning("Warning: Location tracking is triggered, but not including a callback into the `startTrackingLocation` may result in events logged too quickly and not being associated with a location."),t._SessionManager.resetSessionTimer(),t._Events.startTracking(e)},this.setPosition=function(e,n){qs((function(){t.setPosition(e,n)}),t)||(t._SessionManager.resetSessionTimer(),"number"==typeof e&&"number"==typeof n?t._Store.currentPosition={lat:e,lng:n}:t.Logger.error("Position latitude and/or longitude must both be of type number"))},this.startNewSession=function(){t._SessionManager.startNewSession()},this.endSession=function(){t._SessionManager.endSession(!0)},this.logBaseEvent=function(e,n){qs((function(){t.logBaseEvent(e,n)}),t)||(t._SessionManager.resetSessionTimer(),"string"==typeof e.name?(e.eventType||(e.eventType=se.Unknown),t._Helpers.canLog()?t._Events.logEvent(e,n):t.Logger.error(Ls.ErrorMessages.LoggingDisabled)):t.Logger.error(Ls.ErrorMessages.EventNameInvalidType))},this.logEvent=function(e,n,r,i,o){qs((function(){t.logEvent(e,n,r,i,o)}),t)||(t._SessionManager.resetSessionTimer(),"string"==typeof e?(n||(n=se.Unknown),t._Helpers.isEventType(n)?t._Helpers.canLog()?t._Events.logEvent({messageType:oe.PageEvent,name:e,data:r,eventType:n,customFlags:i},o):t.Logger.error(Ls.ErrorMessages.LoggingDisabled):t.Logger.error("Invalid event type: "+n+", must be one of: \n"+JSON.stringify(se))):t.Logger.error(Ls.ErrorMessages.EventNameInvalidType))},this.logError=function(e,n){if(!qs((function(){t.logError(e,n)}),t)&&(t._SessionManager.resetSessionTimer(),e)){"string"==typeof e&&(e={message:e});var r={m:e.message?e.message:e,s:"Error",t:e.stack||null};if(n){var i=t._Helpers.sanitizeAttributes(n,r.m);for(var o in i)r[o]=i[o]}t._Events.logEvent({messageType:oe.CrashReport,name:e.name?e.name:"Error",eventType:se.Other,data:r})}},this.logLink=function(e,n,r,i){t._Events.addEventHandler("click",e,n,i,r)},this.logForm=function(e,n,r,i){t._Events.addEventHandler("submit",e,n,i,r)},this.logPageView=function(e,n,r,i){if(!qs((function(){t.logPageView(e,n,r,i)}),t)){if(t._SessionManager.resetSessionTimer(),t._Helpers.canLog()){if(t._Helpers.Validators.isStringOrNumber(e)||(e="PageView"),n){if(!t._Helpers.isObject(n))return void t.Logger.error("The attributes argument must be an object. A "+c(n)+" was entered. Please correct and retry.")}else n={hostname:window.location.hostname,title:window.document.title};if(r&&!t._Helpers.isObject(r))return void t.Logger.error("The customFlags argument must be an object. A "+c(r)+" was entered. Please correct and retry.")}t._Events.logEvent({messageType:oe.PageView,name:e,data:n,eventType:se.Unknown,customFlags:r},i)}},this.upload=function(){var e,n;t._Helpers.canLog()&&(t._Store.webviewBridgeEnabled?t._NativeSdkHelpers.sendToNative(r.NativeSdkPaths.Upload):null===(n=null===(e=t._APIClient)||void 0===e?void 0:e.uploader)||void 0===n||n.prepareAndUpload(!1,!1))},this.Consent={createCCPAConsent:t._Consent.createPrivacyConsent,createGDPRConsent:t._Consent.createPrivacyConsent,createConsentState:t._Consent.createConsentState},this.eCommerce={setCurrencyCode:function(e){qs((function(){t.eCommerce.setCurrencyCode(e)}),t)||("string"==typeof e?(t._SessionManager.resetSessionTimer(),t._Store.currencyCode=e):t.Logger.error("Code must be a string"))},createProduct:function(e,n,r,i,o,s,a,u,c,l){return t._Ecommerce.createProduct(e,n,r,i,o,s,a,u,c,l)},createPromotion:function(e,n,r,i){return t._Ecommerce.createPromotion(e,n,r,i)},createImpression:function(e,n){return t._Ecommerce.createImpression(e,n)},createTransactionAttributes:function(e,n,r,i,o,s){return t._Ecommerce.createTransactionAttributes(e,n,r,i,o,s)},logProductAction:function(e,n,r,i,o,s){qs((function(){t.eCommerce.logProductAction(e,n,r,i,o,s)}),t)||(t._SessionManager.resetSessionTimer(),t._Events.logProductActionEvent(e,n,r,i,o,s))},logPurchase:function(e,n,r,i,o){tr({methodName:"mParticle.logPurchase",warningMessage:"mParticle.logPurchase is deprecated, please use mParticle.logProductAction with ProductActionType.Purchase instead"},t.Logger,t._ErrorReportingDispatcher),t._Store.isInitialized?e&&n?(t._SessionManager.resetSessionTimer(),t._Events.logPurchaseEvent(e,n,i,o)):t.Logger.error(Ls.ErrorMessages.BadLogPurchase):t.ready((function(){t.eCommerce.logPurchase(e,n,r,i,o)}))},logPromotion:function(e,n,r,i,o){qs((function(){t.eCommerce.logPromotion(e,n,r,i,o)}),t)||(t._SessionManager.resetSessionTimer(),t._Events.logPromotionEvent(e,n,r,i,o))},logImpression:function(e,n,r,i){qs((function(){t.eCommerce.logImpression(e,n,r,i)}),t)||(t._SessionManager.resetSessionTimer(),t._Events.logImpressionEvent(e,n,r,i))},expandCommerceEvent:function(e){return t._Ecommerce.expandCommerceEvent(e)}},this.setSessionAttribute=function(e,n){var i;if(!((null===(i=t._CookieConsentManager)||void 0===i?void 0:i.getNoFunctional())&&!xn(t._Store))&&qs((function(){t.setSessionAttribute(e,n)}),t))return;if(t._Helpers.canLog()){if(!t._Helpers.Validators.isValidAttributeValue(n))return void t.Logger.error(Ls.ErrorMessages.BadAttribute);if(!t._Helpers.Validators.isValidKeyValue(e))return void t.Logger.error(Ls.ErrorMessages.BadKey);if(t._Store.webviewBridgeEnabled)t._NativeSdkHelpers.sendToNative(r.NativeSdkPaths.SetSessionAttribute,JSON.stringify({key:e,value:n}));else{var o=t._Helpers.findKeyInObject(t._Store.sessionAttributes,e);o&&(e=o),t._Store.sessionAttributes[e]=n,t._Persistence.update(),t._Forwarders.applyToForwarders("setSessionAttribute",[e,n])}}},this.setOptOut=function(e){qs((function(){t.setOptOut(e)}),t)||(t._SessionManager.resetSessionTimer(),t._Store.isEnabled=!e,e&&(t._ButtonTracker&&t._ButtonTracker.clearPending(),t._RoktManager.discardCheckoutIntents()),t._Events.logOptOut(),t._Persistence.update(),t._Store.activeForwarders.length&&t._Store.activeForwarders.forEach((function(n){if(n.setOptOut){var r=n.setOptOut(e);r&&t.Logger.verbose(r)}})))},this.setIntegrationAttribute=function(e,n){if(!qs((function(){t.setIntegrationAttribute(e,n)}),t))if("number"==typeof e){if(null===n)t._Store.integrationAttributes[e]={};else{if(!t._Helpers.isObject(n))return void t.Logger.error("Attrs must be an object with keys and values. You entered a "+c(n));if(0===Object.keys(n).length)t._Store.integrationAttributes[e]={};else for(var r in n)"string"==typeof r?"string"==typeof n[r]?(t._Helpers.isObject(t._Store.integrationAttributes[e])||(t._Store.integrationAttributes[e]={}),t._Store.integrationAttributes[e][r]=n[r]):t.Logger.error("Values for integration attributes must be strings. You entered a "+c(n[r])):t.Logger.error("Keys must be strings, you entered a "+c(r))}t._Persistence.update()}else t.Logger.error("integrationId must be a number")},this.getIntegrationAttributes=function(e){return t._Store.integrationAttributes[e]?t._Store.integrationAttributes[e]:{}},this.addForwarder=function(e){t._preInit.forwarderConstructors.push(e)},this.configurePixel=function(e){t._Forwarders.configurePixel(e)},this._getActiveForwarders=function(){return t._Store.activeForwarders},this._getIntegrationDelays=function(){return t._preInit.integrationDelays},this._setIntegrationDelay=function(e,n){if(t._preInit.integrationDelays[e]=n,!0!==n){var r=Object.keys(t._preInit.integrationDelays);if(0!==r.length)r.some((function(e){return!0===t._preInit.integrationDelays[e]}))||t._APIClient.processQueuedEvents()}},this._setWrapperSDKInfo=function(e,n){qs((function(){t._setWrapperSDKInfo(e,n)}),t)||void 0!==t._Store.wrapperSDKInfo&&t._Store.wrapperSDKInfo.isInfoSet||(t._Store.wrapperSDKInfo={name:e,version:n,isInfoSet:!0})},this._registerErrorReportingService=function(e){t._ErrorReportingDispatcher.register(e)},this._registerLoggingService=function(e){t._LoggingDispatcher.register(e)};var n=r.Rokt.LauncherInstanceGuidKey;this.setLauncherInstanceGuid=function(){window[n]&&"string"==typeof window[n]||(window[n]=t._Helpers.generateUniqueId())},this.getLauncherInstanceGuid=function(){return window[n]},this.captureTiming=function(e){var t;"undefined"!=typeof window&&(null===(t=window.performance)||void 0===t?void 0:t.mark)&&window.performance.mark(e)}}function Bs(e,t,n){var i,o,s,a,u=function(e,t){var n,r,i,o;e.dataPlanOptions&&(t.Logger.verbose("Customer provided data plan found"),r={document:{dtpn:{vers:(o=e.dataPlanOptions).dataPlanVersion,blok:{ev:o.blockEvents,ea:o.blockEventAttributes,ua:o.blockUserAttributes,id:o.blockUserIdentities}}}});r||(e.dataPlan&&e.dataPlan.document?e.dataPlan.document.error_message?i=e.dataPlan.document.error_message:(t.Logger.verbose("Data plan found from mParticle.js"),r=e.dataPlan):e.dataPlanResult&&(e.dataPlanResult.error_message?i=e.dataPlanResult.error_message:(t.Logger.verbose("Data plan found from /config"),r={document:e.dataPlanResult})));i&&t.Logger.error(i);r&&(n=new ci(r,t));return n}(t,n),c=n._Helpers.getFeatureFlag,l=r.FeatureFlags,d=l.AutoLogPageView,p=l.AutoButtonTracking,g=l.AutoLinkTracking;if((null===(i=n._APIClient)||void 0===i?void 0:i.uploader)&&n._APIClient.uploader.destroy(),n._APIClient=new Kn(n,u),n._Forwarders=new Rr(n,u),n._Store.processConfig(t),n._Identity.idCache=function(e){var t;if(null===(t=e._CookieConsentManager)||void 0===t?void 0:t.getNoFunctional())return new un("".concat(e._Store.storageName,"-id-cache"));return new sn("".concat(e._Store.storageName,"-id-cache"))}(n),Mn(n._Identity.idCache),n._Store.webviewBridgeEnabled)n._NativeSdkHelpers.initializeSessionAttributes(e),Ts(),n._RoktManager.setAutoButtonClicksForwarded(!1);else{n._Persistence.initializeStorage(),n._Store.syncPersistenceData();var h=n.Identity.getCurrentUser(),v=h?h.getMPID():null,f=h?h.getUserIdentities().userIdentities:{};if(n._Store.SDKConfig.identifyRequest=n._Store.hasInvalidIdentifyRequest()?{userIdentities:f}:n._Store.SDKConfig.identifyRequest,c(Rs)&&n._ForwardingStatsUploader.startForwardingStatsTimer(),Qe(c)){var m=c(Vs),y=c(xs),b=void 0;m||y===Ns.All?b="all":y===Ns.RoktOnly&&(b="roktonly"),n._IntegrationCapture=new We(b),n._IntegrationCapture.capture()}var S=ee(t,"Rokt",181);if(S){var I=null===(o=S.settings)||void 0===o?void 0:o.accountId;n._Store.setRoktAccountId(I);var _=function(e){return Cr(e,S,n,u)},w={sandbox:null==t?void 0:t.isDevelopmentMode,launcherOptions:null==t?void 0:t.launcherOptions,domain:null==t?void 0:t.domain};n._RoktManager.init(S,_(v),n.Identity,n._Store,n.Logger,w,n.captureTiming,n._ErrorReportingDispatcher,n._LoggingDispatcher,n._IntegrationCapture,_)}var P=!!c(p),C=!!c(g),A=S?Ti(S,u):void 0,T=S&&C?Ti(S,u,!0):void 0;P&&(A||T)&&n.Logger.warning(A?"Checkout intent is off: the ".concat(A," keeps some or all Auto Button Click events from the Rokt kit."):"Checkout intent is off: the ".concat(T," keeps some or all Auto Link Click events from the Rokt kit.")),n._RoktManager.setAutoButtonClicksForwarded(!!S&&!A&&!T),n._Forwarders.processForwarders(t,n._APIClient.prepareForwardingStats),n._Forwarders.processPixelConfigs(t),n._SessionManager.initialize(),n._Events.logAST(),c(d)?(n._PageViewTracker||(n.Logger.verbose("mParticle APV: [sdk-init] creating new PageViewTracker for this instance"),n._PageViewTracker=new qt(n,{isAutoPageView:!0})),Vt()?n.Logger.verbose("mParticle APV: [sdk-init] initial page view already logged this page load, skipping"):(xt(),n._Events.logPageView({isAutoPageView:!0})),n._PageViewTracker.init()):n._PageViewTracker&&n._PageViewTracker.teardown(),P||C?(n._ButtonTracker||(n._ButtonTracker=new Ms(n)),n._ButtonTracker.init({hasRoktKit:!!S,logButtons:P,logLinks:C})):Ts(),function(e,t,n,r){!e._Store.identifyCalled&&e._Store.SDKConfig.identityCallback&&t&&n&&e._Store.SDKConfig.identityCallback({httpCode:Fs.activeSession,getUser:function(){return e._Identity.mParticleUser(n)},getPreviousUser:function(){var t=e.Identity.getUsers(),r=t.shift(),i=r.getMPID();return r&&i===n&&(r=t.shift()),r||null},body:{mpid:n,is_logged_in:e._Store.isLoggedIn,matched_identities:r,context:null,is_ephemeral:!1}})}(n,h,v,f)}(n._Store.mpid&&!n._Store.identifyCalled||n._Store.webviewBridgeEnabled)&&(n._Store.isInitialized=!0,null===(s=n._CookieConsentManager)||void 0===s||s.syncNoTargetingAttribute(n.Identity.getCurrentUser()),n._preInit.readyQueue=jr(n._preInit.readyQueue,n.Logger)),null===(a=n.processQueueOnNoFunctional)||void 0===a||a.call(n),n._Store.isFirstRun&&(n._Store.isFirstRun=!1)}function qs(e,t){var n,r,i=(null===(n=t._CookieConsentManager)||void 0===n?void 0:n.getNoFunctional())&&!xn(t._Store);return!(null===(r=t._Store)||void 0===r?void 0:r.isInitialized)&&!i&&(t._preInit.readyQueue.push((function(){var n;(null===(n=t._Store)||void 0===n?void 0:n.isInitialized)&&e()})),!0)}var js=function(){return null},zs=function(){function e(){}return e.prototype.getMPInstance=function(){return{_Helpers:{sanitizeAttributes:window.mParticle.getInstance()._Helpers.sanitizeAttributes,generateHash:function(){return"mockHash"},generateUniqueId:function(){return"mockId"},extend:re,createServiceUrl:js,parseNumber:js,isObject:js,Validators:null},_resetForTests:js,_APIClient:null,_timeOnSiteTimer:{getTimeInForeground:js},MPSideloadedKit:null,_Consent:null,_Events:null,_Forwarders:null,_NativeSdkHelpers:null,_Persistence:null,_preInit:null,Consent:null,_ServerModel:null,_SessionManager:null,_Store:{sessionId:"mockSessionId",sideloadedKits:[],devToken:"test_dev_token",isFirstRun:!0,isEnabled:!0,sessionAttributes:{},currentSessionMPIDs:[],consentState:null,clientId:null,deviceId:null,serverSettings:{},dateLastEventSent:null,sessionStartDate:null,currentPosition:null,isTracking:!1,watchPositionId:null,cartProducts:[],eventQueue:[],currencyCode:null,globalTimer:null,context:null,configurationLoaded:!1,identityCallInFlight:!1,nonCurrentUserMPIDs:{},identifyCalled:!1,isLoggedIn:!1,cookieSyncDates:{},integrationAttributes:{},requireDelay:!0,isLocalStorageAvailable:null,integrationDelayTimeoutStart:null,storageName:null,prodStorageName:null,activeForwarders:[],kits:{},configuredForwarders:[],pixelConfigurations:[],wrapperSDKInfo:{name:"none",version:null,isInfoSet:!1},SDKConfig:{isDevelopmentMode:!1,onCreateBatch:js},getTotalTimeOnSite:js},config:null,eCommerce:null,Identity:{getCurrentUser:js,IdentityAPI:{},identify:js,login:js,logout:js,modify:js},Logger:{verbose:js,error:js,warning:js},ProductActionType:null,ServerModel:null,addForwarder:js,generateHash:js,getAppVersion:js,getAppName:js,getInstance:js,getDeviceId:js,init:js,logBaseEvent:js,logEvent:js,logLevel:"none",setPosition:js,upload:js}},e.prototype.createSDKEventFunction=function(e){return new Kr(this.getMPInstance()).createEventObject(e)},e.prototype.returnBatch=function(e){var t=this,n=this.getMPInstance();return Je("0",Array.isArray(e)?e.map((function(e){return t.createSDKEventFunction(e)})):[this.createSDKEventFunction(e)],n)},e}(),Qs=function(){function e(e){this.filterDictionary={eventTypeFilters:[],eventNameFilters:[],screenNameFilters:[],screenAttributeFilters:[],userIdentityFilters:[],userAttributeFilters:[],attributeFilters:[],consentRegulationFilters:[],consentRegulationPurposeFilters:[],messageTypeFilters:[],messageTypeStateFilters:[],filteringEventAttributeValue:{},filteringUserAttributeValue:{},filteringConsentRuleValues:{}},this.kitInstance=e}return e.prototype.addEventTypeFilter=function(e){var t=Bn.hashEventType(e);this.filterDictionary.eventTypeFilters.push(t)},e.prototype.addEventNameFilter=function(e,t){var n=Bn.hashEventName(t,e);this.filterDictionary.eventNameFilters.push(n)},e.prototype.addEventAttributeFilter=function(e,t,n){var r=Bn.hashEventAttributeKey(e,t,n);this.filterDictionary.attributeFilters.push(r)},e.prototype.addScreenNameFilter=function(e){var t=Bn.hashEventName(e,se.Unknown);this.filterDictionary.screenNameFilters.push(t)},e.prototype.addScreenAttributeFilter=function(e,t){var n=Bn.hashEventAttributeKey(se.Unknown,e,t);this.filterDictionary.screenAttributeFilters.push(n)},e.prototype.addUserIdentityFilter=function(e){var t=Bn.hashUserIdentity(e);this.filterDictionary.userIdentityFilters.push(t)},e.prototype.addUserAttributeFilter=function(e){var t=Bn.hashUserAttribute(e);this.filterDictionary.userAttributeFilters.push(t)},e}();Array.prototype.forEach||(Array.prototype.forEach=n.forEach),Array.prototype.map||(Array.prototype.map=n.map),Array.prototype.filter||(Array.prototype.filter=n.filter),Array.isArray||(Array.prototype.isArray=n.isArray);var Ws=new function(){var e=this;this.Store={},this._instances={},this.IdentityType=ue,this.EventType=se,this.CommerceEventType=ae,this.PromotionType=de,this.ProductActionType=ce,this.RoktEvents=le,this.MPSideloadedKit=Qs,"undefined"!=typeof window&&(this.isIOS=!(!window.mParticle||!window.mParticle.isIOS)&&window.mParticle.isIOS,this.config=window.mParticle&&window.mParticle.config?window.mParticle.config:{}),this.init=function(t,n,i){!n&&window.mParticle&&window.mParticle.config&&(console.warn("You did not pass a config object to mParticle.init(). Attempting to use the window.mParticle.config if it exists. Please note that in a future release, this may not work and mParticle will not initialize properly"),n=window.mParticle?window.mParticle.config:{}),i=(i&&0!==i.length?i:r.DefaultInstance).toLowerCase();var o=e._instances[i];void 0===o&&(o=new Ks(i),e._instances[i]=o),o.captureTiming(pe),o.setLauncherInstanceGuid(),o.init(t,n,i)},this.captureTiming=function(t){e.getInstance().captureTiming(t)},this.getInstance=function(t){var n;return t?(n=e._instances[t.toLowerCase()])||(console.log("You tried to initialize an instance named "+t+". This instance does not exist. Check your instance name or initialize a new instance with this name before calling it."),null):(t=r.DefaultInstance,(n=e._instances[t])||(n=new Ks(t),e._instances[r.DefaultInstance]=n),n)},this.Rokt=e.getInstance()._RoktManager,this.getDeviceId=function(){return e.getInstance().getDeviceId()},this.setDeviceId=function(t){return e.getInstance().setDeviceId(t)},this.isInitialized=function(){return e.getInstance().isInitialized()},this.startNewSession=function(){e.getInstance().startNewSession()},this.endSession=function(){e.getInstance().endSession()},this.setLogLevel=function(t){e.getInstance().setLogLevel(t)},this.ready=function(t){e.getInstance().ready(t)},this.setAppVersion=function(t){e.getInstance().setAppVersion(t)},this.getAppName=function(){return e.getInstance().getAppName()},this.setAppName=function(t){e.getInstance().setAppName(t)},this.getAppVersion=function(){return e.getInstance().getAppVersion()},this.getEnvironment=function(){return e.getInstance().getEnvironment()},this.stopTrackingLocation=function(){e.getInstance().stopTrackingLocation()},this.startTrackingLocation=function(t){e.getInstance().startTrackingLocation(t)},this.setPosition=function(t,n){e.getInstance().setPosition(t,n)},this.logBaseEvent=function(t,n){e.getInstance().logBaseEvent(t,n)},this.logEvent=function(t,n,r,i,o){e.getInstance().logEvent(t,n,r,i,o)},this.logError=function(t,n){e.getInstance().logError(t,n)},this.logLink=function(t,n,r,i){e.getInstance().logLink(t,n,r,i)},this.logForm=function(t,n,r,i){e.getInstance().logForm(t,n,r,i)},this.logPageView=function(t,n,r,i){e.getInstance().logPageView(t,n,r,i)},this.upload=function(){e.getInstance().upload()},this.eCommerce={setCurrencyCode:function(t){e.getInstance().eCommerce.setCurrencyCode(t)},createProduct:function(t,n,r,i,o,s,a,u,c,l){return e.getInstance().eCommerce.createProduct(t,n,r,i,o,s,a,u,c,l)},createPromotion:function(t,n,r,i){return e.getInstance().eCommerce.createPromotion(t,n,r,i)},createImpression:function(t,n){return e.getInstance().eCommerce.createImpression(t,n)},createTransactionAttributes:function(t,n,r,i,o,s){return e.getInstance().eCommerce.createTransactionAttributes(t,n,r,i,o,s)},logProductAction:function(t,n,r,i,o,s){e.getInstance().eCommerce.logProductAction(t,n,r,i,o,s)},logPurchase:function(t,n,r,i,o){e.getInstance().eCommerce.logPurchase(t,n,r,i,o)},logPromotion:function(t,n,r,i,o){e.getInstance().eCommerce.logPromotion(t,n,r,i,o)},logImpression:function(t,n,r,i){e.getInstance().eCommerce.logImpression(t,n,r,i)},expandCommerceEvent:function(t){return e.getInstance().eCommerce.expandCommerceEvent(t)}},this.setSessionAttribute=function(t,n){e.getInstance().setSessionAttribute(t,n)},this.setOptOut=function(t){e.getInstance().setOptOut(t)},this.setIntegrationAttribute=function(t,n){e.getInstance().setIntegrationAttribute(t,n)},this.getIntegrationAttributes=function(t){return e.getInstance().getIntegrationAttributes(t)},this.Identity={HTTPCodes:r.HTTPCodes,aliasUsers:function(t,n){e.getInstance().Identity.aliasUsers(t,n)},createAliasRequest:function(t,n,r){return e.getInstance().Identity.createAliasRequest(t,n,r)},getCurrentUser:function(){return e.getInstance().Identity.getCurrentUser()},getUser:function(t){return e.getInstance().Identity.getUser(t)},getUsers:function(){return e.getInstance().Identity.getUsers()},identify:function(t,n){e.getInstance().Identity.identify(t,n)},login:function(t,n){e.getInstance().Identity.login(t,n)},logout:function(t,n){e.getInstance().Identity.logout(t,n)},modify:function(t,n){e.getInstance().Identity.modify(t,n)},search:function(t,n,r){e.getInstance().Identity.search(t,n,r)}},this.sessionManager={getSession:function(){return e.getInstance()._SessionManager.getSessionId()}},this.Consent={createConsentState:function(){return e.getInstance().Consent.createConsentState()},createGDPRConsent:function(t,n,r,i,o){return e.getInstance().Consent.createGDPRConsent(t,n,r,i,o)},createCCPAConsent:function(t,n,r,i,o){return e.getInstance().Consent.createGDPRConsent(t,n,r,i,o)}},this.reset=function(){e.getInstance().reset(e.getInstance())},this._resetForTests=function(t,n){"boolean"==typeof n?e.getInstance()._resetForTests(t,n,e.getInstance()):e.getInstance()._resetForTests(t,!1,e.getInstance())},this.configurePixel=function(t){e.getInstance().configurePixel(t)},this._setIntegrationDelay=function(t,n){e.getInstance()._setIntegrationDelay(t,n)},this._getIntegrationDelays=function(){return e.getInstance()._getIntegrationDelays()},this.getVersion=function(){return e.getInstance().getVersion()},this.generateHash=function(t){return e.getInstance().generateHash(t)},this._cleanUrl=nn,this.addForwarder=function(t){e.getInstance().addForwarder(t)},this._getActiveForwarders=function(){return e.getInstance()._getActiveForwarders()},this._setWrapperSDKInfo=function(t,n){e.getInstance()._setWrapperSDKInfo(t,n)},this._registerErrorReportingService=function(t){e.getInstance()._registerErrorReportingService(t)},this._registerLoggingService=function(t){e.getInstance()._registerLoggingService(t)}};"undefined"!=typeof window&&(window.mParticle=Ws,window.mParticle._BatchValidator=new zs),module.exports=Ws;
|
|
1
|
+
"undefined"!=typeof globalThis&&(globalThis.regeneratorRuntime=void 0);var e={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encode:function(e){try{if(window.btoa&&window.atob)return window.btoa(unescape(encodeURIComponent(e)))}catch(e){console.error("Error encoding cookie values into Base64:"+e)}return this._encode(e)},_encode:function(n){var r,i,o,s,a,u,c,l="",d=0;for(n=t.encode(n);d<n.length;)s=(r=n.charCodeAt(d++))>>2,a=(3&r)<<4|(i=n.charCodeAt(d++))>>4,u=(15&i)<<2|(o=n.charCodeAt(d++))>>6,c=63&o,isNaN(i)?u=c=64:isNaN(o)&&(c=64),l=l+e._keyStr.charAt(s)+e._keyStr.charAt(a)+e._keyStr.charAt(u)+e._keyStr.charAt(c);return l},decode:function(t){try{if(window.btoa&&window.atob)return decodeURIComponent(escape(window.atob(t)))}catch(e){}return e._decode(t)},_decode:function(n){var r,i,o,s,a,u,c="",l=0;for(n=n.replace(/[^A-Za-z0-9\+\/\=]/g,"");l<n.length;)r=e._keyStr.indexOf(n.charAt(l++))<<2|(s=e._keyStr.indexOf(n.charAt(l++)))>>4,i=(15&s)<<4|(a=e._keyStr.indexOf(n.charAt(l++)))>>2,o=(3&a)<<6|(u=e._keyStr.indexOf(n.charAt(l++))),c+=String.fromCharCode(r),64!==a&&(c+=String.fromCharCode(i)),64!==u&&(c+=String.fromCharCode(o));return c=t.decode(c)}},t={encode:function(e){for(var t="",n=0;n<e.length;n++){var r=e.charCodeAt(n);r<128?t+=String.fromCharCode(r):r>127&&r<2048?(t+=String.fromCharCode(r>>6|192),t+=String.fromCharCode(63&r|128)):(t+=String.fromCharCode(r>>12|224),t+=String.fromCharCode(r>>6&63|128),t+=String.fromCharCode(63&r|128))}return t},decode:function(e){for(var t="",n=0,r=0,i=0,o=0;n<e.length;)(r=e.charCodeAt(n))<128?(t+=String.fromCharCode(r),n++):r>191&&r<224?(i=e.charCodeAt(n+1),t+=String.fromCharCode((31&r)<<6|63&i),n+=2):(i=e.charCodeAt(n+1),o=e.charCodeAt(n+2),t+=String.fromCharCode((15&r)<<12|(63&i)<<6|63&o),n+=3);return t}},n={forEach:function(e,t){var n,r;if(null==this)throw new TypeError(" this is null or not defined");var i=Object(this),o=i.length>>>0;if("function"!=typeof e)throw new TypeError(e+" is not a function");for(arguments.length>1&&(n=t),r=0;r<o;){var s=void 0;r in i&&(s=i[r],e.call(n,s,r,i)),r++}},map:function(e,t){var n,r,i;if(null===this)throw new TypeError(" this is null or not defined");var o=Object(this),s=o.length>>>0;if("function"!=typeof e)throw new TypeError(e+" is not a function");for(arguments.length>1&&(n=t),r=new Array(s),i=0;i<s;){var a=void 0,u=void 0;i in o&&(a=o[i],u=e.call(n,a,i,o),r[i]=u),i++}return r},filter:function(e){if(null==this)throw new TypeError;var t=Object(this),n=t.length>>>0;if("function"!=typeof e)throw new TypeError;for(var r=[],i=arguments.length>=2?arguments[1]:void 0,o=0;o<n;o++)if(o in t){var s=t[o];e.call(i,s,o,t)&&r.push(s)}return r},isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},Base64:e},r={sdkVersion:"3.26.0",sdkVendor:"mparticle",platform:"web",Messages:{DeprecationMessages:{MethodHasBeenDeprecated:"has been deprecated.",MethodMarkedForDeprecationPostfix:"is a deprecated method and will be removed in future releases.",AlternativeMethodPrefix:"Please use the alternate method:"},ErrorMessages:{NoToken:"A token must be specified.",EventNameInvalidType:"Event name must be a valid string value.",EventDataInvalidType:"Event data must be a valid object hash.",LoggingDisabled:"Event logging is currently disabled.",CookieParseError:"Could not parse cookie",EventEmpty:"Event object is null or undefined, cancelling send",APIRequestEmpty:"APIRequest is null or undefined, cancelling send",NoEventType:"Event type must be specified.",TransactionIdRequired:"Transaction ID is required",TransactionRequired:"A transaction attributes object is required",PromotionIdRequired:"Promotion ID is required",BadAttribute:"Attribute value cannot be object or array",BadKey:"Key value cannot be object or array",BadLogPurchase:"Transaction attributes and a product are both required to log a purchase, https://docs.mparticle.com/?javascript#measuring-transactions",AudienceAPINotEnabled:"Your workspace is not enabled to retrieve user audiences."},InformationMessages:{CookieSearch:"Searching for cookie",CookieFound:"Cookie found, parsing values",CookieNotFound:"Cookies not found",CookieSet:"Setting cookie",CookieSync:"Performing cookie sync",SendBegin:"Starting to send event",SendIdentityBegin:"Starting to send event to identity server",SendWindowsPhone:"Sending event to Windows Phone container",SendIOS:"Calling iOS path: ",SendAndroid:"Calling Android JS interface method: ",SendHttp:"Sending event to mParticle HTTP service",SendAliasHttp:"Sending alias request to mParticle HTTP service",SendIdentityHttp:"Sending event to mParticle HTTP service",StartingNewSession:"Starting new Session",StartingLogEvent:"Starting to log event",StartingLogOptOut:"Starting to log user opt in/out",StartingEndSession:"Starting to end session",StartingInitialization:"Starting to initialize",StartingLogCommerceEvent:"Starting to log commerce event",StartingAliasRequest:"Starting to Alias MPIDs",LoadingConfig:"Loading configuration options",AbandonLogEvent:"Cannot log event, logging disabled or developer token not set",AbandonAliasUsers:"Cannot Alias Users, logging disabled or developer token not set",AbandonStartSession:"Cannot start session, logging disabled or developer token not set",AbandonEndSession:"Cannot end session, logging disabled or developer token not set",NoSessionToEnd:"Cannot end session, no active session found"},ValidationMessages:{ModifyIdentityRequestUserIdentitiesPresent:"identityRequests to modify require userIdentities to be present. Request not sent to server. Please fix and try again",IdentityRequesetInvalidKey:"There is an invalid key on your identityRequest object. It can only contain a `userIdentities` object and a `onUserAlias` function. Request not sent to server. Please fix and try again.",OnUserAliasType:"The onUserAlias value must be a function.",UserIdentities:"The userIdentities key must be an object with keys of identityTypes and values of strings. Request not sent to server. Please fix and try again.",UserIdentitiesInvalidKey:"There is an invalid identity key on your `userIdentities` object within the identityRequest. Request not sent to server. Please fix and try again.",UserIdentitiesInvalidValues:"All user identity values must be strings or null. Request not sent to server. Please fix and try again.",AliasMissingMpid:"Alias Request must contain both a destinationMpid and a sourceMpid",AliasNonUniqueMpid:"Alias Request's destinationMpid and sourceMpid must be unique",AliasMissingTime:"Alias Request must have both a startTime and an endTime",AliasStartBeforeEndTime:"Alias Request's endTime must be later than its startTime"}},NativeSdkPaths:{LogEvent:"logEvent",SetUserTag:"setUserTag",RemoveUserTag:"removeUserTag",SetUserAttribute:"setUserAttribute",RemoveUserAttribute:"removeUserAttribute",SetSessionAttribute:"setSessionAttribute",LogOut:"logOut",SetUserAttributeList:"setUserAttributeList",RemoveAllUserAttributes:"removeAllUserAttributes",GetUserAttributesLists:"getUserAttributesLists",GetAllUserAttributes:"getAllUserAttributes",Identify:"identify",Logout:"logout",Login:"login",Modify:"modify",Alias:"aliasUsers",Upload:"upload"},StorageNames:{localStorageName:"mprtcl-api",localStorageNameV3:"mprtcl-v3",cookieName:"mprtcl-api",cookieNameV2:"mprtcl-v2",cookieNameV3:"mprtcl-v3",localStorageNameV4:"mprtcl-v4",cookieNameV4:"mprtcl-v4",currentStorageName:"mprtcl-v4"},DefaultConfig:{cookieDomain:null,cookieExpiration:365,logLevel:null,timeout:300,sessionTimeout:30,forwarderStatsTimeout:5e3,integrationDelayTimeout:5e3,maxCookieSize:3e3,aliasMaxWindow:90,uploadInterval:0},DefaultBaseUrls:{v1SecureServiceUrl:"jssdks.mparticle.com/v1/JS/",v2SecureServiceUrl:"jssdks.mparticle.com/v2/JS/",v3SecureServiceUrl:"jssdks.mparticle.com/v3/JS/",configUrl:"jssdkcdns.mparticle.com/JS/v2/",identityUrl:"identity.mparticle.com/v1/",aliasUrl:"jssdks.mparticle.com/v1/identity/",userAudienceUrl:"nativesdks.mparticle.com/v1/"},CNAMEUrlPaths:{v1SecureServiceUrl:"/webevents/v1/JS/",v2SecureServiceUrl:"/webevents/v2/JS/",v3SecureServiceUrl:"/webevents/v3/JS/",configUrl:"/tags/JS/v2/",identityUrl:"/identity/v1/",aliasUrl:"/webevents/v1/identity/"},Base64CookieKeys:{csm:1,sa:1,ss:1,lsa:1,ua:1,ui:1,csd:1,ia:1,con:1},SDKv2NonMPIDCookieKeys:{gs:1,cu:1,l:1,globalSettings:1,currentUserMPID:1},HTTPCodes:{noHttpCoverage:-1,activeIdentityRequest:-2,activeSession:-3,validationIssue:-4,nativeIdentityRequest:-5,loggingDisabledOrMissingAPIKey:-6,tooManyRequests:429},FeatureFlags:{ReportBatching:"reportBatching",EventBatchingIntervalMillis:"eventBatchingIntervalMillis",OfflineStorage:"offlineStorage",DirectUrlRouting:"directURLRouting",CacheIdentity:"cacheIdentity",AudienceAPI:"audienceAPI",CaptureIntegrationSpecificIds:"captureIntegrationSpecificIds",CaptureIntegrationSpecificIdsV2:"captureIntegrationSpecificIds.V2",AstBackgroundEvents:"astBackgroundEvents",AutoLogPageView:"autoLogPageView",AutoButtonTracking:"autoButtonTracking",AutoLinkTracking:"autoLinkTracking"},DefaultInstance:"default_instance",CCPAPurpose:"data_sale_opt_out",IdentityMethods:{Modify:"modify",Logout:"logout",Login:"login",Identify:"identify"},Environment:{Development:"development",Production:"production"},CaptureIntegrationSpecificIdsV2Modes:{All:"all",None:"none",RoktOnly:"roktonly"},Rokt:{LauncherInstanceGuidKey:"__rokt_li_guid__"}},i="$NoTargeting",o=200,s=202,a=400,u=500;function c(e){return c="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},c(e)}var l=function(e,t){return l=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},l(e,t)};function d(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}l(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var p=function(){return p=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},p.apply(this,arguments)};function g(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))}function h(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}}function v(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;i<o;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var f=r.Messages,m=function(e){return T(D(e))},y=function(e){return k(E(e))},b=function(e,t){if(!e)return!1;var n=0;if(Array.prototype.indexOf)return e.indexOf(t,0)>=0;for(var r=e.length;n<r;n++)if(n in e&&e[n]===t)return!0;return!1},S=function(e,t){if(t&&e)for(var n in e)if(W(e,n)&&n.toLowerCase()===t.toLowerCase())return n;return null},I=function(e,t,n,r){var i=[e];return t?i.push(f.DeprecationMessages.MethodHasBeenDeprecated):i.push(f.DeprecationMessages.MethodMarkedForDeprecationPostfix),n&&(i.push(f.DeprecationMessages.AlternativeMethodPrefix),i.push(n+".")),r&&i.push("See - "+r),i.join(" ")};function _(e){var t=0;if(null==e)return 0;if(e=e.toString().toLowerCase(),Array.prototype.reduce)return e.split("").reduce((function(e,t){return(e=(e<<5)-e+t.charCodeAt(0))&e}),0);if(0===e.length)return t;for(var n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t&=t;return t}var w=function(e){return void 0===e&&(e=""),e?function(e){var t,n;return window.crypto&&window.crypto.getRandomValues&&(t=window.crypto.getRandomValues(new Uint8Array(1))),t?(n^t[0]%16>>NaN).toString(16):(n^16*Math.random()>>NaN).toString(16)}():"".concat(1e7,"-").concat(1e3,"-").concat(4e3,"-").concat(8e3,"-").concat(1e11).replace(/[018]/g,w)},P=function(e){var t=Object.prototype.toString.call(e);return"[object Object]"===t||"[object Error]"===t},C=function(e){if(isNaN(e)||!isFinite(e))return 0;var t=parseFloat(e);return isNaN(t)?0:t},A=function(e){return j(e)?e:null},T=function(e){return e.replace(/,/g,"|")},k=function(e){return e.replace(/\|/g,",")},E=function(e){return e.replace(/\'/g,'"')},D=function(e){return e.replace(/\"/g,"'")},O=function(e,t){return e.replace("%%mpid%%",t)},M=function(e){return e.replace(/&/g,"&")},L=function(e,t,n,r,i){var o=M(t),s=n?M(n):null,a=O(o,e),u=s?O(s,e):"",c=a+encodeURIComponent(u);if(r){var l=c.includes("?")?"&":"?";c+="".concat(l,"domain=").concat(r)}if(i){l=c.includes("?")?"&":"?";c+="".concat(l,"google_hm=").concat(i)}return c},F={"+":"-","/":"_","=":""},U=function(e){return function(e){return!/[^\u0000-\u00ff]/.test(e)}(e)?btoa(e).replace(/[+/=]/g,(function(e){return F[e]})):void 0},N=function(e){return"false"!==e&&"0"!==e&&Boolean(e)},R=function(e){return decodeURIComponent(e.replace(/\+/g," "))},V=function(e){return 0===e.indexOf('"')&&(e=e.slice(1,-1).replace(/\\"/g,'"').replace(/\\\\/g,"\\")),e},x=function(e){return"string"==typeof e},H=function(e){return"number"==typeof e},K=function(e){return"function"==typeof e},B=function(e){return H(e)||x(e)||function(e){return"boolean"==typeof e}(e)},q=function(e){return e===(j(t=e)?t.toString().toLowerCase().replace(/[^0-9a-zA-Z]+/g,"_"):"");var t},j=function(e){return x(e)||H(e)},z=function(e){return null==e||!(Object.keys(e)||e).length},Q=function(e,t){return e.slice(0,t).concat(e.slice(t+1),e[t])},W=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},J=function(e){return"__proto__"===e||"constructor"===e},G=function(e){return J(e)||"prototype"===e},$=function(e,t){var n;void 0===t&&(t=[]);var r={},i={};if(!e)return r;if("undefined"!=typeof URL&&"undefined"!=typeof URLSearchParams){var o=new URL(e);n=new URLSearchParams(o.search)}else n=Y(e);return n.forEach((function(e,t){i[t.toLowerCase()]=e})),z(t)?i:(t.forEach((function(e){var t=e.toLowerCase();W(i,t)&&i[t]&&(r[e]=i[t])})),r)},Y=function(e){var t={};return(e.split("#")[0].split("?")[1]||"").split("&").forEach((function(e){var n=e.split("="),r=n[0],i=n.slice(1).join("=");if(r&&void 0!==i)try{t[r]=decodeURIComponent(i||"")}catch(e){console.error("Failed to decode value for key ".concat(r,": ").concat(e))}})),{get:function(e){return t[e]},forEach:function(e){for(var n in t)W(t,n)&&e(t[n],n)}}},X=function(){return"undefined"!=typeof window&&window.location?window.location.href:""},Z=function(e,t,n){var r,i={};if(!z(e))for(var o in e)if(W(e,o)&&(!J(r=o)&&"hasOwnProperty"!==r)){var s=n(o);b(t,s)||(i[o]=e[o])}return i},ee=function(e,t,n){var r;return(null===(r=e.kitConfigs)||void 0===r?void 0:r.find((function(e){return e.name===t&&e.moduleId===n})))||null},te=function(e){if(null==e)return e;if(Array.isArray(e))return e.map((function(e){return te(e)}));if(P(e)){var t={};for(var n in e)e.hasOwnProperty(n)&&(t[n]=te(e[n]));return t}return c(e)},ne=function(e,t){return t?e:te(e)};function re(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n,r,i,o,s,a,u={hasOwn:Object.prototype.hasOwnProperty,class2type:{},type:function(e){return null==e?String(e):u.class2type[Object.prototype.toString.call(e)]||"object"},isPlainObject:function(e){if(!e||"object"!==u.type(e)||e.nodeType||u.isWindow(e))return!1;try{if(e.constructor&&!u.hasOwn.call(e,"constructor")&&!u.hasOwn.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(e){return!1}var t;for(t in e);return void 0===t||u.hasOwn.call(e,t)},isArray:Array.isArray||function(e){return"array"===u.type(e)},isFunction:function(e){return"function"===u.type(e)},isWindow:function(e){return null!=e&&e==e.window}},l=e[0]||{},d=1,p=!1,g=e.length;for("boolean"==typeof l&&(p=l,l=e[1]||{},d=2),"object"===c(l)||u.isFunction(l)||(l={}),g===d&&(l={},--d);d<g;d++)if(null!=(n=e[d]))for(r in n)G(r)||Object.prototype.hasOwnProperty.call(n,r)&&(i=l[r],l!==(o=n[r])&&(p&&o&&(u.isPlainObject(o)||(s=u.isArray(o)))?(s?(s=!1,a=i&&u.isArray(i)?i:[]):a=i&&u.isPlainObject(i)?i:{},l[r]=re(p,a,o)):void 0!==o&&(l[r]=o)));return l}var ie=function(e,t){return void 0===t&&(t="unknown error"),e instanceof Error?e.message:"string"==typeof e?e:e&&"object"===c(e)&&"string"==typeof e.message?e.message:t},oe={SessionStart:1,SessionEnd:2,PageView:3,PageEvent:4,CrashReport:5,OptOut:6,AppStateTransition:10,Profile:14,Commerce:16,Media:20,UserAttributeChange:17,UserIdentityChange:18},se={Unknown:0,Navigation:1,Location:2,Search:3,Transaction:4,UserContent:5,UserPreference:6,Social:7,Other:8,Media:9,getName:function(e){switch(e){case se.Unknown:return"Unknown";case se.Navigation:return"Navigation";case se.Location:return"Location";case se.Search:return"Search";case se.Transaction:return"Transaction";case se.UserContent:return"User Content";case se.UserPreference:return"User Preference";case se.Social:return"Social";case ae.ProductAddToCart:return"Product Added to Cart";case ae.ProductAddToWishlist:return"Product Added to Wishlist";case ae.ProductCheckout:return"Product Checkout";case ae.ProductCheckoutOption:return"Product Checkout Options";case ae.ProductClick:return"Product Click";case ae.ProductImpression:return"Product Impression";case ae.ProductPurchase:return"Product Purchased";case ae.ProductRefund:return"Product Refunded";case ae.ProductRemoveFromCart:return"Product Removed From Cart";case ae.ProductRemoveFromWishlist:return"Product Removed from Wishlist";case ae.ProductViewDetail:return"Product View Details";case ae.PromotionClick:return"Promotion Click";case ae.PromotionView:return"Promotion View";default:return"Other"}}},ae={ProductAddToCart:10,ProductRemoveFromCart:11,ProductCheckout:12,ProductCheckoutOption:13,ProductClick:14,ProductViewDetail:15,ProductPurchase:16,ProductRefund:17,PromotionView:18,PromotionClick:19,ProductAddToWishlist:20,ProductRemoveFromWishlist:21,ProductImpression:22},ue={Other:0,CustomerId:1,Facebook:2,Twitter:3,Google:4,Microsoft:5,Yahoo:6,Email:7,FacebookCustomAudienceId:9,Other2:10,Other3:11,Other4:12,Other5:13,Other6:14,Other7:15,Other8:16,Other9:17,Other10:18,MobileNumber:19,PhoneNumber2:20,PhoneNumber3:21,isValid:function(e){if("number"==typeof e)for(var t in ue)if(ue.hasOwnProperty(t)&&ue[t]===e)return!0;return!1},getName:function(e){switch(e){case window.mParticle.IdentityType.CustomerId:return"Customer ID";case window.mParticle.IdentityType.Facebook:return"Facebook ID";case window.mParticle.IdentityType.Twitter:return"Twitter ID";case window.mParticle.IdentityType.Google:return"Google ID";case window.mParticle.IdentityType.Microsoft:return"Microsoft ID";case window.mParticle.IdentityType.Yahoo:return"Yahoo ID";case window.mParticle.IdentityType.Email:return"Email";case window.mParticle.IdentityType.FacebookCustomAudienceId:return"Facebook App User ID";default:return"Other ID"}},getIdentityType:function(e){switch(e){case"other":case"email_sha256":return ue.Other;case"customerid":return ue.CustomerId;case"facebook":return ue.Facebook;case"twitter":return ue.Twitter;case"google":return ue.Google;case"microsoft":return ue.Microsoft;case"yahoo":return ue.Yahoo;case"email":return ue.Email;case"facebookcustomaudienceid":return ue.FacebookCustomAudienceId;case"other2":case"mobile_sha256":return ue.Other2;case"other3":return ue.Other3;case"other4":return ue.Other4;case"other5":return ue.Other5;case"other6":return ue.Other6;case"other7":return ue.Other7;case"other8":return ue.Other8;case"other9":return ue.Other9;case"other10":return ue.Other10;case"mobile_number":return ue.MobileNumber;case"phone_number_2":return ue.PhoneNumber2;case"phone_number_3":return ue.PhoneNumber3;default:return!1}},getIdentityName:function(e){switch(e){case ue.Other:return"other";case ue.CustomerId:return"customerid";case ue.Facebook:return"facebook";case ue.Twitter:return"twitter";case ue.Google:return"google";case ue.Microsoft:return"microsoft";case ue.Yahoo:return"yahoo";case ue.Email:return"email";case ue.FacebookCustomAudienceId:return"facebookcustomaudienceid";case ue.Other2:return"other2";case ue.Other3:return"other3";case ue.Other4:return"other4";case ue.Other5:return"other5";case ue.Other6:return"other6";case ue.Other7:return"other7";case ue.Other8:return"other8";case ue.Other9:return"other9";case ue.Other10:return"other10";case ue.MobileNumber:return"mobile_number";case ue.PhoneNumber2:return"phone_number_2";case ue.PhoneNumber3:return"phone_number_3";default:return null}},getValuesAsStrings:function(){return Object.values(ue).map((function(e){return H(e)?e.toString():void 0})).filter((function(e){return void 0!==e}))},getNewIdentitiesByName:function(e){var t={},n=ue.getValuesAsStrings();for(var r in e){if(n.includes(r))t[ue.getIdentityName(C(r))]=e[r]}return t}},ce={Unknown:0,AddToCart:1,RemoveFromCart:2,Checkout:3,CheckoutOption:4,Click:5,ViewDetail:6,Purchase:7,Refund:8,AddToWishlist:9,RemoveFromWishlist:10,ViewCart:11,AddShippingInfo:12,AddPaymentInfo:13,PaymentMethodSelected:14,PaymentAttempted:15,PaymentSucceeded:16,PaymentFailed:17,RefundInitiated:18,isRoktCommerceType:function(e){return e>=ce.ViewCart&&e<=ce.RefundInitiated},getName:function(e){switch(e){case ce.AddToCart:return"Add to Cart";case ce.RemoveFromCart:return"Remove from Cart";case ce.Checkout:return"Checkout";case ce.CheckoutOption:return"Checkout Option";case ce.Click:return"Click";case ce.ViewDetail:return"View Detail";case ce.Purchase:return"Purchase";case ce.Refund:return"Refund";case ce.AddToWishlist:return"Add to Wishlist";case ce.RemoveFromWishlist:return"Remove from Wishlist";case ce.ViewCart:return"View Cart";case ce.AddShippingInfo:return"Add Shipping Info";case ce.AddPaymentInfo:return"Add Payment Info";case ce.PaymentMethodSelected:return"Payment Method Selected";case ce.PaymentAttempted:return"Payment Attempted";case ce.PaymentSucceeded:return"Payment Succeeded";case ce.PaymentFailed:return"Payment Failed";case ce.RefundInitiated:return"Refund Initiated";default:return"Unknown"}},getExpansionName:function(e){switch(e){case ce.AddToCart:return"add_to_cart";case ce.RemoveFromCart:return"remove_from_cart";case ce.Checkout:return"checkout";case ce.CheckoutOption:return"checkout_option";case ce.Click:return"click";case ce.ViewDetail:return"view_detail";case ce.Purchase:return"purchase";case ce.Refund:return"refund";case ce.AddToWishlist:return"add_to_wishlist";case ce.RemoveFromWishlist:return"remove_from_wishlist";case ce.ViewCart:return"view_cart";case ce.AddShippingInfo:return"add_shipping_info";case ce.AddPaymentInfo:return"add_payment_info";case ce.PaymentMethodSelected:return"payment_method_selected";case ce.PaymentAttempted:return"payment_attempted";case ce.PaymentSucceeded:return"payment_succeeded";case ce.PaymentFailed:return"payment_failed";case ce.RefundInitiated:return"refund_initiated";default:return"unknown"}}},le={SignUp:"sign_up",Subscribe:"subscribe",StartTrial:"start_trial",GenerateLead:"generate_lead",Search:"search",Upsell:"upsell",EarnVirtualCurrency:"earn_virtual_currency",DwellTime:"dwell_time",Hover:"hover",Scroll:"scroll",ClickToExpand:"click_to_expand"},de={Unknown:0,PromotionView:1,PromotionClick:2,getName:function(e){switch(e){case de.PromotionView:return"view";case de.PromotionClick:return"click";default:return"unknown"}},getExpansionName:function(e){switch(e){case de.PromotionView:return"view";case de.PromotionClick:return"click";default:return"unknown"}}},pe="mp:sdkStart",ge="mp:jointSdkSelectPlacements",he="mp:jointSdkRoktKitInit";function ve(e){var t=C(e);return String(t)===e&&ue.isValid(t)?t:null}var fe,me={MessageType:oe,EventType:se,CommerceEventType:ae,IdentityType:ue,ProfileMessageType:{Logout:3},ApplicationTransitionType:{AppInit:1},ProductActionType:ce,PromotionActionType:de,RoktEvents:le,Environment:r.Environment};!function(e){e[e.Unknown=0]="Unknown",e[e.AddToCart=1]="AddToCart",e[e.RemoveFromCart=2]="RemoveFromCart",e[e.Checkout=3]="Checkout",e[e.CheckoutOption=4]="CheckoutOption",e[e.Click=5]="Click",e[e.ViewDetail=6]="ViewDetail",e[e.Purchase=7]="Purchase",e[e.Refund=8]="Refund",e[e.AddToWishlist=9]="AddToWishlist",e[e.RemoveFromWishlist=10]="RemoveFromWishlist",e[e.ViewCart=11]="ViewCart",e[e.AddShippingInfo=12]="AddShippingInfo",e[e.AddPaymentInfo=13]="AddPaymentInfo",e[e.PaymentMethodSelected=14]="PaymentMethodSelected",e[e.PaymentAttempted=15]="PaymentAttempted",e[e.PaymentSucceeded=16]="PaymentSucceeded",e[e.PaymentFailed=17]="PaymentFailed",e[e.RefundInitiated=18]="RefundInitiated"}(fe||(fe={}));var ye,be,Se,Ie,_e,we,Pe,Ce,Ae,Te,ke,Ee,De,Oe,Me,Le,Fe,Ue,Ne,Re="none",Ve="verbose",xe="warning",He={};ye=He,Object.defineProperty(ye,"__esModule",{value:!0}),(be=ye.ApplicationInformationOsEnum||(ye.ApplicationInformationOsEnum={})).unknown="Unknown",be.iOS="IOS",be.android="Android",be.windowsPhone="WindowsPhone",be.mobileWeb="MobileWeb",be.unityIOS="UnityIOS",be.unityAndroid="UnityAndroid",be.desktop="Desktop",be.tvOS="TVOS",be.roku="Roku",be.outOfBand="OutOfBand",be.alexa="Alexa",be.smartTV="SmartTV",be.fireTV="FireTV",be.xbox="Xbox",(ye.ApplicationStateTransitionEventEventTypeEnum||(ye.ApplicationStateTransitionEventEventTypeEnum={})).applicationStateTransition="application_state_transition",(Se=ye.ApplicationStateTransitionEventDataApplicationTransitionTypeEnum||(ye.ApplicationStateTransitionEventDataApplicationTransitionTypeEnum={})).applicationInitialized="application_initialized",Se.applicationExit="application_exit",Se.applicationBackground="application_background",Se.applicationForeground="application_foreground",(Ie=ye.BatchEnvironmentEnum||(ye.BatchEnvironmentEnum={})).unknown="unknown",Ie.development="development",Ie.production="production",(ye.BreadcrumbEventEventTypeEnum||(ye.BreadcrumbEventEventTypeEnum={})).breadcrumb="breadcrumb",(ye.CommerceEventEventTypeEnum||(ye.CommerceEventEventTypeEnum={})).commerceEvent="commerce_event",(_e=ye.CommerceEventDataCustomEventTypeEnum||(ye.CommerceEventDataCustomEventTypeEnum={})).addToCart="add_to_cart",_e.removeFromCart="remove_from_cart",_e.checkout="checkout",_e.checkoutOption="checkout_option",_e.click="click",_e.viewDetail="view_detail",_e.purchase="purchase",_e.refund="refund",_e.promotionView="promotion_view",_e.promotionClick="promotion_click",_e.addToWishlist="add_to_wishlist",_e.removeFromWishlist="remove_from_wishlist",_e.impression="impression",(ye.CrashReportEventEventTypeEnum||(ye.CrashReportEventEventTypeEnum={})).crashReport="crash_report",(ye.CustomEventEventTypeEnum||(ye.CustomEventEventTypeEnum={})).customEvent="custom_event",(we=ye.CustomEventDataCustomEventTypeEnum||(ye.CustomEventDataCustomEventTypeEnum={})).navigation="navigation",we.location="location",we.search="search",we.transaction="transaction",we.userContent="user_content",we.userPreference="user_preference",we.social="social",we.media="media",we.other="other",we.unknown="unknown",(Pe=ye.DeviceCurrentStateDeviceOrientationEnum||(ye.DeviceCurrentStateDeviceOrientationEnum={})).portrait="portrait",Pe.portraitUpsideDown="portrait_upside_down",Pe.landscape="landscape",Pe.landscapeLeft="LandscapeLeft",Pe.landscapeRight="LandscapeRight",Pe.faceUp="FaceUp",Pe.faceDown="FaceDown",Pe.square="Square",(Ce=ye.DeviceCurrentStateStatusBarOrientationEnum||(ye.DeviceCurrentStateStatusBarOrientationEnum={})).portrait="portrait",Ce.portraitUpsideDown="portrait_upside_down",Ce.landscape="landscape",Ce.landscapeLeft="LandscapeLeft",Ce.landscapeRight="LandscapeRight",Ce.faceUp="FaceUp",Ce.faceDown="FaceDown",Ce.square="Square",(Ae=ye.DeviceInformationPlatformEnum||(ye.DeviceInformationPlatformEnum={})).iOS="iOS",Ae.android="Android",Ae.web="web",Ae.desktop="desktop",Ae.tvOS="tvOS",Ae.roku="roku",Ae.outOfBand="out_of_band",Ae.smartTV="smart_tv",Ae.xbox="xbox",(Te=ye.EventTypeEnum||(ye.EventTypeEnum={})).unknown="unknown",Te.sessionStart="session_start",Te.sessionEnd="session_end",Te.screenView="screen_view",Te.customEvent="custom_event",Te.crashReport="crash_report",Te.optOut="opt_out",Te.firstRun="first_run",Te.preAttribution="pre_attribution",Te.pushRegistration="push_registration",Te.applicationStateTransition="application_state_transition",Te.pushMessage="push_message",Te.networkPerformance="network_performance",Te.breadcrumb="breadcrumb",Te.profile="profile",Te.pushReaction="push_reaction",Te.commerceEvent="commerce_event",Te.userAttributeChange="user_attribute_change",Te.userIdentityChange="user_identity_change",Te.uninstall="uninstall",Te.validationResult="validation_result",(ke=ye.IdentityTypeEnum||(ye.IdentityTypeEnum={})).other="other",ke.customerId="customer_id",ke.facebook="facebook",ke.twitter="twitter",ke.google="google",ke.microsoft="microsoft",ke.yahoo="yahoo",ke.email="email",ke.alias="alias",ke.facebookCustomAudienceId="facebook_custom_audience_id",ke.otherId2="other_id_2",ke.otherId3="other_id_3",ke.otherId4="other_id_4",ke.otherId5="other_id_5",ke.otherId6="other_id_6",ke.otherId7="other_id_7",ke.otherId8="other_id_8",ke.otherId9="other_id_9",ke.otherId10="other_id_10",ke.mobileNumber="mobile_number",ke.phoneNumber2="phone_number_2",ke.phoneNumber3="phone_number_3",(ye.NetworkPerformanceEventEventTypeEnum||(ye.NetworkPerformanceEventEventTypeEnum={})).networkPerformance="network_performance",(ye.OptOutEventEnum||(ye.OptOutEventEnum={})).optOut="opt_out",(Ee=ye.ProductActionActionEnum||(ye.ProductActionActionEnum={})).unknown="unknown",Ee.addToCart="add_to_cart",Ee.removeFromCart="remove_from_cart",Ee.checkout="checkout",Ee.checkoutOption="checkout_option",Ee.click="click",Ee.viewDetail="view_detail",Ee.purchase="purchase",Ee.refund="refund",Ee.addToWishlist="add_to_wishlist",Ee.removeFromWishlist="remove_from_wish_list",(ye.ProfileEventEventTypeEnum||(ye.ProfileEventEventTypeEnum={})).profile="profile",(De=ye.ProfileEventDataProfileEventTypeEnum||(ye.ProfileEventDataProfileEventTypeEnum={})).signup="signup",De.login="login",De.logout="logout",De.update="update",De.delete="delete",(Oe=ye.PromotionActionActionEnum||(ye.PromotionActionActionEnum={})).view="view",Oe.click="click",(ye.PushMessageEventEventTypeEnum||(ye.PushMessageEventEventTypeEnum={})).pushMessage="push_message",(Me=ye.PushMessageEventDataPushMessageTypeEnum||(ye.PushMessageEventDataPushMessageTypeEnum={})).sent="sent",Me.received="received",Me.action="action",(Le=ye.PushMessageEventDataApplicationStateEnum||(ye.PushMessageEventDataApplicationStateEnum={})).notRunning="not_running",Le.background="background",Le.foreground="foreground",(Fe=ye.PushMessageEventDataPushMessageBehaviorEnum||(ye.PushMessageEventDataPushMessageBehaviorEnum={})).received="Received",Fe.directOpen="DirectOpen",Fe.read="Read",Fe.influencedOpen="InfluencedOpen",Fe.displayed="Displayed",(ye.PushRegistrationEventEventTypeEnum||(ye.PushRegistrationEventEventTypeEnum={})).pushRegistration="push_registration",(ye.SessionEndEventEventTypeEnum||(ye.SessionEndEventEventTypeEnum={})).sessionEnd="session_end",(ye.SessionStartEventEventTypeEnum||(ye.SessionStartEventEventTypeEnum={})).sessionStart="session_start",(Ue=ye.SourceInformationChannelEnum||(ye.SourceInformationChannelEnum={})).native="native",Ue.javascript="javascript",Ue.pixel="pixel",Ue.desktop="desktop",Ue.partner="partner",Ue.serverToServer="server_to_server",(ye.UserAttributeChangeEventEventTypeEnum||(ye.UserAttributeChangeEventEventTypeEnum={})).userAttributeChange="user_attribute_change",(ye.UserIdentityChangeEventEventTypeEnum||(ye.UserIdentityChangeEventEventTypeEnum={})).userIdentityChange="user_identity_change",function(e){e.other="other",e.customerId="customerid",e.facebook="facebook",e.twitter="twitter",e.google="google",e.microsoft="microsoft",e.yahoo="yahoo",e.email="email",e.alias="alias",e.facebookCustomAudienceId="facebookcustomaudienceid",e.otherId2="other2",e.otherId3="other3",e.otherId4="other4",e.otherId5="other5",e.otherId6="other6",e.otherId7="other7",e.otherId8="other8",e.otherId9="other9",e.otherId10="other10",e.mobileNumber="mobile_number",e.phoneNumber2="phone_number_2",e.phoneNumber3="phone_number_3"}(Ne||(Ne={}));var Ke="custom_flags",Be="partner_identities",qe="integration_attributes",je={fbclid:{mappedKey:"Facebook.ClickId",processor:function(e,t,n){if(!e||!t)return"";var r=null==t?void 0:t.split("//");if(!r)return"";var i=1;r[1].split("/")[0].split(".").length>=3&&(i=2);var o=n||Date.now();return"fb.".concat(i,".").concat(o,".").concat(e)},output:Ke},_fbp:{mappedKey:"Facebook.BrowserId",output:Ke},_fbc:{mappedKey:"Facebook.ClickId",output:Ke},gclid:{mappedKey:"GoogleEnhancedConversions.Gclid",output:Ke},gbraid:{mappedKey:"GoogleEnhancedConversions.Gbraid",output:Ke},wbraid:{mappedKey:"GoogleEnhancedConversions.Wbraid",output:Ke},ttclid:{mappedKey:"TikTok.Callback",output:Ke},_ttp:{mappedKey:"tiktok_cookie_id",output:Be},ScCid:{mappedKey:"SnapchatConversions.ClickId",output:Ke},epik:{mappedKey:"Pinterest.click_id",output:Ke},_epik:{mappedKey:"Pinterest.click_id",output:Ke},_scid:{mappedKey:"SnapchatConversions.Cookie1",output:Ke}},ze={rtid:{mappedKey:"passbackconversiontrackingid",output:qe,moduleId:1277},rclid:{mappedKey:"passbackconversiontrackingid",output:qe,moduleId:1277},RoktTransactionId:{mappedKey:"passbackconversiontrackingid",output:qe,moduleId:1277}};function Qe(e){if(!e)return!1;var t=e(r.FeatureFlags.CaptureIntegrationSpecificIds),n=e(r.FeatureFlags.CaptureIntegrationSpecificIdsV2);return!!n&&n!==r.CaptureIntegrationSpecificIdsV2Modes.None||!0===t}var We=function(){function e(e){this.initialTimestamp=Date.now(),this.captureMode=e,this.filteredPartnerIdentityMappings=this.filterMappings(Be),this.filteredCustomFlagMappings=this.filterMappings(Ke),this.filteredIntegrationAttributeMappings=this.filterMappings(qe)}return e.prototype.capture=function(){var e=this.captureQueryParams()||{},t=this.captureCookies()||{},n=this.captureLocalStorage()||{};this.normalizePinterestClickId(e),this.normalizePinterestClickId(n),this.normalizePinterestClickId(t),this.applySourcePrecedence([e,n,t,this.clickIds||{}]),this.clickIds=p(p(p(p({},this.clickIds),t),n),e)},e.prototype.captureCookies=function(){var e,t=this.getAllowedKeysForMode(),n=(e=t,function(e,t){for(var n={},r=0,i=e;r<i.length;r++){var o=i[r].split("="),s=o[0],a=o[1];t&&!t.includes(s)||(n[s]=a)}return n}(function(){try{return"undefined"==typeof window?[]:window.document.cookie.split(";").map((function(e){return e.trim()}))}catch(e){return console.error("Unable to parse cookies",e),[]}}(),e));return this.applyProcessors(n,X(),this.initialTimestamp)},e.prototype.captureQueryParams=function(){var e=this.getQueryParams();return this.applyProcessors(e,X(),this.initialTimestamp)},e.prototype.captureLocalStorage=function(){for(var e={},t=0,n=this.getAllowedKeysForMode();t<n.length;t++){var r=n[t],i=localStorage.getItem(r);i&&(e[r]=i)}return this.applyProcessors(e,X(),this.initialTimestamp)},e.prototype.getQueryParams=function(){var e=this.getAllowedKeysForMode();return $(X(),e)},e.prototype.getClickIdsAsCustomFlags=function(){return this.getClickIds(this.clickIds,this.filteredCustomFlagMappings)},e.prototype.getClickIdsAsPartnerIdentities=function(){return this.getClickIds(this.clickIds,this.filteredPartnerIdentityMappings)},e.prototype.getClickIdsAsIntegrationAttributes=function(){var e,t,n,r={};for(var i in this.clickIds)if(this.clickIds.hasOwnProperty(i)){var o=this.clickIds[i],s=null===(t=this.filteredIntegrationAttributeMappings[i])||void 0===t?void 0:t.mappedKey;if(!z(s)){var a=null===(n=this.filteredIntegrationAttributeMappings[i])||void 0===n?void 0:n.moduleId;a&&!r[a]&&(r[a]=((e={})[s]=o,e))}}return r},e.prototype.getClickIds=function(e,t){var n,r={};if(!e)return r;for(var i in e)if(e.hasOwnProperty(i)){var o=e[i],s=null===(n=t[i])||void 0===n?void 0:n.mappedKey;z(s)||(r[s]=o)}return r},e.prototype.normalizePinterestClickId=function(e){z(null==e?void 0:e._epik)||z(null==e?void 0:e.epik)||delete e.epik},e.prototype.applySourcePrecedence=function(e){for(var t=this.getActiveIntegrationMapping(),n=function(e){var n;return(null===(n=t[e])||void 0===n?void 0:n.mappedKey)||e},r=[],i=0,o=e;i<o.length;i++){var s=o[i],a=[];for(var u in s){var c=n(u);-1!==r.indexOf(c)?delete s[u]:z(s[u])||a.push(c)}r.push.apply(r,a)}},e.prototype.applyProcessors=function(e,t,n){var r,i={},o=this.getActiveIntegrationMapping();for(var s in e)if(e.hasOwnProperty(s)){var a=e[s],u=null===(r=o[s])||void 0===r?void 0:r.processor;i[s]=u?u(a,t,n):a}return i},e.prototype.filterMappings=function(e){var t={},n=this.getActiveIntegrationMapping();for(var r in n)n[r].output===e&&(t[r]=n[r]);return t},e.prototype.getAllowedKeysForMode=function(){return Object.keys(this.getActiveIntegrationMapping())},e.prototype.getActiveIntegrationMapping=function(){return this.captureMode===r.CaptureIntegrationSpecificIdsV2Modes.RoktOnly?ze:this.captureMode===r.CaptureIntegrationSpecificIdsV2Modes.All?p(p({},je),ze):{}},e}();function Je(e,t,n){if(!e)return null;if(!t||t.length<1)return null;for(var r=n._IntegrationCapture,i=n._Helpers.getFeatureFlag,o=n.Identity.getCurrentUser(),s=[],a=null,u=0,c=t;u<c.length;u++){var l=c[u];if(l){a=l;var d=Ze(l);d&&s.push(d)}}if(!a)return null;var p=null;z(a.ConsentState)?z(o)||(p=o.getConsentState()):p=a.ConsentState;var g={source_request_id:n._Helpers.generateUniqueId(),mpid:e,timestamp_unixtime_ms:(new Date).getTime(),environment:a.Debug?He.BatchEnvironmentEnum.development:He.BatchEnvironmentEnum.production,events:s,mp_deviceid:a.DeviceId,sdk_version:a.SDKVersion,application_info:{application_version:a.AppVersion,application_name:a.AppName,package:a.Package,sideloaded_kits_count:n._Store.sideloadedKitsCount},device_info:{platform:He.DeviceInformationPlatformEnum.web,screen_width:"undefined"!=typeof window&&void 0!==window.screen?window.screen.width:0,screen_height:"undefined"!=typeof window&&void 0!==window.screen?window.screen.height:0},user_attributes:a.UserAttributes,user_identities:Xe(a.UserIdentities),consent_state:Ge(p),integration_attributes:a.IntegrationAttributes};if(a.DataPlan&&a.DataPlan.PlanId&&(g.context={data_plan:{plan_id:a.DataPlan.PlanId,plan_version:a.DataPlan.PlanVersion||void 0}}),Qe(i)){null==r||r.capture();var h=null==r?void 0:r.getClickIdsAsPartnerIdentities();z(h)||(g.partner_identities=h)}return g}function Ge(e){return z(e)?null:{gdpr:$e(e.getGDPRConsentState()),ccpa:Ye(e.getCCPAConsentState())}}function $e(e){if(!e)return null;var t={};for(var n in e)e.hasOwnProperty(n)&&(t[n]={consented:e[n].Consented,hardware_id:e[n].HardwareId,document:e[n].ConsentDocument,timestamp_unixtime_ms:e[n].Timestamp,location:e[n].Location});return t}function Ye(e){return e?{data_sale_opt_out:{consented:e.Consented,hardware_id:e.HardwareId,document:e.ConsentDocument,timestamp_unixtime_ms:e.Timestamp,location:e.Location}}:null}function Xe(e){if(!e||!e.length)return null;for(var t={},n=0,r=e;n<r.length;n++){var i=r[n];switch(i.Type){case me.IdentityType.CustomerId:t.customer_id=i.Identity;break;case me.IdentityType.Email:t.email=i.Identity;break;case me.IdentityType.Facebook:t.facebook=i.Identity;break;case me.IdentityType.FacebookCustomAudienceId:t.facebook_custom_audience_id=i.Identity;break;case me.IdentityType.Google:t.google=i.Identity;break;case me.IdentityType.Microsoft:t.microsoft=i.Identity;break;case me.IdentityType.Other:t.other=i.Identity;break;case me.IdentityType.Other2:t.other_id_2=i.Identity;break;case me.IdentityType.Other3:t.other_id_3=i.Identity;break;case me.IdentityType.Other4:t.other_id_4=i.Identity;break;case me.IdentityType.Other5:t.other_id_5=i.Identity;break;case me.IdentityType.Other6:t.other_id_6=i.Identity;break;case me.IdentityType.Other7:t.other_id_7=i.Identity;break;case me.IdentityType.Other8:t.other_id_8=i.Identity;break;case me.IdentityType.Other9:t.other_id_9=i.Identity;break;case me.IdentityType.Other10:t.other_id_10=i.Identity;break;case me.IdentityType.MobileNumber:t.mobile_number=i.Identity;break;case me.IdentityType.PhoneNumber2:t.phone_number_2=i.Identity;break;case me.IdentityType.PhoneNumber3:t.phone_number_3=i.Identity}}return t}function Ze(e){if(!e)return null;switch(e.EventDataType){case me.MessageType.AppStateTransition:return function(e){var t=at(e),n=He.ApplicationStateTransitionEventDataApplicationTransitionTypeEnum,r=n.applicationBackground,i=n.applicationInitialized,o=e.IsBackgroundAST?r:i,s={application_transition_type:o,is_first_run:e.IsFirstRun,is_upgrade:!1,launch_referral:e.LaunchReferral};return s=Object.assign(s,t),{event_type:He.EventTypeEnum.applicationStateTransition,data:s}}(e);case me.MessageType.Commerce:return function(e){var t=at(e),n={custom_flags:e.CustomFlags,product_action:tt(e),promotion_action:rt(e),product_impressions:ot(e),currency_code:e.CurrencyCode};return n=Object.assign(n,t),{event_type:He.EventTypeEnum.commerceEvent,data:n}}(e);case me.MessageType.CrashReport:return function(e){var t=at(e),n={message:e.EventName};return n=Object.assign(n,t),{event_type:He.EventTypeEnum.crashReport,data:n}}(e);case me.MessageType.OptOut:return function(e){var t=at(e),n={is_opted_out:e.OptOut};return n=Object.assign(n,t),{event_type:He.EventTypeEnum.optOut,data:n}}(e);case me.MessageType.PageEvent:return function(e){var t=at(e),n={custom_event_type:st(e.EventCategory),custom_flags:e.CustomFlags,event_name:e.EventName};return n=Object.assign(n,t),{event_type:He.EventTypeEnum.customEvent,data:n}}(e);case me.MessageType.PageView:return function(e){var t=at(e),n={custom_flags:e.CustomFlags,screen_name:e.EventName};return n=Object.assign(n,t),{event_type:He.EventTypeEnum.screenView,data:n}}(e);case me.MessageType.Profile:return null;case me.MessageType.SessionEnd:return function(e){var t=at(e),n={session_duration_ms:e.SessionLength};return n=Object.assign(n,t),{event_type:He.EventTypeEnum.sessionEnd,data:n}}(e);case me.MessageType.SessionStart:return function(e){var t=at(e),n={};return n=Object.assign(n,t),{event_type:He.EventTypeEnum.sessionStart,data:n}}(e);case me.MessageType.UserAttributeChange:return function(e){var t=at(e),n={user_attribute_name:e.UserAttributeChanges.UserAttributeName,new:e.UserAttributeChanges.New,old:e.UserAttributeChanges.Old,deleted:e.UserAttributeChanges.Deleted,is_new_attribute:e.UserAttributeChanges.IsNewAttribute};return n=p(p({},n),t),{event_type:He.EventTypeEnum.userAttributeChange,data:n}}(e);case me.MessageType.UserIdentityChange:return function(e){var t=at(e),n={new:{identity_type:ct(e.UserIdentityChanges.New.IdentityType),identity:e.UserIdentityChanges.New.Identity||null,timestamp_unixtime_ms:e.Timestamp,created_this_batch:e.UserIdentityChanges.New.CreatedThisBatch},old:{identity_type:ct(e.UserIdentityChanges.Old.IdentityType),identity:e.UserIdentityChanges.Old.Identity||null,timestamp_unixtime_ms:e.Timestamp,created_this_batch:e.UserIdentityChanges.Old.CreatedThisBatch}};return n=Object.assign(n,t),{event_type:He.EventTypeEnum.userIdentityChange,data:n}}(e)}return null}function et(e){if(!e)return He.ProductActionActionEnum.unknown;switch(e){case fe.AddToCart:return He.ProductActionActionEnum.addToCart;case fe.AddToWishlist:return He.ProductActionActionEnum.addToWishlist;case fe.Checkout:return He.ProductActionActionEnum.checkout;case fe.CheckoutOption:return He.ProductActionActionEnum.checkoutOption;case fe.Click:return He.ProductActionActionEnum.click;case fe.Purchase:return He.ProductActionActionEnum.purchase;case fe.Refund:return He.ProductActionActionEnum.refund;case fe.RemoveFromCart:return He.ProductActionActionEnum.removeFromCart;case fe.RemoveFromWishlist:return He.ProductActionActionEnum.removeFromWishlist;case fe.ViewDetail:return He.ProductActionActionEnum.viewDetail;default:return He.ProductActionActionEnum.unknown}}function tt(e){return e.ProductAction?{action:et(e.ProductAction.ProductActionType),checkout_step:e.ProductAction.CheckoutStep,checkout_options:e.ProductAction.CheckoutOptions,transaction_id:e.ProductAction.TransactionId,affiliation:e.ProductAction.Affiliation,total_amount:e.ProductAction.TotalAmount,tax_amount:e.ProductAction.TaxAmount,shipping_amount:e.ProductAction.ShippingAmount,coupon_code:e.ProductAction.CouponCode,products:nt(e.ProductAction.ProductList)}:null}function nt(e){if(!e||!e.length)return null;for(var t=[],n=0,r=e;n<r.length;n++){var i=r[n],o={id:i.Sku,name:i.Name,brand:i.Brand,category:i.Category,variant:i.Variant,total_product_amount:i.TotalAmount,position:i.Position,price:i.Price,quantity:i.Quantity,coupon_code:i.CouponCode,custom_attributes:i.Attributes};t.push(o)}return t}function rt(e){return e.PromotionAction?{action:e.PromotionAction.PromotionActionType,promotions:it(e.PromotionAction.PromotionList)}:null}function it(e){if(!e||!e.length)return null;for(var t=[],n=0,r=e;n<r.length;n++){var i=r[n],o={id:i.Id,name:i.Name,creative:i.Creative,position:i.Position};t.push(o)}return t}function ot(e){if(!e.ProductImpressions)return null;for(var t=[],n=0,r=e.ProductImpressions;n<r.length;n++){var i=r[n],o={product_impression_list:i.ProductImpressionList,products:nt(i.ProductList)};t.push(o)}return t}function st(e){switch(e){case me.EventType.Other:return He.CustomEventDataCustomEventTypeEnum.other;case me.EventType.Location:return He.CustomEventDataCustomEventTypeEnum.location;case me.EventType.Navigation:return He.CustomEventDataCustomEventTypeEnum.navigation;case me.EventType.Search:return He.CustomEventDataCustomEventTypeEnum.search;case me.EventType.Social:return He.CustomEventDataCustomEventTypeEnum.social;case me.EventType.Transaction:return He.CustomEventDataCustomEventTypeEnum.transaction;case me.EventType.UserContent:return He.CustomEventDataCustomEventTypeEnum.userContent;case me.EventType.UserPreference:return He.CustomEventDataCustomEventTypeEnum.userPreference;case me.EventType.Media:return He.CustomEventDataCustomEventTypeEnum.media;case me.CommerceEventType.ProductAddToCart:return He.CommerceEventDataCustomEventTypeEnum.addToCart;case me.CommerceEventType.ProductAddToWishlist:return He.CommerceEventDataCustomEventTypeEnum.addToWishlist;case me.CommerceEventType.ProductCheckout:return He.CommerceEventDataCustomEventTypeEnum.checkout;case me.CommerceEventType.ProductCheckoutOption:return He.CommerceEventDataCustomEventTypeEnum.checkoutOption;case me.CommerceEventType.ProductClick:return He.CommerceEventDataCustomEventTypeEnum.click;case me.CommerceEventType.ProductImpression:return He.CommerceEventDataCustomEventTypeEnum.impression;case me.CommerceEventType.ProductPurchase:return He.CommerceEventDataCustomEventTypeEnum.purchase;case me.CommerceEventType.ProductRefund:return He.CommerceEventDataCustomEventTypeEnum.refund;case me.CommerceEventType.ProductRemoveFromCart:return He.CommerceEventDataCustomEventTypeEnum.removeFromCart;case me.CommerceEventType.ProductRemoveFromWishlist:return He.CommerceEventDataCustomEventTypeEnum.removeFromWishlist;case me.CommerceEventType.ProductViewDetail:return He.CommerceEventDataCustomEventTypeEnum.viewDetail;case me.CommerceEventType.PromotionClick:return He.CommerceEventDataCustomEventTypeEnum.promotionClick;case me.CommerceEventType.PromotionView:return He.CommerceEventDataCustomEventTypeEnum.promotionView;default:return He.CustomEventDataCustomEventTypeEnum.unknown}}function at(e){return{timestamp_unixtime_ms:e.Timestamp,session_uuid:e.SessionId,session_start_unixtime_ms:e.SessionStartDate,custom_attributes:e.EventAttributes,location:ut(e.Location),source_message_id:e.SourceMessageId,active_time_on_site_ms:e.ActiveTimeOnSite,total_time_on_site_ms:e.TotalTimeOnSite,page_url:e.PageUrl}}function ut(e){return e&&Object.keys(e).length?{latitude:e.lat,longitude:e.lng}:null}function ct(e){switch(e){case Ne.other:return He.IdentityTypeEnum.other;case Ne.customerId:return He.IdentityTypeEnum.customerId;case Ne.facebook:return He.IdentityTypeEnum.facebook;case Ne.twitter:return He.IdentityTypeEnum.twitter;case Ne.google:return He.IdentityTypeEnum.google;case Ne.microsoft:return He.IdentityTypeEnum.microsoft;case Ne.yahoo:return He.IdentityTypeEnum.yahoo;case Ne.email:return He.IdentityTypeEnum.email;case Ne.alias:return He.IdentityTypeEnum.alias;case Ne.facebookCustomAudienceId:return He.IdentityTypeEnum.facebookCustomAudienceId;case Ne.otherId2:return He.IdentityTypeEnum.otherId2;case Ne.otherId3:return He.IdentityTypeEnum.otherId3;case Ne.otherId4:return He.IdentityTypeEnum.otherId4;case Ne.otherId5:return He.IdentityTypeEnum.otherId5;case Ne.otherId6:return He.IdentityTypeEnum.otherId6;case Ne.otherId7:return He.IdentityTypeEnum.otherId7;case Ne.otherId8:return He.IdentityTypeEnum.otherId8;case Ne.otherId9:return He.IdentityTypeEnum.otherId9;case Ne.otherId10:return He.IdentityTypeEnum.otherId10;case Ne.mobileNumber:return He.IdentityTypeEnum.mobileNumber;case Ne.phoneNumber2:return He.IdentityTypeEnum.phoneNumber2;case Ne.phoneNumber3:return He.IdentityTypeEnum.phoneNumber3}}var lt,dt=["pushState","replaceState"],pt="__mpApvWrapped__",gt=function(e){return!!e&&void 0!==e.history&&"function"==typeof e.history.pushState&&"function"==typeof e.addEventListener},ht="__mpRouteMonitor__",vt=function(){var e=window;return e[ht]||(e[ht]={listeners:{},undoHistoryPatch:null,popStateListener:null}),e[ht]},ft=function(e){Object.values(vt().listeners).forEach((function(t){try{t(e)}catch(e){}}))},mt=function(e,t){e.undoHistoryPatch||e.popStateListener||(e.undoHistoryPatch=function(e,t){if(window.history.pushState[pt])return t("[patch] history already wrapped, skipping to avoid double-wrap \u2014 STACKED WRAPPER DETECTED"),null;var n={},r={};dt.forEach((function(t){var i=window.history[t];n[t]=i;var o=function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];var o=i.apply(this,n);return e(t),o};Object.defineProperty(o,pt,{value:!0,enumerable:!1}),r[t]=o}));var i=function(){return dt.forEach((function(e){window.history[e]===r[e]?(window.history[e]=n[e],t("[teardown] restored original ".concat(e))):t("[teardown] ".concat(e," no longer ours; leaving in place, gating callback to no-op"))}))};try{dt.forEach((function(e){window.history[e]=r[e]}))}catch(e){t("[error] failed to patch history methods (frozen/sealed), rolling back: ".concat(e));try{i()}catch(e){t("[error] failed to restore history methods after patch failure: ".concat(e))}return null}return i}(ft,t),e.popStateListener=function(){return ft("popstate")},window.addEventListener("popstate",e.popStateListener))},yt=function(e,t,n){if(void 0===n&&(n=function(){}),!gt("undefined"==typeof window?null:window))return function(){};var r=vt();return r.listeners[e]=t,mt(r,n),function(){r.listeners[e]===t&&(delete r.listeners[e],0===Object.keys(r.listeners).length&&function(e){e.popStateListener&&(window.removeEventListener("popstate",e.popStateListener),e.popStateListener=null),e.undoHistoryPatch&&(e.undoHistoryPatch(),e.undoHistoryPatch=null)}(r))}},bt="__mpApv__",St=["page","limit","offset","cursor","per_page","q","s","oq","search","query","keyword","keywords","term","text","searchTerm","searchText","search_query","search_text","Ntt","pid","productId","sku","skuId","variant","color","colour","size","category","ref","referrer"],It="is_auto_page_view",_t=["hostname","title","path",It].concat(["constructor","__proto__","prototype"],["true","false"]),wt=St.map((function(e){return e.toLowerCase()})),Pt=function(e){return-1!==wt.indexOf(e.toLowerCase())},Ct=/^[a-z0-9_][a-z0-9_.-]{0,63}$/,At=["dwvar_"],Tt=function(e){return At.some((function(t){return 0===e.indexOf(t)}))},kt=function(e){var t=[],n=[],r=0;return e?((Array.isArray(e)?e:String(e).split(",")).forEach((function(e,i){var o=i+1,s=String(e).trim().toLowerCase();s&&(Ct.test(s)&&-1===_t.indexOf(s)?Pt(s)||-1!==t.indexOf(s)||(t.length>=25?r++:t.push(s)):n.push(o))})),{allowed:t,rejectedPositions:n,overLimit:r}):{allowed:t,rejectedPositions:n,overLimit:r}},Et=function(e,t){return e<t?-1:e>t?1:0},Dt=function(e,t){void 0===t&&(t=[]);var n=function(e){return void 0===e&&(e=[]),St.concat(e.filter((function(e){return!Pt(e)})).sort(Et))}(t),r=$(e,n);return n.filter((function(e){return W(r,e)})).filter((function(e){return function(e,t){return Pt(e)||t.length<=512}(e,r[e])})).map((function(e){return{name:e,value:r[e]}})).concat(function(e,t){var n=$(e);return Object.keys(n).filter((function(e){return Tt(e)&&n[e]&&-1===t.indexOf(e)})).sort(Et).map((function(e){return{name:e,value:n[e]}}))}(e,n))},Ot=function(e){var t={};return e.forEach((function(e){var n=e.name,r=e.value;t[n]=r})),t},Mt=function(e){var t;return e?((t={})[It]=!0,t):{}},Lt=function(e){var t=e.params.map((function(e){var t=e.name,n=e.value;return"".concat(t,"=").concat(encodeURIComponent(n))})).join("&");return t?"".concat(e.path,"?").concat(t):e.path},Ft=function(){return"undefined"==typeof window?null:window},Ut=function(){var e=Ft();return e?e[bt]:void 0},Nt=function(){var e=Ft();return e?(e[bt]||(e[bt]={initialPageViewFired:!1}),e[bt]):null},Rt=function(){var e=Ut();return e?e.tracker:void 0},Vt=function(){var e=Ut();return!(!e||!e.initialPageViewFired)},xt=function(){var e=Nt();e&&(e.initialPageViewFired=!0)},Ht=function(){var e=Ft();if(e){var t=Rt();t&&t.teardown(),e[bt]={initialPageViewFired:!1}}},Kt=function(e){return{path:window.location.pathname,params:Dt(X(),e)}},Bt=function(e){if(!e)return"";var t=e.params.map((function(e){return e.name}));return t.length?"".concat(e.path," (params: ").concat(t.join(),")"):e.path},qt=function(){function e(e,t){this.lastPage=null,this.active=!1,this.customQueryParams=[],this.pendingNavigations=[],this.undoHistoryPatch=null,this.mpInstance=e,this.isAutoPageView=!(!t||!t.isAutoPageView)}return Object.defineProperty(e.prototype,"isActive",{get:function(){return this.active},enumerable:!1,configurable:!0}),e.prototype.init=function(){var e=this;if(this.log("[init] PageViewTracker Init"),gt(Ft())){var t,n,r=Rt(),i=this.retire(r);this.active&&r!==this&&(i=i.concat(this.retire(this))),this.active=!0,this.customQueryParams=this.readCustomQueryParams(),this.lastPage=Kt(this.customQueryParams),this.log("[init] seeded lastPage: ".concat(Bt(this.lastPage))),this.undoHistoryPatch=yt("pageView",(function(t){return e.safeHandleNavigation(t)}),(function(t){return e.log(t)})),t=this,(n=Nt())&&(n.tracker=t),this.log("[init] patched pushState/replaceState + listening for popstate"),i.forEach((function(t){return e.scheduleFire(t)}))}else this.log("[init] unsupported environment (no History API), not starting")},e.prototype.teardown=function(){var e,t;this.takePendingNavigations(),this.undoHistoryPatch&&(this.undoHistoryPatch(),this.undoHistoryPatch=null),this.active=!1,e=this,(t=Ut())&&t.tracker===e&&(t.tracker=void 0)},e.prototype.readCustomQueryParams=function(){var e=this.mpInstance._Store.SDKConfig.autoLogPageViewQueryParams||{},t=e.allowed,n=void 0===t?[]:t,r=e.rejectedPositions,i=void 0===r?[]:r,o=e.overLimit,s=void 0===o?0:o;return i.length&&this.mpInstance.Logger.warning("mParticle APV: ignoring invalid additional page view query "+"parameters at positions ".concat(i.join(", "))),s&&this.mpInstance.Logger.warning("mParticle APV: ignoring ".concat(s," additional page view ")+"query parameters beyond the limit of "+"".concat(25)),n.length&&this.log("[init] additional query params: ".concat(n.join())),n},e.prototype.retire=function(e){if(!e)return[];this.log(e===this?"[init] retiring this tracker for a repeat mParticle.init() \u2014 transferring pending navigations and tearing down":"[init] retiring a tracker from a previous module load \u2014 transferring pending navigations and tearing down");var t=e.takePendingNavigations();return e.teardown(),t},e.prototype.takePendingNavigations=function(){var e=this.pendingNavigations;return this.pendingNavigations=[],e.forEach((function(e){var t=e.timeoutId;return clearTimeout(t)})),e.map((function(e){return e.page}))},e.prototype.safeHandleNavigation=function(e){if(this.active)try{this.handleNavigation(e)}catch(t){this.log("[error] navigation handler threw (".concat(e,"), page view skipped: ").concat(t))}},e.prototype.handleNavigation=function(e){var t=Kt(this.customQueryParams),n=this.lastPage?Lt(this.lastPage):null;this.log("[detect] navigation signal (source: ".concat(e,", candidate: ").concat(Bt(t),", last: ").concat(Bt(this.lastPage),")")),function(e,t){return t!==e}(n,Lt(t))?(this.log("[accept] page changed, scheduling fire (source: ".concat(e,", from: ").concat(Bt(this.lastPage),", to: ").concat(Bt(t),")")),this.lastPage=t,this.scheduleFire(t)):this.log("[dedupe] page unchanged, skipping (source: ".concat(e,", page: ").concat(Bt(t),")"))},e.prototype.scheduleFire=function(e){var t=this,n=setTimeout((function(){t.pendingNavigations=t.pendingNavigations.filter((function(e){return e.timeoutId!==n})),t.active?(t.mpInstance._SessionManager.resetSessionTimer(),t.firePageView(e)):t.log("[defer] fire aborted, tracker inactive (torn down before flush)")}),0);this.pendingNavigations.push({page:e,timeoutId:n})},e.prototype.firePageView=function(e){var t=window.document.title,n=function(e){var t=e.params,n=e.hostname,r=e.title,i=e.path,o=e.isAutoPageView;return{messageType:oe.PageView,name:"PageView",data:p(p(p({},Ot(t)),{hostname:n,title:r,path:i}),Mt(o)),eventType:se.Unknown}}(p(p({},e),{hostname:window.location.hostname,title:t,isAutoPageView:this.isAutoPageView}));this.log("[fire] deferred flush -> _Events.logEvent(PageView) (page: ".concat(Bt(e),", title: ").concat(t,")")),this.mpInstance._Events.logEvent(n)},e.prototype.log=function(e){this.mpInstance.Logger.verbose("mParticle APV: ".concat(e))},e}(),jt="path",zt="full",Qt=["utm_source","utm_medium","utm_campaign","utm_term","utm_content","utm_id","utm_source_platform","utm_creative_format","utm_marketing_tactic","gad_source","gad_campaignid","mc_cid","gclid","gbraid","wbraid","fbclid","msclkid","ttclid","twclid","li_fat_id","dclid","srsltid","epik","ScCid","irclickid","rtid","rclid"].map((function(e){return e.toLowerCase()})),Wt=function(e){return function(e){return Pt(e)||Tt(e.toLowerCase())}(e)||-1!==Qt.indexOf(e.toLowerCase())},Jt=["client_id","redirect_uri","response_type","scope","state","code","nonce"],Gt=Jt.concat(["access_token","id_token","refresh_token","provider_token","provider_refresh_token"]),$t=["ref","referrer"],Yt=/^((?:[a-z][a-z0-9+.-]*:)?\/\/)[^/]*@/i,Xt=function(e){return decodeURIComponent(e.replace(/\+/g," "))},Zt=function(e){var t,n=e.indexOf("="),r=-1===n?e:e.slice(0,n);try{t=Xt(r)}catch(e){return null}var i,o=t.toLowerCase();if(!t||!Wt(t)||-1!==Jt.indexOf(o))return null;if(-1===n||-1===$t.indexOf(o))return e;try{i=Xt(e.slice(n+1))}catch(e){return null}var s=nn(i,jt);return s===i?e:"".concat(r,"=").concat(encodeURIComponent(s))},en=function(e){return e.split("&").map(Zt).filter((function(e){return null!==e})).join("&")},tn=function(e){try{var t=Xt(e.split("=")[0]);return-1===Gt.indexOf(t.toLowerCase())}catch(e){return!1}},nn=function(e,t){if("string"!=typeof e||!e)return"";var n=e.indexOf("#"),r=-1===n?"":e.slice(n),i=-1===n?e:e.slice(0,n),o=i.indexOf("?"),s=(-1===o?i:i.slice(0,o)).replace(Yt,"$1");if(t!==zt)return s;var a=-1===o?"":en(i.slice(o+1));return s+(a?"?".concat(a):"")+function(e){var t=e.indexOf("?"),n=-1===t?e:e.slice(0,t);if((/^#[/!]/.test(e)||-1!==t&&-1===n.indexOf("="))&&-1!==t){var r=en(e.slice(t+1));return n+(r?"?".concat(r):"")}if(-1===e.indexOf("="))return e;var i=e.slice(1).split("&").filter(tn).join("&");return i?"#".concat(i):""}(r)},rn=function(){return nn(X(),zt)};!function(e){e.Success="Success",e.QuotaExceeded="QuotaExceeded",e.Unavailable="Unavailable"}(lt||(lt={}));var on=function(){function e(e,t){this._storageKey=e,this.storageObject=t,this.contents=this.retrieve()}return e.prototype.store=function(e){var t;try{return t=H(e)||!z(e)?JSON.stringify(e):"",this.storageObject.setItem(this._storageKey,t),this.contents=e,lt.Success}catch(e){return function(e){return e instanceof DOMException&&(22===e.code||1014===e.code||"QuotaExceededError"===e.name||"NS_ERROR_DOM_QUOTA_REACHED"===e.name)}(e)?lt.QuotaExceeded:lt.Unavailable}},e.prototype.retrieve=function(){try{var e=this.storageObject.getItem(this._storageKey);this.contents=e?JSON.parse(e):null}catch(e){this.contents=null}return this.contents},e.prototype.purge=function(){this.contents=null;try{this.storageObject.removeItem(this._storageKey)}catch(e){}},e}(),sn=function(e){function t(t){return e.call(this,t,window.localStorage)||this}return d(t,e),t}(on),an=function(e){function t(t){return e.call(this,t,window.sessionStorage)||this}return d(t,e),t}(on),un=function(e){function t(t){var n=e.call(this,t,window.localStorage)||this;return n.contents=null,n.storageObject.removeItem(n._storageKey),n}return d(t,e),t.prototype.store=function(e){return this.contents=null,lt.Success},t.prototype.retrieve=function(){return this.contents},t.prototype.purge=function(){this.contents=null},t}(on),cn=function(e){this.url=e},ln=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return d(t,e),t.prototype.upload=function(e,t){return g(this,void 0,void 0,(function(){var n;return h(this,(function(r){switch(r.label){case 0:return n=t||this.url,[4,fetch(n,e)];case 1:return[2,r.sent()]}}))}))},t}(cn),dn=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return d(t,e),t.prototype.upload=function(e){return g(this,void 0,void 0,(function(){return h(this,(function(t){switch(t.label){case 0:return[4,this.makeRequest(this.url,e.body,e.method,e.headers)];case 1:return[2,t.sent()]}}))}))},t.prototype.makeRequest=function(e,t,n,r){return void 0===n&&(n="post"),void 0===r&&(r={}),g(this,void 0,void 0,(function(){var i;return h(this,(function(o){return i=new XMLHttpRequest,[2,new Promise((function(o,s){for(var a in i.onreadystatechange=function(){4===i.readyState&&o(i)},i.onerror=function(){s(i)},i.open(n,e),r)r.hasOwnProperty(a)&&i.setRequestHeader(a,r[a]);i.send(t)}))]}))}))},t}(cn);function pn(e,t){if(t){if(!e)return t.MPID=null,t.ConsentState=null,t.UserAttributes=null,void(t.UserIdentities=null);if(!t.MPID||t.MPID!==e.getMPID()){t.MPID=e.getMPID(),t.ConsentState=e.getConsentState(),t.UserAttributes=e.getAllUserAttributes();var n=e.getUserIdentities().userIdentities,r={};for(var i in n){var o=me.IdentityType.getIdentityType(i);!1!==o&&(r[o]=n[i])}var s=[];if(P(r)&&Object.keys(r).length)for(var a in r){var u={};u.Identity=r[a],u.Type=C(a),s.push(u)}t.UserIdentities=s}}}var gn=function(){function e(t,n){var r,i,o;this.offlineStorageEnabled=!1,this.lastASTEventTime=0,this.AST_DEBOUNCE_MS=1e3,this.uploadIntervalTimerId=null,this.exitHandler=null,this.visibilityChangeHandler=null,this.destroyed=!1,this.batchOrder=new Map,this.nextBatchOrder=0,this.mpInstance=t,this.uploadIntervalMillis=n,this.batchingEnabled=n>=e.MINIMUM_INTERVAL_MILLIS,this.uploadIntervalMillis<e.MINIMUM_INTERVAL_MILLIS&&(this.uploadIntervalMillis=e.MINIMUM_INTERVAL_MILLIS),this.eventsQueuedForProcessing=[],this.batchesQueuedForProcessing=[],this.offlineStorageEnabled=this.isOfflineStorageAvailable();var s=null===(i=t._CookieConsentManager)||void 0===i?void 0:i.getNoFunctional();this.offlineStorageEnabled&&!s&&(this.eventVault=new an("".concat(t._Store.storageName,"-events")),this.batchVault=new sn("".concat(t._Store.storageName,"-batches")),(r=this.eventsQueuedForProcessing).push.apply(r,null!==(o=this.eventVault.retrieve())&&void 0!==o?o:[]));var a=this.mpInstance._Store,u=a.SDKConfig,c=a.devToken,l=this.mpInstance._Helpers.createServiceUrl(u.v3SecureServiceUrl,c);this.uploadUrl="".concat(l,"/events"),this.uploader=window.fetch?new ln(this.uploadUrl):new dn(this.uploadUrl),this.triggerUploadInterval(!0,!1),this.addEventListeners()}return e.prototype.destroy=function(){this.destroyed=!0,null!==this.uploadIntervalTimerId&&(clearTimeout(this.uploadIntervalTimerId),this.uploadIntervalTimerId=null),this.visibilityChangeHandler&&document.removeEventListener("visibilitychange",this.visibilityChangeHandler),this.exitHandler&&(window.removeEventListener("beforeunload",this.exitHandler),window.removeEventListener("pagehide",this.exitHandler)),this.exitHandler=null,this.visibilityChangeHandler=null},e.prototype.isOfflineStorageAvailable=function(){var e=this.mpInstance,t=e._Helpers.getFeatureFlag,n=e._Store.deviceId,i=t(r.FeatureFlags.OfflineStorage);return parseInt(i,10)>=function(e){if(!e)return 100;var t=_(e);return Math.abs(t%100)+1}(n)},e.prototype.shouldDebounceAndUpdateLastASTTime=function(){var e=Date.now();return e-this.lastASTEventTime<this.AST_DEBOUNCE_MS||(this.lastASTEventTime=e,!1)},e.prototype.createBackgroundASTEvent=function(){var e,t=Date.now(),n=this.mpInstance,i=n._Store,o=n.Identity,s=n._timeOnSiteTimer,a=n._Helpers,u=i.sessionId,c=i.deviceId,l=i.sessionStartDate,d=i.SDKConfig,g=a.generateUniqueId,h=a.getFeatureFlag,v=o.getCurrentUser,f={AppName:d.appName,AppVersion:d.appVersion,Package:d.package,EventDataType:oe.AppStateTransition,Timestamp:t,SessionId:u,DeviceId:c,IsFirstRun:!1,SourceMessageId:g(),SDKVersion:r.sdkVersion,CustomFlags:{},EventAttributes:{},SessionStartDate:(null==l?void 0:l.getTime())||t,Debug:d.isDevelopmentMode,ActiveTimeOnSite:(null==s?void 0:s.getTimeInForeground())||0,TotalTimeOnSite:(null===(e=i.getTotalTimeOnSite)||void 0===e?void 0:e.call(i))||0,PageUrl:rn()||null,IsBackgroundAST:!0},m=p({},f.CustomFlags),y=i.integrationAttributes;if(Qe(h)){this.mpInstance._IntegrationCapture.capture();var b=this.mpInstance._IntegrationCapture.getClickIdsAsCustomFlags();m=p(p({},b),m);var S=this.mpInstance._IntegrationCapture.getClickIdsAsIntegrationAttributes();y=p(p({},S),y)}return f.CustomFlags=m,f.IntegrationAttributes=y,pn(v(),f),f},e.prototype.addEventListeners=function(){var e=this,t=this,n=function(){if((0,e.mpInstance._Helpers.getFeatureFlag)(r.FeatureFlags.AstBackgroundEvents)){if(t.shouldDebounceAndUpdateLastASTTime())return;var n=t.createBackgroundASTEvent();t.queueEvent(n)}t.prepareAndUpload(!1,t.isBeaconAvailable())};this.exitHandler=n,this.visibilityChangeHandler=function(){"hidden"===document.visibilityState&&n()},document.addEventListener("visibilitychange",this.visibilityChangeHandler),window.addEventListener("beforeunload",n),window.addEventListener("pagehide",n)},e.prototype.isBeaconAvailable=function(){return!!navigator.sendBeacon},e.prototype.triggerUploadInterval=function(e,t){var n=this;void 0===e&&(e=!1),void 0===t&&(t=!1),this.uploadIntervalTimerId=setTimeout((function(){n.prepareAndUpload(e,t)}),this.uploadIntervalMillis)},e.prototype.queueEvent=function(e){if(!z(e)){if(this.eventsQueuedForProcessing.push(e),this.offlineStorageEnabled&&this.eventVault&&this.eventVault.store(this.eventsQueuedForProcessing),this.mpInstance.Logger.isVerbose()){var t=ne(e,this.mpInstance._Store.SDKConfig.isDevelopmentMode);this.mpInstance.Logger.verbose("Queuing event: ".concat(JSON.stringify(t))),this.mpInstance.Logger.verbose("Queued event count: ".concat(this.eventsQueuedForProcessing.length))}this.shouldTriggerImmediateUpload(e.EventDataType)&&this.prepareAndUpload(!1,!1)}},e.prototype.shouldTriggerImmediateUpload=function(e){var t=[oe.Commerce,oe.UserIdentityChange];return!this.batchingEnabled||t.includes(e)},e.createNewBatches=function(e,t,n){if(!t||!e||!e.length)return null;for(var r=[],i=new Map,o=0,s=e;o<s.length;o++){if(!(f=s[o]).MPID){var a=t.getMPID();f.MPID=a}(v=i.get(f.MPID))||(v=[]),v.push(f),i.set(f.MPID,v)}for(var u=0,c=Array.from(i.entries());u<c.length;u++){for(var l=c[u],d=(a=l[0],l[1]),p=new Map,g=0,h=d;g<h.length;g++){var v,f=h[g];(v=p.get(f.SessionId))||(v=[]),v.push(f),p.set(f.SessionId,v)}for(var m=0,y=Array.from(p.entries());m<y.length;m++){var b=Je(a,y[m][1],n),S=n._Store.SDKConfig.onCreateBatch;S&&((b=S(b))?b.modified=!0:n.Logger.warning("Skiping batch upload because no batch was returned from onCreateBatch callback")),b&&r.push(b)}}return r},e.prototype.prepareAndUpload=function(t,n){var r;return void 0===t&&(t=!1),void 0===n&&(n=!1),g(this,void 0,void 0,(function(){var i,o,s,a,u,c,l,d,p,g=this;return h(this,(function(h){switch(h.label){case 0:return i=this.mpInstance.Identity.getCurrentUser(),o=this.eventsQueuedForProcessing,this.eventsQueuedForProcessing=[],this.offlineStorageEnabled&&this.eventVault&&this.eventVault.store([]),s=[],z(o)||(s=e.createNewBatches(o,i,this.mpInstance)),this.offlineStorageEnabled&&this.batchVault&&((l=this.batchesQueuedForProcessing).unshift.apply(l,null!==(r=this.batchVault.retrieve())&&void 0!==r?r:[]),this.batchVault.purge()),z(s)||(d=this.batchesQueuedForProcessing).push.apply(d,s),a=this.batchesQueuedForProcessing,this.batchesQueuedForProcessing=[],a.forEach((function(e){g.batchOrder.has(e.source_request_id)||g.batchOrder.set(e.source_request_id,g.nextBatchOrder++)})),[4,this.uploadBatches(a,n)];case 1:return u=h.sent(),c=(u||[]).map((function(e){return e.source_request_id})),a.forEach((function(e){-1===c.indexOf(e.source_request_id)&&g.batchOrder.delete(e.source_request_id)})),z(u)||(p=this.batchesQueuedForProcessing).unshift.apply(p,u),!n&&this.offlineStorageEnabled&&this.batchVault&&this.storeBatchesQueuedForProcessing(),t&&!this.destroyed&&this.triggerUploadInterval(t,!1),[2]}}))}))},e.prototype.storeBatchesQueuedForProcessing=function(){var e,t=this,n=function(e){var n;return null!==(n=t.batchOrder.get(e.source_request_id))&&void 0!==n?n:-1},r=v(v([],this.batchesQueuedForProcessing,!0),null!==(e=this.batchVault.retrieve())&&void 0!==e?e:[],!0).sort((function(e,t){var r,i;return n(e)-n(t)||(null!==(r=e.timestamp_unixtime_ms)&&void 0!==r?r:0)-(null!==(i=t.timestamp_unixtime_ms)&&void 0!==i?i:0)}));if(z(r))return this.batchVault.store([]),void(this.batchesQueuedForProcessing=[]);for(var i=0;i<r.length;i++){var o=this.batchVault.store(r.slice(i));if(o===lt.Success)return this.logDroppedOfflineBatches(i),void(this.batchesQueuedForProcessing=[]);if(o===lt.Unavailable)return void this.mpInstance.Logger.warning("Offline batch storage is unavailable. Retaining batches in memory.")}this.mpInstance.Logger.warning("Offline batch storage is over quota. Retaining batches in memory.")},e.prototype.logDroppedOfflineBatches=function(e){e>0&&this.mpInstance.Logger.warning("Offline batch storage is over quota. Dropped "+"".concat(e," oldest batch(es)."))},e.prototype.uploadBatches=function(t,n){return g(this,void 0,void 0,(function(){var r,i,o,s,a,u,c;return h(this,(function(l){switch(l.label){case 0:if(r=t.filter((function(e){return!z(e.events)})),z(r))return[2,null];this.mpInstance.Logger.isVerbose()&&(i=ne(r,this.mpInstance._Store.SDKConfig.isDevelopmentMode),this.mpInstance.Logger.verbose("Uploading batches: ".concat(JSON.stringify(i))),this.mpInstance.Logger.verbose("Batch count: ".concat(r.length))),o=0,l.label=1;case 1:return o<r.length?(s={method:"POST",headers:{Accept:e.CONTENT_TYPE,"Content-Type":"text/plain;charset=UTF-8"},body:JSON.stringify(r[o])},n&&this.isBeaconAvailable()?(a=new Blob([s.body],{type:"text/plain;charset=UTF-8"}),navigator.sendBeacon(this.uploadUrl,a),[3,5]):[3,2]):[3,6];case 2:return l.trys.push([2,4,,5]),[4,this.uploader.upload(s)];case 3:if(!((u=l.sent()).status>=200&&u.status<300)){if(u.status>=500||429===u.status)return this.mpInstance.Logger.error("HTTP error status ".concat(u.status," received")),[2,r.slice(o,r.length)];if(u.status>=401)return this.mpInstance.Logger.error("HTTP error status ".concat(u.status," while uploading - please verify your API key.")),[2,null];throw console.error("HTTP error status ".concat(u.status," while uploading events."),u),new Error("Uncaught HTTP Error ".concat(u.status,". Batch upload will be re-attempted."))}return this.mpInstance.Logger.verbose("Upload success for request ID: ".concat(r[o].source_request_id)),[3,5];case 4:return c=l.sent(),this.mpInstance.Logger.error("Error sending event to mParticle servers. ".concat(c)),[2,r.slice(o,r.length)];case 5:return o++,[3,1];case 6:return[2,null]}}))}))},e.CONTENT_TYPE="text/plain;charset=UTF-8",e.MINIMUM_INTERVAL_MILLIS=500,e}(),hn={UNKNOWN_ERROR:"UNKNOWN_ERROR",UNHANDLED_EXCEPTION:"UNHANDLED_EXCEPTION",IDENTITY_REQUEST:"IDENTITY_REQUEST",IDENTITY_MISMATCH:"IDENTITY_MISMATCH",MP_DEPRECATED_METHOD_USAGE:"MP_DEPRECATED_METHOD_USAGE"},vn={ERROR:"ERROR",INFO:"INFO",WARNING:"WARNING"},fn=r.IdentityMethods.Modify,mn={isNumber:H,isFunction:K,isStringOrNumber:j,isValidAttributeValue:function(e){return void 0!==e&&!P(e)&&!Array.isArray(e)},isValidKeyValue:function(e){return Boolean(e&&!P(e)&&!Array.isArray(e)&&!this.isFunction(e))},removeFalsyIdentityValues:function(e,t){if(!e||!e.userIdentities)return e;var n={},r=p({},e.userIdentities);for(var i in e.userIdentities)if(e.userIdentities.hasOwnProperty(i)){var o=e.userIdentities[i];null===o||o||(t.warning("Identity value for '".concat(i,"' is falsy (").concat(o,"). This value will be removed from the request.")),delete r[i])}return n.userIdentities=r,n},validateIdentities:function(e,t){var n={userIdentities:1,onUserAlias:1,copyUserAttributes:1};if(e){if(t===fn&&(P(e.userIdentities)&&!Object.keys(e.userIdentities).length||!P(e.userIdentities)))return{valid:!1,error:r.Messages.ValidationMessages.ModifyIdentityRequestUserIdentitiesPresent};for(var i in e)if(e.hasOwnProperty(i)){if(!n[i])return{valid:!1,error:r.Messages.ValidationMessages.IdentityRequesetInvalidKey};if("onUserAlias"===i&&!mn.isFunction(e[i]))return{valid:!1,error:r.Messages.ValidationMessages.OnUserAliasType}}if(0===Object.keys(e).length)return{valid:!0};if(void 0===e.userIdentities)return{valid:!1,error:r.Messages.ValidationMessages.UserIdentities};if(null!==e.userIdentities&&!P(e.userIdentities))return{valid:!1,error:r.Messages.ValidationMessages.UserIdentities};if(P(e.userIdentities)&&Object.keys(e.userIdentities).length)for(var o in e.userIdentities)if(e.userIdentities.hasOwnProperty(o)){if(!1===me.IdentityType.getIdentityType(o))return{valid:!1,error:r.Messages.ValidationMessages.UserIdentitiesInvalidKey};if("string"!=typeof e.userIdentities[o]&&null!==e.userIdentities[o])return{valid:!1,error:r.Messages.ValidationMessages.UserIdentitiesInvalidValues}}}return{valid:!0}}},yn=r.HTTPCodes,bn=r.IdentityMethods,Sn=bn.Identify,In=bn.Modify,_n=bn.Login,wn=bn.Logout,Pn=r.HTTPCodes,Cn=r.Messages,An="x-mp-max-age",Tn=function(e,t,n,r,i){if(!i){var o=Fn(null==r?void 0:r.cacheMaxAge);switch(e){case _n:case Sn:kn(e,t,o,n,r);break;case In:case wn:n.purge()}}},kn=function(e,t,n,r,i){var o=i.responseText,s=i.status,a=r.retrieve()||{},u=_(En(e,t)),c={mpid:o.mpid,is_logged_in:o.is_logged_in};a[u]={responseText:JSON.stringify(c),status:s,expireTimestamp:n},r.store(a)},En=function(e,t){var n="device_application_stamp",r="".concat(e,":").concat(n,"=").concat(t.device_application_stamp,";"),i="";if(Object.keys(t).length){var o=new Array;for(var s in t)s!==n&&(o[me.IdentityType.getIdentityType(s)]=t[s]);i=o.reduce((function(e,t,n){var r=me.IdentityType.getIdentityName(n);return"".concat(e).concat(r,"=").concat(t,";")}),r)}return i},Dn=function(e,t,n){var r=_(En(e,t)),i=n.retrieve(),o=i?i[r]:null;return{responseText:Un(o.responseText),expireTimestamp:o.expireTimestamp,status:o.status}},On=function(e,t){var n={};if(P(null==e?void 0:e.userIdentities))for(var r in e.userIdentities)n[r]=e.userIdentities[r];return n.device_application_stamp=t,n},Mn=function(e){var t=e.retrieve()||{},n=(new Date).getTime();for(var r in t)t[r].expireTimestamp<n&&delete t[r];e.store(t)},Ln=function(e,t,n,r,i,o,s){var a=function(e,t,n){var r=null==n?void 0:n.retrieve();if(!r)return!1;var i=_(En(e,t));return!(!W(r,i)||r[i].expireTimestamp<(new Date).getTime())}(s,e,t);return!!a&&(n(Dn(s,e,t),r,i,o,s,e,!0),!0)},Fn=function(e){return void 0===e&&(e=86400),(new Date).getTime()+1e3*e},Un=function(e){return e?JSON.parse(e):{}},Nn={email_sha256:"other",mobile_sha256:"other2"},Rn=function(e){var t=p({},e);return Object.keys(Nn).forEach((function(e){if(e in t){var n=t[e];delete t[e],t[Nn[e]]=n}})),t},Vn=function(e,t){if(!e||!(null==t?void 0:t.userIdentities))return!1;var n,r,i,o,s=e.getUserIdentities().userIdentities,a=Rn(t.userIdentities);return n=s,r=a,i=Object.keys(null!=n?n:{}),o=Object.keys(null!=r?r:{}),!(i.length===o.length&&i.every((function(e){return n[e]===r[e]})))},xn=function(e){var t,n,r,i=null===(n=null===(t=null==e?void 0:e.SDKConfig)||void 0===t?void 0:t.identifyRequest)||void 0===n?void 0:n.userIdentities;return!(!i||!P(i)||z(i)||!Object.values(i).some(Boolean))||!!(null===(r=null==e?void 0:e.SDKConfig)||void 0===r?void 0:r.deviceId)},Hn=function(e,t,n,i){var s=e._Helpers,a=e._Store,u=e.Logger,c=e._ErrorReportingDispatcher,l=a.SDKConfig,d=l.identityUrl,v=l.isDevelopmentMode;if(s.canLog()){var f=s.createServiceUrl(d),m=v?"development":"production";!function(e,t,n,r,i,s,a,u){g(void 0,void 0,void 0,(function(){var c,l,d,g,v,f,m,y,b,S,I,_;return h(this,(function(h){switch(h.label){case 0:if(!K(i))return s.error("search called without a callback function; skipping request."),[2];if(c=function(e){try{i(e)}catch(e){s.error("Error invoking search callback: "+ie(e))}},l=mn.removeFalsyIdentityValues({userIdentities:null!=e?e:{}},s).userIdentities,!Object.values(null!=l?l:{}).some((function(e){return"string"==typeof e&&e.length>0})))return s.verbose("Identity search called with empty identifiers; skipping request."),c({httpCode:yn.noHttpCoverage}),[2];if(!t)return s.verbose("search called without a workspace API key; skipping request."),c({httpCode:yn.noHttpCoverage}),[2];h.label=1;case 1:return h.trys.push([1,9,,10]),d=n(),g=p(p({},d),{known_identities:p({},l)}),v={method:"post",headers:{Accept:"application/json","Content-Type":"application/json","x-mp-key":t},body:JSON.stringify(g)},f=a||(window.fetch?new ln(r):new dn(r)),s.verbose("Sending search request to "+r),[4,f.upload(v,r)];case 2:if(m=h.sent(),y=void 0,!K(m.json))return[3,7];h.label=3;case 3:return h.trys.push([3,5,,6]),[4,m.json()];case 4:return y=h.sent(),[3,6];case 5:return h.sent(),s.verbose("search response had no parseable JSON body."),[3,6];case 6:return[3,8];case 7:if(null==(b=m)?void 0:b.responseText)try{y=JSON.parse(b.responseText)}catch(e){s.verbose("search XHR response was not valid JSON.")}h.label=8;case 8:return m.status===o?s.verbose("search received 200 OK."):404===m.status?s.verbose("search received 404 (no match)."):s.verbose("search received non-success status "+m.status),c({httpCode:m.status,body:y}),[3,10];case 9:return S=h.sent(),I=ie(S),_="Error sending search request: "+I,s.error(_),null==u||u.report({message:_,code:hn.IDENTITY_REQUEST,severity:vn.ERROR}),c({httpCode:yn.noHttpCoverage}),[3,10];case 10:return[2]}}))}))}(n,t,(function(){return function(e){return{client_sdk:{platform:r.platform,sdk_vendor:r.sdkVendor,sdk_version:r.sdkVersion},environment:e,request_id:w(),request_timestamp_ms:Date.now()}}(m)}),f+"search?cb=1",i,u,void 0,c)}else if(u.verbose(Cn.InformationMessages.AbandonLogEvent),K(i))try{i({httpCode:Pn.loggingDisabledOrMissingAPIKey})}catch(e){u.error("Error invoking search callback: "+ie(e))}};function Kn(e,t){this.uploader=null;var n=this;this.queueEventForBatchUpload=function(t){if(!this.uploader){var n=C(e._Helpers.getFeatureFlag(r.FeatureFlags.EventBatchingIntervalMillis));this.uploader=new gn(e,n)}this.uploader.queueEvent(t),e._Persistence.update()},this.processQueuedEvents=function(){var t,r=e.Identity.getCurrentUser();if(r&&(t=r.getMPID()),e._Store.eventQueue.length&&t){var i=e._Store.eventQueue;e._Store.eventQueue=[],this.appendUserInfoToEvents(r,i),i.forEach((function(e){n.sendEventToServer(e)}))}},this.appendUserInfoToEvents=function(e,t){t.forEach((function(t){t.MPID||pn(e,t)}))};this.sendEventToServer=function(n,i){var o=re({shouldUploadEvent:!0},i);if(e._Store.webviewBridgeEnabled)e._NativeSdkHelpers.sendToNative(r.NativeSdkPaths.LogEvent,JSON.stringify(n));else{var s,a=e.Identity.getCurrentUser();if(a&&(s=a.getMPID()),e._Store.requireDelay=e._Helpers.isDelayedByIntegration(e._preInit.integrationDelays,e._Store.integrationDelayTimeoutStart,Date.now()),!function(n,r){var i;if(!(null===(i=e._CookieConsentManager)||void 0===i?void 0:i.getNoFunctional())||xn(e._Store)||r||!e._Store.configurationLoaded||e._Store.requireDelay)return!1;var o=n;return(null==t?void 0:t.kitBlockingEnabled)&&(o=t.createBlockedEvent(n)),o&&(e._Forwarders.sendEventToForwarders(o),n.AlreadySentToForwarders=!0),e.Logger.verbose("noFunctional event forwarded to kits and queued for MP server upload when MPID is available."),e._Store.eventQueue.push(n),!0}(n,s)){if(!s||e._Store.requireDelay||!e._Store.configurationLoaded)return e.Logger.verbose("Event was added to eventQueue. eventQueue will be processed once a valid MPID is returned or there is no more integration imposed delay."),void e._Store.eventQueue.push(n);this.processQueuedEvents(),z(n)||(o.shouldUploadEvent&&this.queueEventForBatchUpload(n),n.EventName!==String(me.MessageType.AppStateTransition)&&(t&&t.kitBlockingEnabled&&(n=t.createBlockedEvent(n)),n&&!n.AlreadySentToForwarders&&e._Forwarders.sendEventToForwarders(n)))}}},this.sendBatchForwardingStatsToServer=function(t,n){var r,i;try{r=e._Helpers.createServiceUrl(e._Store.SDKConfig.v2SecureServiceUrl,e._Store.devToken),i={uuid:e._Helpers.generateUniqueId(),data:t},n&&(n.open("post",r+"/Forwarding"),n.send(JSON.stringify(i)))}catch(t){e.Logger.error("Error sending forwarding stats to mParticle servers.")}},this.initializeForwarderStatsUploader=function(){var t=e._Store.SDKConfig.v1SecureServiceUrl,n=e._Store.devToken,r="https://".concat(t).concat(n,"/Forwarding");return window.fetch?new ln(r):new dn(r)},this.prepareForwardingStats=function(t,n){var i,o=e._Forwarders.getForwarderStatsQueue();if(t&&t.isVisible){i={mid:t.id,esid:t.eventSubscriptionId,n:n.EventName,attrs:n.EventAttributes,sdk:n.SDKVersion,dt:n.EventDataType,et:n.EventCategory,dbg:n.Debug,ct:n.Timestamp,eec:n.ExpandedEventCount,dp:n.DataPlan};var s=e._Forwarders,a=s.sendSingleForwardingStatsToServer,u=s.setForwarderStatsQueue;e._Helpers.getFeatureFlag(r.FeatureFlags.ReportBatching)?(o.push(i),u(o)):a(i)}}}var Bn=function(){function e(){}var t;return e.hashEventType=function(e){return _(e)},e.hashEventName=function(e,t){return _(t+e)},e.hashEventAttributeKey=function(e,t,n){return _(e+t+n)},e.hashUserAttribute=function(e){return _(e)},e.hashUserIdentity=function(e){return e},e.hashConsentPurpose=function(e,t){return _(e+t)},e.hashAttributeConditionalForwarding=function(e){return _(e).toString()},e.hashConsentPurposeConditionalForwarding=function(e,t){return this.hashConsentPurpose(e,t).toString()},t=e,e.filterUserAttributes=function(e,n){return Z(e,n,(function(e){return t.hashUserAttribute(e)}))},e.filterUserIdentities=function(e,n){return Z(e,n,(function(e){return t.hashUserIdentity(ue.getIdentityType(e))}))},e.isFilteredUserAttribute=function(e,n){var r=t.hashUserAttribute(e);return n&&b(n,r)},e}(),qn=r.StorageNames;function jn(e,t,n){n===me.IdentityType.CustomerId?e.unshift(t):e.push(t)}function zn(e){var t=this;this.canLog=function(){return!(!e._Store.isEnabled||!e._Store.devToken&&!e._Store.webviewBridgeEnabled)},this.getFeatureFlag=function(t){return e._Store.SDKConfig.flags.hasOwnProperty(t)?e._Store.SDKConfig.flags[t]:null},this.invokeCallback=function(n,r,i,o,s){n||e.Logger.warning("There is no callback provided");try{t.Validators.isFunction(n)&&n({httpCode:r,body:i,getUser:function(){return o||e.Identity.getCurrentUser()},getPreviousUser:function(){if(s)return(null==(r=o||e.Identity.getCurrentUser())?void 0:r.getMPID())===s?null:e.Identity.getUser(s);var t=e.Identity.getUsers(),n=t.shift(),r=o||e.Identity.getCurrentUser();return n&&r&&n.getMPID()===r.getMPID()&&(n=t.shift()),n||null}})}catch(t){e.Logger.error("There was an error with your callback: "+t)}},this.invokeAliasCallback=function(n,r,i){n||e.Logger.warning("There is no callback provided");try{if(t.Validators.isFunction(n)){var o={httpCode:r};i&&(o.message=i),n(o)}}catch(t){e.Logger.error("There was an error with your callback: "+t)}},this.extend=re,this.createServiceUrl=function(t,n){var r,i=window.mParticle&&e._Store.SDKConfig.forceHttps?"https://":window.location.protocol+"//";return r=e._Store.SDKConfig.forceHttps?"https://"+t:i+t,n&&(r+=n),r},this.createXHR=function(t){var n;try{n=new window.XMLHttpRequest}catch(t){e.Logger.error("Error creating XMLHttpRequest object.")}if(n&&t&&"withCredentials"in n)n.onreadystatechange=t;else if(void 0!==window.XDomainRequest){e.Logger.verbose("Creating XDomainRequest object");try{(n=new window.XDomainRequest).onload=t}catch(t){e.Logger.error("Error creating XDomainRequest object")}}return n},this.filterUserIdentities=function(e,n){return function(e,t,n){var r=[];if(!e||!Object.keys(e).length)return r;for(var i in e)if(e.hasOwnProperty(i)){var o=me.IdentityType.getIdentityType(i);!1===o||n(t,o)||jn(r,{Type:o,Identity:e[i]},o)}return r}(e,n,t.inArray)},this.filterUserIdentitiesForForwarders=Bn.filterUserIdentities,this.filterUserAttributes=Bn.filterUserAttributes,this.isEventType=function(e){for(var t in me.EventType)if(me.EventType.hasOwnProperty(t)&&me.EventType[t]===e)return!0;return!1},this.sanitizeAttributes=function(n,r){if(!n||!t.isObject(n))return null;var i={};for(var o in n)n.hasOwnProperty(o)&&t.Validators.isValidAttributeValue(n[o])?i[o]=n[o]:e.Logger.warning("For '"+r+"', the corresponding attribute value of '"+o+"' must be a string, number, boolean, or null.");return i},this.isDelayedByIntegration=function(t,n,r){if(r-n>e._Store.SDKConfig.integrationDelayTimeout)return!1;for(var i in t)if(!0===t[i])return!0;return!1},this.createMainStorageName=function(e){return e?qn.currentStorageName+"_"+e:qn.currentStorageName},this.converted=V,this.findKeyInObject=S,this.parseNumber=C,this.inArray=b,this.isObject=P,this.decoded=R,this.parseStringOrNumber=A,this.generateHash=_,this.generateUniqueId=w,this.Validators=mn}var Qn=r.Messages,Wn="mParticleAndroid",Jn="mParticle";function Gn(e){if(Object.prototype.hasOwnProperty.call(window,e))return window[e]}function $n(e){var t=this;this.initializeSessionAttributes=function(e){var n=r.NativeSdkPaths.SetSessionAttribute,i=JSON.stringify({key:"$src_env",value:"webview"}),o=JSON.stringify({key:"$src_key",value:e});t.sendToNative(n,i),e&&t.sendToNative(n,o)},this.isBridgeV2Available=function(e){var t,n;if(!e)return!1;var r=Wn+"_"+e+"_v2",i=Jn+"_"+e+"_v2";return!!(null===(n=null===(t=window.webkit)||void 0===t?void 0:t.messageHandlers)||void 0===n?void 0:n.hasOwnProperty(i))||(!(!window.mParticle||!window.mParticle.uiwebviewBridgeName||window.mParticle.uiwebviewBridgeName!==i)||!!window.hasOwnProperty(r))},this.isWebviewEnabled=function(n,r){return e._Store.bridgeV2Available=t.isBridgeV2Available(n),e._Store.bridgeV1Available=t.isBridgeV1Available(),2===r?e._Store.bridgeV2Available:(!window.mParticle||!window.mParticle.uiwebviewBridgeName||window.mParticle.uiwebviewBridgeName===Jn+"_"+n+"_v2")&&(r<2&&(e._Store.bridgeV2Available||e._Store.bridgeV1Available))},this.isBridgeV1Available=function(){return!!(e._Store.SDKConfig.useNativeSdk||Gn(Wn)||e._Store.SDKConfig.isIOS)},this.sendToNative=function(n,r){e._Store.bridgeV2Available&&2===e._Store.SDKConfig.minWebviewBridgeVersion||e._Store.bridgeV2Available&&e._Store.SDKConfig.minWebviewBridgeVersion<2?t.sendViaBridgeV2(n,r,e._Store.SDKConfig.requiredWebviewBridgeName):e._Store.bridgeV1Available&&e._Store.SDKConfig.minWebviewBridgeVersion<2&&t.sendViaBridgeV1(n,r)},this.sendViaBridgeV1=function(n,r){var i=Gn(Wn);i&&i.hasOwnProperty(n)?(e.Logger.verbose(Qn.InformationMessages.SendAndroid+n),i[n](r)):e._Store.SDKConfig.isIOS&&(e.Logger.verbose(Qn.InformationMessages.SendIOS+n),t.sendViaIframeToIOS(n,r))},this.sendViaIframeToIOS=function(e,t){var n=document.createElement("IFRAME");n.setAttribute("src","mp-sdk://"+e+"/"+encodeURIComponent(t)),document.documentElement.appendChild(n),n.parentNode.removeChild(n)},this.sendViaBridgeV2=function(n,r,i){var o,s;if(i){var a,u,c=Gn(Wn+"_"+i+"_v2"),l=Jn+"_"+i+"_v2";if((null===(s=null===(o=window.webkit)||void 0===o?void 0:o.messageHandlers)||void 0===s?void 0:s[l])&&(a=window.webkit.messageHandlers[l]),e.uiwebviewBridgeName===l&&(u=e[l]),c&&c.hasOwnProperty(n))return e.Logger.verbose(Qn.InformationMessages.SendAndroid+n),void c[n](r);a?(e.Logger.verbose(Qn.InformationMessages.SendIOS+n),a.postMessage(JSON.stringify({path:n,value:r?JSON.parse(r):null}))):u&&(e.Logger.verbose(Qn.InformationMessages.SendIOS+n),t.sendViaIframeToIOS(n,r))}}}var Yn=r.Messages.InformationMessages,Xn={AdobeEventForwarder:11,DoubleclickDFP:41,AppNexus:50,Lotame:58,TradeDesk:103,VerizonMedia:155,Rokt:1277};function Zn(e){var t=this;this.attemptCookieSync=function(n,r){var i,o=e._Store,s=o.pixelConfigurations,a=o.webviewBridgeEnabled;if(n&&!a&&!(null===(i=e._CookieConsentManager)||void 0===i?void 0:i.getNoFunctional())){var u=e._Persistence.getPersistence();z(u)||s.forEach((function(i){var o,s,a;try{var c=!1,l=i.filteringConsentRuleValues,d=i.pixelUrl,p=i.redirectUrl,g=i.moduleId,h=i.settings,v=i.frequencyCap,f=(l||{}).values;if(z(d))return;if(z(f)||(c=!0),c&&r)return;if(g===Xn.Rokt){var m="undefined"==typeof navigator?void 0:navigator;if(e._CookieConsentManager.getNoTargeting()||e._CookieConsentManager.getDoNotShareOrSell()||m&&!0===m.globalPrivacyControl)return}if(!(0,e._Consent.isEnabledForUserConsent)(l,e.Identity.getCurrentUser()))return;var y=null!==(s=null===(o=u[n])||void 0===o?void 0:o.csd)&&void 0!==s?s:{},b=y[g]||null;if(!er(v,b))return;var S=g===Xn.TradeDesk?window.location.hostname:void 0,I="true"===(null===(a=null==h?void 0:h.enableHmTag)||void 0===a?void 0:a.toLowerCase()),_=g===Xn.DoubleclickDFP&&I,w=_?U(n):void 0;_&&!w&&e.Logger.warning("Unable to base64 encode the current MPID; omitting the google_hm parameter from this cookie sync");var P=L(n,d,p,S,w);t.performCookieSync(P,g.toString(),n,y)}catch(t){e.Logger.error("Error performing cookie sync: "+t)}}))}},this.performCookieSync=function(t,n,r,i){var o=document.createElement("img");e.Logger.verbose(Yn.CookieSync),o.onload=function(){i[n]=(new Date).getTime(),e._Persistence.saveUserCookieSyncDatesToPersistence(r,i)},o.src=t}}var er=function(e,t){return!t||(new Date).getTime()>new Date(t).getTime()+864e5*e};function tr(e,t,n){t.warning(e.warningMessage),null==n||n.report({message:e.methodName,code:hn.MP_DEPRECATED_METHOD_USAGE,severity:vn.WARNING})}var nr=r.Messages;function rr(e){var t=this;function n(e,t){if(!e||!t||t<=0)return!1;var n=6e4*t;return Date.now()-e>=n}function r(){var t;e._Events.logEvent({messageType:me.MessageType.SessionEnd}),e._Store.nullifySession(),null===(t=e._timeOnSiteTimer)||void 0===t||t.resetTimer()}this.initialize=function(){var r;if(e._Store.sessionId){var i=e._Store,o=i.dateLastEventSent,s=i.SDKConfig,a=s.sessionTimeout;if(n(null==o?void 0:o.getTime(),a))t.endSession(),t.startNewSession();else{var u=e.Identity.getCurrentUser(),c=s.identifyRequest;!((null===(r=e._CookieConsentManager)||void 0===r?void 0:r.getNoFunctional())&&!xn(e._Store))&&Vn(u,c)&&(e.Identity.identify(c,s.identityCallback),e._Store.identifyCalled=!0,e._Store.SDKConfig.identityCallback=null)}}else t.startNewSession()},this.getSession=function(){return tr({methodName:"SessionManager.getSession()",warningMessage:I("SessionManager.getSession()",!1,"SessionManager.getSessionId()")},e.Logger,e._ErrorReportingDispatcher),this.getSessionId()},this.getSessionId=function(){return e._Store.sessionId},this.startNewSession=function(){var n;if(e.Logger.verbose(nr.InformationMessages.StartingNewSession),e._Helpers.canLog()){e._Store.sessionId=e._Helpers.generateUniqueId().toUpperCase();var r=e.Identity.getCurrentUser(),i=r?r.getMPID():null;if(i&&(e._Store.currentSessionMPIDs=[i]),!e._Store.sessionStartDate){var o=new Date;e._Store.sessionStartDate=o,e._Store.dateLastEventSent=o}t.setSessionTimer();var s=(null===(n=e._CookieConsentManager)||void 0===n?void 0:n.getNoFunctional())&&!xn(e._Store);e._Store.identifyCalled||s||(e.Identity.identify(e._Store.SDKConfig.identifyRequest,e._Store.SDKConfig.identityCallback),e._Store.identifyCalled=!0,e._Store.SDKConfig.identityCallback=null),e._Events.logEvent({messageType:me.MessageType.SessionStart})}else e.Logger.verbose(nr.InformationMessages.AbandonStartSession)},this.endSession=function(i){var o,s,a,u;if(e.Logger.verbose(nr.InformationMessages.StartingEndSession),i)r();else{if(!e._Helpers.canLog())return e.Logger.verbose(nr.InformationMessages.AbandonEndSession),void(null===(o=e._timeOnSiteTimer)||void 0===o||o.resetTimer());var c=e._Persistence.getPersistence();if(!c||c.gs&&!c.gs.sid)return e.Logger.verbose(nr.InformationMessages.NoSessionToEnd),void(null===(s=e._timeOnSiteTimer)||void 0===s||s.resetTimer());if(c.gs.sid&&e._Store.sessionId!==c.gs.sid&&(e._Store.sessionId=c.gs.sid),null===(a=null==c?void 0:c.gs)||void 0===a?void 0:a.les){var l=e._Store.SDKConfig.sessionTimeout;n(c.gs.les,l)?r():(t.setSessionTimer(),null===(u=e._timeOnSiteTimer)||void 0===u||u.resetTimer())}}},this.setSessionTimer=function(){var n=6e4*e._Store.SDKConfig.sessionTimeout;e._Store.globalTimer=window.setTimeout((function(){t.endSession()}),n)},this.resetSessionTimer=function(){e._Store.webviewBridgeEnabled||(e._Store.sessionId||t.startNewSession(),t.clearSessionTimeout(),t.setSessionTimer()),t.startNewSessionIfNeeded()},this.clearSessionTimeout=function(){clearTimeout(e._Store.globalTimer)},this.startNewSessionIfNeeded=function(){if(!e._Store.webviewBridgeEnabled){var n=e._Persistence.getPersistence();!e._Store.sessionId&&n&&(n.sid?e._Store.sessionId=n.sid:t.startNewSession())}}}var ir=r.Messages;function or(e){var t=this;this.convertTransactionAttributesToProductAction=function(e,t){e.hasOwnProperty("Id")&&(t.TransactionId=e.Id),e.hasOwnProperty("Affiliation")&&(t.Affiliation=e.Affiliation),e.hasOwnProperty("CouponCode")&&(t.CouponCode=e.CouponCode),e.hasOwnProperty("Revenue")&&(t.TotalAmount=this.sanitizeAmount(e.Revenue,"Revenue")),e.hasOwnProperty("Shipping")&&(t.ShippingAmount=this.sanitizeAmount(e.Shipping,"Shipping")),e.hasOwnProperty("Tax")&&(t.TaxAmount=this.sanitizeAmount(e.Tax,"Tax")),e.hasOwnProperty("Step")&&(t.CheckoutStep=e.Step),e.hasOwnProperty("Option")&&(t.CheckoutOptions=e.Option)},this.calculateProductActionTotalAmount=function(e){if(!e||null!=e.TotalAmount)return e;var t=0;return Array.isArray(e.ProductList)&&e.ProductList.forEach((function(e){t+=C(e.Quantity)*C(e.Price)})),t+=C(e.ShippingAmount)+C(e.TaxAmount),e.TotalAmount=t,e},this.getProductActionEventName=function(e){switch(e){case me.ProductActionType.AddToCart:return"AddToCart";case me.ProductActionType.AddToWishlist:return"AddToWishlist";case me.ProductActionType.Checkout:return"Checkout";case me.ProductActionType.CheckoutOption:return"CheckoutOption";case me.ProductActionType.Click:return"Click";case me.ProductActionType.Purchase:return"Purchase";case me.ProductActionType.Refund:return"Refund";case me.ProductActionType.RemoveFromCart:return"RemoveFromCart";case me.ProductActionType.RemoveFromWishlist:return"RemoveFromWishlist";case me.ProductActionType.ViewDetail:return"ViewDetail";case me.ProductActionType.ViewCart:return"ViewCart";case me.ProductActionType.AddShippingInfo:return"AddShippingInfo";case me.ProductActionType.AddPaymentInfo:return"AddPaymentInfo";case me.ProductActionType.PaymentMethodSelected:return"PaymentMethodSelected";case me.ProductActionType.PaymentAttempted:return"PaymentAttempted";case me.ProductActionType.PaymentSucceeded:return"PaymentSucceeded";case me.ProductActionType.PaymentFailed:return"PaymentFailed";case me.ProductActionType.RefundInitiated:return"RefundInitiated";case me.ProductActionType.Unknown:default:return"Unknown"}},this.getPromotionActionEventName=function(e){switch(e){case me.PromotionActionType.PromotionClick:return"PromotionClick";case me.PromotionActionType.PromotionView:return"PromotionView";default:return"Unknown"}},this.convertProductActionToEventType=function(t){switch(t){case me.ProductActionType.AddToCart:return me.CommerceEventType.ProductAddToCart;case me.ProductActionType.AddToWishlist:return me.CommerceEventType.ProductAddToWishlist;case me.ProductActionType.Checkout:return me.CommerceEventType.ProductCheckout;case me.ProductActionType.CheckoutOption:return me.CommerceEventType.ProductCheckoutOption;case me.ProductActionType.Click:return me.CommerceEventType.ProductClick;case me.ProductActionType.Purchase:return me.CommerceEventType.ProductPurchase;case me.ProductActionType.Refund:return me.CommerceEventType.ProductRefund;case me.ProductActionType.RemoveFromCart:return me.CommerceEventType.ProductRemoveFromCart;case me.ProductActionType.RemoveFromWishlist:return me.CommerceEventType.ProductRemoveFromWishlist;case me.ProductActionType.Unknown:return me.EventType.Unknown;case me.ProductActionType.ViewDetail:return me.CommerceEventType.ProductViewDetail;case me.ProductActionType.ViewCart:case me.ProductActionType.AddShippingInfo:case me.ProductActionType.AddPaymentInfo:case me.ProductActionType.PaymentMethodSelected:case me.ProductActionType.PaymentAttempted:case me.ProductActionType.PaymentSucceeded:case me.ProductActionType.PaymentFailed:case me.ProductActionType.RefundInitiated:return me.EventType.Unknown;default:return e.Logger.error("Could not convert product action type "+t+" to event type"),null}},this.convertPromotionActionToEventType=function(t){switch(t){case me.PromotionActionType.PromotionClick:return me.CommerceEventType.PromotionClick;case me.PromotionActionType.PromotionView:return me.CommerceEventType.PromotionView;default:return e.Logger.error("Could not convert promotion action type "+t+" to event type"),null}},this.generateExpandedEcommerceName=function(e,t){return"eCommerce - "+e+" - "+(t?"Total":"Item")},this.extractProductAttributes=function(e,t){t.CouponCode&&(e["Coupon Code"]=t.CouponCode),t.Brand&&(e.Brand=t.Brand),t.Category&&(e.Category=t.Category),t.Name&&(e.Name=t.Name),t.Sku&&(e.Id=t.Sku),t.Price&&(e["Item Price"]=t.Price),t.Quantity&&(e.Quantity=t.Quantity),t.Position&&(e.Position=t.Position),t.Variant&&(e.Variant=t.Variant),e["Total Product Amount"]=t.TotalAmount||0},this.extractTransactionId=function(e,t){t.TransactionId&&(e["Transaction Id"]=t.TransactionId)},this.extractActionAttributes=function(e,n){t.extractTransactionId(e,n),n.Affiliation&&(e.Affiliation=n.Affiliation),n.CouponCode&&(e["Coupon Code"]=n.CouponCode),n.TotalAmount&&(e["Total Amount"]=n.TotalAmount),n.ShippingAmount&&(e["Shipping Amount"]=n.ShippingAmount),n.TaxAmount&&(e["Tax Amount"]=n.TaxAmount),n.CheckoutOptions&&(e["Checkout Options"]=n.CheckoutOptions),n.CheckoutStep&&(e["Checkout Step"]=n.CheckoutStep)},this.extractPromotionAttributes=function(e,t){t.Id&&(e.Id=t.Id),t.Creative&&(e.Creative=t.Creative),t.Name&&(e.Name=t.Name),t.Position&&(e.Position=t.Position)},this.createProduct=function(t,n,r,i,o,s,a,u,c,l){return l=e._Helpers.sanitizeAttributes(l,t),"string"!=typeof t?(e.Logger.error("Name is required when creating a product"),null):e._Helpers.Validators.isStringOrNumber(n)?e._Helpers.Validators.isStringOrNumber(r)?(r=e._Helpers.parseNumber(r),u&&!e._Helpers.Validators.isNumber(u)&&(e.Logger.error("Position must be a number, it will be set to null."),u=null),{Name:t,Sku:n,Price:r,Quantity:i=e._Helpers.Validators.isStringOrNumber(i)?e._Helpers.parseNumber(i):1,Brand:a,Variant:o,Category:s,Position:u,CouponCode:c,TotalAmount:i*r,Attributes:l}):(e.Logger.error("Price is required when creating a product, and must be a string or a number"),null):(e.Logger.error("SKU is required when creating a product, and must be a string or a number"),null)},this.createPromotion=function(t,n,r,i){return e._Helpers.Validators.isStringOrNumber(t)?{Id:t,Creative:n,Name:r,Position:i}:(e.Logger.error(ir.ErrorMessages.PromotionIdRequired),null)},this.createImpression=function(t,n){return"string"!=typeof t?(e.Logger.error("Name is required when creating an impression."),null):n?{Name:t,Product:n}:(e.Logger.error("Product is required when creating an impression."),null)},this.createTransactionAttributes=function(t,n,r,i,o,s){return e._Helpers.Validators.isStringOrNumber(t)?{Id:t,Affiliation:n,CouponCode:r,Revenue:i,Shipping:o,Tax:s}:(e.Logger.error(ir.ErrorMessages.TransactionIdRequired),null)},this.expandProductImpression=function(n){var r=[];return n.ProductImpressions?(n.ProductImpressions.forEach((function(i){i.ProductList&&i.ProductList.forEach((function(o){var s=re(!1,{},n.EventAttributes);if(o.Attributes)for(var a in o.Attributes)s[a]=o.Attributes[a];t.extractProductAttributes(s,o),i.ProductImpressionList&&(s["Product Impression List"]=i.ProductImpressionList);var u=e._ServerModel.createEventObject({messageType:me.MessageType.PageEvent,name:t.generateExpandedEcommerceName("Impression"),data:s,eventType:me.EventType.Transaction});r.push(u)}))})),r):r},this.expandCommerceEvent=function(e){return e?t.expandProductAction(e).concat(t.expandPromotionAction(e)).concat(t.expandProductImpression(e)):null},this.expandPromotionAction=function(n){var r=[];return n.PromotionAction?(n.PromotionAction.PromotionList.forEach((function(i){var o=re(!1,{},n.EventAttributes);t.extractPromotionAttributes(o,i);var s=e._ServerModel.createEventObject({messageType:me.MessageType.PageEvent,name:t.generateExpandedEcommerceName(me.PromotionActionType.getExpansionName(n.PromotionAction.PromotionActionType)),data:o,eventType:me.EventType.Transaction});r.push(s)})),r):r},this.expandProductAction=function(n){var r=[];if(!n.ProductAction)return r;var i=!1;if(n.ProductAction.ProductActionType===me.ProductActionType.Purchase||n.ProductAction.ProductActionType===me.ProductActionType.Refund){var o=re(!1,{},n.EventAttributes);o["Product Count"]=n.ProductAction.ProductList?n.ProductAction.ProductList.length:0,t.extractActionAttributes(o,n.ProductAction),n.CurrencyCode&&(o["Currency Code"]=n.CurrencyCode);var s=e._ServerModel.createEventObject({messageType:me.MessageType.PageEvent,name:t.generateExpandedEcommerceName(me.ProductActionType.getExpansionName(n.ProductAction.ProductActionType),!0),data:o,eventType:me.EventType.Transaction});r.push(s)}else i=!0;var a=n.ProductAction.ProductList;return a?(a.forEach((function(o){var s=re(!1,n.EventAttributes,o.Attributes);i?t.extractActionAttributes(s,n.ProductAction):t.extractTransactionId(s,n.ProductAction),t.extractProductAttributes(s,o);var a=e._ServerModel.createEventObject({messageType:me.MessageType.PageEvent,name:t.generateExpandedEcommerceName(me.ProductActionType.getExpansionName(n.ProductAction.ProductActionType)),data:s,eventType:me.EventType.Transaction});r.push(a)})),r):r},this.createCommerceEventObject=function(t,n){var r,i=e._Helpers.extend;return e.Logger.verbose(ir.InformationMessages.StartingLogCommerceEvent),e._Helpers.canLog()?((r=e._ServerModel.createEventObject({messageType:me.MessageType.Commerce,sourceMessageId:null==n?void 0:n.sourceMessageId})).EventName="eCommerce - ",r.CurrencyCode=e._Store.currencyCode,r.CustomFlags=i(r.CustomFlags,t),r):(e.Logger.verbose(ir.InformationMessages.AbandonLogEvent),null)},this.sanitizeAmount=function(t,n){if(!e._Helpers.Validators.isStringOrNumber(t)){var r=[n,"must be of type number. A",c(t),"was passed. Converting to 0"].join(" ");return e.Logger.warning(r),0}return e._Helpers.parseNumber(t)}}var sr=function(){function e(e,t){void 0===t&&(t=!1),this.noFunctional=t,this.isTrackerActive=!1,this.localStorageName="",this.startTime=0,this.totalTime=0,this.localStorageName="mprtcl-tos-".concat(e),this.timerVault=new sn(this.localStorageName),this.noFunctional||this.loadTimeFromStorage(),this.addHandlers(),!1===document.hidden&&this.startTracking()}return e.prototype.addHandlers=function(){var e=this;document.addEventListener("visibilitychange",(function(){return e.handleVisibilityChange()})),window.addEventListener("blur",(function(){return e.handleWindowBlur()})),window.addEventListener("focus",(function(){return e.handleWindowFocus()})),window.addEventListener("storage",(function(t){return e.syncAcrossTabs(t)})),window.addEventListener("beforeunload",(function(){return e.updateTimeInPersistence()}))},e.prototype.handleVisibilityChange=function(){document.hidden?this.stopTracking():this.startTracking()},e.prototype.handleWindowBlur=function(){this.isTrackerActive&&this.stopTracking()},e.prototype.handleWindowFocus=function(){this.isTrackerActive||this.startTracking()},e.prototype.syncAcrossTabs=function(e){if(e.key===this.localStorageName&&null!==e.newValue){var t=parseFloat(e.newValue)||0;this.totalTime=t}},e.prototype.updateTimeInPersistence=function(){this.isTrackerActive&&!this.noFunctional&&this.timerVault.store(Math.round(this.totalTime))},e.prototype.loadTimeFromStorage=function(){var e=this.timerVault.retrieve();H(e)&&null!==e&&(this.totalTime=e)},e.prototype.startTracking=function(){document.hidden||(this.startTime=Math.floor(performance.now()),this.isTrackerActive=!0)},e.prototype.stopTracking=function(){this.isTrackerActive&&(this.setTotalTime(),this.updateTimeInPersistence(),this.isTrackerActive=!1)},e.prototype.setTotalTime=function(){if(this.isTrackerActive){var e=Math.floor(performance.now());this.totalTime+=e-this.startTime,this.startTime=e}},e.prototype.getTimeInForeground=function(){return this.setTotalTime(),this.updateTimeInPersistence(),this.totalTime},e.prototype.resetTimer=function(){this.totalTime=0,this.updateTimeInPersistence()},e}();function ar(e){var t=e?p({},e):{};return(!0===t.noDeviceId||!0===t.noDeviceID)&&(t.noDeviceId=!0,t.noFunctional=!0,t.noTargeting=!0),t}function ur(e,t,n){var i=this,o=t._Helpers.createMainStorageName,s=t._NativeSdkHelpers.isWebviewEnabled,a={isEnabled:!0,sessionAttributes:{},localSessionAttributes:{},currentSessionMPIDs:[],consentState:null,sessionId:null,isFirstRun:null,clientId:null,deviceId:null,devToken:null,serverSettings:{},dateLastEventSent:null,sessionStartDate:null,currentPosition:null,isTracking:!1,watchPositionId:null,cartProducts:[],eventQueue:[],currencyCode:null,globalTimer:null,context:null,configurationLoaded:!1,identityCallInFlight:!1,identityCallFailed:!1,identifyRequestCount:0,SDKConfig:{},nonCurrentUserMPIDs:{},identifyCalled:!1,isLoggedIn:!1,cookieSyncDates:{},integrationAttributes:{},requireDelay:!0,isLocalStorageAvailable:null,storageName:null,activeForwarders:[],kits:{},sideloadedKits:[],configuredForwarders:[],pixelConfigurations:[],wrapperSDKInfo:{name:"none",version:null,isInfoSet:!1},roktAccountId:null,integrationName:null,persistenceData:{gs:{}}};for(var u in a)this[u]=a[u];if(this.devToken=n||null,this.integrationDelayTimeoutStart=Date.now(),this.SDKConfig=function(e){var t={};for(var n in r.DefaultConfig)r.DefaultConfig.hasOwnProperty(n)&&(t[n]=r.DefaultConfig[n]);if(e)for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);for(var n in r.DefaultBaseUrls)t[n]=r.DefaultBaseUrls[n];return t.flags=t.flags||{},t}(e),e){e.hasOwnProperty("flags")||(this.SDKConfig.flags={}),this.SDKConfig.flags=cr(e),this.SDKConfig.autoLogPageViewQueryParams=kt(e.autoLogPageViewQueryParams),e.deviceId&&(this.deviceId=e.deviceId),e.hasOwnProperty("isDevelopmentMode")?this.SDKConfig.isDevelopmentMode=N(e.isDevelopmentMode):this.SDKConfig.isDevelopmentMode=!1;var l=lr(e,this.SDKConfig.flags,n);for(var d in l)this.SDKConfig[d]=l[d];if(this.SDKConfig.useNativeSdk=!!e.useNativeSdk,this.SDKConfig.kits=e.kits||{},this.SDKConfig.sideloadedKits=e.sideloadedKits||[],e.hasOwnProperty("isIOS")?this.SDKConfig.isIOS=e.isIOS:this.SDKConfig.isIOS=!(!window.mParticle||!window.mParticle.isIOS)&&window.mParticle.isIOS,e.hasOwnProperty("useCookieStorage")?this.SDKConfig.useCookieStorage=e.useCookieStorage:this.SDKConfig.useCookieStorage=!1,e.hasOwnProperty("maxCookieSize")?this.SDKConfig.maxCookieSize=e.maxCookieSize:this.SDKConfig.maxCookieSize=r.DefaultConfig.maxCookieSize,e.hasOwnProperty("appName")&&(this.SDKConfig.appName=e.appName),e.hasOwnProperty("package")&&(this.SDKConfig.package=e.package),e.hasOwnProperty("integrationDelayTimeout")?this.SDKConfig.integrationDelayTimeout=e.integrationDelayTimeout:this.SDKConfig.integrationDelayTimeout=r.DefaultConfig.integrationDelayTimeout,e.hasOwnProperty("identifyRequest")&&(this.SDKConfig.identifyRequest=e.identifyRequest),e.hasOwnProperty("identityCallback")){var g=e.identityCallback;t._Helpers.Validators.isFunction(g)?this.SDKConfig.identityCallback=e.identityCallback:t.Logger.warning("The optional callback must be a function. You tried entering a(n) "+c(g)+" . Callback not set. Please set your callback again.")}if(e.hasOwnProperty("appVersion")&&(this.SDKConfig.appVersion=e.appVersion),e.hasOwnProperty("appName")&&(this.SDKConfig.appName=e.appName),e.hasOwnProperty("sessionTimeout")&&(this.SDKConfig.sessionTimeout=e.sessionTimeout),e.hasOwnProperty("dataPlan")){this.SDKConfig.dataPlan={PlanVersion:null,PlanId:null};var h=e.dataPlan;h.planId&&(q(h.planId)?this.SDKConfig.dataPlan.PlanId=h.planId:t.Logger.error("Your data plan id must be a string and match the data plan slug format (i.e. under_case_slug)")),h.planVersion&&(H(h.planVersion)?this.SDKConfig.dataPlan.PlanVersion=h.planVersion:t.Logger.error("Your data plan version must be a number"))}else this.SDKConfig.dataPlan={};if(e.hasOwnProperty("forceHttps")?this.SDKConfig.forceHttps=e.forceHttps:this.SDKConfig.forceHttps=!0,this.SDKConfig.customFlags=e.customFlags||{},e.hasOwnProperty("minWebviewBridgeVersion")?this.SDKConfig.minWebviewBridgeVersion=e.minWebviewBridgeVersion:this.SDKConfig.minWebviewBridgeVersion=1,e.hasOwnProperty("aliasMaxWindow")?this.SDKConfig.aliasMaxWindow=e.aliasMaxWindow:this.SDKConfig.aliasMaxWindow=r.DefaultConfig.aliasMaxWindow,e.hasOwnProperty("dataPlanOptions")){var v=e.dataPlanOptions;v.hasOwnProperty("dataPlanVersion")&&v.hasOwnProperty("blockUserAttributes")&&v.hasOwnProperty("blockEventAttributes")&&v.hasOwnProperty("blockEvents")&&v.hasOwnProperty("blockUserIdentities")||t.Logger.error('Ensure your config.dataPlanOptions object has the following keys: a "dataPlanVersion" object, and "blockUserAttributes", "blockEventAttributes", "blockEvents", "blockUserIdentities" booleans')}e.hasOwnProperty("onCreateBatch")&&("function"==typeof e.onCreateBatch?this.SDKConfig.onCreateBatch=e.onCreateBatch:(t.Logger.error("config.onCreateBatch must be a function"),this.SDKConfig.onCreateBatch=void 0))}this._getFromPersistence=function(e,t){return e?(i.syncPersistenceData(),i.persistenceData&&i.persistenceData[e]&&i.persistenceData[e][t]?i.persistenceData[e][t]:null):null},this._setPersistence=function(e,n,r){var o;e&&(i.syncPersistenceData(),i.persistenceData&&(P(i.persistenceData[e])?i.persistenceData[e][n]=r:i.persistenceData[e]=((o={})[n]=r,o),P(i.persistenceData[e][n])&&z(i.persistenceData[e][n])&&delete i.persistenceData[e][n],t._Persistence.savePersistence(i.persistenceData)))},this.hasInvalidIdentifyRequest=function(){var e=i.SDKConfig.identifyRequest;return P(e)&&P(e.userIdentities)&&z(e.userIdentities)||!e},this.getConsentState=function(e){var n=t._Consent.ConsentSerialization.fromMinifiedJsonObject,r=i._getFromPersistence(e,"con");return z(r)?null:n(r)},this.setConsentState=function(e,n){var r=t._Consent.ConsentSerialization.toMinifiedJsonObject;(n||null===n)&&i._setPersistence(e,"con",r(n))},this.getDeviceId=function(){return i.deviceId},this.setDeviceId=function(e){i.deviceId=e,i.persistenceData.gs.das=e,t._Persistence.update()},this.getFirstSeenTime=function(e){return i._getFromPersistence(e,"fst")},this.setFirstSeenTime=function(e,t){if(e){var n=t||(new Date).getTime();i._setPersistence(e,"fst",n)}},this.getLastSeenTime=function(e){if(!e)return null;var n=t.Identity.getCurrentUser();return e===(null==n?void 0:n.getMPID())?(new Date).getTime():i._getFromPersistence(e,"lst")},this.setLastSeenTime=function(e,t){if(e){var n=t||(new Date).getTime();i._setPersistence(e,"lst",n)}},this.getLocalSessionAttributes=function(){return i.localSessionAttributes||{}},this.setLocalSessionAttribute=function(e,n){var r;i.localSessionAttributes[e]=n,i.persistenceData.gs.lsa=p(p({},i.persistenceData.gs.lsa||{}),((r={})[e]=n,r)),t._Persistence.savePersistence(i.persistenceData)},this.syncPersistenceData=function(){var e=t._Persistence.getPersistence();i.persistenceData=re({},i.persistenceData,e)},this.getUserAttributes=function(e){return i._getFromPersistence(e,"ua")||{}},this.setUserAttributes=function(e,t){return i._setPersistence(e,"ua",t)},this.getUserIdentities=function(e){return i._getFromPersistence(e,"ui")||{}},this.setUserIdentities=function(e,t){i._setPersistence(e,"ui",t)},this.getRoktAccountId=function(){return i.roktAccountId},this.setRoktAccountId=function(e){i.roktAccountId=e},this.getIntegrationName=function(){return i.integrationName},this.setIntegrationName=function(e){i.integrationName=e},this.getTimeOnSite=function(){var e;return null===(e=t._timeOnSiteTimer)||void 0===e?void 0:e.getTimeInForeground()},this.getTotalTimeOnSite=function(){return i.sessionStartDate?Date.now()-i.sessionStartDate.getTime():void 0},this.addMpidToSessionHistory=function(e,t){var n=i.currentSessionMPIDs.indexOf(e);e&&t!==e&&n<0?i.currentSessionMPIDs.push(e):n>=0&&(i.currentSessionMPIDs=Q(i.currentSessionMPIDs,n))},this.nullifySession=function(){i.sessionId=null,i.dateLastEventSent=null,i.sessionStartDate=null,i.sessionAttributes={},i.localSessionAttributes={},t._Persistence.update()},this.processConfig=function(e){var r=e.workspaceToken,a=e.requiredWebviewBridgeName;e.flags&&(i.SDKConfig.flags=cr(e)),i.SDKConfig.autoLogPageViewQueryParams=kt(e.autoLogPageViewQueryParams);var u=lr(e,i.SDKConfig.flags,n);for(var c in u)i.SDKConfig[c]=u[c];if(r){i.SDKConfig.workspaceToken=r;var l=ar(null==e?void 0:e.launcherOptions).noFunctional;t._timeOnSiteTimer=new sr(r,l)}else t.Logger.warning("You should have a workspaceToken on your config object for security purposes.");i.storageName=o(r),i.SDKConfig.requiredWebviewBridgeName=a||r,i.webviewBridgeEnabled=s(i.SDKConfig.requiredWebviewBridgeName,i.SDKConfig.minWebviewBridgeVersion),i.configurationLoaded=!0}}function cr(e){var t={},n=r.FeatureFlags,i=n.ReportBatching,o=n.EventBatchingIntervalMillis,s=n.OfflineStorage,a=n.DirectUrlRouting,u=n.CacheIdentity,c=n.AudienceAPI,l=n.CaptureIntegrationSpecificIds,d=n.CaptureIntegrationSpecificIdsV2,p=n.AstBackgroundEvents,g=n.AutoLogPageView,h=n.AutoButtonTracking,v=n.AutoLinkTracking;return e.flags?(t[i]=e.flags[i]||!1,t[o]=C(e.flags[o])||r.DefaultConfig.uploadInterval,t[s]=e.flags[s]||"0",t[a]="True"===e.flags[a],t[u]="True"===e.flags[u],t[c]="True"===e.flags[c],t[l]="True"===e.flags[l],t[d]=e.flags[d]||"none",t[p]="True"===e.flags[p],t[g]="True"===e.flags[g],t[h]="True"===e.flags[h],t[v]="True"===e.flags[v],t):{}}function lr(e,t,n){return n?z(e.domain)&&t.directURLRouting?function(e,t){var n=r.DefaultBaseUrls,i={},o="us1",s=t.split("-"),a=s.length<=1?o:s[0];for(var u in n)if("configUrl"!==u)if(e.hasOwnProperty(u))i[u]=e[u];else{var c=n[u].split(".");i[u]=v([c[0],a],c.slice(1),!0).join(".")}else i[u]=e[u]||n[u];return i}(e,n):dr(e):{}}function dr(e){var t=r.DefaultBaseUrls,n=r.CNAMEUrlPaths,i={};if(!z(e.domain)){for(var o in n)i[o]="".concat(e.domain).concat(n[o]);return i}for(var s in t)i[s]=e[s]||t[s];return i}var pr=function(){function e(e){var t,n;this.logLevel=null!==(t=e.logLevel)&&void 0!==t?t:xe,this.logger=null!==(n=e.logger)&&void 0!==n?n:new gr}return e.prototype.verbose=function(e){this.logLevel!==Re&&this.logger.verbose&&this.logLevel===Ve&&this.logger.verbose(e)},e.prototype.warning=function(e){this.logLevel!==Re&&(!this.logger.warning||this.logLevel!==Ve&&this.logLevel!==xe||this.logger.warning(e))},e.prototype.error=function(e){this.logLevel!==Re&&this.logger.error&&this.logger.error(e)},e.prototype.isVerbose=function(){return this.logLevel===Ve},e.prototype.setLogLevel=function(e){this.logLevel=e},e}(),gr=function(){function e(){}return e.prototype.verbose=function(e){console&&console.info&&console.info(e)},e.prototype.error=function(e){console&&console.error&&console.error(e)},e.prototype.warning=function(e){console&&console.warn&&console.warn(e)},e}(),hr=n.Base64,vr=r.Messages,fr=r.Base64CookieKeys,mr=r.SDKv2NonMPIDCookieKeys,yr=r.StorageNames;function br(){return window.mParticle}function Sr(e){var t=this;function n(n,r,i){var o;return r?(o=function(e,t){return e&&t?re(!1,e,t):e||t}(r,i),n.removeItem(e._Store.storageName)):i&&(o=i),t.storeDataInMemory(o),o}function r(r,i){if(e._Store.isLocalStorageAvailable)return e._Store.SDKConfig.useCookieStorage?n(window.localStorage,r,i):function(n,r){if(r){var i=n||r;return t.storeDataInMemory(i),t.expireCookies(e._Store.storageName),i}t.storeDataInMemory(n)}(r,i);t.storeDataInMemory(i)}function i(t){var n=e._Store;return t.gs.sid=n.sessionId,t.gs.ie=n.isEnabled,t.gs.sa=n.sessionAttributes,t.gs.lsa=n.localSessionAttributes,t.gs.ss=n.serverSettings,t.gs.dt=n.devToken,t.gs.les=n.dateLastEventSent?n.dateLastEventSent.getTime():null,t.gs.av=n.SDKConfig.appVersion,t.gs.cgid=n.clientId,t.gs.das=n.deviceId,t.gs.c=n.context,t.gs.ssd=n.sessionStartDate?n.sessionStartDate.getTime():0,t.gs.ia=n.integrationAttributes,t}function o(n){var r=t.decodePersistence(n);if(!r)return null;var i=JSON.parse(r);return e._Helpers.isObject(i)&&Object.keys(i).length?i:null}function s(e,t){return e.length>t}function a(t,n,r){if(t[n])return e.Logger.verbose("Size of new encoded cookie is larger than maxCookieSize setting of "+r+". Removing from cookie the earliest logged in MPID containing: "+JSON.stringify(t[n],null,2)),void delete t[n];e.Logger.error("Unable to save MPID data to cookies because the resulting encoded cookie is larger than the maxCookieSize setting of "+r+". We recommend using a maxCookieSize of 1500.")}function u(e){var t="https:"===window.location.protocol;window.document.cookie=t?e+";Secure":e}function c(e,n,r){return t.encodePersistence(JSON.stringify(e))+";expires="+n+";path=/"+r}function l(t,n){var r;t[n]&&(r=t[n],Array.isArray(r)?r.length>0:e._Helpers.isObject(r)&&Object.keys(r).length>0)?t[n]=hr.encode(JSON.stringify(t[n])):delete t[n]}function d(t,n){var r=t[n];e._Helpers.isObject(r)&&Object.keys(r).length?t[n]=hr.encode(JSON.stringify(r)):delete t[n]}function p(e){for(var t in e)e.hasOwnProperty(t)&&fr[t]&&d(e,t)}function g(e){for(var t in e)e.hasOwnProperty(t)&&fr[t]&&e[t].length&&(e[t]=JSON.parse(hr.decode(e[t])))}this.useLocalStorage=function(){return!e._Store.SDKConfig.useCookieStorage&&e._Store.isLocalStorageAvailable},this.initializeStorage=function(){var n,i=null;try{var o=t.getLocalStorage();(function(t,n){if(!t&&!n)return e._Store.isFirstRun=!0,void(e._Store.mpid=0);e._Store.isFirstRun=!1})(o,i=t.getCookie()),e._Store.isLocalStorageAvailable||(e._Store.SDKConfig.useCookieStorage=!0),!function(t){for(var n in t)t.hasOwnProperty(n)&&!mr[n]&&(e._Store.nonCurrentUserMPIDs[n]=t[n])}(r(o,i)),t.update()}catch(r){n=Boolean(i),t.useLocalStorage()&&e._Store.isLocalStorageAvailable?n||localStorage.removeItem(e._Store.storageName):t.expireCookies(e._Store.storageName),e.Logger.error("Error initializing storage: "+r)}},this.update=function(){e._Store.webviewBridgeEnabled||(e._Store.SDKConfig.useCookieStorage&&t.setCookie(),t.setLocalStorage())},this.storeDataInMemory=function(t,n){try{if(!t)return e.Logger.verbose(vr.InformationMessages.CookieNotFound),e._Store.clientId=e._Store.clientId||e._Helpers.generateUniqueId(),void(e._Store.deviceId=e._Store.deviceId||e._Helpers.generateUniqueId());!function(t,n){e._Store.mpid=n||t.cu||0,t.gs=t.gs||{},e._Store.sessionId=t.gs.sid||e._Store.sessionId,e._Store.isEnabled=void 0!==t.gs.ie?t.gs.ie:e._Store.isEnabled,e._Store.sessionAttributes=t.gs.sa||e._Store.sessionAttributes,e._Store.localSessionAttributes=t.gs.lsa||e._Store.localSessionAttributes,e._Store.serverSettings=t.gs.ss||e._Store.serverSettings,e._Store.devToken=e._Store.devToken||t.gs.dt,e._Store.SDKConfig.appVersion=e._Store.SDKConfig.appVersion||t.gs.av,e._Store.clientId=t.gs.cgid||e._Store.clientId||e._Helpers.generateUniqueId(),e._Store.deviceId=e._Store.deviceId||t.gs.das||e._Helpers.generateUniqueId(),e._Store.integrationAttributes=t.gs.ia||{},e._Store.context=t.gs.c||e._Store.context,e._Store.currentSessionMPIDs=t.gs.csm||e._Store.currentSessionMPIDs,e._Store.isLoggedIn=!0===t.l,t.gs.les&&(e._Store.dateLastEventSent=new Date(t.gs.les)),e._Store.sessionStartDate=t.gs.ssd?new Date(t.gs.ssd):new Date,t=n?t[n]:t[t.cu]}(t,n)}catch(t){e.Logger.error(vr.ErrorMessages.CookieParseError)}},this.determineLocalStorageAvailability=function(e){var t=br();if(null==t?void 0:t._forceNoLocalStorage)return!1;try{e.setItem("mparticle","test");var n="test"===e.getItem("mparticle");return e.removeItem("mparticle"),Boolean(n&&e)}catch(e){return!1}},this.setLocalStorage=function(){var n;if(e._Store.isLocalStorageAvailable&&!(null===(n=e._CookieConsentManager)||void 0===n?void 0:n.getNoFunctional())){var r=e._Store.storageName,o=t.getLocalStorage()||{},s=e.Identity.getCurrentUser(),a=s?s.getMPID():null;if(!e._Store.SDKConfig.useCookieStorage){o.gs=o.gs||{},o.l=e._Store.isLoggedIn?1:0,e._Store.sessionId&&(o.gs.csm=e._Store.currentSessionMPIDs),o.gs.ie=e._Store.isEnabled,a&&(o.cu=a),Object.keys(e._Store.nonCurrentUserMPIDs).length&&(o=re({},o,e._Store.nonCurrentUserMPIDs),e._Store.nonCurrentUserMPIDs={}),o=i(o);try{window.localStorage.setItem(encodeURIComponent(r),t.encodePersistence(JSON.stringify(o)))}catch(t){e.Logger.error("Error with setting localStorage item.")}}}},this.getLocalStorage=function(){return e._Store.isLocalStorageAvailable?o(window.localStorage.getItem(e._Store.storageName)):null},this.expireCookies=function(e){var n,r,i=new Date;n=""===(r=t.getCookieDomain())?"":";domain="+r,i.setTime(i.getTime()-864e5),u(e+"="+("; expires="+i.toUTCString())+"; path=/"+n)},this.getCookie=function(){var t,n,r,i,s,a,u=e._Store.storageName;e.Logger.verbose(vr.InformationMessages.CookieSearch);try{t=window.document.cookie.split("; ")}catch(t){return e.Logger.verbose("Unable to parse undefined cookie"),null}for(n=0,r=t.length;n<r;n++){try{s=(i=t[n].split("=")).shift(),a=i.join("=")}catch(t){e.Logger.verbose("Unable to parse cookie: "+s+". Skipping.")}if(u&&u===s){var c=o(e._Helpers.converted(a));if(c)return e.Logger.verbose(vr.InformationMessages.CookieFound),c}}return null},this.setCookie=function(){var n;if(!(null===(n=e._CookieConsentManager)||void 0===n?void 0:n.getNoFunctional())){var r,o=e.Identity.getCurrentUser();o&&(r=o.getMPID());var s,a,c,l=new Date,d=e._Store.storageName,p=t.getCookie()||{},g=new Date(l.getTime()+24*e._Store.SDKConfig.cookieExpiration*60*60*1e3).toUTCString();a=""===(s=t.getCookieDomain())?"":";domain="+s,p.gs=p.gs||{},e._Store.sessionId&&(p.gs.csm=e._Store.currentSessionMPIDs),r&&(p.cu=r),p.l=e._Store.isLoggedIn?1:0,p=i(p),Object.keys(e._Store.nonCurrentUserMPIDs).length&&(p=re({},p,e._Store.nonCurrentUserMPIDs),e._Store.nonCurrentUserMPIDs={}),c=t.reduceAndEncodePersistence(p,g,a,e._Store.SDKConfig.maxCookieSize),e.Logger.verbose(vr.InformationMessages.CookieSet),u(encodeURIComponent(d)+"="+c)}},this.reduceAndEncodePersistence=function(e,t,n,r){var i=e.gs.csm?e.gs.csm:[];if(!i.length)return function(e,t,n,r){var i;for(var o in e)e.hasOwnProperty(o)&&s(i=c(e,t,n),r)&&(mr[o]||o===e.cu||delete e[o]);return i}(e,t,n,r);var o=function(e){var t={};for(var n in e)e.hasOwnProperty(n)&&(mr[n]||n===e.cu||(t[n]=1));return t}(e);return Object.keys(o).length&&function(e,t,n,r,i,o){var a;for(var u in t)s(a=c(e,r,i),o)&&t.hasOwnProperty(u)&&-1===n.indexOf(u)&&delete e[u]}(e,o,i,t,n,r),function(e,t,n,r,i){for(var o,u=0;u<t.length&&s(o=c(e,n,r),i);u++)a(e,t[u],i);return o}(e,i,t,n,r)},this.encodePersistence=function(e){var t=JSON.parse(e);return function(e){for(var t in e)e.hasOwnProperty(t)&&(fr[t]?l(e,t):"ie"!==t?e[t]||delete e[t]:e[t]=e[t]?1:0)}(t.gs),function(e){for(var t in e)e.hasOwnProperty(t)&&(mr[t]||p(e[t]))}(t),m(JSON.stringify(t))},this.decodePersistence=function(t){try{if(!t)return;var n=JSON.parse(y(t));return e._Helpers.isObject(n)&&Object.keys(n).length&&(function(e){for(var t in e)e.hasOwnProperty(t)&&(fr[t]?(e[t]=JSON.parse(hr.decode(e[t])),"csm"!==t||Array.isArray(e[t])||delete e[t]):"ie"===t&&(e[t]=Boolean(e[t])))}(n.gs),function(t){for(var n in t)if(t.hasOwnProperty(n))if(mr[n])"l"===n&&(t[n]=Boolean(t[n]));else{if(!e._Helpers.isObject(t[n])){delete t[n];continue}g(t[n])}}(n)),JSON.stringify(n)}catch(t){e.Logger.error("Problem with decoding cookie")}},this.getCookieDomain=function(){if(e._Store.SDKConfig.cookieDomain)return e._Store.SDKConfig.cookieDomain;var n=t.getDomain(document,location.hostname);return""===n?"":"."+n},this.getDomain=function(e,t){var n,r,i="mptest=cookie",o=t.split(".");for(n=o.length-1;n>=0;n--)if(r=o.slice(n).join("."),e.cookie=i+";domain=."+r+";",e.cookie.indexOf(i)>-1)return e.cookie=i.split("=")[0]+"=;domain=."+r+";expires=Thu, 01 Jan 1970 00:00:01 GMT;",r;return""},this.saveUserCookieSyncDatesToPersistence=function(n,r){if(r){var i=t.getPersistence();i&&(e._Helpers.isObject(i[n])?i[n].csd=r:i[n]={csd:r}),t.savePersistence(i)}},this.swapCurrentUser=function(e,n,r){if(e&&n&&e!==n){var i=t.getPersistence();i&&(i.cu=n,i.gs.csm=r,t.savePersistence(i))}},this.savePersistence=function(n){var r;if(!(null===(r=e._CookieConsentManager)||void 0===r?void 0:r.getNoFunctional())){var i,o=t.encodePersistence(JSON.stringify(n)),s=new Date,a=e._Store.storageName,c=new Date(s.getTime()+24*e._Store.SDKConfig.cookieExpiration*60*60*1e3).toUTCString(),l=t.getCookieDomain();if(i=""===l?"":";domain="+l,e._Store.SDKConfig.useCookieStorage){var d=t.reduceAndEncodePersistence(n,c,i,e._Store.SDKConfig.maxCookieSize);u(encodeURIComponent(a)+"="+d)}else if(e._Store.isLocalStorageAvailable)try{localStorage.setItem(e._Store.storageName,o)}catch(t){e.Logger.error("Error saving persistence to localStorage.")}}},this.getPersistence=function(){return this.useLocalStorage()?this.getLocalStorage():this.getCookie()},this.getFirstSeenTime=function(e){if(!e)return null;var n=t.getPersistence();return n&&n[e]&&n[e].fst?n[e].fst:null},this.setFirstSeenTime=function(n,r){if(n){r||(r=(new Date).getTime());var i=t.getPersistence();i&&(e._Helpers.isObject(i[n])||(i[n]={}),i[n].fst||(i[n].fst=r,t.savePersistence(i)))}},this.getLastSeenTime=function(n){if(!n)return null;if(n===e.Identity.getCurrentUser().getMPID())return(new Date).getTime();var r=t.getPersistence();return r&&r[n]&&r[n].lst?r[n].lst:null},this.setLastSeenTime=function(n,r){if(n){r||(r=(new Date).getTime());var i=t.getPersistence();i&&e._Helpers.isObject(i[n])&&(i[n].lst=r,t.savePersistence(i))}},this.getDeviceId=function(){return e._Store.deviceId},this.setDeviceId=function(n){e._Store.deviceId=n,t.update()},this.resetPersistence=function(){localStorage.clear(),t.expireCookies(yr.cookieName),t.expireCookies(yr.cookieNameV2),t.expireCookies(yr.cookieNameV3),t.expireCookies(yr.cookieNameV4),t.expireCookies(e._Store.storageName);var n=br();if(null==n?void 0:n._isTestEnv){var r="abcdef";localStorage.removeItem(e._Helpers.createMainStorageName(r)),t.expireCookies(e._Helpers.createMainStorageName(r))}},this.forwardingStatsBatches={uploadsTable:{},forwardingStatsEventQueue:[]}}var Ir=r.Messages;function _r(e){var t=this;this.logEvent=function(t,n){if(e.Logger.verbose(Ir.InformationMessages.StartingLogEvent+": "+t.name),e._Helpers.canLog()){var r=e._ServerModel.createEventObject(t);e._APIClient.sendEventToServer(r,n)}else e.Logger.verbose(Ir.InformationMessages.AbandonLogEvent)},this.startTracking=function(t){if(e._Store.isTracking){var n={coords:{latitude:e._Store.currentPosition.lat,longitude:e._Store.currentPosition.lng}};r(t,n)}else"geolocation"in navigator&&(e._Store.watchPositionId=navigator.geolocation.watchPosition((function(n){e._Store.currentPosition={lat:n.coords.latitude,lng:n.coords.longitude},r(t,n),t=null,e._Store.isTracking=!0}),(function(){r(t),t=null,e._Store.isTracking=!1})));function r(t,n){if(t)try{n?t(n):t()}catch(t){e.Logger.error("Error invoking the callback passed to startTrackingLocation."),e.Logger.error(t)}}},this.stopTracking=function(){e._Store.isTracking&&(navigator.geolocation.clearWatch(e._Store.watchPositionId),e._Store.currentPosition=null,e._Store.isTracking=!1)},this.logOptOut=function(){e.Logger.verbose(Ir.InformationMessages.StartingLogOptOut);var t=e._ServerModel.createEventObject({messageType:me.MessageType.OptOut,eventType:me.EventType.Other});e._APIClient.sendEventToServer(t)},this.logAST=function(){t.logEvent({messageType:me.MessageType.AppStateTransition})},this.logPageView=function(n){var r;t.logEvent({messageType:me.MessageType.PageView,name:"PageView",data:p(p(p({},Ot(Dt(X(),null===(r=e._Store.SDKConfig.autoLogPageViewQueryParams)||void 0===r?void 0:r.allowed))),{hostname:window.location.hostname,title:window.document.title}),Mt(n&&n.isAutoPageView)),eventType:me.EventType.Unknown})},this.logProductActionEvent=function(n,r,i,o,s,a){var u=e._Ecommerce.createCommerceEventObject(o,a),c=Array.isArray(r)?r:[r];c.forEach((function(t){t.TotalAmount&&(t.TotalAmount=e._Ecommerce.sanitizeAmount(t.TotalAmount,"TotalAmount")),t.Position&&(t.Position=e._Ecommerce.sanitizeAmount(t.Position,"Position")),t.Price&&(t.Price=e._Ecommerce.sanitizeAmount(t.Price,"Price")),t.Quantity&&(t.Quantity=e._Ecommerce.sanitizeAmount(t.Quantity,"Quantity"))})),u&&(u.EventCategory=e._Ecommerce.convertProductActionToEventType(n),u.EventName+=e._Ecommerce.getProductActionEventName(n),u.ProductAction={ProductActionType:n,ProductList:c},me.ProductActionType.isRoktCommerceType(n)&&(u.CustomFlags=u.CustomFlags||{},u.CustomFlags["Rokt.CommerceEventType"]=me.ProductActionType.getExpansionName(n)),e._Helpers.isObject(s)&&e._Ecommerce.convertTransactionAttributesToProductAction(s,u.ProductAction),t.logCommerceEvent(u,i,a))},this.logPurchaseEvent=function(n,r,i,o){var s=e._Ecommerce.createCommerceEventObject(o);s&&(s.EventName+=e._Ecommerce.getProductActionEventName(me.ProductActionType.Purchase),s.EventCategory=me.CommerceEventType.ProductPurchase,s.ProductAction={ProductActionType:me.ProductActionType.Purchase,ProductList:Array.isArray(r)?r:[r]},e._Ecommerce.convertTransactionAttributesToProductAction(n,s.ProductAction),t.logCommerceEvent(s,i))},this.logPromotionEvent=function(n,r,i,o,s){var a=e._Ecommerce.createCommerceEventObject(o);a&&(a.EventName+=e._Ecommerce.getPromotionActionEventName(n),a.EventCategory=e._Ecommerce.convertPromotionActionToEventType(n),a.PromotionAction={PromotionActionType:n,PromotionList:Array.isArray(r)?r:[r]},t.logCommerceEvent(a,i,s))},this.logImpressionEvent=function(n,r,i,o){var s=e._Ecommerce.createCommerceEventObject(i);s&&(s.EventName+="Impression",s.EventCategory=me.CommerceEventType.ProductImpression,Array.isArray(n)||(n=[n]),s.ProductImpressions=[],n.forEach((function(e){s.ProductImpressions.push({ProductImpressionList:e.Name,ProductList:Array.isArray(e.Product)?e.Product:[e.Product]})})),t.logCommerceEvent(s,r,o))},this.logCommerceEvent=function(t,n,r){if(e.Logger.verbose(Ir.InformationMessages.StartingLogCommerceEvent),t.ProductAction&&null===t.EventCategory)e.Logger.error("Commerce event not sent. The mParticle.ProductActionType you passed was invalid. Re-check your code.");else{var i=e._Helpers.sanitizeAttributes(n,t.EventName);e._Helpers.canLog()?(i&&(t.EventAttributes=i),t.ProductAction&&e._Ecommerce.calculateProductActionTotalAmount(t.ProductAction),e._APIClient.sendEventToServer(t,r),e._Persistence.update()):e.Logger.verbose(Ir.InformationMessages.AbandonLogEvent)}},this.addEventHandler=function(n,r,i,o,s){var a,u=[];if(r)if("string"==typeof r?u=document.querySelectorAll(r):r.nodeType&&(u=[r]),u.length){e.Logger.verbose("Found "+u.length+" element"+(u.length>1?"s":"")+", attaching event handlers");var c=function(){var r=u[a],c=function(n){!function(n,r){e.Logger.verbose("DOM event triggered, handling event"),t.logEvent({messageType:me.MessageType.PageEvent,name:"function"==typeof i?i(r):i,data:"function"==typeof o?o(r):o,eventType:s||me.EventType.Other}),(r.href&&"_blank"!==r.target||r.submit)&&(n.preventDefault?n.preventDefault():n.returnValue=!1,setTimeout((function(){r.href?window.location.href=r.href:r.submit&&r.submit()}),e._Store.SDKConfig.timeout))}(n,r)};r.addEventListener?r.addEventListener(n,c,!1):r.attachEvent?r.attachEvent("on"+n,c):r["on"+n]=c};for(a=0;a<u.length;a++)c()}else e.Logger.verbose("No elements found");else e.Logger.error("Can't bind event, selector is required")}}function wr(e,t){return!(null==e?void 0:e.isAttributeKeyBlocked(t))}function Pr(e,t){return!(null==e?void 0:e.isIdentityBlocked(t))}function Cr(e,t,n,r){function i(){var i=function(e,t){var n,r={};if(!e)return r;for(var i in e)W(e,i)&&!J(i)&&wr(t,i)&&(r[i]=(n=e[i],Array.isArray(n)?n.slice():n));return r}(n._Store.getUserAttributes(e),r);return n._Helpers.filterUserAttributes(i,t.userAttributeFilters)}return{getUserIdentities:function(){var i=function(e,t){var n={},r=e;for(var i in r)if(W(r,i)){var o=ve(i);if(null!==o){var s=me.IdentityType.getIdentityName(o);Pr(t,s)&&(n[s]=r[i])}}return n}(n._Store.getUserIdentities(e),r);return{userIdentities:i=n._Helpers.filterUserIdentitiesForForwarders(i,t.userIdentityFilters)}},getMPID:function(){return e},getUserAttributesLists:function(e){var t=function(e,t){var n={};for(var r in e)W(e,r)&&!J(r)&&Array.isArray(e[r])&&wr(t,r)&&(n[r]=e[r].slice());return n}(i(),r);return n._Helpers.filterUserAttributes(t,e.userAttributeFilters)},getAllUserAttributes:i}}var Ar,Tr=[me.MessageType.PageEvent,me.MessageType.PageView,me.MessageType.Commerce];function kr(e,t){return!(!e||!e.length)&&b(e,t)}function Er(e,t,n){var r=n&&n.kitBlockingEnabled?n.createBlockedEvent(e):e;if(!r)return!1;if(function(e,t,n){if(!(Tr.includes(e)&&n.filteringEventAttributeValue&&n.filteringEventAttributeValue.eventAttributeName&&n.filteringEventAttributeValue.eventAttributeValue))return!1;var r=null;if(t)for(var i in t)if(t.hasOwnProperty(i)){var o=Bn.hashAttributeConditionalForwarding(i);if(o===n.filteringEventAttributeValue.eventAttributeName){r={name:o,value:Bn.hashAttributeConditionalForwarding(t[i])};break}}var s=null!==r&&r.value===n.filteringEventAttributeValue.eventAttributeValue;return!(!0===n.filteringEventAttributeValue.includeOnMatch?s:!s)}(r.EventDataType,r.EventAttributes,t))return!1;var i=r.EventCategory;return!function(e,t,n,r){return!(e!==me.MessageType.PageEvent||!kr(r.eventNameFilters,t)&&!kr(r.eventTypeFilters,n))||!(e!==me.MessageType.Commerce||!kr(r.eventTypeFilters,n))||!(e!==me.MessageType.PageView||!kr(r.screenNameFilters,t))}(r.EventDataType,Bn.hashEventName(r.EventName,i),Bn.hashEventType(i),t)}var Dr=r.IdentityMethods,Or=Dr.Modify,Mr=Dr.Identify,Lr=Dr.Login,Fr=Dr.Logout,Ur=((Ar={})[Mr]="onIdentifyComplete",Ar[Lr]="onLoginComplete",Ar[Fr]="onLogoutComplete",Ar[Or]="onModifyComplete",Ar);function Nr(e,t){var n=e,r={};for(var i in n)n.hasOwnProperty(i)&&Pr(t,i)&&(r[i]=n[i]);return r}function Rr(e,t){var n=this,r=this;this.forwarderStatsUploader=new Kn(e,t).initializeForwarderStatsUploader();var i="setUserAttribute",o="removeUserAttribute";this.initForwarders=function(n,i){var o=e.Identity.getCurrentUser();if(!e._Store.webviewBridgeEnabled&&e._Store.configuredForwarders){var s=Nr(n,t);e._Store.configuredForwarders.sort((function(e,t){return e.settings.PriorityValue=e.settings.PriorityValue||0,t.settings.PriorityValue=t.settings.PriorityValue||0,-1*(e.settings.PriorityValue-t.settings.PriorityValue)})),e._Store.activeForwarders=e._Store.configuredForwarders.filter((function(n){if(!e._Consent.isEnabledForUserConsent(n.filteringConsentRuleValues,o))return!1;if(!r.isEnabledForUserAttributes(n.filteringUserAttributeValue,o))return!1;if(!r.isEnabledForUnknownUser(n.excludeAnonymousUser,o))return!1;var a=e._Helpers.filterUserIdentities(s,n.userIdentityFilters),u=o?Cr(o.getMPID(),n,e,t).getAllUserAttributes():{};return n.initialized||(n.logger=e.Logger,n.init(n.settings,i,!1,null,u,a,e._Store.SDKConfig.appVersion,e._Store.SDKConfig.appName,e._Store.SDKConfig.customFlags,e._Store.clientId),n.initialized=!0),!0}))}},this.isEnabledForUserAttributes=function(t,n){if(!t||!e._Helpers.isObject(t)||!Object.keys(t).length)return!0;if(!n)return!1;var r=n.getAllUserAttributes();try{var i=!!(r&&e._Helpers.isObject(r)&&Object.keys(r).length>0)&&function(e,t){for(var n in e)if(W(e,n)){var r=Bn.hashAttributeConditionalForwarding(n),i=Bn.hashAttributeConditionalForwarding(e[n]);if(r===t.userAttributeName&&i===t.userAttributeValue)return!0}return!1}(r,t);return t.includeOnMatch===i}catch(e){return!0}},this.isEnabledForUnknownUser=function(e,t){return!!(t&&t.isLoggedIn()||!e)},this.applyToForwarders=function(t,n){e._Store.activeForwarders.length&&e._Store.activeForwarders.forEach((function(r){if(r[t])try{var i=r[t](n);i&&e.Logger.verbose(i)}catch(t){e.Logger.verbose(t)}}))},this.sendEventToForwarders=function(t){if(!e._Store.webviewBridgeEnabled&&e._Store.activeForwarders){var n=function(n){if(Er(t,n)){var r,i,o=re(!0,{},t);if(o.EventAttributes=function(e,t,n,r,i){if(!r)return r;var o;if(e===me.MessageType.PageEvent?o=i.attributeFilters:e===me.MessageType.PageView&&(o=i.screenAttributeFilters),!o)return r;var s={};for(var a in r)if(r.hasOwnProperty(a)){var u=Bn.hashEventAttributeKey(t,n,a);b(o,u)||(s[a]=r[a])}return s}(t.EventDataType,t.EventCategory,t.EventName,o.EventAttributes,n),o.UserIdentities=(r=o.UserIdentities,i=n.userIdentityFilters,r&&r.length?r.filter((function(e){return!b(i,Bn.hashUserIdentity(e.Type))})):r||[]),o.UserAttributes=Bn.filterUserAttributes(o.UserAttributes,n.userAttributeFilters),n.process){e.Logger.verbose("Sending message to forwarder: "+n.name);var s=n.process(o);s&&e.Logger.verbose(s)}}};e._Store.activeForwarders.forEach((function(e){n(e)}))}},this.handleForwarderUserAttributes=function(n,r,s){t&&t.isAttributeKeyBlocked(r)||!e._Store.activeForwarders.length||e._Store.activeForwarders.forEach((function(t){if(t[n]&&!Bn.isFilteredUserAttribute(r,t.userAttributeFilters))try{var a=void 0;n===i?a=t.setUserAttribute(r,s):n===o&&(a=t.removeUserAttribute(r)),a&&e.Logger.verbose(a)}catch(t){e.Logger.error(t)}}))},this.setForwarderUserIdentities=function(n){var r=Nr(n,t);e._Store.activeForwarders.forEach((function(t){var n=e._Helpers.filterUserIdentities(r,t.userIdentityFilters);t.setUserIdentity&&n.forEach((function(n){var r=t.setUserIdentity(n.Identity,n.Type);r&&e.Logger.verbose(r)}))}))},this.setForwarderOnUserIdentified=function(n){e._Store.activeForwarders.forEach((function(r){var i=Cr(n.getMPID(),r,e,t);if(r.onUserIdentified){var o=r.onUserIdentified(i);o&&e.Logger.verbose(o)}}))},this.setForwarderOnIdentityComplete=function(n,r){var i=Ur[r];i&&e._Store.activeForwarders.forEach((function(r){var o=r[i];if(o){var s=Cr(n.getMPID(),r,e,t),a=o.call(r,s,s.getUserIdentities());a&&e.Logger.verbose(a)}}))},this.getForwarderStatsQueue=function(){return e._Persistence.forwardingStatsBatches.forwardingStatsEventQueue},this.setForwarderStatsQueue=function(t){e._Persistence.forwardingStatsBatches.forwardingStatsEventQueue=t},this.processForwarders=function(t,n){t?(this.processUIEnabledKits(t),this.processSideloadedKits(t),r.initForwarders(e._Store.SDKConfig.identifyRequest.userIdentities,n)):e.Logger.warning("No config was passed. Cannot process forwarders")},this.processUIEnabledKits=function(t){var n=this.returnKitConstructors();try{Array.isArray(t.kitConfigs)&&t.kitConfigs.length&&t.kitConfigs.forEach((function(e){r.configureUIEnabledKit(e,n)}))}catch(t){e.Logger.error("MP Kits not configured propertly. Kits may not be initialized. "+t)}},this.returnKitConstructors=function(){var t={};return z(e._Store.SDKConfig.kits)?z(e._preInit.forwarderConstructors)||e._preInit.forwarderConstructors.forEach((function(e){if(e.suffix){var n="".concat(e.name,"-").concat(e.suffix);t[n]=e}else t[e.name]=e})):t=e._Store.SDKConfig.kits,t},this.configureUIEnabledKit=function(t,n){var r=null,i=t;for(var o in n){var s=void 0;if(i.suffix&&(s="".concat(i.name,"-").concat(i.suffix)),!(o!==s&&o!==i.name||i.isDebug!==e._Store.SDKConfig.isDevelopmentMode&&i.isSandbox!==e._Store.SDKConfig.isDevelopmentMode)){r=this.returnConfiguredKit(n[o],i),e._Store.configuredForwarders.push(r);break}}},this.processSideloadedKits=function(t){try{if(Array.isArray(t.sideloadedKits)){var n={kits:{}},i=t.sideloadedKits;for(var o in i.forEach((function(e){try{e.kitInstance.register(n);var t=e.kitInstance.name;n.kits[t].filters=e.filterDictionary}catch(t){console.error("Error registering sideloaded kit "+e.kitInstance.name)}})),n.kits){var s=n.kits[o];r.configureSideloadedKit(s)}if(!z(n.kits)){var a=Object.keys(n.kits);e._Store.sideloadedKitsCount=a.length}}}catch(t){e.Logger.error("Sideloaded Kits not configured propertly. Kits may not be initialized. "+t)}},this.configureSideloadedKit=function(t){e._Store.configuredForwarders.push(this.returnConfiguredKit(t,t.filters))},this.returnConfiguredKit=function(e,t){void 0===t&&(t={});var n=new e.constructor;return n.id=t.moduleId,n.isSandbox=t.isDebug||t.isSandbox,n.hasSandbox="true"===t.hasDebugString,n.isVisible=t.isVisible||!0,n.settings=t.settings||{},n.eventNameFilters=t.eventNameFilters||[],n.eventTypeFilters=t.eventTypeFilters||[],n.attributeFilters=t.attributeFilters||[],n.screenNameFilters=t.screenNameFilters||[],n.screenAttributeFilters=t.screenAttributeFilters||[],n.userIdentityFilters=t.userIdentityFilters||[],n.userAttributeFilters=t.userAttributeFilters||[],n.filteringEventAttributeValue=t.filteringEventAttributeValue||{},n.filteringUserAttributeValue=t.filteringUserAttributeValue||{},n.eventSubscriptionId=t.eventSubscriptionId||null,n.filteringConsentRuleValues=t.filteringConsentRuleValues||{},n.excludeAnonymousUser=t.excludeAnonymousUser||!1,n},this.configurePixel=function(t){t.isDebug!==e._Store.SDKConfig.isDevelopmentMode&&t.isProduction===e._Store.SDKConfig.isDevelopmentMode||e._Store.pixelConfigurations.push(t)},this.processPixelConfigs=function(t){try{z(t.pixelConfigs)||t.pixelConfigs.forEach((function(e){r.configurePixel(e)}))}catch(t){e.Logger.error("Cookie Sync configs not configured propertly. Cookie Sync may not be initialized. "+t)}},this.sendSingleForwardingStatsToServer=function(t){return g(n,void 0,void 0,(function(){var n,r,i,o;return h(this,(function(s){switch(s.label){case 0:return n={method:"post",body:JSON.stringify(t),headers:{Accept:"text/plain;charset=UTF-8","Content-Type":"text/plain;charset=UTF-8"}},[4,this.forwarderStatsUploader.upload(n)];case 1:return r=s.sent(),i=202===r.status?"Successfully sent forwarding stats to mParticle Servers":"Issue with forwarding stats to mParticle Servers, received HTTP Code of "+r.statusText,null===(o=null==e?void 0:e.Logger)||void 0===o||o.verbose(i),[2]}}))}))}}var Vr=me.MessageType,xr=me.ApplicationTransitionType;function Hr(e){return e?e.map((function(e){return function(e){return{id:A(e.Sku),nm:A(e.Name),pr:C(e.Price),qt:C(e.Quantity),br:A(e.Brand),va:A(e.Variant),ca:A(e.Category),ps:C(e.Position),cc:A(e.CouponCode),tpa:C(e.TotalAmount),attrs:e.Attributes}}(e)})):[]}function Kr(e){var t=this;this.convertToConsentStateV2DTO=function(e){if(!e)return null;var t={},n=e.getGDPRConsentState();if(n){var r={};for(var i in t.gdpr=r,n)if(n.hasOwnProperty(i)){var o=n[i];t.gdpr[i]={},"boolean"==typeof o.Consented&&(r[i].c=o.Consented),"number"==typeof o.Timestamp&&(r[i].ts=o.Timestamp),"string"==typeof o.ConsentDocument&&(r[i].d=o.ConsentDocument),"string"==typeof o.Location&&(r[i].l=o.Location),"string"==typeof o.HardwareId&&(r[i].h=o.HardwareId)}}var s=e.getCCPAConsentState();return s&&(t.ccpa={data_sale_opt_out:{c:s.Consented,ts:s.Timestamp,d:s.ConsentDocument,l:s.Location,h:s.HardwareId}}),t},this.createEventObject=function(t,n){var i,o,s,a={},u={},c=t.messageType===me.MessageType.OptOut?!e._Store.isEnabled:null;if(e._Store.sessionId||t.messageType===me.MessageType.OptOut||e._Store.webviewBridgeEnabled){var l=p({},t.customFlags),d=e._Store.integrationAttributes;if(Qe(e._Helpers.getFeatureFlag)){e._IntegrationCapture.capture();var g=e._IntegrationCapture.getClickIdsAsCustomFlags();l=p(p({},g),l);var h=e._IntegrationCapture.getClickIdsAsIntegrationAttributes();d=p(p({},h),d)}return u=t.hasOwnProperty("toEventAPIObject")?t.toEventAPIObject():{EventName:t.name||String(t.messageType),EventCategory:t.eventType,EventAttributes:e._Helpers.sanitizeAttributes(t.data,t.name),ActiveTimeOnSite:null===(i=e._timeOnSiteTimer)||void 0===i?void 0:i.getTimeInForeground(),TotalTimeOnSite:null===(s=(o=e._Store).getTotalTimeOnSite)||void 0===s?void 0:s.call(o),PageUrl:rn()||null,SourceMessageId:t.sourceMessageId||e._Helpers.generateUniqueId(),EventDataType:t.messageType,CustomFlags:l,UserAttributeChanges:t.userAttributeChanges,UserIdentityChanges:t.userIdentityChanges},t.messageType!==me.MessageType.SessionEnd&&(e._Store.dateLastEventSent=new Date),a={Store:e._Store.serverSettings,SDKVersion:r.sdkVersion,SessionId:e._Store.sessionId,SessionStartDate:e._Store.sessionStartDate?e._Store.sessionStartDate.getTime():0,Debug:e._Store.SDKConfig.isDevelopmentMode,Location:e._Store.currentPosition,OptOut:c,ExpandedEventCount:0,AppVersion:e.getAppVersion(),AppName:e.getAppName(),Package:e._Store.SDKConfig.package,ClientGeneratedId:e._Store.clientId,DeviceId:e._Store.deviceId,IntegrationAttributes:d,CurrencyCode:e._Store.currencyCode,DataPlan:e._Store.SDKConfig.dataPlan?e._Store.SDKConfig.dataPlan:{}},u.EventDataType===Vr.AppStateTransition&&(u.IsFirstRun=e._Store.isFirstRun,u.LaunchReferral=rn()||null),u.CurrencyCode=e._Store.currencyCode,pn(n||e.Identity.getCurrentUser(),u),t.messageType===me.MessageType.SessionEnd&&(u.SessionLength=e._Store.dateLastEventSent.getTime()-e._Store.sessionStartDate.getTime(),u.currentSessionMPIDs=e._Store.currentSessionMPIDs,u.EventAttributes=e._Store.sessionAttributes,e._Store.currentSessionMPIDs=[],e._Store.sessionStartDate=null),a.Timestamp=e._Store.dateLastEventSent.getTime(),re({},u,a)}return null},this.convertEventToV2DTO=function(n){var r={n:n.EventName,et:n.EventCategory,ua:n.UserAttributes,ui:n.UserIdentities,ia:n.IntegrationAttributes,str:n.Store,attrs:n.EventAttributes,sdk:n.SDKVersion,sid:n.SessionId,sl:n.SessionLength,ssd:n.SessionStartDate,dt:n.EventDataType,dbg:n.Debug,ct:n.Timestamp,lc:n.Location,o:n.OptOut,eec:n.ExpandedEventCount,av:n.AppVersion,cgid:n.ClientGeneratedId,das:n.DeviceId,mpid:n.MPID,smpids:n.currentSessionMPIDs};n.DataPlan&&n.DataPlan.PlanId&&(r.dp_id=n.DataPlan.PlanId,n.DataPlan.PlanVersion&&(r.dp_v=n.DataPlan.PlanVersion));var i=t.convertToConsentStateV2DTO(n.ConsentState);return i&&(r.con=i),n.EventDataType===Vr.AppStateTransition&&(r.fr=n.IsFirstRun,r.iu=!1,r.at=xr.AppInit,r.lr=n.LaunchReferral,r.attrs=null),n.CustomFlags&&function(e,t){var n=[];for(var r in t.flags={},e.CustomFlags)n=[],e.CustomFlags.hasOwnProperty(r)&&(Array.isArray(e.CustomFlags[r])?e.CustomFlags[r].forEach((function(e){B(e)&&n.push(e.toString())})):B(e.CustomFlags[r])&&n.push(e.CustomFlags[r].toString()),n.length&&(t.flags[r]=n))}(n,r),n.EventDataType===Vr.Commerce?(r.cu=n.CurrencyCode,n.ProductAction?r.pd={an:n.ProductAction.ProductActionType,cs:e._Helpers.parseNumber(n.ProductAction.CheckoutStep),co:n.ProductAction.CheckoutOptions,pl:Hr(n.ProductAction.ProductList),ti:n.ProductAction.TransactionId,ta:n.ProductAction.Affiliation,tcc:n.ProductAction.CouponCode,tr:e._Helpers.parseNumber(n.ProductAction.TotalAmount),ts:e._Helpers.parseNumber(n.ProductAction.ShippingAmount),tt:e._Helpers.parseNumber(n.ProductAction.TaxAmount)}:n.PromotionAction?r.pm={an:n.PromotionAction.PromotionActionType,pl:n.PromotionAction.PromotionList.map((function(e){return{id:e.Id,nm:e.Name,cr:e.Creative,ps:e.Position?e.Position:0}}))}:n.ProductImpressions&&(r.pi=n.ProductImpressions.map((function(e){return{pil:e.ProductImpressionList,pl:Hr(e.ProductList)}})))):n.EventDataType===Vr.Profile&&(r.pet=n.ProfileMessageType),r}}function Br(e){this.startForwardingStatsTimer=function(){window.mParticle._forwardingStatsTimer=setInterval((function(){!function(){var t=e._Forwarders.getForwarderStatsQueue(),n=e._Persistence.forwardingStatsBatches.uploadsTable,r=Date.now();t.length&&(n[r]={uploading:!1,data:t},e._Forwarders.setForwarderStatsQueue([]));for(var i in n)!function(t){if(n.hasOwnProperty(t)&&!1===n[t].uploading){var r=function(){4===i.readyState&&(200===i.status||202===i.status?(e.Logger.verbose("Successfully sent "+i.statusText+" from server"),delete n[t]):"4"===i.status.toString()[0]?429!==i.status&&delete n[t]:n[t].uploading=!1)},i=e._Helpers.createXHR(r),o=n[t].data;n[t].uploading=!0,e._APIClient.sendBatchForwardingStatsToServer(o,i)}}(i)}()}),e._Store.SDKConfig.forwarderStatsTimeout)}}var qr=function(){function e(e,t,n){this.url="",this.logger=n,this.url="https://".concat(e).concat(t,"/audience"),this.userAudienceAPI=window.fetch?new ln(this.url):new dn(this.url)}return e.prototype.sendGetUserAudienceRequest=function(e,t){return g(this,void 0,void 0,(function(){var n,r,i,o,s,a;return h(this,(function(u){switch(u.label){case 0:this.logger.verbose("Fetching user audiences from server"),n={method:"GET",headers:{Accept:"*/*"}},r="".concat(this.url,"?mpid=").concat(e),u.label=1;case 1:return u.trys.push([1,6,,7]),[4,this.userAudienceAPI.upload(n,r)];case 2:return(i=u.sent()).status>=200&&i.status<300?(this.logger.verbose("User Audiences successfully received"),[4,i.json()]):[3,4];case 3:o=u.sent(),s={currentAudienceMemberships:null==o?void 0:o.audience_memberships};try{t(s)}catch(e){throw new Error("Error invoking callback on user audience response.")}return[3,5];case 4:throw 401===i.status?new Error("`HTTP error status ${userAudiencePromise.status} while retrieving User Audiences - please verify your API key.`"):403===i.status?new Error("`HTTP error status ${userAudiencePromise.status} while retrieving User Audiences - please verify your workspace is enabled for audiences.`"):new Error("Uncaught HTTP Error ".concat(i.status,"."));case 5:return[3,7];case 6:return a=u.sent(),this.logger.error("Error retrieving audiences. ".concat(a)),[3,7];case 7:return[2]}}))}))},e}(),jr=function(e,t){return z(e)||e.splice(0,e.length).forEach((function(e){try{K(e)?e():Array.isArray(e)&&zr(e)}catch(e){t.error("Error processing ready queue item: "+ie(e))}})),[]},zr=function(e){var t=e.slice(),n=t.splice(0,1)[0];if("string"==typeof n&&0!==n.length)if("undefined"!=typeof window&&window.mParticle&&window.mParticle[t[0]])window.mParticle[n].apply(window.mParticle,t);else{var r=n.split(".");try{for(var i=window.mParticle,o=window.mParticle,s=0,a=r;s<a.length;s++){var u=a[s];o=i,i=i[u]}i.apply(o,t)}catch(e){throw new Error("Unable to compute proper mParticle function "+e)}}},Qr=r.Messages,Wr=r.HTTPCodes,Jr=r.FeatureFlags,Gr=r.IdentityMethods,$r=Qr.ErrorMessages,Yr=Jr.CacheIdentity,Xr=Gr.Identify,Zr=Gr.Modify,ei=Gr.Login,ti=Gr.Logout;function ni(e){var t=e._Helpers,n=t.getFeatureFlag,i=t.extend,s=this;this.idCache=null,this.audienceManager=null,this.IdentityRequest={preProcessIdentityRequest:function(t,n,r){e.Logger.verbose(Qr.InformationMessages.StartingLogEvent+": "+r);var i=e._Helpers.Validators.removeFalsyIdentityValues(t,e.Logger),o=(null==i?void 0:i.userIdentities)?p(p({},i),{userIdentities:Rn(i.userIdentities)}):i,s=e._Helpers.Validators.validateIdentities(o,r);if(!s.valid)return e.Logger.error("ERROR: "+s.error),{valid:!1,error:s.error};if(n&&!e._Helpers.Validators.isFunction(n)){var a="The optional callback must be a function. You tried entering a(n) "+c(n);return e.Logger.error(a),{valid:!1,error:a}}return{valid:!0,cleanedIdentities:o}},createIdentityRequest:function(t,n,r,i,o,s,a){return{client_sdk:{platform:n,sdk_vendor:r,sdk_version:i},context:s,environment:e._Store.SDKConfig.isDevelopmentMode?"development":"production",request_id:e._Helpers.generateUniqueId(),request_timestamp_ms:(new Date).getTime(),previous_mpid:a||null,known_identities:On(t,o)}},createModifyIdentityRequest:function(t,n,r,i,o,s){return{client_sdk:{platform:r,sdk_vendor:i,sdk_version:o},context:s,environment:e._Store.SDKConfig.isDevelopmentMode?"development":"production",request_id:e._Helpers.generateUniqueId(),request_timestamp_ms:(new Date).getTime(),identity_changes:this.createIdentityChanges(t,n)}},createIdentityChanges:function(e,t){var n=[];if(t&&P(t)&&e&&P(e))for(var r in t)n.push({old_value:e[r]||null,new_value:t[r],identity_type:r});return n},combineUserIdentities:function(e,t){var n={},r=i({},e,t);for(var o in r){var s=me.IdentityType.getIdentityType(o);!1!==s&&s>=0&&(n[me.IdentityType.getIdentityType(o)]=r[o])}return n},createAliasNetworkRequest:function(t){return{request_id:e._Helpers.generateUniqueId(),request_type:"alias",environment:e._Store.SDKConfig.isDevelopmentMode?"development":"production",api_key:e._Store.devToken,data:{destination_mpid:t.destinationMpid,source_mpid:t.sourceMpid,start_unixtime_ms:t.startTime,end_unixtime_ms:t.endTime,scope:t.scope,device_application_stamp:e._Store.deviceId}}},convertAliasToNative:function(e){return{DestinationMpid:e.destinationMpid,SourceMpid:e.sourceMpid,StartUnixtimeMs:e.startTime,EndUnixtimeMs:e.endTime,Scope:e.scope}},convertToNative:function(e){var t=[];if(null==e?void 0:e.userIdentities){for(var n in e.userIdentities)e.userIdentities.hasOwnProperty(n)&&t.push({Type:me.IdentityType.getIdentityType(n),Identity:e.userIdentities[n]});return{UserIdentities:t}}}},this.IdentityAPI={HTTPCodes:Wr,identify:function(t,n){var i,o=e.Identity.getCurrentUser(),a=e._Identity.IdentityRequest.preProcessIdentityRequest(t,n,Xr);if(o&&(i=o.getMPID()),a.valid){var u=e._Identity.IdentityRequest.createIdentityRequest(a.cleanedIdentities,r.platform,r.sdkVendor,r.sdkVersion,e._Store.deviceId,e._Store.context,i);if(e._Helpers.getFeatureFlag(r.FeatureFlags.CacheIdentity))if(Ln(u.known_identities,s.idCache,s.parseIdentityResponse,i,n,t,Xr))return;e._Helpers.canLog()?e._Store.webviewBridgeEnabled?(e._NativeSdkHelpers.sendToNative(r.NativeSdkPaths.Identify,JSON.stringify(e._Identity.IdentityRequest.convertToNative(t))),e._Helpers.invokeCallback(n,Wr.nativeIdentityRequest,"Identify request sent to native sdk")):e._IdentityAPIClient.sendIdentityRequest(u,Xr,n,t,s.parseIdentityResponse,i,u.known_identities):(e._Helpers.invokeCallback(n,Wr.loggingDisabledOrMissingAPIKey,Qr.InformationMessages.AbandonLogEvent),e.Logger.verbose(Qr.InformationMessages.AbandonLogEvent))}else e._Helpers.invokeCallback(n,Wr.validationIssue,a.error),e.Logger.verbose(a)},logout:function(t,n){var i,o=e.Identity.getCurrentUser(),a=e._Identity.IdentityRequest.preProcessIdentityRequest(t,n,ti);if(o&&(i=o.getMPID()),a.valid){var u,c=e._Identity.IdentityRequest.createIdentityRequest(a.cleanedIdentities,r.platform,r.sdkVendor,r.sdkVersion,e._Store.deviceId,e._Store.context,i);e._Helpers.canLog()?e._Store.webviewBridgeEnabled?(e._NativeSdkHelpers.sendToNative(r.NativeSdkPaths.Logout,JSON.stringify(e._Identity.IdentityRequest.convertToNative(t))),e._Helpers.invokeCallback(n,Wr.nativeIdentityRequest,"Logout request sent to native sdk")):(e._IdentityAPIClient.sendIdentityRequest(c,ti,n,t,s.parseIdentityResponse,i),(u=e._ServerModel.createEventObject({messageType:me.MessageType.Profile})).ProfileMessageType=me.ProfileMessageType.Logout,e._Store.activeForwarders.length&&e._Store.activeForwarders.forEach((function(e){var t=e;t.logOut&&t.logOut(u)}))):(e._Helpers.invokeCallback(n,Wr.loggingDisabledOrMissingAPIKey,Qr.InformationMessages.AbandonLogEvent),e.Logger.verbose(Qr.InformationMessages.AbandonLogEvent))}else e._Helpers.invokeCallback(n,Wr.validationIssue,a.error),e.Logger.verbose(a)},login:function(t,n){var i,o=e.Identity.getCurrentUser(),a=e._Identity.IdentityRequest.preProcessIdentityRequest(t,n,ei);if(o&&(i=o.getMPID()),a.valid){var u=e._Identity.IdentityRequest.createIdentityRequest(a.cleanedIdentities,r.platform,r.sdkVendor,r.sdkVersion,e._Store.deviceId,e._Store.context,i);if(e._Helpers.getFeatureFlag(r.FeatureFlags.CacheIdentity))if(Ln(u.known_identities,s.idCache,s.parseIdentityResponse,i,n,t,ei))return;e._Helpers.canLog()?e._Store.webviewBridgeEnabled?(e._NativeSdkHelpers.sendToNative(r.NativeSdkPaths.Login,JSON.stringify(e._Identity.IdentityRequest.convertToNative(t))),e._Helpers.invokeCallback(n,Wr.nativeIdentityRequest,"Login request sent to native sdk")):e._IdentityAPIClient.sendIdentityRequest(u,ei,n,t,s.parseIdentityResponse,i,u.known_identities):(e._Helpers.invokeCallback(n,Wr.loggingDisabledOrMissingAPIKey,Qr.InformationMessages.AbandonLogEvent),e.Logger.verbose(Qr.InformationMessages.AbandonLogEvent))}else e._Helpers.invokeCallback(n,Wr.validationIssue,a.error),e.Logger.verbose(a)},modify:function(t,n){var i,o=e.Identity.getCurrentUser(),a=e._Identity.IdentityRequest.preProcessIdentityRequest(t,n,Zr);if(o&&(i=o.getMPID()),a.valid){var u=(null==t?void 0:t.userIdentities)?a.cleanedIdentities.userIdentities:{},c=e._Identity.IdentityRequest.createModifyIdentityRequest(o?o.getUserIdentities().userIdentities:{},u,r.platform,r.sdkVendor,r.sdkVersion,e._Store.context);e._Helpers.canLog()?e._Store.webviewBridgeEnabled?(e._NativeSdkHelpers.sendToNative(r.NativeSdkPaths.Modify,JSON.stringify(e._Identity.IdentityRequest.convertToNative(t))),e._Helpers.invokeCallback(n,Wr.nativeIdentityRequest,"Modify request sent to native sdk")):e._IdentityAPIClient.sendIdentityRequest(c,Zr,n,t,s.parseIdentityResponse,i):(e._Helpers.invokeCallback(n,Wr.loggingDisabledOrMissingAPIKey,Qr.InformationMessages.AbandonLogEvent),e.Logger.verbose(Qr.InformationMessages.AbandonLogEvent))}else e._Helpers.invokeCallback(n,Wr.validationIssue,a.error),e.Logger.verbose(a)},getCurrentUser:function(){var t;return e._Store?(t=e._Store.mpid)?(t=e._Store.mpid.slice(),s.mParticleUser(t,e._Store.isLoggedIn)):e._Store.webviewBridgeEnabled?s.mParticleUser():null:null},getUser:function(t){var n=e._Persistence.getPersistence();return n&&n[t]&&!r.SDKv2NonMPIDCookieKeys.hasOwnProperty(t)?s.mParticleUser(t):null},getUsers:function(){var t=e._Persistence.getPersistence(),n=[];if(t)for(var i in t)r.SDKv2NonMPIDCookieKeys.hasOwnProperty(i)||n.push(s.mParticleUser(i));return n.sort((function(e,t){return(e.getLastSeenTime()||0)>(t.getLastSeenTime()||0)?-1:1})),n},aliasUsers:function(t,n){var i;if(t.destinationMpid&&t.sourceMpid||(i=Qr.ValidationMessages.AliasMissingMpid),t.destinationMpid===t.sourceMpid&&(i=Qr.ValidationMessages.AliasNonUniqueMpid),t.startTime&&t.endTime||(i=Qr.ValidationMessages.AliasMissingTime),t.startTime>t.endTime&&(i=Qr.ValidationMessages.AliasStartBeforeEndTime),i)return e.Logger.warning(i),void e._Helpers.invokeAliasCallback(n,Wr.validationIssue,i);if(e._Helpers.canLog())if(e._Store.webviewBridgeEnabled)e._NativeSdkHelpers.sendToNative(r.NativeSdkPaths.Alias,JSON.stringify(e._Identity.IdentityRequest.convertAliasToNative(t))),e._Helpers.invokeAliasCallback(n,Wr.nativeIdentityRequest,"Alias request sent to native sdk");else{e.Logger.verbose(Qr.InformationMessages.StartingAliasRequest+": "+t.sourceMpid+" -> "+t.destinationMpid);var o=e._Identity.IdentityRequest.createAliasNetworkRequest(t);e._IdentityAPIClient.sendAliasRequest(o,n)}else e._Helpers.invokeAliasCallback(n,Wr.loggingDisabledOrMissingAPIKey,Qr.InformationMessages.AbandonAliasUsers),e.Logger.verbose(Qr.InformationMessages.AbandonAliasUsers)},search:function(t,n,r){Hn(e,t,n,r)},createAliasRequest:function(t,n,r){try{if(!n||!t)return e.Logger.error("'destinationUser' and 'sourceUser' must both be present"),null;var i=t.getFirstSeenTime();i||e.Identity.getUsers().forEach((function(e){e.getFirstSeenTime()&&(!i||e.getFirstSeenTime()<i)&&(i=e.getFirstSeenTime())}));var o=(new Date).getTime()-24*e._Store.SDKConfig.aliasMaxWindow*60*60*1e3,s=t.getLastSeenTime()||(new Date).getTime();return i<o&&s<(i=o)&&e.Logger.warning("Source User has not been seen in the last "+e._Store.SDKConfig.maxAliasWindow+" days, Alias Request will likely fail"),{destinationMpid:n.getMPID(),sourceMpid:t.getMPID(),startTime:i,endTime:s,scope:r||"device"}}catch(t){return e.Logger.error("There was a problem with creating an alias request: "+t),null}}},this.mParticleUser=function(t,n){return{getUserIdentities:function(){var n={},r=e._Store.getUserIdentities(t);for(var i in r)if(W(r,i)){var o=ve(i);null!==o&&(n[me.IdentityType.getIdentityName(o)]=r[i])}return{userIdentities:n}},getMPID:function(){return t},setUserTag:function(t){e._Helpers.Validators.isValidKeyValue(t)?this.setUserAttribute(t,null):e.Logger.error(Qr.ErrorMessages.BadKey)},removeUserTag:function(t){e._Helpers.Validators.isValidKeyValue(t)?this.removeUserAttribute(t):e.Logger.error(Qr.ErrorMessages.BadKey)},setUserAttribute:function(n,i){if(e._SessionManager.resetSessionTimer(),e._Helpers.canLog()){if(!e._Helpers.Validators.isValidAttributeValue(i))return void e.Logger.error(Qr.ErrorMessages.BadAttribute);if(!e._Helpers.Validators.isValidKeyValue(n))return void e.Logger.error(Qr.ErrorMessages.BadKey);if(e._Store.webviewBridgeEnabled)e._NativeSdkHelpers.sendToNative(r.NativeSdkPaths.SetUserAttribute,JSON.stringify({key:n,value:i}));else{var o=this.getAllUserAttributes(),a=void 0,u=void 0,c=e._Helpers.findKeyInObject(o,n);c?(u=!1,a=o[c],delete o[c]):u=!0,o[n]=i,e._Store.setUserAttributes(t,o),s.sendUserAttributeChangeEvent(n,i,a,u,!1,this),e._Forwarders.initForwarders(s.IdentityAPI.getCurrentUser().getUserIdentities().userIdentities,e._APIClient.prepareForwardingStats),e._Forwarders.handleForwarderUserAttributes("setUserAttribute",n,i)}}},setUserAttributes:function(t){if(e._SessionManager.resetSessionTimer(),P(t)){if(e._Helpers.canLog())for(var n in t)t.hasOwnProperty(n)&&this.setUserAttribute(n,t[n])}else e.Logger.error("Must pass an object into setUserAttributes. You passed a "+c(t))},removeUserAttribute:function(n){var i,o;if(e._SessionManager.resetSessionTimer(),e._Helpers.Validators.isValidKeyValue(n))if(e._Store.webviewBridgeEnabled)e._NativeSdkHelpers.sendToNative(r.NativeSdkPaths.RemoveUserAttribute,JSON.stringify({key:n,value:null}));else{i=e._Persistence.getPersistence(),o=this.getAllUserAttributes();var a=e._Helpers.findKeyInObject(o,n);a&&(n=a);var u=o[n]?o[n].toString():null;delete o[n],i&&P(i[t])&&(i[t].ua=o,e._Persistence.savePersistence(i)),s.sendUserAttributeChangeEvent(n,null,u,!1,!0,this),e._Forwarders.initForwarders(s.IdentityAPI.getCurrentUser().getUserIdentities().userIdentities,e._APIClient.prepareForwardingStats),e._Forwarders.handleForwarderUserAttributes("removeUserAttribute",n,null)}else e.Logger.error(Qr.ErrorMessages.BadKey)},setUserAttributeList:function(n,i){if(e._SessionManager.resetSessionTimer(),e._Helpers.Validators.isValidKeyValue(n))if(Array.isArray(i)){var o=i.slice();if(e._Store.webviewBridgeEnabled)e._NativeSdkHelpers.sendToNative(r.NativeSdkPaths.SetUserAttributeList,JSON.stringify({key:n,value:o}));else{var a=this.getAllUserAttributes(),u=void 0,l=void 0,d=void 0,p=e._Helpers.findKeyInObject(a,n);if(p?(l=!1,u=a[p],delete a[p]):l=!0,a[n]=o,e._Store.setUserAttributes(t,a),u&&Array.isArray(u)){if(i.length!==u.length)d=!0;else for(var g=0;g<i.length;g++)if(u[g]!==i[g]){d=!0;break}}else d=!0;d&&s.sendUserAttributeChangeEvent(n,i,u,l,!1,this),e._Forwarders.initForwarders(s.IdentityAPI.getCurrentUser().getUserIdentities().userIdentities,e._APIClient.prepareForwardingStats),e._Forwarders.handleForwarderUserAttributes("setUserAttribute",n,o)}}else e.Logger.error("The value you passed in to setUserAttributeList must be an array. You passed in a "+c(i));else e.Logger.error(Qr.ErrorMessages.BadKey)},removeAllUserAttributes:function(){var t;if(e._SessionManager.resetSessionTimer(),e._Store.webviewBridgeEnabled)e._NativeSdkHelpers.sendToNative(r.NativeSdkPaths.RemoveAllUserAttributes);else if(t=this.getAllUserAttributes(),e._Forwarders.initForwarders(s.IdentityAPI.getCurrentUser().getUserIdentities().userIdentities,e._APIClient.prepareForwardingStats),t)for(var n in t)W(t,n)&&e._Forwarders.handleForwarderUserAttributes("removeUserAttribute",n,null),this.removeUserAttribute(n)},getUserAttributesLists:function(){var e,t={};for(var n in e=this.getAllUserAttributes())W(e,n)&&!J(n)&&Array.isArray(e[n])&&(t[n]=e[n].slice());return t},getAllUserAttributes:function(){var n={},r=(0,e._Store.getUserAttributes)(t);if(r)for(var i in r)if(W(r,i)&&!J(i)){var o=r[i];Array.isArray(o)?n[i]=o.slice():n[i]=o}return n},getConsentState:function(){return e._Store.getConsentState(t)},setConsentState:function(n){e._Store.setConsentState(t,n),e._Forwarders.initForwarders(this.getUserIdentities().userIdentities,e._APIClient.prepareForwardingStats),e._CookieSyncManager.attemptCookieSync(this.getMPID())},isLoggedIn:function(){return n},getLastSeenTime:function(){return e._Persistence.getLastSeenTime(t)},getFirstSeenTime:function(){return e._Persistence.getFirstSeenTime(t)},getUserAudiences:function(n){e._Helpers.getFeatureFlag(Jr.AudienceAPI)?(null===s.audienceManager&&(s.audienceManager=new qr(e._Store.SDKConfig.userAudienceUrl,e._Store.devToken,e.Logger)),s.audienceManager.sendGetUserAudienceRequest(t,n)):e.Logger.error($r.AudienceAPINotEnabled)}}},this.parseIdentityResponse=function(t,r,i,a,u,c,l){var d,p,g,h,v,f,m=e.Identity.getUser(r),y=m?m.getMPID():null,b=m?m.getUserIdentities().userIdentities:{},S={};e._Store.identityCallInFlight=!1;try{if(e.Logger.verbose('Parsing "'+u+'" identity response from server'),v=null!==(d=t.responseText)&&void 0!==d?d:null,e._Store.isLoggedIn=(null==v?void 0:v.is_logged_in)||!1,function(e,t){return!e||e.getMPID()&&t.mpid&&t.mpid!==e.getMPID()}(m,v)&&(e._Store.mpid=v.mpid,m&&e._Persistence.setLastSeenTime(r),h=!e._Persistence.getFirstSeenTime(v.mpid),e._Persistence.setFirstSeenTime(v.mpid)),t.status===o){n(Yr)&&Tn(u,c,s.idCache,t,l);var _=s.IdentityAPI.getUser(v.mpid),w=_?_.getUserIdentities().userIdentities:{};u===Zr?(S=e._Identity.IdentityRequest.combineUserIdentities(b,a.userIdentities),e._Store.setUserIdentities(r,S)):(u===Xr&&m&&v.mpid===y&&e._Persistence.setFirstSeenTime(v.mpid),e._Store.addMpidToSessionHistory(v.mpid,r),e._CookieSyncManager.attemptCookieSync(v.mpid,h),e._Persistence.swapCurrentUser(r,v.mpid,e._Store.currentSessionMPIDs),a&&!z(a.userIdentities)&&(S=s.IdentityRequest.combineUserIdentities(w,a.userIdentities)),e._Store.setUserIdentities(v.mpid,S),e._Persistence.update(),e._Store.syncPersistenceData(),e._Store.context=v.context||e._Store.context),function(e,t,n,r,i){if(n&&n.onUserAlias&&K(n.onUserAlias))try{tr({methodName:"onUserAlias",warningMessage:I("onUserAlias")},r,i),n.onUserAlias(e,t)}catch(e){r.error("There was an error with your onUserAlias function - "+e)}}(m,f=e.Identity.getCurrentUser(),a,e.Logger,e._ErrorReportingDispatcher);var P=e._Persistence.getPersistence();f&&(e._Persistence.storeDataInMemory(P,f.getMPID()),s.reinitForwardersOnUserChange(m,f),s.setForwarderCallbacks(f,u));var C=ue.getNewIdentitiesByName(S),A=u===Zr?b:w;null===(p=e._CookieConsentManager)||void 0===p||p.syncNoTargetingAttribute(f),s.sendUserIdentityChangeEvent(C,u,v.mpid,A)}if(i){var T=0===t.status?Wr.noHttpCoverage:t.status;e._Helpers.invokeCallback(i,T,v||null,f,r)}else v&&!z(v.errors)&&e.Logger.error("Received HTTP response code of "+t.status+" - "+v.errors[0].message);e.Logger.verbose("Successfully parsed Identity Response"),null===(g=e._APIClient)||void 0===g||g.processQueuedEvents()}catch(n){i&&e._Helpers.invokeCallback(i,t.status,v||null),e.Logger.error("Error parsing JSON response from Identity server: "+n)}e._Store.isInitialized=!0,e._RoktManager.onIdentityComplete(),e._preInit.readyQueue=jr(e._preInit.readyQueue,e.Logger)},this.sendUserIdentityChangeEvent=function(t,n,r,i){var o;if(r||n===Zr){var a=this.IdentityAPI.getUser(r);for(var u in t)if(i[u]!==t[u]){var c=!i[u],l=s.createUserIdentityChange(u,t[u],i[u],c,a);null===(o=e._APIClient)||void 0===o||o.sendEventToServer(l)}}},this.createUserIdentityChange=function(t,n,r,i,o){return e._ServerModel.createEventObject({messageType:me.MessageType.UserIdentityChange,userIdentityChanges:{New:{IdentityType:t,Identity:n,CreatedThisBatch:i},Old:{IdentityType:t,Identity:r,CreatedThisBatch:!1}},userInMemory:o})},this.sendUserAttributeChangeEvent=function(t,n,r,i,o,a){var u,c=s.createUserAttributeChange(t,n,r,i,o,a);c&&(null===(u=e._APIClient)||void 0===u||u.sendEventToServer(c))},this.createUserAttributeChange=function(t,n,r,i,o,s){var a;return void 0===r&&(r=null),n!==r&&(a=e._ServerModel.createEventObject({messageType:me.MessageType.UserAttributeChange,userAttributeChanges:{UserAttributeName:t,New:n,Old:r,Deleted:o,IsNewAttribute:i}},s)),a},this.reinitForwardersOnUserChange=function(t,n){var r;(function(e,t){return!e||t.getMPID()!==e.getMPID()||e.isLoggedIn()!==t.isLoggedIn()})(t,n)&&(null===(r=e._Forwarders)||void 0===r||r.initForwarders(n.getUserIdentities().userIdentities,e._APIClient.prepareForwardingStats))},this.setForwarderCallbacks=function(t,n){var r,i,o;null===(r=e._Forwarders)||void 0===r||r.setForwarderUserIdentities(t.getUserIdentities().userIdentities),null===(i=e._Forwarders)||void 0===i||i.setForwarderOnIdentityComplete(t,n),null===(o=e._Forwarders)||void 0===o||o.setForwarderOnUserIdentified(t)}}var ri=r.CCPAPurpose;function ii(e){var t=this;function n(e){return P(e)?t.createPrivacyConsent(e.c,e.ts,e.d,e.l,e.h):null}this.isEnabledForUserConsent=function(e,t){if(!e||!e.values||!e.values.length)return!0;if(!t)return!1;var n,r={},i=t.getConsentState();if(i){var o=i.getGDPRConsentState();if(o)for(var s in o)o.hasOwnProperty(s)&&(n=Bn.hashConsentPurposeConditionalForwarding("1",s),r[n]=o[s].Consented);var a=i.getCCPAConsentState();a&&(n=Bn.hashConsentPurposeConditionalForwarding("2",ri),r[n]=a.Consented)}var u=e.values.some((function(e){var t=e.consentPurpose,n=e.hasConsented;return!!r.hasOwnProperty(t)&&r[t]===n}));return e.includeOnMatch===u},this.createPrivacyConsent=function(t,n,r,i,o){if("boolean"!=typeof t)return e.Logger.error("Consented boolean is required when constructing a Consent object."),null;var s=n instanceof Date;return s&&(n=n.getTime()),(n||s)&&("number"!=typeof n&&"string"!=typeof n||isNaN(n))?(e.Logger.error("Timestamp must be a valid number when constructing a Consent object."),null):r&&"string"!=typeof r?(e.Logger.error("Document must be a valid string when constructing a Consent object."),null):i&&"string"!=typeof i?(e.Logger.error("Location must be a valid string when constructing a Consent object."),null):o&&"string"!=typeof o?(e.Logger.error("Hardware ID must be a valid string when constructing a Consent object."),null):{Consented:t,Timestamp:n||Date.now(),ConsentDocument:r,Location:i,HardwareId:o}},this.ConsentSerialization={toMinifiedJsonObject:function(e){var t,n={};if(e){var r=e.getGDPRConsentState();if(r)for(var i in n.gdpr={},r)if(r.hasOwnProperty(i)){var o=r[i];n.gdpr[i]={},"boolean"==typeof o.Consented&&(n.gdpr[i].c=o.Consented),"number"==typeof o.Timestamp&&(n.gdpr[i].ts=o.Timestamp),"string"==typeof o.ConsentDocument&&(n.gdpr[i].d=o.ConsentDocument),"string"==typeof o.Location&&(n.gdpr[i].l=o.Location),"string"==typeof o.HardwareId&&(n.gdpr[i].h=o.HardwareId)}var s=e.getCCPAConsentState();s&&(n.ccpa=((t={})[ri]={},t),"boolean"==typeof s.Consented&&(n.ccpa[ri].c=s.Consented),"number"==typeof s.Timestamp&&(n.ccpa[ri].ts=s.Timestamp),"string"==typeof s.ConsentDocument&&(n.ccpa[ri].d=s.ConsentDocument),"string"==typeof s.Location&&(n.ccpa[ri].l=s.Location),"string"==typeof s.HardwareId&&(n.ccpa[ri].h=s.HardwareId))}return n},fromMinifiedJsonObject:function(e){var r=t.createConsentState();if(!P(e))return r;if(P(e.gdpr))for(var i in e.gdpr)W(e.gdpr,i)&&r.addGDPRConsentState(i,n(e.gdpr[i]));return P(e.ccpa)&&W(e.ccpa,ri)&&r.setCCPAConsentState(n(e.ccpa[ri])),r}},this.createConsentState=function(n){var r={},i={};if(n){var o=t.createConsentState();return o.setGDPRConsentState(n.getGDPRConsentState()),o.setCCPAConsentState(n.getCCPAConsentState()),o}function s(e){if("string"!=typeof e)return null;var t=e.trim();return t.length?t.toLowerCase():null}return{setGDPRConsentState:function(e){if(e){if(P(e))for(var t in r={},e)e.hasOwnProperty(t)&&this.addGDPRConsentState(t,e[t])}else r={};return this},addGDPRConsentState:function(n,i){var o=s(n);if(!o)return e.Logger.error("Purpose must be a string."),this;if(!P(i))return e.Logger.error("Invoked with a bad or empty consent object."),this;var a=t.createPrivacyConsent(i.Consented,i.Timestamp,i.ConsentDocument,i.Location,i.HardwareId);return a&&(r[o]=a),this},setCCPAConsentState:function(n){if(!P(n))return e.Logger.error("Invoked with a bad or empty CCPA consent object."),this;var r=t.createPrivacyConsent(n.Consented,n.Timestamp,n.ConsentDocument,n.Location,n.HardwareId);return r&&(i[ri]=r),this},getCCPAConsentState:function(){return i[ri]},getGDPRConsentState:function(){return Object.assign({},r)},removeGDPRConsentState:function(e){var t=s(e);return t?(delete r[t],this):this},removeCCPAConsentState:function(){return delete i[ri],this}}}}var oi={ScreenView:"screen_view",CustomEvent:"custom_event",Commerce:"commerce",UserAttributes:"user_attributes",UserIdentities:"user_identities",ProductAction:"product_action",PromotionAction:"promotion_action",ProductImpression:"product_impression"},si=function(e){return e},ai=function(e){return p(p({},e),{UserAttributes:{}})},ui=function(e){return p(p({},e),{UserIdentities:[]})},ci=function(){function e(e,t){var n,r,i,o,s,a,u,c,l,d,p,g,h,v,f,m=this;if(this.dataPlanMatchLookups={},this.blockEvents=!1,this.blockEventAttributes=!1,this.blockUserAttributes=!1,this.blockUserIdentities=!1,this.kitBlockingEnabled=!1,!e||e.document){this.kitBlockingEnabled=!0,this.mpInstance=t,this.blockEvents=null===(i=null===(r=null===(n=null==e?void 0:e.document)||void 0===n?void 0:n.dtpn)||void 0===r?void 0:r.blok)||void 0===i?void 0:i.ev,this.blockEventAttributes=null===(a=null===(s=null===(o=null==e?void 0:e.document)||void 0===o?void 0:o.dtpn)||void 0===s?void 0:s.blok)||void 0===a?void 0:a.ea,this.blockUserAttributes=null===(l=null===(c=null===(u=null==e?void 0:e.document)||void 0===u?void 0:u.dtpn)||void 0===c?void 0:c.blok)||void 0===l?void 0:l.ua,this.blockUserIdentities=null===(g=null===(p=null===(d=null==e?void 0:e.document)||void 0===d?void 0:d.dtpn)||void 0===p?void 0:p.blok)||void 0===g?void 0:g.id;var y=null===(f=null===(v=null===(h=null==e?void 0:e.document)||void 0===h?void 0:h.dtpn)||void 0===v?void 0:v.vers)||void 0===f?void 0:f.version_document,b=null==y?void 0:y.data_points;if(y)try{(null==b?void 0:b.length)>0&&b.forEach((function(e){return m.addToMatchLookups(e)}))}catch(e){this.mpInstance.Logger.error("There was an issue with the data plan: "+e)}}else this.kitBlockingEnabled=!1}return e.prototype.addToMatchLookups=function(e){var t,n,r;if(e.match&&e.validator){var i=this.generateMatchKey(e.match),o=this.getPlannedProperties(e.match.type,e.validator);this.dataPlanMatchLookups[i]=o,(null===(t=null==e?void 0:e.match)||void 0===t?void 0:t.type)!==oi.ProductImpression&&(null===(n=null==e?void 0:e.match)||void 0===n?void 0:n.type)!==oi.ProductAction&&(null===(r=null==e?void 0:e.match)||void 0===r?void 0:r.type)!==oi.PromotionAction||(i=this.generateProductAttributeMatchKey(e.match),o=this.getProductProperties(e.match.type,e.validator),this.dataPlanMatchLookups[i]=o)}else this.mpInstance.Logger.warning("Data Plan Point is not valid' + ".concat(e))},e.prototype.generateMatchKey=function(e){var t=e.criteria||"";switch(e.type){case oi.CustomEvent:var n=t;return[oi.CustomEvent,n.custom_event_type,n.event_name].join(":");case oi.ScreenView:var r=t;return[oi.ScreenView,"",r.screen_name].join(":");case oi.ProductAction:var i=t;return[e.type,i.action].join(":");case oi.PromotionAction:var o=t;return[e.type,o.action].join(":");case oi.ProductImpression:var s=t;return[e.type,s.action].join(":");case oi.UserIdentities:case oi.UserAttributes:return[e.type].join(":");default:return null}},e.prototype.generateProductAttributeMatchKey=function(e){var t=e.criteria||"";switch(e.type){case oi.ProductAction:var n=t;return[e.type,n.action,"ProductAttributes"].join(":");case oi.PromotionAction:var r=t;return[e.type,r.action,"ProductAttributes"].join(":");case oi.ProductImpression:return[e.type,"ProductAttributes"].join(":");default:return null}},e.prototype.getPlannedProperties=function(e,t){var n,r,i,o,s,a,u,c,l,d;switch(e){case oi.CustomEvent:case oi.ScreenView:case oi.ProductAction:case oi.PromotionAction:case oi.ProductImpression:if(l=null===(o=null===(i=null===(r=null===(n=null==t?void 0:t.definition)||void 0===n?void 0:n.properties)||void 0===r?void 0:r.data)||void 0===i?void 0:i.properties)||void 0===o?void 0:o.custom_attributes){if(!0===l.additionalProperties||void 0===l.additionalProperties)return!0;for(var p={},g=0,h=Object.keys(l.properties);g<h.length;g++){p[h[g]]=!0}return p}return!1!==(null===(u=null===(a=null===(s=null==t?void 0:t.definition)||void 0===s?void 0:s.properties)||void 0===a?void 0:a.data)||void 0===u?void 0:u.additionalProperties)||{};case oi.UserAttributes:case oi.UserIdentities:if(!0===(d=null===(c=null==t?void 0:t.definition)||void 0===c?void 0:c.additionalProperties)||void 0===d)return!0;p={};for(var v=t.definition.properties,f=0,m=Object.keys(v);f<m.length;f++){p[m[f]]=!0}return p;default:return null}},e.prototype.getProductProperties=function(e,t){var n,r,i,o,s,a,u,c,l,d,p,g,h,v,f,m,y,b,S,I;switch(e){case oi.ProductImpression:if(!1===(null==(I=null===(d=null===(l=null===(c=null===(u=null===(a=null===(s=null===(o=null===(i=null===(r=null===(n=null==t?void 0:t.definition)||void 0===n?void 0:n.properties)||void 0===r?void 0:r.data)||void 0===i?void 0:i.properties)||void 0===o?void 0:o.product_impressions)||void 0===s?void 0:s.items)||void 0===a?void 0:a.properties)||void 0===u?void 0:u.products)||void 0===c?void 0:c.items)||void 0===l?void 0:l.properties)||void 0===d?void 0:d.custom_attributes)?void 0:I.additionalProperties)){for(var _={},w=0,P=Object.keys(null==I?void 0:I.properties);w<P.length;w++){_[P[w]]=!0}return _}return!0;case oi.ProductAction:case oi.PromotionAction:if((I=null===(S=null===(b=null===(y=null===(m=null===(f=null===(v=null===(h=null===(g=null===(p=null==t?void 0:t.definition)||void 0===p?void 0:p.properties)||void 0===g?void 0:g.data)||void 0===h?void 0:h.properties)||void 0===v?void 0:v.product_action)||void 0===f?void 0:f.properties)||void 0===m?void 0:m.products)||void 0===y?void 0:y.items)||void 0===b?void 0:b.properties)||void 0===S?void 0:S.custom_attributes)&&!1===I.additionalProperties){_={};for(var C=0,A=Object.keys(null==I?void 0:I.properties);C<A.length;C++){_[A[C]]=!0}return _}return!0;default:return null}},e.prototype.getMatchKey=function(e){switch(e.event_type){case He.EventTypeEnum.screenView:var t=e;return t.data?["screen_view","",t.data.screen_name].join(":"):null;case He.EventTypeEnum.commerceEvent:var n=e,r=[];if(n&&n.data){var i=n.data,o=i.product_action,s=i.product_impressions,a=i.promotion_action;o?(r.push(oi.ProductAction),r.push(o.action)):a?(r.push(oi.PromotionAction),r.push(a.action)):s&&r.push(oi.ProductImpression)}return r.join(":");case He.EventTypeEnum.customEvent:var u=e;return u.data?["custom_event",u.data.custom_event_type,u.data.event_name].join(":"):null;default:return null}},e.prototype.getProductAttributeMatchKey=function(e){if(e.event_type===He.EventTypeEnum.commerceEvent){var t=[],n=e.data,r=n.product_action,i=n.product_impressions,o=n.promotion_action;return r?(t.push(oi.ProductAction),t.push(r.action),t.push("ProductAttributes")):o?(t.push(oi.PromotionAction),t.push(o.action),t.push("ProductAttributes")):i&&(t.push(oi.ProductImpression),t.push("ProductAttributes")),t.join(":")}return null},e.prototype.createBlockedEvent=function(e){return e&&(e=this.applyBlockingStep("the event and its attributes",this.transformEventAndEventAttributes,e,si)),e&&e.EventDataType===me.MessageType.Commerce&&(e=this.applyBlockingStep("product attributes",this.transformProductAttributes,e,si)),e&&(e=this.applyBlockingStep("user attributes",this.transformUserAttributes,e,ai),e=this.applyBlockingStep("user identities",this.transformUserIdentities,e,ui)),e},e.prototype.applyBlockingStep=function(e,t,n,r){try{return t.call(this,n)}catch(t){var i=r(n);return this.reportFailedStep(e,t),i}},e.prototype.reportFailedStep=function(e,t){try{this.mpInstance.Logger.error("Kit blocking could not filter "+e+": "+t)}catch(e){}},e.prototype.transformEventAndEventAttributes=function(e){var t=p({},e),n=Ze(t);if(!n)return t;var r=this.getMatchKey(n),i=this.dataPlanMatchLookups[r];if(this.blockEvents&&!i)return null;if(this.blockEventAttributes){if(!0===i)return t;if(i){if(t.EventAttributes){for(var o={},s=0,a=Object.keys(t.EventAttributes);s<a.length;s++){var u=a[s];!0===i[u]&&(o[u]=t.EventAttributes[u])}t.EventAttributes=o}return t}return t}return t},e.prototype.transformProductAttributes=function(e){var t=p({},e),n=Ze(t),r=this.getProductAttributeMatchKey(n),i=this.dataPlanMatchLookups[r];function o(e,t){return null==t?void 0:t.map((function(t){if(!t.Attributes)return t;for(var n={},r=0,i=Object.keys(t.Attributes);r<i.length;r++){var o=i[r];!0===e[o]&&(n[o]=t.Attributes[o])}return p(p({},t),{Attributes:n})}))}return this.blockEvents&&!i?null:this.blockEventAttributes?!0===i?t:i?(t.ProductAction?t.ProductAction=p(p({},t.ProductAction),{ProductList:o(i,t.ProductAction.ProductList)}):t.ProductImpressions?t.ProductImpressions=t.ProductImpressions.map((function(e){return p(p({},e),{ProductList:o(i,e.ProductList)})})):this.mpInstance.Logger.warning("Product Not Supported "),t):t:t},e.prototype.transformUserAttributes=function(e){var t=p({},e);if(this.blockUserAttributes){var n=this.dataPlanMatchLookups.user_attributes;if(this.mpInstance._Helpers.isObject(n)&&t.UserAttributes){for(var r={},i=0,o=Object.keys(t.UserAttributes);i<o.length;i++){var s=o[i];!0===n[s]&&(r[s]=t.UserAttributes[s])}t.UserAttributes=r}}return t},e.prototype.isAttributeKeyBlocked=function(e){if(!this.blockUserAttributes)return!1;var t=this.dataPlanMatchLookups.user_attributes;return("boolean"!=typeof t||!t)&&("object"===c(t)&&!0!==t[e])},e.prototype.isIdentityBlocked=function(e){if(!this.blockUserIdentities)return!1;if(!this.blockUserIdentities)return!1;var t=this.dataPlanMatchLookups.user_identities;return!(!0===t||!t)&&!t[e]},e.prototype.transformUserIdentities=function(e){var t,n=this,r=p({},e);if(this.blockUserIdentities){var i=this.dataPlanMatchLookups.user_identities;this.mpInstance._Helpers.isObject(i)&&(null===(t=null==r?void 0:r.UserIdentities)||void 0===t?void 0:t.length)&&(r.UserIdentities=r.UserIdentities.filter((function(e){var t=me.IdentityType.getIdentityName(n.mpInstance._Helpers.parseNumber(e.Type));return i[t]})))}return r},e}(),li=function(e,t,n,r){var i=e+t+"/config",o=["env=".concat(r?"1":"0")],s=n||{},a=s.planId,u=s.planVersion;return a&&o.push("plan_id=".concat(a)),u&&o.push("plan_version=".concat(u)),"".concat(i,"?").concat(o.join("&"))};function di(e,t,n){var r=this,i="https://"+n._Store.SDKConfig.configUrl,o=t.isDevelopmentMode,s=t.dataPlan,a=li(i,e,s,o),u=window.fetch?new ln(a):new dn(a);this.getSDKConfiguration=function(){return g(r,void 0,void 0,(function(){var e,r,i,o,s,a;return h(this,(function(c){switch(c.label){case 0:e={method:"get",headers:{Accept:"text/plain;charset=UTF-8","Content-Type":"text/plain;charset=UTF-8"},body:null},c.label=1;case 1:return c.trys.push([1,6,,7]),[4,u.upload(e)];case 2:return 200!==(r=c.sent()).status?[3,5]:(null===(o=null==n?void 0:n.Logger)||void 0===o||o.verbose("Successfully received configuration from server"),r.json?[4,r.json()]:[3,4]);case 3:return[2,c.sent()];case 4:return i=r,[2,JSON.parse(i.responseText)];case 5:return null===(s=null==n?void 0:n.Logger)||void 0===s||s.verbose("Issue with receiving configuration from server, received HTTP Code of "+r.statusText),[3,7];case 6:return c.sent(),null===(a=null==n?void 0:n.Logger)||void 0===a||a.error("Error getting forwarder configuration from mParticle servers."),[3,7];case 7:return[2,t]}}))}))}}var pi=r.HTTPCodes,gi=r.Messages,hi=r.IdentityMethods.Modify;function vi(e){this.sendAliasRequest=function(t,n){return g(this,void 0,void 0,(function(){var r,i,u,c,l,d,p,g,v,f,m,y,b,S;return h(this,(function(h){switch(h.label){case 0:r=e.Logger,i=e._Helpers.invokeAliasCallback,u=e._Store.SDKConfig.aliasUrl,c=e._Store.devToken,r.verbose(gi.InformationMessages.SendAliasHttp),l="https://".concat(u).concat(c,"/Alias"),d=window.fetch?new ln(l):new dn(l),p={method:"post",headers:{Accept:"text/plain;charset=UTF-8","Content-Type":"application/json"},body:JSON.stringify(t)},h.label=1;case 1:return h.trys.push([1,13,,14]),[4,d.upload(p)];case 2:switch(g=h.sent(),v=void 0,f=void 0,S=void 0,g.status){case s:case o:return[3,3];case a:return[3,4]}return[3,11];case 3:return f="Received Alias Response from server: "+JSON.stringify(g.status),[3,12];case 4:if(!g.json)return[3,9];h.label=5;case 5:return h.trys.push([5,7,,8]),[4,g.json()];case 6:return v=h.sent(),[3,8];case 7:return h.sent(),r.verbose("The request has no response body"),[3,8];case 8:return[3,10];case 9:v=(m=g).responseText?JSON.parse(m.responseText):"",h.label=10;case 10:return(null==(y=v)?void 0:y.message)&&(S=y.message),f="Issue with sending Alias Request to mParticle Servers, received HTTP Code of "+g.status,(null==y?void 0:y.code)&&(f+=" - "+y.code),[3,12];case 11:throw new Error("Received HTTP Code of "+g.status);case 12:return r.verbose(f),i(n,g.status,S),[3,14];case 13:return b=h.sent(),S=ie(b),r.error("Error sending alias request to mParticle servers. "+S),i(n,pi.noHttpCoverage,S),[3,14];case 14:return[2]}}))}))},this.sendIdentityRequest=function(t,n,r,i,c,l,d){var v,f,m,y;return g(this,void 0,void 0,(function(){var g,b,S,I,_,w,P,C,A,T,k,E,D,O,M,L,F,U,N;return h(this,(function(h){switch(h.label){case 0:if((null===(v=e._RoktManager)||void 0===v?void 0:v.isInitialized)&&(e._Store.identifyRequestCount=(e._Store.identifyRequestCount||0)+1,F=e._Store.identifyRequestCount,e.captureTiming("".concat(F,"-identityRequestStart"))),g=e._Helpers.invokeCallback,b=e.Logger,S=e._ErrorReportingDispatcher,b.verbose(gi.InformationMessages.SendIdentityBegin),!t)return b.error(gi.ErrorMessages.APIRequestEmpty),[2];if(b.verbose(gi.InformationMessages.SendIdentityHttp),e._Store.identityCallInFlight)return g(r,pi.activeIdentityRequest,"There is currently an Identity request processing. Please wait for this to return before requesting again"),[2];I=l||null,_=this.getUploadUrl(n,l),w=window.fetch?new ln(_):new dn(_),P={method:"post",headers:{Accept:"text/plain;charset=UTF-8","Content-Type":"application/json","x-mp-key":e._Store.devToken},body:JSON.stringify(t)},e._Store.identityCallInFlight=!0,h.label=1;case 1:return h.trys.push([1,9,,10]),[4,w.upload(P)];case 2:switch(C=h.sent(),A=void 0,T=void 0,C.status){case s:case o:case a:return[3,3]}return[3,7];case 3:return C.json?[4,C.json()]:[3,5];case 4:return k=h.sent(),A=this.getIdentityResponseFromFetch(C,k),[3,6];case 5:A=this.getIdentityResponseFromXHR(C),h.label=6;case 6:return A.status===a?(E=A.responseText,T="Issue with sending Identity Request to mParticle Servers, received HTTP Code of "+A.status,(null==E?void 0:E.Errors)&&(U=E.Errors.map((function(e){return e.message})).join(", "),T+=" - "+U)):b.isVerbose()&&(D=A.responseText,O=e._Store.SDKConfig.isDevelopmentMode,M=D,!O&&(null==D?void 0:D.matched_identities)&&(M=p(p({},D),{matched_identities:te(D.matched_identities)})),T="Received Identity Response from server: "+JSON.stringify(M)),[3,8];case 7:if(C.status>=u)throw new Error("Received HTTP Code of "+C.status);return e._Store.identityCallInFlight=!1,e._Store.identityCallFailed=!1,U="Received HTTP Code of "+C.status,b.error("Error sending identity request to servers - "+U),g(r,pi.noHttpCoverage,U),[2];case 8:return e._Store.identityCallInFlight=!1,e._Store.identityCallFailed=!1,T&&b.verbose(T),(null===(f=e._RoktManager)||void 0===f?void 0:f.isInitialized)&&(F=e._Store.identifyRequestCount,e.captureTiming("".concat(F,"-identityRequestEnd"))),c(A,I,r,i,n,d,!1),[3,10];case 9:return L=h.sent(),e._Store.identityCallInFlight=!1,e._Store.identityCallFailed=!0,(null===(m=e._RoktManager)||void 0===m?void 0:m.isInitialized)&&(F=e._Store.identifyRequestCount,e.captureTiming("".concat(F,"-identityRequestEnd"))),U=ie(L),N="Error sending identity request to servers - "+U,b.error(N),null==S||S.report({message:N,code:hn.IDENTITY_REQUEST,severity:vn.ERROR}),null===(y=e.processQueueOnIdentityFailure)||void 0===y||y.call(e),g(r,pi.noHttpCoverage,U),[3,10];case 10:return[2]}}))}))},this.getUploadUrl=function(t,n){var r=e._Helpers.createServiceUrl(e._Store.SDKConfig.identityUrl);return t===hi?r+n+"/"+t:r+t},this.getIdentityResponseFromFetch=function(e,t){return{status:e.status,responseText:t,cacheMaxAge:parseInt(e.headers.get(An))||0,expireTimestamp:0}},this.getIdentityResponseFromXHR=function(e){return{status:e.status,responseText:e.responseText?JSON.parse(e.responseText):{},cacheMaxAge:C(e.getResponseHeader(An)||""),expireTimestamp:0}}}var fi="passbackconversiontrackingid",mi=function(){function e(e){this.instanceName=e,this.kit=null,this.filters={},this.currentUser=null,this.messageQueue=new Map,this.sandbox=null,this.placementAttributesMapping=[],this.onReadyCallback=null,this.initialized=!1,this.isShoppableAdsLoaded=!1,this.stopRouteChangeWatch=null,this.pendingCheckoutIntents=[],this.autoButtonClicksForwarded=!1}return e.prototype.setOnReadyCallback=function(e){this.onReadyCallback=e},e.prototype.init=function(e,t,n,r,i,o,s,a,u,c,l){var d,g,h=e||{},v=h.userAttributeFilters,f=h.settings||{},m=f.placementAttributesMapping,y=f.hashedEmailUserIdentityType;this.mappedEmailShaIdentityType=null!==(d=null==y?void 0:y.toLowerCase())&&void 0!==d?d:null,this.identityService=n,this.store=r,this.logger=i,this.errorReporter=a,this.loggingService=u,this.captureTiming=s,this.integrationCapture=c,this.createFilteredUser=l,null===(g=this.captureTiming)||void 0===g||g.call(this,he),this.filters={userAttributeFilters:v,filterUserAttributes:Bn.filterUserAttributes,filteredUser:t};try{this.placementAttributesMapping=function(e){try{return e?JSON.parse(e.replace(/"/g,'"')):[]}catch(e){throw new Error("Settings string contains invalid JSON")}}(m)}catch(e){this.logger.error("Error parsing placement attributes mapping from config: "+e)}var b=(null==o?void 0:o.sandbox)||!1,S=ar(null==o?void 0:o.launcherOptions);this.launcherOptions=p({sandbox:b},S),(null==o?void 0:o.domain)&&(this.domain=o.domain),this.initialized=!0},Object.defineProperty(e.prototype,"isInitialized",{get:function(){return this.initialized},enumerable:!1,configurable:!0}),e.prototype.attachKit=function(e){var t,n,r,i;this.kit=e,this.watchRouteChanges(),this.flushCheckoutIntents(),(null===(t=e.settings)||void 0===t?void 0:t.accountId)&&this.store.setRoktAccountId(e.settings.accountId),e.integrationName&&(null===(n=this.store)||void 0===n||n.setIntegrationName(e.integrationName)),this.processMessageQueue();try{null===(r=this.onReadyCallback)||void 0===r||r.call(this)}catch(e){null===(i=this.logger)||void 0===i||i.error("RoktManager: Error in onReadyCallback: "+e)}},e.prototype.watchRouteChanges=function(){var e,t,n,r=this;if(!K(null===(e=this.kit)||void 0===e?void 0:e.onRouteChange))return null===(t=this.stopRouteChangeWatch)||void 0===t||t.call(this),void(this.stopRouteChangeWatch=null);this.isAutoLogPageViewEnabled()?(null===(n=this.stopRouteChangeWatch)||void 0===n||n.call(this),this.stopRouteChangeWatch=null):this.stopRouteChangeWatch||(this.stopRouteChangeWatch=yt("rokt:".concat(this.instanceName),(function(){return r.notifyRouteChange()}))),this.notifyRouteChange()},e.prototype.notifyRouteChange=function(){var e,t,n;try{null===(t=null===(e=this.kit)||void 0===e?void 0:e.onRouteChange)||void 0===t||t.call(e)}catch(e){null===(n=this.logger)||void 0===n||n.error("RoktManager: Error in onRouteChange: ".concat(ie(e)))}},e.prototype.setAutoButtonClicksForwarded=function(e){this.autoButtonClicksForwarded=e},e.prototype.hasTargetingOptOut=function(){var e=this.launcherOptions||{};if(e.noTargeting||e.doNotShareOrSell)return!0;var t="undefined"==typeof navigator?void 0:navigator;return!!t&&!0===t.globalPrivacyControl},e.prototype.isCheckoutIntentSuppressed=function(){var e,t,n,i=null===(t=null===(e=this.store)||void 0===e?void 0:e.SDKConfig)||void 0===t?void 0:t.flags;return!(i&&!0===i[r.FeatureFlags.AutoButtonTracking]&&this.store.isEnabled&&this.autoButtonClicksForwarded)||(!!(null===(n=this.launcherOptions)||void 0===n?void 0:n.noFunctional)||this.hasTargetingOptOut())},e.prototype.isCheckoutIntentLive=function(){return!this.isCheckoutIntentSuppressed()&&("undefined"!=typeof Event&&K(Event.prototype.composedPath))},e.prototype.notifyCheckoutIntent=function(e,t){var n;if(void 0===t&&(t=window.location.pathname),!this.isCheckoutIntentSuppressed()){var r=this.kit;if(r)try{K(r.onCheckoutIntent)&&r.onCheckoutIntent(e)}catch(e){null===(n=this.logger)||void 0===n||n.error("RoktManager: Error in onCheckoutIntent: ".concat(ie(e)))}else this.pendingCheckoutIntents=this.pendingCheckoutIntents.filter((function(t){return t.signal.kind!==e.kind||!!t.signal.adds!=!!e.adds})).concat({signal:e,pathname:t}).slice(-6)}},e.prototype.discardCheckoutIntents=function(){this.pendingCheckoutIntents=[]},e.prototype.notifyPaymentPick=function(e){var t;if(!this.isCheckoutIntentSuppressed()){var n=this.kit;try{n&&K(n.onPaymentPick)&&n.onPaymentPick(e)}catch(e){null===(t=this.logger)||void 0===t||t.error("RoktManager: Error in onPaymentPick: ".concat(ie(e)))}}},e.prototype.flushCheckoutIntents=function(){var e=this,t=this.pendingCheckoutIntents;this.pendingCheckoutIntents=[];var n=Date.now(),r=window.location.pathname;t.filter((function(e){var t=e.signal,i=e.pathname;return n-t.t<3e4&&i===r})).sort((function(e,t){return e.signal.t-t.signal.t})).forEach((function(t){var n=t.signal;return e.notifyCheckoutIntent(n)}))},e.prototype.isAutoLogPageViewEnabled=function(){var e,t,n;return!0===(null===(n=null===(t=null===(e=this.store)||void 0===e?void 0:e.SDKConfig)||void 0===t?void 0:t.flags)||void 0===n?void 0:n[r.FeatureFlags.AutoLogPageView])},e.prototype.selectPlacements=function(e){var t,n,r,i,o,s,a,u,c,l,d,v,f,m,y,b,S;return g(this,void 0,void 0,(function(){var g,I,_,w,P,C,A,T,k,E,D,O,M,L,F,U,N,R,V,x,H,K,B,q,j=this;return h(this,(function(h){if(null===(t=this.captureTiming)||void 0===t||t.call(this,ge),!this.isReady()||(null===(n=this.store)||void 0===n?void 0:n.identityCallInFlight))return[2,this.deferredCall("selectPlacements",e)];try{if(g=e.attributes,I=(null==g?void 0:g.sandbox)||null,_=this.mapPlacementAttributes(g,this.placementAttributesMapping),(null===(r=this.logger)||void 0===r?void 0:r.isVerbose())&&(w=ne(g,null===(o=null===(i=this.store)||void 0===i?void 0:i.SDKConfig)||void 0===o?void 0:o.isDevelopmentMode),this.logger.verbose("mParticle.Rokt selectPlacements called with attributes:\n".concat(JSON.stringify(w,null,2)))),this.currentUser=this.identityService.getCurrentUser(),P=(null===(a=null===(s=this.currentUser)||void 0===s?void 0:s.getUserIdentities())||void 0===a?void 0:a.userIdentities)||{},C=P.email,A=_.email,T=void 0,k=void 0,(E=this.mappedEmailShaIdentityType&&!1!==ue.getIdentityType(this.mappedEmailShaIdentityType))&&(T=P[this.mappedEmailShaIdentityType],k=_.emailsha256||_[this.mappedEmailShaIdentityType]||void 0),D=this.hasIdentityChanged(C,A),O=this.hasIdentityChanged(T,k),M={},D&&(M.email=A,A&&(L="Email mismatch detected. Current email differs from email passed to selectPlacements call. Proceeding to call identify with email from selectPlacements call. Please verify your implementation.",this.logger.warning(L),null===(u=this.errorReporter)||void 0===u||u.report({message:L,code:hn.IDENTITY_MISMATCH,severity:vn.WARNING}))),O&&(M[this.mappedEmailShaIdentityType]=k,L="emailsha256 mismatch detected. Current mParticle hashedEmail differs from hashedEmail passed to selectPlacements call. Proceeding to call identify with hashedEmail from selectPlacements call. Please verify your implementation.",this.logger.warning(L),null===(c=this.errorReporter)||void 0===c||c.report({message:L,code:hn.IDENTITY_MISMATCH,severity:vn.WARNING})),F=this.toUserAttributes(_),z(M))this.setUserAttributes(this.currentUser,F);else try{this.identityService.identify({userIdentities:p(p({},P),M)},(function(e){var t,n=Number(null==e?void 0:e.httpCode);n&&(n>=400||n<0)&&j.logger.error("Background identify failed with HTTP "+n),j.setUserAttributes(null===(t=null==e?void 0:e.getUser)||void 0===t?void 0:t.call(e),F,M),j.processMessageQueue()}))}catch(e){this.logger.error("Background identify threw an error: "+ie(e)),this.setUserAttributes(this.identityService.getCurrentUser(),F,M)}return U=this.currentUser&&this.createFilteredUser?this.createFilteredUser(this.currentUser.getMPID()):null,N=(null===(l=null==U?void 0:U.getUserIdentities())||void 0===l?void 0:l.userIdentities)||{},R=null===(v=null===(d=this.store)||void 0===d?void 0:d.getTimeOnSite)||void 0===v?void 0:v.call(d),V=null===(m=null===(f=this.store)||void 0===f?void 0:f.getTotalTimeOnSite)||void 0===m?void 0:m.call(f),(x=p(p(p(p({},_),null!==I?{sandbox:I}:{}),R?{active_time_on_site_ms:R}:{}),V?{total_time_on_site_ms:V}:{})).email||(N.email?x.email=N.email:P.email&&this.logFilteredIdentity("email")),!E||x.emailsha256||x[this.mappedEmailShaIdentityType]||((H=N[this.mappedEmailShaIdentityType])?x.emailsha256=H:P[this.mappedEmailShaIdentityType]&&this.logFilteredIdentity(this.mappedEmailShaIdentityType)),x[fi]||(null===(y=this.integrationCapture)||void 0===y||y.capture(),K=null===(b=this.integrationCapture)||void 0===b?void 0:b.getClickIdsAsIntegrationAttributes(),(B=null===(S=null==K?void 0:K[Xn.Rokt])||void 0===S?void 0:S[fi])&&(x[fi]=B)),this.filters.filteredUser=U||this.filters.filteredUser||null,q=p(p({},e),{attributes:x}),[2,this.kit.selectPlacements(q)]}catch(e){return[2,Promise.reject(e instanceof Error?e:new Error("Unknown error occurred"))]}return[2]}))}))},e.prototype.logFilteredIdentity=function(e){var t;null===(t=this.logger)||void 0===t||t.verbose("mParticle.Rokt selectPlacements did not add the ".concat(e," user identity to the attributes because the Rokt connection does not allow it"))},e.prototype.hashAttributes=function(e){return g(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,u,l,d,p,v=this;return h(this,(function(f){switch(f.label){case 0:return f.trys.push([0,2,,3]),e&&"object"===c(e)?0===(t=Object.keys(e)).length?[2,{}]:(n=t.map((function(t){return g(v,void 0,void 0,(function(){var n,r;return h(this,(function(i){switch(i.label){case 0:return n=e[t],[4,this.hashSha256(n)];case 1:return r=i.sent(),[2,{key:t,attributeValue:n,hashedValue:r}]}}))}))})),[4,Promise.all(n)]):[2,{}];case 1:for(r=f.sent(),i={},o=0,s=r;o<s.length;o++)a=s[o],u=a.key,l=a.attributeValue,d=a.hashedValue,i[u]=l,d&&(i["".concat(u,"sha256")]=d);return[2,i];case 2:return p=f.sent(),this.logger.error("Failed to hashAttributes, returning an empty object: ".concat(ie(p))),[2,{}];case 3:return[2]}}))}))},e.prototype.setExtensionData=function(e){if(this.isReady())try{this.kit.setExtensionData(e)}catch(e){throw new Error("Error setting extension data: "+ie(e))}else this.deferredCall("setExtensionData",e)},e.prototype.use=function(e){if(!this.isReady())return this.deferredCall("use",e);try{return this.kit.use(e)}catch(t){return Promise.reject(t instanceof Error?t:new Error("Error using extension: "+e))}},e.prototype.terminate=function(){var e,t,n;return g(this,void 0,void 0,(function(){var r;return h(this,(function(i){switch(i.label){case 0:if(!this.isReady())return null===(e=this.logger)||void 0===e||e.verbose("mParticle.Rokt.terminate called before the Rokt kit was ready. Nothing to terminate."),[2];if(!K(this.kit.terminate))return null===(t=this.logger)||void 0===t||t.error("mParticle.Rokt.terminate is not supported by the attached Rokt Kit version."),[2];i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this.kit.terminate()];case 2:return i.sent(),[3,4];case 3:return r=i.sent(),null===(n=this.logger)||void 0===n||n.error("Failed to terminate the Rokt launcher: ".concat(ie(r))),[3,4];case 4:return[2]}}))}))},e.prototype.onShoppableAdsReady=function(e){if(this.kit&&this.isShoppableAdsLoaded)try{this.kit.onShoppableAdsReady(e)}catch(e){this.logger.error("Failed to register onShoppableAdsReady callback: ".concat(ie(e)))}else this.deferredCall("onShoppableAdsReady",e)},e.prototype.flushOnShoppableAdsReadyMessageQueue=function(e){var t=this;this.kit=e,this.messageQueue.forEach((function(n,r){var i;if("onShoppableAdsReady"===n.methodName){try{e.onShoppableAdsReady(n.payload)}catch(e){null===(i=t.logger)||void 0===i||i.error("RoktManager: Error flushing onShoppableAdsReady: "+e)}t.messageQueue.delete(r)}})),this.isShoppableAdsLoaded=!0},e.prototype.hashSha256=function(e){return g(this,void 0,void 0,(function(){var t,n;return h(this,(function(r){switch(r.label){case 0:if(null==e)return this.logger.warning("hashSha256 received null/undefined as input"),[2,e];r.label=1;case 1:return r.trys.push([1,3,,4]),t=String(e).trim().toLocaleLowerCase(),[4,this.sha256Hex(t)];case 2:return[2,r.sent()];case 3:return n=r.sent(),this.logger.error("Failed to hashSha256, returning undefined: ".concat(ie(n))),[2,void 0];case 4:return[2]}}))}))},e.prototype.getLocalSessionAttributes=function(){return this.store.getLocalSessionAttributes()},e.prototype.setLocalSessionAttribute=function(e,t){this.store.setLocalSessionAttribute(e,t)},e.prototype.isReady=function(){return Boolean(this.kit&&this.kit.launcher)},e.prototype.toUserAttributes=function(e){var t=["sandbox"],n={};for(var r in e)if(e.hasOwnProperty(r)&&-1===t.indexOf(r)){var i=e[r];n[r]=Array.isArray(i)?JSON.stringify(i):i}return n},e.prototype.setUserAttributes=function(e,t,n){if(void 0===n&&(n={}),e)try{if(this.hasContradictingIdentity(e,n))return void this.logger.warning("selectPlacements attributes were not set because identify did not resolve to a user with the passed email or hashed email.");e.setUserAttributes(t)}catch(e){this.logger.error("Error setting user attributes: "+e)}else this.logger.warning("selectPlacements attributes were not set because there is no user to set them on.")},e.prototype.hasContradictingIdentity=function(e,t){return Object.keys(t).some((function(n){var r,i,o=null===(i=null===(r=e.getUserIdentities())||void 0===r?void 0:r.userIdentities)||void 0===i?void 0:i[n];return Boolean(o)&&o!==t[n]}))},e.prototype.mapPlacementAttributes=function(e,t){for(var n={},r=0,i=t;r<i.length;r++){var o=i[r];n[o.map]=o.value}var s={};for(var a in e){if(e.hasOwnProperty(a))s[n[a]||a]=e[a]}return s},e.prototype.onIdentityComplete=function(){this.isReady()&&(this.currentUser=this.identityService.getCurrentUser(),this.processMessageQueue())},e.prototype.processMessageQueue=function(){var e,t=this;if(this.isReady()&&0!==this.messageQueue.size){null===(e=this.logger)||void 0===e||e.verbose("RoktManager: Processing ".concat(this.messageQueue.size," queued messages"));var n=Array.from(this.messageQueue.values());this.messageQueue.clear(),n.forEach((function(e){var n,r,i,o;if(e.methodName in t&&K(t[e.methodName])){if(null===(r=t.logger)||void 0===r?void 0:r.isVerbose()){var s=ne(e.payload,null===(o=null===(i=t.store)||void 0===i?void 0:i.SDKConfig)||void 0===o?void 0:o.isDevelopmentMode);t.logger.verbose("RoktManager: Processing queued message: ".concat(e.methodName," with payload: ").concat(JSON.stringify(s)))}var a=e.resolve,u=e.reject,c=function(n){var r;null===(r=t.logger)||void 0===r||r.error("RoktManager: Error processing message '".concat(e.methodName,"': ").concat(ie(n))),u&&u(n)};try{var l=t[e.methodName](e.payload);Promise.resolve(l).then((function(e){a&&a(e)})).catch(c)}catch(e){c(e)}}else null===(n=t.logger)||void 0===n||n.error("RoktManager: Method ".concat(e.methodName," not found"))}))}},e.prototype.queueMessage=function(e){this.messageQueue.set(e.messageId,e)},e.prototype.deferredCall=function(e,t){var n=this;return new Promise((function(r,i){var o="".concat(e,"_").concat(w());n.queueMessage({messageId:o,methodName:e,payload:t,resolve:r,reject:i})}))},e.prototype.sha256Hex=function(e){return g(this,void 0,void 0,(function(){var t,n,r;return h(this,(function(i){switch(i.label){case 0:return t=new TextEncoder,n=t.encode(e),[4,crypto.subtle.digest("SHA-256",n)];case 1:return r=i.sent(),[2,this.arrayBufferToHex(r)]}}))}))},e.prototype.arrayBufferToHex=function(e){for(var t=new Uint8Array(e),n="",r=0;r<t.length;r++){n+=t[r].toString(16).padStart(2,"0")}return n},e.prototype.hasIdentityChanged=function(e,t){return!!t&&(!e||e!==t)},e}(),yi=function(){function e(e){this.flags=e,this.flags={noFunctional:!0===e.noFunctional,noTargeting:!0===e.noTargeting,doNotShareOrSell:!0===e.doNotShareOrSell}}return e.prototype.getNoTargeting=function(){return this.flags.noTargeting},e.prototype.getNoFunctional=function(){return this.flags.noFunctional},e.prototype.getDoNotShareOrSell=function(){return this.flags.doNotShareOrSell},e.prototype.syncNoTargetingAttribute=function(e){e&&(this.flags.noTargeting?e.setUserAttribute(i,!0):W(e.getAllUserAttributes(),i)&&e.removeUserAttribute(i))},e}(),bi=function(){function e(){this.services=[]}return e.prototype.register=function(e){this.services.push(e)},e.prototype.report=function(e){var t=this;this.services.forEach((function(n){var r;try{n.report(e)}catch(e){null===(r=t.logger)||void 0===r||r.error("Error in ErrorReportingService: "+e)}}))},e}(),Si=function(){function e(){this.services=[]}return e.prototype.register=function(e){this.services.push(e)},e.prototype.log=function(e){var t=this;this.services.forEach((function(n){var r;try{n.log(e)}catch(e){null===(r=t.logger)||void 0===r||r.error("Error in LoggingService: "+e)}}))},e}(),Ii="is_auto_button_click",_i="Auto Button Click",wi="is_auto_link_click",Pi="Auto Link Click",Ci=function(e,t){for(var n={label_source:e.labelSource,element:e.element,type:e.type,path:t,hostname:window.location.hostname},r={label:e.label,aria_label:e.ariaLabel,icon:e.icon,element_id:e.elementId,element_name:e.elementName,test_id:e.testId,controls:e.controls,form:e.form,link_type:e.linkType,link_domain:e.linkDomain,file_extension:e.fileExtension},i=0,o=Object.keys(r);i<o.length;i++){var s=o[i];r[s]&&(n[s]=r[s])}return void 0!==e.checked&&(n.checked=e.checked),n},Ai=["label_source","element","type","path","label","aria_label","icon","element_id","element_name","test_id","controls","form","link_type","link_domain","file_extension","checked"],Ti=function(e,t,n){void 0===n&&(n=!1);var r=e.filteringEventAttributeValue;if(r&&r.eventAttributeValue&&Ai.some((function(e){return Bn.hashAttributeConditionalForwarding(e)===r.eventAttributeName})))return"forwarding rule";var i={hostname:window.location.hostname};i[n?wi:Ii]=!0;var o={EventName:n?Pi:_i,EventCategory:se.Other,EventDataType:oe.PageEvent,EventAttributes:i},s=[["data plan",{}],["forwarding rule",{filteringEventAttributeValue:r}],["event name filter",{eventNameFilters:e.eventNameFilters}],["event type filter",{eventTypeFilters:e.eventTypeFilters}]].find((function(e){var n=e[1];return!Er(o,n,t)}));return s?s[0]:void 0},ki='button, input[type="submit"], input[type="button"], input[type="image"], [role="button"]',Ei='[contenteditable]:not([contenteditable="false"])';function Di(e){var t=K(e.getRootNode)?e.getRootNode():null;return e.assignedSlot||e.parentElement||t&&t.host||null}function Oi(e,t,n){for(var r=e;r&&r!==n;){if(t(r))return!0;r=Di(r)}return!1}function Mi(e,t){return Oi(e,(function(e){return e.matches(t)}))}var Li="[data-core-type], #rokt-controller-frame";function Fi(e){var t=e.getAttribute("src");if(!t)return!1;try{return-1!==new URL(t,"https://example.test").pathname.indexOf("/wsdk/")}catch(e){return!1}}var Ui=["apple-pay-button",".apple-pay-button",".gpay-button",".gpay-card-info-container","#gpay-button-online-api-id","paypal-button","venmo-button","paypal-pay-later-button","paypal-credit-button","shop-pay-button","shop-pay-wallet-button","shopify-accelerated-checkout","shopify-accelerated-checkout-cart","shopify-apple-pay-button","shopify-google-pay-button","shopify-paypal-button","shopify-amazon-pay-button",".amazonpay-button-focusable","#AmazonPayButton","[data-amazon-pay-button]","[data-afterpay-entry-point]"].join(", "),Ni="paypal-basic-card-button",Ri=Ui+", "+Ni,Vi=["set-up","add-money","reload","top-up"].map((function(e){return'apple-pay-button[type="'+e+'"]'})).join(", ");function xi(e){var t=e.matches(Ri)?e:null;if(!t){var n=K(e.getRootNode)?e.getRootNode():null;t=n&&n.host&&n.host.matches(Ri)?n.host:null}if(t)return t.matches(Vi)?"none":t.matches(Ni)?"checkout_step":"wallet"}var Hi=/(?:^| )(?:apple ?pay|google ?pay|g ?pay|amazon ?pay|cash ?app|venmo|pay ?pal|shop ?pay|klarna|after ?pay|clear ?pay|sezzle|samsung ?pay)(?= |$)/,Ki=/(?:^| )affirm(?= |$)/,Bi=/(?:^| )(?:pay|payment|checkout)(?= |$)/,qi=/(?:^| )(?:btn|button)(?= |$)/,ji=/(?:^| )(?:logo|icon|image|img|label|text|caption|message|messaging|info|tooltip|help|learn|terms|promo|banner|container|wrapper|wrap|placeholder|form|section|panel|modal|list|group|select|option|tab|toggle|radio|choice|method)(?= |$)/;function zi(e){return(e||"").slice(0,64).replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[^A-Za-z0-9]+/g," ").trim().toLowerCase()}function Qi(e){return[e.getAttribute("id"),e.getAttribute("data-testid")].map(zi).some((function(e){return(Hi.test(e)||Ki.test(e)&&Bi.test(e))&&qi.test(e)&&!ji.test(e)}))}var Wi='input[type="radio"], input[type="checkbox"], label, [role="radio"], [role="tab"], [role="option"], [role="checkbox"], [role="switch"], [role="menuitemradio"], [role="menuitemcheckbox"], [aria-checked], [aria-selected]',Ji='[role="radiogroup"], [role="tablist"], [role="listbox"]',Gi="klarna-placement, afterpay-placement, square-placement, .affirm-as-low-as, .affirm-site-modal, .affirm-product-modal, [data-pp-message]";function $i(e,t,n){return void 0===n&&(n=!1),!!e.matches(Wi)||(!!Mi(e,Ji)||(!(t||!(!n&&e.hasAttribute("aria-expanded")||e.hasAttribute("aria-pressed")))||Mi(e,Gi)))}var Yi=Wi+", "+Ji+', input:not([type="hidden"]):not([type="submit"]):not([type="button"]):not([type="image"]), select, textarea, option, optgroup, datalist, [aria-expanded], [aria-pressed], '+Ei,Xi=Wi+", "+ki+", a[href], "+Ri+", [aria-expanded], [aria-pressed], "+Ei;function Zi(e){if(!Qi(e)||e.matches(Yi))return!1;for(var t=Di(e);t;t=Di(t))if(t.matches(Xi)||Qi(t))return!1;var n=e.shadowRoot;return!(e.querySelector(Yi)||n&&n.querySelector(Yi))}function eo(e){for(var t,n=e.slice(0,12),r=0,i=n;r<i.length;r++){if((a=i[r])instanceof Element){t=a;break}}if(!t||Mi(t,Li+", [data-mp-no-track]"))return!0;for(var o=0,s=n;o<s.length;o++){var a;if((a=s[o])instanceof Element&&Fi(a))return!0}return!1}function to(e,t){if(void 0===t&&(t=!1),t||!eo(e)){for(var n,r,i=!1,o=0,s=e.slice(0,12);o<s.length;o++){var a=s[o];if(n)break;a instanceof Element&&(a.matches(ki+", a[href], "+Ri)||!i&&Zi(a)?n=a:(!r&&a.matches('input[type="checkbox"], input[type="radio"]')&&(r=a),i=i||a.matches(Yi)))}if(!(!(n=n||r)||n.matches(':disabled, [aria-disabled="true"]')||n.classList.contains("disabled")&&Qi(n)))return n}}function no(e,t){var n="input, select, textarea, [data-mp-no-track], "+Ei;return e.matches("input, select, textarea, option, optgroup, datalist, "+Ei)||(t?Array.from(e.querySelectorAll(n)).some((function(e){return e!==t})):!!e.querySelector(n))||Mi(e,"select, datalist, textarea, [data-mp-no-track], "+Ei)}var ro=function(){try{return{run:new RegExp("\\p{Nd}{6,}","u"),number:new RegExp("\\p{Nd}+(?:[.,\u060c\u066b\u066c]\\p{Nd}+)*","gu")}}catch(e){return}}(),io=128;function oo(e){if(e&&!(e.length>io)&&ro){var t=e.replace(/\s+/g," ").trim().toLowerCase();if(t&&-1===t.indexOf("@")&&!ro.run.test(t.replace(/[\s()\-\u2010-\u2015]/g,"")))return t.replace(ro.number,"#").slice(0,64).trim()||void 0}}var so=/\.(pdf|zip|csv|txt|ics|docx?|xlsx?|pptx?|dmg|exe|apk|mp3|mp4)$/i;function ao(e){if("wallet"===xi(t=e)||Zi(t))return"wallet";var t,n=e.tagName.toLowerCase();return"button"===n||"input"===n?n:e.matches('a[href]:not([role="button"])')?"link":"role"}var uo='script, style, template, [hidden], [aria-hidden="true"], [inert]',co=64;function lo(e){var t=e;return K(t.assignedNodes)?t.assignedNodes():[]}function po(e){return!!(e.matches(uo)||(t=e,n=t.parentElement,n&&(n.shadowRoot?!t.assignedSlot:lo(n).length>0)))||!(e instanceof SVGTitleElement)&&"none"===window.getComputedStyle(e).display;var t,n}function go(e){var t=window.getComputedStyle(e).visibility;return"hidden"!==t&&"collapse"!==t}function ho(e,t){return!Oi(e,po,t)}function vo(e,t){var n=e.assignedSlot;return!!n&&ho(n,t)}function fo(e){return!(/\S/.test(e.textContent||"")||e instanceof Element&&(e.matches("slot")||e.querySelector("slot")))}function mo(e){var t="",n=0,r=function(e){t=(t+e).replace(/\s+/g," ")},i=function(e){if(po(e))return!0;for(var o=lo(e),s=o.length?o:e.childNodes,a=0;a<s.length;a++){var u=s[a],c=u.nodeType===Node.TEXT_NODE;if(c||u instanceof Element)if(fo(u))r(u.textContent);else{if(++n>co)return!1;if(!e.shadowRoot||vo(u,e)){if(c)go(u.assignedSlot||e)&&r(u.nodeValue);else if(o.length&&no(u)||!i(u))return!1;if(t.trim().length>io)return!1}}}return!0};return i(e)?t.trim():void 0}function yo(e){for(var t=e.querySelectorAll("img[alt]"),n=0;n<t.length&&n<co;n++)if(ho(t[n],e)&&go(t[n]))return bo(t[n].getAttribute("alt"))}function bo(e){return e&&e.trim()?e:void 0}function So(e){var t=e.getAttribute("aria-labelledby");if(t){var n=K(e.getRootNode)?e.getRootNode():document,r=t.split(/\s+/).map((function(e){return(t=n.getElementById?n.getElementById(e):null)&&!no(t)&&ho(t)?mo(t):"";var t}));if(-1!==r.indexOf(void 0))return{source:"none"};if(u=r.filter((function(e){return!!e})).join(" "))return{raw:u,source:"labelledby"}}var i=bo(e.getAttribute("aria-label"));if(i)return{raw:i,source:"aria"};var o=e.children.length<=4&&!no(e);if(e instanceof HTMLInputElement){var s=e.type;if("image"===s){if(c=bo(e.getAttribute("alt")))return{raw:c,source:"alt"}}else if("submit"===s||"button"===s||"reset"===s){var a=bo(e.value);if(a)return{raw:a,source:"value"};if("button"!==s)return{raw:s,source:"value"}}}else if(o&&ho(e)){var u,c;if(void 0===(u=mo(e)))return{source:"none"};if(u)return{raw:u,source:"text"};if(c=yo(e))return{raw:c,source:"alt"}}var l=bo(e.getAttribute("title"));return l?{raw:l,source:"title"}:{source:"none"}}var Io=/^(?:fa|fas|far|fal|icon|bi|glyphicon|ti|mdi|ri|la|lucide|ion|feather|ph)-([a-z][a-z-]{1,31})$/,_o=/^(?:solid|regular|light|thin|duotone|brands|sharp|fw|lg|xs|sm|xl|spin|pulse|border|inverse|stack|flip(?:-[a-z]+)?|rotate(?:-[a-z]+)?|pull-[a-z]+)$/;function wo(e){var t=function(e){return!Mi(e,"[data-mp-no-track]")},n=Array.from(e.querySelectorAll("use")).filter(t)[0];if(n){var r=n.getAttribute("href")||n.getAttribute("xlink:href")||"",i=r.indexOf("#"),o=function(e){if(e){var t=e.toLowerCase().replace(/^icon-/,"");return/^[a-z][a-z-]{1,31}$/.test(t)?t:void 0}}(-1===i?null:r.slice(i+1));if(o)return o}for(var s=0,a=[e].concat(Array.from(e.querySelectorAll("i, span, svg"))).filter(t).slice(0,5);s<a.length;s++)for(var u=0,c=(a[s].getAttribute("class")||"").split(/\s+/);u<c.length;u++){var l=c[u],d=Io.exec(l.toLowerCase());if(d&&!_o.test(d[1]))return d[1]}}var Po=/^[A-Za-z]+[0-9]{0,3}(?:[-_](?:[A-Za-z]+[0-9]{0,3}|[0-9]{1,3}))*$/;function Co(e){if(e){var t=e.trim(),n=t.replace(/[^0-9]/g,"").length;return t.length<=64&&n<=3&&Po.test(t)?t:void 0}}var Ao=["data-testid","data-test-id","data-test","data-qa","data-cy"];function To(e,t){for(var n=0,r=t;n<r.length;n++){var i=r[n],o=Co(e.getAttribute(i));if(o)return o}}function ko(e){var t=e.getAttribute("aria-controls");return Co(t?t.trim().split(/\s+/)[0]:null)||To(e,["popovertarget","commandfor"])}function Eo(e){var t=e instanceof HTMLButtonElement||e instanceof HTMLInputElement?e.form:null;return t?Co(t.getAttribute("id")):void 0}function Do(e){var t=e.tagName.toLowerCase();return"button"===t||"input"===t?e.type:"button"}function Oo(e){var t=(e.getAttribute("href")||"").trim();if(!t||"#"===t.charAt(0))return{type:"same_page"};if(e instanceof HTMLAnchorElement){var n=e.protocol.toLowerCase();if("javascript:"===n)return{type:"same_page"};if("http:"===n||"https:"===n){var r=e.hostname!==window.location.hostname?e.hostname.toLowerCase():void 0,i=so.exec(e.pathname);return e.hasAttribute("download")||i?{type:"download",domain:r,fileExtension:i?i[1].toLowerCase():void 0}:r?{type:"outbound",domain:r}:e.pathname===window.location.pathname&&e.search===window.location.search?{type:"same_page"}:{type:"internal"}}}}var Mo='input[type="checkbox"], input[type="radio"], [role~="checkbox"], [role~="radio"], [role~="switch"], [role~="menuitemcheckbox"], [role~="menuitemradio"]',Lo='[role~="radio"], [role~="menuitemradio"]';function Fo(e){var t=e instanceof HTMLLabelElement?e.control:e;return t&&t.matches(Mo)?t:null}function Uo(e){return e instanceof HTMLInputElement?"radio"===e.type:!!e&&e.matches(Lo)}function No(e,t){for(var n=0,r=t;n<r.length;n++){var i=r[n];if(i===e)break;var o=i instanceof Element?Fo(i):null;if(o)return o}return Fo(e)||e.querySelector(Mo)}var Ro=/(?:^| )(?:pay|payment\w*|tenders?|gateways?)(?: |$)/,Vo='[role="radiogroup"], fieldset';function xo(e,t){void 0===t&&(t=[]);var n=No(e,t);if(Uo(n)&&!Mi(n,"[data-mp-no-track]")&&(i=(r=n).getAttribute("name"),((o=i?null:r.closest(Vo))?[o.getAttribute("id"),o.getAttribute("name"),o.getAttribute("aria-label")]:[i]).some((function(e){return Ro.test(zi(e))})))){var r,i,o,s=function(e){var t=[oo(So(e).raw)];return(e instanceof HTMLInputElement&&e.labels?Array.from(e.labels).slice(0,2):[]).forEach((function(n){ho(n)&&!no(n,e)&&(t.push(oo(mo(n))),t.push(oo(yo(n))))})),t.push(Co(e.getAttribute("id")),To(e,Ao)),t.filter((function(e,n){return!!e&&t.indexOf(e)===n}))}(n);return s.length?{radio:n,names:s}:void 0}}var Ho=/(?:^|\/)(?:checkouts?|payment|order|kasse|paiement|commander?|pago)(?:\/|$)/i,Ko=new RegExp("\\b(?:coupon|promo(?: code)?|newsletter|sign in|sign up|log in|login|add to (?:cart|bag|basket)|gift card balance|(?:add|apply|redeem|check|enter|use) (?:a |an |your )?gift card|pay later|interest free|as low as|learn more|prequalify|apply (?:now|for)|payment plan|available|accepted|we accept|set up|add money|reload|top up|add to (?:apple|google) wallet|connect|link your|unlink|remove|delete|edit|change|manage|use a different|switch)\\b|^pay in$|\\bpay in (?:installments|instalments)\\b"),Bo=new RegExp(["gutschein|anmelden|warenkorb|bon cadeau|connexion|panier|cup\xf3n|iniciar sesi\xf3n|carrito","carrello|codice sconto|accedi|buono regalo|winkelwagen|kortingscode|inloggen|cadeaubon|achteraf betalen","\u30ab\u30fc\u30c8|\u30af\u30fc\u30dd\u30f3|\u30ed\u30b0\u30a4\u30f3|\u4f1a\u54e1\u767b\u9332|\u30ae\u30d5\u30c8|\u5f8c\u6255\u3044|\u30e1\u30eb\u30de\u30ac"].join("|")),qo=["(?:jetzt )?(?:zahlungs|kosten)pflichtig (?:bestellen|buchen)|(?:jetzt )?bezahlen|kauf abschlie\xdfen|bestellung abschlie\xdfen","commander et payer|payer(?: maintenant)?|(?:confirmer|finaliser) (?:ma |la )?commande","valider et payer|confirmer et payer|commande avec obligation de paiement|finaliser l'achat","(?:realizar|confirmar|completar) (?:el |mi |la )?(?:pedido|compra|reserva)|finalizar (?:el |mi )?pedido|pagar(?: ahora)?","pedido con obligaci\xf3n de pago","(?:effettua|conferma|concludi|completa) (?:l'|il )?(?:ordine|acquisto)|ordine con obbligo di pagamento","paga(?: ora| adesso)?|ordina e paga","(?:nu )?betalen|bestellen en betalen|bestelling plaatsen|plaats bestelling|bestelling afronden","bestelling met betalingsverplichting","(?:\u3053\u306e\u5185\u5bb9\u3067|\u4e0a\u8a18\u306e?\u5185\u5bb9\u3067)?\u3054?(?:\u6ce8\u6587|\u8cfc\u5165|\u4e88\u7d04|\u6c7a\u6e08|\u304a?\u652f\u6255\u3044?)\u3092?(?:\u78ba\u5b9a|\u5b8c\u4e86)(?:\u3059\u308b)?","(?:\u3053\u306e\u5185\u5bb9\u3067|\u4e0a\u8a18\u306e?\u5185\u5bb9\u3067)\u3054?(?:\u6ce8\u6587|\u8cfc\u5165|\u4e88\u7d04)\u3059\u308b|\u3054?\u6ce8\u6587\u3059\u308b|\u6c7a\u6e08\u3059\u308b|(?:\u4eca\u3059\u3050|\u3092)?\u652f\u6255\u3046"].join("|"),jo=new RegExp("^(?:(?:(?:agree|accept|review) and )?(?:place|submit|complete|confirm|finali[sz]e)(?!(?: [^ ]+){0,2} (?:another|new|next)(?: |$))(?! (?:[^ ]+ )?gift card)(?: [^ ]+){0,2} (?:order|purchase|booking|reservation|payment|checkout|transaction)(?: now| securely| and pay| (?:with|using) [^ ]+(?: [^ ]+)?)?(?: (?:total|subtotal|items?|tickets?))?|pay(?: securely)?(?: now)?|(?:confirm|agree|accept|submit|order|book) and pay|pay and place (?:my |your )?order|order with obligation to pay|"+qo+")$"),zo=new RegExp("^(?:(?:place|submit|complete)(?!(?: [^ ]+){0,2} (?:another|new|next)(?: |$))(?: [^ ]+){0,2} (?:order|purchase)|"+qo+")$"),Qo=new RegExp("^(?:buy now|purchase|jetzt kaufen|kaufen|commander|(?:passer|valider) (?:la |ma )?commande|finalizar (?:la |mi )?compra|comprar ahora|acquista ora|nu kopen|\u4eca\u3059\u3050\u8cfc\u5165|\u8cfc\u5165\u3059\u308b|\u3053\u306e\u5185\u5bb9\u3067\u7533\u3057\u8fbc\u3080)$"),Wo=new RegExp("^(?:"+["(?:let's |lets |go to |proceed to |secure )?(?:check ?out|checkout)(?: now| securely| as guest)?","(?:continue|proceed) to (?:payment|review|billing|shipping|delivery|order review)|review (?:my |your )?order","guest checkout|(?:pay|continue|check ?out) (?:with|by) (?:card|credit card|debit card|credit or debit card)","zur kasse|zur kasse gehen|auschecken|weiter zur zahlung","passer \xe0 la caisse|continuer vers le paiement|proc\xe9der au paiement","ir a caja|continuar al pago|tramitar pedido","procedi al checkout|procedi all'acquisto|procedi al pagamento|vai alla cassa","afrekenen|verder naar betalen|doorgaan naar betalen","\u30ec\u30b8\u306b\u9032\u3080|\u3054?(?:\u8cfc\u5165|\u6ce8\u6587)\u624b\u7d9a\u304d(?:\u3078|\u306b)(?:\u9032\u3080)?|\u304a?\u652f\u6255\u3044(?:\u3078|\u306b)\u9032\u3080|(?:\u3054\u6ce8\u6587\u5185\u5bb9\u306e)?\u78ba\u8a8d\u753b\u9762\u3078(?:\u9032\u3080)?"].join("|")+")$"),Jo="(?:(?:my|your|the) )?(?:shopping )?(?:cart|bag|basket)",Go=new RegExp("^add(?: [^ ]+){0,5} to "+Jo+"$"),$o=new RegExp("^(?:(?:(?:view|open|go to) )?"+Jo+"(?: items?)?|items? in "+Jo+")$"),Yo="apple pay|google pay|paypal|venmo|amazon pay|shop pay|klarna|afterpay|clearpay|cash app(?: pay)?|affirm|sezzle|samsung pay",Xo=new RegExp("^(?:(?:pay|buy|purchase|order|book|donate|subscribe|check ?out|checkout|express checkout|continue|proceed|complete purchase|place (?:my |your )?order)(?: now| securely)? (?:with|using|via|through|by) (?:"+Yo+")(?: express(?: checkout)?| checkout)?|(?:continue|proceed|go) (?:to|with) (?:"+Yo+"))$"),Zo=new RegExp("^(?:"+Yo+")(?: (?:checkout|check out|express(?: checkout)?|express pay|buy now|pay now|pay|now)| (?:logo|icon|mark|button)(?: (?:logo|icon|mark|button))*)?$"),es={"pay.google.com":"google_pay","applepay.cdn-apple.com":"apple_pay","payments.amazon.com":"amazon_pay","pay.shopify.com":"shop_pay"},ts=new Set(["www.paypal.com","www.sandbox.paypal.com"]),ns=/^\/smart\/(?:buttons|menu)(?:\/|$)/,rs=/^\/smart\/card-fields?(?:\/|$)/,is=/^__zoid__paypal_/,os=/^__zoid__paypal_(?:buttons|menu)__/,ss=/\/elements-inner-(?:payment-request|express-checkout)-/,as=/\/elements-inner-card\b/,us=["adyen.com","braintreegateway.com","cybersource.com","squarecdn.com","checkout.com"],cs=/[\u2019\u2018]/g,ls=/[0-9\uFF10-\uFF19$\u20AC\u00A3\u00A5\uFFE5\u20B9\u5186.,\uFF0C]/g,ds=/\([^()]*\)|\[[^[\]]*\]|\uFF08[^\uFF08\uFF09]*\uFF09|\uFF3B[^\uFF3B\uFF3D]*\uFF3D|\u3010[^\u3010\u3011]*\u3011/g,ps="[\\s!-/:-@\\[-`{-~\\u00A1-\\u00BF\\u00D7\\u00F7\\u2000-\\u206F\\u20A0-\\u20CF\\u2190-\\u2BFF\\u3000-\\u3003\\u3008-\\u3011\\u3014-\\u301F\\u30FB\\uD800-\\uDFFF\\uFE00-\\uFE0F\\uFF01-\\uFF0F\\uFF1A-\\uFF20\\uFF3B-\\uFF40\\uFF5B-\\uFF65]+",gs=new RegExp("^"+ps+"|"+ps+"$","g");var hs=/[-_|\xb7\u2022]/g,vs=/(?:^| )(?:usd|aud|cad|nzd|gbp|eur|chf|sgd|hkd|jpy|inr|mxn)(?= |$)|\b(?:a|au|ca|c|us|nz|hk|s)\$/g,fs=[[/\bapplepay\b/g,"apple pay"],[/\bg ?pay\b/g,"google pay"],[/\bamazonpay\b/g,"amazon pay"],[/\bshoppay\b/g,"shop pay"],[/\bcashapp\b/g,"cash app"]],ms=8;function ys(e){if(e&&!(e.length>128)){var t=e.toLowerCase().replace(cs,"'").replace(/[&+]/g," and ").replace(hs," ").replace(vs," ").replace(ls,"").replace(/\s+/g," ").trim();return fs.forEach((function(e){var n=e[0],r=e[1];t=t.replace(n,r)})),t.split(" ").length>ms?void 0:t}}function bs(e){return e.replace(ds," ").replace(/\s+/g," ").replace(gs,"")||e.replace(gs,"")}function Ss(e){return function(e){if(e instanceof HTMLInputElement){var t=e.type,n=null;return"submit"===t||"button"===t?n=e.value:"image"===t&&(n=e.getAttribute("alt")),[e.getAttribute("aria-label"),n]}return e.children.length>4||no(e)?[e.getAttribute("aria-label")]:[e.getAttribute("aria-label"),e.textContent]}(e).map(ys).filter((function(e){return!!e}))}function Is(e,t,n){return t?zo.test(e):jo.test(e)||Qo.test(e)&&"checkout_path"===function(e){return Ho.test(e)?"checkout_path":"other"}(n)}function _s(e,t){var n=xi(e);if("none"!==n){if(n)return $i(e,"wallet"===n)?void 0:{kind:n,source:"vendor"};var r,i=Ss(e),o=i.map(bs),s=function(e,t){var n=t.length?void 0:ys(e.getAttribute("title")),r=n?[bs(n)]:t;return r.some((function(e){return Go.test(e)}))?"add":(e.hasAttribute("aria-expanded")||e.hasAttribute("aria-haspopup"))&&r.some((function(e){return $o.test(e)}))?"open":void 0}(e,o);if("add"===s?r={kind:"cart",source:"label",adds:!0}:"open"===s&&(r={kind:"cart",source:"label"}),!$i(e,!1,!!r)){if(r&&e.hasAttribute("aria-expanded"))return r;var a=e.matches('a[href]:not([role="button"])');if(o.some((function(e){return Is(e,a,t)})))return{kind:"commit",source:"label"};if(i.concat(o).some((function(e){return Ko.test(e)||Bo.test(e)})))return r;if(Zi(e))return{kind:"wallet",source:"name"};for(var u=!a&&e.matches(ki),c=0,l=o;c<l.length;c++){var d=l[c];if(u&&Xo.test(d))return{kind:"wallet",source:"label"};if(u&&Zo.test(d))return{kind:"wallet",source:"brand"};if(Wo.test(d))return{kind:"checkout_step",source:"label"}}return r}}}function ws(e,t){if("visible"===t.document.visibilityState&&e instanceof HTMLIFrameElement&&!(Mi(n=e,Li)||Fi(n)||Mi(e,"[data-mp-no-track]"))){var n;if((!e.src||"about:blank"===e.src)&&is.test(e.name))return os.test(e.name)?{kind:"wallet"}:{kind:"frame"};try{var r=new URL(e.src),i="https:"===r.protocol?r.hostname:"";if(ts.has(i))return ns.test(r.pathname)?{kind:"wallet"}:rs.test(r.pathname)?{kind:"frame",family:"card"}:{kind:"frame"};if(Object.prototype.hasOwnProperty.call(es,i))return{kind:"wallet",family:es[i]};if("js.stripe.com"===i)return ss.test(r.pathname)?{kind:"wallet"}:as.test(r.pathname)?{kind:"frame",family:"card"}:{kind:"frame"};if(us.some((function(e){return function(e,t){return e===t||e.length>t.length&&e.slice(e.length-t.length-1)==="."+t}(i,e)})))return{kind:"frame"}}catch(e){}}}var Ps="__mpBtn__",Cs=function(){return"undefined"==typeof window?null:window},As=function(){var e=Cs(),t=e?e[Ps]:void 0;return t?t.tracker:void 0},Ts=function(){var e=Cs();if(e){var t=As();t&&t.teardown(),e[Ps]={}}},ks="__mpApplePayHook__",Es=function(e){var t=e.ApplePaySession;return t&&t.prototype},Ds={capture:!0,passive:!0},Os={passive:!0},Ms=function(){function e(e){var t=this;this.active=!1,this.hasRoktKit=!1,this.logButtons=!1,this.logLinks=!1,this.generation=0,this.lastCommitClick=-1/0,this.lastClick=null,this.lastSent={},this.pagePath=null,this.pageEvents=0,this.pending=[],this.uploadTimerId=null,this.uploadHeld=!1,this.leaving=!1,this.drain=function(){var e=t.pending;t.pending=[],e.forEach((function(e){return e()}))},this.onHide=function(e){if("beforeunload"===e.type||"pagehide"===e.type||"hidden"===document.visibilityState){t.leaving=!0;try{t.drain()}finally{t.leaving=!1}t.cancelUpload()}},this.onPageShow=function(e){e.persisted&&t.reset()},this.onEvent=function(e){try{t.observe(e)}catch(e){t.log("[error] event handler threw: "+e)}},this.mpInstance=e}return Object.defineProperty(e.prototype,"isActive",{get:function(){return this.active},enumerable:!1,configurable:!0}),e.prototype.init=function(e){var t=Cs();if(t){var n=As();n&&n.teardown(),this.active&&this.teardown(),this.hasRoktKit=e.hasRoktKit,this.logButtons=e.logButtons,this.logLinks=e.logLinks,(this.logButtons||this.logLinks)&&this.eventsEnabled()||!this.isKitSuppressed()?(t.document.addEventListener("click",this.onEvent,Ds),t.document.addEventListener("submit",this.onEvent,Ds),t.addEventListener("blur",this.onEvent,Os),t.addEventListener("pageshow",this.onPageShow,Os),t.addEventListener("beforeunload",this.onHide,Ds),t.addEventListener("pagehide",this.onHide,Ds),t.document.addEventListener("visibilitychange",this.onHide,Ds),this.active=!0,t[Ps]||(t[Ps]={}),t[Ps].tracker=this,this.isKitSuppressed()||function(e){try{var t=Es(e),n=t&&t.begin;if(!K(n)||n[ks])return;var r=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=n.apply(this,e);try{var i=As();i&&i.onApplePayBegin()}catch(e){}return r};Object.defineProperty(r,ks,{value:n}),t.begin=r}catch(e){}}(t),this.log("listening")):this.log("opted out, not starting")}},e.prototype.onApplePayBegin=function(){var e=this,t=Date.now(),n=this.lastClick;if(!(!this.active||!n||n.excluded||"commit"===n.kind||t-n.t>1e3||this.isKitSuppressed())){var r=window.location.pathname,i=this.generation;setTimeout((function(){if(i===e.generation)try{e.emit("wallet","wallet"===n.kind?n.source:"api","apple_pay",t,r)}catch(t){e.log("[error] Apple Pay delivery threw: "+t)}}),0)}},e.prototype.teardown=function(){var e=Cs();if(e){e.document.removeEventListener("click",this.onEvent,!0),e.document.removeEventListener("submit",this.onEvent,!0),e.removeEventListener("blur",this.onEvent),e.removeEventListener("pageshow",this.onPageShow),e.removeEventListener("beforeunload",this.onHide,!0),e.removeEventListener("pagehide",this.onHide,!0),e.document.removeEventListener("visibilitychange",this.onHide,!0);var t=e[Ps];t&&t.tracker===this&&(t.tracker=void 0,function(e){try{var t=Es(e),n=t&&t.begin;K(n)&&K(n[ks])&&(t.begin=n[ks])}catch(e){}}(e))}this.active=!1,this.clearPending()},e.prototype.clearPending=function(){this.reset();var e=this.mpInstance._RoktManager;e&&e.discardCheckoutIntents()},e.prototype.reset=function(){this.generation++,this.pending=[],this.lastCommitClick=-1/0,this.lastClick=null,this.lastSent={},this.pagePath=null,this.pageEvents=0,this.cancelUpload()},e.prototype.enqueue=function(e){var t;this.pending.push(e),1===this.pending.length&&(t=this.drain,K(window.requestAnimationFrame)&&"hidden"!==document.visibilityState?requestAnimationFrame((function(){setTimeout(t,0)})):setTimeout(t,0))},e.prototype.observe=function(e){var t=this;if(this.active&&e.isTrusted){var n=e.type,r="click"===n&&(this.logButtons||this.logLinks)&&this.eventsEnabled()&&!this.hasTargetingOptOut(),i=!this.isKitSuppressed();if(r||i){var o,s,a,u,c,l,d,p=Date.now(),g=window.location.pathname,h=!1,v=!1;if("click"===n){var f=K(e.composedPath)?e.composedPath().slice(0,12):[],m=eo(f);if(I=m?void 0:to(f,!0)){if(o=r&&(this.logButtons||I.matches("a[href]"))?function(e,t){var n;if(void 0===t&&(t=[]),e.matches('a[href]:not([role="button"])')){if(!(n=Oo(e)))return}else e.matches("a[href]")&&(n=Oo(e))&&"same_page"===n.type&&(n=void 0);var r=ao(e),i=e instanceof HTMLInputElement&&("checkbox"===e.type||"radio"===e.type)?e:void 0,o=i||No(e,t),s=Uo(o),a=s?o instanceof HTMLInputElement?o:null:e,u=o?void 0:So(e),c=u?oo(u.raw):void 0;return{label:c,labelSource:c?u.source:"none",ariaLabel:o?void 0:oo(e.getAttribute("aria-label")),icon:o?void 0:wo(e),elementId:s?void 0:Co(e.getAttribute("id")),elementName:Co(a&&a.getAttribute("name")),testId:s?void 0:To(e,Ao),controls:s?void 0:ko(e),form:Eo(e),element:r,type:Do(e),linkType:n?n.type:void 0,linkDomain:n?n.domain:void 0,fileExtension:n?n.fileExtension:void 0,checked:i?i.checked:void 0}}(I,f):void 0,o){h=this.logLinks&&function(e){return!!e.linkType&&"same_page"!==e.linkType}(o);var y=this.logButtons&&!h&&!("internal"===o.linkType&&I.matches('a[href]:not([role="button"])'));h||y||(o=void 0)}o&&void 0!==o.checked&&(s=I);var b=i?_s(I,g):void 0;a=b?b.kind:void 0,u=b?b.source:void 0,c=b?b.adds:void 0,l=i?xo(I,f):void 0}this.lastClick={t:p,excluded:m,kind:a,source:u}}else if("submit"===n){var S=e.submitter,I=S?to([S]):void 0;if(S){if(I){b=_s(I,g);a=b?b.kind:void 0,u=b?b.source:void 0,c=b?b.adds:void 0}}else a="commit",u="submit";v=!S}var _=this.generation;this.enqueue((function(){var i;if(_===t.generation)try{if("blur"===n){var f=ws(document.activeElement,window);a=f?f.kind:void 0,d=f?f.family:void 0,u="frame"}else v&&p-t.lastCommitClick>1e3&&(a=void 0);o&&r&&(s&&e.defaultPrevented&&(o.checked="checkbox"===s.type?!o.checked:s.checked),t.logClick(o,g,h)),l&&((i=l.radio)instanceof HTMLInputElement?i.checked:"true"===i.getAttribute("aria-checked"))?t.pickPayment(p,g,l.names):d&&t.pickPayment(p,g,void 0,d),a&&t.emit(a,u,n,p,g,c)}catch(e){t.log("[error] delivery threw: "+e)}}))}}},e.prototype.logClick=function(e,t,n){if(this.eventsEnabled()&&!this.hasTargetingOptOut()&&(t!==this.pagePath&&(this.pagePath=t,this.pageEvents=0),!(this.pageEvents>=100))){this.pageEvents++,this.mpInstance._SessionManager.resetSessionTimer();var r=this.queuedForUpload();this.mpInstance._Events.logEvent(n?function(e,t){var n=Ci("internal"===e.linkType&&"link"===e.element?p(p({},e),{label:void 0,labelSource:"none",ariaLabel:void 0}):e,t);return n[wi]=!0,{messageType:oe.PageEvent,name:Pi,data:n,eventType:se.Other}}(e,t):function(e,t){var n=Ci(e,t);return n[Ii]=!0,{messageType:oe.PageEvent,name:_i,data:n,eventType:se.Other}}(e,t)),!this.leaving&&void 0===e.checked&&this.queuedForUpload()>r&&this.uploadNow()}},e.prototype.queuedForUpload=function(){var e=this.mpInstance._APIClient.uploader;return e?e.eventsQueuedForProcessing.length:0},e.prototype.uploadNow=function(){var e=this;null===this.uploadTimerId?this.mpInstance.upload():(clearTimeout(this.uploadTimerId),this.uploadHeld=!0),this.uploadTimerId=setTimeout((function(){e.uploadTimerId=null,e.uploadHeld&&(e.uploadHeld=!1,e.mpInstance.upload())}),100)},e.prototype.cancelUpload=function(){null!==this.uploadTimerId&&(clearTimeout(this.uploadTimerId),this.uploadTimerId=null),this.uploadHeld=!1},e.prototype.emit=function(e,t,n,r,i,o){if(!this.isKitSuppressed()){"commit"===e&&"click"===n&&(this.lastCommitClick=r);var s=o?e+":adds":e,a=this.lastSent[s];a&&a.pathname===i&&r-a.t<2e3||(this.lastSent[s]={t:r,pathname:i},this.mpInstance._RoktManager.notifyCheckoutIntent(Object.freeze(o?{kind:e,t:r,source:t,pathname:i,adds:o}:{kind:e,t:r,source:t,pathname:i}),i))}},e.prototype.pickPayment=function(e,t,n,r){this.isKitSuppressed()||this.mpInstance._RoktManager.notifyPaymentPick(Object.freeze({t:e,pathname:t,names:n?Object.freeze(n.slice()):void 0,family:r}))},e.prototype.eventsEnabled=function(){var e=this.mpInstance._Store;return!!e&&e.isEnabled},e.prototype.hasTargetingOptOut=function(){var e=this.mpInstance._RoktManager;return this.hasRoktKit&&!!e&&e.hasTargetingOptOut()},e.prototype.isKitSuppressed=function(){var e=this.mpInstance._RoktManager;return!this.hasRoktKit||!e||e.isCheckoutIntentSuppressed()},e.prototype.log=function(e){this.mpInstance.Logger.verbose("mParticle button tracking: "+e)},e}(),Ls=r.Messages,Fs=r.HTTPCodes,Us=r.FeatureFlags,Ns=r.CaptureIntegrationSpecificIdsV2Modes,Rs=Us.ReportBatching,Vs=Us.CaptureIntegrationSpecificIds,xs=Us.CaptureIntegrationSpecificIdsV2,Hs=Ls.InformationMessages.StartingInitialization;function Ks(e){var t=this;this._instanceName=e,this._NativeSdkHelpers=new $n(this),this._SessionManager=new rr(this),this._Persistence=new Sr(this),this._Helpers=new zn(this),this._Events=new _r(this),this._CookieSyncManager=new Zn(this),this._ServerModel=new Kr(this),this._Ecommerce=new or(this),this._ForwardingStatsUploader=new Br(this),this._Consent=new ii(this),this._IdentityAPIClient=new vi(this),this._preInit={readyQueue:[],integrationDelays:{},forwarderConstructors:[]},this._ErrorReportingDispatcher=new bi,this._LoggingDispatcher=new Si,this._RoktManager=new mi(e),this._RoktManager.setOnReadyCallback((function(){t.processQueueOnIdentityFailure()})),this.processQueueOnIdentityFailure=function(){var e,n,r;(null===(e=t._Store)||void 0===e?void 0:e.isInitialized)||(null===(n=t._Store)||void 0===n?void 0:n.identityCallFailed)&&(null===(r=t._RoktManager)||void 0===r?void 0:r.isReady())&&(t._RoktManager.processMessageQueue(),t._preInit.readyQueue=jr(t._preInit.readyQueue,t.Logger))},this.processQueueOnNoFunctional=function(){var e,n;(null===(e=t._Store)||void 0===e?void 0:e.isInitialized)||(null===(n=t._CookieConsentManager)||void 0===n?void 0:n.getNoFunctional())&&!xn(t._Store)&&(t._preInit.readyQueue=jr(t._preInit.readyQueue,t.Logger))},this.IdentityType=ue,this.EventType=se,this.CommerceEventType=ae,this.PromotionType=de,this.ProductActionType=ce,this.RoktEvents=le,this._Identity=new ni(this),this.Identity=this._Identity.IdentityAPI,this.generateHash=this._Helpers.generateHash,this.getDeviceId=this._Persistence.getDeviceId,"undefined"!=typeof window&&window.mParticle&&window.mParticle.config&&window.mParticle.config.hasOwnProperty("rq")&&(this._preInit.readyQueue=window.mParticle.config.rq),this.init=function(e,t){var n=this;(t||console.warn("You did not pass a config object to init(). mParticle will not initialize properly"),function(e,t,n){e.Logger=new pr(n),e._ErrorReportingDispatcher.logger=e.Logger,e._LoggingDispatcher.logger=e.Logger,e._Store=new ur(n,e,t),window.mParticle.Store=e._Store,Ts(),e.Logger.verbose(Hs);var r=ar(null==n?void 0:n.launcherOptions),i=r.noFunctional,o=r.noTargeting,s=r.doNotShareOrSell;e._CookieConsentManager=new yi({noFunctional:i,noTargeting:o,doNotShareOrSell:s});try{e._Store.isLocalStorageAvailable=e._Persistence.determineLocalStorageAvailability(window.localStorage)}catch(t){e.Logger.warning("localStorage is not available, using cookies if available"),e._Store.isLocalStorageAvailable=!1}}(this,e,t),t)?!t.hasOwnProperty("requestConfig")||t.requestConfig?new di(e,t,this).getSDKConfiguration().then((function(r){var i=re({},t,r);Bs(e,i,n)})):Bs(e,t,this):console.error("No config available on the window, please pass a config object to mParticle.init()")},this.setLogLevel=function(e){t.Logger.setLogLevel(e)},this.reset=function(e){try{e._Persistence.resetPersistence(),Ts(),e._ButtonTracker=void 0,e._Store&&delete e._Store}catch(e){console.error("Cannot reset mParticle",e)}},this._resetForTests=function(e,t,n){n._Store&&delete n._Store,n._ErrorReportingDispatcher=new bi,n._LoggingDispatcher=new Si,n.Logger=new pr(e),n._ErrorReportingDispatcher.logger=n.Logger,n._LoggingDispatcher.logger=n.Logger,n._Store=new ur(e,n),n._Store.isLocalStorageAvailable=n._Persistence.determineLocalStorageAvailability(window.localStorage),n._Events.stopTracking(),Ht(),n._PageViewTracker=void 0,Ts(),n._ButtonTracker=void 0,t||n._Persistence.resetPersistence(),n._Persistence.forwardingStatsBatches.uploadsTable={},n._Persistence.forwardingStatsBatches.forwardingStatsEventQueue=[],n._preInit={readyQueue:[],pixelConfigurations:[],integrationDelays:{},forwarderConstructors:[],isDevelopmentMode:!1}},this.ready=function(e){var n,r,i,o=(null===(n=t._CookieConsentManager)||void 0===n?void 0:n.getNoFunctional())&&!xn(t._Store);K(e)&&((null===(r=t._Store)||void 0===r?void 0:r.isInitialized)||(null===(i=t._Store)||void 0===i?void 0:i.identityCallFailed)&&t._RoktManager.isReady()||o)?e():t._preInit.readyQueue.push(e)},this.getEnvironment=function(){return t._Store.SDKConfig.isDevelopmentMode?r.Environment.Development:r.Environment.Production},this.getVersion=function(){return r.sdkVersion},this.setAppVersion=function(e){qs((function(){t.setAppVersion(e)}),t)||(t._Store.SDKConfig.appVersion=e,t._Persistence.update())},this.setDeviceId=function(e){qs((function(){t.setDeviceId(e)}),t)||this._Store.setDeviceId(e)},this.isInitialized=function(){return!!t._Store&&t._Store.isInitialized},this.getAppName=function(){return t._Store.SDKConfig.appName},this.setAppName=function(e){qs((function(){t.setAppName(e)}),t)||(t._Store.SDKConfig.appName=e)},this.getAppVersion=function(){return t._Store.SDKConfig.appVersion},this.stopTrackingLocation=function(){t._SessionManager.resetSessionTimer(),t._Events.stopTracking()},this.startTrackingLocation=function(e){K(e)||t.Logger.warning("Warning: Location tracking is triggered, but not including a callback into the `startTrackingLocation` may result in events logged too quickly and not being associated with a location."),t._SessionManager.resetSessionTimer(),t._Events.startTracking(e)},this.setPosition=function(e,n){qs((function(){t.setPosition(e,n)}),t)||(t._SessionManager.resetSessionTimer(),"number"==typeof e&&"number"==typeof n?t._Store.currentPosition={lat:e,lng:n}:t.Logger.error("Position latitude and/or longitude must both be of type number"))},this.startNewSession=function(){t._SessionManager.startNewSession()},this.endSession=function(){t._SessionManager.endSession(!0)},this.logBaseEvent=function(e,n){qs((function(){t.logBaseEvent(e,n)}),t)||(t._SessionManager.resetSessionTimer(),"string"==typeof e.name?(e.eventType||(e.eventType=se.Unknown),t._Helpers.canLog()?t._Events.logEvent(e,n):t.Logger.error(Ls.ErrorMessages.LoggingDisabled)):t.Logger.error(Ls.ErrorMessages.EventNameInvalidType))},this.logEvent=function(e,n,r,i,o){qs((function(){t.logEvent(e,n,r,i,o)}),t)||(t._SessionManager.resetSessionTimer(),"string"==typeof e?(n||(n=se.Unknown),t._Helpers.isEventType(n)?t._Helpers.canLog()?t._Events.logEvent({messageType:oe.PageEvent,name:e,data:r,eventType:n,customFlags:i},o):t.Logger.error(Ls.ErrorMessages.LoggingDisabled):t.Logger.error("Invalid event type: "+n+", must be one of: \n"+JSON.stringify(se))):t.Logger.error(Ls.ErrorMessages.EventNameInvalidType))},this.logError=function(e,n){if(!qs((function(){t.logError(e,n)}),t)&&(t._SessionManager.resetSessionTimer(),e)){"string"==typeof e&&(e={message:e});var r={m:e.message?e.message:e,s:"Error",t:e.stack||null};if(n){var i=t._Helpers.sanitizeAttributes(n,r.m);for(var o in i)r[o]=i[o]}t._Events.logEvent({messageType:oe.CrashReport,name:e.name?e.name:"Error",eventType:se.Other,data:r})}},this.logLink=function(e,n,r,i){t._Events.addEventHandler("click",e,n,i,r)},this.logForm=function(e,n,r,i){t._Events.addEventHandler("submit",e,n,i,r)},this.logPageView=function(e,n,r,i){if(!qs((function(){t.logPageView(e,n,r,i)}),t)){if(t._SessionManager.resetSessionTimer(),t._Helpers.canLog()){if(t._Helpers.Validators.isStringOrNumber(e)||(e="PageView"),n){if(!t._Helpers.isObject(n))return void t.Logger.error("The attributes argument must be an object. A "+c(n)+" was entered. Please correct and retry.")}else n={hostname:window.location.hostname,title:window.document.title};if(r&&!t._Helpers.isObject(r))return void t.Logger.error("The customFlags argument must be an object. A "+c(r)+" was entered. Please correct and retry.")}t._Events.logEvent({messageType:oe.PageView,name:e,data:n,eventType:se.Unknown,customFlags:r},i)}},this.upload=function(){var e,n;t._Helpers.canLog()&&(t._Store.webviewBridgeEnabled?t._NativeSdkHelpers.sendToNative(r.NativeSdkPaths.Upload):null===(n=null===(e=t._APIClient)||void 0===e?void 0:e.uploader)||void 0===n||n.prepareAndUpload(!1,!1))},this.Consent={createCCPAConsent:t._Consent.createPrivacyConsent,createGDPRConsent:t._Consent.createPrivacyConsent,createConsentState:t._Consent.createConsentState},this.eCommerce={setCurrencyCode:function(e){qs((function(){t.eCommerce.setCurrencyCode(e)}),t)||("string"==typeof e?(t._SessionManager.resetSessionTimer(),t._Store.currencyCode=e):t.Logger.error("Code must be a string"))},createProduct:function(e,n,r,i,o,s,a,u,c,l){return t._Ecommerce.createProduct(e,n,r,i,o,s,a,u,c,l)},createPromotion:function(e,n,r,i){return t._Ecommerce.createPromotion(e,n,r,i)},createImpression:function(e,n){return t._Ecommerce.createImpression(e,n)},createTransactionAttributes:function(e,n,r,i,o,s){return t._Ecommerce.createTransactionAttributes(e,n,r,i,o,s)},logProductAction:function(e,n,r,i,o,s){qs((function(){t.eCommerce.logProductAction(e,n,r,i,o,s)}),t)||(t._SessionManager.resetSessionTimer(),t._Events.logProductActionEvent(e,n,r,i,o,s))},logPurchase:function(e,n,r,i,o){tr({methodName:"mParticle.logPurchase",warningMessage:"mParticle.logPurchase is deprecated, please use mParticle.logProductAction with ProductActionType.Purchase instead"},t.Logger,t._ErrorReportingDispatcher),t._Store.isInitialized?e&&n?(t._SessionManager.resetSessionTimer(),t._Events.logPurchaseEvent(e,n,i,o)):t.Logger.error(Ls.ErrorMessages.BadLogPurchase):t.ready((function(){t.eCommerce.logPurchase(e,n,r,i,o)}))},logPromotion:function(e,n,r,i,o){qs((function(){t.eCommerce.logPromotion(e,n,r,i,o)}),t)||(t._SessionManager.resetSessionTimer(),t._Events.logPromotionEvent(e,n,r,i,o))},logImpression:function(e,n,r,i){qs((function(){t.eCommerce.logImpression(e,n,r,i)}),t)||(t._SessionManager.resetSessionTimer(),t._Events.logImpressionEvent(e,n,r,i))},expandCommerceEvent:function(e){return t._Ecommerce.expandCommerceEvent(e)}},this.setSessionAttribute=function(e,n){var i;if(!((null===(i=t._CookieConsentManager)||void 0===i?void 0:i.getNoFunctional())&&!xn(t._Store))&&qs((function(){t.setSessionAttribute(e,n)}),t))return;if(t._Helpers.canLog()){if(!t._Helpers.Validators.isValidAttributeValue(n))return void t.Logger.error(Ls.ErrorMessages.BadAttribute);if(!t._Helpers.Validators.isValidKeyValue(e))return void t.Logger.error(Ls.ErrorMessages.BadKey);if(t._Store.webviewBridgeEnabled)t._NativeSdkHelpers.sendToNative(r.NativeSdkPaths.SetSessionAttribute,JSON.stringify({key:e,value:n}));else{var o=t._Helpers.findKeyInObject(t._Store.sessionAttributes,e);o&&(e=o),t._Store.sessionAttributes[e]=n,t._Persistence.update(),t._Forwarders.applyToForwarders("setSessionAttribute",[e,n])}}},this.setOptOut=function(e){qs((function(){t.setOptOut(e)}),t)||(t._SessionManager.resetSessionTimer(),t._Store.isEnabled=!e,e&&(t._ButtonTracker&&t._ButtonTracker.clearPending(),t._RoktManager.discardCheckoutIntents()),t._Events.logOptOut(),t._Persistence.update(),t._Store.activeForwarders.length&&t._Store.activeForwarders.forEach((function(n){if(n.setOptOut){var r=n.setOptOut(e);r&&t.Logger.verbose(r)}})))},this.setIntegrationAttribute=function(e,n){if(!qs((function(){t.setIntegrationAttribute(e,n)}),t))if("number"==typeof e){if(null===n)t._Store.integrationAttributes[e]={};else{if(!t._Helpers.isObject(n))return void t.Logger.error("Attrs must be an object with keys and values. You entered a "+c(n));if(0===Object.keys(n).length)t._Store.integrationAttributes[e]={};else for(var r in n)"string"==typeof r?"string"==typeof n[r]?(t._Helpers.isObject(t._Store.integrationAttributes[e])||(t._Store.integrationAttributes[e]={}),t._Store.integrationAttributes[e][r]=n[r]):t.Logger.error("Values for integration attributes must be strings. You entered a "+c(n[r])):t.Logger.error("Keys must be strings, you entered a "+c(r))}t._Persistence.update()}else t.Logger.error("integrationId must be a number")},this.getIntegrationAttributes=function(e){return t._Store.integrationAttributes[e]?t._Store.integrationAttributes[e]:{}},this.addForwarder=function(e){t._preInit.forwarderConstructors.push(e)},this.configurePixel=function(e){t._Forwarders.configurePixel(e)},this._getActiveForwarders=function(){return t._Store.activeForwarders},this._getIntegrationDelays=function(){return t._preInit.integrationDelays},this._setIntegrationDelay=function(e,n){if(t._preInit.integrationDelays[e]=n,!0!==n){var r=Object.keys(t._preInit.integrationDelays);if(0!==r.length)r.some((function(e){return!0===t._preInit.integrationDelays[e]}))||t._APIClient.processQueuedEvents()}},this._setWrapperSDKInfo=function(e,n){qs((function(){t._setWrapperSDKInfo(e,n)}),t)||void 0!==t._Store.wrapperSDKInfo&&t._Store.wrapperSDKInfo.isInfoSet||(t._Store.wrapperSDKInfo={name:e,version:n,isInfoSet:!0})},this._registerErrorReportingService=function(e){t._ErrorReportingDispatcher.register(e)},this._registerLoggingService=function(e){t._LoggingDispatcher.register(e)};var n=r.Rokt.LauncherInstanceGuidKey;this.setLauncherInstanceGuid=function(){window[n]&&"string"==typeof window[n]||(window[n]=t._Helpers.generateUniqueId())},this.getLauncherInstanceGuid=function(){return window[n]},this.captureTiming=function(e){var t;"undefined"!=typeof window&&(null===(t=window.performance)||void 0===t?void 0:t.mark)&&window.performance.mark(e)}}function Bs(e,t,n){var i,o,s,a,u=function(e,t){var n,r,i,o;e.dataPlanOptions&&(t.Logger.verbose("Customer provided data plan found"),r={document:{dtpn:{vers:(o=e.dataPlanOptions).dataPlanVersion,blok:{ev:o.blockEvents,ea:o.blockEventAttributes,ua:o.blockUserAttributes,id:o.blockUserIdentities}}}});r||(e.dataPlan&&e.dataPlan.document?e.dataPlan.document.error_message?i=e.dataPlan.document.error_message:(t.Logger.verbose("Data plan found from mParticle.js"),r=e.dataPlan):e.dataPlanResult&&(e.dataPlanResult.error_message?i=e.dataPlanResult.error_message:(t.Logger.verbose("Data plan found from /config"),r={document:e.dataPlanResult})));i&&t.Logger.error(i);r&&(n=new ci(r,t));return n}(t,n),c=n._Helpers.getFeatureFlag,l=r.FeatureFlags,d=l.AutoLogPageView,p=l.AutoButtonTracking,g=l.AutoLinkTracking;if((null===(i=n._APIClient)||void 0===i?void 0:i.uploader)&&n._APIClient.uploader.destroy(),n._APIClient=new Kn(n,u),n._Forwarders=new Rr(n,u),n._Store.processConfig(t),n._Identity.idCache=function(e){var t;if(null===(t=e._CookieConsentManager)||void 0===t?void 0:t.getNoFunctional())return new un("".concat(e._Store.storageName,"-id-cache"));return new sn("".concat(e._Store.storageName,"-id-cache"))}(n),Mn(n._Identity.idCache),n._Store.webviewBridgeEnabled)n._NativeSdkHelpers.initializeSessionAttributes(e),Ts(),n._RoktManager.setAutoButtonClicksForwarded(!1);else{n._Persistence.initializeStorage(),n._Store.syncPersistenceData();var h=n.Identity.getCurrentUser(),v=h?h.getMPID():null,f=h?h.getUserIdentities().userIdentities:{};if(n._Store.SDKConfig.identifyRequest=n._Store.hasInvalidIdentifyRequest()?{userIdentities:f}:n._Store.SDKConfig.identifyRequest,c(Rs)&&n._ForwardingStatsUploader.startForwardingStatsTimer(),Qe(c)){var m=c(Vs),y=c(xs),b=void 0;m||y===Ns.All?b="all":y===Ns.RoktOnly&&(b="roktonly"),n._IntegrationCapture=new We(b),n._IntegrationCapture.capture()}var S=ee(t,"Rokt",181);if(S){var I=null===(o=S.settings)||void 0===o?void 0:o.accountId;n._Store.setRoktAccountId(I);var _=function(e){return Cr(e,S,n,u)},w={sandbox:null==t?void 0:t.isDevelopmentMode,launcherOptions:null==t?void 0:t.launcherOptions,domain:null==t?void 0:t.domain};n._RoktManager.init(S,_(v),n.Identity,n._Store,n.Logger,w,n.captureTiming,n._ErrorReportingDispatcher,n._LoggingDispatcher,n._IntegrationCapture,_)}var P=!!c(p),C=!!c(g),A=S?Ti(S,u):void 0,T=S&&C?Ti(S,u,!0):void 0;P&&(A||T)&&n.Logger.warning(A?"Checkout intent is off: the ".concat(A," keeps some or all Auto Button Click events from the Rokt kit."):"Checkout intent is off: the ".concat(T," keeps some or all Auto Link Click events from the Rokt kit.")),n._RoktManager.setAutoButtonClicksForwarded(!!S&&!A&&!T),n._Forwarders.processForwarders(t,n._APIClient.prepareForwardingStats),n._Forwarders.processPixelConfigs(t),n._SessionManager.initialize(),n._Events.logAST(),c(d)?(n._PageViewTracker||(n.Logger.verbose("mParticle APV: [sdk-init] creating new PageViewTracker for this instance"),n._PageViewTracker=new qt(n,{isAutoPageView:!0})),Vt()?n.Logger.verbose("mParticle APV: [sdk-init] initial page view already logged this page load, skipping"):(xt(),n._Events.logPageView({isAutoPageView:!0})),n._PageViewTracker.init()):n._PageViewTracker&&n._PageViewTracker.teardown(),P||C?(n._ButtonTracker||(n._ButtonTracker=new Ms(n)),n._ButtonTracker.init({hasRoktKit:!!S,logButtons:P,logLinks:C})):Ts(),function(e,t,n,r){!e._Store.identifyCalled&&e._Store.SDKConfig.identityCallback&&t&&n&&e._Store.SDKConfig.identityCallback({httpCode:Fs.activeSession,getUser:function(){return e._Identity.mParticleUser(n)},getPreviousUser:function(){var t=e.Identity.getUsers(),r=t.shift(),i=r.getMPID();return r&&i===n&&(r=t.shift()),r||null},body:{mpid:n,is_logged_in:e._Store.isLoggedIn,matched_identities:r,context:null,is_ephemeral:!1}})}(n,h,v,f)}(n._Store.mpid&&!n._Store.identifyCalled||n._Store.webviewBridgeEnabled)&&(n._Store.isInitialized=!0,null===(s=n._CookieConsentManager)||void 0===s||s.syncNoTargetingAttribute(n.Identity.getCurrentUser()),n._preInit.readyQueue=jr(n._preInit.readyQueue,n.Logger)),null===(a=n.processQueueOnNoFunctional)||void 0===a||a.call(n),n._Store.isFirstRun&&(n._Store.isFirstRun=!1)}function qs(e,t){var n,r,i=(null===(n=t._CookieConsentManager)||void 0===n?void 0:n.getNoFunctional())&&!xn(t._Store);return!(null===(r=t._Store)||void 0===r?void 0:r.isInitialized)&&!i&&(t._preInit.readyQueue.push((function(){var n;(null===(n=t._Store)||void 0===n?void 0:n.isInitialized)&&e()})),!0)}var js=function(){return null},zs=function(){function e(){}return e.prototype.getMPInstance=function(){return{_Helpers:{sanitizeAttributes:window.mParticle.getInstance()._Helpers.sanitizeAttributes,generateHash:function(){return"mockHash"},generateUniqueId:function(){return"mockId"},extend:re,createServiceUrl:js,parseNumber:js,isObject:js,Validators:null},_resetForTests:js,_APIClient:null,_timeOnSiteTimer:{getTimeInForeground:js},MPSideloadedKit:null,_Consent:null,_Events:null,_Forwarders:null,_NativeSdkHelpers:null,_Persistence:null,_preInit:null,Consent:null,_ServerModel:null,_SessionManager:null,_Store:{sessionId:"mockSessionId",sideloadedKits:[],devToken:"test_dev_token",isFirstRun:!0,isEnabled:!0,sessionAttributes:{},currentSessionMPIDs:[],consentState:null,clientId:null,deviceId:null,serverSettings:{},dateLastEventSent:null,sessionStartDate:null,currentPosition:null,isTracking:!1,watchPositionId:null,cartProducts:[],eventQueue:[],currencyCode:null,globalTimer:null,context:null,configurationLoaded:!1,identityCallInFlight:!1,nonCurrentUserMPIDs:{},identifyCalled:!1,isLoggedIn:!1,cookieSyncDates:{},integrationAttributes:{},requireDelay:!0,isLocalStorageAvailable:null,integrationDelayTimeoutStart:null,storageName:null,prodStorageName:null,activeForwarders:[],kits:{},configuredForwarders:[],pixelConfigurations:[],wrapperSDKInfo:{name:"none",version:null,isInfoSet:!1},SDKConfig:{isDevelopmentMode:!1,onCreateBatch:js},getTotalTimeOnSite:js},config:null,eCommerce:null,Identity:{getCurrentUser:js,IdentityAPI:{},identify:js,login:js,logout:js,modify:js},Logger:{verbose:js,error:js,warning:js},ProductActionType:null,ServerModel:null,addForwarder:js,generateHash:js,getAppVersion:js,getAppName:js,getInstance:js,getDeviceId:js,init:js,logBaseEvent:js,logEvent:js,logLevel:"none",setPosition:js,upload:js}},e.prototype.createSDKEventFunction=function(e){return new Kr(this.getMPInstance()).createEventObject(e)},e.prototype.returnBatch=function(e){var t=this,n=this.getMPInstance();return Je("0",Array.isArray(e)?e.map((function(e){return t.createSDKEventFunction(e)})):[this.createSDKEventFunction(e)],n)},e}(),Qs=function(){function e(e){this.filterDictionary={eventTypeFilters:[],eventNameFilters:[],screenNameFilters:[],screenAttributeFilters:[],userIdentityFilters:[],userAttributeFilters:[],attributeFilters:[],consentRegulationFilters:[],consentRegulationPurposeFilters:[],messageTypeFilters:[],messageTypeStateFilters:[],filteringEventAttributeValue:{},filteringUserAttributeValue:{},filteringConsentRuleValues:{}},this.kitInstance=e}return e.prototype.addEventTypeFilter=function(e){var t=Bn.hashEventType(e);this.filterDictionary.eventTypeFilters.push(t)},e.prototype.addEventNameFilter=function(e,t){var n=Bn.hashEventName(t,e);this.filterDictionary.eventNameFilters.push(n)},e.prototype.addEventAttributeFilter=function(e,t,n){var r=Bn.hashEventAttributeKey(e,t,n);this.filterDictionary.attributeFilters.push(r)},e.prototype.addScreenNameFilter=function(e){var t=Bn.hashEventName(e,se.Unknown);this.filterDictionary.screenNameFilters.push(t)},e.prototype.addScreenAttributeFilter=function(e,t){var n=Bn.hashEventAttributeKey(se.Unknown,e,t);this.filterDictionary.screenAttributeFilters.push(n)},e.prototype.addUserIdentityFilter=function(e){var t=Bn.hashUserIdentity(e);this.filterDictionary.userIdentityFilters.push(t)},e.prototype.addUserAttributeFilter=function(e){var t=Bn.hashUserAttribute(e);this.filterDictionary.userAttributeFilters.push(t)},e}();Array.prototype.forEach||(Array.prototype.forEach=n.forEach),Array.prototype.map||(Array.prototype.map=n.map),Array.prototype.filter||(Array.prototype.filter=n.filter),Array.isArray||(Array.prototype.isArray=n.isArray);var Ws=new function(){var e=this;this.Store={},this._instances={},this.IdentityType=ue,this.EventType=se,this.CommerceEventType=ae,this.PromotionType=de,this.ProductActionType=ce,this.RoktEvents=le,this.MPSideloadedKit=Qs,"undefined"!=typeof window&&(this.isIOS=!(!window.mParticle||!window.mParticle.isIOS)&&window.mParticle.isIOS,this.config=window.mParticle&&window.mParticle.config?window.mParticle.config:{}),this.init=function(t,n,i){!n&&window.mParticle&&window.mParticle.config&&(console.warn("You did not pass a config object to mParticle.init(). Attempting to use the window.mParticle.config if it exists. Please note that in a future release, this may not work and mParticle will not initialize properly"),n=window.mParticle?window.mParticle.config:{}),i=(i&&0!==i.length?i:r.DefaultInstance).toLowerCase();var o=e._instances[i];void 0===o&&(o=new Ks(i),e._instances[i]=o),o.captureTiming(pe),o.setLauncherInstanceGuid(),o.init(t,n,i)},this.captureTiming=function(t){e.getInstance().captureTiming(t)},this.getInstance=function(t){var n;return t?(n=e._instances[t.toLowerCase()])||(console.log("You tried to initialize an instance named "+t+". This instance does not exist. Check your instance name or initialize a new instance with this name before calling it."),null):(t=r.DefaultInstance,(n=e._instances[t])||(n=new Ks(t),e._instances[r.DefaultInstance]=n),n)},this.Rokt=e.getInstance()._RoktManager,this.getDeviceId=function(){return e.getInstance().getDeviceId()},this.setDeviceId=function(t){return e.getInstance().setDeviceId(t)},this.isInitialized=function(){return e.getInstance().isInitialized()},this.startNewSession=function(){e.getInstance().startNewSession()},this.endSession=function(){e.getInstance().endSession()},this.setLogLevel=function(t){e.getInstance().setLogLevel(t)},this.ready=function(t){e.getInstance().ready(t)},this.setAppVersion=function(t){e.getInstance().setAppVersion(t)},this.getAppName=function(){return e.getInstance().getAppName()},this.setAppName=function(t){e.getInstance().setAppName(t)},this.getAppVersion=function(){return e.getInstance().getAppVersion()},this.getEnvironment=function(){return e.getInstance().getEnvironment()},this.stopTrackingLocation=function(){e.getInstance().stopTrackingLocation()},this.startTrackingLocation=function(t){e.getInstance().startTrackingLocation(t)},this.setPosition=function(t,n){e.getInstance().setPosition(t,n)},this.logBaseEvent=function(t,n){e.getInstance().logBaseEvent(t,n)},this.logEvent=function(t,n,r,i,o){e.getInstance().logEvent(t,n,r,i,o)},this.logError=function(t,n){e.getInstance().logError(t,n)},this.logLink=function(t,n,r,i){e.getInstance().logLink(t,n,r,i)},this.logForm=function(t,n,r,i){e.getInstance().logForm(t,n,r,i)},this.logPageView=function(t,n,r,i){e.getInstance().logPageView(t,n,r,i)},this.upload=function(){e.getInstance().upload()},this.eCommerce={setCurrencyCode:function(t){e.getInstance().eCommerce.setCurrencyCode(t)},createProduct:function(t,n,r,i,o,s,a,u,c,l){return e.getInstance().eCommerce.createProduct(t,n,r,i,o,s,a,u,c,l)},createPromotion:function(t,n,r,i){return e.getInstance().eCommerce.createPromotion(t,n,r,i)},createImpression:function(t,n){return e.getInstance().eCommerce.createImpression(t,n)},createTransactionAttributes:function(t,n,r,i,o,s){return e.getInstance().eCommerce.createTransactionAttributes(t,n,r,i,o,s)},logProductAction:function(t,n,r,i,o,s){e.getInstance().eCommerce.logProductAction(t,n,r,i,o,s)},logPurchase:function(t,n,r,i,o){e.getInstance().eCommerce.logPurchase(t,n,r,i,o)},logPromotion:function(t,n,r,i,o){e.getInstance().eCommerce.logPromotion(t,n,r,i,o)},logImpression:function(t,n,r,i){e.getInstance().eCommerce.logImpression(t,n,r,i)},expandCommerceEvent:function(t){return e.getInstance().eCommerce.expandCommerceEvent(t)}},this.setSessionAttribute=function(t,n){e.getInstance().setSessionAttribute(t,n)},this.setOptOut=function(t){e.getInstance().setOptOut(t)},this.setIntegrationAttribute=function(t,n){e.getInstance().setIntegrationAttribute(t,n)},this.getIntegrationAttributes=function(t){return e.getInstance().getIntegrationAttributes(t)},this.Identity={HTTPCodes:r.HTTPCodes,aliasUsers:function(t,n){e.getInstance().Identity.aliasUsers(t,n)},createAliasRequest:function(t,n,r){return e.getInstance().Identity.createAliasRequest(t,n,r)},getCurrentUser:function(){return e.getInstance().Identity.getCurrentUser()},getUser:function(t){return e.getInstance().Identity.getUser(t)},getUsers:function(){return e.getInstance().Identity.getUsers()},identify:function(t,n){e.getInstance().Identity.identify(t,n)},login:function(t,n){e.getInstance().Identity.login(t,n)},logout:function(t,n){e.getInstance().Identity.logout(t,n)},modify:function(t,n){e.getInstance().Identity.modify(t,n)},search:function(t,n,r){e.getInstance().Identity.search(t,n,r)}},this.sessionManager={getSession:function(){return e.getInstance()._SessionManager.getSessionId()}},this.Consent={createConsentState:function(){return e.getInstance().Consent.createConsentState()},createGDPRConsent:function(t,n,r,i,o){return e.getInstance().Consent.createGDPRConsent(t,n,r,i,o)},createCCPAConsent:function(t,n,r,i,o){return e.getInstance().Consent.createGDPRConsent(t,n,r,i,o)}},this.reset=function(){e.getInstance().reset(e.getInstance())},this._resetForTests=function(t,n){"boolean"==typeof n?e.getInstance()._resetForTests(t,n,e.getInstance()):e.getInstance()._resetForTests(t,!1,e.getInstance())},this.configurePixel=function(t){e.getInstance().configurePixel(t)},this._setIntegrationDelay=function(t,n){e.getInstance()._setIntegrationDelay(t,n)},this._getIntegrationDelays=function(){return e.getInstance()._getIntegrationDelays()},this.getVersion=function(){return e.getInstance().getVersion()},this.generateHash=function(t){return e.getInstance().generateHash(t)},this._cleanUrl=nn,this.addForwarder=function(t){e.getInstance().addForwarder(t)},this._getActiveForwarders=function(){return e.getInstance()._getActiveForwarders()},this._setWrapperSDKInfo=function(t,n){e.getInstance()._setWrapperSDKInfo(t,n)},this._registerErrorReportingService=function(t){e.getInstance()._registerErrorReportingService(t)},this._registerLoggingService=function(t){e.getInstance()._registerLoggingService(t)}};"undefined"!=typeof window&&(window.mParticle=Ws,window.mParticle._BatchValidator=new zs),module.exports=Ws;
|