{"version":3,"sources":["webpack:///./src/client/default/js/components/navigationMenuComponent.js","webpack:///./src/client/default/js/base/baseComponent.js"],"names":["SearchBar","element","$secondLevelWrapper","pageAction","document","querySelector","dataset","action","moveSecondLevelCategoriesUnderBody","setState","currentCategory","$options","secondLevelNavigation","second_level_category","carouselContainer","categoryLink","selected","this","_secondLevelWrapper","body","SELECTORS","$el","querySelectorAll","forEach","section","classList","contains","appendChild","add","highligthSelectCategory","component","currentSecondLevelCategory","currentSecondLevelCategoryAll","map","el","optionStartAt","parentElement","children","indexOf","changes","remove","console","log","selectedMenu","BaseComponent","_componentElement","setAttribute","_checkMessages","compOptions","options","Object","keys","filter","entry","includes","optionValue","cleanEntry","cleanOptionKey","JSON","parse","replace","convertType","deepFreeze","getAttribute","events","cb","elements","Bean","on","e","stopPropagation","one","off","fire","container","message","_loading","EMIT","CUSTOM_MESSAGES","LOADER_EVENTS","show","error","icon","setTimeout","hide","option","optionReturn","key","str","charAt","toLocaleLowerCase","slice","BaseGiaComponent"],"mappings":"iqBAEqBA,E,gCACnB,WAAYC,GAAS,UAEnB,OAFmB,aACnB,cAAMA,IACIC,qBAIV,EAAKC,YAAwC,UAACC,SAASC,cAAc,gBAAxB,mBAAmCC,eAAnC,eAA4CC,SAAU,GACnG,EAAKC,qCACL,EAAKC,SAAS,CAAEC,gBAAiB,EAAKC,SAASD,kBAR5B,GAEY,O,mCASjC,WACE,MAAO,CAAEE,sBAAuB,yBAA0BC,sBAAuB,yBAA0BC,kBAAmB,SAAUC,aAAc,e,mBAGxJ,WACE,MAAO,CACLC,SAAU,c,+BAMd,WAEE,OADKC,KAAKC,sBAAqBD,KAAKC,oBAAkDd,SAASe,KAAKd,cAAcY,KAAKG,UAAUR,wBAC1HK,KAAKC,sB,gDAQd,WAAqC,WACJ,IAAqCD,KAAKI,IAAIC,iBAAiBL,KAAKG,UAAUP,wBACjFU,SAAQ,SAACC,GAC9BA,EAAQC,UAAUC,SAAS,aAC9B,EAAKxB,oBAAoByB,YA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UACR,EAAKC,KAAK,EAAKC,gBAAgBC,cAAcK,KAAM,CACjDV,UAAWA,GAAatE,SAASe,KACjCwD,UACAM,QACAC,WAGH,Q,0BAtHL,SAAmBG,GACjB,IAAIC,EACJ,OAAQD,GACN,IAAK,QACHC,GAAe,EACf,MACF,IAAK,OACHA,GAAe,EACf,MACF,IAAK,OACHA,EAAe,KACf,MACF,QACEA,EAAeD,EAInB,OAAOC,I,4BAGT,SAAsBC,GACpB,IAAMC,EAAMD,EAAI3B,QAAQ,SAAU,IAClC,gBAAU4B,EAAIC,OAAO,GAAGC,qBAAxB,OAA8CF,EAAIG,MAAM,Q,SAhEjBC","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":""}