1
vendor: 89,501 bytes, lines 2-3
2/*! jQuery v3.6.0 | (c) OpenJS Foundation and other contributors | jquery.org/license */ 3!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<t&&t-1 in e)}S.fn=S.prototype={jquery:f,constructor:S,length:0,toArray:function(){return s.call(this)},get:function(e){return null==e?s.call(this):e<0?this[e+this.length]:this[e]},pushStack:function(e){var t=S.merge(this.constructor(),e);return t.prevObject=this,t},each:function(e){return S.each(this,e)},map:function(n){return this.pushStack(S.map(this,function(e,t){return n.call(e,t,e)}))},slice:function(){return this.pushStack(s.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},even:function(){return this.pushStack(S.grep(this,function(e,t){return(t+1)%2}))},odd:function(){return this.pushStack(S.grep(this,function(e,t){return t%2}))},eq:function(e){var t=this.length,n=+e+(e<0?t:0);return this.pushStack(0<=n&&n<t?[this[n]]:[])},end:function(){return this.prevObject||this.constructor()},push:u,sort:t.sort,splice:t.splice},S.extend=S.fn.extend=function(){var e,t,n,r,i,o,a=arguments[0]||{},s=1,u=arguments.length,l=!1;for("boolean"==typeof a&&(l=a,a=arguments[s]||{},s++),"object"==typeof a||m(a)||(a={}),s===u&&(a=this,s--);s<u;s++)if(null!=(e=arguments[s]))for(t in e)r=e[t],"__proto__"!==t&&a!==r&&(l&&r&&(S.isPlainObject(r)||(i=Array.isArray(r)))?(n=a[t],o=i&&!Array.isArray(n)?[]:i||S.isPlainObject(n)?n:{},i=!1,a[t]=S.extend(l,o,r)):void 0!==r&&(a[t]=r));return a},S.extend({expando:"jQuery"+(f+Math.random()).replace(/\D/g,""),isReady:!0,error:function(e){throw new Error(e)},noop:function(){},isPlainObject:function(e){var t,n;return!(!e||"[object Object]"!==o.call(e))&&(!(t=r(e))||"function"==typeof(n=v.call(t,"constructor")&&t.constructor)&&a.call(n)===l)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},globalEval:function(e,t,n){b(e,{nonce:t&&t.nonce},n)},each:function(e,t){var n,r=0;if(p(e)){for(n=e.length;r<n;r++)if(!1===t.call(e[r],r,e[r]))break}else for(r in e)if(!1===t.call(e[r],r,e[r]))break;return e},makeArray:function(e,t){var n=t||[];return null!=e&&(p(Object(e))?S.merge(n,"string"==typeof e?[e]:e):u.call(n,e)),n},inArray:function(e,t,n){return null==t?-1:i.call(t,e,n)},merge:function(e,t){for(var n=+t.length,r=0,i=e.length;r<n;r++)e[i++]=t[r];return e.length=i,e},grep:function(e,t,n){for(var r=[],i=0,o=e.length,a=!n;i<o;i++)!t(e[i],i)!==a&&r.push(e[i]);return r},map:function(e,t,n){var r,i,o=0,a=[];if(p(e))for(r=e.length;o<r;o++)null!=(i=t(e[o],o,n))&&a.push(i);else for(o in e)null!=(i=t(e[o],o,n))&&a.push(i);return g(a)},guid:1,support:y}),"function"==typeof Symbol&&(S.fn[Symbol.iterator]=t[Symbol.iterator]),S.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(e,t){n["[object "+t+"]"]=t.toLowerCase()});var d=function(n){var e,d,b,o,i,h,f,g,w,u,l,T,C,a,E,v,s,c,y,S="sizzle"+1*new Date,p=n.document,k=0,r=0,m=ue(),x=ue(),A=ue(),N=ue(),j=function(e,t){return e===t&&(l=!0),0},D={}.hasOwnProperty,t=[],q=t.pop,L=t.push,H=t.push,O=t.slice,P=function(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1},R="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",M="[\\x20\\t\\r\\n\\f]",I="(?:\\\\[\\da-fA-F]{1,6}"+M+"?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+",W="\\["+M+"*("+I+")(?:"+M+"*([*^$|!~]?=)"+M+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+I+"))|)"+M+"*\\]",F=":("+I+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+W+")*)|.*)\\)|)",B=new RegExp(M+"+","g"),$=new RegExp("^"+M+"+|((?:^|[^\\\\])(?:\\\\.)*)"+M+"+$","g"),_=new RegExp("^"+M+"*,"+M+"*"),z=new RegExp("^"+M+"*([>+~]|"+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="<a id='"+S+"'></a><select id='"+S+"-\r\\' msallowcapture=''><option selected=''></option></select>",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="<a href='' disabled='disabled'></a><select disabled='disabled'><option/></select>";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<se(t,C,null,[e]).length},se.contains=function(e,t){return(e.ownerDocument||e)!=C&&T(e),y(e,t)},se.attr=function(e,t){(e.ownerDocument||e)!=C&&T(e);var n=b.attrHandle[t.toLowerCase()],r=n&&D.call(b.attrHandle,t.toLowerCase())?n(e,t,!E):void 0;return void 0!==r?r:d.attributes||!E?e.getAttribute(t):(r=e.getAttributeNode(t))&&r.specified?r.value:null},se.escape=function(e){return(e+"").replace(re,ie)},se.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},se.uniqueSort=function(e){var t,n=[],r=0,i=0;if(l=!d.detectDuplicates,u=!d.sortStable&&e.slice(0),e.sort(j),l){while(t=e[i++])t===e[i]&&(r=n.push(i));while(r--)e.splice(n[r],1)}return u=null,e},o=se.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=o(e)}else if(3===i||4===i)return e.nodeValue}else while(t=e[r++])n+=o(t);return n},(b=se.selectors={cacheLength:50,createPseudo:le,match:G,attrHandle:{},find:{},relative:{">":{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<t.indexOf(i):"$="===r?i&&t.slice(-i.length)===i:"~="===r?-1<(" "+t.replace(B," ")+" ").indexOf(i):"|="===r&&(t===i||t.slice(0,i.length+1)===i+"-"))}},CHILD:function(h,e,t,g,v){var y="nth"!==h.slice(0,3),m="last"!==h.slice(-4),x="of-type"===e;return 1===g&&0===v?function(e){return!!e.parentNode}:function(e,t,n){var r,i,o,a,s,u,l=y!==m?"nextSibling":"previousSibling",c=e.parentNode,f=x&&e.nodeName.toLowerCase(),p=!n&&!x,d=!1;if(c){if(y){while(l){a=e;while(a=a[l])if(x?a.nodeName.toLowerCase()===f:1===a.nodeType)return!1;u=l="only"===h&&!u&&"nextSibling"}return!0}if(u=[m?c.firstChild:c.lastChild],m&&p){d=(s=(r=(i=(o=(a=c)[S]||(a[S]={}))[a.uniqueID]||(o[a.uniqueID]={}))[h]||[])[0]===k&&r[1])&&r[2],a=s&&c.childNodes[s];while(a=++s&&a&&a[l]||(d=s=0)||u.pop())if(1===a.nodeType&&++d&&a===e){i[h]=[k,s,d];break}}else if(p&&(d=s=(r=(i=(o=(a=e)[S]||(a[S]={}))[a.uniqueID]||(o[a.uniqueID]={}))[h]||[])[0]===k&&r[1]),!1===d)while(a=++s&&a&&a[l]||(d=s=0)||u.pop())if((x?a.nodeName.toLowerCase()===f:1===a.nodeType)&&++d&&(p&&((i=(o=a[S]||(a[S]={}))[a.uniqueID]||(o[a.uniqueID]={}))[h]=[k,d]),a===e))break;return(d-=v)===g||d%g==0&&0<=d/g}}},PSEUDO:function(e,o){var t,a=b.pseudos[e]||b.setFilters[e.toLowerCase()]||se.error("unsupported pseudo: "+e);return a[S]?a(o):1<a.length?(t=[e,e,"",o],b.setFilters.hasOwnProperty(e.toLowerCase())?le(function(e,t){var n,r=a(e,o),i=r.length;while(i--)e[n=P(e,r[i])]=!(t[n]=r[i])}):function(e){return a(e,0,t)}):a}},pseudos:{not:le(function(e){var r=[],i=[],s=f(e.replace($,"$1"));return s[S]?le(function(e,t,n,r){var i,o=s(e,null,r,[]),a=e.length;while(a--)(i=o[a])&&(e[a]=!(t[a]=i))}):function(e,t,n){return r[0]=e,s(r,null,n,i),r[0]=null,!i.pop()}}),has:le(function(t){return function(e){return 0<se(t,e).length}}),contains:le(function(t){return t=t.replace(te,ne),function(e){return-1<(e.textContent||o(e)).indexOf(t)}}),lang:le(function(n){return V.test(n||"")||se.error("unsupported lang: "+n),n=n.replace(te,ne).toLowerCase(),function(e){var t;do{if(t=E?e.lang:e.getAttribute("xml:lang")||e.getAttribute("lang"))return(t=t.toLowerCase())===n||0===t.indexOf(n+"-")}while((e=e.parentNode)&&1===e.nodeType);return!1}}),target:function(e){var t=n.location&&n.location.hash;return t&&t.slice(1)===e.id},root:function(e){return e===a},focus:function(e){return e===C.activeElement&&(!C.hasFocus||C.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:ge(!1),disabled:ge(!0),checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,!0===e.selected},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return!1;return!0},parent:function(e){return!b.pseudos.empty(e)},header:function(e){return J.test(e.nodeName)},input:function(e){return Q.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||"text"===t.toLowerCase())},first:ve(function(){return[0]}),last:ve(function(e,t){return[t-1]}),eq:ve(function(e,t,n){return[n<0?n+t:n]}),even:ve(function(e,t){for(var n=0;n<t;n+=2)e.push(n);return e}),odd:ve(function(e,t){for(var n=1;n<t;n+=2)e.push(n);return e}),lt:ve(function(e,t,n){for(var r=n<0?n+t:t<n?t:n;0<=--r;)e.push(r);return e}),gt:ve(function(e,t,n){for(var r=n<0?n+t:n;++r<t;)e.push(r);return e})}}).pseudos.nth=b.pseudos.eq,{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})b.pseudos[e]=de(e);for(e in{submit:!0,reset:!0})b.pseudos[e]=he(e);function me(){}function xe(e){for(var t=0,n=e.length,r="";t<n;t++)r+=e[t].value;return r}function be(s,e,t){var u=e.dir,l=e.next,c=l||u,f=t&&"parentNode"===c,p=r++;return e.first?function(e,t,n){while(e=e[u])if(1===e.nodeType||f)return s(e,t,n);return!1}:function(e,t,n){var r,i,o,a=[k,p];if(n){while(e=e[u])if((1===e.nodeType||f)&&s(e,t,n))return!0}else while(e=e[u])if(1===e.nodeType||f)if(i=(o=e[S]||(e[S]={}))[e.uniqueID]||(o[e.uniqueID]={}),l&&l===e.nodeName.toLowerCase())e=e[u]||e;else{if((r=i[c])&&r[0]===k&&r[1]===p)return a[2]=r[2];if((i[c]=a)[2]=s(e,t,n))return!0}return!1}}function we(i){return 1<i.length?function(e,t,n){var r=i.length;while(r--)if(!i[r](e,t,n))return!1;return!0}:i[0]}function Te(e,t,n,r,i){for(var o,a=[],s=0,u=e.length,l=null!=t;s<u;s++)(o=e[s])&&(n&&!n(o,r,i)||(a.push(o),l&&t.push(s)));return a}function Ce(d,h,g,v,y,e){return v&&!v[S]&&(v=Ce(v)),y&&!y[S]&&(y=Ce(y,e)),le(function(e,t,n,r){var i,o,a,s=[],u=[],l=t.length,c=e||function(e,t,n){for(var r=0,i=t.length;r<i;r++)se(e,t[r],n);return n}(h||"*",n.nodeType?[n]:n,[]),f=!d||!e&&h?c:Te(c,s,d,n,r),p=g?y||(e?d:l||v)?[]:t:f;if(g&&g(f,p,n,r),v){i=Te(p,u),v(i,[],n,r),o=i.length;while(o--)(a=i[o])&&(p[u[o]]=!(f[u[o]]=a))}if(e){if(y||d){if(y){i=[],o=p.length;while(o--)(a=p[o])&&i.push(f[o]=a);y(null,p=[],i,r)}o=p.length;while(o--)(a=p[o])&&-1<(i=y?P(e,a):s[o])&&(e[i]=!(t[i]=a))}}else p=Te(p===t?p.splice(l,p.length):p),y?y(null,t,p,r):H.apply(t,p)})}function Ee(e){for(var i,t,n,r=e.length,o=b.relative[e[0].type],a=o||b.relative[" "],s=o?1:0,u=be(function(e){return e===i},a,!0),l=be(function(e){return-1<P(i,e)},a,!0),c=[function(e,t,n){var r=!o&&(n||t!==w)||((i=t).nodeType?u(e,t,n):l(e,t,n));return i=null,r}];s<r;s++)if(t=b.relative[e[s].type])c=[be(we(c),t)];else{if((t=b.filter[e[s].type].apply(null,e[s].matches))[S]){for(n=++s;n<r;n++)if(b.relative[e[n].type])break;return Ce(1<s&&we(c),1<s&&xe(e.slice(0,s-1).concat({value:" "===e[s-2].type?"*":""})).replace($,"$1"),t,s<n&&Ee(e.slice(s,n)),n<r&&Ee(e=e.slice(n)),n<r&&xe(e))}c.push(t)}return we(c)}return me.prototype=b.filters=b.pseudos,b.setFilters=new me,h=se.tokenize=function(e,t){var n,r,i,o,a,s,u,l=x[e+" "];if(l)return t?0:l.slice(0);a=e,s=[],u=b.preFilter;while(a){for(o in n&&!(r=_.exec(a))||(r&&(a=a.slice(r[0].length)||a),s.push(i=[])),n=!1,(r=z.exec(a))&&(n=r.shift(),i.push({value:n,type:r[0].replace($," ")}),a=a.slice(n.length)),b.filter)!(r=G[o].exec(a))||u[o]&&!(r=u[o](r))||(n=r.shift(),i.push({value:n,type:o,matches:r}),a=a.slice(n.length));if(!n)break}return t?a.length:a?se.error(e):x(e,s).slice(0)},f=se.compile=function(e,t){var n,v,y,m,x,r,i=[],o=[],a=A[e+" "];if(!a){t||(t=h(e)),n=t.length;while(n--)(a=Ee(t[n]))[S]?i.push(a):o.push(a);(a=A(e,(v=o,m=0<(y=i).length,x=0<v.length,r=function(e,t,n,r,i){var o,a,s,u=0,l="0",c=e&&[],f=[],p=w,d=e||x&&b.find.TAG("*",i),h=k+=null==p?1:Math.random()||.1,g=d.length;for(i&&(w=t==C||t||i);l!==g&&null!=(o=d[l]);l++){if(x&&o){a=0,t||o.ownerDocument==C||(T(o),n=!E);while(s=v[a++])if(s(o,t||C,n)){r.push(o);break}i&&(k=h)}m&&((o=!s&&o)&&u--,e&&c.push(o))}if(u+=l,m&&l!==u){a=0;while(s=y[a++])s(c,f,t,n);if(e){if(0<u)while(l--)c[l]||f[l]||(f[l]=q.call(r));f=Te(f)}H.apply(r,f),i&&!e&&0<f.length&&1<u+y.length&&se.uniqueSort(r)}return i&&(k=h,w=p),c},m?le(r):r))).selector=e}return a},g=se.select=function(e,t,n,r){var i,o,a,s,u,l="function"==typeof e&&e,c=!r&&h(e=l.selector||e);if(n=n||[],1===c.length){if(2<(o=c[0]=c[0].slice(0)).length&&"ID"===(a=o[0]).type&&9===t.nodeType&&E&&b.relative[o[1].type]){if(!(t=(b.find.ID(a.matches[0].replace(te,ne),t)||[])[0]))return n;l&&(t=t.parentNode),e=e.slice(o.shift().value.length)}i=G.needsContext.test(e)?0:o.length;while(i--){if(a=o[i],b.relative[s=a.type])break;if((u=b.find[s])&&(r=u(a.matches[0].replace(te,ne),ee.test(o[0].type)&&ye(t.parentNode)||t))){if(o.splice(i,1),!(e=r.length&&xe(o)))return H.apply(n,r),n;break}}}return(l||f(e,c))(r,t,!E,n,!t||ee.test(e)&&ye(t.parentNode)||t),n},d.sortStable=S.split("").sort(j).join("")===S,d.detectDuplicates=!!l,T(),d.sortDetached=ce(function(e){return 1&e.compareDocumentPosition(C.createElement("fieldset"))}),ce(function(e){return e.innerHTML="<a href='#'></a>","#"===e.firstChild.getAttribute("href")})||fe("type|href|height|width",function(e,t,n){if(!n)return e.getAttribute(t,"type"===t.toLowerCase()?1:2)}),d.attributes&&ce(function(e){return e.innerHTML="<input/>",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||fe("value",function(e,t,n){if(!n&&"input"===e.nodeName.toLowerCase())return e.defaultValue}),ce(function(e){return null==e.getAttribute("disabled")})||fe(R,function(e,t,n){var r;if(!n)return!0===e[t]?t.toLowerCase():(r=e.getAttributeNode(t))&&r.specified?r.value:null}),se}(C);S.find=d,S.expr=d.selectors,S.expr[":"]=S.expr.pseudos,S.uniqueSort=S.unique=d.uniqueSort,S.text=d.getText,S.isXMLDoc=d.isXML,S.contains=d.contains,S.escapeSelector=d.escape;var h=function(e,t,n){var r=[],i=void 0!==n;while((e=e[t])&&9!==e.nodeType)if(1===e.nodeType){if(i&&S(e).is(n))break;r.push(e)}return r},T=function(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n},k=S.expr.match.needsContext;function A(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()}var N=/^<([a-z][^\/\0>:\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<i.call(n,e)!==r}):S.filter(n,e,r)}S.filter=function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?S.find.matchesSelector(r,e)?[r]:[]:S.find.matches(e,S.grep(t,function(e){return 1===e.nodeType}))},S.fn.extend({find:function(e){var t,n,r=this.length,i=this;if("string"!=typeof e)return this.pushStack(S(e).filter(function(){for(t=0;t<r;t++)if(S.contains(i[t],this))return!0}));for(n=this.pushStack([]),t=0;t<r;t++)S.find(e,i[t],n);return 1<r?S.uniqueSort(n):n},filter:function(e){return this.pushStack(j(this,e||[],!1))},not:function(e){return this.pushStack(j(this,e||[],!0))},is:function(e){return!!j(this,"string"==typeof e&&k.test(e)?S(e):e||[],!1).length}});var D,q=/^(?:\s*(<[\w\W]+>)[^>]*|#([\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<n;e++)if(S.contains(this,t[e]))return!0})},closest:function(e,t){var n,r=0,i=this.length,o=[],a="string"!=typeof e&&S(e);if(!k.test(e))for(;r<i;r++)for(n=this[r];n&&n!==t;n=n.parentNode)if(n.nodeType<11&&(a?-1<a.index(n):1===n.nodeType&&S.find.matchesSelector(n,e))){o.push(n);break}return this.pushStack(1<o.length?S.uniqueSort(o):o)},index:function(e){return e?"string"==typeof e?i.call(S(e),this[0]):i.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(S.uniqueSort(S.merge(this.get(),S(e,t))))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),S.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return h(e,"parentNode")},parentsUntil:function(e,t,n){return h(e,"parentNode",n)},next:function(e){return O(e,"nextSibling")},prev:function(e){return O(e,"previousSibling")},nextAll:function(e){return h(e,"nextSibling")},prevAll:function(e){return h(e,"previousSibling")},nextUntil:function(e,t,n){return h(e,"nextSibling",n)},prevUntil:function(e,t,n){return h(e,"previousSibling",n)},siblings:function(e){return T((e.parentNode||{}).firstChild,e)},children:function(e){return T(e.firstChild)},contents:function(e){return null!=e.contentDocument&&r(e.contentDocument)?e.contentDocument:(A(e,"template")&&(e=e.content||e),S.merge([],e.childNodes))}},function(r,i){S.fn[r]=function(e,t){var n=S.map(this,i,e);return"Until"!==r.slice(-5)&&(t=e),t&&"string"==typeof t&&(n=S.filter(t,n)),1<this.length&&(H[r]||S.uniqueSort(n),L.test(r)&&n.reverse()),this.pushStack(n)}});var P=/[^\x20\t\r\n\f]+/g;function R(e){return e}function M(e){throw e}function I(e,t,n,r){var i;try{e&&m(i=e.promise)?i.call(e).done(t).fail(n):e&&m(i=e.then)?i.call(e,t,n):t.apply(void 0,[e].slice(r))}catch(e){n.apply(void 0,[e])}}S.Callbacks=function(r){var e,n;r="string"==typeof r?(e=r,n={},S.each(e.match(P)||[],function(e,t){n[t]=!0}),n):S.extend({},r);var i,t,o,a,s=[],u=[],l=-1,c=function(){for(a=a||r.once,o=i=!0;u.length;l=-1){t=u.shift();while(++l<s.length)!1===s[l].apply(t[0],t[1])&&r.stopOnFalse&&(l=s.length,t=!1)}r.memory||(t=!1),i=!1,a&&(s=t?[]:"")},f={add:function(){return s&&(t&&!i&&(l=s.length-1,u.push(t)),function n(e){S.each(e,function(e,t){m(t)?r.unique&&f.has(t)||s.push(t):t&&t.length&&"string"!==w(t)&&n(t)})}(arguments),t&&!i&&c()),this},remove:function(){return S.each(arguments,function(e,t){var n;while(-1<(n=S.inArray(t,s,n)))s.splice(n,1),n<=l&&l--}),this},has:function(e){return e?-1<S.inArray(e,s):0<s.length},empty:function(){return s&&(s=[]),this},disable:function(){return a=u=[],s=t="",this},disabled:function(){return!s},lock:function(){return a=u=[],t||i||(s=t=""),this},locked:function(){return!!a},fireWith:function(e,t){return a||(t=[e,(t=t||[]).slice?t.slice():t],u.push(t),i||c()),this},fire:function(){return f.fireWith(this,arguments),this},fired:function(){return!!o}};return f},S.extend({Deferred:function(e){var o=[["notify","progress",S.Callbacks("memory"),S.Callbacks("memory"),2],["resolve","done",S.Callbacks("once memory"),S.Callbacks("once memory"),0,"resolved"],["reject","fail",S.Callbacks("once memory"),S.Callbacks("once memory"),1,"rejected"]],i="pending",a={state:function(){return i},always:function(){return s.done(arguments).fail(arguments),this},"catch":function(e){return a.then(null,e)},pipe:function(){var i=arguments;return S.Deferred(function(r){S.each(o,function(e,t){var n=m(i[t[4]])&&i[t[4]];s[t[1]](function(){var e=n&&n.apply(this,arguments);e&&m(e.promise)?e.promise().progress(r.notify).done(r.resolve).fail(r.reject):r[t[0]+"With"](this,n?[e]:arguments)})}),i=null}).promise()},then:function(t,n,r){var u=0;function l(i,o,a,s){return function(){var n=this,r=arguments,e=function(){var e,t;if(!(i<u)){if((e=a.apply(n,r))===o.promise())throw new TypeError("Thenable self-resolution");t=e&&("object"==typeof e||"function"==typeof e)&&e.then,m(t)?s?t.call(e,l(u,o,R,s),l(u,o,M,s)):(u++,t.call(e,l(u,o,R,s),l(u,o,M,s),l(u,o,R,o.notifyWith))):(a!==R&&(n=void 0,r=[e]),(s||o.resolveWith)(n,r))}},t=s?e:function(){try{e()}catch(e){S.Deferred.exceptionHook&&S.Deferred.exceptionHook(e,t.stackTrace),u<=i+1&&(a!==M&&(n=void 0,r=[e]),o.rejectWith(n,r))}};i?t():(S.Deferred.getStackHook&&(t.stackTrace=S.Deferred.getStackHook()),C.setTimeout(t))}}return S.Deferred(function(e){o[0][3].add(l(0,e,m(r)?r:R,e.notifyWith)),o[1][3].add(l(0,e,m(t)?t:R)),o[2][3].add(l(0,e,m(n)?n:M))}).promise()},promise:function(e){return null!=e?S.extend(e,a):a}},s={};return S.each(o,function(e,t){var n=t[2],r=t[5];a[t[1]]=n.add,r&&n.add(function(){i=r},o[3-e][2].disable,o[3-e][3].disable,o[0][2].lock,o[0][3].lock),n.add(t[3].fire),s[t[0]]=function(){return s[t[0]+"With"](this===s?void 0:this,arguments),this},s[t[0]+"With"]=n.fireWith}),a.promise(s),e&&e.call(s,s),s},when:function(e){var n=arguments.length,t=n,r=Array(t),i=s.call(arguments),o=S.Deferred(),a=function(t){return function(e){r[t]=this,i[t]=1<arguments.length?s.call(arguments):e,--n||o.resolveWith(r,i)}};if(n<=1&&(I(e,o.done(a(t)).resolve,o.reject,!n),"pending"===o.state()||m(i[t]&&i[t].then)))return o.then();while(t--)I(i[t],a(t),o.reject);return o.promise()}});var W=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;S.Deferred.exceptionHook=function(e,t){C.console&&C.console.warn&&e&&W.test(e.name)&&C.console.warn("jQuery.Deferred exception: "+e.message,e.stack,t)},S.readyException=function(e){C.setTimeout(function(){throw e})};var F=S.Deferred();function B(){E.removeEventListener("DOMContentLoaded",B),C.removeEventListener("load",B),S.ready()}S.fn.ready=function(e){return F.then(e)["catch"](function(e){S.readyException(e)}),this},S.extend({isReady:!1,readyWait:1,ready:function(e){(!0===e?--S.readyWait:S.isReady)||(S.isReady=!0)!==e&&0<--S.readyWait||F.resolveWith(E,[S])}}),S.ready.then=F.then,"complete"===E.readyState||"loading"!==E.readyState&&!E.documentElement.doScroll?C.setTimeout(S.ready):(E.addEventListener("DOMContentLoaded",B),C.addEventListener("load",B));var $=function(e,t,n,r,i,o,a){var s=0,u=e.length,l=null==n;if("object"===w(n))for(s in i=!0,n)$(e,t,s,n[s],!0,o,a);else if(void 0!==r&&(i=!0,m(r)||(a=!0),l&&(a?(t.call(e,r),t=null):(l=t,t=function(e,t,n){return l.call(S(e),n)})),t))for(;s<u;s++)t(e[s],n,a?r:r.call(e[s],s,t(e[s],n)));return i?e:l?t.call(e):u?t(e[0],n):o},_=/^-ms-/,z=/-([a-z])/g;function U(e,t){return t.toUpperCase()}function X(e){return e.replace(_,"ms-").replace(z,U)}var V=function(e){return 1===e.nodeType||9===e.nodeType||!+e.nodeType};function G(){this.expando=S.expando+G.uid++}G.uid=1,G.prototype={cache:function(e){var t=e[this.expando];return t||(t={},V(e)&&(e.nodeType?e[this.expando]=t:Object.defineProperty(e,this.expando,{value:t,configurable:!0}))),t},set:function(e,t,n){var r,i=this.cache(e);if("string"==typeof t)i[X(t)]=n;else for(r in t)i[X(r)]=t[r];return i},get:function(e,t){return void 0===t?this.cache(e):e[this.expando]&&e[this.expando][X(t)]},access:function(e,t,n){return void 0===t||t&&"string"==typeof t&&void 0===n?this.get(e,t):(this.set(e,t,n),void 0!==n?n:t)},remove:function(e,t){var n,r=e[this.expando];if(void 0!==r){if(void 0!==t){n=(t=Array.isArray(t)?t.map(X):(t=X(t))in r?[t]:t.match(P)||[]).length;while(n--)delete r[t[n]]}(void 0===t||S.isEmptyObject(r))&&(e.nodeType?e[this.expando]=void 0:delete e[this.expando])}},hasData:function(e){var t=e[this.expando];return void 0!==t&&!S.isEmptyObject(t)}};var Y=new G,Q=new G,J=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,K=/[A-Z]/g;function Z(e,t,n){var r,i;if(void 0===n&&1===e.nodeType)if(r="data-"+t.replace(K,"-$&").toLowerCase(),"string"==typeof(n=e.getAttribute(r))){try{n="true"===(i=n)||"false"!==i&&("null"===i?null:i===+i+""?+i:J.test(i)?JSON.parse(i):i)}catch(e){}Q.set(e,t,n)}else n=void 0;return n}S.extend({hasData:function(e){return Q.hasData(e)||Y.hasData(e)},data:function(e,t,n){return Q.access(e,t,n)},removeData:function(e,t){Q.remove(e,t)},_data:function(e,t,n){return Y.access(e,t,n)},_removeData:function(e,t){Y.remove(e,t)}}),S.fn.extend({data:function(n,e){var t,r,i,o=this[0],a=o&&o.attributes;if(void 0===n){if(this.length&&(i=Q.get(o),1===o.nodeType&&!Y.get(o,"hasDataAttrs"))){t=a.length;while(t--)a[t]&&0===(r=a[t].name).indexOf("data-")&&(r=X(r.slice(5)),Z(o,r,i[r]));Y.set(o,"hasDataAttrs",!0)}return i}return"object"==typeof n?this.each(function(){Q.set(this,n)}):$(this,function(e){var t;if(o&&void 0===e)return void 0!==(t=Q.get(o,n))?t:void 0!==(t=Z(o,n))?t:void 0;this.each(function(){Q.set(this,n,e)})},null,e,1<arguments.length,null,!0)},removeData:function(e){return this.each(function(){Q.remove(this,e)})}}),S.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=Y.get(e,t),n&&(!r||Array.isArray(n)?r=Y.access(e,t,S.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=S.queue(e,t),r=n.length,i=n.shift(),o=S._queueHooks(e,t);"inprogress"===i&&(i=n.shift(),r--),i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,function(){S.dequeue(e,t)},o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return Y.get(e,n)||Y.access(e,n,{empty:S.Callbacks("once memory").add(function(){Y.remove(e,[t+"queue",n])})})}}),S.fn.extend({queue:function(t,n){var e=2;return"string"!=typeof t&&(n=t,t="fx",e--),arguments.length<e?S.queue(this[0],t):void 0===n?this:this.each(function(){var e=S.queue(this,t,n);S._queueHooks(this,t),"fx"===t&&"inprogress"!==e[0]&&S.dequeue(this,t)})},dequeue:function(e){return this.each(function(){S.dequeue(this,e)})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,t){var n,r=1,i=S.Deferred(),o=this,a=this.length,s=function(){--r||i.resolveWith(o,[o])};"string"!=typeof e&&(t=e,e=void 0),e=e||"fx";while(a--)(n=Y.get(o[a],e+"queueHooks"))&&n.empty&&(r++,n.empty.add(s));return s(),i.promise(t)}});var ee=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,te=new RegExp("^(?:([+-])=|)("+ee+")([a-z%]*)$","i"),ne=["Top","Right","Bottom","Left"],re=E.documentElement,ie=function(e){return S.contains(e.ownerDocument,e)},oe={composed:!0};re.getRootNode&&(ie=function(e){return S.contains(e.ownerDocument,e)||e.getRootNode(oe)===e.ownerDocument});var ae=function(e,t){return"none"===(e=t||e).style.display||""===e.style.display&&ie(e)&&"none"===S.css(e,"display")};function se(e,t,n,r){var i,o,a=20,s=r?function(){return r.cur()}:function(){return S.css(e,t,"")},u=s(),l=n&&n[3]||(S.cssNumber[t]?"":"px"),c=e.nodeType&&(S.cssNumber[t]||"px"!==l&&+u)&&te.exec(S.css(e,t));if(c&&c[3]!==l){u/=2,l=l||c[3],c=+u||1;while(a--)S.style(e,t,c+l),(1-o)*(1-(o=s()/u||.5))<=0&&(a=0),c/=o;c*=2,S.style(e,t,c+l),n=n||[]}return n&&(c=+c||+u||0,i=n[1]?c+(n[1]+1)*n[2]:+n[2],r&&(r.unit=l,r.start=c,r.end=i)),i}var ue={};function le(e,t){for(var n,r,i,o,a,s,u,l=[],c=0,f=e.length;c<f;c++)(r=e[c]).style&&(n=r.style.display,t?("none"===n&&(l[c]=Y.get(r,"display")||null,l[c]||(r.style.display="")),""===r.style.display&&ae(r)&&(l[c]=(u=a=o=void 0,a=(i=r).ownerDocument,s=i.nodeName,(u=ue[s])||(o=a.body.appendChild(a.createElement(s)),u=S.css(o,"display"),o.parentNode.removeChild(o),"none"===u&&(u="block"),ue[s]=u)))):"none"!==n&&(l[c]="none",Y.set(r,"display",n)));for(c=0;c<f;c++)null!=l[c]&&(e[c].style.display=l[c]);return e}S.fn.extend({show:function(){return le(this,!0)},hide:function(){return le(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each(function(){ae(this)?S(this).show():S(this).hide()})}});var ce,fe,pe=/^(?:checkbox|radio)$/i,de=/<([a-z][^\/\0>\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="<textarea>x</textarea>",y.noCloneChecked=!!ce.cloneNode(!0).lastChild.defaultValue,ce.innerHTML="<option></option>",y.option=!!ce.lastChild;var ge={thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_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<r;n++)Y.set(e[n],"globalEval",!t||Y.get(t[n],"globalEval"))}ge.tbody=ge.tfoot=ge.colgroup=ge.caption=ge.thead,ge.th=ge.td,y.option||(ge.optgroup=ge.option=[1,"<select multiple='multiple'>","</select>"]);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<h;d++)if((o=e[d])||0===o)if("object"===w(o))S.merge(p,o.nodeType?[o]:o);else if(me.test(o)){a=a||f.appendChild(t.createElement("div")),s=(de.exec(o)||["",""])[1].toLowerCase(),u=ge[s]||ge._default,a.innerHTML=u[1]+S.htmlPrefilter(o)+u[2],c=u[0];while(c--)a=a.lastChild;S.merge(p,a.childNodes),(a=f.firstChild).textContent=""}else p.push(t.createTextNode(o));f.textContent="",d=0;while(o=p[d++])if(r&&-1<S.inArray(o,r))i&&i.push(o);else if(l=ie(o),a=ve(f.appendChild(o),"script"),l&&ye(a),n){c=0;while(o=a[c++])he.test(o.type||"")&&n.push(o)}return f}var be=/^([^.]*)(?:\.(.+)|)/;function we(){return!0}function Te(){return!1}function Ce(e,t){return e===function(){try{return E.activeElement}catch(e){}}()==("focus"===t)}function Ee(e,t,n,r,i,o){var a,s;if("object"==typeof t){for(s in"string"!=typeof n&&(r=r||n,n=void 0),t)Ee(e,s,n,r,t[s],o);return e}if(null==r&&null==i?(i=n,r=n=void 0):null==i&&("string"==typeof n?(i=r,r=void 0):(i=r,r=n,n=void 0)),!1===i)i=Te;else if(!i)return e;return 1===o&&(a=i,(i=function(e){return S().off(e),a.apply(this,arguments)}).guid=a.guid||(a.guid=S.guid++)),e.each(function(){S.event.add(this,t,i,r,n)})}function Se(e,i,o){o?(Y.set(e,i,!1),S.event.add(e,i,{namespace:!1,handler:function(e){var t,n,r=Y.get(this,i);if(1&e.isTrigger&&this[i]){if(r.length)(S.event.special[i]||{}).delegateType&&e.stopPropagation();else if(r=s.call(arguments),Y.set(this,i,r),t=o(this,i),this[i](),r!==(n=Y.get(this,i))||t?Y.set(this,i,!1):n={},r!==n)return e.stopImmediatePropagation(),e.preventDefault(),n&&n.value}else r.length&&(Y.set(this,i,{value:S.event.trigger(S.extend(r[0],S.Event.prototype),r.slice(1),this)}),e.stopImmediatePropagation())}})):void 0===Y.get(e,i)&&S.event.add(e,i,we)}S.event={global:{},add:function(t,e,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,v=Y.get(t);if(V(t)){n.handler&&(n=(o=n).handler,i=o.selector),i&&S.find.matchesSelector(re,i),n.guid||(n.guid=S.guid++),(u=v.events)||(u=v.events=Object.create(null)),(a=v.handle)||(a=v.handle=function(e){return"undefined"!=typeof S&&S.event.triggered!==e.type?S.event.dispatch.apply(t,arguments):void 0}),l=(e=(e||"").match(P)||[""]).length;while(l--)d=g=(s=be.exec(e[l])||[])[1],h=(s[2]||"").split(".").sort(),d&&(f=S.event.special[d]||{},d=(i?f.delegateType:f.bindType)||d,f=S.event.special[d]||{},c=S.extend({type:d,origType:g,data:r,handler:n,guid:n.guid,selector:i,needsContext:i&&S.expr.match.needsContext.test(i),namespace:h.join(".")},o),(p=u[d])||((p=u[d]=[]).delegateCount=0,f.setup&&!1!==f.setup.call(t,r,h,a)||t.addEventListener&&t.addEventListener(d,a)),f.add&&(f.add.call(t,c),c.handler.guid||(c.handler.guid=n.guid)),i?p.splice(p.delegateCount++,0,c):p.push(c),S.event.global[d]=!0)}},remove:function(e,t,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,v=Y.hasData(e)&&Y.get(e);if(v&&(u=v.events)){l=(t=(t||"").match(P)||[""]).length;while(l--)if(d=g=(s=be.exec(t[l])||[])[1],h=(s[2]||"").split(".").sort(),d){f=S.event.special[d]||{},p=u[d=(r?f.delegateType:f.bindType)||d]||[],s=s[2]&&new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),a=o=p.length;while(o--)c=p[o],!i&&g!==c.origType||n&&n.guid!==c.guid||s&&!s.test(c.namespace)||r&&r!==c.selector&&("**"!==r||!c.selector)||(p.splice(o,1),c.selector&&p.delegateCount--,f.remove&&f.remove.call(e,c));a&&!p.length&&(f.teardown&&!1!==f.teardown.call(e,h,v.handle)||S.removeEvent(e,d,v.handle),delete u[d])}else for(d in u)S.event.remove(e,d+t[l],n,r,!0);S.isEmptyObject(u)&&Y.remove(e,"handle events")}},dispatch:function(e){var t,n,r,i,o,a,s=new Array(arguments.length),u=S.event.fix(e),l=(Y.get(this,"events")||Object.create(null))[u.type]||[],c=S.event.special[u.type]||{};for(s[0]=u,t=1;t<arguments.length;t++)s[t]=arguments[t];if(u.delegateTarget=this,!c.preDispatch||!1!==c.preDispatch.call(this,u)){a=S.event.handlers.call(this,u,l),t=0;while((i=a[t++])&&!u.isPropagationStopped()){u.currentTarget=i.elem,n=0;while((o=i.handlers[n++])&&!u.isImmediatePropagationStopped())u.rnamespace&&!1!==o.namespace&&!u.rnamespace.test(o.namespace)||(u.handleObj=o,u.data=o.data,void 0!==(r=((S.event.special[o.origType]||{}).handle||o.handler).apply(i.elem,s))&&!1===(u.result=r)&&(u.preventDefault(),u.stopPropagation()))}return c.postDispatch&&c.postDispatch.call(this,u),u.result}},handlers:function(e,t){var n,r,i,o,a,s=[],u=t.delegateCount,l=e.target;if(u&&l.nodeType&&!("click"===e.type&&1<=e.button))for(;l!==this;l=l.parentNode||this)if(1===l.nodeType&&("click"!==e.type||!0!==l.disabled)){for(o=[],a={},n=0;n<u;n++)void 0===a[i=(r=t[n]).selector+" "]&&(a[i]=r.needsContext?-1<S(i,this).index(l):S.find(i,this,null,[l]).length),a[i]&&o.push(r);o.length&&s.push({elem:l,handlers:o})}return l=this,u<t.length&&s.push({elem:l,handlers:t.slice(u)}),s},addProp:function(t,e){Object.defineProperty(S.Event.prototype,t,{enumerable:!0,configurable:!0,get:m(e)?function(){if(this.originalEvent)return e(this.originalEvent)}:function(){if(this.originalEvent)return this.originalEvent[t]},set:function(e){Object.defineProperty(this,t,{enumerable:!0,configurable:!0,writable:!0,value:e})}})},fix:function(e){return e[S.expando]?e:new S.Event(e)},special:{load:{noBubble:!0},click:{setup:function(e){var t=this||e;return pe.test(t.type)&&t.click&&A(t,"input")&&Se(t,"click",we),!1},trigger:function(e){var t=this||e;return pe.test(t.type)&&t.click&&A(t,"input")&&Se(t,"click"),!0},_default:function(e){var t=e.target;return pe.test(t.type)&&t.click&&A(t,"input")&&Y.get(t,"click")||A(t,"a")}},beforeunload:{postDispatch:function(e){void 0!==e.result&&e.originalEvent&&(e.originalEvent.returnValue=e.result)}}}},S.removeEvent=function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n)},S.Event=function(e,t){if(!(this instanceof S.Event))return new S.Event(e,t);e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||void 0===e.defaultPrevented&&!1===e.returnValue?we:Te,this.target=e.target&&3===e.target.nodeType?e.target.parentNode:e.target,this.currentTarget=e.currentTarget,this.relatedTarget=e.relatedTarget):this.type=e,t&&S.extend(this,t),this.timeStamp=e&&e.timeStamp||Date.now(),this[S.expando]=!0},S.Event.prototype={constructor:S.Event,isDefaultPrevented:Te,isPropagationStopped:Te,isImmediatePropagationStopped:Te,isSimulated:!1,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=we,e&&!this.isSimulated&&e.preventDefault()},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=we,e&&!this.isSimulated&&e.stopPropagation()},stopImmediatePropagation:function(){var e=this.originalEvent;this.isImmediatePropagationStopped=we,e&&!this.isSimulated&&e.stopImmediatePropagation(),this.stopPropagation()}},S.each({altKey:!0,bubbles:!0,cancelable:!0,changedTouches:!0,ctrlKey:!0,detail:!0,eventPhase:!0,metaKey:!0,pageX:!0,pageY:!0,shiftKey:!0,view:!0,"char":!0,code:!0,charCode:!0,key:!0,keyCode:!0,button:!0,buttons:!0,clientX:!0,clientY:!0,offsetX:!0,offsetY:!0,pointerId:!0,pointerType:!0,screenX:!0,screenY:!0,targetTouches:!0,toElement:!0,touches:!0,which:!0},S.event.addProp),S.each({focus:"focusin",blur:"focusout"},function(e,t){S.event.special[e]={setup:function(){return Se(this,e,Ce),!1},trigger:function(){return Se(this,e),!0},_default:function(){return!0},delegateType:t}}),S.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(e,i){S.event.special[e]={delegateType:i,bindType:i,handle:function(e){var t,n=e.relatedTarget,r=e.handleObj;return n&&(n===this||S.contains(this,n))||(e.type=r.origType,t=r.handler.apply(this,arguments),e.type=i),t}}}),S.fn.extend({on:function(e,t,n,r){return Ee(this,e,t,n,r)},one:function(e,t,n,r){return Ee(this,e,t,n,r,1)},off:function(e,t,n){var r,i;if(e&&e.preventDefault&&e.handleObj)return r=e.handleObj,S(e.delegateTarget).off(r.namespace?r.origType+"."+r.namespace:r.origType,r.selector,r.handler),this;if("object"==typeof e){for(i in e)this.off(i,t,e[i]);return this}return!1!==t&&"function"!=typeof t||(n=t,t=void 0),!1===n&&(n=Te),this.each(function(){S.event.remove(this,e,n,t)})}});var ke=/<script|<style|<link/i,Ae=/checked\s*(?:[^=]|=\s*.checked.)/i,Ne=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\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<r;n++)S.event.add(t,i,s[i][n]);Q.hasData(e)&&(o=Q.access(e),a=S.extend({},o),Q.set(t,a))}}function He(n,r,i,o){r=g(r);var e,t,a,s,u,l,c=0,f=n.length,p=f-1,d=r[0],h=m(d);if(h||1<f&&"string"==typeof d&&!y.checkClone&&Ae.test(d))return n.each(function(e){var t=n.eq(e);h&&(r[0]=d.call(this,e,t.html())),He(t,r,i,o)});if(f&&(t=(e=xe(r,n[0].ownerDocument,!1,n,o)).firstChild,1===e.childNodes.length&&(e=t),t||o)){for(s=(a=S.map(ve(e,"script"),De)).length;c<f;c++)u=e,c!==p&&(u=S.clone(u,!0,!0),s&&S.merge(a,ve(u,"script"))),i.call(n[c],u,c);if(s)for(l=a[a.length-1].ownerDocument,S.map(a,qe),c=0;c<s;c++)u=a[c],he.test(u.type||"")&&!Y.access(u,"globalEval")&&S.contains(l,u)&&(u.src&&"module"!==(u.type||"").toLowerCase()?S._evalUrl&&!u.noModule&&S._evalUrl(u.src,{nonce:u.nonce||u.getAttribute("nonce")},l):b(u.textContent.replace(Ne,""),u,l))}return n}function Oe(e,t,n){for(var r,i=t?S.filter(t,e):e,o=0;null!=(r=i[o]);o++)n||1!==r.nodeType||S.cleanData(ve(r)),r.parentNode&&(n&&ie(r)&&ye(ve(r,"script")),r.parentNode.removeChild(r));return e}S.extend({htmlPrefilter:function(e){return e},clone:function(e,t,n){var r,i,o,a,s,u,l,c=e.cloneNode(!0),f=ie(e);if(!(y.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||S.isXMLDoc(e)))for(a=ve(c),r=0,i=(o=ve(e)).length;r<i;r++)s=o[r],u=a[r],void 0,"input"===(l=u.nodeName.toLowerCase())&&pe.test(s.type)?u.checked=s.checked:"input"!==l&&"textarea"!==l||(u.defaultValue=s.defaultValue);if(t)if(n)for(o=o||ve(e),a=a||ve(c),r=0,i=o.length;r<i;r++)Le(o[r],a[r]);else Le(e,c);return 0<(a=ve(c,"script")).length&&ye(a,!f&&ve(e,"script")),c},cleanData:function(e){for(var t,n,r,i=S.event.special,o=0;void 0!==(n=e[o]);o++)if(V(n)){if(t=n[Y.expando]){if(t.events)for(r in t.events)i[r]?S.event.remove(n,r):S.removeEvent(n,r,t.handle);n[Y.expando]=void 0}n[Q.expando]&&(n[Q.expando]=void 0)}}}),S.fn.extend({detach:function(e){return Oe(this,e,!0)},remove:function(e){return Oe(this,e)},text:function(e){return $(this,function(e){return void 0===e?S.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=e)})},null,e,arguments.length)},append:function(){return He(this,arguments,function(e){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||je(this,e).appendChild(e)})},prepend:function(){return He(this,arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=je(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return He(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return He(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},empty:function(){for(var e,t=0;null!=(e=this[t]);t++)1===e.nodeType&&(S.cleanData(ve(e,!1)),e.textContent="");return this},clone:function(e,t){return e=null!=e&&e,t=null==t?e:t,this.map(function(){return S.clone(this,e,t)})},html:function(e){return $(this,function(e){var t=this[0]||{},n=0,r=this.length;if(void 0===e&&1===t.nodeType)return t.innerHTML;if("string"==typeof e&&!ke.test(e)&&!ge[(de.exec(e)||["",""])[1].toLowerCase()]){e=S.htmlPrefilter(e);try{for(;n<r;n++)1===(t=this[n]||{}).nodeType&&(S.cleanData(ve(t,!1)),t.innerHTML=e);t=0}catch(e){}}t&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(){var n=[];return He(this,arguments,function(e){var t=this.parentNode;S.inArray(this,n)<0&&(S.cleanData(ve(this)),t&&t.replaceChild(e,this))},n)}}),S.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,a){S.fn[e]=function(e){for(var t,n=[],r=S(e),i=r.length-1,o=0;o<=i;o++)t=o===i?this:this.clone(!0),S(r[o])[a](t),u.apply(n,t.get());return this.pushStack(n)}});var Pe=new RegExp("^("+ee+")(?!px)[a-z%]+$","i"),Re=function(e){var t=e.ownerDocument.defaultView;return t&&t.opener||(t=C),t.getComputedStyle(e)},Me=function(e,t,n){var r,i,o={};for(i in t)o[i]=e.style[i],e.style[i]=t[i];for(i in r=n.call(e),t)e.style[i]=o[i];return r},Ie=new RegExp(ne.join("|"),"i");function We(e,t,n){var r,i,o,a,s=e.style;return(n=n||Re(e))&&(""!==(a=n.getPropertyValue(t)||n[t])||ie(e)||(a=S.style(e,t)),!y.pixelBoxStyles()&&Pe.test(a)&&Ie.test(t)&&(r=s.width,i=s.minWidth,o=s.maxWidth,s.minWidth=s.maxWidth=s.width=a,a=n.width,s.width=r,s.minWidth=i,s.maxWidth=o)),void 0!==a?a+"":a}function Fe(e,t){return{get:function(){if(!e())return(this.get=t).apply(this,arguments);delete this.get}}}!function(){function e(){if(l){u.style.cssText="position:absolute;left:-11111px;width:60px;margin-top:1px;padding:0;border:0",l.style.cssText="position:relative;display:block;box-sizing:border-box;overflow:scroll;margin:auto;border:1px;padding:1px;width:60%;top:1%",re.appendChild(u).appendChild(l);var e=C.getComputedStyle(l);n="1%"!==e.top,s=12===t(e.marginLeft),l.style.right="60%",o=36===t(e.right),r=36===t(e.width),l.style.position="absolute",i=12===t(l.offsetWidth/3),re.removeChild(u),l=null}}function t(e){return Math.round(parseFloat(e))}var n,r,i,o,a,s,u=E.createElement("div"),l=E.createElement("div");l.style&&(l.style.backgroundClip="content-box",l.cloneNode(!0).style.backgroundClip="",y.clearCloneStyle="content-box"===l.style.backgroundClip,S.extend(y,{boxSizingReliable:function(){return e(),r},pixelBoxStyles:function(){return e(),o},pixelPosition:function(){return e(),n},reliableMarginLeft:function(){return e(),s},scrollboxSize:function(){return e(),i},reliableTrDimensions:function(){var e,t,n,r;return null==a&&(e=E.createElement("table"),t=E.createElement("tr"),n=E.createElement("div"),e.style.cssText="position:absolute;left:-11111px;border-collapse:separate",t.style.cssText="border:1px solid",t.style.height="1px",n.style.height="9px",n.style.display="block",re.appendChild(e).appendChild(t).appendChild(n),r=C.getComputedStyle(t),a=parseInt(r.height,10)+parseInt(r.borderTopWidth,10)+parseInt(r.borderBottomWidth,10)===t.offsetHeight,re.removeChild(e)),a}}))}();var Be=["Webkit","Moz","ms"],$e=E.createElement("div").style,_e={};function ze(e){var t=S.cssProps[e]||_e[e];return t||(e in $e?e:_e[e]=function(e){var t=e[0].toUpperCase()+e.slice(1),n=Be.length;while(n--)if((e=Be[n]+t)in $e)return e}(e)||e)}var Ue=/^(none|table(?!-c[ea]).+)/,Xe=/^--/,Ve={position:"absolute",visibility:"hidden",display:"block"},Ge={letterSpacing:"0",fontWeight:"400"};function Ye(e,t,n){var r=te.exec(t);return r?Math.max(0,r[2]-(n||0))+(r[3]||"px"):t}function Qe(e,t,n,r,i,o){var a="width"===t?1:0,s=0,u=0;if(n===(r?"border":"content"))return 0;for(;a<4;a+=2)"margin"===n&&(u+=S.css(e,n+ne[a],!0,i)),r?("content"===n&&(u-=S.css(e,"padding"+ne[a],!0,i)),"margin"!==n&&(u-=S.css(e,"border"+ne[a]+"Width",!0,i))):(u+=S.css(e,"padding"+ne[a],!0,i),"padding"!==n?u+=S.css(e,"border"+ne[a]+"Width",!0,i):s+=S.css(e,"border"+ne[a]+"Width",!0,i));return!r&&0<=o&&(u+=Math.max(0,Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-o-u-s-.5))||0),u}function Je(e,t,n){var r=Re(e),i=(!y.boxSizingReliable()||n)&&"border-box"===S.css(e,"boxSizing",!1,r),o=i,a=We(e,t,r),s="offset"+t[0].toUpperCase()+t.slice(1);if(Pe.test(a)){if(!n)return a;a="auto"}return(!y.boxSizingReliable()&&i||!y.reliableTrDimensions()&&A(e,"tr")||"auto"===a||!parseFloat(a)&&"inline"===S.css(e,"display",!1,r))&&e.getClientRects().length&&(i="border-box"===S.css(e,"boxSizing",!1,r),(o=s in e)&&(a=e[s])),(a=parseFloat(a)||0)+Qe(e,t,n||(i?"border":"content"),o,r,a)+"px"}function Ke(e,t,n,r,i){return new Ke.prototype.init(e,t,n,r,i)}S.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=We(e,"opacity");return""===n?"1":n}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,gridArea:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnStart:!0,gridRow:!0,gridRowEnd:!0,gridRowStart:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{},style:function(e,t,n,r){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var i,o,a,s=X(t),u=Xe.test(t),l=e.style;if(u||(t=ze(s)),a=S.cssHooks[t]||S.cssHooks[s],void 0===n)return a&&"get"in a&&void 0!==(i=a.get(e,!1,r))?i:l[t];"string"===(o=typeof n)&&(i=te.exec(n))&&i[1]&&(n=se(e,t,i),o="number"),null!=n&&n==n&&("number"!==o||u||(n+=i&&i[3]||(S.cssNumber[s]?"":"px")),y.clearCloneStyle||""!==n||0!==t.indexOf("background")||(l[t]="inherit"),a&&"set"in a&&void 0===(n=a.set(e,n,r))||(u?l.setProperty(t,n):l[t]=n))}},css:function(e,t,n,r){var i,o,a,s=X(t);return Xe.test(t)||(t=ze(s)),(a=S.cssHooks[t]||S.cssHooks[s])&&"get"in a&&(i=a.get(e,!0,n)),void 0===i&&(i=We(e,t,r)),"normal"===i&&t in Ge&&(i=Ge[t]),""===n||n?(o=parseFloat(i),!0===n||isFinite(o)?o||0:i):i}}),S.each(["height","width"],function(e,u){S.cssHooks[u]={get:function(e,t,n){if(t)return!Ue.test(S.css(e,"display"))||e.getClientRects().length&&e.getBoundingClientRect().width?Je(e,u,n):Me(e,Ve,function(){return Je(e,u,n)})},set:function(e,t,n){var r,i=Re(e),o=!y.scrollboxSize()&&"absolute"===i.position,a=(o||n)&&"border-box"===S.css(e,"boxSizing",!1,i),s=n?Qe(e,u,n,a,i):0;return a&&o&&(s-=Math.ceil(e["offset"+u[0].toUpperCase()+u.slice(1)]-parseFloat(i[u])-Qe(e,u,"border",!1,i)-.5)),s&&(r=te.exec(t))&&"px"!==(r[3]||"px")&&(e.style[u]=t,t=S.css(e,u)),Ye(0,t,s)}}}),S.cssHooks.marginLeft=Fe(y.reliableMarginLeft,function(e,t){if(t)return(parseFloat(We(e,"marginLeft"))||e.getBoundingClientRect().left-Me(e,{marginLeft:0},function(){return e.getBoundingClientRect().left}))+"px"}),S.each({margin:"",padding:"",border:"Width"},function(i,o){S.cssHooks[i+o]={expand:function(e){for(var t=0,n={},r="string"==typeof e?e.split(" "):[e];t<4;t++)n[i+ne[t]+o]=r[t]||r[t-2]||r[0];return n}},"margin"!==i&&(S.cssHooks[i+o].set=Ye)}),S.fn.extend({css:function(e,t){return $(this,function(e,t,n){var r,i,o={},a=0;if(Array.isArray(t)){for(r=Re(e),i=t.length;a<i;a++)o[t[a]]=S.css(e,t[a],!1,r);return o}return void 0!==n?S.style(e,t,n):S.css(e,t)},e,t,1<arguments.length)}}),((S.Tween=Ke).prototype={constructor:Ke,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||S.easing._default,this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(S.cssNumber[n]?"":"px")},cur:function(){var e=Ke.propHooks[this.prop];return e&&e.get?e.get(this):Ke.propHooks._default.get(this)},run:function(e){var t,n=Ke.propHooks[this.prop];return this.options.duration?this.pos=t=S.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):Ke.propHooks._default.set(this),this}}).init.prototype=Ke.prototype,(Ke.propHooks={_default:{get:function(e){var t;return 1!==e.elem.nodeType||null!=e.elem[e.prop]&&null==e.elem.style[e.prop]?e.elem[e.prop]:(t=S.css(e.elem,e.prop,""))&&"auto"!==t?t:0},set:function(e){S.fx.step[e.prop]?S.fx.step[e.prop](e):1!==e.elem.nodeType||!S.cssHooks[e.prop]&&null==e.elem.style[ze(e.prop)]?e.elem[e.prop]=e.now:S.style(e.elem,e.prop,e.now+e.unit)}}}).scrollTop=Ke.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},S.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2},_default:"swing"},S.fx=Ke.prototype.init,S.fx.step={};var Ze,et,tt,nt,rt=/^(?:toggle|show|hide)$/,it=/queueHooks$/;function ot(){et&&(!1===E.hidden&&C.requestAnimationFrame?C.requestAnimationFrame(ot):C.setTimeout(ot,S.fx.interval),S.fx.tick())}function at(){return C.setTimeout(function(){Ze=void 0}),Ze=Date.now()}function st(e,t){var n,r=0,i={height:e};for(t=t?1:0;r<4;r+=2-t)i["margin"+(n=ne[r])]=i["padding"+n]=e;return t&&(i.opacity=i.width=e),i}function ut(e,t,n){for(var r,i=(lt.tweeners[t]||[]).concat(lt.tweeners["*"]),o=0,a=i.length;o<a;o++)if(r=i[o].call(n,t,e))return r}function lt(o,e,t){var n,a,r=0,i=lt.prefilters.length,s=S.Deferred().always(function(){delete u.elem}),u=function(){if(a)return!1;for(var e=Ze||at(),t=Math.max(0,l.startTime+l.duration-e),n=1-(t/l.duration||0),r=0,i=l.tweens.length;r<i;r++)l.tweens[r].run(n);return s.notifyWith(o,[l,n,t]),n<1&&i?t:(i||s.notifyWith(o,[l,1,0]),s.resolveWith(o,[l]),!1)},l=s.promise({elem:o,props:S.extend({},e),opts:S.extend(!0,{specialEasing:{},easing:S.easing._default},t),originalProperties:e,originalOptions:t,startTime:Ze||at(),duration:t.duration,tweens:[],createTween:function(e,t){var n=S.Tween(o,l.opts,e,t,l.opts.specialEasing[e]||l.opts.easing);return l.tweens.push(n),n},stop:function(e){var t=0,n=e?l.tweens.length:0;if(a)return this;for(a=!0;t<n;t++)l.tweens[t].run(1);return e?(s.notifyWith(o,[l,1,0]),s.resolveWith(o,[l,e])):s.rejectWith(o,[l,e]),this}}),c=l.props;for(!function(e,t){var n,r,i,o,a;for(n in e)if(i=t[r=X(n)],o=e[n],Array.isArray(o)&&(i=o[1],o=e[n]=o[0]),n!==r&&(e[r]=o,delete e[n]),(a=S.cssHooks[r])&&"expand"in a)for(n in o=a.expand(o),delete e[r],o)n in e||(e[n]=o[n],t[n]=i);else t[r]=i}(c,l.opts.specialEasing);r<i;r++)if(n=lt.prefilters[r].call(l,o,c,l.opts))return m(n.stop)&&(S._queueHooks(l.elem,l.opts.queue).stop=n.stop.bind(n)),n;return S.map(c,ut,l),m(l.opts.start)&&l.opts.start.call(o,l),l.progress(l.opts.progress).done(l.opts.done,l.opts.complete).fail(l.opts.fail).always(l.opts.always),S.fx.timer(S.extend(u,{elem:o,anim:l,queue:l.opts.queue})),l}S.Animation=S.extend(lt,{tweeners:{"*":[function(e,t){var n=this.createTween(e,t);return se(n.elem,e,te.exec(t),n),n}]},tweener:function(e,t){m(e)?(t=e,e=["*"]):e=e.match(P);for(var n,r=0,i=e.length;r<i;r++)n=e[r],lt.tweeners[n]=lt.tweeners[n]||[],lt.tweeners[n].unshift(t)},prefilters:[function(e,t,n){var r,i,o,a,s,u,l,c,f="width"in t||"height"in t,p=this,d={},h=e.style,g=e.nodeType&&ae(e),v=Y.get(e,"fxshow");for(r in n.queue||(null==(a=S._queueHooks(e,"fx")).unqueued&&(a.unqueued=0,s=a.empty.fire,a.empty.fire=function(){a.unqueued||s()}),a.unqueued++,p.always(function(){p.always(function(){a.unqueued--,S.queue(e,"fx").length||a.empty.fire()})})),t)if(i=t[r],rt.test(i)){if(delete t[r],o=o||"toggle"===i,i===(g?"hide":"show")){if("show"!==i||!v||void 0===v[r])continue;g=!0}d[r]=v&&v[r]||S.style(e,r)}if((u=!S.isEmptyObject(t))||!S.isEmptyObject(d))for(r in f&&1===e.nodeType&&(n.overflow=[h.overflow,h.overflowX,h.overflowY],null==(l=v&&v.display)&&(l=Y.get(e,"display")),"none"===(c=S.css(e,"display"))&&(l?c=l:(le([e],!0),l=e.style.display||l,c=S.css(e,"display"),le([e]))),("inline"===c||"inline-block"===c&&null!=l)&&"none"===S.css(e,"float")&&(u||(p.done(function(){h.display=l}),null==l&&(c=h.display,l="none"===c?"":c)),h.display="inline-block")),n.overflow&&(h.overflow="hidden",p.always(function(){h.overflow=n.overflow[0],h.overflowX=n.overflow[1],h.overflowY=n.overflow[2]})),u=!1,d)u||(v?"hidden"in v&&(g=v.hidden):v=Y.access(e,"fxshow",{display:l}),o&&(v.hidden=!g),g&&le([e],!0),p.done(function(){for(r in g||le([e]),Y.remove(e,"fxshow"),d)S.style(e,r,d[r])})),u=ut(g?v[r]:0,r,p),r in v||(v[r]=u.start,g&&(u.end=u.start,u.start=0))}],prefilter:function(e,t){t?lt.prefilters.unshift(e):lt.prefilters.push(e)}}),S.speed=function(e,t,n){var r=e&&"object"==typeof e?S.extend({},e):{complete:n||!n&&t||m(e)&&e,duration:e,easing:n&&t||t&&!m(t)&&t};return S.fx.off?r.duration=0:"number"!=typeof r.duration&&(r.duration in S.fx.speeds?r.duration=S.fx.speeds[r.duration]:r.duration=S.fx.speeds._default),null!=r.queue&&!0!==r.queue||(r.queue="fx"),r.old=r.complete,r.complete=function(){m(r.old)&&r.old.call(this),r.queue&&S.dequeue(this,r.queue)},r},S.fn.extend({fadeTo:function(e,t,n,r){return this.filter(ae).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(t,e,n,r){var i=S.isEmptyObject(t),o=S.speed(e,n,r),a=function(){var e=lt(this,S.extend({},t),o);(i||Y.get(this,"finish"))&&e.stop(!0)};return a.finish=a,i||!1===o.queue?this.each(a):this.queue(o.queue,a)},stop:function(i,e,o){var a=function(e){var t=e.stop;delete e.stop,t(o)};return"string"!=typeof i&&(o=e,e=i,i=void 0),e&&this.queue(i||"fx",[]),this.each(function(){var e=!0,t=null!=i&&i+"queueHooks",n=S.timers,r=Y.get(this);if(t)r[t]&&r[t].stop&&a(r[t]);else for(t in r)r[t]&&r[t].stop&&it.test(t)&&a(r[t]);for(t=n.length;t--;)n[t].elem!==this||null!=i&&n[t].queue!==i||(n[t].anim.stop(o),e=!1,n.splice(t,1));!e&&o||S.dequeue(this,i)})},finish:function(a){return!1!==a&&(a=a||"fx"),this.each(function(){var e,t=Y.get(this),n=t[a+"queue"],r=t[a+"queueHooks"],i=S.timers,o=n?n.length:0;for(t.finish=!0,S.queue(this,a,[]),r&&r.stop&&r.stop.call(this,!0),e=i.length;e--;)i[e].elem===this&&i[e].queue===a&&(i[e].anim.stop(!0),i.splice(e,1));for(e=0;e<o;e++)n[e]&&n[e].finish&&n[e].finish.call(this);delete t.finish})}}),S.each(["toggle","show","hide"],function(e,r){var i=S.fn[r];S.fn[r]=function(e,t,n){return null==e||"boolean"==typeof e?i.apply(this,arguments):this.animate(st(r,!0),e,t,n)}}),S.each({slideDown:st("show"),slideUp:st("hide"),slideToggle:st("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,r){S.fn[e]=function(e,t,n){return this.animate(r,e,t,n)}}),S.timers=[],S.fx.tick=function(){var e,t=0,n=S.timers;for(Ze=Date.now();t<n.length;t++)(e=n[t])()||n[t]!==e||n.splice(t--,1);n.length||S.fx.stop(),Ze=void 0},S.fx.timer=function(e){S.timers.push(e),S.fx.start()},S.fx.interval=13,S.fx.start=function(){et||(et=!0,ot())},S.fx.stop=function(){et=null},S.fx.speeds={slow:600,fast:200,_default:400},S.fn.delay=function(r,e){return r=S.fx&&S.fx.speeds[r]||r,e=e||"fx",this.queue(e,function(e,t){var n=C.setTimeout(e,r);t.stop=function(){C.clearTimeout(n)}})},tt=E.createElement("input"),nt=E.createElement("select").appendChild(E.createElement("option")),tt.type="checkbox",y.checkOn=""!==tt.value,y.optSelected=nt.selected,(tt=E.createElement("input")).value="t",tt.type="radio",y.radioValue="t"===tt.value;var ct,ft=S.expr.attrHandle;S.fn.extend({attr:function(e,t){return $(this,S.attr,e,t,1<arguments.length)},removeAttr:function(e){return this.each(function(){S.removeAttr(this,e)})}}),S.extend({attr:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return"undefined"==typeof e.getAttribute?S.prop(e,t,n):(1===o&&S.isXMLDoc(e)||(i=S.attrHooks[t.toLowerCase()]||(S.expr.match.bool.test(t)?ct:void 0)),void 0!==n?null===n?void S.removeAttr(e,t):i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:(e.setAttribute(t,n+""),n):i&&"get"in i&&null!==(r=i.get(e,t))?r:null==(r=S.find.attr(e,t))?void 0:r)},attrHooks:{type:{set:function(e,t){if(!y.radioValue&&"radio"===t&&A(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},removeAttr:function(e,t){var n,r=0,i=t&&t.match(P);if(i&&1===e.nodeType)while(n=i[r++])e.removeAttribute(n)}}),ct={set:function(e,t,n){return!1===t?S.removeAttr(e,n):e.setAttribute(n,n),n}},S.each(S.expr.match.bool.source.match(/\w+/g),function(e,t){var a=ft[t]||S.find.attr;ft[t]=function(e,t,n){var r,i,o=t.toLowerCase();return n||(i=ft[o],ft[o]=r,r=null!=a(e,t,n)?o:null,ft[o]=i),r}});var pt=/^(?:input|select|textarea|button)$/i,dt=/^(?:a|area)$/i;function ht(e){return(e.match(P)||[]).join(" ")}function gt(e){return e.getAttribute&&e.getAttribute("class")||""}function vt(e){return Array.isArray(e)?e:"string"==typeof e&&e.match(P)||[]}S.fn.extend({prop:function(e,t){return $(this,S.prop,e,t,1<arguments.length)},removeProp:function(e){return this.each(function(){delete this[S.propFix[e]||e]})}}),S.extend({prop:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return 1===o&&S.isXMLDoc(e)||(t=S.propFix[t]||t,i=S.propHooks[t]),void 0!==n?i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:e[t]=n:i&&"get"in i&&null!==(r=i.get(e,t))?r:e[t]},propHooks:{tabIndex:{get:function(e){var t=S.find.attr(e,"tabindex");return t?parseInt(t,10):pt.test(e.nodeName)||dt.test(e.nodeName)&&e.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),y.optSelected||(S.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null},set:function(e){var t=e.parentNode;t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex)}}),S.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){S.propFix[this.toLowerCase()]=this}),S.fn.extend({addClass:function(t){var e,n,r,i,o,a,s,u=0;if(m(t))return this.each(function(e){S(this).addClass(t.call(this,e,gt(this)))});if((e=vt(t)).length)while(n=this[u++])if(i=gt(n),r=1===n.nodeType&&" "+ht(i)+" "){a=0;while(o=e[a++])r.indexOf(" "+o+" ")<0&&(r+=o+" ");i!==(s=ht(r))&&n.setAttribute("class",s)}return this},removeClass:function(t){var e,n,r,i,o,a,s,u=0;if(m(t))return this.each(function(e){S(this).removeClass(t.call(this,e,gt(this)))});if(!arguments.length)return this.attr("class","");if((e=vt(t)).length)while(n=this[u++])if(i=gt(n),r=1===n.nodeType&&" "+ht(i)+" "){a=0;while(o=e[a++])while(-1<r.indexOf(" "+o+" "))r=r.replace(" "+o+" "," ");i!==(s=ht(r))&&n.setAttribute("class",s)}return this},toggleClass:function(i,t){var o=typeof i,a="string"===o||Array.isArray(i);return"boolean"==typeof t&&a?t?this.addClass(i):this.removeClass(i):m(i)?this.each(function(e){S(this).toggleClass(i.call(this,e,gt(this),t),t)}):this.each(function(){var e,t,n,r;if(a){t=0,n=S(this),r=vt(i);while(e=r[t++])n.hasClass(e)?n.removeClass(e):n.addClass(e)}else void 0!==i&&"boolean"!==o||((e=gt(this))&&Y.set(this,"__className__",e),this.setAttribute&&this.setAttribute("class",e||!1===i?"":Y.get(this,"__className__")||""))})},hasClass:function(e){var t,n,r=0;t=" "+e+" ";while(n=this[r++])if(1===n.nodeType&&-1<(" "+ht(gt(n))+" ").indexOf(t))return!0;return!1}});var yt=/\r/g;S.fn.extend({val:function(n){var r,e,i,t=this[0];return arguments.length?(i=m(n),this.each(function(e){var t;1===this.nodeType&&(null==(t=i?n.call(this,e,S(this).val()):n)?t="":"number"==typeof t?t+="":Array.isArray(t)&&(t=S.map(t,function(e){return null==e?"":e+""})),(r=S.valHooks[this.type]||S.valHooks[this.nodeName.toLowerCase()])&&"set"in r&&void 0!==r.set(this,t,"value")||(this.value=t))})):t?(r=S.valHooks[t.type]||S.valHooks[t.nodeName.toLowerCase()])&&"get"in r&&void 0!==(e=r.get(t,"value"))?e:"string"==typeof(e=t.value)?e.replace(yt,""):null==e?"":e:void 0}}),S.extend({valHooks:{option:{get:function(e){var t=S.find.attr(e,"value");return null!=t?t:ht(S.text(e))}},select:{get:function(e){var t,n,r,i=e.options,o=e.selectedIndex,a="select-one"===e.type,s=a?null:[],u=a?o+1:i.length;for(r=o<0?u:a?o:0;r<u;r++)if(((n=i[r]).selected||r===o)&&!n.disabled&&(!n.parentNode.disabled||!A(n.parentNode,"optgroup"))){if(t=S(n).val(),a)return t;s.push(t)}return s},set:function(e,t){var n,r,i=e.options,o=S.makeArray(t),a=i.length;while(a--)((r=i[a]).selected=-1<S.inArray(S.valHooks.option.get(r),o))&&(n=!0);return n||(e.selectedIndex=-1),o}}}}),S.each(["radio","checkbox"],function(){S.valHooks[this]={set:function(e,t){if(Array.isArray(t))return e.checked=-1<S.inArray(S(e).val(),t)}},y.checkOn||(S.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})}),y.focusin="onfocusin"in C;var mt=/^(?:focusinfocus|focusoutblur)$/,xt=function(e){e.stopPropagation()};S.extend(S.event,{trigger:function(e,t,n,r){var i,o,a,s,u,l,c,f,p=[n||E],d=v.call(e,"type")?e.type:e,h=v.call(e,"namespace")?e.namespace.split("."):[];if(o=f=a=n=n||E,3!==n.nodeType&&8!==n.nodeType&&!mt.test(d+S.event.triggered)&&(-1<d.indexOf(".")&&(d=(h=d.split(".")).shift(),h.sort()),u=d.indexOf(":")<0&&"on"+d,(e=e[S.expando]?e:new S.Event(d,"object"==typeof e&&e)).isTrigger=r?2:3,e.namespace=h.join("."),e.rnamespace=e.namespace?new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,e.result=void 0,e.target||(e.target=n),t=null==t?[e]:S.makeArray(t,[e]),c=S.event.special[d]||{},r||!c.trigger||!1!==c.trigger.apply(n,t))){if(!r&&!c.noBubble&&!x(n)){for(s=c.delegateType||d,mt.test(s+d)||(o=o.parentNode);o;o=o.parentNode)p.push(o),a=o;a===(n.ownerDocument||E)&&p.push(a.defaultView||a.parentWindow||C)}i=0;while((o=p[i++])&&!e.isPropagationStopped())f=o,e.type=1<i?s:c.bindType||d,(l=(Y.get(o,"events")||Object.create(null))[e.type]&&Y.get(o,"handle"))&&l.apply(o,t),(l=u&&o[u])&&l.apply&&V(o)&&(e.result=l.apply(o,t),!1===e.result&&e.preventDefault());return e.type=d,r||e.isDefaultPrevented()||c._default&&!1!==c._default.apply(p.pop(),t)||!V(n)||u&&m(n[d])&&!x(n)&&((a=n[u])&&(n[u]=null),S.event.triggered=d,e.isPropagationStopped()&&f.addEventListener(d,xt),n[d](),e.isPropagationStopped()&&f.removeEventListener(d,xt),S.event.triggered=void 0,a&&(n[u]=a)),e.result}},simulate:function(e,t,n){var r=S.extend(new S.Event,n,{type:e,isSimulated:!0});S.event.trigger(r,null,t)}}),S.fn.extend({trigger:function(e,t){return this.each(function(){S.event.trigger(e,t,this)})},triggerHandler:function(e,t){var n=this[0];if(n)return S.event.trigger(e,t,n,!0)}}),y.focusin||S.each({focus:"focusin",blur:"focusout"},function(n,r){var i=function(e){S.event.simulate(r,e.target,S.event.fix(e))};S.event.special[r]={setup:function(){var e=this.ownerDocument||this.document||this,t=Y.access(e,r);t||e.addEventListener(n,i,!0),Y.access(e,r,(t||0)+1)},teardown:function(){var e=this.ownerDocument||this.document||this,t=Y.access(e,r)-1;t?Y.access(e,r,t):(e.removeEventListener(n,i,!0),Y.remove(e,r))}}});var bt=C.location,wt={guid:Date.now()},Tt=/\?/;S.parseXML=function(e){var t,n;if(!e||"string"!=typeof e)return null;try{t=(new C.DOMParser).parseFromString(e,"text/xml")}catch(e){}return n=t&&t.getElementsByTagName("parsererror")[0],t&&!n||S.error("Invalid XML: "+(n?S.map(n.childNodes,function(e){return e.textContent}).join("\n"):e)),t};var Ct=/\[\]$/,Et=/\r?\n/g,St=/^(?:submit|button|image|reset|file)$/i,kt=/^(?:input|select|textarea|keygen)/i;function At(n,e,r,i){var t;if(Array.isArray(e))S.each(e,function(e,t){r||Ct.test(n)?i(n,t):At(n+"["+("object"==typeof t&&null!=t?e:"")+"]",t,r,i)});else if(r||"object"!==w(e))i(n,e);else for(t in e)At(n+"["+t+"]",e[t],r,i)}S.param=function(e,t){var n,r=[],i=function(e,t){var n=m(t)?t():t;r[r.length]=encodeURIComponent(e)+"="+encodeURIComponent(null==n?"":n)};if(null==e)return"";if(Array.isArray(e)||e.jquery&&!S.isPlainObject(e))S.each(e,function(){i(this.name,this.value)});else for(n in e)At(n,e[n],t,i);return r.join("&")},S.fn.extend({serialize:function(){return S.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=S.prop(this,"elements");return e?S.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!S(this).is(":disabled")&&kt.test(this.nodeName)&&!St.test(e)&&(this.checked||!pe.test(e))}).map(function(e,t){var n=S(this).val();return null==n?null:Array.isArray(n)?S.map(n,function(e){return{name:t.name,value:e.replace(Et,"\r\n")}}):{name:t.name,value:n.replace(Et,"\r\n")}}).get()}});var Nt=/%20/g,jt=/#.*$/,Dt=/([?&])_=[^&]*/,qt=/^(.*?):[ \t]*([^\r\n]*)$/gm,Lt=/^(?:GET|HEAD)$/,Ht=/^\/\//,Ot={},Pt={},Rt="*/".concat("*"),Mt=E.createElement("a");function It(o){return function(e,t){"string"!=typeof e&&(t=e,e="*");var n,r=0,i=e.toLowerCase().match(P)||[];if(m(t))while(n=i[r++])"+"===n[0]?(n=n.slice(1)||"*",(o[n]=o[n]||[]).unshift(t)):(o[n]=o[n]||[]).push(t)}}function Wt(t,i,o,a){var s={},u=t===Pt;function l(e){var r;return s[e]=!0,S.each(t[e]||[],function(e,t){var n=t(i,o,a);return"string"!=typeof n||u||s[n]?u?!(r=n):void 0:(i.dataTypes.unshift(n),l(n),!1)}),r}return l(i.dataTypes[0])||!s["*"]&&l("*")}function Ft(e,t){var n,r,i=S.ajaxSettings.flatOptions||{};for(n in t)void 0!==t[n]&&((i[n]?e:r||(r={}))[n]=t[n]);return r&&S.extend(!0,e,r),e}Mt.href=bt.href,S.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:bt.href,type:"GET",isLocal:/^(?:about|app|app-storage|.+-extension|file|res|widget):$/.test(bt.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Rt,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":S.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?Ft(Ft(e,S.ajaxSettings),t):Ft(S.ajaxSettings,e)},ajaxPrefilter:It(Ot),ajaxTransport:It(Pt),ajax:function(e,t){"object"==typeof e&&(t=e,e=void 0),t=t||{};var c,f,p,n,d,r,h,g,i,o,v=S.ajaxSetup({},t),y=v.context||v,m=v.context&&(y.nodeType||y.jquery)?S(y):S.event,x=S.Deferred(),b=S.Callbacks("once memory"),w=v.statusCode||{},a={},s={},u="canceled",T={readyState:0,getResponseHeader:function(e){var t;if(h){if(!n){n={};while(t=qt.exec(p))n[t[1].toLowerCase()+" "]=(n[t[1].toLowerCase()+" "]||[]).concat(t[2])}t=n[e.toLowerCase()+" "]}return null==t?null:t.join(", ")},getAllResponseHeaders:function(){return h?p:null},setRequestHeader:function(e,t){return null==h&&(e=s[e.toLowerCase()]=s[e.toLowerCase()]||e,a[e]=t),this},overrideMimeType:function(e){return null==h&&(v.mimeType=e),this},statusCode:function(e){var t;if(e)if(h)T.always(e[T.status]);else for(t in e)w[t]=[w[t],e[t]];return this},abort:function(e){var t=e||u;return c&&c.abort(t),l(0,t),this}};if(x.promise(T),v.url=((e||v.url||bt.href)+"").replace(Ht,bt.protocol+"//"),v.type=t.method||t.type||v.method||v.type,v.dataTypes=(v.dataType||"*").toLowerCase().match(P)||[""],null==v.crossDomain){r=E.createElement("a");try{r.href=v.url,r.href=r.href,v.crossDomain=Mt.protocol+"//"+Mt.host!=r.protocol+"//"+r.host}catch(e){v.crossDomain=!0}}if(v.data&&v.processData&&"string"!=typeof v.data&&(v.data=S.param(v.data,v.traditional)),Wt(Ot,v,t,T),h)return T;for(i in(g=S.event&&v.global)&&0==S.active++&&S.event.trigger("ajaxStart"),v.type=v.type.toUpperCase(),v.hasContent=!Lt.test(v.type),f=v.url.replace(jt,""),v.hasContent?v.data&&v.processData&&0===(v.contentType||"").indexOf("application/x-www-form-urlencoded")&&(v.data=v.data.replace(Nt,"+")):(o=v.url.slice(f.length),v.data&&(v.processData||"string"==typeof v.data)&&(f+=(Tt.test(f)?"&":"?")+v.data,delete v.data),!1===v.cache&&(f=f.replace(Dt,"$1"),o=(Tt.test(f)?"&":"?")+"_="+wt.guid+++o),v.url=f+o),v.ifModified&&(S.lastModified[f]&&T.setRequestHeader("If-Modified-Since",S.lastModified[f]),S.etag[f]&&T.setRequestHeader("If-None-Match",S.etag[f])),(v.data&&v.hasContent&&!1!==v.contentType||t.contentType)&&T.setRequestHeader("Content-Type",v.contentType),T.setRequestHeader("Accept",v.dataTypes[0]&&v.accepts[v.dataTypes[0]]?v.accepts[v.dataTypes[0]]+("*"!==v.dataTypes[0]?", "+Rt+"; q=0.01":""):v.accepts["*"]),v.headers)T.setRequestHeader(i,v.headers[i]);if(v.beforeSend&&(!1===v.beforeSend.call(y,T,v)||h))return T.abort();if(u="abort",b.add(v.complete),T.done(v.success),T.fail(v.error),c=Wt(Pt,v,t,T)){if(T.readyState=1,g&&m.trigger("ajaxSend",[T,v]),h)return T;v.async&&0<v.timeout&&(d=C.setTimeout(function(){T.abort("timeout")},v.timeout));try{h=!1,c.send(a,l)}catch(e){if(h)throw e;l(-1,e)}}else l(-1,"No Transport");function l(e,t,n,r){var i,o,a,s,u,l=t;h||(h=!0,d&&C.clearTimeout(d),c=void 0,p=r||"",T.readyState=0<e?4:0,i=200<=e&&e<300||304===e,n&&(s=function(e,t,n){var r,i,o,a,s=e.contents,u=e.dataTypes;while("*"===u[0])u.shift(),void 0===r&&(r=e.mimeType||t.getResponseHeader("Content-Type"));if(r)for(i in s)if(s[i]&&s[i].test(r)){u.unshift(i);break}if(u[0]in n)o=u[0];else{for(i in n){if(!u[0]||e.converters[i+" "+u[0]]){o=i;break}a||(a=i)}o=o||a}if(o)return o!==u[0]&&u.unshift(o),n[o]}(v,T,n)),!i&&-1<S.inArray("script",v.dataTypes)&&S.inArray("json",v.dataTypes)<0&&(v.converters["text script"]=function(){}),s=function(e,t,n,r){var i,o,a,s,u,l={},c=e.dataTypes.slice();if(c[1])for(a in e.converters)l[a.toLowerCase()]=e.converters[a];o=c.shift();while(o)if(e.responseFields[o]&&(n[e.responseFields[o]]=t),!u&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),u=o,o=c.shift())if("*"===o)o=u;else if("*"!==u&&u!==o){if(!(a=l[u+" "+o]||l["* "+o]))for(i in l)if((s=i.split(" "))[1]===o&&(a=l[u+" "+s[0]]||l["* "+s[0]])){!0===a?a=l[i]:!0!==l[i]&&(o=s[0],c.unshift(s[1]));break}if(!0!==a)if(a&&e["throws"])t=a(t);else try{t=a(t)}catch(e){return{state:"parsererror",error:a?e:"No conversion from "+u+" to "+o}}}return{state:"success",data:t}}(v,s,T,i),i?(v.ifModified&&((u=T.getResponseHeader("Last-Modified"))&&(S.lastModified[f]=u),(u=T.getResponseHeader("etag"))&&(S.etag[f]=u)),204===e||"HEAD"===v.type?l="nocontent":304===e?l="notmodified":(l=s.state,o=s.data,i=!(a=s.error))):(a=l,!e&&l||(l="error",e<0&&(e=0))),T.status=e,T.statusText=(t||l)+"",i?x.resolveWith(y,[o,l,T]):x.rejectWith(y,[T,l,a]),T.statusCode(w),w=void 0,g&&m.trigger(i?"ajaxSuccess":"ajaxError",[T,v,i?o:a]),b.fireWith(y,[T,l]),g&&(m.trigger("ajaxComplete",[T,v]),--S.active||S.event.trigger("ajaxStop")))}return T},getJSON:function(e,t,n){return S.get(e,t,n,"json")},getScript:function(e,t){return S.get(e,void 0,t,"script")}}),S.each(["get","post"],function(e,i){S[i]=function(e,t,n,r){return m(t)&&(r=r||n,n=t,t=void 0),S.ajax(S.extend({url:e,type:i,dataType:r,data:t,success:n},S.isPlainObject(e)&&e))}}),S.ajaxPrefilter(function(e){var t;for(t in e.headers)"content-type"===t.toLowerCase()&&(e.contentType=e.headers[t]||"")}),S._evalUrl=function(e,t,n){return S.ajax({url:e,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,converters:{"text script":function(){}},dataFilter:function(e){S.globalEval(e,t,n)}})},S.fn.extend({wrapAll:function(e){var t;return this[0]&&(m(e)&&(e=e.call(this[0])),t=S(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstElementChild)e=e.firstElementChild;return e}).append(this)),this},wrapInner:function(n){return m(n)?this.each(function(e){S(this).wrapInner(n.call(this,e))}):this.each(function(){var e=S(this),t=e.contents();t.length?t.wrapAll(n):e.append(n)})},wrap:function(t){var n=m(t);return this.each(function(e){S(this).wrapAll(n?t.call(this,e):t)})},unwrap:function(e){return this.parent(e).not("body").each(function(){S(this).replaceWith(this.childNodes)}),this}}),S.expr.pseudos.hidden=function(e){return!S.expr.pseudos.visible(e)},S.expr.pseudos.visible=function(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)},S.ajaxSettings.xhr=function(){try{return new C.XMLHttpRequest}catch(e){}};var Bt={0:200,1223:204},$t=S.ajaxSettings.xhr();y.cors=!!$t&&"withCredentials"in $t,y.ajax=$t=!!$t,S.ajaxTransport(function(i){var o,a;if(y.cors||$t&&!i.crossDomain)return{send:function(e,t){var n,r=i.xhr();if(r.open(i.type,i.url,i.async,i.username,i.password),i.xhrFields)for(n in i.xhrFields)r[n]=i.xhrFields[n];for(n in i.mimeType&&r.overrideMimeType&&r.overrideMimeType(i.mimeType),i.crossDomain||e["X-Requested-With"]||(e["X-Requested-With"]="XMLHttpRequest"),e)r.setRequestHeader(n,e[n]);o=function(e){return function(){o&&(o=a=r.onload=r.onerror=r.onabort=r.ontimeout=r.onreadystatechange=null,"abort"===e?r.abort():"error"===e?"number"!=typeof r.status?t(0,"error"):t(r.status,r.statusText):t(Bt[r.status]||r.status,r.statusText,"text"!==(r.responseType||"text")||"string"!=typeof r.responseText?{binary:r.response}:{text:r.responseText},r.getAllResponseHeaders()))}},r.onload=o(),a=r.onerror=r.ontimeout=o("error"),void 0!==r.onabort?r.onabort=a:r.onreadystatechange=function(){4===r.readyState&&C.setTimeout(function(){o&&a()})},o=o("abort");try{r.send(i.hasContent&&i.data||null)}catch(e){if(o)throw e}},abort:function(){o&&o()}}}),S.ajaxPrefilter(function(e){e.crossDomain&&(e.contents.script=!1)}),S.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(e){return S.globalEval(e),e}}}),S.ajaxPrefilter("script",function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type="GET")}),S.ajaxTransport("script",function(n){var r,i;if(n.crossDomain||n.scriptAttrs)return{send:function(e,t){r=S("<script>").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="<form></form><form></form>",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<s&&(r=ht(e.slice(s)),e=e.slice(0,s)),m(t)?(n=t,t=void 0):t&&"object"==typeof t&&(i="POST"),0<a.length&&S.ajax({url:e,type:i||"GET",dataType:"html",data:t}).done(function(e){o=arguments,a.html(r?S("<div>").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<arguments.length?this.on(n,null,e,t):this.trigger(n)}});var Xt=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;S.proxy=function(e,t){var n,r,i;if("string"==typeof t&&(n=e[t],t=e,e=n),m(e))return r=s.call(arguments,2),(i=function(){return e.apply(t||this,r.concat(s.call(arguments)))}).guid=e.guid=e.guid||S.guid++,i},S.holdReady=function(e){e?S.readyWait++:S.ready(!0)},S.isArray=Array.isArray,S.parseJSON=JSON.parse,S.nodeName=A,S.isFunction=m,S.isWindow=x,S.camelCase=X,S.type=w,S.now=Date.now,S.isNumeric=function(e){var t=S.type(e);return("number"===t||"string"===t)&&!isNaN(e-parseFloat(e))},S.trim=function(e){return null==e?"":(e+"").replace(Xt,"")},"function"==typeof define&&define.amd&&define("jquery",[],function(){return S});var Vt=C.jQuery,Gt=C.$;return S.noConflict=function(e){return C.$===S&&(C.$=Gt),e&&C.jQuery===S&&(C.jQuery=Vt),S},"undefined"==typeof e&&(C.jQuery=C.$=S),S});
4 5/** 6 * Ajax Autocomplete for jQuery, version 1.4.11 7 * (c) 2017 Tomas Kirda 8 * 9 * Ajax Autocomplete for jQuery is freely distributable under the terms of an MIT-style license. 10 * For details, see the web site: https://github.com/devbridge/jQuery-Autocomplete 11 */ 12!function(t){"use strict";"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof exports&&"function"==typeof require?t(require("jquery")):t(jQuery)}(function(t){"use strict";var e={escapeRegExChars:function(t){return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&")},createNode:function(t){var e=document.createElement("div");return e.className=t,e.style.position="absolute",e.style.display="none",e}},s=27,i=9,n=13,o=38,a=39,u=40,l=t.noop;function r(e,s){this.element=e,this.el=t(e),this.suggestions=[],this.badQueries=[],this.selectedIndex=-1,this.currentValue=this.element.value,this.timeoutId=null,this.cachedResponse={},this.onChangeTimeout=null,this.onChange=null,this.isLocal=!1,this.suggestionsContainer=null,this.noSuggestionsContainer=null,this.options=t.extend(!0,{},r.defaults,s),this.classes={selected:"autocomplete-selected",suggestion:"autocomplete-suggestion"},this.hint=null,this.hintValue="",this.selection=null,this.initialize(),this.setOptions(s)}r.utils=e,t.Autocomplete=r,r.defaults={ajaxSettings:{},autoSelectFirst:!1,appendTo:"body",serviceUrl:null,lookup:null,onSelect:null,onHint:null,width:"auto",minChars:1,maxHeight:300,deferRequestBy:0,params:{},formatResult:function(t,s){if(!s)return t.value;var i="("+e.escapeRegExChars(s)+")";return t.value.replace(new RegExp(i,"gi"),"<strong>$1</strong>").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/<(\/?strong)>/g,"<$1>")},formatGroup:function(t,e){return'<div class="autocomplete-group">'+e+"</div>"},delimiter:null,zIndex:9999,type:"GET",noCache:!1,onSearchStart:l,onSearchComplete:l,onSearchError:l,preserveInput:!1,containerClass:"autocomplete-suggestions",tabDisabled:!1,dataType:"text",currentRequest:null,triggerSelectOnValidInput:!0,preventBadQueries:!0,lookupFilter:function(t,e,s){return-1!==t.value.toLowerCase().indexOf(s)},paramName:"query",transformResult:function(e){return"string"==typeof e?t.parseJSON(e):e},showNoSuggestionNotice:!1,noSuggestionNotice:"No results",orientation:"bottom",forceFixPosition:!1},r.prototype={initialize:function(){var e,s=this,i="."+s.classes.suggestion,n=s.classes.selected,o=s.options;s.element.setAttribute("autocomplete","off"),s.noSuggestionsContainer=t('<div class="autocomplete-no-suggestion"></div>').html(this.options.noSuggestionNotice).get(0),s.suggestionsContainer=r.utils.createNode(o.containerClass),(e=t(s.suggestionsContainer)).appendTo(o.appendTo||"body"),"auto"!==o.width&&e.css("width",o.width),e.on("mouseover.autocomplete",i,function(){s.activate(t(this).data("index"))}),e.on("mouseout.autocomplete",function(){s.selectedIndex=-1,e.children("."+n).removeClass(n)}),e.on("click.autocomplete",i,function(){s.select(t(this).data("index"))}),e.on("click.autocomplete",function(){clearTimeout(s.blurTimeoutId)}),s.fixPositionCapture=function(){s.visible&&s.fixPosition()},t(window).on("resize.autocomplete",s.fixPositionCapture),s.el.on("keydown.autocomplete",function(t){s.onKeyPress(t)}),s.el.on("keyup.autocomplete",function(t){s.onKeyUp(t)}),s.el.on("blur.autocomplete",function(){s.onBlur()}),s.el.on("focus.autocomplete",function(){s.onFocus()}),s.el.on("change.autocomplete",function(t){s.onKeyUp(t)}),s.el.on("input.autocomplete",function(t){s.onKeyUp(t)})},onFocus:function(){this.disabled||(this.fixPosition(),this.el.val().length>=this.options.minChars&&this.onValueChange())},onBlur:function(){var e=this,s=e.options,i=e.el.val(),n=e.getQuery(i);e.blurTimeoutId=setTimeout(function(){e.hide(),e.selection&&e.currentValue!==n&&(s.onInvalidateSelection||t.noop).call(e.element)},200)},abortAjax:function(){this.currentRequest&&(this.currentRequest.abort(),this.currentRequest=null)},setOptions:function(e){var s=t.extend({},this.options,e);this.isLocal=Array.isArray(s.lookup),this.isLocal&&(s.lookup=this.verifySuggestionsFormat(s.lookup)),s.orientation=this.validateOrientation(s.orientation,"bottom"),t(this.suggestionsContainer).css({"max-height":s.maxHeight+"px",width:s.width+"px","z-index":s.zIndex}),this.options=s},clearCache:function(){this.cachedResponse={},this.badQueries=[]},clear:function(){this.clearCache(),this.currentValue="",this.suggestions=[]},disable:function(){this.disabled=!0,clearTimeout(this.onChangeTimeout),this.abortAjax()},enable:function(){this.disabled=!1},fixPosition:function(){var e=t(this.suggestionsContainer),s=e.parent().get(0);if(s===document.body||this.options.forceFixPosition){var i=this.options.orientation,n=e.outerHeight(),o=this.el.outerHeight(),a=this.el.offset(),u={top:a.top,left
12:a.left};if("auto"===i){var l=t(window).height(),r=t(window).scrollTop(),h=-r+a.top-n,c=r+l-(a.top+o+n);i=Math.max(h,c)===h?"top":"bottom"}if(u.top+="top"===i?-n:o,s!==document.body){var g,d=e.css("opacity");this.visible||e.css("opacity",0).show(),g=e.offsetParent().offset(),u.top-=g.top,u.top+=s.scrollTop,u.left-=g.left,this.visible||e.css("opacity",d).hide()}"auto"===this.options.width&&(u.width=this.el.outerWidth()+"px"),e.css(u)}},isCursorAtEnd:function(){var t,e=this.el.val().length,s=this.element.selectionStart;return"number"==typeof s?s===e:!document.selection||((t=document.selection.createRange()).moveStart("character",-e),e===t.text.length)},onKeyPress:function(t){if(this.disabled||this.visible||t.which!==u||!this.currentValue){if(!this.disabled&&this.visible){switch(t.which){case s:this.el.val(this.currentValue),this.hide();break;case a:if(this.hint&&this.options.onHint&&this.isCursorAtEnd()){this.selectHint();break}return;case i:if(this.hint&&this.options.onHint)return void this.selectHint();if(-1===this.selectedIndex)return void this.hide();if(this.select(this.selectedIndex),!1===this.options.tabDisabled)return;break;case n:if(-1===this.selectedIndex)return void this.hide();this.select(this.selectedIndex);break;case o:this.moveUp();break;case u:this.moveDown();break;default:return}t.stopImmediatePropagation(),t.preventDefault()}}else this.suggest()},onKeyUp:function(t){var e=this;if(!e.disabled){switch(t.which){case o:case u:return}clearTimeout(e.onChangeTimeout),e.currentValue!==e.el.val()&&(e.findBestHint(),e.options.deferRequestBy>0?e.onChangeTimeout=setTimeout(function(){e.onValueChange()},e.options.deferRequestBy):e.onValueChange())}},onValueChange:function(){if(this.ignoreValueChange)this.ignoreValueChange=!1;else{var e=this.options,s=this.el.val(),i=this.getQuery(s);this.selection&&this.currentValue!==i&&(this.selection=null,(e.onInvalidateSelection||t.noop).call(this.element)),clearTimeout(this.onChangeTimeout),this.currentValue=s,this.selectedIndex=-1,e.triggerSelectOnValidInput&&this.isExactMatch(i)?this.select(0):i.length<e.minChars?this.hide():this.getSuggestions(i)}},isExactMatch:function(t){var e=this.suggestions;return 1===e.length&&e[0].value.toLowerCase()===t.toLowerCase()},getQuery:function(e){var s,i=this.options.delimiter;return i?(s=e.split(i),t.trim(s[s.length-1])):e},getSuggestionsLocal:function(e){var s,i=this.options,n=e.toLowerCase(),o=i.lookupFilter,a=parseInt(i.lookupLimit,10);return s={suggestions:t.grep(i.lookup,function(t){return o(t,e,n)})},a&&s.suggestions.length>a&&(s.suggestions=s.suggestions.slice(0,a)),s},getSuggestions:function(e){var s,i,n,o,a=this,u=a.options,l=u.serviceUrl;u.params[u.paramName]=e,!1!==u.onSearchStart.call(a.element,u.params)&&(i=u.ignoreParams?null:u.params,t.isFunction(u.lookup)?u.lookup(e,function(t){a.suggestions=t.suggestions,a.suggest(),u.onSearchComplete.call(a.element,e,t.suggestions)}):(a.isLocal?s=a.getSuggestionsLocal(e):(t.isFunction(l)&&(l=l.call(a.element,e)),n=l+"?"+t.param(i||{}),s=a.cachedResponse[n]),s&&Array.isArray(s.suggestions)?(a.suggestions=s.suggestions,a.suggest(),u.onSearchComplete.call(a.element,e,s.suggestions)):a.isBadQuery(e)?u.onSearchComplete.call(a.element,e,[]):(a.abortAjax(),o={url:l,data:i,type:u.type,dataType:u.dataType},t.extend(o,u.ajaxSettings),a.currentRequest=t.ajax(o).done(function(t){var s;a.currentRequest=null,s=u.transformResult(t,e),a.processResponse(s,e,n),u.onSearchComplete.call(a.element,e,s.suggestions)}).fail(function(t,s,i){u.onSearchError.call(a.element,e,t,s,i)}))))},isBadQuery:function(t){if(!this.options.preventBadQueries)return!1;for(var e=this.badQueries,s=e.length;s--;)if(0===t.indexOf(e[s]))return!0;return!1},hide:function(){var e=t(this.suggestionsContainer);t.isFunction(this.options.onHide)&&this.visible&&this.options.onHide.call(this.element,e),this.visible=!1,this.selectedIndex=-1,clearTimeout(this.onChangeTimeout),t(this.suggestionsContainer).hide(),this.onHint(null)},suggest:function(){if(this.suggestions.length){var e,s=this.options,i=s.groupBy,n=s.formatResult,o=this.getQuery(this.currentValue),a=this.classes.suggestion,u=this.classes.selected,l=t(this.suggestionsContainer),r=t(this.noSuggestionsContainer),h=s.beforeRender,c="";s.triggerSelectOnValidInput&&this.isExactMatch(o)?this.select(0):(t.each(this.suggestions,function(t,u){i&&(c+=function(t,n){var o=t.data[i];return e===o?"":(e=o,s.formatGroup(t,e))}(u,0)),c+='<div class="'+a+'" data-index="'+t+'">'+n(u,o,t)+"</div>"}),this.adjustContainerWidth(),r.detach(),l.html(c),t.isFunction(h)&&h.call(this.element,l,this.suggestions),this.fixPosition(),l.show(),s.autoSelectFirst&&(this.selectedIndex=0,l.scrollTop(0),l.children("."+a).first().addClass(u)),this.visible=!0,this.findBestHint())}else this.options.showNoSuggestionNotice?this.noSuggestions():this.hide()},noSuggestions:function(){var e=this.options.beforeRender,s=t(this.suggestionsContainer),i=t(this.noSuggestionsContainer);this.adjustContainerWidth(),i.detach(),s.empty(),s.append(i),t.isFunction(e)&&e.call(this.element,s,this.suggestions),this.fixPosition(),s.show(),this.visible=!0},adjustContainerWidth:function(){var e,s=this.options,i=t(this.suggestionsContainer);"auto"===s.width?(e=this.el.outerWidth(),i.css("width",e>0?e:300)):"flex"===s.width&&i.css("width","")},findBestHint:function(){var e=this.el.val().toLowerCase(),s=null;e&&(t.each(this.suggestions,function(t,i){var n=0===i.value.toLowerCase().indexOf(e);return n&&(s=i),!n}),this.onHint(s))},onHint:function(e){var s=this.options.onHint,i="";e&&(i=this.currentValue+e.value.substr(this.currentValue.length)),this.hintValue!==i&&(this.hintValue=i,this.hint=e,t.isFunction(s)&&s.call(this.element,i))},verifySuggestionsFormat:function(e){return e.length&&"string"==typeof e[0]?t.map(e,function(t){return{value:t,data:null}}):e},validateOrientation:function(e,s){return e=t.trim(e||"").toLowerCase(),-1===t.inArray(e,["auto","bottom","top"])&&(e=s),e},processResponse:function(t,e,s){var i=this.options;t.suggestions=this.verifySuggestionsFormat(t.suggestions),i.noCache||(this.cachedResponse[s]=t,i.preventBadQueries&&!t.suggestions.length&&this.badQueries.push(e)),e===this.getQuery(this.currentValue)&&(this.suggestions=t.suggestions,this.suggest())},activate:function(e){var s,i=this.classes.selected,n=t(this.suggestionsContainer),o=n.find("."+this.classes.suggestion);return n.find("."+i).removeClass(i),this.selectedIndex=e,-1!==this.selectedIndex&&o.length>this.selectedIndex?(s=o.get(this.selectedIndex),t(s).addClass(i),s):null},selectHint:function(){var e=t.inArray(this.hint,this.suggestions);this.select(e)},select:function(t){this.hide(),this.onSelect(t)},moveUp:function(){if(-1!==this.selectedIndex)return 0===this.selectedIndex?(t(this.suggestionsContainer).children("."+this.classes.suggestion).first().removeClass(this.classes.selected),this.selectedIndex=-1,this.ignoreValueChange=!1,this.el.val(this.currentValue),void this.findBestHint()):void this.adjustScroll(this.selectedIndex-1)},moveDown:function(){this.selectedIndex!==this.suggestions.length-1&&this.adjustScroll(this.selectedIndex+1)},adjustScroll:function(e){var s=this.activate(e);if(s){var i,n,o,a=t(s).outerHeight();i=s.offsetTop,o=(n=t(this.suggestionsContainer).scrollTop())+this.options.maxHeight-a,i<n?t(this.suggestionsContainer).scrollTop(i):i>o&&t(this.suggestionsContainer).scrollTop(i-this.options.maxHeight+a),this.options.preserveInput||(this.ignoreValueChange=!0,this.el.val(this.getValue(this.suggestions[e].value))),this.onHint(null)}},onSelect:function(e){var s=this.options.onSelect,i=this.suggestions[e];this.currentValue=this.getValue(i.value),this.currentValue===this.el.val()||this.options.preserveInput||this.el.val(this.currentValue),this.onHint(null),this.suggestions=[],this.selection=i,t.isFunction(s)&&s.call(this.element,i)},getValue:function(t){var e,s,i=this.options.delimiter;return i?1===(s=(e=this.currentValue).split(i)).length?t:e.substr(0,e.length-s[s.length-1].length)+t:t},dispose:function(){this.el.off(".autocomplete").removeData("autocomplete"),t(window).off("resize.autocomplete",this.fixPositionCapture),t(this.suggestionsContainer).remove()}},t.fn.devbridgeAutocomplete=function(e,s){return arguments.length?this.each(function(){var i=t(this),n=i.data("autocomplete");"string"==typeof e?n&&"function"==typeof n[e]&&n[e](s):(n&&n.dispose&&n.dispose(),n=new r(this,e),i.data("autocomplete",n))}):this.first().data("autocomplete")}
12,t.fn.autocomplete||(t.fn.autocomplete=t.fn.devbridgeAutocomplete)}); 13 14function SuggestController() { 15 16 this.init = function () { 17 18 jQuery('form[data-suggest]').each(function () { 19 var $form = $(this), $searchBox = $form.find('.tx-solr-suggest'), $formAutoComplete; 20 21 if ($form.find('.tx-solr-autocomplete').length > 0){ 22 $formAutoComplete = $form.find('.tx-solr-autocomplete'); 23 } else { 24 $formAutoComplete = $('body'); 25 } 26 27 // when no specific container found, use the form as container 28 if ($searchBox.length === 0) { 29 $searchBox = $form; 30 } 31 $searchBox.css('position', 'relative'); 32 33 $form.find('.tx-solr-suggest-focus').focus(); 34 35 // Prevent submit of empty search form 36 $form.on('submit', function (e) { 37 if ($form.find('.tx-solr-suggest-focus').val() === '') { 38 e.preventDefault(); 39 $form.find('.tx-solr-suggest-focus').focus(); 40 } 41 }); 42 43 $form.find('.tx-solr-suggest').devbridgeAutocomplete({ 44 serviceUrl: $form.data('suggest'), 45 dataType: 'json', 46 paramName: 'tx_solr[queryString]', 47 groupBy: 'category', 48 maxHeight: 1000, 49 appendTo: $formAutoComplete, 50 autoSelectFirst: false, 51 triggerSelectOnValidInput: false, 52 width: $searchBox.outerWidth() * 0.66, 53 onSelect: function (suggestion) { 54 // go to link when selecting found result 55 if (suggestion.data.link) { 56 // Open youtube in overlay 57 if (suggestion.data.link.indexOf('https://www.youtube.com') === 0) { 58 openVideoOverlay(suggestion.data.link); 59 } else { 60 location.href = suggestion.data.link; 61 } 62 // else trigger form submit (do search) 63 } else { 64 $form.trigger('submit'); 65 } 66 }, 67 transformResult: function (response) { 68 if (!response.suggestions) return {suggestions: []}; 69 var firstSuggestion, result = { 70 suggestions: $.map(response.suggestions, function (count, suggestion) { 71 if (!firstSuggestion) firstSuggestion = suggestion; 72 return {value: suggestion, data: {category: 'suggestion', count: count}}; 73 }) 74 }; 75 76 $.each(response.documents, function (key, value) { 77 var dataObject = value; 78 79 var defaultGroup = $form.data('suggest-header') ? $form.data('suggest-header') : 'Top results'; 80 dataObject.category = defaultGroup; 81 82 // if a group is set we try to get a label 83 if(dataObject.group) { 84 dataObject.category = $form.data('suggest-header-' + dataObject.group) ? $form.data('suggest-header-' + dataObject.group) : dataObject.group; 85 } 86 87 result.suggestions.push( 88 { 89 value: firstSuggestion, 90 data: dataObject 91 } 92 ); 93 }); 94 95 return result; 96 }, 97 beforeRender: function (container) { 98 // remove first group header 99 container.find('.autocomplete-group:first').remove(); 100 container.addClass('tx-solr-autosuggest'); 101 102 // add active class to container 103 $searchBox.parent().addClass('autocomplete-active').fadeIn(); 104 }, 105 formatResult: function (suggestion, currentValue) {
106 // Do not replace anything if there current value is empty 107 if (!currentValue) { 108 return suggestion.value; 109 } 110 var pattern = '(' + $.Autocomplete.utils.escapeRegExChars(currentValue.trim()) + ')'; 111 // normal suggestion 112 if (suggestion.data.category === 'suggestion') { 113 return suggestion.value 114 .replace(new RegExp(pattern, 'gi'), '<strong>$1<\/strong>') 115 .replace(/&/g, '&') 116 .replace(/</g, '<') 117 .replace(/>/g, '>') 118 .replace(/"/g, '"') 119 .replace(/<(\/?strong)>/g, '<$1>'); 120 121 // results 122 } else { 123 var title = suggestion.data.title 124 .replace(new RegExp(pattern, 'gi'), '<em>$1<\/em>') 125 .replace(/&/g, '&') 126 .replace(/</g, '<') 127 .replace(/>/g, '>') 128 .replace(/"/g, '"') 129 .replace(/<(\/?em)>/g, '<$1>'); 130 131 return '<div class="' + suggestion.data.type + '">' + 132 (!!suggestion.data.previewImage ? '<figure ' + (!!suggestion.data.hasVideo ? 'class="hasVideo"' : '') + '>
132<img src="' + suggestion.data.previewImage + '" /></figure>' : '') + 133 '<a href="' + suggestion.data.link + '" class="internal-link">' + title + '</a>' + 134 '</div>'; 135 } 136 137 } 138 }).on('blur', function () { 139 $searchBox.parent().removeClass('autocomplete-active'); 140 var $box = $(this); 141 setTimeout(function () { 142 $box.devbridgeAutocomplete('hide'); 143 }, 200); 144 }); 145 }); 146 }; 147} 148 149jQuery(document).ready(function() { 150 /** solr search autocomplete **/ 151 var solrSuggestController = new SuggestController(); 152 solrSuggestController.init(); 153 154 jQuery("body").on("tx_solr_updated", function() { 155 solrSuggestController.init(); 156 }); 157}); 158 159 160/*! 161 * Bootstrap v5.1.3 (https://getbootstrap.com/) 162 * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) 163 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 164 */ 165(function (global, factory) { 166 typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('@popperjs/core')) : 167 typeof define === 'function' && define.amd ? define(['@popperjs/core'], factory) : 168 (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.bootstrap = factory(global.Popper)); 169})(this, (function (Popper) { 'use strict'; 170 171 function _interopNamespace(e) { 172 if (e && e.__esModule) return e; 173 const n = Object.create(null); 174 if (e) { 175 for (const k in e) { 176 if (k !== 'default') { 177 const d = Object.getOwnPropertyDescriptor(e, k); 178 Object.defineProperty(n, k, d.get ? d : { 179 enumerable: true, 180 get: () => e[k] 181 }); 182 } 183 } 184 } 185 n.default = e; 186 return Object.freeze(n); 187 } 188 189 const Popper__namespace = /*#__PURE__*/_interopNamespace(Popper); 190 191 /** 192 * -------------------------------------------------------------------------- 193 * Bootstrap (v5.1.3): util/index.js 194 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 195 * -------------------------------------------------------------------------- 196 */ 197 const MAX_UID = 1000000; 198 const MILLISECONDS_MULTIPLIER = 1000; 199 const TRANSITION_END = 'transitionend'; // Shoutout AngusCroll (https://goo.gl/pxwQGp) 200 201 const toType = obj => { 202 if (obj === null || obj === undefined) { 203 return `${obj}`; 204 } 205 206 return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase(); 207 }; 208 /** 209 * -------------------------------------------------------------------------- 210 * Public Util Api 211 * -------------------------------------------------------------------------- 212 */ 213 214 215 const getUID = prefix => { 216 do { 217 prefix += Math.floor(Math.random() * MAX_UID); 218 } while (document.getElementById(prefix)); 219 220 return prefix; 221 }; 222 223 const getSelector = element => { 224 let selector = element.getAttribute('data-bs-target'); 225 226 if (!selector || selector === '#') { 227 let hrefAttr = element.getAttribute('href'); // The only valid content that could double as a selector are IDs or classes, 228 // so everything starting with `#` or `.`. If a "real" URL is used as the selector, 229 // `document.querySelector` will rightfully complain it is invalid. 230 // See https://github.com/twbs/bootstrap/issues/32273 231 232 if (!hrefAttr || !hrefAttr.includes('#') && !hrefAttr.startsWith('.')) { 233 return null; 234 } // Just in case some CMS puts out a full URL with the anchor appended 235 236 237 if (hrefAttr.includes('#') && !hrefAttr.startsWith('#')) { 238 hrefAttr = `#${hrefAttr.split('#')[1]}`; 239 } 240 241 selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null; 242 } 243 244 return selector; 245 }; 246 247 const getSelectorFromElement = element => { 248 const selector = getSelector(element); 249 250 if (selector) { 251 return document.querySelector(selector) ? selector : null; 252 } 253 254 return null; 255 }; 256 257 const getElementFromSelector = element => { 258 const selector = getSelector(element); 259 return selector ? document.querySelector(selector) : null; 260 }; 261 262 const getTransitionDurationFromElement = element => { 263 if (!element) { 264 return 0; 265 } // Get transition-duration of the element 266 267 268 let { 269 transitionDuration, 270 transitionDelay 271 } = window.getComputedStyle(element); 272 const floatTransitionDuration = Number.parseFloat(transitionDuration); 273 const floatTransitionDelay = Number.parseFloat(transitionDelay); // Return 0 if element or transition duration is not found 274 275 if (!floatTransitionDuration && !floatTransitionDelay) { 276 return 0; 277 } // If multiple durations are defined, take the first 278 279 280 transitionDuration = transitionDuration.split(',')[0]; 281 transitionDelay = transitionDelay.split(',')[0]; 282 return (Number.parseFloat(transitionDuration) + Number.parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER; 283 }; 284 285 const triggerTransitionEnd = element => { 286 element.dispatchEvent(new Event(TRANSITION_END)); 287 }; 288 289 const isElement = obj => { 290 if (!obj || typeof obj !== 'object') { 291 return false;
292 } 293 294 if (typeof obj.jquery !== 'undefined') { 295 obj = obj[0]; 296 } 297 298 return typeof obj.nodeType !== 'undefined'; 299 }; 300 301 const getElement = obj => { 302 if (isElement(obj)) { 303 // it's a jQuery object or a node element 304 return obj.jquery ? obj[0] : obj; 305 } 306 307 if (typeof obj === 'string' && obj.length > 0) { 308 return document.querySelector(obj); 309 } 310 311 return null; 312 }; 313 314 const typeCheckConfig = (componentName, config, configTypes) => { 315 Object.keys(configTypes).forEach(property => { 316 const expectedTypes = configTypes[property]; 317 const value = config[property]; 318 const valueType = value && isElement(value) ? 'element' : toType(value); 319 320 if (!new RegExp(expectedTypes).test(valueType)) { 321 throw new TypeError(`${componentName.toUpperCase()}: Option "${property}" provided type "${valueType}" but expected type "${expectedTypes}".`); 322 } 323 }); 324 }; 325 326 const isVisible = element => { 327 if (!isElement(element) || element.getClientRects().length === 0) { 328 return false; 329 } 330 331 return getComputedStyle(element).getPropertyValue('visibility') === 'visible'; 332 }; 333 334 const isDisabled = element => { 335 if (!element || element.nodeType !== Node.ELEMENT_NODE) { 336 return true; 337 } 338 339 if (element.classList.contains('disabled')) { 340 return true; 341 } 342 343 if (typeof element.disabled !== 'undefined') { 344 return element.disabled; 345 } 346 347 return element.hasAttribute('disabled') && element.getAttribute('disabled') !== 'false'; 348 }; 349 350 const findShadowRoot = element => { 351 if (!document.documentElement.attachShadow) { 352 return null; 353 } // Can find the shadow root otherwise it'll return the document 354 355 356 if (typeof element.getRootNode === 'function') { 357 const root = element.getRootNode(); 358 return root instanceof ShadowRoot ? root : null; 359 } 360 361 if (element instanceof ShadowRoot) { 362 return element; 363 } // when we don't find a shadow root 364 365 366 if (!element.parentNode) { 367 return null; 368 } 369 370 return findShadowRoot(element.parentNode); 371 }; 372 373 const noop = () => {}; 374 /** 375 * Trick to restart an element's animation 376 * 377 * @param {HTMLElement} element 378 * @return void 379 * 380 * @see https://www.charistheo.io/blog/2021/02/restart-a-css-animation-with-javascript/#restarting-a-css-animation 381 */ 382 383 384 const reflow = element => { 385 // eslint-disable-next-line no-unused-expressions 386 element.offsetHeight; 387 }; 388 389 const getjQuery = () => { 390 const { 391 jQuery 392 } = window; 393 394 if (jQuery && !document.body.hasAttribute('data-bs-no-jquery')) { 395 return jQuery; 396 } 397 398 return null; 399 }; 400 401 const DOMContentLoadedCallbacks = []; 402 403 const onDOMContentLoaded = callback => { 404 if (document.readyState === 'loading') { 405 // add listener on the first call when the document is in loading state 406 if (!DOMContentLoadedCallbacks.length) { 407 document.addEventListener('DOMContentLoaded', () => { 408 DOMContentLoadedCallbacks.forEach(callback => callback()); 409 }); 410 } 411 412 DOMContentLoadedCallbacks.push(callback); 413 } else { 414 callback(); 415 } 416 }; 417 418 const isRTL = () => document.documentElement.dir === 'rtl'; 419 420 const defineJQueryPlugin = plugin => { 421 onDOMContentLoaded(() => { 422 const $ = getjQuery(); 423 /* istanbul ignore if */ 424 425 if ($) { 426 const name = plugin.NAME; 427 const JQUERY_NO_CONFLICT = $.fn[name]; 428 $.fn[name] = plugin.jQueryInterface; 429 $.fn[name].Constructor = plugin; 430 431 $.fn[name].noConflict = () => { 432 $.fn[name] = JQUERY_NO_CONFLICT; 433 return plugin.jQueryInterface; 434 }; 435 } 436 }); 437 }; 438 439 const execute = callback => { 440 if (typeof callback === 'function') { 441 callback(); 442 } 443 }; 444 445 const executeAfterTransition = (callback, transitionElement, waitForTransition = true) => { 446 if (!waitForTransition) { 447 execute(callback); 448 return; 449 } 450 451 const durationPadding = 5; 452 const emulatedDuration = getTransitionDurationFromElement(transitionElement) + durationPadding;
453 let called = false; 454 455 const handler = ({ 456 target 457 }) => { 458 if (target !== transitionElement) { 459 return; 460 } 461 462 called = true; 463 transitionElement.removeEventListener(TRANSITION_END, handler); 464 execute(callback); 465 }; 466 467 transitionElement.addEventListener(TRANSITION_END, handler); 468 setTimeout(() => { 469 if (!called) { 470 triggerTransitionEnd(transitionElement); 471 } 472 }, emulatedDuration); 473 }; 474 /** 475 * Return the previous/next element of a list. 476 * 477 * @param {array} list The list of elements 478 * @param activeElement The active element 479 * @param shouldGetNext Choose to get next or previous element 480 * @param isCycleAllowed 481 * @return {Element|elem} The proper element 482 */ 483 484 485 const getNextActiveElement = (list, activeElement, shouldGetNext, isCycleAllowed) => { 486 let index = list.indexOf(activeElement); // if the element does not exist in the list return an element depending on the direction and if cycle is allowed 487 488 if (index === -1) { 489 return list[!shouldGetNext && isCycleAllowed ? list.length - 1 : 0]; 490 } 491 492 const listLength = list.length; 493 index += shouldGetNext ? 1 : -1; 494 495 if (isCycleAllowed) { 496 index = (index + listLength) % listLength; 497 } 498 499 return list[Math.max(0, Math.min(index, listLength - 1))]; 500 }; 501 502 /** 503 * -------------------------------------------------------------------------- 504 * Bootstrap (v5.1.3): dom/event-handler.js 505 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 506 * -------------------------------------------------------------------------- 507 */ 508 /** 509 * ------------------------------------------------------------------------ 510 * Constants 511 * ------------------------------------------------------------------------ 512 */ 513 514 const namespaceRegex = /[^.]*(?=\..*)\.|.*/; 515 const stripNameRegex = /\..*/; 516 const stripUidRegex = /::\d+$/; 517 const eventRegistry = {}; // Events storage 518 519 let uidEvent = 1; 520 const customEvents = { 521 mouseenter: 'mouseover', 522 mouseleave: 'mouseout' 523 }; 524 const customEventsRegex = /^(mouseenter|mouseleave)/i; 525 const nativeEvents = new Set(['click', 'dblclick', 'mouseup', 'mousedown', 'contextmenu', 'mousewheel', 'DOMMouseScroll', 'mouseover', 'mouseout', 'mousemove', 'selectstart', 'selectend', 'keydown', 'keypress', 'keyup', 'orientationchange', 'touchstart', 'touchmove', 'touchend', 'touchcancel', 'pointerdown', 'pointermove', 'pointerup', 'pointerleave', 'pointercancel', 'gesturestart', 'gesturechange', 'gestureend', 'focus', 'blur', 'change', 'reset', 'select', 'submit', 'focusin', 'focusout', 'load', 'unload', 'beforeunload', 'resize', 'move', 'DOMContentLoaded', 'readystatechange', 'error', 'abort', 'scroll']); 526 /** 527 * ------------------------------------------------------------------------ 528 * Private methods 529 * ------------------------------------------------------------------------ 530 */ 531 532 function getUidEvent(element, uid) { 533 return uid && `${uid}::${uidEvent++}` || element.uidEvent || uidEvent++; 534 } 535 536 function getEvent(element) { 537 const uid = getUidEvent(element); 538 element.uidEvent = uid; 539 eventRegistry[uid] = eventRegistry[uid] || {}; 540 return eventRegistry[uid]; 541 } 542 543 function bootstrapHandler(element, fn) { 544 return function handler(event) { 545 event.delegateTarget = element; 546 547 if (handler.oneOff) { 548 EventHandler.off(element, event.type, fn); 549 } 550 551 return fn.apply(element, [event]); 552 }; 553 } 554 555 function bootstrapDelegationHandler(element, selector, fn) { 556 return function handler(event) { 557 const domElements = element.querySelectorAll(selector); 558 559 for (let { 560 target 561 } = event; target && target !== this; target = target.parentNode) { 562 for (let i = domElements.length; i--;) { 563 if (domElements[i] === target) { 564 event.delegateTarget = target; 565 566 if (handler.oneOff) { 567 EventHandler.off(element, event.type, selector, fn); 568 } 569 570 return fn.apply(target, [event]); 571 } 572 } 573 } // To please ESLint 574 575 576 return null; 577 }; 578 } 579 580 function findHandler(events, handler, delegationSelector = null) { 581 const uidEventList = Object.keys(events); 582 583 for (let i = 0, len = uidEventList.length; i < len; i++) { 584 const event = events[uidEventList[i]]; 585 586 if (event.originalHandler === handler && event.delegationSelector === delegationSelector) { 587 return event; 588 } 589 } 590 591 return null; 592 } 593 594 function normalizeParams(originalTypeEvent, handler, delegationFn) { 595 const delegation = typeof handler === 'string'; 596 const originalHandler = delegation ? delegationFn : handler; 597 let typeEvent = getTypeEvent(originalTypeEvent); 598 const isNative = nativeEvents.has(typeEvent); 599 600 if (!isNative) { 601 typeEvent = originalTypeEvent; 602 } 603 604 return [delegation, originalHandler, typeEvent]; 605 } 606 607 function addHandler(element, originalTypeEvent, handler, delegationFn, oneOff) { 608 if (typeof originalTypeEvent !== 'string' || !element) { 609 return; 610 } 611 612 if (!handler) { 613 handler = delegationFn; 614 delegationFn = null; 615 } // in case of mouseenter or mouseleave wrap the handler within a function that checks for its DOM position 616 // this prevents the handler from being dispatched the same way as mouseover or mouseout does 617 618 619 if (customEventsRegex.test(originalTypeEvent)) { 620 const wrapFn = fn => { 621 return function (event) { 622 if (!event.relatedTarget || event.relatedTarget !== event.delegateTarget && !event.delegateTarget.contains(event.relatedTarget)) {
vendor: 10,268 bytes, lines 623-953
623 return fn.call(this, event); 624 } 625 }; 626 }; 627 628 if (delegationFn) { 629 delegationFn = wrapFn(delegationFn); 630 } else { 631 handler = wrapFn(handler); 632 } 633 } 634 635 const [delegation, originalHandler, typeEvent] = normalizeParams(originalTypeEvent, handler, delegationFn); 636 const events = getEvent(element); 637 const handlers = events[typeEvent] || (events[typeEvent] = {}); 638 const previousFn = findHandler(handlers, originalHandler, delegation ? handler : null); 639 640 if (previousFn) { 641 previousFn.oneOff = previousFn.oneOff && oneOff; 642 return; 643 } 644 645 const uid = getUidEvent(originalHandler, originalTypeEvent.replace(namespaceRegex, '')); 646 const fn = delegation ? bootstrapDelegationHandler(element, handler, delegationFn) : bootstrapHandler(element, handler); 647 fn.delegationSelector = delegation ? handler : null; 648 fn.originalHandler = originalHandler; 649 fn.oneOff = oneOff; 650 fn.uidEvent = uid; 651 handlers[uid] = fn; 652 element.addEventListener(typeEvent, fn, delegation); 653 } 654 655 function removeHandler(element, events, typeEvent, handler, delegationSelector) { 656 const fn = findHandler(events[typeEvent], handler, delegationSelector); 657 658 if (!fn) { 659 return; 660 } 661 662 element.removeEventListener(typeEvent, fn, Boolean(delegationSelector)); 663 delete events[typeEvent][fn.uidEvent]; 664 } 665 666 function removeNamespacedHandlers(element, events, typeEvent, namespace) { 667 const storeElementEvent = events[typeEvent] || {}; 668 Object.keys(storeElementEvent).forEach(handlerKey => { 669 if (handlerKey.includes(namespace)) { 670 const event = storeElementEvent[handlerKey]; 671 removeHandler(element, events, typeEvent, event.originalHandler, event.delegationSelector); 672 } 673 }); 674 } 675 676 function getTypeEvent(event) { 677 // allow to get the native events from namespaced events ('click.bs.button' --> 'click') 678 event = event.replace(stripNameRegex, ''); 679 return customEvents[event] || event; 680 } 681 682 const EventHandler = { 683 on(element, event, handler, delegationFn) { 684 addHandler(element, event, handler, delegationFn, false); 685 }, 686 687 one(element, event, handler, delegationFn) { 688 addHandler(element, event, handler, delegationFn, true); 689 }, 690 691 off(element, originalTypeEvent, handler, delegationFn) { 692 if (typeof originalTypeEvent !== 'string' || !element) { 693 return; 694 } 695 696 const [delegation, originalHandler, typeEvent] = normalizeParams(originalTypeEvent, handler, delegationFn); 697 const inNamespace = typeEvent !== originalTypeEvent; 698 const events = getEvent(element); 699 const isNamespace = originalTypeEvent.startsWith('.'); 700 701 if (typeof originalHandler !== 'undefined') { 702 // Simplest case: handler is passed, remove that listener ONLY. 703 if (!events || !events[typeEvent]) { 704 return; 705 } 706 707 removeHandler(element, events, typeEvent, originalHandler, delegation ? handler : null); 708 return; 709 } 710 711 if (isNamespace) { 712 Object.keys(events).forEach(elementEvent => { 713 removeNamespacedHandlers(element, events, elementEvent, originalTypeEvent.slice(1)); 714 }); 715 } 716 717 const storeElementEvent = events[typeEvent] || {}; 718 Object.keys(storeElementEvent).forEach(keyHandlers => { 719 const handlerKey = keyHandlers.replace(stripUidRegex, ''); 720 721 if (!inNamespace || originalTypeEvent.includes(handlerKey)) { 722 const event = storeElementEvent[keyHandlers]; 723 removeHandler(element, events, typeEvent, event.originalHandler, event.delegationSelector); 724 } 725 }); 726 }, 727 728 trigger(element, event, args) { 729 if (typeof event !== 'string' || !element) { 730 return null; 731 } 732 733 const $ = getjQuery(); 734 const typeEvent = getTypeEvent(event); 735 const inNamespace = event !== typeEvent; 736 const isNative = nativeEvents.has(typeEvent); 737 let jQueryEvent; 738 let bubbles = true; 739 let nativeDispatch = true; 740 let defaultPrevented = false; 741 let evt = null; 742 743 if (inNamespace && $) { 744 jQueryEvent = $.Event(event, args); 745 $(element).trigger(jQueryEvent); 746 bubbles = !jQueryEvent.isPropagationStopped(); 747 nativeDispatch = !jQueryEvent.isImmediatePropagationStopped(); 748 defaultPrevented = jQueryEvent.isDefaultPrevented(); 749 } 750 751 if (isNative) { 752 evt = document.createEvent('HTMLEvents'); 753 evt.initEvent(typeEvent, bubbles, true); 754 } else { 755 evt = new CustomEvent(event, { 756 bubbles, 757 cancelable: true 758 }); 759 } // merge custom information in our event 760 761 762 if (typeof args !== 'undefined') { 763 Object.keys(args).forEach(key => { 764 Object.defineProperty(evt, key, { 765 get() { 766 return args[key]; 767 } 768 769 }); 770 }); 771 } 772 773 if (defaultPrevented) { 774 evt.preventDefault(); 775 } 776 777 if (nativeDispatch) { 778 element.dispatchEvent(evt); 779 } 780 781 if (evt.defaultPrevented && typeof jQueryEvent !== 'undefined') { 782 jQueryEvent.preventDefault(); 783 } 784 785 return evt; 786 } 787 788 }; 789 790 /** 791 * -------------------------------------------------------------------------- 792 * Bootstrap (v5.1.3): dom/data.js 793 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 794 * -------------------------------------------------------------------------- 795 */ 796 797 /** 798 * ------------------------------------------------------------------------ 799 * Constants 800 * ------------------------------------------------------------------------ 801 */ 802 const elementMap = new Map(); 803 const Data = { 804 set(element, key, instance) { 805 if (!elementMap.has(element)) { 806 elementMap.set(element, new Map()); 807 } 808 809 const instanceMap = elementMap.get(element); // make it clear we only want one instance per element 810 // can be removed later when multiple key/instances are fine to be used 811 812 if (!instanceMap.has(key) && instanceMap.size !== 0) { 813 // eslint-disable-next-line no-console 814 console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${Array.from(instanceMap.keys())[0]}.`); 815 return; 816 } 817 818 instanceMap.set(key, instance); 819 }, 820 821 get(element, key) { 822 if (elementMap.has(element)) { 823 return elementMap.get(element).get(key) || null; 824 } 825 826 return null; 827 }, 828 829 remove(element, key) { 830 if (!elementMap.has(element)) { 831 return; 832 } 833 834 const instanceMap = elementMap.get(element); 835 instanceMap.delete(key); // free up element references if there are no instances left for an element 836 837 if (instanceMap.size === 0) { 838 elementMap.delete(element); 839 } 840 } 841 842 }; 843 844 /** 845 * -------------------------------------------------------------------------- 846 * Bootstrap (v5.1.3): base-component.js 847 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 848 * -------------------------------------------------------------------------- 849 */ 850 /** 851 * ------------------------------------------------------------------------ 852 * Constants 853 * ------------------------------------------------------------------------ 854 */ 855 856 const VERSION = '5.1.3'; 857 858 class BaseComponent { 859 constructor(element) { 860 element = getElement(element); 861 862 if (!element) { 863 return; 864 } 865 866 this._element = element; 867 Data.set(this._element, this.constructor.DATA_KEY, this); 868 } 869 870 dispose() { 871 Data.remove(this._element, this.constructor.DATA_KEY); 872 EventHandler.off(this._element, this.constructor.EVENT_KEY); 873 Object.getOwnPropertyNames(this).forEach(propertyName => { 874 this[propertyName] = null; 875 }); 876 } 877 878 _queueCallback(callback, element, isAnimated = true) { 879 executeAfterTransition(callback, element, isAnimated); 880 } 881 /** Static */ 882 883 884 static getInstance(element) { 885 return Data.get(getElement(element), this.DATA_KEY); 886 } 887 888 static getOrCreateInstance(element, config = {}) { 889 return this.getInstance(element) || new this(element, typeof config === 'object' ? config : null); 890 } 891 892 static get VERSION() { 893 return VERSION; 894 } 895 896 static get NAME() { 897 throw new Error('You have to implement the static method "NAME", for each component!'); 898 } 899 900 static get DATA_KEY() { 901 return `bs.${this.NAME}`; 902 } 903 904 static get EVENT_KEY() { 905 return `.${this.DATA_KEY}`; 906 } 907 908 } 909 910 /** 911 * -------------------------------------------------------------------------- 912 * Bootstrap (v5.1.3): util/component-functions.js 913 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 914 * -------------------------------------------------------------------------- 915 */ 916 917 const enableDismissTrigger = (component, method = 'hide') => { 918 const clickEvent = `click.dismiss${component.EVENT_KEY}`; 919 const name = component.NAME; 920 EventHandler.on(document, clickEvent, `[data-bs-dismiss="${name}"]`, function (event) { 921 if (['A', 'AREA'].includes(this.tagName)) { 922 event.preventDefault(); 923 } 924 925 if (isDisabled(this)) { 926 return; 927 } 928 929 const target = getElementFromSelector(this) || this.closest(`.${name}`); 930 const instance = component.getOrCreateInstance(target); // Method argument is left, for Alert and only, as it doesn't implement the 'hide' method 931 932 instance[method](); 933 }); 934 }; 935 936 /** 937 * -------------------------------------------------------------------------- 938 * Bootstrap (v5.1.3): alert.js 939 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 940 * -------------------------------------------------------------------------- 941 */ 942 /** 943 * ------------------------------------------------------------------------ 944 * Constants 945 * ------------------------------------------------------------------------ 946 */ 947 948 const NAME$d = 'alert'; 949 const DATA_KEY$c = 'bs.alert'; 950 const EVENT_KEY$c = `.${DATA_KEY$c}`; 951 const EVENT_CLOSE = `close${EVENT_KEY$c}`; 952 const EVENT_CLOSED = `closed${EVENT_KEY$c}`; 953 const CLASS_NAME_FADE$5 = 'fade';
vendor: 4,515 bytes, lines 954-1108
954 const CLASS_NAME_SHOW$8 = 'show'; 955 /** 956 * ------------------------------------------------------------------------ 957 * Class Definition 958 * ------------------------------------------------------------------------ 959 */ 960 961 class Alert extends BaseComponent { 962 // Getters 963 static get NAME() { 964 return NAME$d; 965 } // Public 966 967 968 close() { 969 const closeEvent = EventHandler.trigger(this._element, EVENT_CLOSE); 970 971 if (closeEvent.defaultPrevented) { 972 return; 973 } 974 975 this._element.classList.remove(CLASS_NAME_SHOW$8); 976 977 const isAnimated = this._element.classList.contains(CLASS_NAME_FADE$5); 978 979 this._queueCallback(() => this._destroyElement(), this._element, isAnimated); 980 } // Private 981 982 983 _destroyElement() { 984 this._element.remove(); 985 986 EventHandler.trigger(this._element, EVENT_CLOSED); 987 this.dispose(); 988 } // Static 989 990 991 static jQueryInterface(config) { 992 return this.each(function () { 993 const data = Alert.getOrCreateInstance(this); 994 995 if (typeof config !== 'string') { 996 return; 997 } 998 999 if (data[config] === undefined || config.startsWith('_') || config === 'constructor') { 1000 throw new TypeError(`No method named "${config}"`); 1001 } 1002 1003 data[config](this); 1004 }); 1005 } 1006 1007 } 1008 /** 1009 * ------------------------------------------------------------------------ 1010 * Data Api implementation 1011 * ------------------------------------------------------------------------ 1012 */ 1013 1014 1015 enableDismissTrigger(Alert, 'close'); 1016 /** 1017 * ------------------------------------------------------------------------ 1018 * jQuery 1019 * ------------------------------------------------------------------------ 1020 * add .Alert to jQuery only if jQuery is present 1021 */ 1022 1023 defineJQueryPlugin(Alert); 1024 1025 /** 1026 * -------------------------------------------------------------------------- 1027 * Bootstrap (v5.1.3): button.js 1028 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 1029 * -------------------------------------------------------------------------- 1030 */ 1031 /** 1032 * ------------------------------------------------------------------------ 1033 * Constants 1034 * ------------------------------------------------------------------------ 1035 */ 1036 1037 const NAME$c = 'button'; 1038 const DATA_KEY$b = 'bs.button'; 1039 const EVENT_KEY$b = `.${DATA_KEY$b}`; 1040 const DATA_API_KEY$7 = '.data-api'; 1041 const CLASS_NAME_ACTIVE$3 = 'active'; 1042 const SELECTOR_DATA_TOGGLE$5 = '[data-bs-toggle="button"]'; 1043 const EVENT_CLICK_DATA_API$6 = `click${EVENT_KEY$b}${DATA_API_KEY$7}`; 1044 /** 1045 * ------------------------------------------------------------------------ 1046 * Class Definition 1047 * ------------------------------------------------------------------------ 1048 */ 1049 1050 class Button extends BaseComponent { 1051 // Getters 1052 static get NAME() { 1053 return NAME$c; 1054 } // Public 1055 1056 1057 toggle() { 1058 // Toggle class and sync the `aria-pressed` attribute with the return value of the `.toggle()` method 1059 this._element.setAttribute('aria-pressed', this._element.classList.toggle(CLASS_NAME_ACTIVE$3)); 1060 } // Static 1061 1062 1063 static jQueryInterface(config) { 1064 return this.each(function () { 1065 const data = Button.getOrCreateInstance(this); 1066 1067 if (config === 'toggle') { 1068 data[config](); 1069 } 1070 }); 1071 } 1072 1073 } 1074 /** 1075 * ------------------------------------------------------------------------ 1076 * Data Api implementation 1077 * ------------------------------------------------------------------------ 1078 */ 1079 1080 1081 EventHandler.on(document, EVENT_CLICK_DATA_API$6, SELECTOR_DATA_TOGGLE$5, event => { 1082 event.preventDefault(); 1083 const button = event.target.closest(SELECTOR_DATA_TOGGLE$5); 1084 const data = Button.getOrCreateInstance(button); 1085 data.toggle(); 1086 }); 1087 /** 1088 * ------------------------------------------------------------------------ 1089 * jQuery 1090 * ------------------------------------------------------------------------ 1091 * add .Button to jQuery only if jQuery is present 1092 */ 1093 1094 defineJQueryPlugin(Button); 1095 1096 /** 1097 * -------------------------------------------------------------------------- 1098 * Bootstrap (v5.1.3): dom/manipulator.js 1099 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 1100 * -------------------------------------------------------------------------- 1101 */ 1102 function normalizeData(val) { 1103 if (val === 'true') { 1104 return true; 1105 } 1106 1107 if (val === 'false') { 1108 return false;
1109 } 1110 1111 if (val === Number(val).toString()) { 1112 return Number(val); 1113 } 1114 1115 if (val === '' || val === 'null') { 1116 return null; 1117 } 1118 1119 return val; 1120 } 1121 1122 function normalizeDataKey(key) { 1123 return key.replace(/[A-Z]/g, chr => `-${chr.toLowerCase()}`); 1124 } 1125 1126 const Manipulator = { 1127 setDataAttribute(element, key, value) { 1128 element.setAttribute(`data-bs-${normalizeDataKey(key)}`, value); 1129 }, 1130 1131 removeDataAttribute(element, key) { 1132 element.removeAttribute(`data-bs-${normalizeDataKey(key)}`); 1133 }, 1134 1135 getDataAttributes(element) { 1136 if (!element) { 1137 return {}; 1138 } 1139 1140 const attributes = {}; 1141 Object.keys(element.dataset).filter(key => key.startsWith('bs')).forEach(key => { 1142 let pureKey = key.replace(/^bs/, ''); 1143 pureKey = pureKey.charAt(0).toLowerCase() + pureKey.slice(1, pureKey.length); 1144 attributes[pureKey] = normalizeData(element.dataset[key]); 1145 }); 1146 return attributes; 1147 }, 1148 1149 getDataAttribute(element, key) { 1150 return normalizeData(element.getAttribute(`data-bs-${normalizeDataKey(key)}`)); 1151 }, 1152 1153 offset(element) { 1154 const rect = element.getBoundingClientRect(); 1155 return { 1156 top: rect.top + window.pageYOffset, 1157 left: rect.left + window.pageXOffset 1158 }; 1159 }, 1160 1161 position(element) { 1162 return { 1163 top: element.offsetTop, 1164 left: element.offsetLeft 1165 }; 1166 } 1167 1168 }; 1169 1170 /** 1171 * -------------------------------------------------------------------------- 1172 * Bootstrap (v5.1.3): dom/selector-engine.js 1173 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 1174 * -------------------------------------------------------------------------- 1175 */ 1176 const NODE_TEXT = 3; 1177 const SelectorEngine = { 1178 find(selector, element = document.documentElement) { 1179 return [].concat(...Element.prototype.querySelectorAll.call(element, selector)); 1180 }, 1181 1182 findOne(selector, element = document.documentElement) { 1183 return Element.prototype.querySelector.call(element, selector); 1184 }, 1185 1186 children(element, selector) { 1187 return [].concat(...element.children).filter(child => child.matches(selector)); 1188 }, 1189 1190 parents(element, selector) { 1191 const parents = []; 1192 let ancestor = element.parentNode; 1193 1194 while (ancestor && ancestor.nodeType === Node.ELEMENT_NODE && ancestor.nodeType !== NODE_TEXT) { 1195 if (ancestor.matches(selector)) { 1196 parents.push(ancestor); 1197 } 1198 1199 ancestor = ancestor.parentNode; 1200 } 1201 1202 return parents; 1203 }, 1204 1205 prev(element, selector) { 1206 let previous = element.previousElementSibling; 1207 1208 while (previous) { 1209 if (previous.matches(selector)) { 1210 return [previous]; 1211 } 1212 1213 previous = previous.previousElementSibling; 1214 } 1215 1216 return []; 1217 }, 1218 1219 next(element, selector) { 1220 let next = element.nextElementSibling; 1221 1222 while (next) { 1223 if (next.matches(selector)) { 1224 return [next]; 1225 } 1226 1227 next = next.nextElementSibling; 1228 } 1229 1230 return []; 1231 }, 1232 1233 focusableChildren(element) { 1234 const focusables = ['a', 'button', 'input', 'textarea', 'select', 'details', '[tabindex]', '[contenteditable="true"]'].map(selector => `${selector}:not([tabindex^="-"])`).join(', '); 1235 return this.find(focusables, element).filter(el => !isDisabled(el) && isVisible(el)); 1236 } 1237 1238 }; 1239 1240 /** 1241 * -------------------------------------------------------------------------- 1242 * Bootstrap (v5.1.3): carousel.js 1243 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 1244 * -------------------------------------------------------------------------- 1245 */ 1246 /** 1247 * ------------------------------------------------------------------------ 1248 * Constants 1249 * ------------------------------------------------------------------------ 1250 */ 1251 1252 const NAME$b = 'carousel'; 1253 const DATA_KEY$a = 'bs.carousel'; 1254 const EVENT_KEY$a = `.${DATA_KEY$a}`; 1255 const DATA_API_KEY$6 = '.data-api'; 1256 const ARROW_LEFT_KEY = 'ArrowLeft'; 1257 const ARROW_RIGHT_KEY = 'ArrowRight'; 1258 const TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch 1259 1260 const SWIPE_THRESHOLD = 40; 1261 const Default$a = { 1262 interval: 5000, 1263 keyboard: true, 1264 slide: false, 1265 pause: 'hover', 1266 wrap: true, 1267 touch: true 1268 }; 1269 const DefaultType$a = { 1270 interval: '(number|boolean)', 1271 keyboard: 'boolean', 1272 slide: '(boolean|string)', 1273 pause: '(string|boolean)', 1274 wrap: 'boolean', 1275 touch: 'boolean' 1276 }; 1277 const ORDER_NEXT = 'next'; 1278 const ORDER_PREV = 'prev'; 1279 const DIRECTION_LEFT = 'left'; 1280 const DIRECTION_RIGHT = 'right'; 1281 const KEY_TO_DIRECTION = { 1282 [ARROW_LEFT_KEY]: DIRECTION_RIGHT, 1283 [ARROW_RIGHT_KEY]: DIRECTION_LEFT 1284 }; 1285 const EVENT_SLIDE = `slide${EVENT_KEY$a}`; 1286 const EVENT_SLID = `slid${EVENT_KEY$a}`; 1287 const EVENT_KEYDOWN = `keydown${EVENT_KEY$a}`; 1288 const EVENT_MOUSEENTER = `mouseenter${EVENT_KEY$a}`; 1289 const EVENT_MOUSELEAVE = `mouseleave${EVENT_KEY$a}`; 1290 const EVENT_TOUCHSTART = `touchstart${EVENT_KEY$a}`; 1291 const EVENT_TOUCHMOVE = `touchmove${EVENT_KEY$a}`; 1292 const EVENT_TOUCHEND = `touchend${EVENT_KEY$a}`; 1293 const EVENT_POINTERDOWN = `pointerdown${EVENT_KEY$a}`; 1294 const EVENT_POINTERUP = `pointerup${EVENT_KEY$a}`; 1295 const EVENT_DRAG_START = `dragstart${EVENT_KEY$a}`; 1296 const EVENT_LOAD_DATA_API$2 = `load${EVENT_KEY$a}${DATA_API_KEY$6}`; 1297 const EVENT_CLICK_DATA_API$5 = `click${EVENT_KEY$a}${DATA_API_KEY$6}`; 1298 const CLASS_NAME_CAROUSEL = 'carousel'; 1299 const CLASS_NAME_ACTIVE$2 = 'active'; 1300 const CLASS_NAME_SLIDE = 'slide'; 1301 const CLASS_NAME_END = 'carousel-item-end'; 1302 const CLASS_NAME_START = 'carousel-item-start';
1303 const CLASS_NAME_NEXT = 'carousel-item-next'; 1304 const CLASS_NAME_PREV = 'carousel-item-prev'; 1305 const CLASS_NAME_POINTER_EVENT = 'pointer-event'; 1306 const SELECTOR_ACTIVE$1 = '.active'; 1307 const SELECTOR_ACTIVE_ITEM = '.active.carousel-item'; 1308 const SELECTOR_ITEM = '.carousel-item'; 1309 const SELECTOR_ITEM_IMG = '.carousel-item img'; 1310 const SELECTOR_NEXT_PREV = '.carousel-item-next, .carousel-item-prev'; 1311 const SELECTOR_INDICATORS = '.carousel-indicators'; 1312 const SELECTOR_INDICATOR = '[data-bs-target]'; 1313 const SELECTOR_DATA_SLIDE = '[data-bs-slide], [data-bs-slide-to]'; 1314 const SELECTOR_DATA_RIDE = '[data-bs-ride="carousel"]'; 1315 const POINTER_TYPE_TOUCH = 'touch'; 1316 const POINTER_TYPE_PEN = 'pen'; 1317 /** 1318 * ------------------------------------------------------------------------ 1319 * Class Definition 1320 * ------------------------------------------------------------------------ 1321 */ 1322 1323 class Carousel extends BaseComponent { 1324 constructor(element, config) { 1325 super(element); 1326 this._items = null; 1327 this._interval = null; 1328 this._activeElement = null; 1329 this._isPaused = false; 1330 this._isSliding = false; 1331 this.touchTimeout = null; 1332 this.touchStartX = 0; 1333 this.touchDeltaX = 0; 1334 this._config = this._getConfig(config); 1335 this._indicatorsElement = SelectorEngine.findOne(SELECTOR_INDICATORS, this._element); 1336 this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0; 1337 this._pointerEvent = Boolean(window.PointerEvent); 1338 1339 this._addEventListeners(); 1340 } // Getters 1341 1342 1343 static get Default() { 1344 return Default$a; 1345 } 1346 1347 static get NAME() { 1348 return NAME$b; 1349 } // Public 1350 1351 1352 next() { 1353 this._slide(ORDER_NEXT); 1354 } 1355 1356 nextWhenVisible() { 1357 // Don't call next when the page isn't visible 1358 // or the carousel or its parent isn't visible 1359 if (!document.hidden && isVisible(this._element)) { 1360 this.next(); 1361 } 1362 } 1363 1364 prev() { 1365 this._slide(ORDER_PREV); 1366 } 1367 1368 pause(event) { 1369 if (!event) { 1370 this._isPaused = true; 1371 } 1372 1373 if (SelectorEngine.findOne(SELECTOR_NEXT_PREV, this._element)) { 1374 triggerTransitionEnd(this._element); 1375 this.cycle(true); 1376 } 1377 1378 clearInterval(this._interval); 1379 this._interval = null; 1380 } 1381 1382 cycle(event) { 1383 if (!event) { 1384 this._isPaused = false; 1385 } 1386 1387 if (this._interval) { 1388 clearInterval(this._interval); 1389 this._interval = null; 1390 } 1391 1392 if (this._config && this._config.interval && !this._isPaused) { 1393 this._updateInterval(); 1394 1395 this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval); 1396 } 1397 } 1398 1399 to(index) { 1400 this._activeElement = SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element); 1401 1402 const activeIndex = this._getItemIndex(this._activeElement); 1403 1404 if (index > this._items.length - 1 || index < 0) { 1405 return; 1406 } 1407 1408 if (this._isSliding) { 1409 EventHandler.one(this._element, EVENT_SLID, () => this.to(index)); 1410 return; 1411 } 1412 1413 if (activeIndex === index) { 1414 this.pause(); 1415 this.cycle(); 1416 return; 1417 } 1418 1419 const order = index > activeIndex ? ORDER_NEXT : ORDER_PREV; 1420 1421 this._slide(order, this._items[index]); 1422 } // Private 1423 1424 1425 _getConfig(config) { 1426 config = { ...Default$a, 1427 ...Manipulator.getDataAttributes(this._element), 1428 ...(typeof config === 'object' ? config : {}) 1429 }; 1430 typeCheckConfig(NAME$b, config, DefaultType$a); 1431 return config; 1432 } 1433 1434 _handleSwipe() { 1435 const absDeltax = Math.abs(this.touchDeltaX); 1436 1437 if (absDeltax <= SWIPE_THRESHOLD) { 1438 return; 1439 } 1440 1441 const direction = absDeltax / this.touchDeltaX; 1442 this.touchDeltaX = 0; 1443 1444 if (!direction) { 1445 return; 1446 } 1447 1448 this._slide(direction > 0 ? DIRECTION_RIGHT : DIRECTION_LEFT); 1449 } 1450 1451 _addEventListeners() { 1452 if (this._config.keyboard) { 1453 EventHandler.on(this._element, EVENT_KEYDOWN, event =>
1453 this._keydown(event)); 1454 } 1455 1456 if (this._config.pause === 'hover') { 1457 EventHandler.on(this._element, EVENT_MOUSEENTER, event => this.pause(event)); 1458 EventHandler.on(this._element, EVENT_MOUSELEAVE, event => this.cycle(event)); 1459 } 1460 1461 if (this._config.touch && this._touchSupported) { 1462 this._addTouchEventListeners(); 1463 } 1464 } 1465 1466 _addTouchEventListeners() { 1467 const hasPointerPenTouch = event => { 1468 return this._pointerEvent && (event.pointerType === POINTER_TYPE_PEN || event.pointerType === POINTER_TYPE_TOUCH); 1469 }; 1470 1471 const start = event => { 1472 if (hasPointerPenTouch(event)) { 1473 this.touchStartX = event.clientX; 1474 } else if (!this._pointerEvent) { 1475 this.touchStartX = event.touches[0].clientX; 1476 } 1477 }; 1478 1479 const move = event => { 1480 // ensure swiping with one touch and not pinching 1481 this.touchDeltaX = event.touches && event.touches.length > 1 ? 0 : event.touches[0].clientX - this.touchStartX; 1482 }; 1483 1484 const end = event => { 1485 if (hasPointerPenTouch(event)) { 1486 this.touchDeltaX = event.clientX - this.touchStartX; 1487 } 1488 1489 this._handleSwipe(); 1490 1491 if (this._config.pause === 'hover') { 1492 // If it's a touch-enabled device, mouseenter/leave are fired as 1493 // part of the mouse compatibility events on first tap - the carousel 1494 // would stop cycling until user tapped out of it; 1495 // here, we listen for touchend, explicitly pause the carousel 1496 // (as if it's the second time we tap on it, mouseenter compat event 1497 // is NOT fired) and after a timeout (to allow for mouse compatibility 1498 // events to fire) we explicitly restart cycling 1499 this.pause(); 1500 1501 if (this.touchTimeout) { 1502 clearTimeout(this.touchTimeout); 1503 } 1504 1505 this.touchTimeout = setTimeout(event => this.cycle(event), TOUCHEVENT_COMPAT_WAIT + this._config.interval); 1506 } 1507 }; 1508 1509 SelectorEngine.find(SELECTOR_ITEM_IMG, this._element).forEach(itemImg => { 1510 EventHandler.on(itemImg, EVENT_DRAG_START, event => event.preventDefault()); 1511 }); 1512 1513 if (this._pointerEvent) { 1514 EventHandler.on(this._element, EVENT_POINTERDOWN, event => start(event)); 1515 EventHandler.on(this._element, EVENT_POINTERUP, event => end(event)); 1516 1517 this._element.classList.add(CLASS_NAME_POINTER_EVENT); 1518 } else { 1519 EventHandler.on(this._element, EVENT_TOUCHSTART, event => start(event)); 1520 EventHandler.on(this._element, EVENT_TOUCHMOVE, event => move(event)); 1521 EventHandler.on(this._element, EVENT_TOUCHEND, event => end(event)); 1522 } 1523 } 1524 1525 _keydown(event) { 1526 if (/input|textarea/i.test(event.target.tagName)) { 1527 return; 1528 } 1529 1530 const direction = KEY_TO_DIRECTION[event.key]; 1531 1532 if (direction) { 1533 event.preventDefault(); 1534 1535 this._slide(direction); 1536 } 1537 } 1538 1539 _getItemIndex(element) { 1540 this._items = element && element.parentNode ? SelectorEngine.find(SELECTOR_ITEM, element.parentNode) : []; 1541 return this._items.indexOf(element); 1542 } 1543 1544 _getItemByOrder(order, activeElement) { 1545 const isNext = order === ORDER_NEXT; 1546 return getNextActiveElement(this._items, activeElement, isNext, this._config.wrap); 1547 } 1548 1549 _triggerSlideEvent(relatedTarget, eventDirectionName) { 1550 const targetIndex = this._getItemIndex(relatedTarget); 1551 1552 const fromIndex = this._getItemIndex(SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element)); 1553 1554 return EventHandler.trigger(this._element, EVENT_SLIDE, { 1555 relatedTarget, 1556 direction: eventDirectionName, 1557 from: fromIndex, 1558 to: targetIndex 1559 }); 1560 } 1561 1562 _setActiveIndicatorElement(element) { 1563 if (this._indicatorsElement) { 1564 const activeIndicator = SelectorEngine.findOne(SELECTOR_ACTIVE$1, this._indicatorsElement); 1565 activeIndicator.classList.remove(CLASS_NAME_ACTIVE$2); 1566 activeIndicator.removeAttribute('aria-current'); 1567 const indicators = SelectorEngine.find(SELECTOR_INDICATOR, this._indicatorsElement); 1568 1569 for (let i = 0; i < indicators.length; i++) { 1570 if (Number.parseInt(indicators[i].getAttribute('data-bs-slide-to'), 10) === this._getItemIndex(element)) { 1571 indicators[i].classList.add(CLASS_NAME_ACTIVE$2); 1572 indicators[i].setAttribute('aria-current', 'true'); 1573 break; 1574 } 1575 } 1576 } 1577 } 1578 1579 _updateInterval() { 1580 const element = this._activeElement || SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element); 1581 1582 if (!element) { 1583 return; 1584 } 1585 1586 const elementInterval = Number.parseInt(element.getAttribute('data-bs-interval'), 10); 1587 1588 if (elementInterval) { 1589 this._config.defaultInterval = this._config.defaultInterval || this._config.interval; 1590 this._config.interval = elementInterval; 1591 } else { 1592 this._config.interval = this._config.defaultInterval || this._config.interval; 1593 } 1594 } 1595 1596 _slide(directionOrOrder, element) { 1597 const order = this._directionToOrder(directionOrOrder); 1598 1599 const activeElement = SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element); 1600 1601 const activeElementIndex = this._getItemIndex(activeElement); 1602 1603 const nextElement = element || this._getItemByOrder(order, activeElement); 1604 1605 const nextElementIndex = this._getItemIndex(nextElement); 1606 1607 const isCycling = Boolean(this._interval); 1608 const isNext = order === ORDER_NEXT; 1609 const directionalClassName = isNext ? CLASS_NAME_START : CLASS_NAME_END; 1610 const orderClassName = isNext ? CLASS_NAME_NEXT : CLASS_NAME_PREV; 1611 1612 const eventDirectionName = this._orderToDirection(order); 1613 1614 if (nextElement && nextElement.classList.contains(CLASS_NAME_ACTIVE$2)) { 1615 this._isSliding = false;
1616 return; 1617 } 1618 1619 if (this._isSliding) { 1620 return; 1621 } 1622 1623 const slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName); 1624 1625 if (slideEvent.defaultPrevented) { 1626 return; 1627 } 1628 1629 if (!activeElement || !nextElement) { 1630 // Some weirdness is happening, so we bail 1631 return; 1632 } 1633 1634 this._isSliding = true; 1635 1636 if (isCycling) { 1637 this.pause(); 1638 } 1639 1640 this._setActiveIndicatorElement(nextElement); 1641 1642 this._activeElement = nextElement; 1643 1644 const triggerSlidEvent = () => { 1645 EventHandler.trigger(this._element, EVENT_SLID, { 1646 relatedTarget: nextElement, 1647 direction: eventDirectionName, 1648 from: activeElementIndex, 1649 to: nextElementIndex 1650 }); 1651 }; 1652 1653 if (this._element.classList.contains(CLASS_NAME_SLIDE)) { 1654 nextElement.classList.add(orderClassName); 1655 reflow(nextElement); 1656 activeElement.classList.add(directionalClassName); 1657 nextElement.classList.add(directionalClassName); 1658 1659 const completeCallBack = () => { 1660 nextElement.classList.remove(directionalClassName, orderClassName); 1661 nextElement.classList.add(CLASS_NAME_ACTIVE$2); 1662 activeElement.classList.remove(CLASS_NAME_ACTIVE$2, orderClassName, directionalClassName); 1663 this._isSliding = false; 1664 setTimeout(triggerSlidEvent, 0); 1665 }; 1666 1667 this._queueCallback(completeCallBack, activeElement, true); 1668 } else { 1669 activeElement.classList.remove(CLASS_NAME_ACTIVE$2); 1670 nextElement.classList.add(CLASS_NAME_ACTIVE$2); 1671 this._isSliding = false; 1672 triggerSlidEvent(); 1673 } 1674 1675 if (isCycling) { 1676 this.cycle(); 1677 } 1678 } 1679 1680 _directionToOrder(direction) { 1681 if (![DIRECTION_RIGHT, DIRECTION_LEFT].includes(direction)) { 1682 return direction; 1683 } 1684 1685 if (isRTL()) { 1686 return direction === DIRECTION_LEFT ? ORDER_PREV : ORDER_NEXT; 1687 } 1688 1689 return direction === DIRECTION_LEFT ? ORDER_NEXT : ORDER_PREV; 1690 } 1691 1692 _orderToDirection(order) { 1693 if (![ORDER_NEXT, ORDER_PREV].includes(order)) { 1694 return order; 1695 } 1696 1697 if (isRTL()) { 1698 return order === ORDER_PREV ? DIRECTION_LEFT : DIRECTION_RIGHT; 1699 } 1700 1701 return order === ORDER_PREV ? DIRECTION_RIGHT : DIRECTION_LEFT; 1702 } // Static 1703 1704 1705 static carouselInterface(element, config) { 1706 const data = Carousel.getOrCreateInstance(element, config); 1707 let { 1708 _config 1709 } = data; 1710 1711 if (typeof config === 'object') { 1712 _config = { ..._config, 1713 ...config 1714 }; 1715 } 1716 1717 const action = typeof config === 'string' ? config : _config.slide; 1718 1719 if (typeof config === 'number') { 1720 data.to(config); 1721 } else if (typeof action === 'string') { 1722 if (typeof data[action] === 'undefined') { 1723 throw new TypeError(`No method named "${action}"`); 1724 } 1725 1726 data[action](); 1727 } else if (_config.interval && _config.ride) { 1728 data.pause(); 1729 data.cycle(); 1730 } 1731 } 1732 1733 static jQueryInterface(config) { 1734 return this.each(function () { 1735 Carousel.carouselInterface(this, config); 1736 }); 1737 } 1738 1739 static dataApiClickHandler(event) { 1740 const target = getElementFromSelector(this); 1741 1742 if (!target || !target.classList.contains(CLASS_NAME_CAROUSEL)) { 1743 return; 1744 } 1745 1746 const config = { ...Manipulator.getDataAttributes(target), 1747 ...Manipulator.getDataAttributes(this) 1748 }; 1749 const slideIndex = this.getAttribute('data-bs-slide-to'); 1750 1751 if (slideIndex) { 1752 config.interval = false; 1753 } 1754 1755 Carousel.carouselInterface(target, config); 1756 1757 if (slideIndex) { 1758 Carousel.getInstance(target).to(slideIndex); 1759 } 1760 1761 event.preventDefault(); 1762 } 1763 1764 } 1765 /** 1766 * ------------------------------------------------------------------------ 1767 * Data Api implementation 1768 * ------------------------------------------------------------------------ 1769 */ 1770 1771 1772 EventHandler.on(document, EVENT_CLICK_DATA_API$5, SELECTOR_DATA_SLIDE, Carousel.dataApiClickHandler); 1773 EventHandler.on(window, EVENT_LOAD_DATA_API$2, () => { 1774 const carousels = SelectorEngine.find(SELECTOR_DATA_RIDE); 1775 1776 for (let i = 0, len = carousels.length; i < len; i++) {
1777 Carousel.carouselInterface(carousels[i], Carousel.getInstance(carousels[i])); 1778 } 1779 }); 1780 /** 1781 * ------------------------------------------------------------------------ 1782 * jQuery 1783 * ------------------------------------------------------------------------ 1784 * add .Carousel to jQuery only if jQuery is present 1785 */ 1786 1787 defineJQueryPlugin(Carousel); 1788 1789 /** 1790 * -------------------------------------------------------------------------- 1791 * Bootstrap (v5.1.3): collapse.js 1792 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 1793 * -------------------------------------------------------------------------- 1794 */ 1795 /** 1796 * ------------------------------------------------------------------------ 1797 * Constants 1798 * ------------------------------------------------------------------------ 1799 */ 1800 1801 const NAME$a = 'collapse'; 1802 const DATA_KEY$9 = 'bs.collapse'; 1803 const EVENT_KEY$9 = `.${DATA_KEY$9}`; 1804 const DATA_API_KEY$5 = '.data-api'; 1805 const Default$9 = { 1806 toggle: true, 1807 parent: null 1808 }; 1809 const DefaultType$9 = { 1810 toggle: 'boolean', 1811 parent: '(null|element)' 1812 }; 1813 const EVENT_SHOW$5 = `show${EVENT_KEY$9}`; 1814 const EVENT_SHOWN$5 = `shown${EVENT_KEY$9}`; 1815 const EVENT_HIDE$5 = `hide${EVENT_KEY$9}`; 1816 const EVENT_HIDDEN$5 = `hidden${EVENT_KEY$9}`; 1817 const EVENT_CLICK_DATA_API$4 = `click${EVENT_KEY$9}${DATA_API_KEY$5}`; 1818 const CLASS_NAME_SHOW$7 = 'show'; 1819 const CLASS_NAME_COLLAPSE = 'collapse'; 1820 const CLASS_NAME_COLLAPSING = 'collapsing'; 1821 const CLASS_NAME_COLLAPSED = 'collapsed'; 1822 const CLASS_NAME_DEEPER_CHILDREN = `:scope .${CLASS_NAME_COLLAPSE} .${CLASS_NAME_COLLAPSE}`; 1823 const CLASS_NAME_HORIZONTAL = 'collapse-horizontal'; 1824 const WIDTH = 'width'; 1825 const HEIGHT = 'height'; 1826 const SELECTOR_ACTIVES = '.collapse.show, .collapse.collapsing'; 1827 const SELECTOR_DATA_TOGGLE$4 = '[data-bs-toggle="collapse"]'; 1828 /** 1829 * ------------------------------------------------------------------------ 1830 * Class Definition 1831 * ------------------------------------------------------------------------ 1832 */ 1833 1834 class Collapse extends BaseComponent { 1835 constructor(element, config) { 1836 super(element); 1837 this._isTransitioning = false; 1838 this._config = this._getConfig(config); 1839 this._triggerArray = []; 1840 const toggleList = SelectorEngine.find(SELECTOR_DATA_TOGGLE$4); 1841 1842 for (let i = 0, len = toggleList.length; i < len; i++) { 1843 const elem = toggleList[i]; 1844 const selector = getSelectorFromElement(elem); 1845 const filterElement = SelectorEngine.find(selector).filter(foundElem => foundElem === this._element); 1846 1847 if (selector !== null && filterElement.length) { 1848 this._selector = selector; 1849 1850 this._triggerArray.push(elem); 1851 } 1852 } 1853 1854 this._initializeChildren(); 1855 1856 if (!this._config.parent) { 1857 this._addAriaAndCollapsedClass(this._triggerArray, this._isShown()); 1858 } 1859 1860 if (this._config.toggle) { 1861 this.toggle(); 1862 } 1863 } // Getters 1864 1865 1866 static get Default() { 1867 return Default$9; 1868 } 1869 1870 static get NAME() { 1871 return NAME$a; 1872 } // Public 1873 1874 1875 toggle() { 1876 if (this._isShown()) { 1877 this.hide(); 1878 } else { 1879 this.show(); 1880 } 1881 } 1882 1883 show() { 1884 if (this._isTransitioning || this._isShown()) { 1885 return; 1886 } 1887 1888 let actives = []; 1889 let activesData; 1890 1891 if (this._config.parent) { 1892 const children = SelectorEngine.find(CLASS_NAME_DEEPER_CHILDREN, this._config.parent); 1893 actives = SelectorEngine.find(SELECTOR_ACTIVES, this._config.parent).filter(elem => !children.includes(elem)); // remove children if greater depth 1894 } 1895 1896 const container = SelectorEngine.findOne(this._selector); 1897 1898 if (actives.length) { 1899 const tempActiveData = actives.find(elem => container !== elem); 1900 activesData = tempActiveData ? Collapse.getInstance(tempActiveData) : null; 1901 1902 if (activesData && activesData._isTransitioning) { 1903 return; 1904 } 1905 } 1906 1907 const startEvent = EventHandler.trigger(this._element, EVENT_SHOW$5); 1908 1909 if (startEvent.defaultPrevented) { 1910 return; 1911 } 1912
1913 actives.forEach(elemActive => { 1914 if (container !== elemActive) { 1915 Collapse.getOrCreateInstance(elemActive, { 1916 toggle: false 1917 }).hide(); 1918 } 1919 1920 if (!activesData) { 1921 Data.set(elemActive, DATA_KEY$9, null); 1922 } 1923 }); 1924 1925 const dimension = this._getDimension(); 1926 1927 this._element.classList.remove(CLASS_NAME_COLLAPSE); 1928 1929 this._element.classList.add(CLASS_NAME_COLLAPSING); 1930 1931 this._element.style[dimension] = 0; 1932 1933 this._addAriaAndCollapsedClass(this._triggerArray, true); 1934 1935 this._isTransitioning = true; 1936 1937 const complete = () => { 1938 this._isTransitioning = false; 1939 1940 this._element.classList.remove(CLASS_NAME_COLLAPSING); 1941 1942 this._element.classList.add(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW$7); 1943 1944 this._element.style[dimension] = ''; 1945 EventHandler.trigger(this._element, EVENT_SHOWN$5); 1946 }; 1947 1948 const capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1); 1949 const scrollSize = `scroll${capitalizedDimension}`; 1950 1951 this._queueCallback(complete, this._element, true); 1952 1953 this._element.style[dimension] = `${this._element[scrollSize]}px`; 1954 } 1955 1956 hide() { 1957 if (this._isTransitioning || !this._isShown()) { 1958 return; 1959 } 1960 1961 const startEvent = EventHandler.trigger(this._element, EVENT_HIDE$5); 1962 1963 if (startEvent.defaultPrevented) { 1964 return; 1965 } 1966 1967 const dimension = this._getDimension(); 1968 1969 this._element.style[dimension] = `${this._element.getBoundingClientRect()[dimension]}px`; 1970 reflow(this._element); 1971 1972 this._element.classList.add(CLASS_NAME_COLLAPSING); 1973 1974 this._element.classList.remove(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW$7); 1975 1976 const triggerArrayLength = this._triggerArray.length; 1977 1978 for (let i = 0; i < triggerArrayLength; i++) { 1979 const trigger = this._triggerArray[i]; 1980 const elem = getElementFromSelector(trigger); 1981 1982 if (elem && !this._isShown(elem)) { 1983 this._addAriaAndCollapsedClass([trigger], false); 1984 } 1985 } 1986 1987 this._isTransitioning = true; 1988 1989 const complete = () => { 1990 this._isTransitioning = false; 1991 1992 this._element.classList.remove(CLASS_NAME_COLLAPSING); 1993 1994 this._element.classList.add(CLASS_NAME_COLLAPSE); 1995 1996 EventHandler.trigger(this._element, EVENT_HIDDEN$5); 1997 }; 1998 1999 this._element.style[dimension] = ''; 2000 2001 this._queueCallback(complete, this._element, true); 2002 } 2003 2004 _isShown(element = this._element) { 2005 return element.classList.contains(CLASS_NAME_SHOW$7); 2006 } // Private 2007 2008 2009 _getConfig(config) { 2010 config = { ...Default$9, 2011 ...Manipulator.getDataAttributes(this._element), 2012 ...config 2013 }; 2014 config.toggle = Boolean(config.toggle); // Coerce string values 2015 2016 config.parent = getElement(config.parent); 2017 typeCheckConfig(NAME$a, config, DefaultType$9); 2018 return config; 2019 } 2020 2021 _getDimension() { 2022 return this._element.classList.contains(CLASS_NAME_HORIZONTAL) ? WIDTH : HEIGHT; 2023 } 2024 2025 _initializeChildren() { 2026 if (!this._config.parent) { 2027 return; 2028 } 2029 2030 const children = SelectorEngine.find(CLASS_NAME_DEEPER_CHILDREN, this._config.parent); 2031 SelectorEngine.find(SELECTOR_DATA_TOGGLE$4, this._config.parent).filter(elem => !children.includes(elem)).forEach(element => { 2032 const selected = getElementFromSelector(element); 2033 2034 if (selected) { 2035 this._addAriaAndCollapsedClass([element], this._isShown(selected)); 2036 } 2037 }); 2038 } 2039 2040 _addAriaAndCollapsedClass(triggerArray, isOpen) { 2041 if (!triggerArray.length) { 2042 return; 2043 } 2044 2045 triggerArray.forEach(elem => { 2046 if (isOpen) { 2047 elem.classList.remove(CLASS_NAME_COLLAPSED); 2048 } else { 2049 elem.classList.add(CLASS_NAME_COLLAPSED); 2050 } 2051 2052 elem.setAttribute('aria-expanded', isOpen); 2053 }); 2054 } // Static 2055 2056 2057 static jQueryInterface(config) { 2058 return this.each(function () { 2059 const _config = {}; 2060 2061 if (typeof config === 'string' && /show|hide/.test(config)) { 2062 _config.toggle = false;
2063 } 2064 2065 const data = Collapse.getOrCreateInstance(this, _config); 2066 2067 if (typeof config === 'string') { 2068 if (typeof data[config] === 'undefined') { 2069 throw new TypeError(`No method named "${config}"`); 2070 } 2071 2072 data[config](); 2073 } 2074 }); 2075 } 2076 2077 } 2078 /** 2079 * ------------------------------------------------------------------------ 2080 * Data Api implementation 2081 * ------------------------------------------------------------------------ 2082 */ 2083 2084 2085 EventHandler.on(document, EVENT_CLICK_DATA_API$4, SELECTOR_DATA_TOGGLE$4, function (event) { 2086 // preventDefault only for <a> elements (which change the URL) not inside the collapsible element 2087 if (event.target.tagName === 'A' || event.delegateTarget && event.delegateTarget.tagName === 'A') { 2088 event.preventDefault(); 2089 } 2090 2091 const selector = getSelectorFromElement(this); 2092 const selectorElements = SelectorEngine.find(selector); 2093 selectorElements.forEach(element => { 2094 Collapse.getOrCreateInstance(element, { 2095 toggle: false 2096 }).toggle(); 2097 }); 2098 }); 2099 /** 2100 * ------------------------------------------------------------------------ 2101 * jQuery 2102 * ------------------------------------------------------------------------ 2103 * add .Collapse to jQuery only if jQuery is present 2104 */ 2105 2106 defineJQueryPlugin(Collapse); 2107 2108 /** 2109 * -------------------------------------------------------------------------- 2110 * Bootstrap (v5.1.3): dropdown.js 2111 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 2112 * -------------------------------------------------------------------------- 2113 */ 2114 /** 2115 * ------------------------------------------------------------------------ 2116 * Constants 2117 * ------------------------------------------------------------------------ 2118 */ 2119 2120 const NAME$9 = 'dropdown'; 2121 const DATA_KEY$8 = 'bs.dropdown'; 2122 const EVENT_KEY$8 = `.${DATA_KEY$8}`; 2123 const DATA_API_KEY$4 = '.data-api'; 2124 const ESCAPE_KEY$2 = 'Escape'; 2125 const SPACE_KEY = 'Space'; 2126 const TAB_KEY$1 = 'Tab'; 2127 const ARROW_UP_KEY = 'ArrowUp'; 2128 const ARROW_DOWN_KEY = 'ArrowDown'; 2129 const RIGHT_MOUSE_BUTTON = 2; // MouseEvent.button value for the secondary button, usually the right button 2130 2131 const REGEXP_KEYDOWN = new RegExp(`${ARROW_UP_KEY}|${ARROW_DOWN_KEY}|${ESCAPE_KEY$2}`); 2132 const EVENT_HIDE$4 = `hide${EVENT_KEY$8}`; 2133 const EVENT_HIDDEN$4 = `hidden${EVENT_KEY$8}`; 2134 const EVENT_SHOW$4 = `show${EVENT_KEY$8}`; 2135 const EVENT_SHOWN$4 = `shown${EVENT_KEY$8}`; 2136 const EVENT_CLICK_DATA_API$3 = `click${EVENT_KEY$8}${DATA_API_KEY$4}`; 2137 const EVENT_KEYDOWN_DATA_API = `keydown${EVENT_KEY$8}${DATA_API_KEY$4}`; 2138 const EVENT_KEYUP_DATA_API = `keyup${EVENT_KEY$8}${DATA_API_KEY$4}`; 2139 const CLASS_NAME_SHOW$6 = 'show'; 2140 const CLASS_NAME_DROPUP = 'dropup'; 2141 const CLASS_NAME_DROPEND = 'dropend'; 2142 const CLASS_NAME_DROPSTART = 'dropstart'; 2143 const CLASS_NAME_NAVBAR = 'navbar'; 2144 const SELECTOR_DATA_TOGGLE$3 = '[data-bs-toggle="dropdown"]'; 2145 const SELECTOR_MENU = '.dropdown-menu'; 2146 const SELECTOR_NAVBAR_NAV = '.navbar-nav'; 2147 const SELECTOR_VISIBLE_ITEMS = '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)'; 2148 const PLACEMENT_TOP = isRTL() ? 'top-end' : 'top-start'; 2149 const PLACEMENT_TOPEND = isRTL() ? 'top-start' : 'top-end'; 2150 const PLACEMENT_BOTTOM = isRTL() ? 'bottom-end' : 'bottom-start'; 2151 const PLACEMENT_BOTTOMEND = isRTL() ? 'bottom-start' : 'bottom-end'; 2152 const PLACEMENT_RIGHT = isRTL() ? 'left-start' : 'right-start'; 2153 const PLACEMENT_LEFT = isRTL() ? 'right-start' : 'left-start'; 2154 const Default$8 = { 2155 offset: [0, 2], 2156 boundary: 'clippingParents', 2157 reference: 'toggle', 2158 display: 'dynamic', 2159 popperConfig: null, 2160 autoClose: true 2161 }; 2162 const DefaultType$8 = { 2163 offset: '(array|string|function)', 2164 boundary: '(string|element)', 2165 reference: '(string|element|object)', 2166 display: 'string', 2167 popperConfig: '(null|object|function)', 2168 autoClose: '(boolean|string)' 2169 }; 2170 /** 2171 * ------------------------------------------------------------------------ 2172 * Class Definition 2173 * ------------------------------------------------------------------------ 2174 */ 2175 2176 class Dropdown extends BaseComponent { 2177 constructor(element, config) { 2178 super(element); 2179 this._popper = null; 2180 this._config = this._getConfig(config); 2181 this._menu = this._getMenuElement(); 2182 this._inNavbar = this._detectNavbar(); 2183 } // Getters 2184 2185 2186 static get Default() { 2187 return Default$8; 2188 } 2189 2190 static get DefaultType() { 2191 return DefaultType$8; 2192 } 2193 2194 static get NAME() { 2195 return NAME$9; 2196 } // Public 2197 2198 2199 toggle() { 2200 return this._isShown() ? this.hide() : this.show(); 2201 } 2202 2203 show() { 2204 if (isDisabled(this._element) || this._isShown(this._menu)) { 2205 return; 2206 } 2207 2208 const relatedTarget = { 2209 relatedTarget: this._element 2210 }; 2211 const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$4, relatedTarget); 2212 2213 if (showEvent.defaultPrevented) { 2214 return; 2215 } 2216 2217 const parent = Dropdown.getParentFromElement(this._element); // Totally disable Popper for Dropdowns in Navbar 2218 2219 if (this._inNavbar) { 2220 Manipulator.setDataAttribute(this._menu, 'popper', 'none'); 2221 } else { 2222 this._createPopper(parent); 2223 } // If this is a touch-enabled device we add extra 2224 // empty mouseover listeners to the body's immediate children; 2225 // only needed because of broken event delegation on iOS 2226 // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html 2227 2228 2229 if ('ontouchstart' in document.documentElement && !parent.closest(SELECTOR_NAVBAR_NAV)) {
2230 [].concat(...document.body.children).forEach(elem => EventHandler.on(elem, 'mouseover', noop)); 2231 } 2232 2233 this._element.focus(); 2234 2235 this._element.setAttribute('aria-expanded', true); 2236 2237 this._menu.classList.add(CLASS_NAME_SHOW$6); 2238 2239 this._element.classList.add(CLASS_NAME_SHOW$6); 2240 2241 EventHandler.trigger(this._element, EVENT_SHOWN$4, relatedTarget); 2242 } 2243 2244 hide() { 2245 if (isDisabled(this._element) || !this._isShown(this._menu)) { 2246 return; 2247 } 2248 2249 const relatedTarget = { 2250 relatedTarget: this._element 2251 }; 2252 2253 this._completeHide(relatedTarget); 2254 } 2255 2256 dispose() { 2257 if (this._popper) { 2258 this._popper.destroy(); 2259 } 2260 2261 super.dispose(); 2262 } 2263 2264 update() { 2265 this._inNavbar = this._detectNavbar(); 2266 2267 if (this._popper) { 2268 this._popper.update(); 2269 } 2270 } // Private 2271 2272 2273 _completeHide(relatedTarget) { 2274 const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$4, relatedTarget); 2275 2276 if (hideEvent.defaultPrevented) { 2277 return; 2278 } // If this is a touch-enabled device we remove the extra 2279 // empty mouseover listeners we added for iOS support 2280 2281 2282 if ('ontouchstart' in document.documentElement) { 2283 [].concat(...document.body.children).forEach(elem => EventHandler.off(elem, 'mouseover', noop)); 2284 } 2285 2286 if (this._popper) { 2287 this._popper.destroy(); 2288 } 2289 2290 this._menu.classList.remove(CLASS_NAME_SHOW$6); 2291 2292 this._element.classList.remove(CLASS_NAME_SHOW$6); 2293 2294 this._element.setAttribute('aria-expanded', 'false'); 2295 2296 Manipulator.removeDataAttribute(this._menu, 'popper'); 2297 EventHandler.trigger(this._element, EVENT_HIDDEN$4, relatedTarget); 2298 } 2299 2300 _getConfig(config) { 2301 config = { ...this.constructor.Default, 2302 ...Manipulator.getDataAttributes(this._element), 2303 ...config 2304 }; 2305 typeCheckConfig(NAME$9, config, this.constructor.DefaultType); 2306 2307 if (typeof config.reference === 'object' && !isElement(config.reference) && typeof config.reference.getBoundingClientRect !== 'function') { 2308 // Popper virtual elements require a getBoundingClientRect method 2309 throw new TypeError(`${NAME$9.toUpperCase()}: Option "reference" provided type "object" without a required "getBoundingClientRect" method.`); 2310 } 2311 2312 return config; 2313 } 2314 2315 _createPopper(parent) { 2316 if (typeof Popper__namespace === 'undefined') { 2317 throw new TypeError('Bootstrap\'s dropdowns require Popper (https://popper.js.org)'); 2318 } 2319 2320 let referenceElement = this._element; 2321 2322 if (this._config.reference === 'parent') { 2323 referenceElement = parent; 2324 } else if (isElement(this._config.reference)) { 2325 referenceElement = getElement(this._config.reference); 2326 } else if (typeof this._config.reference === 'object') { 2327 referenceElement = this._config.reference; 2328 } 2329 2330 const popperConfig = this._getPopperConfig(); 2331 2332 const isDisplayStatic = popperConfig.modifiers.find(modifier => modifier.name === 'applyStyles' && modifier.enabled === false); 2333 this._popper = Popper__namespace.createPopper(referenceElement, this._menu, popperConfig); 2334 2335 if (isDisplayStatic) { 2336 Manipulator.setDataAttribute(this._menu, 'popper', 'static'); 2337 } 2338 } 2339 2340 _isShown(element = this._element) { 2341 return element.classList.contains(CLASS_NAME_SHOW$6); 2342 } 2343 2344 _getMenuElement() { 2345 return SelectorEngine.next(this._element, SELECTOR_MENU)[0]; 2346 } 2347 2348 _getPlacement() { 2349 const parentDropdown = this._element.parentNode; 2350 2351 if (parentDropdown.classList.contains(CLASS_NAME_DROPEND)) { 2352 return PLACEMENT_RIGHT; 2353 } 2354 2355 if (parentDropdown.classList.contains(CLASS_NAME_DROPSTART)) { 2356 return PLACEMENT_LEFT; 2357 } // We need to trim the value because custom properties can also include spaces 2358 2359 2360 const isEnd = getComputedStyle(this._menu).getPropertyValue('--bs-position').trim() === 'end'; 2361 2362 if (parentDropdown.classList.contains(CLASS_NAME_DROPUP)) { 2363 return isEnd ? PLACEMENT_TOPEND : PLACEMENT_TOP; 2364 } 2365 2366 return isEnd ? PLACEMENT_BOTTOMEND : PLACEMENT_BOTTOM; 2367 } 2368 2369 _detectNavbar() { 2370 return this._element.closest(`.${CLASS_NAME_NAVBAR}`) !== null; 2371 } 2372 2373 _getOffset() { 2374 const { 2375 offset 2376 } = this._config; 2377 2378 if (typeof offset === 'string') { 2379 return offset.split(',').map(val => Number.parseInt(val, 10)); 2380 } 2381 2382 if (typeof offset === 'function') { 2383 return popperData => offset(popperData, this._element); 2384 } 2385 2386 return offset; 2387 } 2388 2389 _getPopperConfig() { 2390 const defaultBsPopperConfig = { 2391 placement: this._getPlacement(), 2392 modifiers: [{ 2393 name: 'preventOverflow', 2394 options: {
2395 boundary: this._config.boundary 2396 } 2397 }, { 2398 name: 'offset', 2399 options: { 2400 offset: this._getOffset() 2401 } 2402 }] 2403 }; // Disable Popper if we have a static display 2404 2405 if (this._config.display === 'static') { 2406 defaultBsPopperConfig.modifiers = [{ 2407 name: 'applyStyles', 2408 enabled: false 2409 }]; 2410 } 2411 2412 return { ...defaultBsPopperConfig, 2413 ...(typeof this._config.popperConfig === 'function' ? this._config.popperConfig(defaultBsPopperConfig) : this._config.popperConfig) 2414 }; 2415 } 2416 2417 _selectMenuItem({ 2418 key, 2419 target 2420 }) { 2421 const items = SelectorEngine.find(SELECTOR_VISIBLE_ITEMS, this._menu).filter(isVisible); 2422 2423 if (!items.length) { 2424 return; 2425 } // if target isn't included in items (e.g. when expanding the dropdown) 2426 // allow cycling to get the last item in case key equals ARROW_UP_KEY 2427 2428 2429 getNextActiveElement(items, target, key === ARROW_DOWN_KEY, !items.includes(target)).focus(); 2430 } // Static 2431 2432 2433 static jQueryInterface(config) { 2434 return this.each(function () { 2435 const data = Dropdown.getOrCreateInstance(this, config); 2436 2437 if (typeof config !== 'string') { 2438 return; 2439 } 2440 2441 if (typeof data[config] === 'undefined') { 2442 throw new TypeError(`No method named "${config}"`); 2443 } 2444 2445 data[config](); 2446 }); 2447 } 2448 2449 static clearMenus(event) { 2450 if (event && (event.button === RIGHT_MOUSE_BUTTON || event.type === 'keyup' && event.key !== TAB_KEY$1)) { 2451 return; 2452 } 2453 2454 const toggles = SelectorEngine.find(SELECTOR_DATA_TOGGLE$3); 2455 2456 for (let i = 0, len = toggles.length; i < len; i++) { 2457 const context = Dropdown.getInstance(toggles[i]); 2458 2459 if (!context || context._config.autoClose === false) { 2460 continue; 2461 } 2462 2463 if (!context._isShown()) { 2464 continue; 2465 } 2466 2467 const relatedTarget = { 2468 relatedTarget: context._element 2469 }; 2470 2471 if (event) { 2472 const composedPath = event.composedPath(); 2473 const isMenuTarget = composedPath.includes(context._menu); 2474 2475 if (composedPath.includes(context._element) || context._config.autoClose === 'inside' && !isMenuTarget || context._config.autoClose === 'outside' && isMenuTarget) { 2476 continue; 2477 } // Tab navigation through the dropdown menu or events from contained inputs shouldn't close the menu 2478 2479 2480 if (context._menu.contains(event.target) && (event.type === 'keyup' && event.key === TAB_KEY$1 || /input|select|option|textarea|form/i.test(event.target.tagName))) { 2481 continue; 2482 } 2483 2484 if (event.type === 'click') { 2485 relatedTarget.clickEvent = event; 2486 } 2487 } 2488 2489 context._completeHide(relatedTarget); 2490 } 2491 } 2492 2493 static getParentFromElement(element) { 2494 return getElementFromSelector(element) || element.parentNode; 2495 } 2496 2497 static dataApiKeydownHandler(event) { 2498 // If not input/textarea: 2499 // - And not a key in REGEXP_KEYDOWN => not a dropdown command 2500 // If input/textarea: 2501 // - If space key => not a dropdown command 2502 // - If key is other than escape 2503 // - If key is not up or down => not a dropdown command 2504 // - If trigger inside the menu => not a dropdown command 2505 if (/input|textarea/i.test(event.target.tagName) ? event.key === SPACE_KEY || event.key !== ESCAPE_KEY$2 && (event.key !== ARROW_DOWN_KEY && event.key !== ARROW_UP_KEY || event.target.closest(SELECTOR_MENU)) : !REGEXP_KEYDOWN.test(event.key)) { 2506 return; 2507 } 2508 2509 const isActive = this.classList.contains(CLASS_NAME_SHOW$6); 2510 2511 if (!isActive && event.key === ESCAPE_KEY$2) { 2512 return; 2513 } 2514 2515 event.preventDefault(); 2516 event.stopPropagation(); 2517 2518 if (isDisabled(this)) { 2519 return; 2520 } 2521 2522 const getToggleButton = this.matches(SELECTOR_DATA_TOGGLE$3) ? this : SelectorEngine.prev(this, SELECTOR_DATA_TOGGLE$3)[0]; 2523 const instance = Dropdown.getOrCreateInstance(getToggleButton); 2524 2525 if (event.key === ESCAPE_KEY$2) { 2526 instance.hide(); 2527 return; 2528 } 2529 2530 if (event.key === ARROW_UP_KEY || event.key === ARROW_DOWN_KEY) { 2531 if (!isActive) { 2532 instance.show(); 2533 } 2534 2535 instance._selectMenuItem(event); 2536 2537 return; 2538 } 2539 2540 if (!isActive || event.key === SPACE_KEY) { 2541 Dropdown.clearMenus(); 2542 } 2543 } 2544 2545 } 2546 /** 2547 * ------------------------------------------------------------------------ 2548 * Data Api implementation 2549 * ------------------------------------------------------------------------ 2550 */ 2551 2552 2553 EventHandler.on(document, EVENT_KEYDOWN_DATA_API, SELECTOR_DATA_TOGGLE$3, Dropdown.dataApiKeydownHandler); 2554 EventHandler.on(document, EVENT_KEYDOWN_DATA_API, SELECTOR_MENU, Dropdown.dataApiKeydownHandler); 2555 EventHandler.on(document, EVENT_CLICK_DATA_API$3, Dropdown.clearMenus); 2556 EventHandler.on(document, EVENT_KEYUP_DATA_API, Dropdown.clearMenus); 2557 EventHandler.on(document, EVENT_CLICK_DATA_API$3, SELECTOR_DATA_TOGGLE$3, function (event) { 2558 event.preventDefault(); 2559 Dropdown.getOrCreateInstance(this).toggle(); 2560 }); 2561 /** 2562 * ------------------------------------------------------------------------ 2563 * jQuery 2564 * ------------------------------------------------------------------------ 2565 * add .Dropdown to jQuery only if jQuery is present 2566 */ 2567 2568 defineJQueryPlugin(Dropdown); 2569 2570 /** 2571 * -------------------------------------------------------------------------- 2572 * Bootstrap (v5.1.3): util/scrollBar.js 2573 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 2574 * -------------------------------------------------------------------------- 2575 */ 2576 const SELECTOR_FIXED_CONTENT = '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top'; 2577 const SELECTOR_STICKY_CONTENT = '.sticky-top'; 2578 2579 class ScrollBarHelper { 2580 constructor() { 2581 this._element = document.body; 2582 } 2583 2584 getWidth() { 2585 // https://developer.mozilla.org/en-US/docs/Web/API/Window/innerWidth#usage_notes 2586 const documentWidth = document.documentElement.clientWidth; 2587 return Math.abs(window.innerWidth - documentWidth); 2588 } 2589 2590 hide() { 2591 const width = this.getWidth(); 2592 2593 this._disableOverFlow(); // give padding to element to balance the hidden scrollbar width 2594 2595 2596 this._setElementAttributes(this._element, 'paddingRight', calculatedValue => calculatedValue + width);
2596 // trick: We adjust positive paddingRight and negative marginRight to sticky-top elements to keep showing fullwidth 2597 2598 2599 this._setElementAttributes(SELECTOR_FIXED_CONTENT, 'paddingRight', calculatedValue => calculatedValue + width); 2600 2601 this._setElementAttributes(SELECTOR_STICKY_CONTENT, 'marginRight', calculatedValue => calculatedValue - width); 2602 } 2603 2604 _disableOverFlow() { 2605 this._saveInitialAttribute(this._element, 'overflow'); 2606 2607 this._element.style.overflow = 'hidden'; 2608 } 2609 2610 _setElementAttributes(selector, styleProp, callback) { 2611 const scrollbarWidth = this.getWidth(); 2612 2613 const manipulationCallBack = element => { 2614 if (element !== this._element && window.innerWidth > element.clientWidth + scrollbarWidth) { 2615 return; 2616 } 2617 2618 this._saveInitialAttribute(element, styleProp); 2619 2620 const calculatedValue = window.getComputedStyle(element)[styleProp]; 2621 element.style[styleProp] = `${callback(Number.parseFloat(calculatedValue))}px`; 2622 }; 2623 2624 this._applyManipulationCallback(selector, manipulationCallBack); 2625 } 2626 2627 reset() { 2628 this._resetElementAttributes(this._element, 'overflow'); 2629 2630 this._resetElementAttributes(this._element, 'paddingRight'); 2631 2632 this._resetElementAttributes(SELECTOR_FIXED_CONTENT, 'paddingRight'); 2633 2634 this._resetElementAttributes(SELECTOR_STICKY_CONTENT, 'marginRight'); 2635 } 2636 2637 _saveInitialAttribute(element, styleProp) { 2638 const actualValue = element.style[styleProp]; 2639 2640 if (actualValue) { 2641 Manipulator.setDataAttribute(element, styleProp, actualValue); 2642 } 2643 } 2644 2645 _resetElementAttributes(selector, styleProp) { 2646 const manipulationCallBack = element => { 2647 const value = Manipulator.getDataAttribute(element, styleProp); 2648 2649 if (typeof value === 'undefined') { 2650 element.style.removeProperty(styleProp); 2651 } else { 2652 Manipulator.removeDataAttribute(element, styleProp); 2653 element.style[styleProp] = value; 2654 } 2655 }; 2656 2657 this._applyManipulationCallback(selector, manipulationCallBack); 2658 } 2659 2660 _applyManipulationCallback(selector, callBack) { 2661 if (isElement(selector)) { 2662 callBack(selector); 2663 } else { 2664 SelectorEngine.find(selector, this._element).forEach(callBack); 2665 } 2666 } 2667 2668 isOverflowing() { 2669 return this.getWidth() > 0; 2670 } 2671 2672 } 2673 2674 /** 2675 * -------------------------------------------------------------------------- 2676 * Bootstrap (v5.1.3): util/backdrop.js 2677 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 2678 * -------------------------------------------------------------------------- 2679 */ 2680 const Default$7 = { 2681 className: 'modal-backdrop', 2682 isVisible: true, 2683 // if false, we use the backdrop helper without adding any element to the dom 2684 isAnimated: false, 2685 rootElement: 'body', 2686 // give the choice to place backdrop under different elements 2687 clickCallback: null 2688 }; 2689 const DefaultType$7 = { 2690 className: 'string', 2691 isVisible: 'boolean', 2692 isAnimated: 'boolean', 2693 rootElement: '(element|string)', 2694 clickCallback: '(function|null)' 2695 }; 2696 const NAME$8 = 'backdrop'; 2697 const CLASS_NAME_FADE$4 = 'fade';
2698 const CLASS_NAME_SHOW$5 = 'show'; 2699 const EVENT_MOUSEDOWN = `mousedown.bs.${NAME$8}`; 2700 2701 class Backdrop { 2702 constructor(config) { 2703 this._config = this._getConfig(config); 2704 this._isAppended = false; 2705 this._element = null; 2706 } 2707 2708 show(callback) { 2709 if (!this._config.isVisible) { 2710 execute(callback); 2711 return; 2712 } 2713 2714 this._append(); 2715 2716 if (this._config.isAnimated) { 2717 reflow(this._getElement()); 2718 } 2719 2720 this._getElement().classList.add(CLASS_NAME_SHOW$5); 2721 2722 this._emulateAnimation(() => { 2723 execute(callback); 2724 }); 2725 } 2726 2727 hide(callback) { 2728 if (!this._config.isVisible) { 2729 execute(callback); 2730 return; 2731 } 2732 2733 this._getElement().classList.remove(CLASS_NAME_SHOW$5); 2734 2735 this._emulateAnimation(() => { 2736 this.dispose(); 2737 execute(callback); 2738 }); 2739 } // Private 2740 2741 2742 _getElement() { 2743 if (!this._element) { 2744 const backdrop = document.createElement('div'); 2745 backdrop.className = this._config.className; 2746 2747 if (this._config.isAnimated) { 2748 backdrop.classList.add(CLASS_NAME_FADE$4); 2749 } 2750 2751 this._element = backdrop; 2752 } 2753 2754 return this._element; 2755 } 2756 2757 _getConfig(config) { 2758 config = { ...Default$7, 2759 ...(typeof config === 'object' ? config : {}) 2760 }; // use getElement() with the default "body" to get a fresh Element on each instantiation 2761 2762 config.rootElement = getElement(config.rootElement); 2763 typeCheckConfig(NAME$8, config, DefaultType$7); 2764 return config; 2765 } 2766 2767 _append() { 2768 if (this._isAppended) { 2769 return; 2770 } 2771 2772 this._config.rootElement.append(this._getElement()); 2773 2774 EventHandler.on(this._getElement(), EVENT_MOUSEDOWN, () => { 2775 execute(this._config.clickCallback); 2776 }); 2777 this._isAppended = true; 2778 } 2779 2780 dispose() { 2781 if (!this._isAppended) { 2782 return; 2783 } 2784 2785 EventHandler.off(this._element, EVENT_MOUSEDOWN); 2786 2787 this._element.remove(); 2788 2789 this._isAppended = false; 2790 } 2791 2792 _emulateAnimation(callback) { 2793 executeAfterTransition(callback, this._getElement(), this._config.isAnimated); 2794 } 2795 2796 } 2797 2798 /** 2799 * -------------------------------------------------------------------------- 2800 * Bootstrap (v5.1.3): util/focustrap.js 2801 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 2802 * -------------------------------------------------------------------------- 2803 */ 2804 const Default$6 = { 2805 trapElement: null, 2806 // The element to trap focus inside of 2807 autofocus: true 2808 }; 2809 const DefaultType$6 = { 2810 trapElement: 'element', 2811 autofocus: 'boolean' 2812 }; 2813 const NAME$7 = 'focustrap'; 2814 const DATA_KEY$7 = 'bs.focustrap'; 2815 const EVENT_KEY$7 = `.${DATA_KEY$7}`; 2816 const EVENT_FOCUSIN$1 = `focusin${EVENT_KEY$7}`; 2817 const EVENT_KEYDOWN_TAB = `keydown.tab${EVENT_KEY$7}`; 2818 const TAB_KEY = 'Tab'; 2819 const TAB_NAV_FORWARD = 'forward'; 2820 const TAB_NAV_BACKWARD = 'backward'; 2821 2822 class FocusTrap { 2823 constructor(config) { 2824 this._config = this._getConfig(config); 2825 this._isActive = false; 2826 this._lastTabNavDirection = null; 2827 } 2828 2829 activate() { 2830 const { 2831 trapElement, 2832 autofocus 2833 } = this._config; 2834 2835 if (this._isActive) { 2836 return; 2837 } 2838 2839 if (autofocus) { 2840 trapElement.focus(); 2841 } 2842 2843 EventHandler.off(document, EVENT_KEY$7); // guard against infinite focus loop 2844 2845 EventHandler.on(document, EVENT_FOCUSIN$1, event => this._handleFocusin(event)); 2846 EventHandler.on(document, EVENT_KEYDOWN_TAB, event => this._handleKeydown(event)); 2847 this._isActive = true; 2848 } 2849 2850 deactivate() { 2851 if (!this._isActive) { 2852 return; 2853 } 2854 2855 this._isActive = false; 2856 EventHandler.off(document, EVENT_KEY$7); 2857 } // Private 2858 2859 2860 _handleFocusin(event) { 2861 const { 2862 target 2863 } = event; 2864 const { 2865 trapElement 2866 } = this._config; 2867 2868 if (target === document || target === trapElement || trapElement.contains(target)) { 2869 return; 2870 } 2871 2872 const elements = SelectorEngine.focusableChildren(trapElement); 2873 2874 if (elements.length === 0) { 2875 trapElement.focus(); 2876 } else if (this._lastTabNavDirection === TAB_NAV_BACKWARD) { 2877 elements[elements.length - 1].focus(); 2878 } else { 2879 elements[0].focus(); 2880 } 2881 } 2882 2883 _handleKeydown(event) { 2884 if (event.key !== TAB_KEY) { 2885 return; 2886 } 2887 2888 this._lastTabNavDirection = event.shiftKey ? TAB_NAV_BACKWARD : TAB_NAV_FORWARD; 2889 } 2890 2891 _getConfig(config) { 2892 config = { ...Default$6, 2893 ...(typeof config === 'object' ? config : {}) 2894 }; 2895 typeCheckConfig(NAME$7, config, DefaultType$6); 2896 return config; 2897 } 2898 2899 } 2900 2901 /** 2902 * -------------------------------------------------------------------------- 2903 * Bootstrap (v5.1.3): modal.js 2904 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 2905 * -------------------------------------------------------------------------- 2906 */ 2907 /** 2908 * ------------------------------------------------------------------------ 2909 * Constants 2910 * ------------------------------------------------------------------------ 2911 */ 2912 2913 const NAME$6 = 'modal'; 2914 const DATA_KEY$6 = 'bs.modal'; 2915 const EVENT_KEY$6 = `.${DATA_KEY$6}`; 2916 const DATA_API_KEY$3 = '.data-api'; 2917 const ESCAPE_KEY$1 = 'Escape';
2918 const Default$5 = { 2919 backdrop: true, 2920 keyboard: true, 2921 focus: true 2922 }; 2923 const DefaultType$5 = { 2924 backdrop: '(boolean|string)', 2925 keyboard: 'boolean', 2926 focus: 'boolean' 2927 }; 2928 const EVENT_HIDE$3 = `hide${EVENT_KEY$6}`; 2929 const EVENT_HIDE_PREVENTED = `hidePrevented${EVENT_KEY$6}`; 2930 const EVENT_HIDDEN$3 = `hidden${EVENT_KEY$6}`; 2931 const EVENT_SHOW$3 = `show${EVENT_KEY$6}`; 2932 const EVENT_SHOWN$3 = `shown${EVENT_KEY$6}`; 2933 const EVENT_RESIZE = `resize${EVENT_KEY$6}`; 2934 const EVENT_CLICK_DISMISS = `click.dismiss${EVENT_KEY$6}`; 2935 const EVENT_KEYDOWN_DISMISS$1 = `keydown.dismiss${EVENT_KEY$6}`; 2936 const EVENT_MOUSEUP_DISMISS = `mouseup.dismiss${EVENT_KEY$6}`; 2937 const EVENT_MOUSEDOWN_DISMISS = `mousedown.dismiss${EVENT_KEY$6}`; 2938 const EVENT_CLICK_DATA_API$2 = `click${EVENT_KEY$6}${DATA_API_KEY$3}`; 2939 const CLASS_NAME_OPEN = 'modal-open'; 2940 const CLASS_NAME_FADE$3 = 'fade'; 2941 const CLASS_NAME_SHOW$4 = 'show'; 2942 const CLASS_NAME_STATIC = 'modal-static'; 2943 const OPEN_SELECTOR$1 = '.modal.show'; 2944 const SELECTOR_DIALOG = '.modal-dialog'; 2945 const SELECTOR_MODAL_BODY = '.modal-body'; 2946 const SELECTOR_DATA_TOGGLE$2 = '[data-bs-toggle="modal"]'; 2947 /** 2948 * ------------------------------------------------------------------------ 2949 * Class Definition 2950 * ------------------------------------------------------------------------ 2951 */ 2952 2953 class Modal extends BaseComponent { 2954 constructor(element, config) { 2955 super(element); 2956 this._config = this._getConfig(config); 2957 this._dialog = SelectorEngine.findOne(SELECTOR_DIALOG, this._element); 2958 this._backdrop = this._initializeBackDrop(); 2959 this._focustrap = this._initializeFocusTrap(); 2960 this._isShown = false; 2961 this._ignoreBackdropClick = false; 2962 this._isTransitioning = false; 2963 this._scrollBar = new ScrollBarHelper(); 2964 } // Getters 2965 2966 2967 static get Default() { 2968 return Default$5; 2969 } 2970 2971 static get NAME() { 2972 return NAME$6; 2973 } // Public 2974 2975 2976 toggle(relatedTarget) { 2977 return this._isShown ? this.hide() : this.show(relatedTarget); 2978 } 2979 2980 show(relatedTarget) { 2981 if (this._isShown || this._isTransitioning) { 2982 return; 2983 } 2984 2985 const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$3, { 2986 relatedTarget 2987 }); 2988 2989 if (showEvent.defaultPrevented) { 2990 return; 2991 } 2992 2993 this._isShown = true; 2994 2995 if (this._isAnimated()) { 2996 this._isTransitioning = true; 2997 } 2998 2999 this._scrollBar.hide(); 3000 3001 document.body.classList.add(CLASS_NAME_OPEN); 3002 3003 this._adjustDialog(); 3004 3005 this._setEscapeEvent(); 3006 3007 this._setResizeEvent(); 3008 3009 EventHandler.on(this._dialog, EVENT_MOUSEDOWN_DISMISS, () => { 3010 EventHandler.one(this._element, EVENT_MOUSEUP_DISMISS, event => { 3011 if (event.target === this._element) { 3012 this._ignoreBackdropClick = true; 3013 } 3014 }); 3015 }); 3016 3017 this._showBackdrop(() => this._showElement(relatedTarget)); 3018 } 3019 3020 hide() { 3021 if (!this._isShown || this._isTransitioning) { 3022 return; 3023 } 3024 3025 const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$3); 3026 3027 if (hideEvent.defaultPrevented) { 3028 return; 3029 } 3030 3031 this._isShown = false; 3032 3033 const isAnimated = this._isAnimated(); 3034 3035 if (isAnimated) { 3036 this._isTransitioning = true; 3037 } 3038 3039 this._setEscapeEvent(); 3040 3041 this._setResizeEvent(); 3042 3043 this._focustrap.deactivate(); 3044 3045 this._element.classList.remove(CLASS_NAME_SHOW$4); 3046 3047 EventHandler.off(this._element, EVENT_CLICK_DISMISS); 3048 EventHandler.off(this._dialog, EVENT_MOUSEDOWN_DISMISS); 3049 3050 this._queueCallback(() => this._hideModal(), this._element, isAnimated); 3051 } 3052 3053 dispose() { 3054 [window, this._dialog].forEach(htmlElement => EventHandler.off(htmlElement, EVENT_KEY$6)); 3055 3056 this._backdrop.dispose(); 3057 3058 this._focustrap.deactivate(); 3059 3060 super.dispose(); 3061 } 3062 3063 handleUpdate() { 3064 this._adjustDialog(); 3065 } // Private 3066 3067 3068 _initializeBackDrop() { 3069 return new Backdrop({ 3070 isVisible: Boolean(this._config.backdrop), 3071 // 'static' option will be translated to true, and booleans will keep their value 3072 isAnimated: this._isAnimated() 3073 }); 3074 } 3075 3076 _initializeFocusTrap() { 3077 return new FocusTrap({ 3078 trapElement: this._element 3079 }); 3080 } 3081 3082 _getConfig(config) { 3083 config = { ...Default$5, 3084 ...Manipulator.getDataAttributes(this._element), 3085 ...(typeof config === 'object' ? config : {}) 3086 }; 3087 typeCheckConfig(NAME$6, config, DefaultType$5); 3088 return config; 3089 } 3090 3091 _showElement(relatedTarget) { 3092 const isAnimated = this._isAnimated(); 3093 3094 const modalBody = SelectorEngine.findOne(SELECTOR_MODAL_BODY, this._dialog); 3095 3096 if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) { 3097 // Don't move modal's DOM position 3098 document.body.append(this._element); 3099 } 3100 3101 this._element.style.display = 'block'; 3102 3103 this._element.removeAttribute('aria-hidden'); 3104 3105 this._element.setAttribute('aria-modal', true); 3106 3107 this._element.setAttribute('role', 'dialog'); 3108 3109 this._element.scrollTop = 0; 3110 3111 if (modalBody) { 3112 modalBody.scrollTop = 0; 3113 } 3114 3115 if (isAnimated) { 3116 reflow(this._element); 3117 } 3118 3119 this._element.classList.add(CLASS_NAME_SHOW$4); 3120 3121 const transitionComplete = () => { 3122 if (this._config.focus) { 3123 this._focustrap.activate(); 3124 } 3125 3126 this._isTransitioning = false;
3127 EventHandler.trigger(this._element, EVENT_SHOWN$3, { 3128 relatedTarget 3129 }); 3130 }; 3131 3132 this._queueCallback(transitionComplete, this._dialog, isAnimated); 3133 } 3134 3135 _setEscapeEvent() { 3136 if (this._isShown) { 3137 EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS$1, event => { 3138 if (this._config.keyboard && event.key === ESCAPE_KEY$1) { 3139 event.preventDefault(); 3140 this.hide(); 3141 } else if (!this._config.keyboard && event.key === ESCAPE_KEY$1) { 3142 this._triggerBackdropTransition(); 3143 } 3144 }); 3145 } else { 3146 EventHandler.off(this._element, EVENT_KEYDOWN_DISMISS$1); 3147 } 3148 } 3149 3150 _setResizeEvent() { 3151 if (this._isShown) { 3152 EventHandler.on(window, EVENT_RESIZE, () => this._adjustDialog()); 3153 } else { 3154 EventHandler.off(window, EVENT_RESIZE); 3155 } 3156 } 3157 3158 _hideModal() { 3159 this._element.style.display = 'none'; 3160 3161 this._element.setAttribute('aria-hidden', true); 3162 3163 this._element.removeAttribute('aria-modal'); 3164 3165 this._element.removeAttribute('role'); 3166 3167 this._isTransitioning = false; 3168 3169 this._backdrop.hide(() => { 3170 document.body.classList.remove(CLASS_NAME_OPEN); 3171 3172 this._resetAdjustments(); 3173 3174 this._scrollBar.reset(); 3175 3176 EventHandler.trigger(this._element, EVENT_HIDDEN$3); 3177 }); 3178 } 3179 3180 _showBackdrop(callback) { 3181 EventHandler.on(this._element, EVENT_CLICK_DISMISS, event => { 3182 if (this._ignoreBackdropClick) { 3183 this._ignoreBackdropClick = false; 3184 return; 3185 } 3186 3187 if (event.target !== event.currentTarget) { 3188 return; 3189 } 3190 3191 if (this._config.backdrop === true) { 3192 this.hide(); 3193 } else if (this._config.backdrop === 'static') { 3194 this._triggerBackdropTransition(); 3195 } 3196 }); 3197 3198 this._backdrop.show(callback); 3199 } 3200 3201 _isAnimated() { 3202 return this._element.classList.contains(CLASS_NAME_FADE$3); 3203 } 3204 3205 _triggerBackdropTransition() { 3206 const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED); 3207 3208 if (hideEvent.defaultPrevented) { 3209 return; 3210 } 3211 3212 const { 3213 classList, 3214 scrollHeight, 3215 style 3216 } = this._element; 3217 const isModalOverflowing = scrollHeight > document.documentElement.clientHeight; // return if the following background transition hasn't yet completed 3218 3219 if (!isModalOverflowing && style.overflowY === 'hidden' || classList.contains(CLASS_NAME_STATIC)) { 3220 return; 3221 } 3222 3223 if (!isModalOverflowing) { 3224 style.overflowY = 'hidden'; 3225 } 3226 3227 classList.add(CLASS_NAME_STATIC); 3228 3229 this._queueCallback(() => { 3230 classList.remove(CLASS_NAME_STATIC); 3231 3232 if (!isModalOverflowing) { 3233 this._queueCallback(() => { 3234 style.overflowY = ''; 3235 }, this._dialog); 3236 } 3237 }, this._dialog); 3238 3239 this._element.focus(); 3240 } // ---------------------------------------------------------------------- 3241 // the following methods are used to handle overflowing modals 3242 // ---------------------------------------------------------------------- 3243 3244 3245 _adjustDialog() { 3246 const isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight; 3247 3248 const scrollbarWidth = this._scrollBar.getWidth(); 3249 3250 const isBodyOverflowing = scrollbarWidth > 0; 3251 3252 if (!isBodyOverflowing && isModalOverflowing && !isRTL() || isBodyOverflowing && !isModalOverflowing && isRTL()) { 3253 this._element.style.paddingLeft = `${scrollbarWidth}px`; 3254 } 3255 3256 if (isBodyOverflowing && !isModalOverflowing && !isRTL() || !isBodyOverflowing && isModalOverflowing && isRTL()) { 3257 this._element.style.paddingRight = `${scrollbarWidth}px`; 3258 } 3259 } 3260 3261 _resetAdjustments() { 3262 this._element.style.paddingLeft = ''; 3263 this._element.style.paddingRight = ''; 3264 } // Static 3265 3266 3267 static jQueryInterface(config, relatedTarget) { 3268 return this.each(function () { 3269 const data = Modal.getOrCreateInstance(this, config); 3270 3271 if (typeof config !== 'string') { 3272 return; 3273 } 3274 3275 if (typeof data[config] === 'undefined') {
vendor: 4,925 bytes, lines 3276-3457
3276 throw new TypeError(`No method named "${config}"`); 3277 } 3278 3279 data[config](relatedTarget); 3280 }); 3281 } 3282 3283 } 3284 /** 3285 * ------------------------------------------------------------------------ 3286 * Data Api implementation 3287 * ------------------------------------------------------------------------ 3288 */ 3289 3290 3291 EventHandler.on(document, EVENT_CLICK_DATA_API$2, SELECTOR_DATA_TOGGLE$2, function (event) { 3292 const target = getElementFromSelector(this); 3293 3294 if (['A', 'AREA'].includes(this.tagName)) { 3295 event.preventDefault(); 3296 } 3297 3298 EventHandler.one(target, EVENT_SHOW$3, showEvent => { 3299 if (showEvent.defaultPrevented) { 3300 // only register focus restorer if modal will actually get shown 3301 return; 3302 } 3303 3304 EventHandler.one(target, EVENT_HIDDEN$3, () => { 3305 if (isVisible(this)) { 3306 this.focus(); 3307 } 3308 }); 3309 }); // avoid conflict when clicking moddal toggler while another one is open 3310 3311 const allReadyOpen = SelectorEngine.findOne(OPEN_SELECTOR$1); 3312 3313 if (allReadyOpen) { 3314 Modal.getInstance(allReadyOpen).hide(); 3315 } 3316 3317 const data = Modal.getOrCreateInstance(target); 3318 data.toggle(this); 3319 }); 3320 enableDismissTrigger(Modal); 3321 /** 3322 * ------------------------------------------------------------------------ 3323 * jQuery 3324 * ------------------------------------------------------------------------ 3325 * add .Modal to jQuery only if jQuery is present 3326 */ 3327 3328 defineJQueryPlugin(Modal); 3329 3330 /** 3331 * -------------------------------------------------------------------------- 3332 * Bootstrap (v5.1.3): offcanvas.js 3333 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 3334 * -------------------------------------------------------------------------- 3335 */ 3336 /** 3337 * ------------------------------------------------------------------------ 3338 * Constants 3339 * ------------------------------------------------------------------------ 3340 */ 3341 3342 const NAME$5 = 'offcanvas'; 3343 const DATA_KEY$5 = 'bs.offcanvas'; 3344 const EVENT_KEY$5 = `.${DATA_KEY$5}`; 3345 const DATA_API_KEY$2 = '.data-api'; 3346 const EVENT_LOAD_DATA_API$1 = `load${EVENT_KEY$5}${DATA_API_KEY$2}`; 3347 const ESCAPE_KEY = 'Escape'; 3348 const Default$4 = { 3349 backdrop: true, 3350 keyboard: true, 3351 scroll: false 3352 }; 3353 const DefaultType$4 = { 3354 backdrop: 'boolean', 3355 keyboard: 'boolean', 3356 scroll: 'boolean' 3357 }; 3358 const CLASS_NAME_SHOW$3 = 'show'; 3359 const CLASS_NAME_BACKDROP = 'offcanvas-backdrop'; 3360 const OPEN_SELECTOR = '.offcanvas.show'; 3361 const EVENT_SHOW$2 = `show${EVENT_KEY$5}`; 3362 const EVENT_SHOWN$2 = `shown${EVENT_KEY$5}`; 3363 const EVENT_HIDE$2 = `hide${EVENT_KEY$5}`; 3364 const EVENT_HIDDEN$2 = `hidden${EVENT_KEY$5}`; 3365 const EVENT_CLICK_DATA_API$1 = `click${EVENT_KEY$5}${DATA_API_KEY$2}`; 3366 const EVENT_KEYDOWN_DISMISS = `keydown.dismiss${EVENT_KEY$5}`; 3367 const SELECTOR_DATA_TOGGLE$1 = '[data-bs-toggle="offcanvas"]'; 3368 /** 3369 * ------------------------------------------------------------------------ 3370 * Class Definition 3371 * ------------------------------------------------------------------------ 3372 */ 3373 3374 class Offcanvas extends BaseComponent { 3375 constructor(element, config) { 3376 super(element); 3377 this._config = this._getConfig(config); 3378 this._isShown = false; 3379 this._backdrop = this._initializeBackDrop(); 3380 this._focustrap = this._initializeFocusTrap(); 3381 3382 this._addEventListeners(); 3383 } // Getters 3384 3385 3386 static get NAME() { 3387 return NAME$5; 3388 } 3389 3390 static get Default() { 3391 return Default$4; 3392 } // Public 3393 3394 3395 toggle(relatedTarget) { 3396 return this._isShown ? this.hide() : this.show(relatedTarget); 3397 } 3398 3399 show(relatedTarget) { 3400 if (this._isShown) { 3401 return; 3402 } 3403 3404 const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$2, { 3405 relatedTarget 3406 }); 3407 3408 if (showEvent.defaultPrevented) { 3409 return; 3410 } 3411 3412 this._isShown = true; 3413 this._element.style.visibility = 'visible'; 3414 3415 this._backdrop.show(); 3416 3417 if (!this._config.scroll) { 3418 new ScrollBarHelper().hide(); 3419 } 3420 3421 this._element.removeAttribute('aria-hidden'); 3422 3423 this._element.setAttribute('aria-modal', true); 3424 3425 this._element.setAttribute('role', 'dialog'); 3426 3427 this._element.classList.add(CLASS_NAME_SHOW$3); 3428 3429 const completeCallBack = () => { 3430 if (!this._config.scroll) { 3431 this._focustrap.activate(); 3432 } 3433 3434 EventHandler.trigger(this._element, EVENT_SHOWN$2, { 3435 relatedTarget 3436 }); 3437 }; 3438 3439 this._queueCallback(completeCallBack, this._element, true); 3440 } 3441 3442 hide() { 3443 if (!this._isShown) { 3444 return; 3445 } 3446 3447 const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$2); 3448 3449 if (hideEvent.defaultPrevented) { 3450 return; 3451 } 3452 3453 this._focustrap.deactivate(); 3454 3455 this._element.blur(); 3456 3457 this._isShown = false;
3458 3459 this._element.classList.remove(CLASS_NAME_SHOW$3); 3460 3461 this._backdrop.hide(); 3462 3463 const completeCallback = () => { 3464 this._element.setAttribute('aria-hidden', true); 3465 3466 this._element.removeAttribute('aria-modal'); 3467 3468 this._element.removeAttribute('role'); 3469 3470 this._element.style.visibility = 'hidden'; 3471 3472 if (!this._config.scroll) { 3473 new ScrollBarHelper().reset(); 3474 } 3475 3476 EventHandler.trigger(this._element, EVENT_HIDDEN$2); 3477 }; 3478 3479 this._queueCallback(completeCallback, this._element, true); 3480 } 3481 3482 dispose() { 3483 this._backdrop.dispose(); 3484 3485 this._focustrap.deactivate(); 3486 3487 super.dispose(); 3488 } // Private 3489 3490 3491 _getConfig(config) { 3492 config = { ...Default$4, 3493 ...Manipulator.getDataAttributes(this._element), 3494 ...(typeof config === 'object' ? config : {}) 3495 }; 3496 typeCheckConfig(NAME$5, config, DefaultType$4); 3497 return config; 3498 } 3499 3500 _initializeBackDrop() { 3501 return new Backdrop({ 3502 className: CLASS_NAME_BACKDROP, 3503 isVisible: this._config.backdrop, 3504 isAnimated: true, 3505 rootElement: this._element.parentNode, 3506 clickCallback: () => this.hide() 3507 }); 3508 } 3509 3510 _initializeFocusTrap() { 3511 return new FocusTrap({ 3512 trapElement: this._element 3513 }); 3514 } 3515 3516 _addEventListeners() { 3517 EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS, event => { 3518 if (this._config.keyboard && event.key === ESCAPE_KEY) { 3519 this.hide(); 3520 } 3521 }); 3522 } // Static 3523 3524 3525 static jQueryInterface(config) { 3526 return this.each(function () { 3527 const data = Offcanvas.getOrCreateInstance(this, config); 3528 3529 if (typeof config !== 'string') { 3530 return; 3531 } 3532 3533 if (data[config] === undefined || config.startsWith('_') || config === 'constructor') { 3534 throw new TypeError(`No method named "${config}"`); 3535 } 3536 3537 data[config](this); 3538 }); 3539 } 3540 3541 } 3542 /** 3543 * ------------------------------------------------------------------------ 3544 * Data Api implementation 3545 * ------------------------------------------------------------------------ 3546 */ 3547 3548 3549 EventHandler.on(document, EVENT_CLICK_DATA_API$1, SELECTOR_DATA_TOGGLE$1, function (event) { 3550 const target = getElementFromSelector(this); 3551 3552 if (['A', 'AREA'].includes(this.tagName)) { 3553 event.preventDefault(); 3554 } 3555 3556 if (isDisabled(this)) { 3557 return; 3558 } 3559 3560 EventHandler.one(target, EVENT_HIDDEN$2, () => { 3561 // focus on trigger when it is closed 3562 if (isVisible(this)) { 3563 this.focus(); 3564 } 3565 }); // avoid conflict when clicking a toggler of an offcanvas, while another is open 3566 3567 const allReadyOpen = SelectorEngine.findOne(OPEN_SELECTOR); 3568 3569 if (allReadyOpen && allReadyOpen !== target) { 3570 Offcanvas.getInstance(allReadyOpen).hide(); 3571 } 3572 3573 const data = Offcanvas.getOrCreateInstance(target); 3574 data.toggle(this); 3575 }); 3576 EventHandler.on(window, EVENT_LOAD_DATA_API$1, () => SelectorEngine.find(OPEN_SELECTOR).forEach(el => Offcanvas.getOrCreateInstance(el).show())); 3577 enableDismissTrigger(Offcanvas); 3578 /** 3579 * ------------------------------------------------------------------------ 3580 * jQuery 3581 * ------------------------------------------------------------------------ 3582 */ 3583 3584 defineJQueryPlugin(Offcanvas); 3585 3586 /** 3587 * -------------------------------------------------------------------------- 3588 * Bootstrap (v5.1.3): util/sanitizer.js 3589 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 3590 * -------------------------------------------------------------------------- 3591 */ 3592 const uriAttributes = new Set(['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href']); 3593 const ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i; 3594 /** 3595 * A pattern that recognizes a commonly useful subset of URLs that are safe. 3596 * 3597 * Shoutout to Angular https://github.com/angular/angular/blob/12.2.x/packages/core/src/sanitization/url_sanitizer.ts 3598 */ 3599 3600 const SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file|sms):|[^#&/:?]*(?:[#/?]|$))/i; 3601 /** 3602 * A pattern that matches safe data URLs. Only matches image, video and audio types. 3603 * 3604 * Shoutout to Angular https://github.com/angular/angular/blob/12.2.x/packages/core/src/sanitization/url_sanitizer.ts 3605 */ 3606 3607 const DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[\d+/a-z]+=*$/i; 3608 3609 const allowedAttribute = (attribute, allowedAttributeList) => {
3610 const attributeName = attribute.nodeName.toLowerCase(); 3611 3612 if (allowedAttributeList.includes(attributeName)) { 3613 if (uriAttributes.has(attributeName)) { 3614 return Boolean(SAFE_URL_PATTERN.test(attribute.nodeValue) || DATA_URL_PATTERN.test(attribute.nodeValue)); 3615 } 3616 3617 return true; 3618 } 3619 3620 const regExp = allowedAttributeList.filter(attributeRegex => attributeRegex instanceof RegExp); // Check if a regular expression validates the attribute. 3621 3622 for (let i = 0, len = regExp.length; i < len; i++) { 3623 if (regExp[i].test(attributeName)) { 3624 return true; 3625 } 3626 } 3627 3628 return false; 3629 }; 3630 3631 const DefaultAllowlist = { 3632 // Global attributes allowed on any supplied element below. 3633 '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN], 3634 a: ['target', 'href', 'title', 'rel'], 3635 area: [], 3636 b: [], 3637 br: [], 3638 col: [], 3639 code: [], 3640 div: [], 3641 em: [], 3642 hr: [], 3643 h1: [], 3644 h2: [], 3645 h3: [], 3646 h4: [], 3647 h5: [], 3648 h6: [], 3649 i: [], 3650 img: ['src', 'srcset', 'alt', 'title', 'width', 'height'], 3651 li: [], 3652 ol: [], 3653 p: [], 3654 pre: [], 3655 s: [], 3656 small: [], 3657 span: [], 3658 sub: [], 3659 sup: [], 3660 strong: [], 3661 u: [], 3662 ul: [] 3663 }; 3664 function sanitizeHtml(unsafeHtml, allowList, sanitizeFn) { 3665 if (!unsafeHtml.length) { 3666 return unsafeHtml; 3667 } 3668 3669 if (sanitizeFn && typeof sanitizeFn === 'function') { 3670 return sanitizeFn(unsafeHtml); 3671 } 3672 3673 const domParser = new window.DOMParser(); 3674 const createdDocument = domParser.parseFromString(unsafeHtml, 'text/html'); 3675 const elements = [].concat(...createdDocument.body.querySelectorAll('*')); 3676 3677 for (let i = 0, len = elements.length; i < len; i++) { 3678 const element = elements[i]; 3679 const elementName = element.nodeName.toLowerCase(); 3680 3681 if (!Object.keys(allowList).includes(elementName)) { 3682 element.remove(); 3683 continue; 3684 } 3685 3686 const attributeList = [].concat(...element.attributes); 3687 const allowedAttributes = [].concat(allowList['*'] || [], allowList[elementName] || []); 3688 attributeList.forEach(attribute => { 3689 if (!allowedAttribute(attribute, allowedAttributes)) { 3690 element.removeAttribute(attribute.nodeName); 3691 } 3692 }); 3693 } 3694 3695 return createdDocument.body.innerHTML; 3696 } 3697 3698 /** 3699 * -------------------------------------------------------------------------- 3700 * Bootstrap (v5.1.3): tooltip.js 3701 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 3702 * -------------------------------------------------------------------------- 3703 */ 3704 /** 3705 * ------------------------------------------------------------------------ 3706 * Constants 3707 * ------------------------------------------------------------------------ 3708 */ 3709 3710 const NAME$4 = 'tooltip'; 3711 const DATA_KEY$4 = 'bs.tooltip'; 3712 const EVENT_KEY$4 = `.${DATA_KEY$4}`; 3713 const CLASS_PREFIX$1 = 'bs-tooltip'; 3714 const DISALLOWED_ATTRIBUTES = new Set(['sanitize', 'allowList', 'sanitizeFn']); 3715 const DefaultType$3 = { 3716 animation: 'boolean', 3717 template: 'string', 3718 title: '(string|element|function)', 3719 trigger: 'string', 3720 delay: '(number|object)', 3721 html: 'boolean', 3722 selector: '(string|boolean)', 3723 placement: '(string|function)', 3724 offset: '(array|string|function)', 3725 container: '(string|element|boolean)', 3726 fallbackPlacements: 'array', 3727 boundary: '(string|element)', 3728 customClass: '(string|function)', 3729 sanitize: 'boolean', 3730 sanitizeFn: '(null|function)', 3731 allowList: 'object', 3732 popperConfig: '(null|object|function)' 3733 }; 3734 const AttachmentMap = { 3735 AUTO: 'auto', 3736 TOP: 'top', 3737 RIGHT: isRTL() ? 'left' : 'right', 3738 BOTTOM: 'bottom', 3739 LEFT: isRTL() ? 'right' : 'left' 3740 }; 3741 const Default$3 = { 3742 animation: true, 3743 template: '<div class="tooltip" role="tooltip">' + '<div class="tooltip-arrow"></div>' + '<div class="tooltip-inner"></div>' + '</div>', 3744 trigger: 'hover focus', 3745 title: '', 3746 delay: 0, 3747 html: false, 3748 selector: false, 3749 placement: 'top', 3750 offset: [0, 0], 3751 container: false, 3752 fallbackPlacements: ['top', 'right', 'bottom', 'left'], 3753 boundary: 'clippingParents', 3754 customClass: '', 3755 sanitize: true, 3756 sanitizeFn: null, 3757 allowList: DefaultAllowlist, 3758 popperConfig: null 3759 }; 3760 const Event$2 = { 3761 HIDE: `hide${EVENT_KEY$4}`, 3762 HIDDEN: `hidden${EVENT_KEY$4}`, 3763 SHOW: `show${EVENT_KEY$4}`, 3764 SHOWN: `shown${EVENT_KEY$4}`, 3765 INSERTED: `inserted${EVENT_KEY$4}`, 3766 CLICK: `click${EVENT_KEY$4}`, 3767 FOCUSIN: `focusin${EVENT_KEY$4}`, 3768 FOCUSOUT: `focusout${EVENT_KEY$4}`, 3769 MOUSEENTER: `mouseenter${EVENT_KEY$4}`, 3770 MOUSELEAVE: `mouseleave${EVENT_KEY$4}` 3771 }; 3772 const CLASS_NAME_FADE$2 = 'fade';
3773 const CLASS_NAME_MODAL = 'modal'; 3774 const CLASS_NAME_SHOW$2 = 'show'; 3775 const HOVER_STATE_SHOW = 'show'; 3776 const HOVER_STATE_OUT = 'out'; 3777 const SELECTOR_TOOLTIP_INNER = '.tooltip-inner'; 3778 const SELECTOR_MODAL = `.${CLASS_NAME_MODAL}`; 3779 const EVENT_MODAL_HIDE = 'hide.bs.modal'; 3780 const TRIGGER_HOVER = 'hover'; 3781 const TRIGGER_FOCUS = 'focus'; 3782 const TRIGGER_CLICK = 'click'; 3783 const TRIGGER_MANUAL = 'manual'; 3784 /** 3785 * ------------------------------------------------------------------------ 3786 * Class Definition 3787 * ------------------------------------------------------------------------ 3788 */ 3789 3790 class Tooltip extends BaseComponent { 3791 constructor(element, config) { 3792 if (typeof Popper__namespace === 'undefined') { 3793 throw new TypeError('Bootstrap\'s tooltips require Popper (https://popper.js.org)'); 3794 } 3795 3796 super(element); // private 3797 3798 this._isEnabled = true; 3799 this._timeout = 0; 3800 this._hoverState = ''; 3801 this._activeTrigger = {}; 3802 this._popper = null; // Protected 3803 3804 this._config = this._getConfig(config); 3805 this.tip = null; 3806 3807 this._setListeners(); 3808 } // Getters 3809 3810 3811 static get Default() { 3812 return Default$3; 3813 } 3814 3815 static get NAME() { 3816 return NAME$4; 3817 } 3818 3819 static get Event() { 3820 return Event$2; 3821 } 3822 3823 static get DefaultType() { 3824 return DefaultType$3; 3825 } // Public 3826 3827 3828 enable() { 3829 this._isEnabled = true; 3830 } 3831 3832 disable() { 3833 this._isEnabled = false; 3834 } 3835 3836 toggleEnabled() { 3837 this._isEnabled = !this._isEnabled; 3838 } 3839 3840 toggle(event) { 3841 if (!this._isEnabled) { 3842 return; 3843 } 3844 3845 if (event) { 3846 const context = this._initializeOnDelegatedTarget(event); 3847 3848 context._activeTrigger.click = !context._activeTrigger.click; 3849 3850 if (context._isWithActiveTrigger()) { 3851 context._enter(null, context); 3852 } else { 3853 context._leave(null, context); 3854 } 3855 } else { 3856 if (this.getTipElement().classList.contains(CLASS_NAME_SHOW$2)) { 3857 this._leave(null, this); 3858 3859 return; 3860 } 3861 3862 this._enter(null, this); 3863 } 3864 } 3865 3866 dispose() { 3867 clearTimeout(this._timeout); 3868 EventHandler.off(this._element.closest(SELECTOR_MODAL), EVENT_MODAL_HIDE, this._hideModalHandler); 3869 3870 if (this.tip) { 3871 this.tip.remove(); 3872 } 3873 3874 this._disposePopper(); 3875 3876 super.dispose(); 3877 } 3878 3879 show() { 3880 if (this._element.style.display === 'none') { 3881 throw new Error('Please use show on visible elements'); 3882 } 3883 3884 if (!(this.isWithContent() && this._isEnabled)) { 3885 return; 3886 } 3887 3888 const showEvent = EventHandler.trigger(this._element, this.constructor.Event.SHOW); 3889 const shadowRoot = findShadowRoot(this._element); 3890 const isInTheDom = shadowRoot === null ? this._element.ownerDocument.documentElement.contains(this._element) : shadowRoot.contains(this._element); 3891 3892 if (showEvent.defaultPrevented || !isInTheDom) { 3893 return; 3894 } // A trick to recreate a tooltip in case a new title is given by using the NOT documented `data-bs-original-title` 3895 // This will be removed later in favor of a `setContent` method 3896 3897 3898 if (this.constructor.NAME === 'tooltip' && this.tip && this.getTitle() !== this.tip.querySelector(SELECTOR_TOOLTIP_INNER).innerHTML) { 3899 this._disposePopper(); 3900 3901 this.tip.remove(); 3902 this.tip = null; 3903 } 3904 3905 const tip = this.getTipElement(); 3906 const tipId = getUID(this.constructor.NAME);
3907 tip.setAttribute('id', tipId); 3908 3909 this._element.setAttribute('aria-describedby', tipId); 3910 3911 if (this._config.animation) { 3912 tip.classList.add(CLASS_NAME_FADE$2); 3913 } 3914 3915 const placement = typeof this._config.placement === 'function' ? this._config.placement.call(this, tip, this._element) : this._config.placement; 3916 3917 const attachment = this._getAttachment(placement); 3918 3919 this._addAttachmentClass(attachment); 3920 3921 const { 3922 container 3923 } = this._config; 3924 Data.set(tip, this.constructor.DATA_KEY, this); 3925 3926 if (!this._element.ownerDocument.documentElement.contains(this.tip)) { 3927 container.append(tip); 3928 EventHandler.trigger(this._element, this.constructor.Event.INSERTED); 3929 } 3930 3931 if (this._popper) { 3932 this._popper.update(); 3933 } else { 3934 this._popper = Popper__namespace.createPopper(this._element, tip, this._getPopperConfig(attachment)); 3935 } 3936 3937 tip.classList.add(CLASS_NAME_SHOW$2); 3938 3939 const customClass = this._resolvePossibleFunction(this._config.customClass); 3940 3941 if (customClass) { 3942 tip.classList.add(...customClass.split(' ')); 3943 } // If this is a touch-enabled device we add extra 3944 // empty mouseover listeners to the body's immediate children; 3945 // only needed because of broken event delegation on iOS 3946 // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html 3947 3948 3949 if ('ontouchstart' in document.documentElement) { 3950 [].concat(...document.body.children).forEach(element => { 3951 EventHandler.on(element, 'mouseover', noop); 3952 }); 3953 } 3954 3955 const complete = () => { 3956 const prevHoverState = this._hoverState; 3957 this._hoverState = null; 3958 EventHandler.trigger(this._element, this.constructor.Event.SHOWN); 3959 3960 if (prevHoverState === HOVER_STATE_OUT) { 3961 this._leave(null, this); 3962 } 3963 }; 3964 3965 const isAnimated = this.tip.classList.contains(CLASS_NAME_FADE$2); 3966 3967 this._queueCallback(complete, this.tip, isAnimated); 3968 } 3969 3970 hide() { 3971 if (!this._popper) { 3972 return; 3973 } 3974 3975 const tip = this.getTipElement(); 3976 3977 const complete = () => { 3978 if (this._isWithActiveTrigger()) { 3979 return; 3980 } 3981 3982 if (this._hoverState !== HOVER_STATE_SHOW) { 3983 tip.remove(); 3984 } 3985 3986 this._cleanTipClass(); 3987 3988 this._element.removeAttribute('aria-describedby'); 3989 3990 EventHandler.trigger(this._element, this.constructor.Event.HIDDEN); 3991 3992 this._disposePopper(); 3993 }; 3994 3995 const hideEvent = EventHandler.trigger(this._element, this.constructor.Event.HIDE); 3996 3997 if (hideEvent.defaultPrevented) { 3998 return; 3999 } 4000 4001 tip.classList.remove(CLASS_NAME_SHOW$2); // If this is a touch-enabled device we remove the extra 4002 // empty mouseover listeners we added for iOS support 4003 4004 if ('ontouchstart' in document.documentElement) { 4005 [].concat(...document.body.children).forEach(element => EventHandler.off(element, 'mouseover', noop)); 4006 } 4007 4008 this._activeTrigger[TRIGGER_CLICK] = false; 4009 this._activeTrigger[TRIGGER_FOCUS] = false; 4010 this._activeTrigger[TRIGGER_HOVER] = false; 4011 const isAnimated = this.tip.classList.contains(CLASS_NAME_FADE$2); 4012 4013 this._queueCallback(complete, this.tip, isAnimated); 4014 4015 this._hoverState = ''; 4016 } 4017 4018 update() { 4019 if (this._popper !== null) { 4020 this._popper.update(); 4021 } 4022 } // Protected 4023 4024 4025 isWithContent() { 4026 return Boolean(this.getTitle()); 4027 } 4028 4029 getTipElement() { 4030 if (this.tip) { 4031 return this.tip; 4032 } 4033 4034 const element = document.createElement('div'); 4035 element.innerHTML = this._config.template; 4036 const tip = element.children[0]; 4037 this.setContent(tip); 4038 tip.classList.remove(CLASS_NAME_FADE$2, CLASS_NAME_SHOW$2); 4039 this.tip = tip; 4040 return this.tip; 4041 } 4042 4043 setContent(tip) { 4044 this._sanitizeAndSetContent(tip, this.getTitle(), SELECTOR_TOOLTIP_INNER); 4045 } 4046 4047 _sanitizeAndSetContent(template, content, selector) { 4048 const templateElement = SelectorEngine.findOne(selector, template); 4049 4050 if (!content && templateElement) { 4051 templateElement.remove(); 4052 return; 4053 } // we use append for html objects to maintain js events 4054 4055 4056 this.setElementContent(templateElement, content); 4057 } 4058 4059 setElementContent(element, content) { 4060 if (element === null) { 4061 return; 4062 } 4063 4064 if (isElement(content)) { 4065 content = getElement(content); // content is a DOM node or a jQuery 4066 4067 if (this._config.html) { 4068 if (content.parentNode !== element) { 4069 element.innerHTML = ''; 4070 element.append(content); 4071 } 4072 } else { 4073 element.textContent = content.textContent; 4074 } 4075 4076 return; 4077 } 4078 4079 if (this._config.html) { 4080 if (this._config.sanitize) { 4081 content = sanitizeHtml(content, this._config.allowList, this._config.sanitizeFn); 4082 } 4083 4084 element.innerHTML = content; 4085 } else { 4086 element.textContent = content; 4087 } 4088 } 4089 4090 getTitle() { 4091 const title = this._element.getAttribute('data-bs-original-title') || this._config.title; 4092 4093 return this._resolvePossibleFunction(title); 4094 } 4095 4096 updateAttachment(attachment) { 4097 if (attachment === 'right') { 4098 return 'end'; 4099 } 4100 4101 if (attachment === 'left') { 4102 return 'start'; 4103 } 4104 4105 return attachment; 4106 } // Private 4107 4108 4109 _initializeOnDelegatedTarget(event, context) { 4110 return context || this.constructor.getOrCreateInstance(event.delegateTarget, this._getDelegateConfig()); 4111 } 4112 4113 _getOffset() { 4114 const { 4115 offset 4116 } = this._config; 4117 4118 if (typeof offset === 'string') { 4119 return offset.split(',').map(val => Number.parseInt(val, 10)); 4120 } 4121 4122 if (typeof offset === 'function') { 4123 return popperData => offset(popperData, this._element); 4124 } 4125 4126 return offset; 4127 } 4128 4129 _resolvePossibleFunction(content) { 4130 return typeof content === 'function' ? content.call(this._element) : content; 4131 } 4132 4133 _getPopperConfig(attachment) { 4134 const defaultBsPopperConfig = { 4135 placement: attachment, 4136 modifiers: [{ 4137 name: 'flip', 4138 options: { 4139 fallbackPlacements: this._config.fallbackPlacements 4140 } 4141 }, { 4142 name: 'offset', 4143 options: { 4144 offset: this._getOffset() 4145 } 4146 }, { 4147 name: 'preventOverflow', 4148 options: {
4149 boundary: this._config.boundary 4150 } 4151 }, { 4152 name: 'arrow', 4153 options: { 4154 element: `.${this.constructor.NAME}-arrow` 4155 } 4156 }, { 4157 name: 'onChange', 4158 enabled: true, 4159 phase: 'afterWrite', 4160 fn: data => this._handlePopperPlacementChange(data) 4161 }], 4162 onFirstUpdate: data => { 4163 if (data.options.placement !== data.placement) { 4164 this._handlePopperPlacementChange(data); 4165 } 4166 } 4167 }; 4168 return { ...defaultBsPopperConfig, 4169 ...(typeof this._config.popperConfig === 'function' ? this._config.popperConfig(defaultBsPopperConfig) : this._config.popperConfig) 4170 }; 4171 } 4172 4173 _addAttachmentClass(attachment) { 4174 this.getTipElement().classList.add(`${this._getBasicClassPrefix()}-${this.updateAttachment(attachment)}`); 4175 } 4176 4177 _getAttachment(placement) { 4178 return AttachmentMap[placement.toUpperCase()]; 4179 } 4180 4181 _setListeners() { 4182 const triggers = this._config.trigger.split(' '); 4183 4184 triggers.forEach(trigger => { 4185 if (trigger === 'click') { 4186 EventHandler.on(this._element, this.constructor.Event.CLICK, this._config.selector, event => this.toggle(event)); 4187 } else if (trigger !== TRIGGER_MANUAL) { 4188 const eventIn = trigger === TRIGGER_HOVER ? this.constructor.Event.MOUSEENTER : this.constructor.Event.FOCUSIN; 4189 const eventOut = trigger === TRIGGER_HOVER ? this.constructor.Event.MOUSELEAVE : this.constructor.Event.FOCUSOUT; 4190 EventHandler.on(this._element, eventIn, this._config.selector, event => this._enter(event)); 4191 EventHandler.on(this._element, eventOut, this._config.selector, event => this._leave(event)); 4192 } 4193 }); 4194 4195 this._hideModalHandler = () => { 4196 if (this._element) { 4197 this.hide(); 4198 } 4199 }; 4200 4201 EventHandler.on(this._element.closest(SELECTOR_MODAL), EVENT_MODAL_HIDE, this._hideModalHandler); 4202 4203 if (this._config.selector) { 4204 this._config = { ...this._config, 4205 trigger: 'manual', 4206 selector: '' 4207 }; 4208 } else { 4209 this._fixTitle(); 4210 } 4211 } 4212 4213 _fixTitle() { 4214 const title = this._element.getAttribute('title'); 4215 4216 const originalTitleType = typeof this._element.getAttribute('data-bs-original-title'); 4217 4218 if (title || originalTitleType !== 'string') { 4219 this._element.setAttribute('data-bs-original-title', title || ''); 4220 4221 if (title && !this._element.getAttribute('aria-label') && !this._element.textContent) { 4222 this._element.setAttribute('aria-label', title); 4223 } 4224 4225 this._element.setAttribute('title', ''); 4226 } 4227 } 4228 4229 _enter(event, context) { 4230 context = this._initializeOnDelegatedTarget(event, context); 4231 4232 if (event) { 4233 context._activeTrigger[event.type === 'focusin' ? TRIGGER_FOCUS : TRIGGER_HOVER] = true; 4234 } 4235 4236 if (context.getTipElement().classList.contains(CLASS_NAME_SHOW$2) || context._hoverState === HOVER_STATE_SHOW) { 4237 context._hoverState = HOVER_STATE_SHOW; 4238 return; 4239 } 4240 4241 clearTimeout(context._timeout); 4242 context._hoverState = HOVER_STATE_SHOW; 4243 4244 if (!context._config.delay || !context._config.delay.show) { 4245 context.show(); 4246 return; 4247 } 4248 4249 context._timeout = setTimeout(() => { 4250 if (context._hoverState === HOVER_STATE_SHOW) { 4251 context.show(); 4252 } 4253 }, context._config.delay.show); 4254 } 4255 4256 _leave(event, context) { 4257 context = this._initializeOnDelegatedTarget(event, context); 4258 4259 if (event) { 4260 context._activeTrigger[event.type === 'focusout' ? TRIGGER_FOCUS : TRIGGER_HOVER] = context._element.contains(event.relatedTarget); 4261 } 4262 4263 if (context._isWithActiveTrigger()) { 4264 return; 4265 } 4266 4267 clearTimeout(context._timeout); 4268 context._hoverState = HOVER_STATE_OUT; 4269 4270 if (!context._config.delay || !context._config.delay.hide) { 4271 context.hide(); 4272 return; 4273 } 4274 4275 context._timeout = setTimeout(() => { 4276 if (context._hoverState === HOVER_STATE_OUT) { 4277 context.hide(); 4278 } 4279 }, context._config.delay.hide); 4280 } 4281 4282 _isWithActiveTrigger() { 4283 for (const trigger in this._activeTrigger) { 4284 if (this._activeTrigger[trigger]) { 4285 return true; 4286 } 4287 } 4288 4289 return false;
4290 } 4291 4292 _getConfig(config) { 4293 const dataAttributes = Manipulator.getDataAttributes(this._element); 4294 Object.keys(dataAttributes).forEach(dataAttr => { 4295 if (DISALLOWED_ATTRIBUTES.has(dataAttr)) { 4296 delete dataAttributes[dataAttr]; 4297 } 4298 }); 4299 config = { ...this.constructor.Default, 4300 ...dataAttributes, 4301 ...(typeof config === 'object' && config ? config : {}) 4302 }; 4303 config.container = config.container === false ? document.body : getElement(config.container); 4304 4305 if (typeof config.delay === 'number') { 4306 config.delay = { 4307 show: config.delay, 4308 hide: config.delay 4309 }; 4310 } 4311 4312 if (typeof config.title === 'number') { 4313 config.title = config.title.toString(); 4314 } 4315 4316 if (typeof config.content === 'number') { 4317 config.content = config.content.toString(); 4318 } 4319 4320 typeCheckConfig(NAME$4, config, this.constructor.DefaultType); 4321 4322 if (config.sanitize) { 4323 config.template = sanitizeHtml(config.template, config.allowList, config.sanitizeFn); 4324 } 4325 4326 return config; 4327 } 4328 4329 _getDelegateConfig() { 4330 const config = {}; 4331 4332 for (const key in this._config) { 4333 if (this.constructor.Default[key] !== this._config[key]) { 4334 config[key] = this._config[key]; 4335 } 4336 } // In the future can be replaced with: 4337 // const keysWithDifferentValues = Object.entries(this._config).filter(entry => this.constructor.Default[entry[0]] !== this._config[entry[0]]) 4338 // `Object.fromEntries(keysWithDifferentValues)` 4339 4340 4341 return config; 4342 } 4343 4344 _cleanTipClass() { 4345 const tip = this.getTipElement(); 4346 const basicClassPrefixRegex = new RegExp(`(^|\\s)${this._getBasicClassPrefix()}\\S+`, 'g'); 4347 const tabClass = tip.getAttribute('class').match(basicClassPrefixRegex); 4348 4349 if (tabClass !== null && tabClass.length > 0) { 4350 tabClass.map(token => token.trim()).forEach(tClass => tip.classList.remove(tClass)); 4351 } 4352 } 4353 4354 _getBasicClassPrefix() { 4355 return CLASS_PREFIX$1; 4356 } 4357 4358 _handlePopperPlacementChange(popperData) { 4359 const { 4360 state 4361 } = popperData; 4362 4363 if (!state) { 4364 return; 4365 } 4366 4367 this.tip = state.elements.popper; 4368 4369 this._cleanTipClass(); 4370 4371 this._addAttachmentClass(this._getAttachment(state.placement)); 4372 } 4373 4374 _disposePopper() { 4375 if (this._popper) { 4376 this._popper.destroy(); 4377 4378 this._popper = null; 4379 } 4380 } // Static 4381 4382 4383 static jQueryInterface(config) { 4384 return this.each(function () { 4385 const data = Tooltip.getOrCreateInstance(this, config); 4386 4387 if (typeof config === 'string') { 4388 if (typeof data[config] === 'undefined') { 4389 throw new TypeError(`No method named "${config}"`); 4390 } 4391 4392 data[config](); 4393 } 4394 }); 4395 } 4396 4397 } 4398 /** 4399 * ------------------------------------------------------------------------ 4400 * jQuery 4401 * ------------------------------------------------------------------------ 4402 * add .Tooltip to jQuery only if jQuery is present 4403 */ 4404 4405 4406 defineJQueryPlugin(Tooltip); 4407 4408 /** 4409 * -------------------------------------------------------------------------- 4410 * Bootstrap (v5.1.3): popover.js 4411 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 4412 * -------------------------------------------------------------------------- 4413 */ 4414 /** 4415 * ------------------------------------------------------------------------ 4416 * Constants 4417 * ------------------------------------------------------------------------ 4418 */ 4419 4420 const NAME$3 = 'popover'; 4421 const DATA_KEY$3 = 'bs.popover'; 4422 const EVENT_KEY$3 = `.${DATA_KEY$3}`; 4423 const CLASS_PREFIX = 'bs-popover'; 4424 const Default$2 = { ...Tooltip.Default, 4425 placement: 'right', 4426 offset: [0, 8], 4427 trigger: 'click', 4428 content: '', 4429 template: '<div class="popover" role="tooltip">' + '<div class="popover-arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div>' + '</div>' 4430 }; 4431 const DefaultType$2 = { ...Tooltip.DefaultType, 4432 content: '(string|element|function)' 4433 }; 4434 const Event$1 = { 4435 HIDE: `hide${EVENT_KEY$3}`, 4436 HIDDEN: `hidden${EVENT_KEY$3}`, 4437 SHOW: `show${EVENT_KEY$3}`, 4438 SHOWN: `shown${EVENT_KEY$3}`, 4439 INSERTED: `inserted${EVENT_KEY$3}`, 4440 CLICK: `click${EVENT_KEY$3}`, 4441 FOCUSIN: `focusin${EVENT_KEY$3}`, 4442 FOCUSOUT: `focusout${EVENT_KEY$3}`, 4443 MOUSEENTER: `mouseenter${EVENT_KEY$3}`, 4444 MOUSELEAVE: `mouseleave${EVENT_KEY$3}` 4445 }; 4446 const SELECTOR_TITLE = '.popover-header';
4447 const SELECTOR_CONTENT = '.popover-body'; 4448 /** 4449 * ------------------------------------------------------------------------ 4450 * Class Definition 4451 * ------------------------------------------------------------------------ 4452 */ 4453 4454 class Popover extends Tooltip { 4455 // Getters 4456 static get Default() { 4457 return Default$2; 4458 } 4459 4460 static get NAME() { 4461 return NAME$3; 4462 } 4463 4464 static get Event() { 4465 return Event$1; 4466 } 4467 4468 static get DefaultType() { 4469 return DefaultType$2; 4470 } // Overrides 4471 4472 4473 isWithContent() { 4474 return this.getTitle() || this._getContent(); 4475 } 4476 4477 setContent(tip) { 4478 this._sanitizeAndSetContent(tip, this.getTitle(), SELECTOR_TITLE); 4479 4480 this._sanitizeAndSetContent(tip, this._getContent(), SELECTOR_CONTENT); 4481 } // Private 4482 4483 4484 _getContent() { 4485 return this._resolvePossibleFunction(this._config.content); 4486 } 4487 4488 _getBasicClassPrefix() { 4489 return CLASS_PREFIX; 4490 } // Static 4491 4492 4493 static jQueryInterface(config) { 4494 return this.each(function () { 4495 const data = Popover.getOrCreateInstance(this, config); 4496 4497 if (typeof config === 'string') { 4498 if (typeof data[config] === 'undefined') { 4499 throw new TypeError(`No method named "${config}"`); 4500 } 4501 4502 data[config](); 4503 } 4504 }); 4505 } 4506 4507 } 4508 /** 4509 * ------------------------------------------------------------------------ 4510 * jQuery 4511 * ------------------------------------------------------------------------ 4512 * add .Popover to jQuery only if jQuery is present 4513 */ 4514 4515 4516 defineJQueryPlugin(Popover); 4517 4518 /** 4519 * -------------------------------------------------------------------------- 4520 * Bootstrap (v5.1.3): scrollspy.js 4521 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 4522 * -------------------------------------------------------------------------- 4523 */ 4524 /** 4525 * ------------------------------------------------------------------------ 4526 * Constants 4527 * ------------------------------------------------------------------------ 4528 */ 4529 4530 const NAME$2 = 'scrollspy'; 4531 const DATA_KEY$2 = 'bs.scrollspy'; 4532 const EVENT_KEY$2 = `.${DATA_KEY$2}`; 4533 const DATA_API_KEY$1 = '.data-api'; 4534 const Default$1 = { 4535 offset: 10, 4536 method: 'auto', 4537 target: '' 4538 }; 4539 const DefaultType$1 = { 4540 offset: 'number', 4541 method: 'string', 4542 target: '(string|element)' 4543 }; 4544 const EVENT_ACTIVATE = `activate${EVENT_KEY$2}`; 4545 const EVENT_SCROLL = `scroll${EVENT_KEY$2}`; 4546 const EVENT_LOAD_DATA_API = `load${EVENT_KEY$2}${DATA_API_KEY$1}`; 4547 const CLASS_NAME_DROPDOWN_ITEM = 'dropdown-item'; 4548 const CLASS_NAME_ACTIVE$1 = 'active'; 4549 const SELECTOR_DATA_SPY = '[data-bs-spy="scroll"]'; 4550 const SELECTOR_NAV_LIST_GROUP$1 = '.nav, .list-group'; 4551 const SELECTOR_NAV_LINKS = '.nav-link'; 4552 const SELECTOR_NAV_ITEMS = '.nav-item'; 4553 const SELECTOR_LIST_ITEMS = '.list-group-item'; 4554 const SELECTOR_LINK_ITEMS = `${SELECTOR_NAV_LINKS}, ${SELECTOR_LIST_ITEMS}, .${CLASS_NAME_DROPDOWN_ITEM}`; 4555 const SELECTOR_DROPDOWN$1 = '.dropdown'; 4556 const SELECTOR_DROPDOWN_TOGGLE$1 = '.dropdown-toggle'; 4557 const METHOD_OFFSET = 'offset'; 4558 const METHOD_POSITION = 'position'; 4559 /** 4560 * ------------------------------------------------------------------------ 4561 * Class Definition 4562 * ------------------------------------------------------------------------ 4563 */ 4564 4565 class ScrollSpy extends BaseComponent { 4566 constructor(element, config) { 4567 super(element); 4568 this._scrollElement = this._element.tagName === 'BODY' ? window : this._element; 4569 this._config = this._getConfig(config); 4570 this._offsets = []; 4571 this._targets = []; 4572 this._activeTarget = null; 4573 this._scrollHeight = 0; 4574 EventHandler.on(this._scrollElement, EVENT_SCROLL, () => this._process()); 4575 this.refresh(); 4576 4577 this._process(); 4578 } // Getters 4579 4580 4581 static get Default() { 4582 return Default$1; 4583 } 4584 4585 static get NAME() { 4586 return NAME$2; 4587 } // Public 4588 4589 4590 refresh() { 4591 const autoMethod = this._scrollElement === this._scrollElement.window ? METHOD_OFFSET : METHOD_POSITION; 4592 const offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method; 4593 const offsetBase = offsetMethod === METHOD_POSITION ? this._getScrollTop() : 0; 4594 this._offsets = []; 4595 this._targets = []; 4596 this._scrollHeight = this._getScrollHeight(); 4597 const targets = SelectorEngine.find(SELECTOR_LINK_ITEMS, this._config.target); 4598 targets.map(element => { 4599 const targetSelector = getSelectorFromElement(element); 4600 const target = targetSelector ? SelectorEngine.findOne(targetSelector) : null; 4601 4602 if (target) { 4603 const targetBCR = target.getBoundingClientRect(); 4604 4605 if (targetBCR.width || targetBCR.height) { 4606 return [Manipulator[offsetMethod](target).top + offsetBase, targetSelector]; 4607 } 4608 } 4609 4610 return null; 4611 }).filter(item => item).sort((a, b) =>
4611 a[0] - b[0]).forEach(item => { 4612 this._offsets.push(item[0]); 4613 4614 this._targets.push(item[1]); 4615 }); 4616 } 4617 4618 dispose() { 4619 EventHandler.off(this._scrollElement, EVENT_KEY$2); 4620 super.dispose(); 4621 } // Private 4622 4623 4624 _getConfig(config) { 4625 config = { ...Default$1, 4626 ...Manipulator.getDataAttributes(this._element), 4627 ...(typeof config === 'object' && config ? config : {}) 4628 }; 4629 config.target = getElement(config.target) || document.documentElement; 4630 typeCheckConfig(NAME$2, config, DefaultType$1); 4631 return config; 4632 } 4633 4634 _getScrollTop() { 4635 return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop; 4636 } 4637 4638 _getScrollHeight() { 4639 return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight); 4640 } 4641 4642 _getOffsetHeight() { 4643 return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height; 4644 } 4645 4646 _process() { 4647 const scrollTop = this._getScrollTop() + this._config.offset; 4648 4649 const scrollHeight = this._getScrollHeight(); 4650 4651 const maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight(); 4652 4653 if (this._scrollHeight !== scrollHeight) { 4654 this.refresh(); 4655 } 4656 4657 if (scrollTop >= maxScroll) { 4658 const target = this._targets[this._targets.length - 1]; 4659 4660 if (this._activeTarget !== target) { 4661 this._activate(target); 4662 } 4663 4664 return; 4665 } 4666 4667 if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) { 4668 this._activeTarget = null; 4669 4670 this._clear(); 4671 4672 return; 4673 } 4674 4675 for (let i = this._offsets.length; i--;) { 4676 const isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]); 4677 4678 if (isActiveTarget) { 4679 this._activate(this._targets[i]); 4680 } 4681 } 4682 } 4683 4684 _activate(target) { 4685 this._activeTarget = target; 4686 4687 this._clear(); 4688 4689 const queries = SELECTOR_LINK_ITEMS.split(',').map(selector => `${selector}[data-bs-target="${target}"],${selector}[href="${target}"]`); 4690 const link = SelectorEngine.findOne(queries.join(','), this._config.target); 4691 link.classList.add(CLASS_NAME_ACTIVE$1); 4692 4693 if (link.classList.contains(CLASS_NAME_DROPDOWN_ITEM)) { 4694 SelectorEngine.findOne(SELECTOR_DROPDOWN_TOGGLE$1, link.closest(SELECTOR_DROPDOWN$1)).classList.add(CLASS_NAME_ACTIVE$1); 4695 } else { 4696 SelectorEngine.parents(link, SELECTOR_NAV_LIST_GROUP$1).forEach(listGroup => { 4697 // Set triggered links parents as active
4698 // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor 4699 SelectorEngine.prev(listGroup, `${SELECTOR_NAV_LINKS}, ${SELECTOR_LIST_ITEMS}`).forEach(item => item.classList.add(CLASS_NAME_ACTIVE$1)); // Handle special case when .nav-link is inside .nav-item 4700 4701 SelectorEngine.prev(listGroup, SELECTOR_NAV_ITEMS).forEach(navItem => { 4702 SelectorEngine.children(navItem, SELECTOR_NAV_LINKS).forEach(item => item.classList.add(CLASS_NAME_ACTIVE$1)); 4703 }); 4704 }); 4705 } 4706 4707 EventHandler.trigger(this._scrollElement, EVENT_ACTIVATE, { 4708 relatedTarget: target 4709 }); 4710 } 4711 4712 _clear() { 4713 SelectorEngine.find(SELECTOR_LINK_ITEMS, this._config.target).filter(node => node.classList.contains(CLASS_NAME_ACTIVE$1)).forEach(node => node.classList.remove(CLASS_NAME_ACTIVE$1)); 4714 } // Static 4715 4716 4717 static jQueryInterface(config) { 4718 return this.each(function () { 4719 const data = ScrollSpy.getOrCreateInstance(this, config); 4720 4721 if (typeof config !== 'string') { 4722 return; 4723 } 4724 4725 if (typeof data[config] === 'undefined') { 4726 throw new TypeError(`No method named "${config}"`); 4727 } 4728 4729 data[config](); 4730 }); 4731 } 4732 4733 } 4734 /** 4735 * ------------------------------------------------------------------------ 4736 * Data Api implementation 4737 * ------------------------------------------------------------------------ 4738 */ 4739 4740 4741 EventHandler.on(window, EVENT_LOAD_DATA_API, () => { 4742 SelectorEngine.find(SELECTOR_DATA_SPY).forEach(spy => new ScrollSpy(spy)); 4743 }); 4744 /** 4745 * ------------------------------------------------------------------------ 4746 * jQuery 4747 * ------------------------------------------------------------------------ 4748 * add .ScrollSpy to jQuery only if jQuery is present 4749 */ 4750 4751 defineJQueryPlugin(ScrollSpy); 4752 4753 /** 4754 * -------------------------------------------------------------------------- 4755 * Bootstrap (v5.1.3): tab.js 4756 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 4757 * -------------------------------------------------------------------------- 4758 */ 4759 /** 4760 * ------------------------------------------------------------------------ 4761 * Constants 4762 * ------------------------------------------------------------------------ 4763 */ 4764 4765 const NAME$1 = 'tab'; 4766 const DATA_KEY$1 = 'bs.tab'; 4767 const EVENT_KEY$1 = `.${DATA_KEY$1}`; 4768 const DATA_API_KEY = '.data-api'; 4769 const EVENT_HIDE$1 = `hide${EVENT_KEY$1}`; 4770 const EVENT_HIDDEN$1 = `hidden${EVENT_KEY$1}`; 4771 const EVENT_SHOW$1 = `show${EVENT_KEY$1}`; 4772 const EVENT_SHOWN$1 = `shown${EVENT_KEY$1}`; 4773 const EVENT_CLICK_DATA_API = `click${EVENT_KEY$1}${DATA_API_KEY}`; 4774 const CLASS_NAME_DROPDOWN_MENU = 'dropdown-menu'; 4775 const CLASS_NAME_ACTIVE = 'active'; 4776 const CLASS_NAME_FADE$1 = 'fade';
4777 const CLASS_NAME_SHOW$1 = 'show'; 4778 const SELECTOR_DROPDOWN = '.dropdown'; 4779 const SELECTOR_NAV_LIST_GROUP = '.nav, .list-group'; 4780 const SELECTOR_ACTIVE = '.active'; 4781 const SELECTOR_ACTIVE_UL = ':scope > li > .active'; 4782 const SELECTOR_DATA_TOGGLE = '[data-bs-toggle="tab"], [data-bs-toggle="pill"], [data-bs-toggle="list"]'; 4783 const SELECTOR_DROPDOWN_TOGGLE = '.dropdown-toggle'; 4784 const SELECTOR_DROPDOWN_ACTIVE_CHILD = ':scope > .dropdown-menu .active'; 4785 /** 4786 * ------------------------------------------------------------------------ 4787 * Class Definition 4788 * ------------------------------------------------------------------------ 4789 */ 4790 4791 class Tab extends BaseComponent { 4792 // Getters 4793 static get NAME() { 4794 return NAME$1; 4795 } // Public 4796 4797 4798 show() { 4799 if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && this._element.classList.contains(CLASS_NAME_ACTIVE)) { 4800 return; 4801 } 4802 4803 let previous; 4804 const target = getElementFromSelector(this._element); 4805 4806 const listElement = this._element.closest(SELECTOR_NAV_LIST_GROUP); 4807 4808 if (listElement) { 4809 const itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? SELECTOR_ACTIVE_UL : SELECTOR_ACTIVE; 4810 previous = SelectorEngine.find(itemSelector, listElement); 4811 previous = previous[previous.length - 1]; 4812 } 4813 4814 const hideEvent = previous ? EventHandler.trigger(previous, EVENT_HIDE$1, { 4815 relatedTarget: this._element 4816 }) : null; 4817 const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$1, { 4818 relatedTarget: previous 4819 }); 4820 4821 if (showEvent.defaultPrevented || hideEvent !== null && hideEvent.defaultPrevented) { 4822 return; 4823 } 4824 4825 this._activate(this._element, listElement); 4826 4827 const complete = () => { 4828 EventHandler.trigger(previous, EVENT_HIDDEN$1, { 4829 relatedTarget: this._element 4830 }); 4831 EventHandler.trigger(this._element, EVENT_SHOWN$1, { 4832 relatedTarget: previous 4833 }); 4834 }; 4835 4836 if (target) { 4837 this._activate(target, target.parentNode, complete); 4838 } else { 4839 complete(); 4840 } 4841 } // Private 4842 4843 4844 _activate(element, container, callback) { 4845 const activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? SelectorEngine.find(SELECTOR_ACTIVE_UL, container) : SelectorEngine.children(container, SELECTOR_ACTIVE); 4846 const active = activeElements[0]; 4847 const isTransitioning = callback && active && active.classList.contains(CLASS_NAME_FADE$1); 4848 4849 const complete = () => this._transitionComplete(element, active, callback); 4850 4851 if (active && isTransitioning) { 4852 active.classList.remove(CLASS_NAME_SHOW$1); 4853 4854 this._queueCallback(complete, element, true); 4855 } else { 4856 complete(); 4857 } 4858 } 4859 4860 _transitionComplete(element, active, callback) { 4861 if (active) { 4862 active.classList.remove(CLASS_NAME_ACTIVE);
4863 const dropdownChild = SelectorEngine.findOne(SELECTOR_DROPDOWN_ACTIVE_CHILD, active.parentNode); 4864 4865 if (dropdownChild) { 4866 dropdownChild.classList.remove(CLASS_NAME_ACTIVE); 4867 } 4868 4869 if (active.getAttribute('role') === 'tab') { 4870 active.setAttribute('aria-selected', false); 4871 } 4872 } 4873 4874 element.classList.add(CLASS_NAME_ACTIVE); 4875 4876 if (element.getAttribute('role') === 'tab') { 4877 element.setAttribute('aria-selected', true); 4878 } 4879 4880 reflow(element); 4881 4882 if (element.classList.contains(CLASS_NAME_FADE$1)) { 4883 element.classList.add(CLASS_NAME_SHOW$1); 4884 } 4885 4886 let parent = element.parentNode; 4887 4888 if (parent && parent.nodeName === 'LI') { 4889 parent = parent.parentNode; 4890 } 4891 4892 if (parent && parent.classList.contains(CLASS_NAME_DROPDOWN_MENU)) { 4893 const dropdownElement = element.closest(SELECTOR_DROPDOWN); 4894 4895 if (dropdownElement) { 4896 SelectorEngine.find(SELECTOR_DROPDOWN_TOGGLE, dropdownElement).forEach(dropdown => dropdown.classList.add(CLASS_NAME_ACTIVE)); 4897 } 4898 4899 element.setAttribute('aria-expanded', true); 4900 } 4901 4902 if (callback) { 4903 callback(); 4904 } 4905 } // Static 4906 4907 4908 static jQueryInterface(config) { 4909 return this.each(function () { 4910 const data = Tab.getOrCreateInstance(this); 4911 4912 if (typeof config === 'string') { 4913 if (typeof data[config] === 'undefined') { 4914 throw new TypeError(`No method named "${config}"`); 4915 } 4916 4917 data[config](); 4918 } 4919 }); 4920 } 4921 4922 } 4923 /** 4924 * ------------------------------------------------------------------------ 4925 * Data Api implementation 4926 * ------------------------------------------------------------------------ 4927 */ 4928 4929 4930 EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) { 4931 if (['A', 'AREA'].includes(this.tagName)) { 4932 event.preventDefault(); 4933 } 4934 4935 if (isDisabled(this)) { 4936 return; 4937 } 4938 4939 const data = Tab.getOrCreateInstance(this); 4940 data.show(); 4941 }); 4942 /** 4943 * ------------------------------------------------------------------------ 4944 * jQuery 4945 * ------------------------------------------------------------------------ 4946 * add .Tab to jQuery only if jQuery is present 4947 */ 4948 4949 defineJQueryPlugin(Tab); 4950 4951 /** 4952 * -------------------------------------------------------------------------- 4953 * Bootstrap (v5.1.3): toast.js 4954 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 4955 * -------------------------------------------------------------------------- 4956 */ 4957 /** 4958 * ------------------------------------------------------------------------ 4959 * Constants 4960 * ------------------------------------------------------------------------ 4961 */ 4962 4963 const NAME = 'toast'; 4964 const DATA_KEY = 'bs.toast'; 4965 const EVENT_KEY = `.${DATA_KEY}`; 4966 const EVENT_MOUSEOVER = `mouseover${EVENT_KEY}`; 4967 const EVENT_MOUSEOUT = `mouseout${EVENT_KEY}`; 4968 const EVENT_FOCUSIN = `focusin${EVENT_KEY}`; 4969 const EVENT_FOCUSOUT = `focusout${EVENT_KEY}`; 4970 const EVENT_HIDE = `hide${EVENT_KEY}`; 4971 const EVENT_HIDDEN = `hidden${EVENT_KEY}`; 4972 const EVENT_SHOW = `show${EVENT_KEY}`; 4973 const EVENT_SHOWN = `shown${EVENT_KEY}`; 4974 const CLASS_NAME_FADE = 'fade';
vendor: 4,599 bytes, lines 4975-5160
4975 const CLASS_NAME_HIDE = 'hide'; // @deprecated - kept here only for backwards compatibility 4976 4977 const CLASS_NAME_SHOW = 'show'; 4978 const CLASS_NAME_SHOWING = 'showing'; 4979 const DefaultType = { 4980 animation: 'boolean', 4981 autohide: 'boolean', 4982 delay: 'number' 4983 }; 4984 const Default = { 4985 animation: true, 4986 autohide: true, 4987 delay: 5000 4988 }; 4989 /** 4990 * ------------------------------------------------------------------------ 4991 * Class Definition 4992 * ------------------------------------------------------------------------ 4993 */ 4994 4995 class Toast extends BaseComponent { 4996 constructor(element, config) { 4997 super(element); 4998 this._config = this._getConfig(config); 4999 this._timeout = null; 5000 this._hasMouseInteraction = false; 5001 this._hasKeyboardInteraction = false; 5002 5003 this._setListeners(); 5004 } // Getters 5005 5006 5007 static get DefaultType() { 5008 return DefaultType; 5009 } 5010 5011 static get Default() { 5012 return Default; 5013 } 5014 5015 static get NAME() { 5016 return NAME; 5017 } // Public 5018 5019 5020 show() { 5021 const showEvent = EventHandler.trigger(this._element, EVENT_SHOW); 5022 5023 if (showEvent.defaultPrevented) { 5024 return; 5025 } 5026 5027 this._clearTimeout(); 5028 5029 if (this._config.animation) { 5030 this._element.classList.add(CLASS_NAME_FADE); 5031 } 5032 5033 const complete = () => { 5034 this._element.classList.remove(CLASS_NAME_SHOWING); 5035 5036 EventHandler.trigger(this._element, EVENT_SHOWN); 5037 5038 this._maybeScheduleHide(); 5039 }; 5040 5041 this._element.classList.remove(CLASS_NAME_HIDE); // @deprecated 5042 5043 5044 reflow(this._element); 5045 5046 this._element.classList.add(CLASS_NAME_SHOW); 5047 5048 this._element.classList.add(CLASS_NAME_SHOWING); 5049 5050 this._queueCallback(complete, this._element, this._config.animation); 5051 } 5052 5053 hide() { 5054 if (!this._element.classList.contains(CLASS_NAME_SHOW)) { 5055 return; 5056 } 5057 5058 const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE); 5059 5060 if (hideEvent.defaultPrevented) { 5061 return; 5062 } 5063 5064 const complete = () => { 5065 this._element.classList.add(CLASS_NAME_HIDE); // @deprecated 5066 5067 5068 this._element.classList.remove(CLASS_NAME_SHOWING); 5069 5070 this._element.classList.remove(CLASS_NAME_SHOW); 5071 5072 EventHandler.trigger(this._element, EVENT_HIDDEN); 5073 }; 5074 5075 this._element.classList.add(CLASS_NAME_SHOWING); 5076 5077 this._queueCallback(complete, this._element, this._config.animation); 5078 } 5079 5080 dispose() { 5081 this._clearTimeout(); 5082 5083 if (this._element.classList.contains(CLASS_NAME_SHOW)) { 5084 this._element.classList.remove(CLASS_NAME_SHOW); 5085 } 5086 5087 super.dispose(); 5088 } // Private 5089 5090 5091 _getConfig(config) { 5092 config = { ...Default, 5093 ...Manipulator.getDataAttributes(this._element), 5094 ...(typeof config === 'object' && config ? config : {}) 5095 }; 5096 typeCheckConfig(NAME, config, this.constructor.DefaultType); 5097 return config; 5098 } 5099 5100 _maybeScheduleHide() { 5101 if (!this._config.autohide) { 5102 return; 5103 } 5104 5105 if (this._hasMouseInteraction || this._hasKeyboardInteraction) { 5106 return; 5107 } 5108 5109 this._timeout = setTimeout(() => { 5110 this.hide(); 5111 }, this._config.delay); 5112 } 5113 5114 _onInteraction(event, isInteracting) { 5115 switch (event.type) { 5116 case 'mouseover': 5117 case 'mouseout': 5118 this._hasMouseInteraction = isInteracting; 5119 break; 5120 5121 case 'focusin': 5122 case 'focusout': 5123 this._hasKeyboardInteraction = isInteracting; 5124 break; 5125 } 5126 5127 if (isInteracting) { 5128 this._clearTimeout(); 5129 5130 return; 5131 } 5132 5133 const nextElement = event.relatedTarget; 5134 5135 if (this._element === nextElement || this._element.contains(nextElement)) { 5136 return; 5137 } 5138 5139 this._maybeScheduleHide(); 5140 } 5141 5142 _setListeners() { 5143 EventHandler.on(this._element, EVENT_MOUSEOVER, event => this._onInteraction(event, true)); 5144 EventHandler.on(this._element, EVENT_MOUSEOUT, event => this._onInteraction(event, false)); 5145 EventHandler.on(this._element, EVENT_FOCUSIN, event => this._onInteraction(event, true)); 5146 EventHandler.on(this._element, EVENT_FOCUSOUT, event => this._onInteraction(event, false)); 5147 } 5148 5149 _clearTimeout() { 5150 clearTimeout(this._timeout); 5151 this._timeout = null; 5152 } // Static 5153 5154 5155 static jQueryInterface(config) { 5156 return this.each(function () { 5157 const data = Toast.getOrCreateInstance(this, config); 5158 5159 if (typeof config === 'string') { 5160 if (typeof data[config] === 'undefined') {
5161 throw new TypeError(`No method named "${config}"`); 5162 } 5163 5164 data[config](this); 5165 } 5166 }); 5167 } 5168 5169 } 5170 5171 enableDismissTrigger(Toast); 5172 /** 5173 * ------------------------------------------------------------------------ 5174 * jQuery 5175 * ------------------------------------------------------------------------ 5176 * add .Toast to jQuery only if jQuery is present 5177 */ 5178 5179 defineJQueryPlugin(Toast); 5180 5181 /** 5182 * -------------------------------------------------------------------------- 5183 * Bootstrap (v5.1.3): index.umd.js 5184 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 5185 * -------------------------------------------------------------------------- 5186 */ 5187 const index_umd = { 5188 Alert, 5189 Button, 5190 Carousel, 5191 Collapse, 5192 Dropdown, 5193 Modal, 5194 Offcanvas, 5195 Popover, 5196 ScrollSpy, 5197 Tab, 5198 Toast, 5199 Tooltip 5200 }; 5201 5202 return index_umd; 5203 5204})); 5205//# sourceMappingURL=bootstrap.js.map 5206 5207window.sweSikaProductsDebugger = {}; 5208 5209(function (self) { 5210 'use strict' 5211 5212 /*********** 5213 * Private * 5214 ***********/ 5215 5216 let _availableModules = {}, 5217 _debug = false, 5218 _extClass = '' 5219 5220 /** 5221 * Add available modules. 5222 * 5223 * @param {string} filename 5224 * @param {string[]} modules 5225 * @private 5226 */ 5227 function _addModules (filename, modules) { 5228 if (!_availableModules.hasOwnProperty(filename)) _availableModules[filename] = [] 5229 5230 for (let i = 0; i < modules.length; i += 1) { 5231 if (_availableModules[filename].indexOf(modules[i]) !== -1) continue 5232 _availableModules[filename].push(modules[i]) 5233 } 5234 } 5235 5236 /** 5237 * Check if an object is available in window. 5238 * 5239 * @param {string} namespace The namespace to check 5240 * @return {boolean} 5241 * @private 5242 */ 5243 function _isWindowGlobal (namespace) { 5244 for (let name in window) { 5245 if (name === namespace) return true 5246 } 5247 5248 return false 5249 } 5250 5251 /** 5252 * Get the current line number. 5253 * 5254 * @return {string} Returns the line number. 5255 * @private 5256 */ 5257 function _getLineNumber () { 5258 let e = new Error() 5259 if (!e.stack) { 5260 try { 5261 throw e 5262 } catch (e) { 5263 if (!e.stack) return '0' 5264 } 5265 } 5266 5267 let stack = e.stack.toString().split(/\r\n|\n/), 5268 frameRe = /:(\d+):(?:\d+)[^\d]*$/, 5269 frame 5270 5271 do { 5272 frame = stack.shift() 5273 } while (!frameRe.exec(frame) && stack.length) 5274 stack.shift() 5275 return frameRe.exec(stack.shift())[1] 5276 } 5277 5278 /** 5279 * Get the debug level. 5280 * 5281 * @return {number} Returns the debug level. 5282 */ 5283 function _getDebugLevel () { 5284 if (_extClass.length < 1) return 0 5285 let element = document.querySelector('#' + _extClass + '-debug') 5286 if (!element || !element.hasAttribute('data-debug-level')) return 0 5287 return parseInt(element.getAttribute('data-debug-level')) 5288 } 5289 5290 /********** 5291 * Public * 5292 **********/ 5293 5294 // constants 5295 self.DEBUG_FUNC_END = 0 5296 self.DEBUG_FUNC_START = 1 5297 self.DEBUG_FUNC_CALLED = 2 5298 5299 // @see \Swe\Core\Service\LogServiceInterface 5300 self.LEVEL_EMERGENCY = 0 5301 self.LEVEL_ALERT = 1 5302 self.LEVEL_CRITICAL = 2 5303 self.LEVEL_ERROR = 3 5304 self.LEVEL_WARNING = 4 5305 self.LEVEL_NOTICE = 5 5306 self.LEVEL_INFO = 6 5307 self.LEVEL_DEBUG = 7 5308 5309 /** 5310 * Check if checked module is available. 5311 * 5312 * @param {string} filename 5313 * @param {string} module 5314 * @return {boolean} 5315 */ 5316 self.isModuleAvailable = function (filename, module) { 5317 if (!_availableModules.hasOwnProperty(filename)) return false 5318 return _availableModules[filename].indexOf(module) !== -1 5319 } 5320 5321 /** 5322 * @param {number} group 5323 * @param {string} [name='anonymous'] OPTIONAL. 5324 */ 5325 self.debuggingFunc = function (group, name) { 5326 let functionDebugLevel = self.LEVEL_WARNING 5327 5328 if (!self.isDebug() || _getDebugLevel() < functionDebugLevel) return 5329 if (typeof name === 'undefined') name = 'anonymous' 5330 5331 switch (group) { 5332 case self.DEBUG_FUNC_START: 5333 console.group(name) 5334 break 5335 case self.DEBUG_FUNC_END: 5336 console.groupEnd() 5337 break 5338 case self.DEBUG_FUNC_CALLED: 5339 self.debuggingFunc(self.DEBUG_FUNC_START, name) 5340 self.debuggingFunc(self.DEBUG_FUNC_END, name) 5341 break 5342 } 5343 } 5344 5345 /** 5346 * Print a variable via console.log if the debug mode is enabled. 5347 * 5348 * @param {*} variable The variable to debug. 5349 * @param {number|null} [level=self.LEVEL_INFO] OPTIONAL. The log level. 5350 */ 5351 self.debug = function (variable, level) { 5352 if (typeof level === 'undefined') level = self.LEVEL_INFO 5353 if (!self.isDebug() || _getDebugLevel() < level) return 5354 console.log('Line: ' + _getLineNumber() + ' -', variable) 5355 } 5356 5357 /** 5358 * Print an error message via console.warn. If the debug mode is disabled, printing a default error message. 5359 * 5360 * @param {string} message The error message. 5361 * @param {number|null} [level=self.LEVEL_ERROR] OPTIONAL. The log level. 5362 */ 5363 self.error = function (message, level) { 5364 if (typeof level === 'undefined') level = self.LEVEL_ERROR 5365 if (_getDebugLevel() >= level || self.isDebug()) { 5366 console.warn('Line: ' + _getLineNumber() + ' -', message) 5367 return 5368 } 5369 5370 console.warn('Line: ' + _getLineNumber() + ' -', 'An error occurred') 5371 } 5372 5373 /** 5374 * @param {string} extClass 5375 */ 5376 self.setExtClass = function (extClass) { 5377 _extClass = extClass 5378 } 5379 5380 /** 5381 * @return {string} 5382 */ 5383 self.getExtClass = function () { 5384 return _extClass 5385 } 5386 5387 /** 5388 * Check if the debug mode is enabled. 5389 * 5390 * @return {boolean} Returns TRUE if the debug mode is enabled, FALSE if it's disabled. 5391 */ 5392 self.isDebug = function () { 5393 if (_debug) return _debug 5394 if (_extClass.length < 1) return _debug 5395 let element = document.querySelector('#' + _extClass + '-debug') 5396 if (!element || !element.hasAttribute('data-debug')) return _debug 5397 return element.getAttribute('data-debug') === '1' 5398 } 5399 5400 /** 5401 * @param {boolean} debug 5402 */ 5403 self.setDebug = function (debug) { 5404 _debug = debug === true 5405 } 5406 5407 /** 5408 * Check if modules are available. 5409 * 5410 * @param {string[]} modules 5411 * @param {string} type 5412 * @param {boolean} stop 5413 * @param {string} filename 5414 */ 5415 self.checkModules = function (modules, type, stop, filename) { 5416 self.debuggingFunc(self.DEBUG_FUNC_START, 'sweSikaProductsDebugger.checkModules') 5417 self.debug('Checking modules for: ' + filename, self.LEVEL_INFO) 5418 self.debug('Modules to check: ' + JSON.stringify(modules), self.LEVEL_DEBUG) 5419 self.debug('Modules are: ' + type, self.LEVEL_DEBUG) 5420 5421 let notFound = [],
5422 stringFilename = '[' + filename + '.js] ', 5423 string = stringFilename + type.toUpperCase() + ' NAMESPACES NOT FOUND: ' 5424 5425 if (modules.length < 1) { 5426 _addModules(filename, modules) 5427 string = stringFilename + 'No modules to load.' 5428 self.debug(string, self.LEVEL_INFO) 5429 self.debuggingFunc(self.DEBUG_FUNC_END) 5430 return 5431 } 5432 5433 for (let i = 0; i < modules.length; i += 1) { 5434 if (_isWindowGlobal(modules[i])) { 5435 _addModules(filename, [modules[i]]) 5436 continue 5437 } 5438 5439 notFound.push(modules[i]) 5440 } 5441 5442 if (notFound.length === 0) { 5443 string = stringFilename + 'All ' + type + ' modules (' + modules.length + ') loaded.' 5444 self.debug(string, self.LEVEL_INFO) 5445 self.debuggingFunc(self.DEBUG_FUNC_END) 5446 return 5447 } 5448 5449 if (stop) { 5450 self.debuggingFunc(self.DEBUG_FUNC_END) 5451 throw string + notFound.join(', ') 5452 } 5453 5454 self.error(string + notFound.join(', '), self.LEVEL_ERROR) 5455 self.debuggingFunc(self.DEBUG_FUNC_END) 5456 } 5457 5458})(window.sweSikaProductsDebugger) 5459 5460window.sweSikaProductsHelper = {}; 5461 5462(function (self) { 5463 'use strict' 5464 5465 /*********** 5466 * Private * 5467 ***********/ 5468 5469 let _requiredModules = [], 5470 _suggestedModules = [], 5471 _filename = 'swe-helper', 5472 _checked = false, 5473 _cookieProtection = true, 5474 _elementPrefixes = [ 5475 '#', 5476 '.', 5477 '[', 5478 ], 5479 _htmlTags = [], 5480 _cookieBannerNames = [ 5481 'cookieBanner',
5482 'cookieBanner2019', 5483 ] 5484 5485 /** 5486 * @private 5487 */ 5488 function _check () { 5489 if (_checked) return 5490 if (!sweSikaProductsDebugger) throw '[' + _filename + '.js] Required namespace "sweSikaProductsDebugger" not found.' 5491 5492 sweSikaProductsDebugger.checkModules(_requiredModules, 'required', true, _filename) 5493 sweSikaProductsDebugger.checkModules(_suggestedModules, 'suggested', false, _filename) 5494 _checked = true 5495 } 5496 5497 /** 5498 * Set all available html tag names from the current dom. 5499 * @private 5500 */ 5501 function _setAllHtmlTagNames () { 5502 sweSikaProductsDebugger.debuggingFunc(sweSikaProductsDebugger.DEBUG_FUNC_START, 'sweSikaProductsHelper._getAllHtmlTagNames') 5503 let all = document.getElementsByTagName('*') 5504 5505 for (let i = 0, max = all.length; i < max; i += 1) { 5506 let tag = all[i].tagName.toLowerCase() 5507 if (_htmlTags.indexOf(tag) !== -1) continue 5508 _htmlTags.push(tag) 5509 } 5510 5511 sweSikaProductsDebugger.debug(_htmlTags, sweSikaProductsDebugger.LEVEL_DEBUG) 5512 sweSikaProductsDebugger.debuggingFunc(sweSikaProductsDebugger.DEBUG_FUNC_END) 5513 } 5514 5515 /********** 5516 * Public * 5517 **********/ 5518 5519 /** 5520 * @type {number} 5521 */ 5522 self.recursionCounter = 0 5523 5524 /** 5525 * @type {number} 5526 */ 5527 self.maxRecursions = 10 5528 5529 /** 5530 * Get the cookie protection. 5531 * 5532 * @return {boolean} 5533 */ 5534 self.getCookieProtection = function () { 5535 return _cookieProtection 5536 } 5537 5538 /** 5539 * Set the cookie protection. 5540 * 5541 * @param {boolean} protection 5542 */ 5543 self.setCookieProtection = function (protection) { 5544 _cookieProtection = protection 5545 } 5546 5547 /** 5548 * Check if we can create cookies. 5549 * 5550 * @return {boolean} 5551 */ 5552 self.isCookieAllowed = function () { 5553 return self.setCookie('cookie-test', 'test', 0) 5554 } 5555 5556 /** 5557 * Get a cookie. 5558 * 5559 * @param {string} name The name of the cookie. 5560 * @returns {string} Returns the cookie value. 5561 */ 5562 self.getCookie = function (name) { 5563 let nameEQ = name + '=', 5564 cookieArray = document.cookie.split(';') 5565 5566 for (let i = 0; i < cookieArray.length; i += 1) { 5567 let cookie = cookieArray[i] 5568 5569 while (cookie.charAt(0) === ' ') { 5570 cookie = cookie.substring(1, cookie.length) 5571 } 5572 5573 if (cookie.indexOf(nameEQ) === 0) { 5574 return cookie.substring(nameEQ.length, cookie.length) 5575 } 5576 } 5577 5578 return '' 5579 } 5580 5581 /** 5582 * Set or delete a cookie. 5583 * 5584 * @param {string} name The name of the cookie. 5585 * @param {string} value The value of the cookie. 5586 * @param {number|null} [days=null] OPTIONAL. The number of days until the cookie expires. 5587 * @return {boolean} Returns TRUE if the cookie was set, FALSE if the cookieBanner is not set. 5588 */ 5589 self.setCookie = function (name, value, days) { 5590 let date = new Date(), 5591 expires = '; expires=', 5592 gmtString = 'Thu, 01 Jan 1970 00:00:01 GMT', 5593 valid = false 5594 5595 for (let i = 0; i < _cookieBannerNames.length; i += 1) { 5596 if (!_cookieProtection || self.getCookie(_cookieBannerNames[i]).toLowerCase() === 'set') valid = true 5597 } 5598 5599 if (!valid) { 5600 if (name !== 'cookie-test') { 5601 sweSikaProductsDebugger.error('The cookie banner is not accepted') 5602 sweSikaProductsDebugger.debuggingFunc(sweSikaProductsDebugger.DEBUG_FUNC_END) 5603 } 5604 5605 return false 5606 } 5607 5608 if (name === 'cookie-test') return true 5609 5610 if (days) { 5611 date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000)) 5612 gmtString = date.toGMTString() 5613 } 5614 5615 document.cookie = name + '=' + value + expires + gmtString + '; path=/' 5616 return true 5617 } 5618 5619 /** 5620 * Remove all children elements from an element. 5621 * 5622 * @param {HTMLElement} element The HTMLElement instance. 5623 */ 5624 self.removeChildren = function (element) { 5625 while (element.hasChildNodes()) { 5626 element.removeChild(element.firstChild) 5627 } 5628 } 5629 5630 /** 5631 * Get an element by a selector. 5632 * 5633 * @param {string} selector The selector. 5634 * @param {HTMLElement|Document} [element=null] OPTIONAL. The element to search from. 5635 * @return {HTMLElement} Returns the html element. 5636 */ 5637 self.getElement = function (selector, element) { 5638 element = element || document 5639 if (_htmlTags.length === 0) _setAllHtmlTagNames() 5640 5641 if (_htmlTags.indexOf(selector) === -1) { 5642 if (_elementPrefixes.indexOf(selector.charAt(0)) === -1) selector = '#' + selector 5643 } 5644 5645 return element.querySelector(selector) 5646 } 5647 5648 /** 5649 * Get elements by a selector. 5650 * 5651 * @param {string} selector The selector. 5652 * @param {HTMLElement|Document} [element=null] OPTIONAL. The element to search from. 5653 * @return {NodeListOf<HTMLElement>} Returns a list of html elements. 5654 */ 5655 self.getElements = function (selector, element) { 5656 element = element || document 5657 if (_htmlTags.length === 0) _setAllHtmlTagNames() 5658 5659 if (_htmlTags.indexOf(selector) === -1) { 5660 if (_elementPrefixes.indexOf(selector.charAt(0)) === -1) selector = '.' + selector 5661 } 5662 5663 return element.querySelectorAll(selector) 5664 } 5665 5666 /** 5667 * Get the parent element with the given selector. 5668 * 5669 * @param {HTMLElement} element 5670 * @param {string} selector 5671 * @return {HTMLElement} 5672 */ 5673 self.getParentWithClass = function (element, selector) { 5674 while ((element = element.parentElement) && !(element.classList.contains(selector))) { 5675 // Nothing inside. 5676 } 5677 5678 return element 5679 } 5680 5681 /** 5682 * Remove a css class from a dom element. 5683 * 5684 * @param {HTMLElement} element The html element. 5685 * @param {string} className The name of the class. 5686 */ 5687 self.removeDomClass = function (element, className) { 5688 if (element.classList.contains(className)) element.classList.remove(className) 5689 } 5690 5691 /** 5692 * Add a css class to a dom element. 5693 * 5694 * @param {HTMLElement} element The html element. 5695 * @param {string} className The name of the class. 5696 */ 5697 self.addDomClass = function (element, className) { 5698 if (!element.classList.contains(className)) element.classList.add(className) 5699 } 5700 5701 /** 5702 * Show an html element. 5703 * 5704 * @param {HTMLElement} element The html element. 5705 */ 5706 self.show = function (element) { 5707 self.removeDomClass(element, 'hidden') 5708 } 5709 5710 /** 5711 * Hide an html element. 5712 * 5713 * @param {HTMLElement} element The html element. 5714 */ 5715 self.hide = function (element) { 5716 self.addDomClass(element, 'hidden') 5717 } 5718 5719 /** 5720 * Check if an element is hidden. 5721 * 5722 * @param {HTMLElement} element The html element to check. 5723 * @return {boolean} Returns TRUE if the element is hidden. 5724 */ 5725 self.isHidden = function (element) { 5726 return element.classList.contains('hidden') 5727 } 5728 5729 /** 5730 * Get a random index. 5731 * 5732 * @param {array} array An array where we want to get a random index. 5733 * @return {number} Returns the index. 5734 */ 5735 self.getRandomIndex = function (array) { 5736 return Math.floor(Math.random() * array.length) 5737 } 5738 5739 /** 5740 * Endless loop protection. 5741 * 5742 * @param {number} [max=null] OPTIONAL. The maximum of allowed recursions. 5743 * @return {number|null} Returns the number of recursions if the limit is reached, NULL if it's alright. 5744 */ 5745 self.recursionProtection = function (max) { 5746 sweSikaProductsDebugger.debuggingFunc(sweSikaProductsDebugger.DEBUG_FUNC_START, 'sweHelperGroupTravel.recursionProtection') 5747 if (typeof max === 'undefined' || max === 0) max = self.maxRecursions 5748 let infoMessage = 'Recursion counter: ' + self.recursionCounter.toString() 5749 5750 if (max > self.recursionCounter) { 5751 self.recursionCounter += 1 5752 sweSikaProductsDebugger.debug(infoMessage, sweSikaProductsDebugger.LEVEL_INFO) 5753 sweSikaProductsDebugger.debuggingFunc(sweSikaProductsDebugger.DEBUG_FUNC_END) 5754 return null 5755 } 5756 5757 let amount = self.recursionCounter 5758 infoMessage = 'The maximum of recursions is reached. (Amount: ' + amount + ')' 5759 self.resetRecursion() 5760 sweSikaProductsDebugger.debug(infoMessage, sweSikaProductsDebugger.LEVEL_INFO) 5761 sweSikaProductsDebugger.debuggingFunc(sweSikaProductsDebugger.DEBUG_FUNC_END) 5762 return amount 5763 } 5764 5765 /** 5766 * Reset the recursion counter. 5767 */ 5768 self.resetRecursion = function () { 5769 self.recursionCounter = 0 5770 } 5771 5772 /** 5773 * Check if it's the current action. 5774 * 5775 * @param {string} action The action name. 5776 * @return {boolean} Returns TRUE if it's the current action, FALSE if not. 5777 */ 5778 self.isAction = function (action) { 5779 sweSikaProductsDebugger.debuggingFunc(sweSikaProductsDebugger.DEBUG_FUNC_START, 'sweSikaProductsHelper.isAction') 5780 let root = self.getElement('.' + sweSikaProductsDebugger.getExtClass()) 5781 5782 if (!root || !root.hasAttribute('data-action')) { 5783 sweSikaProductsDebugger.debug('This isn\'t an action of this extension!', sweSikaProductsDebugger.LEVEL_WARNING) 5784 sweSikaProductsDebugger.debuggingFunc(sweSikaProductsDebugger.DEBUG_FUNC_END) 5785 return false 5786 } 5787 5788 let realAction = root.getAttribute('data-action') 5789 sweSikaProductsDebugger.debug('Action ' + realAction.toLowerCase() + ' === ' + action.toLowerCase(), sweSikaProductsDebugger.LEVEL_DEBUG) 5790 5791 sweSikaProductsDebugger.debuggingFunc(sweSikaProductsDebugger.DEBUG_FUNC_END) 5792 return realAction.toLowerCase() === action.toLowerCase() 5793 } 5794 5795 /** 5796 * Check is the current action is one of the given actions. 5797 * 5798 * @param {string[]} actions The action names. 5799 * @return {boolean} Returns TRUE if the current action is one of the given actions, FALSE if not. 5800 */ 5801 self.isOneOfActions = function (actions) { 5802 sweSikaProductsDebugger.debuggingFunc(sweSikaProductsDebugger.DEBUG_FUNC_START, 'sweSikaProductsHelper.isOneOfActions') 5803 for (let i = 0; i < actions.length; i += 1) { 5804 if (!self.isAction(actions[i])) continue 5805 sweSikaProductsDebugger.debuggingFunc(sweSikaProductsDebugger.DEBUG_FUNC_END) 5806 return true 5807 } 5808 5809 sweSikaProductsDebugger.debuggingFunc(sweSikaProductsDebugger.DEBUG_FUNC_END) 5810 return false 5811 } 5812 5813 /** 5814 * Set up module sweSikaProductsHelper. 5815 */ 5816 self.setup = function () { 5817 _check() 5818 _setAllHtmlTagNames() 5819 5820 return self 5821 } 5822 5823})(window.sweSikaProductsHelper) 5824 5825window.sweSikaProductsIE = {}; 5826 5827(function (self) { 5828 'use strict' 5829 5830 /*********** 5831 * Private * 5832 ***********/ 5833 5834 let _requiredModules = [ 5835 'sweSikaProductsHelper' 5836 ], 5837 _suggestedModules = [], 5838 _filename = 'swe-ie', 5839 _checked = false, 5840 _isIE = false, 5841 _extClass = '' 5842 5843 /** 5844 * @private 5845 */ 5846 function _check () { 5847 if (_checked) return 5848 if (!sweSikaProductsDebugger) throw '[' + _filename + '.js] Required namespace "sweSikaProductsDebugger" not found.' 5849 5850 sweSikaProductsDebugger.checkModules(_requiredModules, 'required', true, _filename) 5851 sweSikaProductsDebugger.checkModules(_suggestedModules, 'suggested', false, _filename) 5852 _checked = true 5853 } 5854 5855 /** 5856 * @private 5857 */ 5858 function _initScrollableTables () { 5859 sweSikaProductsDebugger.debuggingFunc(sweSikaProductsDebugger.DEBUG_FUNC_START, 'sweSikaProductsIE._initScrollableTables') 5860 let tables = sweSikaProductsHelper.getElements('.scrollable table') 5861 5862 for (let i = 0; i < tables.length; i += 1) { 5863 let table = tables[i], 5864 tableHeaders = sweSikaProductsHelper.getElements('th', table), 5865 maxWidth = 0 5866 5867 for (let j = 0; j < tableHeaders.length; j += 1) { 5868 let width = tableHeaders[j].offsetWidth 5869 5870 maxWidth = width > maxWidth ? width : maxWidth 5871 } 5872 5873 for (let j = 0; j < tableHeaders.length; j += 1) { 5874 tableHeaders[j].style.width = maxWidth + 'px' 5875 } 5876 5877 table.style.marginLeft = maxWidth + 'px' 5878 } 5879 sweSikaProductsDebugger.debuggingFunc(sweSikaProductsDebugger.DEBUG_FUNC_END) 5880 } 5881 5882 /************* 5883 * Polyfills * 5884 *************/ 5885 5886 let polyfills = { 5887 5888 /** 5889 * Initiate all polyfills. 5890 */ 5891 setup: function () { 5892 for (let method in this) {
5893 if (!this.hasOwnProperty(method)) continue 5894 if (method === 'setup') continue 5895 this[method]() 5896 } 5897 }, 5898 5899 /** 5900 * Enables "String.includes()". 5901 */ 5902 includes: function () { 5903 String.prototype.includes = function (search, start) { 5904 'use strict' 5905 5906 if (typeof start !== 'number') start = 0 5907 5908 if (start + search.length > this.length) { 5909 return false 5910 } 5911 5912 return this.indexOf(search, start) !== -1 5913 } 5914 }, 5915 5916 /** 5917 * Enables "SVGElement.classList" with "contains", "add", "remove" and "toggle". 5918 */ 5919 svgClassList: function () { 5920 Object.defineProperty(SVGElement.prototype, 'classList', { 5921 get: function get () { 5922 let _this = this 5923 5924 return { 5925 contains: function contains (className) { 5926 return _this.className.baseVal.split(' ').indexOf(className) !== 1 5927 }, 5928 add: function add (className) { 5929 return _this.setAttribute('class', _this.getAttribute('class') + ' ' + className) 5930 }, 5931 remove: function remove (className) { 5932 let removedClass = _this 5933 .getAttribute('class') 5934 .replace( 5935 new RegExp('(\\s|^)'.concat(className, '(\\s|$)'), 'g'), 5936 '$2' 5937 ) 5938 5939 if (_this.classList.contains(className)) { 5940 _this.setAttribute('class', removedClass) 5941 } 5942 }, 5943 toggle: function toggle (className) { 5944 if (this.contains(className)) { 5945 this.remove(className) 5946 } else { 5947 this.add(className) 5948 } 5949 }, 5950 } 5951 } 5952 }) 5953 }, 5954 } 5955 5956 /********** 5957 * Public * 5958 **********/ 5959 5960 /** 5961 * @return {boolean} 5962 */ 5963 self.isIE = function () { 5964 return _isIE 5965 } 5966 5967 /** 5968 * Set up module sweSikaProductsIE. 5969 */ 5970 self.setup = function (extClass) { 5971 _check() 5972 _extClass = extClass 5973 _isIE = !!window.MSInputMethodContext && !!document.documentMode 5974 if (!_isIE) return self 5975 5976 sweSikaProductsHelper.addDomClass(sweSikaProductsHelper.getElement('.' + _extClass), 'ie') 5977 _initScrollableTables() 5978 polyfills.setup() 5979 5980 return self 5981 } 5982 5983})(window.sweSikaProductsIE) 5984 5985window.sweSikaProductsMapConstruct = {}; 5986 5987(function (self) { 5988 'use strict' 5989 5990 /*********** 5991 * Private * 5992 ***********/ 5993 5994 let _requiredModules = [ 5995 'google', 5996 ], 5997 _suggestedModules = [ 5998 'MarkerClusterer', 5999 ], 6000 _checked = false, 6001 _filename = 'swe-map-construct', 6002 _markerImagePath = '/typo3conf/ext/swe_sika_products/Resources/Public/Images/markerclusterer' 6003 6004 /** 6005 * @private 6006 */ 6007 function _check () { 6008 if (_checked) return 6009 if (!sweSikaProductsDebugger) throw '[' + _filename + '.js] Required namespace "sweSikaProductsDebugger" not found.' 6010 6011 sweSikaProductsDebugger.checkModules(_requiredModules, 'required', true, _filename) 6012 sweSikaProductsDebugger.checkModules(_suggestedModules, 'suggested', false, _filename) 6013 _checked = true 6014 } 6015 6016 /********** 6017 * Public * 6018 **********/ 6019 6020 self.__config = { 6021 canvasID: null, 6022 map: null, 6023 markers: [], 6024 marker_icon: { 6025 path: 'M0-48c-9.8 0-17.7 7.8-17.7 17.4 0 15.5 17.7 30.6 17.7 30.6s17.7-15.4 17.7-30.6c0-9.6-7.9-17.4-17.7-17.4z', 6026 fillColor: '#111', 6027 fillOpacity: 1, 6028 strokeColor: '', 6029 strokeWeight: 0, 6030 }, 6031 line_start_icon: null, 6032 line_end_icon: null, 6033 lines: [], 6034 circles: [], 6035 bounds: null, 6036 infoWindow: null, 6037 marker_clusterer: null, 6038 options: { 6039 center: { 6040 lat: 51.313361, 6041 lng: 9.486890, 6042 }, 6043 zoom: 8, 6044 minZoom: 5, 6045 maxZoom: 14, 6046 zoomControl: true, 6047 mapTypeControl: true, 6048 scaleControl: true, 6049 streetViewControl: true, 6050 rotateControl: true, 6051 scrollwheel: false, 6052 draggable: window.innerWidth > 1024, 6053 mapTypeControlOptions: { 6054 mapTypeIds: ['grey',], 6055 }, 6056 }, 6057 styles: [ 6058 { 6059 key: 'grey', 6060 label: 'Map', 6061 config: [ 6062 { 6063 'featureType': 'landscape', 6064 'stylers': [{ 'color': '#f9f9f9', },], 6065 }, 6066 { 6067 'featureType': 'road.highway', 6068 'stylers': [{ 'color': '#eaeaea', },], 6069 }, 6070 { 6071 'featureType': 'transit', 6072 'stylers': [{ 'color': '#eaeaea', },], 6073 }, 6074 { 6075 'featureType': 'water', 6076 'stylers': [{ 'color': '#eaeaea', },], 6077 }, 6078 { 6079 'featureType': 'poi', 6080 'elementType': 'geometry', 6081 'stylers': [{ 'color': '#eaeaea', },], 6082 }, 6083 { 6084 'elementType': 'labels.text.fill', 6085 'stylers': [{ 'color': '#808080', },], 6086 }, 6087 ], 6088 }, 6089 ], 6090 } 6091 6092 /** 6093 * Set the marker image path. 6094 * 6095 * @param {string} imagePath path to image directory without a trailing slash. 6096 */ 6097 self.setMarkerImagePath = function (imagePath) { 6098 _check() 6099 sweSikaProductsDebugger.debuggingFunc(sweSikaProductsDebugger.DEBUG_FUNC_CALLED, 'sweSikaProductsMapConstruct.setMarkerImagePath') 6100 _markerImagePath = imagePath 6101 } 6102 6103 /** 6104 * @param {number} lat 6105 * @return {number} 6106 */ 6107 self.getMetersPerPixes = function (lat) { 6108 _check() 6109 sweSikaProductsDebugger.debuggingFunc(sweSikaProductsDebugger.DEBUG_FUNC_CALLED, 'sweSikaProductsMapConstruct.getMetersPerPixes') 6110 if (!self.__config.map) return 0 6111 6112 return 156543.03392 * Math.cos(lat * Math.PI / 180) / Math.pow(2, self.__config.map.getZoom()) 6113 } 6114 6115 /** 6116 * 6117 */ 6118 self.resetBounds = function () { 6119 _check() 6120 sweSikaProductsDebugger.debuggingFunc(sweSikaProductsDebugger.DEBUG_FUNC_CALLED, 'sweSikaProductsMapConstruct.resetBounds') 6121 if (!self.__config.map) return 6122
6123 self.__config.bounds = new google.maps.LatLngBounds() 6124 } 6125 6126 /** 6127 * 6128 */ 6129 self.fitCirclesBounds = function () { 6130 _check() 6131 sweSikaProductsDebugger.debuggingFunc(sweSikaProductsDebugger.DEBUG_FUNC_CALLED, 'sweSikaProductsMapConstruct.fitCirclesBounds') 6132 if (!self.__config.map) return 6133 6134 if (!self.__config.bounds) { 6135 self.__config.bounds = new google.maps.LatLngBounds() 6136 } 6137 6138 if (self.__config.circles.length === 1) { 6139 self.__config.bounds = self.__config.circles[0].getBounds() 6140 } 6141 6142 if (self.__config.circles.length > 1) { 6143 for (let i = 0; i < self.__config.circles.length; i += 1) { 6144 let circle = self.__config.circles[i] 6145 6146 self.__config.bounds.extend(circle.center) 6147 } 6148 } 6149 6150 self.__config.map.fitBounds(self.__config.bounds) 6151 } 6152 6153 /** 6154 * 6155 */ 6156 self.fitMarkersBounds = function () { 6157 _check() 6158 sweSikaProductsDebugger.debuggingFunc(sweSikaProductsDebugger.DEBUG_FUNC_START, 'sweSikaProductsMapConstruct.fitMarkersBounds') 6159 if (!self.__config.map) { 6160 sweSikaProductsDebugger.debug('Map is not a google maps instance', sweSikaProductsDebugger.LEVEL_WARNING) 6161 sweSikaProductsDebugger.debuggingFunc(sweSikaProductsDebugger.DEBUG_FUNC_END) 6162 return 6163 } 6164 6165 if (!self.__config.bounds) { 6166 self.__config.bounds = new google.maps.LatLngBounds() 6167 } 6168 6169 if (self.__config.markers.length >= 1) { 6170 for (let i = 0; i < self.__config.markers.length; i += 1) { 6171 let marker = self.__config.markers[i], 6172 position = new google.maps.LatLng(marker.position.lat(), marker.position.lng()) 6173 6174 self.__config.bounds.extend(position) 6175 } 6176 } 6177 6178 self.__config.map.fitBounds(self.__config.bounds) 6179 sweSikaProductsDebugger.debuggingFunc(sweSikaProductsDebugger.DEBUG_FUNC_END) 6180 } 6181 6182 /** 6183 * 6184 */ 6185 self.fitLinesBounds = function () { 6186 _check() 6187 sweSikaProductsDebugger.debuggingFunc(sweSikaProductsDebugger.DEBUG_FUNC_CALLED, 'sweSikaProductsMapConstruct.fitLinesBounds') 6188 if (!self.__config.map) return 6189 6190 if (!self.__config.bounds) { 6191 self.__config.bounds = new google.maps.LatLngBounds() 6192 } 6193 6194 for (let i = 0; i < self.__config.lines.length; i += 1) { 6195 let line = self.__config.lines[i], 6196 coords = line.getPath() 6197 6198 for (let j = 0; j < coords.length; j += 1) { 6199 let coordinate = coords.getAt(j), 6200 position = new google.maps.LatLng(coordinate.lat(), coordinate.lng()) 6201 6202 self.__config.bounds.extend(position) 6203 } 6204 } 6205 6206 self.__config.map.fitBounds(self.__config.bounds) 6207 } 6208 6209 /** 6210 * @param icon 6211 */ 6212 self.setMarkerIcon = function (icon) { 6213 _check() 6214 sweSikaProductsDebugger.debuggingFunc(sweSikaProductsDebugger.DEBUG_FUNC_CALLED, 'sweSikaProductsMapConstruct.setMarkerIcon') 6215 self.__config.marker_icon = icon 6216 } 6217 6218 /** 6219 * @param icon 6220 */ 6221 self.setLineStartIcon = function (icon) { 6222 _check() 6223 sweSikaProductsDebugger.debuggingFunc(sweSikaProductsDebugger.DEBUG_FUNC_CALLED, 'sweSikaProductsMapConstruct.setLineStartIcon') 6224 self.__config.line_start_icon = icon 6225 } 6226 6227 /** 6228 * @param icon 6229 */ 6230 self.setLineEndIcon = function (icon) { 6231 _check() 6232 sweSikaProductsDebugger.debuggingFunc(sweSikaProductsDebugger.DEBUG_FUNC_CALLED, 'sweSikaProductsMapConstruct.setLineEndIcon') 6233 self.__config.line_end_icon = icon 6234 } 6235 6236 /** 6237 * @return {number} 6238 */ 6239 self.countMarkers = function () { 6240 _check() 6241 sweSikaProductsDebugger.debuggingFunc(sweSikaProductsDebugger.DEBUG_FUNC_CALLED, 'sweSikaProductsMapConstruct.countMarkers') 6242 return self.__config.markers.length 6243 } 6244 6245 /** 6246 * @param marker 6247 * @param onClickHtml 6248 */ 6249 self.showMarkerInfo = function (marker, onClickHtml) { 6250 _check() 6251 sweSikaProductsDebugger.debuggingFunc(sweSikaProductsDebugger.DEBUG_FUNC_CALLED, 'sweSikaProductsMapConstruct.showMarkerInfo') 6252 self.__config.infoWindow.setContent(onClickHtml) 6253 self.__config.infoWindow.open(self.__config.map, marker) 6254 } 6255 6256 /** 6257 * @param index 6258 * @return {*} 6259 */ 6260 self.getMarker = function (index) { 6261 _check() 6262 sweSikaProductsDebugger.debuggingFunc(sweSikaProductsDebugger.DEBUG_FUNC_CALLED, 'sweSikaProductsMapConstruct.getMarker') 6263 return self.__config.markers[index] 6264 } 6265 6266 /** 6267 * @param {number} lat 6268 * @param {number} lng 6269 * @param onClickHtml 6270 * @param icon 6271 * @param {string} iconColor 6272 * @param {string} title 6273 * @param {boolean} openWindow 6274 * @return {*} 6275 */ 6276 self.addMarker = function (lat, lng, onClickHtml, icon, iconColor, title, openWindow) { 6277 _check() 6278 sweSikaProductsDebugger.debuggingFunc(sweSikaProductsDebugger.DEBUG_FUNC_START, 'sweSikaProductsMapConstruct.addMarker') 6279 6280 if (!self.__config.map) { 6281 sweSikaProductsDebugger.debuggingFunc(sweSikaProductsDebugger.DEBUG_FUNC_END) 6282 return null 6283 } 6284 6285 let __icon = self.__config.marker_icon, 6286 __title = '' 6287 6288 if (icon) __icon = icon === 'default' ? self.__config.marker_icon : icon 6289 if (iconColor && (typeof icon !== 'string' || icon === 'default')) __icon.fillColor = iconColor === 'default' ? __icon.fillColor : iconColor 6290 if (title) __title = title 6291 6292 let marker = new google.maps.Marker({ 6293 position: new google.maps.LatLng(lat, lng), 6294 icon: __icon, 6295 title: __title, 6296 map: self.__config.map, 6297 }) 6298 6299 if (onClickHtml) { 6300 google.maps.event.addListener(marker, 'click', function () { 6301 self.__config.infoWindow.setContent(onClickHtml) 6302 self.__config.infoWindow.open(self.__config.map, marker) 6303 }) 6304 6305 if (openWindow) { 6306 self.__config.infoWindow.setContent(onClickHtml) 6307 self.__config.infoWindow.open(self.__config.map, marker) 6308 } 6309 } 6310 6311 self.__config.markers.push(marker) 6312 6313 sweSikaProductsDebugger.debuggingFunc(sweSikaProductsDebugger.DEBUG_FUNC_END) 6314 return marker 6315 } 6316 6317 /** 6318 * 6319 */ 6320 self.removeMarkers = function () { 6321 _check() 6322 sweSikaProductsDebugger.debuggingFunc(sweSikaProductsDebugger.DEBUG_FUNC_CALLED, 'sweSikaProductsMapConstruct.removeMarkers') 6323 for (let i = 0; i < self.__config.markers.length; i += 1) { 6324 let marker = self.__config.markers[i] 6325 marker.setMap(null) 6326 } 6327 6328 self.__config.markers = [] 6329 } 6330 6331 /** 6332 * @param coords 6333 * @param {object} style 6334 * @param fclick 6335 * @return {*} 6336 */ 6337 self.addLine = function (coords, style, fclick) { 6338 _check() 6339 sweSikaProductsDebugger.debuggingFunc(sweSikaProductsDebugger.DEBUG_FUNC_CALLED, 'sweSikaProductsMapConstruct.addLine') 6340 if (!self.__config.map) return null 6341 6342 let line_icons = [] 6343 6344 if (self.__config.line_start_icon !== null) { 6345 line_icons.push({ 6346 icon: self.__config.line_start_icon, 6347 offset: '0%', 6348 }) 6349 } 6350 6351 if (self.__config.line_end_icon !== null) { 6352 line_icons.push({ 6353 icon: self.__config.line_end_icon,
6354 offset: '100%', 6355 }) 6356 } 6357 6358 let line = new google.maps.Polyline({ 6359 path: coords, 6360 icons: line_icons, 6361 map: self.__config.map, 6362 strokeColor: style.strokeColor, 6363 strokeOpacity: style.strokeOpacity, 6364 strokeWeight: style.strokeWeight, 6365 }) 6366 6367 self.__config.lines.push(line) 6368 6369 if (typeof fclick === 'function') { 6370 google.maps.event.addListener(line, 'click', fclick) 6371 } 6372 6373 return line 6374 } 6375 6376 /** 6377 * 6378 */ 6379 self.removeLines = function () { 6380 _check() 6381 sweSikaProductsDebugger.debuggingFunc(sweSikaProductsDebugger.DEBUG_FUNC_CALLED, 'sweSikaProductsMapConstruct.removeLines') 6382 for (let i = 0; i < self.__config.lines.length; i += 1) { 6383 let line = self.__config.lines[i] 6384 line.setMap(null) 6385 } 6386 6387 self.__config.lines = [] 6388 } 6389 6390 /** 6391 * @param {number} centerLat 6392 * @param {number} centerLng 6393 * @param {number} radius 6394 * @param {object} style 6395 * @return {*} 6396 */ 6397 self.addCircle = function (centerLat, centerLng, radius, style) { 6398 _check() 6399 sweSikaProductsDebugger.debuggingFunc(sweSikaProductsDebugger.DEBUG_FUNC_CALLED, 'sweSikaProductsMapConstruct.addCircle') 6400 if (!self.__config.map) return null 6401 6402 let circle = new google.maps.Circle({ 6403 strokeColor: style.strokeColor, 6404 strokeOpacity: style.strokeOpacity, 6405 strokeWeight: style.strokeWeight, 6406 fillColor: style.fillColor, 6407 fillOpacity: style.fillOpacity, 6408 map: self.__config.map, 6409 center: { 6410 lat: centerLat, 6411 lng: centerLng, 6412 }, 6413 radius: radius * 1000, 6414 }) 6415 6416 self.__config.circles.push(circle) 6417 6418 return circle 6419 } 6420 6421 /** 6422 * 6423 */ 6424 self.removeCircles = function () { 6425 _check() 6426 sweSikaProductsDebugger.debuggingFunc(sweSikaProductsDebugger.DEBUG_FUNC_CALLED, 'sweSikaProductsMapConstruct.removeCircles') 6427 for (let i = 0; i < self.__config.circles.length; i += 1) { 6428 let circle = self.__config.circles[i] 6429 circle.setMap(null) 6430 } 6431 6432 self.__config.circles = [] 6433 } 6434 6435 /** 6436 * 6437 */ 6438 self.showMarkerClusters = function () { 6439 _check() 6440 sweSikaProductsDebugger.debuggingFunc(sweSikaProductsDebugger.DEBUG_FUNC_START, 'sweSikaProductsMapConstruct.showMarkerClusters') 6441 self.clearMarkerClusters() 6442 6443 if (!self.__config.map || typeof MarkerClusterer !== 'function') return 6444 6445 let _markers = [] 6446 6447 for (let i = 0; i < self.__config.markers.length; i += 1) { 6448 let marker = self.__config.markers[i] 6449 _markers.push(marker) 6450 } 6451 6452 self.__config.marker_clusterer = new MarkerClusterer(self.__config.map, _markers, { imagePath: _markerImagePath + '/m', }) 6453 sweSikaProductsDebugger.debuggingFunc(sweSikaProductsDebugger.DEBUG_FUNC_END) 6454 } 6455 6456 /** 6457 * 6458 */ 6459 self.clearMarkerClusters = function () { 6460 _check() 6461 sweSikaProductsDebugger.debuggingFunc(sweSikaProductsDebugger.DEBUG_FUNC_CALLED, 'sweSikaProductsMapConstruct.clearMarkerClusters') 6462 if (self.__config.marker_clusterer !== null && typeof self.__config.marker_clusterer === 'object') { 6463 self.__config.marker_clusterer.clearMarkers() 6464 } 6465 6466 self.__config.marker_clusterer = null 6467 } 6468})(window.sweSikaProductsMapConstruct) 6469 6470window.sweSikaProductsMaps = {}; 6471 6472(function (self) { 6473 'use strict' 6474 6475 /*********** 6476 * Private * 6477 ***********/ 6478 6479 const CUSTOM_STYLE = true, 6480 STYLE = 'roadmap' 6481 6482 let _requiredModules = [ 6483 'google', 6484 'sweSikaProductsMapConstruct', 6485 'sweSikaProductsHelper', 6486 ], 6487 _suggestedModules = [], 6488 _checked = false, 6489 _filename = 'swe-maps', 6490 _api = '', 6491 _src = 'https://maps.googleapis.com/maps/api/js' 6492 6493 /** 6494 * @private 6495 */ 6496 function _check () { 6497 if (_checked) return 6498 if (!sweSikaProductsDebugger) throw '[' + _filename + '.js] Required namespace "sweSikaProductsDebugger" not found.' 6499 6500 sweSikaProductsDebugger.checkModules(_requiredModules, 'required', true, _filename) 6501 sweSikaProductsDebugger.checkModules(_suggestedModules, 'suggested', false, _filename) 6502 _checked = true 6503 } 6504 6505 /** 6506 * @param {string} src 6507 * @param {function} callback 6508 * @private 6509 */ 6510 function _addScript (src, callback) { 6511 let script = document.createElement('script') 6512 script.type = 'text/javascript' 6513 if (typeof callback === 'function') script.onload = callback 6514 document.getElementsByTagName('head')[0].appendChild(script) 6515 script.src = src 6516 } 6517 6518 /** 6519 * Merge options. 6520 * 6521 * @param {object} custom 6522 * @param {object} options 6523 * @private 6524 */ 6525 function _mergeOptions (custom, options) { 6526 Object.keys(custom).forEach(function (key) { 6527 options[key] = custom[key] 6528 }) 6529 } 6530 6531 /********** 6532 * Public * 6533 **********/ 6534 6535 /** 6536 * @param {string} src 6537 */ 6538 self.setSrc = function (src) { 6539 _src = src 6540 } 6541 6542 /** 6543 * @param {string} api 6544 */ 6545 self.setApi = function (api) { 6546 _api = api 6547 } 6548 6549 /** 6550 * @param {object} center 6551 * @param {number} center.lat 6552 * @param {number} center.lng 6553 * @param {object} map 6554 */ 6555 self.setCenter = function (center, map) { 6556 map.__config.map.setCenter(center) 6557 } 6558 6559 /** 6560 * @param {object} map 6561 */ 6562 self.resetCenter = function (map) { 6563 self.setCenter(map.__config.options.center, map) 6564 } 6565 6566 /** 6567 * @param {object} map 6568 */ 6569 self.zoomOutMax = function (map) { 6570 self.setZoom(map.__config.options.minZoom, map) 6571 } 6572 6573 /** 6574 * @param {object} map 6575 */ 6576 self.zoomInMax = function (map) { 6577 self.setZoom(map.__config.options.maxZoom, map) 6578 } 6579 6580 /** 6581 * @param {number} zoom 6582 * @param {object} map 6583 */ 6584 self.setZoom = function (zoom, map) { 6585 map.__config.map.setZoom(zoom) 6586 } 6587 6588 /** 6589 * @param {object} map 6590 */ 6591 self.resetZoom = function (map) { 6592 self.setZoom(map.__config.options.zoom, map) 6593 } 6594 6595 /** 6596 * @param {function} callback 6597 */ 6598 self.load = function (callback) { 6599 if (!sweSikaProductsHelper.isCookieAllowed()) return 6600 6601 let src = _src 6602 if (_api.length > 0) src += '?key=' + _api 6603 6604 setTimeout(function () { 6605 if (typeof google === 'undefined') { 6606 _addScript(src, callback) 6607 return 6608 } 6609 6610 callback() 6611 }, 500) 6612 } 6613 6614 /** 6615 * Create a new swe maps instance. 6616 * 6617 * @param {object} map 6618 * @param {string} canvasId 6619 * @return sweSikaProductsMapConstruct|{} 6620 */ 6621 self.create = function (map, canvasId) { 6622 if (!map) map = {} 6623 if (typeof canvasId !== 'string' || canvasId.length < 1) return map 6624 if (!sweSikaProductsHelper.getElement(canvasId)) return map 6625 6626 _check() 6627 _mergeOptions(sweSikaProductsMapConstruct, map) 6628 6629 if (!CUSTOM_STYLE) { 6630 switch (STYLE.toLowerCase()) { 6631 case 'terrain': 6632 map.__config.options.mapTypeId = google.maps.MapTypeId.TERRAIN 6633 break 6634 case 'satellite': 6635 map.__config.options.mapTypeId = google.maps.MapTypeId.SATELLITE 6636 break 6637 case 'hybrid': 6638 map.__config.options.mapTypeId = google.maps.MapTypeId.HYBRID 6639 break 6640 case 'roadmap': 6641 default: 6642 map.__config.options.mapTypeId = google.maps.MapTypeId.ROADMAP 6643 } 6644 } 6645 6646 map.__config.canvasID = canvasId 6647 let mapCanvas = sweSikaProductsHelper.getElement(canvasId) 6648 if (!mapCanvas) return map 6649 sweSikaProductsHelper.removeDomClass(mapCanvas, 'no-cookie') 6650 let newMap = new google.maps.Map(mapCanvas, map.__config.options) 6651 6652 if (CUSTOM_STYLE) { 6653 for (let i = 0; i < map.__config.styles.length; i += 1) { 6654 let style = map.__config.styles[i], 6655 mapType = new google.maps.StyledMapType(style.config, { name: style.label }) 6656 newMap.mapTypes.set(style.key, mapType) 6657 newMap.setMapTypeId(style.key) 6658 } 6659 } 6660 6661 google.maps.event.addDomListener(window, 'resize', function () { 6662 let center = newMap.getCenter() 6663 google.maps.event.trigger(newMap, 'resize') 6664 newMap.setCenter(center) 6665 newMap.set('draggable', window.innerWidth > 1024) 6666 }) 6667 6668 map.__config.map = newMap 6669 map.__config.infoWindow = new google.maps.InfoWindow({ content: '' }) 6670 6671 return map 6672 } 6673 6674})(window.sweSikaProductsMaps) 6675 6676window.sweSikaProductsAjax = {} 6677 6678/******** 6679 * Ajax * 6680 ********/ 6681 6682// https://github.com/yanatan16/nanoajax 6683!function (t, e) { 6684 function n (t) {return t && e.XDomainRequest && !/MSIE 1/.test(navigator.userAgent) ? new XDomainRequest : e.XMLHttpRequest ? new XMLHttpRequest : void 0} 6685 6686 function o (t, e, n) {t[e] = t[e] || n} 6687 6688 var r = ['responseType', 'withCredentials', 'timeout', 'onprogress'] 6689 t.ajax = function (t, a) { 6690 function s (t, e) {return function () {c || (a(void 0 === f.status ? t : f.status, 0 === f.status ? 'Error' : f.response || f.responseText || e, f), c = !0)}} 6691 6692 var u = t.headers || {}, i = t.body, d = t.method || (i ? 'POST' : 'GET'), c = !1, f = n(t.cors) 6693 f.open(d, t.url, !0) 6694 var l = f.onload = s(200) 6695 f.onreadystatechange = function () {4 === f.readyState && l()}, f.onerror = s(null, 'Error'), f.ontimeout = s(null, 'Timeout'), f.onabort = s(null, 'Abort'), i && (o(u, 'X-Requested-With', 'XMLHttpRequest'), e.FormData && i instanceof e.FormData || o(u, 'Content-Type', 'application/x-www-form-urlencoded')) 6696 for (var p, m = 0, v = r.length; v > m; m++) p = r[m], void 0 !== t[p] && (f[p] = t[p]) 6697 for (var p in u) f.setRequestHeader(p, u[p]) 6698 return f.send(i), f 6699 }, e.nanoajax = t 6700}({}, function () {return this}()) 6701 6702;(function (self) { 6703 'use strict' 6704 6705 /*********** 6706 * Private * 6707 ***********/ 6708 6709 let _requiredModules = [], 6710 _suggestedModules = [],
6711 _filename = 'swe-ajax', 6712 _checked = false, 6713 _ajaxUrl = '', 6714 _ajaxStoragePid = '', 6715 _ajaxPageType = '' 6716 6717 /** 6718 * @private 6719 */ 6720 function _check () { 6721 if (_checked) return 6722 if (!sweSikaProductsDebugger) throw '[' + _filename + '.js] Required namespace "sweSikaProductsDebugger" not found.' 6723 6724 sweSikaProductsDebugger.checkModules(_requiredModules, 'required', true, _filename) 6725 sweSikaProductsDebugger.checkModules(_suggestedModules, 'suggested', false, _filename) 6726 _checked = true 6727 } 6728 6729 /********** 6730 * Public * 6731 **********/ 6732 6733 /** 6734 * @param {string} url 6735 * @param {object} postData 6736 * @param {function} processResponse 6737 */ 6738 self.post = function (url, postData, processResponse) { 6739 if (!_checked) return 6740 6741 let body = 'json=' + encodeURIComponent(JSON.stringify(postData)), 6742 info = { 6743 timeout: 0, 6744 url: url, 6745 method: 'POST', 6746 body: body, 6747 } 6748 6749 let postCallback = function (code, responseText, request) { 6750 if (code !== 200) { 6751 sweSikaProductsDebugger.error(responseText, sweSikaProductsDebugger.LEVEL_ERROR) 6752 return 6753 } 6754 6755 sweSikaProductsDebugger.debug(responseText) 6756 let response = JSON.parse(decodeURIComponent(responseText)) 6757 6758 if (typeof processResponse === 'function') processResponse(response) 6759 } 6760 6761 window.nanoajax.ajax(info, postCallback) 6762 } 6763 6764 /** 6765 * @param {string} url 6766 * @param {function} processResponse 6767 */ 6768 self.get = function (url, processResponse) { 6769 if (!_checked) return 6770 6771 let info = { 6772 url: url, 6773 method: 'GET', 6774 } 6775 6776 let getCallback = function (code, responseText, request) { 6777 if (code !== 200) { 6778 sweSikaProductsDebugger.error(responseText, sweSikaProductsDebugger.LEVEL_ERROR) 6779 return 6780 } 6781 6782 sweSikaProductsDebugger.debug(responseText) 6783 let response = JSON.parse(decodeURIComponent(responseText)) 6784 6785 if (typeof processResponse === 'function') processResponse(response) 6786 } 6787 6788 window.nanoajax.ajax(info, getCallback) 6789 } 6790 6791 /** 6792 * @return {string} 6793 */ 6794 self.getDefaultUrl = function () { 6795 if(element.hasAttribute('data-ajax-url')){ 6796 return element.getAttribute('data-ajax-url')+'/?type=' + _ajaxPageType; 6797 } 6798 6799 let prefix = '', 6800 defaultUrl = '/?type=' + _ajaxPageType 6801 6802 if (window.location.host.includes('prototyp')) { 6803 let projectArray = window.location.pathname.split('/'), 6804 project = projectArray.shift() 6805 6806 while (!project.length) { 6807 if (!projectArray.length) { 6808 break 6809 } 6810 6811 project = projectArray.shift() 6812 } 6813 6814 if (project.length) { 6815 prefix = '/' + project 6816 } 6817 } 6818 6819 return prefix + defaultUrl 6820 } 6821 6822 /** 6823 * @return {string} 6824 */ 6825 self.getUrl = function () { 6826 if(_ajaxUrl !== ''){ 6827 return _ajaxUrl; 6828 } 6829 return self.getDefaultUrl(); 6830 } 6831 6832 /** 6833 * @return {string} 6834 */ 6835 self.getStoragePid = function () { 6836 return _ajaxStoragePid; 6837 } 6838 6839 /** 6840 * @param {string} extClass 6841 */ 6842 self.setup = function (extClass) { 6843 _check() 6844 let element = sweSikaProductsHelper.getElement(extClass + '-debug') 6845 if (!element) return 6846 6847 _ajaxUrl = element.getAttribute('data-ajax-url') 6848 _ajaxStoragePid = element.getAttribute('data-ajax-pid') 6849 _ajaxPageType = element.getAttribute('data-ajax-type') 6850 } 6851}) 6852(sweSikaProductsAjax) 6853 6854window.sweSikaProducts = {}; 6855 6856(function (self) { 6857 'use strict' 6858 6859 /*********** 6860 * Private * 6861 ***********/ 6862 6863 /** 6864 * The extension class. 6865 * 6866 * @type {string} 6867 */ 6868 const _extClass = 'tx-swesikaproducts' 6869 6870 var itemHeight = 0, 6871 duration = 0 6872 6873 let _requiredModules = [ 6874 'sweSikaProductsHelper', 6875 ], 6876 _suggestedModules = [], 6877 _checked = false, 6878 _filename = 'main', 6879 _controller = null, 6880 _fixedScene = null, 6881 _loadingMore = false, 6882 _modelRangAmount = 0, 6883 _lastGroupNumber = 0, 6884 _selectors = { 6885 language: { 6886 container: '.download-container', 6887 button: '.download-button', 6888 switchContainer: '.switch-container', 6889 switch: '.language-switch', 6890 link: '.name', 6891 items: '.language', 6892 size: '.file-size', 6893 ext: '.file-ext', 6894 }, 6895 tab: { 6896 header: '.accordion-title', 6897 content: '.accordion-content', 6898 }, 6899 image: { 6900 preview: '.preview-image', 6901 main: '[data-main-image]', 6902 }, 6903 scrollMagic: { 6904 container: '.scrollmagic-container', 6905 item: '.scrollmagic-item', 6906 }, 6907 list: {
6908 loadMore: '[data-load-more]', 6909 loadMoreContainer: '#load-more-container', 6910 prototyp: '#model-range-prototyp', 6911 container: '.model-range-list', 6912 }, 6913 filter: { 6914 container: '.filter-select', 6915 value: '.filter-select-value', 6916 list: '.filter-select-list', 6917 } 6918 } 6919 6920 /** 6921 * @private 6922 */ 6923 function _check () { 6924 if (_checked) return 6925 if (!sweSikaProductsDebugger) throw '[' + _filename + '.js] Required namespace "sweSikaProductsDebugger" not found.' 6926 6927 sweSikaProductsDebugger.setExtClass(_extClass) 6928 sweSikaProductsDebugger.checkModules(_requiredModules, 'required', true, _filename) 6929 sweSikaProductsDebugger.checkModules(_suggestedModules, 'suggested', false, _filename) 6930 _checked = true 6931 } 6932 6933 /** 6934 * @param {HTMLElement} container 6935 * @private 6936 */ 6937 function _initLanguageButton (container) { 6938 let switchContainer = sweSikaProductsHelper.getElement(_selectors.language.switchContainer, container), 6939 list = sweSikaProductsHelper.getElement(_selectors.language.switch, switchContainer), 6940 link = sweSikaProductsHelper.getElement(_selectors.language.link, container), 6941 items = sweSikaProductsHelper.getElements(_selectors.language.items, container), 6942 size = sweSikaProductsHelper.getElement(_selectors.language.size, container), 6943 ext = sweSikaProductsHelper.getElement(_selectors.language.ext, container), 6944 button = sweSikaProductsHelper.getElement(_selectors.language.button, container), 6945 containerHeight = switchContainer.offsetHeight, 6946 collapseTimeout 6947 6948 button.style.paddingLeft = switchContainer.offsetWidth + 'px' 6949 6950 switchContainer.addEventListener('mouseover', function (event) { 6951 event.preventDefault() 6952 event.stopPropagation() 6953 if (containerHeight === 0) containerHeight = switchContainer.offsetHeight 6954 if (collapseTimeout) clearTimeout(collapseTimeout) 6955 switchContainer.style.height = (list.offsetHeight + 15) + 'px' 6956 }) 6957 6958 switchContainer.addEventListener('mouseleave', function (event) { 6959 event.preventDefault() 6960 event.stopPropagation() 6961 if (collapseTimeout) clearTimeout(collapseTimeout) 6962 collapseTimeout = setTimeout(function () { 6963 switchContainer.style.height = containerHeight + 'px' 6964 }, 200) 6965 }) 6966 6967 for (let i = 0; i < items.length; i += 1) { 6968 let item = items[i] 6969 6970 if (i === 0) { 6971 link.setAttribute('href', item.getAttribute('data-link')) 6972 item.setAttribute('data-active', '') 6973 } 6974 6975 item.addEventListener('click', _clickEvent) 6976 } 6977 6978 /** 6979 * @param {Event} event 6980 * @private 6981 */ 6982 function _clickEvent (event) { 6983 event.preventDefault() 6984 event.stopPropagation() 6985 6986 if (this.hasAttribute('data-active')) { 6987 return 6988 } 6989 6990 let items = sweSikaProductsHelper.getElements(_selectors.language.items, container) 6991 6992 for (let i = 0; i < items.length; i += 1) { 6993 items[i].removeAttribute('data-active') 6994 } 6995 6996 link.setAttribute('href', this.getAttribute('data-link')) 6997 this.setAttribute('data-active', '') 6998 ext.innerText = this.getAttribute('data-file-ext') 6999 size.innerText = this.getAttribute('data-file-size') 7000 7001 let firstChild = list.firstChild, 7002 newItem = this.cloneNode(true) 7003 newItem.addEventListener('click', _clickEvent) 7004 7005 list.removeChild(this) 7006 list.insertBefore(newItem, firstChild) 7007 } 7008 } 7009 7010 /** 7011 * @private 7012 */ 7013 function _initLanguageButtons () {
7014 let containers = sweSikaProductsHelper.getElements(_selectors.language.container) 7015 7016 for (let i = 0; i < containers.length; i += 1) { 7017 _initLanguageButton(containers[i]) 7018 } 7019 } 7020 7021 /** 7022 * @param {Event} event 7023 * @private 7024 */ 7025 function _selectTabEvent (event) { 7026 event.preventDefault() 7027 event.stopPropagation() 7028 7029 let tabId = this.getAttribute('data-id'), 7030 tabs = sweSikaProductsHelper.getElements(_selectors.tab.header), 7031 tabContents = sweSikaProductsHelper.getElements(_selectors.tab.content) 7032 7033 for (let i = 0; i < tabContents.length; i += 1) { 7034 let content = tabContents[i], 7035 method = content.getAttribute('data-id') !== tabId ? 'addDomClass' : 'removeDomClass', 7036 isOpen = content.getAttribute('data-id') === tabId && !content.classList.contains('hidden') 7037 7038 if (isOpen) { 7039 method = 'addDomClass' 7040 } 7041 7042 sweSikaProductsHelper[method](content, 'hidden') 7043 } 7044 7045 for (let i = 0; i < tabs.length; i += 1) { 7046 let tab = tabs[i], 7047 method = tab.getAttribute('data-id') !== tabId ? 'removeDomClass' : 'addDomClass', 7048 isOpen = tab.getAttribute('data-id') === tabId && tab.classList.contains('active') 7049 7050 if (isOpen) { 7051 method = 'removeDomClass' 7052 } 7053 7054 sweSikaProductsHelper[method](tab, 'active') 7055 7056 if (method === 'addDomClass') { 7057 let accordionPosition = sweSikaProductsHelper.getElement('#product-accordion').getBoundingClientRect().top, 7058 navHeight = document.querySelector('.fixed-nav').offsetHeight, 7059 scrollTop = (accordionPosition + -1) - navHeight 7060 7061 if (accordionPosition < navHeight) { 7062 scrollBy({ top: scrollTop }) 7063 } 7064 } 7065 } 7066 7067 let downloadElements = sweSikaProductsHelper.getElements(_selectors.language.container) 7068 7069 for (let i = 0; i < downloadElements.length; i += 1) { 7070 let container = downloadElements[i], 7071 switchContainer = sweSikaProductsHelper.getElement(_selectors.language.switchContainer, container), 7072 button = sweSikaProductsHelper.getElement(_selectors.language.button, container) 7073 7074 button.style.paddingLeft = switchContainer.offsetWidth + 'px' 7075 switchContainer.style.top = (button.offsetHeight - switchContainer.offsetHeight) / 2 + 'px' 7076 } 7077 7078 //_updateScenes() 7079 } 7080 7081 /** 7082 * Change the main image by selecting an image in the image container. 7083 * 7084 * @param {Event} event 7085 * @private 7086 */ 7087 function _selectPreviewImageEvent (event) { 7088 event.preventDefault() 7089 event.stopPropagation() 7090 7091 let src = this.getAttribute('data-src'), 7092 previewImages = sweSikaProductsHelper.getElements(_selectors.image.preview), 7093 mainImage = sweSikaProductsHelper.getElement(_selectors.image.main) 7094 7095 if (!mainImage || mainImage.getAttribute('src') === src || !previewImages.length) return 7096 7097 for (let i = 0; i < previewImages.length; i += 1) { 7098 let image = previewImages[i], 7099 method = image.getAttribute('data-src') === src ? 'addDomClass' : 'removeDomClass' 7100 7101 sweSikaProductsHelper[method](image, 'active') 7102 } 7103 7104 mainImage.setAttribute('src', src) 7105 } 7106 7107 /** 7108 * Click event for the load more button. 7109 * 7110 * @param {Event} event 7111 * @private 7112 */ 7113 function _loadMoreButtonEvent (event) { 7114 event.preventDefault() 7115 event.stopPropagation() 7116 7117 if (_loadingMore) return 7118 _loadingMore = true 7119 7120 let ajaxUrl = sweSikaProductsAjax.getUrl(), 7121 post = { 7122 currentModuleRanges: this.getAttribute('data-current'), 7123 action: this.getAttribute('data-ajax-action'), 7124 loadAmount: this.getAttribute('data-load-more'), 7125 category: this.getAttribute('data-category'), 7126 pid: sweSikaProductsAjax.getStoragePid() 7127 } 7128 7129 sweSikaProductsAjax.post(ajaxUrl, post, _moreLoaded) 7130 } 7131 7132 /** 7133 * More module ranges loaded 7134 * 7135 * @param response 7136 * @private 7137 */ 7138 function _moreLoaded (response) { 7139 _loadingMore = false 7140 7141 let data = response.data, 7142 modelRanges = data.modelRanges, 7143 allProducts = data.allProducts, 7144 amount = modelRanges.length, 7145 loadMoreButton = sweSikaProductsHelper.getElement(_selectors.list.loadMore), 7146 currentModelRanges = parseInt(loadMoreButton.getAttribute('data-current')) 7147
7148 loadMoreButton.setAttribute('data-current', currentModelRanges + amount) 7149 7150 if (allProducts) { 7151 let container = sweSikaProductsHelper.getElement(_selectors.list.loadMoreContainer) 7152 sweSikaProductsHelper.hide(container) 7153 } 7154 7155 for (let i = 0; i < amount; i += 1) { 7156 _addModelRange(modelRanges[i], i + 1) 7157 } 7158 7159 if (typeof swe.sameHeight === 'function') { 7160 swe.sameHeight('.equal-height') 7161 } 7162 } 7163 7164 /** 7165 * @param {object} modelRange 7166 * @param {number} iterator 7167 * @private 7168 */ 7169 function _addModelRange (modelRange, iterator) { 7170 let prototyp = sweSikaProductsHelper.getElement(_selectors.list.prototyp), 7171 container = prototyp.children[0].cloneNode(true), 7172 prefix = '' 7173 7174 if (window.location.host.includes('prototyp')) { 7175 let projectArray = window.location.pathname.split('/'), 7176 project = projectArray.shift() 7177 7178 while (!project.length) { 7179 if (!projectArray.length) { 7180 break 7181 } 7182 7183 project = projectArray.shift() 7184 } 7185 7186 if (project.length) { 7187 prefix = '/' + project 7188 } 7189 } 7190 7191 let image = prefix + '/' + modelRange.image, 7192 previewImage = container.querySelector('.preview-image'), 7193 title = container.querySelector('.text--title'), 7194 benefit = container.querySelector('.benefit'), 7195 linkElement = container.querySelector('.link'), 7196 link = linkElement.getAttribute('href'), 7197 columns = parseInt(prototyp.getAttribute('data-columns')), 7198 dataGroupName = benefit.getAttribute('data-group-name'), 7199 newRow = parseInt((_modelRangAmount / columns).toString()) * columns === _modelRangAmount 7200 7201 if (newRow) { 7202 _lastGroupNumber += 1 7203 } 7204 7205 dataGroupName = dataGroupName.replace('group', _lastGroupNumber.toString()) 7206 7207 previewImage.setAttribute('src', image) 7208 previewImage.setAttribute('alt', modelRange.title) 7209 title.innerText = modelRange.title 7210 benefit.innerHTML = modelRange.benefit 7211 benefit.setAttribute('data-group-name', dataGroupName) 7212 linkElement.setAttribute('href', link + '?modelRangeId=' + modelRange.uid) 7213 7214 prototyp.parentElement.querySelector(_selectors.list.container).appendChild(container) 7215 _modelRangAmount += 1 7216 } 7217 7218 /** 7219 * Initiate event listeners. 7220 * @private 7221 */ 7222 function _initEventListeners () { 7223 let tabs = sweSikaProductsHelper.getElements(_selectors.tab.header), 7224 previewImages = sweSikaProductsHelper.getElements(_selectors.image.preview), 7225 mainImage = sweSikaProductsHelper.getElement(_selectors.image.main), 7226 forms = sweSikaProductsHelper.getElements('form'), 7227 loadMoreButton = sweSikaProductsHelper.getElement(_selectors.list.loadMore) 7228 7229 // Disable all forms. 7230 // for (let i = 0; i < forms.length; i += 1) { 7231 // forms[i].addEventListener('submit', function (event) { 7232 // event.preventDefault() 7233 // event.stopPropagation() 7234 // return false 7235 // }) 7236 // } 7237 7238 // Init click events for the tabs/accordion. 7239 for (let i = 0; i < tabs.length; i += 1) { 7240 tabs[i].addEventListener('click', _selectTabEvent) 7241 } 7242 7243 // Make the main image changeable by clicking on the gallery. 7244 for (let i = 0; i < previewImages.length; i += 1) { 7245 if (!mainImage) continue 7246 7247 let preview = previewImages[i] 7248 preview.addEventListener('click', _selectPreviewImageEvent) 7249 7250 if (mainImage.getAttribute('src') === preview.getAttribute('src')) { 7251 sweSikaProductsHelper.addDomClass(preview, 'active') 7252 } 7253 } 7254 7255 // Init the load-more-button. 7256 if (loadMoreButton) { 7257 loadMoreButton.addEventListener('click', _loadMoreButtonEvent) 7258 } 7259 7260 // Update the scenes to calculate the new space of the main image. 7261 //window.addEventListener('resize', _updateScenes) 7262 } 7263 7264 /** 7265 * 7266 * @private 7267 */ 7268 function _initScrollMagic () {
7269 let container = sweSikaProductsHelper.getElement(_selectors.scrollMagic.container), 7270 item = sweSikaProductsHelper.getElement(_selectors.scrollMagic.item) 7271 7272 if (!container || !item) { 7273 return 7274 } 7275 7276 _controller = new ScrollMagic.Controller({ 7277 globalSceneOptions: 'onEnter', 7278 }) 7279 7280 _updateScenes() 7281 } 7282 7283 /** 7284 * 7285 * @private 7286 */ 7287 function _updateScenes () { 7288 var containerHeight; 7289 if (_fixedScene) { 7290 _fixedScene.removePin(true) 7291 } 7292 7293 if (!_fixedScene) { 7294 _fixedScene = new ScrollMagic.Scene() 7295 .addTo(_controller) 7296 } 7297 7298 let container = sweSikaProductsHelper.getElement(_selectors.scrollMagic.container), 7299 item = sweSikaProductsHelper.getElement(_selectors.scrollMagic.item); 7300 7301 if(container && item){ 7302 containerHeight = container.offsetHeight; 7303 itemHeight = item.offsetHeight; 7304 duration = containerHeight - itemHeight 7305 7306 _fixedScene 7307 .duration(duration) 7308 .setPin(_selectors.scrollMagic.item) 7309 .update(true) 7310 } 7311 } 7312 7313 /** 7314 * @private 7315 */ 7316 function _calculateModulRangeAmount () { 7317 let modelRangeList = sweSikaProductsHelper.getElement(_selectors.list.container), 7318 prototyp = sweSikaProductsHelper.getElement(_selectors.list.prototyp), 7319 columns = prototyp ? parseInt(prototyp.getAttribute('data-columns')) : 0 7320 7321 _modelRangAmount = modelRangeList ? modelRangeList.children.length : 0 7322 _lastGroupNumber = parseInt((_modelRangAmount / columns).toString()) - 1 7323 7324 if ((_lastGroupNumber + 1) * columns < _modelRangAmount) { 7325 _lastGroupNumber += 1 7326 } 7327 7328 if (_lastGroupNumber < 0) _lastGroupNumber = 0 7329 } 7330 7331 /** 7332 * @private 7333 */ 7334 function _initFilterBoxes () { 7335 let filters = sweSikaProductsHelper.getElements(_selectors.filter.container) 7336 7337 for (let i = 0; i < filters.length; i += 1) { 7338 let filter = filters[i], 7339 value = sweSikaProductsHelper.getElement(_selectors.filter.value, filter) 7340 7341 value.addEventListener('click', _openFilter) 7342 } 7343 } 7344 7345 /** 7346 * @param {Event} event 7347 * @private 7348 */ 7349 function _openFilter (event) { 7350 event.preventDefault() 7351 event.stopPropagation() 7352 7353 let container = sweSikaProductsHelper.getParentWithClass(this, _selectors.filter.container.substr(1)) 7354 if (!container) return 7355 7356 let list = sweSikaProductsHelper.getElement(_selectors.filter.list, container), 7357 isOpen = this.classList.contains('open'), 7358 listOperation = isOpen ? 'addDomClass' : 'removeDomClass', 7359 valueOperation = isOpen ? 'removeDomClass' : 'addDomClass' 7360 7361 sweSikaProductsHelper[listOperation](list, 'hidden') 7362 sweSikaProductsHelper[valueOperation](this, 'open') 7363 } 7364 7365 /********** 7366 * Public * 7367 **********/ 7368 7369 self.updateScenes = _updateScenes 7370 7371 /** 7372 * Initiate the module. 7373 */ 7374 self.init = function () { 7375 _check() 7376 if (!sweSikaProductsHelper.getElement('.' + _extClass)) return 7377 sweSikaProductsIE.setup(_extClass) 7378 sweSikaProductsAjax.setup(_extClass) 7379 // sweSikaProductsHelper.setCookieProtection(!sweSikaProductsDebugger.isDebug()) 7380 sweSikaProductsDebugger.debug('sweSikaProducts is loaded.', sweSikaProductsDebugger.LEVEL_INFO) 7381 7382 // detect if mobile browser. regex -> http://detectmobilebrowsers.com 7383 let isMobile = (function (a) { 7384 return /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|
7384sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0, 4)) 7385 })(navigator.userAgent || navigator.vendor || window.opera) 7386 7387 _initEventListeners() 7388 _initLanguageButtons() 7389 7390 //if (!isMobile) { 7391 // _initScrollMagic() 7392 //} 7393 7394 _initFilterBoxes() 7395 _calculateModulRangeAmount() 7396 } 7397 7398})(window.sweSikaProducts) 7399 7400// Initiate this js module when the content is loaded. 7401document.addEventListener('DOMContentLoaded', function () { 7402 //try { 7403 window.sweSikaProducts.init() 7404 7405 if (document.querySelectorAll('.splide').length != 0) { 7406 7407 var splide = new Splide('.splide', { 7408 type: 'loop;', 7409 direction: 'ttb', 7410 perMove: 1, 7411 perPage: 4, 7412 height: '34rem', 7413 cover: true, 7414 pagination: false, 7415 rewind: true, 7416 drag: 'free', 7417 gap: '1.5rem', 7418 arrows: true, 7419 }) 7420 splide.mount() 7421 splide.on('click', function (slide) { 7422 let src = slide.slide.querySelector('img').getAttribute('data-src'), 7423 previewImages = sweSikaProductsHelper.getElements('.preview-image'), 7424 mainImage = sweSikaProductsHelper.getElement('[data-main-image]'), 7425 allSlides = sweSikaProductsHelper.getElements('.splide__slide') 7426 7427 for (let j = 0; j < allSlides.length; j += 1) { 7428 let s = allSlides[j] 7429 s.classList.remove('activeElement') 7430 s.classList.remove('is-active') 7431 } 7432 7433 if (!mainImage || mainImage.getAttribute('src') === src || !previewImages.length) return 7434 7435 for (let i = 0; i < previewImages.length; i += 1) { 7436 let image = previewImages[i], 7437 method = image.getAttribute('data-src') === src ? 'addDomClass' : 'removeDomClass' 7438 7439 sweSikaProductsHelper[method](image, 'active') 7440 slide.slide.classList.add('activeElement') 7441 } 7442 7443 mainImage.setAttribute('src', src) 7444 }) 7445 7446 } 7447 7448 //} catch (e) { 7449 // console.warn('unable to load sweSikaProducts.') 7450 // console.warn(e) 7451 //} 7452}) 7453 7454// An ajax library you need a microscope to see 7455// https://github.com/yanatan16/nanoajax 7456!function(t,e){function n(t){return t&&e.XDomainRequest&&!/MSIE 1/.test(navigator.userAgent)?new XDomainRequest:e.XMLHttpRequest?new XMLHttpRequest:void 0}function o(t,e,n){t[e]=t[e]||n}
7456var r=["responseType","withCredentials","timeout","onprogress"];t.ajax=function(t,a){function s(t,e){return function(){c||(a(void 0===f.status?t:f.status,0===f.status?"Error":f.response||f.responseText||e,f),c=!0)}}var u=t.headers||{},i=t.body,d=t.method||(i?"POST":"GET"),c=!1,f=n(t.cors);f.open(d,t.url,!0);var l=f.onload=s(200);f.onreadystatechange=function(){4===f.readyState&&l()},f.onerror=s(null,"Error"),f.ontimeout=s(null,"Timeout"),f.onabort=s(null,"Abort"),i&&(o(u,"X-Requested-With","XMLHttpRequest"),e.FormData&&i instanceof e.FormData||o(u,"Content-Type","application/x-www-form-urlencoded"));for(var p,m=0,v=r.length;v>m;m++)p=r[m],void 0!==t[p]&&(f[p]=t[p]);for(var p in u)f.setRequestHeader(p,u[p]);return f.send(i),f},e.nanoajax=t}({},function(){return this}()); 7457 7458this.variantselector = {}; 7459 7460(function(self){ 7461 "use strict"; 7462 7463 // .... DOM .... 7464 7465 var toObject = function(e){ 7466 if(typeof e === 'object'){ 7467 return e; 7468 7469 } else if(typeof e === 'string'){ 7470 var needles = [ 7471 e, 7472 '#'+e, 7473 ]; 7474 for(var i = 0; i < needles.length; ++i){ 7475 var needle = needles[i]; 7476 var obj = null; 7477 7478 try { 7479 obj = document.querySelector(needle); 7480 7481 if(obj){ 7482 return obj; 7483 } 7484 7485 } catch(e){} 7486 7487 obj = document.getElementById(needle); 7488 7489 if(obj){ 7490 return obj; 7491 } 7492 } 7493 7494 } else if(typeof e === 'function'){ 7495 return e(); 7496 } 7497 return null; 7498 }; 7499 var getEvery = function(s){ 7500 if(typeof s === 'object'){ 7501 return s; 7502 } 7503 return document.querySelectorAll(s); // NodeList 7504 }; 7505 var forEvery = function(s, f){ 7506 Array.prototype.forEach.call(getEvery(s),f); 7507 }; 7508 var hasAny = function(s){ 7509 var found = false; 7510 Array.prototype.forEach.call( getEvery(s), function(){ 7511 found = true; 7512 }); 7513 return found; 7514 }; 7515 var show = function(elem){ 7516 elem = toObject(elem); 7517 7518 let lightBox = document.querySelectorAll('.swe-lightbox'); 7519 7520 for (let i = 0; i < lightBox.length; i += 1) { 7521 if (lightBox[i].parentElement) { 7522 lightBox[i].parentElement.style.display = 'none'; 7523 } 7524 } 7525 7526 if(elem){ 7527 if(elem.classList.contains('flex')){ 7528 elem.style.display = 'flex'; 7529 7530 } else { 7531 elem.style.display = 'block'; 7532 } 7533 } 7534 }; 7535 var hide = function(elem){ 7536 elem = toObject(elem); 7537 7538 if(elem){ 7539 elem.style.display = 'none'; 7540 } 7541 }; 7542 var _opacity = function(elem, floatValue){ 7543 elem = toObject(elem); 7544 7545 if(elem){ 7546 var intValue = 100 * floatValue; 7547 elem.style.opacity = floatValue; //For real browsers; 7548 elem.style.filter = "alpha(opacity="+intValue+")"; //For IE; 7549 } 7550 }; 7551 var lowerOpacity = function(elem){ 7552 _opacity(elem, .2); 7553 }; 7554 var raiseOpacity = function(elem){ 7555 _opacity(elem, 1); 7556 }; 7557 var fadeIn = function(elem, onComplete){ 7558 elem = toObject(elem); 7559 7560 if(elem){ 7561 if((typeof(jQuery) !== 'undefined')){ 7562 jQuery(elem).fadeIn(500, onComplete); 7563 } else { 7564 show(elem); 7565 } 7566 } 7567 }; 7568 var fadeOut = function(elem, onComplete){ 7569 elem = toObject(elem); 7570 7571 if(elem){ 7572 if((typeof(jQuery) !== 'undefined')){ 7573 jQuery(elem).fadeOut(500, onComplete); 7574 7575 } else { 7576 hide(elem); 7577 } 7578 } 7579 }; 7580 var insertAfter = function(referenceNode, newNode){ 7581 referenceNode = toObject(referenceNode); 7582 newNode = toObject(newNode); 7583 7584 if(referenceNode && newNode){ 7585 if(referenceNode.nextSibling){ 7586 referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling); 7587 7588 } else { 7589 referenceNode.parentNode.appendChild(newNode); 7590 } 7591 } 7592 }; 7593 var removeChildren = function(referenceNode){ 7594 elem = toObject(referenceNode); 7595 7596 if(elem){ 7597 while(elem.firstChild){ 7598 elem.removeChild(elem.firstChild); 7599 } 7600 } 7601 }; 7602 7603 // .... FORM .... 7604 7605 var isInput = function(elem){ 7606 return isTag(elem, 'input'); 7607 }; 7608 var isTextInput = function(elem){ 7609 return (isInput(elem) && isType(elem, 'text')); 7610 }; 7611 var isNumberInput = function(elem){ 7612 return (isInput(elem) && isType(elem, 'number')); 7613 }; 7614 var isDateInput = function(elem){ 7615 return (isInput(elem) && isType(elem, 'date')); 7616 }; 7617 var isDateTimeInput = function(elem){ 7618 return (isInput(elem) && isType(elem, 'datetime')); 7619 }; 7620 var isTimeInput = function(elem){ 7621 return (isInput(elem) && isType(elem, 'time')); 7622 }; 7623 var isEmailInput = function(elem){ 7624 return (isInput(elem) && isType(elem, 'email')); 7625 }; 7626 var isSelectbox = function(elem){ 7627 return isTag(elem, 'select'); 7628 }; 7629 var isCheckbox = function(elem){ 7630 return isInput(elem) && isType(elem, 'checkbox'); 7631 }; 7632 var isButton = function(elem){ 7633 return isTag(elem, 'button') || isType(elem, 'button'); 7634 }; 7635 var isTag = function(elem, tagName){ 7636 elem = toObject(elem); 7637 7638 if(elem === null){ 7639 return false;
7640 } 7641 return (elem.tagName.toLowerCase() === tagName.toLowerCase()); 7642 }; 7643 var isType = function(elem, type){ 7644 elem = toObject(elem); 7645 7646 if(elem === null){ 7647 return false; 7648 } 7649 return (elem.type.toLowerCase() === type.toLowerCase()); 7650 }; 7651 var isRequired = function(elem){ 7652 elem = toObject(elem); 7653 7654 if(elem){ 7655 return (elem.hasAttribute('required') && elem.getAttribute('required') === 'required'); 7656 } 7657 return false; 7658 }; 7659 var setRequired = function(e){ 7660 e = toObject(e); 7661 7662 if(e){ 7663 e.setAttribute('required', 'required'); 7664 } 7665 }; 7666 var setNonRequired = function(e){ 7667 e = toObject(e); 7668 7669 if(e){ 7670 e.removeAttribute('required'); 7671 } 7672 }; 7673 var isDisabled = function(elem){ 7674 elem = toObject(elem); 7675 7676 if(elem){ 7677 return (elem.hasAttribute('disabled') && elem.getAttribute('disabled') === 'disabled'); 7678 } 7679 return false; 7680 }; 7681 var setDisabled = function(e){ 7682 e = toObject(e); 7683 7684 if(e){ 7685 e.setAttribute('disabled', 'disabled'); 7686 } 7687 }; 7688 var setNonDisabled = function(e){ 7689 e = toObject(e); 7690 7691 if(e){ 7692 e.removeAttribute('disabled'); 7693 } 7694 }; 7695 var setInnerHTML = function(elem, html){ 7696 elem = toObject(elem); 7697 elem.innerHTML = html; 7698 }; 7699 var appendInnerHTML = function(elem, html){ 7700 elem = toObject(elem); 7701 var content = elem.innerHTML; 7702 content += html; 7703 elem.innerHTML = content; 7704 }; 7705 var resetValue = function(elem){ 7706 elem = toObject(elem); 7707 7708 if(elem){ 7709 if(isCheckbox(elem)){ 7710 elem.checked = false; 7711 } else if(!isButton(elem) && elem.hasAttribute('value')){ 7712 elem.value = ''; 7713 } 7714 } 7715 return null; 7716 }; 7717 var getValue = function(elem){ 7718 elem = toObject(elem); 7719 7720 if(elem){ 7721 if(isCheckbox(elem)){ 7722 return elem.checked; 7723 7724 } else if(elem.hasAttribute('value')){ 7725 return elem.value; 7726 7727 } else if(elem.hasAttribute('innerHTML')){ 7728 return elem.innerHTML; 7729 } 7730 } 7731 return null; 7732 }; 7733 var setValue = function(elem, value){ 7734 elem = toObject(elem); 7735 7736 if(elem){ 7737 if(isCheckbox(elem)){ 7738 elem.checked = value; 7739 7740 } else if(elem.hasAttribute('value')){ 7741 elem.value = value; 7742 7743 } else if(elem.hasAttribute('innerHTML')){ 7744 elem.innerHTML = value; 7745 } 7746 } 7747 return null; 7748 }; 7749 var listenTo = function(s,callback){ 7750 forEvery(s, function(e){ 7751 if(e){ 7752 if(isSelectbox(e)){ 7753 e.addEventListener('change', function(evt){ 7754 callback(evt); 7755 }); 7756 } else if(isCheckbox(e)){ 7757 e.addEventListener('change', function(evt){ 7758 callback(evt); 7759 }); 7760 } else if(isNumberInput(e) || isDateInput(e) || isDateTimeInput(e) || isTimeInput(e)){ 7761 e.addEventListener('input', function(evt){ 7762 callback(evt); 7763 }); 7764 } else if(isTextInput(e) || isEmailInput(e)){ 7765 e.addEventListener('keyup', function(evt){ 7766 callback(evt); 7767 }); 7768 } else { 7769 e.addEventListener('click', function(evt){ 7770 callback(evt); 7771 }); 7772 } 7773 } 7774 }); 7775 }; 7776 7777 // .... STRING .... 7778 7779 var base64Decode = function(str){ 7780 return decodeURIComponent(escape(atob(str))); 7781 }; 7782 7783 // .... AJAX .... 7784 7785 var ajaxPost = function(url, data, onSuccessFunc, onErrorFunc){ 7786 var body = "json="+encodeURIComponent(JSON.stringify(data)); 7787 7788 forEvery('.select-container', function(elem){ 7789 elem.setAttribute('data-disabled', '1'); 7790 }); 7791 7792 nanoajax.ajax({timeout:3000, url: url, method: 'POST', body: body}, function (responseCode, responseText, request) { 7793 //--- request is the xmlhttprequest, which has `getResponseHeader(header)` function 7794 7795 forEvery('.select-container', function(elem){ 7796 elem.removeAttribute('data-disabled'); 7797 }); 7798 7799 if(!onErrorFunc){ 7800 onErrorFunc = function(error){ 7801 console.error(error); 7802 }; 7803 } 7804 if(responseCode != 200){ 7805 if(responseCode != 0){ 7806 onErrorFunc('an error [code: '+responseCode+'] occurred!'); 7807 } 7808 7809 } else if(onSuccessFunc){ 7810 var response = JSON.parse(decodeURIComponent(responseText)); 7811 7812 if(response.hasOwnProperty('success') && response.success === true){ 7813 if(response.hasOwnProperty('data')){ 7814 if(onSuccessFunc){ 7815 onSuccessFunc(response.data); 7816 } else if(response.data.hasOwnProperty('error')){ 7817 onErrorFunc(response.data.error); 7818 } 7819 } 7820 } 7821 } 7822 }); 7823 }; 7824 7825 // ------------------------------------------------- 7826 7827 var optionCatAttrName = 'data-variant-selector-option-cat'; 7828 var optionValueAttrName = 'data-variant-selector-option-value'; 7829 var optionElemsSelector = '['+optionCatAttrName+']['+optionValueAttrName+']'; 7830 var optionSelectedAttrName = 'data-variant-selector-option-selected'; 7831 var resetContainerAttrName = 'data-variant-selector-reset-container'; 7832 var requestContainerAttrName = 'data-variant-selector-request-container'; 7833 var skuContainerAttrName = 'data-variant-selector-sku-container'; 7834 var skuContainerElem = toObject('['+skuContainerAttrName+']'); 7835 7836 self.enabled = function() 7837 { 7838 if(hasAny(optionElemsSelector)){ 7839 return true; 7840 } 7841 return false;
7842 }; 7843 7844 self.setup = function(){ 7845 var updateSelector = function(){ 7846 var skuAttrName = 'data-variant-selector-sku'; 7847 var skuElem = toObject('['+skuAttrName+']'); 7848 7849 var updateUriAttrName = 'data-variant-selector-update-uri'; 7850 var updateUri = toObject('['+updateUriAttrName+']').getAttribute(updateUriAttrName); 7851 7852 var modelRangeAttrName = 'data-variant-selector-modelrange'; 7853 var modelRange = toObject('['+modelRangeAttrName+']').getAttribute(modelRangeAttrName); 7854 7855 var sendOptions = []; 7856 var categories = []; 7857 7858 forEvery(optionElemsSelector, function(elem){ 7859 var category = elem.getAttribute(optionCatAttrName); 7860 7861 if(categories.indexOf(category) === -1){ 7862 categories.push(category); 7863 } 7864 var option = { 7865 category: category, 7866 value: elem.getAttribute(optionValueAttrName), 7867 selected: parseInt(elem.getAttribute(optionSelectedAttrName)) 7868 }; 7869 sendOptions.push(option); 7870 }); 7871 7872 var sendData = { 7873 modelRange: modelRange, 7874 options: sendOptions 7875 }; 7876 7877 ajaxPost(updateUri, sendData, function(resultData){ 7878 var item = resultData.hasOwnProperty('item') ? resultData.item : ''; 7879 7880 if(item){ 7881 setInnerHTML(skuElem, item.sku); 7882 document.querySelector('.item-no').value = item.sku 7883 7884 forEvery('input[data-type="request-button"]', function(button){ 7885 button.setAttribute('data-product', item.uid); 7886 }); 7887 7888 fadeIn(skuContainerElem); 7889 forEvery('['+requestContainerAttrName+']', function(elem){ 7890 fadeIn(elem); 7891 }); 7892 } else { 7893 hide(skuContainerElem); 7894 document.querySelector('.item-no').value = '' 7895 7896 forEvery('input[data-type="request-button"]', function(button){ 7897 button.setAttribute('data-product', ''); 7898 }); 7899 7900 forEvery('['+requestContainerAttrName+']', function(elem){ 7901 hide(elem); 7902 }); 7903 setInnerHTML(skuElem, ''); 7904 } 7905 7906 if(resultData.hasOwnProperty('options')){ 7907 var updateOptions = resultData.options; 7908 7909 for(var i = 0; i < updateOptions.length; ++i){ 7910 var updateOption = updateOptions[i]; 7911 7912 forEvery('['+optionCatAttrName+'="'+updateOption.category+'"]['+optionValueAttrName+'="'+updateOption.value+'"]', function(elem){ 7913 if(updateOption.hasOwnProperty('selectable')){ 7914 if(parseInt(updateOption.selectable) === 1){ 7915 show(elem); 7916 } 7917 if(parseInt(updateOption.selectable) === 0){ 7918 hide(elem); 7919 } 7920 } 7921 }); 7922 } 7923 } 7924 7925 forEvery('.select-value', function (element) { 7926 if (element.value.length) { 7927 element.classList.add('selected') 7928 } 7929 }) 7930 }); 7931 }; 7932 7933 listenTo('['+resetContainerAttrName+']', function(evt){ 7934 // var resetUriAttrName = 'data-variant-selector-reset-uri-dev'; 7935 // var resetUri = toObject('['+resetUriAttrName+']').getAttribute(resetUriAttrName); 7936 7937 forEvery('.selected', function (element) { 7938 element.classList.remove('selected') 7939 }) 7940 7941 forEvery('['+optionSelectedAttrName+']', function(elem){ 7942 show(elem); 7943 elem.setAttribute(optionSelectedAttrName, '0'); 7944 }); 7945 7946 var defaultSelectValueAttrName = 'data-variant-selector-default-select-value';
7947 7948 forEvery('['+defaultSelectValueAttrName+']', function(elem){ 7949 setValue(elem, elem.getAttribute(defaultSelectValueAttrName)); 7950 }); 7951 7952 var defaultSelectLabelAttrName = 'data-variant-selector-default-select-label'; 7953 7954 forEvery('['+defaultSelectLabelAttrName+']', function(elem){ 7955 setInnerHTML(elem, elem.getAttribute(defaultSelectLabelAttrName)); 7956 }); 7957 7958 forEvery('['+resetContainerAttrName+']', function(elem){ 7959 hide(elem); 7960 }); 7961 7962 hide(skuContainerElem); 7963 7964 forEvery('['+requestContainerAttrName+']', function(elem){ 7965 hide(elem); 7966 }); 7967 }); 7968 7969 listenTo('['+requestContainerAttrName+']', function(evt){ 7970 // var requestUriAttrName = 'data-variant-selector-request-uri'; 7971 // var requestUri = toObject('['+requestUriAttrName+']').getAttribute(requestUriAttrName); 7972 7973 forEvery('['+requestContainerAttrName+']', function(elem){ 7974 hide(elem); 7975 }); 7976 }); 7977 7978 listenTo(optionElemsSelector, function(evt){ 7979 if(evt.target){ 7980 forEvery('['+resetContainerAttrName+']', function(elem){ 7981 fadeIn(elem); 7982 }); 7983 7984 var category = evt.target.getAttribute(optionCatAttrName); 7985 7986 forEvery('['+optionCatAttrName+'="'+category+'"]', function(elem){ 7987 elem.setAttribute(optionSelectedAttrName, '0'); 7988 }); 7989 evt.target.setAttribute(optionSelectedAttrName, '1'); 7990 updateSelector(); 7991 } 7992 }); 7993 updateSelector(); 7994 7995 return self; 7996 }; 7997 7998})(this.variantselector); 7999 8000document.addEventListener("DOMContentLoaded", function(event){ 8001 if(!window.variantselector.enabled()){ 8002 return; 8003 } 8004 try { 8005 window.variantselector.setup(); 8006 console.log('variantselector.js successfully loaded.'); 8007 8008 } catch(ex){ 8009 console.error('variantselector.js failed to load!'); 8010 console.error(ex); 8011 } 8012}); 8013 8014// An ajax library you need a microscope to see 8015// https://github.com/yanatan16/nanoajax 8016!function(t,e){function n(t){return t&&e.XDomainRequest&&!/MSIE 1/.test(navigator.userAgent)?new XDomainRequest:e.XMLHttpRequest?new XMLHttpRequest:void 0}function o(t,e,n){t[e]=t[e]||n}
8016var r=["responseType","withCredentials","timeout","onprogress"];t.ajax=function(t,a){function s(t,e){return function(){c||(a(void 0===f.status?t:f.status,0===f.status?"Error":f.response||f.responseText||e,f),c=!0)}}var u=t.headers||{},i=t.body,d=t.method||(i?"POST":"GET"),c=!1,f=n(t.cors);f.open(d,t.url,!0);var l=f.onload=s(200);f.onreadystatechange=function(){4===f.readyState&&l()},f.onerror=s(null,"Error"),f.ontimeout=s(null,"Timeout"),f.onabort=s(null,"Abort"),i&&(o(u,"X-Requested-With","XMLHttpRequest"),e.FormData&&i instanceof e.FormData||o(u,"Content-Type","application/x-www-form-urlencoded"));for(var p,m=0,v=r.length;v>m;m++)p=r[m],void 0!==t[p]&&(f[p]=t[p]);for(var p in u)f.setRequestHeader(p,u[p]);return f.send(i),f},e.nanoajax=t}({},function(){return this}()); 8017 8018// A small fill-in to add .hasClass(), .addClass(), .removeClass() and .toggleClass() to every HTML-Element. 8019// https://github.com/EarMaster/CSSClass 8020(function(){Array.prototype.CSSClassIndexOf=Array.prototype.indexOf||function(a){for(var b=this.length,e=0;e<b;e++)if(this[e]===a)return e;return-1};var d="classList"in document.createElement("a"),c=Element.prototype;d?(c.hasClass||(c.hasClass=function(a){var b=!0;Array.prototype.slice.call(this.classList);a=a.split(" ");for(var e=0;e<a.length;e++)this.classList.contains(a[e])||(b=!1);return b}),c.addClass||(c.addClass=function(a){a=a.split(" ");for(var b=0;b<a.length;b++)this.hasClass(a[b])||this.classList.add(a[b]); 8021return this}),c.removeClass||(c.removeClass=function(a){this.className.split(" ");a=a.split(" ");for(var b=0;b<a.length;b++)this.hasClass(a[b])&&this.classList.remove(a[b]);return this}),c.toggleClass||(c.toggleClass=function(a){a=a.split(" ");for(var b=0;b<a.length;b++)this.classList.toggle(a[b]);return this})):(c.hasClass||(c.hasClass=function(a){var b=!0,e=this.className.split(" ");a=a.split(" ");for(var c=0;c<a.length;c++)-1===e.CSSClassIndexOf(a[c])&&(b=!1);return b}),c.addClass||(c.addClass= 8022function(a){a=a.split(" ");for(var b=0;b<a.length;b++)this.hasClass(a[b])||(this.className=""!==this.className?this.className+" "+a[b]:a[b]);return this}),c.removeClass||(c.removeClass=function(a){var b=this.className.split(" ");a=a.split(" ");for(var c=0;c<a.length;c++)this.hasClass(a[c])&&b.splice(b.CSSClassIndexOf(a[c]),1);this.className=b.join(" ");return this}),c.toggleClass||(c.toggleClass=function(a){a=a.split(" ");for(var b=0;b<a.length;b++)this.hasClass(a[b])?this.removeClass(a[b]):this.addClass(a[b]); 8023return this}));d=NodeList.prototype;d.hasClass||(d.hasClass=function(a,b){void 0===b&&(b=!0);for(var c=0,d=b?!0:!1;(b&&!0===d||!b&&!1===d)&&c<this.length;++c)d=this[c].hasClass(a);return d});d.addClass||(d.addClass=function(a){for(var b=0;b<this.length;++b)this[b].addClass(a)});d.removeClass||(d.removeClass=function(a){for(var b=0;b<this.length;++b)this[b].removeClass(a)});d.toggleClass||(d.toggleClass=function(a){for(var b=0;b<this.length;++b)this[b].toggleClass(a)})})(); 8024 8025this.listfilter = {}; 8026 8027(function(self){ 8028 "use strict"; 8029 8030 self.compatProductlist = function() 8031 { 8032 // which template version is required? 8033 return ['1.1.14']; 8034 }; 8035 8036 self.compatListfilter = function() 8037 { 8038 // which partial version is required? 8039 return ['1.1.17']; 8040 }; 8041 8042 self.log = {}; 8043 8044 self.log.writeln = function(message) 8045 { 8046 console.log(message); 8047 }; 8048 8049 self.error = {}; 8050 8051 self.error.writeln = function(message) 8052 { 8053 console.error(message); 8054 }; 8055 8056 self.info = function() 8057 { 8058 return 'listfilter.js v'+window.listfilter.version()+' ('+window.listfilter.fileinfo()+') '+self.compat(); 8059 }; 8060 8061 self.fileinfo = function() 8062 { 8063 return 'extension/.../listfilter.js'; 8064 }; 8065 8066 self.version = function() 8067 { 8068 return '1.1.19'; 8069 }; 8070 8071 self.compat = function() 8072 { 8073 return 'compat ProductList.html,ListFilter.html'; 8074 }; 8075 8076 // .... DOM .... 8077 8078 var dom = {}; 8079 8080 dom.toObject = function(e){ 8081 if(typeof e === 'object'){ 8082 return e; 8083 8084 } else if(typeof e === 'string'){ 8085 var needles = [ 8086 e, 8087 '#'+e, 8088 ]; 8089 for(var i = 0; i < needles.length; ++i){ 8090 var needle = needles[i]; 8091 var obj = null; 8092 8093 try { 8094 obj = document.querySelector(needle); 8095 8096 if(obj){ 8097 return obj; 8098 } 8099 8100 } catch(e){} 8101 8102 obj = document.getElementById(needle); 8103 8104 if(obj){ 8105 return obj; 8106 } 8107 } 8108 8109 } else if(typeof e === 'function'){ 8110 return e(); 8111 } 8112 return null; 8113 }; 8114 dom.getEvery = function(s){ 8115 if(typeof s === 'object'){ 8116 return s; 8117 } 8118 return document.querySelectorAll(s); // NodeList 8119 }; 8120 dom.forEvery = function(s, f){ 8121 Array.prototype.forEach.call(dom.getEvery(s),f); 8122 }; 8123 dom.hasAny = function(s){ 8124 var found = false;
8125 Array.prototype.forEach.call( dom.getEvery(s), function(){ 8126 found = true; 8127 }); 8128 return found; 8129 }; 8130 dom.show = function(elem){ 8131 elem = dom.toObject(elem); 8132 8133 let lightBox = document.querySelectorAll('.swe-lightbox'); 8134 8135 for (let i = 0; i < lightBox.length; i += 1) { 8136 if (lightBox[i].parentElement) { 8137 lightBox[i].parentElement.style.display = 'none'; 8138 } 8139 } 8140 8141 if(elem){ 8142 dom.showBlock(elem); 8143 } 8144 }; 8145 dom.showBlock = function(elem) 8146 { 8147 elem = dom.toObject(elem); 8148 8149 if(elem){ 8150 if(elem.classList.contains('flex')){ 8151 elem.style.display = 'flex'; 8152 8153 } else { 8154 elem.style.display = 'block'; 8155 } 8156 } 8157 }; 8158 dom.showInline = function(elem) 8159 { 8160 elem = dom.toObject(elem); 8161 8162 if(elem){ 8163 if(elem.classList.contains('flex')){ 8164 elem.style.display = 'flex'; 8165 8166 } else { 8167 elem.style.display = 'inline-flex'; 8168 } 8169 } 8170 }; 8171 dom.hide = function(elem){ 8172 elem = dom.toObject(elem); 8173 8174 if(elem){ 8175 elem.style.display = 'none'; 8176 } 8177 }; 8178 dom._opacity = function(elem, floatValue){ 8179 elem = dom.toObject(elem); 8180 8181 if(elem){ 8182 var intValue = 100 * floatValue; 8183 elem.style.opacity = floatValue; //For real browsers; 8184 elem.style.filter = "alpha(opacity="+intValue+")"; //For IE; 8185 } 8186 }; 8187 dom.lowerOpacity = function(elem){ 8188 dom._opacity(elem, .2); 8189 }; 8190 dom.raiseOpacity = function(elem){ 8191 dom._opacity(elem, 1); 8192 }; 8193 dom.fadeIn = function(elem, onComplete){ 8194 elem = dom.toObject(elem); 8195 8196 if(elem){ 8197 if((typeof(jQuery) !== 'undefined')){ 8198 jQuery(elem).fadeIn(500, onComplete); 8199 } else { 8200 dom.show(elem); 8201 } 8202 } 8203 }; 8204 dom.fadeOut = function(elem, onComplete){ 8205 elem = dom.toObject(elem); 8206 8207 if(elem){ 8208 if((typeof(jQuery) !== 'undefined')){ 8209 jQuery(elem).fadeOut(500, onComplete); 8210 8211 } else { 8212 dom.hide(elem); 8213 } 8214 } 8215 }; 8216 dom.insertAfter = function(referenceNode, newNode){ 8217 referenceNode = dom.toObject(referenceNode); 8218 newNode = dom.toObject(newNode); 8219 8220 if(referenceNode && newNode){ 8221 if(referenceNode.nextSibling){ 8222 referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling); 8223 8224 } else { 8225 referenceNode.parentNode.appendChild(newNode); 8226 } 8227 } 8228 }; 8229 dom.removeChildren = function(referenceNode){ 8230 elem = dom.toObject(referenceNode); 8231 8232 if(elem){ 8233 while(elem.firstChild){ 8234 elem.removeChild(elem.firstChild); 8235 } 8236 } 8237 }; 8238 dom.setInnerHTML = function(elem, html){ 8239 elem = dom.toObject(elem); 8240 elem.innerHTML = html; 8241 }; 8242 dom.appendInnerHTML = function(elem, html){ 8243 elem = dom.toObject(elem); 8244 var content = elem.innerHTML; 8245 content += html; 8246 elem.innerHTML = content; 8247 }; 8248 8249 // .... FORM .... 8250 8251 dom.isInput = function(elem){ 8252 return dom.isTag(elem, 'input'); 8253 }; 8254 dom.isTextInput = function(elem){ 8255 return (dom.isInput(elem) && dom.isType(elem, 'text')); 8256 }; 8257 dom.isNumberInput = function(elem){ 8258 return (dom.isInput(elem) && dom.isType(elem, 'number')); 8259 }; 8260 dom.isRangeInput = function(elem){ 8261 return (dom.isInput(elem) && dom.isType(elem, 'range')); 8262 }; 8263 dom.isDateInput = function(elem){ 8264 return (dom.isInput(elem) && dom.isType(elem, 'date')); 8265 }; 8266 dom.isDateTimeInput = function(elem){ 8267 return (dom.isInput(elem) && dom.isType(elem, 'datetime')); 8268 }; 8269 dom.isTimeInput = function(elem){ 8270 return (dom.isInput(elem) && dom.isType(elem, 'time')); 8271 }; 8272 dom.isEmailInput = function(elem){ 8273 return (dom.isInput(elem) && dom.isType(elem, 'email')); 8274 }; 8275 dom.isSelectbox = function(elem){ 8276 return dom.isTag(elem, 'select'); 8277 }; 8278 dom.isCheckbox = function(elem){ 8279 return dom.isInput(elem) && dom.isType(elem, 'checkbox'); 8280 }; 8281 dom.isButton = function(elem){ 8282 return dom.isTag(elem, 'button') || dom.isType(elem, 'button'); 8283 }; 8284 dom.isTag = function(elem, tagName){ 8285 elem = dom.toObject(elem); 8286 8287 if(elem === null){ 8288 return false;
8289 } 8290 return (elem.tagName.toLowerCase() === tagName.toLowerCase()); 8291 }; 8292 dom.isType = function(elem, type){ 8293 elem = dom.toObject(elem); 8294 8295 if(elem === null){ 8296 return false; 8297 } 8298 return (elem.type.toLowerCase() === type.toLowerCase()); 8299 }; 8300 dom.isRequired = function(elem){ 8301 elem = dom.toObject(elem); 8302 8303 if(elem){ 8304 return (elem.hasAttribute('required') && elem.getAttribute('required') === 'required'); 8305 } 8306 return false; 8307 }; 8308 dom.setRequired = function(e){ 8309 e = dom.toObject(e); 8310 8311 if(e){ 8312 e.setAttribute('required', 'required'); 8313 } 8314 }; 8315 dom.setNonRequired = function(e){ 8316 e = dom.toObject(e); 8317 8318 if(e){ 8319 e.removeAttribute('required'); 8320 } 8321 }; 8322 dom.isDisabled = function(elem){ 8323 elem = dom.toObject(elem); 8324 8325 if(elem){ 8326 return (elem.hasAttribute('disabled') && elem.getAttribute('disabled') === 'disabled'); 8327 } 8328 return false; 8329 }; 8330 dom.setDisabled = function(e){ 8331 e = dom.toObject(e); 8332 8333 if(e){ 8334 e.setAttribute('disabled', 'disabled'); 8335 } 8336 }; 8337 dom.setNonDisabled = function(e){ 8338 e = dom.toObject(e); 8339 8340 if(e){ 8341 e.removeAttribute('disabled'); 8342 } 8343 }; 8344 dom.getValue = function(elem){ 8345 elem = dom.toObject(elem); 8346 8347 if(elem){ 8348 if(dom.isCheckbox(elem)){ 8349 return elem.checked; 8350 8351 } else if(elem.hasAttribute('value')){ 8352 return elem.value; 8353 8354 } else if(elem.hasAttribute('innerHTML')){ 8355 return elem.innerHTML; 8356 } 8357 } 8358 return null; 8359 }; 8360 dom.setValue = function(elem, value){ 8361 elem = dom.toObject(elem); 8362 8363 if(elem){ 8364 if(dom.isCheckbox(elem)){ 8365 elem.checked = value; 8366 8367 } else if(elem.hasAttribute('value')){ 8368 elem.value = value; 8369 8370 } else if(elem.hasAttribute('innerHTML')){ 8371 elem.innerHTML = value; 8372 } 8373 } 8374 return null; 8375 }; 8376 dom.resetValue = function(elem){ 8377 elem = dom.toObject(elem); 8378 8379 if(elem){ 8380 if(dom.isCheckbox(elem)){ 8381 elem.checked = false; 8382 } else if(!dom.isButton(elem) && elem.hasAttribute('value')){ 8383 elem.value = ''; 8384 } 8385 } 8386 return null; 8387 }; 8388 dom.listenTo = function(s,callback){ 8389 dom.forEvery(s, function(e){ 8390 if(e){ 8391 if(dom.isSelectbox(e)){ 8392 e.addEventListener('change', function(evt){ 8393 callback(evt); 8394 }); 8395 } else if(dom.isCheckbox(e)){ 8396 e.addEventListener('change', function(evt){ 8397 callback(evt); 8398 }); 8399 } else if(dom.isRangeInput(e) || dom.isNumberInput(e) || dom.isDateInput(e) || dom.isDateTimeInput(e) || dom.isTimeInput(e)){ 8400 e.addEventListener('input', function(evt){ 8401 callback(evt); 8402 }); 8403 } else if(dom.isTextInput(e) || dom.isEmailInput(e)){ 8404 e.addEventListener('keyup', function(evt){ 8405 callback(evt); 8406 }); 8407 } else { 8408 e.addEventListener('click', function(evt){ 8409 callback(evt); 8410 }); 8411 } 8412 } 8413 }); 8414 }; 8415 8416 // .... STRING .... 8417 8418 var strings = {}; 8419 8420 strings.base64Decode = function(str){ 8421 return decodeURIComponent(escape(atob(str))); 8422 }; 8423 8424 // .... AJAX .... 8425 8426 var ajax = {}; 8427 8428 ajax.dataEncode = function(data) 8429 { 8430 return encodeURIComponent(JSON.stringify(data)); 8431 }; 8432 8433 ajax.dataDecode = function(data) 8434 { 8435 return JSON.parse(decodeURIComponent(data)); 8436 }; 8437 8438 ajax.post = function(url, data, onSuccessFunc, onErrorFunc){ 8439 var body = "json="+ajax.dataEncode(data); 8440 8441 // dom.forEvery('.select-container', function(elem){ 8442 // elem.setAttribute('data-disabled', '1'); 8443 // }); 8444 8445 nanoajax.ajax({timeout:3000, url: url, method: 'POST', body: body}, function (responseCode, responseText, request) { 8446 //--- request is the xmlhttprequest, which has `getResponseHeader(header)` function 8447 8448 // dom.forEvery('.select-container', function(elem){ 8449 // elem.removeAttribute('data-disabled'); 8450 // }); 8451 8452 if(!onErrorFunc){ 8453 onErrorFunc = function(error){ 8454 self.error.writeln(error); 8455 }; 8456 } 8457 if(responseCode != 200){ 8458 if(responseCode != 0){ 8459 onErrorFunc('an error [code: '+responseCode+'] occurred!'); 8460 } 8461 8462 } else if(onSuccessFunc){ 8463 var response = ajax.dataDecode(responseText); 8464 8465 if(response.hasOwnProperty('success') && response.success === true){ 8466 if(response.hasOwnProperty('data')){ 8467 if(onSuccessFunc){ 8468 onSuccessFunc(response.data); 8469 } else if(response.data.hasOwnProperty('error')){ 8470 onErrorFunc(response.data.error); 8471 } 8472 } 8473 } 8474 } 8475 }); 8476 }; 8477 8478 // .... ARRAYS .... 8479 8480 var arrays = {}; 8481 8482 arrays.intersect = function(a,b) 8483 {
8484 var A = new Set(a); 8485 var B = new Set(b); 8486 var C = new Set([...A].filter(x => B.has(x))); 8487 return Array.from(C); 8488 }; 8489 8490 // .... STORAGE .... 8491 8492 var storage = {}; 8493 8494 storage.impl = function() 8495 { 8496 return localStorage; 8497 }; 8498 8499 storage.putItem = function(key, value) 8500 { 8501 storage.impl().setItem(key, value); 8502 }; 8503 8504 storage.hasItem = function(key) 8505 { 8506 return storage.impl().getItem(key) !== null; 8507 }; 8508 8509 storage.retrieveItem = function(key) 8510 { 8511 return storage.impl().getItem(key); // string|null 8512 }; 8513 8514 storage.removeItem = function(key) 8515 { 8516 storage.impl().removeItem(key); 8517 }; 8518 8519 // ------------------------------------------------- 8520 8521 var filter = {}; 8522 8523 filter.selectors = {}; 8524 8525 filter.selectors.getFormContainer = function() 8526 { 8527 return '[data-type="listfilter-form-container"]'; 8528 }; 8529 8530 filter.selectors.getOption = function() 8531 { 8532 return '[data-type="listfilter-option"]'; 8533 }; 8534 8535 filter.selectors.getOptionByOptionId = function(optionId) 8536 { 8537 return ''+filter.selectors.getOption()+'[data-option-id="'+optionId+'"]'; 8538 }; 8539 8540 filter.selectors.getOptionsBySelectorId = function(selectorId) 8541 { 8542 return ''+filter.selectors.getOption()+'[data-selector-id="'+selectorId+'"]'; 8543 }; 8544 8545 filter.selectors.getSelectableAndSelectedOptions = function() 8546 { 8547 return ''+filter.selectors.getOption()+'[data-selectable="1"][data-selected="1"]'; 8548 }; 8549 8550 filter.selectors.getModelRangeTiles = function() 8551 { 8552 return '[data-listfilter-modelrange]'; 8553 }; 8554 8555 filter.selectors.getModelRangeTile = function(modelRange) 8556 { 8557 return '[data-listfilter-modelrange="'+modelRange+'"]'; 8558 }; 8559 8560 filter.selectors.getResetButton = function() 8561 { 8562 return '[id="listfilter-reset-button"]'; 8563 }; 8564 8565 filter.hideAllSelectors = function(){ 8566 dom.forEvery(singleselector.selectors.getLabels(), function(elem){ 8567 var optionsContainerId = elem.getAttribute('id') + '-options'; 8568 var optionsContainer = dom.toObject(optionsContainerId); 8569 var optionsContainerActive = optionsContainer.getAttribute('data-active'); 8570 8571 optionsContainer.setAttribute('data-active', '0'); 8572 dom.hide(optionsContainer); 8573 elem.setAttribute('data-active', '0'); 8574 }); 8575 }; 8576 8577 // ------------------------------------------------- 8578 8579 var singleselector = {}; 8580 8581 singleselector.selectors = {}; 8582 8583 singleselector.selectors.getLabels = function() 8584 { 8585 return '[data-type="listfilter-selector-label"]'; 8586 }; 8587 8588 singleselector.selectors.getClickableOptions = function() 8589 { 8590 return ''+filter.selectors.getOption()+'[data-clickable="1"]'; 8591 }; 8592 8593 singleselector.showOption = function(elem) 8594 { 8595 dom.showInline(elem); 8596 }; 8597 8598 // ------------------------------------------------- 8599 8600 var rangeselector = {}; 8601 8602 rangeselector.selectors = {}; 8603 8604 rangeselector.selectors.getRangeSliders = function() 8605 { 8606 return '[data-type="listfilter-rangeselector-slider"]'; 8607 }; 8608 8609 rangeselector.selectors.getRangeFromSliderBySelectorName = function(selectorName) 8610 { 8611 return ''+rangeselector.selectors.getRangeSliders()+'[data-slider-type="from"][data-selector-name="'+selectorName+'"]'; 8612 }; 8613 8614 rangeselector.selectors.getRangeFromSliderBySelectorId = function(selectorId) 8615 { 8616 return ''+rangeselector.selectors.getRangeSliders()+'[data-slider-type="from"][data-selector-id="'+selectorId+'"]'; 8617 }; 8618 8619 rangeselector.selectors.getRangeToSliderBySelectorName = function(selectorName) 8620 { 8621 return ''+rangeselector.selectors.getRangeSliders()+'[data-slider-type="to"][data-selector-name="'+selectorName+'"]'; 8622 }; 8623 8624 rangeselector.selectors.getRangeToSliderBySelectorId = function(selectorId) 8625 { 8626 return ''+rangeselector.selectors.getRangeSliders()+'[data-slider-type="to"][data-selector-id="'+selectorId+'"]'; 8627 }; 8628 8629 rangeselector.selectors.getOptionsBySelectorName = function(selectorName) 8630 { 8631 return ''+filter.selectors.getOption()+'[data-selector-name="'+selectorName+'"]'; 8632 }; 8633 8634 rangeselector.selectors.getSelectedOptionsBySelectorId = function(selectorId) 8635 { 8636 return '[data-type="listfilter-rangeselector-selected-option"][data-selector-id="'+selectorId+'"]'; 8637 }; 8638 8639 rangeselector.selectors.getSelectedOptionByOptionId = function(optionId) 8640 { 8641 return '[data-type="listfilter-rangeselector-selected-option"][data-option-id="'+optionId+'"]'; 8642 }; 8643 8644 rangeselector.selectors.getAllSelectedOptions = function() 8645 { 8646 return '[data-type="listfilter-rangeselector-selected-option"]'; 8647 }; 8648 8649 rangeselector.showOption = function(elem) 8650 { 8651 dom.showInline(elem); 8652 }; 8653 8654 rangeselector.getOptionsBySelectorName = function(selectorName) 8655 { 8656 var options = []; 8657 8658 dom.forEvery(rangeselector.selectors.getOptionsBySelectorName(selectorName), function(option){ 8659 options.push(option); 8660 }); 8661 8662 return options; 8663 }; 8664 8665 rangeselector.getOptionsBySelectorId = function(selectorId) 8666 { 8667 var options = []; 8668 8669 dom.forEvery(filter.selectors.getOptionsBySelectorId(selectorId), function(option){ 8670 options.push(option); 8671 }); 8672 8673 return options; 8674 }; 8675 8676 rangeselector.resetBySelectorId = function(selectorId) 8677 { 8678 // - gewählte Optionen from/to ausblenden 8679 dom.forEvery(rangeselector.selectors.getSelectedOptionsBySelectorId(selectorId), function(rangeSelectorSelectedOption){ 8680 dom.hide(rangeSelectorSelectedOption); 8681 }); 8682 8683 tags.removeRange(selectorId); 8684 8685 dom.forEvery(rangeselector.selectors.getRangeFromSliderBySelectorId(selectorId), function(elem){ 8686 var selectorName = elem.getAttribute('data-selector-name'); 8687 var options = rangeselector.getOptionsBySelectorId(selectorId); 8688 8689 dom.forEvery(rangeselector.selectors.getRangeFromSliderBySelectorName(selectorName), function(fromSlider){ 8690 fromSlider.value = 1; 8691 });
8692 dom.forEvery(rangeselector.selectors.getRangeToSliderBySelectorName(selectorName), function(toSlider){ 8693 toSlider.value = options.length; 8694 }); 8695 8696 for(var i = 0; i < options.length; ++i){ 8697 var option = options[i]; 8698 var optionId = option.getAttribute('data-option-id'); 8699 var optionIndex = parseInt(option.getAttribute('data-option-index')); 8700 8701 option.setAttribute('data-selected', 0); 8702 8703 if(storage.hasItem(optionId)){ 8704 //self.log.writeln('forget ['+selectorName+']['+optionIndex+']'); 8705 storage.removeItem(optionId); 8706 } 8707 }; 8708 }); 8709 }; 8710 8711 // ------------------------------------------------- 8712 8713 var prettyrangeselector = {}; 8714 8715 prettyrangeselector.selectors = {}; 8716 8717 prettyrangeselector.selectors.getComponentsBySelectorName = function(selectorName) 8718 { 8719 return '[data-type="listfilter-rangeselector-slider-pretty-component"][data-selector-name="'+selectorName+'"]'; 8720 }; 8721 8722 prettyrangeselector.selectors.getUnselectedRangeLeftBySelectorName = function(selectorName) 8723 { 8724 return '[data-slider-component-type="unselected-range-left"]'+prettyrangeselector.selectors.getComponentsBySelectorName(selectorName)+''; 8725 }; 8726 8727 prettyrangeselector.selectors.getUnselectedRangeRightBySelectorName = function(selectorName) 8728 { 8729 return '[data-slider-component-type="unselected-range-right"]'+prettyrangeselector.selectors.getComponentsBySelectorName(selectorName)+''; 8730 }; 8731 8732 prettyrangeselector.selectors.getSelectedRangeCenterBySelectorName = function(selectorName) 8733 { 8734 return '[data-slider-component-type="selected-range-center"]'+prettyrangeselector.selectors.getComponentsBySelectorName(selectorName)+''; 8735 }; 8736 8737 prettyrangeselector.selectors.getHandleLeftBySelectorName = function(selectorName) 8738 { 8739 return '[data-slider-component-type="handle-left"]'+prettyrangeselector.selectors.getComponentsBySelectorName(selectorName)+''; 8740 }; 8741 8742 prettyrangeselector.selectors.getHandleRightBySelectorName = function(selectorName) 8743 { 8744 return '[data-slider-component-type="handle-right"]'+prettyrangeselector.selectors.getComponentsBySelectorName(selectorName)+''; 8745 }; 8746 8747 prettyrangeselector.resetBySelectorId = function(selectorId) 8748 { 8749 dom.forEvery(rangeselector.selectors.getRangeFromSliderBySelectorId(selectorId), function(elem){ 8750 var selectorName = elem.getAttribute('data-selector-name'); 8751 var options = rangeselector.getOptionsBySelectorId(selectorId); 8752 var fromIndex = 1; 8753 var toIndex = options.length; 8754 prettyrangeselector.updateBySelectorName(selectorName, fromIndex, toIndex); 8755 prettyrangeselector.updateThumbs(fromIndex - 1, toIndex - 1); 8756 }); 8757 }; 8758 8759 prettyrangeselector.updateBySelectorName = function(selectorName, fromIndex, toIndex) 8760 { 8761 var fromSlider = dom.toObject(rangeselector.selectors.getRangeFromSliderBySelectorName(selectorName)); 8762 var toSlider = dom.toObject(rangeselector.selectors.getRangeToSliderBySelectorName(selectorName)); 8763 8764 var min = parseInt(fromSlider.getAttribute('min')); 8765 var max = parseInt(toSlider.getAttribute('max')); 8766 8767 if(!fromIndex){ 8768 fromIndex = min; 8769 } 8770 8771 if(!toIndex){ 8772 toIndex = max; 8773 } 8774 8775 let fromPercentValue = (100 / (max - min)) * fromIndex - (100 / (max - min)) * min; 8776 let toPercentValue = (100 / (max - min)) * toIndex - (100 / (max - min)) * min; 8777 8778 //self.log.writeln('update pretty rangeselector ' + selectorName + ': from ' + fromPercentValue + '%, to ' + toPercentValue + '%'); 8779 8780 // --- 8781 8782 var unselectedRangeLeft = dom.toObject(prettyrangeselector.selectors.getUnselectedRangeLeftBySelectorName(selectorName)); 8783 var unselectedRangeRight = dom.toObject(prettyrangeselector.selectors.getUnselectedRangeRightBySelectorName(selectorName)); 8784 var selectedRangeCenter = dom.toObject(prettyrangeselector.selectors.getSelectedRangeCenterBySelectorName(selectorName)); 8785 var handleLeft = dom.toObject(prettyrangeselector.selectors.getHandleLeftBySelectorName(selectorName)); 8786 var handleRight = dom.toObject(prettyrangeselector.selectors.getHandleRightBySelectorName(selectorName)); 8787 8788 // [1] 8789 unselectedRangeLeft.style.width = fromPercentValue + '%'; 8790 8791 // [3] 8792 unselectedRangeRight.style.width = (100 - toPercentValue) + '%'; 8793 8794 // [5] 8795 selectedRangeCenter.style.left = fromPercentValue + '%'; 8796 selectedRangeCenter.style.right = (100 - toPercentValue) + '%'; 8797 8798 // [7] 8799 handleLeft.style.left = fromPercentValue + '%'; 8800 8801 // [9] 8802 handleRight.style.left = toPercentValue + '%'; 8803 8804 // children[1].style.width = fromPercentValue + '%'; 8805 // children[5].style.left = fromPercentValue + '%'; 8806 // children[7].style.left = fromPercentValue + '%'; 8807 // children[11].style.left = fromPercentValue + '%'; 8808 // // children[11].childNodes[1].innerHTML = fromValueContainer.textContent; 8809 8810 // --- 8811 8812 // children[3].style.width = (100 - toPercentValue) + '%'; 8813 // children[5].style.right = (100 - toPercentValue) + '%'; 8814 // children[9].style.left = toPercentValue +'%'; 8815 // children[13].style.left = toPercentValue +'%'; 8816 // children[13].childNodes[1].innerHTML = toValueContainer.textContent; 8817 }; 8818 8819 prettyrangeselector.updateThumbs = function(fromIndex, toIndex) { 8820 const fromOption = document.querySelector('span[data-option-index="' + fromIndex + '"]'); 8821 const toOption = document.querySelector('span[data-option-index="' + toIndex + '"]'); 8822 const fromOutput = document.querySelector('span[data-output="left"]'); 8823 const toOutput = document.querySelector('span[data-output="right"]'); 8824 8825 if (fromOption && fromOutput) { 8826 fromOutput.textContent = fromOption.textContent 8827 } 8828 8829 if (toOption && toOutput) { 8830 toOutput.textContent = toOption.textContent 8831 } 8832 } 8833 8834 // ------------------------------------------------- 8835 8836 var tags = {}; 8837 8838 tags.selectors = {}; 8839 8840 tags.selectors.getSingleselectorOptionTag = function(optionId) 8841 { 8842 return '[id="singleselector-option-tag-'+optionId+'"]'; 8843 }; 8844 8845 tags.selectors.getSingleselectorTagPrototype = function() 8846 { 8847 return '[id="listfilter-singleselector-tag-prototype"]'; 8848 }; 8849 8850 tags.selectors.getRangeselectorTagPrototype = function() 8851 { 8852 return '[id="listfilter-rangeselector-tag-prototype"]'; 8853 }; 8854 8855 tags.selectors.getSingleselectorTagLabel = function() 8856 { 8857 return '[data-type="listfilter-singleselector-tag-label"]'; 8858 }; 8859 8860 tags.selectors.getSingleselectorTagClose = function() 8861 { 8862 return '[data-type="listfilter-singleselector-tag-close"]'; 8863 }; 8864 8865 tags.selectors.getRangeselectorTagClose = function() 8866 { 8867 return '[data-type="listfilter-rangeselector-tag-close"]'; 8868 }; 8869 8870 tags.selectors.getRangeselectorTagCloseBySelectorId = function(selectorId) 8871 { 8872 return '[data-selector-id="'+selectorId+'"]'+tags.selectors.getRangeselectorTagClose()+''; 8873 }; 8874 8875 tags.selectors.getSelectedTagsContainer = function() 8876 { 8877 return '[id="listfilter-tags-selected-container"]'; 8878 }; 8879 8880 tags.selectors.getSingleselectorTagCloseByOptionId = function(optionId) 8881 { 8882 return '[data-option-id="'+optionId+'"]'+tags.selectors.getSingleselectorTagClose()+''; 8883 }; 8884 8885 tags.selectors.getRangeselectorTagBySelectorId = function(selectorId) 8886 { 8887 return '[id="rangeselector-options-tag-'+selectorId+'"]'; 8888 }; 8889 8890 tags.selectors.getRangeselectorTagLabelMin = function() 8891 { 8892 return '[data-type="listfilter-rangeselector-tag-label-min"]'; 8893 }; 8894 8895 tags.selectors.getRangeselectorTagLabelMax = function() 8896 { 8897 return '[data-type="listfilter-rangeselector-tag-label-max"]'; 8898 }; 8899 8900 tags.showTag = function(elem) 8901 { 8902 dom.showInline(elem); 8903 }; 8904 8905 tags._bubbleUpSvgToNodeWithAttribute = function(node, attrKey){ 8906 // svg/path bubble up 8907 while(node.tagName === 'svg' || node.tagName === 'path'){ 8908 node = node.parentNode; 8909 8910 if(node.hasAttribute(attrKey)){ 8911 break; 8912 } 8913 } 8914 8915 while(!node.hasAttribute(attrKey)){ 8916 node = node.parentNode; 8917 } 8918 8919 if(node.hasAttribute(attrKey)){ 8920 return node; 8921 } 8922 8923 return null; 8924 }; 8925 8926 tags.addSingle = function(optionId, option) 8927 { 8928 var tagNode = dom.toObject(tags.selectors.getSingleselectorOptionTag(optionId)); 8929 8930 if(!tagNode){ 8931 var tagNodeProto = dom.toObject(tags.selectors.getSingleselectorTagPrototype()); 8932 8933 if(tagNodeProto){ 8934 var cloneDeep = true; 8935 var newTagNode = tagNodeProto.cloneNode(cloneDeep); 8936 newTagNode.setAttribute('id', 'singleselector-option-tag-'+optionId); 8937 var newTagLabelNode = newTagNode.querySelector(tags.selectors.getSingleselectorTagLabel()); 8938 var newTagCloseNode = newTagNode.querySelector(tags.selectors.getSingleselectorTagClose()); 8939 newTagCloseNode.setAttribute('data-option-id', optionId); 8940 8941 if(newTagLabelNode){ 8942 newTagLabelNode.textContent = option.textContent; 8943 } 8944 8945 var tagsContainer = dom.toObject(tags.selectors.getSelectedTagsContainer()); 8946 8947 if(tagsContainer){ 8948 tagsContainer.appendChild(newTagNode); 8949 tags.showTag(newTagNode); 8950 8951 dom.listenTo(tags.selectors.getSingleselectorTagCloseByOptionId(optionId), function(evt){ 8952 var node = evt.target; 8953 node = tags._bubbleUpSvgToNodeWithAttribute(node, 'data-option-id'); 8954 8955 if(node !== null){ 8956 var optionId = node.getAttribute('data-option-id'); 8957 8958 dom.forEvery(filter.selectors.getOptionByOptionId(optionId), function(option){ 8959 option.click(); // disable by click 8960 }); 8961 } 8962 }); 8963 } 8964 } 8965 } 8966 }; 8967 8968 tags.removeSingle = function(optionId) 8969 { 8970 var tagsContainer = dom.toObject(tags.selectors.getSelectedTagsContainer()); 8971 8972 if(tagsContainer){ 8973 var tagNode = dom.toObject(tags.selectors.getSingleselectorOptionTag(optionId)); 8974 8975 if(tagNode){ 8976 tagsContainer.removeChild(tagNode); 8977 } 8978 } 8979 }; 8980 8981 tags.addEmptyRange = function(selectorId) 8982 { 8983 var tagNode = dom.toObject(tags.selectors.getRangeselectorTagBySelectorId(selectorId)); 8984 8985 if(!tagNode){ 8986 var tagNodeProto = dom.toObject(tags.selectors.getRangeselectorTagPrototype()); 8987 8988 if(tagNodeProto){ 8989 var cloneDeep = true; 8990 var newTagNode = tagNodeProto.cloneNode(cloneDeep); 8991 newTagNode.setAttribute('id', 'rangeselector-options-tag-'+selectorId); 8992 var newTagCloseNode = newTagNode.querySelector(tags.selectors.getRangeselectorTagClose()); 8993 newTagCloseNode.setAttribute('data-selector-id', selectorId); 8994 8995 var tagsContainer = dom.toObject(tags.selectors.getSelectedTagsContainer()); 8996 8997 if(tagsContainer){ 8998 tagsContainer.appendChild(newTagNode); 8999 tags.showTag(newTagNode); 9000 9001 dom.listenTo(tags.selectors.getRangeselectorTagCloseBySelectorId(selectorId), function(evt){ 9002 var node = evt.target; 9003 node = tags._bubbleUpSvgToNodeWithAttribute(node, 'data-selector-id'); 9004 9005 if(node !== null){ 9006 var selectorId = node.getAttribute('data-selector-id'); 9007 9008 rangeselector.resetBySelectorId(selectorId); 9009 prettyrangeselector.resetBySelectorId(selectorId); 9010
9011 filter.update(); 9012 } 9013 }); 9014 } 9015 } 9016 } 9017 }; 9018 9019 tags.setRangeMin = function(selectorId, optionId, option) 9020 { 9021 // self.log.writeln('setRangeMin '+selectorId); 9022 9023 if(!option){ 9024 return; 9025 } 9026 9027 tags.addEmptyRange(selectorId); 9028 var tagNode = dom.toObject(tags.selectors.getRangeselectorTagBySelectorId(selectorId)); 9029 9030 if(tagNode){ 9031 var labelNode = tagNode.querySelector(tags.selectors.getRangeselectorTagLabelMin()); 9032 9033 if(labelNode){ 9034 labelNode.textContent = option.textContent; 9035 } 9036 } 9037 }; 9038 9039 tags.setRangeMax = function(selectorId, optionId, option) 9040 { 9041 // self.log.writeln('setRangeMax '+selectorId); 9042 9043 if(!option){ 9044 return; 9045 } 9046 9047 tags.addEmptyRange(selectorId); 9048 var tagNode = dom.toObject(tags.selectors.getRangeselectorTagBySelectorId(selectorId)); 9049 9050 if(tagNode){ 9051 var labelNode = tagNode.querySelector(tags.selectors.getRangeselectorTagLabelMax()); 9052 9053 if(labelNode){ 9054 labelNode.textContent = option.textContent; 9055 } 9056 } 9057 }; 9058 9059 tags.removeRange = function(selectorId) 9060 { 9061 var tagsContainer = dom.toObject(tags.selectors.getSelectedTagsContainer()); 9062 9063 if(tagsContainer){ 9064 var tagNode = dom.toObject(tags.selectors.getRangeselectorTagBySelectorId(selectorId)); 9065 9066 if(tagNode){ 9067 tagsContainer.removeChild(tagNode); 9068 } 9069 } 9070 }; 9071 9072 // tags.count = function(){ 9073 // var tagsContainer = dom.toObject(tags.selectors.getSelectedTagsContainer()); 9074 9075 // if(tagsContainer){ 9076 // tagsContainer.childElementCount; 9077 // } 9078 9079 // return 0; 9080 // }; 9081 9082 // ------------------------------------------------- 9083 9084 filter.setup = function() 9085 { 9086 /** 9087 * Selectorboxen einblenden 9088 */ 9089 dom.forEvery(filter.selectors.getFormContainer(), function(elem){ 9090 dom.show(elem); 9091 }); 9092 9093 /** 9094 * bei Klick auf eine Selectorbox die Optionen ausklappen/einklappen 9095 */ 9096 dom.listenTo(singleselector.selectors.getLabels(), function(evt){ 9097 var elem = evt.target; 9098 var optionsContainerId = elem.getAttribute('id') + '-options'; 9099 var optionsContainer = dom.toObject(optionsContainerId); 9100 var optionsContainerActive = optionsContainer.getAttribute('data-active'); 9101 9102 filter.hideAllSelectors(); 9103 9104 if(optionsContainerActive === "0"){ 9105 optionsContainer.setAttribute('data-active', '1'); 9106 dom.show(optionsContainer); 9107 elem.setAttribute('data-active', '1'); 9108 9109 } else { 9110 optionsContainer.setAttribute('data-active', '0'); 9111 dom.hide(optionsContainer); 9112 elem.setAttribute('data-active', '0'); 9113 } 9114 }); 9115 9116 /** 9117 * bei Klick auf eine Singleselector-Option: 9118 * - [1] Option aktualisieren 9119 * - [2] Cache aktualisieren 9120 * - [3] Tags aktualisieren 9121 * - [4] den restlichen Filter mit Ergebnissen aktualisieren 9122 * - [5] Reset-Button einblenden 9123 */ 9124 dom.listenTo(singleselector.selectors.getClickableOptions(), function(evt){ 9125 var option = evt.target; 9126 var selected = option.getAttribute('data-selected'); 9127 var selectable = option.getAttribute('data-selectable'); 9128 var optionId = option.getAttribute('data-option-id'); 9129 var optionIndex = option.getAttribute('data-option-index'); 9130 var selectorName = option.getAttribute('data-selector-name'); 9131 var selectorId = option.getAttribute('data-selector-id'); 9132 9133 // selektierbare Option? 9134 if(selectable === "1"){ 9135 if(selected === "0"){ // wenn vorher nicht selektiert, dann jetzt selektieren 9136 // - [1] Option aktualisieren 9137 option.setAttribute('data-selected', '1'); 9138 option.addClass('selected-option'); 9139 //self.log.writeln('memorize ['+selectorName+']['+optionIndex+']'); 9140 // - [2] Cache aktualisieren 9141 storage.putItem(optionId, 1); 9142 // - [3] Tags aktualisieren 9143 tags.addSingle(optionId, option); 9144 9145 } else { // wenn vorher selektiert, dann jetzt abwählen 9146 // - [1] Option aktualisieren 9147 option.setAttribute('data-selected', '0'); 9148 option.removeClass('selected-option'); 9149 // - [2] Cache aktualisieren 9150 if(storage.hasItem(optionId)){ 9151 //self.log.writeln('forget ['+selectorName+']['+optionIndex+']'); 9152 storage.removeItem(optionId); 9153 } 9154 // - [3] Tags aktualisieren 9155 tags.removeSingle(optionId); 9156 } 9157 } 9158 // - [4] den restlichen Filter mit Ergebnissen aktualisieren 9159 filter.update(selectorId); 9160 // - [5] Reset-Button einblenden 9161 // dom.show(filter.selectors.getResetButton()); 9162 }); 9163 9164 /** 9165 * Bei Bewegen eines Range-Selektors: 9166 * - [1] gewählte Optionen from/to einblenden 9167 * - [2] Optionen aktualisieren
9168 * - [3] Cache aktualisieren 9169 * - [4] Tags aktualisieren 9170 * - [5] den restlichen Filter mit Ergebnissen aktualisieren 9171 * - [6] Reset-Button einblenden 9172 * - [7] Pretty-Range-Selector aktualisieren 9173 */ 9174 dom.listenTo(rangeselector.selectors.getRangeSliders(), function(evt){ 9175 var elem = evt.target; 9176 var selectorName = elem.getAttribute('data-selector-name'); 9177 var selectorId = elem.getAttribute('data-selector-id'); 9178 9179 var fromSlider = dom.toObject(rangeselector.selectors.getRangeFromSliderBySelectorName(selectorName)); 9180 var toSlider = dom.toObject(rangeselector.selectors.getRangeToSliderBySelectorName(selectorName)); 9181 9182 var fromIndex = parseInt(fromSlider.value); 9183 var toIndex = parseInt(toSlider.value); 9184 9185 // [ to, from ] 9186 if(toIndex < fromIndex){ 9187 var _fromIndex = fromIndex; 9188 fromIndex = toIndex; 9189 toIndex = _fromIndex; 9190 // [ from, to ] 9191 } 9192 9193 var normFromIndex = fromIndex - 1; 9194 var normToIndex = toIndex - 1; 9195 9196 // self.log.writeln('selected index range ['+normFromIndex+'..'+normToIndex+']'); 9197 9198 // - [1] gewählte Optionen from/to einblenden 9199 dom.forEvery(rangeselector.selectors.getSelectedOptionsBySelectorId(selectorId), function(rangeSelectorSelectedOption){ 9200 dom.hide(rangeSelectorSelectedOption); 9201 var optionIndex = parseInt(rangeSelectorSelectedOption.getAttribute('data-option-index')); 9202 9203 if(normFromIndex == optionIndex || optionIndex == normToIndex){ 9204 rangeselector.showOption(rangeSelectorSelectedOption); 9205 } 9206 }); 9207 9208 dom.forEvery(filter.selectors.getOptionsBySelectorId(selectorId), function(option){ 9209 var optionId = option.getAttribute('data-option-id'); 9210 var optionIndex = parseInt(option.getAttribute('data-option-index')); 9211 var selectable = parseInt(option.getAttribute('data-selectable')); 9212 // var attributeValue = option.textContent; 9213 9214 // self.log.writeln('visit option ['+optionIndex+']: selectable ['+selectable+']'); 9215 9216 if(selectable === 1){ 9217 if(normFromIndex <= optionIndex && optionIndex <= normToIndex){ 9218 // self.log.writeln('select option ['+optionIndex+']'); 9219 9220 // - [2] Optionen aktualisieren 9221 option.setAttribute('data-selected', 1); 9222 //self.log.writeln('memorize ['+selectorName+']['+optionIndex+']'); 9223 // - [3] Cache aktualisieren 9224 storage.putItem(optionId, 1); 9225 // - [4] Tags aktualisieren 9226 if(optionIndex === normFromIndex){ 9227 tags.setRangeMin(selectorId, optionId, option); 9228 } 9229 if(optionIndex === normToIndex){ 9230 tags.setRangeMax(selectorId, optionId, option); 9231 } 9232 9233 } else { 9234 // self.log.writeln('unselect option ['+optionIndex+']'); 9235 9236 // - [2] Optionen aktualisieren 9237 option.setAttribute('data-selected', 0); 9238 // - [3] Cache aktualisieren 9239 if(storage.hasItem(optionId)){ 9240 //self.log.writeln('forget ['+selectorName+']['+optionIndex+']'); 9241 storage.removeItem(optionId); 9242 } 9243 // - [4] Tags aktualisieren 9244 // nur oben für gewählte Range 9245 } 9246 } 9247 }); 9248 9249 // - [5] den restlichen Filter mit Ergebnissen aktualisieren 9250 filter.update(selectorId); 9251 // - [6] Reset-Button einblenden 9252 // dom.show(filter.selectors.getResetButton()); 9253 // - [7] Pretty-Range-Selector aktualisieren 9254 prettyrangeselector.updateBySelectorName(selectorName, fromIndex, toIndex); 9255 prettyrangeselector.updateThumbs(fromIndex - 1, toIndex - 1); 9256 }); 9257 9258 dom.listenTo(filter.selectors.getResetButton(), function(evt){ 9259 filter.reset(); 9260 }); 9261 9262 filter.restore(); 9263 }; 9264 9265 filter.restore = function() 9266 { 9267 //self.log.writeln('restore filter ...'); 9268 9269 // für jede gemerkte Option aus dem Cache, den Klick im Singleselector manuell erneut ausführen 9270 dom.forEvery(singleselector.selectors.getClickableOptions(), function(option){ 9271 var optionIndex = option.getAttribute('data-option-index'); 9272 var selectorName = option.getAttribute('data-selector-name'); 9273 var optionId = option.getAttribute('data-option-id'); 9274 9275 if(storage.hasItem(optionId)){ 9276 //self.log.writeln('restore selectbox ['+selectorName+']['+optionIndex+']'); 9277 option.click(); 9278 } 9279 }); 9280 9281 // alle from/to Option-Werte ausblenden 9282 dom.forEvery(rangeselector.selectors.getAllSelectedOptions(), function(rangeSelectorSelectedOption){ 9283 dom.hide(rangeSelectorSelectedOption); 9284 }); 9285 9286 dom.forEvery(rangeselector.selectors.getRangeSliders(), function(elem){ 9287 // TODO: optimize, will run two times 9288 9289 var selectorName = elem.getAttribute('data-selector-name'); 9290 var selectorId = elem.getAttribute('data-selector-id'); 9291 var options = rangeselector.getOptionsBySelectorName(selectorName); 9292 var fromSlider = dom.toObject(rangeselector.selectors.getRangeFromSliderBySelectorName(selectorName)); 9293 var toSlider = dom.toObject(rangeselector.selectors.getRangeToSli
9293derBySelectorName(selectorName)); 9294 9295 var fromSliderValue = null; 9296 var toSliderValue = null; 9297 9298 var fromOptionId = null; 9299 var toOptionId = null; 9300 9301 var fromOption = null; 9302 var toOption = null; 9303 9304 // alle from/to Option-Werte dieses Range-Selektors ausblenden 9305 dom.forEvery(rangeselector.selectors.getSelectedOptionsBySelectorId(selectorId), function(rangeSelectorSelectedOption){ 9306 dom.hide(rangeSelectorSelectedOption); 9307 }); 9308 9309 // jede Option dieses Selektors durchlaufen: 9310 for(var i = 0; i < options.length; ++i){ 9311 var option = options[i]; 9312 var optionIndex = parseInt(option.getAttribute('data-option-index')); 9313 var optionId = option.getAttribute('data-option-id'); 9314 9315 // ist die Option im Cache 9316 if(storage.hasItem(optionId)){ 9317 // markiere Option als selektiert 9318 option.setAttribute('data-selected', '1'); 9319 // setze Range-Start (from) abhängig vom Cache-Wert 9320 if(fromSliderValue === null){ 9321 fromSliderValue = optionIndex + 1; 9322 fromOptionId = optionId; 9323 fromOption = option; 9324 } 9325 // setze Range-Ende (to) abhängig vom Cache-Wert 9326 toSliderValue = optionIndex + 1; 9327 toOptionId = optionId; 9328 toOption = option; 9329 9330 } else { 9331 // wenn Option nicht im Cache -> deselektieren 9332 option.setAttribute('data-selected', '0'); 9333 } 9334 } 9335 9336 if(fromSliderValue === null){ 9337 fromSliderValue = 1; 9338 toSliderValue = options.length; 9339 } 9340 9341 //self.log.writeln('set range slider ['+selectorName+'][from] = '+fromSliderValue+''); 9342 // bewege Slider manuell auf Range-Start 9343 fromSlider.value = fromSliderValue; 9344 9345 if(fromOptionId){ 9346 // aktualisiere Tag-Min auf Range-Start 9347 tags.setRangeMin(selectorId, fromOptionId, fromOption); 9348 9349 // Range-Start (from) als Wert einblenden 9350 dom.forEvery(rangeselector.selectors.getSelectedOptionByOptionId(fromOptionId), function(rangeSelectorSelectedOption){ 9351 rangeselector.showOption(rangeSelectorSelectedOption); 9352 }); 9353 } 9354 9355 //self.log.writeln('set range slider ['+selectorName+'][to] = '+toSliderValue+''); 9356 // bewege Slider manuell auf Range-Ende 9357 toSlider.value = toSliderValue; 9358 9359 if(toOptionId){ 9360 // aktualisiere Tag-Max auf Range-Ende 9361 tags.setRangeMax(selectorId, toOptionId, toOption); 9362 9363 // Range-Ende (to) als Wert einblenden 9364 dom.forEvery(rangeselector.selectors.getSelectedOptionByOptionId(toOptionId), function(rangeSelectorSelectedOption){ 9365 rangeselector.showOption(rangeSelectorSelectedOption); 9366 }); 9367 } 9368 9369 // Pretty-Range-Selektor aktualisieren mit Range (from/to) 9370 prettyrangeselector.updateBySelectorName(selectorName, fromSliderValue, toSliderValue); 9371 prettyrangeselector.updateThumbs(fromSliderValue - 1, toSliderValue - 1); 9372 }); 9373 9374 filter.update(); 9375 }; 9376 9377 filter.reset = function() 9378 { 9379 //self.log.writeln('reset filter ...'); 9380 9381 dom.hide(filter.selectors.getResetButton()); 9382 9383 /** 9384 * alle klickbaren Optionen vergessen und deselektieren 9385 */ 9386 dom.forEvery(singleselector.selectors.getClickableOptions(), function(option){ 9387 var optionIndex = option.getAttribute('data-option-index'); 9388 var selectorName = option.getAttribute('data-selector-name'); 9389 var optionId = option.getAttribute('data-option-id'); 9390 9391 option.setAttribute('data-selected', '0'); 9392 option.removeClass('selected-option'); 9393 9394 if(storage.hasItem(optionId)){ 9395 //self.log.writeln('forget ['+selectorName+']['+optionIndex+']'); 9396 storage.removeItem(optionId); 9397 } 9398 9399 tags.removeSingle(optionId); 9400 }); 9401 9402 // alle from/to Option-Werte ausblenden 9403 dom.forEvery(rangeselector.selectors.getAllSelectedOptions(), function(rangeSelectorSelectedOption){ 9404 dom.hide(rangeSelectorSelectedOption); 9405 }); 9406 9407 /** 9408 * alle Range-Slider zurücksetzen 9409 */ 9410 dom.forEvery(rangeselector.selectors.getRangeSliders(), function(elem){ 9411 var selectorId = elem.getAttribute('data-selector-id'); 9412 rangeselector.resetBySelectorId(selectorId); 9413 prettyrangeselector.resetBySelectorId(selectorId); 9414 }); 9415 9416 /** 9417 * alle Selektoren einklappen 9418 */ 9419 dom.forEvery(singleselector.selectors.getLabels(), function(elem){ 9420 var optionsContainerId = elem.getAttribute('id') + '-options'; 9421 //self.log.writeln('hide options container '+optionsContainerId); 9422 var optionsContainer = dom.toObject(optionsContainerId); 9423 optionsContainer.setAttribute('data-active', '0'); 9424 dom.hide(optionsContainer); 9425 elem.setAttribute('data-active', '0'); 9426 }); 9427
9428 filter.update(); 9429 }; 9430 9431 /** 9432 * update wird pro Klick auf eine Selectbox-Option aufgerufen und aktualisiert die 9433 * wählbaren Optionen und die Ergebnisliste der Baureihen. 9434 */ 9435 filter.update = function(skipSelectorId) 9436 { 9437 //self.log.writeln('update filter ...'); 9438 9439 // selector für eine spezielle Baureihe (eine Kachel) 9440 // data-listfilter-modelrange="{modelRange.uid}" 9441 9442 var map = new Map(); 9443 9444 /** 9445 * für jede selektierte Option wird die dazu passende Liste von 9446 * Baureihen in einer Map gesammelt (Vereinigung). selectorBoxName:string -> ModelRanges:List 9447 * 9448 * selectorBox_1 -> [1234,1324,1234,1234,12435,2345] 9449 * selectorBox_2 -> [1234,1324,1234,1234] 9450 * selectorBox_3 -> [1234,1324,1234] 9451 * selectorBox_4 -> [1234,1324,12435,2345] 9452 */ 9453 dom.forEvery(filter.selectors.getSelectableAndSelectedOptions(), function(option){ 9454 var modelRangesStr = option.getAttribute('data-related-modelranges'); 9455 var modelRanges = modelRangesStr.split(','); 9456 var selectorId = option.getAttribute('data-selector-id'); 9457 9458 // erzeuge Vereinigung aller ModelRangeUids für einen Selector 9459 9460 var values = map.has(selectorId) ? map.get(selectorId) : []; 9461 9462 for(var i = 0; i < modelRanges.length; ++i){ 9463 var modelRange = modelRanges[i]; 9464 9465 if(values.indexOf(modelRange) === -1){ 9466 values.push(modelRange); 9467 } 9468 } 9469 9470 map.set(selectorId, values); 9471 }); 9472 9473 /** 9474 * die Ergebnismenge der Kacheln über den Schnitt aller Baureihen bilden: 9475 * 9476 * selectorBox_1 -> [1234,1324,1234,1234,12435,2345] 9477 * selectorBox_2 -> [1234,1324,1234,1234] 9478 * selectorBox_3 -> [1234,1324,1234] 9479 * selectorBox_4 -> [1234,1324,12435,2345] 9480 * ============================================== DIFF 9481 * => [1234,1324] 9482 */ 9483 var result = []; 9484 9485 map.forEach(function(values, selectorId, map){ 9486 if(result.length === 0){ 9487 for(var j = 0; j < values.length; ++j){ 9488 result.push(values[j]); 9489 } 9490 } else { 9491 result = arrays.intersect(result, values); 9492 } 9493 }); 9494 9495 // result enthaelt alle gefundenen ModelRanges 9496 9497 //self.log.writeln('result model ranges:'); 9498 //self.log.writeln(result); 9499 9500 /** 9501 * erstmal alle Kacheln ausblenden und dann die gefundenen 9502 * Baureihen wieder einzeln einblenden 9503 */ 9504 dom.forEvery(filter.selectors.getModelRangeTiles(), function(elem){ 9505 dom.hide(elem); 9506 }); 9507 9508 /** 9509 * nur die gefundenen Kacheln einblenden 9510 */ 9511 for(var i = 0; i < result.length; ++i){ 9512 var modelRange = result[i]; 9513 9514 dom.forEvery(filter.selectors.getModelRangeTile(modelRange), function(elem){ 9515 dom.show(elem); 9516 }); 9517 } 9518 9519 /** 9520 * wenn es mindestens eine gewählte Option gibt, dann alle 9521 * Filteroptionen aktualisieren, ob diese noch gewählt werden können (Ergebnismenge.length > 0). 9522 */ 9523 if(dom.hasAny(filter.selectors.getSelectableAndSelectedOptions())){ 9524 dom.show(filter.selectors.getResetButton()); 9525 9526 dom.forEvery(filter.selectors.getOption(), function(option){ 9527 var selectorId = option.getAttribute('data-selector-id'); 9528 var selectorName = option.getAttribute('data-selector-name'); 9529 9530 if(!skipSelectorId || skipSelectorId !== selectorId){ 9531 var modelRangesStr = option.getAttribute('data-related-modelranges'); 9532 var modelRanges = modelRangesStr.split(','); 9533 var intersection = arrays.intersect(modelRanges, result); 9534 9535 // führt zu einer leeren Ergebnismenge, als nicht wählbar 9536 if(intersection.length === 0){ 9537 option.setAttribute('data-selectable', '0'); 9538 dom.lowerOpacity(option); 9539 9540 } else { // wählbar, weil es noch Ergebnisse gibt 9541 option.setAttribute('data-selectable', '1'); 9542 dom.raiseOpacity(option); 9543 } 9544 } else { 9545 //self.log.writeln('skip updating selector ['+selectorName+']'); 9546 } 9547 }); 9548 9549 } else { 9550 // der Filter hat keine gewählte Option, also alle Optionen 9551 // wählbar machen 9552 dom.forEvery(filter.selectors.getOption(), function(option){ 9553 option.setAttribute('data-selectable', '1'); 9554 dom.raiseOpacity(option); 9555 }); 9556 9557 // und alle Kacheln sichtbar machen 9558 dom.forEvery(filter.selectors.getModelRangeTiles(), function(option){ 9559 dom.show(option); 9560 }); 9561 9562 dom.hide(filter.selectors.getResetButton()); 9563 } 9564 9565 return result; 9566 }; 9567 9568 // ------------------------------------------------- 9569 9570 self.checkCompat = function() 9571 { 9572 //self.log.writeln('check compatibility ...'); 9573 9574 var productlistVersionElem = dom.toObject('#template-productlist-version'); 9575 var listfilterVersionElem = dom.toObject('#partial-listfilter-version'); 9576 9577 if(!productlistVersionElem){ 9578 throw new Error('could not get productlist version'); 9579 } 9580 9581 if(!listfilterVersionElem){ 9582 throw new Error('could not get listfilter version'); 9583 } 9584 9585 var productlistVersion = productlistVersionElem.getAttribute('data-version'); 9586 var listfilterVersion = listfilterVersionElem.getAttribute('data-version'); 9587 9588 if(self.compatProductlist().indexOf(productlistVersion) === -1){ 9589 throw new Error('not compatible with productlist template version v'+productlistVersion); 9590 } 9591 if(self.compatListfilter().indexOf(listfilterVersion) === -1){ 9592 throw new Error('not compatible with listfilter partial version v'+listfilterVersion); 9593 } 9594 9595 //self.log.writeln('-> compatibility okay'); 9596 }; 9597 9598 self.enabled = function() 9599 { 9600 if(dom.hasAny(filter.selectors.getFormContainer())){ 9601 return true; 9602 } 9603 return false;
9604 }; 9605 9606 self.setup = function() 9607 { 9608 self.checkCompat(); 9609 filter.setup(); 9610 9611 return self; 9612 }; 9613 9614})(this.listfilter); 9615 9616document.addEventListener("DOMContentLoaded", function(event){ 9617 if(!window.listfilter.enabled()){ 9618 return; 9619 } 9620 try { 9621 window.listfilter.setup(); 9622 window.listfilter.log.writeln(window.listfilter.info()+' successfully loaded.'); 9623 } catch(ex){ 9624 window.listfilter.error.writeln(window.listfilter.info()+' failed to load!'); 9625 window.listfilter.error.writeln(ex); 9626 } 9627}); 9628 9629let customSelectElement = {}; 9630 9631(function (self) { 9632 9633 /** 9634 * All needed selectors. 9635 * 9636 * @private 9637 */ 9638 let _selectors = { 9639 container: '.custom-select', 9640 input: '.select-value', 9641 select: '.select-container', 9642 selectLabel: '.select-label', 9643 optionsContainer: '.select-options', 9644 option: '.select-option', 9645 } 9646 9647 /** 9648 * Add a css class to a dom element. 9649 * 9650 * @param {HTMLElement} element The html element. 9651 * @param {string} className The name of the class. 9652 * @private 9653 */ 9654 function _addDomClass(element, className) { 9655 if (className.substr(0, 1) === '.') { 9656 className = className.substr(1) 9657 } 9658 9659 if (!element.classList.contains(className)) { 9660 element.classList.add(className) 9661 } 9662 } 9663 9664 /** 9665 * Remove a css class from a dom element. 9666 * 9667 * @param {HTMLElement} element The html element. 9668 * @param {string} className The name of the class. 9669 * @private 9670 */ 9671 function _removeDomClass(element, className) { 9672 if (className.substr(0, 1) === '.') { 9673 className = className.substr(1) 9674 } 9675 9676 if (element.classList.contains(className)) { 9677 element.classList.remove(className) 9678 } 9679 } 9680 9681 /** 9682 * Toggle a css class from a dom element. 9683 * 9684 * @param {HTMLElement} element The html element. 9685 * @param {string} className The name of the class. 9686 * @private 9687 */ 9688 function _toggleDomClass(element, className) { 9689 if (className.substr(0, 1) === '.') { 9690 className = className.substr(1) 9691 } 9692 9693 let functionName = element.classList.contains(className) ? _removeDomClass : _addDomClass 9694 functionName(element, className) 9695 } 9696 9697 /** 9698 * Get the parent element with the given class. 9699 * 9700 * @param {HTMLElement} element 9701 * @param {string} className 9702 * @returns {HTMLElement} 9703 * @private 9704 */ 9705 function _getParentWithClass (element, className) { 9706 if (className.substr(0, 1) === '.') { 9707 className = className.substr(1) 9708 } 9709 9710 while ((element = element.parentElement) && !(element.classList.contains(className))) { 9711 // Nothing inside. 9712 } 9713 9714 return element 9715 } 9716 9717 /** 9718 * Get the root element of this custom select element. 9719 * 9720 * @param {HTMLElement} element 9721 * @returns {HTMLElement} 9722 * @private 9723 */ 9724 function _getElementRoot (element) { 9725 return _getParentWithClass(element, _selectors.container) 9726 } 9727 9728 /** 9729 * Close a select element. 9730 * 9731 * @param {HTMLElement|Element} element 9732 * @private 9733 */ 9734 function _closeSelect(element) { 9735 let selectElement = _getParentWithClass(element, _selectors.select), 9736 root = _getElementRoot(element), 9737 optionsContainer = selectElement.querySelector(_selectors.optionsContainer) 9738 9739 _addDomClass(optionsContainer, 'hidden') 9740 root.setAttribute('data-open', '0') 9741 } 9742 9743 /** 9744 * @param {Event} event 9745 * @private 9746 */ 9747 function _toggleSelect (event) { 9748 let selectElement = _getParentWithClass(this, _selectors.select), 9749 root = _getElementRoot(this), 9750 optionsContainer = selectElement.querySelector(_selectors.optionsContainer), 9751 closing = !optionsContainer.classList.contains('hidden'), 9752 allSelectElements = document.querySelectorAll(_selectors.optionsContainer), 9753 allSelectElementLength = allSelectElements.length 9754 9755 // if(selectElement.hasAttribute('data-disabled')){ 9756 // return; 9757 // } 9758 9759 for (let i = 0; i < allSelectElementLength; i += 1) { 9760 _closeSelect(allSelectElements[i]) 9761 } 9762 9763 if (!closing) { 9764 _toggleDomClass(optionsContainer, 'hidden') 9765 } 9766 9767 root.setAttribute('data-open', closing ? '0' : '1') 9768 9769 if (this.classList.contains('select-option')) { 9770 _changeValue(this) 9771 } 9772 } 9773 9774 /** 9775 * @param {HTMLElement} option 9776 * @private 9777 */ 9778 function _changeValue(option) { 9779 let root = _getElementRoot(option), 9780 input = root.querySelector(_selectors.input), 9781 labelElement = root.querySelector(_selectors.selectLabel), 9782 value = option.getAttribute('data-value').trim(), 9783 label = option.innerText.trim() 9784 9785 input.setAttribute('value', value) 9786 labelElement.innerText = label 9787 } 9788 9789 /** 9790 * Initiate all event listeners. 9791 * 9792 * @private 9793 */ 9794 function _initEventListeners () { 9795 let selects = document.querySelectorAll(_selectors.selectLabel), 9796 options = document.querySelectorAll(_selectors.option), 9797 selectLength = selects.length, 9798 optionLength = options.length 9799 9800 for (let i = 0; i < selectLength; i += 1) { 9801 selects[i].addEventListener('click', _toggleSelect) 9802 } 9803 9804 for (let i = 0; i < optionLength; i += 1) { 9805 options[i].addEventListener('click', _toggleSelect) 9806 } 9807 } 9808 9809 /** 9810 * Initiate the custom select element. 9811 */ 9812 self.init = function () { 9813 _initEventListeners() 9814 } 9815 9816 /** 9817 * @see _closeSelect 9818 */ 9819 self.closeSelect = _closeSelect 9820 9821})(customSelectElement) 9822 9823window.addEventListener('DOMContentLoaded', function () { 9824 customSelectElement.init() 9825}) 9826 9827function r(n,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(n,r.key,r)}}
9827function Jt(n,t,i){t&&r(n.prototype,t),i&&r(n,i),Object.defineProperty(n,"prototype",{writable:!1})} 9828/*! 9829 * Splide.js 9830 * Version : 4.1.2
vendor: 29,500 bytes, lines 9830-9835
9830 9831 * License : MIT 9832 * Copyright: 2022 Naotoshi Fujita 9833 */ 9834var n,t;n=this,t=function(){"use strict";var v="(prefers-reduced-motion: reduce)",G=4,rn=5,r={CREATED:1,MOUNTED:2,IDLE:3,MOVING:G,SCROLLING:rn,DRAGGING:6,DESTROYED:7};function D(n){n.length=0}function o(n,t,i){return Array.prototype.slice.call(n,t,i)}function R(n){return n.bind.apply(n,[null].concat(o(arguments,1)))}function on(){}var p=setTimeout;function h(n){return requestAnimationFrame(n)}function u(n,t){return typeof t===n}function un(n){return!c(n)&&u("object",n)}var e=Array.isArray,x=R(u,"function"),C=R(u,"string"),en=R(u,"undefined");function c(n){return null===n}function m(n){try{return n instanceof(n.ownerDocument.defaultView||window).HTMLElement}catch(n){return!1}}function y(n){return e(n)?n:[n]}function g(n,t){y(n).forEach(t)}function b(n,t){return-1<n.indexOf(t)}function k(n,t){return n.push.apply(n,y(t)),n}function A(t,n,i){t&&g(n,function(n){n&&t.classList[i?"add":"remove"](n)})}function M(n,t){A(n,C(t)?t.split(" "):t,!0)}function L(n,t){g(t,n.appendChild.bind(n))}function O(n,i){g(n,function(n){var t=(i||n).parentNode;t&&t.insertBefore(n,i)})}function cn(n,t){return m(n)&&(n.msMatchesSelector||n.matches).call(n,t)}function S(n,t){n=n?o(n.children):[];return t?n.filter(function(n){return cn(n,t)}):n}function fn(n,t){return t?S(n,t)[0]:n.firstElementChild}var E=Object.keys;function w(t,i,n){t&&(n?E(t).reverse():E(t)).forEach(function(n){"__proto__"!==n&&i(t[n],n)})}function an(r){return o(arguments,1).forEach(function(i){w(i,function(n,t){r[t]=i[t]})}),r}function d(i){return o(arguments,1).forEach(function(n){w(n,function(n,t){e(n)?i[t]=n.slice():un(n)?i[t]=d({},un(i[t])?i[t]:{},n):i[t]=n})}),i}function sn(t,n){g(n||E(t),function(n){delete t[n]})}function P(n,i){g(n,function(t){g(i,function(n){t&&t.removeAttribute(n)})})}function I(i,t,r){un(t)?w(t,function(n,t){I(i,t,n)}):g(i,function(n){c(r)||""===r?P(n,t):n.setAttribute(t,String(r))})}function j(n,t,i){n=document.createElement(n);return t&&(C(t)?M:I)(n,t),i&&L(i,n),n}function _(n,t,i){if(en(i))return getComputedStyle(n)[t];c(i)||(n.style[t]=""+i)}function ln(n,t){_(n,"display",t)}function dn(n){n.setActive&&n.setActive()||n.focus({preventScroll:!0})}function z(n,t){return n.getAttribute(t)}function vn(n,t){return n&&n.classList.contains(t)}function N(n){return n.getBoundingClientRect()}function T(n){g(n,function(n){n&&n.parentNode&&n.parentNode.removeChild(n)})}function hn(n){return fn((new DOMParser).parseFromString(n,"text/html").body)}function F(n,t){n.preventDefault(),t&&(n.stopPropagation(),n.stopImmediatePropagation())}function pn(n,t){return n&&n.querySelector(t)}function gn(n,t){return t?o(n.querySelectorAll(t)):[]}function X(n,t){A(n,t,!1)}function mn(n){return n.timeStamp}function W(n){return C(n)?n:n?n+"px":""}var yn="splide",f="data-"+yn;function bn(n,t){if(!n)throw new Error("["+yn+"] "+(t||""))}var Y=Math.min,wn=Math.max,xn=Math.floor,kn=Math.ceil,U=Math.abs;function Sn(n,t,i){return U(n-t)<i}function En(n,t,i,r){var o=Y(t,i),t=wn(t,i);return r?o<n&&n<t:o<=n&&n<=t}function q(n,t,i){var r=Y(t,i),t=wn(t,i);return Y(wn(r,n),t)}function Ln(n){return(0<n)-(n<0)}function On(t,n){return g(n,function(n){t=t.replace("%s",""+n)}),t}function An(n){return n<10?"0"+n:""+n}var _n={};function zn(){var c=[];function i(n,i,r){g(n,function(t){t&&g(i,function(n){n.split(" ").forEach(function(n){n=n.split(".");r(t,n[0],n[1])})})})}return{bind:function(n,t,u,e){i(n,t,function(n,t,i){var r="addEventListener"in n,o=r?n.removeEventListener.bind(n,t,u,e):n.removeListener.bind(n,u);r?n.addEventListener(t,u,e):n.addListener(u),c.push([n,t,i,u,o])})},unbind:function(n,t,o){i(n,t,function(t,i,r){c=c.filter(function(n){return!!(n[0]!==t||n[1]!==i||n[2]!==r||o&&n[3]!==o)||(n[4](),!1)})})},dispatch:function(n,t,i){var r;return"function"==typeof CustomEvent?r=new CustomEvent(t,{bubbles:!0,detail:i}):(r=document.createEvent("CustomEvent")).initCustomEvent(t,!0,!1,i),n.dispatchEvent(r),r},destroy:function(){c.forEach(function(n){n[4]()}),D(c)}}}var B="mounted",H="move",Dn="moved",Mn="click",Pn="active",In="inactive",Rn="visible",Cn="hidden",J="refresh",K="updated",jn="resize",Nn="resized",Tn="scroll",V="scrolled",a="destroy",Gn="navigation:mounted",Fn="autoplay:play",Xn="autoplay:pause",Wn="lazyload:loaded",Yn="sk",Un="sh";function Q(n){var i=n?n.event.bus:document.createDocumentFragment(),r=zn();return n&&n.event.on(a,r.destroy),an(r,{bus:i,on:function(n,t){r.bind(i,y(n).join(" "),function(n){t.apply(t,e(n.detail)?n.detail:[])})},off:R(r.unbind,i),emit:function(n){r.dispatch(i,n,o(arguments,1))}})}function qn(t,n,i,r){var o,u,e=Date.now,c=0,f=!0,a=0;function s(){if(!f){if(c=t?Y((e()-o)/t,1):1,i&&i(c),1<=c&&(n(),o=e(),r&&++a>=r))return l();u=h(s)}}function l(){f=!0}function d(){u&&cancelAnimationFrame(u),f=!(u=c=0)}return{start:function(n){n||d(),o=e()-(n?c*t:0),f=!1,u=h(s)},rewind:function(){o=e(),c=0,i&&i(c)},pause:l,cancel:d,set:function(n){t=n},isPaused:function(){return f}}}function s(n){var t=n;return{set:function(n){t=n},is:function(n){return b(y(n),t)}}}var n="Arrow",Bn=n+"Left",Hn=n+"Right",t=n+"Up",n=n+"Down",Jn="ttb",l={width:["height"],left:["top","right"],right:["bottom","left"],x:["y"],X:["Y"],Y:["X"],ArrowLeft:[t,Hn],ArrowRight:[n,Bn]};var Z="role",$="tabindex",i="aria-",Kn=i+"controls",Vn=i+"current",Qn=i+"selected",nn=i+"label",Zn=i+"labelledby",$n=i+"hidden",nt=i+"orientation",tt=i+"roledescription",it=i+"live",rt=i+"busy",ot=i+"atomic",ut=[Z,$,"disabled",Kn,Vn,nn,Zn,$n,nt,tt],i=yn+"__",et=yn,ct=i+"track",ft=i+"list",at=i+"slide",st=at+"--clone",lt=at+"__container",dt=i+"arrows",vt=i+"arrow",ht=vt+"--prev",pt=vt+"--next",gt=i+"pagination",mt=gt+"__page",yt=i+"progress"+"__bar",bt=i+"toggle",wt=i+"sr",tn="is-active",xt="is-prev",kt="is-next",St="is-visible",Et="is-loading",Lt="is-focus-in",Ot="is-overflow",At=[tn,St,xt,kt,Et,Lt,Ot];var _t="touchstart mousedown",zt="touchmove mousemove",Dt="touchend touchcancel mouseup click";var Mt="slide",Pt="loop",It="fade";function Rt(o,r,t,u){var e,n=Q(o),i=n.on,c=n.emit,f=n.bind,a=o.Components,s=o.root,l=o.options,d=l.isNavigation,v=l.updateOnMove,h=l.i18n,p=l.pagination,g=l.slideFocus,m=a.Direction.resolve,y=z(u,"style"),b=z(u,nn),w=-1<t,x=fn(u,"."+lt);function k(){var n=o.splides.map(function(n){n=n.splide.Components.Slides.getAt(r);return n?n.slide.id:""}).join(" ");I(u,nn,On(h.slideX,(w?t:r)+1)),I(u,Kn,n),I(u,Z,g?"button":""),g&&P(u,tt)}function S(){e||E()}function E(){var n,t,i;e||(n=o.index,(i=L())!==vn(u,tn)&&(A(u,tn,i),I(u,Vn,d&&i||""),c(i?Pn:In,O)),i=function(){if(o.is(It))return L();var n=N(a.Elements.track),t=N(u),i=m("left",!0),r=m("right",!0);return xn(n[i])<=kn(t[i])&&xn(t[r])<=kn(n[r])}(),t=!i&&(!L()||w),o.state.is([G,rn])||I(u,$n,t||""),I(gn(u,l.focusableNodes||""),$,t?-1:""),g&&I(u,$,t?-1:0),i!==vn(u,St)&&(A(u,St,i),c(i?Rn:Cn,O)),i||document.activeElement!==u||(t=a.Slides.getAt(o.index))&&dn(t.slide),A(u,xt,r===n-1),A(u,kt,r===n+1))}function L(){var n=o.index;return n===r||l.cloneStatus&&n===t}var O={index:r,slideIndex:t,slide:u,container:x,isClone:w,mount:function(){w||(u.id=s.id+"-slide"+An(r+1),I(u,Z,p?"tabpanel":"group"),I(u,tt,h.slide),I(u,nn,b||On(h.slideLabel,[r+1,o.length]))),f(u,"click",R(c,Mn,O)),f(u,"keydown",R(c,Yn,O)),i([Dn,Un,V],E),i(Gn,k),v&&i(H,S)},destroy:function(){e=!0,n.destroy(),X(u,At),P(u,ut),I(u,"style",y),I(u,nn,b||"")},update:E,style:function(n,t,i){_(i&&x||u,n,t)},isWithin:function(n,t){return n=U(n-r),(n=w||!l.rewind&&!o.is(Pt)?n:Y(n,o.length-n))<=t}};return O}var Ct=f+"-interval";var jt={passive:!1,capture:!0};var Nt={Spacebar:" ",Right:Hn,Left:Bn,Up:t,Down:n};function Tt(n){return n=C(n)?n:n.key,Nt[n]||n}var Gt="keydown";var Ft=f+"-lazy",Xt=Ft+"-srcset",Wt="["+Ft+"], ["+Xt+"]";var Yt=[" ","Enter"];var Ut=Object.freeze({__proto__:null,Media:function(r,n,o){var u=r.state,t=o.breakpoints||{},e=o.reducedMotion||{},i=zn(),c=[];function f(n){n&&i.destroy()}function a(n,t){t=matchMedia(t);i.bind(t,"change",s),c.push([n,t])}function s(){var n=u.is(7),t=o.direction,i=c.reduce(function(n,t){return d(n,t[1].matches?t[0]:{})},{});sn(o),l(i),o.destroy?r.destroy("completely"===o.destroy):n?(f(!0),r.mount()):t!==o.direction&&r.refresh()}function l(n,t,i){d(o,n),t&&d(Object.getPrototypeOf(o),n),!i&&u.is(1)||r.emit(K,o)}return{setup:function(){var i="min"===o.mediaQuery;E(t).sort(function(n,t){return i?+n-+t:+t-+n}).forEach(function(n){a(t[n],"("+(i?"min":"max")+"-width:"+n+"px)")}),a(e,v),s()},destroy:f,reduce:function(n){matchMedia(v).matches&&(n?d(o,e):sn(o,E(e)))},set:l}},Direction:function(n,t,o){return{resolve:function(n,t,i){var r="rtl"!==(i=i||o.direction)||t?i===Jn?0:-1:1;return l[n]&&l[n][r]||n.replace(/width|left|right/i,function(n,t){n=l[n.toLowerCase()][r]||n;return 0<t?n.charAt(0).toUpperCase()+n.slice(1):n})},orient:function(n){return n*("rtl"===o.direction?1:-1)}}},Elements:function(n,t,i){var r,o,u,e=Q(n),c=e.on,f=e.bind,a=n.root,s=i.i18n,l={},d=[],v=[],h=[];function p(){r=y("."+ct),o=fn(r,"."+ft),bn(r&&o,"A track/list element is missing."),k(d,S(o,"."+at+":not(."+st+")")),w({arrows:dt,pagination:gt,prev:ht,next:pt,bar:yt,toggle:bt},function(n,t){l[t]=y("."+n)}),an(l,{root:a,track:r,list:o,slides:d});var n=a.id||function(n){return""+n+An(_n[n]=(_n[n]||0)+1)}(yn),t=i.role;a.id=n,r.id=r.id||n+"-track",o.id=o.id||n+"-list",!z(a,Z)&&"SECTION"!==a.tagName&&t&&I(a,Z,t),I(a,tt,s.carousel),I(o,Z,"presentation"),m()}function g(n){var t=ut.concat("style");D(d),X(a,v),X(r,h),P([r,o],t),P(a,n?t:["style",tt])}function m(){X(a,v),X(r,h),v=b(et),h=b(ct),M(a,v),M(r,h),I(a,nn,i.label),I(a,Zn,i.labelledby)}function y(n){n=pn(a,n);return n&&function(n,t){if(x(n.closest))return n.closest(t);for(var i=n;i&&1===i.nodeType&&!cn(i,t);)i=i.parentElement;return i}(n,"."+et)===a?n:void 0}function b(n){return[n+"--"+i.type,n+"--"+i.direction,i.drag&&n+"--draggable",i.isNavigation&&n+"--nav",n===et&&tn]}return an(l,{setup:p,mount:function(){c(J,g),c(J,p),c(K,m),f(document,_t+" keydown",function(n){u="keydown"===n.type},{capture:!0}),f(a,"focusin",function(){A(a,Lt,!!u)})},destroy:g})},Slides:function(r,o,u){var n=Q(r),t=n.on,e=n.emit,c=n.bind,f=(n=o.Elements).slides,a=n.list,s=[];function i(){f.forEach(function(n,t){d(n,t,-1)})}function l(){h(function(n){n.destroy()}),D(s)}function d(n,t,i){t=Rt(r,t,i,n);t.mount(),s.push(t),s.sort(function(n,t){return n.index-t.index})}function v(n){return n?p(function(n){return!n.isClone}):s}function h(n,t){v(t).forEach(n)}function p(t){return s.filter(x(t)?t:function(n){return C(t)?cn(n.slide,t):b(y(t),n.index)})}return{mount:function(){i(),t(J,l),t(J,i)},destroy:l,update:function(){h(function(n){n.update()})},register:d,get:v,getIn:function(n){var t=o.Controller,i=t.toIndex(n),r=t.hasFocus()?1:u.perPage;return p(function(n){return En(n.index,i,i+r-1)})},getAt:function(n){return p(n)[0]},add:function(n,o){g(n,function(n){var t,i,r;m(n=C(n)?hn(n):n)&&((t=f[o])?O(n,t):L(a,n),M(n,u.classes.slide),t=n,i=R(e,jn),t=gn(t,"img"),(r=t.length)?t.forEach(function(n){c(n,"load error",function(){--r||i()})}):i())}),e(J)},remove:function(n){T(p(n).map(function(n){return n.slide})),e(J)},forEach:h,filter:p,style:function(t,i,r){h(function(n){n.style(t,i,r)})},getLength:function(n){return(n?f:s).length},isEnough:function(){return s.length>u.perPage}}},Layout:function(t,n,i){var r,o,u,e=(a=Q(t)).on,c=a.bind,f=a.emit,a=n.Slides,s=n.Direction.resolve,l=(n=n.Elements).root,d=n.track,v=n.list,h=a.getAt,p=a.style;function g(){r=i.direction===Jn,_(l,"maxWidth",W(i.width)),_(d,s("paddingLeft"),y(!1)),_(d,s("paddingRight"),y(!0)),m(!0)}function m(n){var t=N(l);!n&&o.width===t.width&&o.height===t.height||(_(d,"height",function(){var n="";r&&(bn(n=b(),"height or heightRatio is missing."),n="calc("+n+" - "+y(!1)+" - "+y(!0)+")");return n}()),p(s("marginRight"),W(i.gap)),p("width",i.autoWidth?null:W(i.fixedWidth)||(r?"":w())),p("height",W(i.fixedHeight)||(r?i.autoHeight?null:w():b()),!0),o=t,f(Nn),u!==(u=O())&&(A(l,Ot,u),f("overflow",u)))}function y(n){var t=i.padding,n=s(n?"right":"left");return t&&W(t[n]||(un(t)?0:t))||"0px"}function b(){return W(i.height||N(v).width*i.heightRatio)}function w(){var n=W(i.gap);return"calc((100%"+(n&&" + "+n)+")/"+(i.perPage||1)+(n&&" - "+n)+")"}function x(){return N(v)[s("width")]}function k(n,t){n=h(n||0);return n?N(n.slide)[s("width")]+(t?0:L()):0}function S(n,t){var i,n=h(n);return n?(n=N(n.slide)[s("right")],i=N(v)[s("left")],U(n-i)+(t?0:L())):0}function E(n){return S(t.length-1)-S(0)+k(0,n)}function L(){var n=h(0);return n&&parseFloat(_(n.slide,s("marginRight")))||0}function O(){return t.is(It)||E(!0)>x()}return{mount:function(){var n,t,i;g(),c(window,"resize load",(n=R(f,jn),i=qn(t||0,n,null,1),function(){i.isPaused()&&i.start()})),e([K,J],g),e(jn,m)},resize:m,listSize:x,slideSize:k,sliderSize:E,totalSize:S,getPadding:function(n){return parseFloat(_(d,s("padding"+(n?"Right":"Left"))))||0},isOverflow:O}},Clones:function(c,i,f){var t,r=Q(c),n=r.on,a=i.Elements,s=i.Slides,o=i.Direction.resolve,l=[];function u(){if(n(J,d),n([K,jn],v),t=h()){var o=t,u=s.get().slice(),e=u.length;if(e){for(;u.length<o;)k(u,u);k(u.slice(-o),u.slice(0,o)).forEach(function(n,t){var i=t<o,r=function(n,t){n=n.cloneNode(!0);return M(n,f.classes.clone),n.id=c.root.id+"-clone"+An(t+1),n}(n.slide,t);i?O(r,u[0].slide):L(a.list,r),k(l,r),s.register(r,t-o+(i?0:e),n.index)})}i.Layout.resize(!0)}}function d(){e(),u()}function e(){T(l),D(l),r.destroy()}function v(){var n=h();t!==n&&(t<n||!n)&&r.emit(J)}function h(){var n,t=f.clones;return c.is(Pt)?en(t)&&(t=(n=f[o("fixedWidth")]&&i.Layout.slideSize(0))&&kn(N(a.track)[o("width")]/n)||f[o("autoWidth")]&&c.length||2*f.perPage):t=0,t}return{mount:u,destroy:e}},Move:function(r,c,o){var e,n=Q(r),t=n.on,f=n.emit,a=r.state.set,u=(n=c.Layout).slideSize,i=n.getPadding,s=n.totalSize,l=n.listSize,d=n.sliderSize,v=(n=c.Direction).resolve,h=n.orient,p=(n=c.Elements).list,g=n.track;function m(){c.Controller.isBusy()||(c.Scroll.cancel(),y(r.index),c.Slides.update())}function y(n){b(S(n,!0))}function b(n,t){r.is(It)||(t=t?n:function(n){{var t,i;r.is(Pt)&&(t=k(n),i=t>c.Controller.getEnd(),(t<0||i)&&(n=w(n,i)))}return n}(n),_(p,"transform","translate"+v("X")+"("+t+"px)"),n!==t&&f(Un))}function w(n,t){var i=n-L(t),r=d();return n-=h(r*(kn(U(i)/r)||1))*(t?1:-1)}function x(){b(E(),!0),e.cancel()}function k(n){for(var t=c.Slides.get(),i=0,r=1/0,o=0;o<t.length;o++){var u=t[o].index,e=U(S(u,!0)-n);if(!(e<=r))break;r=e,i=u}return i}function S(n,t){var i=h(s(n-1)-(n=n,"center"===(i=o.focus)?(l()-u(n,!0))/2:+i*u(n)||0));return t?(n=i,n=o.trimSpace&&r.is(Mt)?q(n,0,h(d(!0)-l())):n):i}function E(){var n=v("left");return N(p)[n]-N(g)[n]+h(i(!1))}function L(n){return S(n?c.Controller.getEnd():0,!!o.trimSpace)}return{mount:function(){e=c.Transition,t([B,Nn,K,J],m)},move:function(n,t,i,r){var o,u;n!==t&&(o=i<n,u=h(w(E(),o)),o?0<=u:u<=p[v("scrollWidth")]-N(g)[v("width")])&&(x(),b(w(E(),i<n),!0)),a(G),f(H,t,i,n),e.start(t,function(){a(3),f(Dn,t,i,n),r&&r()})},jump:y,translate:b,shift:w,cancel:x,toIndex:k,toPosition:S,getPosition:E,getLimit:L,exceededLimit:function(n,t){t=en(t)?E():t;var i=!0!==n&&h(t)<h(L(!1)),n=!1!==n&&h(t)>h(L(!0));return i||n},reposition:m}},Controller:function(o,u,e){var c,f,a,s,n=Q(o),t=n.on,i=n.emit,l=u.Move,d=l.getPosition,r=l.getLimit,v=l.toPosition,h=(n=u.Slides).isEnough,p=n.getLength,g=e.omitEnd,m=o.is(Pt),y=o.is(Mt),b=R(L,!1),w=R(L,!0),x=e.start||0,k=x;function S(){f=p(!0),a=e.perMove,s=e.perPage,c=_();var n=q(x,0,g?c:f-1);n!==x&&(x=n,l.reposition())}function E(){c!==_()&&i("ei")}function L(n,t){var i=a||(P()?1:s),i=O(x+i*(n?-1:1),x,!(a||P()));return-1===i&&y&&!Sn(d(),r(!n),1)?n?0:c:t?i:A(i)}function O(n,t,i){var r;return h()||P()?((r=function(n){if(y&&"move"===e.trimSpace&&n!==x)for(var t=d();t===v(n,!0)&&En(n,0,o.length-1,!e.rewind);)n<x?--n:++n;return n}(n))!==n&&(t=n,n=r,i=!1),n<0||c<n?n=a||!En(0,n,t,!0)&&!En(c,t,n,!0)?m?i?n<0?-(f%s||s):f:n:e.rewind?n<0?c:0:-1:z(D(n)):i&&n!==t&&(n=z(D(t)+(n<t?-1:1)))):n=-1,n}function A(n){return m?(n+f)%f||0:n}function _(){for(var n=f-(P()||m&&a?1:s);g&&0<n--;)if(v(f-1,!0)!==v(n,!0)){n++;break}return q(n,0,f-1)}function z(n){return q(P()?n:s*n,0,c)}function D(n){return P()?Y(n,c):xn((c<=n?f-1:n)/s)}function M(n){n!==x&&(k=x,x=n)}function P(){return!en(e.focus)||e.isNavigation}function I(){return o.state.is([G,rn])&&!!e.waitForTransition}return{mount:function(){S(),t([K,J,"ei"],S),t(Nn,E)},go:function(n,t,i){var r;I()||-1<(r=A(n=function(n){var t=x;{var i,r;C(n)?(r=n.match(/([+\-<>])(\d+)?/)||[],i=r[1],r=r[2],"+"===i||"-"===i?t=O(x+ +(""+i+(+r||1)),x):">"===i?t=r?z(+r):b(!0):"<"===i&&(t=w(!0))):t=m?n:q(n,0,c)}return t}(n)))&&(t||r!==x)&&(M(r),l.move(n,r,k,i))},scroll:function(n,t,i,r){u.Scroll.scroll(n,t,i,function(){var n=A(l.toIndex(d()));M(g?Y(n,c):n),r&&r()})},getNext:b,getPrev:w,getAdjacent:L,getEnd:_,setIndex:M,getIndex:function(n){return n?k:x},toIndex:z,toPage:D,toDest:function(n){return n=l.toIndex(n),y?q(n,0,c):n},hasFocus:P,isBusy:I}},Arrows:function(o,n,t){var i,r,u=Q(o),e=u.on,c=u.bind,f=u.emit,a=t.classes,s=t.i18n,l=n.Elements,d=n.Controller,v=l.arrows,h=l.track,p=v,g=l.prev,m=l.next,y={};function b(){var n=t.arrows;!n||g&&m||(p=v||j("div",a.arrows),g=S(!0),m=S(!1),i=!0,L(p,[g,m]),v||O(p,h)),g&&m&&(an(y,{prev:g,next:m}),ln(p,n?"":"none"),M(p,r=dt+"--"+t.direction),n&&(e([B,Dn,J,V,"ei"],E),c(m,"click",R(k,">")),c(g,"click",R(k,"<")),E(),I([g,m],Kn,h.id),f("arrows:mounted",g,m))),e(K,w)}function w(){x(),b()}function x(){u.destroy(),X(p,r),i?(T(v?[g,m]:p),g=m=null):P([g,m],ut)}function k(n){d.go(n,!0)}function S(n){return hn('<button class="'+a.arrow+" "+(n?a.prev:a.next)+'" type="button"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 40 40" width="40" height="40" focusable="false"><path d="'+(t.arrowPath||"m15.5 0.932-4.3 4.38 14.5 14.6-14.5 14.5 4.3 4.4 14.6-14.6 4.4-4.3-4.4-4.4-14.6-14.6z")+'" />')}function E(){var n,t,i,r;g&&m&&(r=o.index,n=d.getPrev(),t=d.getNext(),i=-1<n&&r<n?s.last:s.prev,r=-1<t&&t<r?s.first:s.next,g.disabled=n<0,m.disabled=t<0,I(g,nn,i),I(m,nn,r),f("arrows:updated",g,m,n,t))}return{arrows:y,mount:b,destroy:x,update:E}},Autoplay:function(n,t,i){var r,o,u=Q(n),e=u.on,c=u.bind,f=u.emit,a=qn(i.interval,n.go.bind(n,">"),function(n){var t=l.bar;t&&_(t,"width",100*n+"%"),f("autoplay:playing",n)}),s=a.isPaused,l=t.Elements,d=(u=t.Elements).root,v=u.toggle,h=i.autoplay,p="pause"===h;function g(){s()&&t.Slides.isEnough()&&(a.start(!i.resetProgress),o=r=p=!1,b(),f(Fn))}function m(n){p=!!(n=void 0===n?!0:n),b(),s()||(a.pause(),f(Xn))}function y(){p||(r||o?m(!1):g())}function b(){v&&(A(v,tn,!p),I(v,nn,i.i18n[p?"play":"pause"]))}function w(n){n=t.Slides.getAt(n);a.set(n&&+z(n.slide,Ct)||i.interval)}return{mount:function(){h&&(i.pauseOnHover&&c(d,"mouseenter mouseleave",function(n){r="mouseenter"===n.type,y()}),i.pauseOnFocus&&c(d,"focusin focusout",function(n){o="focusin"===n.type,y()}),v&&c(v,"click",function(){p?g():m(!0)}),e([H,Tn,J],a.rewind),e(H,w),v&&I(v,Kn,l.track.id),p||g(),b())},destroy:a.cancel,play:g,pause:m,isPaused:s}},Cover:function(n,t,i){var r=Q(n).on;function o(i){t.Slides.forEach(function(n){var t=fn(n.container||n.slide,"img");t&&t.src&&u(i,t,n)})}function u(n,t,i){i.style("background",n?'center/cover no-repeat url("'+t.src+'")':"",!0),ln(t,n?"none":"")}return{mount:function(){i.cover&&(r(Wn,R(u,!0)),r([B,K,J],R(o,!0)))},destroy:R(o,!1)}},Scroll:function(n,c,u){var f,a,t=Q(n),i=t.on,s=t.emit,l=n.state.set,d=c.Move,v=d.getPosition,e=d.getLimit,h=d.exceededLimit,p=d.translate,g=n.is(Mt),m=1;function y(n,t,i,r,o){var u,e=v(),i=(x(),!i||g&&h()||(i=c.Layout.sliderSize(),u=Ln(n)*i*xn(U(n)/i)||0,n=d.toPosition(c.Controller.toDest(n%i))+u),Sn(e,n,1));m=1,t=i?0:t||wn(U(n-e)/1.5,800),a=r,f=qn(t,b,R(w,e,n,o),1),l(rn),s(Tn),f.start()}function b(){l(3),a&&a(),s(V)}function w(n,t,i,r){var o=v(),r=(n+(t-n)*(t=r,(n=u.easingFunc)?n(t):1-Math.pow(1-t,4))-o)*m;p(o+r),g&&!i&&h()&&(m*=.6,U(r)<10&&y(e(h(!0)),600,!1,a,!0))}function x(){f&&f.cancel()}function r(){f&&!f.isPaused()&&(x(),b())}return{mount:function(){i(H,x),i([K,J],r)},destroy:x,scroll:y,cancel:r}},Drag:function(e,o,c){var f,t,u,a,s,l,d,v,n=Q(e),i=n.on,h=n.emit,p=n.bind,g=n.unbind,m=e.state,y=o.Move,b=o.Scroll,w=o.Controller,x=o.Elements.track,k=o.Media.reduce,r=(n=o.Direction).resolve,S=n.orient,E=y.getPosition,L=y.exceededLimit,O=!1;function j(){var n=c.drag;C(!n),a="free"===n}function N(n){var t,i,r;l=!1,d||(t=R(n),i=n.target,r=c.noDrag,cn(i,"."+mt+", ."+vt)||r&&cn(i,r)||!t&&n.button||(w.isBusy()?F(n,!0):(v=t?x:window,s=m.is([G,rn]),u=null,p(v,zt,A,jt),p(v,Dt,_,jt),y.cancel(),b.cancel(),z(n))))}function A(n){var t,i,r,o,u;m.is(6)||(m.set(6),h("drag")),n.cancelable&&(s?(y.translate(f+D(n)/(O&&e.is(Mt)?5:1)),u=200<M(n),t=O!==(O=L()),(u||t)&&z(n),l=!0,h("dragging"),F(n)):U(D(u=n))>U(D(u,!0))&&(t=n,i=c.dragMinThreshold,r=un(i),o=r&&i.mouse||0,r=(r?i.touch:+i)||10,s=U(D(t))>(R(t)?r:o),F(n)))}function _(n){var t,i,r;m.is(6)&&(m.set(3),h("dragged")),s&&(i=function(n){return E()+Ln(n)*Y(U(n)*(c.flickPower||600),a?1/0:o.Layout.listSize()*(c.flickMaxPages||1))}(t=function(n){if(e.is(Pt)||!O){var t=M(n);if(t&&t<200)return D(n)/t}return 0}(t=n)),r=c.rewind&&c.rewindByDrag,k(!1),a?w.scroll(i,0,c.snap):e.is(It)?w.go(S(Ln(t))<0?r?"<":"-":r?">":"+"):e.is(Mt)&&O&&r?w.go(L(!0)?">":"<"):w.go(w.toDest(i),!0),k(!0),F(n)),g(v,zt,A),g(v,Dt,_),s=!1}function T(n){!d&&l&&F(n,!0)}function z(n){u=t,t=n,f=E()}function D(n,t){return I(n,t)-I(P(n),t)}function M(n){return mn(n)-mn(P(n))}function P(n){return t===n&&u||t}function I(n,t){return(R(n)?n.changedTouches[0]:n)["page"+r(t?"Y":"X")]}function R(n){return"undefined"!=typeof TouchEvent&&n instanceof TouchEvent}function C(n){d=n}return{mount:function(){p(x,zt,on,jt),p(x,Dt,on,jt),p(x,_t,N,jt),p(x,"click",T,{capture:!0}),p(x,"dragstart",F),i([B,K],j)},disable:C,isDragging:function(){return s}}},Keyboard:function(t,n,i){var r,o,u=Q(t),e=u.on,c=u.bind,f=u.unbind,a=t.root,s=n.Direction.resolve;function l(){var n=i.keyboard;n&&(r="global"===n?window:a,c(r,Gt,h))}function d(){f(r,Gt)}function v(){var n=o;o=!0,p(function(){o=n})}function h(n){o||((n=Tt(n))===s(Bn)?t.go("<"):n===s(Hn)&&t.go(">"))}return{mount:function(){l(),e(K,d),e(K,l),e(H,v)},destroy:d,disable:function(n){o=n}}},LazyLoad:function(i,n,o){var t=Q(i),r=t.on,u=t.off,e=t.bind,c=t.emit,f="sequential"===o.lazyLoad,a=[Dn,V],s=[];function l(){D(s),n.Slides.forEach(function(r){gn(r.slide,Wt).forEach(function(n){var t=z(n,Ft),i=z(n,Xt);t===n.src&&i===n.srcset||(t=o.classes.spinner,t=fn(i=n.parentElement,"."+t)||j("span",t,i),s.push([n,r,t]),n.src||ln(n,"none"))})}),(f?p:(u(a),r(a,d),d))()}function d(){(s=s.filter(function(n){var t=o.perPage*((o.preloadPages||1)+1)-1;return!n[1].isWithin(i.index,t)||v(n)})).length||u(a)}function v(n){var t=n[0];M(n[1].slide,Et),e(t,"load error",R(h,n)),I(t,"src",z(t,Ft)),I(t,"srcset",z(t,Xt)),P(t,Ft),P(t,Xt)}function h(n,t){var i=n[0],r=n[1];X(r.slide,Et),"error"!==t.type&&(T(n[2]),ln(i,""),c(Wn,i,r),c(jn)),f&&p()}function p(){s.length&&v(s.shift())}return{mount:function(){o.lazyLoad&&(l(),r(J,l))},destroy:R(D,s),check:d}},Pagination:function(l,n,d){var v,h,t=Q(l),p=t.on,g=t.emit,m=t.bind,y=n.Slides,b=n.Elements,w=n.Controller,x=w.hasFocus,r=w.getIndex,e=w.go,c=n.Direction.resolve,k=b.pagination,S=[];function E(){v&&(T(k?o(v.children):v),X(v,h),D(S),v=null),t.destroy()}function L(n){e(">"+n,!0)}function O(n,t){var i=S.length,r=Tt(t),o=A(),u=-1,o=(r===c(Hn,!1,o)?u=++n%i:r===c(Bn,!1,o)?u=(--n+i)%i:"Home"===r?u=0:"End"===r&&(u=i-1),S[u]);o&&(dn(o.button),e(">"+u),F(t,!0))}function A(){return d.paginationDirection||d.direction}function _(n){return S[w.toPage(n)]}function z(){var n,t=_(r(!0)),i=_(r());t&&(X(n=t.button,tn),P(n,Qn),I(n,$,-1)),i&&(M(n=i.button,tn),I(n,Qn,!0),I(n,$,"")),g("pagination:updated",{list:v,items:S},t,i)}return{items:S,mount:function n(){E(),p([K,J,"ei"],n);var t=d.pagination;if(k&&ln(k,t?"":"none"),t){p([H,Tn,V],z);var t=l.length,i=d.classes,r=d.i18n,o=d.perPage,u=x()?w.getEnd()+1:kn(t/o);M(v=k||j("ul",i.pagination,b.track.parentElement),h=gt+"--"+A()),I(v,Z,"tablist"),I(v,nn,r.select),I(v,nt,A()===Jn?"vertical":"");for(var e=0;e<u;e++){var c=j("li",null,v),f=j("button",{class:i.page,type:"button"},c),a=y.getIn(e).map(function(n){return n.slide.id}),s=!x()&&1<o?r.pageX:r.slideX;m(f,"click",R(L,e)),d.paginationKeyboard&&m(f,"keydown",R(O,e)),I(c,Z,"presentation"),I(f,Z,"tab"),I(f,Kn,a.join(" ")),I(f,nn,On(s,e+1)),I(f,$,-1),S.push({li:c,button:f,page:e})}z(),g("pagination:mounted",{list:v,items:S},_(l.index))}},destroy:E,getAt:_,update:z}},Sync:function(i,n,t){var r=t.isNavigation,o=t.slideFocus,u=[];function e(){var n,t;i.splides.forEach(function(n){n.isParent||(f(i,n.splide),f(n.splide,i))}),r&&(n=Q(i),(t=n.on)(Mn,s),t(Yn,l),t([B,K],a),u.push(n),n.emit(Gn,i.splides))}function c(){u.forEach(function(n){n.destroy()}),D(u)}function f(n,r){n=Q(n);n.on(H,function(n,t,i){r.go(r.is(Pt)?i:n)}),u.push(n)}function a(){I(n.Elements.list,nt,t.direction===Jn?"vertical":"")}function s(n){i.go(n.index)}function l(n,t){b(Yt,Tt(t))&&(s(n),F(t))}return{setup:R(n.Media.set,{slideFocus:en(o)?r:o},!0),mount:e,destroy:c,remount:function(){c(),e()}}},Wheel:function(e,c,f){var n=Q(e).bind,a=0;function t(n){var t,i,r,o,u;n.cancelable&&(t=(u=n.deltaY)<0,i=mn(n),r=f.wheelMinThreshold||0,o=f.wheelSleep||0,U(u)>r&&o<i-a&&(e.go(t?"<":">"),a=i),u=t,f.releaseWheel&&!e.state.is(G)&&-1===c.Controller.getAdjacent(u)||F(n))}return{mount:function(){f.wheel&&n(c.Elements.track,"wheel",t,jt)}}},Live:function(n,t,i){var r=Q(n).on,o=t.Elements.track,u=i.live&&!i.isNavigation,e=j("span",wt),c=qn(90,R(f,!1));function f(n){I(o,rt,n),n?(L(o,e),c.start()):(T(e),c.cancel())}function a(n){u&&I(o,it,n?"off":"polite")}return{mount:function(){u&&(a(!t.Autoplay.isPaused()),I(o,ot,!0),e.textContent="â¦",r(Fn,R(a,!0)),r(Xn,R(a,!1)),r([Dn,V],R(f,!0)))},disable:a,destroy:function(){P(o,[it,ot,rt]),T(e)}}}}),qt={type:"slide",role:"region",speed:400,perPage:1,cloneStatus:!0,arrows:!0,pagination:!0,paginationKeyboard:!0,interval:5e3,pauseOnHover:!0,pauseOnFocus:!0,resetProgress:!0,easing:"cubic-bezier(0.25, 1, 0.5, 1)",drag:!0,direction:"ltr",trimSpace:!0,focusableNodes:"a, button, textarea, input, select, iframe",live:!0,classes:{slide:at,clone:st,arrows:dt,arrow:vt,prev:ht,next:pt,pagination:gt,page:mt,spinner:i+"spinner"},i18n:{prev:"Previous slide",next:"Next slide",first:"Go to first slide",last:"Go to last slide",slideX:"Go to slide %s",pageX:"Go to page %s",play:"Start autoplay",pause:"Pause autoplay",carousel:"carousel",slide:"slide",select:"Select a slide to show",slideLabel:"%s of %s"},reducedMotion:{speed:0,rewindSpeed:0,autoplay:"pause"}};function Bt(n,t,i){var r=t.Slides;function o(){r.forEach(function(n){n.style("transform","translateX(-"+100*n.index+"%)")})}return{mount:function(){Q(n).on([B,J],o)},start:function(n,t){r.style("transition","opacity "+i.speed+"ms "+i.easing),p(t)},cancel:on}}function Ht(u,n,e){var c,f=n.Move,a=n.Controller,s=n.Scroll,t=n.Elements.list,l=R(_,t,"transition");function i(){l(""),s.cancel()}return{mount:function(){Q(u).bind(t,"transitionend",function(n){n.target===t&&c&&(i(),c())})},start:function(n,t){var i=f.toPosition(n,!0),r=f.getPosition(),o=function(n){var t=e.rewindSpeed;if(u.is(Mt)&&t){var i=a.getIndex(!0),r=a.getEnd();if(0===i&&r<=n||r<=i&&0===n)return t}return e.speed}(n);1<=U(i-r)&&1<=o?e.useScroll?s.scroll(i,o,!1,t):(l("transform "+o+"ms "+e.easing),f.translate(i,!0),c=t):(f.jump(n),t())},cancel:i}}t=function(){function i(n,t){this.event=Q(),this.Components={},this.state=s(1),this.splides=[],this.n={},this.t={};n=C(n)?pn(document,n):n;bn(n,n+" is invalid."),t=d({label:z(this.root=n,nn)||"",labelledby:z(n,Zn)||""},qt,i.defaults,t||{});try{d(t,JSON.parse(z(n,f)))}catch(n){bn(!1,"Invalid JSON")}this.n=Object.create(d({},t))}var n=i.prototype;return n.mount=function(n,t){var i=this,r=this.state,o=this.Components;return bn(r.is([1,7]),"Already mounted!"),r.set(1),this.i=o,this.r=t||this.r||(this.is(It)?Bt:Ht),this.t=n||this.t,w(an({},Ut,this.t,{Transition:this.r}),function(n,t){n=n(i,o,i.n);(o[t]=n).setup&&n.setup()}),w(o,function(n){n.mount&&n.mount()}),this.emit(B),M(this.root,"is-initialized"),r.set(3),this.emit("ready"),this},n.sync=function(n){return this.splides.push({splide:n}),n.splides.push({splide:this,isParent:!0}),this.state.is(3)&&(this.i.Sync.remount(),n.Components.Sync.remount()),this},n.go=function(n){return this.i.Controller.go(n),this},n.on=function(n,t){return this.event.on(n,t),this},n.off=function(n){return this.event.off(n),this},n.emit=function(n){var t;return(t=this.event).emit.apply(t,[n].concat(o(arguments,1))),this},n.add=function(n,t){return this.i.Slides.add(n,t),this},n.remove=function(n){return this.i.Slides.remove(n),this},n.is=function(n){return this.n.type===n},n.refresh=function(){return this.emit(J),this},n.destroy=function(t){void 0===t&&(t=!0);var n=this.event,i=this.state;return i.is(1)?Q(this).on("ready",this.destroy.bind(this,t)):(w(this.i,function(n){n.destroy&&n.destroy(t)},!0),n.emit(a),n.destroy(),t&&D(this.splides),i.set(7)),this},Jt(i,[{key:"options",get:function(){return this.n},set:function(n){this.i.Media.set(n,!0,!0)}},{key:"length",get:function(){return this.i.Slides.getLength(!0)}},{key:"index",get:function(){return this.i.Controller.getIndex()}}]),i}();return t.defaults={},t.STATES=r,t},"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(n="undefined"!=typeof globalThis?globalThis:n||self).Splide=t(); 9835//# sourceMappingURL=splide.min.js.map
9836 9837window.sweSikaDownloadsDebugger = {}; 9838 9839(function (self) { 9840 'use strict' 9841 9842 /*********** 9843 * Private * 9844 ***********/ 9845 9846 let _availableModules = {}, 9847 _debug = false, 9848 _extClass = '' 9849 9850 /** 9851 * Add available modules. 9852 * 9853 * @param {string} filename 9854 * @param {string[]} modules 9855 * @private 9856 */ 9857 function _addModules (filename, modules) { 9858 if (!_availableModules.hasOwnProperty(filename)) _availableModules[filename] = [] 9859 9860 for (let i = 0; i < modules.length; i += 1) { 9861 if (_availableModules[filename].indexOf(modules[i]) !== -1) continue 9862 _availableModules[filename].push(modules[i]) 9863 } 9864 } 9865 9866 /** 9867 * Check if an object is available in window. 9868 * 9869 * @param {string} namespace The namespace to check 9870 * @return {boolean} 9871 * @private 9872 */ 9873 function _isWindowGlobal (namespace) { 9874 for (let name in window) { 9875 if (name === namespace) return true 9876 } 9877 9878 return false 9879 } 9880 9881 /** 9882 * Get the current line number. 9883 * 9884 * @return {string} Returns the line number. 9885 * @private 9886 */ 9887 function _getLineNumber () { 9888 let e = new Error() 9889 if (!e.stack) { 9890 try { 9891 throw e 9892 } catch (e) { 9893 if (!e.stack) return '0' 9894 } 9895 } 9896 9897 let stack = e.stack.toString().split(/\r\n|\n/), 9898 frameRe = /:(\d+):(?:\d+)[^\d]*$/, 9899 frame 9900 9901 do { 9902 frame = stack.shift() 9903 } while (!frameRe.exec(frame) && stack.length) 9904 stack.shift() 9905 return frameRe.exec(stack.shift())[1] 9906 } 9907 9908 /** 9909 * Get the debug level. 9910 * 9911 * @return {number} Returns the debug level. 9912 */ 9913 function _getDebugLevel () { 9914 if (_extClass.length < 1) return 0 9915 let element = document.querySelector('#' + _extClass + '-debug') 9916 if (!element || !element.hasAttribute('data-debug-level')) return 0 9917 return parseInt(element.getAttribute('data-debug-level')) 9918 } 9919 9920 /********** 9921 * Public * 9922 **********/ 9923 9924 // constants 9925 self.DEBUG_FUNC_END = 0 9926 self.DEBUG_FUNC_START = 1 9927 self.DEBUG_FUNC_CALLED = 2 9928 9929 // @see \Swe\Core\Service\LogServiceInterface 9930 self.LEVEL_EMERGENCY = 0 9931 self.LEVEL_ALERT = 1 9932 self.LEVEL_CRITICAL = 2 9933 self.LEVEL_ERROR = 3 9934 self.LEVEL_WARNING = 4 9935 self.LEVEL_NOTICE = 5 9936 self.LEVEL_INFO = 6 9937 self.LEVEL_DEBUG = 7 9938 9939 /** 9940 * Check if checked module is available. 9941 * 9942 * @param {string} filename 9943 * @param {string} module 9944 * @return {boolean} 9945 */ 9946 self.isModuleAvailable = function (filename, module) { 9947 if (!_availableModules.hasOwnProperty(filename)) return false 9948 return _availableModules[filename].indexOf(module) !== -1 9949 } 9950 9951 /** 9952 * @param {number} group 9953 * @param {string} [name='anonymous'] OPTIONAL. 9954 */ 9955 self.debuggingFunc = function (group, name) { 9956 let functionDebugLevel = self.LEVEL_WARNING 9957 9958 if (!self.isDebug() || _getDebugLevel() < functionDebugLevel) return 9959 if (typeof name === 'undefined') name = 'anonymous' 9960 9961 switch (group) { 9962 case self.DEBUG_FUNC_START: 9963 console.group(name) 9964 break 9965 case self.DEBUG_FUNC_END: 9966 console.groupEnd() 9967 break 9968 case self.DEBUG_FUNC_CALLED: 9969 self.debuggingFunc(self.DEBUG_FUNC_START, name) 9970 self.debuggingFunc(self.DEBUG_FUNC_END, name) 9971 break 9972 } 9973 } 9974 9975 /** 9976 * Print a variable via console.log if the debug mode is enabled. 9977 * 9978 * @param {*} variable The variable to debug. 9979 * @param {number|null} [level=self.LEVEL_INFO] OPTIONAL. The log level. 9980 */ 9981 self.debug = function (variable, level) { 9982 if (typeof level === 'undefined') level = self.LEVEL_INFO 9983 if (!self.isDebug() || _getDebugLevel() < level) return 9984 console.log('Line: ' + _getLineNumber() + ' -', variable) 9985 } 9986 9987 /** 9988 * Print an error message via console.warn. If the debug mode is disabled, printing a default error message. 9989 * 9990 * @param {string} message The error message. 9991 * @param {number|null} [level=self.LEVEL_ERROR] OPTIONAL. The log level. 9992 */ 9993 self.error = function (message, level) { 9994 if (typeof level === 'undefined') level = self.LEVEL_ERROR 9995 if (_getDebugLevel() >= level || self.isDebug()) { 9996 console.warn('Line: ' + _getLineNumber() + ' -', message) 9997 return 9998 } 9999 10000 console.warn('Line: ' + _getLineNumber() + ' -', 'An error occurred') 10001 } 10002 10003 /** 10004 * @param {string} extClass 10005 */ 10006 self.setExtClass = function (extClass) { 10007 _extClass = extClass 10008 } 10009 10010 /** 10011 * @return {string} 10012 */ 10013 self.getExtClass = function () { 10014 return _extClass 10015 } 10016 10017 /** 10018 * Check if the debug mode is enabled. 10019 * 10020 * @return {boolean} Returns TRUE if the debug mode is enabled, FALSE if it's disabled. 10021 */ 10022 self.isDebug = function () { 10023 if (_debug) return _debug 10024 if (_extClass.length < 1) return _debug 10025 let element = document.querySelector('#' + _extClass + '-debug') 10026 if (!element || !element.hasAttribute('data-debug')) return _debug 10027 return element.getAttribute('data-debug') === '1' 10028 } 10029 10030 /** 10031 * @param {boolean} debug 10032 */ 10033 self.setDebug = function (debug) { 10034 _debug = debug === true 10035 } 10036 10037 /** 10038 * Check if modules are available. 10039 * 10040 * @param {string[]} modules 10041 * @param {string} type 10042 * @param {boolean} stop 10043 * @param {string} filename 10044 */ 10045 self.checkModules = function (modules, type, stop, filename) { 10046 self.debuggingFunc(self.DEBUG_FUNC_START, 'sweSikaDownloadsDebugger.checkModules') 10047 self.debug('Checking modules for: ' + filename, self.LEVEL_INFO) 10048 self.debug('Modules to check: ' + JSON.stringify(modules), self.LEVEL_DEBUG) 10049 self.debug('Modules are: ' + type, self.LEVEL_DEBUG) 10050 10051 let notFound = [],
10052 stringFilename = '[' + filename + '.js] ', 10053 string = stringFilename + type.toUpperCase() + ' NAMESPACES NOT FOUND: ' 10054 10055 if (modules.length < 1) { 10056 _addModules(filename, modules) 10057 string = stringFilename + 'No modules to load.' 10058 self.debug(string, self.LEVEL_INFO) 10059 self.debuggingFunc(self.DEBUG_FUNC_END) 10060 return 10061 } 10062 10063 for (let i = 0; i < modules.length; i += 1) { 10064 if (_isWindowGlobal(modules[i])) { 10065 _addModules(filename, [modules[i]]) 10066 continue 10067 } 10068 10069 notFound.push(modules[i]) 10070 } 10071 10072 if (notFound.length === 0) { 10073 string = stringFilename + 'All ' + type + ' modules (' + modules.length + ') loaded.' 10074 self.debug(string, self.LEVEL_INFO) 10075 self.debuggingFunc(self.DEBUG_FUNC_END) 10076 return 10077 } 10078 10079 if (stop) { 10080 self.debuggingFunc(self.DEBUG_FUNC_END) 10081 throw string + notFound.join(', ') 10082 } 10083 10084 self.error(string + notFound.join(', '), self.LEVEL_ERROR) 10085 self.debuggingFunc(self.DEBUG_FUNC_END) 10086 } 10087 10088})(window.sweSikaDownloadsDebugger) 10089 10090window.sweSikaDownloadsHelper = {}; 10091 10092(function (self) { 10093 'use strict' 10094 10095 /*********** 10096 * Private * 10097 ***********/ 10098 10099 let _requiredModules = [], 10100 _suggestedModules = [], 10101 _filename = 'swe-helper', 10102 _checked = false, 10103 _cookieProtection = true, 10104 _elementPrefixes = [ 10105 '#', 10106 '.', 10107 '[', 10108 ], 10109 _htmlTags = [], 10110 _cookieBannerNames = [ 10111 'cookieBanner',
10112 'cookieBanner2019', 10113 ] 10114 10115 /** 10116 * @private 10117 */ 10118 function _check () { 10119 if (_checked) return 10120 if (!sweSikaDownloadsDebugger) throw '[' + _filename + '.js] Required namespace "sweSikaDownloadsDebugger" not found.' 10121 10122 sweSikaDownloadsDebugger.checkModules(_requiredModules, 'required', true, _filename) 10123 sweSikaDownloadsDebugger.checkModules(_suggestedModules, 'suggested', false, _filename) 10124 _checked = true 10125 } 10126 10127 /** 10128 * Set all available html tag names from the current dom. 10129 * @private 10130 */ 10131 function _setAllHtmlTagNames () { 10132 sweSikaDownloadsDebugger.debuggingFunc(sweSikaDownloadsDebugger.DEBUG_FUNC_START, 'sweSikaDownloadsHelper._getAllHtmlTagNames') 10133 let all = document.getElementsByTagName('*') 10134 10135 for (let i = 0, max = all.length; i < max; i += 1) { 10136 let tag = all[i].tagName.toLowerCase() 10137 if (_htmlTags.indexOf(tag) !== -1) continue 10138 _htmlTags.push(tag) 10139 } 10140 10141 sweSikaDownloadsDebugger.debug(_htmlTags, sweSikaDownloadsDebugger.LEVEL_DEBUG) 10142 sweSikaDownloadsDebugger.debuggingFunc(sweSikaDownloadsDebugger.DEBUG_FUNC_END) 10143 } 10144 10145 /********** 10146 * Public * 10147 **********/ 10148 10149 /** 10150 * @type {number} 10151 */ 10152 self.recursionCounter = 0 10153 10154 /** 10155 * @type {number} 10156 */ 10157 self.maxRecursions = 10 10158 10159 /** 10160 * Get the cookie protection. 10161 * 10162 * @return {boolean} 10163 */ 10164 self.getCookieProtection = function () { 10165 return _cookieProtection 10166 } 10167 10168 /** 10169 * Set the cookie protection. 10170 * 10171 * @param {boolean} protection 10172 */ 10173 self.setCookieProtection = function (protection) { 10174 _cookieProtection = protection 10175 } 10176 10177 /** 10178 * Check if we can create cookies. 10179 * 10180 * @return {boolean} 10181 */ 10182 self.isCookieAllowed = function () { 10183 return self.setCookie('cookie-test', 'test', 0) 10184 } 10185 10186 /** 10187 * Get a cookie. 10188 * 10189 * @param {string} name The name of the cookie. 10190 * @returns {string} Returns the cookie value. 10191 */ 10192 self.getCookie = function (name) { 10193 let nameEQ = name + '=', 10194 cookieArray = document.cookie.split(';') 10195 10196 for (let i = 0; i < cookieArray.length; i += 1) { 10197 let cookie = cookieArray[i] 10198 10199 while (cookie.charAt(0) === ' ') { 10200 cookie = cookie.substring(1, cookie.length) 10201 } 10202 10203 if (cookie.indexOf(nameEQ) === 0) { 10204 return cookie.substring(nameEQ.length, cookie.length) 10205 } 10206 } 10207 10208 return '' 10209 } 10210 10211 /** 10212 * Set or delete a cookie. 10213 * 10214 * @param {string} name The name of the cookie. 10215 * @param {string} value The value of the cookie. 10216 * @param {number|null} [days=null] OPTIONAL. The number of days until the cookie expires. 10217 * @return {boolean} Returns TRUE if the cookie was set, FALSE if the cookieBanner is not set. 10218 */ 10219 self.setCookie = function (name, value, days) { 10220 let date = new Date(), 10221 expires = '; expires=', 10222 gmtString = 'Thu, 01 Jan 1970 00:00:01 GMT', 10223 valid = false 10224 10225 for (let i = 0; i < _cookieBannerNames.length; i += 1) { 10226 if (!_cookieProtection || self.getCookie(_cookieBannerNames[i]).toLowerCase() === 'set') valid = true 10227 } 10228 10229 if (!valid) { 10230 if (name !== 'cookie-test') { 10231 sweSikaDownloadsDebugger.error('The cookie banner is not accepted') 10232 sweSikaDownloadsDebugger.debuggingFunc(sweSikaDownloadsDebugger.DEBUG_FUNC_END) 10233 } 10234 10235 return false 10236 } 10237 10238 if (name === 'cookie-test') return true 10239 10240 if (days) { 10241 date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000)) 10242 gmtString = date.toGMTString() 10243 } 10244 10245 document.cookie = name + '=' + value + expires + gmtString + '; path=/' 10246 return true 10247 } 10248 10249 /** 10250 * Remove all children elements from an element. 10251 * 10252 * @param {HTMLElement} element The HTMLElement instance. 10253 */ 10254 self.removeChildren = function (element) { 10255 while (element.hasChildNodes()) { 10256 element.removeChild(element.firstChild) 10257 } 10258 } 10259 10260 /** 10261 * Get an element by a selector. 10262 * 10263 * @param {string} selector The selector. 10264 * @param {HTMLElement|Document} [element=null] OPTIONAL. The element to search from. 10265 * @return {HTMLElement} Returns the html element. 10266 */ 10267 self.getElement = function (selector, element) { 10268 element = element || document 10269 if (_htmlTags.length === 0) _setAllHtmlTagNames() 10270 10271 if (_htmlTags.indexOf(selector) === -1) { 10272 if (_elementPrefixes.indexOf(selector.charAt(0)) === -1) selector = '#' + selector 10273 } 10274 10275 return element.querySelector(selector) 10276 } 10277 10278 /** 10279 * Get elements by a selector. 10280 * 10281 * @param {string} selector The selector. 10282 * @param {HTMLElement|Document} [element=null] OPTIONAL. The element to search from. 10283 * @return {NodeListOf<HTMLElement>} Returns a list of html elements. 10284 */ 10285 self.getElements = function (selector, element) { 10286 element = element || document 10287 if (_htmlTags.length === 0) _setAllHtmlTagNames() 10288 10289 if (_htmlTags.indexOf(selector) === -1) { 10290 if (_elementPrefixes.indexOf(selector.charAt(0)) === -1) selector = '.' + selector 10291 } 10292 10293 return element.querySelectorAll(selector) 10294 } 10295 10296 /** 10297 * Get the parent element with the given selector. 10298 * 10299 * @param {HTMLElement} element 10300 * @param {string} selector 10301 * @return {HTMLElement} 10302 */ 10303 self.getParentWithClass = function (element, selector) { 10304 while ((element = element.parentElement) && !(element.classList.contains(selector))) { 10305 // Nothing inside. 10306 } 10307 10308 return element 10309 } 10310 10311 /** 10312 * Remove a css class from a dom element. 10313 * 10314 * @param {HTMLElement} element The html element. 10315 * @param {string} className The name of the class. 10316 */ 10317 self.removeDomClass = function (element, className) { 10318 if (element.classList.contains(className)) element.classList.remove(className) 10319 } 10320 10321 /** 10322 * Add a css class to a dom element. 10323 * 10324 * @param {HTMLElement} element The html element. 10325 * @param {string} className The name of the class. 10326 */ 10327 self.addDomClass = function (element, className) { 10328 if (!element.classList.contains(className)) element.classList.add(className) 10329 } 10330 10331 /** 10332 * Show an html element. 10333 * 10334 * @param {HTMLElement} element The html element. 10335 */ 10336 self.show = function (element) { 10337 self.removeDomClass(element, 'hidden') 10338 } 10339 10340 /** 10341 * Hide an html element. 10342 * 10343 * @param {HTMLElement} element The html element. 10344 */ 10345 self.hide = function (element) { 10346 self.addDomClass(element, 'hidden') 10347 } 10348 10349 /** 10350 * Check if an element is hidden. 10351 * 10352 * @param {HTMLElement} element The html element to check. 10353 * @return {boolean} Returns TRUE if the element is hidden. 10354 */ 10355 self.isHidden = function (element) { 10356 return element.classList.contains('hidden') 10357 } 10358 10359 /** 10360 * Get a random index. 10361 * 10362 * @param {array} array An array where we want to get a random index. 10363 * @return {number} Returns the index. 10364 */ 10365 self.getRandomIndex = function (array) { 10366 return Math.floor(Math.random() * array.length) 10367 } 10368 10369 /** 10370 * Endless loop protection. 10371 * 10372 * @param {number} [max=null] OPTIONAL. The maximum of allowed recursions. 10373 * @return {number|null} Returns the number of recursions if the limit is reached, NULL if it's alright. 10374 */ 10375 self.recursionProtection = function (max) { 10376 sweSikaDownloadsDebugger.debuggingFunc(sweSikaDownloadsDebugger.DEBUG_FUNC_START, 'sweHelperGroupTravel.recursionProtection') 10377 if (typeof max === 'undefined' || max === 0) max = self.maxRecursions 10378 let infoMessage = 'Recursion counter: ' + self.recursionCounter.toString() 10379 10380 if (max > self.recursionCounter) { 10381 self.recursionCounter += 1 10382 sweSikaDownloadsDebugger.debug(infoMessage, sweSikaDownloadsDebugger.LEVEL_INFO) 10383 sweSikaDownloadsDebugger.debuggingFunc(sweSikaDownloadsDebugger.DEBUG_FUNC_END) 10384 return null 10385 } 10386 10387 let amount = self.recursionCounter 10388 infoMessage = 'The maximum of recursions is reached. (Amount: ' + amount + ')' 10389 self.resetRecursion() 10390 sweSikaDownloadsDebugger.debug(infoMessage, sweSikaDownloadsDebugger.LEVEL_INFO) 10391 sweSikaDownloadsDebugger.debuggingFunc(sweSikaDownloadsDebugger.DEBUG_FUNC_END) 10392 return amount 10393 } 10394 10395 /** 10396 * Reset the recursion counter. 10397 */ 10398 self.resetRecursion = function () { 10399 self.recursionCounter = 0 10400 } 10401 10402 /** 10403 * Check if it's the current action. 10404 * 10405 * @param {string} action The action name. 10406 * @return {boolean} Returns TRUE if it's the current action, FALSE if not. 10407 */ 10408 self.isAction = function (action) { 10409 sweSikaDownloadsDebugger.debuggingFunc(sweSikaDownloadsDebugger.DEBUG_FUNC_START, 'sweSikaDownloadsHelper.isAction') 10410 let root = self.getElement('.' + sweSikaDownloadsDebugger.getExtClass()) 10411 10412 if (!root || !root.hasAttribute('data-action')) { 10413 sweSikaDownloadsDebugger.debug('This isn\'t an action of this extension!', sweSikaDownloadsDebugger.LEVEL_WARNING) 10414 sweSikaDownloadsDebugger.debuggingFunc(sweSikaDownloadsDebugger.DEBUG_FUNC_END) 10415 return false 10416 } 10417 10418 let realAction = root.getAttribute('data-action') 10419 sweSikaDownloadsDebugger.debug('Action ' + realAction.toLowerCase() + ' === ' + action.toLowerCase(), sweSikaDownloadsDebugger.LEVEL_DEBUG) 10420 10421 sweSikaDownloadsDebugger.debuggingFunc(sweSikaDownloadsDebugger.DEBUG_FUNC_END) 10422 return realAction.toLowerCase() === action.toLowerCase() 10423 } 10424 10425 /** 10426 * Check is the current action is one of the given actions. 10427 * 10428 * @param {string[]} actions The action names. 10429 * @return {boolean} Returns TRUE if the current action is one of the given actions, FALSE if not. 10430 */ 10431 self.isOneOfActions = function (actions) { 10432 sweSikaDownloadsDebugger.debuggingFunc(sweSikaDownloadsDebugger.DEBUG_FUNC_START, 'sweSikaDownloadsHelper.isOneOfActions') 10433 for (let i = 0; i < actions.length; i += 1) { 10434 if (!self.isAction(actions[i])) continue 10435 sweSikaDownloadsDebugger.debuggingFunc(sweSikaDownloadsDebugger.DEBUG_FUNC_END) 10436 return true 10437 } 10438 10439 sweSikaDownloadsDebugger.debuggingFunc(sweSikaDownloadsDebugger.DEBUG_FUNC_END) 10440 return false 10441 } 10442 10443 /** 10444 * Set up module sweSikaDownloadsHelper. 10445 */ 10446 self.setup = function () { 10447 _check() 10448 _setAllHtmlTagNames() 10449 10450 return self 10451 } 10452 10453})(window.sweSikaDownloadsHelper) 10454 10455window.sweSikaDownloadsIE = {}; 10456 10457(function (self) { 10458 'use strict' 10459 10460 /*********** 10461 * Private * 10462 ***********/ 10463 10464 let _requiredModules = [ 10465 'sweSikaDownloadsHelper' 10466 ], 10467 _suggestedModules = [], 10468 _filename = 'swe-ie', 10469 _checked = false, 10470 _isIE = false, 10471 _extClass = '' 10472 10473 /** 10474 * @private 10475 */ 10476 function _check () { 10477 if (_checked) return 10478 if (!sweSikaDownloadsDebugger) throw '[' + _filename + '.js] Required namespace "sweSikaDownloadsDebugger" not found.' 10479 10480 sweSikaDownloadsDebugger.checkModules(_requiredModules, 'required', true, _filename) 10481 sweSikaDownloadsDebugger.checkModules(_suggestedModules, 'suggested', false, _filename) 10482 _checked = true 10483 } 10484 10485 /** 10486 * @private 10487 */ 10488 function _initScrollableTables () { 10489 sweSikaDownloadsDebugger.debuggingFunc(sweSikaDownloadsDebugger.DEBUG_FUNC_START, 'sweSikaDownloadsIE._initScrollableTables') 10490 let tables = sweSikaDownloadsHelper.getElements('.scrollable table') 10491 10492 for (let i = 0; i < tables.length; i += 1) { 10493 let table = tables[i], 10494 tableHeaders = sweSikaDownloadsHelper.getElements('th', table), 10495 maxWidth = 0 10496 10497 for (let j = 0; j < tableHeaders.length; j += 1) { 10498 let width = tableHeaders[j].offsetWidth 10499 10500 maxWidth = width > maxWidth ? width : maxWidth 10501 } 10502 10503 for (let j = 0; j < tableHeaders.length; j += 1) { 10504 tableHeaders[j].style.width = maxWidth + 'px' 10505 } 10506 10507 table.style.marginLeft = maxWidth + 'px' 10508 } 10509 sweSikaDownloadsDebugger.debuggingFunc(sweSikaDownloadsDebugger.DEBUG_FUNC_END) 10510 } 10511 10512 /************* 10513 * Polyfills * 10514 *************/ 10515 10516 let polyfills = { 10517 10518 /** 10519 * Initiate all polyfills. 10520 */ 10521 setup: function () { 10522 for (let method in this) {
10523 if (!this.hasOwnProperty(method)) continue 10524 if (method === 'setup') continue 10525 this[method]() 10526 } 10527 }, 10528 10529 /** 10530 * Enables "String.includes()". 10531 */ 10532 includes: function () { 10533 String.prototype.includes = function (search, start) { 10534 'use strict' 10535 10536 if (typeof start !== 'number') start = 0 10537 10538 if (start + search.length > this.length) { 10539 return false 10540 } 10541 10542 return this.indexOf(search, start) !== -1 10543 } 10544 }, 10545 10546 /** 10547 * Enables "SVGElement.classList" with "contains", "add", "remove" and "toggle". 10548 */ 10549 svgClassList: function () { 10550 Object.defineProperty(SVGElement.prototype, 'classList', { 10551 get: function get () { 10552 let _this = this 10553 10554 return { 10555 contains: function contains (className) { 10556 return _this.className.baseVal.split(' ').indexOf(className) !== 1 10557 }, 10558 add: function add (className) { 10559 return _this.setAttribute('class', _this.getAttribute('class') + ' ' + className) 10560 }, 10561 remove: function remove (className) { 10562 let removedClass = _this 10563 .getAttribute('class') 10564 .replace( 10565 new RegExp('(\\s|^)'.concat(className, '(\\s|$)'), 'g'), 10566 '$2' 10567 ) 10568 10569 if (_this.classList.contains(className)) { 10570 _this.setAttribute('class', removedClass) 10571 } 10572 }, 10573 toggle: function toggle (className) { 10574 if (this.contains(className)) { 10575 this.remove(className) 10576 } else { 10577 this.add(className) 10578 } 10579 }, 10580 } 10581 } 10582 }) 10583 }, 10584 } 10585 10586 /********** 10587 * Public * 10588 **********/ 10589 10590 /** 10591 * @return {boolean} 10592 */ 10593 self.isIE = function () { 10594 return _isIE 10595 } 10596 10597 /** 10598 * Set up module sweSikaDownloadsIE. 10599 */ 10600 self.setup = function (extClass) { 10601 _check() 10602 _extClass = extClass 10603 _isIE = !!window.MSInputMethodContext && !!document.documentMode 10604 if (!_isIE) return self 10605 10606 sweSikaDownloadsHelper.addDomClass(sweSikaDownloadsHelper.getElement('.' + _extClass), 'ie') 10607 _initScrollableTables() 10608 polyfills.setup() 10609 10610 return self 10611 } 10612 10613})(window.sweSikaDownloadsIE) 10614 10615window.sweSikaDownloadsMapConstruct = {}; 10616 10617(function (self) { 10618 'use strict' 10619 10620 /*********** 10621 * Private * 10622 ***********/ 10623 10624 let _requiredModules = [ 10625 'google', 10626 ], 10627 _suggestedModules = [ 10628 'MarkerClusterer', 10629 ], 10630 _checked = false, 10631 _filename = 'swe-map-construct', 10632 _markerImagePath = '/typo3conf/ext/swe_sika_downloads/Resources/Public/Images/markerclusterer' 10633 10634 /** 10635 * @private 10636 */ 10637 function _check () { 10638 if (_checked) return 10639 if (!sweSikaDownloadsDebugger) throw '[' + _filename + '.js] Required namespace "sweSikaDownloadsDebugger" not found.' 10640 10641 sweSikaDownloadsDebugger.checkModules(_requiredModules, 'required', true, _filename) 10642 sweSikaDownloadsDebugger.checkModules(_suggestedModules, 'suggested', false, _filename) 10643 _checked = true 10644 } 10645 10646 /********** 10647 * Public * 10648 **********/ 10649 10650 self.__config = { 10651 canvasID: null, 10652 map: null, 10653 markers: [], 10654 marker_icon: { 10655 path: 'M0-48c-9.8 0-17.7 7.8-17.7 17.4 0 15.5 17.7 30.6 17.7 30.6s17.7-15.4 17.7-30.6c0-9.6-7.9-17.4-17.7-17.4z', 10656 fillColor: '#111', 10657 fillOpacity: 1, 10658 strokeColor: '', 10659 strokeWeight: 0, 10660 }, 10661 line_start_icon: null, 10662 line_end_icon: null, 10663 lines: [], 10664 circles: [], 10665 bounds: null, 10666 infoWindow: null, 10667 marker_clusterer: null, 10668 options: { 10669 center: { 10670 lat: 51.313361, 10671 lng: 9.486890, 10672 }, 10673 zoom: 8, 10674 minZoom: 5, 10675 maxZoom: 14, 10676 zoomControl: true, 10677 mapTypeControl: true, 10678 scaleControl: true, 10679 streetViewControl: true, 10680 rotateControl: true, 10681 scrollwheel: false, 10682 draggable: window.innerWidth > 1024, 10683 mapTypeControlOptions: { 10684 mapTypeIds: ['grey',], 10685 }, 10686 }, 10687 styles: [ 10688 { 10689 key: 'grey', 10690 label: 'Map', 10691 config: [ 10692 { 10693 'featureType': 'landscape', 10694 'stylers': [{ 'color': '#f9f9f9', },], 10695 }, 10696 { 10697 'featureType': 'road.highway', 10698 'stylers': [{ 'color': '#eaeaea', },], 10699 }, 10700 { 10701 'featureType': 'transit', 10702 'stylers': [{ 'color': '#eaeaea', },], 10703 }, 10704 { 10705 'featureType': 'water', 10706 'stylers': [{ 'color': '#eaeaea', },], 10707 }, 10708 { 10709 'featureType': 'poi', 10710 'elementType': 'geometry', 10711 'stylers': [{ 'color': '#eaeaea', },], 10712 }, 10713 { 10714 'elementType': 'labels.text.fill', 10715 'stylers': [{ 'color': '#808080', },], 10716 }, 10717 ], 10718 }, 10719 ], 10720 } 10721 10722 /** 10723 * Set the marker image path. 10724 * 10725 * @param {string} imagePath path to image directory without a trailing slash. 10726 */ 10727 self.setMarkerImagePath = function (imagePath) { 10728 _check() 10729 sweSikaDownloadsDebugger.debuggingFunc(sweSikaDownloadsDebugger.DEBUG_FUNC_CALLED, 'sweSikaDownloadsMapConstruct.setMarkerImagePath') 10730 _markerImagePath = imagePath 10731 } 10732 10733 /** 10734 * @param {number} lat 10735 * @return {number} 10736 */ 10737 self.getMetersPerPixes = function (lat) { 10738 _check() 10739 sweSikaDownloadsDebugger.debuggingFunc(sweSikaDownloadsDebugger.DEBUG_FUNC_CALLED, 'sweSikaDownloadsMapConstruct.getMetersPerPixes') 10740 if (!self.__config.map) return 0 10741 10742 return 156543.03392 * Math.cos(lat * Math.PI / 180) / Math.pow(2, self.__config.map.getZoom()) 10743 } 10744 10745 /** 10746 * 10747 */ 10748 self.resetBounds = function () { 10749 _check() 10750 sweSikaDownloadsDebugger.debuggingFunc(sweSikaDownloadsDebugger.DEBUG_FUNC_CALLED, 'sweSikaDownloadsMapConstruct.resetBounds') 10751 if (!self.__config.map) return 10752
10753 self.__config.bounds = new google.maps.LatLngBounds() 10754 } 10755 10756 /** 10757 * 10758 */ 10759 self.fitCirclesBounds = function () { 10760 _check() 10761 sweSikaDownloadsDebugger.debuggingFunc(sweSikaDownloadsDebugger.DEBUG_FUNC_CALLED, 'sweSikaDownloadsMapConstruct.fitCirclesBounds') 10762 if (!self.__config.map) return 10763 10764 if (!self.__config.bounds) { 10765 self.__config.bounds = new google.maps.LatLngBounds() 10766 } 10767 10768 if (self.__config.circles.length === 1) { 10769 self.__config.bounds = self.__config.circles[0].getBounds() 10770 } 10771 10772 if (self.__config.circles.length > 1) { 10773 for (let i = 0; i < self.__config.circles.length; i += 1) { 10774 let circle = self.__config.circles[i] 10775 10776 self.__config.bounds.extend(circle.center) 10777 } 10778 } 10779 10780 self.__config.map.fitBounds(self.__config.bounds) 10781 } 10782 10783 /** 10784 * 10785 */ 10786 self.fitMarkersBounds = function () { 10787 _check() 10788 sweSikaDownloadsDebugger.debuggingFunc(sweSikaDownloadsDebugger.DEBUG_FUNC_START, 'sweSikaDownloadsMapConstruct.fitMarkersBounds') 10789 if (!self.__config.map) { 10790 sweSikaDownloadsDebugger.debug('Map is not a google maps instance', sweSikaDownloadsDebugger.LEVEL_WARNING) 10791 sweSikaDownloadsDebugger.debuggingFunc(sweSikaDownloadsDebugger.DEBUG_FUNC_END) 10792 return 10793 } 10794 10795 if (!self.__config.bounds) { 10796 self.__config.bounds = new google.maps.LatLngBounds() 10797 } 10798 10799 if (self.__config.markers.length >= 1) { 10800 for (let i = 0; i < self.__config.markers.length; i += 1) { 10801 let marker = self.__config.markers[i], 10802 position = new google.maps.LatLng(marker.position.lat(), marker.position.lng()) 10803 10804 self.__config.bounds.extend(position) 10805 } 10806 } 10807 10808 self.__config.map.fitBounds(self.__config.bounds) 10809 sweSikaDownloadsDebugger.debuggingFunc(sweSikaDownloadsDebugger.DEBUG_FUNC_END) 10810 } 10811 10812 /** 10813 * 10814 */ 10815 self.fitLinesBounds = function () { 10816 _check() 10817 sweSikaDownloadsDebugger.debuggingFunc(sweSikaDownloadsDebugger.DEBUG_FUNC_CALLED, 'sweSikaDownloadsMapConstruct.fitLinesBounds') 10818 if (!self.__config.map) return 10819 10820 if (!self.__config.bounds) { 10821 self.__config.bounds = new google.maps.LatLngBounds() 10822 } 10823 10824 for (let i = 0; i < self.__config.lines.length; i += 1) { 10825 let line = self.__config.lines[i], 10826 coords = line.getPath() 10827 10828 for (let j = 0; j < coords.length; j += 1) { 10829 let coordinate = coords.getAt(j), 10830 position = new google.maps.LatLng(coordinate.lat(), coordinate.lng()) 10831 10832 self.__config.bounds.extend(position) 10833 } 10834 } 10835 10836 self.__config.map.fitBounds(self.__config.bounds) 10837 } 10838 10839 /** 10840 * @param icon 10841 */ 10842 self.setMarkerIcon = function (icon) { 10843 _check() 10844 sweSikaDownloadsDebugger.debuggingFunc(sweSikaDownloadsDebugger.DEBUG_FUNC_CALLED, 'sweSikaDownloadsMapConstruct.setMarkerIcon') 10845 self.__config.marker_icon = icon 10846 } 10847 10848 /** 10849 * @param icon 10850 */ 10851 self.setLineStartIcon = function (icon) { 10852 _check() 10853 sweSikaDownloadsDebugger.debuggingFunc(sweSikaDownloadsDebugger.DEBUG_FUNC_CALLED, 'sweSikaDownloadsMapConstruct.setLineStartIcon') 10854 self.__config.line_start_icon = icon 10855 } 10856 10857 /** 10858 * @param icon 10859 */ 10860 self.setLineEndIcon = function (icon) { 10861 _check() 10862 sweSikaDownloadsDebugger.debuggingFunc(sweSikaDownloadsDebugger.DEBUG_FUNC_CALLED, 'sweSikaDownloadsMapConstruct.setLineEndIcon') 10863 self.__config.line_end_icon = icon 10864 } 10865 10866 /** 10867 * @return {number} 10868 */ 10869 self.countMarkers = function () { 10870 _check() 10871 sweSikaDownloadsDebugger.debuggingFunc(sweSikaDownloadsDebugger.DEBUG_FUNC_CALLED, 'sweSikaDownloadsMapConstruct.countMarkers') 10872 return self.__config.markers.length 10873 } 10874 10875 /** 10876 * @param marker 10877 * @param onClickHtml 10878 */ 10879 self.showMarkerInfo = function (marker, onClickHtml) { 10880 _check() 10881 sweSikaDownloadsDebugger.debuggingFunc(sweSikaDownloadsDebugger.DEBUG_FUNC_CALLED, 'sweSikaDownloadsMapConstruct.showMarkerInfo') 10882 self.__config.infoWindow.setContent(onClickHtml) 10883 self.__config.infoWindow.open(self.__config.map, marker) 10884 } 10885 10886 /** 10887 * @param index 10888 * @return {*} 10889 */ 10890 self.getMarker = function (index) { 10891 _check() 10892 sweSikaDownloadsDebugger.debuggingFunc(sweSikaDownloadsDebugger.DEBUG_FUNC_CALLED, 'sweSikaDownloadsMapConstruct.getMarker') 10893 return self.__config.markers[index] 10894 } 10895 10896 /** 10897 * @param {number} lat 10898 * @param {number} lng 10899 * @param onClickHtml 10900 * @param icon 10901 * @param {string} iconColor 10902 * @param {string} title 10903 * @param {boolean} openWindow 10904 * @return {*} 10905 */ 10906 self.addMarker = function (lat, lng, onClickHtml, icon, iconColor, title, openWindow) { 10907 _check() 10908 sweSikaDownloadsDebugger.debuggingFunc(sweSikaDownloadsDebugger.DEBUG_FUNC_START, 'sweSikaDownloadsMapConstruct.addMarker') 10909 10910 if (!self.__config.map) { 10911 sweSikaDownloadsDebugger.debuggingFunc(sweSikaDownloadsDebugger.DEBUG_FUNC_END) 10912 return null 10913 } 10914 10915 let __icon = self.__config.marker_icon, 10916 __title = '' 10917 10918 if (icon) __icon = icon === 'default' ? self.__config.marker_icon : icon 10919 if (iconColor && (typeof icon !== 'string' || icon === 'default')) __icon.fillColor = iconColor === 'default' ? __icon.fillColor : iconColor 10920 if (title) __title = title 10921 10922 let marker = new google.maps.Marker({ 10923 position: new google.maps.LatLng(lat, lng), 10924 icon: __icon, 10925 title: __title, 10926 map: self.__config.map, 10927 }) 10928 10929 if (onClickHtml) { 10930 google.maps.event.addListener(marker, 'click', function () { 10931 self.__config.infoWindow.setContent(onClickHtml) 10932 self.__config.infoWindow.open(self.__config.map, marker) 10933 }) 10934 10935 if (openWindow) { 10936 self.__config.infoWindow.setContent(onClickHtml) 10937 self.__config.infoWindow.open(self.__config.map, marker) 10938 } 10939 } 10940 10941 self.__config.markers.push(marker) 10942 10943 sweSikaDownloadsDebugger.debuggingFunc(sweSikaDownloadsDebugger.DEBUG_FUNC_END) 10944 return marker 10945 } 10946 10947 /** 10948 * 10949 */ 10950 self.removeMarkers = function () { 10951 _check() 10952 sweSikaDownloadsDebugger.debuggingFunc(sweSikaDownloadsDebugger.DEBUG_FUNC_CALLED, 'sweSikaDownloadsMapConstruct.removeMarkers') 10953 for (let i = 0; i < self.__config.markers.length; i += 1) { 10954 let marker = self.__config.markers[i] 10955 marker.setMap(null) 10956 } 10957 10958 self.__config.markers = [] 10959 } 10960 10961 /** 10962 * @param coords 10963 * @param {object} style 10964 * @param fclick 10965 * @return {*} 10966 */ 10967 self.addLine = function (coords, style, fclick) { 10968 _check() 10969 sweSikaDownloadsDebugger.debuggingFunc(sweSikaDownloadsDebugger.DEBUG_FUNC_CALLED, 'sweSikaDownloadsMapConstruct.addLine') 10970 if (!self.__config.map) return null 10971 10972 let line_icons = [] 10973 10974 if (self.__config.line_start_icon !== null) { 10975 line_icons.push({ 10976 icon: self.__config.line_start_icon, 10977 offset: '0%', 10978 }) 10979 } 10980 10981 if (self.__config.line_end_icon !== null) { 10982 line_icons.push({ 10983 icon: self.__config.line_end_icon,
10984 offset: '100%', 10985 }) 10986 } 10987 10988 let line = new google.maps.Polyline({ 10989 path: coords, 10990 icons: line_icons, 10991 map: self.__config.map, 10992 strokeColor: style.strokeColor, 10993 strokeOpacity: style.strokeOpacity, 10994 strokeWeight: style.strokeWeight, 10995 }) 10996 10997 self.__config.lines.push(line) 10998 10999 if (typeof fclick === 'function') { 11000 google.maps.event.addListener(line, 'click', fclick) 11001 } 11002 11003 return line 11004 } 11005 11006 /** 11007 * 11008 */ 11009 self.removeLines = function () { 11010 _check() 11011 sweSikaDownloadsDebugger.debuggingFunc(sweSikaDownloadsDebugger.DEBUG_FUNC_CALLED, 'sweSikaDownloadsMapConstruct.removeLines') 11012 for (let i = 0; i < self.__config.lines.length; i += 1) { 11013 let line = self.__config.lines[i] 11014 line.setMap(null) 11015 } 11016 11017 self.__config.lines = [] 11018 } 11019 11020 /** 11021 * @param {number} centerLat 11022 * @param {number} centerLng 11023 * @param {number} radius 11024 * @param {object} style 11025 * @return {*} 11026 */ 11027 self.addCircle = function (centerLat, centerLng, radius, style) { 11028 _check() 11029 sweSikaDownloadsDebugger.debuggingFunc(sweSikaDownloadsDebugger.DEBUG_FUNC_CALLED, 'sweSikaDownloadsMapConstruct.addCircle') 11030 if (!self.__config.map) return null 11031 11032 let circle = new google.maps.Circle({ 11033 strokeColor: style.strokeColor, 11034 strokeOpacity: style.strokeOpacity, 11035 strokeWeight: style.strokeWeight, 11036 fillColor: style.fillColor, 11037 fillOpacity: style.fillOpacity, 11038 map: self.__config.map, 11039 center: { 11040 lat: centerLat, 11041 lng: centerLng, 11042 }, 11043 radius: radius * 1000, 11044 }) 11045 11046 self.__config.circles.push(circle) 11047 11048 return circle 11049 } 11050 11051 /** 11052 * 11053 */ 11054 self.removeCircles = function () { 11055 _check() 11056 sweSikaDownloadsDebugger.debuggingFunc(sweSikaDownloadsDebugger.DEBUG_FUNC_CALLED, 'sweSikaDownloadsMapConstruct.removeCircles') 11057 for (let i = 0; i < self.__config.circles.length; i += 1) { 11058 let circle = self.__config.circles[i] 11059 circle.setMap(null) 11060 } 11061 11062 self.__config.circles = [] 11063 } 11064 11065 /** 11066 * 11067 */ 11068 self.showMarkerClusters = function () { 11069 _check() 11070 sweSikaDownloadsDebugger.debuggingFunc(sweSikaDownloadsDebugger.DEBUG_FUNC_START, 'sweSikaDownloadsMapConstruct.showMarkerClusters') 11071 self.clearMarkerClusters() 11072 11073 if (!self.__config.map || typeof MarkerClusterer !== 'function') return 11074 11075 let _markers = [] 11076 11077 for (let i = 0; i < self.__config.markers.length; i += 1) { 11078 let marker = self.__config.markers[i] 11079 _markers.push(marker) 11080 } 11081 11082 self.__config.marker_clusterer = new MarkerClusterer(self.__config.map, _markers, { imagePath: _markerImagePath + '/m', }) 11083 sweSikaDownloadsDebugger.debuggingFunc(sweSikaDownloadsDebugger.DEBUG_FUNC_END) 11084 } 11085 11086 /** 11087 * 11088 */ 11089 self.clearMarkerClusters = function () { 11090 _check() 11091 sweSikaDownloadsDebugger.debuggingFunc(sweSikaDownloadsDebugger.DEBUG_FUNC_CALLED, 'sweSikaDownloadsMapConstruct.clearMarkerClusters') 11092 if (self.__config.marker_clusterer !== null && typeof self.__config.marker_clusterer === 'object') { 11093 self.__config.marker_clusterer.clearMarkers() 11094 } 11095 11096 self.__config.marker_clusterer = null 11097 } 11098})(window.sweSikaDownloadsMapConstruct) 11099 11100window.sweSikaDownloadsMaps = {}; 11101 11102(function (self) { 11103 'use strict' 11104 11105 /*********** 11106 * Private * 11107 ***********/ 11108 11109 const CUSTOM_STYLE = true, 11110 STYLE = 'roadmap' 11111 11112 let _requiredModules = [ 11113 'google', 11114 'sweSikaDownloadsMapConstruct', 11115 'sweSikaDownloadsHelper', 11116 ], 11117 _suggestedModules = [], 11118 _checked = false, 11119 _filename = 'swe-maps', 11120 _api = '', 11121 _src = 'https://maps.googleapis.com/maps/api/js' 11122 11123 /** 11124 * @private 11125 */ 11126 function _check () { 11127 if (_checked) return 11128 if (!sweSikaDownloadsDebugger) throw '[' + _filename + '.js] Required namespace "sweSikaDownloadsDebugger" not found.' 11129 11130 sweSikaDownloadsDebugger.checkModules(_requiredModules, 'required', true, _filename) 11131 sweSikaDownloadsDebugger.checkModules(_suggestedModules, 'suggested', false, _filename) 11132 _checked = true 11133 } 11134 11135 /** 11136 * @param {string} src 11137 * @param {function} callback 11138 * @private 11139 */ 11140 function _addScript (src, callback) { 11141 let script = document.createElement('script') 11142 script.type = 'text/javascript' 11143 if (typeof callback === 'function') script.onload = callback 11144 document.getElementsByTagName('head')[0].appendChild(script) 11145 script.src = src 11146 } 11147 11148 /** 11149 * Merge options. 11150 * 11151 * @param {object} custom 11152 * @param {object} options 11153 * @private 11154 */ 11155 function _mergeOptions (custom, options) { 11156 Object.keys(custom).forEach(function (key) { 11157 options[key] = custom[key] 11158 }) 11159 } 11160 11161 /********** 11162 * Public * 11163 **********/ 11164 11165 /** 11166 * @param {string} src 11167 */ 11168 self.setSrc = function (src) { 11169 _src = src 11170 } 11171 11172 /** 11173 * @param {string} api 11174 */ 11175 self.setApi = function (api) { 11176 _api = api 11177 } 11178 11179 /** 11180 * @param {object} center 11181 * @param {number} center.lat 11182 * @param {number} center.lng 11183 * @param {object} map 11184 */ 11185 self.setCenter = function (center, map) { 11186 map.__config.map.setCenter(center) 11187 } 11188 11189 /** 11190 * @param {object} map 11191 */ 11192 self.resetCenter = function (map) { 11193 self.setCenter(map.__config.options.center, map) 11194 } 11195 11196 /** 11197 * @param {object} map 11198 */ 11199 self.zoomOutMax = function (map) { 11200 self.setZoom(map.__config.options.minZoom, map) 11201 } 11202 11203 /** 11204 * @param {object} map 11205 */ 11206 self.zoomInMax = function (map) { 11207 self.setZoom(map.__config.options.maxZoom, map) 11208 } 11209 11210 /** 11211 * @param {number} zoom 11212 * @param {object} map 11213 */ 11214 self.setZoom = function (zoom, map) { 11215 map.__config.map.setZoom(zoom) 11216 } 11217 11218 /** 11219 * @param {object} map 11220 */ 11221 self.resetZoom = function (map) { 11222 self.setZoom(map.__config.options.zoom, map) 11223 } 11224 11225 /** 11226 * @param {function} callback 11227 */ 11228 self.load = function (callback) { 11229 if (!sweSikaDownloadsHelper.isCookieAllowed()) return 11230 11231 let src = _src 11232 if (_api.length > 0) src += '?key=' + _api 11233 11234 setTimeout(function () { 11235 if (typeof google === 'undefined') { 11236 _addScript(src, callback) 11237 return 11238 } 11239 11240 callback() 11241 }, 500) 11242 } 11243 11244 /** 11245 * Create a new swe maps instance. 11246 * 11247 * @param {object} map 11248 * @param {string} canvasId 11249 * @return sweSikaDownloadsMapConstruct|{} 11250 */ 11251 self.create = function (map, canvasId) { 11252 if (!map) map = {} 11253 if (typeof canvasId !== 'string' || canvasId.length < 1) return map 11254 if (!sweSikaDownloadsHelper.getElement(canvasId)) return map 11255 11256 _check() 11257 _mergeOptions(sweSikaDownloadsMapConstruct, map) 11258 11259 if (!CUSTOM_STYLE) { 11260 switch (STYLE.toLowerCase()) { 11261 case 'terrain': 11262 map.__config.options.mapTypeId = google.maps.MapTypeId.TERRAIN 11263 break 11264 case 'satellite': 11265 map.__config.options.mapTypeId = google.maps.MapTypeId.SATELLITE 11266 break 11267 case 'hybrid': 11268 map.__config.options.mapTypeId = google.maps.MapTypeId.HYBRID 11269 break 11270 case 'roadmap': 11271 default: 11272 map.__config.options.mapTypeId = google.maps.MapTypeId.ROADMAP 11273 } 11274 } 11275 11276 map.__config.canvasID = canvasId 11277 let mapCanvas = sweSikaDownloadsHelper.getElement(canvasId) 11278 if (!mapCanvas) return map 11279 sweSikaDownloadsHelper.removeDomClass(mapCanvas, 'no-cookie') 11280 let newMap = new google.maps.Map(mapCanvas, map.__config.options) 11281 11282 if (CUSTOM_STYLE) { 11283 for (let i = 0; i < map.__config.styles.length; i += 1) { 11284 let style = map.__config.styles[i], 11285 mapType = new google.maps.StyledMapType(style.config, { name: style.label }) 11286 newMap.mapTypes.set(style.key, mapType) 11287 newMap.setMapTypeId(style.key) 11288 } 11289 } 11290 11291 google.maps.event.addDomListener(window, 'resize', function () { 11292 let center = newMap.getCenter() 11293 google.maps.event.trigger(newMap, 'resize') 11294 newMap.setCenter(center) 11295 newMap.set('draggable', window.innerWidth > 1024) 11296 }) 11297 11298 map.__config.map = newMap 11299 map.__config.infoWindow = new google.maps.InfoWindow({ content: '' }) 11300 11301 return map 11302 } 11303 11304})(window.sweSikaDownloadsMaps) 11305 11306window.sweSikaDownloadsAjax = {} 11307 11308/******** 11309 * Ajax * 11310 ********/ 11311 11312// https://github.com/yanatan16/nanoajax 11313!function (t, e) { 11314 function n (t) {return t && e.XDomainRequest && !/MSIE 1/.test(navigator.userAgent) ? new XDomainRequest : e.XMLHttpRequest ? new XMLHttpRequest : void 0} 11315 11316 function o (t, e, n) {t[e] = t[e] || n} 11317 11318 var r = ['responseType', 'withCredentials', 'timeout', 'onprogress'] 11319 t.ajax = function (t, a) { 11320 function s (t, e) {return function () {c || (a(void 0 === f.status ? t : f.status, 0 === f.status ? 'Error' : f.response || f.responseText || e, f), c = !0)}} 11321 11322 var u = t.headers || {}, i = t.body, d = t.method || (i ? 'POST' : 'GET'), c = !1, f = n(t.cors) 11323 f.open(d, t.url, !0) 11324 var l = f.onload = s(200) 11325 f.onreadystatechange = function () {4 === f.readyState && l()}, f.onerror = s(null, 'Error'), f.ontimeout = s(null, 'Timeout'), f.onabort = s(null, 'Abort'), i && (o(u, 'X-Requested-With', 'XMLHttpRequest'), e.FormData && i instanceof e.FormData || o(u, 'Content-Type', 'application/x-www-form-urlencoded')) 11326 for (var p, m = 0, v = r.length; v > m; m++) p = r[m], void 0 !== t[p] && (f[p] = t[p]) 11327 for (var p in u) f.setRequestHeader(p, u[p]) 11328 return f.send(i), f 11329 }, e.nanoajax = t 11330}({}, function () {return this}()) 11331 11332;(function (self) { 11333 'use strict' 11334 11335 /*********** 11336 * Private * 11337 ***********/ 11338 11339 let _requiredModules = [], 11340 _suggestedModules = [],
11341 _filename = 'swe-ajax', 11342 _checked = false, 11343 _ajaxUrl = '', 11344 _ajaxStoragePid = '', 11345 _ajaxPageType = '' 11346 11347 /** 11348 * @private 11349 */ 11350 function _check () { 11351 if (_checked) return 11352 if (!sweSikaDownloadsDebugger) throw '[' + _filename + '.js] Required namespace "sweSikaDownloadsDebugger" not found.' 11353 11354 sweSikaDownloadsDebugger.checkModules(_requiredModules, 'required', true, _filename) 11355 sweSikaDownloadsDebugger.checkModules(_suggestedModules, 'suggested', false, _filename) 11356 _checked = true 11357 } 11358 11359 /********** 11360 * Public * 11361 **********/ 11362 11363 /** 11364 * @param {string} url 11365 * @param {object} postData 11366 * @param {function} processResponse 11367 */ 11368 self.post = function (url, postData, processResponse) { 11369 if (!_checked) return 11370 11371 let body = 'json=' + encodeURIComponent(JSON.stringify(postData)), 11372 info = { 11373 timeout: 0, 11374 url: url, 11375 method: 'POST', 11376 body: body, 11377 } 11378 11379 let postCallback = function (code, responseText, request) { 11380 if (code !== 200) { 11381 sweSikaDownloadsDebugger.error(responseText, sweSikaDownloadsDebugger.LEVEL_ERROR) 11382 return 11383 } 11384 11385 sweSikaDownloadsDebugger.debug(responseText) 11386 11387 if (typeof processResponse === 'function') processResponse(responseText) 11388 } 11389 11390 window.nanoajax.ajax(info, postCallback) 11391 } 11392 11393 /** 11394 * @param {string} url 11395 * @param {function} processResponse 11396 */ 11397 self.get = function (url, processResponse) { 11398 if (!_checked) return 11399 11400 let info = { 11401 url: url, 11402 method: 'GET', 11403 } 11404 11405 let getCallback = function (code, responseText, request) { 11406 if (code !== 200) { 11407 sweSikaDownloadsDebugger.error(responseText, sweSikaDownloadsDebugger.LEVEL_ERROR) 11408 return 11409 } 11410 11411 sweSikaDownloadsDebugger.debug(responseText) 11412 11413 if (typeof processResponse === 'function') processResponse(responseText) 11414 } 11415 11416 window.nanoajax.ajax(info, getCallback) 11417 } 11418 11419 /** 11420 * @return {string} 11421 */ 11422 self.getDefaultUrl = function () { 11423 return '/?type=' + _ajaxPageType 11424 } 11425 11426 /** 11427 * @return {string} 11428 */ 11429 self.getUrl = function () { 11430 if(_ajaxUrl !== ''){ 11431 return _ajaxUrl; 11432 } 11433 return self.getDefaultUrl(); 11434 } 11435 11436 /** 11437 * @return {string} 11438 */ 11439 self.getStoragePid = function () { 11440 return _ajaxStoragePid; 11441 } 11442 11443 /** 11444 * @param {string} extClass 11445 */ 11446 self.setup = function (extClass) { 11447 _check() 11448 let element = sweSikaDownloadsHelper.getElement(extClass + '-debug') 11449 if (!element) return 11450 11451 _ajaxUrl = element.getAttribute('data-ajax-url') 11452 _ajaxStoragePid = element.getAttribute('data-ajax-pid') 11453 _ajaxPageType = element.getAttribute('data-ajax-type') 11454 } 11455}) 11456(sweSikaDownloadsAjax) 11457window.sweSikaDownloads = {}; 11458 11459(function (self) { 11460 'use strict' 11461 11462 /*********** 11463 * Private * 11464 ***********/ 11465 11466 /** 11467 * The extension class. 11468 * 11469 * @type {string} 11470 */ 11471 const _extClass = 'tx-swesikadownloads' 11472 11473 let _requiredModules = [ 11474 'sweSikaDownloadsHelper', 11475 ], 11476 _suggestedModules = [], 11477 _checked = false, 11478 _filename = 'main', 11479 _selectors = { 11480 search_input: 'input-search', 11481 select_category: 'select-category', 11482 select_section: 'select-section', 11483 select_language: '#language-select', 11484 container: '.ext-downloads-container', 11485 download_line: '.download-line', 11486 download_line_border: '.download-line-border', 11487 } 11488 11489 /** 11490 * @private 11491 */ 11492 function _check () { 11493 if (_checked) return 11494 if (!sweSikaDownloadsDebugger) throw '[' + _filename + '.js] Required namespace "sweSikaDownloadsDebugger" not found.' 11495 11496 sweSikaDownloadsDebugger.setExtClass(_extClass) 11497 sweSikaDownloadsDebugger.checkModules(_requiredModules, 'required', true, _filename) 11498 sweSikaDownloadsDebugger.checkModules(_suggestedModules, 'suggested', false, _filename) 11499 _checked = true 11500 } 11501 11502 /** 11503 * @param response 11504 * @private 11505 */ 11506 function _responseData(response) { 11507 try { 11508 response = JSON.parse(response) 11509 } catch (e) { 11510 } 11511 11512 if (response.hasOwnProperty('data') && response.data.hasOwnProperty('sections')) { 11513 let selectSection = sweSikaDownloadsHelper.getElement(_selectors.select_section), 11514 firstLabel = selectSection.firstElementChild.innerHTML, 11515 optionFormat = '<option value="VALUE">LABEL</option>', 11516 options = [ 11517 optionFormat.replace('VALUE', '0').replace('LABEL', firstLabel) 11518 ] 11519 11520 for (let name in response.data.sections) { 11521 let ids = response.data.sections[name] 11522 options.push(optionFormat.replace('VALUE', ids).replace('LABEL', name)) 11523 } 11524 11525 selectSection.innerHTML = options.join('') 11526 selectSection.removeAttribute('disabled') 11527 11528 return 11529 } 11530 11531 let dom = document.createElement('html'); 11532 dom.innerHTML = response;
11533 let container = sweSikaDownloadsHelper.getElement(_selectors.container) 11534 11535 if (container != null) { 11536 container.innerHTML = dom.querySelector(_selectors.container).innerHTML 11537 _initLanguageSelectAfterLoad() 11538 _search() 11539 } 11540 } 11541 11542 /** 11543 * @private 11544 */ 11545 function _initSelectBoxes() { 11546 let inputSearch = sweSikaDownloadsHelper.getElement(_selectors.search_input) 11547 let selectCategory = sweSikaDownloadsHelper.getElement(_selectors.select_category) 11548 let selectSection = sweSikaDownloadsHelper.getElement(_selectors.select_section) 11549 let container = sweSikaDownloadsHelper.getElement(_selectors.container) 11550 11551 if (inputSearch) { 11552 inputSearch.disabled = true 11553 } 11554 11555 if (selectCategory) { 11556 selectCategory.addEventListener('change', function() { 11557 if (selectCategory.selectedIndex > 0) { 11558 inputSearch.disabled = true 11559 inputSearch.value = '' 11560 selectSection.selectedIndex = 0 11561 container.innerHTML = '' 11562 11563 let data = { 11564 parentId: selectCategory.options[selectCategory.selectedIndex].value, 11565 sectionId: '', 11566 sections: selectSection.getAttribute('data-sections'), 11567 pid: sweSikaDownloadsAjax.getStoragePid() 11568 } 11569 11570 sweSikaDownloadsAjax.post(sweSikaDownloadsAjax.getUrl(), data, _responseData) 11571 } else { 11572 inputSearch.disabled = true 11573 inputSearch.value = '' 11574 selectSection.selectedIndex = 0 11575 selectSection.setAttribute('disabled', 'disabled') 11576 container.innerHTML = '' 11577 } 11578 }) 11579 } 11580 11581 if (selectSection) { 11582 selectSection.setAttribute('disabled', 'disabled') 11583 selectSection.addEventListener('change', function() { 11584 if (selectSection.selectedIndex > 0 && selectCategory.selectedIndex > 0) { 11585 let data = { 11586 parentId: selectCategory.options[selectCategory.selectedIndex].value, 11587 sectionId: selectSection.options[selectSection.selectedIndex].value, 11588 pid: sweSikaDownloadsAjax.getStoragePid() 11589 } 11590 sweSikaDownloadsAjax.post(sweSikaDownloadsAjax.getUrl(), data, _responseData) 11591 inputSearch.disabled = false 11592 } else { 11593 inputSearch.disabled = true 11594 inputSearch.value = '' 11595 container.innerHTML = '' 11596 } 11597 }) 11598 } 11599 } 11600 11601 /** 11602 * @private 11603 */ 11604 function _initLanguageSelectAfterLoad() { 11605 let selectLanguage = sweSikaDownloadsHelper.getElements(_selectors.select_language) 11606 let selectCategory = sweSikaDownloadsHelper.getElement(_selectors.select_category) 11607 11608 let selectField = function(downloadLine, i) { 11609 let downloadLinks = downloadLine.parentElement.lastElementChild.children 11610 if (downloadLinks != null) { 11611 for (let j = 0; j < downloadLinks.length; j += 1) { 11612 let flag = downloadLinks[j].getAttribute('data-flag') 11613 if (selectLanguage[i].options[selectLanguage[i].selectedIndex].value === flag) { 11614 let newLink = downloadLinks[j].getAttribute('data-link') 11615 let link = selectLanguage[i].parentElement.parentElement.lastElementChild.firstElementChild 11616 link.href = newLink 11617 let newTitle = downloadLinks[j].getAttribute('data-tname') 11618 let title = downloadLine.firstElementChild 11619 title.innerHTML = newTitle 11620 let newSize = downloadLinks[j].getAttribute('data-size') 11621 let size = selectLanguage[i].parentElement.parentElement.children[1].lastElementChild 11622 size = newSize 11623 } 11624 } 11625 } 11626 } 11627 11628 if (selectLanguage != null) { 11629 for (let i = 0; i < selectLanguage.length; i += 1) { 11630 let downloadLine = selectLanguage[i].parentElement.parentElement.parentElement 11631 for (let j = 0; j < selectLanguage[i].options.length; j += 1) { 11632 if (selectLanguage[i].options[j].value === selectCategory.getAttribute('data-flag')) { 11633 selectLanguage[i].selectedIndex = j 11634 selectField(downloadLine, i) 11635 } 11636 } 11637 selectLanguage[i].addEventListener('change', function() { 11638 selectField(downloadLine, i) 11639 }) 11640 } 11641 } 11642 } 11643 11644 /** 11645 * SEARCH FUNCTION 11646 * @private 11647 */ 11648 function _search() { 11649 let inputSearch = sweSikaDownloadsHelper.getElement(_selectors.search_input) 11650 let downloadLines = sweSikaDownloadsHelper.getElements(_selectors.download_line_border) 11651 11652 for (let i = 0; i < downloadLines.length; i += 1) { 11653 let title = downloadLines[i].firstElementChild
11654 if (title.innerText.toLowerCase().indexOf(inputSearch.value.toLowerCase()) >= 0) { 11655 downloadLines[i].classList.remove('hidden'); 11656 } else { 11657 downloadLines[i].classList.add('hidden'); 11658 } 11659 } 11660 } 11661 11662 /** 11663 * INIT SEARCH FIELD 11664 * @private 11665 */ 11666 function _initSearchInput() { 11667 let inputSearch = sweSikaDownloadsHelper.getElement(_selectors.search_input) 11668 11669 if (inputSearch != null) { 11670 inputSearch.addEventListener('input', _search) 11671 } 11672 } 11673 11674 /********** 11675 * Public * 11676 **********/ 11677 11678 /** 11679 * Initiate the module. 11680 */ 11681 self.init = function () { 11682 _check() 11683 if (!sweSikaDownloadsHelper.getElement('.' + _extClass)) return 11684 sweSikaDownloadsIE.setup(_extClass) 11685 sweSikaDownloadsAjax.setup(_extClass) 11686 sweSikaDownloadsHelper.setCookieProtection(!sweSikaDownloadsDebugger.isDebug()) 11687 sweSikaDownloadsDebugger.debug('sweSikaDownloads is loaded.', sweSikaDownloadsDebugger.LEVEL_INFO) 11688 11689 _initSelectBoxes() 11690 _initSearchInput() 11691 _initLanguageSelectAfterLoad() 11692 } 11693 11694})(window.sweSikaDownloads) 11695 11696// Initiate this js module when the content is loaded. 11697document.addEventListener('DOMContentLoaded', function () { 11698 try { 11699 window.sweSikaDownloads.init() 11700 } catch (e) { 11701 console.warn('unable to load sweSikaDownloads.') 11702 console.warn(e) 11703 } 11704}) 11705 11706window.sweSikaVertriebspartnerDebugger = {}; 11707 11708(function (self) { 11709 'use strict' 11710 11711 /*********** 11712 * Private * 11713 ***********/ 11714 11715 let _availableModules = {}, 11716 _debug = false, 11717 _extClass = '' 11718 11719 /** 11720 * Add available modules. 11721 * 11722 * @param {string} filename 11723 * @param {string[]} modules 11724 * @private 11725 */ 11726 function _addModules (filename, modules) { 11727 if (!_availableModules.hasOwnProperty(filename)) _availableModules[filename] = [] 11728 11729 for (let i = 0; i < modules.length; i += 1) { 11730 if (_availableModules[filename].indexOf(modules[i]) !== -1) continue 11731 _availableModules[filename].push(modules[i]) 11732 } 11733 } 11734 11735 /** 11736 * Check if an object is available in window. 11737 * 11738 * @param {string} namespace The namespace to check 11739 * @return {boolean} 11740 * @private 11741 */ 11742 function _isWindowGlobal (namespace) { 11743 for (let name in window) { 11744 if (name === namespace) return true 11745 } 11746 11747 return false 11748 } 11749 11750 /** 11751 * Get the current line number. 11752 * 11753 * @return {string} Returns the line number. 11754 * @private 11755 */ 11756 function _getLineNumber () { 11757 let e = new Error() 11758 if (!e.stack) { 11759 try { 11760 throw e 11761 } catch (e) { 11762 if (!e.stack) return '0' 11763 } 11764 } 11765 11766 let stack = e.stack.toString().split(/\r\n|\n/), 11767 frameRe = /:(\d+):(?:\d+)[^\d]*$/, 11768 frame 11769 11770 do { 11771 frame = stack.shift() 11772 } while (!frameRe.exec(frame) && stack.length) 11773 stack.shift() 11774 return frameRe.exec(stack.shift())[1] 11775 } 11776 11777 /** 11778 * Get the debug level. 11779 * 11780 * @return {number} Returns the debug level. 11781 */ 11782 function _getDebugLevel () { 11783 if (_extClass.length < 1) return 0 11784 let element = document.querySelector('#' + _extClass + '-debug') 11785 if (!element || !element.hasAttribute('data-debug-level')) return 0 11786 return parseInt(element.getAttribute('data-debug-level')) 11787 } 11788 11789 /********** 11790 * Public * 11791 **********/ 11792 11793 // constants 11794 self.DEBUG_FUNC_END = 0 11795 self.DEBUG_FUNC_START = 1 11796 self.DEBUG_FUNC_CALLED = 2 11797 11798 // @see \SWE\SweCore\Service\LogServiceInterface 11799 self.LEVEL_EMERGENCY = 0 11800 self.LEVEL_ALERT = 1 11801 self.LEVEL_CRITICAL = 2 11802 self.LEVEL_ERROR = 3 11803 self.LEVEL_WARNING = 4 11804 self.LEVEL_NOTICE = 5 11805 self.LEVEL_INFO = 6 11806 self.LEVEL_DEBUG = 7 11807 11808 /** 11809 * Check if checked module is available. 11810 * 11811 * @param {string} filename 11812 * @param {string} module 11813 * @return {boolean} 11814 */ 11815 self.isModuleAvailable = function (filename, module) { 11816 if (!_availableModules.hasOwnProperty(filename)) return false 11817 return _availableModules[filename].indexOf(module) !== -1 11818 } 11819 11820 /** 11821 * @param {number} group 11822 * @param {string} [name='anonymous'] OPTIONAL. 11823 */ 11824 self.debuggingFunc = function (group, name) { 11825 let functionDebugLevel = self.LEVEL_WARNING 11826 11827 if (!self.isDebug() || _getDebugLevel() < functionDebugLevel) return 11828 if (typeof name === 'undefined') name = 'anonymous' 11829 11830 switch (group) { 11831 case self.DEBUG_FUNC_START: 11832 console.group(name) 11833 break 11834 case self.DEBUG_FUNC_END: 11835 console.groupEnd() 11836 break 11837 case self.DEBUG_FUNC_CALLED: 11838 self.debuggingFunc(self.DEBUG_FUNC_START, name) 11839 self.debuggingFunc(self.DEBUG_FUNC_END, name) 11840 break 11841 } 11842 } 11843 11844 /** 11845 * Print a variable via console.log if the debug mode is enabled. 11846 * 11847 * @param {*} variable The variable to debug. 11848 * @param {number|null} [level=self.LEVEL_INFO] OPTIONAL. The log level. 11849 */ 11850 self.debug = function (variable, level) { 11851 if (typeof level === 'undefined') level = self.LEVEL_INFO 11852 if (!self.isDebug() || _getDebugLevel() < level) return 11853 console.log('Line: ' + _getLineNumber() + ' -', variable) 11854 } 11855 11856 /** 11857 * Print an error message via console.warn. If the debug mode is disabled, printing a default error message. 11858 * 11859 * @param {string} message The error message. 11860 * @param {number|null} [level=self.LEVEL_ERROR] OPTIONAL. The log level. 11861 */ 11862 self.error = function (message, level) { 11863 if (typeof level === 'undefined') level = self.LEVEL_ERROR 11864 if (_getDebugLevel() >= level || self.isDebug()) { 11865 console.warn('Line: ' + _getLineNumber() + ' -', message) 11866 return 11867 } 11868 11869 console.warn('Line: ' + _getLineNumber() + ' -', 'An error occurred') 11870 } 11871 11872 /** 11873 * @param {string} extClass 11874 */ 11875 self.setExtClass = function (extClass) { 11876 _extClass = extClass 11877 } 11878 11879 /** 11880 * @return {string} 11881 */ 11882 self.getExtClass = function () { 11883 return _extClass 11884 } 11885 11886 /** 11887 * Check if the debug mode is enabled. 11888 * 11889 * @return {boolean} Returns TRUE if the debug mode is enabled, FALSE if it's disabled. 11890 */ 11891 self.isDebug = function () { 11892 if (_debug) return _debug 11893 if (_extClass.length < 1) return _debug 11894 let element = document.querySelector('#' + _extClass + '-debug') 11895 if (!element || !element.hasAttribute('data-debug')) return _debug 11896 return element.getAttribute('data-debug') === '1' 11897 } 11898 11899 /** 11900 * @param {boolean} debug 11901 */ 11902 self.setDebug = function (debug) { 11903 _debug = debug === true 11904 } 11905 11906 /** 11907 * Check if modules are available. 11908 * 11909 * @param {string[]} modules 11910 * @param {string} type 11911 * @param {boolean} stop 11912 * @param {string} filename 11913 */ 11914 self.checkModules = function (modules, type, stop, filename) { 11915 self.debuggingFunc(self.DEBUG_FUNC_START, 'sweSikaVertriebspartnerDebugger.checkModules') 11916 self.debug('Checking modules for: ' + filename, self.LEVEL_INFO) 11917 self.debug('Modules to check: ' + JSON.stringify(modules), self.LEVEL_DEBUG) 11918 self.debug('Modules are: ' + type, self.LEVEL_DEBUG) 11919 11920 let notFound = [],
11921 stringFilename = '[' + filename + '.js] ', 11922 string = stringFilename + type.toUpperCase() + ' NAMESPACES NOT FOUND: ' 11923 11924 if (modules.length < 1) { 11925 _addModules(filename, modules) 11926 string = stringFilename + 'No modules to load.' 11927 self.debug(string, self.LEVEL_INFO) 11928 self.debuggingFunc(self.DEBUG_FUNC_END) 11929 return 11930 } 11931 11932 for (let i = 0; i < modules.length; i += 1) { 11933 if (_isWindowGlobal(modules[i])) { 11934 _addModules(filename, [modules[i]]) 11935 continue 11936 } 11937 11938 notFound.push(modules[i]) 11939 } 11940 11941 if (notFound.length === 0) { 11942 string = stringFilename + 'All ' + type + ' modules (' + modules.length + ') loaded.' 11943 self.debug(string, self.LEVEL_INFO) 11944 self.debuggingFunc(self.DEBUG_FUNC_END) 11945 return 11946 } 11947 11948 if (stop) { 11949 self.debuggingFunc(self.DEBUG_FUNC_END) 11950 throw string + notFound.join(', ') 11951 } 11952 11953 self.error(string + notFound.join(', '), self.LEVEL_ERROR) 11954 self.debuggingFunc(self.DEBUG_FUNC_END) 11955 } 11956 11957})(window.sweSikaVertriebspartnerDebugger) 11958 11959window.sweSikaVertriebspartnerHelper = {}; 11960 11961(function (self) { 11962 'use strict' 11963 11964 /*********** 11965 * Private * 11966 ***********/ 11967 11968 let _requiredModules = [], 11969 _suggestedModules = [], 11970 _filename = 'swe-helper', 11971 _checked = false, 11972 _cookieProtection = true, 11973 _elementPrefixes = [ 11974 '#', 11975 '.', 11976 '[', 11977 ], 11978 _htmlTags = [], 11979 _cookieBannerNames = [ 11980 'cookieBanner',
11981 'cookieBanner2019', 11982 ] 11983 11984 /** 11985 * @private 11986 */ 11987 function _check () { 11988 if (_checked) return 11989 if (!sweSikaVertriebspartnerDebugger) throw '[' + _filename + '.js] Required namespace "sweSikaVertriebspartnerDebugger" not found.' 11990 11991 sweSikaVertriebspartnerDebugger.checkModules(_requiredModules, 'required', true, _filename) 11992 sweSikaVertriebspartnerDebugger.checkModules(_suggestedModules, 'suggested', false, _filename) 11993 _checked = true 11994 } 11995 11996 /** 11997 * Set all available html tag names from the current dom. 11998 * @private 11999 */ 12000 function _setAllHtmlTagNames () { 12001 sweSikaVertriebspartnerDebugger.debuggingFunc(sweSikaVertriebspartnerDebugger.DEBUG_FUNC_START, 'sweSikaVertriebspartnerHelper._getAllHtmlTagNames') 12002 let all = document.getElementsByTagName('*') 12003 12004 for (let i = 0, max = all.length; i < max; i += 1) { 12005 let tag = all[i].tagName.toLowerCase() 12006 if (_htmlTags.indexOf(tag) !== -1) continue 12007 _htmlTags.push(tag) 12008 } 12009 12010 sweSikaVertriebspartnerDebugger.debug(_htmlTags, sweSikaVertriebspartnerDebugger.LEVEL_DEBUG) 12011 sweSikaVertriebspartnerDebugger.debuggingFunc(sweSikaVertriebspartnerDebugger.DEBUG_FUNC_END) 12012 } 12013 12014 /********** 12015 * Public * 12016 **********/ 12017 12018 /** 12019 * @type {number} 12020 */ 12021 self.recursionCounter = 0 12022 12023 /** 12024 * @type {number} 12025 */ 12026 self.maxRecursions = 10 12027 12028 /** 12029 * Get the cookie protection. 12030 * 12031 * @return {boolean} 12032 */ 12033 self.getCookieProtection = function () { 12034 return _cookieProtection 12035 } 12036 12037 /** 12038 * Set the cookie protection. 12039 * 12040 * @param {boolean} protection 12041 */ 12042 self.setCookieProtection = function (protection) { 12043 _cookieProtection = protection 12044 } 12045 12046 /** 12047 * Check if we can create cookies. 12048 * 12049 * @return {boolean} 12050 */ 12051 self.isCookieAllowed = function () { 12052 return self.setCookie('cookie-test', 'test', 0) 12053 } 12054 12055 /** 12056 * Get a cookie. 12057 * 12058 * @param {string} name The name of the cookie. 12059 * @returns {string} Returns the cookie value. 12060 */ 12061 self.getCookie = function (name) { 12062 let nameEQ = name + '=', 12063 cookieArray = document.cookie.split(';') 12064 12065 for (let i = 0; i < cookieArray.length; i += 1) { 12066 let cookie = cookieArray[i] 12067 12068 while (cookie.charAt(0) === ' ') { 12069 cookie = cookie.substring(1, cookie.length) 12070 } 12071 12072 if (cookie.indexOf(nameEQ) === 0) { 12073 return cookie.substring(nameEQ.length, cookie.length) 12074 } 12075 } 12076 12077 return '' 12078 } 12079 12080 /** 12081 * Set or delete a cookie. 12082 * 12083 * @param {string} name The name of the cookie. 12084 * @param {string} value The value of the cookie. 12085 * @param {number|null} [days=null] OPTIONAL. The number of days until the cookie expires. 12086 * @return {boolean} Returns TRUE if the cookie was set, FALSE if the cookieBanner is not set. 12087 */ 12088 self.setCookie = function (name, value, days) { 12089 let date = new Date(), 12090 expires = '; expires=', 12091 gmtString = 'Thu, 01 Jan 1970 00:00:01 GMT', 12092 valid = false 12093 12094 for (let i = 0; i < _cookieBannerNames.length; i += 1) { 12095 if (!_cookieProtection || self.getCookie(_cookieBannerNames[i]).toLowerCase() === 'set') valid = true 12096 } 12097 12098 if (!valid) { 12099 if (name !== 'cookie-test') { 12100 sweSikaVertriebspartnerDebugger.error('The cookie banner is not accepted') 12101 sweSikaVertriebspartnerDebugger.debuggingFunc(sweSikaVertriebspartnerDebugger.DEBUG_FUNC_END) 12102 } 12103 12104 return false 12105 } 12106 12107 if (name === 'cookie-test') return true 12108 12109 if (days) { 12110 date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000)) 12111 gmtString = date.toGMTString() 12112 } 12113 12114 document.cookie = name + '=' + value + expires + gmtString + '; path=/' 12115 return true 12116 } 12117 12118 /** 12119 * Remove all children elements from an element. 12120 * 12121 * @param {HTMLElement} element The HTMLElement instance. 12122 */ 12123 self.removeChildren = function (element) { 12124 while (element.hasChildNodes()) { 12125 element.removeChild(element.firstChild) 12126 } 12127 } 12128 12129 /** 12130 * Get an element by a selector. 12131 * 12132 * @param {string} selector The selector. 12133 * @param {HTMLElement|Document} [element=null] OPTIONAL. The element to search from. 12134 * @return {HTMLElement} Returns the html element. 12135 */ 12136 self.getElement = function (selector, element) { 12137 element = element || document 12138 if (_htmlTags.length === 0) _setAllHtmlTagNames() 12139 12140 if (_htmlTags.indexOf(selector) === -1) { 12141 if (_elementPrefixes.indexOf(selector.charAt(0)) === -1) selector = '#' + selector 12142 } 12143 12144 return element.querySelector(selector) 12145 } 12146 12147 /** 12148 * Get elements by a selector. 12149 * 12150 * @param {string} selector The selector. 12151 * @param {HTMLElement|Document} [element=null] OPTIONAL. The element to search from. 12152 * @return {NodeListOf<HTMLElement>} Returns a list of html elements. 12153 */ 12154 self.getElements = function (selector, element) { 12155 element = element || document 12156 if (_htmlTags.length === 0) _setAllHtmlTagNames() 12157 12158 if (_htmlTags.indexOf(selector) === -1) { 12159 if (_elementPrefixes.indexOf(selector.charAt(0)) === -1) selector = '.' + selector 12160 } 12161 12162 return element.querySelectorAll(selector) 12163 } 12164 12165 /** 12166 * Get the parent element with the given selector. 12167 * 12168 * @param {HTMLElement} element 12169 * @param {string} selector 12170 * @return {HTMLElement} 12171 */ 12172 self.getParentWithClass = function (element, selector) { 12173 while ((element = element.parentElement) && !(element.classList.contains(selector))) { 12174 // Nothing inside. 12175 } 12176 12177 return element 12178 } 12179 12180 /** 12181 * Remove a css class from a dom element. 12182 * 12183 * @param {HTMLElement} element The html element. 12184 * @param {string} className The name of the class. 12185 */ 12186 self.removeDomClass = function (element, className) { 12187 if (element.classList.contains(className)) element.classList.remove(className) 12188 } 12189 12190 /** 12191 * Add a css class to a dom element. 12192 * 12193 * @param {HTMLElement} element The html element. 12194 * @param {string} className The name of the class. 12195 */ 12196 self.addDomClass = function (element, className) { 12197 if (!element.classList.contains(className)) element.classList.add(className) 12198 } 12199 12200 /** 12201 * Show an html element. 12202 * 12203 * @param {HTMLElement} element The html element. 12204 */ 12205 self.show = function (element) { 12206 self.removeDomClass(element, 'hidden') 12207 } 12208 12209 /** 12210 * Hide an html element. 12211 * 12212 * @param {HTMLElement} element The html element. 12213 */ 12214 self.hide = function (element) { 12215 self.addDomClass(element, 'hidden') 12216 } 12217 12218 /** 12219 * Check if an element is hidden. 12220 * 12221 * @param {HTMLElement} element The html element to check. 12222 * @return {boolean} Returns TRUE if the element is hidden. 12223 */ 12224 self.isHidden = function (element) { 12225 return element.classList.contains('hidden') 12226 } 12227 12228 /** 12229 * Get a random index. 12230 * 12231 * @param {array} array An array where we want to get a random index. 12232 * @return {number} Returns the index. 12233 */ 12234 self.getRandomIndex = function (array) { 12235 return Math.floor(Math.random() * array.length) 12236 } 12237 12238 /** 12239 * Endless loop protection. 12240 * 12241 * @param {number} [max=null] OPTIONAL. The maximum of allowed recursions. 12242 * @return {number|null} Returns the number of recursions if the limit is reached, NULL if it's alright. 12243 */ 12244 self.recursionProtection = function (max) { 12245 sweSikaVertriebspartnerDebugger.debuggingFunc(sweSikaVertriebspartnerDebugger.DEBUG_FUNC_START, 'sweHelperGroupTravel.recursionProtection') 12246 if (typeof max === 'undefined' || max === 0) max = self.maxRecursions 12247 let infoMessage = 'Recursion counter: ' + self.recursionCounter.toString() 12248 12249 if (max > self.recursionCounter) { 12250 self.recursionCounter += 1 12251 sweSikaVertriebspartnerDebugger.debug(infoMessage, sweSikaVertriebspartnerDebugger.LEVEL_INFO) 12252 sweSikaVertriebspartnerDebugger.debuggingFunc(sweSikaVertriebspartnerDebugger.DEBUG_FUNC_END) 12253 return null 12254 } 12255 12256 let amount = self.recursionCounter 12257 infoMessage = 'The maximum of recursions is reached. (Amount: ' + amount + ')' 12258 self.resetRecursion() 12259 sweSikaVertriebspartnerDebugger.debug(infoMessage, sweSikaVertriebspartnerDebugger.LEVEL_INFO) 12260 sweSikaVertriebspartnerDebugger.debuggingFunc(sweSikaVertriebspartnerDebugger.DEBUG_FUNC_END) 12261 return amount 12262 } 12263 12264 /** 12265 * Reset the recursion counter. 12266 */ 12267 self.resetRecursion = function () { 12268 self.recursionCounter = 0 12269 } 12270 12271 /** 12272 * Check if it's the current action. 12273 * 12274 * @param {string} action The action name. 12275 * @return {boolean} Returns TRUE if it's the current action, FALSE if not. 12276 */ 12277 self.isAction = function (action) { 12278 sweSikaVertriebspartnerDebugger.debuggingFunc(sweSikaVertriebspartnerDebugger.DEBUG_FUNC_START, 'sweSikaVertriebspartnerHelper.isAction') 12279 let root = self.getElement('.' + sweSikaVertriebspartnerDebugger.getExtClass()) 12280 12281 if (!root || !root.hasAttribute('data-action')) { 12282 sweSikaVertriebspartnerDebugger.debug('This isn\'t an action of this extension!', sweSikaVertriebspartnerDebugger.LEVEL_WARNING) 12283 sweSikaVertriebspartnerDebugger.debuggingFunc(sweSikaVertriebspartnerDebugger.DEBUG_FUNC_END) 12284 return false 12285 } 12286 12287 let realAction = root.getAttribute('data-action') 12288 sweSikaVertriebspartnerDebugger.debug('Action ' + realAction.toLowerCase() + ' === ' + action.toLowerCase(), sweSikaVertriebspartnerDebugger.LEVEL_DEBUG) 12289 12290 sweSikaVertriebspartnerDebugger.debuggingFunc(sweSikaVertriebspartnerDebugger.DEBUG_FUNC_END) 12291 return realAction.toLowerCase() === action.toLowerCase() 12292 } 12293 12294 /** 12295 * Check is the current action is one of the given actions. 12296 * 12297 * @param {string[]} actions The action names. 12298 * @return {boolean} Returns TRUE if the current action is one of the given actions, FALSE if not. 12299 */ 12300 self.isOneOfActions = function (actions) { 12301 sweSikaVertriebspartnerDebugger.debuggingFunc(sweSikaVertriebspartnerDebugger.DEBUG_FUNC_START, 'sweSikaVertriebspartnerHelper.isOneOfActions') 12302 for (let i = 0; i < actions.length; i += 1) { 12303 if (!self.isAction(actions[i])) continue 12304 sweSikaVertriebspartnerDebugger.debuggingFunc(sweSikaVertriebspartnerDebugger.DEBUG_FUNC_END) 12305 return true 12306 } 12307 12308 sweSikaVertriebspartnerDebugger.debuggingFunc(sweSikaVertriebspartnerDebugger.DEBUG_FUNC_END) 12309 return false 12310 } 12311 12312 /** 12313 * Set up module sweSikaVertriebspartnerHelper. 12314 */ 12315 self.setup = function () { 12316 _check() 12317 _setAllHtmlTagNames() 12318 12319 return self 12320 } 12321 12322})(window.sweSikaVertriebspartnerHelper) 12323 12324window.sweSikaVertriebspartnerIE = {}; 12325 12326(function (self) { 12327 'use strict' 12328 12329 /*********** 12330 * Private * 12331 ***********/ 12332 12333 let _requiredModules = [ 12334 'sweSikaVertriebspartnerHelper' 12335 ], 12336 _suggestedModules = [], 12337 _filename = 'swe-ie', 12338 _checked = false, 12339 _isIE = false, 12340 _extClass = '' 12341 12342 /** 12343 * @private 12344 */ 12345 function _check () { 12346 if (_checked) return 12347 if (!sweSikaVertriebspartnerDebugger) throw '[' + _filename + '.js] Required namespace "sweSikaVertriebspartnerDebugger" not found.' 12348 12349 sweSikaVertriebspartnerDebugger.checkModules(_requiredModules, 'required', true, _filename) 12350 sweSikaVertriebspartnerDebugger.checkModules(_suggestedModules, 'suggested', false, _filename) 12351 _checked = true 12352 } 12353 12354 /** 12355 * @private 12356 */ 12357 function _initScrollableTables () { 12358 sweSikaVertriebspartnerDebugger.debuggingFunc(sweSikaVertriebspartnerDebugger.DEBUG_FUNC_START, 'sweSikaVertriebspartnerIE._initScrollableTables') 12359 let tables = sweSikaVertriebspartnerHelper.getElements('.scrollable table') 12360 12361 for (let i = 0; i < tables.length; i += 1) { 12362 let table = tables[i], 12363 tableHeaders = sweSikaVertriebspartnerHelper.getElements('th', table), 12364 maxWidth = 0 12365 12366 for (let j = 0; j < tableHeaders.length; j += 1) { 12367 let width = tableHeaders[j].offsetWidth 12368 12369 maxWidth = width > maxWidth ? width : maxWidth 12370 } 12371 12372 for (let j = 0; j < tableHeaders.length; j += 1) { 12373 tableHeaders[j].style.width = maxWidth + 'px' 12374 } 12375 12376 table.style.marginLeft = maxWidth + 'px' 12377 } 12378 sweSikaVertriebspartnerDebugger.debuggingFunc(sweSikaVertriebspartnerDebugger.DEBUG_FUNC_END) 12379 } 12380 12381 /************* 12382 * Polyfills * 12383 *************/ 12384 12385 let polyfills = { 12386 12387 /** 12388 * Initiate all polyfills. 12389 */ 12390 setup: function () { 12391 for (let method in this) {
12392 if (!this.hasOwnProperty(method)) continue 12393 if (method === 'setup') continue 12394 this[method]() 12395 } 12396 }, 12397 12398 /** 12399 * Enables "String.includes()". 12400 */ 12401 includes: function () { 12402 String.prototype.includes = function (search, start) { 12403 'use strict' 12404 12405 if (typeof start !== 'number') start = 0 12406 12407 if (start + search.length > this.length) { 12408 return false 12409 } 12410 12411 return this.indexOf(search, start) !== -1 12412 } 12413 }, 12414 12415 /** 12416 * Enables "SVGElement.classList" with "contains", "add", "remove" and "toggle". 12417 */ 12418 svgClassList: function () { 12419 Object.defineProperty(SVGElement.prototype, 'classList', { 12420 get: function get () { 12421 let _this = this 12422 12423 return { 12424 contains: function contains (className) { 12425 return _this.className.baseVal.split(' ').indexOf(className) !== 1 12426 }, 12427 add: function add (className) { 12428 return _this.setAttribute('class', _this.getAttribute('class') + ' ' + className) 12429 }, 12430 remove: function remove (className) { 12431 let removedClass = _this 12432 .getAttribute('class') 12433 .replace( 12434 new RegExp('(\\s|^)'.concat(className, '(\\s|$)'), 'g'), 12435 '$2' 12436 ) 12437 12438 if (_this.classList.contains(className)) { 12439 _this.setAttribute('class', removedClass) 12440 } 12441 }, 12442 toggle: function toggle (className) { 12443 if (this.contains(className)) { 12444 this.remove(className) 12445 } else { 12446 this.add(className) 12447 } 12448 }, 12449 } 12450 } 12451 }) 12452 }, 12453 } 12454 12455 /********** 12456 * Public * 12457 **********/ 12458 12459 /** 12460 * @return {boolean} 12461 */ 12462 self.isIE = function () { 12463 return _isIE 12464 } 12465 12466 /** 12467 * Set up module sweSikaVertriebspartnerIE. 12468 */ 12469 self.setup = function (extClass) { 12470 _check() 12471 _extClass = extClass 12472 _isIE = !!window.MSInputMethodContext && !!document.documentMode 12473 if (!_isIE) return self 12474 12475 sweSikaVertriebspartnerHelper.addDomClass(sweSikaVertriebspartnerHelper.getElement('.' + _extClass), 'ie') 12476 _initScrollableTables() 12477 polyfills.setup() 12478 12479 return self 12480 } 12481 12482})(window.sweSikaVertriebspartnerIE) 12483 12484window.sweSikaVertriebspartnerMapConstruct = {}; 12485 12486(function (self) { 12487 'use strict' 12488 12489 /*********** 12490 * Private * 12491 ***********/ 12492 12493 let _requiredModules = [ 12494 'google', 12495 ], 12496 _suggestedModules = [ 12497 // 'MarkerClusterer', 12498 ], 12499 _checked = false, 12500 _filename = 'swe-map-construct', 12501 _markerImagePath = '/typo3conf/ext/swe_sika_vertriebspartner/Resources/Public/Images/markerclusterer', 12502 _customMarker = false 12503 12504 /** 12505 * @private 12506 */ 12507 function _check () { 12508 if (_checked) return 12509 if (!sweSikaVertriebspartnerDebugger) throw '[' + _filename + '.js] Required namespace "sweSikaVertriebspartnerDebugger" not found.' 12510 12511 sweSikaVertriebspartnerDebugger.checkModules(_requiredModules, 'required', true, _filename) 12512 sweSikaVertriebspartnerDebugger.checkModules(_suggestedModules, 'suggested', false, _filename) 12513 _checked = true 12514 } 12515 12516 /********** 12517 * Public * 12518 **********/ 12519 12520 self.__config = { 12521 canvasID: null, 12522 map: null, 12523 markers: [], 12524 marker_icon: { 12525 path: 'M0-48c-9.8 0-17.7 7.8-17.7 17.4 0 15.5 17.7 30.6 17.7 30.6s17.7-15.4 17.7-30.6c0-9.6-7.9-17.4-17.7-17.4z', 12526 fillColor: '#00369c', 12527 fillOpacity: 1, 12528 strokeColor: '', 12529 strokeWeight: 0, 12530 }, 12531 line_start_icon: null, 12532 line_end_icon: null, 12533 lines: [], 12534 circles: [], 12535 bounds: null, 12536 infoWindow: null, 12537 marker_clusterer: null, 12538 options: { 12539 center: { 12540 lat: 51.313361, 12541 lng: 9.486890, 12542 }, 12543 zoom: 8, 12544 minZoom: 3, 12545 maxZoom: 14, 12546 zoomControl: true, 12547 mapTypeControl: true, 12548 scaleControl: true, 12549 streetViewControl: false, 12550 rotateControl: true, 12551 scrollwheel: false, 12552 draggable: window.innerWidth > 1024, 12553 mapTypeControlOptions: { 12554 mapTypeIds: ['grey',], 12555 }, 12556 }, 12557 styles: [ 12558 { 12559 key: 'grey', 12560 label: 'Map', 12561 config: [ 12562 { 12563 'featureType': 'landscape', 12564 'stylers': [{ 'color': '#f9f9f9', },], 12565 }, 12566 { 12567 'featureType': 'road.highway', 12568 'stylers': [{ 'color': '#eaeaea', },], 12569 }, 12570 { 12571 'featureType': 'transit', 12572 'stylers': [{ 'color': '#eaeaea', },], 12573 }, 12574 { 12575 'featureType': 'water', 12576 'stylers': [{ 'color': '#eaeaea', },], 12577 }, 12578 { 12579 'featureType': 'poi', 12580 'elementType': 'geometry', 12581 'stylers': [{ 'color': '#eaeaea', },], 12582 }, 12583 { 12584 'elementType': 'labels.text.fill', 12585 'stylers': [{ 'color': '#808080', },], 12586 }, 12587 ], 12588 }, 12589 ], 12590 } 12591 12592 /** 12593 * @param {boolean} enable 12594 */ 12595 self.enableCustomMarker = function (enable) { 12596 _customMarker = enable 12597 } 12598 12599 /** 12600 * Set the marker image path. 12601 * 12602 * @param {string} imagePath path to image directory without a trailing slash. 12603 */ 12604 self.setMarkerImagePath = function (imagePath) { 12605 _check() 12606 sweSikaVertriebspartnerDebugger.debuggingFunc(sweSikaVertriebspartnerDebugger.DEBUG_FUNC_CALLED, 'sweSikaVertriebspartnerMapConstruct.setMarkerImagePath') 12607 _markerImagePath = imagePath 12608 } 12609 12610 /** 12611 * @param {number} lat 12612 * @return {number} 12613 */ 12614 self.getMetersPerPixes = function (lat) { 12615 _check() 12616 sweSikaVertriebspartnerDebugger.debuggingFunc(sweSikaVertriebspartnerDebugger.DEBUG_FUNC_CALLED, 'sweSikaVertriebspartnerMapConstruct.getMetersPerPixes') 12617 if (!self.__config.map) return 0 12618 12619 return 156543.03392 * Math.cos(lat * Math.PI / 180) / Math.pow(2, self.__config.map.getZoom()) 12620 } 12621 12622 /** 12623 * 12624 */ 12625 self.resetBounds = function () { 12626 _check() 12627 sweSikaVertriebspartnerDebugger.debuggingFunc(sweSikaVertriebspartnerDebugger.DEBUG_FUNC_CALLED, 'sweSikaVertriebspartnerMapConstruct.resetBounds') 12628 if (!self.__config.map) return 12629
12630 self.__config.bounds = new google.maps.LatLngBounds() 12631 } 12632 12633 /** 12634 * 12635 */ 12636 self.fitCirclesBounds = function () { 12637 _check() 12638 sweSikaVertriebspartnerDebugger.debuggingFunc(sweSikaVertriebspartnerDebugger.DEBUG_FUNC_CALLED, 'sweSikaVertriebspartnerMapConstruct.fitCirclesBounds') 12639 if (!self.__config.map) return 12640 12641 if (!self.__config.bounds) { 12642 self.__config.bounds = new google.maps.LatLngBounds() 12643 } 12644 12645 if (self.__config.circles.length === 1) { 12646 self.__config.bounds = self.__config.circles[0].getBounds() 12647 } 12648 12649 if (self.__config.circles.length > 1) { 12650 for (let i = 0; i < self.__config.circles.length; i += 1) { 12651 let circle = self.__config.circles[i] 12652 12653 self.__config.bounds.extend(circle.center) 12654 } 12655 } 12656 12657 self.__config.map.fitBounds(self.__config.bounds) 12658 } 12659 12660 /** 12661 * 12662 */ 12663 self.fitMarkersBounds = function () { 12664 _check() 12665 sweSikaVertriebspartnerDebugger.debuggingFunc(sweSikaVertriebspartnerDebugger.DEBUG_FUNC_START, 'sweSikaVertriebspartnerMapConstruct.fitMarkersBounds') 12666 if (!self.__config.map) { 12667 sweSikaVertriebspartnerDebugger.debug('Map is not a google maps instance', sweSikaVertriebspartnerDebugger.LEVEL_WARNING) 12668 sweSikaVertriebspartnerDebugger.debuggingFunc(sweSikaVertriebspartnerDebugger.DEBUG_FUNC_END) 12669 return 12670 } 12671 12672 if (!self.__config.bounds) { 12673 self.__config.bounds = new google.maps.LatLngBounds() 12674 } 12675 12676 if (self.__config.markers.length >= 1) { 12677 for (let i = 0; i < self.__config.markers.length; i += 1) { 12678 let marker = self.__config.markers[i], 12679 position = new google.maps.LatLng(marker.position.lat(), marker.position.lng()) 12680 12681 self.__config.bounds.extend(position) 12682 } 12683 } 12684 12685 self.__config.map.fitBounds(self.__config.bounds) 12686 sweSikaVertriebspartnerDebugger.debuggingFunc(sweSikaVertriebspartnerDebugger.DEBUG_FUNC_END) 12687 } 12688 12689 /** 12690 * 12691 */ 12692 self.fitLinesBounds = function () { 12693 _check() 12694 sweSikaVertriebspartnerDebugger.debuggingFunc(sweSikaVertriebspartnerDebugger.DEBUG_FUNC_CALLED, 'sweSikaVertriebspartnerMapConstruct.fitLinesBounds') 12695 if (!self.__config.map) return 12696 12697 if (!self.__config.bounds) { 12698 self.__config.bounds = new google.maps.LatLngBounds() 12699 } 12700 12701 for (let i = 0; i < self.__config.lines.length; i += 1) { 12702 let line = self.__config.lines[i], 12703 coords = line.getPath() 12704 12705 for (let j = 0; j < coords.length; j += 1) { 12706 let coordinate = coords.getAt(j), 12707 position = new google.maps.LatLng(coordinate.lat(), coordinate.lng()) 12708 12709 self.__config.bounds.extend(position) 12710 } 12711 } 12712 12713 self.__config.map.fitBounds(self.__config.bounds) 12714 } 12715 12716 /** 12717 * @param icon 12718 */ 12719 self.setMarkerIcon = function (icon) { 12720 _check() 12721 sweSikaVertriebspartnerDebugger.debuggingFunc(sweSikaVertriebspartnerDebugger.DEBUG_FUNC_CALLED, 'sweSikaVertriebspartnerMapConstruct.setMarkerIcon') 12722 self.__config.marker_icon = icon 12723 } 12724 12725 /** 12726 * @param icon 12727 */ 12728 self.setLineStartIcon = function (icon) { 12729 _check() 12730 sweSikaVertriebspartnerDebugger.debuggingFunc(sweSikaVertriebspartnerDebugger.DEBUG_FUNC_CALLED, 'sweSikaVertriebspartnerMapConstruct.setLineStartIcon') 12731 self.__config.line_start_icon = icon 12732 } 12733 12734 /** 12735 * @param icon 12736 */ 12737 self.setLineEndIcon = function (icon) { 12738 _check() 12739 sweSikaVertriebspartnerDebugger.debuggingFunc(sweSikaVertriebspartnerDebugger.DEBUG_FUNC_CALLED, 'sweSikaVertriebspartnerMapConstruct.setLineEndIcon') 12740 self.__config.line_end_icon = icon 12741 } 12742 12743 /** 12744 * @return {number} 12745 */ 12746 self.countMarkers = function () { 12747 _check() 12748 sweSikaVertriebspartnerDebugger.debuggingFunc(sweSikaVertriebspartnerDebugger.DEBUG_FUNC_CALLED, 'sweSikaVertriebspartnerMapConstruct.countMarkers') 12749 return self.__config.markers.length 12750 } 12751 12752 /** 12753 * @param marker 12754 * @param onClickHtml 12755 */ 12756 self.showMarkerInfo = function (marker, onClickHtml) { 12757 _check() 12758 sweSikaVertriebspartnerDebugger.debuggingFunc(sweSikaVertriebspartnerDebugger.DEBUG_FUNC_CALLED, 'sweSikaVertriebspartnerMapConstruct.showMarkerInfo') 12759 self.__config.infoWindow.setContent(onClickHtml) 12760 self.__config.infoWindow.open(self.__config.map, marker) 12761 } 12762 12763 /** 12764 * @param index 12765 * @return {*} 12766 */ 12767 self.getMarker = function (index) { 12768 _check() 12769 sweSikaVertriebspartnerDebugger.debuggingFunc(sweSikaVertriebspartnerDebugger.DEBUG_FUNC_CALLED, 'sweSikaVertriebspartnerMapConstruct.getMarker') 12770 return self.__config.markers[index] 12771 } 12772 12773 /** 12774 * @param {number} lat 12775 * @param {number} lng 12776 * @param {string} [onClickHtml] 12777 * @param {string} [icon] 12778 * @param {string} [iconColor] 12779 * @param {string} [title] 12780 * @param {boolean} [openWindow] 12781 * @return {*} 12782 */ 12783 self.addMarker = function (lat, lng, onClickHtml, icon, iconColor, title, openWindow) { 12784 _check() 12785 sweSikaVertriebspartnerDebugger.debuggingFunc(sweSikaVertriebspartnerDebugger.DEBUG_FUNC_START, 'sweSikaVertriebspartnerMapConstruct.addMarker') 12786 12787 if (!self.__config.map) { 12788 sweSikaVertriebspartnerDebugger.debuggingFunc(sweSikaVertriebspartnerDebugger.DEBUG_FUNC_END) 12789 return null 12790 } 12791 12792 let __icon = self.__config.marker_icon, 12793 __title = '', 12794 marker 12795 12796 if (icon) __icon = icon === 'default' ? self.__config.marker_icon : icon 12797 if (iconColor && (typeof icon !== 'string' || icon === 'default')) __icon.fillColor = iconColor === 'default' ? __icon.fillColor : iconColor 12798 if (title) __title = title 12799 12800 if (!_customMarker) { 12801 // Default Google Maps marker 12802 marker = new google.maps.Marker({ 12803 position: new google.maps.LatLng(lat, lng), 12804 icon: __icon, 12805 title: __title, 12806 map: self.__config.map, 12807 }) 12808 } else { 12809 // Custom defined marker. 12810 marker = new CustomMarker({ 12811 position: new google.maps.LatLng(lat, lng), 12812 map: self.__config.map, 12813 }) 12814 } 12815 12816 if (onClickHtml) { 12817 google.maps.event.addListener(marker, 'click', function () { 12818 self.__config.infoWindow.setContent(onClickHtml) 12819 self.__config.infoWindow.open(self.__config.map, marker) 12820 }) 12821 12822 if (openWindow) { 12823 self.__config.infoWindow.setContent(onClickHtml) 12824 self.__config.infoWindow.open(self.__config.map, marker) 12825 } 12826 } 12827 12828 self.__config.markers.push(marker) 12829 12830 sweSikaVertriebspartnerDebugger.debuggingFunc(sweSikaVertriebspartnerDebugger.DEBUG_FUNC_END) 12831 return marker 12832 } 12833 12834 /** 12835 * 12836 */ 12837 self.removeMarkers = function () { 12838 _check() 12839 sweSikaVertriebspartnerDebugger.debuggingFunc(sweSikaVertriebspartnerDebugger.DEBUG_FUNC_CALLED, 'sweSikaVertriebspartnerMapConstruct.removeMarkers') 12840 for (let i = 0; i < self.__config.markers.length; i += 1) { 12841 let marker = self.__config.markers[i] 12842 marker.setMap(null) 12843 } 12844 12845 self.__config.markers = [] 12846 } 12847 12848 /** 12849 * @param coords 12850 * @param {object} style 12851 * @param fclick 12852 * @return {*} 12853 */ 12854 self.addLine = function (coords, style, fclick) { 12855 _check() 12856 sweSikaVertriebspartnerDebugger.debuggingFunc(sweSikaVertriebspartnerDebugger.DEBUG_FUNC_CALLED, 'sweSikaVertriebspartnerMapConstruct.addLine') 12857 if (!self.__config.map) return null 12858 12859 let line_icons = [] 12860 12861 if (self.__config.line_start_icon !== null) { 12862 line_icons.push({ 12863 icon: self.__config.line_start_icon, 12864 offset: '0%', 12865 }) 12866 } 12867 12868 if (self.__config.line_end_icon !== null) { 12869 line_icons.push({ 12870 icon: self.__config.line_end_icon,
12871 offset: '100%', 12872 }) 12873 } 12874 12875 let line = new google.maps.Polyline({ 12876 path: coords, 12877 icons: line_icons, 12878 map: self.__config.map, 12879 strokeColor: style.strokeColor, 12880 strokeOpacity: style.strokeOpacity, 12881 strokeWeight: style.strokeWeight, 12882 }) 12883 12884 self.__config.lines.push(line) 12885 12886 if (typeof fclick === 'function') { 12887 google.maps.event.addListener(line, 'click', fclick) 12888 } 12889 12890 return line 12891 } 12892 12893 /** 12894 * 12895 */ 12896 self.removeLines = function () { 12897 _check() 12898 sweSikaVertriebspartnerDebugger.debuggingFunc(sweSikaVertriebspartnerDebugger.DEBUG_FUNC_CALLED, 'sweSikaVertriebspartnerMapConstruct.removeLines') 12899 for (let i = 0; i < self.__config.lines.length; i += 1) { 12900 let line = self.__config.lines[i] 12901 line.setMap(null) 12902 } 12903 12904 self.__config.lines = [] 12905 } 12906 12907 /** 12908 * @param {number} centerLat 12909 * @param {number} centerLng 12910 * @param {number} radius 12911 * @param {object} style 12912 * @return {*} 12913 */ 12914 self.addCircle = function (centerLat, centerLng, radius, style) { 12915 _check() 12916 sweSikaVertriebspartnerDebugger.debuggingFunc(sweSikaVertriebspartnerDebugger.DEBUG_FUNC_CALLED, 'sweSikaVertriebspartnerMapConstruct.addCircle') 12917 if (!self.__config.map) return null 12918 12919 let circle = new google.maps.Circle({ 12920 strokeColor: style.strokeColor, 12921 strokeOpacity: style.strokeOpacity, 12922 strokeWeight: style.strokeWeight, 12923 fillColor: style.fillColor, 12924 fillOpacity: style.fillOpacity, 12925 map: self.__config.map, 12926 center: { 12927 lat: centerLat, 12928 lng: centerLng, 12929 }, 12930 radius: radius * 1000, 12931 }) 12932 12933 self.__config.circles.push(circle) 12934 12935 return circle 12936 } 12937 12938 /** 12939 * 12940 */ 12941 self.removeCircles = function () { 12942 _check() 12943 sweSikaVertriebspartnerDebugger.debuggingFunc(sweSikaVertriebspartnerDebugger.DEBUG_FUNC_CALLED, 'sweSikaVertriebspartnerMapConstruct.removeCircles') 12944 for (let i = 0; i < self.__config.circles.length; i += 1) { 12945 let circle = self.__config.circles[i] 12946 circle.setMap(null) 12947 } 12948 12949 self.__config.circles = [] 12950 } 12951 12952 /** 12953 * 12954 */ 12955 self.showMarkerClusters = function () { 12956 _check() 12957 sweSikaVertriebspartnerDebugger.debuggingFunc(sweSikaVertriebspartnerDebugger.DEBUG_FUNC_START, 'sweSikaVertriebspartnerMapConstruct.showMarkerClusters') 12958 self.clearMarkerClusters() 12959 12960 if (!self.__config.map || typeof MarkerClusterer !== 'function') return 12961 12962 let _markers = [] 12963 12964 for (let i = 0; i < self.__config.markers.length; i += 1) { 12965 let marker = self.__config.markers[i] 12966 _markers.push(marker) 12967 } 12968 12969 self.__config.marker_clusterer = new MarkerClusterer(self.__config.map, _markers, { imagePath: _markerImagePath + '/m', }) 12970 sweSikaVertriebspartnerDebugger.debuggingFunc(sweSikaVertriebspartnerDebugger.DEBUG_FUNC_END) 12971 } 12972 12973 /** 12974 * 12975 */ 12976 self.clearMarkerClusters = function () { 12977 _check() 12978 sweSikaVertriebspartnerDebugger.debuggingFunc(sweSikaVertriebspartnerDebugger.DEBUG_FUNC_CALLED, 'sweSikaVertriebspartnerMapConstruct.clearMarkerClusters') 12979 if (self.__config.marker_clusterer !== null && typeof self.__config.marker_clusterer === 'object') { 12980 self.__config.marker_clusterer.clearMarkers() 12981 } 12982 12983 self.__config.marker_clusterer = null 12984 } 12985})(window.sweSikaVertriebspartnerMapConstruct) 12986 12987window.sweSikaVertriebspartnerMaps = {}; 12988 12989(function (self) { 12990 'use strict' 12991 12992 /*********** 12993 * Private * 12994 ***********/ 12995 12996 const CUSTOM_STYLE = true, 12997 STYLE = 'roadmap' 12998 12999 let _requiredModules = [ 13000 'google', 13001 'sweSikaVertriebspartnerMapConstruct', 13002 'sweSikaVertriebspartnerHelper', 13003 ], 13004 _suggestedModules = [], 13005 _jsPathContainer = document.querySelector('[data-js-path]'), 13006 _checked = false, 13007 _filename = 'swe-maps', 13008 _api = '', 13009 _src = 'https://maps.googleapis.com/maps/api/js', 13010 _markerScript = '', 13011 _customMarker = false 13012 13013 /** 13014 * @private 13015 */ 13016 function _check () { 13017 if (_checked) return 13018 if (!sweSikaVertriebspartnerDebugger) throw '[' + _filename + '.js] Required namespace "sweSikaVertriebspartnerDebugger" not found.' 13019 13020 sweSikaVertriebspartnerDebugger.checkModules(_requiredModules, 'required', true, _filename) 13021 sweSikaVertriebspartnerDebugger.checkModules(_suggestedModules, 'suggested', false, _filename) 13022 _checked = true 13023 } 13024 13025 /** 13026 * @param {string} src 13027 * @param {function} callback 13028 * @private 13029 */ 13030 function _addScript (src, callback) { 13031 let script = document.createElement('script') 13032 script.type = 'text/javascript' 13033 document.getElementsByTagName('head')[0].appendChild(script) 13034 if (!_customMarker) script.onload = callback 13035 script.src = src 13036 if (_customMarker) _addCustomMarker(callback) 13037 } 13038 13039 /** 13040 * We have to load the custom marker file dynamically after the Google Maps js. 13041 * 13042 * @param {function} callback 13043 * @private 13044 */ 13045 function _addCustomMarker (callback) { 13046 // We have to load the custom marker after google. 13047 let markerScript = document.createElement('script') 13048 markerScript.type = 'text/javascript' 13049 if (typeof callback === 'function') markerScript.onload = callback
13050 document.getElementsByTagName('head')[0].appendChild(markerScript) 13051 markerScript.src = _markerScript 13052 } 13053 13054 /** 13055 * Merge options. 13056 * 13057 * @param {object} custom 13058 * @param {object} options 13059 * @private 13060 */ 13061 function _mergeOptions (custom, options) { 13062 Object.keys(custom).forEach(function (key) { 13063 options[key] = custom[key] 13064 }) 13065 } 13066 13067 /********** 13068 * Public * 13069 **********/ 13070 13071 /** 13072 * @param {boolean} enable 13073 */ 13074 self.enableCustomMarker = function (enable) { 13075 _customMarker = enable 13076 } 13077 13078 /** 13079 * @param {string} src 13080 */ 13081 self.setSrc = function (src) { 13082 _src = src 13083 } 13084 13085 /** 13086 * @param {string} api 13087 */ 13088 self.setApi = function (api) { 13089 _api = api 13090 } 13091 13092 /** 13093 * @param {object} center 13094 * @param {number} center.lat 13095 * @param {number} center.lng 13096 * @param {object} map 13097 */ 13098 self.setCenter = function (center, map) { 13099 map.__config.map.setCenter(center) 13100 } 13101 13102 /** 13103 * @param {object} map 13104 */ 13105 self.resetCenter = function (map) { 13106 self.setCenter(map.__config.options.center, map) 13107 } 13108 13109 /** 13110 * @param {object} map 13111 */ 13112 self.zoomOutMax = function (map) { 13113 self.setZoom(map.__config.options.minZoom, map) 13114 } 13115 13116 /** 13117 * @param {object} map 13118 */ 13119 self.zoomInMax = function (map) { 13120 self.setZoom(map.__config.options.maxZoom, map) 13121 } 13122 13123 /** 13124 * @param {number} zoom 13125 * @param {object} map 13126 */ 13127 self.setZoom = function (zoom, map) { 13128 map.__config.map.setZoom(zoom) 13129 } 13130 13131 /** 13132 * @param {object} map 13133 */ 13134 self.resetZoom = function (map) { 13135 self.setZoom(map.__config.options.zoom, map) 13136 } 13137 13138 /** 13139 * @param {function} callback 13140 */ 13141 self.load = function (callback) { 13142 if (!sweSikaVertriebspartnerHelper.isCookieAllowed()) return 13143 if (_jsPathContainer && _jsPathContainer.hasAttribute('data-js-path')) { 13144 _markerScript = _jsPathContainer.getAttribute('data-js-path') + '/swe-marker.js?' + Date.now() 13145 } 13146 13147 let src = _src 13148 if (_api.length > 0) src += '?key=' + _api 13149 13150 setTimeout(function () { 13151 if (typeof google === 'undefined') { 13152 _addScript(src, callback) 13153 return 13154 } 13155 13156 if (_customMarker) _addCustomMarker(callback) 13157 if (!_customMarker) callback() 13158 }, 500) 13159 } 13160 13161 /** 13162 * Create a new swe maps instance. 13163 * 13164 * @param {object} map 13165 * @param {string} canvasId 13166 * @return {object} 13167 */ 13168 self.create = function (map, canvasId) { 13169 if (!map) map = {} 13170 if (typeof canvasId !== 'string' || canvasId.length < 1) return map 13171 if (!sweSikaVertriebspartnerHelper.getElement(canvasId)) return map 13172 sweSikaVertriebspartnerMapConstruct.enableCustomMarker(_customMarker) 13173 13174 _check() 13175 if (_jsPathContainer && _jsPathContainer.hasAttribute('data-js-path')) { 13176 _markerScript = _jsPathContainer.getAttribute('data-js-path') + '/swe-marker.js?' + Date.now() 13177 } 13178 13179 _mergeOptions(sweSikaVertriebspartnerMapConstruct, map) 13180 13181 if (!CUSTOM_STYLE) { 13182 switch (STYLE.toLowerCase()) { 13183 case 'terrain': 13184 map.__config.options.mapTypeId = google.maps.MapTypeId.TERRAIN 13185 break 13186 case 'satellite': 13187 map.__config.options.mapTypeId = google.maps.MapTypeId.SATELLITE 13188 break 13189 case 'hybrid': 13190 map.__config.options.mapTypeId = google.maps.MapTypeId.HYBRID 13191 break 13192 case 'roadmap': 13193 default: 13194 map.__config.options.mapTypeId = google.maps.MapTypeId.ROADMAP 13195 } 13196 } 13197 13198 map.__config.canvasID = canvasId 13199 let mapCanvas = sweSikaVertriebspartnerHelper.getElement(canvasId) 13200 if (!mapCanvas) return map 13201 sweSikaVertriebspartnerHelper.removeDomClass(mapCanvas, 'no-cookie') 13202 let newMap = new google.maps.Map(mapCanvas, map.__config.options) 13203 13204 if (CUSTOM_STYLE) { 13205 for (let i = 0; i < map.__config.styles.length; i += 1) { 13206 let style = map.__config.styles[i], 13207 mapType = new google.maps.StyledMapType(style.config, { name: style.label }) 13208 newMap.mapTypes.set(style.key, mapType) 13209 newMap.setMapTypeId(style.key) 13210 } 13211 } 13212 13213 google.maps.event.addDomListener(window, 'resize', function () { 13214 let center = newMap.getCenter() 13215 google.maps.event.trigger(newMap, 'resize') 13216 newMap.setCenter(center) 13217 newMap.set('draggable', window.innerWidth > 1024) 13218 }) 13219 13220 map.__config.map = newMap 13221 map.__config.infoWindow = new google.maps.InfoWindow({ content: '' }) 13222 13223 return map 13224 } 13225 13226})(window.sweSikaVertriebspartnerMaps) 13227 13228window.sweSikaVertriebspartnerAjax = {} 13229 13230/******** 13231 * Ajax * 13232 ********/ 13233 13234// https://github.com/yanatan16/nanoajax 13235!function (t, e) { 13236 function n (t) {return t && e.XDomainRequest && !/MSIE 1/.test(navigator.userAgent) ? new XDomainRequest : e.XMLHttpRequest ? new XMLHttpRequest : void 0} 13237 13238 function o (t, e, n) {t[e] = t[e] || n} 13239 13240 var r = ['responseType', 'withCredentials', 'timeout', 'onprogress'] 13241 t.ajax = function (t, a) { 13242 function s (t, e) {return function () {c || (a(void 0 === f.status ? t : f.status, 0 === f.status ? 'Error' : f.response || f.responseText || e, f), c = !0)}} 13243 13244 var u = t.headers || {}, i = t.body, d = t.method || (i ? 'POST' : 'GET'), c = !1, f = n(t.cors) 13245 f.open(d, t.url, !0) 13246 var l = f.onload = s(200) 13247 f.onreadystatechange = function () {4 === f.readyState && l()}, f.onerror = s(null, 'Error'), f.ontimeout = s(null, 'Timeout'), f.onabort = s(null, 'Abort'), i && (o(u, 'X-Requested-With', 'XMLHttpRequest'), e.FormData && i instanceof e.FormData || o(u, 'Content-Type', 'application/x-www-form-urlencoded')) 13248 for (var p, m = 0, v = r.length; v > m; m++) p = r[m], void 0 !== t[p] && (f[p] = t[p]) 13249 for (var p in u) f.setRequestHeader(p, u[p]) 13250 return f.send(i), f 13251 }, e.nanoajax = t 13252}({}, function () {return this}()) 13253 13254;(function (self) { 13255 'use strict' 13256 13257 /*********** 13258 * Private * 13259 ***********/ 13260 13261 let _requiredModules = [], 13262 _suggestedModules = [],
13263 _filename = 'swe-ajax', 13264 _checked = false, 13265 _ajaxPageType = '' 13266 13267 /** 13268 * @private 13269 */ 13270 function _check () { 13271 if (_checked) return 13272 if (!sweSikaVertriebspartnerDebugger) throw '[' + _filename + '.js] Required namespace "sweSikaVertriebspartnerDebugger" not found.' 13273 13274 sweSikaVertriebspartnerDebugger.checkModules(_requiredModules, 'required', true, _filename) 13275 sweSikaVertriebspartnerDebugger.checkModules(_suggestedModules, 'suggested', false, _filename) 13276 _checked = true 13277 } 13278 13279 /********** 13280 * Public * 13281 **********/ 13282 13283 /** 13284 * @param {string} url 13285 * @param {object} postData 13286 * @param {function} processResponse 13287 */ 13288 self.post = function (url, postData, processResponse) { 13289 if (!_checked) return 13290 13291 let body = 'json=' + encodeURIComponent(JSON.stringify(postData)), 13292 info = { 13293 timeout: 0, 13294 url: url, 13295 method: 'POST', 13296 body: body, 13297 } 13298 13299 let postCallback = function (code, responseText, request) { 13300 if (code !== 200) { 13301 sweSikaVertriebspartnerDebugger.error(responseText, sweSikaVertriebspartnerDebugger.LEVEL_ERROR) 13302 return 13303 } 13304 13305 sweSikaVertriebspartnerDebugger.debug(responseText) 13306 let response = JSON.parse(decodeURIComponent(responseText)) 13307 13308 if (typeof processResponse === 'function') processResponse(response) 13309 } 13310 13311 window.nanoajax.ajax(info, postCallback) 13312 } 13313 13314 /** 13315 * @param {string} url 13316 * @param {function} processResponse 13317 */ 13318 self.get = function (url, processResponse) { 13319 if (!_checked) return 13320 13321 let info = { 13322 url: url, 13323 method: 'GET', 13324 } 13325 13326 let getCallback = function (code, responseText, request) { 13327 if (code !== 200) { 13328 sweSikaVertriebspartnerDebugger.error(responseText, sweSikaVertriebspartnerDebugger.LEVEL_ERROR) 13329 return 13330 } 13331 13332 sweSikaVertriebspartnerDebugger.debug(responseText) 13333 let response = JSON.parse(decodeURIComponent(responseText)) 13334 13335 if (typeof processResponse === 'function') processResponse(response) 13336 } 13337 13338 window.nanoajax.ajax(info, getCallback) 13339 } 13340 13341 /** 13342 * @return {string} 13343 */ 13344 self.getDefaultUrl = function () { 13345 return '/?type=' + _ajaxPageType 13346 } 13347 13348 /** 13349 * @param {string} extClass 13350 */ 13351 self.setup = function (extClass) { 13352 _check() 13353 let element = sweSikaVertriebspartnerHelper.getElement(extClass + '-debug') 13354 if (!element) return 13355 13356 _ajaxPageType = element.getAttribute('data-ajax-type') 13357 } 13358}) 13359(sweSikaVertriebspartnerAjax) 13360 13361window.sweSikaVertriebspartner = {}; 13362 13363(function (self) { 13364 'use strict' 13365 13366 /*********** 13367 * Private * 13368 ***********/ 13369 13370 /** 13371 * The extension class. 13372 * 13373 * @type {string} 13374 */ 13375 const _extClass = 'tx-swesikavertriebspartner' 13376 13377 let _requiredModules = [ 13378 'sweSikaVertriebspartnerHelper', 13379 'sweSikaVertriebspartnerMaps', 13380 ], 13381 _suggestedModules = [], 13382 _selectors = { 13383 searchForm: { 13384 input: '#sika-search', 13385 form: '#sika-search-form', 13386 location: '#location-button', 13387 country: '#country', 13388 zipCode: '#postal_code', 13389 }, 13390 map: '#google-map', 13391 address: '.address', 13392 }, 13393 _componentForm = { 13394 country: 'short_name', 13395 postal_code: 'short_name', 13396 }, 13397 _checked = false, 13398 _filename = 'main', 13399 _autocomplete = null, 13400 _lat = 51.2849213, 13401 _lng = 9.6322388, 13402 _recursive = 0, 13403 _formSubmitTimeout = null, 13404 _map = null, 13405 _mapLoaded = false, 13406 _enable = { 13407 map: true, 13408 customMarker: true, 13409 } 13410 13411 /** 13412 * @private 13413 */ 13414 function _check () { 13415 if (_checked) return 13416 if (!sweSikaVertriebspartnerDebugger) throw '[' + _filename + '.js] Required namespace "sweSikaVertriebspartnerDebugger" not found.' 13417 13418 sweSikaVertriebspartnerDebugger.setExtClass(_extClass) 13419 sweSikaVertriebspartnerDebugger.checkModules(_requiredModules, 'required', true, _filename) 13420 sweSikaVertriebspartnerDebugger.checkModules(_suggestedModules, 'suggested', false, _filename) 13421 _checked = true 13422 } 13423 13424 /** 13425 * Initiate the autocomplete element. 13426 * 13427 * @private 13428 */ 13429 function _initAutocomplete () { 13430 _recursive += 1 13431 if (typeof google === 'undefined') { 13432 if (_recursive <= 30) setTimeout(_initAutocomplete, 500) 13433 if (_recursive >= 30) { 13434 console.warn('Autocomplete was not initialized, Google is not defined!') 13435 _recursive = 0 13436 } 13437 13438 return 13439 } 13440 _recursive = 0 13441 13442 // let defaultBounds = new google.maps.LatLngBounds(new google.maps.LatLng(_lat, _lng)), 13443 // inputField = sweSikaVertriebspartnerHelper.getElement(_selectors.searchForm.input), 13444 // autocompleteOptions = { 13445 // bounds: defaultBounds, 13446 // types: ['geocode'], 13447 // } 13448 13449 let inputField = sweSikaVertriebspartnerHelper.getElement(_selectors.searchForm.input) 13450 13451 let lat = inputField.hasAttribute('data-lat') ? inputField.getAttribute('data-lat') : _lat 13452 let lng = inputField.hasAttribute('data-lng') ? inputField.getAttribute('data-lng') : _lng 13453 13454 let defaultBounds = new google.maps.LatLngBounds(new google.maps.LatLng(lat, lng)) 13455 13456 let autocompleteOptions = { 13457 bounds: defaultBounds, 13458 types: ['geocode'], 13459 } 13460 13461 _autocomplete = new google.maps.places.Autocomplete(inputField, autocompleteOptions) 13462 _autocomplete.setFields(['address_components', 'geometry']) 13463 13464 // If the user clicked onto a predicted element. 13465 _autocomplete.addListener('place_changed', function () { 13466 _fillInAddress() 13467 }) 13468 } 13469 13470 /** 13471 * Get the address of the location. 13472 * 13473 * @param address 13474 * @private 13475 */ 13476 function _fillInAddress (address) { 13477 let place = _autocomplete.getPlace() 13478 13479 if (typeof place.address_components === 'undefined') { 13480 place = address 13481 } 13482 13483 for (let key in _componentForm) { 13484 if (!_componentForm.hasOwnProperty(key)) continue 13485 let component = sweSikaVertriebspartnerHelper.getElement('#' + key) 13486 component.value = '' 13487 component.disabled = false 13488 } 13489 13490 for (let i = 0; i < place.address_components.length; i += 1) { 13491 let addressType = place.address_components[i].types[0] 13492 13493 if (!_componentForm[addressType]) continue 13494 let component = sweSikaVertriebspartnerHelper.getElement('#' + addressType) 13495 component.value = place.address_components[i][_componentForm[addressType]] 13496 } 13497 13498 let zipCode = sweSikaVertriebspartnerHelper.getElement(_selectors.searchForm.zipCode), 13499 country = sweSikaVertriebspartnerHelper.getElement(_selectors.searchForm.country) 13500 13501 if (zipCode.value !== '' && country.value !== '') {
13502 _submitForm() 13503 return 13504 } 13505 13506 let lat = place.geometry.location.lat(), 13507 lng = place.geometry.location.lng(), 13508 latLng = { 13509 lat: lat, 13510 lng: lng, 13511 }, 13512 geoCoder = new google.maps.Geocoder 13513 13514 // Find the location via the latitude and longitude. 13515 geoCoder.geocode({ location: latLng }, _geocoding) 13516 } 13517 13518 /** 13519 * Find the user location via browser. 13520 * 13521 * @private 13522 */ 13523 function _findPerUserLocation () { 13524 function success (position) { 13525 let lat = position.coords.latitude; 13526 let lng = position.coords.longitude; 13527 13528 console.log('using your geolocation: lat: '+lat+' lng:'+lng+' '); 13529 13530 let latLng = { 13531 lat: position.coords.latitude, 13532 lng: position.coords.longitude, 13533 }, 13534 13535 // https://developers.google.com/maps/documentation/javascript/reference/geocoder?hl=de 13536 13537 geoCoder = new google.maps.Geocoder 13538 geoCoder.geocode({ location: latLng }, _geocoding) 13539 } 13540 13541 function error (error) { 13542 if (sweSikaVertriebspartnerIE.isIE()) { 13543 alert('Dieser Webbrowser unterstützt die Standortermittlung leider nicht. Verwenden Sie hierfür bitte einen modernen Browser.') 13544 } else { 13545 alert(error.message) 13546 } 13547 } 13548 13549 navigator.geolocation.getCurrentPosition(success, error) 13550 } 13551 13552 /** 13553 * Find the address with geocoding. 13554 * 13555 * @param {array} results 13556 * @param {string} status 13557 * @private 13558 */ 13559 function _geocoding (results, status) { 13560 // called by google.maps.Geocoder.geocode(...) 13561 // https://developers.google.com/maps/documentation/javascript/reference/geocoder?hl=de 13562 13563 if (status !== 'OK') { 13564 console.warn('google.maps.Geocoder.geocode() response: ' + status); 13565 // if an error occurrs, submit form again. (why?) 13566 // _submitForm() 13567 return 13568 } 13569 13570 if (!results[0]) { 13571 console.warn('No results found') 13572 return 13573 } 13574 13575 let searchFieldValue = '' 13576 13577 for (let i = 0; i < results[0].address_components.length; i += 1) { 13578 let addressType = results[0].address_components[i].types[0] 13579 13580 if (addressType === 'administrative_area_level_2') { 13581 searchFieldValue += results[0].address_components[i].long_name 13582 continue 13583 } 13584 13585 if (addressType === 'country') { 13586 searchFieldValue += ', ' + results[0].address_components[i].long_name 13587 } 13588 13589 if (!_componentForm[addressType]) continue 13590 let component = sweSikaVertriebspartnerHelper.getElement('#' + addressType) 13591 component.value = results[0].address_components[i][_componentForm[addressType]] 13592 } 13593 13594 if (searchFieldValue.length) { 13595 sweSikaVertriebspartnerHelper.getElement(_selectors.searchForm.input).value = searchFieldValue 13596 } 13597 13598 _submitForm() 13599 } 13600 13601 /** 13602 * @private 13603 */ 13604 function _submitForm () { 13605 if (_formSubmitTimeout) clearTimeout(_formSubmitTimeout) 13606 _formSubmitTimeout = setTimeout(function () { 13607 sweSikaVertriebspartnerHelper.getElement(_selectors.searchForm.form).submit() 13608 }, 500) 13609 } 13610 13611 /** 13612 * Form submit event. 13613 * 13614 * @param {Event} event 13615 * @return {boolean} 13616 * @private 13617 */ 13618 function _formSubmitEvent (event) { 13619 let countryField = sweSikaVertriebspartnerHelper.getElement(_selectors.searchForm.country) 13620 13621 if (!countryField.value.length) { 13622 event.preventDefault() 13623 event.stopPropagation() 13624 return false 13625 } 13626 } 13627 13628 /** 13629 * Init google for the autocomplete. 13630 * 13631 * @private 13632 */ 13633 function _initGoogleForAutocomplete () { 13634 if (!sweSikaVertriebspartnerHelper.isCookieAllowed()) { 13635 console.warn('cookies not allowed, do not init google for autocomplete!'); 13636 return 13637 } 13638 13639 let searchInput = sweSikaVertriebspartnerHelper.getElement(_selectors.searchForm.input) 13640 if (!searchInput || !searchInput.hasAttribute('data-key')) return 13641 13642 let language = searchInput.hasAttribute('data-googlemapslanguage') ? searchInput.getAttribute('data-googlemapslanguage') : 'de' 13643 13644 let key = searchInput.getAttribute('data-key'), 13645 script = document.createElement('script') 13646 script.type = 'text/javascript' 13647 script.onload = _initAutocomplete 13648 script.async = true
13649 script.src = 'https://maps.googleapis.com/maps/api/js?v=3&language=' + language + '&key=' + key + '&libraries=places' 13650 document.head.appendChild(script) 13651 } 13652 13653 /** 13654 * Init event listeners. 13655 * 13656 * @private 13657 */ 13658 function _initEventListeners () { 13659 let locationButton = sweSikaVertriebspartnerHelper.getElement(_selectors.searchForm.location) 13660 if (locationButton) locationButton.addEventListener('click', _findPerUserLocation) 13661 13662 let form = sweSikaVertriebspartnerHelper.getElement(_selectors.searchForm.form) 13663 if (form) form.addEventListener('submit', _formSubmitEvent) 13664 } 13665 13666 /** 13667 * @private 13668 */ 13669 function _createMap () { 13670 if (!_enable.map) return 13671 _map = sweSikaVertriebspartnerMaps.create({}, _selectors.map) 13672 _mapLoaded = true 13673 _updateMarkers() 13674 } 13675 13676 /** 13677 * @private 13678 */ 13679 function _updateMarkers () { 13680 if (!_enable.map) return 13681 let addresses = sweSikaVertriebspartnerHelper.getElements(_selectors.address) 13682 _map.removeMarkers() 13683 13684 for (let i = 0; i < addresses.length; i += 1) { 13685 let address = addresses[i] 13686 13687 if (!address.hasAttribute('data-lat') || !address.hasAttribute('data-lng')) continue 13688 let lat = address.getAttribute('data-lat'), 13689 lng = address.getAttribute('data-lng') 13690 13691 if (!lat.length || !lng.length) continue 13692 13693 let marker = _map.addMarker(lat, lng) 13694 13695 marker.addListener('mouseover', function () { 13696 for (let j = 0; j < addresses.length; j += 1) { 13697 let className = address === addresses[j] ? 'focus' : 'fade-out' 13698 sweSikaVertriebspartnerHelper.addDomClass(addresses[j], className) 13699 } 13700 }) 13701 13702 marker.addListener('mouseout', function () { 13703 for (let j = 0; j < addresses.length; j += 1) { 13704 let className = address === addresses[j] ? 'focus' : 'fade-out' 13705 sweSikaVertriebspartnerHelper.removeDomClass(addresses[j], className) 13706 } 13707 }) 13708 } 13709 13710 let defaultMarker = _map.addMarker(51.2849213, 9.6322388) 13711 13712 defaultMarker.addListener('mouseover', function () { 13713 for (let j = 0; j < addresses.length; j += 1) { 13714 let className = !addresses[j].getAttribute('data-lng') || !addresses[j].getAttribute('data-lat') ? 'focus' : 'fade-out' 13715 sweSikaVertriebspartnerHelper.addDomClass(addresses[j], className) 13716 } 13717 }) 13718 13719 defaultMarker.addListener('mouseout', function () { 13720 for (let j = 0; j < addresses.length; j += 1) { 13721 let className = !addresses[j].getAttribute('data-lng') || !addresses[j].getAttribute('data-lat') ? 'focus' : 'fade-out' 13722 sweSikaVertriebspartnerHelper.removeDomClass(addresses[j], className) 13723 } 13724 }) 13725 13726 if (_map.__config.markers.length > 1) _map.fitMarkersBounds() 13727 } 13728 13729 /** 13730 * @private 13731 */ 13732 function _initGoogleMap () { 13733 if (_mapLoaded || !_enable.map) return 13734 let mapElement = sweSikaVertriebspartnerHelper.getElement(_selectors.map) 13735 if (!mapElement || !mapElement.hasAttribute('data-key')) return 13736 let key = mapElement.getAttribute('data-key') 13737 sweSikaVertriebspartnerMaps.enableCustomMarker(_enable.customMarker) 13738 sweSikaVertriebspartnerMaps.setApi(key) 13739 sweSikaVertriebspartnerMaps.load(_createMap) 13740 } 13741 13742 /********** 13743 * Public * 13744 **********/ 13745 13746 /** 13747 * Initiate the module. 13748 */ 13749 self.init = function () { 13750 _check() 13751 sweSikaVertriebspartnerIE.setup(_extClass) 13752 sweSikaVertriebspartnerAjax.setup(_extClass) 13753 sweSikaVertriebspartnerHelper.setCookieProtection(false) 13754 13755 // Action search 13756 _initGoogleForAutocomplete() 13757 _initEventListeners() 13758 13759 // Action result 13760 _initGoogleMap() 13761 13762 sweSikaVertriebspartnerDebugger.debug('sweSikaVertriebspartner is loaded.', sweSikaVertriebspartnerDebugger.LEVEL_INFO) 13763 } 13764 13765})(window.sweSikaVertriebspartner) 13766 13767// Initiate this js module when the content is loaded. 13768document.addEventListener('DOMContentLoaded', function (e) { 13769 try { 13770 window.sweSikaVertriebspartner.init() 13771 } catch (e) { 13772 console.warn('unable to load sweSikaVertriebspartner.') 13773 console.warn(e) 13774 } 13775})
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.