!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 s=parseInt(t.attr("data-per_page")),l=isNaN(s)||0===s?4:s,p=Math.ceil(n/l);window.et_pb_set_responsive_grid(t,".et_pb_gallery_item"),set_gallery_grid_pages(a,p),n=0;let r=1;i.data("page",""),i.each((function(a){n++;const t=e(this);0===parseInt(n%l)?(t.data("page",r),r++):t.data("page",r)})),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":"",s=e>4?' style="display:none;"':"";i.append(`<li${s} 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.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"),s=n.find(".et_pb_gallery_item");if(i.data("paginating"))return;i.data("paginating",!0),e(this).hasClass("page-prev")?t=parseInt(e(this).parents("ul").find("a.active").data("page"))-1:e(this).hasClass("page-next")&&(t=parseInt(e(this).parents("ul").find("a.active").data("page"))+1),e(this).parents("ul").find("a").removeClass("active"),e(this).parents("ul").find(`a.page-${t}`).addClass("active");const l=e(this).parents("ul").find(`a.page-${t}`).parent().index(),p=e(this).parents("ul").find("li.page").length;e(this).parent().nextUntil(`.page-${l+3}`).show(),e(this).parent().prevUntil(".page-"+(l-3)).show(),e(this).parents("ul").find("li.page").each((function(a){e(this).hasClass("prev")||e(this).hasClass("next")||(a<=l-3||a>l+1?e(this).hide():e(this).show(),(p-l<=1&&p-a<5||l<2&&a<=4)&&e(this).show())})),e(this).parents("ul").find("li.prev, li.prev-dots").toggle(t>1),e(this).parents("ul").find("li.next").toggle(!e(this).parents("ul").find("a.active").hasClass("last-page")),e(this).parents("ul").find("li.next-dots").toggle(l+2<p),s.hide(),s.filter((function(a){return e(this).data("page")===t})).show(),i.data("paginating",!1),window.et_pb_set_responsive_grid(n,".et_pb_gallery_item"),setTimeout((()=>{set_gallery_hash(i)}),100)}))},et_pb_gallery_pagination_nav(t),a&&et_pb_gallery_pagination_nav(e("#et-fb-app"))),t.each((function(){const a=e(this);et_pb_gallery_init(a)})),t.data("paginating",!1)}))},window.et_pb_init_gallery_modules()})),((window.divi=window.divi||{}).scriptLibrary=window.divi.scriptLibrary||{}).scriptLibraryGallery={}}();