const cartChangeEvent=new Event("cartChange",{bubbles:!0}),eventNames={ADD_ITEM:"cart:addItem",REMOVE_ITEM:"cart:removeItem",UPDATE_ITEM_QUANTITY:"cart:updateItemQuantity",OPEN_CART:"cart:open",CART_DATA_UPDATED:"cart:dataUpdated"};window.__cartIsOpen=!1;const allFabrics=window.allFabrics.split(",");document.addEventListener("keyup",e=>{e.keyCode===9&&(document.querySelector("body").classList.remove("no-focus-outline"),document.querySelector("body").classList.add("focus-outline"))}),document.addEventListener("click",e=>{!e.target.classList.contains("product-circle-radio-label")&&!e.target.classList.contains("hidden-radio")&&!e.target.classList.contains("product-radio-label")&&!e.target.classList.contains("desktop-search-close")&&!e.target.classList.contains("desktop-search-container-content")&&(document.querySelector("body").classList.add("no-focus-outline"),document.querySelector("body").classList.remove("focus-outline"))}),window.handleize=str=>str?str.toLowerCase().replace(/[^\w\u00C0-\u024f]+/g,"-").replace(/^-+|-+$/g,""):null;const closePersonalizationModal=()=>{const close=document.querySelector(".modal-close");close&&close.click()};window.closePersonalizationModal=closePersonalizationModal;const scrollBehavior=CSS.supports("scroll-behavior: smooth");let isMobile=window.matchMedia("(max-width: 768px)");function polyfill(){const w=window,d=document;if("scrollBehavior"in d.documentElement.style&&w.__forceSmoothScrollPolyfill__!==!0)return;const Element=w.HTMLElement||w.Element,SCROLL_TIME=400,original={scroll:w.scroll||w.scrollTo,scrollBy:w.scrollBy,elementScroll:Element.prototype.scroll||scrollElement,scrollIntoView:Element.prototype.scrollIntoView},now=w.performance&&w.performance.now?w.performance.now.bind(w.performance):Date.now;function isMicrosoftBrowser(userAgent){const userAgentPatterns=["MSIE ","Trident/","Edge/"];return new RegExp(userAgentPatterns.join("|")).test(userAgent)}const ROUNDING_TOLERANCE=isMicrosoftBrowser(w.navigator.userAgent)?1:0;function scrollElement(x,y){this.scrollLeft=x,this.scrollTop=y}function ease(k){return .5*(1-Math.cos(Math.PI*k))}function shouldBailOut(firstArg){if(firstArg===null||typeof firstArg!="object"||firstArg.behavior===void 0||firstArg.behavior==="auto"||firstArg.behavior==="instant")return!0;if(typeof firstArg=="object"&&firstArg.behavior==="smooth")return!1;throw new TypeError(`behavior member of ScrollOptions ${firstArg.behavior} is not a valid value for enumeration ScrollBehavior.`)}function hasScrollableSpace(el,axis){if(axis==="Y")return el.clientHeight+ROUNDING_TOLERANCE1?1:elapsed,value=ease(elapsed),currentX=context.startX+(context.x-context.startX)*value,currentY=context.startY+(context.y-context.startY)*value,context.method.call(context.scrollable,currentX,currentY),(currentX!==context.x||currentY!==context.y)&&w.requestAnimationFrame(step.bind(w,context))}function smoothScroll(el,x,y){let scrollable,startX,startY,method;const startTime=now();el===d.body?(scrollable=w,startX=w.scrollX||w.pageXOffset,startY=w.scrollY||w.pageYOffset,method=original.scroll):(scrollable=el,startX=el.scrollLeft,startY=el.scrollTop,method=scrollElement),step({scrollable,method,startTime,startX,startY,x,y})}w.scroll=w.scrollTo=function(){if(arguments[0]!==void 0){if(shouldBailOut(arguments[0])===!0){original.scroll.call(w,arguments[0].left!==void 0?arguments[0].left:typeof arguments[0]!="object"?arguments[0]:w.scrollX||w.pageXOffset,arguments[0].top!==void 0?arguments[0].top:arguments[1]!==void 0?arguments[1]:w.scrollY||w.pageYOffset);return}smoothScroll.call(w,d.body,arguments[0].left!==void 0?~~arguments[0].left:w.scrollX||w.pageXOffset,arguments[0].top!==void 0?~~arguments[0].top:w.scrollY||w.pageYOffset)}},w.scrollBy=function(){if(arguments[0]!==void 0){if(shouldBailOut(arguments[0])){original.scrollBy.call(w,arguments[0].left!==void 0?arguments[0].left:typeof arguments[0]!="object"?arguments[0]:0,arguments[0].top!==void 0?arguments[0].top:arguments[1]!==void 0?arguments[1]:0);return}smoothScroll.call(w,d.body,~~arguments[0].left+(w.scrollX||w.pageXOffset),~~arguments[0].top+(w.scrollY||w.pageYOffset))}},Element.prototype.scroll=Element.prototype.scrollTo=function(){if(arguments[0]===void 0)return;if(shouldBailOut(arguments[0])===!0){if(typeof arguments[0]=="number"&&arguments[1]===void 0)throw new SyntaxError("Value could not be converted");original.elementScroll.call(this,arguments[0].left!==void 0?~~arguments[0].left:typeof arguments[0]!="object"?~~arguments[0]:this.scrollLeft,arguments[0].top!==void 0?~~arguments[0].top:arguments[1]!==void 0?~~arguments[1]:this.scrollTop);return}const{left}=arguments[0],{top}=arguments[0];smoothScroll.call(this,this,typeof left>"u"?this.scrollLeft:~~left,typeof top>"u"?this.scrollTop:~~top)},Element.prototype.scrollBy=function(){if(arguments[0]!==void 0){if(shouldBailOut(arguments[0])===!0){original.elementScroll.call(this,arguments[0].left!==void 0?~~arguments[0].left+this.scrollLeft:~~arguments[0]+this.scrollLeft,arguments[0].top!==void 0?~~arguments[0].top+this.scrollTop:~~arguments[1]+this.scrollTop);return}this.scroll({left:~~arguments[0].left+this.scrollLeft,top:~~arguments[0].top+this.scrollTop,behavior:arguments[0].behavior})}},Element.prototype.scrollIntoView=function(){if(shouldBailOut(arguments[0])===!0){original.scrollIntoView.call(this,arguments[0]===void 0?!0:arguments[0]);return}const scrollableParent=findScrollableParent(this),parentRects=scrollableParent.getBoundingClientRect(),clientRects=this.getBoundingClientRect();scrollableParent!==d.body?(smoothScroll.call(this,scrollableParent,scrollableParent.scrollLeft+clientRects.left-parentRects.left,scrollableParent.scrollTop+clientRects.top-parentRects.top),w.getComputedStyle(scrollableParent).position!=="fixed"&&w.scrollBy({left:parentRects.left,top:parentRects.top,behavior:"smooth"})):w.scrollBy({left:clientRects.left,top:clientRects.top,behavior:"smooth"})}}typeof exports=="object"&&typeof module<"u"?module.exports={polyfill}:polyfill();const onDesktop=matchMedia("(pointer:fine)").matches;window.enterEvent=e=>{e.repeat&&e.preventDefault();const item=e.target;(e.keyCode===13||e.keyCode===32)&&(e.preventDefault(),item.click())};const updateSwatchMessaging=cart=>{if(cart&&cart.items!==void 0&&cart.items!==null){const swatchTrioMessage=document.getElementById("swatch-trio-message");swatchTrioMessage&&cart.items.some(item=>item.product_type==="Swatch")===!1&&swatchTrioMessage.classList.add("hidden")}};window.addEventListener(eventNames.OPEN_CART,()=>{window.location.pathname.includes("/cart")||window.__cartIsOpen||openDrawer(document.getElementById("cart-button").dataset.drawer)}),window.addEventListener(eventNames.CART_DATA_UPDATED,({detail})=>{const{cart}=detail;if(detail.action==="add"&&detail.data){const{addToCartResponse,klaviyoProduct}=detail.data;cartSuccess(addToCartResponse,cart,klaviyoProduct),window.cart=cart}setTimeout(()=>{buildMiniCart(cart),updateSwatchMessaging(cart),window.dispatchEvent(new CustomEvent(eventNames.OPEN_CART))},10)});const removeItemFromAjaxCart=async(variantId,item,e)=>{const isRemove=e.currentTarget.classList.contains("ajax-remove");isRemove&&(item.quantity=0);const{key}=item;return await fetch("/cart/change.js",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(item)}).then(res=>res.json()).then(response=>{if(localStorage.atc_attribution){const attribution=JSON.parse(localStorage.atc_attribution);attribution[key]&&delete attribution[key],localStorage.atc_attribution=JSON.stringify(attribution)}if(e.target.dispatchEvent(cartChangeEvent),isRemove){const cartAddItemEvent=new CustomEvent(eventNames.REMOVE_ITEM,{detail:{data:{...item,variantId,cart:response}}});window.dispatchEvent(cartAddItemEvent)}return window.cart=response,response}).catch(error2=>{console.error("Error:",error2)})},changeCartQuantityWithKey=e=>{const line=e.currentTarget,{key,variantId}=line.dataset;let quantity=line.value;isNaN(quantity)&&(quantity=1,line.value=1);const item={id:key,quantity,variantId};return window.removeFromStorefrontCart(item)},incrementLineQuantity=e=>{const button=e.currentTarget;return window.updateCartLine(button)},reloadCartFunctions=()=>{document.querySelectorAll(".ajax-remove").forEach(remover=>{remover.addEventListener("click",changeCartQuantityWithKey),remover.addEventListener("keydown",enterEvent)}),document.querySelectorAll(".ajax-change-quantity").forEach(changer=>{changer.addEventListener("change",changeCartQuantityWithKey)}),document.querySelectorAll(".mini-cart-incrementor").forEach(incrementor=>{incrementor.addEventListener("click",incrementLineQuantity),incrementor.addEventListener("keydown",enterEvent)})};window.reloadCartFunctions=reloadCartFunctions;const checkForSwatchBuyer=cart=>{const mainHeader=document.getElementById("header"),blogHeader=document.getElementById("birdy-edit-header"),customerTags=mainHeader?mainHeader.dataset.customertags:blogHeader.dataset.customertags,maxSwatches=Number(window.maxSwatchesForDiscount),isOverMaxSwatchLimit=(cart2,maxSwatch)=>cart2.items&&cart2.items.length<=0?void 0:cart2.items.filter(item=>item.product_type.includes("Swatch")).reduce((total,item)=>total+item.quantity,0)>maxSwatch;return!(customerTags!==null&&customerTags.includes("swatch-buyer")||isOverMaxSwatchLimit(cart,maxSwatches))},shuffle=array=>{let currentIndex=array.length,randomIndex;for(;currentIndex!=0;)randomIndex=Math.floor(Math.random()*currentIndex),currentIndex--,[array[currentIndex],array[randomIndex]]=[array[randomIndex],array[currentIndex]];return array},throttleAddToCart=throttle((...args)=>{window.addToStorefrontCart(...args)},500),upsellAtc=e=>{const button=e.currentTarget;window.focusReturn=e.currentTarget,button.innerHTML="ADDING …";const id=button.dataset.handle;let body;const attributes=button.dataset.location&&[{key:"_location",value:button.dataset.location},{key:"_type",value:button.dataset.quicktype}];button.dataset.finalSale&&button.dataset.finalSale==="true"&&attributes.push({key:"is_final_sale",value:button.dataset.finalSale}),body={lines:[{merchandiseId:id,quantity:1,attributes}]},throttleAddToCart(body,button)};window.upsellAtc=upsellAtc;const buildMiniCart=ajaxCart=>{const cart=window.cart;document.querySelectorAll(".cart-contents-icon").forEach(icon=>{icon.innerHTML=`${cart.item_count}`});const cartHeader=`Your Bag (${cart.item_count})`;let cartContainer="",cartFooter="",cartMixNote="";const mixArray=[];let cartPageContent="";const cartPage=document.getElementById("cart-summary");if(cart.item_count>0){const subtotal=cart.items_subtotal_price;document.getElementById("cart-tray-upsell-body").style.display="block",getCartUpsells(cart),cart.items.forEach(item=>{const isItemRushFee=item.product_title.includes("Rush Fee")||item.title.includes("Rush Fee"),isItemSwatchBook=item.product_type==="Swatch Book",itemHandle=item.vendor.includes("Birdy Grey Suits")?`https://suits.birdygrey.com${item.url}`:item.url;let price=item.final_line_price,originalPrice=item.original_line_price;item.price>item.final_price?price=item.final_line_price:item.product_type.includes("Swatch")||(price=item.original_line_price),item.product_type.includes("Swatch")?price=parseInt(price/100):price=price%100>0?(price/100).toFixed(2):price/100,originalPrice=originalPrice%100>0?(originalPrice/100).toFixed(2):originalPrice/100;let priceContainer="";originalPrice>price?priceContainer=` $${originalPrice} $${price} `:priceContainer=`$${price}`;let properties="",pageProperties="",customization="",ajaxFinalSale="",finalSale="";if(item.properties!==null)if(isItemRushFee){const productNameWithoutColor=item.properties._productNameWithoutColor,variantName=item.properties._variantName.split("/ Rush Production")[0];properties+=`

${productNameWithoutColor}

${variantName}

`,pageProperties+=`

${productNameWithoutColor}

${variantName}

`}else{const props=Object.keys(item.properties).map(key=>[key,item.properties[key]]);props.forEach(property=>{property[0]=="Customization"?customization+=property[1]:(property[0]=="CustomizationFont"||property[0]=="CustomizationColor")&&(customization+=` / ${property[1].split("(")[0].trim()} `)}),props.forEach(property=>{if(property[0]==="MADE-TO-ORDER"||property[0]==="_MADE-TO-ORDER"||property[0]==="PREORDER"||property[0]==="_PREORDER"?mixArray.push("preorder"):(property[0]==="READY TO SHIP"||property[0]==="_READY-TO-SHIP")&&mixArray.push("ready"),property[0]==="MADE-TO-ORDER"||property[0]==="_MADE-TO-ORDER"){const promisedByDate=item.properties._PROMISED_BY_DATE;properties=`
Expected to arrive between ${promisedByDate}
`,pageProperties=`
Expected to arrive between ${promisedByDate}
`}else property[0]==="PREORDER"||property[0]==="_PREORDER"?(properties=`
${property[1]}
`,pageProperties=`
${property[1]}
`):property[0]==="READY TO SHIP"||property[0]==="_READY-TO-SHIP"?(properties=`
${property[1]}
`,pageProperties=`
${property[1]}
`):(property[0]==="_is_final_sale"||property[0]==="is_final_sale")&&property[1]==="true"&&!item.variant_title?.includes("Not Personalized")&&(ajaxFinalSale+="Final Sale",finalSale+="Final Sale")})}const buildCartItemSubhead=cartItem=>{if(cartItem.variant_title==null||cartItem.title.includes("Gift Card")||cartItem.title.includes("Rush Fee")||cartItem.product_title.includes("Rush Fee"))return"";let subhead=cartItem.variant_title.includes("Default Title")?"":cartItem.variant_title;const rushFeeOptionName=window.dualSaleRushOptionName;return subhead.includes(rushFeeOptionName)&&(subhead=subhead.split(` / ${rushFeeOptionName}`)[0]),`
${subhead}
`},buildCartItemQuantity=(cartItem,cartType,itemIsRushFee)=>`
`,buildCartItemControls=(cartItem,cartType,itemIsRushFee)=>{if(itemIsRushFee)return"";const keyPrefix=cartType==="mini"?"":"cart-",idSuffix=cartType==="mini"?"remove":"remover";return`

+
Remove
`};cartContainer+=`
${isItemRushFee||isItemSwatchBook?"":``} ${item.product_title} ${isItemRushFee||isItemSwatchBook?"":""}
${item.product_title}
${buildCartItemSubhead(item)}
${customization}
${priceContainer}
${properties}
${ajaxFinalSale}
${buildCartItemQuantity(item,"mini",isItemRushFee)} ${buildCartItemControls(item,"mini",isItemRushFee)}
`,cartPage&&(cartPageContent+=`
${isItemRushFee?"":``} ${item.product_title} ${isItemRushFee?"":""}
${item.product_title}
${buildCartItemSubhead(item)}
${customization}
${priceContainer}
${pageProperties}
${finalSale}
${buildCartItemQuantity(item,"page",isItemRushFee)} ${buildCartItemControls(item,"page",isItemRushFee)}
`)}),cartFooter+=`
Subtotal
$${Math.floor(subtotal/100)}
Review Your Order `;const hasPreorder=mixArray.includes("preorder"),hasReady=mixArray.includes("ready");hasPreorder&&hasReady?cartMixNote+=`

Your Bag contains items that will ship separately.

You\u2019ll receive Rush and Ready to Ship items first. Preorder, Made-On-Demand and Standard production items will ship separately.

`:cartMixNote+="";const miniCartUpsellCarousel=document.getElementById("mini-cart-upsell-carousel"),cartBody=document.getElementById("cart-tray-upsell-body"),cartFooterContents=document.getElementById("mini-cart-footer-contents");if(miniCartUpsellCarousel.classList.toggle("justify-around",cart.item_count===0),cartFooterContents.classList.toggle("my-4",cart.item_count>0),cartPage){document.getElementById("line-item-container").innerHTML=cartPageContent,document.getElementById("cart-page-tray-note").innerHTML=cartMixNote;const finalPrice=Math.floor(subtotal/100);document.getElementById("cart-item-count").innerText=`${cart.item_count} ${cart.item_count===1?"item":"items"}`,document.getElementById("cart-subtotal-cart-page").innerText=`$${finalPrice}`,reloadCartFunctions()}miniCartUpsellCarousel.classList.add("grid"),miniCartUpsellCarousel.classList.add("gap-4"),miniCartUpsellCarousel.classList.remove("flex"),miniCartUpsellCarousel.style.gridAutoFlow="column",cartBody.classList.add("p-4"),cartBody.classList.remove("mini-cart-empty-body"),document.getElementById("cart-need-little-more").classList.remove("none")}else{const emptyMiniCartMessage=`

Your bag is empty

Find your perfect fit

`,shopBestSellersButton=`
Shop Best Sellers
`,emptyCartPageMessage=`
Your bag is empty, but you can change that.
`;cartContainer+=emptyMiniCartMessage,document.getElementById("cart-tray-upsell-body").style.display="none",cartFooter+=shopBestSellersButton,cartPage&&(document.querySelector("#line-item-container").innerHTML=emptyCartPageMessage);const miniCartUpsellCarousel=document.getElementById("mini-cart-upsell-carousel"),cartBody=document.getElementById("cart-tray-upsell-body"),cartFooterContents=document.getElementById("mini-cart-footer-contents");miniCartUpsellCarousel.classList.add("justify-around"),cartFooterContents.classList.add("my-4"),miniCartUpsellCarousel.innerHTML=window.upsells,miniCartUpsellCarousel.classList.remove("grid"),miniCartUpsellCarousel.classList.remove("gap-4"),miniCartUpsellCarousel.classList.add("flex"),miniCartUpsellCarousel.style.gridAutoFlow="unset",cartBody.style.display="block",cartBody.classList.remove("p-4"),cartBody.classList.add("mini-cart-empty-body"),document.getElementById("cart-need-little-more").classList.add("none")}if(document.getElementById("cart-tray-header-text").innerText=cartHeader,document.getElementById("cart-tray-body").innerHTML=cartContainer,document.getElementById("mini-cart-footer-contents").innerHTML=cartFooter,document.getElementById("cart-tray-note").innerHTML=cartMixNote,document.getElementById("cart-tray-body").classList.toggle("bg-core-liteCream",cart.item_count===0),document.getElementById("mini-cart-footer-contents").classList.toggle("py-8",cart.item_count===0),window.Klarna&&updateKlarnaInCart(cart.items_subtotal_price),cartPage){const checkoutButton=cartPage.querySelector(".init-checkout"),storefrontCheckoutButton=cartPage.querySelector("#storefront-cart-button");checkoutButton&&(checkoutButton.classList.add("hidden"),storefrontCheckoutButton.classList.remove("hidden"))}reloadCartFunctions()};window.buildMiniCart=buildMiniCart;const addToCart=(array,button)=>{const addToCartButton=button,errorContainer=document.querySelector(".atc-error-message-container"),errorMessage=document.querySelector("#atc-error-message"),buttonHTML=addToCartButton.innerHTML,isSwatchCarousel=addToCartButton?.dataset?.location?.includes("utm swatch carousel");addToCartButton.innerHTML="Adding …",fetch("/cart/add.js",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(array)}).then(async res=>{let json={};if((res.headers.get("content-type")?.includes("json")||res.headers.get("content-type")?.includes("javascript"))&&(json=await res.json()),!res.ok)throw errorContainer&&(errorMessage.innerText=json.message,errorContainer.classList.remove("hidden"),addToCartButton.innerText="Error. Try again!",setTimeout(()=>{addToCartButton.innerText="Add to Bag"},2500)),new Error(json.message||res.statusText||res.status);return json}).then(response=>{errorContainer&&!errorContainer.classList.contains("hidden")&&errorContainer.classList.add("hidden");let innerText="Add to Bag";array.items[0].properties&&("PREORDER"in array.items[0].properties||"_PREORDER"in array.items[0].properties)?innerText="Add to Bag":isSwatchCarousel&&(innerText=buttonHTML),addToCartButton.classList.contains("add-color-swatch")&&(innerText="GET COLOR SWATCH"),addToCartButton.id&&addToCartButton.id=="personalization-atc"&&closePersonalizationModal(),setTimeout(()=>{addToCartButton.innerHTML=innerText},500);let klaviyoProduct=null;if(addToCartButton.classList.contains("quick-atc")){const{dataset}=addToCartButton;klaviyoProduct={Name:dataset.atcName,ProductID:dataset.atcProductid,Categories:dataset.atcCategories,ImageURL:dataset.atcImageurl,URL:dataset.atcUrl,Brand:dataset.atcBrand,Price:dataset.atcPrice,CompareAtPrice:dataset.atcCompareatprice,QuickATC:!0}}addToCartButton.dispatchEvent(cartChangeEvent),window.dispatchEvent(new CustomEvent(eventNames.ADD_ITEM,{detail:{data:{addToCartResponse:response,klaviyoProduct},action:"add",source:addToCartButton}}))}).catch(error2=>{console.error(error2)})},timeout=(tasks,time)=>{setTimeout(tasks,time)},openMenu=e=>{const button=e.currentTarget;button.classList.contains("active-menu-button")?(button.classList.remove("active-menu-button"),document.querySelector(".df-block").classList.remove("show-menu"),setTimeout(()=>{document.querySelector(".df-block").classList.remove("visible")},360)):(document.querySelector(".df-block").classList.add("visible"),button.classList.add("active-menu-button"),document.querySelector(".df-block").classList.add("show-menu"))};document.getElementById("mobile-menu-icon")&&(document.getElementById("mobile-menu-icon").addEventListener("click",openMenu),document.getElementById("mobile-menu-icon").addEventListener("keydown",enterEvent)),window.toTrap,window.focusReturn=document.querySelector("body"),window.focusTrap=e=>{if(e.key!=="Tab"&&e.keyCode!==9)return;const focusable=Array.from(toTrap.querySelectorAll("input, button, select, textarea, a, .accessibility-ui, *[tabindex]"));if(!focusable.length)return;const first=focusable[0],last=focusable[focusable.length-1],shift=e.shiftKey;(shift?e.target===first:e.target===last||focusable.indexOf(e.target)<0)&&(e.preventDefault(),(shift?last:first).focus())};let currentlyOpenedMenu;const checkTabInMenu=e=>{e.keyCode===9&&(currentlyOpenedMenu==e.target||currentlyOpenedMenu.contains(e.target)||(currentlyOpenedMenu.classList.remove("open-menu"),currentlyOpenedMenu.querySelector(".menu-dropdown").setAttribute("aria-hidden","true"),currentlyOpenedMenu.setAttribute("aria-expanded","false"),document.querySelector("body").removeEventListener("keyup",checkTabInMenu)))},expandMenu=e=>{if(e.keyCode===13){const currentMenu=e.currentTarget;currentMenu.classList.contains("open-menu")?(currentlyOpenedMenu=null,currentMenu.classList.remove("open-menu"),currentMenu.querySelector(".tab-heading").click(),currentMenu.querySelector(".menu-dropdown").setAttribute("aria-hidden","true"),currentMenu.setAttribute("aria-expanded","false"),document.querySelector("body").removeEventListener("keyup",checkTabInMenu)):(currentlyOpenedMenu=currentMenu,currentMenu.classList.add("open-menu"),currentMenu.querySelector(".tab-heading").click(),currentMenu.querySelector(".menu-dropdown").setAttribute("aria-hidden","false"),currentMenu.setAttribute("aria-expanded","true"),document.querySelector("body").addEventListener("keyup",checkTabInMenu))}},preventClick=e=>{if(e.target.classList.contains("menu-item")){e.preventDefault();const currentMenu=e.currentTarget;currentMenu.classList.contains("open-menu")?(currentlyOpenedMenu=null,currentMenu.classList.remove("open-menu"),currentMenu.querySelector(".menu-dropdown").setAttribute("aria-hidden","true"),currentMenu.setAttribute("aria-expanded","false"),document.querySelector("body").removeEventListener("keyup",checkTabInMenu)):(currentlyOpenedMenu=currentMenu,currentMenu.classList.add("open-menu"),currentMenu.querySelector(".menu-dropdown").setAttribute("aria-hidden","false"),currentMenu.setAttribute("aria-expanded","true"),document.querySelector("body").addEventListener("keyup",checkTabInMenu))}};document.querySelectorAll(".menu-item").forEach(button=>{button.addEventListener("click",preventClick)}),document.querySelectorAll(".menu-item").forEach(button=>{button.addEventListener("keyup",expandMenu)});const openDrawer=e=>{window.__cartIsOpen=!0;const getPageType=()=>window.location.pathname.includes("/products")?"product":window.location.pathname.includes("/collections")?"collection":window.location.pathname.includes("/pages")?"page":window.location.pathname==="/"?"home":"unknown",getUpsellItems=()=>{const items=document.getElementById("mini-cart-upsell-carousel").querySelectorAll(".carousel-item"),upsells=[];return items.forEach(item=>{const upsellTitle=item.querySelector("img").getAttribute("alt"),upsellLink=item.querySelector("a").getAttribute("href");upsells.push({upsell:upsellTitle,upsell_link:upsellLink})}),upsells};trackMiniCartClick("opened"),trackMiniCartView(window.cart.total_price/100,window.cart.items,getPageType(),getUpsellItems()),document.querySelector("body").classList.add("open-cart-drawer");let drawer;const cookieWrapper=document.getElementById("cookie-privs");e.currentTarget?(drawer=document.getElementById(e.currentTarget.dataset.drawer),drawer.classList.contains("open-drawer")||(window.focusReturn=e.currentTarget)):drawer=document.getElementById(e),drawer.classList.contains("open-drawer")?(window.removeEventListener("keydown",focusTrap),drawer.classList.remove("open-drawer"),document.getElementById("website-content").setAttribute("aria-hidden","false"),document.querySelector("body").removeEventListener("click",closeCart),focusReturn.focus(),drawer.classList.add("invisible"),drawer.setAttribute("aria-hidden","true"),drawer.setAttribute("aria-modal","false")):(toTrap=drawer,drawer.classList.add("open-drawer"),drawer.setAttribute("aria-hidden","false"),drawer.setAttribute("aria-modal","true"),drawer.classList.remove("invisible"),drawer.focus(),cookieWrapper&&cookieWrapper.setAttribute("aria-hidden","true"),document.getElementById("website-content")?.setAttribute("aria-hidden","true"),window.addEventListener("keydown",focusTrap))},closeCart=e=>{window.__cartIsOpen=!1,trackMiniCartClick("closed");const tray=document.getElementById("cart-tray-widget");(!e.target.classList.contains("cart-button")&&!e.target.classList.contains("cart-tray-widget")&&!tray.contains(e.target)||e.currentTarget.classList.contains("close-cart-tray"))&&(document.querySelector("body").classList.remove("open-cart-drawer"),document.getElementById("cart-tray-widget").classList.remove("open-drawer"),document.getElementById("website-content")?.setAttribute("aria-hidden","false"),document.querySelector("body").removeEventListener("click",closeCart),window.removeEventListener("keydown",focusTrap),focusReturn.focus(),document.getElementById("cart-tray-widget").setAttribute("aria-modal","false"),document.getElementById("cart-tray-widget").setAttribute("aria-hidden","true"))};document.getElementById("cart-button").addEventListener("click",openDrawer),document.getElementById("cart-button").addEventListener("keydown",enterEvent),document.getElementById("close-cart-tray").addEventListener("click",closeCart),document.getElementById("close-cart-tray").addEventListener("keydown",enterEvent),document.body.addEventListener("click",e=>{const cart=document.querySelector(".cart-tray-container"),cartButton=document.querySelector(".cart-button"),isCartRelated=cart.contains(e.target)||cartButton.contains(e.target);window.__cartIsOpen&&!isCartRelated&&closeCart(e)});const toggleTab=e=>{const heading=e.currentTarget,container=heading.nextElementSibling;container.classList.contains("open-tab")?(container.classList.remove("open-tab"),container.classList.remove("visible"),heading.querySelector(".tab-icon").innerText="+",container.setAttribute("aria-hidden","true")):(container.classList.add("open-tab"),container.classList.add("visible"),heading.querySelector(".tab-icon").innerText="\u2013",container.setAttribute("aria-hidden","false"))};document.querySelectorAll(".tab-heading").forEach(heading=>{heading.addEventListener("click",toggleTab),heading.addEventListener("keydown",enterEvent)});const tabletTabs=document.querySelectorAll(".tablet-flex.tab-heading");tabletTabs&&tabletTabs.forEach(heading=>{heading.removeEventListener("click",toggleTab),heading.addEventListener("click",e=>{tabletTabs.forEach(tab=>{if(tab!=e.currentTarget){const container=tab.nextElementSibling;container.classList.remove("open-tab"),container.classList.remove("visible"),tab.querySelector(".tab-icon").innerText="+",container.setAttribute("aria-hidden","true")}else toggleTab(e)})})});const stampedKey="pubkey-811l536uX1H0TW9mkl620Bg9718PlA",months=["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths=["Jan","Feb","Mar","Apr","May","June","July","Aug","Sept","Oct","Nov","Dec"],getReviews=(productId,widgetKey)=>new Promise(resolve=>{const url=`https://stamped.io/api/widget/reviews?productId=${productId}&minRating=1&take=100&storeUrl=birdygrace.myshopify.com&apiKey=${widgetKey}`;fetch(url,{method:"GET"}).then(res=>res.json()).then(json=>{const data=json,reviews={reviews:[],images:[]};reviews.total=data.total,reviews.average=data.rating,data.data.forEach((review,index)=>{let info={};if(review.reviewOptionsList&&review.reviewOptionsList.length>0)for(const key in review.reviewOptionsList)info[`${review.reviewOptionsList[key].message.trim()}`]=review.reviewOptionsList[key];else info=null;let photos=[];review.reviewUserPhotos&&review.reviewUserPhotos.length>0&&(photos=review.reviewUserPhotos.split(",")),reviews.reviews.push({body:review.reviewMessage,time:review.reviewDate,score:review.reviewRating,info,user:review.author,images:photos,title:review.reviewTitle,verified:review.reviewVerifiedType}),review.reviewUserPhotos&&review.reviewUserPhotos.length>0&&photos.forEach(image=>{reviews.images.push({image,review_index:index})})}),resolve(reviews)}).catch(err=>console.error(`error:${err}`))});sortReviews=e=>{const sorting=e.currentTarget.value,data=allReviews,{reviews}=data,images=[];sorting=="new"?reviews.sort((a,b)=>{const fa=new Date(a.time);return new Date(b.time)-fa}):sorting=="old"?reviews.sort((a,b)=>{const fa=new Date(a.time),fb=new Date(b.time);return fa-fb}):sorting=="rating-high"?reviews.sort((a,b)=>b.score-a.score):sorting=="rating-low"&&reviews.sort((a,b)=>a.score-b.score),document.getElementById("reviews-body").innerHTML="",reviews.forEach((review,index)=>{review.images.forEach(image=>{images.push({image,review_index:index})})}),data.reviews=reviews,data.images=images,window.allReviews=data,initializeReviews(data)},window.getCustomGallery=(albumName,productId,widgetKey)=>new Promise(resolve=>{let url=`https://stamped.io/api/widget/reviews?type=instagram-feed&albumId=${albumName}&productId=${productId}&take=100&apiKey=${stampedKey}&storeUrl=birdygrace.myshopify.com`;url=encodeURI(url),fetch(url,{method:"GET",crossDomain:!0,headers:{Accept:"application/json","Content-Type":"application/json"}}).then(res=>res.json()).then(json=>{const arr=[];json.data.forEach(image=>{arr.push({src:image.imageUrl,caption:image.mediaText,products:image.tags,user:image.username,timestamp:image.dateCreated})}),resolve(arr)}).catch(err=>{console.error(`error:${err}`),resolve({error:"There was an error fetching the instagram results"})})}),window.buildModal=content=>{const timestamp=Date.now(),modal=` `;document.querySelector("body").insertAdjacentHTML("afterbegin",modal),document.getElementById(`close-${timestamp}`).addEventListener("click",closeModal),document.getElementById(`close-${timestamp}`).addEventListener("keydown",enterEvent),document.querySelectorAll(".modal-insta-product").forEach(thumb=>{thumb.addEventListener("click",swapInstaProduct),thumb.addEventListener("keydown",enterEvent)}),document.querySelectorAll(".advance-insta").forEach(button=>{button.addEventListener("click",nextInstaImage),button.addEventListener("keydown",enterEvent)}),document.querySelectorAll(".cookie-settings-consent").forEach(button=>{button.addEventListener("click",hideCookieBanner),button.addEventListener("keydown",enterEvent)}),document.querySelector(".modal").querySelectorAll(".standard-tab-label").forEach(label=>{label.addEventListener("click",toggleTitle),label.addEventListener("keydown",enterEvent)}),document.getElementById(`modal-${timestamp}`).focus(),document.getElementById("website-content").setAttribute("aria-hidden","true"),window.toTrap=document.getElementById(`modal-${timestamp}`),window.addEventListener("keydown",focusTrap)};const closeModal=e=>{const id=e.currentTarget.dataset.modal;if(id){const modal=document.getElementById(`modal-${id}`);modal&&(modal.remove(),document.querySelector("body").removeEventListener("click",closeModal),document.getElementById("website-content").setAttribute("aria-hidden","false"),focusReturn.focus())}else{const item=e.target,mode=document.querySelector(".modal-inner");mode&&item.classList.contains("modal-inner")==!1&&mode.contains(item)==!1&&(document.querySelectorAll(".modal").forEach(modal=>{modal.remove()}),document.getElementById("website-content").setAttribute("aria-hidden","false"),focusReturn.focus()),document.getElementById("website-content").setAttribute("aria-hidden","false"),focusReturn.focus(),document.querySelector("body").removeEventListener("click",closeModal)}},nextInstaImage=e=>{const post=e.currentTarget.dataset.adv,modal=document.querySelector(".modal");if(modal&&post){modal.remove(),document.querySelector("body").removeEventListener("click",closeModal);const show=document.getElementById(post);show&&e.currentTarget.classList.contains("review-carousel-adv")?reviewImageModal(show):showInsta(post)}},swapInstaProduct=e=>{const toSwap=e.currentTarget,container=document.getElementById("active-insta-product"),contents=`
${toSwap.dataset.name.split("-")[0]}
${toSwap.dataset.name.split("-")[1]}

`;container.innerHTML=contents,document.querySelectorAll(".selected-insta-product").forEach(item=>{item.classList.remove("selected-insta-product")}),toSwap.classList.add("selected-insta-product"),window.location.href.indexOf("products")!==-1&&document.querySelectorAll(".active-insta-product-wrapper").forEach(modalProduct=>{getImageForInstaProducts(modalProduct,modalProduct.dataset.url,122,182)})};if(document.getElementById("home-instagram")){const container=document.getElementById("home-instagram");getCustomGallery(container.dataset.gallery,container.dataset.product,stampedKey).then(data=>{let elements="";data.forEach((item,index)=>{if(index<10){let prev="null",next="null";index!==0&&(prev=`home-insta-object-${index-1}`),index<9&&index!==data.length-1&&(next=`home-insta-object-${index+1}`),elements+=` `}}),elements+=` `,container.innerHTML=elements,document.querySelectorAll(".insta-image").forEach(insta=>{insta.addEventListener("click",showInsta),insta.addEventListener("keydown",enterEvent)})})}const showInsta=e=>{let post;e.currentTarget?(post=e.currentTarget,window.focusReturn=e.currentTarget):(post=document.getElementById(e),window.focusReturn=document.getElementById(e));const products=JSON.parse(post.dataset.products);let productContainer="";if(products.length>0){if(productContainer+=`
${products[0].title.split("-")[0]}
${products[0].title.split("-")[1]}

`,products.length>1){productContainer+='
OTHER TAGGED PRODUCTS

';const usedProducts=[];products.forEach((product,index)=>{const pic=new Image;pic.src=product.imageUrl,usedProducts.includes(product.title)||(index==0?productContainer+=` `:productContainer+=` `,usedProducts.push(product.title))}),productContainer+="
"}productContainer+="
"}const time=new Date(post.dataset.timestamp.substring(0,post.dataset.timestamp.indexOf("T")).replace(/-/g,"/")),day=`0${time.getDate()}`.slice(-2),month=`0${time.getMonth()+1}`.slice(-2),year=time.getFullYear().toString().slice(-2),postPic=new Image;postPic.src=post.dataset.image;let moveLeft="",moveRight="";post.dataset.prev!=="null"&&(moveLeft=`
`),post.dataset.next!=="null"&&(moveRight=`
`);const modalContent=`
${moveLeft} ${moveRight}
${productContainer}
${post.dataset.user}
${month}/${day}/${year}

${post.dataset.caption}

`;return setTimeout(()=>{document.querySelectorAll(".modal-insta-product").forEach(modalProduct=>{getImageForInstaProducts(modalProduct,modalProduct.dataset.url,80,120)}),document.querySelectorAll(".active-insta-product-wrapper").forEach(modalProduct=>{getImageForInstaProducts(modalProduct,modalProduct.dataset.url,122,182)})},100),buildModal(modalContent)};function getImageForInstaProducts(element,productUrl,width,height){element.querySelector("img").naturalWidth===0&&fetch(`${window.Shopify.routes.root+productUrl.substring(productUrl.indexOf("products"))}.js`,{method:"GET",headers:{"Content-Type":"application/json"}}).then(res=>res.json()).then(response=>{element.querySelector("img").setAttribute("src",`${response.featured_image}?width=${width}&height=${height}`)})}const moveCarousel=e=>{const button=e.currentTarget,{direction}=button.dataset,section=button.closest(".shopify-section");let carousel;document.getElementById(button.dataset.item)?carousel=section.querySelector(`[id="${button.dataset.item}"]`):carousel=document.getElementsByClassName(button.dataset.item)[0];const carouselWidth=carousel.offsetWidth,position=carousel.scrollLeft,scrollAmt=carouselWidth*3/4;let destination=position+scrollAmt;direction=="left"&&(destination=position-scrollAmt);let final=0;carousel.querySelectorAll(".carousel-item").forEach(item=>{const currentFinal=Math.abs(final-destination);Math.abs(item.offsetLeft-destination){carousel.style.scrollSnapType="x mandatory"},400)),carousel.scrollTo({top:0,left:final,behavior:"smooth"}),section.querySelector(".carousel-left").classList.toggle("opacity-50",final===0),section.querySelector(".carousel-right").classList.toggle("opacity-50",final===carouselWidth)},moveProductCarousel=e=>{const button=e.currentTarget,{direction}=button.dataset,carousel=document.querySelector(".product-image-container"),carouselHeight=carousel.offsetHeight,position=carousel.scrollTop,scrollAmt=carouselHeight*3/4;let destination=carousel.scrollTop+scrollAmt;direction=="up"&&(destination=carousel.scrollTop-scrollAmt);let final=0;carousel.querySelectorAll(".pdp-thumb").forEach(item=>{const currentFinal=Math.abs(final-destination);Math.abs(item.offsetTop-destination){button.addEventListener("click",moveCarousel),button.addEventListener("keydown",enterEvent)}),document.querySelectorAll(".product-image-button").forEach(button=>{button.addEventListener("click",moveProductCarousel),button.addEventListener("keydown",enterEvent)});const verifyInput=input=>{let verified;if(input.classList.contains("personalizer"))if(input.value.trim().length>0){verified=!0,input.classList.remove("invalid-input"),document.getElementById("personalizer-input")?.classList.add("exists"),document.getElementById("personalizer-input")?.setAttribute("aria-describedby",""),input.placeholder="";const personalizeAtc=document.getElementById("personalization-atc");personalizeAtc&&personalizeAtc.innerText=="PLEASE FIX THE ERROR"&&(personalizeAtc.innerText="Add to Bag")}else verified=!1;else input.classList.contains("email-input")?/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(input.value)?(verified=!0,input.classList.remove("invalid-input")):verified=!1:verified=!0;return verified==!0};function addProductTagsToStorage(handle){handle&&fetch(`/products/${handle}.js`).then(res=>res.json()).then(product=>{localStorage.setItem(`${product.id}`,`${product.tags}`)})}const editItemBeforeAdd=(itemId,option)=>{const id=`gid://shopify/ProductVariant/${itemId}`,body={lines:[]},entry={quantity:1,merchandiseId:id,attributes:[]};if(option.dataset.madetoorder&&(entry.attributes.push({key:"_MADE-TO-ORDER",value:`Expected to arrive between ${option.dataset.madetoorder}`}),option.dataset.productiondays&&entry.attributes.push({key:"_PRODUCTION_DAYS",value:option.dataset.productiondays}),entry.attributes.push({key:"_PROMISED_BY_DATE",value:`${option.dataset.madetoorder}`})),option.dataset.readytoship){let readyToShipMessage=`Expected to deliver in ~${option.dataset.readytoship} business days`;option.dataset.giftcard&&(readyToShipMessage=option.dataset.giftcard),entry.attributes.push({key:"_READY-TO-SHIP",value:readyToShipMessage})}return option.dataset.giftcard&&entry.attributes.push({key:"_GIFT_CARD",value:option.dataset.giftcard}),option.dataset.madetoorder||option.dataset.preorder&&entry.attributes.push({key:"_PREORDER",value:`Expected to deliver by ${option.dataset.preorder}`}),option.dataset.preorderdate&&entry.attributes.push({key:"_preorderdate",value:option.dataset.preorderdate}),option.dataset.finalSale&&option.dataset.finalSale==="true"&&entry.attributes.push({key:"is_final_sale",value:option.dataset.finalSale}),option.dataset.location&&(entry.attributes.push({key:"_location",value:option.dataset.location}),entry.attributes.push({key:"_type",value:option.dataset.quicktype})),option.dataset.quickswatch&&entry.attributes.push({key:"_QUICK_SWATCH",value:"true"}),option.dataset.readytoship&&entry.attributes.push({key:"_READY-TO-SHIP",value:`Expected to deliver in ~${option.dataset.readytoship} business days`}),option.dataset.preorder&&entry.attributes.push({key:"_PREORDER",value:`Expected to deliver by ${option.dataset.preorder}`}),document.querySelectorAll(".line-prop-input").forEach(property=>{property.disabled||entry.attributes.push({key:property.dataset.key,value:property.value})}),document.querySelectorAll(".line-prop-radio").forEach(radio=>{if(!radio.disabled&&radio.checked&&(radio.dataset.key=="CustomizationPlacement"&&(placement=radio.value),entry.attributes.push({key:radio.dataset.key,value:radio.value}),radio.dataset.sizekey)){const size=radio.dataset.currentsize;entry.attributes.push({key:radio.dataset.sizekey,value:size})}}),body.lines.push(entry),body};window.atcClick=async e=>{const button=e.currentTarget;let isSizeSelected=!1,isVariantSelected=!1;const variationRadios=document.querySelectorAll(".slit-variation-radio"),addToCartWrapper=document.querySelector(".pdp-ctas"),sizeDropdown=document.querySelector(".size-dropdown"),sizeAndLengthDropdowns=document.querySelectorAll(".size-dropdown, .length-dropdown");if(error=document.querySelector(".option-not-selected"),e.preventDefault(),window.focusReturn=button,e.target.getAttribute("id")==="pdp-atc"){if(sizeDropdown&&sizeDropdown.getAttribute("value")&&(isSizeSelected=!0),variationRadios.forEach(radio=>{radio.checked&&(isVariantSelected=!0)}),sizeDropdown&&!isSizeSelected&&variationRadios.length&&!isVariantSelected)return error?.remove(),sizeDropdown.removeAttribute("aria-live"),addToCartWrapper.insertAdjacentHTML("afterbegin",''),!1;if(variationRadios.length&&!isVariantSelected)return error?.remove(),sizeDropdown.removeAttribute("aria-live"),addToCartWrapper.insertAdjacentHTML("afterbegin",` `),!1;if(sizeAndLengthDropdowns.length){let dropdownSelected=!0,message="Please select a size to continue.";const errorContainer=document.querySelector(".atc-error-message-container"),errorMessage=document.querySelector("#atc-error-message");if(sizeAndLengthDropdowns.forEach(dropdown=>{dropdown.getAttribute("value")||(error?.remove(),dropdown.classList.contains("length-dropdown")&&(message="Please select a length to continue."),dropdown.classList.add("has-error"),dropdown.setAttribute("aria-live","assertive"),dropdownSelected=!1)}),errorContainer&&(errorContainer.classList.toggle("hidden",dropdownSelected),errorMessage.innerText=message),dropdownSelected==!1)return!0}}if(button.classList.contains("inactive-atc")){window.location=`/products/${button.dataset.handle}`;return}if(!button.disabled&&!button.classList.contains("bis-cta")){let quickAdd=!1;if(button.classList.contains("quick-atc")&&(quickAdd=!0),quickAdd){const toAdd=button.dataset.variantid;let body;body=editItemBeforeAdd(toAdd,button),document.querySelectorAll(".line-prop-input").forEach(property=>{property.disabled||verifyInput(property)||(isVerified=!1,property.classList.add("invalid-input"),document.getElementById("personalizer-input")&&(document.getElementById("personalizer-input").placeholder="PLEASE ADD TEXT"),document.getElementById("personalizer-input")?.setAttribute("aria-describedby","Error, please add text"))}),throttleAddToCart(body,button)}else{let placement2="Standard",body,isVerified2=!0;document.querySelectorAll(".variant-select").forEach(selector=>{const option=selector.options[selector.selectedIndex];let entry;body=editItemBeforeAdd(selector.value,option),document.querySelectorAll(".line-prop-input").forEach(property=>{property.disabled||verifyInput(property)||(isVerified2=!1,property.classList.add("invalid-input"),document.getElementById("personalizer-input")&&(document.getElementById("personalizer-input").placeholder="PLEASE ADD TEXT"),document.getElementById("personalizer-input")?.setAttribute("aria-describedby","Error, please add text"))})}),isVerified2&&throttleAddToCart(body,e.currentTarget)}}e.currentTarget.classList.contains("bis-cta")&&showBackInStockModal(e.currentTarget)},document.querySelectorAll(".size-radio").forEach(radio=>{radio.addEventListener("click",()=>{document.getElementById("size-not-selected")?.remove(),document.querySelectorAll(".slit-variation-radio").forEach(radio2=>{radio2.checked&&document.getElementById("size-variant-not-selected")?.remove()})})}),document.querySelectorAll(".slit-variation-radio").forEach(radio=>{radio.addEventListener("click",()=>{document.getElementById("variant-not-selected")?.remove(),document.querySelectorAll(".size-radio").forEach(radio2=>{radio2.checked&&document.getElementById("size-variant-not-selected")?.remove()})})});function throttle(callback,delay){let shouldWait=!1;return(...args)=>{shouldWait||(callback(...args),shouldWait=!0,setTimeout(()=>{shouldWait=!1},delay))}}document.querySelectorAll(".atc").forEach(button=>{button.addEventListener("click",atcClick),button.addEventListener("keydown",enterEvent)}),window.hexToRgb=hex=>{const shorthandRegex=/^#?([a-f\d])([a-f\d])([a-f\d])$/i;hex=hex.replace(shorthandRegex,(m,r,g,b)=>r+r+g+g+b+b);const result=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);return result?{r:parseInt(result[1],16),g:parseInt(result[2],16),b:parseInt(result[3],16)}:null},window.getLuminance=(r,g,b)=>{const a=[r,g,b].map(v=>(v/=255,v<=.03928?v/12.92:((v+.055)/1.055)**2.4));return a[0]*.2126+a[1]*.7152+a[2]*.0722};const checkDropdown=e=>{window.innerWidth>1024&&e.preventDefault()},toggleSortMenu=isOpen=>{const isMobileSort=window.matchMedia("(max-width: 1023px)").matches,sortByContainer=document.querySelector(".collection--sort-by-filter"),closeButton=sortByContainer.querySelector(".close-sort-by"),sortByButton=sortByContainer.querySelector(".sort-by-button"),dropdownContainer=sortByContainer.querySelector(".dropdown-container");dropdownContainer.classList.toggle("dropdown-active",isOpen),dropdownContainer.querySelectorAll(".dropdown-value").forEach(opt=>opt.tabIndex=isOpen?0:-1),sortByButton.ariaExpanded=isOpen.toString(),isMobileSort?(closeButton.classList.toggle("hidden",!isOpen),isOpen?(window.toTrap=dropdownContainer,setTimeout(()=>closeButton.focus(),100)):setTimeout(()=>sortByButton.focus(),100)):isOpen&&(window.toTrap=document.querySelector(".dropdown-values-wrapper")),window[isOpen?"addEventListener":"removeEventListener"]("keydown",window.focusTrap)},openSortMenu=()=>toggleSortMenu(!0),closeSortMenu=()=>toggleSortMenu(!1);window.sort={openMenu:openSortMenu,closeMenu:closeSortMenu},document.querySelectorAll(".select-dropdown").forEach(select=>{select.addEventListener("mousedown",checkDropdown)});const changeDropdown=e=>{const value=e.currentTarget.dataset.select,parent=e.currentTarget.parentNode.parentNode,selector=parent.previousElementSibling.querySelector("select");parent.querySelectorAll("[data-select]").forEach(el=>{el.classList.remove("active"),el.ariaSelected=!1}),e.currentTarget.classList.add("active"),e.currentTarget.ariaSelected=!0,selector.querySelectorAll("option").forEach(option=>{if(option.value==value){option.selected=!0;const event=new Event("input",{bubbles:!0,cancelable:!0});selector.dispatchEvent(event)}}),closeSortMenu()};document.querySelectorAll(".dropdown-value").forEach(value=>{value.addEventListener("click",changeDropdown),value.addEventListener("keydown",enterEvent)}),document.querySelectorAll(".sort-by-button").forEach(value=>{value.addEventListener("click",openSortMenu)}),document.querySelectorAll(".close-sort-by").forEach(value=>{value.addEventListener("click",closeSortMenu)});const getCartUpsells=cart=>{const showDiscountPriceForSwatches=checkForSwatchBuyer(cart);let tagString='tag:"Checkout Aisle"';const cartIDs=[],cartTypes=[];cart.items.forEach(item=>{let itemId="",id=item.id.split("/");id=id[id.length-1],itemId=id,cartIDs.push(itemId),cartTypes.includes(item.product_type)||cartTypes.push(item.product_type),item.title.includes("Robe")&&!cartTypes.includes("Robe")&&cartTypes.push("Robe"),item.title.includes("Pajama")&&!cartTypes.includes("Pajamas")&&cartTypes.push("Pajamas")}),tagString="";let tagLength=0;if(Object.keys(upsellMatrix).forEach(key=>{cartTypes.includes(key)&&upsellMatrix[key].forEach(tag=>{cartTypes.includes(tag.type)||(tagString+=`tag:"${tag.tag}"`,tagLength+=1)})}),tagString!=""){const host=window.location.hostname;fetch(`https://${host}/search?view=dictionary&type=product&q=${tagString}`,{method:"GET"}).then(res=>res.text()).then(response=>{let upsells=[],data=response.split("let products = ");data=data[1].split("<\/script>")[0];const sanitizedData=data.replace(/[\n\r\t]/g,"").trim();try{upsells=JSON.parse(sanitizedData)}catch(error2){console.error("Error parsing JSON:",error2)}upsells=shuffle(upsells).slice(0,8);let picked=[],ind=0;upsells.forEach(upsell=>{ind{const finalSale=upsell.tags.some(tag=>tag==="finalsale"||tag==="Final Sale"),shipNow=upsell.tags.some(tag=>tag==="ss-temp-ships-now-all-sizes-plp-badge'"||tag==="sstempshipsnowallsizesplpbadge"),name=upsell.title.split("-"),title=`
${name[0]}
`;let subtitle="";if(name.length>1){let fabric="";upsell.type!=="Swatch"&&upsells?.tags?.find(tag=>{if(tag.toLowerCase().startsWith("fabric:")){const fabricTag=tag.split("fabric:")[1];fabric=allFabrics.find(fabricMapTag=>fabricMapTag.toLowerCase().includes(fabricTag)).trim()}return fabric}),subtitle=`${fabric} ${name[1].replace(" in "," ")}`}let button="";upsell.variants.length==1?button=``:button=`
View
`;const cardPrice=((salePrice,price,type,showSwatchDiscount)=>{const hasSalePrice=salePrice&&Number(price.slice(1))>Number(salePrice.slice(1));return type.includes("Swatch")&&showSwatchDiscount?`
${upsell.price}
$0`:hasSalePrice?`
${upsell.price}
${upsell.compare_at_price}`:upsell.price})(upsell.compare_at_price,upsell.price,upsell.type,showDiscountPriceForSwatches);upsellContainer+=` `;let pageButton;upsell.variants.length==1?pageButton=``:pageButton=``,cartPageUpsellContainer+=` `}),document.getElementById("mini-cart-upsell-carousel").innerHTML=upsellContainer,document.getElementById("cart-upsell-carousel")&&(document.getElementById("cart-upsell-carousel").innerHTML=cartPageUpsellContainer),document.querySelectorAll(".upsell-atc").forEach(button=>{button.addEventListener("click",upsellAtc),button.addEventListener("keydown",enterEvent)})}).catch(err=>{console.log(err)})}};window.getCartUpsells=getCartUpsells;const setTab=e=>{const current=e.currentTarget;e.currentTarget.parentElement.querySelectorAll(".tab-label").forEach(label=>{label.classList.remove("active-tab-label")}),current.classList.add("active-tab-label");const grid=document.getElementById(current.dataset.grid),toShow=current.dataset.item;grid.querySelectorAll(".featured-product-grid-item").forEach(i=>{i.classList.contains(toShow)?i.classList.remove("none"):i.classList.add("none")}),grid.scrollTo({top:0,left:0,behavior:"smooth"})};document.querySelectorAll(".tab-label").forEach(label=>{label.addEventListener("click",setTab),label.addEventListener("keydown",enterEvent)});const toggleTitle=e=>{const tab=e.currentTarget;if(!tab.classList.contains("active-tab")){const container=document.getElementById(tab.dataset.container),{item}=tab.dataset;container.querySelectorAll(".standard-tab-label").forEach(label=>{label===tab?(label.classList.add("active-tab"),label.setAttribute("aria-selected","true")):(label.classList.remove("active-tab"),label.setAttribute("aria-selected","false"))}),container.querySelectorAll(".tab-item").forEach(content=>{content.classList.contains(item)?(content.classList.remove("none"),content.setAttribute("aria-hidden","false")):(content.classList.add("none"),content.setAttribute("aria-hidden","true"))})}};document.querySelectorAll(".standard-tab-label").forEach(label=>{label.addEventListener("click",toggleTitle),label.addEventListener("keydown",enterEvent)});const triggerStudioModal=e=>{e.preventDefault()};document.querySelectorAll(".non-customer-like-button").forEach(button=>{button.addEventListener("click",triggerStudioModal),button.addEventListener("keydown",enterEvent)});const checkCarouselButtons=()=>{document.querySelectorAll(".horizontal-carousel-container").forEach(container=>{const carousel=container.querySelector(".horizontal-carousel");if(carousel){const carouselWidth=carousel.offsetWidth;carousel.querySelector("div").offsetWidth{button.classList.add("hide-carousel-buttons")}):container.querySelectorAll(".carousel-button").forEach(button=>{button.classList.remove("hide-carousel-buttons")})}})};checkCarouselButtons();const checkCarouselPosition=()=>{},sitemapLinkClick=e=>{e.preventDefault()};if(document.querySelectorAll(".sitemap-link").forEach(link=>{link.addEventListener("click",sitemapLinkClick),link.addEventListener("keydown",enterEvent)}),window.location.pathname.indexOf("/products")===0){const getCurrentVariant=product=>{if(!product||!Array.isArray(product.variants))return console.error("product or product variants not found"),null;const variantSelect=document.querySelector(".variant-select");if(!variantSelect)return console.warn("Variant select element not found, returning the default variant"),product.variants[0];const selectedOption=Array.from(variantSelect.querySelectorAll("option")).find(option=>option.selected);if(!selectedOption)return console.warn("No selected option found, returning the default variant"),product.variants[0];const variantId=selectedOption.value,variant=product.variants.find(v=>v.id==variantId);return variant||(console.warn("Selected variant does not exist in product, returning the default variant"),product.variants[0])};window.addEventListener("productChange",e=>{const newProduct=e.detail,newVariant=getCurrentVariant(newProduct);trackProductView(newProduct,newVariant)}),fetch(`${window.location.pathname}.js`).then(response=>response.json()).then(product=>{const variant=getCurrentVariant(product);trackProductView(product,variant)}).catch(e=>{throw new Error(e)})}window.cleanInput=e=>{const input=e.currentTarget;let{value}=input;input.dataset.case=="lc"&&(value=input.value.toLowerCase()),input.dataset.case=="uc"&&(value=input.value.toUpperCase()),input.dataset.verify=="Chars"?value=value.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^a-z/A-Z ]/g,""):input.dataset.verify=="couple"?(value=value.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^a-z/A-Z /+]/g,""),value.length==2&&value.charAt(1)!=="+"&&(value=`${value.charAt(0)}+${value.charAt(1)}`)):value=value.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^a-z/A-Z ]/g,""),input.value=value,verifyInput(input),input.classList.contains("personalizer")&&document.querySelectorAll(".personalization-text").forEach(text=>{text.textContent=input.value,window.testFontSize()})},window.cleanKeys=e=>{if(e.srcElement.dataset.verify=="couple"){if(!/[a-z /+]/i.test(String.fromCharCode(e.keyCode)))return e.preventDefault(),!1}else if(!/[a-z ]/i.test(String.fromCharCode(e.keyCode)))return e.preventDefault(),!1},window.verifyIt=e=>{verifyInput(e.currentTarget)};const resetMobility=()=>{isMobile=window.matchMedia("(max-width: 768px)")},scrollToAnchor=e=>{e.preventDefault();const anchor=document.getElementById(e.currentTarget.href.split("#")[1]),scrollPosition=anchor.offsetTop;anchor.focus(),window.scrollTo({top:scrollPosition,left:0,behavior:"smooth"})},setRealWeddingsGallery=(gallery,product,key)=>{getCustomGallery(gallery,product,key).then(data=>{let instaContainer="";data.forEach((post,index)=>{let prev=null,next=null;index!==0&&(prev=`real-weddings-insta-object-${index-1}`),index
${post.caption}
`}),realWeddingsGrid.innerHTML=instaContainer,document.querySelectorAll(".insta-image").forEach(insta=>{insta.addEventListener("click",showInsta),insta.addEventListener("keydown",enterEvent)})})};let realWeddingsGrid=document.getElementById("real-weddings-insta-grid");realWeddingsGrid&&setRealWeddingsGallery(realWeddingsGrid.dataset.gallery,realWeddingsGrid.dataset.product,stampedKey);const changeRealWeddingsGallery=e=>{const{value}=e.currentTarget;setRealWeddingsGallery(value,"",stampedKey)},uncheckGallery=e=>{let radio=e.currentTarget.getAttribute("for");radio=document.getElementById(radio),radio&&radio.checked&&(setTimeout(()=>{radio.checked=!1},25),setRealWeddingsGallery(realWeddingsGrid.dataset.gallery,realWeddingsGrid.dataset.product,stampedKey))};document.querySelectorAll(".real-wedding-gallery-label").forEach(label=>{label.addEventListener("click",uncheckGallery),label.addEventListener("keydown",enterEvent)}),document.querySelectorAll(".real-wedding-insta-option").forEach(option=>{option.addEventListener("change",changeRealWeddingsGallery)});const pauseVideo=e=>{e.preventDefault();const videoContainer=e.currentTarget,video=videoContainer.querySelector("video"),button=videoContainer.querySelector(".play-button");!video||!button||(video.classList.remove("cursor-pointer"),video.pause(),button.classList.remove("hidden"),button.parentElement?.classList.add("z-10"),videoContainer.removeEventListener("click",pauseVideo),videoContainer.removeEventListener("keydown",enterEvent))},playVideo=e=>{const isDesktop=window.matchMedia("min-width:768px").matches;e.preventDefault();const button=e.currentTarget,videoContainer=button.parentElement.parentElement,video=videoContainer?.querySelector("video"),stylingVideo=videoContainer.querySelector(".styling-video"),stylingPlayButton=document.querySelector(".pdp-thumb .video-play-button"),internalTitleCard=document.querySelector(".styling-video-title");!video||videoContainer===null||(stylingVideo&&stylingVideo.setAttribute("controls",!0),video.paused&&(button.classList.add("hidden"),button.parentElement?.classList.remove("z-10"),video.play(),setTimeout(()=>{isDesktop||(stylingVideo?(stylingPlayButton.classList.add("hidden"),internalTitleCard&&internalTitleCard.classList.add("hidden")):(videoContainer.addEventListener("click",pauseVideo),videoContainer.addEventListener("keydown",enterEvent)))},10)))},resetFocusOutline=()=>{document.querySelector("body").classList.remove("no-focus-outline"),document.querySelector("body").classList.add("focus-outline")},trapSearchFocus=e=>{const focusableEls=document.querySelectorAll("#desktop-search-ui a[href]:not([disabled]), #desktop-search-ui button:not([disabled]), #desktop-search-ui textarea:not([disabled]), #desktop-search-ui input, #desktop-search-ui select, #desktop-search-icon .desktop-search-close, #popular-search-box a[href]:not([disabled]), #popular-search-box button:not([disabled]), #popular-search-box textarea:not([disabled]), #popular-search-box input:not([disabled]), #popular-search-box select:not([disabled]), .header-container a[href]:not([disabled]), .header-container button:not([disabled]), .header-container textarea:not([disabled]), .header-container input:not([disabled]), .header-container select:not([disabled])"),firstFocusableEl=focusableEls[0],lastFocusableEl=focusableEls[focusableEls.length-1],isTabPressed=e.key==="Tab"||e.keyCode===9;e.key==="Escape"&&(resetFocusOutline(),closeDesktopSearch()),isTabPressed&&(e.shiftKey?document.activeElement===firstFocusableEl&&(lastFocusableEl.focus(),e.preventDefault()):document.activeElement===lastFocusableEl&&(firstFocusableEl.focus(),e.preventDefault()))},trapMobileSearchFocus=e=>{const focusableEls=document.querySelectorAll("#mobile-search-box a[href]:not([disabled]), #mobile-search-box button:not([disabled]), #mobile-search-box textarea:not([disabled]), #mobile-search-box input, #mobile-search-box select, #popular-search-box a[href]:not([disabled]), #popular-search-box button:not([disabled]), #popular-search-box textarea:not([disabled]), #popular-search-box input:not([disabled]), #popular-search-box select:not([disabled])"),firstFocusableEl=focusableEls[0],lastFocusableEl=focusableEls[focusableEls.length-1];(e.key==="Tab"||e.keyCode===9)&&(e.shiftKey?document.activeElement===firstFocusableEl&&(lastFocusableEl.focus(),e.preventDefault()):document.activeElement===lastFocusableEl&&(firstFocusableEl.focus(),e.preventDefault()))},handleDesktopSearchKeyboardEvents=e=>{e.key==="Escape"&&closeDesktopSearch()},openDesktopSearch=e=>{const parent=e.currentTarget.parentElement.parentElement;if(parent.classList.contains("open-search"))document.querySelector(".desktop-search-input").value==""?(parent.classList.remove("open-search"),document.getElementById("popular-search-box")?.classList.remove("open-search"),document.getElementById("desktop-search-ui")?.classList.add("invisible"),document.getElementById("popular-search-box")?.classList.add("invisible"),document.querySelector("body").removeEventListener("click",closeSearchBody)):document.getElementById("desktop-search-form").submit();else{const searchInput=document.querySelector(".desktop-search-input");searchInput&&setTimeout(()=>{searchInput.focus()},1),parent.classList.add("open-search"),document.getElementById("desktop-search-ui").classList.remove("invisible"),document.getElementById("popular-search-box")?.classList.remove("invisible"),document.getElementById("popular-search-box")?.classList.add("open-search"),document.querySelector("body").addEventListener("click",closeSearchBody),document.addEventListener("keydown",handleDesktopSearchKeyboardEvents)}document.querySelector("#popular-search-box")?.addEventListener("keydown",trapSearchFocus),document.querySelector(".header-container")?.addEventListener("keydown",trapSearchFocus)},closeDesktopSearch=()=>{document.getElementById("desktop-search-icon").classList.remove("open-search"),document.getElementById("popular-search-box")?.classList.remove("open-search"),document.querySelector("body").removeEventListener("click",closeSearchBody),document.removeEventListener("keydown",handleDesktopSearchKeyboardEvents),document.querySelector("#popular-search-box")?.removeEventListener("keydown",trapSearchFocus),document.querySelector(".header-container")?.removeEventListener("keydown",trapSearchFocus),document.body.classList.remove("ss__autocomplete--active"),document.querySelector(".desktop-search-container-content").focus(),resetFocusOutline()},openMobileSearch=e=>{const button=e.currentTarget,searchBox=document.getElementById("mobile-search-box");button.classList.contains("active-search")||(button.classList.add("active-search"),button.classList.add("stroke1"),searchBox.classList.add("open-mobile-search"),document.getElementById("popular-search-box")?.classList.add("open-search"),document.getElementById("popular-search-box")?.classList.add("visible"),document.getElementById("popular-search-box")?.classList.remove("invisible"),document.getElementById("mobile-search-ui")?.classList.remove("invisible"),document.getElementById("mobile-search-ui")?.classList.add("visible"),document.getElementById("mobile-search-box")?.focus(),document.querySelector(".mobile-search-input")?.focus(),button.removeEventListener("click",openMobileSearch),button.addEventListener("click",closeMobileSearch),setTimeout(()=>{document.querySelector("body").addEventListener("click",closeSearchBody)},10)),document.querySelector("#popular-search-box")?.addEventListener("keydown",trapMobileSearchFocus)},mobileSearch=e=>{const form=document.getElementById("mobile-search-form"),{value}=document.querySelector(".mobile-search-input");value!==""?form.submit():closeMobileSearch(null)},closeSearchBody=e=>{const body=e.currentTarget,header=document.querySelector("header");!header.contains(e.target)&&!e.target.contains(header)&&(document.getElementById("desktop-search-icon").classList.remove("open-search"),document.getElementById("popular-search-box")?.classList.remove("open-search"),body.removeEventListener("click",closeSearchBody))},closeMobileSearch=e=>{const button=document.getElementById("mobile-search-button"),searchBox=document.getElementById("mobile-search-box");button.classList.remove("active-search"),button.classList.remove("stroke1"),button.addEventListener("click",openMobileSearch),button.removeEventListener("click",closeMobileSearch),searchBox.classList.remove("open-mobile-search"),document.getElementById("popular-search-box")?.classList.remove("open-search"),document.getElementById("popular-search-box")?.classList.remove("visible"),document.getElementById("mobile-search-ui").classList.remove("visible"),document.querySelector("body").removeEventListener("click",closeSearchBody),document.querySelector("#popular-search-box")?.removeEventListener("keydown",trapMobileSearchFocus)},mobileSearchIcon=document.getElementById("mobile-search-button");mobileSearchIcon&&(mobileSearchIcon.addEventListener("click",openMobileSearch),mobileSearchIcon.addEventListener("keydown",enterEvent),document.querySelector(".mobile-close-search").addEventListener("click",closeMobileSearch),document.querySelector(".mobile-close-search").addEventListener("keydown",enterEvent),document.querySelector(".mobile-search-icon").addEventListener("click",mobileSearch),document.querySelector(".mobile-search-icon").addEventListener("keydown",enterEvent));const desktopSearchIcon=document.getElementById("desktop-search-icon");desktopSearchIcon&&(desktopSearchIcon.querySelector(".desktop-search-container-content").addEventListener("click",openDesktopSearch),desktopSearchIcon.querySelector(".desktop-search-container-content").addEventListener("keydown",enterEvent),desktopSearchIcon.querySelector(".desktop-search-close").addEventListener("click",closeDesktopSearch),desktopSearchIcon.querySelector(".search-icon").addEventListener("keydown",enterEvent),desktopSearchIcon.querySelector(".desktop-search-close").addEventListener("keydown",enterEvent)),document.querySelectorAll(".play-button").forEach(button=>{button.addEventListener("click",playVideo),button.addEventListener("keydown",enterEvent)}),document.querySelectorAll(".anchor-link").forEach(anchor=>{anchor.addEventListener("click",scrollToAnchor),anchor.addEventListener("keydown",enterEvent)});const useConfig=()=>{const{shop}=window.Shopify,ENVIRONMENT=shop==="birdygrace.myshopify.com"?"production":"development",config={development:{platform_url:"https://platform.birdystaging.com/api"},production:{platform_url:"https://platform.birdygrey.com/api"}},{platform_url:platformURL}=config[ENVIRONMENT];return{platformURL}},submitFooterEmail=e=>{const{platformURL}=useConfig(),button=e.currentTarget,date=document.getElementById("footer-wedding-date"),email=document.getElementById("footer-email-address");let valid=!0,role;const now=Date.now(),body={initialTS:now,popupTS:now+15e3,submitTS:now+2e4,bot:0,signupLocation:"footer"};document.querySelectorAll(".footer-role-radio").forEach(radio=>{radio.checked&&(role=radio.value,role=="bride"||role=="bridesmaid"||role=="groomsman"||role=="groom"||role=="just shopping"?body.role=role:valid=!1)}),date.value&&(/^\d{4}[/-](0?[1-9]|1[012])[/-](0?[1-9]|[12][0-9]|3[01])$/.test(date.value)?body.date=date.value:valid=!1);const validEmail=/^(?=.*[@])(?=.*\.com)[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/.test(email.value),emailErrorMessage=document.querySelector(".email-form-error-message");validEmail?(body.email=email.value,emailErrorMessage.classList.add("hidden"),email.classList.remove("border-brand-errorText"),email.classList.remove("!text-brand-errorText")):(valid=!1,emailErrorMessage.classList.remove("hidden"),email.classList.add("border-brand-errorText"),email.classList.add("!text-brand-errorText")),valid&&(button.removeEventListener("click",submitFooterEmail),button.removeEventListener("keydown",enterEvent),button.innerText="SIGNING UP...",fetch(`${platformURL}/v1/customer/signup`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(body)}).then(res=>res.json()).then(response=>{button.innerText="YOU'RE IN!",trackLead(body.email,{signup_location:"footer",list_id:"Hj8m3A"})}).catch(err=>{console.error(err),button.innerText="SIGN UP"}))},footerEmailSubmit=document.getElementById("footer-email-submit");footerEmailSubmit&&(footerEmailSubmit.addEventListener("click",submitFooterEmail),footerEmailSubmit.addEventListener("keydown",enterEvent)),window.addEventListener("resize",checkCarouselButtons),window.addEventListener("resize",checkCarouselPosition),window.addEventListener("resize",resetMobility);const cartSuccess=(lines,newCart,klaviyoProduct)=>{if(!lines||!Array.isArray(lines.items)){console.error("cartSuccess: lines.items should be a non-empty array");return}lines.items.forEach(line=>{trackAddToCart(line,newCart,klaviyoProduct);const attributionKey=line.key,attributionId=line.id;let cart_attribution={};if(localStorage.atc_attribution)try{cart_attribution=JSON.parse(localStorage.atc_attribution)}catch(err){console.error("Invalid JSON in atc_attribution",err)}cart_attribution[attributionKey]||(cart_attribution[attributionKey]={}),attributionId&&(cart_attribution[attributionKey].line_id=attributionId),localStorage.iS&&(cart_attribution[attributionKey].initial_source=localStorage.iS),localStorage.iM&&(cart_attribution[attributionKey].initial_medium=localStorage.iM),localStorage.iC&&(cart_attribution[attributionKey].initial_campaign=localStorage.iC),localStorage.iCo&&(cart_attribution[attributionKey].initial_content=localStorage.iCo),localStorage.iT&&(cart_attribution[attributionKey].initial_timestamp=localStorage.iT),localStorage.vS&&(cart_attribution[attributionKey].visit_source=localStorage.vS),localStorage.vM&&(cart_attribution[attributionKey].visit_medium=localStorage.vM),localStorage.vC&&(cart_attribution[attributionKey].visit_campaign=localStorage.vC),localStorage.vCo&&(cart_attribution[attributionKey].visit_content=localStorage.vCo),localStorage.vT&&(cart_attribution[attributionKey].visit_timestamp=localStorage.vT),cart_attribution[attributionKey].atc_ts=Date.now(),localStorage.atc_attribution=JSON.stringify(cart_attribution)})},buildVimeoVideo=e=>{window.focusReturn=e.currentTarget;const{video}=e.currentTarget.dataset,modalContent=`
`;buildModal(modalContent)};document.querySelectorAll(".vimeo-popup").forEach(vimeo=>{vimeo.addEventListener("click",buildVimeoVideo),vimeo.addEventListener("keydown",enterEvent)});const buildStepsPopup=e=>{window.focusReturn=e.currentTarget;const{steps}=e.currentTarget.dataset,{image}=e.currentTarget.dataset,modalContent=`
${steps}
`;buildModal(modalContent)};document.querySelectorAll(".steps-popup").forEach(steps=>{steps.addEventListener("click",buildStepsPopup),steps.addEventListener("keydown",enterEvent)});const activateDress=e=>{const container=e.currentTarget;container.classList.contains("active-dress")?container.classList.remove("active-dress"):container.classList.add("active-dress")};document.querySelectorAll(".meet-dresses-item").forEach(item=>{item.addEventListener("click",activateDress),item.addEventListener("keydown",enterEvent)});const showRecovery=()=>{const recoverForm=document.getElementById("RecoverPasswordForm"),recoverHeading=document.querySelector(".reset-password-heading"),loginHeading=document.querySelector(".login-heading");recoverForm&&(recoverForm.classList.contains("none")?(recoverHeading.classList.remove("none"),loginHeading.classList.add("none"),recoverForm.classList.remove("none"),document.getElementById("CustomerLoginForm").classList.add("none")):(recoverForm.classList.add("none"),recoverHeading.classList.add("none"),loginHeading.classList.remove("none"),document.getElementById("CustomerLoginForm").classList.remove("none")))};window.location.pathname==="/account/login"&&window.location.hash==="#recover"&&showRecovery(),document.querySelectorAll(".recover-password").forEach(recover=>{recover.addEventListener("click",showRecovery),recover.addEventListener("keydown",enterEvent)});const equalizeScroll=e=>{const scrolled=e.currentTarget,offset=scrolled.scrollLeft;document.querySelectorAll(".reward-grid").forEach(grid=>{grid!==scrolled&&(grid.scrollLeft=offset)})};document.querySelectorAll(".reward-grid").forEach(grid=>{grid.addEventListener("scroll",equalizeScroll)});const correctForm=e=>{e.preventDefault();const form=e.currentTarget,input=form.querySelector("input"),value=input.value.toLowerCase();(value.includes("rose quartz")||value.includes("dessert rose"))&&(input.value="Desert Rose"),(value.includes("terra cotta")||value.includes("teracotta"))&&(input.value="Terracotta"),(value.includes("gwinnie")||value.includes("gweenie"))&&(input.value="Gwennie"),value.includes("devon")&&(input.value="Devin"),value.includes("bowtie")&&(input.value="bow tie"),form.submit()},desktopSearchForm=document.getElementById("desktop-search-form"),mobileSearchForm=document.getElementById("mobile-search-form");desktopSearchForm&&desktopSearchForm.addEventListener("submit",correctForm),mobileSearchForm&&mobileSearchForm.addEventListener("submit",correctForm); //# sourceMappingURL=/cdn/shop/t/2915/assets/scripts.js.map