1(self["webpackChunk"] = self["webpackChunk"] || []).push([["/assets/js/app"],{ 2
vendor: 90,137 bytes, lines 3-21
3/***/ "./node_modules/@fancyapps/ui/dist/fancybox.esm.js": 4/*!*********************************************************!*\ 5 !*** ./node_modules/@fancyapps/ui/dist/fancybox.esm.js ***! 6 \*********************************************************/ 7/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 8 9"use strict"; 10__webpack_require__.r(__webpack_exports__); 11/* harmony export */ __webpack_require__.d(__webpack_exports__, { 12/* harmony export */ Carousel: () => (/* binding */ y), 13/* harmony export */ Fancybox: () => (/* binding */ R), 14/* harmony export */ Panzoom: () => (/* binding */ d) 15/* harmony export */ }); 16// @fancyapps/ui/Fancybox v4.0.31 17const t=t=>"object"==typeof t&&null!==t&&t.constructor===Object&&"[object Object]"===Object.prototype.toString.call(t),e=(...i)=>{let s=!1;"boolean"==typeof i[0]&&(s=i.shift());let o=i[0];if(!o||"object"!=typeof o)throw new Error("extendee must be an object");const n=i.slice(1),a=n.length;for(let i=0;i<a;i++){const a=n[i];for(let i in a)if(a.hasOwnProperty(i)){const n=a[i];if(s&&(Array.isArray(n)||t(n))){const t=Array.isArray(n)?[]:{};o[i]=e(!0,o.hasOwnProperty(i)?o[i]:t,n)}else o[i]=n}}return o},i=(t,e=1e4)=>(t=parseFloat(t)||0,Math.round((t+Number.EPSILON)*e)/e),s=function(t){return!!(t&&"object"==typeof t&&t instanceof Element&&t!==document.body)&&(!t.__Panzoom&&(function(t){const e=getComputedStyle(t)["overflow-y"],i=getComputedStyle(t)["overflow-x"],s=("scroll"===e||"auto"===e)&&Math.abs(t.scrollHeight-t.clientHeight)>1,o=("scroll"===i||"auto"===i)&&Math.abs(t.scrollWidth-t.clientWidth)>1;return s||o}(t)?t:s(t.parentNode)))},o="undefined"!=typeof window&&window.ResizeObserver||class{constructor(t){this.observables=[],this.boundCheck=this.check.bind(this),this.boundCheck(),this.callback=t}observe(t){if(this.observables.some((e=>e.el===t)))return;const e={el:t,size:{height:t.clientHeight,width:t.clientWidth}};this.observables.push(e)}unobserve(t){this.observables=this.observables.filter((e=>e.el!==t))}disconnect(){this.observables=[]}check(){const t=this.observables.filter((t=>{const e=t.el.clientHeight,i=t.el.clientWidth;if(t.size.height!==e||t.size.width!==i)return t.size.height=e,t.size.width=i,!0})).map((t=>t.el));t.length>0&&this.callback(t),window.requestAnimationFrame(this.boundCheck)}};class n{constructor(t){this.id=self.Touch&&t instanceof Touch?t.identifier:-1,this.pageX=t.pageX,this.pageY=t.pageY,this.clientX=t.clientX,this.clientY=t.clientY}}const a=(t,e)=>e?Math.sqrt((e.clientX-t.clientX)**2+(e.clientY-t.clientY)**2):0,r=(t,e)=>e?{clientX:(t.clientX+e.clientX)/2,clientY:(t.clientY+e.clientY)/2}:t;class h{constructor(t,{start:e=(()=>!0),move:i=(()=>{}),end:s=(()=>{})}={}){this._element=t,this.startPointers=[],this.currentPointers=[],this._pointerStart=t=>{if(t.buttons>0&&0!==t.button)return;const e=new n(t);this.currentPointers.some((t=>t.id===e.id))||this._triggerPointerStart(e,t)&&(window.addEventListener("mousemove",this._move),window.addEventListener("mouseup",this._pointerEnd))},this._touchStart=t=>{for(const e of Array.from(t.changedTouches||[]))this._triggerPointerStart(new n(e),t)},this._move=t=>{const e=this.currentPointers.slice(),i=(t=>"changedTouches"in t)(t)?Array.from(t.changedTouches).map((t=>new n(t))):[new n(t)];for(const t of i){const e=this.currentPointers.findIndex((e=>e.id===t.id));e<0||(this.currentPointers[e]=t)}this._moveCallback(e,this.currentPointers.slice(),t)},this._triggerPointerEnd=(t,e)=>{const i=this.currentPointers.findIndex((e=>e.id===t.id));return!(i<0)&&(this.currentPointers.splice(i,1),this.startPointers.splice(i,1),this._endCallback(t,e),!0)},this._pointerEnd=t=>{t.buttons>0&&0!==t.button||this._triggerPointerEnd(new n(t),t)&&(window.removeEventListener("mousemove",this._move,{passive:!1}),window.removeEventListener("mouseup",this._pointerEnd,{passive:!1}))},this._touchEnd=t=>{for(const e of Array.from(t.changedTouches||[]))this._triggerPointerEnd(new n(e),t)},this._startCallback=e,this._moveCallback=i,this._endCallback=s,this._element.addEventListener("mousedown",this._pointerStart,{passive:!1}),this._element.addEventListener("touchstart",this._touchStart,{passive:!1}),this._element.addEventListener("touchmove",this._move,{passive:!1}),this._element.addEventListener("touchend",this._touchEnd),this._element.addEventListener("touchcancel",this._touchEnd)}stop(){this._element.removeEventListener("mousedown",this._pointerStart,{passive:!1}),this._element.removeEventListener("touchstart",this._touchStart,{passive:!1}),this._element.removeEventListener("touchmove",this._move,{passive:!1}),this._element.removeEventListener("touchend",this._touchEnd),this._element.removeEventListener("touchcancel",this._touchEnd),window.removeEventListener("mousemove",this._move),window.removeEventListener("mouseup",this._pointerEnd)}_triggerPointerStart(t,e){return!!this._startCallback(t,e)&&(this.currentPointers.push(t),this.startPointers.push(t),!0)}}class l{constructor(t={}){this.options=e(!0,{},t),this.plugins=[],this.events={};for(const t of["on","once"])for(const e of Object.entries(this.options[t]||{}))this[t](...e)}option(t,e,...i){t=String(t);let s=(o=t,n=this.options,o.split(".").reduce((function(t,e){return t&&t[e]}),n));var o,n;return"function"==typeof s&&(s=s.call(this,this,...i)),void 0===s?e:s}localize(t,e=[]){return t=(t=String(t).replace(/\{\{(\w+).?(\w+)?\}\}/g,((t,i,s)=>{let o="";s?o=this.option(`${i[0]+i.toLowerCase().substring(1)}.l10n.${s}`):i&&(o=this.option(`l10n.${i}`)),o||(o=t);for(let t=0;t<e.length;t++)o=o.split(e[t][0]).join(e[t][1]);return o}))).replace(/\{\{(.*)\}\}/,((t,e)=>e))}on(e,i){if(t(e)){for(const t of Object.entries(e))this.on(...t);return this}return String(e).split(" ").forEach((t=>{const e=this.events[t]=this.events[t]||[];-1==e.indexOf(i)&&e.push(i)})),this}once(e,i){if(t(e)){for(const t of Object.entries(e))this.once(...t);return this}return String(e).split(" ").forEach((t=>{const e=(...s)=>{this.off(t,e),i.call(this,this,...s)};e._=i,this.on(t,e)})),this}off(e,i){if(!t(e))return e.split(" ").forEach((t=>{const e=this.events[t];if(!e||!e.length)return this;let s=-1;for(let t=0,o=e.length;t<o;t++){const o=e[t];if(o&&(o===i||o._===i)){s=t;break}}-1!=s&&e.splice(s,1)})),this;for(const t of Object.entries(e))this.off(...t)}trigger(t,...e){for(const i of[...this.events[t]||[]].slice())if(i&&!1===i.call(this,this,...e))return!1;for(const i of[...this.events["*"]||[]].slice())if(i&&!1===i.call(this,t,this,...e))return!1;return!0}attachPlugins(t){const i={};for(const[s,o]of Object.entries(t||{}))!1===this.options[s]||this.plugins[s]||(this.options[s]=e({},o.defaults||{},this.options[s]),i[s]=new o(this));for(const[t,e]of Object.entries(i))e.attach(this);return this.plugins=Object.assign({},this.plugins,i),this}detachPlugins(){for(const t in this.plugins){let e;(e=this.plugins[t])&&"function"==typeof e.detach&&e.detach(this)}return this.plugins={},this}}const c={touch:!0,zoom:!0,pinchToZoom:!0,panOnlyZoomed:!1,lockAxis:!1,friction:.64,decelFriction:.88,zoomFriction:.74,bounceForce:.2,baseScale:1,minScale:1,maxScale:2,step:.5,textSelection:!1,click:"toggleZoom",wheel:"zoom",wheelFactor:42,wheelLimit:5,draggableClass:"is-draggable",draggingClass:"is-dragging",ratio:1};class d extends l{constructor(t,i={}){super(e(!0,{},c,i)),this.state="init",this.$container=t;for(const t of["onLoad","onWheel","onClick"])this[t]=this[t].bind(this);this.initLayout(),this.resetValues(),this.attachPlugins(d.Plugins),this.trigger("init"),this.updateMetrics(),this.attachEvents(),this.trigger("ready"),!1===this.option("centerOnStart")?this.state="ready":this.panTo({friction:0}),t.__Panzoom=this}initLayout(){const t=this.$container;if(!(t instanceof HTMLElement))throw new Error("Panzoom: Container not found");const e=this.option("content")||t.querySelector(".panzoom__content");if(!e)throw new Error("Panzoom: Content not found");this.$content=e;let i=this.option("viewport")||t.querySelector(".panzoom__viewport");i||!1===this.option("wrapInner")||(i=document.createElement("div"),i.classList.add("panzoom__viewport"),i.append(...t.childNodes),t.appendChild(i)),this.$viewport=i||e.parentNode}resetValues(){this.updateRate=this.option("updateRate",/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)?250:24),this.container={width:0,height:0},this.viewport={width:0,height:0},this.content={origWidth:0,origHeight:0,width:0,height:0,x:this.option("x",0),y:this.option("y",0),scale:this.option("baseScale")},this.transform={x:0,y:0,scale:1},this.resetDragPosition()}onLoad(t){this.updateMetrics(),this.panTo({scale:this.option("baseScale"),friction:0}),this.trigger("load",t)}onClick(t){if(t.defaultPrevented)return;if(document.activeElement&&document.activeElement.closest("[contenteditable]"))return;if(this.option("textSelection")&&window.getSelection().toString().length&&(!t.target||!t.target.hasAttribute("data-fancybox-close")))return void t.stopPropagation();const e=this.$content.getClientRects()[0];if("ready"!==this.state&&(this.dragPosition.midPoint||Math.abs(e.top-this.dragStart.rect.top)>1||Math.abs(e.left-this.dragStart.rect.left)>1))return t.preventDefault(),void t.stopPropagation();!1!==this.trigger("click",t)&&this.option("zoom")&&"toggleZoom"===this.option("click")&&(t.preventDefault(),t.stopPropagation(),this.zoomWithClick(t))}onWheel(t){!1!==this.trigger("wheel",t)&&this.option("zoom")&&this.option("wheel")&&this.zoomWithWheel(t)}zoomWithWheel(t){void 0===this.changedDelta&&(this.changedDelta=0);const e=Math.max(-1,Math.min(1,-t.deltaY||-t.deltaX||t.wheelDelta||-t.detail)),i=this.content.scale;let s=i*(100+e*this.option("wheelFactor"))/100;if(e<0&&Math.abs(i-this.option("minScale"))<.01||e>0&&Math.abs(i-this.option("maxScale"))<.01?(this.changedDelta+=Math.abs(e),s=i):(this.changedDelta=0,s=Math.max(Math.min(s,this.option("maxScale")),this.option("minScale"))),this.changedDelta>this.option("wheelLimit"))return;if(t.preventDefault(),s===i)return;const o=this.$content.getBoundingClientRect(),n=t.clientX-o.left,a=t.clientY-o.top;this.zoomTo(s,{x:n,y:a})}zoomWithClick(t){const e=this.$content.getClientRects()[0],i=t.clientX-e.left,s=t.clientY-e.top;this.toggleZoom({x:i,y:s})}attachEvents(){this.$content.addEventListener("load",this.onLoad),this.$container.addEventListener("wheel",this.onWheel,{passive:!1}),this.$container.addEventListener("click",this.onClick,{passive:!1}),this.initObserver();const t=new h(this.$container,{start:(e,i)=>{if(!this.option("touch"))return!1;if(this.velocity.scale<0)return!1;const o=i.composedPath()[0];if(!t.currentPointers.length){if(-1!==["BUTTON","TEXTAREA","OPTION","INPUT","SELECT","VIDEO"].indexOf(o.nodeName))return!1;if(this.option("textSelection")&&((t,e,i)=>{const s=t.childNodes,o=document.createRange();for(let t=0;t<s.length;t++){const n=s[t];if(n.nodeType!==Node.TEXT_NODE)continue;o.selectNodeContents(n);const a=o.getBoundingClientRect();if(e>=a.left&&i>=a.top&&e<=a.right&&i<=a.bottom)return n}return!1})(o,e.clientX,e.clientY))return!1}return!s(o)&&(!1!==this.trigger("touchStart",i)&&("mousedown"===i.type&&i.preventDefault(),this.state="pointerdown",this.resetDragPosition(),this.dragPosition.midPoint=null,this.dragPosition.time=Date.now(),!0))},move:(e,i,s)=>{if("pointerdown"!==this.state)return;if(!1===this.trigger("touchMove",s))return void s.preventDefault();if(i.length<2&&!0===this.option("panOnlyZoomed")&&this.content.width<=this.viewport.width&&this.content.height<=this.viewport.height&&this.transform.scale<=this.option("baseScale"))return;if(i.length>1&&(!this.option("zoom")||!1===this.option("pinchToZoom")))return;const o=r(e[0],e[1]),n=r(i[0],i[1]),h=n.clientX-o.clientX,l=n.clientY-o.clientY,c=a(e[0],e[1]),d=a(i[0],i[1]),u=c&&d?d/c:1;this.dragOffset.x+=h,this.dragOffset.y+=l,this.dragOffset.scale*=u,this.dragOffset.time=Date.now()-this.dragPosition.time;const f=1===this.dragStart.scale&&this.option("lockAxis");if(f&&!this.lockAxis){if(Math.abs(this.dragOffset.x)<6&&Math.abs(this.dragOffset.y)<6)return void s.preventDefault();const t=Math.abs(180*Math.atan2(this.dragOffset.y,this.dragOffset.x)/Math.PI);this.lockAxis=t>45&&t<135?"y":"x"}if("xy"===f||"y"!==this.lockAxis){if(s.preventDefault(),s.stopPropagation(),s.stopImmediatePropagation(),this.lockAxis&&(this.dragOffset["x"===this.lockAxis?"y":"x"]=0),this.$container.classList.add(this.option("draggingClass")),this.transform.scale===this.option("baseScale")&&"y"===this.lockAxis||(this.dragPosition.x=this.dragStart.x+this.dragOffset.x),this.transform.scale===this.option("baseScale")&&"x"===this.lockAxis||(this.dragPosition.y=this.dragStart.y+this.dragOffset.y),this.dragPosition.scale=this.dragStart.scale*this.dragOffset.scale,i.length>1){const e=r(t.startPointers[0],t.startPointers[1]),i=e.clientX-this.dragStart.rect.x,s=e.clientY-this.dragStart.rect.y,{deltaX:o,deltaY:a}=this.getZoomDelta(this.content.scale*this.dragOffset.scale,i,s);this.dragPosition.x-=o,this.dragPosition.y-=a,this.dragPosition.midPoint=n}else this.setDragResistance();this.transform={x:this.dragPosition.x,y:this.dragPosition.y,scale:this.dragPosition.scale},this.startAnimation()}},end:(e,i)=>{if("pointerdown"!==this.state)return;if(this._dragOffset={...this.dragOffset},t.currentPointers.length)return void this.resetDragPosition();if(this.state="decel",this.friction=this.option("decelFriction"),this.recalculateTransform(),this.$container.classList.remove(this.option("draggingClass")),!1===this.trigger("touchEnd",i))return;if("decel"!==this.state)return;const s=this.option("minScale");if(this.transform.scale<s)return void this.zoomTo(s,{friction:.64});const o=this.option("maxScale");if(this.transform.scale-o>.01){const t=this.dragPosition.midPoint||e,i=this.$content.getClientRects()[0];this.zoomTo(o,{friction:.64,x:t.clientX-i.left,y:t.clientY-i.top})}else;}});this.pointerTracker=t}initObserver(){this.resizeObserver||(this.resizeObserver=new o((()=>{this.updateTimer||(this.updateTimer=setTimeout((()=>{const t=this.$container.getBoundingClientRect();t.width&&t.height?((Math.abs(t.width-this.container.width)>1||Math.abs(t.height-this.container.height)>1)&&(this.isAnimating()&&this.endAnimation(!0),this.updateMetrics(),this.panTo({x:this.content.x,y:this.content.y,scale:this.option("baseScale"),friction:0})),this.updateTimer=null):this.updateTimer=null}),this.updateRate))})),this.resizeObserver.observe(this.$container))}resetDragPosition(){this.lockAxis=null,this.friction=this.option("friction"),this.velocity={x:0,y:0,scale:0};const{x:t,y:e,scale:i}=this.content;this.dragStart={rect:this.$content.getBoundingClientRect(),x:t,y:e,scale:i},this.dragPosition={...this.dragPosition,x:t,y:e,scale:i},this.dragOffset={x:0,y:0,scale:1,time:0}}updateMetrics(t){!0!==t&&this.trigger("beforeUpdate");const e=this.$container,s=this.$content,o=this.$viewport,n=s instanceof HTMLImageElement,a=this.option("zoom"),r=this.option("resizeParent",a);let h=this.option("width"),l=this.option("height"),c=h||(d=s,Math.max(parseFloat(d.naturalWidth||0),parseFloat(d.width&&d.width.baseVal&&d.width.baseVal.value||0),parseFloat(d.offsetWidth||0),parseFloat(d.scrollWidth||0)));var d;let u=l||(t=>Math.max(parseFloat(t.naturalHeight||0),parseFloat(t.height&&t.height.baseVal&&t.height.baseVal.value||0),parseFloat(t.offsetHeight||0),parseFloat(t.scrollHeight||0)))(s);Object.assign(s.style,{width:h?`${h}px`:"",height:l?`${l}px`:"",maxWidth:"",maxHeight:""}),r&&Object.assign(o.style,{width:"",height:""});const f=this.option("ratio");c=i(c*f),u=i(u*f),h=c,l=u;const g=s.getBoundingClientRect(),p=o.getBoundingClientRect(),m=o==e?p:e.getBoundingClientRect();let y=Math.max(o.offsetWidth,i(p.width)),v=Math.max(o.offsetHeight,i(p.height)),b=window.getComputedStyle(o);if(y-=parseFloat(b.paddingLeft)+parseFloat(b.paddingRight),v-=parseFloat(b.paddingTop)+parseFloat(b.paddingBottom),this.viewport.width=y,this.viewport.height=v,a){if(Math.abs(c-g.width)>.1||Math.abs(u-g.height)>.1){const t=((t,e,i,s)=>{const o=Math.min(i/t||0,s/e);return{width:t*o||0,height:e*o||0}})(c,u,Math.min(c,g.width),Math.min(u,g.height));h=i(t.width),l=i(t.height)}Object.assign(s.style,{width:`${h}px`,height:`${l}px`,transform:""})}if(r&&(Object.assign(o.style,{width:`${h}px`,height:`${l}px`}),this.viewport={...this.viewport,width:h,height:l}),n&&a&&"function"!=typeof this.options.maxScale){const t=this.option("maxScale");this.options.maxScale=function(){return this.content.origWidth>0&&this.content.fitWidth>0?this.content.origWidth/this.content.fitWidth:t}}this.content={...this.content,origWidth:c,origHeight:u,fitWidth:h,fitHeight:l,width:h,height:l,scale:1,isZoomable:a},this.container={width:m.width,height:m.height},!0!==t&&this.trigger("afterUpdate")}zoomIn(t){this.zoomTo(this.content.scale+(t||this.option("step")))}zoomOut(t){this.zoomTo(this.content.scale-(t||this.option("step")))}toggleZoom(t={}){const e=this.option("maxScale"),i=this.option("baseScale"),s=this.content.scale>i+.5*(e-i)?i:e;this.zoomTo(s,t)}zoomTo(t=this.option("baseScale"),{x:e=null,y:s=null}={}){t=Math.max(Math.min(t,this.option("maxScale")),this.option("minScale"));const o=i(this.content.scale/(this.content.width/this.content.fitWidth),1e7);null===e&&(e=this.content.width*o*.5),null===s&&(s=this.content.height*o*.5);const{deltaX:n,deltaY:a}=this.getZoomDelta(t,e,s);e=this.content.x-n,s=this.content.y-a,this.panTo({x:e,y:s,scale:t,friction:this.option("zoomFriction")})}getZoomDelta(t,e=0,i=0){const s=this.content.fitWidth*this.content.scale,o=this.content.fitHeight*this.content.scale,n=e>0&&s?e/s:0,a=i>0&&o?i/o:0;return{deltaX:(this.content.fitWidth*t-s)*n,deltaY:(this.content.fitHeight*t-o)*a}}panTo({x:t=this.content.x,y:e=this.content.y,scale:i,friction:s=this.option("friction"),ignoreBounds:o=!1}={}){if(i=i||this.content.scale||1,!o){const{boundX:s,boundY:o}=this.getBounds(i);s&&(t=Math.max(Math.min(t,s.to),s.from)),o&&(e=Math.max(Math.min(e,o.to),o.from))}this.friction=s,this.transform={...this.transform,x:t,y:e,scale:i},s?(this.state="panning",this.velocity={x:(1/this.friction-1)*(t-this.content.x),y:(1/this.friction-1)*(e-this.content.y),scale:(1/this.friction-1)*(i-this.content.scale)},this.startAnimation()):this.endAnimation()}startAnimation(){this.rAF?cancelAnimationFrame(this.rAF):this.trigger("startAnimation"),this.rAF=requestAnimationFrame((()=>this.animate()))}animate(){if(this.setEdgeForce(),this.setDragForce(),this.velocity.x*=this.friction,this.velocity.y*=this.friction,this.velocity.scale*=this.friction,this.content.x+=this.velocity.x,this.content.y+=this.velocity.y,this.content.scale+=this.velocity.scale,this.isAnimating())this.setTransform();else if("pointerdown"!==this.state)return void this.endAnimation();this.rAF=requestAnimationFrame((()=>this.animate()))}getBounds(t){let e=this.boundX,s=this.boundY;if(void 0!==e&&void 0!==s)return{boundX:e,boundY:s};e={from:0,to:0},s={from:0,to:0},t=t||this.transform.scale;const o=this.content.fitWidth*t,n=this.content.fitHeight*t,a=this.viewport.width,r=this.viewport.height;if(o<a){const t=i(.5*(a-o));e.from=t,e.to=t}else e.from=i(a-o);if(n<r){const t=.5*(r-n);s.from=t,s.to=t}else s.from=i(r-n);return{boundX:e,boundY:s}}setEdgeForce(){if("decel"!==this.state)return;const t=this.option("bounceForce"),{boundX:e,boundY:i}=this.getBounds(Math.max(this.transform.scale,this.content.scale));let s,o,n,a;if(e&&(s=this.content.x<e.from,o=this.content.x>e.to),i&&(n=this.content.y<i.from,a=this.content.y>i.to),s||o){let i=((s?e.from:e.to)-this.content.x)*t;const o=this.content.x+(this.velocity.x+i)/this.friction;o>=e.from&&o<=e.to&&(i+=this.velocity.x),this.velocity.x=i,this.recalculateTransform()}if(n||a){let e=((n?i.from:i.to)-this.content.y)*t;const s=this.content.y+(e+this.velocity.y)/this.friction;s>=i.from&&s<=i.to&&(e+=this.velocity.y),this.velocity.y=e,this.recalculateTransform()}}setDragResistance(){if("pointerdown"!==this.state)return;const{boundX:t,boundY:e}=this.getBounds(this.dragPosition.scale);let i,s,o,n;if(t&&(i=this.dragPosition.x<t.from,s=this.dragPosition.x>t.to),e&&(o=this.dragPosition.y<e.from,n=this.dragPosition.y>e.to),(i||s)&&(!i||!s)){const e=i?t.from:t.to,s=e-this.dragPosition.x;this.dragPosition.x=e-.3*s}if((o||n)&&(!o||!n)){const t=o?e.from:e.to,i=t-this.dragPosition.y;this.dragPosition.y=t-.3*i}}setDragForce(){"pointerdown"===this.state&&(this.velocity.x=this.dragPosition.x-this.content.x,this.velocity.y=this.dragPosition.y-this.content.y,this.velocity.scale=this.dragPosition.scale-this.content.scale)}recalculateTransform(){this.transform.x=this.content.x+this.velocity.x/(1/this.friction-1),this.transform.y=this.content.y+this.velocity.y/(1/this.friction-1),this.transform.scale=this.content.scale+this.velocity.scale/(1/this.friction-1)}isAnimating(){return!(!this.friction||!(Math.abs(this.velocity.x)>.05||Math.abs(this.velocity.y)>.05||Math.abs(this.velocity.scale)>.05))}setTransform(t){let e,s,o;if(t?(e=i(this.transform.x),s=i(this.transform.y),o=this.transform.scale,this.content={...this.content,x:e,y:s,scale:o}):(e=i(this.content.x),s=i(this.content.y),o=this.content.scale/(this.content.width/this.content.fitWidth),this.content={...this.content,x:e,y:s}),this.trigger("beforeTransform"),e=i(this.content.x),s=i(this.content.y),t&&this.option("zoom")){let t,n;t=i(this.content.fitWidth*o),n=i(this.content.fitHeight*o),this.content.width=t,this.content.height=n,this.transform={...this.transform,width:t,height:n,scale:o},Object.assign(this.$content.style,{width:`${t}px`,height:`${n}px`,maxWidth:"none",maxHeight:"none",transform:`translate3d(${e}px, ${s}px, 0) scale(1)`})}else this.$content.style.transform=`translate3d(${e}px, ${s}px, 0) scale(${o})`;this.trigger("afterTransform")}endAnimation(t){cancelAnimationFrame(this.rAF),this.rAF=null,this.velocity={x:0,y:0,scale:0},this.setTransform(!0),this.state="ready",this.handleCursor(),!0!==t&&this.trigger("endAnimation")}handleCursor(){const t=this.option("draggableClass");t&&this.option("touch")&&(1==this.option("panOnlyZoomed")&&this.content.width<=this.viewport.width&&this.content.height<=this.viewport.height&&this.transform.scale<=this.option("baseScale")?this.$container.classList.remove(t):this.$container.classList.add(t))}detachEvents(){this.$content.removeEventListener("load",this.onLoad),this.$container.removeEventListener("wheel",this.onWheel,{passive:!1}),this.$container.removeEventListener("click",this.onClick,{passive:!1}),this.pointerTracker&&(this.pointerTracker.stop(),this.pointerTracker=null),this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null)}destroy(){"destroy"!==this.state&&(this.state="destroy",clearTimeout(this.updateTimer),this.updateTimer=null,cancelAnimationFrame(this.rAF),this.rAF=null,this.detachEvents(),this.detachPlugins(),this.resetDragPosition())}}d.version="4.0.31",d.Plugins={};const u=(t,e)=>{let i=0;return function(...s){const o=(new Date).getTime();if(!(o-i<e))return i=o,t(...s)}};class f{constructor(t){this.$container=null,this.$prev=null,this.$next=null,this.carousel=t,this.onRefresh=this.onRefresh.bind(this)}option(t){return this.carousel.option(`Navigation.${t}`)}createButton(t){const e=document.createElement("button");e.setAttribute("title",this.carousel.localize(`{{${t.toUpperCase()}}}`));const i=this.option("classNames.button")+" "+this.option(`classNames.${t}`);return e.classList.add(...i.split(" ")),e.setAttribute("tabindex","0"),e.innerHTML=this.carousel.localize(this.option(`${t}Tpl`)),e.addEventListener("click",(e=>{e.preventDefault(),e.stopPropagation(),this.carousel["slide"+("next"===t?"Next":"Prev")]()})),e}build(){this.$container||(this.$container=document.createElement("div"),this.$container.classList.add(...this.option("classNames.main").split(" ")),this.carousel.$container.appendChild(this.$container)),this.$next||(this.$next=this.createButton("next"),this.$container.appendChild(this.$next)),this.$prev||(this.$prev=this.createButton("prev"),this.$container.appendChild(this.$prev))}onRefresh(){const t=this.carousel.pages.length;t<=1||t>1&&this.carousel.elemDimWidth<this.carousel.wrapDimWidth&&!Number.isInteger(this.carousel.option("slidesPerPage"))?this.cleanup():(this.build(),this.$prev.removeAttribute("disabled"),this.$next.removeAttribute("disabled"),this.carousel.option("infiniteX",this.carousel.option("infinite"))||(this.carousel.page<=0&&this.$prev.setAttribute("disabled",""),this.carousel.page>=t-1&&this.$next.setAttribute("disabled","")))}cleanup(){this.$prev&&this.$prev.remove(),this.$prev=null,this.$next&&this.$next.remove(),this.$next=null,this.$container&&this.$container.remove(),this.$container=null}attach(){this.carousel.on("refresh change",this.onRefresh)}detach(){this.carousel.off("refresh change",this.onRefresh),this.cleanup()}}f.defaults={prevTpl:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" tabindex="-1"><path d="M15 3l-9 9 9 9"/></svg>',nextTpl:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" tabindex="-1"><path d="M9 3l9 9-9 9"/></svg>',classNames:{main:"carousel__nav",button:"carousel__button",next:"is-next",prev:"is-prev"}};class g{constructor(t){this.carousel=t,this.selectedIndex=null,this.friction=0,this.onNavReady=this.onNavReady.bind(this),this.onNavClick=this.onNavClick.bind(this),this.onNavCreateSlide=this.onNavCreateSlide.bind(this),this.onTargetChange=this.onTargetChange.bind(this)}addAsTargetFor(t){this.target=this.carousel,this.nav=t,this.attachEvents()}addAsNavFor(t){this.target=t,this.nav=this.carousel,this.attachEvents()}attachEvents(){this.nav.options.initialSlide=this.target.options.initialPage,this.nav.on("ready",this.onNavReady),this.nav.on("createSlide",this.onNavCreateSlide),this.nav.on("Panzoom.click",this.onNavClick),this.target.on("change",this.onTargetChange),this.target.on("Panzoom.afterUpdate",this.onTargetChange)}onNavReady(){this.onTargetChange(!0)}onNavClick(t,e,i){const s=i.target.closest(".carousel__slide");if(!s)return;i.stopPropagation();const o=parseInt(s.dataset.index,10),n=this.target.findPageForSlide(o);this.target.page!==n&&this.target.slideTo(n,{friction:this.friction}),this.markSelectedSlide(o)}onNavCreateSlide(t,e){e.index===this.selectedIndex&&this.markSelectedSlide(e.index)}onTargetChange(){const t=this.target.pages[this.target.page].indexes[0],e=this.nav.findPageForSlide(t);this.nav.slideTo(e),this.markSelectedSlide(t)}markSelectedSlide(t){this.selectedIndex=t,[...this.nav.slides].filter((t=>t.$el&&t.$el.classList.remove("is-nav-selected")));const e=this.nav.slides[t];e&&e.$el&&e.$el.classList.add("is-nav-selected")}attach(t){const e=t.options.Sync;(e.target||e.nav)&&(e.target?this.addAsNavFor(e.target):e.nav&&this.addAsTargetFor(e.nav),this.friction=e.friction)}detach(){this.nav&&(this.nav.off("ready",this.onNavReady),this.nav.off("Panzoom.click",this.onNavClick),this.nav.off("createSlide",this.onNavCreateSlide)),this.target&&(this.target.off("Panzoom.afterUpdate",this.onTargetChange),this.target.off("change",this.onTargetChange))}}g.defaults={friction:.92};const p={Navigation:f,Dots:class{constructor(t){this.carousel=t,this.$list=null,this.events={change:this.onChange.bind(this),refresh:this.onRefresh.bind(this)}}buildList(){if(this.carousel.pages.length<this.carousel.option("Dots.minSlideCount"))return;const t=document.createElement("ol");return t.classList.add("carousel__dots"),t.addEventListener("click",(t=>{if(!("page"in t.target.dataset))return;t.preventDefault(),t.stopPropagation();const e=parseInt(t.target.dataset.page,10),i=this.carousel;e!==i.page&&(i.pages.length<3&&i.option("infinite")?i[0==e?"slidePrev":"slideNext"]():i.slideTo(e))})),this.$list=t,this.carousel.$container.appendChild(t),this.carousel.$container.classList.add("has-dots"),t}removeList(){this.$list&&(this.$list.parentNode.removeChild(this.$list),this.$list=null),this.carousel.$container.classList.remove("has-dots")}rebuildDots(){let t=this.$list;const e=!!t,i=this.carousel.pages.length;if(i<2)return void(e&&this.removeList());e||(t=this.buildList());const s=this.$list.children.length;if(s>i)for(let t=i;t<s;t++)this.$list.removeChild(this.$list.lastChild);else{for(let t=s;t<i;t++){const e=document.createElement("li");e.classList.add("carousel__dot"),e.dataset.page=t,e.setAttribute("role","button"),e.setAttribute("tabindex","0"),e.setAttribute("title",this.carousel.localize("{{GOTO}}",[["%d",t+1]])),e.addEventListener("keydown",(t=>{const i=t.code;let s;"Enter"===i||"NumpadEnter"===i?s=e:"ArrowRight"===i?s=e.nextSibling:"ArrowLeft"===i&&(s=e.previousSibling),s&&s.click()})),this.$list.appendChild(e)}this.setActiveDot()}}setActiveDot(){if(!this.$list)return;this.$list.childNodes.forEach((t=>{t.classList.remove("is-selected")}));const t=this.$list.childNodes[this.carousel.page];t&&t.classList.add("is-selected")}onChange(){this.setActiveDot()}onRefresh(){this.rebuildDots()}attach(){this.carousel.on(this.events)}detach(){this.removeList(),this.carousel.off(this.events),this.carousel=null}},Sync:g};const m={slides:[],preload:0,slidesPerPage:"auto",initialPage:null,initialSlide:null,friction:.92,center:!0,infinite:!0,fill:!0,dragFree:!1,prefix:"",classNames:{viewport:"carousel__viewport",track:"carousel__track",slide:"carousel__slide",slideSelected:"is-selected"},l10n:{NEXT:"Next slide",PREV:"Previous slide",GOTO:"Go to slide #%d"}};class y extends l{constructor(t,i={}){if(super(i=e(!0,{},m,i)),this.state="init",this.$container=t,!(this.$container instanceof HTMLElement))throw new Error("No root element provided");this.slideNext=u(this.slideNext.bind(this),250),this.slidePrev=u(this.slidePrev.bind(this),250),this.init(),t.__Carousel=this}init(){this.pages=[],this.page=this.pageIndex=null,this.prevPage=this.prevPageIndex=null,this.attachPlugins(y.Plugins),this.trigger("init"),this.initLayout(),this.initSlides(),this.updateMetrics(),this.$track&&this.pages.length&&(this.$track.style.transform=`translate3d(${-1*this.pages[this.page].left}px, 0px, 0) scale(1)`),this.manageSlideVisiblity(),this.initPanzoom(),this.state="ready",this.trigger("ready")}initLayout(){const t=this.option("prefix"),e=this.option("classNames");this.$viewport=this.option("viewport")||this.$container.querySelector(`.${t}${e.viewport}`),this.$viewport||(this.$viewport=document.createElement("div"),this.$viewport.classList.add(...(t+e.viewport).split(" ")),this.$viewport.append(...this.$container.childNodes),this.$container.appendChild(this.$viewport)),this.$track=this.option("track")||this.$container.querySelector(`.${t}${e.track}`),this.$track||(this.$track=document.createElement("div"),this.$track.classList.add(...(t+e.track).split(" ")),this.$track.append(...this.$viewport.childNodes),this.$viewport.appendChild(this.$track))}initSlides(){this.slides=[];this.$viewport.querySelectorAll(`.${this.option("prefix")}${this.option("classNames.slide")}`).forEach((t=>{const e={$el:t,isDom:!0};this.slides.push(e),this.trigger("createSlide",e,this.slides.length)})),Array.isArray(this.options.slides)&&(this.slides=e(!0,[...this.slides],this.options.slides))}updateMetrics(){let t,e=0,s=[];this.slides.forEach(((i,o)=>{const n=i.$el,a=i.isDom||!t?this.getSlideMetrics(n):t;i.index=o,i.width=a,i.left=e,t=a,e+=a,s.push(o)}));let o=Math.max(this.$track.offsetWidth,i(this.$track.getBoundingClientRect().width)),n=getComputedStyle(this.$track);o-=parseFloat(n.paddingLeft)+parseFloat(n.paddingRight),this.contentWidth=e,this.viewportWidth=o;const a=[],r=this.option("slidesPerPage");if(Number.isInteger(r)&&e>o)for(let t=0;t<this.slides.length;t+=r)a.push({indexes:s.slice(t,t+r),slides:this.slides.slice(t,t+r)});else{let t=0,e=0;for(let i=0;i<this.slides.length;i+=1){let s=this.slides[i];(!a.length||e+s.width>o)&&(a.push({indexes:[],slides:[]}),t=a.length-1,e=0),e+=s.width,a[t].indexes.push(i),a[t].slides.push(s)}}const h=this.option("center"),l=this.option("fill");a.forEach(((t,i)=>{t.index=i,t.width=t.slides.reduce(((t,e)=>t+e.width),0),t.left=t.slides[0].left,h&&(t.left+=.5*(o-t.width)*-1),l&&!this.option("infiniteX",this.option("infinite"))&&e>o&&(t.left=Math.max(t.left,0),t.left=Math.min(t.left,e-o))}));const c=[];let d;a.forEach((t=>{const e={...t};d&&e.left===d.left?(d.width+=e.width,d.slides=[...d.slides,...e.slides],d.indexes=[...d.indexes,...e.indexes]):(e.index=c.length,d=e,c.push(e))})),this.pages=c;let u=this.page;if(null===u){const t=this.option("initialSlide");u=null!==t?this.findPageForSlide(t):parseInt(this.option("initialPage",0),10)||0,c[u]||(u=c.length&&u>c.length?c[c.length-1].index:0),this.page=u,this.pageIndex=u}this.updatePanzoom(),this.trigger("refresh")}getSlideMetrics(t){if(!t){const e=this.slides[0];(t=document.createElement("div")).dataset.isTestEl=1,t.style.visibility="hidden",t.classList.add(...(this.option("prefix")+this.option("classNames.slide")).split(" ")),e.customClass&&t.classList.add(...e.customClass.split(" ")),this.$track.prepend(t)}let e=Math.max(t.offsetWidth,i(t.getBoundingClientRect().width));const s=t.currentStyle||window.getComputedStyle(t);return e=e+(parseFloat(s.marginLeft)||0)+(parseFloat(s.marginRight)||0),t.dataset.isTestEl&&t.remove(),e}findPageForSlide(t){t=parseInt(t,10)||0;const e=this.pages.find((e=>e.indexes.indexOf(t)>-1));return e?e.index:null}slideNext(){this.slideTo(this.pageIndex+1)}slidePrev(){this.slideTo(this.pageIndex-1)}slideTo(t,e={}){const{x:i=-1*this.setPage(t,!0),y:s=0,friction:o=this.option("friction")}=e;this.Panzoom.content.x===i&&!this.Panzoom.velocity.x&&o||(this.Panzoom.panTo({x:i,y:s,friction:o,ignoreBounds:!0}),"ready"===this.state&&"ready"===this.Panzoom.state&&this.trigger("settle"))}initPanzoom(){this.Panzoom&&this.Panzoom.destroy();const t=e(!0,{},{content:this.$track,wrapInner:!1,resizeParent:!1,zoom:!1,click:!1,lockAxis:"x",x:this.pages.length?-1*this.pages[this.page].left:0,centerOnStart:!1,textSelection:()=>this.option("textSelection",!1),panOnlyZoomed:function(){return this.content.width<=this.viewport.width}},this.option("Panzoom"));this.Panzoom=new d(this.$container,t),this.Panzoom.on({"*":(t,...e)=>this.trigger(`Panzoom.${t}`,...e),afterUpdate:()=>{this.updatePage()},beforeTransform:this.onBeforeTransform.bind(this),touchEnd:this.onTouchEnd.bind(this),endAnimation:()=>{this.trigger("settle")}}),this.updateMetrics(),this.manageSlideVisiblity()}updatePanzoom(){this.Panzoom&&(this.Panzoom.content={...this.Panzoom.content,fitWidth:this.contentWidth,origWidth:this.contentWidth,width:this.contentWidth},this.pages.length>1&&this.option("infiniteX",this.option("infinite"))?this.Panzoom.boundX=null:this.pages.length&&(this.Panzoom.boundX={from:-1*this.pages[this.pages.length-1].left,to:-1*this.pages[0].left}),this.option("infiniteY",this.option("infinite"))?this.Panzoom.boundY=null:this.Panzoom.boundY={from:0,to:0},this.Panzoom.handleCursor())}manageSlideVisiblity(){const t=this.contentWidth,e=this.viewportWidth;let i=this.Panzoom?-1*this.Panzoom.content.x:this.pages.length?this.pages[this.page].left:0;const s=this.option("preload"),o=this.option("infiniteX",this.option("infinite")),n=parseFloat(getComputedStyle(this.$viewport,null).getPropertyValue("padding-left")),a=parseFloat(getComputedStyle(this.$viewport,null).getPropertyValue("padding-right"));this.slides.forEach((r=>{let h,l,c=0;h=i-n,l=i+e+a,h-=s*(e+n+a),l+=s*(e+n+a);const d=r.left+r.width>h&&r.left<l;h=i+t-n,l=i+t+e+a,h-=s*(e+n+a);const u=o&&r.left+r.width>h&&r.left<l;h=i-t-n,l=i-t+e+a,h-=s*(e+n+a);const f=o&&r.left+r.width>h&&r.left<l;u||d||f?(this.createSlideEl(r),d&&(c=0),u&&(c=-1),f&&(c=1),r.left+r.width>i&&r.left<=i+e+a&&(c=0)):this.removeSlideEl(r),r.hasDiff=c}));let r=0,h=0;this.slides.forEach(((e,i)=>{let s=0;e.$el?(i!==r||e.hasDiff?s=h+e.hasDiff*t:h=0,e.$el.style.left=Math.abs(s)>.1?`${h+e.hasDiff*t}px`:"",r++):h+=e.width})),this.markSelectedSlides()}createSlideEl(t){if(!t)return;if(t.$el){let e=t.$el.dataset.index;if(!e||parseInt(e,10)!==t.index){let e;t.$el.dataset.index=t.index,t.$el.querySelectorAll("[data-lazy-srcset]").forEach((t=>{t.srcset=t.dataset.lazySrcset})),t.$el.querySelectorAll("[data-lazy-src]").forEach((t=>{let e=t.dataset.lazySrc;t instanceof HTMLImageElement?t.src=e:t.style.backgroundImage=`url('${e}')`})),(e=t.$el.dataset.lazySrc)&&(t.$el.style.backgroundImage=`url('${e}')`),t.state="ready"}return}const e=document.createElement("div");e.dataset.index=t.index,e.classList.add(...(this.option("prefix")+this.option("classNames.slide")).split(" ")),t.customClass&&e.classList.add(...t.customClass.split(" ")),t.html&&(e.innerHTML=t.html);const i=[];this.slides.forEach(((t,e)=>{t.$el&&i.push(e)}));const s=t.index;let o=null;if(i.length){let t=i.reduce(((t,e)=>Math.abs(e-s)<Math.abs(t-s)?e:t));o=this.slides[t]}return this.$track.insertBefore(e,o&&o.$el?o.index<t.index?o.$el.nextSibling:o.$el:null),t.$el=e,this.trigger("createSlide",t,s),t}removeSlideEl(t){t.$el&&!t.isDom&&(this.trigger("removeSlide",t),t.$el.remove(),t.$el=null)}markSelectedSlides(){const t=this.option("classNames.slideSelected"),e="aria-hidden";this.slides.forEach(((i,s)=>{const o=i.$el;if(!o)return;const n=this.pages[this.page];n&&n.indexes&&n.indexes.indexOf(s)>-1?(t&&!o.classList.contains(t)&&(o.classList.add(t),this.trigger("selectSlide",i)),o.removeAttribute(e)):(t&&o.classList.contains(t)&&(o.classList.remove(t),this.trigger("unselectSlide",i)),o.setAttribute(e,!0))}))}updatePage(){this.updateMetrics(),this.slideTo(this.page,{friction:0})}onBeforeTransform(){this.option("infiniteX",this.option("infinite"))&&this.manageInfiniteTrack(),this.manageSlideVisiblity()}manageInfiniteTrack(){const t=this.contentWidth,e=this.viewportWidth;if(!this.option("infiniteX",this.option("infinite"))||this.pages.length<2||t<e)return;const i=this.Panzoom;let s=!1;return i.content.x<-1*(t-e)&&(i.content.x+=t,this.pageIndex=this.pageIndex-this.pages.length,s=!0),i.content.x>e&&(i.content.x-=t,this.pageIndex=this.pageIndex+this.pages.length,s=!0),s&&"pointerdown"===i.state&&i.resetDragPosition(),s}onTouchEnd(t,e){const i=this.option("dragFree");if(!i&&this.pages.length>1&&t.dragOffset.time<350&&Math.abs(t.dragOffset.y)<1&&Math.abs(t.dragOffset.x)>5)this[t.dragOffset.x<0?"slideNext":"slidePrev"]();else if(i){const[,e]=this.getPageFromPosition(-1*t.transform.x);this.setPage(e)}else this.slideToClosest()}slideToClosest(t={}){let[,e]=this.getPageFromPosition(-1*this.Panzoom.content.x);this.slideTo(e,t)}getPageFromPosition(t){const e=this.pages.length;this.option("center")&&(t+=.5*this.viewportWidth);const i=Math.floor(t/this.contentWidth);t-=i*this.contentWidth;let s=this.slides.find((e=>e.left<=t&&e.left+e.width>t));if(s){let t=this.findPageForSlide(s.index);return[t,t+i*e]}return[0,0]}setPage(t,e){let i=0,s=parseInt(t,10)||0;const o=this.page,n=this.pageIndex,a=this.pages.length,r=this.contentWidth,h=this.viewportWidth;if(t=(s%a+a)%a,this.option("infiniteX",this.option("infinite"))&&r>h){const o=Math.floor(s/a)||0,n=r;if(i=this.pages[t].left+o*n,!0===e&&a>2){let t=-1*this.Panzoom.content.x;const e=i-n,o=i+n,r=Math.abs(t-i),h=Math.abs(t-e),l=Math.abs(t-o);l<r&&l<=h?(i=o,s+=a):h<r&&h<l&&(i=e,s-=a)}}else t=s=Math.max(0,Math.min(s,a-1)),i=this.pages.length?this.pages[t].left:0;return this.page=t,this.pageIndex=s,null!==o&&t!==o&&(this.prevPage=o,this.prevPageIndex=n,this.trigger("change",t,o)),i}destroy(){this.state="destroy",this.slides.forEach((t=>{this.removeSlideEl(t)})),this.slides=[],this.Panzoom.destroy(),this.detachPlugins()}}y.version="4.0.31",y.Plugins=p;const v=!("undefined"==typeof window||!window.document||!window.document.createElement);let b=null;const x=["a[href]","area[href]",'input:not([disabled]):not([type="hidden"]):not([aria-hidden])',"select:not([disabled]):not([aria-hidden])","textarea:not([disabled]):not([aria-hidden])","button:not([disabled]):not([aria-hidden])","iframe","object","embed","video","audio","[contenteditable]",'[tabindex]:not([tabindex^="-"]):not([disabled]):not([aria-hidden])'],w=t=>{if(t&&v){null===b&&document.createElement("div").focus({get preventScroll(){return b=!0,!1}});try{if(t.setActive)t.setActive();else if(b)t.focus({preventScroll:!0});else{const e=window.pageXOffset||document.body.scrollTop,i=window.pageYOffset||document.body.scrollLeft;t.focus(),document.body.scrollTo({top:e,left:i,behavior:"auto"})}}catch(t){}}};const $={minSlideCount:2,minScreenHeight:500,autoStart:!0,key:"t",Carousel:{},tpl:'<div class="fancybox__thumb" style="background-image:url(\'{{src}}\')"></div>'};class C{constructor(t){this.fancybox=t,this.$container=null,this.state="init";for(const t of["onPrepare","onClosing","onKeydown"])this[t]=this[t].bind(this);this.events={prepare:this.onPrepare,closing:this.onClosing,keydown:this.onKeydown}}onPrepare(){this.getSlides().length<this.fancybox.option("Thumbs.minSlideCount")?this.state="disabled":!0===this.fancybox.option("Thumbs.autoStart")&&this.fancybox.Carousel.Panzoom.content.height>=this.fancybox.option("Thumbs.minScreenHeight")&&this.build()}onClosing(){this.Carousel&&this.Carousel.Panzoom.detachEvents()}onKeydown(t,e){e===t.option("Thumbs.key")&&this.toggle()}build(){if(this.$container)return;const t=document.createElement("div");t.classList.add("fancybox__thumbs"),this.fancybox.$carousel.parentNode.insertBefore(t,this.fancybox.$carousel.nextSibling),this.Carousel=new y(t,e(!0,{Dots:!1,Navigation:!1,Sync:{friction:0},infinite:!1,center:!0,fill:!0,dragFree:!0,slidesPerPage:1,preload:1},this.fancybox.option("Thumbs.Carousel"),{Sync:{target:this.fancybox.Carousel},slides:this.getSlides()})),this.Carousel.Panzoom.on("wheel",((t,e)=>{e.preventDefault(),this.fancybox[e.deltaY<0?"prev":"next"]()})),this.$container=t,this.state="visible"}getSlides(){const t=[];for(const e of this.fancybox.items){const i=e.thumb;i&&t.push({html:this.fancybox.option("Thumbs.tpl").replace(/\{\{src\}\}/gi,i),customClass:`has-thumb has-${e.type||"image"}`})}return t}toggle(){"visible"===this.state?this.hide():"hidden"===this.state?this.show():this.build()}show(){"hidden"===this.state&&(this.$container.style.display="",this.Carousel.Panzoom.attachEvents(),this.state="visible")}hide(){"visible"===this.state&&(this.Carousel.Panzoom.detachEvents(),this.$container.style.display="none",this.state="hidden")}cleanup(){this.Carousel&&(this.Carousel.destroy(),this.Carousel=null),this.$container&&(this.$container.remove(),this.$container=null),this.state="init"}attach(){this.fancybox.on(this.events)}detach(){this.fancybox.off(this.events),this.cleanup()}}C.defaults=$;const S=(t,e)=>{const i=new URL(t),s=new URLSearchParams(i.search);let o=new URLSearchParams;for(const[t,i]of[...s,...Object.entries(e)])"t"===t?o.set("start",parseInt(i)):o.set(t,i);o=o.toString();let n=t.match(/#t=((.*)?\d+s)/);return n&&(o+=`#t=${n[1]}`),o},E={video:{autoplay:!0,ratio:16/9},youtube:{autohide:1,fs:1,rel:0,hd:1,wmode:"transparent",enablejsapi:1,html5:1},vimeo:{hd:1,show_title:1,show_byline:1,show_portrait:0,fullscreen:1},html5video:{tpl:'<video class="fancybox__html5video" playsinline controls controlsList="nodownload" poster="{{poster}}">\n <source src="{{src}}" type="{{format}}" />Sorry, your browser doesn\'t support embedded videos.</video>',format:""}};class P{constructor(t){this.fancybox=t;for(const t of["onInit","onReady","onCreateSlide","onRemoveSlide","onSelectSlide","onUnselectSlide","onRefresh","onMessage"])this[t]=this[t].bind(this);this.events={init:this.onInit,ready:this.onReady,"Carousel.createSlide":this.onCreateSlide,"Carousel.removeSlide":this.onRemoveSlide,"Carousel.selectSlide":this.onSelectSlide,"Carousel.unselectSlide":this.onUnselectSlide,"Carousel.refresh":this.onRefresh}}onInit(){for(const t of this.fancybox.items)this.processType(t)}processType(t){if(t.html)return t.src=t.html,t.type="html",void delete t.html;const i=t.src||"";let s=t.type||this.fancybox.options.type,o=null;if(!i||"string"==typeof i){if(o=i.match(/(?:youtube\.com|youtu\.be|youtube\-nocookie\.com)\/(?:watch\?(?:.*&)?v=|v\/|u\/|embed\/?)?(videoseries\?list=(?:.*)|[\w-]{11}|\?listType=(?:.*)&list=(?:.*))(?:.*)/i)){const e=S(i,this.fancybox.option("Html.youtube")),n=encodeURIComponent(o[1]);t.videoId=n,t.src=`https://www.youtube-nocookie.com/embed/${n}?${e}`,t.thumb=t.thumb||`https://i.ytimg.com/vi/${n}/mqdefault.jpg`,t.vendor="youtube",s="video"}else if(o=i.match(/^.+vimeo.com\/(?:\/)?([\d]+)(.*)?/)){const e=S(i,this.fancybox.option("Html.vimeo")),n=encodeURIComponent(o[1]);t.videoId=n,t.src=`https://player.vimeo.com/video/${n}?${e}`,t.vendor="vimeo",s="video"}else(o=i.match(/(?:maps\.)?google\.([a-z]{2,3}(?:\.[a-z]{2})?)\/(?:(?:(?:maps\/(?:place\/(?:.*)\/)?\@(.*),(\d+.?\d+?)z))|(?:\?ll=))(.*)?/i))?(t.src=`//maps.google.${o[1]}/?ll=${(o[2]?o[2]+"&z="+Math.floor(o[3])+(o[4]?o[4].replace(/^\//,"&"):""):o[4]+"").replace(/\?/,"&")}&output=${o[4]&&o[4].indexOf("layer=c")>0?"svembed":"embed"}`,s="map"):(o=i.match(/(?:maps\.)?google\.([a-z]{2,3}(?:\.[a-z]{2})?)\/(?:maps\/search\/)(.*)/i))&&(t.src=`//maps.google.${o[1]}/maps?q=${o[2].replace("query=","q=").replace("api=1","")}&output=embed`,s="map");s||("#"===i.charAt(0)?s="inline":(o=i.match(/\.(mp4|mov|ogv|webm)((\?|#).*)?$/i))?(s="html5video",t.format=t.format||"video/"+("ogv"===o[1]?"ogg":o[1])):i.match(/(^data:image\/[a-z0-9+\/=]*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp|svg|ico)((\?|#).*)?$)/i)?s="image":i.match(/\.(pdf)((\?|#).*)?$/i)&&(s="pdf")),t.type=s||this.fancybox.option("defaultType","image"),"html5video"!==s&&"video"!==s||(t.video=e({},this.fancybox.option("Html.video"),t.video),t._width&&t._height?t.ratio=parseFloat(t._width)/parseFloat(t._height):t.ratio=t.ratio||t.video.ratio||E.video.ratio)}}onReady(){this.fancybox.Carousel.slides.forEach((t=>{t.$el&&(this.setContent(t),t.index===this.fancybox.getSlide().index&&this.playVideo(t))}))}onCreateSlide(t,e,i){"ready"===this.fancybox.state&&this.setContent(i)}loadInlineContent(t){let e;if(t.src instanceof HTMLElement)e=t.src;else if("string"==typeof t.src){const i=t.src.split("#",2),s=2===i.length&&""===i[0]?i[1]:i[0];e=document.getElementById(s)}if(e){if("clone"===t.type||e.$placeHolder){e=e.cloneNode(!0);let i=e.getAttribute("id");i=i?`${i}--clone`:`clone-${this.fancybox.id}-${t.index}`,e.setAttribute("id",i)}else{const t=document.createElement("div");t.classList.add("fancybox-placeholder"),e.parentNode.insertBefore(t,e),e.$placeHolder=t}this.fancybox.setContent(t,e)}else this.fancybox.setError(t,"{{ELEMENT_NOT_FOUND}}")}loadAjaxContent(t){const e=this.fancybox,i=new XMLHttpRequest;e.showLoading(t),i.onreadystatechange=function(){i.readyState===XMLHttpRequest.DONE&&"ready"===e.state&&(e.hideLoading(t),200===i.status?e.setContent(t,i.responseText):e.setError(t,404===i.status?"{{AJAX_NOT_FOUND}}":"{{AJAX_FORBIDDEN}}"))};const s=t.ajax||null;i.open(s?"POST":"GET",t.src),i.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),i.setRequestHeader("X-Requested-With","XMLHttpRequest"),i.send(s),t.xhr=i}loadIframeContent(t){const e=this.fancybox,i=document.createElement("iframe");if(i.className="fancybox__iframe",i.setAttribute("id",`fancybox__iframe_${e.id}_${t.index}`),i.setAttribute("allow","autoplay; fullscreen"),i.setAttribute("scrolling","auto"),t.$iframe=i,"iframe"!==t.type||!1===t.preload)return i.setAttribute("src",t.src),this.fancybox.setContent(t,i),void this.resizeIframe(t);e.showLoading(t);const s=document.createElement("div");s.style.visibility="hidden",this.fancybox.setContent(t,s),s.appendChild(i),i.onerror=()=>{e.setError(t,"{{IFRAME_ERROR}}")},i.onload=()=>{e.hideLoading(t);let s=!1;i.isReady||(i.isReady=!0,s=!0),i.src.length&&(i.parentNode.style.visibility="",this.resizeIframe(t),s&&e.revealContent(t))},i.setAttribute("src",t.src)}setAspectRatio(t){const e=t.$content,i=t.ratio;if(!e)return;let s=t._width,o=t._height;if(i||s&&o){Object.assign(e.style,{width:s&&o?"100%":"",height:s&&o?"100%":"",maxWidth:"",maxHeight:""});let t=e.offsetWidth,n=e.offsetHeight;if(s=s||t,o=o||n,s>t||o>n){let e=Math.min(t/s,n/o);s*=e,o*=e}Math.abs(s/o-i)>.01&&(i<s/o?s=o*i:o=s/i),Object.assign(e.style,{width:`${s}px`,height:`${o}px`})}}resizeIframe(t){const e=t.$iframe;if(!e)return;let i=t._width||0,s=t._height||0;i&&s&&(t.autoSize=!1);const o=e.parentNode,n=o&&o.style;if(!1!==t.preload&&!1!==t.autoSize&&n)try{const t=window.getComputedStyle(o),a=parseFloat(t.paddingLeft)+parseFloat(t.paddingRight),r=parseFloat(t.paddingTop)+parseFloat(t.paddingBottom),h=e.contentWindow.document,l=h.getElementsByTagName("html")[0],c=h.body;n.width="",c.style.overflow="hidden",i=i||l.scrollWidth+a,n.width=`${i}px`,c.style.overflow="",n.flex="0 0 auto",n.height=`${c.scrollHeight}px`,s=l.scrollHeight+r}catch(t){}if(i||s){const t={flex:"0 1 auto"};i&&(t.width=`${i}px`),s&&(t.height=`${s}px`),Object.assign(n,t)}}onRefresh(t,e){e.slides.forEach((t=>{t.$el&&(t.$iframe&&this.resizeIframe(t),t.ratio&&this.setAspectRatio(t))}))}setContent(t){if(t&&!t.isDom){switch(t.type){case"html":this.fancybox.setContent(t,t.src);break;case"html5video":this.fancybox.setContent(t,this.fancybox.option("Html.html5video.tpl").replace(/\{\{src\}\}/gi,t.src).replace("{{format}}",t.format||t.html5video&&t.html5video.format||"").replace("{{poster}}",t.poster||t.thumb||""));break;case"inline":case"clone":this.loadInlineContent(t);break;case"ajax":this.loadAjaxContent(t);break;case"pdf":case"video":case"map":t.preload=!1;case"iframe":this.loadIframeContent(t)}t.ratio&&this.setAspectRatio(t)}}onSelectSlide(t,e,i){"ready"===t.state&&this.playVideo(i)}playVideo(t){if("html5video"===t.type&&t.video.autoplay)try{const e=t.$el.querySelector("video");if(e){const t=e.play();void 0!==t&&t.then((()=>{})).catch((t=>{e.muted=!0,e.play()}))}}catch(t){}if("video"!==t.type||!t.$iframe||!t.$iframe.contentWindow)return;const e=()=>{if("done"===t.state&&t.$iframe&&t.$iframe.contentWindow){let e;if(t.$iframe.isReady)return t.video&&t.video.autoplay&&(e="youtube"==t.vendor?{event:"command",func:"playVideo"}:{method:"play",value:"true"}),void(e&&t.$iframe.contentWindow.postMessage(JSON.stringify(e),"*"));"youtube"===t.vendor&&(e={event:"listening",id:t.$iframe.getAttribute("id")},t.$iframe.contentWindow.postMessage(JSON.stringify(e),"*"))}t.poller=setTimeout(e,250)};e()}onUnselectSlide(t,e,i){if("html5video"===i.type){try{i.$el.querySelector("video").pause()}catch(t){}return}let s=!1;"vimeo"==i.vendor?s={method:"pause",value:"true"}:"youtube"===i.vendor&&(s={event:"command",func:"pauseVideo"}),s&&i.$iframe&&i.$iframe.contentWindow&&i.$iframe.contentWindow.postMessage(JSON.stringify(s),"*"),clearTimeout(i.poller)}onRemoveSlide(t,e,i){i.xhr&&(i.xhr.abort(),i.xhr=null),i.$iframe&&(i.$iframe.onload=i.$iframe.onerror=null,i.$iframe.src="//about:blank",i.$iframe=null);const s=i.$content;"inline"===i.type&&s&&(s.classList.remove("fancybox__content"),"none"!==s.style.display&&(s.style.display="none")),i.$closeButton&&(i.$closeButton.remove(),i.$closeButton=null);const o=s&&s.$placeHolder;o&&(o.parentNode.insertBefore(s,o),o.remove(),s.$placeHolder=null)}onMessage(t){try{let e=JSON.parse(t.data);if("https://player.vimeo.com"===t.origin){if("ready"===e.event)for(let e of document.getElementsByClassName("fancybox__iframe"))e.contentWindow===t.source&&(e.isReady=1)}else"https://www.youtube-nocookie.com"===t.origin&&"onReady"===e.event&&(document.getElementById(e.id).isReady=1)}catch(t){}}attach(){this.fancybox.on(this.events),window.addEventListener("message",this.onMessage,!1)}detach(){this.fancybox.off(this.events),window.removeEventListener("message",this.onMessage,!1)}}P.defaults=E;class T{constructor(t){this.fancybox=t;for(const t of["onReady","onClosing","onDone","onPageChange","onCreateSlide","onRemoveSlide","onImageStatusChange"])this[t]=this[t].bind(this);this.events={ready:this.onReady,closing:this.onClosing,done:this.onDone,"Carousel.change":this.onPageChange,"Carousel.createSlide":this.onCreateSlide,"Carousel.removeSlide":this.onRemoveSlide}}onReady(){this.fancybox.Carousel.slides.forEach((t=>{t.$el&&this.setContent(t)}))}onDone(t,e){this.handleCursor(e)}onClosing(t){clearTimeout(this.clickTimer),this.clickTimer=null,t.Carousel.slides.forEach((t=>{t.$image&&(t.state="destroy"),t.Panzoom&&t.Panzoom.detachEvents()})),"closing"===this.fancybox.state&&this.canZoom(t.getSlide())&&this.zoomOut()}onCreateSlide(t,e,i){"ready"===this.fancybox.state&&this.setContent(i)}onRemoveSlide(t,e,i){i.$image&&(i.$el.classList.remove(t.option("Image.canZoomInClass")),i.$image.remove(),i.$image=null),i.Panzoom&&(i.Panzoom.destroy(),i.Panzoom=null),i.$el&&i.$el.dataset&&delete i.$el.dataset.imageFit}setContent(t){if(t.isDom||t.html||t.type&&"image"!==t.type)return;if(t.$image)return;t.type="image",t.state="loading";const e=document.createElement("div");e.style.visibility="hidden";const i=document.createElement("img");i.addEventListener("load",(e=>{e.stopImmediatePropagation(),this.onImageStatusChange(t)})),i.addEventListener("error",(()=>{this.onImageStatusChange(t)})),i.src=t.src,i.alt="",i.draggable=!1,i.classList.add("fancybox__image"),t.srcset&&i.setAttribute("srcset",t.srcset),t.sizes&&i.setAttribute("sizes",t.sizes),t.$image=i;const s=this.fancybox.option("Image.wrap");if(s){const o=document.createElement("div");o.classList.add("string"==typeof s?s:"fancybox__image-wrap"),o.appendChild(i),e.appendChild(o),t.$wrap=o}else e.appendChild(i);t.$el.dataset.imageFit=this.fancybox.option("Image.fit"),this.fancybox.setContent(t,e),i.complete||i.error?this.onImageStatusChange(t):this.fancybox.showLoading(t)}onImageStatusChange(t){const e=t.$image;e&&"loading"===t.state&&(e.complete&&e.naturalWidth&&e.naturalHeight?(this.fancybox.hideLoading(t),"contain"===this.fancybox.option("Image.fit")&&this.initSlidePanzoom(t),t.$el.addEventListener("wheel",(e=>this.onWheel(t,e)),{passive:!1}),t.$content.addEventListener("click",(e=>this.onClick(t,e)),{passive:!1}),this.revealContent(t)):this.fancybox.setError(t,"{{IMAGE_ERROR}}"))}initSlidePanzoom(t){t.Panzoom||(t.Panzoom=new d(t.$el,e(!0,this.fancybox.option("Image.Panzoom",{}),{viewport:t.$wrap,content:t.$image,width:t._width,height:t._height,wrapInner:!1,textSelection:!0,touch:this.fancybox.option("Image.touch"),panOnlyZoomed:!0,click:!1,wheel:!1})),t.Panzoom.on("startAnimation",(()=>{this.fancybox.trigger("Image.startAnimation",t)})),t.Panzoom.on("endAnimation",(()=>{"zoomIn"===t.state&&this.fancybox.done(t),this.handleCursor(t),this.fancybox.trigger("Image.endAnimation",t)})),t.Panzoom.on("afterUpdate",(()=>{this.handleCursor(t),this.fancybox.trigger("Image.afterUpdate",t)})))}revealContent(t){null===this.fancybox.Carousel.prevPage&&t.index===this.fancybox.options.startIndex&&this.canZoom(t)?this.zoomIn():this.fancybox.revealContent(t)}getZoomInfo(t){const e=t.$thumb.getBoundingClientRect(),i=e.width,s=e.height,o=t.$content.getBoundingClientRect(),n=o.width,a=o.height,r=o.top-e.top,h=o.left-e.left;let l=this.fancybox.option("Image.zoomOpacity");return"auto"===l&&(l=Math.abs(i/s-n/a)>.1),{top:r,left:h,scale:n&&i?i/n:1,opacity:l}}canZoom(t){const e=this.fancybox,i=e.$container;if(window.visualViewport&&1!==window.visualViewport.scale)return!1;if(t.Panzoom&&!t.Panzoom.content.width)return!1;if(!e.option("Image.zoom")||"contain"!==e.option("Image.fit"))return!1;const s=t.$thumb;if(!s||"loading"===t.state)return!1;i.classList.add("fancybox__no-click");const o=s.getBoundingClientRect();let n;if(this.fancybox.option("Image.ignoreCoveredThumbnail")){const t=document.elementFromPoint(o.left+1,o.top+1)===s,e=document.elementFromPoint(o.right-1,o.bottom-1)===s;n=t&&e}else n=document.elementFromPoint(o.left+.5*o.width,o.top+.5*o.height)===s;return i.classList.remove("fancybox__no-click"),n}zoomIn(){const t=this.fancybox,e=t.getSlide(),i=e.Panzoom,{top:s,left:o,scale:n,opacity:a}=this.getZoomInfo(e);t.trigger("reveal",e),i.panTo({x:-1*o,y:-1*s,scale:n,friction:0,ignoreBounds:!0}),e.$content.style.visibility="",e.state="zoomIn",!0===a&&i.on("afterTransform",(t=>{"zoomIn"!==e.state&&"zoomOut"!==e.state||(t.$content.style.opacity=Math.min(1,1-(1-t.content.scale)/(1-n)))})),i.panTo({x:0,y:0,scale:1,friction:this.fancybox.option("Image.zoomFriction")})}zoomOut(){const t=this.fancybox,e=t.getSlide(),i=e.Panzoom;if(!i)return;e.state="zoomOut",t.state="customClosing",e.$caption&&(e.$caption.style.visibility="hidden");let s=this.fancybox.option("Image.zoomFriction");const o=t=>{const{top:o,left:n,scale:a,opacity:r}=this.getZoomInfo(e);t||r||(s*=.82),i.panTo({x:-1*n,y:-1*o,scale:a,friction:s,ignoreBounds:!0}),s*=.98};window.addEventListener("scroll",o),i.once("endAnimation",(()=>{window.removeEventListener("scroll",o),t.destroy()})),o()}handleCursor(t){if("image"!==t.type||!t.$el)return;const e=t.Panzoom,i=this.fancybox.option("Image.click",!1,t),s=this.fancybox.option("Image.touch"),o=t.$el.classList,n=this.fancybox.option("Image.canZoomInClass"),a=this.fancybox.option("Image.canZoomOutClass");if(o.remove(a),o.remove(n),e&&"toggleZoom"===i){e&&1===e.content.scale&&e.option("maxScale")-e.content.scale>.01?o.add(n):e.content.scale>1&&!s&&o.add(a)}else"close"===i&&o.add(a)}onWheel(t,e){if("ready"===this.fancybox.state&&!1!==this.fancybox.trigger("Image.wheel",e))switch(this.fancybox.option("Image.wheel")){case"zoom":"done"===t.state&&t.Panzoom&&t.Panzoom.zoomWithWheel(e);break;case"close":this.fancybox.close();break;case"slide":this.fancybox[e.deltaY<0?"prev":"next"]()}}onClick(t,e){if("ready"!==this.fancybox.state)return;const i=t.Panzoom;if(i&&(i.dragPosition.midPoint||0!==i.dragOffset.x||0!==i.dragOffset.y||1!==i.dragOffset.scale))return;if(this.fancybox.Carousel.Panzoom.lockAxis)return!1;const s=i=>{switch(i){case"toggleZoom":e.stopPropagation(),t.Panzoom&&t.Panzoom.zoomWithClick(e);break;case"close":this.fancybox.close();break;case"next":e.stopPropagation(),this.fancybox.next()}},o=this.fancybox.option("Image.click"),n=this.fancybox.option("Image.doubleClick");n?this.clickTimer?(clearTimeout(this.clickTimer),this.clickTimer=null,s(n)):this.clickTimer=setTimeout((()=>{this.clickTimer=null,s(o)}),300):s(o)}onPageChange(t,e){const i=t.getSlide();e.slides.forEach((t=>{t.Panzoom&&"done"===t.state&&t.index!==i.index&&t.Panzoom.panTo({x:0,y:0,scale:1,friction:.8})}))}attach(){this.fancybox.on(this.events)}detach(){this.fancybox.off(this.events)}}T.defaults={canZoomInClass:"can-zoom_in",canZoomOutClass:"can-zoom_out",zoom:!0,zoomOpacity:"auto",zoomFriction:.82,ignoreCoveredThumbnail:!1,touch:!0,click:"toggleZoom",doubleClick:null,wheel:"zoom",fit:"contain",wrap:!1,Panzoom:{ratio:1}};class L{constructor(t){this.fancybox=t;for(const t of["onChange","onClosing"])this[t]=this[t].bind(this);this.events={initCarousel:this.onChange,"Carousel.change":this.onChange,closing:this.onClosing},this.hasCreatedHistory=!1,this.origHash="",this.timer=null}onChange(t){const e=t.Carousel;this.timer&&clearTimeout(this.timer);const i=null===e.prevPage,s=t.getSlide(),o=new URL(document.URL).hash;let n=!1;if(s.slug)n="#"+s.slug;else{const i=s.$trigger&&s.$trigger.dataset,o=t.option("slug")||i&&i.fancybox;o&&o.length&&"true"!==o&&(n="#"+o+(e.slides.length>1?"-"+(s.index+1):""))}i&&(this.origHash=o!==n?o:""),n&&o!==n&&(this.timer=setTimeout((()=>{try{window.history[i?"pushState":"replaceState"]({},document.title,window.location.pathname+window.location.search+n),i&&(this.hasCreatedHistory=!0)}catch(t){}}),300))}onClosing(){if(this.timer&&clearTimeout(this.timer),!0!==this.hasSilentClose)try{return void window.history.replaceState({},document.title,window.location.pathname+window.location.search+(this.origHash||""))}catch(t){}}attach(t){t.on(this.events)}detach(t){t.off(this.events)}static startFromUrl(){const t=L.Fancybox;if(!t||t.getInstance()||!1===t.defaults.Hash)return;const{hash:e,slug:i,index:s}=L.getParsedURL();if(!i)return;let o=document.querySelector(`[data-slug="${e}"]`);if(o&&o.dispatchEvent(new CustomEvent("click",{bubbles:!0,cancelable:!0})),t.getInstance())return;const n=document.querySelectorAll(`[data-fancybox="${i}"]`);n.length&&(null===s&&1===n.length?o=n[0]:s&&(o=n[s-1]),o&&o.dispatchEvent(new CustomEvent("click",{bubbles:!0,cancelable:!0})))}static onHashChange(){const{slug:t,index:e}=L.getParsedURL(),i=L.Fancybox,s=i&&i.getInstance();if(s&&s.plugins.Hash){if(t){const i=s.Carousel;if(t===s.option("slug"))return i.slideTo(e-1);for(let e of i.slides)if(e.slug&&e.slug===t)return i.slideTo(e.index);const o=s.getSlide(),n=o.$trigger&&o.$trigger.dataset;if(n&&n.fancybox===t)return i.slideTo(e-1)}s.plugins.Hash.hasSilentClose=!0,s.close()}L.startFromUrl()}static create(t){function e(){window.addEventListener("hashchange",L.onHashChange,!1),L.startFromUrl()}L.Fancybox=t,v&&window.requestAnimationFrame((()=>{/complete|interactive|loaded/.test(document.readyState)?e():document.addEventListener("DOMContentLoaded",e)}))}static destroy(){window.removeEventListener("hashchange",L.onHashChange,!1)}static getParsedURL(){const t=window.location.hash.substr(1),e=t.split("-"),i=e.length>1&&/^\+?\d+$/.test(e[e.length-1])&&parseInt(e.pop(-1),10)||null;return{hash:t,slug:e.join("-"),index:i}}}const _={pageXOffset:0,pageYOffset:0,element:()=>document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement,activate(t){_.pageXOffset=window.pageXOffset,_.pageYOffset=window.pageYOffset,t.requestFullscreen?t.requestFullscreen():t.mozRequestFullScreen?t.mozRequestFullScreen():t.webkitRequestFullscreen?t.webkitRequestFullscreen():t.msRequestFullscreen&&t.msRequestFullscreen()},deactivate(){document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen&&document.webkitExitFullscreen()}};class A{constructor(t){this.fancybox=t,this.active=!1,this.handleVisibilityChange=this.handleVisibilityChange.bind(this)}isActive(){return this.active}setTimer(){if(!this.active||this.timer)return;const t=this.fancybox.option("slideshow.delay",3e3);this.timer=setTimeout((()=>{this.timer=null,this.fancybox.option("infinite")||this.fancybox.getSlide().index!==this.fancybox.Carousel.slides.length-1?this.fancybox.next():this.fancybox.jumpTo(0,{friction:0})}),t);let e=this.$progress;e||(e=document.createElement("div"),e.classList.add("fancybox__progress"),this.fancybox.$carousel.parentNode.insertBefore(e,this.fancybox.$carousel),this.$progress=e,e.offsetHeight),e.style.transitionDuration=`${t}ms`,e.style.transform="scaleX(1)"}clearTimer(){clearTimeout(this.timer),this.timer=null,this.$progress&&(this.$progress.style.transitionDuration="",this.$progress.style.transform="",this.$progress.offsetHeight)}activate(){this.active||(this.active=!0,this.fancybox.$container.classList.add("has-slideshow"),"done"===this.fancybox.getSlide().state&&this.setTimer(),document.addEventListener("visibilitychange",this.handleVisibilityChange,!1))}handleVisibilityChange(){this.deactivate()}deactivate(){this.active=!1,this.clearTimer(),this.fancybox.$container.classList.remove("has-slideshow"),document.removeEventListener("visibilitychange",this.handleVisibilityChange,!1)}toggle(){this.active?this.deactivate():this.fancybox.Carousel.slides.length>1&&this.activate()}}const z={display:["counter","zoom","slideshow","fullscreen","thumbs","close"],autoEnable:!0,items:{counter:{position:"left",type:"div",class:"fancybox__counter",html:'<span data-fancybox-index=""></span> / <span data-fancybox-count=""></span>',attr:{tabindex:-1}},prev:{type:"button",class:"fancybox__button--prev",label:"PREV",html:'<svg viewBox="0 0 24 24"><path d="M15 4l-8 8 8 8"/></svg>',attr:{"data-fancybox-prev":""}},next:{type:"button",class:"fancybox__button--next",label:"NEXT",html:'<svg viewBox="0 0 24 24"><path d="M8 4l8 8-8 8"/></svg>',attr:{"data-fancybox-next":""}},fullscreen:{type:"button",class:"fancybox__button--fullscreen",label:"TOGGLE_FULLSCREEN",html:'<svg viewBox="0 0 24 24">\n <g><path d="M3 8 V3h5"></path><path d="M21 8V3h-5"></path><path d="M8 21H3v-5"></path><path d="M16 21h5v-5"></path></g>\n <g><path d="M7 2v5H2M17 2v5h5M2 17h5v5M22 17h-5v5"/></g>\n </svg>',click:function(t){t.preventDefault(),_.element()?_.deactivate():_.activate(this.fancybox.$container)}},slideshow:{type:"button",class:"fancybox__button--slideshow",label:"TOGGLE_SLIDESHOW",html:'<svg viewBox="0 0 24 24">\n <g><path d="M6 4v16"/><path d="M20 12L6 20"/><path d="M20 12L6 4"/></g>\n <g><path d="M7 4v15M17 4v15"/></g>\n </svg>',click:function(t){t.preventDefault(),this.Slideshow.toggle()}},zoom:{type:"button",class:"fancybox__button--zoom",label:"TOGGLE_ZOOM",html:'<svg viewBox="0 0 24 24"><circle cx="10" cy="10" r="7"></circle><path d="M16 16 L21 21"></svg>',click:function(t){t.preventDefault();const e=this.fancybox.getSlide().Panzoom;e&&e.toggleZoom()}},download:{type:"link",label:"DOWNLOAD",class:"fancybox__button--download",html:'<svg viewBox="0 0 24 24"><path d="M12 15V3m0 12l-4-4m4 4l4-4M2 17l.62 2.48A2 2 0 004.56 21h14.88a2 2 0 001.94-1.51L22 17"/></svg>',click:function(t){t.stopPropagation()}},thumbs:{type:"button",label:"TOGGLE_THUMBS",class:"fancybox__button--thumbs",html:'<svg viewBox="0 0 24 24"><circle cx="4" cy="4" r="1" /><circle cx="12" cy="4" r="1" transform="rotate(90 12 4)"/><circle cx="20" cy="4" r="1" transform="rotate(90 20 4)"/><circle cx="4" cy="12" r="1" transform="rotate(90 4 12)"/><circle cx="12" cy="12" r="1" transform="rotate(90 12 12)"/><circle cx="20" cy="12" r="1" transform="rotate(90 20 12)"/><circle cx="4" cy="20" r="1" transform="rotate(90 4 20)"/><circle cx="12" cy="20" r="1" transform="rotate(90 12 20)"/><circle cx="20" cy="20" r="1" transform="rotate(90 20 20)"/></svg>',click:function(t){t.stopPropagation();const e=this.fancybox.plugins.Thumbs;e&&e.toggle()}},close:{type:"button",label:"CLOSE",class:"fancybox__button--close",html:'<svg viewBox="0 0 24 24"><path d="M20 20L4 4m16 0L4 20"></path></svg>',attr:{"data-fancybox-close":"",tabindex:0}}}};class k{constructor(t){this.fancybox=t,this.$container=null,this.state="init";for(const t of["onInit","onPrepare","onDone","onKeydown","onClosing","onChange","onSettle","onRefresh"])this[t]=this[t].bind(this);this.events={init:this.onInit,prepare:this.onPrepare,done:this.onDone,keydown:this.onKeydown,closing:this.onClosing,"Carousel.change":this.onChange,"Carousel.settle":this.onSettle,"Carousel.Panzoom.touchStart":()=>this.onRefresh(),"Image.startAnimation":(t,e)=>this.onRefresh(e),"Image.afterUpdate":(t,e)=>this.onRefresh(e)}}onInit(){if(this.fancybox.option("Toolbar.autoEnable")){let t=!1;for(const e of this.fancybox.items)if("image"===e.type){t=!0;break}if(!t)return void(this.state="disabled")}for(const e of this.fancybox.option("Toolbar.display")){if("close"===(t(e)?e.id:e)){this.fancybox.options.closeButton=!1;break}}}onPrepare(){const t=this.fancybox;if("init"===this.state&&(this.build(),this.update(),this.Slideshow=new A(t),!t.Carousel.prevPage&&(t.option("slideshow.autoStart")&&this.Slideshow.activate(),t.option("fullscreen.autoStart")&&!_.element())))try{_.activate(t.$container)}catch(t){}}onFsChange(){window.scrollTo(_.pageXOffset,_.pageYOffset)}onSettle(){const t=this.fancybox,e=this.Slideshow;e&&e.isActive()&&(t.getSlide().index!==t.Carousel.slides.length-1||t.option("infinite")?"done"===t.getSlide().state&&e.setTimer():e.deactivate())}onChange(){this.update(),this.Slideshow&&this.Slideshow.isActive()&&this.Slideshow.clearTimer()}onDone(t,e){const i=this.Slideshow;e.index===t.getSlide().index&&(this.update(),i&&i.isActive()&&(t.option("infinite")||e.index!==t.Carousel.slides.length-1?i.setTimer():i.deactivate()))}onRefresh(t){t&&t.index!==this.fancybox.getSlide().index||(this.update(),!this.Slideshow||!this.Slideshow.isActive()||t&&"done"!==t.state||this.Slideshow.deactivate())}onKeydown(t,e,i){" "===e&&this.Slideshow&&(this.Slideshow.toggle(),i.preventDefault())}onClosing(){this.Slideshow&&this.Slideshow.deactivate(),document.removeEventListener("fullscreenchange",this.onFsChange)}createElement(t){let e;"div"===t.type?e=document.createElement("div"):(e=document.createElement("link"===t.type?"a":"button"),e.classList.add("carousel__button")),e.innerHTML=t.html,e.setAttribute("tabindex",t.tabindex||0),t.class&&e.classList.add(...t.class.split(" "));for(const i in t.attr)e.setAttribute(i,t.attr[i]);t.label&&e.setAttribute("title",this.fancybox.localize(`{{${t.label}}}`)),t.click&&e.addEventListener("click",t.click.bind(this)),"prev"===t.id&&e.setAttribute("data-fancybox-prev",""),"next"===t.id&&e.setAttribute("data-fancybox-next","");const i=e.querySelector("svg");return i&&(i.setAttribute("role","img"),i.setAttribute("tabindex","-1"),i.setAttribute("xmlns","http://www.w3.org/2000/svg")),e}build(){this.cleanup();const i=this.fancybox.option("Toolbar.items"),s=[{position:"left",items:[]},{position:"center",items:[]},{position:"right",items:[]}],o=this.fancybox.plugins.Thumbs;for(const n of this.fancybox.option("Toolbar.display")){let a,r;if(t(n)?(a=n.id,r=e({},i[a],n)):(a=n,r=i[a]),["counter","next","prev","slideshow"].includes(a)&&this.fancybox.items.length<2)continue;if("fullscreen"===a){if(!document.fullscreenEnabled||window.fullScreen)continue;document.addEventListener("fullscreenchange",this.onFsChange)}if("thumbs"===a&&(!o||"disabled"===o.state))continue;if(!r)continue;let h=r.position||"right",l=s.find((t=>t.position===h));l&&l.items.push(r)}const n=document.createElement("div");n.classList.add("fancybox__toolbar");for(const t of s)if(t.items.length){const e=document.createElement("div");e.classList.add("fancybox__toolbar__items"),e.classList.add(`fancybox__toolbar__items--${t.position}`);for(const i of t.items)e.appendChild(this.createElement(i));n.appendChild(e)}this.fancybox.$carousel.parentNode.insertBefore(n,this.fancybox.$carousel),this.$container=n}update(){const t=this.fancybox.getSlide(),e=t.index,i=this.fancybox.items.length,s=t.downloadSrc||("image"!==t.type||t.error?null:t.src);for(const t of this.fancybox.$container.querySelectorAll("a.fancybox__button--download"))s?(t.removeAttribute("disabled"),t.removeAttribute("tabindex"),t.setAttribute("href",s),t.setAttribute("download",s),t.setAttribute("target","_blank")):(t.setAttribute("disabled",""),t.setAttribute("tabindex",-1),t.removeAttribute("href"),t.removeAttribute("download"));const o=t.Panzoom,n=o&&o.option("maxScale")>o.option("baseScale");for(const t of this.fancybox.$container.querySelectorAll(".fancybox__button--zoom"))n?t.removeAttribute("disabled"):t.setAttribute("disabled","");for(const e of this.fancybox.$container.querySelectorAll("[data-fancybox-index]"))e.innerHTML=t.index+1;for(const t of this.fancybox.$container.querySelectorAll("[data-fancybox-count]"))t.innerHTML=i;if(!this.fancybox.option("infinite")){for(const t of this.fancybox.$container.querySelectorAll("[data-fancybox-prev]"))0===e?t.setAttribute("disabled",""):t.removeAttribute("disabled");for(const t of this.fancybox.$container.querySelectorAll("[data-fancybox-next]"))e===i-1?t.setAttribute("disabled",""):t.removeAttribute("disabled")}}cleanup(){this.Slideshow&&this.Slideshow.isActive()&&this.Slideshow.clearTimer(),this.$container&&this.$container.remove(),this.$container=null}attach(){this.fancybox.on(this.events)}detach(){this.fancybox.off(this.events),this.cleanup()}}k.defaults=z;const O={ScrollLock:class{constructor(t){this.fancybox=t,this.viewport=null,this.pendingUpdate=null;for(const t of["onReady","onResize","onTouchstart","onTouchmove"])this[t]=this[t].bind(this)}onReady(){const t=window.visualViewport;t&&(this.viewport=t,this.startY=0,t.addEventListener("resize",this.onResize),this.updateViewport()),window.addEventListener("touchstart",this.onTouchstart,{passive:!1}),window.addEventListener("touchmove",this.onTouchmove,{passive:!1}),window.addEventListener("wheel",this.onWheel,{passive:!1})}onResize(){this.updateViewport()}updateViewport(){const t=this.fancybox,e=this.viewport,i=e.scale||1,s=t.$container;if(!s)return;let o="",n="",a="";i-1>.1&&(o=e.width*i+"px",n=e.height*i+"px",a=`translate3d(${e.offsetLeft}px, ${e.offsetTop}px, 0) scale(${1/i})`),s.style.width=o,s.style.height=n,s.style.transform=a}onTouchstart(t){this.startY=t.touches?t.touches[0].screenY:t.screenY}onTouchmove(t){const e=this.startY,i=window.innerWidth/window.document.documentElement.clientWidth;if(!t.cancelable)return;if(t.touches.length>1||1!==i)return;const o=s(t.composedPath()[0]);if(!o)return void t.preventDefault();const n=window.getComputedStyle(o),a=parseInt(n.getPropertyValue("height"),10),r=t.touches?t.touches[0].screenY:t.screenY,h=e<=r&&0===o.scrollTop,l=e>=r&&o.scrollHeight-o.scrollTop===a;(h||l)&&t.preventDefault()}onWheel(t){s(t.composedPath()[0])||t.preventDefault()}cleanup(){this.pendingUpdate&&(cancelAnimationFrame(this.pendingUpdate),this.pendingUpdate=null);const t=this.viewport;t&&(t.removeEventListener("resize",this.onResize),this.viewport=null),window.removeEventListener("touchstart",this.onTouchstart,!1),window.removeEventListener("touchmove",this.onTouchmove,!1),window.removeEventListener("wheel",this.onWheel,{passive:!1})}attach(){this.fancybox.on("initLayout",this.onReady)}detach(){this.fancybox.off("initLayout",this.onReady),this.cleanup()}},Thumbs:C,Html:P,Toolbar:k,Image:T,Hash:L};const M={startIndex:0,preload:1,infinite:!0,showClass:"fancybox-zoomInUp",hideClass:"fancybox-fadeOut",animated:!0,hideScrollbar:!0,parentEl:null,mainClass:null,autoFocus:!0,trapFocus:!0,placeFocusBack:!0,click:"close",closeButton:"inside",dragToClose:!0,keyboard:{Escape:"close",Delete:"close",Backspace:"close",PageUp:"next",PageDown:"prev",ArrowUp:"next",ArrowDown:"prev",ArrowRight:"next",ArrowLeft:"prev"},template:{closeButton:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" tabindex="-1"><path d="M20 20L4 4m16 0L4 20"/></svg>',spinner:'<svg xmlns="http://www.w3.org/2000/svg" width="50" height="50" viewBox="25 25 50 50" tabindex="-1"><circle cx="50" cy="50" r="20"/></svg>',main:null},l10n:{CLOSE:"Close",NEXT:"Next",PREV:"Previous",MODAL:"You can close this modal content with the ESC key",ERROR:"Something Went Wrong, Please Try Again Later",IMAGE_ERROR:"Image Not Found",ELEMENT_NOT_FOUND:"HTML Element Not Found",AJAX_NOT_FOUND:"Error Loading AJAX : Not Found",AJAX_FORBIDDEN:"Error Loading AJAX : Forbidden",IFRAME_ERROR:"Error Loading Page",TOGGLE_ZOOM:"Toggle zoom level",TOGGLE_THUMBS:"Toggle thumbnails",TOGGLE_SLIDESHOW:"Toggle slideshow",TOGGLE_FULLSCREEN:"Toggle full-screen mode",DOWNLOAD:"Download"}},I=new Map;let F=0;class R extends l{constructor(t,i={}){t=t.map((t=>(t.width&&(t._width=t.width),t.height&&(t._height=t.height),t))),super(e(!0,{},M,i)),this.bindHandlers(),this.state="init",this.setItems(t),this.attachPlugins(R.Plugins),this.trigger("init"),!0===this.option("hideScrollbar")&&this.hideScrollbar(),this.initLayout(),this.initCarousel(),this.attachEvents(),I.set(this.id,this),this.trigger("prepare"),this.state="ready",this.trigger("ready"),this.$container.setAttribute("aria-hidden","false"),this.option("trapFocus")&&this.focus()}option(t,...e){const i=this.getSlide();let s=i?i[t]:void 0;return void 0!==s?("function"==typeof s&&(s=s.call(this,this,...e)),s):super.option(t,...e)}bindHandlers(){for(const t of["onMousedown","onKeydown","onClick","onFocus","onCreateSlide","onSettle","onTouchMove","onTouchEnd","onTransform"])this[t]=this[t].bind(this)}attachEvents(){document.addEventListener("mousedown",this.onMousedown),document.addEventListener("keydown",this.onKeydown,!0),this.option("trapFocus")&&document.addEventListener("focus",this.onFocus,!0),this.$container.addEventListener("click",this.onClick)}detachEvents(){document.removeEventListener("mousedown",this.onMousedown),document.removeEventListener("keydown",this.onKeydown,!0),document.removeEventListener("focus",this.onFocus,!0),this.$container.removeEventListener("click",this.onClick)}initLayout(){this.$root=this.option("parentEl")||document.body;let t=this.option("template.main");t&&(this.$root.insertAdjacentHTML("beforeend",this.localize(t)),this.$container=this.$root.querySelector(".fancybox__container")),this.$container||(this.$container=document.createElement("div"),this.$root.appendChild(this.$container)),this.$container.onscroll=()=>(this.$container.scrollLeft=0,!1),Object.entries({class:"fancybox__container",role:"dialog",tabIndex:"-1","aria-modal":"true","aria-hidden":"true","aria-label":this.localize("{{MODAL}}")}).forEach((t=>this.$container.setAttribute(...t))),this.option("animated")&&this.$container.classList.add("is-animated"),this.$backdrop=this.$container.querySelector(".fancybox__backdrop"),this.$backdrop||(this.$backdrop=document.createElement("div"),this.$backdrop.classList.add("fancybox__backdrop"),this.$container.appendChild(this.$backdrop)),this.$carousel=this.$container.querySelector(".fancybox__carousel"),this.$carousel||(this.$carousel=document.createElement("div"),this.$carousel.classList.add("fancybox__carousel"),this.$container.appendChild(this.$carousel)),this.$container.Fancybox=this,this.id=this.$container.getAttribute("id"),this.id||(this.id=this.options.id||++F,this.$container.setAttribute("id","fancybox-"+this.id));const e=this.option("mainClass");return e&&this.$container.classList.add(...e.split(" ")),document.documentElement.classList.add("with-fancybox"),this.trigger("initLayout"),this}setItems(t){const e=[];for(const i of t){const t=i.$trigger;if(t){const e=t.dataset||{};i.src=e.src||t.getAttribute("href")||i.src,i.type=e.type||i.type,!i.src&&t instanceof HTMLImageElement&&(i.src=t.currentSrc||i.$trigger.src)}let s=i.$thumb;if(!s){let t=i.$trigger&&i.$trigger.origTarget;t&&(s=t instanceof HTMLImageElement?t:t.querySelector("img:not([aria-hidden])")),!s&&i.$trigger&&(s=i.$trigger instanceof HTMLImageElement?i.$trigger:i.$trigger.querySelector("img:not([aria-hidden])"))}i.$thumb=s||null;let o=i.thumb;!o&&s&&(o=s.currentSrc||s.src,!o&&s.dataset&&(o=s.dataset.lazySrc||s.dataset.src)),o||"image"!==i.type||(o=i.src),i.thumb=o||null,i.caption=i.caption||"",e.push(i)}this.items=e}initCarousel(){return this.Carousel=new y(this.$carousel,e(!0,{},{prefix:"",classNames:{viewport:"fancybox__viewport",track:"fancybox__track",slide:"fancybox__slide"},textSelection:!0,preload:this.option("preload"),friction:.88,slides:this.items,initialPage:this.options.startIndex,slidesPerPage:1,infiniteX:this.option("infinite"),infiniteY:!0,l10n:this.option("l10n"),Dots:!1,Navigation:{classNames:{main:"fancybox__nav",button:"carousel__button",next:"is-next",prev:"is-prev"}},Panzoom:{textSelection:!0,panOnlyZoomed:()=>this.Carousel&&this.Carousel.pages&&this.Carousel.pages.length<2&&!this.option("dragToClose"),lockAxis:()=>{if(this.Carousel){let t="x";return this.option("dragToClose")&&(t+="y"),t}}},on:{"*":(t,...e)=>this.trigger(`Carousel.${t}`,...e),init:t=>this.Carousel=t,createSlide:this.onCreateSlide,settle:this.onSettle}},this.option("Carousel"))),this.option("dragToClose")&&this.Carousel.Panzoom.on({touchMove:this.onTouchMove,afterTransform:this.onTransform,touchEnd:this.onTouchEnd}),this.trigger("initCarousel"),this}onCreateSlide(t,e){let i=e.caption||"";if("function"==typeof this.options.caption&&(i=this.options.caption.call(this,this,this.Carousel,e)),"string"==typeof i&&i.length){const t=document.createElement("div"),s=`fancybox__caption_${this.id}_${e.index}`;t.className="fancybox__caption",t.innerHTML=i,t.setAttribute("id",s),e.$caption=e.$el.appendChild(t),e.$el.classList.add("has-caption"),e.$el.setAttribute("aria-labelledby",s)}}onSettle(){this.option("autoFocus")&&this.focus()}onFocus(t){this.isTopmost()&&this.focus(t)}onClick(t){if(t.defaultPrevented)return;let e=t.composedPath()[0];if(e.matches("[data-fancybox-close]"))return t.preventDefault(),void R.close(!1,t);if(e.matches("[data-fancybox-next]"))return t.preventDefault(),void R.next();if(e.matches("[data-fancybox-prev]"))return t.preventDefault(),void R.prev();const i=document.activeElement;if(i){if(i.closest("[contenteditable]"))return;e.matches(x)||i.blur()}if(e.closest(".fancybox__content"))return;if(getSelection().toString().length)return;if(!1===this.trigger("click",t))return;switch(this.option("click")){case"close":this.close();break;case"next":this.next()}}onTouchMove(){const t=this.getSlide().Panzoom;return!t||1===t.content.scale}onTouchEnd(t){const e=t.dragOffset.y;Math.abs(e)>=150||Math.abs(e)>=35&&t.dragOffset.time<350?(this.option("hideClass")&&(this.getSlide().hideClass="fancybox-throwOut"+(t.content.y<0?"Up":"Down")),this.close()):"y"===t.lockAxis&&t.panTo({y:0})}onTransform(t){if(this.$backdrop){const e=Math.abs(t.content.y),i=e<1?"":Math.max(.33,Math.min(1,1-e/t.content.fitHeight*1.5));this.$container.style.setProperty("--fancybox-ts",i?"0s":""),this.$container.style.setProperty("--fancybox-opacity",i)}}onMousedown(){"ready"===this.state&&document.body.classList.add("is-using-mouse")}onKeydown(t){if(!this.isTopmost())return;document.body.classList.remove("is-using-mouse");const e=t.key,i=this.option("keyboard");if(!i||t.ctrlKey||t.altKey||t.shiftKey)return;const s=t.composedPath()[0],o=document.activeElement&&document.activeElement.classList,n=o&&o.contains("carousel__button");if("Escape"!==e&&!n){if(t.target.isContentEditable||-1!==["BUTTON","TEXTAREA","OPTION","INPUT","SELECT","VIDEO"].indexOf(s.nodeName))return}if(!1===this.trigger("keydown",e,t))return;const a=i[e];"function"==typeof this[a]&&this[a]()}getSlide(){const t=this.Carousel;if(!t)return null;const e=null===t.page?t.option("initialPage"):t.page,i=t.pages||[];return i.length&&i[e]?i[e].slides[0]:null}focus(t){if(R.ignoreFocusChange)return;if(["init","closing","customClosing","destroy"].indexOf(this.state)>-1)return;const e=this.$container,i=this.getSlide(),s="done"===i.state?i.$el:null;if(s&&s.contains(document.activeElement))return;t&&t.preventDefault(),R.ignoreFocusChange=!0;const o=Array.from(e.querySelectorAll(x));let n,a=[];for(let t of o){const e=t.offsetParent,i=s&&s.contains(t),o=!this.Carousel.$viewport.contains(t);e&&(i||o)?(a.push(t),void 0!==t.dataset.origTabindex&&(t.tabIndex=t.dataset.origTabindex,t.removeAttribute("data-orig-tabindex")),(t.hasAttribute("autoFocus")||!n&&i&&!t.classList.contains("carousel__button"))&&(n=t)):(t.dataset.origTabindex=void 0===t.dataset.origTabindex?t.getAttribute("tabindex"):t.dataset.origTabindex,t.tabIndex=-1)}t?a.indexOf(t.target)>-1?this.lastFocus=t.target:this.lastFocus===e?w(a[a.length-1]):w(e):this.option("autoFocus")&&n?w(n):a.indexOf(document.activeElement)<0&&w(e),this.lastFocus=document.activeElement,R.ignoreFocusChange=!1}hideScrollbar(){if(!v)return;const t=window.innerWidth-document.documentElement.getBoundingClientRect().width,e="fancybox-style-noscroll";let i=document.getElementById(e);i||t>0&&(i=document.createElement("style"),i.id=e,i.type="text/css",i.innerHTML=`.compensate-for-scrollbar {padding-right: ${t}px;}`,document.getElementsByTagName("head")[0].appendChild(i),document.body.classList.add("compensate-for-scrollbar"))}revealScrollbar(){document.body.classList.remove("compensate-for-scrollbar");const t=document.getElementById("fancybox-style-noscroll");t&&t.remove()}clearContent(t){this.Carousel.trigger("removeSlide",t),t.$content&&(t.$content.remove(),t.$content=null),t.$closeButton&&(t.$closeButton.remove(),t.$closeButton=null),t._className&&t.$el.classList.remove(t._className)}setContent(t,e,i={}){let s;const o=t.$el;if(e instanceof HTMLElement)["img","iframe","video","audio"].indexOf(e.nodeName.toLowerCase())>-1?(s=document.createElement("div"),s.appendChild(e)):s=e;else{const t=document.createRange().createContextualFragment(e);s=document.createElement("div"),s.appendChild(t)}if(t.filter&&!t.error&&(s=s.querySelector(t.filter)),s instanceof Element)return t._className=`has-${i.suffix||t.type||"unknown"}`,o.classList.add(t._className),s.classList.add("fancybox__content"),"none"!==s.style.display&&"none"!==getComputedStyle(s).getPropertyValue("display")||(s.style.display=t.display||this.option("defaultDisplay")||"flex"),t.id&&s.setAttribute("id",t.id),t.$content=s,o.prepend(s),this.manageCloseButton(t),"loading"!==t.state&&this.revealContent(t),s;this.setError(t,"{{ELEMENT_NOT_FOUND}}")}manageCloseButton(t){const e=void 0===t.closeButton?this.option("closeButton"):t.closeButton;if(!e||"top"===e&&this.$closeButton)return;const i=document.createElement("button");i.classList.add("carousel__button","is-close"),i.setAttribute("title",this.options.l10n.CLOSE),i.innerHTML=this.option("template.closeButton"),i.addEventListener("click",(t=>this.close(t))),"inside"===e?(t.$closeButton&&t.$closeButton.remove(),t.$closeButton=t.$content.appendChild(i)):this.$closeButton=this.$container.insertBefore(i,this.$container.firstChild)}revealContent(t){this.trigger("reveal",t),t.$content.style.visibility="";let e=!1;t.error||"loading"===t.state||null!==this.Carousel.prevPage||t.index!==this.options.startIndex||(e=void 0===t.showClass?this.option("showClass"):t.showClass),e?(t.state="animating",this.animateCSS(t.$content,e,(()=>{this.done(t)}))):this.done(t)}animateCSS(t,e,i){if(t&&t.dispatchEvent(new CustomEvent("animationend",{bubbles:!0,cancelable:!0})),!t||!e)return void("function"==typeof i&&i());const s=function(o){o.currentTarget===this&&(t.removeEventListener("animationend",s),i&&i(),t.classList.remove(e))};t.addEventListener("animationend",s),t.classList.add(e)}done(t){t.state="done",this.trigger("done",t);const e=this.getSlide();e&&t.index===e.index&&this.option("autoFocus")&&this.focus()}setError(t,e){t.error=e,this.hideLoading(t),this.clearContent(t);const i=document.createElement("div");i.classList.add("fancybox-error"),i.innerHTML=this.localize(e||"<p>{{ERROR}}</p>"),this.setContent(t,i,{suffix:"error"})}showLoading(t){t.state="loading",t.$el.classList.add("is-loading");let e=t.$el.querySelector(".fancybox__spinner");e||(e=document.createElement("div"),e.classList.add("fancybox__spinner"),e.innerHTML=this.option("template.spinner"),e.addEventListener("click",(()=>{this.Carousel.Panzoom.velocity||this.close()})),t.$el.prepend(e))}hideLoading(t){const e=t.$el&&t.$el.querySelector(".fancybox__spinner");e&&(e.remove(),t.$el.classList.remove("is-loading")),"loading"===t.state&&(this.trigger("load",t),t.state="ready")}next(){const t=this.Carousel;t&&t.pages.length>1&&t.slideNext()}prev(){const t=this.Carousel;t&&t.pages.length>1&&t.slidePrev()}jumpTo(...t){this.Carousel&&this.Carousel.slideTo(...t)}isClosing(){return["closing","customClosing","destroy"].includes(this.state)}isTopmost(){return R.getInstance().id==this.id}close(t){if(t&&t.preventDefault(),this.isClosing())return;if(!1===this.trigger("shouldClose",t))return;if(this.state="closing",this.Carousel.Panzoom.destroy(),this.detachEvents(),this.trigger("closing",t),"destroy"===this.state)return;this.$container.setAttribute("aria-hidden","true"),this.$container.classList.add("is-closing");const e=this.getSlide();if(this.Carousel.slides.forEach((t=>{t.$content&&t.index!==e.index&&this.Carousel.trigger("removeSlide",t)})),"closing"===this.state){const t=void 0===e.hideClass?this.option("hideClass"):e.hideClass;this.animateCSS(e.$content,t,(()=>{this.destroy()}),!0)}}destroy(){if("destroy"===this.state)return;this.state="destroy",this.trigger("destroy");const t=this.option("placeFocusBack")?this.option("triggerTarget",this.getSlide().$trigger):null;this.Carousel.destroy(),this.detachPlugins(),this.Carousel=null,this.options={},this.events={},this.$container.remove(),this.$container=this.$backdrop=this.$carousel=null,t&&w(t),I.delete(this.id);const e=R.getInstance();e?e.focus():(document.documentElement.classList.remove("with-fancybox"),document.body.classList.remove("is-using-mouse"),this.revealScrollbar())}static show(t,e={}){return new R(t,e)}static fromEvent(t,e={}){if(t.defaultPrevented)return;if(t.button&&0!==t.button)return;if(t.ctrlKey||t.metaKey||t.shiftKey)return;const i=t.composedPath()[0];let s,o,n,a=i;if((a.matches("[data-fancybox-trigger]")||(a=a.closest("[data-fancybox-trigger]")))&&(e.triggerTarget=a,s=a&&a.dataset&&a.dataset.fancyboxTrigger),s){const t=document.querySelectorAll(`[data-fancybox="${s}"]`),e=parseInt(a.dataset.fancyboxIndex,10)||0;a=t.length?t[e]:a}Array.from(R.openers.keys()).reverse().some((e=>{n=a||i;let s=!1;try{n instanceof Element&&("string"==typeof e||e instanceof String)&&(s=n.matches(e)||(n=n.closest(e)))}catch(t){}return!!s&&(t.preventDefault(),o=e,!0)}));let r=!1;if(o){e.event=t,e.target=n,n.origTarget=i,r=R.fromOpener(o,e);const s=R.getInstance();s&&"ready"===s.state&&t.detail&&document.body.classList.add("is-using-mouse")}return r}static fromOpener(t,i={}){let s=[],o=i.startIndex||0,n=i.target||null;const a=void 0!==(i=e({},i,R.openers.get(t))).groupAll&&i.groupAll,r=void 0===i.groupAttr?"data-fancybox":i.groupAttr,h=r&&n?n.getAttribute(`${r}`):"";if(!n||h||a){const e=i.root||(n?n.getRootNode():document.body);s=[].slice.call(e.querySelectorAll(t))}if(n&&!a&&(s=h?s.filter((t=>t.getAttribute(`${r}`)===h)):[n]),!s.length)return!1;const l=R.getInstance();return!(l&&s.indexOf(l.options.$trigger)>-1)&&(o=n?s.indexOf(n):o,s=s.map((function(t){const e=["false","0","no","null","undefined"],i=["true","1","yes"],s=Object.assign({},t.dataset),o={};for(let[t,n]of Object.entries(s))if("fancybox"!==t)if("width"===t||"height"===t)o[`_${t}`]=n;else if("string"==typeof n||n instanceof String)if(e.indexOf(n)>-1)o[t]=!1;else if(i.indexOf(o[t])>-1)o[t]=!0;else try{o[t]=JSON.parse(n)}catch(e){o[t]=n}else o[t]=n;return t instanceof Element&&(o.$trigger=t),o})),new R(s,e({},i,{startIndex:o,$trigger:n})))}static bind(t,e={}){function i(){document.body.addEventListener("click",R.fromEvent,!1)}v&&(R.openers.size||(/complete|interactive|loaded/.test(document.readyState)?i():document.addEventListener("DOMContentLoaded",i)),R.openers.set(t,e))}static unbind(t){R.openers.delete(t),R.openers.size||R.destroy()}static destroy(){let t;for(;t=R.getInstance();)t.destroy();R.openers=new Map,document.body.removeEventListener("click",R.fromEvent,!1)}static getInstance(t){if(t)return I.get(t);return Array.from(I.values()).reverse().find((t=>!t.isClosing()&&t))||null}static close(t=!0,e){if(t)for(const t of I.values())t.close(e);else{const t=R.getInstance();t&&t.close(e)}}static next(){const t=R.getInstance();t&&t.next()}static prev(){const t=R.getInstance();t&&t.prev()}}R.version="4.0.31",R.defaults=M,R.openers=new Map,R.Plugins=O,R.bind("[data-fancybox]");for(const[t,e]of Object.entries(R.Plugins||{}))"function"==typeof e.create&&e.create(R); 18 19 20/***/ }), 21
vendor: 14,757 bytes, lines 22-31
22/***/ "./node_modules/aos/dist/aos.js": 23/*!**************************************!*\ 24 !*** ./node_modules/aos/dist/aos.js ***! 25 \**************************************/ 26/***/ (function(module) { 27 28!function(e,t){ true?module.exports=t():0}(this,function(){return function(e){function t(o){if(n[o])return n[o].exports;var i=n[o]={exports:{},id:o,loaded:!1};return e[o].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var n={};return t.m=e,t.c=n,t.p="dist/",t(0)}([function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},r=n(1),a=(o(r),n(6)),u=o(a),c=n(7),s=o(c),f=n(8),d=o(f),l=n(9),p=o(l),m=n(10),b=o(m),v=n(11),y=o(v),g=n(14),h=o(g),w=[],k=!1,x={offset:120,delay:0,easing:"ease",duration:400,disable:!1,once:!1,startEvent:"DOMContentLoaded",throttleDelay:99,debounceDelay:50,disableMutationObserver:!1},j=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(e&&(k=!0),k)return w=(0,y.default)(w,x),(0,b.default)(w,x.once),w},O=function(){w=(0,h.default)(),j()},M=function(){w.forEach(function(e,t){e.node.removeAttribute("data-aos"),e.node.removeAttribute("data-aos-easing"),e.node.removeAttribute("data-aos-duration"),e.node.removeAttribute("data-aos-delay")})},S=function(e){return e===!0||"mobile"===e&&p.default.mobile()||"phone"===e&&p.default.phone()||"tablet"===e&&p.default.tablet()||"function"==typeof e&&e()===!0},_=function(e){x=i(x,e),w=(0,h.default)();var t=document.all&&!window.atob;return S(x.disable)||t?M():(x.disableMutationObserver||d.default.isSupported()||(console.info('\n aos: MutationObserver is not supported on this browser,\n code mutations observing has been disabled.\n You may have to call "refreshHard()" by yourself.\n '),x.disableMutationObserver=!0),document.querySelector("body").setAttribute("data-aos-easing",x.easing),document.querySelector("body").setAttribute("data-aos-duration",x.duration),document.querySelector("body").setAttribute("data-aos-delay",x.delay),"DOMContentLoaded"===x.startEvent&&["complete","interactive"].indexOf(document.readyState)>-1?j(!0):"load"===x.startEvent?window.addEventListener(x.startEvent,function(){j(!0)}):document.addEventListener(x.startEvent,function(){j(!0)}),window.addEventListener("resize",(0,s.default)(j,x.debounceDelay,!0)),window.addEventListener("orientationchange",(0,s.default)(j,x.debounceDelay,!0)),window.addEventListener("scroll",(0,u.default)(function(){(0,b.default)(w,x.once)},x.throttleDelay)),x.disableMutationObserver||d.default.ready("[data-aos]",O),w)};e.exports={init:_,refresh:j,refreshHard:O}},function(e,t){},,,,,function(e,t){(function(t){"use strict";function n(e,t,n){function o(t){var n=b,o=v;return b=v=void 0,k=t,g=e.apply(o,n)}function r(e){return k=e,h=setTimeout(f,t),M?o(e):g}function a(e){var n=e-w,o=e-k,i=t-n;return S?j(i,y-o):i}function c(e){var n=e-w,o=e-k;return void 0===w||n>=t||n<0||S&&o>=y}function f(){var e=O();return c(e)?d(e):void(h=setTimeout(f,a(e)))}function d(e){return h=void 0,_&&b?o(e):(b=v=void 0,g)}function l(){void 0!==h&&clearTimeout(h),k=0,b=w=v=h=void 0}function p(){return void 0===h?g:d(O())}function m(){var e=O(),n=c(e);if(b=arguments,v=this,w=e,n){if(void 0===h)return r(w);if(S)return h=setTimeout(f,t),o(w)}return void 0===h&&(h=setTimeout(f,t)),g}var b,v,y,g,h,w,k=0,M=!1,S=!1,_=!0;if("function"!=typeof e)throw new TypeError(s);return t=u(t)||0,i(n)&&(M=!!n.leading,S="maxWait"in n,y=S?x(u(n.maxWait)||0,t):y,_="trailing"in n?!!n.trailing:_),m.cancel=l,m.flush=p,m}function o(e,t,o){var r=!0,a=!0;if("function"!=typeof e)throw new TypeError(s);return i(o)&&(r="leading"in o?!!o.leading:r,a="trailing"in o?!!o.trailing:a),n(e,t,{leading:r,maxWait:t,trailing:a})}function i(e){var t="undefined"==typeof e?"undefined":c(e);return!!e&&("object"==t||"function"==t)}function r(e){return!!e&&"object"==("undefined"==typeof e?"undefined":c(e))}function a(e){return"symbol"==("undefined"==typeof e?"undefined":c(e))||r(e)&&k.call(e)==d}function u(e){if("number"==typeof e)return e;if(a(e))return f;if(i(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=i(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(l,"");var n=m.test(e);return n||b.test(e)?v(e.slice(2),n?2:8):p.test(e)?f:+e}var c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s="Expected a function",f=NaN,d="[object Symbol]",l=/^\s+|\s+$/g,p=/^[-+]0x[0-9a-f]+$/i,m=/^0b[01]+$/i,b=/^0o[0-7]+$/i,v=parseInt,y="object"==("undefined"==typeof t?"undefined":c(t))&&t&&t.Object===Object&&t,g="object"==("undefined"==typeof self?"undefined":c(self))&&self&&self.Object===Object&&self,h=y||g||Function("return this")(),w=Object.prototype,k=w.toString,x=Math.max,j=Math.min,O=function(){return h.Date.now()};e.exports=o}).call(t,function(){return this}())},function(e,t){(function(t){"use strict";function n(e,t,n){function i(t){var n=b,o=v;return b=v=void 0,O=t,g=e.apply(o,n)}function r(e){return O=e,h=setTimeout(f,t),M?i(e):g}function u(e){var n=e-w,o=e-O,i=t-n;return S?x(i,y-o):i}function s(e){var n=e-w,o=e-O;return void 0===w||n>=t||n<0||S&&o>=y}function f(){var e=j();return s(e)?d(e):void(h=setTimeout(f,u(e)))}function d(e){return h=void 0,_&&b?i(e):(b=v=void 0,g)}function l(){void 0!==h&&clearTimeout(h),O=0,b=w=v=h=void 0}function p(){return void 0===h?g:d(j())}function m(){var e=j(),n=s(e);if(b=arguments,v=this,w=e,n){if(void 0===h)return r(w);if(S)return h=setTimeout(f,t),i(w)}return void 0===h&&(h=setTimeout(f,t)),g}var b,v,y,g,h,w,O=0,M=!1,S=!1,_=!0;if("function"!=typeof e)throw new TypeError(c);return t=a(t)||0,o(n)&&(M=!!n.leading,S="maxWait"in n,y=S?k(a(n.maxWait)||0,t):y,_="trailing"in n?!!n.trailing:_),m.cancel=l,m.flush=p,m}function o(e){var t="undefined"==typeof e?"undefined":u(e);return!!e&&("object"==t||"function"==t)}function i(e){return!!e&&"object"==("undefined"==typeof e?"undefined":u(e))}function r(e){return"symbol"==("undefined"==typeof e?"undefined":u(e))||i(e)&&w.call(e)==f}function a(e){if("number"==typeof e)return e;if(r(e))return s;if(o(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=o(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(d,"");var n=p.test(e);return n||m.test(e)?b(e.slice(2),n?2:8):l.test(e)?s:+e}var u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},c="Expected a function",s=NaN,f="[object Symbol]",d=/^\s+|\s+$/g,l=/^[-+]0x[0-9a-f]+$/i,p=/^0b[01]+$/i,m=/^0o[0-7]+$/i,b=parseInt,v="object"==("undefined"==typeof t?"undefined":u(t))&&t&&t.Object===Object&&t,y="object"==("undefined"==typeof self?"undefined":u(self))&&self&&self.Object===Object&&self,g=v||y||Function("return this")(),h=Object.prototype,w=h.toString,k=Math.max,x=Math.min,j=function(){return g.Date.now()};e.exports=n}).call(t,function(){return this}())},function(e,t){"use strict";function n(e){var t=void 0,o=void 0,i=void 0;for(t=0;t<e.length;t+=1){if(o=e[t],o.dataset&&o.dataset.aos)return!0;if(i=o.children&&n(o.children))return!0}return!1}function o(){return window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver}function i(){return!!o()}function r(e,t){var n=window.document,i=o(),r=new i(a);u=t,r.observe(n.documentElement,{childList:!0,subtree:!0,removedNodes:!0})}function a(e){e&&e.forEach(function(e){var t=Array.prototype.slice.call(e.addedNodes),o=Array.prototype.slice.call(e.removedNodes),i=t.concat(o);if(n(i))return u()})}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){};t.default={isSupported:i,ready:r}},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(){return navigator.userAgent||navigator.vendor||window.opera||""}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),r=/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i,a=/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i,u=/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i,c=/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i,s=function(){function e(){n(this,e)}return i(e,[{key:"phone",value:function(){var e=o();return!(!r.test(e)&&!a.test(e.substr(0,4)))}},{key:"mobile",value:function(){var e=o();return!(!u.test(e)&&!c.test(e.substr(0,4)))}},{key:"tablet",value:function(){return this.mobile()&&!this.phone()}}]),e}();t.default=new s},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(e,t,n){var o=e.node.getAttribute("data-aos-once");t>e.position?e.node.classList.add("aos-animate"):"undefined"!=typeof o&&("false"===o||!n&&"true"!==o)&&e.node.classList.remove("aos-animate")},o=function(e,t){var o=window.pageYOffset,i=window.innerHeight;e.forEach(function(e,r){n(e,i+o,t)})};t.default=o},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(12),r=o(i),a=function(e,t){return e.forEach(function(e,n){e.node.classList.add("aos-init"),e.position=(0,r.default)(e.node,t.offset)}),e};t.default=a},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(13),r=o(i),a=function(e,t){var n=0,o=0,i=window.innerHeight,a={offset:e.getAttribute("data-aos-offset"),anchor:e.getAttribute("data-aos-anchor"),anchorPlacement:e.getAttribute("data-aos-anchor-placement")};switch(a.offset&&!isNaN(a.offset)&&(o=parseInt(a.offset)),a.anchor&&document.querySelectorAll(a.anchor)&&(e=document.querySelectorAll(a.anchor)[0]),n=(0,r.default)(e).top,a.anchorPlacement){case"top-bottom":break;case"center-bottom":n+=e.offsetHeight/2;break;case"bottom-bottom":n+=e.offsetHeight;break;case"top-center":n+=i/2;break;case"bottom-center":n+=i/2+e.offsetHeight;break;case"center-center":n+=i/2+e.offsetHeight/2;break;case"top-top":n+=i;break;case"bottom-top":n+=e.offsetHeight+i;break;case"center-top":n+=e.offsetHeight/2+i}return a.anchorPlacement||a.offset||isNaN(t)||(o=t),n+o};t.default=a},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(e){for(var t=0,n=0;e&&!isNaN(e.offsetLeft)&&!isNaN(e.offsetTop);)t+=e.offsetLeft-("BODY"!=e.tagName?e.scrollLeft:0),n+=e.offsetTop-("BODY"!=e.tagName?e.scrollTop:0),e=e.offsetParent;return{top:n,left:t}};t.default=n},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(e){return e=e||document.querySelectorAll("[data-aos]"),Array.prototype.map.call(e,function(e){return{node:e}})};t.default=n}])}); 29 30/***/ }), 31
32/***/ "./src/scripts/app.js": 33/*!****************************!*\ 34 !*** ./src/scripts/app.js ***! 35 \****************************/ 36/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 37 38"use strict"; 39__webpack_require__.r(__webpack_exports__); 40/* harmony import */ var aos__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! aos */ "./node_modules/aos/dist/aos.js"); 41/* harmony import */ var aos__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(aos__WEBPACK_IMPORTED_MODULE_0__); 42/* harmony import */ var jarallax__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! jarallax */ "./node_modules/jarallax/dist/jarallax.esm.js"); 43/* harmony import */ var _fancyapps_ui__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @fancyapps/ui */ "./node_modules/@fancyapps/ui/dist/fancybox.esm.js"); 44/* harmony import */ var _modules_serviceWorker_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./modules/_serviceWorker.mjs */ "./src/scripts/modules/_serviceWorker.mjs"); 45/* harmony import */ var _modules_validate_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./modules/_validate.mjs */ "./src/scripts/modules/_validate.mjs"); 46/* harmony import */ var _modules_navigation_mjs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./modules/_navigation.mjs */ "./src/scripts/modules/_navigation.mjs"); 47/* harmony import */ var _modules_carousels_mjs__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./modules/_carousels.mjs */ "./src/scripts/modules/_carousels.mjs"); 48/* harmony import */ var _modules_disclosure_mjs__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./modules/_disclosure.mjs */ "./src/scripts/modules/_disclosure.mjs"); 49/* harmony import */ var _modules_accordion_mjs__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./modules/_accordion.mjs */ "./src/scripts/modules/_accordion.mjs"); 50/* provided dependency */ var __webpack_provided_window_dot_jQuery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js"); 51/* provided dependency */ var jQuery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js"); 52// Load External Libraries 53 54//import 'owl.carousel'; 55 56 57 58// other packages here... 59 60window.$ = __webpack_provided_window_dot_jQuery = jQuery; 61 62//Load Bootstrap Libraries 63//import 'bootstrap/js/dist/alert'; 64//import 'bootstrap/js/dist/button'; 65//import 'bootstrap/js/dist/carousel'; 66//import 'bootstrap/js/dist/collapse'; 67//import 'bootstrap/js/dist/dropdown'; //also requires Popper 68//import 'bootstrap/js/dist/modal'; 69//import 'bootstrap/js/dist/offcanvas'; 70//import 'bootstrap/js/dist/popover'; //also requires Popper 71//import 'bootstrap/js/dist/scrollspy'; 72//import 'bootstrap/js/dist/tab'; 73//import 'bootstrap/js/dist/toast'; 74//import Tooltip from 'bootstrap/js/dist/tooltip'; //also requires Popper 75 76//Local imports 77 78 79 80 81 82 83 84 85//initialize functions 86document.addEventListener("DOMContentLoaded", function () { 87 (0,_modules_serviceWorker_mjs__WEBPACK_IMPORTED_MODULE_3__.serviceWorker)(); 88 (0,_modules_validate_mjs__WEBPACK_IMPORTED_MODULE_4__.validate)(); 89 (0,_modules_navigation_mjs__WEBPACK_IMPORTED_MODULE_5__.navigation)(); 90 //exampleSlider() 91 aos__WEBPACK_IMPORTED_MODULE_0___default().init({ 92 startEvent: 'load', 93 disable: 'mobile' 94 }); 95 (0,jarallax__WEBPACK_IMPORTED_MODULE_1__.jarallax)(document.querySelectorAll('.jarallax'), { 96 speed: 0.8 97 }); 98 //jarallaxVideo(); 99 (0,_modules_carousels_mjs__WEBPACK_IMPORTED_MODULE_6__.sponsorSlider)(); 100 (0,_modules_carousels_mjs__WEBPACK_IMPORTED_MODULE_6__.verslagenSlider)(); 101 var disclosure = new _modules_disclosure_mjs__WEBPACK_IMPORTED_MODULE_7__.Disclosure(); 102 var accordion = new _modules_accordion_mjs__WEBPACK_IMPORTED_MODULE_8__.Accordion(); 103}); 104var baseOpacity = 0.85; 105var overlay = document.querySelector('.bg-overlay'); 106window.addEventListener('scroll', function () { 107 if (scrollY < 1200) { 108 overlay.style.opacity = (baseOpacity + 0.00015 * scrollY).toString(); 109 } else { 110 overlay.style.opacity = '1'; 111 } 112}); 113var height; 114function expandHeight(element) { 115 element.classList.add('active', 'transitioning'); // Set active state styles (setting display to block, visibility to visible, etc.) as well as transitioning styles, so it can actually transition from height: 0; to height: auto; 116 117 element.style.height = 'auto'; // Set the element's height to auto after it becomes visible, so we can obtain the element's computed height 118 height = element.scrollHeight + 'px'; // set the variable 'height' to be equal to the element's computed height (scrollbar included) 119 120 element.style.height = '0px'; // Set the element's height back to 0 after we obtain the rendered height so the element can transition from it. This happens before the browser is able to repaint the element, so height: auto; is never actually displayed on screen. 121 122 // Use requestAnimationFrame for smoother animation on repaint from display: none, visibility: hidden, etc. 123 requestAnimationFrame(function () { 124 // Allow time for the rendering before transitioning 125 setTimeout(function () { 126 element.style.height = height; // Set the element's height to be equal to the 'height' variable declared above 127 }); 128 }); 129 130 // When transition ends, remove the 'transitioning' class. This class is typically used to disable click Events while the element is still in the middle of transitioning. 131 element.addEventListener('transitionend', function () { 132 element.classList.remove('transitioning'); 133 element.style.height = ''; // When the transition has finished, the element's height (contained in the 'height' variable) should be equal to the value of 'auto', so we can remove it. This ensures the height of the element can be recalculated when the viewport changes. 134 }); 135} 136 137//animate element from height: auto; to height: 0; 138//IMPORTANT: animating an element's dimensions causes layout trashing and forces the browser to repaint on every frame of the transition, which is not performant. It can also cause issues when the viewport changes in the middle of a transition. Don't use it if you don't have to.
139// =============================================== 140function collapseHeight(element) { 141 height = element.scrollHeight + 'px'; // set the value of the variable 'height' to be equal to the element's computed height (scrollbar included), so we can use that to transition from 142 element.style.height = height; // set the element's height to be equal to the 'height' variable. The height variable contains a fixed value that should be equal to 'auto'. We do this, because it's not possible to transition from height: auto; 143 144 // Use requestAnimationFrame for smoother animation on repaint from display: none, visibility: hidden, etc. 145 requestAnimationFrame(function () { 146 // Allow time for the rendering before transitioning 147 setTimeout(function () { 148 element.style.height = '0px'; // Set the element's height to 0 149 element.classList.add('transitioning'); // add the transitioning styles back, so it can actually transition from the computed height to 0. (todo: should this be at the very top?) 150 }); 151 }); 152 153 // When transition ends, remove the 'transitioning' class. This class is typically used to disable click Events while the element is still in the middle of transitioning. We also remove the 'active' class so the element can be disabled (e.g. by setting display to none, visibility to hidden, etc.) 154 element.addEventListener('transitionend', function () { 155 element.classList.remove('active', 'transitioning'); 156 }, { 157 once: true // Remove the eventListener from the element when it is no longer visible, so it doesn't try to remove these classes again when the element's height is expanded a 2nd time. 158 }); 159} 160var nav = document.querySelector('.primary-navigation'); 161var headerMain = document.querySelector('.header-main'); 162nav.addEventListener('mouseover', function () { 163 if (nav.matches(':hover') || nav.querySelector('*:focus')) { 164 nav.classList.add('active'); 165 console.log('true'); 166 } else { 167 console.log('false'); 168 } 169}); 170headerMain.addEventListener('mouseleave', function () { 171 nav.classList.remove('active'); 172}); 173var rowbtns = document.querySelectorAll('.btn-togglerows'); 174if (rowbtns) { 175 var toggleAll = document.querySelector('.btn-toggleall'); 176 rowbtns.forEach(function (rowbtn) { 177 rowbtn.addEventListener('click', function () { 178 var rows = rowbtn.closest('tr').querySelectorAll('ul'); 179 if (rowbtn.getAttribute('aria-expanded') === 'true') { 180 rowbtn.setAttribute('aria-expanded', 'false'); 181 rows.forEach(function (row) { 182 //row.classList.add('hidden'); 183 collapseHeight(row); 184 }); 185 } else { 186 rowbtn.setAttribute('aria-expanded', 'true'); 187 rows.forEach(function (row) { 188 // row.classList.remove('hidden'); 189 expandHeight(row); 190 }); 191 } 192 }); 193 }); 194 if (toggleAll) { 195 toggleAll.addEventListener('click', function () { 196 var table = this.closest('table'); 197 var buttons = table.querySelectorAll('.btn-togglerows'); 198 var rows = table.querySelectorAll('tr ul'); 199 if (this.getAttribute('aria-expanded') === 'true') { 200 this.setAttribute('aria-expanded', 'false'); 201 buttons.forEach(function (button) { 202 button.setAttribute('aria-expanded', 'false'); 203 }); 204 rows.forEach(function (row) { 205 collapseHeight(row); 206 }); 207 } else { 208 this.setAttribute('aria-expanded', 'true'); 209 buttons.forEach(function (button) { 210 button.setAttribute('aria-expanded', 'true'); 211 }); 212 rows.forEach(function (row) { 213 expandHeight(row); 214 }); 215 } 216 }); 217 } 218} 219document.addEventListener('click', function (event) { 220 // Assuming 'elementToClose' is the element you want to close 221 var navWrapper = document.getElementById('navwrapper-offcanvas'); 222 223 // Assuming 'childDiv' is the child div inside the element 224 var navElement = document.querySelector('.navigation-menu-wrapper'); 225 226 // Check if the clicked element is not the child div 227 if (!navElement.contains(event.target) && navWrapper.classList.contains('show')) { 228 // Close the element or perform your desired action 229 document.getElementById('navwrapper-offcanvas').classList.remove('show'); 230 } 231}); 232document.getElementById('navtoggler-open').addEventListener('click', function () { 233 setTimeout(function () { 234 document.getElementById('navwrapper-offcanvas').classList.add('show'); 235 }, 100); 236}); 237document.getElementById('navtoggler-close').addEventListener('click', function () { 238 document.getElementById('navwrapper-offcanvas').classList.remove('show'); 239}); 240 241/***/ }), 242
vendor: 4,178 bytes, lines 243-403
243/***/ "./node_modules/base64-js/index.js": 244/*!*****************************************!*\ 245 !*** ./node_modules/base64-js/index.js ***! 246 \*****************************************/ 247/***/ ((__unused_webpack_module, exports) => { 248 249"use strict"; 250 251 252exports.byteLength = byteLength 253exports.toByteArray = toByteArray 254exports.fromByteArray = fromByteArray 255 256var lookup = [] 257var revLookup = [] 258var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array 259 260var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' 261for (var i = 0, len = code.length; i < len; ++i) { 262 lookup[i] = code[i] 263 revLookup[code.charCodeAt(i)] = i 264} 265 266// Support decoding URL-safe base64 strings, as Node.js does. 267// See: https://en.wikipedia.org/wiki/Base64#URL_applications 268revLookup['-'.charCodeAt(0)] = 62 269revLookup['_'.charCodeAt(0)] = 63 270 271function getLens (b64) { 272 var len = b64.length 273 274 if (len % 4 > 0) { 275 throw new Error('Invalid string. Length must be a multiple of 4') 276 } 277 278 // Trim off extra bytes after placeholder bytes are found 279 // See: https://github.com/beatgammit/base64-js/issues/42 280 var validLen = b64.indexOf('=') 281 if (validLen === -1) validLen = len 282 283 var placeHoldersLen = validLen === len 284 ? 0 285 : 4 - (validLen % 4) 286 287 return [validLen, placeHoldersLen] 288} 289 290// base64 is 4/3 + up to two characters of the original data 291function byteLength (b64) { 292 var lens = getLens(b64) 293 var validLen = lens[0] 294 var placeHoldersLen = lens[1] 295 return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen 296} 297 298function _byteLength (b64, validLen, placeHoldersLen) { 299 return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen 300} 301 302function toByteArray (b64) { 303 var tmp 304 var lens = getLens(b64) 305 var validLen = lens[0] 306 var placeHoldersLen = lens[1] 307 308 var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen)) 309 310 var curByte = 0 311 312 // if there are placeholders, only get up to the last complete 4 chars 313 var len = placeHoldersLen > 0 314 ? validLen - 4 315 : validLen 316 317 var i 318 for (i = 0; i < len; i += 4) { 319 tmp = 320 (revLookup[b64.charCodeAt(i)] << 18) | 321 (revLookup[b64.charCodeAt(i + 1)] << 12) | 322 (revLookup[b64.charCodeAt(i + 2)] << 6) | 323 revLookup[b64.charCodeAt(i + 3)] 324 arr[curByte++] = (tmp >> 16) & 0xFF 325 arr[curByte++] = (tmp >> 8) & 0xFF 326 arr[curByte++] = tmp & 0xFF 327 } 328 329 if (placeHoldersLen === 2) { 330 tmp = 331 (revLookup[b64.charCodeAt(i)] << 2) | 332 (revLookup[b64.charCodeAt(i + 1)] >> 4) 333 arr[curByte++] = tmp & 0xFF 334 } 335 336 if (placeHoldersLen === 1) { 337 tmp = 338 (revLookup[b64.charCodeAt(i)] << 10) | 339 (revLookup[b64.charCodeAt(i + 1)] << 4) | 340 (revLookup[b64.charCodeAt(i + 2)] >> 2) 341 arr[curByte++] = (tmp >> 8) & 0xFF 342 arr[curByte++] = tmp & 0xFF 343 } 344 345 return arr 346} 347 348function tripletToBase64 (num) { 349 return lookup[num >> 18 & 0x3F] + 350 lookup[num >> 12 & 0x3F] + 351 lookup[num >> 6 & 0x3F] + 352 lookup[num & 0x3F] 353} 354 355function encodeChunk (uint8, start, end) { 356 var tmp 357 var output = [] 358 for (var i = start; i < end; i += 3) { 359 tmp = 360 ((uint8[i] << 16) & 0xFF0000) + 361 ((uint8[i + 1] << 8) & 0xFF00) + 362 (uint8[i + 2] & 0xFF) 363 output.push(tripletToBase64(tmp)) 364 } 365 return output.join('') 366} 367 368function fromByteArray (uint8) { 369 var tmp 370 var len = uint8.length 371 var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes 372 var parts = [] 373 var maxChunkLength = 16383 // must be multiple of 3 374 375 // go through the array every three bytes, we'll deal with trailing stuff later 376 for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) { 377 parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength))) 378 } 379 380 // pad the end with zeros, but make sure to not forget the extra bytes 381 if (extraBytes === 1) { 382 tmp = uint8[len - 1] 383 parts.push( 384 lookup[tmp >> 2] + 385 lookup[(tmp << 4) & 0x3F] + 386 '==' 387 ) 388 } else if (extraBytes === 2) { 389 tmp = (uint8[len - 2] << 8) + uint8[len - 1] 390 parts.push( 391 lookup[tmp >> 10] + 392 lookup[(tmp >> 4) & 0x3F] + 393 lookup[(tmp << 2) & 0x3F] + 394 '=' 395 ) 396 } 397 398 return parts.join('') 399} 400 401 402/***/ }), 403
vendor: 49,030 bytes, lines 404-2203
404/***/ "./node_modules/buffer/index.js": 405/*!**************************************!*\ 406 !*** ./node_modules/buffer/index.js ***! 407 \**************************************/ 408/***/ ((__unused_webpack_module, exports, __webpack_require__) => { 409 410"use strict"; 411/*! 412 * The buffer module from node.js, for the browser. 413 * 414 * @author Feross Aboukhadijeh <http://feross.org> 415 * @license MIT 416 */ 417/* eslint-disable no-proto */ 418 419 420 421var base64 = __webpack_require__(/*! base64-js */ "./node_modules/base64-js/index.js") 422var ieee754 = __webpack_require__(/*! ieee754 */ "./node_modules/ieee754/index.js") 423var isArray = __webpack_require__(/*! isarray */ "./node_modules/isarray/index.js") 424 425exports.Buffer = Buffer 426exports.SlowBuffer = SlowBuffer 427exports.INSPECT_MAX_BYTES = 50 428 429/** 430 * If `Buffer.TYPED_ARRAY_SUPPORT`: 431 * === true Use Uint8Array implementation (fastest) 432 * === false Use Object implementation (most compatible, even IE6) 433 * 434 * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+, 435 * Opera 11.6+, iOS 4.2+. 436 * 437 * Due to various browser bugs, sometimes the Object implementation will be used even 438 * when the browser supports typed arrays. 439 * 440 * Note: 441 * 442 * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances, 443 * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438. 444 * 445 * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function. 446 * 447 * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of 448 * incorrect length in some situations. 449 450 * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they 451 * get the Object implementation, which is slower but behaves correctly. 452 */ 453Buffer.TYPED_ARRAY_SUPPORT = __webpack_require__.g.TYPED_ARRAY_SUPPORT !== undefined 454 ? __webpack_require__.g.TYPED_ARRAY_SUPPORT 455 : typedArraySupport() 456 457/* 458 * Export kMaxLength after typed array support is determined. 459 */ 460exports.kMaxLength = kMaxLength() 461 462function typedArraySupport () { 463 try { 464 var arr = new Uint8Array(1) 465 arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }} 466 return arr.foo() === 42 && // typed array instances can be augmented 467 typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray` 468 arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray` 469 } catch (e) { 470 return false 471 } 472} 473 474function kMaxLength () { 475 return Buffer.TYPED_ARRAY_SUPPORT 476 ? 0x7fffffff 477 : 0x3fffffff 478} 479 480function createBuffer (that, length) { 481 if (kMaxLength() < length) { 482 throw new RangeError('Invalid typed array length') 483 } 484 if (Buffer.TYPED_ARRAY_SUPPORT) { 485 // Return an augmented `Uint8Array` instance, for best performance 486 that = new Uint8Array(length) 487 that.__proto__ = Buffer.prototype 488 } else { 489 // Fallback: Return an object instance of the Buffer class 490 if (that === null) { 491 that = new Buffer(length) 492 } 493 that.length = length 494 } 495 496 return that 497} 498 499/** 500 * The Buffer constructor returns instances of `Uint8Array` that have their 501 * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of 502 * `Uint8Array`, so the returned instances will have all the node `Buffer` methods 503 * and the `Uint8Array` methods. Square bracket notation works as expected -- it 504 * returns a single octet. 505 * 506 * The `Uint8Array` prototype remains unmodified. 507 */ 508 509function Buffer (arg, encodingOrOffset, length) { 510 if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) { 511 return new Buffer(arg, encodingOrOffset, length) 512 } 513 514 // Common case. 515 if (typeof arg === 'number') { 516 if (typeof encodingOrOffset === 'string') { 517 throw new Error( 518 'If encoding is specified then the first argument must be a string' 519 ) 520 } 521 return allocUnsafe(this, arg) 522 } 523 return from(this, arg, encodingOrOffset, length) 524} 525 526Buffer.poolSize = 8192 // not used by this implementation 527 528// TODO: Legacy, not needed anymore. Remove in next major version. 529Buffer._augment = function (arr) { 530 arr.__proto__ = Buffer.prototype 531 return arr 532} 533 534function from (that, value, encodingOrOffset, length) { 535 if (typeof value === 'number') { 536 throw new TypeError('"value" argument must not be a number') 537 } 538 539 if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) { 540 return fromArrayBuffer(that, value, encodingOrOffset, length) 541 } 542 543 if (typeof value === 'string') { 544 return fromString(that, value, encodingOrOffset) 545 } 546 547 return fromObject(that, value) 548} 549 550/** 551 * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError 552 * if value is a number. 553 * Buffer.from(str[, encoding]) 554 * Buffer.from(array) 555 * Buffer.from(buffer) 556 * Buffer.from(arrayBuffer[, byteOffset[, length]]) 557 **/ 558Buffer.from = function (value, encodingOrOffset, length) { 559 return from(null, value, encodingOrOffset, length) 560} 561 562if (Buffer.TYPED_ARRAY_SUPPORT) { 563 Buffer.prototype.__proto__ = Uint8Array.prototype 564 Buffer.__proto__ = Uint8Array 565 if (typeof Symbol !== 'undefined' && Symbol.species && 566 Buffer[Symbol.species] === Buffer) { 567 // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97 568 Object.defineProperty(Buffer, Symbol.species, { 569 value: null, 570 configurable: true 571 }) 572 } 573} 574 575function assertSize (size) { 576 if (typeof size !== 'number') { 577 throw new TypeError('"size" argument must be a number') 578 } else if (size < 0) { 579 throw new RangeError('"size" argument must not be negative') 580 } 581} 582 583function alloc (that, size, fill, encoding) { 584 assertSize(size) 585 if (size <= 0) { 586 return createBuffer(that, size) 587 } 588 if (fill !== undefined) { 589 // Only pay attention to encoding if it's a string. This 590 // prevents accidentally sending in a number that would 591 // be interpretted as a start offset. 592 return typeof encoding === 'string' 593 ? createBuffer(that, size).fill(fill, encoding) 594 : createBuffer(that, size).fill(fill) 595 } 596 return createBuffer(that, size) 597} 598 599/** 600 * Creates a new filled Buffer instance. 601 * alloc(size[, fill[, encoding]]) 602 **/ 603Buffer.alloc = function (size, fill, encoding) { 604 return alloc(null, size, fill, encoding) 605} 606 607function allocUnsafe (that, size) { 608 assertSize(size) 609 that = createBuffer(that, size < 0 ? 0 : checked(size) | 0) 610 if (!Buffer.TYPED_ARRAY_SUPPORT) { 611 for (var i = 0; i < size; ++i) { 612 that[i] = 0 613 } 614 } 615 return that 616} 617 618/** 619 * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance. 620 * */ 621Buffer.allocUnsafe = function (size) { 622 return allocUnsafe(null, size) 623} 624/** 625 * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. 626 */ 627Buffer.allocUnsafeSlow = function (size) { 628 return allocUnsafe(null, size) 629} 630 631function fromString (that, string, encoding) { 632 if (typeof encoding !== 'string' || encoding === '') { 633 encoding = 'utf8' 634 } 635 636 if (!Buffer.isEncoding(encoding)) { 637 throw new TypeError('"encoding" must be a valid string encoding') 638 } 639 640 var length = byteLength(string, encoding) | 0 641 that = createBuffer(that, length) 642 643 var actual = that.write(string, encoding) 644 645 if (actual !== length) { 646 // Writing a hex string, for example, that contains invalid characters will 647 // cause everything after the first invalid character to be ignored. (e.g. 648 // 'abxxcd' will be treated as 'ab') 649 that = that.slice(0, actual) 650 } 651 652 return that 653} 654 655function fromArrayLike (that, array) { 656 var length = array.length < 0 ? 0 : checked(array.length) | 0 657 that = createBuffer(that, length) 658 for (var i = 0; i < length; i += 1) { 659 that[i] = array[i] & 255 660 } 661 return that 662} 663 664function fromArrayBuffer (that, array, byteOffset, length) { 665 array.byteLength // this throws if `array` is not a valid ArrayBuffer 666 667 if (byteOffset < 0 || array.byteLength < byteOffset) { 668 throw new RangeError('\'offset\' is out of bounds') 669 } 670 671 if (array.byteLength < byteOffset + (length || 0)) { 672 throw new RangeError('\'length\' is out of bounds') 673 } 674 675 if (byteOffset === undefined && length === undefined) { 676 array = new Uint8Array(array) 677 } else if (length === undefined) { 678 array = new Uint8Array(array, byteOffset) 679 } else { 680 array = new Uint8Array(array, byteOffset, length) 681 } 682 683 if (Buffer.TYPED_ARRAY_SUPPORT) { 684 // Return an augmented `Uint8Array` instance, for best performance 685 that = array 686 that.__proto__ = Buffer.prototype 687 } else { 688 // Fallback: Return an object instance of the Buffer class 689 that = fromArrayLike(that, array) 690 } 691 return that 692} 693 694function fromObject (that, obj) { 695 if (Buffer.isBuffer(obj)) { 696 var len = checked(obj.length) | 0 697 that = createBuffer(that, len) 698 699 if (that.length === 0) { 700 return that 701 } 702 703 obj.copy(that, 0, 0, len) 704 return that 705 } 706 707 if (obj) { 708 if ((typeof ArrayBuffer !== 'undefined' && 709 obj.buffer instanceof ArrayBuffer) || 'length' in obj) { 710 if (typeof obj.length !== 'number' || isnan(obj.length)) { 711 return createBuffer(that, 0) 712 } 713 return fromArrayLike(that, obj) 714 } 715 716 if (obj.type === 'Buffer' && isArray(obj.data)) { 717 return fromArrayLike(that, obj.data) 718 } 719 } 720 721 throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.') 722} 723 724function checked (length) { 725 // Note: cannot use `length < kMaxLength()` here because that fails when 726 // length is NaN (which is otherwise coerced to zero.) 727 if (length >= kMaxLength()) { 728 throw new RangeError('Attempt to allocate Buffer larger than maximum ' + 729 'size: 0x' + kMaxLength().toString(16) + ' bytes') 730 } 731 return length | 0 732} 733 734function SlowBuffer (length) { 735 if (+length != length) { // eslint-disable-line eqeqeq 736 length = 0 737 } 738 return Buffer.alloc(+length) 739} 740 741Buffer.isBuffer = function isBuffer (b) { 742 return !!(b != null && b._isBuffer) 743} 744 745Buffer.compare = function compare (a, b) { 746 if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) { 747 throw new TypeError('Arguments must be Buffers') 748 } 749 750 if (a === b) return 0 751 752 var x = a.length 753 var y = b.length 754 755 for (var i = 0, len = Math.min(x, y); i < len; ++i) { 756 if (a[i] !== b[i]) { 757 x = a[i] 758 y = b[i] 759 break 760 } 761 } 762 763 if (x < y) return -1 764 if (y < x) return 1 765 return 0 766} 767 768Buffer.isEncoding = function isEncoding (encoding) { 769 switch (String(encoding).toLowerCase()) { 770 case 'hex': 771 case 'utf8': 772 case 'utf-8': 773 case 'ascii': 774 case 'latin1': 775 case 'binary': 776 case 'base64': 777 case 'ucs2': 778 case 'ucs-2': 779 case 'utf16le': 780 case 'utf-16le': 781 return true 782 default: 783 return false 784 } 785} 786 787Buffer.concat = function concat (list, length) { 788 if (!isArray(list)) { 789 throw new TypeError('"list" argument must be an Array of Buffers') 790 } 791 792 if (list.length === 0) { 793 return Buffer.alloc(0) 794 } 795 796 var i 797 if (length === undefined) { 798 length = 0 799 for (i = 0; i < list.length; ++i) { 800 length += list[i].length 801 } 802 } 803 804 var buffer = Buffer.allocUnsafe(length) 805 var pos = 0 806 for (i = 0; i < list.length; ++i) { 807 var buf = list[i] 808 if (!Buffer.isBuffer(buf)) { 809 throw new TypeError('"list" argument must be an Array of Buffers') 810 } 811 buf.copy(buffer, pos) 812 pos += buf.length 813 } 814 return buffer 815} 816 817function byteLength (string, encoding) { 818 if (Buffer.isBuffer(string)) { 819 return string.length 820 } 821 if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' && 822 (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) { 823 return string.byteLength 824 } 825 if (typeof string !== 'string') { 826 string = '' + string 827 } 828 829 var len = string.length 830 if (len === 0) return 0 831 832 // Use a for loop to avoid recursion 833 var loweredCase = false 834 for (;;) { 835 switch (encoding) { 836 case 'ascii': 837 case 'latin1': 838 case 'binary': 839 return len 840 case 'utf8': 841 case 'utf-8': 842 case undefined: 843 return utf8ToBytes(string).length 844 case 'ucs2': 845 case 'ucs-2': 846 case 'utf16le': 847 case 'utf-16le': 848 return len * 2 849 case 'hex': 850 return len >>> 1 851 case 'base64': 852 return base64ToBytes(string).length 853 default: 854 if (loweredCase) return utf8ToBytes(string).length // assume utf8 855 encoding = ('' + encoding).toLowerCase() 856 loweredCase = true 857 } 858 } 859} 860Buffer.byteLength = byteLength 861 862function slowToString (encoding, start, end) { 863 var loweredCase = false 864 865 // No need to verify that "this.length <= MAX_UINT32" since it's a read-only 866 // property of a typed array. 867 868 // This behaves neither like String nor Uint8Array in that we set start/end 869 // to their upper/lower bounds if the value passed is out of range. 870 // undefined is handled specially as per ECMA-262 6th Edition, 871 // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization. 872 if (start === undefined || start < 0) { 873 start = 0 874 } 875 // Return early if start > this.length. Done here to prevent potential uint32 876 // coercion fail below. 877 if (start > this.length) { 878 return '' 879 } 880 881 if (end === undefined || end > this.length) { 882 end = this.length 883 } 884 885 if (end <= 0) { 886 return '' 887 } 888 889 // Force coersion to uint32. This will also coerce falsey/NaN values to 0. 890 end >>>= 0 891 start >>>= 0 892 893 if (end <= start) { 894 return '' 895 } 896 897 if (!encoding) encoding = 'utf8' 898 899 while (true) { 900 switch (encoding) { 901 case 'hex': 902 return hexSlice(this, start, end) 903 904 case 'utf8': 905 case 'utf-8': 906 return utf8Slice(this, start, end) 907 908 case 'ascii': 909 return asciiSlice(this, start, end) 910 911 case 'latin1': 912 case 'binary': 913 return latin1Slice(this, start, end) 914 915 case 'base64': 916 return base64Slice(this, start, end) 917 918 case 'ucs2': 919 case 'ucs-2': 920 case 'utf16le': 921 case 'utf-16le': 922 return utf16leSlice(this, start, end) 923 924 default: 925 if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) 926 encoding = (encoding + '').toLowerCase() 927 loweredCase = true 928 } 929 } 930} 931 932// The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect 933// Buffer instances. 934Buffer.prototype._isBuffer = true 935 936function swap (b, n, m) { 937 var i = b[n] 938 b[n] = b[m] 939 b[m] = i 940} 941 942Buffer.prototype.swap16 = function swap16 () { 943 var len = this.length 944 if (len % 2 !== 0) { 945 throw new RangeError('Buffer size must be a multiple of 16-bits') 946 } 947 for (var i = 0; i < len; i += 2) { 948 swap(this, i, i + 1) 949 } 950 return this 951} 952 953Buffer.prototype.swap32 = function swap32 () { 954 var len = this.length 955 if (len % 4 !== 0) { 956 throw new RangeError('Buffer size must be a multiple of 32-bits') 957 } 958 for (var i = 0; i < len; i += 4) { 959 swap(this, i, i + 3) 960 swap(this, i + 1, i + 2) 961 } 962 return this 963} 964 965Buffer.prototype.swap64 = function swap64 () { 966 var len = this.length 967 if (len % 8 !== 0) { 968 throw new RangeError('Buffer size must be a multiple of 64-bits') 969 } 970 for (var i = 0; i < len; i += 8) { 971 swap(this, i, i + 7) 972 swap(this, i + 1, i + 6) 973 swap(this, i + 2, i + 5) 974 swap(this, i + 3, i + 4) 975 } 976 return this 977} 978 979Buffer.prototype.toString = function toString () { 980 var length = this.length | 0 981 if (length === 0) return '' 982 if (arguments.length === 0) return utf8Slice(this, 0, length) 983 return slowToString.apply(this, arguments) 984} 985 986Buffer.prototype.equals = function equals (b) { 987 if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer') 988 if (this === b) return true 989 return Buffer.compare(this, b) === 0 990} 991 992Buffer.prototype.inspect = function inspect () { 993 var str = '' 994 var max = exports.INSPECT_MAX_BYTES 995 if (this.length > 0) { 996 str = this.toString('hex', 0, max).match(/.{2}/g).join(' ') 997 if (this.length > max) str += ' ... ' 998 } 999 return '<Buffer ' + str + '>' 1000} 1001 1002Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) { 1003 if (!Buffer.isBuffer(target)) { 1004 throw new TypeError('Argument must be a Buffer') 1005 } 1006 1007 if (start === undefined) { 1008 start = 0 1009 } 1010 if (end === undefined) { 1011 end = target ? target.length : 0 1012 } 1013 if (thisStart === undefined) { 1014 thisStart = 0 1015 } 1016 if (thisEnd === undefined) { 1017 thisEnd = this.length 1018 } 1019 1020 if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) { 1021 throw new RangeError('out of range index') 1022 } 1023 1024 if (thisStart >= thisEnd && start >= end) { 1025 return 0 1026 } 1027 if (thisStart >= thisEnd) { 1028 return -1 1029 } 1030 if (start >= end) { 1031 return 1 1032 } 1033 1034 start >>>= 0 1035 end >>>= 0 1036 thisStart >>>= 0 1037 thisEnd >>>= 0 1038 1039 if (this === target) return 0 1040 1041 var x = thisEnd - thisStart 1042 var y = end - start 1043 var len = Math.min(x, y) 1044 1045 var thisCopy = this.slice(thisStart, thisEnd) 1046 var targetCopy = target.slice(start, end) 1047 1048 for (var i = 0; i < len; ++i) { 1049 if (thisCopy[i] !== targetCopy[i]) { 1050 x = thisCopy[i] 1051 y = targetCopy[i] 1052 break 1053 } 1054 } 1055 1056 if (x < y) return -1 1057 if (y < x) return 1 1058 return 0 1059} 1060 1061// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`, 1062// OR the last index of `val` in `buffer` at offset <= `byteOffset`. 1063// 1064// Arguments: 1065// - buffer - a Buffer to search 1066// - val - a string, Buffer, or number 1067// - byteOffset - an index into `buffer`; will be clamped to an int32 1068// - encoding - an optional encoding, relevant is val is a string 1069// - dir - true for indexOf, false for lastIndexOf 1070function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) { 1071 // Empty buffer means no match 1072 if (buffer.length === 0) return -1 1073 1074 // Normalize byteOffset 1075 if (typeof byteOffset === 'string') { 1076 encoding = byteOffset 1077 byteOffset = 0 1078 } else if (byteOffset > 0x7fffffff) { 1079 byteOffset = 0x7fffffff 1080 } else if (byteOffset < -0x80000000) { 1081 byteOffset = -0x80000000 1082 } 1083 byteOffset = +byteOffset // Coerce to Number. 1084 if (isNaN(byteOffset)) { 1085 // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer 1086 byteOffset = dir ? 0 : (buffer.length - 1) 1087 } 1088 1089 // Normalize byteOffset: negative offsets start from the end of the buffer 1090 if (byteOffset < 0) byteOffset = buffer.length + byteOffset 1091 if (byteOffset >= buffer.length) { 1092 if (dir) return -1 1093 else byteOffset = buffer.length - 1 1094 } else if (byteOffset < 0) { 1095 if (dir) byteOffset = 0 1096 else return -1 1097 } 1098 1099 // Normalize val 1100 if (typeof val === 'string') { 1101 val = Buffer.from(val, encoding) 1102 } 1103 1104 // Finally, search either indexOf (if dir is true) or lastIndexOf 1105 if (Buffer.isBuffer(val)) { 1106 // Special case: looking for empty string/buffer always fails 1107 if (val.length === 0) { 1108 return -1 1109 } 1110 return arrayIndexOf(buffer, val, byteOffset, encoding, dir) 1111 } else if (typeof val === 'number') { 1112 val = val & 0xFF // Search for a byte value [0-255] 1113 if (Buffer.TYPED_ARRAY_SUPPORT && 1114 typeof Uint8Array.prototype.indexOf === 'function') { 1115 if (dir) { 1116 return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset) 1117 } else { 1118 return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset) 1119 } 1120 } 1121 return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir) 1122 } 1123 1124 throw new TypeError('val must be string, number or Buffer') 1125} 1126 1127function arrayIndexOf (arr, val, byteOffset, encoding, dir) { 1128 var indexSize = 1 1129 var arrLength = arr.length 1130 var valLength = val.length 1131 1132 if (encoding !== undefined) { 1133 encoding = String(encoding).toLowerCase() 1134 if (encoding === 'ucs2' || encoding === 'ucs-2' || 1135 encoding === 'utf16le' || encoding === 'utf-16le') { 1136 if (arr.length < 2 || val.length < 2) { 1137 return -1 1138 } 1139 indexSize = 2 1140 arrLength /= 2 1141 valLength /= 2 1142 byteOffset /= 2 1143 } 1144 } 1145 1146 function read (buf, i) { 1147 if (indexSize === 1) { 1148 return buf[i] 1149 } else { 1150 return buf.readUInt16BE(i * indexSize) 1151 } 1152 } 1153 1154 var i 1155 if (dir) { 1156 var foundIndex = -1 1157 for (i = byteOffset; i < arrLength; i++) { 1158 if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) { 1159 if (foundIndex === -1) foundIndex = i 1160 if (i - foundIndex + 1 === valLength) return foundIndex * indexSize 1161 } else { 1162 if (foundIndex !== -1) i -= i - foundIndex 1163 foundIndex = -1 1164 } 1165 } 1166 } else { 1167 if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength 1168 for (i = byteOffset; i >= 0; i--) { 1169 var found = true 1170 for (var j = 0; j < valLength; j++) { 1171 if (read(arr, i + j) !== read(val, j)) { 1172 found = false 1173 break 1174 } 1175 } 1176 if (found) return i 1177 } 1178 } 1179 1180 return -1 1181} 1182 1183Buffer.prototype.includes = function includes (val, byteOffset, encoding) { 1184 return this.indexOf(val, byteOffset, encoding) !== -1 1185} 1186 1187Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) { 1188 return bidirectionalIndexOf(this, val, byteOffset, encoding, true) 1189} 1190 1191Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) { 1192 return bidirectionalIndexOf(this, val, byteOffset, encoding, false) 1193} 1194 1195function hexWrite (buf, string, offset, length) { 1196 offset = Number(offset) || 0 1197 var remaining = buf.length - offset 1198 if (!length) { 1199 length = remaining 1200 } else { 1201 length = Number(length) 1202 if (length > remaining) { 1203 length = remaining 1204 } 1205 } 1206 1207 // must be an even number of digits 1208 var strLen = string.length 1209 if (strLen % 2 !== 0) throw new TypeError('Invalid hex string') 1210 1211 if (length > strLen / 2) { 1212 length = strLen / 2 1213 } 1214 for (var i = 0; i < length; ++i) { 1215 var parsed = parseInt(string.substr(i * 2, 2), 16) 1216 if (isNaN(parsed)) return i 1217 buf[offset + i] = parsed 1218 } 1219 return i 1220} 1221 1222function utf8Write (buf, string, offset, length) { 1223 return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length) 1224} 1225 1226function asciiWrite (buf, string, offset, length) { 1227 return blitBuffer(asciiToBytes(string), buf, offset, length) 1228} 1229 1230function latin1Write (buf, string, offset, length) { 1231 return asciiWrite(buf, string, offset, length) 1232} 1233 1234function base64Write (buf, string, offset, length) { 1235 return blitBuffer(base64ToBytes(string), buf, offset, length) 1236} 1237 1238function ucs2Write (buf, string, offset, length) { 1239 return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length) 1240} 1241 1242Buffer.prototype.write = function write (string, offset, length, encoding) { 1243 // Buffer#write(string) 1244 if (offset === undefined) { 1245 encoding = 'utf8' 1246 length = this.length 1247 offset = 0 1248 // Buffer#write(string, encoding) 1249 } else if (length === undefined && typeof offset === 'string') { 1250 encoding = offset 1251 length = this.length 1252 offset = 0 1253 // Buffer#write(string, offset[, length][, encoding]) 1254 } else if (isFinite(offset)) { 1255 offset = offset | 0 1256 if (isFinite(length)) { 1257 length = length | 0 1258 if (encoding === undefined) encoding = 'utf8' 1259 } else { 1260 encoding = length 1261 length = undefined 1262 } 1263 // legacy write(string, encoding, offset, length) - remove in v0.13 1264 } else { 1265 throw new Error( 1266 'Buffer.write(string, encoding, offset[, length]) is no longer supported' 1267 ) 1268 } 1269 1270 var remaining = this.length - offset 1271 if (length === undefined || length > remaining) length = remaining 1272 1273 if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) { 1274 throw new RangeError('Attempt to write outside buffer bounds') 1275 } 1276 1277 if (!encoding) encoding = 'utf8' 1278 1279 var loweredCase = false 1280 for (;;) { 1281 switch (encoding) { 1282 case 'hex': 1283 return hexWrite(this, string, offset, length) 1284 1285 case 'utf8': 1286 case 'utf-8': 1287 return utf8Write(this, string, offset, length) 1288 1289 case 'ascii': 1290 return asciiWrite(this, string, offset, length) 1291 1292 case 'latin1': 1293 case 'binary': 1294 return latin1Write(this, string, offset, length) 1295 1296 case 'base64': 1297 // Warning: maxLength not taken into account in base64Write 1298 return base64Write(this, string, offset, length) 1299 1300 case 'ucs2': 1301 case 'ucs-2': 1302 case 'utf16le': 1303 case 'utf-16le': 1304 return ucs2Write(this, string, offset, length) 1305 1306 default: 1307 if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) 1308 encoding = ('' + encoding).toLowerCase() 1309 loweredCase = true 1310 } 1311 } 1312} 1313 1314Buffer.prototype.toJSON = function toJSON () { 1315 return { 1316 type: 'Buffer', 1317 data: Array.prototype.slice.call(this._arr || this, 0) 1318 } 1319} 1320 1321function base64Slice (buf, start, end) { 1322 if (start === 0 && end === buf.length) { 1323 return base64.fromByteArray(buf) 1324 } else { 1325 return base64.fromByteArray(buf.slice(start, end)) 1326 } 1327} 1328 1329function utf8Slice (buf, start, end) { 1330 end = Math.min(buf.length, end) 1331 var res = [] 1332 1333 var i = start 1334 while (i < end) { 1335 var firstByte = buf[i] 1336 var codePoint = null 1337 var bytesPerSequence = (firstByte > 0xEF) ? 4 1338 : (firstByte > 0xDF) ? 3 1339 : (firstByte > 0xBF) ? 2 1340 : 1 1341 1342 if (i + bytesPerSequence <= end) { 1343 var secondByte, thirdByte, fourthByte, tempCodePoint 1344 1345 switch (bytesPerSequence) { 1346 case 1: 1347 if (firstByte < 0x80) { 1348 codePoint = firstByte 1349 } 1350 break 1351 case 2: 1352 secondByte = buf[i + 1] 1353 if ((secondByte & 0xC0) === 0x80) { 1354 tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F) 1355 if (tempCodePoint > 0x7F) { 1356 codePoint = tempCodePoint 1357 } 1358 } 1359 break 1360 case 3: 1361 secondByte = buf[i + 1] 1362 thirdByte = buf[i + 2] 1363 if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) { 1364 tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F) 1365 if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) { 1366 codePoint = tempCodePoint 1367 } 1368 } 1369 break 1370 case 4: 1371 secondByte = buf[i + 1] 1372 thirdByte = buf[i + 2] 1373 fourthByte = buf[i + 3] 1374 if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) { 1375 tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F) 1376 if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) { 1377 codePoint = tempCodePoint 1378 } 1379 } 1380 } 1381 } 1382 1383 if (codePoint === null) { 1384 // we did not generate a valid codePoint so insert a 1385 // replacement char (U+FFFD) and advance only 1 byte 1386 codePoint = 0xFFFD 1387 bytesPerSequence = 1 1388 } else if (codePoint > 0xFFFF) { 1389 // encode to utf16 (surrogate pair dance) 1390 codePoint -= 0x10000 1391 res.push(codePoint >>> 10 & 0x3FF | 0xD800) 1392 codePoint = 0xDC00 | codePoint & 0x3FF 1393 } 1394 1395 res.push(codePoint) 1396 i += bytesPerSequence 1397 } 1398 1399 return decodeCodePointsArray(res) 1400} 1401 1402// Based on http://stackoverflow.com/a/22747272/680742, the browser with 1403// the lowest limit is Chrome, with 0x10000 args. 1404// We go 1 magnitude less, for safety 1405var MAX_ARGUMENTS_LENGTH = 0x1000 1406 1407function decodeCodePointsArray (codePoints) { 1408 var len = codePoints.length 1409 if (len <= MAX_ARGUMENTS_LENGTH) { 1410 return String.fromCharCode.apply(String, codePoints) // avoid extra slice() 1411 } 1412 1413 // Decode in chunks to avoid "call stack size exceeded". 1414 var res = '' 1415 var i = 0 1416 while (i < len) { 1417 res += String.fromCharCode.apply( 1418 String, 1419 codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH) 1420 ) 1421 } 1422 return res 1423} 1424 1425function asciiSlice (buf, start, end) { 1426 var ret = '' 1427 end = Math.min(buf.length, end) 1428 1429 for (var i = start; i < end; ++i) { 1430 ret += String.fromCharCode(buf[i] & 0x7F) 1431 } 1432 return ret 1433} 1434 1435function latin1Slice (buf, start, end) { 1436 var ret = '' 1437 end = Math.min(buf.length, end) 1438 1439 for (var i = start; i < end; ++i) { 1440 ret += String.fromCharCode(buf[i]) 1441 } 1442 return ret 1443} 1444 1445function hexSlice (buf, start, end) { 1446 var len = buf.length 1447 1448 if (!start || start < 0) start = 0 1449 if (!end || end < 0 || end > len) end = len 1450 1451 var out = '' 1452 for (var i = start; i < end; ++i) { 1453 out += toHex(buf[i]) 1454 } 1455 return out 1456} 1457 1458function utf16leSlice (buf, start, end) { 1459 var bytes = buf.slice(start, end) 1460 var res = '' 1461 for (var i = 0; i < bytes.length; i += 2) { 1462 res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256) 1463 } 1464 return res 1465} 1466 1467Buffer.prototype.slice = function slice (start, end) { 1468 var len = this.length 1469 start = ~~start 1470 end = end === undefined ? len : ~~end 1471 1472 if (start < 0) { 1473 start += len 1474 if (start < 0) start = 0 1475 } else if (start > len) { 1476 start = len 1477 } 1478 1479 if (end < 0) { 1480 end += len 1481 if (end < 0) end = 0 1482 } else if (end > len) { 1483 end = len 1484 } 1485 1486 if (end < start) end = start 1487 1488 var newBuf 1489 if (Buffer.TYPED_ARRAY_SUPPORT) { 1490 newBuf = this.subarray(start, end) 1491 newBuf.__proto__ = Buffer.prototype 1492 } else { 1493 var sliceLen = end - start 1494 newBuf = new Buffer(sliceLen, undefined) 1495 for (var i = 0; i < sliceLen; ++i) { 1496 newBuf[i] = this[i + start] 1497 } 1498 } 1499 1500 return newBuf 1501} 1502 1503/* 1504 * Need to make sure that buffer isn't trying to write out of bounds. 1505 */ 1506function checkOffset (offset, ext, length) { 1507 if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint') 1508 if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length') 1509} 1510 1511Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) { 1512 offset = offset | 0 1513 byteLength = byteLength | 0 1514 if (!noAssert) checkOffset(offset, byteLength, this.length) 1515 1516 var val = this[offset] 1517 var mul = 1 1518 var i = 0 1519 while (++i < byteLength && (mul *= 0x100)) { 1520 val += this[offset + i] * mul 1521 } 1522 1523 return val 1524} 1525 1526Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) { 1527 offset = offset | 0 1528 byteLength = byteLength | 0 1529 if (!noAssert) { 1530 checkOffset(offset, byteLength, this.length) 1531 } 1532 1533 var val = this[offset + --byteLength] 1534 var mul = 1 1535 while (byteLength > 0 && (mul *= 0x100)) { 1536 val += this[offset + --byteLength] * mul 1537 } 1538 1539 return val 1540} 1541 1542Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) { 1543 if (!noAssert) checkOffset(offset, 1, this.length) 1544 return this[offset] 1545} 1546 1547Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) { 1548 if (!noAssert) checkOffset(offset, 2, this.length) 1549 return this[offset] | (this[offset + 1] << 8) 1550} 1551 1552Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) { 1553 if (!noAssert) checkOffset(offset, 2, this.length) 1554 return (this[offset] << 8) | this[offset + 1] 1555} 1556 1557Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) { 1558 if (!noAssert) checkOffset(offset, 4, this.length) 1559 1560 return ((this[offset]) | 1561 (this[offset + 1] << 8) | 1562 (this[offset + 2] << 16)) + 1563 (this[offset + 3] * 0x1000000) 1564} 1565 1566Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) { 1567 if (!noAssert) checkOffset(offset, 4, this.length) 1568 1569 return (this[offset] * 0x1000000) + 1570 ((this[offset + 1] << 16) | 1571 (this[offset + 2] << 8) | 1572 this[offset + 3]) 1573} 1574 1575Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) { 1576 offset = offset | 0 1577 byteLength = byteLength | 0 1578 if (!noAssert) checkOffset(offset, byteLength, this.length) 1579 1580 var val = this[offset] 1581 var mul = 1 1582 var i = 0 1583 while (++i < byteLength && (mul *= 0x100)) { 1584 val += this[offset + i] * mul 1585 } 1586 mul *= 0x80 1587 1588 if (val >= mul) val -= Math.pow(2, 8 * byteLength) 1589 1590 return val 1591} 1592 1593Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) { 1594 offset = offset | 0 1595 byteLength = byteLength | 0 1596 if (!noAssert) checkOffset(offset, byteLength, this.length) 1597 1598 var i = byteLength 1599 var mul = 1 1600 var val = this[offset + --i] 1601 while (i > 0 && (mul *= 0x100)) { 1602 val += this[offset + --i] * mul 1603 } 1604 mul *= 0x80 1605 1606 if (val >= mul) val -= Math.pow(2, 8 * byteLength) 1607 1608 return val 1609} 1610 1611Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) { 1612 if (!noAssert) checkOffset(offset, 1, this.length) 1613 if (!(this[offset] & 0x80)) return (this[offset]) 1614 return ((0xff - this[offset] + 1) * -1) 1615} 1616 1617Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) { 1618 if (!noAssert) checkOffset(offset, 2, this.length) 1619 var val = this[offset] | (this[offset + 1] << 8) 1620 return (val & 0x8000) ? val | 0xFFFF0000 : val 1621} 1622 1623Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) { 1624 if (!noAssert) checkOffset(offset, 2, this.length) 1625 var val = this[offset + 1] | (this[offset] << 8) 1626 return (val & 0x8000) ? val | 0xFFFF0000 : val 1627} 1628 1629Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) { 1630 if (!noAssert) checkOffset(offset, 4, this.length) 1631 1632 return (this[offset]) | 1633 (this[offset + 1] << 8) | 1634 (this[offset + 2] << 16) | 1635 (this[offset + 3] << 24) 1636} 1637 1638Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) { 1639 if (!noAssert) checkOffset(offset, 4, this.length) 1640 1641 return (this[offset] << 24) | 1642 (this[offset + 1] << 16) | 1643 (this[offset + 2] << 8) | 1644 (this[offset + 3]) 1645} 1646 1647Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) { 1648 if (!noAssert) checkOffset(offset, 4, this.length) 1649 return ieee754.read(this, offset, true, 23, 4) 1650} 1651 1652Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) { 1653 if (!noAssert) checkOffset(offset, 4, this.length) 1654 return ieee754.read(this, offset, false, 23, 4) 1655} 1656 1657Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) { 1658 if (!noAssert) checkOffset(offset, 8, this.length) 1659 return ieee754.read(this, offset, true, 52, 8) 1660} 1661 1662Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) { 1663 if (!noAssert) checkOffset(offset, 8, this.length) 1664 return ieee754.read(this, offset, false, 52, 8) 1665} 1666 1667function checkInt (buf, value, offset, ext, max, min) { 1668 if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance') 1669 if (value > max || value < min) throw new RangeError('"value" argument is out of bounds') 1670 if (offset + ext > buf.length) throw new RangeError('Index out of range') 1671} 1672 1673Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) { 1674 value = +value 1675 offset = offset | 0 1676 byteLength = byteLength | 0 1677 if (!noAssert) { 1678 var maxBytes = Math.pow(2, 8 * byteLength) - 1 1679 checkInt(this, value, offset, byteLength, maxBytes, 0) 1680 } 1681 1682 var mul = 1 1683 var i = 0 1684 this[offset] = value & 0xFF 1685 while (++i < byteLength && (mul *= 0x100)) { 1686 this[offset + i] = (value / mul) & 0xFF 1687 } 1688 1689 return offset + byteLength 1690} 1691 1692Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) { 1693 value = +value 1694 offset = offset | 0 1695 byteLength = byteLength | 0 1696 if (!noAssert) { 1697 var maxBytes = Math.pow(2, 8 * byteLength) - 1 1698 checkInt(this, value, offset, byteLength, maxBytes, 0) 1699 } 1700 1701 var i = byteLength - 1 1702 var mul = 1 1703 this[offset + i] = value & 0xFF 1704 while (--i >= 0 && (mul *= 0x100)) { 1705 this[offset + i] = (value / mul) & 0xFF 1706 } 1707 1708 return offset + byteLength 1709} 1710 1711Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) { 1712 value = +value 1713 offset = offset | 0 1714 if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0) 1715 if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value) 1716 this[offset] = (value & 0xff) 1717 return offset + 1 1718} 1719 1720function objectWriteUInt16 (buf, value, offset, littleEndian) { 1721 if (value < 0) value = 0xffff + value + 1 1722 for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) { 1723 buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>> 1724 (littleEndian ? i : 1 - i) * 8 1725 } 1726} 1727 1728Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) { 1729 value = +value 1730 offset = offset | 0 1731 if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0) 1732 if (Buffer.TYPED_ARRAY_SUPPORT) { 1733 this[offset] = (value & 0xff) 1734 this[offset + 1] = (value >>> 8) 1735 } else { 1736 objectWriteUInt16(this, value, offset, true) 1737 } 1738 return offset + 2 1739} 1740 1741Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) { 1742 value = +value 1743 offset = offset | 0 1744 if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0) 1745 if (Buffer.TYPED_ARRAY_SUPPORT) { 1746 this[offset] = (value >>> 8) 1747 this[offset + 1] = (value & 0xff) 1748 } else { 1749 objectWriteUInt16(this, value, offset, false) 1750 } 1751 return offset + 2 1752} 1753 1754function objectWriteUInt32 (buf, value, offset, littleEndian) { 1755 if (value < 0) value = 0xffffffff + value + 1 1756 for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) { 1757 buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff 1758 } 1759} 1760 1761Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) { 1762 value = +value 1763 offset = offset | 0 1764 if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0) 1765 if (Buffer.TYPED_ARRAY_SUPPORT) { 1766 this[offset + 3] = (value >>> 24) 1767 this[offset + 2] = (value >>> 16) 1768 this[offset + 1] = (value >>> 8) 1769 this[offset] = (value & 0xff) 1770 } else { 1771 objectWriteUInt32(this, value, offset, true) 1772 } 1773 return offset + 4 1774} 1775 1776Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) { 1777 value = +value 1778 offset = offset | 0 1779 if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0) 1780 if (Buffer.TYPED_ARRAY_SUPPORT) { 1781 this[offset] = (value >>> 24) 1782 this[offset + 1] = (value >>> 16) 1783 this[offset + 2] = (value >>> 8) 1784 this[offset + 3] = (value & 0xff) 1785 } else { 1786 objectWriteUInt32(this, value, offset, false) 1787 } 1788 return offset + 4 1789} 1790 1791Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) { 1792 value = +value 1793 offset = offset | 0 1794 if (!noAssert) { 1795 var limit = Math.pow(2, 8 * byteLength - 1) 1796 1797 checkInt(this, value, offset, byteLength, limit - 1, -limit) 1798 } 1799 1800 var i = 0 1801 var mul = 1 1802 var sub = 0 1803 this[offset] = value & 0xFF 1804 while (++i < byteLength && (mul *= 0x100)) { 1805 if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) { 1806 sub = 1 1807 } 1808 this[offset + i] = ((value / mul) >> 0) - sub & 0xFF 1809 } 1810 1811 return offset + byteLength 1812} 1813 1814Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) { 1815 value = +value 1816 offset = offset | 0 1817 if (!noAssert) { 1818 var limit = Math.pow(2, 8 * byteLength - 1) 1819 1820 checkInt(this, value, offset, byteLength, limit - 1, -limit) 1821 } 1822 1823 var i = byteLength - 1 1824 var mul = 1 1825 var sub = 0 1826 this[offset + i] = value & 0xFF 1827 while (--i >= 0 && (mul *= 0x100)) { 1828 if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) { 1829 sub = 1 1830 } 1831 this[offset + i] = ((value / mul) >> 0) - sub & 0xFF 1832 } 1833 1834 return offset + byteLength 1835} 1836 1837Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) { 1838 value = +value 1839 offset = offset | 0 1840 if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80) 1841 if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value) 1842 if (value < 0) value = 0xff + value + 1 1843 this[offset] = (value & 0xff) 1844 return offset + 1 1845} 1846 1847Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) { 1848 value = +value 1849 offset = offset | 0 1850 if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000) 1851 if (Buffer.TYPED_ARRAY_SUPPORT) { 1852 this[offset] = (value & 0xff) 1853 this[offset + 1] = (value >>> 8) 1854 } else { 1855 objectWriteUInt16(this, value, offset, true) 1856 } 1857 return offset + 2 1858} 1859 1860Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) { 1861 value = +value 1862 offset = offset | 0 1863 if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000) 1864 if (Buffer.TYPED_ARRAY_SUPPORT) { 1865 this[offset] = (value >>> 8) 1866 this[offset + 1] = (value & 0xff) 1867 } else { 1868 objectWriteUInt16(this, value, offset, false) 1869 } 1870 return offset + 2 1871} 1872 1873Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) { 1874 value = +value 1875 offset = offset | 0 1876 if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000) 1877 if (Buffer.TYPED_ARRAY_SUPPORT) { 1878 this[offset] = (value & 0xff) 1879 this[offset + 1] = (value >>> 8) 1880 this[offset + 2] = (value >>> 16) 1881 this[offset + 3] = (value >>> 24) 1882 } else { 1883 objectWriteUInt32(this, value, offset, true) 1884 } 1885 return offset + 4 1886} 1887 1888Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) { 1889 value = +value 1890 offset = offset | 0 1891 if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000) 1892 if (value < 0) value = 0xffffffff + value + 1 1893 if (Buffer.TYPED_ARRAY_SUPPORT) { 1894 this[offset] = (value >>> 24) 1895 this[offset + 1] = (value >>> 16) 1896 this[offset + 2] = (value >>> 8) 1897 this[offset + 3] = (value & 0xff) 1898 } else { 1899 objectWriteUInt32(this, value, offset, false) 1900 } 1901 return offset + 4 1902} 1903 1904function checkIEEE754 (buf, value, offset, ext, max, min) { 1905 if (offset + ext > buf.length) throw new RangeError('Index out of range') 1906 if (offset < 0) throw new RangeError('Index out of range') 1907} 1908 1909function writeFloat (buf, value, offset, littleEndian, noAssert) { 1910 if (!noAssert) { 1911 checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38) 1912 } 1913 ieee754.write(buf, value, offset, littleEndian, 23, 4) 1914 return offset + 4 1915} 1916 1917Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) { 1918 return writeFloat(this, value, offset, true, noAssert) 1919} 1920 1921Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) { 1922 return writeFloat(this, value, offset, false, noAssert) 1923} 1924 1925function writeDouble (buf, value, offset, littleEndian, noAssert) { 1926 if (!noAssert) { 1927 checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308) 1928 } 1929 ieee754.write(buf, value, offset, littleEndian, 52, 8) 1930 return offset + 8 1931} 1932 1933Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) { 1934 return writeDouble(this, value, offset, true, noAssert) 1935} 1936 1937Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) { 1938 return writeDouble(this, value, offset, false, noAssert) 1939} 1940 1941// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length) 1942Buffer.prototype.copy = function copy (target, targetStart, start, end) { 1943 if (!start) start = 0 1944 if (!end && end !== 0) end = this.length 1945 if (targetStart >= target.length) targetStart = target.length 1946 if (!targetStart) targetStart = 0 1947 if (end > 0 && end < start) end = start 1948 1949 // Copy 0 bytes; we're done 1950 if (end === start) return 0 1951 if (target.length === 0 || this.length === 0) return 0 1952 1953 // Fatal error conditions 1954 if (targetStart < 0) { 1955 throw new RangeError('targetStart out of bounds') 1956 } 1957 if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds') 1958 if (end < 0) throw new RangeError('sourceEnd out of bounds') 1959 1960 // Are we oob? 1961 if (end > this.length) end = this.length 1962 if (target.length - targetStart < end - start) { 1963 end = target.length - targetStart + start 1964 } 1965 1966 var len = end - start 1967 var i 1968 1969 if (this === target && start < targetStart && targetStart < end) { 1970 // descending copy from end 1971 for (i = len - 1; i >= 0; --i) { 1972 target[i + targetStart] = this[i + start] 1973 } 1974 } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) { 1975 // ascending copy from start 1976 for (i = 0; i < len; ++i) { 1977 target[i + targetStart] = this[i + start] 1978 } 1979 } else { 1980 Uint8Array.prototype.set.call( 1981 target, 1982 this.subarray(start, start + len), 1983 targetStart 1984 ) 1985 } 1986 1987 return len 1988} 1989 1990// Usage: 1991// buffer.fill(number[, offset[, end]]) 1992// buffer.fill(buffer[, offset[, end]]) 1993// buffer.fill(string[, offset[, end]][, encoding]) 1994Buffer.prototype.fill = function fill (val, start, end, encoding) { 1995 // Handle string cases: 1996 if (typeof val === 'string') { 1997 if (typeof start === 'string') { 1998 encoding = start 1999 start = 0 2000 end = this.length 2001 } else if (typeof end === 'string') { 2002 encoding = end 2003 end = this.length 2004 } 2005 if (val.length === 1) { 2006 var code = val.charCodeAt(0) 2007 if (code < 256) { 2008 val = code 2009 } 2010 } 2011 if (encoding !== undefined && typeof encoding !== 'string') { 2012 throw new TypeError('encoding must be a string') 2013 } 2014 if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) { 2015 throw new TypeError('Unknown encoding: ' + encoding) 2016 } 2017 } else if (typeof val === 'number') { 2018 val = val & 255 2019 } 2020 2021 // Invalid ranges are not set to a default, so can range check early. 2022 if (start < 0 || this.length < start || this.length < end) { 2023 throw new RangeError('Out of range index') 2024 } 2025 2026 if (end <= start) { 2027 return this 2028 } 2029 2030 start = start >>> 0 2031 end = end === undefined ? this.length : end >>> 0 2032 2033 if (!val) val = 0 2034 2035 var i 2036 if (typeof val === 'number') { 2037 for (i = start; i < end; ++i) { 2038 this[i] = val 2039 } 2040 } else { 2041 var bytes = Buffer.isBuffer(val) 2042 ? val 2043 : utf8ToBytes(new Buffer(val, encoding).toString()) 2044 var len = bytes.length 2045 for (i = 0; i < end - start; ++i) { 2046 this[i + start] = bytes[i % len] 2047 } 2048 } 2049 2050 return this 2051} 2052 2053// HELPER FUNCTIONS 2054// ================ 2055 2056var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g 2057 2058function base64clean (str) { 2059 // Node strips out invalid characters like \n and \t from the string, base64-js does not 2060 str = stringtrim(str).replace(INVALID_BASE64_RE, '') 2061 // Node converts strings with length < 2 to '' 2062 if (str.length < 2) return '' 2063 // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not 2064 while (str.length % 4 !== 0) { 2065 str = str + '=' 2066 } 2067 return str 2068} 2069 2070function stringtrim (str) { 2071 if (str.trim) return str.trim() 2072 return str.replace(/^\s+|\s+$/g, '') 2073} 2074 2075function toHex (n) { 2076 if (n < 16) return '0' + n.toString(16) 2077 return n.toString(16) 2078} 2079 2080function utf8ToBytes (string, units) { 2081 units = units || Infinity 2082 var codePoint 2083 var length = string.length 2084 var leadSurrogate = null 2085 var bytes = [] 2086 2087 for (var i = 0; i < length; ++i) { 2088 codePoint = string.charCodeAt(i) 2089 2090 // is surrogate component 2091 if (codePoint > 0xD7FF && codePoint < 0xE000) { 2092 // last char was a lead 2093 if (!leadSurrogate) { 2094 // no lead yet 2095 if (codePoint > 0xDBFF) { 2096 // unexpected trail 2097 if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) 2098 continue 2099 } else if (i + 1 === length) { 2100 // unpaired lead 2101 if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) 2102 continue 2103 } 2104 2105 // valid lead 2106 leadSurrogate = codePoint 2107 2108 continue 2109 } 2110 2111 // 2 leads in a row 2112 if (codePoint < 0xDC00) { 2113 if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) 2114 leadSurrogate = codePoint 2115 continue 2116 } 2117 2118 // valid surrogate pair 2119 codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000 2120 } else if (leadSurrogate) { 2121 // valid bmp char, but last char was a lead 2122 if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) 2123 } 2124 2125 leadSurrogate = null 2126 2127 // encode utf8 2128 if (codePoint < 0x80) { 2129 if ((units -= 1) < 0) break 2130 bytes.push(codePoint) 2131 } else if (codePoint < 0x800) { 2132 if ((units -= 2) < 0) break 2133 bytes.push( 2134 codePoint >> 0x6 | 0xC0, 2135 codePoint & 0x3F | 0x80 2136 ) 2137 } else if (codePoint < 0x10000) { 2138 if ((units -= 3) < 0) break 2139 bytes.push( 2140 codePoint >> 0xC | 0xE0, 2141 codePoint >> 0x6 & 0x3F | 0x80, 2142 codePoint & 0x3F | 0x80 2143 ) 2144 } else if (codePoint < 0x110000) { 2145 if ((units -= 4) < 0) break 2146 bytes.push( 2147 codePoint >> 0x12 | 0xF0, 2148 codePoint >> 0xC & 0x3F | 0x80, 2149 codePoint >> 0x6 & 0x3F | 0x80, 2150 codePoint & 0x3F | 0x80 2151 ) 2152 } else { 2153 throw new Error('Invalid code point') 2154 } 2155 } 2156 2157 return bytes 2158} 2159 2160function asciiToBytes (str) { 2161 var byteArray = [] 2162 for (var i = 0; i < str.length; ++i) { 2163 // Node's code seems to be doing this and not & 0x7F.. 2164 byteArray.push(str.charCodeAt(i) & 0xFF) 2165 } 2166 return byteArray 2167} 2168 2169function utf16leToBytes (str, units) { 2170 var c, hi, lo 2171 var byteArray = [] 2172 for (var i = 0; i < str.length; ++i) { 2173 if ((units -= 2) < 0) break 2174 2175 c = str.charCodeAt(i) 2176 hi = c >> 8 2177 lo = c % 256 2178 byteArray.push(lo) 2179 byteArray.push(hi) 2180 } 2181 2182 return byteArray 2183} 2184 2185function base64ToBytes (str) { 2186 return base64.toByteArray(base64clean(str)) 2187} 2188 2189function blitBuffer (src, dst, offset, length) { 2190 for (var i = 0; i < length; ++i) { 2191 if ((i + offset >= dst.length) || (i >= src.length)) break 2192 dst[i + offset] = src[i] 2193 } 2194 return i 2195} 2196 2197function isnan (val) { 2198 return val !== val // eslint-disable-line no-self-compare 2199} 2200 2201 2202/***/ }), 2203
vendor: 2,390 bytes, lines 2204-2298
2204/***/ "./node_modules/ieee754/index.js": 2205/*!***************************************!*\ 2206 !*** ./node_modules/ieee754/index.js ***! 2207 \***************************************/ 2208/***/ ((__unused_webpack_module, exports) => { 2209 2210/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */ 2211exports.read = function (buffer, offset, isLE, mLen, nBytes) { 2212 var e, m 2213 var eLen = (nBytes * 8) - mLen - 1 2214 var eMax = (1 << eLen) - 1 2215 var eBias = eMax >> 1 2216 var nBits = -7 2217 var i = isLE ? (nBytes - 1) : 0 2218 var d = isLE ? -1 : 1 2219 var s = buffer[offset + i] 2220 2221 i += d 2222 2223 e = s & ((1 << (-nBits)) - 1) 2224 s >>= (-nBits) 2225 nBits += eLen 2226 for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {} 2227 2228 m = e & ((1 << (-nBits)) - 1) 2229 e >>= (-nBits) 2230 nBits += mLen 2231 for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {} 2232 2233 if (e === 0) { 2234 e = 1 - eBias 2235 } else if (e === eMax) { 2236 return m ? NaN : ((s ? -1 : 1) * Infinity) 2237 } else { 2238 m = m + Math.pow(2, mLen) 2239 e = e - eBias 2240 } 2241 return (s ? -1 : 1) * m * Math.pow(2, e - mLen) 2242} 2243 2244exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { 2245 var e, m, c 2246 var eLen = (nBytes * 8) - mLen - 1 2247 var eMax = (1 << eLen) - 1 2248 var eBias = eMax >> 1 2249 var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0) 2250 var i = isLE ? 0 : (nBytes - 1) 2251 var d = isLE ? 1 : -1 2252 var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0 2253 2254 value = Math.abs(value) 2255 2256 if (isNaN(value) || value === Infinity) { 2257 m = isNaN(value) ? 1 : 0 2258 e = eMax 2259 } else { 2260 e = Math.floor(Math.log(value) / Math.LN2) 2261 if (value * (c = Math.pow(2, -e)) < 1) { 2262 e-- 2263 c *= 2 2264 } 2265 if (e + eBias >= 1) { 2266 value += rt / c 2267 } else { 2268 value += rt * Math.pow(2, 1 - eBias) 2269 } 2270 if (value * c >= 2) { 2271 e++ 2272 c /= 2 2273 } 2274 2275 if (e + eBias >= eMax) { 2276 m = 0 2277 e = eMax 2278 } else if (e + eBias >= 1) { 2279 m = ((value * c) - 1) * Math.pow(2, mLen) 2280 e = e + eBias 2281 } else { 2282 m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen) 2283 e = 0 2284 } 2285 } 2286 2287 for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {} 2288 2289 e = (e << mLen) | m 2290 eLen += mLen 2291 for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {} 2292 2293 buffer[offset + i - d] |= s * 128 2294} 2295 2296 2297/***/ }), 2298
vendor: 342 bytes, lines 2299-2313
2299/***/ "./node_modules/isarray/index.js": 2300/*!***************************************!*\ 2301 !*** ./node_modules/isarray/index.js ***! 2302 \***************************************/ 2303/***/ ((module) => { 2304 2305var toString = {}.toString; 2306 2307module.exports = Array.isArray || function (arr) { 2308 return toString.call(arr) == '[object Array]'; 2309}; 2310 2311 2312/***/ }), 2313
vendor: 63,277 bytes, lines 2314-4446
2314/***/ "./node_modules/jarallax/dist/jarallax.esm.js": 2315/*!****************************************************!*\ 2316 !*** ./node_modules/jarallax/dist/jarallax.esm.js ***! 2317 \****************************************************/ 2318/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 2319 2320"use strict"; 2321__webpack_require__.r(__webpack_exports__); 2322/* harmony export */ __webpack_require__.d(__webpack_exports__, { 2323/* harmony export */ jarallax: () => (/* binding */ jarallax), 2324/* harmony export */ jarallaxElement: () => (/* binding */ jarallaxElement), 2325/* harmony export */ jarallaxVideo: () => (/* binding */ jarallaxVideo) 2326/* harmony export */ }); 2327/*! 2328 * Jarallax v2.2.0 (https://github.com/nk-o/jarallax) 2329 * Copyright 2024 nK <https://nkdev.info> 2330 * Licensed under MIT (https://github.com/nk-o/jarallax/blob/master/LICENSE) 2331 */ 2332var defaults$1 = { 2333 // Base parallax options. 2334 type: 'scroll', 2335 speed: 0.5, 2336 containerClass: 'jarallax-container', 2337 imgSrc: null, 2338 imgElement: '.jarallax-img', 2339 imgSize: 'cover', 2340 imgPosition: '50% 50%', 2341 imgRepeat: 'no-repeat', 2342 keepImg: false, 2343 elementInViewport: null, 2344 zIndex: -100, 2345 disableParallax: false, 2346 // Callbacks. 2347 onScroll: null, 2348 onInit: null, 2349 onDestroy: null, 2350 onCoverImage: null, 2351 // Video options. 2352 videoClass: 'jarallax-video', 2353 videoSrc: null, 2354 videoStartTime: 0, 2355 videoEndTime: 0, 2356 videoVolume: 0, 2357 videoLoop: true, 2358 videoPlayOnlyVisible: true, 2359 videoLazyLoading: true, 2360 disableVideo: false, 2361 // Video callbacks. 2362 onVideoInsert: null, 2363 onVideoWorkerInit: null 2364}; 2365 2366/* eslint-disable import/no-mutable-exports */ 2367/* eslint-disable no-restricted-globals */ 2368let win$1; 2369if (typeof window !== 'undefined') { 2370 win$1 = window; 2371} else if (typeof __webpack_require__.g !== 'undefined') { 2372 win$1 = __webpack_require__.g; 2373} else if (typeof self !== 'undefined') { 2374 win$1 = self; 2375} else { 2376 win$1 = {}; 2377} 2378var global$2 = win$1; 2379 2380/** 2381 * Add styles to element. 2382 * 2383 * @param {Element} el - element. 2384 * @param {String|Object} styles - styles list. 2385 * 2386 * @returns {Element} 2387 */ 2388function css(el, styles) { 2389 if (typeof styles === 'string') { 2390 return global$2.getComputedStyle(el).getPropertyValue(styles); 2391 } 2392 Object.keys(styles).forEach(key => { 2393 el.style[key] = styles[key]; 2394 }); 2395 return el; 2396} 2397 2398/** 2399 * Extend like jQuery.extend 2400 * 2401 * @param {Object} out - output object. 2402 * @param {...any} args - additional objects to extend. 2403 * 2404 * @returns {Object} 2405 */ 2406function extend$1(out, ...args) { 2407 out = out || {}; 2408 Object.keys(args).forEach(i => { 2409 if (!args[i]) { 2410 return; 2411 } 2412 Object.keys(args[i]).forEach(key => { 2413 out[key] = args[i][key]; 2414 }); 2415 }); 2416 return out; 2417} 2418 2419/** 2420 * Get all parents of the element. 2421 * 2422 * @param {Element} elem - DOM element. 2423 * 2424 * @returns {Array} 2425 */ 2426function getParents(elem) { 2427 const parents = []; 2428 while (elem.parentElement !== null) { 2429 elem = elem.parentElement; 2430 if (elem.nodeType === 1) { 2431 parents.push(elem); 2432 } 2433 } 2434 return parents; 2435} 2436 2437/** 2438 * Document ready callback. 2439 * @param {Function} callback - callback will be fired once Document ready. 2440 */ 2441function ready(callback) { 2442 if (document.readyState === 'complete' || document.readyState === 'interactive') { 2443 // Already ready or interactive, execute callback 2444 callback(); 2445 } else { 2446 document.addEventListener('DOMContentLoaded', callback, { 2447 capture: true, 2448 once: true, 2449 passive: true 2450 }); 2451 } 2452} 2453 2454const { 2455 navigator: navigator$1 2456} = global$2; 2457const mobileAgent = /*#__PURE__*/ /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator$1.userAgent); 2458function isMobile() { 2459 return mobileAgent; 2460} 2461 2462let wndW; 2463let wndH; 2464let $deviceHelper; 2465 2466/** 2467 * The most popular mobile browsers changes height after page scroll and this generates image jumping. 2468 * We can fix it using this workaround with vh units. 2469 */ 2470function getDeviceHeight() { 2471 if (!$deviceHelper && document.body) { 2472 $deviceHelper = document.createElement('div'); 2473 $deviceHelper.style.cssText = 'position: fixed; top: -9999px; left: 0; height: 100vh; width: 0;'; 2474 document.body.appendChild($deviceHelper); 2475 } 2476 return ($deviceHelper ? $deviceHelper.clientHeight : 0) || global$2.innerHeight || document.documentElement.clientHeight; 2477} 2478function updateWindowHeight() { 2479 wndW = global$2.innerWidth || document.documentElement.clientWidth; 2480 if (isMobile()) { 2481 wndH = getDeviceHeight(); 2482 } else { 2483 wndH = global$2.innerHeight || document.documentElement.clientHeight; 2484 } 2485} 2486updateWindowHeight(); 2487global$2.addEventListener('resize', updateWindowHeight); 2488global$2.addEventListener('orientationchange', updateWindowHeight); 2489global$2.addEventListener('load', updateWindowHeight); 2490ready(() => { 2491 updateWindowHeight(); 2492}); 2493function getWindowSize() { 2494 return { 2495 width: wndW, 2496 height: wndH 2497 }; 2498} 2499 2500// List with all jarallax instances 2501// need to render all in one scroll/resize event. 2502const jarallaxList = []; 2503function updateParallax() { 2504 if (!jarallaxList.length) { 2505 return; 2506 } 2507 const { 2508 width: wndW, 2509 height: wndH 2510 } = getWindowSize(); 2511 jarallaxList.forEach((data, k) => { 2512 const { 2513 instance, 2514 oldData 2515 } = data; 2516 if (!instance.isVisible()) { 2517 return; 2518 } 2519 const clientRect = instance.$item.getBoundingClientRect(); 2520 const newData = { 2521 width: clientRect.width, 2522 height: clientRect.height, 2523 top: clientRect.top, 2524 bottom: clientRect.bottom, 2525 wndW, 2526 wndH 2527 }; 2528 const isResized = !oldData || oldData.wndW !== newData.wndW || oldData.wndH !== newData.wndH || oldData.width !== newData.width || oldData.height !== newData.height; 2529 const isScrolled = isResized || !oldData || oldData.top !== newData.top || oldData.bottom !== newData.bottom; 2530 jarallaxList[k].oldData = newData; 2531 if (isResized) { 2532 instance.onResize(); 2533 } 2534 if (isScrolled) { 2535 instance.onScroll(); 2536 } 2537 }); 2538 global$2.requestAnimationFrame(updateParallax); 2539} 2540const visibilityObserver = /*#__PURE__*/new global$2.IntersectionObserver(entries => { 2541 entries.forEach(entry => { 2542 entry.target.jarallax.isElementInViewport = entry.isIntersecting; 2543 }); 2544}, { 2545 // We have to start parallax calculation before the block is in view 2546 // to prevent possible parallax jumping. 2547 rootMargin: '50px' 2548}); 2549function addObserver(instance) { 2550 jarallaxList.push({ 2551 instance 2552 }); 2553 if (jarallaxList.length === 1) { 2554 global$2.requestAnimationFrame(updateParallax); 2555 } 2556 visibilityObserver.observe(instance.options.elementInViewport || instance.$item); 2557} 2558function removeObserver(instance) { 2559 jarallaxList.forEach((data, key) => { 2560 if (data.instance.instanceID === instance.instanceID) { 2561 jarallaxList.splice(key, 1); 2562 } 2563 }); 2564 visibilityObserver.unobserve(instance.options.elementInViewport || instance.$item); 2565} 2566 2567/* eslint-disable class-methods-use-this */ 2568const { 2569 navigator 2570} = global$2; 2571let instanceID = 0; 2572 2573// Jarallax class 2574class Jarallax { 2575 constructor(item, userOptions) { 2576 const self = this; 2577 self.instanceID = instanceID; 2578 instanceID += 1; 2579 self.$item = item; 2580 self.defaults = { 2581 ...defaults$1 2582 }; 2583 2584 // prepare data-options 2585 const dataOptions = self.$item.dataset || {}; 2586 const pureDataOptions = {}; 2587 Object.keys(dataOptions).forEach(key => { 2588 const lowerCaseOption = key.substr(0, 1).toLowerCase() + key.substr(1); 2589 if (lowerCaseOption && typeof self.defaults[lowerCaseOption] !== 'undefined') { 2590 pureDataOptions[lowerCaseOption] = dataOptions[key]; 2591 } 2592 }); 2593 self.options = self.extend({}, self.defaults, pureDataOptions, userOptions); 2594 self.pureOptions = self.extend({}, self.options); 2595 2596 // prepare 'true' and 'false' strings to boolean 2597 Object.keys(self.options).forEach(key => { 2598 if (self.options[key] === 'true') { 2599 self.options[key] = true; 2600 } else if (self.options[key] === 'false') { 2601 self.options[key] = false; 2602 } 2603 }); 2604 2605 // fix speed option [-1.0, 2.0] 2606 self.options.speed = Math.min(2, Math.max(-1, parseFloat(self.options.speed))); 2607 2608 // prepare disableParallax callback 2609 if (typeof self.options.disableParallax === 'string') { 2610 self.options.disableParallax = new RegExp(self.options.disableParallax); 2611 } 2612 if (self.options.disableParallax instanceof RegExp) { 2613 const disableParallaxRegexp = self.options.disableParallax; 2614 self.options.disableParallax = () => disableParallaxRegexp.test(navigator.userAgent); 2615 } 2616 if (typeof self.options.disableParallax !== 'function') { 2617 self.options.disableParallax = () => false; 2618 } 2619 2620 // prepare disableVideo callback 2621 if (typeof self.options.disableVideo === 'string') { 2622 self.options.disableVideo = new RegExp(self.options.disableVideo); 2623 } 2624 if (self.options.disableVideo instanceof RegExp) { 2625 const disableVideoRegexp = self.options.disableVideo; 2626 self.options.disableVideo = () => disableVideoRegexp.test(navigator.userAgent); 2627 } 2628 if (typeof self.options.disableVideo !== 'function') { 2629 self.options.disableVideo = () => false; 2630 } 2631 2632 // custom element to check if parallax in viewport 2633 let elementInVP = self.options.elementInViewport; 2634 // get first item from array 2635 if (elementInVP && typeof elementInVP === 'object' && typeof elementInVP.length !== 'undefined') { 2636 [elementInVP] = elementInVP; 2637 } 2638 // check if dom element 2639 if (!(elementInVP instanceof Element)) { 2640 elementInVP = null; 2641 } 2642 self.options.elementInViewport = elementInVP; 2643 self.image = { 2644 src: self.options.imgSrc || null, 2645 $container: null, 2646 useImgTag: false, 2647 // 1. Position fixed is needed for the most of browsers because absolute position have glitches 2648 // 2. On MacOS with smooth scroll there is a huge lags with absolute position - https://github.com/nk-o/jarallax/issues/75 2649 // 3. Previously used 'absolute' for mobile devices. But we re-tested on iPhone 12 and 'fixed' position is working better, then 'absolute', so for now position is always 'fixed' 2650 position: 'fixed' 2651 }; 2652 if (self.initImg() && self.canInitParallax()) { 2653 self.init(); 2654 } 2655 } 2656 css(el, styles) { 2657 return css(el, styles); 2658 } 2659 extend(out, ...args) { 2660 return extend$1(out, ...args); 2661 } 2662 2663 // get window size and scroll position. Useful for extensions 2664 getWindowData() { 2665 const { 2666 width, 2667 height 2668 } = getWindowSize(); 2669 return { 2670 width, 2671 height, 2672 y: document.documentElement.scrollTop 2673 }; 2674 } 2675 2676 // Jarallax functions 2677 initImg() { 2678 const self = this; 2679 2680 // find image element 2681 let $imgElement = self.options.imgElement; 2682 if ($imgElement && typeof $imgElement === 'string') { 2683 $imgElement = self.$item.querySelector($imgElement); 2684 } 2685 2686 // check if dom element 2687 if (!($imgElement instanceof Element)) { 2688 if (self.options.imgSrc) { 2689 $imgElement = new Image(); 2690 $imgElement.src = self.options.imgSrc; 2691 } else { 2692 $imgElement = null; 2693 } 2694 } 2695 if ($imgElement) { 2696 if (self.options.keepImg) { 2697 self.image.$item = $imgElement.cloneNode(true); 2698 } else { 2699 self.image.$item = $imgElement; 2700 self.image.$itemParent = $imgElement.parentNode; 2701 } 2702 self.image.useImgTag = true; 2703 } 2704 2705 // true if there is img tag 2706 if (self.image.$item) { 2707 return true; 2708 } 2709 2710 // get image src 2711 if (self.image.src === null) { 2712 self.image.src = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7'; 2713 self.image.bgImage = self.css(self.$item, 'background-image'); 2714 } 2715 return !(!self.image.bgImage || self.image.bgImage === 'none'); 2716 } 2717 canInitParallax() { 2718 return !this.options.disableParallax(); 2719 } 2720 init() { 2721 const self = this; 2722 const containerStyles = { 2723 position: 'absolute', 2724 top: 0, 2725 left: 0, 2726 width: '100%', 2727 height: '100%', 2728 overflow: 'hidden' 2729 }; 2730 let imageStyles = { 2731 pointerEvents: 'none', 2732 transformStyle: 'preserve-3d', 2733 backfaceVisibility: 'hidden' 2734 }; 2735 if (!self.options.keepImg) { 2736 // save default user styles 2737 const curStyle = self.$item.getAttribute('style'); 2738 if (curStyle) { 2739 self.$item.setAttribute('data-jarallax-original-styles', curStyle); 2740 } 2741 if (self.image.useImgTag) { 2742 const curImgStyle = self.image.$item.getAttribute('style'); 2743 if (curImgStyle) { 2744 self.image.$item.setAttribute('data-jarallax-original-styles', curImgStyle); 2745 } 2746 } 2747 } 2748 2749 // set relative position and z-index to the parent 2750 if (self.css(self.$item, 'position') === 'static') { 2751 self.css(self.$item, { 2752 position: 'relative' 2753 }); 2754 } 2755 if (self.css(self.$item, 'z-index') === 'auto') { 2756 self.css(self.$item, { 2757 zIndex: 0 2758 }); 2759 } 2760 2761 // container for parallax image 2762 self.image.$container = document.createElement('div'); 2763 self.css(self.image.$container, containerStyles); 2764 self.css(self.image.$container, { 2765 'z-index': self.options.zIndex 2766 }); 2767 2768 // it will remove some image overlapping 2769 // overlapping occur due to an image position fixed inside absolute position element 2770 // needed only when background in fixed position 2771 if (this.image.position === 'fixed') { 2772 self.css(self.image.$container, { 2773 '-webkit-clip-path': 'polygon(0 0, 100% 0, 100% 100%, 0 100%)', 2774 'clip-path': 'polygon(0 0, 100% 0, 100% 100%, 0 100%)' 2775 }); 2776 } 2777 2778 // Add container unique ID. 2779 self.image.$container.setAttribute('id', `jarallax-container-${self.instanceID}`); 2780 2781 // Add container class. 2782 if (self.options.containerClass) { 2783 self.image.$container.setAttribute('class', self.options.containerClass); 2784 } 2785 self.$item.appendChild(self.image.$container); 2786 2787 // use img tag 2788 if (self.image.useImgTag) { 2789 imageStyles = self.extend({ 2790 'object-fit': self.options.imgSize, 2791 'object-position': self.options.imgPosition, 2792 'max-width': 'none' 2793 }, containerStyles, imageStyles); 2794 2795 // use div with background image 2796 } else { 2797 self.image.$item = document.createElement('div'); 2798 if (self.image.src) { 2799 imageStyles = self.extend({ 2800 'background-position': self.options.imgPosition, 2801 'background-size': self.options.imgSize, 2802 'background-repeat': self.options.imgRepeat, 2803 'background-image': self.image.bgImage || `url("${self.image.src}")` 2804 }, containerStyles, imageStyles); 2805 } 2806 } 2807 if (self.options.type === 'opacity' || self.options.type === 'scale' || self.options.type === 'scale-opacity' || self.options.speed === 1) { 2808 self.image.position = 'absolute'; 2809 } 2810 2811 // 1. Check if one of parents have transform style (without this check, scroll transform will be inverted if used parallax with position fixed) 2812 // discussion - https://github.com/nk-o/jarallax/issues/9 2813 // 2. Check if parents have overflow scroll 2814 if (self.image.position === 'fixed') { 2815 const $parents = getParents(self.$item).filter(el => { 2816 const styles = global$2.getComputedStyle(el); 2817 const parentTransform = styles['-webkit-transform'] || styles['-moz-transform'] || styles.transform; 2818 const overflowRegex = /(auto|scroll)/; 2819 return parentTransform && parentTransform !== 'none' || overflowRegex.test(styles.overflow + styles['overflow-y'] + styles['overflow-x']); 2820 }); 2821 self.image.position = $parents.length ? 'absolute' : 'fixed'; 2822 } 2823 2824 // add position to parallax block 2825 imageStyles.position = self.image.position; 2826 2827 // insert parallax image 2828 self.css(self.image.$item, imageStyles); 2829 self.image.$container.appendChild(self.image.$item); 2830 2831 // set initial position and size 2832 self.onResize(); 2833 self.onScroll(true); 2834 2835 // call onInit event 2836 if (self.options.onInit) { 2837 self.options.onInit.call(self); 2838 } 2839 2840 // remove default user background 2841 if (self.css(self.$item, 'background-image') !== 'none') { 2842 self.css(self.$item, { 2843 'background-image': 'none' 2844 }); 2845 } 2846 addObserver(self); 2847 } 2848 destroy() { 2849 const self = this; 2850 removeObserver(self); 2851 2852 // return styles on container as before jarallax init 2853 const originalStylesTag = self.$item.getAttribute('data-jarallax-original-styles'); 2854 self.$item.removeAttribute('data-jarallax-original-styles'); 2855 // null occurs if there is no style tag before jarallax init 2856 if (!originalStylesTag) { 2857 self.$item.removeAttribute('style'); 2858 } else { 2859 self.$item.setAttribute('style', originalStylesTag); 2860 } 2861 if (self.image.useImgTag) { 2862 // return styles on img tag as before jarallax init 2863 const originalStylesImgTag = self.image.$item.getAttribute('data-jarallax-original-styles'); 2864 self.image.$item.removeAttribute('data-jarallax-original-styles'); 2865 // null occurs if there is no style tag before jarallax init 2866 if (!originalStylesImgTag) { 2867 self.image.$item.removeAttribute('style'); 2868 } else { 2869 self.image.$item.setAttribute('style', originalStylesTag); 2870 } 2871 2872 // move img tag to its default position 2873 if (self.image.$itemParent) { 2874 self.image.$itemParent.appendChild(self.image.$item); 2875 } 2876 } 2877 2878 // remove additional dom elements 2879 if (self.image.$container) { 2880 self.image.$container.parentNode.removeChild(self.image.$container); 2881 } 2882 2883 // call onDestroy event 2884 if (self.options.onDestroy) { 2885 self.options.onDestroy.call(self); 2886 } 2887 2888 // delete jarallax from item 2889 delete self.$item.jarallax; 2890 } 2891 coverImage() { 2892 const self = this; 2893 const { 2894 height: wndH 2895 } = getWindowSize(); 2896 const rect = self.image.$container.getBoundingClientRect(); 2897 const contH = rect.height; 2898 const { 2899 speed 2900 } = self.options; 2901 const isScroll = self.options.type === 'scroll' || self.options.type === 'scroll-opacity'; 2902 let scrollDist = 0; 2903 let resultH = contH; 2904 let resultMT = 0; 2905 2906 // scroll parallax 2907 if (isScroll) { 2908 // scroll distance and height for image 2909 if (speed < 0) { 2910 scrollDist = speed * Math.max(contH, wndH); 2911 if (wndH < contH) { 2912 scrollDist -= speed * (contH - wndH); 2913 } 2914 } else { 2915 scrollDist = speed * (contH + wndH); 2916 } 2917 2918 // size for scroll parallax 2919 if (speed > 1) { 2920 resultH = Math.abs(scrollDist - wndH); 2921 } else if (speed < 0) { 2922 resultH = scrollDist / speed + Math.abs(scrollDist); 2923 } else { 2924 resultH += (wndH - contH) * (1 - speed); 2925 } 2926 scrollDist /= 2; 2927 } 2928 2929 // store scroll distance 2930 self.parallaxScrollDistance = scrollDist; 2931 2932 // vertical center 2933 if (isScroll) { 2934 resultMT = (wndH - resultH) / 2; 2935 } else { 2936 resultMT = (contH - resultH) / 2; 2937 } 2938 2939 // apply result to item 2940 self.css(self.image.$item, { 2941 height: `${resultH}px`, 2942 marginTop: `${resultMT}px`, 2943 left: self.image.position === 'fixed' ? `${rect.left}px` : '0', 2944 width: `${rect.width}px` 2945 }); 2946 2947 // call onCoverImage event 2948 if (self.options.onCoverImage) { 2949 self.options.onCoverImage.call(self); 2950 } 2951 2952 // return some useful data. Used in the video cover function 2953 return { 2954 image: { 2955 height: resultH, 2956 marginTop: resultMT 2957 }, 2958 container: rect 2959 }; 2960 } 2961 isVisible() { 2962 return this.isElementInViewport || false; 2963 } 2964 onScroll(force) { 2965 const self = this; 2966 2967 // stop calculations if item is not in viewport 2968 if (!force && !self.isVisible()) { 2969 return; 2970 } 2971 const { 2972 height: wndH 2973 } = getWindowSize(); 2974 const rect = self.$item.getBoundingClientRect(); 2975 const contT = rect.top; 2976 const contH = rect.height; 2977 const styles = {}; 2978 2979 // calculate parallax helping variables 2980 const beforeTop = Math.max(0, contT); 2981 const beforeTopEnd = Math.max(0, contH + contT); 2982 const afterTop = Math.max(0, -contT); 2983 const beforeBottom = Math.max(0, contT + contH - wndH); 2984 const beforeBottomEnd = Math.max(0, contH - (contT + contH - wndH)); 2985 const afterBottom = Math.max(0, -contT + wndH - contH); 2986 const fromViewportCenter = 1 - 2 * ((wndH - contT) / (wndH + contH)); 2987 2988 // calculate on how percent of section is visible 2989 let visiblePercent = 1; 2990 if (contH < wndH) { 2991 visiblePercent = 1 - (afterTop || beforeBottom) / contH; 2992 } else if (beforeTopEnd <= wndH) { 2993 visiblePercent = beforeTopEnd / wndH; 2994 } else if (beforeBottomEnd <= wndH) { 2995 visiblePercent = beforeBottomEnd / wndH; 2996 } 2997 2998 // opacity 2999 if (self.options.type === 'opacity' || self.options.type === 'scale-opacity' || self.options.type === 'scroll-opacity') { 3000 styles.transform = 'translate3d(0,0,0)'; 3001 styles.opacity = visiblePercent; 3002 } 3003 3004 // scale 3005 if (self.options.type === 'scale' || self.options.type === 'scale-opacity') { 3006 let scale = 1; 3007 if (self.options.speed < 0) { 3008 scale -= self.options.speed * visiblePercent; 3009 } else { 3010 scale += self.options.speed * (1 - visiblePercent); 3011 } 3012 styles.transform = `scale(${scale}) translate3d(0,0,0)`; 3013 } 3014 3015 // scroll 3016 if (self.options.type === 'scroll' || self.options.type === 'scroll-opacity') { 3017 let positionY = self.parallaxScrollDistance * fromViewportCenter; 3018 3019 // fix if parallax block in absolute position 3020 if (self.image.position === 'absolute') { 3021 positionY -= contT; 3022 } 3023 styles.transform = `translate3d(0,${positionY}px,0)`; 3024 } 3025 self.css(self.image.$item, styles); 3026 3027 // call onScroll event 3028 if (self.options.onScroll) { 3029 self.options.onScroll.call(self, { 3030 section: rect, 3031 beforeTop, 3032 beforeTopEnd, 3033 afterTop, 3034 beforeBottom, 3035 beforeBottomEnd, 3036 afterBottom, 3037 visiblePercent, 3038 fromViewportCenter 3039 }); 3040 } 3041 } 3042 onResize() { 3043 this.coverImage(); 3044 } 3045} 3046 3047// global definition 3048const jarallax$1 = function (items, options, ...args) { 3049 // check for dom element 3050 // thanks: http://stackoverflow.com/questions/384286/javascript-isdom-how-do-you-check-if-a-javascript-object-is-a-dom-object 3051 if (typeof HTMLElement === 'object' ? items instanceof HTMLElement : items && typeof items === 'object' && items !== null && items.nodeType === 1 && typeof items.nodeName === 'string') { 3052 items = [items]; 3053 } 3054 const len = items.length; 3055 let k = 0; 3056 let ret; 3057 for (k; k < len; k += 1) { 3058 if (typeof options === 'object' || typeof options === 'undefined') { 3059 if (!items[k].jarallax) { 3060 items[k].jarallax = new Jarallax(items[k], options); 3061 } 3062 } else if (items[k].jarallax) { 3063 // eslint-disable-next-line prefer-spread 3064 ret = items[k].jarallax[options].apply(items[k].jarallax, args); 3065 } 3066 if (typeof ret !== 'undefined') { 3067 return ret; 3068 } 3069 } 3070 return items; 3071}; 3072jarallax$1.constructor = Jarallax; 3073 3074/*! 3075 * Video Worker v2.2.0 (https://github.com/nk-o/video-worker) 3076 * Copyright 2024 nK <https://nkdev.info> 3077 * Licensed under MIT (https://github.com/nk-o/video-worker/blob/master/LICENSE) 3078 */ 3079 3080var defaults = { 3081 autoplay: false, 3082 loop: false, 3083 mute: false, 3084 volume: 100, 3085 showControls: true, 3086 accessibilityHidden: false, 3087 // start / end video time in seconds 3088 startTime: 0, 3089 endTime: 0 3090}; 3091 3092/** 3093 * Extend like jQuery.extend 3094 * 3095 * @param {Object} out - output object. 3096 * @param {...any} args - additional objects to extend. 3097 * 3098 * @returns {Object} 3099 */ 3100function extend(out, ...args) { 3101 out = out || {}; 3102 Object.keys(args).forEach(i => { 3103 if (!args[i]) { 3104 return; 3105 } 3106 Object.keys(args[i]).forEach(key => { 3107 out[key] = args[i][key]; 3108 }); 3109 }); 3110 return out; 3111} 3112let ID = 0; 3113class VideoWorkerBase { 3114 type = 'none'; 3115 constructor(url, options) { 3116 const self = this; 3117 self.url = url; 3118 self.options_default = { 3119 ...defaults 3120 }; 3121 self.options = extend({}, self.options_default, options); 3122 3123 // check URL 3124 self.videoID = self.constructor.parseURL(url); 3125 3126 // init 3127 if (self.videoID) { 3128 self.init(); 3129 } 3130 } 3131 isValid() { 3132 return !!this.videoID; 3133 } 3134 init() { 3135 const self = this; 3136 self.ID = ID; 3137 ID += 1; 3138 self.playerID = `VideoWorker-${self.ID}`; 3139 } 3140 3141 // events 3142 on(name, callback) { 3143 this.userEventsList = this.userEventsList || []; 3144 3145 // add new callback in events list 3146 (this.userEventsList[name] || (this.userEventsList[name] = [])).push(callback); 3147 } 3148 off(name, callback) { 3149 if (!this.userEventsList || !this.userEventsList[name]) { 3150 return; 3151 } 3152 if (!callback) { 3153 delete this.userEventsList[name]; 3154 } else { 3155 this.userEventsList[name].forEach((val, key) => { 3156 if (val === callback) { 3157 this.userEventsList[name][key] = false; 3158 } 3159 }); 3160 } 3161 } 3162 fire(name, ...args) { 3163 if (this.userEventsList && typeof this.userEventsList[name] !== 'undefined') { 3164 this.userEventsList[name].forEach(val => { 3165 // call with all arguments 3166 if (val) { 3167 val.apply(this, args); 3168 } 3169 }); 3170 } 3171 } 3172 3173 /** 3174 * Methods used in providers. 3175 */ 3176 /* eslint-disable */ 3177 static parseURL(url) { 3178 return false; 3179 } 3180 play(start) {} 3181 pause() {} 3182 mute() {} 3183 unmute() {} 3184 setVolume(volume = false) {} 3185 getVolume(callback) {} 3186 getMuted(callback) {} 3187 setCurrentTime(currentTime = false) {} 3188 getCurrentTime(callback) {} 3189 getImageURL(callback) {} 3190 getVideo(callback) {} 3191 /* eslint-enable */ 3192} 3193 3194/* eslint-disable import/no-mutable-exports */ 3195/* eslint-disable no-restricted-globals */ 3196let win; 3197if (typeof window !== 'undefined') { 3198 win = window; 3199} else if (typeof __webpack_require__.g !== 'undefined') { 3200 win = __webpack_require__.g; 3201} else if (typeof self !== 'undefined') { 3202 win = self; 3203} else { 3204 win = {}; 3205} 3206var global$1 = win; 3207 3208// Deferred 3209// thanks http://stackoverflow.com/questions/18096715/implement-deferred-object-without-using-jquery 3210function Deferred() { 3211 this.doneCallbacks = []; 3212 this.failCallbacks = []; 3213} 3214Deferred.prototype = { 3215 execute(list, args) { 3216 let i = list.length; 3217 // eslint-disable-next-line no-param-reassign 3218 args = Array.prototype.slice.call(args); 3219 while (i) { 3220 i -= 1; 3221 list[i].apply(null, args); 3222 } 3223 }, 3224 resolve(...args) { 3225 this.execute(this.doneCallbacks, args); 3226 }, 3227 reject(...args) { 3228 this.execute(this.failCallbacks, args); 3229 }, 3230 done(callback) { 3231 this.doneCallbacks.push(callback); 3232 }, 3233 fail(callback) { 3234 this.failCallbacks.push(callback); 3235 } 3236}; 3237let YoutubeAPIadded = 0; 3238let loadingYoutubePlayer = 0; 3239const loadingYoutubeDefer = /*#__PURE__*/new Deferred(); 3240function loadAPI$1() { 3241 if (YoutubeAPIadded) { 3242 return; 3243 } 3244 YoutubeAPIadded = true; 3245 const src = 'https://www.youtube.com/iframe_api'; 3246 3247 // add script in head section 3248 let tag = document.createElement('script'); 3249 let head = document.getElementsByTagName('head')[0]; 3250 tag.src = src; 3251 head.appendChild(tag); 3252 head = null; 3253 tag = null; 3254} 3255function onAPIready$1(callback) { 3256 // Listen for global YT player callback 3257 if ((typeof global$1.YT === 'undefined' || global$1.YT.loaded === 0) && !loadingYoutubePlayer) { 3258 // Prevents Ready event from being called twice 3259 loadingYoutubePlayer = 1; 3260 3261 // Creates deferred so, other players know when to wait. 3262 global$1.onYouTubeIframeAPIReady = function () { 3263 global$1.onYouTubeIframeAPIReady = null; 3264 loadingYoutubeDefer.resolve('done'); 3265 callback(); 3266 }; 3267 } else if (typeof global$1.YT === 'object' && global$1.YT.loaded === 1) { 3268 callback(); 3269 } else { 3270 loadingYoutubeDefer.done(() => { 3271 callback(); 3272 }); 3273 } 3274} 3275class VideoWorkerYoutube extends VideoWorkerBase { 3276 type = 'youtube'; 3277 static parseURL(url) { 3278 // eslint-disable-next-line no-useless-escape 3279 const regExp = /.*(?:youtu.be\/|v\/|u\/\w\/|embed\/|shorts\/|watch\?v=)([^#\&\?]*).*/; 3280 const match = url.match(regExp); 3281 return match && match[1].length === 11 ? match[1] : false; 3282 } 3283 init() { 3284 super.init(); 3285 loadAPI$1(); 3286 } 3287 play(start) { 3288 const self = this; 3289 if (!self.player || !self.player.playVideo) { 3290 return; 3291 } 3292 if (typeof start !== 'undefined') { 3293 self.player.seekTo(start || 0); 3294 } 3295 if (global$1.YT.PlayerState.PLAYING !== self.player.getPlayerState()) { 3296 // Don't play if video is already ended and with no loop. 3297 if (self.options.endTime && !self.options.loop) { 3298 self.getCurrentTime(seconds => { 3299 if (seconds < self.options.endTime) { 3300 self.player.playVideo(); 3301 } 3302 }); 3303 } else { 3304 self.player.playVideo(); 3305 } 3306 } 3307 } 3308 pause() { 3309 const self = this; 3310 if (!self.player || !self.player.pauseVideo) { 3311 return; 3312 } 3313 if (global$1.YT.PlayerState.PLAYING === self.player.getPlayerState()) { 3314 self.player.pauseVideo(); 3315 } 3316 } 3317 mute() { 3318 const self = this; 3319 if (!self.player || !self.player.mute) { 3320 return; 3321 } 3322 self.player.mute(); 3323 } 3324 unmute() { 3325 const self = this; 3326 if (!self.player || !self.player.unMute) { 3327 return; 3328 } 3329 self.player.unMute(); 3330 } 3331 setVolume(volume = false) { 3332 const self = this; 3333 if (!self.player || typeof volume !== 'number' || !self.player.setVolume) { 3334 return; 3335 } 3336 self.player.setVolume(volume); 3337 } 3338 getVolume(callback) { 3339 const self = this; 3340 if (!self.player) { 3341 callback(false); 3342 return; 3343 } 3344 if (self.player.getVolume) { 3345 callback(self.player.getVolume()); 3346 } 3347 } 3348 getMuted(callback) { 3349 const self = this; 3350 if (!self.player) { 3351 callback(null); 3352 return; 3353 } 3354 if (self.player.isMuted) { 3355 callback(self.player.isMuted()); 3356 } 3357 } 3358 setCurrentTime(currentTime = false) { 3359 const self = this; 3360 if (!self.player || typeof currentTime !== 'number' || !self.player.seekTo) { 3361 return; 3362 } 3363 self.player.seekTo(currentTime); 3364 } 3365 getCurrentTime(callback) { 3366 const self = this; 3367 if (!self.player || !self.player.getCurrentTime) { 3368 return; 3369 } 3370 callback(self.player.getCurrentTime()); 3371 } 3372 getImageURL(callback) { 3373 const self = this; 3374 if (self.videoImage) { 3375 callback(self.videoImage); 3376 return; 3377 } 3378 const availableSizes = ['maxresdefault', 'sddefault', 'hqdefault', '0']; 3379 let step = 0; 3380 const tempImg = new Image(); 3381 tempImg.onload = function () { 3382 // if no thumbnail, youtube add their own image with width = 120px 3383 if ((this.naturalWidth || this.width) !== 120 || step === availableSizes.length - 1) { 3384 // ok 3385 self.videoImage = `https://img.youtube.com/vi/${self.videoID}/${availableSizes[step]}.jpg`; 3386 callback(self.videoImage); 3387 } else { 3388 // try another size 3389 step += 1; 3390 this.src = `https://img.youtube.com/vi/${self.videoID}/${availableSizes[step]}.jpg`; 3391 } 3392 }; 3393 tempImg.src = `https://img.youtube.com/vi/${self.videoID}/${availableSizes[step]}.jpg`; 3394 } 3395 getVideo(callback) { 3396 const self = this; 3397 3398 // return generated video block 3399 if (self.$video) { 3400 callback(self.$video); 3401 return; 3402 } 3403 3404 // generate new video block 3405 onAPIready$1(() => { 3406 let hiddenDiv; 3407 if (!self.$video) { 3408 hiddenDiv = document.createElement('div'); 3409 hiddenDiv.style.display = 'none'; 3410 } 3411 self.playerOptions = { 3412 // GDPR Compliance. 3413 host: 'https://www.youtube-nocookie.com', 3414 videoId: self.videoID, 3415 playerVars: { 3416 autohide: 1, 3417 rel: 0, 3418 autoplay: 0, 3419 // autoplay enable on mobile devices 3420 playsinline: 1 3421 } 3422 }; 3423 3424 // hide controls 3425 if (!self.options.showControls) { 3426 self.playerOptions.playerVars.iv_load_policy = 3; 3427 self.playerOptions.playerVars.modestbranding = 1; 3428 self.playerOptions.playerVars.controls = 0; 3429 self.playerOptions.playerVars.showinfo = 0; 3430 self.playerOptions.playerVars.disablekb = 1; 3431 } 3432 3433 // events 3434 let ytStarted; 3435 let ytProgressInterval; 3436 self.playerOptions.events = { 3437 onReady(e) { 3438 // mute 3439 if (self.options.mute) { 3440 e.target.mute(); 3441 } else if (typeof self.options.volume === 'number') { 3442 e.target.setVolume(self.options.volume); 3443 } 3444 3445 // autoplay 3446 if (self.options.autoplay) { 3447 self.play(self.options.startTime); 3448 } 3449 self.fire('ready', e); 3450 3451 // For seamless loops, set the endTime to 0.1 seconds less than the video's duration 3452 // https://github.com/nk-o/video-worker/issues/2 3453 if (self.options.loop && !self.options.endTime) { 3454 const secondsOffset = 0.1; 3455 self.options.endTime = self.player.getDuration() - secondsOffset; 3456 } 3457 3458 // volumechange 3459 setInterval(() => { 3460 self.getVolume(volume => { 3461 if (self.options.volume !== volume) { 3462 self.options.volume = volume; 3463 self.fire('volumechange', e); 3464 } 3465 }); 3466 }, 150); 3467 }, 3468 onStateChange(e) { 3469 // loop 3470 if (self.options.loop && e.data === global$1.YT.PlayerState.ENDED) { 3471 self.play(self.options.startTime); 3472 } 3473 if (!ytStarted && e.data === global$1.YT.PlayerState.PLAYING) { 3474 ytStarted = 1; 3475 self.fire('started', e); 3476 } 3477 if (e.data === global$1.YT.PlayerState.PLAYING) { 3478 self.fire('play', e); 3479 } 3480 if (e.data === global$1.YT.PlayerState.PAUSED) { 3481 self.fire('pause', e); 3482 } 3483 if (e.data === global$1.YT.PlayerState.ENDED) { 3484 self.fire('ended', e); 3485 } 3486 3487 // progress check 3488 if (e.data === global$1.YT.PlayerState.PLAYING) { 3489 ytProgressInterval = setInterval(() => { 3490 self.fire('timeupdate', e); 3491 3492 // check for end of video and play again or stop 3493 if (self.options.endTime && self.player.getCurrentTime() >= self.options.endTime) { 3494 if (self.options.loop) { 3495 self.play(self.options.startTime); 3496 } else { 3497 self.pause(); 3498 } 3499 } 3500 }, 150); 3501 } else { 3502 clearInterval(ytProgressInterval); 3503 } 3504 }, 3505 onError(e) { 3506 self.fire('error', e); 3507 } 3508 }; 3509 const firstInit = !self.$video; 3510 if (firstInit) { 3511 const div = document.createElement('div'); 3512 div.setAttribute('id', self.playerID); 3513 hiddenDiv.appendChild(div); 3514 document.body.appendChild(hiddenDiv); 3515 } 3516 self.player = self.player || new global$1.YT.Player(self.playerID, self.playerOptions); 3517 if (firstInit) { 3518 self.$video = document.getElementById(self.playerID); 3519 3520 // add accessibility attributes 3521 if (self.options.accessibilityHidden) { 3522 self.$video.setAttribute('tabindex', '-1'); 3523 self.$video.setAttribute('aria-hidden', 'true'); 3524 } 3525 3526 // get video width and height 3527 self.videoWidth = parseInt(self.$video.getAttribute('width'), 10) || 1280; 3528 self.videoHeight = parseInt(self.$video.getAttribute('height'), 10) || 720; 3529 } 3530 callback(self.$video); 3531 }); 3532 } 3533} 3534let VimeoAPIadded = 0; 3535let loadingVimeoPlayer = 0; 3536const loadingVimeoDefer = /*#__PURE__*/new Deferred(); 3537function loadAPI() { 3538 if (VimeoAPIadded) { 3539 return; 3540 } 3541 VimeoAPIadded = true; 3542 3543 // Useful when Vimeo API added using RequireJS https://github.com/nk-o/video-worker/pull/7 3544 if (typeof global$1.Vimeo !== 'undefined') { 3545 return; 3546 } 3547 const src = 'https://player.vimeo.com/api/player.js'; 3548 3549 // add script in head section 3550 let tag = document.createElement('script'); 3551 let head = document.getElementsByTagName('head')[0]; 3552 tag.src = src; 3553 head.appendChild(tag); 3554 head = null; 3555 tag = null; 3556} 3557function onAPIready(callback) { 3558 if (typeof global$1.Vimeo === 'undefined' && !loadingVimeoPlayer) { 3559 loadingVimeoPlayer = 1; 3560 const vimeoInterval = setInterval(() => { 3561 if (typeof global$1.Vimeo !== 'undefined') { 3562 clearInterval(vimeoInterval); 3563 loadingVimeoDefer.resolve('done'); 3564 callback(); 3565 } 3566 }, 20); 3567 } else if (typeof global$1.Vimeo !== 'undefined') { 3568 callback(); 3569 } else { 3570 loadingVimeoDefer.done(() => { 3571 callback(); 3572 }); 3573 } 3574} 3575class VideoWorkerVimeo extends VideoWorkerBase { 3576 type = 'vimeo'; 3577 static parseURL(url) { 3578 // eslint-disable-next-line no-useless-escape 3579 const regExp = /https?:\/\/(?:www\.|player\.)?vimeo.com\/(?:channels\/(?:\w+\/)?|groups\/([^/]*)\/videos\/|album\/(\d+)\/video\/|video\/|)(\d+)(?:$|\/|\?)/; 3580 const match = url.match(regExp); 3581 return match && match[3] ? match[3] : false; 3582 } 3583 3584 // Try to extract a hash for private videos from the URL. 3585 // Thanks to https://github.com/sampotts/plyr 3586 static parseURLHash(url) { 3587 /* This regex matches a hexadecimal hash if given in any of these forms: 3588 * - [https://player.]vimeo.com/video/{id}/{hash}[?params] 3589 * - [https://player.]vimeo.com/video/{id}?h={hash}[¶ms] 3590 * - [https://player.]vimeo.com/video/{id}?[params]&h={hash} 3591 * - video/{id}/{hash} 3592 * If matched, the hash is available in capture group 4 3593 */ 3594 const regex = /^.*(vimeo.com\/|video\/)(\d+)(\?.*&*h=|\/)+([\d,a-f]+)/; 3595 const found = url.match(regex); 3596 return found && found.length === 5 ? found[4] : null; 3597 } 3598 init() { 3599 super.init(); 3600 loadAPI(); 3601 } 3602 play(start) { 3603 const self = this; 3604 if (!self.player) { 3605 return; 3606 } 3607 if (typeof start !== 'undefined') { 3608 self.player.setCurrentTime(start); 3609 } 3610 self.player.getPaused().then(paused => { 3611 if (paused) { 3612 // Don't play if video is already ended and with no loop. 3613 if (self.options.endTime && !self.options.loop) { 3614 self.getCurrentTime(seconds => { 3615 if (seconds < self.options.endTime) { 3616 self.player.play(); 3617 } 3618 }); 3619 } else { 3620 self.player.play(); 3621 } 3622 } 3623 }); 3624 } 3625 pause() { 3626 const self = this; 3627 if (!self.player) { 3628 return; 3629 } 3630 self.player.getPaused().then(paused => { 3631 if (!paused) { 3632 self.player.pause(); 3633 } 3634 }); 3635 } 3636 mute() { 3637 const self = this; 3638 if (!self.player || !self.player.setVolume) { 3639 return; 3640 } 3641 self.setVolume(0); 3642 } 3643 unmute() { 3644 const self = this; 3645 if (!self.player || !self.player.setVolume) { 3646 return; 3647 } 3648 3649 // In case the default volume is 0, we have to set 100 when unmute. 3650 self.setVolume(self.options.volume || 100); 3651 } 3652 setVolume(volume = false) { 3653 const self = this; 3654 if (!self.player || typeof volume !== 'number' || !self.player.setVolume) { 3655 return; 3656 } 3657 self.player.setVolume(volume / 100); 3658 } 3659 getVolume(callback) { 3660 const self = this; 3661 if (!self.player) { 3662 callback(false); 3663 return; 3664 } 3665 if (self.player.getVolume) { 3666 self.player.getVolume().then(volume => { 3667 callback(volume * 100); 3668 }); 3669 } 3670 } 3671 getMuted(callback) { 3672 const self = this; 3673 if (!self.player) { 3674 callback(null); 3675 return; 3676 } 3677 if (self.player.getVolume) { 3678 self.player.getVolume().then(volume => { 3679 callback(!!volume); 3680 }); 3681 } 3682 } 3683 setCurrentTime(currentTime = false) { 3684 const self = this; 3685 if (!self.player || typeof currentTime !== 'number' || !self.player.setCurrentTime) { 3686 return; 3687 } 3688 self.player.setCurrentTime(currentTime); 3689 } 3690 getCurrentTime(callback) { 3691 const self = this; 3692 if (!self.player || !self.player.getCurrentTime) { 3693 return; 3694 } 3695 self.player.getCurrentTime().then(currentTime => { 3696 callback(currentTime); 3697 }); 3698 } 3699 getImageURL(callback) { 3700 const self = this; 3701 if (self.videoImage) { 3702 callback(self.videoImage); 3703 return; 3704 } 3705 3706 // We should provide width to get HQ thumbnail URL. 3707 let width = global$1.innerWidth || 1920; 3708 if (global$1.devicePixelRatio) { 3709 width *= global$1.devicePixelRatio; 3710 } 3711 width = Math.min(width, 1920); 3712 let request = new XMLHttpRequest(); 3713 // https://vimeo.com/api/oembed.json?url=https://vimeo.com/235212527 3714 request.open('GET', `https://vimeo.com/api/oembed.json?url=${self.url}&width=${width}`, true); 3715 request.onreadystatechange = function () { 3716 if (this.readyState === 4) { 3717 if (this.status >= 200 && this.status < 400) { 3718 // Success! 3719 const response = JSON.parse(this.responseText); 3720 if (response.thumbnail_url) { 3721 self.videoImage = response.thumbnail_url; 3722 callback(self.videoImage); 3723 } 3724 } 3725 } 3726 }; 3727 request.send(); 3728 request = null; 3729 } 3730 getVideo(callback) { 3731 const self = this; 3732 3733 // return generated video block 3734 if (self.$video) { 3735 callback(self.$video); 3736 return; 3737 } 3738 3739 // generate new video block 3740 onAPIready(() => { 3741 let hiddenDiv; 3742 if (!self.$video) { 3743 hiddenDiv = document.createElement('div'); 3744 hiddenDiv.style.display = 'none'; 3745 } 3746 self.playerOptions = { 3747 // GDPR Compliance. 3748 dnt: 1, 3749 id: self.videoID, 3750 autopause: 0, 3751 transparent: 0, 3752 autoplay: self.options.autoplay ? 1 : 0, 3753 loop: self.options.loop ? 1 : 0, 3754 muted: self.options.mute || self.options.volume === 0 ? 1 : 0 3755 }; 3756 3757 // private video hash 3758 const urlHash = self.constructor.parseURLHash(self.url); 3759 if (urlHash) { 3760 self.playerOptions.h = urlHash; 3761 } 3762 3763 // hide controls 3764 if (!self.options.showControls) { 3765 self.playerOptions.controls = 0; 3766 } 3767 3768 // enable background option 3769 if (!self.options.showControls && self.options.loop && self.options.autoplay) { 3770 self.playerOptions.background = 1; 3771 } 3772 if (!self.$video) { 3773 let playerOptionsString = ''; 3774 Object.keys(self.playerOptions).forEach(key => { 3775 if (playerOptionsString !== '') { 3776 playerOptionsString += '&'; 3777 } 3778 playerOptionsString += `${key}=${encodeURIComponent(self.playerOptions[key])}`; 3779 }); 3780 3781 // we need to create iframe manually because when we create it using API 3782 // js events won't triggers after iframe moved to another place 3783 self.$video = document.createElement('iframe'); 3784 self.$video.setAttribute('id', self.playerID); 3785 self.$video.setAttribute('src', `https://player.vimeo.com/video/${self.videoID}?${playerOptionsString}`); 3786 self.$video.setAttribute('frameborder', '0'); 3787 self.$video.setAttribute('mozallowfullscreen', ''); 3788 self.$video.setAttribute('allowfullscreen', ''); 3789 self.$video.setAttribute('title', 'Vimeo video player'); 3790 3791 // add accessibility attributes 3792 if (self.options.accessibilityHidden) { 3793 self.$video.setAttribute('tabindex', '-1'); 3794 self.$video.setAttribute('aria-hidden', 'true'); 3795 } 3796 hiddenDiv.appendChild(self.$video); 3797 document.body.appendChild(hiddenDiv); 3798 } 3799 self.player = self.player || new global$1.Vimeo.Player(self.$video, self.playerOptions); 3800 3801 // Since Vimeo removed the `volume` parameter, we have to set it manually. 3802 if (!self.options.mute && typeof self.options.volume === 'number') { 3803 self.setVolume(self.options.volume); 3804 } 3805 3806 // set current time for autoplay 3807 if (self.options.startTime && self.options.autoplay) { 3808 self.player.setCurrentTime(self.options.startTime); 3809 } 3810 3811 // get video width and height 3812 self.player.getVideoWidth().then(width => { 3813 self.videoWidth = width || 1280; 3814 }); 3815 self.player.getVideoHeight().then(height => { 3816 self.videoHeight = height || 720; 3817 }); 3818 3819 // events 3820 let vmStarted; 3821 self.player.on('timeupdate', e => { 3822 if (!vmStarted) { 3823 self.fire('started', e); 3824 vmStarted = 1; 3825 } 3826 self.fire('timeupdate', e); 3827 3828 // check for end of video and play again or stop 3829 if (self.options.endTime && e.seconds >= self.options.endTime) { 3830 if (self.options.loop) { 3831 self.play(self.options.startTime); 3832 } else { 3833 self.pause(); 3834 } 3835 } 3836 }); 3837 self.player.on('play', e => { 3838 self.fire('play', e); 3839 3840 // check for the start time and start with it 3841 if (self.options.startTime && e.seconds === 0) { 3842 self.play(self.options.startTime); 3843 } 3844 }); 3845 self.player.on('pause', e => { 3846 self.fire('pause', e); 3847 }); 3848 self.player.on('ended', e => { 3849 self.fire('ended', e); 3850 }); 3851 self.player.on('loaded', e => { 3852 self.fire('ready', e); 3853 }); 3854 self.player.on('volumechange', e => { 3855 self.getVolume(volume => { 3856 self.options.volume = volume; 3857 }); 3858 self.fire('volumechange', e); 3859 }); 3860 self.player.on('error', e => { 3861 self.fire('error', e); 3862 }); 3863 callback(self.$video); 3864 }); 3865 } 3866} 3867class VideoWorkerLocal extends VideoWorkerBase { 3868 type = 'local'; 3869 static parseURL(url) { 3870 // eslint-disable-next-line no-useless-escape 3871 const videoFormats = url.split(/,(?=mp4\:|webm\:|ogv\:|ogg\:)/); 3872 const result = {}; 3873 let ready = 0; 3874 videoFormats.forEach(val => { 3875 // eslint-disable-next-line no-useless-escape 3876 const match = val.match(/^(mp4|webm|ogv|ogg)\:(.*)/); 3877 if (match && match[1] && match[2]) { 3878 // eslint-disable-next-line prefer-destructuring 3879 result[match[1] === 'ogv' ? 'ogg' : match[1]] = match[2]; 3880 ready = 1; 3881 } 3882 }); 3883 return ready ? result : false; 3884 } 3885 play(start) { 3886 const self = this; 3887 if (!self.player) { 3888 return; 3889 } 3890 if (typeof start !== 'undefined') { 3891 self.player.currentTime = start; 3892 } 3893 if (self.player.paused) { 3894 // Don't play if video is already ended and with no loop. 3895 if (self.options.endTime && !self.options.loop) { 3896 self.getCurrentTime(seconds => { 3897 if (seconds < self.options.endTime) { 3898 self.player.play(); 3899 } 3900 }); 3901 } else { 3902 self.player.play(); 3903 } 3904 } 3905 } 3906 pause() { 3907 const self = this; 3908 if (!self.player || self.player.paused) { 3909 return; 3910 } 3911 self.player.pause(); 3912 } 3913 mute() { 3914 const self = this; 3915 if (!self.player) { 3916 return; 3917 } 3918 self.$video.muted = true; 3919 } 3920 unmute() { 3921 const self = this; 3922 if (!self.player) { 3923 return; 3924 } 3925 self.$video.muted = false; 3926 } 3927 setVolume(volume = false) { 3928 const self = this; 3929 if (!self.player || typeof volume !== 'number') { 3930 return; 3931 } 3932 self.$video.volume = volume / 100; 3933 } 3934 getVolume(callback) { 3935 const self = this; 3936 if (!self.player) { 3937 callback(false); 3938 return; 3939 } 3940 callback(self.$video.volume * 100); 3941 } 3942 getMuted(callback) { 3943 const self = this; 3944 if (!self.player) { 3945 callback(null); 3946 return; 3947 } 3948 callback(self.$video.muted); 3949 } 3950 setCurrentTime(currentTime = false) { 3951 const self = this; 3952 if (!self.player || typeof currentTime !== 'number') { 3953 return; 3954 } 3955 self.$video.currentTime = currentTime; 3956 } 3957 getCurrentTime(callback) { 3958 const self = this; 3959 if (!self.player) { 3960 return; 3961 } 3962 callback(self.player.currentTime); 3963 } 3964 getImageURL(callback) { 3965 const self = this; 3966 if (self.videoImage) { 3967 callback(self.videoImage); 3968 } 3969 } 3970 getVideo(callback) { 3971 const self = this; 3972 3973 // return generated video block 3974 if (self.$video) { 3975 callback(self.$video); 3976 return; 3977 } 3978 3979 // generate new video block 3980 let hiddenDiv; 3981 if (!self.$video) { 3982 hiddenDiv = document.createElement('div'); 3983 hiddenDiv.style.display = 'none'; 3984 } 3985 function addSourceElement(element, src, type) { 3986 const source = document.createElement('source'); 3987 source.src = src; 3988 source.type = type; 3989 element.appendChild(source); 3990 } 3991 if (!self.$video) { 3992 self.$video = document.createElement('video'); 3993 self.player = self.$video; 3994 3995 // show controls 3996 if (self.options.showControls) { 3997 self.$video.controls = true; 3998 } 3999 4000 // set volume 4001 if (typeof self.options.volume === 'number') { 4002 self.setVolume(self.options.volume); 4003 } 4004 4005 // mute (it is required to mute after the volume set) 4006 if (self.options.mute) { 4007 self.mute(); 4008 } 4009 4010 // loop 4011 if (self.options.loop) { 4012 self.$video.loop = true; 4013 } 4014 4015 // autoplay enable on mobile devices 4016 self.$video.setAttribute('playsinline', ''); 4017 self.$video.setAttribute('webkit-playsinline', ''); 4018 4019 // add accessibility attributes 4020 if (self.options.accessibilityHidden) { 4021 self.$video.setAttribute('tabindex', '-1'); 4022 self.$video.setAttribute('aria-hidden', 'true'); 4023 } 4024 self.$video.setAttribute('id', self.playerID); 4025 hiddenDiv.appendChild(self.$video); 4026 document.body.appendChild(hiddenDiv); 4027 Object.keys(self.videoID).forEach(key => { 4028 addSourceElement(self.$video, self.videoID[key], `video/${key}`); 4029 }); 4030 } 4031 let locStarted; 4032 self.player.addEventListener('playing', e => { 4033 if (!locStarted) { 4034 self.fire('started', e); 4035 } 4036 locStarted = 1; 4037 }); 4038 self.player.addEventListener('timeupdate', function (e) { 4039 self.fire('timeupdate', e); 4040 4041 // check for end of video and play again or stop 4042 if (self.options.endTime && this.currentTime >= self.options.endTime) { 4043 if (self.options.loop) { 4044 self.play(self.options.startTime); 4045 } else { 4046 self.pause(); 4047 } 4048 } 4049 }); 4050 self.player.addEventListener('play', e => { 4051 self.fire('play', e); 4052 }); 4053 self.player.addEventListener('pause', e => { 4054 self.fire('pause', e); 4055 }); 4056 self.player.addEventListener('ended', e => { 4057 self.fire('ended', e); 4058 }); 4059 self.player.addEventListener('loadedmetadata', function () { 4060 // get video width and height 4061 self.videoWidth = this.videoWidth || 1280; 4062 self.videoHeight = this.videoHeight || 720; 4063 self.fire('ready'); 4064 4065 // autoplay 4066 if (self.options.autoplay) { 4067 self.play(self.options.startTime); 4068 } 4069 }); 4070 self.player.addEventListener('volumechange', e => { 4071 self.getVolume(volume => { 4072 self.options.volume = volume; 4073 }); 4074 self.fire('volumechange', e); 4075 }); 4076 self.player.addEventListener('error', e => { 4077 self.fire('error', e); 4078 }); 4079 callback(self.$video); 4080 } 4081} 4082function VideoWorker(url, options) { 4083 let result = false; 4084 Object.keys(VideoWorker.providers).forEach(key => { 4085 if (!result && VideoWorker.providers[key].parseURL(url)) { 4086 result = new VideoWorker.providers[key](url, options); 4087 } 4088 }); 4089 return result || new VideoWorkerBase(url, options); 4090} 4091VideoWorker.BaseClass = VideoWorkerBase; 4092VideoWorker.providers = { 4093 Youtube: VideoWorkerYoutube, 4094 Vimeo: VideoWorkerVimeo, 4095 Local: VideoWorkerLocal 4096}; 4097 4098function jarallaxVideo$1(jarallax = global$2.jarallax) { 4099 if (typeof jarallax === 'undefined') { 4100 return; 4101 } 4102 const Jarallax = jarallax.constructor; 4103 4104 // append video after when block will be visible. 4105 const defOnScroll = Jarallax.prototype.onScroll; 4106 Jarallax.prototype.onScroll = function () { 4107 const self = this; 4108 defOnScroll.apply(self); 4109 const isReady = !self.isVideoInserted && self.video && (!self.options.videoLazyLoading || self.isElementInViewport) && !self.options.disableVideo(); 4110 if (isReady) { 4111 self.isVideoInserted = true; 4112 self.video.getVideo(video => { 4113 const $parent = video.parentNode; 4114 self.css(video, { 4115 position: self.image.position, 4116 top: '0px', 4117 left: '0px', 4118 right: '0px', 4119 bottom: '0px', 4120 width: '100%', 4121 height: '100%', 4122 maxWidth: 'none', 4123 maxHeight: 'none', 4124 pointerEvents: 'none', 4125 transformStyle: 'preserve-3d', 4126 backfaceVisibility: 'hidden', 4127 margin: 0, 4128 zIndex: -1 4129 }); 4130 self.$video = video; 4131 4132 // add Poster attribute to self-hosted video 4133 if (self.video.type === 'local') { 4134 if (self.image.src) { 4135 self.$video.setAttribute('poster', self.image.src); 4136 } else if (self.image.$item && self.image.$item.tagName === 'IMG' && self.image.$item.src) { 4137 self.$video.setAttribute('poster', self.image.$item.src); 4138 } 4139 } 4140 4141 // add classname to video element 4142 if (self.options.videoClass) { 4143 self.$video.setAttribute('class', `${self.options.videoClass} ${self.options.videoClass}-${self.video.type}`); 4144 } 4145 4146 // insert video tag 4147 self.image.$container.appendChild(video); 4148 4149 // remove parent video element (created by VideoWorker) 4150 $parent.parentNode.removeChild($parent); 4151 4152 // call onVideoInsert event 4153 if (self.options.onVideoInsert) { 4154 self.options.onVideoInsert.call(self); 4155 } 4156 }); 4157 } 4158 }; 4159 4160 // cover video 4161 const defCoverImage = Jarallax.prototype.coverImage; 4162 Jarallax.prototype.coverImage = function () { 4163 const self = this; 4164 const imageData = defCoverImage.apply(self); 4165 const node = self.image.$item ? self.image.$item.nodeName : false; 4166 if (imageData && self.video && node && (node === 'IFRAME' || node === 'VIDEO')) { 4167 let h = imageData.image.height; 4168 let w = h * self.image.width / self.image.height; 4169 let ml = (imageData.container.width - w) / 2; 4170 let mt = imageData.image.marginTop; 4171 if (imageData.container.width > w) { 4172 w = imageData.container.width; 4173 h = w * self.image.height / self.image.width; 4174 ml = 0; 4175 mt += (imageData.image.height - h) / 2; 4176 } 4177 4178 // add video height over than need to hide controls 4179 if (node === 'IFRAME') { 4180 h += 400; 4181 mt -= 200; 4182 } 4183 self.css(self.$video, { 4184 width: `${w}px`, 4185 marginLeft: `${ml}px`, 4186 height: `${h}px`, 4187 marginTop: `${mt}px` 4188 }); 4189 } 4190 return imageData; 4191 }; 4192 4193 // init video 4194 const defInitImg = Jarallax.prototype.initImg; 4195 Jarallax.prototype.initImg = function () { 4196 const self = this; 4197 const defaultResult = defInitImg.apply(self); 4198 if (!self.options.videoSrc) { 4199 self.options.videoSrc = self.$item.getAttribute('data-jarallax-video') || null; 4200 } 4201 if (self.options.videoSrc) { 4202 self.defaultInitImgResult = defaultResult; 4203 return true; 4204 } 4205 return defaultResult; 4206 }; 4207 const defCanInitParallax = Jarallax.prototype.canInitParallax; 4208 Jarallax.prototype.canInitParallax = function () { 4209 const self = this; 4210 let defaultResult = defCanInitParallax.apply(self); 4211 if (!self.options.videoSrc) { 4212 return defaultResult; 4213 } 4214 4215 // Init video api 4216 const video = new VideoWorker(self.options.videoSrc, { 4217 autoplay: true, 4218 loop: self.options.videoLoop, 4219 showControls: false, 4220 accessibilityHidden: true, 4221 startTime: self.options.videoStartTime || 0, 4222 endTime: self.options.videoEndTime || 0, 4223 mute: !self.options.videoVolume, 4224 volume: self.options.videoVolume || 0 4225 }); 4226 4227 // call onVideoWorkerInit event 4228 if (self.options.onVideoWorkerInit) { 4229 self.options.onVideoWorkerInit.call(self, video); 4230 } 4231 function resetDefaultImage() { 4232 if (self.image.$default_item) { 4233 self.image.$item = self.image.$default_item; 4234 self.image.$item.style.display = 'block'; 4235 4236 // set image width and height 4237 self.coverImage(); 4238 self.onScroll(); 4239 } 4240 } 4241 if (video.isValid()) { 4242 // Force enable parallax. 4243 // When the parallax disabled on mobile devices, we still need to display videos. 4244 // https://github.com/nk-o/jarallax/issues/159 4245 if (this.options.disableParallax()) { 4246 defaultResult = true; 4247 self.image.position = 'absolute'; 4248 self.options.type = 'scroll'; 4249 self.options.speed = 1; 4250 } 4251 4252 // if parallax will not be inited, we can add thumbnail on background. 4253 if (!defaultResult) { 4254 if (!self.defaultInitImgResult) { 4255 video.getImageURL(url => { 4256 // save default user styles 4257 const curStyle = self.$item.getAttribute('style'); 4258 if (curStyle) { 4259 self.$item.setAttribute('data-jarallax-original-styles', curStyle); 4260 } 4261 4262 // set new background 4263 self.css(self.$item, { 4264 'background-image': `url("${url}")`, 4265 'background-position': 'center', 4266 'background-size': 'cover' 4267 }); 4268 }); 4269 } 4270 4271 // init video 4272 } else { 4273 video.on('ready', () => { 4274 if (self.options.videoPlayOnlyVisible) { 4275 const oldOnScroll = self.onScroll; 4276 self.onScroll = function () { 4277 oldOnScroll.apply(self); 4278 if (!self.videoError && (self.options.videoLoop || !self.options.videoLoop && !self.videoEnded)) { 4279 if (self.isVisible()) { 4280 video.play(); 4281 } else { 4282 video.pause(); 4283 } 4284 } 4285 }; 4286 } else { 4287 video.play(); 4288 } 4289 }); 4290 video.on('started', () => { 4291 self.image.$default_item = self.image.$item; 4292 self.image.$item = self.$video; 4293 4294 // set video width and height 4295 self.image.width = self.video.videoWidth || 1280; 4296 self.image.height = self.video.videoHeight || 720; 4297 self.coverImage(); 4298 self.onScroll(); 4299 4300 // hide image 4301 if (self.image.$default_item) { 4302 self.image.$default_item.style.display = 'none'; 4303 } 4304 }); 4305 video.on('ended', () => { 4306 self.videoEnded = true; 4307 if (!self.options.videoLoop) { 4308 // show default image if Loop disabled. 4309 resetDefaultImage(); 4310 } 4311 }); 4312 video.on('error', () => { 4313 self.videoError = true; 4314 4315 // show default image if video loading error. 4316 resetDefaultImage(); 4317 }); 4318 self.video = video; 4319 4320 // set image if not exists 4321 if (!self.defaultInitImgResult) { 4322 // set empty image on self-hosted video if not defined 4323 self.image.src = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7'; 4324 if (video.type !== 'local') { 4325 video.getImageURL(url => { 4326 self.image.bgImage = `url("${url}")`; 4327 self.init(); 4328 }); 4329 return false; 4330 } 4331 } 4332 } 4333 } 4334 return defaultResult; 4335 }; 4336 4337 // Destroy video parallax 4338 const defDestroy = Jarallax.prototype.destroy; 4339 Jarallax.prototype.destroy = function () { 4340 const self = this; 4341 if (self.image.$default_item) { 4342 self.image.$item = self.image.$default_item; 4343 delete self.image.$default_item; 4344 } 4345 defDestroy.apply(self); 4346 }; 4347} 4348 4349function jarallaxElement$1(jarallax = global$2.jarallax) { 4350 // eslint-disable-next-line no-console 4351 console.warn("Jarallax Element extension is DEPRECATED, please, avoid using it. We recommend you look at something like `lax.js` library <https://github.com/alexfoxy/lax.js>. It is much more powerful and has a less code (in cases when you don't want to add parallax backgrounds)."); 4352 if (typeof jarallax === 'undefined') { 4353 return; 4354 } 4355 const Jarallax = jarallax.constructor; 4356 4357 // redefine default methods 4358 ['initImg', 'canInitParallax', 'init', 'destroy', 'coverImage', 'isVisible', 'onScroll', 'onResize'].forEach(key => { 4359 const def = Jarallax.prototype[key]; 4360 Jarallax.prototype[key] = function (...args) { 4361 const self = this; 4362 if (key === 'initImg' && self.$item.getAttribute('data-jarallax-element') !== null) { 4363 self.options.type = 'element'; 4364 self.pureOptions.speed = self.$item.getAttribute('data-jarallax-element') || '100'; 4365 } 4366 if (self.options.type !== 'element') { 4367 return def.apply(self, args); 4368 } 4369 self.pureOptions.threshold = self.$item.getAttribute('data-threshold') || ''; 4370 switch (key) { 4371 case 'init': 4372 { 4373 const speedArr = `${self.pureOptions.speed}`.split(' '); 4374 self.options.speed = self.pureOptions.speed || 0; 4375 self.options.speedY = speedArr[0] ? parseFloat(speedArr[0]) : 0; 4376 self.options.speedX = speedArr[1] ? parseFloat(speedArr[1]) : 0; 4377 const thresholdArr = self.pureOptions.threshold.split(' '); 4378 self.options.thresholdY = thresholdArr[0] ? parseFloat(thresholdArr[0]) : null; 4379 self.options.thresholdX = thresholdArr[1] ? parseFloat(thresholdArr[1]) : null; 4380 def.apply(self, args); 4381 4382 // restore background image if available. 4383 const originalStylesTag = self.$item.getAttribute('data-jarallax-original-styles'); 4384 if (originalStylesTag) { 4385 self.$item.setAttribute('style', originalStylesTag); 4386 } 4387 return true; 4388 } 4389 case 'onResize': 4390 { 4391 const defTransform = self.css(self.$item, 'transform'); 4392 self.css(self.$item, { 4393 transform: '' 4394 }); 4395 const rect = self.$item.getBoundingClientRect(); 4396 self.itemData = { 4397 width: rect.width, 4398 height: rect.height, 4399 y: rect.top + self.getWindowData().y, 4400 x: rect.left 4401 }; 4402 self.css(self.$item, { 4403 transform: defTransform 4404 }); 4405 break; 4406 } 4407 case 'onScroll': 4408 { 4409 const wnd = self.getWindowData(); 4410 const centerPercent = (wnd.y + wnd.height / 2 - self.itemData.y - self.itemData.height / 2) / (wnd.height / 2); 4411 const moveY = centerPercent * self.options.speedY; 4412 const moveX = centerPercent * self.options.speedX; 4413 let my = moveY; 4414 let mx = moveX; 4415 if (self.options.thresholdY !== null && moveY > self.options.thresholdY) my = 0; 4416 if (self.options.thresholdX !== null && moveX > self.options.thresholdX) mx = 0; 4417 self.css(self.$item, { 4418 transform: `translate3d(${mx}px,${my}px,0)` 4419 }); 4420 break; 4421 } 4422 case 'initImg': 4423 case 'isVisible': 4424 case 'coverImage': 4425 return true; 4426 // no default 4427 } 4428 return def.apply(self, args); 4429 }; 4430 }); 4431} 4432 4433const jarallax = jarallax$1; 4434const jarallaxVideo = function jarallaxVideo() { 4435 return jarallaxVideo$1(jarallax); 4436}; 4437const jarallaxElement = function jarallaxElement() { 4438 return jarallaxElement$1(jarallax); 4439}; 4440 4441 4442//# sourceMappingURL=jarallax.esm.js.map 4443 4444 4445/***/ }), 4446
4447/***/ "./src/styles/main.scss": 4448/*!******************************!*\ 4449 !*** ./src/styles/main.scss ***! 4450 \******************************/ 4451/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 4452 4453"use strict"; 4454__webpack_require__.r(__webpack_exports__); 4455// extracted by mini-css-extract-plugin 4456 4457 4458/***/ }), 4459
vendor: 5,636 bytes, lines 4460-4653
4460/***/ "./node_modules/process/browser.js": 4461/*!*****************************************!*\ 4462 !*** ./node_modules/process/browser.js ***! 4463 \*****************************************/ 4464/***/ ((module) => { 4465 4466// shim for using process in browser 4467var process = module.exports = {}; 4468 4469// cached from whatever global is present so that test runners that stub it 4470// don't break things. But we need to wrap it in a try catch in case it is 4471// wrapped in strict mode code which doesn't define any globals. It's inside a 4472// function because try/catches deoptimize in certain engines. 4473 4474var cachedSetTimeout; 4475var cachedClearTimeout; 4476 4477function defaultSetTimout() { 4478 throw new Error('setTimeout has not been defined'); 4479} 4480function defaultClearTimeout () { 4481 throw new Error('clearTimeout has not been defined'); 4482} 4483(function () { 4484 try { 4485 if (typeof setTimeout === 'function') { 4486 cachedSetTimeout = setTimeout; 4487 } else { 4488 cachedSetTimeout = defaultSetTimout; 4489 } 4490 } catch (e) { 4491 cachedSetTimeout = defaultSetTimout; 4492 } 4493 try { 4494 if (typeof clearTimeout === 'function') { 4495 cachedClearTimeout = clearTimeout; 4496 } else { 4497 cachedClearTimeout = defaultClearTimeout; 4498 } 4499 } catch (e) { 4500 cachedClearTimeout = defaultClearTimeout; 4501 } 4502} ()) 4503function runTimeout(fun) { 4504 if (cachedSetTimeout === setTimeout) { 4505 //normal enviroments in sane situations 4506 return setTimeout(fun, 0); 4507 } 4508 // if setTimeout wasn't available but was latter defined 4509 if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { 4510 cachedSetTimeout = setTimeout; 4511 return setTimeout(fun, 0); 4512 } 4513 try { 4514 // when when somebody has screwed with setTimeout but no I.E. maddness 4515 return cachedSetTimeout(fun, 0); 4516 } catch(e){ 4517 try { 4518 // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally 4519 return cachedSetTimeout.call(null, fun, 0); 4520 } catch(e){ 4521 // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error 4522 return cachedSetTimeout.call(this, fun, 0); 4523 } 4524 } 4525 4526 4527} 4528function runClearTimeout(marker) { 4529 if (cachedClearTimeout === clearTimeout) { 4530 //normal enviroments in sane situations 4531 return clearTimeout(marker); 4532 } 4533 // if clearTimeout wasn't available but was latter defined 4534 if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { 4535 cachedClearTimeout = clearTimeout; 4536 return clearTimeout(marker); 4537 } 4538 try { 4539 // when when somebody has screwed with setTimeout but no I.E. maddness 4540 return cachedClearTimeout(marker); 4541 } catch (e){ 4542 try { 4543 // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally 4544 return cachedClearTimeout.call(null, marker); 4545 } catch (e){ 4546 // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. 4547 // Some versions of I.E. have different rules for clearTimeout vs setTimeout 4548 return cachedClearTimeout.call(this, marker); 4549 } 4550 } 4551 4552 4553 4554} 4555var queue = []; 4556var draining = false; 4557var currentQueue; 4558var queueIndex = -1; 4559 4560function cleanUpNextTick() { 4561 if (!draining || !currentQueue) { 4562 return; 4563 } 4564 draining = false; 4565 if (currentQueue.length) { 4566 queue = currentQueue.concat(queue); 4567 } else { 4568 queueIndex = -1; 4569 } 4570 if (queue.length) { 4571 drainQueue(); 4572 } 4573} 4574 4575function drainQueue() { 4576 if (draining) { 4577 return; 4578 } 4579 var timeout = runTimeout(cleanUpNextTick); 4580 draining = true; 4581 4582 var len = queue.length; 4583 while(len) { 4584 currentQueue = queue; 4585 queue = []; 4586 while (++queueIndex < len) { 4587 if (currentQueue) { 4588 currentQueue[queueIndex].run(); 4589 } 4590 } 4591 queueIndex = -1; 4592 len = queue.length; 4593 } 4594 currentQueue = null; 4595 draining = false; 4596 runClearTimeout(timeout); 4597} 4598 4599process.nextTick = function (fun) { 4600 var args = new Array(arguments.length - 1); 4601 if (arguments.length > 1) { 4602 for (var i = 1; i < arguments.length; i++) { 4603 args[i - 1] = arguments[i]; 4604 } 4605 } 4606 queue.push(new Item(fun, args)); 4607 if (queue.length === 1 && !draining) { 4608 runTimeout(drainQueue); 4609 } 4610}; 4611 4612// v8 likes predictible objects 4613function Item(fun, array) { 4614 this.fun = fun; 4615 this.array = array; 4616} 4617Item.prototype.run = function () { 4618 this.fun.apply(null, this.array); 4619}; 4620process.title = 'browser'; 4621process.browser = true; 4622process.env = {}; 4623process.argv = []; 4624process.version = ''; // empty string to avoid regexp issues 4625process.versions = {}; 4626 4627function noop() {} 4628 4629process.on = noop; 4630process.addListener = noop; 4631process.once = noop; 4632process.off = noop; 4633process.removeListener = noop; 4634process.removeAllListeners = noop; 4635process.emit = noop; 4636process.prependListener = noop; 4637process.prependOnceListener = noop; 4638 4639process.listeners = function (name) { return [] } 4640 4641process.binding = function (name) { 4642 throw new Error('process.binding is not supported'); 4643}; 4644 4645process.cwd = function () { return '/' }; 4646process.chdir = function (dir) { 4647 throw new Error('process.chdir is not supported'); 4648}; 4649process.umask = function() { return 0; }; 4650 4651 4652/***/ }), 4653
vendor: 102,519 bytes, lines 4654-8335
4654/***/ "./node_modules/tiny-slider/dist/tiny-slider.js": 4655/*!******************************************************!*\ 4656 !*** ./node_modules/tiny-slider/dist/tiny-slider.js ***! 4657 \******************************************************/ 4658/***/ ((__unused_webpack_module, exports) => { 4659 4660"use strict"; 4661 4662 4663Object.defineProperty(exports, "__esModule", ({ value: true })); 4664 4665var win$1 = window; 4666var raf = win$1.requestAnimationFrame || win$1.webkitRequestAnimationFrame || win$1.mozRequestAnimationFrame || win$1.msRequestAnimationFrame || function (cb) { 4667 return setTimeout(cb, 16); 4668}; 4669 4670var win = window; 4671var caf = win.cancelAnimationFrame || win.mozCancelAnimationFrame || function (id) { 4672 clearTimeout(id); 4673}; 4674 4675function extend() { 4676 var obj, 4677 name, 4678 copy, 4679 target = arguments[0] || {}, 4680 i = 1, 4681 length = arguments.length; 4682 4683 for (; i < length; i++) { 4684 if ((obj = arguments[i]) !== null) { 4685 for (name in obj) { 4686 copy = obj[name]; 4687 4688 if (target === copy) { 4689 continue; 4690 } else if (copy !== undefined) { 4691 target[name] = copy; 4692 } 4693 } 4694 } 4695 } 4696 4697 return target; 4698} 4699 4700function checkStorageValue(value) { 4701 return ['true', 'false'].indexOf(value) >= 0 ? JSON.parse(value) : value; 4702} 4703 4704function setLocalStorage(storage, key, value, access) { 4705 if (access) { 4706 try { 4707 storage.setItem(key, value); 4708 } catch (e) {} 4709 } 4710 4711 return value; 4712} 4713 4714function getSlideId() { 4715 var id = window.tnsId; 4716 window.tnsId = !id ? 1 : id + 1; 4717 return 'tns' + window.tnsId; 4718} 4719 4720function getBody() { 4721 var doc = document, 4722 body = doc.body; 4723 4724 if (!body) { 4725 body = doc.createElement('body'); 4726 body.fake = true; 4727 } 4728 4729 return body; 4730} 4731 4732var docElement = document.documentElement; 4733 4734function setFakeBody(body) { 4735 var docOverflow = ''; 4736 4737 if (body.fake) { 4738 docOverflow = docElement.style.overflow; //avoid crashing IE8, if background image is used 4739 4740 body.style.background = ''; //Safari 5.13/5.1.4 OSX stops loading if ::-webkit-scrollbar is used and scrollbars are visible 4741 4742 body.style.overflow = docElement.style.overflow = 'hidden'; 4743 docElement.appendChild(body); 4744 } 4745 4746 return docOverflow; 4747} 4748 4749function resetFakeBody(body, docOverflow) { 4750 if (body.fake) { 4751 body.remove(); 4752 docElement.style.overflow = docOverflow; // Trigger layout so kinetic scrolling isn't disabled in iOS6+ 4753 // eslint-disable-next-line 4754 4755 docElement.offsetHeight; 4756 } 4757} 4758 4759// get css-calc 4760function calc() { 4761 var doc = document, 4762 body = getBody(), 4763 docOverflow = setFakeBody(body), 4764 div = doc.createElement('div'), 4765 result = false; 4766 body.appendChild(div); 4767 4768 try { 4769 var str = '(10px * 10)', 4770 vals = ['calc' + str, '-moz-calc' + str, '-webkit-calc' + str], 4771 val; 4772 4773 for (var i = 0; i < 3; i++) { 4774 val = vals[i]; 4775 div.style.width = val; 4776 4777 if (div.offsetWidth === 100) { 4778 result = val.replace(str, ''); 4779 break; 4780 } 4781 } 4782 } catch (e) {} 4783 4784 body.fake ? resetFakeBody(body, docOverflow) : div.remove(); 4785 return result; 4786} 4787 4788// get subpixel support value 4789function percentageLayout() { 4790 // check subpixel layout supporting 4791 var doc = document, 4792 body = getBody(), 4793 docOverflow = setFakeBody(body), 4794 wrapper = doc.createElement('div'), 4795 outer = doc.createElement('div'), 4796 str = '', 4797 count = 70, 4798 perPage = 3, 4799 supported = false; 4800 wrapper.className = "tns-t-subp2"; 4801 outer.className = "tns-t-ct"; 4802 4803 for (var i = 0; i < count; i++) { 4804 str += '<div></div>'; 4805 } 4806 4807 outer.innerHTML = str; 4808 wrapper.appendChild(outer); 4809 body.appendChild(wrapper); 4810 supported = Math.abs(wrapper.getBoundingClientRect().left - outer.children[count - perPage].getBoundingClientRect().left) < 2; 4811 body.fake ? resetFakeBody(body, docOverflow) : wrapper.remove(); 4812 return supported; 4813} 4814 4815function mediaquerySupport() { 4816 if (window.matchMedia || window.msMatchMedia) { 4817 return true; 4818 } 4819 4820 var doc = document, 4821 body = getBody(), 4822 docOverflow = setFakeBody(body), 4823 div = doc.createElement('div'), 4824 style = doc.createElement('style'), 4825 rule = '@media all and (min-width:1px){.tns-mq-test{position:absolute}}', 4826 position; 4827 style.type = 'text/css'; 4828 div.className = 'tns-mq-test'; 4829 body.appendChild(style); 4830 body.appendChild(div); 4831 4832 if (style.styleSheet) { 4833 style.styleSheet.cssText = rule; 4834 } else { 4835 style.appendChild(doc.createTextNode(rule)); 4836 } 4837 4838 position = window.getComputedStyle ? window.getComputedStyle(div).position : div.currentStyle['position']; 4839 body.fake ? resetFakeBody(body, docOverflow) : div.remove(); 4840 return position === "absolute"; 4841} 4842 4843// create and append style sheet 4844function createStyleSheet(media, nonce) { 4845 // Create the <style> tag 4846 var style = document.createElement("style"); // style.setAttribute("type", "text/css"); 4847 // Add a media (and/or media query) here if you'd like! 4848 // style.setAttribute("media", "screen") 4849 // style.setAttribute("media", "only screen and (max-width : 1024px)") 4850 4851 if (media) { 4852 style.setAttribute("media", media); 4853 } // Add nonce attribute for Content Security Policy 4854 4855 4856 if (nonce) { 4857 style.setAttribute("nonce", nonce); 4858 } // WebKit hack :( 4859 // style.appendChild(document.createTextNode("")); 4860 // Add the <style> element to the page 4861 4862 4863 document.querySelector('head').appendChild(style); 4864 return style.sheet ? style.sheet : style.styleSheet; 4865} 4866 4867// cross browsers addRule method 4868function addCSSRule(sheet, selector, rules, index) { 4869 // return raf(function() { 4870 'insertRule' in sheet ? sheet.insertRule(selector + '{' + rules + '}', index) : sheet.addRule(selector, rules, index); // }); 4871} 4872 4873// cross browsers addRule method 4874function removeCSSRule(sheet, index) { 4875 // return raf(function() { 4876 'deleteRule' in sheet ? sheet.deleteRule(index) : sheet.removeRule(index); // }); 4877} 4878 4879function getCssRulesLength(sheet) { 4880 var rule = 'insertRule' in sheet ? sheet.cssRules : sheet.rules; 4881 return rule.length; 4882} 4883 4884function toDegree(y, x) { 4885 return Math.atan2(y, x) * (180 / Math.PI); 4886} 4887 4888function getTouchDirection(angle, range) { 4889 var direction = false, 4890 gap = Math.abs(90 - Math.abs(angle)); 4891 4892 if (gap >= 90 - range) { 4893 direction = 'horizontal'; 4894 } else if (gap <= range) { 4895 direction = 'vertical'; 4896 } 4897 4898 return direction; 4899} 4900 4901// https://toddmotto.com/ditch-the-array-foreach-call-nodelist-hack/ 4902function forEach(arr, callback, scope) { 4903 for (var i = 0, l = arr.length; i < l; i++) { 4904 callback.call(scope, arr[i], i); 4905 } 4906} 4907 4908var classListSupport = ('classList' in document.createElement('_')); 4909 4910var hasClass = classListSupport ? function (el, str) { 4911 return el.classList.contains(str); 4912} : function (el, str) { 4913 return el.className.indexOf(str) >= 0; 4914}; 4915 4916var addClass = classListSupport ? function (el, str) { 4917 if (!hasClass(el, str)) { 4918 el.classList.add(str); 4919 } 4920} : function (el, str) { 4921 if (!hasClass(el, str)) { 4922 el.className += ' ' + str; 4923 } 4924}; 4925 4926var removeClass = classListSupport ? function (el, str) { 4927 if (hasClass(el, str)) { 4928 el.classList.remove(str); 4929 } 4930} : function (el, str) { 4931 if (hasClass(el, str)) { 4932 el.className = el.className.replace(str, ''); 4933 } 4934}; 4935 4936function hasAttr(el, attr) { 4937 return el.hasAttribute(attr); 4938} 4939 4940function getAttr(el, attr) { 4941 return el.getAttribute(attr); 4942} 4943 4944function isNodeList(el) { 4945 // Only NodeList has the "item()" function 4946 return typeof el.item !== "undefined"; 4947} 4948 4949function setAttrs(els, attrs) { 4950 els = isNodeList(els) || els instanceof Array ? els : [els]; 4951 4952 if (Object.prototype.toString.call(attrs) !== '[object Object]') { 4953 return; 4954 } 4955 4956 for (var i = els.length; i--;) { 4957 for (var key in attrs) { 4958 els[i].setAttribute(key, attrs[key]); 4959 } 4960 } 4961} 4962 4963function removeAttrs(els, attrs) { 4964 els = isNodeList(els) || els instanceof Array ? els : [els]; 4965 attrs = attrs instanceof Array ? attrs : [attrs]; 4966 var attrLength = attrs.length; 4967 4968 for (var i = els.length; i--;) { 4969 for (var j = attrLength; j--;) { 4970 els[i].removeAttribute(attrs[j]); 4971 } 4972 } 4973} 4974 4975function arrayFromNodeList(nl) { 4976 var arr = []; 4977 4978 for (var i = 0, l = nl.length; i < l; i++) { 4979 arr.push(nl[i]); 4980 } 4981 4982 return arr; 4983} 4984 4985function hideElement(el, forceHide) { 4986 if (el.style.display !== 'none') { 4987 el.style.display = 'none'; 4988 } 4989} 4990 4991function showElement(el, forceHide) { 4992 if (el.style.display === 'none') { 4993 el.style.display = ''; 4994 } 4995} 4996 4997function isVisible(el) { 4998 return window.getComputedStyle(el).display !== 'none'; 4999} 5000 5001function whichProperty(props) { 5002 if (typeof props === 'string') { 5003 var arr = [props], 5004 Props = props.charAt(0).toUpperCase() + props.substr(1), 5005 prefixes = ['Webkit', 'Moz', 'ms', 'O']; 5006 prefixes.forEach(function (prefix) { 5007 if (prefix !== 'ms' || props === 'transform') { 5008 arr.push(prefix + Props); 5009 } 5010 }); 5011 props = arr; 5012 } 5013 5014 var el = document.createElement('fakeelement'); 5015 props.length; 5016 5017 for (var i = 0; i < props.length; i++) { 5018 var prop = props[i]; 5019 5020 if (el.style[prop] !== undefined) { 5021 return prop; 5022 } 5023 } 5024 5025 return false; // explicit for ie9- 5026} 5027 5028function has3DTransforms(tf) { 5029 if (!tf) { 5030 return false; 5031 } 5032 5033 if (!window.getComputedStyle) { 5034 return false; 5035 } 5036 5037 var doc = document, 5038 body = getBody(), 5039 docOverflow = setFakeBody(body), 5040 el = doc.createElement('p'), 5041 has3d, 5042 cssTF = tf.length > 9 ? '-' + tf.slice(0, -9).toLowerCase() + '-' : ''; 5043 cssTF += 'transform'; // Add it to the body to get the computed style 5044 5045 body.insertBefore(el, null); 5046 el.style[tf] = 'translate3d(1px,1px,1px)'; 5047 has3d = window.getComputedStyle(el).getPropertyValue(cssTF); 5048 body.fake ? resetFakeBody(body, docOverflow) : el.remove(); 5049 return has3d !== undefined && has3d.length > 0 && has3d !== "none"; 5050} 5051 5052// get transitionend, animationend based on transitionDuration 5053// @propin: string 5054// @propOut: string, first-letter uppercase 5055// Usage: getEndProperty('WebkitTransitionDuration', 'Transition') => webkitTransitionEnd 5056function getEndProperty(propIn, propOut) { 5057 var endProp = false; 5058 5059 if (/^Webkit/.test(propIn)) { 5060 endProp = 'webkit' + propOut + 'End'; 5061 } else if (/^O/.test(propIn)) { 5062 endProp = 'o' + propOut + 'End'; 5063 } else if (propIn) { 5064 endProp = propOut.toLowerCase() + 'end'; 5065 } 5066 5067 return endProp; 5068} 5069 5070// Test via a getter in the options object to see if the passive property is accessed 5071var supportsPassive = false; 5072 5073try { 5074 var opts = Object.defineProperty({}, 'passive', { 5075 get: function () { 5076 supportsPassive = true; 5077 } 5078 }); 5079 window.addEventListener("test", null, opts); 5080} catch (e) {} 5081 5082var passiveOption = supportsPassive ? { 5083 passive: true 5084} : false; 5085 5086function addEvents(el, obj, preventScrolling) { 5087 for (var prop in obj) { 5088 var option = ['touchstart', 'touchmove'].indexOf(prop) >= 0 && !preventScrolling ? passiveOption : false; 5089 el.addEventListener(prop, obj[prop], option); 5090 } 5091} 5092 5093function removeEvents(el, obj) { 5094 for (var prop in obj) { 5095 var option = ['touchstart', 'touchmove'].indexOf(prop) >= 0 ? passiveOption : false; 5096 el.removeEventListener(prop, obj[prop], option); 5097 } 5098} 5099 5100function Events() { 5101 return { 5102 topics: {}, 5103 on: function (eventName, fn) { 5104 this.topics[eventName] = this.topics[eventName] || []; 5105 this.topics[eventName].push(fn); 5106 }, 5107 off: function (eventName, fn) { 5108 if (this.topics[eventName]) { 5109 for (var i = 0; i < this.topics[eventName].length; i++) { 5110 if (this.topics[eventName][i] === fn) { 5111 this.topics[eventName].splice(i, 1); 5112 break; 5113 } 5114 } 5115 } 5116 }, 5117 emit: function (eventName, data) { 5118 data.type = eventName; 5119 5120 if (this.topics[eventName]) { 5121 this.topics[eventName].forEach(function (fn) { 5122 fn(data, eventName); 5123 }); 5124 } 5125 } 5126 }; 5127} 5128 5129function jsTransform(element, attr, prefix, postfix, to, duration, callback) { 5130 var tick = Math.min(duration, 10), 5131 unit = to.indexOf('%') >= 0 ? '%' : 'px', 5132 to = to.replace(unit, ''), 5133 from = Number(element.style[attr].replace(prefix, '').replace(postfix, '').replace(unit, '')), 5134 positionTick = (to - from) / duration * tick; 5135 setTimeout(moveElement, tick); 5136 5137 function moveElement() { 5138 duration -= tick; 5139 from += positionTick; 5140 element.style[attr] = prefix + from + unit + postfix; 5141 5142 if (duration > 0) { 5143 setTimeout(moveElement, tick); 5144 } else { 5145 callback(); 5146 } 5147 } 5148} 5149 5150// Object.keys 5151if (!Object.keys) { 5152 Object.keys = function (object) { 5153 var keys = []; 5154 5155 for (var name in object) { 5156 if (Object.prototype.hasOwnProperty.call(object, name)) { 5157 keys.push(name); 5158 } 5159 } 5160 5161 return keys; 5162 }; 5163} // ChildNode.remove 5164 5165 5166if (!("remove" in Element.prototype)) { 5167 Element.prototype.remove = function () { 5168 if (this.parentNode) { 5169 this.parentNode.removeChild(this); 5170 } 5171 }; 5172} 5173var tns = function (options) { 5174 options = extend({ 5175 container: '.slider', 5176 mode: 'carousel', 5177 axis: 'horizontal', 5178 items: 1, 5179 gutter: 0, 5180 edgePadding: 0, 5181 fixedWidth: false, 5182 autoWidth: false, 5183 viewportMax: false, 5184 slideBy: 1, 5185 center: false, 5186 controls: true, 5187 controlsPosition: 'top', 5188 controlsText: ['prev', 'next'], 5189 controlsContainer: false, 5190 prevButton: false, 5191 nextButton: false, 5192 nav: true, 5193 navPosition: 'top', 5194 navContainer: false, 5195 navAsThumbnails: false, 5196 arrowKeys: false, 5197 speed: 300, 5198 autoplay: false, 5199 autoplayPosition: 'top', 5200 autoplayTimeout: 5000, 5201 autoplayDirection: 'forward', 5202 autoplayText: ['start', 'stop'], 5203 autoplayHoverPause: false, 5204 autoplayButton: false, 5205 autoplayButtonOutput: true, 5206 autoplayResetOnVisibility: true, 5207 animateIn: 'tns-fadeIn', 5208 animateOut: 'tns-fadeOut', 5209 animateNormal: 'tns-normal', 5210 animateDelay: false, 5211 loop: true, 5212 rewind: false, 5213 autoHeight: false, 5214 responsive: false, 5215 lazyload: false, 5216 lazyloadSelector: '.tns-lazy-img', 5217 touch: true, 5218 mouseDrag: false, 5219 swipeAngle: 15, 5220 nested: false, 5221 preventActionWhenRunning: false, 5222 preventScrollOnTouch: false, 5223 freezable: true, 5224 onInit: false, 5225 useLocalStorage: true, 5226 nonce: false 5227 }, options || {}); 5228 var doc = document, 5229 win = window, 5230 KEYS = { 5231 ENTER: 13, 5232 SPACE: 32, 5233 LEFT: 37, 5234 RIGHT: 39 5235 }, 5236 tnsStorage = {}, 5237 localStorageAccess = options.useLocalStorage; 5238 5239 if (localStorageAccess) { 5240 // check browser version and local storage access 5241 var browserInfo = navigator.userAgent; 5242 var uid = new Date(); 5243 5244 try { 5245 tnsStorage = win.localStorage; 5246 5247 if (tnsStorage) { 5248 tnsStorage.setItem(uid, uid); 5249 localStorageAccess = tnsStorage.getItem(uid) == uid; 5250 tnsStorage.removeItem(uid); 5251 } else { 5252 localStorageAccess = false; 5253 } 5254 5255 if (!localStorageAccess) { 5256 tnsStorage = {}; 5257 } 5258 } catch (e) { 5259 localStorageAccess = false; 5260 } 5261 5262 if (localStorageAccess) { 5263 // remove storage when browser version changes 5264 if (tnsStorage['tnsApp'] && tnsStorage['tnsApp'] !== browserInfo) { 5265 ['tC', 'tPL', 'tMQ', 'tTf', 't3D', 'tTDu', 'tTDe', 'tADu', 'tADe', 'tTE', 'tAE'].forEach(function (item) { 5266 tnsStorage.removeItem(item); 5267 }); 5268 } // update browserInfo 5269 5270 5271 localStorage['tnsApp'] = browserInfo; 5272 } 5273 } 5274 5275 var CALC = tnsStorage['tC'] ? checkStorageValue(tnsStorage['tC']) : setLocalStorage(tnsStorage, 'tC', calc(), localStorageAccess), 5276 PERCENTAGELAYOUT = tnsStorage['tPL'] ? checkStorageValue(tnsStorage['tPL']) : setLocalStorage(tnsStorage, 'tPL', percentageLayout(), localStorageAccess), 5277 CSSMQ = tnsStorage['tMQ'] ? checkStorageValue(tnsStorage['tMQ']) : setLocalStorage(tnsStorage, 'tMQ', mediaquerySupport(), localStorageAccess), 5278 TRANSFORM = tnsStorage['tTf'] ? checkStorageValue(tnsStorage['tTf']) : setLocalStorage(tnsStorage, 'tTf', whichProperty('transform'), localStorageAccess), 5279 HAS3DTRANSFORMS = tnsStorage['t3D'] ? checkStorageValue(tnsStorage['t3D']) : setLocalStorage(tnsStorage, 't3D', has3DTransforms(TRANSFORM), localStorageAccess), 5280 TRANSITIONDURATION = tnsStorage['tTDu'] ? checkStorageValue(tnsStorage['tTDu']) : setLocalStorage(tnsStorage, 'tTDu', whichProperty('transitionDuration'), localStorageAccess), 5281 TRANSITIONDELAY = tnsStorage['tTDe'] ? checkStorageValue(tnsStorage['tTDe']) : setLocalStorage(tnsStorage, 'tTDe', whichProperty('transitionDelay'), localStorageAccess), 5282 ANIMATIONDURATION = tnsStorage['tADu'] ? checkStorageValue(tnsStorage['tADu']) : setLocalStorage(tnsStorage, 'tADu', whichProperty('animationDuration'), localStorageAccess), 5283 ANIMATIONDELAY = tnsStorage['tADe'] ? checkStorageValue(tnsStorage['tADe']) : setLocalStorage(tnsStorage, 'tADe', whichProperty('animationDelay'), localStorageAccess), 5284 TRANSITIONEND = tnsStorage['tTE'] ? checkStorageValue(tnsStorage['tTE']) : setLocalStorage(tnsStorage, 'tTE', getEndProperty(TRANSITIONDURATION, 'Transition'), localStorageAccess), 5285 ANIMATIONEND = tnsStorage['tAE'] ? checkStorageValue(tnsStorage['tAE']) : setLocalStorage(tnsStorage, 'tAE', getEndProperty(ANIMATIONDURATION, 'Animation'), localStorageAccess); // get element nodes from selectors 5286 5287 var supportConsoleWarn = win.console && typeof win.console.warn === "function", 5288 tnsList = ['container', 'controlsContainer', 'prevButton', 'nextButton', 'navContainer', 'autoplayButton'], 5289 optionsElements = {}; 5290 tnsList.forEach(function (item) { 5291 if (typeof options[item] === 'string') { 5292 var str = options[item], 5293 el = doc.querySelector(str); 5294 optionsElements[item] = str; 5295 5296 if (el && el.nodeName) { 5297 options[item] = el; 5298 } else { 5299 if (supportConsoleWarn) { 5300 console.warn('Can\'t find', options[item]); 5301 } 5302 5303 return; 5304 } 5305 } 5306 }); // make sure at least 1 slide 5307 5308 if (options.container.children.length < 1) { 5309 if (supportConsoleWarn) { 5310 console.warn('No slides found in', options.container); 5311 } 5312 5313 return; 5314 } // update options 5315 5316 5317 var responsive = options.responsive, 5318 nested = options.nested, 5319 carousel = options.mode === 'carousel' ? true : false; 5320 5321 if (responsive) { 5322 // apply responsive[0] to options and remove it 5323 if (0 in responsive) { 5324 options = extend(options, responsive[0]); 5325 delete responsive[0]; 5326 } 5327 5328 var responsiveTem = {}; 5329 5330 for (var key in responsive) { 5331 var val = responsive[key]; // update responsive 5332 // from: 300: 2 5333 // to: 5334 // 300: { 5335 // items: 2 5336 // } 5337 5338 val = typeof val === 'number' ? { 5339 items: val 5340 } : val; 5341 responsiveTem[key] = val; 5342 } 5343 5344 responsive = responsiveTem; 5345 responsiveTem = null; 5346 } // update options 5347 5348 5349 function updateOptions(obj) { 5350 for (var key in obj) { 5351 if (!carousel) { 5352 if (key === 'slideBy') { 5353 obj[key] = 'page'; 5354 } 5355 5356 if (key === 'edgePadding') { 5357 obj[key] = false; 5358 } 5359 5360 if (key === 'autoHeight') { 5361 obj[key] = false; 5362 } 5363 } // update responsive options 5364 5365 5366 if (key === 'responsive') { 5367 updateOptions(obj[key]); 5368 } 5369 } 5370 } 5371 5372 if (!carousel) { 5373 updateOptions(options); 5374 } // === define and set variables === 5375 5376 5377 if (!carousel) { 5378 options.axis = 'horizontal'; 5379 options.slideBy = 'page'; 5380 options.edgePadding = false; 5381 var animateIn = options.animateIn, 5382 animateOut = options.animateOut, 5383 animateDelay = options.animateDelay, 5384 animateNormal = options.animateNormal; 5385 } 5386 5387 var horizontal = options.axis === 'horizontal' ? true : false, 5388 outerWrapper = doc.createElement('div'), 5389 innerWrapper = doc.createElement('div'), 5390 middleWrapper, 5391 container = options.container, 5392 containerParent = container.parentNode, 5393 containerHTML = container.outerHTML, 5394 slideItems = container.children, 5395 slideCount = slideItems.length, 5396 breakpointZone, 5397 windowWidth = getWindowWidth(), 5398 isOn = false; 5399 5400 if (responsive) { 5401 setBreakpointZone(); 5402 } 5403 5404 if (carousel) { 5405 container.className += ' tns-vpfix'; 5406 } // fixedWidth: viewport > rightBoundary > indexMax 5407 5408 5409 var autoWidth = options.autoWidth, 5410 fixedWidth = getOption('fixedWidth'), 5411 edgePadding = getOption('edgePadding'), 5412 gutter = getOption('gutter'), 5413 viewport = getViewportWidth(), 5414 center = getOption('center'), 5415 items = !autoWidth ? Math.floor(getOption('items')) : 1, 5416 slideBy = getOption('slideBy'), 5417 viewportMax = options.viewportMax || options.fixedWidthViewportWidth, 5418 arrowKeys = getOption('arrowKeys'), 5419 speed = getOption('speed'), 5420 rewind = options.rewind, 5421 loop = rewind ? false : options.loop, 5422 autoHeight = getOption('autoHeight'), 5423 controls = getOption('controls'), 5424 controlsText = getOption('controlsText'), 5425 nav = getOption('nav'), 5426 touch = getOption('touch'), 5427 mouseDrag = getOption('mouseDrag'), 5428 autoplay = getOption('autoplay'), 5429 autoplayTimeout = getOption('autoplayTimeout'), 5430 autoplayText = getOption('autoplayText'), 5431 autoplayHoverPause = getOption('autoplayHoverPause'), 5432 autoplayResetOnVisibility = getOption('autoplayResetOnVisibility'), 5433 sheet = createStyleSheet(null, getOption('nonce')), 5434 lazyload = options.lazyload, 5435 lazyloadSelector = options.lazyloadSelector, 5436 slidePositions, 5437 // collection of slide positions 5438 slideItemsOut = [], 5439 cloneCount = loop ? getCloneCountForLoop() : 0, 5440 slideCountNew = !carousel ? slideCount + cloneCount : slideCount + cloneCount * 2, 5441 hasRightDeadZone = (fixedWidth || autoWidth) && !loop ? true : false, 5442 rightBoundary = fixedWidth ? getRightBoundary() : null, 5443 updateIndexBeforeTransform = !carousel || !loop ? true : false, 5444 // transform 5445 transformAttr = horizontal ? 'left' : 'top', 5446 transformPrefix = '', 5447 transformPostfix = '', 5448 // index 5449 getIndexMax = function () { 5450 if (fixedWidth) { 5451 return function () { 5452 return center && !loop ? slideCount - 1 : Math.ceil(-rightBoundary / (fixedWidth + gutter)); 5453 }; 5454 } else if (autoWidth) { 5455 return function () { 5456 for (var i = 0; i < slideCountNew; i++) { 5457 if (slidePositions[i] >= -rightBoundary) { 5458 return i; 5459 } 5460 } 5461 }; 5462 } else { 5463 return function () { 5464 if (center && carousel && !loop) { 5465 return slideCount - 1; 5466 } else { 5467 return loop || carousel ? Math.max(0, slideCountNew - Math.ceil(items)) : slideCountNew - 1; 5468 } 5469 }; 5470 } 5471 }(), 5472 index = getStartIndex(getOption('startIndex')), 5473 indexCached = index; 5474 getCurrentSlide(); 5475 var indexMin = 0, 5476 indexMax = !autoWidth ? getIndexMax() : null, 5477 preventActionWhenRunning = options.preventActionWhenRunning, 5478 swipeAngle = options.swipeAngle, 5479 moveDirectionExpected = swipeAngle ? '?' : true, 5480 running = false, 5481 onInit = options.onInit, 5482 events = new Events(), 5483 // id, class 5484 newContainerClasses = ' tns-slider tns-' + options.mode, 5485 slideId = container.id || getSlideId(), 5486 disable = getOption('disable'), 5487 disabled = false, 5488 freezable = options.freezable, 5489 freeze = freezable && !autoWidth ? getFreeze() : false, 5490 frozen = false, 5491 controlsEvents = { 5492 'click': onControlsClick, 5493 'keydown': onControlsKeydown 5494 }, 5495 navEvents = { 5496 'click': onNavClick, 5497 'keydown': onNavKeydown 5498 }, 5499 hoverEvents = { 5500 'mouseover': mouseoverPause, 5501 'mouseout': mouseoutRestart 5502 }, 5503 visibilityEvent = { 5504 'visibilitychange': onVisibilityChange 5505 }, 5506 docmentKeydownEvent = { 5507 'keydown': onDocumentKeydown 5508 }, 5509 touchEvents = { 5510 'touchstart': onPanStart, 5511 'touchmove': onPanMove, 5512 'touchend': onPanEnd, 5513 'touchcancel': onPanEnd 5514 }, 5515 dragEvents = { 5516 'mousedown': onPanStart, 5517 'mousemove': onPanMove, 5518 'mouseup': onPanEnd, 5519 'mouseleave': onPanEnd 5520 }, 5521 hasControls = hasOption('controls'), 5522 hasNav = hasOption('nav'), 5523 navAsThumbnails = autoWidth ? true : options.navAsThumbnails, 5524 hasAutoplay = hasOption('autoplay'), 5525 hasTouch = hasOption('touch'), 5526 hasMouseDrag = hasOption('mouseDrag'), 5527 slideActiveClass = 'tns-slide-active', 5528 slideClonedClass = 'tns-slide-cloned', 5529 imgCompleteClass = 'tns-complete', 5530 imgEvents = { 5531 'load': onImgLoaded, 5532 'error': onImgFailed 5533 }, 5534 imgsComplete, 5535 liveregionCurrent, 5536 preventScroll = options.preventScrollOnTouch === 'force' ? true : false; // controls 5537 5538 5539 if (hasControls) { 5540 var controlsContainer = options.controlsContainer, 5541 controlsContainerHTML = options.controlsContainer ? options.controlsContainer.outerHTML : '', 5542 prevButton = options.prevButton, 5543 nextButton = options.nextButton, 5544 prevButtonHTML = options.prevButton ? options.prevButton.outerHTML : '', 5545 nextButtonHTML = options.nextButton ? options.nextButton.outerHTML : '', 5546 prevIsButton, 5547 nextIsButton; 5548 } // nav 5549 5550 5551 if (hasNav) { 5552 var navContainer = options.navContainer, 5553 navContainerHTML = options.navContainer ? options.navContainer.outerHTML : '', 5554 navItems, 5555 pages = autoWidth ? slideCount : getPages(), 5556 pagesCached = 0, 5557 navClicked = -1, 5558 navCurrentIndex = getCurrentNavIndex(), 5559 navCurrentIndexCached = navCurrentIndex, 5560 navActiveClass = 'tns-nav-active', 5561 navStr = 'Carousel Page ', 5562 navStrCurrent = ' (Current Slide)'; 5563 } // autoplay 5564 5565 5566 if (hasAutoplay) { 5567 var autoplayDirection = options.autoplayDirection === 'forward' ? 1 : -1, 5568 autoplayButton = options.autoplayButton, 5569 autoplayButtonHTML = options.autoplayButton ? options.autoplayButton.outerHTML : '', 5570 autoplayHtmlStrings = ['<span class=\'tns-visually-hidden\'>', ' animation</span>'], 5571 autoplayTimer, 5572 animating, 5573 autoplayHoverPaused, 5574 autoplayUserPaused, 5575 autoplayVisibilityPaused; 5576 } 5577 5578 if (hasTouch || hasMouseDrag) { 5579 var initPosition = {}, 5580 lastPosition = {}, 5581 translateInit, 5582 panStart = false, 5583 rafIndex, 5584 getDist = horizontal ? function (a, b) { 5585 return a.x - b.x; 5586 } : function (a, b) { 5587 return a.y - b.y; 5588 }; 5589 } // disable slider when slidecount <= items 5590 5591 5592 if (!autoWidth) { 5593 resetVariblesWhenDisable(disable || freeze); 5594 } 5595 5596 if (TRANSFORM) { 5597 transformAttr = TRANSFORM; 5598 transformPrefix = 'translate'; 5599 5600 if (HAS3DTRANSFORMS) { 5601 transformPrefix += horizontal ? '3d(' : '3d(0px, '; 5602 transformPostfix = horizontal ? ', 0px, 0px)' : ', 0px)'; 5603 } else { 5604 transformPrefix += horizontal ? 'X(' : 'Y('; 5605 transformPostfix = ')'; 5606 } 5607 } 5608 5609 if (carousel) { 5610 container.className = container.className.replace('tns-vpfix', ''); 5611 } 5612 5613 initStructure(); 5614 initSheet(); 5615 initSliderTransform(); // === COMMON FUNCTIONS === // 5616 5617 function resetVariblesWhenDisable(condition) { 5618 if (condition) { 5619 controls = nav = touch = mouseDrag = arrowKeys = autoplay = autoplayHoverPause = autoplayResetOnVisibility = false; 5620 } 5621 } 5622 5623 function getCurrentSlide() { 5624 var tem = carousel ? index - cloneCount : index; 5625 5626 while (tem < 0) { 5627 tem += slideCount; 5628 } 5629 5630 return tem % slideCount + 1; 5631 } 5632 5633 function getStartIndex(ind) { 5634 ind = ind ? Math.max(0, Math.min(loop ? slideCount - 1 : slideCount - items, ind)) : 0; 5635 return carousel ? ind + cloneCount : ind; 5636 } 5637 5638 function getAbsIndex(i) { 5639 if (i == null) { 5640 i = index; 5641 } 5642 5643 if (carousel) { 5644 i -= cloneCount; 5645 } 5646 5647 while (i < 0) { 5648 i += slideCount; 5649 } 5650 5651 return Math.floor(i % slideCount); 5652 } 5653 5654 function getCurrentNavIndex() { 5655 var absIndex = getAbsIndex(), 5656 result; 5657 result = navAsThumbnails ? absIndex : fixedWidth || autoWidth ? Math.ceil((absIndex + 1) * pages / slideCount - 1) : Math.floor(absIndex / items); // set active nav to the last one when reaches the right edge 5658 5659 if (!loop && carousel && index === indexMax) { 5660 result = pages - 1; 5661 } 5662 5663 return result; 5664 } 5665 5666 function getItemsMax() { 5667 // fixedWidth or autoWidth while viewportMax is not available 5668 if (autoWidth || fixedWidth && !viewportMax) { 5669 return slideCount - 1; // most cases 5670 } else { 5671 var str = fixedWidth ? 'fixedWidth' : 'items', 5672 arr = []; 5673 5674 if (fixedWidth || options[str] < slideCount) { 5675 arr.push(options[str]); 5676 } 5677 5678 if (responsive) { 5679 for (var bp in responsive) { 5680 var tem = responsive[bp][str]; 5681 5682 if (tem && (fixedWidth || tem < slideCount)) { 5683 arr.push(tem); 5684 } 5685 } 5686 } 5687 5688 if (!arr.length) { 5689 arr.push(0); 5690 } 5691 5692 return Math.ceil(fixedWidth ? viewportMax / Math.min.apply(null, arr) : Math.max.apply(null, arr)); 5693 } 5694 } 5695 5696 function getCloneCountForLoop() { 5697 var itemsMax = getItemsMax(), 5698 result = carousel ? Math.ceil((itemsMax * 5 - slideCount) / 2) : itemsMax * 4 - slideCount; 5699 result = Math.max(itemsMax, result); 5700 return hasOption('edgePadding') ? result + 1 : result; 5701 } 5702 5703 function getWindowWidth() { 5704 return win.innerWidth || doc.documentElement.clientWidth || doc.body.clientWidth; 5705 } 5706 5707 function getInsertPosition(pos) { 5708 return pos === 'top' ? 'afterbegin' : 'beforeend'; 5709 } 5710 5711 function getClientWidth(el) { 5712 if (el == null) { 5713 return; 5714 } 5715 5716 var div = doc.createElement('div'), 5717 rect, 5718 width; 5719 el.appendChild(div); 5720 rect = div.getBoundingClientRect(); 5721 width = rect.right - rect.left; 5722 div.remove(); 5723 return width || getClientWidth(el.parentNode); 5724 } 5725 5726 function getViewportWidth() { 5727 var gap = edgePadding ? edgePadding * 2 - gutter : 0; 5728 return getClientWidth(containerParent) - gap; 5729 } 5730 5731 function hasOption(item) { 5732 if (options[item]) { 5733 return true; 5734 } else { 5735 if (responsive) { 5736 for (var bp in responsive) { 5737 if (responsive[bp][item]) { 5738 return true; 5739 } 5740 } 5741 } 5742 5743 return false; 5744 } 5745 } // get option: 5746 // fixed width: viewport, fixedWidth, gutter => items 5747 // others: window width => all variables 5748 // all: items => slideBy 5749 5750 5751 function getOption(item, ww) { 5752 if (ww == null) { 5753 ww = windowWidth; 5754 } 5755 5756 if (item === 'items' && fixedWidth) { 5757 return Math.floor((viewport + gutter) / (fixedWidth + gutter)) || 1; 5758 } else { 5759 var result = options[item]; 5760 5761 if (responsive) { 5762 for (var bp in responsive) { 5763 // bp: convert string to number 5764 if (ww >= parseInt(bp)) { 5765 if (item in responsive[bp]) { 5766 result = responsive[bp][item]; 5767 } 5768 } 5769 } 5770 } 5771 5772 if (item === 'slideBy' && result === 'page') { 5773 result = getOption('items'); 5774 } 5775 5776 if (!carousel && (item === 'slideBy' || item === 'items')) { 5777 result = Math.floor(result); 5778 } 5779 5780 return result; 5781 } 5782 } 5783 5784 function getSlideMarginLeft(i) { 5785 return CALC ? CALC + '(' + i * 100 + '% / ' + slideCountNew + ')' : i * 100 / slideCountNew + '%'; 5786 } 5787 5788 function getInnerWrapperStyles(edgePaddingTem, gutterTem, fixedWidthTem, speedTem, autoHeightBP) { 5789 var str = ''; 5790 5791 if (edgePaddingTem !== undefined) { 5792 var gap = edgePaddingTem; 5793 5794 if (gutterTem) { 5795 gap -= gutterTem; 5796 } 5797 5798 str = horizontal ? 'margin: 0 ' + gap + 'px 0 ' + edgePaddingTem + 'px;' : 'margin: ' + edgePaddingTem + 'px 0 ' + gap + 'px 0;'; 5799 } else if (gutterTem && !fixedWidthTem) { 5800 var gutterTemUnit = '-' + gutterTem + 'px', 5801 dir = horizontal ? gutterTemUnit + ' 0 0' : '0 ' + gutterTemUnit + ' 0'; 5802 str = 'margin: 0 ' + dir + ';'; 5803 } 5804 5805 if (!carousel && autoHeightBP && TRANSITIONDURATION && speedTem) { 5806 str += getTransitionDurationStyle(speedTem); 5807 } 5808 5809 return str; 5810 } 5811 5812 function getContainerWidth(fixedWidthTem, gutterTem, itemsTem) { 5813 if (fixedWidthTem) { 5814 return (fixedWidthTem + gutterTem) * slideCountNew + 'px'; 5815 } else { 5816 return CALC ? CALC + '(' + slideCountNew * 100 + '% / ' + itemsTem + ')' : slideCountNew * 100 / itemsTem + '%'; 5817 } 5818 } 5819 5820 function getSlideWidthStyle(fixedWidthTem, gutterTem, itemsTem) { 5821 var width; 5822 5823 if (fixedWidthTem) { 5824 width = fixedWidthTem + gutterTem + 'px'; 5825 } else { 5826 if (!carousel) { 5827 itemsTem = Math.floor(itemsTem); 5828 } 5829 5830 var dividend = carousel ? slideCountNew : itemsTem; 5831 width = CALC ? CALC + '(100% / ' + dividend + ')' : 100 / dividend + '%'; 5832 } 5833 5834 width = 'width:' + width; // inner slider: overwrite outer slider styles 5835 5836 return nested !== 'inner' ? width + ';' : width + ' !important;'; 5837 } 5838 5839 function getSlideGutterStyle(gutterTem) { 5840 var str = ''; // gutter maybe interger || 0 5841 // so can't use 'if (gutter)' 5842 5843 if (gutterTem !== false) { 5844 var prop = horizontal ? 'padding-' : 'margin-', 5845 dir = horizontal ? 'right' : 'bottom'; 5846 str = prop + dir + ': ' + gutterTem + 'px;'; 5847 } 5848 5849 return str; 5850 } 5851 5852 function getCSSPrefix(name, num) { 5853 var prefix = name.substring(0, name.length - num).toLowerCase(); 5854 5855 if (prefix) { 5856 prefix = '-' + prefix + '-'; 5857 } 5858 5859 return prefix; 5860 } 5861 5862 function getTransitionDurationStyle(speed) { 5863 return getCSSPrefix(TRANSITIONDURATION, 18) + 'transition-duration:' + speed / 1000 + 's;'; 5864 } 5865 5866 function getAnimationDurationStyle(speed) { 5867 return getCSSPrefix(ANIMATIONDURATION, 17) + 'animation-duration:' + speed / 1000 + 's;'; 5868 } 5869 5870 function initStructure() { 5871 var classOuter = 'tns-outer', 5872 classInner = 'tns-inner'; 5873 hasOption('gutter'); 5874 outerWrapper.className = classOuter; 5875 innerWrapper.className = classInner; 5876 outerWrapper.id = slideId + '-ow'; 5877 innerWrapper.id = slideId + '-iw'; // set container properties 5878 5879 if (container.id === '') { 5880 container.id = slideId; 5881 } 5882 5883 newContainerClasses += PERCENTAGELAYOUT || autoWidth ? ' tns-subpixel' : ' tns-no-subpixel'; 5884 newContainerClasses += CALC ? ' tns-calc' : ' tns-no-calc'; 5885 5886 if (autoWidth) { 5887 newContainerClasses += ' tns-autowidth'; 5888 } 5889 5890 newContainerClasses += ' tns-' + options.axis; 5891 container.className += newContainerClasses; // add constrain layer for carousel 5892 5893 if (carousel) { 5894 middleWrapper = doc.createElement('div'); 5895 middleWrapper.id = slideId + '-mw'; 5896 middleWrapper.className = 'tns-ovh'; 5897 outerWrapper.appendChild(middleWrapper); 5898 middleWrapper.appendChild(innerWrapper); 5899 } else { 5900 outerWrapper.appendChild(innerWrapper); 5901 } 5902 5903 if (autoHeight) { 5904 var wp = middleWrapper ? middleWrapper : innerWrapper; 5905 wp.className += ' tns-ah'; 5906 } 5907 5908 containerParent.insertBefore(outerWrapper, container); 5909 innerWrapper.appendChild(container); // add id, class, aria attributes 5910 // before clone slides 5911 5912 forEach(slideItems, function (item, i) { 5913 addClass(item, 'tns-item'); 5914 5915 if (!item.id) { 5916 item.id = slideId + '-item' + i; 5917 } 5918 5919 if (!carousel && animateNormal) { 5920 addClass(item, animateNormal); 5921 } 5922 5923 setAttrs(item, { 5924 'aria-hidden': 'true', 5925 'tabindex': '-1' 5926 }); 5927 }); // ## clone slides 5928 // carousel: n + slides + n 5929 // gallery: slides + n 5930 5931 if (cloneCount) { 5932 var fragmentBefore = doc.createDocumentFragment(), 5933 fragmentAfter = doc.createDocumentFragment(); 5934 5935 for (var j = cloneCount; j--;) { 5936 var num = j % slideCount, 5937 cloneFirst = slideItems[num].cloneNode(true); 5938 addClass(cloneFirst, slideClonedClass); 5939 removeAttrs(cloneFirst, 'id'); 5940 fragmentAfter.insertBefore(cloneFirst, fragmentAfter.firstChild); 5941 5942 if (carousel) { 5943 var cloneLast = slideItems[slideCount - 1 - num].cloneNode(true); 5944 addClass(cloneLast, slideClonedClass); 5945 removeAttrs(cloneLast, 'id'); 5946 fragmentBefore.appendChild(cloneLast); 5947 } 5948 } 5949 5950 container.insertBefore(fragmentBefore, container.firstChild); 5951 container.appendChild(fragmentAfter); 5952 slideItems = container.children; 5953 } 5954 } 5955 5956 function initSliderTransform() { 5957 // ## images loaded/failed 5958 if (hasOption('autoHeight') || autoWidth || !horizontal) { 5959 var imgs = container.querySelectorAll('img'); // add img load event listener 5960 5961 forEach(imgs, function (img) { 5962 var src = img.src; 5963 5964 if (!lazyload) { 5965 // not data img 5966 if (src && src.indexOf('data:image') < 0) { 5967 img.src = ''; 5968 addEvents(img, imgEvents); 5969 addClass(img, 'loading'); 5970 img.src = src; // data img 5971 } else { 5972 imgLoaded(img); 5973 } 5974 } 5975 }); // set imgsComplete 5976 5977 raf(function () { 5978 imgsLoadedCheck(arrayFromNodeList(imgs), function () { 5979 imgsComplete = true; 5980 }); 5981 }); // reset imgs for auto height: check visible imgs only 5982 5983 if (hasOption('autoHeight')) { 5984 imgs = getImageArray(index, Math.min(index + items - 1, slideCountNew - 1)); 5985 } 5986 5987 lazyload ? initSliderTransformStyleCheck() : raf(function () { 5988 imgsLoadedCheck(arrayFromNodeList(imgs), initSliderTransformStyleCheck); 5989 }); 5990 } else { 5991 // set container transform property 5992 if (carousel) { 5993 doContainerTransformSilent(); 5994 } // update slider tools and events 5995 5996 5997 initTools(); 5998 initEvents(); 5999 } 6000 } 6001 6002 function initSliderTransformStyleCheck() { 6003 if (autoWidth && slideCount > 1) { 6004 // check styles application 6005 var num = loop ? index : slideCount - 1; 6006 6007 (function stylesApplicationCheck() { 6008 var left = slideItems[num].getBoundingClientRect().left; 6009 var right = slideItems[num - 1].getBoundingClientRect().right; 6010 Math.abs(left - right) <= 1 ? initSliderTransformCore() : setTimeout(function () { 6011 stylesApplicationCheck(); 6012 }, 16); 6013 })(); 6014 } else { 6015 initSliderTransformCore(); 6016 } 6017 } 6018 6019 function initSliderTransformCore() { 6020 // run Fn()s which are rely on image loading 6021 if (!horizontal || autoWidth) { 6022 setSlidePositions(); 6023 6024 if (autoWidth) { 6025 rightBoundary = getRightBoundary(); 6026 6027 if (freezable) { 6028 freeze = getFreeze(); 6029 } 6030 6031 indexMax = getIndexMax(); // <= slidePositions, rightBoundary <= 6032 6033 resetVariblesWhenDisable(disable || freeze); 6034 } else { 6035 updateContentWrapperHeight(); 6036 } 6037 } // set container transform property 6038 6039 6040 if (carousel) { 6041 doContainerTransformSilent(); 6042 } // update slider tools and events 6043 6044 6045 initTools(); 6046 initEvents(); 6047 } 6048 6049 function initSheet() { 6050 // gallery: 6051 // set animation classes and left value for gallery slider 6052 if (!carousel) { 6053 for (var i = index, l = index + Math.min(slideCount, items); i < l; i++) { 6054 var item = slideItems[i]; 6055 item.style.left = (i - index) * 100 / items + '%'; 6056 addClass(item, animateIn); 6057 removeClass(item, animateNormal); 6058 } 6059 } // #### LAYOUT 6060 // ## INLINE-BLOCK VS FLOAT 6061 // ## PercentageLayout: 6062 // slides: inline-block 6063 // remove blank space between slides by set font-size: 0 6064 // ## Non PercentageLayout: 6065 // slides: float 6066 // margin-right: -100% 6067 // margin-left: ~ 6068 // Resource: https://docs.google.com/spreadsheets/d/147up245wwTXeQYve3BRSAD4oVcvQmuGsFteJOeA5xNQ/edit?usp=sharing 6069 6070 6071 if (horizontal) { 6072 if (PERCENTAGELAYOUT || autoWidth) { 6073 addCSSRule(sheet, '#' + slideId + ' > .tns-item', 'font-size:' + win.getComputedStyle(slideItems[0]).fontSize + ';', getCssRulesLength(sheet)); 6074 addCSSRule(sheet, '#' + slideId, 'font-size:0;', getCssRulesLength(sheet)); 6075 } else if (carousel) { 6076 forEach(slideItems, function (slide, i) { 6077 slide.style.marginLeft = getSlideMarginLeft(i); 6078 }); 6079 } 6080 } // ## BASIC STYLES 6081 6082 6083 if (CSSMQ) { 6084 // middle wrapper style 6085 if (TRANSITIONDURATION) { 6086 var str = middleWrapper && options.autoHeight ? getTransitionDurationStyle(options.speed) : ''; 6087 addCSSRule(sheet, '#' + slideId + '-mw', str, getCssRulesLength(sheet)); 6088 } // inner wrapper styles 6089 6090 6091 str = getInnerWrapperStyles(options.edgePadding, options.gutter, options.fixedWidth, options.speed, options.autoHeight); 6092 addCSSRule(sheet, '#' + slideId + '-iw', str, getCssRulesLength(sheet)); // container styles 6093 6094 if (carousel) { 6095 str = horizontal && !autoWidth ? 'width:' + getContainerWidth(options.fixedWidth, options.gutter, options.items) + ';' : ''; 6096 6097 if (TRANSITIONDURATION) { 6098 str += getTransitionDurationStyle(speed); 6099 } 6100 6101 addCSSRule(sheet, '#' + slideId, str, getCssRulesLength(sheet)); 6102 } // slide styles 6103 6104 6105 str = horizontal && !autoWidth ? getSlideWidthStyle(options.fixedWidth, options.gutter, options.items) : ''; 6106 6107 if (options.gutter) { 6108 str += getSlideGutterStyle(options.gutter); 6109 } // set gallery items transition-duration 6110 6111 6112 if (!carousel) { 6113 if (TRANSITIONDURATION) { 6114 str += getTransitionDurationStyle(speed); 6115 } 6116 6117 if (ANIMATIONDURATION) { 6118 str += getAnimationDurationStyle(speed); 6119 } 6120 } 6121 6122 if (str) { 6123 addCSSRule(sheet, '#' + slideId + ' > .tns-item', str, getCssRulesLength(sheet)); 6124 } // non CSS mediaqueries: IE8 6125 // ## update inner wrapper, container, slides if needed 6126 // set inline styles for inner wrapper & container 6127 // insert stylesheet (one line) for slides only (since slides are many) 6128 6129 } else { 6130 // middle wrapper styles 6131 update_carousel_transition_duration(); // inner wrapper styles 6132 6133 innerWrapper.style.cssText = getInnerWrapperStyles(edgePadding, gutter, fixedWidth, autoHeight); // container styles 6134 6135 if (carousel && horizontal && !autoWidth) { 6136 container.style.width = getContainerWidth(fixedWidth, gutter, items); 6137 } // slide styles 6138 6139 6140 var str = horizontal && !autoWidth ? getSlideWidthStyle(fixedWidth, gutter, items) : ''; 6141 6142 if (gutter) { 6143 str += getSlideGutterStyle(gutter); 6144 } // append to the last line 6145 6146 6147 if (str) { 6148 addCSSRule(sheet, '#' + slideId + ' > .tns-item', str, getCssRulesLength(sheet)); 6149 } 6150 } // ## MEDIAQUERIES 6151 6152 6153 if (responsive && CSSMQ) { 6154 for (var bp in responsive) { 6155 // bp: convert string to number 6156 bp = parseInt(bp); 6157 var opts = responsive[bp], 6158 str = '', 6159 middleWrapperStr = '', 6160 innerWrapperStr = '', 6161 containerStr = '', 6162 slideStr = '', 6163 itemsBP = !autoWidth ? getOption('items', bp) : null, 6164 fixedWidthBP = getOption('fixedWidth', bp), 6165 speedBP = getOption('speed', bp), 6166 edgePaddingBP = getOption('edgePadding', bp), 6167 autoHeightBP = getOption('autoHeight', bp), 6168 gutterBP = getOption('gutter', bp); // middle wrapper string 6169 6170 if (TRANSITIONDURATION && middleWrapper && getOption('autoHeight', bp) && 'speed' in opts) { 6171 middleWrapperStr = '#' + slideId + '-mw{' + getTransitionDurationStyle(speedBP) + '}'; 6172 } // inner wrapper string 6173 6174 6175 if ('edgePadding' in opts || 'gutter' in opts) { 6176 innerWrapperStr = '#' + slideId + '-iw{' + getInnerWrapperStyles(edgePaddingBP, gutterBP, fixedWidthBP, speedBP, autoHeightBP) + '}'; 6177 } // container string 6178 6179 6180 if (carousel && horizontal && !autoWidth && ('fixedWidth' in opts || 'items' in opts || fixedWidth && 'gutter' in opts)) { 6181 containerStr = 'width:' + getContainerWidth(fixedWidthBP, gutterBP, itemsBP) + ';'; 6182 } 6183 6184 if (TRANSITIONDURATION && 'speed' in opts) { 6185 containerStr += getTransitionDurationStyle(speedBP); 6186 } 6187 6188 if (containerStr) { 6189 containerStr = '#' + slideId + '{' + containerStr + '}'; 6190 } // slide string 6191 6192 6193 if ('fixedWidth' in opts || fixedWidth && 'gutter' in opts || !carousel && 'items' in opts) { 6194 slideStr += getSlideWidthStyle(fixedWidthBP, gutterBP, itemsBP); 6195 } 6196 6197 if ('gutter' in opts) { 6198 slideStr += getSlideGutterStyle(gutterBP); 6199 } // set gallery items transition-duration 6200 6201 6202 if (!carousel && 'speed' in opts) { 6203 if (TRANSITIONDURATION) { 6204 slideStr += getTransitionDurationStyle(speedBP); 6205 } 6206 6207 if (ANIMATIONDURATION) { 6208 slideStr += getAnimationDurationStyle(speedBP); 6209 } 6210 } 6211 6212 if (slideStr) { 6213 slideStr = '#' + slideId + ' > .tns-item{' + slideStr + '}'; 6214 } // add up 6215 6216 6217 str = middleWrapperStr + innerWrapperStr + containerStr + slideStr; 6218 6219 if (str) { 6220 sheet.insertRule('@media (min-width: ' + bp / 16 + 'em) {' + str + '}', sheet.cssRules.length); 6221 } 6222 } 6223 } 6224 } 6225 6226 function initTools() { 6227 // == slides == 6228 updateSlideStatus(); // == live region == 6229 6230 outerWrapper.insertAdjacentHTML('afterbegin', '<div class="tns-liveregion tns-visually-hidden" aria-live="polite" aria-atomic="true">slide <span class="current">' + getLiveRegionStr() + '</span> of ' + slideCount + '</div>'); 6231 liveregionCurrent = outerWrapper.querySelector('.tns-liveregion .current'); // == autoplayInit == 6232 6233 if (hasAutoplay) { 6234 var txt = autoplay ? 'stop' : 'start'; 6235 6236 if (autoplayButton) { 6237 setAttrs(autoplayButton, { 6238 'data-action': txt 6239 }); 6240 } else if (options.autoplayButtonOutput) { 6241 outerWrapper.insertAdjacentHTML(getInsertPosition(options.autoplayPosition), '<button type="button" data-action="' + txt + '">' + autoplayHtmlStrings[0] + txt + autoplayHtmlStrings[1] + autoplayText[0] + '</button>'); 6242 autoplayButton = outerWrapper.querySelector('[data-action]'); 6243 } // add event 6244 6245 6246 if (autoplayButton) { 6247 addEvents(autoplayButton, { 6248 'click': toggleAutoplay 6249 }); 6250 } 6251 6252 if (autoplay) { 6253 startAutoplay(); 6254 6255 if (autoplayHoverPause) { 6256 addEvents(container, hoverEvents); 6257 } 6258 6259 if (autoplayResetOnVisibility) { 6260 addEvents(container, visibilityEvent); 6261 } 6262 } 6263 } // == navInit == 6264 6265 6266 if (hasNav) { 6267 // will not hide the navs in case they're thumbnails 6268 6269 if (navContainer) { 6270 setAttrs(navContainer, { 6271 'aria-label': 'Carousel Pagination' 6272 }); 6273 navItems = navContainer.children; 6274 forEach(navItems, function (item, i) { 6275 setAttrs(item, { 6276 'data-nav': i, 6277 'tabindex': '-1', 6278 'aria-label': navStr + (i + 1), 6279 'aria-controls': slideId 6280 }); 6281 }); // generated nav 6282 } else { 6283 var navHtml = '', 6284 hiddenStr = navAsThumbnails ? '' : 'style="display:none"'; 6285 6286 for (var i = 0; i < slideCount; i++) { 6287 // hide nav items by default 6288 navHtml += '<button type="button" data-nav="' + i + '" tabindex="-1" aria-controls="' + slideId + '" ' + hiddenStr + ' aria-label="' + navStr + (i + 1) + '"></button>'; 6289 } 6290 6291 navHtml = '<div class="tns-nav" aria-label="Carousel Pagination">' + navHtml + '</div>'; 6292 outerWrapper.insertAdjacentHTML(getInsertPosition(options.navPosition), navHtml); 6293 navContainer = outerWrapper.querySelector('.tns-nav'); 6294 navItems = navContainer.children; 6295 } 6296 6297 updateNavVisibility(); // add transition 6298 6299 if (TRANSITIONDURATION) { 6300 var prefix = TRANSITIONDURATION.substring(0, TRANSITIONDURATION.length - 18).toLowerCase(), 6301 str = 'transition: all ' + speed / 1000 + 's'; 6302 6303 if (prefix) { 6304 str = '-' + prefix + '-' + str; 6305 } 6306 6307 addCSSRule(sheet, '[aria-controls^=' + slideId + '-item]', str, getCssRulesLength(sheet)); 6308 } 6309 6310 setAttrs(navItems[navCurrentIndex], { 6311 'aria-label': navStr + (navCurrentIndex + 1) + navStrCurrent 6312 }); 6313 removeAttrs(navItems[navCurrentIndex], 'tabindex'); 6314 addClass(navItems[navCurrentIndex], navActiveClass); // add events 6315 6316 addEvents(navContainer, navEvents); 6317 } // == controlsInit == 6318 6319 6320 if (hasControls) { 6321 if (!controlsContainer && (!prevButton || !nextButton)) { 6322 outerWrapper.insertAdjacentHTML(getInsertPosition(options.controlsPosition), '<div class="tns-controls" aria-label="Carousel Navigation" tabindex="0"><button type="button" data-controls="prev" tabindex="-1" aria-controls="' + slideId + '">' + controlsText[0] + '</button><button type="button" data-controls="next" tabindex="-1" aria-controls="' + slideId + '">' + controlsText[1] + '</button></div>'); 6323 controlsContainer = outerWrapper.querySelector('.tns-controls'); 6324 } 6325 6326 if (!prevButton || !nextButton) { 6327 prevButton = controlsContainer.children[0]; 6328 nextButton = controlsContainer.children[1]; 6329 } 6330 6331 if (options.controlsContainer) { 6332 setAttrs(controlsContainer, { 6333 'aria-label': 'Carousel Navigation', 6334 'tabindex': '0' 6335 }); 6336 } 6337 6338 if (options.controlsContainer || options.prevButton && options.nextButton) { 6339 setAttrs([prevButton, nextButton], { 6340 'aria-controls': slideId, 6341 'tabindex': '-1' 6342 }); 6343 } 6344 6345 if (options.controlsContainer || options.prevButton && options.nextButton) { 6346 setAttrs(prevButton, { 6347 'data-controls': 'prev' 6348 }); 6349 setAttrs(nextButton, { 6350 'data-controls': 'next' 6351 }); 6352 } 6353 6354 prevIsButton = isButton(prevButton); 6355 nextIsButton = isButton(nextButton); 6356 updateControlsStatus(); // add events 6357 6358 if (controlsContainer) { 6359 addEvents(controlsContainer, controlsEvents); 6360 } else { 6361 addEvents(prevButton, controlsEvents); 6362 addEvents(nextButton, controlsEvents); 6363 } 6364 } // hide tools if needed 6365 6366 6367 disableUI(); 6368 } 6369 6370 function initEvents() { 6371 // add events 6372 if (carousel && TRANSITIONEND) { 6373 var eve = {}; 6374 eve[TRANSITIONEND] = onTransitionEnd; 6375 addEvents(container, eve); 6376 } 6377 6378 if (touch) { 6379 addEvents(container, touchEvents, options.preventScrollOnTouch); 6380 } 6381 6382 if (mouseDrag) { 6383 addEvents(container, dragEvents); 6384 } 6385 6386 if (arrowKeys) { 6387 addEvents(doc, docmentKeydownEvent); 6388 } 6389 6390 if (nested === 'inner') { 6391 events.on('outerResized', function () { 6392 resizeTasks(); 6393 events.emit('innerLoaded', info()); 6394 }); 6395 } else if (responsive || fixedWidth || autoWidth || autoHeight || !horizontal) { 6396 addEvents(win, { 6397 'resize': onResize 6398 }); 6399 } 6400 6401 if (autoHeight) { 6402 if (nested === 'outer') { 6403 events.on('innerLoaded', doAutoHeight); 6404 } else if (!disable) { 6405 doAutoHeight(); 6406 } 6407 } 6408 6409 doLazyLoad(); 6410 6411 if (disable) { 6412 disableSlider(); 6413 } else if (freeze) { 6414 freezeSlider(); 6415 } 6416 6417 events.on('indexChanged', additionalUpdates); 6418 6419 if (nested === 'inner') { 6420 events.emit('innerLoaded', info()); 6421 } 6422 6423 if (typeof onInit === 'function') { 6424 onInit(info()); 6425 } 6426 6427 isOn = true; 6428 } 6429 6430 function destroy() { 6431 // sheet 6432 sheet.disabled = true; 6433 6434 if (sheet.ownerNode) { 6435 sheet.ownerNode.remove(); 6436 } // remove win event listeners 6437 6438 6439 removeEvents(win, { 6440 'resize': onResize 6441 }); // arrowKeys, controls, nav 6442 6443 if (arrowKeys) { 6444 removeEvents(doc, docmentKeydownEvent); 6445 } 6446 6447 if (controlsContainer) { 6448 removeEvents(controlsContainer, controlsEvents); 6449 } 6450 6451 if (navContainer) { 6452 removeEvents(navContainer, navEvents); 6453 } // autoplay 6454 6455 6456 removeEvents(container, hoverEvents); 6457 removeEvents(container, visibilityEvent); 6458 6459 if (autoplayButton) { 6460 removeEvents(autoplayButton, { 6461 'click': toggleAutoplay 6462 }); 6463 } 6464 6465 if (autoplay) { 6466 clearInterval(autoplayTimer); 6467 } // container 6468 6469 6470 if (carousel && TRANSITIONEND) { 6471 var eve = {}; 6472 eve[TRANSITIONEND] = onTransitionEnd; 6473 removeEvents(container, eve); 6474 } 6475 6476 if (touch) { 6477 removeEvents(container, touchEvents); 6478 } 6479 6480 if (mouseDrag) { 6481 removeEvents(container, dragEvents); 6482 } // cache Object values in options && reset HTML 6483 6484 6485 var htmlList = [containerHTML, controlsContainerHTML, prevButtonHTML, nextButtonHTML, navContainerHTML, autoplayButtonHTML]; 6486 tnsList.forEach(function (item, i) { 6487 var el = item === 'container' ? outerWrapper : options[item]; 6488 6489 if (typeof el === 'object' && el) { 6490 var prevEl = el.previousElementSibling ? el.previousElementSibling : false, 6491 parentEl = el.parentNode; 6492 el.outerHTML = htmlList[i]; 6493 options[item] = prevEl ? prevEl.nextElementSibling : parentEl.firstElementChild; 6494 } 6495 }); // reset variables 6496 6497 tnsList = animateIn = animateOut = animateDelay = animateNormal = horizontal = outerWrapper = innerWrapper = container = containerParent = containerHTML = slideItems = slideCount = breakpointZone = windowWidth = autoWidth = fixedWidth = edgePadding = gutter = viewport = items = slideBy = viewportMax = arrowKeys = speed = rewind = loop = autoHeight = sheet = lazyload = slidePositions = slideItemsOut = cloneCount = slideCountNew = hasRightDeadZone = rightBoundary = updateIndexBeforeTransform = transformAttr = transformPrefix = transformPostfix = getIndexMax = index = indexCached = indexMin = indexMax = swipeAngle = moveDirectionExpected = running = onInit = events = newContainerClasses = slideId = disable = disabled = freezable = freeze = frozen = controlsEvents = navEvents = hoverEvents = visibilityEvent = docmentKeydownEvent = touchEvents = dragEvents = hasControls = hasNav = navAsThumbnails = hasAutoplay = hasTouch = hasMouseDrag = slideActiveClass = imgCompleteClass = imgEvents = imgsComplete = controls = controlsText = controlsContainer = controlsContainerHTML = prevButton = nextButton = prevIsButton = nextIsButton = nav = navContainer = navContainerHTML = navItems = pages = pagesCached = navClicked = navCurrentIndex = navCurrentIndexCached = navActiveClass = navStr = navStrCurrent = autoplay = autoplayTimeout = autoplayDirection = autoplayText = autoplayHoverPause = autoplayButton = autoplayButtonHTML = autoplayResetOnVisibility = autoplayHtmlStrings = autoplayTimer = animating = autoplayHoverPaused = autoplayUserPaused = autoplayVisibilityPaused = initPosition = lastPosition = translateInit = panStart = rafIndex = getDist = touch = mouseDrag = null; // check variables 6498 // [animateIn, animateOut, animateDelay, animateNormal, horizontal, outerWrapper, innerWrapper, container, containerParent, containerHTML, slideItems, slideCount, breakpointZone, windowWidth, autoWidth, fixedWidth, edgePadding, gutter, viewport, items, slideBy, viewportMax, arrowKeys, speed, rewind, loop, autoHeight, sheet, lazyload, slidePositions, slideItemsOut, cloneCount, slideCountNew, hasRightDeadZone, rightBoundary, updateIndexBeforeTransform, transformAttr, transformPrefix, transformPostfix, getIndexMax, index, indexCached, indexMin, indexMax, resizeTimer, swipeAngle, moveDirectionExpected, running, onInit, events, newContainerClasses, slideId, disable, disabled, freezable, freeze, frozen, controlsEvents, navEvents, hoverEvents, visibilityEvent, docmentKeydownEvent, touchEvents, dragEvents, hasControls, hasNav, navAsThumbnails, hasAutoplay, hasTouch, hasMouseDrag, slideActiveClass, imgCompleteClass, imgEvents, imgsComplete, controls, controlsText, controlsContainer, controlsContainerHTML, prevButton, nextButton, prevIsButton, nextIsButton, nav, navContainer, navContainerHTML, navItems, pages, pagesCached, navClicked, navCurrentIndex, navCurrentIndexCached, navActiveClass, navStr, navStrCurrent, autoplay, autoplayTimeout, autoplayDirection, autoplayText, autoplayHoverPause, autoplayButton, autoplayButtonHTML, autoplayResetOnVisibility, autoplayHtmlStrings, autoplayTimer, animating, autoplayHoverPaused, autoplayUserPaused, autoplayVisibilityPaused, initPosition, lastPosition, translateInit, disX, disY, panStart, rafIndex, getDist, touch, mouseDrag ].forEach(function(item) { if (item !== null) { console.log(item); } }); 6499 6500 for (var a in this) { 6501 if (a !== 'rebuild') { 6502 this[a] = null; 6503 } 6504 } 6505 6506 isOn = false; 6507 } // === ON RESIZE === 6508 // responsive || fixedWidth || autoWidth || !horizontal 6509 6510 6511 function onResize(e) { 6512 raf(function () { 6513 resizeTasks(getEvent(e)); 6514 }); 6515 } 6516 6517 function resizeTasks(e) { 6518 if (!isOn) { 6519 return; 6520 } 6521 6522 if (nested === 'outer') { 6523 events.emit('outerResized', info(e)); 6524 } 6525 6526 windowWidth = getWindowWidth(); 6527 var bpChanged, 6528 breakpointZoneTem = breakpointZone, 6529 needContainerTransform = false; 6530 6531 if (responsive) { 6532 setBreakpointZone(); 6533 bpChanged = breakpointZoneTem !== breakpointZone; // if (hasRightDeadZone) { needContainerTransform = true; } // *? 6534 6535 if (bpChanged) { 6536 events.emit('newBreakpointStart', info(e)); 6537 } 6538 } 6539 6540 var indChanged, 6541 itemsChanged, 6542 itemsTem = items, 6543 disableTem = disable, 6544 freezeTem = freeze, 6545 arrowKeysTem = arrowKeys, 6546 controlsTem = controls, 6547 navTem = nav, 6548 touchTem = touch, 6549 mouseDragTem = mouseDrag, 6550 autoplayTem = autoplay, 6551 autoplayHoverPauseTem = autoplayHoverPause, 6552 autoplayResetOnVisibilityTem = autoplayResetOnVisibility, 6553 indexTem = index; 6554 6555 if (bpChanged) { 6556 var fixedWidthTem = fixedWidth, 6557 autoHeightTem = autoHeight, 6558 controlsTextTem = controlsText, 6559 centerTem = center, 6560 autoplayTextTem = autoplayText; 6561 6562 if (!CSSMQ) { 6563 var gutterTem = gutter, 6564 edgePaddingTem = edgePadding; 6565 } 6566 } // get option: 6567 // fixed width: viewport, fixedWidth, gutter => items 6568 // others: window width => all variables 6569 // all: items => slideBy 6570 6571 6572 arrowKeys = getOption('arrowKeys'); 6573 controls = getOption('controls'); 6574 nav = getOption('nav'); 6575 touch = getOption('touch'); 6576 center = getOption('center'); 6577 mouseDrag = getOption('mouseDrag'); 6578 autoplay = getOption('autoplay'); 6579 autoplayHoverPause = getOption('autoplayHoverPause'); 6580 autoplayResetOnVisibility = getOption('autoplayResetOnVisibility'); 6581 6582 if (bpChanged) { 6583 disable = getOption('disable'); 6584 fixedWidth = getOption('fixedWidth'); 6585 speed = getOption('speed'); 6586 autoHeight = getOption('autoHeight'); 6587 controlsText = getOption('controlsText'); 6588 autoplayText = getOption('autoplayText'); 6589 autoplayTimeout = getOption('autoplayTimeout'); 6590 6591 if (!CSSMQ) { 6592 edgePadding = getOption('edgePadding'); 6593 gutter = getOption('gutter'); 6594 } 6595 } // update options 6596 6597 6598 resetVariblesWhenDisable(disable); 6599 viewport = getViewportWidth(); // <= edgePadding, gutter 6600 6601 if ((!horizontal || autoWidth) && !disable) { 6602 setSlidePositions(); 6603 6604 if (!horizontal) { 6605 updateContentWrapperHeight(); // <= setSlidePositions 6606 6607 needContainerTransform = true; 6608 } 6609 } 6610 6611 if (fixedWidth || autoWidth) { 6612 rightBoundary = getRightBoundary(); // autoWidth: <= viewport, slidePositions, gutter 6613 // fixedWidth: <= viewport, fixedWidth, gutter 6614 6615 indexMax = getIndexMax(); // autoWidth: <= rightBoundary, slidePositions 6616 // fixedWidth: <= rightBoundary, fixedWidth, gutter 6617 } 6618 6619 if (bpChanged || fixedWidth) { 6620 items = getOption('items'); 6621 slideBy = getOption('slideBy'); 6622 itemsChanged = items !== itemsTem; 6623 6624 if (itemsChanged) { 6625 if (!fixedWidth && !autoWidth) { 6626 indexMax = getIndexMax(); 6627 } // <= items 6628 // check index before transform in case 6629 // slider reach the right edge then items become bigger 6630 6631 6632 updateIndex(); 6633 } 6634 } 6635 6636 if (bpChanged) { 6637 if (disable !== disableTem) { 6638 if (disable) { 6639 disableSlider(); 6640 } else { 6641 enableSlider(); // <= slidePositions, rightBoundary, indexMax 6642 } 6643 } 6644 } 6645 6646 if (freezable && (bpChanged || fixedWidth || autoWidth)) { 6647 freeze = getFreeze(); // <= autoWidth: slidePositions, gutter, viewport, rightBoundary 6648 // <= fixedWidth: fixedWidth, gutter, rightBoundary 6649 // <= others: items 6650 6651 if (freeze !== freezeTem) { 6652 if (freeze) { 6653 doContainerTransform(getContainerTransformValue(getStartIndex(0))); 6654 freezeSlider(); 6655 } else { 6656 unfreezeSlider(); 6657 needContainerTransform = true; 6658 } 6659 } 6660 } 6661 6662 resetVariblesWhenDisable(disable || freeze); // controls, nav, touch, mouseDrag, arrowKeys, autoplay, autoplayHoverPause, autoplayResetOnVisibility 6663 6664 if (!autoplay) { 6665 autoplayHoverPause = autoplayResetOnVisibility = false; 6666 } 6667 6668 if (arrowKeys !== arrowKeysTem) { 6669 arrowKeys ? addEvents(doc, docmentKeydownEvent) : removeEvents(doc, docmentKeydownEvent); 6670 } 6671 6672 if (controls !== controlsTem) { 6673 if (controls) { 6674 if (controlsContainer) { 6675 showElement(controlsContainer); 6676 } else { 6677 if (prevButton) { 6678 showElement(prevButton); 6679 } 6680 6681 if (nextButton) { 6682 showElement(nextButton); 6683 } 6684 } 6685 } else { 6686 if (controlsContainer) { 6687 hideElement(controlsContainer); 6688 } else { 6689 if (prevButton) { 6690 hideElement(prevButton); 6691 } 6692 6693 if (nextButton) { 6694 hideElement(nextButton); 6695 } 6696 } 6697 } 6698 } 6699 6700 if (nav !== navTem) { 6701 if (nav) { 6702 showElement(navContainer); 6703 updateNavVisibility(); 6704 } else { 6705 hideElement(navContainer); 6706 } 6707 } 6708 6709 if (touch !== touchTem) { 6710 touch ? addEvents(container, touchEvents, options.preventScrollOnTouch) : removeEvents(container, touchEvents); 6711 } 6712 6713 if (mouseDrag !== mouseDragTem) { 6714 mouseDrag ? addEvents(container, dragEvents) : removeEvents(container, dragEvents); 6715 } 6716 6717 if (autoplay !== autoplayTem) { 6718 if (autoplay) { 6719 if (autoplayButton) { 6720 showElement(autoplayButton); 6721 } 6722 6723 if (!animating && !autoplayUserPaused) { 6724 startAutoplay(); 6725 } 6726 } else { 6727 if (autoplayButton) { 6728 hideElement(autoplayButton); 6729 } 6730 6731 if (animating) { 6732 stopAutoplay(); 6733 } 6734 } 6735 } 6736 6737 if (autoplayHoverPause !== autoplayHoverPauseTem) { 6738 autoplayHoverPause ? addEvents(container, hoverEvents) : removeEvents(container, hoverEvents); 6739 } 6740 6741 if (autoplayResetOnVisibility !== autoplayResetOnVisibilityTem) { 6742 autoplayResetOnVisibility ? addEvents(doc, visibilityEvent) : removeEvents(doc, visibilityEvent); 6743 } 6744 6745 if (bpChanged) { 6746 if (fixedWidth !== fixedWidthTem || center !== centerTem) { 6747 needContainerTransform = true; 6748 } 6749 6750 if (autoHeight !== autoHeightTem) { 6751 if (!autoHeight) { 6752 innerWrapper.style.height = ''; 6753 } 6754 } 6755 6756 if (controls && controlsText !== controlsTextTem) { 6757 prevButton.innerHTML = controlsText[0]; 6758 nextButton.innerHTML = controlsText[1]; 6759 } 6760 6761 if (autoplayButton && autoplayText !== autoplayTextTem) { 6762 var i = autoplay ? 1 : 0, 6763 html = autoplayButton.innerHTML, 6764 len = html.length - autoplayTextTem[i].length; 6765 6766 if (html.substring(len) === autoplayTextTem[i]) { 6767 autoplayButton.innerHTML = html.substring(0, len) + autoplayText[i]; 6768 } 6769 } 6770 } else { 6771 if (center && (fixedWidth || autoWidth)) { 6772 needContainerTransform = true; 6773 } 6774 } 6775 6776 if (itemsChanged || fixedWidth && !autoWidth) { 6777 pages = getPages(); 6778 updateNavVisibility(); 6779 } 6780 6781 indChanged = index !== indexTem; 6782 6783 if (indChanged) { 6784 events.emit('indexChanged', info()); 6785 needContainerTransform = true; 6786 } else if (itemsChanged) { 6787 if (!indChanged) { 6788 additionalUpdates(); 6789 } 6790 } else if (fixedWidth || autoWidth) { 6791 doLazyLoad(); 6792 updateSlideStatus(); 6793 updateLiveRegion(); 6794 } 6795 6796 if (itemsChanged && !carousel) { 6797 updateGallerySlidePositions(); 6798 } 6799 6800 if (!disable && !freeze) { 6801 // non-mediaqueries: IE8 6802 if (bpChanged && !CSSMQ) { 6803 // middle wrapper styles 6804 // inner wrapper styles 6805 if (edgePadding !== edgePaddingTem || gutter !== gutterTem) { 6806 innerWrapper.style.cssText = getInnerWrapperStyles(edgePadding, gutter, fixedWidth, speed, autoHeight); 6807 } 6808 6809 if (horizontal) { 6810 // container styles 6811 if (carousel) { 6812 container.style.width = getContainerWidth(fixedWidth, gutter, items); 6813 } // slide styles 6814 6815 6816 var str = getSlideWidthStyle(fixedWidth, gutter, items) + getSlideGutterStyle(gutter); // remove the last line and 6817 // add new styles 6818 6819 removeCSSRule(sheet, getCssRulesLength(sheet) - 1); 6820 addCSSRule(sheet, '#' + slideId + ' > .tns-item', str, getCssRulesLength(sheet)); 6821 } 6822 } // auto height 6823 6824 6825 if (autoHeight) { 6826 doAutoHeight(); 6827 } 6828 6829 if (needContainerTransform) { 6830 doContainerTransformSilent(); 6831 indexCached = index; 6832 } 6833 } 6834 6835 if (bpChanged) { 6836 events.emit('newBreakpointEnd', info(e)); 6837 } 6838 } // === INITIALIZATION FUNCTIONS === // 6839 6840 6841 function getFreeze() { 6842 if (!fixedWidth && !autoWidth) { 6843 var a = center ? items - (items - 1) / 2 : items; 6844 return slideCount <= a; 6845 } 6846 6847 var width = fixedWidth ? (fixedWidth + gutter) * slideCount : slidePositions[slideCount], 6848 vp = edgePadding ? viewport + edgePadding * 2 : viewport + gutter; 6849 6850 if (center) { 6851 vp -= fixedWidth ? (viewport - fixedWidth) / 2 : (viewport - (slidePositions[index + 1] - slidePositions[index] - gutter)) / 2; 6852 } 6853 6854 return width <= vp; 6855 } 6856 6857 function setBreakpointZone() { 6858 breakpointZone = 0; 6859 6860 for (var bp in responsive) { 6861 bp = parseInt(bp); // convert string to number 6862 6863 if (windowWidth >= bp) { 6864 breakpointZone = bp; 6865 } 6866 } 6867 } // (slideBy, indexMin, indexMax) => index 6868 6869 6870 var updateIndex = function () { 6871 return loop ? carousel ? // loop + carousel 6872 function () { 6873 var leftEdge = indexMin, 6874 rightEdge = indexMax; 6875 leftEdge += slideBy; 6876 rightEdge -= slideBy; // adjust edges when has edge paddings 6877 // or fixed-width slider with extra space on the right side 6878 6879 if (edgePadding) { 6880 leftEdge += 1; 6881 rightEdge -= 1; 6882 } else if (fixedWidth) { 6883 if ((viewport + gutter) % (fixedWidth + gutter)) { 6884 rightEdge -= 1; 6885 } 6886 } 6887 6888 if (cloneCount) { 6889 if (index > rightEdge) { 6890 index -= slideCount; 6891 } else if (index < leftEdge) { 6892 index += slideCount; 6893 } 6894 } 6895 } : // loop + gallery 6896 function () { 6897 if (index > indexMax) { 6898 while (index >= indexMin + slideCount) { 6899 index -= slideCount; 6900 } 6901 } else if (index < indexMin) { 6902 while (index <= indexMax - slideCount) { 6903 index += slideCount; 6904 } 6905 } 6906 } : // non-loop 6907 function () { 6908 index = Math.max(indexMin, Math.min(indexMax, index)); 6909 }; 6910 }(); 6911 6912 function disableUI() { 6913 if (!autoplay && autoplayButton) { 6914 hideElement(autoplayButton); 6915 } 6916 6917 if (!nav && navContainer) { 6918 hideElement(navContainer); 6919 } 6920 6921 if (!controls) { 6922 if (controlsContainer) { 6923 hideElement(controlsContainer); 6924 } else { 6925 if (prevButton) { 6926 hideElement(prevButton); 6927 } 6928 6929 if (nextButton) { 6930 hideElement(nextButton); 6931 } 6932 } 6933 } 6934 } 6935 6936 function enableUI() { 6937 if (autoplay && autoplayButton) { 6938 showElement(autoplayButton); 6939 } 6940 6941 if (nav && navContainer) { 6942 showElement(navContainer); 6943 } 6944 6945 if (controls) { 6946 if (controlsContainer) { 6947 showElement(controlsContainer); 6948 } else { 6949 if (prevButton) { 6950 showElement(prevButton); 6951 } 6952 6953 if (nextButton) { 6954 showElement(nextButton); 6955 } 6956 } 6957 } 6958 } 6959 6960 function freezeSlider() { 6961 if (frozen) { 6962 return; 6963 } // remove edge padding from inner wrapper 6964 6965 6966 if (edgePadding) { 6967 innerWrapper.style.margin = '0px'; 6968 } // add class tns-transparent to cloned slides 6969 6970 6971 if (cloneCount) { 6972 var str = 'tns-transparent'; 6973 6974 for (var i = cloneCount; i--;) { 6975 if (carousel) { 6976 addClass(slideItems[i], str); 6977 } 6978 6979 addClass(slideItems[slideCountNew - i - 1], str); 6980 } 6981 } // update tools 6982 6983 6984 disableUI(); 6985 frozen = true; 6986 } 6987 6988 function unfreezeSlider() { 6989 if (!frozen) { 6990 return; 6991 } // restore edge padding for inner wrapper 6992 // for mordern browsers 6993 6994 6995 if (edgePadding && CSSMQ) { 6996 innerWrapper.style.margin = ''; 6997 } // remove class tns-transparent to cloned slides 6998 6999 7000 if (cloneCount) { 7001 var str = 'tns-transparent'; 7002 7003 for (var i = cloneCount; i--;) { 7004 if (carousel) { 7005 removeClass(slideItems[i], str); 7006 } 7007 7008 removeClass(slideItems[slideCountNew - i - 1], str); 7009 } 7010 } // update tools 7011 7012 7013 enableUI(); 7014 frozen = false; 7015 } 7016 7017 function disableSlider() { 7018 if (disabled) { 7019 return; 7020 } 7021 7022 sheet.disabled = true; 7023 container.className = container.className.replace(newContainerClasses.substring(1), ''); 7024 removeAttrs(container, ['style']); 7025 7026 if (loop) { 7027 for (var j = cloneCount; j--;) { 7028 if (carousel) { 7029 hideElement(slideItems[j]); 7030 } 7031 7032 hideElement(slideItems[slideCountNew - j - 1]); 7033 } 7034 } // vertical slider 7035 7036 7037 if (!horizontal || !carousel) { 7038 removeAttrs(innerWrapper, ['style']); 7039 } // gallery 7040 7041 7042 if (!carousel) { 7043 for (var i = index, l = index + slideCount; i < l; i++) { 7044 var item = slideItems[i]; 7045 removeAttrs(item, ['style']); 7046 removeClass(item, animateIn); 7047 removeClass(item, animateNormal); 7048 } 7049 } // update tools 7050 7051 7052 disableUI(); 7053 disabled = true; 7054 } 7055 7056 function enableSlider() { 7057 if (!disabled) { 7058 return; 7059 } 7060 7061 sheet.disabled = false; 7062 container.className += newContainerClasses; 7063 doContainerTransformSilent(); 7064 7065 if (loop) { 7066 for (var j = cloneCount; j--;) { 7067 if (carousel) { 7068 showElement(slideItems[j]); 7069 } 7070 7071 showElement(slideItems[slideCountNew - j - 1]); 7072 } 7073 } // gallery 7074 7075 7076 if (!carousel) { 7077 for (var i = index, l = index + slideCount; i < l; i++) { 7078 var item = slideItems[i], 7079 classN = i < index + items ? animateIn : animateNormal; 7080 item.style.left = (i - index) * 100 / items + '%'; 7081 addClass(item, classN); 7082 } 7083 } // update tools 7084 7085 7086 enableUI(); 7087 disabled = false; 7088 } 7089 7090 function updateLiveRegion() { 7091 var str = getLiveRegionStr(); 7092 7093 if (liveregionCurrent.innerHTML !== str) { 7094 liveregionCurrent.innerHTML = str; 7095 } 7096 } 7097 7098 function getLiveRegionStr() { 7099 var arr = getVisibleSlideRange(), 7100 start = arr[0] + 1, 7101 end = arr[1] + 1; 7102 return start === end ? start + '' : start + ' to ' + end; 7103 } 7104 7105 function getVisibleSlideRange(val) { 7106 if (val == null) { 7107 val = getContainerTransformValue(); 7108 } 7109 7110 var start = index, 7111 end, 7112 rangestart, 7113 rangeend; // get range start, range end for autoWidth and fixedWidth 7114 7115 if (center || edgePadding) { 7116 if (autoWidth || fixedWidth) { 7117 rangestart = -(parseFloat(val) + edgePadding); 7118 rangeend = rangestart + viewport + edgePadding * 2; 7119 } 7120 } else { 7121 if (autoWidth) { 7122 rangestart = slidePositions[index]; 7123 rangeend = rangestart + viewport; 7124 } 7125 } // get start, end 7126 // - check auto width 7127 7128 7129 if (autoWidth) { 7130 slidePositions.forEach(function (point, i) { 7131 if (i < slideCountNew) { 7132 if ((center || edgePadding) && point <= rangestart + 0.5) { 7133 start = i; 7134 } 7135 7136 if (rangeend - point >= 0.5) { 7137 end = i; 7138 } 7139 } 7140 }); // - check percentage width, fixed width 7141 } else { 7142 if (fixedWidth) { 7143 var cell = fixedWidth + gutter; 7144 7145 if (center || edgePadding) { 7146 start = Math.floor(rangestart / cell); 7147 end = Math.ceil(rangeend / cell - 1); 7148 } else { 7149 end = start + Math.ceil(viewport / cell) - 1; 7150 } 7151 } else { 7152 if (center || edgePadding) { 7153 var a = items - 1; 7154 7155 if (center) { 7156 start -= a / 2; 7157 end = index + a / 2; 7158 } else { 7159 end = index + a; 7160 } 7161 7162 if (edgePadding) { 7163 var b = edgePadding * items / viewport; 7164 start -= b; 7165 end += b; 7166 } 7167 7168 start = Math.floor(start); 7169 end = Math.ceil(end); 7170 } else { 7171 end = start + items - 1; 7172 } 7173 } 7174 7175 start = Math.max(start, 0); 7176 end = Math.min(end, slideCountNew - 1); 7177 } 7178 7179 return [start, end]; 7180 } 7181 7182 function doLazyLoad() { 7183 if (lazyload && !disable) { 7184 var arg = getVisibleSlideRange(); 7185 arg.push(lazyloadSelector); 7186 getImageArray.apply(null, arg).forEach(function (img) { 7187 if (!hasClass(img, imgCompleteClass)) { 7188 // stop propagation transitionend event to container 7189 var eve = {}; 7190 7191 eve[TRANSITIONEND] = function (e) { 7192 e.stopPropagation(); 7193 }; 7194 7195 addEvents(img, eve); 7196 addEvents(img, imgEvents); // update src 7197 7198 img.src = getAttr(img, 'data-src'); // update srcset 7199 7200 var srcset = getAttr(img, 'data-srcset'); 7201 7202 if (srcset) { 7203 img.srcset = srcset; 7204 } 7205 7206 addClass(img, 'loading'); 7207 } 7208 }); 7209 } 7210 } 7211 7212 function onImgLoaded(e) { 7213 imgLoaded(getTarget(e)); 7214 } 7215 7216 function onImgFailed(e) { 7217 imgFailed(getTarget(e)); 7218 } 7219 7220 function imgLoaded(img) { 7221 addClass(img, 'loaded'); 7222 imgCompleted(img); 7223 } 7224 7225 function imgFailed(img) { 7226 addClass(img, 'failed'); 7227 imgCompleted(img); 7228 } 7229 7230 function imgCompleted(img) { 7231 addClass(img, imgCompleteClass); 7232 removeClass(img, 'loading'); 7233 removeEvents(img, imgEvents); 7234 } 7235 7236 function getImageArray(start, end, imgSelector) { 7237 var imgs = []; 7238 7239 if (!imgSelector) { 7240 imgSelector = 'img'; 7241 } 7242 7243 while (start <= end) { 7244 forEach(slideItems[start].querySelectorAll(imgSelector), function (img) { 7245 imgs.push(img); 7246 }); 7247 start++; 7248 } 7249 7250 return imgs; 7251 } // check if all visible images are loaded 7252 // and update container height if it's done 7253 7254 7255 function doAutoHeight() { 7256 var imgs = getImageArray.apply(null, getVisibleSlideRange()); 7257 raf(function () { 7258 imgsLoadedCheck(imgs, updateInnerWrapperHeight); 7259 }); 7260 } 7261 7262 function imgsLoadedCheck(imgs, cb) { 7263 // execute callback function if all images are complete 7264 if (imgsComplete) { 7265 return cb(); 7266 } // check image classes 7267 7268 7269 imgs.forEach(function (img, index) { 7270 if (!lazyload && img.complete) { 7271 imgCompleted(img); 7272 } // Check image.complete 7273 7274 7275 if (hasClass(img, imgCompleteClass)) { 7276 imgs.splice(index, 1); 7277 } 7278 }); // execute callback function if selected images are all complete 7279 7280 if (!imgs.length) { 7281 return cb(); 7282 } // otherwise execute this functiona again 7283 7284 7285 raf(function () { 7286 imgsLoadedCheck(imgs, cb); 7287 }); 7288 } 7289 7290 function additionalUpdates() { 7291 doLazyLoad(); 7292 updateSlideStatus(); 7293 updateLiveRegion(); 7294 updateControlsStatus(); 7295 updateNavStatus(); 7296 } 7297 7298 function update_carousel_transition_duration() { 7299 if (carousel && autoHeight) { 7300 middleWrapper.style[TRANSITIONDURATION] = speed / 1000 + 's'; 7301 } 7302 } 7303 7304 function getMaxSlideHeight(slideStart, slideRange) { 7305 var heights = []; 7306 7307 for (var i = slideStart, l = Math.min(slideStart + slideRange, slideCountNew); i < l; i++) { 7308 heights.push(slideItems[i].offsetHeight); 7309 } 7310 7311 return Math.max.apply(null, heights); 7312 } // update inner wrapper height 7313 // 1. get the max-height of the visible slides 7314 // 2. set transitionDuration to speed 7315 // 3. update inner wrapper height to max-height 7316 // 4. set transitionDuration to 0s after transition done 7317 7318 7319 function updateInnerWrapperHeight() { 7320 var maxHeight = autoHeight ? getMaxSlideHeight(index, items) : getMaxSlideHeight(cloneCount, slideCount), 7321 wp = middleWrapper ? middleWrapper : innerWrapper; 7322 7323 if (wp.style.height !== maxHeight) { 7324 wp.style.height = maxHeight + 'px'; 7325 } 7326 } // get the distance from the top edge of the first slide to each slide 7327 // (init) => slidePositions 7328 7329 7330 function setSlidePositions() { 7331 slidePositions = [0]; 7332 var attr = horizontal ? 'left' : 'top', 7333 attr2 = horizontal ? 'right' : 'bottom', 7334 base = slideItems[0].getBoundingClientRect()[attr]; 7335 forEach(slideItems, function (item, i) { 7336 // skip the first slide 7337 if (i) { 7338 slidePositions.push(item.getBoundingClientRect()[attr] - base); 7339 } // add the end edge 7340 7341 7342 if (i === slideCountNew - 1) { 7343 slidePositions.push(item.getBoundingClientRect()[attr2] - base); 7344 } 7345 }); 7346 } // update slide 7347 7348 7349 function updateSlideStatus() { 7350 var range = getVisibleSlideRange(), 7351 start = range[0], 7352 end = range[1]; 7353 forEach(slideItems, function (item, i) { 7354 // show slides 7355 if (i >= start && i <= end) { 7356 if (hasAttr(item, 'aria-hidden')) { 7357 removeAttrs(item, ['aria-hidden', 'tabindex']); 7358 addClass(item, slideActiveClass); 7359 } // hide slides 7360 7361 } else { 7362 if (!hasAttr(item, 'aria-hidden')) { 7363 setAttrs(item, { 7364 'aria-hidden': 'true', 7365 'tabindex': '-1' 7366 }); 7367 removeClass(item, slideActiveClass); 7368 } 7369 } 7370 }); 7371 } // gallery: update slide position 7372 7373 7374 function updateGallerySlidePositions() { 7375 var l = index + Math.min(slideCount, items); 7376 7377 for (var i = slideCountNew; i--;) { 7378 var item = slideItems[i]; 7379 7380 if (i >= index && i < l) { 7381 // add transitions to visible slides when adjusting their positions 7382 addClass(item, 'tns-moving'); 7383 item.style.left = (i - index) * 100 / items + '%'; 7384 addClass(item, animateIn); 7385 removeClass(item, animateNormal); 7386 } else if (item.style.left) { 7387 item.style.left = ''; 7388 addClass(item, animateNormal); 7389 removeClass(item, animateIn); 7390 } // remove outlet animation 7391 7392 7393 removeClass(item, animateOut); 7394 } // removing '.tns-moving' 7395 7396 7397 setTimeout(function () { 7398 forEach(slideItems, function (el) { 7399 removeClass(el, 'tns-moving'); 7400 }); 7401 }, 300); 7402 } // set tabindex on Nav 7403 7404 7405 function updateNavStatus() { 7406 // get current nav 7407 if (nav) { 7408 navCurrentIndex = navClicked >= 0 ? navClicked : getCurrentNavIndex(); 7409 navClicked = -1; 7410 7411 if (navCurrentIndex !== navCurrentIndexCached) { 7412 var navPrev = navItems[navCurrentIndexCached], 7413 navCurrent = navItems[navCurrentIndex]; 7414 setAttrs(navPrev, { 7415 'tabindex': '-1', 7416 'aria-label': navStr + (navCurrentIndexCached + 1) 7417 }); 7418 removeClass(navPrev, navActiveClass); 7419 setAttrs(navCurrent, { 7420 'aria-label': navStr + (navCurrentIndex + 1) + navStrCurrent 7421 }); 7422 removeAttrs(navCurrent, 'tabindex'); 7423 addClass(navCurrent, navActiveClass); 7424 navCurrentIndexCached = navCurrentIndex; 7425 } 7426 } 7427 } 7428 7429 function getLowerCaseNodeName(el) { 7430 return el.nodeName.toLowerCase(); 7431 } 7432 7433 function isButton(el) { 7434 return getLowerCaseNodeName(el) === 'button'; 7435 } 7436 7437 function isAriaDisabled(el) { 7438 return el.getAttribute('aria-disabled') === 'true'; 7439 } 7440 7441 function disEnableElement(isButton, el, val) { 7442 if (isButton) { 7443 el.disabled = val; 7444 } else { 7445 el.setAttribute('aria-disabled', val.toString()); 7446 } 7447 } // set 'disabled' to true on controls when reach the edges 7448 7449 7450 function updateControlsStatus() { 7451 if (!controls || rewind || loop) { 7452 return; 7453 } 7454 7455 var prevDisabled = prevIsButton ? prevButton.disabled : isAriaDisabled(prevButton), 7456 nextDisabled = nextIsButton ? nextButton.disabled : isAriaDisabled(nextButton), 7457 disablePrev = index <= indexMin ? true : false, 7458 disableNext = !rewind && index >= indexMax ? true : false; 7459 7460 if (disablePrev && !prevDisabled) { 7461 disEnableElement(prevIsButton, prevButton, true); 7462 } 7463 7464 if (!disablePrev && prevDisabled) { 7465 disEnableElement(prevIsButton, prevButton, false); 7466 } 7467 7468 if (disableNext && !nextDisabled) { 7469 disEnableElement(nextIsButton, nextButton, true); 7470 } 7471 7472 if (!disableNext && nextDisabled) { 7473 disEnableElement(nextIsButton, nextButton, false); 7474 } 7475 } // set duration 7476 7477 7478 function resetDuration(el, str) { 7479 if (TRANSITIONDURATION) { 7480 el.style[TRANSITIONDURATION] = str; 7481 } 7482 } 7483 7484 function getSliderWidth() { 7485 return fixedWidth ? (fixedWidth + gutter) * slideCountNew : slidePositions[slideCountNew]; 7486 } 7487 7488 function getCenterGap(num) { 7489 if (num == null) { 7490 num = index; 7491 } 7492 7493 var gap = edgePadding ? gutter : 0; 7494 return autoWidth ? (viewport - gap - (slidePositions[num + 1] - slidePositions[num] - gutter)) / 2 : fixedWidth ? (viewport - fixedWidth) / 2 : (items - 1) / 2; 7495 } 7496 7497 function getRightBoundary() { 7498 var gap = edgePadding ? gutter : 0, 7499 result = viewport + gap - getSliderWidth(); 7500 7501 if (center && !loop) { 7502 result = fixedWidth ? -(fixedWidth + gutter) * (slideCountNew - 1) - getCenterGap() : getCenterGap(slideCountNew - 1) - slidePositions[slideCountNew - 1]; 7503 } 7504 7505 if (result > 0) { 7506 result = 0; 7507 } 7508 7509 return result; 7510 } 7511 7512 function getContainerTransformValue(num) { 7513 if (num == null) { 7514 num = index; 7515 } 7516 7517 var val; 7518 7519 if (horizontal && !autoWidth) { 7520 if (fixedWidth) { 7521 val = -(fixedWidth + gutter) * num; 7522 7523 if (center) { 7524 val += getCenterGap(); 7525 } 7526 } else { 7527 var denominator = TRANSFORM ? slideCountNew : items; 7528 7529 if (center) { 7530 num -= getCenterGap(); 7531 } 7532 7533 val = -num * 100 / denominator; 7534 } 7535 } else { 7536 val = -slidePositions[num]; 7537 7538 if (center && autoWidth) { 7539 val += getCenterGap(); 7540 } 7541 } 7542 7543 if (hasRightDeadZone) { 7544 val = Math.max(val, rightBoundary); 7545 } 7546 7547 val += horizontal && !autoWidth && !fixedWidth ? '%' : 'px'; 7548 return val; 7549 } 7550 7551 function doContainerTransformSilent(val) { 7552 resetDuration(container, '0s'); 7553 doContainerTransform(val); 7554 } 7555 7556 function doContainerTransform(val) { 7557 if (val == null) { 7558 val = getContainerTransformValue(); 7559 } 7560 7561 container.style[transformAttr] = transformPrefix + val + transformPostfix; 7562 } 7563 7564 function animateSlide(number, classOut, classIn, isOut) { 7565 var l = number + items; 7566 7567 if (!loop) { 7568 l = Math.min(l, slideCountNew); 7569 } 7570 7571 for (var i = number; i < l; i++) { 7572 var item = slideItems[i]; // set item positions 7573 7574 if (!isOut) { 7575 item.style.left = (i - index) * 100 / items + '%'; 7576 } 7577 7578 if (animateDelay && TRANSITIONDELAY) { 7579 item.style[TRANSITIONDELAY] = item.style[ANIMATIONDELAY] = animateDelay * (i - number) / 1000 + 's'; 7580 } 7581 7582 removeClass(item, classOut); 7583 addClass(item, classIn); 7584 7585 if (isOut) { 7586 slideItemsOut.push(item); 7587 } 7588 } 7589 } // make transfer after click/drag: 7590 // 1. change 'transform' property for mordern browsers 7591 // 2. change 'left' property for legacy browsers 7592 7593 7594 var transformCore = function () { 7595 return carousel ? function () { 7596 resetDuration(container, ''); 7597 7598 if (TRANSITIONDURATION || !speed) { 7599 // for morden browsers with non-zero duration or 7600 // zero duration for all browsers 7601 doContainerTransform(); // run fallback function manually 7602 // when duration is 0 / container is hidden 7603 7604 if (!speed || !isVisible(container)) { 7605 onTransitionEnd(); 7606 } 7607 } else { 7608 // for old browser with non-zero duration 7609 jsTransform(container, transformAttr, transformPrefix, transformPostfix, getContainerTransformValue(), speed, onTransitionEnd); 7610 } 7611 7612 if (!horizontal) { 7613 updateContentWrapperHeight(); 7614 } 7615 } : function () { 7616 slideItemsOut = []; 7617 var eve = {}; 7618 eve[TRANSITIONEND] = eve[ANIMATIONEND] = onTransitionEnd; 7619 removeEvents(slideItems[indexCached], eve); 7620 addEvents(slideItems[index], eve); 7621 animateSlide(indexCached, animateIn, animateOut, true); 7622 animateSlide(index, animateNormal, animateIn); // run fallback function manually 7623 // when transition or animation not supported / duration is 0 7624 7625 if (!TRANSITIONEND || !ANIMATIONEND || !speed || !isVisible(container)) { 7626 onTransitionEnd(); 7627 } 7628 }; 7629 }(); 7630 7631 function render(e, sliderMoved) { 7632 if (updateIndexBeforeTransform) { 7633 updateIndex(); 7634 } // render when slider was moved (touch or drag) even though index may not change 7635 7636 7637 if (index !== indexCached || sliderMoved) { 7638 // events 7639 events.emit('indexChanged', info()); 7640 events.emit('transitionStart', info()); 7641 7642 if (autoHeight) { 7643 doAutoHeight(); 7644 } // pause autoplay when click or keydown from user 7645 7646 7647 if (animating && e && ['click', 'keydown'].indexOf(e.type) >= 0) { 7648 stopAutoplay(); 7649 } 7650 7651 running = true; 7652 transformCore(); 7653 } 7654 } 7655 /* 7656 * Transfer prefixed properties to the same format 7657 * CSS: -Webkit-Transform => webkittransform 7658 * JS: WebkitTransform => webkittransform 7659 * @param {string} str - property 7660 * 7661 */ 7662 7663 7664 function strTrans(str) { 7665 return str.toLowerCase().replace(/-/g, ''); 7666 } // AFTER TRANSFORM 7667 // Things need to be done after a transfer: 7668 // 1. check index 7669 // 2. add classes to visible slide 7670 // 3. disable controls buttons when reach the first/last slide in non-loop slider 7671 // 4. update nav status 7672 // 5. lazyload images 7673 // 6. update container height 7674 7675 7676 function onTransitionEnd(event) { 7677 // check running on gallery mode 7678 // make sure trantionend/animationend events run only once 7679 if (carousel || running) { 7680 events.emit('transitionEnd', info(event)); 7681 7682 if (!carousel && slideItemsOut.length > 0) { 7683 for (var i = 0; i < slideItemsOut.length; i++) { 7684 var item = slideItemsOut[i]; // set item positions 7685 7686 item.style.left = ''; 7687 7688 if (ANIMATIONDELAY && TRANSITIONDELAY) { 7689 item.style[ANIMATIONDELAY] = ''; 7690 item.style[TRANSITIONDELAY] = ''; 7691 } 7692 7693 removeClass(item, animateOut); 7694 addClass(item, animateNormal); 7695 } 7696 } 7697 /* update slides, nav, controls after checking ... 7698 * => legacy browsers who don't support 'event' 7699 * have to check event first, otherwise event.target will cause an error 7700 * => or 'gallery' mode: 7701 * + event target is slide item 7702 * => or 'carousel' mode: 7703 * + event target is container, 7704 * + event.property is the same with transform attribute 7705 */ 7706 7707 7708 if (!event || !carousel && event.target.parentNode === container || event.target === container && strTrans(event.propertyName) === strTrans(transformAttr)) { 7709 if (!updateIndexBeforeTransform) { 7710 var indexTem = index; 7711 updateIndex(); 7712 7713 if (index !== indexTem) { 7714 events.emit('indexChanged', info()); 7715 doContainerTransformSilent(); 7716 } 7717 } 7718 7719 if (nested === 'inner') { 7720 events.emit('innerLoaded', info()); 7721 } 7722 7723 running = false; 7724 indexCached = index; 7725 } 7726 } 7727 } // # ACTIONS 7728 7729 7730 function goTo(targetIndex, e) { 7731 if (freeze) { 7732 return; 7733 } // prev slideBy 7734 7735 7736 if (targetIndex === 'prev') { 7737 onControlsClick(e, -1); // next slideBy 7738 } else if (targetIndex === 'next') { 7739 onControlsClick(e, 1); // go to exact slide 7740 } else { 7741 if (running) { 7742 if (preventActionWhenRunning) { 7743 return; 7744 } else { 7745 onTransitionEnd(); 7746 } 7747 } 7748 7749 var absIndex = getAbsIndex(), 7750 indexGap = 0; 7751 7752 if (targetIndex === 'first') { 7753 indexGap = -absIndex; 7754 } else if (targetIndex === 'last') { 7755 indexGap = carousel ? slideCount - items - absIndex : slideCount - 1 - absIndex; 7756 } else { 7757 if (typeof targetIndex !== 'number') { 7758 targetIndex = parseInt(targetIndex); 7759 } 7760 7761 if (!isNaN(targetIndex)) { 7762 // from directly called goTo function 7763 if (!e) { 7764 targetIndex = Math.max(0, Math.min(slideCount - 1, targetIndex)); 7765 } 7766 7767 indexGap = targetIndex - absIndex; 7768 } 7769 } // gallery: make sure new page won't overlap with current page 7770 7771 7772 if (!carousel && indexGap && Math.abs(indexGap) < items) { 7773 var factor = indexGap > 0 ? 1 : -1; 7774 indexGap += index + indexGap - slideCount >= indexMin ? slideCount * factor : slideCount * 2 * factor * -1; 7775 } 7776 7777 index += indexGap; // make sure index is in range 7778 7779 if (carousel && loop) { 7780 if (index < indexMin) { 7781 index += slideCount; 7782 } 7783 7784 if (index > indexMax) { 7785 index -= slideCount; 7786 } 7787 } // if index is changed, start rendering 7788 7789 7790 if (getAbsIndex(index) !== getAbsIndex(indexCached)) { 7791 render(e); 7792 } 7793 } 7794 } // on controls click 7795 7796 7797 function onControlsClick(e, dir) { 7798 if (running) { 7799 if (preventActionWhenRunning) { 7800 return; 7801 } else { 7802 onTransitionEnd(); 7803 } 7804 } 7805 7806 var passEventObject; 7807 7808 if (!dir) { 7809 e = getEvent(e); 7810 var target = getTarget(e); 7811 7812 while (target !== controlsContainer && [prevButton, nextButton].indexOf(target) < 0) { 7813 target = target.parentNode; 7814 } 7815 7816 var targetIn = [prevButton, nextButton].indexOf(target); 7817 7818 if (targetIn >= 0) { 7819 passEventObject = true; 7820 dir = targetIn === 0 ? -1 : 1; 7821 } 7822 } 7823 7824 if (rewind) { 7825 if (index === indexMin && dir === -1) { 7826 goTo('last', e); 7827 return; 7828 } else if (index === indexMax && dir === 1) { 7829 goTo('first', e); 7830 return; 7831 } 7832 } 7833 7834 if (dir) { 7835 index += slideBy * dir; 7836 7837 if (autoWidth) { 7838 index = Math.floor(index); 7839 } // pass e when click control buttons or keydown 7840 7841 7842 render(passEventObject || e && e.type === 'keydown' ? e : null); 7843 } 7844 } // on nav click 7845 7846 7847 function onNavClick(e) { 7848 if (running) { 7849 if (preventActionWhenRunning) { 7850 return; 7851 } else { 7852 onTransitionEnd(); 7853 } 7854 } 7855 7856 e = getEvent(e); 7857 var target = getTarget(e), 7858 navIndex; // find the clicked nav item 7859 7860 while (target !== navContainer && !hasAttr(target, 'data-nav')) { 7861 target = target.parentNode; 7862 } 7863 7864 if (hasAttr(target, 'data-nav')) { 7865 var navIndex = navClicked = Number(getAttr(target, 'data-nav')), 7866 targetIndexBase = fixedWidth || autoWidth ? navIndex * slideCount / pages : navIndex * items, 7867 targetIndex = navAsThumbnails ? navIndex : Math.min(Math.ceil(targetIndexBase), slideCount - 1); 7868 goTo(targetIndex, e); 7869 7870 if (navCurrentIndex === navIndex) { 7871 if (animating) { 7872 stopAutoplay(); 7873 } 7874 7875 navClicked = -1; // reset navClicked 7876 } 7877 } 7878 } // autoplay functions 7879 7880 7881 function setAutoplayTimer() { 7882 autoplayTimer = setInterval(function () { 7883 onControlsClick(null, autoplayDirection); 7884 }, autoplayTimeout); 7885 animating = true; 7886 } 7887 7888 function stopAutoplayTimer() { 7889 clearInterval(autoplayTimer); 7890 animating = false; 7891 } 7892 7893 function updateAutoplayButton(action, txt) { 7894 setAttrs(autoplayButton, { 7895 'data-action': action 7896 }); 7897 autoplayButton.innerHTML = autoplayHtmlStrings[0] + action + autoplayHtmlStrings[1] + txt; 7898 } 7899 7900 function startAutoplay() { 7901 setAutoplayTimer(); 7902 7903 if (autoplayButton) { 7904 updateAutoplayButton('stop', autoplayText[1]); 7905 } 7906 } 7907 7908 function stopAutoplay() { 7909 stopAutoplayTimer(); 7910 7911 if (autoplayButton) { 7912 updateAutoplayButton('start', autoplayText[0]); 7913 } 7914 } // programaitcally play/pause the slider 7915 7916 7917 function play() { 7918 if (autoplay && !animating) { 7919 startAutoplay(); 7920 autoplayUserPaused = false; 7921 } 7922 } 7923 7924 function pause() { 7925 if (animating) { 7926 stopAutoplay(); 7927 autoplayUserPaused = true; 7928 } 7929 } 7930 7931 function toggleAutoplay() { 7932 if (animating) { 7933 stopAutoplay(); 7934 autoplayUserPaused = true; 7935 } else { 7936 startAutoplay(); 7937 autoplayUserPaused = false; 7938 } 7939 } 7940 7941 function onVisibilityChange() { 7942 if (doc.hidden) { 7943 if (animating) { 7944 stopAutoplayTimer(); 7945 autoplayVisibilityPaused = true; 7946 } 7947 } else if (autoplayVisibilityPaused) { 7948 setAutoplayTimer(); 7949 autoplayVisibilityPaused = false; 7950 } 7951 } 7952 7953 function mouseoverPause() { 7954 if (animating) { 7955 stopAutoplayTimer(); 7956 autoplayHoverPaused = true; 7957 } 7958 } 7959 7960 function mouseoutRestart() { 7961 if (autoplayHoverPaused) { 7962 setAutoplayTimer(); 7963 autoplayHoverPaused = false; 7964 } 7965 } // keydown events on document 7966 7967 7968 function onDocumentKeydown(e) { 7969 e = getEvent(e); 7970 var keyIndex = [KEYS.LEFT, KEYS.RIGHT].indexOf(e.keyCode); 7971 7972 if (keyIndex >= 0) { 7973 onControlsClick(e, keyIndex === 0 ? -1 : 1); 7974 } 7975 } // on key control 7976 7977 7978 function onControlsKeydown(e) { 7979 e = getEvent(e); 7980 var keyIndex = [KEYS.LEFT, KEYS.RIGHT].indexOf(e.keyCode); 7981 7982 if (keyIndex >= 0) { 7983 if (keyIndex === 0) { 7984 if (!prevButton.disabled) { 7985 onControlsClick(e, -1); 7986 } 7987 } else if (!nextButton.disabled) { 7988 onControlsClick(e, 1); 7989 } 7990 } 7991 } // set focus 7992 7993 7994 function setFocus(el) { 7995 el.focus(); 7996 } // on key nav 7997 7998 7999 function onNavKeydown(e) { 8000 e = getEvent(e); 8001 var curElement = doc.activeElement; 8002 8003 if (!hasAttr(curElement, 'data-nav')) { 8004 return; 8005 } // var code = e.keyCode, 8006 8007 8008 var keyIndex = [KEYS.LEFT, KEYS.RIGHT, KEYS.ENTER, KEYS.SPACE].indexOf(e.keyCode), 8009 navIndex = Number(getAttr(curElement, 'data-nav')); 8010 8011 if (keyIndex >= 0) { 8012 if (keyIndex === 0) { 8013 if (navIndex > 0) { 8014 setFocus(navItems[navIndex - 1]); 8015 } 8016 } else if (keyIndex === 1) { 8017 if (navIndex < pages - 1) { 8018 setFocus(navItems[navIndex + 1]); 8019 } 8020 } else { 8021 navClicked = navIndex; 8022 goTo(navIndex, e); 8023 } 8024 } 8025 } 8026 8027 function getEvent(e) { 8028 e = e || win.event; 8029 return isTouchEvent(e) ? e.changedTouches[0] : e; 8030 } 8031 8032 function getTarget(e) { 8033 return e.target || win.event.srcElement; 8034 } 8035 8036 function isTouchEvent(e) { 8037 return e.type.indexOf('touch') >= 0; 8038 } 8039 8040 function preventDefaultBehavior(e) { 8041 e.preventDefault ? e.preventDefault() : e.returnValue = false; 8042 } 8043 8044 function getMoveDirectionExpected() { 8045 return getTouchDirection(toDegree(lastPosition.y - initPosition.y, lastPosition.x - initPosition.x), swipeAngle) === options.axis; 8046 } 8047 8048 function onPanStart(e) { 8049 if (running) { 8050 if (preventActionWhenRunning) { 8051 return; 8052 } else { 8053 onTransitionEnd(); 8054 } 8055 } 8056 8057 if (autoplay && animating) { 8058 stopAutoplayTimer(); 8059 } 8060 8061 panStart = true; 8062 8063 if (rafIndex) { 8064 caf(rafIndex); 8065 rafIndex = null; 8066 } 8067 8068 var $ = getEvent(e); 8069 events.emit(isTouchEvent(e) ? 'touchStart' : 'dragStart', info(e)); 8070 8071 if (!isTouchEvent(e) && ['img', 'a'].indexOf(getLowerCaseNodeName(getTarget(e))) >= 0) { 8072 preventDefaultBehavior(e); 8073 } 8074 8075 lastPosition.x = initPosition.x = $.clientX; 8076 lastPosition.y = initPosition.y = $.clientY; 8077 8078 if (carousel) { 8079 translateInit = parseFloat(container.style[transformAttr].replace(transformPrefix, '')); 8080 resetDuration(container, '0s'); 8081 } 8082 } 8083 8084 function onPanMove(e) { 8085 if (panStart) { 8086 var $ = getEvent(e); 8087 lastPosition.x = $.clientX; 8088 lastPosition.y = $.clientY; 8089 8090 if (carousel) { 8091 if (!rafIndex) { 8092 rafIndex = raf(function () { 8093 panUpdate(e); 8094 }); 8095 } 8096 } else { 8097 if (moveDirectionExpected === '?') { 8098 moveDirectionExpected = getMoveDirectionExpected(); 8099 } 8100 8101 if (moveDirectionExpected) { 8102 preventScroll = true; 8103 } 8104 } 8105 8106 if ((typeof e.cancelable !== 'boolean' || e.cancelable) && preventScroll) { 8107 e.preventDefault(); 8108 } 8109 } 8110 } 8111 8112 function panUpdate(e) { 8113 if (!moveDirectionExpected) { 8114 panStart = false; 8115 return; 8116 } 8117 8118 caf(rafIndex); 8119 8120 if (panStart) { 8121 rafIndex = raf(function () { 8122 panUpdate(e); 8123 }); 8124 } 8125 8126 if (moveDirectionExpected === '?') { 8127 moveDirectionExpected = getMoveDirectionExpected(); 8128 } 8129 8130 if (moveDirectionExpected) { 8131 if (!preventScroll && isTouchEvent(e)) { 8132 preventScroll = true; 8133 } 8134 8135 try { 8136 if (e.type) { 8137 events.emit(isTouchEvent(e) ? 'touchMove' : 'dragMove', info(e)); 8138 } 8139 } catch (err) {} 8140 8141 var x = translateInit, 8142 dist = getDist(lastPosition, initPosition); 8143 8144 if (!horizontal || fixedWidth || autoWidth) { 8145 x += dist; 8146 x += 'px'; 8147 } else { 8148 var percentageX = TRANSFORM ? dist * items * 100 / ((viewport + gutter) * slideCountNew) : dist * 100 / (viewport + gutter); 8149 x += percentageX; 8150 x += '%'; 8151 } 8152 8153 container.style[transformAttr] = transformPrefix + x + transformPostfix; 8154 } 8155 } 8156 8157 function onPanEnd(e) { 8158 if (panStart) { 8159 if (rafIndex) { 8160 caf(rafIndex); 8161 rafIndex = null; 8162 } 8163 8164 if (carousel) { 8165 resetDuration(container, ''); 8166 } 8167 8168 panStart = false; 8169 var $ = getEvent(e); 8170 lastPosition.x = $.clientX; 8171 lastPosition.y = $.clientY; 8172 var dist = getDist(lastPosition, initPosition); 8173 8174 if (Math.abs(dist)) { 8175 // drag vs click 8176 if (!isTouchEvent(e)) { 8177 // prevent "click" 8178 var target = getTarget(e); 8179 addEvents(target, { 8180 'click': function preventClick(e) { 8181 preventDefaultBehavior(e); 8182 removeEvents(target, { 8183 'click': preventClick 8184 }); 8185 } 8186 }); 8187 } 8188 8189 if (carousel) { 8190 rafIndex = raf(function () { 8191 if (horizontal && !autoWidth) { 8192 var indexMoved = -dist * items / (viewport + gutter); 8193 indexMoved = dist > 0 ? Math.floor(indexMoved) : Math.ceil(indexMoved); 8194 index += indexMoved; 8195 } else { 8196 var moved = -(translateInit + dist); 8197 8198 if (moved <= 0) { 8199 index = indexMin; 8200 } else if (moved >= slidePositions[slideCountNew - 1]) { 8201 index = indexMax; 8202 } else { 8203 var i = 0; 8204 8205 while (i < slideCountNew && moved >= slidePositions[i]) { 8206 index = i; 8207 8208 if (moved > slidePositions[i] && dist < 0) { 8209 index += 1; 8210 } 8211 8212 i++; 8213 } 8214 } 8215 } 8216 8217 render(e, dist); 8218 events.emit(isTouchEvent(e) ? 'touchEnd' : 'dragEnd', info(e)); 8219 }); 8220 } else { 8221 if (moveDirectionExpected) { 8222 onControlsClick(e, dist > 0 ? -1 : 1); 8223 } 8224 } 8225 } 8226 } // reset 8227 8228 8229 if (options.preventScrollOnTouch === 'auto') { 8230 preventScroll = false; 8231 } 8232 8233 if (swipeAngle) { 8234 moveDirectionExpected = '?'; 8235 } 8236 8237 if (autoplay && !animating) { 8238 setAutoplayTimer(); 8239 } 8240 } // === RESIZE FUNCTIONS === // 8241 // (slidePositions, index, items) => vertical_conentWrapper.height 8242 8243 8244 function updateContentWrapperHeight() { 8245 var wp = middleWrapper ? middleWrapper : innerWrapper; 8246 wp.style.height = slidePositions[index + items] - slidePositions[index] + 'px'; 8247 } 8248 8249 function getPages() { 8250 var rough = fixedWidth ? (fixedWidth + gutter) * slideCount / viewport : slideCount / items; 8251 return Math.min(Math.ceil(rough), slideCount); 8252 } 8253 /* 8254 * 1. update visible nav items list 8255 * 2. add "hidden" attributes to previous visible nav items 8256 * 3. remove "hidden" attrubutes to new visible nav items 8257 */ 8258 8259 8260 function updateNavVisibility() { 8261 if (!nav || navAsThumbnails) { 8262 return; 8263 } 8264 8265 if (pages !== pagesCached) { 8266 var min = pagesCached, 8267 max = pages, 8268 fn = showElement; 8269 8270 if (pagesCached > pages) { 8271 min = pages; 8272 max = pagesCached; 8273 fn = hideElement; 8274 } 8275 8276 while (min < max) { 8277 fn(navItems[min]); 8278 min++; 8279 } // cache pages 8280 8281 8282 pagesCached = pages; 8283 } 8284 } 8285 8286 function info(e) { 8287 return { 8288 container: container, 8289 slideItems: slideItems, 8290 navContainer: navContainer, 8291 navItems: navItems, 8292 controlsContainer: controlsContainer, 8293 hasControls: hasControls, 8294 prevButton: prevButton, 8295 nextButton: nextButton, 8296 items: items, 8297 slideBy: slideBy, 8298 cloneCount: cloneCount, 8299 slideCount: slideCount, 8300 slideCountNew: slideCountNew, 8301 index: index, 8302 indexCached: indexCached, 8303 displayIndex: getCurrentSlide(), 8304 navCurrentIndex: navCurrentIndex, 8305 navCurrentIndexCached: navCurrentIndexCached, 8306 pages: pages, 8307 pagesCached: pagesCached, 8308 sheet: sheet, 8309 isOn: isOn, 8310 event: e || {} 8311 }; 8312 } 8313 8314 return { 8315 version: '2.9.4', 8316 getInfo: info, 8317 events: events, 8318 goTo: goTo, 8319 play: play, 8320 pause: pause, 8321 isOn: isOn, 8322 updateSliderHeight: updateInnerWrapperHeight, 8323 refresh: initSliderTransform, 8324 destroy: destroy, 8325 rebuild: function () { 8326 return tns(extend(options, optionsElements)); 8327 } 8328 }; 8329}; 8330 8331exports.tns = tns; 8332 8333 8334/***/ }), 8335
8336/***/ "./src/scripts/modules/_accordion.mjs": 8337/*!********************************************!*\ 8338 !*** ./src/scripts/modules/_accordion.mjs ***! 8339 \********************************************/ 8340/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { 8341 8342"use strict"; 8343__webpack_require__.r(__webpack_exports__); 8344/* harmony export */ __webpack_require__.d(__webpack_exports__, { 8345/* harmony export */ Accordion: () => (/* binding */ Accordion) 8346/* harmony export */ }); 8347/* harmony import */ var _animations_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_animations.mjs */ "./src/scripts/modules/_animations.mjs"); 8348/* harmony import */ var _disclosure_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_disclosure.mjs */ "./src/scripts/modules/_disclosure.mjs"); 8349 // import the animations from our animations script so the disclosure script can use them when toggling elements on the page 8350 8351 8352// todo: this widget REQUIRES that _disclosure.mjs is loaded in first. Without _disclosure.mjs, this script will NOT WORK 8353// todo: when no data-disclosure-animate is set with no value, it should implicitly be set to "slide" for accordions 8354//todo: allow for more specific grouping of disclosure elements 8355// todo: we could implement home/end/arrow key support, but it's optional and n
8355ot required. Navigates between the accordion headers, optionally in a loop. 8356 8357// Javascript-Powered Accordion script for the displaying and hiding of elements within an accordion widget, and update their corresponding accordion headers 8358// @author Jesse de Vries 8359 8360// How to use: 8361// Relies on 'disclosure' to work. Import this script after _disclosure.mjs in your app.js. 8362// accordion headers require [data-disclosure-control], while accordion panels require [data-disclosure-content] to be applied to them 8363// _disclosure.mjs describes further instructions for the further customization individual accordion items 8364// place the .js-accordion class on the parent element (IMPORTANT: DO NOT USE CSS WITH THIS CLASS!) 8365// on .js-accordion, optionally provide the 'stayopen' class to disable the accordion behavior described by fireEvent(). This is a band-aid fix, though. Ideally you should not include the class '.js-accordion' for accordions that do not require the closing of other content 8366 8367// todo: implement arrow and home/end controls for accordions 8368 8369'use strict'; 8370var reducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)'); //todo: We already declare this in _disclosure.mjs 8371 8372/** 8373 * Accordion 8374 * @author Jesse de Vries 8375*/ 8376function Accordion(options) { 8377 this.Init(options); 8378} 8379Accordion.prototype = { 8380 /** 8381 * Constructor 8382 * @Param object options 8383 * @return void 8384 */ 8385 // Initialize Object variables 8386 Init: function Init(options) { 8387 // Initialization 8388 8389 // Default selectors 8390 this.options = Object.assign({ 8391 controls: '.js-accordion-header' // Controls (buttons) used to toggle elements. The reason we need to assign this is that we only want accordion headers to implement accordion-like behavior. This way regular disclosure controls nested inside an accordion still work as intended. Keep in mind that both regular disclosure controls and accordion headers still need [data-disclosure-control] applied to them 8392 }, options); 8393 8394 // Initialize Prototype variables 8395 this.controls = document.querySelectorAll(this.options.controls); 8396 this.SetEvents(); 8397 }, 8398 /** 8399 * SetEvents 8400 * @return void 8401 */ 8402 // Event Handling 8403 SetEvents: function SetEvents() { 8404 // Create local variables from the Object context 8405 var controls = this.controls; 8406 // todo: should this be debounced? 8407 controls.forEach(function (control) { 8408 // Iterate through all .js-accordion-header elements 8409 control.addEventListener('click', function () { 8410 // todo: consider using Event delegation here 8411 fireEvent(this); // Jump to 'fireEvent', passing with it the instance of the button that was clicked and its type as arguments 8412 }); 8413 }); 8414 function fireEvent(control) { 8415 var accordion = control.closest('.js-accordion'); // Get the nearest '.js-accordion' parent 8416 8417 //If the Accordion has the class 'stayopen', or if no .js-accordion parent class is found, don't close the other accordion items 8418 if (accordion.classList.contains('stayopen') || !accordion) { 8419 return; 8420 } 8421 8422 // Get all opened accordion panels whose id does not match with the aria-controls attribute of the clicked accordion header // todo: We don't have to worry about looping through multiple aria-controls attributes here because accordion headers can never open more than 1 item at a time, but we should probably throw a warning for headers that have more than 1 string anyway 8423 var otherContents = accordion.querySelectorAll('.js-accordion-panel[data-disclosure-content=open]:not([id="' + control.getAttribute('aria-controls') + '"])'); 8424 otherContents.forEach(function (otherContent) { 8425 // Iterate through all non-matching accordion items 8426 otherContent.setAttribute('data-disclosure-content', 'closed'); // Update their states to 'closed' 8427 8428 var animation = otherContent.getAttribute('data-animate'); 8429 if (!animation) { 8430 var parentElement = otherContent.closest('[data-animate]'); 8431 if (parentElement) { 8432 animation = parentElement.getAttribute('data-animate'); 8433 } 8434 } 8435 _disclosure_mjs__WEBPACK_IMPORTED_MODULE_1__.Disclosure.prototype.SetAnimation.call(_disclosure_mjs__WEBPACK_IMPORTED_MODULE_1__.Disclosure.prototype, otherContent, animation); 8436 }); 8437 } 8438 } 8439}; 8440 8441 8442/***/ }), 8443
8444/***/ "./src/scripts/modules/_animations.mjs": 8445/*!*********************************************!*\ 8446 !*** ./src/scripts/modules/_animations.mjs ***! 8447 \*********************************************/ 8448/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { 8449 8450"use strict"; 8451__webpack_require__.r(__webpack_exports__); 8452/* harmony export */ __webpack_require__.d(__webpack_exports__, { 8453/* harmony export */ animationsList: () => (/* binding */ animationsList), 8454/* harmony export */ collapseHeight: () => (/* binding */ collapseHeight), 8455/* harmony export */ collapseWidth: () => (/* binding */ collapseWidth), 8456/* harmony export */ expandHeight: () => (/* binding */ expandHeight), 8457/* harmony export */ expandWidth: () => (/* binding */ expandWidth), 8458/* harmony export */ fadeIn: () => (/* binding */ fadeIn), 8459/* harmony export */ fadeOut: () => (/* binding */ fadeOut), 8460/* harmony export */ transformIn: () => (/* binding */ transformIn), 8461/* harmony export */ transformOut: () => (/* binding */ transformOut) 8462/* harmony export */ }); 8463// Javascript-Powered animations for the animating of elements to/from display: none; and visibility: hidden; and to/from height/width: auto; 8464// @author Jesse de Vries 8465// How to use: import the function you need, then call it while supplying a variable parameter that contains the DOM element you want to animate. 8466//todo: support for prefers-reduced-motion 8467 8468// Declare variables for 'width' and 'height' so that the functions that need them can use them (todo: is there a more elegant solutions for this?) 8469var height; 8470var width; 8471 8472// List of animations, so we can check against them for widgets that need them (such as inside a switch()) 8473var animationsList = { 8474 toggleHeight: 'heightToggle', 8475 toggleWidth: 'widthToggle', 8476 toggleFade: 'fadeToggle', 8477 toggleTransform: 'transformToggle' 8478}; 8479 8480// animate element from opacity: 0; to opacity: 1; 8481// =============================================== 8482function fadeIn(element) { 8483 element.classList.add('active', 'transitioning'); // Set active state styles (setting display to block, visibility to visible, etc.) as well as transitioning styles, so it can actually transition from 0 to 1. 8484 element.style.opacity = '0'; // Make sure the element starts invisible 8485 8486 // Use requestAnimationFrame for smoother animation from display: none, visibility: hidden, etc. 8487 requestAnimationFrame(function () { 8488 // Allow time for the rendering before transitioning 8489 setTimeout(function () { 8490 element.style.opacity = '1'; // change the element's style to fully opaque on next repaint when ready 8491 }); 8492 }); 8493 8494 // When transition ends, remove the 'transitioning' class. This class is typically used to disable click Events while the element is still in the middle of transitioning. 8495 element.addEventListener('transitionend', function () { 8496 element.classList.remove('transitioning'); 8497 }); 8498} 8499 8500// animate element from opacity: 1; to opacity: 0; 8501// =============================================== 8502function fadeOut(element) { 8503 element.style.opacity = '0'; // Set the opacity back to 0 8504 element.classList.add('transitioning'); // add the transitioning styles back, so it can actually transition from 1 to 0. 8505 8506 // When transition ends, remove the 'transitioning' class. This class is typically used to disable click Events while the element is still in the middle of transitioning. We also remove the 'active' class so the element can be disabled (e.g. by setting display to none, visibility to hidden, etc.) 8507 element.addEventListener('transitionend', function () { 8508 element.classList.remove('active', 'transitioning'); 8509 }, { 8510 once: true // Removed the eventListener from the element when it is no longer visible, so it doesn't try to remove these classes again when the element's fade-in transition is triggered a 2nd time. 8511 }); 8512} 8513 8514// animate an element from a transformed state to transform: none; 8515// =============================================================== 8516function transformIn(element) { 8517 element.classList.add('active', 'transitioning'); // Set active state styles (setting display to block, visibility to visible, etc.) as well as transitioning styles, so it can actually transition from transform to none. 8518 // Any transforms applied to the element should be declared in CSS 8519 8520 // Use requestAnimationFrame for smoother animation from display: none, visibility: hidden, etc. 8521 requestAnimationFrame(function () { 8522 // Allow time for the rendering before transitioning 8523 setTimeout(function () { 8524 element.style.transform = 'none'; // Remove the element's transforms on next repaint when ready 8525 }); 8526 }); 8527 8528 // When transition ends, remove the 'transitioning' class. This class is typically used to disable click Events while the element is still in the middle of transitioning. 8529 element.addEventListener('transitionend', function () { 8530 element.classList.remove('transitioning'); 8531 }); 8532} 8533 8534//animate an element from transform: none; to a transformed state 8535// ============================================================== 8536function transformOut(element) { 8537 element.style.transform = ''; // Reset the transform to whatever the author declared in the CSS 8538 element.classList.add('transitioning'); // add the transitioning styles back, so it can actually transition from none to the author-declared transform 8539 8540 // When transition ends, remove the 'transitioning' class. This class is typically used to disable click Events while the element is still in the middle of transitioning. We also remove the 'active' class so the element can be disabled (e.g. by setting display to none, visibility to hidden, etc.) 8541 element.addEventListener('transitionend', function () { 8542 element.classList.remove('active', 'transitioning'); 8543 }, { 8544 once: true // Remove the eventListener from the element when it is no longer visible, so it doesn't try to remove these classes again when the element's transform-to-none transition is triggered a 2nd time. 8545 }); 8546} 8547 8548//animate element from height: 0; to height: auto; 8549//IMPORTANT: animating an element's dimensions causes layout trashing and forces the browser to repaint on every frame of the transition, which is not performant. It can also cause issues when the viewport changes in the middle of a transition. Don't use it if you don't have to.
8550// =============================================== 8551function expandHeight(element) { 8552 element.classList.add('active', 'transitioning'); // Set active state styles (setting display to block, visibility to visible, etc.) as well as transitioning styles, so it can actually transition from height: 0; to height: auto; 8553 8554 element.style.height = 'auto'; // Set the element's height to auto after it becomes visible, so we can obtain the element's computed height 8555 height = element.scrollHeight + 'px'; // set the variable 'height' to be equal to the element's computed height (scrollbar included) 8556 8557 element.style.height = '0px'; // Set the element's height back to 0 after we obtain the rendered height so the element can transition from it. This happens before the browser is able to repaint the element, so height: auto; is never actually displayed on screen. 8558 8559 // Use requestAnimationFrame for smoother animation on repaint from display: none, visibility: hidden, etc. 8560 requestAnimationFrame(function () { 8561 // Allow time for the rendering before transitioning 8562 setTimeout(function () { 8563 element.style.height = height; // Set the element's height to be equal to the 'height' variable declared above 8564 }); 8565 }); 8566 8567 // When transition ends, remove the 'transitioning' class. This class is typically used to disable click Events while the element is still in the middle of transitioning. 8568 element.addEventListener('transitionend', function () { 8569 element.classList.remove('transitioning'); 8570 element.style.height = ''; // When the transition has finished, the element's height (contained in the 'height' variable) should be equal to the value of 'auto', so we can remove it. This ensures the height of the element can be recalculated when the viewport changes. 8571 }); 8572} 8573 8574//animate element from height: auto; to height: 0; 8575//IMPORTANT: animating an element's dimensions causes layout trashing and forces the browser to repaint on every frame of the transition, which is not performant. It can also cause issues when the viewport changes in the middle of a transition. Don't use it if you don't have to. 8576// =============================================== 8577function collapseHeight(element) { 8578 height = element.scrollHeight + 'px'; // set the value of the variable 'height' to be equal to the element's computed height (scrollbar included), so we can use that to transition from 8579 element.style.height = height; // set the element's height to be equal to the 'height' variable. The height variable contains a fixed value that should be equal to 'auto'. We do this, because it's not possible to transition from height: auto; 8580 8581 // Use requestAnimationFrame for smoother animation on repaint from display: none, visibility: hidden, etc. 8582 requestAnimationFrame(function () { 8583 // Allow time for the rendering before transitioning 8584 setTimeout(function () { 8585 element.style.height = '0px'; // Set the element's height to 0 8586 element.classList.add('transitioning'); // add the transitioning styles back, so it can actually transition from the computed height to 0. (todo: should this be at the very top?) 8587 }); 8588 }); 8589 8590 // When transition ends, remove the 'transitioning' class. This class is typically used to disable click Events while the element is still in the middle of transitioning. We also remove the 'active' class so the element can be disabled (e.g. by setting display to none, visibility to hidden, etc.) 8591 element.addEventListener('transitionend', function () { 8592 element.classList.remove('active', 'transitioning'); 8593 }, { 8594 once: true // Remove the eventListener from the element when it is no longer visible, so it doesn't try to remove these classes again when the element's height is expanded a 2nd time. 8595 }); 8596} 8597 8598//animate element from width: 0; to width: auto; 8599//IMPORTANT: animating an element's dimensions causes layout trashing and forces the browser to repaint on every frame of the transition, which is not performant. It can also cause issues when the viewport changes in the middle of a transition. Don't use it if you don't have to. 8600// ============================================= 8601function expandWidth(element) { 8602 element.classList.add('active', 'transitioning'); // Set active state styles (setting display to block, visibility to visible, etc.) as well as transitioning styles, so it can actually transition from height: 0; to height: auto; 8603 8604 element.style.width = 'auto'; // Set the element's width to auto after it becomes visible, so we can obtain the element's computed width 8605 width = element.scrollWidth + 'px'; // set the variable 'width' to be equal to the element's computed width (scrollbar included) 8606 8607 element.style.width = '0px'; // Set the element's width back to 0 after we obtain the rendered width so the element can transition from it. This happens before the browser is able to repaint the element, so width: auto; is never actually displayed on screen. 8608 8609 // Use requestAnimationFrame for smoother animation on repaint from display: none, visibility: hidden, etc. 8610 requestAnimationFrame(function () { 8611 // Allow time for the rendering before transitioning 8612 setTimeout(function () { 8613 element.style.width = width; // Set the element's width to be equal to the 'width' variable declared above 8614 }); 8615 }); 8616 8617 // When transition ends, remove the 'transitioning' class. This class is typically used to disable click Events while the element is still in the middle of transitioning. 8618 element.addEventListener('transitionend', function () { 8619 element.classList.remove('transitioning'); 8620 element.style.width = ''; // When the transition has finished, the element's width (contained in the 'width' variable) should be equal to the value of 'auto', so we can remove it. This ensures the width of the element can be recalculated when the viewport changes. 8621 }); 8622} 8623 8624//animate element from width: auto; to width: 0; 8625//IMPORTANT: animating an element's dimensions causes layout trashing and forces the browser to repaint on every frame of the transition, which is not performant. It can also cause issues when the viewport changes in the middle of a transition. Don't use it if you don't have to.
8626// ============================================= 8627function collapseWidth(element) { 8628 width = element.scrollWidth + 'px'; // set the value of the variable 'width' to be equal to the element's computed width (scrollbar included), so we can use that to transition from 8629 element.style.width = width; // set the element's width to be equal to the 'width' variable. The width variable contains a fixed value that should be equal to 'auto'. We do this, because it's not possible to transition from width: auto; 8630 8631 // Use requestAnimationFrame for smoother animation on repaint from display: none, visibility: hidden, etc. 8632 requestAnimationFrame(function () { 8633 // Allow time for the rendering before transitioning 8634 setTimeout(function () { 8635 element.style.width = '0px'; // Set the element's width to 0 8636 element.classList.add('transitioning'); // add the transitioning styles back, so it can actually transition from the computed width to 0. (todo: should this be at the very top?) 8637 }); 8638 }); 8639 8640 // When transition ends, remove the 'transitioning' class. This class is typically used to disable click Events while the element is still in the middle of transitioning. We also remove the 'active' class so the element can be disabled (e.g. by setting display to none, visibility to hidden, etc.) 8641 element.addEventListener('transitionend', function () { 8642 element.classList.remove('active', 'transitioning'); 8643 }, { 8644 once: true // Remove the eventListener from the element when it is no longer visible, so it doesn't try to remove these classes again when the element's width is expanded a 2nd time. 8645 }); 8646} 8647 8648/***/ }), 8649
8650/***/ "./src/scripts/modules/_buttons.mjs": 8651/*!******************************************!*\ 8652 !*** ./src/scripts/modules/_buttons.mjs ***! 8653 \******************************************/ 8654/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { 8655 8656"use strict"; 8657__webpack_require__.r(__webpack_exports__); 8658/* harmony export */ __webpack_require__.d(__webpack_exports__, { 8659/* harmony export */ updateButtonStates: () => (/* binding */ updateButtonStates) 8660/* harmony export */ }); 8661function updateButtonStates(controls, contentState) { 8662 controls.forEach(function (control) { 8663 // Loop through all the [data-disclosure-control] elements in the document 8664 var ariaControls = control.getAttribute('aria-controls').split(' '); // Get the space-separated values of 'aria-controls' for all of them, and split them into separate strings in an 'ariaControls' array 8665 8666 var targetElements = ariaControls.map(function (element) { 8667 // Iterate through the 'ariaControls' array 8668 return document.getElementById(element); //For each item encountered in 'ariaControls', search the entire document for elements with an id matching the item's value, then return those elements and add them to a new array 'targetElements'. 8669 }); 8670 var isOpened = targetElements.some(function (targetElement) { 8671 // Iterate through the 'targetElements' array, using 'some' which returns 'true' if at least 1 element in the array satisfies the condition specified inside it 8672 if (targetElement) { 8673 return targetElement.getAttribute('data-disclosure-content') === 'open'; // retrieves the value of each element's 'data-disclosure-content' attribute. Return only the elements that are either open, or opening. //todo: are we actually using the value 'opening' for anything? 8674 } 8675 }); 8676 if (!contentState) { 8677 contentState = 'aria-expanded'; 8678 } 8679 control.setAttribute(contentState, isOpened); 8680 if (control.getAttribute('aria-selected')) { 8681 control.setAttribute('tabindex', isOpened ? '0' : '-1'); 8682 } 8683 8684 // Define selectors for disabled/enabled controls 8685 var closeSelector = "[data-disclosure-control=close][".concat(contentState, "=false]"); 8686 var openSelector = "[data-disclosure-control=open][".concat(contentState, "=true]"); 8687 8688 // Controls that are specified as 'close-only' and do not have any corresponding expanded elements, and controls that are specified as 'open-only' and do not have any corresponding collapsed elements, should be disabled in the HTML 8689 var disabledControls = document.querySelectorAll("".concat(closeSelector, ", ").concat(openSelector)); 8690 disabledControls.forEach(function (disabledControl) { 8691 disabledControl.setAttribute('disabled', 'disabled'); 8692 }); 8693 8694 // Enable controls not meeting the disabled criteria 8695 var enabledControls = document.querySelectorAll("[data-disclosure-control]:not(".concat(closeSelector, "):not(").concat(openSelector, ")")); 8696 enabledControls.forEach(function (enabledControl) { 8697 enabledControl.removeAttribute('disabled'); 8698 }); 8699 }); 8700} 8701 8702//todo aria-pressed (toggle) button support (https://www.w3.org/WAI/ARIA/apg/patterns/button/examples/button/) 8703 8704/***/ }), 8705
8706/***/ "./src/scripts/modules/_carousels.mjs": 8707/*!********************************************!*\ 8708 !*** ./src/scripts/modules/_carousels.mjs ***! 8709 \********************************************/ 8710/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { 8711 8712"use strict"; 8713__webpack_require__.r(__webpack_exports__); 8714/* harmony export */ __webpack_require__.d(__webpack_exports__, { 8715/* harmony export */ sponsorSlider: () => (/* binding */ sponsorSlider), 8716/* harmony export */ verslagenSlider: () => (/* binding */ verslagenSlider) 8717/* harmony export */ }); 8718/* harmony import */ var tiny_slider__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tiny-slider */ "./node_modules/tiny-slider/dist/tiny-slider.js"); 8719 8720function sponsorSlider() { 8721 var slider = document.getElementById('sponsor-slider'); 8722 if (slider) { 8723 slider = (0,tiny_slider__WEBPACK_IMPORTED_MODULE_0__.tns)({ 8724 container: '#sponsor-slider', 8725 items: 1, 8726 gutter: 24, 8727 autoplay: true, 8728 center: false, 8729 autoplayButton: false, 8730 autoplayButtonOutput: '', 8731 controls: false, 8732 navPosition: 'bottom', 8733 controlsPosition: 'bottom', 8734 controlsText: ['<img src="/assets/images/ui/prev.svg" alt="Vorige slide" width="" height="" loading="lazy">', '<img src="/assets/images/ui/next.svg" alt="Volgende slide" width="" height="" loading="lazy">'], 8735 nav: false, 8736 mouseDrag: true, 8737 //autoplayHoverPause: true, //too buggy right now, but should be added. 8738 touch: true, 8739 responsive: { 8740 576: { 8741 items: 2 8742 }, 8743 768: { 8744 items: 3 8745 }, 8746 1024: { 8747 items: 4 8748 }, 8749 1366: { 8750 items: 5 8751 }, 8752 1600: { 8753 items: 6 8754 } 8755 } 8756 }); 8757 } 8758 return 'sponsorSlider'; 8759} 8760function verslagenSlider() { 8761 var slider = document.getElementById('verslagen-slider'); 8762 if (slider) { 8763 slider = (0,tiny_slider__WEBPACK_IMPORTED_MODULE_0__.tns)({ 8764 container: '#verslagen-slider', 8765 items: 1, 8766 gutter: 8, 8767 autoplay: true, 8768 center: false, 8769 autoplayButton: false, 8770 autoplayButtonOutput: '', 8771 controls: false, 8772 navPosition: 'bottom', 8773 controlsPosition: 'bottom', 8774 controlsText: ['<img src="/assets/images/ui/prev.svg" alt="Vorige slide" width="" height="" loading="lazy">', '<img src="/assets/images/ui/next.svg" alt="Volgende slide" width="" height="" loading="lazy">'], 8775 nav: false, 8776 mouseDrag: true, 8777 //autoplayHoverPause: true, //too buggy right now, but should be added. 8778 touch: true, 8779 responsive: { 8780 768: { 8781 items: 2 8782 }, 8783 1024: { 8784 items: 3 8785 }, 8786 1366: { 8787 items: 4 8788 } 8789 } 8790 }); 8791 } 8792 return 'verslagenSlider'; 8793} 8794 8795/***/ }), 8796
8797/***/ "./src/scripts/modules/_disclosure.mjs": 8798/*!*********************************************!*\ 8799 !*** ./src/scripts/modules/_disclosure.mjs ***! 8800 \*********************************************/ 8801/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { 8802 8803"use strict"; 8804__webpack_require__.r(__webpack_exports__); 8805/* harmony export */ __webpack_require__.d(__webpack_exports__, { 8806/* harmony export */ Disclosure: () => (/* binding */ Disclosure) 8807/* harmony export */ }); 8808/* harmony import */ var _animations_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_animations.mjs */ "./src/scripts/modules/_animations.mjs"); 8809/* harmony import */ var _buttons_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_buttons.mjs */ "./src/scripts/modules/_buttons.mjs"); 8810/* harmony import */ var _setActiveStartItems_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./_setActiveStartItems.mjs */ "./src/scripts/modules/_setActiveStartItems.mjs"); 8811// Javascript-Powered disclosure script for the displaying and hiding of elements on the page, and update their corresponding button elements 8812// @author Jesse de Vries 8813 8814/*readme 8815* The Disclosure widget is a widget designed to expand or collapse content, or completely remove content from the DOM altogether. 8816* The widget consists of a control button and the section of content that is controlled by the control button. 8817* The state of the content's visibility is communicated to assistive technologies by using the aria-expanded attribute on the control button. This attribute is applied and updated accordingly, meaning authors are not required to apply it. 8818* The author is required to add an aria-controls attribute on the control button providing a space-separated list of elements referenced by their id for accessibility reasons and to indicate which elements should be targeted by the control button. 8819* CSS attribute selectors such as [aria-expanded] can be used to indicate the active or inactive state of the control buttons while styling the buttons, including their indicators. 8820* There are two ways to set a disclosure item's content to be visible on page load. The first is to only apply [data-disclosure-content=open] on the content. This will cause the content to animate in on page load. 8821* The second method is to provide both [data-disclosure-content=open] and the active class on the element. This will cause the content to be visible instantly, without an animation. 8822* Additionally, if the ID of the content is applied to the page's URL hash, it acts as if [data-disclosure-content=open] is set on the element and the page will scroll to the corresponding element. You don't have to apply [data-disclosure-content=open] manually in these circumstances, allowing you to control the visual state of content based on a redirect from another page. 8823* An additional effect of setting an id hash is that the first control button in the DOM that controls the element that matches the id hash will receive focus (to be implemented) 8824* */ 8825 8826// How to use: 8827 8828// Button Controls: apply the attribute 'data-disclosure-control' on the button, and set it to the desired type (can be open, close, destroy or create, defaulting to a basic toggle button) 8829// Apply an 'aria-controls' attribute on the button, with a space-separated string corresponding to the id's of all elements the control button corresponds to. 8830 8831// Toggleable Elements: apply the attribute 'data-disclosure-content' on the element, and set it to the state you want it to be when the page loads (either 'open' or 'close'). By default, it is assumed to be closed. 8832// If you additionally wish to have a toggle animation on the element as well, you must also provide the attribute 'data-disclosure-animate' with the value 'fadeToggle', 'heightToggle' 'widthToggle' or 'transformToggle'. If you don't provide the attribute, or the attribute contains an invalid value, no animation is applied to the element. 8833// It is possible for toggleable elements to inherit the animate behavior of the parent, as long as it finds a parent with a 'data-disclosure-animate' attribute and the item itself has no 'data-disclosure-animate' attribute explicitly declared. 8834// If you want to prevent DOM traversal from inheriting something you don't want, either assign 'data-disclosure-animate' on the items individually, or re-assign it on a parent element with the value you want (leave empty for no animation). 8835 8836//example of usage with custom selectors: 8837// new Disclosure({ 8838// contents: '.custom-content-selector', // Override contents selector
8839// controls: '.custom-control-selector' // Override controls selector 8840// }); 8841 8842//todo: allow for hover support, toggling content only on hover (requires a container around the content and the trigger button) 8843 8844//todo: we might want to attach the event listener for controls to the body. This way, it should work for dynamically-added content 8845 8846//todo: When a nested accordion item is accessed from a control outside the accordion, but accordion item's parent is closed, open the accordion parent accordion item, but only if the toggle button is used to open the content. 8847 8848//todo: right now, we require each control and element to have an explicit type and animation set. It would be nice if we could target a parent element and have them inherit the parent declrations by default 8849 8850//todo: when animate is set, but does not have a value, the implicit animation should depend on the context it is used in 8851 8852//todo: add functionality that automtically closes items when they detect their parent was closed 8853 8854//todo: implement modal behavior working with dynamically-added modals 8855 8856//todo: we're no longer passing our button type and testing against the presence of 'open' or 'close' when we go to the animations. We're instead relying on the 'disabled' attribute to disable buttons that correspond to open/closed items if they have the open/closed attributes in our button scripts. Is this sufficient? We're also no longer using a toggle() function, but instead checking for the presence of the 'active' class. We may want to instead test if the item is visible, rather than testing against an 'active' class, as jQuery does. 8857 8858// todo: figure out a way to not require the animations.mjs file to be present, since the script works fine without it. All we need to do is throw a warning and create an empty animationsList object. 8859 // import the animations from our animations script so the disclosure script can use them when toggling elements on the page 8860 8861 8862 8863// Create a global list of options that we may need to update between different widgets that rely on disclosure(). 8864 8865'use strict'; // enforce stricter parsing and error handling 8866 8867// Specify Console errors 8868var missingAria = new TypeError("The control is missing an aria-controls attribute"); 8869var emptyAria = new TypeError("The provided aria-controls attribute is empty"); 8870 8871// Create a variable to check against prefers-reduced-motion settings 8872var reducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)'); 8873 8874/** 8875 * Disclosure 8876 * @author Jesse de Vries 8877*/ 8878function Disclosure(options) { 8879 this.Init(options); 8880} 8881 8882/** 8883 * Constructor 8884 * @Param object options 8885 * @return void 8886*/ 8887Disclosure.prototype = { 8888 // Initialize Object variables 8889 Init: function Init(options) { 8890 // Initialization 8891 8892 // Default selectors 8893 var defaultOptions = { 8894 contents: '[data-disclosure-content]', 8895 // Toggleable elements 8896 controls: '[data-disclosure-control]' // Controls (buttons) used to toggle elements 8897 }; 8898 8899 // Merge default options with provided options 8900 this.options = Object.assign({}, defaultOptions, options); 8901 8902 // Initialize Prototype variables 8903 this.contents = document.querySelectorAll(this.options.contents); 8904 this.controls = document.querySelectorAll(this.options.controls); 8905 8906 // Initialize Start function 8907 this.Start(); 8908 }, 8909 /** 8910 * Start 8911 * @return void 8912 */ 8913 // Executes on page load 8914 Start: function Start() { 8915 // Starting functionality 8916 8917 var _this = this; // Put the current context of 'this' in a variable, so we can always pass it to the next function 8918 8919 // Create local variables from the Object context 8920 var controls = this.controls; 8921 var contents = this.contents; 8922 function onLoadHandler() { 8923 (0,_setActiveStartItems_mjs__WEBPACK_IMPORTED_MODULE_2__.setActiveStartItems)(contents, _this); 8924 _this.UpdateButtonStates(controls); 8925 _this.SetEvents(controls); 8926 } 8927 if (document.readyState === 'complete') { 8928 // If the document is already loaded, execute immediately 8929 onLoadHandler(); 8930 } else { 8931 // Otherwise, add a listener for the 'load' event 8932 window.addEventListener('load', onLoadHandler); 8933 } 8934 }, 8935 /** 8936 * Update Button States 8937 * @return void 8938 */ 8939 // Update the button states 8940 // todo: We might want to move this function to its own script file that deals with button-related events and import it instead. That way we
8940can always re-use it for other scripts that rely on checking button states. In particular, tab lists use a nearly identical implementation pattern, the only difference being the use of aria-selected on the buttons instead of aria-expanded. 8941 UpdateButtonStates: function UpdateButtonStates(controls) { 8942 setTimeout(function () { 8943 // We set a delay here to make sure all toggleable elements updated their states before the buttons themselves do 8944 8945 var contentState = 'aria-expanded'; 8946 (0,_buttons_mjs__WEBPACK_IMPORTED_MODULE_1__.updateButtonStates)(controls, contentState); 8947 }); 8948 }, 8949 /** 8950 * SetEvents 8951 * @return void 8952 */ 8953 // Event Handling 8954 SetEvents: function SetEvents(controls) { 8955 var _this = this; // Put the current context of 'this' in a variable, so we can always pass it to the next function 8956 // todo: should this be debounced? 8957 controls.forEach(function (control) { 8958 // Iterate through all [data-disclosure-control] elements 8959 var type = control.getAttribute('data-disclosure-control'); // Get the attribute value of the element, which corresponds to its type 8960 control.addEventListener('click', function () { 8961 // todo: consider using Event delegation here 8962 _this.fireEvent(this, type); // Jump to 'fireEvent', passing with it the instance of the button that was clicked and its type as arguments 8963 }); 8964 }); 8965 8966 //we are using this code for eventDelegation for dynamically-inserted content. However, we may want to attach a single event Listener on the body to control our disclosure in the future. 8967 var liveRegions = document.querySelectorAll('[aria-live]'); 8968 liveRegions.forEach(function (liveRegion) { 8969 liveRegion.addEventListener('click', function (e) { 8970 var target = e.target; 8971 var control = target.closest('[data-disclosure-control]'); 8972 if (control) { 8973 var type = control.getAttribute('data-disclosure-control'); 8974 _this.fireEvent(control, type); 8975 } 8976 }); 8977 }); 8978 }, 8979 /** 8980 * FireEvent 8981 * @return void 8982 */ 8983 // Event handling logic 8984 fireEvent: function fireEvent(control, type) { 8985 var _this2 = this; 8986 if (control.hasAttribute('aria-controls')) { 8987 var targetElements = control.getAttribute('aria-controls').split(' '); // Get the space-separated values of 'aria-controls' for the clicked button, and split them into separate strings in a 'targetElements' array 8988 var nonMatchingIds = []; // Array to store non-matching IDs 8989 8990 if (control.getAttribute('aria-controls') !== '') { 8991 var _loop = function _loop() { 8992 // Iterate through the 'targetElements' array 8993 8994 var content = document.getElementById(targetElements[i]); // Create a variable, 'content' (same as in the 'Start' function) for each item in targetElements, and set it to be equal to the element in the document with a matching ID. 8995 8996 if (!content) { 8997 // If content is not found, add the ID to nonMatchingIds array 8998 nonMatchingIds.push(targetElements[i]); 8999 } 9000 9001 // Check if the 'content' variable actually contains any DOM elements 9002 if (content) { 9003 // Create a variable where we can store the type of animation that should be used 9004 var animation = content.getAttribute('data-animate'); 9005 if (!animation) { 9006 var parentElement = content.closest('[data-animate]'); 9007 if (parentElement) { 9008 animation = parentElement.getAttribute('data-animate'); 9009 } 9010 } 9011 9012 // Debounce button presses when the toggleable element is still transitioning. This makes sure button states don't update and animations don't execute in quick succession. 9013 if (content.classList.contains('transitioning')) { 9014 return { 9015 v: void 0 9016 }; // todo: Potential Duplication: If the fireEvent() function is called from multiple places within the widget. We may want a more centralized debounce somewhere 9017 } 9018 9019 // Get the control button's [data-disclosure-control] value from a fixed set of options 9020 switch (type) { 9021 // If it's an 'open-only' control, change the states of the corresponding element
9021(s) to 'open'. 9022 case 'open': 9023 content.setAttribute('data-disclosure-content', 'open'); 9024 break; 9025 // If it's a 'close-only' control, change the states of the corresponding element(s) to 'closed'. 9026 case 'close': 9027 content.setAttribute('data-disclosure-content', 'closed'); 9028 break; 9029 9030 // If it's a control that destroys the corresponding element(s) (removes them from the DOM) 9031 case 'destroy': 9032 // todo: We may want to move this code into its own separate script file that deals with content mutation and import it instead, so we can re-use it for other content in case we need it 9033 var removeContent = function removeContent() { 9034 content.remove(); // remove the element from the DOM 9035 9036 // Remove all the control buttons whose aria-controls value matches the element's id. //todo: This does not work for control buttons that control multiple elements. 9037 var relatedControls = document.querySelectorAll('[data-disclosure-control][aria-controls="' + content.id + '"]'); 9038 relatedControls.forEach(function (relatedControl) { 9039 relatedControl.remove(); 9040 }); 9041 }; // Remove the corresponding element(s) immediately without waiting for a transition for visitors that have their motion preferences set to 'reduce', elements that are already in their 'closed' state, and items that have no/an invalid animation declared on them 9042 if (reducedMotion.matches || !Object.values(_animations_mjs__WEBPACK_IMPORTED_MODULE_0__.animationsList).includes(animation) || content.getAttribute('data-disclosure-content') === 'closed') { 9043 removeContent(); 9044 } else { 9045 // Otherwise, wait for the animation to finish before removing the content from the DOM 9046 content.addEventListener('transitionend', function () { 9047 removeContent(); 9048 }); 9049 } 9050 break; 9051 case 'create': 9052 // Todo: create a function that allows us to create new elements in the DOM...? 9053 break; 9054 // Any value that is not one of the other values within this switch statement (including null/empty) will assume that the control button is a 'toggle' button 9055 default: 9056 content.setAttribute('data-disclosure-content', content.getAttribute('data-disclosure-content') === 'open' ? 'closed' : 'open'); // Changing the corresponding element(s) state to the opposite of what they were when the control button was clicked 9057 break; 9058 } 9059 9060 // If the corresponding element is not currently in a 'transitioning' state, we jump to the 'SetAnimation' function, passing with it the current element 9061 if (!content.classList.contains('transitioning')) { 9062 _this2.SetAnimation(content, animation); 9063 } 9064 } 9065 if (nonMatchingIds.length > 0) { 9066 console.warn('No matching elements found in the document for the following IDs provided in "aria-controls":', nonMatchingIds); 9067 } 9068 }, 9069 _ret; 9070 for (var i = 0; i < targetElements.length; i++) { 9071 _ret = _loop(); 9072 if (_ret) return _ret.v; 9073 } 9074 } else { 9075 throw emptyAria; // Throw an error if an element with [data-disclosure-control] has an empty 'aria-controls' attribute, and stop executing the rest of the script 9076 } 9077 } else { 9078 throw missingAria; // Throw an error if an element with [data-disclosure-control] is missing an 'aria-controls' attribute, and stop executing the rest of the script 9079 } 9080 this.UpdateButtonStates(this.controls); // Update the control button states again once all the toggleable elements are done updating their states 9081 }, 9082 /** 9083 * SetAnimation 9084 * @return void 9085 */ 9086 // Animation handling 9087 SetAnimation: function SetAnimation(content, animation) { 9088 //replacement for jQuery's content.stop().hide() and content.stop().show(). We may want to test if the element is visible at all rather than test for the 'active' class and setting it, instead simply toggling display. (adding/removing display: none inline) 9089 function toggleContent() { 9090 if (!content.classList.contains('active')) { 9091 content.classList.add('active'); 9092 } else { 9093 content.classList.remove('active'); 9094 } 9095 } 9096 9097 //othercontent is no longer controlled by the disclosure script. It is instead decided by the tablist, modal, navigation or accordion scripts, depending on the context. This particularly happens with the way the animations work. For example, accordion items should open/close at the same time, while active tablist items/modals should not have a fadeout animation to instantly make room for the next item. 9098 9099 //todo: fade, height and width transitions currently do not work on nested content with parents that are not visible. (Their scrollHeight/scrollWidth defaults to 0px because the parent is also 0px, and 'transitionend' does not trigger because the element is not rendered when the parent is not. We should eventually fix this, but the situations where something like this occurs is pretty sparse 9100 9101 // Check the visitor's motion preferences. If nothing is specified, execute the animation that is specified for the element. We need to set this check because in our CSS, we set the transition-duration to 0, which would mean that things break since 'transitionEnd' is never called. We could possibly rectify this by instead declaring a transition with a very low duration (like 1ms). 9102 if (!reducedMotion.matches) { 9103 //the duration of the animations is dictated by the animation-duration CSS property. It has a default that we can overwrite in our CSS whenever we want. 9104 9105 // The animation used for toggling the element from a fixed set of options. Uses the class 'active' because it's what our _animations.mjs functions use // todo: the 'active' class indicates items that are expanded here. In _disclosure.mjs, we are using the value of [data-disclosure-content]. We should probably not rely on 2 separate values for this 9106 switch (animation) { 9107 // Expand or collapse the element's height 9108 case _animations_mjs__WEBPACK_IMPORTED_MODULE_0__.animationsList.toggleHeight: 9109 if (!content.classList.contains('active')) { 9110 (0,_animations_mjs__WEBPACK_IMPORTED_MODULE_0__.expandHeight)(content); 9111 } else { 9112 (0,_animations_mjs__WEBPACK_IMPORTED_MODULE_0__.collapseHeight)(content); 9113 } 9114 break; 9115 9116 // Expand or collapse the element's width 9117 case _animations_mjs__WEBPACK_IMPORTED_MODULE_0__.animationsList.toggleWidth: 9118 if (!content.classList.contains('active')) { 9119 (0,_animations_mjs__WEBPACK_IMPORTED_MODULE_0__.expandWidth)(content); 9120 } else { 9121 (0,_animations_mjs__WEBPACK_IMPORTED_MODULE_0__.collapseWidth)(content); 9122 } 9123 break; 9124 9125 // Fade the element in or out 9126 case _animations_mjs__WEBPACK_IMPORTED_MODULE_0__.animationsList.toggleFade: 9127 if (!content.classList.contains('active')) { 9128 (0,_animations_mjs__WEBPACK_IMPORTED_MODULE_0__.fadeIn)(content); 9129 } else { 9130 (0,_animations_mjs__WEBPACK_IMPORTED_MODULE_0__.fadeOut)(content); 9131 } 9132 break; 9133 case _animations_mjs__WEBPACK_IMPORTED_MODULE_0__.animationsList.toggleTransform: 9134 if (!content.classList.contains('active')) { 9135 (0,_animations_mjs__WEBPACK_IMPORTED_MODULE_0__.transformIn)(content); 9136 } else { 9137 (0,_animations_mjs__WEBPACK_IMPORTED_MODULE_0__.transformOut)(content); 9138 } 9139 break; 9140 9141 // Any value that is not one of the other values within this switch statement (including null/empty) will assume that the element has no toggle animation, and apply the 'active' class to toggle the element's 'active' styles immediately. 9142 // This is always the case for users that have their motion preferences set to reduced, because the check above the Switch Statement leaves the value of 'animation' as 'null'. 9143 default: 9144 toggleContent(); 9145 break; 9146 } 9147 } else { 9148 // I want the 'default' case in the Switch-statement above to execute for reduced-motion 9149 toggleContent(); 9150 } 9151 } 9152}; 9153 9154 9155/***/ }), 9156
9157/***/ "./src/scripts/modules/_navigation.mjs": 9158/*!*********************************************!*\ 9159 !*** ./src/scripts/modules/_navigation.mjs ***! 9160 \*********************************************/ 9161/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { 9162 9163"use strict"; 9164__webpack_require__.r(__webpack_exports__); 9165/* harmony export */ __webpack_require__.d(__webpack_exports__, { 9166/* harmony export */ navigation: () => (/* binding */ navigation) 9167/* harmony export */ }); 9168//todo: for mobile, all items in the inactive slides should have a tabindex of -1 9169//todo: Disabled navigation items should not be focusable by either providing a tabindex of -1 or removing the href attribute. 9170//todo: add functionality for regular fade and fadeindown 9171//todo: aria-current-link support 9172//todo: adjust for RTL documents 9173//todo: close the menu if it was open on mobile when screen changes size (e.g. remove the backdrop) 9174//todo: menu patterns are a bit different. They require a menu to be closed when focus leaves the area. 9175 9176/*controls: 9177* Down arrow: 9178* 9179* Right arrow: 9180* 9181* Left arrow: 9182* 9183* Up arrow: 9184* 9185* Home: 9186* 9187* End: 9188* 9189* Escape: 9190* 9191* 9192* 9193* 9194* 9195* <!--The following Keyboard support has not been added yet: 9196-Implementing the optional arrow key support should prevent the default page scroll behavior when focus is contained within the data-disclosure region. 9197Down/Right arrow: 9198 -If focus is on a top-level link or top-level button and its dropdown is collapsed, and it is not the last top-level item, moves focus to the next top-level button or top-level link. 9199 -If focus is on a top-level button and its dropdown is expanded, moves focus to the first link in the dropdown. 9200 -If focus is on a link within an expanded dropdown, and it is not the last link, moves focus to the next link. 9201Up/Left Arrow: 9202 -If focus is on a top-level link or top-level button, and it is not the first top-level item, moves focus to the previous top-level button or top-level link. 9203 -If focus is on a link within an expanded dropdown, and it is not the first link, moves focus to the previous link. 9204Home: 9205 -If focus is on a top-level link or top-level button, and it is not the first top-level item, moves focus to the first top-level button or top-level link. 9206 -If focus is on a link within an expanded dropdown, and it is not the first link, moves focus to the first link. 9207End: 9208 -If focus is on a top-level link or top-level button, and it is not the last top-level item, moves focus to the last top-level button or top-level link. 9209 -If focus is on a link within an expanded dropdown, and it is not the last link, moves focus to the last link. 9210Escape (Required): 9211 -If a dropdown is open, and focus is inside the wrapping data-disclosure, closes it and sets focus on the button that controls that dropdown. 9212 -Moving focus out of the wrapping data-disclosure also closes the dropdown 9213--> 9214* 9215 */ 9216 9217function navigation() { 9218 'use strict'; 9219 9220 var reducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)'); 9221 function Navigation(options) { 9222 this.Init(options); 9223 } 9224 Navigation.prototype = { 9225 /** 9226 * Constructor 9227 * @Param object options 9228 * @return void 9229 */ 9230 Init: function Init(options) { 9231 this.options = Object.assign({ 9232 navs: '.js-navigation' 9233 }, options); 9234 this.navs = document.querySelectorAll(this.options.navs); 9235 this.Start(); 9236 }, 9237 Start: function Start() { 9238 var _this = this; 9239 var navs = this.navs; 9240 navs.forEach(function (nav) { 9241 var menus = nav.querySelectorAll('ul[data-level]'); 9242 var items = nav.querySelectorAll('.navigation-item'); 9243 var controls = nav.querySelectorAll('button.navigation-item[aria-controls]'); 9244 var duration = nav.getAttribute('data-menu-duration'); 9245 controls.forEach(function (control) { 9246 control.setAttribute('aria-expanded', 'false'); 9247 }); 9248 if (duration) { 9249 nav.querySelectorAll('ul[data-level]').forEach(function (menu) { 9250 menu.style.transitionDuration = parseInt(duration) + 'ms'; 9251 }); 9252 } 9253 _this.SetEvents(nav, menus, items); 9254 }); 9255 }, 9256 /** 9257 * SetEvents 9258 * @return void 9259 */ 9260 SetEvents: function SetEvents(nav, menus, items) { 9261 var _this = this;
9262 menus.forEach(function (menu) { 9263 var level = menu.getAttribute('data-level'); 9264 var controls = menu.querySelectorAll(':scope > li > button.navigation-item[aria-controls]'); 9265 var submenus = menu.querySelectorAll('.navigation-submenu.expanded'); 9266 var nav = menu.closest('.js-navigation'); 9267 var duration = parseInt(nav.getAttribute('data-menu-duration')); 9268 menu.addEventListener('keydown', function (e) { 9269 e.stopPropagation(); 9270 if (e.which === 27 && level > 1) { 9271 if (menu.classList.contains('collapsing')) { 9272 e.preventDefault(); 9273 } else { 9274 menu.classList.add('collapsing'); 9275 submenus.forEach(function (submenu) { 9276 submenu.classList.add('collapsing'); 9277 }); 9278 menu.querySelectorAll('.navigation-item[aria-expanded=true]').forEach(function (item) { 9279 item.setAttribute('aria-expanded', 'false'); 9280 }); 9281 setTimeout(function () { 9282 menu.classList.remove('collapsing', 'expanded'); 9283 menu.style.display = 'none'; 9284 submenus.forEach(function (submenu) { 9285 submenu.style.display = 'none'; 9286 }); 9287 }, reducedMotion.matches || !reducedMotion ? 0 : duration); 9288 nav.querySelector('[aria-controls=' + menu.id + ']').setAttribute('aria-expanded', 'false'); 9289 nav.querySelector('[aria-controls=' + menu.id + ']').focus(); 9290 } 9291 } 9292 }); 9293 controls.forEach(function (control) { 9294 control.addEventListener('click', function (e) { 9295 var target = nav.querySelector('#' + control.getAttribute('aria-controls')); 9296 if (target.classList.contains('expanding') || target.classList.contains('collapsing')) { 9297 e.preventDefault(); 9298 } else { 9299 fireEvent(control, target); 9300 } 9301 }); 9302 }); 9303 function fireEvent(control, target) { 9304 /* 9305 function setExpandedState(e) { 9306 9307 if ($control.getAttribute('aria-expanded') === 'true') { 9308 9309 } else { 9310 $controls.forEach(function(ctrl) { 9311 if (ctrl !== $control) { 9312 ctrl.setAttribute('aria-expanded', 'false'); 9313 } 9314 }); 9315 $control.setAttribute('aria-expanded', 'true'); 9316 9317 Array.from(document.querySelectorAll('[data-level]')).forEach(function(element) { 9318 if (element.getAttribute('data-level') > parseInt($level)) { 9319 element.style.display = 'none'; 9320 Array.from(element.querySelectorAll('button.nav-item[aria-controls]')).forEach(function(item) { 9321 item.setAttribute('aria-expanded', 'false'); 9322 }); 9323 } 9324 }); 9325 9326 $target.style.display = 'block'; 9327 } 9328 } 9329 */ 9330 9331 var submenus = target.querySelectorAll('[data-level]'); 9332 if (control.getAttribute('aria-expanded') === 'true') { 9333 target.classList.add('collapsing'); 9334 target.querySelectorAll('.navigation-item[aria-expanded=true]').forEach(function (item) { 9335 item.setAttribute('aria-expanded', 'false'); 9336 }); 9337 submenus.forEach(function (submenu) { 9338 submenu.classList.add('collapsing'); 9339 submenu.querySelectorAll('.navigation-item[aria-expanded=true]').forEach(function (submenItem) { 9340 submenu.setAttribute('aria-expanded', 'false'); 9341 }); 9342 }); 9343 target.closest('li').querySelector('[aria-controls=' + target.id + ']').setAttribute('aria-expanded', 'false'); 9344 setTimeout(function () { 9345 target.classList.remove('collapsing', 'expanded'); 9346 target.style.display = 'none';
9347 submenus.forEach(function (submenu) { 9348 submenu.classList.remove('collapsing', 'expanded'); 9349 submenu.style.display = 'none'; 9350 }); 9351 }, reducedMotion.matches || !reducedMotion ? 0 : duration); 9352 control.setAttribute('aria-expanded', 'false'); 9353 } else { 9354 controls.forEach(function (ctrl) { 9355 if (ctrl !== control && !ctrl.closest('li.goback')) { 9356 ctrl.setAttribute('aria-expanded', 'false'); 9357 } 9358 }); 9359 control.setAttribute('aria-expanded', 'true'); 9360 target.querySelector('[aria-controls=' + target.id + ']').setAttribute('aria-expanded', 'true'); 9361 Array.from(document.querySelectorAll('[data-level]')).forEach(function (element) { 9362 if (element.id !== target.id && element.getAttribute('data-level') > parseInt(level) && element.classList.contains('expanded')) { 9363 element.classList.add('collapsing'); 9364 Array.from(element.querySelectorAll('.navigation-item[aria-controls]')).forEach(function (item) { 9365 item.setAttribute('aria-expanded', 'false'); 9366 }); 9367 } 9368 }); 9369 setTimeout(function () { 9370 document.querySelectorAll('[data-level]').forEach(function (element) { 9371 if (element.getAttribute('data-level') > parseInt(level) && element.classList.contains('collapsing')) { 9372 element.classList.remove('collapsing', 'expanded'); 9373 element.style.display = 'none'; 9374 element.querySelectorAll('.navigation-item[aria-expanded=true]').forEach(function (item) { 9375 item.setAttribute('aria-expanded', 'false'); 9376 }); 9377 } 9378 }); 9379 }, reducedMotion.matches ? 0 : duration); 9380 target.style.display = 'block'; // Show the target element 9381 setTimeout(function () { 9382 target.classList.add('expanding'); 9383 }, 30); 9384 setTimeout(function () { 9385 target.classList.add('expanded'); 9386 target.classList.remove('expanding'); 9387 }, reducedMotion.matches ? 0 : duration); 9388 } 9389 } 9390 if (window.outerWidth >= 1024 && nav.getAttribute('data-hover') === 'true') { 9391 controls.forEach(function (ctrl) { 9392 ctrl.closest('li').addEventListener('mouseenter', function (e) { 9393 var control = this.querySelector('button.navigation-item[aria-controls]'); 9394 var target = document.getElementById(control.getAttribute('aria-controls')); 9395 fireEvent(control, target); 9396 }); 9397 /* 9398 ctrl.closest('li').addEventListener('mouseleave', function() { 9399 let control = this.querySelector('button.navigation-item[aria-controls]'); 9400 let target = document.getElementById(control.getAttribute('aria-controls')); 9401 target.classList.add('collapsing'); 9402 control.setAttribute('aria-expanded', 'false'); 9403 setTimeout(function() { 9404 target.classList.remove('collapsing'); 9405 target.classList.remove('expanded'); 9406 target.style.display = 'none'; 9407 }, reducedMotion.matches ? 0 : duration); 9408 }); 9409 */ 9410 }); 9411 } 9412 //mouseleave should close the menu, not click. mouseleave function is used to ensure that loading a page with hover already on the disclosure item will close the item when the mouse leaves 9413 }); 9414 items.forEach(function (item) { 9415 item.addEventListener('keydown', function (e) { 9416 var keyCode = e.which; 9417 var prevSibling = item.previousElementSibling; 9418 var nextSibling = item.nextElementSibling; 9419 switch (keyCode) { 9420 case 32: 9421 e.preventDefault(); 9422 item.click(); 9423 break; 9424 case 35: 9425 e.preventDefault(); 9426 item.closest('ul[data-level]').querySelector('> li:last-child .navigation-item').focus(); //needs to be tested 9427 break; 9428 case 36: 9429 e.preventDefault(); 9430 item.closest('ul[data-level]').querySelector('> li:first-child .navigation-item').focus(); //needs to be tested 9431 break; 9432 case 37: 9433 e.preventDefault(); 9434 if (prevSibling && prevSibling.classList.contains('navigation-item')) { 9435 prevSibling.focus(); 9436 } else { 9437 prevSibling = item.closest('li').previousElementSibling; 9438 if (prevSibling) { 9439 var directChildren = Array.from(prevSibling.querySelectorAll('.navigation-item')).filter(function (child) { 9440 return child.parentNode === prevSibling; 9441 }); 9442 if (directChildren.length > 0) { 9443 var lastNavItem = directChildren[directChildren.length - 1]; 9444 lastNavItem.focus(); 9445 } else { 9446 return; 9447 } 9448 } else { 9449 return; 9450 } 9451 } 9452 break; 9453 case 38: 9454 e.preventDefault(); 9455 if (prevSibling && prevSibling.classList.contains('navigation-item')) { 9456 prevSibling.focus(); 9457 } else { 9458 prevSibling = item.closest('li').previousElementSibling; 9459 console.log(prevSibling); 9460 if (prevSibling) { 9461 var _directChildren = Array.from(prevSibling.querySelectorAll('.navigation-item')).filter(function (child) { 9462 return child.parentNode === prevSibling; 9463 }); 9464 if (_directChildren.length > 0) { 9465 var _lastNavItem = _directChildren[_directChildren.length - 1]; 9466 _lastNavItem.focus(); 9467 } else { 9468 return; 9469 } 9470 } else { 9471 return; 9472 } 9473 } 9474 break; 9475 case 39: 9476 e.preventDefault(); 9477 if (item.getAttribute('aria-expanded') === 'true' && item.closest('ul[data-level]').getAttribute('data-level') !== '1') { 9478 var firstNavItem = document.getElementById(item.getAttribute('aria-controls')).querySelector('li:not(.goback) > .navigation-item'); 9479 if (firstNavItem) { 9480 firstNavItem.focus(); 9481 } 9482 } else { 9483 if (nextSibling && nextSibling.classList.contains('navigation-item')) { 9484 nextSibling.focus(); 9485 } else { 9486 nextSibling = item.closest('li').nextElementSibling; 9487 if (nextSibling) { 9488 var _directChildren2 = Array.from(nextSibling.querySelectorAll('.navigation-item')).filter(function (child) { 9489 return child.parentNode === nextSibling; 9490 }); 9491 if (_directChildren2.length > 0) { 9492 var _firstNavItem = _directChildren2[0]; 9493 _firstNavItem.focus(); 9494 } else { 9495 return; 9496 } 9497 } else { 9498 return; 9499 } 9500 } 9501 } 9502 break; 9503 case 40: 9504 e.preventDefault(); 9505 if (item.getAttribute('aria-expanded') === 'true' && item.closest('ul[data-level]').getAttribute('data-level') === '1') { 9506 var _firstNavItem2 = document.getElementById(item.getAttribute('aria-controls')).querySelector('li:not(.goback) > .navigation-item'); 9507 if (_firstNavItem2) { 9508 _firstNavItem2.focus(); 9509 } 9510 } else { 9511 var _nextSibling = item.nextElementSibling; 9512 if (_nextSibling && _nextSibling.classList.contains('navigation-item')) { 9513 _nextSibling.focus(); 9514 } else { 9515 _nextSibling = item.closest('li').nextElementSibling; 9516 if (_nextSibling) { 9517 var _directChildren3 = Array.from(_nextSibling.querySelectorAll('.navigation-item')).filter(function (child) { 9518 return child.parentNode === _nextSibling; 9519 }); 9520 if (_directChildren3.length > 0) { 9521 var _firstNavItem3 = _directChildren3[0]; 9522 _firstNavItem3.focus(); 9523 } else { 9524 return; 9525 } 9526 } else { 9527 return; 9528 } 9529 } 9530 } 9531 break; 9532 } 9533 }); 9534 }); 9535 document.addEventListener('click', function (e) { 9536 var target = e.target; 9537 var isSubmenu = target.closest('ul[data-level] ul[data-level]'); 9538 var isNavItem = target.classList.contains('navigation-item'); 9539 if (!isSubmenu && !isNavItem) { 9540 var activeControl = document.querySelector('.navigation-item[aria-expanded="true"]'); 9541 if (activeControl) { 9542 var activeMenuId = activeControl.getAttribute('aria-controls'); 9543 var activeMenu = document.getElementById(activeMenuId); 9544 activeMenu.classList.add('collapsing'); 9545 activeControl.setAttribute('aria-expanded', 'false'); 9546 setTimeout(function () { 9547 activeMenu.classList.remove('collapsing', 'expanded'); 9548 activeMenu.style.display = 'none'; 9549 }, reducedMotion.matches ? 0 : parseInt(nav.getAttribute('data-menu-duration'))); 9550 } 9551 } 9552 }); 9553 } 9554 }; 9555 new Navigation(); 9556 return 'navigation'; 9557} 9558 9559/***/ }), 9560
9561/***/ "./src/scripts/modules/_serviceWorker.mjs": 9562/*!************************************************!*\ 9563 !*** ./src/scripts/modules/_serviceWorker.mjs ***! 9564 \************************************************/ 9565/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { 9566 9567"use strict"; 9568__webpack_require__.r(__webpack_exports__); 9569/* harmony export */ __webpack_require__.d(__webpack_exports__, { 9570/* harmony export */ serviceWorker: () => (/* binding */ serviceWorker) 9571/* harmony export */ }); 9572function serviceWorker() { 9573 // Register a service worker hosted at the root of the site using the default scope. 9574 if ('serviceWorker' in navigator) { 9575 navigator.serviceWorker.register('/serviceWorker.js').then(function (registration) { 9576 // Registration was successful 9577 console.log('ServiceWorker registration successful with scope: ', registration.scope); 9578 })["catch"](function (error) { 9579 // registration failed 9580 console.log('ServiceWorker registration failed: ', error); 9581 }); 9582 } else { 9583 // Fallback 9584 console.error('Service workers are not supported.'); 9585 } 9586 return 'serviceWorker'; 9587} 9588 9589/***/ }), 9590
9591/***/ "./src/scripts/modules/_setActiveStartItems.mjs": 9592/*!******************************************************!*\ 9593 !*** ./src/scripts/modules/_setActiveStartItems.mjs ***! 9594 \******************************************************/ 9595/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { 9596 9597"use strict"; 9598__webpack_require__.r(__webpack_exports__); 9599/* harmony export */ __webpack_require__.d(__webpack_exports__, { 9600/* harmony export */ setActiveStartItems: () => (/* binding */ setActiveStartItems) 9601/* harmony export */ }); 9602// todo: open and close buttons don't respond on page load yet, only after the disclosure script has fired at least once. This seems to have to do with updateButtonstates. 9603 9604function setActiveStartItems(contents, _this) { 9605 // If a URL hash exists, put decode it and put its value in a variable 'hash' and remove any '!' characters to make sure it doesn't break 9606 if (window.location.hash) { 9607 var hash = decodeURI(window.location.hash).replace(/(!)/g, "\\$1"); 9608 var matchingContent = document.querySelector(hash + _this.options.contents); // Search the document for the first element that matches the value of 'hash', and put that in the variable 'contentHash'. 9609 if (matchingContent) { 9610 // Check if the contentHash actually contains an element, and if that element is a toggleable element // todo: we should probably not be looking for 'data-disclosure-content' directly, but for the value declared in this.options.contents so the two values always correspond to each other 9611 matchingContent.setAttribute('data-disclosure-content', 'open'); // If yes, set the element's state to 'open' 9612 } 9613 } 9614 contents.forEach(function (content) { 9615 // Iterate through all the toggleable elements on the page 9616 9617 var animation = null; 9618 if (content.getAttribute('data-disclosure-content') === 'open' || content.querySelector('[data-disclosure-content=open]')) { 9619 // check if the toggleable element's state is set to 'open', or if it contains a toggleable child element that is set to 'open' 9620 9621 content.setAttribute('data-disclosure-content', 'open'); // for toggleable elements that contain child elements that have their states set to 'open', set their states to 'open' to allow the children to be shown as well. 9622 // For toggleable elements that are set to the 'open' state, or contain child elements that have the 'open' state, jump to 'SetAnimation' so we can animate them in on page load. We use a small delay to make sure the browser is ready to render the animation 9623 animation = content.getAttribute('data-animate'); 9624 if (!animation) { 9625 var parentElement = content.closest('[data-animate]'); 9626 if (parentElement) { 9627 animation = parentElement.getAttribute('data-animate'); 9628 } 9629 } 9630 9631 // don't execute animation if target element is set to be immediately visible 9632 if (content.classList.contains('active')) { 9633 return; 9634 } 9635 setTimeout(function () { 9636 _this.SetAnimation(content, animation); 9637 }); 9638 } else { 9639 content.setAttribute('data-disclosure-content', 'closed'); // For all toggleable elements that do not have their state explicitly declared as 'open' in the HTML or match the variable of contentHash above, assume their state to be 'closed' on page load 9640 } 9641 }); 9642} 9643 9644/***/ }), 9645
9646/***/ "./src/scripts/modules/_validate.mjs": 9647/*!*******************************************!*\ 9648 !*** ./src/scripts/modules/_validate.mjs ***! 9649 \*******************************************/ 9650/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { 9651 9652"use strict"; 9653__webpack_require__.r(__webpack_exports__); 9654/* harmony export */ __webpack_require__.d(__webpack_exports__, { 9655/* harmony export */ validate: () => (/* binding */ validate) 9656/* harmony export */ }); 9657/* provided dependency */ var $ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js"); 9658/* provided dependency */ var axios = __webpack_require__(/*! axios */ "./node_modules/axios/index.js"); 9659function validate() { 9660 // Get the user's preferred motion settings 9661 var reducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)'); 9662 $('form.validate, form.needs-validation').submit(function (e) { 9663 // Don't automatically post data on submit 9664 e.preventDefault(); 9665 9666 // Declare Variables 9667 var form = $(this); 9668 var feedback = form.find('.feedback'); 9669 var button = form.find('button[type="submit"]'); 9670 var url = form.attr('action'); 9671 var data = new FormData(this); 9672 var alert_message = feedback.find('.alert'); 9673 var language = $('html').attr('lang'); 9674 var html = ''; 9675 var buttonValue = button.html(); 9676 9677 // Get all languages 9678 var ButtonLoadingValue; 9679 var warningMessage; 9680 var errorMessage; 9681 switch (language) { 9682 case 'en': 9683 ButtonLoadingValue = 'Loading'; 9684 warningMessage = 'Could not send form'; 9685 errorMessage = 'An unspecified error has occurred while processing your request. Please try again.'; 9686 break; 9687 case 'nl': 9688 ButtonLoadingValue = 'Laden'; 9689 warningMessage = 'Probleem met versturen'; 9690 errorMessage = 'Er heeft zich een onverwachts probleem voorgedaan bij het verwerken van uw verzoek. Probeer het nog eens.'; 9691 break; 9692 } 9693 9694 // Return error if Honeypot input field is missing 9695 if (form.find('input[name="gender"]').length === 0) { 9696 alert('Honeypot field is missing...'); 9697 return false; 9698 } 9699 9700 // Return error if feedback container div is missing 9701 if (feedback.length === 0) { 9702 alert('<div> with class ".feedback" is missing...'); 9703 return false; 9704 } 9705 9706 // Change button to disabled when form is busy processing the data based on language 9707 button.html(ButtonLoadingValue).attr('disabled', 'disabled'); 9708 button.append('<span class="basicon icon-spinner" aria-hidden="true"></span>'); 9709 9710 // Remove existing alert messages when attempting to submit 9711 feedback.hide(reducedMotion.matches ? 0 : 200, function () { 9712 alert_message.remove(); 9713 }); 9714 9715 // Get Form Response 9716 axios.post(url, data, { 9717 headers: { 9718 'Content-Type': 'multipart/form-data' 9719 } 9720 }).then(function (response) { 9721 var status = response.data.status; 9722 var warnings = response.data.warnings; 9723 var hasError = response.data.hasError; 9724 var message = response.data.message; 9725 9726 // Skip following steps and go to new page if a redirect is called 9727 if (response.data.redirect) { 9728 window.location = response.data.redirect; 9729 return false; 9730 } 9731 9732 // Otherwise, indicate that the form has been validated by the client (
9732add the 'required' attribute for fields that must undergo client-side validation) 9733 form.addClass('was-validated'); 9734 9735 // If an error occurs, populate the alert with negative feedback 9736 if (status === 'error') { 9737 if (!Array.isArray(warnings)) { 9738 warnings = []; 9739 } 9740 html += '<div class="alert alert-danger alert-dismissible" role="alert"><button type="button" class="alert-dismiss" aria-label="Close"></button><div class="alert-heading"><span class="basicon icon-attention-triangle" aria-hidden="true"></span><strong>' + warningMessage + '</strong></div><hr><ul>'; 9741 9742 // Show all the warnings 9743 if (warnings.length > 0) { 9744 $(warnings).each(function (index, value) { 9745 html += '<li><span class="basicon icon-cancel-circled" aria-hidden="true"></span>' + value + '</li>'; 9746 }); 9747 } else { 9748 html += '<li>' + message + '</li>'; 9749 } 9750 html += '</ul></div>'; 9751 } 9752 9753 // If the form is sent successfully, populate the alert with positive feedback 9754 if (status === 'success') { 9755 html += '<div class="alert alert-success alert-dismissible" role="alert"><button type="button" class="alert-dismiss" aria-label="Close"></button><div class="alert-heading"><span class="basicon icon-check-circled" aria-hidden="true"></span><strong style="font-weight:normal;">' + message + '</strong></div></div>'; 9756 } 9757 9758 // Show the alert and revert the button state 9759 feedback.html(html).show(reducedMotion.matches ? 0 : 200); 9760 button.html(buttonValue).attr('disabled', false); 9761 if (response.data.clear) { 9762 form.trigger('reset'); 9763 } 9764 9765 // If an internal error occurs, alert the user 9766 })["catch"](function (error) { 9767 console.log(error); //log the error 9768 9769 // Show the alert and revert the button state 9770 feedback.html('<div class="alert alert-danger alert-dismissible" role="alert"><button type="button" class="alert-dismiss" aria-label="Close"></button><div class="alert-heading"><span class="basicon icon-attention-triangle" aria-hidden="true"></span><strong style="font-weight:normal;">' + errorMessage + '</strong></div></div>').show(reducedMotion.matches ? 0 : 200); 9771 button.html(buttonValue).attr('disabled', false); 9772 }); 9773 }); 9774 9775 // Handle the dismissing 9776 $(document).on('click', '.alert-dismiss', function (e) { 9777 $(e.target).parents('.feedback').hide(reducedMotion.matches ? 0 : 200, function () { 9778 $(this).find('.alert').remove(); 9779 $(this).closest('form').removeClass('was-validated'); 9780 }); 9781 }); 9782 return 'validate'; 9783} 9784 9785/***/ })
9785 9786 9787}, 9788/******/ __webpack_require__ => { // webpackRuntimeModules 9789/******/ var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId)) 9790/******/ __webpack_require__.O(0, ["assets/css/style","/assets/js/vendor"], () => (__webpack_exec__("./src/scripts/app.js"), __webpack_exec__("./src/styles/main.scss"))); 9791/******/ var __webpack_exports__ = __webpack_require__.O(); 9792/******/ } 9793]); 9794//# sourceMappingURL=app.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.