import"./lib/pollyfills.js";import"./lib/mousewheel.js";import"./lib/jquery.justifiedGallery.js";import"./lib/enviraJustifiedGallery-extensions.js";import"./lib/imagesloaded.js";import"./lib/isotope.js";import"./lib/envirabox.js";import"./lib/envirabox-fullscreen.js";import"./lib/envirabox-media.js";import"./lib/envirabox-wheel.js";import"./lib/envirabox-guestures.js";import"./lib/envirabox-thumbs.js";import"./lib/envirabox-slideshow.js";import Envira from"./gallery-init.js";import Envira_Link from"./gallery-link.js";var envira_galleries=window.envira_galleries||{},envira_links=window.envira_links||{};!function(i,e,a,l,r,n,t){i((function(){e.envira_galleries=t,e.envira_links=envira_links,i(a).on("envira_load",(function(e){e.stopPropagation(),t={},envira_links={};var n=[];i(".envira-gallery-public").each((function(){let e=i(this),a=e.data("envira-id"),r=e.data("gallery-config"),o=e.data("gallery-images"),v=e.data("lightbox-theme"),s="";void 0!==n[r.gallery_id]?(s="_"+(n[r.gallery_id]?parseInt(n[r.gallery_id])+1:2),n[r.gallery_id]=parseInt(n[r.gallery_id])+1):n[r.gallery_id]=1,t[r.gallery_id]=new l(r.gallery_id+s,r,o,v),i("#envira-gallery-wrap-"+r.gallery_id+s+".envira-lazy-loading-disabled").length?i("#envira-gallery-wrap-"+r.gallery_id+s+".envira-lazy-loading-disabled").find(".envira-loader").remove():i(".envira-gallery-wrap").find(".envira-loader").remove()})),i(".envira-gallery-links").each((function(){let e=i(this),a=e.data("gallery-config"),l=e.data("gallery-images"),n=e.data("lightbox-theme");void 0===envira_links[a.gallery_id]&&(envira_links[a.gallery_id]=new r(a,l,n))})),i(a).trigger("envira_loaded",[t,envira_links])})),i(a).trigger("envira_load"),void 0!==n.debug&&n.debug&&(console.log(envira_links),console.log(t)),i("body").on("click",'div.envirabox-title a[href*="#"]:not([href="#"])',(function(e){if(location.pathname.replace(/^\//,"")==this.pathname.replace(/^\//,"")&&location.hostname==this.hostname)return i.envirabox.close(),!1})),i(a).on("envira_image_lazy_load_complete",(function(a){let l="";if(void 0!==a&&(void 0!==a.image_id&&null!==a.image_id||void 0!==a.video_id&&null!==a.video_id)){if(l=i("#envira-gallery-wrap-"+a.gallery_id).find("#"+a.video_id+" iframe").length>0?i("#envira-gallery-wrap-"+a.gallery_id).find("#"+a.video_id+" iframe"):i("#envira-gallery-wrap-"+a.gallery_id).find("#"+a.video_id+" video").length>0?i("#envira-gallery-wrap-"+a.gallery_id).find("#"+a.video_id+" video"):i("#envira-gallery-wrap-"+a.gallery_id).find("img#"+a.image_id),i("#envira-gallery-wrap-"+a.gallery_id).length?i("#envira-gallery-wrap-"+a.gallery_id).find(".envira-loader").remove():i(".envira-gallery-wrap").find(".envira-loader").remove(),void 0===l||""===l)return;if(i("#envira-gallery-wrap-"+a.gallery_id).find("div.envira-gallery-public").hasClass("envira-gallery-0-columns"))i(l).closest("div.envira-gallery-item-inner").find("div.envira-gallery-position-overlay").delay(100).show();else{i(l).closest("div.envira-gallery-item-inner").find("div.envira-gallery-position-overlay").delay(100).show();var r=i(l).closest("div.envira-gallery-item-inner").find(".envira-lazy").width(),n=a.naturalHeight/a.naturalWidth,t=a.naturalHeight/r;if(t<n)var o=t;else var o=n;var v=100*o;l.closest("div.envira-gallery-public").parent().hasClass("envira-gallery-theme-sleek")&&(v+=2);var s=i(l).closest("div.envira-gallery-item-inner").find("div.envira-lazy"),d=s.closest("div.envira-gallery-item-inner").find(".envira-gallery-captioned-data").height(),g,g;if(i(l).closest("div.envira-gallery-item").hasClass("enviratope-item"))s.css("padding-bottom",v+"%").attr("data-envira-changed","true"),(g=i(l).closest("div.envira-gallery-item-inner").find(".envira-gallery-position-overlay.envira-gallery-bottom-right")).css("bottom",d),(g=i(l).closest("div.envira-gallery-item-inner").find(".envira-gallery-position-overlay.envira-gallery-bottom-left")).css("bottom",d);else s.css("height","auto").css("padding-bottom","10px").attr("data-envira-changed","true"),(g=i(l).closest("div.envira-gallery-item-inner").find(".envira-gallery-position-overlay.envira-gallery-bottom-right")).css("bottom",d+10),(g=i(l).closest("div.envira-gallery-item-inner").find(".envira-gallery-position-overlay.envira-gallery-bottom-left")).css("bottom",d+10);i(l).closest("div.envira-gallery-item-inner").find("span.envira-title").delay(1e3).css("visibility","visible"),i(l).closest("div.envira-gallery-item-inner").find("span.envira-caption").delay(1e3).css("visibility","visible"),void 0!==e["envira_container_"+a.gallery_id]&&i("#envira-gallery-"+a.gallery_id).hasClass("enviratope")&&e["envira_container_"+a.gallery_id].on("layoutComplete",(function(e,a){i(l).closest("div.envira-gallery-item-inner").find("span.envira-title").delay(1e3).css("visibility","visible"),i(l).closest("div.envira-gallery-item-inner").find("span.envira-caption").delay(1e3).css("visibility","visible")}))}}}))}))}(jQuery,window,document,Envira,Envira_Link,envira_gallery,envira_galleries);