!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).window=t.window||{})}(this,function(t){"use strict";function F(e,t){var i,n=Object.keys(e);return Object.getOwnPropertySymbols&&(i=Object.getOwnPropertySymbols(e),t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,i)),n}function y(n){for(var t=1;tt.length)&&(e=t.length);for(var i=0,n=new Array(e);i=t.length?{done:!0}:{done:!1,value:t[s++]}},e:function(t){throw t},f:e};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function v(){for(var t=!1,e=arguments.length,i=new Array(e),n=0;nthis.option("wheelLimit")||(t.preventDefault(),n===i)||(e=this.$content.getBoundingClientRect(),i=t.clientX-e.left,t=t.clientY-e.top,this.zoomTo(n,{x:i,y:t}))}},{key:"zoomWithClick",value:function(t){var e=this.$content.getClientRects()[0],i=t.clientX-e.left,t=t.clientY-e.top;this.toggleZoom({x:i,y:t})}},{key:"attachEvents",value:function(){var r=this,l=(this.$content.addEventListener("load",this.onLoad),this.$container.addEventListener("wheel",this.onWheel,{passive:!1}),this.$container.addEventListener("click",this.onClick,{passive:!1}),this.initObserver(),new W(this.$container,{start:function(t,e){if(!r.option("touch"))return!1;if(!(r.velocity.scale<0)){if(!l.currentPointers.length){if(-1!==["BUTTON","TEXTAREA","OPTION","INPUT","SELECT","VIDEO"].indexOf(e.target.nodeName))return!1;if(r.option("textSelection")&&function(t,e,i){for(var n=t.childNodes,o=document.createRange(),s=0;s=r.left&&i>=r.top&&e<=r.right&&i<=r.bottom)return a}}}(e.target,e.clientX,e.clientY))return!1;if(p(e.target))return!1}return!1!==r.trigger("touchStart",e)&&(r.state="pointerdown",r.resetDragPosition(),r.dragPosition.midPoint=null,r.dragPosition.time=Date.now(),!0)}},move:function(t,e,i){if("pointerdown"===r.state)if(0!=r.trigger("touchMove",i)){if(!(e.length<2&&1==r.option("panOnlyZoomed")&&r.content.width<=r.viewport.width&&r.content.height<=r.viewport.height&&r.transform.scale<=r.option("baseScale"))&&(!(1i+.5*(e-i)?i:e;this.zoomTo(i,t)}},{key:"zoomTo",value:function(){var t=0a.to),n&&(t=this.content.yn.to),(s||o)&&(o=((s?a.from:a.to)-this.content.x)*i,(s=this.content.x+(this.velocity.x+o)/this.friction)>=a.from&&s<=a.to&&(o+=this.velocity.x),this.velocity.x=o,this.recalculateTransform()),t||e)&&(s=((t?n.from:n.to)-this.content.y)*i,(a=this.content.y+(s+this.velocity.y)/this.friction)>=n.from&&a<=n.to&&(s+=this.velocity.y),this.velocity.y=s,this.recalculateTransform())}},{key:"setDragResistance",value:function(){var t,e,i,n,o,s;"pointerdown"===this.state&&(o=(i=this.getBounds(this.dragPosition.scale)).boundX,i=i.boundY,o&&(n=this.dragPosition.xo.to),i&&(t=this.dragPosition.yi.to),!n&&!s||n&&s||(n=(s=n?o.from:o.to)-this.dragPosition.x,this.dragPosition.x=s-.3*n),!t&&!e||t&&e||(s=(o=t?i.from:i.to)-this.dragPosition.y,this.dragPosition.y=o-.3*s))}},{key:"setDragForce",value:function(){"pointerdown"===this.state&&(this.velocity.x=this.dragPosition.x-this.content.x,this.velocity.y=this.dragPosition.y-this.content.y,this.velocity.scale=this.dragPosition.scale-this.content.scale)}},{key:"recalculateTransform",value:function(){this.transform.x=this.content.x+this.velocity.x/(1/this.friction-1),this.transform.y=this.content.y+this.velocity.y/(1/this.friction-1),this.transform.scale=this.content.scale+this.velocity.scale/(1/this.friction-1)}},{key:"isAnimating",value:function(){return!(!this.friction||!(.05=t-1&&this.$next.setAttribute("disabled","")))}},{key:"cleanup",value:function(){this.$prev&&this.$prev.remove(),this.$prev=null,this.$next&&this.$next.remove(),this.$next=null,this.$container&&this.$container.remove(),this.$container=null}},{key:"attach",value:function(){this.carousel.on("refresh change",this.onRefresh)}},{key:"detach",value:function(){this.carousel.off("refresh change",this.onRefresh),this.cleanup()}}]);var E=q;function q(t){r(this,q),this.$container=null,this.$prev=null,this.$next=null,this.carousel=t,this.onRefresh=this.onRefresh.bind(this)}E.defaults={prevTpl:'',nextTpl:'',classNames:{main:"carousel__nav",button:"carousel__button",next:"is-next",prev:"is-prev"}};e(V,[{key:"buildList",value:function(){var t,i=this;if(!(this.carousel.pages.length<2))return(t=document.createElement("ol")).classList.add("carousel__dots"),t.addEventListener("click",function(t){var e;"page"in t.target.dataset&&(t.preventDefault(),t.stopPropagation(),(t=parseInt(t.target.dataset.page,10))!==(e=i.carousel).page)&&(e.pages.length<3&&e.option("infinite")?e[0==t?"slidePrev":"slideNext"]():e.slideTo(t))}),this.$list=t,this.carousel.$container.appendChild(t),this.carousel.$container.classList.add("has-dots"),t}},{key:"removeList",value:function(){this.$list&&(this.$list.parentNode.removeChild(this.$list),this.$list=null),this.carousel.$container.classList.remove("has-dots")}},{key:"rebuildDots",value:function(){var e=this,t=!!this.$list,i=this.carousel.pages.length;if(i<2)t&&this.removeList();else{t||this.buildList();var n=this.$list.children.length;if(ii)&&(e.push({indexes:[],slides:[]}),c=e.length-1,h=0),h+=u.width,e[c].indexes.push(d),e[c].slides.push(u)}var f=this.option("center"),v=this.option("fill");e.forEach(function(t,e){t.index=e,t.width=t.slides.reduce(function(t,e){return t+e.width},0),t.left=t.slides[0].left,f&&(t.left+=.5*(i-t.width)*-1),v&&!o.option("infiniteX",o.option("infinite"))&&i(i-=h*(l+u+f))&&t.lefti&&t.lefti&&t.leftc&&t.left<=c+l+f&&(e=0)):a.removeSlideEl(t),t.hasDiff=e}),0),o=0;this.slides.forEach(function(t,e){var i=0;t.$el?(e!==n||t.hasDiff?i=o+t.hasDiff*r:o=0,t.$el.style.left=.1n&&(t.content.x-=i,this.pageIndex=this.pageIndex+this.pages.length,e=!0),e&&"pointerdown"===t.state&&t.resetDragPosition(),e}},{key:"onTouchEnd",value:function(t,e){var i=this.option("dragFree");!i&&1e}));return n?[n=this.findPageForSlide(n.index),n+i*t]:[0,0]}},{key:"setPage",value:function(t,e){var i,n,o=0,s=parseInt(t,10)||0,a=this.page,r=this.pageIndex,l=this.pages.length,c=this.contentWidth,h=this.viewportWidth;return t=(s%l+l)%l,this.option("infiniteX",this.option("infinite"))&&h=this.fancybox.option("Thumbs.minScreenHeight")&&this.build()}},{key:"onClosing",value:function(){this.Carousel&&this.Carousel.Panzoom.detachEvents()}},{key:"onKeydown",value:function(t,e){e===t.option("Thumbs.key")&&this.toggle()}},{key:"build",value:function(){var t,i=this;this.$container||((t=document.createElement("div")).classList.add("fancybox__thumbs"),this.fancybox.$carousel.parentNode.insertBefore(t,this.fancybox.$carousel.nextSibling),this.Carousel=new T(t,v(!0,{Dots:!1,Navigation:!1,Sync:{friction:0},infinite:!1,center:!0,fill:!0,dragFree:!0,slidesPerPage:1,preload:1},this.fancybox.option("Thumbs.Carousel"),{Sync:{target:this.fancybox.Carousel},slides:this.getSlides()})),this.Carousel.Panzoom.on("wheel",function(t,e){e.preventDefault(),i.fancybox[e.deltaY<0?"prev":"next"]()}),this.$container=t,this.state="visible")}},{key:"getSlides",value:function(){var t,e=[],i=k(this.fancybox.items);try{for(i.s();!(t=i.n()).done;){var n=t.value,o=n.thumb;o&&e.push({html:'"),customClass:"has-thumb has-".concat(n.type||"image")})}}catch(t){i.e(t)}finally{i.f()}return e}},{key:"toggle",value:function(){return"visible"===this.state?(this.Carousel.Panzoom.detachEvents(),this.$container.style.display="none",void(this.state="hidden")):"hidden"===this.state?(this.$container.style.display="",this.Carousel.Panzoom.attachEvents(),void(this.state="visible")):void this.build()}},{key:"show",value:function(){this.state="hidden",this.toggle()}},{key:"hide",value:function(){this.state="visible",this.toggle()}},{key:"cleanup",value:function(){this.Carousel&&(this.Carousel.destroy(),this.Carousel=null),this.$container&&(this.$container.remove(),this.$container=null),this.state="init"}},{key:"attach",value:function(){this.fancybox.on(this.events)}},{key:"detach",value:function(){this.fancybox.off(this.events),this.cleanup()}}]),J);function J(t){r(this,J),this.fancybox=t,this.$container=null,this.state="init";for(var e=0,i=["onPrepare","onClosing","onKeydown"];e\n Sorry, your browser doesn\'t support embedded videos.',format:""}},E=(e(it,[{key:"onInit",value:function(){var t,e=k(this.fancybox.items);try{for(e.s();!(t=e.n()).done;){var i=t.value;this.processType(i)}}catch(t){e.e(t)}finally{e.f()}}},{key:"processType",value:function(t){var e,i,n,o,s;t.html?(t.src=t.html,t.type="html",delete t.html):(e=t.src||"",i=t.type||this.fancybox.options.type,n=null,e&&"string"!=typeof e||((n=e.match(/(?:youtube\.com|youtu\.be|youtube\-nocookie\.com)\/(?:watch\?(?:.*&)?v=|v\/|u\/|embed\/?)?(videoseries\?list=(?:.*)|[\w-]{11}|\?listType=(?:.*)&list=(?:.*))(?:.*)/i))?(o=tt(this.fancybox.option("Html.youtube")),s=encodeURIComponent(n[1]),t.videoId=s,t.src="https://www.youtube-nocookie.com/embed/".concat(s,"?").concat(o),t.thumb=t.thumb||"https://i.ytimg.com/vi/".concat(s,"/mqdefault.jpg"),t.vendor="youtube",i="video"):(n=e.match(/^.+vimeo.com\/(?:\/)?([\d]+)(.*)?/))?(o=tt(this.fancybox.option("Html.vimeo")),s=encodeURIComponent(n[1]),t.videoId=s,t.src="https://player.vimeo.com/video/".concat(s,"?").concat(o),t.vendor="vimeo",i="video"):(n=e.match(/(?:maps\.)?google\.([a-z]{2,3}(?:\.[a-z]{2})?)\/(?:(?:(?:maps\/(?:place\/(?:.*)\/)?\@(.*),(\d+.?\d+?)z))|(?:\?ll=))(.*)?/i))?(t.src="//maps.google.".concat(n[1],"/?ll=").concat((n[2]?n[2]+"&z="+Math.floor(n[3])+(n[4]?n[4].replace(/^\//,"&"):""):n[4]+"").replace(/\?/,"&"),"&output=").concat(n[4]&&0n||i / ',tabindex:-1,position:"left"},prev:{type:"button",class:"fancybox__button--prev",label:"PREV",html:'',click:function(t){t.preventDefault(),this.fancybox.prev()}},next:{type:"button",class:"fancybox__button--next",label:"NEXT",html:'',click:function(t){t.preventDefault(),this.fancybox.next()}},fullscreen:{type:"button",class:"fancybox__button--fullscreen",label:"TOGGLE_FULLSCREEN",html:'',click:function(t){t.preventDefault(),A.element()?A.deactivate():A.activate(this.fancybox.$container)}},slideshow:{type:"button",class:"fancybox__button--slideshow",label:"TOGGLE_SLIDESHOW",html:'',click:function(t){t.preventDefault(),this.Slideshow.toggle()}},zoom:{type:"button",class:"fancybox__button--zoom",label:"TOGGLE_ZOOM",html:'',click:function(t){t.preventDefault();t=this.fancybox.getSlide().Panzoom;t&&t.toggleZoom()}},download:{type:"link",label:"DOWNLOAD",class:"fancybox__button--download",html:'',click:function(t){t.stopPropagation()}},thumbs:{type:"button",label:"TOGGLE_THUMBS",class:"fancybox__button--thumbs",html:'',click:function(t){t.stopPropagation();t=this.fancybox.plugins.Thumbs;t&&t.toggle()}},close:{type:"button",label:"CLOSE",class:"fancybox__button--close",html:'',tabindex:0,click:function(t){t.stopPropagation(),t.preventDefault(),this.fancybox.close()}}}},ct=(e(ht,[{key:"onInit",value:function(){if(this.fancybox.option("Toolbar.autoEnable")){var t,e=!1,i=k(this.fancybox.items);try{for(i.s();!(t=i.n()).done;)if("image"===t.value.type){e=!0;break}}catch(t){i.e(t)}finally{i.f()}if(!e)return void(this.state="disabled")}var n,o=k(this.fancybox.option("Toolbar.display"));try{for(o.s();!(n=o.n()).done;){var s=n.value;if("close"===(g(s)?s.id:s)){this.fancybox.options.closeButton=!1;break}}}catch(t){o.e(t)}finally{o.f()}}},{key:"onPrepare",value:function(){if("init"===this.state&&(this.build(),this.update(),this.Slideshow=new rt(this.fancybox),!this.fancybox.Carousel.prevPage)&&(this.fancybox.option("slideshow.autoStart")&&this.Slideshow.activate(),this.fancybox.option("fullscreen.autoStart"))&&!A.element())try{A.activate(this.fancybox.$container)}catch(t){}}},{key:"onFsChange",value:function(){window.scrollTo(A.pageXOffset,A.pageYOffset)}},{key:"onSettle",value:function(){this.Slideshow&&this.Slideshow.isActive()&&(this.fancybox.getSlide().index!==this.fancybox.Carousel.slides.length-1||this.fancybox.option("infinite")?"done"===this.fancybox.getSlide().state&&this.Slideshow.setTimer():this.Slideshow.deactivate())}},{key:"onChange",value:function(){this.update(),this.Slideshow&&this.Slideshow.isActive()&&this.Slideshow.clearTimer()}},{key:"onDone",value:function(t,e){e.index===t.getSlide().index&&(this.update(),this.Slideshow)&&this.Slideshow.isActive()&&(this.fancybox.option("infinite")||e.index!==this.fancybox.Carousel.slides.length-1?this.Slideshow.setTimer():this.Slideshow.deactivate())}},{key:"onRefresh",value:function(t){t&&t.index!==this.fancybox.getSlide().index||(this.update(),!this.Slideshow)||!this.Slideshow.isActive()||t&&"done"!==t.state||this.Slideshow.deactivate()}},{key:"onKeydown",value:function(t,e,i){" "===e&&this.Slideshow&&(this.Slideshow.toggle(),i.preventDefault())}},{key:"onClosing",value:function(){this.Slideshow&&this.Slideshow.deactivate(),document.removeEventListener("fullscreenchange",this.onFsChange)}},{key:"createElement",value:function(t){"div"===t.type?e=document.createElement("div"):(e=document.createElement("link"===t.type?"a":"button")).classList.add("carousel__button"),e.innerHTML=t.html,e.setAttribute("tabindex",t.tabindex||0),t.class&&(i=e.classList).add.apply(i,b(t.class.split(" "))),t.label&&e.setAttribute("title",this.fancybox.localize("{{".concat(t.label,"}}"))),t.click&&e.addEventListener("click",t.click.bind(this)),"prev"===t.id&&e.setAttribute("data-fancybox-prev",""),"next"===t.id&&e.setAttribute("data-fancybox-next","");var e,i=e.querySelector("svg");return i&&(i.setAttribute("role","img"),i.setAttribute("tabindex","-1"),i.setAttribute("xmlns","http://www.w3.org/2000/svg")),e}},{key:"build",value:function(){var o=this;this.cleanup();var s,a=this.fancybox.option("Toolbar.items"),r=[{position:"left",items:[]},{position:"center",items:[]},{position:"right",items:[]}],l=this.fancybox.plugins.Thumbs,t=k(this.fancybox.option("Toolbar.display"));try{for(t.s();!(s=t.n()).done;)!function(){var e,t=s.value,i=void 0,n=void 0,n=g(t)?(i=t.id,v({},a[i],t)):a[i=t];if(["counter","next","prev","slideshow"].includes(i)&&o.fancybox.items.length<2)return;if("fullscreen"===i){if(!document.fullscreenEnabled||window.fullScreen)return;document.addEventListener("fullscreenchange",o.onFsChange)}("thumbs"!==i||l&&"disabled"!==l.state)&&n&&(e=n.position||"right",(t=r.find(function(t){return t.position===e}))&&t.items.push(n))}()}catch(o){t.e(o)}finally{t.f()}var e=document.createElement("div");e.classList.add("fancybox__toolbar");for(var i=0,n=r;il.option("baseScale"),h=k(this.fancybox.$container.querySelectorAll(".fancybox__button--zoom"));try{for(h.s();!(r=h.n()).done;){var d=r.value;c?d.removeAttribute("disabled"):d.setAttribute("disabled","")}}catch(t){h.e(t)}finally{h.f()}var u,f=k(this.fancybox.$container.querySelectorAll("[data-fancybox-index]"));try{for(f.s();!(u=f.n()).done;)u.value.innerHTML=e.index+1}catch(t){f.e(t)}finally{f.f()}var v,g=k(this.fancybox.$container.querySelectorAll("[data-fancybox-count]"));try{for(g.s();!(v=g.n()).done;)v.value.innerHTML=n}catch(t){g.e(t)}finally{g.f()}if(!this.fancybox.option("infinite")){var p,m=k(this.fancybox.$container.querySelectorAll("[data-fancybox-prev]"));try{for(m.s();!(p=m.n()).done;){var y=p.value;0===i?y.setAttribute("disabled",""):y.removeAttribute("disabled")}}catch(t){m.e(t)}finally{m.f()}var b,x=k(this.fancybox.$container.querySelectorAll("[data-fancybox-next]"));try{for(x.s();!(b=x.n()).done;){var w=b.value;i===n-1?w.setAttribute("disabled",""):w.removeAttribute("disabled")}}catch(t){x.e(t)}finally{x.f()}}}},{key:"cleanup",value:function(){this.Slideshow&&this.Slideshow.isActive()&&this.Slideshow.clearTimer(),this.$container&&this.$container.remove(),this.$container=null}},{key:"attach",value:function(){this.fancybox.on(this.events)}},{key:"detach",value:function(){this.fancybox.off(this.events),this.cleanup()}}]),ht);function ht(t){var i=this;r(this,ht),this.fancybox=t,this.$container=null,this.state="init";for(var e=0,n=["onInit","onPrepare","onDone","onKeydown","onClosing","onChange","onSettle","onRefresh"];e',spinner:'',main:null},l10n:{CLOSE:"Close",NEXT:"Next",PREV:"Previous",MODAL:"You can close this modal content with the ESC key",ERROR:"Something Went Wrong, Please Try Again Later",IMAGE_ERROR:"Image Not Found",ELEMENT_NOT_FOUND:"HTML Element Not Found",AJAX_NOT_FOUND:"Error Loading AJAX : Not Found",AJAX_FORBIDDEN:"Error Loading AJAX : Forbidden",IFRAME_ERROR:"Error Loading Page",TOGGLE_ZOOM:"Toggle zoom level",TOGGLE_THUMBS:"Toggle thumbnails",TOGGLE_SLIDESHOW:"Toggle slideshow",TOGGLE_FULLSCREEN:"Toggle full-screen mode",DOWNLOAD:"Download"}},z={},vt=0,_=(i(M,m),ut=n(M),e(M,[{key:"bindHandlers",value:function(){for(var t=0,e=["onMousedown","onKeydown","onClick","onFocus","onCreateSlide","onTouchMove","onTouchEnd","onTransform"];t{{ERROR}}
"),this.setContent(t,i,{suffix:"error"})}},{key:"showLoading",value:function(t){var e=this,i=(t.state="loading",t.$el.classList.add("is-loading"),t.$el.querySelector(".fancybox__spinner"));i||((i=document.createElement("div")).classList.add("fancybox__spinner"),i.innerHTML=this.option("template.spinner"),i.addEventListener("click",function(){e.Carousel.Panzoom.velocity||e.close()}),t.$el.prepend(i))}},{key:"hideLoading",value:function(t){var e=t.$el&&t.$el.querySelector(".fancybox__spinner");e&&(e.remove(),t.$el.classList.remove("is-loading")),"loading"===t.state&&(this.trigger("load",t),t.state="ready")}},{key:"next",value:function(){var t=this.Carousel;t&&1