!function(e){var t={};function i(n){if(t[n])return t[n].exports;var r=t[n]={i:n,l:!1,exports:{}};return e[n].call(r.exports,r,r.exports,i),r.l=!0,r.exports}i.m=e,i.c=t,i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)i.d(n,r,function(t){return e[t]}.bind(null,r));return n},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="https://www.ikea.com/mx/es/ikea-abtesting",i(i.s=14)}([function(e,t,i){"use strict";i.d(t,"b",(function(){return u})),i.d(t,"c",(function(){return l})),i.d(t,"d",(function(){return c})),i.d(t,"j",(function(){return p})),i.d(t,"m",(function(){return g})),i.d(t,"i",(function(){return h})),i.d(t,"l",(function(){return E})),i.d(t,"h",(function(){return v})),i.d(t,"k",(function(){return y})),i.d(t,"e",(function(){return m})),i.d(t,"f",(function(){return _})),i.d(t,"a",(function(){return T})),i.d(t,"g",(function(){return R}));var n=i(1),r=i(4);const o="--abtest-fragment",a=1===Object(r.c)().logLevel,s=Object(r.c)().userId,u="background: #222; color: #bada55; padding: 2px 5px;",l="background: blue; color: #FFF; font-weight: bold; padding: 2px 5px;",c="background: #FFF; color: #000; font-weight: bold; padding: 2px 5px;font-family: monospace;",d=(e="",t="",i="",n=365)=>{const r=new Date;r.setTime(r.getTime()+24*n*60*60*1e3);const o=[`${e}=${t}`,`expires=${r.toUTCString()}`];i&&o.push(`domain=${i}`),o.push("path=/"),document.cookie=o.join(";")},p=(e=!1)=>{let t=((e="")=>{try{const t=document.cookie.split("; ").find((t=>0===t.indexOf(e+"=")));if(t)return t.split("=")[1]}catch(e){}return null})(n.b);return e&&!t&&(t=`${n.c}${f()}`,d(n.b,t,n.a)),s&&(t=`${s}`,d(n.b,t,n.a)),t},f=()=>{var e=(new Date).getTime(),t="undefined"!=typeof performance&&performance.now&&1e3*performance.now()||0;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(i){var n=16*Math.random();return e>0?(n=(e+n)%16|0,e=Math.floor(e/16)):(n=(t+n)%16|0,t=Math.floor(t/16)),("x"===i?n:3&n|8).toString(16)}))},g=(e,t=(()=>{}),i=(()=>{}))=>{let n=0,r=window.setInterval((()=>{if(e())return window.clearInterval(r),void t();n++,n<100||(window.clearInterval(r),i())}),200)},h=(e="")=>{let t=localStorage.getItem(e);if("string"==typeof t&&t&&0===t.indexOf("{"))try{t=JSON.parse(t)}catch(e){}return"object"!=typeof t&&(t={}),t||(t={}),t},E=(e,t)=>{let i="{}";"object"==typeof t&&(i=JSON.stringify(t)),localStorage.setItem(e,i)},v=()=>h(o),y=e=>E(o,e),I=async(e,t=3,i=1e3)=>{try{return await e()}catch(r){if(t>0)return await(n=i,new Promise((e=>setTimeout(e,n,null)))),I(e,t-1,i);throw r}var n},m=()=>{const e="guest";return I((async()=>{const t=window.ikea&&window.ikea.authentication&&window.ikea.authentication.isLoggedIn;if(!t)throw new Error("Authentication service not ready");return t().then((({isLoggedIn:t,authToken:i})=>{if(!t)return e;const n=i.split(".")[1];return JSON.parse(atob(n))["https://accounts.ikea.com/customerType"]||e})).catch((()=>e))}),10,100).catch((()=>e))},_=()=>new Promise(((e,t)=>{let i=!1,n=!1;const r=()=>{n||(n=!0,e(i))},o=()=>g((()=>ikea&&ikea.authentication&&ikea.authentication.isLoggedIn),(()=>{ikea.authentication.isLoggedIn().then((e=>{i=!!e.isLoggedIn,a&&(console.groupCollapsed("%c[Ab-testing-fragment] [Detect login user]: ikea.authentication.isLoggedIn() result%c"+(i?"true":"false"),u,l),console.log("result",e),console.groupEnd()),r()}))}),r);g((()=>ikea&&ikea.pubsub&&ikea.pubsub.subscribe),(()=>{ikea.pubsub.subscribe("user/loggedIn",(e=>{a&&(console.groupCollapsed("%c[Ab-testing-fragment] [Detect login user]: Pubsub fired%cuser/loggedIn",u,l),console.log("event",e),console.groupEnd()),i=!0,r()})),ikea.pubsub.subscribe("user/loggedOut",(e=>{a&&(console.groupCollapsed("%c[Ab-testing-fragment] [Detect login user]: Pubsub fired%cuser/loggedOut",u,l),console.log("event",e),console.groupEnd()),i=!1,r()}));!!ikea.pubsub.events().find((e=>"initialized"===e.event&&"authentication"===e.namespace))?o():ikea.pubsub.subscribe("authentication/initialized",(e=>{a&&(console.groupCollapsed("%c[Ab-testing-fragment] [Detect login user]: Pubsub fired%cauthentication/initialized",u,l),console.log("event",e),console.groupEnd()),o()}))})),setTimeout(r,1e4)})),O={},b={},T=async(e,t)=>{if(O[e])return O[e];if(Array.isArray(b[e]))return await new Promise((t=>b[e].push(t))),O[e];let i;b[e]=[];try{const n=await fetch(e,t);i=await n.json()}catch(e){i=null}return O[e]=i,b[e].forEach((e=>e())),delete b[e],i},R={log(...e){if(!n.e)return console.log(...e)},warn(...e){if(!n.e)return console.warn(...e)},error(...e){if(!n.e)return console.error(...e)},table(...e){if(!n.e)return console.table(...e)}}},function(e,t,i){"use strict";i.d(t,"e",(function(){return n})),i.d(t,"d",(function(){return r})),i.d(t,"b",(function(){return o})),i.d(t,"f",(function(){return a})),i.d(t,"c",(function(){return s})),i.d(t,"a",(function(){return u}));const n=!0,r=new URL(document.location.href).hostname.indexOf("ikea.com")>=0,o="ikexp_id",a="_ga"===o,s=a?"GA":"",u=(()=>{const e=new URL(document.location.href);return e.origin.indexOf("ikeadt.com")>0?".ikeadt.com":e.origin.indexOf("ikea.com")>0?".ikea.com":""})()},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,r=i(13),o=i(9),a=(n=i(10))&&"object"==typeof n&&"default"in n?n.default:n,s=i(6),u=function(e,t){return(u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])})(e,t)};function l(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function i(){this.constructor=e}u(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}var c=function(){return(c=Object.assign||function(e){for(var t,i=1,n=arguments.length;i0&&r[r.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]=this.logLevel},e.prototype.getLogLevelName=function(e){switch(e){case t.LogLevel.DEBUG:return"DEBUG";case t.LogLevel.INFO:return"INFO ";case t.LogLevel.WARNING:return"WARN ";case t.LogLevel.ERROR:return"ERROR";default:return"NOTSET"}},e.prototype.consoleLog=function(e,i){switch(e){case t.LogLevel.DEBUG:console.log.apply(console,i);break;case t.LogLevel.INFO:console.info.apply(console,i);break;case t.LogLevel.WARNING:console.warn.apply(console,i);break;case t.LogLevel.ERROR:console.error.apply(console,i);break;default:console.log.apply(console,i)}},e}(),P=t.LogLevel.NOTSET,k=null,x=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 i=[],n=2;n=this.maxQueueSize&&this.flush()}else z.warn("Queue is stopped, not accepting event")},e.prototype.flush=function(){this.sink(this.buffer),this.buffer=[],this.timer.stop()},e}(),$={NOTSET:0,DEBUG:1,INFO:2,WARNING:3,ERROR:4},J={BROWSER_ODP_MANAGER_INITIALIZATION_FAILED:"%s: Error initializing Browser ODP Manager.",CONDITION_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: No 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."},W={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:"%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"'},Z={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"},Q={AB_TEST:"ab-test",FEATURE:"feature",FEATURE_TEST:"feature-test",FEATURE_VARIABLE:"feature-variable",ALL_FEATURE_VARIABLES:"all-feature-variables",FLAG:"flag"},ee={FEATURE_TEST:"feature-test",ROLLOUT:"rollout",EXPERIMENT:"experiment"},te={RULE:"rule",EXPERIMENT:"experiment"},ie={BOOLEAN:"boolean",DOUBLE:"double",INTEGER:"integer",STRING:"string",JSON:"json"},ne={V2:"2",V3:"3",V4:"4"},re={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 invalid or wrong type.'};!function(e){e.ACTIVATE="ACTIVATE:experiment, user_id,attributes, variation, event",e.DECISION="DECISION:type, userId, attributes, decisionInfo",e.LOG_EVENT="LOG_EVENT:logEvent",e.OPTIMIZELY_CONFIG_UPDATE="OPTIMIZELY_CONFIG_UPDATE",e.TRACK="TRACK:event_key, user_id, attributes, event_tags, event"}(G||(G={})),function(e){e.VUID="vuid",e.FS_USER_ID="fs_user_id"}(K||(K={})),function(e){e.IDENTIFIED="identified",e.INITIALIZED="client_initialized"}(q||(q={}));var oe=Object.freeze({__proto__:null,LOG_LEVEL:$,ERROR_MESSAGES:J,LOG_MESSAGES:W,CONTROL_ATTRIBUTES:Z,JAVASCRIPT_CLIENT_ENGINE:"javascript-sdk",NODE_CLIENT_ENGINE:"node-sdk",REACT_CLIENT_ENGINE:"react-sdk",REACT_NATIVE_CLIENT_ENGINE:"react-native-sdk",REACT_NATIVE_JS_CLIENT_ENGINE:"react-native-js-sdk",CLIENT_VERSION:"5.3.4",DECISION_NOTIFICATION_TYPES:Q,DECISION_SOURCES:ee,AUDIENCE_EVALUATION_TYPES:te,FEATURE_VARIABLE_TYPES:ie,DATAFILE_VERSIONS:ne,DECISION_MESSAGES:re,get NOTIFICATION_TYPES(){return G},REQUEST_TIMEOUT_MS:6e4,REQUEST_TIMEOUT_ODP_SEGMENTS_MS:1e4,REQUEST_TIMEOUT_ODP_EVENTS_MS:1e4,get ODP_USER_KEY(){return K},FS_USER_ID_ALIAS:"fs-user-id",ODP_DEFAULT_EVENT_TYPE:"fullstack",get ODP_EVENT_ACTION(){return q}}),ae=V("EventProcessor"),se=V("EventProcessor"),ue=function(){function e(e){var t=e.key,i=e.maxValues,n=void 0===i?1e3:i;this.LS_KEY=t,this.maxValues=n}return e.prototype.get=function(e){return this.getMap()[e]||null},e.prototype.set=function(e,t){var i=this.getMap();i[e]=t,this.replace(i)},e.prototype.remove=function(e){var t=this.getMap();delete t[e],this.replace(t)},e.prototype.values=function(){return O(this.getMap())},e.prototype.clear=function(){this.replace({})},e.prototype.replace=function(e){try{"undefined"!=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){se.error(String(e))}},e.prototype.clean=function(){var e=this.getMap(),t=Object.keys(e),i=t.length-this.maxValues;if(!(i<1)){var n=t.map((function(t){return{key:t,value:e[t]}}));n.sort((function(e,t){return e.value.timestamp-t.value.timestamp}));for(var r=0;r1?new X({flushInterval:t,maxQueueSize:e,sink:n,closingSink:r,batchComparator:i}):new Y({sink:n})}(a,r,B,this.drainQueue.bind(this,!1),this.drainQueue.bind(this,!0))}return e.prototype.drainQueue=function(e,t){var i=this,n=new Promise((function(n){if(fe.debug("draining queue with %s events",t.length),0!==t.length){var r,o,a={url:"https://logx.optimizely.com/v1/events",httpVerb:"POST",params:de(t)};(e&&i.closingDispatcher?i.closingDispatcher:i.dispatcher).dispatchEvent(a,(function(){n()})),o=a,(r=i.notificationCenter)&&r.sendNotifications(G.LOG_EVENT,o)}else n()}));return this.requestTracker.trackRequest(n),n},e.prototype.process=function(e){this.queue.enqueue(e)},e.prototype.stop=function(){try{return this.queue.stop(),this.requestTracker.onRequestsComplete()}catch(e){fe.error('Error stopping EventProcessor: "%s"',Object(e).message,String(e))}return Promise.resolve()},e.prototype.start=function(){return d(this,void 0,void 0,(function(){return p(this,(function(e){switch(e.label){case 0:return[4,this.queue.start()];case 1:return e.sent(),[2]}}))}))},e}(),he="CONFIG_VALIDATOR",Ee=[ne.V2,ne.V3,ne.V4],ve={handleError:function(){}},ye={dispatchEvent:function(e,t){var i,n=e.params,r=e.url;"POST"===e.httpVerb?((i=new XMLHttpRequest).open("POST",r,!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))):(r+="?wxhr=true",n&&(r+="&"+function(e){return Object.keys(e).map((function(t){return encodeURIComponent(t)+"="+encodeURIComponent(e[t])})).join("&")}(n)),(i=new XMLHttpRequest).open("GET",r,!0),i.onreadystatechange=function(){if(4===i.readyState&&t&&"function"==typeof t)try{t({statusCode:i.status})}catch(e){}},i.send())}},Ie={dispatchEvent:function(e,t){var i=e.params,n=e.url,r=new Blob([JSON.stringify(i)],{type:"application/json"});t({statusCode:navigator.sendBeacon(n,r)?200:500})}},me=function(){function e(){}return e.prototype.log=function(){},e}();function _e(e){return new C(e)}var Oe=Object.freeze({__proto__:null,NoOpLogger:me,createLogger:_e,createNoOpLogger:function(){return new me}}),be=function(){function e(e){var t=this;this.logger=e.logger,this.errorHandler=e.errorHandler,this.notificationListeners={},O(G).forEach((function(e){t.notificationListeners[e]=[]})),this.listenerId=1}return e.prototype.addNotificationListener=function(e,t){try{if(!(O(G).indexOf(e)>-1))return-1;this.notificationListeners[e]||(this.notificationListeners[e]=[]);var i=!1;if((this.notificationListeners[e]||[]).forEach((function(e){e.callback!==t||(i=!0)})),i)return-1;this.notificationListeners[e].push({id:this.listenerId,callback:t});var n=this.listenerId;return this.listenerId+=1,n}catch(e){return this.logger.log($.ERROR,e.message),this.errorHandler.handleError(e),-1}},e.prototype.removeNotificationListener=function(e){var t=this;try{var i,n;if(Object.keys(this.notificationListeners).some((function(r){return(t.notificationListeners[r]||[]).every((function(t,o){return t.id!==e||(i=o,n=r,!1)})),void 0!==i&&void 0!==n})),void 0!==i&&void 0!==n)return this.notificationListeners[n].splice(i,1),!0}catch(e){this.logger.log($.ERROR,e.message),this.errorHandler.handleError(e)}return!1},e.prototype.clearAllNotificationListeners=function(){var e=this;try{O(G).forEach((function(t){e.notificationListeners[t]=[]}))}catch(e){this.logger.log($.ERROR,e.message),this.errorHandler.handleError(e)}},e.prototype.clearNotificationListeners=function(e){try{this.notificationListeners[e]=[]}catch(e){this.logger.log($.ERROR,e.message),this.errorHandler.handleError(e)}},e.prototype.sendNotifications=function(e,t){var i=this;try{(this.notificationListeners[e]||[]).forEach((function(n){var r=n.callback;try{r(t)}catch(t){i.logger.log($.ERROR,W.NOTIFICATION_LISTENER_EXCEPTION,"NOTIFICATION_CENTER",e,t.message)}}))}catch(e){this.logger.log($.ERROR,e.message),this.errorHandler.handleError(e)}},e}();function Te(e){return new be(e)}var Re,Ne,Ae,Se=function(){for(var e=[],t=0;t=200&&e<400}var Fe={get:function(){return Promise.resolve(void 0)},set:function(){return Promise.resolve()},contains:function(){return Promise.resolve(!1)},remove:function(){return Promise.resolve(!1)}},Ve=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return l(t,e),t.prototype.makeGetRequest=function(e,t){return function(e,t){var i=new XMLHttpRequest;return{responsePromise:new Promise((function(n,r){i.open("GET",e,!0),function(e,t){Object.keys(e).forEach((function(i){var n=e[i];t.setRequestHeader(i,n)}))}(t,i),i.onreadystatechange=function(){if(4===i.readyState){if(0===i.status)return void r(new Error("Request error"));var e=function(e){var t=e.getAllResponseHeaders();if(null===t)return{};var i=t.split("\r\n"),n={};return i.forEach((function(e){var t=e.indexOf(": ");if(t>-1){var i=e.slice(0,t),r=e.slice(t+2);r.length>0&&(n[i]=r)}})),n}(i),t={statusCode:i.status,body:i.responseText,headers:e};n(t)}},i.timeout=6e4,i.ontimeout=function(){we.error("Request timed out")},i.send()})),abort:function(){i.abort()}}}(e,t)},t.prototype.getConfigDefaults=function(){return{autoUpdate:!1}},t}(function(){function e(e){var t=this,i=c(c({},this.getConfigDefaults()),e),n=i.datafile,r=i.autoUpdate,o=void 0!==r&&r,a=i.sdkKey,s=i.updateInterval,u=void 0===s?3e5:s,l=i.urlTemplate,d=void 0===l?"https://cdn.optimizely.com/datafiles/%s.json":l,p=i.cache,f=void 0===p?Fe:p;this.cache=f,this.cacheKey="opt-datafile-"+a,this.sdkKey=a,this.isReadyPromiseSettled=!1,this.readyPromiseResolver=function(){},this.readyPromiseRejecter=function(){},this.readyPromise=new Promise((function(e,i){t.readyPromiseResolver=e,t.readyPromiseRejecter=i})),n?(this.currentDatafile=n,a||this.resolveReadyPromise()):this.currentDatafile="",this.isStarted=!1,this.datafileUrl=N(d,a),this.emitter=new Ue,this.autoUpdate=o,this.updateInterval=u,this.updateInterval<3e4&&ke.warn(Le),this.currentTimeout=null,this.currentRequest=null,this.backoffController=new Ce,this.syncOnCurrentRequestComplete=!1}return e.prototype.get=function(){return this.currentDatafile},e.prototype.start=function(){this.isStarted||(ke.debug("Datafile manager started"),this.isStarted=!0,this.backoffController.reset(),this.setDatafileFromCacheIfAvailable(),this.syncDatafile())},e.prototype.stop=function(){return ke.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?ke.error("Error fetching datafile: %s",e.message,e):"string"==typeof e?ke.error("Error fetching datafile: %s",e):ke.error("Error fetching datafile"))},e.prototype.onRequestResolved=function(e){var t;if(this.isStarted){void 0!==e.statusCode&&xe(e.statusCode)?this.backoffController.reset():this.backoffController.countError(),this.trySavingLastModified(e.headers);var i=this.getNextDatafileFromResponse(e);if(""!==i)if(ke.info("Updating datafile from response"),this.currentDatafile=i,this.cache.set(this.cacheKey,i),this.isReadyPromiseSettled){var n={datafile:i};null===(t=Pe.getNotificationCenter(this.sdkKey,ke))||void 0===t||t.sendNotifications(G.OPTIMIZELY_CONFIG_UPDATE),this.emitter.emit("update",n)}else this.resolveReadyPromise()}},e.prototype.onRequestComplete=function(){this.isStarted&&(this.currentRequest=null,this.isReadyPromiseSettled||this.autoUpdate||this.rejectReadyPromise(new Error("Failed to become ready")),this.autoUpdate&&this.syncOnCurrentRequestComplete&&this.syncDatafile(),this.syncOnCurrentRequestComplete=!1)},e.prototype.syncDatafile=function(){var e=this,t={};this.lastResponseLastModified&&(t["if-modified-since"]=this.lastResponseLastModified),ke.debug("Making datafile request to url %s with headers: %s",this.datafileUrl,(function(){return JSON.stringify(t)})),this.currentRequest=this.makeGetRequest(this.datafileUrl,t);var i=function(){e.onRequestComplete()};this.currentRequest.responsePromise.then((function(t){e.onRequestResolved(t)}),(function(t){e.onRequestRejected(t)})).then(i,i),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=this.backoffController.getDelay(),i=Math.max(t,this.updateInterval);ke.debug("Scheduling sync in %s ms",i),this.currentTimeout=setTimeout((function(){e.currentRequest?e.syncOnCurrentRequestComplete=!0:e.syncDatafile()}),i)},e.prototype.getNextDatafileFromResponse=function(e){return ke.debug("Response status code: %s",e.statusCode),void 0===e.statusCode||304===e.statusCode?"":xe(e.statusCode)?e.body:(ke.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,ke.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&&(ke.debug("Using datafile from cache"),e.currentDatafile=t,e.resolveReadyPromise())}))},e}()),Me=function(){function e(e,t,i,n){this.apiKey=e,this.apiHost=t,this.pixelUrl=i,this.segmentsToCheck=n}return e.prototype.equals=function(e){return this.apiHost===e.apiHost&&this.apiKey===e.apiKey&&this.pixelUrl===e.pixelUrl&&A(this.segmentsToCheck,e.segmentsToCheck)},e}(),je="PROJECT_CONFIG",Be=function(e,t){void 0===t&&(t=null);var i,n,r,o,a=((o=v({},i=e)).audiences=(i.audiences||[]).map((function(e){return v({},e)})),o.experiments=(i.experiments||[]).map((function(e){return v({},e)})),o.featureFlags=(i.featureFlags||[]).map((function(e){return v({},e)})),o.groups=(i.groups||[]).map((function(e){var t=v({},e);return t.experiments=(e.experiments||[]).map((function(e){return v({},e)})),t})),o.rollouts=(i.rollouts||[]).map((function(e){var t=v({},e);return t.experiments=(e.experiments||[]).map((function(e){return v({},e)})),t})),o.environmentKey=null!==(n=i.environmentKey)&&void 0!==n?n:"",o.sdkKey=null!==(r=i.sdkKey)&&void 0!==r?r:"",o);a.__datafileStr=null===t?JSON.stringify(e):t,(a.audiences||[]).forEach((function(e){e.conditions=JSON.parse(e.conditions)})),a.audiencesById=y(a.audiences,"id"),v(a.audiencesById,y(a.typedAudiences,"id")),a.attributeKeyMap=y(a.attributes,"key"),a.eventKeyMap=y(a.events,"key"),a.groupIdMap=y(a.groups,"id"),Object.keys(a.groupIdMap||{}).forEach((function(e){(a.groupIdMap[e].experiments||[]).forEach((function(t){a.experiments.push(v(t,{groupId:e}))}))})),a.rolloutIdMap=y(a.rollouts||[],"id"),O(a.rolloutIdMap||{}).forEach((function(e){(e.experiments||[]).forEach((function(e){a.experiments.push(e),e.variationKeyMap=y(e.variations,"key")}))}));var s=new Set;Object.keys(a.audiencesById).map((function(e){return Ge(a.audiencesById[e])})).forEach((function(e){e.forEach((function(e){s.add(e)}))}));var u=Array.from(s),l=!1,c="",d="",p="";return a.integrations&&(a.integrationKeyMap=y(a.integrations,"key"),a.integrations.forEach((function(e){if(!("key"in e))throw new Error(N(J.MISSING_INTEGRATION_KEY,je));"odp"===e.key&&(l=!0,d=d||e.publicKey||"",c=c||e.host||"",p=p||e.pixelUrl||"")}))),a.odpIntegrationConfig=l?{integrated:!0,odpConfig:new Me(d,c,p,u)}:{integrated:!1},a.experimentKeyMap=y(a.experiments,"key"),a.experimentIdMap=y(a.experiments,"id"),a.variationIdMap={},a.variationVariableUsageMap={},(a.experiments||[]).forEach((function(e){e.variationKeyMap=y(e.variations,"key"),v(a.variationIdMap,y(e.variations,"id")),O(e.variationKeyMap||{}).forEach((function(e){e.variables&&(a.variationVariableUsageMap[e.id]=y(e.variables,"id"))}))})),a.experimentFeatureMap={},a.featureKeyMap=y(a.featureFlags||[],"key"),O(a.featureKeyMap||{}).forEach((function(e){e.variables.forEach((function(e){e.type===ie.STRING&&e.subType===ie.JSON&&(e.type=ie.JSON,delete e.subType)})),e.variableKeyMap=y(e.variables,"key"),(e.experimentIds||[]).forEach((function(t){a.experimentFeatureMap[t]?a.experimentFeatureMap[t].push(e.id):a.experimentFeatureMap[t]=[e.id]}))})),a.flagRulesMap={},(a.featureFlags||[]).forEach((function(e){var t=[];e.experimentIds.forEach((function(e){var i=a.experimentIdMap[e];i&&t.push(i)}));var i=a.rolloutIdMap[e.rolloutId];i&&t.push.apply(t,i.experiments),a.flagRulesMap[e.key]=t})),a.flagVariationsMap={},b(a.flagRulesMap||{}).forEach((function(e){var t=e[0],i=e[1],n=[];i.forEach((function(e){e.variations.forEach((function(e){T(n,(function(t){return t.id===e.id}))||n.push(e)}))})),a.flagVariationsMap[t]=n})),a},Ge=function(e){return e.conditions?Ke(e.conditions):[]},Ke=function(e){var t=[];return function(e){return["and","or","not"].includes(e)}(e)?[]:(Array.isArray(e)?e.forEach((function(e){return t.push.apply(t,Ke(e))})):"qualified"===e.match&&t.push(e.value),t)},qe=function(e,t){var i=e.experimentIdMap[t];if(!i)throw new Error(N(J.INVALID_EXPERIMENT_ID,je,t));return i.layerId},ze=function(e,t,i){var n=e.attributeKeyMap[t],r=0===t.indexOf("$opt_");return n?(r&&i.log($.WARNING,"Attribute %s unexpectedly has reserved prefix %s; using attribute ID instead of reserved attribute name.",t,"$opt_"),n.id):r?t:(i.log($.DEBUG,J.UNRECOGNIZED_ATTRIBUTE,je,t),null)},He=function(e,t){var i=e.eventKeyMap[t];return i?i.id:null},Ye=function(e,t){var i=e.experimentKeyMap[t];if(!i)throw new Error(N(J.INVALID_EXPERIMENT_KEY,je,t));return i.status},Xe=function(e,t){return e.variationIdMap.hasOwnProperty(t)?e.variationIdMap[t].key:null},$e=function(e,t){if(e.experimentKeyMap.hasOwnProperty(t)){var i=e.experimentKeyMap[t];if(i)return i}throw new Error(N(J.EXPERIMENT_KEY_NOT_IN_DATAFILE,je,t))},Je=function(e,t){var i=e.experimentIdMap[t];if(!i)throw new Error(N(J.INVALID_EXPERIMENT_ID,je,t));return i.trafficAllocation},We=function(e,t,i){if(e.experimentIdMap.hasOwnProperty(t)){var n=e.experimentIdMap[t];if(n)return n}return i.log($.ERROR,J.INVALID_EXPERIMENT_ID,je,t),null},Ze=function(e,t,i){if(!e)return null;var n=T(e.flagVariationsMap[t],(function(e){return e.key===i}));return n||null},Qe=function(e,t,i){if(e.featureKeyMap.hasOwnProperty(t)){var n=e.featureKeyMap[t];if(n)return n}return i.log($.ERROR,J.FEATURE_NOT_IN_DATAFILE,je,t),null},et=function(e){return e.__datafileStr},tt=function(e){var t;try{t=function(e){if(!e)throw new Error(N(J.NO_DATAFILE_SPECIFIED,he));if("string"==typeof e)try{e=JSON.parse(e)}catch(e){throw new Error(N(J.INVALID_DATAFILE_MALFORMED,he))}if("object"==typeof e&&!Array.isArray(e)&&null!==e&&-1===Ee.indexOf(e.version))throw new Error(N(J.INVALID_DATAFILE_VERSION,he,e.version));return e}(e.datafile)}catch(e){return{configObj:null,error:e}}if(e.jsonSchemaValidator)try{e.jsonSchemaValidator.validate(t),e.logger.log($.INFO,W.VALID_DATAFILE,je)}catch(e){return{configObj:null,error:e}}else e.logger.log($.INFO,W.SKIPPING_JSON_VALIDATION,je);var i=[t];return"string"==typeof e.datafile&&i.push(e.datafile),{configObj:Be.apply(void 0,i),error:null}},it=function(e){return!!e.sendFlagDecisions};function nt(e,t,i,n){var r={sdkKey:e};if((void 0===n||"object"==typeof n&&null!==n)&&L.assign(r,n),i){var o=tt({datafile:i,jsonSchemaValidator:void 0,logger:t}),a=o.configObj,s=o.error;s&&t.error(s),a&&(r.datafile=et(a))}return new Ve(r)}var rt=function(){function e(e,t){void 0===t&&(t=6e4),this.logger=e,this.timeout=t}return e.prototype.makeRequest=function(e,i,n,r){var o=this,a=new XMLHttpRequest;return{responsePromise:new Promise((function(s,u){a.open(n,e,!0),o.setHeadersInXhr(i,a),a.onreadystatechange=function(){if(a.readyState===XMLHttpRequest.DONE){if(0===a.status)return void u(new Error("Request error"));var e=o.parseHeadersFromXhr(a),t={statusCode:a.status,body:a.responseText,headers:e};s(t)}},a.timeout=o.timeout,a.ontimeout=function(){o.logger.log(t.LogLevel.WARNING,"Request timed out")},a.send(r)})),abort:function(){a.abort()}}},e.prototype.setHeadersInXhr=function(e,t){Object.keys(e).forEach((function(i){var n=e[i];"string"==typeof n&&t.setRequestHeader(i,n)}))},e.prototype.parseHeadersFromXhr=function(e){var i=this,n=e.getAllResponseHeaders();if(null===n)return{};var r=n.split("\r\n"),o={};return r.forEach((function(e){try{var n=e.indexOf(": ");if(n>-1){var r=e.slice(0,n),a=e.slice(n+2);r&&a&&(o[r]=a)}}catch(n){i.logger.log(t.LogLevel.WARNING,"Unable to parse & skipped header item '".concat(e,"'"))}})),o},e}(),ot=function(e){var t=e.browserCallback,i=e.nonBrowserCallback;return"undefined"!=typeof window?t(null===window||void 0===window?void 0:window.localStorage):i()},at=function(){function e(){this.logger=V()}return e.prototype.contains=function(e){return d(this,void 0,void 0,(function(){var t=this;return p(this,(function(i){return[2,ot({browserCallback:function(t){return null!==(null==t?void 0:t.getItem(e))},nonBrowserCallback:function(){return t.logger.error(J.LOCAL_STORAGE_DOES_NOT_EXIST),!1}})]}))}))},e.prototype.get=function(e){return d(this,void 0,void 0,(function(){var t=this;return p(this,(function(i){return[2,ot({browserCallback:function(t){return(null==t?void 0:t.getItem(e))||void 0},nonBrowserCallback:function(){t.logger.error(J.LOCAL_STORAGE_DOES_NOT_EXIST)}})]}))}))},e.prototype.remove=function(e){return d(this,void 0,void 0,(function(){var t=this;return p(this,(function(i){switch(i.label){case 0:return[4,this.contains(e)];case 1:return i.sent()?(ot({browserCallback:function(t){null==t||t.removeItem(e)},nonBrowserCallback:function(){t.logger.error(J.LOCAL_STORAGE_DOES_NOT_EXIST)}}),[2,!0]):[2,!1]}}))}))},e.prototype.set=function(e,t){return d(this,void 0,void 0,(function(){var i=this;return p(this,(function(n){return[2,ot({browserCallback:function(i){null==i||i.setItem(e,t)},nonBrowserCallback:function(){i.logger.error(J.LOCAL_STORAGE_DOES_NOT_EXIST)}})]}))}))},e}(),st=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}(),ut=function(){function e(e){var t=e.maxSize,i=e.timeout;this._map=new Map;var n=V();n.debug("Provisioning cache with maxSize of ".concat(t)),n.debug("Provisioning cache with timeout of ".concat(i)),this._maxSize=t,this._timeout=i}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,i=e.value;if(!(this._maxSize<=0)&&(this._map.get(t)&&this._map.delete(t),this._map.set(t,new st(i)),this._map.size>this._maxSize)){var n=this._map.keys().next().value;this._map.delete(n)}},e.prototype.reset=function(){this._maxSize<=0||this._map.clear()},e.prototype.peek=function(e){var t;if(this._maxSize<=0)return null;var i=this._map.get(e);return null!==(t=null==i?void 0:i.value)&&void 0!==t?t:null},e}(),lt=function(e){function t(t){var i,n;return e.call(this,{maxSize:null!==(i=null==t?void 0:t.maxSize)&&void 0!==i?i:100,timeout:null!==(n=null==t?void 0:t.timeout)&&void 0!==n?n:6e5})||this}return l(t,e),t}(ut),ct=(function(e){l((function(t){var i,n;return e.call(this,{maxSize:null!==(i=null==t?void 0:t.maxSize)&&void 0!==i?i:1e4,timeout:null!==(n=null==t?void 0:t.timeout)&&void 0!==n?n:6e5})||this}),e)}(ut),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 d(this,void 0,void 0,(function(){return p(this,(function(i){switch(i.label){case 0:return this._instance||(this._instance=new e),this._instance._vuid?[3,2]:[4,this._instance.load(t)];case 1:i.sent(),i.label=2;case 2:return[2,this._instance]}}))}))},e.prototype.load=function(t){return d(this,void 0,void 0,(function(){var i;return p(this,(function(n){switch(n.label){case 0:return[4,t.get(this._keyForVuid)];case 1:return(i=n.sent())&&e.isVuid(i)?(this._vuid=i,[3,4]):[3,2];case 2:return this._vuid=this.makeVuid(),[4,this.save(this._vuid,t)];case 3:n.sent(),n.label=4;case 4:return[2,this._vuid]}}))}))},e.prototype.makeVuid=function(){var t=I().replace(/-/g,"").toLowerCase(),i="".concat(e.vuid_prefix).concat(t);return i.length<=32?i:i.substring(0,32)},e.prototype.save=function(e,t){return d(this,void 0,void 0,(function(){return p(this,(function(i){switch(i.label){case 0:return[4,t.set(this._keyForVuid,e)];case 1:return i.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 dt(e){var t=["string","number","boolean"],i=!1;return e.forEach((function(e){t.includes(typeof e)||null===e||(i=!0)})),i}var pt,ft=function(e,t,i,n){this.type=e,this.action=t,this.identifiers=null!=i?i:new Map,this.data=null!=n?n:new Map},gt=function(){};!function(e){e[e.Running=0]="Running",e[e.Stopped=1]="Stopped"}(pt||(pt={}));var ht,Et=function(){function e(e){var t,i,n,r=e.odpIntegrationConfig,o=e.segmentManager,a=e.eventManager,s=e.logger,u=this;this.ready=!1,this.status=pt.Stopped,this.segmentManager=o,this.eventManager=a,this.logger=s,this.configPromise=(t=gt,i=gt,{promise:n=new Promise((function(e,n){t=e,i=n})),resolve:t,reject:i,then:n.then.bind(n)});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===pt.Running&&u.registerVuid()})),r&&this.updateSettings(r)}return e.prototype.getStatus=function(){return this.status},e.prototype.start=function(){return d(this,void 0,void 0,(function(){return p(this,(function(e){return this.status===pt.Running?[2]:this.odpIntegrationConfig?this.odpIntegrationConfig.integrated?(this.status=pt.Running,this.segmentManager.updateSettings(this.odpIntegrationConfig.odpConfig),this.eventManager.updateSettings(this.odpIntegrationConfig.odpConfig),this.eventManager.start(),[2,Promise.resolve()]):[2,Promise.reject(new Error("start() called when ODP is not integrated"))]:[2,Promise.reject(new Error("cannot start without ODP config"))]}))}))},e.prototype.stop=function(){return d(this,void 0,void 0,(function(){return p(this,(function(e){switch(e.label){case 0:return this.status===pt.Stopped?[2]:(this.status=pt.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){return this.configPromise.resolve(),!(this.odpIntegrationConfig&&(t=this.odpIntegrationConfig,i=e,!(t.integrated!==i.integrated||t.integrated&&i.integrated&&!t.odpConfig.equals(i.odpConfig)))||(this.odpIntegrationConfig=e,e.integrated?this.status===pt.Running?(this.segmentManager.updateSettings(e.odpConfig),this.eventManager.updateSettings(e.odpConfig)):this.start():this.stop(),0));var t,i},e.prototype.fetchQualifiedSegments=function(e,i){return void 0===i&&(i=[]),d(this,void 0,void 0,(function(){return p(this,(function(n){return this.odpIntegrationConfig?this.odpIntegrationConfig.integrated?ct.isVuid(e)?[2,this.segmentManager.fetchQualifiedSegments(K.VUID,e,i)]:[2,this.segmentManager.fetchQualifiedSegments(K.FS_USER_ID,e,i)]:(this.logger.log(t.LogLevel.ERROR,J.ODP_NOT_INTEGRATED),[2,null]):(this.logger.log(t.LogLevel.ERROR,J.ODP_CONFIG_NOT_AVAILABLE),[2,null])}))}))},e.prototype.identifyUser=function(e,i){this.odpIntegrationConfig?this.odpIntegrationConfig.integrated?e&&ct.isVuid(e)?this.eventManager.identifyUser(void 0,e):this.eventManager.identifyUser(e,i):this.logger.log(t.LogLevel.INFO,J.ODP_NOT_INTEGRATED):this.logger.log(t.LogLevel.ERROR,J.ODP_CONFIG_NOT_AVAILABLE)},e.prototype.sendEvent=function(e){var i=e.type,n=e.action,r=e.identifiers,o=e.data,a=i;if("string"==typeof a&&""!==a||(a="fullstack"),this.odpIntegrationConfig)if(this.odpIntegrationConfig.integrated){if(dt(o))throw new Error(J.ODP_INVALID_DATA);if("string"!=typeof n||""===n)throw new Error("ODP action is not valid (cannot be empty).");this.eventManager.sendEvent(new ft(a,n,r,o))}else this.logger.log(t.LogLevel.ERROR,J.ODP_NOT_INTEGRATED);else this.logger.log(t.LogLevel.ERROR,J.ODP_CONFIG_NOT_AVAILABLE)},e.prototype.initializeVuid=function(){return Promise.resolve()},e.prototype.registerVuid=function(){if(this.odpIntegrationConfig)if(this.odpIntegrationConfig.integrated){var e=this.getVuid();if(e)try{this.eventManager.registerVuid(e)}catch(e){this.logger.log(t.LogLevel.ERROR,J.ODP_VUID_REGISTRATION_FAILED)}}else this.logger.log(t.LogLevel.INFO,J.ODP_NOT_INTEGRATED);else this.logger.log(t.LogLevel.ERROR,J.ODP_CONFIG_NOT_AVAILABLE)},e}(),vt=function(){function e(e,t){this.requestHandler=e,this.logger=t}return e.prototype.getLogger=function(){return this.logger},e.prototype.sendEvents=function(e,i){var n;return d(this,void 0,void 0,(function(){var r,o,a,s,u,l,c,d,f,g;return p(this,(function(p){switch(p.label){case 0:if(r=!1,0===i.length)return this.logger.log(t.LogLevel.ERROR,"".concat("ODP event send failed"," (no events)")),[2,r];if(!this.shouldSendEvents(i))return[2,r];o=this.generateRequestData(e,i),a=o.method,s=o.endpoint,u=o.headers,l=o.data,c=0,p.label=1;case 1:return p.trys.push([1,3,,4]),[4,this.requestHandler.makeRequest(s,u,a,l).responsePromise];case 2:return d=p.sent(),c=null!==(n=d.statusCode)&&void 0!==n?n:c,[3,4];case 3:return f=p.sent(),g="network error",f instanceof Error&&(g=f.message),this.logger.log(t.LogLevel.ERROR,"".concat("ODP event send failed"," (").concat(g,")")),r=!0,[3,4];case 4:return c>=400&&this.logger.log(t.LogLevel.ERROR,"".concat("ODP event send failed"," (").concat(c,")")),c>=500&&(r=!0),[2,r]}}))}))},e}(),yt=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return l(i,e),i.prototype.shouldSendEvents=function(e){return e.length<=1||(this.getLogger().log(t.LogLevel.ERROR,"".concat("ODP event send failed"," (browser only supports batch size 1)")),!1)},i.prototype.getPixelApiEndpoint=function(e){var t=e.pixelUrl;return new URL("v2/zaius.gif",t).href},i.prototype.generateRequestData=function(e,t){var i=this.getPixelApiEndpoint(e),n=e.apiKey,r=t[0],o=new URL(i);return r.identifiers.forEach((function(e,t){o.searchParams.append(t,e)})),r.data.forEach((function(e,t){o.searchParams.append(t,e)})),o.searchParams.append("tracker_id",n),o.searchParams.append("event_type",r.type),o.searchParams.append("vdl_action",r.action),{method:"GET",endpoint:o.toString(),headers:{},data:""}},i}(vt),It=function(e){"function"==typeof queueMicrotask?queueMicrotask(e):setTimeout(e)};!function(e){e[e.Stopped=0]="Stopped",e[e.Running=1]="Running"}(ht||(ht={}));var mt=function(){function e(e){var t=e.odpConfig,i=e.apiManager,n=e.logger,r=e.clientEngine,o=e.clientVersion,a=e.queueSize,s=e.batchSize,u=e.flushInterval,l=e.userAgentParser,c=e.retries;if(this.status=ht.Stopped,this.queue=new Array,this.apiManager=i,this.logger=n,this.clientEngine=r,this.clientVersion=o,this.initParams(s,a,u),this.status=ht.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&&null!=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=ht.Running,this.batchSize>1&&this.setNewTimeout()):this.logger.log(t.LogLevel.ERROR,J.ODP_CONFIG_NOT_AVAILABLE)},e.prototype.stop=function(){return d(this,void 0,void 0,(function(){return p(this,(function(e){return this.logger.log(t.LogLevel.DEBUG,"Stop requested."),this.flush(),this.clearCurrentTimeout(),this.status=ht.Stopped,this.logger.log(t.LogLevel.DEBUG,"Stopped. Queue Count: %s",this.queue.length),[2]}))}))},e.prototype.registerVuid=function(e){var t=new Map;t.set(K.VUID,e);var i=new ft("fullstack",q.INITIALIZED,t);this.sendEvent(i)},e.prototype.identifyUser=function(e,i){var n=new Map;if(e||i){i&&n.set(K.VUID,i),e&&n.set(K.FS_USER_ID,e);var r=new ft("fullstack",q.IDENTIFIED,n);this.sendEvent(r)}else this.logger.log(t.LogLevel.ERROR,J.ODP_SEND_EVENT_FAILED_UID_MISSING)},e.prototype.sendEvent=function(e){dt(e.data)?this.logger.log(t.LogLevel.ERROR,"Event data found to be invalid."):(e.data=this.augmentCommonData(e.data),this.enqueue(e))},e.prototype.enqueue=function(e){this.status!==ht.Stopped?this.hasNecessaryIdentifiers(e)?this.queue.length>=this.queueSize?this.logger.log(t.LogLevel.WARNING,"Failed to Process ODP Event. Event Queue full. queueSize = %s.",this.queue.length):(this.queue.push(e),this.processQueue()):this.logger.log(t.LogLevel.ERROR,"ODP events should have at least one key-value pair in identifiers."):this.logger.log(t.LogLevel.WARNING,"Failed to Process ODP Event. ODPEventManager is not running.")},e.prototype.processQueue=function(e){if(void 0===e&&(e=!1),this.status===ht.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),i=this.odpConfig;t.length>0&&It((function(){return d(e,void 0,void 0,(function(){var e,n;return p(this,(function(r){switch(r.label){case 0:n=0,r.label=1;case 1:return[4,this.apiManager.sendEvents(i,t)];case 2:e=r.sent(),n+=1,r.label=3;case 3:if(e&&n0},e.prototype.augmentCommonData=function(e){var t=new Map(this.userAgentData);return t.set("idempotence_id",I()),t.set("data_source_type","sdk"),t.set("data_source",this.clientEngine),t.set("data_source_version",this.clientVersion),e.forEach((function(e,i){return t.set(i,e)})),t},e.prototype.getLogger=function(){return this.logger},e.prototype.getQueue=function(){return this.queue},e}(),_t=function(e){function i(){var t=null!==e&&e.apply(this,arguments)||this;return t.hasNecessaryIdentifiers=function(e){return e.identifiers.size>=0},t}return l(i,e),i.prototype.initParams=function(e,i,n){this.queueSize=i||100,this.batchSize=1,this.flushInterval=0,void 0!==e&&1!==e&&this.getLogger().log(t.LogLevel.WARNING,"ODP event batch size must be 1 in the browser."),void 0!==n&&0!==n&&this.getLogger().log(t.LogLevel.WARNING,"ODP event flush interval must be 0 in the browser.")},i.prototype.discardEventsIfNeeded=function(){this.getLogger().log(t.LogLevel.DEBUG,"ODPConfig not ready. Leaving events in queue.")},i}(mt),Ot=function(){function e(e,t,i,n){this.odpConfig=n,this._segmentsCache=e,this.odpSegmentApiManager=t,this.logger=i||V("OdpSegmentManager")}return Object.defineProperty(e.prototype,"segmentsCache",{get:function(){return this._segmentsCache},enumerable:!1,configurable:!0}),e.prototype.fetchQualifiedSegments=function(e,i,n){return d(this,void 0,void 0,(function(){var r,o,a,s,u,l;return p(this,(function(c){switch(c.label){case 0:if(!this.odpConfig)return this.logger.log(t.LogLevel.WARNING,J.ODP_CONFIG_NOT_AVAILABLE),[2,null];if(!(r=this.odpConfig.segmentsToCheck)||r.length<=0)return this.logger.log(t.LogLevel.DEBUG,"No segments are used in the project. Returning an empty list."),[2,[]];if(o=this.makeCacheKey(e,i),a=n.includes(t.OptimizelySegmentOption.IGNORE_CACHE),(s=n.includes(t.OptimizelySegmentOption.RESET_CACHE))&&this.reset(),!a&&!s){if(u=this._segmentsCache.lookup(o))return this.logger.log(t.LogLevel.DEBUG,'ODP cache hit. Returning segments from cache "%s".',o),[2,u];this.logger.log(t.LogLevel.DEBUG,"ODP cache miss.")}return this.logger.log(t.LogLevel.DEBUG,"Making a call to ODP server."),[4,this.odpSegmentApiManager.fetchSegments(this.odpConfig.apiKey,this.odpConfig.apiHost,e,i,r)];case 1:return(l=c.sent())&&!a&&this._segmentsCache.save({key:o,value:l}),[2,l]}}))}))},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}(),bt={$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"}}}}}},Tt={$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"]},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:[]},Rt=[],Nt=function(){function e(e,t){this.toGraphQLJson=function(e,t,i){return f(f(['{"query" : "query {customer',"(".concat(e,' : \\"').concat(t,'\\") '),"{audiences","(subset: ["],(null==i?void 0:i.map((function(e,t){return'\\"'.concat(e,'\\"').concat(t0?(h=g.errors[0].extensions,E=h.code,v=h.classification,"INVALID_IDENTIFIER_EXCEPTION"==E?this.logger.log(t.LogLevel.ERROR,"".concat("Audience segments fetch failed"," (invalid identifier)")):this.logger.log(t.LogLevel.ERROR,"".concat("Audience segments fetch failed"," (").concat(v,")")),[2,null]):(y=null===(l=null===(u=null===(s=null==g?void 0:g.data)||void 0===s?void 0:s.customer)||void 0===u?void 0:u.audiences)||void 0===l?void 0:l.edges)?[2,y.filter((function(e){return"qualified"==e.node.state})).map((function(e){return e.node.name}))]:(this.logger.log(t.LogLevel.ERROR,"".concat("Audience segments fetch failed"," (decode error)")),[2,null]):(this.logger.log(t.LogLevel.ERROR,"".concat("Audience segments fetch failed"," (decode error)")),[2,null]):(this.logger.log(t.LogLevel.ERROR,"".concat("Audience segments fetch failed"," (network error)")),[2,null])}}))}))},e.prototype.querySegments=function(e,t,i,n,r){return d(this,void 0,void 0,(function(){var i,n,o,a;return p(this,(function(s){switch(s.label){case 0:i="POST",n=t,o={"Content-Type":"application/json","x-api-key":e},s.label=1;case 1:return s.trys.push([1,3,,4]),[4,this.requestHandler.makeRequest(n,o,i,r).responsePromise];case 2:return a=s.sent(),[3,4];case 3:return s.sent(),[2,null];case 4:return[2,a.body]}}))}))},e.prototype.parseSegmentsResponseJson=function(e){var t={};try{t=JSON.parse(e)}catch(e){return null}return function(e,t,i){void 0===t&&(t=bt),void 0===i&&(i=!0);var n="".concat("JSON_SCHEMA_VALIDATOR"," (").concat(t.title,")");if("object"!=typeof e||null===e)throw new Error(N(J.NO_JSON_PROVIDED,n));var r=o.validate(e,t);if(r.valid)return!0;if(!i)return!1;if(Array.isArray(r.errors))throw new Error(N(J.INVALID_DATAFILE,n,r.errors[0].property,r.errors[0].message));throw new Error(N(J.INVALID_JSON,n))}(t,Tt,!1)?t:null},e}(),At=function(e){function t(t){return e.call(this,t)||this}return l(t,e),t.createInstance=function(e){var i=e.logger,n=e.odpOptions,r=e.odpIntegrationConfig,o=e.clientEngine,a=e.clientVersion;i=i||V(),o=o||"javascript-sdk",a=a||"5.3.4";var s,u,l,c=void 0;return(null==r?void 0:r.integrated)&&(c=r.odpConfig),s=(null==n?void 0:n.segmentsRequestHandler)?n.segmentsRequestHandler:new rt(i,(null==n?void 0:n.segmentsApiTimeout)||1e4),u=(null==n?void 0:n.segmentManager)?n.segmentManager:new Ot((null==n?void 0:n.segmentsCache)||new lt({maxSize:null==n?void 0:n.segmentsCacheSize,timeout:null==n?void 0:n.segmentsCacheTimeout}),new Nt(s,i),i,c),l=(null==n?void 0:n.eventRequestHandler)?n.eventRequestHandler:new rt(i,(null==n?void 0:n.eventApiTimeout)||1e4),new t({odpIntegrationConfig:r,segmentManager:u,eventManager:(null==n?void 0:n.eventManager)?n.eventManager:new _t({odpConfig:c,apiManager:new yt(l,i),logger:i,clientEngine:o,clientVersion:a,flushInterval:null==n?void 0:n.eventFlushInterval,batchSize:null==n?void 0:n.eventBatchSize,queueSize:null==n?void 0:n.eventQueueSize,userAgentParser:null==n?void 0:n.userAgentParser}),logger:i})},t.prototype.initializeVuid=function(){return d(this,void 0,void 0,(function(){var e;return p(this,(function(i){switch(i.label){case 0:return[4,ct.instance(t.cache)];case 1:return e=i.sent(),this.vuid=e.vuid,[2]}}))}))},t.prototype.identifyUser=function(t,i){t&&ct.isVuid(t)?e.prototype.identifyUser.call(this,void 0,t):t&&i&&ct.isVuid(i)?e.prototype.identifyUser.call(this,t,i):e.prototype.identifyUser.call(this,t,i||this.vuid)},t.prototype.sendEvent=function(t){var i=t.type,n=t.action,r=t.identifiers,o=t.data,a=new Map(r);if(!r.has(K.VUID)){if(!this.vuid)throw new Error(J.ODP_SEND_EVENT_FAILED_VUID_MISSING);a.set(K.VUID,this.vuid)}e.prototype.sendEvent.call(this,{type:i,action:n,identifiers:a,data:o})},t.prototype.isVuidEnabled=function(){return!0},t.prototype.getVuid=function(){return this.vuid},t.cache=new at,t}(Et);function St(e,t,i){return{variationKey:null,enabled:!1,variables:{},ruleKey:null,flagKey:e,userContext:t,reasons:i}}var Lt=function(){function e(e){var t,i=e.optimizely,n=e.userId,r=e.attributes,o=e.shouldIdentifyUser,a=void 0===o||o,s=this;this._qualifiedSegments=null,this.optimizely=i,this.userId=n,this.attributes=null!==(t=c({},r))&&void 0!==t?t:{},this.forcedDecisionsMap={},a&&this.optimizely.onReady().then((function(e){e.success&&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 c({},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 i,n=e.flagKey,r=null!==(i=e.ruleKey)&&void 0!==i?i:Z.FORCED_DECISION_NULL_RULE_KEY,o={variationKey:t.variationKey};return this.forcedDecisionsMap[n]||(this.forcedDecisionsMap[n]={}),this.forcedDecisionsMap[n][r]=o,!0},e.prototype.getForcedDecision=function(e){return this.findForcedDecision(e)},e.prototype.removeForcedDecision=function(e){var t,i=null!==(t=e.ruleKey)&&void 0!==t?t:Z.FORCED_DECISION_NULL_RULE_KEY,n=e.flagKey,r=!1;return this.forcedDecisionsMap.hasOwnProperty(n)&&(this.forcedDecisionsMap[n].hasOwnProperty(i)&&(delete this.forcedDecisionsMap[n][i],r=!0),0===Object.keys(this.forcedDecisionsMap[n]).length&&delete this.forcedDecisionsMap[n]),r},e.prototype.removeAllForcedDecisions=function(){return this.forcedDecisionsMap={},!0},e.prototype.findForcedDecision=function(e){var t,i=null!==(t=e.ruleKey)&&void 0!==t?t:Z.FORCED_DECISION_NULL_RULE_KEY,n=e.flagKey;if(this.forcedDecisionsMap.hasOwnProperty(e.flagKey)){var r=this.forcedDecisionsMap[n];if(r.hasOwnProperty(i))return{variationKey:r[i].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=c({},this.forcedDecisionsMap)),t._qualifiedSegments=this._qualifiedSegments,t},e.prototype.fetchQualifiedSegments=function(e){return d(this,void 0,void 0,(function(){var t;return p(this,(function(i){switch(i.label){case 0:return[4,this.optimizely.fetchQualifiedSegments(this.userId,e)];case 1:return t=i.sent(),this.qualifiedSegments=t,[2,null!==t]}}))}))},e.prototype.isQualifiedFor=function(e){return!!this._qualifiedSegments&&this._qualifiedSegments.indexOf(e)>-1},e}(),Dt=["and","or","not"];function wt(e,t){if(Array.isArray(e)){var i=e[0],n=e.slice(1);switch("string"==typeof i&&-1===Dt.indexOf(i)&&(i="or",n=e),i){case"and":return function(e,t){var i=!1;if(Array.isArray(e)){for(var n=0;n0){var i=wt(e[0],t);return null===i?null:!i}return null}(n,t);default:return function(e,t){var i=!1;if(Array.isArray(e)){for(var n=0;n-1)r=t.toUpperCase();else{var a=i[t]?i[t].name:t;n||"NOT"===r?(r=""===r?"OR":r,n=""===n?"".concat(r,' "').concat(i[t].name,'"'):n.concat(" ".concat(r,' "').concat(a,'"'))):n='"'.concat(a,'"')}""!==o&&(""!==n||"NOT"===r?(r=""===r?"OR":r,n=""===n?"".concat(r," ").concat(o):n.concat(" ".concat(r," ").concat(o))):n=n.concat(o))}))}return n},e.getExperimentAudiences=function(t,i){return t.audienceConditions?e.getSerializedAudiences(t.audienceConditions,i.audiencesById):""},e.mergeFeatureVariables=function(e,t,i,n,r){var o=(e[i]||[]).reduce((function(e,t){return e[t.key]={id:t.id,key:t.key,type:t.type,value:t.defaultValue},e}),{});return(n||[]).forEach((function(e){var i=t[e.id],n={id:e.id,key:i.key,type:i.type,value:r?e.value:i.defaultValue};o[i.key]=n})),o},e.getVariationsMap=function(t,i,n,r){return t.reduce((function(t,o){var a=e.mergeFeatureVariables(i,n,r,o.variables,o.featureEnabled);return t[o.key]={id:o.id,key:o.key,featureEnabled:o.featureEnabled,variablesMap:a},t}),{})},e.getVariableIdMap=function(e){return(e.featureFlags||[]).reduce((function(e,t){return t.variables.forEach((function(t){e[t.id]=t})),e}),{})},e.getDeliveryRules=function(t,i,n,r,o){return r.map((function(r){return{id:r.id,key:r.key,audiences:e.getExperimentAudiences(r,t),variationsMap:e.getVariationsMap(r.variations,i,o,n)}}))},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,i,n,r){var o=this.getRolloutExperimentIds(t.rollouts),a={},s={};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,i,n,c.toString()),p={id:u.id,key:u.key,audiences:e.getExperimentAudiences(u,t),variationsMap:d};a[u.id]=p,s[u.key]&&r&&r.warn("Duplicate experiment keys found in datafile: ".concat(u.key)),s[u.key]=p}})),{experimentsMapById:a,experimentsMapByKey:s}},e.getExperimentsKeyMap=function(e){var t={};for(var i in e){var n=e[i];t[n.key]=n}return t},e.getFeaturesMap=function(t,i,n,r){var o={};return t.featureFlags.forEach((function(a){var s={},u=[];a.experimentIds.forEach((function(e){var t=n[e];t&&(s[t.key]=t),u.push(n[e])}));var l=(a.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[a.rolloutId];d&&(c=e.getDeliveryRules(t,i,a.id,d.experiments,r)),o[a.key]={id:a.id,key:a.key,experimentRules:u,deliveryRules:c,experimentsMap:s,variablesMap:l}})),o},e}(),Ct=V();function Pt(e,t){return e instanceof Error?e.message:t||"Unknown error"}var kt=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=new Error(N(J.DATAFILE_AND_SDK_KEY_MISSING,"PROJECT_CONFIG_MANAGER"));return this.readyPromise=Promise.resolve({success:!1,reason:Pt(t)}),void Ct.error(t)}var i=null;e.datafile&&(i=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:Pt(i,"Invalid datafile")})}catch(e){Ct.error(e),this.readyPromise=Promise.resolve({success:!1,reason:Pt(e,"Error in initialize")})}}return e.prototype.onDatafileManagerReadyFulfill=function(){if(this.datafileManager){var e=this.handleNewDatafile(this.datafileManager.get());return e?{success:!1,reason:Pt(e)}:{success:!0}}return{success:!1,reason:Pt(null,"Datafile manager is not provided")}},e.prototype.onDatafileManagerReadyReject=function(e){return{success:!1,reason:Pt(e,"Failed to become ready")}},e.prototype.onDatafileManagerUpdate=function(){this.datafileManager&&this.handleNewDatafile(this.datafileManager.get())},e.prototype.handleNewDatafile=function(e){var t=this,i=tt({datafile:e,jsonSchemaValidator:this.jsonSchemaValidator,logger:Ct}),n=i.configObj,r=i.error;if(r)Ct.error(r);else{var o=this.configObj?this.configObj.revision:"null";n&&o!==n.revision&&(this.configObj=n,this.optimizelyConfigObj=null,It((function(){t.updateListeners.forEach((function(e){return e(n)}))})))}return r},e.prototype.getConfig=function(){return this.configObj},e.prototype.getOptimizelyConfig=function(){return!this.optimizelyConfigObj&&this.configObj&&(this.optimizelyConfigObj=function(e,t,i){return new Ut(e,t,i)}(this.configObj,et(this.configObj),Ct)),this.optimizelyConfigObj},e.prototype.onReady=function(){return this.readyPromise},e.prototype.onUpdate=function(e){var t=this;return this.updateListeners.push(e),function(){var i=t.updateListeners.indexOf(e);i>-1&&t.updateListeners.splice(i,1)}},e.prototype.stop=function(){this.datafileManager&&this.datafileManager.stop(),this.updateListeners=[]},e}(),xt=Math.pow(2,32),Ft=function(e){var t=[],i=e.experimentIdMap[e.experimentId].groupId;if(i){var n=e.groupIdMap[i];if(!n)throw new Error(N(J.INVALID_GROUP_ID,"BUCKETER",i));if("random"===n.policy){var r=Vt(n,e.bucketingId,e.userId,e.logger);if(null===r)return e.logger.log($.INFO,W.USER_NOT_IN_ANY_EXPERIMENT,"BUCKETER",e.userId,i),t.push([W.USER_NOT_IN_ANY_EXPERIMENT,"BUCKETER",e.userId,i]),{result:null,reasons:t};if(r!==e.experimentId)return e.logger.log($.INFO,W.USER_NOT_BUCKETED_INTO_EXPERIMENT_IN_GROUP,"BUCKETER",e.userId,e.experimentKey,i),t.push([W.USER_NOT_BUCKETED_INTO_EXPERIMENT_IN_GROUP,"BUCKETER",e.userId,e.experimentKey,i]),{result:null,reasons:t};e.logger.log($.INFO,W.USER_BUCKETED_INTO_EXPERIMENT_IN_GROUP,"BUCKETER",e.userId,e.experimentKey,i),t.push([W.USER_BUCKETED_INTO_EXPERIMENT_IN_GROUP,"BUCKETER",e.userId,e.experimentKey,i])}}var o="".concat(e.bucketingId).concat(e.experimentId),a=jt(o);e.logger.log($.DEBUG,W.USER_ASSIGNED_TO_EXPERIMENT_BUCKET,"BUCKETER",a,e.userId),t.push([W.USER_ASSIGNED_TO_EXPERIMENT_BUCKET,"BUCKETER",a,e.userId]);var s=Mt(a,e.trafficAllocationConfig);return null===s||e.variationIdMap[s]?{result:s,reasons:t}:(s&&(e.logger.log($.WARNING,W.INVALID_VARIATION_ID,"BUCKETER"),t.push([W.INVALID_VARIATION_ID,"BUCKETER"])),{result:null,reasons:t})},Vt=function(e,t,i,n){var r="".concat(t).concat(e.id),o=jt(r);n.log($.DEBUG,W.USER_ASSIGNED_TO_EXPERIMENT_BUCKET,"BUCKETER",o,i);var a=e.trafficAllocation;return Mt(o,a)},Mt=function(e,t){for(var i=0;i2)return Bt.warn(W.UNKNOWN_MATCH_TYPE,"SEMANTIC VERSION",e),null;var r=t.split(".");if(r.length!=n+1)return Bt.warn(W.UNKNOWN_MATCH_TYPE,"SEMANTIC VERSION",e),null;for(var o=0,a=r;os)return 1;if(an[o])return!Kt(e)&&Kt(t)?-1:1}}return Kt(t)&&!Kt(e)?-1:0}(a,r)}$t.exact=Wt,$t.exists=function(e,t){return null!=t.getAttributes()[e.name]},$t.gt=function(e,t){var i=t.getAttributes()[e.name],n=e.value;return Zt(e,t)&&null!==n?i>n:null},$t.ge=function(e,t){var i=t.getAttributes()[e.name],n=e.value;return Zt(e,t)&&null!==n?i>=n:null},$t.lt=function(e,t){var i=t.getAttributes()[e.name],n=e.value;return Zt(e,t)&&null!==n?i0},$t.semver_ge=function(e,t){var i=Qt(e,t);return null===i?null:i>=0},$t.semver_lt=function(e,t){var i=Qt(e,t);return null===i?null:i<0},$t.semver_le=function(e,t){var i=Qt(e,t);return null===i?null:i<=0};var ei=Object.freeze({__proto__:null,evaluate:function(e,t){var i=t.getAttributes(),n=e.match;if(void 0!==n&&-1===Xt.indexOf(n))return Yt.warn(W.UNKNOWN_MATCH_TYPE,Ht,JSON.stringify(e)),null;var r=e.name;return i.hasOwnProperty(r)||"exists"==n?(n&&$t[n]||Wt)(e,t):(Yt.debug(W.MISSING_ATTRIBUTE_VALUE,Ht,JSON.stringify(e),r),null)}}),ti=V(),ii=["qualified"],ni={};function ri(e,t){return t.isQualifiedFor(e.value)}ni.qualified=ri;var oi=Object.freeze({__proto__:null,evaluate:function(e,t){var i=e.match;return void 0!==i&&-1===ii.indexOf(i)?(ti.warn(W.UNKNOWN_MATCH_TYPE,"ODP_SEGMENT_CONDITION_EVALUATOR",JSON.stringify(e)),null):(i&&ni[i]||ri)(e,t)}}),ai=V(),si=function(){function e(e){this.typeToEvaluatorMap=L.assign({},e,{custom_attribute:ei,third_party_dimension:oi})}return e.prototype.evaluate=function(e,t,i){var n=this;return!e||0===e.length||!!wt(e,(function(e){var r=t[e];if(r){ai.log($.DEBUG,W.EVALUATING_AUDIENCE,"AUDIENCE_EVALUATOR",e,JSON.stringify(r.conditions));var o=wt(r.conditions,n.evaluateConditionWithUserAttributes.bind(n,i)),a=null===o?"UNKNOWN":o.toString().toUpperCase();return ai.log($.DEBUG,W.AUDIENCE_EVALUATION_RESULT,"AUDIENCE_EVALUATOR",e,a),o}return null}))},e.prototype.evaluateConditionWithUserAttributes=function(e,t){var i=this.typeToEvaluatorMap[t.type];if(!i)return ai.log($.WARNING,W.UNKNOWN_CONDITION_TYPE,"AUDIENCE_EVALUATOR",JSON.stringify(t)),null;try{return i.evaluate(t,e)}catch(e){ai.log($.ERROR,J.CONDITION_EVALUATOR_ERROR,"AUDIENCE_EVALUATOR",t.type,e.message)}return null},e}();function ui(e){return"string"==typeof e&&""!==e}var li="DECISION_SERVICE",ci=function(){function e(e){var t;this.audienceEvaluator=(t=e.UNSTABLE_conditionEvaluators,new si(t)),this.forcedVariationMap={},this.logger=e.logger,this.userProfileService=e.userProfileService||null}return e.prototype.getVariation=function(e,i,n,r){void 0===r&&(r={});var o=n.getUserId(),a=n.getAttributes(),s=this.getBucketingId(o,a),u=[],l=i.key;if(!this.checkIfExperimentIsActive(e,l))return this.logger.log($.INFO,W.EXPERIMENT_NOT_RUNNING,li,l),u.push([W.EXPERIMENT_NOT_RUNNING,li,l]),{result:null,reasons:u};var c=this.getForcedVariation(e,l,o);u.push.apply(u,c.reasons);var d=c.result;if(d)return{result:d,reasons:u};var p=this.getWhitelistedVariation(i,o);u.push.apply(u,p.reasons);var f=p.result;if(f)return{result:f.key,reasons:u};var g=r[t.OptimizelyDecideOption.IGNORE_USER_PROFILE_SERVICE],h=this.resolveExperimentBucketMap(o,a);if(!g&&(f=this.getStoredVariation(e,i,o,h)))return this.logger.log($.INFO,W.RETURNING_STORED_VARIATION,li,f.key,l,o),u.push([W.RETURNING_STORED_VARIATION,li,f.key,l,o]),{result:f.key,reasons:u};var E=this.checkIfUserIsInAudience(e,i,te.EXPERIMENT,n,"");if(u.push.apply(u,E.reasons),!E.result)return this.logger.log($.INFO,W.USER_NOT_IN_EXPERIMENT,li,o,l),u.push([W.USER_NOT_IN_EXPERIMENT,li,o,l]),{result:null,reasons:u};var v=this.buildBucketerParams(e,i,s,o),y=Ft(v);u.push.apply(u,y.reasons);var I=y.result;return I&&(f=e.variationIdMap[I]),f?(this.logger.log($.INFO,W.USER_HAS_VARIATION,li,o,f.key,l),u.push([W.USER_HAS_VARIATION,li,o,f.key,l]),g||this.saveUserProfile(i,f,o,h),{result:f.key,reasons:u}):(this.logger.log($.DEBUG,W.USER_HAS_NO_VARIATION,li,o,l),u.push([W.USER_HAS_NO_VARIATION,li,o,l]),{result:null,reasons:u})},e.prototype.resolveExperimentBucketMap=function(e,t){t=t||{};var i=this.getUserProfile(e)||{},n=t[Z.STICKY_BUCKETING_KEY];return L.assign({},i.experiment_bucket_map,n)},e.prototype.checkIfExperimentIsActive=function(e,t){return function(e,t){return"Running"===Ye(e,t)}(e,t)},e.prototype.getWhitelistedVariation=function(e,t){var i=[];if(e.forcedVariations&&e.forcedVariations.hasOwnProperty(t)){var n=e.forcedVariations[t];return e.variationKeyMap.hasOwnProperty(n)?(this.logger.log($.INFO,W.USER_FORCED_IN_VARIATION,li,t,n),i.push([W.USER_FORCED_IN_VARIATION,li,t,n]),{result:e.variationKeyMap[n],reasons:i}):(this.logger.log($.ERROR,W.FORCED_BUCKETING_FAILED,li,n,t),i.push([W.FORCED_BUCKETING_FAILED,li,n,t]),{result:null,reasons:i})}return{result:null,reasons:i}},e.prototype.checkIfUserIsInAudience=function(e,t,i,n,r){var o=[],a=function(e,t){var i=e.experimentIdMap[t];if(!i)throw new Error(N(J.INVALID_EXPERIMENT_ID,je,t));return i.audienceConditions||i.audienceIds}(e,t.id),s=e.audiencesById;this.logger.log($.DEBUG,W.EVALUATING_AUDIENCES_COMBINED,li,i,r||t.key,JSON.stringify(a)),o.push([W.EVALUATING_AUDIENCES_COMBINED,li,i,r||t.key,JSON.stringify(a)]);var u=this.audienceEvaluator.evaluate(a,s,n);return this.logger.log($.INFO,W.AUDIENCE_EVALUATION_RESULT_COMBINED,li,i,r||t.key,u.toString().toUpperCase()),o.push([W.AUDIENCE_EVALUATION_RESULT_COMBINED,li,i,r||t.key,u.toString().toUpperCase()]),{result:u,reasons:o}},e.prototype.buildBucketerParams=function(e,t,i,n){return{bucketingId:i,experimentId:t.id,experimentKey:t.key,experimentIdMap:e.experimentIdMap,experimentKeyMap:e.experimentKeyMap,groupIdMap:e.groupIdMap,logger:this.logger,trafficAllocationConfig:Je(e,t.id),userId:n,variationIdMap:e.variationIdMap}},e.prototype.getStoredVariation=function(e,t,i,n){if(n.hasOwnProperty(t.id)){var r=n[t.id],o=r.variation_id;if(e.variationIdMap.hasOwnProperty(o))return e.variationIdMap[r.variation_id];this.logger.log($.INFO,W.SAVED_VARIATION_NOT_FOUND,li,i,o,t.key)}return null},e.prototype.getUserProfile=function(e){var t={user_id:e,experiment_bucket_map:{}};if(!this.userProfileService)return t;try{return this.userProfileService.lookup(e)}catch(t){this.logger.log($.ERROR,J.USER_PROFILE_LOOKUP_ERROR,li,e,t.message)}return null},e.prototype.saveUserProfile=function(e,t,i,n){if(this.userProfileService)try{n[e.id]={variation_id:t.id},this.userProfileService.save({user_id:i,experiment_bucket_map:n}),this.logger.log($.INFO,W.SAVED_VARIATION,li,t.key,e.key,i)}catch(e){this.logger.log($.ERROR,J.USER_PROFILE_SAVE_ERROR,li,i,e.message)}},e.prototype.getVariationForFeature=function(e,t,i,n){void 0===n&&(n={});var r=[],o=this.getVariationForFeatureExperiment(e,t,i,n);r.push.apply(r,o.reasons);var a=o.result;if(null!==a.variation)return{result:a,reasons:r};var s=this.getVariationForRollout(e,t,i);r.push.apply(r,s.reasons);var u=s.result,l=i.getUserId();return u.variation?(this.logger.log($.DEBUG,W.USER_IN_ROLLOUT,li,l,t.key),r.push([W.USER_IN_ROLLOUT,li,l,t.key]),{result:u,reasons:r}):(this.logger.log($.DEBUG,W.USER_NOT_IN_ROLLOUT,li,l,t.key),r.push([W.USER_NOT_IN_ROLLOUT,li,l,t.key]),{result:u,reasons:r})},e.prototype.getVariationForFeatureExperiment=function(e,t,i,n){void 0===n&&(n={});var r,o,a=[],s=null;if(t.experimentIds.length>0)for(o=0;o0)try{i.forEach((function(e,t){"fs-user-id"!==t.toLowerCase()&&K.FS_USER_ID!==t.toLowerCase()||(o.delete(t),o.set(K.FS_USER_ID,e))}))}catch(e){this.logger.warn(W.ODP_SEND_EVENT_IDENTIFIER_CONVERSION_FAILED)}try{var a=new ft(r,e,o,n);this.odpManager.sendEvent(a)}catch(e){this.logger.error(J.ODP_EVENT_FAILED,e)}}else this.logger.error(J.ODP_EVENT_FAILED_ODP_MANAGER_MISSING)},e.prototype.isOdpIntegrated=function(){var e,t,i;return null!==(i=null===(t=null===(e=this.projectConfigManager.getConfig())||void 0===e?void 0:e.odpIntegrationConfig)||void 0===t?void 0:t.integrated)&&void 0!==i&&i},e.prototype.identifyUser=function(e){this.odpManager&&this.isOdpIntegrated()&&this.odpManager.identifyUser(e)},e.prototype.fetchQualifiedSegments=function(e,t){return d(this,void 0,void 0,(function(){return p(this,(function(i){switch(i.label){case 0:return this.odpManager?[4,this.odpManager.fetchQualifiedSegments(e,t)]:[2,null];case 1:return[2,i.sent()]}}))}))},e.prototype.getVuid=function(){var e;if(this.odpManager){if(this.odpManager.isVuidEnabled())return this.odpManager.getVuid();this.logger.log($.WARNING,"getVuid() unavailable for this platform","OPTIMIZELY")}else null===(e=this.logger)||void 0===e||e.error("Unable to get VUID - ODP Manager is not instantiated yet.")},e}(),Ri={parseUserAgentInfo:function(){var e=(new s.UAParser).getResult();return{os:e.os,device:e.device}}};function Ni(){return Ri}var Ai=Object.freeze({__proto__:null,get LogLevel(){return t.LogLevel},getLogger:V,setLogHandler:M,LOG_LEVEL:$,createLogger:_e}),Si=V();j.setLogHandler(_e()),j.setLogLevel(t.LogLevel.INFO);var Li=!1,Di=function(e){var i,n;try{var r=!1;e.errorHandler&&(n=e.errorHandler,g=n),e.logger&&(j.setLogHandler(e.logger),j.setLogLevel(t.LogLevel.NOTSET)),void 0!==e.logLevel&&j.setLogLevel(e.logLevel);try{(function(e){if("object"==typeof e&&null!==e){var t=e,i=t.errorHandler,n=t.eventDispatcher,r=t.logger;if(i&&"function"!=typeof i.handleError)throw new Error(N(J.INVALID_ERROR_HANDLER,he));if(n&&"function"!=typeof n.dispatchEvent)throw new Error(N(J.INVALID_EVENT_DISPATCHER,he));if(r&&"function"!=typeof r.log)throw new Error(N(J.INVALID_LOGGER,he));return!0}throw new Error(N(J.INVALID_CONFIG,he))})(e),r=!0}catch(e){Si.error(e)}var o=void 0;null==e.eventDispatcher?(o=new ce({eventDispatcher:ye}),Li||(o.sendPendingEvents(),Li=!0)):o=e.eventDispatcher;var a=e.closingEventDispatcher;!e.eventDispatcher&&!a&&window.navigator&&"sendBeacon"in window.navigator&&(a=Ie);var s=e.eventBatchSize,u=e.eventFlushInterval;(function(e){return!("number"!=typeof e||!L.isSafeInteger(e))&&e>=1})(e.eventBatchSize)||(Si.warn("Invalid eventBatchSize %s, defaulting to %s",e.eventBatchSize,10),s=10),function(e){return!("number"!=typeof e||!L.isSafeInteger(e))&&e>0}(e.eventFlushInterval)||(Si.warn("Invalid eventFlushInterval %s, defaulting to %s",e.eventFlushInterval,1e3),u=1e3);var l=h(),d=Te({logger:Si,errorHandler:l}),p={dispatcher:o,closingDispatcher:a,flushInterval:u,batchSize:s,maxQueueSize:e.eventMaxQueueSize||1e4,notificationCenter:d},f=!0===(null===(i=e.odpOptions)||void 0===i?void 0:i.disabled);f&&Si.info(W.ODP_DISABLED);var E=e.clientEngine,v=e.clientVersion,y=c(c({clientEngine:"javascript-sdk"},e),{eventProcessor:Se(p),logger:Si,errorHandler:l,datafileManager:e.sdkKey?nt(e.sdkKey,Si,e.datafile,e.datafileOptions):void 0,notificationCenter:d,isValidInstance:r,odpManager:f?void 0:At.createInstance({logger:Si,odpOptions:e.odpOptions,clientEngine:E,clientVersion:v})}),I=new Ti(y);try{if("function"==typeof window.addEventListener){var m="onpagehide"in window?"pagehide":"unload";window.addEventListener(m,(function(){I.close()}),!1)}}catch(e){Si.error(W.UNABLE_TO_ATTACH_UNLOAD,"INDEX_BROWSER",e.message)}return I}catch(e){return Si.error(e),null}},wi=function(){Li=!1},Ui=j.setLogHandler,Ci=j.setLogLevel,Pi=c(c({},Ai),{logging:Oe,errorHandler:ve,eventDispatcher:ye,sendBeaconEventDispatcher:Ie,enums:oe,setLogger:Ui,setLogLevel:Ci,createInstance:Di,__internalResetRetryState:wi,OptimizelyDecideOption:t.OptimizelyDecideOption,getUserAgentParser:Ni});t.LOG_LEVEL=$,t.__internalResetRetryState=wi,t.createInstance=Di,t.createLogger=_e,t.default=Pi,t.enums=oe,t.errorHandler=ve,t.eventDispatcher=ye,t.getLogger=V,t.getUserAgentParser=Ni,t.logging=Oe,t.sendBeaconEventDispatcher=Ie,t.setLogHandler=M,t.setLogLevel=Ci,t.setLogger=Ui},function(e,t,i){"use strict";i.d(t,"b",(function(){return n})),i.d(t,"f",(function(){return r})),i.d(t,"c",(function(){return o})),i.d(t,"d",(function(){return a})),i.d(t,"e",(function(){return s})),i.d(t,"a",(function(){return u}));const n={USER_DID_NOT_ACCEPT_COOKIE:1,FAIL_FETCH_DATAFILE:2,INVALID_DATAFILE:3,OUT_OF_TIME:4},r={code:n.USER_DID_NOT_ACCEPT_COOKIE,message:"The user did not accept the performance consent."},o={code:n.FAIL_FETCH_DATAFILE,message:"Failed to fetch the datafile at: {{url}}"},a={code:n.INVALID_DATAFILE,message:"Datafile is invalid!"},s={code:n.OUT_OF_TIME,message:"Out of time for waiting to initialize Optimizely!"};class u extends Error{constructor(e={},t={}){let i=e.message;for(let[e,n]of Object.entries(t))i=i.replace(`{{${e}}}`,n);super(i),this.code=e.code}}},function(e,t,i){"use strict";i.d(t,"b",(function(){return o})),i.d(t,"c",(function(){return a})),i.d(t,"a",(function(){return s}));var n=i(5);const r={debug:1,info:2,warn:3,warning:3,error:4,1:1,2:2,3:3,4:4},o=(e=null)=>null===e?null:r[e]||0,a=(e=[])=>{const t={},i=new URL(document.location.href);let r=i.searchParams.get("opti_log_level");r&&(r=o(r)),r&&(t.logLevel=r);let a=window.sessionStorage.getItem("opti_log_level");a&&(a=o(a)),a&&(t.logLevel=a);let s=i.searchParams.get("opti_user_id");s&&(t.userId=s),null!==i.searchParams.get("opti_force_variation")&&(t.forceVariation=!0);let u=i.searchParams.get("opti_session_force_variation");null!==u&&(t.forceVariation=!0);let l=Object(n.a)("opti_start_url");if(l){l=new URL(l),null!==l.searchParams.get("opti_session_force_variation")&&(t.forceVariation=!0);for(const i of e){let e=l.searchParams.get(i);e&&(t[i]=e)}}null!==u&&Object(n.b)("opti_start_url",document.location.href,20);for(const n of e){let e=i.searchParams.get(n);e&&(t[n]=e)}return t},s=(e,t,i="")=>{if(!e||!t)return;const{forceVariation:n,[t]:r}=a([t]);n&&r&&(e.setForcedVariation(t,r),i&&e.setForcedDecision(i,t,r))}},function(e,t,i){"use strict";i.d(t,"b",(function(){return n})),i.d(t,"a",(function(){return r}));const n=(e,t,i)=>{const n=new Date;n.setMinutes(n.getMinutes()+i),((e,t)=>{try{sessionStorage&&sessionStorage.setItem(e,t)}catch(e){}})(e,JSON.stringify({expires:n.getTime(),data:t}))},r=e=>{let t=(e=>{try{if(sessionStorage)return sessionStorage.getItem(e)}catch(e){}})(e);if(t)try{const e=JSON.parse(t);if(e&&e.data&&e.expires&&e.expires>Date.now())return e.data}catch(e){}}},function(e,t,i){var n;!function(r,o){"use strict";var a="function",s="undefined",u="object",l="string",c="major",d="model",p="name",f="type",g="vendor",h="version",E="architecture",v="console",y="mobile",I="tablet",m="smarttv",_="wearable",O="embedded",b="Amazon",T="Apple",R="ASUS",N="BlackBerry",A="Firefox",S="Google",L="Huawei",D="LG",w="Microsoft",U="Motorola",C="Opera",P="Samsung",k="Sharp",x="Sony",F="Xiaomi",V="Zebra",M="Facebook",j="Chromium OS",B="Mac OS",G=function(e){for(var t={},i=0;i0?2===s.length?typeof s[1]==a?this[s[0]]=s[1].call(this,c):this[s[0]]=s[1]:3===s.length?typeof s[1]!==a||s[1].exec&&s[1].test?this[s[0]]=c?c.replace(s[1],s[2]):o:this[s[0]]=c?s[1].call(this,c,s[2]):o:4===s.length&&(this[s[0]]=c?s[3].call(this,c.replace(s[1],s[2])):o):this[s]=c||o;d+=2}},Y=function(e,t){for(var i in t)if(typeof t[i]===u&&t[i].length>0){for(var n=0;n2&&(e.model="iPad",e.type=I),e},this.getEngine=function(){var e={};return e.name=o,e.version=o,H.call(e,n,d.engine),e},this.getOS=function(){var e={};return e.name=o,e.version=o,H.call(e,n,d.os),p&&!e.name&&c&&c.platform&&"Unknown"!=c.platform&&(e.name=c.platform.replace(/chrome os/i,j).replace(/macos/i,B)),e},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return n},this.setUA=function(e){return n=typeof e===l&&e.length>500?z(e,500):e,this},this.setUA(n),this};J.VERSION="1.0.39",J.BROWSER=G([p,h,c]),J.CPU=G([E]),J.DEVICE=G([d,g,f,v,y,m,I,_,O]),J.ENGINE=J.OS=G([p,h]),typeof t!==s?(typeof e!==s&&e.exports&&(t=e.exports=J),t.UAParser=J):i(11)?(n=function(){return J}.call(t,i,t,e))===o||(e.exports=n):typeof r!==s&&(r.UAParser=J);var W=typeof r!==s&&(r.jQuery||r.Zepto);if(W&&!W.ua){var Z=new J;W.ua=Z.getResult(),W.ua.get=function(){return Z.getUA()},W.ua.set=function(e){Z.setUA(e);var t=Z.getResult();for(var i in t)W.ua[i]=t[i]}}}("object"==typeof window?window:this)},function(e,t,i){"use strict";(function(e){i.d(t,"a",(function(){return c}));var n=i(1),r=i(3),o=i(0),a=i(5);const s="https://cdn.optimizely.com/datafiles/{{SDK_KEY}}.json",u=n.d?"https://www.ikea.com/global/assets/optimizely/{{SDK_KEY}}.json":s,l=async function(t,i){const n=e.env.IKEA_AUTH_HEADER;if(n){const e=n.split(":")[0],t=n.split(":")[1];i.headers={},i.headers[e]=t}let a;try{a=await Object(o.a)(t,i)}catch(e){throw new r.a(r.c,{url:t})}if(!a)throw new r.a(r.c,{url:t});return a},c=async(e="",t=!1)=>{const i=Object(a.a)(`opti_${e}`);if(i)return i;let r=u.replace("{{SDK_KEY}}",e);try{const t=await l(r,{});return t&&Object(a.b)(`opti_${e}`,t,5),t}catch(e){if(!n.d){if(t)throw e;return}}r=s.replace("{{SDK_KEY}}",e);try{const t=await l(r,{});return t&&Object(a.b)(`opti_${e}`,t,5),t}catch(e){if(t)throw e}return null}}).call(this,i(12))},,function(e,t,i){var n;n=function(){return function(){var e=i;e.Integer={type:"integer"};var t={String:String,Boolean:Boolean,Number:Number,Object:Object,Array:Array,Date:Date};function i(e,t){return i(e,t,{changing:!1})}e.validate=i,e.checkPropertyChange=function(e,t,n){return i(e,t,{changing:n||"property"})};var i=e._validate=function(e,i,n){n||(n={});var r=n.changing;function o(e){return e.type||t[e.name]==e&&e.name.toLowerCase()}var a=[];function s(e,t,i,l){var c;function d(e){a.push({property:i,message:e})}if(i+=i?"number"==typeof l?"["+l+"]":void 0===l?"":"."+l:l,("object"!=typeof t||t instanceof Array)&&(i||"function"!=typeof t)&&(!t||!o(t)))return"function"==typeof t?e instanceof t||d("is not an instance of the class/constructor "+t.name):t&&d("Invalid schema/property definition "+t),null;function p(e,t){if(e){if(!("string"!=typeof e||"any"==e||("null"==e?null===t:typeof t==e)||t instanceof Array&&"array"==e||t instanceof Date&&"date"==e||"integer"==e&&t%1==0))return[{property:i,message:t+" - "+typeof t+" value found, but a "+e+" is required"}];if(e instanceof Array){for(var n=[],r=0;rt.maxItems&&d("There must be a maximum of "+t.maxItems+" in the array")}else(t.properties||t.additionalProperties)&&a.concat(u(e,t.properties,i,t.additionalProperties));if(t.pattern&&"string"==typeof e&&!e.match(t.pattern)&&d("does not match the regex pattern "+t.pattern),t.maxLength&&"string"==typeof e&&e.length>t.maxLength&&d("may only be "+t.maxLength+" characters long"),t.minLength&&"string"==typeof e&&e.lengthe&&d("must have a minimum value of "+t.minimum),void 0!==t.maximum&&typeof e==typeof t.maximum&&t.maximum(new TextEncoder).encode(e);function i(e,i){let n,r,o,a,s,u,l,c;for("string"==typeof e&&(e=t(e)),n=3&e.length,r=e.length-n,o=i,s=3432918353,u=461845907,c=0;c>>16)*s&65535)<<16)&4294967295,l=l<<15|l>>>17,l=(65535&l)*u+(((l>>>16)*u&65535)<<16)&4294967295,o^=l,o=o<<13|o>>>19,a=5*(65535&o)+((5*(o>>>16)&65535)<<16)&4294967295,o=27492+(65535&a)+((58964+(a>>>16)&65535)<<16);switch(l=0,n){case 3:l^=(255&e[c+2])<<16;case 2:l^=(255&e[c+1])<<8;case 1:l^=255&e[c],l=(65535&l)*s+(((l>>>16)*s&65535)<<16)&4294967295,l=l<<15|l>>>17,l=(65535&l)*u+(((l>>>16)*u&65535)<<16)&4294967295,o^=l}return o^=e.length,o^=o>>>16,o=2246822507*(65535&o)+((2246822507*(o>>>16)&65535)<<16)&4294967295,o^=o>>>13,o=3266489909*(65535&o)+((3266489909*(o>>>16)&65535)<<16)&4294967295,o^=o>>>16,o>>>0}const n=i;n.v2=function(e,i){"string"==typeof e&&(e=t(e));let n,r=e.length,o=i^r,a=0;for(;r>=4;)n=255&e[a]|(255&e[++a])<<8|(255&e[++a])<<16|(255&e[++a])<<24,n=1540483477*(65535&n)+((1540483477*(n>>>16)&65535)<<16),n^=n>>>24,n=1540483477*(65535&n)+((1540483477*(n>>>16)&65535)<<16),o=1540483477*(65535&o)+((1540483477*(o>>>16)&65535)<<16)^n,r-=4,++a;switch(r){case 3:o^=(255&e[a+2])<<16;case 2:o^=(255&e[a+1])<<8;case 1:o^=255&e[a],o=1540483477*(65535&o)+((1540483477*(o>>>16)&65535)<<16)}return o^=o>>>13,o=1540483477*(65535&o)+((1540483477*(o>>>16)&65535)<<16),o^=o>>>15,o>>>0},n.v3=i,e.exports=n}()},function(e,t){(function(t){e.exports=t}).call(this,{})},function(e,t){var i,n,r=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function s(e){if(i===setTimeout)return setTimeout(e,0);if((i===o||!i)&&setTimeout)return i=setTimeout,setTimeout(e,0);try{return i(e,0)}catch(t){try{return i.call(null,e,0)}catch(t){return i.call(this,e,0)}}}!function(){try{i="function"==typeof setTimeout?setTimeout:o}catch(e){i=o}try{n="function"==typeof clearTimeout?clearTimeout:a}catch(e){n=a}}();var u,l=[],c=!1,d=-1;function p(){c&&u&&(c=!1,u.length?l=u.concat(l):d=-1,l.length&&f())}function f(){if(!c){var e=s(p);c=!0;for(var t=l.length;t;){for(u=l,l=[];++d1)for(var i=1;if)&&void 0===e.nsecs&&(c=0),c>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");f=u,g=c,p=s,u+=122192928e5;const E=(1e4*(268435455&u)+c)%4294967296;r[n++]=E>>>24&255,r[n++]=E>>>16&255,r[n++]=E>>>8&255,r[n++]=255&E;const v=u/4294967296*1e4&268435455;r[n++]=v>>>8&255,r[n++]=255&v,r[n++]=v>>>24&15|16,r[n++]=v>>>16&255,r[n++]=s>>>8|128,r[n++]=255&s;for(let e=0;e<6;++e)r[n+e]=a[e];return t||l(r)};var E=function(e){if(!s(e))throw TypeError("Invalid UUID");let t;const i=new Uint8Array(16);return i[0]=(t=parseInt(e.slice(0,8),16))>>>24,i[1]=t>>>16&255,i[2]=t>>>8&255,i[3]=255&t,i[4]=(t=parseInt(e.slice(9,13),16))>>>8,i[5]=255&t,i[6]=(t=parseInt(e.slice(14,18),16))>>>8,i[7]=255&t,i[8]=(t=parseInt(e.slice(19,23),16))>>>8,i[9]=255&t,i[10]=(t=parseInt(e.slice(24,36),16))/1099511627776&255,i[11]=t/4294967296&255,i[12]=t>>>24&255,i[13]=t>>>16&255,i[14]=t>>>8&255,i[15]=255&t,i};function v(e,t,i){function n(e,n,r,o){var a;if("string"==typeof e&&(e=function(e){e=unescape(encodeURIComponent(e));const t=[];for(let i=0;i>>9<<4)+1}function I(e,t){const i=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(i>>16)<<16|65535&i}function m(e,t,i,n,r,o){return I((a=I(I(t,e),I(n,o)))<<(s=r)|a>>>32-s,i);var a,s}function _(e,t,i,n,r,o,a){return m(t&i|~t&n,e,t,r,o,a)}function O(e,t,i,n,r,o,a){return m(t&n|i&~n,e,t,r,o,a)}function b(e,t,i,n,r,o,a){return m(t^i^n,e,t,r,o,a)}function T(e,t,i,n,r,o,a){return m(i^(t|~n),e,t,r,o,a)}var R=v("v3",48,(function(e){if("string"==typeof e){const t=unescape(encodeURIComponent(e));e=new Uint8Array(t.length);for(let i=0;i>5]>>>r%32&255,o=parseInt(n.charAt(i>>>4&15)+n.charAt(15&i),16);t.push(o)}return t}(function(e,t){e[t>>5]|=128<>5]|=(255&e[n/8])<>>32-t}var D=v("v5",80,(function(e){const t=[1518500249,1859775393,2400959708,3395469782],i=[1732584193,4023233417,2562383102,271733878,3285377520];if("string"==typeof e){const t=unescape(encodeURIComponent(e));e=[];for(let i=0;i>>0;l=u,u=s,s=L(a,30)>>>0,a=r,r=o}i[0]=i[0]+r>>>0,i[1]=i[1]+a>>>0,i[2]=i[2]+s>>>0,i[3]=i[3]+u>>>0,i[4]=i[4]+l>>>0}return[i[0]>>24&255,i[0]>>16&255,i[0]>>8&255,255&i[0],i[1]>>24&255,i[1]>>16&255,i[1]>>8&255,255&i[1],i[2]>>24&255,i[2]>>16&255,i[2]>>8&255,255&i[2],i[3]>>24&255,i[3]>>16&255,i[3]>>8&255,255&i[3],i[4]>>24&255,i[4]>>16&255,i[4]>>8&255,255&i[4]]})),w="00000000-0000-0000-0000-000000000000";var U=function(e){if(!s(e))throw TypeError("Invalid UUID");return parseInt(e.slice(14,15),16)}},function(e,t,i){"use strict";i.r(t),i.d(t,"getInstance",(function(){return mt})),i.d(t,"init",(function(){return Ot}));var n=i(2),r=i(1),o=i(3);const a={ga:e=>[{label:`(${e.experiment.id}):(${e.variation.id})`}],cs:e=>[{key:`AB_Opti_${e.experiment.id}`,value:`${e.variation.id}`},{key:`AB_Opti_${e.experiment.key}`,value:`${e.variation.key}`},{key:"AB_Opti_project",value:`${e.projectId}`}]};var s=i(0),u=i(6),l=i.n(u);let c=!1;const d=()=>c,p=(()=>{const e=(new l.a).getResult(),[t,i,n]=(()=>{if(void 0!==window.utag_data)return[window.utag_data.country||" ",window.utag_data.language||" ",window.utag_data.device||" "];if(void 0!==window.utag&&void 0!==window.utag.data)return[window.utag.data.visit_country||" ",window.utag.data.visit_language||" ",window.utag.data.device||" "];const e=new URL(document.location.href).pathname.split("/");return e[1]&&2===e[1].length&&e[2]&&2===e[2].length?[e[1],e[2]," "]:[" "," "," "]})(),o=e.device.model||" ",a=e.device.vendor||" ",u=(n.trim()?n:e.device.type)||"desktop",d=r.e?"prod":"cte",p=e.browser.name||" ",f=e.os.name||" ",g=`${i}-${t.toUpperCase()}`,h=`${i}-${t.toUpperCase()}`,E={market:t,device:o,deviceType:u,deviceVendor:a,isLoggedIn:!1,environment:d,browser:p,os:f,language:i,feedMarket:g,locale:h,customerType:"guest"};return(async()=>{E.isLoggedIn=await Object(s.f)(),E.customerType=await Object(s.e)(),c||(c=!0,document.dispatchEvent(new Event("_ikeaOptGloAttrReady")),I())})(),E})(),f=Object.keys(p),g=[],h=e=>{g.push(e)},E=()=>{let e={};for(const t of g){if("function"!=typeof t)continue;const i=t();i&&"object"==typeof i&&(e={...e,...i})}return{...p,...e}},v=(e={})=>{for(let[t,i]of Object.entries(e))void 0===i?(!f.includes(t)&&p.hasOwnProperty(t)&&delete p[t],f.includes(t)&&s.g.warn(`Cann't delete the default attribute: ${t}`)):p[t]=i;var t;(t=p).market||s.g.warn('"market" attribute is not set.'),t.device||s.g.warn('"device" attribute is not set.'),"boolean"!=typeof t.isLoggedIn&&s.g.warn('"isLoggedIn" attribute must be boolean.'),t.environment||s.g.warn('"environment" attribute is not set.'),t.browser||s.g.warn('"browser" attribute is not set.'),t.os||s.g.warn('"os" attribute is not set.')},y=(e=[],t={})=>{const i=e.map((e=>{const i=e.key,{[i]:n}=t;return void 0===n?null:[i,n]}));return Object.fromEntries(i.filter((e=>e)))},I=()=>{const e=f.reduce((e=>({key:e,value:"isLoggedIn"===e?String(p[e]):p[e]})),{});window.optimizely=window.optimizely||[],window.optimizely.push({type:"user",attributes:e})},m=()=>{try{return _()||!!window.ikea.cookieConsent.interactedWithBanner}catch(e){}return!1},_=(e=!1)=>{if(!window.ikea.cookieConsent)return!0;try{if(window.ikea.cookieConsent.hasConsent(2))return!0}catch(e){}if(e)throw new o.a(o.f);return!1};var O=i(7),b=i(4);const T=({storage:e=localStorage,prefix:t="optimizely-ups-data"}={})=>{const i=t,n=t=>JSON.parse(e.getItem(t)||"{}"),r=(t,i)=>e.setItem(t,JSON.stringify(i)),o=e=>`${i}-${e}`;return{lookup:e=>n(o(e)),save:e=>{const t=o(e.user_id);r(t,e)}}},R=(e,t={})=>{((e={})=>{let{logLevel:t=0}=e;if(0===t)return;const i=null===t?null:n.logging.createLogger();Object(n.setLogger)(i),Object(n.setLogLevel)(t)})(t);const i={datafile:e,eventBatchSize:1,eventFlushInterval:1,eventDispatcher:{dispatchEvent:"function"==typeof window.navigator.sendBeacon?n.sendBeaconEventDispatcher.dispatchEvent:n.eventDispatcher.dispatchEvent},errorHandler:{handleError(e){}}},r=e.featureFlags.some((e=>e.key.endsWith("_ups"))),o=Object(n.createInstance)(i),a=r?Object(n.createInstance)({...i,userProfileService:T(t)}):null;return new A(o,a,e,t)},N=e=>"string"==typeof e?e:"object"==typeof e&&e.datafile&&e.datafile.sdkKey?e.datafile.sdkKey||"":"object"==typeof e&&e&&e.projectConfigManager&&e.projectConfigManager.configObj&&e.projectConfigManager.configObj.sdkKey||"",A=function(e,t,i,r={}){const{attributePrefix:o=""}=r,{attributes:a=[]}=i||{},u=i&&i.projectId?i.projectId:null;this.data=i,this.options=r,this.variables={},this.userId=r.userId,this.mergeAttributes=((e="",t=[],i="")=>(e={})=>{const i={...E(),...e};return y(t,i)})(this.userId,a,o),this.projectId=u,this.instance=e,this.instanceUPS=t,this.instance._instanceUPS=this.instanceUPS,this.getInstanceForFlag=function(e,t){return this.instanceUPS&&(e.endsWith("_ups")||(e.key||"").endsWith("_ups")||t.endsWith("_ups"))?this.instanceUPS:this.instance};const l=[],c=[];this.notificationHandlerDecisions=function(e){const{type:t,userId:i,attributes:n,decisionInfo:r={}}=e;let{flagKey:o="",enabled:a=!1,ruleKey:s=null,variationKey:c=null,experimentKey:d=null}=r,p=o?{key:o}:null;if("flag"===t){s&&0===s.indexOf("default-rollout-")&&(s=o),s&&s.indexOf("_targeted_delivery")>0&&(s=o);const e=null===s&&null===c||String(parseInt(s))===String(s)&&String(parseInt(c))===String(c);d=e?o:s,c=e?a?"on":"off":c}if("feature"===t){const{source:e,sourceInfo:t,featureKey:i,featureEnabled:n}=r;e&&"rollout"!==e&&t?(d=t.experimentKey||null,c=t.variationKey||null):"rollout"===e&&i&&(d=i,c=n?"on":"off")}if(d&&c){let e=this.getExperimentByKey(d);e||([p,e]=this.findFlagByRolloutExperiment(d)),e||(e=this.findFlagByLegacyRolloutKey(d));let i=e&&e.variations&&Array.isArray(e.variations)?e.variations.find((e=>e.key===c)):null;const o={key:d,id:e?e.id:null},a={key:c,id:i?i.id:null};l.forEach((e=>e({type:t,flag:p,experiment:o,variation:a,attributes:n,projectId:u,decisionInfo:r}))),this.lastTestInfo={type:t,experiment:o,variation:a,flag:p}}}.bind(this),this.notificationHandlerTrack=function(e){const{logLevel:t=0}=r,{eventKey:i}=e;if("number"==typeof t&&t<=2&&"bounce_rate"!==i&&"exit_rate"!==i){console.groupCollapsed(`%c[Ab-testing-fragment] - Send track event%c${i}`,s.b,s.c);const t=this.getUsedAttributes(e.attributes);console.log("attributes",t),console.log("tags",e.eventTags),console.groupEnd()}c.forEach((t=>t(e)))}.bind(this),this.instance.notificationCenter.addNotificationListener(n.enums.NOTIFICATION_TYPES.DECISION,this.notificationHandlerDecisions),this.instance.notificationCenter.addNotificationListener(n.enums.NOTIFICATION_TYPES.TRACK,this.notificationHandlerTrack),this.instanceUPS&&(this.instanceUPS.notificationCenter.addNotificationListener(n.enums.NOTIFICATION_TYPES.DECISION,this.notificationHandlerDecisions),this.instanceUPS.notificationCenter.addNotificationListener(n.enums.NOTIFICATION_TYPES.TRACK,this.notificationHandlerTrack)),this.addActivateEventListener=e=>l.push(e),this.addTrackEventListener=e=>c.push(e),this._user=null,this._userUPS=null,this.getUser=function(e={},t=!1){if(this._user||this._userUPS)for(const[t,i]of Object.entries(e))this._user&&this._user.setAttribute(t,i),this._userUPS&&this._userUPS.setAttribute(t,i);const i=this._user||this.instance&&this.instance.createUserContext(this.userId,this.mergeAttributes(e)),n=this._userUPS||this.instanceUPS&&this.instanceUPS.createUserContext(this.userId,this.mergeAttributes(e));return t&&(this._user=i,this._userUPS=n),[i,n]},this.getUserForFlag=function(e,t={},i=!1){const[n,r]=this.getUser(t,i);return e&&(e.endsWith("_ups")||(e.key||"").endsWith("_ups"))?r:n}};A.prototype.isFeatureEnabled=function(e,t={}){_(!0);const[i,n]=this.findFlagByRolloutExperiment(e);if(i){const e=this.getDecision(i.key,t);return e&&e.enabled}const r=this.mergeAttributes(t);return this.instance&&this.instance.isFeatureEnabled(e,this.userId,r)||!!this.instanceUPS&&this.instanceUPS.isFeatureEnabled(e,this.userId,r)},A.prototype.getEnabledFeatures=function(e={}){_(!0);const[t,i]=this.getUser(e);try{const e={...t&&t.decideAll([n.OptimizelyDecideOption.ENABLED_FLAGS_ONLY]),...i&&i.decideAll([n.OptimizelyDecideOption.ENABLED_FLAGS_ONLY])};return Object.keys(e)}catch(e){}const r=this.mergeAttributes(e);return{...this.instance&&this.instance.getEnabledFeatures(this.userId,r)||{},...this.instanceUPS&&this.instanceUPS.getEnabledFeatures(this.userId,r)||{}}},A.prototype.getExperiments=function(){return _(!0),(this.data.experiments||[]).map((e=>e.key))},A.prototype.getFlags=function(){return _(!0),[]},A.prototype.findFlagByExperiment=function(e=""){const t=this.getExperimentId(e);let i;i=t?e=>(e.experimentIds||[]).includes(t):t=>t.key===e;const n=(this.data.featureFlags||[]).find(i);return n?n.key:null},A.prototype.findFlagByLegacyRolloutKey=function(e=""){const t=(this.data.featureFlags||[]).find((t=>t.key===e));return t||null},A.prototype.findFlagByRolloutExperiment=function(e=""){const t=this.data.rollouts||[];let i,n=null,r=null;e:for(let r of t)if(r.experiments)for(let t of r.experiments)if(t.key===e){i=r.id,n={...t};break e}return i&&(r=(this.data.featureFlags||[]).find((e=>e.rolloutId===i))),[r,n]},A.prototype.getExperimentsByFlag=function(e=""){const t=(this.data.featureFlags||[]).find((t=>t.key===e));if(!t)return[];const i=t.experimentIds||[];return(this.data.experiments||[]).filter((e=>i.includes(e.id))).map((e=>e.key))},A.prototype.getExperimentByKey=function(e=""){return(this.data.experiments||[]).find((t=>t.key===e&&t.id))},A.prototype.getExperimentId=function(e=""){const t=this.getExperimentByKey(e);return t?t.id:null},A.prototype.activates=A.prototype.activateExperiments=function(e=[],t={}){return _(!0),this.getExperiments().filter((t=>e.includes(t))).map((e=>[e,this.activate(e,t)]))},A.prototype.decides=A.prototype.decideFlags=function(e=[],t={}){return _(!0),this.getFlags().filter((t=>e.includes(t))).map((e=>[e,this.decide(e,t)]))},A.prototype.getRunningExperiments=function(){return _(!0),(this.data.experiments||[]).filter((e=>"Running"===e.status)).map((e=>e.key))},A.prototype.activateRunningExperiments=function(e={}){return _(!0),this.getRunningExperiments().map((t=>[t,this.activate(t,e)]))},A.prototype.activate=function(e,t={}){_(!0);const i=this.findFlagByExperiment(e);if(i){const n=this.decide(i,t);if(n&&!n.enabled)return null;if(n&&(n.ruleKey===e||i===e))return n.variationKey}return Object(b.a)(this,e),this.getInstanceForFlag(i,e).activate(e,this.userId,this.mergeAttributes(t))};const S=[];A.prototype.activateOnce=function(e,t={}){const i=`${this.projectId}-activate-${e}`;return S.includes(i)?this.getVariation(e,t):(S.push(i),this.activate(e,t))},A.prototype.getVariation=function(e,t={}){_(!0);const i=this.findFlagByExperiment(e);if(i){const n=this.getDecision(i,t);if(n&&!n.enabled)return null;if(n&&(n.ruleKey===e||i===e))return n.variationKey}return Object(b.a)(this,e),this.getInstanceForFlag(i,e).getVariation(e,this.userId,this.mergeAttributes(t))},A.prototype.getForcedVariation=function(e){const t=this.findFlagByExperiment(e);return this.getInstanceForFlag(t,e).getForcedVariation(e,this.userId)},A.prototype.setForcedVariation=function(e,t=""){const i=this.findFlagByExperiment(e);return this.getInstanceForFlag(i,e).setForcedVariation(e,this.userId,t)},A.prototype.decide=function(e,t={}){if(_(!0),e)for(const t of this.getExperimentsByFlag(e))Object(b.a)(this,t,e);const i=this.getUserForFlag(e,t).decide(e);return i.variables&&"object"==typeof i.variables||(i.variables={}),this.variables={...this.variables,...i.variables},i},A.prototype.decideOnce=function(e,t={}){const i=`${this.projectId}-decide-${e}`;return S.includes(i)?this.getDecision(e,t):(S.push(i),this.decide(e,t))},A.prototype.getDecision=function(e,t={}){if(_(!0),e)for(const t of this.getExperimentsByFlag(e))Object(b.a)(this,t,e);const i=this.getUserForFlag(e,t).decide(e,[n.OptimizelyDecideOption.DISABLE_DECISION_EVENT]);return i.variables&&"object"==typeof i.variables||(i.variables={}),this.variables={...this.variables,...i.variables},i},A.prototype.setForcedDecision=function(e="",t=null,i=""){return this.getUserForFlag(e,{},!0).setForcedDecision({flagKey:e,ruleKey:t},{variationKey:i})},A.prototype.getForcedDecision=function(e="",t=null){const i=this.getUserForFlag(flag).getForcedDecision({flagKey:e,ruleKey:t});return i&&i.variationKey||null},A.prototype.hasEvent=function(e=""){return!!(this.data.events||[]).find((t=>t.key===e))};const L={};A.prototype.track=function(e,t={},i={}){const{value:n=""}=i,r=`${this.data.sdkKey}:${e}:${n}`;if(L[r])return;_(!0),L[r]=!0,setTimeout((()=>{L[r]&&delete L[r]}),600);return this.getUserForFlag(e,t).trackEvent(e,i)},A.prototype.close=async function(){return this.instanceUPS&&await this.instanceUPS.close(),await this.instance.close()},A.prototype.getUsedAttributes=function(e={}){const{attributes:t=[]}=this.data||{};return y(t,e)};let D=0;const w=["exit_rate","bounce_rate"];let U;const C=e=>U?e(U):window.sendEvent?(U=e=>{try{return window.sendEvent(e)}catch(e){}return null},e(U)):D<1e4?setTimeout((()=>{D+=100,C(e)}),100):void 0,P=(e="",t="",i="",n={},r=!1,{logLevel:o=2}={})=>{if(e&&t){if("number"==typeof o&&o<=2){const r={category:e,action:t,label:i};n&&"object"==typeof n&&Object.keys(n).length&&(r.custom=n),console.group("%c[Ab-testing-fragment] - Google Analytics Integration",s.b),console.table(r),console.groupEnd()}C((o=>o({event_category:e,event_action:t,event_label:i,custom:n,non_interaction:r})))}},k=(e,t)=>{if(!e)return null;const i=window.ikea.experiment.getUserId();let n="optimizely",r="user bucketed",o=`(${t.experiment.id}):(${t.variation.id})`,a={optimizely_id:`${i}`};return"object"==typeof e&&(e.category&&(n=e.category),e.action&&(r=e.action),e.label&&(o=e.label),e.custom&&(a=e.custom)),{category:n,action:r,label:o,custom:a}},x=(e=!0,t,{logLevel:i}={})=>{const n=[];if("function"==typeof e)try{let i=e(t);if(null===i)return;Array.isArray(i)||(i=[i]),i.forEach((e=>{const i=k(e,t);i&&n.push(i)}))}catch(e){console.error('[Ab-testing fragment] Custom "ga" function got an error when executing.',e),console.error(t)}else e&&n.push(k({},t));n.forEach((e=>{const{category:n,action:r,label:o,custom:a={}}=e;if(!n||!r||!o)return;if("user bucketed"==r&&o.indexOf("null")>-1)return;if(t&&t.decisionInfo&&0==t.decisionInfo.decisionEventDispatched)return;const u=Object(s.h)(),l=u.decisions||{},c=(new Date).getTime(),d=o;l[d]&&c-parseInt(l[d].t)<18e5||(l[d]={t:c},Object(s.k)({...u,decisions:l}),P(n,r,o,a,!0,{logLevel:i}))}))},F=(e="",t,{logLevel:i}={})=>{if(w.includes(t.eventKey))return;let n="string"==typeof e?e:"",r=t.eventKey,o="",a={};if("function"==typeof e)try{const i=e(t);if(null===i)return;i&&(i.category&&(n=i.category),i.action&&(r=i.action),i.label&&(o=i.label),i.custom&&(a=i.custom))}catch(e){console.error('[Ab-testing fragment] Custom "gaCategory" function got an error when executing.',e),console.error(t)}n&&r&&P(n,r,o,a,!1,{logLevel:i})},V=["exit_rate","bounce_rate"],M=[],j=(e="",t="",i="",{logLevel:n}={})=>{"number"==typeof n&&n<=2&&(console.group("%c[Ab-testing-fragment] - Contentsquare Integration",s.b),console.table({method:e,key:t,value:i}),console.groupEnd());try{window._uxa=window._uxa||[],window._uxa.push([e,{key:decodeURI(t),value:decodeURI(i)}])}catch(e){}},B=(e,t)=>{if(!e)return null;let i="trackDynamicVariable",n=`AB_Opti_${t.experiment.id}`,r=`${t.variation.id}`;return"object"==typeof e&&(e.method&&(i=e.method),e.key&&(n=e.key),e.value&&(r=e.value)),{method:i,key:n,value:r}},G=(e=!0,t,{logLevel:i}={})=>{const n=[];if("function"==typeof e)try{let i=e(t);if(null===i)return;Array.isArray(i)||(i=[i]),i.forEach((e=>{const i=B(e,t);i&&n.push(i)}))}catch(e){console.error('[Ab-testing fragment] Custom "cs" function got an error when executing.',e),console.error(t)}else e&&n.push(B({},t));n.forEach((e=>{const{method:n,key:r,value:o}=e;if(!n||!r||!o)return;if(t&&t.decisionInfo&&0==t.decisionInfo.decisionEventDispatched)return;const a=[n,r,o].join("-");M.includes(a)||(M.push(a),j(n,r,o,{logLevel:i}))}))},K=(e="",t,{logLevel:i}={})=>{if(V.includes(t.eventKey))return;let n="trackDynamicVariable",r="string"==typeof e?`AB_Opti_${e}`:"",o=t.eventKey;if("function"==typeof e)try{const i=e(t);if(null===i)return;i&&(i.method&&(n=i.method),i.key&&(r=i.key),i.value&&(o=i.value))}catch(e){console.error('[Ab-testing fragment] Custom "csCategory" function got an error when executing.',e),console.error(t)}n&&r&&o&&j(n,r,o,{logLevel:i})},q=(()=>{let e=!1;const t=(new Date).getTime(),i=Object(s.h)();return(!i.lastVisit||t-parseInt(i.lastVisit)>72e5)&&(e=!0),i.lastVisit=t,Object(s.k)(i),e})();h((()=>({isEntranceVisit:q})));const z={};let H=!1;const Y=(e,t)=>{const i=Object(s.h)(),n=i.exit||{},r=i.bounce||{},o=(new Date).getTime();!n[t]&&e.hasEvent("exit_rate")&&(n[t]={u:document.location.href,t:o},e.track("exit_rate",{},{value:1})),!r[t]&&q&&e.hasEvent("bounce_rate")&&(r[t]={u:document.location.href,t:o},e.track("bounce_rate",{},{value:1})),Object(s.k)({...i,exit:n,bounce:r})},X=({init:e})=>setTimeout((()=>{const t=(new Date).getTime(),i=Object(s.h)(),n=i.exit||{},r=i.bounce||{},o=(i,n="")=>{for(const[r,o]of Object.entries(i)){const[a,s]=r.split(":"),{u:u,t:l}=o;t-l>9e5?delete i[r]:document.location.href!==u&&(delete i[r],e(a,{statistic:!1,logLevel:0},{},(e=>{e.track(n,{},{value:-1})}),(e=>{})))}};o(n,"exit_rate"),o(r,"bounce_rate"),Object(s.k)({...i,exit:n,bounce:r}),H=!0;for(const[e,t]of Object.entries(z))Y(t,e)}),5e3),$=[],J={},W=()=>{if(!window.optimizely)return[];let e,t;try{e=window.optimizely.get("data");const i=window.optimizely.get("state");i&&(t=i.getCampaignStates({isActive:!0}))}catch(e){}return e&&t&&"object"==typeof t?Object.values(t).filter((e=>e.experiment&&e.variation)).map((t=>({projectType:"web",projectId:e.accountId,experiment:t.experiment.name||null,experimentId:t.experiment.id||null,variation:t.variation.name||null,variationId:t.variation.id||null,attributes:{}}))):[]},Z=()=>[...$,...W()],Q=()=>{const e=[],t={Fullstack:"F","Fullstack legacy":"F legacy",Web:"W",Edge:"E"};return Z().forEach((i=>{const{projectType:n,projectId:r,type:o,flag:a=null,experiment:u,experimentId:l,variation:c,variationId:d,attributes:p}=i,f=((e,t,i)=>"fullstack"===e&&"feature"===t?"Fullstack legacy":"fullstack"===e&&i?"Fullstack":"fullstack"!==e||i?"web"===e?"Web":"edge"===e?"Edge":"":"Fullstack legacy")(n,o,a);console.groupCollapsed(`%c${t[f]||""}%c${u||l}%c${c||d}`,s.d,s.b,s.c),console.log("Type:",f),console.log("Project:",`https://app.optimizely.com/v2/projects/${r}`),"fullstack"===n&&(a?console.log("Flag:",`https://app.optimizely.com/v2/projects/${r}/flags/manage/${a}`):"feature"===o?console.log("Feature:",`https://app.optimizely.com/v2/projects/${r}/features/${l}`):console.log("Experiment:",`https://app.optimizely.com/v2/projects/${r}/experiments/${l}`),console.log("Attributes:"),console.table(p)),"web"===n&&console.log("Experiment:",`https://app.optimizely.com/v2/projects/${r}/experiments/${l}`),console.groupEnd(),e.push({projectType:n,projectId:r,flag:a,experiment:u,experimentId:l,variation:c,variationId:d,...p})})),console.group("%cAll Experiments Summary Table:",s.b),console.table(e),console.groupEnd(),Z()},ee=(e,t)=>{const{projectId:i}=e.data||{},n={projectType:"fullstack",projectId:i,type:t.type,flag:t.flag?t.flag.key:null,experiment:t.experiment.key,experimentId:t.experiment.id,variation:t.variation.key,variationId:t.variation.id},r=JSON.stringify(n);J[r]||(J[r]=!0,$.push({...n,attributes:e.getUsedAttributes(t.attributes||{})}))};let te,ie;const ne=({init:e,getGlobalAttributes:t})=>{te=t().market||"",te.trim()&&Object(s.m)((()=>window.__abtesting_default_data),(()=>{e({datafile:window.__abtesting_default_data},{ga:!1,cs:!1,bounceRate:!1,exitRate:!1,statistic:!1,waitLoginStatus:!1,logLevel:0},{},re,(e=>{}))}))},re=e=>{ie=e,ie.decide("default"),ie.decide(te),Object(s.m)((()=>ikea&&ikea.pubsub&&ikea.pubsub.subscribe),(()=>{ikea.pubsub.subscribe("CART_CLIENT/ADD_TO_CART_SUCCESS",(e=>{let t,i;try{e&&Array.isArray(e.items)&&(t=e.items.reduce(((e,t)=>{const n=parseInt(t.quantity);return t.productNumber&&(i=t.productNumber),isNaN(n)?e+1:e+n}),0))}catch(e){}t&&!isNaN(t)||(t=1),ie.track("add_to_cart_global",{},{value:t}),ie.track(`add_to_cart_${te}`,{},{value:t})})),ikea.pubsub.subscribe("FAVOURITE_CLIENT/ADD_TO_FAVOURITES_SUCCESS",(e=>{let t,i;try{e&&Array.isArray(e.items)&&(t=e.items.reduce(((e,t)=>{const n=parseInt(t.quantity);return t.productNumber&&(i=t.productNumber),isNaN(n)?e+1:e+n}),0))}catch(e){}t&&!isNaN(t)||(t=1),ie.track("add_to_wishlist_global",{},{value:t}),ie.track(`add_to_wishlist_${te}`,{},{value:t})}))}))},oe="--ikea-customer-web",ae=r.e?"WxCqMHtKF55xPdqZFdTVa":"JrP7oNw2A3sjSwzHsaB8N";let se=!1;const ue=Object(s.i)(oe);document.location.href.indexOf("/profile/login")>1&&(se=!0,Object(s.l)(oe,{li:1,r:document.referrer||""}));const le="--ikea-pip",ce=Object(s.i)(le),de=e=>{const t=e.replace("//","").split("/");return t.length>=5&&"p"===t[3]},pe=de(document.location.href);pe&&document.referrer&&de(document.referrer)||(ce.ptps="",Object(s.l)(le,ce));const fe=e=>{Object(s.l)(le,{...Object(s.i)(le),ptps:ge(e)})},ge=e=>e?e.closest('[data-recommendations-type="rec-pip-product-first"]')?"rec-pip-product-first":e.closest('[data-recommendations-type="rec-pip-container-first"]')?"rec-pip-container-first":e.closest('[data-recommendations-type="rec-pip-container-second"]')?"rec-pip-container-second":e.closest('[data-recommendations-type="rec-pip-container-third"]')?"rec-pip-container-third":e.closest('[data-recommendations-type="recently_viewed"]')?"rec-recently-viewed":e.closest('[data-recommendations-type="rec-add-to-cart"]')?"rec-add-to-cart":e.closest(".pip-product-variation")&&e.closest(".pip-sheets")?"pip-product-variation-sheets":e.closest(".pip-product-styles")?"pip-product-variation":e.closest(".ofeed-shoppable-image")?"ofeed-shoppable-image":e.closest(".pip-upsell")?"pip-upsell":e.closest(".rec-carousel")?"rec-carousel":"unknown":"",he=e=>{if(!pe)return;const t=e.target.closest("a[href]");t&&t.getAttribute("href")&&(de(t.getAttribute("href"))?fe(t):fe(null))};document.addEventListener("click",he),document.addEventListener("mousedown",he);var Ee,ve,ye=function(){var e=self.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart(t||100)-1)return i||r;if(i=i?r+">"+i:r,n.id)break;e=n.parentNode}}catch(e){}return i},Oe=-1,be=function(){return Oe},Te=function(e){addEventListener("pageshow",(function(t){t.persisted&&(Oe=t.timeStamp,e(t))}),!0)},Re=function(){var e=ye();return e&&e.activationStart||0},Ne=function(e,t){var i=ye(),n="navigate";return be()>=0?n="back-forward-cache":i&&(document.prerendering||Re()>0?n="prerender":document.wasDiscarded?n="restore":i.type&&(n=i.type.replace(/_/g,"-"))),{name:e,value:void 0===t?-1:t,rating:"good",delta:0,entries:[],id:"v4-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12),navigationType:n}},Ae=function(e,t,i){try{if(PerformanceObserver.supportedEntryTypes.includes(e)){var n=new PerformanceObserver((function(e){Promise.resolve().then((function(){t(e.getEntries())}))}));return n.observe(Object.assign({type:e,buffered:!0},i||{})),n}}catch(e){}},Se=function(e,t,i,n){var r,o;return function(a){t.value>=0&&(a||n)&&((o=t.value-(r||0))||void 0===r)&&(r=t.value,t.delta=o,t.rating=function(e,t){return e>t[1]?"poor":e>t[0]?"needs-improvement":"good"}(t.value,i),e(t))}},Le=function(e){requestAnimationFrame((function(){return requestAnimationFrame((function(){return e()}))}))},De=function(e){document.addEventListener("visibilitychange",(function(){"hidden"===document.visibilityState&&e()}))},we=function(e){var t=!1;return function(){t||(e(),t=!0)}},Ue=-1,Ce=function(){return"hidden"!==document.visibilityState||document.prerendering?1/0:0},Pe=function(e){"hidden"===document.visibilityState&&Ue>-1&&(Ue="visibilitychange"===e.type?e.timeStamp:0,xe())},ke=function(){addEventListener("visibilitychange",Pe,!0),addEventListener("prerenderingchange",Pe,!0)},xe=function(){removeEventListener("visibilitychange",Pe,!0),removeEventListener("prerenderingchange",Pe,!0)},Fe=function(){return Ue<0&&(Ue=Ce(),ke(),Te((function(){setTimeout((function(){Ue=Ce(),ke()}),0)}))),{get firstHiddenTime(){return Ue}}},Ve=function(e){document.prerendering?addEventListener("prerenderingchange",(function(){return e()}),!0):e()},Me=[1800,3e3],je=function(e,t){t=t||{},Ve((function(){var i,n=Fe(),r=Ne("FCP"),o=Ae("paint",(function(e){e.forEach((function(e){"first-contentful-paint"===e.name&&(o.disconnect(),e.startTimet.latency){if(i)e.duration>i.latency?(i.entries=[e],i.latency=e.duration):e.duration===i.latency&&e.startTime===i.entries[0].startTime&&i.entries.push(e);else{var n={id:e.interactionId,latency:e.duration,entries:[e]};$e.set(n.id,n),Xe.push(n)}Xe.sort((function(e,t){return t.latency-e.latency})),Xe.length>10&&Xe.splice(10).forEach((function(e){return $e.delete(e.id)}))}}},Qe=function(e){var t=self.requestIdleCallback||self.setTimeout,i=-1;return e=we(e),"hidden"===document.visibilityState?e():(i=t(e),De(e)),i},et=[200,500],tt=function(e,t){"PerformanceEventTiming"in self&&"interactionId"in PerformanceEventTiming.prototype&&(t=t||{},Ve((function(){var i;Ye();var n,r=Ne("INP"),o=function(e){Qe((function(){e.forEach(Ze);var t=function(){var e=Math.min(Xe.length-1,Math.floor((He()-Je)/50));return Xe[e]}();t&&t.latency!==r.value&&(r.value=t.latency,r.entries=t.entries,n())}))},a=Ae("event",o,{durationThreshold:null!==(i=t.durationThreshold)&&void 0!==i?i:40});n=Se(e,r,et,t.reportAllChanges),a&&(a.observe({type:"first-input",buffered:!0}),De((function(){o(a.takeRecords()),n(!0)})),Te((function(){Je=He(),Xe.length=0,$e.clear(),r=Ne("INP"),n=Se(e,r,et,t.reportAllChanges)})))})))},it=[],nt=[],rt=0,ot=new WeakMap,at=new Map,st=-1,ut=function(e){it=it.concat(e),lt()},lt=function(){st<0&&(st=Qe(ct))},ct=function(){at.size>10&&at.forEach((function(e,t){$e.has(t)||at.delete(t)}));var e=Xe.map((function(e){return ot.get(e.entries[0])})),t=nt.length-50;nt=nt.filter((function(i,n){return n>=t||e.includes(i)}));for(var i=new Set,n=0;nrt&&t>o||i.has(e)})),st=-1};We.push((function(e){e.interactionId&&e.target&&!at.has(e.interactionId)&&at.set(e.interactionId,e.target)}),(function(e){var t,i=e.startTime+e.duration;rt=Math.max(rt,e.processingEnd);for(var n=nt.length-1;n>=0;n--){var r=nt[n];if(Math.abs(i-r.renderTime)<=8){(t=r).startTime=Math.min(e.startTime,t.startTime),t.processingStart=Math.min(e.processingStart,t.processingStart),t.processingEnd=Math.max(e.processingEnd,t.processingEnd),t.entries.push(e);break}}t||(t={startTime:e.startTime,processingStart:e.processingStart,processingEnd:e.processingEnd,renderTime:i,entries:[e]},nt.push(t)),(e.interactionId||"first-input"===e.entryType)&&ot.set(e,t),lt()}));var dt=function(e,t){for(var i,n=[],r=0;i=it[r];r++)if(!(i.startTime+i.durationt)break;n.push(i)}return n},pt=[2500,4e3],ft={};new Date;const gt=({name:e,delta:t},i,n)=>{try{const r=`${n.data.sdkKey}:${i.experiment.key}:${e}`;if(!window.ikea.experiment.webvitals[r]&&(window.ikea.experiment.webvitals[r]=!0,n)){const r=`${i.experiment.id}_cwv_${e.toLowerCase()}`,o=["LCP","FCP"].includes(e)?t/1e3:t;n.hasEvent(r)&&n.track(r,{},{value:o})}}catch(e){}},ht=e=>e.addActivateEventListener((t=>{try{const i=`${e.data.sdkKey}:${t.experiment.key}:observer`;window.ikea.experiment.webvitals=window.ikea.experiment.webvitals||{},window.ikea.experiment.webvitals[i]||(window.ikea.experiment.webvitals[i]=!0,function(e,t){!function(e,t){t=t||{},je(we((function(){var i,n=Ne("CLS",0),r=0,o=[],a=function(e){e.forEach((function(e){if(!e.hadRecentInput){var t=o[0],i=o[o.length-1];r&&e.startTime-i.startTime<1e3&&e.startTime-t.startTime<5e3?(r+=e.value,o.push(e)):(r=e.value,o=[e])}})),r>n.value&&(n.value=r,n.entries=o,i())},s=Ae("layout-shift",a);s&&(i=Se(e,n,Be,t.reportAllChanges),De((function(){a(s.takeRecords()),i(!0)})),Te((function(){r=0,n=Ne("CLS",0),i=Se(e,n,Be,t.reportAllChanges),Le((function(){return i()}))})),setTimeout(i,0))})))}((function(t){var i=function(e){var t,i={};if(e.entries.length){var n=e.entries.reduce((function(e,t){return e&&e.value>t.value?e:t}));if(n&&n.sources&&n.sources.length){var r=(t=n.sources).find((function(e){return e.node&&1===e.node.nodeType}))||t[0];r&&(i={largestShiftTarget:_e(r.node),largestShiftTime:n.startTime,largestShiftValue:n.value,largestShiftSource:r,largestShiftEntry:n,loadState:Ie(n.startTime)})}}return Object.assign(e,{attribution:i})}(t);e(i)}),t)}((i=>gt(i,t,e))),function(e,t){je((function(t){var i=function(e){var t={timeToFirstByte:0,firstByteToFCP:e.value,loadState:Ie(be())};if(e.entries.length){var i=ye(),n=e.entries[e.entries.length-1];if(i){var r=i.activationStart||0,o=Math.max(0,i.responseStart-r);t={timeToFirstByte:o,firstByteToFCP:e.value-o,loadState:Ie(e.entries[0].startTime),navigationEntry:i,fcpEntry:n}}}return Object.assign(e,{attribution:t})}(t);e(i)}),t)}((i=>gt(i,t,e))),function(e,t){ve||(ve=Ae("long-animation-frame",ut)),tt((function(t){var i=function(e){var t=e.entries[0],i=ot.get(t),n=t.processingStart,r=i.processingEnd,o=i.entries.sort((function(e,t){return e.processingStart-t.processingStart})),a=dt(t.startTime,r),s=e.entries.find((function(e){return e.target})),u=s&&s.target||at.get(t.interactionId),l=[t.startTime+t.duration,r].concat(a.map((function(e){return e.startTime+e.duration}))),c=Math.max.apply(Math,l),d={interactionTarget:_e(u),interactionTargetElement:u,interactionType:t.name.startsWith("key")?"keyboard":"pointer",interactionTime:t.startTime,nextPaintTime:c,processedEventEntries:o,longAnimationFrameEntries:a,inputDelay:n-t.startTime,processingDuration:r-n,presentationDelay:Math.max(c-r,0),loadState:Ie(t.startTime)};return Object.assign(e,{attribution:d})}(t);e(i)}),t)}((i=>gt(i,t,e))),function(e,t){!function(e,t){t=t||{},Ve((function(){var i,n=Fe(),r=Ne("LCP"),o=function(e){t.reportAllChanges||(e=e.slice(-1)),e.forEach((function(e){e.startTimegt(i,t,e))))}catch(e){}}));window.__optimizely=n;const Et=12e4,vt={};let yt=[],It=[];const mt=e=>{if(vt[e])return vt[e].instance},_t=({timeout:e=Et}={})=>!isNaN(e)&&e>0&&!m(),Ot=async(e,t={},i={},n,r)=>new Promise(((a,s)=>{const u=e=>{"function"==typeof r?r(e):"function"!=typeof n&&s(e)};bt(e,t,i,(e=>{"function"==typeof n&&n(e),a(e)}),u);const{timeout:l=Et}=t;var c;_t(t)&&(c=l,Number.isFinite(c)&&c!==Number.MAX_SAFE_INTEGER&&c!==Number.MAX_VALUE)&&window.setTimeout((()=>u(new o.a(o.e))),l)})),bt=async(e,t={},i={},u,l)=>{if(!e)return void l(new Error("Please provide SDK key or Datafile or Optimizely instance!"));v(i);const c=N(e);if(c&&vt[c])return void u(vt[c]);if("string"==typeof e&&Object(O.a)(c),_t(t))return void yt.push({sdkKeyOrOptimizelyInstance:e,options:t,successCallbackFn:u,failedCallbackFn:l});if((({waitLoginStatus:e=!0}={})=>e)(t)&&!d())return void It.push({sdkKeyOrOptimizelyInstance:e,options:t,successCallbackFn:u,failedCallbackFn:l});try{_(!0)}catch(e){return void l(e)}const{ga:p=a.ga,gaCategory:f="",cs:g=a.cs,csCategory:h="",bounceRate:E=!0,exitRate:y=!0,statistic:I=!0,attributePrefix:m=""}=t;let{logLevel:T=n.enums.LOG_LEVEL.INFO}=t;const S=Object(b.c)();T=S.logLevel?S.logLevel:r.e?null:Object(b.b)(T);let L=t.userId;S.userId&&(L=S.userId),L||(L=Object(s.j)(!0));let D=null;if("string"==typeof e){let e;try{e=await Object(O.a)(c,!0)}catch(e){return void l(e)}if(!e)return void l(new o.a(o.d));D=R(e,{ga:p,cs:g,userId:L,gaCategory:f,csCategory:h,logLevel:T,attributePrefix:m})}else"object"==typeof e&&e.datafile?D=R(e.datafile,{ga:p,cs:g,userId:L,gaCategory:f,csCategory:h,logLevel:T,attributePrefix:m}):"object"==typeof e&&(D=((e,t={})=>{const i={sdkKey:N(e),experiments:[],events:[]};return e&&e.projectConfigManager&&e.projectConfigManager.configObj&&(i.experiments=(e.projectConfigManager.configObj.experiments||[]).filter((e=>!`${e.id}`.startsWith("default-rollout-"))),i.events=e.projectConfigManager.configObj.events||[]),new A(e,e._instanceUPS,i,t)})(e,{ga:p,cs:g,userId:L,gaCategory:f,csCategory:h,logLevel:T,attributePrefix:m}));D?(p&&((e,t,{logLevel:i}={})=>{e.addActivateEventListener((e=>x(t,e,{logLevel:i}))),e.options.gaCategory&&e.addTrackEventListener((t=>F(e.options.gaCategory,t,{logLevel:i})))})(D,p,{logLevel:T}),g&&((e,t,{logLevel:i}={})=>{e.addActivateEventListener((e=>G(t,e,{logLevel:i}))),e.options.csCategory&&e.addTrackEventListener((t=>K(e.options.csCategory,t,{logLevel:i})))})(D,g,{logLevel:T}),I&&(e=>{e.addActivateEventListener((t=>ee(e,t)))})(D),(E||y)&&(e=>{e.addActivateEventListener((t=>{const i=`${e.data.sdkKey}:${t.experiment.key}`;if(H)return Y(e,i);z[i]||(z[i]=e)}))})(D),ht(D),(e=>{ce.ptps&&e.data&&Array.isArray(e.data.events)&&e.data.events.find((e=>"pip_to_pip"===e.key))&&e.track("pip_to_pip")})(D),u(vt[c]=D)):l(new Error("Can't create the Optimizely Wrapper!"))};h((()=>({pip_to_pip_src:ce.ptps||""}))),((e,t)=>{e.ikea||(e.ikea={}),e.ikea.experiment||(e.ikea.optimizely=e.ikea.experiment={init:Ot,enums:{...n.enums,ERROR_CODES:o.b,DEFAULT_CALLBACK_FUNCTIONS:a},getInstance:mt,getUserId:()=>Object(s.j)(!1),setGlobalAttributes:v,getGlobalAttributes:E,addGlobalAttributesBuilder:h,getActiveExperiments:Z,logActiveExperiments:Q,webVitalsObserver:ht});let i=!1;const u=()=>{!i&&d()&&_()&&(i=!0,X(e.ikea.experiment),(({init:e})=>{r.e||!se&&ue.li&&(Object(s.l)(oe,{}),e(ae,{gaCategory:"customer_web",logLevel:0},{},(e=>{e.track("login_intent_started")}),(e=>{})))})(e.ikea.experiment),ne(e.ikea.experiment))},l=e=>{if(!d())return;for(const{sdkKeyOrOptimizelyInstance:e,options:t,successCallbackFn:i,failedCallbackFn:n}of It)bt(e,t,{},i,n);if(It=[],!m()||e.detail&&e.detail.showBanner)return;const t=()=>{for(const{sdkKeyOrOptimizelyInstance:e,options:t,successCallbackFn:i,failedCallbackFn:n}of yt)bt(e,t,{},i,n);yt=[],u()};_()?Object(s.j)()||!r.f?t():Object(s.m)((()=>!!Object(s.j)(!1)),t,t):t()};t.addEventListener("ikeaCookieConsent",l),t.addEventListener("_ikeaOptGloAttrReady",l),t.dispatchEvent(new Event("ikeaOptimizelyReady")),t.dispatchEvent(new Event("ikeaExperimentReady")),Object(s.m)((()=>ikea&&ikea.pubsub&&ikea.pubsub.publish),(()=>{ikea.pubsub.publish("EXPERIMENT/READY")})),u();try{_()&&Object(s.j)(!0)}catch(e){}})(window,document)}]);