"use strict";(self.webpackChunkui=self.webpackChunkui||[]).push([[9],{42:function(t,e,n){var i=this&&this.__awaiter||function(t,e,n,i){return new(n||(n=Promise))((function(a,o){function r(t){try{l(i.next(t))}catch(t){o(t)}}function c(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?a(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(r,c)}l((i=i.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.initLogicOnClientSideStateRelated=e.initLogicOnClientSide=e.getLinkerParam=e.setCartTokenCookieForNativeShopifyFeatures=e.setCartTotalCookie=e.setCartQuantityCookie=e.setVariantParamInQueryStringWithHandle=e.setVariantParamInQueryString=e.initAttentionMessageTitle=e.initWeLoveYouTitle=e.changeVariantSideEffects=e.getInitialVariant=void 0;const a=n(35),o=n(5),r=n(95);let c;function l(t){var e;if("undefined"==typeof document)return;const n=document.title;let i=null,a=null!==(e=null==t?void 0:t.default)&&void 0!==e?e:"We miss you ❤",r=0;document.addEventListener("visibilitychange",(function(){var e;const c=!document.hidden,l=(0,o.getAssignment)("pageTabTitle");l&&t[l]&&(a=null!==(e=t[l])&&void 0!==e?e:"We miss you ❤"),c?(r>0&&(0,o.logOutcome)("returnToHiddenPage"),document.title=n,i&&clearInterval(i)):(i=setInterval((function(){document.title===a?document.title=n:document.title=a}),2e3),r++)}))}function u(t){if("undefined"!=typeof window&&"URLSearchParams"in window){const e=new URLSearchParams(window.location.search);window.location.pathname.includes("products")&&(e.set("variant",t),history.pushState(null,"",`${window.location.pathname}?${e.toString()}`))}}e.getInitialVariant=function(t,e){var n,i,a,o;const r=null!==(n=e[0])&&void 0!==n?n:{id:"",price:"",compareAtPrice:"",title:"",availableForSale:!1,quantityAvailable:0,currentlyNotInStock:!1,image:{src:"",alt:""},sellingPlan:{id:0,mode:"",pct:0},sku:"",priceCurrency:"USD",selectedOptions:[],colorId:"",cartImage:{src:"",alt:""},mediaContentCarousel:{images:[]},shippingDate:"",shippingOffset:0,specialEdition:"",allowedCountries:[],restrictedCountries:[],nutritionFactsTile:{heading:"",text:"",media:{src:"",alt:"",type:""}},description:"",bannerText:"",hideVariant:!1,quantityOption:{title:"",quantity:""},outOfStock:!1,colorData:{swatch_src:"",swatch_hex:""},bundle:null,onSale:!1,heroImages:[],pdpDescriptionSection_variant:"",nutritionFactsImage:{src:"",alt:""}};function c(t){var n,i;const a=e.findIndex((e=>e.id===t));if(-1===a){const t={initialCurrentVariantIndex:0,initialVariant:r};return u(null!==(i=null===(n=null==t?void 0:t.initialVariant)||void 0===n?void 0:n.id)&&void 0!==i?i:""),t}return{initialCurrentVariantIndex:a,initialVariant:e[a]}}if("undefined"==typeof window)return c(t);if(!("URLSearchParams"in window))return c(t);const l=new URLSearchParams(window.location.search).get("variant")||t,d=c(l);return 0===d.initialCurrentVariantIndex&&l!==(null===(i=null==d?void 0:d.initialVariant)||void 0===i?void 0:i.id)||u(null!==(o=null===(a=null==d?void 0:d.initialVariant)||void 0===a?void 0:a.id)&&void 0!==o?o:""),d},e.changeVariantSideEffects=function(t,e){var n,i;e.colorId.includes("lisa-frank")?null===(n=document.querySelector(".app"))||void 0===n||n.classList.add("lisa-frank"):null===(i=document.querySelector(".app"))||void 0===i||i.classList.remove("lisa-frank"),clearTimeout(c),c=setTimeout((()=>{a.outsmartlyDataLayer.push({event:"VIEW_PRODUCT",payload:{product:t,variant:e}}),u(e.id)}),500)},e.initWeLoveYouTitle=function(){if("undefined"==typeof document)return;const t=document.title,e="We miss you ❤";let n=null;document.addEventListener("visibilitychange",(function(){document.hidden?n=setInterval((function(){document.title===e?document.title=t:document.title=e}),2e3):(document.title=t,n&&clearInterval(n))}))},e.initAttentionMessageTitle=l,e.setVariantParamInQueryString=u,e.setVariantParamInQueryStringWithHandle=function(t,e){if("undefined"!=typeof window&&"URLSearchParams"in window){var n=new URLSearchParams(window.location.search);window.location.pathname.includes("products")&&(n.set("variant",t),history.pushState(null,"",`/products/${e}?${n.toString()}`))}},e.setCartQuantityCookie=function(t){document.cookie=`cart_quantity=${t}; expires=Tue, 19 Jan 2038 03:14:07 UTC`},e.setCartTotalCookie=function(t,e){document.cookie=`cart_total=${t}*display${e}; expires=Tue, 19 Jan 2038 03:14:07 UTC; path=/`},e.setCartTokenCookieForNativeShopifyFeatures=function(t){document.cookie=`cart=${t}; expires=Tue, 19 Jan 2038 03:14:07 UTC`},e.getLinkerParam=function(){return new Promise(((t,e)=>{if("undefined"==typeof window)return t("");const{ga:n}=window;if(void 0===n)return t("");const i=()=>n.getAll().forEach((e=>t(e.get("linkerParam").replace("_ga=",""))));if(n.loaded)i();else{const t=setInterval((()=>{n.loaded&&(clearInterval(t),i())}),1e3)}}))},e.initLogicOnClientSide=function(t,e){var n;return i(this,void 0,void 0,(function*(){const{product:i,pageTabTitlesData:o}=t;if(l(o),"undefined"!=typeof window)if(a.outsmartlyDataLayer.push({event:"PAGE_VIEW",payload:{url:window.location.href}}),window.location.pathname.includes("products"))a.outsmartlyDataLayer.push({event:"VIEW_PRODUCT",payload:{product:i,variant:e}});else{yield(0,r.initBentoAnalytics)({elevar:!0});const e=null===(n=t.optionalProducts)||void 0===n?void 0:n.optionalProductsData;(e?Object.values(e).flat():[]).map((t=>{const e=t.product,n=t.variant;return{id:e.id,title:e.title,description:"",handle:e.handle,vendor:e.vendor,price:n.price,quantity:t.quantity,productType:e.productType,compareAtPrice:n.compareAtPrice}})),window.location.pathname}}))},e.initLogicOnClientSideStateRelated=function(t,e){if("undefined"!=typeof window){const{searchParams:n}=new URL(window.location.href),i=n.get("discount");i&&setTimeout((()=>{t({newCheckout:Object.assign(Object.assign({},e().newCheckout),{discount:i})})}),100),window.location.search.includes("cart=true")&&setTimeout((()=>{e().setShowCart(!0)}),100)}}}}]);