{"version":3,"sources":["webpack:///./src/client/default/js/components/navigationMenuComponent.js","webpack:///./src/client/default/js/base/baseComponent.js"],"names":["SearchBar","_BaseComponent","element","_document$querySelect","_document$querySelect2","_this","_classCallCheck","_callSuper","$secondLevelWrapper","pageAction","document","querySelector","dataset","action","moveSecondLevelCategoriesUnderBody","setState","currentCategory","$options","_possibleConstructorReturn","_inherits","_createClass","key","get","secondLevelNavigation","second_level_category","carouselContainer","categoryLink","selected","this","_secondLevelWrapper","body","SELECTORS","value","_this2","_toConsumableArray","$el","querySelectorAll","forEach","section","classList","contains","appendChild","add","highligthSelectCategory","component","currentSecondLevelCategory","currentSecondLevelCategoryAll","map","el","optionStartAt","concat","parentElement","children","indexOf","changes","remove","console","log","selectedMenu","BaseComponent","_BaseGiaComponent","_componentElement","setAttribute","_checkMessages","compOptions","options","_objectSpread","Object","keys","filter","entry","includes","optionValue","cleanEntry","cleanOptionKey","JSON","parse","replace","convertType","deepFreeze","getAttribute","events","cb","arguments","length","undefined","elements","Bean","on","e","stopPropagation","one","off","fire","container","message","_loading","EMIT","CUSTOM_MESSAGES","LOADER_EVENTS","show","error","icon","setTimeout","hide","option","optionReturn","str","charAt","toLocaleLowerCase","slice","BaseGiaComponent"],"mappings":"meAAkD,IAE7BA,EAAS,SAAAC,GAC5B,SAAAD,EAAYE,GAAS,IAAAC,EAAAC,EAAAC,EAEnB,OAFmBC,IAAA,KAAAN,IACnBK,EAAAE,EAAA,KAAAP,EAAA,CAAME,KACIM,qBAIVH,EAAKI,YAAwE,QAAhCN,EAACO,SAASC,cAAc,gBAAQ,IAAAR,GAAU,QAAVC,EAAhCD,EAAmCS,eAAO,IAAAR,OAAV,EAAhCA,EAA4CS,SAAU,GACnGR,EAAKS,qCACLT,EAAKU,SAAS,CAAEC,gBAAiBX,EAAKY,SAASD,kBAAmBX,GANnCa,IAAAb,GAOhC,OAAAc,IAAAnB,EAAAC,GAAAmB,IAAApB,EAAA,EAAAqB,IAAA,YAAAC,IAED,WACE,MA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gE,KAAKhE,EAAKiE,gBAAgBC,cAAcK,KAAM,CACjDV,UAAWA,GAAapF,SAASoB,KACjCiE,UACAM,QACAC,WAGH,QACJ,EAAAjF,IAAA,cAAAW,MAvHD,SAAmByE,GACjB,IAAIC,EACJ,OAAQD,GACN,IAAK,QACHC,GAAe,EACf,MACF,IAAK,OACHA,GAAe,EACf,MACF,IAAK,OACHA,EAAe,KACf,MACF,QACEA,EAAeD,EAInB,OAAOC,IACR,CAAArF,IAAA,iBAAAW,MAED,SAAsBX,GACpB,IAAMsF,EAAMtF,EAAIwD,QAAQ,SAAU,IAClC,MAAO,GAAP3B,OAAUyD,EAAIC,OAAO,GAAGC,qBAAmB3D,OAAGyD,EAAIG,MAAM,QAhE1B,C,MAASC","file":"js/component-navigationMenuComponent-js.chunks.js","sourcesContent":["import BaseComponent from '../base/baseComponent';\n\nexport default class SearchBar extends BaseComponent {\n  constructor(element) {\n    super(element);\n    if (!this.$secondLevelWrapper) return;\n    /**\n     * @type {string}\n     */\n    this.pageAction = /** @type {HTMLElement} */ (document.querySelector('.page'))?.dataset?.action || '';\n    this.moveSecondLevelCategoriesUnderBody();\n    this.setState({ currentCategory: this.$options.currentCategory });\n  }\n\n  get SELECTORS() {\n    return { secondLevelNavigation: '#secondLevelNavigation', second_level_category: '.second-level-category', carouselContainer: '.glide', categoryLink: '.category' };\n  }\n\n  get CLASSES() {\n    return {\n      selected: 'selected'\n    };\n  }\n  /**\n   * @return {HTMLElement}\n   */\n  get $secondLevelWrapper() {\n    if (!this._secondLevelWrapper) this._secondLevelWrapper = /** @type {HTMLElement} */ (document.body.querySelector(this.SELECTORS.secondLevelNavigation));\n    return this._secondLevelWrapper;\n  }\n\n  /**\n   * function that moves the categories from the header to the page container. In case of a carousel with a selected categories\n   * calls function highligthSelectCategory to move them at the beginning of the carousel.\n   * @returns {void}\n   */\n  moveSecondLevelCategoriesUnderBody() {\n    let secondLevelCategorySections = /** @type {HTMLElement[]} */ ([...this.$el.querySelectorAll(this.SELECTORS.second_level_category)]);\n    secondLevelCategorySections.forEach((section) => {\n      if (!section.classList.contains('not-move')) {\n        this.$secondLevelWrapper.appendChild(section);\n      }\n      this.$secondLevelWrapper.classList.add('expandend');\n      let carouselContainer = /** @type {HTMLElement} */ (section.querySelector(this.SELECTORS.carouselContainer));\n      if (!carouselContainer) return;\n      this.highligthSelectCategory(carouselContainer);\n      carouselContainer.dataset.component = 'navigationCarouselComponent';\n    });\n  }\n\n  /**\n   * Function to set the initial slide with the selected category of the carousel.\n   * @param {HTMLElement} carouselContainer Swiper carousel\n   * @returns {void}\n   */\n  highligthSelectCategory(carouselContainer) {\n    if ('currentSecondLevelCategory' in this.$options && this.$options.currentSecondLevelCategory) {\n      let currentSecondLevelCategoryAll = document.querySelectorAll(\"[data-id='cat-\" + this.$options.currentSecondLevelCategory + \"']\");\n      [...currentSecondLevelCategoryAll].map((el) => {\n        el.classList.add('selected');\n        carouselContainer.dataset.optionStartAt = `${[...el.parentElement.children].indexOf(el)}`;\n      });\n    }\n  }\n\n  stateChange(changes) {\n    if ('currentCategory' in changes) {\n      [...this.$el.querySelectorAll('.category.selected')].map((el) => el.classList.remove('selected'));\n      let currentCategory = this.$el.querySelector(\"[data-id='first-nv-\" + changes.currentCategory + \"']\");\n      console.log(\"[data-id='first-nv-\" + changes.currentCategory + ']');\n      if (currentCategory) currentCategory.classList.add('selected');\n      [...this.$secondLevelWrapper.querySelectorAll('.second-level-category.selected')].map((el) => el.classList.remove('selected'));\n      let selectedMenu = this.$secondLevelWrapper.querySelector(\"[data-id='second-nv-\" + changes.currentCategory + \"']\");\n      console.log(\"[data-id='second-nv-\" + changes.currentCategory + ']');\n      if (selectedMenu) selectedMenu.classList.add('selected');\n    }\n  }\n}\n","/* eslint-disable new-cap */\n/* eslint-disable valid-jsdoc */\n/* eslint-disable no-underscore-dangle */\n\nimport Bean from 'bean';\nimport deepFreeze from '../utilities/freeze';\nimport BaseGiaComponent from './baseGiaComponent';\n\nexport default class BaseComponent extends BaseGiaComponent {\n  /**\n   * @returns {HTMLElement}\n   */\n  get $el() {\n    return /** @type {HTMLElement} */ (this._componentElement);\n  }\n\n  get $options() {\n    const compOptions = {};\n    const options = { ...this.$el.dataset };\n    const optionsEntires = Object.keys(options).filter((entry) => entry.includes('option'));\n    optionsEntires.forEach((entry) => {\n      const cleanEntry = BaseComponent.cleanOptionKey(entry);\n      let optionValue;\n      if (options[entry].includes('{') && options[entry].includes('}')) {\n        optionValue = JSON.parse(options[entry].replace(/'/g, '\"'));\n      } else {\n        optionValue = BaseComponent.convertType(options[entry]);\n      }\n      compOptions[cleanEntry] = optionValue;\n    });\n    return deepFreeze(compOptions);\n  }\n\n  get COMPONENT_NAME() {\n    return this.$el.getAttribute('data-component');\n  }\n\n  /**\n   *\n   * constructor\n   *\n   * @param {Element} element\n   */\n  constructor(element) {\n    super(element);\n    this._componentElement = element;\n    this._componentElement.setAttribute('data-component-init', 'true');\n    this._checkMessages();\n  }\n\n  static convertType(option) {\n    let optionReturn;\n    switch (option) {\n      case 'false':\n        optionReturn = false;\n        break;\n      case 'true':\n        optionReturn = true;\n        break;\n      case 'null':\n        optionReturn = null;\n        break;\n      default:\n        optionReturn = option;\n        break;\n    }\n\n    return optionReturn;\n  }\n\n  static cleanOptionKey(key) {\n    const str = key.replace('option', '');\n    return `${str.charAt(0).toLocaleLowerCase()}${str.slice(1)}`;\n  }\n\n  /**\n   *\n   * $on\n   *\n   * @param {String} events\n   * @param {Function} cb\n   * @param {Element} [element = this.$el]\n   * @param {Array|String|Element} [elements = null]\n   */\n  $on(events, cb, element = this.$el, elements = null) {\n    if (!element || !events || !cb) return;\n    if (!elements) {\n      Bean.on(element, events, (e) => {\n        if (e) e.stopPropagation();\n        cb(e);\n      });\n    } else {\n      Bean.on(element, events, elements, (e) => {\n        if (e) e.stopPropagation();\n        cb(e);\n      });\n    }\n  }\n\n  /**\n   *\n   * $one\n   *\n   * @param {String} events\n   * @param {Function} cb\n   * @param {Element} [element = this.$el]\n   */\n  $one(events, cb, element = this.$el) {\n    Bean.one(element, events, cb);\n  }\n\n  /**\n   *\n   * $off\n   *\n   * @param {String} events\n   * @param {Element} [element = this.$el]\n   */\n  $off(events, element = this.$el) {\n    Bean.off(element, events);\n  }\n\n  /**\n   *\n   * $fire\n   *\n   * @param {String} events\n   * @param {Element} [element = this.$el]\n   */\n  $fire(events, element = this.$el) {\n    Bean.fire(element, events);\n  }\n\n  /**\n   *\n   * Activate loader\n   *\n   * @param {HTMLElement} [container]\n   * @param {String} [message]\n   */\n  loading(container, message) {\n    this._loading = true;\n    this.EMIT(this.CUSTOM_MESSAGES.LOADER_EVENTS.show, {\n      container: container || document.body,\n      message: message ?? null\n    });\n  }\n\n  /**\n   *\n   * Deactivate loader\n   *\n   * @param {HTMLElement} [container]\n   * @param {String} [message]\n   * @param {Boolean} [error=false]\n   * @param {String} [icon]\n   */\n  endLoading(container, message, error = false, icon) {\n    this._loading = false;\n    setTimeout(() => {\n      if (!this._loading) {\n        this.EMIT(this.CUSTOM_MESSAGES.LOADER_EVENTS.hide, {\n          container: container || document.body,\n          message,\n          error,\n          icon\n        });\n      }\n    }, 400);\n  }\n}\n"],"sourceRoot":""}