var ewww_webp_supported,swis_lazy_css_images;void 0===ewww_webp_supported&&(ewww_webp_supported=!1),void 0===swis_lazy_css_images&&(swis_lazy_css_images={}),window.lazySizesConfig=window.lazySizesConfig||{},window.lazySizesConfig.expand=500<document.documentElement.clientHeight&&500<document.documentElement.clientWidth?1e3:740,window.lazySizesConfig.iframeLoadMode=1,"undefined"==typeof eio_lazy_vars&&(eio_lazy_vars={exactdn_domain:".exactdn.com",threshold:0,skip_autoscale:0,use_dpr:0}),50<eio_lazy_vars.threshold&&(window.lazySizesConfig.expand=eio_lazy_vars.threshold);for(const[a,b]of Object.entries(swis_lazy_css_images))try{document.querySelectorAll(b[0].selector).forEach(e=>{e.classList.contains("lazyload")||(e.classList.add("lazyload"),e.dataset.swisLazyId=a,5<b[0].rwidth&&5<b[0].rheight&&(e.dataset.eioRwidth=b[0].rwidth,e.dataset.eioRheight=b[0].rheight))})}catch(e){}!function(e,t){function a(){t(e.lazySizes),e.removeEventListener("lazyunveilread",a,!0)}t=t.bind(null,e,e.document),"object"==typeof module&&module.exports?t(require("lazysizes")):"function"==typeof define&&define.amd?define(["lazysizes"],t):e.lazySizes?a():e.addEventListener("lazyunveilread",a,!0)}(window,function(e,n,s){"use strict";var o,l,d={};function c(e,t,a){var i,r;d[e]||(i=n.createElement(t?"link":"script"),r=n.getElementsByTagName("script")[0],t?(i.rel="stylesheet",i.href=e):(i.onload=function(){i.onerror=null,i.onload=null,a()},i.onerror=i.onload,i.src=e),d[e]=!0,d[i.src||i.href]=!0,r.parentNode.insertBefore(i,r))}n.addEventListener&&(l=/\(|\)|\s|'/,o=function(e,t){var a=n.createElement("img");a.onload=function(){a.onload=null,a.onerror=null,a=null,t()},a.onerror=a.onload,a.src=e,a&&a.complete&&a.onload&&a.onload()},addEventListener("lazybeforeunveil",function(e){var t,a,i;if(e.detail.instance==s&&!e.defaultPrevented){var r=e.target;if("none"==r.preload&&(r.preload=r.getAttribute("data-preload")||"auto"),null!=r.getAttribute("data-autoplay"))if(r.getAttribute("data-expand")&&!r.autoplay)try{r.play()}catch(e){}else requestAnimationFrame(function(){r.setAttribute("data-expand","-10"),s.aC(r,s.cfg.lazyClass)});(t=r.getAttribute("data-link"))&&c(t,!0),(t=r.getAttribute("data-script"))&&(e.detail.firesLoad=!0,c(t,null,function(){e.detail.firesLoad=!1,s.fire(r,"_lazyloaded",{},!0,!0)})),(t=r.getAttribute("data-require"))&&(s.cfg.requireJs?s.cfg.requireJs([t]):c(t)),(a=r.getAttribute("data-bg"))&&(e.detail.firesLoad=!0,o(a,function(){r.style.backgroundImage="url("+(l.test(a)?JSON.stringify(a):a)+")",e.detail.firesLoad=!1,s.fire(r,"_lazyloaded",{},!0,!0)})),(i=r.getAttribute("data-poster"))&&(e.detail.firesLoad=!0,o(i,function(){r.poster=i,e.detail.firesLoad=!1,s.fire(r,"_lazyloaded",{},!0,!0)}))}},!1))}),function(e,t){function a(){t(e.lazySizes),e.removeEventListener("lazyunveilread",a,!0)}t=t.bind(null,e,e.document),"object"==typeof module&&module.exports?t(require("lazysizes")):"function"==typeof define&&define.amd?define(["lazysizes"],t):e.lazySizes?a():e.addEventListener("lazyunveilread",a,!0)}(window,function(u,f,h){"use strict";var r;f.addEventListener&&(r=/\(|\)|\s|'/,addEventListener("lazybeforeunveil",function(t){var e,a,i;t.detail.instance==h&&(t.defaultPrevented||("none"==t.target.preload&&(t.target.preload="auto"),(a=t.target.dataset.back)&&(ewww_webp_supported&&(e=t.target.dataset.backWebp)&&(a=e),a=n(a,t.target),t.target.style.backgroundImage&&-1===t.target.style.backgroundImage.search(/^initial/)?0===a.search(/\[/)?((a=JSON.parse(a)).forEach(function(e){r.test(e)&&JSON.stringify(e)}),a='url("'+a.join('"), url("')+'"',e=t.target.style.backgroundImage+", "+a,t.target.style.backgroundImage=e):t.target.style.backgroundImage=t.target.style.backgroundImage+', url("'+(r.test(a)?JSON.stringify(a):a)+'")':0===a.search(/\[/)?((a=JSON.parse(a)).forEach(function(e){r.test(e)&&JSON.stringify(e)}),a='url("'+a.join('"), url("')+'"',t.target.style.backgroundImage=a):t.target.style.backgroundImage="url("+(r.test(a)?JSON.stringify(a):a)+")"),(a=t.target.dataset.swisLazyId)&&a in swis_lazy_css_images&&(a=swis_lazy_css_images[a],i=f.querySelector("style#swis-lazy-css-styles"),a.forEach(function(e){e.url&&(ewww_webp_supported&&e.webp_url&&(e.url=e.webp_url),e.url=n(e.url,t.target),e=e.selector+" {--swis-bg-"+e.hash+": url("+e.url+"); }",i.sheet.insertRule(e))}))))},!1));function g(e,t=!1){var a=y(),i=Math.round(e.offsetWidth*a),r=Math.round(e.offsetHeight*a),n=e.getAttribute("data-src"),a=e.getAttribute("data-src-webp");ewww_webp_supported&&a&&-1==n.search("webp=1")&&!t&&(n=a),o(e)&&(a=e,a=h.hC(a,"et_pb_jt_filterable_grid_item_image")||h.hC(a,"ss-foreground-image")||h.hC(a,"img-crop")?"img-crop":h.hC(a,"object-cover")&&(h.hC(a,"object-top")||h.hC(a,"object-bottom"))?"img-w":h.hC(a,"object-cover")&&(h.hC(a,"object-left")||h.hC(a,"object-right"))?"img-h":h.hC(a,"ct-image")&&h.hC(a,"object-cover")||!a.getAttribute("data-srcset")&&!a.srcset&&a.offsetHeight>a.offsetWidth&&1<d(a)?"img-crop":"img",(a=l(n,i,r,a,t))&&n!=a&&(t&&e.setAttribute("src",a),e.setAttribute("data-src",a)))}var n=function(e,t){if(0===e.search(/\[/))return e;if(!o(t))return e;var a=y();a<eio_lazy_vars.bg_min_dpr&&(a=eio_lazy_vars.bg_min_dpr);var i=Math.round(t.offsetWidth*a),r=Math.round(t.offsetHeight*a),n="bg";h.hC(t,"wp-block-cover")||h.hC(t,"wp-block-cover__image-background")?(h.hC(t,"has-parallax")?(i=Math.round(u.screen.width*a),r=Math.round(u.screen.height*a)):r<300&&(r=430),n="bg-cover"):(h.hC(t,"cover-image")||h.hC(t,"elementor-bg")||h.hC(t,"et_parallax_bg")||h.hC(t,"bg-image-crop"))&&(n="bg-cover");var s=d(t);if("bg"==n&&1<r&&1<i&&0<s){a=Math.ceil(r*s),s=Math.ceil(i/s);i+2<a&&(i=a),r+2<s&&(r=s);t=p(t);if(Math.abs(t.w-i)<5||Math.abs(t.h-r)<5)return e}return e=l(e,i,r,n)},o=function(e){if(1==eio_lazy_vars.skip_autoscale)return!1;for(var t=e,a=0;a<=7;a++){if(t.hasAttributes())for(var i=t.attributes,r=/skip-autoscale/,a=i.length-1;0<=a;a--){if(r.test(i[a].name))return!1;if(r.test(i[a].value))return!1}if(!t.parentNode||1!==t.parentNode.nodeType||!t.parentNode.hasAttributes)break;t=t.parentNode}return!0},l=function(e,t,a,i,r=!1){if(null===e)return e;var n=/w=(\d+)/,s=/fit=(\d+),(\d+)/,o=/resize=(\d+),(\d+)/,l=decodeURIComponent(e);if(/\.svg(\?.+)?$/.exec(l))return e;if(0<e.search("\\?")&&0<e.search(eio_lazy_vars.exactdn_domain)){var d=o.exec(l);if(d&&(t<d[1]||r))return"img-w"===i?l.replace(o,"w="+t):"img-h"===i?l.replace(o,"h="+a):l.replace(o,"resize="+t+","+a);o=n.exec(e);if(o&&(t<=o[1]||r)){if("img-h"===i)return l.replace(n,"h="+a);if("bg-cover"!==i&&"img-crop"!==i)return e.replace(n,"w="+t);var c=Math.abs(o[1]-t);return 20<c||a<1080?e.replace(n,"resize="+t+","+a):e}c=s.exec(l);if(c&&(t<c[1]||r)){if("bg-cover"!==i&&"img-crop"!==i)return"img-w"===i?l.replace(s,"w="+t):"img-h"===i?l.replace(s,"h="+a):l.replace(s,"fit="+t+","+a);l=Math.abs(c[1]-t),s=Math.abs(c[2]-a);return 20<l||20<s?e.replace(n,"resize="+t+","+a):e}if(!o&&!c&&!d)return"img"===i?e+"&fit="+t+","+a:"bg-cover"===i||"img-crop"===i?e+"&resize="+t+","+a:"img-h"===i||t<a?e+"&h="+a:e+"&w="+t}return-1==e.search("\\?")&&0<e.search(eio_lazy_vars.exactdn_domain)?"img"===i?e+"?fit="+t+","+a:"bg-cover"===i||"img-crop"===i?e+"?resize="+t+","+a:"img-h"===i||t<a?e+"?h="+a:e+"?w="+t:e},m=function(e){e=/-(\d+)x(\d+)\./.exec(e);return e&&1<e[1]&&1<e[2]?{w:e[1],h:e[2]}:{w:0,h:0}},p=function(e){var t=e.dataset.eioRwidth,e=e.dataset.eioRheight;return 1<t&&1<e?{w:t,h:e}:{w:0,h:0}},d=function(e){var t=e.getAttribute("width"),a=e.getAttribute("height");if(1<t&&1<a)return t/a;a=!1;if(a=(a=e.src&&-1<e.src.search("http")?e.src:a)||e.getAttribute("data-src")){var i=m(a);if(i.w&&i.h)return i.w/i.h}i=p(e);if(i.w&&i.h)return i.w/i.h;e=function(e){var t;if(e.srcset?t=e.srcset.split(","):(e=e.getAttribute("data-srcset"))&&(t=e.split(",")),t){var a=0,i=t.length;if(i){for(;a<i;a++){var r,n=t[a].trim().split(" ");!n[0].length||(n=m(n[0])).w&&n.h&&(r=n)}if(r.w&&r.h)return r}}return{w:0,h:0}}(e);return e.w&&e.h?e.w/e.h:0},y=function(){return eio_lazy_vars.use_dpr&&1<u.devicePixelRatio?u.devicePixelRatio:1};f.addEventListener("lazybeforesizes",function(e){e.target.getAttribute("data-src");var t=d(e.target);1<e.target.clientHeight&&t&&(t=Math.ceil(t*e.target.clientHeight),e.detail.width+2<t&&(e.detail.width=t)),void 0!==e.target._lazysizesWidth?(!eio_lazy_vars.use_dpr&&1<u.devicePixelRatio&&(e.detail.width=Math.ceil(e.detail.width/u.devicePixelRatio)),e.detail.width<e.target._lazysizesWidth&&(e.detail.width=e.target._lazysizesWidth)):!eio_lazy_vars.use_dpr&&1<u.devicePixelRatio&&(e.detail.width=Math.ceil(e.detail.width/u.devicePixelRatio))}),f.addEventListener("lazybeforeunveil",function(e){var t,a,i,r,n=e.target,s=n.getAttribute("data-srcset");n.naturalWidth&&!s&&1<n.naturalWidth&&1<n.naturalHeight&&(t=y(),a=n.naturalWidth,i=n.naturalHeight,(e=p(n)).w&&e.w>a&&(a=e.w,i=e.h),a=n.clientWidth&&1.25*n.clientWidth*t<a,i=n.clientHeight&&1.25*n.clientHeight*t<i,(a||i)&&g(n)),ewww_webp_supported&&(!s||(r=n.getAttribute("data-srcset-webp"))&&n.setAttribute("data-srcset",r),(r=n.getAttribute("data-src-webp"))&&n.setAttribute("data-src",r))});function e(e=!1){e.type&&"load"===e.type&&h.autoSizer.checkElems(),y();var t,a=f.getElementsByClassName(h.cfg.loadedClass),i=a.length;if(i)for(t=0;t<i;t++){var r,n,s,o,l,d,c=a[t];c.src&&!c.srcset&&1<c.naturalWidth&&1<c.naturalHeight&&1<c.clientWidth&&1<c.clientHeight&&(r=c.naturalWidth,n=c.naturalHeight,s=u.innerWidth,o=u.innerHeight,l=p(c),d=m(c.src),l.w?s=l.w:d.w&&(s=d.w),l.h?o=l.h:d.h&&(o=d.h),l=c.clientWidth,d=c.clientHeight,(1.1*r<l&&l<=s||1.1*n<d&&d<=o)&&g(c,!0))}}var t,a,i,s,c=(t=e,s=function(){a=null,t()},function(){i=Date.now(),a=a||setTimeout(v,99)});function v(){var e=Date.now()-i;e<99?setTimeout(v,99-e):(u.requestIdleCallback||s)(s)}addEventListener("load",e),addEventListener("resize",c),setTimeout(e,2e4)}),function(e,t){t=t(e,e.document,Date);e.lazySizes=t,"object"==typeof module&&module.exports&&(module.exports=t)}("undefined"!=typeof window?window:{},function(i,f,n){"use strict";var h,g;if(!function(){var e,t={lazyClass:"lazyload",loadedClass:"lazyloaded",loadingClass:"lazyloading",preloadClass:"lazypreload",errorClass:"lazyerror",autosizesClass:"lazyautosizes",fastLoadedClass:"ls-is-cached",iframeLoadMode:0,srcAttr:"data-src",srcsetAttr:"data-srcset",sizesAttr:"data-sizes",minSize:40,customMedia:{},init:!0,expFactor:1.5,hFac:.8,loadMode:2,loadHidden:!0,ricTimeout:0,throttleDelay:125};for(e in g=i.lazySizesConfig||i.lazysizesConfig||{},t)e in g||(g[e]=t[e])}(),!f||!f.getElementsByClassName)return{init:function(){},cfg:g,noSupport:!0};function c(e,t){E(e,t)||e.setAttribute("class",(e[y]("class")||"").trim()+" "+t)}function u(e,t){(t=E(e,t))&&e.setAttribute("class",(e[y]("class")||"").replace(t," "))}function m(e,t){var a;!l&&(a=i.picturefill||g.pf)?(t&&t.src&&!e[y]("srcset")&&e.setAttribute("srcset",t.src),a({reevaluate:!0,elements:[e]})):t&&t.src&&(e.src=t.src)}var a,r,t,s,o,p=f.documentElement,l=i.HTMLPictureElement,d="addEventListener",y="getAttribute",e=i[d].bind(i),v=i.setTimeout,z=i.requestAnimationFrame||v,b=i.requestIdleCallback,w=/^picture$/i,_=["load","error","lazyincluded","_lazyloaded"],C={},A=Array.prototype.forEach,E=function(e,t){return C[t]||(C[t]=new RegExp("(\\s|^)"+t+"(\\s|$)")),C[t].test(e[y]("class")||"")&&C[t]},L=function(t,a,e){var i=e?d:"removeEventListener";e&&L(t,a),_.forEach(function(e){t[i](e,a)})},x=function(e,t,a,i,r){var n=f.createEvent("Event");return(a=a||{}).instance=h,n.initEvent(t,!i,!r),n.detail=a,e.dispatchEvent(n),n},M=function(e,t){return(getComputedStyle(e,null)||{})[t]},N=function(e,t,a){for(a=a||e.offsetWidth;a<g.minSize&&t&&!e._lazysizesWidth;)a=t.offsetWidth,t=t.parentNode;return a},S=(s=[],o=t=[],k._lsFlush=W,k);function W(){var e=o;for(o=t.length?s:t,r=!(a=!0);e.length;)e.shift()();a=!1}function k(e,t){a&&!t?e.apply(this,arguments):(o.push(e),r||(r=!0,(f.hidden?v:z)(W)))}function H(a,e){return e?function(){S(a)}:function(){var e=this,t=arguments;S(function(){a.apply(e,t)})}}function R(e){function t(){var e=n.now()-i;e<99?v(t,99-e):(b||r)(r)}var a,i,r=function(){a=null,e()};return function(){i=n.now(),a=a||v(t,99)}}var I,j,T,O,P,q,B,F,J,D,$,U,G,K,Q,V,X,Y,Z,ee,te,ae,ie,re,ne,se,oe,le,de,ce,ue,fe=(Z=/^img$/i,ee=/^iframe$/i,te="onscroll"in i&&!/(gle|ing)bot/.test(navigator.userAgent),re=-1,ne=function(e){return(U=null==U?"hidden"==M(f.body,"visibility"):U)||!("hidden"==M(e.parentNode,"visibility")&&"hidden"==M(e,"visibility"))},G=ge,Q=ie=ae=0,V=g.throttleDelay,X=g.ricTimeout,Y=b&&49<X?function(){b(me,{timeout:X}),X!==g.ricTimeout&&(X=g.ricTimeout)}:H(function(){v(me)},!0),oe=H(pe),le=function(e){oe({target:e.target})},de=H(function(t,e,a,i,r){var n,s,o,l,d;(o=x(t,"lazybeforeunveil",e)).defaultPrevented||(i&&(a?c(t,g.autosizesClass):t.setAttribute("sizes",i)),n=t[y](g.srcsetAttr),a=t[y](g.srcAttr),r&&(s=(d=t.parentNode)&&w.test(d.nodeName||"")),l=e.firesLoad||"src"in t&&(n||a||s),o={target:t},c(t,g.loadingClass),l&&(clearTimeout(T),T=v(he,2500),L(t,le,!0)),s&&A.call(d.getElementsByTagName("source"),ye),n?t.setAttribute("srcset",n):a&&!s&&(ee.test(t.nodeName)?(i=a,0==(d=(e=t).getAttribute("data-load-mode")||g.iframeLoadMode)?e.contentWindow.location.replace(i):1==d&&(e.src=i)):t.src=a),r&&(n||s)&&m(t,{src:a})),t._lazyRace&&delete t._lazyRace,u(t,g.lazyClass),S(function(){var e=t.complete&&1<t.naturalWidth;l&&!e||(e&&c(t,g.fastLoadedClass),pe(o),t._lazyCache=!0,v(function(){"_lazyCache"in t&&delete t._lazyCache},9)),"lazy"==t.loading&&ie--},!0)}),ue=R(function(){g.loadMode=3,se()}),{_:function(){P=n.now(),h.elements=f.getElementsByClassName(g.lazyClass),I=f.getElementsByClassName(g.lazyClass+" "+g.preloadClass),e("scroll",se,!0),e("resize",se,!0),e("pageshow",function(e){var t;!e.persisted||(t=f.querySelectorAll("."+g.loadingClass)).length&&t.forEach&&z(function(){t.forEach(function(e){e.complete&&ce(e)})})}),i.MutationObserver?new MutationObserver(se).observe(p,{childList:!0,subtree:!0,attributes:!0}):(p[d]("DOMNodeInserted",se,!0),p[d]("DOMAttrModified",se,!0),setInterval(se,999)),e("hashchange",se,!0),["focus","mouseover","click","load","transitionend","animationend"].forEach(function(e){f[d](e,se,!0)}),/d$|^c/.test(f.readyState)?ze():(e("load",ze),f[d]("DOMContentLoaded",se),v(ze,2e4)),h.elements.length?(ge(),S._lsFlush()):se()},checkElems:se=function(e){var t;(e=!0===e)&&(X=33),K||(K=!0,(t=V-(n.now()-Q))<0&&(t=0),e||t<9?Y():v(Y,t))},unveil:ce=function(e){var t,a,i,r;e._lazyRace||(!(r="auto"==(i=(a=Z.test(e.nodeName))&&(e[y](g.sizesAttr)||e[y]("sizes"))))&&j||!a||!e[y]("src")&&!e.srcset||e.complete||E(e,g.errorClass)||!E(e,g.lazyClass))&&(t=x(e,"lazyunveilread").detail,r&&Ce.updateElem(e,!0,e.offsetWidth),e._lazyRace=!0,ie++,de(e,t,r,i,a))},_aLSL:ve});function he(e){ie--,e&&!(ie<0)&&e.target||(ie=0)}function ge(){var e,t,a,i,r,n,s,o,l,d,c,u=h.elements;if((O=g.loadMode)&&ie<8&&(e=u.length)){for(t=0,re++;t<e;t++)if(u[t]&&!u[t]._lazyRace)if(!te||h.prematureUnveil&&h.prematureUnveil(u[t]))ce(u[t]);else if((s=u[t][y]("data-expand"))&&(r=+s)||(r=ae),l||(l=!g.expand||g.expand<1?500<p.clientHeight&&500<p.clientWidth?500:370:g.expand,d=(h._defEx=l)*g.expFactor,c=g.hFac,U=null,ae<d&&ie<1&&2<re&&2<O&&!f.hidden?(ae=d,re=0):ae=1<O&&1<re&&ie<6?l:0),o!==r&&(q=innerWidth+r*c,B=innerHeight+r,n=-1*r,o=r),d=u[t].getBoundingClientRect(),($=d.bottom)>=n&&(F=d.top)<=B&&(D=d.right)>=n*c&&(J=d.left)<=q&&($||D||J||F)&&(g.loadHidden||ne(u[t]))&&(j&&ie<3&&!s&&(O<3||re<4)||function(e,t){var a,i=e,r=ne(e);for(F-=t,$+=t,J-=t,D+=t;r&&(i=i.offsetParent)&&i!=f.body&&i!=p;)(r=0<(M(i,"opacity")||1))&&"visible"!=M(i,"overflow")&&(a=i.getBoundingClientRect(),r=D>a.left&&J<a.right&&$>a.top-1&&F<a.bottom+1);return r}(u[t],r))){if(ce(u[t]),i=!0,9<ie)break}else!i&&j&&!a&&ie<4&&re<4&&2<O&&(I[0]||g.preloadAfterLoad)&&(I[0]||!s&&($||D||J||F||"auto"!=u[t][y](g.sizesAttr)))&&(a=I[0]||u[t]);a&&!i&&ce(a)}}function me(){K=!1,Q=n.now(),G()}function pe(e){var t=e.target;t._lazyCache?delete t._lazyCache:(he(e),c(t,g.loadedClass),u(t,g.loadingClass),L(t,le),x(t,"lazyloaded"))}function ye(e){var t,a=e[y](g.srcsetAttr);(t=g.customMedia[e[y]("data-media")||e[y]("media")])&&e.setAttribute("media",t),a&&e.setAttribute("srcset",a)}function ve(){3==g.loadMode&&(g.loadMode=2),ue()}function ze(){j||(n.now()-P<999?v(ze,999):(j=!0,g.loadMode=3,se(),e("scroll",ve,!0)))}var be,we,_e,Ce=(we=H(function(e,t,a,i){var r,n,s;if(e._lazysizesWidth=i,e.setAttribute("sizes",i+="px"),w.test(t.nodeName||""))for(n=0,s=(r=t.getElementsByTagName("source")).length;n<s;n++)r[n].setAttribute("sizes",i);a.detail.dataAttr||m(e,a.detail)}),{_:function(){be=f.getElementsByClassName(g.autosizesClass),e("resize",_e)},checkElems:_e=R(function(){var e,t=be.length;if(t)for(e=0;e<t;e++)Ae(be[e])}),updateElem:Ae});function Ae(e,t,a){var i=e.parentNode;i&&(a=N(e,i,a),(t=x(e,"lazybeforesizes",{width:a,dataAttr:!!t})).defaultPrevented||(a=t.detail.width)&&a!==e._lazysizesWidth&&we(e,i,t,a))}function Ee(){!Ee.i&&f.getElementsByClassName&&(Ee.i=!0,Ce._(),fe._())}return v(function(){g.init&&Ee()}),h={cfg:g,autoSizer:Ce,loader:fe,init:Ee,uP:m,aC:c,rC:u,hC:E,fire:x,gW:N,rAF:S}});
!function(e,t){"function"==typeof define&&define.amd?define("ev-emitter/ev-emitter",t):"object"==typeof module&&module.exports?module.exports=t():e.EvEmitter=t()}("undefined"!=typeof window?window:this,function(){function e(){}var t=e.prototype;return t.on=function(e,t){if(e&&t){var i=this._events=this._events||{},n=i[e]=i[e]||[];return n.indexOf(t)==-1&&n.push(t),this}},t.once=function(e,t){if(e&&t){this.on(e,t);var i=this._onceEvents=this._onceEvents||{},n=i[e]=i[e]||{};return n[t]=!0,this}},t.off=function(e,t){var i=this._events&&this._events[e];if(i&&i.length){var n=i.indexOf(t);return n!=-1&&i.splice(n,1),this}},t.emitEvent=function(e,t){var i=this._events&&this._events[e];if(i&&i.length){i=i.slice(0),t=t||[];for(var n=this._onceEvents&&this._onceEvents[e],o=0;o<i.length;o++){var r=i[o],s=n&&n[r];s&&(this.off(e,r),delete n[r]),r.apply(this,t)}return this}},t.allOff=function(){delete this._events,delete this._onceEvents},e}),function(e,t){"use strict";"function"==typeof define&&define.amd?define(["ev-emitter/ev-emitter"],function(i){return t(e,i)}):"object"==typeof module&&module.exports?module.exports=t(e,require("ev-emitter")):e.imagesLoaded=t(e,e.EvEmitter)}("undefined"!=typeof window?window:this,function(e,t){function i(e,t){for(var i in t)e[i]=t[i];return e}function n(e){if(Array.isArray(e))return e;var t="object"==typeof e&&"number"==typeof e.length;return t?d.call(e):[e]}function o(e,t,r){if(!(this instanceof o))return new o(e,t,r);var s=e;return"string"==typeof e&&(s=document.querySelectorAll(e)),s?(this.elements=n(s),this.options=i({},this.options),"function"==typeof t?r=t:i(this.options,t),r&&this.on("always",r),this.getImages(),h&&(this.jqDeferred=new h.Deferred),void setTimeout(this.check.bind(this))):void a.error("Bad element for imagesLoaded "+(s||e))}function r(e){this.img=e}function s(e,t){this.url=e,this.element=t,this.img=new Image}var h=e.jQuery,a=e.console,d=Array.prototype.slice;o.prototype=Object.create(t.prototype),o.prototype.options={},o.prototype.getImages=function(){this.images=[],this.elements.forEach(this.addElementImages,this)},o.prototype.addElementImages=function(e){"IMG"==e.nodeName&&this.addImage(e),this.options.background===!0&&this.addElementBackgroundImages(e);var t=e.nodeType;if(t&&u[t]){for(var i=e.querySelectorAll("img"),n=0;n<i.length;n++){var o=i[n];this.addImage(o)}if("string"==typeof this.options.background){var r=e.querySelectorAll(this.options.background);for(n=0;n<r.length;n++){var s=r[n];this.addElementBackgroundImages(s)}}}};var u={1:!0,9:!0,11:!0};return o.prototype.addElementBackgroundImages=function(e){var t=getComputedStyle(e);if(t)for(var i=/url\((['"])?(.*?)\1\)/gi,n=i.exec(t.backgroundImage);null!==n;){var o=n&&n[2];o&&this.addBackground(o,e),n=i.exec(t.backgroundImage)}},o.prototype.addImage=function(e){var t=new r(e);this.images.push(t)},o.prototype.addBackground=function(e,t){var i=new s(e,t);this.images.push(i)},o.prototype.check=function(){function e(e,i,n){setTimeout(function(){t.progress(e,i,n)})}var t=this;return this.progressedCount=0,this.hasAnyBroken=!1,this.images.length?void this.images.forEach(function(t){t.once("progress",e),t.check()}):void this.complete()},o.prototype.progress=function(e,t,i){this.progressedCount++,this.hasAnyBroken=this.hasAnyBroken||!e.isLoaded,this.emitEvent("progress",[this,e,t]),this.jqDeferred&&this.jqDeferred.notify&&this.jqDeferred.notify(this,e),this.progressedCount==this.images.length&&this.complete(),this.options.debug&&a&&a.log("progress: "+i,e,t)},o.prototype.complete=function(){var e=this.hasAnyBroken?"fail":"done";if(this.isComplete=!0,this.emitEvent(e,[this]),this.emitEvent("always",[this]),this.jqDeferred){var t=this.hasAnyBroken?"reject":"resolve";this.jqDeferred[t](this)}},r.prototype=Object.create(t.prototype),r.prototype.check=function(){var e=this.getIsImageComplete();return e?void this.confirm(0!==this.img.naturalWidth,"naturalWidth"):(this.proxyImage=new Image,this.proxyImage.addEventListener("load",this),this.proxyImage.addEventListener("error",this),this.img.addEventListener("load",this),this.img.addEventListener("error",this),void(this.proxyImage.src=this.img.src))},r.prototype.getIsImageComplete=function(){return this.img.complete&&this.img.naturalWidth},r.prototype.confirm=function(e,t){this.isLoaded=e,this.emitEvent("progress",[this,this.img,t])},r.prototype.handleEvent=function(e){var t="on"+e.type;this[t]&&this[t](e)},r.prototype.onload=function(){this.confirm(!0,"onload"),this.unbindEvents()},r.prototype.onerror=function(){this.confirm(!1,"onerror"),this.unbindEvents()},r.prototype.unbindEvents=function(){this.proxyImage.removeEventListener("load",this),this.proxyImage.removeEventListener("error",this),this.img.removeEventListener("load",this),this.img.removeEventListener("error",this)},s.prototype=Object.create(r.prototype),s.prototype.check=function(){this.img.addEventListener("load",this),this.img.addEventListener("error",this),this.img.src=this.url;var e=this.getIsImageComplete();e&&(this.confirm(0!==this.img.naturalWidth,"naturalWidth"),this.unbindEvents())},s.prototype.unbindEvents=function(){this.img.removeEventListener("load",this),this.img.removeEventListener("error",this)},s.prototype.confirm=function(e,t){this.isLoaded=e,this.emitEvent("progress",[this,this.element,t])},o.makeJQueryPlugin=function(t){t=t||e.jQuery,t&&(h=t,h.fn.imagesLoaded=function(e,t){var i=new o(this,e,t);return i.jqDeferred.promise(h(this))})},o.makeJQueryPlugin(),o});
(function(b,c){var $=b.jQuery||b.Cowboy||(b.Cowboy={}),a;$.throttle=a=function(e,f,j,i){var h,d=0;if(typeof f!=="boolean"){i=j;j=f;f=c}function g(){var o=this,m=+new Date()-d,n=arguments;function l(){d=+new Date();j.apply(o,n)}function k(){h=c}if(i&&!h){l()}h&&clearTimeout(h);if(i===c&&m>e){l()}else{if(f!==true){h=setTimeout(i?k:l,i===c?e-m:e)}}}if($.guid){g.guid=j.guid=j.guid||$.guid++}return g};$.debounce=function(d,e,f){return f===c?a(d,e,false):a(d,f,e!==false)}})(this);
if(typeof Tablesaw==="undefined"){
Tablesaw={
i18n: {
modes: [ 'Stack', 'Swipe', 'Toggle' ],
columns: 'Col<span class=\"a11y-sm\">umn</span>s',
columnBtnText: 'Columns',
columnsDialogError: 'No eligible columns.',
sort: 'Sort'
},
mustard: 'querySelector' in document &&
(!window.blackberry||window.WebKitPoint) &&
!window.operamini
};}
if(!Tablesaw.config){
Tablesaw.config={};}
if(Tablesaw.mustard){
jQuery(document.documentElement).addClass('tablesaw-enhanced');
}
;(function($){
var pluginName="table",
classes={
toolbar: "tablesaw-bar"
},
events={
create: "tablesawcreate",
destroy: "tablesawdestroy",
refresh: "tablesawrefresh"
},
defaultMode="stack",
initSelector="table[data-tablesaw-mode],table[data-tablesaw-sortable]";
var Table=function(element){
if(!element){
throw new Error("Tablesaw requires an element.");
}
this.table=element;
this.$table=$(element);
this.mode=this.$table.attr("data-tablesaw-mode")||defaultMode;
this.init();
};
Table.prototype.init=function(){
if(!this.$table.attr("id") ){
this.$table.attr("id", pluginName + "-" + Math.round(Math.random() * 10000) );
}
this.createToolbar();
var colstart=this._initCells();
this.$table.trigger(events.create, [ this, colstart ]);
};
Table.prototype._initCells=function(){
var colstart,
thrs=this.table.querySelectorAll("thead tr"),
self=this;
$(thrs).each(function(){
var coltally=0;
$(this).children().each(function(){
var span=parseInt(this.getAttribute("colspan"), 10),
sel=":nth-child(" +(coltally + 1) + ")";
colstart=coltally + 1;
if(span){
for(var k=0; k < span - 1; k++){
coltally++;
sel +=", :nth-child(" +(coltally + 1) + ")";
}}
this.cells=self.$table.find("tr").not(thrs[0]).not(this).children().filter(sel);
coltally++;
});
});
return colstart;
};
Table.prototype.refresh=function(){
this._initCells();
this.$table.trigger(events.refresh);
};
Table.prototype.createToolbar=function(){
var $toolbar=this.$table.prev().filter('.' + classes.toolbar);
if(!$toolbar.length){
$toolbar=$('<div>')
.addClass(classes.toolbar)
.insertBefore(this.$table);
}
this.$toolbar=$toolbar;
if(this.mode){
this.$toolbar.addClass('mode-' + this.mode);
}};
Table.prototype.destroy=function(){
this.$table.prev().filter('.' + classes.toolbar).each(function(){
this.className=this.className.replace(/\bmode\-\w*\b/gi, '');
});
var tableId=this.$table.attr('id');
$(document).unbind("." + tableId);
$(window).unbind("." + tableId);
this.$table.trigger(events.destroy, [ this ]);
this.$table.removeAttr('data-tablesaw-mode');
this.$table.removeData(pluginName);
};
$.fn[ pluginName ]=function(){
return this.each(function(){
var $t=$(this);
if($t.data(pluginName) ){
return;
}
var table=new Table(this);
$t.data(pluginName, table);
});
};
$(document).on("enhance.tablesaw", function(e){
if(Tablesaw.mustard){
$(e.target).find(initSelector)[ pluginName ]();
}});
}(jQuery));
;(function(win, $, undefined){
var classes={
stackTable: 'tablesaw-stack',
cellLabels: 'tablesaw-cell-label',
cellContentLabels: 'tablesaw-cell-content'
};
var data={
obj: 'tablesaw-stack'
};
var attrs={
labelless: 'data-tablesaw-no-labels',
hideempty: 'data-tablesaw-hide-empty'
};
var Stack=function(element){
this.$table=$(element);
this.labelless=this.$table.is('[' + attrs.labelless + ']');
this.hideempty=this.$table.is('[' + attrs.hideempty + ']');
if(!this.labelless){
this.allHeaders=this.$table.find("th");
}
this.$table.data(data.obj, this);
};
Stack.prototype.init=function(colstart){
this.$table.addClass(classes.stackTable);
if(this.labelless){
return;
}
var reverseHeaders=$(this.allHeaders);
var hideempty=this.hideempty;
reverseHeaders.each(function(){
var $t=$(this),
$cells=$(this.cells).filter(function(){
return !$(this).parent().is("[" + attrs.labelless + "]")&&(!hideempty||!$(this).is(":empty") );
}),
hierarchyClass=$cells.not(this).filter("thead th").length&&" tablesaw-cell-label-top",
$sortableButton=$t.find(".tablesaw-sortable-btn"),
html=$sortableButton.length ? $sortableButton.html():$t.html();
if(html!==""){
if(hierarchyClass){
var iteration=parseInt($(this).attr("colspan"), 10),
filter="";
if(iteration){
filter="td:nth-child("+ iteration +"n + " +(colstart) +")";
}
$cells.filter(filter).prepend("<b class='" + classes.cellLabels + hierarchyClass + "'>" + html + "</b>");
}else{
$cells.wrapInner("<span class='" + classes.cellContentLabels + "'></span>");
$cells.prepend("<b class='" + classes.cellLabels + "'>" + html + "</b>");
}}
});
};
Stack.prototype.destroy=function(){
this.$table.removeClass(classes.stackTable);
this.$table.find('.' + classes.cellLabels).remove();
this.$table.find('.' + classes.cellContentLabels).each(function(){
$(this).replaceWith(this.childNodes);
});
};
$(document).on("tablesawcreate", function(e, Tablesaw, colstart){
if(Tablesaw.mode==='stack'){
var table=new Stack(Tablesaw.table);
table.init(colstart);
}});
$(document).on("tablesawdestroy", function(e, Tablesaw){
if(Tablesaw.mode==='stack'){
$(Tablesaw.table).data(data.obj).destroy();
}});
}(this, jQuery));
;(function($){
var pluginName="tablesawbtn",
methods={
_create: function(){
return $(this).each(function(){
$(this)
.trigger("beforecreate." + pluginName)
[ pluginName ]("_init")
.trigger("create." + pluginName);
});
},
_init: function(){
var oEl=$(this),
sel=this.getElementsByTagName("select")[ 0 ];
if(sel){
$(this)
.addClass("btn-select")
[ pluginName ]("_select", sel);
}
return oEl;
},
_select: function(sel){
var update=function(oEl, sel){
var opts=$(sel).find("option"),
label, el, children;
opts.each(function(){
var opt=this;
if(opt.selected){
label=document.createTextNode(opt.text);
}});
children=oEl.childNodes;
if(opts.length > 0){
for(var i=0, l=children.length; i < l; i++){
el=children[ i ];
if(el&&el.nodeType===3){
oEl.replaceChild(label, el);
}}
}};
update(this, sel);
$(this).bind("change refresh", function(){
update(this, sel);
});
}};
$.fn[ pluginName ]=function(arrg, a, b, c){
return this.each(function(){
if(arrg&&typeof(arrg)==="string"){
return $.fn[ pluginName ].prototype[ arrg ].call(this, a, b, c);
}
if($(this).data(pluginName + "active") ){
return $(this);
}
$(this).data(pluginName + "active", true);
$.fn[ pluginName ].prototype._create.call(this);
});
};
$.extend($.fn[ pluginName ].prototype, methods);
}(jQuery));
;(function(win, $, undefined){
var ColumnToggle=function(element){
this.$table=$(element);
this.classes={
columnToggleTable: 'tablesaw-columntoggle',
columnBtnContain: 'tablesaw-columntoggle-btnwrap tablesaw-advance',
columnBtn: 'tablesaw-columntoggle-btn tablesaw-nav-btn down',
popup: 'tablesaw-columntoggle-popup',
priorityPrefix: 'tablesaw-priority-',
toolbar: 'tablesaw-bar'
};
this.headers=this.$table.find('tr:first > th');
this.$table.data('tablesaw-coltoggle', this);
};
ColumnToggle.prototype.init=function(){
var tableId,
id,
$menuButton,
$popup,
$menu,
$btnContain,
self=this;
this.$table.addClass(this.classes.columnToggleTable);
tableId=this.$table.attr("id");
id=tableId + "-popup";
$btnContain=$("<div class='" + this.classes.columnBtnContain + "'></div>");
$menuButton=$("<a href='#" + id + "' class='btn btn-micro " + this.classes.columnBtn +"' data-popup-link>" +
"<span>" + Tablesaw.i18n.columnBtnText + "</span></a>");
$popup=$("<div class='dialog-table-coltoggle " + this.classes.popup + "' id='" + id + "'></div>");
$menu=$("<div class='btn-group'></div>");
var hasNonPersistentHeaders=false;
$(this.headers).not("td").each(function(){
var $this=$(this),
priority=$this.attr("data-tablesaw-priority"),
$cells=$this.add(this.cells);
if(priority&&priority!=="persist"){
$cells.addClass(self.classes.priorityPrefix + priority);
$("<label><input type='checkbox' checked>" + $this.text() + "</label>")
.appendTo($menu)
.children(0)
.data("cells", $cells);
hasNonPersistentHeaders=true;
}});
if(!hasNonPersistentHeaders){
$menu.append('<label>' + Tablesaw.i18n.columnsDialogError + '</label>');
}
$menu.appendTo($popup);
$menu.find('input[type="checkbox"]').on("change", function(e){
var checked=e.target.checked;
$(e.target).data("cells")
.toggleClass("tablesaw-cell-hidden", !checked)
.toggleClass("tablesaw-cell-visible", checked);
self.$table.trigger('tablesawcolumns');
});
$menuButton.appendTo($btnContain);
$btnContain.appendTo(this.$table.prev().filter('.' + this.classes.toolbar) );
var closeTimeout;
function openPopup(){
$btnContain.addClass('visible');
$menuButton.removeClass('down').addClass('up');
$(document).unbind('click.' + tableId, closePopup);
window.clearTimeout(closeTimeout);
closeTimeout=window.setTimeout(function(){
$(document).one('click.' + tableId, closePopup);
}, 15);
}
function closePopup(event){
if(event&&$(event.target).closest("." + self.classes.popup).length){
return;
}
$(document).unbind('click.' + tableId);
$menuButton.removeClass('up').addClass('down');
$btnContain.removeClass('visible');
}
$menuButton.on("click.tablesaw", function(event){
event.preventDefault();
if(!$btnContain.is(".visible") ){
openPopup();
}else{
closePopup();
}});
$popup.appendTo($btnContain);
this.$menu=$menu;
$(window).on("resize." + tableId, function(){
self.refreshToggle();
});
this.refreshToggle();
};
ColumnToggle.prototype.refreshToggle=function(){
this.$menu.find("input").each(function(){
var $this=$(this);
this.checked=$this.data("cells").eq(0).css("display")==="table-cell";
});
};
ColumnToggle.prototype.refreshPriority=function(){
var self=this;
$(this.headers).not("td").each(function(){
var $this=$(this),
priority=$this.attr("data-tablesaw-priority"),
$cells=$this.add(this.cells);
if(priority&&priority!=="persist"){
$cells.addClass(self.classes.priorityPrefix + priority);
}});
};
ColumnToggle.prototype.destroy=function(){
this.$table.removeClass(this.classes.columnToggleTable);
this.$table.find('th, td').each(function(){
var $cell=$(this);
$cell.removeClass('tablesaw-cell-hidden')
.removeClass('tablesaw-cell-visible');
this.className=this.className.replace(/\bui\-table\-priority\-\d\b/g, '');
});
};
$(document).on("tablesawcreate", function(e, Tablesaw){
if(Tablesaw.mode==='columntoggle'){
var table=new ColumnToggle(Tablesaw.table);
table.init();
}});
$(document).on("tablesawdestroy", function(e, Tablesaw){
if(Tablesaw.mode==='columntoggle'){
$(Tablesaw.table).data('tablesaw-coltoggle').destroy();
}});
}(this, jQuery));
;(function(win, $, undefined){
$.extend(Tablesaw.config, {
swipe: {
horizontalThreshold: 15,
verticalThreshold: 30
}});
function isIE8(){
var div=document.createElement('div'),
all=div.getElementsByTagName('i');
div.innerHTML='<!--[if lte IE 8]><i></i><![endif]-->';
return !!all.length;
}
function createSwipeTable($table){
var $btns=$("<div class='tablesaw-advance'></div>"),
$prevBtn=$("<a href='#' class='tablesaw-nav-btn btn btn-micro left' title='Previous Column'></a>").appendTo($btns),
$nextBtn=$("<a href='#' class='tablesaw-nav-btn btn btn-micro right' title='Next Column'></a>").appendTo($btns),
hideBtn='disabled',
persistWidths='tablesaw-fix-persist',
$headerCells=$table.find("thead th"),
$headerCellsNoPersist=$headerCells.not('[data-tablesaw-priority="persist"]'),
headerWidths=[],
$head=$(document.head||'head'),
tableId=$table.attr('id'),
supportsNthChild = !isIE8();
if(!$headerCells.length){
}
$table.css('width', 'auto');
$headerCells.each(function(){
headerWidths.push($(this).outerWidth());
});
$table.css('width', '');
$btns.appendTo($table.prev().filter('.tablesaw-bar') );
$table.addClass("tablesaw-swipe");
if(!tableId){
tableId='tableswipe-' + Math.round(Math.random() * 10000);
$table.attr('id', tableId);
}
function $getCells(headerCell){
return $(headerCell.cells).add(headerCell);
}
function showColumn(headerCell){
$getCells(headerCell).removeClass('tablesaw-cell-hidden');
}
function hideColumn(headerCell){
$getCells(headerCell).addClass('tablesaw-cell-hidden');
}
function persistColumn(headerCell){
$getCells(headerCell).addClass('tablesaw-cell-persist');
}
function isPersistent(headerCell){
return $(headerCell).is('[data-tablesaw-priority="persist"]');
}
function unmaintainWidths(){
$table.removeClass(persistWidths);
$('#' + tableId + '-persist').remove();
}
function maintainWidths(){
var prefix='#' + tableId + '.tablesaw-swipe ',
styles=[],
tableWidth=$table.width(),
hash=[],
newHash;
$headerCells.each(function(index){
var width;
if(isPersistent(this) ){
width=$(this).outerWidth();
if(width < tableWidth * 0.75){
hash.push(index + '-' + width);
styles.push(prefix + ' .tablesaw-cell-persist:nth-child(' +(index + 1) + '){ width: ' + width + 'px; }');
}}
});
newHash=hash.join('_');
$table.addClass(persistWidths);
var $style=$('#' + tableId + '-persist');
if(!$style.length||$style.data('hash')!==newHash){
$style.remove();
if(styles.length){
$('<style>' + styles.join("\n") + '</style>')
.attr('id', tableId + '-persist')
.data('hash', newHash)
.appendTo($head);
}}
}
function getNext(){
var next=[],
checkFound;
$headerCellsNoPersist.each(function(i){
var $t=$(this),
isHidden=$t.css("display")==="none"||$t.is(".tablesaw-cell-hidden");
if(!isHidden&&!checkFound){
checkFound=true;
next[ 0 ]=i;
}else if(isHidden&&checkFound){
next[ 1 ]=i;
return false;
}});
return next;
}
function getPrev(){
var next=getNext();
return [ next[ 1 ] - 1 , next[ 0 ] - 1 ];
}
function nextpair(fwd){
return fwd ? getNext():getPrev();
}
function canAdvance(pair){
return pair[ 1 ] > -1&&pair[ 1 ] < $headerCellsNoPersist.length;
}
function matchesMedia(){
var matchMedia=$table.attr("data-tablesaw-swipe-media");
return !matchMedia||("matchMedia" in win)&&win.matchMedia(matchMedia).matches;
}
function fakeBreakpoints(){
if(!matchesMedia()){
return;
}
var extraPaddingPixels=20,
containerWidth=$table.parent().width(),
persist=[],
sum=0,
sums=[],
visibleNonPersistantCount=$headerCells.length;
$headerCells.each(function(index){
var $t=$(this),
isPersist=$t.is('[data-tablesaw-priority="persist"]');
persist.push(isPersist);
sum +=headerWidths[ index ] +(isPersist ? 0:extraPaddingPixels);
sums.push(sum);
if(isPersist||sum > containerWidth){
visibleNonPersistantCount--;
}});
var needsNonPersistentColumn=visibleNonPersistantCount===0;
$headerCells.each(function(index){
if(persist[ index ]){
persistColumn(this);
return;
}
if(sums[ index ] <=containerWidth||needsNonPersistentColumn){
needsNonPersistentColumn=false;
showColumn(this);
}else{
hideColumn(this);
}});
if(supportsNthChild){
unmaintainWidths();
}
$table.trigger('tablesawcolumns');
}
function advance(fwd){
var pair=nextpair(fwd);
if(canAdvance(pair) ){
if(isNaN(pair[ 0 ]) ){
if(fwd){
pair[0]=0;
}else{
pair[0]=$headerCellsNoPersist.length - 1;
}}
if(supportsNthChild){
maintainWidths();
}
hideColumn($headerCellsNoPersist.get(pair[ 0 ]) );
showColumn($headerCellsNoPersist.get(pair[ 1 ]) );
$table.trigger('tablesawcolumns');
}}
$prevBtn.add($nextBtn).click(function(e){
advance(!!$(e.target).closest($nextBtn).length);
e.preventDefault();
});
function getCoord(event, key){
return(event.touches||event.originalEvent.touches)[ 0 ][ key ];
}
$table
.bind("touchstart.swipetoggle", function(e){
var originX=getCoord(e, 'pageX'),
originY=getCoord(e, 'pageY'),
x,
y;
$(win).off("resize", fakeBreakpoints);
$(this)
.bind("touchmove", function(e){
x=getCoord(e, 'pageX');
y=getCoord(e, 'pageY');
var cfg=Tablesaw.config.swipe;
if(Math.abs(x - originX) > cfg.horizontalThreshold&&Math.abs(y - originY) < cfg.verticalThreshold){
e.preventDefault();
}})
.bind("touchend.swipetoggle", function(){
var cfg=Tablesaw.config.swipe;
if(Math.abs(y - originY) < cfg.verticalThreshold){
if(x - originX < -1 * cfg.horizontalThreshold){
advance(true);
}
if(x - originX > cfg.horizontalThreshold){
advance(false);
}}
window.setTimeout(function(){
$(win).on("resize", fakeBreakpoints);
}, 300);
$(this).unbind("touchmove touchend");
});
})
.bind("tablesawcolumns.swipetoggle", function(){
$prevBtn[ canAdvance(getPrev()) ? "removeClass":"addClass" ](hideBtn);
$nextBtn[ canAdvance(getNext()) ? "removeClass":"addClass" ](hideBtn);
})
.bind("tablesawnext.swipetoggle", function(){
advance(true);
})
.bind("tablesawprev.swipetoggle", function(){
advance(false);
})
.bind("tablesawdestroy.swipetoggle", function(){
var $t=$(this);
$t.removeClass('tablesaw-swipe');
$t.prev().filter('.tablesaw-bar').find('.tablesaw-advance').remove();
$(win).off("resize", fakeBreakpoints);
$t.unbind(".swipetoggle");
});
fakeBreakpoints();
$(win).on("resize", fakeBreakpoints);
}
$(document).on("tablesawcreate", function(e, Tablesaw){
if(Tablesaw.mode==='swipe'){
createSwipeTable(Tablesaw.$table);
}});
}(this, jQuery));
;(function($){
function getSortValue(cell){
return $.map(cell.childNodes, function(el){
var $el=$(el);
if($el.is('input, select') ){
return $el.val();
}else if($el.hasClass('tablesaw-cell-label') ){
return;
}
return $.trim($el.text());
}).join('');
}
var pluginName="tablesaw-sortable",
initSelector="table[data-" + pluginName + "]",
sortableSwitchSelector="[data-" + pluginName + "-switch]",
attrs={
defaultCol: "data-tablesaw-sortable-default-col"
},
classes={
head: pluginName + "-head",
ascend: pluginName + "-ascending",
descend: pluginName + "-descending",
switcher: pluginName + "-switch",
tableToolbar: 'tablesaw-toolbar',
sortButton: pluginName + "-btn"
},
methods={
_create: function(o){
return $(this).each(function(){
var init=$(this).data("init" + pluginName);
if(init){
return false;
}
$(this)
.data("init"+ pluginName, true)
.trigger("beforecreate." + pluginName)
[ pluginName ]("_init" , o)
.trigger("create." + pluginName);
});
},
_init: function(){
var el=$(this),
heads,
$switcher;
var addClassToTable=function(){
el.addClass(pluginName);
},
addClassToHeads=function(h){
$.each(h , function(i , v){
$(v).addClass(classes.head);
});
},
makeHeadsActionable=function(h , fn){
$.each(h , function(i , v){
var b=$("<button class='" + classes.sortButton + "'/>");
b.bind("click" , { col: v } , fn);
$(v).wrapInner(b);
});
},
clearOthers=function(sibs){
$.each(sibs , function(i , v){
var col=$(v);
col.removeAttr(attrs.defaultCol);
col.removeClass(classes.ascend);
col.removeClass(classes.descend);
});
},
headsOnAction=function(e){
if($(e.target).is('a[href]') ){
return;
}
e.stopPropagation();
var head=$(this).parent(),
v=e.data.col,
newSortValue=heads.index(head);
clearOthers(head.siblings());
if(head.hasClass(classes.descend) ){
el[ pluginName ]("sortBy" , v , true);
newSortValue +='_asc';
}else{
el[ pluginName ]("sortBy" , v);
newSortValue +='_desc';
}
if($switcher){
$switcher.find('select').val(newSortValue).trigger('refresh');
}
e.preventDefault();
},
handleDefault=function(heads){
$.each(heads , function(idx , el){
var $el=$(el);
if($el.is("[" + attrs.defaultCol + "]") ){
if(!$el.hasClass(classes.descend) ){
$el.addClass(classes.ascend);
}}
});
},
addSwitcher=function(heads){
$switcher=$('<div>').addClass(classes.switcher).addClass(classes.tableToolbar).html(function(){
var html=[ '<label>' + Tablesaw.i18n.sort + ':' ];
html.push('<span class="btn btn-small">&#160;<select>');
heads.each(function(j){
var $t=$(this),
isDefaultCol=$t.is("[" + attrs.defaultCol + "]"),
isDescending=$t.hasClass(classes.descend),
isNumeric=false;
$(this.cells).slice(0, 3).each(function(){
if(!isNaN(parseInt(getSortValue(this), 10) )){
isNumeric=true;
return false;
}});
html.push('<option' +(isDefaultCol&&!isDescending ? ' selected':'') + ' value="' + j + '_asc">' + $t.text() + ' ' +(isNumeric ? '&#x2191;':'(A-Z)') + '</option>');
html.push('<option' +(isDefaultCol&&isDescending ? ' selected':'') + ' value="' + j + '_desc">' + $t.text() + ' ' +(isNumeric ? '&#x2193;':'(Z-A)') + '</option>');
});
html.push('</select></span></label>');
return html.join('');
});
var $toolbar=el.prev().filter('.tablesaw-bar'),
$firstChild=$toolbar.children().eq(0);
if($firstChild.length){
$switcher.insertBefore($firstChild);
}else{
$switcher.appendTo($toolbar);
}
$switcher.find('.btn').tablesawbtn();
$switcher.find('select').on('change', function(){
var val=$(this).val().split('_'),
head=heads.eq(val[ 0 ]);
clearOthers(head.siblings());
el[ pluginName ]('sortBy', head.get(0), val[ 1 ]==='asc');
});
};
addClassToTable();
heads=el.find("thead th[data-" + pluginName + "-col]");
addClassToHeads(heads);
makeHeadsActionable(heads , headsOnAction);
handleDefault(heads);
if(el.is(sortableSwitchSelector) ){
addSwitcher(heads, el.find('tbody tr:nth-child(-n+3)'));
}},
getColumnNumber: function(col){
return $(col).prevAll().length;
},
getTableRows: function(){
return $(this).find("tbody tr");
},
sortRows: function(rows , colNum , ascending, col){
var cells, fn, sorted;
var getCells=function(rows){
var cells=[];
$.each(rows , function(i , r){
cells.push({
cell: getSortValue($(r).children().get(colNum) ),
rowNum: i
});
});
return cells;
},
getSortFxn=function(ascending, forceNumeric){
var fn,
regex=/[^\-\+\d\.]/g;
if(ascending){
fn=function(a , b){
if(forceNumeric||!isNaN(parseFloat(a.cell) )){
return parseFloat(a.cell.replace(regex, '') ) - parseFloat(b.cell.replace(regex, '') );
}else{
return a.cell.toLowerCase() > b.cell.toLowerCase() ? 1:-1;
}};}else{
fn=function(a , b){
if(forceNumeric||!isNaN(parseFloat(a.cell) )){
return parseFloat(b.cell.replace(regex, '') ) - parseFloat(a.cell.replace(regex, '') );
}else{
return a.cell.toLowerCase() < b.cell.toLowerCase() ? 1:-1;
}};}
return fn;
},
applyToRows=function(sorted , rows){
var newRows=[], i, l, cur;
for(i=0, l=sorted.length ; i < l ; i++){
cur=sorted[ i ].rowNum;
newRows.push(rows[cur]);
}
return newRows;
};
cells=getCells(rows);
var customFn=$(col).data('tablesaw-sort');
fn=(customFn&&typeof customFn==="function" ? customFn(ascending):false) ||
getSortFxn(ascending, $(col).is('[data-sortable-numeric]') );
sorted=cells.sort(fn);
rows=applyToRows(sorted , rows);
return rows;
},
replaceTableRows: function(rows){
var el=$(this),
body=el.find("tbody");
body.html(rows);
},
makeColDefault: function(col , a){
var c=$(col);
c.attr(attrs.defaultCol , "true");
if(a){
c.removeClass(classes.descend);
c.addClass(classes.ascend);
}else{
c.removeClass(classes.ascend);
c.addClass(classes.descend);
}},
sortBy: function(col , ascending){
var el=$(this), colNum, rows;
colNum=el[ pluginName ]("getColumnNumber" , col);
rows=el[ pluginName ]("getTableRows");
rows=el[ pluginName ]("sortRows" , rows , colNum , ascending, col);
el[ pluginName ]("replaceTableRows" , rows);
el[ pluginName ]("makeColDefault" , col , ascending);
}};
$.fn[ pluginName ]=function(arrg){
var args=Array.prototype.slice.call(arguments , 1),
returnVal;
if(arrg&&typeof(arrg)==="string"){
returnVal=$.fn[ pluginName ].prototype[ arrg ].apply(this[0], args);
return (typeof returnVal!=="undefined")? returnVal:$(this);
}
if(!$(this).data(pluginName + "data") ){
$(this).data(pluginName + "active", true);
$.fn[ pluginName ].prototype._create.call(this , arrg);
}
return $(this);
};
$.extend($.fn[ pluginName ].prototype, methods);
$(document).on("tablesawcreate", function(e, Tablesaw){
if(Tablesaw.$table.is(initSelector) ){
Tablesaw.$table[ pluginName ]();
}});
}(jQuery));
;(function(win, $, undefined){
var MM={
attr: {
init: 'data-tablesaw-minimap'
}};
function createMiniMap($table){
var $btns=$('<div class="tablesaw-advance minimap">'),
$dotNav=$('<ul class="tablesaw-advance-dots">').appendTo($btns),
hideDot='tablesaw-advance-dots-hide',
$headerCells=$table.find('thead th');
$headerCells.each(function(){
$dotNav.append('<li><i></i></li>');
});
$btns.appendTo($table.prev().filter('.tablesaw-bar') );
function showMinimap($table){
var mq=$table.attr(MM.attr.init);
return !mq||win.matchMedia&&win.matchMedia(mq).matches;
}
function showHideNav(){
if(!showMinimap($table) ){
$btns.hide();
return;
}
$btns.show();
var dots=$dotNav.find("li").removeClass(hideDot);
$table.find("thead th").each(function(i){
if($(this).css("display")==="none"){
dots.eq(i).addClass(hideDot);
}});
}
showHideNav();
$(win).on("resize", showHideNav);
$table
.bind("tablesawcolumns.minimap", function(){
showHideNav();
})
.bind("tablesawdestroy.minimap", function(){
var $t=$(this);
$t.prev().filter('.tablesaw-bar').find('.tablesaw-advance').remove();
$(win).off("resize", showHideNav);
$t.unbind(".minimap");
});
}
$(document).on("tablesawcreate", function(e, Tablesaw){
if(( Tablesaw.mode==='swipe'||Tablesaw.mode==='columntoggle')&&Tablesaw.$table.is('[ ' + MM.attr.init + ']') ){
createMiniMap(Tablesaw.$table);
}});
}(this, jQuery));
;(function(win, $){
var S={
selectors: {
init: 'table[data-tablesaw-mode-switch]'
},
attributes: {
excludeMode: 'data-tablesaw-mode-exclude'
},
classes: {
main: 'tablesaw-modeswitch',
toolbar: 'tablesaw-toolbar'
},
modes: [ 'stack', 'swipe', 'columntoggle' ],
init: function(table){
var $table=$(table),
ignoreMode=$table.attr(S.attributes.excludeMode),
$toolbar=$table.prev().filter('.tablesaw-bar'),
modeVal='',
$switcher=$('<div>').addClass(S.classes.main + ' ' + S.classes.toolbar).html(function(){
var html=[ '<label>' + Tablesaw.i18n.columns + ':' ],
dataMode=$table.attr('data-tablesaw-mode'),
isSelected;
html.push('<span class="btn btn-small">&#160;<select>');
for(var j=0, k=S.modes.length; j<k; j++){
if(ignoreMode&&ignoreMode.toLowerCase()===S.modes[ j ]){
continue;
}
isSelected=dataMode===S.modes[ j ];
if(isSelected){
modeVal=S.modes[ j ];
}
html.push('<option' +
(isSelected ? ' selected':'') +
' value="' + S.modes[ j ] + '">' + Tablesaw.i18n.modes[ j ] + '</option>');
}
html.push('</select></span></label>');
return html.join('');
});
var $otherToolbarItems=$toolbar.find('.tablesaw-advance').eq(0);
if($otherToolbarItems.length){
$switcher.insertBefore($otherToolbarItems);
}else{
$switcher.appendTo($toolbar);
}
$switcher.find('.btn').tablesawbtn();
$switcher.find('select').bind('change', S.onModeChange);
},
onModeChange: function(){
var $t=$(this),
$switcher=$t.closest('.' + S.classes.main),
$table=$t.closest('.tablesaw-bar').nextUntil($table).eq(0),
val=$t.val();
$switcher.remove();
$table.data('table').destroy();
$table.attr('data-tablesaw-mode', val);
$table.table();
}};
$(win.document).on("tablesawcreate", function(e, Tablesaw){
if(Tablesaw.$table.is(S.selectors.init) ){
S.init(Tablesaw.table);
}});
})(this, jQuery);