import{b as t}from"./Mapsvg-BFnnlm0J.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];let a;window.mapsvg.getById(l).getData().options.galleries.forEach((function(t){t.id==s&&(a=t)}));const o=void 0!==a.thumb_margin?(a.thumb_margin+"").replace("px",""):0,d=a.type;return i+=`<div class="${"slider"===d?"glide":""}" style="background-color: ${a.background}; ">           <div class="mapsvg-gallery-wrap ${"slider"===d?"glide__track":""}" data-glide-el="track" style="background-color: ${a.background}">             <div class="${"slider"===d?"glide__slides":""} mapsvg-gallery mapsvg-gallery-${d} ${a.lightbox?" mapsvg-gallery-lightbox pswp-gallery ":""}"${"original"==a.type||"justified"==a.type||"multi"==a.type?' data-thumb-margins="'+o+'"':""} ${"original"==a.type||"justified"==a.type||"multi"==a.type?' data-thumb-height="'+(void 0!==a.thumb_height?(a.thumb_height+"").replace("px",""):0)+'"':""} style="gap: ${o}px;" >`,e.forEach((function(t,e){let l,s=!0;"multi"==a.type?(l=t.medium,s=!1):"justified"==a.type?(l=t.medium,s=!0):((0!==e||"single"!=d&&"combo"!=d)&&"slider"!=d?(s=!1,l=t.medium):(s=!0,l=t.full),l=0===e&&("single"==d||"combo"==d)||"slider"==d?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: ${a.thumb_width?a.thumb_width:80}px;`)+("multi"==a.type?`width: ${a.thumb_width}px; height: ${a.thumb_width}px; `:"")+("slider"==a.type?`max-height: ${a.max_height}px;`:"")+'" itemprop="thumbnail" /></a>'})),i+="</div>","single"==d&&a.lb_button_show&&(i+='<button class="mapsvg-gallery-button">'+a.lb_button_text.replace("{{counter}}",e.length)+"</button>"),i+="</div>","slider"==d&&(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-t8tdisrZ.js");this.PhotoSwipeLightbox=new t({gallery:".pswp-gallery",children:"a",pswpModule:()=>import("./photoswipe.esm-LaFVYM0R.js")}),this.PhotoSwipeLightbox.init(),$(".mapsvg-gallery-button").on("click",(()=>{this.PhotoSwipeLightbox.loadAndOpen(0)}))}if($(t.containers.view).find(".mapsvg-gallery-slider").length){const{default:t}=yield import("./glide.esm-DCSVM-Hg.js");new t(".glide",{perView:1}).mount()}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-B2qLEd99.js.map
