New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@midzer/tobii

Package Overview
Dependencies
Maintainers
0
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@midzer/tobii - npm Package Compare versions

Comparing version 2.5.0 to 2.6.0

2

dist/tobii.js

@@ -1,1 +0,1 @@

class e{constructor(){this.figcaptionId=0,this.userSettings=null}init(e,t,i){this.userSettings=i;const r=document.createElement("figure"),n=document.createElement("figcaption"),s=document.createElement("img"),a=e.querySelector("img"),o=document.createElement("div");if(r.style.opacity="0",a&&(s.alt=a.alt||""),s.setAttribute("src",""),s.setAttribute("data-src",e.href),e.hasAttribute("data-srcset")&&s.setAttribute("data-srcset",e.getAttribute("data-srcset")),r.appendChild(s),this.userSettings.captions){let t;"function"==typeof this.userSettings.captionText?t=this.userSettings.captionText(e):"self"===this.userSettings.captionsSelector&&e.getAttribute(this.userSettings.captionAttribute)?t=e.getAttribute(this.userSettings.captionAttribute):"img"===this.userSettings.captionsSelector&&a&&a.getAttribute(this.userSettings.captionAttribute)&&(t=a.getAttribute(this.userSettings.captionAttribute)),this.userSettings.captionHTML?n.innerHTML=t:n.textContent=t,t&&(n.id=`tobii-figcaption-${this.figcaptionId}`,r.appendChild(n),s.setAttribute("aria-labelledby",n.id),++this.figcaptionId)}t.appendChild(r),o.className="tobii__loader",o.setAttribute("role","progressbar"),o.setAttribute("aria-label",this.userSettings.loadingIndicatorLabel),t.appendChild(o),t.setAttribute("data-type","image"),t.classList.add("tobii-image")}onPreload(e){this.onLoad(e)}onLoad(e){const t=e.querySelector("img");if(!t.hasAttribute("data-src"))return;const i=e.querySelector("figure"),r=e.querySelector(".tobii__loader");t.addEventListener("load",()=>{e.removeChild(r),i.style.opacity="1"}),t.addEventListener("error",()=>{e.removeChild(r),i.style.opacity="1"}),t.setAttribute("src",t.getAttribute("data-src")),t.removeAttribute("data-src"),t.hasAttribute("data-srcset")&&t.setAttribute("srcset",t.getAttribute("data-srcset"))}onLeave(e){}onCleanup(e){}onReset(){this.figcaptionId=0}}class t{constructor(){this.userSettings=null}init(e,t,i){this.userSettings=i;const r=e.hasAttribute("data-target")?e.getAttribute("data-target"):e.getAttribute("href");t.setAttribute("data-HREF",r),e.getAttribute("data-allow")&&t.setAttribute("data-allow",e.getAttribute("data-allow")),e.hasAttribute("data-width")&&t.setAttribute("data-width",`${e.getAttribute("data-width")}`),e.hasAttribute("data-height")&&t.setAttribute("data-height",`${e.getAttribute("data-height")}`),t.setAttribute("data-type","iframe"),t.classList.add("tobii-iframe")}onPreload(e){}onLoad(e){let t=e.querySelector("iframe");const i=document.createElement("div");if(i.className="tobii__loader",i.setAttribute("role","progressbar"),i.setAttribute("aria-label",this.userSettings.loadingIndicatorLabel),e.appendChild(i),null==t){t=document.createElement("iframe");const i=e.getAttribute("data-href");t.setAttribute("frameborder","0"),t.setAttribute("src",i),t.setAttribute("allowfullscreen",""),i.indexOf("youtube.com")>-1?t.setAttribute("allow","accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"):i.indexOf("vimeo.com")>-1?t.setAttribute("allow","autoplay; picture-in-picture"):e.hasAttribute("data-allow")&&t.setAttribute("allow",e.getAttribute("data-allow")),e.getAttribute("data-width")&&(t.style.maxWidth=`${e.getAttribute("data-width")}`),e.getAttribute("data-height")&&(t.style.maxHeight=`${e.getAttribute("data-height")}`),t.style.opacity="0",e.appendChild(t),t.addEventListener("load",()=>{t.style.opacity="1";const i=e.querySelector(".tobii__loader");i&&e.removeChild(i)}),t.addEventListener("error",()=>{t.style.opacity="1";const i=e.querySelector(".tobii__loader");i&&e.removeChild(i)})}else t.setAttribute("src",e.getAttribute("data-href"))}onLeave(e){}onCleanup(e){const t=e.querySelector("iframe");t.setAttribute("src",""),t.style.opacity="0"}onReset(){}}class i{constructor(){this.userSettings=null}init(e,t,i){this.userSettings=i;const r=e.hasAttribute("data-target")?e.getAttribute("data-target"):e.getAttribute("href"),n=document.querySelector(r).cloneNode(!0);if(!n)throw new Error(`Ups, I can't find the target ${r}.`);t.appendChild(n),t.setAttribute("data-type","html"),t.classList.add("tobii-html")}onPreload(e){}onLoad(e,t){const i=e.querySelector("video");i&&(i.hasAttribute("data-time")&&i.readyState>0&&(i.currentTime=i.getAttribute("data-time")),this.userSettings.autoplayVideo&&i.play());const r=e.querySelector("audio");r&&this.userSettings.autoplayAudio&&r.play(),e.classList.add("tobii-group-"+t)}onLeave(e){const t=e.querySelector("video");t&&(t.paused||t.pause(),t.readyState>0&&t.setAttribute("data-time",t.currentTime));const i=e.querySelector("audio");i&&(i.paused||i.pause())}onCleanup(e){const t=e.querySelector("video");if(t&&t.readyState>0&&t.readyState<3&&t.duration!==t.currentTime){const i=t.cloneNode(!0);this._removeSources(t),t.load(),t.parentNode.removeChild(t),e.appendChild(i)}}onReset(){}_removeSources(e){const t=e.querySelectorAll("src");t&&t.forEach(e=>{e.setAttribute("src","")})}}class r{constructor(){this.playerId=0,this.PLAYER=[],this.userSettings=null}init(e,t,i){this.userSettings=i;const r=document.createElement("div");t.appendChild(r),this.PLAYER[this.playerId]=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",this.playerId),t.setAttribute("data-type","youtube"),t.classList.add("tobii-youtube"),this.playerId++}onPreload(e){}onLoad(e){this.userSettings.autoplayVideo&&this.PLAYER[e.getAttribute("data-player")].playVideo()}onLeave(e){1===this.PLAYER[e.getAttribute("data-player")].getPlayerState()&&this.PLAYER[e.getAttribute("data-player")].pauseVideo()}onCleanup(e){1===this.PLAYER[e.getAttribute("data-player")].getPlayerState()&&this.PLAYER[e.getAttribute("data-player")].pauseVideo()}onReset(){}}module.exports=function n(s){const a={image:new e,html:new i,iframe:new t,youtube:new r},o=['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])'];let d={};const l=[],u={gallery:[],slider:null,sliderElements:[],elementsLength:0,currentIndex:0,x:0};let c=null,p=null,b=null,h=null,g=null,m={},y=!1,v=!1,f=!1,w=null,A=null,E=null,L=!1,x=!1,_={},S=null,I=null;const C=e=>{if(null===document.querySelector('[data-type="youtube"]')||x)P(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===l.indexOf(e)&&l.push(e),window.onYouTubePlayerAPIReady=()=>{l.forEach(e=>{P(e)}),x=!0}}},T=e=>e.hasAttribute("data-group")?e.getAttribute("data-group"):"default",P=e=>{if(S=T(e),Object.prototype.hasOwnProperty.call(_,S)||(_[S]=JSON.parse(JSON.stringify(u)),Y()),-1!==_[S].gallery.indexOf(e))throw new Error("Ups, element already added.");if(_[S].gallery.push(e),_[S].elementsLength++,d.zoom&&e.querySelector("img")&&"false"!==e.getAttribute("data-zoom")||"true"===e.getAttribute("data-zoom")){const t=document.createElement("div");t.className="tobii-zoom__icon",t.innerHTML=d.zoomText,e.classList.add("tobii-zoom"),e.appendChild(t)}e.addEventListener("click",F),N(e),ue()&&S===I&&(oe(),de())},q=e=>{const t=T(e);if(-1===_[t].gallery.indexOf(e))throw new Error(`Ups, I can't find a slide for the element ${e}.`);{const i=_[t].gallery.indexOf(e),r=_[t].sliderElements[i];if(ue()&&t===I&&i===_[t].currentIndex){if(1===_[t].elementsLength)throw U(),new Error("Ups, I've closed. There are no slides more to show.");0===_[t].currentIndex?M():z(),oe(),de()}if(_[t].gallery.splice(_[t].gallery.indexOf(e)),_[t].sliderElements.splice(_[t].gallery.indexOf(e)),_[t].elementsLength--,--_[t].x,d.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",F),r.parentNode.removeChild(r)}},Y=()=>{_[S].slider=document.createElement("div"),_[S].slider.className="tobii__slider",_[S].slider.setAttribute("aria-hidden","true"),c.appendChild(_[S].slider)},N=e=>{const t=k(e),i=document.createElement("div"),r=document.createElement("div");i.className="tobii__slide",i.style.position="absolute",i.style.left=100*_[S].x+"%",i.setAttribute("aria-hidden","true"),t.init(e,r,d),i.appendChild(r),_[S].slider.appendChild(i),_[S].sliderElements.push(i),++_[S].x},k=e=>{const t=e.getAttribute("data-type");return void 0!==a[t]?a[t]:(e.hasAttribute("data-type")&&console.log("Unknown lightbox element type: "+t),a.image)},O=e=>{if(I=null!==I?I:S,ue())throw new Error("Ups, I'm aleady open.");if(!ue()&&(e||(e=0),-1===e||e>=_[I].elementsLength))throw new Error(`Ups, I can't find slide ${e}.`);document.documentElement.classList.add("tobii-is-open"),document.body.classList.add("tobii-is-open"),document.body.classList.add("tobii-is-open-"+I),oe(),d.close||(h.disabled=!1,h.setAttribute("aria-hidden","true")),w=document.activeElement;const t=window.location.href;window.history.pushState({tobii:"close"},"Image",t),_[I].currentIndex=e,V(),se(),$(_[I].currentIndex),_[I].slider.setAttribute("aria-hidden","false"),c.setAttribute("aria-hidden","false"),de(),X(_[I].currentIndex+1),X(_[I].currentIndex-1),_[I].slider.classList.add("tobii__slider--animate");const i=new window.CustomEvent("open",{detail:{group:I}});c.dispatchEvent(i)},U=()=>{if(!ue())throw new Error("Ups, I'm already closed.");document.documentElement.classList.remove("tobii-is-open"),document.body.classList.remove("tobii-is-open"),document.body.classList.remove("tobii-is-open-"+I),ae(),null!==window.history.state&&"close"===window.history.state.tobii&&window.history.back(),w.focus(),H(_[I].currentIndex),D(_[I].currentIndex),c.setAttribute("aria-hidden","true"),_[I].slider.setAttribute("aria-hidden","true"),_[I].currentIndex=0,_[I].slider.classList.remove("tobii__slider--animate");const e=new window.CustomEvent("close",{detail:{group:I}});c.dispatchEvent(e)},X=e=>{if(void 0===_[I].sliderElements[e])return;const t=_[I].sliderElements[e].querySelector("[data-type]");k(t).onPreload(t)},$=e=>{if(void 0===_[I].sliderElements[e])return;const t=_[I].sliderElements[e].querySelector("[data-type]"),i=k(t);_[I].sliderElements[e].classList.add("tobii__slide--is-active"),_[I].sliderElements[e].setAttribute("aria-hidden","false"),i.onLoad(t,I)},z=()=>{if(!ue())throw new Error("Ups, I'm closed.");_[I].currentIndex>0&&(H(_[I].currentIndex),$(--_[I].currentIndex),de("left"),D(_[I].currentIndex+1),X(_[I].currentIndex-1));const e=new window.CustomEvent("previous",{detail:{group:I}});c.dispatchEvent(e)},M=()=>{if(!ue())throw new Error("Ups, I'm closed.");_[I].currentIndex<_[I].elementsLength-1&&(H(_[I].currentIndex),$(++_[I].currentIndex),de("right"),D(_[I].currentIndex-1),X(_[I].currentIndex+1));const e=new window.CustomEvent("next",{detail:{group:I}});c.dispatchEvent(e)},R=e=>{if(ue())throw new Error("Ups, I'm open.");if(!e)throw new Error("Ups, no group specified.");if(e&&!Object.prototype.hasOwnProperty.call(_,e))throw new Error(`Ups, I don't have a group called "${e}".`);I=e},H=e=>{if(void 0===_[I].sliderElements[e])return;const t=_[I].sliderElements[e].querySelector("[data-type]"),i=k(t);_[I].sliderElements[e].classList.remove("tobii__slide--is-active"),_[I].sliderElements[e].setAttribute("aria-hidden","true"),i.onLeave(t)},D=e=>{if(void 0===_[I].sliderElements[e])return;const t=_[I].sliderElements[e].querySelector("[data-type]");k(t).onCleanup(t)},B=()=>{I=null!==I?I:S,A=-_[I].currentIndex*c.offsetWidth,_[I].slider.style.transform=`translate3d(${A}px, 0, 0)`,E=A},V=()=>{m={startX:0,endX:0,startY:0,endY:0}},j=()=>{const e=m.endX-m.startX,t=m.endY-m.startY,i=Math.abs(e),r=Math.abs(t);e>0&&i>d.threshold&&_[I].currentIndex>0?z():e<0&&i>d.threshold&&_[I].currentIndex!==_[I].elementsLength-1?M():t<0&&r>d.threshold&&d.swipeClose?U():B()},W=()=>{L||(L=!0,window.requestAnimationFrame(()=>{B(),L=!1}))},F=e=>{e.preventDefault(),I=T(e.currentTarget),O(_[I].gallery.indexOf(e.currentTarget))},G=e=>{e.target===p?z():e.target===b?M():(e.target===h||!1===y&&!1===v&&e.target.classList.contains("tobii__slide")&&d.docClose)&&U(),e.stopPropagation()},J=e=>{const t=Array.prototype.slice.call(c.querySelectorAll(`.tobii__btn:not([disabled]), .tobii__slide--is-active ${o.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(),U()):37===e.keyCode||"ArrowLeft"===e.code?(e.preventDefault(),z()):39!==e.keyCode&&"ArrowRight"!==e.code||(e.preventDefault(),M())},K=e=>{pe(e.target)||(e.stopPropagation(),y=!1,v=!1,f=!0,m.startX=e.touches[0].pageX,m.startY=e.touches[0].pageY,ce()&&_[I].slider.classList.add("tobii__slider--is-dragging"))},Q=e=>{e.stopPropagation(),f&&(m.endX=e.touches[0].pageX,m.endY=e.touches[0].pageY,ne())},Z=e=>{e.stopPropagation(),f=!1,_[I].slider.classList.remove("tobii__slider--is-dragging"),m.endX&&j(),V()},ee=e=>{pe(e.target)||(e.preventDefault(),e.stopPropagation(),y=!1,v=!1,f=!0,m.startX=e.pageX,m.startY=e.pageY,ce()&&_[I].slider.classList.add("tobii__slider--is-dragging"))},te=e=>{e.preventDefault(),f&&(m.endX=e.pageX,m.endY=e.pageY,ne())},ie=e=>{e.stopPropagation(),f=!1,_[I].slider.classList.remove("tobii__slider--is-dragging"),m.endX&&j(),V()},re=()=>{f=!1},ne=()=>{Math.abs(m.startX-m.endX)>0&&!v&&_[I].elementsLength>1?(_[I].slider.style.transform=`translate3d(${E-Math.round(m.startX-m.endX)}px, 0, 0)`,y=!0,v=!1):Math.abs(m.startY-m.endY)>0&&!y&&d.swipeClose&&(_[I].slider.style.transform=`translate3d(${E}px, -${Math.round(m.startY-m.endY)}px, 0)`,y=!1,v=!0)},se=()=>{d.keyboard&&window.addEventListener("keydown",J),window.addEventListener("resize",W),window.addEventListener("popstate",U),c.addEventListener("click",G),d.draggable&&ce()&&(c.addEventListener("touchstart",K),c.addEventListener("touchmove",Q),c.addEventListener("touchend",Z),c.addEventListener("mousedown",ee),c.addEventListener("mouseup",ie),c.addEventListener("mousemove",te),c.addEventListener("contextmenu",re))},ae=()=>{d.keyboard&&window.removeEventListener("keydown",J),window.removeEventListener("resize",W),window.removeEventListener("popstate",U),c.removeEventListener("click",G),d.draggable&&ce()&&(c.removeEventListener("touchstart",K),c.removeEventListener("touchmove",Q),c.removeEventListener("touchend",Z),c.removeEventListener("mousedown",ee),c.removeEventListener("mouseup",ie),c.removeEventListener("mousemove",te),c.removeEventListener("contextmenu",re))},oe=()=>{(d.draggable&&d.swipeClose&&ce()&&!_[I].slider.classList.contains("tobii__slider--is-draggable")||d.draggable&&_[I].elementsLength>1&&!_[I].slider.classList.contains("tobii__slider--is-draggable"))&&_[I].slider.classList.add("tobii__slider--is-draggable"),!d.nav||1===_[I].elementsLength||"auto"===d.nav&&ce()?(p.setAttribute("aria-hidden","true"),p.disabled=!0,b.setAttribute("aria-hidden","true"),b.disabled=!0):(p.setAttribute("aria-hidden","false"),p.disabled=!1,b.setAttribute("aria-hidden","false"),b.disabled=!1),g.setAttribute("aria-hidden",d.counter&&1!==_[I].elementsLength?"false":"true")},de=(e=null)=>{B(),g.textContent=`${_[I].currentIndex+1}/${_[I].elementsLength}`,(e=>{(!0===d.nav||"auto"===d.nav)&&!ce()&&_[I].elementsLength>1?(p.setAttribute("aria-hidden","true"),p.disabled=!0,b.setAttribute("aria-hidden","true"),b.disabled=!0,1===_[I].elementsLength?d.close&&h.focus():0===_[I].currentIndex?(b.setAttribute("aria-hidden","false"),b.disabled=!1,b.focus()):_[I].currentIndex===_[I].elementsLength-1?(p.setAttribute("aria-hidden","false"),p.disabled=!1,p.focus()):(p.setAttribute("aria-hidden","false"),p.disabled=!1,b.setAttribute("aria-hidden","false"),b.disabled=!1,"left"===e?p.focus():b.focus())):d.close&&h.focus()})(e)},le=()=>{ue()&&U(),Object.entries(_).forEach(e=>{e[1].gallery.forEach(e=>{q(e)})}),_={},S=I=null;for(const e in a)a[e].onReset()},ue=()=>"false"===c.getAttribute("aria-hidden"),ce=()=>"ontouchstart"in window,pe=e=>-1!==["TEXTAREA","OPTION","INPUT","SELECT"].indexOf(e.nodeName)||e===p||e===b||e===h;return(e=>{if(document.querySelector("div.tobii"))return void console.log("Multiple lightbox instances not supported.");d=(e=>({selector:".lightbox",captions:!0,captionsSelector:"img",captionAttribute:"alt",captionText:null,captionHTML:!1,nav:"auto",navText:['<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path stroke="none" d="M0 0h24v24H0z"/><polyline points="15 6 9 12 15 18" /></svg>','<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path stroke="none" d="M0 0h24v24H0z"/><polyline points="9 6 15 12 9 18" /></svg>'],navLabel:["Previous image","Next image"],close:!0,closeText:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path stroke="none" d="M0 0h24v24H0z"/><line x1="18" y1="6" x2="6" y2="18" /><line x1="6" y1="6" x2="18" y2="18" /></svg>',closeLabel:"Close lightbox",loadingIndicatorLabel:"Image loading",counter:!0,download:!1,downloadText:"",downloadLabel:"Download image",keyboard:!0,zoom:!0,zoomText:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path stroke="none" d="M0 0h24v24H0z"/><polyline points="16 4 20 4 20 8" /><line x1="14" y1="10" x2="20" y2="4" /><polyline points="8 20 4 20 4 16" /><line x1="4" y1="20" x2="10" y2="14" /><polyline points="16 20 20 20 20 16" /><line x1="14" y1="14" x2="20" y2="20" /><polyline points="8 4 4 4 4 8" /><line x1="4" y1="4" x2="10" y2="10" /></svg>',docClose:!0,swipeClose:!0,hideScrollbar:!0,draggable:!0,threshold:100,rtl:!1,loop:!1,autoplayVideo:!1,modal:!1,theme:"tobii--theme-default",...e}))(e),c||(c=document.createElement("div"),c.setAttribute("role","dialog"),c.setAttribute("aria-hidden","true"),c.classList.add("tobii"),c.classList.add(d.theme),p=document.createElement("button"),p.className="tobii__btn tobii__btn--previous",p.setAttribute("type","button"),p.setAttribute("aria-label",d.navLabel[0]),p.innerHTML=d.navText[0],c.appendChild(p),b=document.createElement("button"),b.className="tobii__btn tobii__btn--next",b.setAttribute("type","button"),b.setAttribute("aria-label",d.navLabel[1]),b.innerHTML=d.navText[1],c.appendChild(b),h=document.createElement("button"),h.className="tobii__btn tobii__btn--close",h.setAttribute("type","button"),h.setAttribute("aria-label",d.closeLabel),h.innerHTML=d.closeText,c.appendChild(h),g=document.createElement("div"),g.className="tobii__counter",c.appendChild(g),document.body.appendChild(c));const t=document.querySelectorAll(d.selector);if(!t)throw new Error(`Ups, I can't find the selector ${d.selector} on this website.`);const i=[];t.forEach(e=>{const t=e.hasAttribute("data-group")?e.getAttribute("data-group"):"default";let r=e.href;e.hasAttribute("data-target")&&(r=e.getAttribute("data-target")),r+="__"+t,void 0!==i[r]?e.addEventListener("click",e=>{R(t),O(),e.preventDefault()}):(i[r]=1,C(e))})})(s),n.open=O,n.previous=z,n.next=M,n.close=U,n.add=C,n.remove=q,n.reset=le,n.destroy=()=>{le(),c.parentNode.removeChild(c)},n.isOpen=ue,n.slidesIndex=()=>_[I].currentIndex,n.select=e=>{const t=_[I].currentIndex;if(!ue())throw new Error("Ups, I'm closed.");if(ue()){if(!e&&0!==e)throw new Error("Ups, no slide specified.");if(e===_[I].currentIndex)throw new Error(`Ups, slide ${e} is already selected.`);if(-1===e||e>=_[I].elementsLength)throw new Error(`Ups, I can't find slide ${e}.`)}_[I].currentIndex=e,H(t),$(e),e<t&&(de("left"),D(t),X(e-1)),e>t&&(de("right"),D(t),X(e+1))},n.slidesCount=()=>_[I].elementsLength,n.selectGroup=R,n.currentGroup=()=>null!==I?I:S,n.on=(e,t)=>{c.addEventListener(e,t)},n.off=(e,t)=>{c.removeEventListener(e,t)},n};
class e{constructor(){this.figcaptionId=0,this.userSettings=null}init(e,t,i){this.userSettings=i;const r=document.createElement("figure"),n=document.createElement("figcaption"),a=document.createElement("img"),s=e.querySelector("img"),o=document.createElement("div");if(r.style.opacity="0",s&&(a.alt=s.alt||""),a.setAttribute("src",""),a.setAttribute("data-src",e.href),e.hasAttribute("data-srcset")&&a.setAttribute("data-srcset",e.getAttribute("data-srcset")),r.appendChild(a),this.userSettings.captions){let t;"function"==typeof this.userSettings.captionText?t=this.userSettings.captionText(e):"self"===this.userSettings.captionsSelector&&e.getAttribute(this.userSettings.captionAttribute)?t=e.getAttribute(this.userSettings.captionAttribute):"img"===this.userSettings.captionsSelector&&s&&s.getAttribute(this.userSettings.captionAttribute)&&(t=s.getAttribute(this.userSettings.captionAttribute)),this.userSettings.captionHTML?n.innerHTML=t:n.textContent=t,t&&(n.id=`tobii-figcaption-${this.figcaptionId}`,r.appendChild(n),a.setAttribute("aria-labelledby",n.id),++this.figcaptionId)}t.appendChild(r),o.className="tobii__loader",o.setAttribute("role","progressbar"),o.setAttribute("aria-label",this.userSettings.loadingIndicatorLabel),t.appendChild(o),t.setAttribute("data-type","image"),t.classList.add("tobii-image")}onPreload(e){this.onLoad(e)}onLoad(e){const t=e.querySelector("img");if(!t.hasAttribute("data-src"))return;const i=e.querySelector("figure"),r=e.querySelector(".tobii__loader");t.addEventListener("load",()=>{e.removeChild(r),i.style.opacity="1"}),t.addEventListener("error",()=>{e.removeChild(r),i.style.opacity="1"}),t.setAttribute("src",t.getAttribute("data-src")),t.removeAttribute("data-src"),t.hasAttribute("data-srcset")&&t.setAttribute("srcset",t.getAttribute("data-srcset"))}onLeave(e){}onCleanup(e){}onReset(){this.figcaptionId=0}}class t{constructor(){this.userSettings=null}init(e,t,i){this.userSettings=i;const r=e.hasAttribute("data-target")?e.getAttribute("data-target"):e.getAttribute("href");t.setAttribute("data-HREF",r),e.getAttribute("data-allow")&&t.setAttribute("data-allow",e.getAttribute("data-allow")),e.hasAttribute("data-width")&&t.setAttribute("data-width",`${e.getAttribute("data-width")}`),e.hasAttribute("data-height")&&t.setAttribute("data-height",`${e.getAttribute("data-height")}`),t.setAttribute("data-type","iframe"),t.classList.add("tobii-iframe")}onPreload(e){}onLoad(e){let t=e.querySelector("iframe");const i=document.createElement("div");if(i.className="tobii__loader",i.setAttribute("role","progressbar"),i.setAttribute("aria-label",this.userSettings.loadingIndicatorLabel),e.appendChild(i),null==t){t=document.createElement("iframe");const i=e.getAttribute("data-href");t.setAttribute("frameborder","0"),t.setAttribute("src",i),t.setAttribute("allowfullscreen",""),i.indexOf("youtube.com")>-1?t.setAttribute("allow","accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"):i.indexOf("vimeo.com")>-1?t.setAttribute("allow","autoplay; picture-in-picture"):e.hasAttribute("data-allow")&&t.setAttribute("allow",e.getAttribute("data-allow")),e.getAttribute("data-width")&&(t.style.maxWidth=`${e.getAttribute("data-width")}`),e.getAttribute("data-height")&&(t.style.maxHeight=`${e.getAttribute("data-height")}`),t.style.opacity="0",e.appendChild(t),t.addEventListener("load",()=>{t.style.opacity="1";const i=e.querySelector(".tobii__loader");i&&e.removeChild(i)}),t.addEventListener("error",()=>{t.style.opacity="1";const i=e.querySelector(".tobii__loader");i&&e.removeChild(i)})}else t.setAttribute("src",e.getAttribute("data-href"))}onLeave(e){}onCleanup(e){const t=e.querySelector("iframe");t.setAttribute("src",""),t.style.opacity="0"}onReset(){}}class i{constructor(){this.userSettings=null}init(e,t,i){this.userSettings=i;const r=e.hasAttribute("data-target")?e.getAttribute("data-target"):e.getAttribute("href"),n=document.querySelector(r).cloneNode(!0);if(!n)throw new Error(`Ups, I can't find the target ${r}.`);t.appendChild(n),t.setAttribute("data-type","html"),t.classList.add("tobii-html")}onPreload(e){}onLoad(e,t){const i=e.querySelector("video");i&&(i.hasAttribute("data-time")&&i.readyState>0&&(i.currentTime=i.getAttribute("data-time")),this.userSettings.autoplayVideo&&i.play());const r=e.querySelector("audio");r&&this.userSettings.autoplayAudio&&r.play(),e.classList.add("tobii-group-"+t)}onLeave(e){const t=e.querySelector("video");t&&(t.paused||t.pause(),t.readyState>0&&t.setAttribute("data-time",t.currentTime));const i=e.querySelector("audio");i&&(i.paused||i.pause())}onCleanup(e){const t=e.querySelector("video");if(t&&t.readyState>0&&t.readyState<3&&t.duration!==t.currentTime){const i=t.cloneNode(!0);this._removeSources(t),t.load(),t.parentNode.removeChild(t),e.appendChild(i)}}onReset(){}_removeSources(e){const t=e.querySelectorAll("src");t&&t.forEach(e=>{e.setAttribute("src","")})}}class r{constructor(){this.playerId=0,this.PLAYER=[],this.userSettings=null}init(e,t,i){this.userSettings=i;const r=document.createElement("div");t.appendChild(r),this.PLAYER[this.playerId]=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",this.playerId),t.setAttribute("data-type","youtube"),t.classList.add("tobii-youtube"),this.playerId++}onPreload(e){}onLoad(e){this.userSettings.autoplayVideo&&this.PLAYER[e.getAttribute("data-player")].playVideo()}onLeave(e){1===this.PLAYER[e.getAttribute("data-player")].getPlayerState()&&this.PLAYER[e.getAttribute("data-player")].pauseVideo()}onCleanup(e){1===this.PLAYER[e.getAttribute("data-player")].getPlayerState()&&this.PLAYER[e.getAttribute("data-player")].pauseVideo()}onReset(){}}module.exports=function n(a){const s={image:new e,html:new i,iframe:new t,youtube:new r},o=['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])'];let l={};const d=[],c={gallery:[],slider:null,sliderElements:[],elementsLength:0,currentIndex:0,x:0};let u=null,p=null,h=null,b=null,g=null,m=null,y=null,f=!1,w={},v=null,A=[],x=0;const E={element:null,originX:0,originY:0,translateX:0,translateY:0,scale:1},L={startX:0,startY:0,x:0,y:0,distance:0},_=e=>{if(null===document.querySelector('[data-type="youtube"]')||f)S(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===d.indexOf(e)&&d.push(e),window.onYouTubePlayerAPIReady=()=>{d.forEach(e=>{S(e)}),f=!0}}},I=e=>e.hasAttribute("data-group")?e.getAttribute("data-group"):"default",S=e=>{const t=I(e);if(Object.prototype.hasOwnProperty.call(w,t)||(w[t]=JSON.parse(JSON.stringify(c)),w[t].slider=document.createElement("div"),w[t].slider.className="tobii__slider",w[t].slider.setAttribute("aria-hidden","true"),u.appendChild(w[t].slider)),-1!==w[t].gallery.indexOf(e))throw new Error("Ups, element already added.");{if(w[t].gallery.push(e),w[t].elementsLength++,l.zoom&&e.querySelector("img")&&"false"!==e.getAttribute("data-zoom")||"true"===e.getAttribute("data-zoom")){const t=document.createElement("div");t.className="tobii-zoom__icon",t.innerHTML=l.zoomText,e.classList.add("tobii-zoom"),e.appendChild(t)}e.addEventListener("click",z);const i=Y(e),r=document.createElement("div"),n=document.createElement("div");r.className="tobii__slide",r.style.position="absolute",r.style.left=100*w[t].x+"%",r.setAttribute("aria-hidden","true"),i.init(e,n,l),r.appendChild(n),w[t].slider.appendChild(r),w[t].sliderElements.push(r),++w[t].x,le()&&t===v&&(ae(),se())}},C=e=>{const t=I(e);if(-1===w[t].gallery.indexOf(e))throw new Error(`Ups, I can't find a slide for the element ${e}.`);{const i=w[t].gallery.indexOf(e),r=w[t].sliderElements[i];if(le()&&t===v&&i===w[t].currentIndex){if(1===w[t].elementsLength)throw X(),new Error("Ups, I've closed. There are no slides more to show.");0===w[t].currentIndex?P():N(),ae(),se()}if(w[t].gallery.splice(w[t].gallery.indexOf(e)),w[t].sliderElements.splice(w[t].gallery.indexOf(e)),w[t].elementsLength--,--w[t].x,l.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",z),r.parentNode.removeChild(r)}},Y=e=>{const t=e.getAttribute("data-type");return void 0!==s[t]?s[t]:(e.hasAttribute("data-type")&&console.log("Unknown lightbox element type: "+t),s.image)},T=(e=0)=>{if(le())throw new Error("Ups, I'm aleady open.");if(-1===e||e>=w[v].elementsLength)throw new Error(`Ups, I can't find slide ${e}.`);document.documentElement.classList.add("tobii-is-open"),document.body.classList.add("tobii-is-open"),document.body.classList.add("tobii-is-open-"+v),ae(),l.close||(b.disabled=!1,b.setAttribute("aria-hidden","true")),m=document.activeElement;const t=window.location.href;window.history.pushState({tobii:"close"},"Image",t),w[v].currentIndex=e,re(),M(w[v].currentIndex),w[v].slider.setAttribute("aria-hidden","false"),u.setAttribute("aria-hidden","false"),se(),q(w[v].currentIndex+1),q(w[v].currentIndex-1),w[v].slider.classList.add("tobii__slider--animate");const i=new window.CustomEvent("open",{detail:{group:v}});u.dispatchEvent(i)},X=()=>{if(!le())throw new Error("Ups, I'm already closed.");document.documentElement.classList.remove("tobii-is-open"),document.body.classList.remove("tobii-is-open"),document.body.classList.remove("tobii-is-open-"+v),ne(),null!==window.history.state&&"close"===window.history.state.tobii&&window.history.back(),m.focus(),O(w[v].currentIndex),k(w[v].currentIndex),u.setAttribute("aria-hidden","true"),w[v].slider.setAttribute("aria-hidden","true"),w[v].currentIndex=0,w[v].slider.classList.remove("tobii__slider--animate");const e=new window.CustomEvent("close",{detail:{group:v}});u.dispatchEvent(e)},q=e=>{if(void 0===w[v].sliderElements[e])return;const t=w[v].sliderElements[e].querySelector("[data-type]");Y(t).onPreload(t)},M=e=>{if(void 0===w[v].sliderElements[e])return;const t=w[v].sliderElements[e].querySelector("[data-type]"),i=Y(t);w[v].sliderElements[e].classList.add("tobii__slide--is-active"),w[v].sliderElements[e].setAttribute("aria-hidden","false"),i.onLoad(t,v)},N=()=>{if(!le())throw new Error("Ups, I'm closed.");w[v].currentIndex>0&&(O(w[v].currentIndex),M(--w[v].currentIndex),se("left"),k(w[v].currentIndex+1),q(w[v].currentIndex-1));const e=new window.CustomEvent("previous",{detail:{group:v}});u.dispatchEvent(e)},P=()=>{if(!le())throw new Error("Ups, I'm closed.");w[v].currentIndex<w[v].elementsLength-1&&(O(w[v].currentIndex),M(++w[v].currentIndex),se("right"),k(w[v].currentIndex-1),q(w[v].currentIndex+1));const e=new window.CustomEvent("next",{detail:{group:v}});u.dispatchEvent(e)},$=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(w,e))throw new Error(`Ups, I don't have a group called "${e}".`);v=e},O=e=>{if(void 0===w[v].sliderElements[e])return;const t=w[v].sliderElements[e].querySelector("[data-type]"),i=Y(t);w[v].sliderElements[e].classList.remove("tobii__slide--is-active"),w[v].sliderElements[e].setAttribute("aria-hidden","true"),i.onLeave(t)},k=e=>{if(void 0===w[v].sliderElements[e])return;const t=w[v].sliderElements[e].querySelector("[data-type]");Y(t).onCleanup(t),L.startX=0,L.startY=0,L.x=0,L.y=0,L.distance=0,x=0,F()&&ie()},R=()=>{y=-w[v].currentIndex*u.offsetWidth,w[v].slider.style.transform=`translate(${y}px, 0)`},U=()=>{R()},z=e=>{e.preventDefault(),v=I(e.currentTarget),T(w[v].gallery.indexOf(e.currentTarget))},H=e=>{e.target===p?N():e.target===h?P():(e.target===b||e.target.classList.contains("tobii__slide")&&l.docClose)&&X(),e.stopPropagation()},D=e=>{const t=Array.prototype.slice.call(u.querySelectorAll(`.tobii__btn:not([disabled]), .tobii__slide--is-active ${o.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(),X()):37===e.keyCode||"ArrowLeft"===e.code?(e.preventDefault(),N()):39!==e.keyCode&&"ArrowRight"!==e.code||(e.preventDefault(),P())},B=()=>{A=[],R(),w[v].slider.classList.remove("tobii__slider--is-"+(F()?"moving":"dragging"))},V=e=>{if(!ce(e.target)&&(e.preventDefault(),e.stopPropagation(),L.startX=L.x=e.pageX,L.startY=L.y=e.pageY,L.distance=0,A.push(e),2===A.length)){const{x:e,y:t}=te(A[0].pageX,A[0].pageY,A[1].pageX,A[1].pageY);L.startX=L.x=e,L.startY=L.y=t,L.distance=ee(A[0].pageX-A[1].pageX,A[0].pageY-A[1].pageY)/E.scale}},j=e=>{if(!A.length)return;w[v].slider.classList.add("tobii__slider--is-"+(F()?"moving":"dragging"));const t=A.findIndex(t=>t.pointerId===e.pointerId);if(A[t]=e,2===A.length){const{x:e,y:t}=te(A[0].pageX,A[0].pageY,A[1].pageX,A[1].pageY),i=ee(A[0].pageX-A[1].pageX,A[0].pageY-A[1].pageY)/L.distance;return Z(K(i,1,4),e,t,e-L.x,t-L.y),L.x=e,void(L.y=t)}if(F()&&Q(e.pageX-L.x,e.pageY-L.y),L.x=e.pageX,L.y=e.pageY,!F()){const e=L.startX-L.x,t=L.startY-L.y;if(ee(e,t)<10)return;Math.abs(e)>Math.abs(t)&&w[v].elementsLength>1?w[v].slider.style.transform=`translate(${y-Math.round(e)}px, 0)`:l.swipeClose&&(w[v].slider.style.transform=`translate(${y}px, -${Math.round(t)}px)`)}},W=e=>{e.stopPropagation(),w[v].slider.classList.remove("tobii__slider--is-"+(F()?"moving":"dragging"));const t=A.findIndex(t=>t.pointerId===e.pointerId);A.splice(t,1);const i=L.startX-L.x,r=L.startY-L.y,n=Math.abs(i),a=Math.abs(r);if(n||a)F()||(i<0&&n>l.threshold&&w[v].currentIndex>0?N():i>0&&n>l.threshold&&w[v].currentIndex!==w[v].elementsLength-1?P():r>0&&a>l.threshold&&l.swipeClose?X():R());else{const t=(new Date).getTime(),i=t-x;i<500&&i>100?(e.preventDefault(),x=0,F()?ie():Z(2,e.clientX,e.clientY,0,0)):(x=t,de()&&window.setTimeout(()=>{const{left:t,top:i,bottom:r,right:n,width:a}=e.target.getBoundingClientRect();L.startY<i||L.startY>r||!x||(L.startX>t&&L.startX<t+a/2?N():L.startX<n&&L.startX>n-a/2&&P())},500))}},G=e=>{const t=Math.sign(e.deltaY)>0?-1:1;(F()||t)&&(e.preventDefault(),Z(K(E.scale+t/(10/E.scale),1,4),e.pageX,e.pageY,0,0))},J=(e,t)=>{const{element:i,scale:r,originX:n,originY:a}=E,s="x"===e,o=s?n:a,l=s?"offsetWidth":"offsetHeight",d=i.parentNode[l],c=i[l],u=i.getBoundingClientRect(),p=(o-c/2)*(r-1),h=Math.max(0,Math.round(s?u.width:u.height)-d),b=Math.round(h/2);return K(t,0-b+p,b+p)},K=(e,t,i)=>Math.max(Math.min(e,i),t),F=()=>1!==E.scale,Q=(e,t)=>{0!==e&&(E.translateX=J("x",E.translateX+e)),0!==t&&(E.translateY=J("y",E.translateY+t));const{element:i,originX:r,originY:n,translateX:a,translateY:s,scale:o}=E;i.style.transformOrigin=`${r}px ${n}px`,i.style.transform=`translate(${a}px, ${s}px) scale(${o})`},Z=(e,t,i,r,n)=>{E.element||(E.element=u.querySelector(".tobii__slide--is-active img"));const{left:a,top:s}=E.element.getBoundingClientRect(),o=(i-s)/E.scale;E.originX=(t-a)/E.scale,E.originY=o,E.scale=e,Q(r,n)},ee=(e,t)=>Math.hypot(e,t),te=(e,t,i,r)=>({x:(e+i)/2,y:(t+r)/2}),ie=()=>{E.scale=1,E.originX=0,E.originY=0,E.translateX=0,E.translateY=0,Q(0,0),E.element=null},re=()=>{l.keyboard&&window.addEventListener("keydown",D),window.addEventListener("resize",U),window.addEventListener("popstate",X),ue("click",H),l.draggable&&(ue("pointerdown",V),ue("pointermove",j),ue("pointerup",W),ue("pointercancel",B),ue("pointerout",B),ue("pointerleave",B),ue("contextmenu",B)),ue("wheel",G)},ne=()=>{l.keyboard&&window.removeEventListener("keydown",D),window.removeEventListener("resize",U),window.removeEventListener("popstate",X),pe("click",H),l.draggable&&(pe("pointerdown",V),pe("pointermove",j),pe("pointerup",W),pe("pointercancel",B),pe("pointerout",B),pe("pointerleave",B),pe("contextmenu",B)),pe("wheel",G)},ae=()=>{l.draggable&&!w[v].slider.classList.contains("tobii__slider--is-draggable")&&w[v].slider.classList.add("tobii__slider--is-draggable"),!l.nav||1===w[v].elementsLength||"auto"===l.nav&&de()?(p.setAttribute("aria-hidden","true"),p.disabled=!0,h.setAttribute("aria-hidden","true"),h.disabled=!0):(p.setAttribute("aria-hidden","false"),p.disabled=!1,h.setAttribute("aria-hidden","false"),h.disabled=!1),g.setAttribute("aria-hidden",l.counter&&1!==w[v].elementsLength?"false":"true")},se=(e=null)=>{R(),g.textContent=`${w[v].currentIndex+1}/${w[v].elementsLength}`,(e=>{(!0===l.nav||"auto"===l.nav)&&!de()&&w[v].elementsLength>1?(p.setAttribute("aria-hidden","true"),p.disabled=!0,h.setAttribute("aria-hidden","true"),h.disabled=!0,1===w[v].elementsLength?l.close&&b.focus():0===w[v].currentIndex?(h.setAttribute("aria-hidden","false"),h.disabled=!1,h.focus()):w[v].currentIndex===w[v].elementsLength-1?(p.setAttribute("aria-hidden","false"),p.disabled=!1,p.focus()):(p.setAttribute("aria-hidden","false"),p.disabled=!1,h.setAttribute("aria-hidden","false"),h.disabled=!1,"left"===e?p.focus():h.focus())):l.close&&b.focus()})(e)},oe=()=>{le()&&X(),Object.entries(w).forEach(e=>{e[1].gallery.forEach(e=>{C(e)})}),w={},v=null;for(const e in s)s[e].onReset()},le=()=>"false"===u.getAttribute("aria-hidden"),de=()=>"ontouchstart"in window,ce=e=>-1!==["TEXTAREA","OPTION","INPUT","SELECT"].indexOf(e.nodeName)||e===p||e===h||e===b,ue=(e,t)=>{u.addEventListener(e,t)},pe=(e,t)=>{u.removeEventListener(e,t)};return(e=>{if(document.querySelector("div.tobii"))return void console.log("Multiple lightbox instances not supported.");l=(e=>({selector:".lightbox",captions:!0,captionsSelector:"img",captionAttribute:"alt",captionText:null,captionHTML:!1,nav:"auto",navText:['<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path stroke="none" d="M0 0h24v24H0z"/><polyline points="15 6 9 12 15 18" /></svg>','<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path stroke="none" d="M0 0h24v24H0z"/><polyline points="9 6 15 12 9 18" /></svg>'],navLabel:["Previous image","Next image"],close:!0,closeText:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path stroke="none" d="M0 0h24v24H0z"/><line x1="18" y1="6" x2="6" y2="18" /><line x1="6" y1="6" x2="18" y2="18" /></svg>',closeLabel:"Close lightbox",loadingIndicatorLabel:"Image loading",counter:!0,download:!1,downloadText:"",downloadLabel:"Download image",keyboard:!0,zoom:!0,zoomText:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path stroke="none" d="M0 0h24v24H0z"/><polyline points="16 4 20 4 20 8" /><line x1="14" y1="10" x2="20" y2="4" /><polyline points="8 20 4 20 4 16" /><line x1="4" y1="20" x2="10" y2="14" /><polyline points="16 20 20 20 20 16" /><line x1="14" y1="14" x2="20" y2="20" /><polyline points="8 4 4 4 4 8" /><line x1="4" y1="4" x2="10" y2="10" /></svg>',docClose:!0,swipeClose:!0,hideScrollbar:!0,draggable:!0,threshold:100,rtl:!1,loop:!1,autoplayVideo:!1,modal:!1,theme:"tobii--theme-default",...e}))(e),u||(u=document.createElement("div"),u.setAttribute("role","dialog"),u.setAttribute("aria-hidden","true"),u.classList.add("tobii"),u.classList.add(l.theme),p=document.createElement("button"),p.className="tobii__btn tobii__btn--previous",p.setAttribute("type","button"),p.setAttribute("aria-label",l.navLabel[0]),p.innerHTML=l.navText[0],u.appendChild(p),h=document.createElement("button"),h.className="tobii__btn tobii__btn--next",h.setAttribute("type","button"),h.setAttribute("aria-label",l.navLabel[1]),h.innerHTML=l.navText[1],u.appendChild(h),b=document.createElement("button"),b.className="tobii__btn tobii__btn--close",b.setAttribute("type","button"),b.setAttribute("aria-label",l.closeLabel),b.innerHTML=l.closeText,u.appendChild(b),g=document.createElement("div"),g.className="tobii__counter",u.appendChild(g),document.body.appendChild(u));const t=document.querySelectorAll(l.selector);if(!t)throw new Error(`Ups, I can't find the selector ${l.selector} on this website.`);const i=[];t.forEach(e=>{const t=e.hasAttribute("data-group")?e.getAttribute("data-group"):"default";let r=e.href;e.hasAttribute("data-target")&&(r=e.getAttribute("data-target")),r+="__"+t,void 0!==i[r]?e.addEventListener("click",e=>{$(t),T(),e.preventDefault()}):(i[r]=1,_(e))})})(a),n.open=T,n.previous=N,n.next=P,n.close=X,n.add=_,n.remove=C,n.reset=oe,n.destroy=()=>{oe(),u.parentNode.removeChild(u)},n.isOpen=le,n.slidesIndex=()=>w[v].currentIndex,n.select=e=>{const t=w[v].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===w[v].currentIndex)throw new Error(`Ups, slide ${e} is already selected.`);if(-1===e||e>=w[v].elementsLength)throw new Error(`Ups, I can't find slide ${e}.`)}w[v].currentIndex=e,O(t),M(e),e<t&&(se("left"),k(t),q(e-1)),e>t&&(se("right"),k(t),q(e+1))},n.slidesCount=()=>w[v].elementsLength,n.selectGroup=$,n.currentGroup=()=>v,n.on=ue,n.off=pe,n};

@@ -1,1 +0,1 @@

!function(){if("function"!=typeof window.CustomEvent){var e=function(e,t){t=t||{bubbles:!1,cancelable:!1,detail:void 0};var i=document.createEvent("CustomEvent");return i.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),i};e.prototype=window.Event.prototype,window.CustomEvent=e}function t(){return t=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n])}return e},t.apply(this,arguments)}window.NodeList&&!NodeList.prototype.forEach&&(NodeList.prototype.forEach=function(e,t){t=t||window;for(var i=0;i<this.length;i++)e.call(t,this[i],i,this)});var i=/*#__PURE__*/function(){function e(){this.figcaptionId=0,this.userSettings=null}var t=e.prototype;return t.init=function(e,t,i){this.userSettings=i;var n,r=document.createElement("figure"),o=document.createElement("figcaption"),a=document.createElement("img"),s=e.querySelector("img"),d=document.createElement("div");r.style.opacity="0",s&&(a.alt=s.alt||""),a.setAttribute("src",""),a.setAttribute("data-src",e.href),e.hasAttribute("data-srcset")&&a.setAttribute("data-srcset",e.getAttribute("data-srcset")),r.appendChild(a),this.userSettings.captions&&("function"==typeof this.userSettings.captionText?n=this.userSettings.captionText(e):"self"===this.userSettings.captionsSelector&&e.getAttribute(this.userSettings.captionAttribute)?n=e.getAttribute(this.userSettings.captionAttribute):"img"===this.userSettings.captionsSelector&&s&&s.getAttribute(this.userSettings.captionAttribute)&&(n=s.getAttribute(this.userSettings.captionAttribute)),this.userSettings.captionHTML?o.innerHTML=n:o.textContent=n,n&&(o.id="tobii-figcaption-"+this.figcaptionId,r.appendChild(o),a.setAttribute("aria-labelledby",o.id),++this.figcaptionId)),t.appendChild(r),d.className="tobii__loader",d.setAttribute("role","progressbar"),d.setAttribute("aria-label",this.userSettings.loadingIndicatorLabel),t.appendChild(d),t.setAttribute("data-type","image"),t.classList.add("tobii-image")},t.onPreload=function(e){this.onLoad(e)},t.onLoad=function(e){var t=e.querySelector("img");if(t.hasAttribute("data-src")){var i=e.querySelector("figure"),n=e.querySelector(".tobii__loader");t.addEventListener("load",function(){e.removeChild(n),i.style.opacity="1"}),t.addEventListener("error",function(){e.removeChild(n),i.style.opacity="1"}),t.setAttribute("src",t.getAttribute("data-src")),t.removeAttribute("data-src"),t.hasAttribute("data-srcset")&&t.setAttribute("srcset",t.getAttribute("data-srcset"))}},t.onLeave=function(e){},t.onCleanup=function(e){},t.onReset=function(){this.figcaptionId=0},e}(),n=/*#__PURE__*/function(){function e(){this.userSettings=null}var t=e.prototype;return t.init=function(e,t,i){this.userSettings=i;var n=e.hasAttribute("data-target")?e.getAttribute("data-target"):e.getAttribute("href");t.setAttribute("data-HREF",n),e.getAttribute("data-allow")&&t.setAttribute("data-allow",e.getAttribute("data-allow")),e.hasAttribute("data-width")&&t.setAttribute("data-width",""+e.getAttribute("data-width")),e.hasAttribute("data-height")&&t.setAttribute("data-height",""+e.getAttribute("data-height")),t.setAttribute("data-type","iframe"),t.classList.add("tobii-iframe")},t.onPreload=function(e){},t.onLoad=function(e){var t=e.querySelector("iframe"),i=document.createElement("div");if(i.className="tobii__loader",i.setAttribute("role","progressbar"),i.setAttribute("aria-label",this.userSettings.loadingIndicatorLabel),e.appendChild(i),null==t){t=document.createElement("iframe");var n=e.getAttribute("data-href");t.setAttribute("frameborder","0"),t.setAttribute("src",n),t.setAttribute("allowfullscreen",""),n.indexOf("youtube.com")>-1?t.setAttribute("allow","accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"):n.indexOf("vimeo.com")>-1?t.setAttribute("allow","autoplay; picture-in-picture"):e.hasAttribute("data-allow")&&t.setAttribute("allow",e.getAttribute("data-allow")),e.getAttribute("data-width")&&(t.style.maxWidth=""+e.getAttribute("data-width")),e.getAttribute("data-height")&&(t.style.maxHeight=""+e.getAttribute("data-height")),t.style.opacity="0",e.appendChild(t),t.addEventListener("load",function(){t.style.opacity="1";var i=e.querySelector(".tobii__loader");i&&e.removeChild(i)}),t.addEventListener("error",function(){t.style.opacity="1";var i=e.querySelector(".tobii__loader");i&&e.removeChild(i)})}else t.setAttribute("src",e.getAttribute("data-href"))},t.onLeave=function(e){},t.onCleanup=function(e){var t=e.querySelector("iframe");t.setAttribute("src",""),t.style.opacity="0"},t.onReset=function(){},e}(),r=/*#__PURE__*/function(){function e(){this.userSettings=null}var t=e.prototype;return t.init=function(e,t,i){this.userSettings=i;var n=e.hasAttribute("data-target")?e.getAttribute("data-target"):e.getAttribute("href"),r=document.querySelector(n).cloneNode(!0);if(!r)throw new Error("Ups, I can't find the target "+n+".");t.appendChild(r),t.setAttribute("data-type","html"),t.classList.add("tobii-html")},t.onPreload=function(e){},t.onLoad=function(e,t){var i=e.querySelector("video");i&&(i.hasAttribute("data-time")&&i.readyState>0&&(i.currentTime=i.getAttribute("data-time")),this.userSettings.autoplayVideo&&i.play());var n=e.querySelector("audio");n&&this.userSettings.autoplayAudio&&n.play(),e.classList.add("tobii-group-"+t)},t.onLeave=function(e){var t=e.querySelector("video");t&&(t.paused||t.pause(),t.readyState>0&&t.setAttribute("data-time",t.currentTime));var i=e.querySelector("audio");i&&(i.paused||i.pause())},t.onCleanup=function(e){var t=e.querySelector("video");if(t&&t.readyState>0&&t.readyState<3&&t.duration!==t.currentTime){var i=t.cloneNode(!0);this._removeSources(t),t.load(),t.parentNode.removeChild(t),e.appendChild(i)}},t.onReset=function(){},t._removeSources=function(e){var t=e.querySelectorAll("src");t&&t.forEach(function(e){e.setAttribute("src","")})},e}(),o=/*#__PURE__*/function(){function e(){this.playerId=0,this.PLAYER=[],this.userSettings=null}var t=e.prototype;return t.init=function(e,t,i){this.userSettings=i;var n=document.createElement("div");t.appendChild(n),this.PLAYER[this.playerId]=new window.YT.Player(n,{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",this.playerId),t.setAttribute("data-type","youtube"),t.classList.add("tobii-youtube"),this.playerId++},t.onPreload=function(e){},t.onLoad=function(e){this.userSettings.autoplayVideo&&this.PLAYER[e.getAttribute("data-player")].playVideo()},t.onLeave=function(e){1===this.PLAYER[e.getAttribute("data-player")].getPlayerState()&&this.PLAYER[e.getAttribute("data-player")].pauseVideo()},t.onCleanup=function(e){1===this.PLAYER[e.getAttribute("data-player")].getPlayerState()&&this.PLAYER[e.getAttribute("data-player")].pauseVideo()},t.onReset=function(){},e}();function a(e){var s={image:new i,html:new r,iframe:new n,youtube:new o},d=['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])'],l={},u=[],c={gallery:[],slider:null,sliderElements:[],elementsLength:0,currentIndex:0,x:0},p=null,b=null,h=null,f=null,m=null,g={},v=!1,y=!1,w=!1,A=null,E=null,L=null,x=!1,_=!1,S={},I=null,C=null,T=function(e){if(null===document.querySelector('[data-type="youtube"]')||_)q(e);else{if(null===document.getElementById("iframe_api")){var t=document.createElement("script"),i=document.getElementsByTagName("script")[0];t.id="iframe_api",t.src="https://www.youtube.com/iframe_api",i.parentNode.insertBefore(t,i)}-1===u.indexOf(e)&&u.push(e),window.onYouTubePlayerAPIReady=function(){u.forEach(function(e){q(e)}),_=!0}}},P=function(e){return e.hasAttribute("data-group")?e.getAttribute("data-group"):"default"},q=function(e){if(I=P(e),Object.prototype.hasOwnProperty.call(S,I)||(S[I]=JSON.parse(JSON.stringify(c)),Y()),-1!==S[I].gallery.indexOf(e))throw new Error("Ups, element already added.");if(S[I].gallery.push(e),S[I].elementsLength++,l.zoom&&e.querySelector("img")&&"false"!==e.getAttribute("data-zoom")||"true"===e.getAttribute("data-zoom")){var t=document.createElement("div");t.className="tobii-zoom__icon",t.innerHTML=l.zoomText,e.classList.add("tobii-zoom"),e.appendChild(t)}e.addEventListener("click",J),O(e),ce()&&I===C&&(de(),le())},N=function(e){var t=P(e);if(-1===S[t].gallery.indexOf(e))throw new Error("Ups, I can't find a slide for the element "+e+".");var i=S[t].gallery.indexOf(e),n=S[t].sliderElements[i];if(ce()&&t===C&&i===S[t].currentIndex){if(1===S[t].elementsLength)throw X(),new Error("Ups, I've closed. There are no slides more to show.");0===S[t].currentIndex?H():R(),de(),le()}if(S[t].gallery.splice(S[t].gallery.indexOf(e)),S[t].sliderElements.splice(S[t].gallery.indexOf(e)),S[t].elementsLength--,--S[t].x,l.zoom&&e.querySelector(".tobii-zoom__icon")){var r=e.querySelector(".tobii-zoom__icon");r.parentNode.classList.remove("tobii-zoom"),r.parentNode.removeChild(r)}e.removeEventListener("click",J),n.parentNode.removeChild(n)},Y=function(){S[I].slider=document.createElement("div"),S[I].slider.className="tobii__slider",S[I].slider.setAttribute("aria-hidden","true"),p.appendChild(S[I].slider)},O=function(e){var t=k(e),i=document.createElement("div"),n=document.createElement("div");i.className="tobii__slide",i.style.position="absolute",i.style.left=100*S[I].x+"%",i.setAttribute("aria-hidden","true"),t.init(e,n,l),i.appendChild(n),S[I].slider.appendChild(i),S[I].sliderElements.push(i),++S[I].x},k=function(e){var t=e.getAttribute("data-type");return void 0!==s[t]?s[t]:(e.hasAttribute("data-type")&&console.log("Unknown lightbox element type: "+t),s.image)},U=function(e){if(C=null!==C?C:I,ce())throw new Error("Ups, I'm aleady open.");if(!ce()&&(e||(e=0),-1===e||e>=S[C].elementsLength))throw new Error("Ups, I can't find slide "+e+".");document.documentElement.classList.add("tobii-is-open"),document.body.classList.add("tobii-is-open"),document.body.classList.add("tobii-is-open-"+C),de(),l.close||(f.disabled=!1,f.setAttribute("aria-hidden","true")),A=document.activeElement;var t=window.location.href;window.history.pushState({tobii:"close"},"Image",t),S[C].currentIndex=e,W(),ae(),M(S[C].currentIndex),S[C].slider.setAttribute("aria-hidden","false"),p.setAttribute("aria-hidden","false"),le(),z(S[C].currentIndex+1),z(S[C].currentIndex-1),S[C].slider.classList.add("tobii__slider--animate");var i=new window.CustomEvent("open",{detail:{group:C}});p.dispatchEvent(i)},X=function(){if(!ce())throw new Error("Ups, I'm already closed.");document.documentElement.classList.remove("tobii-is-open"),document.body.classList.remove("tobii-is-open"),document.body.classList.remove("tobii-is-open-"+C),se(),null!==window.history.state&&"close"===window.history.state.tobii&&window.history.back(),A.focus(),B(S[C].currentIndex),V(S[C].currentIndex),p.setAttribute("aria-hidden","true"),S[C].slider.setAttribute("aria-hidden","true"),S[C].currentIndex=0,S[C].slider.classList.remove("tobii__slider--animate");var e=new window.CustomEvent("close",{detail:{group:C}});p.dispatchEvent(e)},z=function(e){if(void 0!==S[C].sliderElements[e]){var t=S[C].sliderElements[e].querySelector("[data-type]");k(t).onPreload(t)}},M=function(e){if(void 0!==S[C].sliderElements[e]){var t=S[C].sliderElements[e].querySelector("[data-type]"),i=k(t);S[C].sliderElements[e].classList.add("tobii__slide--is-active"),S[C].sliderElements[e].setAttribute("aria-hidden","false"),i.onLoad(t,C)}},R=function(){if(!ce())throw new Error("Ups, I'm closed.");S[C].currentIndex>0&&(B(S[C].currentIndex),M(--S[C].currentIndex),le("left"),V(S[C].currentIndex+1),z(S[C].currentIndex-1));var e=new window.CustomEvent("previous",{detail:{group:C}});p.dispatchEvent(e)},H=function(){if(!ce())throw new Error("Ups, I'm closed.");S[C].currentIndex<S[C].elementsLength-1&&(B(S[C].currentIndex),M(++S[C].currentIndex),le("right"),V(S[C].currentIndex-1),z(S[C].currentIndex+1));var e=new window.CustomEvent("next",{detail:{group:C}});p.dispatchEvent(e)},D=function(e){if(ce())throw new Error("Ups, I'm open.");if(!e)throw new Error("Ups, no group specified.");if(e&&!Object.prototype.hasOwnProperty.call(S,e))throw new Error("Ups, I don't have a group called \""+e+'".');C=e},B=function(e){if(void 0!==S[C].sliderElements[e]){var t=S[C].sliderElements[e].querySelector("[data-type]"),i=k(t);S[C].sliderElements[e].classList.remove("tobii__slide--is-active"),S[C].sliderElements[e].setAttribute("aria-hidden","true"),i.onLeave(t)}},V=function(e){if(void 0!==S[C].sliderElements[e]){var t=S[C].sliderElements[e].querySelector("[data-type]");k(t).onCleanup(t)}},j=function(){S[C=null!==C?C:I].slider.style.transform="translate3d("+(E=-S[C].currentIndex*p.offsetWidth)+"px, 0, 0)",L=E},W=function(){g={startX:0,endX:0,startY:0,endY:0}},F=function(){var e=g.endX-g.startX,t=g.endY-g.startY,i=Math.abs(e),n=Math.abs(t);e>0&&i>l.threshold&&S[C].currentIndex>0?R():e<0&&i>l.threshold&&S[C].currentIndex!==S[C].elementsLength-1?H():t<0&&n>l.threshold&&l.swipeClose?X():j()},G=function(){x||(x=!0,window.requestAnimationFrame(function(){j(),x=!1}))},J=function(e){e.preventDefault(),C=P(e.currentTarget),U(S[C].gallery.indexOf(e.currentTarget))},K=function(e){e.target===b?R():e.target===h?H():(e.target===f||!1===v&&!1===y&&e.target.classList.contains("tobii__slide")&&l.docClose)&&X(),e.stopPropagation()},Q=function(e){var t=Array.prototype.slice.call(p.querySelectorAll(".tobii__btn:not([disabled]), .tobii__slide--is-active "+d.join(", .tobii__slide--is-active "))).filter(function(e){return!!(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(),X()):37===e.keyCode||"ArrowLeft"===e.code?(e.preventDefault(),R()):39!==e.keyCode&&"ArrowRight"!==e.code||(e.preventDefault(),H())},Z=function(e){be(e.target)||(e.stopPropagation(),v=!1,y=!1,w=!0,g.startX=e.touches[0].pageX,g.startY=e.touches[0].pageY,pe()&&S[C].slider.classList.add("tobii__slider--is-dragging"))},$=function(e){e.stopPropagation(),w&&(g.endX=e.touches[0].pageX,g.endY=e.touches[0].pageY,oe())},ee=function(e){e.stopPropagation(),w=!1,S[C].slider.classList.remove("tobii__slider--is-dragging"),g.endX&&F(),W()},te=function(e){be(e.target)||(e.preventDefault(),e.stopPropagation(),v=!1,y=!1,w=!0,g.startX=e.pageX,g.startY=e.pageY,pe()&&S[C].slider.classList.add("tobii__slider--is-dragging"))},ie=function(e){e.preventDefault(),w&&(g.endX=e.pageX,g.endY=e.pageY,oe())},ne=function(e){e.stopPropagation(),w=!1,S[C].slider.classList.remove("tobii__slider--is-dragging"),g.endX&&F(),W()},re=function(){w=!1},oe=function(){Math.abs(g.startX-g.endX)>0&&!y&&S[C].elementsLength>1?(S[C].slider.style.transform="translate3d("+(L-Math.round(g.startX-g.endX))+"px, 0, 0)",v=!0,y=!1):Math.abs(g.startY-g.endY)>0&&!v&&l.swipeClose&&(S[C].slider.style.transform="translate3d("+L+"px, -"+Math.round(g.startY-g.endY)+"px, 0)",v=!1,y=!0)},ae=function(){l.keyboard&&window.addEventListener("keydown",Q),window.addEventListener("resize",G),window.addEventListener("popstate",X),p.addEventListener("click",K),l.draggable&&pe()&&(p.addEventListener("touchstart",Z),p.addEventListener("touchmove",$),p.addEventListener("touchend",ee),p.addEventListener("mousedown",te),p.addEventListener("mouseup",ne),p.addEventListener("mousemove",ie),p.addEventListener("contextmenu",re))},se=function(){l.keyboard&&window.removeEventListener("keydown",Q),window.removeEventListener("resize",G),window.removeEventListener("popstate",X),p.removeEventListener("click",K),l.draggable&&pe()&&(p.removeEventListener("touchstart",Z),p.removeEventListener("touchmove",$),p.removeEventListener("touchend",ee),p.removeEventListener("mousedown",te),p.removeEventListener("mouseup",ne),p.removeEventListener("mousemove",ie),p.removeEventListener("contextmenu",re))},de=function(){(l.draggable&&l.swipeClose&&pe()&&!S[C].slider.classList.contains("tobii__slider--is-draggable")||l.draggable&&S[C].elementsLength>1&&!S[C].slider.classList.contains("tobii__slider--is-draggable"))&&S[C].slider.classList.add("tobii__slider--is-draggable"),!l.nav||1===S[C].elementsLength||"auto"===l.nav&&pe()?(b.setAttribute("aria-hidden","true"),b.disabled=!0,h.setAttribute("aria-hidden","true"),h.disabled=!0):(b.setAttribute("aria-hidden","false"),b.disabled=!1,h.setAttribute("aria-hidden","false"),h.disabled=!1),m.setAttribute("aria-hidden",l.counter&&1!==S[C].elementsLength?"false":"true")},le=function(e){void 0===e&&(e=null),j(),m.textContent=S[C].currentIndex+1+"/"+S[C].elementsLength,function(e){(!0===l.nav||"auto"===l.nav)&&!pe()&&S[C].elementsLength>1?(b.setAttribute("aria-hidden","true"),b.disabled=!0,h.setAttribute("aria-hidden","true"),h.disabled=!0,1===S[C].elementsLength?l.close&&f.focus():0===S[C].currentIndex?(h.setAttribute("aria-hidden","false"),h.disabled=!1,h.focus()):S[C].currentIndex===S[C].elementsLength-1?(b.setAttribute("aria-hidden","false"),b.disabled=!1,b.focus()):(b.setAttribute("aria-hidden","false"),b.disabled=!1,h.setAttribute("aria-hidden","false"),h.disabled=!1,"left"===e?b.focus():h.focus())):l.close&&f.focus()}(e)},ue=function(){ce()&&X();var e=Object.entries(S);for(var t in e.forEach(function(e){e[1].gallery.forEach(function(e){N(e)})}),S={},I=C=null,s)s[t].onReset()},ce=function(){return"false"===p.getAttribute("aria-hidden")},pe=function(){return"ontouchstart"in window},be=function(e){return-1!==["TEXTAREA","OPTION","INPUT","SELECT"].indexOf(e.nodeName)||e===b||e===h||e===f};return function(e){if(document.querySelector("div.tobii"))console.log("Multiple lightbox instances not supported.");else{l=function(e){return t({},{selector:".lightbox",captions:!0,captionsSelector:"img",captionAttribute:"alt",captionText:null,captionHTML:!1,nav:"auto",navText:['<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path stroke="none" d="M0 0h24v24H0z"/><polyline points="15 6 9 12 15 18" /></svg>','<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path stroke="none" d="M0 0h24v24H0z"/><polyline points="9 6 15 12 9 18" /></svg>'],navLabel:["Previous image","Next image"],close:!0,closeText:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path stroke="none" d="M0 0h24v24H0z"/><line x1="18" y1="6" x2="6" y2="18" /><line x1="6" y1="6" x2="18" y2="18" /></svg>',closeLabel:"Close lightbox",loadingIndicatorLabel:"Image loading",counter:!0,download:!1,downloadText:"",downloadLabel:"Download image",keyboard:!0,zoom:!0,zoomText:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path stroke="none" d="M0 0h24v24H0z"/><polyline points="16 4 20 4 20 8" /><line x1="14" y1="10" x2="20" y2="4" /><polyline points="8 20 4 20 4 16" /><line x1="4" y1="20" x2="10" y2="14" /><polyline points="16 20 20 20 20 16" /><line x1="14" y1="14" x2="20" y2="20" /><polyline points="8 4 4 4 4 8" /><line x1="4" y1="4" x2="10" y2="10" /></svg>',docClose:!0,swipeClose:!0,hideScrollbar:!0,draggable:!0,threshold:100,rtl:!1,loop:!1,autoplayVideo:!1,modal:!1,theme:"tobii--theme-default"},e)}(e),p||((p=document.createElement("div")).setAttribute("role","dialog"),p.setAttribute("aria-hidden","true"),p.classList.add("tobii"),p.classList.add(l.theme),(b=document.createElement("button")).className="tobii__btn tobii__btn--previous",b.setAttribute("type","button"),b.setAttribute("aria-label",l.navLabel[0]),b.innerHTML=l.navText[0],p.appendChild(b),(h=document.createElement("button")).className="tobii__btn tobii__btn--next",h.setAttribute("type","button"),h.setAttribute("aria-label",l.navLabel[1]),h.innerHTML=l.navText[1],p.appendChild(h),(f=document.createElement("button")).className="tobii__btn tobii__btn--close",f.setAttribute("type","button"),f.setAttribute("aria-label",l.closeLabel),f.innerHTML=l.closeText,p.appendChild(f),(m=document.createElement("div")).className="tobii__counter",p.appendChild(m),document.body.appendChild(p));var i=document.querySelectorAll(l.selector);if(!i)throw new Error("Ups, I can't find the selector "+l.selector+" on this website.");var n=[];i.forEach(function(e){var t=e.hasAttribute("data-group")?e.getAttribute("data-group"):"default",i=e.href;e.hasAttribute("data-target")&&(i=e.getAttribute("data-target")),void 0!==n[i+="__"+t]?e.addEventListener("click",function(e){D(t),U(),e.preventDefault()}):(n[i]=1,T(e))})}}(e),a.open=U,a.previous=R,a.next=H,a.close=X,a.add=T,a.remove=N,a.reset=ue,a.destroy=function(){ue(),p.parentNode.removeChild(p)},a.isOpen=ce,a.slidesIndex=function(){return S[C].currentIndex},a.select=function(e){var t=S[C].currentIndex;if(!ce())throw new Error("Ups, I'm closed.");if(ce()){if(!e&&0!==e)throw new Error("Ups, no slide specified.");if(e===S[C].currentIndex)throw new Error("Ups, slide "+e+" is already selected.");if(-1===e||e>=S[C].elementsLength)throw new Error("Ups, I can't find slide "+e+".")}S[C].currentIndex=e,B(t),M(e),e<t&&(le("left"),V(t),z(e-1)),e>t&&(le("right"),V(t),z(e+1))},a.slidesCount=function(){return S[C].elementsLength},a.selectGroup=D,a.currentGroup=function(){return null!==C?C:I},a.on=function(e,t){p.addEventListener(e,t)},a.off=function(e,t){p.removeEventListener(e,t)},a}typeof module<"u"?module.exports=a:self.Tobii=a}();
!function(){if("function"!=typeof window.CustomEvent){var t=function(t,e){e=e||{bubbles:!1,cancelable:!1,detail:void 0};var i=document.createEvent("CustomEvent");return i.initCustomEvent(t,e.bubbles,e.cancelable,e.detail),i};t.prototype=window.Event.prototype,window.CustomEvent=t}function e(){return e=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var n in i)({}).hasOwnProperty.call(i,n)&&(t[n]=i[n])}return t},e.apply(null,arguments)}window.NodeList&&!NodeList.prototype.forEach&&(NodeList.prototype.forEach=function(t,e){e=e||window;for(var i=0;i<this.length;i++)t.call(e,this[i],i,this)});var i=/*#__PURE__*/function(){function t(){this.figcaptionId=0,this.userSettings=null}var e=t.prototype;return e.init=function(t,e,i){this.userSettings=i;var n,r=document.createElement("figure"),a=document.createElement("figcaption"),o=document.createElement("img"),s=t.querySelector("img"),l=document.createElement("div");r.style.opacity="0",s&&(o.alt=s.alt||""),o.setAttribute("src",""),o.setAttribute("data-src",t.href),t.hasAttribute("data-srcset")&&o.setAttribute("data-srcset",t.getAttribute("data-srcset")),r.appendChild(o),this.userSettings.captions&&("function"==typeof this.userSettings.captionText?n=this.userSettings.captionText(t):"self"===this.userSettings.captionsSelector&&t.getAttribute(this.userSettings.captionAttribute)?n=t.getAttribute(this.userSettings.captionAttribute):"img"===this.userSettings.captionsSelector&&s&&s.getAttribute(this.userSettings.captionAttribute)&&(n=s.getAttribute(this.userSettings.captionAttribute)),this.userSettings.captionHTML?a.innerHTML=n:a.textContent=n,n&&(a.id="tobii-figcaption-"+this.figcaptionId,r.appendChild(a),o.setAttribute("aria-labelledby",a.id),++this.figcaptionId)),e.appendChild(r),l.className="tobii__loader",l.setAttribute("role","progressbar"),l.setAttribute("aria-label",this.userSettings.loadingIndicatorLabel),e.appendChild(l),e.setAttribute("data-type","image"),e.classList.add("tobii-image")},e.onPreload=function(t){this.onLoad(t)},e.onLoad=function(t){var e=t.querySelector("img");if(e.hasAttribute("data-src")){var i=t.querySelector("figure"),n=t.querySelector(".tobii__loader");e.addEventListener("load",function(){t.removeChild(n),i.style.opacity="1"}),e.addEventListener("error",function(){t.removeChild(n),i.style.opacity="1"}),e.setAttribute("src",e.getAttribute("data-src")),e.removeAttribute("data-src"),e.hasAttribute("data-srcset")&&e.setAttribute("srcset",e.getAttribute("data-srcset"))}},e.onLeave=function(t){},e.onCleanup=function(t){},e.onReset=function(){this.figcaptionId=0},t}(),n=/*#__PURE__*/function(){function t(){this.userSettings=null}var e=t.prototype;return e.init=function(t,e,i){this.userSettings=i;var n=t.hasAttribute("data-target")?t.getAttribute("data-target"):t.getAttribute("href");e.setAttribute("data-HREF",n),t.getAttribute("data-allow")&&e.setAttribute("data-allow",t.getAttribute("data-allow")),t.hasAttribute("data-width")&&e.setAttribute("data-width",""+t.getAttribute("data-width")),t.hasAttribute("data-height")&&e.setAttribute("data-height",""+t.getAttribute("data-height")),e.setAttribute("data-type","iframe"),e.classList.add("tobii-iframe")},e.onPreload=function(t){},e.onLoad=function(t){var e=t.querySelector("iframe"),i=document.createElement("div");if(i.className="tobii__loader",i.setAttribute("role","progressbar"),i.setAttribute("aria-label",this.userSettings.loadingIndicatorLabel),t.appendChild(i),null==e){e=document.createElement("iframe");var n=t.getAttribute("data-href");e.setAttribute("frameborder","0"),e.setAttribute("src",n),e.setAttribute("allowfullscreen",""),n.indexOf("youtube.com")>-1?e.setAttribute("allow","accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"):n.indexOf("vimeo.com")>-1?e.setAttribute("allow","autoplay; picture-in-picture"):t.hasAttribute("data-allow")&&e.setAttribute("allow",t.getAttribute("data-allow")),t.getAttribute("data-width")&&(e.style.maxWidth=""+t.getAttribute("data-width")),t.getAttribute("data-height")&&(e.style.maxHeight=""+t.getAttribute("data-height")),e.style.opacity="0",t.appendChild(e),e.addEventListener("load",function(){e.style.opacity="1";var i=t.querySelector(".tobii__loader");i&&t.removeChild(i)}),e.addEventListener("error",function(){e.style.opacity="1";var i=t.querySelector(".tobii__loader");i&&t.removeChild(i)})}else e.setAttribute("src",t.getAttribute("data-href"))},e.onLeave=function(t){},e.onCleanup=function(t){var e=t.querySelector("iframe");e.setAttribute("src",""),e.style.opacity="0"},e.onReset=function(){},t}(),r=/*#__PURE__*/function(){function t(){this.userSettings=null}var e=t.prototype;return e.init=function(t,e,i){this.userSettings=i;var n=t.hasAttribute("data-target")?t.getAttribute("data-target"):t.getAttribute("href"),r=document.querySelector(n).cloneNode(!0);if(!r)throw new Error("Ups, I can't find the target "+n+".");e.appendChild(r),e.setAttribute("data-type","html"),e.classList.add("tobii-html")},e.onPreload=function(t){},e.onLoad=function(t,e){var i=t.querySelector("video");i&&(i.hasAttribute("data-time")&&i.readyState>0&&(i.currentTime=i.getAttribute("data-time")),this.userSettings.autoplayVideo&&i.play());var n=t.querySelector("audio");n&&this.userSettings.autoplayAudio&&n.play(),t.classList.add("tobii-group-"+e)},e.onLeave=function(t){var e=t.querySelector("video");e&&(e.paused||e.pause(),e.readyState>0&&e.setAttribute("data-time",e.currentTime));var i=t.querySelector("audio");i&&(i.paused||i.pause())},e.onCleanup=function(t){var e=t.querySelector("video");if(e&&e.readyState>0&&e.readyState<3&&e.duration!==e.currentTime){var i=e.cloneNode(!0);this._removeSources(e),e.load(),e.parentNode.removeChild(e),t.appendChild(i)}},e.onReset=function(){},e._removeSources=function(t){var e=t.querySelectorAll("src");e&&e.forEach(function(t){t.setAttribute("src","")})},t}(),a=/*#__PURE__*/function(){function t(){this.playerId=0,this.PLAYER=[],this.userSettings=null}var e=t.prototype;return e.init=function(t,e,i){this.userSettings=i;var n=document.createElement("div");e.appendChild(n),this.PLAYER[this.playerId]=new window.YT.Player(n,{host:"https://www.youtube-nocookie.com",height:t.getAttribute("data-height")||"360",width:t.getAttribute("data-width")||"640",videoId:t.getAttribute("data-id"),playerVars:{controls:t.getAttribute("data-controls")||1,rel:0,playsinline:1}}),e.setAttribute("data-player",this.playerId),e.setAttribute("data-type","youtube"),e.classList.add("tobii-youtube"),this.playerId++},e.onPreload=function(t){},e.onLoad=function(t){this.userSettings.autoplayVideo&&this.PLAYER[t.getAttribute("data-player")].playVideo()},e.onLeave=function(t){1===this.PLAYER[t.getAttribute("data-player")].getPlayerState()&&this.PLAYER[t.getAttribute("data-player")].pauseVideo()},e.onCleanup=function(t){1===this.PLAYER[t.getAttribute("data-player")].getPlayerState()&&this.PLAYER[t.getAttribute("data-player")].pauseVideo()},e.onReset=function(){},t}();function o(t){var s={image:new i,html:new r,iframe:new n,youtube:new a},l=['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])'],d={},u=[],c={gallery:[],slider:null,sliderElements:[],elementsLength:0,currentIndex:0,x:0},p=null,f=null,b=null,h=null,g=null,m=null,v=null,y=!1,w={},A=null,x=[],E=0,L={element:null,originX:0,originY:0,translateX:0,translateY:0,scale:1},_={startX:0,startY:0,x:0,y:0,distance:0},I=function(t){if(null===document.querySelector('[data-type="youtube"]')||y)C(t);else{if(null===document.getElementById("iframe_api")){var e=document.createElement("script"),i=document.getElementsByTagName("script")[0];e.id="iframe_api",e.src="https://www.youtube.com/iframe_api",i.parentNode.insertBefore(e,i)}-1===u.indexOf(t)&&u.push(t),window.onYouTubePlayerAPIReady=function(){u.forEach(function(t){C(t)}),y=!0}}},S=function(t){return t.hasAttribute("data-group")?t.getAttribute("data-group"):"default"},C=function(t){var e=S(t);if(Object.prototype.hasOwnProperty.call(w,e)||(w[e]=JSON.parse(JSON.stringify(c)),w[e].slider=document.createElement("div"),w[e].slider.className="tobii__slider",w[e].slider.setAttribute("aria-hidden","true"),p.appendChild(w[e].slider)),-1!==w[e].gallery.indexOf(t))throw new Error("Ups, element already added.");if(w[e].gallery.push(t),w[e].elementsLength++,d.zoom&&t.querySelector("img")&&"false"!==t.getAttribute("data-zoom")||"true"===t.getAttribute("data-zoom")){var i=document.createElement("div");i.className="tobii-zoom__icon",i.innerHTML=d.zoomText,t.classList.add("tobii-zoom"),t.appendChild(i)}t.addEventListener("click",D);var n=T(t),r=document.createElement("div"),a=document.createElement("div");r.className="tobii__slide",r.style.position="absolute",r.style.left=100*w[e].x+"%",r.setAttribute("aria-hidden","true"),n.init(t,a,d),r.appendChild(a),w[e].slider.appendChild(r),w[e].sliderElements.push(r),++w[e].x,dt()&&e===A&&(ot(),st())},Y=function(t){var e=S(t);if(-1===w[e].gallery.indexOf(t))throw new Error("Ups, I can't find a slide for the element "+t+".");var i=w[e].gallery.indexOf(t),n=w[e].sliderElements[i];if(dt()&&e===A&&i===w[e].currentIndex){if(1===w[e].elementsLength)throw N(),new Error("Ups, I've closed. There are no slides more to show.");0===w[e].currentIndex?O():M(),ot(),st()}if(w[e].gallery.splice(w[e].gallery.indexOf(t)),w[e].sliderElements.splice(w[e].gallery.indexOf(t)),w[e].elementsLength--,--w[e].x,d.zoom&&t.querySelector(".tobii-zoom__icon")){var r=t.querySelector(".tobii-zoom__icon");r.parentNode.classList.remove("tobii-zoom"),r.parentNode.removeChild(r)}t.removeEventListener("click",D),n.parentNode.removeChild(n)},T=function(t){var e=t.getAttribute("data-type");return void 0!==s[e]?s[e]:(t.hasAttribute("data-type")&&console.log("Unknown lightbox element type: "+e),s.image)},X=function(t){if(void 0===t&&(t=0),dt())throw new Error("Ups, I'm aleady open.");if(-1===t||t>=w[A].elementsLength)throw new Error("Ups, I can't find slide "+t+".");document.documentElement.classList.add("tobii-is-open"),document.body.classList.add("tobii-is-open"),document.body.classList.add("tobii-is-open-"+A),ot(),d.close||(h.disabled=!1,h.setAttribute("aria-hidden","true")),m=document.activeElement;var e=window.location.href;window.history.pushState({tobii:"close"},"Image",e),w[A].currentIndex=t,rt(),P(w[A].currentIndex),w[A].slider.setAttribute("aria-hidden","false"),p.setAttribute("aria-hidden","false"),st(),q(w[A].currentIndex+1),q(w[A].currentIndex-1),w[A].slider.classList.add("tobii__slider--animate");var i=new window.CustomEvent("open",{detail:{group:A}});p.dispatchEvent(i)},N=function(){if(!dt())throw new Error("Ups, I'm already closed.");document.documentElement.classList.remove("tobii-is-open"),document.body.classList.remove("tobii-is-open"),document.body.classList.remove("tobii-is-open-"+A),at(),null!==window.history.state&&"close"===window.history.state.tobii&&window.history.back(),m.focus(),R(w[A].currentIndex),U(w[A].currentIndex),p.setAttribute("aria-hidden","true"),w[A].slider.setAttribute("aria-hidden","true"),w[A].currentIndex=0,w[A].slider.classList.remove("tobii__slider--animate");var t=new window.CustomEvent("close",{detail:{group:A}});p.dispatchEvent(t)},q=function(t){if(void 0!==w[A].sliderElements[t]){var e=w[A].sliderElements[t].querySelector("[data-type]");T(e).onPreload(e)}},P=function(t){if(void 0!==w[A].sliderElements[t]){var e=w[A].sliderElements[t].querySelector("[data-type]"),i=T(e);w[A].sliderElements[t].classList.add("tobii__slide--is-active"),w[A].sliderElements[t].setAttribute("aria-hidden","false"),i.onLoad(e,A)}},M=function(){if(!dt())throw new Error("Ups, I'm closed.");w[A].currentIndex>0&&(R(w[A].currentIndex),P(--w[A].currentIndex),st("left"),U(w[A].currentIndex+1),q(w[A].currentIndex-1));var t=new window.CustomEvent("previous",{detail:{group:A}});p.dispatchEvent(t)},O=function(){if(!dt())throw new Error("Ups, I'm closed.");w[A].currentIndex<w[A].elementsLength-1&&(R(w[A].currentIndex),P(++w[A].currentIndex),st("right"),U(w[A].currentIndex-1),q(w[A].currentIndex+1));var t=new window.CustomEvent("next",{detail:{group:A}});p.dispatchEvent(t)},k=function(t){if(dt())throw new Error("Ups, I'm open.");if(!t)throw new Error("Ups, no group specified.");if(t&&!Object.prototype.hasOwnProperty.call(w,t))throw new Error("Ups, I don't have a group called \""+t+'".');A=t},R=function(t){if(void 0!==w[A].sliderElements[t]){var e=w[A].sliderElements[t].querySelector("[data-type]"),i=T(e);w[A].sliderElements[t].classList.remove("tobii__slide--is-active"),w[A].sliderElements[t].setAttribute("aria-hidden","true"),i.onLeave(e)}},U=function(t){if(void 0!==w[A].sliderElements[t]){var e=w[A].sliderElements[t].querySelector("[data-type]");T(e).onCleanup(e),_.startX=0,_.startY=0,_.x=0,_.y=0,_.distance=0,E=0,Z()&&nt()}},z=function(){w[A].slider.style.transform="translate("+(v=-w[A].currentIndex*p.offsetWidth)+"px, 0)"},H=function(){z()},D=function(t){t.preventDefault(),A=S(t.currentTarget),X(w[A].gallery.indexOf(t.currentTarget))},B=function(t){t.target===f?M():t.target===b?O():(t.target===h||t.target.classList.contains("tobii__slide")&&d.docClose)&&N(),t.stopPropagation()},V=function(t){var e=Array.prototype.slice.call(p.querySelectorAll(".tobii__btn:not([disabled]), .tobii__slide--is-active "+l.join(", .tobii__slide--is-active "))).filter(function(t){return!!(t.offsetWidth||t.offsetHeight||t.getClientRects().length)}),i=e.indexOf(document.activeElement);9===t.keyCode||"Tab"===t.code?t.shiftKey&&0===i?(e[e.length-1].focus(),t.preventDefault()):t.shiftKey||i!==e.length-1||(e[0].focus(),t.preventDefault()):27===t.keyCode||"Escape"===t.code?(t.preventDefault(),N()):37===t.keyCode||"ArrowLeft"===t.code?(t.preventDefault(),M()):39!==t.keyCode&&"ArrowRight"!==t.code||(t.preventDefault(),O())},j=function(){x=[],z(),w[A].slider.classList.remove("tobii__slider--is-"+(Z()?"moving":"dragging"))},W=function(t){if(!ct(t.target)&&(t.preventDefault(),t.stopPropagation(),_.startX=_.x=t.pageX,_.startY=_.y=t.pageY,_.distance=0,x.push(t),2===x.length)){var e=it(x[0].pageX,x[0].pageY,x[1].pageX,x[1].pageY),i=e.y;_.startX=_.x=e.x,_.startY=_.y=i,_.distance=et(x[0].pageX-x[1].pageX,x[0].pageY-x[1].pageY)/L.scale}},G=function(t){if(x.length){w[A].slider.classList.add("tobii__slider--is-"+(Z()?"moving":"dragging"));var e=x.findIndex(function(e){return e.pointerId===t.pointerId});if(x[e]=t,2===x.length){var i=it(x[0].pageX,x[0].pageY,x[1].pageX,x[1].pageY),n=i.x,r=i.y,a=et(x[0].pageX-x[1].pageX,x[0].pageY-x[1].pageY)/_.distance;return tt(Q(a,1,4),n,r,n-_.x,r-_.y),_.x=n,void(_.y=r)}if(Z()&&$(t.pageX-_.x,t.pageY-_.y),_.x=t.pageX,_.y=t.pageY,!Z()){var o=_.startX-_.x,s=_.startY-_.y;if(et(o,s)<10)return;Math.abs(o)>Math.abs(s)&&w[A].elementsLength>1?w[A].slider.style.transform="translate("+(v-Math.round(o))+"px, 0)":d.swipeClose&&(w[A].slider.style.transform="translate("+v+"px, -"+Math.round(s)+"px)")}}},J=function(t){t.stopPropagation(),w[A].slider.classList.remove("tobii__slider--is-"+(Z()?"moving":"dragging"));var e=x.findIndex(function(e){return e.pointerId===t.pointerId});x.splice(e,1);var i=_.startX-_.x,n=_.startY-_.y,r=Math.abs(i),a=Math.abs(n);if(r||a)Z()||(i<0&&r>d.threshold&&w[A].currentIndex>0?M():i>0&&r>d.threshold&&w[A].currentIndex!==w[A].elementsLength-1?O():n>0&&a>d.threshold&&d.swipeClose?N():z());else{var o=(new Date).getTime(),s=o-E;s<500&&s>100?(t.preventDefault(),E=0,Z()?nt():tt(2,t.clientX,t.clientY,0,0)):(E=o,ut()&&window.setTimeout(function(){var e=t.target.getBoundingClientRect(),i=e.left,n=e.right,r=e.width;_.startY<e.top||_.startY>e.bottom||!E||(_.startX>i&&_.startX<i+r/2?M():_.startX<n&&_.startX>n-r/2&&O())},500))}},K=function(t){var e=Math.sign(t.deltaY)>0?-1:1;(Z()||e)&&(t.preventDefault(),tt(Q(L.scale+e/(10/L.scale),1,4),t.pageX,t.pageY,0,0))},F=function(t,e){var i=L.element,n=L.scale,r="x"===t,a=r?L.originX:L.originY,o=r?"offsetWidth":"offsetHeight",s=i.parentNode[o],l=i[o],d=i.getBoundingClientRect(),u=(a-l/2)*(n-1),c=Math.max(0,Math.round(r?d.width:d.height)-s),p=Math.round(c/2);return Q(e,0-p+u,p+u)},Q=function(t,e,i){return Math.max(Math.min(t,i),e)},Z=function(){return 1!==L.scale},$=function(t,e){0!==t&&(L.translateX=F("x",L.translateX+t)),0!==e&&(L.translateY=F("y",L.translateY+e));var i=L.element,n=L.translateX,r=L.translateY,a=L.scale;i.style.transformOrigin=L.originX+"px "+L.originY+"px",i.style.transform="translate("+n+"px, "+r+"px) scale("+a+")"},tt=function(t,e,i,n,r){L.element||(L.element=p.querySelector(".tobii__slide--is-active img"));var a=L.element.getBoundingClientRect(),o=(i-a.top)/L.scale;L.originX=(e-a.left)/L.scale,L.originY=o,L.scale=t,$(n,r)},et=function(t,e){return Math.hypot(t,e)},it=function(t,e,i,n){return{x:(t+i)/2,y:(e+n)/2}},nt=function(){L.scale=1,L.originX=0,L.originY=0,L.translateX=0,L.translateY=0,$(0,0),L.element=null},rt=function(){d.keyboard&&window.addEventListener("keydown",V),window.addEventListener("resize",H),window.addEventListener("popstate",N),pt("click",B),d.draggable&&(pt("pointerdown",W),pt("pointermove",G),pt("pointerup",J),pt("pointercancel",j),pt("pointerout",j),pt("pointerleave",j),pt("contextmenu",j)),pt("wheel",K)},at=function(){d.keyboard&&window.removeEventListener("keydown",V),window.removeEventListener("resize",H),window.removeEventListener("popstate",N),ft("click",B),d.draggable&&(ft("pointerdown",W),ft("pointermove",G),ft("pointerup",J),ft("pointercancel",j),ft("pointerout",j),ft("pointerleave",j),ft("contextmenu",j)),ft("wheel",K)},ot=function(){d.draggable&&!w[A].slider.classList.contains("tobii__slider--is-draggable")&&w[A].slider.classList.add("tobii__slider--is-draggable"),!d.nav||1===w[A].elementsLength||"auto"===d.nav&&ut()?(f.setAttribute("aria-hidden","true"),f.disabled=!0,b.setAttribute("aria-hidden","true"),b.disabled=!0):(f.setAttribute("aria-hidden","false"),f.disabled=!1,b.setAttribute("aria-hidden","false"),b.disabled=!1),g.setAttribute("aria-hidden",d.counter&&1!==w[A].elementsLength?"false":"true")},st=function(t){void 0===t&&(t=null),z(),g.textContent=w[A].currentIndex+1+"/"+w[A].elementsLength,function(t){(!0===d.nav||"auto"===d.nav)&&!ut()&&w[A].elementsLength>1?(f.setAttribute("aria-hidden","true"),f.disabled=!0,b.setAttribute("aria-hidden","true"),b.disabled=!0,1===w[A].elementsLength?d.close&&h.focus():0===w[A].currentIndex?(b.setAttribute("aria-hidden","false"),b.disabled=!1,b.focus()):w[A].currentIndex===w[A].elementsLength-1?(f.setAttribute("aria-hidden","false"),f.disabled=!1,f.focus()):(f.setAttribute("aria-hidden","false"),f.disabled=!1,b.setAttribute("aria-hidden","false"),b.disabled=!1,"left"===t?f.focus():b.focus())):d.close&&h.focus()}(t)},lt=function(){dt()&&N();var t=Object.entries(w);for(var e in t.forEach(function(t){t[1].gallery.forEach(function(t){Y(t)})}),w={},A=null,s)s[e].onReset()},dt=function(){return"false"===p.getAttribute("aria-hidden")},ut=function(){return"ontouchstart"in window},ct=function(t){return-1!==["TEXTAREA","OPTION","INPUT","SELECT"].indexOf(t.nodeName)||t===f||t===b||t===h},pt=function(t,e){p.addEventListener(t,e)},ft=function(t,e){p.removeEventListener(t,e)};return function(t){if(document.querySelector("div.tobii"))console.log("Multiple lightbox instances not supported.");else{d=function(t){return e({},{selector:".lightbox",captions:!0,captionsSelector:"img",captionAttribute:"alt",captionText:null,captionHTML:!1,nav:"auto",navText:['<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path stroke="none" d="M0 0h24v24H0z"/><polyline points="15 6 9 12 15 18" /></svg>','<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path stroke="none" d="M0 0h24v24H0z"/><polyline points="9 6 15 12 9 18" /></svg>'],navLabel:["Previous image","Next image"],close:!0,closeText:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path stroke="none" d="M0 0h24v24H0z"/><line x1="18" y1="6" x2="6" y2="18" /><line x1="6" y1="6" x2="18" y2="18" /></svg>',closeLabel:"Close lightbox",loadingIndicatorLabel:"Image loading",counter:!0,download:!1,downloadText:"",downloadLabel:"Download image",keyboard:!0,zoom:!0,zoomText:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path stroke="none" d="M0 0h24v24H0z"/><polyline points="16 4 20 4 20 8" /><line x1="14" y1="10" x2="20" y2="4" /><polyline points="8 20 4 20 4 16" /><line x1="4" y1="20" x2="10" y2="14" /><polyline points="16 20 20 20 20 16" /><line x1="14" y1="14" x2="20" y2="20" /><polyline points="8 4 4 4 4 8" /><line x1="4" y1="4" x2="10" y2="10" /></svg>',docClose:!0,swipeClose:!0,hideScrollbar:!0,draggable:!0,threshold:100,rtl:!1,loop:!1,autoplayVideo:!1,modal:!1,theme:"tobii--theme-default"},t)}(t),p||((p=document.createElement("div")).setAttribute("role","dialog"),p.setAttribute("aria-hidden","true"),p.classList.add("tobii"),p.classList.add(d.theme),(f=document.createElement("button")).className="tobii__btn tobii__btn--previous",f.setAttribute("type","button"),f.setAttribute("aria-label",d.navLabel[0]),f.innerHTML=d.navText[0],p.appendChild(f),(b=document.createElement("button")).className="tobii__btn tobii__btn--next",b.setAttribute("type","button"),b.setAttribute("aria-label",d.navLabel[1]),b.innerHTML=d.navText[1],p.appendChild(b),(h=document.createElement("button")).className="tobii__btn tobii__btn--close",h.setAttribute("type","button"),h.setAttribute("aria-label",d.closeLabel),h.innerHTML=d.closeText,p.appendChild(h),(g=document.createElement("div")).className="tobii__counter",p.appendChild(g),document.body.appendChild(p));var i=document.querySelectorAll(d.selector);if(!i)throw new Error("Ups, I can't find the selector "+d.selector+" on this website.");var n=[];i.forEach(function(t){var e=t.hasAttribute("data-group")?t.getAttribute("data-group"):"default",i=t.href;t.hasAttribute("data-target")&&(i=t.getAttribute("data-target")),void 0!==n[i+="__"+e]?t.addEventListener("click",function(t){k(e),X(),t.preventDefault()}):(n[i]=1,I(t))})}}(t),o.open=X,o.previous=M,o.next=O,o.close=N,o.add=I,o.remove=Y,o.reset=lt,o.destroy=function(){lt(),p.parentNode.removeChild(p)},o.isOpen=dt,o.slidesIndex=function(){return w[A].currentIndex},o.select=function(t){var e=w[A].currentIndex;if(!dt())throw new Error("Ups, I'm closed.");if(dt()){if(!t&&0!==t)throw new Error("Ups, no slide specified.");if(t===w[A].currentIndex)throw new Error("Ups, slide "+t+" is already selected.");if(-1===t||t>=w[A].elementsLength)throw new Error("Ups, I can't find slide "+t+".")}w[A].currentIndex=t,R(e),P(t),t<e&&(st("left"),U(e),q(t-1)),t>e&&(st("right"),U(e),q(t+1))},o.slidesCount=function(){return w[A].elementsLength},o.selectGroup=k,o.currentGroup=function(){return A},o.on=pt,o.off=ft,o}typeof module<"u"?module.exports=o:self.Tobii=o}();

@@ -1,1 +0,1 @@

function e(){return e=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e},e.apply(this,arguments)}class t{constructor(){this.figcaptionId=0,this.userSettings=null}init(e,t,i){this.userSettings=i;const r=document.createElement("figure"),n=document.createElement("figcaption"),a=document.createElement("img"),s=e.querySelector("img"),o=document.createElement("div");if(r.style.opacity="0",s&&(a.alt=s.alt||""),a.setAttribute("src",""),a.setAttribute("data-src",e.href),e.hasAttribute("data-srcset")&&a.setAttribute("data-srcset",e.getAttribute("data-srcset")),r.appendChild(a),this.userSettings.captions){let t;"function"==typeof this.userSettings.captionText?t=this.userSettings.captionText(e):"self"===this.userSettings.captionsSelector&&e.getAttribute(this.userSettings.captionAttribute)?t=e.getAttribute(this.userSettings.captionAttribute):"img"===this.userSettings.captionsSelector&&s&&s.getAttribute(this.userSettings.captionAttribute)&&(t=s.getAttribute(this.userSettings.captionAttribute)),this.userSettings.captionHTML?n.innerHTML=t:n.textContent=t,t&&(n.id=`tobii-figcaption-${this.figcaptionId}`,r.appendChild(n),a.setAttribute("aria-labelledby",n.id),++this.figcaptionId)}t.appendChild(r),o.className="tobii__loader",o.setAttribute("role","progressbar"),o.setAttribute("aria-label",this.userSettings.loadingIndicatorLabel),t.appendChild(o),t.setAttribute("data-type","image"),t.classList.add("tobii-image")}onPreload(e){this.onLoad(e)}onLoad(e){const t=e.querySelector("img");if(!t.hasAttribute("data-src"))return;const i=e.querySelector("figure"),r=e.querySelector(".tobii__loader");t.addEventListener("load",()=>{e.removeChild(r),i.style.opacity="1"}),t.addEventListener("error",()=>{e.removeChild(r),i.style.opacity="1"}),t.setAttribute("src",t.getAttribute("data-src")),t.removeAttribute("data-src"),t.hasAttribute("data-srcset")&&t.setAttribute("srcset",t.getAttribute("data-srcset"))}onLeave(e){}onCleanup(e){}onReset(){this.figcaptionId=0}}class i{constructor(){this.userSettings=null}init(e,t,i){this.userSettings=i;const r=e.hasAttribute("data-target")?e.getAttribute("data-target"):e.getAttribute("href");t.setAttribute("data-HREF",r),e.getAttribute("data-allow")&&t.setAttribute("data-allow",e.getAttribute("data-allow")),e.hasAttribute("data-width")&&t.setAttribute("data-width",`${e.getAttribute("data-width")}`),e.hasAttribute("data-height")&&t.setAttribute("data-height",`${e.getAttribute("data-height")}`),t.setAttribute("data-type","iframe"),t.classList.add("tobii-iframe")}onPreload(e){}onLoad(e){let t=e.querySelector("iframe");const i=document.createElement("div");if(i.className="tobii__loader",i.setAttribute("role","progressbar"),i.setAttribute("aria-label",this.userSettings.loadingIndicatorLabel),e.appendChild(i),null==t){t=document.createElement("iframe");const i=e.getAttribute("data-href");t.setAttribute("frameborder","0"),t.setAttribute("src",i),t.setAttribute("allowfullscreen",""),i.indexOf("youtube.com")>-1?t.setAttribute("allow","accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"):i.indexOf("vimeo.com")>-1?t.setAttribute("allow","autoplay; picture-in-picture"):e.hasAttribute("data-allow")&&t.setAttribute("allow",e.getAttribute("data-allow")),e.getAttribute("data-width")&&(t.style.maxWidth=`${e.getAttribute("data-width")}`),e.getAttribute("data-height")&&(t.style.maxHeight=`${e.getAttribute("data-height")}`),t.style.opacity="0",e.appendChild(t),t.addEventListener("load",()=>{t.style.opacity="1";const i=e.querySelector(".tobii__loader");i&&e.removeChild(i)}),t.addEventListener("error",()=>{t.style.opacity="1";const i=e.querySelector(".tobii__loader");i&&e.removeChild(i)})}else t.setAttribute("src",e.getAttribute("data-href"))}onLeave(e){}onCleanup(e){const t=e.querySelector("iframe");t.setAttribute("src",""),t.style.opacity="0"}onReset(){}}class r{constructor(){this.userSettings=null}init(e,t,i){this.userSettings=i;const r=e.hasAttribute("data-target")?e.getAttribute("data-target"):e.getAttribute("href"),n=document.querySelector(r).cloneNode(!0);if(!n)throw new Error(`Ups, I can't find the target ${r}.`);t.appendChild(n),t.setAttribute("data-type","html"),t.classList.add("tobii-html")}onPreload(e){}onLoad(e,t){const i=e.querySelector("video");i&&(i.hasAttribute("data-time")&&i.readyState>0&&(i.currentTime=i.getAttribute("data-time")),this.userSettings.autoplayVideo&&i.play());const r=e.querySelector("audio");r&&this.userSettings.autoplayAudio&&r.play(),e.classList.add("tobii-group-"+t)}onLeave(e){const t=e.querySelector("video");t&&(t.paused||t.pause(),t.readyState>0&&t.setAttribute("data-time",t.currentTime));const i=e.querySelector("audio");i&&(i.paused||i.pause())}onCleanup(e){const t=e.querySelector("video");if(t&&t.readyState>0&&t.readyState<3&&t.duration!==t.currentTime){const i=t.cloneNode(!0);this._removeSources(t),t.load(),t.parentNode.removeChild(t),e.appendChild(i)}}onReset(){}_removeSources(e){const t=e.querySelectorAll("src");t&&t.forEach(e=>{e.setAttribute("src","")})}}class n{constructor(){this.playerId=0,this.PLAYER=[],this.userSettings=null}init(e,t,i){this.userSettings=i;const r=document.createElement("div");t.appendChild(r),this.PLAYER[this.playerId]=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",this.playerId),t.setAttribute("data-type","youtube"),t.classList.add("tobii-youtube"),this.playerId++}onPreload(e){}onLoad(e){this.userSettings.autoplayVideo&&this.PLAYER[e.getAttribute("data-player")].playVideo()}onLeave(e){1===this.PLAYER[e.getAttribute("data-player")].getPlayerState()&&this.PLAYER[e.getAttribute("data-player")].pauseVideo()}onCleanup(e){1===this.PLAYER[e.getAttribute("data-player")].getPlayerState()&&this.PLAYER[e.getAttribute("data-player")].pauseVideo()}onReset(){}}function a(s){const o={image:new t,html:new r,iframe:new i,youtube:new n},d=['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])'];let l={};const u=[],c={gallery:[],slider:null,sliderElements:[],elementsLength:0,currentIndex:0,x:0};let p=null,b=null,h=null,g=null,m=null,y={},v=!1,f=!1,w=!1,A=null,E=null,L=null,x=!1,_=!1,S={},I=null,C=null;const T=e=>{if(null===document.querySelector('[data-type="youtube"]')||_)q(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===u.indexOf(e)&&u.push(e),window.onYouTubePlayerAPIReady=()=>{u.forEach(e=>{q(e)}),_=!0}}},P=e=>e.hasAttribute("data-group")?e.getAttribute("data-group"):"default",q=e=>{if(I=P(e),Object.prototype.hasOwnProperty.call(S,I)||(S[I]=JSON.parse(JSON.stringify(c)),N()),-1!==S[I].gallery.indexOf(e))throw new Error("Ups, element already added.");if(S[I].gallery.push(e),S[I].elementsLength++,l.zoom&&e.querySelector("img")&&"false"!==e.getAttribute("data-zoom")||"true"===e.getAttribute("data-zoom")){const t=document.createElement("div");t.className="tobii-zoom__icon",t.innerHTML=l.zoomText,e.classList.add("tobii-zoom"),e.appendChild(t)}e.addEventListener("click",G),O(e),ce()&&I===C&&(de(),le())},Y=e=>{const t=P(e);if(-1===S[t].gallery.indexOf(e))throw new Error(`Ups, I can't find a slide for the element ${e}.`);{const i=S[t].gallery.indexOf(e),r=S[t].sliderElements[i];if(ce()&&t===C&&i===S[t].currentIndex){if(1===S[t].elementsLength)throw X(),new Error("Ups, I've closed. There are no slides more to show.");0===S[t].currentIndex?R():M(),de(),le()}if(S[t].gallery.splice(S[t].gallery.indexOf(e)),S[t].sliderElements.splice(S[t].gallery.indexOf(e)),S[t].elementsLength--,--S[t].x,l.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",G),r.parentNode.removeChild(r)}},N=()=>{S[I].slider=document.createElement("div"),S[I].slider.className="tobii__slider",S[I].slider.setAttribute("aria-hidden","true"),p.appendChild(S[I].slider)},O=e=>{const t=k(e),i=document.createElement("div"),r=document.createElement("div");i.className="tobii__slide",i.style.position="absolute",i.style.left=100*S[I].x+"%",i.setAttribute("aria-hidden","true"),t.init(e,r,l),i.appendChild(r),S[I].slider.appendChild(i),S[I].sliderElements.push(i),++S[I].x},k=e=>{const t=e.getAttribute("data-type");return void 0!==o[t]?o[t]:(e.hasAttribute("data-type")&&console.log("Unknown lightbox element type: "+t),o.image)},U=e=>{if(C=null!==C?C:I,ce())throw new Error("Ups, I'm aleady open.");if(!ce()&&(e||(e=0),-1===e||e>=S[C].elementsLength))throw new Error(`Ups, I can't find slide ${e}.`);document.documentElement.classList.add("tobii-is-open"),document.body.classList.add("tobii-is-open"),document.body.classList.add("tobii-is-open-"+C),de(),l.close||(g.disabled=!1,g.setAttribute("aria-hidden","true")),A=document.activeElement;const t=window.location.href;window.history.pushState({tobii:"close"},"Image",t),S[C].currentIndex=e,j(),se(),z(S[C].currentIndex),S[C].slider.setAttribute("aria-hidden","false"),p.setAttribute("aria-hidden","false"),le(),$(S[C].currentIndex+1),$(S[C].currentIndex-1),S[C].slider.classList.add("tobii__slider--animate");const i=new window.CustomEvent("open",{detail:{group:C}});p.dispatchEvent(i)},X=()=>{if(!ce())throw new Error("Ups, I'm already closed.");document.documentElement.classList.remove("tobii-is-open"),document.body.classList.remove("tobii-is-open"),document.body.classList.remove("tobii-is-open-"+C),oe(),null!==window.history.state&&"close"===window.history.state.tobii&&window.history.back(),A.focus(),D(S[C].currentIndex),B(S[C].currentIndex),p.setAttribute("aria-hidden","true"),S[C].slider.setAttribute("aria-hidden","true"),S[C].currentIndex=0,S[C].slider.classList.remove("tobii__slider--animate");const e=new window.CustomEvent("close",{detail:{group:C}});p.dispatchEvent(e)},$=e=>{if(void 0===S[C].sliderElements[e])return;const t=S[C].sliderElements[e].querySelector("[data-type]");k(t).onPreload(t)},z=e=>{if(void 0===S[C].sliderElements[e])return;const t=S[C].sliderElements[e].querySelector("[data-type]"),i=k(t);S[C].sliderElements[e].classList.add("tobii__slide--is-active"),S[C].sliderElements[e].setAttribute("aria-hidden","false"),i.onLoad(t,C)},M=()=>{if(!ce())throw new Error("Ups, I'm closed.");S[C].currentIndex>0&&(D(S[C].currentIndex),z(--S[C].currentIndex),le("left"),B(S[C].currentIndex+1),$(S[C].currentIndex-1));const e=new window.CustomEvent("previous",{detail:{group:C}});p.dispatchEvent(e)},R=()=>{if(!ce())throw new Error("Ups, I'm closed.");S[C].currentIndex<S[C].elementsLength-1&&(D(S[C].currentIndex),z(++S[C].currentIndex),le("right"),B(S[C].currentIndex-1),$(S[C].currentIndex+1));const e=new window.CustomEvent("next",{detail:{group:C}});p.dispatchEvent(e)},H=e=>{if(ce())throw new Error("Ups, I'm open.");if(!e)throw new Error("Ups, no group specified.");if(e&&!Object.prototype.hasOwnProperty.call(S,e))throw new Error(`Ups, I don't have a group called "${e}".`);C=e},D=e=>{if(void 0===S[C].sliderElements[e])return;const t=S[C].sliderElements[e].querySelector("[data-type]"),i=k(t);S[C].sliderElements[e].classList.remove("tobii__slide--is-active"),S[C].sliderElements[e].setAttribute("aria-hidden","true"),i.onLeave(t)},B=e=>{if(void 0===S[C].sliderElements[e])return;const t=S[C].sliderElements[e].querySelector("[data-type]");k(t).onCleanup(t)},V=()=>{C=null!==C?C:I,E=-S[C].currentIndex*p.offsetWidth,S[C].slider.style.transform=`translate3d(${E}px, 0, 0)`,L=E},j=()=>{y={startX:0,endX:0,startY:0,endY:0}},W=()=>{const e=y.endX-y.startX,t=y.endY-y.startY,i=Math.abs(e),r=Math.abs(t);e>0&&i>l.threshold&&S[C].currentIndex>0?M():e<0&&i>l.threshold&&S[C].currentIndex!==S[C].elementsLength-1?R():t<0&&r>l.threshold&&l.swipeClose?X():V()},F=()=>{x||(x=!0,window.requestAnimationFrame(()=>{V(),x=!1}))},G=e=>{e.preventDefault(),C=P(e.currentTarget),U(S[C].gallery.indexOf(e.currentTarget))},J=e=>{e.target===b?M():e.target===h?R():(e.target===g||!1===v&&!1===f&&e.target.classList.contains("tobii__slide")&&l.docClose)&&X(),e.stopPropagation()},K=e=>{const t=Array.prototype.slice.call(p.querySelectorAll(`.tobii__btn:not([disabled]), .tobii__slide--is-active ${d.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(),X()):37===e.keyCode||"ArrowLeft"===e.code?(e.preventDefault(),M()):39!==e.keyCode&&"ArrowRight"!==e.code||(e.preventDefault(),R())},Q=e=>{be(e.target)||(e.stopPropagation(),v=!1,f=!1,w=!0,y.startX=e.touches[0].pageX,y.startY=e.touches[0].pageY,pe()&&S[C].slider.classList.add("tobii__slider--is-dragging"))},Z=e=>{e.stopPropagation(),w&&(y.endX=e.touches[0].pageX,y.endY=e.touches[0].pageY,ae())},ee=e=>{e.stopPropagation(),w=!1,S[C].slider.classList.remove("tobii__slider--is-dragging"),y.endX&&W(),j()},te=e=>{be(e.target)||(e.preventDefault(),e.stopPropagation(),v=!1,f=!1,w=!0,y.startX=e.pageX,y.startY=e.pageY,pe()&&S[C].slider.classList.add("tobii__slider--is-dragging"))},ie=e=>{e.preventDefault(),w&&(y.endX=e.pageX,y.endY=e.pageY,ae())},re=e=>{e.stopPropagation(),w=!1,S[C].slider.classList.remove("tobii__slider--is-dragging"),y.endX&&W(),j()},ne=()=>{w=!1},ae=()=>{Math.abs(y.startX-y.endX)>0&&!f&&S[C].elementsLength>1?(S[C].slider.style.transform=`translate3d(${L-Math.round(y.startX-y.endX)}px, 0, 0)`,v=!0,f=!1):Math.abs(y.startY-y.endY)>0&&!v&&l.swipeClose&&(S[C].slider.style.transform=`translate3d(${L}px, -${Math.round(y.startY-y.endY)}px, 0)`,v=!1,f=!0)},se=()=>{l.keyboard&&window.addEventListener("keydown",K),window.addEventListener("resize",F),window.addEventListener("popstate",X),p.addEventListener("click",J),l.draggable&&pe()&&(p.addEventListener("touchstart",Q),p.addEventListener("touchmove",Z),p.addEventListener("touchend",ee),p.addEventListener("mousedown",te),p.addEventListener("mouseup",re),p.addEventListener("mousemove",ie),p.addEventListener("contextmenu",ne))},oe=()=>{l.keyboard&&window.removeEventListener("keydown",K),window.removeEventListener("resize",F),window.removeEventListener("popstate",X),p.removeEventListener("click",J),l.draggable&&pe()&&(p.removeEventListener("touchstart",Q),p.removeEventListener("touchmove",Z),p.removeEventListener("touchend",ee),p.removeEventListener("mousedown",te),p.removeEventListener("mouseup",re),p.removeEventListener("mousemove",ie),p.removeEventListener("contextmenu",ne))},de=()=>{(l.draggable&&l.swipeClose&&pe()&&!S[C].slider.classList.contains("tobii__slider--is-draggable")||l.draggable&&S[C].elementsLength>1&&!S[C].slider.classList.contains("tobii__slider--is-draggable"))&&S[C].slider.classList.add("tobii__slider--is-draggable"),!l.nav||1===S[C].elementsLength||"auto"===l.nav&&pe()?(b.setAttribute("aria-hidden","true"),b.disabled=!0,h.setAttribute("aria-hidden","true"),h.disabled=!0):(b.setAttribute("aria-hidden","false"),b.disabled=!1,h.setAttribute("aria-hidden","false"),h.disabled=!1),m.setAttribute("aria-hidden",l.counter&&1!==S[C].elementsLength?"false":"true")},le=(e=null)=>{V(),m.textContent=`${S[C].currentIndex+1}/${S[C].elementsLength}`,(e=>{(!0===l.nav||"auto"===l.nav)&&!pe()&&S[C].elementsLength>1?(b.setAttribute("aria-hidden","true"),b.disabled=!0,h.setAttribute("aria-hidden","true"),h.disabled=!0,1===S[C].elementsLength?l.close&&g.focus():0===S[C].currentIndex?(h.setAttribute("aria-hidden","false"),h.disabled=!1,h.focus()):S[C].currentIndex===S[C].elementsLength-1?(b.setAttribute("aria-hidden","false"),b.disabled=!1,b.focus()):(b.setAttribute("aria-hidden","false"),b.disabled=!1,h.setAttribute("aria-hidden","false"),h.disabled=!1,"left"===e?b.focus():h.focus())):l.close&&g.focus()})(e)},ue=()=>{ce()&&X(),Object.entries(S).forEach(e=>{e[1].gallery.forEach(e=>{Y(e)})}),S={},I=C=null;for(const e in o)o[e].onReset()},ce=()=>"false"===p.getAttribute("aria-hidden"),pe=()=>"ontouchstart"in window,be=e=>-1!==["TEXTAREA","OPTION","INPUT","SELECT"].indexOf(e.nodeName)||e===b||e===h||e===g;return(t=>{if(document.querySelector("div.tobii"))return void console.log("Multiple lightbox instances not supported.");l=(t=>e({},{selector:".lightbox",captions:!0,captionsSelector:"img",captionAttribute:"alt",captionText:null,captionHTML:!1,nav:"auto",navText:['<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path stroke="none" d="M0 0h24v24H0z"/><polyline points="15 6 9 12 15 18" /></svg>','<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path stroke="none" d="M0 0h24v24H0z"/><polyline points="9 6 15 12 9 18" /></svg>'],navLabel:["Previous image","Next image"],close:!0,closeText:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path stroke="none" d="M0 0h24v24H0z"/><line x1="18" y1="6" x2="6" y2="18" /><line x1="6" y1="6" x2="18" y2="18" /></svg>',closeLabel:"Close lightbox",loadingIndicatorLabel:"Image loading",counter:!0,download:!1,downloadText:"",downloadLabel:"Download image",keyboard:!0,zoom:!0,zoomText:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path stroke="none" d="M0 0h24v24H0z"/><polyline points="16 4 20 4 20 8" /><line x1="14" y1="10" x2="20" y2="4" /><polyline points="8 20 4 20 4 16" /><line x1="4" y1="20" x2="10" y2="14" /><polyline points="16 20 20 20 20 16" /><line x1="14" y1="14" x2="20" y2="20" /><polyline points="8 4 4 4 4 8" /><line x1="4" y1="4" x2="10" y2="10" /></svg>',docClose:!0,swipeClose:!0,hideScrollbar:!0,draggable:!0,threshold:100,rtl:!1,loop:!1,autoplayVideo:!1,modal:!1,theme:"tobii--theme-default"},t))(t),p||(p=document.createElement("div"),p.setAttribute("role","dialog"),p.setAttribute("aria-hidden","true"),p.classList.add("tobii"),p.classList.add(l.theme),b=document.createElement("button"),b.className="tobii__btn tobii__btn--previous",b.setAttribute("type","button"),b.setAttribute("aria-label",l.navLabel[0]),b.innerHTML=l.navText[0],p.appendChild(b),h=document.createElement("button"),h.className="tobii__btn tobii__btn--next",h.setAttribute("type","button"),h.setAttribute("aria-label",l.navLabel[1]),h.innerHTML=l.navText[1],p.appendChild(h),g=document.createElement("button"),g.className="tobii__btn tobii__btn--close",g.setAttribute("type","button"),g.setAttribute("aria-label",l.closeLabel),g.innerHTML=l.closeText,p.appendChild(g),m=document.createElement("div"),m.className="tobii__counter",p.appendChild(m),document.body.appendChild(p));const i=document.querySelectorAll(l.selector);if(!i)throw new Error(`Ups, I can't find the selector ${l.selector} on this website.`);const r=[];i.forEach(e=>{const t=e.hasAttribute("data-group")?e.getAttribute("data-group"):"default";let i=e.href;e.hasAttribute("data-target")&&(i=e.getAttribute("data-target")),i+="__"+t,void 0!==r[i]?e.addEventListener("click",e=>{H(t),U(),e.preventDefault()}):(r[i]=1,T(e))})})(s),a.open=U,a.previous=M,a.next=R,a.close=X,a.add=T,a.remove=Y,a.reset=ue,a.destroy=()=>{ue(),p.parentNode.removeChild(p)},a.isOpen=ce,a.slidesIndex=()=>S[C].currentIndex,a.select=e=>{const t=S[C].currentIndex;if(!ce())throw new Error("Ups, I'm closed.");if(ce()){if(!e&&0!==e)throw new Error("Ups, no slide specified.");if(e===S[C].currentIndex)throw new Error(`Ups, slide ${e} is already selected.`);if(-1===e||e>=S[C].elementsLength)throw new Error(`Ups, I can't find slide ${e}.`)}S[C].currentIndex=e,D(t),z(e),e<t&&(le("left"),B(t),$(e-1)),e>t&&(le("right"),B(t),$(e+1))},a.slidesCount=()=>S[C].elementsLength,a.selectGroup=H,a.currentGroup=()=>null!==C?C:I,a.on=(e,t)=>{p.addEventListener(e,t)},a.off=(e,t)=>{p.removeEventListener(e,t)},a}export{a as default};
function e(){return e=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var r in i)({}).hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e},e.apply(null,arguments)}class t{constructor(){this.figcaptionId=0,this.userSettings=null}init(e,t,i){this.userSettings=i;const r=document.createElement("figure"),n=document.createElement("figcaption"),a=document.createElement("img"),s=e.querySelector("img"),o=document.createElement("div");if(r.style.opacity="0",s&&(a.alt=s.alt||""),a.setAttribute("src",""),a.setAttribute("data-src",e.href),e.hasAttribute("data-srcset")&&a.setAttribute("data-srcset",e.getAttribute("data-srcset")),r.appendChild(a),this.userSettings.captions){let t;"function"==typeof this.userSettings.captionText?t=this.userSettings.captionText(e):"self"===this.userSettings.captionsSelector&&e.getAttribute(this.userSettings.captionAttribute)?t=e.getAttribute(this.userSettings.captionAttribute):"img"===this.userSettings.captionsSelector&&s&&s.getAttribute(this.userSettings.captionAttribute)&&(t=s.getAttribute(this.userSettings.captionAttribute)),this.userSettings.captionHTML?n.innerHTML=t:n.textContent=t,t&&(n.id=`tobii-figcaption-${this.figcaptionId}`,r.appendChild(n),a.setAttribute("aria-labelledby",n.id),++this.figcaptionId)}t.appendChild(r),o.className="tobii__loader",o.setAttribute("role","progressbar"),o.setAttribute("aria-label",this.userSettings.loadingIndicatorLabel),t.appendChild(o),t.setAttribute("data-type","image"),t.classList.add("tobii-image")}onPreload(e){this.onLoad(e)}onLoad(e){const t=e.querySelector("img");if(!t.hasAttribute("data-src"))return;const i=e.querySelector("figure"),r=e.querySelector(".tobii__loader");t.addEventListener("load",()=>{e.removeChild(r),i.style.opacity="1"}),t.addEventListener("error",()=>{e.removeChild(r),i.style.opacity="1"}),t.setAttribute("src",t.getAttribute("data-src")),t.removeAttribute("data-src"),t.hasAttribute("data-srcset")&&t.setAttribute("srcset",t.getAttribute("data-srcset"))}onLeave(e){}onCleanup(e){}onReset(){this.figcaptionId=0}}class i{constructor(){this.userSettings=null}init(e,t,i){this.userSettings=i;const r=e.hasAttribute("data-target")?e.getAttribute("data-target"):e.getAttribute("href");t.setAttribute("data-HREF",r),e.getAttribute("data-allow")&&t.setAttribute("data-allow",e.getAttribute("data-allow")),e.hasAttribute("data-width")&&t.setAttribute("data-width",`${e.getAttribute("data-width")}`),e.hasAttribute("data-height")&&t.setAttribute("data-height",`${e.getAttribute("data-height")}`),t.setAttribute("data-type","iframe"),t.classList.add("tobii-iframe")}onPreload(e){}onLoad(e){let t=e.querySelector("iframe");const i=document.createElement("div");if(i.className="tobii__loader",i.setAttribute("role","progressbar"),i.setAttribute("aria-label",this.userSettings.loadingIndicatorLabel),e.appendChild(i),null==t){t=document.createElement("iframe");const i=e.getAttribute("data-href");t.setAttribute("frameborder","0"),t.setAttribute("src",i),t.setAttribute("allowfullscreen",""),i.indexOf("youtube.com")>-1?t.setAttribute("allow","accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"):i.indexOf("vimeo.com")>-1?t.setAttribute("allow","autoplay; picture-in-picture"):e.hasAttribute("data-allow")&&t.setAttribute("allow",e.getAttribute("data-allow")),e.getAttribute("data-width")&&(t.style.maxWidth=`${e.getAttribute("data-width")}`),e.getAttribute("data-height")&&(t.style.maxHeight=`${e.getAttribute("data-height")}`),t.style.opacity="0",e.appendChild(t),t.addEventListener("load",()=>{t.style.opacity="1";const i=e.querySelector(".tobii__loader");i&&e.removeChild(i)}),t.addEventListener("error",()=>{t.style.opacity="1";const i=e.querySelector(".tobii__loader");i&&e.removeChild(i)})}else t.setAttribute("src",e.getAttribute("data-href"))}onLeave(e){}onCleanup(e){const t=e.querySelector("iframe");t.setAttribute("src",""),t.style.opacity="0"}onReset(){}}class r{constructor(){this.userSettings=null}init(e,t,i){this.userSettings=i;const r=e.hasAttribute("data-target")?e.getAttribute("data-target"):e.getAttribute("href"),n=document.querySelector(r).cloneNode(!0);if(!n)throw new Error(`Ups, I can't find the target ${r}.`);t.appendChild(n),t.setAttribute("data-type","html"),t.classList.add("tobii-html")}onPreload(e){}onLoad(e,t){const i=e.querySelector("video");i&&(i.hasAttribute("data-time")&&i.readyState>0&&(i.currentTime=i.getAttribute("data-time")),this.userSettings.autoplayVideo&&i.play());const r=e.querySelector("audio");r&&this.userSettings.autoplayAudio&&r.play(),e.classList.add("tobii-group-"+t)}onLeave(e){const t=e.querySelector("video");t&&(t.paused||t.pause(),t.readyState>0&&t.setAttribute("data-time",t.currentTime));const i=e.querySelector("audio");i&&(i.paused||i.pause())}onCleanup(e){const t=e.querySelector("video");if(t&&t.readyState>0&&t.readyState<3&&t.duration!==t.currentTime){const i=t.cloneNode(!0);this._removeSources(t),t.load(),t.parentNode.removeChild(t),e.appendChild(i)}}onReset(){}_removeSources(e){const t=e.querySelectorAll("src");t&&t.forEach(e=>{e.setAttribute("src","")})}}class n{constructor(){this.playerId=0,this.PLAYER=[],this.userSettings=null}init(e,t,i){this.userSettings=i;const r=document.createElement("div");t.appendChild(r),this.PLAYER[this.playerId]=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",this.playerId),t.setAttribute("data-type","youtube"),t.classList.add("tobii-youtube"),this.playerId++}onPreload(e){}onLoad(e){this.userSettings.autoplayVideo&&this.PLAYER[e.getAttribute("data-player")].playVideo()}onLeave(e){1===this.PLAYER[e.getAttribute("data-player")].getPlayerState()&&this.PLAYER[e.getAttribute("data-player")].pauseVideo()}onCleanup(e){1===this.PLAYER[e.getAttribute("data-player")].getPlayerState()&&this.PLAYER[e.getAttribute("data-player")].pauseVideo()}onReset(){}}function a(s){const o={image:new t,html:new r,iframe:new i,youtube:new n},l=['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])'];let d={};const c=[],u={gallery:[],slider:null,sliderElements:[],elementsLength:0,currentIndex:0,x:0};let p=null,h=null,b=null,g=null,m=null,y=null,f=null,w=!1,v={},A=null,x=[],E=0;const L={element:null,originX:0,originY:0,translateX:0,translateY:0,scale:1},_={startX:0,startY:0,x:0,y:0,distance:0},I=e=>{if(null===document.querySelector('[data-type="youtube"]')||w)C(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===c.indexOf(e)&&c.push(e),window.onYouTubePlayerAPIReady=()=>{c.forEach(e=>{C(e)}),w=!0}}},S=e=>e.hasAttribute("data-group")?e.getAttribute("data-group"):"default",C=e=>{const t=S(e);if(Object.prototype.hasOwnProperty.call(v,t)||(v[t]=JSON.parse(JSON.stringify(u)),v[t].slider=document.createElement("div"),v[t].slider.className="tobii__slider",v[t].slider.setAttribute("aria-hidden","true"),p.appendChild(v[t].slider)),-1!==v[t].gallery.indexOf(e))throw new Error("Ups, element already added.");{if(v[t].gallery.push(e),v[t].elementsLength++,d.zoom&&e.querySelector("img")&&"false"!==e.getAttribute("data-zoom")||"true"===e.getAttribute("data-zoom")){const t=document.createElement("div");t.className="tobii-zoom__icon",t.innerHTML=d.zoomText,e.classList.add("tobii-zoom"),e.appendChild(t)}e.addEventListener("click",H);const i=T(e),r=document.createElement("div"),n=document.createElement("div");r.className="tobii__slide",r.style.position="absolute",r.style.left=100*v[t].x+"%",r.setAttribute("aria-hidden","true"),i.init(e,n,d),r.appendChild(n),v[t].slider.appendChild(r),v[t].sliderElements.push(r),++v[t].x,de()&&t===A&&(se(),oe())}},Y=e=>{const t=S(e);if(-1===v[t].gallery.indexOf(e))throw new Error(`Ups, I can't find a slide for the element ${e}.`);{const i=v[t].gallery.indexOf(e),r=v[t].sliderElements[i];if(de()&&t===A&&i===v[t].currentIndex){if(1===v[t].elementsLength)throw q(),new Error("Ups, I've closed. There are no slides more to show.");0===v[t].currentIndex?O():N(),se(),oe()}if(v[t].gallery.splice(v[t].gallery.indexOf(e)),v[t].sliderElements.splice(v[t].gallery.indexOf(e)),v[t].elementsLength--,--v[t].x,d.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",H),r.parentNode.removeChild(r)}},T=e=>{const t=e.getAttribute("data-type");return void 0!==o[t]?o[t]:(e.hasAttribute("data-type")&&console.log("Unknown lightbox element type: "+t),o.image)},X=(e=0)=>{if(de())throw new Error("Ups, I'm aleady open.");if(-1===e||e>=v[A].elementsLength)throw new Error(`Ups, I can't find slide ${e}.`);document.documentElement.classList.add("tobii-is-open"),document.body.classList.add("tobii-is-open"),document.body.classList.add("tobii-is-open-"+A),se(),d.close||(g.disabled=!1,g.setAttribute("aria-hidden","true")),y=document.activeElement;const t=window.location.href;window.history.pushState({tobii:"close"},"Image",t),v[A].currentIndex=e,ne(),M(v[A].currentIndex),v[A].slider.setAttribute("aria-hidden","false"),p.setAttribute("aria-hidden","false"),oe(),P(v[A].currentIndex+1),P(v[A].currentIndex-1),v[A].slider.classList.add("tobii__slider--animate");const i=new window.CustomEvent("open",{detail:{group:A}});p.dispatchEvent(i)},q=()=>{if(!de())throw new Error("Ups, I'm already closed.");document.documentElement.classList.remove("tobii-is-open"),document.body.classList.remove("tobii-is-open"),document.body.classList.remove("tobii-is-open-"+A),ae(),null!==window.history.state&&"close"===window.history.state.tobii&&window.history.back(),y.focus(),k(v[A].currentIndex),R(v[A].currentIndex),p.setAttribute("aria-hidden","true"),v[A].slider.setAttribute("aria-hidden","true"),v[A].currentIndex=0,v[A].slider.classList.remove("tobii__slider--animate");const e=new window.CustomEvent("close",{detail:{group:A}});p.dispatchEvent(e)},P=e=>{if(void 0===v[A].sliderElements[e])return;const t=v[A].sliderElements[e].querySelector("[data-type]");T(t).onPreload(t)},M=e=>{if(void 0===v[A].sliderElements[e])return;const t=v[A].sliderElements[e].querySelector("[data-type]"),i=T(t);v[A].sliderElements[e].classList.add("tobii__slide--is-active"),v[A].sliderElements[e].setAttribute("aria-hidden","false"),i.onLoad(t,A)},N=()=>{if(!de())throw new Error("Ups, I'm closed.");v[A].currentIndex>0&&(k(v[A].currentIndex),M(--v[A].currentIndex),oe("left"),R(v[A].currentIndex+1),P(v[A].currentIndex-1));const e=new window.CustomEvent("previous",{detail:{group:A}});p.dispatchEvent(e)},O=()=>{if(!de())throw new Error("Ups, I'm closed.");v[A].currentIndex<v[A].elementsLength-1&&(k(v[A].currentIndex),M(++v[A].currentIndex),oe("right"),R(v[A].currentIndex-1),P(v[A].currentIndex+1));const e=new window.CustomEvent("next",{detail:{group:A}});p.dispatchEvent(e)},$=e=>{if(de())throw new Error("Ups, I'm open.");if(!e)throw new Error("Ups, no group specified.");if(e&&!Object.prototype.hasOwnProperty.call(v,e))throw new Error(`Ups, I don't have a group called "${e}".`);A=e},k=e=>{if(void 0===v[A].sliderElements[e])return;const t=v[A].sliderElements[e].querySelector("[data-type]"),i=T(t);v[A].sliderElements[e].classList.remove("tobii__slide--is-active"),v[A].sliderElements[e].setAttribute("aria-hidden","true"),i.onLeave(t)},R=e=>{if(void 0===v[A].sliderElements[e])return;const t=v[A].sliderElements[e].querySelector("[data-type]");T(t).onCleanup(t),_.startX=0,_.startY=0,_.x=0,_.y=0,_.distance=0,E=0,Q()&&re()},U=()=>{f=-v[A].currentIndex*p.offsetWidth,v[A].slider.style.transform=`translate(${f}px, 0)`},z=()=>{U()},H=e=>{e.preventDefault(),A=S(e.currentTarget),X(v[A].gallery.indexOf(e.currentTarget))},D=e=>{e.target===h?N():e.target===b?O():(e.target===g||e.target.classList.contains("tobii__slide")&&d.docClose)&&q(),e.stopPropagation()},B=e=>{const t=Array.prototype.slice.call(p.querySelectorAll(`.tobii__btn:not([disabled]), .tobii__slide--is-active ${l.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(),q()):37===e.keyCode||"ArrowLeft"===e.code?(e.preventDefault(),N()):39!==e.keyCode&&"ArrowRight"!==e.code||(e.preventDefault(),O())},V=()=>{x=[],U(),v[A].slider.classList.remove("tobii__slider--is-"+(Q()?"moving":"dragging"))},j=e=>{if(!ue(e.target)&&(e.preventDefault(),e.stopPropagation(),_.startX=_.x=e.pageX,_.startY=_.y=e.pageY,_.distance=0,x.push(e),2===x.length)){const{x:e,y:t}=ie(x[0].pageX,x[0].pageY,x[1].pageX,x[1].pageY);_.startX=_.x=e,_.startY=_.y=t,_.distance=te(x[0].pageX-x[1].pageX,x[0].pageY-x[1].pageY)/L.scale}},W=e=>{if(!x.length)return;v[A].slider.classList.add("tobii__slider--is-"+(Q()?"moving":"dragging"));const t=x.findIndex(t=>t.pointerId===e.pointerId);if(x[t]=e,2===x.length){const{x:e,y:t}=ie(x[0].pageX,x[0].pageY,x[1].pageX,x[1].pageY),i=te(x[0].pageX-x[1].pageX,x[0].pageY-x[1].pageY)/_.distance;return ee(F(i,1,4),e,t,e-_.x,t-_.y),_.x=e,void(_.y=t)}if(Q()&&Z(e.pageX-_.x,e.pageY-_.y),_.x=e.pageX,_.y=e.pageY,!Q()){const e=_.startX-_.x,t=_.startY-_.y;if(te(e,t)<10)return;Math.abs(e)>Math.abs(t)&&v[A].elementsLength>1?v[A].slider.style.transform=`translate(${f-Math.round(e)}px, 0)`:d.swipeClose&&(v[A].slider.style.transform=`translate(${f}px, -${Math.round(t)}px)`)}},G=e=>{e.stopPropagation(),v[A].slider.classList.remove("tobii__slider--is-"+(Q()?"moving":"dragging"));const t=x.findIndex(t=>t.pointerId===e.pointerId);x.splice(t,1);const i=_.startX-_.x,r=_.startY-_.y,n=Math.abs(i),a=Math.abs(r);if(n||a)Q()||(i<0&&n>d.threshold&&v[A].currentIndex>0?N():i>0&&n>d.threshold&&v[A].currentIndex!==v[A].elementsLength-1?O():r>0&&a>d.threshold&&d.swipeClose?q():U());else{const t=(new Date).getTime(),i=t-E;i<500&&i>100?(e.preventDefault(),E=0,Q()?re():ee(2,e.clientX,e.clientY,0,0)):(E=t,ce()&&window.setTimeout(()=>{const{left:t,top:i,bottom:r,right:n,width:a}=e.target.getBoundingClientRect();_.startY<i||_.startY>r||!E||(_.startX>t&&_.startX<t+a/2?N():_.startX<n&&_.startX>n-a/2&&O())},500))}},J=e=>{const t=Math.sign(e.deltaY)>0?-1:1;(Q()||t)&&(e.preventDefault(),ee(F(L.scale+t/(10/L.scale),1,4),e.pageX,e.pageY,0,0))},K=(e,t)=>{const{element:i,scale:r,originX:n,originY:a}=L,s="x"===e,o=s?n:a,l=s?"offsetWidth":"offsetHeight",d=i.parentNode[l],c=i[l],u=i.getBoundingClientRect(),p=(o-c/2)*(r-1),h=Math.max(0,Math.round(s?u.width:u.height)-d),b=Math.round(h/2);return F(t,0-b+p,b+p)},F=(e,t,i)=>Math.max(Math.min(e,i),t),Q=()=>1!==L.scale,Z=(e,t)=>{0!==e&&(L.translateX=K("x",L.translateX+e)),0!==t&&(L.translateY=K("y",L.translateY+t));const{element:i,originX:r,originY:n,translateX:a,translateY:s,scale:o}=L;i.style.transformOrigin=`${r}px ${n}px`,i.style.transform=`translate(${a}px, ${s}px) scale(${o})`},ee=(e,t,i,r,n)=>{L.element||(L.element=p.querySelector(".tobii__slide--is-active img"));const{left:a,top:s}=L.element.getBoundingClientRect(),o=(i-s)/L.scale;L.originX=(t-a)/L.scale,L.originY=o,L.scale=e,Z(r,n)},te=(e,t)=>Math.hypot(e,t),ie=(e,t,i,r)=>({x:(e+i)/2,y:(t+r)/2}),re=()=>{L.scale=1,L.originX=0,L.originY=0,L.translateX=0,L.translateY=0,Z(0,0),L.element=null},ne=()=>{d.keyboard&&window.addEventListener("keydown",B),window.addEventListener("resize",z),window.addEventListener("popstate",q),pe("click",D),d.draggable&&(pe("pointerdown",j),pe("pointermove",W),pe("pointerup",G),pe("pointercancel",V),pe("pointerout",V),pe("pointerleave",V),pe("contextmenu",V)),pe("wheel",J)},ae=()=>{d.keyboard&&window.removeEventListener("keydown",B),window.removeEventListener("resize",z),window.removeEventListener("popstate",q),he("click",D),d.draggable&&(he("pointerdown",j),he("pointermove",W),he("pointerup",G),he("pointercancel",V),he("pointerout",V),he("pointerleave",V),he("contextmenu",V)),he("wheel",J)},se=()=>{d.draggable&&!v[A].slider.classList.contains("tobii__slider--is-draggable")&&v[A].slider.classList.add("tobii__slider--is-draggable"),!d.nav||1===v[A].elementsLength||"auto"===d.nav&&ce()?(h.setAttribute("aria-hidden","true"),h.disabled=!0,b.setAttribute("aria-hidden","true"),b.disabled=!0):(h.setAttribute("aria-hidden","false"),h.disabled=!1,b.setAttribute("aria-hidden","false"),b.disabled=!1),m.setAttribute("aria-hidden",d.counter&&1!==v[A].elementsLength?"false":"true")},oe=(e=null)=>{U(),m.textContent=`${v[A].currentIndex+1}/${v[A].elementsLength}`,(e=>{(!0===d.nav||"auto"===d.nav)&&!ce()&&v[A].elementsLength>1?(h.setAttribute("aria-hidden","true"),h.disabled=!0,b.setAttribute("aria-hidden","true"),b.disabled=!0,1===v[A].elementsLength?d.close&&g.focus():0===v[A].currentIndex?(b.setAttribute("aria-hidden","false"),b.disabled=!1,b.focus()):v[A].currentIndex===v[A].elementsLength-1?(h.setAttribute("aria-hidden","false"),h.disabled=!1,h.focus()):(h.setAttribute("aria-hidden","false"),h.disabled=!1,b.setAttribute("aria-hidden","false"),b.disabled=!1,"left"===e?h.focus():b.focus())):d.close&&g.focus()})(e)},le=()=>{de()&&q(),Object.entries(v).forEach(e=>{e[1].gallery.forEach(e=>{Y(e)})}),v={},A=null;for(const e in o)o[e].onReset()},de=()=>"false"===p.getAttribute("aria-hidden"),ce=()=>"ontouchstart"in window,ue=e=>-1!==["TEXTAREA","OPTION","INPUT","SELECT"].indexOf(e.nodeName)||e===h||e===b||e===g,pe=(e,t)=>{p.addEventListener(e,t)},he=(e,t)=>{p.removeEventListener(e,t)};return(t=>{if(document.querySelector("div.tobii"))return void console.log("Multiple lightbox instances not supported.");d=(t=>e({},{selector:".lightbox",captions:!0,captionsSelector:"img",captionAttribute:"alt",captionText:null,captionHTML:!1,nav:"auto",navText:['<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path stroke="none" d="M0 0h24v24H0z"/><polyline points="15 6 9 12 15 18" /></svg>','<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path stroke="none" d="M0 0h24v24H0z"/><polyline points="9 6 15 12 9 18" /></svg>'],navLabel:["Previous image","Next image"],close:!0,closeText:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path stroke="none" d="M0 0h24v24H0z"/><line x1="18" y1="6" x2="6" y2="18" /><line x1="6" y1="6" x2="18" y2="18" /></svg>',closeLabel:"Close lightbox",loadingIndicatorLabel:"Image loading",counter:!0,download:!1,downloadText:"",downloadLabel:"Download image",keyboard:!0,zoom:!0,zoomText:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path stroke="none" d="M0 0h24v24H0z"/><polyline points="16 4 20 4 20 8" /><line x1="14" y1="10" x2="20" y2="4" /><polyline points="8 20 4 20 4 16" /><line x1="4" y1="20" x2="10" y2="14" /><polyline points="16 20 20 20 20 16" /><line x1="14" y1="14" x2="20" y2="20" /><polyline points="8 4 4 4 4 8" /><line x1="4" y1="4" x2="10" y2="10" /></svg>',docClose:!0,swipeClose:!0,hideScrollbar:!0,draggable:!0,threshold:100,rtl:!1,loop:!1,autoplayVideo:!1,modal:!1,theme:"tobii--theme-default"},t))(t),p||(p=document.createElement("div"),p.setAttribute("role","dialog"),p.setAttribute("aria-hidden","true"),p.classList.add("tobii"),p.classList.add(d.theme),h=document.createElement("button"),h.className="tobii__btn tobii__btn--previous",h.setAttribute("type","button"),h.setAttribute("aria-label",d.navLabel[0]),h.innerHTML=d.navText[0],p.appendChild(h),b=document.createElement("button"),b.className="tobii__btn tobii__btn--next",b.setAttribute("type","button"),b.setAttribute("aria-label",d.navLabel[1]),b.innerHTML=d.navText[1],p.appendChild(b),g=document.createElement("button"),g.className="tobii__btn tobii__btn--close",g.setAttribute("type","button"),g.setAttribute("aria-label",d.closeLabel),g.innerHTML=d.closeText,p.appendChild(g),m=document.createElement("div"),m.className="tobii__counter",p.appendChild(m),document.body.appendChild(p));const i=document.querySelectorAll(d.selector);if(!i)throw new Error(`Ups, I can't find the selector ${d.selector} on this website.`);const r=[];i.forEach(e=>{const t=e.hasAttribute("data-group")?e.getAttribute("data-group"):"default";let i=e.href;e.hasAttribute("data-target")&&(i=e.getAttribute("data-target")),i+="__"+t,void 0!==r[i]?e.addEventListener("click",e=>{$(t),X(),e.preventDefault()}):(r[i]=1,I(e))})})(s),a.open=X,a.previous=N,a.next=O,a.close=q,a.add=I,a.remove=Y,a.reset=le,a.destroy=()=>{le(),p.parentNode.removeChild(p)},a.isOpen=de,a.slidesIndex=()=>v[A].currentIndex,a.select=e=>{const t=v[A].currentIndex;if(!de())throw new Error("Ups, I'm closed.");if(de()){if(!e&&0!==e)throw new Error("Ups, no slide specified.");if(e===v[A].currentIndex)throw new Error(`Ups, slide ${e} is already selected.`);if(-1===e||e>=v[A].elementsLength)throw new Error(`Ups, I can't find slide ${e}.`)}v[A].currentIndex=e,k(t),M(e),e<t&&(oe("left"),R(t),P(e-1)),e>t&&(oe("right"),R(t),P(e+1))},a.slidesCount=()=>v[A].elementsLength,a.selectGroup=$,a.currentGroup=()=>A,a.on=pe,a.off=he,a}export{a as default};

@@ -1,1 +0,1 @@

class e{constructor(){this.figcaptionId=0,this.userSettings=null}init(e,t,i){this.userSettings=i;const r=document.createElement("figure"),n=document.createElement("figcaption"),s=document.createElement("img"),a=e.querySelector("img"),o=document.createElement("div");if(r.style.opacity="0",a&&(s.alt=a.alt||""),s.setAttribute("src",""),s.setAttribute("data-src",e.href),e.hasAttribute("data-srcset")&&s.setAttribute("data-srcset",e.getAttribute("data-srcset")),r.appendChild(s),this.userSettings.captions){let t;"function"==typeof this.userSettings.captionText?t=this.userSettings.captionText(e):"self"===this.userSettings.captionsSelector&&e.getAttribute(this.userSettings.captionAttribute)?t=e.getAttribute(this.userSettings.captionAttribute):"img"===this.userSettings.captionsSelector&&a&&a.getAttribute(this.userSettings.captionAttribute)&&(t=a.getAttribute(this.userSettings.captionAttribute)),this.userSettings.captionHTML?n.innerHTML=t:n.textContent=t,t&&(n.id=`tobii-figcaption-${this.figcaptionId}`,r.appendChild(n),s.setAttribute("aria-labelledby",n.id),++this.figcaptionId)}t.appendChild(r),o.className="tobii__loader",o.setAttribute("role","progressbar"),o.setAttribute("aria-label",this.userSettings.loadingIndicatorLabel),t.appendChild(o),t.setAttribute("data-type","image"),t.classList.add("tobii-image")}onPreload(e){this.onLoad(e)}onLoad(e){const t=e.querySelector("img");if(!t.hasAttribute("data-src"))return;const i=e.querySelector("figure"),r=e.querySelector(".tobii__loader");t.addEventListener("load",()=>{e.removeChild(r),i.style.opacity="1"}),t.addEventListener("error",()=>{e.removeChild(r),i.style.opacity="1"}),t.setAttribute("src",t.getAttribute("data-src")),t.removeAttribute("data-src"),t.hasAttribute("data-srcset")&&t.setAttribute("srcset",t.getAttribute("data-srcset"))}onLeave(e){}onCleanup(e){}onReset(){this.figcaptionId=0}}class t{constructor(){this.userSettings=null}init(e,t,i){this.userSettings=i;const r=e.hasAttribute("data-target")?e.getAttribute("data-target"):e.getAttribute("href");t.setAttribute("data-HREF",r),e.getAttribute("data-allow")&&t.setAttribute("data-allow",e.getAttribute("data-allow")),e.hasAttribute("data-width")&&t.setAttribute("data-width",`${e.getAttribute("data-width")}`),e.hasAttribute("data-height")&&t.setAttribute("data-height",`${e.getAttribute("data-height")}`),t.setAttribute("data-type","iframe"),t.classList.add("tobii-iframe")}onPreload(e){}onLoad(e){let t=e.querySelector("iframe");const i=document.createElement("div");if(i.className="tobii__loader",i.setAttribute("role","progressbar"),i.setAttribute("aria-label",this.userSettings.loadingIndicatorLabel),e.appendChild(i),null==t){t=document.createElement("iframe");const i=e.getAttribute("data-href");t.setAttribute("frameborder","0"),t.setAttribute("src",i),t.setAttribute("allowfullscreen",""),i.indexOf("youtube.com")>-1?t.setAttribute("allow","accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"):i.indexOf("vimeo.com")>-1?t.setAttribute("allow","autoplay; picture-in-picture"):e.hasAttribute("data-allow")&&t.setAttribute("allow",e.getAttribute("data-allow")),e.getAttribute("data-width")&&(t.style.maxWidth=`${e.getAttribute("data-width")}`),e.getAttribute("data-height")&&(t.style.maxHeight=`${e.getAttribute("data-height")}`),t.style.opacity="0",e.appendChild(t),t.addEventListener("load",()=>{t.style.opacity="1";const i=e.querySelector(".tobii__loader");i&&e.removeChild(i)}),t.addEventListener("error",()=>{t.style.opacity="1";const i=e.querySelector(".tobii__loader");i&&e.removeChild(i)})}else t.setAttribute("src",e.getAttribute("data-href"))}onLeave(e){}onCleanup(e){const t=e.querySelector("iframe");t.setAttribute("src",""),t.style.opacity="0"}onReset(){}}class i{constructor(){this.userSettings=null}init(e,t,i){this.userSettings=i;const r=e.hasAttribute("data-target")?e.getAttribute("data-target"):e.getAttribute("href"),n=document.querySelector(r).cloneNode(!0);if(!n)throw new Error(`Ups, I can't find the target ${r}.`);t.appendChild(n),t.setAttribute("data-type","html"),t.classList.add("tobii-html")}onPreload(e){}onLoad(e,t){const i=e.querySelector("video");i&&(i.hasAttribute("data-time")&&i.readyState>0&&(i.currentTime=i.getAttribute("data-time")),this.userSettings.autoplayVideo&&i.play());const r=e.querySelector("audio");r&&this.userSettings.autoplayAudio&&r.play(),e.classList.add("tobii-group-"+t)}onLeave(e){const t=e.querySelector("video");t&&(t.paused||t.pause(),t.readyState>0&&t.setAttribute("data-time",t.currentTime));const i=e.querySelector("audio");i&&(i.paused||i.pause())}onCleanup(e){const t=e.querySelector("video");if(t&&t.readyState>0&&t.readyState<3&&t.duration!==t.currentTime){const i=t.cloneNode(!0);this._removeSources(t),t.load(),t.parentNode.removeChild(t),e.appendChild(i)}}onReset(){}_removeSources(e){const t=e.querySelectorAll("src");t&&t.forEach(e=>{e.setAttribute("src","")})}}class r{constructor(){this.playerId=0,this.PLAYER=[],this.userSettings=null}init(e,t,i){this.userSettings=i;const r=document.createElement("div");t.appendChild(r),this.PLAYER[this.playerId]=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",this.playerId),t.setAttribute("data-type","youtube"),t.classList.add("tobii-youtube"),this.playerId++}onPreload(e){}onLoad(e){this.userSettings.autoplayVideo&&this.PLAYER[e.getAttribute("data-player")].playVideo()}onLeave(e){1===this.PLAYER[e.getAttribute("data-player")].getPlayerState()&&this.PLAYER[e.getAttribute("data-player")].pauseVideo()}onCleanup(e){1===this.PLAYER[e.getAttribute("data-player")].getPlayerState()&&this.PLAYER[e.getAttribute("data-player")].pauseVideo()}onReset(){}}function n(s){const a={image:new e,html:new i,iframe:new t,youtube:new r},o=['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])'];let d={};const l=[],u={gallery:[],slider:null,sliderElements:[],elementsLength:0,currentIndex:0,x:0};let c=null,p=null,b=null,h=null,g=null,m={},y=!1,v=!1,f=!1,w=null,A=null,E=null,L=!1,x=!1,_={},S=null,I=null;const C=e=>{if(null===document.querySelector('[data-type="youtube"]')||x)P(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===l.indexOf(e)&&l.push(e),window.onYouTubePlayerAPIReady=()=>{l.forEach(e=>{P(e)}),x=!0}}},T=e=>e.hasAttribute("data-group")?e.getAttribute("data-group"):"default",P=e=>{if(S=T(e),Object.prototype.hasOwnProperty.call(_,S)||(_[S]=JSON.parse(JSON.stringify(u)),Y()),-1!==_[S].gallery.indexOf(e))throw new Error("Ups, element already added.");if(_[S].gallery.push(e),_[S].elementsLength++,d.zoom&&e.querySelector("img")&&"false"!==e.getAttribute("data-zoom")||"true"===e.getAttribute("data-zoom")){const t=document.createElement("div");t.className="tobii-zoom__icon",t.innerHTML=d.zoomText,e.classList.add("tobii-zoom"),e.appendChild(t)}e.addEventListener("click",F),N(e),ue()&&S===I&&(oe(),de())},q=e=>{const t=T(e);if(-1===_[t].gallery.indexOf(e))throw new Error(`Ups, I can't find a slide for the element ${e}.`);{const i=_[t].gallery.indexOf(e),r=_[t].sliderElements[i];if(ue()&&t===I&&i===_[t].currentIndex){if(1===_[t].elementsLength)throw U(),new Error("Ups, I've closed. There are no slides more to show.");0===_[t].currentIndex?M():z(),oe(),de()}if(_[t].gallery.splice(_[t].gallery.indexOf(e)),_[t].sliderElements.splice(_[t].gallery.indexOf(e)),_[t].elementsLength--,--_[t].x,d.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",F),r.parentNode.removeChild(r)}},Y=()=>{_[S].slider=document.createElement("div"),_[S].slider.className="tobii__slider",_[S].slider.setAttribute("aria-hidden","true"),c.appendChild(_[S].slider)},N=e=>{const t=k(e),i=document.createElement("div"),r=document.createElement("div");i.className="tobii__slide",i.style.position="absolute",i.style.left=100*_[S].x+"%",i.setAttribute("aria-hidden","true"),t.init(e,r,d),i.appendChild(r),_[S].slider.appendChild(i),_[S].sliderElements.push(i),++_[S].x},k=e=>{const t=e.getAttribute("data-type");return void 0!==a[t]?a[t]:(e.hasAttribute("data-type")&&console.log("Unknown lightbox element type: "+t),a.image)},O=e=>{if(I=null!==I?I:S,ue())throw new Error("Ups, I'm aleady open.");if(!ue()&&(e||(e=0),-1===e||e>=_[I].elementsLength))throw new Error(`Ups, I can't find slide ${e}.`);document.documentElement.classList.add("tobii-is-open"),document.body.classList.add("tobii-is-open"),document.body.classList.add("tobii-is-open-"+I),oe(),d.close||(h.disabled=!1,h.setAttribute("aria-hidden","true")),w=document.activeElement;const t=window.location.href;window.history.pushState({tobii:"close"},"Image",t),_[I].currentIndex=e,V(),se(),$(_[I].currentIndex),_[I].slider.setAttribute("aria-hidden","false"),c.setAttribute("aria-hidden","false"),de(),X(_[I].currentIndex+1),X(_[I].currentIndex-1),_[I].slider.classList.add("tobii__slider--animate");const i=new window.CustomEvent("open",{detail:{group:I}});c.dispatchEvent(i)},U=()=>{if(!ue())throw new Error("Ups, I'm already closed.");document.documentElement.classList.remove("tobii-is-open"),document.body.classList.remove("tobii-is-open"),document.body.classList.remove("tobii-is-open-"+I),ae(),null!==window.history.state&&"close"===window.history.state.tobii&&window.history.back(),w.focus(),H(_[I].currentIndex),D(_[I].currentIndex),c.setAttribute("aria-hidden","true"),_[I].slider.setAttribute("aria-hidden","true"),_[I].currentIndex=0,_[I].slider.classList.remove("tobii__slider--animate");const e=new window.CustomEvent("close",{detail:{group:I}});c.dispatchEvent(e)},X=e=>{if(void 0===_[I].sliderElements[e])return;const t=_[I].sliderElements[e].querySelector("[data-type]");k(t).onPreload(t)},$=e=>{if(void 0===_[I].sliderElements[e])return;const t=_[I].sliderElements[e].querySelector("[data-type]"),i=k(t);_[I].sliderElements[e].classList.add("tobii__slide--is-active"),_[I].sliderElements[e].setAttribute("aria-hidden","false"),i.onLoad(t,I)},z=()=>{if(!ue())throw new Error("Ups, I'm closed.");_[I].currentIndex>0&&(H(_[I].currentIndex),$(--_[I].currentIndex),de("left"),D(_[I].currentIndex+1),X(_[I].currentIndex-1));const e=new window.CustomEvent("previous",{detail:{group:I}});c.dispatchEvent(e)},M=()=>{if(!ue())throw new Error("Ups, I'm closed.");_[I].currentIndex<_[I].elementsLength-1&&(H(_[I].currentIndex),$(++_[I].currentIndex),de("right"),D(_[I].currentIndex-1),X(_[I].currentIndex+1));const e=new window.CustomEvent("next",{detail:{group:I}});c.dispatchEvent(e)},R=e=>{if(ue())throw new Error("Ups, I'm open.");if(!e)throw new Error("Ups, no group specified.");if(e&&!Object.prototype.hasOwnProperty.call(_,e))throw new Error(`Ups, I don't have a group called "${e}".`);I=e},H=e=>{if(void 0===_[I].sliderElements[e])return;const t=_[I].sliderElements[e].querySelector("[data-type]"),i=k(t);_[I].sliderElements[e].classList.remove("tobii__slide--is-active"),_[I].sliderElements[e].setAttribute("aria-hidden","true"),i.onLeave(t)},D=e=>{if(void 0===_[I].sliderElements[e])return;const t=_[I].sliderElements[e].querySelector("[data-type]");k(t).onCleanup(t)},B=()=>{I=null!==I?I:S,A=-_[I].currentIndex*c.offsetWidth,_[I].slider.style.transform=`translate3d(${A}px, 0, 0)`,E=A},V=()=>{m={startX:0,endX:0,startY:0,endY:0}},j=()=>{const e=m.endX-m.startX,t=m.endY-m.startY,i=Math.abs(e),r=Math.abs(t);e>0&&i>d.threshold&&_[I].currentIndex>0?z():e<0&&i>d.threshold&&_[I].currentIndex!==_[I].elementsLength-1?M():t<0&&r>d.threshold&&d.swipeClose?U():B()},W=()=>{L||(L=!0,window.requestAnimationFrame(()=>{B(),L=!1}))},F=e=>{e.preventDefault(),I=T(e.currentTarget),O(_[I].gallery.indexOf(e.currentTarget))},G=e=>{e.target===p?z():e.target===b?M():(e.target===h||!1===y&&!1===v&&e.target.classList.contains("tobii__slide")&&d.docClose)&&U(),e.stopPropagation()},J=e=>{const t=Array.prototype.slice.call(c.querySelectorAll(`.tobii__btn:not([disabled]), .tobii__slide--is-active ${o.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(),U()):37===e.keyCode||"ArrowLeft"===e.code?(e.preventDefault(),z()):39!==e.keyCode&&"ArrowRight"!==e.code||(e.preventDefault(),M())},K=e=>{pe(e.target)||(e.stopPropagation(),y=!1,v=!1,f=!0,m.startX=e.touches[0].pageX,m.startY=e.touches[0].pageY,ce()&&_[I].slider.classList.add("tobii__slider--is-dragging"))},Q=e=>{e.stopPropagation(),f&&(m.endX=e.touches[0].pageX,m.endY=e.touches[0].pageY,ne())},Z=e=>{e.stopPropagation(),f=!1,_[I].slider.classList.remove("tobii__slider--is-dragging"),m.endX&&j(),V()},ee=e=>{pe(e.target)||(e.preventDefault(),e.stopPropagation(),y=!1,v=!1,f=!0,m.startX=e.pageX,m.startY=e.pageY,ce()&&_[I].slider.classList.add("tobii__slider--is-dragging"))},te=e=>{e.preventDefault(),f&&(m.endX=e.pageX,m.endY=e.pageY,ne())},ie=e=>{e.stopPropagation(),f=!1,_[I].slider.classList.remove("tobii__slider--is-dragging"),m.endX&&j(),V()},re=()=>{f=!1},ne=()=>{Math.abs(m.startX-m.endX)>0&&!v&&_[I].elementsLength>1?(_[I].slider.style.transform=`translate3d(${E-Math.round(m.startX-m.endX)}px, 0, 0)`,y=!0,v=!1):Math.abs(m.startY-m.endY)>0&&!y&&d.swipeClose&&(_[I].slider.style.transform=`translate3d(${E}px, -${Math.round(m.startY-m.endY)}px, 0)`,y=!1,v=!0)},se=()=>{d.keyboard&&window.addEventListener("keydown",J),window.addEventListener("resize",W),window.addEventListener("popstate",U),c.addEventListener("click",G),d.draggable&&ce()&&(c.addEventListener("touchstart",K),c.addEventListener("touchmove",Q),c.addEventListener("touchend",Z),c.addEventListener("mousedown",ee),c.addEventListener("mouseup",ie),c.addEventListener("mousemove",te),c.addEventListener("contextmenu",re))},ae=()=>{d.keyboard&&window.removeEventListener("keydown",J),window.removeEventListener("resize",W),window.removeEventListener("popstate",U),c.removeEventListener("click",G),d.draggable&&ce()&&(c.removeEventListener("touchstart",K),c.removeEventListener("touchmove",Q),c.removeEventListener("touchend",Z),c.removeEventListener("mousedown",ee),c.removeEventListener("mouseup",ie),c.removeEventListener("mousemove",te),c.removeEventListener("contextmenu",re))},oe=()=>{(d.draggable&&d.swipeClose&&ce()&&!_[I].slider.classList.contains("tobii__slider--is-draggable")||d.draggable&&_[I].elementsLength>1&&!_[I].slider.classList.contains("tobii__slider--is-draggable"))&&_[I].slider.classList.add("tobii__slider--is-draggable"),!d.nav||1===_[I].elementsLength||"auto"===d.nav&&ce()?(p.setAttribute("aria-hidden","true"),p.disabled=!0,b.setAttribute("aria-hidden","true"),b.disabled=!0):(p.setAttribute("aria-hidden","false"),p.disabled=!1,b.setAttribute("aria-hidden","false"),b.disabled=!1),g.setAttribute("aria-hidden",d.counter&&1!==_[I].elementsLength?"false":"true")},de=(e=null)=>{B(),g.textContent=`${_[I].currentIndex+1}/${_[I].elementsLength}`,(e=>{(!0===d.nav||"auto"===d.nav)&&!ce()&&_[I].elementsLength>1?(p.setAttribute("aria-hidden","true"),p.disabled=!0,b.setAttribute("aria-hidden","true"),b.disabled=!0,1===_[I].elementsLength?d.close&&h.focus():0===_[I].currentIndex?(b.setAttribute("aria-hidden","false"),b.disabled=!1,b.focus()):_[I].currentIndex===_[I].elementsLength-1?(p.setAttribute("aria-hidden","false"),p.disabled=!1,p.focus()):(p.setAttribute("aria-hidden","false"),p.disabled=!1,b.setAttribute("aria-hidden","false"),b.disabled=!1,"left"===e?p.focus():b.focus())):d.close&&h.focus()})(e)},le=()=>{ue()&&U(),Object.entries(_).forEach(e=>{e[1].gallery.forEach(e=>{q(e)})}),_={},S=I=null;for(const e in a)a[e].onReset()},ue=()=>"false"===c.getAttribute("aria-hidden"),ce=()=>"ontouchstart"in window,pe=e=>-1!==["TEXTAREA","OPTION","INPUT","SELECT"].indexOf(e.nodeName)||e===p||e===b||e===h;return(e=>{if(document.querySelector("div.tobii"))return void console.log("Multiple lightbox instances not supported.");d=(e=>({selector:".lightbox",captions:!0,captionsSelector:"img",captionAttribute:"alt",captionText:null,captionHTML:!1,nav:"auto",navText:['<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path stroke="none" d="M0 0h24v24H0z"/><polyline points="15 6 9 12 15 18" /></svg>','<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path stroke="none" d="M0 0h24v24H0z"/><polyline points="9 6 15 12 9 18" /></svg>'],navLabel:["Previous image","Next image"],close:!0,closeText:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path stroke="none" d="M0 0h24v24H0z"/><line x1="18" y1="6" x2="6" y2="18" /><line x1="6" y1="6" x2="18" y2="18" /></svg>',closeLabel:"Close lightbox",loadingIndicatorLabel:"Image loading",counter:!0,download:!1,downloadText:"",downloadLabel:"Download image",keyboard:!0,zoom:!0,zoomText:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path stroke="none" d="M0 0h24v24H0z"/><polyline points="16 4 20 4 20 8" /><line x1="14" y1="10" x2="20" y2="4" /><polyline points="8 20 4 20 4 16" /><line x1="4" y1="20" x2="10" y2="14" /><polyline points="16 20 20 20 20 16" /><line x1="14" y1="14" x2="20" y2="20" /><polyline points="8 4 4 4 4 8" /><line x1="4" y1="4" x2="10" y2="10" /></svg>',docClose:!0,swipeClose:!0,hideScrollbar:!0,draggable:!0,threshold:100,rtl:!1,loop:!1,autoplayVideo:!1,modal:!1,theme:"tobii--theme-default",...e}))(e),c||(c=document.createElement("div"),c.setAttribute("role","dialog"),c.setAttribute("aria-hidden","true"),c.classList.add("tobii"),c.classList.add(d.theme),p=document.createElement("button"),p.className="tobii__btn tobii__btn--previous",p.setAttribute("type","button"),p.setAttribute("aria-label",d.navLabel[0]),p.innerHTML=d.navText[0],c.appendChild(p),b=document.createElement("button"),b.className="tobii__btn tobii__btn--next",b.setAttribute("type","button"),b.setAttribute("aria-label",d.navLabel[1]),b.innerHTML=d.navText[1],c.appendChild(b),h=document.createElement("button"),h.className="tobii__btn tobii__btn--close",h.setAttribute("type","button"),h.setAttribute("aria-label",d.closeLabel),h.innerHTML=d.closeText,c.appendChild(h),g=document.createElement("div"),g.className="tobii__counter",c.appendChild(g),document.body.appendChild(c));const t=document.querySelectorAll(d.selector);if(!t)throw new Error(`Ups, I can't find the selector ${d.selector} on this website.`);const i=[];t.forEach(e=>{const t=e.hasAttribute("data-group")?e.getAttribute("data-group"):"default";let r=e.href;e.hasAttribute("data-target")&&(r=e.getAttribute("data-target")),r+="__"+t,void 0!==i[r]?e.addEventListener("click",e=>{R(t),O(),e.preventDefault()}):(i[r]=1,C(e))})})(s),n.open=O,n.previous=z,n.next=M,n.close=U,n.add=C,n.remove=q,n.reset=le,n.destroy=()=>{le(),c.parentNode.removeChild(c)},n.isOpen=ue,n.slidesIndex=()=>_[I].currentIndex,n.select=e=>{const t=_[I].currentIndex;if(!ue())throw new Error("Ups, I'm closed.");if(ue()){if(!e&&0!==e)throw new Error("Ups, no slide specified.");if(e===_[I].currentIndex)throw new Error(`Ups, slide ${e} is already selected.`);if(-1===e||e>=_[I].elementsLength)throw new Error(`Ups, I can't find slide ${e}.`)}_[I].currentIndex=e,H(t),$(e),e<t&&(de("left"),D(t),X(e-1)),e>t&&(de("right"),D(t),X(e+1))},n.slidesCount=()=>_[I].elementsLength,n.selectGroup=R,n.currentGroup=()=>null!==I?I:S,n.on=(e,t)=>{c.addEventListener(e,t)},n.off=(e,t)=>{c.removeEventListener(e,t)},n}export{n as default};
class e{constructor(){this.figcaptionId=0,this.userSettings=null}init(e,t,i){this.userSettings=i;const r=document.createElement("figure"),a=document.createElement("figcaption"),n=document.createElement("img"),s=e.querySelector("img"),o=document.createElement("div");if(r.style.opacity="0",s&&(n.alt=s.alt||""),n.setAttribute("src",""),n.setAttribute("data-src",e.href),e.hasAttribute("data-srcset")&&n.setAttribute("data-srcset",e.getAttribute("data-srcset")),r.appendChild(n),this.userSettings.captions){let t;"function"==typeof this.userSettings.captionText?t=this.userSettings.captionText(e):"self"===this.userSettings.captionsSelector&&e.getAttribute(this.userSettings.captionAttribute)?t=e.getAttribute(this.userSettings.captionAttribute):"img"===this.userSettings.captionsSelector&&s&&s.getAttribute(this.userSettings.captionAttribute)&&(t=s.getAttribute(this.userSettings.captionAttribute)),this.userSettings.captionHTML?a.innerHTML=t:a.textContent=t,t&&(a.id=`tobii-figcaption-${this.figcaptionId}`,r.appendChild(a),n.setAttribute("aria-labelledby",a.id),++this.figcaptionId)}t.appendChild(r),o.className="tobii__loader",o.setAttribute("role","progressbar"),o.setAttribute("aria-label",this.userSettings.loadingIndicatorLabel),t.appendChild(o),t.setAttribute("data-type","image"),t.classList.add("tobii-image")}onPreload(e){this.onLoad(e)}onLoad(e){const t=e.querySelector("img");if(!t.hasAttribute("data-src"))return;const i=e.querySelector("figure"),r=e.querySelector(".tobii__loader");t.addEventListener("load",()=>{e.removeChild(r),i.style.opacity="1"}),t.addEventListener("error",()=>{e.removeChild(r),i.style.opacity="1"}),t.setAttribute("src",t.getAttribute("data-src")),t.removeAttribute("data-src"),t.hasAttribute("data-srcset")&&t.setAttribute("srcset",t.getAttribute("data-srcset"))}onLeave(e){}onCleanup(e){}onReset(){this.figcaptionId=0}}class t{constructor(){this.userSettings=null}init(e,t,i){this.userSettings=i;const r=e.hasAttribute("data-target")?e.getAttribute("data-target"):e.getAttribute("href");t.setAttribute("data-HREF",r),e.getAttribute("data-allow")&&t.setAttribute("data-allow",e.getAttribute("data-allow")),e.hasAttribute("data-width")&&t.setAttribute("data-width",`${e.getAttribute("data-width")}`),e.hasAttribute("data-height")&&t.setAttribute("data-height",`${e.getAttribute("data-height")}`),t.setAttribute("data-type","iframe"),t.classList.add("tobii-iframe")}onPreload(e){}onLoad(e){let t=e.querySelector("iframe");const i=document.createElement("div");if(i.className="tobii__loader",i.setAttribute("role","progressbar"),i.setAttribute("aria-label",this.userSettings.loadingIndicatorLabel),e.appendChild(i),null==t){t=document.createElement("iframe");const i=e.getAttribute("data-href");t.setAttribute("frameborder","0"),t.setAttribute("src",i),t.setAttribute("allowfullscreen",""),i.indexOf("youtube.com")>-1?t.setAttribute("allow","accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"):i.indexOf("vimeo.com")>-1?t.setAttribute("allow","autoplay; picture-in-picture"):e.hasAttribute("data-allow")&&t.setAttribute("allow",e.getAttribute("data-allow")),e.getAttribute("data-width")&&(t.style.maxWidth=`${e.getAttribute("data-width")}`),e.getAttribute("data-height")&&(t.style.maxHeight=`${e.getAttribute("data-height")}`),t.style.opacity="0",e.appendChild(t),t.addEventListener("load",()=>{t.style.opacity="1";const i=e.querySelector(".tobii__loader");i&&e.removeChild(i)}),t.addEventListener("error",()=>{t.style.opacity="1";const i=e.querySelector(".tobii__loader");i&&e.removeChild(i)})}else t.setAttribute("src",e.getAttribute("data-href"))}onLeave(e){}onCleanup(e){const t=e.querySelector("iframe");t.setAttribute("src",""),t.style.opacity="0"}onReset(){}}class i{constructor(){this.userSettings=null}init(e,t,i){this.userSettings=i;const r=e.hasAttribute("data-target")?e.getAttribute("data-target"):e.getAttribute("href"),a=document.querySelector(r).cloneNode(!0);if(!a)throw new Error(`Ups, I can't find the target ${r}.`);t.appendChild(a),t.setAttribute("data-type","html"),t.classList.add("tobii-html")}onPreload(e){}onLoad(e,t){const i=e.querySelector("video");i&&(i.hasAttribute("data-time")&&i.readyState>0&&(i.currentTime=i.getAttribute("data-time")),this.userSettings.autoplayVideo&&i.play());const r=e.querySelector("audio");r&&this.userSettings.autoplayAudio&&r.play(),e.classList.add("tobii-group-"+t)}onLeave(e){const t=e.querySelector("video");t&&(t.paused||t.pause(),t.readyState>0&&t.setAttribute("data-time",t.currentTime));const i=e.querySelector("audio");i&&(i.paused||i.pause())}onCleanup(e){const t=e.querySelector("video");if(t&&t.readyState>0&&t.readyState<3&&t.duration!==t.currentTime){const i=t.cloneNode(!0);this._removeSources(t),t.load(),t.parentNode.removeChild(t),e.appendChild(i)}}onReset(){}_removeSources(e){const t=e.querySelectorAll("src");t&&t.forEach(e=>{e.setAttribute("src","")})}}class r{constructor(){this.playerId=0,this.PLAYER=[],this.userSettings=null}init(e,t,i){this.userSettings=i;const r=document.createElement("div");t.appendChild(r),this.PLAYER[this.playerId]=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",this.playerId),t.setAttribute("data-type","youtube"),t.classList.add("tobii-youtube"),this.playerId++}onPreload(e){}onLoad(e){this.userSettings.autoplayVideo&&this.PLAYER[e.getAttribute("data-player")].playVideo()}onLeave(e){1===this.PLAYER[e.getAttribute("data-player")].getPlayerState()&&this.PLAYER[e.getAttribute("data-player")].pauseVideo()}onCleanup(e){1===this.PLAYER[e.getAttribute("data-player")].getPlayerState()&&this.PLAYER[e.getAttribute("data-player")].pauseVideo()}onReset(){}}function a(n){const s={image:new e,html:new i,iframe:new t,youtube:new r},o=['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])'];let l={};const d=[],c={gallery:[],slider:null,sliderElements:[],elementsLength:0,currentIndex:0,x:0};let u=null,p=null,h=null,b=null,g=null,m=null,y=null,f=!1,w={},v=null,A=[],x=0;const E={element:null,originX:0,originY:0,translateX:0,translateY:0,scale:1},L={startX:0,startY:0,x:0,y:0,distance:0},_=e=>{if(null===document.querySelector('[data-type="youtube"]')||f)S(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===d.indexOf(e)&&d.push(e),window.onYouTubePlayerAPIReady=()=>{d.forEach(e=>{S(e)}),f=!0}}},I=e=>e.hasAttribute("data-group")?e.getAttribute("data-group"):"default",S=e=>{const t=I(e);if(Object.prototype.hasOwnProperty.call(w,t)||(w[t]=JSON.parse(JSON.stringify(c)),w[t].slider=document.createElement("div"),w[t].slider.className="tobii__slider",w[t].slider.setAttribute("aria-hidden","true"),u.appendChild(w[t].slider)),-1!==w[t].gallery.indexOf(e))throw new Error("Ups, element already added.");{if(w[t].gallery.push(e),w[t].elementsLength++,l.zoom&&e.querySelector("img")&&"false"!==e.getAttribute("data-zoom")||"true"===e.getAttribute("data-zoom")){const t=document.createElement("div");t.className="tobii-zoom__icon",t.innerHTML=l.zoomText,e.classList.add("tobii-zoom"),e.appendChild(t)}e.addEventListener("click",z);const i=Y(e),r=document.createElement("div"),a=document.createElement("div");r.className="tobii__slide",r.style.position="absolute",r.style.left=100*w[t].x+"%",r.setAttribute("aria-hidden","true"),i.init(e,a,l),r.appendChild(a),w[t].slider.appendChild(r),w[t].sliderElements.push(r),++w[t].x,le()&&t===v&&(ne(),se())}},C=e=>{const t=I(e);if(-1===w[t].gallery.indexOf(e))throw new Error(`Ups, I can't find a slide for the element ${e}.`);{const i=w[t].gallery.indexOf(e),r=w[t].sliderElements[i];if(le()&&t===v&&i===w[t].currentIndex){if(1===w[t].elementsLength)throw X(),new Error("Ups, I've closed. There are no slides more to show.");0===w[t].currentIndex?P():N(),ne(),se()}if(w[t].gallery.splice(w[t].gallery.indexOf(e)),w[t].sliderElements.splice(w[t].gallery.indexOf(e)),w[t].elementsLength--,--w[t].x,l.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",z),r.parentNode.removeChild(r)}},Y=e=>{const t=e.getAttribute("data-type");return void 0!==s[t]?s[t]:(e.hasAttribute("data-type")&&console.log("Unknown lightbox element type: "+t),s.image)},T=(e=0)=>{if(le())throw new Error("Ups, I'm aleady open.");if(-1===e||e>=w[v].elementsLength)throw new Error(`Ups, I can't find slide ${e}.`);document.documentElement.classList.add("tobii-is-open"),document.body.classList.add("tobii-is-open"),document.body.classList.add("tobii-is-open-"+v),ne(),l.close||(b.disabled=!1,b.setAttribute("aria-hidden","true")),m=document.activeElement;const t=window.location.href;window.history.pushState({tobii:"close"},"Image",t),w[v].currentIndex=e,re(),M(w[v].currentIndex),w[v].slider.setAttribute("aria-hidden","false"),u.setAttribute("aria-hidden","false"),se(),q(w[v].currentIndex+1),q(w[v].currentIndex-1),w[v].slider.classList.add("tobii__slider--animate");const i=new window.CustomEvent("open",{detail:{group:v}});u.dispatchEvent(i)},X=()=>{if(!le())throw new Error("Ups, I'm already closed.");document.documentElement.classList.remove("tobii-is-open"),document.body.classList.remove("tobii-is-open"),document.body.classList.remove("tobii-is-open-"+v),ae(),null!==window.history.state&&"close"===window.history.state.tobii&&window.history.back(),m.focus(),O(w[v].currentIndex),k(w[v].currentIndex),u.setAttribute("aria-hidden","true"),w[v].slider.setAttribute("aria-hidden","true"),w[v].currentIndex=0,w[v].slider.classList.remove("tobii__slider--animate");const e=new window.CustomEvent("close",{detail:{group:v}});u.dispatchEvent(e)},q=e=>{if(void 0===w[v].sliderElements[e])return;const t=w[v].sliderElements[e].querySelector("[data-type]");Y(t).onPreload(t)},M=e=>{if(void 0===w[v].sliderElements[e])return;const t=w[v].sliderElements[e].querySelector("[data-type]"),i=Y(t);w[v].sliderElements[e].classList.add("tobii__slide--is-active"),w[v].sliderElements[e].setAttribute("aria-hidden","false"),i.onLoad(t,v)},N=()=>{if(!le())throw new Error("Ups, I'm closed.");w[v].currentIndex>0&&(O(w[v].currentIndex),M(--w[v].currentIndex),se("left"),k(w[v].currentIndex+1),q(w[v].currentIndex-1));const e=new window.CustomEvent("previous",{detail:{group:v}});u.dispatchEvent(e)},P=()=>{if(!le())throw new Error("Ups, I'm closed.");w[v].currentIndex<w[v].elementsLength-1&&(O(w[v].currentIndex),M(++w[v].currentIndex),se("right"),k(w[v].currentIndex-1),q(w[v].currentIndex+1));const e=new window.CustomEvent("next",{detail:{group:v}});u.dispatchEvent(e)},$=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(w,e))throw new Error(`Ups, I don't have a group called "${e}".`);v=e},O=e=>{if(void 0===w[v].sliderElements[e])return;const t=w[v].sliderElements[e].querySelector("[data-type]"),i=Y(t);w[v].sliderElements[e].classList.remove("tobii__slide--is-active"),w[v].sliderElements[e].setAttribute("aria-hidden","true"),i.onLeave(t)},k=e=>{if(void 0===w[v].sliderElements[e])return;const t=w[v].sliderElements[e].querySelector("[data-type]");Y(t).onCleanup(t),L.startX=0,L.startY=0,L.x=0,L.y=0,L.distance=0,x=0,F()&&ie()},R=()=>{y=-w[v].currentIndex*u.offsetWidth,w[v].slider.style.transform=`translate(${y}px, 0)`},U=()=>{R()},z=e=>{e.preventDefault(),v=I(e.currentTarget),T(w[v].gallery.indexOf(e.currentTarget))},H=e=>{e.target===p?N():e.target===h?P():(e.target===b||e.target.classList.contains("tobii__slide")&&l.docClose)&&X(),e.stopPropagation()},D=e=>{const t=Array.prototype.slice.call(u.querySelectorAll(`.tobii__btn:not([disabled]), .tobii__slide--is-active ${o.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(),X()):37===e.keyCode||"ArrowLeft"===e.code?(e.preventDefault(),N()):39!==e.keyCode&&"ArrowRight"!==e.code||(e.preventDefault(),P())},B=()=>{A=[],R(),w[v].slider.classList.remove("tobii__slider--is-"+(F()?"moving":"dragging"))},V=e=>{if(!ce(e.target)&&(e.preventDefault(),e.stopPropagation(),L.startX=L.x=e.pageX,L.startY=L.y=e.pageY,L.distance=0,A.push(e),2===A.length)){const{x:e,y:t}=te(A[0].pageX,A[0].pageY,A[1].pageX,A[1].pageY);L.startX=L.x=e,L.startY=L.y=t,L.distance=ee(A[0].pageX-A[1].pageX,A[0].pageY-A[1].pageY)/E.scale}},j=e=>{if(!A.length)return;w[v].slider.classList.add("tobii__slider--is-"+(F()?"moving":"dragging"));const t=A.findIndex(t=>t.pointerId===e.pointerId);if(A[t]=e,2===A.length){const{x:e,y:t}=te(A[0].pageX,A[0].pageY,A[1].pageX,A[1].pageY),i=ee(A[0].pageX-A[1].pageX,A[0].pageY-A[1].pageY)/L.distance;return Z(K(i,1,4),e,t,e-L.x,t-L.y),L.x=e,void(L.y=t)}if(F()&&Q(e.pageX-L.x,e.pageY-L.y),L.x=e.pageX,L.y=e.pageY,!F()){const e=L.startX-L.x,t=L.startY-L.y;if(ee(e,t)<10)return;Math.abs(e)>Math.abs(t)&&w[v].elementsLength>1?w[v].slider.style.transform=`translate(${y-Math.round(e)}px, 0)`:l.swipeClose&&(w[v].slider.style.transform=`translate(${y}px, -${Math.round(t)}px)`)}},W=e=>{e.stopPropagation(),w[v].slider.classList.remove("tobii__slider--is-"+(F()?"moving":"dragging"));const t=A.findIndex(t=>t.pointerId===e.pointerId);A.splice(t,1);const i=L.startX-L.x,r=L.startY-L.y,a=Math.abs(i),n=Math.abs(r);if(a||n)F()||(i<0&&a>l.threshold&&w[v].currentIndex>0?N():i>0&&a>l.threshold&&w[v].currentIndex!==w[v].elementsLength-1?P():r>0&&n>l.threshold&&l.swipeClose?X():R());else{const t=(new Date).getTime(),i=t-x;i<500&&i>100?(e.preventDefault(),x=0,F()?ie():Z(2,e.clientX,e.clientY,0,0)):(x=t,de()&&window.setTimeout(()=>{const{left:t,top:i,bottom:r,right:a,width:n}=e.target.getBoundingClientRect();L.startY<i||L.startY>r||!x||(L.startX>t&&L.startX<t+n/2?N():L.startX<a&&L.startX>a-n/2&&P())},500))}},G=e=>{const t=Math.sign(e.deltaY)>0?-1:1;(F()||t)&&(e.preventDefault(),Z(K(E.scale+t/(10/E.scale),1,4),e.pageX,e.pageY,0,0))},J=(e,t)=>{const{element:i,scale:r,originX:a,originY:n}=E,s="x"===e,o=s?a:n,l=s?"offsetWidth":"offsetHeight",d=i.parentNode[l],c=i[l],u=i.getBoundingClientRect(),p=(o-c/2)*(r-1),h=Math.max(0,Math.round(s?u.width:u.height)-d),b=Math.round(h/2);return K(t,0-b+p,b+p)},K=(e,t,i)=>Math.max(Math.min(e,i),t),F=()=>1!==E.scale,Q=(e,t)=>{0!==e&&(E.translateX=J("x",E.translateX+e)),0!==t&&(E.translateY=J("y",E.translateY+t));const{element:i,originX:r,originY:a,translateX:n,translateY:s,scale:o}=E;i.style.transformOrigin=`${r}px ${a}px`,i.style.transform=`translate(${n}px, ${s}px) scale(${o})`},Z=(e,t,i,r,a)=>{E.element||(E.element=u.querySelector(".tobii__slide--is-active img"));const{left:n,top:s}=E.element.getBoundingClientRect(),o=(i-s)/E.scale;E.originX=(t-n)/E.scale,E.originY=o,E.scale=e,Q(r,a)},ee=(e,t)=>Math.hypot(e,t),te=(e,t,i,r)=>({x:(e+i)/2,y:(t+r)/2}),ie=()=>{E.scale=1,E.originX=0,E.originY=0,E.translateX=0,E.translateY=0,Q(0,0),E.element=null},re=()=>{l.keyboard&&window.addEventListener("keydown",D),window.addEventListener("resize",U),window.addEventListener("popstate",X),ue("click",H),l.draggable&&(ue("pointerdown",V),ue("pointermove",j),ue("pointerup",W),ue("pointercancel",B),ue("pointerout",B),ue("pointerleave",B),ue("contextmenu",B)),ue("wheel",G)},ae=()=>{l.keyboard&&window.removeEventListener("keydown",D),window.removeEventListener("resize",U),window.removeEventListener("popstate",X),pe("click",H),l.draggable&&(pe("pointerdown",V),pe("pointermove",j),pe("pointerup",W),pe("pointercancel",B),pe("pointerout",B),pe("pointerleave",B),pe("contextmenu",B)),pe("wheel",G)},ne=()=>{l.draggable&&!w[v].slider.classList.contains("tobii__slider--is-draggable")&&w[v].slider.classList.add("tobii__slider--is-draggable"),!l.nav||1===w[v].elementsLength||"auto"===l.nav&&de()?(p.setAttribute("aria-hidden","true"),p.disabled=!0,h.setAttribute("aria-hidden","true"),h.disabled=!0):(p.setAttribute("aria-hidden","false"),p.disabled=!1,h.setAttribute("aria-hidden","false"),h.disabled=!1),g.setAttribute("aria-hidden",l.counter&&1!==w[v].elementsLength?"false":"true")},se=(e=null)=>{R(),g.textContent=`${w[v].currentIndex+1}/${w[v].elementsLength}`,(e=>{(!0===l.nav||"auto"===l.nav)&&!de()&&w[v].elementsLength>1?(p.setAttribute("aria-hidden","true"),p.disabled=!0,h.setAttribute("aria-hidden","true"),h.disabled=!0,1===w[v].elementsLength?l.close&&b.focus():0===w[v].currentIndex?(h.setAttribute("aria-hidden","false"),h.disabled=!1,h.focus()):w[v].currentIndex===w[v].elementsLength-1?(p.setAttribute("aria-hidden","false"),p.disabled=!1,p.focus()):(p.setAttribute("aria-hidden","false"),p.disabled=!1,h.setAttribute("aria-hidden","false"),h.disabled=!1,"left"===e?p.focus():h.focus())):l.close&&b.focus()})(e)},oe=()=>{le()&&X(),Object.entries(w).forEach(e=>{e[1].gallery.forEach(e=>{C(e)})}),w={},v=null;for(const e in s)s[e].onReset()},le=()=>"false"===u.getAttribute("aria-hidden"),de=()=>"ontouchstart"in window,ce=e=>-1!==["TEXTAREA","OPTION","INPUT","SELECT"].indexOf(e.nodeName)||e===p||e===h||e===b,ue=(e,t)=>{u.addEventListener(e,t)},pe=(e,t)=>{u.removeEventListener(e,t)};return(e=>{if(document.querySelector("div.tobii"))return void console.log("Multiple lightbox instances not supported.");l=(e=>({selector:".lightbox",captions:!0,captionsSelector:"img",captionAttribute:"alt",captionText:null,captionHTML:!1,nav:"auto",navText:['<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path stroke="none" d="M0 0h24v24H0z"/><polyline points="15 6 9 12 15 18" /></svg>','<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path stroke="none" d="M0 0h24v24H0z"/><polyline points="9 6 15 12 9 18" /></svg>'],navLabel:["Previous image","Next image"],close:!0,closeText:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path stroke="none" d="M0 0h24v24H0z"/><line x1="18" y1="6" x2="6" y2="18" /><line x1="6" y1="6" x2="18" y2="18" /></svg>',closeLabel:"Close lightbox",loadingIndicatorLabel:"Image loading",counter:!0,download:!1,downloadText:"",downloadLabel:"Download image",keyboard:!0,zoom:!0,zoomText:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path stroke="none" d="M0 0h24v24H0z"/><polyline points="16 4 20 4 20 8" /><line x1="14" y1="10" x2="20" y2="4" /><polyline points="8 20 4 20 4 16" /><line x1="4" y1="20" x2="10" y2="14" /><polyline points="16 20 20 20 20 16" /><line x1="14" y1="14" x2="20" y2="20" /><polyline points="8 4 4 4 4 8" /><line x1="4" y1="4" x2="10" y2="10" /></svg>',docClose:!0,swipeClose:!0,hideScrollbar:!0,draggable:!0,threshold:100,rtl:!1,loop:!1,autoplayVideo:!1,modal:!1,theme:"tobii--theme-default",...e}))(e),u||(u=document.createElement("div"),u.setAttribute("role","dialog"),u.setAttribute("aria-hidden","true"),u.classList.add("tobii"),u.classList.add(l.theme),p=document.createElement("button"),p.className="tobii__btn tobii__btn--previous",p.setAttribute("type","button"),p.setAttribute("aria-label",l.navLabel[0]),p.innerHTML=l.navText[0],u.appendChild(p),h=document.createElement("button"),h.className="tobii__btn tobii__btn--next",h.setAttribute("type","button"),h.setAttribute("aria-label",l.navLabel[1]),h.innerHTML=l.navText[1],u.appendChild(h),b=document.createElement("button"),b.className="tobii__btn tobii__btn--close",b.setAttribute("type","button"),b.setAttribute("aria-label",l.closeLabel),b.innerHTML=l.closeText,u.appendChild(b),g=document.createElement("div"),g.className="tobii__counter",u.appendChild(g),document.body.appendChild(u));const t=document.querySelectorAll(l.selector);if(!t)throw new Error(`Ups, I can't find the selector ${l.selector} on this website.`);const i=[];t.forEach(e=>{const t=e.hasAttribute("data-group")?e.getAttribute("data-group"):"default";let r=e.href;e.hasAttribute("data-target")&&(r=e.getAttribute("data-target")),r+="__"+t,void 0!==i[r]?e.addEventListener("click",e=>{$(t),T(),e.preventDefault()}):(i[r]=1,_(e))})})(n),a.open=T,a.previous=N,a.next=P,a.close=X,a.add=_,a.remove=C,a.reset=oe,a.destroy=()=>{oe(),u.parentNode.removeChild(u)},a.isOpen=le,a.slidesIndex=()=>w[v].currentIndex,a.select=e=>{const t=w[v].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===w[v].currentIndex)throw new Error(`Ups, slide ${e} is already selected.`);if(-1===e||e>=w[v].elementsLength)throw new Error(`Ups, I can't find slide ${e}.`)}w[v].currentIndex=e,O(t),M(e),e<t&&(se("left"),k(t),q(e-1)),e>t&&(se("right"),k(t),q(e+1))},a.slidesCount=()=>w[v].elementsLength,a.selectGroup=$,a.currentGroup=()=>v,a.on=ue,a.off=pe,a}export{a as default};

@@ -1,1 +0,1 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e||self).Tobii=t()}(this,function(){class e{constructor(){this.figcaptionId=0,this.userSettings=null}init(e,t,i){this.userSettings=i;const r=document.createElement("figure"),n=document.createElement("figcaption"),s=document.createElement("img"),a=e.querySelector("img"),o=document.createElement("div");if(r.style.opacity="0",a&&(s.alt=a.alt||""),s.setAttribute("src",""),s.setAttribute("data-src",e.href),e.hasAttribute("data-srcset")&&s.setAttribute("data-srcset",e.getAttribute("data-srcset")),r.appendChild(s),this.userSettings.captions){let t;"function"==typeof this.userSettings.captionText?t=this.userSettings.captionText(e):"self"===this.userSettings.captionsSelector&&e.getAttribute(this.userSettings.captionAttribute)?t=e.getAttribute(this.userSettings.captionAttribute):"img"===this.userSettings.captionsSelector&&a&&a.getAttribute(this.userSettings.captionAttribute)&&(t=a.getAttribute(this.userSettings.captionAttribute)),this.userSettings.captionHTML?n.innerHTML=t:n.textContent=t,t&&(n.id=`tobii-figcaption-${this.figcaptionId}`,r.appendChild(n),s.setAttribute("aria-labelledby",n.id),++this.figcaptionId)}t.appendChild(r),o.className="tobii__loader",o.setAttribute("role","progressbar"),o.setAttribute("aria-label",this.userSettings.loadingIndicatorLabel),t.appendChild(o),t.setAttribute("data-type","image"),t.classList.add("tobii-image")}onPreload(e){this.onLoad(e)}onLoad(e){const t=e.querySelector("img");if(!t.hasAttribute("data-src"))return;const i=e.querySelector("figure"),r=e.querySelector(".tobii__loader");t.addEventListener("load",()=>{e.removeChild(r),i.style.opacity="1"}),t.addEventListener("error",()=>{e.removeChild(r),i.style.opacity="1"}),t.setAttribute("src",t.getAttribute("data-src")),t.removeAttribute("data-src"),t.hasAttribute("data-srcset")&&t.setAttribute("srcset",t.getAttribute("data-srcset"))}onLeave(e){}onCleanup(e){}onReset(){this.figcaptionId=0}}class t{constructor(){this.userSettings=null}init(e,t,i){this.userSettings=i;const r=e.hasAttribute("data-target")?e.getAttribute("data-target"):e.getAttribute("href");t.setAttribute("data-HREF",r),e.getAttribute("data-allow")&&t.setAttribute("data-allow",e.getAttribute("data-allow")),e.hasAttribute("data-width")&&t.setAttribute("data-width",`${e.getAttribute("data-width")}`),e.hasAttribute("data-height")&&t.setAttribute("data-height",`${e.getAttribute("data-height")}`),t.setAttribute("data-type","iframe"),t.classList.add("tobii-iframe")}onPreload(e){}onLoad(e){let t=e.querySelector("iframe");const i=document.createElement("div");if(i.className="tobii__loader",i.setAttribute("role","progressbar"),i.setAttribute("aria-label",this.userSettings.loadingIndicatorLabel),e.appendChild(i),null==t){t=document.createElement("iframe");const i=e.getAttribute("data-href");t.setAttribute("frameborder","0"),t.setAttribute("src",i),t.setAttribute("allowfullscreen",""),i.indexOf("youtube.com")>-1?t.setAttribute("allow","accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"):i.indexOf("vimeo.com")>-1?t.setAttribute("allow","autoplay; picture-in-picture"):e.hasAttribute("data-allow")&&t.setAttribute("allow",e.getAttribute("data-allow")),e.getAttribute("data-width")&&(t.style.maxWidth=`${e.getAttribute("data-width")}`),e.getAttribute("data-height")&&(t.style.maxHeight=`${e.getAttribute("data-height")}`),t.style.opacity="0",e.appendChild(t),t.addEventListener("load",()=>{t.style.opacity="1";const i=e.querySelector(".tobii__loader");i&&e.removeChild(i)}),t.addEventListener("error",()=>{t.style.opacity="1";const i=e.querySelector(".tobii__loader");i&&e.removeChild(i)})}else t.setAttribute("src",e.getAttribute("data-href"))}onLeave(e){}onCleanup(e){const t=e.querySelector("iframe");t.setAttribute("src",""),t.style.opacity="0"}onReset(){}}class i{constructor(){this.userSettings=null}init(e,t,i){this.userSettings=i;const r=e.hasAttribute("data-target")?e.getAttribute("data-target"):e.getAttribute("href"),n=document.querySelector(r).cloneNode(!0);if(!n)throw new Error(`Ups, I can't find the target ${r}.`);t.appendChild(n),t.setAttribute("data-type","html"),t.classList.add("tobii-html")}onPreload(e){}onLoad(e,t){const i=e.querySelector("video");i&&(i.hasAttribute("data-time")&&i.readyState>0&&(i.currentTime=i.getAttribute("data-time")),this.userSettings.autoplayVideo&&i.play());const r=e.querySelector("audio");r&&this.userSettings.autoplayAudio&&r.play(),e.classList.add("tobii-group-"+t)}onLeave(e){const t=e.querySelector("video");t&&(t.paused||t.pause(),t.readyState>0&&t.setAttribute("data-time",t.currentTime));const i=e.querySelector("audio");i&&(i.paused||i.pause())}onCleanup(e){const t=e.querySelector("video");if(t&&t.readyState>0&&t.readyState<3&&t.duration!==t.currentTime){const i=t.cloneNode(!0);this._removeSources(t),t.load(),t.parentNode.removeChild(t),e.appendChild(i)}}onReset(){}_removeSources(e){const t=e.querySelectorAll("src");t&&t.forEach(e=>{e.setAttribute("src","")})}}class r{constructor(){this.playerId=0,this.PLAYER=[],this.userSettings=null}init(e,t,i){this.userSettings=i;const r=document.createElement("div");t.appendChild(r),this.PLAYER[this.playerId]=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",this.playerId),t.setAttribute("data-type","youtube"),t.classList.add("tobii-youtube"),this.playerId++}onPreload(e){}onLoad(e){this.userSettings.autoplayVideo&&this.PLAYER[e.getAttribute("data-player")].playVideo()}onLeave(e){1===this.PLAYER[e.getAttribute("data-player")].getPlayerState()&&this.PLAYER[e.getAttribute("data-player")].pauseVideo()}onCleanup(e){1===this.PLAYER[e.getAttribute("data-player")].getPlayerState()&&this.PLAYER[e.getAttribute("data-player")].pauseVideo()}onReset(){}}return function n(s){const a={image:new e,html:new i,iframe:new t,youtube:new r},o=['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])'];let d={};const l=[],u={gallery:[],slider:null,sliderElements:[],elementsLength:0,currentIndex:0,x:0};let c=null,p=null,b=null,h=null,g=null,m={},y=!1,f=!1,v=!1,w=null,A=null,E=null,L=!1,x=!1,_={},S=null,I=null;const C=e=>{if(null===document.querySelector('[data-type="youtube"]')||x)P(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===l.indexOf(e)&&l.push(e),window.onYouTubePlayerAPIReady=()=>{l.forEach(e=>{P(e)}),x=!0}}},T=e=>e.hasAttribute("data-group")?e.getAttribute("data-group"):"default",P=e=>{if(S=T(e),Object.prototype.hasOwnProperty.call(_,S)||(_[S]=JSON.parse(JSON.stringify(u)),Y()),-1!==_[S].gallery.indexOf(e))throw new Error("Ups, element already added.");if(_[S].gallery.push(e),_[S].elementsLength++,d.zoom&&e.querySelector("img")&&"false"!==e.getAttribute("data-zoom")||"true"===e.getAttribute("data-zoom")){const t=document.createElement("div");t.className="tobii-zoom__icon",t.innerHTML=d.zoomText,e.classList.add("tobii-zoom"),e.appendChild(t)}e.addEventListener("click",F),N(e),ue()&&S===I&&(oe(),de())},q=e=>{const t=T(e);if(-1===_[t].gallery.indexOf(e))throw new Error(`Ups, I can't find a slide for the element ${e}.`);{const i=_[t].gallery.indexOf(e),r=_[t].sliderElements[i];if(ue()&&t===I&&i===_[t].currentIndex){if(1===_[t].elementsLength)throw U(),new Error("Ups, I've closed. There are no slides more to show.");0===_[t].currentIndex?M():z(),oe(),de()}if(_[t].gallery.splice(_[t].gallery.indexOf(e)),_[t].sliderElements.splice(_[t].gallery.indexOf(e)),_[t].elementsLength--,--_[t].x,d.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",F),r.parentNode.removeChild(r)}},Y=()=>{_[S].slider=document.createElement("div"),_[S].slider.className="tobii__slider",_[S].slider.setAttribute("aria-hidden","true"),c.appendChild(_[S].slider)},N=e=>{const t=k(e),i=document.createElement("div"),r=document.createElement("div");i.className="tobii__slide",i.style.position="absolute",i.style.left=100*_[S].x+"%",i.setAttribute("aria-hidden","true"),t.init(e,r,d),i.appendChild(r),_[S].slider.appendChild(i),_[S].sliderElements.push(i),++_[S].x},k=e=>{const t=e.getAttribute("data-type");return void 0!==a[t]?a[t]:(e.hasAttribute("data-type")&&console.log("Unknown lightbox element type: "+t),a.image)},O=e=>{if(I=null!==I?I:S,ue())throw new Error("Ups, I'm aleady open.");if(!ue()&&(e||(e=0),-1===e||e>=_[I].elementsLength))throw new Error(`Ups, I can't find slide ${e}.`);document.documentElement.classList.add("tobii-is-open"),document.body.classList.add("tobii-is-open"),document.body.classList.add("tobii-is-open-"+I),oe(),d.close||(h.disabled=!1,h.setAttribute("aria-hidden","true")),w=document.activeElement;const t=window.location.href;window.history.pushState({tobii:"close"},"Image",t),_[I].currentIndex=e,V(),se(),$(_[I].currentIndex),_[I].slider.setAttribute("aria-hidden","false"),c.setAttribute("aria-hidden","false"),de(),X(_[I].currentIndex+1),X(_[I].currentIndex-1),_[I].slider.classList.add("tobii__slider--animate");const i=new window.CustomEvent("open",{detail:{group:I}});c.dispatchEvent(i)},U=()=>{if(!ue())throw new Error("Ups, I'm already closed.");document.documentElement.classList.remove("tobii-is-open"),document.body.classList.remove("tobii-is-open"),document.body.classList.remove("tobii-is-open-"+I),ae(),null!==window.history.state&&"close"===window.history.state.tobii&&window.history.back(),w.focus(),H(_[I].currentIndex),D(_[I].currentIndex),c.setAttribute("aria-hidden","true"),_[I].slider.setAttribute("aria-hidden","true"),_[I].currentIndex=0,_[I].slider.classList.remove("tobii__slider--animate");const e=new window.CustomEvent("close",{detail:{group:I}});c.dispatchEvent(e)},X=e=>{if(void 0===_[I].sliderElements[e])return;const t=_[I].sliderElements[e].querySelector("[data-type]");k(t).onPreload(t)},$=e=>{if(void 0===_[I].sliderElements[e])return;const t=_[I].sliderElements[e].querySelector("[data-type]"),i=k(t);_[I].sliderElements[e].classList.add("tobii__slide--is-active"),_[I].sliderElements[e].setAttribute("aria-hidden","false"),i.onLoad(t,I)},z=()=>{if(!ue())throw new Error("Ups, I'm closed.");_[I].currentIndex>0&&(H(_[I].currentIndex),$(--_[I].currentIndex),de("left"),D(_[I].currentIndex+1),X(_[I].currentIndex-1));const e=new window.CustomEvent("previous",{detail:{group:I}});c.dispatchEvent(e)},M=()=>{if(!ue())throw new Error("Ups, I'm closed.");_[I].currentIndex<_[I].elementsLength-1&&(H(_[I].currentIndex),$(++_[I].currentIndex),de("right"),D(_[I].currentIndex-1),X(_[I].currentIndex+1));const e=new window.CustomEvent("next",{detail:{group:I}});c.dispatchEvent(e)},R=e=>{if(ue())throw new Error("Ups, I'm open.");if(!e)throw new Error("Ups, no group specified.");if(e&&!Object.prototype.hasOwnProperty.call(_,e))throw new Error(`Ups, I don't have a group called "${e}".`);I=e},H=e=>{if(void 0===_[I].sliderElements[e])return;const t=_[I].sliderElements[e].querySelector("[data-type]"),i=k(t);_[I].sliderElements[e].classList.remove("tobii__slide--is-active"),_[I].sliderElements[e].setAttribute("aria-hidden","true"),i.onLeave(t)},D=e=>{if(void 0===_[I].sliderElements[e])return;const t=_[I].sliderElements[e].querySelector("[data-type]");k(t).onCleanup(t)},B=()=>{I=null!==I?I:S,A=-_[I].currentIndex*c.offsetWidth,_[I].slider.style.transform=`translate3d(${A}px, 0, 0)`,E=A},V=()=>{m={startX:0,endX:0,startY:0,endY:0}},j=()=>{const e=m.endX-m.startX,t=m.endY-m.startY,i=Math.abs(e),r=Math.abs(t);e>0&&i>d.threshold&&_[I].currentIndex>0?z():e<0&&i>d.threshold&&_[I].currentIndex!==_[I].elementsLength-1?M():t<0&&r>d.threshold&&d.swipeClose?U():B()},W=()=>{L||(L=!0,window.requestAnimationFrame(()=>{B(),L=!1}))},F=e=>{e.preventDefault(),I=T(e.currentTarget),O(_[I].gallery.indexOf(e.currentTarget))},G=e=>{e.target===p?z():e.target===b?M():(e.target===h||!1===y&&!1===f&&e.target.classList.contains("tobii__slide")&&d.docClose)&&U(),e.stopPropagation()},J=e=>{const t=Array.prototype.slice.call(c.querySelectorAll(`.tobii__btn:not([disabled]), .tobii__slide--is-active ${o.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(),U()):37===e.keyCode||"ArrowLeft"===e.code?(e.preventDefault(),z()):39!==e.keyCode&&"ArrowRight"!==e.code||(e.preventDefault(),M())},K=e=>{pe(e.target)||(e.stopPropagation(),y=!1,f=!1,v=!0,m.startX=e.touches[0].pageX,m.startY=e.touches[0].pageY,ce()&&_[I].slider.classList.add("tobii__slider--is-dragging"))},Q=e=>{e.stopPropagation(),v&&(m.endX=e.touches[0].pageX,m.endY=e.touches[0].pageY,ne())},Z=e=>{e.stopPropagation(),v=!1,_[I].slider.classList.remove("tobii__slider--is-dragging"),m.endX&&j(),V()},ee=e=>{pe(e.target)||(e.preventDefault(),e.stopPropagation(),y=!1,f=!1,v=!0,m.startX=e.pageX,m.startY=e.pageY,ce()&&_[I].slider.classList.add("tobii__slider--is-dragging"))},te=e=>{e.preventDefault(),v&&(m.endX=e.pageX,m.endY=e.pageY,ne())},ie=e=>{e.stopPropagation(),v=!1,_[I].slider.classList.remove("tobii__slider--is-dragging"),m.endX&&j(),V()},re=()=>{v=!1},ne=()=>{Math.abs(m.startX-m.endX)>0&&!f&&_[I].elementsLength>1?(_[I].slider.style.transform=`translate3d(${E-Math.round(m.startX-m.endX)}px, 0, 0)`,y=!0,f=!1):Math.abs(m.startY-m.endY)>0&&!y&&d.swipeClose&&(_[I].slider.style.transform=`translate3d(${E}px, -${Math.round(m.startY-m.endY)}px, 0)`,y=!1,f=!0)},se=()=>{d.keyboard&&window.addEventListener("keydown",J),window.addEventListener("resize",W),window.addEventListener("popstate",U),c.addEventListener("click",G),d.draggable&&ce()&&(c.addEventListener("touchstart",K),c.addEventListener("touchmove",Q),c.addEventListener("touchend",Z),c.addEventListener("mousedown",ee),c.addEventListener("mouseup",ie),c.addEventListener("mousemove",te),c.addEventListener("contextmenu",re))},ae=()=>{d.keyboard&&window.removeEventListener("keydown",J),window.removeEventListener("resize",W),window.removeEventListener("popstate",U),c.removeEventListener("click",G),d.draggable&&ce()&&(c.removeEventListener("touchstart",K),c.removeEventListener("touchmove",Q),c.removeEventListener("touchend",Z),c.removeEventListener("mousedown",ee),c.removeEventListener("mouseup",ie),c.removeEventListener("mousemove",te),c.removeEventListener("contextmenu",re))},oe=()=>{(d.draggable&&d.swipeClose&&ce()&&!_[I].slider.classList.contains("tobii__slider--is-draggable")||d.draggable&&_[I].elementsLength>1&&!_[I].slider.classList.contains("tobii__slider--is-draggable"))&&_[I].slider.classList.add("tobii__slider--is-draggable"),!d.nav||1===_[I].elementsLength||"auto"===d.nav&&ce()?(p.setAttribute("aria-hidden","true"),p.disabled=!0,b.setAttribute("aria-hidden","true"),b.disabled=!0):(p.setAttribute("aria-hidden","false"),p.disabled=!1,b.setAttribute("aria-hidden","false"),b.disabled=!1),g.setAttribute("aria-hidden",d.counter&&1!==_[I].elementsLength?"false":"true")},de=(e=null)=>{B(),g.textContent=`${_[I].currentIndex+1}/${_[I].elementsLength}`,(e=>{(!0===d.nav||"auto"===d.nav)&&!ce()&&_[I].elementsLength>1?(p.setAttribute("aria-hidden","true"),p.disabled=!0,b.setAttribute("aria-hidden","true"),b.disabled=!0,1===_[I].elementsLength?d.close&&h.focus():0===_[I].currentIndex?(b.setAttribute("aria-hidden","false"),b.disabled=!1,b.focus()):_[I].currentIndex===_[I].elementsLength-1?(p.setAttribute("aria-hidden","false"),p.disabled=!1,p.focus()):(p.setAttribute("aria-hidden","false"),p.disabled=!1,b.setAttribute("aria-hidden","false"),b.disabled=!1,"left"===e?p.focus():b.focus())):d.close&&h.focus()})(e)},le=()=>{ue()&&U(),Object.entries(_).forEach(e=>{e[1].gallery.forEach(e=>{q(e)})}),_={},S=I=null;for(const e in a)a[e].onReset()},ue=()=>"false"===c.getAttribute("aria-hidden"),ce=()=>"ontouchstart"in window,pe=e=>-1!==["TEXTAREA","OPTION","INPUT","SELECT"].indexOf(e.nodeName)||e===p||e===b||e===h;return(e=>{if(document.querySelector("div.tobii"))return void console.log("Multiple lightbox instances not supported.");d=(e=>({selector:".lightbox",captions:!0,captionsSelector:"img",captionAttribute:"alt",captionText:null,captionHTML:!1,nav:"auto",navText:['<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path stroke="none" d="M0 0h24v24H0z"/><polyline points="15 6 9 12 15 18" /></svg>','<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path stroke="none" d="M0 0h24v24H0z"/><polyline points="9 6 15 12 9 18" /></svg>'],navLabel:["Previous image","Next image"],close:!0,closeText:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path stroke="none" d="M0 0h24v24H0z"/><line x1="18" y1="6" x2="6" y2="18" /><line x1="6" y1="6" x2="18" y2="18" /></svg>',closeLabel:"Close lightbox",loadingIndicatorLabel:"Image loading",counter:!0,download:!1,downloadText:"",downloadLabel:"Download image",keyboard:!0,zoom:!0,zoomText:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path stroke="none" d="M0 0h24v24H0z"/><polyline points="16 4 20 4 20 8" /><line x1="14" y1="10" x2="20" y2="4" /><polyline points="8 20 4 20 4 16" /><line x1="4" y1="20" x2="10" y2="14" /><polyline points="16 20 20 20 20 16" /><line x1="14" y1="14" x2="20" y2="20" /><polyline points="8 4 4 4 4 8" /><line x1="4" y1="4" x2="10" y2="10" /></svg>',docClose:!0,swipeClose:!0,hideScrollbar:!0,draggable:!0,threshold:100,rtl:!1,loop:!1,autoplayVideo:!1,modal:!1,theme:"tobii--theme-default",...e}))(e),c||(c=document.createElement("div"),c.setAttribute("role","dialog"),c.setAttribute("aria-hidden","true"),c.classList.add("tobii"),c.classList.add(d.theme),p=document.createElement("button"),p.className="tobii__btn tobii__btn--previous",p.setAttribute("type","button"),p.setAttribute("aria-label",d.navLabel[0]),p.innerHTML=d.navText[0],c.appendChild(p),b=document.createElement("button"),b.className="tobii__btn tobii__btn--next",b.setAttribute("type","button"),b.setAttribute("aria-label",d.navLabel[1]),b.innerHTML=d.navText[1],c.appendChild(b),h=document.createElement("button"),h.className="tobii__btn tobii__btn--close",h.setAttribute("type","button"),h.setAttribute("aria-label",d.closeLabel),h.innerHTML=d.closeText,c.appendChild(h),g=document.createElement("div"),g.className="tobii__counter",c.appendChild(g),document.body.appendChild(c));const t=document.querySelectorAll(d.selector);if(!t)throw new Error(`Ups, I can't find the selector ${d.selector} on this website.`);const i=[];t.forEach(e=>{const t=e.hasAttribute("data-group")?e.getAttribute("data-group"):"default";let r=e.href;e.hasAttribute("data-target")&&(r=e.getAttribute("data-target")),r+="__"+t,void 0!==i[r]?e.addEventListener("click",e=>{R(t),O(),e.preventDefault()}):(i[r]=1,C(e))})})(s),n.open=O,n.previous=z,n.next=M,n.close=U,n.add=C,n.remove=q,n.reset=le,n.destroy=()=>{le(),c.parentNode.removeChild(c)},n.isOpen=ue,n.slidesIndex=()=>_[I].currentIndex,n.select=e=>{const t=_[I].currentIndex;if(!ue())throw new Error("Ups, I'm closed.");if(ue()){if(!e&&0!==e)throw new Error("Ups, no slide specified.");if(e===_[I].currentIndex)throw new Error(`Ups, slide ${e} is already selected.`);if(-1===e||e>=_[I].elementsLength)throw new Error(`Ups, I can't find slide ${e}.`)}_[I].currentIndex=e,H(t),$(e),e<t&&(de("left"),D(t),X(e-1)),e>t&&(de("right"),D(t),X(e+1))},n.slidesCount=()=>_[I].elementsLength,n.selectGroup=R,n.currentGroup=()=>null!==I?I:S,n.on=(e,t)=>{c.addEventListener(e,t)},n.off=(e,t)=>{c.removeEventListener(e,t)},n}});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e||self).Tobii=t()}(this,function(){class e{constructor(){this.figcaptionId=0,this.userSettings=null}init(e,t,i){this.userSettings=i;const r=document.createElement("figure"),n=document.createElement("figcaption"),a=document.createElement("img"),s=e.querySelector("img"),o=document.createElement("div");if(r.style.opacity="0",s&&(a.alt=s.alt||""),a.setAttribute("src",""),a.setAttribute("data-src",e.href),e.hasAttribute("data-srcset")&&a.setAttribute("data-srcset",e.getAttribute("data-srcset")),r.appendChild(a),this.userSettings.captions){let t;"function"==typeof this.userSettings.captionText?t=this.userSettings.captionText(e):"self"===this.userSettings.captionsSelector&&e.getAttribute(this.userSettings.captionAttribute)?t=e.getAttribute(this.userSettings.captionAttribute):"img"===this.userSettings.captionsSelector&&s&&s.getAttribute(this.userSettings.captionAttribute)&&(t=s.getAttribute(this.userSettings.captionAttribute)),this.userSettings.captionHTML?n.innerHTML=t:n.textContent=t,t&&(n.id=`tobii-figcaption-${this.figcaptionId}`,r.appendChild(n),a.setAttribute("aria-labelledby",n.id),++this.figcaptionId)}t.appendChild(r),o.className="tobii__loader",o.setAttribute("role","progressbar"),o.setAttribute("aria-label",this.userSettings.loadingIndicatorLabel),t.appendChild(o),t.setAttribute("data-type","image"),t.classList.add("tobii-image")}onPreload(e){this.onLoad(e)}onLoad(e){const t=e.querySelector("img");if(!t.hasAttribute("data-src"))return;const i=e.querySelector("figure"),r=e.querySelector(".tobii__loader");t.addEventListener("load",()=>{e.removeChild(r),i.style.opacity="1"}),t.addEventListener("error",()=>{e.removeChild(r),i.style.opacity="1"}),t.setAttribute("src",t.getAttribute("data-src")),t.removeAttribute("data-src"),t.hasAttribute("data-srcset")&&t.setAttribute("srcset",t.getAttribute("data-srcset"))}onLeave(e){}onCleanup(e){}onReset(){this.figcaptionId=0}}class t{constructor(){this.userSettings=null}init(e,t,i){this.userSettings=i;const r=e.hasAttribute("data-target")?e.getAttribute("data-target"):e.getAttribute("href");t.setAttribute("data-HREF",r),e.getAttribute("data-allow")&&t.setAttribute("data-allow",e.getAttribute("data-allow")),e.hasAttribute("data-width")&&t.setAttribute("data-width",`${e.getAttribute("data-width")}`),e.hasAttribute("data-height")&&t.setAttribute("data-height",`${e.getAttribute("data-height")}`),t.setAttribute("data-type","iframe"),t.classList.add("tobii-iframe")}onPreload(e){}onLoad(e){let t=e.querySelector("iframe");const i=document.createElement("div");if(i.className="tobii__loader",i.setAttribute("role","progressbar"),i.setAttribute("aria-label",this.userSettings.loadingIndicatorLabel),e.appendChild(i),null==t){t=document.createElement("iframe");const i=e.getAttribute("data-href");t.setAttribute("frameborder","0"),t.setAttribute("src",i),t.setAttribute("allowfullscreen",""),i.indexOf("youtube.com")>-1?t.setAttribute("allow","accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"):i.indexOf("vimeo.com")>-1?t.setAttribute("allow","autoplay; picture-in-picture"):e.hasAttribute("data-allow")&&t.setAttribute("allow",e.getAttribute("data-allow")),e.getAttribute("data-width")&&(t.style.maxWidth=`${e.getAttribute("data-width")}`),e.getAttribute("data-height")&&(t.style.maxHeight=`${e.getAttribute("data-height")}`),t.style.opacity="0",e.appendChild(t),t.addEventListener("load",()=>{t.style.opacity="1";const i=e.querySelector(".tobii__loader");i&&e.removeChild(i)}),t.addEventListener("error",()=>{t.style.opacity="1";const i=e.querySelector(".tobii__loader");i&&e.removeChild(i)})}else t.setAttribute("src",e.getAttribute("data-href"))}onLeave(e){}onCleanup(e){const t=e.querySelector("iframe");t.setAttribute("src",""),t.style.opacity="0"}onReset(){}}class i{constructor(){this.userSettings=null}init(e,t,i){this.userSettings=i;const r=e.hasAttribute("data-target")?e.getAttribute("data-target"):e.getAttribute("href"),n=document.querySelector(r).cloneNode(!0);if(!n)throw new Error(`Ups, I can't find the target ${r}.`);t.appendChild(n),t.setAttribute("data-type","html"),t.classList.add("tobii-html")}onPreload(e){}onLoad(e,t){const i=e.querySelector("video");i&&(i.hasAttribute("data-time")&&i.readyState>0&&(i.currentTime=i.getAttribute("data-time")),this.userSettings.autoplayVideo&&i.play());const r=e.querySelector("audio");r&&this.userSettings.autoplayAudio&&r.play(),e.classList.add("tobii-group-"+t)}onLeave(e){const t=e.querySelector("video");t&&(t.paused||t.pause(),t.readyState>0&&t.setAttribute("data-time",t.currentTime));const i=e.querySelector("audio");i&&(i.paused||i.pause())}onCleanup(e){const t=e.querySelector("video");if(t&&t.readyState>0&&t.readyState<3&&t.duration!==t.currentTime){const i=t.cloneNode(!0);this._removeSources(t),t.load(),t.parentNode.removeChild(t),e.appendChild(i)}}onReset(){}_removeSources(e){const t=e.querySelectorAll("src");t&&t.forEach(e=>{e.setAttribute("src","")})}}class r{constructor(){this.playerId=0,this.PLAYER=[],this.userSettings=null}init(e,t,i){this.userSettings=i;const r=document.createElement("div");t.appendChild(r),this.PLAYER[this.playerId]=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",this.playerId),t.setAttribute("data-type","youtube"),t.classList.add("tobii-youtube"),this.playerId++}onPreload(e){}onLoad(e){this.userSettings.autoplayVideo&&this.PLAYER[e.getAttribute("data-player")].playVideo()}onLeave(e){1===this.PLAYER[e.getAttribute("data-player")].getPlayerState()&&this.PLAYER[e.getAttribute("data-player")].pauseVideo()}onCleanup(e){1===this.PLAYER[e.getAttribute("data-player")].getPlayerState()&&this.PLAYER[e.getAttribute("data-player")].pauseVideo()}onReset(){}}return function n(a){const s={image:new e,html:new i,iframe:new t,youtube:new r},o=['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])'];let l={};const d=[],c={gallery:[],slider:null,sliderElements:[],elementsLength:0,currentIndex:0,x:0};let u=null,p=null,h=null,b=null,g=null,m=null,y=null,f=!1,w={},v=null,A=[],x=0;const E={element:null,originX:0,originY:0,translateX:0,translateY:0,scale:1},L={startX:0,startY:0,x:0,y:0,distance:0},_=e=>{if(null===document.querySelector('[data-type="youtube"]')||f)S(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===d.indexOf(e)&&d.push(e),window.onYouTubePlayerAPIReady=()=>{d.forEach(e=>{S(e)}),f=!0}}},I=e=>e.hasAttribute("data-group")?e.getAttribute("data-group"):"default",S=e=>{const t=I(e);if(Object.prototype.hasOwnProperty.call(w,t)||(w[t]=JSON.parse(JSON.stringify(c)),w[t].slider=document.createElement("div"),w[t].slider.className="tobii__slider",w[t].slider.setAttribute("aria-hidden","true"),u.appendChild(w[t].slider)),-1!==w[t].gallery.indexOf(e))throw new Error("Ups, element already added.");{if(w[t].gallery.push(e),w[t].elementsLength++,l.zoom&&e.querySelector("img")&&"false"!==e.getAttribute("data-zoom")||"true"===e.getAttribute("data-zoom")){const t=document.createElement("div");t.className="tobii-zoom__icon",t.innerHTML=l.zoomText,e.classList.add("tobii-zoom"),e.appendChild(t)}e.addEventListener("click",z);const i=Y(e),r=document.createElement("div"),n=document.createElement("div");r.className="tobii__slide",r.style.position="absolute",r.style.left=100*w[t].x+"%",r.setAttribute("aria-hidden","true"),i.init(e,n,l),r.appendChild(n),w[t].slider.appendChild(r),w[t].sliderElements.push(r),++w[t].x,le()&&t===v&&(ae(),se())}},C=e=>{const t=I(e);if(-1===w[t].gallery.indexOf(e))throw new Error(`Ups, I can't find a slide for the element ${e}.`);{const i=w[t].gallery.indexOf(e),r=w[t].sliderElements[i];if(le()&&t===v&&i===w[t].currentIndex){if(1===w[t].elementsLength)throw X(),new Error("Ups, I've closed. There are no slides more to show.");0===w[t].currentIndex?P():N(),ae(),se()}if(w[t].gallery.splice(w[t].gallery.indexOf(e)),w[t].sliderElements.splice(w[t].gallery.indexOf(e)),w[t].elementsLength--,--w[t].x,l.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",z),r.parentNode.removeChild(r)}},Y=e=>{const t=e.getAttribute("data-type");return void 0!==s[t]?s[t]:(e.hasAttribute("data-type")&&console.log("Unknown lightbox element type: "+t),s.image)},T=(e=0)=>{if(le())throw new Error("Ups, I'm aleady open.");if(-1===e||e>=w[v].elementsLength)throw new Error(`Ups, I can't find slide ${e}.`);document.documentElement.classList.add("tobii-is-open"),document.body.classList.add("tobii-is-open"),document.body.classList.add("tobii-is-open-"+v),ae(),l.close||(b.disabled=!1,b.setAttribute("aria-hidden","true")),m=document.activeElement;const t=window.location.href;window.history.pushState({tobii:"close"},"Image",t),w[v].currentIndex=e,re(),M(w[v].currentIndex),w[v].slider.setAttribute("aria-hidden","false"),u.setAttribute("aria-hidden","false"),se(),q(w[v].currentIndex+1),q(w[v].currentIndex-1),w[v].slider.classList.add("tobii__slider--animate");const i=new window.CustomEvent("open",{detail:{group:v}});u.dispatchEvent(i)},X=()=>{if(!le())throw new Error("Ups, I'm already closed.");document.documentElement.classList.remove("tobii-is-open"),document.body.classList.remove("tobii-is-open"),document.body.classList.remove("tobii-is-open-"+v),ne(),null!==window.history.state&&"close"===window.history.state.tobii&&window.history.back(),m.focus(),O(w[v].currentIndex),k(w[v].currentIndex),u.setAttribute("aria-hidden","true"),w[v].slider.setAttribute("aria-hidden","true"),w[v].currentIndex=0,w[v].slider.classList.remove("tobii__slider--animate");const e=new window.CustomEvent("close",{detail:{group:v}});u.dispatchEvent(e)},q=e=>{if(void 0===w[v].sliderElements[e])return;const t=w[v].sliderElements[e].querySelector("[data-type]");Y(t).onPreload(t)},M=e=>{if(void 0===w[v].sliderElements[e])return;const t=w[v].sliderElements[e].querySelector("[data-type]"),i=Y(t);w[v].sliderElements[e].classList.add("tobii__slide--is-active"),w[v].sliderElements[e].setAttribute("aria-hidden","false"),i.onLoad(t,v)},N=()=>{if(!le())throw new Error("Ups, I'm closed.");w[v].currentIndex>0&&(O(w[v].currentIndex),M(--w[v].currentIndex),se("left"),k(w[v].currentIndex+1),q(w[v].currentIndex-1));const e=new window.CustomEvent("previous",{detail:{group:v}});u.dispatchEvent(e)},P=()=>{if(!le())throw new Error("Ups, I'm closed.");w[v].currentIndex<w[v].elementsLength-1&&(O(w[v].currentIndex),M(++w[v].currentIndex),se("right"),k(w[v].currentIndex-1),q(w[v].currentIndex+1));const e=new window.CustomEvent("next",{detail:{group:v}});u.dispatchEvent(e)},$=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(w,e))throw new Error(`Ups, I don't have a group called "${e}".`);v=e},O=e=>{if(void 0===w[v].sliderElements[e])return;const t=w[v].sliderElements[e].querySelector("[data-type]"),i=Y(t);w[v].sliderElements[e].classList.remove("tobii__slide--is-active"),w[v].sliderElements[e].setAttribute("aria-hidden","true"),i.onLeave(t)},k=e=>{if(void 0===w[v].sliderElements[e])return;const t=w[v].sliderElements[e].querySelector("[data-type]");Y(t).onCleanup(t),L.startX=0,L.startY=0,L.x=0,L.y=0,L.distance=0,x=0,F()&&ie()},R=()=>{y=-w[v].currentIndex*u.offsetWidth,w[v].slider.style.transform=`translate(${y}px, 0)`},U=()=>{R()},z=e=>{e.preventDefault(),v=I(e.currentTarget),T(w[v].gallery.indexOf(e.currentTarget))},H=e=>{e.target===p?N():e.target===h?P():(e.target===b||e.target.classList.contains("tobii__slide")&&l.docClose)&&X(),e.stopPropagation()},D=e=>{const t=Array.prototype.slice.call(u.querySelectorAll(`.tobii__btn:not([disabled]), .tobii__slide--is-active ${o.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(),X()):37===e.keyCode||"ArrowLeft"===e.code?(e.preventDefault(),N()):39!==e.keyCode&&"ArrowRight"!==e.code||(e.preventDefault(),P())},B=()=>{A=[],R(),w[v].slider.classList.remove("tobii__slider--is-"+(F()?"moving":"dragging"))},V=e=>{if(!ce(e.target)&&(e.preventDefault(),e.stopPropagation(),L.startX=L.x=e.pageX,L.startY=L.y=e.pageY,L.distance=0,A.push(e),2===A.length)){const{x:e,y:t}=te(A[0].pageX,A[0].pageY,A[1].pageX,A[1].pageY);L.startX=L.x=e,L.startY=L.y=t,L.distance=ee(A[0].pageX-A[1].pageX,A[0].pageY-A[1].pageY)/E.scale}},j=e=>{if(!A.length)return;w[v].slider.classList.add("tobii__slider--is-"+(F()?"moving":"dragging"));const t=A.findIndex(t=>t.pointerId===e.pointerId);if(A[t]=e,2===A.length){const{x:e,y:t}=te(A[0].pageX,A[0].pageY,A[1].pageX,A[1].pageY),i=ee(A[0].pageX-A[1].pageX,A[0].pageY-A[1].pageY)/L.distance;return Z(K(i,1,4),e,t,e-L.x,t-L.y),L.x=e,void(L.y=t)}if(F()&&Q(e.pageX-L.x,e.pageY-L.y),L.x=e.pageX,L.y=e.pageY,!F()){const e=L.startX-L.x,t=L.startY-L.y;if(ee(e,t)<10)return;Math.abs(e)>Math.abs(t)&&w[v].elementsLength>1?w[v].slider.style.transform=`translate(${y-Math.round(e)}px, 0)`:l.swipeClose&&(w[v].slider.style.transform=`translate(${y}px, -${Math.round(t)}px)`)}},W=e=>{e.stopPropagation(),w[v].slider.classList.remove("tobii__slider--is-"+(F()?"moving":"dragging"));const t=A.findIndex(t=>t.pointerId===e.pointerId);A.splice(t,1);const i=L.startX-L.x,r=L.startY-L.y,n=Math.abs(i),a=Math.abs(r);if(n||a)F()||(i<0&&n>l.threshold&&w[v].currentIndex>0?N():i>0&&n>l.threshold&&w[v].currentIndex!==w[v].elementsLength-1?P():r>0&&a>l.threshold&&l.swipeClose?X():R());else{const t=(new Date).getTime(),i=t-x;i<500&&i>100?(e.preventDefault(),x=0,F()?ie():Z(2,e.clientX,e.clientY,0,0)):(x=t,de()&&window.setTimeout(()=>{const{left:t,top:i,bottom:r,right:n,width:a}=e.target.getBoundingClientRect();L.startY<i||L.startY>r||!x||(L.startX>t&&L.startX<t+a/2?N():L.startX<n&&L.startX>n-a/2&&P())},500))}},G=e=>{const t=Math.sign(e.deltaY)>0?-1:1;(F()||t)&&(e.preventDefault(),Z(K(E.scale+t/(10/E.scale),1,4),e.pageX,e.pageY,0,0))},J=(e,t)=>{const{element:i,scale:r,originX:n,originY:a}=E,s="x"===e,o=s?n:a,l=s?"offsetWidth":"offsetHeight",d=i.parentNode[l],c=i[l],u=i.getBoundingClientRect(),p=(o-c/2)*(r-1),h=Math.max(0,Math.round(s?u.width:u.height)-d),b=Math.round(h/2);return K(t,0-b+p,b+p)},K=(e,t,i)=>Math.max(Math.min(e,i),t),F=()=>1!==E.scale,Q=(e,t)=>{0!==e&&(E.translateX=J("x",E.translateX+e)),0!==t&&(E.translateY=J("y",E.translateY+t));const{element:i,originX:r,originY:n,translateX:a,translateY:s,scale:o}=E;i.style.transformOrigin=`${r}px ${n}px`,i.style.transform=`translate(${a}px, ${s}px) scale(${o})`},Z=(e,t,i,r,n)=>{E.element||(E.element=u.querySelector(".tobii__slide--is-active img"));const{left:a,top:s}=E.element.getBoundingClientRect(),o=(i-s)/E.scale;E.originX=(t-a)/E.scale,E.originY=o,E.scale=e,Q(r,n)},ee=(e,t)=>Math.hypot(e,t),te=(e,t,i,r)=>({x:(e+i)/2,y:(t+r)/2}),ie=()=>{E.scale=1,E.originX=0,E.originY=0,E.translateX=0,E.translateY=0,Q(0,0),E.element=null},re=()=>{l.keyboard&&window.addEventListener("keydown",D),window.addEventListener("resize",U),window.addEventListener("popstate",X),ue("click",H),l.draggable&&(ue("pointerdown",V),ue("pointermove",j),ue("pointerup",W),ue("pointercancel",B),ue("pointerout",B),ue("pointerleave",B),ue("contextmenu",B)),ue("wheel",G)},ne=()=>{l.keyboard&&window.removeEventListener("keydown",D),window.removeEventListener("resize",U),window.removeEventListener("popstate",X),pe("click",H),l.draggable&&(pe("pointerdown",V),pe("pointermove",j),pe("pointerup",W),pe("pointercancel",B),pe("pointerout",B),pe("pointerleave",B),pe("contextmenu",B)),pe("wheel",G)},ae=()=>{l.draggable&&!w[v].slider.classList.contains("tobii__slider--is-draggable")&&w[v].slider.classList.add("tobii__slider--is-draggable"),!l.nav||1===w[v].elementsLength||"auto"===l.nav&&de()?(p.setAttribute("aria-hidden","true"),p.disabled=!0,h.setAttribute("aria-hidden","true"),h.disabled=!0):(p.setAttribute("aria-hidden","false"),p.disabled=!1,h.setAttribute("aria-hidden","false"),h.disabled=!1),g.setAttribute("aria-hidden",l.counter&&1!==w[v].elementsLength?"false":"true")},se=(e=null)=>{R(),g.textContent=`${w[v].currentIndex+1}/${w[v].elementsLength}`,(e=>{(!0===l.nav||"auto"===l.nav)&&!de()&&w[v].elementsLength>1?(p.setAttribute("aria-hidden","true"),p.disabled=!0,h.setAttribute("aria-hidden","true"),h.disabled=!0,1===w[v].elementsLength?l.close&&b.focus():0===w[v].currentIndex?(h.setAttribute("aria-hidden","false"),h.disabled=!1,h.focus()):w[v].currentIndex===w[v].elementsLength-1?(p.setAttribute("aria-hidden","false"),p.disabled=!1,p.focus()):(p.setAttribute("aria-hidden","false"),p.disabled=!1,h.setAttribute("aria-hidden","false"),h.disabled=!1,"left"===e?p.focus():h.focus())):l.close&&b.focus()})(e)},oe=()=>{le()&&X(),Object.entries(w).forEach(e=>{e[1].gallery.forEach(e=>{C(e)})}),w={},v=null;for(const e in s)s[e].onReset()},le=()=>"false"===u.getAttribute("aria-hidden"),de=()=>"ontouchstart"in window,ce=e=>-1!==["TEXTAREA","OPTION","INPUT","SELECT"].indexOf(e.nodeName)||e===p||e===h||e===b,ue=(e,t)=>{u.addEventListener(e,t)},pe=(e,t)=>{u.removeEventListener(e,t)};return(e=>{if(document.querySelector("div.tobii"))return void console.log("Multiple lightbox instances not supported.");l=(e=>({selector:".lightbox",captions:!0,captionsSelector:"img",captionAttribute:"alt",captionText:null,captionHTML:!1,nav:"auto",navText:['<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path stroke="none" d="M0 0h24v24H0z"/><polyline points="15 6 9 12 15 18" /></svg>','<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path stroke="none" d="M0 0h24v24H0z"/><polyline points="9 6 15 12 9 18" /></svg>'],navLabel:["Previous image","Next image"],close:!0,closeText:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path stroke="none" d="M0 0h24v24H0z"/><line x1="18" y1="6" x2="6" y2="18" /><line x1="6" y1="6" x2="18" y2="18" /></svg>',closeLabel:"Close lightbox",loadingIndicatorLabel:"Image loading",counter:!0,download:!1,downloadText:"",downloadLabel:"Download image",keyboard:!0,zoom:!0,zoomText:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path stroke="none" d="M0 0h24v24H0z"/><polyline points="16 4 20 4 20 8" /><line x1="14" y1="10" x2="20" y2="4" /><polyline points="8 20 4 20 4 16" /><line x1="4" y1="20" x2="10" y2="14" /><polyline points="16 20 20 20 20 16" /><line x1="14" y1="14" x2="20" y2="20" /><polyline points="8 4 4 4 4 8" /><line x1="4" y1="4" x2="10" y2="10" /></svg>',docClose:!0,swipeClose:!0,hideScrollbar:!0,draggable:!0,threshold:100,rtl:!1,loop:!1,autoplayVideo:!1,modal:!1,theme:"tobii--theme-default",...e}))(e),u||(u=document.createElement("div"),u.setAttribute("role","dialog"),u.setAttribute("aria-hidden","true"),u.classList.add("tobii"),u.classList.add(l.theme),p=document.createElement("button"),p.className="tobii__btn tobii__btn--previous",p.setAttribute("type","button"),p.setAttribute("aria-label",l.navLabel[0]),p.innerHTML=l.navText[0],u.appendChild(p),h=document.createElement("button"),h.className="tobii__btn tobii__btn--next",h.setAttribute("type","button"),h.setAttribute("aria-label",l.navLabel[1]),h.innerHTML=l.navText[1],u.appendChild(h),b=document.createElement("button"),b.className="tobii__btn tobii__btn--close",b.setAttribute("type","button"),b.setAttribute("aria-label",l.closeLabel),b.innerHTML=l.closeText,u.appendChild(b),g=document.createElement("div"),g.className="tobii__counter",u.appendChild(g),document.body.appendChild(u));const t=document.querySelectorAll(l.selector);if(!t)throw new Error(`Ups, I can't find the selector ${l.selector} on this website.`);const i=[];t.forEach(e=>{const t=e.hasAttribute("data-group")?e.getAttribute("data-group"):"default";let r=e.href;e.hasAttribute("data-target")&&(r=e.getAttribute("data-target")),r+="__"+t,void 0!==i[r]?e.addEventListener("click",e=>{$(t),T(),e.preventDefault()}):(i[r]=1,_(e))})})(a),n.open=T,n.previous=N,n.next=P,n.close=X,n.add=_,n.remove=C,n.reset=oe,n.destroy=()=>{oe(),u.parentNode.removeChild(u)},n.isOpen=le,n.slidesIndex=()=>w[v].currentIndex,n.select=e=>{const t=w[v].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===w[v].currentIndex)throw new Error(`Ups, slide ${e} is already selected.`);if(-1===e||e>=w[v].elementsLength)throw new Error(`Ups, I can't find slide ${e}.`)}w[v].currentIndex=e,O(t),M(e),e<t&&(se("left"),k(t),q(e-1)),e>t&&(se("right"),k(t),q(e+1))},n.slidesCount=()=>w[v].elementsLength,n.selectGroup=$,n.currentGroup=()=>v,n.on=ue,n.off=pe,n}});
{
"name": "@midzer/tobii",
"version": "2.5.0",
"version": "2.6.0",
"description": "An accessible, open-source lightbox with no dependencies.",

@@ -21,11 +21,12 @@ "main": "dist/tobii.js",

"devDependencies": {
"@eslint/compat": "^1.2.3",
"cross-env": "^7.0.3",
"eslint": "^8.32.0",
"eslint": "^9.15.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-standard": "^5.0.0",
"microbundle": "^0.15.1",
"node-sass": "^7.0.3",
"rimraf": "^3.0.2",
"rimraf": "^6.0.1",
"sass": "^1.81.0",
"standard": "^17.0.0",
"stylelint": "^14.16.1"
"stylelint": "^16.10.0"
},

@@ -32,0 +33,0 @@ "browserslist": {

@@ -55,5 +55,7 @@ # Tobii

- When Tobii closes, focus returns to what was in focus before Tobii opened
- Touch & Mouse drag support:
- Drag/ Swipe horizontal to navigate through slides
- Drag/ Swipe vertical to close Tobii
- Touch & mouse drag/swipe support:
- Horizontal to navigate through slides
- Vertical up to close Tobii
- Double click, pinch and wheel zoom:
- Hold pointer to pan
- Responsive

@@ -70,3 +72,3 @@

* `dist/tobii.min.js`: IIFE build for maximum browser support, including IE 11
* `dist/tobii.mjs`: Build specially designed to work in all modern browsers
* `dist/tobii.modern.js`: Build specially designed to work in all modern browsers
* `dist/tobii.module.js`: ESM build

@@ -73,0 +75,0 @@ * `dist/tobii.umd.js`: UMD build

@@ -5,3 +5,3 @@ /**

* @author midzer
* @version 2.5.0
* @version 2.6.0
* @url https://github.com/midzer/tobii

@@ -56,14 +56,28 @@ *

let counter = null
let drag = {}
let isDraggingX = false
let isDraggingY = false
let pointerDown = false
let lastFocus = null
let offset = null
let offsetTmp = null
let resizeTicking = false
let isYouTubeDependencyLoaded = false
let groups = {}
let newGroup = null
let activeGroup = null
let pointerDownCache = []
let lastTapTime = 0
const MIN_SCALE = 1
const MAX_SCALE = 4
const DOUBLE_TAP_TIME = 500 // milliseconds
const SCALE_SENSITIVITY = 10
const TRANSFORM = {
element: null,
originX: 0,
originY: 0,
translateX: 0,
translateY: 0,
scale: MIN_SCALE
}
const DRAG = {
startX: 0,
startY: 0,
x: 0,
y: 0,
distance: 0
}

@@ -232,3 +246,3 @@ /**

const add = (el) => {
newGroup = getGroupName(el)
const newGroup = getGroupName(el)

@@ -238,3 +252,10 @@ if (!Object.prototype.hasOwnProperty.call(groups, newGroup)) {

createSlider()
// Create slider
groups[newGroup].slider = document.createElement('div')
groups[newGroup].slider.className = 'tobii__slider'
// Hide slider
groups[newGroup].slider.setAttribute('aria-hidden', 'true')
lightbox.appendChild(groups[newGroup].slider)
}

@@ -262,4 +283,27 @@

createSlide(el)
const model = getModel(el)
// Create slide
const SLIDER_ELEMENT = document.createElement('div')
const SLIDER_ELEMENT_CONTENT = document.createElement('div')
SLIDER_ELEMENT.className = 'tobii__slide'
SLIDER_ELEMENT.style.position = 'absolute'
SLIDER_ELEMENT.style.left = `${groups[newGroup].x * 100}%`
// Hide slide
SLIDER_ELEMENT.setAttribute('aria-hidden', 'true')
// Create type elements
model.init(el, SLIDER_ELEMENT_CONTENT, userSettings)
// Add slide content container to slider element
SLIDER_ELEMENT.appendChild(SLIDER_ELEMENT_CONTENT)
// Add slider element to slider
groups[newGroup].slider.appendChild(SLIDER_ELEMENT)
groups[newGroup].sliderElements.push(SLIDER_ELEMENT)
++groups[newGroup].x
if (isOpen() && newGroup === activeGroup) {

@@ -377,46 +421,2 @@ updateConfig()

/**
* Create a slider
*/
const createSlider = () => {
groups[newGroup].slider = document.createElement('div')
groups[newGroup].slider.className = 'tobii__slider'
// Hide slider
groups[newGroup].slider.setAttribute('aria-hidden', 'true')
lightbox.appendChild(groups[newGroup].slider)
}
/**
* Create a slide
*
*/
const createSlide = (el) => {
const model = getModel(el)
// Create slide elements
const SLIDER_ELEMENT = document.createElement('div')
const SLIDER_ELEMENT_CONTENT = document.createElement('div')
SLIDER_ELEMENT.className = 'tobii__slide'
SLIDER_ELEMENT.style.position = 'absolute'
SLIDER_ELEMENT.style.left = `${groups[newGroup].x * 100}%`
// Hide slide
SLIDER_ELEMENT.setAttribute('aria-hidden', 'true')
// Create type elements
model.init(el, SLIDER_ELEMENT_CONTENT, userSettings)
// Add slide content container to slider element
SLIDER_ELEMENT.appendChild(SLIDER_ELEMENT_CONTENT)
// Add slider element to slider
groups[newGroup].slider.appendChild(SLIDER_ELEMENT)
groups[newGroup].sliderElements.push(SLIDER_ELEMENT)
++groups[newGroup].x
}
const getModel = (el) => {

@@ -440,5 +440,3 @@ const type = el.getAttribute('data-type')

*/
const open = (index) => {
activeGroup = activeGroup !== null ? activeGroup : newGroup
const open = (index = 0) => {
if (isOpen()) {

@@ -448,10 +446,4 @@ throw new Error('Ups, I\'m aleady open.')

if (!isOpen()) {
if (!index) {
index = 0
}
if (index === -1 || index >= groups[activeGroup].elementsLength) {
throw new Error(`Ups, I can't find slide ${index}.`)
}
if (index === -1 || index >= groups[activeGroup].elementsLength) {
throw new Error(`Ups, I can't find slide ${index}.`)
}

@@ -486,3 +478,2 @@

clearDrag()
bindEvents()

@@ -759,2 +750,12 @@

model.onCleanup(CONTAINER)
DRAG.startX = 0
DRAG.startY = 0
DRAG.x = 0
DRAG.y = 0
DRAG.distance = 0
lastTapTime = 0
if (isZoomed()) resetZoom()
}

@@ -767,8 +768,5 @@

const updateOffset = () => {
activeGroup = activeGroup !== null ? activeGroup : newGroup
offset = -groups[activeGroup].currentIndex * lightbox.offsetWidth
groups[activeGroup].slider.style.transform = `translate3d(${offset}px, 0, 0)`
offsetTmp = offset
groups[activeGroup].slider.style.transform = `translate(${offset}px, 0)`
}

@@ -835,50 +833,7 @@

/**
* Clear drag after touchend and mousup event
* Resize event
*
*/
const clearDrag = () => {
drag = {
startX: 0,
endX: 0,
startY: 0,
endY: 0
}
}
/**
* Recalculate drag / swipe event
*
*/
const updateAfterDrag = () => {
const MOVEMENT_X = drag.endX - drag.startX
const MOVEMENT_Y = drag.endY - drag.startY
const MOVEMENT_X_DISTANCE = Math.abs(MOVEMENT_X)
const MOVEMENT_Y_DISTANCE = Math.abs(MOVEMENT_Y)
if (MOVEMENT_X > 0 && MOVEMENT_X_DISTANCE > userSettings.threshold && groups[activeGroup].currentIndex > 0) {
previous()
} else if (MOVEMENT_X < 0 && MOVEMENT_X_DISTANCE > userSettings.threshold &&
groups[activeGroup].currentIndex !== groups[activeGroup].elementsLength - 1) {
next()
} else if (MOVEMENT_Y < 0 && MOVEMENT_Y_DISTANCE > userSettings.threshold && userSettings.swipeClose) {
close()
} else {
updateOffset()
}
}
/**
* Resize event using requestAnimationFrame
*
*/
const resizeHandler = () => {
if (!resizeTicking) {
resizeTicking = true
window.requestAnimationFrame(() => {
updateOffset()
resizeTicking = false
})
}
updateOffset()
}

@@ -907,4 +862,4 @@

next()
} else if (event.target === closeButton || (isDraggingX === false && isDraggingY === false &&
event.target.classList.contains('tobii__slide') && userSettings.docClose)) {
} else if (event.target === closeButton ||
(event.target.classList.contains('tobii__slide') && userSettings.docClose)) {
close()

@@ -975,7 +930,20 @@ }

/**
* Touchstart event handler
* Contextmenu event handler
* This is a fix for chromium based browser on mac.
* The 'contextmenu' terminates a mouse event sequence.
* https://bugs.chromium.org/p/chromium/issues/detail?id=506801
*
*/
const touchstartHandler = (event) => {
// Prevent dragging / swiping on textareas inputs and selects
const contextmenuHandler = () => {
pointerDownCache = []
updateOffset()
groups[activeGroup].slider.classList.remove('tobii__slider--is-' + (isZoomed() ? 'moving' : 'dragging'))
}
/**
* Pointerdown event handler
*
*/
const pointerdownHandler = (event) => {
// Prevent dragging / swiping on textareas, inputs and selects
if (isIgnoreElement(event.target)) {

@@ -985,14 +953,23 @@ return

event.preventDefault()
event.stopPropagation()
isDraggingX = false
isDraggingY = false
DRAG.startX = DRAG.x = event.pageX
DRAG.startY = DRAG.y = event.pageY
DRAG.distance = 0
pointerDown = true
// This event is cached to support 2-finger gestures
pointerDownCache.push(event)
drag.startX = event.touches[0].pageX
drag.startY = event.touches[0].pageY
if (pointerDownCache.length === 2) {
const { x, y } = midPoint(
pointerDownCache[0].pageX, pointerDownCache[0].pageY,
pointerDownCache[1].pageX, pointerDownCache[1].pageY
)
if (isTouchDevice()) {
groups[activeGroup].slider.classList.add('tobii__slider--is-dragging')
DRAG.startX = DRAG.x = x
DRAG.startY = DRAG.y = y
DRAG.distance = distance(
pointerDownCache[0].pageX - pointerDownCache[1].pageX, pointerDownCache[0].pageY - pointerDownCache[1].pageY
) / TRANSFORM.scale
}

@@ -1002,57 +979,65 @@ }

/**
* Touchmove event handler
* Pointermove event handler
*
*/
const touchmoveHandler = (event) => {
event.stopPropagation()
const pointermoveHandler = (event) => {
if (!pointerDownCache.length) return
if (pointerDown) {
drag.endX = event.touches[0].pageX
drag.endY = event.touches[0].pageY
groups[activeGroup].slider.classList.add('tobii__slider--is-' + (isZoomed() ? 'moving' : 'dragging'))
doSwipe()
}
}
// Find this event in the cache and update its record with this event
const index = pointerDownCache.findIndex(
(cachedEv) => cachedEv.pointerId === event.pointerId
)
pointerDownCache[index] = event
/**
* Touchend event handler
*
*/
const touchendHandler = (event) => {
event.stopPropagation()
if (pointerDownCache.length === 2) {
// 2-pointer horizontal pinch/zoom gesture
const { x, y } = midPoint(
pointerDownCache[0].pageX, pointerDownCache[0].pageY,
pointerDownCache[1].pageX, pointerDownCache[1].pageY
)
const scale = distance(
pointerDownCache[0].pageX - pointerDownCache[1].pageX, pointerDownCache[0].pageY - pointerDownCache[1].pageY
) / DRAG.distance
pointerDown = false
zoomPan(
clamp(scale, MIN_SCALE, MAX_SCALE),
x, y,
x - DRAG.x, y - DRAG.y
)
groups[activeGroup].slider.classList.remove('tobii__slider--is-dragging')
DRAG.x = x
DRAG.y = y
if (drag.endX) {
updateAfterDrag()
return
}
clearDrag()
}
if (isZoomed()) {
const deltaX = event.pageX - DRAG.x
const deltaY = event.pageY - DRAG.y
/**
* Mousedown event handler
*
*/
const mousedownHandler = (event) => {
// Prevent dragging / swiping on textareas inputs and selects
if (isIgnoreElement(event.target)) {
return
pan(deltaX, deltaY)
}
event.preventDefault()
event.stopPropagation()
DRAG.x = event.pageX
DRAG.y = event.pageY
isDraggingX = false
isDraggingY = false
if (!isZoomed()) {
// Drag animation
const deltaX = DRAG.startX - DRAG.x
const deltaY = DRAG.startY - DRAG.y
pointerDown = true
// Skip animation if drag distance is too low
if (distance(deltaX, deltaY) < 10) return
drag.startX = event.pageX
drag.startY = event.pageY
if (isTouchDevice()) {
groups[activeGroup].slider.classList.add('tobii__slider--is-dragging')
if (Math.abs(deltaX) > Math.abs(deltaY) && groups[activeGroup].elementsLength > 1) {
// Horizontal swipe
groups[activeGroup].slider.style.transform =
`translate(${offset - Math.round(deltaX)}px, 0)`
} else if (userSettings.swipeClose) {
// Vertical swipe
groups[activeGroup].slider.style.transform =
`translate(${offset}px, -${Math.round(deltaY)}px)`
}
}

@@ -1062,13 +1047,62 @@ }

/**
* Mousemove event handler
* Pointerup event handler
*
*/
const mousemoveHandler = (event) => {
event.preventDefault()
const pointerupHandler = (event) => {
event.stopPropagation()
if (pointerDown) {
drag.endX = event.pageX
drag.endY = event.pageY
groups[activeGroup].slider.classList.remove('tobii__slider--is-' + (isZoomed() ? 'moving' : 'dragging'))
doSwipe()
// Remove this event from the target's cache
const index = pointerDownCache.findIndex(
(cachedEv) => cachedEv.pointerId === event.pointerId
)
pointerDownCache.splice(index, 1)
const MOVEMENT_X = DRAG.startX - DRAG.x
const MOVEMENT_Y = DRAG.startY - DRAG.y
const MOVEMENT_X_DISTANCE = Math.abs(MOVEMENT_X)
const MOVEMENT_Y_DISTANCE = Math.abs(MOVEMENT_Y)
if (MOVEMENT_X_DISTANCE || MOVEMENT_Y_DISTANCE) {
if (!isZoomed()) {
// Evaluate drag
if (MOVEMENT_X < 0 && MOVEMENT_X_DISTANCE > userSettings.threshold && groups[activeGroup].currentIndex > 0) {
previous()
} else if (MOVEMENT_X > 0 && MOVEMENT_X_DISTANCE > userSettings.threshold &&
groups[activeGroup].currentIndex !== groups[activeGroup].elementsLength - 1) {
next()
} else if (MOVEMENT_Y > 0 && MOVEMENT_Y_DISTANCE > userSettings.threshold && userSettings.swipeClose) {
close()
} else {
updateOffset()
}
}
} else {
// Evaluate tap
const currentTime = new Date().getTime()
const tapLength = currentTime - lastTapTime
if (tapLength < DOUBLE_TAP_TIME && tapLength > 100) {
// Double click
event.preventDefault()
lastTapTime = 0
if (isZoomed()) {
resetZoom()
} else {
zoomPan(MAX_SCALE / 2, event.clientX, event.clientY, 0, 0)
}
} else {
lastTapTime = currentTime
if (isTouchDevice()) {
// Delayed tap on mobile
window.setTimeout(() => {
const { left, top, bottom, right, width } = event.target.getBoundingClientRect()
if (DRAG.startY < top || DRAG.startY > bottom || !lastTapTime) return
if (DRAG.startX > left && DRAG.startX < left + width / 2) {
previous()
} else if (DRAG.startX < right && DRAG.startX > right - width / 2) {
next()
}
}, DOUBLE_TAP_TIME)
}
}
}

@@ -1078,50 +1112,94 @@ }

/**
* Mouseup event handler
* Wheel event handler
*
*/
const mouseupHandler = (event) => {
event.stopPropagation()
const wheelHandler = (event) => {
const deltaScale = Math.sign(event.deltaY) > 0 ? -1 : 1
if (!isZoomed() && !deltaScale) return
event.preventDefault()
pointerDown = false
const newScale = TRANSFORM.scale + deltaScale / (SCALE_SENSITIVITY / TRANSFORM.scale)
zoomPan(
clamp(newScale, MIN_SCALE, MAX_SCALE),
event.pageX, event.pageY,
0, 0
)
}
groups[activeGroup].slider.classList.remove('tobii__slider--is-dragging')
const clampedTranslate = (axis, translate) => {
// Whole clamping functionality heavily inspired
// by https://github.com/Neophen/pinch-zoom-pan
const { element, scale, originX, originY } = TRANSFORM
const axisIsX = axis === 'x'
const origin = axisIsX ? originX : originY
const axisKey = axisIsX ? 'offsetWidth' : 'offsetHeight'
if (drag.endX) {
updateAfterDrag()
const containerSize = element.parentNode[axisKey]
const imageSize = element[axisKey]
const bounds = element.getBoundingClientRect()
const imageScaledSize = axisIsX ? bounds.width : bounds.height
const defaultOrigin = imageSize / 2
const originOffset = (origin - defaultOrigin) * (scale - 1)
const range = Math.max(0, Math.round(imageScaledSize) - containerSize)
const max = Math.round(range / 2)
const min = 0 - max
return clamp(translate, min + originOffset, max + originOffset)
}
const clamp = (value, min, max) => Math.max(Math.min(value, max), min)
const isZoomed = () => TRANSFORM.scale !== MIN_SCALE
const pan = (deltaX, deltaY) => {
if (deltaX !== 0) {
TRANSFORM.translateX = clampedTranslate('x', TRANSFORM.translateX + deltaX)
}
if (deltaY !== 0) {
TRANSFORM.translateY = clampedTranslate('y', TRANSFORM.translateY + deltaY)
}
clearDrag()
const { element, originX, originY, translateX, translateY, scale } = TRANSFORM
element.style.transformOrigin = `${originX}px ${originY}px`
element.style.transform = `translate(${translateX}px, ${translateY}px) scale(${scale})`
}
/**
* Contextmenu event handler
* This is a fix for chromium based browser on mac.
* The 'contextmenu' terminates a mouse event sequence.
* https://bugs.chromium.org/p/chromium/issues/detail?id=506801
*
*/
const contextmenuHandler = () => {
pointerDown = false
const zoomPan = (newScale, x, y, deltaX, deltaY) => {
if (!TRANSFORM.element) {
TRANSFORM.element = lightbox.querySelector('.tobii__slide--is-active img')
}
const { left, top } = TRANSFORM.element.getBoundingClientRect()
const originX = x - left
const originY = y - top
const newOriginX = originX / TRANSFORM.scale
const newOriginY = originY / TRANSFORM.scale
TRANSFORM.originX = newOriginX
TRANSFORM.originY = newOriginY
TRANSFORM.scale = newScale
pan(deltaX, deltaY)
}
/**
* Decide whether to do horizontal of vertical swipe
*
*/
const doSwipe = () => {
if (Math.abs(drag.startX - drag.endX) > 0 && !isDraggingY && groups[activeGroup].elementsLength > 1) {
// Horizontal swipe
groups[activeGroup].slider.style.transform =
`translate3d(${offsetTmp - Math.round(drag.startX - drag.endX)}px, 0, 0)`
const distance = (dx, dy) => Math.hypot(dx, dy)
isDraggingX = true
isDraggingY = false
} else if (Math.abs(drag.startY - drag.endY) > 0 && !isDraggingX && userSettings.swipeClose) {
// Vertical swipe
groups[activeGroup].slider.style.transform =
`translate3d(${offsetTmp}px, -${Math.round(drag.startY - drag.endY)}px, 0)`
const midPoint = (x1, y1, x2, y2) => ({
x: (x1 + x2) / 2,
y: (y1 + y2) / 2
})
isDraggingX = false
isDraggingY = true
}
const resetZoom = () => {
TRANSFORM.scale = MIN_SCALE
TRANSFORM.originX = 0
TRANSFORM.originY = 0
TRANSFORM.translateX = 0
TRANSFORM.translateY = 0
pan(0, 0)
TRANSFORM.element = null
}

@@ -1145,16 +1223,17 @@

// Click event
lightbox.addEventListener('click', clickHandler)
on('click', clickHandler)
if (userSettings.draggable && isTouchDevice()) {
// Touch events
lightbox.addEventListener('touchstart', touchstartHandler)
lightbox.addEventListener('touchmove', touchmoveHandler)
lightbox.addEventListener('touchend', touchendHandler)
if (userSettings.draggable) {
// Pointer events
on('pointerdown', pointerdownHandler)
on('pointermove', pointermoveHandler)
on('pointerup', pointerupHandler)
on('pointercancel', contextmenuHandler)
on('pointerout', contextmenuHandler)
on('pointerleave', contextmenuHandler)
on('contextmenu', contextmenuHandler)
}
// Mouse events
lightbox.addEventListener('mousedown', mousedownHandler)
lightbox.addEventListener('mouseup', mouseupHandler)
lightbox.addEventListener('mousemove', mousemoveHandler)
lightbox.addEventListener('contextmenu', contextmenuHandler)
}
// Wheel event
on('wheel', wheelHandler)
}

@@ -1178,16 +1257,17 @@

// Click event
lightbox.removeEventListener('click', clickHandler)
off('click', clickHandler)
if (userSettings.draggable && isTouchDevice()) {
// Touch events
lightbox.removeEventListener('touchstart', touchstartHandler)
lightbox.removeEventListener('touchmove', touchmoveHandler)
lightbox.removeEventListener('touchend', touchendHandler)
if (userSettings.draggable) {
// Pointer events
off('pointerdown', pointerdownHandler)
off('pointermove', pointermoveHandler)
off('pointerup', pointerupHandler)
off('pointercancel', contextmenuHandler)
off('pointerout', contextmenuHandler)
off('pointerleave', contextmenuHandler)
off('contextmenu', contextmenuHandler)
}
// Mouse events
lightbox.removeEventListener('mousedown', mousedownHandler)
lightbox.removeEventListener('mouseup', mouseupHandler)
lightbox.removeEventListener('mousemove', mousemoveHandler)
lightbox.removeEventListener('contextmenu', contextmenuHandler)
}
// Wheel event
off('wheel', wheelHandler)
}

@@ -1200,7 +1280,4 @@

const updateConfig = () => {
if ((userSettings.draggable && userSettings.swipeClose && isTouchDevice() &&
!groups[activeGroup].slider.classList.contains('tobii__slider--is-draggable')) ||
(userSettings.draggable && groups[activeGroup].elementsLength > 1 &&
!groups[activeGroup].slider.classList.contains('tobii__slider--is-draggable'))
) {
if (userSettings.draggable &&
!groups[activeGroup].slider.classList.contains('tobii__slider--is-draggable')) {
groups[activeGroup].slider.classList.add('tobii__slider--is-draggable')

@@ -1264,3 +1341,3 @@ }

groups = {}
newGroup = activeGroup = null
activeGroup = null

@@ -1330,3 +1407,3 @@ for (const i in SUPPORTED_ELEMENTS) {

const currentGroup = () => {
return activeGroup !== null ? activeGroup : newGroup
return activeGroup
}

@@ -1333,0 +1410,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc