{
  "version": 3,
  "sources": ["/cdn/shop/t/724/assets/cart-notification.js?enable_js_minification=1"],
  "sourcesContent": ["class CartNotification extends HTMLElement {\n  constructor() {\n    super();\n\n    this.notification = document.getElementById('cart-notification');\n    this.header = document.querySelector('sticky-header');\n    this.onBodyClick = this.handleBodyClick.bind(this);\n\n    this.notification.addEventListener('keyup', (evt) => evt.code === 'Escape' && this.close());\n    this.querySelectorAll('button[type=\"button\"]').forEach((closeButton) =>\n      closeButton.addEventListener('click', this.close.bind(this))\n    );\n  }\n\n  open() {\n    this.notification.classList.add('animate', 'active');\n\n    this.notification.addEventListener('transitionend', () => {\n      this.notification.focus();\n      trapFocus(this.notification);\n    }, { once: true });\n\n    document.body.addEventListener('click', this.onBodyClick);\n\n// CV-CUSTOM START\n// https://cvlinens.atlassian.net/browse/WX-2051\n// Used to close the cart notification when the user starts scrolling\n    var limit_scroll_top = $(window).scrollTop() - 40;\n    var limit_scroll_bottom = $(window).scrollTop() + 10;\n\n    var cart_notfication = this;\n    $(window).scroll(function() {\n      var current_y = $(window).scrollTop();\n      if(current_y > limit_scroll_bottom || current_y < limit_scroll_top){\n        cart_notfication.close();\n        $(this).unbind();\n      }\n    });\n// CV-CUSTOM END\n  }\n\n  close() {\n    this.notification.classList.remove('active');\n    document.body.removeEventListener('click', this.onBodyClick);\n\n    removeTrapFocus(this.activeElement);\n  }\n\n  renderContents(parsedState) {\n      //CV CUSTOM START - replaced parsedState.key -> parsedState.variant_id\n      // this.cartItemKey = parsedState.key;\n      this.cartItemKey = parsedState.variant_id;\n      //CV CUSTOM END - replaced parsedState.key -> parsedState.variant_id\n      this.getSectionsToRender().forEach((section => {\n        document.getElementById(section.id).innerHTML =\n          this.getSectionInnerHTML(parsedState.sections[section.id], section.selector);\n      }));\n\n      if (this.header) this.header.reveal();\n      this.open();\n  }\n\n  getSectionsToRender() {\n    return [\n      {\n        id: 'cart-notification-product',\n        selector: `[id=\"cart-notification-product-${this.cartItemKey}\"]`,\n      },\n      {\n        id: 'cart-notification-button'\n      },\n      {\n        id: 'cart-icon-bubble'\n      }\n    ];\n  }\n\n  getSectionInnerHTML(html, selector = '.shopify-section') {\n    return new DOMParser()\n      .parseFromString(html, 'text/html')\n      .querySelector(selector).innerHTML;\n  }\n\n  handleBodyClick(evt) {\n    const target = evt.target;\n    if (target !== this.notification && !target.closest('cart-notification')) {\n      const disclosure = target.closest('details-disclosure, header-menu');\n      this.activeElement = disclosure ? disclosure.querySelector('summary') : null;\n      this.close();\n    }\n  }\n\n  setActiveElement(element) {\n    this.activeElement = element;\n  }\n}\n\ncustomElements.define('cart-notification', CartNotification);\n"],
  "mappings": "AAAA,MAAM,yBAAyB,WAAY,CACzC,aAAc,CACZ,MAAM,EAEN,KAAK,aAAe,SAAS,eAAe,mBAAmB,EAC/D,KAAK,OAAS,SAAS,cAAc,eAAe,EACpD,KAAK,YAAc,KAAK,gBAAgB,KAAK,IAAI,EAEjD,KAAK,aAAa,iBAAiB,QAAU,KAAQ,IAAI,OAAS,UAAY,KAAK,MAAM,CAAC,EAC1F,KAAK,iBAAiB,uBAAuB,EAAE,QAAS,aACtD,YAAY,iBAAiB,QAAS,KAAK,MAAM,KAAK,IAAI,CAAC,CAC7D,CACF,CAEA,MAAO,CACL,KAAK,aAAa,UAAU,IAAI,UAAW,QAAQ,EAEnD,KAAK,aAAa,iBAAiB,gBAAiB,IAAM,CACxD,KAAK,aAAa,MAAM,EACxB,UAAU,KAAK,YAAY,CAC7B,EAAG,CAAE,KAAM,EAAK,CAAC,EAEjB,SAAS,KAAK,iBAAiB,QAAS,KAAK,WAAW,EAKxD,IAAI,iBAAmB,EAAE,MAAM,EAAE,UAAU,EAAI,GAC3C,oBAAsB,EAAE,MAAM,EAAE,UAAU,EAAI,GAE9C,iBAAmB,KACvB,EAAE,MAAM,EAAE,OAAO,UAAW,CAC1B,IAAI,UAAY,EAAE,MAAM,EAAE,UAAU,GACjC,UAAY,qBAAuB,UAAY,oBAChD,iBAAiB,MAAM,EACvB,EAAE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