!function(){var e;(e=jQuery)(window).on("et_pb_init_modules",(function(){window.et_pb_init_gallery_modules=function(){var a="object"==typeof window.ET_Builder,t=e(".et_pb_gallery"),i=e(".et_post_gallery"),n=void 0!==window.ETBlockLayoutModulesScript&&e("body").hasClass("et-block-layout-preview");e((()=>{if(!n&&i.length>0){const a=e.magnificPopup.instance;e("body").on("swiperight",".mfp-container",(()=>{a.prev()})),e("body").on("swipeleft",".mfp-container",(()=>{a.next()})),i.each((function(){e(this).magnificPopup({delegate:".et_pb_gallery_image a",type:"image",removalDelay:500,gallery:{enabled:!0,navigateByImgClick:!0},mainClass:"mfp-fade",zoom:{enabled:window.et_pb_custom&&!window.et_pb_custom.is_builder_plugin_used,duration:500,opener:e=>e.find("img")},autoFocusLast:!1})})),i.find("a").off("click")}(t.length||a)&&(window.set_gallery_grid_items=function(a){const t=a.find(".et_pb_gallery_items"),i=t.find(".et_pb_gallery_item");var n=i.length;const l=parseInt(t.attr("data-per_page")),s=isNaN(l)||0===l?4:l,p=Math.ceil(n/s);window.et_pb_set_responsive_grid(t,".et_pb_gallery_item"),set_gallery_grid_pages(a,p),n=0;let _=1;i.data("page",""),i.each((function(a){n++;const t=e(this);0===parseInt(n%s)?(t.data("page",_),_++):t.data("page",_)})),i.filter((function(){return 1==e(this).data("page")})).show(),i.filter((function(){return 1!=e(this).data("page")})).hide()},window.set_gallery_grid_pages=function(e,a){const t=e.find(".et_pb_gallery_pagination");if(!t.length)return;if(t.html("<ul></ul>"),a<=1)return void t.hide();t.show();const i=t.children("ul");i.empty();const n=a;i.append(`<li class="prev" style="display:none;"><a href="#" data-page="prev" class="page-prev">${et_pb_custom.prev}</a></li>`),i.append('<li style="display:none;" class="prev-dots">...</li>');for(let e=1;e<=n;e++){const a=1===e?" active":"",t=e===n?" last-page":"",l=e>4?' style="display:none;"':"";i.append(`<li${l} class="page page-${e}"><a href="#" data-page="${e}" class="page-${e}${a}${t}">${e}</a></li>`)}n>4&&5<=n&&i.append('<li class="next-dots">...</li>'),1<n&&i.append(`<li class="next"><a href="#" data-page="next" class="page-next">${et_pb_custom.next}</a></li>`)},window.set_gallery_hash=function(e){if(!e.attr("id"))return;let a=[];a.push(e.attr("id")),e.find(".et_pb_gallery_pagination a.active").length?a.push(e.find(".et_pb_gallery_pagination a.active").data("page")):a.push(1),a=a.join(et_hash_module_param_seperator),setHash(a)},window.et_pb_gallery_init=function(a){a.hasClass("et_pb_gallery_grid")&&(a.show(),set_gallery_grid_items(a),a.on("et_hashchange",(t=>{const{params:i}=t;a=e(`#${t.target.id}`);const n=i[0];n&&(a.find(`.et_pb_gallery_pagination a.page-${n}`).hasClass("active")||a.find(`.et_pb_gallery_pagination a.page-${n}`).addClass("active").trigger("click"))})))},window.et_pb_gallery_pagination_nav=function(a){a.off("click",".et_pb_gallery_pagination a"),a.on("click",".et_pb_gallery_pagination a",(function(a){a.preventDefault();let t=e(this).data("page");const i=e(this).parents(".et_pb_gallery"),n=i.find(".et_pb_gallery_items"),l=n.find(".et_pb_gallery_item");if(i.data("paginating"))return;i.data("paginating",!0);const s=e(this).parents("ul"),p=s.find("a.active").data("page"),_=s.find("li.page").length;e(this).hasClass("page-prev")?t=Math.max(1,parseInt(p)-1):e(this).hasClass("page-next")&&(t=Math.min(_,parseInt(p)+1)),s.find("a").removeClass("active"),s.find(`a.page-${t}`).addClass("active");const o=s.find(`a.page-${t}`).parent().index();e(this).parent().nextUntil(`.page-${o+3}`).show(),e(this).parent().prevUntil(".page-"+(o-3)).show(),s.find("li.page").each((function(a){e(this).hasClass("prev")||e(this).hasClass("next")||(a<=o-3||a>o+1?e(this).hide():e(this).show(),(_-o<=1&&_-a<5||o<2&&a<=4)&&e(this).show())})),s.find("li.prev, li.prev-dots").toggle(t>1),s.find("li.next").toggle(!s.find("a.active").hasClass("last-page")),s.find("li.next-dots").toggle(o+2<_),l.hide(),l.filter((function(a){return e(this).data("page")===t})).show(),window.et_pb_set_responsive_grid(n,".et_pb_gallery_item"),setTimeout((()=>{set_gallery_hash(i),i.data("paginating",!1)}),100)}))},a?et_pb_gallery_pagination_nav(e("#et-fb-app")):et_pb_gallery_pagination_nav(t)),t.each((function(){const a=e(this);et_pb_gallery_init(a)})),t.data("paginating",!1)})),e(document.body).on("post-load",(function(){e(".et_pb_gallery").each((function(){const a=e(this);a.hasClass("et_pb_gallery_grid")&&a.find(".et_pb_gallery_pagination ul").children().length||et_pb_gallery_init(a)}))})),window.addEventListener("divi:setPaginatedContent",(function(a){const t=a.detail?.$current_module;t&&t.find(".et_pb_gallery").each((function(){const a=e(this);et_pb_gallery_init(a)}))}))},window.et_pb_init_gallery_modules()})),((window.divi=window.divi||{}).scriptLibrary=window.divi.scriptLibrary||{}).scriptLibraryGallery={}}();