PageSourceSearch

https://www.nordnet.fi/static/nn-npm.optimizely.optimizely-sdk.e784567e0942abd1d67d.js

js nordnet.fi collected 2026-10-02 03:18:38 UTC 128,191 bytes, 1 lines download raw bytes

1!function(){try{var e="u">typeof window?window:"u">typeof global?global:"u">typeof globalThis?globalThis:"u">typeof self?self:{};e.SENTRY_RELEASE={id:"pr-12478"},e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[(new e.Error).stack]=function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];if(null!=r)for(var i in r)r.hasOwnProperty(i)&&(e[i]=r[i])}return e}({},e._sentryModuleMetadata[(new e.Error).stack],{"_sentryBundlerPluginAppKey:webapp-next":!0});var t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="b3b45b98-1d65-4687-a50e-2f0d13388c77",e._sentryDebugIdIdentifier="sentry-dbid-b3b45b98-1d65-4687-a50e-2f0d13388c77")}catch(e){}}();"use strict";(self.webpackChunkwebapp_next=self.webpackChunkwebapp_next||[]).push([["npm.optimizely.optimizely-sdk"],{78496(e,t,r){let i;r.d(t,{kn:()=>T,Q_:()=>rJ,vP:()=>em,tZ:()=>er});let n="u">typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),o=new Uint8Array(16),s=[];for(let e=0;e<256;++e)s.push((e+256).toString(16).slice(1));let a=function(e,t,r){if(n&&!t&&!e)return n();let a=(e=e||{}).random||(e.rng||function(){if(!i&&!(i="u">typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)))throw Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return i(o)})();if(a[6]=15&a[6]|64,a[8]=63&a[8]|128,t){r=r||0;for(let e=0;e<16;++e)t[r+e]=a[e];return t}return function(e,t=0){return s[e[t+0]]+s[e[t+1]]+s[e[t+2]]+s[e[t+3]]+"-"+s[e[t+4]]+s[e[t+5]]+"-"+s[e[t+6]]+s[e[t+7]]+"-"+s[e[t+8]]+s[e[t+9]]+"-"+s[e[t+10]]+s[e[t+11]]+s[e[t+12]]+s[e[t+13]]+s[e[t+14]]+s[e[t+15]]}(a)};var u,l,c,d,p,f,g,E,h,_,I,v,y,R,O,N,T,m,A,D=r(25543),S=r(88005),U=r.n(S),C=r(77232),L=function(e,t){return(L=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)};function b(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}L(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var V=function(){return(V=Object.assign||function(e){for(var t,r=1,i=arguments.length;r<i;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}).apply(this,arguments)};function P(e,t,r,i){return new(r||(r=Promise))(function(n,o){function s(e){try{u(i.next(e))}catch(e){o(e)}}function a(e){try{u(i.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?n(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(s,a)}u((i=i.apply(e,t||[])).next())})}function F(e,t){var r,i,n,o,s={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){var l=[a,u];if(r)throw TypeError("Generator is already executing.");for(;o&&(o=0,l[0]&&(s=0)),s;)try{if(r=1,i&&(n=2&l[0]?i.return:l[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,l[1])).done)return n;switch(i=0,n&&(l=[2&l[0],n.value]),l[0]){case 0:case 1:n=l;break;case 4:return s.label++,{value:l[1],done:!1};case 5:s.label++,i=l[1],l=[0];continue;case 7:l=s.ops.pop(),s.trys.pop();continue;default:if(!(n=(n=s.trys).length>0&&n[n.length-1])&&(6===l[0]||2===l[0])){s=0;continue}if(3===l[0]&&(!n||l[1]>n[0]&&l[1]<n[3])){s.label=l[1];break}if(6===l[0]&&s.label<n[1]){s.label=n[1],n=l;break}if(n&&s.label<n[2]){s.label=n[2],s.ops.push(l);break}n[2]&&s.ops.pop(),s.trys.pop();continue}l=t.call(e,s)}catch(e){l=[6,e],i=0}finally{r=n=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}function M(e,t,r){if(r||2==arguments.length)for(var i,n=0,o=t.length;n<o;n++)!i&&n in t||(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return e.concat(i||Array.prototype.slice.call(t))}var k=new(function(){function e(){}return e.prototype.handleError=function(e){},e}());function x(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];if(!e)return{};if("function"==typeof Object.assign)return Object.assign.apply(Object,M([e],t,!1));for(var i=Object(e),n=0;n<t.length;n++){var o=t[n];if(null!=o)for(var s in o)Object.prototype.hasOwnProperty.call(o,s)&&(i[s]=o[s])}return i}function w(e,t){return e?function(e,t){var r={};return e.forEach(function(e){r[t(e)]=e}),r}(e,function(e){return e[t]}):{}}function G(){return a()}function B(e,t){for(var r=!1,i=Object.keys(e),n=0;n<i.length;n++)if(t===e[i[n]]){r=!0;break}return r}function K(e){return Object.keys(e).map(function(t){return e[t]})}function j(e,t){for(var r,i=0;i<e.length;i++){var n=e[i];if(t(n)){r=n;break}}return r}function q(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];var i=0;return e.replace(/%s/g,function(){var e=t[i++],r=typeof e;return"function"===r?e():"string"===r?e:String(e)})}var H=function(){return Math.round(new Date().getTime())},z=function(e){return"number"==typeof e&&0x20000000000000>=Math.abs(e)},X=function(e){return"number"==typeof e};(u=I||(I={}))[u.NOTSET=0]="NOTSET",u[u.DEBUG=1]="DEBUG",u[u.INFO=2]="INFO",u[u.WARNING=3]="WARNING",u[u.ERROR=4]="ERROR";var Y={NOTSET:0,DEBUG:1,INFO:2,WARNING:3,ERROR:4};function J(e){return"string"!=typeof e?e:("WARN"===(e=e.toUpperCase())&&(e="WARNING"),Y[e])?Y[e]:e}var W=function(){function e(){this.defaultLoggerFacade=new ee,this.loggers={}}return e.prototype.getLogger=function(e){return e?(this.loggers[e]||(this.loggers[e]=new ee({messagePrefix:e})),this.loggers[e]):this.defaultLoggerFacade},e}(),Q=function(){function e(e){void 0===e&&(e={}),this.logLevel=I.NOTSET,void 0!==e.logLevel&&B(I,e.logLevel)&&this.setLogLevel(e.logLevel),this.logToConsole=void 0===e.logToConsole||!!e.logToConsole,this.prefix=void 0!==e.prefix?e.prefix:"[OPTIMIZELY]"}return e.prototype.log=function(e,t){if(this.shouldLog(e)&&this.logToConsole){var r="".concat(this.prefix," - ").concat(this.getLogLevelName(e)," ").concat(this.getTime()," ").concat(t);this.consoleLog(e,[r])}},e.prototype.setLogLevel=function(e){e=J(e),B(I,e)&&void 0!==e?this.logLevel=e:this.logLevel=I.ERROR},e.prototype.getTime=function(){return new Date().toISOString()},e.prototype.shouldLog=function(e){return e>=this.logLevel},e.prototype.getLogLevelName=function(e){switch(e){case I.DEBUG:return"DEBUG";case I.INFO:return"INFO ";case I.WARNING:return"WARN ";case I.ERROR:return"ERROR";default:return"NOTSET"}},e.prototype.consoleLog=function(e,t){switch(e){case I.DEBUG:console.log.apply(console,t);break;case I.INFO:console.info.apply(console,t);break;case I.WARNING:console.warn.apply(console,t);break;case I.ERROR:console.error.apply(console,t);break;default:console.log.apply(console,t)}},e}(),Z=I.NOTSET,$=null,ee=function(){function e(e){void 0===e&&(e={}),this.messagePrefix="",e.messagePrefix&&(this.messagePrefix=e.messagePrefix)}return e.prototype.log=function(e,t){for(var r=[],i=2;i<arguments.length;i++)r[i-2]=arguments[i];this.internalLog(J(e),{message:t,splat:r})},e.prototype.info=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];this.namedLog(I.INFO,e,t)},e.prototype.debug=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];this.namedLog(I.DEBUG,e,t)},e.prototype.warn=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];this.namedLog(I.WARNING,e,t)},e.prototype.error=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];this.namedLog(I.ERROR,e,t)},e.prototype.format=function(e){return"".concat(this.messagePrefix?this.messagePrefix+": ":"").concat(q.apply(void 0,M([e.message],e.splat,!1)))},e.prototype.internalLog=function(e,t){!$||!(e<Z)&&($.log(e,this.format(t)),t.error&&t.error instanceof Error&&k.handleError(t.error))},e.prototype.namedLog=function(e,t,r){if(t instanceof Error){t=(i=t).message,this.internalLog(e,{error:i,message:t,splat:r});return}if(0===r.length)return void this.internalLog(e,{message:t,splat:r});var i,n=r[r.length-1];n instanceof Error&&(i=n,r.splice(-1)),this.internalLog(e,{message:t,error:i,splat:r})},e}(),et=new W;function er(e){return et.getLogger(e)}function ei(e){$=e}var en=function(e){e=J(e),Z=B(I,e)&&void 0!==e?e:I.ERROR};function eo(e,t){var r=e.context,i=t.context;return r.accountId===i.accountId&&r.projectId===i.projectId&&r.clientName===i.clientName&&r.clientVersion===i.clientVersion&&r.revision===i.revision&&r.anonymizeIP===i.anonymizeIP&&r.botFiltering===i.botFiltering}var es=er("EventProcessor"),ea=function(){function e(e){var t=e.timeout,r=e.callback;this.timeout=Math.max(t,0),this.callback=r}return e.prototype.start=function(){this.timeoutId=setTimeout(this.callback,this.timeout)},e.prototype.refresh=function(){this.stop(),this.start()},e.prototype.stop=function(){this.timeoutId&&clearTimeout(this.timeoutId)},e}(),eu=function(){function e(e){var t=e.sink;this.sink=t}return e.prototype.start=function(){return Promise.resolve()},e.prototype.stop=function(){return Promise.resolve()},e.prototype.enqueue=function(e){this.sink([e])},e}(),el=function(){function e(e){var t=e.flushInterval,r=e.maxQueueSize,i=e.sink,n=e.closingSink,o=e.batchComparator;this.buffer=[],this.maxQueueSize=Math.max(r,1),this.sink=i,this.closingSink=n,this.batchComparator=o,this.timer=new ea({callback:this.flush.bind(this),timeout:t}),this.started=!1}return e.prototype.start=function(){return this.started=!0,Promise.resolve()},e.prototype.stop=function(){this.started=!1;var e=this.closingSink?this.closingSink(this.buffer):this.sink(this.buffer);return this.buffer=[],this.timer.stop(),e},e.prototype.enqueue=function(e){if(!this.started)return void es.warn("Queue is stopped, not accepting event");var t=this.buffer[0];t&&!this.batchComparator(t,e)&&this.flush(),0===this.buffer.length&&this.timer.refresh(),this.buffer.push(e),this.buffer.length>=this.maxQueueSize&&this.flush()},e.prototype.flush=function(){this.sink(this.buffer),this.buffer=[],this.timer.stop()},e}(),ec={NOTSET:0,DEBUG:1,INFO:2,WARNING:3,ERROR:4},ed={BROWSER_ODP_MANAGER_INITIALIZATION_FAILED:"%s: Error initializing Browser ODP Manager.",CON
1DITION_EVALUATOR_ERROR:"%s: Error evaluating audience condition of type %s: %s",DATAFILE_AND_SDK_KEY_MISSING:"%s: You must provide at least one of sdkKey or datafile. Cannot start Optimizely",EXPERIMENT_KEY_NOT_IN_DATAFILE:"%s: Experiment key %s is not in datafile.",FEATURE_NOT_IN_DATAFILE:"%s: Feature key %s is not in datafile.",FETCH_SEGMENTS_FAILED_NETWORK_ERROR:"%s: Audience segments fetch failed. (network error)",FETCH_SEGMENTS_FAILED_DECODE_ERROR:"%s: Audience segments fetch failed. (decode error)",IMPROPERLY_FORMATTED_EXPERIMENT:"%s: Experiment key %s is improperly formatted.",INVALID_ATTRIBUTES:"%s: Provided attributes are in an invalid format.",INVALID_BUCKETING_ID:"%s: Unable to generate hash for bucketing ID %s: %s",INVALID_DATAFILE:"%s: Datafile is invalid - property %s: %s",INVALID_DATAFILE_MALFORMED:"%s: Datafile is invalid because it is malformed.",INVALID_CONFIG:"%s: Provided Optimizely config is in an invalid format.",INVALID_JSON:"%s: JSON object is not valid.",INVALID_ERROR_HANDLER:'%s: Provided "errorHandler" is in an invalid format.',INVALID_EVENT_DISPATCHER:'%s: Provided "eventDispatcher" is in an invalid format.',INVALID_EVENT_TAGS:"%s: Provided event tags are in an invalid format.",INVALID_EXPERIMENT_KEY:"%s: Experiment key %s is not in datafile. It is either invalid, paused, or archived.",INVALID_EXPERIMENT_ID:"%s: Experiment ID %s is not in datafile.",INVALID_GROUP_ID:"%s: Group ID %s is not in datafile.",INVALID_LOGGER:'%s: Provided "logger" is in an invalid format.',INVALID_ROLLOUT_ID:"%s: Invalid rollout ID %s attached to feature %s",INVALID_USER_ID:"%s: Provided user ID is in an invalid format.",INVALID_USER_PROFILE_SERVICE:"%s: Provided user profile service instance is in an invalid format: %s.",LOCAL_STORAGE_DOES_NOT_EXIST:"Error accessing window localStorage.",MISSING_INTEGRATION_KEY:"%s: Integration key missing from datafile. All integrations should include a key.",NO_DATAFILE_SPECIFIED:"%s: No datafile specified. Cannot start optimizely.",NO_JSON_PROVIDED:"%s: No JSON object to validate against schema.",NO_VARIATION_FOR_EXPERIMENT_KEY:"%s: No variation key %s defined in datafile for experiment %s.",ODP_CONFIG_NOT_AVAILABLE:"%s: ODP is not integrated to the project.",ODP_EVENT_FAILED:"ODP event send failed.",ODP_FETCH_QUALIFIED_SEGMENTS_SEGMENTS_MANAGER_MISSING:"%s: ODP unable to fetch qualified segments (Segments Manager not initialized).",ODP_IDENTIFY_FAILED_EVENT_MANAGER_MISSING:"%s: ODP identify event %s is not dispatched (Event Manager not instantiated).",ODP_INITIALIZATION_FAILED:"%s: ODP failed to initialize.",ODP_INVALID_DATA:"%s: ODP data is not valid",ODP_EVENT_FAILED_ODP_MANAGER_MISSING:"%s: ODP Event failed to send. (ODP Manager not initialized).",ODP_FETCH_QUALIFIED_SEGMENTS_FAILED_ODP_MANAGER_MISSING:"%s: ODP failed to Fetch Qualified Segments. (ODP Manager not initialized).",ODP_IDENTIFY_USER_FAILED_ODP_MANAGER_MISSING:"%s: ODP failed to Identify User. (ODP Manager not initialized).",ODP_IDENTIFY_USER_FAILED_USER_CONTEXT_INITIALIZATION:"%s: ODP failed to Identify User. (Failed during User Context Initialization).",ODP_MANAGER_UPDATE_SETTINGS_FAILED_EVENT_MANAGER_MISSING:"%s: ODP Manager failed to update OdpConfig settings for internal event manager. (Event Manager not initialized).",ODP_MANAGER_UPDATE_SETTINGS_FAILED_SEGMENTS_MANAGER_MISSING:"%s: ODP Manager failed to update OdpConfig settings for internal segments manager. (Segments Manager not initialized).",ODP_NOT_ENABLED:"ODP is not enabled",ODP_NOT_INTEGRATED:"%s: ODP is not integrated",ODP_SEND_EVENT_FAILED_EVENT_MANAGER_MISSING:"%s: ODP send event %s was not dispatched (Event Manager not instantiated).",ODP_SEND_EVENT_FAILED_UID_MISSING:"%s: ODP send event %s was not dispatched (No valid user identifier provided).",ODP_SEND_EVENT_FAILED_VUID_MISSING:"%s: ODP send event %s was not dispatched (Unable to fetch VUID).",ODP_VUID_INITIALIZATION_FAILED:"%s: ODP VUID initialization failed.",ODP_VUID_REGISTRATION_FAILED:"%s: ODP VUID failed to be registered.",ODP_VUID_REGISTRATION_FAILED_EVENT_MANAGER_MISSING:"%s: ODP register vuid failed. (Event Manager not instantiated).",UNDEFINED_ATTRIBUTE:"%s: Provided attribute: %s has an undefined value.",UNRECOGNIZED_ATTRIBUTE:"%s: Unrecognized attribute %s provided. Pruning before sending event to Optimizely.",UNABLE_TO_CAST_VALUE:"%s: Unable to cast value %s to type %s, returning null.",USER_NOT_IN_FORCED_VARIATION:"%s: User %s is not in the forced variation map. Cannot remove their forced variation.",USER_PROFILE_LOOKUP_ERROR:'%s: Error while looking up user profile for user ID "%s": %s.',USER_PROFILE_SAVE_ERROR:'%s: Error while saving user profile for user ID "%s": %s.',VARIABLE_KEY_NOT_IN_DATAFILE:'%s: Variable with key "%s" associated with feature with key "%s" is not in datafile.',VARIATION_ID_NOT_IN_DATAFILE:"%s: N
1o variation ID %s defined in datafile for experiment %s.",VARIATION_ID_NOT_IN_DATAFILE_NO_EXPERIMENT:"%s: Variation ID %s is not in the datafile.",INVALID_INPUT_FORMAT:"%s: Provided %s is in an invalid format.",INVALID_DATAFILE_VERSION:"%s: This version of the JavaScript SDK does not support the given datafile version: %s",INVALID_VARIATION_KEY:"%s: Provided variation key is in an invalid format."},ep={ACTIVATE_USER:"%s: Activating user %s in experiment %s.",DISPATCH_CONVERSION_EVENT:"%s: Dispatching conversion event to URL %s with params %s.",DISPATCH_IMPRESSION_EVENT:"%s: Dispatching impression event to URL %s with params %s.",DEPRECATED_EVENT_VALUE:"%s: Event value is deprecated in %s call.",EVENT_KEY_NOT_FOUND:"%s: Event key %s is not in datafile.",EXPERIMENT_NOT_RUNNING:"%s: Experiment %s is not running.",FEATURE_ENABLED_FOR_USER:"%s: Feature %s is enabled for user %s.",FEATURE_NOT_ENABLED_FOR_USER:"%s: Feature %s is not enabled for user %s.",FEATURE_HAS_NO_EXPERIMENTS:"%s: Feature %s is not attached to any experiments.",FAILED_TO_PARSE_VALUE:'%s: Failed to parse event value "%s" from event tags.',FAILED_TO_PARSE_REVENUE:'%s: Failed to parse revenue value "%s" from event tags.',FORCED_BUCKETING_FAILED:"%s: Variation key %s is not in datafile. Not activating user %s.",INVALID_OBJECT:"%s: Optimizely object is not valid. Failing %s.",INVALID_CLIENT_ENGINE:"%s: Invalid client engine passed: %s. Defaulting to node-sdk.",INVALID_DEFAULT_DECIDE_OPTIONS:"%s: Provided default decide options is not an array.",INVALID_DECIDE_OPTIONS:"%s: Provided decide options is not an array. Using default decide options.",INVALID_VARIATION_ID:"%s: Bucketed into an invalid variation ID. Returning null.",NOTIFICATION_LISTENER_EXCEPTION:"%s: Notification listener for (%s) threw exception: %s",NO_ROLLOUT_EXISTS:"%s: There is no rollout of feature %s.",NOT_ACTIVATING_USER:"%s: Not activating user %s for experiment %s.",NOT_TRACKING_USER:"%s: Not tracking user %s.",ODP_DISABLED:"ODP Disabled.",ODP_IDENTIFY_FAILED_ODP_DISABLED:"%s: ODP identify event for user %s is not dispatched (ODP disabled).",ODP_IDENTIFY_FAILED_ODP_NOT_INTEGRATED:"%s: ODP identify event %s is not dispatched (ODP not integrated).",ODP_SEND_EVENT_IDENTIFIER_CONVERSION_FAILED:"%s: sendOdpEvent failed to parse through and convert fs_user_id aliases",PARSED_REVENUE_VALUE:'%s: Parsed revenue value "%s" from event tags.',PARSED_NUMERIC_VALUE:'%s: Parsed event value "%s" from event tags.',RETURNING_STORED_VARIATION:'%s: Returning previously activated variation "%s" of experiment "%s" for user "%s" from user profile.',ROLLOUT_HAS_NO_EXPERIMENTS:"%s: Rollout of feature %s has no experiments",SAVED_VARIATION:'%s: Saved variation "%s" of experiment "%s" for user "%s".',SAVED_VARIATION_NOT_FOUND:"%s: User %s was previously bucketed into variation with ID %s for experiment %s, but no matching variation was found.",SHOULD_NOT_DISPATCH_ACTIVATE:'%s: Experiment %s is not in "Running" state. Not activating user.',SKIPPING_JSON_VALIDATION:"%s: Skipping JSON schema validation.",TRACK_EVENT:"%s: Tracking event %s for user %s.",UNRECOGNIZED_DECIDE_OPTION:"%s: Unrecognized decide option %s provided.",USER_ASSIGNED_TO_EXPERIMENT_BUCKET:"%s: Assigned bucket %s to user with bucketing ID %s.",USER_BUCKETED_INTO_EXPERIMENT_IN_GROUP:"%s: User %s is in experiment %s of group %s.",USER_BUCKETED_INTO_TARGETING_RULE:"%s: User %s bucketed into targeting rule %s.",USER_IN_FEATURE_EXPERIMENT:"%s: User %s is in variation %s of experiment %s on the feature %s.",USER_IN_ROLLOUT:"%s: User %s is in rollout of feature %s.",USER_NOT_BUCKETED_INTO_EVERYONE_TARGETING_RULE:"%s: User %s not bucketed into everyone targeting rule due to traffic allocation.",USER_NOT_BUCKETED_INTO_EXPERIMENT_IN_GROUP:"%s: User %s is not in experiment %s of group %s.",USER_NOT_BUCKETED_INTO_ANY_EXPERIMENT_IN_GROUP:"%s: User %s is not in any experiment of group %s.",USER_NOT_BUCKETED_INTO_TARGETING_RULE:"%s User %s not bucketed into targeting rule %s due to traffic allocation. Trying everyone rule.",USER_NOT_IN_FEATURE_EXPERIMENT:"%s: User %s is not in any experiment on the feature %s.",USER_NOT_IN_ROLLOUT:"%s: User %s is not in rollout of feature %s.",USER_FORCED_IN_VARIATION:"%s: User %s is forced in variation %s.",USER_MAPPED_TO_FORCED_VARIATION:"%s: Set variation %s for experiment %s and user %s in the forced variation map.",USER_DOESNT_MEET_CONDITIONS_FOR_TARGETING_RULE:"
1%s: User %s does not meet conditions for targeting rule %s.",USER_MEETS_CONDITIONS_FOR_TARGETING_RULE:"%s: User %s meets conditions for targeting rule %s.",USER_HAS_VARIATION:"%s: User %s is in variation %s of experiment %s.",USER_HAS_FORCED_DECISION_WITH_RULE_SPECIFIED:"Variation (%s) is mapped to flag (%s), rule (%s) and user (%s) in the forced decision map.",USER_HAS_FORCED_DECISION_WITH_NO_RULE_SPECIFIED:"Variation (%s) is mapped to flag (%s) and user (%s) in the forced decision map.",USER_HAS_FORCED_DECISION_WITH_RULE_SPECIFIED_BUT_INVALID:"Invalid variation is mapped to flag (%s), rule (%s) and user (%s) in the forced decision map.",USER_HAS_FORCED_DECISION_WITH_NO_RULE_SPECIFIED_BUT_INVALID:"Invalid variation is mapped to flag (%s) and user (%s) in the forced decision map.",USER_HAS_FORCED_VARIATION:"%s: Variation %s is mapped to experiment %s and user %s in the forced variation map.",USER_HAS_NO_VARIATION:"%s: User %s is in no variation of experiment %s.",USER_HAS_NO_FORCED_VARIATION:"%s: User %s is not in the forced variation map.",USER_HAS_NO_FORCED_VARIATION_FOR_EXPERIMENT:"%s: No experiment %s mapped to user %s in the forced variation map.",USER_NOT_IN_ANY_EXPERIMENT:"%s: User %s is not in any experiment of group %s.",USER_NOT_IN_EXPERIMENT:"%s: User %s does not meet conditions to be in experiment %s.",USER_RECEIVED_DEFAULT_VARIABLE_VALUE:'%s: User "%s" is not in any variation or rollout rule. Returning default value for variable "%s" of feature flag "%s".',FEATURE_NOT_ENABLED_RETURN_DEFAULT_VARIABLE_VALUE:'%s: Feature "%s" is not enabled for user %s. Returning the default variable value "%s".',VARIABLE_NOT_USED_RETURN_DEFAULT_VARIABLE_VALUE:'%s: Variable "%s" is not used in variation "%s". Returning default value.',USER_RECEIVED_VARIABLE_VALUE:'%s: Got variable value "%s" for variable "%s" of feature flag "%s"',VALID_DATAFILE:"%s: Datafile is valid.",VALID_USER_PROFILE_SERVICE:"%s: Valid user profile service provided.",VARIATION_REMOVED_FOR_USER:"%s: Variation mapped to experiment %s has been removed for user %s.",VARIABLE_REQUESTED_WITH_WRONG_TYPE:'%s: Requested variable type "%s", but variable is of type "%s". Use correct API to retrieve value. Returning None.',VALID_BUCKETING_ID:'%s: BucketingId is valid: "%s"',BUCKETING_ID_NOT_STRING:"%s: BucketingID attribute is not a string. Defaulted to userId",EVALUATING_AUDIENCE:'%s: Starting to evaluate audience "%s" with conditions: %s.',EVALUATING_AUDIENCES_COMBINED:'%s: Evaluating audiences for %s "%s": %s.',AUDIENCE_EVALUATION_RESULT:'%s: Audience "%s" evaluated to %s.',AUDIENCE_EVALUATION_RESULT_COMBINED:"%s: Audiences for %s %s collectively evaluated to %s.",MISSING_ATTRIBUTE_VALUE:'%s: Audience condition %s evaluated to UNKNOWN because no value was passed for user attribute "%s".',UNEXPECTED_CONDITION_VALUE:"%s: Audience condition %s evaluated to UNKNOWN because the condition value is not supported.",UNEXPECTED_TYPE:'%s: Audience condition %s evaluated to UNKNOWN because a value of type "%s" was passed for user attribute "%s".',UNEXPECTED_TYPE_NULL:'%s: Audience condition %s evaluated to UNKNOWN because a null value was passed for user attribute "%s".',UNKNOWN_CONDITION_TYPE:"%s: Audience condition %s has an unknown condition type. You may need to upgrade to a newer release of the Optimizely SDK.",UNKNOWN_MATCH_TYPE:"%s: Audience condition %s uses an unknown match type. You may need to upgrade to a newer release of the Optimizely SDK.",UPDATED_OPTIMIZELY_CONFIG:"%s: Updated Optimizely config to revision %s (project id %s)",OUT_OF_BOUNDS:'%s: Audience condition %s evaluated to UNKNOWN because the number value for user attribute "%s" is not in the range [-2^53, +2^53].',UNABLE_TO_ATTACH_UNLOAD:'%s: unable to bind optimizely.close() to page unload event: "%s"'},ef={BOT_FILTERING:"$opt_bot_filtering",BUCKETING_ID:"$opt_bucketing_id",STICKY_BUCKETING_KEY:"$opt_experiment_bucket_map",USER_AGENT:"$opt_user_agent",FORCED_DECISION_NULL_RULE_KEY:"$opt_null_rule_key"},eg="javascript-sdk",eE="node-sdk",eh="5.4.1",e_={AB_TEST:"ab-test",FEATURE:"feature",FEATURE_TEST:"feature-test",FEATURE_VARIABLE:"feature-variable",ALL_FEATURE_VARIABLES:"all-feature-variables",FLAG:"flag"},eI={FEATURE_TEST:"feature-test",ROLLOUT:"rollout",EXPERIMENT:"experiment"},ev={RULE:"rule",EXPERIMENT:"experiment"},ey={BOOLEAN:"boolean",DOUBLE:"double",INTEGER:"integer",STRING:"string",JSON:"json"},eR={V2:"2",V3:"3",V4:"4"},eO={SDK_NOT_READY:"Optimizely SDK not configured properly yet.",FLAG_KEY_INVALID:'No flag was found for key "%s".',VARIABLE_VALUE_INVALID:'Variable value for key "%s" is invali
1d or wrong type.'};(l=v||(v={})).ACTIVATE="ACTIVATE:experiment, user_id,attributes, variation, event",l.DECISION="DECISION:type, userId, attributes, decisionInfo",l.LOG_EVENT="LOG_EVENT:logEvent",l.OPTIMIZELY_CONFIG_UPDATE="OPTIMIZELY_CONFIG_UPDATE",l.TRACK="TRACK:event_key, user_id, attributes, event_tags, event",(c=y||(y={})).VUID="vuid",c.FS_USER_ID="fs_user_id";var eN="fs-user-id",eT="fullstack";(d=R||(R={})).IDENTIFIED="identified",d.INITIALIZED="client_initialized";var em=Object.freeze({__proto__:null,LOG_LEVEL:ec,ERROR_MESSAGES:ed,LOG_MESSAGES:ep,CONTROL_ATTRIBUTES:ef,JAVASCRIPT_CLIENT_ENGINE:eg,NODE_CLIENT_ENGINE:eE,REACT_CLIENT_ENGINE:"react-sdk",REACT_NATIVE_CLIENT_ENGINE:"react-native-sdk",REACT_NATIVE_JS_CLIENT_ENGINE:"react-native-js-sdk",CLIENT_VERSION:eh,DECISION_NOTIFICATION_TYPES:e_,DECISION_SOURCES:eI,AUDIENCE_EVALUATION_TYPES:ev,FEATURE_VARIABLE_TYPES:ey,DATAFILE_VERSIONS:eR,DECISION_MESSAGES:eO,get NOTIFICATION_TYPES(){return v},REQUEST_TIMEOUT_MS:6e4,REQUEST_TIMEOUT_ODP_SEGMENTS_MS:1e4,REQUEST_TIMEOUT_ODP_EVENTS_MS:1e4,get ODP_USER_KEY(){return y},FS_USER_ID_ALIAS:eN,ODP_DEFAULT_EVENT_TYPE:eT,get ODP_EVENT_ACTION(){return R}}),eA=er("EventProcessor"),eD=er("EventProcessor"),eS=function(){function e(e){var t=e.key,r=e.maxValues;this.LS_KEY=t,this.maxValues=void 0===r?1e3:r}return e.prototype.get=function(e){return this.getMap()[e]||null},e.prototype.set=function(e,t){var r=this.getMap();r[e]=t,this.replace(r)},e.prototype.remove=function(e){var t=this.getMap();delete t[e],this.replace(t)},e.prototype.values=function(){return K(this.getMap())},e.prototype.clear=function(){this.replace({})},e.prototype.replace=function(e){try{"u">typeof window?window&&window.localStorage&&localStorage.setItem(this.LS_KEY,JSON.stringify(e)):localStorage.setItem(this.LS_KEY,JSON.stringify(e)),this.clean()}catch(e){eD.error(String(e))}},e.prototype.clean=function(){var e=this.getMap(),t=Object.keys(e),r=t.length-this.maxValues;if(!(r<1)){var i=t.map(function(t){return{key:t,value:e[t]}});i.sort(function(e,t){return e.value.timestamp-t.value.timestamp});for(var n=0;n<r;n++)delete e[i[n].key];this.replace(e)}},e.prototype.getMap=function(){try{var e="u">typeof window?window&&window.localStorage&&localStorage.getItem(this.LS_KEY):localStorage.getItem(this.LS_KEY);if(e)return JSON.parse(e)||{}}catch(e){eD.error(e)}return{}},e}(),eU=er("EventProcessor"),eC=function(e){function t(t){var r=t.eventDispatcher;return e.call(this,{eventDispatcher:r,store:new eS({maxValues:100,key:"fs_optly_pending_events"})})||this}return b(t,e),t}(function(){function e(e){var t=e.eventDispatcher,r=e.store;this.dispatcher=t,this.store=r}return e.prototype.dispatchEvent=function(e,t){this.send({uuid:G(),timestamp:new Date().getTime(),request:e},t)},e.prototype.sendPendingEvents=function(){var e=this,t=this.store.values();eU.debug("Sending %s pending events from previous page",t.length),t.forEach(function(t){try{e.send(t,function(){})}catch(e){eU.debug(String(e))}})},e.prototype.send=function(e,t){var r=this;this.store.set(e.uuid,e),this.dispatcher.dispatchEvent(e.request,function(i){r.store.remove(e.uuid),t(i)})},e}()),eL="$opt_bot_filtering",eb=function(){function e(){this.reqsInFlightCount=0,this.reqsCompleteResolvers=[]}return e.prototype.trackRequest=function(e){var t=this;this.reqsInFlightCount++;var r=function(){t.reqsInFlightCount--,0===t.reqsInFlightCount&&(t.reqsCompleteResolvers.forEach(function(e){return e()}),t.reqsCompleteResolvers=[])};e.then(r,r)},e.prototype.onRequestsComplete=function(){var e=this;return new Promise(function(t){0===e.reqsInFlightCount?t():e.reqsCompleteResolvers.push(t)})},e}(),eV=er("LogTierV1EventProcessor"),eP=function(){function e(e){var t,r,i,n,o,s,a=e.dispatcher,u=e.closingDispatcher,l=e.flushInterval,c=void 0===l?3e4:l,d=e.batchSize,p=void 0===d?10:d,f=e.notificationCenter;this.dispatcher=a,this.closingDispatcher=u,this.notificationCenter=f,this.requestTracker=new eb,(t=c)<=0&&(eA.warn("Invalid flushInterval ".concat(t,", defaulting to ").concat(3e4)),t=3e4),c=t,(r=Math.floor(r=p))<1&&(eA.warn("Invalid batchSize ".concat(r,", defaulting to ").concat(10)),r=10),p=r=Math.max(1,r),this.queue=(i=p,n=c,o=this.drainQueue.bind(this,!1),s=this.drainQueue.bind(this,!0),i>1?new el({flushInterval:n,maxQueueSize:i,sink:o,closingSink:s,batchComparator:eo}):new eu({sink:o}))}return e.prototype.drainQueue=function(e,t){var r=this,i=new Promise(function(i){if(eV.debug("draining queue with %s events",t.length),0===t.length)return void i();var n,o,s,a={url:"https://logx.optimizely.com/v1/events",httpVerb:"POST",params:(n=[],o=t[0],t.forEach(function(e){if("conversion"===e.type||"impression"===e.type){var t,r,i,o,s,a,u,l,c,d,p,f,g,E,h,_,I=(r={snapshots:[],visitor_id:(t=e).user.id,attributes:[]}
1,t.user.attributes.forEach(function(e){r.attributes.push({entity_id:e.entityId,key:e.key,type:"custom",value:e.value})}),"boolean"==typeof t.context.botFiltering&&r.attributes.push({entity_id:eL,key:eL,type:"custom",value:t.context.botFiltering}),r);"impression"===e.type?I.snapshots.push((a=(i=e).layer,u=i.experiment,l=i.variation,c=i.ruleKey,d=i.flagKey,p=i.ruleType,f=i.enabled,{decisions:[{campaign_id:g=a?a.id:null,experiment_id:null!=(o=null==u?void 0:u.id)?o:"",variation_id:null!=(s=null==l?void 0:l.id)?s:"",metadata:{flag_key:d,rule_key:c,rule_type:p,variation_key:l?l.key:"",enabled:f}}],events:[{entity_id:g,timestamp:i.timestamp,key:"campaign_activated",uuid:i.uuid}]})):"conversion"===e.type&&I.snapshots.push((h=V({},(E=e).tags),delete h.revenue,delete h.value,_={entity_id:E.event.id,key:E.event.key,timestamp:E.timestamp,uuid:E.uuid},E.tags&&(_.tags=E.tags),null!=E.value&&(_.value=E.value),null!=E.revenue&&(_.revenue=E.revenue),{events:[_]})),n.push(I)}}),{client_name:o.context.clientName,client_version:o.context.clientVersion,account_id:o.context.accountId,project_id:o.context.projectId,revision:o.context.revision,anonymize_ip:o.context.anonymizeIP,enrich_decisions:!0,visitors:n})};(e&&r.closingDispatcher?r.closingDispatcher:r.dispatcher).dispatchEvent(a,function(){i()}),s=r.notificationCenter,s&&s.sendNotifications(v.LOG_EVENT,a)});return this.requestTracker.trackRequest(i),i},e.prototype.process=function(e){this.queue.enqueue(e)},e.prototype.stop=function(){try{return this.queue.stop(),this.requestTracker.onRequestsComplete()}catch(e){eV.error('Error stopping EventProcessor: "%s"',Object(e).message,String(e))}return Promise.resolve()},e.prototype.start=function(){return P(this,void 0,void 0,function(){return F(this,function(e){switch(e.label){case 0:return[4,this.queue.start()];case 1:return e.sent(),[2]}})})},e}(),eF="CONFIG_VALIDATOR",eM=[eR.V2,eR.V3,eR.V4],ek=function(e){if("object"==typeof e&&null!==e){var t=e.errorHandler,r=e.eventDispatcher,i=e.logger;if(t&&"function"!=typeof t.handleError)throw Error(q(ed.INVALID_ERROR_HANDLER,eF));if(r&&"function"!=typeof r.dispatchEvent)throw Error(q(ed.INVALID_EVENT_DISPATCHER,eF));if(i&&"function"!=typeof i.log)throw Error(q(ed.INVALID_LOGGER,eF));return!0}throw Error(q(ed.INVALID_CONFIG,eF))},ex=function(e){if(!e)throw Error(q(ed.NO_DATAFILE_SPECIFIED,eF));if("string"==typeof e)try{e=JSON.parse(e)}catch(e){throw Error(q(ed.INVALID_DATAFILE_MALFORMED,eF))}if("object"==typeof e&&!Array.isArray(e)&&null!==e&&-1===eM.indexOf(e.version))throw Error(q(ed.INVALID_DATAFILE_VERSION,eF,e.version));return e},ew="POST",eG={dispatchEvent:function(e,t){var r,i,n=e.params,o=e.url;e.httpVerb===ew?((i=new XMLHttpRequest).open(ew,o,!0),i.setRequestHeader("Content-Type","application/json"),i.onreadystatechange=function(){if(4===i.readyState&&t&&"function"==typeof t)try{t({statusCode:i.status})}catch(e){}},i.send(JSON.stringify(n))):(o+="?wxhr=true",n&&(o+="&"+Object.keys(r=n).map(function(e){return encodeURIComponent(e)+"="+encodeURIComponent(r[e])}).join("&")),(i=new XMLHttpRequest).open("GET",o,!0),i.onreadystatechange=function(){if(4===i.readyState&&t&&"function"==typeof t)try{t({statusCode:i.status})}catch(e){}},i.send())}},eB={dispatchEvent:function(e,t){var r=e.params,i=e.url,n=new Blob([JSON.stringify(r)],{type:"application/json"});t({statusCode:navigator.sendBeacon(i,n)?200:500})}},eK=function(){function e(){}return e.prototype.log=function(){},e}();function ej(e){return new Q(e)}var eq=Object.freeze({__proto__:null,NoOpLogger:eK,createLogger:ej,createNoOpLogger:function(){return new eK}}),eH=function(){function e(e){var t=this;this.logger=e.logger,this.errorHandler=e.errorHandler,this.notificationListeners={},K(v).forEach(function(e){t.notificationListeners[e]=[]}),this.listenerId=1}return e.prototype.addNotificationListener=function(e,t){try{if(!(K(v).indexOf(e)>-1))return -1;this.notificationListeners[e]||(this.notificationListeners[e]=[]);var r=!1;if((this.notificationListeners[e]||[]).forEach(function(e){if(e.callback===t){r=!0;return}}),r)return -1;this.notificationListeners[e].push({id:this.listenerId,callback:t});var i=this.listenerId;return this.listenerId+=1,i}catch(e){return this.logger.log(ec.ERROR,e.message),this.errorHandler.handleError(e),-1}},e.prototype.removeNotificationListener=function(e){var t,r,i=this;try{if(Object.keys(this.notificationListeners).some(function(n){return(i.notificationListeners[n]||[]).every(function(i,o){return i.id!==e||(t=o,r=n,!1)}),void 0!==t&&void 0!==r}),void 0!==t&&void 0!==r)return this.notificationListeners[r].splice(t,1),!0}catch(e){this.logger.log(ec.ERROR,e.message),this.errorHandler.handleError(e)}return!1},e.prototype.clearAllNotificationListeners=function(){var e=this;try{K(v).forEach(function(t){e.notificationListeners[t]=[]})}catch(e){this.logger.log(ec.ERROR,e.message),this.errorHandler.handleError(e)}},e.prototype.clearNotificationListeners=function(e){try{this.notificationListeners[e]=[]}catch(e){this.logger.log(ec.ERROR,e.message),this.errorHandler.handleError(e)}},e.prototype.sendNotifications=function(e,t){var r=this;
1try{(this.notificationListeners[e]||[]).forEach(function(i){var n=i.callback;try{n(t)}catch(t){r.logger.log(ec.ERROR,ep.NOTIFICATION_LISTENER_EXCEPTION,"NOTIFICATION_CENTER",e,t.message)}})}catch(e){this.logger.log(ec.ERROR,e.message),this.errorHandler.handleError(e)}},e}(),ez=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return new(eP.bind.apply(eP,M([void 0],e,!1)))};(p=O||(O={})).IGNORE_CACHE="IGNORE_CACHE",p.RESET_CACHE="RESET_CACHE",(f=N||(N={})).BOOLEAN="boolean",f.DOUBLE="double",f.INTEGER="integer",f.STRING="string",f.JSON="json",(g=T||(T={})).DISABLE_DECISION_EVENT="DISABLE_DECISION_EVENT",g.ENABLED_FLAGS_ONLY="ENABLED_FLAGS_ONLY",g.IGNORE_USER_PROFILE_SERVICE="IGNORE_USER_PROFILE_SERVICE",g.INCLUDE_REASONS="INCLUDE_REASONS",g.EXCLUDE_VARIABLES="EXCLUDE_VARIABLES";var eX="Polling intervals below ".concat(30," seconds are not recommended."),eY=[0,8,16,32,64,128,256,512],eJ=er("DatafileManager"),eW=function(){function e(){this.listeners={},this.listenerId=1}return e.prototype.on=function(e,t){var r=this;this.listeners[e]||(this.listeners[e]={});var i=String(this.listenerId);return this.listenerId++,this.listeners[e][i]=t,function(){r.listeners[e]&&delete r.listeners[e][i]}},e.prototype.emit=function(e,t){var r=this.listeners[e];r&&Object.keys(r).forEach(function(e){(0,r[e])(t)})},e.prototype.removeAllListeners=function(){this.listeners={}},e}(),eQ=function(){function e(){this.errorCount=0}return e.prototype.getDelay=function(){return 0===this.errorCount?0:1e3*eY[Math.min(eY.length-1,this.errorCount)]+Math.round(1e3*Math.random())},e.prototype.countError=function(){this.errorCount<eY.length-1&&this.errorCount++},e.prototype.reset=function(){this.errorCount=0},e}(),eZ=function(){function e(){}return e.getNotificationCenter=function(e,t){var r;return(void 0===t&&(t=er()),e)?(this._notificationCenters.has(e)?r=this._notificationCenters.get(e):(r=new eH({logger:t,errorHandler:{handleError:function(){}}}),this._notificationCenters.set(e,r)),r):void t.log(I.ERROR,"No SDK key provided to getNotificationCenter.")},e.removeNotificationCenter=function(e){if(e){var t=this._notificationCenters.get(e);t&&(t.clearAllNotificationListeners(),this._notificationCenters.delete(e))}},e._notificationCenters=new Map,e}(),e$=er("DatafileManager");function e0(e){return e>=200&&e<400}var e1={get:function(){return Promise.resolve(void 0)},set:function(){return Promise.resolve()},contains:function(){return Promise.resolve(!1)},remove:function(){return Promise.resolve(!1)}},e2=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return b(t,e),t.prototype.makeGetRequest=function(e,t){var r;return r=new XMLHttpRequest,{responsePromise:new Promise(function(i,n){r.open("GET",e,!0),Object.keys(t).forEach(function(e){var i=t[e];r.setRequestHeader(e,i)}),r.onreadystatechange=function(){if(4===r.readyState){if(0===r.status)return void n(Error("Request error"));var e=function(e){var t=e.getAllResponseHeaders();if(null===t)return{};var r=t.split("\r\n"),i={};return r.forEach(function(e){var t=e.indexOf(": ");if(t>-1){var r=e.slice(0,t),n=e.slice(t+2);n.length>0&&(i[r]=n)}}),i}(r);i({statusCode:r.status,body:r.responseText,headers:e})}},r.timeout=6e4,r.ontimeout=function(){eJ.error("Request timed out")},r.send()}),abort:function(){r.abort()}}},t.prototype.getConfigDefaults=function(){return{autoUpdate:!1}},t}(function(){function e(e){var t=this,r=V(V({},this.getConfigDefaults()),e),i=r.datafile,n=r.autoUpdate,o=r.sdkKey,s=r.updateInterval,a=r.urlTemplate,u=r.cache,l=r.customHeaders;this.cache=void 0===u?e1:u,this.cacheKey="opt-datafile-"+o,this.sdkKey=o,this.customHeaders=l,this.isReadyPromiseSettled=!1,this.readyPromiseResolver=function(){},this.readyPromiseRejecter=function(){},this.readyPromise=new Promise(function(e,r){t.readyPromiseResolver=e,t.readyPromiseRejecter=r}),i?(this.currentDatafile=i,o||this.resolveReadyPromise()):this.currentDatafile="",this.isStarted=!1,this.datafileUrl=q(void 0===a?"https://cdn.optimizely.com/datafiles/%s.json":a,o),this.emitter=new eW,this.autoUpdate=void 0!==n&&n,this.updateInterval=void 0===s?3e5:s,this.updateInterval<3e4&&e$.warn(eX),this.currentTimeout=null,this.currentRequest=null,this.backoffController=new eQ,this.syncOnCurrentRequestComplete=!1}return e.prototype.get=function(){return this.currentDatafile},e.prototype.start=function(){this.isStarted||(e$.debug("Datafile manager started"),this.isStarted=!0,this.backoffController.reset(),this.setDatafileFromCacheIfAvailable(),this.syncDatafile())},e.prototype.stop=function(){return e$.debug("Datafile manager stopped"),this.isStarted=!1,this.currentTimeout&&(clearTimeout(this.currentTimeout),this.currentTimeout=null),this.emitter.removeAllListeners(),this.currentRequest&&(this.currentRequest.abort(),this.currentRequest=null),Promise.resolve()},e.prototype.onReady=function(){return this.readyPromise},e.prototype.on=function(e,t){return this.emitter.on(e,t)},e.prototype.onRequestRejected=function(e){this.isStarted&&(this.backoffController.countError(),e instanceof Error?e$.error("Error fetching datafile: %s",e.message,e):"string"==typeof e?e$.error("Error fetching datafile: %s",e):e$.error("Error fetching datafile"))},e.prototype.onRequestResolved=function(e){if(this.isStarted){void 0!==e.statusCode&&e0(e.statusCode)?this.backoffController.reset():this.backoffController.countError(),this.trySavingLastModified(e.headers);var t,r=this.getNextDatafileFromResponse(e);""!==r&&(e$.info("Updating datafile from response"),this.currentDatafile=r,this.cache.set(this.cacheKey,r),this.isReadyPromiseSettled?(null==(t=eZ.getNotificationCenter(this.sdkKey,e$))||t.sendNotifications(v.OPTIMIZELY_CONFIG_UPDATE),this.emitter.emit("update",{datafile:r})):this.resolveReadyPromise())}},e.prototype.onRequestComplete=function(){this.isStarted&&(this.currentRequest=null,this.isReadyPromiseSettled||this.autoUpdate||this.rejectReadyPromise(Error("Failed to become ready")),this.autoUpdate&&this.syncOnCurrentRequestComplete&&this.syncDatafile(),this.syncOnCurrentRequestComplete=!1)},e.prototype.syncDatafile=function(){var e=this,t={};this.customHeaders&&x(t,this.customHeaders),this.lastResponseLastModified&&(t["if-modified-since"]=this.lastResponseLastModified),e$.debug("Making datafile request to url %s with headers: %s",this.datafileUrl,function(){return JSON.stringify(t)}
1),this.currentRequest=this.makeGetRequest(this.datafileUrl,t);var r=function(){e.onRequestComplete()};this.currentRequest.responsePromise.then(function(t){e.onRequestResolved(t)},function(t){e.onRequestRejected(t)}).then(r,r),this.autoUpdate&&this.scheduleNextUpdate()},e.prototype.resolveReadyPromise=function(){this.readyPromiseResolver(),this.isReadyPromiseSettled=!0},e.prototype.rejectReadyPromise=function(e){this.readyPromiseRejecter(e),this.isReadyPromiseSettled=!0},e.prototype.scheduleNextUpdate=function(){var e=this,t=Math.max(this.backoffController.getDelay(),this.updateInterval);e$.debug("Scheduling sync in %s ms",t),this.currentTimeout=setTimeout(function(){e.currentRequest?e.syncOnCurrentRequestComplete=!0:e.syncDatafile()},t)},e.prototype.getNextDatafileFromResponse=function(e){return(e$.debug("Response status code: %s",e.statusCode),void 0===e.statusCode||304===e.statusCode)?"":e0(e.statusCode)?e.body:(e$.error("Datafile fetch request failed with status: ".concat(e.statusCode)),"")},e.prototype.trySavingLastModified=function(e){var t=e["last-modified"]||e["Last-Modified"];void 0!==t&&(this.lastResponseLastModified=t,e$.debug("Saved last modified header value from response: %s",this.lastResponseLastModified))},e.prototype.setDatafileFromCacheIfAvailable=function(){var e=this;this.cache.get(this.cacheKey).then(function(t){e.isStarted&&!e.isReadyPromiseSettled&&t&&(e$.debug("Using datafile from cache"),e.currentDatafile=t,e.resolveReadyPromise())})},e}()),e4=function(){function e(e,t,r,i){this.apiKey=e,this.apiHost=t,this.pixelUrl=r,this.segmentsToCheck=i}return e.prototype.equals=function(e){var t,r;return this.apiHost===e.apiHost&&this.apiKey===e.apiKey&&this.pixelUrl===e.pixelUrl&&(t=this.segmentsToCheck,r=e.segmentsToCheck,t.length===r.length&&t.every(function(e,t){return e===r[t]}))},e}(),e3="Running",e5="$opt_",e6="PROJECT_CONFIG",e8=function(e,t){void 0===t&&(t=null);var r,i,n,o,s=((o=x({},e)).events=(e.events||[]).map(function(e){var t=x({},e);return t.experimentsIds=e.experimentIds,t}),o.audiences=(e.audiences||[]).map(function(e){return x({},e)}),o.experiments=(e.experiments||[]).map(function(e){return x({},e)}),o.featureFlags=(e.featureFlags||[]).map(function(e){return x({},e)}),o.groups=(e.groups||[]).map(function(e){var t=x({},e);return t.experiments=(e.experiments||[]).map(function(e){return x({},e)}),t}),o.rollouts=(e.rollouts||[]).map(function(e){var t=x({},e);return t.experiments=(e.experiments||[]).map(function(e){return x({},e)}),t}),o.environmentKey=null!=(i=e.environmentKey)?i:"",o.sdkKey=null!=(n=e.sdkKey)?n:"",o);s.__datafileStr=null===t?JSON.stringify(e):t,(s.audiences||[]).forEach(function(e){e.conditions=JSON.parse(e.conditions)}),s.audiencesById=w(s.audiences,"id"),x(s.audiencesById,w(s.typedAudiences,"id")),s.attributeKeyMap=w(s.attributes,"key"),s.eventKeyMap=w(s.events,"key"),s.groupIdMap=w(s.groups,"id"),Object.keys(s.groupIdMap||{}).forEach(function(e){(s.groupIdMap[e].experiments||[]).forEach(function(t){s.experiments.push(x(t,{groupId:e}))})}),s.rolloutIdMap=w(s.rollouts||[],"id"),K(s.rolloutIdMap||{}).forEach(function(e){(e.experiments||[]).forEach(function(e){e.isRollout=!0,s.experiments.push(e),e.variationKeyMap=w(e.variations,"key")})});var a=new Set;Object.keys(s.audiencesById).map(function(e){return e7(s.audiencesById[e])}).forEach(function(e){e.forEach(function(e){a.add(e)})});var u=Array.from(a),l=!1,c="",d="",p="";return s.integrations&&(s.integrationKeyMap=w(s.integrations,"key"),s.integrations.forEach(function(e){if(!("key"in e))throw Error(q(ed.MISSING_INTEGRATION_KEY,e6));"odp"===e.key&&(l=!0,d=d||e.publicKey||"",c=c||e.host||"",p=p||e.pixelUrl||"")})),l?s.odpIntegrationConfig={integrated:!0,odpConfig:new e4(d,c,p,u)}:s.odpIntegrationConfig={integrated:!1},s.experimentKeyMap=w(s.experiments,"key"),s.experimentIdMap=w(s.experiments,"id"),s.variationIdMap={},s.variationVariableUsageMap={},(s.experiments||[]).forEach(function(e){e.variationKeyMap=w(e.variations,"key"),x(s.variationIdMap,w(e.variations,"id")),K(e.variationKeyMap||{}).forEach(function(e){e.variables&&(s.variationVariableUsageMap[e.id]=w(e.variables,"id"))})}),s.experimentFeatureMap={},s.featureKeyMap=w(s.featureFlags||[],"key"),K(s.featureKeyMap||{}
1).forEach(function(e){e.variables.forEach(function(e){e.type===ey.STRING&&e.subType===ey.JSON&&(e.type=ey.JSON,delete e.subType)}),e.variableKeyMap=w(e.variables,"key"),(e.experimentIds||[]).forEach(function(t){s.experimentFeatureMap[t]?s.experimentFeatureMap[t].push(e.id):s.experimentFeatureMap[t]=[e.id]})}),s.flagRulesMap={},(s.featureFlags||[]).forEach(function(e){var t=[];e.experimentIds.forEach(function(e){var r=s.experimentIdMap[e];r&&t.push(r)});var r=s.rolloutIdMap[e.rolloutId];r&&t.push.apply(t,r.experiments),s.flagRulesMap[e.key]=t}),s.flagVariationsMap={},Object.keys(r=s.flagRulesMap||{}).map(function(e){return[e,r[e]]}).forEach(function(e){var t=e[0],r=e[1],i=[];r.forEach(function(e){e.variations.forEach(function(e){j(i,function(t){return t.id===e.id})||i.push(e)})}),s.flagVariationsMap[t]=i}),s},e7=function(e){return e.conditions?e9(e.conditions):[]},e9=function(e){var t=[];return["and","or","not"].includes(e)?[]:(Array.isArray(e)?e.forEach(function(e){return t.push.apply(t,e9(e))}):"qualified"===e.match&&t.push(e.value),t)},te=function(e,t){var r=e.experimentIdMap[t];if(!r)throw Error(q(ed.INVALID_EXPERIMENT_ID,e6,t));return r.layerId},tt=function(e,t,r){var i=e.attributeKeyMap[t],n=0===t.indexOf(e5);return i?(n&&r.log(ec.WARNING,"Attribute %s unexpectedly has reserved prefix %s; using attribute ID instead of reserved attribute name.",t,e5),i.id):n?t:(r.log(ec.DEBUG,ed.UNRECOGNIZED_ATTRIBUTE,e6,t),null)},tr=function(e,t){var r=e.eventKeyMap[t];return r?r.id:null},ti=function(e,t){var r=e.experimentKeyMap[t];if(!r)throw Error(q(ed.INVALID_EXPERIMENT_KEY,e6,t));return r.status},tn=function(e,t){var r=e.experimentIdMap[t];if(!r)throw Error(q(ed.INVALID_EXPERIMENT_ID,e6,t));return r.audienceConditions||r.audienceIds},to=function(e,t){return e.variationIdMap.hasOwnProperty(t)?e.variationIdMap[t].key:null},ts=function(e,t,r){var i=e.experimentKeyMap[t];return i.variationKeyMap.hasOwnProperty(r)?i.variationKeyMap[r].id:null},ta=function(e,t){if(e.experimentKeyMap.hasOwnProperty(t)){var r=e.experimentKeyMap[t];if(r)return r}throw Error(q(ed.EXPERIMENT_KEY_NOT_IN_DATAFILE,e6,t))},tu=function(e,t){var r=e.experimentIdMap[t];if(!r)throw Error(q(ed.INVALID_EXPERIMENT_ID,e6,t));return r.trafficAllocation},tl=function(e,t,r){if(e.experimentIdMap.hasOwnProperty(t)){var i=e.experimentIdMap[t];if(i)return i}return r.log(ec.ERROR,ed.INVALID_EXPERIMENT_ID,e6,t),null},tc=function(e,t,r){if(!e)return null;var i=j(e.flagVariationsMap[t],function(e){return e.key===r});return i||null},td=function(e,t,r){if(e.featureKeyMap.hasOwnProperty(t)){var i=e.featureKeyMap[t];if(i)return i}return r.log(ec.ERROR,ed.FEATURE_NOT_IN_DATAFILE,e6,t),null},tp=function(e,t,r,i){var n=e.featureKeyMap[t];if(!n)return i.log(ec.ERROR,ed.FEATURE_NOT_IN_DATAFILE,e6,t),null;var o=n.variableKeyMap[r];return o||(i.log(ec.ERROR,ed.VARIABLE_KEY_NOT_IN_DATAFILE,e6,r,t),null)},tf=function(e,t,r,i){if(!t||!r)return null;if(!e.variationVariableUsageMap.hasOwnProperty(r.id))return i.log(ec.ERROR,ed.VARIATION_ID_NOT_IN_DATAFILE_NO_EXPERIMENT,e6,r.id),null;var n=e.variationVariableUsageMap[r.id][t.id];return n?n.value:null},tg=function(e,t,r){var i;switch(t){case ey.BOOLEAN:"true"!==e&&"false"!==e?(r.log(ec.ERROR,ed.UNABLE_TO_CAST_VALUE,e6,e,t),i=null):i="true"===e;break;case ey.INTEGER:isNaN(i=parseInt(e,10))&&(r.log(ec.ERROR,ed.UNABLE_TO_CAST_VALUE,e6,e,t),i=null);break;case ey.DOUBLE:isNaN(i=parseFloat(e))&&(r.log(ec.ERROR,ed.UNABLE_TO_CAST_VALUE,e6,e,t),i=null);break;case ey.JSON:try{i=JSON.parse(e)}catch(n){r.log(ec.ERROR,ed.UNABLE_TO_CAST_VALUE,e6,e,t),i=null}break;default:i=e}return i},tE=function(e){return e.__datafileStr},th=function(e){try{t=ex(e.datafile)}catch(e){return{configObj:null,error:e}}if(e.jsonSchemaValidator)try{e.jsonSchemaValidator.validate(t),e.logger.log(ec.INFO,ep.VALID_DATAFILE,e6)}catch(e){return{configObj:null,error:e}}else e.logger.log(ec.INFO,ep.SKIPPING_JSON_VALIDATION,e6);var t,r=[t];return"string"==typeof e.datafile&&r.push(e.datafile),{configObj:e8.apply(void 0,r),error:null}},t_=function(e){return!!e.sendFlagDecisions},tI=function(){function e(e,t){void 0===t&&(t=6e4),this.logger=e,this.timeout=t}return e.prototype.makeRequest=function(e,t,r,i){var n=this,o=new XMLHttpRequest;return{responsePromise:new Promise(function(s,a){o.open(r,e,!0),n.setHeadersInXhr(t,o),o.onreadystatechange=function(){if(o.readyState===XMLHttpRequest.DONE){if(0===o.status)return void a(Error("Request error"));var e=n.parseHeadersFromXhr(o);s({statusCode:o.status,body:o.responseText,headers:e})}},o.timeout=n.timeout,o.ontimeout=function(){n.logger.log(I.WARNING,"Request timed out")},o.send(i)}),abort:function(){o.abort()}}},e.prototype.setHeadersInXhr=function(e,t){Object.keys(e).forEach(function(r){var i=e[r];"string"==typeof i&&t.setRequestHeader(r,i)})},e.prototype.parseHeadersFromXhr=function(e){var t=this,r=e.getAllResponseHeaders();if(null===r)return{};var i=r.split("\r\n"),n={};
1return i.forEach(function(e){try{var r=e.indexOf(": ");if(r>-1){var i=e.slice(0,r),o=e.slice(r+2);i&&o&&(n[i]=o)}}catch(r){t.logger.log(I.WARNING,"Unable to parse & skipped header item '".concat(e,"'"))}}),n},e}(),tv=function(e){var t=e.browserCallback,r=e.nonBrowserCallback;return"u">typeof window?t(null==window?void 0:window.localStorage):r()},ty=function(){function e(){this.logger=er()}return e.prototype.contains=function(e){return P(this,void 0,void 0,function(){var t=this;return F(this,function(r){return[2,tv({browserCallback:function(t){return(null==t?void 0:t.getItem(e))!==null},nonBrowserCallback:function(){return t.logger.error(ed.LOCAL_STORAGE_DOES_NOT_EXIST),!1}})]})})},e.prototype.get=function(e){return P(this,void 0,void 0,function(){var t=this;return F(this,function(r){return[2,tv({browserCallback:function(t){return(null==t?void 0:t.getItem(e))||void 0},nonBrowserCallback:function(){t.logger.error(ed.LOCAL_STORAGE_DOES_NOT_EXIST)}})]})})},e.prototype.remove=function(e){return P(this,void 0,void 0,function(){var t=this;return F(this,function(r){switch(r.label){case 0:return[4,this.contains(e)];case 1:if(r.sent())return tv({browserCallback:function(t){null==t||t.removeItem(e)},nonBrowserCallback:function(){t.logger.error(ed.LOCAL_STORAGE_DOES_NOT_EXIST)}}),[2,!0];return[2,!1]}})})},e.prototype.set=function(e,t){return P(this,void 0,void 0,function(){var r=this;return F(this,function(i){return[2,tv({browserCallback:function(r){null==r||r.setItem(e,t)},nonBrowserCallback:function(){r.logger.error(ed.LOCAL_STORAGE_DOES_NOT_EXIST)}})]})})},e}(),tR=function(){function e(e){void 0===e&&(e=null),this._value=e,this._time=Date.now()}return Object.defineProperty(e.prototype,"value",{get:function(){return this._value},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"time",{get:function(){return this._time},enumerable:!1,configurable:!0}),e.prototype.is_stale=function(e){return!(e<=0)&&Date.now()-this._time>=e},e}(),tO=function(){function e(e){var t=e.maxSize,r=e.timeout;this._map=new Map;var i=er();i.debug("Provisioning cache with maxSize of ".concat(t)),i.debug("Provisioning cache with timeout of ".concat(r)),this._maxSize=t,this._timeout=r}return Object.defineProperty(e.prototype,"map",{get:function(){return this._map},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maxSize",{get:function(){return this._maxSize},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"timeout",{get:function(){return this._timeout},enumerable:!1,configurable:!0}),e.prototype.lookup=function(e){if(this._maxSize<=0)return null;var t=this._map.get(e);return t?t.is_stale(this._timeout)?(this._map.delete(e),null):(this._map.delete(e),this._map.set(e,t),t.value):null},e.prototype.save=function(e){var t=e.key,r=e.value;if(!(this._maxSize<=0)&&(this._map.get(t)&&this._map.delete(t),this._map.set(t,new tR(r)),this._map.size>this._maxSize)){var i=this._map.keys().next().value;this._map.delete(i)}},e.prototype.reset=function(){this._maxSize<=0||this._map.clear()},e.prototype.peek=function(e){if(this._maxSize<=0)return null;var t,r=this._map.get(e);return null!=(t=null==r?void 0:r.value)?t:null},e}(),tN=function(e){function t(t){var r,i;return e.call(this,{maxSize:null!=(r=null==t?void 0:t.maxSize)?r:100,timeout:null!=(i=null==t?void 0:t.timeout)?i:6e5})||this}return b(t,e),t}(tO);b(function(e){var t,r;return E.call(this,{maxSize:null!=(t=null==e?void 0:e.maxSize)?t:1e4,timeout:null!=(r=null==e?void 0:e.timeout)?r:6e5})||this},E=tO);var tT=function(){function e(){this._keyForVuid="optimizely-vuid",this._vuid=""}return Object.defineProperty(e.prototype,"vuid",{get:function(){return this._vuid},enumerable:!1,configurable:!0}),e.instance=function(t){return P(this,void 0,void 0,function(){return F(this,function(r){switch(r.label){case 0:if(this._instance||(this._instance=new e),this._instance._vuid)return[3,2];return[4,this._instance.load(t)];case 1:r.sent(),r.label=2;case 2:return[2,this._instance]}})})},e.prototype.load=function(t){return P(this,void 0,void 0,function(){var r;return F(this,function(i){switch(i.label){case 0:return[4,t.get(this._keyForVuid)];case 1:if(!((r=i.sent())&&e.isVuid(r)))return[3,2];return this._vuid=r,[3,4];case 2:return this._vuid=this.makeVuid(),[4,this.save(this._vuid,t)];case 3:i.sent(),i.label=4;case 4:return[2,this._vuid]}})})},e.prototype.makeVuid=function(){var t=G().replace(/-/g,"").toLowerCase(),r="".concat(e.vuid_prefix).concat(t);return r.length<=32?r:r.substring(0,32)},e.prototype.save=function(e,t){return P(this,void 0,void 0,function(){return F(this,function(r){switch(r.label){case 0:return[4,t.set(this._keyForVuid,e)];case 1:return r.sent(),[2]}})})},e._reset=function(){this._instance._vuid=""},e.vuid_prefix="vuid_",e.isVuid=function(t){return(null==t?void 0:t.startsWith(e.vuid_prefix))||!1},e}();function tm(e){var t=["string","number","boolean"],r=!1;return e.forEach(function(e){t.includes(typeof e)||null===e||(r=!0)}),r}var tA=function(e,t,r,i){this.type=e,this.action=t,this.identifiers=null!=r?r:new Map,this.data=null!=i?i:new Map},tD=function(){};(h=m||(m={}))[h.Running=0]="Running",h[h.Stopped=1]="Stopped";var tS=function(){function e(e){var t,r,i,n=e.odpIntegrationConfig,o=e.segmentManager,s=e.eventManager,a=e.logger,u=this;this.ready=!1,this.status=m.Stopped,this.segmentManager=o,this.eventManager=s,this.logger=a,this.configPromise=(t=tD,r=tD,{promise:i=new Promise(function(e,i){t=e,r=i}),resolve:t,reject:r,then:i.then.bind(i)});var l=[this.configPromise];this.isVuidEnabled()&&l.push(this.initializeVuid()),this.initPromise=Promise.all(l),this.onReady().then(function(){u.ready=!0,u.isVuidEnabled()&&u.status===m.Running&&u.registerVuid()}),n&&this.updateSettings(n)}return e.prototype.getStatus=function(){return this.status},e.prototype.start=function(){return P(this,void 0,void 0,function(){return F(this,function(e){return this.status===m.Running?[2]:this.odpIntegrationConfig?this.odpIntegrationConfig.integrated?(this.status=m.Running,this.segmentManager.updateSettings(this.odpIntegrationConfig.odpConfig),this.eventManager.updateSettings(this.odpIntegrationConfig.odpConfig),this.eventManager.start(),[2,Promise.resolve()]):[2,Promise.reject(Error("start() called when ODP is not integrated"))]:[2,Promise.reject(Error("cannot start without ODP config"))]})})},e.prototype.stop=function(){return P(this,void 0,void 0,function(){return F(this,function(e){switch(e.label){case 0:if(this.status===m.Stopped)return[2];return this.status=m.Stopped,[4,this.eventManager.stop()];case 1:return e.sent(),[2]}})})},e.prototype.onReady=function(){return this.initPromise},e.prototype.isReady=function(){return this.ready},e.prototype.updateSettings=function(e){var t;return this.configPromise.resolve(),!(this.odpIntegrationConfig&&(t=this.odpIntegrationConfig,t.integrated===e.integrated&&(!t.integrated||!e.integrated||t.odpConfig.equals(e.odpConfig))))&&(this.odpIntegrationConfig=e,e.integrated?this.status===m.Running?(this.segmentManager.updateSettings(e.odpConfig),this.eventManager.updateSettings(e.odpConfig)):this.start():this.stop(),!0)},e.prototype.fetchQualifiedSegments=function(e,t){return void 0===t&&(t=[]),P(this,void 0,void 0,function(){return F(this,function(r){return this.odpIntegrationConfig?this.odpIntegrationConfig.integrated?tT.isVuid(e)?[2,this.segmentManager.fetchQualifiedSegments(y.VUID,e,t)]:[2,this.segmentManager.fetchQualifiedSegments(y.FS_USER_ID,e,t)]:(this.logger.log(I.ERROR,ed.ODP_NOT_INTEGRATED),[2,null]):(this.logger.log(I.ERROR,ed.ODP_CONFIG_NOT_AVAILABLE),[2,null])})})},e.prototype.identifyUser=function(e,t){this.odpIntegrationConfig?this.odpIntegrationConfig.integrated?e&&tT.isVuid(e)?this.eventManager.identifyUser(void 0,e):this.eventManager.identifyUser(e,t):this.logger.log(I.INFO,ed.ODP_NOT_INTEGRATED):this.logger.log(I.ERROR,ed.ODP_CONFIG_NOT_AVAILABLE)},e.prototype.sendEvent=function(e){var t=e.type,r=e.action,i=e.identifiers,n=e.data,o=t;if(("string"!=typeof o||""===o)&&(o="fullstack"),!this.odpIntegrationConfig)return void this.logger.log(I.ERROR,ed.ODP_CONFIG_NOT_AVAILABLE);if(!this.odpIntegrationConfig.integrated)return void this.logger.log(I.ERROR,ed.ODP_NOT_INTEGRATED);if(tm(n))throw Error(ed.ODP_INVALID_DATA);if("string"!=typeof r||""===r)throw Error("ODP action is not val
1id (cannot be empty).");this.eventManager.sendEvent(new tA(o,r,i,n))},e.prototype.initializeVuid=function(){return Promise.resolve()},e.prototype.registerVuid=function(){if(!this.odpIntegrationConfig)return void this.logger.log(I.ERROR,ed.ODP_CONFIG_NOT_AVAILABLE);if(!this.odpIntegrationConfig.integrated)return void this.logger.log(I.INFO,ed.ODP_NOT_INTEGRATED);var e=this.getVuid();if(e)try{this.eventManager.registerVuid(e)}catch(e){this.logger.log(I.ERROR,ed.ODP_VUID_REGISTRATION_FAILED)}},e}(),tU="ODP event send failed",tC=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return b(t,e),t.prototype.shouldSendEvents=function(e){return e.length<=1||(this.getLogger().log(I.ERROR,"".concat("ODP event send failed"," (browser only supports batch size 1)")),!1)},t.prototype.getPixelApiEndpoint=function(e){return new URL("v2/zaius.gif",e.pixelUrl).href},t.prototype.generateRequestData=function(e,t){var r=this.getPixelApiEndpoint(e),i=e.apiKey,n=t[0],o=new URL(r);return n.identifiers.forEach(function(e,t){o.searchParams.append(t,e)}),n.data.forEach(function(e,t){o.searchParams.append(t,e)}),o.searchParams.append("tracker_id",i),o.searchParams.append("event_type",n.type),o.searchParams.append("vdl_action",n.action),{method:"GET",endpoint:o.toString(),headers:{},data:""}},t}(function(){function e(e,t){this.requestHandler=e,this.logger=t}return e.prototype.getLogger=function(){return this.logger},e.prototype.sendEvents=function(e,t){var r;return P(this,void 0,void 0,function(){var i,n,o,s,a,u,l,c,d;return F(this,function(p){switch(p.label){case 0:if(i=!1,0===t.length)return this.logger.log(I.ERROR,"".concat(tU," (no events)")),[2,i];if(!this.shouldSendEvents(t))return[2,i];o=(n=this.generateRequestData(e,t)).method,s=n.endpoint,a=n.headers,u=n.data,l=0,p.label=1;case 1:return p.trys.push([1,3,,4]),[4,this.requestHandler.makeRequest(s,a,o,u).responsePromise];case 2:return l=null!=(r=p.sent().statusCode)?r:l,[3,4];case 3:return c=p.sent(),d="network error",c instanceof Error&&(d=c.message),this.logger.log(I.ERROR,"".concat(tU," (").concat(d,")")),i=!0,[3,4];case 4:return l>=400&&this.logger.log(I.ERROR,"".concat(tU," (").concat(l,")")),l>=500&&(i=!0),[2,i]}})})},e}()),tL=function(e){"function"==typeof queueMicrotask?queueMicrotask(e):setTimeout(e)};(_=A||(A={}))[_.Stopped=0]="Stopped",_[_.Running=1]="Running";var tb=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.hasNecessaryIdentifiers=function(e){return e.identifiers.size>=0},t}return b(t,e),t.prototype.initParams=function(e,t,r){this.queueSize=t||100,this.batchSize=1,this.flushInterval=0,void 0!==e&&1!==e&&this.getLogger().log(I.WARNING,"ODP event batch size must be 1 in the browser."),void 0!==r&&0!==r&&this.getLogger().log(I.WARNING,"ODP event flush interval must be 0 in the browser.")},t.prototype.discardEventsIfNeeded=function(){this.getLogger().log(I.DEBUG,"ODPConfig not ready. Leaving events in queue.")},t}(function(){function e(e){var t=e.odpConfig,r=e.apiManager,i=e.logger,n=e.clientEngine,o=e.clientVersion,s=e.queueSize,a=e.batchSize,u=e.flushInterval,l=e.userAgentParser,c=e.retries;if(this.status=A.Stopped,this.queue=[],this.apiManager=r,this.logger=i,this.clientEngine=n,this.clientVersion=o,this.initParams(a,s,u),this.status=A.Stopped,this.userAgentParser=l,this.retries=c||3,l){var d=l.parseUserAgentInfo(),p=d.os,f=d.device,g={os:p.name,os_version:p.version,device_type:f.type,model:f.model};this.userAgentData=new Map(Object.entries(g).filter(function(e){e[0];var t=e[1];return null!=t&&void 0!=t}))}t&&this.updateSettings(t)}return e.prototype.updateSettings=function(e){this.odpConfig&&this.odpConfig.equals(e)||(this.flush(),this.odpConfig=e)},e.prototype.flush=function(){this.processQueue(!0)},e.prototype.start=function(){this.odpConfig?(this.status=A.Running,this.batchSize>1&&this.setNewTimeout()):this.logger.log(I.ERROR,ed.ODP_CONFIG_NOT_AVAILABLE)},e.prototype.stop=function(){return P(this,void 0,void 0,function(){return F(this,function(e){return this.logger.log(I.DEBUG,"Stop requested."),this.flush(),this.clearCurrentTimeout(),this.status=A.Stopped,this.logger.log(I.DEBUG,"Stopped. Queue Count: %s",this.queue.length),[2]})})},e.prototype.registerVuid=function(e){var t=new Map;t.set(y.VUID,e);var r=new tA(eT,R.INITIALIZED,t);this.sendEvent(r)},e.prototype.identifyUser=function(e,t){var r=new Map;if(!e&&!t)return void this.logger.log(I.ERROR,ed.ODP_SEND_EVENT_FAILED_UID_MISSING);t&&r.set(y.VUID,t),e&&r.set(y.FS_USER_ID,e);var i=new tA(eT,R.IDENTIFIED,r);this.sendEvent(i)},e.prototype.sendEvent=function(e){tm(e.data)?this.logger.log(I.ERROR,"Event data found to be invalid."):(e.data=this.augmentCommonData(e.data),this.enqueue(e))},e.prototype.enqueue=function(e){this.status===A.Stopped?this.logger.log(I.WARNING,"Failed to Process ODP Event. ODPEventManager is not running."):this.hasNecessaryIdentifiers(e)?this.queue.length>=this.queueSize?this.logger.log(I.WARNING,"Failed to Process ODP Event. Event Queue full. queueSize = %s.",this.queue.length):(this.queue.push(e),this.processQueue()):this.logger.log(I.ERROR,"ODP events should have at least one key-value pair in identifiers.")},e.prototype.processQueue=function(e){if(void 0===e&&(e=!1),this.status===A.Running){if(e)for(this.clearCurrentTimeout();this.queueContainsItems();)this.makeAndSend1Batch();else if(this.queueHasBatches())for(this.clearCurrentTimeout();this.queueHasBatches();)this.makeAndSend1Batch();this.batchSize>1&&this.setNewTimeout()}},e.prototype.clearCurrentTimeout=function(){clearTimeout(this.timeoutId),this.timeoutId=void 0},e.prototype.setNewTimeout=function(){var e=this;void 0===this.timeoutId&&(this.timeoutId=setTimeout(function(){return e.processQueue(!0)},this.flushInterval))},e.prototype.makeAndSend1Batch=function(){var e=this;if(this.odpConfig){var t=this.queue.splice(0,this.batchSize),r=this.odpConfig;t.length>0&&tL(function(){return P(e,void 0,void 0,function(){var e,i;return F(this,function(n){switch(n.label){case 0:i=0,n.label=1;case 1:return[4,this.apiManager.sendEvents(r,t)];case 2:e=n.sent(),i+=1,n.label=3;case 3:if(e&&i<this.retries)return[3,1];n.label=4;case 4:return[2]}})})})}},e.prototype.queueHasBatches=function(){return this.queueContainsItems()&&this.queue.length%this.batchSize==0},e.prototype.queueContainsItems=function(){return this.queue.length>0},e.prototype.augmentCommonData=function(e){var t=new Map(this.userAgentData);return t.set("idempotence_id",G()),t.set("data_source_type","sdk"),t.set("data_source",this.clientEngine),t.set("data_source_version",this.clientVersion),e.forEach(function(e,r){return t.set(r,e)}),t},e.prototype.getLogger=function(){return this.logger},e.prototype.getQueue=function(){return this.queue},e}
1()),tV=function(){function e(e,t,r,i){this.odpConfig=i,this._segmentsCache=e,this.odpSegmentApiManager=t,this.logger=r||er("OdpSegmentManager")}return Object.defineProperty(e.prototype,"segmentsCache",{get:function(){return this._segmentsCache},enumerable:!1,configurable:!0}),e.prototype.fetchQualifiedSegments=function(e,t,r){return P(this,void 0,void 0,function(){var i,n,o,s,a,u;return F(this,function(l){switch(l.label){case 0:if(!this.odpConfig)return this.logger.log(I.WARNING,ed.ODP_CONFIG_NOT_AVAILABLE),[2,null];if(!(i=this.odpConfig.segmentsToCheck)||i.length<=0)return this.logger.log(I.DEBUG,"No segments are used in the project. Returning an empty list."),[2,[]];if(n=this.makeCacheKey(e,t),o=r.includes(O.IGNORE_CACHE),(s=r.includes(O.RESET_CACHE))&&this.reset(),!o&&!s){if(a=this._segmentsCache.lookup(n))return this.logger.log(I.DEBUG,'ODP cache hit. Returning segments from cache "%s".',n),[2,a];this.logger.log(I.DEBUG,"ODP cache miss.")}return this.logger.log(I.DEBUG,"Making a call to ODP server."),[4,this.odpSegmentApiManager.fetchSegments(this.odpConfig.apiKey,this.odpConfig.apiHost,e,t,i)];case 1:return(u=l.sent())&&!o&&this._segmentsCache.save({key:n,value:u}),[2,u]}})})},e.prototype.reset=function(){this._segmentsCache.reset()},e.prototype.makeCacheKey=function(e,t){return"".concat(e,"-$-").concat(t)},e.prototype.updateSettings=function(e){this.odpConfig=e,this.reset()},e}(),tP={$schema:"http://json-schema.org/draft-04/schema#",title:"Project Config JSON Schema",type:"object",properties:{projectId:{type:"string",required:!0},accountId:{type:"string",required:!0},groups:{type:"array",items:{type:"object",properties:{id:{type:"string",required:!0},policy:{type:"string",required:!0},trafficAllocation:{type:"array",items:{type:"object",properties:{entityId:{type:"string",required:!0},endOfRange:{type:"integer",required:!0}}},required:!0},experiments:{type:"array",items:{type:"object",properties:{id:{type:"string",required:!0},key:{type:"string",required:!0},status:{type:"string",required:!0},layerId:{type:"string",required:!0},variations:{type:"array",items:{type:"object",properties:{id:{type:"string",required:!0},key:{type:"string",required:!0}}},required:!0},trafficAllocation:{type:"array",items:{type:"object",properties:{entityId:{type:"string",required:!0},endOfRange:{type:"integer",required:!0}}},required:!0},audienceIds:{type:"array",items:{type:"string"},required:!0},forcedVariations:{type:"object",required:!0}}},required:!0}}},required:!0},experiments:{type:"array",items:{type:"object",properties:{id:{type:"string",required:!0},key:{type:"string",required:!0},status:{type:"string",required:!0},layerId:{type:"string",required:!0},variations:{type:"array",items:{type:"object",properties:{id:{type:"string",required:!0},key:{type:"string",required:!0}}},required:!0},trafficAllocation:{type:"array",items:{type:"object",properties:{entityId:{type:"string",required:!0},endOfRange:{type:"integer",required:!0}}},required:!0},audienceIds:{type:"array",items:{type:"string"},required:!0},forcedVariations:{type:"object",required:!0}}},required:!0},events:{type:"array",items:{type:"object",properties:{key:{type:"string",required:!0},experimentIds:{type:"array",items:{type:"string",required:!0}},id:{type:"string",required:!0}}},required:!0},audiences:{type:"array",items:{type:"object",properties:{id:{type:"string",required:!0},name:{type:"string",required:!0},conditions:{type:"string",required:!0}}},required:!0},attributes:{type:"array",items:{type:"object",properties:{id:{type:"string",required:!0},key:{type:"string",required:!0}}},required:!0},version:{type:"string",required:!0},revision:{type:"string",required:!0},integrations:{type:"array",items:{type:"object",properties:{key:{type:"string",required:!0},host:{type:"string"},publicKey:{type:"string"},pixelUrl:{type:"string"}}}}}},tF={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://example.com/example.json",title:"ODP Response Schema",type:"object",required:["data"],properties:{data:{title:"The data Schema",type:"object",required:["customer"],properties:{customer:{title:"The customer Schema",type:"object",required:[],properties:{audiences:{title:"The audiences Schema",type:"object",required:["edges"],properties:{edges:{title:"The edges Schema",type:"array",items:{title:"A Schema",type:"object",required:["node"],properties:{node:{title:"The node Schema",type:"object",required:["name","state"],properties:{name:{title:"The name Schema",type:"string",examples:["has_email","has_email_opted_in"]}
1,state:{title:"The state Schema",type:"string",examples:["qualified"]}},examples:[]}},examples:[]},examples:[]}},examples:[]}},examples:[]}},examples:[]},errors:{title:"The errors Schema",type:"array",default:[],items:{title:"A Schema",type:"object",required:["message","locations","extensions"],properties:{message:{title:"The message Schema",type:"string",examples:["Exception while fetching data (/customer) : java.lang.RuntimeException: could not resolve _fs_user_id = asdsdaddddd"]},locations:{title:"The locations Schema",type:"array",items:{title:"A Schema",type:"object",required:["line","column"],properties:{line:{title:"The line Schema",type:"integer",examples:[2]},column:{title:"The column Schema",type:"integer",examples:[3]}},examples:[]},examples:[]},path:{title:"The path Schema",type:"array",items:{title:"A Schema",type:"string",examples:["customer"]},examples:[]},extensions:{title:"The extensions Schema",type:"object",required:["classification"],properties:{classification:{title:"The classification Schema",type:"string",examples:["InvalidIdentifierException"]}},examples:[]}},examples:[]},examples:[]}},examples:[]},tM=[],tk="Audience segments fetch failed",tx=function(){function e(e,t){this.toGraphQLJson=function(e,t,r){return M(M(['{"query" : "query {customer',"(".concat(e,' : \\"').concat(t,'\\") '),"{audiences","(subset: ["],(null==r?void 0:r.map(function(e,t){return'\\"'.concat(e,'\\"').concat(t<r.length-1?",":"")}))||"",!0),[']) {edges {node {name state}}}}}"}'],!1).join("")},this.requestHandler=e,this.logger=t}return e.prototype.fetchSegments=function(e,t,r,i,n){var o,s,a,u;return P(this,void 0,void 0,function(){var l,c,d,p,f,g,E,h;return F(this,function(_){switch(_.label){case 0:if(!e||!t)return this.logger.log(I.ERROR,"".concat(tk," (Parameters apiKey or apiHost invalid)")),[2,null];if((null==n?void 0:n.length)===0)return[2,tM];return l="".concat(t,"/v3/graphql"),c=this.toGraphQLJson(r,i,n),[4,this.querySegments(e,l,r,i,c)];case 1:if(!(d=_.sent()))return this.logger.log(I.ERROR,"".concat(tk," (network error)")),[2,null];if(!(p=this.parseSegmentsResponseJson(d)))return this.logger.log(I.ERROR,"".concat(tk," (decode error)")),[2,null];if((null==(o=p.errors)?void 0:o.length)>0)return g=(f=p.errors[0].extensions).code,E=f.classification,"INVALID_IDENTIFIER_EXCEPTION"==g?this.logger.log(I.ERROR,"".concat(tk," (invalid identifier)")):this.logger.log(I.ERROR,"".concat(tk," (").concat(E,")")),[2,null];if(!(h=null==(u=null==(a=null==(s=null==p?void 0:p.data)?void 0:s.customer)?void 0:a.audiences)?void 0:u.edges))return this.logger.log(I.ERROR,"".concat(tk," (decode error)")),[2,null];return[2,h.filter(function(e){return"qualified"==e.node.state}).map(function(e){return e.node.name})]}})})},e.prototype.querySegments=function(e,t,r,i,n){return P(this,void 0,void 0,function(){var r,i,o,s;return F(this,function(a){switch(a.label){case 0:r="POST",i=t,o={"Content-Type":"application/json","x-api-key":e},a.label=1;case 1:return a.trys.push([1,3,,4]),[4,this.requestHandler.makeRequest(i,o,r,n).responsePromise];case 2:return s=a.sent(),[3,4];case 3:return a.sent(),[2,null];case 4:return[2,s.body]}})})},e.prototype.parseSegmentsResponseJson=function(e){var t={};try{t=JSON.parse(e)}catch(e){return null}return!function(e,t,r){void 0===t&&(t=tP),void 0===r&&(r=!0);var i="".concat("JSON_SCHEMA_VALIDATOR"," (").concat(t.title,")");if("object"!=typeof e||null===e)throw Error(q(ed.NO_JSON_PROVIDED,i));var n=(0,D.validate)(e,t);if(n.valid)return!0;if(!r)return!1;if(Array.isArray(n.errors))throw Error(q(ed.INVALID_DATAFILE,i,n.errors[0].property,n.errors[0].message));throw Error(q(ed.INVALID_JSON,i))}(t,tF,!1)?null:t},e}(),tw=function(e){function t(t){return e.call(this,t)||this}return b(t,e),t.createInstance=function(e){var r,i,n,o=e.logger,s=e.odpOptions,a=e.odpIntegrationConfig,u=e.clientEngine,l=e.clientVersion;o=o||er(),u=u||eg,l=l||eh;var c=void 0;return(null==a?void 0:a.integrated)&&(c=a.odpConfig),r=(null==s?void 0:s.segmentsRequestHandler)?s.segmentsRequestHandler:new tI(o,(null==s?void 0:s.segmentsApiTimeout)||1e4),i=(null==s?void 0:s.segmentManager)?s.segmentManager:new tV((null==s?void 0:s.segmentsCache)||new tN({maxSize:null==s?void 0:s.segmentsCacheSize,timeout:null==s?void 0:s.segmentsCacheTimeout}),new tx(r,o),o,c),n=(null==s?void 0:s.eventRequestHandler)?s.eventRequestHandler:new tI(o,(null==s?void 0:s.eventApiTimeout)||1e4),new t({odpIntegrationConfig:a,segmentManager:i,eventManager:(null==s?void 0:s.eventManager)?s.eventManager:new tb({odpConfig:c,apiManager:new tC(n,o),logger:o,clientEngine:u,clientVersion:l,flushInterval:null==s?void 0:s.eventFlushInterval,batchSize:null==s?void 0:s.eventBatchSize,queueSize:null==s?void 0:s.eventQueueSize,userAgentParser:null==s?void 0:s.userAgentParser}),logger:o})},t.prototype.initializeVuid=function(){return P(this,void 0,void 0,function(){var e;return F(this,function(r){switch(r.label){case 0:return[4,tT.instance(t.cache)];case 1:return e=r.sent(),this.vuid=e.vuid,[2]}})})},t.prototype.identifyUser=function(t,r){t&&tT.isVuid(t)?e.prototype.identifyUser.call(this,void 0,t):t&&r&&tT.isVuid(r)?e.prototype.identifyUser.call(this,t,r):e.prototype.identifyUser.call(this,t,r||this.vuid)},t.prototype.sendEvent=function(t){var r=t.type,i=t.action,n=t.identifiers,o=t.data,s=new Map(n);
1if(!n.has(y.VUID))if(this.vuid)s.set(y.VUID,this.vuid);else throw Error(ed.ODP_SEND_EVENT_FAILED_VUID_MISSING);e.prototype.sendEvent.call(this,{type:r,action:i,identifiers:s,data:o})},t.prototype.isVuidEnabled=function(){return!0},t.prototype.getVuid=function(){return this.vuid},t.cache=new ty,t}(tS);function tG(e,t,r){return{variationKey:null,enabled:!1,variables:{},ruleKey:null,flagKey:e,userContext:t,reasons:r}}var tB=function(){function e(e){var t,r=e.optimizely,i=e.userId,n=e.attributes,o=e.shouldIdentifyUser,s=this;this._qualifiedSegments=null,this.optimizely=r,this.userId=i,this.attributes=null!=(t=V({},n))?t:{},this.forcedDecisionsMap={},(void 0===o||o)&&r.readyPromise.then(function(e){e.success&&r.isOdpIntegrated()&&s.identifyUser()})}return e.prototype.identifyUser=function(){this.optimizely.identifyUser(this.userId)},e.prototype.setAttribute=function(e,t){this.attributes[e]=t},e.prototype.getUserId=function(){return this.userId},e.prototype.getAttributes=function(){return V({},this.attributes)},e.prototype.getOptimizely=function(){return this.optimizely},Object.defineProperty(e.prototype,"qualifiedSegments",{get:function(){return this._qualifiedSegments},set:function(e){this._qualifiedSegments=e},enumerable:!1,configurable:!0}),e.prototype.decide=function(e,t){return void 0===t&&(t=[]),this.optimizely.decide(this.cloneUserContext(),e,t)},e.prototype.decideForKeys=function(e,t){return void 0===t&&(t=[]),this.optimizely.decideForKeys(this.cloneUserContext(),e,t)},e.prototype.decideAll=function(e){return void 0===e&&(e=[]),this.optimizely.decideAll(this.cloneUserContext(),e)},e.prototype.trackEvent=function(e,t){this.optimizely.track(e,this.userId,this.attributes,t)},e.prototype.setForcedDecision=function(e,t){var r,i=e.flagKey,n=null!=(r=e.ruleKey)?r:ef.FORCED_DECISION_NULL_RULE_KEY,o=t.variationKey;return this.forcedDecisionsMap[i]||(this.forcedDecisionsMap[i]={}),this.forcedDecisionsMap[i][n]={variationKey:o},!0},e.prototype.getForcedDecision=function(e){return this.findForcedDecision(e)},e.prototype.removeForcedDecision=function(e){var t,r=null!=(t=e.ruleKey)?t:ef.FORCED_DECISION_NULL_RULE_KEY,i=e.flagKey,n=!1;return this.forcedDecisionsMap.hasOwnProperty(i)&&(this.forcedDecisionsMap[i].hasOwnProperty(r)&&(delete this.forcedDecisionsMap[i][r],n=!0),0===Object.keys(this.forcedDecisionsMap[i]).length&&delete this.forcedDecisionsMap[i]),n},e.prototype.removeAllForcedDecisions=function(){return this.forcedDecisionsMap={},!0},e.prototype.findForcedDecision=function(e){var t,r=null!=(t=e.ruleKey)?t:ef.FORCED_DECISION_NULL_RULE_KEY,i=e.flagKey;if(this.forcedDecisionsMap.hasOwnProperty(e.flagKey)){var n=this.forcedDecisionsMap[i];if(n.hasOwnProperty(r))return{variationKey:n[r].variationKey}}return null},e.prototype.cloneUserContext=function(){var t=new e({shouldIdentifyUser:!1,optimizely:this.getOptimizely(),userId:this.getUserId(),attributes:this.getAttributes()});return Object.keys(this.forcedDecisionsMap).length>0&&(t.forcedDecisionsMap=V({},this.forcedDecisionsMap)),t._qualifiedSegments=this._qualifiedSegments,t},e.prototype.fetchQualifiedSegments=function(e){return P(this,void 0,void 0,function(){var t;return F(this,function(r){switch(r.label){case 0:return[4,this.optimizely.fetchQualifiedSegments(this.userId,e)];case 1:return t=r.sent(),this.qualifiedSegments=t,[2,null!==t]}})})},e.prototype.isQualifiedFor=function(e){return!!this._qualifiedSegments&&this._qualifiedSegments.indexOf(e)>-1},e}(),tK=["and","or","not"];function tj(e,t){if(Array.isArray(e)){var r=e[0],i=e.slice(1);switch("string"==typeof r&&-1===tK.indexOf(r)&&(r="or",i=e),r){case"and":var n=i,o=t,s=!1;if(Array.isArray(n)){for(var a=0;a<n.length;a++){var u=tj(n[a],o);if(!1===u)return!1;null===u&&(s=!0)}return!s||null}return null;case"not":var l=i,c=t;if(Array.isArray(l)&&l.length>0){var d=tj(l[0],c);return null===d?null:!d}return null;default:var p=i,f=t,g=!1;if(Array.isArray(p)){for(var E=0;E<p.length;E++){var h=tj(p[E],f);if(!0===h)return!0;null===h&&(g=!0)}return!!g&&null}return null}}return t(e)}var tq=function(){function e(t,r,i){this.sdkKey=null!=(n=t.sdkKey)?n:"",this.environmentKey=null!=(o=t.environmentKey)?o:"",this.attributes=t.attributes,this.audiences=e.getAudiences(t),this.events=t.events,this.revision=t.revision;var n,o,s=(t.featureFlags||[]).reduce(function(e,t){return e[t.id]=t.variables,e},{}),a=e.getVariableIdMap(t),u=e.getExperimentsMap(t,s,a,i),l=u.experimentsMapById,c=u.experimentsMapByKey;this.experimentsMap=c,this.featuresMap=e.getFeaturesMap(t,s,l,a),this.datafile=r}return e.prototype.getDatafile=function(){return this.datafile},e.getAudiences=function(e){var t=[],r=[];
1return(e.typedAudiences||[]).forEach(function(e){t.push({id:e.id,conditions:JSON.stringify(e.conditions),name:e.name}),r.push(e.id)}),(e.audiences||[]).forEach(function(e){-1===r.indexOf(e.id)&&"$opt_dummy_audience"!=e.id&&t.push({id:e.id,conditions:JSON.stringify(e.conditions),name:e.name})}),t},e.getSerializedAudiences=function(t,r){var i="";if(t){var n="";t.forEach(function(t){var o="";if(t instanceof Array)o=e.getSerializedAudiences(t,r),o="(".concat(o,")");else if(tK.indexOf(t)>-1)n=t.toUpperCase();else{var s=r[t]?r[t].name:t;i||"NOT"===n?(n=""===n?"OR":n,i=""===i?"".concat(n,' "').concat(r[t].name,'"'):i.concat(" ".concat(n,' "').concat(s,'"'))):i='"'.concat(s,'"')}""!==o&&(""!==i||"NOT"===n?(n=""===n?"OR":n,i=""===i?"".concat(n," ").concat(o):i.concat(" ".concat(n," ").concat(o))):i=i.concat(o))})}return i},e.getExperimentAudiences=function(t,r){return t.audienceConditions?e.getSerializedAudiences(t.audienceConditions,r.audiencesById):""},e.mergeFeatureVariables=function(e,t,r,i,n){var o=(e[r]||[]).reduce(function(e,t){return e[t.key]={id:t.id,key:t.key,type:t.type,value:t.defaultValue},e},{});return(i||[]).forEach(function(e){var r=t[e.id],i={id:e.id,key:r.key,type:r.type,value:n?e.value:r.defaultValue};o[r.key]=i}),o},e.getVariationsMap=function(t,r,i,n){return t.reduce(function(t,o){var s=e.mergeFeatureVariables(r,i,n,o.variables,o.featureEnabled);return t[o.key]={id:o.id,key:o.key,featureEnabled:o.featureEnabled,variablesMap:s},t},{})},e.getVariableIdMap=function(e){return(e.featureFlags||[]).reduce(function(e,t){return t.variables.forEac
1h(function(t){e[t.id]=t}),e},{})},e.getDeliveryRules=function(t,r,i,n,o){return n.map(function(n){return{id:n.id,key:n.key,audiences:e.getExperimentAudiences(n,t),variationsMap:e.getVariationsMap(n.variations,r,o,i)}})},e.getRolloutExperimentIds=function(e){var t=[];return(e||[]).forEach(function(e){e.experiments.forEach(function(e){t.push(e.id)})}),t},e.getExperimentsMap=function(t,r,i,n){var o=this.getRolloutExperimentIds(t.rollouts),s={},a={};return(t.experiments||[]).forEach(function(u){if(-1===o.indexOf(u.id)){var l=t.experimentFeatureMap[u.id],c="";l&&l.length>0&&(c=l[0]);var d=e.getVariationsMap(u.variations,r,i,c.toString()),p={id:u.id,key:u.key,audiences:e.getExperimentAudiences(u,t),variationsMap:d};s[u.id]=p,a[u.key]&&n&&n.warn("Duplicate experiment keys found in datafile: ".concat(u.key)),a[u.key]=p}}),{experimentsMapById:s,experimentsMapByKey:a}},e.getExperimentsKeyMap=function(e){var t={};for(var r in e){var i=e[r];t[i.key]=i}return t},e.getFeaturesMap=function(t,r,i,n){var o={};return t.featureFlags.forEac
1h(function(s){var a={},u=[];s.experimentIds.forEach(function(e){var t=i[e];t&&(a[t.key]=t),u.push(i[e])});var l=(s.variables||[]).reduce(function(e,t){return e[t.key]={id:t.id,key:t.key,type:t.type,value:t.defaultValue},e},{}),c=[],d=t.rolloutIdMap[s.rolloutId];d&&(c=e.getDeliveryRules(t,r,s.id,d.experiments,n)),o[s.key]={id:s.id,key:s.key,experimentRules:u,deliveryRules:c,experimentsMap:a,variablesMap:l}}),o},e}(),tH=er();function tz(e,t){return e instanceof Error?e.message:t||"Unknown error"}var tX=function(){function e(e){this.updateListeners=[],this.configObj=null,this.optimizelyConfigObj=null,this.datafileManager=null;try{if(this.jsonSchemaValidator=e.jsonSchemaValidator,!e.datafile&&!e.sdkKey){var t=Error(q(ed.DATAFILE_AND_SDK_KEY_MISSING,"PROJECT_CONFIG_MANAGER"));this.readyPromise=Promise.resolve({success:!1,reason:tz(t)}),tH.error(t);return}var r=null;e.datafile&&(r=this.handleNewDatafile(e.datafile)),e.sdkKey&&e.datafileManager?(this.datafileManager=e.datafileManager,this.datafileManager.start(),this.readyPromise=this.datafileManager.onReady().then(this.onDatafileManagerReadyFulfill.bind(this),this.onDatafileManagerReadyReject.bind(this)),this.datafileManager.on("update",this.onDatafileManagerUpdate.bind(this))):this.configObj?this.readyPromise=Promise.resolve({success:!0}):this.readyPromise=Promise.resolve({success:!1,reason:tz(r,"Invalid datafile")})}catch(e){tH.error(e),this.readyPromise=Promise.resolve({success:!1,reason:tz(e,"Error in initialize")})}}return e.prototype.onDatafileManagerReadyFulfill=function(){if(this.datafileManager){var e=this.handleNewDatafile(this.datafileManager.get());return e?{success:!1,reason:tz(e)}:{success:!0}}return{success:!1,reason:tz(null,"Datafile manager is not provided")}},e.prototype.onDatafileManagerReadyReject=function(e){return{success:!1,reason:tz(e,"Failed to become ready")}},e.prototype.onDatafileManagerUpdate=function(){this.datafileManager&&this.handleNewDatafile(this.datafileManager.get())},e.prototype.handleNewDatafile=function(e){var t=this,r=th({datafile:e,jsonSchemaValidator:this.jsonSchemaValidator,logger:tH}),i=r.configObj,n=r.error;if(n)tH.error(n);else{var o=this.configObj?this.configObj.revision:"null";i&&o!==i.revision&&(this.configObj=i,this.optimizelyConfigObj=null,tL(function(){t.updateListeners.forEach(function(e){return e(i)})}))}return n},e.prototype.getConfig=function(){return this.configObj},e.prototype.getOptimizelyConfig=function(){var e;return!this.optimizelyConfigObj&&this.configObj&&(this.optimizelyConfigObj=(e=this.configObj,new tq(e,tE(this.configObj),tH))),this.optimizelyConfigObj},e.prototype.onReady=function(){return this.readyPromise},e.prototype.onUpdate=function(e){var t=this;return this.updateListeners.push(e),function(){var r=t.updateListeners.indexOf(e);r>-1&&t.updateListeners.splice(r,1)}},e.prototype.stop=function(){this.datafileManager&&this.datafileManager.stop(),this.updateListeners=[]},e}(),tY="BUCKETER",tJ=function(e){var t=[],r=e.experimentIdMap[e.experimentId].groupId;if(r){var i=e.groupIdMap[r];if(!i)throw Error(q(ed.INVALID_GROUP_ID,tY,r));if("random"===i.policy){var n=tW(i,e.bucketingId,e.userId,e.logger);if(null===n)return e.logger.log(ec.INFO,ep.USER_NOT_IN_ANY_EXPERIMENT,tY,e.userId,r),t.push([ep.USER_NOT_IN_ANY_EXPERIMENT,tY,e.userId,r]),{result:null,reasons:t};if(n!==e.experimentId)return e.logger.log(ec.INFO,ep.USER_NOT_BUCKETED_INTO_EXPERIMENT_IN_GROUP,tY,e.userId,e.experimentKey,r),t.push([ep.USER_NOT_BUCKETED_INTO_EXPERIMENT_IN_GROUP,tY,e.userId,e.experimentKey,r]),{result:null,reasons:t};e.logger.log(ec.INFO,ep.USER_BUCKETED_INTO_EXPERIMENT_IN_GROUP,tY,e.userId,e.experimentKey,r),t.push([ep.USER_BUCKETED_INTO_EXPERIMENT_IN_GROUP,tY,e.userId,e.experimentKey,r])}}var o=tZ("".concat(e.bucketingId).concat(e.experimentId));e.logger.log(ec.DEBUG,ep.USER_ASSIGNED_TO_EXPERIMENT_BUCKET,tY,o,e.userId),t.push([ep.USER_ASSIGNED_TO_EXPERIMENT_BUCKET,tY,o,e.userId]);var s=tQ(o,e.trafficAllocationConfig);return null===s||e.variationIdMap[s]?{result:s,reasons:t}:(s&&(e.logger.log(ec.WARNING,ep.INVALID_VARIATION_ID,tY),t.push([ep.INVALID_VARIATION_ID,tY])),{result:null,reasons:t})},tW=function(e,t,r,i){var n=tZ("".concat(t).concat(e.id));return i.log(ec.DEBUG,ep.USER_ASSIGNED_TO_EXPERIMENT_BUCKET,tY,n,r),tQ(n,e.trafficAllocation)},tQ=function(e,t){for(var r=0;r<t.length;
1r++)if(e<t[r].endOfRange)return t[r].entityId;return null},tZ=function(e){try{var t=U().v3(e,1);return Math.floor(t/0x100000000*1e4)}catch(t){throw Error(q(ed.INVALID_BUCKETING_ID,tY,e,t.message))}},t$="SEMANTIC VERSION",t0=er();function t1(e){return/^\d+$/.test(e)}function t2(e){var t=e.indexOf("-"),r=e.indexOf("+");return!(t<0)&&(r<0||t<r)}function t4(e){var t=e.indexOf("-"),r=e.indexOf("+");return!(r<0)&&(t<0||r<t)}function t3(e){var t=e,r="";if(/\s/.test(e))return t0.warn(ep.UNKNOWN_MATCH_TYPE,t$,e),null;if(t2(e)?(t=e.substring(0,e.indexOf("-")),r=e.substring(e.indexOf("-")+1)):t4(e)&&(t=e.substring(0,e.indexOf("+")),r=e.substring(e.indexOf("+")+1)),"string"!=typeof t||"string"!=typeof r)return null;var i=t.split(".").length-1;if(i>2)return t0.warn(ep.UNKNOWN_MATCH_TYPE,t$,e),null;var n=t.split(".");if(n.length!=i+1)return t0.warn(ep.UNKNOWN_MATCH_TYPE,t$,e),null;for(var o=0;o<n.length;o++)if(!t1(n[o]))return t0.warn(ep.UNKNOWN_MATCH_TYPE,t$,e),null;return r&&n.push(r),n}var t5="CUSTOM_ATTRIBUTE_CONDITION_EVALUATOR",t6=er(),t8="exact",t7="exists",t9="semver_eq",re="semver_ge",rt="semver_gt",rr="semver_le",ri="semver_lt",rn="substring",ro=[t8,t7,"gt","ge","lt","le",rn,t9,ri,rr,rt,re],rs={};function ra(e){return"string"==typeof e||"boolean"==typeof e||X(e)}function ru(e,t){var r=t.getAttributes(),i=e.value,n=typeof i,o=e.name,s=r[o],a=typeof s;return!ra(i)||X(i)&&!z(i)?(t6.warn(ep.UNEXPECTED_CONDITION_VALUE,t5,JSON.stringify(e)),null):null===s?(t6.debug(ep.UNEXPECTED_TYPE_NULL,t5,JSON.stringify(e),o),null):ra(s)&&n===a?X(s)&&!z(s)?(t6.warn(ep.OUT_OF_BOUNDS,t5,JSON.stringify(e),o),null):i===s:(t6.warn(ep.UNEXPECTED_TYPE,t5,JSON.stringify(e),a,o),null)}function rl(e,t){var r=t.getAttributes(),i=e.name,n=r[i],o=typeof n,s=e.value;return null!==s&&z(s)?null===n?(t6.debug(ep.UNEXPECTED_TYPE_NULL,t5,JSON.stringify(e),i),!1):X(n)?!!z(n)||(t6.warn(ep.OUT_OF_BOUNDS,t5,JSON.stringify(e),i),!1):(t6.warn(ep.UNEXPECTED_TYPE,t5,JSON.stringify(e),o,i),!1):(t6.warn(ep.UNEXPECTED_CONDITION_VALUE,t5,JSON.stringify(e)),!1)}function rc(e,t){var r=t.getAttributes(),i=e.name,n=r[i],o=e.value;return"string"!=typeof o?(t6.warn(ep.UNEXPECTED_CONDITION_VALUE,t5,JSON.stringify(e)),null):null===n?(t6.debug(ep.UNEXPECTED_TYPE_NULL,t5,JSON.stringify(e),i),null):"string"!=typeof n?(t6.warn(ep.UNEXPECTED_TYPE,t5,JSON.stringify(e),typeof n,i),null):function(e,t){var r=t3(t),i=t3(e);if(!r||!i)return null;for(var n=r.length,o=0;o<i.length;o++)if(n<=o)return t2(e)||t4(e)?1:-1;else if(t1(r[o])){var s=parseInt(r[o]),a=parseInt(i[o]);if(s>a)return 1;if(s<a)return -1}else if(r[o]<i[o])return t2(e)&&!t2(t)?1:-1;else if(r[o]>i[o])return!t2(e)&&t2(t)?-1:1;return t2(t)&&!t2(e)?-1:0}(o,n)}rs[t8]=ru,rs[t7]=function(e,t){return null!=t.getAttributes()[e.name]},rs.gt=function(e,t){var r=t.getAttributes()[e.name],i=e.value;return rl(e,t)&&null!==i?r>i:null},rs.ge=function(e,t){var r=t.getAttributes()[e.name],i=e.value;return rl(e,t)&&null!==i?r>=i:null},rs.lt=function(e,t){var r=t.getAttributes()[e.name],i=e.value;return rl(e,t)&&null!==i?r<i:null},rs.le=function(e,t){var r=t.getAttributes()[e.name],i=e.value;return rl(e,t)&&null!==i?r<=i:null},rs[rn]=function(e,t){var r=t.getAttributes(),i=e.name,n=r[e.name],o=typeof n,s=e.value;return"string"!=typeof s?(t6.warn(ep.UNEXPECTED_CONDITION_VALUE,t5,JSON.stringify(e)),null):null===n?(t6.debug(ep.UNEXPECTED_TYPE_NULL,t5,JSON.stringify(e),i),null):"string"!=typeof n?(t6.warn(ep.UNEXPECTED_TYPE,t5,JSON.stringify(e),o,i),null):-1!==n.indexOf(s)},rs[t9]=function(e,t){var r=rc(e,t);return null===r?null:0===r},rs[rt]=function(e,t){var r=rc(e,t);return null===r?null:r>0},rs[re]=function(e,t){var r=rc(e,t);return null===r?null:r>=0},rs[ri]=function(e,t){var r=rc(e,t);return null===r?null:r<0},rs[rr]=function(e,t){var r=rc(e,t);return null===r?null:r<=0};var rd=Object.freeze({__proto__:null,evaluate:function(e,t){var r=t.getAttributes(),i=e.match;if(void 0!==i&&-1===ro.indexOf(i))return t6.warn(ep.UNKNOWN_MATCH_TYPE,t5,JSON.stringify(e)),null;var n=e.name;return r.hasOwnProperty(n)||i==t7?(i&&rs[i]||ru)(e,t):(t6.debug(ep.MISSING_ATTRIBUTE_VALUE,t5,JSON.stringify(e),n),null)}}),rp=er(),rf="qualified",rg=[rf],rE={};function rh(e,t){return t.isQualifiedFor(e.value)}rE[rf]=rh;var r_=Object.freeze({__proto__:null,evaluate:function(e,t){var r=e.match;return void 0!==r&&-1===rg.indexOf(r)?(rp.warn(ep.UNKNOWN_MATCH_TYPE,"ODP_SEGMENT_CONDITION_EVALUATOR",JSON.stringify(e)),null):(r&&rE[r]||rh)(e,t)}}),rI=er(),rv="AUDIENCE_EVALUATOR",ry=function(){function e(e){this.typeToEvaluatorMap=x({},e,{custom_attribute:rd,third_party_dimension:r_})}return e.prototype.evaluate=function(e,t,r){var i=this;return!e||0===e.length||!!tj(e,function(e){var n=t[e];if(n){rI.log(ec.DEBUG,ep.EVALUATING_AUDIENCE,rv,e,JSON.stringify(n.conditions));var o=tj(n.conditions,i.evaluateConditionWithUserAttributes.bind(i,r)),s=null===o?"UNKNOWN":o.toString().toUpperCase();return rI.log(ec.DEBUG,ep.AUDIENCE_EVALUATION_RESULT,rv,e,s),o}return null})},e.prototype.evaluateConditionWithUserAttributes=function(e,t){var r=this.t
1ypeToEvaluatorMap[t.type];if(!r)return rI.log(ec.WARNING,ep.UNKNOWN_CONDITION_TYPE,rv,JSON.stringify(t)),null;try{return r.evaluate(t,e)}catch(e){rI.log(ec.ERROR,ed.CONDITION_EVALUATOR_ERROR,rv,t.type,e.message)}return null},e}();function rR(e){return"string"==typeof e&&""!==e}var rO="DECISION_SERVICE",rN=function(){function e(e){this.audienceEvaluator=new ry(e.UNSTABLE_conditionEvaluators),this.forcedVariationMap={},this.logger=e.logger,this.userProfileService=e.userProfileService||null}return e.prototype.getVariation=function(e,t,r,i){void 0===i&&(i={});var n=r.getUserId(),o=r.getAttributes(),s=this.getBucketingId(n,o),a=[],u=t.key;if(!this.checkIfExperimentIsActive(e,u))return this.logger.log(ec.INFO,ep.EXPERIMENT_NOT_RUNNING,rO,u),a.push([ep.EXPERIMENT_NOT_RUNNING,rO,u]),{result:null,reasons:a};var l=this.getForcedVariation(e,u,n);a.push.apply(a,l.reasons);var c=l.result;if(c)return{result:c,reasons:a};var d=this.getWhitelistedVariation(t,n);a.push.apply(a,d.reasons);var p=d.result;if(p)return{result:p.key,reasons:a};var f=i[T.IGNORE_USER_PROFILE_SERVICE],g=this.resolveExperimentBucketMap(n,o);if(!f&&(p=this.getStoredVariation(e,t,n,g)))return this.logger.log(ec.INFO,ep.RETURNING_STORED_VARIATION,rO,p.key,u,n),a.push([ep.RETURNING_STORED_VARIATION,rO,p.key,u,n]),{result:p.key,reasons:a};var E=this.checkIfUserIsInAudience(e,t,ev.EXPERIMENT,r,"");if(a.push.apply(a,E.reasons),!E.result)return this.logger.log(ec.INFO,ep.USER_NOT_IN_EXPERIMENT,rO,n,u),a.push([ep.USER_NOT_IN_EXPERIMENT,rO,n,u]),{result:null,reasons:a};var h=tJ(this.buildBucketerParams(e,t,s,n));a.push.apply(a,h.reasons);var _=h.result;return(_&&(p=e.variationIdMap[_]),p)?(this.logger.log(ec.INFO,ep.USER_HAS_VARIATION,rO,n,p.key,u),a.push([ep.USER_HAS_VARIATION,rO,n,p.key,u]),f||this.saveUserProfile(t,p,n,g),{result:p.key,reasons:a}):(this.logger.log(ec.DEBUG,ep.USER_HAS_NO_VARIATION,rO,n,u),a.push([ep.USER_HAS_NO_VARIATION,rO,n,u]),{result:null,reasons:a})},e.prototype.resolveExperimentBucketMap=function(e,t){t=t||{};var r=this.getUserProfile(e)||{},i=t[ef.STICKY_BUCKETING_KEY];return x({},r.experiment_bucket_map,i)},e.prototype.checkIfExperimentIsActive=function(e,t){return ti(e,t)===e3},e.prototype.getWhitelistedVariation=function(e,t){var r=[];if(e.forcedVariations&&e.forcedVariations.hasOwnProperty(t)){var i=e.forcedVariations[t];if(e.variationKeyMap.hasOwnProperty(i))return this.logger.log(ec.INFO,ep.USER_FORCED_IN_VARIATION,rO,t,i),r.push([ep.USER_FORCED_IN_VARIATION,rO,t,i]),{result:e.variationKeyMap[i],reasons:r};this.logger.log(ec.ERROR,ep.FORCED_BUCKETING_FAILED,rO,i,t),r.push([ep.FORCED_BUCKETING_FAILED,rO,i,t])}return{result:null,reasons:r}},e.prototype.checkIfUserIsInAudience=function(e,t,r,i,n){var o=[],s=tn(e,t.id),a=e.audiencesById;this.logger.log(ec.DEBUG,ep.EVALUATING_AUDIENCES_COMBINED,rO,r,n||t.key,JSON.stringify(s)),o.push([ep.EVALUATING_AUDIENCES_COMBINED,rO,r,n||t.key,JSON.stringify(s)]);var u=this.audienceEvaluator.evaluate(s,a,i);return this.logger.log(ec.INFO,ep.AUDIENCE_EVALUATION_RESULT_COMBINED,rO,r,n||t.key,u.toString().toUpperCase()),o.push([ep.AUDIENCE_EVALUATION_RESULT_COMBINED,rO,r,n||t.key,u.toString().toUpperCase()]),{result:u,reasons:o}},e.prototype.buildBucketerParams=function(e,t,r,i){return{bucketingId:r,experimentId:t.id,experimentKey:t.key,experimentIdMap:e.experimentIdMap,experimentKeyMap:e.experimentKeyMap,groupIdMap:e.groupIdMap,logger:this.logger,trafficAllocationConfig:tu(e,t.id),userId:i,variationIdMap:e.variationIdMap}},e.prototype.getStoredVariation=function(e,t,r,i){if(i.hasOwnProperty(t.id)){var n=i[t.id],o=n.variation_id;if(e.variationIdMap.hasOwnProperty(o))return e.variationIdMap[n.variation_id];this.logger.log(ec.INFO,ep.SAVED_VARIATION_NOT_FOUND,rO,r,o,t.key)}return null},e.prototype.getUserProfile=function(e){if(!this.userProfileService)return{user_id:e,experiment_bucket_map:{}};try{return this.userProfileService.lookup(e)}catch(t){this.logger.log(ec.ERROR,ed.USER_PROFILE_LOOKUP_ERROR,rO,e,t.message)}return null},e.prototype.saveUserProfile=function(e,t,r,i){if(this.userProfileService)try{i[e.id]={variation_id:t.
1id},this.userProfileService.save({user_id:r,experiment_bucket_map:i}),this.logger.log(ec.INFO,ep.SAVED_VARIATION,rO,t.key,e.key,r)}catch(e){this.logger.log(ec.ERROR,ed.USER_PROFILE_SAVE_ERROR,rO,r,e.message)}},e.prototype.getVariationForFeature=function(e,t,r,i){void 0===i&&(i={});var n=[],o=this.getVariationForFeatureExperiment(e,t,r,i);n.push.apply(n,o.reasons);var s=o.result;if(null!==s.variation)return{result:s,reasons:n};var a=this.getVariationForRollout(e,t,r);n.push.apply(n,a.reasons);var u=a.result,l=r.getUserId();return u.variation?(this.logger.log(ec.DEBUG,ep.USER_IN_ROLLOUT,rO,l,t.key),n.push([ep.USER_IN_ROLLOUT,rO,l,t.key])):(this.logger.log(ec.DEBUG,ep.USER_NOT_IN_ROLLOUT,rO,l,t.key),n.push([ep.USER_NOT_IN_ROLLOUT,rO,l,t.key])),{result:u,reasons:n}},e.prototype.getVariationForFeatureExperiment=function(e,t,r,i){void 0===i&&(i={});var n,o,s=[],a=null;if(t.experimentIds.length>0)for(o=0;o<t.experimentIds.length;o++){var u=tl(e,t.experimentIds[o],this.logger);if(u&&(n=this.getVariationFromExperimentRule(e,t.key,u,r,i),s.push.apply(s,n.reasons),a=n.result)){var l=null;return(l=u.variationKeyMap[a])||(l=tc(e,t.key,a)),{result:{experiment:u,variation:l,decisionSource:eI.FEATURE_TEST},reasons:s}}}else this.logger.log(ec.DEBUG,ep.FEATURE_HAS_NO_EXPERIMENTS,rO,t.key),s.push([ep.FEATURE_HAS_NO_EXPERIMENTS,rO,t.key]);return{result:{experiment:null,variation:null,decisionSource:eI.FEATURE_TEST},reasons:s}},e.prototype.getVariationForRollout=function(e,t,r){var i,n,o,s=[];if(!t.rolloutId)return this.logger.log(ec.DEBUG,ep.NO_ROLLOUT_EXISTS,rO,t.key),s.push([ep.NO_ROLLOUT_EXISTS,rO,t.key]),{result:{experiment:null,variation:null,decisionSource:eI.ROLLOUT},reasons:s};var a=e.rolloutIdMap[t.rolloutId];if(!a)return this.logger.log(ec.ERROR,ed.INVALID_ROLLOUT_ID,rO,t.rolloutId,t.key),s.push([ed.INVALID_ROLLOUT_ID,rO,t.rolloutId,t.key]),{result:{experiment:null,variation:null,decisionSource:eI.ROLLOUT},reasons:s};var u=a.experiments;if(0===u.length)return this.logger.log(ec.ERROR,ep.ROLLOUT_HAS_NO_EXPERIMENTS,rO,t.rolloutId),s.push([ep.ROLLOUT_HAS_NO_EXPERIMENTS,rO,t.rolloutId]),{result:{experiment:null,variation:null,decisionSource:eI.ROLLOUT},reasons:s};for(var l=0;l<u.length;){if(i=this.getVariationFromDeliveryRule(e,t.key,u,l,r),s.push.apply(s,i.reasons),o=i.result,n=i.skipToEveryoneElse,o)return{result:{experiment:e.experimentIdMap[u[l].id],variation:o,decisionSource:eI.ROLLOUT},reasons:s};l=n?u.length-1:l+1}return{result:{experiment:null,variation:null,decisionSource:eI.ROLLOUT},reasons:s}},e.prototype.getBucketingId=function(e,t){var r=e;return null!=t&&"object"==typeof t&&t.hasOwnProperty(ef.BUCKETING_ID)&&("string"==typeof t[ef.BUCKETING_ID]?(r=String(t[ef.BUCKETING_ID]),this.logger.log(ec.DEBUG,ep.VALID_BUCKETING_ID,rO,r)):this.logger.log(ec.WARNING,ep.BUCKETING_ID_NOT_STRING,rO)),r},e.prototype.findValidatedForcedDecision=function(e,t,r,i){var n,o=[],s=t.getForcedDecision({flagKey:r,ruleKey:i}),a=null,u=t.getUserId();return e&&s&&((a=tc(e,r,n=s.variationKey))?i?(this.logger.log(ec.INFO,ep.USER_HAS_FORCED_DECISION_WITH_RULE_SPECIFIED,n,r,i,u),o.push([ep.USER_HAS_FORCED_DECISION_WITH_RULE_SPECIFIED,n,r,i,u])):(this.logger.log(ec.INFO,ep.USER_HAS_FORCED_DECISION_WITH_NO_RULE_SPECIFIED,n,r,u),o.push([ep.USER_HAS_FORCED_DECISION_WITH_NO_RULE_SPECIFIED,n,r,u])):i?(this.logger.log(ec.INFO,ep.USER_HAS_FORCED_DECISION_WITH_RULE_SPECIFIED_BUT_INVALID,r,i,u),o.push([ep.USER_HAS_FORCED_DECISION_WITH_RULE_SPECIFIED_BUT_INVALID,r,i,u])):(this.logger.log(ec.INFO,ep.USER_HAS_FORCED_DECISION_WITH_NO_RULE_SPECIFIED_BUT_INVALID,r,u),o.push([ep.USER_HAS_FORCED_DECISION_WITH_NO_RULE_SPECIFIED_BUT_INVALID,r,u]))),{result:a,reasons:o}},e.prototype.removeForcedVariation=function(e,t,r){if(!e)throw Error(q(ed.INVALID_USER_ID,rO));if(this.forcedVariationMap.hasOwnProperty(e))delete this.forcedVariationMap[e][t],this.logger.log(ec.DEBUG,ep.VARIATION_REMOVED_FOR_USER,rO,r,e);else throw Error(q(ed.USER_NOT_IN_FORCED_VARIATION,rO,e))},e.prototype.setInForcedVariationMap=function(e,t,r){this.forcedVariationMap.hasOwnProperty(e)||(this.forcedVariationMap[e]={}),this.forcedVariationMap[e][t]=r,this.logger.log(ec.DEBUG,ep.USER_MAPPED_TO_FORCED_VARIATION,rO,r,t,e)},e.prototype.getForcedVariation=function(e,t,r){var i,n=[],o=this.forcedVariationMap[r];if(!o)return this.logger.log(ec.DEBUG,ep.USER_HAS_NO_FORCED_VARIATION,rO,r),{result:null,reasons:n};try{var s=ta(e,t);if(!s.hasOwnProperty("id"))return this.logger.log(ec.ERROR,ed.IMPROPERLY_FORMATTED_EXPERIMENT,rO,t),n.push([ed.IMPROPERLY_FORMATTED_EXPERIMENT,rO,t]),{result:null,reasons:n};i=s.id}catch(e){return this.logger.log(ec.ERROR,e.message),n.push(e.message),{result:null,reasons:n}}var a=o[i];if(!a)return this.logger.log(ec.DEBUG,ep.USER_HAS_NO_FORCED_VARIATION_FOR_EXPERIMENT,rO,t,r),{result:null,reasons:n};var u=to(e,a);return u?(this.logger.log(ec.DEBUG,ep.USER_HAS_FORCED_VARIATION,rO,u,t,r),n.push([ep.USER_HAS_FORCED_VARIATION,rO,u,t,r])):this.logger.log(ec.DEBUG,ep.USER_HAS_NO_FORCED_VARIATION_FOR_EXPERIMENT,rO,t,r),{result:u,reasons:n}},e.prototype.setForcedVariation=function(e,t,r,i){if(null!=i&&!rR(i))return this.logger.log(ec.ERROR,ed.INVALID_VARIATION_KEY,rO),!1;try{var n,o=ta(e,t);if(!o.hasOwnProperty("id"))return this.logger.log(ec.ERROR,ed.IMPROPERLY_FORMATTED_EXPERIMENT,rO,t),!1;n=o.id}catch(e){return this.logger.log(ec.ERROR,e.message),!1}if(null==i)try{return this.removeForcedVariation(r,n,t),!0}catch(e){return this.logger.log(ec.ERROR,e.message),!1}var s=ts(e,t,i);if(!s)return this.logger.log(ec.ERROR,ed.NO_VARIATION_FOR_EXPERIMENT_KEY,rO,i,t),!1;try{return this.setInForcedVariationMap(r,n,s),!0}catch(e){return this.logger.log(ec.ERROR,e.message),!1}},e.prototype.getVariationFromExperimentRule=function(e,t,r,i,n){void 0===n&&(n={});var o=[],s=this.findValidatedForcedDecision(e,i,t,r.key);o.push.apply(o,s.reasons);var a=s.result;if(a)return{result:a.key,reasons:o};var u=this.getVariation(e,r,i,n);return o.push.apply(o,u.reasons),{result:u.result,reasons:o}},e.prototype.getVariationFromDeliveryRule=function(e,t,r,i,n){var o,s,a=[],u=!1,l=r[i],c=this.findValidatedForcedDecision(e,n,t,l.key);a.push.apply(a,c.reasons);var d=c.result;if(d)return{result:d,reasons:a,skipToEveryoneElse:u};var p=n.getUserId(),f=n.getAttributes(),g=this.getBucketingId(p,f),E=i===r.length-1,h=E?"Everyone Else":i+1,_=null,I=this.checkIfUserIsInAudience(e,l,ev.RULE,n,h);return(a.push.apply(a,I.reasons),I.result)?(this.logger.log(ec.DEBUG,ep.USER_MEETS_CONDITIONS_FOR_TARGETING_RULE,rO,p,h),a.push([ep.USER_MEETS_CONDITIONS_FOR_TARGETING_RULE,rO,p,h]),s=tJ(this.buildBucketerParams(e,l,g,p)),a.push.apply(a,s.reasons),(o=s.result)&&(_=e.variationIdMap.hasOwnProperty(o)?e.variationIdMap[o]:null),_?(this.logger.log(ec.DEBUG,ep.USER_BUCKET
1ED_INTO_TARGETING_RULE,rO,p,h),a.push([ep.USER_BUCKETED_INTO_TARGETING_RULE,rO,p,h])):E||(this.logger.log(ec.DEBUG,ep.USER_NOT_BUCKETED_INTO_TARGETING_RULE,rO,p,h),a.push([ep.USER_NOT_BUCKETED_INTO_TARGETING_RULE,rO,p,h]),u=!0)):(this.logger.log(ec.DEBUG,ep.USER_DOESNT_MEET_CONDITIONS_FOR_TARGETING_RULE,rO,p,h),a.push([ep.USER_DOESNT_MEET_CONDITIONS_FOR_TARGETING_RULE,rO,p,h])),{result:_,reasons:a,skipToEveryoneElse:u}},e}(),rT="EVENT_TAG_UTILS";function rm(e,t){var r=e.revenue;if(null==r)return null;var i="string"==typeof r?parseInt(r):Math.trunc(r);return isFinite(i)?(t.log(ec.INFO,ep.PARSED_REVENUE_VALUE,rT,i),i):(t.log(ec.INFO,ep.FAILED_TO_PARSE_REVENUE,rT,r),null)}function rA(e,t){var r=e.value;if(null==r)return null;var i="string"==typeof r?parseFloat(r):r;return isFinite(i)?(t.log(ec.INFO,ep.PARSED_NUMERIC_VALUE,rT,i),i):(t.log(ec.INFO,ep.FAILED_TO_PARSE_VALUE,rT,r),null)}var rD="ATTRIBUTES_VALIDATOR";function rS(e,t){return"string"==typeof e&&("string"==typeof t||"boolean"==typeof t||X(t)&&z(t))}var rU="custom",rC="https://logx.optimizely.com/v1/events",rL="POST";function rb(e){var t=e.attributes,r=e.userId,i=e.clientEngine,n=e.clientVersion,o=e.configObj,s=e.logger,a=!!o.anonymizeIP&&o.anonymizeIP,u=o.botFiltering,l={account_id:o.accountId,project_id:o.projectId,visitors:[{snapshots:[],visitor_id:r,attributes:[]}],revision:o.revision,client_name:i,client_version:n,anonymize_ip:a,enrich_decisions:!0};return t&&Object.keys(t||{}).forEach(function(e){var r=t[e];if(rS(e,r)){var i=tt(o,e,s);i&&l.visitors[0].attributes.push({entity_id:i,key:e,type:rU,value:r})}}),"boolean"==typeof u&&l.visitors[0].attributes.push({entity_id:ef.BOT_FILTERING,key:ef.BOT_FILTERING,type:rU,value:u}),l}function rV(e){var t,r;return null!=(r=null==(t=e.experiment)?void 0:t.key)?r:""}function rP(e){var t,r;return null!=(r=null==(t=e.variation)?void 0:t.key)?r:""}function rF(e){var t,r;return null!=(r=null==(t=e.variation)?void 0:t.featureEnabled)&&r}function rM(e){var t,r;return null!=(r=null==(t=e.experiment)?void 0:t.id)?r:null}function rk(e){var t,r;return null!=(r=null==(t=e.variation)?void 0:t.id)?r:null}var rx=er("EVENT_BUILDER"),rw=function(e){var t=e.configObj,r=e.decisionObj,i=e.userId,n=e.flagKey,o=e.enabled,s=e.userAttributes,a=e.clientEngine,u=e.clientVersion,l=r.decisionSource,c=rV(r),d=rM(r),p=rP(r),f=rk(r),g=null!==d?te(t,d):null;return{type:"impression",timestamp:H(),uuid:G(),user:{id:i,attributes:rB(t,s)},context:{accountId:t.accountId,projectId:t.projectId,revision:t.revision,clientName:a,clientVersion:u,anonymizeIP:t.anonymizeIP||!1,botFiltering:t.botFiltering},layer:{id:g},experiment:{id:d,key:c},variation:{id:f,key:p},ruleKey:c,flagKey:n,ruleType:l,enabled:o}},rG=function(e){var t=e.configObj,r=e.userId,i=e.userAttributes,n=e.clientEngine,o=e.clientVersion,s=e.eventKey,a=e.eventTags,u=tr(t,s),l=a?rm(a,rx):null,c=a?rA(a,rx):null;return{type:"conversion",timestamp:H(),uuid:G(),user:{id:r,attributes:rB(t,i)},context:{accountId:t.accountId,projectId:t.projectId,revision:t.revision,clientName:n,clientVersion:o,anonymizeIP:t.anonymizeIP||!1,botFiltering:t.botFiltering},event:{id:u,key:s},revenue:l,value:c,tags:a}};function rB(e,t){var r=[];return t&&Object.keys(t||{}).forEach(function(i){var n=t[i];if(rS(i,n)){var o=tt(e,i,rx);o&&r.push({entityId:o,key:i,value:n})}}),r}var rK="USER_PROFILE_SERVICE_VALIDATOR",rj="OPTIMIZELY",rq=function(){function e(e){var t,r=this,i=e.clientEngine;i||(e.logger.log(ec.INFO,ep.INVALID_CLIENT_ENGINE,rj,i),i=eE),this.clientEngine=i,this.clientVersion=e.clientVersion||eh,this.errorHandler=e.errorHandler,this.isOptimizelyConfigValid=e.isValidInstance,this.logger=e.logger,this.odp
1Manager=e.odpManager;var n=null!=(t=e.defaultDecideOptions)?t:[];Array.isArray(n)||(this.logger.log(ec.DEBUG,ep.INVALID_DEFAULT_DECIDE_OPTIONS,rj),n=[]);var o={};n.forEach(function(e){T[e]?o[e]=!0:r.logger.log(ec.WARNING,ep.UNRECOGNIZED_DECIDE_OPTION,rj,e)}),this.defaultDecideOptions=o,this.projectConfigManager=new tX({datafile:e.datafile,jsonSchemaValidator:e.jsonSchemaValidator,sdkKey:e.sdkKey,datafileManager:e.datafileManager}),this.disposeOnUpdate=this.projectConfigManager.onUpdate(function(e){r.logger.log(ec.INFO,ep.UPDATED_OPTIMIZELY_CONFIG,rj,e.revision,e.projectId),r.notificationCenter.sendNotifications(v.OPTIMIZELY_CONFIG_UPDATE),r.updateOdpSettings()});var s=this.projectConfigManager.onReady(),a=null;if(e.userProfileService)try{(function(e){if("object"==typeof e&&null!==e){if("function"!=typeof e.lookup)throw Error(q(ed.INVALID_USER_PROFILE_SERVICE,rK,"Missing function 'lookup'"));if("function"!=typeof e.save)throw Error(q(ed.INVALID_USER_PROFILE_SERVICE,rK,"Missing function 'save'"));return!0}throw Error(q(ed.INVALID_USER_PROFILE_SERVICE,rK))})(e.userProfileService)&&(a=e.userProfileService,this.logger.log(ec.INFO,ep.VALID_USER_PROFILE_SERVICE,rj))}catch(e){this.logger.log(ec.WARNING,e.message)}this.decisionService=new rN({userProfileService:a,logger:this.logger,UNSTABLE_conditionEvaluators:e.UNSTABLE_conditionEvaluators}),this.notificationCenter=e.notificationCenter,this.eventProcessor=e.eventProcessor;var u=this.eventProcessor.start();this.readyPromise=Promise.all([s,u,e.odpManager?e.odpManager.onReady():Promise.resolve()]).then(function(e){return e[0]}),this.readyTimeouts={},this.nextReadyTimeoutId=0}return e.prototype.getProjectConfig=function(){return this.projectConfigManager.getConfig()},e.prototype.isValidInstance=function(){return this.isOptimizelyConfigValid&&!!this.projectConfigManager.getConfig()},e.prototype.activate=function(e,t,r){try{if(!this.isValidInstance())return this.logger.log(ec.ERROR,ep.INVALID_OBJECT,rj,"activate"),null;if(!this.validateInputs({experiment_key:e,user_id:t},r))return this.notActivatingExperiment(e,t);var i=this.projectConfigManager.getConfig();if(!i)return null;try{var n=this.getVariation(e,t,r);if(null===n)return this.notActivatingExperiment(e,t);if(ti(i,e)!==e3)return this.logger.log(ec.DEBUG,ep.SHOULD_NOT_DISPATCH_ACTIVATE,rj,e),n;var o=ta(i,e),s=o.variationKeyMap[n],a={experiment:o,variation:s,decisionSource:eI.EXPERIMENT};return this.sendImpressionEvent(a,"",t,!0,r),n}catch(r){return this.logger.log(ec.ERROR,r.message),this.logger.log(ec.INFO,ep.NOT_ACTIVATING_USER,rj,t,e),this.errorHandler.handleError(r),null}}catch(e){return this.logger.log(ec.ERROR,e.message),this.errorHandler.handleError(e),null}},e.prototype.sendImpressionEvent=function(e,t,r,i,n){var o=this.projectConfigManager.getConfig();if(o){var s=rw({decisionObj:e,flagKey:t,enabled:i,userId:r,userAttributes:n,clientEngine:this.clientEngine,clientVersion:this.clientVersion,configObj:o});this.eventProcessor.process(s),this.emitNotificationCenterActivate(e,t,r,i,n)}},e.prototype.emitNotificationCenterActivate=function(e,t,r,i,n){var o,s,a=this.projectConfigManager.getConfig();if(a){var u,l,c,d,p,f,g,E,h,_,I,y,R=e.decisionSource,O=rV(e),N=rM(e),T=rP(e),m=rk(e);null!==N&&""!==T&&(o=a.experimentIdMap[N]);var A=(l=rb(u={attributes:n,clientEngine:this.clientEngine,clientVersion:this.clientVersion,configObj:a,experimentId:N,ruleKey:O,flagKey:t,ruleType:R,userId:r,enabled:i,variationId:m,logger:this.logger}),c=u.configObj,d=u.experimentId,p=u.variationId,f=u.ruleKey,g=u.ruleType,E=u.flagKey,h=u.enabled,_=d?te(c,d):null,I=p?to(c,p):null,y={decisions:[{campaign_id:_,experiment_id:d,variation_id:p,metadata:{flag_key:E,rule_key:f,rule_type:g,variation_key:I=I||"",enabled:h}}],events:[{entity_id:_,timestamp:H(),key:"campaign_activated",uuid:G()}]},l.visitors[0].snapshots.push(y),{httpVerb:rL,url:rC,params:l});o&&o.variationKeyMap&&""!==T&&(s=o.variationKeyMap[T]),this.notificationCenter.sendNotifications(v.ACTIVATE,{experiment:o,userId:r,attributes:n,variation:s,logEvent:A})}},e.prototype.track=function(e,t,r,i){try{if(!this.isValidInstance())return void this.logger.log(ec.ERROR,ep.INVALID_OBJECT,rj,"track");if(!this.validateInputs({user_id:t,event_key:e},r,i))return;var n=this.projectConfigManager.getConfig();if(!n)return;if(!n.eventKeyMap.hasOwnProperty(e)){this.logger.log(ec.WARNING,ep.EVENT_KEY_NOT_FOUND,rj,e),this.logger.log(ec.WARNING,ep.NOT_TRACKING_USER,rj,t);return}i=this.filterEmptyValues(i);
1var o=rG({eventKey:e,eventTags:i,userId:t,userAttributes:r,clientEngine:this.clientEngine,clientVersion:this.clientVersion,configObj:n});this.logger.log(ec.INFO,ep.TRACK_EVENT,rj,e,t),this.eventProcessor.process(o),this.emitNotificationCenterTrack(e,t,r,i)}catch(e){this.logger.log(ec.ERROR,e.message),this.errorHandler.handleError(e),this.logger.log(ec.ERROR,ep.NOT_TRACKING_USER,rj,t)}},e.prototype.emitNotificationCenterTrack=function(e,t,r,i){try{var n,o,s,a=this.projectConfigManager.getConfig();if(!a)return;var u=(n={attributes:r,clientEngine:this.clientEngine,clientVersion:this.clientVersion,configObj:a,eventKey:e,eventTags:i,logger:this.logger,userId:t},o=rb(n),s=function(e,t,r,i){var n={events:[]},o={entity_id:tr(e,t),timestamp:H(),uuid:G(),key:t};if(i){var s=rm(i,r);null!==s&&(o.revenue=s);var a=rA(i,r);null!==a&&(o.value=a),o.tags=i}return n.events.push(o),n}(n.configObj,n.eventKey,n.logger,n.eventTags),o.visitors[0].snapshots=[s],{httpVerb:rL,url:rC,params:o});this.notificationCenter.sendNotifications(v.TRACK,{eventKey:e,userId:t,attributes:r,eventTags:i,logEvent:u})}catch(e){this.logger.log(ec.ERROR,e.message),this.errorHandler.handleError(e)}},e.prototype.getVariation=function(e,t,r){try{if(!this.isValidInstance())return this.logger.log(ec.ERROR,ep.INVALID_OBJECT,rj,"getVariation"),null;try{if(!this.validateInputs({experiment_key:e,user_id:t},r))return null;var i,n=this.projectConfigManager.getConfig();if(!n)return null;var o=n.experimentKeyMap[e];if(!o||o.isRollout)return this.logger.log(ec.DEBUG,ed.INVALID_EXPERIMENT_KEY,rj,e),null;var s=this.decisionService.getVariation(n,o,this.createInternalUserContext(t,r)).result,a=(i=o.id,n.experimentFeatureMap.hasOwnProperty(i))?e_.FEATURE_TEST:e_.AB_TEST;return this.notificationCenter.sendNotifications(v.DECISION,{type:a,userId:t,attributes:r||{},decisionInfo:{experimentKey:e,variationKey:s}}),s}catch(e){return this.logger.log(ec.ERROR,e.message),this.errorHandler.handleError(e),null}}catch(e){return this.logger.log(ec.ERROR,e.message),this.errorHandler.handleError(e),null}},e.prototype.setForcedVariation=function(e,t,r){if(!this.validateInputs({experiment_key:e,user_id:t}))return!1;var i=this.projectConfigManager.getConfig();if(!i)return!1;try{return this.decisionService.setForcedVariation(i,e,t,r)}catch(e){return this.logger.log(ec.ERROR,e.message),this.errorHandler.handleError(e),!1}},e.prototype.getForcedVariation=function(e,t){if(!this.validateInputs({experiment_key:e,user_id:t}))return null;var r=this.projectConfigManager.getConfig();if(!r)return null;try{return this.decisionService.getForcedVariation(r,e,t).result}catch(e){return this.logger.log(ec.ERROR,e.message),this.errorHandler.handleError(e),null}},e.prototype.validateInputs=function(e,t,r){try{if(e.hasOwnProperty("user_id")){var i=e.user_id;if("string"!=typeof i||null===i||"undefined"===i)throw Error(q(ed.INVALID_INPUT_FORMAT,rj,"user_id"));delete e.user_id}return Object.keys(e).forEach(function(t){if(!rR(e[t]))throw Error(q(ed.INVALID_INPUT_FORMAT,rj,t))}),t&&function(e){if("object"==typeof e&&!Array.isArray(e)&&null!==e)return Object.keys(e).forEach(function(t){if(void 0===e[t])throw Error(q(ed.UNDEFINED_ATTRIBUTE,rD,t))});throw Error(q(ed.INVALID_ATTRIBUTES,rD))}(t),r&&function(e){if("object"!=typeof e||Array.isArray(e)||null===e)throw Error(q(ed.INVALID_EVENT_TAGS,"EVENT_TAGS_VALIDATOR"))}(r),!0}catch(e){return this.logger.log(ec.ERROR,e.message),this.errorHandler.handleError(e),!1}},e.prototype.notActivatingExperiment=function(e,t){return this.logger.log(ec.INFO,ep.NOT_ACTIVATING_USER,rj,t,e),null},e.prototype.filterEmptyValues=function(e){for(var t in e)e.hasOwnProperty(t)&&(null===e[t]||void 0===e[t])&&delete e[t];return e},e.prototype.isFeatureEnabled=function(e,t,r){try{if(!this.isValidInstance())return this.logger.log(ec.ERROR,ep.INVALID_OBJECT,rj,"isFeatureEnabled"),!1;if(!this.validateInputs({feature_key:e,user_id:t},r))return!1;var i=this.projectConfigManager.getConfig();if(!i)return!1;var n=td(i,e,this.logger);if(!n)return!1;var o={},s=this.createInternalUserContext(t,r),a=this.decisionService.getVariationForFeature
1(i,n,s).result,u=a.decisionSource,l=rV(a),c=rP(a),d=rF(a);u===eI.FEATURE_TEST&&(o={experimentKey:l,variationKey:c}),(u===eI.FEATURE_TEST||u===eI.ROLLOUT&&t_(i))&&this.sendImpressionEvent(a,n.key,t,d,r),!0===d?this.logger.log(ec.INFO,ep.FEATURE_ENABLED_FOR_USER,rj,e,t):(this.logger.log(ec.INFO,ep.FEATURE_NOT_ENABLED_FOR_USER,rj,e,t),d=!1);var p={featureKey:e,featureEnabled:d,source:a.decisionSource,sourceInfo:o};return this.notificationCenter.sendNotifications(v.DECISION,{type:e_.FEATURE,userId:t,attributes:r||{},decisionInfo:p}),d}catch(e){return this.logger.log(ec.ERROR,e.message),this.errorHandler.handleError(e),!1}},e.prototype.getEnabledFeatures=function(e,t){var r=this;try{var i=[];if(!this.isValidInstance())return this.logger.log(ec.ERROR,ep.INVALID_OBJECT,rj,"getEnabledFeatures"),i;if(!this.validateInputs({user_id:e}))return i;var n=this.projectConfigManager.getConfig();if(!n)return i;return K(n.featureKeyMap).forEach(function(n){r.isFeatureEnabled(n.key,e,t)&&i.push(n.key)}),i}catch(e){return this.logger.log(ec.ERROR,e.message),this.errorHandler.handleError(e),[]}},e.prototype.getFeatureVariable=function(e,t,r,i){try{if(!this.isValidInstance())return this.logger.log(ec.ERROR,ep.INVALID_OBJECT,rj,"getFeatureVariable"),null;return this.getFeatureVariableForType(e,t,null,r,i)}catch(e){return this.logger.log(ec.ERROR,e.message),this.errorHandler.handleError(e),null}},e.prototype.getFeatureVariableForType=function(e,t,r,i,n){if(!this.validateInputs({feature_key:e,variable_key:t,user_id:i},n))return null;var o=this.projectConfigManager.getConfig();if(!o)return null;var s=td(o,e,this.logger);if(!s)return null;var a=tp(o,e,t,this.logger);if(!a)return null;if(r&&a.type!==r)return this.logger.log(ec.WARNING,ep.VARIABLE_REQUESTED_WITH_WRONG_TYPE,rj,r,a.type),null;var u=this.createInternalUserContext(i,n),l=this.decisionService.getVariationForFeature(o,s,u).result,c=rF(l),d=this.getFeatureVariableValueFromVariation(e,c,l.variation,a,i),p={};return l.decisionSource===eI.FEATURE_TEST&&null!==l.experiment&&null!==l.variation&&(p={experimentKey:l.experiment.key,variationKey:l.variation.key}),this.notificationCenter.sendNotifications(v.DECISION,{type:e_.FEATURE_VARIABLE,userId:i,attributes:n||{},decisionInfo:{featureKey:e,featureEnabled:c,source:l.decisionSource,variableKey:t,variableValue:d,variableType:a.type,sourceInfo:p}}),d},e.prototype.getFeatureVariableValueFromVariation=function(e,t,r,i,n){var o=this.projectConfigManager.getConfig();if(!o)return null;var s=i.defaultValue;if(null!==r){var a=tf(o,i,r,this.logger);null!==a?t?(s=a,this.logger.log(ec.INFO,ep.USER_RECEIVED_VARIABLE_VALUE,rj,s,i.key,e)):this.logger.log(ec.INFO,ep.FEATURE_NOT_ENABLED_RETURN_DEFAULT_VARIABLE_VALUE,rj,e,n,s):this.logger.log(ec.INFO,ep.VARIABLE_NOT_USED_RETURN_DEFAULT_VARIABLE_VALUE,rj,i.key,r.key)}else this.logger.log(ec.INFO,ep.USER_RECEIVED_DEFAULT_VARIABLE_VALUE,rj,n,i.key,e);return tg(s,i.type,this.logger)},e.prototype.getFeatureVariableBoolean=function(e,t,r,i){try{if(!this.isValidInstance())return this.logger.log(ec.ERROR,ep.INVALID_OBJECT,rj,"getFeatureVariableBoolean"),null;return this.getFeatureVariableForType(e,t,ey.BOOLEAN,r,i)}catch(e){return this.logger.log(ec.ERROR,e.message),this.errorHandler.handleError(e),null}},e.prototype.getFeatureVariableDouble=function(e,t,r,i){try{if(!this.isValidInstance())return this.logger.log(ec.ERROR,ep.INVALID_OBJECT,rj,"getFeatureVariableDouble"),null;return this.getFeatureVariableForType(e,t,ey.DOUBLE,r,i)}catch(e){return this.logger.log(ec.ERROR,e.message),this.errorHandler.handleError(e),null}},e.prototype.getFeatureVariableInteger=function(e,t,r,i){try{if(!this.isValidInstance())return this.logger.log(ec.ERROR,ep.INVALID_OBJECT,rj,"getFeatureVariableInteger"),null;return this.getFeatureVariableForType(e,t,ey.INTEGER,r,i)}catch(e){return this.logger.log(ec.ERROR,e.message),this.errorHandler.handleError(e),null}},e.prototype.getFeatureVariableString=function(e,t,r,i){try{if(!this.isValidInstance())return this.logger.log(ec.ERROR,ep.INVALID_OBJECT,rj,"getFeatureVariableString"),null;return this.getFeatureVariableForType(e,t,ey.STRING,r,i)}catch(e){return this.logger.log(ec.ERROR,e.message),this.errorHandler.handleError(e),null}},e.prototype.getFeatureVariableJSON=function(e,t,r,i){try{if(!this.isValidInstance())return this.logger.log(ec.ERROR,ep.INVALID_OBJECT,rj,"getFeatureVariableJSON"),null;return this.getFeatureVariableForType(e,t,ey.JSON,r,i)}catch(e){return this.logger.log(ec.ERROR,e.message),this.errorHandler.handleError(e),null}},e.prototype.getAllFeatureVariables=function(e,t,r){var i=this;try{if(!this.isValidInstance())return this.logger.log(ec.ERROR,ep.INVALID_OBJECT,rj,"getAllFeatureVariables"),null;if(!this.validateInputs({feature_key:e,user_id:t},r))return null;var n=this.projectConfigManager.getConfig();if(!n)return null;var o=td(n,e,this.logger);if(!o)return null;var s=this.createInternalUserContext(t,r),a=this.decisionService.getVariationForFeature
1(n,o,s).result,u=rF(a),l={};o.variables.forEach(function(r){l[r.key]=i.getFeatureVariableValueFromVariation(e,u,a.variation,r,t)});var c={};return a.decisionSource===eI.FEATURE_TEST&&null!==a.experiment&&null!==a.variation&&(c={experimentKey:a.experiment.key,variationKey:a.variation.key}),this.notificationCenter.sendNotifications(v.DECISION,{type:e_.ALL_FEATURE_VARIABLES,userId:t,attributes:r||{},decisionInfo:{featureKey:e,featureEnabled:u,source:a.decisionSource,variableValues:l,sourceInfo:c}}),l}catch(e){return this.logger.log(ec.ERROR,e.message),this.errorHandler.handleError(e),null}},e.prototype.getOptimizelyConfig=function(){try{if(!this.projectConfigManager.getConfig())return null;return this.projectConfigManager.getOptimizelyConfig()}catch(e){return this.logger.log(ec.ERROR,e.message),this.errorHandler.handleError(e),null}},e.prototype.close=function(){var e,t=this;try{this.odpManager&&this.odpManager.stop(),this.notificationCenter.clearAllNotificationListeners();var r=null==(e=this.projectConfigManager.getConfig())?void 0:e.sdkKey;r&&eZ.removeNotificationCenter(r);var i=this.eventProcessor.stop();return this.disposeOnUpdate&&(this.disposeOnUpdate(),this.disposeOnUpdate=null),this.projectConfigManager&&this.projectConfigManager.stop(),Object.keys(this.readyTimeouts).forEach(function(e){var r=t.readyTimeouts[e];clearTimeout(r.readyTimeout),r.onClose()}),this.readyTimeouts={},i.then(function(){return{success:!0}},function(e){return{success:!1,reason:String(e)}})}catch(e){return this.logger.log(ec.ERROR,e.message),this.errorHandler.handleError(e),Promise.resolve({success:!1,reason:String(e)})}},e.prototype.onReady=function(e){var t,r,i=this;"object"==typeof e&&null!==e&&void 0!==e.timeout&&(t=e.timeout),z(t)||(t=3e4);var n=new Promise(function(e){r=e}),o=this.nextReadyTimeoutId;this.nextReadyTimeoutId++;var s=setTimeout(function(){delete i.readyTimeouts[o],r({success:!1,reason:q("onReady timeout expired after %s ms",t)})},t);return this.readyTimeouts[o]={readyTimeout:s,onClose:function(){r({success:!1,reason:"Instance closed"})}},this.readyPromise.then(function(){clearTimeout(s),delete i.readyTimeouts[o],r({success:!0})}),Promise.race([this.readyPromise,n])},e.prototype.createUserContext=function(e,t){var r,i=null!=e?e:null==(r=this.odpManager)?void 0:r.getVuid();return void 0!==i&&this.validateInputs({user_id:i},t)?new tB({optimizely:this,userId:i,attributes:t,shouldIdentifyUser:!0}):null},e.prototype.createInternalUserContext=function(e,t){return new tB({optimizely:this,userId:e,attributes:t,shouldIdentifyUser:!1})},e.prototype.decide=function(e,t,r){var i,n,o,s,a,u=this;void 0===r&&(r=[]);var l=e.getUserId(),c=e.getAttributes(),d=this.projectConfigManager.getConfig(),p=[];if(!this.isValidInstance()||!d)return this.logger.log(ec.INFO,ep.INVALID_OBJECT,rj,"decide"),tG(t,e,[eO.SDK_NOT_READY]);var f=d.featureKeyMap[t];if(!f)return this.logger.log(ec.ERROR,ed.FEATURE_NOT_IN_DATAFILE,rj,t),tG(t,e,[q(eO.FLAG_KEY_INVALID,t)]);var g=this.getAllDecideOptions(r),E=this.decisionService.findValidatedForcedDecision(d,e,t);p.push.apply(p,E.reasons);var h=E.result;if(h)a={experiment:null,variation:h,decisionSource:eI.FEATURE_TEST};else{var _=this.decisionService.getVariationForFeature(d,f,e,g);p.push.apply(p,_.reasons),a=_.result}var I=a.decisionSource,y=null!=(n=null==(i=a.experiment)?void 0:i.key)?n:null,R=null!=(s=null==(o=a.variation)?void 0:o.key)?s:null,O=rF(a);!0===O?this.logger.log(ec.INFO,ep.FEATURE_ENABLED_FOR_USER,rj,t,l):this.logger.log(ec.INFO,ep.FEATURE_NOT_ENABLED_FOR_USER,rj,t,l);var N={},m=!1;
1g[T.EXCLUDE_VARIABLES]||f.variables.forEach(function(e){N[e.key]=u.getFeatureVariableValueFromVariation(t,O,a.variation,e,l)}),!g[T.DISABLE_DECISION_EVENT]&&(I===eI.FEATURE_TEST||I===eI.ROLLOUT&&t_(d))&&(this.sendImpressionEvent(a,t,l,O,c),m=!0);var A=g[T.INCLUDE_REASONS],D=[];A&&(D=p.map(function(e){return q.apply(void 0,M([e[0]],e.slice(1),!1))}));var S={flagKey:t,enabled:O,variationKey:R,ruleKey:y,variables:N,reasons:D,decisionEventDispatched:m};return this.notificationCenter.sendNotifications(v.DECISION,{type:e_.FLAG,userId:l,attributes:c,decisionInfo:S}),{variationKey:R,enabled:O,variables:N,ruleKey:y,flagKey:t,userContext:e,reasons:D}},e.prototype.getAllDecideOptions=function(e){var t=this,r=V({},this.defaultDecideOptions);return Array.isArray(e)?e.forEach(function(e){T[e]?r[e]=!0:t.logger.log(ec.WARNING,ep.UNRECOGNIZED_DECIDE_OPTION,rj,e)}):this.logger.log(ec.DEBUG,ep.INVALID_DECIDE_OPTIONS,rj),r},e.prototype.decideForKeys=function(e,t,r){var i=this;void 0===r&&(r=[]);var n={};if(!this.isValidInstance())return this.logger.log(ec.ERROR,ep.INVALID_OBJECT,rj,"decideForKeys"),n;if(0===t.length)return n;var o=this.getAllDecideOptions(r);return t.forEach(function(t){var s=i.decide(e,t,r);(!o[T.ENABLED_FLAGS_ONLY]||s.enabled)&&(n[t]=s)}),n},e.prototype.decideAll=function(e,t){void 0===t&&(t=[]);var r=this.projectConfigManager.getConfig();if(!this.isValidInstance()||!r)return this.logger.log(ec.ERROR,ep.INVALID_OBJECT,rj,"decideAll"),{};var i=Object.keys(r.featureKeyMap);return this.decideForKeys(e,i,t)}
1,e.prototype.updateOdpSettings=function(){var e=this.projectConfigManager.getConfig();e&&this.odpManager&&this.odpManager.updateSettings(e.odpIntegrationConfig)},e.prototype.sendOdpEvent=function(e,t,r,i){if(!this.odpManager)return void this.logger.error(ed.ODP_EVENT_FAILED_ODP_MANAGER_MISSING);var n=null!=t?t:eT,o=new Map(r);if(r&&r.size>0)try{r.forEach(function(e,t){(eN===t.toLowerCase()||y.FS_USER_ID===t.toLowerCase())&&(o.delete(t),o.set(y.FS_USER_ID,e))})}catch(e){this.logger.warn(ep.ODP_SEND_EVENT_IDENTIFIER_CONVERSION_FAILED)}try{var s=new tA(n,e,o,i);this.odpManager.sendEvent(s)}catch(e){this.logger.error(ed.ODP_EVENT_FAILED,e)}},e.prototype.isOdpIntegrated=function(){var e,t,r;return null!=(r=null==(t=null==(e=this.projectConfigManager.getConfig())?void 0:e.odpIntegrationConfig)?void 0:t.integrated)&&r},e.prototype.identifyUser=function(e){this.odpManager&&this.isOdpIntegrated()&&this.odpManager.identifyUser(e)},e.prototype.fetchQualifiedSegments=function(e,t){return P(this,void 0,void 0,function(){return F(this,function(r){switch(r.label){case 0:if(!this.odpManager)return[2,null];return[4,this.odpManager.fetchQualifiedSegments(e,t)];case 1:return[2,r.sent()]}})})},e.prototype.getVuid=function(){var e;if(!this.odpManager){null==(e=this.logger)||e.error("Unable to get VUID - ODP Manager is not instantiated yet.");return}
1return this.odpManager.isVuidEnabled()?this.odpManager.getVuid():void this.logger.log(ec.WARNING,"getVuid() unavailable for this platform",rj)},e}(),rH={parseUserAgentInfo:function(){var e=new C.UAParser().getResult();return{os:e.os,device:e.device}}},rz=Object.freeze({__proto__:null,get LogLevel(){return I},getLogger:er,setLogHandler:ei,LOG_LEVEL:ec,createLogger:ej}),rX=er();ei(ej()),en(I.INFO);var rY=!1,rJ=function(e){var t;try{var r,i,n,o=!1;e.errorHandler&&(k=e.errorHandler),e.logger&&(ei(e.logger),en(I.NOTSET)),void 0!==e.logLevel&&en(e.logLevel);try{ek(e),o=!0}catch(e){rX.error(e)}var s=void 0;null==e.eventDispatcher?(s=new eC({eventDispatcher:eG}),rY||(s.sendPendingEvents(),rY=!0)):s=e.eventDispatcher;var a=e.closingEventDispatcher;!e.eventDispatcher&&!a&&window.navigator&&"sendBeacon"in window.navigator&&(a=eB);var u=e.eventBatchSize,l=e.eventFlushInterval;r=e.eventBatchSize,"number"==typeof r&&z(r)&&r>=1||(rX.warn("Invalid eventBatchSize %s, defaulting to %s",e.eventBatchSize,10),u=10),i=e.eventFlushInterval,"number"==typeof i&&z(i)&&i>0||(rX.warn("Invalid eventFlushInterval %s, defaulting to %s",e.eventFlushInterval,1e3),l=1e3);var c=k,d=(n={logger:rX,errorHandler:c},new eH(n)),p={dispatcher:s,closingDispatcher:a,flushInterval:l,batchSize:u,maxQueueSize:e.eventMaxQueueSize||1e4,notificationCenter:d},f=(null==(t=e.odpOptions)?void 0:t.disabled)===!0;f&&rX.info(ep.ODP_DISABLED);var g=e.clientEngine,E=e.clientVersion,h=V(V({clientEngine:eg},e),{eventProcessor:ez(p),logger:rX,errorHandler:c,datafileManager:e.sdkKey?function(e,t,r,i){var n={sdkKey:e};if((void 0===i||"object"==typeof i&&null!==i)&&x(n,i),r){var o=th({datafile:r,jsonSchemaValidator:void 0,logger:t}),s=o.configObj,a=o.error;a&&t.error(a),s&&(n.datafile=tE(s))}return new e2(n)}(e.sdkKey,rX,e.datafile,e.datafileOptions):void 0,notificationCenter:d,isValidInstance:o,odpManager:f?void 0:tw.createInstance({logger:rX,odpOptions:e.odpOptions,clientEngine:g,clientVersion:E})}),_=new rq(h);try{if("function"==typeof window.addEventListener){var v="onpagehide"in window?"pagehide":"unload";window.addEventListener(v,function(){_.close()},!1)}}catch(e){rX.error(ep.UNABLE_TO_ATTACH_UNLOAD,"INDEX_BROWSER",e.message)}return _}catch(e){return rX.error(e),null}};V(V({},rz),{logging:eq,errorHandler:{handleError:function(){}},eventDispatcher:eG,sendBeaconEventDispatcher:eB,enums:em,setLogger:ei,setLogLevel:en,createInstance:rJ,__internalResetRetryState:function(){rY=!1},OptimizelyDecideOption:T,getUserAgentParser:function(){return rH}})}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.