{
  "version": 3,
  "sources": ["/cdn/shop/t/2708/assets/cart-notification.js?cachebuster=HNUp9K6TY3Q9"],
  "sourcesContent": ["class CartNotification extends HTMLElement {\r\n  constructor() {\r\n    super();\r\n\r\n    this.autoClose = this.getAttribute('cart-auto-close') === 'true';\r\n    this.autoCloseDelay = Number(this.getAttribute('cart-notification-timer')) || 5000;\r\n\r\n    this.autoCloseTimeout = null;\r\n\r\n    this.toggleElementSelector = this.getAttribute('cart-toggle-button');\r\n    this.toggleElement = document.getElementById(this.toggleElementSelector);\r\n\r\n    this.closeButtonSelector = this.getAttribute('cart-close-button');\r\n    this.closeButton = document.getElementById(this.closeButtonSelector);\r\n\r\n    if (this.closeButton) this.closeButton.addEventListener('click', this.close.bind(this));\r\n\r\n    this.notification = document.getElementById('cart-notification');\r\n    this.timerBar = this.notification.querySelector('.cart-notification__timer-bar');\r\n    this.header = document.querySelector('sticky-header');\r\n    this.onBodyClick = this.handleBodyClick.bind(this);\r\n\r\n    if (this.toggleElement) this.toggleElement.addEventListener('click', () => this.toggleButtonClick());\r\n\r\n    this.notification.addEventListener('keyup', (evt) => evt.code === 'Escape' && this.close());\r\n    this.notification.addEventListener('mouseenter', () => this.clearAutoClose());\r\n    this.notification.addEventListener('touchstart', () => this.clearAutoClose(), { passive: true });\r\n    this.notification.addEventListener('pointerdown', () => this.clearAutoClose());\r\n    this.querySelectorAll('button[type=\"button\"]').forEach((closeButton) =>\r\n      closeButton.addEventListener('click', this.close.bind(this))\r\n    );\r\n\r\n  }\r\n\r\n\r\n  toggleButtonClick() {\r\n    if (this.notification.classList.contains('active')) {\r\n      this.close();\r\n    } else {\r\n      this.open();\r\n    }\r\n  }\r\n\r\n  open(initAutoClose = false) {\r\n    this.clearAutoClose();\r\n    \r\n    document.body.classList.add('overflow-hidden-mobile');\r\n\r\n    this.notification.classList.add('animate');\r\n\r\n    requestAnimationFrame(() => {\r\n      this.notification.classList.add('active');\r\n      document.body.addEventListener('click', this.onBodyClick);\r\n      if(initAutoClose) this.startAutoClose();\r\n      if (this.toggleElement) this.toggleElement.classList.add('active');\r\n      if (this.closeButton) this.closeButton.classList.add('active');\r\n      console.log('cart notification opened',this.closeButton);\r\n    });\r\n\r\n    this.notification.addEventListener('transitionend', () => {\r\n      this.notification.focus();\r\n      trapFocus(this.notification);\r\n    }, { once: true });\r\n\r\n  }\r\n\r\n  close() {\r\n    this.clearAutoClose();\r\n\r\n    this.notification.classList.remove('active');\r\n    if (this.toggleElement) this.toggleElement.classList.remove('active');\r\n    if (this.closeButton) this.closeButton.classList.remove('active');\r\n    document.body.removeEventListener('click', this.onBodyClick);\r\n\r\n    document.body.classList.remove('overflow-hidden-mobile');\r\n\r\n    removeTrapFocus(this.activeElement);\r\n  }\r\n\r\n  renderContents(parsedState) {\r\n      this.cartItemKey = parsedState.variantId;\r\n      if (!this.cartItemKey) return;\r\n      this.getSectionsToRender().forEach((section => {\r\n        const element =  document.getElementById(section.id)\r\n        const html = parsedState.sections?.[section.id] || parsedState[section.id];\r\n        if (!element || !html) return;\r\n        if(this.cartItemKey && section.selector) {\r\n          element.innerHTML = this.getSectionInnerHTML(html, section.selector);\r\n        } else {\r\n          element.innerHTML = this.getSectionInnerHTML(html);\r\n        } \r\n          \r\n      }));\r\n\r\n      this.querySelectorAll('button[type=\"button\"]').forEach((closeButton) =>\r\n        closeButton.addEventListener('click', this.close.bind(this))\r\n      );\r\n\r\n      if (this.header) this.header.reveal();\r\n      this.open(true);\r\n  }\r\n\r\n  getSectionsToRender() {\r\n    return [\r\n      {\r\n        id: 'cart-notification-product',\r\n        selector: `[id=\"cart-notification-product-${this.cartItemKey}\"]`,\r\n      },\r\n      {\r\n        id: 'cart-notification-price',\r\n        selector: `[id=\"cart-notification-price-${this.cartItemKey}\"]`,\r\n      },\r\n      {\r\n        id: 'cart-icon-bubble'\r\n      }\r\n    ];\r\n  }\r\n\r\n  getSectionInnerHTML(html, selector = '.shopify-section') {\r\n    return new DOMParser()\r\n      .parseFromString(html, 'text/html')\r\n      .querySelector(selector).innerHTML;\r\n  }\r\n\r\n  handleBodyClick(evt) {\r\n    const target = evt.target;\r\n\r\n    if (this.notification.contains(target) || target.closest('.header__icon--cart')) {\r\n      this.clearAutoClose();\r\n      return;\r\n    }\r\n\r\n    const disclosure = target.closest('details-disclosure, header-menu');\r\n    this.activeElement = disclosure ? disclosure.querySelector('summary') : null;\r\n    this.close();\r\n  }\r\n\r\n  setActiveElement(element) {\r\n    this.activeElement = element;\r\n  }\r\n\r\n  startAutoClose() {\r\n    if (!this.autoClose || !this.timerBar) return;\r\n    this.timerBar.style.animation = \"none\";\r\n    this.timerBar.offsetHeight; \r\n    this.timerBar.style.animation = `cartTimer ${this.autoCloseDelay}ms linear forwards`;\r\n    this.timerBar.classList.add('animate');\r\n    this.autoCloseTimeout = setTimeout(() => {\r\n      this.close();\r\n    }, this.autoCloseDelay);\r\n  }\r\n\r\n  clearAutoClose() {\r\n    if (!this.autoClose || !this.autoCloseTimeout) return;\r\n    clearTimeout(this.autoCloseTimeout);\r\n    this.autoCloseTimeout = null;\r\n    if (this.timerBar) {\r\n      this.timerBar.style.animation = \"none\";\r\n      this.timerBar.classList.remove('animate');\r\n    }\r\n  }\r\n\r\n}\r\n\r\ncustomElements.define('cart-notification', CartNotification);"],
  "mappings": "AAAA,MAAM,yBAAyB,WAAY,CACzC,aAAc,CACZ,MAAM,EAEN,KAAK,UAAY,KAAK,aAAa,iBAAiB,IAAM,OAC1D,KAAK,eAAiB,OAAO,KAAK,aAAa,yBAAyB,CAAC,GAAK,IAE9E,KAAK,iBAAmB,KAExB,KAAK,sBAAwB,KAAK,aAAa,oBAAoB,EACnE,KAAK,cAAgB,SAAS,eAAe,KAAK,qBAAqB,EAEvE,KAAK,oBAAsB,KAAK,aAAa,mBAAmB,EAChE,KAAK,YAAc,SAAS,eAAe,KAAK,mBAAmB,EAE/D,KAAK,aAAa,KAAK,YAAY,iBAAiB,QAAS,KAAK,MAAM,KAAK,IAAI,CAAC,EAEtF,KAAK,aA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