/*! jQuery v3.6.0 | (c) OpenJS Foundation and other contributors | jquery.org/license */ !function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(C,e){"use strict";var t=[],r=Object.getPrototypeOf,s=t.slice,g=t.flat?function(e){return t.flat.call(e)}:function(e){return t.concat.apply([],e)},u=t.push,i=t.indexOf,n={},o=n.toString,v=n.hasOwnProperty,a=v.toString,l=a.call(Object),y={},m=function(e){return"function"==typeof e&&"number"!=typeof e.nodeType&&"function"!=typeof e.item},x=function(e){return null!=e&&e===e.window},E=C.document,c={type:!0,src:!0,nonce:!0,noModule:!0};function b(e,t,n){var r,i,o=(n=n||E).createElement("script");if(o.text=e,t)for(r in c)(i=t[r]||t.getAttribute&&t.getAttribute(r))&&o.setAttribute(r,i);n.head.appendChild(o).parentNode.removeChild(o)}function w(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?n[o.call(e)]||"object":typeof e}var f="3.6.0",S=function(e,t){return new S.fn.init(e,t)};function p(e){var t=!!e&&"length"in e&&e.length,n=w(e);return!m(e)&&!x(e)&&("array"===n||0===t||"number"==typeof t&&0+~]|"+M+")"+M+"*"),U=new RegExp(M+"|>"),X=new RegExp(F),V=new RegExp("^"+I+"$"),G={ID:new RegExp("^#("+I+")"),CLASS:new RegExp("^\\.("+I+")"),TAG:new RegExp("^("+I+"|[*])"),ATTR:new RegExp("^"+W),PSEUDO:new RegExp("^"+F),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+R+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Y=/HTML$/i,Q=/^(?:input|select|textarea|button)$/i,J=/^h\d$/i,K=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ee=/[+~]/,te=new RegExp("\\\\[\\da-fA-F]{1,6}"+M+"?|\\\\([^\\r\\n\\f])","g"),ne=function(e,t){var n="0x"+e.slice(1)-65536;return t||(n<0?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,1023&n|56320))},re=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ie=function(e,t){return t?"\0"===e?"\ufffd":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},oe=function(){T()},ae=be(function(e){return!0===e.disabled&&"fieldset"===e.nodeName.toLowerCase()},{dir:"parentNode",next:"legend"});try{H.apply(t=O.call(p.childNodes),p.childNodes),t[p.childNodes.length].nodeType}catch(e){H={apply:t.length?function(e,t){L.apply(e,O.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function se(t,e,n,r){var i,o,a,s,u,l,c,f=e&&e.ownerDocument,p=e?e.nodeType:9;if(n=n||[],"string"!=typeof t||!t||1!==p&&9!==p&&11!==p)return n;if(!r&&(T(e),e=e||C,E)){if(11!==p&&(u=Z.exec(t)))if(i=u[1]){if(9===p){if(!(a=e.getElementById(i)))return n;if(a.id===i)return n.push(a),n}else if(f&&(a=f.getElementById(i))&&y(e,a)&&a.id===i)return n.push(a),n}else{if(u[2])return H.apply(n,e.getElementsByTagName(t)),n;if((i=u[3])&&d.getElementsByClassName&&e.getElementsByClassName)return H.apply(n,e.getElementsByClassName(i)),n}if(d.qsa&&!N[t+" "]&&(!v||!v.test(t))&&(1!==p||"object"!==e.nodeName.toLowerCase())){if(c=t,f=e,1===p&&(U.test(t)||z.test(t))){(f=ee.test(t)&&ye(e.parentNode)||e)===e&&d.scope||((s=e.getAttribute("id"))?s=s.replace(re,ie):e.setAttribute("id",s=S)),o=(l=h(t)).length;while(o--)l[o]=(s?"#"+s:":scope")+" "+xe(l[o]);c=l.join(",")}try{return H.apply(n,f.querySelectorAll(c)),n}catch(e){N(t,!0)}finally{s===S&&e.removeAttribute("id")}}}return g(t.replace($,"$1"),e,n,r)}function ue(){var r=[];return function e(t,n){return r.push(t+" ")>b.cacheLength&&delete e[r.shift()],e[t+" "]=n}}function le(e){return e[S]=!0,e}function ce(e){var t=C.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function fe(e,t){var n=e.split("|"),r=n.length;while(r--)b.attrHandle[n[r]]=t}function pe(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function de(t){return function(e){return"input"===e.nodeName.toLowerCase()&&e.type===t}}function he(n){return function(e){var t=e.nodeName.toLowerCase();return("input"===t||"button"===t)&&e.type===n}}function ge(t){return function(e){return"form"in e?e.parentNode&&!1===e.disabled?"label"in e?"label"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&ae(e)===t:e.disabled===t:"label"in e&&e.disabled===t}}function ve(a){return le(function(o){return o=+o,le(function(e,t){var n,r=a([],e.length,o),i=r.length;while(i--)e[n=r[i]]&&(e[n]=!(t[n]=e[n]))})})}function ye(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}for(e in d=se.support={},i=se.isXML=function(e){var t=e&&e.namespaceURI,n=e&&(e.ownerDocument||e).documentElement;return!Y.test(t||n&&n.nodeName||"HTML")},T=se.setDocument=function(e){var t,n,r=e?e.ownerDocument||e:p;return r!=C&&9===r.nodeType&&r.documentElement&&(a=(C=r).documentElement,E=!i(C),p!=C&&(n=C.defaultView)&&n.top!==n&&(n.addEventListener?n.addEventListener("unload",oe,!1):n.attachEvent&&n.attachEvent("onunload",oe)),d.scope=ce(function(e){return a.appendChild(e).appendChild(C.createElement("div")),"undefined"!=typeof e.querySelectorAll&&!e.querySelectorAll(":scope fieldset div").length}),d.attributes=ce(function(e){return e.className="i",!e.getAttribute("className")}),d.getElementsByTagName=ce(function(e){return e.appendChild(C.createComment("")),!e.getElementsByTagName("*").length}),d.getElementsByClassName=K.test(C.getElementsByClassName),d.getById=ce(function(e){return a.appendChild(e).id=S,!C.getElementsByName||!C.getElementsByName(S).length}),d.getById?(b.filter.ID=function(e){var t=e.replace(te,ne);return function(e){return e.getAttribute("id")===t}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n=t.getElementById(e);return n?[n]:[]}}):(b.filter.ID=function(e){var n=e.replace(te,ne);return function(e){var t="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return t&&t.value===n}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];i=t.getElementsByName(e),r=0;while(o=i[r++])if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),b.find.TAG=d.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):d.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},b.find.CLASS=d.getElementsByClassName&&function(e,t){if("undefined"!=typeof t.getElementsByClassName&&E)return t.getElementsByClassName(e)},s=[],v=[],(d.qsa=K.test(C.querySelectorAll))&&(ce(function(e){var t;a.appendChild(e).innerHTML="",e.querySelectorAll("[msallowcapture^='']").length&&v.push("[*^$]="+M+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||v.push("\\["+M+"*(?:value|"+R+")"),e.querySelectorAll("[id~="+S+"-]").length||v.push("~="),(t=C.createElement("input")).setAttribute("name",""),e.appendChild(t),e.querySelectorAll("[name='']").length||v.push("\\["+M+"*name"+M+"*="+M+"*(?:''|\"\")"),e.querySelectorAll(":checked").length||v.push(":checked"),e.querySelectorAll("a#"+S+"+*").length||v.push(".#.+[+~]"),e.querySelectorAll("\\\f"),v.push("[\\r\\n\\f]")}),ce(function(e){e.innerHTML="";var t=C.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&v.push("name"+M+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&v.push(":enabled",":disabled"),a.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&v.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),v.push(",.*:")})),(d.matchesSelector=K.test(c=a.matches||a.webkitMatchesSelector||a.mozMatchesSelector||a.oMatchesSelector||a.msMatchesSelector))&&ce(function(e){d.disconnectedMatch=c.call(e,"*"),c.call(e,"[s!='']:x"),s.push("!=",F)}),v=v.length&&new RegExp(v.join("|")),s=s.length&&new RegExp(s.join("|")),t=K.test(a.compareDocumentPosition),y=t||K.test(a.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},j=t?function(e,t){if(e===t)return l=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(1&(n=(e.ownerDocument||e)==(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!d.sortDetached&&t.compareDocumentPosition(e)===n?e==C||e.ownerDocument==p&&y(p,e)?-1:t==C||t.ownerDocument==p&&y(p,t)?1:u?P(u,e)-P(u,t):0:4&n?-1:1)}:function(e,t){if(e===t)return l=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,a=[e],s=[t];if(!i||!o)return e==C?-1:t==C?1:i?-1:o?1:u?P(u,e)-P(u,t):0;if(i===o)return pe(e,t);n=e;while(n=n.parentNode)a.unshift(n);n=t;while(n=n.parentNode)s.unshift(n);while(a[r]===s[r])r++;return r?pe(a[r],s[r]):a[r]==p?-1:s[r]==p?1:0}),C},se.matches=function(e,t){return se(e,null,null,t)},se.matchesSelector=function(e,t){if(T(e),d.matchesSelector&&E&&!N[t+" "]&&(!s||!s.test(t))&&(!v||!v.test(t)))try{var n=c.call(e,t);if(n||d.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(e){N(t,!0)}return 0":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(te,ne),e[3]=(e[3]||e[4]||e[5]||"").replace(te,ne),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||se.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&se.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return G.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&X.test(n)&&(t=h(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(te,ne).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=m[e+" "];return t||(t=new RegExp("(^|"+M+")"+e+"("+M+"|$)"))&&m(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(n,r,i){return function(e){var t=se.attr(e,n);return null==t?"!="===r:!r||(t+="","="===r?t===i:"!="===r?t!==i:"^="===r?i&&0===t.indexOf(i):"*="===r?i&&-1:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function j(e,n,r){return m(n)?S.grep(e,function(e,t){return!!n.call(e,t,e)!==r}):n.nodeType?S.grep(e,function(e){return e===n!==r}):"string"!=typeof n?S.grep(e,function(e){return-1)[^>]*|#([\w-]+))$/;(S.fn.init=function(e,t,n){var r,i;if(!e)return this;if(n=n||D,"string"==typeof e){if(!(r="<"===e[0]&&">"===e[e.length-1]&&3<=e.length?[null,e,null]:q.exec(e))||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof S?t[0]:t,S.merge(this,S.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:E,!0)),N.test(r[1])&&S.isPlainObject(t))for(r in t)m(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return(i=E.getElementById(r[2]))&&(this[0]=i,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):m(e)?void 0!==n.ready?n.ready(e):e(S):S.makeArray(e,this)}).prototype=S.fn,D=S(E);var L=/^(?:parents|prev(?:Until|All))/,H={children:!0,contents:!0,next:!0,prev:!0};function O(e,t){while((e=e[t])&&1!==e.nodeType);return e}S.fn.extend({has:function(e){var t=S(e,this),n=t.length;return this.filter(function(){for(var e=0;e\x20\t\r\n\f]*)/i,he=/^$|^module$|\/(?:java|ecma)script/i;ce=E.createDocumentFragment().appendChild(E.createElement("div")),(fe=E.createElement("input")).setAttribute("type","radio"),fe.setAttribute("checked","checked"),fe.setAttribute("name","t"),ce.appendChild(fe),y.checkClone=ce.cloneNode(!0).cloneNode(!0).lastChild.checked,ce.innerHTML="",y.noCloneChecked=!!ce.cloneNode(!0).lastChild.defaultValue,ce.innerHTML="",y.option=!!ce.lastChild;var ge={thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};function ve(e,t){var n;return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&A(e,t)?S.merge([e],n):n}function ye(e,t){for(var n=0,r=e.length;n",""]);var me=/<|&#?\w+;/;function xe(e,t,n,r,i){for(var o,a,s,u,l,c,f=t.createDocumentFragment(),p=[],d=0,h=e.length;d\s*$/g;function je(e,t){return A(e,"table")&&A(11!==t.nodeType?t:t.firstChild,"tr")&&S(e).children("tbody")[0]||e}function De(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function qe(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Le(e,t){var n,r,i,o,a,s;if(1===t.nodeType){if(Y.hasData(e)&&(s=Y.get(e).events))for(i in Y.remove(t,"handle events"),s)for(n=0,r=s[i].length;n").attr(n.scriptAttrs||{}).prop({charset:n.scriptCharset,src:n.url}).on("load error",i=function(e){r.remove(),i=null,e&&t("error"===e.type?404:200,e.type)}),E.head.appendChild(r[0])},abort:function(){i&&i()}}});var _t,zt=[],Ut=/(=)\?(?=&|$)|\?\?/;S.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=zt.pop()||S.expando+"_"+wt.guid++;return this[e]=!0,e}}),S.ajaxPrefilter("json jsonp",function(e,t,n){var r,i,o,a=!1!==e.jsonp&&(Ut.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&Ut.test(e.data)&&"data");if(a||"jsonp"===e.dataTypes[0])return r=e.jsonpCallback=m(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,a?e[a]=e[a].replace(Ut,"$1"+r):!1!==e.jsonp&&(e.url+=(Tt.test(e.url)?"&":"?")+e.jsonp+"="+r),e.converters["script json"]=function(){return o||S.error(r+" was not called"),o[0]},e.dataTypes[0]="json",i=C[r],C[r]=function(){o=arguments},n.always(function(){void 0===i?S(C).removeProp(r):C[r]=i,e[r]&&(e.jsonpCallback=t.jsonpCallback,zt.push(r)),o&&m(i)&&i(o[0]),o=i=void 0}),"script"}),y.createHTMLDocument=((_t=E.implementation.createHTMLDocument("").body).innerHTML="
",2===_t.childNodes.length),S.parseHTML=function(e,t,n){return"string"!=typeof e?[]:("boolean"==typeof t&&(n=t,t=!1),t||(y.createHTMLDocument?((r=(t=E.implementation.createHTMLDocument("")).createElement("base")).href=E.location.href,t.head.appendChild(r)):t=E),o=!n&&[],(i=N.exec(e))?[t.createElement(i[1])]:(i=xe([e],t,o),o&&o.length&&S(o).remove(),S.merge([],i.childNodes)));var r,i,o},S.fn.load=function(e,t,n){var r,i,o,a=this,s=e.indexOf(" ");return-1").append(S.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(this,o||[e.responseText,t,e])})}),this},S.expr.pseudos.animated=function(t){return S.grep(S.timers,function(e){return t===e.elem}).length},S.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l=S.css(e,"position"),c=S(e),f={};"static"===l&&(e.style.position="relative"),s=c.offset(),o=S.css(e,"top"),u=S.css(e,"left"),("absolute"===l||"fixed"===l)&&-1<(o+u).indexOf("auto")?(a=(r=c.position()).top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),m(t)&&(t=t.call(e,n,S.extend({},s))),null!=t.top&&(f.top=t.top-s.top+a),null!=t.left&&(f.left=t.left-s.left+i),"using"in t?t.using.call(e,f):c.css(f)}},S.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){S.offset.setOffset(this,t,e)});var e,n,r=this[0];return r?r.getClientRects().length?(e=r.getBoundingClientRect(),n=r.ownerDocument.defaultView,{top:e.top+n.pageYOffset,left:e.left+n.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var e,t,n,r=this[0],i={top:0,left:0};if("fixed"===S.css(r,"position"))t=r.getBoundingClientRect();else{t=this.offset(),n=r.ownerDocument,e=r.offsetParent||n.documentElement;while(e&&(e===n.body||e===n.documentElement)&&"static"===S.css(e,"position"))e=e.parentNode;e&&e!==r&&1===e.nodeType&&((i=S(e).offset()).top+=S.css(e,"borderTopWidth",!0),i.left+=S.css(e,"borderLeftWidth",!0))}return{top:t.top-i.top-S.css(r,"marginTop",!0),left:t.left-i.left-S.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent;while(e&&"static"===S.css(e,"position"))e=e.offsetParent;return e||re})}}),S.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,i){var o="pageYOffset"===i;S.fn[t]=function(e){return $(this,function(e,t,n){var r;if(x(e)?r=e:9===e.nodeType&&(r=e.defaultView),void 0===n)return r?r[i]:e[t];r?r.scrollTo(o?r.pageXOffset:n,o?n:r.pageYOffset):e[t]=n},t,e,arguments.length)}}),S.each(["top","left"],function(e,n){S.cssHooks[n]=Fe(y.pixelPosition,function(e,t){if(t)return t=We(e,n),Pe.test(t)?S(e).position()[n]+"px":t})}),S.each({Height:"height",Width:"width"},function(a,s){S.each({padding:"inner"+a,content:s,"":"outer"+a},function(r,o){S.fn[o]=function(e,t){var n=arguments.length&&(r||"boolean"!=typeof e),i=r||(!0===e||!0===t?"margin":"border");return $(this,function(e,t,n){var r;return x(e)?0===o.indexOf("outer")?e["inner"+a]:e.document.documentElement["client"+a]:9===e.nodeType?(r=e.documentElement,Math.max(e.body["scroll"+a],r["scroll"+a],e.body["offset"+a],r["offset"+a],r["client"+a])):void 0===n?S.css(e,t,i):S.style(e,t,n,i)},s,n?e:void 0,n)}})}),S.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){S.fn[t]=function(e){return this.on(t,e)}}),S.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)},hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),S.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,n){S.fn[n]=function(e,t){return 0",{size:1}).attr("size")&&a.attrFn,h=a.attr,i=a.attrHooks.value&&a.attrHooks.value.get||function(){return null},j=a.attrHooks.value&&a.attrHooks.value.set||function(){return c},k=/^(?:input|button)$/i,l=/^[238]$/,m=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,n=/^(?:checked|selected)$/i;e(a,"attrFn",g||{},"jQuery.attrFn is deprecated"),a.attr=function(b,e,f,i){var j=e.toLowerCase(),o=b&&b.nodeType;return i&&(h.length<4&&d("jQuery.fn.attr( props, pass ) is deprecated"),b&&!l.test(o)&&(g?e in g:a.isFunction(a.fn[e])))?a(b)[e](f):("type"===e&&f!==c&&k.test(b.nodeName)&&b.parentNode&&d("Can't change the 'type' of an input or button in IE 6/7/8"),!a.attrHooks[j]&&m.test(j)&&(a.attrHooks[j]={get:function(b,d){var e,f=a.prop(b,d);return f===!0||"boolean"!=typeof f&&(e=b.getAttributeNode(d))&&e.nodeValue!==!1?d.toLowerCase():c},set:function(b,c,d){var e;return c===!1?a.removeAttr(b,d):(e=a.propFix[d]||d,e in b&&(b[e]=!0),b.setAttribute(d,d.toLowerCase())),d}},n.test(j)&&d("jQuery.fn.attr('"+j+"') might use property instead of attribute")),h.call(a,b,e,f))},a.attrHooks.value={get:function(a,b){var c=(a.nodeName||"").toLowerCase();return"button"===c?i.apply(this,arguments):("input"!==c&&"option"!==c&&d("jQuery.fn.attr('value') no longer gets properties"),b in a?a.value:null)},set:function(a,b){var c=(a.nodeName||"").toLowerCase();return"button"===c?j.apply(this,arguments):("input"!==c&&"option"!==c&&d("jQuery.fn.attr('value', val) no longer sets properties"),void(a.value=b))}};var o,p,q=a.fn.init,r=a.find,s=a.parseJSON,t=/^\s*)([^>]*)$/;a.fn.init=function(b,e,f){var g,h;return b&&"string"==typeof b&&!a.isPlainObject(e)&&(g=w.exec(a.trim(b)))&&g[0]&&(t.test(b)||d("$(html) HTML strings must start with '<' character"),g[3]&&d("$(html) HTML text after last tag is ignored"),"#"===g[0].charAt(0)&&(d("HTML string cannot start with a '#' character"),a.error("JQMIGRATE: Invalid selector string (XSS)")),e&&e.context&&e.context.nodeType&&(e=e.context),a.parseHTML)?q.call(this,a.parseHTML(g[2],e&&e.ownerDocument||e||document,!0),e,f):(h=q.apply(this,arguments),b&&b.selector!==c?(h.selector=b.selector,h.context=b.context):(h.selector="string"==typeof b?b:"",b&&(h.context=b.nodeType?b:e||document)),h)},a.fn.init.prototype=a.fn,a.find=function(a){var b=Array.prototype.slice.call(arguments);if("string"==typeof a&&u.test(a))try{document.querySelector(a)}catch(c){a=a.replace(v,function(a,b,c,d){return"["+b+c+'"'+d+'"]'});try{document.querySelector(a),d("Attribute selector with '#' must be quoted: "+b[0]),b[0]=a}catch(e){d("Attribute selector with '#' was not fixed: "+b[0])}}return r.apply(this,b)};var x;for(x in r)Object.prototype.hasOwnProperty.call(r,x)&&(a.find[x]=r[x]);a.parseJSON=function(a){return a?s.apply(this,arguments):(d("jQuery.parseJSON requires a valid JSON string"),null)},a.uaMatch=function(a){a=a.toLowerCase();var b=/(chrome)[ \/]([\w.]+)/.exec(a)||/(webkit)[ \/]([\w.]+)/.exec(a)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(a)||/(msie) ([\w.]+)/.exec(a)||a.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},a.browser||(o=a.uaMatch(navigator.userAgent),p={},o.browser&&(p[o.browser]=!0,p.version=o.version),p.chrome?p.webkit=!0:p.webkit&&(p.safari=!0),a.browser=p),e(a,"browser",a.browser,"jQuery.browser is deprecated"),a.boxModel=a.support.boxModel="CSS1Compat"===document.compatMode,e(a,"boxModel",a.boxModel,"jQuery.boxModel is deprecated"),e(a.support,"boxModel",a.support.boxModel,"jQuery.support.boxModel is deprecated"),a.sub=function(){function b(a,c){return new b.fn.init(a,c)}a.extend(!0,b,this),b.superclass=this,b.fn=b.prototype=this(),b.fn.constructor=b,b.sub=this.sub,b.fn.init=function(d,e){var f=a.fn.init.call(this,d,e,c);return f instanceof b?f:b(f)},b.fn.init.prototype=b.fn;var c=b(document);return d("jQuery.sub() is deprecated"),b},a.fn.size=function(){return d("jQuery.fn.size() is deprecated; use the .length property"),this.length};var y=!1;a.swap&&a.each(["height","width","reliableMarginRight"],function(b,c){var d=a.cssHooks[c]&&a.cssHooks[c].get;d&&(a.cssHooks[c].get=function(){var a;return y=!0,a=d.apply(this,arguments),y=!1,a})}),a.swap=function(a,b,c,e){var f,g,h={};y||d("jQuery.swap() is undocumented and deprecated");for(g in b)h[g]=a.style[g],a.style[g]=b[g];f=c.apply(a,e||[]);for(g in b)a.style[g]=h[g];return f},a.ajaxSetup({converters:{"text json":a.parseJSON}});var z=a.fn.data;a.fn.data=function(b){var e,f,g=this[0];return!g||"events"!==b||1!==arguments.length||(e=a.data(g,b),f=a._data(g,b),e!==c&&e!==f||f===c)?z.apply(this,arguments):(d("Use of jQuery.fn.data('events') is deprecated"),f)};var A=/\/(java|ecma)script/i;a.clean||(a.clean=function(b,c,e,f){c=c||document,c=!c.nodeType&&c[0]||c,c=c.ownerDocument||c,d("jQuery.clean() is deprecated");var g,h,i,j,k=[];if(a.merge(k,a.buildFragment(b,c).childNodes),e)for(i=function(a){return!a.type||A.test(a.type)?f?f.push(a.parentNode?a.parentNode.removeChild(a):a):e.appendChild(a):void 0},g=0;null!=(h=k[g]);g++)a.nodeName(h,"script")&&i(h)||(e.appendChild(h),"undefined"!=typeof h.getElementsByTagName&&(j=a.grep(a.merge([],h.getElementsByTagName("script")),i),k.splice.apply(k,[g+1,0].concat(j)),g+=j.length));return k});var B=a.event.add,C=a.event.remove,D=a.event.trigger,E=a.fn.toggle,F=a.fn.live,G=a.fn.die,H=a.fn.load,I="ajaxStart|ajaxStop|ajaxSend|ajaxComplete|ajaxError|ajaxSuccess",J=new RegExp("\\b(?:"+I+")\\b"),K=/(?:^|\s)hover(\.\S+|)\b/,L=function(b){return"string"!=typeof b||a.event.special.hover?b:(K.test(b)&&d("'hover' pseudo-event is deprecated, use 'mouseenter mouseleave'"),b&&b.replace(K,"mouseenter$1 mouseleave$1"))};a.event.props&&"attrChange"!==a.event.props[0]&&a.event.props.unshift("attrChange","attrName","relatedNode","srcElement"),a.event.dispatch&&e(a.event,"handle",a.event.dispatch,"jQuery.event.handle is undocumented and deprecated"),a.event.add=function(a,b,c,e,f){a!==document&&J.test(b)&&d("AJAX events should be attached to document: "+b),B.call(this,a,L(b||""),c,e,f)},a.event.remove=function(a,b,c,d,e){C.call(this,a,L(b)||"",c,d,e)},a.each(["load","unload","error"],function(b,c){a.fn[c]=function(){var a=Array.prototype.slice.call(arguments,0);return"load"===c&&"string"==typeof a[0]?H.apply(this,a):(d("jQuery.fn."+c+"() is deprecated"),a.splice(0,0,c),arguments.length?this.bind.apply(this,a):(this.triggerHandler.apply(this,a),this))}}),a.fn.toggle=function(b,c){if(!a.isFunction(b)||!a.isFunction(c))return E.apply(this,arguments);d("jQuery.fn.toggle(handler, handler...) is deprecated");var e=arguments,f=b.guid||a.guid++,g=0,h=function(c){var d=(a._data(this,"lastToggle"+b.guid)||0)%g;return a._data(this,"lastToggle"+b.guid,d+1),c.preventDefault(),e[d].apply(this,arguments)||!1};for(h.guid=f;g * Licensed under the Apache-2.0 License. * * @license Apache-2.0 */ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).less=t()}(this,(function(){"use strict";function e(e){return e.replace(/^[a-z-]+:\/+?[^\/]+/,"").replace(/[\?\&]livereload=\w+/,"").replace(/^\//,"").replace(/\.[a-zA-Z]+$/,"").replace(/[^\.\w-]+/g,"-").replace(/\./g,":")}function t(e,t){for(var i in t.dataset)if(t.dataset.hasOwnProperty(i))if("env"===i||"dumpLineNumbers"===i||"rootpath"===i||"errorReporting"===i)e[i]=t.dataset[i];else try{e[i]=JSON.parse(t.dataset[i])}catch(e){}}var i=function(t,i,n){var r=n.href||"",s="less:"+(n.title||e(r)),o=t.getElementById(s),a=!1,l=t.createElement("style");l.setAttribute("type","text/css"),n.media&&l.setAttribute("media",n.media),l.id=s,l.styleSheet||(l.appendChild(t.createTextNode(i)),a=null!==o&&o.childNodes.length>0&&l.childNodes.length>0&&o.firstChild.nodeValue===l.firstChild.nodeValue);var u=t.getElementsByTagName("head")[0];if(null===o||!1===a){var c=n&&n.nextSibling||null;c?c.parentNode.insertBefore(l,c):u.appendChild(l)}if(o&&!1===a&&o.parentNode.removeChild(o),l.styleSheet)try{l.styleSheet.cssText=i}catch(e){throw new Error("Couldn't reassign styleSheet.cssText.")}},n=function(e){var t,i=e.document;return i.currentScript||(t=i.getElementsByTagName("script"))[t.length-1]},r={error:function(e){this._fireEvent("error",e)},warn:function(e){this._fireEvent("warn",e)},info:function(e){this._fireEvent("info",e)},debug:function(e){this._fireEvent("debug",e)},addListener:function(e){this._listeners.push(e)},removeListener:function(e){for(var t=0;t=0;a--){var l=o[a];if(l[s?"supportsSync":"supports"](e,t,i,n))return l}return null},e.prototype.addFileManager=function(e){this.fileManagers.push(e)},e.prototype.clearFileManagers=function(){this.fileManagers=[]},e}(),o={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgrey:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",grey:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370d8",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#d87093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},a={length:{m:1,cm:.01,mm:.001,in:.0254,px:.0254/96,pt:.0254/72,pc:.0254/72*12},duration:{s:1,ms:.001},angle:{rad:1/(2*Math.PI),deg:1/360,grad:1/400,turn:1}},l={colors:o,unitConversions:a},u=function(){function e(){this.parent=null,this.visibilityBlocks=void 0,this.nodeVisible=void 0,this.rootNode=null,this.parsed=null;var e=this;Object.defineProperty(this,"currentFileInfo",{get:function(){return e.fileInfo()}}),Object.defineProperty(this,"index",{get:function(){return e.getIndex()}})}return e.prototype.setParent=function(t,i){function n(t){t&&t instanceof e&&(t.parent=i)}Array.isArray(t)?t.forEach(n):n(t)},e.prototype.getIndex=function(){return this._index||this.parent&&this.parent.getIndex()||0},e.prototype.fileInfo=function(){return this._fileInfo||this.parent&&this.parent.fileInfo()||{}},e.prototype.isRulesetLike=function(){return!1},e.prototype.toCSS=function(e){var t=[];return this.genCSS(e,{add:function(e,i,n){t.push(e)},isEmpty:function(){return 0===t.length}}),t.join("")},e.prototype.genCSS=function(e,t){t.add(this.value)},e.prototype.accept=function(e){this.value=e.visit(this.value)},e.prototype.eval=function(){return this},e.prototype._operate=function(e,t,i,n){switch(t){case"+":return i+n;case"-":return i-n;case"*":return i*n;case"/":return i/n}},e.prototype.fround=function(e,t){var i=e&&e.numPrecision;return i?Number((t+2e-16).toFixed(i)):t},e.compare=function(t,i){if(t.compare&&"Quoted"!==i.type&&"Anonymous"!==i.type)return t.compare(i);if(i.compare)return-i.compare(t);if(t.type===i.type){if(t=t.value,i=i.value,!Array.isArray(t))return t===i?0:void 0;if(t.length===i.length){for(var n=0;nt?1:void 0},e.prototype.blocksVisibility=function(){return null==this.visibilityBlocks&&(this.visibilityBlocks=0),0!==this.visibilityBlocks},e.prototype.addVisibilityBlock=function(){null==this.visibilityBlocks&&(this.visibilityBlocks=0),this.visibilityBlocks=this.visibilityBlocks+1},e.prototype.removeVisibilityBlock=function(){null==this.visibilityBlocks&&(this.visibilityBlocks=0),this.visibilityBlocks=this.visibilityBlocks-1},e.prototype.ensureVisibility=function(){this.nodeVisible=!0},e.prototype.ensureInvisibility=function(){this.nodeVisible=!1},e.prototype.isVisible=function(){return this.nodeVisible},e.prototype.visibilityInfo=function(){return{visibilityBlocks:this.visibilityBlocks,nodeVisible:this.nodeVisible}},e.prototype.copyVisibilityInfo=function(e){e&&(this.visibilityBlocks=e.visibilityBlocks,this.nodeVisible=e.nodeVisible)},e}(),c=function(e,t,i){var n=this;Array.isArray(e)?this.rgb=e:e.length>=6?(this.rgb=[],e.match(/.{2}/g).map((function(e,t){t<3?n.rgb.push(parseInt(e,16)):n.alpha=parseInt(e,16)/255}))):(this.rgb=[],e.split("").map((function(e,t){t<3?n.rgb.push(parseInt(e+e,16)):n.alpha=parseInt(e+e,16)/255}))),this.alpha=this.alpha||("number"==typeof t?t:1),void 0!==i&&(this.value=i)};function h(e,t){return Math.min(Math.max(e,0),t)}function f(e){return"#"+e.map((function(e){return((e=h(Math.round(e),255))<16?"0":"")+e.toString(16)})).join("")}c.prototype=Object.assign(new u,{type:"Color",luma:function(){var e=this.rgb[0]/255,t=this.rgb[1]/255,i=this.rgb[2]/255;return.2126*(e=e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4))+.7152*(t=t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4))+.0722*(i=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4))},genCSS:function(e,t){t.add(this.toCSS(e))},toCSS:function(e,t){var i,n,r,s=e&&e.compress&&!t,o=[];if(n=this.fround(e,this.alpha),this.value)if(0===this.value.indexOf("rgb"))n<1&&(r="rgba");else{if(0!==this.value.indexOf("hsl"))return this.value;r=n<1?"hsla":"hsl"}else n<1&&(r="rgba");switch(r){case"rgba":o=this.rgb.map((function(e){return h(Math.round(e),255)})).concat(h(n,1));break;case"hsla":o.push(h(n,1));case"hsl":i=this.toHSL(),o=[this.fround(e,i.h),this.fround(e,100*i.s)+"%",this.fround(e,100*i.l)+"%"].concat(o)}if(r)return r+"("+o.join(","+(s?"":" "))+")";if(i=this.toRGB(),s){var a=i.split("");a[1]===a[2]&&a[3]===a[4]&&a[5]===a[6]&&(i="#"+a[1]+a[3]+a[5])}return i},operate:function(e,t,i){for(var n=new Array(3),r=this.alpha*(1-i.alpha)+i.alpha,s=0;s<3;s++)n[s]=this._operate(e,t,this.rgb[s],i.rgb[s]);return new c(n,r)},toRGB:function(){return f(this.rgb)},toHSL:function(){var e,t,i=this.rgb[0]/255,n=this.rgb[1]/255,r=this.rgb[2]/255,s=this.alpha,o=Math.max(i,n,r),a=Math.min(i,n,r),l=(o+a)/2,u=o-a;if(o===a)e=t=0;else{switch(t=l>.5?u/(2-o-a):u/(o+a),o){case i:e=(n-r)/u+(n=0&&"\n"!==t.charAt(i);)r++;return"number"==typeof e&&(n=(t.slice(0,e).match(/\n/g)||"").length),{line:n,column:r}}function k(e){var t,i=e.length,n=new Array(i);for(t=0;t|Function):(\d+):(\d+)/,O=function(e,t,i){Error.call(this);var n=e.filename||i;if(this.message=e.message,this.stack=e.stack,t&&n){var r=t.contents[n],s=C(e.index,r),o=s.line,a=s.column,l=e.call&&C(e.call,r).line,u=r?r.split("\n"):"";if(this.type=e.type||"Syntax",this.filename=n,this.index=e.index,this.line="number"==typeof o?o+1:null,this.column=a,!this.line&&this.stack){var c=this.stack.match(R),h=new Function("a","throw new Error()"),f=0;try{h()}catch(e){var p=e.stack.match(R);f=1-(o=parseInt(p[2]))}c&&(c[2]&&(this.line=parseInt(c[2])+f),c[3]&&(this.column=parseInt(c[3])))}this.callLine=l+1,this.callExtract=u[l],this.extract=[u[this.line-2],u[this.line-1],u[this.line]]}};if(void 0===Object.create){var V=function(){};V.prototype=Error.prototype,O.prototype=new V}else O.prototype=Object.create(Error.prototype);O.prototype.constructor=O,O.prototype.toString=function(e){e=e||{};var t="",i=this.extract||[],n=[],r=function(e){return e};if(e.stylize){var s=typeof e.stylize;if("function"!==s)throw Error("options.stylize should be a function, got a "+s+"!");r=e.stylize}if(null!==this.line){if("string"==typeof i[0]&&n.push(r(this.line-1+" "+i[0],"grey")),"string"==typeof i[1]){var o=this.line+" ";i[1]&&(o+=i[1].slice(0,this.column)+r(r(r(i[1].substr(this.column,1),"bold")+i[1].slice(this.column+1),"red"),"inverse")),n.push(o)}"string"==typeof i[2]&&n.push(r(this.line+1+" "+i[2],"grey")),n=n.join("\n")+r("","reset")+"\n"}return t+=r(this.type+"Error: "+this.message,"red"),this.filename&&(t+=r(" in ","red")+this.filename),this.line&&(t+=r(" on line "+this.line+", column "+(this.column+1)+":","grey")),t+="\n"+n,this.callLine&&(t+=r("from ","red")+(this.filename||"")+"/n",t+=r(this.callLine,"grey")+" "+this.callExtract+"/n"),t};var F=function(e,t,i,n,r,s){this.extendList=t,this.condition=i,this.evaldCondition=!i,this._index=n,this._fileInfo=r,this.elements=this.getElements(e),this.mixinElements_=void 0,this.copyVisibilityInfo(s),this.setParent(this.elements,this)};F.prototype=Object.assign(new u,{type:"Selector",accept:function(e){this.elements&&(this.elements=e.visitArray(this.elements)),this.extendList&&(this.extendList=e.visitArray(this.extendList)),this.condition&&(this.condition=e.visit(this.condition))},createDerived:function(e,t,i){e=this.getElements(e);var n=new F(e,t||this.extendList,null,this.getIndex(),this.fileInfo(),this.visibilityInfo());return n.evaldCondition=null!=i?i:this.evaldCondition,n.mediaEmpty=this.mediaEmpty,n},getElements:function(e){return e?("string"==typeof e&&this.parse.parseNode(e,["selector"],this._index,this._fileInfo,(function(t,i){if(t)throw new O({index:t.index,message:t.message},this.parse.imports,this._fileInfo.filename);e=i[0].elements})),e):[new m("","&",!1,this._index,this._fileInfo)]},createEmptySelectors:function(){var e=new m("","&",!1,this._index,this._fileInfo),t=[new F([e],null,null,this._index,this._fileInfo)];return t[0].mediaEmpty=!0,t},match:function(e){var t,i,n=this.elements,r=n.length;if(0===(t=(e=e.mixinElements()).length)||rg.PARENS_DIVISION)||this.parensStack&&this.parensStack.length))},q.Eval.prototype.pathRequiresRewrite=function(e){return(this.rewriteUrls===b?J:W)(e)},q.Eval.prototype.rewritePath=function(e,t){var i;return t=t||"",i=this.normalizePath(t+e),J(e)&&W(t)&&!1===J(i)&&(i="./"+i),i},q.Eval.prototype.normalizePath=function(e){var t,i=e.split("/").reverse();for(e=[];0!==i.length;)switch(t=i.pop()){case".":break;case"..":0===e.length||".."===e[e.length-1]?e.push(t):e.pop();break;default:e.push(t)}return e.join("/")};var H=function e(t){return{_data:{},add:function(e,t){e=e.toLowerCase(),this._data.hasOwnProperty(e),this._data[e]=t},addMultiple:function(e){var t=this;Object.keys(e).forEach((function(i){t.add(i,e[i])}))},get:function(e){return this._data[e]||t&&t.get(e)},getLocalFunctions:function(){return this._data},inherit:function(){return e(this)},create:function(t){return e(t)}}}(null),Q={eval:function(){var e=this.value_,t=this.error_;if(t)throw t;if(null!=e)return e?L.True:L.False},value:function(e){this.value_=e},error:function(e){this.error_=e},reset:function(){this.value_=this.error_=null}},K=function(e,t,i,n){this.selectors=e,this.rules=t,this._lookups={},this._variables=null,this._properties=null,this.strictImports=i,this.copyVisibilityInfo(n),this.allowRoot=!0,this.setParent(this.selectors,this),this.setParent(this.rules,this)};K.prototype=Object.assign(new u,{type:"Ruleset",isRuleset:!0,isRulesetLike:function(){return!0},accept:function(e){this.paths?this.paths=e.visitArray(this.paths,!0):this.selectors&&(this.selectors=e.visitArray(this.selectors)),this.rules&&this.rules.length&&(this.rules=e.visitArray(this.rules))},eval:function(e){var t,i,n,r,s,o=!1;if(this.selectors&&(i=this.selectors.length)){for(t=new Array(i),Q.error({type:"Syntax",message:"it is currently only allowed in parametric mixin guards,"}),r=0;r0;e--){var t=this.rules[e-1];if(t instanceof D)return this.parseValue(t)}},parseValue:function(e){var t=this;function i(e){return e.value instanceof j&&!e.parsed?("string"==typeof e.value.value?this.parse.parseNode(e.value.value,["value","important"],e.value.getIndex(),e.fileInfo(),(function(t,i){t&&(e.parsed=!0),i&&(e.value=i[0],e.important=i[1]||"",e.parsed=!0)})):e.parsed=!0,e):e}if(Array.isArray(e)){var n=[];return e.forEach((function(e){n.push(i.call(t,e))})),n}return i.call(t,e)},rulesets:function(){if(!this.rules)return[];var e,t,i=[],n=this.rules;for(e=0;t=n[e];e++)t.isRuleset&&i.push(t);return i},prependRule:function(e){var t=this.rules;t?t.unshift(e):this.rules=[e],this.setParent(e,this)},find:function(e,t,i){t=t||this;var n,r,s=[],o=e.toCSS();return o in this._lookups?this._lookups[o]:(this.rulesets().forEach((function(o){if(o!==t)for(var a=0;an){if(!i||i(o)){r=o.find(new F(e.elements.slice(n)),t,i);for(var l=0;l0&&t.add(l),e.firstSelector=!0,o[0].genCSS(e,t),e.firstSelector=!1,n=1;n0?(s=(r=k(e)).pop(),o=n.createDerived(k(s.elements))):o=n.createDerived([]),t.length>0){var a=i.combinator,l=t[0].elements[0];a.emptyOrWhitespace&&!l.combinator.emptyOrWhitespace&&(a=l.combinator),o.elements.push(new m(a,l.value,i.isVariable,i._index,i._fileInfo)),o.elements=o.elements.concat(t[0].elements.slice(1))}if(0!==o.elements.length&&r.push(o),t.length>1){var u=t.slice(1);u=u.map((function(e){return e.createDerived(e.elements,[])})),r=r.concat(u)}return r}function o(e,t,i,n,r){var o;for(o=0;o0?n[n.length-1]=n[n.length-1].createDerived(n[n.length-1].elements.concat(e)):n.push(new F(e));else t.push([new F(e)])}function l(e,t){var i=t.createDerived(t.elements,t.extendList,t.evaldCondition);return i.copyVisibilityInfo(e),i}var u,c;if(!function e(t,i,l){var u,c,h,f,v,d,g,y,b,w,x,S,I=!1;for(f=[],v=[[]],u=0;y=l.elements[u];u++)if("&"!==y.value){var C=(S=void 0,(x=y).value instanceof p&&(S=x.value.value)instanceof F?S:null);if(null!=C){a(f,v);var k,_=[],A=[];for(k=e(_,i,C),I=I||k,h=0;h<_.length;h++){o(v,[r(n(_[h],y),y)],y,l,A)}v=A,f=[]}else f.push(y)}else{for(I=!0,d=[],a(f,v),c=0;c0&&g[0].elements.push(new m(y.combinator,"",y.isVariable,y._index,y._fileInfo)),d.push(g);else for(h=0;h0&&(t.push(v[u]),w=v[u][b-1],v[u][b-1]=w.createDerived(w.elements,l.extendList));return I}(c=[],t,i))if(t.length>0)for(c=[],u=0;u0)for(t=0;t-1e-6&&(n=i.toFixed(20).replace(/0+$/,"")),e&&e.compress){if(0===i&&this.unit.isLength())return void t.add(n);i>0&&i<1&&(n=n.substr(1))}t.add(n),this.unit.genCSS(e,t)},operate:function(e,t,i){var n=this._operate(e,t,this.value,i.value),r=this.unit.clone();if("+"===t||"-"===t)if(0===r.numerator.length&&0===r.denominator.length)r=i.unit.clone(),this.unit.backupUnit&&(r.backupUnit=this.unit.backupUnit);else if(0===i.unit.numerator.length&&0===r.denominator.length);else{if(i=i.convertTo(this.unit.usedUnits()),e.strictUnits&&i.unit.toString()!==r.toString())throw new Error("Incompatible units. Change the units or use the unit function. Bad units: '"+r.toString()+"' and '"+i.unit.toString()+"'.");n=this._operate(e,t,this.value,i.value)}else"*"===t?(r.numerator=r.numerator.concat(i.unit.numerator).sort(),r.denominator=r.denominator.concat(i.unit.denominator).sort(),r.cancel()):"/"===t&&(r.numerator=r.numerator.concat(i.unit.denominator).sort(),r.denominator=r.denominator.concat(i.unit.numerator).sort(),r.cancel());return new ee(n,r)},compare:function(e){var t,i;if(e instanceof ee){if(this.unit.isEmpty()||e.unit.isEmpty())t=this,i=e;else if(t=this.unify(),i=e.unify(),0!==t.unit.compare(i.unit))return;return u.numericCompare(t.value,i.value)}},unify:function(){return this.convertTo({length:"px",duration:"s",angle:"rad"})},convertTo:function(e){var t,i,n,r,s,o=this.value,l=this.unit.clone(),u={};if("string"==typeof e){for(t in a)a[t].hasOwnProperty(e)&&((u={})[t]=e);e=u}for(i in s=function(e,t){return n.hasOwnProperty(e)?(t?o/=n[e]/n[r]:o*=n[e]/n[r],r):e},e)e.hasOwnProperty(i)&&(r=e[i],n=a[i],l.map(s));return l.cancel(),new ee(o,l)}});var te=g,ie=function(e,t,i){this.op=e.trim(),this.operands=t,this.isSpaced=i};ie.prototype=Object.assign(new u,{type:"Operation",accept:function(e){this.operands=e.visitArray(this.operands)},eval:function(e){var t,i=this.operands[0].eval(e),n=this.operands[1].eval(e);if(e.isMathOn(this.op)){if(t="./"===this.op?"/":this.op,i instanceof ee&&n instanceof c&&(i=i.toColor()),n instanceof ee&&i instanceof c&&(n=n.toColor()),!i.operate||!n.operate){if((i instanceof ie||n instanceof ie)&&"/"===i.op&&e.math===te.PARENS_DIVISION)return new ie(this.op,[i,n],this.isSpaced);throw{type:"Operation",message:"Operation on an invalid type"}}return i.operate(e,t,n)}return new ie(this.op,[i,n],this.isSpaced)},genCSS:function(e,t){this.operands[0].genCSS(e,t),this.isSpaced&&t.add(" "),t.add(this.op),this.isSpaced&&t.add(" "),this.operands[1].genCSS(e,t)}});var ne=function(e,t){if(this.value=e,this.noSpacing=t,!e)throw new Error("Expression requires an array parameter")};ne.prototype=Object.assign(new u,{type:"Expression",accept:function(e){this.value=e.visitArray(this.value)},eval:function(e){var t,i=e.isMathOn(),n=this.parens,r=!1;return n&&e.inParenthesis(),this.value.length>1?t=new ne(this.value.map((function(t){return t.eval?t.eval(e):t})),this.noSpacing):1===this.value.length?(!this.value[0].parens||this.value[0].parensInOp||e.inCalc||(r=!0),t=this.value[0].eval(e)):t=this,n&&e.outOfParenthesis(),!this.parens||!this.parensInOp||i||r||t instanceof ee||(t=new p(t)),t},genCSS:function(e,t){for(var i=0;i1){var i=new F([],null,null,this.getIndex(),this.fileInfo()).createEmptySelectors();(t=new K(i,e.mediaBlocks)).multiMedia=!0,t.copyVisibilityInfo(this.visibilityInfo()),this.setParent(t,this)}return delete e.mediaBlocks,delete e.mediaPath,t},evalNested:function(e){var t,i,n=e.mediaPath.concat([this]);for(t=0;t0;t--)e.splice(t,0,new j("and"));return new ne(e)}))),this.setParent(this.features,this),new K([],[])},permute:function(e){if(0===e.length)return[];if(1===e.length)return e[0];for(var t=[],i=this.permute(e.slice(1)),n=0;n1?"["+e.value.map((function(e){return e.toCSS()})).join(", ")+"]":e.toCSS()}});var ve=function(e,t,i,n){this.escaped=t,this.expression=e,this._index=i,this._fileInfo=n};ve.prototype=Object.assign(new pe,{type:"JavaScript",eval:function(e){var t=this.evaluateJavaScript(this.expression,e),i=typeof t;return"number"!==i||isNaN(t)?"string"===i?new ue('"'+t+'"',t,this.escaped,this._index):Array.isArray(t)?new j(t.join(", ")):new j(t):new ee(t)}});var de=function(e,t){this.key=e,this.value=t};de.prototype=Object.assign(new u,{type:"Assignment",accept:function(e){this.value=e.visit(this.value)},eval:function(e){return this.value.eval?new de(this.key,this.value.eval(e)):this},genCSS:function(e,t){t.add(this.key+"="),this.value.genCSS?this.value.genCSS(e,t):t.add(this.value)}});var me=function(e,t,i,n,r){this.op=e.trim(),this.lvalue=t,this.rvalue=i,this._index=n,this.negate=r};me.prototype=Object.assign(new u,{type:"Condition",accept:function(e){this.lvalue=e.visit(this.lvalue),this.rvalue=e.visit(this.rvalue)},eval:function(e){var t=function(e,t,i){switch(e){case"and":return t&&i;case"or":return t||i;default:switch(u.compare(t,i)){case-1:return"<"===e||"=<"===e||"<="===e;case 0:return"="===e||">="===e||"=<"===e||"<="===e;case 1:return">"===e||">="===e;default:return!1}}}(this.op,this.lvalue.eval(e),this.rvalue.eval(e));return this.negate?!t:t}});var ge=function(e){this.value=e};ge.prototype=Object.assign(new u,{type:"UnicodeDescriptor"});var ye=function(e){this.value=e};ye.prototype=Object.assign(new u,{type:"Negative",genCSS:function(e,t){t.add("-"),this.value.genCSS(e,t)},eval:function(e){return e.isMathOn()?new ie("*",[new ee(-1),this.value]).eval(e):new ye(this.value.eval(e))}});var be=function(e,t,i,n,r){switch(this.selector=e,this.option=t,this.object_id=be.next_id++,this.parent_ids=[this.object_id],this._index=i,this._fileInfo=n,this.copyVisibilityInfo(r),this.allowRoot=!0,t){case"all":this.allowBefore=!0,this.allowAfter=!0;break;default:this.allowBefore=!1,this.allowAfter=!1}this.setParent(this.selector,this)};be.prototype=Object.assign(new u,{type:"Extend",accept:function(e){this.selector=e.visit(this.selector)},eval:function(e){return new be(this.selector.eval(e),this.option,this.getIndex(),this.fileInfo(),this.visibilityInfo())},clone:function(e){return new be(this.selector,this.option,this.getIndex(),this.fileInfo(),this.visibilityInfo())},findSelfSelectors:function(e){var t,i,n=[];for(t=0;t0&&i.length&&""===i[0].combinator.value&&(i[0].combinator.value=" "),n=n.concat(e[t].elements);this.selfSelectors=[new F(n)],this.selfSelectors[0].copyVisibilityInfo(this.visibilityInfo())}}),be.next_id=0;var we=function(e,t,i){this.variable=e,this._index=t,this._fileInfo=i,this.allowRoot=!0};we.prototype=Object.assign(new u,{type:"VariableCall",eval:function(e){var t,i=new oe(this.variable,this.getIndex(),this.fileInfo()).eval(e),n=new O({message:"Could not evaluate variable call "+this.variable});if(!i.ruleset){if(i.rules)t=i;else if(Array.isArray(i))t=new K("",i);else{if(!Array.isArray(i.value))throw n;t=new K("",i.value)}i=new X(t)}if(i.ruleset)return i.callEval(e);throw n}});var xe=function(e,t,i,n){this.value=e,this.lookups=t,this._index=i,this._fileInfo=n};xe.prototype=Object.assign(new u,{type:"NamespaceValue",eval:function(e){var t,i,n=this.value.eval(e);for(t=0;tthis.params.length)return!1}i=Math.min(s,this.arity);for(var o=0;o0){for(c=!0,a=0;a0)f=2;else if(f=1,p[1]+p[2]>1)throw{type:"Runtime",message:"Ambiguous use of `default()` found when matching for `"+this.format(m)+"`",index:this.getIndex(),filename:this.fileInfo().filename};for(a=0;a0&&(e=e.slice(0,t)),(t=e.lastIndexOf("/"))<0&&(t=e.lastIndexOf("\\")),t<0?"":e.slice(0,t+1)},e.prototype.tryAppendExtension=function(e,t){return/(\.[a-z]*$)|([\?;].*)$/.test(e)?e:e+t},e.prototype.tryAppendLessExtension=function(e){return this.tryAppendExtension(e,".less")},e.prototype.supportsSync=function(){return!1},e.prototype.alwaysMakePathsAbsolute=function(){return!1},e.prototype.isPathAbsolute=function(e){return/^(?:[a-z-]+:|\/|\\|#)/i.test(e)},e.prototype.join=function(e,t){return e?e+t:t},e.prototype.pathDiff=function(e,t){var i,n,r,s,o=this.extractUrlParts(e),a=this.extractUrlParts(t),l="";if(o.hostPart!==a.hostPart)return"";for(n=Math.max(a.directories.length,o.directories.length),i=0;iparseInt(t[i])?-1:1;return 0},e.prototype.versionToString=function(e){for(var t="",i=0;i0;){var e=this.imports[0];if(!e.isReady)return;this.imports=this.imports.slice(1),e.callback.apply(null,e.args)}if(0===this.variableImports.length)break;var t=this.variableImports[0];this.variableImports=this.variableImports.slice(1),t()}}finally{this._currentDepth--}0===this._currentDepth&&this._onSequencerEmpty&&this._onSequencerEmpty()},e}(),Oe=function(e,t){this._visitor=new Pe(this),this._importer=e,this._finish=t,this.context=new q.Eval,this.importCount=0,this.onceFileDetectionMap={},this.recursionDetector={},this._sequencer=new Re(this._onSequencerEmpty.bind(this))};Oe.prototype={isReplacing:!1,run:function(e){try{this._visitor.visit(e)}catch(e){this.error=e}this.isFinished=!0,this._sequencer.tryRun()},_onSequencerEmpty:function(){this.isFinished&&this._finish(this.error)},visitImport:function(e,t){var i=e.options.inline;if(!e.css||i){var n=new q.Eval(this.context,k(this.context.frames)),r=n.frames[0];this.importCount++,e.isVariableImport()?this._sequencer.addVariableImport(this.processImportNode.bind(this,e,n,r)):this.processImportNode(e,n,r)}t.visitDeeper=!1},processImportNode:function(e,t,i){var n,r=e.options.inline;try{n=e.evalForImport(t)}catch(t){t.filename||(t.index=e.getIndex(),t.filename=e.fileInfo().filename),e.css=!0,e.error=t}if(!n||n.css&&!r)this.importCount--,this.isFinished&&this._sequencer.tryRun();else{n.options.multiple&&(t.importMultiple=!0);for(var s=void 0===n.css,o=0;o=0||(a=[u.selfSelectors[0]],(s=f.findMatch(l,a)).length&&(l.hasFoundMatches=!0,l.selfSelectors.forEach((function(e){var t=u.visibilityInfo();o=f.extendSelector(s,a,e,l.isVisible()),(c=new Ce.Extend(u.selector,u.option,0,u.fileInfo(),t)).selfSelectors=o,o[o.length-1].extendList=[c],h.push(c),c.ruleset=u.ruleset,c.parent_ids=c.parent_ids.concat(u.parent_ids,l.parent_ids),u.firstExtendOnThisSelectorPath&&(c.firstExtendOnThisSelectorPath=!0,u.ruleset.paths.push(o))}))));if(h.length){if(this.extendChainCount++,i>100){var p="{unable to calculate}",v="{unable to calculate}";try{p=h[0].selfSelectors[0].toCSS(),v=h[0].selector.toCSS()}catch(e){}throw{message:"extend circular reference detected. One of the circular extends is currently:"+p+":extend("+v+")"}}return h.concat(f.doExtendChaining(h,t,i+1))}return h},e.prototype.visitDeclaration=function(e,t){t.visitDeeper=!1},e.prototype.visitMixinDefinition=function(e,t){t.visitDeeper=!1},e.prototype.visitSelector=function(e,t){t.visitDeeper=!1},e.prototype.visitRuleset=function(e,t){if(!e.root){var i,n,r,s,o=this.allExtendsStack[this.allExtendsStack.length-1],a=[],l=this;for(r=0;r0&&u[l.matched].combinator.value!==o?l=null:l.matched++,l&&(l.finished=l.matched===u.length,l.finished&&!e.allowAfter&&(r+1u&&c>0&&(h[h.length-1].elements=h[h.length-1].elements.concat(t[u].elements.slice(c)),c=0,u++),l=s.elements.slice(c,a.index).concat([o]).concat(i.elements.slice(1)),u===a.pathIndex&&r>0?h[h.length-1].elements=h[h.length-1].elements.concat(l):(h=h.concat(t.slice(u,a.pathIndex))).push(new Ce.Selector(l)),u=a.endPathIndex,(c=a.endPathElementIndex)>=t[u].elements.length&&(c=0,u++);return u0&&(h[h.length-1].elements=h[h.length-1].elements.concat(t[u].elements.slice(c)),u++),h=(h=h.concat(t.slice(u,t.length))).map((function(e){var t=e.createDerived(e.elements);return n?t.ensureVisibility():t.ensureInvisibility(),t}))},e.prototype.visitMedia=function(e,t){var i=e.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length-1]);i=i.concat(this.doExtendChaining(i,e.allExtends)),this.allExtendsStack.push(i)},e.prototype.visitMediaOut=function(e){var t=this.allExtendsStack.length-1;this.allExtendsStack.length=t},e.prototype.visitAtRule=function(e,t){var i=e.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length-1]);i=i.concat(this.doExtendChaining(i,e.allExtends)),this.allExtendsStack.push(i)},e.prototype.visitAtRuleOut=function(e){var t=this.allExtendsStack.length-1;this.allExtendsStack.length=t},e}(),Le=function(){function e(){this.contexts=[[]],this._visitor=new Pe(this)}return e.prototype.run=function(e){return this._visitor.visit(e)},e.prototype.visitDeclaration=function(e,t){t.visitDeeper=!1},e.prototype.visitMixinDefinition=function(e,t){t.visitDeeper=!1},e.prototype.visitRuleset=function(e,t){var i,n=this.contexts[this.contexts.length-1],r=[];this.contexts.push(r),e.root||((i=e.selectors)&&(i=i.filter((function(e){return e.getIsOutput()})),e.selectors=i.length?i:i=null,i&&e.joinSelectors(r,n,i)),i||(e.rules=null),e.paths=r)},e.prototype.visitRulesetOut=function(e){this.contexts.length=this.contexts.length-1},e.prototype.visitMedia=function(e,t){var i=this.contexts[this.contexts.length-1];e.rules[0].root=0===i.length||i[0].multiMedia},e.prototype.visitAtRule=function(e,t){var i=this.contexts[this.contexts.length-1];e.rules&&e.rules.length&&(e.rules[0].root=e.isRooted||0===i.length||null)},e}(),je=function(){function e(e){this._visitor=new Pe(this),this._context=e}return e.prototype.containsSilentNonBlockedChild=function(e){var t;if(!e)return!1;for(var i=0;i0},e.prototype.resolveVisibility=function(e,t){if(!e.blocksVisibility()){if(this.isEmpty(e)&&!this.containsSilentNonBlockedChild(t))return;return e}var i=e.rules[0];if(this.keepOnlyVisibleChilds(i),!this.isEmpty(i))return e.ensureVisibility(),e.removeVisibilityBlock(),e},e.prototype.isVisibleRuleset=function(e){return!!e.firstRoot||!this.isEmpty(e)&&!(!e.root&&!this.hasVisibleSelector(e))},e}(),Ne=function(e){this._visitor=new Pe(this),this._context=e,this.utils=new je(e)};Ne.prototype={isReplacing:!0,run:function(e){return this._visitor.visit(e)},visitDeclaration:function(e,t){if(!e.blocksVisibility()&&!e.variable)return e},visitMixinDefinition:function(e,t){e.frames=[]},visitExtend:function(e,t){},visitComment:function(e,t){if(!e.blocksVisibility()&&!e.isSilent(this._context))return e},visitMedia:function(e,t){var i=e.rules[0].rules;return e.accept(this._visitor),t.visitDeeper=!1,this.utils.resolveVisibility(e,i)},visitImport:function(e,t){if(!e.blocksVisibility())return e},visitAtRule:function(e,t){return e.rules&&e.rules.length?this.visitAtRuleWithBody(e,t):this.visitAtRuleWithoutBody(e,t)},visitAnonymous:function(e,t){if(!e.blocksVisibility())return e.accept(this._visitor),e},visitAtRuleWithBody:function(e,t){var i=function(e){var t=e.rules;return function(e){var t=e.rules;return 1===t.length&&(!t[0].paths||0===t[0].paths.length)}(e)?t[0].rules:t}(e);return e.accept(this._visitor),t.visitDeeper=!1,this.utils.isEmpty(e)||this._mergeRules(e.rules[0].rules),this.utils.resolveVisibility(e,i)},visitAtRuleWithoutBody:function(e,t){if(!e.blocksVisibility()){if("@charset"===e.name){if(this.charset){if(e.debugInfo){var i=new Ce.Comment("/* "+e.toCSS(this._context).replace(/\n/g,"")+" */\n");return i.debugInfo=e.debugInfo,this._visitor.visit(i)}return}this.charset=!0}return e}},checkValidNodes:function(e,t){if(e)for(var i=0;i0?e.accept(this._visitor):e.rules=null,t.visitDeeper=!1}return e.rules&&(this._mergeRules(e.rules),this._removeDuplicateRules(e.rules)),this.utils.isVisibleRuleset(e)&&(e.ensureVisibility(),n.splice(0,0,e)),1===n.length?n[0]:n},_compileRulesetPaths:function(e){e.paths&&(e.paths=e.paths.filter((function(e){var t;for(" "===e[0].elements[0].combinator.value&&(e[0].elements[0].combinator=new Ce.Combinator("")),t=0;t=0;n--)if((i=e[n])instanceof Ce.Declaration)if(r[i.name]){(t=r[i.name])instanceof Ce.Declaration&&(t=r[i.name]=[r[i.name].toCSS(this._context)]);var s=i.toCSS(this._context);-1!==t.indexOf(s)?e.splice(n,1):t.push(s)}else r[i.name]=i}},_mergeRules:function(e){if(e){for(var t={},i=[],n=0;n0){var t=e[0],i=[],n=[new Ce.Expression(i)];e.forEach((function(e){"+"===e.merge&&i.length>0&&n.push(new Ce.Expression(i=[])),i.push(e.value),t.important=t.important||e.important})),t.value=new Ce.Value(n)}}))}}};var De={Visitor:Pe,ImportVisitor:Oe,MarkVisibleSelectorsVisitor:Ve,ExtendVisitor:$e,JoinSelectorVisitor:Le,ToCSSVisitor:Ne};var Be=function(){var e,t,i,n,r,s,o,a=[],l={};function u(i){for(var n,a,c,h=l.i,f=t,p=l.i-o,v=l.i+s.length-p,d=l.i+=i,m=e;l.i=0){c={index:l.i,text:m.substr(l.i,y+2-l.i),isLineComment:!1},l.i+=c.text.length-1,l.commentStore.push(c);continue}}break}if(32!==n&&10!==n&&9!==n&&13!==n)break}if(s=s.slice(i+l.i-d+p),o=l.i,!s.length){if(ti||l.i===i&&e&&!n)&&(i=l.i,n=e);var r=a.pop();s=r.current,o=l.i=r.i,t=r.j},l.forget=function(){a.pop()},l.isWhitespace=function(t){var i=l.i+(t||0),n=e.charCodeAt(i);return 32===n||13===n||9===n||10===n},l.$re=function(e){l.i>o&&(s=s.slice(l.i-o),o=l.i);var t=e.exec(s);return t?(u(t[0].length),"string"==typeof t?t:1===t.length?t[0]:t):null},l.$char=function(t){return e.charAt(l.i)!==t?null:(u(1),t)},l.$str=function(t){for(var i=t.length,n=0;nh&&(d=!1)}}while(d);return r||null},l.autoCommentAbsorb=!0,l.commentStore=[],l.finished=!1,l.peek=function(t){if("string"==typeof t){for(var i=0;i57||t<43||47===t||44===t},l.start=function(n,a,c){e=n,l.i=t=o=i=0,r=a?function(e,t){var i,n,r,s,o,a,l,u,c,h=e.length,f=0,p=0,v=[],d=0;function m(t){var i=o-d;i<512&&!t||!i||(v.push(e.slice(d,o+1)),d=o+1)}for(o=0;o=97&&l<=122||l<34))switch(l){case 40:p++,n=o;continue;case 41:if(--p<0)return t("missing opening `(`",o);continue;case 59:p||m();continue;case 123:f++,i=o;continue;case 125:if(--f<0)return t("missing opening `{`",o);f||p||m();continue;case 92:if(o96)){if(u==l){c=1;break}if(92==u){if(o==h-1)return t("unescaped `\\`",o);o++}}if(c)continue;return t("unmatched `"+String.fromCharCode(l)+"`",a);case 47:if(p||o==h-1)continue;if(47==(u=e.charCodeAt(o+1)))for(o+=2;oi&&s>r?"missing closing `}` or `*/`":"missing closing `}`",i):0!==p?t("missing closing `)`",n):(m(!0),v)}(n,c):[n],s=r[0],u(0)},l.end=function(){var t,r=l.i>=e.length;return l.i=e.length-1,furthestChar:e[l.i]}},l},Ue=function e(t,i,n){var r,s=Be();function o(e,t){throw new O({index:s.i,filename:n.filename,type:t||"Syntax",message:e},i)}function a(e,t){var i=e instanceof Function?e.call(r):s.$re(e);if(i)return i;o(t||("string"==typeof e?"expected '"+e+"' got '"+s.currentChar()+"'":"unexpected token"))}function l(e,t){if(s.$char(e))return e;o(t||"expected '"+e+"' got '"+s.currentChar()+"'")}function u(e){var t=n.filename;return{lineNumber:C(e,s.getInput()).line+1,fileName:t}}return{parserInput:s,imports:i,fileInfo:n,parseNode:function(e,t,n,o,a){var l,u=[],c=s;try{c.start(e,!1,(function(e,t){a({message:e,index:t+n})}));for(var h=0,f=void 0,p=void 0;f=t[h];h++)if(p=c.i,l=r[f]()){try{l._index=p+n,l._fileInfo=o}catch(e){}u.push(l)}else u.push(null);c.end().isFinished?a(null,u):a(!0,null)}catch(e){throw new O({index:e.index+n,message:e.message},i,o.filename)}},parse:function(r,o,a){var l,u,c,h,f=null,p="";if(u=a&&a.globalVars?e.serializeVars(a.globalVars)+"\n":"",c=a&&a.modifyVars?"\n"+e.serializeVars(a.modifyVars):"",t.pluginManager)for(var v=t.pluginManager.getPreProcessors(),d=0;d");return e},args:function(e){var t,i,n,a,l,u,c,h=r.entities,f={args:null,variadic:!1},p=[],v=[],d=[],m=!0;for(s.save();;){if(e)u=r.detachedRuleset()||r.expression();else{if(s.commentStore.length=0,s.$str("...")){f.variadic=!0,s.$char(";")&&!t&&(t=!0),(t?v:d).push({variadic:!0});break}u=h.variable()||h.property()||h.literal()||h.keyword()||this.call(!0)}if(!u||!m)break;a=null,u.throwAwayComments&&u.throwAwayComments(),l=u;var g=null;if(e?u.value&&1==u.value.length&&(g=u.value[0]):g=u,g&&(g instanceof Ce.Variable||g instanceof Ce.Property))if(s.$char(":")){if(p.length>0&&(t&&o("Cannot mix ; and , as delimiter types"),i=!0),!(l=r.detachedRuleset()||r.expression())){if(!e)return s.restore(),f.args=[],f;o("could not understand value for named argument")}a=n=g.name}else if(s.$str("...")){if(!e){f.variadic=!0,s.$char(";")&&!t&&(t=!0),(t?v:d).push({name:u.name,variadic:!0});break}c=!0}else e||(n=a=g.name,l=null);l&&p.push(l),d.push({name:a,value:l,expand:c}),s.$char(",")?m=!0:((m=";"===s.$char(";"))||t)&&(i&&o("Cannot mix ; and , as delimiter types"),t=!0,p.length>1&&(l=new Ce.Value(p)),v.push({name:n,value:l,expand:c}),n=null,p=[],i=!1)}return s.forget(),f.args=t?v:d,f},definition:function(){var e,t,i,n,o=[],l=!1;if(!("."!==s.currentChar()&&"#"!==s.currentChar()||s.peek(/^[^{]*\}/)))if(s.save(),t=s.$re(/^([#.](?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+)\s*\(/)){e=t[1];var u=this.args(!1);if(o=u.args,l=u.variadic,!s.$char(")"))return void s.restore("Missing closing ')'");if(s.commentStore.length=0,s.$str("when")&&(n=a(r.conditions,"expected condition")),i=r.block())return s.forget(),new Ce.mixin.Definition(e,o,i,n,l);s.restore()}else s.restore()},ruleLookups:function(){var e,t=[];if("["===s.currentChar()){for(;;){if(s.save(),!(e=this.lookupValue())&&""!==e){s.restore();break}t.push(e),s.forget()}return t.length>0?t:void 0}},lookupValue:function(){if(s.save(),s.$char("[")){var e=s.$re(/^(?:[@$]{0,2})[_a-zA-Z0-9-]*/);if(s.$char("]"))return e||""===e?(s.forget(),e):void s.restore();s.restore()}else s.restore()}},entity:function(){var e=this.entities;return this.comment()||e.literal()||e.variable()||e.url()||e.property()||e.call()||e.keyword()||this.mixin.call(!0)||e.javascript()},end:function(){return s.$char(";")||s.peek("}")},ieAlpha:function(){var e;if(s.$re(/^opacity=/i))return(e=s.$re(/^\d+/))||(e="@{"+(e=a(r.entities.variable,"Could not parse alpha")).name.slice(1)+"}"),l(")"),new Ce.Quoted("","alpha(opacity="+e+")")},element:function(){var e,t,i,r=s.i;if(t=this.combinator(),(e=s.$re(/^(?:\d+\.\d+|\d+)%/)||s.$re(/^(?:[.#]?|:*)(?:[\w-]|[^\x00-\x9f]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/)||s.$char("*")||s.$char("&")||this.attribute()||s.$re(/^\([^&()@]+\)/)||s.$re(/^[\.#:](?=@)/)||this.entities.variableCurly())||(s.save(),s.$char("(")?(i=this.selector(!1))&&s.$char(")")?(e=new Ce.Paren(i),s.forget()):s.restore("Missing closing ')'"):s.forget()),e)return new Ce.Element(t,e,e instanceof Ce.Variable,r,n)},combinator:function(){var e=s.currentChar();if("/"===e){s.save();var t=s.$re(/^\/[a-z]+\//i);if(t)return s.forget(),new Ce.Combinator(t);s.restore()}if(">"===e||"+"===e||"~"===e||"|"===e||"^"===e){for(s.i++,"^"===e&&"^"===s.currentChar()&&(e="^^",s.i++);s.isWhitespace();)s.i++;return new Ce.Combinator(e)}return s.isWhitespace(-1)?new Ce.Combinator(" "):new Ce.Combinator(null)},selector:function(e){var t,i,r,l,u,c,h,f=s.i;for(e=!1!==e;(e&&(i=this.extend())||e&&(c=s.$str("when"))||(l=this.element()))&&(c?h=a(this.conditions,"expected condition"):h?o("CSS guard can only be used at the end of selector"):i?u=u?u.concat(i):i:(u&&o("Extend can only be used at the end of selector"),r=s.currentChar(),t?t.push(l):t=[l],l=null),"{"!==r&&"}"!==r&&";"!==r&&","!==r&&")"!==r););if(t)return new Ce.Selector(t,u,h,f,n);u&&o("Extend must be used to extend a selector, it cannot be used on its own")},selectors:function(){for(var e,t;(e=this.selector())&&(t?t.push(e):t=[e],s.commentStore.length=0,e.condition&&t.length>1&&o("Guards are only currently allowed on a single selector."),s.$char(","));)e.condition&&o("Guards are only currently allowed on a single selector."),s.commentStore.length=0;return t},attribute:function(){if(s.$char("[")){var e,t,i,n=this.entities;return(e=n.variableCurly())||(e=a(/^(?:[_A-Za-z0-9-\*]*\|)?(?:[_A-Za-z0-9-]|\\.)+/)),(i=s.$re(/^[|~*$^]?=/))&&(t=n.quoted()||s.$re(/^[0-9]+%/)||s.$re(/^[\w-]+/)||n.variableCurly()),l("]"),new Ce.Attribute(e,i,t)}},block:function(){var e;if(s.$char("{")&&(e=this.primary())&&s.$char("}"))return e},blockRuleset:function(){var e=this.block();return e&&(e=new Ce.Ruleset(null,e)),e},detachedRuleset:function(){var e,t,i;if(s.save(),!s.$re(/^[.#]\(/)||(t=(e=this.mixin.args(!1)).args,i=e.variadic,s.$char(")"))){var n=this.blockRuleset();if(n)return s.forget(),t?new Ce.mixin.Definition(null,t,n,null,i):new Ce.DetachedRuleset(n);s.restore()}else s.restore()},ruleset:function(){var e,i,n;if(s.save(),t.dumpLineNumbers&&(n=u(s.i)),(e=this.selectors())&&(i=this.block())){s.forget();var r=new Ce.Ruleset(e,i,t.strictImports);return t.dumpLineNumbers&&(r.debugInfo=n),r}s.restore()},declaration:function(){var e,t,i,r,o,a,l=s.i,u=s.currentChar();if("."!==u&&"#"!==u&&"&"!==u&&":"!==u)if(s.save(),e=this.variable()||this.ruleProperty()){if((a="string"==typeof e)&&(t=this.detachedRuleset())&&(i=!0),s.commentStore.length=0,!t){if(o=!a&&e.length>1&&e.pop().value,t=e[0].value&&"--"===e[0].value.slice(0,2)?this.permissiveValue():this.anonymousValue())return s.forget(),new Ce.Declaration(e,t,!1,o,l,n);t||(t=this.value()),t?r=this.important():a&&(t=this.permissiveValue())}if(t&&(this.end()||i))return s.forget(),new Ce.Declaration(e,t,r,o,l,n);s.restore()}else s.restore()},anonymousValue:function(){var e=s.i,t=s.$re(/^([^.#@\$+\/'"*`(;{}-]*);/);if(t)return new Ce.Anonymous(t[1],e)},permissiveValue:function(e){var t,i,r,a,l=e||";",u=s.i,c=[];function h(){var e=s.currentChar();return"string"==typeof l?e===l:l.test(e)}if(!h()){a=[];do{((i=this.comment())||(i=this.entity()))&&a.push(i)}while(i);if(r=h(),a.length>0){if(a=new Ce.Expression(a),r)return a;c.push(a)," "===s.prevChar()&&c.push(new Ce.Anonymous(" ",u))}if(s.save(),a=s.$parseUntil(l)){if("string"==typeof a&&o("Expected '"+a+"'","Parse"),1===a.length&&" "===a[0])return s.forget(),new Ce.Anonymous("",u);var f=void 0;for(t=0;t0)return new Ce.Expression(r)},mediaFeatures:function(){var e,t=this.entities,i=[];do{if(e=this.mediaFeature()){if(i.push(e),!s.$char(","))break}else if((e=t.variable()||t.mixinLookup())&&(i.push(e),!s.$char(",")))break}while(e);return i.length>0?i:null},media:function(){var e,i,r,a,l=s.i;if(t.dumpLineNumbers&&(a=u(l)),s.save(),s.$str("@media"))return e=this.mediaFeatures(),(i=this.block())||o("media definitions require block statements after any features"),s.forget(),r=new Ce.Media(i,e,l,n),t.dumpLineNumbers&&(r.debugInfo=a),r;s.restore()},plugin:function(){var e,t,i,r=s.i;if(s.$re(/^@plugin?\s+/)){if(i=(t=this.pluginArgs())?{pluginArgs:t,isPlugin:!0}:{isPlugin:!0},e=this.entities.quoted()||this.entities.url())return s.$char(";")||(s.i=r,o("missing semi-colon on @plugin")),new Ce.Import(e,null,i,r,n);s.i=r,o("malformed @plugin statement")}},pluginArgs:function(){if(s.save(),!s.$char("("))return s.restore(),null;var e=s.$re(/^\s*([^\);]+)\)\s*/);return e[1]?(s.forget(),e[1].trim()):(s.restore(),null)},atrule:function(){var e,i,r,a,l,c,h,f=s.i,p=!0,v=!0;if("@"===s.currentChar()){if(i=this.import()||this.plugin()||this.media())return i;if(s.save(),e=s.$re(/^@[a-z-]+/)){switch(a=e,"-"==e.charAt(1)&&e.indexOf("-",2)>0&&(a="@"+e.slice(e.indexOf("-",2)+1)),a){case"@charset":l=!0,p=!1;break;case"@namespace":c=!0,p=!1;break;case"@keyframes":case"@counter-style":l=!0;break;case"@document":case"@supports":h=!0,v=!1;break;default:h=!0}if(s.commentStore.length=0,l?(i=this.entity())||o("expected "+e+" identifier"):c?(i=this.expression())||o("expected "+e+" expression"):h&&(i=this.permissiveValue(/^[{;]/),p="{"===s.currentChar(),i?i.value||(i=null):p||";"===s.currentChar()||o(e+" rule is missing block or ending semi-colon")),p&&(r=this.blockRuleset()),r||!p&&i&&s.$char(";"))return s.forget(),new Ce.AtRule(e,i,r,f,n,t.dumpLineNumbers?u(f):null,v);s.restore("at-rule options not recognised")}}},value:function(){var e,t=[],i=s.i;do{if((e=this.expression())&&(t.push(e),!s.$char(",")))break}while(e);if(t.length>0)return new Ce.Value(t,i)},important:function(){if("!"===s.currentChar())return s.$re(/^! *important/)},sub:function(){var e,t;if(s.save(),s.$char("("))return(e=this.addition())&&s.$char(")")?(s.forget(),(t=new Ce.Expression([e])).parens=!0,t):void s.restore("Expected ')'");s.restore()},multiplication:function(){var e,t,i,n,r;if(e=this.operand()){for(r=s.isWhitespace(-1);!s.peek(/^\/[*\/]/);){if(s.save(),!(i=s.$char("/")||s.$char("*")||s.$str("./"))){s.forget();break}if(!(t=this.operand())){s.restore();break}s.forget(),e.parensInOp=!0,t.parensInOp=!0,n=new Ce.Operation(i,[n||e,t],r),r=s.isWhitespace(-1)}return n||e}},addition:function(){var e,t,i,n,r;if(e=this.multiplication()){for(r=s.isWhitespace(-1);(i=s.$re(/^[-+]\s+/)||!r&&(s.$char("+")||s.$char("-")))&&(t=this.multiplication());)e.parensInOp=!0,t.parensInOp=!0,n=new Ce.Operation(i,[n||e,t],r),r=s.isWhitespace(-1);return n||e}},conditions:function(){var e,t,i,n=s.i;if(e=this.condition(!0)){for(;s.peek(/^,\s*(not\s*)?\(/)&&s.$char(",")&&(t=this.condition(!0));)i=new Ce.Condition("or",i||e,t,n);return i||e}},condition:function(e){var t,i,n;if(t=this.conditionAnd(e)){if(i=s.$str("or")){if(!(n=this.condition(e)))return;t=new Ce.Condition(i,t,n)}return t}},conditionAnd:function(e){var t,i,n,r,o=this;if(t=(r=o.negatedCondition(e)||o.parenthesisCondition(e))||e?r:o.atomicCondition(e)){if(i=s.$str("and")){if(!(n=this.conditionAnd(e)))return;t=new Ce.Condition(i,t,n)}return t}},negatedCondition:function(e){if(s.$str("not")){var t=this.parenthesisCondition(e);return t&&(t.negate=!t.negate),t}},parenthesisCondition:function(e){var t;if(s.save(),s.$str("(")){if(t=function(t){var i;if(s.save(),i=t.condition(e)){if(s.$char(")"))return s.forget(),i;s.restore()}else s.restore()}(this))return s.forget(),t;if(t=this.atomicCondition(e)){if(s.$char(")"))return s.forget(),t;s.restore("expected ')' got '"+s.currentChar()+"'")}else s.restore()}else s.restore()},atomicCondition:function(e){var t,i,n,r,a=this.entities,l=s.i;function u(){return this.addition()||a.keyword()||a.quoted()||a.mixinLookup()}if(t=(u=u.bind(this))())return s.$char(">")?r=s.$char("=")?">=":">":s.$char("<")?r=s.$char("=")?"<=":"<":s.$char("=")&&(r=s.$char(">")?"=>":s.$char("<")?"=<":"="),r?(i=u())?n=new Ce.Condition(r,t,i,l,!1):o("expected expression"):n=new Ce.Condition("=",t,new Ce.Keyword("true"),l,!1),n},operand:function(){var e,t=this.entities;s.peek(/^-[@\$\(]/)&&(e=s.$char("-"));var i=this.sub()||t.dimension()||t.color()||t.variable()||t.property()||t.call()||t.quoted(!0)||t.colorKeyword()||t.mixinLookup();return e&&(i.parensInOp=!0,i=new Ce.Negative(i)),i},expression:function(){var e,t,i=[],n=s.i;do{(e=this.comment())?i.push(e):((e=this.addition()||this.entity())instanceof Ce.Comment&&(e=null),e&&(i.push(e),s.peek(/^\/[\/*]/)||(t=s.$char("/"))&&i.push(new Ce.Anonymous(t,n))))}while(e);if(i.length>0)return new Ce.Expression(i)},property:function(){var e=s.$re(/^(\*?-?[_a-zA-Z0-9-]+)\s*:/);if(e)return e[1]},ruleProperty:function(){var e,t,i=[],r=[];s.save();var o=s.$re(/^([_a-zA-Z0-9-]+)\s*:/);if(o)return i=[new Ce.Keyword(o[1])],s.forget(),i;function a(e){var t=s.i,n=s.$re(e);if(n)return r.push(t),i.push(n[1])}for(a(/^(\*?)/);a(/^((?:[\w-]+)|(?:[@\$]\{[\w-]+\}))/););if(i.length>1&&a(/^((?:\+_|\+)?)\s*:/)){for(s.forget(),""===i[0]&&(i.shift(),r.shift()),t=0;t1?e-1:e)<1?r+(s-r)*e*6:2*e<1?s:3*e<2?r+(s-r)*(2/3-e)*6:r}e=Ke(e)%360/360,t=We(Ke(t)),i=We(Ke(i)),n=We(Ke(n)),r=2*i-(s=i<=.5?i*(t+1):i+t-i*t);var a=[255*o(e+1/3),255*o(e),255*o(e-1/3)];return n=Ke(n),new c(a,n,"hsla")}catch(e){}},hsv:function(e,t,i){return ze.hsva(e,t,i,1)},hsva:function(e,t,i,n){var r,s;e=Ke(e)%360/360*360,t=Ke(t),i=Ke(i),n=Ke(n);var o=[i,i*(1-t),i*(1-(s=e/60-(r=Math.floor(e/60%6)))*t),i*(1-(1-s)*t)],a=[[0,3,1],[2,0,1],[1,0,3],[1,2,0],[3,1,0],[0,1,2]];return ze.rgba(255*o[a[r][0]],255*o[a[r][1]],255*o[a[r][2]],n)},hue:function(e){return new ee(He(e).h)},saturation:function(e){return new ee(100*He(e).s,"%")},lightness:function(e){return new ee(100*He(e).l,"%")},hsvhue:function(e){return new ee(Qe(e).h)},hsvsaturation:function(e){return new ee(100*Qe(e).s,"%")},hsvvalue:function(e){return new ee(100*Qe(e).v,"%")},red:function(e){return new ee(e.rgb[0])},green:function(e){return new ee(e.rgb[1])},blue:function(e){return new ee(e.rgb[2])},alpha:function(e){return new ee(He(e).a)},luma:function(e){return new ee(e.luma()*e.alpha*100,"%")},luminance:function(e){var t=.2126*e.rgb[0]/255+.7152*e.rgb[1]/255+.0722*e.rgb[2]/255;return new ee(t*e.alpha*100,"%")},saturate:function(e,t,i){if(!e.rgb)return null;var n=He(e);return void 0!==i&&"relative"===i.value?n.s+=n.s*t.value/100:n.s+=t.value/100,n.s=We(n.s),Je(e,n)},desaturate:function(e,t,i){var n=He(e);return void 0!==i&&"relative"===i.value?n.s-=n.s*t.value/100:n.s-=t.value/100,n.s=We(n.s),Je(e,n)},lighten:function(e,t,i){var n=He(e);return void 0!==i&&"relative"===i.value?n.l+=n.l*t.value/100:n.l+=t.value/100,n.l=We(n.l),Je(e,n)},darken:function(e,t,i){var n=He(e);return void 0!==i&&"relative"===i.value?n.l-=n.l*t.value/100:n.l-=t.value/100,n.l=We(n.l),Je(e,n)},fadein:function(e,t,i){var n=He(e);return void 0!==i&&"relative"===i.value?n.a+=n.a*t.value/100:n.a+=t.value/100,n.a=We(n.a),Je(e,n)},fadeout:function(e,t,i){var n=He(e);return void 0!==i&&"relative"===i.value?n.a-=n.a*t.value/100:n.a-=t.value/100,n.a=We(n.a),Je(e,n)},fade:function(e,t){var i=He(e);return i.a=t.value/100,i.a=We(i.a),Je(e,i)},spin:function(e,t){var i=He(e),n=(i.h+t.value)%360;return i.h=n<0?360+n:n,Je(e,i)},mix:function(e,t,i){i||(i=new ee(50));var n=i.value/100,r=2*n-1,s=He(e).a-He(t).a,o=((r*s==-1?r:(r+s)/(1+r*s))+1)/2,a=1-o,l=[e.rgb[0]*o+t.rgb[0]*a,e.rgb[1]*o+t.rgb[1]*a,e.rgb[2]*o+t.rgb[2]*a],u=e.alpha*n+t.alpha*(1-n);return new c(l,u)},greyscale:function(e){return ze.desaturate(e,new ee(100))},contrast:function(e,t,i,n){if(!e.rgb)return null;if(void 0===i&&(i=ze.rgba(255,255,255,1)),void 0===t&&(t=ze.rgba(0,0,0,1)),t.luma()>i.luma()){var r=i;i=t,t=r}return n=void 0===n?.43:Ke(n),e.luma().5&&(n=1,i=e>.25?Math.sqrt(e):((16*e-12)*e+4)*e),e-(1-2*t)*n*(i-e)},hardlight:function(e,t){return Ye.overlay(t,e)},difference:function(e,t){return Math.abs(e-t)},exclusion:function(e,t){return e+t-2*e*t},average:function(e,t){return(e+t)/2},negation:function(e,t){return 1-Math.abs(e+t-1)}};for(var et in Ye)Ye.hasOwnProperty(et)&&(Xe[et]=Xe.bind(null,Ye[et]));var tt=function(e){return Array.isArray(e.value)?e.value:Array(e)},it={_SELF:function(e){return e},"~":function(){for(var e=[],t=0;to.value)&&(c[n]=r);else{if(void 0!==l&&a!==l)throw{type:"Argument",message:"incompatible types"};h[a]=c.length,c.push(r)}else Array.isArray(t[i].value)&&Array.prototype.push.apply(t,Array.prototype.slice.call(t[i].value));return 1==c.length?c[0]:(t=c.map((function(e){return e.toCSS(this.context)})).join(this.context.compress?",":", "),new j((e?"min":"max")+"("+t+")"))},at={min:function(){for(var e=[],t=0;t",r=0;r";return n+="',n=encodeURIComponent(n),new ce(new ue("'"+(n="data:image/svg+xml,"+n)+"'",n,!1,this.index,this.currentFileInfo),this.index,this.currentFileInfo)}}),H.addMultiple(ht),t};function pt(e,t){var i,n=(t=t||{}).variables,r=new q.Eval(t);"object"!=typeof n||Array.isArray(n)||(n=Object.keys(n).map((function(e){var t=n[e];return t instanceof Ce.Value||(t instanceof Ce.Expression||(t=new Ce.Expression([t])),t=new Ce.Value([t])),new Ce.Declaration("@"+e,t,!1,null,0)})),r.frames=[new Ce.Ruleset(null,n)]);var s,o,a=[new De.JoinSelectorVisitor,new De.MarkVisibleSelectorsVisitor(!0),new De.ExtendVisitor,new De.ToCSSVisitor({compress:Boolean(t.compress)})],l=[];if(t.pluginManager){o=t.pluginManager.visitor();for(var u=0;u<2;u++)for(o.first();s=o.get();)s.isPreEvalVisitor?0!==u&&-1!==l.indexOf(s)||(l.push(s),s.run(e)):0!==u&&-1!==a.indexOf(s)||(s.isPreVisitor?a.unshift(s):a.push(s))}i=e.eval(r);for(u=0;u=t);i++);this.preProcessors.splice(i,0,{preProcessor:e,priority:t})},e.prototype.addPostProcessor=function(e,t){var i;for(i=0;i=t);i++);this.postProcessors.splice(i,0,{postProcessor:e,priority:t})},e.prototype.addFileManager=function(e){this.fileManagers.push(e)},e.prototype.getPreProcessors=function(){for(var e=[],t=0;t0){var n=void 0,r=JSON.stringify(this._sourceMapGenerator.toJSON());this.sourceMapURL?n=this.sourceMapURL:this._sourceMapFilename&&(n=this._sourceMapFilename),this.sourceMapURL=n,this.sourceMap=r}return this._css.join("")},t}()}(e=new s(e,t)),e)),a=function(e){return function(){function t(e,t,i){this.less=e,this.rootFilename=i.filename,this.paths=t.paths||[],this.contents={},this.contentsIgnoredChars={},this.mime=t.mime,this.error=null,this.context=t,this.queue=[],this.files={}}return t.prototype.push=function(t,i,n,s,o){var a=this,l=this.context.pluginManager.Loader;this.queue.push(t);var u=function(e,i,n){a.queue.splice(a.queue.indexOf(t),1);var l=n===a.rootFilename;s.optional&&e?(o(null,{rules:[]},!1,null),r.info("The file "+n+" was skipped because it was not found and the import was marked optional.")):(a.files[n]||s.inline||(a.files[n]={root:i,options:s}),e&&!a.error&&(a.error=e),o(e,i,l,n))},c={rewriteUrls:this.context.rewriteUrls,entryPath:n.entryPath,rootpath:n.rootpath,rootFilename:n.rootFilename},h=e.getFileManager(t,n.currentDirectory,this.context,e);if(h){var f,p,v=function(e){var t,i=e.filename,r=e.contents.replace(/^\uFEFF/,"");c.currentDirectory=h.getPath(i),c.rewriteUrls&&(c.rootpath=h.join(a.context.rootpath||"",h.pathDiff(c.currentDirectory,c.entryPath)),!h.isPathAbsolute(c.rootpath)&&h.alwaysMakePathsAbsolute()&&(c.rootpath=h.join(c.entryPath,c.rootpath))),c.filename=i;var o=new q.Parse(a.context);o.processImports=!1,a.contents[i]=r,(n.reference||s.reference)&&(c.reference=!0),s.isPlugin?(t=l.evalPlugin(r,o,a,s.pluginArgs,c))instanceof O?u(t,null,i):u(null,t,i):s.inline?u(null,r,i):!a.files[i]||a.files[i].options.multiple||s.multiple?new Ue(o,a,c).parse(r,(function(e,t){u(e,t,i)})):u(null,a.files[i].root,i)},d=_(this.context);i&&(d.ext=s.isPlugin?".js":".less"),s.isPlugin?(d.mime="application/javascript",d.syncImport?f=l.loadPluginSync(t,n.currentDirectory,d,e,h):p=l.loadPlugin(t,n.currentDirectory,d,e,h)):d.syncImport?f=h.loadFileSync(t,n.currentDirectory,d,e):p=h.loadFile(t,n.currentDirectory,d,e,(function(e,t){e?u(e):v(t)})),f?f.filename?v(f):u(f):p&&p.then(v,u)}else u({message:"Could not find a file-manager for "+t})},t}()}(e);var u,c=function(e,t,i){var n=function(e,i,r){if("function"==typeof i?(r=i,i=M(this.options,{})):i=M(this.options,i||{}),!r){var s=this;return new Promise((function(t,r){n.call(s,e,i,(function(e,i){e?r(e):t(i)}))}))}this.parse(e,i,(function(e,i,n,s){if(e)return r(e);var o;try{o=new t(i,n).toCSS(s)}catch(e){return r(e)}r(null,o)}))};return n}(0,o),h=function(e,t,i){var n=function(e,t,r){if("function"==typeof t?(r=t,t=M(this.options,{})):t=M(this.options,t||{}),!r){var s=this;return new Promise((function(i,r){n.call(s,e,t,(function(e,t){e?r(e):i(t)}))}))}var o,a=void 0,l=new mt(this,!t.reUsePluginManager);if(t.pluginManager=l,o=new q.Parse(t),t.rootFileInfo)a=t.rootFileInfo;else{var u=t.filename||"input",c=u.replace(/[^\/\\]*$/,"");(a={filename:u,rewriteUrls:o.rewriteUrls,rootpath:o.rootpath||"",currentDirectory:c,entryPath:c,rootFilename:u}).rootpath&&"/"!==a.rootpath.slice(-1)&&(a.rootpath+="/")}var h=new i(this,o,a);this.importManager=h,t.plugins&&t.plugins.forEach((function(e){var t,i;if(e.fileContent){if(i=e.fileContent.replace(/^\uFEFF/,""),(t=l.Loader.evalPlugin(i,o,h,e.options,e.filename))instanceof O)return r(t)}else l.addPlugin(e)})),new Ue(o,h,a).parse(e,(function(e,i){if(e)return r(e);r(null,i,h,t)}),t)};return n}(0,0,a),f=bt("v4.1.1"),p={version:[f.major,f.minor,f.patch],data:l,tree:Ce,Environment:s,AbstractFileManager:ke,AbstractPluginLoader:_e,environment:e,visitors:De,Parser:Ue,functions:ft(e),contexts:q,SourceMapOutput:i,SourceMapBuilder:n,ParseTree:o,ImportManager:a,render:c,parse:h,LessError:O,transformTree:pt,utils:P,PluginManager:mt,logger:r},v=function(e){return function(){var t=Object.create(e.prototype);return e.apply(t,Array.prototype.slice.call(arguments,0)),t}},d=Object.create(p);for(var m in p.tree)if("function"==typeof(u=p.tree[m]))d[m.toLowerCase()]=v(u);else for(var g in d[m]=Object.create(null),u)d[m][g.toLowerCase()]=v(u[g]);return p.parse=p.parse.bind(d),p.render=p.render.bind(d),d}var xt={},St=function(){};St.prototype=Object.assign(new ke,{alwaysMakePathsAbsolute:function(){return!0},join:function(e,t){return e?this.extractUrlParts(t,e).path:t},doXHR:function(e,t,i,n){var r=new XMLHttpRequest,s=!gt.isFileProtocol||gt.fileAsync;function o(t,i,n){t.status>=200&&t.status<300?i(t.responseText,t.getResponseHeader("Last-Modified")):"function"==typeof n&&n(t.status,e)}"function"==typeof r.overrideMimeType&&r.overrideMimeType("text/css"),yt.debug("XHR: Getting '"+e+"'"),r.open("GET",e,s),r.setRequestHeader("Accept",t||"text/x-less, text/css; q=0.9, */*; q=0.5"),r.send(null),gt.isFileProtocol&&!gt.fileAsync?0===r.status||r.status>=200&&r.status<300?i(r.responseText):n(r.status,e):s?r.onreadystatechange=function(){4==r.readyState&&o(r,i,n)}:o(r,i,n)},supports:function(){return!0},clearFileCache:function(){xt={}},loadFile:function(e,t,i,n){t&&!this.isPathAbsolute(e)&&(e=t+e),e=i.ext?this.tryAppendExtension(e,i.ext):e,i=i||{};var r=this.extractUrlParts(e,window.location.href).url,s=this;return new Promise((function(e,t){if(i.useFileCache&&xt[r])try{var n=xt[r];return e({contents:n,filename:r,webInfo:{lastModified:new Date}})}catch(e){return t({filename:r,message:"Error loading file "+r+" error was "+e.message})}s.doXHR(r,i.mime,(function(t,i){xt[r]=t,e({contents:t,filename:r,webInfo:{lastModified:i}})}),(function(e,i){t({type:"File",message:"'"+i+"' wasn't found ("+e+")",href:r})}))}))}});var It=function(e,t){return gt=e,yt=t,St},Ct=function(e){this.less=e};Ct.prototype=Object.assign(new _e,{loadPlugin:function(e,t,i,n,r){return new Promise((function(s,o){r.loadFile(e,t,i,n).then(s).catch(o)}))}});var kt=function(t,n,r){return{add:function(s,o){r.errorReporting&&"html"!==r.errorReporting?"console"===r.errorReporting?function(e,t){var i=e.filename||t,s=[],o=(e.type||"Syntax")+"Error: "+(e.message||"There is an error in your .less file")+" in "+i,a=function(e,t,i){void 0!==e.extract[t]&&s.push("{line} {content}".replace(/\{line\}/,(parseInt(e.line,10)||0)+(t-1)).replace(/\{class\}/,i).replace(/\{content\}/,e.extract[t]))};e.line&&(a(e,0,""),a(e,1,"line"),a(e,2,""),o+=" on line "+e.line+", column "+(e.column+1)+":\n"+s.join("\n")),e.stack&&(e.extract||r.logLevel>=4)&&(o+="\nStack Trace\n"+e.stack),n.logger.error(o)}(s,o):"function"==typeof r.errorReporting&&r.errorReporting("add",s,o):function(n,s){var o,a,l="less-error-message:"+e(s||""),u=t.document.createElement("div"),c=[],h=n.filename||s,f=h.match(/([^\/]+(\?.*)?)$/)[1];u.id=l,u.className="less-error-message",a="

"+(n.type||"Syntax")+"Error: "+(n.message||"There is an error in your .less file")+'

in '+f+" ";var p=function(e,t,i){void 0!==e.extract[t]&&c.push('

  • {content}
  • '.replace(/\{line\}/,(parseInt(e.line,10)||0)+(t-1)).replace(/\{class\}/,i).replace(/\{content\}/,e.extract[t]))};n.line&&(p(n,0,""),p(n,1,"line"),p(n,2,""),a+="on line "+n.line+", column "+(n.column+1)+":

      "+c.join("")+"
    "),n.stack&&(n.extract||r.logLevel>=4)&&(a+="
    Stack Trace
    "+n.stack.split("\n").slice(1).join("
    ")),u.innerHTML=a,i(t.document,[".less-error-message ul, .less-error-message li {","list-style-type: none;","margin-right: 15px;","padding: 4px 0;","margin: 0;","}",".less-error-message label {","font-size: 12px;","margin-right: 15px;","padding: 4px 0;","color: #cc7777;","}",".less-error-message pre {","color: #dd6666;","padding: 4px 0;","margin: 0;","display: inline-block;","}",".less-error-message pre.line {","color: #ff0000;","}",".less-error-message h3 {","font-size: 20px;","font-weight: bold;","padding: 15px 0 5px 0;","margin: 0;","}",".less-error-message a {","color: #10a","}",".less-error-message .error {","color: red;","font-weight: bold;","padding-bottom: 2px;","border-bottom: 1px dashed red;","}"].join("\n"),{title:"error-message"}),u.style.cssText=["font-family: Arial, sans-serif","border: 1px solid #e00","background-color: #eee","border-radius: 5px","-webkit-border-radius: 5px","-moz-border-radius: 5px","color: #e00","padding: 15px","margin-bottom: 15px"].join(";"),"development"===r.env&&(o=setInterval((function(){var e=t.document,i=e.body;i&&(e.getElementById(l)?i.replaceChild(u,e.getElementById(l)):i.insertBefore(u,i.firstChild),clearInterval(o))}),10))}(s,o)},remove:function(i){r.errorReporting&&"html"!==r.errorReporting?"console"===r.errorReporting||"function"==typeof r.errorReporting&&r.errorReporting("remove",i):function(i){var n=t.document.getElementById("less-error-message:"+e(i));n&&n.parentNode.removeChild(n)}(i)}}},_t={javascriptEnabled:!1,depends:!1,compress:!1,lint:!1,paths:[],color:!0,strictImports:!1,insecure:!1,rootpath:"",rewriteUrls:!1,math:1,strictUnits:!1,globalVars:null,modifyVars:null,urlArgs:""};if(window.less)for(var At in window.less)window.less.hasOwnProperty(At)&&(_t[At]=window.less[At]);!function(e,i){t(i,n(e)),void 0===i.isFileProtocol&&(i.isFileProtocol=/^(file|(chrome|safari)(-extension)?|resource|qrc|app):/.test(e.location.protocol)),i.async=i.async||!1,i.fileAsync=i.fileAsync||!1,i.poll=i.poll||(i.isFileProtocol?1e3:1500),i.env=i.env||("127.0.0.1"==e.location.hostname||"0.0.0.0"==e.location.hostname||"localhost"==e.location.hostname||e.location.port&&e.location.port.length>0||i.isFileProtocol?"development":"production");var r=/!dumpLineNumbers:(comments|mediaquery|all)/.exec(e.location.hash);r&&(i.dumpLineNumbers=r[1]),void 0===i.useFileCache&&(i.useFileCache=!0),void 0===i.onReady&&(i.onReady=!0),i.relativeUrls&&(i.rewriteUrls="all")}(window,_t),_t.plugins=_t.plugins||[],window.LESS_PLUGINS&&(_t.plugins=_t.plugins.concat(window.LESS_PLUGINS));var Mt,Et,Pt,Rt=function(e,n){var r=e.document,s=wt();s.options=n;var o=s.environment,a=It(n,s.logger),l=new a;o.addFileManager(l),s.FileManager=a,s.PluginLoader=Ct,function(e,t){t.logLevel=void 0!==t.logLevel?t.logLevel:"development"===t.env?3:1,t.loggers||(t.loggers=[{debug:function(e){t.logLevel>=4&&console.log(e)},info:function(e){t.logLevel>=3&&console.log(e)},warn:function(e){t.logLevel>=2&&console.warn(e)},error:function(e){t.logLevel>=1&&console.error(e)}}]);for(var i=0;i6,left:"center",load:!1,mask:null,oneInstance:!0,speed:"normal",target:null,top:"10%"}};var b=[],c={};a.tools.overlay.addEffect("default",function(b,c){var d=this.getConf(),e=a(window);d.fixed||(b.top+=e.scrollTop(),b.left+=e.scrollLeft()),b.position=d.fixed?"fixed":"absolute",this.getOverlay().css(b).fadeIn(d.speed,c)},function(a){this.getOverlay().fadeOut(this.getConf().closeSpeed,a)});function d(d,e){var f=this,g=d.add(f),h=a(window),i,j,k,l=a.tools.expose&&(e.mask||e.expose),m=Math.random().toString().slice(10);l&&(typeof l=="string"&&(l={color:l}),l.closeOnClick=l.closeOnEsc=!1);var n=e.target||d.attr("rel");j=n?a(n):null||d;if(!j.length)throw"Could not find Overlay: "+n;d&&d.index(j)==-1&&d.click(function(a){f.load(a);return a.preventDefault()}),a.extend(f,{load:function(d){if(f.isOpened())return f;var i=c[e.effect];if(!i)throw"Overlay: cannot find effect : \""+e.effect+"\"";e.oneInstance&&a.each(b,function(){this.close(d)}),d=d||a.Event(),d.type="onBeforeLoad",g.trigger(d);if(d.isDefaultPrevented())return f;k=!0,l&&a(j).expose(l);var n=e.top,o=e.left,p=j.outerWidth({margin:!0}),q=j.outerHeight({margin:!0});typeof n=="string"&&(n=n=="center"?Math.max((h.height()-q)/2,0):parseInt(n,10)/100*h.height()),o=="center"&&(o=Math.max((h.width()-p)/2,0)),i[0].call(f,{top:n,left:o},function(){k&&(d.type="onLoad",g.trigger(d))}),l&&e.closeOnClick&&a.mask.getMask().one("click",f.close),e.closeOnClick&&a(document).on("click."+m,function(b){a(b.target).parents(j).length||f.close(b)}),e.closeOnEsc&&a(document).on("keydown."+m,function(a){a.keyCode==27&&f.close(a)});return f},close:function(b){if(!f.isOpened())return f;b=b||a.Event(),b.type="onBeforeClose",g.trigger(b);if(!b.isDefaultPrevented()){k=!1,c[e.effect][1].call(f,function(){b.type="onClose",g.trigger(b)}),a(document).off("click."+m+" keydown."+m),l&&a.mask.close();return f}},getOverlay:function(){return j},getTrigger:function(){return d},getClosers:function(){return i},isOpened:function(){return k},getConf:function(){return e}}),a.each("onBeforeLoad,onStart,onLoad,onBeforeClose,onClose".split(","),function(b,c){a.isFunction(e[c])&&a(f).on(c,e[c]),f[c]=function(b){b&&a(f).on(c,b);return f}}),i=j.find(e.close||".close"),!i.length&&!e.close&&(i=a(""),j.prepend(i)),i.click(function(a){f.close(a)}),e.load&&f.load()}a.fn.overlay=function(c){var e=this.data("overlay");if(e)return e;a.isFunction(c)&&(c={onBeforeLoad:c}),c=a.extend(!0,{},a.tools.overlay.conf,c),this.each(function(){e=new d(a(this),c),b.push(e),a(this).data("overlay",e)});return c.api?e:this}})(jQuery); (function(a){var b=a.tools.overlay,c=a(window);a.extend(b.conf,{start:{top:null,left:null},fadeInSpeed:"fast",zIndex:9999});function d(a){var b=a.offset();return{top:b.top+a.height()/2,left:b.left+a.width()/2}}var e=function(b,e){var f=this.getOverlay(),g=this.getConf(),h=this.getTrigger(),i=this,j=f.outerWidth({margin:!0}),k=f.data("img"),l=g.fixed?"fixed":"absolute";if(!k){var m=f.css("backgroundImage");if(!m)throw"background-image CSS property not set for overlay";m=m.slice(m.indexOf("(")+1,m.indexOf(")")).replace(/\"/g,""),f.css("backgroundImage","none"),k=a(""),k.css({border:0,display:"none"}).width(j),a("body").append(k),f.data("img",k)}var n=g.start.top||Math.round(c.height()/2),o=g.start.left||Math.round(c.width()/2);if(h){var p=d(h);n=p.top,o=p.left}g.fixed?(n-=c.scrollTop(),o-=c.scrollLeft()):(b.top+=c.scrollTop(),b.left+=c.scrollLeft()),k.css({position:"absolute",top:n,left:o,width:0,zIndex:g.zIndex}).show(),b.position=l,f.css(b),k.animate({top:b.top,left:b.left,width:j},g.speed,function(){f.css("zIndex",g.zIndex+1).fadeIn(g.fadeInSpeed,function(){i.isOpened()&&!a(this).index(f)?e.call():f.hide()})}).css("position",l)},f=function(b){var e=this.getOverlay().hide(),f=this.getConf(),g=this.getTrigger(),h=e.data("img"),i={top:f.start.top,left:f.start.left,width:0};g&&a.extend(i,d(g)),f.fixed&&h.css({position:"absolute"}).animate({top:"+="+c.scrollTop(),left:"+="+c.scrollLeft()},0),h.animate(i,f.closeSpeed,b)};b.addEffect("apple",e,f)})(jQuery); (function(a){a.tools=a.tools||{version:"dev"},a.tools.scrollable={conf:{activeClass:"active",circular:!1,clonedClass:"cloned",disabledClass:"disabled",easing:"swing",initialIndex:0,item:"> *",items:".items",keyboard:!0,mousewheel:!1,next:".next",prev:".prev",size:1,speed:400,vertical:!1,touch:!0,wheelSpeed:0}};function b(a,b){var c=parseInt(a.css(b),10);if(c)return c;var d=a[0].currentStyle;return d&&d.width&&parseInt(d.width,10)}function c(b,c){var d=a(c);return d.length<2?d:b.parent().find(c)}var d;function e(b,e){var f=this,g=b.add(f),h=b.children(),i=0,j=e.vertical;d||(d=f),h.length>1&&(h=a(e.items,b)),e.size>1&&(e.circular=!1),a.extend(f,{getConf:function(){return e},getIndex:function(){return i},getSize:function(){return f.getItems().size()},getNaviButtons:function(){return n.add(o)},getRoot:function(){return b},getItemWrap:function(){return h},getItems:function(){return h.find(e.item).not("."+e.clonedClass)},move:function(a,b){return f.seekTo(i+a,b)},next:function(a){return f.move(e.size,a)},prev:function(a){return f.move(-e.size,a)},begin:function(a){return f.seekTo(0,a)},end:function(a){return f.seekTo(f.getSize()-1,a)},focus:function(){d=f;return f},addItem:function(b){b=a(b),e.circular?(h.children().last().before(b),h.children().first().replaceWith(b.clone().addClass(e.clonedClass))):(h.append(b),o.removeClass("disabled")),g.trigger("onAddItem",[b]);return f},seekTo:function(b,c,k){b.jquery||(b*=1);if(e.circular&&b===0&&i==-1&&c!==0)return f;if(!e.circular&&b<0||b>f.getSize()||b<-1)return f;var l=b;b.jquery?b=f.getItems().index(b):l=f.getItems().eq(b);var m=a.Event("onBeforeSeek");if(!k){g.trigger(m,[b,c]);if(m.isDefaultPrevented()||!l.length)return f}var n=j?{top:-l.position().top}:{left:-l.position().left};i=b,d=f,c===undefined&&(c=e.speed),h.animate(n,c,e.easing,k||function(){g.trigger("onSeek",[b])});return f}}),a.each(["onBeforeSeek","onSeek","onAddItem"],function(b,c){a.isFunction(e[c])&&a(f).on(c,e[c]),f[c]=function(b){b&&a(f).on(c,b);return f}});if(e.circular){var k=f.getItems().slice(-1).clone().prependTo(h),l=f.getItems().eq(1).clone().appendTo(h);k.add(l).addClass(e.clonedClass),f.onBeforeSeek(function(a,b,c){if(!a.isDefaultPrevented()){if(b==-1){f.seekTo(k,c,function(){f.end(0)});return a.preventDefault()}b==f.getSize()&&f.seekTo(l,c,function(){f.begin(0)})}});var m=b.parents().add(b).filter(function(){if(a(this).css("display")==="none")return!0});m.length?(m.show(),f.seekTo(0,0,function(){}),m.hide()):f.seekTo(0,0,function(){})}var n=c(b,e.prev).click(function(a){a.stopPropagation(),f.prev()}),o=c(b,e.next).click(function(a){a.stopPropagation(),f.next()});e.circular||(f.onBeforeSeek(function(a,b){setTimeout(function(){a.isDefaultPrevented()||(n.toggleClass(e.disabledClass,b<=0),o.toggleClass(e.disabledClass,b>=f.getSize()-1))},1)}),e.initialIndex||n.addClass(e.disabledClass)),f.getSize()<2&&n.add(o).addClass(e.disabledClass),e.mousewheel&&a.fn.mousewheel&&b.mousewheel(function(a,b){if(e.mousewheel){f.move(b<0?1:-1,e.wheelSpeed||50);return!1}});if(e.touch){var p={};h[0].ontouchstart=function(a){var b=a.touches[0];p.x=b.clientX,p.y=b.clientY},h[0].ontouchmove=function(a){if(a.touches.length==1&&!h.is(":animated")){var b=a.touches[0],c=p.x-b.clientX,d=p.y-b.clientY;f[j&&d>0||!j&&c>0?"next":"prev"](),a.preventDefault()}}}e.keyboard&&a(document).on("keydown.scrollable",function(b){if(!(!e.keyboard||b.altKey||b.ctrlKey||b.metaKey||a(b.target).is(":input"))){if(e.keyboard!="static"&&d!=f)return;var c=b.keyCode;if(j&&(c==38||c==40)){f.move(c==38?-1:1);return b.preventDefault()}if(!j&&(c==37||c==39)){f.move(c==37?-1:1);return b.preventDefault()}}}),e.initialIndex&&f.seekTo(e.initialIndex,0,function(){})}a.fn.scrollable=function(b){var c=this.data("scrollable");if(c)return c;b=a.extend({},a.tools.scrollable.conf,b),this.each(function(){c=new e(a(this),b),a(this).data("scrollable",c)});return b.api?c:this}})(jQuery); (function(a){var b=a.tools.scrollable;b.autoscroll={conf:{autoplay:!0,interval:3e3,autopause:!0}},a.fn.autoscroll=function(c){typeof c=="number"&&(c={interval:c});var d=a.extend({},b.autoscroll.conf,c),e;this.each(function(){var b=a(this).data("scrollable"),c=b.getRoot(),f,g=!1;function h(){f&&clearTimeout(f),f=setTimeout(function(){b.next()},d.interval)}b&&(e=b),b.play=function(){f||(g=!1,c.on("onSeek",h),h())},b.pause=function(){f=clearTimeout(f),c.off("onSeek",h)},b.resume=function(){g||b.play()},b.stop=function(){g=!0,b.pause()},d.autopause&&c.add(b.getNaviButtons()).hover(b.pause,b.resume),d.autoplay&&b.play()});return d.api?e:this}})(jQuery); (function(a){var b=a.tools.scrollable;b.navigator={conf:{navi:".navi",naviItem:null,activeClass:"active",indexed:!1,idPrefix:null,history:!1}};function c(b,c){var d=a(c);return d.length<2?d:b.parent().find(c)}a.fn.navigator=function(d){typeof d=="string"&&(d={navi:d}),d=a.extend({},b.navigator.conf,d);var e;this.each(function(){var b=a(this).data("scrollable"),f=d.navi.jquery?d.navi:c(b.getRoot(),d.navi),g=b.getNaviButtons(),h=d.activeClass,i=d.history&&history.pushState,j=b.getConf().size;b&&(e=b),b.getNaviButtons=function(){return g.add(f)},i&&(history.pushState({i:0},""),a(window).on("popstate",function(a){var c=a.originalEvent.state;c&&b.seekTo(c.i)}));function k(a,c,d){b.seekTo(c),d.preventDefault(),i&&history.pushState({i:c},"")}function l(){return f.find(d.naviItem||"> *")}function m(b){var c=a("<"+(d.naviItem||"a")+"/>").click(function(c){k(a(this),b,c)});b===0&&c.addClass(h),d.indexed&&c.text(b+1),d.idPrefix&&c.attr("id",d.idPrefix+b);return c.appendTo(f)}l().length?l().each(function(b){a(this).click(function(c){k(a(this),b,c)})}):a.each(b.getItems(),function(a){a%j==0&&m(a)}),b.onBeforeSeek(function(a,b){setTimeout(function(){if(!a.isDefaultPrevented()){var c=b/j,d=l().eq(c);d.length&&l().removeClass(h).eq(c).addClass(h)}},1)}),b.onAddItem(function(a,c){var d=b.getItems().index(c);d%j==0&&m(d)})});return d.api?e:this}})(jQuery); (function(a){a.tools=a.tools||{version:"dev"},a.tools.tabs={conf:{tabs:"a",current:"current",onBeforeClick:null,onClick:null,effect:"default",initialEffect:!1,initialIndex:0,event:"click",rotate:!1,slideUpSpeed:400,slideDownSpeed:400,history:!1},addEffect:function(a,c){b[a]=c}};var b={"default":function(a,b){this.getPanes().hide().eq(a).show(),b.call()},fade:function(a,b){var c=this.getConf(),d=c.fadeOutSpeed,e=this.getPanes();d?e.fadeOut(d):e.hide(),e.eq(a).fadeIn(c.fadeInSpeed,b)},slide:function(a,b){var c=this.getConf();this.getPanes().slideUp(c.slideUpSpeed),this.getPanes().eq(a).slideDown(c.slideDownSpeed,b)},ajax:function(a,b){this.getPanes().eq(0).load(this.getTabs().eq(a).attr("href"),b)}},c,d;a.tools.tabs.addEffect("horizontal",function(b,e){if(!c){var f=this.getPanes().eq(b),g=this.getCurrentPane();d||(d=this.getPanes().eq(0).width()),c=!0,f.show(),g.animate({width:0},{step:function(a){f.css("width",d-a)},complete:function(){a(this).hide(),e.call(),c=!1}}),g.length||(e.call(),c=!1)}});function e(c,d,e){var f=this,g=c.add(this),h=c.find(e.tabs),i=d.jquery?d:c.children(d),j;h.length||(h=c.children()),i.length||(i=c.parent().find(d)),i.length||(i=a(d)),a.extend(this,{click:function(d,i){var k=h.eq(d),l=!c.data("tabs");typeof d=="string"&&d.replace("#","")&&(k=h.filter("[href*=\""+d.replace("#","")+"\"]"),d=Math.max(h.index(k),0));if(e.rotate){var m=h.length-1;if(d<0)return f.click(m,i);if(d>m)return f.click(0,i)}if(!k.length){if(j>=0)return f;d=e.initialIndex,k=h.eq(d)}if(d===j)return f;i=i||a.Event(),i.type="onBeforeClick",g.trigger(i,[d]);if(!i.isDefaultPrevented()){var n=l?e.initialEffect&&e.effect||"default":e.effect;b[n].call(f,d,function(){j=d,i.type="onClick",g.trigger(i,[d])}),h.removeClass(e.current),k.addClass(e.current);return f}},getConf:function(){return e},getTabs:function(){return h},getPanes:function(){return i},getCurrentPane:function(){return i.eq(j)},getCurrentTab:function(){return h.eq(j)},getIndex:function(){return j},next:function(){return f.click(j+1)},prev:function(){return f.click(j-1)},destroy:function(){h.off(e.event).removeClass(e.current),i.find("a[href^=\"#\"]").off("click.T");return f}}),a.each("onBeforeClick,onClick".split(","),function(b,c){a.isFunction(e[c])&&a(f).on(c,e[c]),f[c]=function(b){b&&a(f).on(c,b);return f}}),e.history&&a.fn.history&&(a.tools.history.init(h),e.event="history"),h.each(function(b){a(this).on(e.event,function(a){f.click(b,a);return a.preventDefault()})}),i.find("a[href^=\"#\"]").on("click.T",function(b){f.click(a(this).attr("href"),b)}),location.hash&&e.tabs=="a"&&c.find("[href=\""+location.hash+"\"]").length?f.click(location.hash):(e.initialIndex===0||e.initialIndex>0)&&f.click(e.initialIndex)}a.fn.tabs=function(b,c){var d=this.data("tabs");d&&(d.destroy(),this.removeData("tabs")),a.isFunction(c)&&(c={onBeforeClick:c}),c=a.extend({},a.tools.tabs.conf,c),this.each(function(){d=new e(a(this),b,c),a(this).data("tabs",d)});return c.api?d:this}})(jQuery); (function(a){var b;b=a.tools.tabs.slideshow={conf:{next:".forward",prev:".backward",disabledClass:"disabled",autoplay:!1,autopause:!0,interval:3e3,clickable:!0,api:!1}};function c(b,c){var d=this,e=b.add(this),f=b.data("tabs"),g,h=!0;function i(c){var d=a(c);return d.length<2?d:b.parent().find(c)}var j=i(c.next).click(function(){f.next()}),k=i(c.prev).click(function(){f.prev()});function l(){g=setTimeout(function(){f.next()},c.interval)}a.extend(d,{getTabs:function(){return f},getConf:function(){return c},play:function(){if(g)return d;var b=a.Event("onBeforePlay");e.trigger(b);if(b.isDefaultPrevented())return d;h=!1,e.trigger("onPlay"),e.on("onClick",l),l();return d},pause:function(){if(!g)return d;var b=a.Event("onBeforePause");e.trigger(b);if(b.isDefaultPrevented())return d;g=clearTimeout(g),e.trigger("onPause"),e.off("onClick",l);return d},resume:function(){h||d.play()},stop:function(){d.pause(),h=!0}}),a.each("onBeforePlay,onPlay,onBeforePause,onPause".split(","),function(b,e){a.isFunction(c[e])&&a(d).on(e,c[e]),d[e]=function(b){return a(d).on(e,b)}}),c.autopause&&f.getTabs().add(j).add(k).add(f.getPanes()).hover(d.pause,d.resume),c.autoplay&&d.play(),c.clickable&&f.getPanes().click(function(){f.next()});if(!f.getConf().rotate){var m=c.disabledClass;f.getIndex()||k.addClass(m),f.onBeforeClick(function(a,b){k.toggleClass(m,!b),j.toggleClass(m,b==f.getTabs().length-1)})}}a.fn.slideshow=function(d){var e=this.data("slideshow");if(e)return e;d=a.extend({},b.conf,d),this.each(function(){e=new c(a(this),d),a(this).data("slideshow",e)});return d.api?e:this}})(jQuery); (function(a){a.fn.mousewheel=function(a){return this[a?"on":"trigger"]("wheel",a)},a.event.special.wheel={setup:function(){a.event.add(this,b,c,{})},teardown:function(){a.event.remove(this,b,c)}};var b=a.browser.mozilla?"DOMMouseScroll"+(a.browser.version<"1.9"?" mousemove":""):"mousewheel";function c(b){switch(b.type){case"mousemove":return a.extend(b.data,{clientX:b.clientX,clientY:b.clientY,pageX:b.pageX,pageY:b.pageY});case"DOMMouseScroll":a.extend(b,b.data),b.delta=-b.detail/3;break;case"mousewheel":b.delta=b.wheelDelta/120}b.type="wheel";return a.event.handle.call(this,b,b.delta)}})(jQuery); (function(a){a.tools=a.tools||{version:"dev"},a.tools.tooltip={conf:{effect:"toggle",fadeOutSpeed:"fast",predelay:0,delay:30,opacity:1,tip:0,fadeIE:!1,position:["top","center"],offset:[0,0],relative:!1,cancelDefault:!0,events:{def:"mouseenter,mouseleave",input:"focus,blur",widget:"focus mouseenter,blur mouseleave",tooltip:"mouseenter,mouseleave"},layout:"
    ",tipClass:"tooltip"},addEffect:function(a,c,d){b[a]=[c,d]}};var b={toggle:[function(a){var b=this.getConf(),c=this.getTip(),d=b.opacity;d<1&&c.css({opacity:d}),c.show(),a.call()},function(a){this.getTip().hide(),a.call()}],fade:[function(b){var c=this.getConf();!a.browser.msie||c.fadeIE?this.getTip().fadeTo(c.fadeInSpeed,c.opacity,b):(this.getTip().show(),b())},function(b){var c=this.getConf();!a.browser.msie||c.fadeIE?this.getTip().fadeOut(c.fadeOutSpeed,b):(this.getTip().hide(),b())}]};function c(b,c,d){var e=d.relative?b.position().top:b.offset().top,f=d.relative?b.position().left:b.offset().left,g=d.position[0];e-=c.outerHeight()-d.offset[0],f+=b.outerWidth()+d.offset[1],/iPad/i.test(navigator.userAgent)&&(e-=a(window).scrollTop());var h=c.outerHeight()+b.outerHeight();g=="center"&&(e+=h/2),g=="bottom"&&(e+=h),g=d.position[1];var i=c.outerWidth()+b.outerWidth();g=="center"&&(f-=i/2),g=="left"&&(f-=i);return{top:e,left:f}}function d(d,e){var f=this,g=d.add(f),h,i=0,j=0,k=d.attr("title"),l=d.attr("data-tooltip"),m=b[e.effect],n,o=d.is(":input"),p=o&&d.is(":checkbox, :radio, select, :button, :submit"),q=d.attr("type"),r=e.events[q]||e.events[o?p?"widget":"input":"def"];if(!m)throw"Nonexistent effect \""+e.effect+"\"";r=r.split(/,\s*/);if(r.length!=2)throw"Tooltip: bad events configuration for "+q;d.on(r[0],function(a){clearTimeout(i),e.predelay?j=setTimeout(function(){f.show(a)},e.predelay):f.show(a)}).on(r[1],function(a){clearTimeout(j),e.delay?i=setTimeout(function(){f.hide(a)},e.delay):f.hide(a)}),k&&e.cancelDefault&&(d.removeAttr("title"),d.data("title",k)),a.extend(f,{show:function(b){if(!h){l?h=a(l):e.tip?h=a(e.tip).eq(0):k?h=a(e.layout).addClass(e.tipClass).appendTo(document.body).hide().append(k):(h=d.find("."+e.tipClass),h.length||(h=d.next()),h.length||(h=d.parent().next()));if(!h.length)throw"Cannot find tooltip for "+d}if(f.isShown())return f;h.stop(!0,!0);var o=c(d,h,e);e.tip&&h.html(d.data("title")),b=a.Event(),b.type="onBeforeShow",g.trigger(b,[o]);if(b.isDefaultPrevented())return f;o=c(d,h,e),h.css({position:"absolute",top:o.top,left:o.left}),n=!0,m[0].call(f,function(){b.type="onShow",n="full",g.trigger(b)});var p=e.events.tooltip.split(/,\s*/);h.data("__set")||(h.off(p[0]).on(p[0],function(){clearTimeout(i),clearTimeout(j)}),p[1]&&!d.is("input:not(:checkbox, :radio), textarea")&&h.off(p[1]).on(p[1],function(a){a.relatedTarget!=d[0]&&d.trigger(r[1].split(" ")[0])}),e.tip||h.data("__set",!0));return f},hide:function(c){if(!h||!f.isShown())return f;c=a.Event(),c.type="onBeforeHide",g.trigger(c);if(!c.isDefaultPrevented()){n=!1,b[e.effect][1].call(f,function(){c.type="onHide",g.trigger(c)});return f}},isShown:function(a){return a?n=="full":n},getConf:function(){return e},getTip:function(){return h},getTrigger:function(){return d}}),a.each("onHide,onBeforeShow,onShow,onBeforeHide".split(","),function(b,c){a.isFunction(e[c])&&a(f).on(c,e[c]),f[c]=function(b){b&&a(f).on(c,b);return f}})}a.fn.tooltip=function(b){b=a.extend(!0,{},a.tools.tooltip.conf,b),typeof b.position=="string"&&(b.position=b.position.split(/,?\s/)),this.each(function(){a(this).data("tooltip")===null&&(api=new d(a(this),b),a(this).data("tooltip",api))});return b.api?api:this}})(jQuery); (function(a){var b=a.tools.tooltip;b.dynamic={conf:{classNames:"top right bottom left"}};function c(b){var c=a(window),d=c.width()+c.scrollLeft(),e=c.height()+c.scrollTop();return[b.offset().top<=c.scrollTop(),d<=b.offset().left+b.width(),e<=b.offset().top+b.height(),c.scrollLeft()>=b.offset().left]}function d(a){var b=a.length;while(b--)if(a[b])return!1;return!0}a.fn.dynamic=function(e){typeof e=="number"&&(e={speed:e}),e=a.extend({},b.dynamic.conf,e);var f=a.extend(!0,{},e),g=e.classNames.split(/\s/),h,i;this.each(function(){var b=a(this).tooltip().onBeforeShow(function(b,e){var i=this.getTip(),j=this.getConf();h||(h=[j.position[0],j.position[1],j.offset[0],j.offset[1],a.extend({},j)]),a.extend(j,h[4]),j.position=[h[0],h[1]],j.offset=[h[2],h[3]],i.css({visibility:"hidden",position:"absolute",top:e.top,left:e.left}).show();var k=a.extend(!0,{},f),l=c(i);if(!d(l)){l[2]&&(a.extend(j,k.top),j.position[0]="top",i.addClass(g[0])),l[3]&&(a.extend(j,k.right),j.position[1]="right",i.addClass(g[1])),l[0]&&(a.extend(j,k.bottom),j.position[0]="bottom",i.addClass(g[2])),l[1]&&(a.extend(j,k.left),j.position[1]="left",i.addClass(g[3]));if(l[0]||l[2])j.offset[0]*=-1;if(l[1]||l[3])j.offset[1]*=-1}i.css({visibility:"visible"}).hide()});b.onBeforeShow(function(){var a=this.getConf(),b=this.getTip();setTimeout(function(){a.position=[h[0],h[1]],a.offset=[h[2],h[3]]},0)}),b.onHide(function(){var a=this.getTip();a.removeClass(e.classNames)}),i=b});return e.api?i:this}})(jQuery); (function(a){var b=a.tools.tooltip;a.extend(b.conf,{direction:"up",bounce:!1,slideOffset:10,slideInSpeed:200,slideOutSpeed:200,slideFade:!a.browser.msie});var c={up:["-","top"],down:["+","top"],left:["-","left"],right:["+","left"]};b.addEffect("slide",function(a){var b=this.getConf(),d=this.getTip(),e=b.slideFade?{opacity:b.opacity}:{},f=c[b.direction]||c.up;e[f[1]]=f[0]+"="+b.slideOffset,b.slideFade&&d.css({opacity:0}),d.show().animate(e,b.slideInSpeed,a)},function(b){var d=this.getConf(),e=d.slideOffset,f=d.slideFade?{opacity:0}:{},g=c[d.direction]||c.up,h=""+g[0];d.bounce&&(h=h=="+"?"-":"+"),f[g[1]]=h+"="+e,this.getTip().animate(f,d.slideOutSpeed,function(){a(this).hide(),b.call()})})})(jQuery); ;(function(root, factory) { if (typeof define === 'function' && define.amd) { define(['jquery'], factory); } else if (typeof exports === 'object') { module.exports = factory(require('jquery')); } else { root.jquery_mmenu_all_js = factory(root.jQuery); } }(this, function(jQuery) { /*! * jQuery mmenu v7.0.5 * @requires jQuery 1.7.0 or later * * mmenu.frebsite.nl * * Copyright (c) Fred Heusschen * www.frebsite.nl * * License: CC-BY-NC-4.0 * http://creativecommons.org/licenses/by-nc/4.0/ */ !function(e){function t(){e[n].glbl||(l={$wndw:e(window),$docu:e(document),$html:e("html"),$body:e("body")},s={},a={},r={},e.each([s,a,r],function(e,t){t.add=function(e){e=e.split(" ");for(var n=0,i=e.length;ni)){e[n]=function(e,t,n){return this.$menu=e,this._api=["bind","getInstance","initPanels","openPanel","closePanel","closeAllPanels","setSelected"],this.opts=t,this.conf=n,this.vars={},this.cbck={},this.mtch={},"function"==typeof this.___deprecated&&this.___deprecated(),this._initHooks(),this._initWrappers(),this._initAddons(),this._initExtensions(),this._initMenu(),this._initPanels(),this._initOpened(),this._initAnchors(),this._initMatchMedia(),"function"==typeof this.___debug&&this.___debug(),this},e[n].version=i,e[n].uniqueId=0,e[n].wrappers={},e[n].addons={},e[n].defaults={hooks:{},extensions:[],wrappers:[],navbar:{add:!0,title:"Menu",titleLink:"parent"},onClick:{setSelected:!0},slidingSubmenus:!0},e[n].configuration={classNames:{divider:"Divider",inset:"Inset",nolistview:"NoListview",nopanel:"NoPanel",panel:"Panel",selected:"Selected",spacer:"Spacer",vertical:"Vertical"},clone:!1,openingInterval:25,panelNodetype:"ul, ol, div",transitionDuration:400},e[n].prototype={getInstance:function(){return this},initPanels:function(e){this._initPanels(e)},openPanel:function(t,i){if(this.trigger("openPanel:before",t),t&&t.length&&(t.is("."+s.panel)||(t=t.closest("."+s.panel)),t.is("."+s.panel))){var r=this;if("boolean"!=typeof i&&(i=!0),t.parent("."+s.listitem+"_vertical").length)t.parents("."+s.listitem+"_vertical").addClass(s.listitem+"_opened").children("."+s.panel).removeClass(s.hidden),this.openPanel(t.parents("."+s.panel).not(function(){return e(this).parent("."+s.listitem+"_vertical").length}).first()),this.trigger("openPanel:start",t),this.trigger("openPanel:finish",t);else{if(t.hasClass(s.panel+"_opened"))return;var l=this.$pnls.children("."+s.panel),o=this.$pnls.children("."+s.panel+"_opened");if(!e[n].support.csstransitions)return o.addClass(s.hidden).removeClass(s.panel+"_opened"),t.removeClass(s.hidden).addClass(s.panel+"_opened"),this.trigger("openPanel:start",t),void this.trigger("openPanel:finish",t);l.not(t).removeClass(s.panel+"_opened-parent");for(var d=t.data(a.parent);d;)d=d.closest("."+s.panel),d.parent("."+s.listitem+"_vertical").length||d.addClass(s.panel+"_opened-parent"),d=d.data(a.parent);l.removeClass(s.panel+"_highest").not(o).not(t).addClass(s.hidden),t.removeClass(s.hidden);var c=function(){o.removeClass(s.panel+"_opened"),t.addClass(s.panel+"_opened"),t.hasClass(s.panel+"_opened-parent")?(o.addClass(s.panel+"_highest"),t.removeClass(s.panel+"_opened-parent")):(o.addClass(s.panel+"_opened-parent"),t.addClass(s.panel+"_highest")),r.trigger("openPanel:start",t)},h=function(){o.removeClass(s.panel+"_highest").addClass(s.hidden),t.removeClass(s.panel+"_highest"),r.trigger("openPanel:finish",t)};i&&!t.hasClass(s.panel+"_noanimation")?setTimeout(function(){r.__transitionend(t,function(){h()},r.conf.transitionDuration),c()},r.conf.openingInterval):(c(),h())}this.trigger("openPanel:after",t)}},closePanel:function(e){this.trigger("closePanel:before",e);var t=e.parent();t.hasClass(s.listitem+"_vertical")&&(t.removeClass(s.listitem+"_opened"),e.addClass(s.hidden),this.trigger("closePanel",e)),this.trigger("closePanel:after",e)},closeAllPanels:function(e){this.trigger("closeAllPanels:before"),this.$pnls.find("."+s.listview).children().removeClass(s.listitem+"_selected").filter("."+s.listitem+"_vertical").removeClass(s.listitem+"_opened");var t=this.$pnls.children("."+s.panel),n=e&&e.length?e:t.first();this.$pnls.children("."+s.panel).not(n).removeClass(s.panel+"_opened").removeClass(s.panel+"_opened-parent").removeClass(s.panel+"_highest").addClass(s.hidden),this.openPanel(n,!1),this.trigger("closeAllPanels:after")},togglePanel:function(e){var t=e.parent();t.hasClass(s.listitem+"_vertical")&&this[t.hasClass(s.listitem+"_opened")?"closePanel":"openPanel"](e)},setSelected:function(e){this.trigger("setSelected:before",e),this.$menu.find("."+s.listitem+"_selected").removeClass(s.listitem+"_selected"),e.addClass(s.listitem+"_selected"),this.trigger("setSelected:after",e)},bind:function(e,t){this.cbck[e]=this.cbck[e]||[],this.cbck[e].push(t)},trigger:function(){var e=this,t=Array.prototype.slice.call(arguments),n=t.shift();if(this.cbck[n])for(var i=0,s=this.cbck[n].length;i').append(this.$menu.children(this.conf.panelNodetype)).prependTo(this.$menu),this.$menu.addClass(s.menu).parent().addClass(s.wrapper),this.trigger("initMenu:after")},_initPanels:function(t){this.trigger("initPanels:before",t),t=t||this.$pnls.children(this.conf.panelNodetype);var n=e(),i=this,a=function(t){t.filter(i.conf.panelNodetype).each(function(t){var r=i._initPanel(e(this));if(r){i._initNavbar(r),i._initListview(r),n=n.add(r);var l=r.children("."+s.listview).children("li").children(i.conf.panelNodetype).add(r.children("."+i.conf.classNames.panel));l.length&&a(l)}})};a(t),this.trigger("initPanels:after",n)},_initPanel:function(e){this.trigger("initPanel:before",e);if(e.hasClass(s.panel))return e;if(this.__refactorClass(e,this.conf.classNames.panel,s.panel),this.__refactorClass(e,this.conf.classNames.nopanel,s.nopanel),this.__refactorClass(e,this.conf.classNames.inset,s.listview+"_inset"),e.filter("."+s.listview+"_inset").addClass(s.nopanel),e.hasClass(s.nopanel))return!1;var t=e.hasClass(this.conf.classNames.vertical)||!this.opts.slidingSubmenus;e.removeClass(this.conf.classNames.vertical);var n=e.attr("id")||this.__getUniqueId();e.is("ul, ol")&&(e.removeAttr("id"),e.wrap("
    "),e=e.parent()),e.attr("id",n),e.addClass(s.panel+" "+s.hidden);var i=e.parent("li");return t?i.addClass(s.listitem+"_vertical"):e.appendTo(this.$pnls),i.length&&(i.data(a.child,e),e.data(a.parent,i)),this.trigger("initPanel:after",e),e},_initNavbar:function(t){if(this.trigger("initNavbar:before",t),!t.children("."+s.navbar).length){var n=t.data(a.parent),i=e('
    '),r=this.__getPanelTitle(t,this.opts.navbar.title),l="";if(n&&n.length){if(n.hasClass(s.listitem+"_vertical"))return;if(n.parent().is("."+s.listview))var o=n.children("a, span").not("."+s.btn+"_next");else var o=n.closest("."+s.panel).find('a[href="#'+t.attr("id")+'"]');o=o.first(),n=o.closest("."+s.panel);var d=n.attr("id");switch(r=this.__getPanelTitle(t,e(""+o.text()+"").text()),this.opts.navbar.titleLink){case"anchor":l=o.attr("href");break;case"parent":l="#"+d}i.append('')}else if(!this.opts.navbar.title)return;this.opts.navbar.add&&t.addClass(s.panel+"_has-navbar"),i.append('"+r+"").prependTo(t),this.trigger("initNavbar:after",t)}},_initListview:function(t){this.trigger("initListview:before",t);var n=this.__childAddBack(t,"ul, ol");this.__refactorClass(n,this.conf.classNames.nolistview,s.nolistview);var i=n.not("."+s.nolistview).addClass(s.listview).children().addClass(s.listitem);this.__refactorClass(i,this.conf.classNames.selected,s.listitem+"_selected"),this.__refactorClass(i,this.conf.classNames.divider,s.listitem+"_divider"),this.__refactorClass(i,this.conf.classNames.spacer,s.listitem+"_spacer");var r=t.data(a.parent);if(r&&r.is("."+s.listitem)&&!r.children("."+s.btn+"_next").length){var l=r.children("a, span").first(),o=e('').insertBefore(l);l.is("span")&&o.addClass(s.btn+"_fullwidth")}this.trigger("initListview:after",t)},_initOpened:function(){this.trigger("initOpened:before");var e=this.$pnls.find("."+s.listitem+"_selected").removeClass(s.listitem+"_selected").last().addClass(s.listitem+"_selected"),t=e.length?e.closest("."+s.panel):this.$pnls.children("."+s.panel).first();this.openPanel(t,!1),this.trigger("initOpened:after")},_initAnchors:function(){this.trigger("initAnchors:before");var t=this;l.$body.on(r.click+"-oncanvas","a[href]",function(i){var a=e(this),r=a.attr("href"),l=t.$menu.find(a).length,o=a.is("."+s.listitem+" > a"),d=a.is('[rel="external"]')||a.is('[target="_blank"]');if(l&&r.length>1&&"#"==r.slice(0,1))try{var c=t.$menu.find(r);if(c.is("."+s.panel))return t[a.parent().hasClass(s.listitem+"_vertical")?"togglePanel":"openPanel"](c),void i.preventDefault()}catch(h){}var f={close:null,setSelected:null,preventDefault:"#"==r.slice(0,1)};for(var p in e[n].addons){var u=e[n].addons[p].clickAnchor.call(t,a,l,o,d);if(u){if("boolean"==typeof u)return void i.preventDefault();"object"==typeof u&&(f=e.extend({},f,u))}}l&&o&&!d&&(t.__valueOrFn(a,t.opts.onClick.setSelected,f.setSelected)&&t.setSelected(e(i.target).parent()),t.__valueOrFn(a,t.opts.onClick.preventDefault,f.preventDefault)&&i.preventDefault(),t.__valueOrFn(a,t.opts.onClick.close,f.close)&&t.opts.offCanvas&&"function"==typeof t.close&&t.close())}),this.trigger("initAnchors:after")},_initMatchMedia:function(){var e=this;for(var t in this.mtch)!function(){var n=t,i=window.matchMedia(n);e._fireMatchMedia(n,i),i.addListener(function(t){e._fireMatchMedia(n,t)})}()},_fireMatchMedia:function(e,t){for(var n=t.matches?"yes":"no",i=0;i1&&s.wrapPageIfNeeded&&(t=t.wrapAll("<"+this.conf[n].pageNodetype+" />").parent())),t.each(function(){e(this).attr("id",e(this).attr("id")||i.__getUniqueId())}),t.addClass(o.page+" "+o.slideout),r.$page=t,this.trigger("setPage:after",t)},e[t].prototype["_initWindow_"+n]=function(){r.$wndw.off(s.keydown+"-"+n).on(s.keydown+"-"+n,function(e){if(r.$html.hasClass(o.wrapper+"_opened")&&9==e.keyCode)return e.preventDefault(),!1});var e=0;r.$wndw.off(s.resize+"-"+n).on(s.resize+"-"+n,function(t,n){if(1==r.$page.length&&(n||r.$html.hasClass(o.wrapper+"_opened"))){var i=r.$wndw.height();(n||i!=e)&&(e=i,r.$page.css("minHeight",i))}})},e[t].prototype._initBlocker=function(){var t=this;this.opts[n].blockUI&&(r.$blck||(r.$blck=e('
    ')),r.$blck.appendTo(r.$body).off(s.touchstart+"-"+n+" "+s.touchmove+"-"+n).on(s.touchstart+"-"+n+" "+s.touchmove+"-"+n,function(e){e.preventDefault(),e.stopPropagation(),r.$blck.trigger(s.mousedown+"-"+n)}).off(s.mousedown+"-"+n).on(s.mousedown+"-"+n,function(e){e.preventDefault(),r.$html.hasClass(o.wrapper+"_modal")||(t.closeAllOthers(),t.close())}))};var o,i,s,r}(jQuery); /* * jQuery mmenu screenReader add-on * mmenu.frebsite.nl */ !function(t){var i="mmenu",n="screenReader";t[i].addons[n]={setup:function(){var a=this,o=this.opts[n],h=this.conf[n];s=t[i].glbl,"boolean"==typeof o&&(o={aria:o,text:o}),"object"!=typeof o&&(o={}),o=this.opts[n]=t.extend(!0,{},t[i].defaults[n],o),o.aria&&(this.bind("initAddons:after",function(){this.bind("initMenu:after",function(){this.trigger("initMenu:after:sr-aria")}),this.bind("initNavbar:after",function(){this.trigger("initNavbar:after:sr-aria",arguments[0])}),this.bind("openPanel:start",function(){this.trigger("openPanel:start:sr-aria",arguments[0])}),this.bind("close:start",function(){this.trigger("close:start:sr-aria")}),this.bind("close:finish",function(){this.trigger("close:finish:sr-aria")}),this.bind("open:start",function(){this.trigger("open:start:sr-aria")}),this.bind("initOpened:after",function(){this.trigger("initOpened:after:sr-aria")})}),this.bind("updateListview",function(){this.$pnls.find("."+e.listview).children().each(function(){a.__sr_aria(t(this),"hidden",t(this).is("."+e.hidden))})}),this.bind("openPanel:start",function(t){var i=this.$menu.find("."+e.panel).not(t).not(t.parents("."+e.panel)),n=t.add(t.find("."+e.listitem+"_vertical ."+e.listitem+"_opened").children("."+e.panel));this.__sr_aria(i,"hidden",!0),this.__sr_aria(n,"hidden",!1)}),this.bind("closePanel",function(t){this.__sr_aria(t,"hidden",!0)}),this.bind("initPanels:after",function(i){var n=i.find("."+e.btn).each(function(){a.__sr_aria(t(this),"owns",t(this).attr("href").replace("#",""))});this.__sr_aria(n,"haspopup",!0)}),this.bind("initNavbar:after",function(t){var i=t.children("."+e.navbar);this.__sr_aria(i,"hidden",!t.hasClass(e.panel+"_has-navbar"))}),o.text&&(this.bind("initlistview:after",function(t){var i=t.find("."+e.listview).find("."+e.btn+"_fullwidth").parent().children("span");this.__sr_aria(i,"hidden",!0)}),"parent"==this.opts.navbar.titleLink&&this.bind("initNavbar:after",function(t){var i=t.children("."+e.navbar),n=!!i.children("."+e.btn+"_prev").length;this.__sr_aria(i.children("."+e.title),"hidden",n)}))),o.text&&(this.bind("initAddons:after",function(){this.bind("setPage:after",function(){this.trigger("setPage:after:sr-text",arguments[0])})}),this.bind("initNavbar:after",function(n){var r=n.children("."+e.navbar),a=r.children("."+e.title).text(),s=t[i].i18n(h.text.closeSubmenu);a&&(s+=" ("+a+")"),r.children("."+e.btn+"_prev").html(this.__sr_text(s))}),this.bind("initListview:after",function(n){var s=n.data(r.parent);if(s&&s.length){var o=s.children("."+e.btn+"_next"),d=o.nextAll("span, a").first().text(),l=t[i].i18n(h.text[o.parent().is("."+e.listitem+"_vertical")?"toggleSubmenu":"openSubmenu"]);d&&(l+=" ("+d+")"),o.html(a.__sr_text(l))}}))},add:function(){e=t[i]._c,r=t[i]._d,a=t[i]._e,e.add("sronly")},clickAnchor:function(t,i){}},t[i].defaults[n]={aria:!0,text:!0},t[i].configuration[n]={text:{closeMenu:"Close menu",closeSubmenu:"Close submenu",openSubmenu:"Open submenu",toggleSubmenu:"Toggle submenu"}},t[i].prototype.__sr_aria=function(t,i,n){t.prop("aria-"+i,n)[n?"attr":"removeAttr"]("aria-"+i,n)},t[i].prototype.__sr_role=function(t,i){t.prop("role",i)[i?"attr":"removeAttr"]("role",i)},t[i].prototype.__sr_text=function(t){return''+t+""};var e,r,a,s}(jQuery); /* * jQuery mmenu scrollBugFix add-on * mmenu.frebsite.nl */ !function(o){var t="mmenu",n="scrollBugFix";o[t].addons[n]={setup:function(){var r=this.opts[n];this.conf[n];i=o[t].glbl,o[t].support.touch&&this.opts.offCanvas&&this.opts.offCanvas.blockUI&&("boolean"==typeof r&&(r={fix:r}),"object"!=typeof r&&(r={}),r=this.opts[n]=o.extend(!0,{},o[t].defaults[n],r),r.fix&&(this.bind("open:start",function(){this.$pnls.children("."+e.panel+"_opened").scrollTop(0)}),this.bind("initMenu:after",function(){this["_initWindow_"+n]()})))},add:function(){e=o[t]._c,r=o[t]._d,s=o[t]._e},clickAnchor:function(o,t){}},o[t].defaults[n]={fix:!0},o[t].prototype["_initWindow_"+n]=function(){var t=this;i.$docu.off(s.touchmove+"-"+n).on(s.touchmove+"-"+n,function(o){i.$html.hasClass(e.wrapper+"_opened")&&o.preventDefault()});var r=!1;i.$body.off(s.touchstart+"-"+n).on(s.touchstart+"-"+n,"."+e.panels+"> ."+e.panel,function(o){i.$html.hasClass(e.wrapper+"_opened")&&(r||(r=!0,0===o.currentTarget.scrollTop?o.currentTarget.scrollTop=1:o.currentTarget.scrollHeight===o.currentTarget.scrollTop+o.currentTarget.offsetHeight&&(o.currentTarget.scrollTop-=1),r=!1))}).off(s.touchmove+"-"+n).on(s.touchmove+"-"+n,"."+e.panels+"> ."+e.panel,function(t){i.$html.hasClass(e.wrapper+"_opened")&&o(this)[0].scrollHeight>o(this).innerHeight()&&t.stopPropagation()}),i.$wndw.off(s.orientationchange+"-"+n).on(s.orientationchange+"-"+n,function(){t.$pnls.children("."+e.panel+"_opened").scrollTop(0).css({"-webkit-overflow-scrolling":"auto"}).css({"-webkit-overflow-scrolling":"touch"})})};var e,r,s,i}(jQuery); /* * jQuery mmenu autoHeight add-on * mmenu.frebsite.nl */ !function(t){var e="mmenu",i="autoHeight";t[e].addons[i]={setup:function(){var h=this.opts[i];this.conf[i];if(a=t[e].glbl,"boolean"==typeof h&&h&&(h={height:"auto"}),"string"==typeof h&&(h={height:h}),"object"!=typeof h&&(h={}),h=this.opts[i]=t.extend(!0,{},t[e].defaults[i],h),"auto"==h.height||"highest"==h.height){this.bind("initMenu:after",function(){this.$menu.addClass(n.menu+"_autoheight")});var s=function(e){if(!this.opts.offCanvas||this.vars.opened){var i=Math.max(parseInt(this.$pnls.css("top"),10),0)||0,s=Math.max(parseInt(this.$pnls.css("bottom"),10),0)||0,a=0;this.$menu.addClass(n.menu+"_autoheight-measuring"),"auto"==h.height?(e=e||this.$pnls.children("."+n.panel+"_opened"),e.parent("."+n.listitem+"_vertical").length&&(e=e.parents("."+n.panel).not(function(){return t(this).parent("."+n.listitem+"_vertical").length})),e.length||(e=this.$pnls.children("."+n.panel)),a=e.first().outerHeight()):"highest"==h.height&&this.$pnls.children("."+n.panel).each(function(){var e=t(this);e.parent("."+n.listitem+"_vertical").length&&(e=e.parents("."+n.panel).not(function(){return t(this).parent("."+n.listitem+"_vertical").length})),a=Math.max(a,e.first().outerHeight())}),this.$menu.height(a+i+s).removeClass(n.menu+"_autoheight-measuring")}};this.opts.offCanvas&&this.bind("open:start",s),"highest"==h.height&&this.bind("initPanels:after",s),"auto"==h.height&&(this.bind("updateListview",s),this.bind("openPanel:start",s),this.bind("closePanel",s))}},add:function(){n=t[e]._c,h=t[e]._d,s=t[e]._e,s.add("resize")},clickAnchor:function(t,e){}},t[e].defaults[i]={height:"default"};var n,h,s,a}(jQuery); /* * jQuery mmenu backButton add-on * mmenu.frebsite.nl */ !function(n){var t="mmenu",o="backButton";n[t].addons[o]={setup:function(){function e(){l=[c],this.$pnls.children("."+i.panel+"_opened-parent").add(s.$pnls.children("."+i.panel+"_opened")).each(function(){l.push("#"+n(this).attr("id"))})}if(this.opts.offCanvas){var s=this,h=this.opts[o];this.conf[o];a=n[t].glbl,"boolean"==typeof h&&(h={close:h}),"object"!=typeof h&&(h={}),h=n.extend(!0,{},n[t].defaults[o],h);var c="#"+this.$menu.attr("id");if(h.close){var l=[];this.bind("open:finish",function(){history.pushState(null,document.title,c)}),this.bind("open:finish",e),this.bind("openPanel:finish",e),this.bind("close:finish",function(){l=[],history.back(),history.pushState(null,document.title,location.pathname+location.search)}),n(window).on("popstate",function(t){if(s.vars.opened&&l.length){l=l.slice(0,-1);var o=l[l.length-1];o==c?s.close():(s.openPanel(n(o)),history.pushState(null,document.title,c))}})}h.open&&n(window).on("popstate",function(n){s.vars.opened||location.hash!=c||s.open()})}},add:function(){return window.history&&window.history.pushState?(i=n[t]._c,e=n[t]._d,void(s=n[t]._e)):void(n[t].addons[o].setup=function(){})},clickAnchor:function(n,t){}},n[t].defaults[o]={close:!1,open:!1};var i,e,s,a}(jQuery); /* * jQuery mmenu columns add-on * mmenu.frebsite.nl */ !function(e){var n="mmenu",i="columns";e[n].addons[i]={setup:function(){function l(e){var n=e.data(s.parent);if(n&&(n=n.closest("."+a.panel),n.length)){var i=n.attr("class");if(i&&(i=i.split(a.panel+"_columns-")[1]))for(i=parseInt(i.split(" ")[0],10)+1;i>0;){var l=this.$pnls.children("."+a.panel+"_columns-"+i);if(!l.length){i=-1;break}i++,l.removeClass(r).addClass(a.hidden)}}}var o=this.opts[i];this.conf[i];if(t=e[n].glbl,"boolean"==typeof o&&(o={add:o}),"number"==typeof o&&(o={add:!0,visible:o}),"object"!=typeof o&&(o={}),"number"==typeof o.visible&&(o.visible={min:o.visible,max:o.visible}),o=this.opts[i]=e.extend(!0,{},e[n].defaults[i],o),o.add){o.visible.min=Math.max(1,Math.min(6,o.visible.min)),o.visible.max=Math.max(o.visible.min,Math.min(6,o.visible.max));for(var d="",p="",m=0;m<=o.visible.max;m++)d+=" "+a.menu+"_columns-"+m,p+=" "+a.panel+"_columns-"+m;d.length&&(d=d.slice(1),p=p.slice(1));var r=p+" "+a.panel+"_opened "+a.panel+"_opened-parent "+a.panel+"_highest",c=function(n){var i=this.$pnls.children("."+a.panel+"_opened-parent").length;n.hasClass(a.panel+"_opened-parent")||i++,i=Math.min(o.visible.max,Math.max(o.visible.min,i)),this.$menu.removeClass(d).addClass(a.menu+"_columns-"+i),this.$pnls.children("."+a.panel).removeClass(p).filter("."+a.panel+"_opened-parent").add(n).slice(-o.visible.max).each(function(n){e(this).addClass(a.panel+"_columns-"+n)})};this.bind("openPanel:before",l),this.bind("openPanel:start",c)}},add:function(){a=e[n]._c,s=e[n]._d,l=e[n]._e},clickAnchor:function(e,n){}},e[n].defaults[i]={add:!1,visible:{min:1,max:3}};var a,s,l,t}(jQuery); /* * jQuery mmenu counters add-on * mmenu.frebsite.nl */ !function(t){var e="mmenu",n="counters";t[e].addons[n]={setup:function(){var s=this,d=this.opts[n];this.conf[n];if(c=t[e].glbl,"boolean"==typeof d&&(d={add:d,update:d}),"object"!=typeof d&&(d={}),d=this.opts[n]=t.extend(!0,{},t[e].defaults[n],d),this.bind("initListview:after",function(t){var e=this.conf.classNames[n].counter;this.__refactorClass(t.find("."+e),e,i.counter)}),d.add&&this.bind("initListview:after",function(e){var n;switch(d.addTo){case"panels":n=e;break;default:n=e.filter(d.addTo)}n.each(function(){var e=t(this).data(a.parent);e&&(e.children("."+i.counter).length||e.prepend(t('')))})}),d.update){var r=function(e){e=e||this.$pnls.children("."+i.panel),e.each(function(){var e=t(this),n=e.data(a.parent);if(n){var c=n.children("em."+i.counter);c.length&&(e=e.children("."+i.listview),e.length&&c.html(s.__filterListItems(e.children()).length))}})};this.bind("initListview:after",r),this.bind("updateListview",r)}},add:function(){i=t[e]._c,a=t[e]._d,s=t[e]._e,i.add("counter")},clickAnchor:function(t,e){}},t[e].defaults[n]={add:!1,addTo:"panels",count:!1},t[e].configuration.classNames[n]={counter:"Counter"};var i,a,s,c}(jQuery); /* * jQuery mmenu dividers add-on * mmenu.frebsite.nl */ !function(i){var e="mmenu",t="dividers";i[e].addons[t]={setup:function(){var s=this,a=this.opts[t];this.conf[t];if(l=i[e].glbl,"boolean"==typeof a&&(a={add:a,fixed:a}),"object"!=typeof a&&(a={}),a=this.opts[t]=i.extend(!0,{},i[e].defaults[t],a),a.type&&this.bind("initMenu:after",function(){this.$menu.addClass(n.menu+"_"+t+"-"+a.type)}),a.add&&this.bind("initListview:after",function(e){var t;switch(a.addTo){case"panels":t=e;break;default:t=e.filter(a.addTo)}t.length&&(t.children("."+n.listitem+"_divider").remove(),t.find("."+n.listview).each(function(){var e="";s.__filterListItems(i(this).children()).each(function(){var t=i.trim(i(this).children("a, span").text()).slice(0,1).toLowerCase();t!=e&&t.length&&(e=t,i('
  • '+t+"
  • ").insertBefore(this))})}))}),a.fixed){this.bind("initPanels:after",function(){"undefined"==typeof this.$fixeddivider&&(this.$fixeddivider=i('
    ').appendTo(this.$pnls).children())});var o=function(e){if(e=e||this.$pnls.children("."+n.panel+"_opened"),!e.is(":hidden")){var t=e.find("."+n.listitem+"_divider").not("."+n.hidden),s=e.scrollTop()||0,d="";t.each(function(){i(this).position().top+st&&(e=t),e}function t(t,o,i){var r,p,d,f=this,u={events:"panleft panright",typeLower:"x",typeUpper:"X",open_dir:"right",close_dir:"left",negative:!1},c="width",l=u.open_dir,m=function(e){e<=t.maxStartPos&&(g=1)},h=function(){return e("."+s.slideout)},g=0,_=0,v=0,b=this.opts.extensions.all,w="undefined"==typeof b?"left":b.indexOf(s.menu+"_position-right")>-1?"right":b.indexOf(s.menu+"_position-top")>-1?"top":b.indexOf(s.menu+"_position-bottom")>-1?"bottom":"left",y="undefined"==typeof b?"back":b.indexOf(s.menu+"_position-top")>-1||b.indexOf(s.menu+"_position-bottom")>-1||b.indexOf(s.menu+"_position-front")>-1?"front":"back";switch(w){case"top":case"bottom":u.events="panup pandown",u.typeLower="y",u.typeUpper="Y",c="height"}switch(w){case"right":case"bottom":u.negative=!0,m=function(e){e>=i.$wndw[c]()-t.maxStartPos&&(g=1)}}switch(w){case"right":u.open_dir="left",u.close_dir="right";break;case"top":u.open_dir="down",u.close_dir="up";break;case"bottom":u.open_dir="up",u.close_dir="down"}switch(y){case"front":h=function(){return f.$menu}}var x,O=this.__valueOrFn(this.$menu,t.node,i.$page);"string"==typeof O&&(O=e(O));var $=new Hammer(O[0],this.opts[a].vendors.hammer);$.on("panstart",function(e){m(e.center[u.typeLower]),x=h(),l=u.open_dir}),$.on(u.events+" panend",function(e){g>0&&e.preventDefault()}),$.on(u.events,function(e){if(r=e["delta"+u.typeUpper],u.negative&&(r=-r),r!=_&&(l=r>=_?u.open_dir:u.close_dir),_=r,_>t.threshold&&1==g){if(i.$html.hasClass(s.wrapper+"_opened"))return;g=2,f._openSetup(),f.trigger("open:start"),i.$html.addClass(s.dragging),v=n(i.$wndw[c]()*o[c].perc,o[c].min,o[c].max)}2==g&&(p=n(_,10,v)-("front"==y?v:0),u.negative&&(p=-p),d="translate"+u.typeUpper+"("+p+"px )",x.css({"-webkit-transform":"-webkit-"+d,transform:d}))}),$.on("panend",function(e){2==g&&(i.$html.removeClass(s.dragging),x.css("transform",""),f[l==u.open_dir?"_openFinish":"close"]()),g=0})}function o(e,n,t,o){var i=this,p=e.data(r.parent);if(p){p=p.closest("."+s.panel);var d=new Hammer(e[0],i.opts[a].vendors.hammer),f=null;d.on("panright",function(e){f||(i.openPanel(p),f=setTimeout(function(){clearTimeout(f),f=null},i.conf.openingInterval+i.conf.transitionDuration))})}}var i="mmenu",a="drag";e[i].addons[a]={setup:function(){if(this.opts.offCanvas){var n=this.opts[a],s=this.conf[a];d=e[i].glbl,"boolean"==typeof n&&(n={menu:n,panels:n}),"object"!=typeof n&&(n={}),"boolean"==typeof n.menu&&(n.menu={open:n.menu}),"object"!=typeof n.menu&&(n.menu={}),"boolean"==typeof n.panels&&(n.panels={close:n.panels}),"object"!=typeof n.panels&&(n.panels={}),n=this.opts[a]=e.extend(!0,{},e[i].defaults[a],n),n.menu.open&&this.bind("setPage:after",function(){t.call(this,n.menu,s.menu,d)}),n.panels.close&&this.bind("initPanel:after",function(e){o.call(this,e,n.panels,s.panels,d)})}},add:function(){return"function"!=typeof Hammer||Hammer.VERSION<2?(e[i].addons[a].add=function(){},void(e[i].addons[a].setup=function(){})):(s=e[i]._c,r=e[i]._d,p=e[i]._e,void s.add("dragging"))},clickAnchor:function(e,n){}},e[i].defaults[a]={menu:{open:!1,maxStartPos:100,threshold:50},panels:{close:!1},vendors:{hammer:{}}},e[i].configuration[a]={menu:{width:{perc:.8,min:140,max:440},height:{perc:.8,min:140,max:880}},panels:{}};var s,r,p,d}(jQuery); /* * jQuery mmenu dropdown add-on * mmenu.frebsite.nl */ !function(t){var o="mmenu",e="dropdown";t[o].addons[e]={setup:function(){if(this.opts.offCanvas){var r=this,f=this.opts[e],p=this.conf[e];if(a=t[o].glbl,"boolean"==typeof f&&f&&(f={drop:f}),"object"!=typeof f&&(f={}),"string"==typeof f.position&&(f.position={of:f.position}),f=this.opts[e]=t.extend(!0,{},t[o].defaults[e],f),f.drop){var l;this.bind("initMenu:after",function(){if(this.$menu.addClass(i.menu+"_"+e),"string"!=typeof f.position.of){var o=this._getOriginalMenuId();o&&o.length&&(f.position.of='[href="#'+o+'"]')}"string"==typeof f.position.of&&(l=t(f.position.of),f.event=f.event.split(" "),1==f.event.length&&(f.event[1]=f.event[0]),"hover"==f.event[0]&&l.on(s.mouseenter+"-"+e,function(){r.open()}),"hover"==f.event[1]&&this.$menu.on(s.mouseleave+"-"+e,function(){r.close()}))}),this.bind("open:start",function(){this.$menu.data(n.style,this.$menu.attr("style")||""),a.$html.addClass(i.wrapper+"_dropdown")}),this.bind("close:finish",function(){this.$menu.attr("style",this.$menu.data(n.style)),a.$html.removeClass(i.wrapper+"_dropdown")});var h=function(t,o){var e=o[0],n=o[1],s="x"==t?"scrollLeft":"scrollTop",r="x"==t?"outerWidth":"outerHeight",h="x"==t?"left":"top",u="x"==t?"right":"bottom",d="x"==t?"width":"height",c="x"==t?"maxWidth":"maxHeight",m=null,v=a.$wndw[s](),x=l.offset()[h]-=v,b=x+l[r](),w=a.$wndw[d](),g=p.offset.button[t]+p.offset.viewport[t];if(f.position[t])switch(f.position[t]){case"left":case"bottom":m="after";break;case"right":case"top":m="before"}null===m&&(m=x+(b-x)/2'),r=0,s=i.length;r')),l.append(o))}),l&&(this.bind("initMenu:after",function(){this.$menu.addClass(e.menu+"_iconbar-"+c.size).prepend(l)}),"tabs"==c.type)){l.addClass(e.iconbar+"_tabs");var f=l.find("a");f.on(o.click+"-"+n,function(t){var n=a(this);if(n.hasClass(e.iconbar+"__tab_selected"))return void t.stopImmediatePropagation();try{var i=a(n.attr("href"));i.hasClass(e.panel)&&(t.preventDefault(),t.stopImmediatePropagation(),d.__openPanelWoAnimation(i))}catch(o){}}),this.bind("openPanel:start",s)}}},add:function(){e=a[t]._c,i=a[t]._d,o=a[t]._e,e.add(n)},clickAnchor:function(a,t){}},a[t].defaults[n]={add:!1,size:40,top:[],bottom:[]},a[t].configuration[n]={};var e,i,o,r}(jQuery); /* * jQuery mmenu iconPanels add-on * mmenu.frebsite.nl */ !function(e){var i="mmenu",n="iconPanels";e[i].addons[n]={setup:function(){var a=this,l=this.opts[n],d=(this.conf[n],!1);if(s=e[i].glbl,"boolean"==typeof l&&(l={add:l}),"number"!=typeof l&&"string"!=typeof l||(l={add:!0,visible:l}),"object"!=typeof l&&(l={}),"first"==l.visible&&(d=!0,l.visible=1),l=this.opts[n]=e.extend(!0,{},e[i].defaults[n],l),l.visible=Math.min(3,Math.max(1,l.visible)),l.visible++,l.add){for(var r="",o=0;o<=l.visible;o++)r+=" "+t.panel+"_iconpanel-"+o;r.length&&(r=r.slice(1));var c=function(i){if(!i.parent("."+t.listitem+"_vertical").length){var n=a.$pnls.children("."+t.panel).removeClass(r);d&&n.removeClass(t.panel+"_iconpanel-first").first().addClass(t.panel+"_iconpanel-first"),n.filter("."+t.panel+"_opened-parent").removeClass(t.hidden).not(function(){return e(this).parent("."+t.listitem+"_vertical").length}).add(i).slice(-l.visible).each(function(i){e(this).addClass(t.panel+"_iconpanel-"+i)})}};this.bind("initMenu:after",function(){var e=[t.menu+"_iconpanel-"+l.size];l.hideNavbar&&e.push(t.menu+"_hidenavbar"),l.hideDivider&&e.push(t.menu+"_hidedivider"),this.$menu.addClass(e.join(" "))}),this.bind("openPanel:start",c),this.bind("initPanels:after",function(e){c.call(a,a.$pnls.children("."+t.panel+"_opened"))}),this.bind("initListview:after",function(e){!l.blockPanel||e.parent("."+t.listitem+"_vertical").length||e.children("."+t.panel+"__blocker").length||e.prepend('
    ')})}},add:function(){t=e[i]._c,a=e[i]._d,l=e[i]._e},clickAnchor:function(e,i){}},e[i].defaults[n]={add:!1,blockPanel:!0,hideDivider:!1,hideNavbar:!0,size:40,visible:3};var t,a,l,s}(jQuery); /* * jQuery mmenu keyboardNavigation add-on * mmenu.frebsite.nl */ !function(n){function e(e,t){e=e||this.$pnls.children("."+i.panel+"_opened");var a=n(),s=this.$menu.children("."+i.mm("navbars_top")+", ."+i.mm("navbars_bottom")).children("."+i.navbar);s.find(r).filter(":focus").length||("default"==t&&(a=e.children("."+i.listview).find("a[href]").not("."+i.hidden),a.length||(a=e.find(r).not("."+i.hidden)),a.length||(a=s.find(r).not("."+i.hidden))),a.length||(a=this.$menu.children("."+i.tabstart)),a.first().focus())}var t="mmenu",a="keyboardNavigation";n[t].addons[a]={setup:function(){if(!n[t].support.touch){var s=this.opts[a];this.conf[a];if(d=n[t].glbl,"boolean"!=typeof s&&"string"!=typeof s||(s={enable:s}),"object"!=typeof s&&(s={}),s=this.opts[a]=n.extend(!0,{},n[t].defaults[a],s),s.enable){var o=n('' + '
    ' + ' / ' + '
    ' + '' + '
    ' + '
    ' + '{{BUTTONS}}' + '
    ' + '
    ' + '
    ' + '
    ' + '
    ' + '
    ' + '
    ' + '
    ' + '
    ', // Loading indicator template spinnerTpl : '
    ', // Error message template errorTpl : '

    {{ERROR}}

    ', btnTpl : { slideShow : '', fullScreen : '', thumbs : '', close : '', // This small close button will be appended to your html/inline/ajax content by default, // if "smallBtn" option is not set to false smallBtn : '' }, // Container is injected into this element parentEl : 'body', // Focus handling // ============== // Try to focus on the first focusable element after opening autoFocus : true, // Put focus back to active element after closing backFocus : true, // Do not let user to focus on element outside modal content trapFocus : true, // Module specific options // ======================= fullScreen : { autoStart : false, }, touch : { vertical : true, // Allow to drag content vertically momentum : true // Continue movement after releasing mouse/touch when panning }, // Hash value when initializing manually, // set `false` to disable hash change hash : null, // Customize or add new media types // Example: /* media : { youtube : { params : { autoplay : 0 } } } */ media : {}, slideShow : { autoStart : false, speed : 4000 }, thumbs : { autoStart : false, // Display thumbnails on opening hideOnClose : true // Hide thumbnail grid when closing animation starts }, // Callbacks //========== // See Documentation/API/Events for more information // Example: /* afterShow: function( instance, current ) { console.info( 'Clicked element:' ); console.info( current.opts.$orig ); } */ onInit : $.noop, // When instance has been initialized beforeLoad : $.noop, // Before the content of a slide is being loaded afterLoad : $.noop, // When the content of a slide is done loading beforeShow : $.noop, // Before open animation starts afterShow : $.noop, // When content is done loading and animating beforeClose : $.noop, // Before the instance attempts to close. Return false to cancel the close. afterClose : $.noop, // After instance has been closed onActivate : $.noop, // When instance is brought to front onDeactivate : $.noop, // When other instance has been activated // Interaction // =========== // Use options below to customize taken action when user clicks or double clicks on the fancyBox area, // each option can be string or method that returns value. // // Possible values: // "close" - close instance // "next" - move to next gallery item // "nextOrClose" - move to next gallery item or close if gallery has only one item // "toggleControls" - show/hide controls // "zoom" - zoom image (if loaded) // false - do nothing // Clicked on the content clickContent : function( current, event ) { return current.type === 'image' ? 'zoom' : false; }, // Clicked on the slide clickSlide : 'close', // Clicked on the background (backdrop) element clickOutside : 'close', // Same as previous two, but for double click dblclickContent : false, dblclickSlide : false, dblclickOutside : false, // Custom options when mobile device is detected // ============================================= mobile : { clickContent : function( current, event ) { return current.type === 'image' ? 'toggleControls' : false; }, clickSlide : function( current, event ) { return current.type === 'image' ? 'toggleControls' : "close"; }, dblclickContent : function( current, event ) { return current.type === 'image' ? 'zoom' : false; }, dblclickSlide : function( current, event ) { return current.type === 'image' ? 'zoom' : false; } }, // Internationalization // ============ lang : 'en', i18n : { 'en' : { CLOSE : 'Close', NEXT : 'Next', PREV : 'Previous', ERROR : 'The requested content cannot be loaded.
    Please try again later.', PLAY_START : 'Start slideshow', PLAY_STOP : 'Pause slideshow', FULL_SCREEN : 'Full screen', THUMBS : 'Thumbnails' }, 'de' : { CLOSE : 'Schliessen', NEXT : 'Weiter', PREV : 'Zurück', ERROR : 'Die angeforderten Daten konnten nicht geladen werden.
    Bitte versuchen Sie es später nochmal.', PLAY_START : 'Diaschau starten', PLAY_STOP : 'Diaschau beenden', FULL_SCREEN : 'Vollbild', THUMBS : 'Vorschaubilder' } } }; // Few useful variables and methods // ================================ var $W = $(window); var $D = $(document); var called = 0; // Check if an object is a jQuery object and not a native JavaScript object // ======================================================================== var isQuery = function ( obj ) { return obj && obj.hasOwnProperty && obj instanceof $; }; // Handle multiple browsers for "requestAnimationFrame" and "cancelAnimationFrame" // =============================================================================== var requestAFrame = (function () { return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || // if all else fails, use setTimeout function (callback) { return window.setTimeout(callback, 1000 / 60); }; })(); // Detect the supported transition-end event property name // ======================================================= var transitionEnd = (function () { var t, el = document.createElement("fakeelement"); var transitions = { "transition" : "transitionend", "OTransition" : "oTransitionEnd", "MozTransition" : "transitionend", "WebkitTransition": "webkitTransitionEnd" }; for (t in transitions) { if (el.style[t] !== undefined){ return transitions[t]; } } })(); // Force redraw on an element. // This helps in cases where the browser doesn't redraw an updated element properly. // ================================================================================= var forceRedraw = function( $el ) { return ( $el && $el.length && $el[0].offsetHeight ); }; // Class definition // ================ var FancyBox = function( content, opts, index ) { var self = this; self.opts = $.extend( true, { index : index }, defaults, opts || {} ); // Exclude buttons option from deep merging if ( opts && $.isArray( opts.buttons ) ) { self.opts.buttons = opts.buttons; } self.id = self.opts.id || ++called; self.group = []; self.currIndex = parseInt( self.opts.index, 10 ) || 0; self.prevIndex = null; self.prevPos = null; self.currPos = 0; self.firstRun = null; // Create group elements from original item collection self.createGroup( content ); if ( !self.group.length ) { return; } // Save last active element and current scroll position self.$lastFocus = $(document.activeElement).blur(); // Collection of gallery objects self.slides = {}; self.init( content ); }; $.extend(FancyBox.prototype, { // Create DOM structure // ==================== init : function() { var self = this; var testWidth, $container, buttonStr; var firstItemOpts = self.group[ self.currIndex ].opts; self.scrollTop = $D.scrollTop(); self.scrollLeft = $D.scrollLeft(); // Hide scrollbars // =============== if ( !$.fancybox.getInstance() && !$.fancybox.isMobile && $( 'body' ).css('overflow') !== 'hidden' ) { testWidth = $( 'body' ).width(); $( 'html' ).addClass( 'fancybox-enabled' ); // Compare body width after applying "overflow: hidden" testWidth = $( 'body' ).width() - testWidth; // If width has changed - compensate missing scrollbars by adding right margin if ( testWidth > 1 ) { $( 'head' ).append( '' ); } } // Build html markup and set references // ==================================== // Build html code for buttons and insert into main template buttonStr = ''; $.each( firstItemOpts.buttons, function( index, value ) { buttonStr += ( firstItemOpts.btnTpl[ value ] || '' ); }); // Create markup from base template, it will be initially hidden to // avoid unnecessary work like painting while initializing is not complete $container = $( self.translate( self, firstItemOpts.baseTpl.replace( '\{\{BUTTONS\}\}', buttonStr ) ) ) .addClass( 'fancybox-is-hidden' ) .attr('id', 'fancybox-container-' + self.id) .addClass( firstItemOpts.baseClass ) .data( 'FancyBox', self ) .prependTo( firstItemOpts.parentEl ); // Create object holding references to jQuery wrapped nodes self.$refs = { container : $container }; [ 'bg', 'inner', 'infobar', 'toolbar', 'stage', 'caption' ].forEach(function(item) { self.$refs[ item ] = $container.find( '.fancybox-' + item ); }); // Check for redundant elements if ( !firstItemOpts.arrows || self.group.length < 2 ) { $container.find('.fancybox-navigation').remove(); } if ( !firstItemOpts.infobar ) { self.$refs.infobar.remove(); } if ( !firstItemOpts.toolbar ) { self.$refs.toolbar.remove(); } self.trigger( 'onInit' ); // Bring to front and enable events self.activate(); // Build slides, load and reveal content self.jumpTo( self.currIndex ); }, // Simple i18n support - replaces object keys found in template // with corresponding values // ============================================================ translate : function( obj, str ) { var arr = obj.opts.i18n[ obj.opts.lang ]; return str.replace(/\{\{(\w+)\}\}/g, function(match, n) { var value = arr[n]; if ( value === undefined ) { return match; } return value; }); }, // Create array of gally item objects // Check if each object has valid type and content // =============================================== createGroup : function ( content ) { var self = this; var items = $.makeArray( content ); $.each(items, function( i, item ) { var obj = {}, opts = {}, data = [], $item, type, src, srcParts; // Step 1 - Make sure we have an object // ==================================== if ( $.isPlainObject( item ) ) { // We probably have manual usage here, something like // $.fancybox.open( [ { src : "image.jpg", type : "image" } ] ) obj = item; opts = item.opts || item; } else if ( $.type( item ) === 'object' && $( item ).length ) { // Here we propbably have jQuery collection returned by some selector $item = $( item ); data = $item.data(); opts = 'options' in data ? data.options : {}; opts = $.type( opts ) === 'object' ? opts : {}; obj.src = 'src' in data ? data.src : ( opts.src || $item.attr( 'href' ) ); [ 'width', 'height', 'thumb', 'type', 'filter' ].forEach(function(item) { if ( item in data ) { opts[ item ] = data[ item ]; } }); if ( 'srcset' in data ) { opts.image = { srcset : data.srcset }; } opts.$orig = $item; if ( !obj.type && !obj.src ) { obj.type = 'inline'; obj.src = item; } } else { // Assume we have a simple html code, for example: // $.fancybox.open( '

    Hi!

    ' ); obj = { type : 'html', src : item + '' }; } // Each gallery object has full collection of options obj.opts = $.extend( true, {}, self.opts, opts ); if ( $.fancybox.isMobile ) { obj.opts = $.extend( true, {}, obj.opts, obj.opts.mobile ); } // Step 2 - Make sure we have content type, if not - try to guess // ============================================================== type = obj.type || obj.opts.type; src = obj.src || ''; if ( !type && src ) { if ( src.match(/(^data:image\/[a-z0-9+\/=]*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp|svg|ico)((\?|#).*)?$)/i) ) { type = 'image'; } else if ( src.match(/\.(pdf)((\?|#).*)?$/i) ) { type = 'pdf'; } else if ( src.charAt(0) === '#' ) { type = 'inline'; } } obj.type = type; // Step 3 - Some adjustments // ========================= obj.index = self.group.length; // Check if $orig and $thumb objects exist if ( obj.opts.$orig && !obj.opts.$orig.length ) { delete obj.opts.$orig; } if ( !obj.opts.$thumb && obj.opts.$orig ) { obj.opts.$thumb = obj.opts.$orig.find( 'img:first' ); } if ( obj.opts.$thumb && !obj.opts.$thumb.length ) { delete obj.opts.$thumb; } // Caption is a "special" option, it can be passed as a method if ( $.type( obj.opts.caption ) === 'function' ) { obj.opts.caption = obj.opts.caption.apply( item, [ self, obj ] ); } else if ( 'caption' in data ) { obj.opts.caption = data.caption; } // Make sure we have caption as a string obj.opts.caption = obj.opts.caption === undefined ? '' : obj.opts.caption + ''; // Check if url contains "filter" used to filter the content // Example: "ajax.html #something" if ( type === 'ajax' ) { srcParts = src.split(/\s+/, 2); if ( srcParts.length > 1 ) { obj.src = srcParts.shift(); obj.opts.filter = srcParts.shift(); } } if ( obj.opts.smallBtn == 'auto' ) { if ( $.inArray( type, ['html', 'inline', 'ajax'] ) > -1 ) { obj.opts.toolbar = false; obj.opts.smallBtn = true; } else { obj.opts.smallBtn = false; } } // If the type is "pdf", then simply load file into iframe if ( type === 'pdf' ) { obj.type = 'iframe'; obj.opts.iframe.preload = false; } // Hide all buttons and disable interactivity for modal items if ( obj.opts.modal ) { obj.opts = $.extend(true, obj.opts, { // Remove buttons infobar : 0, toolbar : 0, smallBtn : 0, // Disable keyboard navigation keyboard : 0, // Disable some modules slideShow : 0, fullScreen : 0, thumbs : 0, touch : 0, // Disable click event handlers clickContent : false, clickSlide : false, clickOutside : false, dblclickContent : false, dblclickSlide : false, dblclickOutside : false }); } // Step 4 - Add processed object to group // ====================================== self.group.push( obj ); }); }, // Attach an event handler functions for: // - navigation buttons // - browser scrolling, resizing; // - focusing // - keyboard // - detect idle // ====================================== addEvents : function() { var self = this; self.removeEvents(); // Make navigation elements clickable self.$refs.container.on('click.fb-close', '[data-fancybox-close]', function(e) { e.stopPropagation(); e.preventDefault(); self.close( e ); }).on( 'click.fb-prev touchend.fb-prev', '[data-fancybox-prev]', function(e) { e.stopPropagation(); e.preventDefault(); self.previous(); }).on( 'click.fb-next touchend.fb-next', '[data-fancybox-next]', function(e) { e.stopPropagation(); e.preventDefault(); self.next(); }); // Handle page scrolling and browser resizing $W.on('orientationchange.fb resize.fb', function(e) { if ( e && e.originalEvent && e.originalEvent.type === "resize" ) { requestAFrame(function() { self.update(); }); } else { self.$refs.stage.hide(); setTimeout(function() { self.$refs.stage.show(); self.update(); }, 500); } }); // Trap keyboard focus inside of the modal, so the user does not accidentally tab outside of the modal // (a.k.a. "escaping the modal") $D.on('focusin.fb', function(e) { var instance = $.fancybox ? $.fancybox.getInstance() : null; if ( instance.isClosing || !instance.current || !instance.current.opts.trapFocus || $( e.target ).hasClass( 'fancybox-container' ) || $( e.target ).is( document ) ) { return; } if ( instance && $( e.target ).css( 'position' ) !== 'fixed' && !instance.$refs.container.has( e.target ).length ) { e.stopPropagation(); instance.focus(); // Sometimes page gets scrolled, set it back $W.scrollTop( self.scrollTop ).scrollLeft( self.scrollLeft ); } }); // Enable keyboard navigation $D.on('keydown.fb', function (e) { var current = self.current, keycode = e.keyCode || e.which; if ( !current || !current.opts.keyboard ) { return; } if ( $(e.target).is('input') || $(e.target).is('textarea') ) { return; } // Backspace and Esc keys if ( keycode === 8 || keycode === 27 ) { e.preventDefault(); self.close( e ); return; } // Left arrow and Up arrow if ( keycode === 37 || keycode === 38 ) { e.preventDefault(); self.previous(); return; } // Righ arrow and Down arrow if ( keycode === 39 || keycode === 40 ) { e.preventDefault(); self.next(); return; } self.trigger('afterKeydown', e, keycode); }); // Hide controls after some inactivity period if ( self.group[ self.currIndex ].opts.idleTime ) { self.idleSecondsCounter = 0; $D.on('mousemove.fb-idle mouseenter.fb-idle mouseleave.fb-idle mousedown.fb-idle touchstart.fb-idle touchmove.fb-idle scroll.fb-idle keydown.fb-idle', function() { self.idleSecondsCounter = 0; if ( self.isIdle ) { self.showControls(); } self.isIdle = false; }); self.idleInterval = window.setInterval(function() { self.idleSecondsCounter++; if ( self.idleSecondsCounter >= self.group[ self.currIndex ].opts.idleTime ) { self.isIdle = true; self.idleSecondsCounter = 0; self.hideControls(); } }, 1000); } }, // Remove events added by the core // =============================== removeEvents : function () { var self = this; $W.off( 'orientationchange.fb resize.fb' ); $D.off( 'focusin.fb keydown.fb .fb-idle' ); this.$refs.container.off( '.fb-close .fb-prev .fb-next' ); if ( self.idleInterval ) { window.clearInterval( self.idleInterval ); self.idleInterval = null; } }, // Change to previous gallery item // =============================== previous : function( duration ) { return this.jumpTo( this.currPos - 1, duration ); }, // Change to next gallery item // =========================== next : function( duration ) { return this.jumpTo( this.currPos + 1, duration ); }, // Switch to selected gallery item // =============================== jumpTo : function ( pos, duration, slide ) { var self = this, firstRun, loop, current, previous, canvasWidth, currentPos, transitionProps; var groupLen = self.group.length; if ( self.isSliding || self.isClosing || ( self.isAnimating && self.firstRun ) ) { return; } pos = parseInt( pos, 10 ); loop = self.current ? self.current.opts.loop : self.opts.loop; if ( !loop && ( pos < 0 || pos >= groupLen ) ) { return false; } firstRun = self.firstRun = ( self.firstRun === null ); if ( groupLen < 2 && !firstRun && !!self.isSliding ) { return; } previous = self.current; self.prevIndex = self.currIndex; self.prevPos = self.currPos; // Create slides current = self.createSlide( pos ); if ( groupLen > 1 ) { if ( loop || current.index > 0 ) { self.createSlide( pos - 1 ); } if ( loop || current.index < groupLen - 1 ) { self.createSlide( pos + 1 ); } } self.current = current; self.currIndex = current.index; self.currPos = current.pos; self.trigger( 'beforeShow', firstRun ); self.updateControls(); currentPos = $.fancybox.getTranslate( current.$slide ); current.isMoved = ( currentPos.left !== 0 || currentPos.top !== 0 ) && !current.$slide.hasClass( 'fancybox-animated' ); current.forcedDuration = undefined; if ( $.isNumeric( duration ) ) { current.forcedDuration = duration; } else { duration = current.opts[ firstRun ? 'animationDuration' : 'transitionDuration' ]; } duration = parseInt( duration, 10 ); // Fresh start - reveal container, current slide and start loading content if ( firstRun ) { if ( current.opts.animationEffect && duration ) { self.$refs.container.css( 'transition-duration', duration + 'ms' ); } self.$refs.container.removeClass( 'fancybox-is-hidden' ); forceRedraw( self.$refs.container ); self.$refs.container.addClass( 'fancybox-is-open' ); // Make first slide visible (to display loading icon, if needed) current.$slide.addClass( 'fancybox-slide--current' ); self.loadSlide( current ); self.preload(); return; } // Clean up $.each(self.slides, function( index, slide ) { $.fancybox.stop( slide.$slide ); }); // Make current that slide is visible even if content is still loading current.$slide.removeClass( 'fancybox-slide--next fancybox-slide--previous' ).addClass( 'fancybox-slide--current' ); // If slides have been dragged, animate them to correct position if ( current.isMoved ) { canvasWidth = Math.round( current.$slide.width() ); $.each(self.slides, function( index, slide ) { var pos = slide.pos - current.pos; $.fancybox.animate( slide.$slide, { top : 0, left : ( pos * canvasWidth ) + ( pos * slide.opts.gutter ) }, duration, function() { slide.$slide.removeAttr('style').removeClass( 'fancybox-slide--next fancybox-slide--previous' ); if ( slide.pos === self.currPos ) { current.isMoved = false; self.complete(); } }); }); } else { self.$refs.stage.children().removeAttr( 'style' ); } // Start transition that reveals current content // or wait when it will be loaded if ( current.isLoaded ) { self.revealContent( current ); } else { self.loadSlide( current ); } self.preload(); if ( previous.pos === current.pos ) { return; } // Handle previous slide // ===================== transitionProps = 'fancybox-slide--' + ( previous.pos > current.pos ? 'next' : 'previous' ); previous.$slide.removeClass( 'fancybox-slide--complete fancybox-slide--current fancybox-slide--next fancybox-slide--previous' ); previous.isComplete = false; if ( !duration || ( !current.isMoved && !current.opts.transitionEffect ) ) { return; } if ( current.isMoved ) { previous.$slide.addClass( transitionProps ); } else { transitionProps = 'fancybox-animated ' + transitionProps + ' fancybox-fx-' + current.opts.transitionEffect; $.fancybox.animate( previous.$slide, transitionProps, duration, function() { previous.$slide.removeClass( transitionProps ).removeAttr( 'style' ); }); } }, // Create new "slide" element // These are gallery items that are actually added to DOM // ======================================================= createSlide : function( pos ) { var self = this; var $slide; var index; index = pos % self.group.length; index = index < 0 ? self.group.length + index : index; if ( !self.slides[ pos ] && self.group[ index ] ) { $slide = $('
    ').appendTo( self.$refs.stage ); self.slides[ pos ] = $.extend( true, {}, self.group[ index ], { pos : pos, $slide : $slide, isLoaded : false, }); self.updateSlide( self.slides[ pos ] ); } return self.slides[ pos ]; }, // Scale image to the actual size of the image // =========================================== scaleToActual : function( x, y, duration ) { var self = this; var current = self.current; var $what = current.$content; var imgPos, posX, posY, scaleX, scaleY; var canvasWidth = parseInt( current.$slide.width(), 10 ); var canvasHeight = parseInt( current.$slide.height(), 10 ); var newImgWidth = current.width; var newImgHeight = current.height; if ( !( current.type == 'image' && !current.hasError) || !$what || self.isAnimating) { return; } $.fancybox.stop( $what ); self.isAnimating = true; x = x === undefined ? canvasWidth * 0.5 : x; y = y === undefined ? canvasHeight * 0.5 : y; imgPos = $.fancybox.getTranslate( $what ); scaleX = newImgWidth / imgPos.width; scaleY = newImgHeight / imgPos.height; // Get center position for original image posX = ( canvasWidth * 0.5 - newImgWidth * 0.5 ); posY = ( canvasHeight * 0.5 - newImgHeight * 0.5 ); // Make sure image does not move away from edges if ( newImgWidth > canvasWidth ) { posX = imgPos.left * scaleX - ( ( x * scaleX ) - x ); if ( posX > 0 ) { posX = 0; } if ( posX < canvasWidth - newImgWidth ) { posX = canvasWidth - newImgWidth; } } if ( newImgHeight > canvasHeight) { posY = imgPos.top * scaleY - ( ( y * scaleY ) - y ); if ( posY > 0 ) { posY = 0; } if ( posY < canvasHeight - newImgHeight ) { posY = canvasHeight - newImgHeight; } } self.updateCursor( newImgWidth, newImgHeight ); $.fancybox.animate( $what, { top : posY, left : posX, scaleX : scaleX, scaleY : scaleY }, duration || 330, function() { self.isAnimating = false; }); // Stop slideshow if ( self.SlideShow && self.SlideShow.isActive ) { self.SlideShow.stop(); } }, // Scale image to fit inside parent element // ======================================== scaleToFit : function( duration ) { var self = this; var current = self.current; var $what = current.$content; var end; if ( !( current.type == 'image' && !current.hasError) || !$what || self.isAnimating ) { return; } $.fancybox.stop( $what ); self.isAnimating = true; end = self.getFitPos( current ); self.updateCursor( end.width, end.height ); $.fancybox.animate( $what, { top : end.top, left : end.left, scaleX : end.width / $what.width(), scaleY : end.height / $what.height() }, duration || 330, function() { self.isAnimating = false; }); }, // Calculate image size to fit inside viewport // =========================================== getFitPos : function( slide ) { var self = this; var $what = slide.$content; var imgWidth = slide.width; var imgHeight = slide.height; var margin = slide.opts.margin; var canvasWidth, canvasHeight, minRatio, width, height; if ( !$what || !$what.length || ( !imgWidth && !imgHeight) ) { return false; } // Convert "margin to CSS style: [ top, right, bottom, left ] if ( $.type( margin ) === "number" ) { margin = [ margin, margin ]; } if ( margin.length == 2 ) { margin = [ margin[0], margin[1], margin[0], margin[1] ]; } if ( $W.width() < 800 ) { margin = [ 0, 0, 0, 0 ]; } // We can not use $slide width here, because it can have different diemensions while in transiton canvasWidth = parseInt( self.$refs.stage.width(), 10 ) - ( margin[ 1 ] + margin[ 3 ] ); canvasHeight = parseInt( self.$refs.stage.height(), 10 ) - ( margin[ 0 ] + margin[ 2 ] ); minRatio = Math.min(1, canvasWidth / imgWidth, canvasHeight / imgHeight ); width = Math.floor( minRatio * imgWidth ); height = Math.floor( minRatio * imgHeight ); // Use floor rounding to make sure it really fits return { top : Math.floor( ( canvasHeight - height ) * 0.5 ) + margin[ 0 ], left : Math.floor( ( canvasWidth - width ) * 0.5 ) + margin[ 3 ], width : width, height : height }; }, // Update position and content of all slides // ========================================= update : function() { var self = this; $.each( self.slides, function( key, slide ) { self.updateSlide( slide ); }); }, // Update slide position and scale content to fit // ============================================== updateSlide : function( slide ) { var self = this; var $what = slide.$content; if ( $what && ( slide.width || slide.height ) ) { $.fancybox.stop( $what ); $.fancybox.setTranslate( $what, self.getFitPos( slide ) ); if ( slide.pos === self.currPos ) { self.updateCursor(); } } slide.$slide.trigger( 'refresh' ); self.trigger( 'onUpdate', slide ); }, // Update cursor style depending if content can be zoomed // ====================================================== updateCursor : function( nextWidth, nextHeight ) { var self = this; var isScaledDown; var $container = self.$refs.container.removeClass('fancybox-is-zoomable fancybox-can-zoomIn fancybox-can-drag fancybox-can-zoomOut'); if ( !self.current || self.isClosing ) { return; } if ( self.isZoomable() ) { $container.addClass( 'fancybox-is-zoomable' ); if ( nextWidth !== undefined && nextHeight !== undefined ) { isScaledDown = nextWidth < self.current.width && nextHeight < self.current.height; } else { isScaledDown = self.isScaledDown(); } if ( isScaledDown ) { // If image is scaled down, then, obviously, it can be zoomed to full size $container.addClass('fancybox-can-zoomIn'); } else { if ( self.current.opts.touch ) { // If image size ir largen than available available and touch module is not disable, // then user can do panning $container.addClass('fancybox-can-drag'); } else { $container.addClass('fancybox-can-zoomOut'); } } } else if ( self.current.opts.touch ) { $container.addClass('fancybox-can-drag'); } }, // Check if current slide is zoomable // ================================== isZoomable : function() { var self = this; var current = self.current; var fitPos; if ( !current || self.isClosing ) { return; } // Assume that slide is zoomable if // - image is loaded successfuly // - click action is "zoom" // - actual size of the image is smaller than available area if ( current.type === 'image' && current.isLoaded && !current.hasError && ( current.opts.clickContent === 'zoom' || ( $.isFunction( current.opts.clickContent ) && current.opts.clickContent( current ) === "zoom" ) ) ) { fitPos = self.getFitPos( current ); if ( current.width > fitPos.width || current.height > fitPos.height ) { return true; } } return false; }, // Check if current image dimensions are smaller than actual // ========================================================= isScaledDown : function() { var self = this; var current = self.current; var $what = current.$content; var rez = false; if ( $what ) { rez = $.fancybox.getTranslate( $what ); rez = rez.width < current.width || rez.height < current.height; } return rez; }, // Check if image dimensions exceed parent element // =============================================== canPan : function() { var self = this; var current = self.current; var $what = current.$content; var rez = false; if ( $what ) { rez = self.getFitPos( current ); rez = Math.abs( $what.width() - rez.width ) > 1 || Math.abs( $what.height() - rez.height ) > 1; } return rez; }, // Load content into the slide // =========================== loadSlide : function( slide ) { var self = this, type, $slide; var ajaxLoad; if ( slide.isLoading ) { return; } if ( slide.isLoaded ) { return; } slide.isLoading = true; self.trigger( 'beforeLoad', slide ); type = slide.type; $slide = slide.$slide; $slide .off( 'refresh' ) .trigger( 'onReset' ) .addClass( 'fancybox-slide--' + ( type || 'unknown' ) ) .addClass( slide.opts.slideClass ); // Create content depending on the type switch ( type ) { case 'image': self.setImage( slide ); break; case 'iframe': self.setIframe( slide ); break; case 'html': self.setContent( slide, slide.src || slide.content ); break; case 'inline': if ( $( slide.src ).length ) { self.setContent( slide, $( slide.src ) ); } else { self.setError( slide ); } break; case 'ajax': self.showLoading( slide ); ajaxLoad = $.ajax( $.extend( {}, slide.opts.ajax.settings, { url : slide.src, success : function ( data, textStatus ) { if ( textStatus === 'success' ) { self.setContent( slide, data ); } }, error : function ( jqXHR, textStatus ) { if ( jqXHR && textStatus !== 'abort' ) { self.setError( slide ); } } })); $slide.one( 'onReset', function () { ajaxLoad.abort(); }); break; default: self.setError( slide ); break; } return true; }, // Use thumbnail image, if possible // ================================ setImage : function( slide ) { var self = this; var srcset = slide.opts.image.srcset; var found, temp, pxRatio, windowWidth; // If we have "srcset", then we need to find matching "src" value. // This is necessary, because when you set an src attribute, the browser will preload the image // before any javascript or even CSS is applied. if ( srcset ) { pxRatio = window.devicePixelRatio || 1; windowWidth = window.innerWidth * pxRatio; temp = srcset.split(',').map(function ( el ) { var ret = {}; el.trim().split(/\s+/).forEach(function ( el, i ) { var value = parseInt( el.substring(0, el.length - 1), 10 ); if ( i === 0 ) { return ( ret.url = el ); } if ( value ) { ret.value = value; ret.postfix = el[ el.length - 1 ]; } }); return ret; }); // Sort by value temp.sort(function (a, b) { return a.value - b.value; }); // Ok, now we have an array of all srcset values for ( var j = 0; j < temp.length; j++ ) { var el = temp[ j ]; if ( ( el.postfix === 'w' && el.value >= windowWidth ) || ( el.postfix === 'x' && el.value >= pxRatio ) ) { found = el; break; } } // If not found, take the last one if ( !found && temp.length ) { found = temp[ temp.length - 1 ]; } if ( found ) { slide.src = found.url; // If we have default width/height values, we can calculate height for matching source if ( slide.width && slide.height && found.postfix == 'w' ) { slide.height = ( slide.width / slide.height ) * found.value; slide.width = found.value; } } } // This will be wrapper containing both ghost and actual image slide.$content = $('
    ') .addClass( 'fancybox-is-hidden' ) .appendTo( slide.$slide ); // If we have a thumbnail, we can display it while actual image is loading // Users will not stare at black screen and actual image will appear gradually if ( slide.opts.preload !== false && slide.opts.width && slide.opts.height && ( slide.opts.thumb || slide.opts.$thumb ) ) { slide.width = slide.opts.width; slide.height = slide.opts.height; slide.$ghost = $('') .one('error', function() { $(this).remove(); slide.$ghost = null; self.setBigImage( slide ); }) .one('load', function() { self.afterLoad( slide ); self.setBigImage( slide ); }) .addClass( 'fancybox-image' ) .appendTo( slide.$content ) .attr( 'src', slide.opts.thumb || slide.opts.$thumb.attr( 'src' ) ); } else { self.setBigImage( slide ); } }, // Create full-size image // ====================== setBigImage : function ( slide ) { var self = this; var $img = $(''); slide.$image = $img .one('error', function() { self.setError( slide ); }) .one('load', function() { // Clear timeout that checks if loading icon needs to be displayed clearTimeout( slide.timouts ); slide.timouts = null; if ( self.isClosing ) { return; } slide.width = this.naturalWidth; slide.height = this.naturalHeight; if ( slide.opts.image.srcset ) { $img.attr( 'sizes', '100vw' ).attr( 'srcset', slide.opts.image.srcset ); } self.hideLoading( slide ); if ( slide.$ghost ) { slide.timouts = setTimeout(function() { slide.timouts = null; slide.$ghost.hide(); }, Math.min( 300, Math.max( 1000, slide.height / 1600 ) ) ); } else { self.afterLoad( slide ); } }) .addClass( 'fancybox-image' ) .attr('src', slide.src) .appendTo( slide.$content ); if ( $img[0].complete ) { $img.trigger( 'load' ); } else if( $img[0].error ) { $img.trigger( 'error' ); } else { slide.timouts = setTimeout(function() { if ( !$img[0].complete && !slide.hasError ) { self.showLoading( slide ); } }, 100); } }, // Create iframe wrapper, iframe and bindings // ========================================== setIframe : function( slide ) { var self = this, opts = slide.opts.iframe, $slide = slide.$slide, $iframe; slide.$content = $('
    ') .css( opts.css ) .appendTo( $slide ); $iframe = $( opts.tpl.replace(/\{rnd\}/g, new Date().getTime()) ) .attr( opts.attr ) .appendTo( slide.$content ); if ( opts.preload ) { self.showLoading( slide ); // Unfortunately, it is not always possible to determine if iframe is successfully loaded // (due to browser security policy) $iframe.on('load.fb error.fb', function(e) { this.isReady = 1; slide.$slide.trigger( 'refresh' ); self.afterLoad( slide ); }); // Recalculate iframe content size // =============================== $slide.on('refresh.fb', function() { var $wrap = slide.$content, $contents, $body, scrollWidth, frameWidth, frameHeight; if ( $iframe[0].isReady !== 1 ) { return; } // Check if content is accessible, // it will fail if frame is not with the same origin try { $contents = $iframe.contents(); $body = $contents.find('body'); } catch (ignore) {} // Calculate dimensions for the wrapper if ( $body && $body.length && !( opts.css.width !== undefined && opts.css.height !== undefined ) ) { scrollWidth = $iframe[0].contentWindow.document.documentElement.scrollWidth; frameWidth = Math.ceil( $body.outerWidth(true) + ( $wrap.width() - scrollWidth ) ); frameHeight = Math.ceil( $body.outerHeight(true) ); // Resize wrapper to fit iframe content $wrap.css({ 'width' : opts.css.width === undefined ? frameWidth + ( $wrap.outerWidth() - $wrap.innerWidth() ) : opts.css.width, 'height' : opts.css.height === undefined ? frameHeight + ( $wrap.outerHeight() - $wrap.innerHeight() ) : opts.css.height }); } $wrap.removeClass( 'fancybox-is-hidden' ); }); } else { this.afterLoad( slide ); } $iframe.attr( 'src', slide.src ); if ( slide.opts.smallBtn === true ) { slide.$content.prepend( self.translate( slide, slide.opts.btnTpl.smallBtn ) ); } // Remove iframe if closing or changing gallery item $slide.one( 'onReset', function () { // This helps IE not to throw errors when closing try { $( this ).find( 'iframe' ).hide().attr( 'src', '//about:blank' ); } catch ( ignore ) {} $( this ).empty(); slide.isLoaded = false; }); }, // Wrap and append content to the slide // ====================================== setContent : function ( slide, content ) { var self = this; if ( self.isClosing ) { return; } self.hideLoading( slide ); slide.$slide.empty(); if ( isQuery( content ) && content.parent().length ) { // If content is a jQuery object, then it will be moved to the slide. // The placeholder is created so we will know where to put it back. // If user is navigating gallery fast, then the content might be already inside fancyBox // ===================================================================================== // Make sure content is not already moved to fancyBox content.parent( '.fancybox-slide--inline' ).trigger( 'onReset' ); // Create temporary element marking original place of the content slide.$placeholder = $( '
    ' ).hide().insertAfter( content ); // Make sure content is visible content.css('display', 'inline-block'); } else if ( !slide.hasError ) { // If content is just a plain text, try to convert it to html if ( $.type( content ) === 'string' ) { content = $('
    ').append( $.trim( content ) ).contents(); // If we have text node, then add wrapping element to make vertical alignment work if ( content[0].nodeType === 3 ) { content = $('
    ').html( content ); } } // If "filter" option is provided, then filter content if ( slide.opts.filter ) { content = $('
    ').html( content ).find( slide.opts.filter ); } } slide.$slide.one('onReset', function () { // Put content back if ( slide.$placeholder ) { slide.$placeholder.after( content.hide() ).remove(); slide.$placeholder = null; } // Remove custom close button if ( slide.$smallBtn ) { slide.$smallBtn.remove(); slide.$smallBtn = null; } // Remove content and mark slide as not loaded if ( !slide.hasError ) { $(this).empty(); slide.isLoaded = false; } }); slide.$content = $( content ).appendTo( slide.$slide ); if ( slide.opts.smallBtn && !slide.$smallBtn ) { slide.$smallBtn = $( self.translate( slide, slide.opts.btnTpl.smallBtn ) ).appendTo( slide.$content ); } this.afterLoad( slide ); }, // Display error message // ===================== setError : function ( slide ) { slide.hasError = true; slide.$slide.removeClass( 'fancybox-slide--' + slide.type ); this.setContent( slide, this.translate( slide, slide.opts.errorTpl ) ); }, // Show loading icon inside the slide // ================================== showLoading : function( slide ) { var self = this; slide = slide || self.current; if ( slide && !slide.$spinner ) { slide.$spinner = $( self.opts.spinnerTpl ).appendTo( slide.$slide ); } }, // Remove loading icon from the slide // ================================== hideLoading : function( slide ) { var self = this; slide = slide || self.current; if ( slide && slide.$spinner ) { slide.$spinner.remove(); delete slide.$spinner; } }, // Adjustments after slide content has been loaded // =============================================== afterLoad : function( slide ) { var self = this; if ( self.isClosing ) { return; } slide.isLoading = false; slide.isLoaded = true; self.trigger( 'afterLoad', slide ); self.hideLoading( slide ); if ( slide.opts.protect && slide.$content && !slide.hasError ) { // Disable right click slide.$content.on( 'contextmenu.fb', function( e ) { if ( e.button == 2 ) { e.preventDefault(); } return true; }); // Add fake element on top of the image // This makes a bit harder for user to select image if ( slide.type === 'image' ) { $( '
    ' ).appendTo( slide.$content ); } } self.revealContent( slide ); }, // Make content visible // This method is called right after content has been loaded or // user navigates gallery and transition should start // ============================================================ revealContent : function( slide ) { var self = this; var $slide = slide.$slide; var effect, effectClassName, duration, opacity, end, start = false; effect = slide.opts[ self.firstRun ? 'animationEffect' : 'transitionEffect' ]; duration = slide.opts[ self.firstRun ? 'animationDuration' : 'transitionDuration' ]; duration = parseInt( slide.forcedDuration === undefined ? duration : slide.forcedDuration, 10 ); if ( slide.isMoved || slide.pos !== self.currPos || !duration ) { effect = false; } // Check if can zoom if ( effect === 'zoom' && !( slide.pos === self.currPos && duration && slide.type === 'image' && !slide.hasError && ( start = self.getThumbPos( slide ) ) ) ) { effect = 'fade'; } // Zoom animation // ============== if ( effect === 'zoom' ) { end = self.getFitPos( slide ); end.scaleX = Math.round( (end.width / start.width) * 100 ) / 100; end.scaleY = Math.round( (end.height / start.height) * 100 ) / 100; delete end.width; delete end.height; // Check if we need to animate opacity opacity = slide.opts.zoomOpacity; if ( opacity == 'auto' ) { opacity = Math.abs( slide.width / slide.height - start.width / start.height ) > 0.1; } if ( opacity ) { start.opacity = 0.1; end.opacity = 1; } // Draw image at start position $.fancybox.setTranslate( slide.$content.removeClass( 'fancybox-is-hidden' ), start ); forceRedraw( slide.$content ); // Start animation $.fancybox.animate( slide.$content, end, duration, function() { self.complete(); }); return; } self.updateSlide( slide ); // Simply show content // =================== if ( !effect ) { forceRedraw( $slide ); slide.$content.removeClass( 'fancybox-is-hidden' ); if ( slide.pos === self.currPos ) { self.complete(); } return; } $.fancybox.stop( $slide ); effectClassName = 'fancybox-animated fancybox-slide--' + ( slide.pos > self.prevPos ? 'next' : 'previous' ) + ' fancybox-fx-' + effect; $slide.removeAttr( 'style' ).removeClass( 'fancybox-slide--current fancybox-slide--next fancybox-slide--previous' ).addClass( effectClassName ); slide.$content.removeClass( 'fancybox-is-hidden' ); //Force reflow for CSS3 transitions forceRedraw( $slide ); $.fancybox.animate( $slide, 'fancybox-slide--current', duration, function(e) { $slide.removeClass( effectClassName ).removeAttr( 'style' ); if ( slide.pos === self.currPos ) { self.complete(); } }, true); }, // Check if we can and have to zoom from thumbnail //================================================ getThumbPos : function( slide ) { var self = this; var rez = false; // Check if element is inside the viewport by at least 1 pixel var isElementVisible = function( $el ) { var element = $el[0]; var elementRect = element.getBoundingClientRect(); var parentRects = []; var visibleInAllParents; while ( element.parentElement !== null ) { if ( $(element.parentElement).css('overflow') === 'hidden' || $(element.parentElement).css('overflow') === 'auto' ) { parentRects.push(element.parentElement.getBoundingClientRect()); } element = element.parentElement; } visibleInAllParents = parentRects.every(function(parentRect){ var visiblePixelX = Math.min(elementRect.right, parentRect.right) - Math.max(elementRect.left, parentRect.left); var visiblePixelY = Math.min(elementRect.bottom, parentRect.bottom) - Math.max(elementRect.top, parentRect.top); return visiblePixelX > 0 && visiblePixelY > 0; }); return visibleInAllParents && elementRect.bottom > 0 && elementRect.right > 0 && elementRect.left < $(window).width() && elementRect.top < $(window).height(); }; var $thumb = slide.opts.$thumb; var thumbPos = $thumb ? $thumb.offset() : 0; var slidePos; if ( thumbPos && $thumb[0].ownerDocument === document && isElementVisible( $thumb ) ) { slidePos = self.$refs.stage.offset(); rez = { top : thumbPos.top - slidePos.top + parseFloat( $thumb.css( "border-top-width" ) || 0 ), left : thumbPos.left - slidePos.left + parseFloat( $thumb.css( "border-left-width" ) || 0 ), width : $thumb.width(), height : $thumb.height(), scaleX : 1, scaleY : 1 }; } return rez; }, // Final adjustments after current gallery item is moved to position // and it`s content is loaded // ================================================================== complete : function() { var self = this; var current = self.current; var slides = {}; if ( current.isMoved || !current.isLoaded || current.isComplete ) { return; } current.isComplete = true; current.$slide.siblings().trigger( 'onReset' ); // Trigger any CSS3 transiton inside the slide forceRedraw( current.$slide ); current.$slide.addClass( 'fancybox-slide--complete' ); // Remove unnecessary slides $.each( self.slides, function( key, slide ) { if ( slide.pos >= self.currPos - 1 && slide.pos <= self.currPos + 1 ) { slides[ slide.pos ] = slide; } else if ( slide ) { $.fancybox.stop( slide.$slide ); slide.$slide.unbind().remove(); } }); self.slides = slides; self.updateCursor(); self.trigger( 'afterShow' ); // Try to focus on the first focusable element if ( $( document.activeElement ).is( '[disabled]' ) || ( current.opts.autoFocus && !( current.type == 'image' || current.type === 'iframe' ) ) ) { self.focus(); } }, // Preload next and previous slides // ================================ preload : function() { var self = this; var next, prev; if ( self.group.length < 2 ) { return; } next = self.slides[ self.currPos + 1 ]; prev = self.slides[ self.currPos - 1 ]; if ( next && next.type === 'image' ) { self.loadSlide( next ); } if ( prev && prev.type === 'image' ) { self.loadSlide( prev ); } }, // Try to find and focus on the first focusable element // ==================================================== focus : function() { var current = this.current; var $el; if ( this.isClosing ) { return; } // Skip for images and iframes $el = current && current.isComplete ? current.$slide.find('button,:input,[tabindex],a').filter(':not([disabled]):visible:first') : null; $el = $el && $el.length ? $el : this.$refs.container; $el.focus(); }, // Activates current instance - brings container to the front and enables keyboard, // notifies other instances about deactivating // ================================================================================= activate : function () { var self = this; // Deactivate all instances $( '.fancybox-container' ).each(function () { var instance = $(this).data( 'FancyBox' ); // Skip self and closing instances if (instance && instance.uid !== self.uid && !instance.isClosing) { instance.trigger( 'onDeactivate' ); } }); if ( self.current ) { if ( self.$refs.container.index() > 0 ) { self.$refs.container.prependTo( document.body ); } self.updateControls(); } self.trigger( 'onActivate' ); self.addEvents(); }, // Start closing procedure // This will start "zoom-out" animation if needed and clean everything up afterwards // ================================================================================= close : function( e, d ) { var self = this; var current = self.current; var effect, duration; var $what, opacity, start, end; var done = function() { self.cleanUp( e ); }; if ( self.isClosing ) { return false; } self.isClosing = true; // If beforeClose callback prevents closing, make sure content is centered if ( self.trigger( 'beforeClose', e ) === false ) { self.isClosing = false; requestAFrame(function() { self.update(); }); return false; } // Remove all events // If there are multiple instances, they will be set again by "activate" method self.removeEvents(); if ( current.timouts ) { clearTimeout( current.timouts ); } $what = current.$content; effect = current.opts.animationEffect; duration = $.isNumeric( d ) ? d : ( effect ? current.opts.animationDuration : 0 ); // Remove other slides current.$slide.off( transitionEnd ).removeClass( 'fancybox-slide--complete fancybox-slide--next fancybox-slide--previous fancybox-animated' ); current.$slide.siblings().trigger( 'onReset' ).remove(); // Trigger animations if ( duration ) { self.$refs.container.removeClass( 'fancybox-is-open' ).addClass( 'fancybox-is-closing' ); } // Clean up self.hideLoading( current ); self.hideControls(); self.updateCursor(); // Check if possible to zoom-out if ( effect === 'zoom' && !( e !== true && $what && duration && current.type === 'image' && !current.hasError && ( end = self.getThumbPos( current ) ) ) ) { effect = 'fade'; } if ( effect === 'zoom' ) { $.fancybox.stop( $what ); start = $.fancybox.getTranslate( $what ); start.width = start.width * start.scaleX; start.height = start.height * start.scaleY; // Check if we need to animate opacity opacity = current.opts.zoomOpacity; if ( opacity == 'auto' ) { opacity = Math.abs( current.width / current.height - end.width / end.height ) > 0.1; } if ( opacity ) { end.opacity = 0; } start.scaleX = start.width / end.width; start.scaleY = start.height / end.height; start.width = end.width; start.height = end.height; $.fancybox.setTranslate( current.$content, start ); $.fancybox.animate( current.$content, end, duration, done ); return true; } if ( effect && duration ) { // If skip animation if ( e === true ) { setTimeout( done, duration ); } else { $.fancybox.animate( current.$slide.removeClass( 'fancybox-slide--current' ), 'fancybox-animated fancybox-slide--previous fancybox-fx-' + effect, duration, done ); } } else { done(); } return true; }, // Final adjustments after removing the instance // ============================================= cleanUp : function( e ) { var self = this, instance; self.current.$slide.trigger( 'onReset' ); self.$refs.container.empty().remove(); self.trigger( 'afterClose', e ); // Place back focus if ( self.$lastFocus && !!self.current.opts.backFocus ) { self.$lastFocus.focus(); } self.current = null; // Check if there are other instances instance = $.fancybox.getInstance(); if ( instance ) { instance.activate(); } else { $W.scrollTop( self.scrollTop ).scrollLeft( self.scrollLeft ); $( 'html' ).removeClass( 'fancybox-enabled' ); $( '#fancybox-style-noscroll' ).remove(); } }, // Call callback and trigger an event // ================================== trigger : function( name, slide ) { var args = Array.prototype.slice.call(arguments, 1), self = this, obj = slide && slide.opts ? slide : self.current, rez; if ( obj ) { args.unshift( obj ); } else { obj = self; } args.unshift( self ); if ( $.isFunction( obj.opts[ name ] ) ) { rez = obj.opts[ name ].apply( obj, args ); } if ( rez === false ) { return rez; } if ( name === 'afterClose' ) { $D.trigger( name + '.fb', args ); } else { self.$refs.container.trigger( name + '.fb', args ); } }, // Update infobar values, navigation button states and reveal caption // ================================================================== updateControls : function ( force ) { var self = this; var current = self.current; var index = current.index; var opts = current.opts; var caption = opts.caption; var $caption = self.$refs.caption; // Recalculate content dimensions current.$slide.trigger( 'refresh' ); self.$caption = caption && caption.length ? $caption.html( caption ) : null; if ( !self.isHiddenControls ) { self.showControls(); } // Update info and navigation elements $('[data-fancybox-count]').html( self.group.length ); $('[data-fancybox-index]').html( index + 1 ); $('[data-fancybox-prev]').prop('disabled', ( !opts.loop && index <= 0 ) ); $('[data-fancybox-next]').prop('disabled', ( !opts.loop && index >= self.group.length - 1 ) ); }, // Hide toolbar and caption // ======================== hideControls : function () { this.isHiddenControls = true; this.$refs.container.removeClass('fancybox-show-infobar fancybox-show-toolbar fancybox-show-caption fancybox-show-nav'); }, showControls : function() { var self = this; var opts = self.current ? self.current.opts : self.opts; var $container = self.$refs.container; self.isHiddenControls = false; self.idleSecondsCounter = 0; $container .toggleClass('fancybox-show-toolbar', !!( opts.toolbar && opts.buttons ) ) .toggleClass('fancybox-show-infobar', !!( opts.infobar && self.group.length > 1 ) ) .toggleClass('fancybox-show-nav', !!( opts.arrows && self.group.length > 1 ) ) .toggleClass('fancybox-is-modal', !!opts.modal ); if ( self.$caption ) { $container.addClass( 'fancybox-show-caption '); } else { $container.removeClass( 'fancybox-show-caption' ); } }, // Toggle toolbar and caption // ========================== toggleControls : function() { if ( this.isHiddenControls ) { this.showControls(); } else { this.hideControls(); } }, }); $.fancybox = { version : "{fancybox-version}", defaults : defaults, // Get current instance and execute a command. // // Examples of usage: // // $instance = $.fancybox.getInstance(); // $.fancybox.getInstance().jumpTo( 1 ); // $.fancybox.getInstance( 'jumpTo', 1 ); // $.fancybox.getInstance( function() { // console.info( this.currIndex ); // }); // ====================================================== getInstance : function ( command ) { var instance = $('.fancybox-container:not(".fancybox-is-closing"):first').data( 'FancyBox' ); var args = Array.prototype.slice.call(arguments, 1); if ( instance instanceof FancyBox ) { if ( $.type( command ) === 'string' ) { instance[ command ].apply( instance, args ); } else if ( $.type( command ) === 'function' ) { command.apply( instance, args ); } return instance; } return false; }, // Create new instance // =================== open : function ( items, opts, index ) { return new FancyBox( items, opts, index ); }, // Close current or all instances // ============================== close : function ( all ) { var instance = this.getInstance(); if ( instance ) { instance.close(); // Try to find and close next instance if ( all === true ) { this.close(); } } }, // Close instances and unbind all events // ============================== destroy : function() { this.close( true ); $D.off( 'click.fb-start' ); }, // Try to detect mobile devices // ============================ isMobile : document.createTouch !== undefined && /Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent), // Detect if 'translate3d' support is available // ============================================ use3d : (function() { var div = document.createElement('div'); return window.getComputedStyle && window.getComputedStyle( div ).getPropertyValue('transform') && !(document.documentMode && document.documentMode < 11); }()), // Helper function to get current visual state of an element // returns array[ top, left, horizontal-scale, vertical-scale, opacity ] // ===================================================================== getTranslate : function( $el ) { var matrix; if ( !$el || !$el.length ) { return false; } matrix = $el.eq( 0 ).css('transform'); if ( matrix && matrix.indexOf( 'matrix' ) !== -1 ) { matrix = matrix.split('(')[1]; matrix = matrix.split(')')[0]; matrix = matrix.split(','); } else { matrix = []; } if ( matrix.length ) { // If IE if ( matrix.length > 10 ) { matrix = [ matrix[13], matrix[12], matrix[0], matrix[5] ]; } else { matrix = [ matrix[5], matrix[4], matrix[0], matrix[3]]; } matrix = matrix.map(parseFloat); } else { matrix = [ 0, 0, 1, 1 ]; var transRegex = /\.*translate\((.*)px,(.*)px\)/i; var transRez = transRegex.exec( $el.eq( 0 ).attr('style') ); if ( transRez ) { matrix[ 0 ] = parseFloat( transRez[2] ); matrix[ 1 ] = parseFloat( transRez[1] ); } } return { top : matrix[ 0 ], left : matrix[ 1 ], scaleX : matrix[ 2 ], scaleY : matrix[ 3 ], opacity : parseFloat( $el.css('opacity') ), width : $el.width(), height : $el.height() }; }, // Shortcut for setting "translate3d" properties for element // Can set be used to set opacity, too // ======================================================== setTranslate : function( $el, props ) { var str = ''; var css = {}; if ( !$el || !props ) { return; } if ( props.left !== undefined || props.top !== undefined ) { str = ( props.left === undefined ? $el.position().left : props.left ) + 'px, ' + ( props.top === undefined ? $el.position().top : props.top ) + 'px'; if ( this.use3d ) { str = 'translate3d(' + str + ', 0px)'; } else { str = 'translate(' + str + ')'; } } if ( props.scaleX !== undefined && props.scaleY !== undefined ) { str = (str.length ? str + ' ' : '') + 'scale(' + props.scaleX + ', ' + props.scaleY + ')'; } if ( str.length ) { css.transform = str; } if ( props.opacity !== undefined ) { css.opacity = props.opacity; } if ( props.width !== undefined ) { css.width = props.width; } if ( props.height !== undefined ) { css.height = props.height; } return $el.css( css ); }, // Simple CSS transition handler // ============================= animate : function ( $el, to, duration, callback, leaveAnimationName ) { var event = transitionEnd || 'transitionend'; if ( $.isFunction( duration ) ) { callback = duration; duration = null; } if ( !$.isPlainObject( to ) ) { $el.removeAttr('style'); } $el.on( event, function(e) { // Skip events from child elements and z-index change if ( e && e.originalEvent && ( !$el.is( e.originalEvent.target ) || e.originalEvent.propertyName == 'z-index' ) ) { return; } $el.off( event ); if ( $.isPlainObject( to ) ) { if ( to.scaleX !== undefined && to.scaleY !== undefined ) { $el.css( 'transition-duration', '0ms' ); to.width = $el.width() * to.scaleX; to.height = $el.height() * to.scaleY; to.scaleX = 1; to.scaleY = 1; $.fancybox.setTranslate( $el, to ); } } else if ( leaveAnimationName !== true ) { $el.removeClass( to ); } if ( $.isFunction( callback ) ) { callback( e ); } }); if ( $.isNumeric( duration ) ) { $el.css( 'transition-duration', duration + 'ms' ); } if ( $.isPlainObject( to ) ) { $.fancybox.setTranslate( $el, to ); } else { $el.addClass( to ); } $el.data("timer", setTimeout(function() { $el.trigger( 'transitionend' ); }, duration + 16)); }, stop : function( $el ) { clearTimeout( $el.data("timer") ); $el.off( transitionEnd ); } }; // Default click handler for "fancyboxed" links // ============================================ function _run( e ) { var target = e.currentTarget, opts = e.data ? e.data.options : {}, items = opts.selector ? $( opts.selector ) : ( e.data ? e.data.items : [] ), value = $(target).attr( 'data-fancybox' ) || '', index = 0, active = $.fancybox.getInstance(); e.preventDefault(); e.stopPropagation(); // Avoid opening multiple times if ( active && active.current.opts.$orig.is( target ) ) { return; } // Get all related items and find index for clicked one if ( value ) { items = items.length ? items.filter( '[data-fancybox="' + value + '"]' ) : $( '[data-fancybox="' + value + '"]' ); index = items.index( target ); // Sometimes current item can not be found // (for example, when slider clones items) if ( index < 0 ) { index = 0; } } else { items = [ target ]; } $.fancybox.open( items, opts, index ); } // Create a jQuery plugin // ====================== $.fn.fancybox = function (options) { var selector; options = options || {}; selector = options.selector || false; if ( selector ) { $( 'body' ).off( 'click.fb-start', selector ).on( 'click.fb-start', selector, { options : options }, _run ); } else { this.off( 'click.fb-start' ).on( 'click.fb-start', { items : this, options : options }, _run); } return this; }; // Self initializing plugin // ======================== $D.on( 'click.fb-start', '[data-fancybox]', _run ); }( window, document, window.jQuery )); // ========================================================================== // // FullScreen // Adds fullscreen functionality // // ========================================================================== ;(function (document, $) { 'use strict'; // Collection of methods supported by user browser var fn = (function () { var fnMap = [ [ 'requestFullscreen', 'exitFullscreen', 'fullscreenElement', 'fullscreenEnabled', 'fullscreenchange', 'fullscreenerror' ], // new WebKit [ 'webkitRequestFullscreen', 'webkitExitFullscreen', 'webkitFullscreenElement', 'webkitFullscreenEnabled', 'webkitfullscreenchange', 'webkitfullscreenerror' ], // old WebKit (Safari 5.1) [ 'webkitRequestFullScreen', 'webkitCancelFullScreen', 'webkitCurrentFullScreenElement', 'webkitCancelFullScreen', 'webkitfullscreenchange', 'webkitfullscreenerror' ], [ 'mozRequestFullScreen', 'mozCancelFullScreen', 'mozFullScreenElement', 'mozFullScreenEnabled', 'mozfullscreenchange', 'mozfullscreenerror' ], [ 'msRequestFullscreen', 'msExitFullscreen', 'msFullscreenElement', 'msFullscreenEnabled', 'MSFullscreenChange', 'MSFullscreenError' ] ]; var val; var ret = {}; var i, j; for ( i = 0; i < fnMap.length; i++ ) { val = fnMap[ i ]; if ( val && val[ 1 ] in document ) { for ( j = 0; j < val.length; j++ ) { ret[ fnMap[ 0 ][ j ] ] = val[ j ]; } return ret; } } return false; })(); // If browser does not have Full Screen API, then simply unset default button template and stop if ( !fn ) { $.fancybox.defaults.btnTpl.fullScreen = false; return; } var FullScreen = { request : function ( elem ) { elem = elem || document.documentElement; elem[ fn.requestFullscreen ]( elem.ALLOW_KEYBOARD_INPUT ); }, exit : function () { document[ fn.exitFullscreen ](); }, toggle : function ( elem ) { elem = elem || document.documentElement; if ( this.isFullscreen() ) { this.exit(); } else { this.request( elem ); } }, isFullscreen : function() { return Boolean( document[ fn.fullscreenElement ] ); }, enabled : function() { return Boolean( document[ fn.fullscreenEnabled ] ); } }; $(document).on({ 'onInit.fb' : function(e, instance) { var $container; var $button = instance.$refs.toolbar.find('[data-fancybox-fullscreen]'); if ( instance && !instance.FullScreen && instance.group[ instance.currIndex ].opts.fullScreen ) { $container = instance.$refs.container; $container.on('click.fb-fullscreen', '[data-fancybox-fullscreen]', function(e) { e.stopPropagation(); e.preventDefault(); FullScreen.toggle( $container[ 0 ] ); }); if ( instance.opts.fullScreen && instance.opts.fullScreen.autoStart === true ) { FullScreen.request( $container[ 0 ] ); } // Expose API instance.FullScreen = FullScreen; } else { $button.hide(); } }, 'afterKeydown.fb' : function(e, instance, current, keypress, keycode) { // "P" or Spacebar if ( instance && instance.FullScreen && keycode === 70 ) { keypress.preventDefault(); instance.FullScreen.toggle( instance.$refs.container[ 0 ] ); } }, 'beforeClose.fb' : function( instance ) { if ( instance && instance.FullScreen ) { FullScreen.exit(); } } }); $(document).on(fn.fullscreenchange, function() { var instance = $.fancybox.getInstance(); // If image is zooming, then force to stop and reposition properly if ( instance.current && instance.current.type === 'image' && instance.isAnimating ) { instance.current.$content.css( 'transition', 'none' ); instance.isAnimating = false; instance.update( true, true, 0 ); } }); }(document, window.jQuery)); // ========================================================================== // // Guestures // Adds touch guestures, handles click and tap events // // ========================================================================== ;(function (window, document, $) { 'use strict'; var requestAFrame = (function () { return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || // if all else fails, use setTimeout function (callback) { return window.setTimeout(callback, 1000 / 60); }; })(); var cancelAFrame = (function () { return window.cancelAnimationFrame || window.webkitCancelAnimationFrame || window.mozCancelAnimationFrame || window.oCancelAnimationFrame || function (id) { window.clearTimeout(id); }; })(); var pointers = function( e ) { var result = []; e = e.originalEvent || e || window.e; e = e.touches && e.touches.length ? e.touches : ( e.changedTouches && e.changedTouches.length ? e.changedTouches : [ e ] ); for ( var key in e ) { if ( e[ key ].pageX ) { result.push( { x : e[ key ].pageX, y : e[ key ].pageY } ); } else if ( e[ key ].clientX ) { result.push( { x : e[ key ].clientX, y : e[ key ].clientY } ); } } return result; }; var distance = function( point2, point1, what ) { if ( !point1 || !point2 ) { return 0; } if ( what === 'x' ) { return point2.x - point1.x; } else if ( what === 'y' ) { return point2.y - point1.y; } return Math.sqrt( Math.pow( point2.x - point1.x, 2 ) + Math.pow( point2.y - point1.y, 2 ) ); }; var isClickable = function( $el ) { if ( $el.is('a,button,input,select,textarea') || $.isFunction( $el.get(0).onclick ) ) { return true; } // Check for attributes like data-fancybox-next or data-fancybox-close for ( var i = 0, atts = $el[0].attributes, n = atts.length; i < n; i++ ) { if ( atts[i].nodeName.substr(0, 14) === 'data-fancybox-' ) { return true; } } return false; }; var hasScrollbars = function( el ) { var overflowY = window.getComputedStyle( el )['overflow-y']; var overflowX = window.getComputedStyle( el )['overflow-x']; var vertical = (overflowY === 'scroll' || overflowY === 'auto') && el.scrollHeight > el.clientHeight; var horizontal = (overflowX === 'scroll' || overflowX === 'auto') && el.scrollWidth > el.clientWidth; return vertical || horizontal; }; var isScrollable = function ( $el ) { var rez = false; while ( true ) { rez = hasScrollbars( $el.get(0) ); if ( rez ) { break; } $el = $el.parent(); if ( !$el.length || $el.hasClass( 'fancybox-stage' ) || $el.is( 'body' ) ) { break; } } return rez; }; var Guestures = function ( instance ) { var self = this; self.instance = instance; self.$bg = instance.$refs.bg; self.$stage = instance.$refs.stage; self.$container = instance.$refs.container; self.destroy(); self.$container.on( 'touchstart.fb.touch mousedown.fb.touch', $.proxy(self, 'ontouchstart') ); }; Guestures.prototype.destroy = function() { this.$container.off( '.fb.touch' ); }; Guestures.prototype.ontouchstart = function( e ) { var self = this; var $target = $( e.target ); var instance = self.instance; var current = instance.current; var $content = current.$content; var isTouchDevice = ( e.type == 'touchstart' ); // Do not respond to both events if ( isTouchDevice ) { self.$container.off( 'mousedown.fb.touch' ); } // Ignore clicks while zooming or closing if ( !current || self.instance.isAnimating || self.instance.isClosing ) { e.stopPropagation(); e.preventDefault(); return; } // Ignore right click if ( e.originalEvent && e.originalEvent.button == 2 ) { return; } // Ignore taping on links, buttons, input elements if ( !$target.length || isClickable( $target ) || isClickable( $target.parent() ) ) { return; } // Ignore clicks on the scrollbar if ( e.originalEvent.clientX > $target[0].clientWidth + $target.offset().left ) { return; } self.startPoints = pointers( e ); // Prevent zooming if already swiping if ( !self.startPoints || ( self.startPoints.length > 1 && instance.isSliding ) ) { return; } self.$target = $target; self.$content = $content; self.canTap = true; $(document).off( '.fb.touch' ); $(document).on( isTouchDevice ? 'touchend.fb.touch touchcancel.fb.touch' : 'mouseup.fb.touch mouseleave.fb.touch', $.proxy(self, "ontouchend")); $(document).on( isTouchDevice ? 'touchmove.fb.touch' : 'mousemove.fb.touch', $.proxy(self, "ontouchmove")); e.stopPropagation(); if ( !(instance.current.opts.touch || instance.canPan() ) || !( $target.is( self.$stage ) || self.$stage.find( $target ).length ) ) { // Prevent ghosting if ( $target.is('img') ) { e.preventDefault(); } return; } if ( !( $.fancybox.isMobile && ( isScrollable( self.$target ) || isScrollable( self.$target.parent() ) ) ) ) { e.preventDefault(); } self.canvasWidth = Math.round( current.$slide[0].clientWidth ); self.canvasHeight = Math.round( current.$slide[0].clientHeight ); self.startTime = new Date().getTime(); self.distanceX = self.distanceY = self.distance = 0; self.isPanning = false; self.isSwiping = false; self.isZooming = false; self.sliderStartPos = self.sliderLastPos || { top: 0, left: 0 }; self.contentStartPos = $.fancybox.getTranslate( self.$content ); self.contentLastPos = null; if ( self.startPoints.length === 1 && !self.isZooming ) { self.canTap = !instance.isSliding; if ( current.type === 'image' && ( self.contentStartPos.width > self.canvasWidth + 1 || self.contentStartPos.height > self.canvasHeight + 1 ) ) { $.fancybox.stop( self.$content ); self.$content.css( 'transition-duration', '0ms' ); self.isPanning = true; } else { self.isSwiping = true; } self.$container.addClass('fancybox-controls--isGrabbing'); } if ( self.startPoints.length === 2 && !instance.isAnimating && !current.hasError && current.type === 'image' && ( current.isLoaded || current.$ghost ) ) { self.isZooming = true; self.isSwiping = false; self.isPanning = false; $.fancybox.stop( self.$content ); self.$content.css( 'transition-duration', '0ms' ); self.centerPointStartX = ( ( self.startPoints[0].x + self.startPoints[1].x ) * 0.5 ) - $(window).scrollLeft(); self.centerPointStartY = ( ( self.startPoints[0].y + self.startPoints[1].y ) * 0.5 ) - $(window).scrollTop(); self.percentageOfImageAtPinchPointX = ( self.centerPointStartX - self.contentStartPos.left ) / self.contentStartPos.width; self.percentageOfImageAtPinchPointY = ( self.centerPointStartY - self.contentStartPos.top ) / self.contentStartPos.height; self.startDistanceBetweenFingers = distance( self.startPoints[0], self.startPoints[1] ); } }; Guestures.prototype.ontouchmove = function( e ) { var self = this; self.newPoints = pointers( e ); if ( $.fancybox.isMobile && ( isScrollable( self.$target ) || isScrollable( self.$target.parent() ) ) ) { e.stopPropagation(); self.canTap = false; return; } if ( !( self.instance.current.opts.touch || self.instance.canPan() ) || !self.newPoints || !self.newPoints.length ) { return; } self.distanceX = distance( self.newPoints[0], self.startPoints[0], 'x' ); self.distanceY = distance( self.newPoints[0], self.startPoints[0], 'y' ); self.distance = distance( self.newPoints[0], self.startPoints[0] ); // Skip false ontouchmove events (Chrome) if ( self.distance > 0 ) { if ( !( self.$target.is( self.$stage ) || self.$stage.find( self.$target ).length ) ) { return; } e.stopPropagation(); e.preventDefault(); if ( self.isSwiping ) { self.onSwipe(); } else if ( self.isPanning ) { self.onPan(); } else if ( self.isZooming ) { self.onZoom(); } } }; Guestures.prototype.onSwipe = function() { var self = this; var swiping = self.isSwiping; var left = self.sliderStartPos.left || 0; var angle; if ( swiping === true ) { if ( Math.abs( self.distance ) > 10 ) { self.canTap = false; if ( self.instance.group.length < 2 && self.instance.opts.touch.vertical ) { self.isSwiping = 'y'; } else if ( self.instance.isSliding || self.instance.opts.touch.vertical === false || ( self.instance.opts.touch.vertical === 'auto' && $( window ).width() > 800 ) ) { self.isSwiping = 'x'; } else { angle = Math.abs( Math.atan2( self.distanceY, self.distanceX ) * 180 / Math.PI ); self.isSwiping = ( angle > 45 && angle < 135 ) ? 'y' : 'x'; } self.instance.isSliding = self.isSwiping; // Reset points to avoid jumping, because we dropped first swipes to calculate the angle self.startPoints = self.newPoints; $.each(self.instance.slides, function( index, slide ) { $.fancybox.stop( slide.$slide ); slide.$slide.css( 'transition-duration', '0ms' ); slide.inTransition = false; if ( slide.pos === self.instance.current.pos ) { self.sliderStartPos.left = $.fancybox.getTranslate( slide.$slide ).left; } }); //self.instance.current.isMoved = true; // Stop slideshow if ( self.instance.SlideShow && self.instance.SlideShow.isActive ) { self.instance.SlideShow.stop(); } } } else { if ( swiping == 'x' ) { // Sticky edges if ( self.distanceX > 0 && ( self.instance.group.length < 2 || ( self.instance.current.index === 0 && !self.instance.current.opts.loop ) ) ) { left = left + Math.pow( self.distanceX, 0.8 ); } else if ( self.distanceX < 0 && ( self.instance.group.length < 2 || ( self.instance.current.index === self.instance.group.length - 1 && !self.instance.current.opts.loop ) ) ) { left = left - Math.pow( -self.distanceX, 0.8 ); } else { left = left + self.distanceX; } } self.sliderLastPos = { top : swiping == 'x' ? 0 : self.sliderStartPos.top + self.distanceY, left : left }; if ( self.requestId ) { cancelAFrame( self.requestId ); self.requestId = null; } self.requestId = requestAFrame(function() { if ( self.sliderLastPos ) { $.each(self.instance.slides, function( index, slide ) { var pos = slide.pos - self.instance.currPos; $.fancybox.setTranslate( slide.$slide, { top : self.sliderLastPos.top, left : self.sliderLastPos.left + ( pos * self.canvasWidth ) + ( pos * slide.opts.gutter ) }); }); self.$container.addClass( 'fancybox-is-sliding' ); } }); } }; Guestures.prototype.onPan = function() { var self = this; var newOffsetX, newOffsetY, newPos; self.canTap = false; if ( self.contentStartPos.width > self.canvasWidth ) { newOffsetX = self.contentStartPos.left + self.distanceX; } else { newOffsetX = self.contentStartPos.left; } newOffsetY = self.contentStartPos.top + self.distanceY; newPos = self.limitMovement( newOffsetX, newOffsetY, self.contentStartPos.width, self.contentStartPos.height ); newPos.scaleX = self.contentStartPos.scaleX; newPos.scaleY = self.contentStartPos.scaleY; self.contentLastPos = newPos; if ( self.requestId ) { cancelAFrame( self.requestId ); self.requestId = null; } self.requestId = requestAFrame(function() { $.fancybox.setTranslate( self.$content, self.contentLastPos ); }); }; // Make panning sticky to the edges Guestures.prototype.limitMovement = function( newOffsetX, newOffsetY, newWidth, newHeight ) { var self = this; var minTranslateX, minTranslateY, maxTranslateX, maxTranslateY; var canvasWidth = self.canvasWidth; var canvasHeight = self.canvasHeight; var currentOffsetX = self.contentStartPos.left; var currentOffsetY = self.contentStartPos.top; var distanceX = self.distanceX; var distanceY = self.distanceY; // Slow down proportionally to traveled distance minTranslateX = Math.max(0, canvasWidth * 0.5 - newWidth * 0.5 ); minTranslateY = Math.max(0, canvasHeight * 0.5 - newHeight * 0.5 ); maxTranslateX = Math.min( canvasWidth - newWidth, canvasWidth * 0.5 - newWidth * 0.5 ); maxTranslateY = Math.min( canvasHeight - newHeight, canvasHeight * 0.5 - newHeight * 0.5 ); if ( newWidth > canvasWidth ) { // -> if ( distanceX > 0 && newOffsetX > minTranslateX ) { newOffsetX = minTranslateX - 1 + Math.pow( -minTranslateX + currentOffsetX + distanceX, 0.8 ) || 0; } // <- if ( distanceX < 0 && newOffsetX < maxTranslateX ) { newOffsetX = maxTranslateX + 1 - Math.pow( maxTranslateX - currentOffsetX - distanceX, 0.8 ) || 0; } } if ( newHeight > canvasHeight ) { // \/ if ( distanceY > 0 && newOffsetY > minTranslateY ) { newOffsetY = minTranslateY - 1 + Math.pow(-minTranslateY + currentOffsetY + distanceY, 0.8 ) || 0; } // /\ if ( distanceY < 0 && newOffsetY < maxTranslateY ) { newOffsetY = maxTranslateY + 1 - Math.pow ( maxTranslateY - currentOffsetY - distanceY, 0.8 ) || 0; } } return { top : newOffsetY, left : newOffsetX }; }; Guestures.prototype.limitPosition = function( newOffsetX, newOffsetY, newWidth, newHeight ) { var self = this; var canvasWidth = self.canvasWidth; var canvasHeight = self.canvasHeight; if ( newWidth > canvasWidth ) { newOffsetX = newOffsetX > 0 ? 0 : newOffsetX; newOffsetX = newOffsetX < canvasWidth - newWidth ? canvasWidth - newWidth : newOffsetX; } else { // Center horizontally newOffsetX = Math.max( 0, canvasWidth / 2 - newWidth / 2 ); } if ( newHeight > canvasHeight ) { newOffsetY = newOffsetY > 0 ? 0 : newOffsetY; newOffsetY = newOffsetY < canvasHeight - newHeight ? canvasHeight - newHeight : newOffsetY; } else { // Center vertically newOffsetY = Math.max( 0, canvasHeight / 2 - newHeight / 2 ); } return { top : newOffsetY, left : newOffsetX }; }; Guestures.prototype.onZoom = function() { var self = this; // Calculate current distance between points to get pinch ratio and new width and height var currentWidth = self.contentStartPos.width; var currentHeight = self.contentStartPos.height; var currentOffsetX = self.contentStartPos.left; var currentOffsetY = self.contentStartPos.top; var endDistanceBetweenFingers = distance( self.newPoints[0], self.newPoints[1] ); var pinchRatio = endDistanceBetweenFingers / self.startDistanceBetweenFingers; var newWidth = Math.floor( currentWidth * pinchRatio ); var newHeight = Math.floor( currentHeight * pinchRatio ); // This is the translation due to pinch-zooming var translateFromZoomingX = (currentWidth - newWidth) * self.percentageOfImageAtPinchPointX; var translateFromZoomingY = (currentHeight - newHeight) * self.percentageOfImageAtPinchPointY; //Point between the two touches var centerPointEndX = ((self.newPoints[0].x + self.newPoints[1].x) / 2) - $(window).scrollLeft(); var centerPointEndY = ((self.newPoints[0].y + self.newPoints[1].y) / 2) - $(window).scrollTop(); // And this is the translation due to translation of the centerpoint // between the two fingers var translateFromTranslatingX = centerPointEndX - self.centerPointStartX; var translateFromTranslatingY = centerPointEndY - self.centerPointStartY; // The new offset is the old/current one plus the total translation var newOffsetX = currentOffsetX + ( translateFromZoomingX + translateFromTranslatingX ); var newOffsetY = currentOffsetY + ( translateFromZoomingY + translateFromTranslatingY ); var newPos = { top : newOffsetY, left : newOffsetX, scaleX : self.contentStartPos.scaleX * pinchRatio, scaleY : self.contentStartPos.scaleY * pinchRatio }; self.canTap = false; self.newWidth = newWidth; self.newHeight = newHeight; self.contentLastPos = newPos; if ( self.requestId ) { cancelAFrame( self.requestId ); self.requestId = null; } self.requestId = requestAFrame(function() { $.fancybox.setTranslate( self.$content, self.contentLastPos ); }); }; Guestures.prototype.ontouchend = function( e ) { var self = this; var dMs = Math.max( (new Date().getTime() ) - self.startTime, 1); var swiping = self.isSwiping; var panning = self.isPanning; var zooming = self.isZooming; self.endPoints = pointers( e ); self.$container.removeClass( 'fancybox-controls--isGrabbing' ); $(document).off( '.fb.touch' ); if ( self.requestId ) { cancelAFrame( self.requestId ); self.requestId = null; } self.isSwiping = false; self.isPanning = false; self.isZooming = false; if ( self.canTap ) { return self.onTap( e ); } self.speed = 366; // Speed in px/ms self.velocityX = self.distanceX / dMs * 0.5; self.velocityY = self.distanceY / dMs * 0.5; self.speedX = Math.max( self.speed * 0.5, Math.min( self.speed * 1.5, ( 1 / Math.abs( self.velocityX ) ) * self.speed ) ); if ( panning ) { self.endPanning(); } else if ( zooming ) { self.endZooming(); } else { self.endSwiping( swiping ); } return; }; Guestures.prototype.endSwiping = function( swiping ) { var self = this; var ret = false; self.instance.isSliding = false; self.sliderLastPos = null; // Close if swiped vertically / navigate if horizontally if ( swiping == 'y' && Math.abs( self.distanceY ) > 50 ) { // Continue vertical movement $.fancybox.animate( self.instance.current.$slide, { top : self.sliderStartPos.top + self.distanceY + ( self.velocityY * 150 ), opacity : 0 }, 150 ); ret = self.instance.close( true, 300 ); } else if ( swiping == 'x' && self.distanceX > 50 && self.instance.group.length > 1 ) { ret = self.instance.previous( self.speedX ); } else if ( swiping == 'x' && self.distanceX < -50 && self.instance.group.length > 1 ) { ret = self.instance.next( self.speedX ); } if ( ret === false && ( swiping == 'x' || swiping == 'y' ) ) { self.instance.jumpTo( self.instance.current.index, 150 ); } self.$container.removeClass( 'fancybox-is-sliding' ); }; // Limit panning from edges // ======================== Guestures.prototype.endPanning = function() { var self = this; var newOffsetX, newOffsetY, newPos; if ( !self.contentLastPos ) { return; } if ( self.instance.current.opts.touch.momentum === false ) { newOffsetX = self.contentLastPos.left; newOffsetY = self.contentLastPos.top; } else { // Continue movement newOffsetX = self.contentLastPos.left + ( self.velocityX * self.speed ); newOffsetY = self.contentLastPos.top + ( self.velocityY * self.speed ); } newPos = self.limitPosition( newOffsetX, newOffsetY, self.contentStartPos.width, self.contentStartPos.height ); newPos.width = self.contentStartPos.width; newPos.height = self.contentStartPos.height; $.fancybox.animate( self.$content, newPos, 330 ); }; Guestures.prototype.endZooming = function() { var self = this; var current = self.instance.current; var newOffsetX, newOffsetY, newPos, reset; var newWidth = self.newWidth; var newHeight = self.newHeight; if ( !self.contentLastPos ) { return; } newOffsetX = self.contentLastPos.left; newOffsetY = self.contentLastPos.top; reset = { top : newOffsetY, left : newOffsetX, width : newWidth, height : newHeight, scaleX : 1, scaleY : 1 }; // Reset scalex/scaleY values; this helps for perfomance and does not break animation $.fancybox.setTranslate( self.$content, reset ); if ( newWidth < self.canvasWidth && newHeight < self.canvasHeight ) { self.instance.scaleToFit( 150 ); } else if ( newWidth > current.width || newHeight > current.height ) { self.instance.scaleToActual( self.centerPointStartX, self.centerPointStartY, 150 ); } else { newPos = self.limitPosition( newOffsetX, newOffsetY, newWidth, newHeight ); // Switch from scale() to width/height or animation will not work correctly $.fancybox.setTranslate( self.content, $.fancybox.getTranslate( self.$content ) ); $.fancybox.animate( self.$content, newPos, 150 ); } }; Guestures.prototype.onTap = function(e) { var self = this; var $target = $( e.target ); var instance = self.instance; var current = instance.current; var endPoints = ( e && pointers( e ) ) || self.startPoints; var tapX = endPoints[0] ? endPoints[0].x - self.$stage.offset().left : 0; var tapY = endPoints[0] ? endPoints[0].y - self.$stage.offset().top : 0; var where; var process = function ( prefix ) { var action = current.opts[ prefix ]; if ( $.isFunction( action ) ) { action = action.apply( instance, [ current, e ] ); } if ( !action) { return; } switch ( action ) { case "close" : instance.close( self.startEvent ); break; case "toggleControls" : instance.toggleControls( true ); break; case "next" : instance.next(); break; case "nextOrClose" : if ( instance.group.length > 1 ) { instance.next(); } else { instance.close( self.startEvent ); } break; case "zoom" : if ( current.type == 'image' && ( current.isLoaded || current.$ghost ) ) { if ( instance.canPan() ) { instance.scaleToFit(); } else if ( instance.isScaledDown() ) { instance.scaleToActual( tapX, tapY ); } else if ( instance.group.length < 2 ) { instance.close( self.startEvent ); } } break; } }; // Ignore right click if ( e.originalEvent && e.originalEvent.button == 2 ) { return; } // Skip if current slide is not in the center if ( instance.isSliding ) { return; } // Skip if clicked on the scrollbar if ( tapX > $target[0].clientWidth + $target.offset().left ) { return; } // Check where is clicked if ( $target.is( '.fancybox-bg,.fancybox-inner,.fancybox-outer,.fancybox-container' ) ) { where = 'Outside'; } else if ( $target.is( '.fancybox-slide' ) ) { where = 'Slide'; } else if ( instance.current.$content && instance.current.$content.has( e.target ).length ) { where = 'Content'; } else { return; } // Check if this is a double tap if ( self.tapped ) { // Stop previously created single tap clearTimeout( self.tapped ); self.tapped = null; // Skip if distance between taps is too big if ( Math.abs( tapX - self.tapX ) > 50 || Math.abs( tapY - self.tapY ) > 50 || instance.isSliding ) { return this; } // OK, now we assume that this is a double-tap process( 'dblclick' + where ); } else { // Single tap will be processed if user has not clicked second time within 300ms // or there is no need to wait for double-tap self.tapX = tapX; self.tapY = tapY; if ( current.opts[ 'dblclick' + where ] && current.opts[ 'dblclick' + where ] !== current.opts[ 'click' + where ] ) { self.tapped = setTimeout(function() { self.tapped = null; process( 'click' + where ); }, 300); } else { process( 'click' + where ); } } return this; }; $(document).on('onActivate.fb', function (e, instance) { if ( instance && !instance.Guestures ) { instance.Guestures = new Guestures( instance ); } }); $(document).on('beforeClose.fb', function (e, instance) { if ( instance && instance.Guestures ) { instance.Guestures.destroy(); } }); }(window, document, window.jQuery)); // ========================================================================== // // Hash // Enables linking to each modal // // ========================================================================== ;(function (document, window, $) { 'use strict'; // Simple $.escapeSelector polyfill (for jQuery prior v3) if ( !$.escapeSelector ) { $.escapeSelector = function( sel ) { var rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g; var fcssescape = function( ch, asCodePoint ) { if ( asCodePoint ) { // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER if ( ch === "\0" ) { return "\uFFFD"; } // Control characters and (dependent upon position) numbers get escaped as code points return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " "; } // Other potentially-special ASCII characters get backslash-escaped return "\\" + ch; }; return ( sel + "" ).replace( rcssescape, fcssescape ); }; } // Variable containing last hash value set by fancyBox // It will be used to determine if fancyBox needs to close after hash change is detected var currentHash = null; // Throtlling the history change var timerID = null; // Get info about gallery name and current index from url function parseUrl() { var hash = window.location.hash.substr( 1 ); var rez = hash.split( '-' ); var index = rez.length > 1 && /^\+?\d+$/.test( rez[ rez.length - 1 ] ) ? parseInt( rez.pop( -1 ), 10 ) || 1 : 1; var gallery = rez.join( '-' ); // Index is starting from 1 if ( index < 1 ) { index = 1; } return { hash : hash, index : index, gallery : gallery }; } // Trigger click evnt on links to open new fancyBox instance function triggerFromUrl( url ) { var $el; if ( url.gallery !== '' ) { // If we can find element matching 'data-fancybox' atribute, then trigger click event for that .. $el = $( "[data-fancybox='" + $.escapeSelector( url.gallery ) + "']" ).eq( url.index - 1 ); if ( $el.length ) { $el.trigger( 'click' ); } else { // .. if not, try finding element by ID $( "#" + $.escapeSelector( url.gallery ) + "" ).trigger( 'click' ); } } } // Get gallery name from current instance function getGallery( instance ) { var opts; if ( !instance ) { return false; } opts = instance.current ? instance.current.opts : instance.opts; return opts.$orig ? opts.$orig.data( 'fancybox' ) : ( opts.hash || '' ); } // Star when DOM becomes ready $(function() { // Small delay is used to allow other scripts to process "dom ready" event setTimeout(function() { // Check if this module is not disabled if ( $.fancybox.defaults.hash === false ) { return; } // Update hash when opening/closing fancyBox $(document).on({ 'onInit.fb' : function( e, instance ) { var url, gallery; if ( instance.group[ instance.currIndex ].opts.hash === false ) { return; } url = parseUrl(); gallery = getGallery( instance ); // Make sure gallery start index matches index from hash if ( gallery && url.gallery && gallery == url.gallery ) { instance.currIndex = url.index - 1; } }, 'beforeShow.fb' : function( e, instance, current, firstRun ) { var gallery; if ( current.opts.hash === false ) { return; } gallery = getGallery( instance ); // Update window hash if ( gallery && gallery !== '' ) { if ( window.location.hash.indexOf( gallery ) < 0 ) { instance.opts.origHash = window.location.hash; } currentHash = gallery + ( instance.group.length > 1 ? '-' + ( current.index + 1 ) : '' ); if ( 'replaceState' in window.history ) { if ( timerID ) { clearTimeout( timerID ); } timerID = setTimeout(function() { window.history[ firstRun ? 'pushState' : 'replaceState' ]( {} , document.title, window.location.pathname + window.location.search + '#' + currentHash ); timerID = null; }, 300); } else { window.location.hash = currentHash; } } }, 'beforeClose.fb' : function( e, instance, current ) { var gallery, origHash; if ( timerID ) { clearTimeout( timerID ); } if ( current.opts.hash === false ) { return; } gallery = getGallery( instance ); origHash = instance && instance.opts.origHash ? instance.opts.origHash : ''; // Remove hash from location bar if ( gallery && gallery !== '' ) { if ( 'replaceState' in history ) { window.history.replaceState( {} , document.title, window.location.pathname + window.location.search + origHash ); } else { window.location.hash = origHash; // Keep original scroll position $( window ).scrollTop( instance.scrollTop ).scrollLeft( instance.scrollLeft ); } } currentHash = null; } }); // Check if need to close after url has changed $(window).on('hashchange.fb', function() { var url = parseUrl(); if ( $.fancybox.getInstance() ) { if ( currentHash && currentHash !== url.gallery + '-' + url.index && !( url.index === 1 && currentHash == url.gallery ) ) { currentHash = null; $.fancybox.close(); } } else if ( url.gallery !== '' ) { triggerFromUrl( url ); } }); // If navigating away from current page $(window).one('unload.fb popstate.fb', function() { $.fancybox.getInstance( 'close', true, 0 ); }); // Check current hash and trigger click event on matching element to start fancyBox, if needed triggerFromUrl( parseUrl() ); }, 50); }); }(document, window, window.jQuery)); // ========================================================================== // // Media // Adds additional media type support // // ========================================================================== ;(function ($) { 'use strict'; // Formats matching url to final form var format = function (url, rez, params) { if ( !url ) { return; } params = params || ''; if ( $.type(params) === "object" ) { params = $.param(params, true); } $.each(rez, function (key, value) { url = url.replace('$' + key, value || ''); }); if (params.length) { url += (url.indexOf('?') > 0 ? '&' : '?') + params; } return url; }; // Object containing properties for each media type var defaults = { youtube : { matcher : /(youtube\.com|youtu\.be|youtube\-nocookie\.com)\/(watch\?(.*&)?v=|v\/|u\/|embed\/?)?(videoseries\?list=(.*)|[\w-]{11}|\?listType=(.*)&list=(.*))(.*)/i, params : { autoplay : 1, autohide : 1, fs : 1, rel : 0, hd : 1, wmode : 'transparent', enablejsapi : 1, html5 : 1 }, paramPlace : 8, type : 'iframe', url : '//www.youtube.com/embed/$4', thumb : '//img.youtube.com/vi/$4/hqdefault.jpg' }, vimeo : { matcher : /^.+vimeo.com\/(.*\/)?([\d]+)(.*)?/, params : { autoplay : 1, hd : 1, show_title : 1, show_byline : 1, show_portrait : 0, fullscreen : 1, api : 1 }, paramPlace : 3, type : 'iframe', url : '//player.vimeo.com/video/$2' }, metacafe : { matcher : /metacafe.com\/watch\/(\d+)\/(.*)?/, type : 'iframe', url : '//www.metacafe.com/embed/$1/?ap=1' }, dailymotion : { matcher : /dailymotion.com\/video\/(.*)\/?(.*)/, params : { additionalInfos : 0, autoStart : 1 }, type : 'iframe', url : '//www.dailymotion.com/embed/video/$1' }, vine : { matcher : /vine.co\/v\/([a-zA-Z0-9\?\=\-]+)/, type : 'iframe', url : '//vine.co/v/$1/embed/simple' }, instagram : { matcher : /(instagr\.am|instagram\.com)\/p\/([a-zA-Z0-9_\-]+)\/?/i, type : 'image', url : '//$1/p/$2/media/?size=l' }, // Examples: // http://maps.google.com/?ll=48.857995,2.294297&spn=0.007666,0.021136&t=m&z=16 // http://maps.google.com/?ll=48.857995,2.294297&spn=0.007666,0.021136&t=m&z=16 // https://www.google.lv/maps/place/Googleplex/@37.4220041,-122.0833494,17z/data=!4m5!3m4!1s0x0:0x6c296c66619367e0!8m2!3d37.4219998!4d-122.0840572 google_maps : { matcher : /(maps\.)?google\.([a-z]{2,3}(\.[a-z]{2})?)\/(((maps\/(place\/(.*)\/)?\@(.*),(\d+.?\d+?)z))|(\?ll=))(.*)?/i, type : 'iframe', url : function (rez) { return '//maps.google.' + rez[2] + '/?ll=' + ( rez[9] ? rez[9] + '&z=' + Math.floor( rez[10] ) + ( rez[12] ? rez[12].replace(/^\//, "&") : '' ) : rez[12] ) + '&output=' + ( rez[12] && rez[12].indexOf('layer=c') > 0 ? 'svembed' : 'embed' ); } } }; $(document).on('onInit.fb', function (e, instance) { $.each(instance.group, function( i, item ) { var url = item.src || '', type = false, media, thumb, rez, params, urlParams, o, provider; // Skip items that already have content type if ( item.type ) { return; } media = $.extend( true, {}, defaults, item.opts.media ); // Look for any matching media type $.each(media, function ( n, el ) { rez = url.match(el.matcher); o = {}; provider = n; if (!rez) { return; } type = el.type; if ( el.paramPlace && rez[ el.paramPlace ] ) { urlParams = rez[ el.paramPlace ]; if ( urlParams[ 0 ] == '?' ) { urlParams = urlParams.substring(1); } urlParams = urlParams.split('&'); for ( var m = 0; m < urlParams.length; ++m ) { var p = urlParams[ m ].split('=', 2); if ( p.length == 2 ) { o[ p[0] ] = decodeURIComponent( p[1].replace(/\+/g, " ") ); } } } params = $.extend( true, {}, el.params, item.opts[ n ], o ); url = $.type(el.url) === "function" ? el.url.call(this, rez, params, item) : format(el.url, rez, params); thumb = $.type(el.thumb) === "function" ? el.thumb.call(this, rez, params, item) : format(el.thumb, rez); if ( provider === 'vimeo' ) { url = url.replace('&%23', '#'); } return false; }); // If it is found, then change content type and update the url if ( type ) { item.src = url; item.type = type; if ( !item.opts.thumb && !( item.opts.$thumb && item.opts.$thumb.length ) ) { item.opts.thumb = thumb; } if ( type === 'iframe' ) { $.extend(true, item.opts, { iframe : { preload : false, attr : { scrolling : "no" } } }); item.contentProvider = provider; item.opts.slideClass += ' fancybox-slide--' + ( provider == 'google_maps' ? 'map' : 'video' ); } } else { // If no content type is found, then set it to `image` as fallback item.type = 'image'; } }); }); }(window.jQuery)); // ========================================================================== // // SlideShow // Enables slideshow functionality // // Example of usage: // $.fancybox.getInstance().SlideShow.start() // // ========================================================================== ;(function (document, $) { 'use strict'; var SlideShow = function( instance ) { this.instance = instance; this.init(); }; $.extend( SlideShow.prototype, { timer : null, isActive : false, $button : null, speed : 3000, init : function() { var self = this; self.$button = self.instance.$refs.toolbar.find('[data-fancybox-play]').on('click', function() { self.toggle(); }); if ( self.instance.group.length < 2 || !self.instance.group[ self.instance.currIndex ].opts.slideShow ) { self.$button.hide(); } }, set : function() { var self = this; // Check if reached last element if ( self.instance && self.instance.current && (self.instance.current.opts.loop || self.instance.currIndex < self.instance.group.length - 1 )) { self.timer = setTimeout(function() { self.instance.next(); }, self.instance.current.opts.slideShow.speed || self.speed); } else { self.stop(); self.instance.idleSecondsCounter = 0; self.instance.showControls(); } }, clear : function() { var self = this; clearTimeout( self.timer ); self.timer = null; }, start : function() { var self = this; var current = self.instance.current; if ( self.instance && current && ( current.opts.loop || current.index < self.instance.group.length - 1 )) { self.isActive = true; self.$button .attr( 'title', current.opts.i18n[ current.opts.lang ].PLAY_STOP ) .addClass( 'fancybox-button--pause' ); if ( current.isComplete ) { self.set(); } } }, stop : function() { var self = this; var current = self.instance.current; self.clear(); self.$button .attr( 'title', current.opts.i18n[ current.opts.lang ].PLAY_START ) .removeClass( 'fancybox-button--pause' ); self.isActive = false; }, toggle : function() { var self = this; if ( self.isActive ) { self.stop(); } else { self.start(); } } }); $(document).on({ 'onInit.fb' : function(e, instance) { if ( instance && !instance.SlideShow ) { instance.SlideShow = new SlideShow( instance ); } }, 'beforeShow.fb' : function(e, instance, current, firstRun) { var SlideShow = instance && instance.SlideShow; if ( firstRun ) { if ( SlideShow && current.opts.slideShow.autoStart ) { SlideShow.start(); } } else if ( SlideShow && SlideShow.isActive ) { SlideShow.clear(); } }, 'afterShow.fb' : function(e, instance, current) { var SlideShow = instance && instance.SlideShow; if ( SlideShow && SlideShow.isActive ) { SlideShow.set(); } }, 'afterKeydown.fb' : function(e, instance, current, keypress, keycode) { var SlideShow = instance && instance.SlideShow; // "P" or Spacebar if ( SlideShow && current.opts.slideShow && ( keycode === 80 || keycode === 32 ) && !$(document.activeElement).is( 'button,a,input' ) ) { keypress.preventDefault(); SlideShow.toggle(); } }, 'beforeClose.fb onDeactivate.fb' : function(e, instance) { var SlideShow = instance && instance.SlideShow; if ( SlideShow ) { SlideShow.stop(); } } }); // Page Visibility API to pause slideshow when window is not active $(document).on("visibilitychange", function() { var instance = $.fancybox.getInstance(); var SlideShow = instance && instance.SlideShow; if ( SlideShow && SlideShow.isActive ) { if ( document.hidden ) { SlideShow.clear(); } else { SlideShow.set(); } } }); }(document, window.jQuery)); // ========================================================================== // // Thumbs // Displays thumbnails in a grid // // ========================================================================== ;(function (document, $) { 'use strict'; var FancyThumbs = function( instance ) { this.instance = instance; this.init(); }; $.extend( FancyThumbs.prototype, { $button : null, $grid : null, $list : null, isVisible : false, init : function() { var self = this; var first = self.instance.group[0], second = self.instance.group[1]; self.$button = self.instance.$refs.toolbar.find( '[data-fancybox-thumbs]' ); if ( self.instance.group.length > 1 && self.instance.group[ self.instance.currIndex ].opts.thumbs && ( ( first.type == 'image' || first.opts.thumb || first.opts.$thumb ) && ( second.type == 'image' || second.opts.thumb || second.opts.$thumb ) )) { self.$button.on('click', function() { self.toggle(); }); self.isActive = true; } else { self.$button.hide(); self.isActive = false; } }, create : function() { var instance = this.instance, list, src; this.$grid = $('
    ').appendTo( instance.$refs.container ); list = '
      '; $.each(instance.group, function( i, item ) { src = item.opts.thumb || ( item.opts.$thumb ? item.opts.$thumb.attr('src') : null ); if ( !src && item.type === 'image' ) { src = item.src; } if ( src && src.length ) { list += '
    • '; } }); list += '
    '; this.$list = $( list ).appendTo( this.$grid ).on('click', 'li', function() { instance.jumpTo( $(this).data('index') ); }); this.$list.find('img').hide().one('load', function() { var $parent = $(this).parent().removeClass('fancybox-thumbs-loading'), thumbWidth = $parent.outerWidth(), thumbHeight = $parent.outerHeight(), width, height, widthRatio, heightRatio; width = this.naturalWidth || this.width; height = this.naturalHeight || this.height; //Calculate thumbnail width/height and center it widthRatio = width / thumbWidth; heightRatio = height / thumbHeight; if (widthRatio >= 1 && heightRatio >= 1) { if (widthRatio > heightRatio) { width = width / heightRatio; height = thumbHeight; } else { width = thumbWidth; height = height / widthRatio; } } $(this).css({ width : Math.floor(width), height : Math.floor(height), 'margin-top' : Math.min( 0, Math.floor(thumbHeight * 0.3 - height * 0.3 ) ), 'margin-left' : Math.min( 0, Math.floor(thumbWidth * 0.5 - width * 0.5 ) ) }).show(); }) .each(function() { this.src = $( this ).data( 'src' ); }); }, focus : function() { if ( this.instance.current ) { this.$list .children() .removeClass('fancybox-thumbs-active') .filter('[data-index="' + this.instance.current.index + '"]') .addClass('fancybox-thumbs-active') .focus(); } }, close : function() { this.$grid.hide(); }, update : function() { this.instance.$refs.container.toggleClass( 'fancybox-show-thumbs', this.isVisible ); if ( this.isVisible ) { if ( !this.$grid ) { this.create(); } this.instance.trigger( 'onThumbsShow' ); this.focus(); } else if ( this.$grid ) { this.instance.trigger( 'onThumbsHide' ); } // Update content position this.instance.update(); }, hide : function() { this.isVisible = false; this.update(); }, show : function() { this.isVisible = true; this.update(); }, toggle : function() { this.isVisible = !this.isVisible; this.update(); } }); $(document).on({ 'onInit.fb' : function(e, instance) { if ( instance && !instance.Thumbs ) { instance.Thumbs = new FancyThumbs( instance ); } }, 'beforeShow.fb' : function(e, instance, item, firstRun) { var Thumbs = instance && instance.Thumbs; if ( !Thumbs || !Thumbs.isActive ) { return; } if ( item.modal ) { Thumbs.$button.hide(); Thumbs.hide(); return; } if ( firstRun && instance.opts.thumbs.autoStart === true ) { Thumbs.show(); } if ( Thumbs.isVisible ) { Thumbs.focus(); } }, 'afterKeydown.fb' : function(e, instance, current, keypress, keycode) { var Thumbs = instance && instance.Thumbs; // "G" if ( Thumbs && Thumbs.isActive && keycode === 71 ) { keypress.preventDefault(); Thumbs.toggle(); } }, 'beforeClose.fb' : function( e, instance ) { var Thumbs = instance && instance.Thumbs; if ( Thumbs && Thumbs.isVisible && instance.opts.thumbs.hideOnClose !== false ) { Thumbs.close(); } } }); }(document, window.jQuery)); /*! http://mths.be/placeholder v2.0.8 by @mathias */ ;(function(window, document, $) { // Opera Mini v7 doesn’t support placeholder although its DOM seems to indicate so var isOperaMini = Object.prototype.toString.call(window.operamini) == '[object OperaMini]'; var isInputSupported = 'placeholder' in document.createElement('input') && !isOperaMini; var isTextareaSupported = 'placeholder' in document.createElement('textarea') && !isOperaMini; var prototype = $.fn; var valHooks = $.valHooks; var propHooks = $.propHooks; var hooks; var placeholder; if (isInputSupported && isTextareaSupported) { placeholder = prototype.placeholder = function() { return this; }; placeholder.input = placeholder.textarea = true; } else { placeholder = prototype.placeholder = function() { var $this = this; $this .filter((isInputSupported ? 'textarea' : ':input') + '[placeholder]') .not('.placeholder') .bind({ 'focus.placeholder': clearPlaceholder, 'blur.placeholder': setPlaceholder }) .data('placeholder-enabled', true) .trigger('blur.placeholder'); return $this; }; placeholder.input = isInputSupported; placeholder.textarea = isTextareaSupported; hooks = { 'get': function(element) { var $element = $(element); var $passwordInput = $element.data('placeholder-password'); if ($passwordInput) { return $passwordInput[0].value; } return $element.data('placeholder-enabled') && $element.hasClass('placeholder') ? '' : element.value; }, 'set': function(element, value) { var $element = $(element); var $passwordInput = $element.data('placeholder-password'); if ($passwordInput) { return $passwordInput[0].value = value; } if (!$element.data('placeholder-enabled')) { return element.value = value; } if (value == '') { element.value = value; // Issue #56: Setting the placeholder causes problems if the element continues to have focus. if (element != safeActiveElement()) { // We can't use `triggerHandler` here because of dummy text/password inputs :( setPlaceholder.call(element); } } else if ($element.hasClass('placeholder')) { clearPlaceholder.call(element, true, value) || (element.value = value); } else { element.value = value; } // `set` can not return `undefined`; see http://jsapi.info/jquery/1.7.1/val#L2363 return $element; } }; if (!isInputSupported) { valHooks.input = hooks; propHooks.value = hooks; } if (!isTextareaSupported) { valHooks.textarea = hooks; propHooks.value = hooks; } $(function() { // Look for forms $(document).delegate('form', 'submit.placeholder', function() { // Clear the placeholder values so they don't get submitted var $inputs = $('.placeholder', this).each(clearPlaceholder); setTimeout(function() { $inputs.each(setPlaceholder); }, 10); }); }); // Clear placeholder values upon page reload $(window).bind('beforeunload.placeholder', function() { $('.placeholder').each(function() { this.value = ''; }); }); } function args(elem) { // Return an object of element attributes var newAttrs = {}; var rinlinejQuery = /^jQuery\d+$/; $.each(elem.attributes, function(i, attr) { if (attr.specified && !rinlinejQuery.test(attr.name)) { newAttrs[attr.name] = attr.value; } }); return newAttrs; } function clearPlaceholder(event, value) { var input = this; var $input = $(input); if (input.value == $input.attr('placeholder') && $input.hasClass('placeholder')) { if ($input.data('placeholder-password')) { $input = $input.hide().next().show().attr('id', $input.removeAttr('id').data('placeholder-id')); // If `clearPlaceholder` was called from `$.valHooks.input.set` if (event === true) { return $input[0].value = value; } $input.focus(); } else { input.value = ''; $input.removeClass('placeholder'); input == safeActiveElement() && input.select(); } } } function setPlaceholder() { var $replacement; var input = this; var $input = $(input); var id = this.id; if (input.value == '') { if (input.type == 'password') { if (!$input.data('placeholder-textinput')) { try { $replacement = $input.clone().attr({ 'type': 'text' }); } catch(e) { $replacement = $('').attr($.extend(args(this), { 'type': 'text' })); } $replacement .removeAttr('name') .data({ 'placeholder-password': $input, 'placeholder-id': id }) .bind('focus.placeholder', clearPlaceholder); $input .data({ 'placeholder-textinput': $replacement, 'placeholder-id': id }) .before($replacement); } $input = $input.removeAttr('id').hide().prev().attr('id', id).show(); // Note: `$input[0] != input` now! } $input.addClass('placeholder'); $input[0].value = $input.attr('placeholder'); } else { $input.removeClass('placeholder'); } } function safeActiveElement() { // Avoid IE9 `document.activeElement` of death // https://github.com/mathiasbynens/jquery-placeholder/pull/99 try { return document.activeElement; } catch (exception) {} } }(this, document, jQuery)); /*! * sweetalert2 v7.3.2 * Released under the MIT License. */ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : (global.Sweetalert2 = factory()); }(this, (function () { 'use strict'; var styles = "html.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown),\nbody.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown) {\n overflow-y: hidden; }\n\nbody.swal2-toast-shown.swal2-has-input > .swal2-container > .swal2-toast {\n -webkit-box-orient: vertical;\n -webkit-box-direction: normal;\n -ms-flex-direction: column;\n flex-direction: column; }\n body.swal2-toast-shown.swal2-has-input > .swal2-container > .swal2-toast .swal2-icon {\n margin: 0 0 15px; }\n body.swal2-toast-shown.swal2-has-input > .swal2-container > .swal2-toast .swal2-buttonswrapper {\n -webkit-box-flex: 1;\n -ms-flex: 1;\n flex: 1;\n -ms-flex-item-align: stretch;\n align-self: stretch;\n -webkit-box-pack: end;\n -ms-flex-pack: end;\n justify-content: flex-end; }\n body.swal2-toast-shown.swal2-has-input > .swal2-container > .swal2-toast .swal2-loading {\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center; }\n body.swal2-toast-shown.swal2-has-input > .swal2-container > .swal2-toast .swal2-input {\n height: 32px;\n font-size: 14px;\n margin: 5px auto; }\n\nbody.swal2-toast-shown > .swal2-container {\n position: fixed;\n background-color: transparent; }\n body.swal2-toast-shown > .swal2-container.swal2-shown {\n background-color: transparent; }\n body.swal2-toast-shown > .swal2-container.swal2-top {\n top: 0;\n left: 50%;\n bottom: auto;\n right: auto;\n -webkit-transform: translateX(-50%);\n transform: translateX(-50%); }\n body.swal2-toast-shown > .swal2-container.swal2-top-end, body.swal2-toast-shown > .swal2-container.swal2-top-right {\n top: 0;\n left: auto;\n bottom: auto;\n right: 0; }\n body.swal2-toast-shown > .swal2-container.swal2-top-start, body.swal2-toast-shown > .swal2-container.swal2-top-left {\n top: 0;\n left: 0;\n bottom: auto;\n right: auto; }\n body.swal2-toast-shown > .swal2-container.swal2-center-start, body.swal2-toast-shown > .swal2-container.swal2-center-left {\n top: 50%;\n left: 0;\n bottom: auto;\n right: auto;\n -webkit-transform: translateY(-50%);\n transform: translateY(-50%); }\n body.swal2-toast-shown > .swal2-container.swal2-center {\n top: 50%;\n left: 50%;\n bottom: auto;\n right: auto;\n -webkit-transform: translate(-50%, -50%);\n transform: translate(-50%, -50%); }\n body.swal2-toast-shown > .swal2-container.swal2-center-end, body.swal2-toast-shown > .swal2-container.swal2-center-right {\n top: 50%;\n left: auto;\n bottom: auto;\n right: 0;\n -webkit-transform: translateY(-50%);\n transform: translateY(-50%); }\n body.swal2-toast-shown > .swal2-container.swal2-bottom-start, body.swal2-toast-shown > .swal2-container.swal2-bottom-left {\n top: auto;\n left: 0;\n bottom: 0;\n right: auto; }\n body.swal2-toast-shown > .swal2-container.swal2-bottom {\n top: auto;\n left: 50%;\n bottom: 0;\n right: auto;\n -webkit-transform: translateX(-50%);\n transform: translateX(-50%); }\n body.swal2-toast-shown > .swal2-container.swal2-bottom-end, body.swal2-toast-shown > .swal2-container.swal2-bottom-right {\n top: auto;\n left: auto;\n bottom: 0;\n right: 0; }\n\nbody.swal2-iosfix {\n position: fixed;\n left: 0;\n right: 0; }\n\nbody.swal2-no-backdrop > .swal2-shown {\n top: auto;\n bottom: auto;\n left: auto;\n right: auto;\n background-color: transparent; }\n body.swal2-no-backdrop > .swal2-shown > .swal2-modal {\n -webkit-box-shadow: 0 0 10px rgba(0, 0, 0, 0.4);\n box-shadow: 0 0 10px rgba(0, 0, 0, 0.4); }\n body.swal2-no-backdrop > .swal2-shown.swal2-top {\n top: 0;\n left: 50%;\n -webkit-transform: translateX(-50%);\n transform: translateX(-50%); }\n body.swal2-no-backdrop > .swal2-shown.swal2-top-start, body.swal2-no-backdrop > .swal2-shown.swal2-top-left {\n top: 0;\n left: 0; }\n body.swal2-no-backdrop > .swal2-shown.swal2-top-end, body.swal2-no-backdrop > .swal2-shown.swal2-top-right {\n top: 0;\n right: 0; }\n body.swal2-no-backdrop > .swal2-shown.swal2-center {\n top: 50%;\n left: 50%;\n -webkit-transform: translate(-50%, -50%);\n transform: translate(-50%, -50%); }\n body.swal2-no-backdrop > .swal2-shown.swal2-center-start, body.swal2-no-backdrop > .swal2-shown.swal2-center-left {\n top: 50%;\n left: 0;\n -webkit-transform: translateY(-50%);\n transform: translateY(-50%); }\n body.swal2-no-backdrop > .swal2-shown.swal2-center-end, body.swal2-no-backdrop > .swal2-shown.swal2-center-right {\n top: 50%;\n right: 0;\n -webkit-transform: translateY(-50%);\n transform: translateY(-50%); }\n body.swal2-no-backdrop > .swal2-shown.swal2-bottom {\n bottom: 0;\n left: 50%;\n -webkit-transform: translateX(-50%);\n transform: translateX(-50%); }\n body.swal2-no-backdrop > .swal2-shown.swal2-bottom-start, body.swal2-no-backdrop > .swal2-shown.swal2-bottom-left {\n bottom: 0;\n left: 0; }\n body.swal2-no-backdrop > .swal2-shown.swal2-bottom-end, body.swal2-no-backdrop > .swal2-shown.swal2-bottom-right {\n bottom: 0;\n right: 0; }\n\n.swal2-container {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-orient: horizontal;\n -webkit-box-direction: normal;\n -ms-flex-direction: row;\n flex-direction: row;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n position: fixed;\n padding: 10px;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background-color: transparent;\n z-index: 1060; }\n .swal2-container.swal2-top {\n -webkit-box-align: start;\n -ms-flex-align: start;\n align-items: flex-start; }\n .swal2-container.swal2-top-start, .swal2-container.swal2-top-left {\n -webkit-box-align: start;\n -ms-flex-align: start;\n align-items: flex-start;\n -webkit-box-pack: start;\n -ms-flex-pack: start;\n justify-content: flex-start; }\n .swal2-container.swal2-top-end, .swal2-container.swal2-top-right {\n -webkit-box-align: start;\n -ms-flex-align: start;\n align-items: flex-start;\n -webkit-box-pack: end;\n -ms-flex-pack: end;\n justify-content: flex-end; }\n .swal2-container.swal2-center {\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center; }\n .swal2-container.swal2-center-start, .swal2-container.swal2-center-left {\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -webkit-box-pack: start;\n -ms-flex-pack: start;\n justify-content: flex-start; }\n .swal2-container.swal2-center-end, .swal2-container.swal2-center-right {\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -webkit-box-pack: end;\n -ms-flex-pack: end;\n justify-content: flex-end; }\n .swal2-container.swal2-bottom {\n -webkit-box-align: end;\n -ms-flex-align: end;\n align-items: flex-end; }\n .swal2-container.swal2-bottom-start, .swal2-container.swal2-bottom-left {\n -webkit-box-align: end;\n -ms-flex-align: end;\n align-items: flex-end;\n -webkit-box-pack: start;\n -ms-flex-pack: start;\n justify-content: flex-start; }\n .swal2-container.swal2-bottom-end, .swal2-container.swal2-bottom-right {\n -webkit-box-align: end;\n -ms-flex-align: end;\n align-items: flex-end;\n -webkit-box-pack: end;\n -ms-flex-pack: end;\n justify-content: flex-end; }\n .swal2-container.swal2-grow-fullscreen > .swal2-modal {\n display: -webkit-box !important;\n display: -ms-flexbox !important;\n display: flex !important;\n -webkit-box-flex: 1;\n -ms-flex: 1;\n flex: 1;\n -ms-flex-item-align: stretch;\n align-self: stretch;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center; }\n .swal2-container.swal2-grow-row > .swal2-modal {\n display: -webkit-box !important;\n display: -ms-flexbox !important;\n display: flex !important;\n -webkit-box-flex: 1;\n -ms-flex: 1;\n flex: 1;\n -ms-flex-line-pack: center;\n align-content: center;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center; }\n .swal2-container.swal2-grow-column {\n -webkit-box-flex: 1;\n -ms-flex: 1;\n flex: 1;\n -webkit-box-orient: vertical;\n -webkit-box-direction: normal;\n -ms-flex-direction: column;\n flex-direction: column; }\n .swal2-container.swal2-grow-column.swal2-top, .swal2-container.swal2-grow-column.swal2-center, .swal2-container.swal2-grow-column.swal2-bottom {\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center; }\n .swal2-container.swal2-grow-column.swal2-top-start, .swal2-container.swal2-grow-column.swal2-center-start, .swal2-container.swal2-grow-column.swal2-bottom-start, .swal2-container.swal2-grow-column.swal2-top-left, .swal2-container.swal2-grow-column.swal2-center-left, .swal2-container.swal2-grow-column.swal2-bottom-left {\n -webkit-box-align: start;\n -ms-flex-align: start;\n align-items: flex-start; }\n .swal2-container.swal2-grow-column.swal2-top-end, .swal2-container.swal2-grow-column.swal2-center-end, .swal2-container.swal2-grow-column.swal2-bottom-end, .swal2-container.swal2-grow-column.swal2-top-right, .swal2-container.swal2-grow-column.swal2-center-right, .swal2-container.swal2-grow-column.swal2-bottom-right {\n -webkit-box-align: end;\n -ms-flex-align: end;\n align-items: flex-end; }\n .swal2-container.swal2-grow-column > .swal2-modal {\n display: -webkit-box !important;\n display: -ms-flexbox !important;\n display: flex !important;\n -webkit-box-flex: 1;\n -ms-flex: 1;\n flex: 1;\n -ms-flex-line-pack: center;\n align-content: center;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center; }\n .swal2-container:not(.swal2-top):not(.swal2-top-start):not(.swal2-top-end):not(.swal2-top-left):not(.swal2-top-right):not(.swal2-center-start):not(.swal2-center-end):not(.swal2-center-left):not(.swal2-center-right):not(.swal2-bottom):not(.swal2-bottom-start):not(.swal2-bottom-end):not(.swal2-bottom-left):not(.swal2-bottom-right) > .swal2-modal {\n margin: auto; }\n @media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {\n .swal2-container .swal2-modal {\n margin: 0 !important; } }\n .swal2-container.swal2-fade {\n -webkit-transition: background-color .1s;\n transition: background-color .1s; }\n .swal2-container.swal2-shown {\n background-color: rgba(0, 0, 0, 0.4); }\n\n.swal2-popup {\n -webkit-box-orient: vertical;\n -webkit-box-direction: normal;\n -ms-flex-direction: column;\n flex-direction: column;\n background-color: #fff;\n font-family: \"Helvetica Neue\", Helvetica, Arial, sans-serif;\n border-radius: 5px;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n text-align: center;\n overflow-x: hidden;\n overflow-y: auto;\n display: none;\n position: relative;\n max-width: 100%; }\n .swal2-popup.swal2-toast {\n width: 300px;\n padding: 0 15px;\n -webkit-box-orient: horizontal;\n -webkit-box-direction: normal;\n -ms-flex-direction: row;\n flex-direction: row;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n overflow-y: hidden;\n -webkit-box-shadow: 0 0 10px #d9d9d9;\n box-shadow: 0 0 10px #d9d9d9; }\n .swal2-popup.swal2-toast .swal2-title {\n max-width: 300px;\n font-size: 16px;\n text-align: left; }\n .swal2-popup.swal2-toast .swal2-content {\n font-size: 14px;\n text-align: left; }\n .swal2-popup.swal2-toast .swal2-icon {\n width: 32px;\n min-width: 32px;\n height: 32px;\n margin: 0 15px 0 0; }\n .swal2-popup.swal2-toast .swal2-icon.swal2-success .swal2-success-ring {\n width: 32px;\n height: 32px; }\n .swal2-popup.swal2-toast .swal2-icon.swal2-info, .swal2-popup.swal2-toast .swal2-icon.swal2-warning, .swal2-popup.swal2-toast .swal2-icon.swal2-question {\n font-size: 26px;\n line-height: 32px; }\n .swal2-popup.swal2-toast .swal2-icon.swal2-error [class^='swal2-x-mark-line'] {\n top: 14px;\n width: 22px; }\n .swal2-popup.swal2-toast .swal2-icon.swal2-error [class^='swal2-x-mark-line'][class$='left'] {\n left: 5px; }\n .swal2-popup.swal2-toast .swal2-icon.swal2-error [class^='swal2-x-mark-line'][class$='right'] {\n right: 5px; }\n .swal2-popup.swal2-toast .swal2-buttonswrapper {\n margin: 0 0 0 5px; }\n .swal2-popup.swal2-toast .swal2-styled {\n margin: 0 0 0 5px;\n padding: 5px 10px; }\n .swal2-popup.swal2-toast .swal2-styled:focus {\n -webkit-box-shadow: 0 0 0 1px #fff, 0 0 0 2px rgba(50, 100, 150, 0.4);\n box-shadow: 0 0 0 1px #fff, 0 0 0 2px rgba(50, 100, 150, 0.4); }\n .swal2-popup.swal2-toast .swal2-validationerror {\n width: 100%;\n margin: 5px -20px; }\n .swal2-popup.swal2-toast .swal2-success {\n border-color: #a5dc86; }\n .swal2-popup.swal2-toast .swal2-success [class^='swal2-success-circular-line'] {\n border-radius: 50%;\n position: absolute;\n width: 32px;\n height: 64px;\n -webkit-transform: rotate(45deg);\n transform: rotate(45deg); }\n .swal2-popup.swal2-toast .swal2-success [class^='swal2-success-circular-line'][class$='left'] {\n border-radius: 64px 0 0 64px;\n top: -4px;\n left: -15px;\n -webkit-transform: rotate(-45deg);\n transform: rotate(-45deg);\n -webkit-transform-origin: 32px 32px;\n transform-origin: 32px 32px; }\n .swal2-popup.swal2-toast .swal2-success [class^='swal2-success-circular-line'][class$='right'] {\n border-radius: 0 64px 64px 0;\n top: -5px;\n left: 14px;\n -webkit-transform-origin: 0 32px;\n transform-origin: 0 32px; }\n .swal2-popup.swal2-toast .swal2-success .swal2-success-ring {\n width: 32px;\n height: 32px; }\n .swal2-popup.swal2-toast .swal2-success .swal2-success-fix {\n width: 7px;\n height: 90px;\n left: 28px;\n top: 8px; }\n .swal2-popup.swal2-toast .swal2-success [class^='swal2-success-line'] {\n height: 5px; }\n .swal2-popup.swal2-toast .swal2-success [class^='swal2-success-line'][class$='tip'] {\n width: 12px;\n left: 3px;\n top: 18px; }\n .swal2-popup.swal2-toast .swal2-success [class^='swal2-success-line'][class$='long'] {\n width: 22px;\n right: 3px;\n top: 15px; }\n .swal2-popup.swal2-toast .swal2-animate-success-line-tip {\n -webkit-animation: animate-toast-success-tip .75s;\n animation: animate-toast-success-tip .75s; }\n .swal2-popup.swal2-toast .swal2-animate-success-line-long {\n -webkit-animation: animate-toast-success-long .75s;\n animation: animate-toast-success-long .75s; }\n .swal2-popup:focus {\n outline: none; }\n .swal2-popup.swal2-loading {\n overflow-y: hidden; }\n .swal2-popup .swal2-title {\n color: #595959;\n font-size: 30px;\n text-align: center;\n font-weight: 600;\n text-transform: none;\n position: relative;\n margin: 0 0 .4em;\n padding: 0;\n display: block;\n word-wrap: break-word; }\n .swal2-popup .swal2-buttonswrapper {\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n margin-top: 15px; }\n .swal2-popup .swal2-buttonswrapper:not(.swal2-loading) .swal2-styled[disabled] {\n opacity: .4;\n cursor: no-drop; }\n .swal2-popup .swal2-buttonswrapper.swal2-loading .swal2-styled.swal2-confirm {\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n border: 4px solid transparent;\n border-color: transparent;\n width: 40px;\n height: 40px;\n padding: 0;\n margin: 7.5px;\n vertical-align: top;\n background-color: transparent !important;\n color: transparent;\n cursor: default;\n border-radius: 100%;\n -webkit-animation: rotate-loading 1.5s linear 0s infinite normal;\n animation: rotate-loading 1.5s linear 0s infinite normal;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none; }\n .swal2-popup .swal2-buttonswrapper.swal2-loading .swal2-styled.swal2-cancel {\n margin-left: 30px;\n margin-right: 30px; }\n .swal2-popup .swal2-buttonswrapper.swal2-loading :not(.swal2-styled).swal2-confirm::after {\n display: inline-block;\n content: '';\n margin-left: 5px;\n vertical-align: -1px;\n height: 15px;\n width: 15px;\n border: 3px solid #999999;\n -webkit-box-shadow: 1px 1px 1px #fff;\n box-shadow: 1px 1px 1px #fff;\n border-right-color: transparent;\n border-radius: 50%;\n -webkit-animation: rotate-loading 1.5s linear 0s infinite normal;\n animation: rotate-loading 1.5s linear 0s infinite normal; }\n .swal2-popup .swal2-styled {\n border: 0;\n border-radius: 3px;\n -webkit-box-shadow: none;\n box-shadow: none;\n color: #fff;\n cursor: pointer;\n font-size: 17px;\n font-weight: 500;\n margin: 15px 5px 0;\n padding: 10px 32px; }\n .swal2-popup .swal2-styled:focus {\n outline: none;\n -webkit-box-shadow: 0 0 0 2px #fff, 0 0 0 4px rgba(50, 100, 150, 0.4);\n box-shadow: 0 0 0 2px #fff, 0 0 0 4px rgba(50, 100, 150, 0.4); }\n .swal2-popup .swal2-image {\n margin: 20px auto;\n max-width: 100%; }\n .swal2-popup .swal2-close {\n background: transparent;\n border: 0;\n margin: 0;\n padding: 0;\n width: 38px;\n height: 40px;\n font-size: 36px;\n line-height: 40px;\n font-family: serif;\n position: absolute;\n top: 5px;\n right: 8px;\n cursor: pointer;\n color: #cccccc;\n -webkit-transition: color .1s ease;\n transition: color .1s ease; }\n .swal2-popup .swal2-close:hover {\n color: #d55; }\n .swal2-popup > .swal2-input,\n .swal2-popup > .swal2-file,\n .swal2-popup > .swal2-textarea,\n .swal2-popup > .swal2-select,\n .swal2-popup > .swal2-radio,\n .swal2-popup > .swal2-checkbox {\n display: none; }\n .swal2-popup .swal2-content {\n font-size: 18px;\n text-align: center;\n font-weight: 300;\n position: relative;\n float: none;\n margin: 0;\n padding: 0;\n line-height: normal;\n color: #545454;\n word-wrap: break-word; }\n .swal2-popup .swal2-input,\n .swal2-popup .swal2-file,\n .swal2-popup .swal2-textarea,\n .swal2-popup .swal2-select,\n .swal2-popup .swal2-radio,\n .swal2-popup .swal2-checkbox {\n margin: 20px auto; }\n .swal2-popup .swal2-input,\n .swal2-popup .swal2-file,\n .swal2-popup .swal2-textarea {\n width: 100%;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n font-size: 18px;\n border-radius: 3px;\n border: 1px solid #d9d9d9;\n -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.06);\n box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.06);\n -webkit-transition: border-color .3s, -webkit-box-shadow .3s;\n transition: border-color .3s, -webkit-box-shadow .3s;\n transition: border-color .3s, box-shadow .3s;\n transition: border-color .3s, box-shadow .3s, -webkit-box-shadow .3s; }\n .swal2-popup .swal2-input.swal2-inputerror,\n .swal2-popup .swal2-file.swal2-inputerror,\n .swal2-popup .swal2-textarea.swal2-inputerror {\n border-color: #f27474 !important;\n -webkit-box-shadow: 0 0 2px #f27474 !important;\n box-shadow: 0 0 2px #f27474 !important; }\n .swal2-popup .swal2-input:focus,\n .swal2-popup .swal2-file:focus,\n .swal2-popup .swal2-textarea:focus {\n outline: none;\n border: 1px solid #b4dbed;\n -webkit-box-shadow: 0 0 3px #c4e6f5;\n box-shadow: 0 0 3px #c4e6f5; }\n .swal2-popup .swal2-input::-webkit-input-placeholder,\n .swal2-popup .swal2-file::-webkit-input-placeholder,\n .swal2-popup .swal2-textarea::-webkit-input-placeholder {\n color: #cccccc; }\n .swal2-popup .swal2-input:-ms-input-placeholder,\n .swal2-popup .swal2-file:-ms-input-placeholder,\n .swal2-popup .swal2-textarea:-ms-input-placeholder {\n color: #cccccc; }\n .swal2-popup .swal2-input::-ms-input-placeholder,\n .swal2-popup .swal2-file::-ms-input-placeholder,\n .swal2-popup .swal2-textarea::-ms-input-placeholder {\n color: #cccccc; }\n .swal2-popup .swal2-input::placeholder,\n .swal2-popup .swal2-file::placeholder,\n .swal2-popup .swal2-textarea::placeholder {\n color: #cccccc; }\n .swal2-popup .swal2-range input {\n float: left;\n width: 80%; }\n .swal2-popup .swal2-range output {\n float: right;\n width: 20%;\n font-size: 20px;\n font-weight: 600;\n text-align: center; }\n .swal2-popup .swal2-range input,\n .swal2-popup .swal2-range output {\n height: 43px;\n line-height: 43px;\n vertical-align: middle;\n margin: 20px auto;\n padding: 0; }\n .swal2-popup .swal2-input {\n height: 43px;\n padding: 0 12px; }\n .swal2-popup .swal2-input[type='number'] {\n max-width: 150px; }\n .swal2-popup .swal2-file {\n font-size: 20px; }\n .swal2-popup .swal2-textarea {\n height: 108px;\n padding: 12px; }\n .swal2-popup .swal2-select {\n color: #545454;\n font-size: inherit;\n padding: 5px 10px;\n min-width: 40%;\n max-width: 100%; }\n .swal2-popup .swal2-radio {\n border: 0; }\n .swal2-popup .swal2-radio label:not(:first-child) {\n margin-left: 20px; }\n .swal2-popup .swal2-radio input,\n .swal2-popup .swal2-radio span {\n vertical-align: middle; }\n .swal2-popup .swal2-radio input {\n margin: 0 3px 0 0; }\n .swal2-popup .swal2-checkbox {\n color: #545454; }\n .swal2-popup .swal2-checkbox input,\n .swal2-popup .swal2-checkbox span {\n vertical-align: middle; }\n .swal2-popup .swal2-validationerror {\n background-color: #f0f0f0;\n margin: 0 -20px;\n overflow: hidden;\n padding: 10px;\n color: gray;\n font-size: 16px;\n font-weight: 300;\n display: none; }\n .swal2-popup .swal2-validationerror::before {\n content: '!';\n display: inline-block;\n width: 24px;\n height: 24px;\n border-radius: 50%;\n background-color: #ea7d7d;\n color: #fff;\n line-height: 24px;\n text-align: center;\n margin-right: 10px; }\n\n@supports (-ms-accelerator: true) {\n .swal2-range input {\n width: 100% !important; }\n .swal2-range output {\n display: none; } }\n\n@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {\n .swal2-range input {\n width: 100% !important; }\n .swal2-range output {\n display: none; } }\n\n.swal2-icon {\n width: 80px;\n height: 80px;\n border: 4px solid transparent;\n border-radius: 50%;\n margin: 20px auto 30px;\n padding: 0;\n position: relative;\n -webkit-box-sizing: content-box;\n box-sizing: content-box;\n cursor: default;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none; }\n .swal2-icon.swal2-error {\n border-color: #f27474; }\n .swal2-icon.swal2-error .swal2-x-mark {\n position: relative;\n display: block; }\n .swal2-icon.swal2-error [class^='swal2-x-mark-line'] {\n position: absolute;\n height: 5px;\n width: 47px;\n background-color: #f27474;\n display: block;\n top: 37px;\n border-radius: 2px; }\n .swal2-icon.swal2-error [class^='swal2-x-mark-line'][class$='left'] {\n -webkit-transform: rotate(45deg);\n transform: rotate(45deg);\n left: 17px; }\n .swal2-icon.swal2-error [class^='swal2-x-mark-line'][class$='right'] {\n -webkit-transform: rotate(-45deg);\n transform: rotate(-45deg);\n right: 16px; }\n .swal2-icon.swal2-warning {\n font-family: \"Helvetica Neue\", Helvetica, Arial, sans-serif;\n color: #f8bb86;\n border-color: #facea8;\n font-size: 60px;\n line-height: 80px;\n text-align: center; }\n .swal2-icon.swal2-info {\n font-family: \"Helvetica Neue\", Helvetica, Arial, sans-serif;\n color: #3fc3ee;\n border-color: #9de0f6;\n font-size: 60px;\n line-height: 80px;\n text-align: center; }\n .swal2-icon.swal2-question {\n font-family: \"Helvetica Neue\", Helvetica, Arial, sans-serif;\n color: #87adbd;\n border-color: #c9dae1;\n font-size: 60px;\n line-height: 80px;\n text-align: center; }\n .swal2-icon.swal2-success {\n border-color: #a5dc86; }\n .swal2-icon.swal2-success [class^='swal2-success-circular-line'] {\n border-radius: 50%;\n position: absolute;\n width: 60px;\n height: 120px;\n -webkit-transform: rotate(45deg);\n transform: rotate(45deg); }\n .swal2-icon.swal2-success [class^='swal2-success-circular-line'][class$='left'] {\n border-radius: 120px 0 0 120px;\n top: -7px;\n left: -33px;\n -webkit-transform: rotate(-45deg);\n transform: rotate(-45deg);\n -webkit-transform-origin: 60px 60px;\n transform-origin: 60px 60px; }\n .swal2-icon.swal2-success [class^='swal2-success-circular-line'][class$='right'] {\n border-radius: 0 120px 120px 0;\n top: -11px;\n left: 30px;\n -webkit-transform: rotate(-45deg);\n transform: rotate(-45deg);\n -webkit-transform-origin: 0 60px;\n transform-origin: 0 60px; }\n .swal2-icon.swal2-success .swal2-success-ring {\n width: 80px;\n height: 80px;\n border: 4px solid rgba(165, 220, 134, 0.2);\n border-radius: 50%;\n -webkit-box-sizing: content-box;\n box-sizing: content-box;\n position: absolute;\n left: -4px;\n top: -4px;\n z-index: 2; }\n .swal2-icon.swal2-success .swal2-success-fix {\n width: 7px;\n height: 90px;\n position: absolute;\n left: 28px;\n top: 8px;\n z-index: 1;\n -webkit-transform: rotate(-45deg);\n transform: rotate(-45deg); }\n .swal2-icon.swal2-success [class^='swal2-success-line'] {\n height: 5px;\n background-color: #a5dc86;\n display: block;\n border-radius: 2px;\n position: absolute;\n z-index: 2; }\n .swal2-icon.swal2-success [class^='swal2-success-line'][class$='tip'] {\n width: 25px;\n left: 14px;\n top: 46px;\n -webkit-transform: rotate(45deg);\n transform: rotate(45deg); }\n .swal2-icon.swal2-success [class^='swal2-success-line'][class$='long'] {\n width: 47px;\n right: 8px;\n top: 38px;\n -webkit-transform: rotate(-45deg);\n transform: rotate(-45deg); }\n\n.swal2-progresssteps {\n font-weight: 600;\n margin: 0 0 20px;\n padding: 0; }\n .swal2-progresssteps li {\n display: inline-block;\n position: relative; }\n .swal2-progresssteps .swal2-progresscircle {\n background: #3085d6;\n border-radius: 2em;\n color: #fff;\n height: 2em;\n line-height: 2em;\n text-align: center;\n width: 2em;\n z-index: 20; }\n .swal2-progresssteps .swal2-progresscircle:first-child {\n margin-left: 0; }\n .swal2-progresssteps .swal2-progresscircle:last-child {\n margin-right: 0; }\n .swal2-progresssteps .swal2-progresscircle.swal2-activeprogressstep {\n background: #3085d6; }\n .swal2-progresssteps .swal2-progresscircle.swal2-activeprogressstep ~ .swal2-progresscircle {\n background: #add8e6; }\n .swal2-progresssteps .swal2-progresscircle.swal2-activeprogressstep ~ .swal2-progressline {\n background: #add8e6; }\n .swal2-progresssteps .swal2-progressline {\n background: #3085d6;\n height: .4em;\n margin: 0 -1px;\n z-index: 10; }\n\n[class^='swal2'] {\n -webkit-tap-highlight-color: transparent; }\n\n@-webkit-keyframes showSweetToast {\n 0% {\n -webkit-transform: translateY(-10px) rotateZ(2deg);\n transform: translateY(-10px) rotateZ(2deg);\n opacity: 0; }\n 33% {\n -webkit-transform: translateY(0) rotateZ(-2deg);\n transform: translateY(0) rotateZ(-2deg);\n opacity: .5; }\n 66% {\n -webkit-transform: translateY(5px) rotateZ(2deg);\n transform: translateY(5px) rotateZ(2deg);\n opacity: .7; }\n 100% {\n -webkit-transform: translateY(0) rotateZ(0);\n transform: translateY(0) rotateZ(0);\n opacity: 1; } }\n\n@keyframes showSweetToast {\n 0% {\n -webkit-transform: translateY(-10px) rotateZ(2deg);\n transform: translateY(-10px) rotateZ(2deg);\n opacity: 0; }\n 33% {\n -webkit-transform: translateY(0) rotateZ(-2deg);\n transform: translateY(0) rotateZ(-2deg);\n opacity: .5; }\n 66% {\n -webkit-transform: translateY(5px) rotateZ(2deg);\n transform: translateY(5px) rotateZ(2deg);\n opacity: .7; }\n 100% {\n -webkit-transform: translateY(0) rotateZ(0);\n transform: translateY(0) rotateZ(0);\n opacity: 1; } }\n\n@-webkit-keyframes hideSweetToast {\n 0% {\n opacity: 1; }\n 33% {\n opacity: .5; }\n 100% {\n -webkit-transform: rotateZ(1deg);\n transform: rotateZ(1deg);\n opacity: 0; } }\n\n@keyframes hideSweetToast {\n 0% {\n opacity: 1; }\n 33% {\n opacity: .5; }\n 100% {\n -webkit-transform: rotateZ(1deg);\n transform: rotateZ(1deg);\n opacity: 0; } }\n\n@-webkit-keyframes showSweetAlert {\n 0% {\n -webkit-transform: scale(0.7);\n transform: scale(0.7); }\n 45% {\n -webkit-transform: scale(1.05);\n transform: scale(1.05); }\n 80% {\n -webkit-transform: scale(0.95);\n transform: scale(0.95); }\n 100% {\n -webkit-transform: scale(1);\n transform: scale(1); } }\n\n@keyframes showSweetAlert {\n 0% {\n -webkit-transform: scale(0.7);\n transform: scale(0.7); }\n 45% {\n -webkit-transform: scale(1.05);\n transform: scale(1.05); }\n 80% {\n -webkit-transform: scale(0.95);\n transform: scale(0.95); }\n 100% {\n -webkit-transform: scale(1);\n transform: scale(1); } }\n\n@-webkit-keyframes hideSweetAlert {\n 0% {\n -webkit-transform: scale(1);\n transform: scale(1);\n opacity: 1; }\n 100% {\n -webkit-transform: scale(0.5);\n transform: scale(0.5);\n opacity: 0; } }\n\n@keyframes hideSweetAlert {\n 0% {\n -webkit-transform: scale(1);\n transform: scale(1);\n opacity: 1; }\n 100% {\n -webkit-transform: scale(0.5);\n transform: scale(0.5);\n opacity: 0; } }\n\n.swal2-show {\n -webkit-animation: showSweetAlert .3s;\n animation: showSweetAlert .3s; }\n .swal2-show.swal2-toast {\n -webkit-animation: showSweetToast .5s;\n animation: showSweetToast .5s; }\n .swal2-show.swal2-noanimation {\n -webkit-animation: none;\n animation: none; }\n\n.swal2-hide {\n -webkit-animation: hideSweetAlert .15s forwards;\n animation: hideSweetAlert .15s forwards; }\n .swal2-hide.swal2-toast {\n -webkit-animation: hideSweetToast .2s forwards;\n animation: hideSweetToast .2s forwards; }\n .swal2-hide.swal2-noanimation {\n -webkit-animation: none;\n animation: none; }\n\n[dir='rtl'] .swal2-close {\n left: 8px;\n right: auto; }\n\n@-webkit-keyframes animate-success-tip {\n 0% {\n width: 0;\n left: 1px;\n top: 19px; }\n 54% {\n width: 0;\n left: 1px;\n top: 19px; }\n 70% {\n width: 50px;\n left: -8px;\n top: 37px; }\n 84% {\n width: 17px;\n left: 21px;\n top: 48px; }\n 100% {\n width: 25px;\n left: 14px;\n top: 45px; } }\n\n@keyframes animate-success-tip {\n 0% {\n width: 0;\n left: 1px;\n top: 19px; }\n 54% {\n width: 0;\n left: 1px;\n top: 19px; }\n 70% {\n width: 50px;\n left: -8px;\n top: 37px; }\n 84% {\n width: 17px;\n left: 21px;\n top: 48px; }\n 100% {\n width: 25px;\n left: 14px;\n top: 45px; } }\n\n@-webkit-keyframes animate-success-long {\n 0% {\n width: 0;\n right: 46px;\n top: 54px; }\n 65% {\n width: 0;\n right: 46px;\n top: 54px; }\n 84% {\n width: 55px;\n right: 0;\n top: 35px; }\n 100% {\n width: 47px;\n right: 8px;\n top: 38px; } }\n\n@keyframes animate-success-long {\n 0% {\n width: 0;\n right: 46px;\n top: 54px; }\n 65% {\n width: 0;\n right: 46px;\n top: 54px; }\n 84% {\n width: 55px;\n right: 0;\n top: 35px; }\n 100% {\n width: 47px;\n right: 8px;\n top: 38px; } }\n\n@-webkit-keyframes animate-toast-success-tip {\n 0% {\n width: 0;\n left: 1px;\n top: 9px; }\n 54% {\n width: 0;\n left: 1px;\n top: 9px; }\n 70% {\n width: 24px;\n left: -4px;\n top: 17px; }\n 84% {\n width: 8px;\n left: 10px;\n top: 20px; }\n 100% {\n width: 12px;\n left: 3px;\n top: 18px; } }\n\n@keyframes animate-toast-success-tip {\n 0% {\n width: 0;\n left: 1px;\n top: 9px; }\n 54% {\n width: 0;\n left: 1px;\n top: 9px; }\n 70% {\n width: 24px;\n left: -4px;\n top: 17px; }\n 84% {\n width: 8px;\n left: 10px;\n top: 20px; }\n 100% {\n width: 12px;\n left: 3px;\n top: 18px; } }\n\n@-webkit-keyframes animate-toast-success-long {\n 0% {\n width: 0;\n right: 22px;\n top: 26px; }\n 65% {\n width: 0;\n right: 22px;\n top: 26px; }\n 84% {\n width: 26px;\n right: 0;\n top: 15px; }\n 100% {\n width: 22px;\n right: 3px;\n top: 15px; } }\n\n@keyframes animate-toast-success-long {\n 0% {\n width: 0;\n right: 22px;\n top: 26px; }\n 65% {\n width: 0;\n right: 22px;\n top: 26px; }\n 84% {\n width: 26px;\n right: 0;\n top: 15px; }\n 100% {\n width: 22px;\n right: 3px;\n top: 15px; } }\n\n@-webkit-keyframes rotatePlaceholder {\n 0% {\n -webkit-transform: rotate(-45deg);\n transform: rotate(-45deg); }\n 5% {\n -webkit-transform: rotate(-45deg);\n transform: rotate(-45deg); }\n 12% {\n -webkit-transform: rotate(-405deg);\n transform: rotate(-405deg); }\n 100% {\n -webkit-transform: rotate(-405deg);\n transform: rotate(-405deg); } }\n\n@keyframes rotatePlaceholder {\n 0% {\n -webkit-transform: rotate(-45deg);\n transform: rotate(-45deg); }\n 5% {\n -webkit-transform: rotate(-45deg);\n transform: rotate(-45deg); }\n 12% {\n -webkit-transform: rotate(-405deg);\n transform: rotate(-405deg); }\n 100% {\n -webkit-transform: rotate(-405deg);\n transform: rotate(-405deg); } }\n\n.swal2-animate-success-line-tip {\n -webkit-animation: animate-success-tip .75s;\n animation: animate-success-tip .75s; }\n\n.swal2-animate-success-line-long {\n -webkit-animation: animate-success-long .75s;\n animation: animate-success-long .75s; }\n\n.swal2-success.swal2-animate-success-icon .swal2-success-circular-line-right {\n -webkit-animation: rotatePlaceholder 4.25s ease-in;\n animation: rotatePlaceholder 4.25s ease-in; }\n\n@-webkit-keyframes animate-error-icon {\n 0% {\n -webkit-transform: rotateX(100deg);\n transform: rotateX(100deg);\n opacity: 0; }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n opacity: 1; } }\n\n@keyframes animate-error-icon {\n 0% {\n -webkit-transform: rotateX(100deg);\n transform: rotateX(100deg);\n opacity: 0; }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n opacity: 1; } }\n\n.swal2-animate-error-icon {\n -webkit-animation: animate-error-icon .5s;\n animation: animate-error-icon .5s; }\n\n@-webkit-keyframes animate-x-mark {\n 0% {\n -webkit-transform: scale(0.4);\n transform: scale(0.4);\n margin-top: 26px;\n opacity: 0; }\n 50% {\n -webkit-transform: scale(0.4);\n transform: scale(0.4);\n margin-top: 26px;\n opacity: 0; }\n 80% {\n -webkit-transform: scale(1.15);\n transform: scale(1.15);\n margin-top: -6px; }\n 100% {\n -webkit-transform: scale(1);\n transform: scale(1);\n margin-top: 0;\n opacity: 1; } }\n\n@keyframes animate-x-mark {\n 0% {\n -webkit-transform: scale(0.4);\n transform: scale(0.4);\n margin-top: 26px;\n opacity: 0; }\n 50% {\n -webkit-transform: scale(0.4);\n transform: scale(0.4);\n margin-top: 26px;\n opacity: 0; }\n 80% {\n -webkit-transform: scale(1.15);\n transform: scale(1.15);\n margin-top: -6px; }\n 100% {\n -webkit-transform: scale(1);\n transform: scale(1);\n margin-top: 0;\n opacity: 1; } }\n\n.swal2-animate-x-mark {\n -webkit-animation: animate-x-mark .5s;\n animation: animate-x-mark .5s; }\n\n@-webkit-keyframes rotate-loading {\n 0% {\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg); }\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg); } }\n\n@keyframes rotate-loading {\n 0% {\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg); }\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg); } }\n"; var defaultParams = { title: '', titleText: '', text: '', html: '', type: null, toast: false, customClass: '', target: 'body', backdrop: true, animation: true, allowOutsideClick: true, allowEscapeKey: true, allowEnterKey: true, showConfirmButton: true, showCancelButton: false, preConfirm: null, confirmButtonText: 'OK', confirmButtonAriaLabel: '', confirmButtonColor: '#3085d6', confirmButtonClass: null, cancelButtonText: 'Cancel', cancelButtonAriaLabel: '', cancelButtonColor: '#aaa', cancelButtonClass: null, buttonsStyling: true, reverseButtons: false, focusConfirm: true, focusCancel: false, showCloseButton: false, closeButtonAriaLabel: 'Close this dialog', showLoaderOnConfirm: false, imageUrl: null, imageWidth: null, imageHeight: null, imageAlt: '', imageClass: null, timer: null, width: 500, padding: 20, background: '#fff', input: null, inputPlaceholder: '', inputValue: '', inputOptions: {}, inputAutoTrim: true, inputClass: null, inputAttributes: {}, inputValidator: null, grow: false, position: 'center', progressSteps: [], currentProgressStep: null, progressStepsDistance: '40px', onBeforeOpen: null, onOpen: null, onClose: null, useRejections: false, expectRejections: false }; var deprecatedParams = ['useRejections', 'expectRejections']; var swalPrefix = 'swal2-'; var prefix = function prefix(items) { var result = {}; for (var i in items) { result[items[i]] = swalPrefix + items[i]; } return result; }; var swalClasses = prefix(['container', 'shown', 'iosfix', 'popup', 'modal', 'no-backdrop', 'toast', 'toast-shown', 'overlay', 'fade', 'show', 'hide', 'noanimation', 'close', 'title', 'content', 'contentwrapper', 'buttonswrapper', 'confirm', 'cancel', 'icon', 'image', 'input', 'has-input', 'file', 'range', 'select', 'radio', 'checkbox', 'textarea', 'inputerror', 'validationerror', 'progresssteps', 'activeprogressstep', 'progresscircle', 'progressline', 'loading', 'styled', 'top', 'top-start', 'top-end', 'top-left', 'top-right', 'center', 'center-start', 'center-end', 'center-left', 'center-right', 'bottom', 'bottom-start', 'bottom-end', 'bottom-left', 'bottom-right', 'grow-row', 'grow-column', 'grow-fullscreen']); var iconTypes = prefix(['success', 'warning', 'info', 'question', 'error']); var consolePrefix = 'SweetAlert2:'; /* * Set hover, active and focus-states for buttons (source: http://www.sitepoint.com/javascript-generate-lighter-darker-color) */ var colorLuminance = function colorLuminance(hex, lum) { // Validate hex string hex = String(hex).replace(/[^0-9a-f]/gi, ''); if (hex.length < 6) { hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2]; } lum = lum || 0; // Convert to decimal and change luminosity var rgb = '#'; for (var i = 0; i < 3; i++) { var c = parseInt(hex.substr(i * 2, 2), 16); c = Math.round(Math.min(Math.max(0, c + c * lum), 255)).toString(16); rgb += ('00' + c).substr(c.length); } return rgb; }; /** * Filter the unique values into a new array * @param arr */ var uniqueArray = function uniqueArray(arr) { var result = []; for (var i in arr) { if (result.indexOf(arr[i]) === -1) { result.push(arr[i]); } } return result; }; /** * Standardise console warnings * @param message */ var warn = function warn(message) { console.warn(consolePrefix + ' ' + message); }; /** * Standardise console errors * @param message */ var error = function error(message) { console.error(consolePrefix + ' ' + message); }; /** * Private global state for `warnOnce` * @type {Array} * @private */ var previousWarnOnceMessages = []; /** * Show a console warning, but only if it hasn't already been shown * @param message */ var warnOnce = function warnOnce(message) { if (!(previousWarnOnceMessages.indexOf(message) !== -1)) { previousWarnOnceMessages.push(message); warn(message); } }; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var popupParams = _extends({}, defaultParams); var queue = []; var previousWindowKeyDown = void 0; var windowOnkeydownOverridden = void 0; /* * Check for the existence of Promise * Hopefully to avoid many github issues */ if (typeof Promise === 'undefined') { error('This package requires a Promise library, please include a shim to enable it in this browser (See: https://github.com/limonte/sweetalert2/wiki/Migration-from-SweetAlert-to-SweetAlert2#1-ie-support)'); } /** * Show relevant warnings for given params * * @param params */ var showWarningsForParams = function showWarningsForParams(params) { for (var param in params) { if (!sweetAlert$1.isValidParameter(param)) { warn('Unknown parameter "' + param + '"'); } if (sweetAlert$1.isDeprecatedParameter(param)) { warnOnce('The parameter "' + param + '" is deprecated and will be removed in the next major release.'); } } }; /** * Set type, text and actions on popup * * @param params * @returns {boolean} */ var setParameters = function setParameters(params) { // If a custom element is set, determine if it is valid if (typeof params.target === 'string' && !document.querySelector(params.target) || typeof params.target !== 'string' && !params.target.appendChild) { warn('Target parameter is not valid, defaulting to "body"'); params.target = 'body'; } var popup = void 0; var oldPopup = getPopup(); var targetElement = typeof params.target === 'string' ? document.querySelector(params.target) : params.target; // If the model target has changed, refresh the popup if (oldPopup && targetElement && oldPopup.parentNode !== targetElement.parentNode) { popup = init(params); } else { popup = oldPopup || init(params); } // Set popup width var popupWidth = params.width === defaultParams.width && params.toast ? 'auto' : params.width; popup.style.width = typeof popupWidth === 'number' ? popupWidth + 'px' : popupWidth; var popupPadding = params.padding === defaultParams.padding && params.toast ? 'inherit' : params.padding; popup.style.padding = typeof popupPadding === 'number' ? popupPadding + 'px' : popupPadding; popup.style.background = params.background; var successIconParts = popup.querySelectorAll('[class^=swal2-success-circular-line], .swal2-success-fix'); for (var i = 0; i < successIconParts.length; i++) { successIconParts[i].style.background = params.background; } var container = getContainer(); var title = getTitle(); var content = getContent(); var buttonsWrapper = getButtonsWrapper(); var confirmButton = getConfirmButton(); var cancelButton = getCancelButton(); var closeButton = getCloseButton(); // Title if (params.titleText) { title.innerText = params.titleText; } else { title.innerHTML = params.title.split('\n').join('
    '); } if (!params.backdrop) { addClass([document.documentElement, document.body], swalClasses['no-backdrop']); } // Content if (params.text || params.html) { if (_typeof(params.html) === 'object') { content.innerHTML = ''; if (0 in params.html) { for (var _i = 0; _i in params.html; _i++) { content.appendChild(params.html[_i].cloneNode(true)); } } else { content.appendChild(params.html.cloneNode(true)); } } else if (params.html) { content.innerHTML = params.html; } else if (params.text) { content.textContent = params.text; } show(content); } else { hide(content); } // Position if (params.position in swalClasses) { addClass(container, swalClasses[params.position]); } // Grow if (params.grow && typeof params.grow === 'string') { var growClass = 'grow-' + params.grow; if (growClass in swalClasses) { addClass(container, swalClasses[growClass]); } } // Close button if (params.showCloseButton) { closeButton.setAttribute('aria-label', params.closeButtonAriaLabel); show(closeButton); } else { hide(closeButton); } // Default Class popup.className = swalClasses.popup; if (params.toast) { addClass([document.documentElement, document.body], swalClasses['toast-shown']); addClass(popup, swalClasses.toast); } else { addClass(popup, swalClasses.modal); } // Custom Class if (params.customClass) { addClass(popup, params.customClass); } // Progress steps var progressStepsContainer = getProgressSteps(); var currentProgressStep = parseInt(params.currentProgressStep === null ? sweetAlert$1.getQueueStep() : params.currentProgressStep, 10); if (params.progressSteps.length) { show(progressStepsContainer); empty(progressStepsContainer); if (currentProgressStep >= params.progressSteps.length) { warn('Invalid currentProgressStep parameter, it should be less than progressSteps.length ' + '(currentProgressStep like JS arrays starts from 0)'); } params.progressSteps.forEach(function (step, index) { var circle = document.createElement('li'); addClass(circle, swalClasses.progresscircle); circle.innerHTML = step; if (index === currentProgressStep) { addClass(circle, swalClasses.activeprogressstep); } progressStepsContainer.appendChild(circle); if (index !== params.progressSteps.length - 1) { var line = document.createElement('li'); addClass(line, swalClasses.progressline); line.style.width = params.progressStepsDistance; progressStepsContainer.appendChild(line); } }); } else { hide(progressStepsContainer); } // Icon var icons = getIcons(); for (var _i2 = 0; _i2 < icons.length; _i2++) { hide(icons[_i2]); } if (params.type) { var validType = false; for (var iconType in iconTypes) { if (params.type === iconType) { validType = true; break; } } if (!validType) { error('Unknown alert type: ' + params.type); return false; } var icon = popup.querySelector('.' + swalClasses.icon + '.' + iconTypes[params.type]); show(icon); // Animate icon if (params.animation) { switch (params.type) { case 'success': addClass(icon, 'swal2-animate-success-icon'); addClass(icon.querySelector('.swal2-success-line-tip'), 'swal2-animate-success-line-tip'); addClass(icon.querySelector('.swal2-success-line-long'), 'swal2-animate-success-line-long'); break; case 'error': addClass(icon, 'swal2-animate-error-icon'); addClass(icon.querySelector('.swal2-x-mark'), 'swal2-animate-x-mark'); break; default: break; } } } // Custom image var image = getImage(); if (params.imageUrl) { image.setAttribute('src', params.imageUrl); image.setAttribute('alt', params.imageAlt); show(image); if (params.imageWidth) { image.setAttribute('width', params.imageWidth); } else { image.removeAttribute('width'); } if (params.imageHeight) { image.setAttribute('height', params.imageHeight); } else { image.removeAttribute('height'); } image.className = swalClasses.image; if (params.imageClass) { addClass(image, params.imageClass); } } else { hide(image); } // Cancel button if (params.showCancelButton) { cancelButton.style.display = 'inline-block'; } else { hide(cancelButton); } // Confirm button if (params.showConfirmButton) { removeStyleProperty(confirmButton, 'display'); } else { hide(confirmButton); } // Buttons wrapper if (!params.showConfirmButton && !params.showCancelButton) { hide(buttonsWrapper); } else { show(buttonsWrapper); } // Edit text on confirm and cancel buttons confirmButton.innerHTML = params.confirmButtonText; cancelButton.innerHTML = params.cancelButtonText; // ARIA labels for confirm and cancel buttons confirmButton.setAttribute('aria-label', params.confirmButtonAriaLabel); cancelButton.setAttribute('aria-label', params.cancelButtonAriaLabel); // Set buttons to selected background colors if (params.buttonsStyling) { confirmButton.style.backgroundColor = params.confirmButtonColor; cancelButton.style.backgroundColor = params.cancelButtonColor; } // Add buttons custom classes confirmButton.className = swalClasses.confirm; addClass(confirmButton, params.confirmButtonClass); cancelButton.className = swalClasses.cancel; addClass(cancelButton, params.cancelButtonClass); // Buttons styling if (params.buttonsStyling) { addClass([confirmButton, cancelButton], swalClasses.styled); } else { removeClass([confirmButton, cancelButton], swalClasses.styled); confirmButton.style.backgroundColor = confirmButton.style.borderLeftColor = confirmButton.style.borderRightColor = ''; cancelButton.style.backgroundColor = cancelButton.style.borderLeftColor = cancelButton.style.borderRightColor = ''; } // CSS animation if (params.animation === true) { removeClass(popup, swalClasses.noanimation); } else { addClass(popup, swalClasses.noanimation); } // showLoaderOnConfirm && preConfirm if (params.showLoaderOnConfirm && !params.preConfirm) { warn('showLoaderOnConfirm is set to true, but preConfirm is not defined.\n' + 'showLoaderOnConfirm should be used together with preConfirm, see usage example:\n' + 'https://limonte.github.io/sweetalert2/#ajax-request'); } }; /** * Animations * * @param animation * @param onBeforeOpen * @param onComplete */ var openPopup = function openPopup(animation, onBeforeOpen, onComplete) { var container = getContainer(); var popup = getPopup(); if (onBeforeOpen !== null && typeof onBeforeOpen === 'function') { onBeforeOpen(popup); } if (animation) { addClass(popup, swalClasses.show); addClass(container, swalClasses.fade); removeClass(popup, swalClasses.hide); } else { removeClass(popup, swalClasses.fade); } show(popup); // scrolling is 'hidden' until animation is done, after that 'auto' container.style.overflowY = 'hidden'; if (animationEndEvent && !hasClass(popup, swalClasses.noanimation)) { popup.addEventListener(animationEndEvent, function swalCloseEventFinished() { popup.removeEventListener(animationEndEvent, swalCloseEventFinished); container.style.overflowY = 'auto'; }); } else { container.style.overflowY = 'auto'; } addClass([document.documentElement, document.body, container], swalClasses.shown); if (isModal()) { fixScrollbar(); iOSfix(); } states.previousActiveElement = document.activeElement; if (onComplete !== null && typeof onComplete === 'function') { setTimeout(function () { onComplete(popup); }); } }; var fixScrollbar = function fixScrollbar() { // for queues, do not do this more than once if (states.previousBodyPadding !== null) { return; } // if the body has overflow if (document.body.scrollHeight > window.innerHeight) { // add padding so the content doesn't shift after removal of scrollbar states.previousBodyPadding = document.body.style.paddingRight; document.body.style.paddingRight = measureScrollbar() + 'px'; } }; var undoScrollbar = function undoScrollbar() { if (states.previousBodyPadding !== null) { document.body.style.paddingRight = states.previousBodyPadding; states.previousBodyPadding = null; } }; // Fix iOS scrolling http://stackoverflow.com/q/39626302/1331425 var iOSfix = function iOSfix() { var iOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream; if (iOS && !hasClass(document.body, swalClasses.iosfix)) { var offset = document.body.scrollTop; document.body.style.top = offset * -1 + 'px'; addClass(document.body, swalClasses.iosfix); } }; var undoIOSfix = function undoIOSfix() { if (hasClass(document.body, swalClasses.iosfix)) { var offset = parseInt(document.body.style.top, 10); removeClass(document.body, swalClasses.iosfix); document.body.style.top = ''; document.body.scrollTop = offset * -1; } }; // SweetAlert entry point var sweetAlert$1 = function sweetAlert() { for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } // Prevent run in Node env if (typeof window === 'undefined') { return; } if (typeof args[0] === 'undefined') { error('SweetAlert2 expects at least 1 attribute!'); return false; } var params = _extends({}, popupParams); switch (_typeof(args[0])) { case 'string': params.title = args[0]; params.html = args[1]; params.type = args[2]; break; case 'object': showWarningsForParams(args[0]); _extends(params, args[0]); params.extraParams = args[0].extraParams; if (params.input === 'email' && params.inputValidator === null) { var inputValidator = function inputValidator(email) { return new Promise(function (resolve, reject) { var emailRegex = /^[a-zA-Z0-9.+_-]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9-]{2,24}$/; if (emailRegex.test(email)) { resolve(); } else { reject('Invalid email address'); } }); }; params.inputValidator = params.expectRejections ? inputValidator : sweetAlert.adaptInputValidator(inputValidator); } if (params.input === 'url' && params.inputValidator === null) { var _inputValidator = function _inputValidator(url) { return new Promise(function (resolve, reject) { // taken from https://stackoverflow.com/a/3809435/1331425 var urlRegex = /^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_+.~#?&//=]*)$/; if (urlRegex.test(url)) { resolve(); } else { reject('Invalid URL'); } }); }; params.inputValidator = params.expectRejections ? _inputValidator : sweetAlert.adaptInputValidator(_inputValidator); } break; default: error('Unexpected type of argument! Expected "string" or "object", got ' + _typeof(args[0])); return false; } setParameters(params); var container = getContainer(); var popup = getPopup(); return new Promise(function (resolve, reject) { // functions to handle all resolving/rejecting/settling var succeedWith = function succeedWith(value) { sweetAlert.closePopup(params.onClose); if (params.useRejections) { resolve(value); } else { resolve({ value: value }); } }; var dismissWith = function dismissWith(dismiss) { sweetAlert.closePopup(params.onClose); if (params.useRejections) { reject(dismiss); } else { resolve({ dismiss: dismiss }); } }; var errorWith = function errorWith(error$$1) { sweetAlert.closePopup(params.onClose); reject(error$$1); }; // Close on timer if (params.timer) { popup.timeout = setTimeout(function () { return dismissWith('timer'); }, params.timer); } // Get input element by specified type or, if type isn't specified, by params.input var getInput = function getInput(inputType) { inputType = inputType || params.input; if (!inputType) { return null; } switch (inputType) { case 'select': case 'textarea': case 'file': return getChildByClass(popup, swalClasses[inputType]); case 'checkbox': return popup.querySelector('.' + swalClasses.checkbox + ' input'); case 'radio': return popup.querySelector('.' + swalClasses.radio + ' input:checked') || popup.querySelector('.' + swalClasses.radio + ' input:first-child'); case 'range': return popup.querySelector('.' + swalClasses.range + ' input'); default: return getChildByClass(popup, swalClasses.input); } }; // Get the value of the popup input var getInputValue = function getInputValue() { var input = getInput(); if (!input) { return null; } switch (params.input) { case 'checkbox': return input.checked ? 1 : 0; case 'radio': return input.checked ? input.value : null; case 'file': return input.files.length ? input.files[0] : null; default: return params.inputAutoTrim ? input.value.trim() : input.value; } }; // input autofocus if (params.input) { setTimeout(function () { var input = getInput(); if (input) { focusInput(input); } }, 0); } var confirm = function confirm(value) { if (params.showLoaderOnConfirm) { sweetAlert.showLoading(); } if (params.preConfirm) { sweetAlert.resetValidationError(); var preConfirmPromise = Promise.resolve().then(function () { return params.preConfirm(value, params.extraParams); }); if (params.expectRejections) { preConfirmPromise.then(function (preConfirmValue) { return succeedWith(preConfirmValue || value); }, function (validationError) { sweetAlert.hideLoading(); if (validationError) { sweetAlert.showValidationError(validationError); } }); } else { preConfirmPromise.then(function (preConfirmValue) { if (isVisible(getValidationError())) { sweetAlert.hideLoading(); } else { succeedWith(preConfirmValue || value); } }, function (error$$1) { return errorWith(error$$1); }); } } else { succeedWith(value); } }; // Mouse interactions var onButtonEvent = function onButtonEvent(event) { var e = event || window.event; var target = e.target || e.srcElement; var confirmButton = getConfirmButton(); var cancelButton = getCancelButton(); var targetedConfirm = confirmButton && (confirmButton === target || confirmButton.contains(target)); var targetedCancel = cancelButton && (cancelButton === target || cancelButton.contains(target)); switch (e.type) { case 'mouseover': case 'mouseup': if (params.buttonsStyling) { if (targetedConfirm) { confirmButton.style.backgroundColor = colorLuminance(params.confirmButtonColor, -0.1); } else if (targetedCancel) { cancelButton.style.backgroundColor = colorLuminance(params.cancelButtonColor, -0.1); } } break; case 'mouseout': if (params.buttonsStyling) { if (targetedConfirm) { confirmButton.style.backgroundColor = params.confirmButtonColor; } else if (targetedCancel) { cancelButton.style.backgroundColor = params.cancelButtonColor; } } break; case 'mousedown': if (params.buttonsStyling) { if (targetedConfirm) { confirmButton.style.backgroundColor = colorLuminance(params.confirmButtonColor, -0.2); } else if (targetedCancel) { cancelButton.style.backgroundColor = colorLuminance(params.cancelButtonColor, -0.2); } } break; case 'click': // Clicked 'confirm' if (targetedConfirm && sweetAlert.isVisible()) { sweetAlert.disableButtons(); if (params.input) { var inputValue = getInputValue(); if (params.inputValidator) { sweetAlert.disableInput(); var validationPromise = Promise.resolve().then(function () { return params.inputValidator(inputValue, params.extraParams); }); if (params.expectRejections) { validationPromise.then(function () { sweetAlert.enableButtons(); sweetAlert.enableInput(); confirm(inputValue); }, function (validationError) { sweetAlert.enableButtons(); sweetAlert.enableInput(); if (validationError) { sweetAlert.showValidationError(validationError); } }); } else { validationPromise.then(function (validationError) { sweetAlert.enableButtons(); sweetAlert.enableInput(); if (validationError) { sweetAlert.showValidationError(validationError); } else { confirm(inputValue); } }, function (error$$1) { return errorWith(error$$1); }); } } else { confirm(inputValue); } } else { confirm(true); } // Clicked 'cancel' } else if (targetedCancel && sweetAlert.isVisible()) { sweetAlert.disableButtons(); dismissWith('cancel'); } break; default: } }; var buttons = popup.querySelectorAll('button'); for (var i = 0; i < buttons.length; i++) { buttons[i].onclick = onButtonEvent; buttons[i].onmouseover = onButtonEvent; buttons[i].onmouseout = onButtonEvent; buttons[i].onmousedown = onButtonEvent; } // Closing popup by close button getCloseButton().onclick = function () { dismissWith('close'); }; if (params.toast) { // Closing popup by overlay click popup.onclick = function (e) { if (e.target !== popup || params.showConfirmButton || params.showCancelButton) { return; } if (params.allowOutsideClick) { sweetAlert.closePopup(params.onClose); dismissWith('overlay'); } }; } else { var ignoreOutsideClick = false; // Ignore click events that had mousedown on the popup but mouseup on the container // This can happen when the user drags a slider popup.onmousedown = function () { container.onmouseup = function (e) { container.onmouseup = undefined; // We only check if the mouseup target is the container because usually it doesn't // have any other direct children aside of the popup if (e.target === container) { ignoreOutsideClick = true; } }; }; // Ignore click events that had mousedown on the container but mouseup on the popup container.onmousedown = function () { popup.onmouseup = function (e) { popup.onmouseup = undefined; // We also need to check if the mouseup target is a child of the popup if (e.target === popup || popup.contains(e.target)) { ignoreOutsideClick = true; } }; }; container.onclick = function (e) { if (ignoreOutsideClick) { ignoreOutsideClick = false; return; } if (e.target !== container) { return; } if (params.allowOutsideClick) { if (typeof params.allowOutsideClick === 'function') { if (params.allowOutsideClick()) { dismissWith('overlay'); } } else { dismissWith('overlay'); } } }; } var buttonsWrapper = getButtonsWrapper(); var confirmButton = getConfirmButton(); var cancelButton = getCancelButton(); // Reverse buttons (Confirm on the right side) if (params.reverseButtons) { confirmButton.parentNode.insertBefore(cancelButton, confirmButton); } else { confirmButton.parentNode.insertBefore(confirmButton, cancelButton); } // Focus handling var setFocus = function setFocus(index, increment) { var focusableElements = getFocusableElements(params.focusCancel); // search for visible elements and select the next possible match for (var _i3 = 0; _i3 < focusableElements.length; _i3++) { index = index + increment; // rollover to first item if (index === focusableElements.length) { index = 0; // go to last item } else if (index === -1) { index = focusableElements.length - 1; } // determine if element is visible var el = focusableElements[index]; if (isVisible(el)) { return el.focus(); } } }; var handleKeyDown = function handleKeyDown(event) { var e = event || window.event; var arrowKeys = ['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown', 'Left', 'Right', 'Up', 'Down' // IE11 ]; if (e.key === 'Enter' && !e.isComposing) { if (e.target === getInput()) { if (e.target.tagName.toLowerCase() === 'textarea') { return; // do not submit } sweetAlert.clickConfirm(); e.preventDefault(); } // TAB } else if (e.key === 'Tab') { var targetElement = e.target || e.srcElement; var focusableElements = getFocusableElements(params.focusCancel); var btnIndex = -1; // Find the button - note, this is a nodelist, not an array. for (var _i4 = 0; _i4 < focusableElements.length; _i4++) { if (targetElement === focusableElements[_i4]) { btnIndex = _i4; break; } } if (!e.shiftKey) { // Cycle to the next button setFocus(btnIndex, 1); } else { // Cycle to the prev button setFocus(btnIndex, -1); } e.stopPropagation(); e.preventDefault(); // ARROWS - switch focus between buttons } else if (arrowKeys.indexOf(e.key) !== -1) { // focus Cancel button if Confirm button is currently focused if (document.activeElement === confirmButton && isVisible(cancelButton)) { cancelButton.focus(); // and vice versa } else if (document.activeElement === cancelButton && isVisible(confirmButton)) { confirmButton.focus(); } // ESC } else if ((e.key === 'Escape' || e.key === 'Esc') && params.allowEscapeKey === true) { dismissWith('esc'); } }; if (params.toast && windowOnkeydownOverridden) { window.onkeydown = previousWindowKeyDown; windowOnkeydownOverridden = false; } if (!params.toast && !windowOnkeydownOverridden) { previousWindowKeyDown = window.onkeydown; windowOnkeydownOverridden = true; window.onkeydown = handleKeyDown; } // Loading state if (params.buttonsStyling) { confirmButton.style.borderLeftColor = params.confirmButtonColor; confirmButton.style.borderRightColor = params.confirmButtonColor; } /** * Show spinner instead of Confirm button and disable Cancel button */ sweetAlert.hideLoading = sweetAlert.disableLoading = function () { if (!params.showConfirmButton) { hide(confirmButton); if (!params.showCancelButton) { hide(getButtonsWrapper()); } } removeClass([popup, buttonsWrapper], swalClasses.loading); popup.removeAttribute('aria-busy'); popup.removeAttribute('data-loading'); confirmButton.disabled = false; cancelButton.disabled = false; }; sweetAlert.getTitle = function () { return getTitle(); }; sweetAlert.getContent = function () { return getContent(); }; sweetAlert.getInput = function () { return getInput(); }; sweetAlert.getImage = function () { return getImage(); }; sweetAlert.getButtonsWrapper = function () { return getButtonsWrapper(); }; sweetAlert.getConfirmButton = function () { return getConfirmButton(); }; sweetAlert.getCancelButton = function () { return getCancelButton(); }; sweetAlert.isLoading = function () { return isLoading(); }; sweetAlert.enableButtons = function () { confirmButton.disabled = false; cancelButton.disabled = false; }; sweetAlert.disableButtons = function () { confirmButton.disabled = true; cancelButton.disabled = true; }; sweetAlert.enableConfirmButton = function () { confirmButton.disabled = false; }; sweetAlert.disableConfirmButton = function () { confirmButton.disabled = true; }; sweetAlert.enableInput = function () { var input = getInput(); if (!input) { return false; } if (input.type === 'radio') { var radiosContainer = input.parentNode.parentNode; var radios = radiosContainer.querySelectorAll('input'); for (var _i5 = 0; _i5 < radios.length; _i5++) { radios[_i5].disabled = false; } } else { input.disabled = false; } }; sweetAlert.disableInput = function () { var input = getInput(); if (!input) { return false; } if (input && input.type === 'radio') { var radiosContainer = input.parentNode.parentNode; var radios = radiosContainer.querySelectorAll('input'); for (var _i6 = 0; _i6 < radios.length; _i6++) { radios[_i6].disabled = true; } } else { input.disabled = true; } }; // Show block with validation error sweetAlert.showValidationError = function (error$$1) { var validationError = getValidationError(); validationError.innerHTML = error$$1; show(validationError); var input = getInput(); if (input) { input.setAttribute('aria-invalid', true); input.setAttribute('aria-describedBy', swalClasses.validationerror); focusInput(input); addClass(input, swalClasses.inputerror); } }; // Hide block with validation error sweetAlert.resetValidationError = function () { var validationError = getValidationError(); hide(validationError); var input = getInput(); if (input) { input.removeAttribute('aria-invalid'); input.removeAttribute('aria-describedBy'); removeClass(input, swalClasses.inputerror); } }; sweetAlert.getProgressSteps = function () { return params.progressSteps; }; sweetAlert.setProgressSteps = function (progressSteps) { params.progressSteps = progressSteps; setParameters(params); }; sweetAlert.showProgressSteps = function () { show(getProgressSteps()); }; sweetAlert.hideProgressSteps = function () { hide(getProgressSteps()); }; sweetAlert.enableButtons(); sweetAlert.hideLoading(); sweetAlert.resetValidationError(); if (params.input) { addClass(document.body, swalClasses['has-input']); } // inputs var inputTypes = ['input', 'file', 'range', 'select', 'radio', 'checkbox', 'textarea']; var input = void 0; for (var _i7 = 0; _i7 < inputTypes.length; _i7++) { var inputClass = swalClasses[inputTypes[_i7]]; var inputContainer = getChildByClass(popup, inputClass); input = getInput(inputTypes[_i7]); // set attributes if (input) { for (var j in input.attributes) { if (input.attributes.hasOwnProperty(j)) { var attrName = input.attributes[j].name; if (attrName !== 'type' && attrName !== 'value') { input.removeAttribute(attrName); } } } for (var attr in params.inputAttributes) { input.setAttribute(attr, params.inputAttributes[attr]); } } // set class inputContainer.className = inputClass; if (params.inputClass) { addClass(inputContainer, params.inputClass); } hide(inputContainer); } var populateInputOptions = void 0; switch (params.input) { case 'text': case 'email': case 'password': case 'number': case 'tel': case 'url': input = getChildByClass(popup, swalClasses.input); input.value = params.inputValue; input.placeholder = params.inputPlaceholder; input.type = params.input; show(input); break; case 'file': input = getChildByClass(popup, swalClasses.file); input.placeholder = params.inputPlaceholder; input.type = params.input; show(input); break; case 'range': var range = getChildByClass(popup, swalClasses.range); var rangeInput = range.querySelector('input'); var rangeOutput = range.querySelector('output'); rangeInput.value = params.inputValue; rangeInput.type = params.input; rangeOutput.value = params.inputValue; show(range); break; case 'select': var select = getChildByClass(popup, swalClasses.select); select.innerHTML = ''; if (params.inputPlaceholder) { var placeholder = document.createElement('option'); placeholder.innerHTML = params.inputPlaceholder; placeholder.value = ''; placeholder.disabled = true; placeholder.selected = true; select.appendChild(placeholder); } populateInputOptions = function populateInputOptions(inputOptions) { for (var optionValue in inputOptions) { var option = document.createElement('option'); option.value = optionValue; option.innerHTML = inputOptions[optionValue]; if (params.inputValue.toString() === optionValue) { option.selected = true; } select.appendChild(option); } show(select); select.focus(); }; break; case 'radio': var radio = getChildByClass(popup, swalClasses.radio); radio.innerHTML = ''; populateInputOptions = function populateInputOptions(inputOptions) { for (var radioValue in inputOptions) { var radioInput = document.createElement('input'); var radioLabel = document.createElement('label'); var radioLabelSpan = document.createElement('span'); radioInput.type = 'radio'; radioInput.name = swalClasses.radio; radioInput.value = radioValue; if (params.inputValue.toString() === radioValue) { radioInput.checked = true; } radioLabelSpan.innerHTML = inputOptions[radioValue]; radioLabel.appendChild(radioInput); radioLabel.appendChild(radioLabelSpan); radioLabel.for = radioInput.id; radio.appendChild(radioLabel); } show(radio); var radios = radio.querySelectorAll('input'); if (radios.length) { radios[0].focus(); } }; break; case 'checkbox': var checkbox = getChildByClass(popup, swalClasses.checkbox); var checkboxInput = getInput('checkbox'); checkboxInput.type = 'checkbox'; checkboxInput.value = 1; checkboxInput.id = swalClasses.checkbox; checkboxInput.checked = Boolean(params.inputValue); var label = checkbox.getElementsByTagName('span'); if (label.length) { checkbox.removeChild(label[0]); } label = document.createElement('span'); label.innerHTML = params.inputPlaceholder; checkbox.appendChild(label); show(checkbox); break; case 'textarea': var textarea = getChildByClass(popup, swalClasses.textarea); textarea.value = params.inputValue; textarea.placeholder = params.inputPlaceholder; show(textarea); break; case null: break; default: error('Unexpected type of input! Expected "text", "email", "password", "number", "tel", "select", "radio", "checkbox", "textarea", "file" or "url", got "' + params.input + '"'); break; } if (params.input === 'select' || params.input === 'radio') { if (params.inputOptions instanceof Promise) { sweetAlert.showLoading(); params.inputOptions.then(function (inputOptions) { sweetAlert.hideLoading(); populateInputOptions(inputOptions); }); } else if (_typeof(params.inputOptions) === 'object') { populateInputOptions(params.inputOptions); } else { error('Unexpected type of inputOptions! Expected object or Promise, got ' + _typeof(params.inputOptions)); } } openPopup(params.animation, params.onBeforeOpen, params.onOpen); if (!params.toast) { if (!params.allowEnterKey) { if (document.activeElement) { document.activeElement.blur(); } } else if (params.focusCancel && isVisible(cancelButton)) { cancelButton.focus(); } else if (params.focusConfirm && isVisible(confirmButton)) { confirmButton.focus(); } else { setFocus(-1, 1); } } // fix scroll getContainer().scrollTop = 0; }); }; /* * Global function to determine if swal2 popup is shown */ sweetAlert$1.isVisible = function () { return !!getPopup(); }; /* * Global function for chaining sweetAlert popups */ sweetAlert$1.queue = function (steps) { queue = steps; var resetQueue = function resetQueue() { queue = []; document.body.removeAttribute('data-swal2-queue-step'); }; var queueResult = []; return new Promise(function (resolve, reject) { (function step(i, callback) { if (i < queue.length) { document.body.setAttribute('data-swal2-queue-step', i); sweetAlert$1(queue[i]).then(function (result) { if (typeof result.value !== 'undefined') { queueResult.push(result.value); step(i + 1, callback); } else { resetQueue(); resolve({ dismiss: result.dismiss }); } }); } else { resetQueue(); resolve({ value: queueResult }); } })(0); }); }; /* * Global function for getting the index of current popup in queue */ sweetAlert$1.getQueueStep = function () { return document.body.getAttribute('data-swal2-queue-step'); }; /* * Global function for inserting a popup to the queue */ sweetAlert$1.insertQueueStep = function (step, index) { if (index && index < queue.length) { return queue.splice(index, 0, step); } return queue.push(step); }; /* * Global function for deleting a popup from the queue */ sweetAlert$1.deleteQueueStep = function (index) { if (typeof queue[index] !== 'undefined') { queue.splice(index, 1); } }; /* * Global function to close sweetAlert */ sweetAlert$1.close = sweetAlert$1.closePopup = sweetAlert$1.closeModal = sweetAlert$1.closeToast = function (onComplete) { var container = getContainer(); var popup = getPopup(); if (!popup) { return; } removeClass(popup, swalClasses.show); addClass(popup, swalClasses.hide); clearTimeout(popup.timeout); if (!isToast()) { resetPrevState(); window.onkeydown = previousWindowKeyDown; windowOnkeydownOverridden = false; } var removePopupAndResetState = function removePopupAndResetState() { if (container.parentNode) { container.parentNode.removeChild(container); } removeClass([document.documentElement, document.body], [swalClasses.shown, swalClasses['no-backdrop'], swalClasses['has-input'], swalClasses['toast-shown']]); if (isModal()) { undoScrollbar(); undoIOSfix(); } }; // If animation is supported, animate if (animationEndEvent && !hasClass(popup, swalClasses.noanimation)) { popup.addEventListener(animationEndEvent, function swalCloseEventFinished() { popup.removeEventListener(animationEndEvent, swalCloseEventFinished); if (hasClass(popup, swalClasses.hide)) { removePopupAndResetState(); } }); } else { // Otherwise, remove immediately removePopupAndResetState(); } if (onComplete !== null && typeof onComplete === 'function') { setTimeout(function () { onComplete(popup); }); } }; /* * Global function to click 'Confirm' button */ sweetAlert$1.clickConfirm = function () { return getConfirmButton().click(); }; /* * Global function to click 'Cancel' button */ sweetAlert$1.clickCancel = function () { return getCancelButton().click(); }; /** * Show spinner instead of Confirm button and disable Cancel button */ sweetAlert$1.showLoading = sweetAlert$1.enableLoading = function () { var popup = getPopup(); if (!popup) { sweetAlert$1(''); } popup = getPopup(); var buttonsWrapper = getButtonsWrapper(); var confirmButton = getConfirmButton(); var cancelButton = getCancelButton(); show(buttonsWrapper); show(confirmButton, 'inline-block'); addClass([popup, buttonsWrapper], swalClasses.loading); confirmButton.disabled = true; cancelButton.disabled = true; popup.setAttribute('data-loading', true); popup.setAttribute('aria-busy', true); popup.focus(); }; /** * Is valid parameter * @param {String} paramName */ sweetAlert$1.isValidParameter = function (paramName) { return defaultParams.hasOwnProperty(paramName) || paramName === 'extraParams'; }; /** * Is deprecated parameter * @param {String} paramName */ sweetAlert$1.isDeprecatedParameter = function (paramName) { return deprecatedParams.indexOf(paramName) !== -1; }; /** * Set default params for each popup * @param {Object} userParams */ sweetAlert$1.setDefaults = function (userParams) { if (!userParams || (typeof userParams === 'undefined' ? 'undefined' : _typeof(userParams)) !== 'object') { return error('the argument for setDefaults() is required and has to be a object'); } showWarningsForParams(userParams); // assign valid params from userParams to popupParams for (var param in userParams) { if (sweetAlert$1.isValidParameter(param)) { popupParams[param] = userParams[param]; } } }; /** * Reset default params for each popup */ sweetAlert$1.resetDefaults = function () { popupParams = _extends({}, defaultParams); }; /** * Adapt a legacy inputValidator for use with expectRejections=false */ sweetAlert$1.adaptInputValidator = function (legacyValidator) { return function adaptedInputValidator(inputValue, extraParams) { return legacyValidator.call(this, inputValue, extraParams).then(function () { return undefined; }, function (validationError) { return validationError; }); }; }; sweetAlert$1.noop = function () {}; sweetAlert$1.version = '7.3.2'; sweetAlert$1.default = sweetAlert$1; /** * Set default params if `window._swalDefaults` is an object */ if (typeof window !== 'undefined' && _typeof(window._swalDefaults) === 'object') { sweetAlert$1.setDefaults(window._swalDefaults); } // Remember state in cases where opening and handling a modal will fiddle with it. var states = { previousActiveElement: null, previousBodyPadding: null // Detect Node env };var isNodeEnv = function isNodeEnv() { return typeof window === 'undefined' || typeof document === 'undefined'; }; /* * Add modal + overlay to DOM */ var init = function init(params) { // Clean up the old popup if it exists var c = getContainer(); if (c) { c.parentNode.removeChild(c); removeClass([document.documentElement, document.body], [swalClasses['no-backdrop'], swalClasses['has-input'], swalClasses['toast-shown']]); } if (isNodeEnv()) { error('SweetAlert2 requires document to initialize'); return; } var container = document.createElement('div'); container.className = swalClasses.container; container.innerHTML = sweetHTML; var targetElement = typeof params.target === 'string' ? document.querySelector(params.target) : params.target; targetElement.appendChild(container); var popup = getPopup(); var input = getChildByClass(popup, swalClasses.input); var file = getChildByClass(popup, swalClasses.file); var range = popup.querySelector('.' + swalClasses.range + ' input'); var rangeOutput = popup.querySelector('.' + swalClasses.range + ' output'); var select = getChildByClass(popup, swalClasses.select); var checkbox = popup.querySelector('.' + swalClasses.checkbox + ' input'); var textarea = getChildByClass(popup, swalClasses.textarea); // a11y popup.setAttribute('aria-live', params.toast ? 'polite' : 'assertive'); var resetValidationError = function resetValidationError() { sweetAlert$1.isVisible() && sweetAlert$1.resetValidationError(); }; input.oninput = resetValidationError; file.onchange = resetValidationError; select.onchange = resetValidationError; checkbox.onchange = resetValidationError; textarea.oninput = resetValidationError; range.oninput = function () { resetValidationError(); rangeOutput.value = range.value; }; range.onchange = function () { resetValidationError(); range.previousSibling.value = range.value; }; return popup; }; /* * Manipulate DOM */ var sweetHTML = ('\n \n').replace(/(^|\n)\s*/g, ''); var getContainer = function getContainer() { return document.body.querySelector('.' + swalClasses.container); }; var getPopup = function getPopup() { return getContainer() ? getContainer().querySelector('.' + swalClasses.popup) : null; }; var getIcons = function getIcons() { var popup = getPopup(); return popup.querySelectorAll('.' + swalClasses.icon); }; var elementByClass = function elementByClass(className) { return getContainer() ? getContainer().querySelector('.' + className) : null; }; var getTitle = function getTitle() { return elementByClass(swalClasses.title); }; var getContent = function getContent() { return elementByClass(swalClasses.content); }; var getImage = function getImage() { return elementByClass(swalClasses.image); }; var getProgressSteps = function getProgressSteps() { return elementByClass(swalClasses.progresssteps); }; var getValidationError = function getValidationError() { return elementByClass(swalClasses.validationerror); }; var getConfirmButton = function getConfirmButton() { return elementByClass(swalClasses.confirm); }; var getCancelButton = function getCancelButton() { return elementByClass(swalClasses.cancel); }; var getButtonsWrapper = function getButtonsWrapper() { return elementByClass(swalClasses.buttonswrapper); }; var getCloseButton = function getCloseButton() { return elementByClass(swalClasses.close); }; var getFocusableElements = function getFocusableElements() { var focusableElementsWithTabindex = Array.prototype.slice.call(getPopup().querySelectorAll('[tabindex]:not([tabindex="-1"]):not([tabindex="0"])')) // sort according to tabindex .sort(function (a, b) { a = parseInt(a.getAttribute('tabindex')); b = parseInt(b.getAttribute('tabindex')); if (a > b) { return 1; } else if (a < b) { return -1; } return 0; }); var otherFocusableElements = Array.prototype.slice.call(getPopup().querySelectorAll('button, input:not([type=hidden]), textarea, select, a, [tabindex="0"]')); return uniqueArray(focusableElementsWithTabindex.concat(otherFocusableElements)); }; var isModal = function isModal() { return !document.body.classList.contains(swalClasses['toast-shown']); }; var isToast = function isToast() { return document.body.classList.contains(swalClasses['toast-shown']); }; var isLoading = function isLoading() { return getPopup().hasAttribute('data-loading'); }; var hasClass = function hasClass(elem, className) { if (elem.classList) { return elem.classList.contains(className); } return false; }; var focusInput = function focusInput(input) { input.focus(); // place cursor at end of text in text input if (input.type !== 'file') { // http://stackoverflow.com/a/2345915/1331425 var val = input.value; input.value = ''; input.value = val; } }; var addOrRemoveClass = function addOrRemoveClass(target, classList, add) { if (!target || !classList) { return; } if (typeof classList === 'string') { classList = classList.split(/\s+/).filter(Boolean); } classList.forEach(function (className) { if (target.forEach) { target.forEach(function (elem) { add ? elem.classList.add(className) : elem.classList.remove(className); }); } else { add ? target.classList.add(className) : target.classList.remove(className); } }); }; var addClass = function addClass(target, classList) { addOrRemoveClass(target, classList, true); }; var removeClass = function removeClass(target, classList) { addOrRemoveClass(target, classList, false); }; var getChildByClass = function getChildByClass(elem, className) { for (var i = 0; i < elem.childNodes.length; i++) { if (hasClass(elem.childNodes[i], className)) { return elem.childNodes[i]; } } }; var show = function show(elem, display) { if (!display) { display = elem === getPopup() || elem === getButtonsWrapper() ? 'flex' : 'block'; } elem.style.opacity = ''; elem.style.display = display; }; var hide = function hide(elem) { elem.style.opacity = ''; elem.style.display = 'none'; }; var empty = function empty(elem) { while (elem.firstChild) { elem.removeChild(elem.firstChild); } }; // borrowed from jquery $(elem).is(':visible') implementation var isVisible = function isVisible(elem) { return elem && (elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length); }; var removeStyleProperty = function removeStyleProperty(elem, property) { if (elem.style.removeProperty) { elem.style.removeProperty(property); } else { elem.style.removeAttribute(property); } }; var animationEndEvent = function () { // Prevent run in Node env if (isNodeEnv()) { return false; } var testEl = document.createElement('div'); var transEndEventNames = { 'WebkitAnimation': 'webkitAnimationEnd', 'OAnimation': 'oAnimationEnd oanimationend', 'animation': 'animationend' }; for (var i in transEndEventNames) { if (transEndEventNames.hasOwnProperty(i) && typeof testEl.style[i] !== 'undefined') { return transEndEventNames[i]; } } return false; }(); // Reset previous window keydown handler and focued element var resetPrevState = function resetPrevState() { if (states.previousActiveElement && states.previousActiveElement.focus) { var x = window.scrollX; var y = window.scrollY; states.previousActiveElement.focus(); if (typeof x !== 'undefined' && typeof y !== 'undefined') { // IE doesn't have scrollX/scrollY support window.scrollTo(x, y); } } }; // Measure width of scrollbar // https://github.com/twbs/bootstrap/blob/master/js/modal.js#L279-L286 var measureScrollbar = function measureScrollbar() { var supportsTouch = 'ontouchstart' in window || navigator.msMaxTouchPoints; if (supportsTouch) { return 0; } var scrollDiv = document.createElement('div'); scrollDiv.style.width = '50px'; scrollDiv.style.height = '50px'; scrollDiv.style.overflow = 'scroll'; document.body.appendChild(scrollDiv); var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth; document.body.removeChild(scrollDiv); return scrollbarWidth; }; /** * Inject a string of CSS into the page header * * @param {String} css */ var injectCSS = function injectCSS() { var css = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; // Prevent run in Node env if (isNodeEnv()) { return false; } var head = document.head || document.getElementsByTagName('head')[0]; var style = document.createElement('style'); style.type = 'text/css'; head.appendChild(style); if (style.styleSheet) { style.styleSheet.cssText = css; } else { style.appendChild(document.createTextNode(css)); } }; injectCSS(styles); return sweetAlert$1; }))); if (typeof window !== 'undefined' && window.Sweetalert2) window.sweetAlert = window.swal = window.Sweetalert2; /** * Swiper 7.0.3 * Most modern mobile touch slider and framework with hardware accelerated transitions * https://swiperjs.com * * Copyright 2014-2021 Vladimir Kharlampidi * * Released under the MIT License * * Released on: September 3, 2021 */ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Swiper = factory()); }(this, (function () { 'use strict'; /** * SSR Window 4.0.0 * Better handling for window object in SSR environment * https://github.com/nolimits4web/ssr-window * * Copyright 2021, Vladimir Kharlampidi * * Licensed under MIT * * Released on: August 25, 2021 */ /* eslint-disable no-param-reassign */ function isObject$1(obj) { return obj !== null && typeof obj === 'object' && 'constructor' in obj && obj.constructor === Object; } function extend$1(target = {}, src = {}) { Object.keys(src).forEach(key => { if (typeof target[key] === 'undefined') target[key] = src[key];else if (isObject$1(src[key]) && isObject$1(target[key]) && Object.keys(src[key]).length > 0) { extend$1(target[key], src[key]); } }); } const ssrDocument = { body: {}, addEventListener() {}, removeEventListener() {}, activeElement: { blur() {}, nodeName: '' }, querySelector() { return null; }, querySelectorAll() { return []; }, getElementById() { return null; }, createEvent() { return { initEvent() {} }; }, createElement() { return { children: [], childNodes: [], style: {}, setAttribute() {}, getElementsByTagName() { return []; } }; }, createElementNS() { return {}; }, importNode() { return null; }, location: { hash: '', host: '', hostname: '', href: '', origin: '', pathname: '', protocol: '', search: '' } }; function getDocument() { const doc = typeof document !== 'undefined' ? document : {}; extend$1(doc, ssrDocument); return doc; } const ssrWindow = { document: ssrDocument, navigator: { userAgent: '' }, location: { hash: '', host: '', hostname: '', href: '', origin: '', pathname: '', protocol: '', search: '' }, history: { replaceState() {}, pushState() {}, go() {}, back() {} }, CustomEvent: function CustomEvent() { return this; }, addEventListener() {}, removeEventListener() {}, getComputedStyle() { return { getPropertyValue() { return ''; } }; }, Image() {}, Date() {}, screen: {}, setTimeout() {}, clearTimeout() {}, matchMedia() { return {}; }, requestAnimationFrame(callback) { if (typeof setTimeout === 'undefined') { callback(); return null; } return setTimeout(callback, 0); }, cancelAnimationFrame(id) { if (typeof setTimeout === 'undefined') { return; } clearTimeout(id); } }; function getWindow() { const win = typeof window !== 'undefined' ? window : {}; extend$1(win, ssrWindow); return win; } /** * Dom7 4.0.0 * Minimalistic JavaScript library for DOM manipulation, with a jQuery-compatible API * https://framework7.io/docs/dom7.html * * Copyright 2021, Vladimir Kharlampidi * * Licensed under MIT * * Released on: August 25, 2021 */ /* eslint-disable no-proto */ function makeReactive(obj) { const proto = obj.__proto__; Object.defineProperty(obj, '__proto__', { get() { return proto; }, set(value) { proto.__proto__ = value; } }); } class Dom7 extends Array { constructor(items) { super(...(items || [])); makeReactive(this); } } function arrayFlat(arr = []) { const res = []; arr.forEach(el => { if (Array.isArray(el)) { res.push(...arrayFlat(el)); } else { res.push(el); } }); return res; } function arrayFilter(arr, callback) { return Array.prototype.filter.call(arr, callback); } function arrayUnique(arr) { const uniqueArray = []; for (let i = 0; i < arr.length; i += 1) { if (uniqueArray.indexOf(arr[i]) === -1) uniqueArray.push(arr[i]); } return uniqueArray; } function qsa(selector, context) { if (typeof selector !== 'string') { return [selector]; } const a = []; const res = context.querySelectorAll(selector); for (let i = 0; i < res.length; i += 1) { a.push(res[i]); } return a; } function $(selector, context) { const window = getWindow(); const document = getDocument(); let arr = []; if (!context && selector instanceof Dom7) { return selector; } if (!selector) { return new Dom7(arr); } if (typeof selector === 'string') { const html = selector.trim(); if (html.indexOf('<') >= 0 && html.indexOf('>') >= 0) { let toCreate = 'div'; if (html.indexOf(' c.split(' '))); this.forEach(el => { el.classList.add(...classNames); }); return this; } function removeClass(...classes) { const classNames = arrayFlat(classes.map(c => c.split(' '))); this.forEach(el => { el.classList.remove(...classNames); }); return this; } function toggleClass(...classes) { const classNames = arrayFlat(classes.map(c => c.split(' '))); this.forEach(el => { classNames.forEach(className => { el.classList.toggle(className); }); }); } function hasClass(...classes) { const classNames = arrayFlat(classes.map(c => c.split(' '))); return arrayFilter(this, el => { return classNames.filter(className => el.classList.contains(className)).length > 0; }).length > 0; } function attr(attrs, value) { if (arguments.length === 1 && typeof attrs === 'string') { // Get attr if (this[0]) return this[0].getAttribute(attrs); return undefined; } // Set attrs for (let i = 0; i < this.length; i += 1) { if (arguments.length === 2) { // String this[i].setAttribute(attrs, value); } else { // Object for (const attrName in attrs) { this[i][attrName] = attrs[attrName]; this[i].setAttribute(attrName, attrs[attrName]); } } } return this; } function removeAttr(attr) { for (let i = 0; i < this.length; i += 1) { this[i].removeAttribute(attr); } return this; } function transform(transform) { for (let i = 0; i < this.length; i += 1) { this[i].style.transform = transform; } return this; } function transition$1(duration) { for (let i = 0; i < this.length; i += 1) { this[i].style.transitionDuration = typeof duration !== 'string' ? `${duration}ms` : duration; } return this; } function on(...args) { let [eventType, targetSelector, listener, capture] = args; if (typeof args[1] === 'function') { [eventType, listener, capture] = args; targetSelector = undefined; } if (!capture) capture = false; function handleLiveEvent(e) { const target = e.target; if (!target) return; const eventData = e.target.dom7EventData || []; if (eventData.indexOf(e) < 0) { eventData.unshift(e); } if ($(target).is(targetSelector)) listener.apply(target, eventData);else { const parents = $(target).parents(); // eslint-disable-line for (let k = 0; k < parents.length; k += 1) { if ($(parents[k]).is(targetSelector)) listener.apply(parents[k], eventData); } } } function handleEvent(e) { const eventData = e && e.target ? e.target.dom7EventData || [] : []; if (eventData.indexOf(e) < 0) { eventData.unshift(e); } listener.apply(this, eventData); } const events = eventType.split(' '); let j; for (let i = 0; i < this.length; i += 1) { const el = this[i]; if (!targetSelector) { for (j = 0; j < events.length; j += 1) { const event = events[j]; if (!el.dom7Listeners) el.dom7Listeners = {}; if (!el.dom7Listeners[event]) el.dom7Listeners[event] = []; el.dom7Listeners[event].push({ listener, proxyListener: handleEvent }); el.addEventListener(event, handleEvent, capture); } } else { // Live events for (j = 0; j < events.length; j += 1) { const event = events[j]; if (!el.dom7LiveListeners) el.dom7LiveListeners = {}; if (!el.dom7LiveListeners[event]) el.dom7LiveListeners[event] = []; el.dom7LiveListeners[event].push({ listener, proxyListener: handleLiveEvent }); el.addEventListener(event, handleLiveEvent, capture); } } } return this; } function off(...args) { let [eventType, targetSelector, listener, capture] = args; if (typeof args[1] === 'function') { [eventType, listener, capture] = args; targetSelector = undefined; } if (!capture) capture = false; const events = eventType.split(' '); for (let i = 0; i < events.length; i += 1) { const event = events[i]; for (let j = 0; j < this.length; j += 1) { const el = this[j]; let handlers; if (!targetSelector && el.dom7Listeners) { handlers = el.dom7Listeners[event]; } else if (targetSelector && el.dom7LiveListeners) { handlers = el.dom7LiveListeners[event]; } if (handlers && handlers.length) { for (let k = handlers.length - 1; k >= 0; k -= 1) { const handler = handlers[k]; if (listener && handler.listener === listener) { el.removeEventListener(event, handler.proxyListener, capture); handlers.splice(k, 1); } else if (listener && handler.listener && handler.listener.dom7proxy && handler.listener.dom7proxy === listener) { el.removeEventListener(event, handler.proxyListener, capture); handlers.splice(k, 1); } else if (!listener) { el.removeEventListener(event, handler.proxyListener, capture); handlers.splice(k, 1); } } } } } return this; } function trigger(...args) { const window = getWindow(); const events = args[0].split(' '); const eventData = args[1]; for (let i = 0; i < events.length; i += 1) { const event = events[i]; for (let j = 0; j < this.length; j += 1) { const el = this[j]; if (window.CustomEvent) { const evt = new window.CustomEvent(event, { detail: eventData, bubbles: true, cancelable: true }); el.dom7EventData = args.filter((data, dataIndex) => dataIndex > 0); el.dispatchEvent(evt); el.dom7EventData = []; delete el.dom7EventData; } } } return this; } function transitionEnd$1(callback) { const dom = this; function fireCallBack(e) { if (e.target !== this) return; callback.call(this, e); dom.off('transitionend', fireCallBack); } if (callback) { dom.on('transitionend', fireCallBack); } return this; } function outerWidth(includeMargins) { if (this.length > 0) { if (includeMargins) { const styles = this.styles(); return this[0].offsetWidth + parseFloat(styles.getPropertyValue('margin-right')) + parseFloat(styles.getPropertyValue('margin-left')); } return this[0].offsetWidth; } return null; } function outerHeight(includeMargins) { if (this.length > 0) { if (includeMargins) { const styles = this.styles(); return this[0].offsetHeight + parseFloat(styles.getPropertyValue('margin-top')) + parseFloat(styles.getPropertyValue('margin-bottom')); } return this[0].offsetHeight; } return null; } function offset() { if (this.length > 0) { const window = getWindow(); const document = getDocument(); const el = this[0]; const box = el.getBoundingClientRect(); const body = document.body; const clientTop = el.clientTop || body.clientTop || 0; const clientLeft = el.clientLeft || body.clientLeft || 0; const scrollTop = el === window ? window.scrollY : el.scrollTop; const scrollLeft = el === window ? window.scrollX : el.scrollLeft; return { top: box.top + scrollTop - clientTop, left: box.left + scrollLeft - clientLeft }; } return null; } function styles() { const window = getWindow(); if (this[0]) return window.getComputedStyle(this[0], null); return {}; } function css(props, value) { const window = getWindow(); let i; if (arguments.length === 1) { if (typeof props === 'string') { // .css('width') if (this[0]) return window.getComputedStyle(this[0], null).getPropertyValue(props); } else { // .css({ width: '100px' }) for (i = 0; i < this.length; i += 1) { for (const prop in props) { this[i].style[prop] = props[prop]; } } return this; } } if (arguments.length === 2 && typeof props === 'string') { // .css('width', '100px') for (i = 0; i < this.length; i += 1) { this[i].style[props] = value; } return this; } return this; } function each(callback) { if (!callback) return this; this.forEach((el, index) => { callback.apply(el, [el, index]); }); return this; } function filter(callback) { const result = arrayFilter(this, callback); return $(result); } function html(html) { if (typeof html === 'undefined') { return this[0] ? this[0].innerHTML : null; } for (let i = 0; i < this.length; i += 1) { this[i].innerHTML = html; } return this; } function text(text) { if (typeof text === 'undefined') { return this[0] ? this[0].textContent.trim() : null; } for (let i = 0; i < this.length; i += 1) { this[i].textContent = text; } return this; } function is(selector) { const window = getWindow(); const document = getDocument(); const el = this[0]; let compareWith; let i; if (!el || typeof selector === 'undefined') return false; if (typeof selector === 'string') { if (el.matches) return el.matches(selector); if (el.webkitMatchesSelector) return el.webkitMatchesSelector(selector); if (el.msMatchesSelector) return el.msMatchesSelector(selector); compareWith = $(selector); for (i = 0; i < compareWith.length; i += 1) { if (compareWith[i] === el) return true; } return false; } if (selector === document) { return el === document; } if (selector === window) { return el === window; } if (selector.nodeType || selector instanceof Dom7) { compareWith = selector.nodeType ? [selector] : selector; for (i = 0; i < compareWith.length; i += 1) { if (compareWith[i] === el) return true; } return false; } return false; } function index() { let child = this[0]; let i; if (child) { i = 0; // eslint-disable-next-line while ((child = child.previousSibling) !== null) { if (child.nodeType === 1) i += 1; } return i; } return undefined; } function eq(index) { if (typeof index === 'undefined') return this; const length = this.length; if (index > length - 1) { return $([]); } if (index < 0) { const returnIndex = length + index; if (returnIndex < 0) return $([]); return $([this[returnIndex]]); } return $([this[index]]); } function append(...els) { let newChild; const document = getDocument(); for (let k = 0; k < els.length; k += 1) { newChild = els[k]; for (let i = 0; i < this.length; i += 1) { if (typeof newChild === 'string') { const tempDiv = document.createElement('div'); tempDiv.innerHTML = newChild; while (tempDiv.firstChild) { this[i].appendChild(tempDiv.firstChild); } } else if (newChild instanceof Dom7) { for (let j = 0; j < newChild.length; j += 1) { this[i].appendChild(newChild[j]); } } else { this[i].appendChild(newChild); } } } return this; } function prepend(newChild) { const document = getDocument(); let i; let j; for (i = 0; i < this.length; i += 1) { if (typeof newChild === 'string') { const tempDiv = document.createElement('div'); tempDiv.innerHTML = newChild; for (j = tempDiv.childNodes.length - 1; j >= 0; j -= 1) { this[i].insertBefore(tempDiv.childNodes[j], this[i].childNodes[0]); } } else if (newChild instanceof Dom7) { for (j = 0; j < newChild.length; j += 1) { this[i].insertBefore(newChild[j], this[i].childNodes[0]); } } else { this[i].insertBefore(newChild, this[i].childNodes[0]); } } return this; } function next(selector) { if (this.length > 0) { if (selector) { if (this[0].nextElementSibling && $(this[0].nextElementSibling).is(selector)) { return $([this[0].nextElementSibling]); } return $([]); } if (this[0].nextElementSibling) return $([this[0].nextElementSibling]); return $([]); } return $([]); } function nextAll(selector) { const nextEls = []; let el = this[0]; if (!el) return $([]); while (el.nextElementSibling) { const next = el.nextElementSibling; // eslint-disable-line if (selector) { if ($(next).is(selector)) nextEls.push(next); } else nextEls.push(next); el = next; } return $(nextEls); } function prev(selector) { if (this.length > 0) { const el = this[0]; if (selector) { if (el.previousElementSibling && $(el.previousElementSibling).is(selector)) { return $([el.previousElementSibling]); } return $([]); } if (el.previousElementSibling) return $([el.previousElementSibling]); return $([]); } return $([]); } function prevAll(selector) { const prevEls = []; let el = this[0]; if (!el) return $([]); while (el.previousElementSibling) { const prev = el.previousElementSibling; // eslint-disable-line if (selector) { if ($(prev).is(selector)) prevEls.push(prev); } else prevEls.push(prev); el = prev; } return $(prevEls); } function parent(selector) { const parents = []; // eslint-disable-line for (let i = 0; i < this.length; i += 1) { if (this[i].parentNode !== null) { if (selector) { if ($(this[i].parentNode).is(selector)) parents.push(this[i].parentNode); } else { parents.push(this[i].parentNode); } } } return $(parents); } function parents(selector) { const parents = []; // eslint-disable-line for (let i = 0; i < this.length; i += 1) { let parent = this[i].parentNode; // eslint-disable-line while (parent) { if (selector) { if ($(parent).is(selector)) parents.push(parent); } else { parents.push(parent); } parent = parent.parentNode; } } return $(parents); } function closest(selector) { let closest = this; // eslint-disable-line if (typeof selector === 'undefined') { return $([]); } if (!closest.is(selector)) { closest = closest.parents(selector).eq(0); } return closest; } function find(selector) { const foundElements = []; for (let i = 0; i < this.length; i += 1) { const found = this[i].querySelectorAll(selector); for (let j = 0; j < found.length; j += 1) { foundElements.push(found[j]); } } return $(foundElements); } function children(selector) { const children = []; // eslint-disable-line for (let i = 0; i < this.length; i += 1) { const childNodes = this[i].children; for (let j = 0; j < childNodes.length; j += 1) { if (!selector || $(childNodes[j]).is(selector)) { children.push(childNodes[j]); } } } return $(children); } function remove() { for (let i = 0; i < this.length; i += 1) { if (this[i].parentNode) this[i].parentNode.removeChild(this[i]); } return this; } const Methods = { addClass, removeClass, hasClass, toggleClass, attr, removeAttr, transform, transition: transition$1, on, off, trigger, transitionEnd: transitionEnd$1, outerWidth, outerHeight, styles, offset, css, each, html, text, is, index, eq, append, prepend, next, nextAll, prev, prevAll, parent, parents, closest, find, children, filter, remove }; Object.keys(Methods).forEach(methodName => { Object.defineProperty($.fn, methodName, { value: Methods[methodName], writable: true }); }); function deleteProps(obj) { const object = obj; Object.keys(object).forEach(key => { try { object[key] = null; } catch (e) {// no getter for object } try { delete object[key]; } catch (e) {// something got wrong } }); } function nextTick(callback, delay = 0) { return setTimeout(callback, delay); } function now() { return Date.now(); } function getComputedStyle$1(el) { const window = getWindow(); let style; if (window.getComputedStyle) { style = window.getComputedStyle(el, null); } if (!style && el.currentStyle) { style = el.currentStyle; } if (!style) { style = el.style; } return style; } function getTranslate(el, axis = 'x') { const window = getWindow(); let matrix; let curTransform; let transformMatrix; const curStyle = getComputedStyle$1(el); if (window.WebKitCSSMatrix) { curTransform = curStyle.transform || curStyle.webkitTransform; if (curTransform.split(',').length > 6) { curTransform = curTransform.split(', ').map(a => a.replace(',', '.')).join(', '); } // Some old versions of Webkit choke when 'none' is passed; pass // empty string instead in this case transformMatrix = new window.WebKitCSSMatrix(curTransform === 'none' ? '' : curTransform); } else { transformMatrix = curStyle.MozTransform || curStyle.OTransform || curStyle.MsTransform || curStyle.msTransform || curStyle.transform || curStyle.getPropertyValue('transform').replace('translate(', 'matrix(1, 0, 0, 1,'); matrix = transformMatrix.toString().split(','); } if (axis === 'x') { // Latest Chrome and webkits Fix if (window.WebKitCSSMatrix) curTransform = transformMatrix.m41; // Crazy IE10 Matrix else if (matrix.length === 16) curTransform = parseFloat(matrix[12]); // Normal Browsers else curTransform = parseFloat(matrix[4]); } if (axis === 'y') { // Latest Chrome and webkits Fix if (window.WebKitCSSMatrix) curTransform = transformMatrix.m42; // Crazy IE10 Matrix else if (matrix.length === 16) curTransform = parseFloat(matrix[13]); // Normal Browsers else curTransform = parseFloat(matrix[5]); } return curTransform || 0; } function isObject(o) { return typeof o === 'object' && o !== null && o.constructor && Object.prototype.toString.call(o).slice(8, -1) === 'Object'; } function isNode(node) { // eslint-disable-next-line if (typeof window !== 'undefined' && typeof window.HTMLElement !== 'undefined') { return node instanceof HTMLElement; } return node && (node.nodeType === 1 || node.nodeType === 11); } function extend(...args) { const to = Object(args[0]); const noExtend = ['__proto__', 'constructor', 'prototype']; for (let i = 1; i < args.length; i += 1) { const nextSource = args[i]; if (nextSource !== undefined && nextSource !== null && !isNode(nextSource)) { const keysArray = Object.keys(Object(nextSource)).filter(key => noExtend.indexOf(key) < 0); for (let nextIndex = 0, len = keysArray.length; nextIndex < len; nextIndex += 1) { const nextKey = keysArray[nextIndex]; const desc = Object.getOwnPropertyDescriptor(nextSource, nextKey); if (desc !== undefined && desc.enumerable) { if (isObject(to[nextKey]) && isObject(nextSource[nextKey])) { if (nextSource[nextKey].__swiper__) { to[nextKey] = nextSource[nextKey]; } else { extend(to[nextKey], nextSource[nextKey]); } } else if (!isObject(to[nextKey]) && isObject(nextSource[nextKey])) { to[nextKey] = {}; if (nextSource[nextKey].__swiper__) { to[nextKey] = nextSource[nextKey]; } else { extend(to[nextKey], nextSource[nextKey]); } } else { to[nextKey] = nextSource[nextKey]; } } } } } return to; } function setCSSProperty(el, varName, varValue) { el.style.setProperty(varName, varValue); } function animateCSSModeScroll({ swiper, targetPosition, side }) { const window = getWindow(); const startPosition = -swiper.translate; let startTime = null; let time; const duration = swiper.params.speed; swiper.wrapperEl.style.scrollSnapType = 'none'; window.cancelAnimationFrame(swiper.cssModeFrameID); const dir = targetPosition > startPosition ? 'next' : 'prev'; const isOutOfBound = (current, target) => { return dir === 'next' && current >= target || dir === 'prev' && current <= target; }; const animate = () => { time = new Date().getTime(); if (startTime === null) { startTime = time; } const progress = Math.max(Math.min((time - startTime) / duration, 1), 0); const easeProgress = 0.5 - Math.cos(progress * Math.PI) / 2; let currentPosition = startPosition + easeProgress * (targetPosition - startPosition); if (isOutOfBound(currentPosition, targetPosition)) currentPosition = targetPosition; swiper.wrapperEl.scrollTo({ [side]: currentPosition }); if (isOutOfBound(currentPosition, targetPosition)) { swiper.wrapperEl.style.scrollSnapType = ''; window.cancelAnimationFrame(swiper.cssModeFrameID); return; } swiper.cssModeFrameID = window.requestAnimationFrame(animate); }; animate(); } let support; function calcSupport() { const window = getWindow(); const document = getDocument(); return { smoothScroll: document.documentElement && 'scrollBehavior' in document.documentElement.style, touch: !!('ontouchstart' in window || window.DocumentTouch && document instanceof window.DocumentTouch), passiveListener: function checkPassiveListener() { let supportsPassive = false; try { const opts = Object.defineProperty({}, 'passive', { // eslint-disable-next-line get() { supportsPassive = true; } }); window.addEventListener('testPassiveListener', null, opts); } catch (e) {// No support } return supportsPassive; }(), gestures: function checkGestures() { return 'ongesturestart' in window; }() }; } function getSupport() { if (!support) { support = calcSupport(); } return support; } let deviceCached; function calcDevice({ userAgent } = {}) { const support = getSupport(); const window = getWindow(); const platform = window.navigator.platform; const ua = userAgent || window.navigator.userAgent; const device = { ios: false, android: false }; const screenWidth = window.screen.width; const screenHeight = window.screen.height; const android = ua.match(/(Android);?[\s\/]+([\d.]+)?/); // eslint-disable-line let ipad = ua.match(/(iPad).*OS\s([\d_]+)/); const ipod = ua.match(/(iPod)(.*OS\s([\d_]+))?/); const iphone = !ipad && ua.match(/(iPhone\sOS|iOS)\s([\d_]+)/); const windows = platform === 'Win32'; let macos = platform === 'MacIntel'; // iPadOs 13 fix const iPadScreens = ['1024x1366', '1366x1024', '834x1194', '1194x834', '834x1112', '1112x834', '768x1024', '1024x768', '820x1180', '1180x820', '810x1080', '1080x810']; if (!ipad && macos && support.touch && iPadScreens.indexOf(`${screenWidth}x${screenHeight}`) >= 0) { ipad = ua.match(/(Version)\/([\d.]+)/); if (!ipad) ipad = [0, 1, '13_0_0']; macos = false; } // Android if (android && !windows) { device.os = 'android'; device.android = true; } if (ipad || iphone || ipod) { device.os = 'ios'; device.ios = true; } // Export object return device; } function getDevice(overrides = {}) { if (!deviceCached) { deviceCached = calcDevice(overrides); } return deviceCached; } let browser; function calcBrowser() { const window = getWindow(); function isSafari() { const ua = window.navigator.userAgent.toLowerCase(); return ua.indexOf('safari') >= 0 && ua.indexOf('chrome') < 0 && ua.indexOf('android') < 0; } return { isSafari: isSafari(), isWebView: /(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(window.navigator.userAgent) }; } function getBrowser() { if (!browser) { browser = calcBrowser(); } return browser; } function Resize({ swiper, on, emit }) { const window = getWindow(); let observer = null; const resizeHandler = () => { if (!swiper || swiper.destroyed || !swiper.initialized) return; emit('beforeResize'); emit('resize'); }; const createObserver = () => { if (!swiper || swiper.destroyed || !swiper.initialized) return; observer = new ResizeObserver(entries => { const { width, height } = swiper; let newWidth = width; let newHeight = height; entries.forEach(({ contentBoxSize, contentRect, target }) => { if (target && target !== swiper.el) return; newWidth = contentRect ? contentRect.width : (contentBoxSize[0] || contentBoxSize).inlineSize; newHeight = contentRect ? contentRect.height : (contentBoxSize[0] || contentBoxSize).blockSize; }); if (newWidth !== width || newHeight !== height) { resizeHandler(); } }); observer.observe(swiper.el); }; const removeObserver = () => { if (observer && observer.unobserve && swiper.el) { observer.unobserve(swiper.el); observer = null; } }; const orientationChangeHandler = () => { if (!swiper || swiper.destroyed || !swiper.initialized) return; emit('orientationchange'); }; on('init', () => { if (swiper.params.resizeObserver && typeof window.ResizeObserver !== 'undefined') { createObserver(); return; } window.addEventListener('resize', resizeHandler); window.addEventListener('orientationchange', orientationChangeHandler); }); on('destroy', () => { removeObserver(); window.removeEventListener('resize', resizeHandler); window.removeEventListener('orientationchange', orientationChangeHandler); }); } function Observer({ swiper, extendParams, on, emit }) { const observers = []; const window = getWindow(); const attach = (target, options = {}) => { const ObserverFunc = window.MutationObserver || window.WebkitMutationObserver; const observer = new ObserverFunc(mutations => { // The observerUpdate event should only be triggered // once despite the number of mutations. Additional // triggers are redundant and are very costly if (mutations.length === 1) { emit('observerUpdate', mutations[0]); return; } const observerUpdate = function observerUpdate() { emit('observerUpdate', mutations[0]); }; if (window.requestAnimationFrame) { window.requestAnimationFrame(observerUpdate); } else { window.setTimeout(observerUpdate, 0); } }); observer.observe(target, { attributes: typeof options.attributes === 'undefined' ? true : options.attributes, childList: typeof options.childList === 'undefined' ? true : options.childList, characterData: typeof options.characterData === 'undefined' ? true : options.characterData }); observers.push(observer); }; const init = () => { if (!swiper.params.observer) return; if (swiper.params.observeParents) { const containerParents = swiper.$el.parents(); for (let i = 0; i < containerParents.length; i += 1) { attach(containerParents[i]); } } // Observe container attach(swiper.$el[0], { childList: swiper.params.observeSlideChildren }); // Observe wrapper attach(swiper.$wrapperEl[0], { attributes: false }); }; const destroy = () => { observers.forEach(observer => { observer.disconnect(); }); observers.splice(0, observers.length); }; extendParams({ observer: false, observeParents: false, observeSlideChildren: false }); on('init', init); on('destroy', destroy); } /* eslint-disable no-underscore-dangle */ var eventsEmitter = { on(events, handler, priority) { const self = this; if (typeof handler !== 'function') return self; const method = priority ? 'unshift' : 'push'; events.split(' ').forEach(event => { if (!self.eventsListeners[event]) self.eventsListeners[event] = []; self.eventsListeners[event][method](handler); }); return self; }, once(events, handler, priority) { const self = this; if (typeof handler !== 'function') return self; function onceHandler(...args) { self.off(events, onceHandler); if (onceHandler.__emitterProxy) { delete onceHandler.__emitterProxy; } handler.apply(self, args); } onceHandler.__emitterProxy = handler; return self.on(events, onceHandler, priority); }, onAny(handler, priority) { const self = this; if (typeof handler !== 'function') return self; const method = priority ? 'unshift' : 'push'; if (self.eventsAnyListeners.indexOf(handler) < 0) { self.eventsAnyListeners[method](handler); } return self; }, offAny(handler) { const self = this; if (!self.eventsAnyListeners) return self; const index = self.eventsAnyListeners.indexOf(handler); if (index >= 0) { self.eventsAnyListeners.splice(index, 1); } return self; }, off(events, handler) { const self = this; if (!self.eventsListeners) return self; events.split(' ').forEach(event => { if (typeof handler === 'undefined') { self.eventsListeners[event] = []; } else if (self.eventsListeners[event]) { self.eventsListeners[event].forEach((eventHandler, index) => { if (eventHandler === handler || eventHandler.__emitterProxy && eventHandler.__emitterProxy === handler) { self.eventsListeners[event].splice(index, 1); } }); } }); return self; }, emit(...args) { const self = this; if (!self.eventsListeners) return self; let events; let data; let context; if (typeof args[0] === 'string' || Array.isArray(args[0])) { events = args[0]; data = args.slice(1, args.length); context = self; } else { events = args[0].events; data = args[0].data; context = args[0].context || self; } data.unshift(context); const eventsArray = Array.isArray(events) ? events : events.split(' '); eventsArray.forEach(event => { if (self.eventsAnyListeners && self.eventsAnyListeners.length) { self.eventsAnyListeners.forEach(eventHandler => { eventHandler.apply(context, [event, ...data]); }); } if (self.eventsListeners && self.eventsListeners[event]) { self.eventsListeners[event].forEach(eventHandler => { eventHandler.apply(context, data); }); } }); return self; } }; function updateSize() { const swiper = this; let width; let height; const $el = swiper.$el; if (typeof swiper.params.width !== 'undefined' && swiper.params.width !== null) { width = swiper.params.width; } else { width = $el[0].clientWidth; } if (typeof swiper.params.height !== 'undefined' && swiper.params.height !== null) { height = swiper.params.height; } else { height = $el[0].clientHeight; } if (width === 0 && swiper.isHorizontal() || height === 0 && swiper.isVertical()) { return; } // Subtract paddings width = width - parseInt($el.css('padding-left') || 0, 10) - parseInt($el.css('padding-right') || 0, 10); height = height - parseInt($el.css('padding-top') || 0, 10) - parseInt($el.css('padding-bottom') || 0, 10); if (Number.isNaN(width)) width = 0; if (Number.isNaN(height)) height = 0; Object.assign(swiper, { width, height, size: swiper.isHorizontal() ? width : height }); } function updateSlides() { const swiper = this; function getDirectionLabel(property) { if (swiper.isHorizontal()) { return property; } // prettier-ignore return { 'width': 'height', 'margin-top': 'margin-left', 'margin-bottom ': 'margin-right', 'margin-left': 'margin-top', 'margin-right': 'margin-bottom', 'padding-left': 'padding-top', 'padding-right': 'padding-bottom', 'marginRight': 'marginBottom' }[property]; } function getDirectionPropertyValue(node, label) { return parseFloat(node.getPropertyValue(getDirectionLabel(label)) || 0); } const params = swiper.params; const { $wrapperEl, size: swiperSize, rtlTranslate: rtl, wrongRTL } = swiper; const isVirtual = swiper.virtual && params.virtual.enabled; const previousSlidesLength = isVirtual ? swiper.virtual.slides.length : swiper.slides.length; const slides = $wrapperEl.children(`.${swiper.params.slideClass}`); const slidesLength = isVirtual ? swiper.virtual.slides.length : slides.length; let snapGrid = []; const slidesGrid = []; const slidesSizesGrid = []; let offsetBefore = params.slidesOffsetBefore; if (typeof offsetBefore === 'function') { offsetBefore = params.slidesOffsetBefore.call(swiper); } let offsetAfter = params.slidesOffsetAfter; if (typeof offsetAfter === 'function') { offsetAfter = params.slidesOffsetAfter.call(swiper); } const previousSnapGridLength = swiper.snapGrid.length; const previousSlidesGridLength = swiper.slidesGrid.length; let spaceBetween = params.spaceBetween; let slidePosition = -offsetBefore; let prevSlideSize = 0; let index = 0; if (typeof swiperSize === 'undefined') { return; } if (typeof spaceBetween === 'string' && spaceBetween.indexOf('%') >= 0) { spaceBetween = parseFloat(spaceBetween.replace('%', '')) / 100 * swiperSize; } swiper.virtualSize = -spaceBetween; // reset margins if (rtl) slides.css({ marginLeft: '', marginBottom: '', marginTop: '' });else slides.css({ marginRight: '', marginBottom: '', marginTop: '' }); // reset cssMode offsets if (params.centeredSlides && params.cssMode) { setCSSProperty(swiper.wrapperEl, '--swiper-centered-offset-before', ''); setCSSProperty(swiper.wrapperEl, '--swiper-centered-offset-after', ''); } const gridEnabled = params.grid && params.grid.rows > 1 && swiper.grid; if (gridEnabled) { swiper.grid.initSlides(slidesLength); } // Calc slides let slideSize; const shouldResetSlideSize = params.slidesPerView === 'auto' && params.breakpoints && Object.keys(params.breakpoints).filter(key => { return typeof params.breakpoints[key].slidesPerView !== 'undefined'; }).length > 0; for (let i = 0; i < slidesLength; i += 1) { slideSize = 0; const slide = slides.eq(i); if (gridEnabled) { swiper.grid.updateSlide(i, slide, slidesLength, getDirectionLabel); } if (slide.css('display') === 'none') continue; // eslint-disable-line if (params.slidesPerView === 'auto') { if (shouldResetSlideSize) { slides[i].style[getDirectionLabel('width')] = ``; } const slideStyles = getComputedStyle(slide[0]); const currentTransform = slide[0].style.transform; const currentWebKitTransform = slide[0].style.webkitTransform; if (currentTransform) { slide[0].style.transform = 'none'; } if (currentWebKitTransform) { slide[0].style.webkitTransform = 'none'; } if (params.roundLengths) { slideSize = swiper.isHorizontal() ? slide.outerWidth(true) : slide.outerHeight(true); } else { // eslint-disable-next-line const width = getDirectionPropertyValue(slideStyles, 'width'); const paddingLeft = getDirectionPropertyValue(slideStyles, 'padding-left'); const paddingRight = getDirectionPropertyValue(slideStyles, 'padding-right'); const marginLeft = getDirectionPropertyValue(slideStyles, 'margin-left'); const marginRight = getDirectionPropertyValue(slideStyles, 'margin-right'); const boxSizing = slideStyles.getPropertyValue('box-sizing'); if (boxSizing && boxSizing === 'border-box') { slideSize = width + marginLeft + marginRight; } else { const { clientWidth, offsetWidth } = slide[0]; slideSize = width + paddingLeft + paddingRight + marginLeft + marginRight + (offsetWidth - clientWidth); } } if (currentTransform) { slide[0].style.transform = currentTransform; } if (currentWebKitTransform) { slide[0].style.webkitTransform = currentWebKitTransform; } if (params.roundLengths) slideSize = Math.floor(slideSize); } else { slideSize = (swiperSize - (params.slidesPerView - 1) * spaceBetween) / params.slidesPerView; if (params.roundLengths) slideSize = Math.floor(slideSize); if (slides[i]) { slides[i].style[getDirectionLabel('width')] = `${slideSize}px`; } } if (slides[i]) { slides[i].swiperSlideSize = slideSize; } slidesSizesGrid.push(slideSize); if (params.centeredSlides) { slidePosition = slidePosition + slideSize / 2 + prevSlideSize / 2 + spaceBetween; if (prevSlideSize === 0 && i !== 0) slidePosition = slidePosition - swiperSize / 2 - spaceBetween; if (i === 0) slidePosition = slidePosition - swiperSize / 2 - spaceBetween; if (Math.abs(slidePosition) < 1 / 1000) slidePosition = 0; if (params.roundLengths) slidePosition = Math.floor(slidePosition); if (index % params.slidesPerGroup === 0) snapGrid.push(slidePosition); slidesGrid.push(slidePosition); } else { if (params.roundLengths) slidePosition = Math.floor(slidePosition); if ((index - Math.min(swiper.params.slidesPerGroupSkip, index)) % swiper.params.slidesPerGroup === 0) snapGrid.push(slidePosition); slidesGrid.push(slidePosition); slidePosition = slidePosition + slideSize + spaceBetween; } swiper.virtualSize += slideSize + spaceBetween; prevSlideSize = slideSize; index += 1; } swiper.virtualSize = Math.max(swiper.virtualSize, swiperSize) + offsetAfter; if (rtl && wrongRTL && (params.effect === 'slide' || params.effect === 'coverflow')) { $wrapperEl.css({ width: `${swiper.virtualSize + params.spaceBetween}px` }); } if (params.setWrapperSize) { $wrapperEl.css({ [getDirectionLabel('width')]: `${swiper.virtualSize + params.spaceBetween}px` }); } if (gridEnabled) { swiper.grid.updateWrapperSize(slideSize, snapGrid, getDirectionLabel); } // Remove last grid elements depending on width if (!params.centeredSlides) { const newSlidesGrid = []; for (let i = 0; i < snapGrid.length; i += 1) { let slidesGridItem = snapGrid[i]; if (params.roundLengths) slidesGridItem = Math.floor(slidesGridItem); if (snapGrid[i] <= swiper.virtualSize - swiperSize) { newSlidesGrid.push(slidesGridItem); } } snapGrid = newSlidesGrid; if (Math.floor(swiper.virtualSize - swiperSize) - Math.floor(snapGrid[snapGrid.length - 1]) > 1) { snapGrid.push(swiper.virtualSize - swiperSize); } } if (snapGrid.length === 0) snapGrid = [0]; if (params.spaceBetween !== 0) { const key = swiper.isHorizontal() && rtl ? 'marginLeft' : getDirectionLabel('marginRight'); slides.filter((_, slideIndex) => { if (!params.cssMode) return true; if (slideIndex === slides.length - 1) { return false; } return true; }).css({ [key]: `${spaceBetween}px` }); } if (params.centeredSlides && params.centeredSlidesBounds) { let allSlidesSize = 0; slidesSizesGrid.forEach(slideSizeValue => { allSlidesSize += slideSizeValue + (params.spaceBetween ? params.spaceBetween : 0); }); allSlidesSize -= params.spaceBetween; const maxSnap = allSlidesSize - swiperSize; snapGrid = snapGrid.map(snap => { if (snap < 0) return -offsetBefore; if (snap > maxSnap) return maxSnap + offsetAfter; return snap; }); } if (params.centerInsufficientSlides) { let allSlidesSize = 0; slidesSizesGrid.forEach(slideSizeValue => { allSlidesSize += slideSizeValue + (params.spaceBetween ? params.spaceBetween : 0); }); allSlidesSize -= params.spaceBetween; if (allSlidesSize < swiperSize) { const allSlidesOffset = (swiperSize - allSlidesSize) / 2; snapGrid.forEach((snap, snapIndex) => { snapGrid[snapIndex] = snap - allSlidesOffset; }); slidesGrid.forEach((snap, snapIndex) => { slidesGrid[snapIndex] = snap + allSlidesOffset; }); } } Object.assign(swiper, { slides, snapGrid, slidesGrid, slidesSizesGrid }); if (params.centeredSlides && params.cssMode && !params.centeredSlidesBounds) { setCSSProperty(swiper.wrapperEl, '--swiper-centered-offset-before', `${-snapGrid[0]}px`); setCSSProperty(swiper.wrapperEl, '--swiper-centered-offset-after', `${swiper.size / 2 - slidesSizesGrid[slidesSizesGrid.length - 1] / 2}px`); const addToSnapGrid = -swiper.snapGrid[0]; const addToSlidesGrid = -swiper.slidesGrid[0]; swiper.snapGrid = swiper.snapGrid.map(v => v + addToSnapGrid); swiper.slidesGrid = swiper.slidesGrid.map(v => v + addToSlidesGrid); } if (slidesLength !== previousSlidesLength) { swiper.emit('slidesLengthChange'); } if (snapGrid.length !== previousSnapGridLength) { if (swiper.params.watchOverflow) swiper.checkOverflow(); swiper.emit('snapGridLengthChange'); } if (slidesGrid.length !== previousSlidesGridLength) { swiper.emit('slidesGridLengthChange'); } if (params.watchSlidesProgress) { swiper.updateSlidesOffset(); } } function updateAutoHeight(speed) { const swiper = this; const activeSlides = []; const isVirtual = swiper.virtual && swiper.params.virtual.enabled; let newHeight = 0; let i; if (typeof speed === 'number') { swiper.setTransition(speed); } else if (speed === true) { swiper.setTransition(swiper.params.speed); } const getSlideByIndex = index => { if (isVirtual) { return swiper.slides.filter(el => parseInt(el.getAttribute('data-swiper-slide-index'), 10) === index)[0]; } return swiper.slides.eq(index)[0]; }; // Find slides currently in view if (swiper.params.slidesPerView !== 'auto' && swiper.params.slidesPerView > 1) { if (swiper.params.centeredSlides) { swiper.visibleSlides.each(slide => { activeSlides.push(slide); }); } else { for (i = 0; i < Math.ceil(swiper.params.slidesPerView); i += 1) { const index = swiper.activeIndex + i; if (index > swiper.slides.length && !isVirtual) break; activeSlides.push(getSlideByIndex(index)); } } } else { activeSlides.push(getSlideByIndex(swiper.activeIndex)); } // Find new height from highest slide in view for (i = 0; i < activeSlides.length; i += 1) { if (typeof activeSlides[i] !== 'undefined') { const height = activeSlides[i].offsetHeight; newHeight = height > newHeight ? height : newHeight; } } // Update Height if (newHeight) swiper.$wrapperEl.css('height', `${newHeight}px`); } function updateSlidesOffset() { const swiper = this; const slides = swiper.slides; for (let i = 0; i < slides.length; i += 1) { slides[i].swiperSlideOffset = swiper.isHorizontal() ? slides[i].offsetLeft : slides[i].offsetTop; } } function updateSlidesProgress(translate = this && this.translate || 0) { const swiper = this; const params = swiper.params; const { slides, rtlTranslate: rtl } = swiper; if (slides.length === 0) return; if (typeof slides[0].swiperSlideOffset === 'undefined') swiper.updateSlidesOffset(); let offsetCenter = -translate; if (rtl) offsetCenter = translate; // Visible Slides slides.removeClass(params.slideVisibleClass); swiper.visibleSlidesIndexes = []; swiper.visibleSlides = []; for (let i = 0; i < slides.length; i += 1) { const slide = slides[i]; let slideOffset = slide.swiperSlideOffset; if (params.cssMode && params.centeredSlides) { slideOffset -= slides[0].swiperSlideOffset; } const slideProgress = (offsetCenter + (params.centeredSlides ? swiper.minTranslate() : 0) - slideOffset) / (slide.swiperSlideSize + params.spaceBetween); const slideBefore = -(offsetCenter - slideOffset); const slideAfter = slideBefore + swiper.slidesSizesGrid[i]; const isVisible = slideBefore >= 0 && slideBefore < swiper.size - 1 || slideAfter > 1 && slideAfter <= swiper.size || slideBefore <= 0 && slideAfter >= swiper.size; if (isVisible) { swiper.visibleSlides.push(slide); swiper.visibleSlidesIndexes.push(i); slides.eq(i).addClass(params.slideVisibleClass); } slide.progress = rtl ? -slideProgress : slideProgress; } swiper.visibleSlides = $(swiper.visibleSlides); } function updateProgress(translate) { const swiper = this; if (typeof translate === 'undefined') { const multiplier = swiper.rtlTranslate ? -1 : 1; // eslint-disable-next-line translate = swiper && swiper.translate && swiper.translate * multiplier || 0; } const params = swiper.params; const translatesDiff = swiper.maxTranslate() - swiper.minTranslate(); let { progress, isBeginning, isEnd } = swiper; const wasBeginning = isBeginning; const wasEnd = isEnd; if (translatesDiff === 0) { progress = 0; isBeginning = true; isEnd = true; } else { progress = (translate - swiper.minTranslate()) / translatesDiff; isBeginning = progress <= 0; isEnd = progress >= 1; } Object.assign(swiper, { progress, isBeginning, isEnd }); if (params.watchSlidesProgress || params.centeredSlides && params.autoHeight) swiper.updateSlidesProgress(translate); if (isBeginning && !wasBeginning) { swiper.emit('reachBeginning toEdge'); } if (isEnd && !wasEnd) { swiper.emit('reachEnd toEdge'); } if (wasBeginning && !isBeginning || wasEnd && !isEnd) { swiper.emit('fromEdge'); } swiper.emit('progress', progress); } function updateSlidesClasses() { const swiper = this; const { slides, params, $wrapperEl, activeIndex, realIndex } = swiper; const isVirtual = swiper.virtual && params.virtual.enabled; slides.removeClass(`${params.slideActiveClass} ${params.slideNextClass} ${params.slidePrevClass} ${params.slideDuplicateActiveClass} ${params.slideDuplicateNextClass} ${params.slideDuplicatePrevClass}`); let activeSlide; if (isVirtual) { activeSlide = swiper.$wrapperEl.find(`.${params.slideClass}[data-swiper-slide-index="${activeIndex}"]`); } else { activeSlide = slides.eq(activeIndex); } // Active classes activeSlide.addClass(params.slideActiveClass); if (params.loop) { // Duplicate to all looped slides if (activeSlide.hasClass(params.slideDuplicateClass)) { $wrapperEl.children(`.${params.slideClass}:not(.${params.slideDuplicateClass})[data-swiper-slide-index="${realIndex}"]`).addClass(params.slideDuplicateActiveClass); } else { $wrapperEl.children(`.${params.slideClass}.${params.slideDuplicateClass}[data-swiper-slide-index="${realIndex}"]`).addClass(params.slideDuplicateActiveClass); } } // Next Slide let nextSlide = activeSlide.nextAll(`.${params.slideClass}`).eq(0).addClass(params.slideNextClass); if (params.loop && nextSlide.length === 0) { nextSlide = slides.eq(0); nextSlide.addClass(params.slideNextClass); } // Prev Slide let prevSlide = activeSlide.prevAll(`.${params.slideClass}`).eq(0).addClass(params.slidePrevClass); if (params.loop && prevSlide.length === 0) { prevSlide = slides.eq(-1); prevSlide.addClass(params.slidePrevClass); } if (params.loop) { // Duplicate to all looped slides if (nextSlide.hasClass(params.slideDuplicateClass)) { $wrapperEl.children(`.${params.slideClass}:not(.${params.slideDuplicateClass})[data-swiper-slide-index="${nextSlide.attr('data-swiper-slide-index')}"]`).addClass(params.slideDuplicateNextClass); } else { $wrapperEl.children(`.${params.slideClass}.${params.slideDuplicateClass}[data-swiper-slide-index="${nextSlide.attr('data-swiper-slide-index')}"]`).addClass(params.slideDuplicateNextClass); } if (prevSlide.hasClass(params.slideDuplicateClass)) { $wrapperEl.children(`.${params.slideClass}:not(.${params.slideDuplicateClass})[data-swiper-slide-index="${prevSlide.attr('data-swiper-slide-index')}"]`).addClass(params.slideDuplicatePrevClass); } else { $wrapperEl.children(`.${params.slideClass}.${params.slideDuplicateClass}[data-swiper-slide-index="${prevSlide.attr('data-swiper-slide-index')}"]`).addClass(params.slideDuplicatePrevClass); } } swiper.emitSlidesClasses(); } function updateActiveIndex(newActiveIndex) { const swiper = this; const translate = swiper.rtlTranslate ? swiper.translate : -swiper.translate; const { slidesGrid, snapGrid, params, activeIndex: previousIndex, realIndex: previousRealIndex, snapIndex: previousSnapIndex } = swiper; let activeIndex = newActiveIndex; let snapIndex; if (typeof activeIndex === 'undefined') { for (let i = 0; i < slidesGrid.length; i += 1) { if (typeof slidesGrid[i + 1] !== 'undefined') { if (translate >= slidesGrid[i] && translate < slidesGrid[i + 1] - (slidesGrid[i + 1] - slidesGrid[i]) / 2) { activeIndex = i; } else if (translate >= slidesGrid[i] && translate < slidesGrid[i + 1]) { activeIndex = i + 1; } } else if (translate >= slidesGrid[i]) { activeIndex = i; } } // Normalize slideIndex if (params.normalizeSlideIndex) { if (activeIndex < 0 || typeof activeIndex === 'undefined') activeIndex = 0; } } if (snapGrid.indexOf(translate) >= 0) { snapIndex = snapGrid.indexOf(translate); } else { const skip = Math.min(params.slidesPerGroupSkip, activeIndex); snapIndex = skip + Math.floor((activeIndex - skip) / params.slidesPerGroup); } if (snapIndex >= snapGrid.length) snapIndex = snapGrid.length - 1; if (activeIndex === previousIndex) { if (snapIndex !== previousSnapIndex) { swiper.snapIndex = snapIndex; swiper.emit('snapIndexChange'); } return; } // Get real index const realIndex = parseInt(swiper.slides.eq(activeIndex).attr('data-swiper-slide-index') || activeIndex, 10); Object.assign(swiper, { snapIndex, realIndex, previousIndex, activeIndex }); swiper.emit('activeIndexChange'); swiper.emit('snapIndexChange'); if (previousRealIndex !== realIndex) { swiper.emit('realIndexChange'); } if (swiper.initialized || swiper.params.runCallbacksOnInit) { swiper.emit('slideChange'); } } function updateClickedSlide(e) { const swiper = this; const params = swiper.params; const slide = $(e.target).closest(`.${params.slideClass}`)[0]; let slideFound = false; let slideIndex; if (slide) { for (let i = 0; i < swiper.slides.length; i += 1) { if (swiper.slides[i] === slide) { slideFound = true; slideIndex = i; break; } } } if (slide && slideFound) { swiper.clickedSlide = slide; if (swiper.virtual && swiper.params.virtual.enabled) { swiper.clickedIndex = parseInt($(slide).attr('data-swiper-slide-index'), 10); } else { swiper.clickedIndex = slideIndex; } } else { swiper.clickedSlide = undefined; swiper.clickedIndex = undefined; return; } if (params.slideToClickedSlide && swiper.clickedIndex !== undefined && swiper.clickedIndex !== swiper.activeIndex) { swiper.slideToClickedSlide(); } } var update = { updateSize, updateSlides, updateAutoHeight, updateSlidesOffset, updateSlidesProgress, updateProgress, updateSlidesClasses, updateActiveIndex, updateClickedSlide }; function getSwiperTranslate(axis = this.isHorizontal() ? 'x' : 'y') { const swiper = this; const { params, rtlTranslate: rtl, translate, $wrapperEl } = swiper; if (params.virtualTranslate) { return rtl ? -translate : translate; } if (params.cssMode) { return translate; } let currentTranslate = getTranslate($wrapperEl[0], axis); if (rtl) currentTranslate = -currentTranslate; return currentTranslate || 0; } function setTranslate(translate, byController) { const swiper = this; const { rtlTranslate: rtl, params, $wrapperEl, wrapperEl, progress } = swiper; let x = 0; let y = 0; const z = 0; if (swiper.isHorizontal()) { x = rtl ? -translate : translate; } else { y = translate; } if (params.roundLengths) { x = Math.floor(x); y = Math.floor(y); } if (params.cssMode) { wrapperEl[swiper.isHorizontal() ? 'scrollLeft' : 'scrollTop'] = swiper.isHorizontal() ? -x : -y; } else if (!params.virtualTranslate) { $wrapperEl.transform(`translate3d(${x}px, ${y}px, ${z}px)`); } swiper.previousTranslate = swiper.translate; swiper.translate = swiper.isHorizontal() ? x : y; // Check if we need to update progress let newProgress; const translatesDiff = swiper.maxTranslate() - swiper.minTranslate(); if (translatesDiff === 0) { newProgress = 0; } else { newProgress = (translate - swiper.minTranslate()) / translatesDiff; } if (newProgress !== progress) { swiper.updateProgress(translate); } swiper.emit('setTranslate', swiper.translate, byController); } function minTranslate() { return -this.snapGrid[0]; } function maxTranslate() { return -this.snapGrid[this.snapGrid.length - 1]; } function translateTo(translate = 0, speed = this.params.speed, runCallbacks = true, translateBounds = true, internal) { const swiper = this; const { params, wrapperEl } = swiper; if (swiper.animating && params.preventInteractionOnTransition) { return false; } const minTranslate = swiper.minTranslate(); const maxTranslate = swiper.maxTranslate(); let newTranslate; if (translateBounds && translate > minTranslate) newTranslate = minTranslate;else if (translateBounds && translate < maxTranslate) newTranslate = maxTranslate;else newTranslate = translate; // Update progress swiper.updateProgress(newTranslate); if (params.cssMode) { const isH = swiper.isHorizontal(); if (speed === 0) { wrapperEl[isH ? 'scrollLeft' : 'scrollTop'] = -newTranslate; } else { if (!swiper.support.smoothScroll) { animateCSSModeScroll({ swiper, targetPosition: -newTranslate, side: isH ? 'left' : 'top' }); return true; } wrapperEl.scrollTo({ [isH ? 'left' : 'top']: -newTranslate, behavior: 'smooth' }); } return true; } if (speed === 0) { swiper.setTransition(0); swiper.setTranslate(newTranslate); if (runCallbacks) { swiper.emit('beforeTransitionStart', speed, internal); swiper.emit('transitionEnd'); } } else { swiper.setTransition(speed); swiper.setTranslate(newTranslate); if (runCallbacks) { swiper.emit('beforeTransitionStart', speed, internal); swiper.emit('transitionStart'); } if (!swiper.animating) { swiper.animating = true; if (!swiper.onTranslateToWrapperTransitionEnd) { swiper.onTranslateToWrapperTransitionEnd = function transitionEnd(e) { if (!swiper || swiper.destroyed) return; if (e.target !== this) return; swiper.$wrapperEl[0].removeEventListener('transitionend', swiper.onTranslateToWrapperTransitionEnd); swiper.$wrapperEl[0].removeEventListener('webkitTransitionEnd', swiper.onTranslateToWrapperTransitionEnd); swiper.onTranslateToWrapperTransitionEnd = null; delete swiper.onTranslateToWrapperTransitionEnd; if (runCallbacks) { swiper.emit('transitionEnd'); } }; } swiper.$wrapperEl[0].addEventListener('transitionend', swiper.onTranslateToWrapperTransitionEnd); swiper.$wrapperEl[0].addEventListener('webkitTransitionEnd', swiper.onTranslateToWrapperTransitionEnd); } } return true; } var translate = { getTranslate: getSwiperTranslate, setTranslate, minTranslate, maxTranslate, translateTo }; function setTransition(duration, byController) { const swiper = this; if (!swiper.params.cssMode) { swiper.$wrapperEl.transition(duration); } swiper.emit('setTransition', duration, byController); } function transitionEmit({ swiper, runCallbacks, direction, step }) { const { activeIndex, previousIndex } = swiper; let dir = direction; if (!dir) { if (activeIndex > previousIndex) dir = 'next';else if (activeIndex < previousIndex) dir = 'prev';else dir = 'reset'; } swiper.emit(`transition${step}`); if (runCallbacks && activeIndex !== previousIndex) { if (dir === 'reset') { swiper.emit(`slideResetTransition${step}`); return; } swiper.emit(`slideChangeTransition${step}`); if (dir === 'next') { swiper.emit(`slideNextTransition${step}`); } else { swiper.emit(`slidePrevTransition${step}`); } } } function transitionStart(runCallbacks = true, direction) { const swiper = this; const { params } = swiper; if (params.cssMode) return; if (params.autoHeight) { swiper.updateAutoHeight(); } transitionEmit({ swiper, runCallbacks, direction, step: 'Start' }); } function transitionEnd(runCallbacks = true, direction) { const swiper = this; const { params } = swiper; swiper.animating = false; if (params.cssMode) return; swiper.setTransition(0); transitionEmit({ swiper, runCallbacks, direction, step: 'End' }); } var transition = { setTransition, transitionStart, transitionEnd }; function slideTo(index = 0, speed = this.params.speed, runCallbacks = true, internal, initial) { if (typeof index !== 'number' && typeof index !== 'string') { throw new Error(`The 'index' argument cannot have type other than 'number' or 'string'. [${typeof index}] given.`); } if (typeof index === 'string') { /** * The `index` argument converted from `string` to `number`. * @type {number} */ const indexAsNumber = parseInt(index, 10); /** * Determines whether the `index` argument is a valid `number` * after being converted from the `string` type. * @type {boolean} */ const isValidNumber = isFinite(indexAsNumber); if (!isValidNumber) { throw new Error(`The passed-in 'index' (string) couldn't be converted to 'number'. [${index}] given.`); } // Knowing that the converted `index` is a valid number, // we can update the original argument's value. index = indexAsNumber; } const swiper = this; let slideIndex = index; if (slideIndex < 0) slideIndex = 0; const { params, snapGrid, slidesGrid, previousIndex, activeIndex, rtlTranslate: rtl, wrapperEl, enabled } = swiper; if (swiper.animating && params.preventInteractionOnTransition || !enabled && !internal && !initial) { return false; } const skip = Math.min(swiper.params.slidesPerGroupSkip, slideIndex); let snapIndex = skip + Math.floor((slideIndex - skip) / swiper.params.slidesPerGroup); if (snapIndex >= snapGrid.length) snapIndex = snapGrid.length - 1; if ((activeIndex || params.initialSlide || 0) === (previousIndex || 0) && runCallbacks) { swiper.emit('beforeSlideChangeStart'); } const translate = -snapGrid[snapIndex]; // Update progress swiper.updateProgress(translate); // Normalize slideIndex if (params.normalizeSlideIndex) { for (let i = 0; i < slidesGrid.length; i += 1) { const normalizedTranslate = -Math.floor(translate * 100); const normalizedGrid = Math.floor(slidesGrid[i] * 100); const normalizedGridNext = Math.floor(slidesGrid[i + 1] * 100); if (typeof slidesGrid[i + 1] !== 'undefined') { if (normalizedTranslate >= normalizedGrid && normalizedTranslate < normalizedGridNext - (normalizedGridNext - normalizedGrid) / 2) { slideIndex = i; } else if (normalizedTranslate >= normalizedGrid && normalizedTranslate < normalizedGridNext) { slideIndex = i + 1; } } else if (normalizedTranslate >= normalizedGrid) { slideIndex = i; } } } // Directions locks if (swiper.initialized && slideIndex !== activeIndex) { if (!swiper.allowSlideNext && translate < swiper.translate && translate < swiper.minTranslate()) { return false; } if (!swiper.allowSlidePrev && translate > swiper.translate && translate > swiper.maxTranslate()) { if ((activeIndex || 0) !== slideIndex) return false; } } let direction; if (slideIndex > activeIndex) direction = 'next';else if (slideIndex < activeIndex) direction = 'prev';else direction = 'reset'; // Update Index if (rtl && -translate === swiper.translate || !rtl && translate === swiper.translate) { swiper.updateActiveIndex(slideIndex); // Update Height if (params.autoHeight) { swiper.updateAutoHeight(); } swiper.updateSlidesClasses(); if (params.effect !== 'slide') { swiper.setTranslate(translate); } if (direction !== 'reset') { swiper.transitionStart(runCallbacks, direction); swiper.transitionEnd(runCallbacks, direction); } return false; } if (params.cssMode) { const isH = swiper.isHorizontal(); const t = rtl ? translate : -translate; if (speed === 0) { const isVirtual = swiper.virtual && swiper.params.virtual.enabled; if (isVirtual) { swiper.wrapperEl.style.scrollSnapType = 'none'; } wrapperEl[isH ? 'scrollLeft' : 'scrollTop'] = t; if (isVirtual) { requestAnimationFrame(() => { swiper.wrapperEl.style.scrollSnapType = ''; }); } } else { if (!swiper.support.smoothScroll) { animateCSSModeScroll({ swiper, targetPosition: t, side: isH ? 'left' : 'top' }); return true; } wrapperEl.scrollTo({ [isH ? 'left' : 'top']: t, behavior: 'smooth' }); } return true; } if (speed === 0) { swiper.setTransition(0); swiper.setTranslate(translate); swiper.updateActiveIndex(slideIndex); swiper.updateSlidesClasses(); swiper.emit('beforeTransitionStart', speed, internal); swiper.transitionStart(runCallbacks, direction); swiper.transitionEnd(runCallbacks, direction); } else { swiper.setTransition(speed); swiper.setTranslate(translate); swiper.updateActiveIndex(slideIndex); swiper.updateSlidesClasses(); swiper.emit('beforeTransitionStart', speed, internal); swiper.transitionStart(runCallbacks, direction); if (!swiper.animating) { swiper.animating = true; if (!swiper.onSlideToWrapperTransitionEnd) { swiper.onSlideToWrapperTransitionEnd = function transitionEnd(e) { if (!swiper || swiper.destroyed) return; if (e.target !== this) return; swiper.$wrapperEl[0].removeEventListener('transitionend', swiper.onSlideToWrapperTransitionEnd); swiper.$wrapperEl[0].removeEventListener('webkitTransitionEnd', swiper.onSlideToWrapperTransitionEnd); swiper.onSlideToWrapperTransitionEnd = null; delete swiper.onSlideToWrapperTransitionEnd; swiper.transitionEnd(runCallbacks, direction); }; } swiper.$wrapperEl[0].addEventListener('transitionend', swiper.onSlideToWrapperTransitionEnd); swiper.$wrapperEl[0].addEventListener('webkitTransitionEnd', swiper.onSlideToWrapperTransitionEnd); } } return true; } function slideToLoop(index = 0, speed = this.params.speed, runCallbacks = true, internal) { const swiper = this; let newIndex = index; if (swiper.params.loop) { newIndex += swiper.loopedSlides; } return swiper.slideTo(newIndex, speed, runCallbacks, internal); } /* eslint no-unused-vars: "off" */ function slideNext(speed = this.params.speed, runCallbacks = true, internal) { const swiper = this; const { animating, enabled, params } = swiper; if (!enabled) return swiper; let perGroup = params.slidesPerGroup; if (params.slidesPerView === 'auto' && params.slidesPerGroup === 1 && params.slidesPerGroupAuto) { perGroup = Math.max(swiper.slidesPerViewDynamic('current', true), 1); } const increment = swiper.activeIndex < params.slidesPerGroupSkip ? 1 : perGroup; if (params.loop) { if (animating && params.loopPreventsSlide) return false; swiper.loopFix(); // eslint-disable-next-line swiper._clientLeft = swiper.$wrapperEl[0].clientLeft; } return swiper.slideTo(swiper.activeIndex + increment, speed, runCallbacks, internal); } /* eslint no-unused-vars: "off" */ function slidePrev(speed = this.params.speed, runCallbacks = true, internal) { const swiper = this; const { params, animating, snapGrid, slidesGrid, rtlTranslate, enabled } = swiper; if (!enabled) return swiper; if (params.loop) { if (animating && params.loopPreventsSlide) return false; swiper.loopFix(); // eslint-disable-next-line swiper._clientLeft = swiper.$wrapperEl[0].clientLeft; } const translate = rtlTranslate ? swiper.translate : -swiper.translate; function normalize(val) { if (val < 0) return -Math.floor(Math.abs(val)); return Math.floor(val); } const normalizedTranslate = normalize(translate); const normalizedSnapGrid = snapGrid.map(val => normalize(val)); let prevSnap = snapGrid[normalizedSnapGrid.indexOf(normalizedTranslate) - 1]; if (typeof prevSnap === 'undefined' && params.cssMode) { let prevSnapIndex; snapGrid.forEach((snap, snapIndex) => { if (normalizedTranslate >= snap) { // prevSnap = snap; prevSnapIndex = snapIndex; } }); if (typeof prevSnapIndex !== 'undefined') { prevSnap = snapGrid[prevSnapIndex > 0 ? prevSnapIndex - 1 : prevSnapIndex]; } } let prevIndex = 0; if (typeof prevSnap !== 'undefined') { prevIndex = slidesGrid.indexOf(prevSnap); if (prevIndex < 0) prevIndex = swiper.activeIndex - 1; if (params.slidesPerView === 'auto' && params.slidesPerGroup === 1 && params.slidesPerGroupAuto) { prevIndex = prevIndex - swiper.slidesPerViewDynamic('previous', true) + 1; prevIndex = Math.max(prevIndex, 0); } } return swiper.slideTo(prevIndex, speed, runCallbacks, internal); } /* eslint no-unused-vars: "off" */ function slideReset(speed = this.params.speed, runCallbacks = true, internal) { const swiper = this; return swiper.slideTo(swiper.activeIndex, speed, runCallbacks, internal); } /* eslint no-unused-vars: "off" */ function slideToClosest(speed = this.params.speed, runCallbacks = true, internal, threshold = 0.5) { const swiper = this; let index = swiper.activeIndex; const skip = Math.min(swiper.params.slidesPerGroupSkip, index); const snapIndex = skip + Math.floor((index - skip) / swiper.params.slidesPerGroup); const translate = swiper.rtlTranslate ? swiper.translate : -swiper.translate; if (translate >= swiper.snapGrid[snapIndex]) { // The current translate is on or after the current snap index, so the choice // is between the current index and the one after it. const currentSnap = swiper.snapGrid[snapIndex]; const nextSnap = swiper.snapGrid[snapIndex + 1]; if (translate - currentSnap > (nextSnap - currentSnap) * threshold) { index += swiper.params.slidesPerGroup; } } else { // The current translate is before the current snap index, so the choice // is between the current index and the one before it. const prevSnap = swiper.snapGrid[snapIndex - 1]; const currentSnap = swiper.snapGrid[snapIndex]; if (translate - prevSnap <= (currentSnap - prevSnap) * threshold) { index -= swiper.params.slidesPerGroup; } } index = Math.max(index, 0); index = Math.min(index, swiper.slidesGrid.length - 1); return swiper.slideTo(index, speed, runCallbacks, internal); } function slideToClickedSlide() { const swiper = this; const { params, $wrapperEl } = swiper; const slidesPerView = params.slidesPerView === 'auto' ? swiper.slidesPerViewDynamic() : params.slidesPerView; let slideToIndex = swiper.clickedIndex; let realIndex; if (params.loop) { if (swiper.animating) return; realIndex = parseInt($(swiper.clickedSlide).attr('data-swiper-slide-index'), 10); if (params.centeredSlides) { if (slideToIndex < swiper.loopedSlides - slidesPerView / 2 || slideToIndex > swiper.slides.length - swiper.loopedSlides + slidesPerView / 2) { swiper.loopFix(); slideToIndex = $wrapperEl.children(`.${params.slideClass}[data-swiper-slide-index="${realIndex}"]:not(.${params.slideDuplicateClass})`).eq(0).index(); nextTick(() => { swiper.slideTo(slideToIndex); }); } else { swiper.slideTo(slideToIndex); } } else if (slideToIndex > swiper.slides.length - slidesPerView) { swiper.loopFix(); slideToIndex = $wrapperEl.children(`.${params.slideClass}[data-swiper-slide-index="${realIndex}"]:not(.${params.slideDuplicateClass})`).eq(0).index(); nextTick(() => { swiper.slideTo(slideToIndex); }); } else { swiper.slideTo(slideToIndex); } } else { swiper.slideTo(slideToIndex); } } var slide = { slideTo, slideToLoop, slideNext, slidePrev, slideReset, slideToClosest, slideToClickedSlide }; function loopCreate() { const swiper = this; const document = getDocument(); const { params, $wrapperEl } = swiper; // Remove duplicated slides $wrapperEl.children(`.${params.slideClass}.${params.slideDuplicateClass}`).remove(); let slides = $wrapperEl.children(`.${params.slideClass}`); if (params.loopFillGroupWithBlank) { const blankSlidesNum = params.slidesPerGroup - slides.length % params.slidesPerGroup; if (blankSlidesNum !== params.slidesPerGroup) { for (let i = 0; i < blankSlidesNum; i += 1) { const blankNode = $(document.createElement('div')).addClass(`${params.slideClass} ${params.slideBlankClass}`); $wrapperEl.append(blankNode); } slides = $wrapperEl.children(`.${params.slideClass}`); } } if (params.slidesPerView === 'auto' && !params.loopedSlides) params.loopedSlides = slides.length; swiper.loopedSlides = Math.ceil(parseFloat(params.loopedSlides || params.slidesPerView, 10)); swiper.loopedSlides += params.loopAdditionalSlides; if (swiper.loopedSlides > slides.length) { swiper.loopedSlides = slides.length; } const prependSlides = []; const appendSlides = []; slides.each((el, index) => { const slide = $(el); if (index < swiper.loopedSlides) { appendSlides.push(el); } if (index < slides.length && index >= slides.length - swiper.loopedSlides) { prependSlides.push(el); } slide.attr('data-swiper-slide-index', index); }); for (let i = 0; i < appendSlides.length; i += 1) { $wrapperEl.append($(appendSlides[i].cloneNode(true)).addClass(params.slideDuplicateClass)); } for (let i = prependSlides.length - 1; i >= 0; i -= 1) { $wrapperEl.prepend($(prependSlides[i].cloneNode(true)).addClass(params.slideDuplicateClass)); } } function loopFix() { const swiper = this; swiper.emit('beforeLoopFix'); const { activeIndex, slides, loopedSlides, allowSlidePrev, allowSlideNext, snapGrid, rtlTranslate: rtl } = swiper; let newIndex; swiper.allowSlidePrev = true; swiper.allowSlideNext = true; const snapTranslate = -snapGrid[activeIndex]; const diff = snapTranslate - swiper.getTranslate(); // Fix For Negative Oversliding if (activeIndex < loopedSlides) { newIndex = slides.length - loopedSlides * 3 + activeIndex; newIndex += loopedSlides; const slideChanged = swiper.slideTo(newIndex, 0, false, true); if (slideChanged && diff !== 0) { swiper.setTranslate((rtl ? -swiper.translate : swiper.translate) - diff); } } else if (activeIndex >= slides.length - loopedSlides) { // Fix For Positive Oversliding newIndex = -slides.length + activeIndex + loopedSlides; newIndex += loopedSlides; const slideChanged = swiper.slideTo(newIndex, 0, false, true); if (slideChanged && diff !== 0) { swiper.setTranslate((rtl ? -swiper.translate : swiper.translate) - diff); } } swiper.allowSlidePrev = allowSlidePrev; swiper.allowSlideNext = allowSlideNext; swiper.emit('loopFix'); } function loopDestroy() { const swiper = this; const { $wrapperEl, params, slides } = swiper; $wrapperEl.children(`.${params.slideClass}.${params.slideDuplicateClass},.${params.slideClass}.${params.slideBlankClass}`).remove(); slides.removeAttr('data-swiper-slide-index'); } var loop = { loopCreate, loopFix, loopDestroy }; function setGrabCursor(moving) { const swiper = this; if (swiper.support.touch || !swiper.params.simulateTouch || swiper.params.watchOverflow && swiper.isLocked || swiper.params.cssMode) return; const el = swiper.params.touchEventsTarget === 'container' ? swiper.el : swiper.wrapperEl; el.style.cursor = 'move'; el.style.cursor = moving ? '-webkit-grabbing' : '-webkit-grab'; el.style.cursor = moving ? '-moz-grabbin' : '-moz-grab'; el.style.cursor = moving ? 'grabbing' : 'grab'; } function unsetGrabCursor() { const swiper = this; if (swiper.support.touch || swiper.params.watchOverflow && swiper.isLocked || swiper.params.cssMode) { return; } swiper[swiper.params.touchEventsTarget === 'container' ? 'el' : 'wrapperEl'].style.cursor = ''; } var grabCursor = { setGrabCursor, unsetGrabCursor }; function closestElement(selector, base = this) { function __closestFrom(el) { if (!el || el === getDocument() || el === getWindow()) return null; if (el.assignedSlot) el = el.assignedSlot; const found = el.closest(selector); return found || __closestFrom(el.getRootNode().host); } return __closestFrom(base); } function onTouchStart(event) { const swiper = this; const document = getDocument(); const window = getWindow(); const data = swiper.touchEventsData; const { params, touches, enabled } = swiper; if (!enabled) return; if (swiper.animating && params.preventInteractionOnTransition) { return; } if (!swiper.animating && params.cssMode && params.loop) { swiper.loopFix(); } let e = event; if (e.originalEvent) e = e.originalEvent; let $targetEl = $(e.target); if (params.touchEventsTarget === 'wrapper') { if (!$targetEl.closest(swiper.wrapperEl).length) return; } data.isTouchEvent = e.type === 'touchstart'; if (!data.isTouchEvent && 'which' in e && e.which === 3) return; if (!data.isTouchEvent && 'button' in e && e.button > 0) return; if (data.isTouched && data.isMoved) return; // change target el for shadow root component const swipingClassHasValue = !!params.noSwipingClass && params.noSwipingClass !== ''; if (swipingClassHasValue && e.target && e.target.shadowRoot && event.path && event.path[0]) { $targetEl = $(event.path[0]); } const noSwipingSelector = params.noSwipingSelector ? params.noSwipingSelector : `.${params.noSwipingClass}`; const isTargetShadow = !!(e.target && e.target.shadowRoot); // use closestElement for shadow root element to get the actual closest for nested shadow root element if (params.noSwiping && (isTargetShadow ? closestElement(noSwipingSelector, e.target) : $targetEl.closest(noSwipingSelector)[0])) { swiper.allowClick = true; return; } if (params.swipeHandler) { if (!$targetEl.closest(params.swipeHandler)[0]) return; } touches.currentX = e.type === 'touchstart' ? e.targetTouches[0].pageX : e.pageX; touches.currentY = e.type === 'touchstart' ? e.targetTouches[0].pageY : e.pageY; const startX = touches.currentX; const startY = touches.currentY; // Do NOT start if iOS edge swipe is detected. Otherwise iOS app cannot swipe-to-go-back anymore const edgeSwipeDetection = params.edgeSwipeDetection || params.iOSEdgeSwipeDetection; const edgeSwipeThreshold = params.edgeSwipeThreshold || params.iOSEdgeSwipeThreshold; if (edgeSwipeDetection && (startX <= edgeSwipeThreshold || startX >= window.innerWidth - edgeSwipeThreshold)) { if (edgeSwipeDetection === 'prevent') { event.preventDefault(); } else { return; } } Object.assign(data, { isTouched: true, isMoved: false, allowTouchCallbacks: true, isScrolling: undefined, startMoving: undefined }); touches.startX = startX; touches.startY = startY; data.touchStartTime = now(); swiper.allowClick = true; swiper.updateSize(); swiper.swipeDirection = undefined; if (params.threshold > 0) data.allowThresholdMove = false; if (e.type !== 'touchstart') { let preventDefault = true; if ($targetEl.is(data.focusableElements)) preventDefault = false; if (document.activeElement && $(document.activeElement).is(data.focusableElements) && document.activeElement !== $targetEl[0]) { document.activeElement.blur(); } const shouldPreventDefault = preventDefault && swiper.allowTouchMove && params.touchStartPreventDefault; if ((params.touchStartForcePreventDefault || shouldPreventDefault) && !$targetEl[0].isContentEditable) { e.preventDefault(); } } swiper.emit('touchStart', e); } function onTouchMove(event) { const document = getDocument(); const swiper = this; const data = swiper.touchEventsData; const { params, touches, rtlTranslate: rtl, enabled } = swiper; if (!enabled) return; let e = event; if (e.originalEvent) e = e.originalEvent; if (!data.isTouched) { if (data.startMoving && data.isScrolling) { swiper.emit('touchMoveOpposite', e); } return; } if (data.isTouchEvent && e.type !== 'touchmove') return; const targetTouch = e.type === 'touchmove' && e.targetTouches && (e.targetTouches[0] || e.changedTouches[0]); const pageX = e.type === 'touchmove' ? targetTouch.pageX : e.pageX; const pageY = e.type === 'touchmove' ? targetTouch.pageY : e.pageY; if (e.preventedByNestedSwiper) { touches.startX = pageX; touches.startY = pageY; return; } if (!swiper.allowTouchMove) { // isMoved = true; swiper.allowClick = false; if (data.isTouched) { Object.assign(touches, { startX: pageX, startY: pageY, currentX: pageX, currentY: pageY }); data.touchStartTime = now(); } return; } if (data.isTouchEvent && params.touchReleaseOnEdges && !params.loop) { if (swiper.isVertical()) { // Vertical if (pageY < touches.startY && swiper.translate <= swiper.maxTranslate() || pageY > touches.startY && swiper.translate >= swiper.minTranslate()) { data.isTouched = false; data.isMoved = false; return; } } else if (pageX < touches.startX && swiper.translate <= swiper.maxTranslate() || pageX > touches.startX && swiper.translate >= swiper.minTranslate()) { return; } } if (data.isTouchEvent && document.activeElement) { if (e.target === document.activeElement && $(e.target).is(data.focusableElements)) { data.isMoved = true; swiper.allowClick = false; return; } } if (data.allowTouchCallbacks) { swiper.emit('touchMove', e); } if (e.targetTouches && e.targetTouches.length > 1) return; touches.currentX = pageX; touches.currentY = pageY; const diffX = touches.currentX - touches.startX; const diffY = touches.currentY - touches.startY; if (swiper.params.threshold && Math.sqrt(diffX ** 2 + diffY ** 2) < swiper.params.threshold) return; if (typeof data.isScrolling === 'undefined') { let touchAngle; if (swiper.isHorizontal() && touches.currentY === touches.startY || swiper.isVertical() && touches.currentX === touches.startX) { data.isScrolling = false; } else { // eslint-disable-next-line if (diffX * diffX + diffY * diffY >= 25) { touchAngle = Math.atan2(Math.abs(diffY), Math.abs(diffX)) * 180 / Math.PI; data.isScrolling = swiper.isHorizontal() ? touchAngle > params.touchAngle : 90 - touchAngle > params.touchAngle; } } } if (data.isScrolling) { swiper.emit('touchMoveOpposite', e); } if (typeof data.startMoving === 'undefined') { if (touches.currentX !== touches.startX || touches.currentY !== touches.startY) { data.startMoving = true; } } if (data.isScrolling) { data.isTouched = false; return; } if (!data.startMoving) { return; } swiper.allowClick = false; if (!params.cssMode && e.cancelable) { e.preventDefault(); } if (params.touchMoveStopPropagation && !params.nested) { e.stopPropagation(); } if (!data.isMoved) { if (params.loop && !params.cssMode) { swiper.loopFix(); } data.startTranslate = swiper.getTranslate(); swiper.setTransition(0); if (swiper.animating) { swiper.$wrapperEl.trigger('webkitTransitionEnd transitionend'); } data.allowMomentumBounce = false; // Grab Cursor if (params.grabCursor && (swiper.allowSlideNext === true || swiper.allowSlidePrev === true)) { swiper.setGrabCursor(true); } swiper.emit('sliderFirstMove', e); } swiper.emit('sliderMove', e); data.isMoved = true; let diff = swiper.isHorizontal() ? diffX : diffY; touches.diff = diff; diff *= params.touchRatio; if (rtl) diff = -diff; swiper.swipeDirection = diff > 0 ? 'prev' : 'next'; data.currentTranslate = diff + data.startTranslate; let disableParentSwiper = true; let resistanceRatio = params.resistanceRatio; if (params.touchReleaseOnEdges) { resistanceRatio = 0; } if (diff > 0 && data.currentTranslate > swiper.minTranslate()) { disableParentSwiper = false; if (params.resistance) data.currentTranslate = swiper.minTranslate() - 1 + (-swiper.minTranslate() + data.startTranslate + diff) ** resistanceRatio; } else if (diff < 0 && data.currentTranslate < swiper.maxTranslate()) { disableParentSwiper = false; if (params.resistance) data.currentTranslate = swiper.maxTranslate() + 1 - (swiper.maxTranslate() - data.startTranslate - diff) ** resistanceRatio; } if (disableParentSwiper) { e.preventedByNestedSwiper = true; } // Directions locks if (!swiper.allowSlideNext && swiper.swipeDirection === 'next' && data.currentTranslate < data.startTranslate) { data.currentTranslate = data.startTranslate; } if (!swiper.allowSlidePrev && swiper.swipeDirection === 'prev' && data.currentTranslate > data.startTranslate) { data.currentTranslate = data.startTranslate; } if (!swiper.allowSlidePrev && !swiper.allowSlideNext) { data.currentTranslate = data.startTranslate; } // Threshold if (params.threshold > 0) { if (Math.abs(diff) > params.threshold || data.allowThresholdMove) { if (!data.allowThresholdMove) { data.allowThresholdMove = true; touches.startX = touches.currentX; touches.startY = touches.currentY; data.currentTranslate = data.startTranslate; touches.diff = swiper.isHorizontal() ? touches.currentX - touches.startX : touches.currentY - touches.startY; return; } } else { data.currentTranslate = data.startTranslate; return; } } if (!params.followFinger || params.cssMode) return; // Update active index in free mode if (params.freeMode && params.freeMode.enabled && swiper.freeMode || params.watchSlidesProgress) { swiper.updateActiveIndex(); swiper.updateSlidesClasses(); } if (swiper.params.freeMode && params.freeMode.enabled && swiper.freeMode) { swiper.freeMode.onTouchMove(); } // Update progress swiper.updateProgress(data.currentTranslate); // Update translate swiper.setTranslate(data.currentTranslate); } function onTouchEnd(event) { const swiper = this; const data = swiper.touchEventsData; const { params, touches, rtlTranslate: rtl, slidesGrid, enabled } = swiper; if (!enabled) return; let e = event; if (e.originalEvent) e = e.originalEvent; if (data.allowTouchCallbacks) { swiper.emit('touchEnd', e); } data.allowTouchCallbacks = false; if (!data.isTouched) { if (data.isMoved && params.grabCursor) { swiper.setGrabCursor(false); } data.isMoved = false; data.startMoving = false; return; } // Return Grab Cursor if (params.grabCursor && data.isMoved && data.isTouched && (swiper.allowSlideNext === true || swiper.allowSlidePrev === true)) { swiper.setGrabCursor(false); } // Time diff const touchEndTime = now(); const timeDiff = touchEndTime - data.touchStartTime; // Tap, doubleTap, Click if (swiper.allowClick) { swiper.updateClickedSlide(e); swiper.emit('tap click', e); if (timeDiff < 300 && touchEndTime - data.lastClickTime < 300) { swiper.emit('doubleTap doubleClick', e); } } data.lastClickTime = now(); nextTick(() => { if (!swiper.destroyed) swiper.allowClick = true; }); if (!data.isTouched || !data.isMoved || !swiper.swipeDirection || touches.diff === 0 || data.currentTranslate === data.startTranslate) { data.isTouched = false; data.isMoved = false; data.startMoving = false; return; } data.isTouched = false; data.isMoved = false; data.startMoving = false; let currentPos; if (params.followFinger) { currentPos = rtl ? swiper.translate : -swiper.translate; } else { currentPos = -data.currentTranslate; } if (params.cssMode) { return; } if (swiper.params.freeMode && params.freeMode.enabled) { swiper.freeMode.onTouchEnd({ currentPos }); return; } // Find current slide let stopIndex = 0; let groupSize = swiper.slidesSizesGrid[0]; for (let i = 0; i < slidesGrid.length; i += i < params.slidesPerGroupSkip ? 1 : params.slidesPerGroup) { const increment = i < params.slidesPerGroupSkip - 1 ? 1 : params.slidesPerGroup; if (typeof slidesGrid[i + increment] !== 'undefined') { if (currentPos >= slidesGrid[i] && currentPos < slidesGrid[i + increment]) { stopIndex = i; groupSize = slidesGrid[i + increment] - slidesGrid[i]; } } else if (currentPos >= slidesGrid[i]) { stopIndex = i; groupSize = slidesGrid[slidesGrid.length - 1] - slidesGrid[slidesGrid.length - 2]; } } // Find current slide size const ratio = (currentPos - slidesGrid[stopIndex]) / groupSize; const increment = stopIndex < params.slidesPerGroupSkip - 1 ? 1 : params.slidesPerGroup; if (timeDiff > params.longSwipesMs) { // Long touches if (!params.longSwipes) { swiper.slideTo(swiper.activeIndex); return; } if (swiper.swipeDirection === 'next') { if (ratio >= params.longSwipesRatio) swiper.slideTo(stopIndex + increment);else swiper.slideTo(stopIndex); } if (swiper.swipeDirection === 'prev') { if (ratio > 1 - params.longSwipesRatio) swiper.slideTo(stopIndex + increment);else swiper.slideTo(stopIndex); } } else { // Short swipes if (!params.shortSwipes) { swiper.slideTo(swiper.activeIndex); return; } const isNavButtonTarget = swiper.navigation && (e.target === swiper.navigation.nextEl || e.target === swiper.navigation.prevEl); if (!isNavButtonTarget) { if (swiper.swipeDirection === 'next') { swiper.slideTo(stopIndex + increment); } if (swiper.swipeDirection === 'prev') { swiper.slideTo(stopIndex); } } else if (e.target === swiper.navigation.nextEl) { swiper.slideTo(stopIndex + increment); } else { swiper.slideTo(stopIndex); } } } function onResize() { const swiper = this; const { params, el } = swiper; if (el && el.offsetWidth === 0) return; // Breakpoints if (params.breakpoints) { swiper.setBreakpoint(); } // Save locks const { allowSlideNext, allowSlidePrev, snapGrid } = swiper; // Disable locks on resize swiper.allowSlideNext = true; swiper.allowSlidePrev = true; swiper.updateSize(); swiper.updateSlides(); swiper.updateSlidesClasses(); if ((params.slidesPerView === 'auto' || params.slidesPerView > 1) && swiper.isEnd && !swiper.isBeginning && !swiper.params.centeredSlides) { swiper.slideTo(swiper.slides.length - 1, 0, false, true); } else { swiper.slideTo(swiper.activeIndex, 0, false, true); } if (swiper.autoplay && swiper.autoplay.running && swiper.autoplay.paused) { swiper.autoplay.run(); } // Return locks after resize swiper.allowSlidePrev = allowSlidePrev; swiper.allowSlideNext = allowSlideNext; if (swiper.params.watchOverflow && snapGrid !== swiper.snapGrid) { swiper.checkOverflow(); } } function onClick(e) { const swiper = this; if (!swiper.enabled) return; if (!swiper.allowClick) { if (swiper.params.preventClicks) e.preventDefault(); if (swiper.params.preventClicksPropagation && swiper.animating) { e.stopPropagation(); e.stopImmediatePropagation(); } } } function onScroll() { const swiper = this; const { wrapperEl, rtlTranslate, enabled } = swiper; if (!enabled) return; swiper.previousTranslate = swiper.translate; if (swiper.isHorizontal()) { swiper.translate = -wrapperEl.scrollLeft; } else { swiper.translate = -wrapperEl.scrollTop; } // eslint-disable-next-line if (swiper.translate === -0) swiper.translate = 0; swiper.updateActiveIndex(); swiper.updateSlidesClasses(); let newProgress; const translatesDiff = swiper.maxTranslate() - swiper.minTranslate(); if (translatesDiff === 0) { newProgress = 0; } else { newProgress = (swiper.translate - swiper.minTranslate()) / translatesDiff; } if (newProgress !== swiper.progress) { swiper.updateProgress(rtlTranslate ? -swiper.translate : swiper.translate); } swiper.emit('setTranslate', swiper.translate, false); } let dummyEventAttached = false; function dummyEventListener() {} const events = (swiper, method) => { const document = getDocument(); const { params, touchEvents, el, wrapperEl, device, support } = swiper; const capture = !!params.nested; const domMethod = method === 'on' ? 'addEventListener' : 'removeEventListener'; const swiperMethod = method; // Touch Events if (!support.touch) { el[domMethod](touchEvents.start, swiper.onTouchStart, false); document[domMethod](touchEvents.move, swiper.onTouchMove, capture); document[domMethod](touchEvents.end, swiper.onTouchEnd, false); } else { const passiveListener = touchEvents.start === 'touchstart' && support.passiveListener && params.passiveListeners ? { passive: true, capture: false } : false; el[domMethod](touchEvents.start, swiper.onTouchStart, passiveListener); el[domMethod](touchEvents.move, swiper.onTouchMove, support.passiveListener ? { passive: false, capture } : capture); el[domMethod](touchEvents.end, swiper.onTouchEnd, passiveListener); if (touchEvents.cancel) { el[domMethod](touchEvents.cancel, swiper.onTouchEnd, passiveListener); } } // Prevent Links Clicks if (params.preventClicks || params.preventClicksPropagation) { el[domMethod]('click', swiper.onClick, true); } if (params.cssMode) { wrapperEl[domMethod]('scroll', swiper.onScroll); } // Resize handler if (params.updateOnWindowResize) { swiper[swiperMethod](device.ios || device.android ? 'resize orientationchange observerUpdate' : 'resize observerUpdate', onResize, true); } else { swiper[swiperMethod]('observerUpdate', onResize, true); } }; function attachEvents() { const swiper = this; const document = getDocument(); const { params, support } = swiper; swiper.onTouchStart = onTouchStart.bind(swiper); swiper.onTouchMove = onTouchMove.bind(swiper); swiper.onTouchEnd = onTouchEnd.bind(swiper); if (params.cssMode) { swiper.onScroll = onScroll.bind(swiper); } swiper.onClick = onClick.bind(swiper); if (support.touch && !dummyEventAttached) { document.addEventListener('touchstart', dummyEventListener); dummyEventAttached = true; } events(swiper, 'on'); } function detachEvents() { const swiper = this; events(swiper, 'off'); } var events$1 = { attachEvents, detachEvents }; const isGridEnabled = (swiper, params) => { return swiper.grid && params.grid && params.grid.rows > 1; }; function setBreakpoint() { const swiper = this; const { activeIndex, initialized, loopedSlides = 0, params, $el } = swiper; const breakpoints = params.breakpoints; if (!breakpoints || breakpoints && Object.keys(breakpoints).length === 0) return; // Get breakpoint for window width and update parameters const breakpoint = swiper.getBreakpoint(breakpoints, swiper.params.breakpointsBase, swiper.el); if (!breakpoint || swiper.currentBreakpoint === breakpoint) return; const breakpointOnlyParams = breakpoint in breakpoints ? breakpoints[breakpoint] : undefined; const breakpointParams = breakpointOnlyParams || swiper.originalParams; const wasMultiRow = isGridEnabled(swiper, params); const isMultiRow = isGridEnabled(swiper, breakpointParams); const wasEnabled = params.enabled; if (wasMultiRow && !isMultiRow) { $el.removeClass(`${params.containerModifierClass}grid ${params.containerModifierClass}grid-column`); swiper.emitContainerClasses(); } else if (!wasMultiRow && isMultiRow) { $el.addClass(`${params.containerModifierClass}grid`); if (breakpointParams.grid.fill && breakpointParams.grid.fill === 'column' || !breakpointParams.grid.fill && params.grid.fill === 'column') { $el.addClass(`${params.containerModifierClass}grid-column`); } swiper.emitContainerClasses(); } const directionChanged = breakpointParams.direction && breakpointParams.direction !== params.direction; const needsReLoop = params.loop && (breakpointParams.slidesPerView !== params.slidesPerView || directionChanged); if (directionChanged && initialized) { swiper.changeDirection(); } extend(swiper.params, breakpointParams); const isEnabled = swiper.params.enabled; Object.assign(swiper, { allowTouchMove: swiper.params.allowTouchMove, allowSlideNext: swiper.params.allowSlideNext, allowSlidePrev: swiper.params.allowSlidePrev }); if (wasEnabled && !isEnabled) { swiper.disable(); } else if (!wasEnabled && isEnabled) { swiper.enable(); } swiper.currentBreakpoint = breakpoint; swiper.emit('_beforeBreakpoint', breakpointParams); if (needsReLoop && initialized) { swiper.loopDestroy(); swiper.loopCreate(); swiper.updateSlides(); swiper.slideTo(activeIndex - loopedSlides + swiper.loopedSlides, 0, false); } swiper.emit('breakpoint', breakpointParams); } function getBreakpoint(breakpoints, base = 'window', containerEl) { if (!breakpoints || base === 'container' && !containerEl) return undefined; let breakpoint = false; const window = getWindow(); const currentHeight = base === 'window' ? window.innerHeight : containerEl.clientHeight; const points = Object.keys(breakpoints).map(point => { if (typeof point === 'string' && point.indexOf('@') === 0) { const minRatio = parseFloat(point.substr(1)); const value = currentHeight * minRatio; return { value, point }; } return { value: point, point }; }); points.sort((a, b) => parseInt(a.value, 10) - parseInt(b.value, 10)); for (let i = 0; i < points.length; i += 1) { const { point, value } = points[i]; if (base === 'window') { if (window.matchMedia(`(min-width: ${value}px)`).matches) { breakpoint = point; } } else if (value <= containerEl.clientWidth) { breakpoint = point; } } return breakpoint || 'max'; } var breakpoints = { setBreakpoint, getBreakpoint }; function prepareClasses(entries, prefix) { const resultClasses = []; entries.forEach(item => { if (typeof item === 'object') { Object.keys(item).forEach(classNames => { if (item[classNames]) { resultClasses.push(prefix + classNames); } }); } else if (typeof item === 'string') { resultClasses.push(prefix + item); } }); return resultClasses; } function addClasses() { const swiper = this; const { classNames, params, rtl, $el, device, support } = swiper; // prettier-ignore const suffixes = prepareClasses(['initialized', params.direction, { 'pointer-events': !support.touch }, { 'free-mode': swiper.params.freeMode && params.freeMode.enabled }, { 'autoheight': params.autoHeight }, { 'rtl': rtl }, { 'grid': params.grid && params.grid.rows > 1 }, { 'grid-column': params.grid && params.grid.rows > 1 && params.grid.fill === 'column' }, { 'android': device.android }, { 'ios': device.ios }, { 'css-mode': params.cssMode }, { 'centered': params.cssMode && params.centeredSlides }], params.containerModifierClass); classNames.push(...suffixes); $el.addClass([...classNames].join(' ')); swiper.emitContainerClasses(); } function removeClasses() { const swiper = this; const { $el, classNames } = swiper; $el.removeClass(classNames.join(' ')); swiper.emitContainerClasses(); } var classes = { addClasses, removeClasses }; function loadImage(imageEl, src, srcset, sizes, checkForComplete, callback) { const window = getWindow(); let image; function onReady() { if (callback) callback(); } const isPicture = $(imageEl).parent('picture')[0]; if (!isPicture && (!imageEl.complete || !checkForComplete)) { if (src) { image = new window.Image(); image.onload = onReady; image.onerror = onReady; if (sizes) { image.sizes = sizes; } if (srcset) { image.srcset = srcset; } if (src) { image.src = src; } } else { onReady(); } } else { // image already loaded... onReady(); } } function preloadImages() { const swiper = this; swiper.imagesToLoad = swiper.$el.find('img'); function onReady() { if (typeof swiper === 'undefined' || swiper === null || !swiper || swiper.destroyed) return; if (swiper.imagesLoaded !== undefined) swiper.imagesLoaded += 1; if (swiper.imagesLoaded === swiper.imagesToLoad.length) { if (swiper.params.updateOnImagesReady) swiper.update(); swiper.emit('imagesReady'); } } for (let i = 0; i < swiper.imagesToLoad.length; i += 1) { const imageEl = swiper.imagesToLoad[i]; swiper.loadImage(imageEl, imageEl.currentSrc || imageEl.getAttribute('src'), imageEl.srcset || imageEl.getAttribute('srcset'), imageEl.sizes || imageEl.getAttribute('sizes'), true, onReady); } } var images = { loadImage, preloadImages }; function checkOverflow() { const swiper = this; const { isLocked: wasLocked, params } = swiper; const { slidesOffsetBefore } = params; if (slidesOffsetBefore) { const lastSlideIndex = swiper.slides.length - 1; const lastSlideRightEdge = swiper.slidesGrid[lastSlideIndex] + swiper.slidesSizesGrid[lastSlideIndex] + slidesOffsetBefore * 2; swiper.isLocked = swiper.size > lastSlideRightEdge; } else { swiper.isLocked = swiper.snapGrid.length === 1; } if (params.allowSlideNext === true) { swiper.allowSlideNext = !swiper.isLocked; } if (params.allowSlidePrev === true) { swiper.allowSlidePrev = !swiper.isLocked; } if (wasLocked && wasLocked !== swiper.isLocked) { swiper.isEnd = false; } if (wasLocked !== swiper.isLocked) { swiper.emit(swiper.isLocked ? 'lock' : 'unlock'); } } var checkOverflow$1 = { checkOverflow }; var defaults = { init: true, direction: 'horizontal', touchEventsTarget: 'wrapper', initialSlide: 0, speed: 300, cssMode: false, updateOnWindowResize: true, resizeObserver: true, nested: false, createElements: false, enabled: true, focusableElements: 'input, select, option, textarea, button, video, label', // Overrides width: null, height: null, // preventInteractionOnTransition: false, // ssr userAgent: null, url: null, // To support iOS's swipe-to-go-back gesture (when being used in-app). edgeSwipeDetection: false, edgeSwipeThreshold: 20, // Autoheight autoHeight: false, // Set wrapper width setWrapperSize: false, // Virtual Translate virtualTranslate: false, // Effects effect: 'slide', // 'slide' or 'fade' or 'cube' or 'coverflow' or 'flip' // Breakpoints breakpoints: undefined, breakpointsBase: 'window', // Slides grid spaceBetween: 0, slidesPerView: 1, slidesPerGroup: 1, slidesPerGroupSkip: 0, slidesPerGroupAuto: false, centeredSlides: false, centeredSlidesBounds: false, slidesOffsetBefore: 0, // in px slidesOffsetAfter: 0, // in px normalizeSlideIndex: true, centerInsufficientSlides: false, // Disable swiper and hide navigation when container not overflow watchOverflow: true, // Round length roundLengths: false, // Touches touchRatio: 1, touchAngle: 45, simulateTouch: true, shortSwipes: true, longSwipes: true, longSwipesRatio: 0.5, longSwipesMs: 300, followFinger: true, allowTouchMove: true, threshold: 0, touchMoveStopPropagation: false, touchStartPreventDefault: true, touchStartForcePreventDefault: false, touchReleaseOnEdges: false, // Unique Navigation Elements uniqueNavElements: true, // Resistance resistance: true, resistanceRatio: 0.85, // Progress watchSlidesProgress: false, // Cursor grabCursor: false, // Clicks preventClicks: true, preventClicksPropagation: true, slideToClickedSlide: false, // Images preloadImages: true, updateOnImagesReady: true, // loop loop: false, loopAdditionalSlides: 0, loopedSlides: null, loopFillGroupWithBlank: false, loopPreventsSlide: true, // Swiping/no swiping allowSlidePrev: true, allowSlideNext: true, swipeHandler: null, // '.swipe-handler', noSwiping: true, noSwipingClass: 'swiper-no-swiping', noSwipingSelector: null, // Passive Listeners passiveListeners: true, // NS containerModifierClass: 'swiper-', // NEW slideClass: 'swiper-slide', slideBlankClass: 'swiper-slide-invisible-blank', slideActiveClass: 'swiper-slide-active', slideDuplicateActiveClass: 'swiper-slide-duplicate-active', slideVisibleClass: 'swiper-slide-visible', slideDuplicateClass: 'swiper-slide-duplicate', slideNextClass: 'swiper-slide-next', slideDuplicateNextClass: 'swiper-slide-duplicate-next', slidePrevClass: 'swiper-slide-prev', slideDuplicatePrevClass: 'swiper-slide-duplicate-prev', wrapperClass: 'swiper-wrapper', // Callbacks runCallbacksOnInit: true, // Internals _emitClasses: false }; function moduleExtendParams(params, allModulesParams) { return function extendParams(obj = {}) { const moduleParamName = Object.keys(obj)[0]; const moduleParams = obj[moduleParamName]; if (typeof moduleParams !== 'object' || moduleParams === null) { extend(allModulesParams, obj); return; } if (['navigation', 'pagination', 'scrollbar'].indexOf(moduleParamName) >= 0 && params[moduleParamName] === true) { params[moduleParamName] = { auto: true }; } if (!(moduleParamName in params && 'enabled' in moduleParams)) { extend(allModulesParams, obj); return; } if (params[moduleParamName] === true) { params[moduleParamName] = { enabled: true }; } if (typeof params[moduleParamName] === 'object' && !('enabled' in params[moduleParamName])) { params[moduleParamName].enabled = true; } if (!params[moduleParamName]) params[moduleParamName] = { enabled: false }; extend(allModulesParams, obj); }; } /* eslint no-param-reassign: "off" */ const prototypes = { eventsEmitter, update, translate, transition, slide, loop, grabCursor, events: events$1, breakpoints, checkOverflow: checkOverflow$1, classes, images }; const extendedDefaults = {}; class Swiper { constructor(...args) { let el; let params; if (args.length === 1 && args[0].constructor && Object.prototype.toString.call(args[0]).slice(8, -1) === 'Object') { params = args[0]; } else { [el, params] = args; } if (!params) params = {}; params = extend({}, params); if (el && !params.el) params.el = el; if (params.el && $(params.el).length > 1) { const swipers = []; $(params.el).each(containerEl => { const newParams = extend({}, params, { el: containerEl }); swipers.push(new Swiper(newParams)); }); return swipers; } // Swiper Instance const swiper = this; swiper.__swiper__ = true; swiper.support = getSupport(); swiper.device = getDevice({ userAgent: params.userAgent }); swiper.browser = getBrowser(); swiper.eventsListeners = {}; swiper.eventsAnyListeners = []; if (typeof swiper.modules === 'undefined') { swiper.modules = []; } if (params.modules && Array.isArray(params.modules)) { swiper.modules.push(...params.modules); } const allModulesParams = {}; swiper.modules.forEach(mod => { mod({ swiper, extendParams: moduleExtendParams(params, allModulesParams), on: swiper.on.bind(swiper), once: swiper.once.bind(swiper), off: swiper.off.bind(swiper), emit: swiper.emit.bind(swiper) }); }); // Extend defaults with modules params const swiperParams = extend({}, defaults, allModulesParams); // Extend defaults with passed params swiper.params = extend({}, swiperParams, extendedDefaults, params); swiper.originalParams = extend({}, swiper.params); swiper.passedParams = extend({}, params); // add event listeners if (swiper.params && swiper.params.on) { Object.keys(swiper.params.on).forEach(eventName => { swiper.on(eventName, swiper.params.on[eventName]); }); } if (swiper.params && swiper.params.onAny) { swiper.onAny(swiper.params.onAny); } // Save Dom lib swiper.$ = $; // Extend Swiper Object.assign(swiper, { enabled: swiper.params.enabled, el, // Classes classNames: [], // Slides slides: $(), slidesGrid: [], snapGrid: [], slidesSizesGrid: [], // isDirection isHorizontal() { return swiper.params.direction === 'horizontal'; }, isVertical() { return swiper.params.direction === 'vertical'; }, // Indexes activeIndex: 0, realIndex: 0, // isBeginning: true, isEnd: false, // Props translate: 0, previousTranslate: 0, progress: 0, velocity: 0, animating: false, // Locks allowSlideNext: swiper.params.allowSlideNext, allowSlidePrev: swiper.params.allowSlidePrev, // Touch Events touchEvents: function touchEvents() { const touch = ['touchstart', 'touchmove', 'touchend', 'touchcancel']; const desktop = ['pointerdown', 'pointermove', 'pointerup']; swiper.touchEventsTouch = { start: touch[0], move: touch[1], end: touch[2], cancel: touch[3] }; swiper.touchEventsDesktop = { start: desktop[0], move: desktop[1], end: desktop[2] }; return swiper.support.touch || !swiper.params.simulateTouch ? swiper.touchEventsTouch : swiper.touchEventsDesktop; }(), touchEventsData: { isTouched: undefined, isMoved: undefined, allowTouchCallbacks: undefined, touchStartTime: undefined, isScrolling: undefined, currentTranslate: undefined, startTranslate: undefined, allowThresholdMove: undefined, // Form elements to match focusableElements: swiper.params.focusableElements, // Last click time lastClickTime: now(), clickTimeout: undefined, // Velocities velocities: [], allowMomentumBounce: undefined, isTouchEvent: undefined, startMoving: undefined }, // Clicks allowClick: true, // Touches allowTouchMove: swiper.params.allowTouchMove, touches: { startX: 0, startY: 0, currentX: 0, currentY: 0, diff: 0 }, // Images imagesToLoad: [], imagesLoaded: 0 }); swiper.emit('_swiper'); // Init if (swiper.params.init) { swiper.init(); } // Return app instance return swiper; } enable() { const swiper = this; if (swiper.enabled) return; swiper.enabled = true; if (swiper.params.grabCursor) { swiper.setGrabCursor(); } swiper.emit('enable'); } disable() { const swiper = this; if (!swiper.enabled) return; swiper.enabled = false; if (swiper.params.grabCursor) { swiper.unsetGrabCursor(); } swiper.emit('disable'); } setProgress(progress, speed) { const swiper = this; progress = Math.min(Math.max(progress, 0), 1); const min = swiper.minTranslate(); const max = swiper.maxTranslate(); const current = (max - min) * progress + min; swiper.translateTo(current, typeof speed === 'undefined' ? 0 : speed); swiper.updateActiveIndex(); swiper.updateSlidesClasses(); } emitContainerClasses() { const swiper = this; if (!swiper.params._emitClasses || !swiper.el) return; const cls = swiper.el.className.split(' ').filter(className => { return className.indexOf('swiper') === 0 || className.indexOf(swiper.params.containerModifierClass) === 0; }); swiper.emit('_containerClasses', cls.join(' ')); } getSlideClasses(slideEl) { const swiper = this; return slideEl.className.split(' ').filter(className => { return className.indexOf('swiper-slide') === 0 || className.indexOf(swiper.params.slideClass) === 0; }).join(' '); } emitSlidesClasses() { const swiper = this; if (!swiper.params._emitClasses || !swiper.el) return; const updates = []; swiper.slides.each(slideEl => { const classNames = swiper.getSlideClasses(slideEl); updates.push({ slideEl, classNames }); swiper.emit('_slideClass', slideEl, classNames); }); swiper.emit('_slideClasses', updates); } slidesPerViewDynamic(view = 'current', exact = false) { const swiper = this; const { params, slides, slidesGrid, slidesSizesGrid, size: swiperSize, activeIndex } = swiper; let spv = 1; if (params.centeredSlides) { let slideSize = slides[activeIndex].swiperSlideSize; let breakLoop; for (let i = activeIndex + 1; i < slides.length; i += 1) { if (slides[i] && !breakLoop) { slideSize += slides[i].swiperSlideSize; spv += 1; if (slideSize > swiperSize) breakLoop = true; } } for (let i = activeIndex - 1; i >= 0; i -= 1) { if (slides[i] && !breakLoop) { slideSize += slides[i].swiperSlideSize; spv += 1; if (slideSize > swiperSize) breakLoop = true; } } } else { // eslint-disable-next-line if (view === 'current') { for (let i = activeIndex + 1; i < slides.length; i += 1) { const slideInView = exact ? slidesGrid[i] + slidesSizesGrid[i] - slidesGrid[activeIndex] < swiperSize : slidesGrid[i] - slidesGrid[activeIndex] < swiperSize; if (slideInView) { spv += 1; } } } else { // previous for (let i = activeIndex - 1; i >= 0; i -= 1) { const slideInView = slidesGrid[activeIndex] - slidesGrid[i] < swiperSize; if (slideInView) { spv += 1; } } } } return spv; } update() { const swiper = this; if (!swiper || swiper.destroyed) return; const { snapGrid, params } = swiper; // Breakpoints if (params.breakpoints) { swiper.setBreakpoint(); } swiper.updateSize(); swiper.updateSlides(); swiper.updateProgress(); swiper.updateSlidesClasses(); function setTranslate() { const translateValue = swiper.rtlTranslate ? swiper.translate * -1 : swiper.translate; const newTranslate = Math.min(Math.max(translateValue, swiper.maxTranslate()), swiper.minTranslate()); swiper.setTranslate(newTranslate); swiper.updateActiveIndex(); swiper.updateSlidesClasses(); } let translated; if (swiper.params.freeMode && swiper.params.freeMode.enabled) { setTranslate(); if (swiper.params.autoHeight) { swiper.updateAutoHeight(); } } else { if ((swiper.params.slidesPerView === 'auto' || swiper.params.slidesPerView > 1) && swiper.isEnd && !swiper.params.centeredSlides) { translated = swiper.slideTo(swiper.slides.length - 1, 0, false, true); } else { translated = swiper.slideTo(swiper.activeIndex, 0, false, true); } if (!translated) { setTranslate(); } } if (params.watchOverflow && snapGrid !== swiper.snapGrid) { swiper.checkOverflow(); } swiper.emit('update'); } changeDirection(newDirection, needUpdate = true) { const swiper = this; const currentDirection = swiper.params.direction; if (!newDirection) { // eslint-disable-next-line newDirection = currentDirection === 'horizontal' ? 'vertical' : 'horizontal'; } if (newDirection === currentDirection || newDirection !== 'horizontal' && newDirection !== 'vertical') { return swiper; } swiper.$el.removeClass(`${swiper.params.containerModifierClass}${currentDirection}`).addClass(`${swiper.params.containerModifierClass}${newDirection}`); swiper.emitContainerClasses(); swiper.params.direction = newDirection; swiper.slides.each(slideEl => { if (newDirection === 'vertical') { slideEl.style.width = ''; } else { slideEl.style.height = ''; } }); swiper.emit('changeDirection'); if (needUpdate) swiper.update(); return swiper; } mount(el) { const swiper = this; if (swiper.mounted) return true; // Find el const $el = $(el || swiper.params.el); el = $el[0]; if (!el) { return false; } el.swiper = swiper; const getWrapperSelector = () => { return `.${(swiper.params.wrapperClass || '').trim().split(' ').join('.')}`; }; const getWrapper = () => { if (el && el.shadowRoot && el.shadowRoot.querySelector) { const res = $(el.shadowRoot.querySelector(getWrapperSelector())); // Children needs to return slot items res.children = options => $el.children(options); return res; } return $el.children(getWrapperSelector()); }; // Find Wrapper let $wrapperEl = getWrapper(); if ($wrapperEl.length === 0 && swiper.params.createElements) { const document = getDocument(); const wrapper = document.createElement('div'); $wrapperEl = $(wrapper); wrapper.className = swiper.params.wrapperClass; $el.append(wrapper); $el.children(`.${swiper.params.slideClass}`).each(slideEl => { $wrapperEl.append(slideEl); }); } Object.assign(swiper, { $el, el, $wrapperEl, wrapperEl: $wrapperEl[0], mounted: true, // RTL rtl: el.dir.toLowerCase() === 'rtl' || $el.css('direction') === 'rtl', rtlTranslate: swiper.params.direction === 'horizontal' && (el.dir.toLowerCase() === 'rtl' || $el.css('direction') === 'rtl'), wrongRTL: $wrapperEl.css('display') === '-webkit-box' }); return true; } init(el) { const swiper = this; if (swiper.initialized) return swiper; const mounted = swiper.mount(el); if (mounted === false) return swiper; swiper.emit('beforeInit'); // Set breakpoint if (swiper.params.breakpoints) { swiper.setBreakpoint(); } // Add Classes swiper.addClasses(); // Create loop if (swiper.params.loop) { swiper.loopCreate(); } // Update size swiper.updateSize(); // Update slides swiper.updateSlides(); if (swiper.params.watchOverflow) { swiper.checkOverflow(); } // Set Grab Cursor if (swiper.params.grabCursor && swiper.enabled) { swiper.setGrabCursor(); } if (swiper.params.preloadImages) { swiper.preloadImages(); } // Slide To Initial Slide if (swiper.params.loop) { swiper.slideTo(swiper.params.initialSlide + swiper.loopedSlides, 0, swiper.params.runCallbacksOnInit, false, true); } else { swiper.slideTo(swiper.params.initialSlide, 0, swiper.params.runCallbacksOnInit, false, true); } // Attach events swiper.attachEvents(); // Init Flag swiper.initialized = true; // Emit swiper.emit('init'); swiper.emit('afterInit'); return swiper; } destroy(deleteInstance = true, cleanStyles = true) { const swiper = this; const { params, $el, $wrapperEl, slides } = swiper; if (typeof swiper.params === 'undefined' || swiper.destroyed) { return null; } swiper.emit('beforeDestroy'); // Init Flag swiper.initialized = false; // Detach events swiper.detachEvents(); // Destroy loop if (params.loop) { swiper.loopDestroy(); } // Cleanup styles if (cleanStyles) { swiper.removeClasses(); $el.removeAttr('style'); $wrapperEl.removeAttr('style'); if (slides && slides.length) { slides.removeClass([params.slideVisibleClass, params.slideActiveClass, params.slideNextClass, params.slidePrevClass].join(' ')).removeAttr('style').removeAttr('data-swiper-slide-index'); } } swiper.emit('destroy'); // Detach emitter events Object.keys(swiper.eventsListeners).forEach(eventName => { swiper.off(eventName); }); if (deleteInstance !== false) { swiper.$el[0].swiper = null; deleteProps(swiper); } swiper.destroyed = true; return null; } static extendDefaults(newDefaults) { extend(extendedDefaults, newDefaults); } static get extendedDefaults() { return extendedDefaults; } static get defaults() { return defaults; } static installModule(mod) { if (!Swiper.prototype.modules) Swiper.prototype.modules = []; const modules = Swiper.prototype.modules; if (typeof mod === 'function' && modules.indexOf(mod) < 0) { modules.push(mod); } } static use(module) { if (Array.isArray(module)) { module.forEach(m => Swiper.installModule(m)); return Swiper; } Swiper.installModule(module); return Swiper; } } Object.keys(prototypes).forEach(prototypeGroup => { Object.keys(prototypes[prototypeGroup]).forEach(protoMethod => { Swiper.prototype[protoMethod] = prototypes[prototypeGroup][protoMethod]; }); }); Swiper.use([Resize, Observer]); function Virtual({ swiper, extendParams, on }) { extendParams({ virtual: { enabled: false, slides: [], cache: true, renderSlide: null, renderExternal: null, renderExternalUpdate: true, addSlidesBefore: 0, addSlidesAfter: 0 } }); swiper.virtual = { cache: {}, from: undefined, to: undefined, slides: [], offset: 0, slidesGrid: [] }; function renderSlide(slide, index) { const params = swiper.params.virtual; if (params.cache && swiper.virtual.cache[index]) { return swiper.virtual.cache[index]; } const $slideEl = params.renderSlide ? $(params.renderSlide.call(swiper, slide, index)) : $(`
    ${slide}
    `); if (!$slideEl.attr('data-swiper-slide-index')) $slideEl.attr('data-swiper-slide-index', index); if (params.cache) swiper.virtual.cache[index] = $slideEl; return $slideEl; } function update(force) { const { slidesPerView, slidesPerGroup, centeredSlides } = swiper.params; const { addSlidesBefore, addSlidesAfter } = swiper.params.virtual; const { from: previousFrom, to: previousTo, slides, slidesGrid: previousSlidesGrid, offset: previousOffset } = swiper.virtual; swiper.updateActiveIndex(); const activeIndex = swiper.activeIndex || 0; let offsetProp; if (swiper.rtlTranslate) offsetProp = 'right';else offsetProp = swiper.isHorizontal() ? 'left' : 'top'; let slidesAfter; let slidesBefore; if (centeredSlides) { slidesAfter = Math.floor(slidesPerView / 2) + slidesPerGroup + addSlidesAfter; slidesBefore = Math.floor(slidesPerView / 2) + slidesPerGroup + addSlidesBefore; } else { slidesAfter = slidesPerView + (slidesPerGroup - 1) + addSlidesAfter; slidesBefore = slidesPerGroup + addSlidesBefore; } const from = Math.max((activeIndex || 0) - slidesBefore, 0); const to = Math.min((activeIndex || 0) + slidesAfter, slides.length - 1); const offset = (swiper.slidesGrid[from] || 0) - (swiper.slidesGrid[0] || 0); Object.assign(swiper.virtual, { from, to, offset, slidesGrid: swiper.slidesGrid }); function onRendered() { swiper.updateSlides(); swiper.updateProgress(); swiper.updateSlidesClasses(); if (swiper.lazy && swiper.params.lazy.enabled) { swiper.lazy.load(); } } if (previousFrom === from && previousTo === to && !force) { if (swiper.slidesGrid !== previousSlidesGrid && offset !== previousOffset) { swiper.slides.css(offsetProp, `${offset}px`); } swiper.updateProgress(); return; } if (swiper.params.virtual.renderExternal) { swiper.params.virtual.renderExternal.call(swiper, { offset, from, to, slides: function getSlides() { const slidesToRender = []; for (let i = from; i <= to; i += 1) { slidesToRender.push(slides[i]); } return slidesToRender; }() }); if (swiper.params.virtual.renderExternalUpdate) { onRendered(); } return; } const prependIndexes = []; const appendIndexes = []; if (force) { swiper.$wrapperEl.find(`.${swiper.params.slideClass}`).remove(); } else { for (let i = previousFrom; i <= previousTo; i += 1) { if (i < from || i > to) { swiper.$wrapperEl.find(`.${swiper.params.slideClass}[data-swiper-slide-index="${i}"]`).remove(); } } } for (let i = 0; i < slides.length; i += 1) { if (i >= from && i <= to) { if (typeof previousTo === 'undefined' || force) { appendIndexes.push(i); } else { if (i > previousTo) appendIndexes.push(i); if (i < previousFrom) prependIndexes.push(i); } } } appendIndexes.forEach(index => { swiper.$wrapperEl.append(renderSlide(slides[index], index)); }); prependIndexes.sort((a, b) => b - a).forEach(index => { swiper.$wrapperEl.prepend(renderSlide(slides[index], index)); }); swiper.$wrapperEl.children('.swiper-slide').css(offsetProp, `${offset}px`); onRendered(); } function appendSlide(slides) { if (typeof slides === 'object' && 'length' in slides) { for (let i = 0; i < slides.length; i += 1) { if (slides[i]) swiper.virtual.slides.push(slides[i]); } } else { swiper.virtual.slides.push(slides); } update(true); } function prependSlide(slides) { const activeIndex = swiper.activeIndex; let newActiveIndex = activeIndex + 1; let numberOfNewSlides = 1; if (Array.isArray(slides)) { for (let i = 0; i < slides.length; i += 1) { if (slides[i]) swiper.virtual.slides.unshift(slides[i]); } newActiveIndex = activeIndex + slides.length; numberOfNewSlides = slides.length; } else { swiper.virtual.slides.unshift(slides); } if (swiper.params.virtual.cache) { const cache = swiper.virtual.cache; const newCache = {}; Object.keys(cache).forEach(cachedIndex => { const $cachedEl = cache[cachedIndex]; const cachedElIndex = $cachedEl.attr('data-swiper-slide-index'); if (cachedElIndex) { $cachedEl.attr('data-swiper-slide-index', parseInt(cachedElIndex, 10) + 1); } newCache[parseInt(cachedIndex, 10) + numberOfNewSlides] = $cachedEl; }); swiper.virtual.cache = newCache; } update(true); swiper.slideTo(newActiveIndex, 0); } function removeSlide(slidesIndexes) { if (typeof slidesIndexes === 'undefined' || slidesIndexes === null) return; let activeIndex = swiper.activeIndex; if (Array.isArray(slidesIndexes)) { for (let i = slidesIndexes.length - 1; i >= 0; i -= 1) { swiper.virtual.slides.splice(slidesIndexes[i], 1); if (swiper.params.virtual.cache) { delete swiper.virtual.cache[slidesIndexes[i]]; } if (slidesIndexes[i] < activeIndex) activeIndex -= 1; activeIndex = Math.max(activeIndex, 0); } } else { swiper.virtual.slides.splice(slidesIndexes, 1); if (swiper.params.virtual.cache) { delete swiper.virtual.cache[slidesIndexes]; } if (slidesIndexes < activeIndex) activeIndex -= 1; activeIndex = Math.max(activeIndex, 0); } update(true); swiper.slideTo(activeIndex, 0); } function removeAllSlides() { swiper.virtual.slides = []; if (swiper.params.virtual.cache) { swiper.virtual.cache = {}; } update(true); swiper.slideTo(0, 0); } on('beforeInit', () => { if (!swiper.params.virtual.enabled) return; swiper.virtual.slides = swiper.params.virtual.slides; swiper.classNames.push(`${swiper.params.containerModifierClass}virtual`); swiper.params.watchSlidesProgress = true; swiper.originalParams.watchSlidesProgress = true; if (!swiper.params.initialSlide) { update(); } }); on('setTranslate', () => { if (!swiper.params.virtual.enabled) return; update(); }); on('init update resize', () => { if (!swiper.params.virtual.enabled) return; if (swiper.params.cssMode) { setCSSProperty(swiper.wrapperEl, '--swiper-virtual-size', `${swiper.virtualSize}px`); } }); Object.assign(swiper.virtual, { appendSlide, prependSlide, removeSlide, removeAllSlides, update }); } /* eslint-disable consistent-return */ function Keyboard({ swiper, extendParams, on, emit }) { const document = getDocument(); const window = getWindow(); swiper.keyboard = { enabled: false }; extendParams({ keyboard: { enabled: false, onlyInViewport: true, pageUpDown: true } }); function handle(event) { if (!swiper.enabled) return; const { rtlTranslate: rtl } = swiper; let e = event; if (e.originalEvent) e = e.originalEvent; // jquery fix const kc = e.keyCode || e.charCode; const pageUpDown = swiper.params.keyboard.pageUpDown; const isPageUp = pageUpDown && kc === 33; const isPageDown = pageUpDown && kc === 34; const isArrowLeft = kc === 37; const isArrowRight = kc === 39; const isArrowUp = kc === 38; const isArrowDown = kc === 40; // Directions locks if (!swiper.allowSlideNext && (swiper.isHorizontal() && isArrowRight || swiper.isVertical() && isArrowDown || isPageDown)) { return false; } if (!swiper.allowSlidePrev && (swiper.isHorizontal() && isArrowLeft || swiper.isVertical() && isArrowUp || isPageUp)) { return false; } if (e.shiftKey || e.altKey || e.ctrlKey || e.metaKey) { return undefined; } if (document.activeElement && document.activeElement.nodeName && (document.activeElement.nodeName.toLowerCase() === 'input' || document.activeElement.nodeName.toLowerCase() === 'textarea')) { return undefined; } if (swiper.params.keyboard.onlyInViewport && (isPageUp || isPageDown || isArrowLeft || isArrowRight || isArrowUp || isArrowDown)) { let inView = false; // Check that swiper should be inside of visible area of window if (swiper.$el.parents(`.${swiper.params.slideClass}`).length > 0 && swiper.$el.parents(`.${swiper.params.slideActiveClass}`).length === 0) { return undefined; } const $el = swiper.$el; const swiperWidth = $el[0].clientWidth; const swiperHeight = $el[0].clientHeight; const windowWidth = window.innerWidth; const windowHeight = window.innerHeight; const swiperOffset = swiper.$el.offset(); if (rtl) swiperOffset.left -= swiper.$el[0].scrollLeft; const swiperCoord = [[swiperOffset.left, swiperOffset.top], [swiperOffset.left + swiperWidth, swiperOffset.top], [swiperOffset.left, swiperOffset.top + swiperHeight], [swiperOffset.left + swiperWidth, swiperOffset.top + swiperHeight]]; for (let i = 0; i < swiperCoord.length; i += 1) { const point = swiperCoord[i]; if (point[0] >= 0 && point[0] <= windowWidth && point[1] >= 0 && point[1] <= windowHeight) { if (point[0] === 0 && point[1] === 0) continue; // eslint-disable-line inView = true; } } if (!inView) return undefined; } if (swiper.isHorizontal()) { if (isPageUp || isPageDown || isArrowLeft || isArrowRight) { if (e.preventDefault) e.preventDefault();else e.returnValue = false; } if ((isPageDown || isArrowRight) && !rtl || (isPageUp || isArrowLeft) && rtl) swiper.slideNext(); if ((isPageUp || isArrowLeft) && !rtl || (isPageDown || isArrowRight) && rtl) swiper.slidePrev(); } else { if (isPageUp || isPageDown || isArrowUp || isArrowDown) { if (e.preventDefault) e.preventDefault();else e.returnValue = false; } if (isPageDown || isArrowDown) swiper.slideNext(); if (isPageUp || isArrowUp) swiper.slidePrev(); } emit('keyPress', kc); return undefined; } function enable() { if (swiper.keyboard.enabled) return; $(document).on('keydown', handle); swiper.keyboard.enabled = true; } function disable() { if (!swiper.keyboard.enabled) return; $(document).off('keydown', handle); swiper.keyboard.enabled = false; } on('init', () => { if (swiper.params.keyboard.enabled) { enable(); } }); on('destroy', () => { if (swiper.keyboard.enabled) { disable(); } }); Object.assign(swiper.keyboard, { enable, disable }); } /* eslint-disable consistent-return */ function Mousewheel({ swiper, extendParams, on, emit }) { const window = getWindow(); extendParams({ mousewheel: { enabled: false, releaseOnEdges: false, invert: false, forceToAxis: false, sensitivity: 1, eventsTarget: 'container', thresholdDelta: null, thresholdTime: null } }); swiper.mousewheel = { enabled: false }; let timeout; let lastScrollTime = now(); let lastEventBeforeSnap; const recentWheelEvents = []; function normalize(e) { // Reasonable defaults const PIXEL_STEP = 10; const LINE_HEIGHT = 40; const PAGE_HEIGHT = 800; let sX = 0; let sY = 0; // spinX, spinY let pX = 0; let pY = 0; // pixelX, pixelY // Legacy if ('detail' in e) { sY = e.detail; } if ('wheelDelta' in e) { sY = -e.wheelDelta / 120; } if ('wheelDeltaY' in e) { sY = -e.wheelDeltaY / 120; } if ('wheelDeltaX' in e) { sX = -e.wheelDeltaX / 120; } // side scrolling on FF with DOMMouseScroll if ('axis' in e && e.axis === e.HORIZONTAL_AXIS) { sX = sY; sY = 0; } pX = sX * PIXEL_STEP; pY = sY * PIXEL_STEP; if ('deltaY' in e) { pY = e.deltaY; } if ('deltaX' in e) { pX = e.deltaX; } if (e.shiftKey && !pX) { // if user scrolls with shift he wants horizontal scroll pX = pY; pY = 0; } if ((pX || pY) && e.deltaMode) { if (e.deltaMode === 1) { // delta in LINE units pX *= LINE_HEIGHT; pY *= LINE_HEIGHT; } else { // delta in PAGE units pX *= PAGE_HEIGHT; pY *= PAGE_HEIGHT; } } // Fall-back if spin cannot be determined if (pX && !sX) { sX = pX < 1 ? -1 : 1; } if (pY && !sY) { sY = pY < 1 ? -1 : 1; } return { spinX: sX, spinY: sY, pixelX: pX, pixelY: pY }; } function handleMouseEnter() { if (!swiper.enabled) return; swiper.mouseEntered = true; } function handleMouseLeave() { if (!swiper.enabled) return; swiper.mouseEntered = false; } function animateSlider(newEvent) { if (swiper.params.mousewheel.thresholdDelta && newEvent.delta < swiper.params.mousewheel.thresholdDelta) { // Prevent if delta of wheel scroll delta is below configured threshold return false; } if (swiper.params.mousewheel.thresholdTime && now() - lastScrollTime < swiper.params.mousewheel.thresholdTime) { // Prevent if time between scrolls is below configured threshold return false; } // If the movement is NOT big enough and // if the last time the user scrolled was too close to the current one (avoid continuously triggering the slider): // Don't go any further (avoid insignificant scroll movement). if (newEvent.delta >= 6 && now() - lastScrollTime < 60) { // Return false as a default return true; } // If user is scrolling towards the end: // If the slider hasn't hit the latest slide or // if the slider is a loop and // if the slider isn't moving right now: // Go to next slide and // emit a scroll event. // Else (the user is scrolling towards the beginning) and // if the slider hasn't hit the first slide or // if the slider is a loop and // if the slider isn't moving right now: // Go to prev slide and // emit a scroll event. if (newEvent.direction < 0) { if ((!swiper.isEnd || swiper.params.loop) && !swiper.animating) { swiper.slideNext(); emit('scroll', newEvent.raw); } } else if ((!swiper.isBeginning || swiper.params.loop) && !swiper.animating) { swiper.slidePrev(); emit('scroll', newEvent.raw); } // If you got here is because an animation has been triggered so store the current time lastScrollTime = new window.Date().getTime(); // Return false as a default return false; } function releaseScroll(newEvent) { const params = swiper.params.mousewheel; if (newEvent.direction < 0) { if (swiper.isEnd && !swiper.params.loop && params.releaseOnEdges) { // Return true to animate scroll on edges return true; } } else if (swiper.isBeginning && !swiper.params.loop && params.releaseOnEdges) { // Return true to animate scroll on edges return true; } return false; } function handle(event) { let e = event; let disableParentSwiper = true; if (!swiper.enabled) return; const params = swiper.params.mousewheel; if (swiper.params.cssMode) { e.preventDefault(); } let target = swiper.$el; if (swiper.params.mousewheel.eventsTarget !== 'container') { target = $(swiper.params.mousewheel.eventsTarget); } if (!swiper.mouseEntered && !target[0].contains(e.target) && !params.releaseOnEdges) return true; if (e.originalEvent) e = e.originalEvent; // jquery fix let delta = 0; const rtlFactor = swiper.rtlTranslate ? -1 : 1; const data = normalize(e); if (params.forceToAxis) { if (swiper.isHorizontal()) { if (Math.abs(data.pixelX) > Math.abs(data.pixelY)) delta = -data.pixelX * rtlFactor;else return true; } else if (Math.abs(data.pixelY) > Math.abs(data.pixelX)) delta = -data.pixelY;else return true; } else { delta = Math.abs(data.pixelX) > Math.abs(data.pixelY) ? -data.pixelX * rtlFactor : -data.pixelY; } if (delta === 0) return true; if (params.invert) delta = -delta; // Get the scroll positions let positions = swiper.getTranslate() + delta * params.sensitivity; if (positions >= swiper.minTranslate()) positions = swiper.minTranslate(); if (positions <= swiper.maxTranslate()) positions = swiper.maxTranslate(); // When loop is true: // the disableParentSwiper will be true. // When loop is false: // if the scroll positions is not on edge, // then the disableParentSwiper will be true. // if the scroll on edge positions, // then the disableParentSwiper will be false. disableParentSwiper = swiper.params.loop ? true : !(positions === swiper.minTranslate() || positions === swiper.maxTranslate()); if (disableParentSwiper && swiper.params.nested) e.stopPropagation(); if (!swiper.params.freeMode || !swiper.params.freeMode.enabled) { // Register the new event in a variable which stores the relevant data const newEvent = { time: now(), delta: Math.abs(delta), direction: Math.sign(delta), raw: event }; // Keep the most recent events if (recentWheelEvents.length >= 2) { recentWheelEvents.shift(); // only store the last N events } const prevEvent = recentWheelEvents.length ? recentWheelEvents[recentWheelEvents.length - 1] : undefined; recentWheelEvents.push(newEvent); // If there is at least one previous recorded event: // If direction has changed or // if the scroll is quicker than the previous one: // Animate the slider. // Else (this is the first time the wheel is moved): // Animate the slider. if (prevEvent) { if (newEvent.direction !== prevEvent.direction || newEvent.delta > prevEvent.delta || newEvent.time > prevEvent.time + 150) { animateSlider(newEvent); } } else { animateSlider(newEvent); } // If it's time to release the scroll: // Return now so you don't hit the preventDefault. if (releaseScroll(newEvent)) { return true; } } else { // Freemode or scrollContainer: // If we recently snapped after a momentum scroll, then ignore wheel events // to give time for the deceleration to finish. Stop ignoring after 500 msecs // or if it's a new scroll (larger delta or inverse sign as last event before // an end-of-momentum snap). const newEvent = { time: now(), delta: Math.abs(delta), direction: Math.sign(delta) }; const ignoreWheelEvents = lastEventBeforeSnap && newEvent.time < lastEventBeforeSnap.time + 500 && newEvent.delta <= lastEventBeforeSnap.delta && newEvent.direction === lastEventBeforeSnap.direction; if (!ignoreWheelEvents) { lastEventBeforeSnap = undefined; if (swiper.params.loop) { swiper.loopFix(); } let position = swiper.getTranslate() + delta * params.sensitivity; const wasBeginning = swiper.isBeginning; const wasEnd = swiper.isEnd; if (position >= swiper.minTranslate()) position = swiper.minTranslate(); if (position <= swiper.maxTranslate()) position = swiper.maxTranslate(); swiper.setTransition(0); swiper.setTranslate(position); swiper.updateProgress(); swiper.updateActiveIndex(); swiper.updateSlidesClasses(); if (!wasBeginning && swiper.isBeginning || !wasEnd && swiper.isEnd) { swiper.updateSlidesClasses(); } if (swiper.params.freeMode.sticky) { // When wheel scrolling starts with sticky (aka snap) enabled, then detect // the end of a momentum scroll by storing recent (N=15?) wheel events. // 1. do all N events have decreasing or same (absolute value) delta? // 2. did all N events arrive in the last M (M=500?) msecs? // 3. does the earliest event have an (absolute value) delta that's // at least P (P=1?) larger than the most recent event's delta? // 4. does the latest event have a delta that's smaller than Q (Q=6?) pixels? // If 1-4 are "yes" then we're near the end of a momentum scroll deceleration. // Snap immediately and ignore remaining wheel events in this scroll. // See comment above for "remaining wheel events in this scroll" determination. // If 1-4 aren't satisfied, then wait to snap until 500ms after the last event. clearTimeout(timeout); timeout = undefined; if (recentWheelEvents.length >= 15) { recentWheelEvents.shift(); // only store the last N events } const prevEvent = recentWheelEvents.length ? recentWheelEvents[recentWheelEvents.length - 1] : undefined; const firstEvent = recentWheelEvents[0]; recentWheelEvents.push(newEvent); if (prevEvent && (newEvent.delta > prevEvent.delta || newEvent.direction !== prevEvent.direction)) { // Increasing or reverse-sign delta means the user started scrolling again. Clear the wheel event log. recentWheelEvents.splice(0); } else if (recentWheelEvents.length >= 15 && newEvent.time - firstEvent.time < 500 && firstEvent.delta - newEvent.delta >= 1 && newEvent.delta <= 6) { // We're at the end of the deceleration of a momentum scroll, so there's no need // to wait for more events. Snap ASAP on the next tick. // Also, because there's some remaining momentum we'll bias the snap in the // direction of the ongoing scroll because it's better UX for the scroll to snap // in the same direction as the scroll instead of reversing to snap. Therefore, // if it's already scrolled more than 20% in the current direction, keep going. const snapToThreshold = delta > 0 ? 0.8 : 0.2; lastEventBeforeSnap = newEvent; recentWheelEvents.splice(0); timeout = nextTick(() => { swiper.slideToClosest(swiper.params.speed, true, undefined, snapToThreshold); }, 0); // no delay; move on next tick } if (!timeout) { // if we get here, then we haven't detected the end of a momentum scroll, so // we'll consider a scroll "complete" when there haven't been any wheel events // for 500ms. timeout = nextTick(() => { const snapToThreshold = 0.5; lastEventBeforeSnap = newEvent; recentWheelEvents.splice(0); swiper.slideToClosest(swiper.params.speed, true, undefined, snapToThreshold); }, 500); } } // Emit event if (!ignoreWheelEvents) emit('scroll', e); // Stop autoplay if (swiper.params.autoplay && swiper.params.autoplayDisableOnInteraction) swiper.autoplay.stop(); // Return page scroll on edge positions if (position === swiper.minTranslate() || position === swiper.maxTranslate()) return true; } } if (e.preventDefault) e.preventDefault();else e.returnValue = false; return false; } function events(method) { let target = swiper.$el; if (swiper.params.mousewheel.eventsTarget !== 'container') { target = $(swiper.params.mousewheel.eventsTarget); } target[method]('mouseenter', handleMouseEnter); target[method]('mouseleave', handleMouseLeave); target[method]('wheel', handle); } function enable() { if (swiper.params.cssMode) { swiper.wrapperEl.removeEventListener('wheel', handle); return true; } if (swiper.mousewheel.enabled) return false; events('on'); swiper.mousewheel.enabled = true; return true; } function disable() { if (swiper.params.cssMode) { swiper.wrapperEl.addEventListener(event, handle); return true; } if (!swiper.mousewheel.enabled) return false; events('off'); swiper.mousewheel.enabled = false; return true; } on('init', () => { if (!swiper.params.mousewheel.enabled && swiper.params.cssMode) { disable(); } if (swiper.params.mousewheel.enabled) enable(); }); on('destroy', () => { if (swiper.params.cssMode) { enable(); } if (swiper.mousewheel.enabled) disable(); }); Object.assign(swiper.mousewheel, { enable, disable }); } function createElementIfNotDefined(swiper, originalParams, params, checkProps) { const document = getDocument(); if (swiper.params.createElements) { Object.keys(checkProps).forEach(key => { if (!params[key] && params.auto === true) { const element = document.createElement('div'); element.className = checkProps[key]; swiper.$el.append(element); params[key] = element; originalParams[key] = element; } }); } return params; } function Navigation({ swiper, extendParams, on, emit }) { extendParams({ navigation: { nextEl: null, prevEl: null, hideOnClick: false, disabledClass: 'swiper-button-disabled', hiddenClass: 'swiper-button-hidden', lockClass: 'swiper-button-lock' } }); swiper.navigation = { nextEl: null, $nextEl: null, prevEl: null, $prevEl: null }; function getEl(el) { let $el; if (el) { $el = $(el); if (swiper.params.uniqueNavElements && typeof el === 'string' && $el.length > 1 && swiper.$el.find(el).length === 1) { $el = swiper.$el.find(el); } } return $el; } function toggleEl($el, disabled) { const params = swiper.params.navigation; if ($el && $el.length > 0) { $el[disabled ? 'addClass' : 'removeClass'](params.disabledClass); if ($el[0] && $el[0].tagName === 'BUTTON') $el[0].disabled = disabled; if (swiper.params.watchOverflow && swiper.enabled) { $el[swiper.isLocked ? 'addClass' : 'removeClass'](params.lockClass); } } } function update() { // Update Navigation Buttons if (swiper.params.loop) return; const { $nextEl, $prevEl } = swiper.navigation; toggleEl($prevEl, swiper.isBeginning); toggleEl($nextEl, swiper.isEnd); } function onPrevClick(e) { e.preventDefault(); if (swiper.isBeginning && !swiper.params.loop) return; swiper.slidePrev(); } function onNextClick(e) { e.preventDefault(); if (swiper.isEnd && !swiper.params.loop) return; swiper.slideNext(); } function init() { const params = swiper.params.navigation; swiper.params.navigation = createElementIfNotDefined(swiper, swiper.originalParams.navigation, swiper.params.navigation, { nextEl: 'swiper-button-next', prevEl: 'swiper-button-prev' }); if (!(params.nextEl || params.prevEl)) return; const $nextEl = getEl(params.nextEl); const $prevEl = getEl(params.prevEl); if ($nextEl && $nextEl.length > 0) { $nextEl.on('click', onNextClick); } if ($prevEl && $prevEl.length > 0) { $prevEl.on('click', onPrevClick); } Object.assign(swiper.navigation, { $nextEl, nextEl: $nextEl && $nextEl[0], $prevEl, prevEl: $prevEl && $prevEl[0] }); if (!swiper.enabled) { if ($nextEl) $nextEl.addClass(params.lockClass); if ($prevEl) $prevEl.addClass(params.lockClass); } } function destroy() { const { $nextEl, $prevEl } = swiper.navigation; if ($nextEl && $nextEl.length) { $nextEl.off('click', onNextClick); $nextEl.removeClass(swiper.params.navigation.disabledClass); } if ($prevEl && $prevEl.length) { $prevEl.off('click', onPrevClick); $prevEl.removeClass(swiper.params.navigation.disabledClass); } } on('init', () => { init(); update(); }); on('toEdge fromEdge lock unlock', () => { update(); }); on('destroy', () => { destroy(); }); on('enable disable', () => { const { $nextEl, $prevEl } = swiper.navigation; if ($nextEl) { $nextEl[swiper.enabled ? 'removeClass' : 'addClass'](swiper.params.navigation.lockClass); } if ($prevEl) { $prevEl[swiper.enabled ? 'removeClass' : 'addClass'](swiper.params.navigation.lockClass); } }); on('click', (_s, e) => { const { $nextEl, $prevEl } = swiper.navigation; const targetEl = e.target; if (swiper.params.navigation.hideOnClick && !$(targetEl).is($prevEl) && !$(targetEl).is($nextEl)) { if (swiper.pagination && swiper.params.pagination && swiper.params.pagination.clickable && (swiper.pagination.el === targetEl || swiper.pagination.el.contains(targetEl))) return; let isHidden; if ($nextEl) { isHidden = $nextEl.hasClass(swiper.params.navigation.hiddenClass); } else if ($prevEl) { isHidden = $prevEl.hasClass(swiper.params.navigation.hiddenClass); } if (isHidden === true) { emit('navigationShow'); } else { emit('navigationHide'); } if ($nextEl) { $nextEl.toggleClass(swiper.params.navigation.hiddenClass); } if ($prevEl) { $prevEl.toggleClass(swiper.params.navigation.hiddenClass); } } }); Object.assign(swiper.navigation, { update, init, destroy }); } function classesToSelector(classes = '') { return `.${classes.trim().replace(/([\.:!\/])/g, '\\$1') // eslint-disable-line .replace(/ /g, '.')}`; } function Pagination({ swiper, extendParams, on, emit }) { const pfx = 'swiper-pagination'; extendParams({ pagination: { el: null, bulletElement: 'span', clickable: false, hideOnClick: false, renderBullet: null, renderProgressbar: null, renderFraction: null, renderCustom: null, progressbarOpposite: false, type: 'bullets', // 'bullets' or 'progressbar' or 'fraction' or 'custom' dynamicBullets: false, dynamicMainBullets: 1, formatFractionCurrent: number => number, formatFractionTotal: number => number, bulletClass: `${pfx}-bullet`, bulletActiveClass: `${pfx}-bullet-active`, modifierClass: `${pfx}-`, currentClass: `${pfx}-current`, totalClass: `${pfx}-total`, hiddenClass: `${pfx}-hidden`, progressbarFillClass: `${pfx}-progressbar-fill`, progressbarOppositeClass: `${pfx}-progressbar-opposite`, clickableClass: `${pfx}-clickable`, lockClass: `${pfx}-lock`, horizontalClass: `${pfx}-horizontal`, verticalClass: `${pfx}-vertical` } }); swiper.pagination = { el: null, $el: null, bullets: [] }; let bulletSize; let dynamicBulletIndex = 0; function isPaginationDisabled() { return !swiper.params.pagination.el || !swiper.pagination.el || !swiper.pagination.$el || swiper.pagination.$el.length === 0; } function setSideBullets($bulletEl, position) { const { bulletActiveClass } = swiper.params.pagination; $bulletEl[position]().addClass(`${bulletActiveClass}-${position}`)[position]().addClass(`${bulletActiveClass}-${position}-${position}`); } function update() { // Render || Update Pagination bullets/items const rtl = swiper.rtl; const params = swiper.params.pagination; if (isPaginationDisabled()) return; const slidesLength = swiper.virtual && swiper.params.virtual.enabled ? swiper.virtual.slides.length : swiper.slides.length; const $el = swiper.pagination.$el; // Current/Total let current; const total = swiper.params.loop ? Math.ceil((slidesLength - swiper.loopedSlides * 2) / swiper.params.slidesPerGroup) : swiper.snapGrid.length; if (swiper.params.loop) { current = Math.ceil((swiper.activeIndex - swiper.loopedSlides) / swiper.params.slidesPerGroup); if (current > slidesLength - 1 - swiper.loopedSlides * 2) { current -= slidesLength - swiper.loopedSlides * 2; } if (current > total - 1) current -= total; if (current < 0 && swiper.params.paginationType !== 'bullets') current = total + current; } else if (typeof swiper.snapIndex !== 'undefined') { current = swiper.snapIndex; } else { current = swiper.activeIndex || 0; } // Types if (params.type === 'bullets' && swiper.pagination.bullets && swiper.pagination.bullets.length > 0) { const bullets = swiper.pagination.bullets; let firstIndex; let lastIndex; let midIndex; if (params.dynamicBullets) { bulletSize = bullets.eq(0)[swiper.isHorizontal() ? 'outerWidth' : 'outerHeight'](true); $el.css(swiper.isHorizontal() ? 'width' : 'height', `${bulletSize * (params.dynamicMainBullets + 4)}px`); if (params.dynamicMainBullets > 1 && swiper.previousIndex !== undefined) { dynamicBulletIndex += current - swiper.previousIndex; if (dynamicBulletIndex > params.dynamicMainBullets - 1) { dynamicBulletIndex = params.dynamicMainBullets - 1; } else if (dynamicBulletIndex < 0) { dynamicBulletIndex = 0; } } firstIndex = current - dynamicBulletIndex; lastIndex = firstIndex + (Math.min(bullets.length, params.dynamicMainBullets) - 1); midIndex = (lastIndex + firstIndex) / 2; } bullets.removeClass(['', '-next', '-next-next', '-prev', '-prev-prev', '-main'].map(suffix => `${params.bulletActiveClass}${suffix}`).join(' ')); if ($el.length > 1) { bullets.each(bullet => { const $bullet = $(bullet); const bulletIndex = $bullet.index(); if (bulletIndex === current) { $bullet.addClass(params.bulletActiveClass); } if (params.dynamicBullets) { if (bulletIndex >= firstIndex && bulletIndex <= lastIndex) { $bullet.addClass(`${params.bulletActiveClass}-main`); } if (bulletIndex === firstIndex) { setSideBullets($bullet, 'prev'); } if (bulletIndex === lastIndex) { setSideBullets($bullet, 'next'); } } }); } else { const $bullet = bullets.eq(current); const bulletIndex = $bullet.index(); $bullet.addClass(params.bulletActiveClass); if (params.dynamicBullets) { const $firstDisplayedBullet = bullets.eq(firstIndex); const $lastDisplayedBullet = bullets.eq(lastIndex); for (let i = firstIndex; i <= lastIndex; i += 1) { bullets.eq(i).addClass(`${params.bulletActiveClass}-main`); } if (swiper.params.loop) { if (bulletIndex >= bullets.length - params.dynamicMainBullets) { for (let i = params.dynamicMainBullets; i >= 0; i -= 1) { bullets.eq(bullets.length - i).addClass(`${params.bulletActiveClass}-main`); } bullets.eq(bullets.length - params.dynamicMainBullets - 1).addClass(`${params.bulletActiveClass}-prev`); } else { setSideBullets($firstDisplayedBullet, 'prev'); setSideBullets($lastDisplayedBullet, 'next'); } } else { setSideBullets($firstDisplayedBullet, 'prev'); setSideBullets($lastDisplayedBullet, 'next'); } } } if (params.dynamicBullets) { const dynamicBulletsLength = Math.min(bullets.length, params.dynamicMainBullets + 4); const bulletsOffset = (bulletSize * dynamicBulletsLength - bulletSize) / 2 - midIndex * bulletSize; const offsetProp = rtl ? 'right' : 'left'; bullets.css(swiper.isHorizontal() ? offsetProp : 'top', `${bulletsOffset}px`); } } if (params.type === 'fraction') { $el.find(classesToSelector(params.currentClass)).text(params.formatFractionCurrent(current + 1)); $el.find(classesToSelector(params.totalClass)).text(params.formatFractionTotal(total)); } if (params.type === 'progressbar') { let progressbarDirection; if (params.progressbarOpposite) { progressbarDirection = swiper.isHorizontal() ? 'vertical' : 'horizontal'; } else { progressbarDirection = swiper.isHorizontal() ? 'horizontal' : 'vertical'; } const scale = (current + 1) / total; let scaleX = 1; let scaleY = 1; if (progressbarDirection === 'horizontal') { scaleX = scale; } else { scaleY = scale; } $el.find(classesToSelector(params.progressbarFillClass)).transform(`translate3d(0,0,0) scaleX(${scaleX}) scaleY(${scaleY})`).transition(swiper.params.speed); } if (params.type === 'custom' && params.renderCustom) { $el.html(params.renderCustom(swiper, current + 1, total)); emit('paginationRender', $el[0]); } else { emit('paginationUpdate', $el[0]); } if (swiper.params.watchOverflow && swiper.enabled) { $el[swiper.isLocked ? 'addClass' : 'removeClass'](params.lockClass); } } function render() { // Render Container const params = swiper.params.pagination; if (isPaginationDisabled()) return; const slidesLength = swiper.virtual && swiper.params.virtual.enabled ? swiper.virtual.slides.length : swiper.slides.length; const $el = swiper.pagination.$el; let paginationHTML = ''; if (params.type === 'bullets') { let numberOfBullets = swiper.params.loop ? Math.ceil((slidesLength - swiper.loopedSlides * 2) / swiper.params.slidesPerGroup) : swiper.snapGrid.length; if (swiper.params.freeMode && swiper.params.freeMode.enabled && !swiper.params.loop && numberOfBullets > slidesLength) { numberOfBullets = slidesLength; } for (let i = 0; i < numberOfBullets; i += 1) { if (params.renderBullet) { paginationHTML += params.renderBullet.call(swiper, i, params.bulletClass); } else { paginationHTML += `<${params.bulletElement} class="${params.bulletClass}">`; } } $el.html(paginationHTML); swiper.pagination.bullets = $el.find(classesToSelector(params.bulletClass)); } if (params.type === 'fraction') { if (params.renderFraction) { paginationHTML = params.renderFraction.call(swiper, params.currentClass, params.totalClass); } else { paginationHTML = `` + ' / ' + ``; } $el.html(paginationHTML); } if (params.type === 'progressbar') { if (params.renderProgressbar) { paginationHTML = params.renderProgressbar.call(swiper, params.progressbarFillClass); } else { paginationHTML = ``; } $el.html(paginationHTML); } if (params.type !== 'custom') { emit('paginationRender', swiper.pagination.$el[0]); } } function init() { swiper.params.pagination = createElementIfNotDefined(swiper, swiper.originalParams.pagination, swiper.params.pagination, { el: 'swiper-pagination' }); const params = swiper.params.pagination; if (!params.el) return; let $el = $(params.el); if ($el.length === 0) return; if (swiper.params.uniqueNavElements && typeof params.el === 'string' && $el.length > 1) { $el = swiper.$el.find(params.el); // check if it belongs to another nested Swiper if ($el.length > 1) { $el = $el.filter(el => { if ($(el).parents('.swiper')[0] !== swiper.el) return false; return true; }); } } if (params.type === 'bullets' && params.clickable) { $el.addClass(params.clickableClass); } $el.addClass(params.modifierClass + params.type); $el.addClass(params.modifierClass + swiper.params.direction); if (params.type === 'bullets' && params.dynamicBullets) { $el.addClass(`${params.modifierClass}${params.type}-dynamic`); dynamicBulletIndex = 0; if (params.dynamicMainBullets < 1) { params.dynamicMainBullets = 1; } } if (params.type === 'progressbar' && params.progressbarOpposite) { $el.addClass(params.progressbarOppositeClass); } if (params.clickable) { $el.on('click', classesToSelector(params.bulletClass), function onClick(e) { e.preventDefault(); let index = $(this).index() * swiper.params.slidesPerGroup; if (swiper.params.loop) index += swiper.loopedSlides; swiper.slideTo(index); }); } Object.assign(swiper.pagination, { $el, el: $el[0] }); if (!swiper.enabled) { $el.addClass(params.lockClass); } } function destroy() { const params = swiper.params.pagination; if (isPaginationDisabled()) return; const $el = swiper.pagination.$el; $el.removeClass(params.hiddenClass); $el.removeClass(params.modifierClass + params.type); $el.removeClass(params.modifierClass + swiper.params.direction); if (swiper.pagination.bullets && swiper.pagination.bullets.removeClass) swiper.pagination.bullets.removeClass(params.bulletActiveClass); if (params.clickable) { $el.off('click', classesToSelector(params.bulletClass)); } } on('init', () => { init(); render(); update(); }); on('activeIndexChange', () => { if (swiper.params.loop) { update(); } else if (typeof swiper.snapIndex === 'undefined') { update(); } }); on('snapIndexChange', () => { if (!swiper.params.loop) { update(); } }); on('slidesLengthChange', () => { if (swiper.params.loop) { render(); update(); } }); on('snapGridLengthChange', () => { if (!swiper.params.loop) { render(); update(); } }); on('destroy', () => { destroy(); }); on('enable disable', () => { const { $el } = swiper.pagination; if ($el) { $el[swiper.enabled ? 'removeClass' : 'addClass'](swiper.params.pagination.lockClass); } }); on('lock unlock', () => { update(); }); on('click', (_s, e) => { const targetEl = e.target; const { $el } = swiper.pagination; if (swiper.params.pagination.el && swiper.params.pagination.hideOnClick && $el.length > 0 && !$(targetEl).hasClass(swiper.params.pagination.bulletClass)) { if (swiper.navigation && (swiper.navigation.nextEl && targetEl === swiper.navigation.nextEl || swiper.navigation.prevEl && targetEl === swiper.navigation.prevEl)) return; const isHidden = $el.hasClass(swiper.params.pagination.hiddenClass); if (isHidden === true) { emit('paginationShow'); } else { emit('paginationHide'); } $el.toggleClass(swiper.params.pagination.hiddenClass); } }); Object.assign(swiper.pagination, { render, update, init, destroy }); } function Scrollbar({ swiper, extendParams, on, emit }) { const document = getDocument(); let isTouched = false; let timeout = null; let dragTimeout = null; let dragStartPos; let dragSize; let trackSize; let divider; extendParams({ scrollbar: { el: null, dragSize: 'auto', hide: false, draggable: false, snapOnRelease: true, lockClass: 'swiper-scrollbar-lock', dragClass: 'swiper-scrollbar-drag' } }); swiper.scrollbar = { el: null, dragEl: null, $el: null, $dragEl: null }; function setTranslate() { if (!swiper.params.scrollbar.el || !swiper.scrollbar.el) return; const { scrollbar, rtlTranslate: rtl, progress } = swiper; const { $dragEl, $el } = scrollbar; const params = swiper.params.scrollbar; let newSize = dragSize; let newPos = (trackSize - dragSize) * progress; if (rtl) { newPos = -newPos; if (newPos > 0) { newSize = dragSize - newPos; newPos = 0; } else if (-newPos + dragSize > trackSize) { newSize = trackSize + newPos; } } else if (newPos < 0) { newSize = dragSize + newPos; newPos = 0; } else if (newPos + dragSize > trackSize) { newSize = trackSize - newPos; } if (swiper.isHorizontal()) { $dragEl.transform(`translate3d(${newPos}px, 0, 0)`); $dragEl[0].style.width = `${newSize}px`; } else { $dragEl.transform(`translate3d(0px, ${newPos}px, 0)`); $dragEl[0].style.height = `${newSize}px`; } if (params.hide) { clearTimeout(timeout); $el[0].style.opacity = 1; timeout = setTimeout(() => { $el[0].style.opacity = 0; $el.transition(400); }, 1000); } } function setTransition(duration) { if (!swiper.params.scrollbar.el || !swiper.scrollbar.el) return; swiper.scrollbar.$dragEl.transition(duration); } function updateSize() { if (!swiper.params.scrollbar.el || !swiper.scrollbar.el) return; const { scrollbar } = swiper; const { $dragEl, $el } = scrollbar; $dragEl[0].style.width = ''; $dragEl[0].style.height = ''; trackSize = swiper.isHorizontal() ? $el[0].offsetWidth : $el[0].offsetHeight; divider = swiper.size / (swiper.virtualSize + swiper.params.slidesOffsetBefore - (swiper.params.centeredSlides ? swiper.snapGrid[0] : 0)); if (swiper.params.scrollbar.dragSize === 'auto') { dragSize = trackSize * divider; } else { dragSize = parseInt(swiper.params.scrollbar.dragSize, 10); } if (swiper.isHorizontal()) { $dragEl[0].style.width = `${dragSize}px`; } else { $dragEl[0].style.height = `${dragSize}px`; } if (divider >= 1) { $el[0].style.display = 'none'; } else { $el[0].style.display = ''; } if (swiper.params.scrollbar.hide) { $el[0].style.opacity = 0; } if (swiper.params.watchOverflow && swiper.enabled) { scrollbar.$el[swiper.isLocked ? 'addClass' : 'removeClass'](swiper.params.scrollbar.lockClass); } } function getPointerPosition(e) { if (swiper.isHorizontal()) { return e.type === 'touchstart' || e.type === 'touchmove' ? e.targetTouches[0].clientX : e.clientX; } return e.type === 'touchstart' || e.type === 'touchmove' ? e.targetTouches[0].clientY : e.clientY; } function setDragPosition(e) { const { scrollbar, rtlTranslate: rtl } = swiper; const { $el } = scrollbar; let positionRatio; positionRatio = (getPointerPosition(e) - $el.offset()[swiper.isHorizontal() ? 'left' : 'top'] - (dragStartPos !== null ? dragStartPos : dragSize / 2)) / (trackSize - dragSize); positionRatio = Math.max(Math.min(positionRatio, 1), 0); if (rtl) { positionRatio = 1 - positionRatio; } const position = swiper.minTranslate() + (swiper.maxTranslate() - swiper.minTranslate()) * positionRatio; swiper.updateProgress(position); swiper.setTranslate(position); swiper.updateActiveIndex(); swiper.updateSlidesClasses(); } function onDragStart(e) { const params = swiper.params.scrollbar; const { scrollbar, $wrapperEl } = swiper; const { $el, $dragEl } = scrollbar; isTouched = true; dragStartPos = e.target === $dragEl[0] || e.target === $dragEl ? getPointerPosition(e) - e.target.getBoundingClientRect()[swiper.isHorizontal() ? 'left' : 'top'] : null; e.preventDefault(); e.stopPropagation(); $wrapperEl.transition(100); $dragEl.transition(100); setDragPosition(e); clearTimeout(dragTimeout); $el.transition(0); if (params.hide) { $el.css('opacity', 1); } if (swiper.params.cssMode) { swiper.$wrapperEl.css('scroll-snap-type', 'none'); } emit('scrollbarDragStart', e); } function onDragMove(e) { const { scrollbar, $wrapperEl } = swiper; const { $el, $dragEl } = scrollbar; if (!isTouched) return; if (e.preventDefault) e.preventDefault();else e.returnValue = false; setDragPosition(e); $wrapperEl.transition(0); $el.transition(0); $dragEl.transition(0); emit('scrollbarDragMove', e); } function onDragEnd(e) { const params = swiper.params.scrollbar; const { scrollbar, $wrapperEl } = swiper; const { $el } = scrollbar; if (!isTouched) return; isTouched = false; if (swiper.params.cssMode) { swiper.$wrapperEl.css('scroll-snap-type', ''); $wrapperEl.transition(''); } if (params.hide) { clearTimeout(dragTimeout); dragTimeout = nextTick(() => { $el.css('opacity', 0); $el.transition(400); }, 1000); } emit('scrollbarDragEnd', e); if (params.snapOnRelease) { swiper.slideToClosest(); } } function events(method) { const { scrollbar, touchEventsTouch, touchEventsDesktop, params, support } = swiper; const $el = scrollbar.$el; const target = $el[0]; const activeListener = support.passiveListener && params.passiveListeners ? { passive: false, capture: false } : false; const passiveListener = support.passiveListener && params.passiveListeners ? { passive: true, capture: false } : false; if (!target) return; const eventMethod = method === 'on' ? 'addEventListener' : 'removeEventListener'; if (!support.touch) { target[eventMethod](touchEventsDesktop.start, onDragStart, activeListener); document[eventMethod](touchEventsDesktop.move, onDragMove, activeListener); document[eventMethod](touchEventsDesktop.end, onDragEnd, passiveListener); } else { target[eventMethod](touchEventsTouch.start, onDragStart, activeListener); target[eventMethod](touchEventsTouch.move, onDragMove, activeListener); target[eventMethod](touchEventsTouch.end, onDragEnd, passiveListener); } } function enableDraggable() { if (!swiper.params.scrollbar.el) return; events('on'); } function disableDraggable() { if (!swiper.params.scrollbar.el) return; events('off'); } function init() { const { scrollbar, $el: $swiperEl } = swiper; swiper.params.scrollbar = createElementIfNotDefined(swiper, swiper.originalParams.scrollbar, swiper.params.scrollbar, { el: 'swiper-scrollbar' }); const params = swiper.params.scrollbar; if (!params.el) return; let $el = $(params.el); if (swiper.params.uniqueNavElements && typeof params.el === 'string' && $el.length > 1 && $swiperEl.find(params.el).length === 1) { $el = $swiperEl.find(params.el); } let $dragEl = $el.find(`.${swiper.params.scrollbar.dragClass}`); if ($dragEl.length === 0) { $dragEl = $(`
    `); $el.append($dragEl); } Object.assign(scrollbar, { $el, el: $el[0], $dragEl, dragEl: $dragEl[0] }); if (params.draggable) { enableDraggable(); } if ($el) { $el[swiper.enabled ? 'removeClass' : 'addClass'](swiper.params.scrollbar.lockClass); } } function destroy() { disableDraggable(); } on('init', () => { init(); updateSize(); setTranslate(); }); on('update resize observerUpdate lock unlock', () => { updateSize(); }); on('setTranslate', () => { setTranslate(); }); on('setTransition', (_s, duration) => { setTransition(duration); }); on('enable disable', () => { const { $el } = swiper.scrollbar; if ($el) { $el[swiper.enabled ? 'removeClass' : 'addClass'](swiper.params.scrollbar.lockClass); } }); on('destroy', () => { destroy(); }); Object.assign(swiper.scrollbar, { updateSize, setTranslate, init, destroy }); } function Parallax({ swiper, extendParams, on }) { extendParams({ parallax: { enabled: false } }); const setTransform = (el, progress) => { const { rtl } = swiper; const $el = $(el); const rtlFactor = rtl ? -1 : 1; const p = $el.attr('data-swiper-parallax') || '0'; let x = $el.attr('data-swiper-parallax-x'); let y = $el.attr('data-swiper-parallax-y'); const scale = $el.attr('data-swiper-parallax-scale'); const opacity = $el.attr('data-swiper-parallax-opacity'); if (x || y) { x = x || '0'; y = y || '0'; } else if (swiper.isHorizontal()) { x = p; y = '0'; } else { y = p; x = '0'; } if (x.indexOf('%') >= 0) { x = `${parseInt(x, 10) * progress * rtlFactor}%`; } else { x = `${x * progress * rtlFactor}px`; } if (y.indexOf('%') >= 0) { y = `${parseInt(y, 10) * progress}%`; } else { y = `${y * progress}px`; } if (typeof opacity !== 'undefined' && opacity !== null) { const currentOpacity = opacity - (opacity - 1) * (1 - Math.abs(progress)); $el[0].style.opacity = currentOpacity; } if (typeof scale === 'undefined' || scale === null) { $el.transform(`translate3d(${x}, ${y}, 0px)`); } else { const currentScale = scale - (scale - 1) * (1 - Math.abs(progress)); $el.transform(`translate3d(${x}, ${y}, 0px) scale(${currentScale})`); } }; const setTranslate = () => { const { $el, slides, progress, snapGrid } = swiper; $el.children('[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y], [data-swiper-parallax-opacity], [data-swiper-parallax-scale]').each(el => { setTransform(el, progress); }); slides.each((slideEl, slideIndex) => { let slideProgress = slideEl.progress; if (swiper.params.slidesPerGroup > 1 && swiper.params.slidesPerView !== 'auto') { slideProgress += Math.ceil(slideIndex / 2) - progress * (snapGrid.length - 1); } slideProgress = Math.min(Math.max(slideProgress, -1), 1); $(slideEl).find('[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y], [data-swiper-parallax-opacity], [data-swiper-parallax-scale]').each(el => { setTransform(el, slideProgress); }); }); }; const setTransition = (duration = swiper.params.speed) => { const { $el } = swiper; $el.find('[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y], [data-swiper-parallax-opacity], [data-swiper-parallax-scale]').each(parallaxEl => { const $parallaxEl = $(parallaxEl); let parallaxDuration = parseInt($parallaxEl.attr('data-swiper-parallax-duration'), 10) || duration; if (duration === 0) parallaxDuration = 0; $parallaxEl.transition(parallaxDuration); }); }; on('beforeInit', () => { if (!swiper.params.parallax.enabled) return; swiper.params.watchSlidesProgress = true; swiper.originalParams.watchSlidesProgress = true; }); on('init', () => { if (!swiper.params.parallax.enabled) return; setTranslate(); }); on('setTranslate', () => { if (!swiper.params.parallax.enabled) return; setTranslate(); }); on('setTransition', (_swiper, duration) => { if (!swiper.params.parallax.enabled) return; setTransition(duration); }); } function Zoom({ swiper, extendParams, on, emit }) { const window = getWindow(); extendParams({ zoom: { enabled: false, maxRatio: 3, minRatio: 1, toggle: true, containerClass: 'swiper-zoom-container', zoomedSlideClass: 'swiper-slide-zoomed' } }); swiper.zoom = { enabled: false }; let currentScale = 1; let isScaling = false; let gesturesEnabled; let fakeGestureTouched; let fakeGestureMoved; const gesture = { $slideEl: undefined, slideWidth: undefined, slideHeight: undefined, $imageEl: undefined, $imageWrapEl: undefined, maxRatio: 3 }; const image = { isTouched: undefined, isMoved: undefined, currentX: undefined, currentY: undefined, minX: undefined, minY: undefined, maxX: undefined, maxY: undefined, width: undefined, height: undefined, startX: undefined, startY: undefined, touchesStart: {}, touchesCurrent: {} }; const velocity = { x: undefined, y: undefined, prevPositionX: undefined, prevPositionY: undefined, prevTime: undefined }; let scale = 1; Object.defineProperty(swiper.zoom, 'scale', { get() { return scale; }, set(value) { if (scale !== value) { const imageEl = gesture.$imageEl ? gesture.$imageEl[0] : undefined; const slideEl = gesture.$slideEl ? gesture.$slideEl[0] : undefined; emit('zoomChange', value, imageEl, slideEl); } scale = value; } }); function getDistanceBetweenTouches(e) { if (e.targetTouches.length < 2) return 1; const x1 = e.targetTouches[0].pageX; const y1 = e.targetTouches[0].pageY; const x2 = e.targetTouches[1].pageX; const y2 = e.targetTouches[1].pageY; const distance = Math.sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2); return distance; } // Events function onGestureStart(e) { const support = swiper.support; const params = swiper.params.zoom; fakeGestureTouched = false; fakeGestureMoved = false; if (!support.gestures) { if (e.type !== 'touchstart' || e.type === 'touchstart' && e.targetTouches.length < 2) { return; } fakeGestureTouched = true; gesture.scaleStart = getDistanceBetweenTouches(e); } if (!gesture.$slideEl || !gesture.$slideEl.length) { gesture.$slideEl = $(e.target).closest(`.${swiper.params.slideClass}`); if (gesture.$slideEl.length === 0) gesture.$slideEl = swiper.slides.eq(swiper.activeIndex); gesture.$imageEl = gesture.$slideEl.find(`.${params.containerClass}`).eq(0).find('img, svg, canvas, picture, .swiper-zoom-target'); gesture.$imageWrapEl = gesture.$imageEl.parent(`.${params.containerClass}`); gesture.maxRatio = gesture.$imageWrapEl.attr('data-swiper-zoom') || params.maxRatio; if (gesture.$imageWrapEl.length === 0) { gesture.$imageEl = undefined; return; } } if (gesture.$imageEl) { gesture.$imageEl.transition(0); } isScaling = true; } function onGestureChange(e) { const support = swiper.support; const params = swiper.params.zoom; const zoom = swiper.zoom; if (!support.gestures) { if (e.type !== 'touchmove' || e.type === 'touchmove' && e.targetTouches.length < 2) { return; } fakeGestureMoved = true; gesture.scaleMove = getDistanceBetweenTouches(e); } if (!gesture.$imageEl || gesture.$imageEl.length === 0) { if (e.type === 'gesturechange') onGestureStart(e); return; } if (support.gestures) { zoom.scale = e.scale * currentScale; } else { zoom.scale = gesture.scaleMove / gesture.scaleStart * currentScale; } if (zoom.scale > gesture.maxRatio) { zoom.scale = gesture.maxRatio - 1 + (zoom.scale - gesture.maxRatio + 1) ** 0.5; } if (zoom.scale < params.minRatio) { zoom.scale = params.minRatio + 1 - (params.minRatio - zoom.scale + 1) ** 0.5; } gesture.$imageEl.transform(`translate3d(0,0,0) scale(${zoom.scale})`); } function onGestureEnd(e) { const device = swiper.device; const support = swiper.support; const params = swiper.params.zoom; const zoom = swiper.zoom; if (!support.gestures) { if (!fakeGestureTouched || !fakeGestureMoved) { return; } if (e.type !== 'touchend' || e.type === 'touchend' && e.changedTouches.length < 2 && !device.android) { return; } fakeGestureTouched = false; fakeGestureMoved = false; } if (!gesture.$imageEl || gesture.$imageEl.length === 0) return; zoom.scale = Math.max(Math.min(zoom.scale, gesture.maxRatio), params.minRatio); gesture.$imageEl.transition(swiper.params.speed).transform(`translate3d(0,0,0) scale(${zoom.scale})`); currentScale = zoom.scale; isScaling = false; if (zoom.scale === 1) gesture.$slideEl = undefined; } function onTouchStart(e) { const device = swiper.device; if (!gesture.$imageEl || gesture.$imageEl.length === 0) return; if (image.isTouched) return; if (device.android && e.cancelable) e.preventDefault(); image.isTouched = true; image.touchesStart.x = e.type === 'touchstart' ? e.targetTouches[0].pageX : e.pageX; image.touchesStart.y = e.type === 'touchstart' ? e.targetTouches[0].pageY : e.pageY; } function onTouchMove(e) { const zoom = swiper.zoom; if (!gesture.$imageEl || gesture.$imageEl.length === 0) return; swiper.allowClick = false; if (!image.isTouched || !gesture.$slideEl) return; if (!image.isMoved) { image.width = gesture.$imageEl[0].offsetWidth; image.height = gesture.$imageEl[0].offsetHeight; image.startX = getTranslate(gesture.$imageWrapEl[0], 'x') || 0; image.startY = getTranslate(gesture.$imageWrapEl[0], 'y') || 0; gesture.slideWidth = gesture.$slideEl[0].offsetWidth; gesture.slideHeight = gesture.$slideEl[0].offsetHeight; gesture.$imageWrapEl.transition(0); } // Define if we need image drag const scaledWidth = image.width * zoom.scale; const scaledHeight = image.height * zoom.scale; if (scaledWidth < gesture.slideWidth && scaledHeight < gesture.slideHeight) return; image.minX = Math.min(gesture.slideWidth / 2 - scaledWidth / 2, 0); image.maxX = -image.minX; image.minY = Math.min(gesture.slideHeight / 2 - scaledHeight / 2, 0); image.maxY = -image.minY; image.touchesCurrent.x = e.type === 'touchmove' ? e.targetTouches[0].pageX : e.pageX; image.touchesCurrent.y = e.type === 'touchmove' ? e.targetTouches[0].pageY : e.pageY; if (!image.isMoved && !isScaling) { if (swiper.isHorizontal() && (Math.floor(image.minX) === Math.floor(image.startX) && image.touchesCurrent.x < image.touchesStart.x || Math.floor(image.maxX) === Math.floor(image.startX) && image.touchesCurrent.x > image.touchesStart.x)) { image.isTouched = false; return; } if (!swiper.isHorizontal() && (Math.floor(image.minY) === Math.floor(image.startY) && image.touchesCurrent.y < image.touchesStart.y || Math.floor(image.maxY) === Math.floor(image.startY) && image.touchesCurrent.y > image.touchesStart.y)) { image.isTouched = false; return; } } if (e.cancelable) { e.preventDefault(); } e.stopPropagation(); image.isMoved = true; image.currentX = image.touchesCurrent.x - image.touchesStart.x + image.startX; image.currentY = image.touchesCurrent.y - image.touchesStart.y + image.startY; if (image.currentX < image.minX) { image.currentX = image.minX + 1 - (image.minX - image.currentX + 1) ** 0.8; } if (image.currentX > image.maxX) { image.currentX = image.maxX - 1 + (image.currentX - image.maxX + 1) ** 0.8; } if (image.currentY < image.minY) { image.currentY = image.minY + 1 - (image.minY - image.currentY + 1) ** 0.8; } if (image.currentY > image.maxY) { image.currentY = image.maxY - 1 + (image.currentY - image.maxY + 1) ** 0.8; } // Velocity if (!velocity.prevPositionX) velocity.prevPositionX = image.touchesCurrent.x; if (!velocity.prevPositionY) velocity.prevPositionY = image.touchesCurrent.y; if (!velocity.prevTime) velocity.prevTime = Date.now(); velocity.x = (image.touchesCurrent.x - velocity.prevPositionX) / (Date.now() - velocity.prevTime) / 2; velocity.y = (image.touchesCurrent.y - velocity.prevPositionY) / (Date.now() - velocity.prevTime) / 2; if (Math.abs(image.touchesCurrent.x - velocity.prevPositionX) < 2) velocity.x = 0; if (Math.abs(image.touchesCurrent.y - velocity.prevPositionY) < 2) velocity.y = 0; velocity.prevPositionX = image.touchesCurrent.x; velocity.prevPositionY = image.touchesCurrent.y; velocity.prevTime = Date.now(); gesture.$imageWrapEl.transform(`translate3d(${image.currentX}px, ${image.currentY}px,0)`); } function onTouchEnd() { const zoom = swiper.zoom; if (!gesture.$imageEl || gesture.$imageEl.length === 0) return; if (!image.isTouched || !image.isMoved) { image.isTouched = false; image.isMoved = false; return; } image.isTouched = false; image.isMoved = false; let momentumDurationX = 300; let momentumDurationY = 300; const momentumDistanceX = velocity.x * momentumDurationX; const newPositionX = image.currentX + momentumDistanceX; const momentumDistanceY = velocity.y * momentumDurationY; const newPositionY = image.currentY + momentumDistanceY; // Fix duration if (velocity.x !== 0) momentumDurationX = Math.abs((newPositionX - image.currentX) / velocity.x); if (velocity.y !== 0) momentumDurationY = Math.abs((newPositionY - image.currentY) / velocity.y); const momentumDuration = Math.max(momentumDurationX, momentumDurationY); image.currentX = newPositionX; image.currentY = newPositionY; // Define if we need image drag const scaledWidth = image.width * zoom.scale; const scaledHeight = image.height * zoom.scale; image.minX = Math.min(gesture.slideWidth / 2 - scaledWidth / 2, 0); image.maxX = -image.minX; image.minY = Math.min(gesture.slideHeight / 2 - scaledHeight / 2, 0); image.maxY = -image.minY; image.currentX = Math.max(Math.min(image.currentX, image.maxX), image.minX); image.currentY = Math.max(Math.min(image.currentY, image.maxY), image.minY); gesture.$imageWrapEl.transition(momentumDuration).transform(`translate3d(${image.currentX}px, ${image.currentY}px,0)`); } function onTransitionEnd() { const zoom = swiper.zoom; if (gesture.$slideEl && swiper.previousIndex !== swiper.activeIndex) { if (gesture.$imageEl) { gesture.$imageEl.transform('translate3d(0,0,0) scale(1)'); } if (gesture.$imageWrapEl) { gesture.$imageWrapEl.transform('translate3d(0,0,0)'); } zoom.scale = 1; currentScale = 1; gesture.$slideEl = undefined; gesture.$imageEl = undefined; gesture.$imageWrapEl = undefined; } } function zoomIn(e) { const zoom = swiper.zoom; const params = swiper.params.zoom; if (!gesture.$slideEl) { if (e && e.target) { gesture.$slideEl = $(e.target).closest(`.${swiper.params.slideClass}`); } if (!gesture.$slideEl) { if (swiper.params.virtual && swiper.params.virtual.enabled && swiper.virtual) { gesture.$slideEl = swiper.$wrapperEl.children(`.${swiper.params.slideActiveClass}`); } else { gesture.$slideEl = swiper.slides.eq(swiper.activeIndex); } } gesture.$imageEl = gesture.$slideEl.find(`.${params.containerClass}`).eq(0).find('img, svg, canvas, picture, .swiper-zoom-target'); gesture.$imageWrapEl = gesture.$imageEl.parent(`.${params.containerClass}`); } if (!gesture.$imageEl || gesture.$imageEl.length === 0 || !gesture.$imageWrapEl || gesture.$imageWrapEl.length === 0) return; if (swiper.params.cssMode) { swiper.wrapperEl.style.overflow = 'hidden'; swiper.wrapperEl.style.touchAction = 'none'; } gesture.$slideEl.addClass(`${params.zoomedSlideClass}`); let touchX; let touchY; let offsetX; let offsetY; let diffX; let diffY; let translateX; let translateY; let imageWidth; let imageHeight; let scaledWidth; let scaledHeight; let translateMinX; let translateMinY; let translateMaxX; let translateMaxY; let slideWidth; let slideHeight; if (typeof image.touchesStart.x === 'undefined' && e) { touchX = e.type === 'touchend' ? e.changedTouches[0].pageX : e.pageX; touchY = e.type === 'touchend' ? e.changedTouches[0].pageY : e.pageY; } else { touchX = image.touchesStart.x; touchY = image.touchesStart.y; } zoom.scale = gesture.$imageWrapEl.attr('data-swiper-zoom') || params.maxRatio; currentScale = gesture.$imageWrapEl.attr('data-swiper-zoom') || params.maxRatio; if (e) { slideWidth = gesture.$slideEl[0].offsetWidth; slideHeight = gesture.$slideEl[0].offsetHeight; offsetX = gesture.$slideEl.offset().left + window.scrollX; offsetY = gesture.$slideEl.offset().top + window.scrollY; diffX = offsetX + slideWidth / 2 - touchX; diffY = offsetY + slideHeight / 2 - touchY; imageWidth = gesture.$imageEl[0].offsetWidth; imageHeight = gesture.$imageEl[0].offsetHeight; scaledWidth = imageWidth * zoom.scale; scaledHeight = imageHeight * zoom.scale; translateMinX = Math.min(slideWidth / 2 - scaledWidth / 2, 0); translateMinY = Math.min(slideHeight / 2 - scaledHeight / 2, 0); translateMaxX = -translateMinX; translateMaxY = -translateMinY; translateX = diffX * zoom.scale; translateY = diffY * zoom.scale; if (translateX < translateMinX) { translateX = translateMinX; } if (translateX > translateMaxX) { translateX = translateMaxX; } if (translateY < translateMinY) { translateY = translateMinY; } if (translateY > translateMaxY) { translateY = translateMaxY; } } else { translateX = 0; translateY = 0; } gesture.$imageWrapEl.transition(300).transform(`translate3d(${translateX}px, ${translateY}px,0)`); gesture.$imageEl.transition(300).transform(`translate3d(0,0,0) scale(${zoom.scale})`); } function zoomOut() { const zoom = swiper.zoom; const params = swiper.params.zoom; if (!gesture.$slideEl) { if (swiper.params.virtual && swiper.params.virtual.enabled && swiper.virtual) { gesture.$slideEl = swiper.$wrapperEl.children(`.${swiper.params.slideActiveClass}`); } else { gesture.$slideEl = swiper.slides.eq(swiper.activeIndex); } gesture.$imageEl = gesture.$slideEl.find(`.${params.containerClass}`).eq(0).find('img, svg, canvas, picture, .swiper-zoom-target'); gesture.$imageWrapEl = gesture.$imageEl.parent(`.${params.containerClass}`); } if (!gesture.$imageEl || gesture.$imageEl.length === 0 || !gesture.$imageWrapEl || gesture.$imageWrapEl.length === 0) return; if (swiper.params.cssMode) { swiper.wrapperEl.style.overflow = ''; swiper.wrapperEl.style.touchAction = ''; } zoom.scale = 1; currentScale = 1; gesture.$imageWrapEl.transition(300).transform('translate3d(0,0,0)'); gesture.$imageEl.transition(300).transform('translate3d(0,0,0) scale(1)'); gesture.$slideEl.removeClass(`${params.zoomedSlideClass}`); gesture.$slideEl = undefined; } // Toggle Zoom function zoomToggle(e) { const zoom = swiper.zoom; if (zoom.scale && zoom.scale !== 1) { // Zoom Out zoomOut(); } else { // Zoom In zoomIn(e); } } function getListeners() { const support = swiper.support; const passiveListener = swiper.touchEvents.start === 'touchstart' && support.passiveListener && swiper.params.passiveListeners ? { passive: true, capture: false } : false; const activeListenerWithCapture = support.passiveListener ? { passive: false, capture: true } : true; return { passiveListener, activeListenerWithCapture }; } function getSlideSelector() { return `.${swiper.params.slideClass}`; } function toggleGestures(method) { const { passiveListener } = getListeners(); const slideSelector = getSlideSelector(); swiper.$wrapperEl[method]('gesturestart', slideSelector, onGestureStart, passiveListener); swiper.$wrapperEl[method]('gesturechange', slideSelector, onGestureChange, passiveListener); swiper.$wrapperEl[method]('gestureend', slideSelector, onGestureEnd, passiveListener); } function enableGestures() { if (gesturesEnabled) return; gesturesEnabled = true; toggleGestures('on'); } function disableGestures() { if (!gesturesEnabled) return; gesturesEnabled = false; toggleGestures('off'); } // Attach/Detach Events function enable() { const zoom = swiper.zoom; if (zoom.enabled) return; zoom.enabled = true; const support = swiper.support; const { passiveListener, activeListenerWithCapture } = getListeners(); const slideSelector = getSlideSelector(); // Scale image if (support.gestures) { swiper.$wrapperEl.on(swiper.touchEvents.start, enableGestures, passiveListener); swiper.$wrapperEl.on(swiper.touchEvents.end, disableGestures, passiveListener); } else if (swiper.touchEvents.start === 'touchstart') { swiper.$wrapperEl.on(swiper.touchEvents.start, slideSelector, onGestureStart, passiveListener); swiper.$wrapperEl.on(swiper.touchEvents.move, slideSelector, onGestureChange, activeListenerWithCapture); swiper.$wrapperEl.on(swiper.touchEvents.end, slideSelector, onGestureEnd, passiveListener); if (swiper.touchEvents.cancel) { swiper.$wrapperEl.on(swiper.touchEvents.cancel, slideSelector, onGestureEnd, passiveListener); } } // Move image swiper.$wrapperEl.on(swiper.touchEvents.move, `.${swiper.params.zoom.containerClass}`, onTouchMove, activeListenerWithCapture); } function disable() { const zoom = swiper.zoom; if (!zoom.enabled) return; const support = swiper.support; zoom.enabled = false; const { passiveListener, activeListenerWithCapture } = getListeners(); const slideSelector = getSlideSelector(); // Scale image if (support.gestures) { swiper.$wrapperEl.off(swiper.touchEvents.start, enableGestures, passiveListener); swiper.$wrapperEl.off(swiper.touchEvents.end, disableGestures, passiveListener); } else if (swiper.touchEvents.start === 'touchstart') { swiper.$wrapperEl.off(swiper.touchEvents.start, slideSelector, onGestureStart, passiveListener); swiper.$wrapperEl.off(swiper.touchEvents.move, slideSelector, onGestureChange, activeListenerWithCapture); swiper.$wrapperEl.off(swiper.touchEvents.end, slideSelector, onGestureEnd, passiveListener); if (swiper.touchEvents.cancel) { swiper.$wrapperEl.off(swiper.touchEvents.cancel, slideSelector, onGestureEnd, passiveListener); } } // Move image swiper.$wrapperEl.off(swiper.touchEvents.move, `.${swiper.params.zoom.containerClass}`, onTouchMove, activeListenerWithCapture); } on('init', () => { if (swiper.params.zoom.enabled) { enable(); } }); on('destroy', () => { disable(); }); on('touchStart', (_s, e) => { if (!swiper.zoom.enabled) return; onTouchStart(e); }); on('touchEnd', (_s, e) => { if (!swiper.zoom.enabled) return; onTouchEnd(); }); on('doubleTap', (_s, e) => { if (!swiper.animating && swiper.params.zoom.enabled && swiper.zoom.enabled && swiper.params.zoom.toggle) { zoomToggle(e); } }); on('transitionEnd', () => { if (swiper.zoom.enabled && swiper.params.zoom.enabled) { onTransitionEnd(); } }); on('slideChange', () => { if (swiper.zoom.enabled && swiper.params.zoom.enabled && swiper.params.cssMode) { onTransitionEnd(); } }); Object.assign(swiper.zoom, { enable, disable, in: zoomIn, out: zoomOut, toggle: zoomToggle }); } function Lazy({ swiper, extendParams, on, emit }) { extendParams({ lazy: { checkInView: false, enabled: false, loadPrevNext: false, loadPrevNextAmount: 1, loadOnTransitionStart: false, scrollingElement: '', elementClass: 'swiper-lazy', loadingClass: 'swiper-lazy-loading', loadedClass: 'swiper-lazy-loaded', preloaderClass: 'swiper-lazy-preloader' } }); swiper.lazy = {}; let scrollHandlerAttached = false; let initialImageLoaded = false; function loadInSlide(index, loadInDuplicate = true) { const params = swiper.params.lazy; if (typeof index === 'undefined') return; if (swiper.slides.length === 0) return; const isVirtual = swiper.virtual && swiper.params.virtual.enabled; const $slideEl = isVirtual ? swiper.$wrapperEl.children(`.${swiper.params.slideClass}[data-swiper-slide-index="${index}"]`) : swiper.slides.eq(index); const $images = $slideEl.find(`.${params.elementClass}:not(.${params.loadedClass}):not(.${params.loadingClass})`); if ($slideEl.hasClass(params.elementClass) && !$slideEl.hasClass(params.loadedClass) && !$slideEl.hasClass(params.loadingClass)) { $images.push($slideEl[0]); } if ($images.length === 0) return; $images.each(imageEl => { const $imageEl = $(imageEl); $imageEl.addClass(params.loadingClass); const background = $imageEl.attr('data-background'); const src = $imageEl.attr('data-src'); const srcset = $imageEl.attr('data-srcset'); const sizes = $imageEl.attr('data-sizes'); const $pictureEl = $imageEl.parent('picture'); swiper.loadImage($imageEl[0], src || background, srcset, sizes, false, () => { if (typeof swiper === 'undefined' || swiper === null || !swiper || swiper && !swiper.params || swiper.destroyed) return; if (background) { $imageEl.css('background-image', `url("${background}")`); $imageEl.removeAttr('data-background'); } else { if (srcset) { $imageEl.attr('srcset', srcset); $imageEl.removeAttr('data-srcset'); } if (sizes) { $imageEl.attr('sizes', sizes); $imageEl.removeAttr('data-sizes'); } if ($pictureEl.length) { $pictureEl.children('source').each(sourceEl => { const $source = $(sourceEl); if ($source.attr('data-srcset')) { $source.attr('srcset', $source.attr('data-srcset')); $source.removeAttr('data-srcset'); } }); } if (src) { $imageEl.attr('src', src); $imageEl.removeAttr('data-src'); } } $imageEl.addClass(params.loadedClass).removeClass(params.loadingClass); $slideEl.find(`.${params.preloaderClass}`).remove(); if (swiper.params.loop && loadInDuplicate) { const slideOriginalIndex = $slideEl.attr('data-swiper-slide-index'); if ($slideEl.hasClass(swiper.params.slideDuplicateClass)) { const originalSlide = swiper.$wrapperEl.children(`[data-swiper-slide-index="${slideOriginalIndex}"]:not(.${swiper.params.slideDuplicateClass})`); loadInSlide(originalSlide.index(), false); } else { const duplicatedSlide = swiper.$wrapperEl.children(`.${swiper.params.slideDuplicateClass}[data-swiper-slide-index="${slideOriginalIndex}"]`); loadInSlide(duplicatedSlide.index(), false); } } emit('lazyImageReady', $slideEl[0], $imageEl[0]); if (swiper.params.autoHeight) { swiper.updateAutoHeight(); } }); emit('lazyImageLoad', $slideEl[0], $imageEl[0]); }); } function load() { const { $wrapperEl, params: swiperParams, slides, activeIndex } = swiper; const isVirtual = swiper.virtual && swiperParams.virtual.enabled; const params = swiperParams.lazy; let slidesPerView = swiperParams.slidesPerView; if (slidesPerView === 'auto') { slidesPerView = 0; } function slideExist(index) { if (isVirtual) { if ($wrapperEl.children(`.${swiperParams.slideClass}[data-swiper-slide-index="${index}"]`).length) { return true; } } else if (slides[index]) return true; return false; } function slideIndex(slideEl) { if (isVirtual) { return $(slideEl).attr('data-swiper-slide-index'); } return $(slideEl).index(); } if (!initialImageLoaded) initialImageLoaded = true; if (swiper.params.watchSlidesProgress) { $wrapperEl.children(`.${swiperParams.slideVisibleClass}`).each(slideEl => { const index = isVirtual ? $(slideEl).attr('data-swiper-slide-index') : $(slideEl).index(); loadInSlide(index); }); } else if (slidesPerView > 1) { for (let i = activeIndex; i < activeIndex + slidesPerView; i += 1) { if (slideExist(i)) loadInSlide(i); } } else { loadInSlide(activeIndex); } if (params.loadPrevNext) { if (slidesPerView > 1 || params.loadPrevNextAmount && params.loadPrevNextAmount > 1) { const amount = params.loadPrevNextAmount; const spv = slidesPerView; const maxIndex = Math.min(activeIndex + spv + Math.max(amount, spv), slides.length); const minIndex = Math.max(activeIndex - Math.max(spv, amount), 0); // Next Slides for (let i = activeIndex + slidesPerView; i < maxIndex; i += 1) { if (slideExist(i)) loadInSlide(i); } // Prev Slides for (let i = minIndex; i < activeIndex; i += 1) { if (slideExist(i)) loadInSlide(i); } } else { const nextSlide = $wrapperEl.children(`.${swiperParams.slideNextClass}`); if (nextSlide.length > 0) loadInSlide(slideIndex(nextSlide)); const prevSlide = $wrapperEl.children(`.${swiperParams.slidePrevClass}`); if (prevSlide.length > 0) loadInSlide(slideIndex(prevSlide)); } } } function checkInViewOnLoad() { const window = getWindow(); if (!swiper || swiper.destroyed) return; const $scrollElement = swiper.params.lazy.scrollingElement ? $(swiper.params.lazy.scrollingElement) : $(window); const isWindow = $scrollElement[0] === window; const scrollElementWidth = isWindow ? window.innerWidth : $scrollElement[0].offsetWidth; const scrollElementHeight = isWindow ? window.innerHeight : $scrollElement[0].offsetHeight; const swiperOffset = swiper.$el.offset(); const { rtlTranslate: rtl } = swiper; let inView = false; if (rtl) swiperOffset.left -= swiper.$el[0].scrollLeft; const swiperCoord = [[swiperOffset.left, swiperOffset.top], [swiperOffset.left + swiper.width, swiperOffset.top], [swiperOffset.left, swiperOffset.top + swiper.height], [swiperOffset.left + swiper.width, swiperOffset.top + swiper.height]]; for (let i = 0; i < swiperCoord.length; i += 1) { const point = swiperCoord[i]; if (point[0] >= 0 && point[0] <= scrollElementWidth && point[1] >= 0 && point[1] <= scrollElementHeight) { if (point[0] === 0 && point[1] === 0) continue; // eslint-disable-line inView = true; } } const passiveListener = swiper.touchEvents.start === 'touchstart' && swiper.support.passiveListener && swiper.params.passiveListeners ? { passive: true, capture: false } : false; if (inView) { load(); $scrollElement.off('scroll', checkInViewOnLoad, passiveListener); } else if (!scrollHandlerAttached) { scrollHandlerAttached = true; $scrollElement.on('scroll', checkInViewOnLoad, passiveListener); } } on('beforeInit', () => { if (swiper.params.lazy.enabled && swiper.params.preloadImages) { swiper.params.preloadImages = false; } }); on('init', () => { if (swiper.params.lazy.enabled) { if (swiper.params.lazy.checkInView) { checkInViewOnLoad(); } else { load(); } } }); on('scroll', () => { if (swiper.params.freeMode && swiper.params.freeMode.enabled && !swiper.params.freeMode.sticky) { load(); } }); on('scrollbarDragMove resize _freeModeNoMomentumRelease', () => { if (swiper.params.lazy.enabled) { if (swiper.params.lazy.checkInView) { checkInViewOnLoad(); } else { load(); } } }); on('transitionStart', () => { if (swiper.params.lazy.enabled) { if (swiper.params.lazy.loadOnTransitionStart || !swiper.params.lazy.loadOnTransitionStart && !initialImageLoaded) { if (swiper.params.lazy.checkInView) { checkInViewOnLoad(); } else { load(); } } } }); on('transitionEnd', () => { if (swiper.params.lazy.enabled && !swiper.params.lazy.loadOnTransitionStart) { if (swiper.params.lazy.checkInView) { checkInViewOnLoad(); } else { load(); } } }); on('slideChange', () => { const { lazy, cssMode, watchSlidesProgress, touchReleaseOnEdges, resistanceRatio } = swiper.params; if (lazy.enabled && (cssMode || watchSlidesProgress && (touchReleaseOnEdges || resistanceRatio === 0))) { load(); } }); Object.assign(swiper.lazy, { load, loadInSlide }); } /* eslint no-bitwise: ["error", { "allow": [">>"] }] */ function Controller({ swiper, extendParams, on }) { extendParams({ controller: { control: undefined, inverse: false, by: 'slide' // or 'container' } }); swiper.controller = { control: undefined }; function LinearSpline(x, y) { const binarySearch = function search() { let maxIndex; let minIndex; let guess; return (array, val) => { minIndex = -1; maxIndex = array.length; while (maxIndex - minIndex > 1) { guess = maxIndex + minIndex >> 1; if (array[guess] <= val) { minIndex = guess; } else { maxIndex = guess; } } return maxIndex; }; }(); this.x = x; this.y = y; this.lastIndex = x.length - 1; // Given an x value (x2), return the expected y2 value: // (x1,y1) is the known point before given value, // (x3,y3) is the known point after given value. let i1; let i3; this.interpolate = function interpolate(x2) { if (!x2) return 0; // Get the indexes of x1 and x3 (the array indexes before and after given x2): i3 = binarySearch(this.x, x2); i1 = i3 - 1; // We have our indexes i1 & i3, so we can calculate already: // y2 := ((x2−x1) × (y3−y1)) ÷ (x3−x1) + y1 return (x2 - this.x[i1]) * (this.y[i3] - this.y[i1]) / (this.x[i3] - this.x[i1]) + this.y[i1]; }; return this; } // xxx: for now i will just save one spline function to to function getInterpolateFunction(c) { if (!swiper.controller.spline) { swiper.controller.spline = swiper.params.loop ? new LinearSpline(swiper.slidesGrid, c.slidesGrid) : new LinearSpline(swiper.snapGrid, c.snapGrid); } } function setTranslate(_t, byController) { const controlled = swiper.controller.control; let multiplier; let controlledTranslate; const Swiper = swiper.constructor; function setControlledTranslate(c) { // this will create an Interpolate function based on the snapGrids // x is the Grid of the scrolled scroller and y will be the controlled scroller // it makes sense to create this only once and recall it for the interpolation // the function does a lot of value caching for performance const translate = swiper.rtlTranslate ? -swiper.translate : swiper.translate; if (swiper.params.controller.by === 'slide') { getInterpolateFunction(c); // i am not sure why the values have to be multiplicated this way, tried to invert the snapGrid // but it did not work out controlledTranslate = -swiper.controller.spline.interpolate(-translate); } if (!controlledTranslate || swiper.params.controller.by === 'container') { multiplier = (c.maxTranslate() - c.minTranslate()) / (swiper.maxTranslate() - swiper.minTranslate()); controlledTranslate = (translate - swiper.minTranslate()) * multiplier + c.minTranslate(); } if (swiper.params.controller.inverse) { controlledTranslate = c.maxTranslate() - controlledTranslate; } c.updateProgress(controlledTranslate); c.setTranslate(controlledTranslate, swiper); c.updateActiveIndex(); c.updateSlidesClasses(); } if (Array.isArray(controlled)) { for (let i = 0; i < controlled.length; i += 1) { if (controlled[i] !== byController && controlled[i] instanceof Swiper) { setControlledTranslate(controlled[i]); } } } else if (controlled instanceof Swiper && byController !== controlled) { setControlledTranslate(controlled); } } function setTransition(duration, byController) { const Swiper = swiper.constructor; const controlled = swiper.controller.control; let i; function setControlledTransition(c) { c.setTransition(duration, swiper); if (duration !== 0) { c.transitionStart(); if (c.params.autoHeight) { nextTick(() => { c.updateAutoHeight(); }); } c.$wrapperEl.transitionEnd(() => { if (!controlled) return; if (c.params.loop && swiper.params.controller.by === 'slide') { c.loopFix(); } c.transitionEnd(); }); } } if (Array.isArray(controlled)) { for (i = 0; i < controlled.length; i += 1) { if (controlled[i] !== byController && controlled[i] instanceof Swiper) { setControlledTransition(controlled[i]); } } } else if (controlled instanceof Swiper && byController !== controlled) { setControlledTransition(controlled); } } function removeSpline() { if (!swiper.controller.control) return; if (swiper.controller.spline) { swiper.controller.spline = undefined; delete swiper.controller.spline; } } on('beforeInit', () => { swiper.controller.control = swiper.params.controller.control; }); on('update', () => { removeSpline(); }); on('resize', () => { removeSpline(); }); on('observerUpdate', () => { removeSpline(); }); on('setTranslate', (_s, translate, byController) => { if (!swiper.controller.control) return; swiper.controller.setTranslate(translate, byController); }); on('setTransition', (_s, duration, byController) => { if (!swiper.controller.control) return; swiper.controller.setTransition(duration, byController); }); Object.assign(swiper.controller, { setTranslate, setTransition }); } function A11y({ swiper, extendParams, on }) { extendParams({ a11y: { enabled: true, notificationClass: 'swiper-notification', prevSlideMessage: 'Previous slide', nextSlideMessage: 'Next slide', firstSlideMessage: 'This is the first slide', lastSlideMessage: 'This is the last slide', paginationBulletMessage: 'Go to slide {{index}}', slideLabelMessage: '{{index}} / {{slidesLength}}', containerMessage: null, containerRoleDescriptionMessage: null, itemRoleDescriptionMessage: null, slideRole: 'group' } }); let liveRegion = null; function notify(message) { const notification = liveRegion; if (notification.length === 0) return; notification.html(''); notification.html(message); } function getRandomNumber(size = 16) { const randomChar = () => Math.round(16 * Math.random()).toString(16); return 'x'.repeat(size).replace(/x/g, randomChar); } function makeElFocusable($el) { $el.attr('tabIndex', '0'); } function makeElNotFocusable($el) { $el.attr('tabIndex', '-1'); } function addElRole($el, role) { $el.attr('role', role); } function addElRoleDescription($el, description) { $el.attr('aria-roledescription', description); } function addElControls($el, controls) { $el.attr('aria-controls', controls); } function addElLabel($el, label) { $el.attr('aria-label', label); } function addElId($el, id) { $el.attr('id', id); } function addElLive($el, live) { $el.attr('aria-live', live); } function disableEl($el) { $el.attr('aria-disabled', true); } function enableEl($el) { $el.attr('aria-disabled', false); } function onEnterOrSpaceKey(e) { if (e.keyCode !== 13 && e.keyCode !== 32) return; const params = swiper.params.a11y; const $targetEl = $(e.target); if (swiper.navigation && swiper.navigation.$nextEl && $targetEl.is(swiper.navigation.$nextEl)) { if (!(swiper.isEnd && !swiper.params.loop)) { swiper.slideNext(); } if (swiper.isEnd) { notify(params.lastSlideMessage); } else { notify(params.nextSlideMessage); } } if (swiper.navigation && swiper.navigation.$prevEl && $targetEl.is(swiper.navigation.$prevEl)) { if (!(swiper.isBeginning && !swiper.params.loop)) { swiper.slidePrev(); } if (swiper.isBeginning) { notify(params.firstSlideMessage); } else { notify(params.prevSlideMessage); } } if (swiper.pagination && $targetEl.is(classesToSelector(swiper.params.pagination.bulletClass))) { $targetEl[0].click(); } } function updateNavigation() { if (swiper.params.loop || !swiper.navigation) return; const { $nextEl, $prevEl } = swiper.navigation; if ($prevEl && $prevEl.length > 0) { if (swiper.isBeginning) { disableEl($prevEl); makeElNotFocusable($prevEl); } else { enableEl($prevEl); makeElFocusable($prevEl); } } if ($nextEl && $nextEl.length > 0) { if (swiper.isEnd) { disableEl($nextEl); makeElNotFocusable($nextEl); } else { enableEl($nextEl); makeElFocusable($nextEl); } } } function hasPagination() { return swiper.pagination && swiper.params.pagination.clickable && swiper.pagination.bullets && swiper.pagination.bullets.length; } function updatePagination() { const params = swiper.params.a11y; if (hasPagination()) { swiper.pagination.bullets.each(bulletEl => { const $bulletEl = $(bulletEl); makeElFocusable($bulletEl); if (!swiper.params.pagination.renderBullet) { addElRole($bulletEl, 'button'); addElLabel($bulletEl, params.paginationBulletMessage.replace(/\{\{index\}\}/, $bulletEl.index() + 1)); } }); } } const initNavEl = ($el, wrapperId, message) => { makeElFocusable($el); if ($el[0].tagName !== 'BUTTON') { addElRole($el, 'button'); $el.on('keydown', onEnterOrSpaceKey); } addElLabel($el, message); addElControls($el, wrapperId); }; function init() { const params = swiper.params.a11y; swiper.$el.append(liveRegion); // Container const $containerEl = swiper.$el; if (params.containerRoleDescriptionMessage) { addElRoleDescription($containerEl, params.containerRoleDescriptionMessage); } if (params.containerMessage) { addElLabel($containerEl, params.containerMessage); } // Wrapper const $wrapperEl = swiper.$wrapperEl; const wrapperId = $wrapperEl.attr('id') || `swiper-wrapper-${getRandomNumber(16)}`; const live = swiper.params.autoplay && swiper.params.autoplay.enabled ? 'off' : 'polite'; addElId($wrapperEl, wrapperId); addElLive($wrapperEl, live); // Slide if (params.itemRoleDescriptionMessage) { addElRoleDescription($(swiper.slides), params.itemRoleDescriptionMessage); } addElRole($(swiper.slides), params.slideRole); const slidesLength = swiper.params.loop ? swiper.slides.filter(el => !el.classList.contains(swiper.params.slideDuplicateClass)).length : swiper.slides.length; swiper.slides.each((slideEl, index) => { const $slideEl = $(slideEl); const slideIndex = swiper.params.loop ? parseInt($slideEl.attr('data-swiper-slide-index'), 10) : index; const ariaLabelMessage = params.slideLabelMessage.replace(/\{\{index\}\}/, slideIndex + 1).replace(/\{\{slidesLength\}\}/, slidesLength); addElLabel($slideEl, ariaLabelMessage); }); // Navigation let $nextEl; let $prevEl; if (swiper.navigation && swiper.navigation.$nextEl) { $nextEl = swiper.navigation.$nextEl; } if (swiper.navigation && swiper.navigation.$prevEl) { $prevEl = swiper.navigation.$prevEl; } if ($nextEl && $nextEl.length) { initNavEl($nextEl, wrapperId, params.nextSlideMessage); } if ($prevEl && $prevEl.length) { initNavEl($prevEl, wrapperId, params.prevSlideMessage); } // Pagination if (hasPagination()) { swiper.pagination.$el.on('keydown', classesToSelector(swiper.params.pagination.bulletClass), onEnterOrSpaceKey); } } function destroy() { if (liveRegion && liveRegion.length > 0) liveRegion.remove(); let $nextEl; let $prevEl; if (swiper.navigation && swiper.navigation.$nextEl) { $nextEl = swiper.navigation.$nextEl; } if (swiper.navigation && swiper.navigation.$prevEl) { $prevEl = swiper.navigation.$prevEl; } if ($nextEl) { $nextEl.off('keydown', onEnterOrSpaceKey); } if ($prevEl) { $prevEl.off('keydown', onEnterOrSpaceKey); } // Pagination if (hasPagination()) { swiper.pagination.$el.off('keydown', classesToSelector(swiper.params.pagination.bulletClass), onEnterOrSpaceKey); } } on('beforeInit', () => { liveRegion = $(``); }); on('afterInit', () => { if (!swiper.params.a11y.enabled) return; init(); updateNavigation(); }); on('toEdge', () => { if (!swiper.params.a11y.enabled) return; updateNavigation(); }); on('fromEdge', () => { if (!swiper.params.a11y.enabled) return; updateNavigation(); }); on('paginationUpdate', () => { if (!swiper.params.a11y.enabled) return; updatePagination(); }); on('destroy', () => { if (!swiper.params.a11y.enabled) return; destroy(); }); } function History({ swiper, extendParams, on }) { extendParams({ history: { enabled: false, root: '', replaceState: false, key: 'slides' } }); let initialized = false; let paths = {}; const slugify = text => { return text.toString().replace(/\s+/g, '-').replace(/[^\w-]+/g, '').replace(/--+/g, '-').replace(/^-+/, '').replace(/-+$/, ''); }; const getPathValues = urlOverride => { const window = getWindow(); let location; if (urlOverride) { location = new URL(urlOverride); } else { location = window.location; } const pathArray = location.pathname.slice(1).split('/').filter(part => part !== ''); const total = pathArray.length; const key = pathArray[total - 2]; const value = pathArray[total - 1]; return { key, value }; }; const setHistory = (key, index) => { const window = getWindow(); if (!initialized || !swiper.params.history.enabled) return; let location; if (swiper.params.url) { location = new URL(swiper.params.url); } else { location = window.location; } const slide = swiper.slides.eq(index); let value = slugify(slide.attr('data-history')); if (swiper.params.history.root.length > 0) { let root = swiper.params.history.root; if (root[root.length - 1] === '/') root = root.slice(0, root.length - 1); value = `${root}/${key}/${value}`; } else if (!location.pathname.includes(key)) { value = `${key}/${value}`; } const currentState = window.history.state; if (currentState && currentState.value === value) { return; } if (swiper.params.history.replaceState) { window.history.replaceState({ value }, null, value); } else { window.history.pushState({ value }, null, value); } }; const scrollToSlide = (speed, value, runCallbacks) => { if (value) { for (let i = 0, length = swiper.slides.length; i < length; i += 1) { const slide = swiper.slides.eq(i); const slideHistory = slugify(slide.attr('data-history')); if (slideHistory === value && !slide.hasClass(swiper.params.slideDuplicateClass)) { const index = slide.index(); swiper.slideTo(index, speed, runCallbacks); } } } else { swiper.slideTo(0, speed, runCallbacks); } }; const setHistoryPopState = () => { paths = getPathValues(swiper.params.url); scrollToSlide(swiper.params.speed, swiper.paths.value, false); }; const init = () => { const window = getWindow(); if (!swiper.params.history) return; if (!window.history || !window.history.pushState) { swiper.params.history.enabled = false; swiper.params.hashNavigation.enabled = true; return; } initialized = true; paths = getPathValues(swiper.params.url); if (!paths.key && !paths.value) return; scrollToSlide(0, paths.value, swiper.params.runCallbacksOnInit); if (!swiper.params.history.replaceState) { window.addEventListener('popstate', setHistoryPopState); } }; const destroy = () => { const window = getWindow(); if (!swiper.params.history.replaceState) { window.removeEventListener('popstate', setHistoryPopState); } }; on('init', () => { if (swiper.params.history.enabled) { init(); } }); on('destroy', () => { if (swiper.params.history.enabled) { destroy(); } }); on('transitionEnd _freeModeNoMomentumRelease', () => { if (initialized) { setHistory(swiper.params.history.key, swiper.activeIndex); } }); on('slideChange', () => { if (initialized && swiper.params.cssMode) { setHistory(swiper.params.history.key, swiper.activeIndex); } }); } function HashNavigation({ swiper, extendParams, emit, on }) { let initialized = false; const document = getDocument(); const window = getWindow(); extendParams({ hashNavigation: { enabled: false, replaceState: false, watchState: false } }); const onHashChange = () => { emit('hashChange'); const newHash = document.location.hash.replace('#', ''); const activeSlideHash = swiper.slides.eq(swiper.activeIndex).attr('data-hash'); if (newHash !== activeSlideHash) { const newIndex = swiper.$wrapperEl.children(`.${swiper.params.slideClass}[data-hash="${newHash}"]`).index(); if (typeof newIndex === 'undefined') return; swiper.slideTo(newIndex); } }; const setHash = () => { if (!initialized || !swiper.params.hashNavigation.enabled) return; if (swiper.params.hashNavigation.replaceState && window.history && window.history.replaceState) { window.history.replaceState(null, null, `#${swiper.slides.eq(swiper.activeIndex).attr('data-hash')}` || ''); emit('hashSet'); } else { const slide = swiper.slides.eq(swiper.activeIndex); const hash = slide.attr('data-hash') || slide.attr('data-history'); document.location.hash = hash || ''; emit('hashSet'); } }; const init = () => { if (!swiper.params.hashNavigation.enabled || swiper.params.history && swiper.params.history.enabled) return; initialized = true; const hash = document.location.hash.replace('#', ''); if (hash) { const speed = 0; for (let i = 0, length = swiper.slides.length; i < length; i += 1) { const slide = swiper.slides.eq(i); const slideHash = slide.attr('data-hash') || slide.attr('data-history'); if (slideHash === hash && !slide.hasClass(swiper.params.slideDuplicateClass)) { const index = slide.index(); swiper.slideTo(index, speed, swiper.params.runCallbacksOnInit, true); } } } if (swiper.params.hashNavigation.watchState) { $(window).on('hashchange', onHashChange); } }; const destroy = () => { if (swiper.params.hashNavigation.watchState) { $(window).off('hashchange', onHashChange); } }; on('init', () => { if (swiper.params.hashNavigation.enabled) { init(); } }); on('destroy', () => { if (swiper.params.hashNavigation.enabled) { destroy(); } }); on('transitionEnd _freeModeNoMomentumRelease', () => { if (initialized) { setHash(); } }); on('slideChange', () => { if (initialized && swiper.params.cssMode) { setHash(); } }); } /* eslint no-underscore-dangle: "off" */ function Autoplay({ swiper, extendParams, on, emit }) { let timeout; swiper.autoplay = { running: false, paused: false }; extendParams({ autoplay: { enabled: false, delay: 3000, waitForTransition: true, disableOnInteraction: true, stopOnLastSlide: false, reverseDirection: false, pauseOnMouseEnter: false } }); function run() { const $activeSlideEl = swiper.slides.eq(swiper.activeIndex); let delay = swiper.params.autoplay.delay; if ($activeSlideEl.attr('data-swiper-autoplay')) { delay = $activeSlideEl.attr('data-swiper-autoplay') || swiper.params.autoplay.delay; } clearTimeout(timeout); timeout = nextTick(() => { let autoplayResult; if (swiper.params.autoplay.reverseDirection) { if (swiper.params.loop) { swiper.loopFix(); autoplayResult = swiper.slidePrev(swiper.params.speed, true, true); emit('autoplay'); } else if (!swiper.isBeginning) { autoplayResult = swiper.slidePrev(swiper.params.speed, true, true); emit('autoplay'); } else if (!swiper.params.autoplay.stopOnLastSlide) { autoplayResult = swiper.slideTo(swiper.slides.length - 1, swiper.params.speed, true, true); emit('autoplay'); } else { stop(); } } else if (swiper.params.loop) { swiper.loopFix(); autoplayResult = swiper.slideNext(swiper.params.speed, true, true); emit('autoplay'); } else if (!swiper.isEnd) { autoplayResult = swiper.slideNext(swiper.params.speed, true, true); emit('autoplay'); } else if (!swiper.params.autoplay.stopOnLastSlide) { autoplayResult = swiper.slideTo(0, swiper.params.speed, true, true); emit('autoplay'); } else { stop(); } if (swiper.params.cssMode && swiper.autoplay.running) run();else if (autoplayResult === false) { run(); } }, delay); } function start() { if (typeof timeout !== 'undefined') return false; if (swiper.autoplay.running) return false; swiper.autoplay.running = true; emit('autoplayStart'); run(); return true; } function stop() { if (!swiper.autoplay.running) return false; if (typeof timeout === 'undefined') return false; if (timeout) { clearTimeout(timeout); timeout = undefined; } swiper.autoplay.running = false; emit('autoplayStop'); return true; } function pause(speed) { if (!swiper.autoplay.running) return; if (swiper.autoplay.paused) return; if (timeout) clearTimeout(timeout); swiper.autoplay.paused = true; if (speed === 0 || !swiper.params.autoplay.waitForTransition) { swiper.autoplay.paused = false; run(); } else { ['transitionend', 'webkitTransitionEnd'].forEach(event => { swiper.$wrapperEl[0].addEventListener(event, onTransitionEnd); }); } } function onVisibilityChange() { const document = getDocument(); if (document.visibilityState === 'hidden' && swiper.autoplay.running) { pause(); } if (document.visibilityState === 'visible' && swiper.autoplay.paused) { run(); swiper.autoplay.paused = false; } } function onTransitionEnd(e) { if (!swiper || swiper.destroyed || !swiper.$wrapperEl) return; if (e.target !== swiper.$wrapperEl[0]) return; ['transitionend', 'webkitTransitionEnd'].forEach(event => { swiper.$wrapperEl[0].removeEventListener(event, onTransitionEnd); }); swiper.autoplay.paused = false; if (!swiper.autoplay.running) { stop(); } else { run(); } } function onMouseEnter() { if (swiper.params.autoplay.disableOnInteraction) { stop(); } else { pause(); } ['transitionend', 'webkitTransitionEnd'].forEach(event => { swiper.$wrapperEl[0].removeEventListener(event, onTransitionEnd); }); } function onMouseLeave() { if (swiper.params.autoplay.disableOnInteraction) { return; } swiper.autoplay.paused = false; run(); } function attachMouseEvents() { if (swiper.params.autoplay.pauseOnMouseEnter) { swiper.$el.on('mouseenter', onMouseEnter); swiper.$el.on('mouseleave', onMouseLeave); } } function detachMouseEvents() { swiper.$el.off('mouseenter', onMouseEnter); swiper.$el.off('mouseleave', onMouseLeave); } on('init', () => { if (swiper.params.autoplay.enabled) { start(); const document = getDocument(); document.addEventListener('visibilitychange', onVisibilityChange); attachMouseEvents(); } }); on('beforeTransitionStart', (_s, speed, internal) => { if (swiper.autoplay.running) { if (internal || !swiper.params.autoplay.disableOnInteraction) { swiper.autoplay.pause(speed); } else { stop(); } } }); on('sliderFirstMove', () => { if (swiper.autoplay.running) { if (swiper.params.autoplay.disableOnInteraction) { stop(); } else { pause(); } } }); on('touchEnd', () => { if (swiper.params.cssMode && swiper.autoplay.paused && !swiper.params.autoplay.disableOnInteraction) { run(); } }); on('destroy', () => { detachMouseEvents(); if (swiper.autoplay.running) { stop(); } const document = getDocument(); document.removeEventListener('visibilitychange', onVisibilityChange); }); Object.assign(swiper.autoplay, { pause, run, start, stop }); } function Thumb({ swiper, extendParams, on }) { extendParams({ thumbs: { swiper: null, multipleActiveThumbs: true, autoScrollOffset: 0, slideThumbActiveClass: 'swiper-slide-thumb-active', thumbsContainerClass: 'swiper-thumbs' } }); let initialized = false; let swiperCreated = false; swiper.thumbs = { swiper: null }; function onThumbClick() { const thumbsSwiper = swiper.thumbs.swiper; if (!thumbsSwiper) return; const clickedIndex = thumbsSwiper.clickedIndex; const clickedSlide = thumbsSwiper.clickedSlide; if (clickedSlide && $(clickedSlide).hasClass(swiper.params.thumbs.slideThumbActiveClass)) return; if (typeof clickedIndex === 'undefined' || clickedIndex === null) return; let slideToIndex; if (thumbsSwiper.params.loop) { slideToIndex = parseInt($(thumbsSwiper.clickedSlide).attr('data-swiper-slide-index'), 10); } else { slideToIndex = clickedIndex; } if (swiper.params.loop) { let currentIndex = swiper.activeIndex; if (swiper.slides.eq(currentIndex).hasClass(swiper.params.slideDuplicateClass)) { swiper.loopFix(); // eslint-disable-next-line swiper._clientLeft = swiper.$wrapperEl[0].clientLeft; currentIndex = swiper.activeIndex; } const prevIndex = swiper.slides.eq(currentIndex).prevAll(`[data-swiper-slide-index="${slideToIndex}"]`).eq(0).index(); const nextIndex = swiper.slides.eq(currentIndex).nextAll(`[data-swiper-slide-index="${slideToIndex}"]`).eq(0).index(); if (typeof prevIndex === 'undefined') slideToIndex = nextIndex;else if (typeof nextIndex === 'undefined') slideToIndex = prevIndex;else if (nextIndex - currentIndex < currentIndex - prevIndex) slideToIndex = nextIndex;else slideToIndex = prevIndex; } swiper.slideTo(slideToIndex); } function init() { const { thumbs: thumbsParams } = swiper.params; if (initialized) return false; initialized = true; const SwiperClass = swiper.constructor; if (thumbsParams.swiper instanceof SwiperClass) { swiper.thumbs.swiper = thumbsParams.swiper; Object.assign(swiper.thumbs.swiper.originalParams, { watchSlidesProgress: true, slideToClickedSlide: false }); Object.assign(swiper.thumbs.swiper.params, { watchSlidesProgress: true, slideToClickedSlide: false }); } else if (isObject(thumbsParams.swiper)) { const thumbsSwiperParams = Object.assign({}, thumbsParams.swiper); Object.assign(thumbsSwiperParams, { watchSlidesProgress: true, slideToClickedSlide: false }); swiper.thumbs.swiper = new SwiperClass(thumbsSwiperParams); swiperCreated = true; } swiper.thumbs.swiper.$el.addClass(swiper.params.thumbs.thumbsContainerClass); swiper.thumbs.swiper.on('tap', onThumbClick); return true; } function update(initial) { const thumbsSwiper = swiper.thumbs.swiper; if (!thumbsSwiper) return; const slidesPerView = thumbsSwiper.params.slidesPerView === 'auto' ? thumbsSwiper.slidesPerViewDynamic() : thumbsSwiper.params.slidesPerView; const autoScrollOffset = swiper.params.thumbs.autoScrollOffset; const useOffset = autoScrollOffset && !thumbsSwiper.params.loop; if (swiper.realIndex !== thumbsSwiper.realIndex || useOffset) { let currentThumbsIndex = thumbsSwiper.activeIndex; let newThumbsIndex; let direction; if (thumbsSwiper.params.loop) { if (thumbsSwiper.slides.eq(currentThumbsIndex).hasClass(thumbsSwiper.params.slideDuplicateClass)) { thumbsSwiper.loopFix(); // eslint-disable-next-line thumbsSwiper._clientLeft = thumbsSwiper.$wrapperEl[0].clientLeft; currentThumbsIndex = thumbsSwiper.activeIndex; } // Find actual thumbs index to slide to const prevThumbsIndex = thumbsSwiper.slides.eq(currentThumbsIndex).prevAll(`[data-swiper-slide-index="${swiper.realIndex}"]`).eq(0).index(); const nextThumbsIndex = thumbsSwiper.slides.eq(currentThumbsIndex).nextAll(`[data-swiper-slide-index="${swiper.realIndex}"]`).eq(0).index(); if (typeof prevThumbsIndex === 'undefined') { newThumbsIndex = nextThumbsIndex; } else if (typeof nextThumbsIndex === 'undefined') { newThumbsIndex = prevThumbsIndex; } else if (nextThumbsIndex - currentThumbsIndex === currentThumbsIndex - prevThumbsIndex) { newThumbsIndex = thumbsSwiper.params.slidesPerGroup > 1 ? nextThumbsIndex : currentThumbsIndex; } else if (nextThumbsIndex - currentThumbsIndex < currentThumbsIndex - prevThumbsIndex) { newThumbsIndex = nextThumbsIndex; } else { newThumbsIndex = prevThumbsIndex; } direction = swiper.activeIndex > swiper.previousIndex ? 'next' : 'prev'; } else { newThumbsIndex = swiper.realIndex; direction = newThumbsIndex > swiper.previousIndex ? 'next' : 'prev'; } if (useOffset) { newThumbsIndex += direction === 'next' ? autoScrollOffset : -1 * autoScrollOffset; } if (thumbsSwiper.visibleSlidesIndexes && thumbsSwiper.visibleSlidesIndexes.indexOf(newThumbsIndex) < 0) { if (thumbsSwiper.params.centeredSlides) { if (newThumbsIndex > currentThumbsIndex) { newThumbsIndex = newThumbsIndex - Math.floor(slidesPerView / 2) + 1; } else { newThumbsIndex = newThumbsIndex + Math.floor(slidesPerView / 2) - 1; } } else if (newThumbsIndex > currentThumbsIndex && thumbsSwiper.params.slidesPerGroup === 1) ; thumbsSwiper.slideTo(newThumbsIndex, initial ? 0 : undefined); } } // Activate thumbs let thumbsToActivate = 1; const thumbActiveClass = swiper.params.thumbs.slideThumbActiveClass; if (swiper.params.slidesPerView > 1 && !swiper.params.centeredSlides) { thumbsToActivate = swiper.params.slidesPerView; } if (!swiper.params.thumbs.multipleActiveThumbs) { thumbsToActivate = 1; } thumbsToActivate = Math.floor(thumbsToActivate); thumbsSwiper.slides.removeClass(thumbActiveClass); if (thumbsSwiper.params.loop || thumbsSwiper.params.virtual && thumbsSwiper.params.virtual.enabled) { for (let i = 0; i < thumbsToActivate; i += 1) { thumbsSwiper.$wrapperEl.children(`[data-swiper-slide-index="${swiper.realIndex + i}"]`).addClass(thumbActiveClass); } } else { for (let i = 0; i < thumbsToActivate; i += 1) { thumbsSwiper.slides.eq(swiper.realIndex + i).addClass(thumbActiveClass); } } } on('beforeInit', () => { const { thumbs } = swiper.params; if (!thumbs || !thumbs.swiper) return; init(); update(true); }); on('slideChange update resize observerUpdate', () => { if (!swiper.thumbs.swiper) return; update(); }); on('setTransition', (_s, duration) => { const thumbsSwiper = swiper.thumbs.swiper; if (!thumbsSwiper) return; thumbsSwiper.setTransition(duration); }); on('beforeDestroy', () => { const thumbsSwiper = swiper.thumbs.swiper; if (!thumbsSwiper) return; if (swiperCreated && thumbsSwiper) { thumbsSwiper.destroy(); } }); Object.assign(swiper.thumbs, { init, update }); } function freeMode({ swiper, extendParams, emit, once }) { extendParams({ freeMode: { enabled: false, momentum: true, momentumRatio: 1, momentumBounce: true, momentumBounceRatio: 1, momentumVelocityRatio: 1, sticky: false, minimumVelocity: 0.02 } }); function onTouchMove() { const { touchEventsData: data, touches } = swiper; // Velocity if (data.velocities.length === 0) { data.velocities.push({ position: touches[swiper.isHorizontal() ? 'startX' : 'startY'], time: data.touchStartTime }); } data.velocities.push({ position: touches[swiper.isHorizontal() ? 'currentX' : 'currentY'], time: now() }); } function onTouchEnd({ currentPos }) { const { params, $wrapperEl, rtlTranslate: rtl, snapGrid, touchEventsData: data } = swiper; // Time diff const touchEndTime = now(); const timeDiff = touchEndTime - data.touchStartTime; if (currentPos < -swiper.minTranslate()) { swiper.slideTo(swiper.activeIndex); return; } if (currentPos > -swiper.maxTranslate()) { if (swiper.slides.length < snapGrid.length) { swiper.slideTo(snapGrid.length - 1); } else { swiper.slideTo(swiper.slides.length - 1); } return; } if (params.freeMode.momentum) { if (data.velocities.length > 1) { const lastMoveEvent = data.velocities.pop(); const velocityEvent = data.velocities.pop(); const distance = lastMoveEvent.position - velocityEvent.position; const time = lastMoveEvent.time - velocityEvent.time; swiper.velocity = distance / time; swiper.velocity /= 2; if (Math.abs(swiper.velocity) < params.freeMode.minimumVelocity) { swiper.velocity = 0; } // this implies that the user stopped moving a finger then released. // There would be no events with distance zero, so the last event is stale. if (time > 150 || now() - lastMoveEvent.time > 300) { swiper.velocity = 0; } } else { swiper.velocity = 0; } swiper.velocity *= params.freeMode.momentumVelocityRatio; data.velocities.length = 0; let momentumDuration = 1000 * params.freeMode.momentumRatio; const momentumDistance = swiper.velocity * momentumDuration; let newPosition = swiper.translate + momentumDistance; if (rtl) newPosition = -newPosition; let doBounce = false; let afterBouncePosition; const bounceAmount = Math.abs(swiper.velocity) * 20 * params.freeMode.momentumBounceRatio; let needsLoopFix; if (newPosition < swiper.maxTranslate()) { if (params.freeMode.momentumBounce) { if (newPosition + swiper.maxTranslate() < -bounceAmount) { newPosition = swiper.maxTranslate() - bounceAmount; } afterBouncePosition = swiper.maxTranslate(); doBounce = true; data.allowMomentumBounce = true; } else { newPosition = swiper.maxTranslate(); } if (params.loop && params.centeredSlides) needsLoopFix = true; } else if (newPosition > swiper.minTranslate()) { if (params.freeMode.momentumBounce) { if (newPosition - swiper.minTranslate() > bounceAmount) { newPosition = swiper.minTranslate() + bounceAmount; } afterBouncePosition = swiper.minTranslate(); doBounce = true; data.allowMomentumBounce = true; } else { newPosition = swiper.minTranslate(); } if (params.loop && params.centeredSlides) needsLoopFix = true; } else if (params.freeMode.sticky) { let nextSlide; for (let j = 0; j < snapGrid.length; j += 1) { if (snapGrid[j] > -newPosition) { nextSlide = j; break; } } if (Math.abs(snapGrid[nextSlide] - newPosition) < Math.abs(snapGrid[nextSlide - 1] - newPosition) || swiper.swipeDirection === 'next') { newPosition = snapGrid[nextSlide]; } else { newPosition = snapGrid[nextSlide - 1]; } newPosition = -newPosition; } if (needsLoopFix) { once('transitionEnd', () => { swiper.loopFix(); }); } // Fix duration if (swiper.velocity !== 0) { if (rtl) { momentumDuration = Math.abs((-newPosition - swiper.translate) / swiper.velocity); } else { momentumDuration = Math.abs((newPosition - swiper.translate) / swiper.velocity); } if (params.freeMode.sticky) { // If freeMode.sticky is active and the user ends a swipe with a slow-velocity // event, then durations can be 20+ seconds to slide one (or zero!) slides. // It's easy to see this when simulating touch with mouse events. To fix this, // limit single-slide swipes to the default slide duration. This also has the // nice side effect of matching slide speed if the user stopped moving before // lifting finger or mouse vs. moving slowly before lifting the finger/mouse. // For faster swipes, also apply limits (albeit higher ones). const moveDistance = Math.abs((rtl ? -newPosition : newPosition) - swiper.translate); const currentSlideSize = swiper.slidesSizesGrid[swiper.activeIndex]; if (moveDistance < currentSlideSize) { momentumDuration = params.speed; } else if (moveDistance < 2 * currentSlideSize) { momentumDuration = params.speed * 1.5; } else { momentumDuration = params.speed * 2.5; } } } else if (params.freeMode.sticky) { swiper.slideToClosest(); return; } if (params.freeMode.momentumBounce && doBounce) { swiper.updateProgress(afterBouncePosition); swiper.setTransition(momentumDuration); swiper.setTranslate(newPosition); swiper.transitionStart(true, swiper.swipeDirection); swiper.animating = true; $wrapperEl.transitionEnd(() => { if (!swiper || swiper.destroyed || !data.allowMomentumBounce) return; emit('momentumBounce'); swiper.setTransition(params.speed); setTimeout(() => { swiper.setTranslate(afterBouncePosition); $wrapperEl.transitionEnd(() => { if (!swiper || swiper.destroyed) return; swiper.transitionEnd(); }); }, 0); }); } else if (swiper.velocity) { emit('_freeModeNoMomentumRelease'); swiper.updateProgress(newPosition); swiper.setTransition(momentumDuration); swiper.setTranslate(newPosition); swiper.transitionStart(true, swiper.swipeDirection); if (!swiper.animating) { swiper.animating = true; $wrapperEl.transitionEnd(() => { if (!swiper || swiper.destroyed) return; swiper.transitionEnd(); }); } } else { swiper.updateProgress(newPosition); } swiper.updateActiveIndex(); swiper.updateSlidesClasses(); } else if (params.freeMode.sticky) { swiper.slideToClosest(); return; } else if (params.freeMode) { emit('_freeModeNoMomentumRelease'); } if (!params.freeMode.momentum || timeDiff >= params.longSwipesMs) { swiper.updateProgress(); swiper.updateActiveIndex(); swiper.updateSlidesClasses(); } } Object.assign(swiper, { freeMode: { onTouchMove, onTouchEnd } }); } function Grid({ swiper, extendParams }) { extendParams({ grid: { rows: 1, fill: 'column' } }); let slidesNumberEvenToRows; let slidesPerRow; let numFullColumns; const initSlides = slidesLength => { const { slidesPerView } = swiper.params; const { rows, fill } = swiper.params.grid; slidesPerRow = slidesNumberEvenToRows / rows; numFullColumns = Math.floor(slidesLength / rows); if (Math.floor(slidesLength / rows) === slidesLength / rows) { slidesNumberEvenToRows = slidesLength; } else { slidesNumberEvenToRows = Math.ceil(slidesLength / rows) * rows; } if (slidesPerView !== 'auto' && fill === 'row') { slidesNumberEvenToRows = Math.max(slidesNumberEvenToRows, slidesPerView * rows); } }; const updateSlide = (i, slide, slidesLength, getDirectionLabel) => { const { slidesPerGroup, spaceBetween } = swiper.params; const { rows, fill } = swiper.params.grid; // Set slides order let newSlideOrderIndex; let column; let row; if (fill === 'row' && slidesPerGroup > 1) { const groupIndex = Math.floor(i / (slidesPerGroup * rows)); const slideIndexInGroup = i - rows * slidesPerGroup * groupIndex; const columnsInGroup = groupIndex === 0 ? slidesPerGroup : Math.min(Math.ceil((slidesLength - groupIndex * rows * slidesPerGroup) / rows), slidesPerGroup); row = Math.floor(slideIndexInGroup / columnsInGroup); column = slideIndexInGroup - row * columnsInGroup + groupIndex * slidesPerGroup; newSlideOrderIndex = column + row * slidesNumberEvenToRows / rows; slide.css({ '-webkit-order': newSlideOrderIndex, order: newSlideOrderIndex }); } else if (fill === 'column') { column = Math.floor(i / rows); row = i - column * rows; if (column > numFullColumns || column === numFullColumns && row === rows - 1) { row += 1; if (row >= rows) { row = 0; column += 1; } } } else { row = Math.floor(i / slidesPerRow); column = i - row * slidesPerRow; } slide.css(getDirectionLabel('margin-top'), row !== 0 ? spaceBetween && `${spaceBetween}px` : ''); }; const updateWrapperSize = (slideSize, snapGrid, getDirectionLabel) => { const { spaceBetween, centeredSlides, roundLengths } = swiper.params; const { rows } = swiper.params.grid; swiper.virtualSize = (slideSize + spaceBetween) * slidesNumberEvenToRows; swiper.virtualSize = Math.ceil(swiper.virtualSize / rows) - spaceBetween; swiper.$wrapperEl.css({ [getDirectionLabel('width')]: `${swiper.virtualSize + spaceBetween}px` }); if (centeredSlides) { snapGrid.splice(0, snapGrid.length); const newSlidesGrid = []; for (let i = 0; i < snapGrid.length; i += 1) { let slidesGridItem = snapGrid[i]; if (roundLengths) slidesGridItem = Math.floor(slidesGridItem); if (snapGrid[i] < swiper.virtualSize + snapGrid[0]) newSlidesGrid.push(slidesGridItem); } snapGrid.push(...newSlidesGrid); } }; swiper.grid = { initSlides, updateSlide, updateWrapperSize }; } function appendSlide(slides) { const swiper = this; const { $wrapperEl, params } = swiper; if (params.loop) { swiper.loopDestroy(); } if (typeof slides === 'object' && 'length' in slides) { for (let i = 0; i < slides.length; i += 1) { if (slides[i]) $wrapperEl.append(slides[i]); } } else { $wrapperEl.append(slides); } if (params.loop) { swiper.loopCreate(); } if (!params.observer) { swiper.update(); } } function prependSlide(slides) { const swiper = this; const { params, $wrapperEl, activeIndex } = swiper; if (params.loop) { swiper.loopDestroy(); } let newActiveIndex = activeIndex + 1; if (typeof slides === 'object' && 'length' in slides) { for (let i = 0; i < slides.length; i += 1) { if (slides[i]) $wrapperEl.prepend(slides[i]); } newActiveIndex = activeIndex + slides.length; } else { $wrapperEl.prepend(slides); } if (params.loop) { swiper.loopCreate(); } if (!params.observer) { swiper.update(); } swiper.slideTo(newActiveIndex, 0, false); } function addSlide(index, slides) { const swiper = this; const { $wrapperEl, params, activeIndex } = swiper; let activeIndexBuffer = activeIndex; if (params.loop) { activeIndexBuffer -= swiper.loopedSlides; swiper.loopDestroy(); swiper.slides = $wrapperEl.children(`.${params.slideClass}`); } const baseLength = swiper.slides.length; if (index <= 0) { swiper.prependSlide(slides); return; } if (index >= baseLength) { swiper.appendSlide(slides); return; } let newActiveIndex = activeIndexBuffer > index ? activeIndexBuffer + 1 : activeIndexBuffer; const slidesBuffer = []; for (let i = baseLength - 1; i >= index; i -= 1) { const currentSlide = swiper.slides.eq(i); currentSlide.remove(); slidesBuffer.unshift(currentSlide); } if (typeof slides === 'object' && 'length' in slides) { for (let i = 0; i < slides.length; i += 1) { if (slides[i]) $wrapperEl.append(slides[i]); } newActiveIndex = activeIndexBuffer > index ? activeIndexBuffer + slides.length : activeIndexBuffer; } else { $wrapperEl.append(slides); } for (let i = 0; i < slidesBuffer.length; i += 1) { $wrapperEl.append(slidesBuffer[i]); } if (params.loop) { swiper.loopCreate(); } if (!params.observer) { swiper.update(); } if (params.loop) { swiper.slideTo(newActiveIndex + swiper.loopedSlides, 0, false); } else { swiper.slideTo(newActiveIndex, 0, false); } } function removeSlide(slidesIndexes) { const swiper = this; const { params, $wrapperEl, activeIndex } = swiper; let activeIndexBuffer = activeIndex; if (params.loop) { activeIndexBuffer -= swiper.loopedSlides; swiper.loopDestroy(); swiper.slides = $wrapperEl.children(`.${params.slideClass}`); } let newActiveIndex = activeIndexBuffer; let indexToRemove; if (typeof slidesIndexes === 'object' && 'length' in slidesIndexes) { for (let i = 0; i < slidesIndexes.length; i += 1) { indexToRemove = slidesIndexes[i]; if (swiper.slides[indexToRemove]) swiper.slides.eq(indexToRemove).remove(); if (indexToRemove < newActiveIndex) newActiveIndex -= 1; } newActiveIndex = Math.max(newActiveIndex, 0); } else { indexToRemove = slidesIndexes; if (swiper.slides[indexToRemove]) swiper.slides.eq(indexToRemove).remove(); if (indexToRemove < newActiveIndex) newActiveIndex -= 1; newActiveIndex = Math.max(newActiveIndex, 0); } if (params.loop) { swiper.loopCreate(); } if (!params.observer) { swiper.update(); } if (params.loop) { swiper.slideTo(newActiveIndex + swiper.loopedSlides, 0, false); } else { swiper.slideTo(newActiveIndex, 0, false); } } function removeAllSlides() { const swiper = this; const slidesIndexes = []; for (let i = 0; i < swiper.slides.length; i += 1) { slidesIndexes.push(i); } swiper.removeSlide(slidesIndexes); } function Manipulation({ swiper }) { Object.assign(swiper, { appendSlide: appendSlide.bind(swiper), prependSlide: prependSlide.bind(swiper), addSlide: addSlide.bind(swiper), removeSlide: removeSlide.bind(swiper), removeAllSlides: removeAllSlides.bind(swiper) }); } function effectInit(params) { const { effect, swiper, on, setTranslate, setTransition, overwriteParams, perspective } = params; on('beforeInit', () => { if (swiper.params.effect !== effect) return; swiper.classNames.push(`${swiper.params.containerModifierClass}${effect}`); if (perspective && perspective()) { swiper.classNames.push(`${swiper.params.containerModifierClass}3d`); } const overwriteParamsResult = overwriteParams ? overwriteParams() : {}; Object.assign(swiper.params, overwriteParamsResult); Object.assign(swiper.originalParams, overwriteParamsResult); }); on('setTranslate', () => { if (swiper.params.effect !== effect) return; setTranslate(); }); on('setTransition', (_s, duration) => { if (swiper.params.effect !== effect) return; setTransition(duration); }); } function effectTarget(effectParams, $slideEl) { if (effectParams.transformEl) { return $slideEl.find(effectParams.transformEl).css({ 'backface-visibility': 'hidden', '-webkit-backface-visibility': 'hidden' }); } return $slideEl; } function effectVirtualTransitionEnd({ swiper, duration, transformEl, allSlides }) { const { slides, activeIndex, $wrapperEl } = swiper; if (swiper.params.virtualTranslate && duration !== 0) { let eventTriggered = false; let $transitionEndTarget; if (allSlides) { $transitionEndTarget = transformEl ? slides.find(transformEl) : slides; } else { $transitionEndTarget = transformEl ? slides.eq(activeIndex).find(transformEl) : slides.eq(activeIndex); } $transitionEndTarget.transitionEnd(() => { if (eventTriggered) return; if (!swiper || swiper.destroyed) return; eventTriggered = true; swiper.animating = false; const triggerEvents = ['webkitTransitionEnd', 'transitionend']; for (let i = 0; i < triggerEvents.length; i += 1) { $wrapperEl.trigger(triggerEvents[i]); } }); } } function EffectFade({ swiper, extendParams, on }) { extendParams({ fadeEffect: { crossFade: false, transformEl: null } }); const setTranslate = () => { const { slides } = swiper; const params = swiper.params.fadeEffect; for (let i = 0; i < slides.length; i += 1) { const $slideEl = swiper.slides.eq(i); const offset = $slideEl[0].swiperSlideOffset; let tx = -offset; if (!swiper.params.virtualTranslate) tx -= swiper.translate; let ty = 0; if (!swiper.isHorizontal()) { ty = tx; tx = 0; } const slideOpacity = swiper.params.fadeEffect.crossFade ? Math.max(1 - Math.abs($slideEl[0].progress), 0) : 1 + Math.min(Math.max($slideEl[0].progress, -1), 0); const $targetEl = effectTarget(params, $slideEl); $targetEl.css({ opacity: slideOpacity }).transform(`translate3d(${tx}px, ${ty}px, 0px)`); } }; const setTransition = duration => { const { transformEl } = swiper.params.fadeEffect; const $transitionElements = transformEl ? swiper.slides.find(transformEl) : swiper.slides; $transitionElements.transition(duration); effectVirtualTransitionEnd({ swiper, duration, transformEl, allSlides: true }); }; effectInit({ effect: 'fade', swiper, on, setTranslate, setTransition, overwriteParams: () => ({ slidesPerView: 1, slidesPerGroup: 1, watchSlidesProgress: true, spaceBetween: 0, virtualTranslate: !swiper.params.cssMode }) }); } function EffectCube({ swiper, extendParams, on }) { extendParams({ cubeEffect: { slideShadows: true, shadow: true, shadowOffset: 20, shadowScale: 0.94 } }); const setTranslate = () => { const { $el, $wrapperEl, slides, width: swiperWidth, height: swiperHeight, rtlTranslate: rtl, size: swiperSize, browser } = swiper; const params = swiper.params.cubeEffect; const isHorizontal = swiper.isHorizontal(); const isVirtual = swiper.virtual && swiper.params.virtual.enabled; let wrapperRotate = 0; let $cubeShadowEl; if (params.shadow) { if (isHorizontal) { $cubeShadowEl = $wrapperEl.find('.swiper-cube-shadow'); if ($cubeShadowEl.length === 0) { $cubeShadowEl = $('
    '); $wrapperEl.append($cubeShadowEl); } $cubeShadowEl.css({ height: `${swiperWidth}px` }); } else { $cubeShadowEl = $el.find('.swiper-cube-shadow'); if ($cubeShadowEl.length === 0) { $cubeShadowEl = $('
    '); $el.append($cubeShadowEl); } } } for (let i = 0; i < slides.length; i += 1) { const $slideEl = slides.eq(i); let slideIndex = i; if (isVirtual) { slideIndex = parseInt($slideEl.attr('data-swiper-slide-index'), 10); } let slideAngle = slideIndex * 90; let round = Math.floor(slideAngle / 360); if (rtl) { slideAngle = -slideAngle; round = Math.floor(-slideAngle / 360); } const progress = Math.max(Math.min($slideEl[0].progress, 1), -1); let tx = 0; let ty = 0; let tz = 0; if (slideIndex % 4 === 0) { tx = -round * 4 * swiperSize; tz = 0; } else if ((slideIndex - 1) % 4 === 0) { tx = 0; tz = -round * 4 * swiperSize; } else if ((slideIndex - 2) % 4 === 0) { tx = swiperSize + round * 4 * swiperSize; tz = swiperSize; } else if ((slideIndex - 3) % 4 === 0) { tx = -swiperSize; tz = 3 * swiperSize + swiperSize * 4 * round; } if (rtl) { tx = -tx; } if (!isHorizontal) { ty = tx; tx = 0; } const transform = `rotateX(${isHorizontal ? 0 : -slideAngle}deg) rotateY(${isHorizontal ? slideAngle : 0}deg) translate3d(${tx}px, ${ty}px, ${tz}px)`; if (progress <= 1 && progress > -1) { wrapperRotate = slideIndex * 90 + progress * 90; if (rtl) wrapperRotate = -slideIndex * 90 - progress * 90; } $slideEl.transform(transform); if (params.slideShadows) { // Set shadows let shadowBefore = isHorizontal ? $slideEl.find('.swiper-slide-shadow-left') : $slideEl.find('.swiper-slide-shadow-top'); let shadowAfter = isHorizontal ? $slideEl.find('.swiper-slide-shadow-right') : $slideEl.find('.swiper-slide-shadow-bottom'); if (shadowBefore.length === 0) { shadowBefore = $(`
    `); $slideEl.append(shadowBefore); } if (shadowAfter.length === 0) { shadowAfter = $(`
    `); $slideEl.append(shadowAfter); } if (shadowBefore.length) shadowBefore[0].style.opacity = Math.max(-progress, 0); if (shadowAfter.length) shadowAfter[0].style.opacity = Math.max(progress, 0); } } $wrapperEl.css({ '-webkit-transform-origin': `50% 50% -${swiperSize / 2}px`, 'transform-origin': `50% 50% -${swiperSize / 2}px` }); if (params.shadow) { if (isHorizontal) { $cubeShadowEl.transform(`translate3d(0px, ${swiperWidth / 2 + params.shadowOffset}px, ${-swiperWidth / 2}px) rotateX(90deg) rotateZ(0deg) scale(${params.shadowScale})`); } else { const shadowAngle = Math.abs(wrapperRotate) - Math.floor(Math.abs(wrapperRotate) / 90) * 90; const multiplier = 1.5 - (Math.sin(shadowAngle * 2 * Math.PI / 360) / 2 + Math.cos(shadowAngle * 2 * Math.PI / 360) / 2); const scale1 = params.shadowScale; const scale2 = params.shadowScale / multiplier; const offset = params.shadowOffset; $cubeShadowEl.transform(`scale3d(${scale1}, 1, ${scale2}) translate3d(0px, ${swiperHeight / 2 + offset}px, ${-swiperHeight / 2 / scale2}px) rotateX(-90deg)`); } } const zFactor = browser.isSafari || browser.isWebView ? -swiperSize / 2 : 0; $wrapperEl.transform(`translate3d(0px,0,${zFactor}px) rotateX(${swiper.isHorizontal() ? 0 : wrapperRotate}deg) rotateY(${swiper.isHorizontal() ? -wrapperRotate : 0}deg)`); }; const setTransition = duration => { const { $el, slides } = swiper; slides.transition(duration).find('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left').transition(duration); if (swiper.params.cubeEffect.shadow && !swiper.isHorizontal()) { $el.find('.swiper-cube-shadow').transition(duration); } }; effectInit({ effect: 'cube', swiper, on, setTranslate, setTransition, perspective: () => true, overwriteParams: () => ({ slidesPerView: 1, slidesPerGroup: 1, watchSlidesProgress: true, resistanceRatio: 0, spaceBetween: 0, centeredSlides: false, virtualTranslate: true }) }); } function createShadow(params, $slideEl, side) { const shadowClass = `swiper-slide-shadow${side ? `-${side}` : ''}`; const $shadowContainer = params.transformEl ? $slideEl.find(params.transformEl) : $slideEl; let $shadowEl = $shadowContainer.children(`.${shadowClass}`); if (!$shadowEl.length) { $shadowEl = $(`
    `); $shadowContainer.append($shadowEl); } return $shadowEl; } function EffectFlip({ swiper, extendParams, on }) { extendParams({ flipEffect: { slideShadows: true, limitRotation: true, transformEl: null } }); const setTranslate = () => { const { slides, rtlTranslate: rtl } = swiper; const params = swiper.params.flipEffect; for (let i = 0; i < slides.length; i += 1) { const $slideEl = slides.eq(i); let progress = $slideEl[0].progress; if (swiper.params.flipEffect.limitRotation) { progress = Math.max(Math.min($slideEl[0].progress, 1), -1); } const offset = $slideEl[0].swiperSlideOffset; const rotate = -180 * progress; let rotateY = rotate; let rotateX = 0; let tx = swiper.params.cssMode ? -offset - swiper.translate : -offset; let ty = 0; if (!swiper.isHorizontal()) { ty = tx; tx = 0; rotateX = -rotateY; rotateY = 0; } else if (rtl) { rotateY = -rotateY; } $slideEl[0].style.zIndex = -Math.abs(Math.round(progress)) + slides.length; if (params.slideShadows) { // Set shadows let shadowBefore = swiper.isHorizontal() ? $slideEl.find('.swiper-slide-shadow-left') : $slideEl.find('.swiper-slide-shadow-top'); let shadowAfter = swiper.isHorizontal() ? $slideEl.find('.swiper-slide-shadow-right') : $slideEl.find('.swiper-slide-shadow-bottom'); if (shadowBefore.length === 0) { shadowBefore = createShadow(params, $slideEl, swiper.isHorizontal() ? 'left' : 'top'); } if (shadowAfter.length === 0) { shadowAfter = createShadow(params, $slideEl, swiper.isHorizontal() ? 'right' : 'bottom'); } if (shadowBefore.length) shadowBefore[0].style.opacity = Math.max(-progress, 0); if (shadowAfter.length) shadowAfter[0].style.opacity = Math.max(progress, 0); } const transform = `translate3d(${tx}px, ${ty}px, 0px) rotateX(${rotateX}deg) rotateY(${rotateY}deg)`; const $targetEl = effectTarget(params, $slideEl); $targetEl.transform(transform); } }; const setTransition = duration => { const { transformEl } = swiper.params.flipEffect; const $transitionElements = transformEl ? swiper.slides.find(transformEl) : swiper.slides; $transitionElements.transition(duration).find('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left').transition(duration); effectVirtualTransitionEnd({ swiper, duration, transformEl }); }; effectInit({ effect: 'flip', swiper, on, setTranslate, setTransition, perspective: () => true, overwriteParams: () => ({ slidesPerView: 1, slidesPerGroup: 1, watchSlidesProgress: true, spaceBetween: 0, virtualTranslate: !swiper.params.cssMode }) }); } function EffectCoverflow({ swiper, extendParams, on }) { extendParams({ coverflowEffect: { rotate: 50, stretch: 0, depth: 100, scale: 1, modifier: 1, slideShadows: true, transformEl: null } }); const setTranslate = () => { const { width: swiperWidth, height: swiperHeight, slides, slidesSizesGrid } = swiper; const params = swiper.params.coverflowEffect; const isHorizontal = swiper.isHorizontal(); const transform = swiper.translate; const center = isHorizontal ? -transform + swiperWidth / 2 : -transform + swiperHeight / 2; const rotate = isHorizontal ? params.rotate : -params.rotate; const translate = params.depth; // Each slide offset from center for (let i = 0, length = slides.length; i < length; i += 1) { const $slideEl = slides.eq(i); const slideSize = slidesSizesGrid[i]; const slideOffset = $slideEl[0].swiperSlideOffset; const offsetMultiplier = (center - slideOffset - slideSize / 2) / slideSize * params.modifier; let rotateY = isHorizontal ? rotate * offsetMultiplier : 0; let rotateX = isHorizontal ? 0 : rotate * offsetMultiplier; // var rotateZ = 0 let translateZ = -translate * Math.abs(offsetMultiplier); let stretch = params.stretch; // Allow percentage to make a relative stretch for responsive sliders if (typeof stretch === 'string' && stretch.indexOf('%') !== -1) { stretch = parseFloat(params.stretch) / 100 * slideSize; } let translateY = isHorizontal ? 0 : stretch * offsetMultiplier; let translateX = isHorizontal ? stretch * offsetMultiplier : 0; let scale = 1 - (1 - params.scale) * Math.abs(offsetMultiplier); // Fix for ultra small values if (Math.abs(translateX) < 0.001) translateX = 0; if (Math.abs(translateY) < 0.001) translateY = 0; if (Math.abs(translateZ) < 0.001) translateZ = 0; if (Math.abs(rotateY) < 0.001) rotateY = 0; if (Math.abs(rotateX) < 0.001) rotateX = 0; if (Math.abs(scale) < 0.001) scale = 0; const slideTransform = `translate3d(${translateX}px,${translateY}px,${translateZ}px) rotateX(${rotateX}deg) rotateY(${rotateY}deg) scale(${scale})`; const $targetEl = effectTarget(params, $slideEl); $targetEl.transform(slideTransform); $slideEl[0].style.zIndex = -Math.abs(Math.round(offsetMultiplier)) + 1; if (params.slideShadows) { // Set shadows let $shadowBeforeEl = isHorizontal ? $slideEl.find('.swiper-slide-shadow-left') : $slideEl.find('.swiper-slide-shadow-top'); let $shadowAfterEl = isHorizontal ? $slideEl.find('.swiper-slide-shadow-right') : $slideEl.find('.swiper-slide-shadow-bottom'); if ($shadowBeforeEl.length === 0) { $shadowBeforeEl = createShadow(params, $slideEl, isHorizontal ? 'left' : 'top'); } if ($shadowAfterEl.length === 0) { $shadowAfterEl = createShadow(params, $slideEl, isHorizontal ? 'right' : 'bottom'); } if ($shadowBeforeEl.length) $shadowBeforeEl[0].style.opacity = offsetMultiplier > 0 ? offsetMultiplier : 0; if ($shadowAfterEl.length) $shadowAfterEl[0].style.opacity = -offsetMultiplier > 0 ? -offsetMultiplier : 0; } } }; const setTransition = duration => { const { transformEl } = swiper.params.coverflowEffect; const $transitionElements = transformEl ? swiper.slides.find(transformEl) : swiper.slides; $transitionElements.transition(duration).find('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left').transition(duration); }; effectInit({ effect: 'coverflow', swiper, on, setTranslate, setTransition, perspective: () => true, overwriteParams: () => ({ watchSlidesProgress: true }) }); } function EffectCreative({ swiper, extendParams, on }) { extendParams({ creativeEffect: { transformEl: null, limitProgress: 1, shadowPerProgress: false, progressMultiplier: 1, perspective: true, prev: { translate: [0, 0, 0], rotate: [0, 0, 0], opacity: 1, scale: 1 }, next: { translate: [0, 0, 0], rotate: [0, 0, 0], opacity: 1, scale: 1 } } }); const getTranslateValue = value => { if (typeof value === 'string') return value; return `${value}px`; }; const setTranslate = () => { const { slides } = swiper; const params = swiper.params.creativeEffect; const { progressMultiplier: multiplier } = params; for (let i = 0; i < slides.length; i += 1) { const $slideEl = slides.eq(i); const slideProgress = $slideEl[0].progress; const progress = Math.min(Math.max($slideEl[0].progress, -params.limitProgress), params.limitProgress); const offset = $slideEl[0].swiperSlideOffset; const t = [swiper.params.cssMode ? -offset - swiper.translate : -offset, 0, 0]; const r = [0, 0, 0]; let custom = false; if (!swiper.isHorizontal()) { t[1] = t[0]; t[0] = 0; } let data = { translate: [0, 0, 0], rotate: [0, 0, 0], scale: 1, opacity: 1 }; if (progress < 0) { data = params.next; custom = true; } else if (progress > 0) { data = params.prev; custom = true; } // set translate t.forEach((value, index) => { t[index] = `calc(${value}px + (${getTranslateValue(data.translate[index])} * ${Math.abs(progress * multiplier)}))`; }); // set rotates r.forEach((value, index) => { r[index] = data.rotate[index] * Math.abs(progress * multiplier); }); $slideEl[0].style.zIndex = -Math.abs(Math.round(slideProgress)) + slides.length; const translateString = t.join(', '); const rotateString = `rotateX(${r[0]}deg) rotateY(${r[1]}deg) rotateZ(${r[2]}deg)`; const scaleString = progress < 0 ? `scale(${1 + (1 - data.scale) * progress * multiplier})` : `scale(${1 - (1 - data.scale) * progress * multiplier})`; const opacityString = progress < 0 ? 1 + (1 - data.opacity) * progress * multiplier : 1 - (1 - data.opacity) * progress * multiplier; const transform = `translate3d(${translateString}) ${rotateString} ${scaleString}`; // Set shadows if (custom && data.shadow || !custom) { let $shadowEl = $slideEl.children('.swiper-slide-shadow'); if ($shadowEl.length === 0 && data.shadow) { $shadowEl = createShadow(params, $slideEl); } if ($shadowEl.length) { const shadowOpacity = params.shadowPerProgress ? progress * (1 / params.limitProgress) : progress; $shadowEl[0].style.opacity = Math.min(Math.max(Math.abs(shadowOpacity), 0), 1); } } const $targetEl = effectTarget(params, $slideEl); $targetEl.transform(transform).css({ opacity: opacityString }); if (data.origin) { $targetEl.css('transform-origin', data.origin); } } }; const setTransition = duration => { const { transformEl } = swiper.params.creativeEffect; const $transitionElements = transformEl ? swiper.slides.find(transformEl) : swiper.slides; $transitionElements.transition(duration).find('.swiper-slide-shadow').transition(duration); effectVirtualTransitionEnd({ swiper, duration, transformEl }); }; effectInit({ effect: 'creative', swiper, on, setTranslate, setTransition, perspective: () => swiper.params.creativeEffect.perspective, overwriteParams: () => ({ watchSlidesProgress: true, virtualTranslate: !swiper.params.cssMode }) }); } function EffectCards({ swiper, extendParams, on }) { extendParams({ cardsEffect: { slideShadows: true, transformEl: null } }); const setTranslate = () => { const { slides, activeIndex } = swiper; const params = swiper.params.cardsEffect; const { startTranslate, isTouched } = swiper.touchEventsData; const currentTranslate = swiper.translate; for (let i = 0; i < slides.length; i += 1) { const $slideEl = slides.eq(i); const slideProgress = $slideEl[0].progress; const progress = Math.min(Math.max(slideProgress, -4), 4); let offset = $slideEl[0].swiperSlideOffset; if (swiper.params.centeredSlides && !swiper.params.cssMode) { swiper.$wrapperEl.transform(`translateX(${swiper.minTranslate()}px)`); } if (swiper.params.centeredSlides && swiper.params.cssMode) { offset -= slides[0].swiperSlideOffset; } let tX = swiper.params.cssMode ? -offset - swiper.translate : -offset; let tY = 0; const tZ = -100 * Math.abs(progress); let scale = 1; let rotate = -2 * progress; let tXAdd = 8 - Math.abs(progress) * 0.75; const isSwipeToNext = (i === activeIndex || i === activeIndex - 1) && progress > 0 && progress < 1 && (isTouched || swiper.params.cssMode) && currentTranslate < startTranslate; const isSwipeToPrev = (i === activeIndex || i === activeIndex + 1) && progress < 0 && progress > -1 && (isTouched || swiper.params.cssMode) && currentTranslate > startTranslate; if (isSwipeToNext || isSwipeToPrev) { const subProgress = (1 - Math.abs((Math.abs(progress) - 0.5) / 0.5)) ** 0.5; rotate += -28 * progress * subProgress; scale += -0.5 * subProgress; tXAdd += 96 * subProgress; tY = `${-25 * subProgress * Math.abs(progress)}%`; } if (progress < 0) { // next tX = `calc(${tX}px + (${tXAdd * Math.abs(progress)}%))`; } else if (progress > 0) { // prev tX = `calc(${tX}px + (-${tXAdd * Math.abs(progress)}%))`; } else { tX = `${tX}px`; } if (!swiper.isHorizontal()) { const prevY = tY; tY = tX; tX = prevY; } const scaleString = progress < 0 ? `${1 + (1 - scale) * progress}` : `${1 - (1 - scale) * progress}`; const transform = ` translate3d(${tX}, ${tY}, ${tZ}px) rotateZ(${rotate}deg) scale(${scaleString}) `; if (params.slideShadows) { // Set shadows let $shadowEl = $slideEl.find('.swiper-slide-shadow'); if ($shadowEl.length === 0) { $shadowEl = createShadow(params, $slideEl); } if ($shadowEl.length) $shadowEl[0].style.opacity = Math.min(Math.max((Math.abs(progress) - 0.5) / 0.5, 0), 1); } $slideEl[0].style.zIndex = -Math.abs(Math.round(slideProgress)) + slides.length; const $targetEl = effectTarget(params, $slideEl); $targetEl.transform(transform); } }; const setTransition = duration => { const { transformEl } = swiper.params.cardsEffect; const $transitionElements = transformEl ? swiper.slides.find(transformEl) : swiper.slides; $transitionElements.transition(duration).find('.swiper-slide-shadow').transition(duration); effectVirtualTransitionEnd({ swiper, duration, transformEl }); }; effectInit({ effect: 'cards', swiper, on, setTranslate, setTransition, perspective: () => true, overwriteParams: () => ({ watchSlidesProgress: true, virtualTranslate: !swiper.params.cssMode }) }); } // Swiper Class const modules = [Virtual, Keyboard, Mousewheel, Navigation, Pagination, Scrollbar, Parallax, Zoom, Lazy, Controller, A11y, History, HashNavigation, Autoplay, Thumb, freeMode, Grid, Manipulation, EffectFade, EffectCube, EffectFlip, EffectCoverflow, EffectCreative, EffectCards]; Swiper.use(modules); return Swiper; }))); //# sourceMappingURL=../js/jQuery-plugins/swiper/swiper-bundle.js.map /* Chosen v1.6.2 | (c) 2011-2016 by Harvest | MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md */ (function(){var a,AbstractChosen,Chosen,SelectParser,b,c={}.hasOwnProperty,d=function(a,b){function d(){this.constructor=a}for(var e in b)c.call(b,e)&&(a[e]=b[e]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};SelectParser=function(){function SelectParser(){this.options_index=0,this.parsed=[]}return SelectParser.prototype.add_node=function(a){return"OPTGROUP"===a.nodeName.toUpperCase()?this.add_group(a):this.add_option(a)},SelectParser.prototype.add_group=function(a){var b,c,d,e,f,g;for(b=this.parsed.length,this.parsed.push({array_index:b,group:!0,label:this.escapeExpression(a.label),title:a.title?a.title:void 0,children:0,disabled:a.disabled,classes:a.className}),f=a.childNodes,g=[],d=0,e=f.length;e>d;d++)c=f[d],g.push(this.add_option(c,b,a.disabled));return g},SelectParser.prototype.add_option=function(a,b,c){return"OPTION"===a.nodeName.toUpperCase()?(""!==a.text?(null!=b&&(this.parsed[b].children+=1),this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,value:a.value,text:a.text,html:a.innerHTML,title:a.title?a.title:void 0,selected:a.selected,disabled:c===!0?c:a.disabled,group_array_index:b,group_label:null!=b?this.parsed[b].label:null,classes:a.className,style:a.style.cssText})):this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,empty:!0}),this.options_index+=1):void 0},SelectParser.prototype.escapeExpression=function(a){var b,c;return null==a||a===!1?"":/[\&\<\>\"\'\`]/.test(a)?(b={"<":"<",">":">",'"':""","'":"'","`":"`"},c=/&(?!\w+;)|[\<\>\"\'\`]/g,a.replace(c,function(a){return b[a]||"&"})):a},SelectParser}(),SelectParser.select_to_array=function(a){var b,c,d,e,f;for(c=new SelectParser,f=a.childNodes,d=0,e=f.length;e>d;d++)b=f[d],c.add_node(b);return c.parsed},AbstractChosen=function(){function AbstractChosen(a,b){this.form_field=a,this.options=null!=b?b:{},AbstractChosen.browser_is_supported()&&(this.is_multiple=this.form_field.multiple,this.set_default_text(),this.set_default_values(),this.setup(),this.set_up_html(),this.register_observers(),this.on_ready())}return AbstractChosen.prototype.set_default_values=function(){var a=this;return this.click_test_action=function(b){return a.test_active_click(b)},this.activate_action=function(b){return a.activate_field(b)},this.active_field=!1,this.mouse_on_container=!1,this.results_showing=!1,this.result_highlighted=null,this.allow_single_deselect=null!=this.options.allow_single_deselect&&null!=this.form_field.options[0]&&""===this.form_field.options[0].text?this.options.allow_single_deselect:!1,this.disable_search_threshold=this.options.disable_search_threshold||0,this.disable_search=this.options.disable_search||!1,this.enable_split_word_search=null!=this.options.enable_split_word_search?this.options.enable_split_word_search:!0,this.group_search=null!=this.options.group_search?this.options.group_search:!0,this.search_contains=this.options.search_contains||!1,this.single_backstroke_delete=null!=this.options.single_backstroke_delete?this.options.single_backstroke_delete:!0,this.max_selected_options=this.options.max_selected_options||1/0,this.inherit_select_classes=this.options.inherit_select_classes||!1,this.display_selected_options=null!=this.options.display_selected_options?this.options.display_selected_options:!0,this.display_disabled_options=null!=this.options.display_disabled_options?this.options.display_disabled_options:!0,this.include_group_label_in_selected=this.options.include_group_label_in_selected||!1,this.max_shown_results=this.options.max_shown_results||Number.POSITIVE_INFINITY,this.case_sensitive_search=this.options.case_sensitive_search||!1},AbstractChosen.prototype.set_default_text=function(){return this.form_field.getAttribute("data-placeholder")?this.default_text=this.form_field.getAttribute("data-placeholder"):this.is_multiple?this.default_text=this.options.placeholder_text_multiple||this.options.placeholder_text||AbstractChosen.default_multiple_text:this.default_text=this.options.placeholder_text_single||this.options.placeholder_text||AbstractChosen.default_single_text,this.results_none_found=this.form_field.getAttribute("data-no_results_text")||this.options.no_results_text||AbstractChosen.default_no_result_text},AbstractChosen.prototype.choice_label=function(a){return this.include_group_label_in_selected&&null!=a.group_label?""+a.group_label+""+a.html:a.html},AbstractChosen.prototype.mouse_enter=function(){return this.mouse_on_container=!0},AbstractChosen.prototype.mouse_leave=function(){return this.mouse_on_container=!1},AbstractChosen.prototype.input_focus=function(a){var b=this;if(this.is_multiple){if(!this.active_field)return setTimeout(function(){return b.container_mousedown()},50)}else if(!this.active_field)return this.activate_field()},AbstractChosen.prototype.input_blur=function(a){var b=this;return this.mouse_on_container?void 0:(this.active_field=!1,setTimeout(function(){return b.blur_test()},100))},AbstractChosen.prototype.results_option_build=function(a){var b,c,d,e,f,g,h;for(b="",e=0,h=this.results_data,f=0,g=h.length;g>f&&(c=h[f],d="",d=c.group?this.result_add_group(c):this.result_add_option(c),""!==d&&(e++,b+=d),(null!=a?a.first:void 0)&&(c.selected&&this.is_multiple?this.choice_build(c):c.selected&&!this.is_multiple&&this.single_set_selected_text(this.choice_label(c))),!(e>=this.max_shown_results));f++);return b},AbstractChosen.prototype.result_add_option=function(a){var b,c;return a.search_match&&this.include_option_in_results(a)?(b=[],a.disabled||a.selected&&this.is_multiple||b.push("active-result"),!a.disabled||a.selected&&this.is_multiple||b.push("disabled-result"),a.selected&&b.push("result-selected"),null!=a.group_array_index&&b.push("group-option"),""!==a.classes&&b.push(a.classes),c=document.createElement("li"),c.className=b.join(" "),c.style.cssText=a.style,c.setAttribute("data-option-array-index",a.array_index),c.innerHTML=a.search_text,a.title&&(c.title=a.title),this.outerHTML(c)):""},AbstractChosen.prototype.result_add_group=function(a){var b,c;return(a.search_match||a.group_match)&&a.active_options>0?(b=[],b.push("group-result"),a.classes&&b.push(a.classes),c=document.createElement("li"),c.className=b.join(" "),c.innerHTML=a.search_text,a.title&&(c.title=a.title),this.outerHTML(c)):""},AbstractChosen.prototype.results_update_field=function(){return this.set_default_text(),this.is_multiple||this.results_reset_cleanup(),this.result_clear_highlight(),this.results_build(),this.results_showing?this.winnow_results():void 0},AbstractChosen.prototype.reset_single_select_options=function(){var a,b,c,d,e;for(d=this.results_data,e=[],b=0,c=d.length;c>b;b++)a=d[b],a.selected?e.push(a.selected=!1):e.push(void 0);return e},AbstractChosen.prototype.results_toggle=function(){return this.results_showing?this.results_hide():this.results_show()},AbstractChosen.prototype.results_search=function(a){return this.results_showing?this.winnow_results():this.results_show()},AbstractChosen.prototype.winnow_results=function(){var a,b,c,d,e,f,g,h,i,j,k,l;for(this.no_results_clear(),d=0,f=this.get_search_text(),a=f.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),i=new RegExp(a,"i"),c=this.get_search_regex(a),l=this.results_data,j=0,k=l.length;k>j;j++)b=l[j],b.search_match=!1,e=null,this.include_option_in_results(b)&&(b.group&&(b.group_match=!1,b.active_options=0),null!=b.group_array_index&&this.results_data[b.group_array_index]&&(e=this.results_data[b.group_array_index],0===e.active_options&&e.search_match&&(d+=1),e.active_options+=1),b.search_text=b.group?b.label:b.html,(!b.group||this.group_search)&&(b.search_match=this.search_string_match(b.search_text,c),b.search_match&&!b.group&&(d+=1),b.search_match?(f.length&&(g=b.search_text.search(i),h=b.search_text.substr(0,g+f.length)+"
    "+b.search_text.substr(g+f.length),b.search_text=h.substr(0,g)+""+h.substr(g)),null!=e&&(e.group_match=!0)):null!=b.group_array_index&&this.results_data[b.group_array_index].search_match&&(b.search_match=!0)));return this.result_clear_highlight(),1>d&&f.length?(this.update_results_content(""),this.no_results(f)):(this.update_results_content(this.results_option_build()),this.winnow_results_set_highlight())},AbstractChosen.prototype.get_search_regex=function(a){var b,c;return b=this.search_contains?"":"^",c=this.case_sensitive_search?"":"i",new RegExp(b+a,c)},AbstractChosen.prototype.search_string_match=function(a,b){var c,d,e,f;if(b.test(a))return!0;if(this.enable_split_word_search&&(a.indexOf(" ")>=0||0===a.indexOf("["))&&(d=a.replace(/\[|\]/g,"").split(" "),d.length))for(e=0,f=d.length;f>e;e++)if(c=d[e],b.test(c))return!0},AbstractChosen.prototype.choices_count=function(){var a,b,c,d;if(null!=this.selected_option_count)return this.selected_option_count;for(this.selected_option_count=0,d=this.form_field.options,b=0,c=d.length;c>b;b++)a=d[b],a.selected&&(this.selected_option_count+=1);return this.selected_option_count},AbstractChosen.prototype.choices_click=function(a){return a.preventDefault(),this.results_showing||this.is_disabled?void 0:this.results_show()},AbstractChosen.prototype.keyup_checker=function(a){var b,c;switch(b=null!=(c=a.which)?c:a.keyCode,this.search_field_scale(),b){case 8:if(this.is_multiple&&this.backstroke_length<1&&this.choices_count()>0)return this.keydown_backstroke();if(!this.pending_backstroke)return this.result_clear_highlight(),this.results_search();break;case 13:if(a.preventDefault(),this.results_showing)return this.result_select(a);break;case 27:return this.results_showing&&this.results_hide(),!0;case 9:case 38:case 40:case 16:case 91:case 17:case 18:break;default:return this.results_search()}},AbstractChosen.prototype.clipboard_event_checker=function(a){var b=this;return setTimeout(function(){return b.results_search()},50)},AbstractChosen.prototype.container_width=function(){return null!=this.options.width?this.options.width:""+this.form_field.offsetWidth+"px"},AbstractChosen.prototype.include_option_in_results=function(a){return this.is_multiple&&!this.display_selected_options&&a.selected?!1:!this.display_disabled_options&&a.disabled?!1:a.empty?!1:!0},AbstractChosen.prototype.search_results_touchstart=function(a){return this.touch_started=!0,this.search_results_mouseover(a)},AbstractChosen.prototype.search_results_touchmove=function(a){return this.touch_started=!1,this.search_results_mouseout(a)},AbstractChosen.prototype.search_results_touchend=function(a){return this.touch_started?this.search_results_mouseup(a):void 0},AbstractChosen.prototype.outerHTML=function(a){var b;return a.outerHTML?a.outerHTML:(b=document.createElement("div"),b.appendChild(a),b.innerHTML)},AbstractChosen.browser_is_supported=function(){return"Microsoft Internet Explorer"===window.navigator.appName?document.documentMode>=8:/iP(od|hone)/i.test(window.navigator.userAgent)||/IEMobile/i.test(window.navigator.userAgent)||/Windows Phone/i.test(window.navigator.userAgent)||/BlackBerry/i.test(window.navigator.userAgent)||/BB10/i.test(window.navigator.userAgent)||/Android.*Mobile/i.test(window.navigator.userAgent)?!1:!0},AbstractChosen.default_multiple_text="Select Some Options",AbstractChosen.default_single_text="Select an Option",AbstractChosen.default_no_result_text="No results match",AbstractChosen}(),a=jQuery,a.fn.extend({chosen:function(b){return AbstractChosen.browser_is_supported()?this.each(function(c){var d,e;return d=a(this),e=d.data("chosen"),"destroy"===b?void(e instanceof Chosen&&e.destroy()):void(e instanceof Chosen||d.data("chosen",new Chosen(this,b)))}):this}}),Chosen=function(c){function Chosen(){return b=Chosen.__super__.constructor.apply(this,arguments)}return d(Chosen,c),Chosen.prototype.setup=function(){return this.form_field_jq=a(this.form_field),this.current_selectedIndex=this.form_field.selectedIndex,this.is_rtl=this.form_field_jq.hasClass("chosen-rtl")},Chosen.prototype.set_up_html=function(){var b,c;return b=["chosen-container"],b.push("chosen-container-"+(this.is_multiple?"multi":"single")),this.inherit_select_classes&&this.form_field.className&&b.push(this.form_field.className),this.is_rtl&&b.push("chosen-rtl"),c={"class":b.join(" "),style:"width: "+this.container_width()+";",title:this.form_field.title},this.form_field.id.length&&(c.id=this.form_field.id.replace(/[^\w]/g,"_")+"_chosen"),this.container=a("
    ",c),this.is_multiple?this.container.html('
      '):this.container.html('
      '+this.default_text+'
        '),this.form_field_jq.hide().after(this.container),this.dropdown=this.container.find("div.chosen-drop").first(),this.search_field=this.container.find("input").first(),this.search_results=this.container.find("ul.chosen-results").first(),this.search_field_scale(),this.search_no_results=this.container.find("li.no-results").first(),this.is_multiple?(this.search_choices=this.container.find("ul.chosen-choices").first(),this.search_container=this.container.find("li.search-field").first()):(this.search_container=this.container.find("div.chosen-search").first(),this.selected_item=this.container.find(".chosen-single").first()),this.results_build(),this.set_tab_index(),this.set_label_behavior()},Chosen.prototype.on_ready=function(){return this.form_field_jq.trigger("chosen:ready",{chosen:this})},Chosen.prototype.register_observers=function(){var a=this;return this.container.bind("touchstart.chosen",function(b){return a.container_mousedown(b),b.preventDefault()}),this.container.bind("touchend.chosen",function(b){return a.container_mouseup(b),b.preventDefault()}),this.container.bind("mousedown.chosen",function(b){a.container_mousedown(b)}),this.container.bind("mouseup.chosen",function(b){a.container_mouseup(b)}),this.container.bind("mouseenter.chosen",function(b){a.mouse_enter(b)}),this.container.bind("mouseleave.chosen",function(b){a.mouse_leave(b)}),this.search_results.bind("mouseup.chosen",function(b){a.search_results_mouseup(b)}),this.search_results.bind("mouseover.chosen",function(b){a.search_results_mouseover(b)}),this.search_results.bind("mouseout.chosen",function(b){a.search_results_mouseout(b)}),this.search_results.bind("mousewheel.chosen DOMMouseScroll.chosen",function(b){a.search_results_mousewheel(b)}),this.search_results.bind("touchstart.chosen",function(b){a.search_results_touchstart(b)}),this.search_results.bind("touchmove.chosen",function(b){a.search_results_touchmove(b)}),this.search_results.bind("touchend.chosen",function(b){a.search_results_touchend(b)}),this.form_field_jq.bind("chosen:updated.chosen",function(b){a.results_update_field(b)}),this.form_field_jq.bind("chosen:activate.chosen",function(b){a.activate_field(b)}),this.form_field_jq.bind("chosen:open.chosen",function(b){a.container_mousedown(b)}),this.form_field_jq.bind("chosen:close.chosen",function(b){a.input_blur(b)}),this.search_field.bind("blur.chosen",function(b){a.input_blur(b)}),this.search_field.bind("keyup.chosen",function(b){a.keyup_checker(b)}),this.search_field.bind("keydown.chosen",function(b){a.keydown_checker(b)}),this.search_field.bind("focus.chosen",function(b){a.input_focus(b)}),this.search_field.bind("cut.chosen",function(b){a.clipboard_event_checker(b)}),this.search_field.bind("paste.chosen",function(b){a.clipboard_event_checker(b)}),this.is_multiple?this.search_choices.bind("click.chosen",function(b){a.choices_click(b)}):this.container.bind("click.chosen",function(a){a.preventDefault()})},Chosen.prototype.destroy=function(){return a(this.container[0].ownerDocument).unbind("click.chosen",this.click_test_action),this.search_field[0].tabIndex&&(this.form_field_jq[0].tabIndex=this.search_field[0].tabIndex),this.container.remove(),this.form_field_jq.removeData("chosen"),this.form_field_jq.show()},Chosen.prototype.search_field_disabled=function(){return this.is_disabled=this.form_field_jq[0].disabled,this.is_disabled?(this.container.addClass("chosen-disabled"),this.search_field[0].disabled=!0,this.is_multiple||this.selected_item.unbind("focus.chosen",this.activate_action),this.close_field()):(this.container.removeClass("chosen-disabled"),this.search_field[0].disabled=!1,this.is_multiple?void 0:this.selected_item.bind("focus.chosen",this.activate_action))},Chosen.prototype.container_mousedown=function(b){return this.is_disabled||(b&&"mousedown"===b.type&&!this.results_showing&&b.preventDefault(),null!=b&&a(b.target).hasClass("search-choice-close"))?void 0:(this.active_field?this.is_multiple||!b||a(b.target)[0]!==this.selected_item[0]&&!a(b.target).parents("a.chosen-single").length||(b.preventDefault(),this.results_toggle()):(this.is_multiple&&this.search_field.val(""),a(this.container[0].ownerDocument).bind("click.chosen",this.click_test_action),this.results_show()),this.activate_field())},Chosen.prototype.container_mouseup=function(a){return"ABBR"!==a.target.nodeName||this.is_disabled?void 0:this.results_reset(a)},Chosen.prototype.search_results_mousewheel=function(a){var b;return a.originalEvent&&(b=a.originalEvent.deltaY||-a.originalEvent.wheelDelta||a.originalEvent.detail),null!=b?(a.preventDefault(),"DOMMouseScroll"===a.type&&(b=40*b),this.search_results.scrollTop(b+this.search_results.scrollTop())):void 0},Chosen.prototype.blur_test=function(a){return!this.active_field&&this.container.hasClass("chosen-container-active")?this.close_field():void 0},Chosen.prototype.close_field=function(){return a(this.container[0].ownerDocument).unbind("click.chosen",this.click_test_action),this.active_field=!1,this.results_hide(),this.container.removeClass("chosen-container-active"),this.clear_backstroke(),this.show_search_field_default(),this.search_field_scale()},Chosen.prototype.activate_field=function(){return this.container.addClass("chosen-container-active"),this.active_field=!0,this.search_field.val(this.search_field.val()),this.search_field.focus()},Chosen.prototype.test_active_click=function(b){var c;return c=a(b.target).closest(".chosen-container"),c.length&&this.container[0]===c[0]?this.active_field=!0:this.close_field()},Chosen.prototype.results_build=function(){return this.parsing=!0,this.selected_option_count=null,this.results_data=SelectParser.select_to_array(this.form_field),this.is_multiple?this.search_choices.find("li.search-choice").remove():this.is_multiple||(this.single_set_selected_text(),this.disable_search||this.form_field.options.length<=this.disable_search_threshold?(this.search_field[0].readOnly=!0,this.container.addClass("chosen-container-single-nosearch")):(this.search_field[0].readOnly=!1,this.container.removeClass("chosen-container-single-nosearch"))),this.update_results_content(this.results_option_build({first:!0})),this.search_field_disabled(),this.show_search_field_default(),this.search_field_scale(),this.parsing=!1},Chosen.prototype.result_do_highlight=function(a){var b,c,d,e,f;if(a.length){if(this.result_clear_highlight(),this.result_highlight=a,this.result_highlight.addClass("highlighted"),d=parseInt(this.search_results.css("maxHeight"),10),f=this.search_results.scrollTop(),e=d+f,c=this.result_highlight.position().top+this.search_results.scrollTop(),b=c+this.result_highlight.outerHeight(),b>=e)return this.search_results.scrollTop(b-d>0?b-d:0);if(f>c)return this.search_results.scrollTop(c)}},Chosen.prototype.result_clear_highlight=function(){return this.result_highlight&&this.result_highlight.removeClass("highlighted"),this.result_highlight=null},Chosen.prototype.results_show=function(){return this.is_multiple&&this.max_selected_options<=this.choices_count()?(this.form_field_jq.trigger("chosen:maxselected",{chosen:this}),!1):(this.container.addClass("chosen-with-drop"),this.results_showing=!0,this.search_field.focus(),this.search_field.val(this.search_field.val()),this.winnow_results(),this.form_field_jq.trigger("chosen:showing_dropdown",{chosen:this}))},Chosen.prototype.update_results_content=function(a){return this.search_results.html(a)},Chosen.prototype.results_hide=function(){return this.results_showing&&(this.result_clear_highlight(),this.container.removeClass("chosen-with-drop"),this.form_field_jq.trigger("chosen:hiding_dropdown",{chosen:this})),this.results_showing=!1},Chosen.prototype.set_tab_index=function(a){var b;return this.form_field.tabIndex?(b=this.form_field.tabIndex,this.form_field.tabIndex=-1,this.search_field[0].tabIndex=b):void 0},Chosen.prototype.set_label_behavior=function(){var b=this;return this.form_field_label=this.form_field_jq.parents("label"),!this.form_field_label.length&&this.form_field.id.length&&(this.form_field_label=a("label[for='"+this.form_field.id+"']")),this.form_field_label.length>0?this.form_field_label.bind("click.chosen",function(a){return b.is_multiple?b.container_mousedown(a):b.activate_field()}):void 0},Chosen.prototype.show_search_field_default=function(){return this.is_multiple&&this.choices_count()<1&&!this.active_field?(this.search_field.val(this.default_text),this.search_field.addClass("default")):(this.search_field.val(""),this.search_field.removeClass("default"))},Chosen.prototype.search_results_mouseup=function(b){var c;return c=a(b.target).hasClass("active-result")?a(b.target):a(b.target).parents(".active-result").first(),c.length?(this.result_highlight=c,this.result_select(b),this.search_field.focus()):void 0},Chosen.prototype.search_results_mouseover=function(b){var c;return c=a(b.target).hasClass("active-result")?a(b.target):a(b.target).parents(".active-result").first(),c?this.result_do_highlight(c):void 0},Chosen.prototype.search_results_mouseout=function(b){return a(b.target).hasClass("active-result")?this.result_clear_highlight():void 0},Chosen.prototype.choice_build=function(b){var c,d,e=this;return c=a("
      • ",{"class":"search-choice"}).html(""+this.choice_label(b)+""),b.disabled?c.addClass("search-choice-disabled"):(d=a("",{"class":"search-choice-close","data-option-array-index":b.array_index}),d.bind("click.chosen",function(a){return e.choice_destroy_link_click(a)}),c.append(d)),this.search_container.before(c)},Chosen.prototype.choice_destroy_link_click=function(b){return b.preventDefault(),b.stopPropagation(),this.is_disabled?void 0:this.choice_destroy(a(b.target))},Chosen.prototype.choice_destroy=function(a){return this.result_deselect(a[0].getAttribute("data-option-array-index"))?(this.show_search_field_default(),this.is_multiple&&this.choices_count()>0&&this.search_field.val().length<1&&this.results_hide(),a.parents("li").first().remove(),this.search_field_scale()):void 0},Chosen.prototype.results_reset=function(){return this.reset_single_select_options(),this.form_field.options[0].selected=!0,this.single_set_selected_text(),this.show_search_field_default(),this.results_reset_cleanup(),this.form_field_jq.trigger("change"),this.active_field?this.results_hide():void 0},Chosen.prototype.results_reset_cleanup=function(){return this.current_selectedIndex=this.form_field.selectedIndex,this.selected_item.find("abbr").remove()},Chosen.prototype.result_select=function(a){var b,c;return this.result_highlight?(b=this.result_highlight,this.result_clear_highlight(),this.is_multiple&&this.max_selected_options<=this.choices_count()?(this.form_field_jq.trigger("chosen:maxselected",{chosen:this}),!1):(this.is_multiple?b.removeClass("active-result"):this.reset_single_select_options(),b.addClass("result-selected"),c=this.results_data[b[0].getAttribute("data-option-array-index")],c.selected=!0,this.form_field.options[c.options_index].selected=!0,this.selected_option_count=null,this.is_multiple?this.choice_build(c):this.single_set_selected_text(this.choice_label(c)),(a.metaKey||a.ctrlKey)&&this.is_multiple||this.results_hide(),this.show_search_field_default(),(this.is_multiple||this.form_field.selectedIndex!==this.current_selectedIndex)&&this.form_field_jq.trigger("change",{selected:this.form_field.options[c.options_index].value}),this.current_selectedIndex=this.form_field.selectedIndex,a.preventDefault(),this.search_field_scale())):void 0},Chosen.prototype.single_set_selected_text=function(a){return null==a&&(a=this.default_text),a===this.default_text?this.selected_item.addClass("chosen-default"):(this.single_deselect_control_build(),this.selected_item.removeClass("chosen-default")),this.selected_item.find("span").html(a)},Chosen.prototype.result_deselect=function(a){var b;return b=this.results_data[a],this.form_field.options[b.options_index].disabled?!1:(b.selected=!1,this.form_field.options[b.options_index].selected=!1,this.selected_option_count=null,this.result_clear_highlight(),this.results_showing&&this.winnow_results(),this.form_field_jq.trigger("change",{deselected:this.form_field.options[b.options_index].value}),this.search_field_scale(),!0)},Chosen.prototype.single_deselect_control_build=function(){return this.allow_single_deselect?(this.selected_item.find("abbr").length||this.selected_item.find("span").first().after(''),this.selected_item.addClass("chosen-single-with-deselect")):void 0},Chosen.prototype.get_search_text=function(){return a("
        ").text(a.trim(this.search_field.val())).html()},Chosen.prototype.winnow_results_set_highlight=function(){var a,b;return b=this.is_multiple?[]:this.search_results.find(".result-selected.active-result"),a=b.length?b.first():this.search_results.find(".active-result").first(),null!=a?this.result_do_highlight(a):void 0},Chosen.prototype.no_results=function(b){var c;return c=a('
      • '+this.results_none_found+' ""
      • '),c.find("span").first().html(b),this.search_results.append(c),this.form_field_jq.trigger("chosen:no_results",{chosen:this})},Chosen.prototype.no_results_clear=function(){return this.search_results.find(".no-results").remove()},Chosen.prototype.keydown_arrow=function(){var a;return this.results_showing&&this.result_highlight?(a=this.result_highlight.nextAll("li.active-result").first())?this.result_do_highlight(a):void 0:this.results_show()},Chosen.prototype.keyup_arrow=function(){var a;return this.results_showing||this.is_multiple?this.result_highlight?(a=this.result_highlight.prevAll("li.active-result"),a.length?this.result_do_highlight(a.first()):(this.choices_count()>0&&this.results_hide(),this.result_clear_highlight())):void 0:this.results_show()},Chosen.prototype.keydown_backstroke=function(){var a;return this.pending_backstroke?(this.choice_destroy(this.pending_backstroke.find("a").first()),this.clear_backstroke()):(a=this.search_container.siblings("li.search-choice").last(),a.length&&!a.hasClass("search-choice-disabled")?(this.pending_backstroke=a,this.single_backstroke_delete?this.keydown_backstroke():this.pending_backstroke.addClass("search-choice-focus")):void 0)},Chosen.prototype.clear_backstroke=function(){return this.pending_backstroke&&this.pending_backstroke.removeClass("search-choice-focus"),this.pending_backstroke=null},Chosen.prototype.keydown_checker=function(a){var b,c;switch(b=null!=(c=a.which)?c:a.keyCode,this.search_field_scale(),8!==b&&this.pending_backstroke&&this.clear_backstroke(),b){case 8:this.backstroke_length=this.search_field.val().length;break;case 9:this.results_showing&&!this.is_multiple&&this.result_select(a),this.mouse_on_container=!1;break;case 13:this.results_showing&&a.preventDefault();break;case 32:this.disable_search&&a.preventDefault();break;case 38:a.preventDefault(),this.keyup_arrow();break;case 40:a.preventDefault(),this.keydown_arrow()}},Chosen.prototype.search_field_scale=function(){var b,c,d,e,f,g,h,i,j;if(this.is_multiple){for(d=0,h=0,f="position:absolute; left: -1000px; top: -1000px; display:none;",g=["font-size","font-style","font-weight","font-family","line-height","text-transform","letter-spacing"],i=0,j=g.length;j>i;i++)e=g[i],f+=e+":"+this.search_field.css(e)+";";return b=a("
        ",{style:f}),b.text(this.search_field.val()),a("body").append(b),h=b.width()+25,b.remove(),c=this.container.outerWidth(),h>c-10&&(h=c-10),this.search_field.css({width:h+"px"})}},Chosen}(AbstractChosen)}).call(this); swal.setDefaults({ confirmButtonColor: '#0f1c49' }); $(document).ready(function(){ $().fancybox({ baseClass : 'quick-view-container', infobar : false, buttons : true, thumbs : true, margin : 0, transitionEffect : "slide", transitionDuration : 500, }); $('a.fancy').fancybox({ baseClass : 'quick-view-container', infobar : false, buttons : true, thumbs : true, margin : 0, transitionEffect : "slide", transitionDuration : 500, }); /* Safari Render */ /* is_chrome = navigator.userAgent.indexOf('Chrome') > -1; is_explorer = navigator.userAgent.indexOf('MSIE') > -1; is_firefox = navigator.userAgent.indexOf('Firefox') > -1; is_safari = navigator.userAgent.indexOf("Safari") > -1; is_opera = navigator.userAgent.indexOf("Presto") > -1; is_mac = (navigator.userAgent.indexOf('Mac OS') != -1); is_windows = !is_mac; if (is_chrome && is_safari){ is_safari=false; } if (is_safari || is_windows){ $('body').css('-webkit-text-stroke', '0.5px'); } */ $('input, textarea').placeholder(); $(".youtube_v").click(function() { $.fancybox({ 'padding' : 0, 'autoScale' : false, 'transitionIn' : 'none', 'transitionOut' : 'none', 'title' : this.title, 'width' : 680, 'height' : 495, 'type' : 'iframe', 'href' : this.href.replace(new RegExp('youtu.be', 'i'), 'www.youtube.com/embed').replace(new RegExp('watch\\?v=([a-z0-9\_\-]+)(&|\\?)?(.*)', 'i'), 'embed/$1?version=3&$3') }); return false; }); $('nav#mobile-menu').mmenu({ //extensions : [ 'theme-dark' ], setSelected : false, sectionIndexer: false, counters: true, navbar : { title : "Menü" }, onClick: { close: true }, iconbar : { add : true, size : 40, top : [ '' ], bottom : [ '' ] }, navbars : [ { type : 'tabs', }, { content : [ 'prev', 'breadcrumbs', 'close' ] } ] }, { navbars : { breadcrumbs : { removeFirst : true } }, // configuration offCanvas: { pageNodetype: "div#page-real-content" }, }); /* $("#mobile-menu").mmenu({ "extensions": [ "border-none", "pageshadow", "theme-dark"], //"autoHeight": true, "counters": true, "sectionIndexer": true, "navbar" : { title : "Menü" } }, { // configuration offCanvas: { pageNodetype: "div#page-real-content" } }); */ /* equalheight */ equalheight = function(container){ var currentTallest = 0, currentRowStart = 0, rowDivs = new Array(), $el, topPosition = 0; $(container).each(function() { $el = $(this); $($el).height('auto') topPostion = $el.position().top; if (currentRowStart != topPostion) { for (currentDiv = 0 ; currentDiv < rowDivs.length ; currentDiv++) { rowDivs[currentDiv].height(currentTallest); } rowDivs.length = 0; // empty the array currentRowStart = topPostion; currentTallest = $el.height(); rowDivs.push($el); } else { rowDivs.push($el); currentTallest = (currentTallest < $el.height()) ? ($el.height()) : (currentTallest); } for (currentDiv = 0 ; currentDiv < rowDivs.length ; currentDiv++) { rowDivs[currentDiv].height(currentTallest); } }); } $(window).load(function() { //equalheight('.main article'); }); $(window).resize(function(){ //equalheight('.main article'); }); if ($('#back-to-top').length) { var scrollTrigger = 100, // px backToTop = function () { var scrollTop = $(window).scrollTop(); if (scrollTop > scrollTrigger) { $('#back-to-top').addClass('show'); } else { $('#back-to-top').removeClass('show'); } }; backToTop(); $(window).on('scroll', function () { backToTop(); }); $('#back-to-top').on('click', function (e) { e.preventDefault(); $('html,body').animate({ scrollTop: 0 }, 700); }); } // Data - time picker /* $('.datepicker').datepicker(); $('.datetimepicker').datetimepicker(); $('.timepicker').timepicker(); */ //chosen $(".chosen_select").chosen({disable_search_threshold: 10}); /* //toggle $('.more_description').hide("fast"); $('a.more_info').click(function() { if ($(this).hasClass('current')) { $('.more_description').slideUp(); $(this).removeClass('current'); } else { $('a.more_info').removeClass('current'); $('div.more_description').slideUp(); $(this).addClass('current'); $('#'+$(this).attr("id")+'-description').slideToggle(); } }); */ }); function langalert(lang) { if ( lang == 'en') { sweetAlert("Oops...", "This website is under construction!\nPlease visit later!", "error"); } else if ( lang == 'de') { sweetAlert("Oops...", "An dieser Website wird gerade gebaut.\nBitte schauen Sie später noch einmal vorbei.", "error"); } } function goBack() { window.history.back(); } $(function(){ $('input[type="number"]').bind('keypress', function(e){ var keyCode = (e.which)?e.which:event.keyCode return !(keyCode>31 && (keyCode<48 || keyCode>57)); }); });