!function(){function t(t,i){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var i=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=i){var r,n,s,o,l=[],a=!0,c=!1;try{if(s=(i=i.call(t)).next,0===e){if(Object(i)!==i)return;a=!1}else for(;!(a=(r=s.call(i)).done)&&(l.push(r.value),l.length!==e);a=!0);}catch(t){c=!0,n=t}finally{try{if(!a&&null!=i.return&&(o=i.return(),Object(o)!==o))return}finally{if(c)throw n}}return l}}(t,i)||function(t,i){if(t){if("string"==typeof t)return e(t,i);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?e(t,i):void 0}}(t,i)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function e(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,r=Array(e);i<e;i++)r[i]=t[i];return r}!function(e,i){"use strict";function r(t,i){this.defaultSettings={itemSelector:".tiles-gallery-item",sizerSelector:".tiles-gallery__sizer",parentSelector:".tiles-gallery-parent",captionSelector:".tiles-gallery-item__caption",captionTitleSelector:".tiles-gallery-item__caption-title",captionSubtitleSelector:".tiles-gallery-item__caption-subtitle",videoSelector:".video-embed",standardImageSelector:".tiles-gallery-item--standard img"},this.settings=e.extend(!0,this.defaultSettings,i||{}),this.$wrapper=t,this.$parent=this.$wrapper.closest(this.settings.parentSelector),this.$masonry=null,this.initMasonry(),this.prepareTilesCaptions()}r.prototype.initMasonry=function(){this.$masonry=this.$wrapper.masonry({itemSelector:this.settings.itemSelector,columnWidth:this.settings.sizerSelector,percentPosition:!0}),this.bindMasonryEvents(),this.$masonry.masonry("layout")},r.prototype.bindMasonryEvents=function(){var t=this;this.$masonry.on("layoutComplete",(function(){t.$parent.css("min-height",t.$wrapper.height()),t.resizeVideos()}))},r.prototype.resizeVideos=function(){var t=this.$wrapper.find(this.settings.videoSelector),i=this.$wrapper.find(this.settings.standardImageSelector).height();t.each((function(){e(this).css("height",i+"px")}))},r.prototype.prepareTilesCaptions=function(){var i=this;this.$wrapper.find(this.settings.itemSelector).each((function(){var r=e(this).find("img");if(0!=r.length){var n=t(r.attr("alt").split("/",2),2),s=n[0],o=n[1];void 0!==s&&e(this).find(i.settings.captionTitleSelector).text(s),void 0!==o&&e(this).find(i.settings.captionSubtitleSelector).text(o)}else e(this).find(i.settings.captionSelector).remove()}))},r.jQueryInterface=function(t){return this.each((function(){new r(e(this),t)}))},e.fn.tilesGallery=r.jQueryInterface,i.behaviors.tilesGallery={attach:function(t){e(once("tiles-gallery",".tiles-gallery",t)).tilesGallery()}}}(jQuery,Drupal)}();
//# sourceMappingURL=tiles-gallery.js.map