!function(t){var e={};function n(r){if(e[r])return e[r].exports;var s=e[r]={i:r,l:!1,exports:{}};return t[r].call(s.exports,s,s.exports,n),s.l=!0,s.exports}n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var s in t)n.d(r,s,function(e){return t[e]}.bind(null,s));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=45)}({45:function(t,e){((t,e,n)=>{e.behaviors.tourismHub={attach(e){const s=document.getElementsByClassName("th-scrollable");s&&n("tourismHubSetScrollable",s).forEach(e=>{const n=new r(e);function s(e){const n=t(e),r=n.closest(".card-header");n.css("height",r.css("height"))}t(e).find(".scroller-ctrl").each((e,r)=>{r.classList.contains("left")?r.addEventListener("click",t=>{t.preventDefault(),n.scrollLeft()},!1):r.classList.contains("right")&&r.addEventListener("click",t=>{t.preventDefault(),n.scrollRight()},!1),s(r),t(r).closest(".card-header").find("img").on("load",()=>{s(r)})}),window.addEventListener("resize",()=>{t(e).find(".scroller-ctrl").each((t,e)=>{s(e)})})})}};class r{constructor(e){this.$elem=t(e),this.$row=this.$elem.find(".row"),this.$elements=this.$row.find(".th-card"),this.$leftButton=this.$elem.find(".scroller-ctrl.left"),this.$rightButton=this.$elem.find(".scroller-ctrl.right"),this.currentIndex=0,this.lastIndex=this.$elements.length-1,this.scrollToIndex=function(t){const e=this.$elements[t],n=this.$row.css("marginLeft"),r=parseInt(n,10),s=e.offsetLeft-r;this.$row.animate({scrollLeft:s},500)}}scrollLeft(){if(this.$rightButton.show(),this.currentIndex<=0)return this.currentIndex=0,null;this.currentIndex=Math.max(this.currentIndex-2,0),0===this.currentIndex&&this.$leftButton.hide(),this.scrollToIndex(this.currentIndex)}scrollRight(){if(this.$leftButton.show(),this.currentIndex>=this.lastIndex)return this.currentIndex=this.lastIndex,null;this.currentIndex=Math.min(this.currentIndex+2,this.lastIndex-2),this.currentIndex===this.lastIndex-2&&this.$rightButton.hide(),this.scrollToIndex(this.currentIndex)}}})(jQuery,Drupal,once)}});
//# sourceMappingURL=tourism-hub.js.map