{"version":3,"sources":["webpack:///./assets/javascripts/modules/components/CartLayerComponent.js"],"names":["CartLayerComponent","htmlEl","_classCallCheck","this","_possibleConstructorReturn","__proto__","Object","getPrototypeOf","call","Component","content","items","_this2","itemsEl","$component","querySelectorAll","SELECTORS","length","toggleEmpty","moduleLoader","loadSimpleBarAndExecute","module","initSimpleBar","default","error","console","log","stack","bool","classList","remove","add","SimpleBar","querySelector","_this3","$on","$customEvents","MINICART_EVENTS","update","e","counterList","bindEvents"],"mappings":"wWAEqBA,cASnB,SAAAA,EAAYC,GAAQ,mGAAAC,CAAAC,KAAAH,oKAAAI,CAAAD,MAAAH,EAAAK,WAAAC,OAAAC,eAAAP,IAAAQ,KAAAL,KACZF,uUAVsCQ,6CAG5C,OACEC,QAAS,yBACTC,MAAO,+DAQG,IAAAC,EAAAT,KACRU,EAAUV,KAAKW,WAAWC,iBAAiBZ,KAAKa,UAAUL,OAC3DE,EAAQI,OAAS,GAClBd,KAAKe,aAAY,GACjBf,KAAKgB,aAAaC,wBAChB,SAAAC,GACET,EAAKU,cAAcD,EAAOE,UAE5B,SAAAC,GACEC,QAAQC,IAAI,4BAA6BF,EAAMG,UAGzB,GAAlBd,EAAQI,QAChBd,KAAKe,aAAY,uCAGTU,GAEPA,EACDzB,KAAKW,WAAWe,UAAUC,OAAO,SAEjC3B,KAAKW,WAAWe,UAAUE,IAAI,+CAGpBC,GACZ,IAAIA,EAAU7B,KAAKW,WAAWmB,cAAc9B,KAAKa,UAAUN,+CAGhD,IAAAwB,EAAA/B,KACXA,KAAKgC,IAAIhC,KAAKiC,cAAcC,gBAAgBC,OAAQ,SAACC,GACnDL,EAAKM,iDAKPrC,KAAKuB,IAAI,gBACTvB,KAAKsC,aACLtC,KAAKqC,uBAlDYxC","file":"component-CartLayerComponent.chunks.js","sourcesContent":["import Component from '../abstracts/Component';\n\nexport default class CartLayerComponent extends Component {\n\n  get SELECTORS() {\n    return {\n      content: '[data-items-container]',\n      items: '[data-mc-item]',\n    };\n  }\n\n  constructor(htmlEl) {\n    super(htmlEl);\n  }\n\n  counterList() {\n    let itemsEl = this.$component.querySelectorAll(this.SELECTORS.items);\n    if(itemsEl.length > 0) {\n      this.toggleEmpty(true);\n      this.moduleLoader.loadSimpleBarAndExecute(\n        module => {\n          this.initSimpleBar(module.default);\n        },\n        error => {\n          console.log('failed to load SimpleBar ', error.stack);\n        }\n      );\n    } else if(itemsEl.length == 0) {\n      this.toggleEmpty(false);\n    }\n  }\n  toggleEmpty(bool) {\n    // new simple code\n    if(bool) {\n      this.$component.classList.remove('empty');\n    } else {\n      this.$component.classList.add('empty');\n    }\n  }\n  initSimpleBar(SimpleBar) {\n    new SimpleBar(this.$component.querySelector(this.SELECTORS.content));\n  }\n\n  bindEvents() {\n    this.$on(this.$customEvents.MINICART_EVENTS.update, (e) => {\n      this.counterList();\n    });\n  }\n\n  render() {\n    this.log('Rendering...');\n    this.bindEvents();\n    this.counterList();\n  }\n}\n"],"sourceRoot":""}