!function(t){var e={};function i(s){if(e[s])return e[s].exports;var n=e[s]={i:s,l:!1,exports:{}};return t[s].call(n.exports,n,n.exports,i),n.l=!0,n.exports}i.m=t,i.c=e,i.d=function(t,e,s){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:s})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var s=Object.create(null);if(i.r(s),Object.defineProperty(s,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)i.d(s,n,function(e){return t[e]}.bind(null,n));return s},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=41)}({41:function(t,e){for(var i=[{label:"xs",value:0},{label:"sm",value:580},{label:"md",value:768},{label:"lg",value:992},{label:"xl",value:1200},{label:"xxl",value:3e3}],s=[],n=0;n<i.length;n++)s.push(i[n].label);var o=window.innerWidth;function a(t,e){clearTimeout(t.timeId),t.timeId=setTimeout((function(){t()}),e)}function l(t){this.selector=t,this.isCollapsed=!1,this.isTablet=!1,this.isMobile=!1,this.isDesktop=!1,this.isAtTop=!0,this.hasScrolled=!1,this.isMinified=!1,this.hasOverlay=!1,this.lastActiveTab=null,this.tabsClosed=!0,this.isInlineBKF=document.querySelector(".btf-mobile-inline"),this.element=document.getElementById(t),this.header=document.getElementById("header"),this.tabsWrapper=document.getElementById("nav-btld"),this.tabs=this.getJPBTabs()}l.prototype.getJPBTabs=function(){var t=[];if(this.tabsWrapper){var e=this.tabsWrapper.querySelectorAll('a[data-bs-toggle="tab"]');e&&e.forEach((function(e){var i=e.id.replace("tbt-","");"tbh-btld"!==i&&t.push(i)}))}return t},l.prototype.handleScroll=function(){var t=document.body.classList.contains("page-no-scrolling");document.body.classList.contains("page-overlay-on")||t||this.isMobile&&this.isInlineBKF||this.tabsWrapper&&(window.scrollY>this.tabsWrapper.offsetHeight?this.minify():this.unminify())},l.prototype.handleResize=function(){var t=window.innerWidth;t!==o&&(this.setState(),this.showLastActiveTab(),this.hideLastActiveTab(),this.handleScroll(),o=t)},l.prototype.minify=function(){this.isMinified||(this.isMinified=!0,this.element.dataset.isMinified=!0,this.header.classList.add("header-minify"),this.hideLastActiveTab(!0))},l.prototype.unminify=function(){this.isMinified&&(this.isMinified=!1,this.element.dataset.isMinified=!1,this.header.classList.remove("header-minify"),this.showLastActiveTab())},l.prototype.setState=function(){var t=function(){for(var t=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,e=0;e<i.length;e++){var s=i[e].value,n=1e4;if(i[e+1]&&(n=i[e+1].value),t>=s&&t<n)return i[e].label}return!1}();this.isTablet=!1,this.isMobile=!1,this.isDesktop=!1,"lg"===t||"xl"===t||"xxl"===t?this.isDesktop=!0:"md"===t?this.isTablet=!0:"sm"!==t&&"xs"!==t||(this.isMobile=!0)},l.prototype.showLastActiveTab=function(){if(this.isDesktop||this.isInlineBKF){var t=!1;t=this.lastActiveTab?this.tabs[this.lastActiveTab]:this.tabs[0];var e=document.getElementById("tbt-".concat(t));t&&e&&(this.tabsClosed=!1,new window.Tab(e).show())}},l.prototype.hideLastActiveTab=function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.tabsClosed=!1,this.isMobile||this.isTablet||t){var e=document.getElementById("tbt-tbh-btld");e&&(e.classList.contains("active")||(new window.Tab(e).show(),(this.isMobile||this.isTablet)&&(this.tabsClosed=!0)))}},l.prototype.setListeners=function(){var t=this,e=this;window.addEventListener("scroll",(function(){a((function(){e.handleScroll()}),100)})),window.addEventListener("resize",(function(){a((function(){e.handleResize()}),100)})),this.tabs.forEach((function(i,s){var n=document.getElementById("tbt-".concat(i));n&&(n.addEventListener("mousedown",(function(i){(t.isMobile||t.isTablet)&&(e.lastActiveTab!==s||e.tabsClosed?(e.tabsClosed=!1,e.lastActiveTab=null):(e.hideLastActiveTab(),i.preventDefault())),t.isMobile&&t.isInlineBKF&&0!==window.scrollY&&(window.scrollToTop(200),e.tabsClosed&&t.showLastActiveTab())})),n.addEventListener("show.bs.tab",(function(i){(t.isMobile||t.isTablet)&&e.lastActiveTab===s&&e.tabsClosed?i.preventDefault():e.lastActiveTab=s})))}))},l.prototype.constructMe=function(){this.setState(),this.setListeners(),this.showLastActiveTab(),this.isMobile&&!this.isInlineBKF&&this.hideLastActiveTab()},function(t,e){t.behaviors.journeyPlannerBar={attach:function(t){console.log("Loaded -- Journey Panner Bar"),e("journeyPlanner","html",document).forEach((function(t){new l("hdr").constructMe()}))}}}(Drupal,once)}});
//# sourceMappingURL=journey-planner-bar.js.map