UNPKG

@apptimize/apptimize-web-sdk

Version:

Apptimize Client SDK for Web

2 lines 230 kB
// Copyright (c) Apptimize, Inc. | https://sdk.apptimize.com/license !function(e,i){"use strict";var t,r={},n=function(){return or.__string_rec(this,"")},w=w||{};function a(e,t){var r=Object.create(e);for(var i in t)r[i]=t[i];return t.toString!==Object.prototype.toString&&(r.toString=t.toString),r}var z=e.Apptimize=function(){};(r["apptimize.Apptimize"]=z).__name__="apptimize.Apptimize",z._isInitialized=function(){return g._isInitialized()},z.setCustomerUserId=e.setCustomerUserId=function(e){(!it.isNullOrString(e)||null!=e&&""==j.ltrim(e))&&(d.w("The `customerUserID` argument cannot be set to a non-string value, be empty or be whitespace only, setting to null instead.",{fileName:"src/apptimize/Apptimize.hx",lineNumber:71,className:"apptimize.Apptimize",methodName:"setCustomerUserId"}),e=null);var t=z.getCustomerUserId();if(null==t||t!=e)if(null!=t||null!=e){var r=z.getApptimizeAnonUserId(),i=new le(t,r,Ge.loadObject(Ge.kCustomPropertiesKey),C.getAppKey(),je.sharedInstance(),Xe.sharedInstance()),n=new le(e,r,null,C.getAppKey(),je.sharedInstance(),Xe.sharedInstance()),a=C.sharedInstance();z._isInitialized()&&a.dispatchUnenrollmentsForUserChanged(i),Ge.saveString(Ge.kUserIDKey,e),z.setMixpanelCohortId(e),z.setCustomAttributes(null);var s=C.sharedInstance().getMetaData(C.getAppKey());null!=s&&s.clearAlterationCache(),z._isInitialized()&&(a.logUserTransition(i,n),a.dispatchEnrollmentsForUserChanged(n)),d.v("Customer User ID set to: "+e,{fileName:"src/apptimize/Apptimize.hx",lineNumber:115,className:"apptimize.Apptimize",methodName:"setCustomerUserId"})}else d.w("Ignoring redundant setCustomerUserId(null)",{fileName:"src/apptimize/Apptimize.hx",lineNumber:83,className:"apptimize.Apptimize",methodName:"setCustomerUserId"});else d.w("Not setting customerUserId if ID already set.",{fileName:"src/apptimize/Apptimize.hx",lineNumber:79,className:"apptimize.Apptimize",methodName:"setCustomerUserId"})},z.setMixpanelCohortId=function(e){var t;t=null==e?null:"i_"+e,Xe.sharedInstance().setPropertyForNamespace("_cohort_id",t,Je.Mixpanel)},z.getCustomerUserId=e.getCustomerUserId=function(){var e=Ge.loadString(Ge.kUserIDKey);return(!it.isNullOrString(e)||null!=e&&""==j.ltrim(e))&&(d.w("Invalid CustomerUserId saved. Resetting to null.",{fileName:"src/apptimize/Apptimize.hx",lineNumber:142,className:"apptimize.Apptimize",methodName:"getCustomerUserId"}),e=null),e},z.getApptimizeAnonUserId=e.getApptimizeAnonUserId=function(){return z._getApptimizeAnonUserId()},z.setCustomAttributes=e.setCustomAttributes=function(e){var t=lt.nativeObjectToStringMap(e);Ge.saveStringMap(Ge.kCustomPropertiesKey,t);var r=Ge.loadStringMap(Ge.kCustomPropertiesKey);d.v("Custom Attributes:\n"+(null==r?"null":D.stringify(r.h)),{fileName:"src/apptimize/Apptimize.hx",lineNumber:174,className:"apptimize.Apptimize",methodName:"setCustomAttributes"}),C.sharedInstance().onEnvPropsChanged(C.getAppKey())},z.getCustomAttributes=e.getCustomAttributes=function(){return lt.stringMapToNativeDictionary(Ge.loadStringMap(Ge.kCustomPropertiesKey))},z.setPilotTargetingId=e.setPilotTargetingId=function(e){it.isNullOrString(e)?(Xe.sharedInstance().setPropertyForNamespace("pilot_targeting_id",e,Je.ApptimizeLocal),C.sharedInstance().onEnvPropsChanged(C.getAppKey())):d.e("Invalid PilotTargetingId. Id not set. Please use a valid string.",{fileName:"src/apptimize/Apptimize.hx",lineNumber:206,className:"apptimize.Apptimize",methodName:"setPilotTargetingId"})},z.getPilotTargetingId=e.getPilotTargetingId=function(){return Xe.sharedInstance().valueForNamespacedProperty("pilot_targeting_id",Je.ApptimizeLocal)},z.setOnEnrolledInExperimentCallback=e.setOnEnrolledInExperimentCallback=function(e){H.setOnEnrolledInExperimentCallback(e),d.v("OnEnrolledInExperimentCallback set!",{fileName:"src/apptimize/Apptimize.hx",lineNumber:233,className:"apptimize.Apptimize",methodName:"setOnEnrolledInExperimentCallback"})},z.setOnUnenrolledInExperimentCallback=e.setOnUnenrolledInExperimentCallback=function(e){H.setOnUnenrolledInExperimentCallback(e),d.v("OnUnenrolledInExperimentCallback set!",{fileName:"src/apptimize/Apptimize.hx",lineNumber:244,className:"apptimize.Apptimize",methodName:"setOnUnenrolledInExperimentCallback"})},z._getApptimizeAnonUserId=function(){var e=Ge.loadString(Ge.kAnonymousGuidKey);return null!=e&&""!=e&&q.isValidGuid(e)||(e=q.generateUserGuid(),Ge.saveString(Ge.kAnonymousGuidKey,e)),e},z.setAppVersion=e.setAppVersion=function(e){je.sharedInstance().setProperty("app_version",e);var t=je.sharedInstance().valueForProperty("app_version");d.v("App Version set to: "+t,{fileName:"src/apptimize/Apptimize.hx",lineNumber:267,className:"apptimize.Apptimize",methodName:"setAppVersion"})},z.setAppName=e.setAppName=function(e){je.sharedInstance().setProperty("app_name",e);var t=je.sharedInstance().valueForProperty("app_name");d.v("App Name set to: "+t,{fileName:"src/apptimize/Apptimize.hx",lineNumber:278,className:"apptimize.Apptimize",methodName:"setAppName"})},z.setOnParticipationCallback=e.setOnParticipationCallback=function(e){H.setOnParticipationCallback(e),d.w("setOnParticipationCallback is deprecated - please use setOnParticipatedInExperimentCallback.",{fileName:"src/apptimize/Apptimize.hx",lineNumber:299,className:"apptimize.Apptimize",methodName:"setOnParticipationCallback"})},z.setOnMetadataUpdatedCallback=e.setOnMetadataUpdatedCallback=function(e){H.setOnMetadataUpdatedCallback(e),d.v("OnMetadataProcessedCallback set!",{fileName:"src/apptimize/Apptimize.hx",lineNumber:318,className:"apptimize.Apptimize",methodName:"setOnMetadataUpdatedCallback"})},z.setOnApptimizeInitializedCallback=e.setOnApptimizeInitializedCallback=function(e){H.setOnApptimizeInitializedCallback(e),d.v("OnApptimizeInitializedCallback set!",{fileName:"src/apptimize/Apptimize.hx",lineNumber:339,className:"apptimize.Apptimize",methodName:"setOnApptimizeInitializedCallback"})},z.setOnParticipatedInExperimentCallback=e.setOnParticipatedInExperimentCallback=function(e){H.setOnParticipatedInExperimentCallback(e),d.v("OnParticipatedInExperimentCallback set!",{fileName:"src/apptimize/Apptimize.hx",lineNumber:357,className:"apptimize.Apptimize",methodName:"setOnParticipatedInExperimentCallback"})},z.setup=e.setup=function(e,t){null!=e&&""!=e?null==C.getAppKey()||C.getAppKey()!=e?g._setup(e,t,function(){null!=C.getAppKey()&&C.getAppKey()!=e&&C.clear(),d.v("Set Anonymous User ID: "+z._getApptimizeAnonUserId(),{fileName:"src/apptimize/Apptimize.hx",lineNumber:427,className:"apptimize.Apptimize",methodName:"setup"}),d.i("Apptimize "+z.getApptimizeSDKPlatform()+" SDK initialized.\nApptimize SDK Version: "+z.getApptimizeSDKVersion(),{fileName:"src/apptimize/Apptimize.hx",lineNumber:428,className:"apptimize.Apptimize",methodName:"setup"}),z._initialize(e)}):d.w('Apptimize is already initialized with app key: "'+e+'".',{fileName:"src/apptimize/Apptimize.hx",lineNumber:416,className:"apptimize.Apptimize",methodName:"setup"}):d.c("Unable to initialize Apptimize due to missing app key.",{fileName:"src/apptimize/Apptimize.hx",lineNumber:413,className:"apptimize.Apptimize",methodName:"setup"})},z.updateApptimizeMetadataOnce=e.updateApptimizeMetadataOnce=function(){try{C.checkForUpdatedMetaData(!0)}catch(e){gt.lastError=e;var t=ct.caught(e).unwrap();d.e("Failed to update Metadata: "+O.string(t),{fileName:"src/apptimize/Apptimize.hx",lineNumber:460,className:"apptimize.Apptimize",methodName:"updateApptimizeMetadataOnce"})}},z.flushTracking=e.flushTracking=function(){z._isInitialized()?C.sharedInstance().flushTracking():d.w("Tracking can only be flushed after setup().",{fileName:"src/apptimize/Apptimize.hx",lineNumber:475,className:"apptimize.Apptimize",methodName:"flushTracking"})},z.getApptimizeSDKVersion=e.getApptimizeSDKVersion=function(){return"1.2.44"},z.getApptimizeSDKPlatform=e.getApptimizeSDKPlatform=function(){return"JavaScript"},z._initialize=function(e){C.sharedInstance().loadMetaData(e),g.setState(2),C.sharedInstance().hasMetadata(C.getAppKey())&&0==He.sharedInstance().valueForProperty(He.REFRESH_META_DATA_ON_SETUP)&&g._trySetReady()&&(H.dispatchOnApptimizeInitialized(),d.i('Apptimize initialized with app key "'+e+'".',{fileName:"src/apptimize/Apptimize.hx",lineNumber:532,className:"apptimize.Apptimize",methodName:"_initialize"}))},z._getAlterations=function(e,t){if(C._checkForUpdatedMetadataIfNecessary(),z._isInitialized()){var r=new le(e,z._getApptimizeAnonUserId(),t,C.getAppKey(),je.sharedInstance(),Xe.sharedInstance());return g._getAlterations(r)}return[]},z._getCodeBlockMethod=function(e,t,r){C._checkForUpdatedMetadataIfNecessary();var i=new le(t,z._getApptimizeAnonUserId(),r,C.getAppKey(),je.sharedInstance(),Xe.sharedInstance());return g._getCodeBlockMethod(i,e)},z.runCodeBlock=e.runCodeBlock=function(e,t,r,i){null!=r?(d.w("The `userID` argument is deprecated. Please use the `setCustomerUserId()` method instead.",{fileName:"src/apptimize/macros/ABTClientMacro.hx",lineNumber:19,className:"apptimize.Apptimize",methodName:"runCodeBlock"}),it.isString(r)&&""!=j.ltrim(r)||(d.w("The `userID` argument cannot be set to a non-string value, be empty or be whitespace only, setting to null instead.",{fileName:"src/apptimize/macros/ABTClientMacro.hx",lineNumber:21,className:"apptimize.Apptimize",methodName:"runCodeBlock"}),r=null)):r=z.getCustomerUserId(),null!=i&&d.w("The `customAttributes` argument is deprecated. Please use the `setCustomAttributes()` method instead.",{fileName:"src/apptimize/macros/ABTClientMacro.hx",lineNumber:31,className:"apptimize.Apptimize",methodName:"runCodeBlock"}),null==i&&(i=z.getCustomAttributes());var n=lt.nativeObjectToStringMap(i),a=z._getCodeBlockMethod(e,r,n),s=lt.nativeObjectToStringMap(t);if(null!=a&&""!=a)if(null==t||null==s.h[a]){var l=k.getProperty(t,a);null!=l?l.apply(t,[]):d.w("Supplied callbacks do not include method: "+a,{fileName:"src/apptimize/Apptimize.hx",lineNumber:635,className:"apptimize.Apptimize",methodName:"runCodeBlock"})}else{d.v("Calling callback method: "+a,{fileName:"src/apptimize/Apptimize.hx",lineNumber:638,className:"apptimize.Apptimize",methodName:"runCodeBlock"});var o=s.h[a];if(!k.isFunction(o))return void d.e("runCodeBlock() called with callback that isn't a function/method.",{fileName:"src/apptimize/Apptimize.hx",lineNumber:642,className:"apptimize.Apptimize",methodName:"runCodeBlock"});o()}else d.w("No Code Block with variable name "+e+" found, skipping callback.",{fileName:"src/apptimize/Apptimize.hx",lineNumber:627,className:"apptimize.Apptimize",methodName:"runCodeBlock"})},z.isFeatureFlagEnabled=e.isFeatureFlagEnabled=function(e,t,r){return z.getBool(e,!1,t,r)},z.getString=e.getString=function(e,t,r,i){var n=z._getValue(e,r,c.String,null,i);return null==n?t:n},z.getBool=e.getBool=function(e,t,r,i){var n=z._getValue(e,r,c.Boolean,null,i);return null==n?t:n},z.getInt=e.getInt=function(e,t,r,i){var n=z._getValue(e,r,c.Integer,null,i);return null==n?t:n},z.getDouble=e.getDouble=function(e,t,r,i){var n=z._getValue(e,r,c.Double,null,i);return null==n?t:n},z.getStringArray=e.getStringArray=function(e,t,r,i){var n=z._getValue(e,r,c.Array,c.String,i);return null==n?t:st.toNativeArray(n,at.String)},z.getBoolArray=e.getBoolArray=function(e,t,r,i){var n=z._getValue(e,r,c.Array,c.Boolean,i);return null==n?t:st.toNativeArray(n,at.Bool)},z.getIntArray=e.getIntArray=function(e,t,r,i){var n=z._getValue(e,r,c.Array,c.Integer,i);return null==n?t:st.toNativeArray(n,at.Int)},z.getDoubleArray=e.getDoubleArray=function(e,t,r,i){var n=z._getValue(e,r,c.Array,c.Double,i);return null==n?t:st.toNativeArray(n,at.Double)},z.getStringDictionary=e.getStringDictionary=function(e,t,r,i){var n=z._getValue(e,r,c.Dictionary,c.String,i);return null==n?t:n},z.getBoolDictionary=e.getBoolDictionary=function(e,t,r,i){var n=z._getValue(e,r,c.Dictionary,c.Boolean,i);return null==n?t:n},z.getIntDictionary=e.getIntDictionary=function(e,t,r,i){var n=z._getValue(e,r,c.Dictionary,c.Integer,i);return null==n?t:n},z.getDoubleDictionary=e.getDoubleDictionary=function(e,t,r,i){var n=z._getValue(e,r,c.Dictionary,c.Double,i);return null==n?t:n},z._getValue=function(e,t,r,i,n){if(!z._isInitialized())return null;null!=t?(d.w("The `userID` argument is deprecated. Please use the `setCustomerUserId()` method instead.",{fileName:"src/apptimize/macros/ABTClientMacro.hx",lineNumber:19,className:"apptimize.Apptimize",methodName:"_getValue"}),it.isString(t)&&""!=j.ltrim(t)||(d.w("The `userID` argument cannot be set to a non-string value, be empty or be whitespace only, setting to null instead.",{fileName:"src/apptimize/macros/ABTClientMacro.hx",lineNumber:21,className:"apptimize.Apptimize",methodName:"_getValue"}),t=null)):t=z.getCustomerUserId(),null!=n&&d.w("The `customAttributes` argument is deprecated. Please use the `setCustomAttributes()` method instead.",{fileName:"src/apptimize/macros/ABTClientMacro.hx",lineNumber:31,className:"apptimize.Apptimize",methodName:"_getValue"}),null==n&&(n=z.getCustomAttributes());var a=lt.nativeObjectToStringMap(n),s=new le(t,z._getApptimizeAnonUserId(),a,C.getAppKey(),je.sharedInstance(),Xe.sharedInstance());return m.getValue(s,e,r,i)},z.getVariantInfo=e.getVariantInfo=function(e,t){null!=e?(d.w("The `userID` argument is deprecated. Please use the `setCustomerUserId()` method instead.",{fileName:"src/apptimize/macros/ABTClientMacro.hx",lineNumber:19,className:"apptimize.Apptimize",methodName:"getVariantInfo"}),it.isString(e)&&""!=j.ltrim(e)||(d.w("The `userID` argument cannot be set to a non-string value, be empty or be whitespace only, setting to null instead.",{fileName:"src/apptimize/macros/ABTClientMacro.hx",lineNumber:21,className:"apptimize.Apptimize",methodName:"getVariantInfo"}),e=null)):e=z.getCustomerUserId(),null!=t&&d.w("The `customAttributes` argument is deprecated. Please use the `setCustomAttributes()` method instead.",{fileName:"src/apptimize/macros/ABTClientMacro.hx",lineNumber:31,className:"apptimize.Apptimize",methodName:"getVariantInfo"}),null==t&&(t=z.getCustomAttributes());for(var r=[],i=z._getApptimizeAnonUserId(),n=lt.nativeObjectToStringMap(t),a=new le(e,i,n,C.getAppKey(),je.sharedInstance(),Xe.sharedInstance()),s=0,l=g._getVariants(a,!1);s<l.length;){var o=l[s];++s,r.push(B.initWithVariant(o,e,i))}return st.toNativeArray(r,at.VariantInfo)},z.getWinnerVariantInfo=e.getWinnerVariantInfo=function(){return g.getWinnerVariantInfo(z.getCustomerUserId(),z._getApptimizeAnonUserId(),z.getCustomAttributes())},z._getVariantInfoForAlteration=function(e,t,r){for(var i=z._getApptimizeAnonUserId(),n=0,a=z._getAlterations(t,r);n<a.length;){var s=a[n];if(++n,s.getKey()==e)return B.initWithVariant(s.getVariant(),t,i)}return null},z._getVariantInfoForDynamicVariable=function(e,t,r){null!=t?(d.w("The `userID` argument is deprecated. Please use the `setCustomerUserId()` method instead.",{fileName:"src/apptimize/macros/ABTClientMacro.hx",lineNumber:19,className:"apptimize.Apptimize",methodName:"_getVariantInfoForDynamicVariable"}),it.isString(t)&&""!=j.ltrim(t)||(d.w("The `userID` argument cannot be set to a non-string value, be empty or be whitespace only, setting to null instead.",{fileName:"src/apptimize/macros/ABTClientMacro.hx",lineNumber:21,className:"apptimize.Apptimize",methodName:"_getVariantInfoForDynamicVariable"}),t=null)):t=z.getCustomerUserId(),null!=r&&d.w("The `customAttributes` argument is deprecated. Please use the `setCustomAttributes()` method instead.",{fileName:"src/apptimize/macros/ABTClientMacro.hx",lineNumber:31,className:"apptimize.Apptimize",methodName:"_getVariantInfoForDynamicVariable"}),null==r&&(r=z.getCustomAttributes());var i=lt.nativeObjectToStringMap(r);return z._getVariantInfoForAlteration(e,t,i)},z._getVariantInfoForExperiment=function(e,t,r){null!=t?(d.w("The `userID` argument is deprecated. Please use the `setCustomerUserId()` method instead.",{fileName:"src/apptimize/macros/ABTClientMacro.hx",lineNumber:19,className:"apptimize.Apptimize",methodName:"_getVariantInfoForExperiment"}),it.isString(t)&&""!=j.ltrim(t)||(d.w("The `userID` argument cannot be set to a non-string value, be empty or be whitespace only, setting to null instead.",{fileName:"src/apptimize/macros/ABTClientMacro.hx",lineNumber:21,className:"apptimize.Apptimize",methodName:"_getVariantInfoForExperiment"}),t=null)):t=z.getCustomerUserId(),null!=r&&d.w("The `customAttributes` argument is deprecated. Please use the `setCustomAttributes()` method instead.",{fileName:"src/apptimize/macros/ABTClientMacro.hx",lineNumber:31,className:"apptimize.Apptimize",methodName:"_getVariantInfoForExperiment"}),null==r&&(r=z.getCustomAttributes());for(var i=z._getApptimizeAnonUserId(),n=lt.nativeObjectToStringMap(r),a=new le(t,i,n,C.getAppKey(),je.sharedInstance(),Xe.sharedInstance()),s=0,l=g._getVariants(a);s<l.length;){var o=l[s];if(++s,o.getExperimentName()==e)return B.initWithVariant(o,t,i)}return null},z.track=e.track=function(e,t,r){if(z._isInitialized()){null!=t?(d.w("The `userID` argument is deprecated. Please use the `setCustomerUserId()` method instead.",{fileName:"src/apptimize/macros/ABTClientMacro.hx",lineNumber:19,className:"apptimize.Apptimize",methodName:"track"}),it.isString(t)&&""!=j.ltrim(t)||(d.w("The `userID` argument cannot be set to a non-string value, be empty or be whitespace only, setting to null instead.",{fileName:"src/apptimize/macros/ABTClientMacro.hx",lineNumber:21,className:"apptimize.Apptimize",methodName:"track"}),t=null)):t=z.getCustomerUserId(),null!=r&&d.w("The `customAttributes` argument is deprecated. Please use the `setCustomAttributes()` method instead.",{fileName:"src/apptimize/macros/ABTClientMacro.hx",lineNumber:31,className:"apptimize.Apptimize",methodName:"track"}),null==r&&(r=z.getCustomAttributes());var i=lt.nativeObjectToStringMap(r),n=new le(t,z._getApptimizeAnonUserId(),i,C.getAppKey(),je.sharedInstance(),Xe.sharedInstance());g.generateTrackEvent(n,e,null)}else d.w("Events can only be tracked after setup() has been called.",{fileName:"src/apptimize/Apptimize.hx",lineNumber:1253,className:"apptimize.Apptimize",methodName:"track"})},z.trackValue=e.trackValue=function(e,t,r,i){if(z._isInitialized()){if(null!=r?(d.w("The `userID` argument is deprecated. Please use the `setCustomerUserId()` method instead.",{fileName:"src/apptimize/macros/ABTClientMacro.hx",lineNumber:19,className:"apptimize.Apptimize",methodName:"trackValue"}),it.isString(r)&&""!=j.ltrim(r)||(d.w("The `userID` argument cannot be set to a non-string value, be empty or be whitespace only, setting to null instead.",{fileName:"src/apptimize/macros/ABTClientMacro.hx",lineNumber:21,className:"apptimize.Apptimize",methodName:"trackValue"}),r=null)):r=z.getCustomerUserId(),null!=i&&d.w("The `customAttributes` argument is deprecated. Please use the `setCustomAttributes()` method instead.",{fileName:"src/apptimize/macros/ABTClientMacro.hx",lineNumber:31,className:"apptimize.Apptimize",methodName:"trackValue"}),null==i&&(i=z.getCustomAttributes()),"number"!=typeof t&&!or.__instanceof(t,at.Int))return void d.w("trackValue() called with a non-float value. Event not logged.",{fileName:"src/apptimize/Apptimize.hx",lineNumber:1284,className:"apptimize.Apptimize",methodName:"trackValue"});var n=lt.nativeObjectToStringMap(i),a=new le(r,z._getApptimizeAnonUserId(),n,C.getAppKey(),je.sharedInstance(),Xe.sharedInstance());g.generateTrackEvent(a,e,t)}else d.w("Events can only be tracked after setup() has been called.",{fileName:"src/apptimize/Apptimize.hx",lineNumber:1292,className:"apptimize.Apptimize",methodName:"trackValue"})},z.getMetadataSequenceNumber=e.getMetadataSequenceNumber=function(){var e=C.sharedInstance().getMetaData(C.getAppKey());return null!=e?e.getSequenceNumber():0};var s=function(){};(r.Apptimize=s).__name__="Apptimize",s.__super__=z,s.prototype=a(z.prototype,{__class__:s});var B=e.VariantInfo=function(e,t,r,i,n,a,s,l,o,u,p){this._variantId=e,this._variantName=t,this._experimentId=r,this._experimentName=i,this._experimentType=B.apptimizeExperimentTypeForString(n),this._experimentTypeName=n,this._cycle=a,this._currentPhase=s,this._participationPhase=l,this._userId=o,this._anonymousUserId=u,this._userHasParticipated=p};(r["apptimize.VariantInfo"]=B).__name__="apptimize.VariantInfo",B.initWithVariant=function(e,t,r){var i=0,n="v"+e.getVariantID()+"_"+e.getCycle(),a=!1;return Xe.sharedInstance().isNamespacedPropertyAvailable(n,Je.ApptimizeInternal)&&(i=Xe.sharedInstance().valueForNamespacedProperty(n,Je.ApptimizeInternal),a=!0),new B(e.getVariantID(),e.getVariantName(),e.getExperimentID(),e.getExperimentName(),e.getExperimentType(),e.getCycle(),e.getPhase(),i,t,r,a)},B.apptimizeExperimentTypeForString=function(e){switch(e.toLowerCase()){case"code-block":return v.CodeBlock;case"double-value":return v.DynamicVariables;case"feature-config":return v.FeatureVariables;case"feature-flag":return v.FeatureFlag;case"int-value":case"string-value":case"variables":return v.DynamicVariables;case"wysiwyg":return v.Visual;default:return v.Unknown}},B.prototype={_variantId:null,_variantName:null,_experimentId:null,_experimentName:null,_experimentType:null,_experimentTypeName:null,_currentPhase:null,_participationPhase:null,_cycle:null,_userId:null,_anonymousUserId:null,_userHasParticipated:null,getVariantId:function(){return this._variantId},getVariantName:function(){return this._variantName},getExperimentId:function(){return this._experimentId},getExperimentName:function(){return this._experimentName},getExperimentType:function(){return this._experimentType},getExperimentTypeName:function(){return this._experimentTypeName},getCurrentPhase:function(){return this._currentPhase},getParticipationPhase:function(){return this._participationPhase},getCycle:function(){return this._cycle},getUserId:function(){return this._userId},getAnonymousUserId:function(){return this._anonymousUserId},getUserHasParticipated:function(){return this._userHasParticipated},__class__:B};var l=function(e,t,r,i,n,a,s,l,o,u,p){B.call(this,e,t,r,i,n,a,s,l,o,u,p)};(r.VariantInfo=l).__name__="VariantInfo",l.__super__=B,l.prototype=a(B.prototype,{__class__:l});var o=function(e,t){this.r=new RegExp(e,t.split("u").join(""))};(r.EReg=o).__name__="EReg",o.prototype={r:null,match:function(e){return this.r.global&&(this.r.lastIndex=0),this.r.m=this.r.exec(e),this.r.s=e,null!=this.r.m},matched:function(e){if(null!=this.r.m&&0<=e&&e<this.r.m.length)return this.r.m[e];throw ct.thrown("EReg::matched")},matchedPos:function(){if(null==this.r.m)throw ct.thrown("No string matched");return{pos:this.r.m.index,len:this.r.m[0].length}},matchSub:function(e,t,r){var i;return null==r&&(r=-1),this.r.global?(this.r.lastIndex=t,this.r.m=this.r.exec(r<0?e:Y.substr(e,0,t+r)),(i=null!=this.r.m)&&(this.r.s=e)):(i=this.match(r<0?Y.substr(e,t,null):Y.substr(e,t,r)))&&(this.r.s=e,this.r.m.index+=t),i},split:function(e){var t="#__delim__#";return e.replace(this.r,t).split(t)},map:function(e,t){for(var r=0,i="";!(r>=e.length);){if(!this.matchSub(e,r)){i+=O.string(Y.substr(e,r,null));break}var n=this.matchedPos();if(i+=O.string(Y.substr(e,r,n.pos-r)),i+=O.string(t(this)),0==n.len?(i+=O.string(Y.substr(e,n.pos,1)),r=n.pos+1):r=n.pos+n.len,!this.r.global)break}return!this.r.global&&0<r&&r<e.length&&(i+=O.string(Y.substr(e,r,null))),i},__class__:o};var Y=function(){};(r.HxOverrides=Y).__name__="HxOverrides",Y.dateStr=function(e){var t=e.getMonth()+1,r=e.getDate(),i=e.getHours(),n=e.getMinutes(),a=e.getSeconds();return e.getFullYear()+"-"+(t<10?"0"+t:""+t)+"-"+(r<10?"0"+r:""+r)+" "+(i<10?"0"+i:""+i)+":"+(n<10?"0"+n:""+n)+":"+(a<10?"0"+a:""+a)},Y.strDate=function(e){switch(e.length){case 8:var t=e.split(":"),r=new Date;return r.setTime(0),r.setUTCHours(t[0]),r.setUTCMinutes(t[1]),r.setUTCSeconds(t[2]),r;case 10:t=e.split("-");return new Date(t[0],t[1]-1,t[2],0,0,0);case 19:var i=(t=e.split(" "))[0].split("-"),n=t[1].split(":");return new Date(i[0],i[1]-1,i[2],n[0],n[1],n[2]);default:throw ct.thrown("Invalid date format : "+e)}},Y.cca=function(e,t){var r=e.charCodeAt(t);if(r==r)return r},Y.substr=function(e,t,r){if(null==r)r=e.length;else if(r<0){if(0!=t)return"";r=e.length+r}return e.substr(t,r)},Y.remove=function(e,t){var r=e.indexOf(t);return-1!=r&&(e.splice(r,1),!0)},Y.now=function(){return Date.now()};var F=function(){};(r.Lambda=F).__name__="Lambda",F.array=function(e){for(var t=[],r=_r(e);r.hasNext();){var i=r.next();t.push(i)}return t},F.exists=function(e,t){for(var r=_r(e);r.hasNext();){if(t(r.next()))return!0}return!1},Math.__name__="Math";var k=function(){};(r.Reflect=k).__name__="Reflect",k.field=function(e,t){try{return e[t]}catch(e){return gt.lastError=e,null}},k.getProperty=function(e,t){var r;return null==e?null:!!e.__properties__&&(r=e.__properties__["get_"+t])?e[r]():e[t]},k.fields=function(e){var t=[];if(null!=e){var r=Object.prototype.hasOwnProperty;for(var i in e)"__id__"!=i&&"hx__closures__"!=i&&r.call(e,i)&&t.push(i)}return t},k.isFunction=function(e){return"function"==typeof e&&!(e.__name__||e.__ename__)},k.deleteField=function(e,t){return!!Object.prototype.hasOwnProperty.call(e,t)&&(delete e[t],!0)};var O=function(){};(r.Std=O).__name__="Std",O.string=function(e){return or.__string_rec(e,"")},O.parseInt=function(e){if(null!=e)for(var t=0,r=e.length;t<r;){var i=t++,n=e.charCodeAt(i);if(n<=8||14<=n&&32!=n&&45!=n){var a=e.charCodeAt(i+1),s=parseInt(e,120==a||88==a?16:10);return isNaN(s)?null:s}}return null};var u=function(){this.b=""};(r.StringBuf=u).__name__="StringBuf",u.prototype={b:null,__class__:u};var j=function(){};(r.StringTools=j).__name__="StringTools",j.isSpace=function(e,t){var r=Y.cca(e,t);return 8<r&&r<14||32==r},j.ltrim=function(e){for(var t=e.length,r=0;r<t&&j.isSpace(e,r);)++r;return 0<r?Y.substr(e,r,t-r):e},j.rtrim=function(e){for(var t=e.length,r=0;r<t&&j.isSpace(e,t-r-1);)++r;return 0<r?Y.substr(e,0,t-r):e},j.trim=function(e){return j.ltrim(j.rtrim(e))},j.lpad=function(e,t,r){if(t.length<=0)return e;var i="";for(r-=e.length;i.length<r;)i+=null==t?"null":""+t;return i+=null==e?"null":""+e},j.replace=function(e,t,r){return e.split(t).join(r)},j.hex=function(e,t){for(var r="";r="0123456789ABCDEF".charAt(15&e)+r,0<(e>>>=4););if(null!=t)for(;r.length<t;)r="0"+r;return r};var p=w.ValueType={__ename__:"ValueType",__constructs__:null,TNull:{_hx_name:"TNull",_hx_index:0,__enum__:"ValueType",toString:n},TInt:{_hx_name:"TInt",_hx_index:1,__enum__:"ValueType",toString:n},TFloat:{_hx_name:"TFloat",_hx_index:2,__enum__:"ValueType",toString:n},TBool:{_hx_name:"TBool",_hx_index:3,__enum__:"ValueType",toString:n},TObject:{_hx_name:"TObject",_hx_index:4,__enum__:"ValueType",toString:n},TFunction:{_hx_name:"TFunction",_hx_index:5,__enum__:"ValueType",toString:n},TClass:(t=function(e){return{_hx_index:6,c:e,__enum__:"ValueType",toString:n}},t._hx_name="TClass",t.__params__=["c"],t),TEnum:(t=function(e){return{_hx_index:7,e:e,__enum__:"ValueType",toString:n}},t._hx_name="TEnum",t.__params__=["e"],t),TUnknown:{_hx_name:"TUnknown",_hx_index:8,__enum__:"ValueType",toString:n}};p.__constructs__=[p.TNull,p.TInt,p.TFloat,p.TBool,p.TObject,p.TFunction,p.TClass,p.TEnum,p.TUnknown];var P=function(){};(r.Type=P).__name__="Type",P.createInstance=function(e,t){return new(Function.prototype.bind.apply(e,[null].concat(t)))},P.createEnum=function(e,t,r){var i=k.field(e,t);if(null==i)throw ct.thrown("No such constructor "+t);if(k.isFunction(i)){if(null==r)throw ct.thrown("Constructor "+t+" need parameters");return i.apply(e,r)}if(null!=r&&0!=r.length)throw ct.thrown("Constructor "+t+" does not need parameters");return i},P.getInstanceFields=function(e){var t=[];for(var r in e.prototype)t.push(r);return Y.remove(t,"__class__"),Y.remove(t,"__properties__"),t},P.typeof=function(e){switch(typeof e){case"boolean":return p.TBool;case"function":return e.__name__||e.__ename__?p.TObject:p.TFunction;case"number":return Math.ceil(e)==e%2147483648?p.TInt:p.TFloat;case"object":if(null==e)return p.TNull;var t=e.__enum__;if(null!=t)return p.TEnum(w[t]);var r=or.getClass(e);return null!=r?p.TClass(r):p.TObject;case"string":return p.TClass(String);case"undefined":return p.TNull;default:return p.TUnknown}},P.enumParameters=function(e){var t=w[e.__enum__].__constructs__[e._hx_index].__params__;if(null!=t){for(var r=[],i=0;i<t.length;){var n=t[i];++i,r.push(e[n])}return r}return[]};var c=w["apptimize.ABTApptimizeVariableType"]={__ename__:"apptimize.ABTApptimizeVariableType",__constructs__:null,Invalid:{_hx_name:"Invalid",_hx_index:0,__enum__:"apptimize.ABTApptimizeVariableType",toString:n},String:{_hx_name:"String",_hx_index:1,__enum__:"apptimize.ABTApptimizeVariableType",toString:n},Double:{_hx_name:"Double",_hx_index:2,__enum__:"apptimize.ABTApptimizeVariableType",toString:n},Integer:{_hx_name:"Integer",_hx_index:3,__enum__:"apptimize.ABTApptimizeVariableType",toString:n},Boolean:{_hx_name:"Boolean",_hx_index:4,__enum__:"apptimize.ABTApptimizeVariableType",toString:n},Array:{_hx_name:"Array",_hx_index:5,__enum__:"apptimize.ABTApptimizeVariableType",toString:n},Dictionary:{_hx_name:"Dictionary",_hx_index:6,__enum__:"apptimize.ABTApptimizeVariableType",toString:n}};c.__constructs__=[c.Invalid,c.String,c.Double,c.Integer,c.Boolean,c.Array,c.Dictionary];var m=function(){};(r["apptimize.ABTApptimizeVariable"]=m).__name__="apptimize.ABTApptimizeVariable",m.getValue=function(e,t,r,i){C._checkForUpdatedMetadataIfNecessary();var n=C.sharedInstance(),a=n.getMetaData(e.appkey);if(null==a)return null;for(var s=n.makeEnvironment(e),l=a.selectAlterationsIntoArray(s),o=0;o<l.length;){var u=l[o];if(++o,u.getKey()==t){var p=u instanceof Ae?u:null;if(null==p)return d.v('Alteration found for key "'+u.getKey()+"\" isn't a value alteration.",{fileName:"src/apptimize/ABTApptimizeVariable.hx",lineNumber:41,className:"apptimize.ABTApptimizeVariable",methodName:"getValue"}),null;var c=m.apptimizeVariableTypeForString(p.getType()),h=null;if(null!=p.getNestedType()&&(h=m.apptimizeVariableTypeForString(p.getNestedType())),c==r&&h==i){var _=p.getVariant();if(C.sharedInstance().incrementVariantRunCount(e,_),!p.useDefaultValue())return p.getValue()}}}return d.v('No alteration found for dynamic variable "'+t+'".',{fileName:"src/apptimize/ABTApptimizeVariable.hx",lineNumber:63,className:"apptimize.ABTApptimizeVariable",methodName:"getValue"}),null},m.apptimizeVariableTypeForString=function(e){var t=e.toLowerCase();return"string"==t?c.String:"double"==t?c.Double:"int"==t?c.Integer:"boolean"==t?c.Boolean:"list"==t?c.Array:"dictionary"==t?c.Dictionary:c.Invalid};var h=function(){};(r["apptimize.util.PlatformLock"]=h).__name__="apptimize.util.PlatformLock",h.__isInterface__=!0,h.prototype={acquire:null,release:null,__class__:h};var _=function(){};(r["apptimize.util.DefaultPlatformLock"]=_).__name__="apptimize.util.DefaultPlatformLock",_.__interfaces__=[h],_.prototype={acquire:function(){return!0},release:function(){},hxUnserialize:function(e){},__class__:_};var f=function(){};(r["apptimize.util.ABTDataLock"]=f).__name__="apptimize.util.ABTDataLock",f.getNewLock=function(e){return new _};var C=function(){this.sdkParameters=new be(null),this.resultDispatchQueue=new R("Results Logging Dispatch Queue"),this.resultDispatchQueue.start(),this.newMdFetcher=new V,this.propChangeFetcher=new V,this.metaDataCache=new D};(r["apptimize.ABTDataStore"]=C).__name__="apptimize.ABTDataStore",C.sharedInstance=function(){return null==C._instance&&(C._instance=new C),C._instance},C.clear=function(){Ge.clear(),C._instance=null},C.shutdown=function(){null!=C._instance&&null!=C._instance.resultTimer&&C._instance.resultTimer.stop(),C._instance=null,C.appKey=null,C.serverGuid=null},C._getLastCheckTime=function(){var e=Ge.loadString(Ge.kMetadataLastCheckTimeKey);return null!=e?parseFloat(e):-1e4},C._updateLastCheckTime=function(e){Ge.saveString(Ge.kMetadataLastCheckTimeKey,null==e?"null":""+e)},C._resetCheckTimeIfNeeded=function(){var e=!1;f.CHECK_TIME_LOCK.acquire();try{var t=parseFloat(He.sharedInstance().valueForProperty(He.METADATA_POLLING_INTERVAL_MS_KEY)),r=(new Date).getTime();t<r-C._getLastCheckTime()&&(C._updateLastCheckTime(r),e=!0)}catch(e){gt.lastError=e;var i=ct.caught(e).unwrap();throw f.CHECK_TIME_LOCK.release(),ct.thrown(i)}return f.CHECK_TIME_LOCK.release(),e},C._getLastSubmitTime=function(){var e=Ge.loadString(Ge.kResultLastSubmitTimeKey);return null!=e?parseFloat(e):-1e4},C._updateLastSubmitTime=function(e){Ge.saveString(Ge.kResultLastSubmitTimeKey,null==e?"null":""+e)},C.getAppKey=function(){return C.appKey},C.checkForUpdatedMetaData=function(e){null==e&&(e=!1),C.shouldDisable()?d.w("This SDK version disabled; not checking for updated metadata",{fileName:"src/apptimize/ABTDataStore.hx",lineNumber:223,className:"apptimize.ABTDataStore",methodName:"checkForUpdatedMetaData"}):(d.v("Checking for updated metadata...",{fileName:"src/apptimize/ABTDataStore.hx",lineNumber:226,className:"apptimize.ABTDataStore",methodName:"checkForUpdatedMetaData"}),z._isInitialized()&&(C._resetCheckTimeIfNeeded()||e)&&T.sharedInstance().downloadMetaDataForKey(C.getAppKey(),C.sharedInstance()._getCurrentEtag(C.getAppKey())))},C._checkForUpdatedMetadataIfNecessary=function(){},C.shouldDisable=function(){var e=Ge.loadObject(Ge.kDisabledVersions);return null!=e&&-1<e.indexOf(z.getApptimizeSDKVersion())},C.prototype={resultLogs:null,metaDataCache:null,newMdFetcher:null,propChangeFetcher:null,resultDispatchQueue:null,sdkParameters:null,resultTimer:null,initialize:function(){if(this.resultLogs=Ge.loadObject(Ge.kResultLogsKey),null==this.resultLogs){var e=He.sharedInstance().valueForProperty(He.RESULTS_CACHE_SIZE_KEY);or.getClass(e)==String&&null==(e=O.parseInt(e))&&(d.e("Invalid value specified for results_cache_size, defaulting to 10",{fileName:"src/apptimize/ABTDataStore.hx",lineNumber:102,className:"apptimize.ABTDataStore",methodName:"initialize"}),e=10),this.resultLogs=new rt(e)}},hasMetadata:function(e){var t=!1;f.METADATA_LOCK.acquire();try{t=Object.prototype.hasOwnProperty.call(this.metaDataCache.h,e)}catch(e){gt.lastError=e;var r=ct.caught(e).unwrap();throw f.METADATA_LOCK.release(),ct.thrown(r)}return f.METADATA_LOCK.release(),t},_getCurrentEtag:function(e){var t=this.getMetaData(e);return null==t?null:t.getEtag()},loadMetaData:function(e){C.appKey=e,this.reloadFromDisk(),C.shouldDisable()||(C._resetCheckTimeIfNeeded()||1==He.sharedInstance().valueForProperty(He.REFRESH_META_DATA_ON_SETUP))&&T.sharedInstance().downloadMetaDataForKey(e,this._getCurrentEtag(e))},_resetSubmitTimeIfNeeded:function(e){null==e&&(e=!1);var t=!1;f.CHECK_TIME_LOCK.acquire();try{var r=this._getMinTimeBetweenPosts(e),i=(new Date).getTime();r<i-C._getLastSubmitTime()&&(C._updateLastSubmitTime(i),t=!0)}catch(e){gt.lastError=e;var n=ct.caught(e).unwrap();throw f.CHECK_TIME_LOCK.release(),ct.thrown(n)}return f.CHECK_TIME_LOCK.release(),t},_getMinTimeBetweenPosts:function(e){null==e&&(e=!1);var t=parseFloat(He.sharedInstance().valueForProperty(He.RESULT_POST_DELAY_MS_KEY)),r=this.sdkParameters.minPostFrequencyMs;return e?null==r?-1:r:null!=r&&t<r?r:t},_submitResultsIfNecessary:function(){},reloadFromDisk:function(){var e=Ge.loadObject(Ge.kMetadataKey);null!=e?(d.v("Existing metadata loaded from storage, will update if necessary.",{fileName:"src/apptimize/ABTDataStore.hx",lineNumber:261,className:"apptimize.ABTDataStore",methodName:"reloadFromDisk"}),this.onMetadataLoaded(e)):d.v("No existing metadata found in storage.",{fileName:"src/apptimize/ABTDataStore.hx",lineNumber:264,className:"apptimize.ABTDataStore",methodName:"reloadFromDisk"})},getRequestlessEnvironment:function(e){var t=z.getApptimizeAnonUserId(),r=z.getCustomerUserId(),i=Ge.loadStringMap(Ge.kCustomPropertiesKey),n=new le(r,t,i,e.getAppKey(),je.sharedInstance(),Xe.sharedInstance());return e.makeEnvironment(n,this.sdkParameters)},getUrlsForMetadata:function(e){var t=this.getRequestlessEnvironment(e);return e.extractNeededSecondaryUrls(t)},onMetadataLoaded:function(i){var n=this;this.sdkParameters=i.extractSdkParameters(this.getRequestlessEnvironment(i));var a=this.getUrlsForMetadata(i);this.newMdFetcher.fetch(a,i.getSecondaryValues(),function(e,t){var r=n.getUrlsForMetadata(i);if(n.newMdFetcher.needNewUrls(a,r))return d.w("urls changed while fetching values, retrying",{fileName:"src/apptimize/ABTDataStore.hx",lineNumber:314,className:"apptimize.ABTDataStore",methodName:"onMetadataLoaded"}),void n.onMetadataLoaded(i);i.setSecondaryValues(e),n.overrideMetadata(i,!1,t)})},onMetadataReceived:function(i){var n=this;if(this.newMdFetcher.fetching())d.e("onMetadataReceived called while fetch already in progress",{fileName:"src/apptimize/ABTDataStore.hx",lineNumber:335,className:"apptimize.ABTDataStore",methodName:"onMetadataReceived"});else{this.sdkParameters=i.extractSdkParameters(this.getRequestlessEnvironment(i));var a=this.getUrlsForMetadata(i),e=null,t=this.getMetaData(i.getAppKey());null!=t&&(e=t.getSecondaryValues()),this.newMdFetcher.fetch(a,e,function(e,t){var r=n.getUrlsForMetadata(i);if(n.newMdFetcher.needNewUrls(a,r))return d.w("urls changed while fetching values, retrying",{fileName:"src/apptimize/ABTDataStore.hx",lineNumber:351,className:"apptimize.ABTDataStore",methodName:"onMetadataReceived"}),void n.onMetadataReceived(i);i.setSecondaryValues(e),n.overrideMetadata(i,!0,t)})}},onEnvPropsChanged:function(n){var a=this,s=this.getMetaData(n);if(null!=s){s.resetFilterEvaluations();var l=this.getUrlsForMetadata(s),e=s.getSecondaryValues();this.newMdFetcher.fetching()||this.propChangeFetcher.fetching()||this.propChangeFetcher.fetch(l,e,function(e,t){if(a.getMetaData(n)==s){var r=a.getUrlsForMetadata(s);if(a.newMdFetcher.needNewUrls(l,r))return d.w("urls changed while fetching values, retrying",{fileName:"src/apptimize/ABTDataStore.hx",lineNumber:396,className:"apptimize.ABTDataStore",methodName:"onEnvPropsChanged"}),void a.onEnvPropsChanged(n);var i=s.clone();i.setSecondaryValues(e),a.overrideMetadata(i,!0,t)}})}},overrideMetadata:function(e,t,r){var i=null,n=!0,a=!1;f.METADATA_LOCK.acquire();try{n=e.getAppKey()==C.getAppKey();var s=e.getAppKey();i=this.metaDataCache.h[s],n&&((null==i||i.getSequenceNumber()<e.getSequenceNumber())&&(a=!0),(a||r)&&(this.metaDataCache.h[s]=e,this.sdkParameters=e.extractSdkParameters(this.getRequestlessEnvironment(e)),t&&Ge.saveObject(Ge.kDisabledVersions,e.getDisabledVersions())))}catch(e){gt.lastError=e;var l=ct.caught(e).unwrap();throw f.METADATA_LOCK.release(),ct.thrown(l)}f.METADATA_LOCK.release(),e.copyPersistentValues(i),(a&&t||r)&&(this.writeToDiskIfNeeded(),this.dispatchEnrollmentChangeCallbacks(i,e)),a?(H.dispatchOnMetadataUpdated(),d.i('Updated metadata for app key "'+e.getAppKey()+'".',{fileName:"src/apptimize/ABTDataStore.hx",lineNumber:456,className:"apptimize.ABTDataStore",methodName:"overrideMetadata"}),d.v("New metadata:\n"+Pt.print(e.getMetaData(),null," "),{fileName:"src/apptimize/ABTDataStore.hx",lineNumber:458,className:"apptimize.ABTDataStore",methodName:"overrideMetadata"}),null!=i&&1!=He.sharedInstance().valueForProperty(He.REFRESH_META_DATA_ON_SETUP)||!g._trySetReady()||(H.dispatchOnApptimizeInitialized(),d.i("Apptimize initialized after metadata download.",{fileName:"src/apptimize/ABTDataStore.hx",lineNumber:465,className:"apptimize.ABTDataStore",methodName:"overrideMetadata"}))):(d.i("Existing metadata is up-to-date.",{fileName:"src/apptimize/ABTDataStore.hx",lineNumber:469,className:"apptimize.ABTDataStore",methodName:"overrideMetadata"}),1==He.sharedInstance().valueForProperty(He.REFRESH_META_DATA_ON_SETUP)&&g._trySetReady()&&(H.dispatchOnApptimizeInitialized(),d.i("Apptimize initialized after metadata unchanged.",{fileName:"src/apptimize/ABTDataStore.hx",lineNumber:476,className:"apptimize.ABTDataStore",methodName:"overrideMetadata"})))},getMetaData:function(e){if(null==this.metaDataCache)return null;var t=null;f.METADATA_LOCK.acquire();try{t=this.metaDataCache.h[e]}catch(e){gt.lastError=e;var r=ct.caught(e).unwrap();throw f.METADATA_LOCK.release(),ct.thrown(r)}return f.METADATA_LOCK.release(),null!=t&&t.getAppKey()!=e?(d.e("Metadata appkey does not match requested key",{fileName:"src/apptimize/ABTDataStore.hx",lineNumber:494,className:"apptimize.ABTDataStore",methodName:"getMetaData"}),null):t},dispatchEnrollmentChangeCallbacks:function(e,t){if(H.isEnrollmentListenerRegistered()||H.isUnenrollmentListenerRegistered()){for(var r=z.getCustomerUserId(),i=z.getApptimizeAnonUserId(),n=Ge.loadStringMap(Ge.kCustomPropertiesKey),a=new le(r,i,n,C.getAppKey(),je.sharedInstance(),Xe.sharedInstance()),s=t.makeEnvironment(a,this.sdkParameters),l=null==e?s:e.makeEnvironment(a,this.sdkParameters),o=null==e?[]:e.uncachedSelectAlterationsIntoArray(l,!1),u=t.uncachedSelectAlterationsIntoArray(s,!1),p=new zt,c=new zt,h=0;h<u.length;){var _=u[h];++h;var m=_.getVariant();if(or.getClass(m)==we){var f=m;p.add(f.getHotfixName())}else c.add(m)}for(var d=t.getAllVariants(),g=new Array(d.length),v=(h=0,d.length);h<v;){var A=h++;g[A]=d[A].getExperimentID()}var T=g,y=new zt,N=new zt,S=new zt,b=new zt;for(h=0;h<o.length;){_=o[h];++h;m=[_.getVariant()];if(or.getClass(m[0])!=we&&!F.exists(N,function(t){return function(e){return e==t[0].getVariantID()}}(m))){var E=B.initWithVariant(m[0],r,i);y.add(m[0].getExperimentID()),N.add(m[0].getVariantID()),p.filter(function(t){return function(e){return e==t[0].getExperimentName()}}(m)).isEmpty()?F.exists(T,function(t){return function(e){return e==t[0].getExperimentID()}}(m))?F.exists(c,function(t){return function(e){return e.getExperimentID()==t[0].getExperimentID()}}(m))?F.exists(c,function(t){return function(e){return e.getVariantID()==t[0].getVariantID()}}(m))||(H.dispatchOnUnenrolledInExperiment(E,G.VariantChanged),S.add(m[0].getExperimentID())):H.dispatchOnUnenrolledInExperiment(E,G.Other):H.dispatchOnUnenrolledInExperiment(E,G.ExperimentStopped):H.dispatchOnUnenrolledInExperiment(E,G.ExperimentWinnerSelected)}}b=new zt;for(var x=c.h;null!=x;){var I=x.item;x=x.next;var w=[I];if(!F.exists(b,function(t){return function(e){return e==t[0].getVariantID()}}(w))&&(b.add(w[0].getVariantID()),!F.exists(y,function(t){return function(e){return e==t[0].getExperimentID()}}(w))||F.exists(S,function(t){return function(e){return e==t[0].getExperimentID()}}(w)))){E=B.initWithVariant(w[0],r,i);H.dispatchOnEnrolledInExperiment(E)}}}},dispatchUnenrollmentsForUserChanged:function(e){var t=this.getMetaData(e.appkey);if(null!=t){for(var r=t.makeEnvironment(e,this.sdkParameters),i=t.uncachedSelectAlterationsIntoArray(r),n=new zt,a=0,s=new Array(i.length),l=0,o=i.length;l<o;){s[h=l++]=i[h].getVariant()}l=[],o=0;for(var u=s;o<u.length;){var p=u[o];++o,or.getClass(p)!=we&&l.push(p)}var c=l;for(s=new Array(c.length),l=0,o=c.length;l<o;){var h;s[h=l++]=B.initWithVariant(c[h],r.userID,r.anonID)}for(l=s;a<l.length;){var _=[l[a]];++a,F.exists(n,function(t){return function(e){return e==t[0].getVariantId()}}(_))||(n.add(_[0].getVariantId()),H.dispatchOnUnenrolledInExperiment(_[0],G.UserIdChanged))}}},dispatchEnrollmentsForUserChanged:function(e){var t=this.getMetaData(e.appkey);if(null!=t){for(var r=t.makeEnvironment(e,this.sdkParameters),i=t.uncachedSelectAlterationsIntoArray(r),n=new zt,a=0,s=new Array(i.length),l=0,o=i.length;l<o;){s[h=l++]=i[h].getVariant()}l=[],o=0;for(var u=s;o<u.length;){var p=u[o];++o,or.getClass(p)!=we&&l.push(p)}var c=l;for(s=new Array(c.length),l=0,o=c.length;l<o;){var h;s[h=l++]=B.initWithVariant(c[h],r.userID,r.anonID)}for(l=s;a<l.length;){var _=[l[a]];++a,F.exists(n,function(t){return function(e){return e==t[0].getVariantId()}}(_))||(n.add(_[0].getVariantId()),H.dispatchOnEnrolledInExperiment(_[0]))}}},makeEnvironment:function(e){var t=this.getMetaData(e.appkey);return null==t?null:t.makeEnvironment(e,this.sdkParameters)},writeToDiskIfNeeded:function(){var e=this.getMetaData(C.getAppKey());null!=e&&Ge.saveObject(Ge.kMetadataKey,e,null,!0)},_saveResultLogs:function(){Ge.saveObject(Ge.kResultLogsKey,this.resultLogs,null,!0)},addResultLogEntry:function(e,t){var r=e.getUniqueUserID();C.resultsLock.acquire();try{var i=this.resultLogs.getValue(r);null==i&&(i=new Le(e),this.resultLogs.insert(r,i,mr(this,this._submitResultLog),this.resultDispatchQueue)),i.logEntry(t),i.entryCount()>He.sharedInstance().valueForProperty(He.MAXIMUM_RESULT_ENTRIES_KEY)&&this.resultLogs.remove(r,mr(this,this._submitResultLog),this.resultDispatchQueue),null==this.resultTimer&&(this.resultTimer=At.delay(mr(this,this._flushTrackingForTimer),this._getMinTimeBetweenPosts())),this._saveResultLogs(),this._submitResultsIfNecessary()}catch(e){gt.lastError=e;var n=ct.caught(e).unwrap();throw C.resultsLock.release(),ct.thrown(n)}C.resultsLock.release()},logUserTransition:function(e,t){var r=this.makeEnvironment(e),i=this.makeEnvironment(t);if(null!=r&&null!=i){var n=new Pe(r,i.userID),a=new Ce(i,r.userID);this.addResultLogEntry(r,n),this.addResultLogEntry(i,a)}},_submitResultLog:function(e){C.shouldDisable()||(T.sharedInstance().postResultsForKey(e.getAppKey(),e),this._saveResultLogs())},flushTracking:function(){this._resetSubmitTimeIfNeeded(!0)&&(this._flushTrackingInternal(),null!=this.resultTimer&&(this.resultTimer.stop(),this.resultTimer=null))},_flushTrackingForTimer:function(){this.resultTimer=null,this._flushTrackingInternal(),this._resetSubmitTimeIfNeeded()},_flushTrackingInternal:function(){d.v("Posting results...",{fileName:"src/apptimize/ABTDataStore.hx",lineNumber:752,className:"apptimize.ABTDataStore",methodName:"_flushTrackingInternal"}),C.resultsLock.acquire();try{this.resultLogs.clear(mr(this,this._submitResultLog),this.resultDispatchQueue),this._saveResultLogs()}catch(e){gt.lastError=e;var t=ct.caught(e).unwrap();throw C.resultsLock.release(),ct.thrown(t)}C.resultsLock.release()},incrementVariantRunCount:function(e,t){if(or.getClass(t)!=we){var r="v"+t.getVariantID()+"_"+t.getCycle(),i="e"+t.getExperimentID()+"_"+t.getCycle(),n=t.getPhase(),a=!1;if(e.internalProps.isNamespacedPropertyAvailable(r,Je.ApptimizeInternal))n=e.internalProps.valueForNamespacedProperty(r,Je.ApptimizeInternal);else{e.internalProps.valueForNamespacedProperty(r,Je.ApptimizeInternal),e.internalProps.valueForNamespacedProperty(i,Je.ApptimizeInternal);e.internalProps.setPropertyForNamespace(r,n,Je.ApptimizeInternal),e.internalProps.setPropertyForNamespace(i,n,Je.ApptimizeInternal),d.v("Setting stickiness attributes "+r+" and "+i+" to participation phase "+t.getPhase(),{fileName:"src/apptimize/ABTDataStore.hx",lineNumber:781,className:"apptimize.ABTDataStore",methodName:"incrementVariantRunCount"}),a=!0}var s=this.makeEnvironment(e),l=new Be(s,t.getVariantID(),t.getCycle(),n);d.v('Incrementing variant run count for variant ID "'+t.getVariantID()+'".',{fileName:"src/apptimize/ABTDataStore.hx",lineNumber:787,className:"apptimize.ABTDataStore",methodName:"incrementVariantRunCount"});var o=B.initWithVariant(t,s.userID,s.anonID);H.dispatchOnParticipatedInExperiment(o,a),this.addResultLogEntry(s,l)}},generateEvent:function(e,t,r,i){if(z._isInitialized()&&null!=C.sharedInstance().getMetaData(i.appkey)){var n=this.makeEnvironment(i),a=new Fe(n,e,t,r),s='Event "'+e+'"';null!=r&&(s=s+" with value "+O.string(r.h[g.kABTValueEventKey])),s+=" tracked.",d.v(s,{fileName:"src/apptimize/ABTDataStore.hx",lineNumber:812,className:"apptimize.ABTDataStore",methodName:"generateEvent"}),this.addResultLogEntry(n,a)}else d.w('Event "'+e+'" will not be tracked until Apptimize.setup() is called and MetaData available.',{fileName:"src/apptimize/ABTDataStore.hx",lineNumber:798,className:"apptimize.ABTDataStore",methodName:"generateEvent"})},__class__:C};var d=function(){};(r["apptimize.ABTLogger"]=d).__name__="apptimize.ABTLogger",d.logLevelFromString=function(e){var t=e.toUpperCase();return"LOG_LEVEL_VERBOSE"==t?d.LOG_LEVEL_VERBOSE:"LOG_LEVEL_DEBUG"==t?d.LOG_LEVEL_DEBUG:"LOG_LEVEL_INFO"==t?d.LOG_LEVEL_INFO:"LOG_LEVEL_WARN"==t?d.LOG_LEVEL_WARN:"LOG_LEVEL_ERROR"==t?d.LOG_LEVEL_ERROR:d.LOG_LEVEL_NONE},d.setLogLevel=function(e){d.logLevel=e},d.c=function(e,t){d.log_out(e,t),Qe.throwException(e)},d.e=function(e,t){d.logLevel<=d.LOG_LEVEL_ERROR&&d.log_out(e,t)},d.w=function(e,t){d.logLevel<=d.LOG_LEVEL_WARN&&d.log_out(e,t)},d.i=function(e,t){d.logLevel<=d.LOG_LEVEL_INFO&&d.log_out(e,t)},d.d=function(e,t){d.logLevel<=d.LOG_LEVEL_DEBUG&&d.log_out(e,t)},d.v=function(e,t){d.logLevel<=d.LOG_LEVEL_VERBOSE&&d.log_out(e,t)},d.log_out=function(e,t){d.useTraceForLogging&&dt.trace!=d.trace?dt.trace(e,t):d.traceInternal("Apptimize: "+e,t)},d.redirectTraceStatements=function(){dt.trace=d.trace},d.traceInternal=function(e,t){"undefined"!=typeof console&&null!=console.log&&console.log(e)},d.trace=function(e,t){var r=O.string(e);d.v(r,t)};var g=function(){};(r["apptimize.ApptimizeInternal"]=g).__name__="apptimize.ApptimizeInternal",g._isInitialized=function(){var e=!1;f.INITIALIZATION.acquire();try{e=2==g._state||3==g._state}catch(e){gt.lastError=e;var t=ct.caught(e).unwrap();throw f.INITIALIZATION.release(),ct.thrown(t)}return f.INITIALIZATION.release(),e},g.setState=function(e){f.INITIALIZATION.acquire();try{g._state=e}catch(e){gt.lastError=e;var t=ct.caught(e).unwrap();throw f.INITIALIZATION.release(),ct.thrown(t)}f.INITIALIZATION.release()},g._trySetReady=function(){var e=!1;f.INITIALIZATION.acquire();try{2==g._state&&(e=!0,g._state=3)}catch(e){gt.lastError=e;var t=ct.caught(e).unwrap();throw f.INITIALIZATION.release(),ct.thrown(t)}return f.INITIALIZATION.release(),e},g._setup=function(e,t,r){var i=!0;f.INITIALIZATION.acquire();try{0!=g._state?(d.w("Apptimize setup has already been called.",{fileName:"src/apptimize/ApptimizeInternal.hx",lineNumber:73,className:"apptimize.ApptimizeInternal",methodName:"_setup"}),i=!1):g._state=1}catch(e){gt.lastError=e;var n=ct.caught(e).unwrap();throw f.INITIALIZATION.release(),ct.thrown(n)}if(f.INITIALIZATION.release(),0!=i){d.redirectTraceStatements();var a=He.sharedInstance();if(null!=t&&a.setProperties(lt.nativeObjectToStringMap(t)),a.isPropertyAvailable(He.LOG_LEVEL_KEY)){var s=a.valueForProperty(He.LOG_LEVEL_KEY);d.setLogLevel(d.logLevelFromString(s))}if(a.isPropertyAvailable(He.APPTIMIZE_ENVIRONMENT_KEY)||a.isPropertyAvailable(He.APPT