import"./modulepreload-polyfill-B5Qt9EMX.js";const o=document.querySelector(".eyewear-page");if(o){const e=o.querySelector("[data-eyewear-video]"),f=o.querySelector("[data-eyewear-track]"),m=o.querySelector("[data-eyewear-products]"),g=o.querySelector("[data-eyewear-discover]"),v=o.querySelector("[data-eyewear-cart]"),S=o.querySelector("[data-eyewear-cart-count]"),i=o.querySelector("[data-eyewear-status]"),k=[...o.querySelectorAll(".eyewear-product")],q=[...o.querySelectorAll("[data-eyewear-add]")],L="https://d8j0ntlcm91z4.cloudfront.net/user_38xzZboKViGWJOttwIXH07lWA1P/hf_20260722_034500_01d916a4-d526-46c0-90e8-959d44fcc69b.mp4",a=new Set;let n=0,c=0,d=0,w=!1,y=0;const l=t=>{window.clearTimeout(y),i.textContent=t,i.classList.add("is-visible"),y=window.setTimeout(()=>i.classList.remove("is-visible"),2400)},T=()=>{const t=f.offsetHeight-window.innerHeight;return t<=0?0:Math.min(1,Math.max(0,window.scrollY/t))},h=()=>{!w||!e.duration||(n=T()*e.duration,u())},u=()=>{d||(d=window.requestAnimationFrame(M))},M=()=>{d=0,c+=(n-c)*.12,!e.seeking&&Math.abs(e.currentTime-c)>.04&&(e.currentTime=c),Math.abs(n-c)>.001||e.seeking||Math.abs(e.currentTime-c)>.04?u():c=n},p=()=>{const t=m.getBoundingClientRect(),r=Math.min(1,Math.max(0,(window.innerHeight-t.top)/(window.innerHeight*.7)));k.forEach((s,b)=>{const E=Math.min(1,Math.max(0,r*1.5-b*.08));s.style.setProperty("--eyewear-product-offset",`${(1-E)*80}px`)})};e.addEventListener("loadedmetadata",()=>{w=!0,e.currentTime=0,h()}),e.addEventListener("seeked",u),e.src=L,e.load(),window.addEventListener("scroll",()=>{h(),p()},{passive:!0}),g?.addEventListener("click",()=>{m.scrollIntoView({behavior:"smooth",block:"start"})}),q.forEach(t=>{t.addEventListener("click",()=>{const r=t.dataset.product,s=a.has(r);s?a.delete(r):a.add(r),t.classList.toggle("is-selected",!s),t.setAttribute("aria-label",`${s?"Add":"Remove"} ${r} ${s?"to":"from"} collection`),S.textContent=String(a.size),l(s?`${r} removed from the collection.`:`${r} added to the collection.`)})}),v?.addEventListener("click",()=>{if(!a.size){l("Select an optical study to start your collection.");return}l(`${a.size} optical ${a.size===1?"study":"studies"} in your collection.`)}),p()}