"use strict";(self.webpackChunklib=self.webpackChunklib||[]).push([[6677],{717:function(e,t,n){n.d(t,{u:function(){return l}});var o=n(9961),r=n(1936),i=n(8053),s=n(5209);const a=window.fetch;function l(e){let{method:t,url:n,data:l,params:c,cache:u,contextID:g,keepalive:d,logData:p}=e;const m=new URL(n,n.includes("//")?void 0:o.Z.apiServerUrl);m.searchParams.set("h",LimeSpot.runtime.hash),new URLSearchParams(c).forEach(((e,t)=>m.searchParams.set(t,e))),u||m.searchParams.append("t",(new Date).getTime().toString());const f={method:t,headers:{"Content-Type":"application/json"},mode:"cors",body:l?JSON.stringify(l):null,keepalive:d},S=g||r.Z.getContextID()||s.ZP.getCookie("lsContextID");if(S)f.headers["X-Personalizer-Context-ID"]=S;else{if(p)try{m.searchParams.set("logData",JSON.stringify(p))}catch(e){}m.searchParams.set("uid",r.Z.getUserID()),m.searchParams.set("shop",i.G.params.shop),m.searchParams.set("state",i.G.state)}return a(m.toString(),f).then((e=>{const{status:t}=e;if(!e.ok)throw 401===t&&r.Z.invalidate(),e;return 204===t?e.text():e.json()}))}},3052:function(e,t,n){n.d(t,{ZP:function(){return U}});var o=n(9961),r=n(1936),i=n(2676),s=n(717),a=n(3966),l=n(5209),c=n(5768),u=n(5721),g=n(8053);const d="lsChannel";var p={call:function(e,t,n,o){i.ZP.initialize(d,`${g.G.publicPath}/storefront/channel/core.${g.G.hash}.html?key=${g.G.params.key}`,(()=>{i.ZP.call(d,e,t,n,o)}))}},m=n(1701),f=n(4944);const S="lsRuntime";function h(){return a.ZP.getLocalStorageValue(S)||g.G.guid}function C(){a.ZP.removeLocalStorageValue(S),g.G.guid=null}var x={log:function(e){let{contextID:t,error:n}=e;C()},getRuntimeGuid:h};const D="Auth",b=new c.L("auth");function L(e,t){let n=null,i=null,l=null,c=null,g=null;void 0!==LimeSpot.UserInfo&&(n=LimeSpot.UserInfo.Identifier,i=LimeSpot.UserInfo.Email,l=LimeSpot.UserInfo.CellPhone,c=LimeSpot.UserInfo.FirstName,g=LimeSpot.UserInfo.LastName);const d=I(n,i,l,c,g),p=a.ZP.getLocalStorageObject("lsContext");if(p)!function(e,t,n,i){if(t.BypassExperienceCache)return m.Z.logDebug(D,"Cached Context processing bypassed due to BypassExperienceCache param."),void n(!1);if("1"===o.Z.getUrlParam("lsForceExperienceReload"))return m.Z.logDebug(D,"Cached Context processing bypassed due to lsForceExperienceReload URL param."),void n(!1);if(r.Z.isExpired())return m.Z.logDebug(D,"Cached Context processing bypassed due expired context."),void n(!1);if(JSON.stringify(v())!==JSON.stringify(t))return m.Z.logDebug(D,"Cached Context processing bypassed due to auth params inconsistency."),m.Z.logDebug(D,"Current auth params:",v()),m.Z.logDebug(D,"Cached auth params:",JSON.stringify(t)),void n(!1);const l=a.ZP.getLocalStorageObject("lsAuthResult");if(!l||!e)return m.Z.logDebug(D,"Cached Context processing bypassed due to auth params inconsistency."),void n(!1);m.Z.logDebug(D,`Cached Context valid on Local Storage. Bypassing authentication and performing context renewal for ${e.ContextID}`),e.Experiences=l.Experiences,LimeSpot.Context=e,Z(t.UserIdentifier,t.UserEmailAddress,t.UserCellPhone,t.UserFirstName,t.UserLastName,l,n),r.Z.setAuthEventDetails({NewSession:!1}),(0,s.u)({method:"PUT",url:"/v1/userAuthentication",cache:!1,contextID:e.ContextID}).then((e=>{m.Z.logDebug(D,"Cached Context renewed.",t),i&&i(),P(e.ContextExpirationTimeStamp),u.Z.update({userSegmentGuids:e.UserSegmentGuids})})).catch((e=>{r.Z.invalidate(),m.Z.logDebug(D,"Context renewal failed.",e),n(!1),i&&i()}))}(p,d,(t=>{if(t)return m.Z.logDebug(D,"Using cached context.",d),void e(!0);m.Z.logDebug(D,"Enforcing normal authentication."),r.Z.invalidate(),L(e)}),t);else{if(m.Z.logDebug(D,"Starting Authentication...",d),!d.ExperienceGuid&&p&&f.ZP.getModule("Recommendations",p).Guid){const e=f.ZP.getModule("Recommendations",p).Guid;m.Z.logDebug(D,"Enforcing previously assigned ExperienceGuid:",e),d.ExperienceGuid=e}(0,s.u)({method:"POST",url:"/v1/userAuthentication?storefront=true",data:{...d,StorefrontRuntimeGuid:x.getRuntimeGuid()},cache:!1}).then((o=>{if(!o)return x.log({error:"NullResponse"}),e&&e(!1),void(t&&t());const s=o.ContextID;var a;x.log({contextID:s}),a=o,LimeSpot.Context={...a},P(a.ContextExpirationTimeStamp),o&&o.UserSegmentGuids&&u.Z.update({userSegmentGuids:o.UserSegmentGuids}),Z(n,i,l,c,g,o,e),t&&t(),r.Z.setAuthEventDetails({NewSession:!0})})).catch((e=>{e&&e instanceof Response&&(e.json().then((t=>{m.Z.logDebug(D,"Authentication failed.",t);let n="";try{const e=JSON.parse(t.MessageDetail).TraceID;e&&(n=` [${e}]`)}catch(e){}x.log({error:`${e.status}${n}: ${t.Message}`}),403===e.status&&(m.Z.logDebug(D,"Disabling LimeSpot on the machine for the session."),a.ZP.setSessionStorageValue("lsDisabled","1"))})),t&&t())}))}}function Z(e,t,n,o,r,s,c){const u=(s.Experiences||[]).map((e=>`${e.Module}: ${e.Guid}`)).join(",");m.Z.logDebug(D,`Applying context details: UserID[${s.UserID}], ContextID[${s.ContextID}],\n CampaignGuid[${s.CampaignGuid}], CampaignEntryGuid[${s.CampaignEntryGuid}],\n Experiences[${u}]`),l.ZP.setCookie("lsContextID",s.ContextID),a.ZP.setLocalStorageValue("lsUserID",s.UserID),a.ZP.setSessionStorageValue("lsCampaignGuid",s.CampaignGuid,!0),a.ZP.setSessionStorageValue("lsCampaignEntryGuid",s.CampaignEntryGuid,!0);w(I(e,t,n,o,r)),a.ZP.setLocalStorageObject("lsAuthResult",s);const g=JSON.parse(JSON.stringify(LimeSpot.Context));(g.Experiences||[]).forEach((e=>delete e.Settings)),a.ZP.setLocalStorageObject("lsContext",g),LimeSpot.Context.Experiences=s.Experiences,f.ZP.getModule("Recommendations")||f.ZP.setModule("Recommendations",{BoxOptions:null,CustomCss:null,CustomJavaScript:null}),i.ZP.syncContext(),c&&c(!0)}function P(e){m.Z.logDebug(D,"Context Expiration set to: "+new Date(e)),a.ZP.setLocalStorageValue("lsContextExpires",e)}function I(e,t,n,r,i){const s=o.Z.getLandingDetails();let c=null,u=null;s&&(c=+s.UserID||null,u=s.ContextID||null,u&&l.ZP.setCookie("lsContextID",u));const d=+a.ZP.getLocalStorageValue("lsUserID")||null;let p=null,m=null;return d&&c&&+d!=+c?(p=d,m=c):p=d||c||null,{SubscriberKey:g.G.params.key,ContextID:l.ZP.getCookie("lsContextID"),UserID:p,AlternateUserID:m,ExperienceGuid:o.Z.getUrlParam("lsExperienceGuid"),ExperiencePreview:!!o.Z.getUrlParam("lsExperiencePreview")||null,LandingDetails:s,UserIdentifier:e||null,UserEmailAddress:t||null,UserCellPhone:n||null,UserFirstName:r||null,UserLastName:i||null,BypassExperienceCache:"true"===a.ZP.getLocalStorageValue("lsBypassCache")}}function v(){return a.ZP.getLocalStorageObject("lsAuthParams")}function w(e){a.ZP.setLocalStorageObject("lsAuthParams",e)}var U={authenticate:function(e){if("1"===a.ZP.getSessionStorageValue("lsDisabled"))return m.Z.logDebug(D,"Authentication bypassed due to lsDisabled cookie."),void e(!1);const t=setInterval((()=>{b.acquire()?(L(e,(()=>{b.release()})),window.clearInterval(t)):m.Z.logDebug(D,"Authentication delayed due to semaphore lock.")}),100)},syncChannelUserID:function(){p.call("SyncUserID",{UserID:LimeSpot.Context.UserID,EncUserID:LimeSpot.Context.EncUserID,SubscriberKey:g.G.params.key,PageInfo:LimeSpot.PageInfo},(e=>{e?function(e,t){if(LimeSpot.Context.UserID===e)return void m.Z.logDebug(D,`Replacing context UserID bypassed because the same user was provided: ${e}`);m.Z.logDebug(D,`Replacing context UserID ${LimeSpot.Context.UserID} with existing ${e}`),LimeSpot.Context.UserID=e,LimeSpot.Context.EncUserID=t,i.ZP.syncContext(),a.ZP.setLocalStorageValue("lsUserID",e);const n=v();n.UserID=e,w(n);const o=a.ZP.getLocalStorageObject("lsAuthResult");o.UserID=e,o.EncUserID=t,a.ZP.setLocalStorageObject("lsAuthResult",o);const r=a.ZP.getLocalStorageObject("lsContext");r.UserID=e,r.EncUserID=t,a.ZP.setLocalStorageObject("lsContext",r)}(e.UserID,e.EncUserID):m.Z.logDebug(D,"UserID valid with Channel.")}))}}},2676:function(e,t,n){var o=n(9961),r=n(1701);const i={},s="Channel";function a(e){r.Z.logDebug(s,"syncContext("+e+");",LimeSpot.Context),document.querySelectorAll(void 0===e?"iframe[data-owner='LimeSpot']":"#"+e).forEach((e=>{e.contentWindow.postMessage(JSON.stringify({Owner:"LimeSpot",Target:"*",Command:"SyncContext",Context:LimeSpot.Context,ApiServerUrl:o.Z.apiServerUrl}),"*")}))}window.addEventListener("message",(e=>{if(null==e||null==e.data||void 0===e.data||"function"!=typeof e.data.indexOf)return;if(e.data.indexOf("LimeSpot")<0)return;const t=JSON.parse(e.data);if("*"!==t.Target)"Storefront"===t.Target&&i[t.CallbackID]&&(r.Z.logDebug(s,`Callback [${t.CallbackID}].`,t.Result),i[t.CallbackID](t.Result),i[t.CallbackID]=null);else if("SyncContext"===t.Command)LimeSpot.Context=t.Context,a()}),!1),t.ZP={syncContext:a,initialize:function(e,t,n,o){r.Z.logDebug(s,`[${e}] initializing...`),t+=(-1===t.indexOf("?")?"?":"&")+"channelID="+e;const i=document.querySelector("iframe[src='"+t+"']");if(i){const t=setInterval((()=>{r.Z.logDebug(s,`[${e}] frame exists, waiting to initialize.`),"1"===i.dataset.initialized&&(clearInterval(t),r.Z.logDebug(s,`[${e}] already initialized.`),n&&n())}),10)}else void 0===o?((o=document.createElement("iframe")).id=e,o.style.display="none",document.body.insertBefore(o,document.body.children[0])):""!==o.id&&void 0!==o.id||(o.id=e),o.addEventListener("load",(t=>{a(e),r.Z.logDebug(s,`[${e}] initialized.`),"1"!==t.target.dataset.initialized?(t.target.dataset.initialized="1",n&&n()):n&&n()})),o.setAttribute("src",t),o.dataset.owner="LimeSpot"},call:function(e,t,n,a,l){if(!e)return void console.error("Target channel unspecified.");const c=document.getElementById(e);if(!c)return void console.error("Channel not initialized.");const u={Owner:"LimeSpot",Method:t,Params:n,Target:e,Source:"Storefront"};a&&(u.SuccessCallbackID=Math.random().toString(36).substr(2,10),i[u.SuccessCallbackID]=a),l&&(u.ErrorCallbackID=Math.random().toString(36).substr(2,10),i[u.ErrorCallbackID]=l);const g=o.Z.scriptHostUrl||"*";r.Z.logDebug(s,`[${e}] calling.`,u),c.contentWindow.postMessage(JSON.stringify(u),g)}}},1936:function(e,t,n){var o=n(3966),r=n(2676),i=n(1701);const s="Context";let a;t.Z={getContextID:function(){return window.LimeSpot&&window.LimeSpot.Context&&window.LimeSpot.Context.ContextID||null},getUserID:function(){return window.LimeSpot&&window.LimeSpot.Context&&window.LimeSpot.Context.UserID||null},invalidate:function(){o.ZP.setLocalStorageObject("lsAuthResult",null),o.ZP.setLocalStorageObject("lsContext",null),LimeSpot.Context=null,r.ZP.syncContext(),i.Z.logDebug(s,"Context cache invalidated")},isExpired:function(){const e=parseFloat(o.ZP.getLocalStorageValue("lsContextExpires")),t=e<=(new Date).getTime();return i.Z.logDebug(s,`Cached Context expiry: ${new Date(e)} - Expired: ${t}`),t},setAuthEventDetails:function(e){a=e},getAuthEventDetails:function(){return a}}},3094:function(e,t,n){n.d(t,{U:function(){return i}});var o=n(9961),r=n(3052);function i(e){o.Z.processUrlParams(),r.ZP.authenticate((t=>{e(t)}))}},6517:function(e,t,n){var o=n(3094);const r=()=>(0,o.U)((async()=>{(await Promise.all([n.e(989),n.e(4574),n.e(5510),n.e(3271),n.e(6927),n.e(970)]).then(n.bind(n,6927))).default.init(),Promise.all([n.e(989),n.e(4574),n.e(5510),n.e(3271),n.e(1027)]).then(n.bind(n,855)).then((e=>e.default.init())),Promise.all([n.e(989),n.e(4574),n.e(3271),n.e(8057)]).then(n.bind(n,8057)).then((e=>e.default.init()))}));LimeSpot.DisableAutoInitialize||r(),window.LimeSpot={...window.LimeSpot,Storefront:{...window.LimeSpot.Storefront,Initialize:r}}},9961:function(e,t,n){var o=n(6031),r=n(3966),i=n(8053);const s=i.G.publicPath,a=`${s}/storefront`,l=i.G.apiBase,c={},u={title:i.G.platform},g=[],d=[];function p(e,t,n){if(c[e])return c[e];void 0===n&&(n=location.search);const o=new RegExp("[?&]"+encodeURIComponent(e)+"=([^&]*)").exec(n);if(o){const n=decodeURIComponent(o[1]);return null!=n&&!0===t&&m(e,n),n}}function m(e,t){void 0===t&&(t=p(e));let n=e+"="+encodeURIComponent(t);window.location.href.includes("?"+n+"&")?n+="&":n=window.location.href.includes("?"+n)?"?"+n:"&"+n,window.history.replaceState({},window.document.title,window.location.href.replace(n,""))}function f(){let e=document.referrer.replace(/https?:\/\//g,"");!e.startsWith(location.hostname)&&e||(e=void 0);const t={};return Array.from(new URLSearchParams(location.search)).forEach((e=>{d.includes(e[0])||(t[e[0]]=g.includes(e[0].toLowerCase())?"*":e[1])})),{PageUrl:`${location.hostname}${location.pathname}`,Referrer:e,UrlParams:Object.keys(t).length>0?t:void 0}}function S(){return/[\-]{3}.*limespot\.app.*/.test(location.href)}g.push(...["fbclid","gclid","awc","smile_ref","epik","WickedID","cjevent","cjdata","_sid","_pos","_ke"].map((e=>e.toLowerCase()))),d.push(...["variant",...o.Vn].map((e=>e.toLowerCase()))),S()&&r.ZP.setSessionStorageValue("lsDesigner","true"),t.Z={scriptHostUrl:s,scriptRootUrl:a,apiServerUrl:l,urlParams:c,platform:u,getUrlParam:p,removeUrlParam:m,processUrlParams:function(){for(const e of Object.keys(c))delete c[e];const e=o.Vn;for(let t=0;t{let{userSegmentGuids:t}=e;const n=o.ZP.getSessionStorageObject(i)||[];LimeSpot.Context.UserSegmentGuids=(t||[]).concat(n),o.ZP.setLocalStorageObject("lsContext",LimeSpot.Context),s.next(LimeSpot.Context.UserSegmentGuids)},userSegmentGuids:s,setEnforcedUserSegmentGuids:e=>{o.ZP.setSessionStorageObject(i,e||[])}}},1031:function(e,t,n){n.d(t,{X:function(){return o}});class o{constructor(e){this.value=e,this.observers=[]}subscribe(e){this.observers.push(e),e(this.value)}unsubscribe(e){this.observers=this.observers.filter((t=>t!==e))}next(e){this.value=e,this.observers.forEach((t=>t(e)))}getValue(){return this.value}}},3966:function(e,t,n){n.d(t,{I:function(){return u},_o:function(){return c},jy:function(){return s},uN:function(){return i},v8:function(){return l}});var o=n(5209);function r(){try{return"object"==typeof window.localStorage&&"function"==typeof window.localStorage.getItem}catch(e){return!1}}function i(e,t,n){!n||t?r()?localStorage.setItem(e,t):(0,o.d8)(e,t):u(e)}function s(e,t){let n=null;return n=r()?localStorage.getItem(e):(0,o.ej)(e),t&&n&&u(e),n}function a(e){let t=null;return t=r()?sessionStorage.getItem(e):(0,o.ej)(e),t}function l(e,t,n){!n||t?r()?sessionStorage.setItem(e,t):(0,o.d8)(e,t):c(e)}function c(e){return r()?sessionStorage.removeItem(e):(0,o.nJ)(e)}function u(e){return r()?localStorage.removeItem(e):(0,o.nJ)(e)}t.ZP={isLocalStorageSupported:r,setLocalStorageValue:i,getLocalStorageValue:s,setLocalStorageObject:function(e,t){if(t){i(e,JSON.stringify(t))}else u(e)},getLocalStorageObject:function(e,t){const n=s(e,t);if(!n)return null;try{return JSON.parse(n)}catch(e){return console.error(e),null}},removeLocalStorageValue:u,setSessionStorageValue:l,getSessionStorageValue:a,setSessionStorageObject:function(e,t){if(t){l(e,JSON.stringify(t))}else c(e)},getSessionStorageObject:function(e,t){const n=a(e);if(!n)return null;try{return JSON.parse(n)}catch(e){return console.error(e),null}},removeSessionStorageValue:c}},5209:function(e,t,n){function o(e,t,n,o){const r=new Date;r.setDate(r.getDate()+n);let i=escape(t)+(null==n||void 0===n?"":"; expires="+r.toUTCString());i+="; Path=/; SameSite=None; Secure",o&&(i+="; Domain="+o),document.cookie=e+"="+i}function r(e){let t,n,o;const r=document.cookie.split(";");for(t=0;tt.Module.toLowerCase()===e.toLowerCase()));return n&&n.Settings?n:{Settings:{}}}function r(e,t){LimeSpot.Context=LimeSpot.Context||{},LimeSpot.Context.Experiences=LimeSpot.Context.Experiences||[];let n=LimeSpot.Context.Experiences.find((t=>t.Module===e));n?(n.Settings=n.Settings||{},Object.assign(n.Settings,t)):(n={Module:e,Settings:t},LimeSpot.Context.Experiences.push(n))}n.d(t,{IY:function(){return r},rT:function(){return o}}),t.ZP={getModule:o,setModule:r}},5768:function(e,t,n){n.d(t,{L:function(){return s}});var o=n(5209),r=n(1701);const i="Semaphore";function s(e,t){t=t||5e3,this.acquire=()=>{const n=o.ZP.getCookie(a());return+n?Date.now()-parseInt(n,10){o.ZP.setCookie(a(),""),r.Z.logDebug(i,`Released: ${e}`)}}function a(){return"lsSema-"+name}}},function(e){var t;t=6517,e(e.s=t)}]);