!function(){if("function"!=typeof window.CustomEvent){const e=function(e,t){t=t||{bubbles:!1,cancelable:!1,detail:void 0};const r=document.createEvent("CustomEvent");return r.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),r};e.prototype=window.Event.prototype,window.CustomEvent=e}function e(t){const r=['a[href]:not([tabindex^="-"]):not([inert])','area[href]:not([tabindex^="-"]):not([inert])',"input:not([disabled]):not([inert])","select:not([disabled]):not([inert])","textarea:not([disabled]):not([inert])","button:not([disabled]):not([inert])",'iframe:not([tabindex^="-"]):not([inert])','audio:not([tabindex^="-"]):not([inert])','video:not([tabindex^="-"]):not([inert])','[contenteditable]:not([tabindex^="-"]):not([inert])','[tabindex]:not([tabindex^="-"]):not([inert])'],i=[],n={gallery:[],slider:null,sliderElements:[],elementsLength:0,currentIndex:0,x:0},o=[];let a={},s=0,d=null,l=null,u=null,c=null,p=null,b={},m=!1,h=!1,g=!1,f=null,v=null,y=null,w=!1,x=!1,E=0,A={},L=null,_=null;const C={image:{checkSupport:e=>!e.hasAttribute("data-type")&&e.href.match(/\.(png|jpe?g|tiff|tif|gif|bmp|webp|avif|svg|ico)(\?.*)?$/i),init(e,t){const r=document.createElement("figure"),i=document.createElement("figcaption"),n=document.createElement("img"),o=e.querySelector("img"),d=document.createElement("div");r.style.opacity="0",o&&(n.alt=o.alt||""),n.setAttribute("src",""),n.setAttribute("data-src",e.href),r.appendChild(n),a.captions&&("function"==typeof a.captionText?i.textContent=a.captionText(e):"self"===a.captionsSelector&&e.getAttribute(a.captionAttribute)?i.textContent=e.getAttribute(a.captionAttribute):"img"===a.captionsSelector&&o&&o.getAttribute(a.captionAttribute)&&(i.textContent=o.getAttribute(a.captionAttribute)),i.textContent&&(i.id=`tobii-figcaption-${s}`,r.appendChild(i),n.setAttribute("aria-labelledby",i.id),++s)),t.appendChild(r),d.className="tobii__loader",d.setAttribute("role","progressbar"),d.setAttribute("aria-label",a.loadingIndicatorLabel),t.appendChild(d),t.setAttribute("data-type","image")},onPreload(e){C.image.onLoad(e)},onLoad(e){const t=e.querySelector("img");if(!t.hasAttribute("data-src"))return;const r=e.querySelector("figure"),i=e.querySelector(".tobii__loader");t.onload=()=>{e.removeChild(i),r.style.opacity="1"},t.setAttribute("src",t.getAttribute("data-src")),t.removeAttribute("data-src")},onLeave(e){},onCleanup(e){}},html:{checkSupport:e=>ne(e,"html"),init(e,t){const r=e.hasAttribute("href")?e.getAttribute("href"):e.getAttribute("data-target"),i=document.querySelector(r);if(!i)throw new Error(`Ups, I can't find the target ${r}.`);t.appendChild(i),t.setAttribute("data-type","html")},onPreload(e){},onLoad(e){const t=e.querySelector("video");t&&(t.hasAttribute("data-time")&&t.readyState>0&&(t.currentTime=t.getAttribute("data-time")),a.autoplayVideo&&t.play())},onLeave(e){const t=e.querySelector("video");t&&(t.paused||t.pause(),t.readyState>0&&t.setAttribute("data-time",t.currentTime))},onCleanup(e){const t=e.querySelector("video");if(t&&t.readyState>0&&t.readyState<3&&t.duration!==t.currentTime){const r=t.cloneNode(!0);oe(t),t.load(),t.parentNode.removeChild(t),e.appendChild(r)}}},iframe:{checkSupport:e=>ne(e,"iframe"),init(e,t){const r=document.createElement("iframe"),i=e.hasAttribute("href")?e.getAttribute("href"):e.getAttribute("data-target");r.setAttribute("frameborder","0"),r.setAttribute("src",""),r.setAttribute("data-src",i),e.getAttribute("data-width")&&(r.style.maxWidth=`${e.getAttribute("data-width")}px`),e.getAttribute("data-height")&&(r.style.maxHeight=`${e.getAttribute("data-height")}px`),t.appendChild(r),t.setAttribute("data-type","iframe")},onPreload(e){},onLoad(e){const t=e.querySelector("iframe");t.setAttribute("src",t.getAttribute("data-src"))},onLeave(e){},onCleanup(e){}},youtube:{checkSupport:e=>ne(e,"youtube"),init(e,t){const r=document.createElement("div");t.appendChild(r),o[E]=new window.YT.Player(r,{host:"https://www.youtube-nocookie.com",height:e.getAttribute("data-height")||"360",width:e.getAttribute("data-width")||"640",videoId:e.getAttribute("data-id"),playerVars:{controls:e.getAttribute("data-controls")||1,rel:0,playsinline:1}}),t.setAttribute("data-player",E),t.setAttribute("data-type","youtube"),E++},onPreload(e){},onLoad(e){a.autoplayVideo&&o[e.getAttribute("data-player")].playVideo()},onLeave(e){1===o[e.getAttribute("data-player")].getPlayerState()&&o[e.getAttribute("data-player")].pauseVideo()},onCleanup(e){1===o[e.getAttribute("data-player")].getPlayerState()&&o[e.getAttribute("data-player")].pauseVideo()}}},I=e=>{if(null===document.querySelector('[data-type="youtube"]')||x)T(e);else{if(null===document.getElementById("iframe_api")){const e=document.createElement("script"),t=document.getElementsByTagName("script")[0];e.id="iframe_api",e.src="https://www.youtube.com/iframe_api",t.parentNode.insertBefore(e,t)}-1===i.indexOf(e)&&i.push(e),window.onYouTubePlayerAPIReady=()=>{i.forEach(e=>{T(e)}),x=!0}}},S=e=>e.hasAttribute("data-group")?e.getAttribute("data-group"):"default",T=e=>{if(L=S(e),Object.prototype.hasOwnProperty.call(A,L)||(A[L]=JSON.parse(JSON.stringify(n)),N()),-1!==A[L].gallery.indexOf(e))throw new Error("Ups, element already added.");if(A[L].gallery.push(e),A[L].elementsLength++,a.zoom&&e.querySelector("img")){const t=document.createElement("div");t.className="tobii-zoom__icon",t.innerHTML=a.zoomText,e.classList.add("tobii-zoom"),e.appendChild(t)}e.addEventListener("click",j),P(e),le()&&L===_&&(ae(),se())},k=e=>{const t=S(e);if(-1===A[t].gallery.indexOf(e))throw new Error(`Ups, I can't find a slide for the element ${e}.`);{const r=A[t].gallery.indexOf(e),i=A[t].sliderElements[r];if(le()&&t===_&&r===A[t].currentIndex){if(1===A[t].elementsLength)throw O(),new Error("Ups, I've closed. There are no slides more to show.");0===A[t].currentIndex?$():Y()}if(A[t].elementsLength--,a.zoom&&e.querySelector(".tobii-zoom__icon")){const t=e.querySelector(".tobii-zoom__icon");t.parentNode.classList.remove("tobii-zoom"),t.parentNode.removeChild(t)}e.removeEventListener("click",j),i.parentNode.removeChild(i)}},N=()=>{A[L].slider=document.createElement("div"),A[L].slider.className="tobii__slider",A[L].slider.setAttribute("aria-hidden","true"),d.appendChild(A[L].slider)},P=e=>{for(const t in C)if(Object.prototype.hasOwnProperty.call(C,t)&&C[t].checkSupport(e)){const r=document.createElement("div"),i=document.createElement("div");r.className="tobii__slide",r.style.position="absolute",r.style.left=100*A[L].x+"%",r.setAttribute("aria-hidden","true"),C[t].init(e,i),r.appendChild(i),A[L].slider.appendChild(r),A[L].sliderElements.push(r),++A[L].x;break}},q=e=>{if(_=null!==_?_:L,le())throw new Error("Ups, I'm aleady open.");if(!le()&&(e||(e=0),-1===e||e>=A[_].elementsLength))throw new Error(`Ups, I can't find slide ${e}.`);a.hideScrollbar&&(document.documentElement.classList.add("tobii-is-open"),document.body.classList.add("tobii-is-open")),ae(),a.close||(c.disabled=!1,c.setAttribute("aria-hidden","true")),f=document.activeElement;const t=window.location.href;window.history.pushState({tobii:"close"},"Image",t),A[_].currentIndex=e,H(),re(),U(A[_].currentIndex),A[_].slider.setAttribute("aria-hidden","false"),d.setAttribute("aria-hidden","false"),se(),X(A[_].currentIndex+1),X(A[_].currentIndex-1),setTimeout(()=>{A[_].slider.classList.add("tobii__slider--animate")},1e3);const r=new window.CustomEvent("open");d.dispatchEvent(r)},O=()=>{if(!le())throw new Error("Ups, I'm already closed.");a.hideScrollbar&&(document.documentElement.classList.remove("tobii-is-open"),document.body.classList.remove("tobii-is-open")),ie(),null!==window.history.state&&"close"===window.history.state.tobii&&window.history.back(),f.focus(),z(A[_].currentIndex),M(A[_].currentIndex),d.setAttribute("aria-hidden","true"),A[_].slider.setAttribute("aria-hidden","true"),A[_].currentIndex=0,A[_].slider.classList.remove("tobii__slider--animate")},X=e=>{if(void 0===A[_].sliderElements[e])return;const t=A[_].sliderElements[e].querySelector("[data-type]"),r=t.getAttribute("data-type");C[r].onPreload(t)},U=e=>{if(void 0===A[_].sliderElements[e])return;const t=A[_].sliderElements[e].querySelector("[data-type]"),r=t.getAttribute("data-type");A[_].sliderElements[e].classList.add("tobii__slide--is-active"),A[_].sliderElements[e].setAttribute("aria-hidden","false"),C[r].onLoad(t)},Y=()=>{if(!le())throw new Error("Ups, I'm closed.");A[_].currentIndex>0&&(z(A[_].currentIndex),U(--A[_].currentIndex),se("left"),M(A[_].currentIndex+1),X(A[_].currentIndex-1));const e=new window.CustomEvent("previous");d.dispatchEvent(e)},$=()=>{if(!le())throw new Error("Ups, I'm closed.");A[_].currentIndex{if(void 0===A[_].sliderElements[e])return;const t=A[_].sliderElements[e].querySelector("[data-type]"),r=t.getAttribute("data-type");A[_].sliderElements[e].classList.remove("tobii__slide--is-active"),A[_].sliderElements[e].setAttribute("aria-hidden","true"),C[r].onLeave(t)},M=e=>{if(void 0===A[_].sliderElements[e])return;const t=A[_].sliderElements[e].querySelector("[data-type]"),r=t.getAttribute("data-type");C[r].onCleanup(t)},D=()=>{_=null!==_?_:L,v=-A[_].currentIndex*d.offsetWidth,A[_].slider.style.transform=`translate3d(${v}px, 0, 0)`,y=v},H=()=>{b={startX:0,endX:0,startY:0,endY:0}},B=()=>{const e=b.endX-b.startX,t=b.endY-b.startY,r=Math.abs(e),i=Math.abs(t);e>0&&r>a.threshold&&A[_].currentIndex>0?Y():e<0&&r>a.threshold&&A[_].currentIndex!==A[_].elementsLength-1?$():t<0&&i>a.threshold&&a.swipeClose?O():D()},V=()=>{w||(w=!0,window.requestAnimationFrame(()=>{D(),w=!1}))},j=e=>{e.preventDefault(),_=S(e.currentTarget),q(A[_].gallery.indexOf(e.currentTarget))},R=e=>{e.target===l?Y():e.target===u?$():(e.target===c||!1===m&&!1===h&&e.target.classList.contains("tobii__slide")&&a.docClose)&&O(),e.stopPropagation()},W=e=>{const t=Array.prototype.slice.call(d.querySelectorAll(`.tobii__btn:not([disabled]), .tobii__slide--is-active + ${r.join(", .tobii__slide--is-active ")}`)).filter(e=>!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)),i=t.indexOf(document.activeElement);9===e.keyCode||"Tab"===e.code?e.shiftKey&&0===i?(t[t.length-1].focus(),e.preventDefault()):e.shiftKey||i!==t.length-1||(t[0].focus(),e.preventDefault()):27===e.keyCode||"Escape"===e.code?(e.preventDefault(),O()):37===e.keyCode||"ArrowLeft"===e.code?(e.preventDefault(),Y()):39!==e.keyCode&&"ArrowRight"!==e.code||(e.preventDefault(),$())},G=e=>{ce(e.target)||(e.stopPropagation(),m=!1,h=!1,g=!0,b.startX=e.touches[0].pageX,b.startY=e.touches[0].pageY,A[_].slider.classList.add("tobii__slider--is-dragging"))},J=e=>{e.stopPropagation(),g&&(e.preventDefault(),b.endX=e.touches[0].pageX,b.endY=e.touches[0].pageY,te())},K=e=>{e.stopPropagation(),g=!1,A[_].slider.classList.remove("tobii__slider--is-dragging"),b.endX&&B(),H()},F=e=>{ce(e.target)||(e.preventDefault(),e.stopPropagation(),m=!1,h=!1,g=!0,b.startX=e.pageX,b.startY=e.pageY,A[_].slider.classList.add("tobii__slider--is-dragging"))},Q=e=>{e.preventDefault(),g&&(b.endX=e.pageX,b.endY=e.pageY,te())},Z=e=>{e.stopPropagation(),g=!1,A[_].slider.classList.remove("tobii__slider--is-dragging"),b.endX&&B(),H()},ee=()=>{g=!1},te=()=>{Math.abs(b.startX-b.endX)>0&&!h&&A[_].elementsLength>1?(A[_].slider.style.transform=`translate3d(${y-Math.round(b.startX-b.endX)}px, 0, 0)`,m=!0,h=!1):Math.abs(b.startY-b.endY)>0&&!m&&a.swipeClose&&(A[_].slider.style.transform=`translate3d(${y}px, -${Math.round(b.startY-b.endY)}px, 0)`,m=!1,h=!0)},re=()=>{a.keyboard&&window.addEventListener("keydown",W),window.addEventListener("resize",V),window.addEventListener("popstate",O),d.addEventListener("click",R),a.draggable&&(ue()&&(d.addEventListener("touchstart",G),d.addEventListener("touchmove",J),d.addEventListener("touchend",K)),d.addEventListener("mousedown",F),d.addEventListener("mouseup",Z),d.addEventListener("mousemove",Q),d.addEventListener("contextmenu",ee))},ie=()=>{a.keyboard&&window.removeEventListener("keydown",W),window.removeEventListener("resize",V),window.removeEventListener("popstate",O),d.removeEventListener("click",R),a.draggable&&(ue()&&(d.removeEventListener("touchstart",G),d.removeEventListener("touchmove",J),d.removeEventListener("touchend",K)),d.removeEventListener("mousedown",F),d.removeEventListener("mouseup",Z),d.removeEventListener("mousemove",Q),d.removeEventListener("contextmenu",ee))},ne=(e,t)=>e.getAttribute("data-type")===t,oe=e=>{const t=e.querySelectorAll("src");t&&t.forEach(e=>{e.setAttribute("src","")})},ae=()=>{(a.draggable&&a.swipeClose&&!A[_].slider.classList.contains("tobii__slider--is-draggable")||a.draggable&&A[_].elementsLength>1&&!A[_].slider.classList.contains("tobii__slider--is-draggable"))&&A[_].slider.classList.add("tobii__slider--is-draggable"),!a.nav||1===A[_].elementsLength||"auto"===a.nav&&ue()?(l.setAttribute("aria-hidden","true"),l.disabled=!0,u.setAttribute("aria-hidden","true"),u.disabled=!0):(l.setAttribute("aria-hidden","false"),l.disabled=!1,u.setAttribute("aria-hidden","false"),u.disabled=!1),p.setAttribute("aria-hidden",a.counter&&1!==A[_].elementsLength?"false":"true")},se=e=>{D(),p.textContent=`${A[_].currentIndex+1}/${A[_].elementsLength}`,(e=>{(!0===a.nav||"auto"===a.nav)&&!ue()&&A[_].elementsLength>1?(l.setAttribute("aria-hidden","true"),l.disabled=!0,u.setAttribute("aria-hidden","true"),u.disabled=!0,1===A[_].elementsLength?a.close&&c.focus():0===A[_].currentIndex?(u.setAttribute("aria-hidden","false"),u.disabled=!1,u.focus()):A[_].currentIndex===A[_].elementsLength-1?(l.setAttribute("aria-hidden","false"),l.disabled=!1,l.focus()):(l.setAttribute("aria-hidden","false"),l.disabled=!1,u.setAttribute("aria-hidden","false"),u.disabled=!1,"left"===e?l.focus():u.focus())):a.close&&c.focus()})(e)},de=()=>{le()&&O(),Object.entries(A).forEach(e=>{e[1].gallery.forEach(e=>{k(e)})}),A={},L=_=null,s=0},le=()=>"false"===d.getAttribute("aria-hidden"),ue=()=>"ontouchstart"in window,ce=e=>-1!==["TEXTAREA","OPTION","INPUT","SELECT"].indexOf(e.nodeName)||e===l||e===u||e===c;return(e=>{a=(e=>({selector:".lightbox",captions:!0,captionsSelector:"img",captionAttribute:"alt",captionText:null,nav:"auto",navText:['',''],navLabel:["Previous image","Next image"],close:!0,closeText:'',closeLabel:"Close lightbox",loadingIndicatorLabel:"Image loading",counter:!0,download:!1,downloadText:"",downloadLabel:"Download image",keyboard:!0,zoom:!0,zoomText:'',docClose:!0,swipeClose:!0,hideScrollbar:!0,draggable:!0,threshold:100,rtl:!1,loop:!1,autoplayVideo:!1,modal:!1,theme:"tobii--theme-default",...e}))(e),d||(d=document.createElement("div"),d.setAttribute("role","dialog"),d.setAttribute("aria-hidden","true"),d.classList.add("tobii"),d.classList.add(a.theme),l=document.createElement("button"),l.className="tobii__btn tobii__btn--previous",l.setAttribute("type","button"),l.setAttribute("aria-label",a.navLabel[0]),l.innerHTML=a.navText[0],d.appendChild(l),u=document.createElement("button"),u.className="tobii__btn tobii__btn--next",u.setAttribute("type","button"),u.setAttribute("aria-label",a.navLabel[1]),u.innerHTML=a.navText[1],d.appendChild(u),c=document.createElement("button"),c.className="tobii__btn tobii__btn--close",c.setAttribute("type","button"),c.setAttribute("aria-label",a.closeLabel),c.innerHTML=a.closeText,d.appendChild(c),p=document.createElement("div"),p.className="tobii__counter",d.appendChild(p),document.body.appendChild(d));const t=document.querySelectorAll(a.selector);if(!t)throw new Error(`Ups, I can't find the selector ${a.selector} on this website.`);t.forEach(e=>{I(e)})})(t),e.open=q,e.previous=Y,e.next=$,e.close=O,e.add=I,e.remove=k,e.reset=de,e.destroy=()=>{de(),d.parentNode.removeChild(d)},e.isOpen=le,e.slidesIndex=()=>A[_].currentIndex,e.select=e=>{const t=A[_].currentIndex;if(!le())throw new Error("Ups, I'm closed.");if(le()){if(!e&&0!==e)throw new Error("Ups, no slide specified.");if(e===A[_].currentIndex)throw new Error(`Ups, slide ${e} is already selected.`);if(-1===e||e>=A[_].elementsLength)throw new Error(`Ups, I can't find slide ${e}.`)}A[_].currentIndex=e,z(t),U(e),et&&(se("right"),M(t),X(e+1))},e.slidesCount=()=>A[_].elementsLength,e.selectGroup=e=>{if(le())throw new Error("Ups, I'm open.");if(!e)throw new Error("Ups, no group specified.");if(e&&!Object.prototype.hasOwnProperty.call(A,e))throw new Error(`Ups, I don't have a group called "${e}".`);_=e},e.currentGroup=()=>null!==_?_:L,e.on=(e,t)=>{d.addEventListener(e,t)},e.off=(e,t)=>{d.removeEventListener(e,t)},e}typeof module<"u"?module.exports=e:self.Tobii=e}();