@mparticle/web-sdk 3.31.0 → 3.32.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.
@@ -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,a,s,u,c,l="",d=0;for(n=t.encode(n);d<n.length;)a=(r=n.charCodeAt(d++))>>2,s=(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(a)+e._keyStr.charAt(s)+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,a,s,u,c="",l=0;for(n=n.replace(/[^A-Za-z0-9\+\/\=]/g,"");l<n.length;)r=e._keyStr.indexOf(n.charAt(l++))<<2|(a=e._keyStr.indexOf(n.charAt(l++)))>>4,i=(15&a)<<4|(s=e._keyStr.indexOf(n.charAt(l++)))>>2,o=(3&s)<<6|(u=e._keyStr.indexOf(n.charAt(l++))),c+=String.fromCharCode(r),64!==s&&(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 a=void 0;r in i&&(a=i[r],e.call(n,a,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),a=o.length>>>0;if("function"!=typeof e)throw new TypeError(e+" is not a function");for(arguments.length>1&&(n=t),r=new Array(a),i=0;i<a;){var s=void 0,u=void 0;i in o&&(s=o[i],u=e.call(n,s,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 a=t[o];e.call(i,a,o,t)&&r.push(a)}return r},isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},Base64:e},r={sdkVersion:"3.31.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,a=202,s=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 a(e){try{u(r.next(e))}catch(e){o(e)}}function s(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(a,s)}u((r=r.apply(e,t||[])).next())}))}function f(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(u){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,r=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){a.label=s[1];break}if(6===s[0]&&a.label<i[1]){a.label=i[1],i=s;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(s);break}i[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,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 h=r.Messages,m=function(e){return k(D(e))},y=function(e){return T(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(h.DeprecationMessages.MethodHasBeenDeprecated):i.push(h.DeprecationMessages.MethodMarkedForDeprecationPostfix),n&&(i.push(h.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},k=function(e){return e.replace(/,/g,"|")},T=function(e){return e.replace(/\|/g,",")},E=function(e){return e.replace(/\'/g,'"')},D=function(e){return e.replace(/\"/g,"'")},L=function(e,t){return e.replace("%%mpid%%",t)},M=function(e){return e.replace(/&amp;/g,"&")},O=function(e,t,n,r,i){var o=M(t),a=n?M(n):null,s=L(o,e),u=a?L(a,e):"",c=s+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," "))},x=function(e){return 0===e.indexOf('"')&&(e=e.slice(1,-1).replace(/\\"/g,'"').replace(/\\\\/g,"\\")),e},V=function(e){return"string"==typeof e},H=function(e){return"number"==typeof e},K=function(e){return"function"==typeof e},q=function(e){return H(e)||V(e)||function(e){return"boolean"==typeof e}(e)},B=function(e){return e===(j(t=e)?t.toString().toLowerCase().replace(/[^0-9a-zA-Z]+/g,"_"):"");var t},j=function(e){return V(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},$=function(e){return J(e)||"prototype"===e},G=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)}}},Z=function(){return"undefined"!=typeof window&&window.location?window.location.href:""},X=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 a=n(o);b(t,a)||(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,a,s,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)$(r)||Object.prototype.hasOwnProperty.call(n,r)&&(i=l[r],l!==(o=n[r])&&(p&&o&&(u.isPlainObject(o)||(a=u.isArray(o)))?(a?(a=!1,s=i&&u.isArray(i)?i:[]):s=i&&u.isPlainObject(i)?i:{},l[r]=re(p,s,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},ae={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 ae.Unknown:return"Unknown";case ae.Navigation:return"Navigation";case ae.Location:return"Location";case ae.Search:return"Search";case ae.Transaction:return"Transaction";case ae.UserContent:return"User Content";case ae.UserPreference:return"User Preference";case ae.Social:return"Social";case se.ProductAddToCart:return"Product Added to Cart";case se.ProductAddToWishlist:return"Product Added to Wishlist";case se.ProductCheckout:return"Product Checkout";case se.ProductCheckoutOption:return"Product Checkout Options";case se.ProductClick:return"Product Click";case se.ProductImpression:return"Product Impression";case se.ProductPurchase:return"Product Purchased";case se.ProductRefund:return"Product Refunded";case se.ProductRemoveFromCart:return"Product Removed From Cart";case se.ProductRemoveFromWishlist:return"Product Removed from Wishlist";case se.ProductViewDetail:return"Product View Details";case se.PromotionClick:return"Promotion Click";case se.PromotionView:return"Promotion View";default:return"Other"}}},se={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",fe="mp:jointSdkRoktKitInit";function ve(e){var t=C(e);return String(t)===e&&ue.isValid(t)?t:null}var he,me={MessageType:oe,EventType:ae,CommerceEventType:se,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"}(he||(he={}));var ye,be,Se,Ie,_e,we,Pe,Ce,Ae,ke,Te,Ee,De,Le,Me,Oe,Fe,Ue,Ne,Re="none",xe="verbose",Ve="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",(ke=ye.EventTypeEnum||(ye.EventTypeEnum={})).unknown="unknown",ke.sessionStart="session_start",ke.sessionEnd="session_end",ke.screenView="screen_view",ke.customEvent="custom_event",ke.crashReport="crash_report",ke.optOut="opt_out",ke.firstRun="first_run",ke.preAttribution="pre_attribution",ke.pushRegistration="push_registration",ke.applicationStateTransition="application_state_transition",ke.pushMessage="push_message",ke.networkPerformance="network_performance",ke.breadcrumb="breadcrumb",ke.profile="profile",ke.pushReaction="push_reaction",ke.commerceEvent="commerce_event",ke.userAttributeChange="user_attribute_change",ke.userIdentityChange="user_identity_change",ke.uninstall="uninstall",ke.validationResult="validation_result",(Te=ye.IdentityTypeEnum||(ye.IdentityTypeEnum={})).other="other",Te.customerId="customer_id",Te.facebook="facebook",Te.twitter="twitter",Te.google="google",Te.microsoft="microsoft",Te.yahoo="yahoo",Te.email="email",Te.alias="alias",Te.facebookCustomAudienceId="facebook_custom_audience_id",Te.otherId2="other_id_2",Te.otherId3="other_id_3",Te.otherId4="other_id_4",Te.otherId5="other_id_5",Te.otherId6="other_id_6",Te.otherId7="other_id_7",Te.otherId8="other_id_8",Te.otherId9="other_id_9",Te.otherId10="other_id_10",Te.mobileNumber="mobile_number",Te.phoneNumber2="phone_number_2",Te.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",(Le=ye.PromotionActionActionEnum||(ye.PromotionActionActionEnum={})).view="view",Le.click="click",(ye.PushMessageEventEventTypeEnum||(ye.PushMessageEventEventTypeEnum={})).pushMessage="push_message",(Me=ye.PushMessageEventDataPushMessageTypeEnum||(ye.PushMessageEventDataPushMessageTypeEnum={})).sent="sent",Me.received="received",Me.action="action",(Oe=ye.PushMessageEventDataApplicationStateEnum||(ye.PushMessageEventDataApplicationStateEnum={})).notRunning="not_running",Oe.background="background",Oe.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",qe="partner_identities",Be="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:qe},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:Be,moduleId:1277},rclid:{mappedKey:"passbackconversiontrackingid",output:Be,moduleId:1277},RoktTransactionId:{mappedKey:"passbackconversiontrackingid",output:Be,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(qe),this.filteredCustomFlagMappings=this.filterMappings(Ke),this.filteredIntegrationAttributeMappings=this.filterMappings(Be)}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("="),a=o[0],s=o[1];t&&!t.includes(a)||(n[a]=s)}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,Z(),this.initialTimestamp)},e.prototype.captureQueryParams=function(){var e=this.getQueryParams();return this.applyProcessors(e,Z(),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,Z(),this.initialTimestamp)},e.prototype.getQueryParams=function(){var e=this.getAllowedKeysForMode();return G(Z(),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],a=null===(t=this.filteredIntegrationAttributeMappings[i])||void 0===t?void 0:t.mappedKey;if(!z(a)){var s=null===(n=this.filteredIntegrationAttributeMappings[i])||void 0===n?void 0:n.moduleId;s&&!r[s]&&(r[s]=((e={})[a]=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],a=null===(n=t[i])||void 0===n?void 0:n.mappedKey;z(a)||(r[a]=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 a=o[i],s=[];for(var u in a){var c=n(u);-1!==r.indexOf(c)?delete a[u]:z(a[u])||s.push(c)}r.push.apply(r,s)}},e.prototype.applyProcessors=function(e,t,n){var r,i={},o=this.getActiveIntegrationMapping();for(var a in e)if(e.hasOwnProperty(a)){var s=e[a],u=null===(r=o[a])||void 0===r?void 0:r.processor;i[a]=u?u(s,t,n):s}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(),a=[],s=null,u=0,c=t;u<c.length;u++){var l=c[u];if(l){s=l;var d=Xe(l);d&&a.push(d)}}if(!s)return null;var p=null;z(s.ConsentState)?z(o)||(p=o.getConsentState()):p=s.ConsentState;var g={source_request_id:n._Helpers.generateUniqueId(),mpid:e,timestamp_unixtime_ms:(new Date).getTime(),environment:s.Debug?He.BatchEnvironmentEnum.development:He.BatchEnvironmentEnum.production,events:a,mp_deviceid:s.DeviceId,sdk_version:s.SDKVersion,application_info:{application_version:s.AppVersion,application_name:s.AppName,package:s.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:s.UserAttributes,user_identities:Ze(s.UserIdentities),consent_state:$e(p),integration_attributes:s.IntegrationAttributes};if(s.DataPlan&&s.DataPlan.PlanId&&(g.context={data_plan:{plan_id:s.DataPlan.PlanId,plan_version:s.DataPlan.PlanVersion||void 0}}),Qe(i)){null==r||r.capture();var f=null==r?void 0:r.getClickIdsAsPartnerIdentities();z(f)||(g.partner_identities=f)}return g}function $e(e){return z(e)?null:{gdpr:Ge(e.getGDPRConsentState()),ccpa:Ye(e.getCCPAConsentState())}}function Ge(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 Ze(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 Xe(e){if(!e)return null;switch(e.EventDataType){case me.MessageType.AppStateTransition:return function(e){var t=st(e),n=He.ApplicationStateTransitionEventDataApplicationTransitionTypeEnum,r=n.applicationBackground,i=n.applicationInitialized,o=e.IsBackgroundAST?r:i,a={application_transition_type:o,is_first_run:e.IsFirstRun,is_upgrade:!1,launch_referral:e.LaunchReferral};return a=Object.assign(a,t),{event_type:He.EventTypeEnum.applicationStateTransition,data:a}}(e);case me.MessageType.Commerce:return function(e){var t=st(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=st(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=st(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=st(e),n={custom_event_type:at(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=st(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=st(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=st(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=st(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=st(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 he.AddToCart:return He.ProductActionActionEnum.addToCart;case he.AddToWishlist:return He.ProductActionActionEnum.addToWishlist;case he.Checkout:return He.ProductActionActionEnum.checkout;case he.CheckoutOption:return He.ProductActionActionEnum.checkoutOption;case he.Click:return He.ProductActionActionEnum.click;case he.Purchase:return He.ProductActionActionEnum.purchase;case he.Refund:return He.ProductActionActionEnum.refund;case he.RemoveFromCart:return He.ProductActionActionEnum.removeFromCart;case he.RemoveFromWishlist:return He.ProductActionActionEnum.removeFromWishlist;case he.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 at(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 st(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=/^(?=[^0-9]*[0-9])(?=[^A-Za-z]*[A-Za-z])[A-Za-z0-9]{6,}$/,dt=/^(?=[A-Za-z]{8,}$)(?:[^a-z]*[a-z]+[A-Z]){3}/,pt=/^(?:u|user|users|profile|profiles|member|members|people|reset|reset-password|password|verify|verification|confirm|activate|invite|invitation|token|unsubscribe|magic-link)$/i,gt=/(?:^|[-_])orders?(?:[-_]|$)/i,ft=/^(?:(?:pre|on|back)[-_]|made[-_]to[-_])orders?$/i,vt=/;|%(?:25)*3B/i,ht=/%[0-9A-F]{2}/i,mt=/^(?:log-?in|log-?out|sign-?in|sign-?out|sign-?up|register|registration|create-account|account|settings|forgot-password|reset-password|password|challenge|consent|callback|authorize|continue|mfa(?:-[a-z]+)*)$/i;function yt(e,t){return bt(e)&&!(pt.test(e)&&mt.test(t))}function bt(e){return pt.test(e)||gt.test(e)&&!ft.test(e)}var St=5;function It(e){for(var t=e,n=0;n<St;n++){var r=void 0;try{r=decodeURIComponent(t)}catch(e){return 0===n?void 0:t}if(r===t)return t;t=r}return t}function _t(e){for(var t=e,n=0;n<St;n++){var r=t.split(vt)[0],i=void 0;try{i=decodeURIComponent(r)}catch(e){return 0===n?void 0:r.split("/").pop()}if(i===r)return r.split("/").pop();t=i}}function wt(e,t){for(var n=t-1;n>0&&""===e[n];)n--;return e[n]}var Pt=/[a-z][A-Z]/,Ct=function(e){return lt.test(e)||dt.test(e)},At=function(e){return/[0-9]/.test(e)&&/[A-Za-z]/.test(e)};function kt(e){var t=e.replace(/\+/g,"").split(/[-_.~]/),n=t.join("");return t.some(Ct)||t.some((function(e){return Pt.test(e)}))&&Ct(n)||t.filter(At).length>=2&&lt.test(n)}var Tt=function(e){return/^(?:[a-z]{3,}|[A-Z][a-z]{2,})$/.test(e)},Et=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/i,Dt=/^(?:p|product|products|item|items|dp|shop|catalog)$/i;function Lt(e,t,n){if(kt(t)){if(!n||!Dt.test(n)||Et.test(t))return"*";for(var r=e.split(/([-_.~])/),i=r.filter((function(e,t){return t%2==0})),o=r.filter((function(e,t){return t%2==1})),a=i.map((function(e){return It(e)})).map((function(e){if(void 0===e||/[-_.~]/.test(e))return"token";var t=e.replace(/\+/g,"");return Ct(t)||At(t)||Pt.test(t)?"token":Tt(t)?"word":"other"})),s=a.map((function(){return!1})),u=0;u<a.length;)if("word"!==a[u]){for(var c=u;c<a.length&&"word"!==a[c];)c++;if(-1!==a.slice(u,c).indexOf("token")||Ct(i.slice(u,c).join("")))for(var l=u;l<c;l++)s[l]=!0;u=c}else u++;if(-1===s.indexOf(!0)||-1===a.indexOf("word"))return"*";var d="";for(l=0;l<i.length;l++)s[l]&&l>0&&s[l-1]||(d+=(l>0?o[l-1]:"")+(s[l]?"*":i[l]));return d}}function Mt(e){var t=e.split("/");return t.map((function(e,n){var r=It(e),i=n>0?_t(wt(t,n)):"",o=n>0&&!!r&&(void 0===i||yt(i,r));if(void 0===r||/[@;=/]/.test(r)||ht.test(r)||o)return"*";var a=Lt(e,r,i);return void 0===a?e:a})).join("/")}var Ot=/^(?=[^0-9]*[0-9])(?=[^A-Za-z]*[A-Za-z])[A-Za-z0-9]{16,}$/,Ft=/^(?=[A-Za-z]{16,}$)(?:[^a-z]*[a-z]+[A-Z]){3}/,Ut=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Nt(e){var t=e.split("/");return t.map((function(e,n){var r=It(e),i=n>0?_t(wt(t,n)):"",o=!!r&&(/[0-9]/.test(r)||kt(r)),a=n>0&&!!r&&(void 0===i||bt(i)&&o);return void 0===r||/[@;=/]/.test(r)||ht.test(r)||function(e){var t=e.replace(/\+/g,"").split(/[-_.~]/);return Ut.test(e)||t.some((function(e){return Ot.test(e)||Ft.test(e)}))||t.filter(At).length>=2&&Ot.test(t.join(""))}(r)||a?"*":e})).join("/")}var Rt,xt=["pushState","replaceState"],Vt="__mpApvWrapped__",Ht=function(e){return!!e&&void 0!==e.history&&"function"==typeof e.history.pushState&&"function"==typeof e.addEventListener},Kt="__mpRouteMonitor__",qt=function(){var e=window;return e[Kt]||(e[Kt]={listeners:{},undoHistoryPatch:null,popStateListener:null}),e[Kt]},Bt=function(e){Object.values(qt().listeners).forEach((function(t){try{t(e)}catch(e){}}))},jt=function(e,t){e.undoHistoryPatch||e.popStateListener||(e.undoHistoryPatch=function(e,t){if(window.history.pushState[Vt])return t("[patch] history already wrapped, skipping to avoid double-wrap \u2014 STACKED WRAPPER DETECTED"),null;var n={},r={};xt.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,Vt,{value:!0,enumerable:!1}),r[t]=o}));var i=function(){return xt.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{xt.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}(Bt,t),e.popStateListener=function(){return Bt("popstate")},window.addEventListener("popstate",e.popStateListener))},zt=function(e,t,n){if(void 0===n&&(n=function(){}),!Ht("undefined"==typeof window?null:window))return function(){};var r=qt();return r.listeners[e]=t,jt(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))}},Qt="__mpApv__",Wt=["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"],Jt="is_auto_page_view",$t=["hostname","title","path",Jt].concat(["constructor","__proto__","prototype"],["true","false"]),Gt=Wt.map((function(e){return e.toLowerCase()})),Yt=function(e){return-1!==Gt.indexOf(e.toLowerCase())},Zt=/^[a-z0-9_][a-z0-9_.-]{0,63}$/,Xt=["dwvar_"],en=function(e){return Xt.some((function(t){return 0===e.indexOf(t)}))},tn=function(e){var t=[],n=[],r=0;return e?((Array.isArray(e)?e:String(e).split(",")).forEach((function(e,i){var o=i+1,a=String(e).trim().toLowerCase();a&&(Zt.test(a)&&-1===$t.indexOf(a)?Yt(a)||-1!==t.indexOf(a)||(t.length>=25?r++:t.push(a)):n.push(o))})),{allowed:t,rejectedPositions:n,overLimit:r}):{allowed:t,rejectedPositions:n,overLimit:r}},nn=function(e,t){return e<t?-1:e>t?1:0},rn=function(e,t){void 0===t&&(t=[]);var n=function(e){return void 0===e&&(e=[]),Wt.concat(e.filter((function(e){return!Yt(e)})).sort(nn))}(t),r=G(e,n);return n.filter((function(e){return W(r,e)})).filter((function(e){return function(e,t){return Yt(e)||t.length<=512}(e,r[e])})).map((function(e){return{name:e,value:r[e]}})).concat(function(e,t){var n=G(e);return Object.keys(n).filter((function(e){return en(e)&&n[e]&&-1===t.indexOf(e)})).sort(nn).map((function(e){return{name:e,value:n[e]}}))}(e,n))},on=function(e){var t={};return e.forEach((function(e){var n=e.name,r=e.value;t[n]=r})),t},an=function(e){var t;return e?((t={})[Jt]=!0,t):{}},sn=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},un=function(){return"undefined"==typeof window?null:window},cn=function(){var e=un();return e?e[Qt]:void 0},ln=function(){var e=un();return e?(e[Qt]||(e[Qt]={initialPageViewFired:!1}),e[Qt]):null},dn=function(){var e=cn();return e?e.tracker:void 0},pn=function(){var e=cn();return!(!e||!e.initialPageViewFired)},gn=function(){var e=ln();e&&(e.initialPageViewFired=!0)},fn=function(){var e=un();if(e){var t=dn();t&&t.teardown(),e[Qt]={initialPageViewFired:!1}}},vn=function(e){return{path:window.location.pathname,params:rn(Z(),e)}},hn=function(e){if(!e)return"";var t=e.params.map((function(e){return e.name})),n=Mt(e.path);return t.length?"".concat(n," (params: ").concat(t.join(),")"):n},mn=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"),Ht(un())){var t,n,r=dn(),i=this.retire(r);this.active&&r!==this&&(i=i.concat(this.retire(this))),this.active=!0,this.customQueryParams=this.readCustomQueryParams(),this.lastPage=vn(this.customQueryParams),this.log("[init] seeded lastPage: ".concat(hn(this.lastPage))),this.undoHistoryPatch=zt("pageView",(function(t){return e.safeHandleNavigation(t)}),(function(t){return e.log(t)})),t=this,(n=ln())&&(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=cn())&&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,a=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(", "))),a&&this.mpInstance.Logger.warning("mParticle APV: ignoring ".concat(a," 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=vn(this.customQueryParams),n=this.lastPage?sn(this.lastPage):null;this.log("[detect] navigation signal (source: ".concat(e,", candidate: ").concat(hn(t),", last: ").concat(hn(this.lastPage),")")),function(e,t){return t!==e}(n,sn(t))?(this.log("[accept] page changed, scheduling fire (source: ".concat(e,", from: ").concat(hn(this.lastPage),", to: ").concat(hn(t),")")),this.lastPage=t,this.scheduleFire(t)):this.log("[dedupe] page unchanged, skipping (source: ".concat(e,", page: ").concat(hn(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({},on(t)),{hostname:n,title:r,path:Nt(i)}),an(o)),eventType:ae.Unknown}}(p(p({},e),{hostname:window.location.hostname,title:t,isAutoPageView:this.isAutoPageView}));this.log("[fire] deferred flush -> _Events.logEvent(PageView) (page: ".concat(hn(e),")")),this.mpInstance._Events.logEvent(n)},e.prototype.log=function(e){this.mpInstance.Logger.verbose("mParticle APV: ".concat(e))},e}(),yn="path",bn="full",Sn="report",In=["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()})),_n=function(e){return function(e){return Yt(e)||en(e.toLowerCase())}(e)||-1!==In.indexOf(e.toLowerCase())},wn=["client_id","redirect_uri","response_type","scope","state","code","nonce"],Pn=wn.concat(["access_token","id_token","refresh_token","provider_token","provider_refresh_token"]),Cn=["ref","referrer"],An=/^((?:[a-z][a-z0-9+.-]*:)?\/\/)[^/]*@/i,kn=/^(?:[a-z][a-z0-9+.-]*:)?\/\/[^/]*/i,Tn=function(e){var t=/^#!?/.exec(e)[0],n=e.indexOf("&"),r=-1===n?e.length:n,i=e.slice(r).split("&").slice(1).filter(Mn).map((function(e){return"&".concat(e)})).join("");return t+Nt(e.slice(t.length,r))+i},En=function(e){return decodeURIComponent(e.replace(/\+/g," "))},Dn=function(e){var t,n=e.indexOf("="),r=-1===n?e:e.slice(0,n);try{t=En(r)}catch(e){return null}var i,o=t.toLowerCase();if(!t||!_n(t)||-1!==wn.indexOf(o))return null;if(-1===n||-1===Cn.indexOf(o))return e;try{i=En(e.slice(n+1))}catch(e){return null}var a=On(i,yn);return a===i?e:"".concat(r,"=").concat(encodeURIComponent(a))},Ln=function(e){return e.split("&").map(Dn).filter((function(e){return null!==e})).join("&")},Mn=function(e){try{var t=En(e.split("=")[0]);return-1===Pn.indexOf(t.toLowerCase())}catch(e){return!1}},On=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("?"),a=function(e,t){void 0===t&&(t=Nt);var n=kn.exec(e);return n?n[0]+t(e.slice(n[0].length)):"/"===e.charAt(0)?t(e):e}((-1===o?i:i.slice(0,o)).replace(An,"$1"),t===Sn?Mt:Nt);if(t!==bn)return a;var s=-1===o?"":Ln(i.slice(o+1));return a+(s?"?".concat(s):"")+function(e){var t=e.indexOf("?"),n=-1===t?e:e.slice(0,t),r=/^#!|^#[^?&=]*\//.test(e);if((r||-1!==t&&-1===n.indexOf("="))&&-1!==t){var i=Ln(e.slice(t+1));return Tn(n)+(i?"?".concat(i):"")}if(-1===e.indexOf("="))return r?Tn(e):e;var o=e.slice(1).split("&").map((function(e,t){return 0===t&&r?Tn("#".concat(e)).slice(1):e})).filter(Mn).join("&");return o?"#".concat(o):""}(r)},Fn=function(){return On(Z(),bn)};!function(e){e.Success="Success",e.QuotaExceeded="QuotaExceeded",e.Unavailable="Unavailable"}(Rt||(Rt={}));var Un=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,Rt.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)?Rt.QuotaExceeded:Rt.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}(),Nn=function(e){function t(t){return e.call(this,t,window.localStorage)||this}return d(t,e),t}(Un),Rn=function(e){function t(t){return e.call(this,t,window.sessionStorage)||this}return d(t,e),t}(Un),xn=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,Rt.Success},t.prototype.retrieve=function(){return this.contents},t.prototype.purge=function(){this.contents=null},t}(Un),Vn=function(e){this.url=e},Hn=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 f(this,(function(r){switch(r.label){case 0:return n=t||this.url,[4,fetch(n,e)];case 1:return[2,r.sent()]}}))}))},t}(Vn),Kn=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 f(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 f(this,(function(o){return i=new XMLHttpRequest,[2,new Promise((function(o,a){for(var s in i.onreadystatechange=function(){4===i.readyState&&o(i)},i.onerror=function(){a(i)},i.open(n,e),r)r.hasOwnProperty(s)&&i.setRequestHeader(s,r[s]);i.send(t)}))]}))}))},t}(Vn);function qn(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 a=[];if(P(r)&&Object.keys(r).length)for(var s in r){var u={};u.Identity=r[s],u.Type=C(s),a.push(u)}t.UserIdentities=a}}}var Bn=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 a=null===(i=t._CookieConsentManager)||void 0===i?void 0:i.getNoFunctional();this.offlineStorageEnabled&&!a&&(this.eventVault=new Rn("".concat(t._Store.storageName,"-events")),this.batchVault=new Nn("".concat(t._Store.storageName,"-batches")),(r=this.eventsQueuedForProcessing).push.apply(r,null!==(o=this.eventVault.retrieve())&&void 0!==o?o:[]));var s=this.mpInstance._Store,u=s.SDKConfig,c=s.devToken,l=this.mpInstance._Helpers.createServiceUrl(u.v3SecureServiceUrl,c);this.uploadUrl="".concat(l,"/events"),this.uploader=window.fetch?new Hn(this.uploadUrl):new Kn(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,a=n._timeOnSiteTimer,s=n._Helpers,u=i.sessionId,c=i.deviceId,l=i.sessionStartDate,d=i.SDKConfig,g=s.generateUniqueId,f=s.getFeatureFlag,v=o.getCurrentUser,h={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==a?void 0:a.getTimeInForeground())||0,TotalTimeOnSite:(null===(e=i.getTotalTimeOnSite)||void 0===e?void 0:e.call(i))||0,PageUrl:Fn()||null,IsBackgroundAST:!0},m=p({},h.CustomFlags),y=i.integrationAttributes;if(Qe(f)){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 h.CustomFlags=m,h.IntegrationAttributes=y,qn(v(),h),h},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,a=e;o<a.length;o++){if(!(h=a[o]).MPID){var s=t.getMPID();h.MPID=s}(v=i.get(h.MPID))||(v=[]),v.push(h),i.set(h.MPID,v)}for(var u=0,c=Array.from(i.entries());u<c.length;u++){for(var l=c[u],d=(s=l[0],l[1]),p=new Map,g=0,f=d;g<f.length;g++){var v,h=f[g];(v=p.get(h.SessionId))||(v=[]),v.push(h),p.set(h.SessionId,v)}for(var m=0,y=Array.from(p.entries());m<y.length;m++){var b=Je(s,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,a,s,u,c,l,d,p,g=this;return f(this,(function(f){switch(f.label){case 0:return i=this.mpInstance.Identity.getCurrentUser(),o=this.eventsQueuedForProcessing,this.eventsQueuedForProcessing=[],this.offlineStorageEnabled&&this.eventVault&&this.eventVault.store([]),a=[],z(o)||(a=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(a)||(d=this.batchesQueuedForProcessing).push.apply(d,a),s=this.batchesQueuedForProcessing,this.batchesQueuedForProcessing=[],s.forEach((function(e){g.batchOrder.has(e.source_request_id)||g.batchOrder.set(e.source_request_id,g.nextBatchOrder++)})),[4,this.uploadBatches(s,n)];case 1:return u=f.sent(),c=(u||[]).map((function(e){return e.source_request_id})),s.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),!this.offlineStorageEnabled||!this.batchVault||n&&z(u)||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===Rt.Success)return this.logDroppedOfflineBatches(i),void(this.batchesQueuedForProcessing=[]);if(o===Rt.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,a,s,u,c,l;return f(this,(function(d){switch(d.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=[],a=0,d.label=1;case 1:return a<r.length?(s={method:"POST",headers:{Accept:e.CONTENT_TYPE,"Content-Type":"text/plain;charset=UTF-8"},body:JSON.stringify(r[a])},n&&this.isBeaconAvailable()?(u=new Blob([s.body],{type:"text/plain;charset=UTF-8"}),!1===navigator.sendBeacon(this.uploadUrl,u)&&o.push(r[a]),[3,5]):[3,2]):[3,6];case 2:return d.trys.push([2,4,,5]),[4,this.uploader.upload(s)];case 3:if(!((c=d.sent()).status>=200&&c.status<300)){if(c.status>=500||429===c.status)return this.mpInstance.Logger.error("HTTP error status ".concat(c.status," received")),[2,r.slice(a,r.length)];if(c.status>=401)return this.mpInstance.Logger.error("HTTP error status ".concat(c.status," while uploading - please verify your API key.")),[2,null];throw console.error("HTTP error status ".concat(c.status," while uploading events."),c),new Error("Uncaught HTTP Error ".concat(c.status,". Batch upload will be re-attempted."))}return this.mpInstance.Logger.verbose("Upload success for request ID: ".concat(r[a].source_request_id)),[3,5];case 4:return l=d.sent(),this.mpInstance.Logger.error("Error sending event to mParticle servers. ".concat(l)),[2,r.slice(a,r.length)];case 5:return a++,[3,1];case 6:return z(o)?[2,null]:(this.mpInstance.Logger.warning("The browser refused the exit upload of ".concat(o.length," batch(es). Keeping them for the next upload.")),[2,o])}}))}))},e.CONTENT_TYPE="text/plain;charset=UTF-8",e.MINIMUM_INTERVAL_MILLIS=500,e}(),jn={UNKNOWN_ERROR:"UNKNOWN_ERROR",UNHANDLED_EXCEPTION:"UNHANDLED_EXCEPTION",IDENTITY_REQUEST:"IDENTITY_REQUEST",IDENTITY_MISMATCH:"IDENTITY_MISMATCH",MP_DEPRECATED_METHOD_USAGE:"MP_DEPRECATED_METHOD_USAGE",SELECT_PLACEMENTS_IDENTITY_IN_FLIGHT:"SELECT_PLACEMENTS_IDENTITY_IN_FLIGHT"},zn={ERROR:"ERROR",INFO:"INFO",WARNING:"WARNING"},Qn=r.IdentityMethods.Modify,Wn={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===Qn&&(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&&!Wn.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}}},Jn=r.HTTPCodes,$n=r.IdentityMethods,Gn=$n.Identify,Yn=$n.Modify,Zn=$n.Login,Xn=$n.Logout,er=r.HTTPCodes,tr=r.Messages,nr="x-mp-max-age",rr=function(e,t,n,r,i){if(!i){var o=lr(null==r?void 0:r.cacheMaxAge);switch(e){case Zn:case Gn:ir(e,t,o,n,r);break;case Yn:case Xn:n.purge()}}},ir=function(e,t,n,r,i){var o=i.responseText,a=i.status,s=r.retrieve()||{},u=_(or(e,t)),c={mpid:o.mpid,is_logged_in:o.is_logged_in};s[u]={responseText:JSON.stringify(c),status:a,expireTimestamp:n},r.store(s)},or=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 a in t)a!==n&&(o[me.IdentityType.getIdentityType(a)]=t[a]);i=o.reduce((function(e,t,n){var r=me.IdentityType.getIdentityName(n);return"".concat(e).concat(r,"=").concat(t,";")}),r)}return i},ar=function(e,t,n){var r=_(or(e,t)),i=n.retrieve(),o=i?i[r]:null;return{responseText:dr(o.responseText),expireTimestamp:o.expireTimestamp,status:o.status}},sr=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},ur=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)},cr=function(e,t,n,r,i,o,a){var s=function(e,t,n){var r=null==n?void 0:n.retrieve();if(!r)return!1;var i=_(or(e,t));return!(!W(r,i)||r[i].expireTimestamp<(new Date).getTime())}(a,e,t);return!!s&&(n(ar(a,e,t),r,i,o,a,e,!0),!0)},lr=function(e){return void 0===e&&(e=86400),(new Date).getTime()+1e3*e},dr=function(e){return e?JSON.parse(e):{}},pr={email_sha256:"other",mobile_sha256:"other2"},gr=function(e){var t=p({},e);return Object.keys(pr).forEach((function(e){if(e in t){var n=t[e];delete t[e],t[pr[e]]=n}})),t},fr=function(e,t){if(!e||!(null==t?void 0:t.userIdentities))return!1;var n,r,i,o,a=e.getUserIdentities().userIdentities,s=gr(t.userIdentities);return n=a,r=s,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]})))},vr=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)},hr=function(e,t,n,i){var a=e._Helpers,s=e._Store,u=e.Logger,c=e._ErrorReportingDispatcher,l=s.SDKConfig,d=l.identityUrl,v=l.isDevelopmentMode;if(a.canLog()){var h=a.createServiceUrl(d),m=v?"development":"production";!function(e,t,n,r,i,a,s,u){g(void 0,void 0,void 0,(function(){var c,l,d,g,v,h,m,y,b,S,I,_;return f(this,(function(f){switch(f.label){case 0:if(!K(i))return a.error("search called without a callback function; skipping request."),[2];if(c=function(e){try{i(e)}catch(e){a.error("Error invoking search callback: "+ie(e))}},l=Wn.removeFalsyIdentityValues({userIdentities:null!=e?e:{}},a).userIdentities,!Object.values(null!=l?l:{}).some((function(e){return"string"==typeof e&&e.length>0})))return a.verbose("Identity search called with empty identifiers; skipping request."),c({httpCode:Jn.noHttpCoverage}),[2];if(!t)return a.verbose("search called without a workspace API key; skipping request."),c({httpCode:Jn.noHttpCoverage}),[2];f.label=1;case 1:return f.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)},h=s||(window.fetch?new Hn(r):new Kn(r)),a.verbose("Sending search request to "+r),[4,h.upload(v,r)];case 2:if(m=f.sent(),y=void 0,!K(m.json))return[3,7];f.label=3;case 3:return f.trys.push([3,5,,6]),[4,m.json()];case 4:return y=f.sent(),[3,6];case 5:return f.sent(),a.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){a.verbose("search XHR response was not valid JSON.")}f.label=8;case 8:return m.status===o?a.verbose("search received 200 OK."):404===m.status?a.verbose("search received 404 (no match)."):a.verbose("search received non-success status "+m.status),c({httpCode:m.status,body:y}),[3,10];case 9:return S=f.sent(),I=ie(S),_="Error sending search request: "+I,a.error(_),null==u||u.report({message:_,code:jn.IDENTITY_REQUEST,severity:zn.ERROR}),c({httpCode:Jn.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)}),h+"search?cb=1",i,u,void 0,c)}else if(u.verbose(tr.InformationMessages.AbandonLogEvent),K(i))try{i({httpCode:er.loggingDisabledOrMissingAPIKey})}catch(e){u.error("Error invoking search callback: "+ie(e))}};function mr(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 Bn(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||qn(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 a,s=e.Identity.getCurrentUser();if(s&&(a=s.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())||vr(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,a)){if(!a||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 Hn(r):new Kn(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 a=e._Forwarders,s=a.sendSingleForwardingStatsToServer,u=a.setForwarderStatsQueue;e._Helpers.getFeatureFlag(r.FeatureFlags.ReportBatching)?(o.push(i),u(o)):s(i)}}}var yr=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 X(e,n,(function(e){return t.hashUserAttribute(e)}))},e.filterUserIdentities=function(e,n){return X(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}(),br=r.StorageNames;function Sr(e,t,n){n===me.IdentityType.CustomerId?e.unshift(t):e.push(t)}function Ir(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,a){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(a)return(null==(r=o||e.Identity.getCurrentUser())?void 0:r.getMPID())===a?null:e.Identity.getUser(a);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)||Sr(r,{Type:o,Identity:e[i]},o)}return r}(e,n,t.inArray)},this.filterUserIdentitiesForForwarders=yr.filterUserIdentities,this.filterUserAttributes=yr.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?br.currentStorageName+"_"+e:br.currentStorageName},this.converted=x,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=Wn}var _r=r.Messages,wr="mParticleAndroid",Pr="mParticle";function Cr(e){if(Object.prototype.hasOwnProperty.call(window,e))return window[e]}function Ar(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=wr+"_"+e+"_v2",i=Pr+"_"+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===Pr+"_"+n+"_v2")&&(r<2&&(e._Store.bridgeV2Available||e._Store.bridgeV1Available))},this.isBridgeV1Available=function(){return!!(e._Store.SDKConfig.useNativeSdk||Cr(wr)||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=Cr(wr);i&&i.hasOwnProperty(n)?(e.Logger.verbose(_r.InformationMessages.SendAndroid+n),i[n](r)):e._Store.SDKConfig.isIOS&&(e.Logger.verbose(_r.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,a;if(i){var s,u,c=Cr(wr+"_"+i+"_v2"),l=Pr+"_"+i+"_v2";if((null===(a=null===(o=window.webkit)||void 0===o?void 0:o.messageHandlers)||void 0===a?void 0:a[l])&&(s=window.webkit.messageHandlers[l]),e.uiwebviewBridgeName===l&&(u=e[l]),c&&c.hasOwnProperty(n))return e.Logger.verbose(_r.InformationMessages.SendAndroid+n),void c[n](r);s?(e.Logger.verbose(_r.InformationMessages.SendIOS+n),s.postMessage(JSON.stringify({path:n,value:r?JSON.parse(r):null}))):u&&(e.Logger.verbose(_r.InformationMessages.SendIOS+n),t.sendViaIframeToIOS(n,r))}}}var kr=r.Messages.InformationMessages,Tr={AdobeEventForwarder:11,DoubleclickDFP:41,AppNexus:50,Lotame:58,TradeDesk:103,VerizonMedia:155,Rokt:1277};function Er(e){var t=this;this.attemptCookieSync=function(n,r){var i,o=e._Store,a=o.pixelConfigurations,s=o.webviewBridgeEnabled;if(n&&!s&&!(null===(i=e._CookieConsentManager)||void 0===i?void 0:i.getNoFunctional())){var u=e._Persistence.getPersistence();z(u)||a.forEach((function(i){var o,a,s;try{var c=!1,l=i.filteringConsentRuleValues,d=i.pixelUrl,p=i.redirectUrl,g=i.moduleId,f=i.settings,v=i.frequencyCap,h=(l||{}).values;if(z(d))return;if(z(h)||(c=!0),c&&r)return;if(g===Tr.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!==(a=null===(o=u[n])||void 0===o?void 0:o.csd)&&void 0!==a?a:{},b=y[g]||null;if(!Dr(v,b))return;var S=g===Tr.TradeDesk?window.location.hostname:void 0,I="true"===(null===(s=null==f?void 0:f.enableHmTag)||void 0===s?void 0:s.toLowerCase()),_=g===Tr.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=O(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(kr.CookieSync),o.onload=function(){i[n]=(new Date).getTime(),e._Persistence.saveUserCookieSyncDatesToPersistence(r,i)},o.src=t}}var Dr=function(e,t){return!t||(new Date).getTime()>new Date(t).getTime()+864e5*e};function Lr(e,t,n){t.warning(e.warningMessage),null==n||n.report({message:e.methodName,code:jn.MP_DEPRECATED_METHOD_USAGE,severity:zn.WARNING})}var Mr=r.Messages;function Or(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,a=i.SDKConfig,s=a.sessionTimeout;if(n(null==o?void 0:o.getTime(),s))t.endSession(),t.startNewSession();else{var u=e.Identity.getCurrentUser(),c=a.identifyRequest;!((null===(r=e._CookieConsentManager)||void 0===r?void 0:r.getNoFunctional())&&!vr(e._Store))&&fr(u,c)&&(e.Identity.identify(c,a.identityCallback),e._Store.identifyCalled=!0,e._Store.SDKConfig.identityCallback=null)}}else t.startNewSession()},this.getSession=function(){return Lr({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(Mr.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 a=(null===(n=e._CookieConsentManager)||void 0===n?void 0:n.getNoFunctional())&&!vr(e._Store);e._Store.identifyCalled||a||(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(Mr.InformationMessages.AbandonStartSession)},this.endSession=function(i){var o,a,s,u;if(e.Logger.verbose(Mr.InformationMessages.StartingEndSession),i)r();else{if(!e._Helpers.canLog())return e.Logger.verbose(Mr.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(Mr.InformationMessages.NoSessionToEnd),void(null===(a=e._timeOnSiteTimer)||void 0===a||a.resetTimer());if(c.gs.sid&&e._Store.sessionId!==c.gs.sid&&(e._Store.sessionId=c.gs.sid),null===(s=null==c?void 0:c.gs)||void 0===s?void 0:s.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 Fr=r.Messages;function Ur(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,a,s,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=C(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)?C(i):1,Brand:s,Variant:o,Category:a,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(Fr.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,a){return e._Helpers.Validators.isStringOrNumber(t)?{Id:t,Affiliation:n,CouponCode:r,Revenue:i,Shipping:o,Tax:a}:(e.Logger.error(Fr.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 a=re(!1,{},n.EventAttributes);if(o.Attributes)for(var s in o.Attributes)a[s]=o.Attributes[s];t.extractProductAttributes(a,o),i.ProductImpressionList&&(a["Product Impression List"]=i.ProductImpressionList);var u=e._ServerModel.createEventObject({messageType:me.MessageType.PageEvent,name:t.generateExpandedEcommerceName("Impression"),data:a,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 a=e._ServerModel.createEventObject({messageType:me.MessageType.PageEvent,name:t.generateExpandedEcommerceName(me.PromotionActionType.getExpansionName(n.PromotionAction.PromotionActionType)),data:o,eventType:me.EventType.Transaction});r.push(a)})),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 a=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(a)}else i=!0;var s=n.ProductAction.ProductList;return s?(s.forEach((function(o){var a=re(!1,n.EventAttributes,o.Attributes);i?t.extractActionAttributes(a,n.ProductAction):t.extractTransactionId(a,n.ProductAction),t.extractProductAttributes(a,o);var s=e._ServerModel.createEventObject({messageType:me.MessageType.PageEvent,name:t.generateExpandedEcommerceName(me.ProductActionType.getExpansionName(n.ProductAction.ProductActionType)),data:a,eventType:me.EventType.Transaction});r.push(s)})),r):r},this.createCommerceEventObject=function(t,n){var r,i=e._Helpers.extend;return e.Logger.verbose(Fr.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(Fr.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 C(t)}}var Nr=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 Nn(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 Rr(e){var t=e?p({},e):{};return(!0===t.noDeviceId||!0===t.noDeviceID)&&(t.noDeviceId=!0,t.noFunctional=!0,t.noTargeting=!0),t}function xr(e,t,n){var i=this,o=t._Helpers.createMainStorageName,a=t._NativeSdkHelpers.isWebviewEnabled,s={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 s)this[u]=s[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=Vr(e),this.SDKConfig.autoLogPageViewQueryParams=tn(e.autoLogPageViewQueryParams),e.deviceId&&(this.deviceId=e.deviceId),e.hasOwnProperty("isDevelopmentMode")?this.SDKConfig.isDevelopmentMode=N(e.isDevelopmentMode):this.SDKConfig.isDevelopmentMode=!1;var l=Hr(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 f=e.dataPlan;f.planId&&(B(f.planId)?this.SDKConfig.dataPlan.PlanId=f.planId:t.Logger.error("Your data plan id must be a string and match the data plan slug format (i.e. under_case_slug)")),f.planVersion&&(H(f.planVersion)?this.SDKConfig.dataPlan.PlanVersion=f.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,s=e.requiredWebviewBridgeName;e.flags&&(i.SDKConfig.flags=Vr(e)),i.SDKConfig.autoLogPageViewQueryParams=tn(e.autoLogPageViewQueryParams);var u=Hr(e,i.SDKConfig.flags,n);for(var c in u)i.SDKConfig[c]=u[c];if(r){i.SDKConfig.workspaceToken=r;var l=Rr(null==e?void 0:e.launcherOptions).noFunctional;t._timeOnSiteTimer=new Nr(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=s||r,i.webviewBridgeEnabled=a(i.SDKConfig.requiredWebviewBridgeName,i.SDKConfig.minWebviewBridgeVersion),i.configurationLoaded=!0}}function Vr(e){var t={},n=r.FeatureFlags,i=n.ReportBatching,o=n.EventBatchingIntervalMillis,a=n.OfflineStorage,s=n.DirectUrlRouting,u=n.CacheIdentity,c=n.AudienceAPI,l=n.CaptureIntegrationSpecificIds,d=n.CaptureIntegrationSpecificIdsV2,p=n.AstBackgroundEvents,g=n.AutoLogPageView,f=n.AutoButtonTracking,v=n.AutoLinkTracking;return e.flags?(t[i]=e.flags[i]||!1,t[o]=C(e.flags[o])||r.DefaultConfig.uploadInterval,t[a]=e.flags[a]||"0",t[s]="True"===e.flags[s],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[f]="True"===e.flags[f],t[v]="True"===e.flags[v],t):{}}function Hr(e,t,n){return n?z(e.domain)&&t.directURLRouting?function(e,t){var n=r.DefaultBaseUrls,i={},o="us1",a=t.split("-"),s=a.length<=1?o:a[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],s],c.slice(1),!0).join(".")}else i[u]=e[u]||n[u];return i}(e,n):Kr(e):{}}function Kr(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 a in t)i[a]=e[a]||t[a];return i}var qr=function(){function e(e){var t,n;this.logLevel=null!==(t=e.logLevel)&&void 0!==t?t:Ve,this.logger=null!==(n=e.logger)&&void 0!==n?n:new Br}return e.prototype.verbose=function(e){this.logLevel!==Re&&this.logger.verbose&&this.logLevel===xe&&this.logger.verbose(e)},e.prototype.warning=function(e){this.logLevel!==Re&&(!this.logger.warning||this.logLevel!==xe&&this.logLevel!==Ve||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===xe},e.prototype.setLogLevel=function(e){this.logLevel=e},e}(),Br=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}(),jr=n.Base64,zr=r.Messages,Qr=r.Base64CookieKeys,Wr=r.SDKv2NonMPIDCookieKeys,Jr=r.StorageNames;function $r(){return window.mParticle}function Gr(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(e){var n=t.decodePersistence(e);if(!n)return null;var r=JSON.parse(n);return P(r)&&Object.keys(r).length?r:null}function a(e,t){return e.length>t}function s(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(e,t){var n;e[t]&&(n=e[t],Array.isArray(n)?n.length>0:P(n)&&Object.keys(n).length>0)?e[t]=jr.encode(JSON.stringify(e[t])):delete e[t]}function d(e,t){var n=e[t];P(n)&&Object.keys(n).length?e[t]=jr.encode(JSON.stringify(n)):delete e[t]}function p(e){for(var t in e)e.hasOwnProperty(t)&&Qr[t]&&d(e,t)}function g(e){for(var t in e)e.hasOwnProperty(t)&&Qr[t]&&e[t].length&&(e[t]=JSON.parse(jr.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)&&!Wr[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(zr.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(zr.ErrorMessages.CookieParseError)}},this.determineLocalStorageAvailability=function(e){var t=$r();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()||{},a=e.Identity.getCurrentUser(),s=a?a.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,s&&(o.cu=s),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,a,s,u=e._Store.storageName;e.Logger.verbose(zr.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{a=(i=t[n].split("=")).shift(),s=i.join("=")}catch(t){e.Logger.verbose("Unable to parse cookie: "+a+". Skipping.")}if(u&&u===a){var c=o(e._Helpers.converted(s));if(c)return e.Logger.verbose(zr.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 a,s,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();s=""===(a=t.getCookieDomain())?"":";domain="+a,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,s,e._Store.SDKConfig.maxCookieSize),e.Logger.verbose(zr.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)&&a(i=c(e,t,n),r)&&(Wr[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)&&(Wr[n]||n===e.cu||(t[n]=1));return t}(e);return Object.keys(o).length&&function(e,t,n,r,i,o){var s;for(var u in t)a(s=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&&a(o=c(e,n,r),i);u++)s(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)&&(Qr[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)&&(Wr[t]||p(e[t]))}(t),m(JSON.stringify(t))},this.decodePersistence=function(t){try{if(!t)return;var n=JSON.parse(y(t));return P(n)&&Object.keys(n).length&&(function(e){for(var t in e)e.hasOwnProperty(t)&&(Qr[t]?(e[t]=JSON.parse(jr.decode(e[t])),"csm"!==t||Array.isArray(e[t])||delete e[t]):"ie"===t&&(e[t]=Boolean(e[t])))}(n.gs),function(e){for(var t in e)if(e.hasOwnProperty(t))if(Wr[t])"l"===t&&(e[t]=Boolean(e[t]));else{if(!P(e[t])){delete e[t];continue}g(e[t])}}(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(e,n){if(n){var r=t.getPersistence();r&&(P(r[e])?r[e].csd=n:r[e]={csd:n}),t.savePersistence(r)}},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)),a=new Date,s=e._Store.storageName,c=new Date(a.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(s)+"="+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(e,n){if(e){n||(n=(new Date).getTime());var r=t.getPersistence();r&&(P(r[e])||(r[e]={}),r[e].fst||(r[e].fst=n,t.savePersistence(r)))}},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(e,n){if(e){n||(n=(new Date).getTime());var r=t.getPersistence();r&&P(r[e])&&(r[e].lst=n,t.savePersistence(r))}},this.getDeviceId=function(){return e._Store.deviceId},this.setDeviceId=function(n){e._Store.deviceId=n,t.update()},this.resetPersistence=function(){localStorage.clear(),t.expireCookies(Jr.cookieName),t.expireCookies(Jr.cookieNameV2),t.expireCookies(Jr.cookieNameV3),t.expireCookies(Jr.cookieNameV4),t.expireCookies(e._Store.storageName);var n=$r();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 Yr=r.Messages;function Zr(e){var t=this;this.logEvent=function(t,n){if(e.Logger.verbose(Yr.InformationMessages.StartingLogEvent+": "+t.name),e._Helpers.canLog()){var r=e._ServerModel.createEventObject(t);e._APIClient.sendEventToServer(r,n)}else e.Logger.verbose(Yr.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(Yr.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({},on(rn(Z(),null===(r=e._Store.SDKConfig.autoLogPageViewQueryParams)||void 0===r?void 0:r.allowed))),{hostname:window.location.hostname,title:window.document.title}),an(n&&n.isAutoPageView)),eventType:me.EventType.Unknown})},this.logProductActionEvent=function(n,r,i,o,a,s){var u=e._Ecommerce.createCommerceEventObject(o,s),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)),P(a)&&e._Ecommerce.convertTransactionAttributesToProductAction(a,u.ProductAction),t.logCommerceEvent(u,i,s))},this.logPurchaseEvent=function(n,r,i,o){var a=e._Ecommerce.createCommerceEventObject(o);a&&(a.EventName+=e._Ecommerce.getProductActionEventName(me.ProductActionType.Purchase),a.EventCategory=me.CommerceEventType.ProductPurchase,a.ProductAction={ProductActionType:me.ProductActionType.Purchase,ProductList:Array.isArray(r)?r:[r]},e._Ecommerce.convertTransactionAttributesToProductAction(n,a.ProductAction),t.logCommerceEvent(a,i))},this.logPromotionEvent=function(n,r,i,o,a){var s=e._Ecommerce.createCommerceEventObject(o);s&&(s.EventName+=e._Ecommerce.getPromotionActionEventName(n),s.EventCategory=e._Ecommerce.convertPromotionActionToEventType(n),s.PromotionAction={PromotionActionType:n,PromotionList:Array.isArray(r)?r:[r]},t.logCommerceEvent(s,i,a))},this.logImpressionEvent=function(n,r,i,o){var a=e._Ecommerce.createCommerceEventObject(i);a&&(a.EventName+="Impression",a.EventCategory=me.CommerceEventType.ProductImpression,Array.isArray(n)||(n=[n]),a.ProductImpressions=[],n.forEach((function(e){a.ProductImpressions.push({ProductImpressionList:e.Name,ProductList:Array.isArray(e.Product)?e.Product:[e.Product]})})),t.logCommerceEvent(a,r,o))},this.logCommerceEvent=function(t,n,r){if(e.Logger.verbose(Yr.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(Yr.InformationMessages.AbandonLogEvent)}},this.addEventHandler=function(n,r,i,o,a){var s,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[s],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:a||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(s=0;s<u.length;s++)c()}else e.Logger.verbose("No elements found");else e.Logger.error("Can't bind event, selector is required")}}function Xr(e,t){return!(null==e?void 0:e.isAttributeKeyBlocked(t))}function ei(e,t){return!(null==e?void 0:e.isIdentityBlocked(t))}function ti(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)&&Xr(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 a=me.IdentityType.getIdentityName(o);ei(t,a)&&(n[a]=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])&&Xr(t,r)&&(n[r]=e[r].slice());return n}(i(),r);return n._Helpers.filterUserAttributes(t,e.userAttributeFilters)},getAllUserAttributes:i}}var ni,ri=[me.MessageType.PageEvent,me.MessageType.PageView,me.MessageType.Commerce];function ii(e,t){return!(!e||!e.length)&&b(e,t)}function oi(e,t,n){var r=n&&n.kitBlockingEnabled?n.createBlockedEvent(e):e;if(!r)return!1;if(function(e,t,n){if(!(ri.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=yr.hashAttributeConditionalForwarding(i);if(o===n.filteringEventAttributeValue.eventAttributeName){r={name:o,value:yr.hashAttributeConditionalForwarding(t[i])};break}}var a=null!==r&&r.value===n.filteringEventAttributeValue.eventAttributeValue;return!(!0===n.filteringEventAttributeValue.includeOnMatch?a:!a)}(r.EventDataType,r.EventAttributes,t))return!1;var i=r.EventCategory;return!function(e,t,n,r){return!(e!==me.MessageType.PageEvent||!ii(r.eventNameFilters,t)&&!ii(r.eventTypeFilters,n))||!(e!==me.MessageType.Commerce||!ii(r.eventTypeFilters,n))||!(e!==me.MessageType.PageView||!ii(r.screenNameFilters,t))}(r.EventDataType,yr.hashEventName(r.EventName,i),yr.hashEventType(i),t)}var ai=r.IdentityMethods,si=ai.Modify,ui=ai.Identify,ci=ai.Login,li=ai.Logout,di=((ni={})[ui]="onIdentifyComplete",ni[ci]="onLoginComplete",ni[li]="onLogoutComplete",ni[si]="onModifyComplete",ni);function pi(e,t){var n=e,r={};for(var i in n)n.hasOwnProperty(i)&&ei(t,i)&&(r[i]=n[i]);return r}function gi(e,t){var n=this,r=this;this.forwarderStatsUploader=new mr(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 a=pi(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 s=e._Helpers.filterUserIdentities(a,n.userIdentityFilters),u=o?ti(o.getMPID(),n,e,t).getAllUserAttributes():{};return n.initialized||(n.logger=e.Logger,n.init(n.settings,i,!1,null,u,s,e._Store.SDKConfig.appVersion,e._Store.SDKConfig.appName,e._Store.SDKConfig.customFlags,e._Store.clientId),n.initialized=!0),!0}))}},this.isEnabledForUserAttributes=function(e,t){if(!e||!P(e)||!Object.keys(e).length)return!0;if(!t)return!1;var n=t.getAllUserAttributes();try{var r=!!(n&&P(n)&&Object.keys(n).length>0)&&function(e,t){for(var n in e)if(W(e,n)){var r=yr.hashAttributeConditionalForwarding(n),i=yr.hashAttributeConditionalForwarding(e[n]);if(r===t.userAttributeName&&i===t.userAttributeValue)return!0}return!1}(n,e);return e.includeOnMatch===r}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(oi(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 a={};for(var s in r)if(r.hasOwnProperty(s)){var u=yr.hashEventAttributeKey(t,n,s);b(o,u)||(a[s]=r[s])}return a}(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,yr.hashUserIdentity(e.Type))})):r||[]),o.UserAttributes=yr.filterUserAttributes(o.UserAttributes,n.userAttributeFilters),n.process){e.Logger.verbose("Sending message to forwarder: "+n.name);var a=n.process(o);a&&e.Logger.verbose(a)}}};e._Store.activeForwarders.forEach((function(e){n(e)}))}},this.handleForwarderUserAttributes=function(n,r,a){t&&t.isAttributeKeyBlocked(r)||!e._Store.activeForwarders.length||e._Store.activeForwarders.forEach((function(t){if(t[n]&&!yr.isFilteredUserAttribute(r,t.userAttributeFilters))try{var s=void 0;n===i?s=t.setUserAttribute(r,a):n===o&&(s=t.removeUserAttribute(r)),s&&e.Logger.verbose(s)}catch(t){e.Logger.error(t)}}))},this.setForwarderUserIdentities=function(n){var r=pi(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=ti(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=di[r];i&&e._Store.activeForwarders.forEach((function(r){var o=r[i];if(o){var a=ti(n.getMPID(),r,e,t),s=o.call(r,a,a.getUserIdentities());s&&e.Logger.verbose(s)}}))},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 a=void 0;if(i.suffix&&(a="".concat(i.name,"-").concat(i.suffix)),!(o!==a&&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 a=n.kits[o];r.configureSideloadedKit(a)}if(!z(n.kits)){var s=Object.keys(n.kits);e._Store.sideloadedKitsCount=s.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 f(this,(function(a){switch(a.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=a.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 fi=me.MessageType,vi=me.ApplicationTransitionType;function hi(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 mi(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 a=e.getCCPAConsentState();return a&&(t.ccpa={data_sale_opt_out:{c:a.Consented,ts:a.Timestamp,d:a.ConsentDocument,l:a.Location,h:a.HardwareId}}),t},this.createEventObject=function(t,n){var i,o,a,s={},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 f=e._IntegrationCapture.getClickIdsAsIntegrationAttributes();d=p(p({},f),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===(a=(o=e._Store).getTotalTimeOnSite)||void 0===a?void 0:a.call(o),PageUrl:Fn()||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),s={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===fi.AppStateTransition&&(u.IsFirstRun=e._Store.isFirstRun,u.LaunchReferral=Fn()||null),u.CurrencyCode=e._Store.currencyCode,qn(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),s.Timestamp=e._Store.dateLastEventSent.getTime(),re({},u,s)}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===fi.AppStateTransition&&(r.fr=n.IsFirstRun,r.iu=!1,r.at=vi.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){q(e)&&n.push(e.toString())})):q(e.CustomFlags[r])&&n.push(e.CustomFlags[r].toString()),n.length&&(t.flags[r]=n))}(n,r),n.EventDataType===fi.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:hi(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:hi(e.ProductList)}})))):n.EventDataType===fi.Profile&&(r.pet=n.ProfileMessageType),r}}function yi(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 bi=function(){function e(e,t,n){this.url="",this.logger=n,this.url="https://".concat(e).concat(t,"/audience"),this.userAudienceAPI=window.fetch?new Hn(this.url):new Kn(this.url)}return e.prototype.sendGetUserAudienceRequest=function(e,t){return g(this,void 0,void 0,(function(){var n,r,i,o,a,s;return f(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(),a={currentAudienceMemberships:null==o?void 0:o.audience_memberships};try{t(a)}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 s=u.sent(),this.logger.error("Error retrieving audiences. ".concat(s)),[3,7];case 7:return[2]}}))}))},e}(),Si=function(e,t){return z(e)||e.splice(0,e.length).forEach((function(e){try{K(e)?e():Array.isArray(e)&&Ii(e)}catch(e){t.error("Error processing ready queue item: "+ie(e))}})),[]},Ii=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,a=0,s=r;a<s.length;a++){var u=s[a];o=i,i=i[u]}i.apply(o,t)}catch(e){throw new Error("Unable to compute proper mParticle function "+e)}}},_i=r.Messages,wi=r.HTTPCodes,Pi=r.FeatureFlags,Ci=r.IdentityMethods,Ai=_i.ErrorMessages,ki=Pi.CacheIdentity,Ti=Ci.Identify,Ei=Ci.Modify,Di=Ci.Login,Li=Ci.Logout;function Mi(e){var t=e._Helpers,n=t.getFeatureFlag,i=t.extend,a=this;this.idCache=null,this.audienceManager=null,this.IdentityRequest={preProcessIdentityRequest:function(t,n,r){e.Logger.verbose(_i.InformationMessages.StartingLogEvent+": "+r);var i=e._Helpers.Validators.removeFalsyIdentityValues(t,e.Logger),o=(null==i?void 0:i.userIdentities)?p(p({},i),{userIdentities:gr(i.userIdentities)}):i,a=e._Helpers.Validators.validateIdentities(o,r);if(!a.valid)return e.Logger.error("ERROR: "+a.error),{valid:!1,error:a.error};if(n&&!e._Helpers.Validators.isFunction(n)){var s="The optional callback must be a function. You tried entering a(n) "+c(n);return e.Logger.error(s),{valid:!1,error:s}}return{valid:!0,cleanedIdentities:o}},createIdentityRequest:function(t,n,r,i,o,a,s){return{client_sdk:{platform:n,sdk_vendor:r,sdk_version:i},context:a,environment:e._Store.SDKConfig.isDevelopmentMode?"development":"production",request_id:e._Helpers.generateUniqueId(),request_timestamp_ms:(new Date).getTime(),previous_mpid:s||null,known_identities:sr(t,o)}},createModifyIdentityRequest:function(t,n,r,i,o,a){return{client_sdk:{platform:r,sdk_vendor:i,sdk_version:o},context:a,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 a=me.IdentityType.getIdentityType(o);!1!==a&&a>=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:wi,identify:function(t,n){var i,o=e.Identity.getCurrentUser(),s=e._Identity.IdentityRequest.preProcessIdentityRequest(t,n,Ti);if(o&&(i=o.getMPID()),s.valid){var u=e._Identity.IdentityRequest.createIdentityRequest(s.cleanedIdentities,r.platform,r.sdkVendor,r.sdkVersion,e._Store.deviceId,e._Store.context,i);if(e._Helpers.getFeatureFlag(r.FeatureFlags.CacheIdentity))if(cr(u.known_identities,a.idCache,a.parseIdentityResponse,i,n,t,Ti))return;e._Helpers.canLog()?e._Store.webviewBridgeEnabled?(e._NativeSdkHelpers.sendToNative(r.NativeSdkPaths.Identify,JSON.stringify(e._Identity.IdentityRequest.convertToNative(t))),e._Helpers.invokeCallback(n,wi.nativeIdentityRequest,"Identify request sent to native sdk")):e._IdentityAPIClient.sendIdentityRequest(u,Ti,n,t,a.parseIdentityResponse,i,u.known_identities):(e._Helpers.invokeCallback(n,wi.loggingDisabledOrMissingAPIKey,_i.InformationMessages.AbandonLogEvent),e.Logger.verbose(_i.InformationMessages.AbandonLogEvent))}else e._Helpers.invokeCallback(n,wi.validationIssue,s.error),e.Logger.verbose(s)},logout:function(t,n){var i,o=e.Identity.getCurrentUser(),s=e._Identity.IdentityRequest.preProcessIdentityRequest(t,n,Li);if(o&&(i=o.getMPID()),s.valid){var u,c=e._Identity.IdentityRequest.createIdentityRequest(s.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,wi.nativeIdentityRequest,"Logout request sent to native sdk")):(e._IdentityAPIClient.sendIdentityRequest(c,Li,n,t,a.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,wi.loggingDisabledOrMissingAPIKey,_i.InformationMessages.AbandonLogEvent),e.Logger.verbose(_i.InformationMessages.AbandonLogEvent))}else e._Helpers.invokeCallback(n,wi.validationIssue,s.error),e.Logger.verbose(s)},login:function(t,n){var i,o=e.Identity.getCurrentUser(),s=e._Identity.IdentityRequest.preProcessIdentityRequest(t,n,Di);if(o&&(i=o.getMPID()),s.valid){var u=e._Identity.IdentityRequest.createIdentityRequest(s.cleanedIdentities,r.platform,r.sdkVendor,r.sdkVersion,e._Store.deviceId,e._Store.context,i);if(e._Helpers.getFeatureFlag(r.FeatureFlags.CacheIdentity))if(cr(u.known_identities,a.idCache,a.parseIdentityResponse,i,n,t,Di))return;e._Helpers.canLog()?e._Store.webviewBridgeEnabled?(e._NativeSdkHelpers.sendToNative(r.NativeSdkPaths.Login,JSON.stringify(e._Identity.IdentityRequest.convertToNative(t))),e._Helpers.invokeCallback(n,wi.nativeIdentityRequest,"Login request sent to native sdk")):e._IdentityAPIClient.sendIdentityRequest(u,Di,n,t,a.parseIdentityResponse,i,u.known_identities):(e._Helpers.invokeCallback(n,wi.loggingDisabledOrMissingAPIKey,_i.InformationMessages.AbandonLogEvent),e.Logger.verbose(_i.InformationMessages.AbandonLogEvent))}else e._Helpers.invokeCallback(n,wi.validationIssue,s.error),e.Logger.verbose(s)},modify:function(t,n){var i,o=e.Identity.getCurrentUser(),s=e._Identity.IdentityRequest.preProcessIdentityRequest(t,n,Ei);if(o&&(i=o.getMPID()),s.valid){var u=(null==t?void 0:t.userIdentities)?s.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,wi.nativeIdentityRequest,"Modify request sent to native sdk")):e._IdentityAPIClient.sendIdentityRequest(c,Ei,n,t,a.parseIdentityResponse,i):(e._Helpers.invokeCallback(n,wi.loggingDisabledOrMissingAPIKey,_i.InformationMessages.AbandonLogEvent),e.Logger.verbose(_i.InformationMessages.AbandonLogEvent))}else e._Helpers.invokeCallback(n,wi.validationIssue,s.error),e.Logger.verbose(s)},getCurrentUser:function(){var t;return e._Store?(t=e._Store.mpid)?(t=e._Store.mpid.slice(),a.mParticleUser(t,e._Store.isLoggedIn)):e._Store.webviewBridgeEnabled?a.mParticleUser():null:null},getUser:function(t){var n=e._Persistence.getPersistence();return n&&n[t]&&!r.SDKv2NonMPIDCookieKeys.hasOwnProperty(t)?a.mParticleUser(t):null},getUsers:function(){var t=e._Persistence.getPersistence(),n=[];if(t)for(var i in t)r.SDKv2NonMPIDCookieKeys.hasOwnProperty(i)||n.push(a.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=_i.ValidationMessages.AliasMissingMpid),t.destinationMpid===t.sourceMpid&&(i=_i.ValidationMessages.AliasNonUniqueMpid),t.startTime&&t.endTime||(i=_i.ValidationMessages.AliasMissingTime),t.startTime>t.endTime&&(i=_i.ValidationMessages.AliasStartBeforeEndTime),i)return e.Logger.warning(i),void e._Helpers.invokeAliasCallback(n,wi.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,wi.nativeIdentityRequest,"Alias request sent to native sdk");else{e.Logger.verbose(_i.InformationMessages.StartingAliasRequest+": "+t.sourceMpid+" -> "+t.destinationMpid);var o=e._Identity.IdentityRequest.createAliasNetworkRequest(t);e._IdentityAPIClient.sendAliasRequest(o,n)}else e._Helpers.invokeAliasCallback(n,wi.loggingDisabledOrMissingAPIKey,_i.InformationMessages.AbandonAliasUsers),e.Logger.verbose(_i.InformationMessages.AbandonAliasUsers)},search:function(t,n,r){hr(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,a=t.getLastSeenTime()||(new Date).getTime();return i<o&&a<(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:a,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(_i.ErrorMessages.BadKey)},removeUserTag:function(t){e._Helpers.Validators.isValidKeyValue(t)?this.removeUserAttribute(t):e.Logger.error(_i.ErrorMessages.BadKey)},setUserAttribute:function(n,i){if(e._SessionManager.resetSessionTimer(),e._Helpers.canLog()){if(!e._Helpers.Validators.isValidAttributeValue(i))return void e.Logger.error(_i.ErrorMessages.BadAttribute);if(!e._Helpers.Validators.isValidKeyValue(n))return void e.Logger.error(_i.ErrorMessages.BadKey);if(e._Store.webviewBridgeEnabled)e._NativeSdkHelpers.sendToNative(r.NativeSdkPaths.SetUserAttribute,JSON.stringify({key:n,value:i}));else{var o=this.getAllUserAttributes(),s=void 0,u=void 0,c=S(o,n);c?(u=!1,s=o[c],delete o[c]):u=!0,o[n]=i,e._Store.setUserAttributes(t,o),a.sendUserAttributeChangeEvent(n,i,s,u,!1,this),e._Forwarders.initForwarders(a.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 s=S(o,n);s&&(n=s);var u=o[n]?o[n].toString():null;delete o[n],i&&P(i[t])&&(i[t].ua=o,e._Persistence.savePersistence(i)),a.sendUserAttributeChangeEvent(n,null,u,!1,!0,this),e._Forwarders.initForwarders(a.IdentityAPI.getCurrentUser().getUserIdentities().userIdentities,e._APIClient.prepareForwardingStats),e._Forwarders.handleForwarderUserAttributes("removeUserAttribute",n,null)}else e.Logger.error(_i.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 s=this.getAllUserAttributes(),u=void 0,l=void 0,d=void 0,p=S(s,n);if(p?(l=!1,u=s[p],delete s[p]):l=!0,s[n]=o,e._Store.setUserAttributes(t,s),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&&a.sendUserAttributeChangeEvent(n,i,u,l,!1,this),e._Forwarders.initForwarders(a.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(_i.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(a.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(Pi.AudienceAPI)?(null===a.audienceManager&&(a.audienceManager=new bi(e._Store.SDKConfig.userAudienceUrl,e._Store.devToken,e.Logger)),a.audienceManager.sendGetUserAudienceRequest(t,n)):e.Logger.error(Ai.AudienceAPINotEnabled)}}},this.parseIdentityResponse=function(t,r,i,s,u,c,l){var d,p,g,f,v,h,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),f=!e._Persistence.getFirstSeenTime(v.mpid),e._Persistence.setFirstSeenTime(v.mpid)),t.status===o){n(ki)&&rr(u,c,a.idCache,t,l);var _=a.IdentityAPI.getUser(v.mpid),w=_?_.getUserIdentities().userIdentities:{};u===Ei?(S=e._Identity.IdentityRequest.combineUserIdentities(b,s.userIdentities),e._Store.setUserIdentities(r,S)):(u===Ti&&m&&v.mpid===y&&e._Persistence.setFirstSeenTime(v.mpid),e._Store.addMpidToSessionHistory(v.mpid,r),e._CookieSyncManager.attemptCookieSync(v.mpid,f),e._Persistence.swapCurrentUser(r,v.mpid,e._Store.currentSessionMPIDs),s&&!z(s.userIdentities)&&(S=a.IdentityRequest.combineUserIdentities(w,s.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{Lr({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,h=e.Identity.getCurrentUser(),s,e.Logger,e._ErrorReportingDispatcher);var P=e._Persistence.getPersistence();h&&(e._Persistence.storeDataInMemory(P,h.getMPID()),a.reinitForwardersOnUserChange(m,h),a.setForwarderCallbacks(h,u));var C=ue.getNewIdentitiesByName(S),A=u===Ei?b:w;null===(p=e._CookieConsentManager)||void 0===p||p.syncNoTargetingAttribute(h),a.sendUserIdentityChangeEvent(C,u,v.mpid,A)}if(i){var k=0===t.status?wi.noHttpCoverage:t.status;e._Helpers.invokeCallback(i,k,v||null,h,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=Si(e._preInit.readyQueue,e.Logger)},this.sendUserIdentityChangeEvent=function(t,n,r,i){var o;if(r||n===Ei){var s=this.IdentityAPI.getUser(r);for(var u in t)if(i[u]!==t[u]){var c=!i[u],l=a.createUserIdentityChange(u,t[u],i[u],c,s);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,s){var u,c=a.createUserAttributeChange(t,n,r,i,o,s);c&&(null===(u=e._APIClient)||void 0===u||u.sendEventToServer(c))},this.createUserAttributeChange=function(t,n,r,i,o,a){var s;return void 0===r&&(r=null),n!==r&&(s=e._ServerModel.createEventObject({messageType:me.MessageType.UserAttributeChange,userAttributeChanges:{UserAttributeName:t,New:n,Old:r,Deleted:o,IsNewAttribute:i}},a)),s},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 Oi=r.CCPAPurpose;function Fi(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 a in o)o.hasOwnProperty(a)&&(n=yr.hashConsentPurposeConditionalForwarding("1",a),r[n]=o[a].Consented);var s=i.getCCPAConsentState();s&&(n=yr.hashConsentPurposeConditionalForwarding("2",Oi),r[n]=s.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 a=n instanceof Date;return a&&(n=n.getTime()),(n||a)&&("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 a=e.getCCPAConsentState();a&&(n.ccpa=((t={})[Oi]={},t),"boolean"==typeof a.Consented&&(n.ccpa[Oi].c=a.Consented),"number"==typeof a.Timestamp&&(n.ccpa[Oi].ts=a.Timestamp),"string"==typeof a.ConsentDocument&&(n.ccpa[Oi].d=a.ConsentDocument),"string"==typeof a.Location&&(n.ccpa[Oi].l=a.Location),"string"==typeof a.HardwareId&&(n.ccpa[Oi].h=a.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,Oi)&&r.setCCPAConsentState(n(e.ccpa[Oi])),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 a(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=a(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 s=t.createPrivacyConsent(i.Consented,i.Timestamp,i.ConsentDocument,i.Location,i.HardwareId);return s&&(r[o]=s),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[Oi]=r),this},getCCPAConsentState:function(){return i[Oi]},getGDPRConsentState:function(){return Object.assign({},r)},removeGDPRConsentState:function(e){var t=a(e);return t?(delete r[t],this):this},removeCCPAConsentState:function(){return delete i[Oi],this}}}}var Ui={ScreenView:"screen_view",CustomEvent:"custom_event",Commerce:"commerce",UserAttributes:"user_attributes",UserIdentities:"user_identities",ProductAction:"product_action",PromotionAction:"promotion_action",ProductImpression:"product_impression"},Ni=function(e){return e},Ri=function(e){return p(p({},e),{UserAttributes:{}})},xi=function(e){return p(p({},e),{UserIdentities:[]})},Vi=function(){function e(e,t){var n,r,i,o,a,s,u,c,l,d,p,g,f,v,h,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===(s=null===(a=null===(o=null==e?void 0:e.document)||void 0===o?void 0:o.dtpn)||void 0===a?void 0:a.blok)||void 0===s?void 0:s.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===(h=null===(v=null===(f=null==e?void 0:e.document)||void 0===f?void 0:f.dtpn)||void 0===v?void 0:v.vers)||void 0===h?void 0:h.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)!==Ui.ProductImpression&&(null===(n=null==e?void 0:e.match)||void 0===n?void 0:n.type)!==Ui.ProductAction&&(null===(r=null==e?void 0:e.match)||void 0===r?void 0:r.type)!==Ui.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 Ui.CustomEvent:var n=t;return[Ui.CustomEvent,n.custom_event_type,n.event_name].join(":");case Ui.ScreenView:var r=t;return[Ui.ScreenView,"",r.screen_name].join(":");case Ui.ProductAction:var i=t;return[e.type,i.action].join(":");case Ui.PromotionAction:var o=t;return[e.type,o.action].join(":");case Ui.ProductImpression:var a=t;return[e.type,a.action].join(":");case Ui.UserIdentities:case Ui.UserAttributes:return[e.type].join(":");default:return null}},e.prototype.generateProductAttributeMatchKey=function(e){var t=e.criteria||"";switch(e.type){case Ui.ProductAction:var n=t;return[e.type,n.action,"ProductAttributes"].join(":");case Ui.PromotionAction:var r=t;return[e.type,r.action,"ProductAttributes"].join(":");case Ui.ProductImpression:return[e.type,"ProductAttributes"].join(":");default:return null}},e.prototype.getPlannedProperties=function(e,t){var n,r,i,o,a,s,u,c,l,d;switch(e){case Ui.CustomEvent:case Ui.ScreenView:case Ui.ProductAction:case Ui.PromotionAction:case Ui.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,f=Object.keys(l.properties);g<f.length;g++){p[f[g]]=!0}return p}return!1!==(null===(u=null===(s=null===(a=null==t?void 0:t.definition)||void 0===a?void 0:a.properties)||void 0===s?void 0:s.data)||void 0===u?void 0:u.additionalProperties)||{};case Ui.UserAttributes:case Ui.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,h=0,m=Object.keys(v);h<m.length;h++){p[m[h]]=!0}return p;default:return null}},e.prototype.getProductProperties=function(e,t){var n,r,i,o,a,s,u,c,l,d,p,g,f,v,h,m,y,b,S,I;switch(e){case Ui.ProductImpression:if(!1===(null==(I=null===(d=null===(l=null===(c=null===(u=null===(s=null===(a=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===a?void 0:a.items)||void 0===s?void 0:s.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 Ui.ProductAction:case Ui.PromotionAction:if((I=null===(S=null===(b=null===(y=null===(m=null===(h=null===(v=null===(f=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===f?void 0:f.properties)||void 0===v?void 0:v.product_action)||void 0===h?void 0:h.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,a=i.product_impressions,s=i.promotion_action;o?(r.push(Ui.ProductAction),r.push(o.action)):s?(r.push(Ui.PromotionAction),r.push(s.action)):a&&r.push(Ui.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(Ui.ProductAction),t.push(r.action),t.push("ProductAttributes")):o?(t.push(Ui.PromotionAction),t.push(o.action),t.push("ProductAttributes")):i&&(t.push(Ui.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,Ni)),e&&e.EventDataType===me.MessageType.Commerce&&(e=this.applyBlockingStep("product attributes",this.transformProductAttributes,e,Ni)),e&&(e=this.applyBlockingStep("user attributes",this.transformUserAttributes,e,Ri),e=this.applyBlockingStep("user identities",this.transformUserIdentities,e,xi)),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=Xe(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={},a=0,s=Object.keys(t.EventAttributes);a<s.length;a++){var u=s[a];!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=Xe(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(P(n)&&t.UserAttributes){for(var r={},i=0,o=Object.keys(t.UserAttributes);i<o.length;i++){var a=o[i];!0===n[a]&&(r[a]=t.UserAttributes[a])}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=p({},e);if(this.blockUserIdentities){var r=this.dataPlanMatchLookups.user_identities;P(r)&&(null===(t=null==n?void 0:n.UserIdentities)||void 0===t?void 0:t.length)&&(n.UserIdentities=n.UserIdentities.filter((function(e){var t=me.IdentityType.getIdentityName(C(e.Type));return r[t]})))}return n},e}(),Hi=function(e,t,n,r){var i=e+t+"/config",o=["env=".concat(r?"1":"0")],a=n||{},s=a.planId,u=a.planVersion;return s&&o.push("plan_id=".concat(s)),u&&o.push("plan_version=".concat(u)),"".concat(i,"?").concat(o.join("&"))};function Ki(e,t,n){var r=this,i="https://"+n._Store.SDKConfig.configUrl,o=t.isDevelopmentMode,a=t.dataPlan,s=Hi(i,e,a,o),u=window.fetch?new Hn(s):new Kn(s);this.getSDKConfiguration=function(){return g(r,void 0,void 0,(function(){var e,r,i,o,a,s;return f(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===(a=null==n?void 0:n.Logger)||void 0===a||a.verbose("Issue with receiving configuration from server, received HTTP Code of "+r.statusText),[3,7];case 6:return c.sent(),null===(s=null==n?void 0:n.Logger)||void 0===s||s.error("Error getting forwarder configuration from mParticle servers."),[3,7];case 7:return[2,t]}}))}))}}var qi=r.HTTPCodes,Bi=r.Messages,ji=r.IdentityMethods.Modify;function zi(e){this.sendAliasRequest=function(t,n){return g(this,void 0,void 0,(function(){var r,i,u,c,l,d,p,g,v,h,m,y,b,S;return f(this,(function(f){switch(f.label){case 0:r=e.Logger,i=e._Helpers.invokeAliasCallback,u=e._Store.SDKConfig.aliasUrl,c=e._Store.devToken,r.verbose(Bi.InformationMessages.SendAliasHttp),l="https://".concat(u).concat(c,"/Alias"),d=window.fetch?new Hn(l):new Kn(l),p={method:"post",headers:{Accept:"text/plain;charset=UTF-8","Content-Type":"application/json"},body:JSON.stringify(t)},f.label=1;case 1:return f.trys.push([1,13,,14]),[4,d.upload(p)];case 2:switch(g=f.sent(),v=void 0,h=void 0,S=void 0,g.status){case a:case o:return[3,3];case s:return[3,4]}return[3,11];case 3:return h="Received Alias Response from server: "+JSON.stringify(g.status),[3,12];case 4:if(!g.json)return[3,9];f.label=5;case 5:return f.trys.push([5,7,,8]),[4,g.json()];case 6:return v=f.sent(),[3,8];case 7:return f.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):"",f.label=10;case 10:return(null==(y=v)?void 0:y.message)&&(S=y.message),h="Issue with sending Alias Request to mParticle Servers, received HTTP Code of "+g.status,(null==y?void 0:y.code)&&(h+=" - "+y.code),[3,12];case 11:throw new Error("Received HTTP Code of "+g.status);case 12:return r.verbose(h),i(n,g.status,S),[3,14];case 13:return b=f.sent(),S=ie(b),r.error("Error sending alias request to mParticle servers. "+S),i(n,qi.noHttpCoverage,S),[3,14];case 14:return[2]}}))}))},this.sendIdentityRequest=function(t,n,r,i,c,l,d){var v,h,m,y;return g(this,void 0,void 0,(function(){var g,b,S,I,_,w,P,C,A,k,T,E,D,L,M,O,F,U,N;return f(this,(function(f){switch(f.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(Bi.InformationMessages.SendIdentityBegin),!t)return b.error(Bi.ErrorMessages.APIRequestEmpty),[2];if(b.verbose(Bi.InformationMessages.SendIdentityHttp),e._Store.identityCallInFlight)return g(r,qi.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 Hn(_):new Kn(_),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,f.label=1;case 1:return f.trys.push([1,9,,10]),[4,w.upload(P)];case 2:switch(C=f.sent(),A=void 0,k=void 0,C.status){case a:case o:case s:return[3,3]}return[3,7];case 3:return C.json?[4,C.json()]:[3,5];case 4:return T=f.sent(),A=this.getIdentityResponseFromFetch(C,T),[3,6];case 5:A=this.getIdentityResponseFromXHR(C),f.label=6;case 6:return A.status===s?(E=A.responseText,k="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(", "),k+=" - "+U)):b.isVerbose()&&(D=A.responseText,L=e._Store.SDKConfig.isDevelopmentMode,M=D,!L&&(null==D?void 0:D.matched_identities)&&(M=p(p({},D),{matched_identities:te(D.matched_identities)})),k="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,qi.noHttpCoverage,U),[2];case 8:return e._Store.identityCallInFlight=!1,e._Store.identityCallFailed=!1,k&&b.verbose(k),(null===(h=e._RoktManager)||void 0===h?void 0:h.isInitialized)&&(F=e._Store.identifyRequestCount,e.captureTiming("".concat(F,"-identityRequestEnd"))),c(A,I,r,i,n,d,!1),[3,10];case 9:return O=f.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(O),N="Error sending identity request to servers - "+U,b.error(N),null==S||S.report({message:N,code:jn.IDENTITY_REQUEST,severity:zn.ERROR}),null===(y=e.processQueueOnIdentityFailure)||void 0===y||y.call(e),g(r,qi.noHttpCoverage,U),[3,10];case 10:return[2]}}))}))},this.getUploadUrl=function(t,n){var r=e._Helpers.createServiceUrl(e._Store.SDKConfig.identityUrl);return t===ji?r+n+"/"+t:r+t},this.getIdentityResponseFromFetch=function(e,t){return{status:e.status,responseText:t,cacheMaxAge:parseInt(e.headers.get(nr))||0,expireTimestamp:0}},this.getIdentityResponseFromXHR=function(e){return{status:e.status,responseText:e.responseText?JSON.parse(e.responseText):{},cacheMaxAge:C(e.getResponseHeader(nr)||""),expireTimestamp:0}}}var Qi="passbackconversiontrackingid",Wi=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,this.autoLinkClicksForwarded=!1}return e.prototype.setOnReadyCallback=function(e){this.onReadyCallback=e},e.prototype.init=function(e,t,n,r,i,o,a,s,u,c,l){var d,g,f=e||{},v=f.userAttributeFilters,h=f.settings||{},m=h.placementAttributesMapping,y=h.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=s,this.loggingService=u,this.captureTiming=a,this.integrationCapture=c,this.createFilteredUser=l,null===(g=this.captureTiming)||void 0===g||g.call(this,fe),this.filters={userAttributeFilters:v,filterUserAttributes:yr.filterUserAttributes,filteredUser:t};try{this.placementAttributesMapping=function(e){try{return e?JSON.parse(e.replace(/&quot;/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=Rr(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=zt("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.setAutoLinkClicksForwarded=function(e){this.autoLinkClicksForwarded=e},e.prototype.areAutoLinkClicksForwarded=function(){return this.autoLinkClicksForwarded},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.getCheckoutIntentSelectors=function(){var e=this.kit;return e?e.checkoutIntentSelectors:void 0},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,a,s,u,c,l,d,v,h,m,y,b,S,I;return g(this,void 0,void 0,(function(){var g,_,w,P,C,A,k,T,E,D,L,M,O,F,U,N,R,x,V,H,K,q,B,j,Q=this;return f(this,(function(f){if(null===(t=this.captureTiming)||void 0===t||t.call(this,ge),!this.isReady())return[2,this.deferredCall("selectPlacements",e)];(null===(n=this.store)||void 0===n?void 0:n.identityCallInFlight)&&(null===(r=this.loggingService)||void 0===r||r.log({message:"RoktManager: selectPlacements ran while an identity request was in flight",code:jn.SELECT_PLACEMENTS_IDENTITY_IN_FLIGHT}));try{if(g=e.attributes,_=(null==g?void 0:g.sandbox)||null,w=this.mapPlacementAttributes(g,this.placementAttributesMapping),(null===(i=this.logger)||void 0===i?void 0:i.isVerbose())&&(P=ne(g,null===(a=null===(o=this.store)||void 0===o?void 0:o.SDKConfig)||void 0===a?void 0:a.isDevelopmentMode),this.logger.verbose("mParticle.Rokt selectPlacements called with attributes:\n".concat(JSON.stringify(P,null,2)))),this.currentUser=this.identityService.getCurrentUser(),C=(null===(u=null===(s=this.currentUser)||void 0===s?void 0:s.getUserIdentities())||void 0===u?void 0:u.userIdentities)||{},A=C.email,k=w.email,T=void 0,E=void 0,(D=this.mappedEmailShaIdentityType&&!1!==ue.getIdentityType(this.mappedEmailShaIdentityType))&&(T=C[this.mappedEmailShaIdentityType],E=w.emailsha256||w[this.mappedEmailShaIdentityType]||void 0),L=this.hasIdentityChanged(A,k),M=this.hasIdentityChanged(T,E),O={},L&&(O.email=k,k&&(F="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(F),null===(c=this.errorReporter)||void 0===c||c.report({message:F,code:jn.IDENTITY_MISMATCH,severity:zn.WARNING}))),M&&(O[this.mappedEmailShaIdentityType]=E,F="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(F),null===(l=this.errorReporter)||void 0===l||l.report({message:F,code:jn.IDENTITY_MISMATCH,severity:zn.WARNING})),U=this.toUserAttributes(w),z(O))this.setUserAttributes(this.currentUser,U);else try{this.identityService.identify({userIdentities:p(p({},C),O)},(function(e){var t,n=Number(null==e?void 0:e.httpCode);n&&(n>=400||n<0)&&Q.logger.error("Background identify failed with HTTP "+n),Q.setUserAttributes(null===(t=null==e?void 0:e.getUser)||void 0===t?void 0:t.call(e),U,O)}))}catch(e){this.logger.error("Background identify threw an error: "+ie(e)),this.setUserAttributes(this.identityService.getCurrentUser(),U,O)}return N=this.currentUser&&this.createFilteredUser?this.createFilteredUser(this.currentUser.getMPID()):null,R=(null===(d=null==N?void 0:N.getUserIdentities())||void 0===d?void 0:d.userIdentities)||{},x=null===(h=null===(v=this.store)||void 0===v?void 0:v.getTimeOnSite)||void 0===h?void 0:h.call(v),V=null===(y=null===(m=this.store)||void 0===m?void 0:m.getTotalTimeOnSite)||void 0===y?void 0:y.call(m),(H=p(p(p(p({},w),null!==_?{sandbox:_}:{}),x?{active_time_on_site_ms:x}:{}),V?{total_time_on_site_ms:V}:{})).email||(R.email?H.email=R.email:C.email&&this.logFilteredIdentity("email")),!D||H.emailsha256||H[this.mappedEmailShaIdentityType]||((K=R[this.mappedEmailShaIdentityType])?H.emailsha256=K:C[this.mappedEmailShaIdentityType]&&this.logFilteredIdentity(this.mappedEmailShaIdentityType)),H[Qi]||(null===(b=this.integrationCapture)||void 0===b||b.capture(),q=null===(S=this.integrationCapture)||void 0===S?void 0:S.getClickIdsAsIntegrationAttributes(),(B=null===(I=null==q?void 0:q[Tr.Rokt])||void 0===I?void 0:I[Qi])&&(H[Qi]=B)),this.filters.filteredUser=N||this.filters.filteredUser||null,j=p(p({},e),{attributes:H}),[2,this.kit.selectPlacements(j)]}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,a,s,u,l,d,p,v=this;return f(this,(function(h){switch(h.label){case 0:return h.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 f(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=h.sent(),i={},o=0,a=r;o<a.length;o++)s=a[o],u=s.key,l=s.attributeValue,d=s.hashedValue,i[u]=l,d&&(i["".concat(u,"sha256")]=d);return[2,i];case 2:return p=h.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 f(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 f(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 a={};for(var s in e){if(e.hasOwnProperty(s))a[n[s]||s]=e[s]}return a},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 a=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(a)))}var s=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){s&&s(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 f(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}(),Ji=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}(),$i=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}(),Gi=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}(),Yi="is_auto_button_click",Zi="Auto Button Click",Xi="is_auto_link_click",eo="Auto Link Click",to=function(e,t){for(var n={label_source:e.labelSource,element:e.element,type:e.type,path:Mt(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,group:e.group,link_type:e.linkType,link_domain:e.linkDomain,link_path:e.linkPath,file_extension:e.fileExtension},i=0,o=Object.keys(r);i<o.length;i++){var a=o[i];r[a]&&(n[a]=r[a])}return void 0!==e.checked&&(n.checked=e.checked),n},no=["label_source","element","type","path","label","aria_label","icon","element_id","element_name","test_id","controls","form","group","link_type","link_domain","link_path","file_extension","checked"],ro=function(e,t,n){void 0===n&&(n=!1);var r=e.filteringEventAttributeValue;if(r&&r.eventAttributeValue&&no.some((function(e){return yr.hashAttributeConditionalForwarding(e)===r.eventAttributeName})))return"forwarding rule";var i={hostname:window.location.hostname};i[n?Xi:Yi]=!0;var o={EventName:n?eo:Zi,EventCategory:ae.Other,EventDataType:oe.PageEvent,EventAttributes:i},a=[["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!oi(o,n,t)}));return a?a[0]:void 0},io='button, input[type="submit"], input[type="button"], input[type="image"], [role="button"]',oo='[contenteditable]:not([contenteditable="false"])';function ao(e){var t=K(e.getRootNode)?e.getRootNode():null;return e.assignedSlot||e.parentElement||t&&t.host||null}function so(e,t,n){for(var r=e;r&&r!==n;){if(t(r))return!0;r=ao(r)}return!1}function uo(e,t){return so(e,(function(e){return e.matches(t)}))}var co="[data-core-type], #rokt-controller-frame";function lo(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 po=["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(", "),go="paypal-basic-card-button",fo=po+", "+go,vo=["set-up","add-money","reload","top-up"].map((function(e){return'apple-pay-button[type="'+e+'"]'})).join(", ");function ho(e){var t=e.matches(fo)?e:null;if(!t){var n=K(e.getRootNode)?e.getRootNode():null;t=n&&n.host&&n.host.matches(fo)?n.host:null}if(t)return t.matches(vo)?"none":t.matches(go)?"checkout_step":"wallet"}var mo=/(?:^| )(?:apple ?pay|google ?pay|g ?pay|amazon ?pay|cash ?app|venmo|pay ?pal|shop ?pay|klarna|after ?pay|clear ?pay|sezzle|samsung ?pay)(?= |$)/,yo=/(?:^| )affirm(?= |$)/,bo=/(?:^| )(?:pay|payment|checkout)(?= |$)/,So=/(?:^| )(?:btn|button)(?= |$)/,Io=/(?:^| )(?: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 _o(e){return(e||"").slice(0,64).replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[^A-Za-z0-9]+/g," ").trim().toLowerCase()}function wo(e){return[e.getAttribute("id"),e.getAttribute("data-testid")].map(_o).some((function(e){return(mo.test(e)||yo.test(e)&&bo.test(e))&&So.test(e)&&!Io.test(e)}))}var Po='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]',Co='[role="radiogroup"], [role="tablist"], [role="listbox"]',Ao="klarna-placement, afterpay-placement, square-placement, .affirm-as-low-as, .affirm-site-modal, .affirm-product-modal, [data-pp-message]";function ko(e,t,n){return void 0===n&&(n=!1),!!e.matches(Po)||(!!uo(e,Co)||(!(t||!(!n&&e.hasAttribute("aria-expanded")||e.hasAttribute("aria-pressed")))||uo(e,Ao)))}var To=Po+", "+Co+', input:not([type="hidden"]):not([type="submit"]):not([type="button"]):not([type="image"]), select, textarea, option, optgroup, datalist, [aria-expanded], [aria-pressed], '+oo,Eo=Po+", "+io+", a[href], "+fo+", [aria-expanded], [aria-pressed], "+oo;function Do(e){if(!wo(e)||e.matches(To))return!1;for(var t=ao(e);t;t=ao(t))if(t.matches(Eo)||wo(t))return!1;var n=e.shadowRoot;return!(e.querySelector(To)||n&&n.querySelector(To))}function Lo(e){for(var t,n=e.slice(0,12),r=0,i=n;r<i.length;r++){if((s=i[r])instanceof Element){t=s;break}}if(!t||uo(t,co+", [data-mp-no-track]"))return!0;for(var o=0,a=n;o<a.length;o++){var s;if((s=a[o])instanceof Element&&lo(s))return!0}return!1}function Mo(e,t,n){if(void 0===t&&(t=!1),void 0===n&&(n=12),t||!Lo(e)){for(var r,i,o=!1,a=0,s=e.slice(0,n);a<s.length;a++){var u=s[a];if(r)break;u instanceof Element&&(u.matches(io+", a[href], "+fo)||!o&&Do(u)?r=u:(!i&&u.matches('input[type="checkbox"], input[type="radio"]')&&(i=u),o=o||u.matches(To)))}if(!(!(r=r||i)||r.matches(':disabled, [aria-disabled="true"]')||r.classList.contains("disabled")&&wo(r)))return r}}var Oo='input:not([type="submit"]):not([type="button"]):not([type="image"]):not([type="reset"]):not([type="radio"]):not([type="checkbox"]), textarea, select, '+oo;function Fo(e,t){var n="input, select, textarea, [data-mp-no-track], "+oo;return e.matches("input, select, textarea, option, optgroup, datalist, "+oo)||(t?Array.from(e.querySelectorAll(n)).some((function(e){return e!==t})):!!e.querySelector(n))||uo(e,"select, datalist, textarea, [data-mp-no-track], "+oo)}var Uo=function(){try{return{run:new RegExp("\\p{Nd}{6,}","u"),number:new RegExp("\\p{Nd}+(?:[.,\u060c\u066b\u066c]\\p{Nd}+)*","gu")}}catch(e){return}}(),No=128;function Ro(e){if(e&&!(e.length>No)&&Uo){var t=e.replace(/\s+/g," ").trim().toLowerCase();if(t&&-1===t.indexOf("@")&&!Uo.run.test(t.replace(/[\s()\-\u2010-\u2015]/g,"")))return t.replace(Uo.number,"#").slice(0,64).trim()||void 0}}var xo=/\.(pdf|zip|csv|txt|ics|docx?|xlsx?|pptx?|dmg|exe|apk|mp3|mp4)$/i,Vo='a[href]:not([role="button"]), [role~="link"]:not([role~="button"])';function Ho(e){if("wallet"===ho(t=e)||Do(t))return"wallet";var t,n=e.tagName.toLowerCase();return"button"===n||"input"===n?n:e.matches(Vo)?"link":"role"}var Ko='script, style, template, [hidden], [aria-hidden="true"], [inert]',qo=64;function Bo(e){var t=e;return K(t.assignedNodes)?t.assignedNodes():[]}function jo(e){return!!(e.matches(Ko)||(t=e,n=t.parentElement,n&&(n.shadowRoot?!t.assignedSlot:Bo(n).length>0)))||!(e instanceof SVGTitleElement)&&"none"===window.getComputedStyle(e).display;var t,n}function zo(e){var t=window.getComputedStyle(e).visibility;return"hidden"!==t&&"collapse"!==t}function Qo(e,t){return!so(e,jo,t)}function Wo(e,t){var n=e.assignedSlot;return!!n&&Qo(n,t)}function Jo(e){return!(/\S/.test(e.textContent||"")||e instanceof Element&&(e.matches("slot")||e.querySelector("slot")))}function $o(e){var t="",n=0,r=function(e){t=(t+e).replace(/\s+/g," ")},i=function(e){if(jo(e))return!0;for(var o=Bo(e),a=o.length?o:e.childNodes,s=0;s<a.length;s++){var u=a[s],c=u.nodeType===Node.TEXT_NODE;if(c||u instanceof Element)if(Jo(u))r(u.textContent);else{if(++n>qo)return!1;if(!e.shadowRoot||Wo(u,e)){if(c)zo(u.assignedSlot||e)&&r(u.nodeValue);else if(o.length&&Fo(u)||!i(u))return!1;if(t.trim().length>No)return!1}}}return!0};return i(e)?t.trim():void 0}function Go(e){return e&&!Fo(e)&&Qo(e)?$o(e):""}function Yo(e){for(var t=e.querySelectorAll('img[alt], svg[aria-label], [role="img"][aria-label]'),n=0;n<t.length&&n<qo;n++){var r=Zo(t[n].getAttribute("alt")||t[n].getAttribute("aria-label"));if(r&&Qo(t[n],e)&&zo(t[n]))return r}}function Zo(e){return e&&e.trim()?e:void 0}function Xo(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 Go(n.getElementById?n.getElementById(e):null)}));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=Zo(e.getAttribute("aria-label"));if(i)return{raw:i,source:"aria"};var o=e.children.length<=4&&!Fo(e);if(e instanceof HTMLInputElement){var a=e.type;if("image"===a){if(c=Zo(e.getAttribute("alt")))return{raw:c,source:"alt"}}else if("submit"===a||"button"===a||"reset"===a){var s=Zo(e.value);if(s)return{raw:s,source:"value"};if("button"!==a)return{raw:a,source:"value"}}}else if(o&&Qo(e)){var u,c;if(void 0===(u=$o(e)))return ea(e)||{source:"none"};if(u)return{raw:u,source:"text"};if(c=Yo(e))return{raw:c,source:"alt"}}if(!(e instanceof HTMLInputElement)&&Qo(e)){var l=ea(e);if(l)return l}var d=Zo(e.getAttribute("title"));return d?{raw:d,source:"title"}:{source:"none"}}function ea(e){if(!(Fo(e)||e.shadowRoot||e.querySelector("slot")||-1!==e.tagName.indexOf("-")||Array.from(e.querySelectorAll("*")).some((function(e){return!!e.shadowRoot||-1!==e.tagName.indexOf("-")})))){var t=Go(e.querySelector('h1, h2, h3, h4, h5, h6, [role="heading"]'));return t?{raw:t,source:"heading"}:void 0}}var ta=/^(?:fa|fas|far|fal|icon|bi|glyphicon|ti|mdi|ri|la|lucide|ion|feather|ph)-([a-z][a-z-]{1,31})$/,na=/^(?: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 ra(e){var t=function(e){return!uo(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 a=0,s=[e].concat(Array.from(e.querySelectorAll("i, span, svg"))).filter(t).slice(0,5);a<s.length;a++)for(var u=0,c=(s[a].getAttribute("class")||"").split(/\s+/);u<c.length;u++){var l=c[u],d=ta.exec(l.toLowerCase());if(d&&!na.test(d[1]))return d[1]}}var ia=/^[A-Za-z]+[0-9]{0,3}(?:[-_](?:[A-Za-z]+[0-9]{0,3}|[0-9]{1,3}))*$/;function oa(e){if(e){var t=e.trim(),n=t.replace(/[^0-9]/g,"").length;return t.length<=64&&n<=3&&ia.test(t)?t:void 0}}var aa=/:(?:r[0-9a-v]{1,4}|R[0-9a-v]+(?:H[0-9a-v]+)?):|\u00ab(?:r[0-9a-v]{1,4}|R[0-9a-v]+(?:H[0-9a-v]+)?)\u00bb|_(?:r_[0-9a-v]{1,4}|R_[0-9a-v]+(?:H[0-9a-v]+)?)_/g,sa=/^(?:radix|react-aria|headlessui(?:-[a-z]+)*|mui|chakra|reach|ark|mantine|base-ui)$/i;function ua(e){if(e){var t=e.trim(),n=t.replace(aa,"-"),r=oa(n.replace(/([-_])[-_]+/g,"$1").replace(/^[-_]+|[-_]+$/g,"").replace(/[-_][0-9]{4,}$/,""));return r&&n!==t&&sa.test(r)?void 0:r}}var ca=["data-testid","data-test-id","data-test","data-qa","data-cy"];function la(e,t){for(var n=0,r=t;n<r.length;n++){var i=r[n],o=oa(e.getAttribute(i));if(o)return o}}function da(e){var t=e.getAttribute("aria-controls");return oa(t?t.trim().split(/\s+/)[0]:null)||la(e,["popovertarget","commandfor"])}function pa(e){var t=e instanceof HTMLButtonElement||e instanceof HTMLInputElement?e.form:e.matches(Vo)?null:e.closest("form");return t?oa(t.getAttribute("id")):void 0}var ga=["radio","menuitemradio","checkbox","menuitemcheckbox","switch","option","tab","link"];function fa(e){var t=e.tagName.toLowerCase();if("button"===t||"input"===t)return e.type;if(e.matches('[role~="button"]'))return"button";for(var n=0,r=(e.getAttribute("role")||"").trim().split(/\s+/);n<r.length;n++){var i=r[n];if(-1!==ga.indexOf(i))return i}return"button"}function va(e){var t=e.pathname.split("/").map(It);if(!t.some((function(e){return void 0===e}))){var n=t.join("/");if(!(n.length>No||/[@;=]/.test(n)||ht.test(n))){var r,i=n.split("/"),o=i.map((function(e,t){if(t>0&&e&&yt(wt(i,t),e))return"*";var n=Lt(e,e,t>0?wt(i,t):void 0);return void 0===n?e:n}));return r=o.join("/"),Uo?r.replace(Uo.number,"#"):void 0}}}function ha(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=xo.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",path:va(e)}}}}var ma='input[type="checkbox"], input[type="radio"], [role~="checkbox"], [role~="radio"], [role~="switch"], [role~="menuitemcheckbox"], [role~="menuitemradio"], [role~="option"]',ya='[role~="radio"], [role~="menuitemradio"]';function ba(e){var t=e instanceof HTMLLabelElement?e.control:e;return t&&t.matches(ma)?t:null}function Sa(e){return e instanceof HTMLInputElement?"radio"===e.type:!!e&&e.matches(ya)}function Ia(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?ba(i):null;if(o)return o}return ba(e)||e.querySelector(ma)}var _a='[role="radiogroup"], [role="listbox"], [role="group"], fieldset, [role="region"][aria-label], [role="region"][aria-labelledby]',wa=ma+", "+io+', a[href], input, select, textarea, slot, [aria-haspopup], [role~="button"], [role~="link"], [role~="tab"], [role~="combobox"]',Pa=["radio","menuitemradio","checkbox","menuitemcheckbox","switch","option"];function Ca(e){return e instanceof HTMLInputElement?e.type:(e.getAttribute("role")||"").trim().split(/\s+/).filter((function(e){return-1!==Pa.indexOf(e)}))[0]}function Aa(e,t){if(!(t instanceof HTMLInputElement)){var n='[role="radiogroup"], [role="listbox"]';return!(e instanceof HTMLInputElement)&&Ca(e)===Ca(t)&&e.closest(n)===t.closest(n)}var r=t.getAttribute("name");return e instanceof HTMLInputElement&&e.type===t.type&&!!r&&e.getAttribute("name")===r&&e.form===t.form}function ka(e,t){return so(e,(function(e){return"0"===window.getComputedStyle(e).opacity}),t)}var Ta="svg title, svg desc, svg metadata, svg defs, svg symbol, svg clipPath, svg mask, svg pattern, svg marker, svg linearGradient, svg radialGradient, svg filter, canvas";function Ea(e,t){for(var n=t.closest("details:not([open])");n;){var r=Array.from(n.children).filter((function(e){return"SUMMARY"===e.tagName}))[0];if(!r||!r.contains(e))return!0;n=n.parentElement?n.parentElement.closest("details:not([open])"):null}return!1}function Da(e){var t=e.checkVisibility;return K(t)&&t.call(e,{checkOpacity:!0,checkVisibilityCSS:!0,opacityProperty:!0,visibilityProperty:!0})}function La(e,t){if(Fo(e,t)||uo(t,"[data-mp-no-track]")||e.shadowRoot||-1!==e.tagName.indexOf("-")||e.querySelector("slot"))return!1;var n=e.querySelectorAll("*");if(n.length>qo)return!1;for(var r=0;r<n.length;r++)if(n[r].shadowRoot||-1!==n[r].tagName.indexOf("-"))return!1;var i,o,a=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(r=0;r<qo&&a.nextNode();r++){var s=a.currentNode.parentElement;if(s&&Zo(a.currentNode.nodeValue)&&!s.closest(Ta)&&!Ea(a.currentNode,s)&&Qo(s,e)&&zo(s)&&!ka(s,e)&&Da(s)&&(i=a.currentNode,o=void 0,(o=K(document.createRange)?document.createRange():null)&&K(o.getClientRects)&&(o.selectNodeContents(i),Array.from(o.getClientRects()).some((function(e){return e.width>0&&e.height>0})))))return!0}return!1}function Ma(e,t,n){var r=e instanceof HTMLInputElement&&e.parentElement?e.parentElement.closest(io):null;return!!r&&n.contains(r)&&!r.contains(t)&&Qo(r,n)&&zo(r)&&!ka(r,n)&&La(r,e)}function Oa(e,t,n){return e instanceof HTMLInputElement&&t instanceof HTMLInputElement&&e.type===t.type&&!e.getAttribute("name")&&!t.getAttribute("name")&&e.form===t.form&&e.closest(_a)===n&&t.closest(_a)===n&&Ma(e,t,n)&&Ma(t,e,n)&&function(e){if("FIELDSET"===e.tagName)return function(e){var t=Ra(e);return!(!t||Zo(e.getAttribute("aria-label"))||e.getAttribute("aria-labelledby")&&xa(e)!==t)}(e);return!Zo(e.getAttribute("aria-label"))&&Va(e,xa(e))}(n)}function Fa(e,t,n){return e instanceof HTMLInputElement&&!!e.labels&&!uo(e,"[data-mp-no-track]")&&Array.from(e.labels).some((function(r){return n.contains(r)&&!r.contains(t)&&!uo(r,"[data-mp-no-track]")&&Qo(r,n)&&zo(r)&&!ka(r,n)&&Da(r)&&La(r,e)}))}function Ua(e,t){for(var n=e.querySelectorAll(ma),r=0;r<n.length;r++){var i=n[r];if(!i.contains(t)&&!t.contains(i)&&(Aa(i,t)||Oa(i,t,e))&&(Qo(i,e)&&zo(i)&&(!ka(i,e)||Ma(i,t,e))||Fa(i,t,e)))return!0}return!1}function Na(e){if(!(e instanceof HTMLInputElement)){var t=e.matches('[role~="option"]')?e.closest('[role="listbox"]'):e.matches('[role~="radio"]')?e.closest('[role="radiogroup"]'):null;return t&&Ua(t,e)?Ha(t):void 0}for(var n=e.closest(_a);n;){if(Ua(n,e)){var r=Ha(n);if(r||!n.matches('[role="region"]'))return r}n=n.parentElement?n.parentElement.closest(_a):null}}function Ra(e){return"FIELDSET"===e.tagName?Array.from(e.children).filter((function(e){return"LEGEND"===e.tagName}))[0]:void 0}function xa(e){var t=e.getAttribute("aria-labelledby"),n=K(e.getRootNode)?e.getRootNode():document;return t&&n.getElementById?n.getElementById(t.trim().split(/\s+/)[0]):null}function Va(e,t){return!!t&&e.matches('[role="region"]')&&"tab"===(t.getAttribute("role")||"").trim()&&!uo(t,'[role~="tablist"]')&&!t.querySelector(wa)}function Ha(e){var t=Zo(e.getAttribute("aria-label"));if(!t){var n=e.getAttribute("aria-labelledby"),r=Ra(e),i=K(e.getRootNode)?e.getRootNode():document,o=n?xa(e):r||null,a=n&&Va(e,o)?o:null,s=a?a.querySelector('h1, h2, h3, h4, h5, h6, [role="heading"]'):o,u=s?s.closest("label"):null,c=!!s&&Array.from(e.querySelectorAll(ma)).some((function(e){return function(e,t){var n=e instanceof HTMLInputElement&&e.labels?Array.from(e.labels):[];return(e.getAttribute("aria-labelledby")||"").trim().split(/\s+/).forEach((function(e){var r=e&&t.getElementById?t.getElementById(e):null;r&&n.push(r)})),n}(e,i).some((function(e){return s.contains(e)||e.contains(s)}))}));t=!s||c||so(s,(function(e){return e!==a&&e.matches(wa)}))||s.querySelector(wa)||u&&(u.control||u.querySelector(ma))?void 0:Go(s)}return t?Ro(t.split(":")[0]):void 0}var Ka=/(?:^| )(?:pay|payment\w*|tenders?|gateways?)(?: |$)/,qa='[role="radiogroup"], fieldset';function Ba(e){var t=e.getAttribute("name"),n=t?null:e.closest(qa);return(n?[n.getAttribute("id"),n.getAttribute("name"),n.getAttribute("aria-label")]:[t]).some((function(e){return Ka.test(_o(e))}))}function ja(e){var t=[Ro(Xo(e).raw)];return(e instanceof HTMLInputElement&&e.labels?Array.from(e.labels).slice(0,2):[]).forEach((function(n){Qo(n)&&!Fo(n,e)&&(t.push(Ro($o(n))),t.push(Ro(Yo(n))))})),t}function za(e){return e.filter((function(t,n){return!!t&&e.indexOf(t)===n}))}function Qa(e){return za(ja(e).concat(oa(e.getAttribute("id")),la(e,ca)))}function Wa(e){return e instanceof HTMLInputElement?e.checked:"true"===e.getAttribute("aria-checked")}var Ja="(?:(?:express|guest|quick|secure|complete|one-?page|single-?page|mobile)-)?checkouts?(?:-(?:v\\d+|\\d+|flow|external|process|step(?:-\\d+)?))?",$a=new RegExp("(?:^|\\/)(?:"+Ja+"|payment|order|kasse|paiement|commander?|pago)(?:\\/|$)","i"),Ga=new RegExp("(?:^|\\/)"+Ja+"(?:\\/|$)","i"),Ya=/(?:^|[\/_-])(?:thank[-_]?you|thanks|confirmation|confirmed|receipt|received)(?:[\/_-]|$)|(?:^|[\/_-])(?:complete|completed|success)(?:\/|$)/i,Za=/^register(?: now)?$/,Xa=/(?:^|\/)(?:register|registration|login|log-in|signin|sign-in|signup|sign-up|account|create-account)(?:\/|$)/i,es=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"),ts=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("|")),ns=["(?: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("|"),rs=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|"+ns+")$"),is=new RegExp("^(?:(?:place|submit|complete)(?!(?: [^ ]+){0,2} (?:another|new|next)(?: |$))(?: [^ ]+){0,2} (?:order|purchase)|"+ns+")$"),os=new RegExp("^(?:buy now|purchase|register(?: now)?|complete (?:my |your )?registration|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)$"),as=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("|")+")$"),ss=/^save and continue$/,us="(?:(?:my|your|the) )?(?:shopping )?(?:cart|bag|basket)",cs=new RegExp("^add(?: [^ ]+){0,5} to "+us+"$"),ls=new RegExp("^(?:(?:(?:view|open|go to) )?"+us+"(?: items?)?|items? in "+us+")$"),ds="apple pay|google pay|paypal|venmo|amazon pay|shop pay|klarna|afterpay|clearpay|cash app(?: pay)?|affirm|sezzle|samsung pay",ps=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) (?:"+ds+")(?: express(?: checkout)?| checkout)?|(?:continue|proceed|go) (?:to|with) (?:"+ds+"))$"),gs=new RegExp("^(?:"+ds+")(?: (?:checkout|check out|express(?: checkout)?|express pay|buy now|pay now|pay|now)| (?:logo|icon|mark|button)(?: (?:logo|icon|mark|button))*)?$"),fs=/(?:^| )(?:apple ?pay|google ?pay|g ?pay|android ?pay|venmo|pay ?pal|amazon ?pay|shop ?pay|klarna|after ?pay|clear ?pay|affirm|cash ?app|sezzle|samsung ?pay)(?= |$)/,vs={"pay.google.com":"google_pay","applepay.cdn-apple.com":"apple_pay","payments.amazon.com":"amazon_pay","pay.shopify.com":"shop_pay"},hs=new Set(["www.paypal.com","www.sandbox.paypal.com"]),ms=/^\/smart\/(?:buttons|menu)(?:\/|$)/,ys=/^\/smart\/card-fields?(?:\/|$)/,bs=/^__zoid__paypal_/,Ss=/^__zoid__paypal_(?:buttons|menu)__/,Is=/\/elements-inner-(?:payment-request|express-checkout)-/,_s=/\/elements-inner-card\b/,ws=["adyen.com","braintreegateway.com","cybersource.com","squarecdn.com","checkout.com"],Ps=/[\u2019\u2018]/g,Cs=/[0-9\uFF10-\uFF19$\u20AC\u00A3\u00A5\uFFE5\u20B9\u5186.,\uFF0C]/g,As=/\([^()]*\)|\[[^[\]]*\]|\uFF08[^\uFF08\uFF09]*\uFF09|\uFF3B[^\uFF3B\uFF3D]*\uFF3D|\u3010[^\u3010\u3011]*\u3011/g,ks="[\\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]+",Ts=new RegExp("^"+ks+"|"+ks+"$","g");var Es=/[-_|\xb7\u2022]/g,Ds=/(?:^| )(?:usd|aud|cad|nzd|gbp|eur|chf|sgd|hkd|jpy|inr|mxn)(?= |$)|\b(?:a|au|ca|c|us|nz|hk|s)\$/g,Ls=[[/\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 Os(e){if(e&&!(e.length>128)){var t=e.toLowerCase().replace(Ps,"'").replace(/[&+]/g," and ").replace(Es," ").replace(Ds," ").replace(Cs,"").replace(/\s+/g," ").trim();return Ls.forEach((function(e){var n=e[0],r=e[1];t=t.replace(n,r)})),t.split(" ").length>Ms?void 0:t}}function Fs(e){return e.replace(As," ").replace(/\s+/g," ").replace(Ts,"")||e.replace(Ts,"")}function Us(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||Fo(e)?[e.getAttribute("aria-label")]:[e.getAttribute("aria-label"),e.textContent]}function Ns(e,t){return!!t&&t.some((function(t){try{return e.matches(t)}catch(e){return!1}}))}function Rs(e,t){var n=e instanceof HTMLButtonElement||e instanceof HTMLInputElement?e.form:e.closest("form");return Xa.test(t)||!!n&&Array.prototype.some.call(function(e){var t=Object.getOwnPropertyDescriptor(HTMLFormElement.prototype,"elements");return t&&t.get?t.get.call(e):e.elements}(n),(function(e){return e instanceof HTMLInputElement&&"password"===e.type}))}function xs(e,t,n,r){return t?is.test(e):rs.test(e)||os.test(e)&&"checkout_path"===function(e){return $a.test(e)&&!Ya.test(e)?"checkout_path":"other"}(n)&&!(Za.test(e)&&Rs(r,n))}function Vs(e,t,n){var r=ho(e);if("none"!==r){if(r)return ko(e,"wallet"===r)?void 0:{kind:r,source:"vendor"};if(n&&!ko(e,!1)){if(Ns(e,n.commit))return{kind:"commit",source:"selector"};if(Ns(e,n.checkout_step)){var i=Hs(e,t);return!i||"commit"!==i.kind&&"wallet"!==i.kind&&!0!==i.adds?{kind:"checkout_step",source:"selector"}:i}}return Hs(e,t)}}function Hs(e,t){var n,r=Us(e).map(Os).filter((function(e){return!!e})),i=r.map(Fs),o=function(e,t){var n=t.length?void 0:Os(e.getAttribute("title")),r=n?[Fs(n)]:t;return r.some((function(e){return cs.test(e)}))?"add":(e.hasAttribute("aria-expanded")||e.hasAttribute("aria-haspopup"))&&r.some((function(e){return ls.test(e)}))?"open":void 0}(e,i);if("add"===o?n={kind:"cart",source:"label",adds:!0}:"open"===o&&(n={kind:"cart",source:"label"}),!ko(e,!1,!!n)){if(n&&e.hasAttribute("aria-expanded"))return n;var a=e.matches('a[href]:not([role="button"])');if(i.some((function(n){return xs(n,a,t,e)})))return{kind:"commit",source:"label"};if(r.concat(i).some((function(e){return es.test(e)||ts.test(e)})))return n;if(Do(e))return{kind:"wallet",source:"name"};for(var s=!a&&e.matches(io),u=0,c=i;u<c.length;u++){var l=c[u];if(s&&ps.test(l))return{kind:"wallet",source:"label"};if(s&&gs.test(l))return{kind:"wallet",source:"brand"};if(as.test(l)||s&&ss.test(l)&&Ga.test(t)&&!Ya.test(t)&&!Xa.test(t))return{kind:"checkout_step",source:"label"}}return n}}function Ks(e,t){if("visible"===t.document.visibilityState&&e instanceof HTMLIFrameElement&&!(uo(n=e,co)||lo(n)||uo(e,"[data-mp-no-track]"))){var n;if((!e.src||"about:blank"===e.src)&&bs.test(e.name))return Ss.test(e.name)?{kind:"wallet"}:{kind:"frame"};try{var r=new URL(e.src),i="https:"===r.protocol?r.hostname:"";if(hs.has(i))return ms.test(r.pathname)?{kind:"wallet"}:ys.test(r.pathname)?{kind:"frame",family:"card"}:{kind:"frame"};if(Object.prototype.hasOwnProperty.call(vs,i))return{kind:"wallet",family:vs[i]};if("js.stripe.com"===i)return Is.test(r.pathname)?{kind:"wallet"}:_s.test(r.pathname)?{kind:"frame",family:"card"}:{kind:"frame"};if(ws.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 qs="__mpBtn__",Bs=function(){return"undefined"==typeof window?null:window},js=function(){var e=Bs(),t=e?e[qs]:void 0;return t?t.tracker:void 0},zs=function(){var e=Bs();if(e){var t=js();t&&t.teardown(),e[qs]={}}},Qs="__mpApplePayHook__",Ws=function(e){var t=e.ApplePaySession;return t&&t.prototype},Js={capture:!0,passive:!0},$s={passive:!0},Gs=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.drain=function(){var e=t.pending;t.pending=[],e.forEach((function(e){return e()}))},this.onHide=function(e){"beforeunload"!==e.type&&"pagehide"!==e.type&&"hidden"!==document.visibilityState||t.drain()},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=Bs();if(t){var n=js();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,Js),t.document.addEventListener("submit",this.onEvent,Js),t.addEventListener("blur",this.onEvent,$s),t.addEventListener("pageshow",this.onPageShow,$s),t.addEventListener("beforeunload",this.onHide,Js),t.addEventListener("pagehide",this.onHide,Js),t.document.addEventListener("visibilitychange",this.onHide,Js),this.active=!0,t[qs]||(t[qs]={}),t[qs].tracker=this,this.isKitSuppressed()||function(e){try{var t=Ws(e),n=t&&t.begin;if(!K(n)||n[Qs])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=js();i&&i.onApplePayBegin()}catch(e){}return r};Object.defineProperty(r,Qs,{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=Bs();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[qs];t&&t.tracker===this&&(t.tracker=void 0,function(e){try{var t=Ws(e),n=t&&t.begin;K(n)&&K(n[Qs])&&(t.begin=n[Qs])}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},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,a,s,u,c,l,d,p,g,f,v=Date.now(),h=window.location.pathname,m=!1,y=!1;if("click"===n){var b=K(e.composedPath)?e.composedPath().slice(0,20):[],S=Lo(b),I=(L=S?void 0:Mo(b,!0))||(S?void 0:Mo(b,!0,20)||function(e,t){var n=e.slice(0,t).filter((function(e){return e instanceof Element}));if(!n.some((function(e){return e.matches(':disabled, [aria-disabled="true"]')||e.classList.contains("disabled")&&wo(e)})))for(var r=0,i=n;r<i.length;r++){var o=i[r];if(o.matches('[role~="radio"], [role~="menuitemradio"], [role~="checkbox"], [role~="menuitemcheckbox"], [role~="switch"], [role~="option"], [role~="tab"], [role~="link"]'))return o.matches(Oo)||uo(o,oo)?void 0:o;if(o.matches(Oo))return}}(b,20)),_=!1;if(I){var w=r&&(this.logButtons||I.matches("a[href]")),P=i&&this.logLinks&&!this.linkClicksReachKit(),C=w||P?function(e,t){var n;if(void 0===t&&(t=[]),e.matches('a[href]:not([role="button"])')){if(!(n=ha(e)))return}else e.matches("a[href]")&&(n=ha(e))&&"same_page"===n.type&&(n=void 0);var r=Ho(e),i=e instanceof HTMLInputElement&&("checkbox"===e.type||"radio"===e.type)?e:void 0,o=i||Ia(e,t),a=Sa(o)||!!o&&o.matches('[role~="option"]'),s=a?o instanceof HTMLInputElement&&!o.matches('[role~="option"]')?o:null:e,u=!!o||!n&&"wallet"!==r&&e.matches('[role~="link"]')&&!e.matches(io),c=u?void 0:Xo(e),l=c?Ro(c.raw):void 0;return{label:l,labelSource:l?c.source:"none",ariaLabel:u?void 0:Ro(e.getAttribute("aria-label")),icon:o?void 0:ra(e),elementId:a?void 0:oa(e.getAttribute("id")),elementName:(o?ua:oa)(s&&s.getAttribute("name")),testId:a?void 0:la(e,ca),controls:a?void 0:da(e),form:pa(e),group:o?Na(o):void 0,element:r,type:fa(e),linkType:n?n.type:void 0,linkDomain:n?n.domain:void 0,linkPath:n?n.path:void 0,fileExtension:n?n.fileExtension:void 0,checked:i?i.checked:void 0}}(I,b):void 0,A=this.logLinks&&!!C&&function(e){return!!e.linkType&&"same_page"!==e.linkType}(C);if(_=P&&A,o=w?C:void 0){m=A;var k=this.logButtons&&!m&&!("internal"===o.linkType&&I.matches('a[href]:not([role="button"])'));m||k||(o=void 0)}o&&void 0!==o.checked&&(a=I)}if(L&&!_){var T=i?Vs(L,h,this.checkoutIntentSelectors()):void 0;if(s=T?T.kind:void 0,u=T?T.source:void 0,c=T?T.adds:void 0,l=i?function(e,t){void 0===t&&(t=[]);var n=Ia(e,t);if(Sa(n)&&!uo(n,"[data-mp-no-track]")&&Ba(n)){var r=Qa(n);return r.length?{radio:n,names:r}:void 0}}(L,b):void 0,!(l||"commit"!==s&&"checkout_step"!==s||function(e,t){return(t?[t.label,t.ariaLabel,t.elementId,t.elementName,t.testId]:Us(e).concat(["id","name"].concat(ca).map((function(t){return e.getAttribute(t)})))).some((function(e){return fs.test(function(e){return(e||"").replace(/([a-z])([A-Z])/g,"$1 $2").toLowerCase().replace(/[^a-z]+/g," ").trim()}(e))}))}(L,o))){var E=(g=Array.from(document.querySelectorAll('input[type="radio"]:checked, [role~="radio"][aria-checked="true"], [role~="menuitemradio"][aria-checked="true"]')).filter((function(e){return Wa(e)&&"true"!==e.getAttribute("aria-hidden")&&!uo(e,"[data-mp-no-track]")&&Ba(e)})),f=g.filter((function(e){return!g.some((function(t){return t!==e&&e.contains(t)}))})).map((function(e){var t=za(ja(e)),n=Qa(e);return{radio:e,names:n,option:(t.length?t:n).join("\n")}})),1===new Set(f.map((function(e){return e.option}))).size&&f[0].names.length?{radio:f[0].radio,names:f[0].names}:void 0);d=E?E.names:void 0}}this.lastClick={t:v,excluded:S||_,kind:s,source:u}}else if("submit"===n){var D=e.submitter,L=D?Mo([D]):void 0;if(D){if(L){T=Vs(L,h,this.checkoutIntentSelectors());s=T?T.kind:void 0,u=T?T.source:void 0,c=T?T.adds:void 0}}else s="commit",u="submit";y=!D}var M=this.generation;this.enqueue((function(){if(M===t.generation)try{if("blur"===n){var i=Ks(document.activeElement,window);s=i?i.kind:void 0,p=i?i.family:void 0,u="frame"}else y&&v-t.lastCommitClick>1e3&&(s=void 0);o&&r&&(a&&e.defaultPrevented&&(o.checked="checkbox"===a.type?!o.checked:a.checked),t.logClick(o,h,m)),l&&Wa(l.radio)?t.pickPayment(v,h,l.names):d?t.pickPayment(v,h,d):p&&t.pickPayment(v,h,void 0,p),s&&t.emit(s,u,n,v,h,c)}catch(e){t.log("[error] delivery threw: "+e)}}))}}},e.prototype.logClick=function(e,t,n){this.eventsEnabled()&&!this.hasTargetingOptOut()&&(t!==this.pagePath&&(this.pagePath=t,this.pageEvents=0),this.pageEvents>=100||(this.pageEvents++,this.mpInstance._SessionManager.resetSessionTimer(),this.mpInstance._Events.logEvent(n?function(e,t){var n=to("internal"===e.linkType&&"link"===e.element?p(p({},e),{label:void 0,labelSource:"none",ariaLabel:void 0}):e,t);return n[Xi]=!0,{messageType:oe.PageEvent,name:eo,data:n,eventType:ae.Other}}(e,t):function(e,t){var n=to(e,t);return n[Yi]=!0,{messageType:oe.PageEvent,name:Zi,data:n,eventType:ae.Other}}(e,t))))},e.prototype.emit=function(e,t,n,r,i,o){if(!this.isKitSuppressed()){"commit"===e&&"click"===n&&(this.lastCommitClick=r);var a=o?e+":adds":e,s=this.lastSent[a];s&&s.pathname===i&&r-s.t<2e3||(this.lastSent[a]={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.checkoutIntentSelectors=function(){var e=this.mpInstance._RoktManager;return e?e.getCheckoutIntentSelectors():void 0},e.prototype.linkClicksReachKit=function(){var e=this.mpInstance._RoktManager;return!!e&&e.areAutoLinkClicksForwarded()},e.prototype.log=function(e){this.mpInstance.Logger.verbose("mParticle button tracking: "+e)},e}(),Ys=r.Messages,Zs=r.HTTPCodes,Xs=r.FeatureFlags,eu=r.CaptureIntegrationSpecificIdsV2Modes,tu=Xs.ReportBatching,nu=Xs.CaptureIntegrationSpecificIds,ru=Xs.CaptureIntegrationSpecificIdsV2,iu=Ys.InformationMessages.StartingInitialization;function ou(e){var t=this;this._instanceName=e,this._NativeSdkHelpers=new Ar(this),this._SessionManager=new Or(this),this._Persistence=new Gr(this),this._Helpers=new Ir(this),this._Events=new Zr(this),this._CookieSyncManager=new Er(this),this._ServerModel=new mi(this),this._Ecommerce=new Ur(this),this._ForwardingStatsUploader=new yi(this),this._Consent=new Fi(this),this._IdentityAPIClient=new zi(this),this._preInit={readyQueue:[],integrationDelays:{},forwarderConstructors:[]},this._ErrorReportingDispatcher=new $i,this._LoggingDispatcher=new Gi,this._RoktManager=new Wi(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=Si(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())&&!vr(t._Store)&&(t._preInit.readyQueue=Si(t._preInit.readyQueue,t.Logger))},this.IdentityType=ue,this.EventType=ae,this.CommerceEventType=se,this.PromotionType=de,this.ProductActionType=ce,this.RoktEvents=le,this._Identity=new Mi(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 qr(n),e._ErrorReportingDispatcher.logger=e.Logger,e._LoggingDispatcher.logger=e.Logger,e._Store=new xr(n,e,t),window.mParticle.Store=e._Store,zs(),e.Logger.verbose(iu);var r=Rr(null==n?void 0:n.launcherOptions),i=r.noFunctional,o=r.noTargeting,a=r.doNotShareOrSell;e._CookieConsentManager=new Ji({noFunctional:i,noTargeting:o,doNotShareOrSell:a});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 Ki(e,t,this).getSDKConfiguration().then((function(r){var i=re({},t,r);au(e,i,n)})):au(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(),zs(),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 $i,n._LoggingDispatcher=new Gi,n.Logger=new qr(e),n._ErrorReportingDispatcher.logger=n.Logger,n._LoggingDispatcher.logger=n.Logger,n._Store=new xr(e,n),n._Store.isLocalStorageAvailable=n._Persistence.determineLocalStorageAvailability(window.localStorage),n._Events.stopTracking(),fn(),n._PageViewTracker=void 0,zs(),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())&&!vr(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){su((function(){t.setAppVersion(e)}),t)||(t._Store.SDKConfig.appVersion=e,t._Persistence.update())},this.setDeviceId=function(e){su((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){su((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){su((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){su((function(){t.logBaseEvent(e,n)}),t)||(t._SessionManager.resetSessionTimer(),"string"==typeof e.name?(e.eventType||(e.eventType=ae.Unknown),t._Helpers.canLog()?t._Events.logEvent(e,n):t.Logger.error(Ys.ErrorMessages.LoggingDisabled)):t.Logger.error(Ys.ErrorMessages.EventNameInvalidType))},this.logEvent=function(e,n,r,i,o){su((function(){t.logEvent(e,n,r,i,o)}),t)||(t._SessionManager.resetSessionTimer(),"string"==typeof e?(n||(n=ae.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(Ys.ErrorMessages.LoggingDisabled):t.Logger.error("Invalid event type: "+n+", must be one of: \n"+JSON.stringify(ae))):t.Logger.error(Ys.ErrorMessages.EventNameInvalidType))},this.logError=function(e,n){if(!su((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:ae.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(!su((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(!P(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&&!P(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:ae.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){su((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,a,s,u,c,l){return t._Ecommerce.createProduct(e,n,r,i,o,a,s,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,a){return t._Ecommerce.createTransactionAttributes(e,n,r,i,o,a)},logProductAction:function(e,n,r,i,o,a){su((function(){t.eCommerce.logProductAction(e,n,r,i,o,a)}),t)||(t._SessionManager.resetSessionTimer(),t._Events.logProductActionEvent(e,n,r,i,o,a))},logPurchase:function(e,n,r,i,o){Lr({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(Ys.ErrorMessages.BadLogPurchase):t.ready((function(){t.eCommerce.logPurchase(e,n,r,i,o)}))},logPromotion:function(e,n,r,i,o){su((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){su((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())&&!vr(t._Store))&&su((function(){t.setSessionAttribute(e,n)}),t))return;if(t._Helpers.canLog()){if(!t._Helpers.Validators.isValidAttributeValue(n))return void t.Logger.error(Ys.ErrorMessages.BadAttribute);if(!t._Helpers.Validators.isValidKeyValue(e))return void t.Logger.error(Ys.ErrorMessages.BadKey);if(t._Store.webviewBridgeEnabled)t._NativeSdkHelpers.sendToNative(r.NativeSdkPaths.SetSessionAttribute,JSON.stringify({key:e,value:n}));else{var o=S(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){su((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(!su((function(){t.setIntegrationAttribute(e,n)}),t))if("number"==typeof e){if(null===n)t._Store.integrationAttributes[e]={};else{if(!P(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]?(P(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){su((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 au(e,t,n){var i,o,a,s,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 Vi(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 mr(n,u),n._Forwarders=new gi(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 xn("".concat(e._Store.storageName,"-id-cache"));return new Nn("".concat(e._Store.storageName,"-id-cache"))}(n),ur(n._Identity.idCache),n._Store.webviewBridgeEnabled)n._NativeSdkHelpers.initializeSessionAttributes(e),zs(),n._RoktManager.setAutoButtonClicksForwarded(!1),n._RoktManager.setAutoLinkClicksForwarded(!1);else{n._Persistence.initializeStorage(),n._Store.syncPersistenceData();var f=n.Identity.getCurrentUser(),v=f?f.getMPID():null,h=f?f.getUserIdentities().userIdentities:{};if(n._Store.SDKConfig.identifyRequest=n._Store.hasInvalidIdentifyRequest()?{userIdentities:h}:n._Store.SDKConfig.identifyRequest,c(tu)&&n._ForwardingStatsUploader.startForwardingStatsTimer(),Qe(c)){var m=c(nu),y=c(ru),b=void 0;m||y===eu.All?b="all":y===eu.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 ti(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?ro(S,u):void 0,k=S&&C?ro(S,u,!0):void 0;P&&(A||k)&&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 skips link clicks: the ".concat(k," keeps some or all Auto Link Click events from the Rokt kit.")),n._RoktManager.setAutoButtonClicksForwarded(!!S&&!A),n._RoktManager.setAutoLinkClicksForwarded(!!S&&!k),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 mn(n,{isAutoPageView:!0})),pn()?n.Logger.verbose("mParticle APV: [sdk-init] initial page view already logged this page load, skipping"):(gn(),n._Events.logPageView({isAutoPageView:!0})),n._PageViewTracker.init()):n._PageViewTracker&&n._PageViewTracker.teardown(),P||C?(n._ButtonTracker||(n._ButtonTracker=new Gs(n)),n._ButtonTracker.init({hasRoktKit:!!S,logButtons:P,logLinks:C})):zs(),function(e,t,n,r){!e._Store.identifyCalled&&e._Store.SDKConfig.identityCallback&&t&&n&&e._Store.SDKConfig.identityCallback({httpCode:Zs.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,f,v,h)}(n._Store.mpid&&!n._Store.identifyCalled||n._Store.webviewBridgeEnabled)&&(n._Store.isInitialized=!0,null===(a=n._CookieConsentManager)||void 0===a||a.syncNoTargetingAttribute(n.Identity.getCurrentUser()),n._preInit.readyQueue=Si(n._preInit.readyQueue,n.Logger)),null===(s=n.processQueueOnNoFunctional)||void 0===s||s.call(n),n._Store.isFirstRun&&(n._Store.isFirstRun=!1)}function su(e,t){var n,r,i=(null===(n=t._CookieConsentManager)||void 0===n?void 0:n.getNoFunctional())&&!vr(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 uu=function(){return null},cu=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:uu,parseNumber:uu,isObject:uu,Validators:null},_resetForTests:uu,_APIClient:null,_timeOnSiteTimer:{getTimeInForeground:uu},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:uu},getTotalTimeOnSite:uu},config:null,eCommerce:null,Identity:{getCurrentUser:uu,IdentityAPI:{},identify:uu,login:uu,logout:uu,modify:uu},Logger:{verbose:uu,error:uu,warning:uu},ProductActionType:null,ServerModel:null,addForwarder:uu,generateHash:uu,getAppVersion:uu,getAppName:uu,getInstance:uu,getDeviceId:uu,init:uu,logBaseEvent:uu,logEvent:uu,logLevel:"none",setPosition:uu,upload:uu}},e.prototype.createSDKEventFunction=function(e){return new mi(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}(),lu=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=yr.hashEventType(e);this.filterDictionary.eventTypeFilters.push(t)},e.prototype.addEventNameFilter=function(e,t){var n=yr.hashEventName(t,e);this.filterDictionary.eventNameFilters.push(n)},e.prototype.addEventAttributeFilter=function(e,t,n){var r=yr.hashEventAttributeKey(e,t,n);this.filterDictionary.attributeFilters.push(r)},e.prototype.addScreenNameFilter=function(e){var t=yr.hashEventName(e,ae.Unknown);this.filterDictionary.screenNameFilters.push(t)},e.prototype.addScreenAttributeFilter=function(e,t){var n=yr.hashEventAttributeKey(ae.Unknown,e,t);this.filterDictionary.screenAttributeFilters.push(n)},e.prototype.addUserIdentityFilter=function(e){var t=yr.hashUserIdentity(e);this.filterDictionary.userIdentityFilters.push(t)},e.prototype.addUserAttributeFilter=function(e){var t=yr.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 du=new function(){var e=this;this.Store={},this._instances={},this.IdentityType=ue,this.EventType=ae,this.CommerceEventType=se,this.PromotionType=de,this.ProductActionType=ce,this.RoktEvents=le,this.MPSideloadedKit=lu,"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 ou(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 ou(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,a,s,u,c,l){return e.getInstance().eCommerce.createProduct(t,n,r,i,o,a,s,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,a){return e.getInstance().eCommerce.createTransactionAttributes(t,n,r,i,o,a)},logProductAction:function(t,n,r,i,o,a){e.getInstance().eCommerce.logProductAction(t,n,r,i,o,a)},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=On,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=du,window.mParticle._BatchValidator=new cu),module.exports=du;
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,a,s,u,c,l="",d=0;for(n=t.encode(n);d<n.length;)a=(r=n.charCodeAt(d++))>>2,s=(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(a)+e._keyStr.charAt(s)+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,a,s,u,c="",l=0;for(n=n.replace(/[^A-Za-z0-9\+\/\=]/g,"");l<n.length;)r=e._keyStr.indexOf(n.charAt(l++))<<2|(a=e._keyStr.indexOf(n.charAt(l++)))>>4,i=(15&a)<<4|(s=e._keyStr.indexOf(n.charAt(l++)))>>2,o=(3&s)<<6|(u=e._keyStr.indexOf(n.charAt(l++))),c+=String.fromCharCode(r),64!==s&&(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 a=void 0;r in i&&(a=i[r],e.call(n,a,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),a=o.length>>>0;if("function"!=typeof e)throw new TypeError(e+" is not a function");for(arguments.length>1&&(n=t),r=new Array(a),i=0;i<a;){var s=void 0,u=void 0;i in o&&(s=o[i],u=e.call(n,s,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 a=t[o];e.call(i,a,o,t)&&r.push(a)}return r},isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},Base64:e},r={sdkVersion:"3.32.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,a=202,s=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 a(e){try{u(r.next(e))}catch(e){o(e)}}function s(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(a,s)}u((r=r.apply(e,t||[])).next())}))}function f(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(u){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,r=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){a.label=s[1];break}if(6===s[0]&&a.label<i[1]){a.label=i[1],i=s;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(s);break}i[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,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 h=r.Messages,m=function(e){return k(D(e))},y=function(e){return T(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(h.DeprecationMessages.MethodHasBeenDeprecated):i.push(h.DeprecationMessages.MethodMarkedForDeprecationPostfix),n&&(i.push(h.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},k=function(e){return e.replace(/,/g,"|")},T=function(e){return e.replace(/\|/g,",")},E=function(e){return e.replace(/\'/g,'"')},D=function(e){return e.replace(/\"/g,"'")},L=function(e,t){return e.replace("%%mpid%%",t)},M=function(e){return e.replace(/&amp;/g,"&")},O=function(e,t,n,r,i){var o=M(t),a=n?M(n):null,s=L(o,e),u=a?L(a,e):"",c=s+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," "))},x=function(e){return 0===e.indexOf('"')&&(e=e.slice(1,-1).replace(/\\"/g,'"').replace(/\\\\/g,"\\")),e},V=function(e){return"string"==typeof e},H=function(e){return"number"==typeof e},K=function(e){return"function"==typeof e},q=function(e){return H(e)||V(e)||function(e){return"boolean"==typeof e}(e)},B=function(e){return e===(j(t=e)?t.toString().toLowerCase().replace(/[^0-9a-zA-Z]+/g,"_"):"");var t},j=function(e){return V(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},$=function(e){return J(e)||"prototype"===e},G=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)}}},Z=function(){return"undefined"!=typeof window&&window.location?window.location.href:""},X=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 a=n(o);b(t,a)||(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,a,s,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)$(r)||Object.prototype.hasOwnProperty.call(n,r)&&(i=l[r],l!==(o=n[r])&&(p&&o&&(u.isPlainObject(o)||(a=u.isArray(o)))?(a?(a=!1,s=i&&u.isArray(i)?i:[]):s=i&&u.isPlainObject(i)?i:{},l[r]=re(p,s,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},ae={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 ae.Unknown:return"Unknown";case ae.Navigation:return"Navigation";case ae.Location:return"Location";case ae.Search:return"Search";case ae.Transaction:return"Transaction";case ae.UserContent:return"User Content";case ae.UserPreference:return"User Preference";case ae.Social:return"Social";case se.ProductAddToCart:return"Product Added to Cart";case se.ProductAddToWishlist:return"Product Added to Wishlist";case se.ProductCheckout:return"Product Checkout";case se.ProductCheckoutOption:return"Product Checkout Options";case se.ProductClick:return"Product Click";case se.ProductImpression:return"Product Impression";case se.ProductPurchase:return"Product Purchased";case se.ProductRefund:return"Product Refunded";case se.ProductRemoveFromCart:return"Product Removed From Cart";case se.ProductRemoveFromWishlist:return"Product Removed from Wishlist";case se.ProductViewDetail:return"Product View Details";case se.PromotionClick:return"Promotion Click";case se.PromotionView:return"Promotion View";default:return"Other"}}},se={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",fe="mp:jointSdkRoktKitInit";function ve(e){var t=C(e);return String(t)===e&&ue.isValid(t)?t:null}var he,me={MessageType:oe,EventType:ae,CommerceEventType:se,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"}(he||(he={}));var ye,be,Se,Ie,_e,we,Pe,Ce,Ae,ke,Te,Ee,De,Le,Me,Oe,Fe,Ue,Ne,Re="none",xe="verbose",Ve="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",(ke=ye.EventTypeEnum||(ye.EventTypeEnum={})).unknown="unknown",ke.sessionStart="session_start",ke.sessionEnd="session_end",ke.screenView="screen_view",ke.customEvent="custom_event",ke.crashReport="crash_report",ke.optOut="opt_out",ke.firstRun="first_run",ke.preAttribution="pre_attribution",ke.pushRegistration="push_registration",ke.applicationStateTransition="application_state_transition",ke.pushMessage="push_message",ke.networkPerformance="network_performance",ke.breadcrumb="breadcrumb",ke.profile="profile",ke.pushReaction="push_reaction",ke.commerceEvent="commerce_event",ke.userAttributeChange="user_attribute_change",ke.userIdentityChange="user_identity_change",ke.uninstall="uninstall",ke.validationResult="validation_result",(Te=ye.IdentityTypeEnum||(ye.IdentityTypeEnum={})).other="other",Te.customerId="customer_id",Te.facebook="facebook",Te.twitter="twitter",Te.google="google",Te.microsoft="microsoft",Te.yahoo="yahoo",Te.email="email",Te.alias="alias",Te.facebookCustomAudienceId="facebook_custom_audience_id",Te.otherId2="other_id_2",Te.otherId3="other_id_3",Te.otherId4="other_id_4",Te.otherId5="other_id_5",Te.otherId6="other_id_6",Te.otherId7="other_id_7",Te.otherId8="other_id_8",Te.otherId9="other_id_9",Te.otherId10="other_id_10",Te.mobileNumber="mobile_number",Te.phoneNumber2="phone_number_2",Te.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",(Le=ye.PromotionActionActionEnum||(ye.PromotionActionActionEnum={})).view="view",Le.click="click",(ye.PushMessageEventEventTypeEnum||(ye.PushMessageEventEventTypeEnum={})).pushMessage="push_message",(Me=ye.PushMessageEventDataPushMessageTypeEnum||(ye.PushMessageEventDataPushMessageTypeEnum={})).sent="sent",Me.received="received",Me.action="action",(Oe=ye.PushMessageEventDataApplicationStateEnum||(ye.PushMessageEventDataApplicationStateEnum={})).notRunning="not_running",Oe.background="background",Oe.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",qe="partner_identities",Be="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:qe},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:Be,moduleId:1277},rclid:{mappedKey:"passbackconversiontrackingid",output:Be,moduleId:1277},RoktTransactionId:{mappedKey:"passbackconversiontrackingid",output:Be,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(qe),this.filteredCustomFlagMappings=this.filterMappings(Ke),this.filteredIntegrationAttributeMappings=this.filterMappings(Be)}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("="),a=o[0],s=o[1];t&&!t.includes(a)||(n[a]=s)}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,Z(),this.initialTimestamp)},e.prototype.captureQueryParams=function(){var e=this.getQueryParams();return this.applyProcessors(e,Z(),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,Z(),this.initialTimestamp)},e.prototype.getQueryParams=function(){var e=this.getAllowedKeysForMode();return G(Z(),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],a=null===(t=this.filteredIntegrationAttributeMappings[i])||void 0===t?void 0:t.mappedKey;if(!z(a)){var s=null===(n=this.filteredIntegrationAttributeMappings[i])||void 0===n?void 0:n.moduleId;s&&!r[s]&&(r[s]=((e={})[a]=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],a=null===(n=t[i])||void 0===n?void 0:n.mappedKey;z(a)||(r[a]=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 a=o[i],s=[];for(var u in a){var c=n(u);-1!==r.indexOf(c)?delete a[u]:z(a[u])||s.push(c)}r.push.apply(r,s)}},e.prototype.applyProcessors=function(e,t,n){var r,i={},o=this.getActiveIntegrationMapping();for(var a in e)if(e.hasOwnProperty(a)){var s=e[a],u=null===(r=o[a])||void 0===r?void 0:r.processor;i[a]=u?u(s,t,n):s}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(),a=[],s=null,u=0,c=t;u<c.length;u++){var l=c[u];if(l){s=l;var d=Xe(l);d&&a.push(d)}}if(!s)return null;var p=null;z(s.ConsentState)?z(o)||(p=o.getConsentState()):p=s.ConsentState;var g={source_request_id:n._Helpers.generateUniqueId(),mpid:e,timestamp_unixtime_ms:(new Date).getTime(),environment:s.Debug?He.BatchEnvironmentEnum.development:He.BatchEnvironmentEnum.production,events:a,mp_deviceid:s.DeviceId,sdk_version:s.SDKVersion,application_info:{application_version:s.AppVersion,application_name:s.AppName,package:s.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:s.UserAttributes,user_identities:Ze(s.UserIdentities),consent_state:$e(p),integration_attributes:s.IntegrationAttributes};if(s.DataPlan&&s.DataPlan.PlanId&&(g.context={data_plan:{plan_id:s.DataPlan.PlanId,plan_version:s.DataPlan.PlanVersion||void 0}}),Qe(i)){null==r||r.capture();var f=null==r?void 0:r.getClickIdsAsPartnerIdentities();z(f)||(g.partner_identities=f)}return g}function $e(e){return z(e)?null:{gdpr:Ge(e.getGDPRConsentState()),ccpa:Ye(e.getCCPAConsentState())}}function Ge(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 Ze(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 Xe(e){if(!e)return null;switch(e.EventDataType){case me.MessageType.AppStateTransition:return function(e){var t=st(e),n=He.ApplicationStateTransitionEventDataApplicationTransitionTypeEnum,r=n.applicationBackground,i=n.applicationInitialized,o=e.IsBackgroundAST?r:i,a={application_transition_type:o,is_first_run:e.IsFirstRun,is_upgrade:!1,launch_referral:e.LaunchReferral};return a=Object.assign(a,t),{event_type:He.EventTypeEnum.applicationStateTransition,data:a}}(e);case me.MessageType.Commerce:return function(e){var t=st(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=st(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=st(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=st(e),n={custom_event_type:at(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=st(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=st(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=st(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=st(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=st(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 he.AddToCart:return He.ProductActionActionEnum.addToCart;case he.AddToWishlist:return He.ProductActionActionEnum.addToWishlist;case he.Checkout:return He.ProductActionActionEnum.checkout;case he.CheckoutOption:return He.ProductActionActionEnum.checkoutOption;case he.Click:return He.ProductActionActionEnum.click;case he.Purchase:return He.ProductActionActionEnum.purchase;case he.Refund:return He.ProductActionActionEnum.refund;case he.RemoveFromCart:return He.ProductActionActionEnum.removeFromCart;case he.RemoveFromWishlist:return He.ProductActionActionEnum.removeFromWishlist;case he.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 at(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 st(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=/^(?=[^0-9]*[0-9])(?=[^A-Za-z]*[A-Za-z])[A-Za-z0-9]{6,}$/,dt=/^(?=[A-Za-z]{8,}$)(?:[^a-z]*[a-z]+[A-Z]){3}/,pt=/^(?:u|user|users|profile|profiles|member|members|people|reset|reset-password|password|verify|verification|confirm|activate|invite|invitation|token|unsubscribe|magic-link)$/i,gt=/(?:^|[-_])orders?(?:[-_]|$)/i,ft=/^(?:(?:pre|on|back)[-_]|made[-_]to[-_])orders?$/i,vt=/;|%(?:25)*3B/i,ht=/%[0-9A-F]{2}/i,mt=/^(?:log-?in|log-?out|sign-?in|sign-?out|sign-?up|register|registration|create-account|account|settings|forgot-password|reset-password|password|challenge|consent|callback|authorize|continue|mfa(?:-[a-z]+)*)$/i;function yt(e,t){return bt(e)&&!(pt.test(e)&&mt.test(t))}function bt(e){return pt.test(e)||gt.test(e)&&!ft.test(e)}var St=5;function It(e){for(var t=e,n=0;n<St;n++){var r=void 0;try{r=decodeURIComponent(t)}catch(e){return 0===n?void 0:t}if(r===t)return t;t=r}return t}function _t(e){for(var t=e,n=0;n<St;n++){var r=t.split(vt)[0],i=void 0;try{i=decodeURIComponent(r)}catch(e){return 0===n?void 0:r.split("/").pop()}if(i===r)return r.split("/").pop();t=i}}function wt(e,t){for(var n=t-1;n>0&&""===e[n];)n--;return e[n]}var Pt=/[a-z][A-Z]/,Ct=function(e){return lt.test(e)||dt.test(e)},At=function(e){return/[0-9]/.test(e)&&/[A-Za-z]/.test(e)};function kt(e){var t=e.replace(/\+/g,"").split(/[-_.~]/),n=t.join("");return t.some(Ct)||t.some((function(e){return Pt.test(e)}))&&Ct(n)||t.filter(At).length>=2&&lt.test(n)}var Tt=function(e){return/^(?:[a-z]{3,}|[A-Z][a-z]{2,})$/.test(e)},Et=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/i,Dt=/^(?:p|product|products|item|items|dp|shop|catalog)$/i;function Lt(e,t,n){if(kt(t)){if(!n||!Dt.test(n)||Et.test(t))return"*";for(var r=e.split(/([-_.~])/),i=r.filter((function(e,t){return t%2==0})),o=r.filter((function(e,t){return t%2==1})),a=i.map((function(e){return It(e)})).map((function(e){if(void 0===e||/[-_.~]/.test(e))return"token";var t=e.replace(/\+/g,"");return Ct(t)||At(t)||Pt.test(t)?"token":Tt(t)?"word":"other"})),s=a.map((function(){return!1})),u=0;u<a.length;)if("word"!==a[u]){for(var c=u;c<a.length&&"word"!==a[c];)c++;if(-1!==a.slice(u,c).indexOf("token")||Ct(i.slice(u,c).join("")))for(var l=u;l<c;l++)s[l]=!0;u=c}else u++;if(-1===s.indexOf(!0)||-1===a.indexOf("word"))return"*";var d="";for(l=0;l<i.length;l++)s[l]&&l>0&&s[l-1]||(d+=(l>0?o[l-1]:"")+(s[l]?"*":i[l]));return d}}function Mt(e){var t=e.split("/");return t.map((function(e,n){var r=It(e),i=n>0?_t(wt(t,n)):"",o=n>0&&!!r&&(void 0===i||yt(i,r));if(void 0===r||/[@;=/]/.test(r)||ht.test(r)||o)return"*";var a=Lt(e,r,i);return void 0===a?e:a})).join("/")}var Ot=/^(?=[^0-9]*[0-9])(?=[^A-Za-z]*[A-Za-z])[A-Za-z0-9]{16,}$/,Ft=/^(?=[A-Za-z]{16,}$)(?:[^a-z]*[a-z]+[A-Z]){3}/,Ut=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Nt(e){var t=e.split("/");return t.map((function(e,n){var r=It(e),i=n>0?_t(wt(t,n)):"",o=!!r&&(/[0-9]/.test(r)||kt(r)),a=n>0&&!!r&&(void 0===i||bt(i)&&o);return void 0===r||/[@;=/]/.test(r)||ht.test(r)||function(e){var t=e.replace(/\+/g,"").split(/[-_.~]/);return Ut.test(e)||t.some((function(e){return Ot.test(e)||Ft.test(e)}))||t.filter(At).length>=2&&Ot.test(t.join(""))}(r)||a?"*":e})).join("/")}var Rt,xt=["pushState","replaceState"],Vt="__mpApvWrapped__",Ht=function(e){return!!e&&void 0!==e.history&&"function"==typeof e.history.pushState&&"function"==typeof e.addEventListener},Kt="__mpRouteMonitor__",qt=function(){var e=window;return e[Kt]||(e[Kt]={listeners:{},undoHistoryPatch:null,popStateListener:null}),e[Kt]},Bt=function(e){Object.values(qt().listeners).forEach((function(t){try{t(e)}catch(e){}}))},jt=function(e,t){e.undoHistoryPatch||e.popStateListener||(e.undoHistoryPatch=function(e,t){if(window.history.pushState[Vt])return t("[patch] history already wrapped, skipping to avoid double-wrap \u2014 STACKED WRAPPER DETECTED"),null;var n={},r={};xt.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,Vt,{value:!0,enumerable:!1}),r[t]=o}));var i=function(){return xt.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{xt.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}(Bt,t),e.popStateListener=function(){return Bt("popstate")},window.addEventListener("popstate",e.popStateListener))},zt=function(e,t,n){if(void 0===n&&(n=function(){}),!Ht("undefined"==typeof window?null:window))return function(){};var r=qt();return r.listeners[e]=t,jt(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))}},Qt="__mpApv__",Wt=["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"],Jt="is_auto_page_view",$t=["hostname","title","path",Jt].concat(["constructor","__proto__","prototype"],["true","false"]),Gt=Wt.map((function(e){return e.toLowerCase()})),Yt=function(e){return-1!==Gt.indexOf(e.toLowerCase())},Zt=/^[a-z0-9_][a-z0-9_.-]{0,63}$/,Xt=["dwvar_"],en=function(e){return Xt.some((function(t){return 0===e.indexOf(t)}))},tn=function(e){var t=[],n=[],r=0;return e?((Array.isArray(e)?e:String(e).split(",")).forEach((function(e,i){var o=i+1,a=String(e).trim().toLowerCase();a&&(Zt.test(a)&&-1===$t.indexOf(a)?Yt(a)||-1!==t.indexOf(a)||(t.length>=25?r++:t.push(a)):n.push(o))})),{allowed:t,rejectedPositions:n,overLimit:r}):{allowed:t,rejectedPositions:n,overLimit:r}},nn=function(e,t){return e<t?-1:e>t?1:0},rn=function(e,t){void 0===t&&(t=[]);var n=function(e){return void 0===e&&(e=[]),Wt.concat(e.filter((function(e){return!Yt(e)})).sort(nn))}(t),r=G(e,n);return n.filter((function(e){return W(r,e)})).filter((function(e){return function(e,t){return Yt(e)||t.length<=512}(e,r[e])})).map((function(e){return{name:e,value:r[e]}})).concat(function(e,t){var n=G(e);return Object.keys(n).filter((function(e){return en(e)&&n[e]&&-1===t.indexOf(e)})).sort(nn).map((function(e){return{name:e,value:n[e]}}))}(e,n))},on=function(e){var t={};return e.forEach((function(e){var n=e.name,r=e.value;t[n]=r})),t},an=function(e){var t;return e?((t={})[Jt]=!0,t):{}},sn=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},un=function(){return"undefined"==typeof window?null:window},cn=function(){var e=un();return e?e[Qt]:void 0},ln=function(){var e=un();return e?(e[Qt]||(e[Qt]={initialPageViewFired:!1}),e[Qt]):null},dn=function(){var e=cn();return e?e.tracker:void 0},pn=function(){var e=cn();return!(!e||!e.initialPageViewFired)},gn=function(){var e=ln();e&&(e.initialPageViewFired=!0)},fn=function(){var e=un();if(e){var t=dn();t&&t.teardown(),e[Qt]={initialPageViewFired:!1}}},vn=function(e){return{path:window.location.pathname,params:rn(Z(),e)}},hn=function(e){if(!e)return"";var t=e.params.map((function(e){return e.name})),n=Mt(e.path);return t.length?"".concat(n," (params: ").concat(t.join(),")"):n},mn=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"),Ht(un())){var t,n,r=dn(),i=this.retire(r);this.active&&r!==this&&(i=i.concat(this.retire(this))),this.active=!0,this.customQueryParams=this.readCustomQueryParams(),this.lastPage=vn(this.customQueryParams),this.log("[init] seeded lastPage: ".concat(hn(this.lastPage))),this.undoHistoryPatch=zt("pageView",(function(t){return e.safeHandleNavigation(t)}),(function(t){return e.log(t)})),t=this,(n=ln())&&(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=cn())&&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,a=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(", "))),a&&this.mpInstance.Logger.warning("mParticle APV: ignoring ".concat(a," 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=vn(this.customQueryParams),n=this.lastPage?sn(this.lastPage):null;this.log("[detect] navigation signal (source: ".concat(e,", candidate: ").concat(hn(t),", last: ").concat(hn(this.lastPage),")")),function(e,t){return t!==e}(n,sn(t))?(this.log("[accept] page changed, scheduling fire (source: ".concat(e,", from: ").concat(hn(this.lastPage),", to: ").concat(hn(t),")")),this.lastPage=t,this.scheduleFire(t)):this.log("[dedupe] page unchanged, skipping (source: ".concat(e,", page: ").concat(hn(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({},on(t)),{hostname:n,title:r,path:Nt(i)}),an(o)),eventType:ae.Unknown}}(p(p({},e),{hostname:window.location.hostname,title:t,isAutoPageView:this.isAutoPageView}));this.log("[fire] deferred flush -> _Events.logEvent(PageView) (page: ".concat(hn(e),")")),this.mpInstance._Events.logEvent(n)},e.prototype.log=function(e){this.mpInstance.Logger.verbose("mParticle APV: ".concat(e))},e}(),yn="path",bn="full",Sn="report",In=["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()})),_n=function(e){return function(e){return Yt(e)||en(e.toLowerCase())}(e)||-1!==In.indexOf(e.toLowerCase())},wn=["client_id","redirect_uri","response_type","scope","state","code","nonce"],Pn=wn.concat(["access_token","id_token","refresh_token","provider_token","provider_refresh_token"]),Cn=["ref","referrer"],An=/^((?:[a-z][a-z0-9+.-]*:)?\/\/)[^/]*@/i,kn=/^(?:[a-z][a-z0-9+.-]*:)?\/\/[^/]*/i,Tn=function(e){var t=/^#!?/.exec(e)[0],n=e.indexOf("&"),r=-1===n?e.length:n,i=e.slice(r).split("&").slice(1).filter(Mn).map((function(e){return"&".concat(e)})).join("");return t+Nt(e.slice(t.length,r))+i},En=function(e){return decodeURIComponent(e.replace(/\+/g," "))},Dn=function(e){var t,n=e.indexOf("="),r=-1===n?e:e.slice(0,n);try{t=En(r)}catch(e){return null}var i,o=t.toLowerCase();if(!t||!_n(t)||-1!==wn.indexOf(o))return null;if(-1===n||-1===Cn.indexOf(o))return e;try{i=En(e.slice(n+1))}catch(e){return null}var a=On(i,yn);return a===i?e:"".concat(r,"=").concat(encodeURIComponent(a))},Ln=function(e){return e.split("&").map(Dn).filter((function(e){return null!==e})).join("&")},Mn=function(e){try{var t=En(e.split("=")[0]);return-1===Pn.indexOf(t.toLowerCase())}catch(e){return!1}},On=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("?"),a=function(e,t){void 0===t&&(t=Nt);var n=kn.exec(e);return n?n[0]+t(e.slice(n[0].length)):"/"===e.charAt(0)?t(e):e}((-1===o?i:i.slice(0,o)).replace(An,"$1"),t===Sn?Mt:Nt);if(t!==bn)return a;var s=-1===o?"":Ln(i.slice(o+1));return a+(s?"?".concat(s):"")+function(e){var t=e.indexOf("?"),n=-1===t?e:e.slice(0,t),r=/^#!|^#[^?&=]*\//.test(e);if((r||-1!==t&&-1===n.indexOf("="))&&-1!==t){var i=Ln(e.slice(t+1));return Tn(n)+(i?"?".concat(i):"")}if(-1===e.indexOf("="))return r?Tn(e):e;var o=e.slice(1).split("&").map((function(e,t){return 0===t&&r?Tn("#".concat(e)).slice(1):e})).filter(Mn).join("&");return o?"#".concat(o):""}(r)},Fn=function(){return On(Z(),bn)};!function(e){e.Success="Success",e.QuotaExceeded="QuotaExceeded",e.Unavailable="Unavailable"}(Rt||(Rt={}));var Un=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,Rt.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)?Rt.QuotaExceeded:Rt.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}(),Nn=function(e){function t(t){return e.call(this,t,window.localStorage)||this}return d(t,e),t}(Un),Rn=function(e){function t(t){return e.call(this,t,window.sessionStorage)||this}return d(t,e),t}(Un),xn=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,Rt.Success},t.prototype.retrieve=function(){return this.contents},t.prototype.purge=function(){this.contents=null},t}(Un),Vn=function(e){this.url=e},Hn=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 f(this,(function(r){switch(r.label){case 0:return n=t||this.url,[4,fetch(n,e)];case 1:return[2,r.sent()]}}))}))},t}(Vn),Kn=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 f(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 f(this,(function(o){return i=new XMLHttpRequest,[2,new Promise((function(o,a){for(var s in i.onreadystatechange=function(){4===i.readyState&&o(i)},i.onerror=function(){a(i)},i.open(n,e),r)r.hasOwnProperty(s)&&i.setRequestHeader(s,r[s]);i.send(t)}))]}))}))},t}(Vn);function qn(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 a=[];if(P(r)&&Object.keys(r).length)for(var s in r){var u={};u.Identity=r[s],u.Type=C(s),a.push(u)}t.UserIdentities=a}}}var Bn=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 a=null===(i=t._CookieConsentManager)||void 0===i?void 0:i.getNoFunctional();this.offlineStorageEnabled&&!a&&(this.eventVault=new Rn("".concat(t._Store.storageName,"-events")),this.batchVault=new Nn("".concat(t._Store.storageName,"-batches")),(r=this.eventsQueuedForProcessing).push.apply(r,null!==(o=this.eventVault.retrieve())&&void 0!==o?o:[]));var s=this.mpInstance._Store,u=s.SDKConfig,c=s.devToken,l=this.mpInstance._Helpers.createServiceUrl(u.v3SecureServiceUrl,c);this.uploadUrl="".concat(l,"/events"),this.uploader=window.fetch?new Hn(this.uploadUrl):new Kn(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,a=n._timeOnSiteTimer,s=n._Helpers,u=i.sessionId,c=i.deviceId,l=i.sessionStartDate,d=i.SDKConfig,g=s.generateUniqueId,f=s.getFeatureFlag,v=o.getCurrentUser,h={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==a?void 0:a.getTimeInForeground())||0,TotalTimeOnSite:(null===(e=i.getTotalTimeOnSite)||void 0===e?void 0:e.call(i))||0,PageUrl:Fn()||null,IsBackgroundAST:!0},m=p({},h.CustomFlags),y=i.integrationAttributes;if(Qe(f)){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 h.CustomFlags=m,h.IntegrationAttributes=y,qn(v(),h),h},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,a=e;o<a.length;o++){if(!(h=a[o]).MPID){var s=t.getMPID();h.MPID=s}(v=i.get(h.MPID))||(v=[]),v.push(h),i.set(h.MPID,v)}for(var u=0,c=Array.from(i.entries());u<c.length;u++){for(var l=c[u],d=(s=l[0],l[1]),p=new Map,g=0,f=d;g<f.length;g++){var v,h=f[g];(v=p.get(h.SessionId))||(v=[]),v.push(h),p.set(h.SessionId,v)}for(var m=0,y=Array.from(p.entries());m<y.length;m++){var b=Je(s,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,a,s,u,c,l,d,p,g=this;return f(this,(function(f){switch(f.label){case 0:return i=this.mpInstance.Identity.getCurrentUser(),o=this.eventsQueuedForProcessing,this.eventsQueuedForProcessing=[],this.offlineStorageEnabled&&this.eventVault&&this.eventVault.store([]),a=[],z(o)||(a=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(a)||(d=this.batchesQueuedForProcessing).push.apply(d,a),s=this.batchesQueuedForProcessing,this.batchesQueuedForProcessing=[],s.forEach((function(e){g.batchOrder.has(e.source_request_id)||g.batchOrder.set(e.source_request_id,g.nextBatchOrder++)})),[4,this.uploadBatches(s,n)];case 1:return u=f.sent(),c=(u||[]).map((function(e){return e.source_request_id})),s.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),!this.offlineStorageEnabled||!this.batchVault||n&&z(u)||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===Rt.Success)return this.logDroppedOfflineBatches(i),void(this.batchesQueuedForProcessing=[]);if(o===Rt.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,a,s,u,c,l;return f(this,(function(d){switch(d.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=[],a=0,d.label=1;case 1:return a<r.length?(s={method:"POST",headers:{Accept:e.CONTENT_TYPE,"Content-Type":"text/plain;charset=UTF-8"},body:JSON.stringify(r[a])},n&&this.isBeaconAvailable()?(u=new Blob([s.body],{type:"text/plain;charset=UTF-8"}),!1===navigator.sendBeacon(this.uploadUrl,u)&&o.push(r[a]),[3,5]):[3,2]):[3,6];case 2:return d.trys.push([2,4,,5]),[4,this.uploader.upload(s)];case 3:if(!((c=d.sent()).status>=200&&c.status<300)){if(c.status>=500||429===c.status)return this.mpInstance.Logger.error("HTTP error status ".concat(c.status," received")),[2,r.slice(a,r.length)];if(c.status>=401)return this.mpInstance.Logger.error("HTTP error status ".concat(c.status," while uploading - please verify your API key.")),[2,null];throw console.error("HTTP error status ".concat(c.status," while uploading events."),c),new Error("Uncaught HTTP Error ".concat(c.status,". Batch upload will be re-attempted."))}return this.mpInstance.Logger.verbose("Upload success for request ID: ".concat(r[a].source_request_id)),[3,5];case 4:return l=d.sent(),this.mpInstance.Logger.error("Error sending event to mParticle servers. ".concat(l)),[2,r.slice(a,r.length)];case 5:return a++,[3,1];case 6:return z(o)?[2,null]:(this.mpInstance.Logger.warning("The browser refused the exit upload of ".concat(o.length," batch(es). Keeping them for the next upload.")),[2,o])}}))}))},e.CONTENT_TYPE="text/plain;charset=UTF-8",e.MINIMUM_INTERVAL_MILLIS=500,e}(),jn={UNKNOWN_ERROR:"UNKNOWN_ERROR",UNHANDLED_EXCEPTION:"UNHANDLED_EXCEPTION",IDENTITY_REQUEST:"IDENTITY_REQUEST",IDENTITY_MISMATCH:"IDENTITY_MISMATCH",MP_DEPRECATED_METHOD_USAGE:"MP_DEPRECATED_METHOD_USAGE",SELECT_PLACEMENTS_IDENTITY_IN_FLIGHT:"SELECT_PLACEMENTS_IDENTITY_IN_FLIGHT"},zn={ERROR:"ERROR",INFO:"INFO",WARNING:"WARNING"},Qn=r.IdentityMethods.Modify,Wn={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===Qn&&(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&&!Wn.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}}},Jn=r.HTTPCodes,$n=r.IdentityMethods,Gn=$n.Identify,Yn=$n.Modify,Zn=$n.Login,Xn=$n.Logout,er=r.HTTPCodes,tr=r.Messages,nr="x-mp-max-age",rr=function(e,t,n,r,i){if(!i){var o=lr(null==r?void 0:r.cacheMaxAge);switch(e){case Zn:case Gn:ir(e,t,o,n,r);break;case Yn:case Xn:n.purge()}}},ir=function(e,t,n,r,i){var o=i.responseText,a=i.status,s=r.retrieve()||{},u=_(or(e,t)),c={mpid:o.mpid,is_logged_in:o.is_logged_in};s[u]={responseText:JSON.stringify(c),status:a,expireTimestamp:n},r.store(s)},or=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 a in t)a!==n&&(o[me.IdentityType.getIdentityType(a)]=t[a]);i=o.reduce((function(e,t,n){var r=me.IdentityType.getIdentityName(n);return"".concat(e).concat(r,"=").concat(t,";")}),r)}return i},ar=function(e,t,n){var r=_(or(e,t)),i=n.retrieve(),o=i?i[r]:null;return{responseText:dr(o.responseText),expireTimestamp:o.expireTimestamp,status:o.status}},sr=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},ur=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)},cr=function(e,t,n,r,i,o,a){var s=function(e,t,n){var r=null==n?void 0:n.retrieve();if(!r)return!1;var i=_(or(e,t));return!(!W(r,i)||r[i].expireTimestamp<(new Date).getTime())}(a,e,t);return!!s&&(n(ar(a,e,t),r,i,o,a,e,!0),!0)},lr=function(e){return void 0===e&&(e=86400),(new Date).getTime()+1e3*e},dr=function(e){return e?JSON.parse(e):{}},pr={email_sha256:"other",mobile_sha256:"other2"},gr=function(e){var t=p({},e);return Object.keys(pr).forEach((function(e){if(e in t){var n=t[e];delete t[e],t[pr[e]]=n}})),t},fr=function(e,t){if(!e||!(null==t?void 0:t.userIdentities))return!1;var n,r,i,o,a=e.getUserIdentities().userIdentities,s=gr(t.userIdentities);return n=a,r=s,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]})))},vr=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)},hr=function(e,t,n,i){var a=e._Helpers,s=e._Store,u=e.Logger,c=e._ErrorReportingDispatcher,l=s.SDKConfig,d=l.identityUrl,v=l.isDevelopmentMode;if(a.canLog()){var h=a.createServiceUrl(d),m=v?"development":"production";!function(e,t,n,r,i,a,s,u){g(void 0,void 0,void 0,(function(){var c,l,d,g,v,h,m,y,b,S,I,_;return f(this,(function(f){switch(f.label){case 0:if(!K(i))return a.error("search called without a callback function; skipping request."),[2];if(c=function(e){try{i(e)}catch(e){a.error("Error invoking search callback: "+ie(e))}},l=Wn.removeFalsyIdentityValues({userIdentities:null!=e?e:{}},a).userIdentities,!Object.values(null!=l?l:{}).some((function(e){return"string"==typeof e&&e.length>0})))return a.verbose("Identity search called with empty identifiers; skipping request."),c({httpCode:Jn.noHttpCoverage}),[2];if(!t)return a.verbose("search called without a workspace API key; skipping request."),c({httpCode:Jn.noHttpCoverage}),[2];f.label=1;case 1:return f.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)},h=s||(window.fetch?new Hn(r):new Kn(r)),a.verbose("Sending search request to "+r),[4,h.upload(v,r)];case 2:if(m=f.sent(),y=void 0,!K(m.json))return[3,7];f.label=3;case 3:return f.trys.push([3,5,,6]),[4,m.json()];case 4:return y=f.sent(),[3,6];case 5:return f.sent(),a.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){a.verbose("search XHR response was not valid JSON.")}f.label=8;case 8:return m.status===o?a.verbose("search received 200 OK."):404===m.status?a.verbose("search received 404 (no match)."):a.verbose("search received non-success status "+m.status),c({httpCode:m.status,body:y}),[3,10];case 9:return S=f.sent(),I=ie(S),_="Error sending search request: "+I,a.error(_),null==u||u.report({message:_,code:jn.IDENTITY_REQUEST,severity:zn.ERROR}),c({httpCode:Jn.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)}),h+"search?cb=1",i,u,void 0,c)}else if(u.verbose(tr.InformationMessages.AbandonLogEvent),K(i))try{i({httpCode:er.loggingDisabledOrMissingAPIKey})}catch(e){u.error("Error invoking search callback: "+ie(e))}};function mr(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 Bn(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||qn(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 a,s=e.Identity.getCurrentUser();if(s&&(a=s.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())||vr(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,a)){if(!a||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 Hn(r):new Kn(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 a=e._Forwarders,s=a.sendSingleForwardingStatsToServer,u=a.setForwarderStatsQueue;e._Helpers.getFeatureFlag(r.FeatureFlags.ReportBatching)?(o.push(i),u(o)):s(i)}}}var yr=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 X(e,n,(function(e){return t.hashUserAttribute(e)}))},e.filterUserIdentities=function(e,n){return X(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}(),br=r.StorageNames;function Sr(e,t,n){n===me.IdentityType.CustomerId?e.unshift(t):e.push(t)}function Ir(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,a){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(a)return(null==(r=o||e.Identity.getCurrentUser())?void 0:r.getMPID())===a?null:e.Identity.getUser(a);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)||Sr(r,{Type:o,Identity:e[i]},o)}return r}(e,n,t.inArray)},this.filterUserIdentitiesForForwarders=yr.filterUserIdentities,this.filterUserAttributes=yr.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?br.currentStorageName+"_"+e:br.currentStorageName},this.converted=x,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=Wn}var _r=r.Messages,wr="mParticleAndroid",Pr="mParticle";function Cr(e){if(Object.prototype.hasOwnProperty.call(window,e))return window[e]}function Ar(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=wr+"_"+e+"_v2",i=Pr+"_"+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===Pr+"_"+n+"_v2")&&(r<2&&(e._Store.bridgeV2Available||e._Store.bridgeV1Available))},this.isBridgeV1Available=function(){return!!(e._Store.SDKConfig.useNativeSdk||Cr(wr)||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=Cr(wr);i&&i.hasOwnProperty(n)?(e.Logger.verbose(_r.InformationMessages.SendAndroid+n),i[n](r)):e._Store.SDKConfig.isIOS&&(e.Logger.verbose(_r.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,a;if(i){var s,u,c=Cr(wr+"_"+i+"_v2"),l=Pr+"_"+i+"_v2";if((null===(a=null===(o=window.webkit)||void 0===o?void 0:o.messageHandlers)||void 0===a?void 0:a[l])&&(s=window.webkit.messageHandlers[l]),e.uiwebviewBridgeName===l&&(u=e[l]),c&&c.hasOwnProperty(n))return e.Logger.verbose(_r.InformationMessages.SendAndroid+n),void c[n](r);s?(e.Logger.verbose(_r.InformationMessages.SendIOS+n),s.postMessage(JSON.stringify({path:n,value:r?JSON.parse(r):null}))):u&&(e.Logger.verbose(_r.InformationMessages.SendIOS+n),t.sendViaIframeToIOS(n,r))}}}var kr=r.Messages.InformationMessages,Tr={AdobeEventForwarder:11,DoubleclickDFP:41,AppNexus:50,Lotame:58,TradeDesk:103,VerizonMedia:155,Rokt:1277};function Er(e){var t=this;this.attemptCookieSync=function(n,r){var i,o=e._Store,a=o.pixelConfigurations,s=o.webviewBridgeEnabled;if(n&&!s&&!(null===(i=e._CookieConsentManager)||void 0===i?void 0:i.getNoFunctional())){var u=e._Persistence.getPersistence();z(u)||a.forEach((function(i){var o,a,s;try{var c=!1,l=i.filteringConsentRuleValues,d=i.pixelUrl,p=i.redirectUrl,g=i.moduleId,f=i.settings,v=i.frequencyCap,h=(l||{}).values;if(z(d))return;if(z(h)||(c=!0),c&&r)return;if(g===Tr.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!==(a=null===(o=u[n])||void 0===o?void 0:o.csd)&&void 0!==a?a:{},b=y[g]||null;if(!Dr(v,b))return;var S=g===Tr.TradeDesk?window.location.hostname:void 0,I="true"===(null===(s=null==f?void 0:f.enableHmTag)||void 0===s?void 0:s.toLowerCase()),_=g===Tr.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=O(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(kr.CookieSync),o.onload=function(){i[n]=(new Date).getTime(),e._Persistence.saveUserCookieSyncDatesToPersistence(r,i)},o.src=t}}var Dr=function(e,t){return!t||(new Date).getTime()>new Date(t).getTime()+864e5*e};function Lr(e,t,n){t.warning(e.warningMessage),null==n||n.report({message:e.methodName,code:jn.MP_DEPRECATED_METHOD_USAGE,severity:zn.WARNING})}var Mr=r.Messages;function Or(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,a=i.SDKConfig,s=a.sessionTimeout;if(n(null==o?void 0:o.getTime(),s))t.endSession(),t.startNewSession();else{var u=e.Identity.getCurrentUser(),c=a.identifyRequest;!((null===(r=e._CookieConsentManager)||void 0===r?void 0:r.getNoFunctional())&&!vr(e._Store))&&fr(u,c)&&(e.Identity.identify(c,a.identityCallback),e._Store.identifyCalled=!0,e._Store.SDKConfig.identityCallback=null)}}else t.startNewSession()},this.getSession=function(){return Lr({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(Mr.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 a=(null===(n=e._CookieConsentManager)||void 0===n?void 0:n.getNoFunctional())&&!vr(e._Store);e._Store.identifyCalled||a||(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(Mr.InformationMessages.AbandonStartSession)},this.endSession=function(i){var o,a,s,u;if(e.Logger.verbose(Mr.InformationMessages.StartingEndSession),i)r();else{if(!e._Helpers.canLog())return e.Logger.verbose(Mr.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(Mr.InformationMessages.NoSessionToEnd),void(null===(a=e._timeOnSiteTimer)||void 0===a||a.resetTimer());if(c.gs.sid&&e._Store.sessionId!==c.gs.sid&&(e._Store.sessionId=c.gs.sid),null===(s=null==c?void 0:c.gs)||void 0===s?void 0:s.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 Fr=r.Messages;function Ur(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,a,s,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=C(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)?C(i):1,Brand:s,Variant:o,Category:a,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(Fr.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,a){return e._Helpers.Validators.isStringOrNumber(t)?{Id:t,Affiliation:n,CouponCode:r,Revenue:i,Shipping:o,Tax:a}:(e.Logger.error(Fr.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 a=re(!1,{},n.EventAttributes);if(o.Attributes)for(var s in o.Attributes)a[s]=o.Attributes[s];t.extractProductAttributes(a,o),i.ProductImpressionList&&(a["Product Impression List"]=i.ProductImpressionList);var u=e._ServerModel.createEventObject({messageType:me.MessageType.PageEvent,name:t.generateExpandedEcommerceName("Impression"),data:a,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 a=e._ServerModel.createEventObject({messageType:me.MessageType.PageEvent,name:t.generateExpandedEcommerceName(me.PromotionActionType.getExpansionName(n.PromotionAction.PromotionActionType)),data:o,eventType:me.EventType.Transaction});r.push(a)})),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 a=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(a)}else i=!0;var s=n.ProductAction.ProductList;return s?(s.forEach((function(o){var a=re(!1,n.EventAttributes,o.Attributes);i?t.extractActionAttributes(a,n.ProductAction):t.extractTransactionId(a,n.ProductAction),t.extractProductAttributes(a,o);var s=e._ServerModel.createEventObject({messageType:me.MessageType.PageEvent,name:t.generateExpandedEcommerceName(me.ProductActionType.getExpansionName(n.ProductAction.ProductActionType)),data:a,eventType:me.EventType.Transaction});r.push(s)})),r):r},this.createCommerceEventObject=function(t,n){var r,i=e._Helpers.extend;return e.Logger.verbose(Fr.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(Fr.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 C(t)}}var Nr=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 Nn(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 Rr(e){var t=e?p({},e):{};return(!0===t.noDeviceId||!0===t.noDeviceID)&&(t.noDeviceId=!0,t.noFunctional=!0,t.noTargeting=!0),t}function xr(e,t,n){var i=this,o=t._Helpers.createMainStorageName,a=t._NativeSdkHelpers.isWebviewEnabled,s={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 s)this[u]=s[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=Vr(e),this.SDKConfig.autoLogPageViewQueryParams=tn(e.autoLogPageViewQueryParams),e.deviceId&&(this.deviceId=e.deviceId),e.hasOwnProperty("isDevelopmentMode")?this.SDKConfig.isDevelopmentMode=N(e.isDevelopmentMode):this.SDKConfig.isDevelopmentMode=!1;var l=Hr(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 f=e.dataPlan;f.planId&&(B(f.planId)?this.SDKConfig.dataPlan.PlanId=f.planId:t.Logger.error("Your data plan id must be a string and match the data plan slug format (i.e. under_case_slug)")),f.planVersion&&(H(f.planVersion)?this.SDKConfig.dataPlan.PlanVersion=f.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,s=e.requiredWebviewBridgeName;e.flags&&(i.SDKConfig.flags=Vr(e)),i.SDKConfig.autoLogPageViewQueryParams=tn(e.autoLogPageViewQueryParams);var u=Hr(e,i.SDKConfig.flags,n);for(var c in u)i.SDKConfig[c]=u[c];if(r){i.SDKConfig.workspaceToken=r;var l=Rr(null==e?void 0:e.launcherOptions).noFunctional;t._timeOnSiteTimer=new Nr(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=s||r,i.webviewBridgeEnabled=a(i.SDKConfig.requiredWebviewBridgeName,i.SDKConfig.minWebviewBridgeVersion),i.configurationLoaded=!0}}function Vr(e){var t={},n=r.FeatureFlags,i=n.ReportBatching,o=n.EventBatchingIntervalMillis,a=n.OfflineStorage,s=n.DirectUrlRouting,u=n.CacheIdentity,c=n.AudienceAPI,l=n.CaptureIntegrationSpecificIds,d=n.CaptureIntegrationSpecificIdsV2,p=n.AstBackgroundEvents,g=n.AutoLogPageView,f=n.AutoButtonTracking,v=n.AutoLinkTracking;return e.flags?(t[i]=e.flags[i]||!1,t[o]=C(e.flags[o])||r.DefaultConfig.uploadInterval,t[a]=e.flags[a]||"0",t[s]="True"===e.flags[s],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[f]="True"===e.flags[f],t[v]="True"===e.flags[v],t):{}}function Hr(e,t,n){return n?z(e.domain)&&t.directURLRouting?function(e,t){var n=r.DefaultBaseUrls,i={},o="us1",a=t.split("-"),s=a.length<=1?o:a[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],s],c.slice(1),!0).join(".")}else i[u]=e[u]||n[u];return i}(e,n):Kr(e):{}}function Kr(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 a in t)i[a]=e[a]||t[a];return i}var qr=function(){function e(e){var t,n;this.logLevel=null!==(t=e.logLevel)&&void 0!==t?t:Ve,this.logger=null!==(n=e.logger)&&void 0!==n?n:new Br}return e.prototype.verbose=function(e){this.logLevel!==Re&&this.logger.verbose&&this.logLevel===xe&&this.logger.verbose(e)},e.prototype.warning=function(e){this.logLevel!==Re&&(!this.logger.warning||this.logLevel!==xe&&this.logLevel!==Ve||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===xe},e.prototype.setLogLevel=function(e){this.logLevel=e},e}(),Br=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}(),jr=n.Base64,zr=r.Messages,Qr=r.Base64CookieKeys,Wr=r.SDKv2NonMPIDCookieKeys,Jr=r.StorageNames;function $r(){return window.mParticle}function Gr(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(e){var n=t.decodePersistence(e);if(!n)return null;var r=JSON.parse(n);return P(r)&&Object.keys(r).length?r:null}function a(e,t){return e.length>t}function s(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(e,t){var n;e[t]&&(n=e[t],Array.isArray(n)?n.length>0:P(n)&&Object.keys(n).length>0)?e[t]=jr.encode(JSON.stringify(e[t])):delete e[t]}function d(e,t){var n=e[t];P(n)&&Object.keys(n).length?e[t]=jr.encode(JSON.stringify(n)):delete e[t]}function p(e){for(var t in e)e.hasOwnProperty(t)&&Qr[t]&&d(e,t)}function g(e){for(var t in e)e.hasOwnProperty(t)&&Qr[t]&&e[t].length&&(e[t]=JSON.parse(jr.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)&&!Wr[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(zr.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(zr.ErrorMessages.CookieParseError)}},this.determineLocalStorageAvailability=function(e){var t=$r();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()||{},a=e.Identity.getCurrentUser(),s=a?a.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,s&&(o.cu=s),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,a,s,u=e._Store.storageName;e.Logger.verbose(zr.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{a=(i=t[n].split("=")).shift(),s=i.join("=")}catch(t){e.Logger.verbose("Unable to parse cookie: "+a+". Skipping.")}if(u&&u===a){var c=o(e._Helpers.converted(s));if(c)return e.Logger.verbose(zr.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 a,s,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();s=""===(a=t.getCookieDomain())?"":";domain="+a,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,s,e._Store.SDKConfig.maxCookieSize),e.Logger.verbose(zr.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)&&a(i=c(e,t,n),r)&&(Wr[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)&&(Wr[n]||n===e.cu||(t[n]=1));return t}(e);return Object.keys(o).length&&function(e,t,n,r,i,o){var s;for(var u in t)a(s=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&&a(o=c(e,n,r),i);u++)s(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)&&(Qr[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)&&(Wr[t]||p(e[t]))}(t),m(JSON.stringify(t))},this.decodePersistence=function(t){try{if(!t)return;var n=JSON.parse(y(t));return P(n)&&Object.keys(n).length&&(function(e){for(var t in e)e.hasOwnProperty(t)&&(Qr[t]?(e[t]=JSON.parse(jr.decode(e[t])),"csm"!==t||Array.isArray(e[t])||delete e[t]):"ie"===t&&(e[t]=Boolean(e[t])))}(n.gs),function(e){for(var t in e)if(e.hasOwnProperty(t))if(Wr[t])"l"===t&&(e[t]=Boolean(e[t]));else{if(!P(e[t])){delete e[t];continue}g(e[t])}}(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(e,n){if(n){var r=t.getPersistence();r&&(P(r[e])?r[e].csd=n:r[e]={csd:n}),t.savePersistence(r)}},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)),a=new Date,s=e._Store.storageName,c=new Date(a.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(s)+"="+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(e,n){if(e){n||(n=(new Date).getTime());var r=t.getPersistence();r&&(P(r[e])||(r[e]={}),r[e].fst||(r[e].fst=n,t.savePersistence(r)))}},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(e,n){if(e){n||(n=(new Date).getTime());var r=t.getPersistence();r&&P(r[e])&&(r[e].lst=n,t.savePersistence(r))}},this.getDeviceId=function(){return e._Store.deviceId},this.setDeviceId=function(n){e._Store.deviceId=n,t.update()},this.resetPersistence=function(){localStorage.clear(),t.expireCookies(Jr.cookieName),t.expireCookies(Jr.cookieNameV2),t.expireCookies(Jr.cookieNameV3),t.expireCookies(Jr.cookieNameV4),t.expireCookies(e._Store.storageName);var n=$r();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 Yr=r.Messages;function Zr(e){var t=this;this.logEvent=function(t,n){if(e.Logger.verbose(Yr.InformationMessages.StartingLogEvent+": "+t.name),e._Helpers.canLog()){var r=e._ServerModel.createEventObject(t);e._APIClient.sendEventToServer(r,n)}else e.Logger.verbose(Yr.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(Yr.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({},on(rn(Z(),null===(r=e._Store.SDKConfig.autoLogPageViewQueryParams)||void 0===r?void 0:r.allowed))),{hostname:window.location.hostname,title:window.document.title}),an(n&&n.isAutoPageView)),eventType:me.EventType.Unknown})},this.logProductActionEvent=function(n,r,i,o,a,s){var u=e._Ecommerce.createCommerceEventObject(o,s),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)),P(a)&&e._Ecommerce.convertTransactionAttributesToProductAction(a,u.ProductAction),t.logCommerceEvent(u,i,s))},this.logPurchaseEvent=function(n,r,i,o){var a=e._Ecommerce.createCommerceEventObject(o);a&&(a.EventName+=e._Ecommerce.getProductActionEventName(me.ProductActionType.Purchase),a.EventCategory=me.CommerceEventType.ProductPurchase,a.ProductAction={ProductActionType:me.ProductActionType.Purchase,ProductList:Array.isArray(r)?r:[r]},e._Ecommerce.convertTransactionAttributesToProductAction(n,a.ProductAction),t.logCommerceEvent(a,i))},this.logPromotionEvent=function(n,r,i,o,a){var s=e._Ecommerce.createCommerceEventObject(o);s&&(s.EventName+=e._Ecommerce.getPromotionActionEventName(n),s.EventCategory=e._Ecommerce.convertPromotionActionToEventType(n),s.PromotionAction={PromotionActionType:n,PromotionList:Array.isArray(r)?r:[r]},t.logCommerceEvent(s,i,a))},this.logImpressionEvent=function(n,r,i,o){var a=e._Ecommerce.createCommerceEventObject(i);a&&(a.EventName+="Impression",a.EventCategory=me.CommerceEventType.ProductImpression,Array.isArray(n)||(n=[n]),a.ProductImpressions=[],n.forEach((function(e){a.ProductImpressions.push({ProductImpressionList:e.Name,ProductList:Array.isArray(e.Product)?e.Product:[e.Product]})})),t.logCommerceEvent(a,r,o))},this.logCommerceEvent=function(t,n,r){if(e.Logger.verbose(Yr.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(Yr.InformationMessages.AbandonLogEvent)}},this.addEventHandler=function(n,r,i,o,a){var s,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[s],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:a||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(s=0;s<u.length;s++)c()}else e.Logger.verbose("No elements found");else e.Logger.error("Can't bind event, selector is required")}}function Xr(e,t){return!(null==e?void 0:e.isAttributeKeyBlocked(t))}function ei(e,t){return!(null==e?void 0:e.isIdentityBlocked(t))}function ti(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)&&Xr(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 a=me.IdentityType.getIdentityName(o);ei(t,a)&&(n[a]=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])&&Xr(t,r)&&(n[r]=e[r].slice());return n}(i(),r);return n._Helpers.filterUserAttributes(t,e.userAttributeFilters)},getAllUserAttributes:i}}var ni,ri=[me.MessageType.PageEvent,me.MessageType.PageView,me.MessageType.Commerce];function ii(e,t){return!(!e||!e.length)&&b(e,t)}function oi(e,t,n){var r=n&&n.kitBlockingEnabled?n.createBlockedEvent(e):e;if(!r)return!1;if(function(e,t,n){if(!(ri.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=yr.hashAttributeConditionalForwarding(i);if(o===n.filteringEventAttributeValue.eventAttributeName){r={name:o,value:yr.hashAttributeConditionalForwarding(t[i])};break}}var a=null!==r&&r.value===n.filteringEventAttributeValue.eventAttributeValue;return!(!0===n.filteringEventAttributeValue.includeOnMatch?a:!a)}(r.EventDataType,r.EventAttributes,t))return!1;var i=r.EventCategory;return!function(e,t,n,r){return!(e!==me.MessageType.PageEvent||!ii(r.eventNameFilters,t)&&!ii(r.eventTypeFilters,n))||!(e!==me.MessageType.Commerce||!ii(r.eventTypeFilters,n))||!(e!==me.MessageType.PageView||!ii(r.screenNameFilters,t))}(r.EventDataType,yr.hashEventName(r.EventName,i),yr.hashEventType(i),t)}var ai=r.IdentityMethods,si=ai.Modify,ui=ai.Identify,ci=ai.Login,li=ai.Logout,di=((ni={})[ui]="onIdentifyComplete",ni[ci]="onLoginComplete",ni[li]="onLogoutComplete",ni[si]="onModifyComplete",ni);function pi(e,t){var n=e,r={};for(var i in n)n.hasOwnProperty(i)&&ei(t,i)&&(r[i]=n[i]);return r}function gi(e,t){var n=this,r=this;this.forwarderStatsUploader=new mr(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 a=pi(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 s=e._Helpers.filterUserIdentities(a,n.userIdentityFilters),u=o?ti(o.getMPID(),n,e,t).getAllUserAttributes():{};return n.initialized||(n.logger=e.Logger,n.init(n.settings,i,!1,null,u,s,e._Store.SDKConfig.appVersion,e._Store.SDKConfig.appName,e._Store.SDKConfig.customFlags,e._Store.clientId),n.initialized=!0),!0}))}},this.isEnabledForUserAttributes=function(e,t){if(!e||!P(e)||!Object.keys(e).length)return!0;if(!t)return!1;var n=t.getAllUserAttributes();try{var r=!!(n&&P(n)&&Object.keys(n).length>0)&&function(e,t){for(var n in e)if(W(e,n)){var r=yr.hashAttributeConditionalForwarding(n),i=yr.hashAttributeConditionalForwarding(e[n]);if(r===t.userAttributeName&&i===t.userAttributeValue)return!0}return!1}(n,e);return e.includeOnMatch===r}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(oi(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 a={};for(var s in r)if(r.hasOwnProperty(s)){var u=yr.hashEventAttributeKey(t,n,s);b(o,u)||(a[s]=r[s])}return a}(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,yr.hashUserIdentity(e.Type))})):r||[]),o.UserAttributes=yr.filterUserAttributes(o.UserAttributes,n.userAttributeFilters),n.process){e.Logger.verbose("Sending message to forwarder: "+n.name);var a=n.process(o);a&&e.Logger.verbose(a)}}};e._Store.activeForwarders.forEach((function(e){n(e)}))}},this.handleForwarderUserAttributes=function(n,r,a){t&&t.isAttributeKeyBlocked(r)||!e._Store.activeForwarders.length||e._Store.activeForwarders.forEach((function(t){if(t[n]&&!yr.isFilteredUserAttribute(r,t.userAttributeFilters))try{var s=void 0;n===i?s=t.setUserAttribute(r,a):n===o&&(s=t.removeUserAttribute(r)),s&&e.Logger.verbose(s)}catch(t){e.Logger.error(t)}}))},this.setForwarderUserIdentities=function(n){var r=pi(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=ti(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=di[r];i&&e._Store.activeForwarders.forEach((function(r){var o=r[i];if(o){var a=ti(n.getMPID(),r,e,t),s=o.call(r,a,a.getUserIdentities());s&&e.Logger.verbose(s)}}))},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 a=void 0;if(i.suffix&&(a="".concat(i.name,"-").concat(i.suffix)),!(o!==a&&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 a=n.kits[o];r.configureSideloadedKit(a)}if(!z(n.kits)){var s=Object.keys(n.kits);e._Store.sideloadedKitsCount=s.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 f(this,(function(a){switch(a.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=a.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 fi=me.MessageType,vi=me.ApplicationTransitionType;function hi(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 mi(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 a=e.getCCPAConsentState();return a&&(t.ccpa={data_sale_opt_out:{c:a.Consented,ts:a.Timestamp,d:a.ConsentDocument,l:a.Location,h:a.HardwareId}}),t},this.createEventObject=function(t,n){var i,o,a,s={},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 f=e._IntegrationCapture.getClickIdsAsIntegrationAttributes();d=p(p({},f),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===(a=(o=e._Store).getTotalTimeOnSite)||void 0===a?void 0:a.call(o),PageUrl:Fn()||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),s={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===fi.AppStateTransition&&(u.IsFirstRun=e._Store.isFirstRun,u.LaunchReferral=Fn()||null),u.CurrencyCode=e._Store.currencyCode,qn(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),s.Timestamp=e._Store.dateLastEventSent.getTime(),re({},u,s)}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===fi.AppStateTransition&&(r.fr=n.IsFirstRun,r.iu=!1,r.at=vi.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){q(e)&&n.push(e.toString())})):q(e.CustomFlags[r])&&n.push(e.CustomFlags[r].toString()),n.length&&(t.flags[r]=n))}(n,r),n.EventDataType===fi.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:hi(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:hi(e.ProductList)}})))):n.EventDataType===fi.Profile&&(r.pet=n.ProfileMessageType),r}}function yi(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 bi=function(){function e(e,t,n){this.url="",this.logger=n,this.url="https://".concat(e).concat(t,"/audience"),this.userAudienceAPI=window.fetch?new Hn(this.url):new Kn(this.url)}return e.prototype.sendGetUserAudienceRequest=function(e,t){return g(this,void 0,void 0,(function(){var n,r,i,o,a,s;return f(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(),a={currentAudienceMemberships:null==o?void 0:o.audience_memberships};try{t(a)}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 s=u.sent(),this.logger.error("Error retrieving audiences. ".concat(s)),[3,7];case 7:return[2]}}))}))},e}(),Si=function(e,t){return z(e)||e.splice(0,e.length).forEach((function(e){try{K(e)?e():Array.isArray(e)&&Ii(e)}catch(e){t.error("Error processing ready queue item: "+ie(e))}})),[]},Ii=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,a=0,s=r;a<s.length;a++){var u=s[a];o=i,i=i[u]}i.apply(o,t)}catch(e){throw new Error("Unable to compute proper mParticle function "+e)}}},_i=r.Messages,wi=r.HTTPCodes,Pi=r.FeatureFlags,Ci=r.IdentityMethods,Ai=_i.ErrorMessages,ki=Pi.CacheIdentity,Ti=Ci.Identify,Ei=Ci.Modify,Di=Ci.Login,Li=Ci.Logout;function Mi(e){var t=e._Helpers,n=t.getFeatureFlag,i=t.extend,a=this;this.idCache=null,this.audienceManager=null,this.IdentityRequest={preProcessIdentityRequest:function(t,n,r){e.Logger.verbose(_i.InformationMessages.StartingLogEvent+": "+r);var i=e._Helpers.Validators.removeFalsyIdentityValues(t,e.Logger),o=(null==i?void 0:i.userIdentities)?p(p({},i),{userIdentities:gr(i.userIdentities)}):i,a=e._Helpers.Validators.validateIdentities(o,r);if(!a.valid)return e.Logger.error("ERROR: "+a.error),{valid:!1,error:a.error};if(n&&!e._Helpers.Validators.isFunction(n)){var s="The optional callback must be a function. You tried entering a(n) "+c(n);return e.Logger.error(s),{valid:!1,error:s}}return{valid:!0,cleanedIdentities:o}},createIdentityRequest:function(t,n,r,i,o,a,s){return{client_sdk:{platform:n,sdk_vendor:r,sdk_version:i},context:a,environment:e._Store.SDKConfig.isDevelopmentMode?"development":"production",request_id:e._Helpers.generateUniqueId(),request_timestamp_ms:(new Date).getTime(),previous_mpid:s||null,known_identities:sr(t,o)}},createModifyIdentityRequest:function(t,n,r,i,o,a){return{client_sdk:{platform:r,sdk_vendor:i,sdk_version:o},context:a,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 a=me.IdentityType.getIdentityType(o);!1!==a&&a>=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:wi,identify:function(t,n){var i,o=e.Identity.getCurrentUser(),s=e._Identity.IdentityRequest.preProcessIdentityRequest(t,n,Ti);if(o&&(i=o.getMPID()),s.valid){var u=e._Identity.IdentityRequest.createIdentityRequest(s.cleanedIdentities,r.platform,r.sdkVendor,r.sdkVersion,e._Store.deviceId,e._Store.context,i);if(e._Helpers.getFeatureFlag(r.FeatureFlags.CacheIdentity))if(cr(u.known_identities,a.idCache,a.parseIdentityResponse,i,n,t,Ti))return;e._Helpers.canLog()?e._Store.webviewBridgeEnabled?(e._NativeSdkHelpers.sendToNative(r.NativeSdkPaths.Identify,JSON.stringify(e._Identity.IdentityRequest.convertToNative(t))),e._Helpers.invokeCallback(n,wi.nativeIdentityRequest,"Identify request sent to native sdk")):e._IdentityAPIClient.sendIdentityRequest(u,Ti,n,t,a.parseIdentityResponse,i,u.known_identities):(e._Helpers.invokeCallback(n,wi.loggingDisabledOrMissingAPIKey,_i.InformationMessages.AbandonLogEvent),e.Logger.verbose(_i.InformationMessages.AbandonLogEvent))}else e._Helpers.invokeCallback(n,wi.validationIssue,s.error),e.Logger.verbose(s)},logout:function(t,n){var i,o=e.Identity.getCurrentUser(),s=e._Identity.IdentityRequest.preProcessIdentityRequest(t,n,Li);if(o&&(i=o.getMPID()),s.valid){var u,c=e._Identity.IdentityRequest.createIdentityRequest(s.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,wi.nativeIdentityRequest,"Logout request sent to native sdk")):(e._IdentityAPIClient.sendIdentityRequest(c,Li,n,t,a.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,wi.loggingDisabledOrMissingAPIKey,_i.InformationMessages.AbandonLogEvent),e.Logger.verbose(_i.InformationMessages.AbandonLogEvent))}else e._Helpers.invokeCallback(n,wi.validationIssue,s.error),e.Logger.verbose(s)},login:function(t,n){var i,o=e.Identity.getCurrentUser(),s=e._Identity.IdentityRequest.preProcessIdentityRequest(t,n,Di);if(o&&(i=o.getMPID()),s.valid){var u=e._Identity.IdentityRequest.createIdentityRequest(s.cleanedIdentities,r.platform,r.sdkVendor,r.sdkVersion,e._Store.deviceId,e._Store.context,i);if(e._Helpers.getFeatureFlag(r.FeatureFlags.CacheIdentity))if(cr(u.known_identities,a.idCache,a.parseIdentityResponse,i,n,t,Di))return;e._Helpers.canLog()?e._Store.webviewBridgeEnabled?(e._NativeSdkHelpers.sendToNative(r.NativeSdkPaths.Login,JSON.stringify(e._Identity.IdentityRequest.convertToNative(t))),e._Helpers.invokeCallback(n,wi.nativeIdentityRequest,"Login request sent to native sdk")):e._IdentityAPIClient.sendIdentityRequest(u,Di,n,t,a.parseIdentityResponse,i,u.known_identities):(e._Helpers.invokeCallback(n,wi.loggingDisabledOrMissingAPIKey,_i.InformationMessages.AbandonLogEvent),e.Logger.verbose(_i.InformationMessages.AbandonLogEvent))}else e._Helpers.invokeCallback(n,wi.validationIssue,s.error),e.Logger.verbose(s)},modify:function(t,n){var i,o=e.Identity.getCurrentUser(),s=e._Identity.IdentityRequest.preProcessIdentityRequest(t,n,Ei);if(o&&(i=o.getMPID()),s.valid){var u=(null==t?void 0:t.userIdentities)?s.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,wi.nativeIdentityRequest,"Modify request sent to native sdk")):e._IdentityAPIClient.sendIdentityRequest(c,Ei,n,t,a.parseIdentityResponse,i):(e._Helpers.invokeCallback(n,wi.loggingDisabledOrMissingAPIKey,_i.InformationMessages.AbandonLogEvent),e.Logger.verbose(_i.InformationMessages.AbandonLogEvent))}else e._Helpers.invokeCallback(n,wi.validationIssue,s.error),e.Logger.verbose(s)},getCurrentUser:function(){var t;return e._Store?(t=e._Store.mpid)?(t=e._Store.mpid.slice(),a.mParticleUser(t,e._Store.isLoggedIn)):e._Store.webviewBridgeEnabled?a.mParticleUser():null:null},getUser:function(t){var n=e._Persistence.getPersistence();return n&&n[t]&&!r.SDKv2NonMPIDCookieKeys.hasOwnProperty(t)?a.mParticleUser(t):null},getUsers:function(){var t=e._Persistence.getPersistence(),n=[];if(t)for(var i in t)r.SDKv2NonMPIDCookieKeys.hasOwnProperty(i)||n.push(a.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=_i.ValidationMessages.AliasMissingMpid),t.destinationMpid===t.sourceMpid&&(i=_i.ValidationMessages.AliasNonUniqueMpid),t.startTime&&t.endTime||(i=_i.ValidationMessages.AliasMissingTime),t.startTime>t.endTime&&(i=_i.ValidationMessages.AliasStartBeforeEndTime),i)return e.Logger.warning(i),void e._Helpers.invokeAliasCallback(n,wi.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,wi.nativeIdentityRequest,"Alias request sent to native sdk");else{e.Logger.verbose(_i.InformationMessages.StartingAliasRequest+": "+t.sourceMpid+" -> "+t.destinationMpid);var o=e._Identity.IdentityRequest.createAliasNetworkRequest(t);e._IdentityAPIClient.sendAliasRequest(o,n)}else e._Helpers.invokeAliasCallback(n,wi.loggingDisabledOrMissingAPIKey,_i.InformationMessages.AbandonAliasUsers),e.Logger.verbose(_i.InformationMessages.AbandonAliasUsers)},search:function(t,n,r){hr(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,a=t.getLastSeenTime()||(new Date).getTime();return i<o&&a<(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:a,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(_i.ErrorMessages.BadKey)},removeUserTag:function(t){e._Helpers.Validators.isValidKeyValue(t)?this.removeUserAttribute(t):e.Logger.error(_i.ErrorMessages.BadKey)},setUserAttribute:function(n,i){if(e._SessionManager.resetSessionTimer(),e._Helpers.canLog()){if(!e._Helpers.Validators.isValidAttributeValue(i))return void e.Logger.error(_i.ErrorMessages.BadAttribute);if(!e._Helpers.Validators.isValidKeyValue(n))return void e.Logger.error(_i.ErrorMessages.BadKey);if(e._Store.webviewBridgeEnabled)e._NativeSdkHelpers.sendToNative(r.NativeSdkPaths.SetUserAttribute,JSON.stringify({key:n,value:i}));else{var o=this.getAllUserAttributes(),s=void 0,u=void 0,c=S(o,n);c?(u=!1,s=o[c],delete o[c]):u=!0,o[n]=i,e._Store.setUserAttributes(t,o),a.sendUserAttributeChangeEvent(n,i,s,u,!1,this),e._Forwarders.initForwarders(a.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 s=S(o,n);s&&(n=s);var u=o[n]?o[n].toString():null;delete o[n],i&&P(i[t])&&(i[t].ua=o,e._Persistence.savePersistence(i)),a.sendUserAttributeChangeEvent(n,null,u,!1,!0,this),e._Forwarders.initForwarders(a.IdentityAPI.getCurrentUser().getUserIdentities().userIdentities,e._APIClient.prepareForwardingStats),e._Forwarders.handleForwarderUserAttributes("removeUserAttribute",n,null)}else e.Logger.error(_i.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 s=this.getAllUserAttributes(),u=void 0,l=void 0,d=void 0,p=S(s,n);if(p?(l=!1,u=s[p],delete s[p]):l=!0,s[n]=o,e._Store.setUserAttributes(t,s),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&&a.sendUserAttributeChangeEvent(n,i,u,l,!1,this),e._Forwarders.initForwarders(a.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(_i.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(a.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(Pi.AudienceAPI)?(null===a.audienceManager&&(a.audienceManager=new bi(e._Store.SDKConfig.userAudienceUrl,e._Store.devToken,e.Logger)),a.audienceManager.sendGetUserAudienceRequest(t,n)):e.Logger.error(Ai.AudienceAPINotEnabled)}}},this.parseIdentityResponse=function(t,r,i,s,u,c,l){var d,p,g,f,v,h,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),f=!e._Persistence.getFirstSeenTime(v.mpid),e._Persistence.setFirstSeenTime(v.mpid)),t.status===o){n(ki)&&rr(u,c,a.idCache,t,l);var _=a.IdentityAPI.getUser(v.mpid),w=_?_.getUserIdentities().userIdentities:{};u===Ei?(S=e._Identity.IdentityRequest.combineUserIdentities(b,s.userIdentities),e._Store.setUserIdentities(r,S)):(u===Ti&&m&&v.mpid===y&&e._Persistence.setFirstSeenTime(v.mpid),e._Store.addMpidToSessionHistory(v.mpid,r),e._CookieSyncManager.attemptCookieSync(v.mpid,f),e._Persistence.swapCurrentUser(r,v.mpid,e._Store.currentSessionMPIDs),s&&!z(s.userIdentities)&&(S=a.IdentityRequest.combineUserIdentities(w,s.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{Lr({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,h=e.Identity.getCurrentUser(),s,e.Logger,e._ErrorReportingDispatcher);var P=e._Persistence.getPersistence();h&&(e._Persistence.storeDataInMemory(P,h.getMPID()),a.reinitForwardersOnUserChange(m,h),a.setForwarderCallbacks(h,u));var C=ue.getNewIdentitiesByName(S),A=u===Ei?b:w;null===(p=e._CookieConsentManager)||void 0===p||p.syncNoTargetingAttribute(h),a.sendUserIdentityChangeEvent(C,u,v.mpid,A)}if(i){var k=0===t.status?wi.noHttpCoverage:t.status;e._Helpers.invokeCallback(i,k,v||null,h,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=Si(e._preInit.readyQueue,e.Logger)},this.sendUserIdentityChangeEvent=function(t,n,r,i){var o;if(r||n===Ei){var s=this.IdentityAPI.getUser(r);for(var u in t)if(i[u]!==t[u]){var c=!i[u],l=a.createUserIdentityChange(u,t[u],i[u],c,s);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,s){var u,c=a.createUserAttributeChange(t,n,r,i,o,s);c&&(null===(u=e._APIClient)||void 0===u||u.sendEventToServer(c))},this.createUserAttributeChange=function(t,n,r,i,o,a){var s;return void 0===r&&(r=null),n!==r&&(s=e._ServerModel.createEventObject({messageType:me.MessageType.UserAttributeChange,userAttributeChanges:{UserAttributeName:t,New:n,Old:r,Deleted:o,IsNewAttribute:i}},a)),s},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 Oi=r.CCPAPurpose;function Fi(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 a in o)o.hasOwnProperty(a)&&(n=yr.hashConsentPurposeConditionalForwarding("1",a),r[n]=o[a].Consented);var s=i.getCCPAConsentState();s&&(n=yr.hashConsentPurposeConditionalForwarding("2",Oi),r[n]=s.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 a=n instanceof Date;return a&&(n=n.getTime()),(n||a)&&("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 a=e.getCCPAConsentState();a&&(n.ccpa=((t={})[Oi]={},t),"boolean"==typeof a.Consented&&(n.ccpa[Oi].c=a.Consented),"number"==typeof a.Timestamp&&(n.ccpa[Oi].ts=a.Timestamp),"string"==typeof a.ConsentDocument&&(n.ccpa[Oi].d=a.ConsentDocument),"string"==typeof a.Location&&(n.ccpa[Oi].l=a.Location),"string"==typeof a.HardwareId&&(n.ccpa[Oi].h=a.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,Oi)&&r.setCCPAConsentState(n(e.ccpa[Oi])),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 a(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=a(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 s=t.createPrivacyConsent(i.Consented,i.Timestamp,i.ConsentDocument,i.Location,i.HardwareId);return s&&(r[o]=s),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[Oi]=r),this},getCCPAConsentState:function(){return i[Oi]},getGDPRConsentState:function(){return Object.assign({},r)},removeGDPRConsentState:function(e){var t=a(e);return t?(delete r[t],this):this},removeCCPAConsentState:function(){return delete i[Oi],this}}}}var Ui={ScreenView:"screen_view",CustomEvent:"custom_event",Commerce:"commerce",UserAttributes:"user_attributes",UserIdentities:"user_identities",ProductAction:"product_action",PromotionAction:"promotion_action",ProductImpression:"product_impression"},Ni=function(e){return e},Ri=function(e){return p(p({},e),{UserAttributes:{}})},xi=function(e){return p(p({},e),{UserIdentities:[]})},Vi=function(){function e(e,t){var n,r,i,o,a,s,u,c,l,d,p,g,f,v,h,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===(s=null===(a=null===(o=null==e?void 0:e.document)||void 0===o?void 0:o.dtpn)||void 0===a?void 0:a.blok)||void 0===s?void 0:s.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===(h=null===(v=null===(f=null==e?void 0:e.document)||void 0===f?void 0:f.dtpn)||void 0===v?void 0:v.vers)||void 0===h?void 0:h.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)!==Ui.ProductImpression&&(null===(n=null==e?void 0:e.match)||void 0===n?void 0:n.type)!==Ui.ProductAction&&(null===(r=null==e?void 0:e.match)||void 0===r?void 0:r.type)!==Ui.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 Ui.CustomEvent:var n=t;return[Ui.CustomEvent,n.custom_event_type,n.event_name].join(":");case Ui.ScreenView:var r=t;return[Ui.ScreenView,"",r.screen_name].join(":");case Ui.ProductAction:var i=t;return[e.type,i.action].join(":");case Ui.PromotionAction:var o=t;return[e.type,o.action].join(":");case Ui.ProductImpression:var a=t;return[e.type,a.action].join(":");case Ui.UserIdentities:case Ui.UserAttributes:return[e.type].join(":");default:return null}},e.prototype.generateProductAttributeMatchKey=function(e){var t=e.criteria||"";switch(e.type){case Ui.ProductAction:var n=t;return[e.type,n.action,"ProductAttributes"].join(":");case Ui.PromotionAction:var r=t;return[e.type,r.action,"ProductAttributes"].join(":");case Ui.ProductImpression:return[e.type,"ProductAttributes"].join(":");default:return null}},e.prototype.getPlannedProperties=function(e,t){var n,r,i,o,a,s,u,c,l,d;switch(e){case Ui.CustomEvent:case Ui.ScreenView:case Ui.ProductAction:case Ui.PromotionAction:case Ui.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,f=Object.keys(l.properties);g<f.length;g++){p[f[g]]=!0}return p}return!1!==(null===(u=null===(s=null===(a=null==t?void 0:t.definition)||void 0===a?void 0:a.properties)||void 0===s?void 0:s.data)||void 0===u?void 0:u.additionalProperties)||{};case Ui.UserAttributes:case Ui.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,h=0,m=Object.keys(v);h<m.length;h++){p[m[h]]=!0}return p;default:return null}},e.prototype.getProductProperties=function(e,t){var n,r,i,o,a,s,u,c,l,d,p,g,f,v,h,m,y,b,S,I;switch(e){case Ui.ProductImpression:if(!1===(null==(I=null===(d=null===(l=null===(c=null===(u=null===(s=null===(a=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===a?void 0:a.items)||void 0===s?void 0:s.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 Ui.ProductAction:case Ui.PromotionAction:if((I=null===(S=null===(b=null===(y=null===(m=null===(h=null===(v=null===(f=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===f?void 0:f.properties)||void 0===v?void 0:v.product_action)||void 0===h?void 0:h.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,a=i.product_impressions,s=i.promotion_action;o?(r.push(Ui.ProductAction),r.push(o.action)):s?(r.push(Ui.PromotionAction),r.push(s.action)):a&&r.push(Ui.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(Ui.ProductAction),t.push(r.action),t.push("ProductAttributes")):o?(t.push(Ui.PromotionAction),t.push(o.action),t.push("ProductAttributes")):i&&(t.push(Ui.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,Ni)),e&&e.EventDataType===me.MessageType.Commerce&&(e=this.applyBlockingStep("product attributes",this.transformProductAttributes,e,Ni)),e&&(e=this.applyBlockingStep("user attributes",this.transformUserAttributes,e,Ri),e=this.applyBlockingStep("user identities",this.transformUserIdentities,e,xi)),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=Xe(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={},a=0,s=Object.keys(t.EventAttributes);a<s.length;a++){var u=s[a];!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=Xe(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(P(n)&&t.UserAttributes){for(var r={},i=0,o=Object.keys(t.UserAttributes);i<o.length;i++){var a=o[i];!0===n[a]&&(r[a]=t.UserAttributes[a])}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=p({},e);if(this.blockUserIdentities){var r=this.dataPlanMatchLookups.user_identities;P(r)&&(null===(t=null==n?void 0:n.UserIdentities)||void 0===t?void 0:t.length)&&(n.UserIdentities=n.UserIdentities.filter((function(e){var t=me.IdentityType.getIdentityName(C(e.Type));return r[t]})))}return n},e}(),Hi=function(e,t,n,r){var i=e+t+"/config",o=["env=".concat(r?"1":"0")],a=n||{},s=a.planId,u=a.planVersion;return s&&o.push("plan_id=".concat(s)),u&&o.push("plan_version=".concat(u)),"".concat(i,"?").concat(o.join("&"))};function Ki(e,t,n){var r=this,i="https://"+n._Store.SDKConfig.configUrl,o=t.isDevelopmentMode,a=t.dataPlan,s=Hi(i,e,a,o),u=window.fetch?new Hn(s):new Kn(s);this.getSDKConfiguration=function(){return g(r,void 0,void 0,(function(){var e,r,i,o,a,s;return f(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===(a=null==n?void 0:n.Logger)||void 0===a||a.verbose("Issue with receiving configuration from server, received HTTP Code of "+r.statusText),[3,7];case 6:return c.sent(),null===(s=null==n?void 0:n.Logger)||void 0===s||s.error("Error getting forwarder configuration from mParticle servers."),[3,7];case 7:return[2,t]}}))}))}}var qi=r.HTTPCodes,Bi=r.Messages,ji=r.IdentityMethods.Modify;function zi(e){this.sendAliasRequest=function(t,n){return g(this,void 0,void 0,(function(){var r,i,u,c,l,d,p,g,v,h,m,y,b,S;return f(this,(function(f){switch(f.label){case 0:r=e.Logger,i=e._Helpers.invokeAliasCallback,u=e._Store.SDKConfig.aliasUrl,c=e._Store.devToken,r.verbose(Bi.InformationMessages.SendAliasHttp),l="https://".concat(u).concat(c,"/Alias"),d=window.fetch?new Hn(l):new Kn(l),p={method:"post",headers:{Accept:"text/plain;charset=UTF-8","Content-Type":"application/json"},body:JSON.stringify(t)},f.label=1;case 1:return f.trys.push([1,13,,14]),[4,d.upload(p)];case 2:switch(g=f.sent(),v=void 0,h=void 0,S=void 0,g.status){case a:case o:return[3,3];case s:return[3,4]}return[3,11];case 3:return h="Received Alias Response from server: "+JSON.stringify(g.status),[3,12];case 4:if(!g.json)return[3,9];f.label=5;case 5:return f.trys.push([5,7,,8]),[4,g.json()];case 6:return v=f.sent(),[3,8];case 7:return f.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):"",f.label=10;case 10:return(null==(y=v)?void 0:y.message)&&(S=y.message),h="Issue with sending Alias Request to mParticle Servers, received HTTP Code of "+g.status,(null==y?void 0:y.code)&&(h+=" - "+y.code),[3,12];case 11:throw new Error("Received HTTP Code of "+g.status);case 12:return r.verbose(h),i(n,g.status,S),[3,14];case 13:return b=f.sent(),S=ie(b),r.error("Error sending alias request to mParticle servers. "+S),i(n,qi.noHttpCoverage,S),[3,14];case 14:return[2]}}))}))},this.sendIdentityRequest=function(t,n,r,i,c,l,d){var v,h,m,y;return g(this,void 0,void 0,(function(){var g,b,S,I,_,w,P,C,A,k,T,E,D,L,M,O,F,U,N;return f(this,(function(f){switch(f.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(Bi.InformationMessages.SendIdentityBegin),!t)return b.error(Bi.ErrorMessages.APIRequestEmpty),[2];if(b.verbose(Bi.InformationMessages.SendIdentityHttp),e._Store.identityCallInFlight)return g(r,qi.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 Hn(_):new Kn(_),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,f.label=1;case 1:return f.trys.push([1,9,,10]),[4,w.upload(P)];case 2:switch(C=f.sent(),A=void 0,k=void 0,C.status){case a:case o:case s:return[3,3]}return[3,7];case 3:return C.json?[4,C.json()]:[3,5];case 4:return T=f.sent(),A=this.getIdentityResponseFromFetch(C,T),[3,6];case 5:A=this.getIdentityResponseFromXHR(C),f.label=6;case 6:return A.status===s?(E=A.responseText,k="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(", "),k+=" - "+U)):b.isVerbose()&&(D=A.responseText,L=e._Store.SDKConfig.isDevelopmentMode,M=D,!L&&(null==D?void 0:D.matched_identities)&&(M=p(p({},D),{matched_identities:te(D.matched_identities)})),k="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,qi.noHttpCoverage,U),[2];case 8:return e._Store.identityCallInFlight=!1,e._Store.identityCallFailed=!1,k&&b.verbose(k),(null===(h=e._RoktManager)||void 0===h?void 0:h.isInitialized)&&(F=e._Store.identifyRequestCount,e.captureTiming("".concat(F,"-identityRequestEnd"))),c(A,I,r,i,n,d,!1),[3,10];case 9:return O=f.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(O),N="Error sending identity request to servers - "+U,b.error(N),null==S||S.report({message:N,code:jn.IDENTITY_REQUEST,severity:zn.ERROR}),null===(y=e.processQueueOnIdentityFailure)||void 0===y||y.call(e),g(r,qi.noHttpCoverage,U),[3,10];case 10:return[2]}}))}))},this.getUploadUrl=function(t,n){var r=e._Helpers.createServiceUrl(e._Store.SDKConfig.identityUrl);return t===ji?r+n+"/"+t:r+t},this.getIdentityResponseFromFetch=function(e,t){return{status:e.status,responseText:t,cacheMaxAge:parseInt(e.headers.get(nr))||0,expireTimestamp:0}},this.getIdentityResponseFromXHR=function(e){return{status:e.status,responseText:e.responseText?JSON.parse(e.responseText):{},cacheMaxAge:C(e.getResponseHeader(nr)||""),expireTimestamp:0}}}var Qi="passbackconversiontrackingid",Wi=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,this.autoLinkClicksForwarded=!1}return e.prototype.setOnReadyCallback=function(e){this.onReadyCallback=e},e.prototype.init=function(e,t,n,r,i,o,a,s,u,c,l){var d,g,f=e||{},v=f.userAttributeFilters,h=f.settings||{},m=h.placementAttributesMapping,y=h.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=s,this.loggingService=u,this.captureTiming=a,this.integrationCapture=c,this.createFilteredUser=l,null===(g=this.captureTiming)||void 0===g||g.call(this,fe),this.filters={userAttributeFilters:v,filterUserAttributes:yr.filterUserAttributes,filteredUser:t};try{this.placementAttributesMapping=function(e){try{return e?JSON.parse(e.replace(/&quot;/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=Rr(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=zt("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.setAutoLinkClicksForwarded=function(e){this.autoLinkClicksForwarded=e},e.prototype.areAutoLinkClicksForwarded=function(){return this.autoLinkClicksForwarded},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.getCheckoutIntentSelectors=function(){var e=this.kit;return e?e.checkoutIntentSelectors:void 0},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,a,s,u,c,l,d,v,h,m,y,b,S,I;return g(this,void 0,void 0,(function(){var g,_,w,P,C,A,k,T,E,D,L,M,O,F,U,N,R,x,V,H,K,q,B,j,Q=this;return f(this,(function(f){if(null===(t=this.captureTiming)||void 0===t||t.call(this,ge),!this.isReady())return[2,this.deferredCall("selectPlacements",e)];(null===(n=this.store)||void 0===n?void 0:n.identityCallInFlight)&&(null===(r=this.loggingService)||void 0===r||r.log({message:"RoktManager: selectPlacements ran while an identity request was in flight",code:jn.SELECT_PLACEMENTS_IDENTITY_IN_FLIGHT}));try{if(g=e.attributes,_=(null==g?void 0:g.sandbox)||null,w=this.mapPlacementAttributes(g,this.placementAttributesMapping),(null===(i=this.logger)||void 0===i?void 0:i.isVerbose())&&(P=ne(g,null===(a=null===(o=this.store)||void 0===o?void 0:o.SDKConfig)||void 0===a?void 0:a.isDevelopmentMode),this.logger.verbose("mParticle.Rokt selectPlacements called with attributes:\n".concat(JSON.stringify(P,null,2)))),this.currentUser=this.identityService.getCurrentUser(),C=(null===(u=null===(s=this.currentUser)||void 0===s?void 0:s.getUserIdentities())||void 0===u?void 0:u.userIdentities)||{},A=C.email,k=w.email,T=void 0,E=void 0,(D=this.mappedEmailShaIdentityType&&!1!==ue.getIdentityType(this.mappedEmailShaIdentityType))&&(T=C[this.mappedEmailShaIdentityType],E=w.emailsha256||w[this.mappedEmailShaIdentityType]||void 0),L=this.hasIdentityChanged(A,k),M=this.hasIdentityChanged(T,E),O={},L&&(O.email=k,k&&(F="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(F),null===(c=this.errorReporter)||void 0===c||c.report({message:F,code:jn.IDENTITY_MISMATCH,severity:zn.WARNING}))),M&&(O[this.mappedEmailShaIdentityType]=E,F="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(F),null===(l=this.errorReporter)||void 0===l||l.report({message:F,code:jn.IDENTITY_MISMATCH,severity:zn.WARNING})),U=this.toUserAttributes(w),z(O))this.setUserAttributes(this.currentUser,U);else try{this.identityService.identify({userIdentities:p(p({},C),O)},(function(e){var t,n=Number(null==e?void 0:e.httpCode);n&&(n>=400||n<0)&&Q.logger.error("Background identify failed with HTTP "+n),Q.setUserAttributes(null===(t=null==e?void 0:e.getUser)||void 0===t?void 0:t.call(e),U,O)}))}catch(e){this.logger.error("Background identify threw an error: "+ie(e)),this.setUserAttributes(this.identityService.getCurrentUser(),U,O)}return N=this.currentUser&&this.createFilteredUser?this.createFilteredUser(this.currentUser.getMPID()):null,R=(null===(d=null==N?void 0:N.getUserIdentities())||void 0===d?void 0:d.userIdentities)||{},x=null===(h=null===(v=this.store)||void 0===v?void 0:v.getTimeOnSite)||void 0===h?void 0:h.call(v),V=null===(y=null===(m=this.store)||void 0===m?void 0:m.getTotalTimeOnSite)||void 0===y?void 0:y.call(m),(H=p(p(p(p({},w),null!==_?{sandbox:_}:{}),x?{active_time_on_site_ms:x}:{}),V?{total_time_on_site_ms:V}:{})).email||(R.email?H.email=R.email:C.email&&this.logFilteredIdentity("email")),!D||H.emailsha256||H[this.mappedEmailShaIdentityType]||((K=R[this.mappedEmailShaIdentityType])?H.emailsha256=K:C[this.mappedEmailShaIdentityType]&&this.logFilteredIdentity(this.mappedEmailShaIdentityType)),H[Qi]||(null===(b=this.integrationCapture)||void 0===b||b.capture(),q=null===(S=this.integrationCapture)||void 0===S?void 0:S.getClickIdsAsIntegrationAttributes(),(B=null===(I=null==q?void 0:q[Tr.Rokt])||void 0===I?void 0:I[Qi])&&(H[Qi]=B)),this.filters.filteredUser=N||this.filters.filteredUser||null,j=p(p({},e),{attributes:H}),[2,this.kit.selectPlacements(j)]}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,a,s,u,l,d,p,v=this;return f(this,(function(h){switch(h.label){case 0:return h.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 f(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=h.sent(),i={},o=0,a=r;o<a.length;o++)s=a[o],u=s.key,l=s.attributeValue,d=s.hashedValue,i[u]=l,d&&(i["".concat(u,"sha256")]=d);return[2,i];case 2:return p=h.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 f(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 f(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 a={};for(var s in e){if(e.hasOwnProperty(s))a[n[s]||s]=e[s]}return a},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 a=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(a)))}var s=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){s&&s(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 f(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}(),Ji=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}(),$i=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}(),Gi=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}(),Yi="is_auto_button_click",Zi="Auto Button Click",Xi="is_auto_link_click",eo="Auto Link Click",to=function(e,t){for(var n={label_source:e.labelSource,element:e.element,type:e.type,path:Mt(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,group:e.group,link_type:e.linkType,link_domain:e.linkDomain,link_path:e.linkPath,file_extension:e.fileExtension},i=0,o=Object.keys(r);i<o.length;i++){var a=o[i];r[a]&&(n[a]=r[a])}return void 0!==e.checked&&(n.checked=e.checked),n},no=["label_source","element","type","path","label","aria_label","icon","element_id","element_name","test_id","controls","form","group","link_type","link_domain","link_path","file_extension","checked"],ro=function(e,t,n){void 0===n&&(n=!1);var r=e.filteringEventAttributeValue;if(r&&r.eventAttributeValue&&no.some((function(e){return yr.hashAttributeConditionalForwarding(e)===r.eventAttributeName})))return"forwarding rule";var i={hostname:window.location.hostname};i[n?Xi:Yi]=!0;var o={EventName:n?eo:Zi,EventCategory:ae.Other,EventDataType:oe.PageEvent,EventAttributes:i},a=[["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!oi(o,n,t)}));return a?a[0]:void 0},io='button, input[type="submit"], input[type="button"], input[type="image"], [role="button"]',oo='[contenteditable]:not([contenteditable="false"])';function ao(e){var t=K(e.getRootNode)?e.getRootNode():null;return e.assignedSlot||e.parentElement||t&&t.host||null}function so(e,t,n){for(var r=e;r&&r!==n;){if(t(r))return!0;r=ao(r)}return!1}function uo(e,t){return so(e,(function(e){return e.matches(t)}))}var co="[data-core-type], #rokt-controller-frame";function lo(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 po=["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(", "),go="paypal-basic-card-button",fo=po+", "+go,vo=["set-up","add-money","reload","top-up"].map((function(e){return'apple-pay-button[type="'+e+'"]'})).join(", ");function ho(e){var t=e.matches(fo)?e:null;if(!t){var n=K(e.getRootNode)?e.getRootNode():null;t=n&&n.host&&n.host.matches(fo)?n.host:null}if(t)return t.matches(vo)?"none":t.matches(go)?"checkout_step":"wallet"}var mo=/(?:^| )(?:apple ?pay|google ?pay|g ?pay|amazon ?pay|cash ?app|venmo|pay ?pal|shop ?pay|klarna|after ?pay|clear ?pay|sezzle|samsung ?pay)(?= |$)/,yo=/(?:^| )affirm(?= |$)/,bo=/(?:^| )(?:pay|payment|checkout)(?= |$)/,So=/(?:^| )(?:btn|button)(?= |$)/,Io=/(?:^| )(?: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 _o(e){return(e||"").slice(0,64).replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[^A-Za-z0-9]+/g," ").trim().toLowerCase()}function wo(e){return[e.getAttribute("id"),e.getAttribute("data-testid")].map(_o).some((function(e){return(mo.test(e)||yo.test(e)&&bo.test(e))&&So.test(e)&&!Io.test(e)}))}var Po='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]',Co='[role="radiogroup"], [role="tablist"], [role="listbox"]',Ao="klarna-placement, afterpay-placement, square-placement, .affirm-as-low-as, .affirm-site-modal, .affirm-product-modal, [data-pp-message]";function ko(e,t,n){return void 0===n&&(n=!1),!!e.matches(Po)||(!!uo(e,Co)||(!(t||!(!n&&e.hasAttribute("aria-expanded")||e.hasAttribute("aria-pressed")))||uo(e,Ao)))}var To=Po+", "+Co+', input:not([type="hidden"]):not([type="submit"]):not([type="button"]):not([type="image"]), select, textarea, option, optgroup, datalist, [aria-expanded], [aria-pressed], '+oo,Eo=Po+", "+io+", a[href], "+fo+", [aria-expanded], [aria-pressed], "+oo;function Do(e){if(!wo(e)||e.matches(To))return!1;for(var t=ao(e);t;t=ao(t))if(t.matches(Eo)||wo(t))return!1;var n=e.shadowRoot;return!(e.querySelector(To)||n&&n.querySelector(To))}function Lo(e){for(var t,n=e.slice(0,12),r=0,i=n;r<i.length;r++){if((s=i[r])instanceof Element){t=s;break}}if(!t||uo(t,co+", [data-mp-no-track]"))return!0;for(var o=0,a=n;o<a.length;o++){var s;if((s=a[o])instanceof Element&&lo(s))return!0}return!1}function Mo(e,t,n){if(void 0===t&&(t=!1),void 0===n&&(n=12),t||!Lo(e)){for(var r,i,o=!1,a=0,s=e.slice(0,n);a<s.length;a++){var u=s[a];if(r)break;u instanceof Element&&(u.matches(io+", a[href], "+fo)||!o&&Do(u)?r=u:(!i&&u.matches('input[type="checkbox"], input[type="radio"]')&&(i=u),o=o||u.matches(To)))}if(!(!(r=r||i)||r.matches(':disabled, [aria-disabled="true"]')||r.classList.contains("disabled")&&wo(r)))return r}}var Oo='input:not([type="submit"]):not([type="button"]):not([type="image"]):not([type="reset"]):not([type="radio"]):not([type="checkbox"]), textarea, select, '+oo;function Fo(e,t){var n="input, select, textarea, [data-mp-no-track], "+oo;return e.matches("input, select, textarea, option, optgroup, datalist, "+oo)||(t?Array.from(e.querySelectorAll(n)).some((function(e){return e!==t})):!!e.querySelector(n))||uo(e,"select, datalist, textarea, [data-mp-no-track], "+oo)}var Uo=function(){try{return{run:new RegExp("\\p{Nd}{6,}","u"),number:new RegExp("\\p{Nd}+(?:[.,\u060c\u066b\u066c]\\p{Nd}+)*","gu")}}catch(e){return}}(),No=128;function Ro(e){if(e&&!(e.length>No)&&Uo){var t=e.replace(/\s+/g," ").trim().toLowerCase();if(t&&-1===t.indexOf("@")&&!Uo.run.test(t.replace(/[\s()\-\u2010-\u2015]/g,"")))return t.replace(Uo.number,"#").slice(0,64).trim()||void 0}}var xo=/\.(pdf|zip|csv|txt|ics|docx?|xlsx?|pptx?|dmg|exe|apk|mp3|mp4)$/i,Vo='a[href]:not([role="button"]), [role~="link"]:not([role~="button"])';function Ho(e){if("wallet"===ho(t=e)||Do(t))return"wallet";var t,n=e.tagName.toLowerCase();return"button"===n||"input"===n?n:e.matches(Vo)?"link":"role"}var Ko='script, style, template, [hidden], [aria-hidden="true"], [inert]',qo=64;function Bo(e){var t=e;return K(t.assignedNodes)?t.assignedNodes():[]}function jo(e){return!!(e.matches(Ko)||(t=e,n=t.parentElement,n&&(n.shadowRoot?!t.assignedSlot:Bo(n).length>0)))||!(e instanceof SVGTitleElement)&&"none"===window.getComputedStyle(e).display;var t,n}function zo(e){var t=window.getComputedStyle(e).visibility;return"hidden"!==t&&"collapse"!==t}function Qo(e,t){return!so(e,jo,t)}function Wo(e,t){var n=e.assignedSlot;return!!n&&Qo(n,t)}function Jo(e){return!(/\S/.test(e.textContent||"")||e instanceof Element&&(e.matches("slot")||e.querySelector("slot")))}function $o(e){var t="",n=0,r=function(e){t=(t+e).replace(/\s+/g," ")},i=function(e){if(jo(e))return!0;for(var o=Bo(e),a=o.length?o:e.childNodes,s=0;s<a.length;s++){var u=a[s],c=u.nodeType===Node.TEXT_NODE;if(c||u instanceof Element)if(Jo(u))r(u.textContent);else{if(++n>qo)return!1;if(!e.shadowRoot||Wo(u,e)){if(c)zo(u.assignedSlot||e)&&r(u.nodeValue);else if(o.length&&Fo(u)||!i(u))return!1;if(t.trim().length>No)return!1}}}return!0};return i(e)?t.trim():void 0}function Go(e){return e&&!Fo(e)&&Qo(e)?$o(e):""}function Yo(e){for(var t=e.querySelectorAll('img[alt], svg[aria-label], [role="img"][aria-label]'),n=0;n<t.length&&n<qo;n++){var r=Zo(t[n].getAttribute("alt")||t[n].getAttribute("aria-label"));if(r&&Qo(t[n],e)&&zo(t[n]))return r}}function Zo(e){return e&&e.trim()?e:void 0}function Xo(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 Go(n.getElementById?n.getElementById(e):null)}));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=Zo(e.getAttribute("aria-label"));if(i)return{raw:i,source:"aria"};var o=e.children.length<=4&&!Fo(e);if(e instanceof HTMLInputElement){var a=e.type;if("image"===a){if(c=Zo(e.getAttribute("alt")))return{raw:c,source:"alt"}}else if("submit"===a||"button"===a||"reset"===a){var s=Zo(e.value);if(s)return{raw:s,source:"value"};if("button"!==a)return{raw:a,source:"value"}}}else if(o&&Qo(e)){var u,c;if(void 0===(u=$o(e)))return ea(e)||{source:"none"};if(u)return{raw:u,source:"text"};if(c=Yo(e))return{raw:c,source:"alt"}}if(!(e instanceof HTMLInputElement)&&Qo(e)){var l=ea(e);if(l)return l}var d=Zo(e.getAttribute("title"));return d?{raw:d,source:"title"}:{source:"none"}}function ea(e){if(!(Fo(e)||e.shadowRoot||e.querySelector("slot")||-1!==e.tagName.indexOf("-")||Array.from(e.querySelectorAll("*")).some((function(e){return!!e.shadowRoot||-1!==e.tagName.indexOf("-")})))){var t=Go(e.querySelector('h1, h2, h3, h4, h5, h6, [role="heading"]'));return t?{raw:t,source:"heading"}:void 0}}var ta=/^(?:fa|fas|far|fal|icon|bi|glyphicon|ti|mdi|ri|la|lucide|ion|feather|ph)-([a-z][a-z-]{1,31})$/,na=/^(?: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 ra(e){var t=function(e){return!uo(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 a=0,s=[e].concat(Array.from(e.querySelectorAll("i, span, svg"))).filter(t).slice(0,5);a<s.length;a++)for(var u=0,c=(s[a].getAttribute("class")||"").split(/\s+/);u<c.length;u++){var l=c[u],d=ta.exec(l.toLowerCase());if(d&&!na.test(d[1]))return d[1]}}var ia=/^[A-Za-z]+[0-9]{0,3}(?:[-_](?:[A-Za-z]+[0-9]{0,3}|[0-9]{1,3}))*$/;function oa(e){if(e){var t=e.trim(),n=t.replace(/[^0-9]/g,"").length;return t.length<=64&&n<=3&&ia.test(t)?t:void 0}}var aa=/:(?:r[0-9a-v]{1,4}|R[0-9a-v]+(?:H[0-9a-v]+)?):|\u00ab(?:r[0-9a-v]{1,4}|R[0-9a-v]+(?:H[0-9a-v]+)?)\u00bb|_(?:r_[0-9a-v]{1,4}|R_[0-9a-v]+(?:H[0-9a-v]+)?)_/g,sa=/^(?:radix|react-aria|headlessui(?:-[a-z]+)*|mui|chakra|reach|ark|mantine|base-ui)$/i;function ua(e){if(e){var t=e.trim(),n=t.replace(aa,"-"),r=oa(n.replace(/([-_])[-_]+/g,"$1").replace(/^[-_]+|[-_]+$/g,"").replace(/[-_][0-9]{4,}$/,""));return r&&n!==t&&sa.test(r)?void 0:r}}var ca=["data-testid","data-test-id","data-test","data-qa","data-cy"];function la(e,t){for(var n=0,r=t;n<r.length;n++){var i=r[n],o=oa(e.getAttribute(i));if(o)return o}}function da(e){var t=e.getAttribute("aria-controls");return oa(t?t.trim().split(/\s+/)[0]:null)||la(e,["popovertarget","commandfor"])}function pa(e){var t=e instanceof HTMLButtonElement||e instanceof HTMLInputElement?e.form:e.matches(Vo)?null:e.closest("form");return t?oa(t.getAttribute("id")):void 0}var ga=["radio","menuitemradio","checkbox","menuitemcheckbox","switch","option","tab","link"];function fa(e){var t=e.tagName.toLowerCase();if("button"===t||"input"===t)return e.type;if(e.matches('[role~="button"]'))return"button";for(var n=0,r=(e.getAttribute("role")||"").trim().split(/\s+/);n<r.length;n++){var i=r[n];if(-1!==ga.indexOf(i))return i}return"button"}function va(e){var t=e.pathname.split("/").map(It);if(!t.some((function(e){return void 0===e}))){var n=t.join("/");if(!(n.length>No||/[@;=]/.test(n)||ht.test(n))){var r,i=n.split("/"),o=i.map((function(e,t){if(t>0&&e&&yt(wt(i,t),e))return"*";var n=Lt(e,e,t>0?wt(i,t):void 0);return void 0===n?e:n}));return r=o.join("/"),Uo?r.replace(Uo.number,"#"):void 0}}}function ha(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=xo.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",path:va(e)}}}}var ma='input[type="checkbox"], input[type="radio"], [role~="checkbox"], [role~="radio"], [role~="switch"], [role~="menuitemcheckbox"], [role~="menuitemradio"], [role~="option"]',ya='[role~="radio"], [role~="menuitemradio"]';function ba(e){var t=e instanceof HTMLLabelElement?e.control:e;return t&&t.matches(ma)?t:null}function Sa(e){return e instanceof HTMLInputElement?"radio"===e.type:!!e&&e.matches(ya)}function Ia(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?ba(i):null;if(o)return o}return ba(e)||e.querySelector(ma)}var _a='[role="radiogroup"], [role="listbox"], [role="group"], fieldset, [role="region"][aria-label], [role="region"][aria-labelledby]',wa=ma+", "+io+', a[href], input, select, textarea, slot, [aria-haspopup], [role~="button"], [role~="link"], [role~="tab"], [role~="combobox"]',Pa=["radio","menuitemradio","checkbox","menuitemcheckbox","switch","option"];function Ca(e){return e instanceof HTMLInputElement?e.type:(e.getAttribute("role")||"").trim().split(/\s+/).filter((function(e){return-1!==Pa.indexOf(e)}))[0]}function Aa(e,t){if(!(t instanceof HTMLInputElement)){var n='[role="radiogroup"], [role="listbox"]';return!(e instanceof HTMLInputElement)&&Ca(e)===Ca(t)&&e.closest(n)===t.closest(n)}var r=t.getAttribute("name");return e instanceof HTMLInputElement&&e.type===t.type&&!!r&&e.getAttribute("name")===r&&e.form===t.form}function ka(e,t){return so(e,(function(e){return"0"===window.getComputedStyle(e).opacity}),t)}var Ta="svg title, svg desc, svg metadata, svg defs, svg symbol, svg clipPath, svg mask, svg pattern, svg marker, svg linearGradient, svg radialGradient, svg filter, canvas";function Ea(e,t){for(var n=t.closest("details:not([open])");n;){var r=Array.from(n.children).filter((function(e){return"SUMMARY"===e.tagName}))[0];if(!r||!r.contains(e))return!0;n=n.parentElement?n.parentElement.closest("details:not([open])"):null}return!1}function Da(e){var t=e.checkVisibility;return K(t)&&t.call(e,{checkOpacity:!0,checkVisibilityCSS:!0,opacityProperty:!0,visibilityProperty:!0})}function La(e,t){if(Fo(e,t)||uo(t,"[data-mp-no-track]")||e.shadowRoot||-1!==e.tagName.indexOf("-")||e.querySelector("slot"))return!1;var n=e.querySelectorAll("*");if(n.length>qo)return!1;for(var r=0;r<n.length;r++)if(n[r].shadowRoot||-1!==n[r].tagName.indexOf("-"))return!1;var i,o,a=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(r=0;r<qo&&a.nextNode();r++){var s=a.currentNode.parentElement;if(s&&Zo(a.currentNode.nodeValue)&&!s.closest(Ta)&&!Ea(a.currentNode,s)&&Qo(s,e)&&zo(s)&&!ka(s,e)&&Da(s)&&(i=a.currentNode,o=void 0,(o=K(document.createRange)?document.createRange():null)&&K(o.getClientRects)&&(o.selectNodeContents(i),Array.from(o.getClientRects()).some((function(e){return e.width>0&&e.height>0})))))return!0}return!1}function Ma(e,t,n){var r=e instanceof HTMLInputElement&&e.parentElement?e.parentElement.closest(io):null;return!!r&&n.contains(r)&&!r.contains(t)&&Qo(r,n)&&zo(r)&&!ka(r,n)&&La(r,e)}function Oa(e,t,n){return e instanceof HTMLInputElement&&t instanceof HTMLInputElement&&e.type===t.type&&!e.getAttribute("name")&&!t.getAttribute("name")&&e.form===t.form&&e.closest(_a)===n&&t.closest(_a)===n&&Ma(e,t,n)&&Ma(t,e,n)&&function(e){if("FIELDSET"===e.tagName)return function(e){var t=Ra(e);return!(!t||Zo(e.getAttribute("aria-label"))||e.getAttribute("aria-labelledby")&&xa(e)!==t)}(e);return!Zo(e.getAttribute("aria-label"))&&Va(e,xa(e))}(n)}function Fa(e,t,n){return e instanceof HTMLInputElement&&!!e.labels&&!uo(e,"[data-mp-no-track]")&&Array.from(e.labels).some((function(r){return n.contains(r)&&!r.contains(t)&&!uo(r,"[data-mp-no-track]")&&Qo(r,n)&&zo(r)&&!ka(r,n)&&Da(r)&&La(r,e)}))}function Ua(e,t){for(var n=e.querySelectorAll(ma),r=0;r<n.length;r++){var i=n[r];if(!i.contains(t)&&!t.contains(i)&&(Aa(i,t)||Oa(i,t,e))&&(Qo(i,e)&&zo(i)&&(!ka(i,e)||Ma(i,t,e))||Fa(i,t,e)))return!0}return!1}function Na(e){if(!(e instanceof HTMLInputElement)){var t=e.matches('[role~="option"]')?e.closest('[role="listbox"]'):e.matches('[role~="radio"]')?e.closest('[role="radiogroup"]'):null;return t&&Ua(t,e)?Ha(t):void 0}for(var n=e.closest(_a);n;){if(Ua(n,e)){var r=Ha(n);if(r||!n.matches('[role="region"]'))return r}n=n.parentElement?n.parentElement.closest(_a):null}}function Ra(e){return"FIELDSET"===e.tagName?Array.from(e.children).filter((function(e){return"LEGEND"===e.tagName}))[0]:void 0}function xa(e){var t=e.getAttribute("aria-labelledby"),n=K(e.getRootNode)?e.getRootNode():document;return t&&n.getElementById?n.getElementById(t.trim().split(/\s+/)[0]):null}function Va(e,t){return!!t&&e.matches('[role="region"]')&&"tab"===(t.getAttribute("role")||"").trim()&&!uo(t,'[role~="tablist"]')&&!t.querySelector(wa)}function Ha(e){var t=Zo(e.getAttribute("aria-label"));if(!t){var n=e.getAttribute("aria-labelledby"),r=Ra(e),i=K(e.getRootNode)?e.getRootNode():document,o=n?xa(e):r||null,a=n&&Va(e,o)?o:null,s=a?a.querySelector('h1, h2, h3, h4, h5, h6, [role="heading"]'):o,u=s?s.closest("label"):null,c=!!s&&Array.from(e.querySelectorAll(ma)).some((function(e){return function(e,t){var n=e instanceof HTMLInputElement&&e.labels?Array.from(e.labels):[];return(e.getAttribute("aria-labelledby")||"").trim().split(/\s+/).forEach((function(e){var r=e&&t.getElementById?t.getElementById(e):null;r&&n.push(r)})),n}(e,i).some((function(e){return s.contains(e)||e.contains(s)}))}));t=!s||c||so(s,(function(e){return e!==a&&e.matches(wa)}))||s.querySelector(wa)||u&&(u.control||u.querySelector(ma))?void 0:Go(s)}return t?Ro(t.split(":")[0]):void 0}var Ka=/(?:^| )(?:pay|payment\w*|tenders?|gateways?)(?: |$)/,qa='[role="radiogroup"], fieldset';function Ba(e){var t=e.getAttribute("name"),n=t?null:e.closest(qa);return(n?[n.getAttribute("id"),n.getAttribute("name"),n.getAttribute("aria-label")]:[t]).some((function(e){return Ka.test(_o(e))}))}function ja(e){var t=[Ro(Xo(e).raw)];return(e instanceof HTMLInputElement&&e.labels?Array.from(e.labels).slice(0,2):[]).forEach((function(n){Qo(n)&&!Fo(n,e)&&(t.push(Ro($o(n))),t.push(Ro(Yo(n))))})),t}function za(e){return e.filter((function(t,n){return!!t&&e.indexOf(t)===n}))}function Qa(e){return za(ja(e).concat(oa(e.getAttribute("id")),la(e,ca)))}function Wa(e){return e instanceof HTMLInputElement?e.checked:"true"===e.getAttribute("aria-checked")}var Ja="(?:(?:express|guest|quick|secure|complete|one-?page|single-?page|mobile)-)?checkouts?(?:-(?:v\\d+|\\d+|flow|external|process|step(?:-\\d+)?))?",$a=new RegExp("(?:^|\\/)(?:"+Ja+"|payment|order|kasse|paiement|commander?|pago)(?:\\/|$)","i"),Ga=new RegExp("(?:^|\\/)"+Ja+"(?:\\/|$)","i"),Ya=/(?:^|[\/_-])(?:thank[-_]?you|thanks|confirmation|confirmed|receipt|received)(?:[\/_-]|$)|(?:^|[\/_-])(?:complete|completed|success)(?:\/|$)/i,Za=/^register(?: now)?$/,Xa=/(?:^|\/)(?:register|registration|login|log-in|signin|sign-in|signup|sign-up|account|create-account)(?:\/|$)/i,es=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"),ts=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("|")),ns=["(?: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("|"),rs=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|"+ns+")$"),is=new RegExp("^(?:(?:place|submit|complete)(?!(?: [^ ]+){0,2} (?:another|new|next)(?: |$))(?: [^ ]+){0,2} (?:order|purchase)|"+ns+")$"),os=new RegExp("^(?:buy now|purchase|register(?: now)?|complete (?:my |your )?registration|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)$"),as=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("|")+")$"),ss=/^save and continue$/,us="(?:(?:my|your|the) )?(?:shopping )?(?:cart|bag|basket)",cs=new RegExp("^add(?: [^ ]+){0,5} to "+us+"$"),ls=new RegExp("^(?:(?:(?:view|open|go to) )?"+us+"(?: items?)?|items? in "+us+")$"),ds="apple pay|google pay|paypal|venmo|amazon pay|shop pay|klarna|afterpay|clearpay|cash app(?: pay)?|affirm|sezzle|samsung pay",ps=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) (?:"+ds+")(?: express(?: checkout)?| checkout)?|(?:continue|proceed|go) (?:to|with) (?:"+ds+"))$"),gs=new RegExp("^(?:"+ds+")(?: (?:checkout|check out|express(?: checkout)?|express pay|buy now|pay now|pay|now)| (?:logo|icon|mark|button)(?: (?:logo|icon|mark|button))*)?$"),fs=/(?:^| )(?:apple ?pay|google ?pay|g ?pay|android ?pay|venmo|pay ?pal|amazon ?pay|shop ?pay|klarna|after ?pay|clear ?pay|affirm|cash ?app|sezzle|samsung ?pay)(?= |$)/,vs={"pay.google.com":"google_pay","applepay.cdn-apple.com":"apple_pay","payments.amazon.com":"amazon_pay","pay.shopify.com":"shop_pay"},hs=new Set(["www.paypal.com","www.sandbox.paypal.com"]),ms=/^\/smart\/(?:buttons|menu)(?:\/|$)/,ys=/^\/smart\/card-fields?(?:\/|$)/,bs=/^__zoid__paypal_/,Ss=/^__zoid__paypal_(?:buttons|menu)__/,Is=/\/elements-inner-(?:payment-request|express-checkout)-/,_s=/\/elements-inner-card\b/,ws=["adyen.com","braintreegateway.com","cybersource.com","squarecdn.com","checkout.com"],Ps=/[\u2019\u2018]/g,Cs=/[0-9\uFF10-\uFF19$\u20AC\u00A3\u00A5\uFFE5\u20B9\u5186.,\uFF0C]/g,As=/\([^()]*\)|\[[^[\]]*\]|\uFF08[^\uFF08\uFF09]*\uFF09|\uFF3B[^\uFF3B\uFF3D]*\uFF3D|\u3010[^\u3010\u3011]*\u3011/g,ks="[\\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]+",Ts=new RegExp("^"+ks+"|"+ks+"$","g");var Es=/[-_|\xb7\u2022]/g,Ds=/(?:^| )(?:usd|aud|cad|nzd|gbp|eur|chf|sgd|hkd|jpy|inr|mxn)(?= |$)|\b(?:a|au|ca|c|us|nz|hk|s)\$/g,Ls=[[/\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 Os(e){if(e&&!(e.length>128)){var t=e.toLowerCase().replace(Ps,"'").replace(/[&+]/g," and ").replace(Es," ").replace(Ds," ").replace(Cs,"").replace(/\s+/g," ").trim();return Ls.forEach((function(e){var n=e[0],r=e[1];t=t.replace(n,r)})),t.split(" ").length>Ms?void 0:t}}function Fs(e){return e.replace(As," ").replace(/\s+/g," ").replace(Ts,"")||e.replace(Ts,"")}function Us(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||Fo(e)?[e.getAttribute("aria-label")]:[e.getAttribute("aria-label"),e.textContent]}function Ns(e,t){return!!t&&t.some((function(t){try{return e.matches(t)}catch(e){return!1}}))}function Rs(e,t){var n=e instanceof HTMLButtonElement||e instanceof HTMLInputElement?e.form:e.closest("form");return Xa.test(t)||!!n&&Array.prototype.some.call(function(e){var t=Object.getOwnPropertyDescriptor(HTMLFormElement.prototype,"elements");return t&&t.get?t.get.call(e):e.elements}(n),(function(e){return e instanceof HTMLInputElement&&"password"===e.type}))}function xs(e,t,n,r){return t?is.test(e):rs.test(e)||os.test(e)&&"checkout_path"===function(e){return $a.test(e)&&!Ya.test(e)?"checkout_path":"other"}(n)&&!(Za.test(e)&&Rs(r,n))}function Vs(e,t,n){var r=ho(e);if("none"!==r){if(r)return ko(e,"wallet"===r)?void 0:{kind:r,source:"vendor"};if(n&&!ko(e,!1)){if(Ns(e,n.commit))return{kind:"commit",source:"selector"};if(Ns(e,n.checkout_step)){var i=Hs(e,t);return!i||"commit"!==i.kind&&"wallet"!==i.kind&&!0!==i.adds?{kind:"checkout_step",source:"selector"}:i}}return Hs(e,t)}}function Hs(e,t){var n,r=Us(e).map(Os).filter((function(e){return!!e})),i=r.map(Fs),o=function(e,t){var n=t.length?void 0:Os(e.getAttribute("title")),r=n?[Fs(n)]:t;return r.some((function(e){return cs.test(e)}))?"add":(e.hasAttribute("aria-expanded")||e.hasAttribute("aria-haspopup"))&&r.some((function(e){return ls.test(e)}))?"open":void 0}(e,i);if("add"===o?n={kind:"cart",source:"label",adds:!0}:"open"===o&&(n={kind:"cart",source:"label"}),!ko(e,!1,!!n)){if(n&&e.hasAttribute("aria-expanded"))return n;var a=e.matches('a[href]:not([role="button"])');if(i.some((function(n){return xs(n,a,t,e)})))return{kind:"commit",source:"label"};if(r.concat(i).some((function(e){return es.test(e)||ts.test(e)})))return n;if(Do(e))return{kind:"wallet",source:"name"};for(var s=!a&&e.matches(io),u=0,c=i;u<c.length;u++){var l=c[u];if(s&&ps.test(l))return{kind:"wallet",source:"label"};if(s&&gs.test(l))return{kind:"wallet",source:"brand"};if(as.test(l)||s&&ss.test(l)&&Ga.test(t)&&!Ya.test(t)&&!Xa.test(t))return{kind:"checkout_step",source:"label"}}return n}}function Ks(e,t){if("visible"===t.document.visibilityState&&e instanceof HTMLIFrameElement&&!(uo(n=e,co)||lo(n)||uo(e,"[data-mp-no-track]"))){var n;if((!e.src||"about:blank"===e.src)&&bs.test(e.name))return Ss.test(e.name)?{kind:"wallet"}:{kind:"frame"};try{var r=new URL(e.src),i="https:"===r.protocol?r.hostname:"";if(hs.has(i))return ms.test(r.pathname)?{kind:"wallet"}:ys.test(r.pathname)?{kind:"frame",family:"card"}:{kind:"frame"};if(Object.prototype.hasOwnProperty.call(vs,i))return{kind:"wallet",family:vs[i]};if("js.stripe.com"===i)return Is.test(r.pathname)?{kind:"wallet"}:_s.test(r.pathname)?{kind:"frame",family:"card"}:{kind:"frame"};if(ws.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 qs="__mpBtn__",Bs=function(){return"undefined"==typeof window?null:window},js=function(){var e=Bs(),t=e?e[qs]:void 0;return t?t.tracker:void 0},zs=function(){var e=Bs();if(e){var t=js();t&&t.teardown(),e[qs]={}}},Qs="__mpApplePayHook__",Ws=function(e){var t=e.ApplePaySession;return t&&t.prototype},Js={capture:!0,passive:!0},$s={passive:!0},Gs=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.drain=function(){var e=t.pending;t.pending=[],e.forEach((function(e){return e()}))},this.onHide=function(e){"beforeunload"!==e.type&&"pagehide"!==e.type&&"hidden"!==document.visibilityState||t.drain()},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=Bs();if(t){var n=js();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,Js),t.document.addEventListener("submit",this.onEvent,Js),t.addEventListener("blur",this.onEvent,$s),t.addEventListener("pageshow",this.onPageShow,$s),t.addEventListener("beforeunload",this.onHide,Js),t.addEventListener("pagehide",this.onHide,Js),t.document.addEventListener("visibilitychange",this.onHide,Js),this.active=!0,t[qs]||(t[qs]={}),t[qs].tracker=this,this.isKitSuppressed()||function(e){try{var t=Ws(e),n=t&&t.begin;if(!K(n)||n[Qs])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=js();i&&i.onApplePayBegin()}catch(e){}return r};Object.defineProperty(r,Qs,{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=Bs();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[qs];t&&t.tracker===this&&(t.tracker=void 0,function(e){try{var t=Ws(e),n=t&&t.begin;K(n)&&K(n[Qs])&&(t.begin=n[Qs])}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},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,a,s,u,c,l,d,p,g,f,v=Date.now(),h=window.location.pathname,m=!1,y=!1;if("click"===n){var b=K(e.composedPath)?e.composedPath().slice(0,20):[],S=Lo(b),I=(L=S?void 0:Mo(b,!0))||(S?void 0:Mo(b,!0,20)||function(e,t){var n=e.slice(0,t).filter((function(e){return e instanceof Element}));if(!n.some((function(e){return e.matches(':disabled, [aria-disabled="true"]')||e.classList.contains("disabled")&&wo(e)})))for(var r=0,i=n;r<i.length;r++){var o=i[r];if(o.matches('[role~="radio"], [role~="menuitemradio"], [role~="checkbox"], [role~="menuitemcheckbox"], [role~="switch"], [role~="option"], [role~="tab"], [role~="link"]'))return o.matches(Oo)||uo(o,oo)?void 0:o;if(o.matches(Oo))return}}(b,20)),_=!1;if(I){var w=r&&(this.logButtons||I.matches("a[href]")),P=i&&this.logLinks&&!this.linkClicksReachKit(),C=w||P?function(e,t){var n;if(void 0===t&&(t=[]),e.matches('a[href]:not([role="button"])')){if(!(n=ha(e)))return}else e.matches("a[href]")&&(n=ha(e))&&"same_page"===n.type&&(n=void 0);var r=Ho(e),i=e instanceof HTMLInputElement&&("checkbox"===e.type||"radio"===e.type)?e:void 0,o=i||Ia(e,t),a=Sa(o)||!!o&&o.matches('[role~="option"]'),s=a?o instanceof HTMLInputElement&&!o.matches('[role~="option"]')?o:null:e,u=!!o||!n&&"wallet"!==r&&e.matches('[role~="link"]')&&!e.matches(io),c=u?void 0:Xo(e),l=c?Ro(c.raw):void 0;return{label:l,labelSource:l?c.source:"none",ariaLabel:u?void 0:Ro(e.getAttribute("aria-label")),icon:o?void 0:ra(e),elementId:a?void 0:oa(e.getAttribute("id")),elementName:(o?ua:oa)(s&&s.getAttribute("name")),testId:a?void 0:la(e,ca),controls:a?void 0:da(e),form:pa(e),group:o?Na(o):void 0,element:r,type:fa(e),linkType:n?n.type:void 0,linkDomain:n?n.domain:void 0,linkPath:n?n.path:void 0,fileExtension:n?n.fileExtension:void 0,checked:i?i.checked:void 0}}(I,b):void 0,A=this.logLinks&&!!C&&function(e){return!!e.linkType&&"same_page"!==e.linkType}(C);if(_=P&&A,o=w?C:void 0){m=A;var k=this.logButtons&&!m&&!("internal"===o.linkType&&I.matches('a[href]:not([role="button"])'));m||k||(o=void 0)}o&&void 0!==o.checked&&(a=I)}if(L&&!_){var T=i?Vs(L,h,this.checkoutIntentSelectors()):void 0;if(s=T?T.kind:void 0,u=T?T.source:void 0,c=T?T.adds:void 0,l=i?function(e,t){void 0===t&&(t=[]);var n=Ia(e,t);if(Sa(n)&&!uo(n,"[data-mp-no-track]")&&Ba(n)){var r=Qa(n);return r.length?{radio:n,names:r}:void 0}}(L,b):void 0,!(l||"commit"!==s&&"checkout_step"!==s||function(e,t){return(t?[t.label,t.ariaLabel,t.elementId,t.elementName,t.testId]:Us(e).concat(["id","name"].concat(ca).map((function(t){return e.getAttribute(t)})))).some((function(e){return fs.test(function(e){return(e||"").replace(/([a-z])([A-Z])/g,"$1 $2").toLowerCase().replace(/[^a-z]+/g," ").trim()}(e))}))}(L,o))){var E=(g=Array.from(document.querySelectorAll('input[type="radio"]:checked, [role~="radio"][aria-checked="true"], [role~="menuitemradio"][aria-checked="true"]')).filter((function(e){return Wa(e)&&"true"!==e.getAttribute("aria-hidden")&&!uo(e,"[data-mp-no-track]")&&Ba(e)})),f=g.filter((function(e){return!g.some((function(t){return t!==e&&e.contains(t)}))})).map((function(e){var t=za(ja(e)),n=Qa(e);return{radio:e,names:n,option:(t.length?t:n).join("\n")}})),1===new Set(f.map((function(e){return e.option}))).size&&f[0].names.length?{radio:f[0].radio,names:f[0].names}:void 0);d=E?E.names:void 0}}this.lastClick={t:v,excluded:S||_,kind:s,source:u}}else if("submit"===n){var D=e.submitter,L=D?Mo([D]):void 0;if(D){if(L){T=Vs(L,h,this.checkoutIntentSelectors());s=T?T.kind:void 0,u=T?T.source:void 0,c=T?T.adds:void 0}}else s="commit",u="submit";y=!D}var M=this.generation;this.enqueue((function(){if(M===t.generation)try{if("blur"===n){var i=Ks(document.activeElement,window);s=i?i.kind:void 0,p=i?i.family:void 0,u="frame"}else y&&v-t.lastCommitClick>1e3&&(s=void 0);o&&r&&(a&&e.defaultPrevented&&(o.checked="checkbox"===a.type?!o.checked:a.checked),t.logClick(o,h,m)),l&&Wa(l.radio)?t.pickPayment(v,h,l.names):d?t.pickPayment(v,h,d):p&&t.pickPayment(v,h,void 0,p),s&&t.emit(s,u,n,v,h,c)}catch(e){t.log("[error] delivery threw: "+e)}}))}}},e.prototype.logClick=function(e,t,n){this.eventsEnabled()&&!this.hasTargetingOptOut()&&(t!==this.pagePath&&(this.pagePath=t,this.pageEvents=0),this.pageEvents>=100||(this.pageEvents++,this.mpInstance._SessionManager.resetSessionTimer(),this.mpInstance._Events.logEvent(n?function(e,t){var n=to("internal"===e.linkType&&"link"===e.element?p(p({},e),{label:void 0,labelSource:"none",ariaLabel:void 0}):e,t);return n[Xi]=!0,{messageType:oe.PageEvent,name:eo,data:n,eventType:ae.Other}}(e,t):function(e,t){var n=to(e,t);return n[Yi]=!0,{messageType:oe.PageEvent,name:Zi,data:n,eventType:ae.Other}}(e,t))))},e.prototype.emit=function(e,t,n,r,i,o){if(!this.isKitSuppressed()){"commit"===e&&"click"===n&&(this.lastCommitClick=r);var a=o?e+":adds":e,s=this.lastSent[a];s&&s.pathname===i&&r-s.t<2e3||(this.lastSent[a]={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.checkoutIntentSelectors=function(){var e=this.mpInstance._RoktManager;return e?e.getCheckoutIntentSelectors():void 0},e.prototype.linkClicksReachKit=function(){var e=this.mpInstance._RoktManager;return!!e&&e.areAutoLinkClicksForwarded()},e.prototype.log=function(e){this.mpInstance.Logger.verbose("mParticle button tracking: "+e)},e}(),Ys=r.Messages,Zs=r.HTTPCodes,Xs=r.FeatureFlags,eu=r.CaptureIntegrationSpecificIdsV2Modes,tu=Xs.ReportBatching,nu=Xs.CaptureIntegrationSpecificIds,ru=Xs.CaptureIntegrationSpecificIdsV2,iu=Ys.InformationMessages.StartingInitialization;function ou(e){var t=this;this._instanceName=e,this._NativeSdkHelpers=new Ar(this),this._SessionManager=new Or(this),this._Persistence=new Gr(this),this._Helpers=new Ir(this),this._Events=new Zr(this),this._CookieSyncManager=new Er(this),this._ServerModel=new mi(this),this._Ecommerce=new Ur(this),this._ForwardingStatsUploader=new yi(this),this._Consent=new Fi(this),this._IdentityAPIClient=new zi(this),this._preInit={readyQueue:[],integrationDelays:{},forwarderConstructors:[]},this._ErrorReportingDispatcher=new $i,this._LoggingDispatcher=new Gi,this._RoktManager=new Wi(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=Si(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())&&!vr(t._Store)&&(t._preInit.readyQueue=Si(t._preInit.readyQueue,t.Logger))},this.IdentityType=ue,this.EventType=ae,this.CommerceEventType=se,this.PromotionType=de,this.ProductActionType=ce,this.RoktEvents=le,this._Identity=new Mi(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 qr(n),e._ErrorReportingDispatcher.logger=e.Logger,e._LoggingDispatcher.logger=e.Logger,e._Store=new xr(n,e,t),window.mParticle.Store=e._Store,zs(),e.Logger.verbose(iu);var r=Rr(null==n?void 0:n.launcherOptions),i=r.noFunctional,o=r.noTargeting,a=r.doNotShareOrSell;e._CookieConsentManager=new Ji({noFunctional:i,noTargeting:o,doNotShareOrSell:a});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 Ki(e,t,this).getSDKConfiguration().then((function(r){var i=re({},t,r);au(e,i,n)})):au(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(),zs(),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 $i,n._LoggingDispatcher=new Gi,n.Logger=new qr(e),n._ErrorReportingDispatcher.logger=n.Logger,n._LoggingDispatcher.logger=n.Logger,n._Store=new xr(e,n),n._Store.isLocalStorageAvailable=n._Persistence.determineLocalStorageAvailability(window.localStorage),n._Events.stopTracking(),fn(),n._PageViewTracker=void 0,zs(),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())&&!vr(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){su((function(){t.setAppVersion(e)}),t)||(t._Store.SDKConfig.appVersion=e,t._Persistence.update())},this.setDeviceId=function(e){su((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){su((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){su((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){su((function(){t.logBaseEvent(e,n)}),t)||(t._SessionManager.resetSessionTimer(),"string"==typeof e.name?(e.eventType||(e.eventType=ae.Unknown),t._Helpers.canLog()?t._Events.logEvent(e,n):t.Logger.error(Ys.ErrorMessages.LoggingDisabled)):t.Logger.error(Ys.ErrorMessages.EventNameInvalidType))},this.logEvent=function(e,n,r,i,o){su((function(){t.logEvent(e,n,r,i,o)}),t)||(t._SessionManager.resetSessionTimer(),"string"==typeof e?(n||(n=ae.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(Ys.ErrorMessages.LoggingDisabled):t.Logger.error("Invalid event type: "+n+", must be one of: \n"+JSON.stringify(ae))):t.Logger.error(Ys.ErrorMessages.EventNameInvalidType))},this.logError=function(e,n){if(!su((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:ae.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(!su((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(!P(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&&!P(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:ae.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){su((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,a,s,u,c,l){return t._Ecommerce.createProduct(e,n,r,i,o,a,s,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,a){return t._Ecommerce.createTransactionAttributes(e,n,r,i,o,a)},logProductAction:function(e,n,r,i,o,a){su((function(){t.eCommerce.logProductAction(e,n,r,i,o,a)}),t)||(t._SessionManager.resetSessionTimer(),t._Events.logProductActionEvent(e,n,r,i,o,a))},logPurchase:function(e,n,r,i,o){Lr({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(Ys.ErrorMessages.BadLogPurchase):t.ready((function(){t.eCommerce.logPurchase(e,n,r,i,o)}))},logPromotion:function(e,n,r,i,o){su((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){su((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())&&!vr(t._Store))&&su((function(){t.setSessionAttribute(e,n)}),t))return;if(t._Helpers.canLog()){if(!t._Helpers.Validators.isValidAttributeValue(n))return void t.Logger.error(Ys.ErrorMessages.BadAttribute);if(!t._Helpers.Validators.isValidKeyValue(e))return void t.Logger.error(Ys.ErrorMessages.BadKey);if(t._Store.webviewBridgeEnabled)t._NativeSdkHelpers.sendToNative(r.NativeSdkPaths.SetSessionAttribute,JSON.stringify({key:e,value:n}));else{var o=S(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){su((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(!su((function(){t.setIntegrationAttribute(e,n)}),t))if("number"==typeof e){if(null===n)t._Store.integrationAttributes[e]={};else{if(!P(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]?(P(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){su((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 au(e,t,n){var i,o,a,s,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 Vi(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 mr(n,u),n._Forwarders=new gi(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 xn("".concat(e._Store.storageName,"-id-cache"));return new Nn("".concat(e._Store.storageName,"-id-cache"))}(n),ur(n._Identity.idCache),n._Store.webviewBridgeEnabled)n._NativeSdkHelpers.initializeSessionAttributes(e),zs(),n._RoktManager.setAutoButtonClicksForwarded(!1),n._RoktManager.setAutoLinkClicksForwarded(!1);else{n._Persistence.initializeStorage(),n._Store.syncPersistenceData();var f=n.Identity.getCurrentUser(),v=f?f.getMPID():null,h=f?f.getUserIdentities().userIdentities:{};if(n._Store.SDKConfig.identifyRequest=n._Store.hasInvalidIdentifyRequest()?{userIdentities:h}:n._Store.SDKConfig.identifyRequest,c(tu)&&n._ForwardingStatsUploader.startForwardingStatsTimer(),Qe(c)){var m=c(nu),y=c(ru),b=void 0;m||y===eu.All?b="all":y===eu.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 ti(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?ro(S,u):void 0,k=S&&C?ro(S,u,!0):void 0;P&&(A||k)&&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 skips link clicks: the ".concat(k," keeps some or all Auto Link Click events from the Rokt kit.")),n._RoktManager.setAutoButtonClicksForwarded(!!S&&!A),n._RoktManager.setAutoLinkClicksForwarded(!!S&&!k),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 mn(n,{isAutoPageView:!0})),pn()?n.Logger.verbose("mParticle APV: [sdk-init] initial page view already logged this page load, skipping"):(gn(),n._Events.logPageView({isAutoPageView:!0})),n._PageViewTracker.init()):n._PageViewTracker&&n._PageViewTracker.teardown(),P||C?(n._ButtonTracker||(n._ButtonTracker=new Gs(n)),n._ButtonTracker.init({hasRoktKit:!!S,logButtons:P,logLinks:C})):zs(),function(e,t,n,r){!e._Store.identifyCalled&&e._Store.SDKConfig.identityCallback&&t&&n&&e._Store.SDKConfig.identityCallback({httpCode:Zs.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,f,v,h)}(n._Store.mpid&&!n._Store.identifyCalled||n._Store.webviewBridgeEnabled)&&(n._Store.isInitialized=!0,null===(a=n._CookieConsentManager)||void 0===a||a.syncNoTargetingAttribute(n.Identity.getCurrentUser()),n._preInit.readyQueue=Si(n._preInit.readyQueue,n.Logger)),null===(s=n.processQueueOnNoFunctional)||void 0===s||s.call(n),n._Store.isFirstRun&&(n._Store.isFirstRun=!1)}function su(e,t){var n,r,i=(null===(n=t._CookieConsentManager)||void 0===n?void 0:n.getNoFunctional())&&!vr(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 uu=function(){return null},cu=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:uu,parseNumber:uu,isObject:uu,Validators:null},_resetForTests:uu,_APIClient:null,_timeOnSiteTimer:{getTimeInForeground:uu},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:uu},getTotalTimeOnSite:uu},config:null,eCommerce:null,Identity:{getCurrentUser:uu,IdentityAPI:{},identify:uu,login:uu,logout:uu,modify:uu},Logger:{verbose:uu,error:uu,warning:uu},ProductActionType:null,ServerModel:null,addForwarder:uu,generateHash:uu,getAppVersion:uu,getAppName:uu,getInstance:uu,getDeviceId:uu,init:uu,logBaseEvent:uu,logEvent:uu,logLevel:"none",setPosition:uu,upload:uu}},e.prototype.createSDKEventFunction=function(e){return new mi(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}(),lu=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=yr.hashEventType(e);this.filterDictionary.eventTypeFilters.push(t)},e.prototype.addEventNameFilter=function(e,t){var n=yr.hashEventName(t,e);this.filterDictionary.eventNameFilters.push(n)},e.prototype.addEventAttributeFilter=function(e,t,n){var r=yr.hashEventAttributeKey(e,t,n);this.filterDictionary.attributeFilters.push(r)},e.prototype.addScreenNameFilter=function(e){var t=yr.hashEventName(e,ae.Unknown);this.filterDictionary.screenNameFilters.push(t)},e.prototype.addScreenAttributeFilter=function(e,t){var n=yr.hashEventAttributeKey(ae.Unknown,e,t);this.filterDictionary.screenAttributeFilters.push(n)},e.prototype.addUserIdentityFilter=function(e){var t=yr.hashUserIdentity(e);this.filterDictionary.userIdentityFilters.push(t)},e.prototype.addUserAttributeFilter=function(e){var t=yr.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 du=new function(){var e=this;this.Store={},this._instances={},this.IdentityType=ue,this.EventType=ae,this.CommerceEventType=se,this.PromotionType=de,this.ProductActionType=ce,this.RoktEvents=le,this.MPSideloadedKit=lu,"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 ou(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 ou(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,a,s,u,c,l){return e.getInstance().eCommerce.createProduct(t,n,r,i,o,a,s,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,a){return e.getInstance().eCommerce.createTransactionAttributes(t,n,r,i,o,a)},logProductAction:function(t,n,r,i,o,a){e.getInstance().eCommerce.logProductAction(t,n,r,i,o,a)},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=On,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=du,window.mParticle._BatchValidator=new cu),module.exports=du;