PageSourceSearch

https://www.promgirl.com/cdn/shop/t/191/assets/global.js?v=14616822002860122991790010536

js promgirl.com collected 2026-10-02 14:53:19 UTC 40,558 bytes, 2 lines download raw bytes

1const trapFocusHandlers={};let previouslyFocusedElement=null;function getFocusableElements(container){return Array.from(container.querySelectorAll("summary, a:not([tabindex^='-']), button:enabled:not([tabindex^='-']), [tabindex]:not([tabindex^='-']), [draggable], area, input:not([type=hidden]):enabled, select:enabled, textarea:enabled, object, iframe"))}function trapFocus(container){removeTrapFocus();const current=document.activeElement;previouslyFocusedElement=current&&!container.contains(current)?current:null;function setFocusableElements(){const elements=getFocusableElements(container);trapFocusHandlers.first=elements[0],trapFocusHandlers.last=elements[elements.length-1]}setFocusableElements(),trapFocusHandlers.focusin=event=>{event.target!==container&&event.target!==trapFocusHandlers.last&&event.target!==trapFocusHandlers.first||document.addEventListener("keydown",trapFocusHandlers.keydown)},trapFocusHandlers.focusout=()=>document.removeEventListener("keydown",trapFocusHandlers.keydown),trapFocusHandlers.keydown=event=>{event.code.toUpperCase()==="TAB"&&(event.target===trapFocusHandlers.last&&!event.shiftKey&&(event.preventDefault(),trapFocusHandlers.first?.focus()),(event.target===container||event.target===trapFocusHandlers.first)&&event.shiftKey&&(event.preventDefault(),trapFocusHandlers.last?.focus()))},document.addEventListener("focusout",trapFocusHandlers.focusout),document.addEventListener("focusin",trapFocusHandlers.focusin);const observer=new MutationObserver(()=>{setFocusableElements(),container.contains(document.activeElement)||trapFocusHandlers.first?.focus()});observer.observe(container,{childList:!0,subtree:!0}),trapFocusHandlers.disconnect=()=>observer.disconnect(),trapFocusHandlers.update=setFocusableElements,trapFocusHandlers.first?.focus()}function removeTrapFocus(elementToFocus=null){document.removeEventListener("focusin",trapFocusHandlers.focusin),document.removeEventListener("focusout",trapFocusHandlers.focusout),document.removeEventListener("keydown",trapFocusHandlers.keydown),trapFocusHandlers.disconnect?.(),!elementToFocus&&previouslyFocusedElement?.isConnected&&(elementToFocus=previouslyFocusedElement),elementToFocus&&elementToFocus.focus(),previouslyFocusedElement=null,delete trapFocusHandlers.first,delete trapFocusHandlers.last,delete trapFocusHandlers.update}function debounce(fn,wait){let t;return(...args)=>{clearTimeout(t),t=setTimeout(()=>fn.apply(this,args),wait)}}function throttle(fn,wait){let t=!1;return(...args)=>{t||(fn.apply(this,args),t=!0,setTimeout(()=>t=!1,wait))}}typeof window.Woolman>"u"&&(window.Woolman={}),Woolman.bind=function(fn,scope){return function(){return fn.apply(scope,arguments)}},Woolman.init=function(){if(Woolman.ModalsAndDrawers.init(),Woolman.Header.init(),Woolman.DetailsAccordions.init(),!Shopify||!Shopify.designMode)return;let lastSelection={sectionId:void 0,blockId:void 0};document.addEventListener("shopify:section:load",evt=>{"shopify-section-"+evt.detail.sectionId===Woolman.Header.cache.section.id&&(Woolman.ModalsAndDrawers.init(),Woolman.Header.init()),document.querySelector(`[data-modal][data-section-id="${evt.detail.sectionId}"]`)&&Woolman.ModalsAndDrawers.showModalOrDrawer(document.querySelector(`[data-modal][data-section-id="${evt.detail.sectionId}"]`).id),console.log("shopify:section:load sectionId",evt.detail.sectionId),console.log("lastSelection",lastSelection)}),document.addEventListener("shopify:block:select",evt=>{const sectionId="shopify-section-"+evt.detail.sectionId,selectedBlock=[...document.getElementById(sectionId).querySelectorAll("[data-shopify-editor-block]")].find(x=>JSON.parse(x.dataset.shopifyEditorBlock).id===evt.detail.blockId);if(sectionId===Woolman.Header.cache.section.id){if(selectedBlock){Woolman.Header.cache.openButton.click();const accordion=selectedBlock.closest("[data-accordion-item]").querySelector("input"),label=selectedBlock.closest("[data-accordion-item]").querySelector("label");accordion.checked||label.click()}}else sectionId.includes("modal")&&document.getElementById(sectionId).querySelector("[data-modal]")&&selectedBlock&&Woolman.ModalsAndDrawers.showModalOrDrawer(document.getElementById(sectionId).querySelector("[data-modal]").id);lastSelection.sectionId=evt.detail.sectionId,lastSelection.blockId=evt.detail.blockId,console.log("shopify:block:select",evt.detail.sectionId,evt.detail.blockId),console.log("lastSelection",lastSelection)}),document.addEventListener("shopify:section:unload",evt=>{console.log("shopify:section:unload sectionId",evt.detail.sectionId)}),document.addEventListener("shopify:section:select",evt=>{console.log("shopify:section:select",evt.detail.sectionId),lastSelection={sectionId:evt.detail.sectionId,blockId:evt.detail.blockId},evt.detail.sectionId.includes("modal")&&document.querySelector(`[data-modal][data-section-id="${evt.detail.sectionId}"]`)&&Woolman.ModalsAndDrawers.showModalOrDrawer(document.querySelector(`[data-modal][data-section-id="${evt.detail.sectionId}"]`).id),console.log("lastSelection",lastSelection)}),document.addEventListener("shopify:section:deselect",evt=>{console.log("shopify:section:deselect",evt.detail.sectionId),lastSelection={sectionId:void 0,blockId:void 0},evt.detail.sectionId.includes("modal")&&document.querySelector(`[data-modal][data-section-id="${evt.detail.sectionId}"]`)&&Woolman.ModalsAndDrawers.closeModalOrDrawer(document.querySelector(`[data-modal][data-section-id="${evt.detail.sectionId}"]`).id),console.log("lastSelection",lastSelection)})},Woolman.Utils={debugMode:!0,prepareQueryParams:()=>
1{if(Shopify.queryParams=Shopify.queryParams||{},location.search.length){const params=location.search.substr(1).split("&");for(let i=0;i<params.length;i++){const keyValue=params[i].split("=");keyValue.length&&(Shopify.queryParams[decodeURIComponent(keyValue[0])]=decodeURIComponent(keyValue[1]).replaceAll("+"," "))}}return Shopify.queryParams},formatMoney(cents,format){const default_money_format=theme.settings.moneyFormat||"\u20AC{{amount}}";typeof cents=="string"&&(cents=cents.replace(".","")),window?.Shopify?.currency?.rate&&(cents=cents*parseFloat(window.Shopify.currency.rate||1));var value="",placeholderRegex=/\{\{\s*(\w+)\s*\}\}/,formatString=format||default_money_format;function defaultOption(opt,def){return typeof opt>"u"?def:opt}function formatWithDelimiters(number,precision,thousands,decimal){if(precision=defaultOption(precision,2),thousands=defaultOption(thousands,","),decimal=defaultOption(decimal,"."),isNaN(number)||number==null)return 0;number=(number/100).toFixed(precision);var parts=number.split("."),dollars=parts[0].replace(/(\d)(?=(\d\d\d)+(?!\d))/g,"$1"+thousands),cents2=parts[1]?decimal+parts[1]:"";return dollars+cents2}switch(formatString.match(placeholderRegex)[1]){case"amount":value=formatWithDelimiters(cents,2);break;case"amount_no_decimals":value=formatWithDelimiters(cents,0);break;case"amount_with_comma_separator":value=formatWithDelimiters(cents,2,".",",");break;case"amount_no_decimals_with_comma_separator":value=formatWithDelimiters(cents,0,".",",");break}return formatString.replace(placeholderRegex,value)}},Woolman.Header={selectors:{header:"MainHeader",cartBlip:".cart-blip"},cache:{header:void 0,cartBlip:void 0,section:void 0,openButton:void 0},init:function(){this.cache.header=document.getElementById(this.selectors.header),this.cache.cartBlip=this.cache.header.querySelector(this.selectors.cartBlip),this.cache.section=this.cache.header.closest(".shopify-section"),this.cache.openButton=this.cache.header.querySelector('[href="#drawer-menu"]'),this.setHeaderHeightVar(),window.addEventListener("resize",throttle(this.setHeaderHeightVar.bind(this),40)),document.addEventListener("ajaxProduct:added",this.updateCartBlip.bind(this)),document.addEventListener("cart:update",this.updateCartBlip.bind(this)),this.cache.header.dataset.stickyBehavior!=="none"&&this.initStickyBehavior(this.cache.header.dataset.stickyBehavior)},setHeaderHeightVar:function(){if(!this.cache.header)return;const headerHeight=this.cache.header.offsetHeight;document.documentElement.style.setProperty("--header-height",`${headerHeight}px`)},initStickyBehavior(behaviorType){const stickyConfig={headerHeight:this.cache.header.clientHeight,behavior:behaviorType};if(document.documentElement.classList.add("sticky-header-initialized",`sticky-header-${behaviorType}`),document.documentElement.style.setProperty("--sticky-header-margin-top",`${stickyConfig.headerHeight}px`),behaviorType==="scroll"||behaviorType==="fixed"){let prevScroll=window.scrollY||document.documentElement.scrollTop,curScroll,direction=0,prevDirection=0;const toggleStickyHeader=(direction2,curScroll2)=>{direction2===1||curScroll2<stickyConfig.headerHeight?document.documentElement.classList.remove("sticky-header-hide"):direction2===2&&curScroll2>stickyConfig.headerHeight&&document.documentElement.classList.add("sticky-header-hide"),prevDirection=direction2};window.addEventListener("scroll",throttle(()=>{curScroll=window.scrollY||document.documentElement.scrollTop,curScroll>=300?document.documentElement.classList.add("sticky-header-show"):document.documentElement.classList.remove("sticky-header-show"),curScroll>prevScroll?direction=2:direction=1,direction!==prevDirection&&behaviorType==="scroll"&&toggleStickyHeader(direction,curScroll),prevScroll=curScroll},50)),setInterval(()=>{direction===2&&behaviorType==="scroll"&&curScroll>=900&&toggleStickyHeader(direction,curScroll),window.scrollY===0&&document.documentElement.classList.remove("sticky-header-show","sticky-header-hide")},200)}},async updateCartBlip(e){const cart=e.detail&&e.detail.cart&&e.detail.cart.item_count||await(async function(){return await(await fetch("/cart.json")).json()})();this.cache.cartBlip.textContent=cart.item_count||0,cart&&cart.item_count==0?(this.cache.cartBlip.setAttribute("hidden",!0),this.cache.cartBlip.closest(".header-item__link").classList.remove("has-blip-visible")):(this.cache.cartBlip.removeAttribute("hidden"),this.cache.cartBlip.closest(".header-item__link").classList.add("has-blip-visible"));const total_in_notification=document.querySelector("#cart-notification-link .cart-total");total_in_notification&&(total_in_notification.textContent=cart.item_count)}
1};class HeaderDropdown extends HTMLElement{constructor(){super(),this.details=this.querySelector("details"),this.summary=this.querySelector("summary"),this.header=this.closest("header"),this.timer=null,this.summary.addEventListener("mouseenter",this.openDropdown.bind(this)),this.details.addEventListener("mouseenter",this.clearCloseTimer.bind(this)),this.details.addEventListener("mouseleave",this.startCloseTimer.bind(this)),this.summary.addEventListener("keydown",this.handleKeydown.bind(this))}openDropdown(){this.closeOtherDropdowns(),this.details.open=!0,this.details.offsetHeight,this.header&&this.header.classList.add("sub-menu-open")}closeOtherDropdowns(){this.header&&this.header.querySelectorAll("header-dropdown details[open]").forEach(dropdown=>{if(dropdown!==this.details){dropdown.open=!1;const parentDropdown=dropdown.closest("header-dropdown");parentDropdown&&typeof parentDropdown.clearCloseTimer=="function"&&parentDropdown.clearCloseTimer()}})}startCloseTimer(){this.timer=setTimeout(()=>{this.details.open=!1,this.header&&this.header.classList.remove("sub-menu-open")},600)}clearCloseTimer(){this.timer&&(clearTimeout(this.timer),this.timer=null)}handleKeydown(event){(event.key==="Enter"||event.key===" ")&&(event.preventDefault(),this.details.open?(this.details.open=!1,this.header&&this.header.classList.remove("sub-menu-open")):this.openDropdown())}}customElements.define("header-dropdown",HeaderDropdown),Woolman.ModalsAndDrawers={settings:{selectors:{modalLink:'a[href*="#modal"]:not(.quick-buy_link)',drawerLink:'a[href*="#drawer"]'}},focusTraps:{},init:function(){document.querySelectorAll(this.settings.selectors.modalLink).forEach(modalLink=>{modalLink.addEventListener("click",event=>{event.preventDefault();const targetId=event.currentTarget.getAttribute("href").substring(1).split("?")[0],slideIndex=event.currentTarget.getAttribute("href").substring(1).split("?slide=")[1],scrollToId=event.currentTarget.getAttribute("href").substring(1).split("?scroll=")[1];this.showModalOrDrawer(targetId,parseInt(slideIndex),scrollToId)})}),document.querySelectorAll(this.settings.selectors.drawerLink).forEach(drawerLink=>{drawerLink.addEventListener("click",event=>{event.preventDefault();const targetId=event.currentTarget.getAttribute("href").substring(1).split("?")[0];this.showModalOrDrawer(targetId)})});const closeBtns=document.querySelectorAll("[data-close]");closeBtns&&closeBtns.forEach(closeBtn=>{closeBtn.addEventListener("click",this.closeModalOrDrawerOrDrawerFromEvent.bind(this))});const overlays=document.querySelectorAll("[data-overlay]");overlays&&overlays.forEach(overlay=>{overlay.addEventListener("click",this.closeModalOrDrawerOrDrawerFromEvent.bind(this))}),document.addEventListener("keydown",function(event){if(event.key==="Escape"||event.keyCode===27){const hadOpen=document.querySelector(".drawer.is-open, .modal.is-open");document.querySelectorAll(".drawer").forEach(drawer=>{drawer.classList.remove("is-open")}),document.querySelectorAll(".modal").forEach(modal=>{modal.classList.remove("is-open")}),document.body.classList.remove("overflow-hidden"),hadOpen&&typeof removeTrapFocus=="function"&&removeTrapFocus()}})},showModalOrDrawer:function(targetId,slideIndex,scrollToId){const targetElement=document.getElementById(targetId);if(!targetElement&&Woolman.Utils.debugMode&&console.warn("No modal/drawer element specified"),!!targetElement&&!targetElement.classList.contains("is-open")){if(targetElement.classList.add("initialized","is-open"),document.body.classList.add("overflow-hidden"),setTimeout(()=>{trapFocus(targetElement);const drawerSearchInput=targetElement.querySelector("#drawerSearchInput");drawerSearchInput&&drawerSearchInput.focus()},600),slideIndex)setTimeout(()=>{targetElement.querySelector("gridy-slider").scrollToSlide(slideIndex-1)},600);else if(scrollToId){const scrollToElement=document.getElementById(scrollToId);targetElement.querySelector(".gridy-track").scrollTo({top:scrollToElement.offsetTop,left:scrollToElement.offsetLeft,behavior:"instant"})}}},closeModalOrDrawer:function(targetId){document.getElementById(targetId).classList.remove("is-open"),document.body.classList.remove("overflow-hidden")},closeModalOrDrawerOrDrawerFromEvent:function(event){event.preventDefault(),removeTrapFocus(),event.currentTarget.closest("[data-parent]").classList.remove("is-open"),document.body.classList.remove("overflow-hidden")}};let woolman_window_size=window.innerWidth;window.addEventListener("resize",debounce(()=>{window.innerWidth!=woolman_window_size&&(woolman_window_size=window.innerWidth,document.dispatchEvent(new CustomEvent("woolman:resize")))}),250);class Accordion{constructor(el){el.hasAttribute("data-no-accordion-logic")||(this.el=el,this.summary=el.querySelector("summary"),this.content=el.querySelector(".content"),this.video=this.content?this.content.querySelector("video"):null,this.animation=null,this.isClosing=!1,this.isExpanding=!1,this.summary.addEventListener("click",e=>this.onClick(e)),this.toggleByViewport(),document.addEventListener("woolman:resize",this.toggleByViewport.bind(this)))}onClick(e){e.preventDefault(),this.el.style.overflow="hidden",this.isClosing||!this.el.open?this.open():(this.isExpanding||this.el.open)&&this.shrink()}shrink(){this.isClosing=!0,this.video&&!this.video.paused&&this.video.pause();const startHeight=`${this.el.offsetHeight}px`,endHeight=`${this.summary.offsetHeight}px`;this.animation&&this.animation.cancel(),this.animation=this.el.animate({height:[startHeight,endHeight]},{duration:400,easing:"ease-in-out"}),this.animation.onfinish=()=>this.onAnimationFinish(!1),this.animation.oncancel=()=>this.isClosing=!1}open(){this.el.style.height=`${this.el.offsetHeight}px`,this.el.open=!0,window.requestAnimationFrame(()=>this.expand())}expand(){this.isExpanding=!0;const startHeight=`${this.el.offsetHeight}px`,endHeight=`${this.summary.offsetHeight+this.content.offsetHeight}px`;this.animation&&this.animation.cancel(),this.animation=this.el.animate({height:[startHeight,endHeight]},{duration:400,easing:"ease-out"}),this.animation.onfinish=()=>this.onAnimationFinish(!0),this.animation.oncancel=()=>this.isExpanding=!1}onAnimationFinish(open){this.el.open=open,this.animation=null,this.isClosing=!1,this.isExpanding=!1,this.el.style.height=this.el.style.overflow="",!open&&this.video&&!this.video.paused&&this.video.pause()}toggleByViewport(){let mobileClose=this.el.dataset.mobileClose!=null?JSON.parse(this.el.dataset.mobileClose):!1,desktopOpen=this.el.dataset.desktopOpen!=null?JSON.parse(this.el.dataset.desktopOpen):!1;woolman_window_size>
1=768&&desktopOpen?this.el.open=!0:mobileClose&&(this.el.open=!1,this.video&&!this.video.paused&&this.video.pause())}}Woolman.DetailsAccordions={init:function(){document.querySelectorAll("details").forEach(el=>{new Accordion(el)})}},Woolman.init();class LocalizationForm extends HTMLElement{constructor(){super(),this.elements={input:this.querySelector('input[name="locale_code"], input[name="country_code"]')},this.querySelectorAll("a[data-value], button[data-value]").forEach(item=>item.addEventListener("click",this.onItemClick.bind(this)))}onItemClick(event){event.preventDefault();const form=this.querySelector("form");this.elements.input.value=event.currentTarget.dataset.value;let return_to_value=form.querySelector('[name="return_to"]').value,indexOfFilters=return_to_value.indexOf("?filter");if(indexOfFilters!==-1){let replacedSubstring=return_to_value.substring(indexOfFilters).replace(/%2C/g,",");form.querySelector('[name="return_to"]').value=return_to_value.substring(0,indexOfFilters)+replacedSubstring}form&&form.submit()}}customElements.define("localization-form",LocalizationForm);class SuperPoweredVideo extends HTMLElement{constructor(){if(super(),this.video=this.querySelector("video")||this.querySelector("iframe"),this.container=this.closest(".video-container")||null,this.container&&this.attachClickListener(this.closest(".video-container")),this.video.nodeName==="IFRAME"&&this.video.src&&this.video.src.includes("youtube")&&!this.container&&this.video.addEventListener("load",this.onVideoLoad.bind(this)),!(this.dataset.autoplay||!1)||this.container)return;const videoType=this.video.nodeName==="VIDEO"?"video":"iframe",videoHost=this.video.nodeName==="VIDEO"?"shopify":this.video.src.includes("youtube")?"youtube":"vimeo";new IntersectionObserver(entries=>{entries.forEach(entry=>{entry.isIntersecting?videoType=="video"?this.video.play():videoHost=="youtube"?this.video.contentWindow.postMessage('{"event":"command","func":"playVideo","args":""}',"*"):videoHost=="vimeo"&&this.video.contentWindow.postMessage('{"method":"play"}',"*"):videoType=="video"?this.video.pause():videoHost=="youtube"?this.video.contentWindow.postMessage('{"event":"command","func":"pauseVideo","args":""}',"*"):videoHost=="vimeo"&&this.video.contentWindow.postMessage('{"method":"pause"}',"*")})},{threshold:.5}).observe(this.video)}attachClickListener(videoContainer){videoContainer&&(videoContainer.addEventListener("click",e=>{this.video.paused?this.video.play():this.video.pause()}),this.video.onplay=()=>{videoContainer.querySelector("button").hidden=!0},this.video.onpause=()=>{videoContainer.querySelector("button").hidden=!1})}onVideoLoad(){this.video.contentWindow.postMessage('{"event":"command","func":"playVideo","args":""}',"*")}}customElements.define("superpowered-video",SuperPoweredVideo);class GridySlider extends HTMLElement{constructor(){super(),this.track=this.querySelector(".gridy-track"),this.slides=this.querySelectorAll(".gridy-track > *");const child_count=this.track.childElementCount,data_ipr_desktop=parseInt(this.dataset.iprDesktop,10)||1,data_ipr_tablet=parseInt(this.dataset.iprTablet,10)||data_ipr_desktop,data_ipr_mobile=parseInt(this.dataset.iprMobile,10)||1,data_init_scroll_to=this.dataset.initScrollTo,data_autoplay=this.dataset.autoplay!=null?JSON.parse(this.dataset.autoplay):!1,data_autoplay_delay=parseInt(this.dataset.autoplayDelay,10)||5e3,data_is_thumbnails_slider=this.dataset.thumbnailsFor!=null,data_indicator=this.dataset.indicator!=null?JSON.parse(this.dataset.indicator):!1,data_sliding_behavior=this.dataset.slidingBehavior,data_thumbnail_slider=document.getElementById(`thumbnail-${this.id}`),data_track_overflow_visible=this.dataset.overflowVisible!=null;if(this.config={slide_count:child_count,current_slide:0,active_slide_offset:0,ipr_desktop:data_ipr_desktop,ipr_tablet:data_ipr_tablet,ipr_mobile:data_ipr_mobile,breakpoint_tablet:768,breakpoint_desktop:1024,arrows:!0,autoplay:data_autoplay||!1,autoplay_delay:data_autoplay_delay,timer:null,is_thumbnails_slider:data_is_thumbnails_slider,thumbnails_for:void 0,thumbnail_slider:data_thumbnail_slider,indicator:data_indicator,track_overflow_visible:data_track_overflow_visible,sliding_behavior:data_sliding_behavior||"all"},data_init_scroll_to!=null&&this.scrollToSlideByID(data_init_scroll_to),this.config.arrows&&(this.buttons=this.querySelectorAll("[data-gridy-arrow]"),this.buttons.forEach(arrowButton=>{arrowButton.addEventListener("click",this.onArrowClick.bind(this))}
1)),this.config.autoplay&&(this.autoplayGridy(),this.addEventListener("mouseenter",this.clearAutoplayTimer),this.addEventListener("mouseleave",this.autoplayGridy),this.addEventListener("touchenter",this.clearAutoplayTimer),this.addEventListener("touchleave",this.autoplayGridy)),this.config.is_thumbnails_slider&&(this.config.active_slide_offset=2,this.config.thumbnails_for=document.getElementById(this.dataset.thumbnailsFor),this.thumbnail=this.querySelectorAll("[data-thumbnail-btn]"),this.thumbnail.forEach(thumbnail=>{thumbnail.addEventListener("click",this.onThumbnailClick.bind(this))})),this.config.indicator&&(this.indicator_dots=this.querySelectorAll("[data-indicator-dot]"),this.indicator_current=this.querySelector("[data-indicator-current]")),!this.config.is_thumbnails_slider){let scrollTimeout;this.track.addEventListener("scroll",function(){clearTimeout(scrollTimeout),scrollTimeout=setTimeout(this.afterScrollStops.bind(this),200)}.bind(this))}}afterScrollStops(){let slideInView=this.firstSlideInView();this.config.current_slide=slideInView,this.setActiveSlide(this.slides[slideInView+this.config.active_slide_offset]),this.config.thumbnail_slider&&this.config.thumbnail_slider.scrollToSlide(slideInView)}autoplayGridy(){this.config.timer=setInterval(this.scrollByIPR.bind(this),this.config.autoplay_delay,"next")}clearAutoplayTimer(){clearInterval(this.config.timer),this.config.timer=null}onThumbnailClick(event){event.preventDefault(),this.config.current_slide=Array.from(event.currentTarget.parentNode.children).indexOf(event.currentTarget),this.config.thumbnails_for.scrollToSlideByID(event.currentTarget.dataset.itemId),this.scrollToSlide(this.config.current_slide)}onArrowClick(event){this.scrollByIPR(event.currentTarget.dataset.direction)}scrollByIPR(direction){let currentIPR=this.getCurrentIPR(),slideMultiplier=this.config.sliding_behavior=="all"?currentIPR:1,newCurrentSlide=this.config.current_slide,lastToShow=this.config.slide_count-currentIPR;direction==="next"?(newCurrentSlide=newCurrentSlide+slideMultiplier,this.config.current_slide>=lastToShow&&(newCurrentSlide=0)):direction==="prev"&&(newCurrentSlide=newCurrentSlide-slideMultiplier,this.config.current_slide>0&&newCurrentSlide<0?newCurrentSlide=0:newCurrentSlide<0&&(newCurrentSlide=lastToShow)),this.config.current_slide=newCurrentSlide,this.scrollToSlide(newCurrentSlide)}scrollToSlide(newPosition){if(isNaN(newPosition))return;let slidePosWithOffset=newPosition-this.config.active_slide_offset,newScrollToSlidePos=slidePosWithOffset>0?slidePosWithOffset:0;const slideInNewScrollToPos=this.slides[newScrollToSlidePos];let scrollToLeft=slideInNewScrollToPos.offsetLeft,scrollToTop=slideInNewScrollToPos.offsetTop;this.config.track_overflow_visible&&(scrollToLeft=this.slides[newScrollToSlidePos].offsetLeft-this.slides[0].offsetLeft),this.track.scrollTo({left:scrollToLeft,top:scrollToTop,behavior:"smooth"}),this.slides.forEach(item=>{item.classList.remove("active")}),this.slides[newPosition].classList.add("active")}scrollToSlideByID(slideID){const theSlide=document.getElementById(slideID),newPosition=Array.from(theSlide.parentNode.children).indexOf(theSlide);this.scrollToSlide(newPosition)}setActiveSlide(slide){this.slides.forEach(item=>{item.classList.remove("active")}),slide.classList.add("active"),this.config.indicator&&this.indicator_dots&&(this.indicator_current.textContent=this.config.current_slide+1,this.indicator_dots.forEach(dot=>{dot.classList.remove("active")}),this.indicator_dots[this.config.current_slide].classList.add("active"))}getCurrentIPR(){let currentIPR=this.config.ipr_mobile;return woolman_window_size>=this.config.breakpoint_desktop?currentIPR=this.config.ipr_desktop:woolman_window_size>=this.config.breakpoint_tablet&&(currentIPR=this.config.ipr_tablet),currentIPR}firstSlideInView(){let loopIndex=0;for(const slide of this.slides){if(this.isSlideInView(slide))return loopIndex;++loopIndex}return this.config.current_slide}isSlideInView(slide){const containerBounds=this.track.getBoundingClientRect(),slideBounds=slide.getBoundingClientRect();
1return Math.round(slideBounds.top)>=Math.floor(containerBounds.top)&&Math.floor(slideBounds.bottom)<=Math.round(containerBounds.bottom)&&Math.round(slideBounds.left)>=Math.floor(containerBounds.left)&&Math.floor(slideBounds.right)<=Math.round(containerBounds.right)}}customElements.define("gridy-slider",GridySlider);class BeforeAfterSlider extends HTMLElement{constructor(){super(),this.rangeInput=this.querySelector('input[type="range"]'),this.rangeInput&&this.initSlider()}initSlider(){this.updatePosition(this.rangeInput.value),this.rangeInput.addEventListener("input",this.onInput.bind(this)),this.rangeInput.addEventListener("mousedown",this.onMouseDown.bind(this)),this.rangeInput.addEventListener("mouseup",this.onMouseUp.bind(this)),this.rangeInput.addEventListener("touchstart",this.onTouchStart.bind(this)),this.rangeInput.addEventListener("touchend",this.onTouchEnd.bind(this)),this.rangeInput.addEventListener("keydown",this.onKeyDown.bind(this))}updatePosition(value){const position=(value==="0"||value===0?0:Math.max(0,Math.min(1e3,parseFloat(value)||500)))/10+"%";this.style.setProperty("--position",position)}onInput(event){this.updatePosition(event.target.value),this.rangeInput.setAttribute("aria-valuetext",`Showing ${event.target.value}% of before image`)}onMouseDown(){document.body.style.userSelect="none"}onMouseUp(){document.body.style.userSelect=""}onTouchStart(){document.body.style.userSelect="none"}onTouchEnd(){document.body.style.userSelect=""}onKeyDown(event){const min=this.rangeInput.min?parseInt(this.rangeInput.min):0,max=this.rangeInput.max?parseInt(this.rangeInput.max):1e3;let newValue=parseInt(this.rangeInput.value);switch(event.key){case"ArrowLeft":case"ArrowDown":newValue=Math.max(min,newValue-50);break;case"ArrowRight":case"ArrowUp":newValue=Math.min(max,newValue+50);break;case"Home":newValue=min;break;case"End":newValue=max;break;default:return}event.preventDefault(),this.rangeInput.value=newValue,this.updatePosition(newValue)}}customElements.define("before-after-slider",BeforeAfterSlider);class QuantityInput extends HTMLElement{constructor(){super(),this.input=this.querySelector("input"),this.changeEvent=ne
1w Event("change",{bubbles:!0}),this.querySelectorAll("button").forEach(button=>button.addEventListener("click",this.onButtonClick.bind(this)))}onButtonClick(event){event.preventDefault();const previousValue=this.input.value;event.target.name==="plus"?this.input.stepUp():this.input.stepDown(),previousValue!==this.input.value&&this.input.dispatchEvent(this.changeEvent)}}customElements.define("quantity-input",QuantityInput);class VariantSelects extends HTMLElement{constructor(){super()}connectedCallback(){this.addEventListener("change",this.onVariantChange)}disconnectedCallback(){this.removeEventListener("change",this.onVariantChange)}onVariantChange(e){const{isCombinedProduct,targetUrl}=this.combinedListingCheck(e);this.toggleAddButton(!0,"");const productUrl=targetUrl||this.dataset.url;this.updateSelectionMetadata(e),this.fetchProductSection({newProductUrl:productUrl,callback:isCombinedProduct?this.handleCombinedProduct(targetUrl):this.handleUpdateProductInfo()})}combinedListingCheck(e){const currentUrl=window.location.pathname;let targetUrl;if(e.target.type==="radio")targetUrl=e.target.dataset.productUrl;else if(e.target.tagName==="SELECT"){const selectedOption=e.target.selectedOptions[0];targetUrl=selectedOption?selectedOption.dataset.productUrl:void 0}let isCombinedProduct=!1;return targetUrl!=null&&currentUrl!=targetUrl&&(isCombinedProduct=!0),{isCombinedProduct,targetUrl}}async fetchProductSection({newProductUrl,callback}){const params=[];JSON.parse(this.dataset.modal)||!1?params.push("view=ajax-modal"):params.push(`section_id=${this.dataset.section}`),this.selectedOptionValues=this.getSelectedOptionValues();const selectedOptionValues=this.selectedOptionValues?.join(",");params.push(`option_values=${selectedOptionValues}`);const requestUrl=`${newProductUrl}?${params.join("&")}`;fetch(requestUrl).then(response=>response.text()).then(responseText=>{const html=new DOMParser().parseFromString(responseText,"text/html");callback(html)}).catch(error=>{console.error("Error fetching product section:",error)})}handleCombinedProduct(newProductUrl){return html=>{const productElement=this.closest(".main-product");productElement.innerHTML=html.querySelector(".main-product").innerHTML,window.history.replaceState({},"",`${newProductUrl}`)}}updateSelectionMetadata(event){const target=event.target;target.tagName==="SELECT"&&target.selectedOptions.length&&(Array.from(target.options).find(option=>option.getAttribute("selected")).removeAttribute("selected"),target.selectedOptions[0].setAttribute("selected","selected"))}getSelectedOptionValues(){return Array.from(this.querySelectorAll("select option[selected], fieldset input:checked")).map(({dataset})=>dataset.optionValueId)}getSelectedVariant(productInfoNode){const selectedVariant=productInfoNode.querySelector("variant-selects [data-selected-variant]")?.innerHTML,inventory=productInfoNode.querySelector("variant-selects [data-selected-variant-inventory]")?.innerHTML;return selectedVariant?{...JSON.parse(selectedVariant),...JSON.parse(inventory)}:null}handleUpdateProductInfo(){return html=>{this.currentVariant=this.getSelectedVariant(html),this.updatePickupAvailability(),this.removeErrorMessage(),this.currentVariant?(this.updateMedia(),this.updateURL(),this.updateVariantInput(),this.renderProductInfo(html),this.updateShareUrl(),this.applySoldOutLogic()):(this.toggleAddButton(!0,""),this.setUnavailable())}}applySoldOutLogic(){if(!this.currentVariant)return;const productTags=window.productTags||[],hasPreorderTag=productTags.some(t=>t.toLowerCase()==="preorder")||window.woolmanPreorder===!0,hasCustomOrderTag=productTags.includes("custom-order"),inventoryQty=this.currentVariant.inventory_quantity||0,inventoryPolicy=this.currentVariant.inventory_policy||"deny",rawLeadTime=this.getLeadTimeData(this.currentVariant.id)?.lead_time,leadTime=rawLeadTime&&rawLeadTime!=="-"?rawLeadTime:null,leadTimeExpired=this.isLeadTimeExpired(leadTime);if(inventoryQty>0){this.toggleAddButton(!1,window.variantStrings.addToCart),this.updateInventoryStatusText("in_stock"),this.updatePreorderProperty(null);return}const poQueueInfo=this.getPoQueueData(this.currentVariant.id);let winner="sold_out";switch(poQueueInfo?winner="po":hasPreorderTag&&hasCustomOrderTag&&inventoryPolicy==="continue"&&!leadTimeExpired?winner="custom_order":hasPreorderTag&&inventoryPolicy==="continue"&&!leadTimeExpired&&(winner="preorder"),winner){case"po":this.toggleAddButton(!1,window.variantStrings.preOrder),this.updateInventoryStatusText("po_available",poQueueInfo.date),this.updatePreorderProperty("Pre-Order",poQueueInfo.date);break;case"preorder":this.toggleAddButton(!1,window.variantStrings.preOrder),this.updateInventoryStatusText("preorder",leadTime),this.updatePreorderProperty("Pre-Order",leadTime);break;case"custom_order":{this.toggleAddButton(!1,"Custom Order");const customOrderDate=poQueueInfo?poQueueInfo.date:leadTime;this.updateInventoryStatusText("custom_order",customOrderDate),this.updatePreorderProperty("Custom Order",customOrderDate);break}default:this.toggleAddButton(!0,"Sold out"),this.updateInventoryStatusText("sold_out"),this.updatePreorderProperty(null);break}}isLeadTimeExpired(leadTime){if(!leadTime)return!1;let iso=leadTime;if(leadTime.includes("/")){const[m,d,y]=leadTime.split("/");iso=`${y}
1-${String(m).padStart(2,"0")}-${String(d).padStart(2,"0")}`}const date=new Date(iso+"T00:00:00");if(isNaN(date))return!1;const today=new Date;return today.setHours(0,0,0,0),date<today}getLeadTimeData(variantId){const el=document.getElementById("lead-time");if(!el)return null;try{return JSON.parse(el.textContent).find(v=>String(v.id)===String(variantId))||null}catch{return null}}getPoQueueData(variantId){const el=document.getElementById("po-queue-data");if(!el)return null;try{const vData=JSON.parse(el.textContent)[String(variantId)];if(!vData)return null;const activePO=vData.purchase_orders[vData.active_po_index];if(activePO&&activePO.qty_remaining>0){const poDate=new Date(activePO.expected_ship_date+"T00:00:00"),today=new Date;return today.setHours(0,0,0,0),poDate<today?null:{date:activePO.expected_ship_date,qty:activePO.qty_remaining}}return null}catch{return null}}normalizeDate(dateStr){if(!dateStr)return"9999-12-31";if(dateStr.includes("/")){const[month,day,year]=dateStr.split("/");return`${year}-${month.padStart(2,"0")}-${day.padStart(2,"0")}`}return dateStr}formatDateForDisplay(dateStr){if(!dateStr)return null;let parsed;if(dateStr.includes("/")){const[month,day,year]=dateStr.split("/");parsed=new Date(year,month-1,day)}else if(dateStr.includes("-")){const[year,month,day]=dateStr.split("-");parsed=new Date(year,month-1,day)}return parsed&&!isNaN(parsed)?parsed.toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"}):dateStr}updateInventoryStatusText(state,dateStr){const invText=document.querySelector(".inventory-status__text.caption");if(!invText)return;const formattedDate=this.formatDateForDisplay(dateStr);switch(state){case"po_available":invText.textContent="Expected by "+(formattedDate||"");break;case"preorder":invText.textContent=formattedDate?"Pre-Order Ships "+formattedDate:"Preorder";break;case"custom_order":invText.textContent=formattedDate?"Custom Order Ships "+formattedDate:"Custom Order";break;case"sold_out":invText.textContent="Out of stock";break;case"in_stock":break}}updatePreorderProperty(type,dateValue){const input=document.getElementById("variant-preorder");input&&(type?(input.setAttribute("name",`properties[${type}]`),input.value=dateValue||"Yes"):(input.removeAttribute("name"),input.value=""))}updateMedia(){if(!this.currentVariant||!this.currentVariant.featured_media)return;const mediaGridySlider=document.getElementById(`slider-${this.dataset.section}`),thumbnailsGridySlider=document.getElementById(`thumbnail-slider-${this.dataset.section}`);mediaGridySlider&&mediaGridySlider.scrollToSlideByID(`item-${this.currentVariant.featured_media.id}`),thumbnailsGridySlider&&thumbnailsGridySlider.scrollToSlideByID(`thumbnail-item-${this.currentVariant.featured_media.id}`);const isDesktop=window.matchMedia("(min-width: 1024px)").matches,isGrid=mediaGridySlider?.dataset.desktopEnabled==="false";isDesktop&&isGrid&&document.getElementById(`item-${this.currentVariant.featured_media.id}`)?.scrollIntoView()}updateURL(){!this.currentVariant||this.dataset.updateUrl==="false"||window.history.replaceState({},"",`${this.dataset.url}?variant=${this.currentVariant.id}`)}updateShareUrl(){const shareButton=document.getElementById(`Share-${this.dataset.section}`);!shareButton||!shareButton.updateUrl||shareButton.updateUrl(`${window.shopUrl}${this.dataset.url}?variant=${this.currentVariant.id}`)}updateVariantInput(){document.querySelectorAll(`#product-form-${this.dataset.section}, #product-form-installment-${this.dataset.section}, #product-form-${this.dataset.section}-product-buy-bar`).forEach(productForm=>{const input=productForm.querySelector('input[name="id"]');input.value=this.currentVariant.id,input.dispatchEvent(new Event("change",{bubbles:!0})),this.updateInventoryProperties(productForm)})}updateInventoryProperties(form){if(!this.currentVariant)return;
1const inventoryQtyInput=form.querySelector('input[name="properties[_inventory_qty]"]'),inventoryPolicyInput=form.querySelector('input[name="properties[_inventory_policy]"]');inventoryQtyInput&&(inventoryQtyInput.value=this.currentVariant.inventory_quantity||0),inventoryPolicyInput&&(inventoryPolicyInput.value=this.currentVariant.inventory_policy||"deny")}updatePickupAvailability(){const pickUpAvailability=document.querySelector("pickup-availability");pickUpAvailability&&(this.currentVariant&&this.currentVariant.available?pickUpAvailability.fetchAvailability(this.currentVariant.id):(pickUpAvailability.removeAttribute("available"),pickUpAvailability.innerHTML=""))}removeErrorMessage(){const section=this.closest("section");if(!section)return;const productForm=section.querySelector("product-form");productForm&&productForm.handleErrorMessage()}renderProductInfo(html){const updateSourceFromDestination=(id,shouldHide=source=>!1)=>{const source=html.getElementById(`${id}-${this.dataset.section}`),destination=document.getElementById(`${id}-${this.dataset.section}`);source&&destination&&(destination.innerHTML=source.innerHTML,destination.classList.toggle("hidden",shouldHide(source)),destination.querySelectorAll('a[href*="#drawer"]').forEach(drawerLink=>{drawerLink.addEventListener("click",event=>{event.preventDefault();const targetId=event.currentTarget.getAttribute("href").substring(1).split("?")[0];Woolman.ModalsAndDrawers.showModalOrDrawer(targetId)})}),destination.querySelectorAll('a[href*="#modal"]:not(.quick-buy_link)').forEach(modalLink=>{modalLink.addEventListener("click",event=>{event.preventDefault();const targetId=event.currentTarget.getAttribute("href").substring(1).split("?")[0],slideIndex=event.currentTarget.getAttribute("href").substring(1).split("?slide=")[1],scrollToId=event.currentTarget.getAttribute("href").substring(1).split("?scroll=")[1];Woolman.ModalsAndDrawers.showModalOrDrawer(targetId,parseInt(slideIndex),scrollToId)})}))};updateSourceFromDestination("variant-selects"),updateSourceFromDestination("price"),updateSourceFromDestination("buy-bar-info"),updateSourceFromDestination("Sku",({classList})=>classList.contains("hidden")),updateSourceFromDestination("Inventory",({innerText})=>innerText===""),updateSourceFromDestination("saleBadge",({classList})=>classList.contains("hidden"))}toggleAddButton(disable=!0,text){const productForm=document.getElementById(`product-form-${this.dataset.section}`);if(!productForm)return;const addButton=productForm.querySelector('[name="add"]'),addButtonText=productForm.querySelector('[name="add"] > span'),multiplyButtons=productForm.querySelectorAll(".btn--add-multiplier");addButton&&(disable?(addButton.setAttribute("disabled","disabled"),text&&(addButtonText.textContent=text)):(addButton.removeAttribute("disabled"),text&&(addButtonText.textContent=text)),multiplyButtons&&multiplyButtons.forEach(button=>{button.disabled=disable}))}setUnavailable(){const button=document.getElementById(`product-form-${this.dataset.section}`),addButton=button.querySelector('[name="add"]'),addButtonText=button.querySelector('[name="add"] > span'),price=document.getElementById(`price-${this.dataset.section}`);if(!addButton)return;addButtonText.textContent=window.variantStrings.unavailable,price&&price.classList.add("hidden");const button_BuyBar=document.getElementById(`product-form-${this.dataset.section}-product-buy-bar`),addButton_BuyBar=button_BuyBar.querySelector('[name="add"]'),addButtonText_BuyBar=button_BuyBar.querySelector('[name="add"] > span'),price_BuyBar=document.getElementById(`price-${this.dataset.section}-product-buy-bar`);addButton_BuyBar&&(addButtonText_BuyBar.textContent=window.variantStrings.unavailable,price_BuyBar&&price_BuyBar.classList.add("hidden"))}}customElements.define("variant-selects",VariantSelects);
2//# sourceMappingURL=/cdn/shop/t/191/assets/global.js.map?v=14616822002860122991790010536

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