{
  "version": 3,
  "sources": ["/cdn/shop/t/1/assets/hover-video-card.js?cb=2685cb07"],
  "sourcesContent": ["// Plays a product card's media video on hover and rewinds it on leave.\n//\n// The clip is tagged .card__hover-video and is only painted on hover by\n// luxury-streetwear.css, so with JS off it just sits as an inert poster frame.\n// Binds to the existing .card-wrapper rather than wrapping it in a custom element,\n// which would otherwise change the grid DOM the collection layout depends on.\nfunction initializeHoverVideoCards(root = document) {\n  const cards = root.querySelectorAll('.card-wrapper--hover-video');\n\n  const canHover = window.matchMedia('(hover: hover) and (pointer: fine)');\n  const reduceMotion = window.matchMedia('(prefers-reduced-motion: reduce)');\n\n  cards.forEach((card) => {\n    if (card.dataset.hoverVideoBound) return;\n    const video = card.querySelector('.card__hover-video');\n    if (!video) return;\n    card.dataset.hoverVideoBound = 'true';\n\n    // Re-checked on enter rather than at bind time, so a card rendered before a\n    // media-query change (or a device that gains a fine pointer later) still works.\n    const active = () => canHover.matches && !reduceMotion.matches;\n\n    let hovering = false;\n    let attempts = 0;\n    let retryTimer = null;\n\n    // These product clips carry no audio track, so Chrome treats them as\n    // \"video-only background media\" and aborts play() while the clip is still\n    // loading. Left unhandled that means the first hover silently does nothing and\n    // the user has to hover twice. Retry a bounded number of times, on canplay\n    // (data arrived) and on a short timer (in case canplay already fired).\n    const clearPending = () => {\n      video.removeEventListener('canplay', playNow);\n      if (retryTimer !== null) {\n        clearTimeout(retryTimer);\n        retryTimer = null;\n      }\n    };\n\n    function playNow() {\n      clearPending();\n\n      // With no data loaded yet, wait for it instead of firing play() blind: Chrome\n      // aborts play() on a still-loading audio-less clip, and each abort would burn\n      // a retry before the media is even ready. canplay is the readiness signal;\n      // the timer is only a fallback for the case where canplay already fired.\n      if (video.readyState < 3) {\n        if (!hovering || !active()) return;\n        video.addEventListener('canplay', playNow, { once: true });\n        retryTimer = setTimeout(playNow, 400);\n        return;\n      }\n\n      const played = video.play();\n      if (!played || typeof played.then !== 'function') return;\n      played.then(\n        () => {\n          attempts = 0;\n        },\n        () => {\n          if (!hovering || !active() || attempts >= 3) return;\n          attempts += 1;\n          video.addEventListener('canplay', playNow, { once: true });\n          retryTimer = setTimeout(playNow, 400);\n        }\n      );\n    }\n\n    card.addEventListener('mouseenter', () => {\n      hovering = true;\n      if (!active()) return;\n      attempts = 0;\n      playNow();\n    });\n\n    card.addEventListener('mouseleave', () => {\n      hovering = false;\n      // Drop any pending retry so leaving mid-load does not start playback.\n      clearPending();\n      video.pause();\n      // Rewind so the next hover always starts from the first frame.\n      video.currentTime = 0;\n    });\n  });\n}\n\nwindow.addEventListener('DOMContentLoaded', () => initializeHoverVideoCards());\n\nif (Shopify.designMode) {\n  document.addEventListener('shopify:section:load', (event) => initializeHoverVideoCards(event.target));\n}"],
  "mappings": "AAMA,SAAS,0BAA0B,KAAO,SAAU,CAClD,MAAM,MAAQ,KAAK,iBAAiB,4BAA4B,EAE1D,SAAW,OAAO,WAAW,oCAAoC,EACjE,aAAe,OAAO,WAAW,kCAAkC,EAEzE,MAAM,QAAS,MAAS,CACtB,GAAI,KAAK,QAAQ,gBAAiB,OAClC,MAAM,MAAQ,KAAK,cAAc,oBAAoB,EACrD,GAAI,CAAC,MAAO,OACZ,KAAK,QAAQ,gBAAkB,OAI/B,MAAM,OAAS,IAAM,SAAS,SAAW,CAAC,aAAa,QAEvD,IAAI,SAAW,GACX,SAAW,EACX,WAAa,KAOjB,MAAM,aAAe,IAAM,CACzB,MAAM,oBAAoB,UAAW,OAAO,EACxC,aAAe,OACjB,aAAa,UAAU,EACvB,WAAa,KAEjB,EAEA,SAAS,SAAU,CAOjB,GANA,aAAa,EAMT,MAAM,WAAa,EAAG,CACxB,GAAI,CAAC,UAAY,CAAC,OAAO,EAAG,OAC5B,MAAM,iBAAiB,UAAW,QAAS,CAAE,KAAM,EAAK,CAAC,EACzD,WAAa,WAAW,QAAS,GAAG,EACpC,MACF,CAEA,MAAM,OAAS,MAAM,KAAK,EACtB,CAAC,QAAU,OAAO,OAAO,MAAS,YACtC,OAAO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