{
  "version": 3,
  "sources": ["/cdn/shop/t/145/assets/product-media.js?nocache=1789882721984"],
  "sourcesContent": ["if (!window.Eurus.loadedScript.has('product-media.js')) {\n  window.Eurus.loadedScript.add('product-media.js');\n\n  requestAnimationFrame(() => {\n    document.addEventListener('alpine:init', () => {\n      Alpine.data('xProductMedia', (settings) => ({\n        thumbnailOnMouseDown: false,\n        thumbnailOfset: 0,\n        thumbnailScrollOfset: 0,\n        thumbnailGrabbingClass: '',\n        zoomIsOpen: false,\n        productMediaIsOpen: '',\n        videoExternalListened: false,\n        xPosition: 0,\n        yPosition: 0,\n        imageWidth: 0,\n        imageHeight: 0,\n        startZoom(event) {\n          const elem = event.currentTarget;\n          const size = elem.getBoundingClientRect();\n          this.xOffset = size.left;\n          this.yOffset = size.top;\n          this.imageWidth = size.width;\n          this.imageHeight = size.height;\n        },\n        updatePosition(event) {\n          if (this.imageWidth && this.imageHeight) {\n            this.xPosition = ((event.clientX - this.xOffset) / this.imageWidth) * 100;\n            this.yPosition = ((event.clientY - this.yOffset)  / this.imageHeight) * 100;\n          }\n        },\n        thumbnailHandleMouseDown(e) {\n          this.thumbnailOnMouseDown = true;\n          this.thumbnailGrabbingClass = 'cursor-grabbing';\n          if (settings.thumbnail_direction == 'horizontal') {\n            this.thumbnailOfset = e.pageX - this.$refs.thumbnail.offsetLeft;\n            this.thumbnailScrollOfset = this.$refs.thumbnail.scrollLeft;\n          } else {\n            this.thumbnailOfset = e.pageY - this.$refs.thumbnail.offsetTop;\n            this.thumbnailScrollOfset = this.$refs.thumbnail.scrollTop;\n          }\n        },\n        thumbnailHandleMouseMove(e) {\n          if(!this.thumbnailOnMouseDown) return;\n          e.preventDefault();\n          if (settings.thumbnail_direction == 'horizontal') {\n            const x = e.pageX - this.$refs.thumbnail.offsetLeft;\n            const walk = (x - this.thumbnailOfset) * 2;\n            this.$refs.thumbnail.scrollLeft = this.thumbnailScrollOfset - walk;\n          }\n          else {\n            const y = e.pageY - this.$refs.thumbnail.offsetTop;\n            const walk = (y - this.thumbnailOfset) * 2;\n            this.$refs.thumbnail.scrollTop = this.thumbnailScrollOfset - walk;\n          }\n        },\n        thumbnailHandleMouseLeave() {\n          this._thumbnailRemoveGrabing();\n        },\n        thumbnailHandleMouseUp() {\n          this._thumbnailRemoveGrabing();\n        },\n        _thumbnailRemoveGrabing() {\n          this.thumbnailOnMouseDown = false;\n          this.thumbnailGrabbingClass = 'md:cursor-grab';\n        },\n        zoomOpen(position, isSplide) {\n          this.zoomIsOpen = true;\n          Alpine.store('xPopup').open = true;\n          setTimeout(() => {\n            if (isSplide) {\n              const splideEl = document.getElementById(`media-gallery-${settings.section_id}`)\n              if (splideEl && splideEl.splide) {\n                let nextSlideIndex = 0;\n                const childrenArray = Array.from(splideEl.querySelector('.splide__list').children)\n                childrenArray.map((item, index) => {\n                  if (item.getAttribute('x-slide-index') == position) {\n                    nextSlideIndex = index\n                  }\n                })\n                splideEl.splide.go(nextSlideIndex);\n              }\n              document.addEventListener(`eurus:zoom-image-ready:${settings.section_id}`, () => {\n                if (splideEl && splideEl.splide) {\n                  let nextSlideIndex = 0;\n                  const childrenArray = Array.from(splideEl.querySelector('.splide__list').children)\n                  childrenArray.map((item, index) => {\n                    if (item.getAttribute('x-slide-index') == position) {\n                      nextSlideIndex = index\n                    }\n                  })\n                  splideEl.splide.go(nextSlideIndex);\n                }\n              });\n            }\n            else {\n              // PNM fix: smooth scrollIntoView does not scroll the fixed zoom overlay, so the\n              // popup always opened on the first image. Scroll the overlay container directly.\n              const target = document.getElementById(position + '-image-zoom-' + settings.section_id);\n              if (target) {\n                const scroller = target.closest('.overflow-y-scroll') || target.closest('.overflow-y-auto');\n                if (scroller) {\n                  const top = target.getBoundingClientRect().top - scroller.getBoundingClientRect().top + scroller.scrollTop;\n                  scroller.scrollTop = top;\n                } else {\n                  target.scrollIntoView({ block: 'start' });\n                }\n              }\n            }\n          }, 200);\n          Alpine.store('xModal').activeElement = 'product-image-' + settings.section_id + '-' + position;\n        },\n        zoomClose() {\n          this.zoomIsOpen = false;\n          Alpine.store('xPopup').close();\n        },\n\n        videoHandleIntersect() {\n          if (settings.video_autoplay) {\n            Alpine.store('xVideo').play(this.$el);\n          }\n        },\n        productModelInit() {\n          window.Shopify.loadFeatures([\n            {\n              name: 'shopify-xr',\n              version: '1.0',\n              onLoad: this._productModelSetupShopifyXR,\n            },\n          ]);\n        },\n        _productModelSetupShopifyXR() {\n          const setup = () => {\n            document.querySelectorAll('[id^=\"ProductJSON-\"]').forEach((modelJSON) => {\n              window.ShopifyXR.addModels(JSON.parse(modelJSON.textContent));\n              modelJSON.remove();\n            });\n            window.ShopifyXR.setupXRElements();\n          }\n\n          if (!window.ShopifyXR) {\n            document.addEventListener('shopify_xr_initialized', () => {\n              setup();\n            });\n            return;\n          }\n\n          setup();\n        },\n        productModelLoadMedia() {\n          let container = this.$el.parentNode;\n          const content = document.createElement('div');\n          content.appendChild(container.querySelector('template').content.firstElementChild.cloneNode(true));\n\n          this.$el.classList.add('hidden');\n          container.appendChild(content.querySelector('model-viewer'));\n\n          this._productModelLoadViewerUI();\n        },\n        productModelPauseViewer() {\n          if (this.$el.modelViewerUI) this.$el.modelViewerUI.pause();\n        },\n        _productModelLoadViewerUI() {\n          window.Shopify.loadFeatures([\n            {\n              name: 'model-viewer-ui',\n              version: '1.0',\n              onLoad: this._productModelSetupViewerUI.bind(this),\n            },\n          ]);\n        },\n        _productModelSetupViewerUI(errors) {\n          if (errors) return;\n\n          this.$el.parentNode.modelViewerUI\n            = new Shopify.ModelViewerUI(this.$el.parentNode.querySelector('model-viewer'));\n        }\n      }));\n    });\n  });\n}\n"],
  "mappings": "AAAK,OAAO,MAAM,aAAa,IAAI,kBAAkB,IACnD,OAAO,MAAM,aAAa,IAAI,kBAAkB,EAEhD,sBAAsB,IAAM,CAC1B,SAAS,iBAAiB,cAAe,IAAM,CAC7C,OAAO,KAAK,gBAAkB,WAAc,CAC1C,qBAAsB,GACtB,eAAgB,EAChB,qBAAsB,EACtB,uB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