{"version":3,"sources":["webpack:///./src/client/default/js/components/carouselComponent.js","webpack:///./src/client/default/js/base/baseComponent.js","webpack:///./src/client/default/js/base/baseCarousel.js"],"names":["CarouselComponent","element","mount","$el","$options","BaseCarousel","BaseComponent","_componentElement","setAttribute","_checkMessages","this","compOptions","options","dataset","Object","keys","filter","entry","includes","forEach","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","document","body","error","icon","setTimeout","hide","option","optionReturn","key","str","charAt","toLocaleLowerCase","slice","BaseGiaComponent","CAROUSEL_EVENTS","UPDATE_CAROUSEL","swiperInstance","update","direction","navigation","nextEl","id","prevEl","a11y","prevSlideMessage","nextSlideMessage","paginationBulletMessage","conf","BASE_CONF","spaceBetween","Number","Swiper"],"mappings":"+oBAEqBA,E,gCACnB,WAAYC,GAAS,0BACnB,cAAMA,IACDC,MAAM,EAAKC,IAAK,EAAKC,UAFP,E,sBADwBC,I,g1BCM1BC,E,gCAmCnB,WAAYL,GAAS,0BACnB,cAAMA,IACDM,kBAAoBN,EACzB,EAAKM,kBAAkBC,aAAa,sBAAuB,QAC3D,EAAKC,iBAJc,E,6BA/BrB,WACE,OAAmCC,KAAnC,oB,oBAGF,WACE,IAAMC,EAAc,GACdC,E,iWAAU,CAAH,GAAQF,KAAKP,IAAIU,SAY9B,OAXuBC,OAAOC,KAAKH,GAASI,QAAO,SAACC,GAAD,OAAWA,EAAMC,SAAS,aAC9DC,SAAQ,SAACF,GACtB,IACIG,EADEC,EAAaf,EAAcgB,eAAeL,GAG9CG,EADER,EAAQK,GAAOC,SAAS,MAAQN,EAAQK,GAAOC,SAAS,KAC5CK,KAAKC,MAAMZ,EAAQK,GAAOQ,QAAQ,KAAM,MAExCnB,EAAcoB,YAAYd,EAAQK,IAElDN,EAAYU,GAAcD,KAErBO,YAAWhB,K,0BAGpB,WACE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AxB,OAA8CF,EAAIG,MAAM,Q,SAhEjBC,I,kqCCLtBtD,E,gCAgCnB,WAAYJ,GAAS,+BACbA,G,kCAhCR,WAAe,WACb,cACGS,KAAKiC,gBAAgBiB,gBAAgBC,iBAAkB,WAClD,EAAKC,gBACP,EAAKA,eAAeC,c,qBAK5B,WACE,MAAO,CACLC,UAAW,aAQXC,WAAY,CACVC,OAAQxD,KAAKN,SAAS+D,GAAK,uBAAyBzD,KAAKN,SAAS+D,GAAK,sBACvEC,OAAQ1D,KAAKN,SAAS+D,GAAK,uBAAyBzD,KAAKN,SAAS+D,GAAK,uBAEzEE,KAAM,CACJC,iBAAkB,sBAClBC,iBAAkB,sBAClBC,wBAAyB,gC,mBAS/B,SAAMvE,EAASW,GACb,IAAM6D,EAAO,EAAH,KACL/D,KAAKgE,WACL9D,GAED6D,EAAKE,eACPF,EAAKE,aAAeC,OAAOH,EAAKE,eAElCjE,KAAKoD,eAAiB,IAAIe,IAAO5E,EAASwE,O,UA5CJnE","file":"js/component-carouselComponent-js.chunks.js","sourcesContent":["import BaseCarousel from '../base/baseCarousel';\n\nexport default class CarouselComponent extends BaseCarousel {\n  constructor(element) {\n    super(element);\n    this.mount(this.$el, this.$options);\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","import Swiper from 'swiper';\nimport BaseComponent from './baseComponent';\n\nexport default class BaseCarousel extends BaseComponent {\n  get Messages() {\n    return {\n      [this.CUSTOM_MESSAGES.CAROUSEL_EVENTS.UPDATE_CAROUSEL]: () => {\n        if (this.swiperInstance) {\n          this.swiperInstance.update();\n        }\n      }\n    };\n  }\n  get BASE_CONF() {\n    return {\n      direction: 'horizontal',\n\n      // If we need pagination\n      // pagination: {\n      //     el: '.swiper-pagination'\n      // },\n\n      // Navigation arrows\n      navigation: {\n        nextEl: this.$options.id ? '.swiper-button-next-' + this.$options.id : '.swiper-button-next',\n        prevEl: this.$options.id ? '.swiper-button-prev-' + this.$options.id : '.swiper-button-prev'\n      },\n      a11y: {\n        prevSlideMessage: 'Immagini precedenti',\n        nextSlideMessage: 'Immagini successive',\n        paginationBulletMessage: 'Vai all`mmagine {{index}}'\n      }\n    };\n  }\n\n  constructor(element) {\n    super(element);\n  }\n\n  mount(element, options) {\n    const conf = {\n      ...this.BASE_CONF,\n      ...options\n    };\n    if (conf.spaceBetween) {\n      conf.spaceBetween = Number(conf.spaceBetween);\n    }\n    this.swiperInstance = new Swiper(element, conf);\n  }\n}\n"],"sourceRoot":""}