PageSourceSearch

https://sarahsbag.com/cdn/shop/t/3/assets/app.js?v=18738182259509659551702305779

js sarahsbag.com collected 2026-09-26 04:33:42 UTC 17,644 bytes, 2 lines download raw bytes

1function debounce(fn,wait){let t;return(...args)=>{clearTimeout(t),t=setTimeout(()=>fn.apply(this,args),wait)}}var dispatchCustomEvent=function(eventName){var data=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},detail={detail:data},event=new CustomEvent(eventName,data?detail:null);document.dispatchEvent(event)};if(!customElements.get("quantity-selector")){class QuantityInput extends HTMLElement{constructor(){super(),this.input=this.querySelector(".qty"),this.step=this.input.getAttribute("step"),this.changeEvent=new Event("change",{bubbles:!0}),this.subtract=this.querySelector(".minus"),this.add=this.querySelector(".plus"),this.subtract.addEventListener("click",()=>this.change_quantity(-1*this.step)),this.add.addEventListener("click",()=>this.change_quantity(1*this.step))}connectedCallback(){this.classList.add("buttons_added")}change_quantity(change){let quantity=Number(this.input.value);isNaN(quantity)&&(quantity=1),!(this.input.getAttribute("min")>quantity+change)&&(this.input.getAttribute("max")&&this.input.getAttribute("max")<quantity+change||(quantity+=change,quantity=Math.max(quantity,1),this.input.value=quantity,this.input.dispatchEvent(this.changeEvent)))}}customElements.define("quantity-selector",QuantityInput)}class ArrowSubMenu{constructor(self){this.submenu=self.parentNode.querySelector(".sub-menu"),this.arrow=self,self.addEventListener("click",e=>this.toggle_submenu(e))}toggle_submenu(e){e.preventDefault();let submenu=this.submenu;submenu.classList.contains("active")?(submenu.classList.remove("active"),this.arrow.blur()):submenu.classList.add("active")}}let arrows=document.querySelectorAll(".thb-arrow");if(arrows.forEach(arrow=>{new ArrowSubMenu(arrow)}),!customElements.get("product-card")){class ProductCard extends HTMLElement{constructor(){super(),this.swatches=this.querySelector(".product-card-swatches"),this.image=this.querySelector(".product-featured-image-link .product-primary-image"),this.secondary=this.querySelector(".product-featured-image-link .product-secondary-image"),this.quick_add=this.querySelector(".product-card--add-to-cart-button-simple")}connectedCallback(){this.swatches&&this.enableSwatches(),this.quick_add&&this.enableQuickView(),this.secondary&&window.addEventListener("load",event=>{lazySizes.loader.unveil(this.secondary)})}enableSwatches(){let swatch_list=this.swatches.querySelectorAll(".product-card-swatch"),org_srcset=this.image?this.image.dataset.srcset:"";swatch_list.forEach((swatch,index)=>{window.addEventListener("load",event=>{let image=new Image;image.srcset=swatch.dataset.srcset,lazySizes.loader.unveil(image)}),swatch.addEventListener("mouseover",()=>{[].forEach.call(swatch_list,function(el){el.classList.remove("active")}),this.image&&(swatch.dataset.srcset?this.image.setAttribute("srcset",swatch.dataset.srcset):this.image.setAttribute("srcset",org_srcset)),swatch.classList.add("active")}),swatch.addEventListener("click",function(evt){window.location.href=this.dataset.href,evt.preventDefault()})})}enableQuickView(){this.quick_add.addEventListener("click",this.quickAdd.bind(this))}quickAdd(evt){if(evt.preventDefault(),this.quick_add.disabled)return;this.quick_add.classList.add("loading"),this.quick_add.setAttribute("aria-disabled",!0);const config={method:"POST",headers:{"X-Requested-With":"XMLHttpRequest",Accept:"application/javascript"}};let formData=new FormData(this.form);return formData.append("id",this.quick_add.dataset.productId),formData.append("quantity",1),formData.append("sections",this.getSectionsToRender().map(section=>section.section)),formData.append("sections_url",window.location.pathname),config.body=formData,fetch(`${theme.routes.cart_add_url}`,config).then(response=>response.json()).then(response=>{response.status||(this.renderContents(response),dispatchCustomEvent("cart:item-added",{product:response.hasOwnProperty("items")?response.items[0]:response}))}).catch(e=>{console.error(e)}).finally(()=>{this.quick_add.classList.remove("loading"),this.quick_add.removeAttribute("aria-disabled")}),!1}getSectionsToRender(){return[{id:"Cart",section:"main-cart",selector:".thb-cart-form"},{id:"Cart-Drawer",section:"cart-drawer",selector:".cart-drawer"},{id:"cart-drawer-toggle",section:"cart-bubble",selector:".thb-item-count"}]}
1renderContents(parsedState){this.getSectionsToRender().forEach((section=>{if(!document.getElementById(section.id))return;const elementToReplace=document.getElementById(section.id).querySelector(section.selector)||document.getElementById(section.id);elementToReplace.innerHTML=this.getSectionInnerHTML(parsedState.sections[section.section],section.selector),typeof CartDrawer<"u"&&new CartDrawer,typeof Cart<"u"&&new Cart().renderContents(parsedState)})),document.getElementById("Cart-Drawer")&&(document.body.classList.add("open-cc"),document.getElementById("Cart-Drawer").classList.add("active"),dispatchCustomEvent("cart-drawer:open"))}getSectionInnerHTML(html,selector=".shopify-section"){return new DOMParser().parseFromString(html,"text/html").querySelector(selector).innerHTML}}customElements.define("product-card",ProductCard)}class PanelClose extends HTMLElement{constructor(){super();let cc=document.querySelector(".click-capture");this.addEventListener("click",e=>this.close_panel(e)),document.addEventListener("keyup",e=>{e.code&&e.code.toUpperCase()==="ESCAPE"&&document.querySelectorAll(".side-panel").forEach(panel=>{panel.classList.remove("active"),document.body.classList.remove("open-cc")})}),cc.addEventListener("click",e=>{document.body.classList.remove("open-cc"),document.querySelector(".side-panel.active")&&document.querySelector(".side-panel.active").classList.remove("active")})}close_panel(e){e.preventDefault(),e.target.closest(".side-panel").classList.remove("active"),document.body.classList.remove("open-cc")}}customElements.define("side-panel-close",PanelClose);class CartDrawer{constructor(){if(this.container=document.getElementById("Cart-Drawer"),!this.container)return;let button=document.getElementById("cart-drawer-toggle");button&&(button.addEventListener("click",e=>{e.preventDefault(),document.body.classList.add("open-cc"),this.container.classList.add("active"),this.container.focus(),dispatchCustomEvent("cart-drawer:open")}),this.debouncedOnChange=debounce(event=>{this.onChange(event)},300),document.addEventListener("cart:refresh",event=>{this.refresh()}),this.container.addEventListener("change",this.debouncedOnChange.bind(this)),this.notesToggle(),this.removeProductEvent(),this.termsCheckbox())}onChange(event){event.target.classList.contains("qty")&&this.updateQuantity(event.target.dataset.index,event.target.value),this.removeProductEvent()}removeProductEvent(){this.container.querySelectorAll(".remove").forEach(remove=>{remove.addEventListener("click",event=>{this.updateQuantity(event.target.dataset.index,"0"),event.preventDefault()})})}getSectionsToRender(){return[{id:"Cart-Drawer",section:"cart-drawer",selector:".cart-drawer"},{id:"cart-drawer-toggle",section:"cart-bubble",selector:".thb-item-count"}]}getSectionInnerHTML(html,selector){return new DOMParser().parseFromString(html,"text/html").querySelector(selector).innerHTML}termsCheckbox(){let terms_checkbox=this.container.querySelector("#CartDrawerTerms"),checkout_button=this.container.querySelector(".button.checkout");terms_checkbox&&checkout_button&&(terms_checkbox.setCustomValidity(theme.strings.requiresTerms),checkout_button.addEventListener("click",function(e){terms_checkbox.checked||(terms_checkbox.reportValidity(),terms_checkbox.focus(),e.preventDefault())}))}notesToggle(){let notes_toggle=document.getElementById("order-note-toggle");notes_toggle&&(notes_toggle.addEventListener("click",event=>{notes_toggle.nextElementSibling.classList.add("active")}),notes_toggle.nextElementSibling.querySelectorAll(".button, .order-note-toggle__content-overlay").forEach(el=>{el.addEventListener("click",event=>{notes_toggle.nextElementSibling.classList.remove("active"),this.saveNotes()})}))}saveNotes(){fetch(`${theme.routes.cart_update_url}.js`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({note:document.getElementById("mini-cart__notes").value})})}updateQuantity(line,quantity){this.container.querySelector(`#CartDrawerItem-${line}`).classList.add("thb-loading");const body=JSON.stringify({line,quantity,sections:this.getSectionsToRender().map(section=>section.section),sections_url:window.location.pathname});dispatchCustomEvent("line-item:change:start",{quantity}
1),fetch(`${theme.routes.cart_change_url}`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body}).then(response=>response.text()).then(state=>{const parsedState=JSON.parse(state);this.getSectionsToRender().forEach((section=>{const elementToReplace=document.getElementById(section.id).querySelector(section.selector)||document.getElementById(section.id);elementToReplace.innerHTML=this.getSectionInnerHTML(parsedState.sections[section.section],section.selector)})),this.removeProductEvent(),this.notesToggle(),this.termsCheckbox(),dispatchCustomEvent("line-item:change:end",{quantity,cart:parsedState}),this.container.querySelector(`#CartDrawerItem-${line}`).length&&this.container.querySelector(`#CartDrawerItem-${line}`).classList.remove("thb-loading")})}refresh(){fetch(`${window.location.pathname}?sections=cart-drawer,cart-bubble`).then(response=>response.text()).then(state=>{const parsedState=JSON.parse(state);this.getSectionsToRender().forEach((section=>{const elementToReplace=document.getElementById(section.id).querySelector(section.selector)||document.getElementById(section.id);elementToReplace.innerHTML=this.getSectionInnerHTML(parsedState[section.section],section.selector)})),this.removeProductEvent(),this.notesToggle(),this.termsCheckbox()})}}if(!customElements.get("quick-view")){class QuickView extends HTMLElement{constructor(){super()}connectedCallback(){this.cc=document.querySelector(".click-capture"),this.drawer=document.getElementById("Product-Drawer"),this.body=document.body,this.addEventListener("click",this.setupEventListener.bind(this)),this.cc.addEventListener("click",this.setupCCEventListener.bind(this))}setupCCEventListener(e){this.body.classList.remove("open-cc"),this.drawer.classList.remove("active"),this.drawer.querySelector("#Product-Drawer-Content").innerHTML=""}setupEventListener(e){e.preventDefault();let productHandle=this.dataset.productHandle,href=`${theme.routes.root_url}/products/${productHandle}?view=quick-view`;href=href.replace("//","/"),!(!href||!productHandle)&&(this.classList.contains("loading")||(this.classList.add("loading"),fetch(href,{method:"GET"}).then(response=>(this.classList.remove("loading"),response.text())).then(text=>{const sectionInnerHTML=new DOMParser().parseFromString(text,"text/html").querySelector("#Product-Drawer-Content").innerHTML;this.renderQuickview(sectionInnerHTML,href,productHandle)})))}renderQuickview(sectionInnerHTML,href,productHandle){if(sectionInnerHTML){this.drawer.querySelector("#Product-Drawer-Content").innerHTML=sectionInnerHTML;let js_files=this.drawer.querySelector("#Product-Drawer-Content").querySelectorAll("script");if(js_files.length>0){var head=document.getElementsByTagName("head")[0];js_files.forEach((js_file,i)=>{let script=document.createElement("script");script.src=js_file.src,head.appendChild(script)})}setTimeout(()=>{window.dispatchEvent(new Event("resize")),Shopify&&Shopify.PaymentButton&&Shopify.PaymentButton.init(),window.ProductModel&&window.ProductModel.loadShopifyXR()},300),this.body.classList.add("open-cc"),this.drawer.classList.add("active"),this.drawer.querySelector(".side-panel-close").focus(),dispatchCustomEvent("quick-view:open",{productUrl:href,productHandle})}}}customElements.define("quick-view",QuickView)}class ModalDialog extends HTMLElement{constructor(){super(),this.querySelector('[id^="ModalClose-"]').addEventListener("click",this.hide.bind(this)),this.addEventListener("keyup",event=>{event.code.toUpperCase()==="ESCAPE"&&this.hide()}),this.classList.contains("media-modal")?this.addEventListener("pointerup",event=>{event.pointerType==="mouse"&&!event.target.closest("product-model")&&this.hide()}):this.addEventListener("click",event=>{event.target.nodeName==="MODAL-DIALOG"&&this.hide()})}connectedCallback(){this.moved||(this.moved=!0,document.body.appendChild(this))}show(opener){this.openedBy=opener,document.body.classList.add("overflow-hidden"),this.setAttribute("open","")}hide(){document.body.classList.remove("overflow-hidden"),this.removeAttribute("open"),this.querySelectorAll(".js-youtube").forEach(video=>{video.contentWindow.postMessage('{"event":"command","func":"pauseVideo","args":""}',"*")}),this.querySelectorAll(".js-vimeo").forEach(video=>{video.contentWindow.postMessage('{"method":"pause"}',"*")}),this.querySelectorAll("video").forEach(video=>video.pause())}}customElements.define("modal-dialog",ModalDialog);class ModalOpener extends HTMLElement{constructor(){super();const button=this.querySelector("button");button&&button.addEventListener("click",()=>{const modal=document.querySelector(this.getAttribute("data-modal"));modal&&modal.show(button)})}}customElements.define("modal-opener",ModalOpener);class ProductRecommendations extends HTMLElement{constructor(){super()}fetchProducts(){fetch(this.dataset.url).then(response=>response.text()).then(text=>{const html=document.createElement("div");
1html.innerHTML=text;const recommendations=html.querySelector("product-recommendations");recommendations&&recommendations.innerHTML.trim().length&&(this.innerHTML=recommendations.innerHTML),this.classList.add("product-recommendations--loaded")}).catch(e=>{console.error(e)})}connectedCallback(){this.fetchProducts()}}customElements.define("product-recommendations",ProductRecommendations);class Localization{constructor(){let _this=this;document.querySelectorAll(".thb-localization-forms").forEach(localization=>{localization.addEventListener("change",e=>{localization.querySelector("form").submit()})})}}class SelectWidth{constructor(){let _this=this;document.querySelectorAll(".resize-select").forEach(_this.resizeSelect),document.body.addEventListener("change",e=>{e.target.matches(".resize-select")&&e.target.offsetParent!==null&&_this.resizeSelect(e.target)}),window.addEventListener("resize.resize-select",function(){document.querySelectorAll(".resize-select").forEach(_this.resizeSelect)})}resizeSelect(sel){let tempOption=document.createElement("option");tempOption.textContent=sel.selectedOptions[0].textContent;let tempSelect=document.createElement("select");tempSelect.style.visibility="hidden",tempSelect.style.position="fixed",tempSelect.appendChild(tempOption),sel.after(tempSelect),tempSelect.clientWidth>0&&(sel.style.width=`${+tempSelect.clientWidth+12}px`),tempSelect.remove()}}if(!customElements.get("collapsible-row")){class CollapsibleRow extends HTMLElement{constructor(){super(),this.details=this.querySelector("details"),this.summary=this.querySelector("summary"),this.content=this.querySelector(".collapsible__content"),this.animation=null,this.isClosing=!1,this.isExpanding=!1}connectedCallback(){this.setListeners()}setListeners(){this.querySelector("summary").addEventListener("click",e=>this.onClick(e))}prepareAnimations(){let _this=this,summary_height=this.querySelector("summary").offsetHeight,content_height=this.querySelector(".collapsible__content").offsetHeight,initial_height=summary_height,final_height=summary_height+content_height;this.tl=!1,this.tl=gsap.timeline({reversed:!_this.details.open,paused:!0,inherit:!1,ease:"none",onStart:function(){_this.details.open=!0,_this.details.style.overflow="hidden"},onReverseComplete:function(){_this.details.open=!1,_this.details.style.overflow=""}}),this.tl.fromTo(_this.details,{height:function(){return Math.max(Math.max(initial_height,0),24)},clearProps:"height"},{duration:.4,height:final_height,clearProps:"height"}),this.details.open&&this.tl.progress(1)}instantClose(){this.tl.timeScale(10).reverse()}animateClose(){this.tl.timeScale(3).reverse()}animateOpen(){this.tl.timeScale(1).play()}onClick(e){e.preventDefault(),this.details.style.overflow="hidden",this.isClosing||!this.details.open?this.open():(this.isExpanding||this.details.open)&&this.shrink()}shrink(){this.isClosing=!0;const startHeight=`${this.details.offsetHeight}px`,endHeight=`${this.summary.offsetHeight}px`;this.animation&&this.animation.cancel(),this.animation=this.details.animate({height:[startHeight,endHeight]},{duration:250,easing:"ease"}),this.animation.onfinish=()=>this.onAnimationFinish(!1),this.animation.oncancel=()=>this.isClosing=!1}open(){this.details.style.height=`${this.details.offsetHeight}px`,this.details.open=!0,window.requestAnimationFrame(()=>this.expand())}expand(){this.isExpanding=!0;const startHeight=`${this.details.offsetHeight}px`,endHeight=`${this.summary.offsetHeight+this.content.offsetHeight}px`;this.animation&&this.animation.cancel(),this.animation=this.details.animate({height:[startHeight,endHeight]},{duration:400,easing:"ease-out"}),this.animation.onfinish=()=>this.onAnimationFinish(!0),this.animation.oncancel=()=>this.isExpanding=!1}onAnimationFinish(open){this.details.open=open,this.animation=null,this.isClosing=!1,this.isExpanding=!1,this.details.style.height=this.details.style.overflow=""}}customElements.define("collapsible-row",CollapsibleRow)}typeof SelectWidth<"u"&&new SelectWidth,document.addEventListener("DOMContentLoaded",()=>{typeof Localization<"u"&&new Localization,typeof CartDrawer<"u"&&new CartDrawer});
2//# sourceMappingURL=/cdn/shop/t/3/assets/app.js.map?v=18738182259509659551702305779

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.