import{b as t}from"./Mapsvg-qIIOi3d0.js";class e{constructor(t){const{mapsvg:e}=t;this.mapsvg=e}init(){Handlebars.registerHelper("mapsvg_gallery",(function(t,e){if(!e)return;e.full&&void 0===e.length&&(e=[e]);let i="";const l=(t=(t+="").split("."))[0],s=t[1],a=undefined;let d;window.mapsvg.getById(l).getData().options.galleries.forEach((function(t){t.id==s&&(d=t)}));const o=void 0!==d.thumb_margin?(d.thumb_margin+"").replace("px",""):0,n=d.type;return i+=`<div class="${"slider"===n?"glide":""}" style="background-color: ${d.background}; ">           <div class="mapsvg-gallery-wrap ${"slider"===n?"glide__track":""}" data-glide-el="track" style="background-color: ${d.background}">             <div class="${"slider"===n?"glide__slides":""} mapsvg-gallery mapsvg-gallery-${n} ${d.lightbox?" mapsvg-gallery-lightbox pswp-gallery ":""}"${"original"==d.type||"justified"==d.type||"multi"==d.type?' data-thumb-margins="'+o+'"':""} ${"original"==d.type||"justified"==d.type||"multi"==d.type?' data-thumb-height="'+(void 0!==d.thumb_height?(d.thumb_height+"").replace("px",""):0)+'"':""} style="gap: ${o}px;" >`,e.forEach((function(t,e){let l,s=!0;"multi"==d.type?(l=t.medium,s=!1):"justified"==d.type?(l=t.medium,s=!0):((0!==e||"single"!=n&&"combo"!=n)&&"slider"!=n?(s=!1,l=t.medium):(s=!0,l=t.full),l=0===e&&("single"==n||"combo"==n)||"slider"==n?t.full:t.medium),i+=`<a href="${t.full}" data-pswp-width="${t.sizes.full.width}" data-pswp-height="${t.sizes.full.height}" ><img src="${l}" style="`+(s?"":`max-width: ${d.thumb_width?d.thumb_width:80}px;`)+("multi"==d.type?`width: ${d.thumb_width}px; height: ${d.thumb_width}px; `:"")+("slider"==d.type?`max-height: ${d.max_height}px;`:"")+'" itemprop="thumbnail" /></a>'})),i+="</div>","single"==n&&d.lb_button_show&&(i+='<button class="mapsvg-gallery-button">'+d.lb_button_text.replace("{{counter}}",e.length)+"</button>"),i+="</div>","slider"==n&&(i+='<div class="glide__bullets" data-glide-el="controls[nav]">\n                    <button class="glide__bullet" data-glide-dir="=0"></button>\n                    <button class="glide__bullet" data-glide-dir="=1"></button>\n                    <button class="glide__bullet" data-glide-dir="=2"></button>\n                  </div>      \n                  <div class="glide__arrows" data-glide-el="controls">\n                    <button class="glide__arrow glide__arrow--left" data-glide-dir="<">\n                      <svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24">\n                        <path d="M0 12l10.975 11 2.848-2.828-6.176-6.176H24v-3.992H7.646l6.176-6.176L10.975 1 0 12z"></path>\n                      </svg>\n                    </button>\n                    <button class="glide__arrow glide__arrow--right" data-glide-dir=">">\n                      <svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24">\n                        <path d="M13.025 1l-2.847 2.828 6.176 6.176h-16.354v3.992h16.354l-6.176 6.176 2.847 2.828 10.975-11z"></path>\n                      </svg>\n                    </button>\n                  </div>'),i+="</div>",new Handlebars.SafeString(i)})),this.setEventHandlers()}setEventHandlers(){const e=e=>t(this,[e],void 0,(function*({data:{controller:t}}){if(t.containers.view.querySelector(".mapsvg-gallery-lightbox")){const{default:t}=yield import("./photoswipe-lightbox.esm-DWa6GPcA.js");this.PhotoSwipeLightbox=new t({gallery:".pswp-gallery",children:"a",pswpModule:()=>import("./photoswipe.esm-C0FDMN8U.js")}),this.PhotoSwipeLightbox.init(),$(".mapsvg-gallery-button").on("click",(()=>{this.PhotoSwipeLightbox.loadAndOpen(0)}))}const e=undefined;if($(t.containers.view).find(".mapsvg-gallery-slider").length){const{default:t}=yield import("./glide.esm-C3C9zyKn.js");new t(".glide",{perView:1}).mount()}const i=undefined;if(window.jQuery(t.containers.view).find(".mapsvg-gallery-justified")){const t=.2*screen.height,e=document.querySelectorAll(".mapsvg-gallery-justified a");Array.prototype.forEach.call(e,(e=>{const i=e.querySelector("img"),l=()=>{const l=i.width/i.height;e.style.width=t*l+"px",e.style.flexGrow=l};i.complete?l():i.onload=l}))}}));this.mapsvg.events.on("afterRedraw.popover",e),this.mapsvg.events.on("afterRedraw.detailsView",e)}}export{e as default};
//# sourceMappingURL=Gallery-CLKUpFZ8.js.map
