{"version":3,"sources":["webpack://@verndale/toolkit/./src/js/modules/floor-plans-row.js"],"names":["Module","Component","el","BREAKPOINTS","maxHeight","debounce","panelContainer","resolve","currentContainer","node","e","room","close"],"mappings":"uLAIA,MAAMA,UAAeC,WAAU,CAC7B,eAAgB,CACd,KAAK,IAAM,CACT,IAAK,KAAK,GACV,UAAW,KAAK,GAAG,IAAI,2BAA2B,EAClD,aAAc,KAAK,GAAG,GAAG,gCAAgC,EACzD,iBAAkB,KAAK,GAAG,IAAI,mCAAmC,EACjE,cAAe,KAAK,GAAG,IAAI,sCAAsC,EACjE,aAAc,KAAK,GAAG,IAAI,qCAAqC,EAC/D,YAAa,KAAK,GAAG,GAAG,oCAAoC,EAC5D,sBAAuB,KAAK,GAAG,IAAI,mDAAmD,EACtF,aAAc,KAAK,GAAG,IAAI,+BAA+B,EACzD,aAAc,KAAK,GAAG,IAAI,qCAAqC,EAC/D,aAAc,KAAK,GAAG,IAAI,qCAAqC,EAC/D,gBAAiB,KAAK,GAAG,GAAG,yCAAyC,EACrE,QAAS,KAAK,GAAG,IAAI,QAAQ,EAC7B,qBAAsB,KAAK,GAAG,IAAI,aAAa,CACjD,EACA,KAAK,gBAAkB,KAAK,GAAG,QAAQ,UACvC,KAAK,iBAAmB,KAAK,GAAG,QAAQ,aACxC,KAAK,aAAe,GACpB,KAAK,cACL,KAAK,cACL,KAAK,YAAc,GACnB,KAAK,IAAI,aAAa,QAAQC,GAAMA,EAAG,GAAG,cAAc,EAAE,UAAY,KAAK,eAAe,EAC1F,KAAK,IAAI,UAAU,QAAQA,GAAMA,EAAG,GAAG,cAAc,EAAE,UAAY,KAAK,gBAAgB,EAEnF,KAAK,IAAI,IAAI,UAAU,SAAS,oBAAoB,EAGvD,KAAK,sBAAsB,EAF3B,KAAK,gBAAgB,CAIzB,CAEA,uBAAuB,CACrB,KAAK,IAAI,iBAAiB,QAAQA,GAAMA,EAAG,OAAO,CAAC,EACnD,KAAK,IAAI,QAAQ,QAAQA,GAAMA,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AG,MAAM,OAAO,GAAG,EAC3D,KAAK,IAAI,aAAa,QAAQA,GAAMA,EAAG,MAAM,OAAO,GAAG,CACzD,CAEA,kBAAkB,CAChB,KAAK,IAAI,iBAAiB,QAAQA,GAAMA,EAAG,MAAM,OAAO,IAAI,EAC5D,KAAK,IAAI,aAAa,QAAQA,GAAMA,EAAG,MAAM,OAAO,IAAI,CAC1D,CAEA,YAAYQ,EAAG,CACTA,EAAE,cAAc,UAAU,SAAS,qCAAqC,GAC1E,KAAK,IAAI,iBAAiB,QAAQR,GAAM,CACtCA,EAAG,MAAM,QAAU,OACnBA,EAAG,OAAS,EACd,CAAC,EAEH,KAAK,IAAI,iBAAiB,QAAQA,GAAMA,EAAG,UAAU,OAAO,QAAQ,CAAC,EACrE,KAAK,IAAI,UAAU,QAAQA,GAAM,CAC/BA,EAAG,MAAM,QAAU,IACrB,CAAC,EACD,KAAK,IAAI,aAAa,MAAM,QAAU,IACxC,CAEA,sBAAsBQ,EAAG,CACvB,MAAME,EAAQF,EAAE,QAAQ,UAAU,2CAA2C,GAAG,KAAK,sCAAsC,EACvHE,GAAOA,EAAM,MAAM,CACzB,CACF,CAEA,UAAeZ,C","file":"Areas/SunriseSeniorLiving/Scripts/249.7ae4103845906ff49cbe.bundle.js","sourcesContent":["import { Component } from '@verndale/core';\nimport { debounce } from 'lodash';\nimport { BREAKPOINTS } from '../constants';\n\nclass Module extends Component {\n  setupDefaults() {\n    this.dom = {\n      $el: this.el,\n      $triggers: this.el._$$('.floor-plans-row__trigger'),\n      $sectionHead: this.el._$('.floor-plans-row__section-head'),\n      $panelContainers: this.el._$$('.floor-plans-row__panel-container'),\n      $closeButtons: this.el._$$('.floor-plans-row__panel-close-button'),\n      $backButtons: this.el._$$('.floor-plans-row__panel-back-button'),\n      $disclaimer: this.el._$('.floor-plans-row__panel-disclaimer'),\n      $panelsDetailsDesktop: this.el._$$('.floor-plans-row__panel-details-container-desktop'),\n      $panelInners: this.el._$$('.floor-plans-row__panel-inner'),\n      $prevButtons: this.el._$$('.floor-plans-row__panel-prev-button'),\n      $nextButtons: this.el._$$('.floor-plans-row__panel-next-button'),\n      $bottomControls: this.el._$('.floor-plans-row__panel-controls-bottom'),\n      $modals: this.el._$$('.modal'),\n      $anchorsInDisclaimer: this.el._$$('[href^=\"#\"]')\n    };\n    this.backButtonLabel = this.el.dataset.backLabel\n    this.viewDetailsLabel = this.el.dataset.detailsLabel\n    this.currentSlide = -1;\n    this.prevContainer;\n    this.nextContainer;\n    this.displayType = '';\n    this.dom.$backButtons.forEach(el => el._$('.link__label').innerText = this.backButtonLabel);\n    this.dom.$triggers.forEach(el => el._$('.link__label').innerText = this.viewDetailsLabel);\n\n    if (!this.dom.$el.classList.contains('isExperienceEditor')){\n      this.setSlidesHeight();\n    } else {\n      this.removePanelsAndModals();\n    }\n  }\n\n  removePanelsAndModals(){\n    this.dom.$panelContainers.forEach(el => el.remove())\n    this.dom.$modals.forEach(el => el.remove())\n  }\n\n  setSlidesHeight(){\n    window.matchMedia(`(min-width: ${BREAKPOINTS.TABLET_LANDSCAPE}px)`).matches ?  this.displayType = 'flex' : this.displayType = 'block'\n    this.dom.$panelContainers.forEach(el => el.style.display = this.displayType)\n    const maxHeight = 0;\n    // this.dom.$panelsDetailsDesktop.forEach(el => {\n    //   el.style.height = null\n    //   if (el.offsetHeight > maxHeight) maxHeight = el.offsetHeight;\n    // })\n    // if (window.matchMedia(`(min-width: ${BREAKPOINTS.TABLET_LANDSCAPE}px)`).matches){\n    //   const bottomControlsHeight = this.dom.$bottomControls.offsetHeight;\n    //   this.dom.$panelsDetailsDesktop.forEach(el => {\n    //     el.style.height = `${maxHeight+bottomControlsHeight+150}px`;\n    //   })\n    // }\n\n    this.dom.$panelContainers.forEach(el =>  {\n      if (!el.classList.contains('active')) el.style.display = 'none';\n      else el.style.display = this.displayType;\n    })\n\n  }\n\n  addListeners() {\n    if (!this.dom.$el.classList.contains('isExperienceEditor')){\n      this.dom.$triggers._on('click', this.handlePanelActivation.bind(this));\n      this.dom.$closeButtons.forEach(el => el._on('click', this.handleClose.bind(this)));\n      this.dom.$backButtons.forEach(el => el._on('click', this.handleClose.bind(this)));\n      this.dom.$panelContainers.forEach(el => el._on('transitionend', this.handleTransitionEnd.bind(this)));\n      this.dom.$prevButtons.forEach(el => el._on('click', this.handlePrevClick.bind(this)));\n      this.dom.$nextButtons.forEach(el => el._on('click', this.handleNextClick.bind(this)));\n      this.dom.$modals.forEach(el => el.addEventListener('modalopen', this.handleModalOpen.bind(this)));\n      this.dom.$modals.forEach(el => el.addEventListener('modalclose', this.handleModalClose.bind(this)));\n      this.dom.$anchorsInDisclaimer._on('click', this.handleAnchorLinkClick.bind(this));\n      window.addEventListener('resize', debounce(this.setSlidesHeight.bind(this), 300));\n    }\n  }\n\n  async showPanel(panelContainer) {\n    panelContainer.style.display = this.displayType;\n    panelContainer.hidden = false;\n    // eslint-disable-next-line no-undef\n    await new Promise(resolve => {\n      requestAnimationFrame(() => resolve());\n    });\n\n    this.checkNavigationButtonsLabels();\n    this.checkDisclaimer();\n    requestAnimationFrame(() => panelContainer.classList.add('active'))\n  }\n\n  checkNavigationButtonsLabels(){\n    const currentContainer = this.dom.$panelContainers[this.currentIndex]\n    this.prevContainer = this.dom.$panelContainers[this.currentIndex-1]\n    this.nextContainer = this.dom.$panelContainers[this.currentIndex+1]\n\n    if (this.prevContainer){\n      currentContainer._$('.floor-plans-row__panel-prev-button .link__label').innerHTML = this.prevContainer.querySelector('.floor-plans-row__panel-heading').innerHTML;\n    } else {\n      currentContainer._$('.floor-plans-row__panel-prev-button .link__label').innerHTML = ''\n      currentContainer._$('.floor-plans-row__panel-prev-button').disabled = true;\n    }\n\n    if (this.nextContainer){\n      currentContainer._$('.floor-plans-row__panel-next-button .link__label').innerHTML = this.nextContainer.querySelector('.floor-plans-row__panel-heading').innerHTML;\n    } else {\n      currentContainer._$('.floor-plans-row__panel-next-button .link__label').innerHTML = ''\n      currentContainer._$('.floor-plans-row__panel-next-button').disabled = true;\n    }\n  }\n\n  checkDisclaimer(){\n    const currentContainer = this.dom.$panelContainers[this.currentIndex]\n\n    if (!currentContainer._$('.floor-plans-row__panel-disclaimer') && this.dom.$disclaimer){\n      const node = this.dom.$disclaimer.cloneNode(true)\n      node.hidden = false;\n      currentContainer._$('.floor-plans-row__panel-controls-bottom').appendChild(node)\n\n      this.dom.$anchorsInDisclaimer = this.el._$$('[href^=\"#\"]');\n      this.dom.$anchorsInDisclaimer._on('click', this.handleAnchorLinkClick.bind(this));\n    }\n  }\n\n  handleNextClick(){\n    this.nextContainer.style.transitionDuration = '0ms';\n    this.dom.$panelContainers.forEach(el => { el.style.display = 'none'; el.classList.remove('active'); });\n    this.nextContainer.classList.add('active');\n    this.nextContainer.style.display = this.displayType;\n    this.nextContainer.style.transitionDuration = null;\n    this.currentIndex++;\n    this.checkDisclaimer();\n    this.checkNavigationButtonsLabels();\n  }\n\n  handlePrevClick(){\n    this.prevContainer.style.transitionDuration = '0ms';\n    this.dom.$panelContainers.forEach(el => { el.style.display = 'none'; el.classList.remove('active'); });\n    this.prevContainer.classList.add('active');\n    this.prevContainer.style.display = this.displayType;\n    this.prevContainer.style.transitionDuration = null;\n    this.currentIndex--;\n    this.checkDisclaimer();\n    this.checkNavigationButtonsLabels();\n  }\n\n  handleTransitionEnd(e) {\n    if (!e.currentTarget.classList.contains('active')) {\n      e.currentTarget.style.display = 'none';\n    } else {\n      this.dom.$triggers.forEach(el => {\n        el.style.display = 'none';\n      })\n      this.dom.$sectionHead.style.display = 'none';\n    }\n  }\n\n  handlePanelActivation(e) {\n    const { room } = e.currentTarget.dataset;\n    const panelContainer = this.dom.$panelContainers.find(el => el.dataset.room === room);\n    this.currentIndex = this.dom.$panelContainers.indexOf(panelContainer);\n    this.dom.$panelContainers.forEach(el => el.style.display = 'none')\n    panelContainer.style.display = this.displayType;\n    this.showPanel(panelContainer);\n  }\n\n  handleModalOpen(){\n    this.dom.$panelContainers.forEach(el => el.style.height='0')\n    this.dom.$panelInners.forEach(el => el.style.height='0')\n  }\n\n  handleModalClose(){\n    this.dom.$panelContainers.forEach(el => el.style.height=null)\n    this.dom.$panelInners.forEach(el => el.style.height=null)\n  }\n\n  handleClose(e) {\n    if (e.currentTarget.classList.contains('floor-plans-row__panel-close-button')){\n      this.dom.$panelContainers.forEach(el => {\n        el.style.display = 'none';\n        el.hidden = true;\n      });\n    }\n    this.dom.$panelContainers.forEach(el => el.classList.remove('active'))\n    this.dom.$triggers.forEach(el => {\n      el.style.display = null;\n    })\n    this.dom.$sectionHead.style.display = null;\n  }\n\n  handleAnchorLinkClick(e) {\n    const close = e.target?.closest?.('.floor-plans-row__panel-content-container')?._$?.('.floor-plans-row__panel-close-button');\n    if (close) close.click();\n  }\n}\n\nexport default Module;\n"],"sourceRoot":""}