function bool(t){return 1===t||"1"===t||t===!0||"true"===t}function e(t){return String(t).replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(//g,">")}function isArray(t){return"[object Array]"===Object.prototype.toString.call(t)}function isObject(t){return"[object Object]"===Object.prototype.toString.call(t)}function regexEscape(t){return t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function rssiPerc(t){var e=parseInt(t);return e>-50?100:-100>e?0:Math.round(2*(e+100))}!function(){"use strict";function t(){var t;for(p=!0,t=0;t=0;n-=1)t(e[n])}function i(t){return t.replace(/-\w/g,function(t){return t.charAt(1).toUpperCase()})}function r(t,e){return t.currentStyle?t.currentStyle[i(e)]:x.getComputedStyle?x.getComputedStyle(t,null).getPropertyValue(e):null}function s(t,e){return encodeURIComponent(t).replace(/%20/g,"+")+"="+encodeURIComponent(e).replace(/%20/g,"+")}function a(t,e,n){try{t.style[i(e)]=n}catch(r){}}function o(t){t.style.display="","none"===r(t,"display")&&(t.style.display="block")}function c(t){var e,i,r,a="";if(t.constructor===Object){for(e in t)if(t.hasOwnProperty(e))if(t[e].constructor===Array)for(i=0;i0&&(a+="&"+s(e.name,e.value));break;case"select-multiple":for(r=0;r0?a.substring(1):""}function u(t,e,i){var r,s,a,o=!1;return t&&(r=t.split(/\s+/),n(function(t){for(a=0;a0?w[0].className.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"").replace(/\s+/," "):void 0},e.setClass=function(t){return(t||""===t)&&n(function(e){e.className=t},w),e},e.addClass=function(t){return t&&n(function(e){e.className+=" "+t},w),e},e.removeClass=function(t){return u(t,"remove",w),e},e.toggleClass=function(t){return u(t,"toggle",w),e},e.hasClass=function(t){return u(t,"has",w)},e.html=function(t){return t||""===t?(n(function(e){e.innerHTML=t},w),e):w[0]?w[0].innerHTML:void 0},e.htmlBefore=function(t){return l(t,"before",w),e},e.htmlAfter=function(t){return l(t,"after",w),e},e.htmlAppend=function(t){return l(t,"append",w),e},e.htmlPrepend=function(t){return l(t,"prepend",w),e},e.attr=function(t,i){if(t){if(t=t.toLowerCase(),"undefined"!=typeof i)return n(function(e){"style"===t?e.style.cssText=i:"class"===t?e.className=i:e.setAttribute(t,i)},w),e;if(w[0])if("style"===t){if(w[0].style.cssText)return w[0].style.cssText}else if("class"===t){if(w[0].className)return w[0].className}else if(w[0].getAttribute(t))return w[0].getAttribute(t)}},e.data=function(t,n){return t?e.attr("data-"+t,n):void 0},e.val=function(t){var i,r,s;if(t||""===t)return n(function(e){switch(e.nodeName){case"SELECT":for("string"!=typeof t&&"number"!=typeof t||(t=[t]),r=0;r1?i:i[0];case"INPUT":case"TEXTAREA":case"BUTTON":return w[0].value}},e.checked=function(t){return"boolean"==typeof t?(n(function(e){"INPUT"!==e.nodeName||"checkbox"!==e.type&&"radio"!==e.type||(e.checked=t)},w),e):!w[0]||"INPUT"!==w[0].nodeName||"checkbox"!==w[0].type&&"radio"!==w[0].type?void 0:!!w[0].checked},e.on=function(i,r){return t!==x&&t!==v||(w=[t]),n(function(t){v.addEventListener?t.addEventListener(i,r,!1):v.attachEvent&&(t[i+r]=function(){return r.apply(t,arguments)},t.attachEvent("on"+i,t[i+r]))},w),e},e.off=function(i,r){return t!==x&&t!==v||(w=[t]),n(function(t){v.addEventListener?t.removeEventListener(i,r,!1):v.attachEvent&&(t.detachEvent("on"+i,t[i+r]),t[i+r]=null)},w),e},e.ajax=function(t,n,i,r,s){var a,o,u=c(w),l=n?n.toUpperCase():"GET",h=new RegExp("http[s]?://(.*?)/","gi"),d=h.exec(t),f="_ts="+ +new Date,p=v.getElementsByTagName("head")[0],m="chibi"+ +new Date+(g+=1);return!u||"GET"!==l&&"DELETE"!==l||(t+=-1===t.indexOf("?")?"?"+u:"&"+u,u=null),"GET"===l&&!s&&d&&x.location.host!==d[1]?(r&&(t+=-1===t.indexOf("?")?"?"+f:"&"+f),t=t.replace("=%3F","=?"),i&&-1!==t.indexOf("=?")&&(t=t.replace("=?","="+m),x[m]=function(t){try{i(t,200)}catch(e){}x[m]=void 0}),o=document.createElement("script"),o.async=!0,o.src=t,o.onload=function(){p.removeChild(o)},p.appendChild(o)):(x.XMLHttpRequest?a=new XMLHttpRequest:x.ActiveXObject&&(a=new ActiveXObject("Microsoft.XMLHTTP")),a&&(r&&(t+=-1===t.indexOf("?")?"?"+f:"&"+f),a.open(l,t,!0),a.onreadystatechange=function(){4===a.readyState&&i&&i(a.responseText,a.status)},a.setRequestHeader("X-Requested-With","XMLHttpRequest"),"POST"!==l&&"PUT"!==l||a.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),a.send(u))),e},e.get=function(t,n,i,r){return e.ajax(t,"get",n,i,r)},e.post=function(t,n,i){return e.ajax(t,"post",n,i)},e}var d=[],f=[],p=!1,m=!1,g=0,v=document,x=window;v.addEventListener?(v.addEventListener("DOMContentLoaded",t,!1),x.addEventListener("load",e,!1)):v.attachEvent?(v.attachEvent("onreadystatechange",t),x.attachEvent("onload",e)):x.onload=e,x.$=h}(),function(t,e){t.Chartist=e()}(this,function(){var t={version:"0.9.7"};return function(t,e,n){"use strict";n.namespaces={svg:"http://www.w3.org/2000/svg",xmlns:"http://www.w3.org/2000/xmlns/",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",ct:"http://gionkunz.github.com/chartist-js/ct"},n.noop=function(t){return t},n.alphaNumerate=function(t){return String.fromCharCode(97+t%26)},n.extend=function(t){t=t||{};var e=Array.prototype.slice.call(arguments,1);return e.forEach(function(e){for(var i in e)"object"!=typeof e[i]||null===e[i]||e[i]instanceof Array?t[i]=e[i]:t[i]=n.extend({},t[i],e[i])}),t},n.replaceAll=function(t,e,n){return t.replace(new RegExp(e,"g"),n)},n.ensureUnit=function(t,e){return"number"==typeof t&&(t+=e),t},n.quantity=function(t){if("string"==typeof t){var e=/^(\d+)\s*(.*)$/g.exec(t);return{value:+e[1],unit:e[2]||void 0}}return{value:t}},n.querySelector=function(t){return t instanceof Node?t:e.querySelector(t)},n.times=function(t){return Array.apply(null,new Array(t))},n.sum=function(t,e){return t+(e?e:0)},n.mapMultiply=function(t){return function(e){return e*t}},n.mapAdd=function(t){return function(e){return e+t}},n.serialMap=function(t,e){var i=[],r=Math.max.apply(null,t.map(function(t){return t.length}));return n.times(r).forEach(function(n,r){var s=t.map(function(t){return t[r]});i[r]=e.apply(null,s)}),i},n.roundWithPrecision=function(t,e){var i=Math.pow(10,e||n.precision);return Math.round(t*i)/i},n.precision=8,n.escapingMap={"&":"&","<":"<",">":">",'"':""","'":"'"},n.serialize=function(t){return null===t||void 0===t?t:("number"==typeof t?t=""+t:"object"==typeof t&&(t=JSON.stringify({data:t})),Object.keys(n.escapingMap).reduce(function(t,e){return n.replaceAll(t,e,n.escapingMap[e])},t))},n.deserialize=function(t){if("string"!=typeof t)return t;t=Object.keys(n.escapingMap).reduce(function(t,e){return n.replaceAll(t,n.escapingMap[e],e)},t);try{t=JSON.parse(t),t=void 0!==t.data?t.data:t}catch(e){}return t},n.createSvg=function(t,e,i,r){var s;return e=e||"100%",i=i||"100%",Array.prototype.slice.call(t.querySelectorAll("svg")).filter(function(t){return t.getAttributeNS(n.namespaces.xmlns,"ct")}).forEach(function(e){t.removeChild(e)}),s=new n.Svg("svg").attr({width:e,height:i}).addClass(r).attr({style:"width: "+e+"; height: "+i+";"}),t.appendChild(s._node),s},n.normalizeData=function(t){if(t=t||{series:[],labels:[]},t.series=t.series||[],t.labels=t.labels||[],t.series.length>0&&0===t.labels.length){var e,i=n.getDataArray(t);e=i.every(function(t){return t instanceof Array})?Math.max.apply(null,i.map(function(t){return t.length})):i.length,t.labels=n.times(e).map(function(){return""})}return t},n.reverseData=function(t){t.labels.reverse(),t.series.reverse();for(var e=0;es.high&&(s.high=n),o&&n0?s.low=0:(s.high=1,s.low=0)),s},n.isNum=function(t){return!isNaN(t)&&isFinite(t)},n.isFalseyButZero=function(t){return!t&&0!==t},n.getNumberOrUndefined=function(t){return isNaN(+t)?void 0:+t},n.getMultiValue=function(t,e){return n.isNum(t)?+t:t?t[e||"y"]||0:0},n.rho=function(t){function e(t,n){return t%n===0?n:e(n,t%n)}function n(t){return t*t+1}if(1===t)return t;var i,r=2,s=2;if(t%2===0)return 2;do r=n(r)%t,s=n(n(s))%t,i=e(Math.abs(r-s),t);while(1===i);return i},n.getBounds=function(t,e,i,r){var s,a,o,c=0,u={high:e.high,low:e.low};u.valueRange=u.high-u.low,u.oom=n.orderOfMagnitude(u.valueRange),u.step=Math.pow(10,u.oom),u.min=Math.floor(u.low/u.step)*u.step,u.max=Math.ceil(u.high/u.step)*u.step,u.range=u.max-u.min,u.numberOfSteps=Math.round(u.range/u.step);var l=n.projectLength(t,u.step,u),h=i>l,d=r?n.rho(u.range):0;if(r&&n.projectLength(t,1,u)>=i)u.step=1;else if(r&&d=i)u.step=d;else for(;;){if(h&&n.projectLength(t,u.step,u)<=i)u.step*=2;else{if(h||!(n.projectLength(t,u.step/2,u)>=i))break;if(u.step/=2,r&&u.step%1!==0){u.step*=2;break}}if(c++>1e3)throw new Error("Exceeded maximum number of iterations while optimizing scale step!")}for(a=u.min,o=u.max;a+u.step<=u.low;)a+=u.step;for(;o-u.step>=u.high;)o-=u.step;for(u.min=a,u.max=o,u.range=u.max-u.min,u.values=[],s=u.min;s<=u.max;s+=u.step)u.values.push(n.roundWithPrecision(s));return u},n.polarToCartesian=function(t,e,n,i){var r=(i-90)*Math.PI/180;return{x:t+n*Math.cos(r),y:e+n*Math.sin(r)}},n.createChartRect=function(t,e,i){var r=!(!e.axisX&&!e.axisY),s=r?e.axisY.offset:0,a=r?e.axisX.offset:0,o=t.width()||n.quantity(e.width).value||0,c=t.height()||n.quantity(e.height).value||0,u=n.normalizePadding(e.chartPadding,i);o=Math.max(o,s+u.left+u.right),c=Math.max(c,a+u.top+u.bottom);var l={padding:u,width:function(){return this.x2-this.x1},height:function(){return this.y1-this.y2}};return r?("start"===e.axisX.position?(l.y2=u.top+a,l.y1=Math.max(c-u.bottom,l.y2+1)):(l.y2=u.top,l.y1=Math.max(c-u.bottom-a,l.y2+1)),"start"===e.axisY.position?(l.x1=u.left+s,l.x2=Math.max(o-u.right,l.x1+1)):(l.x1=u.left,l.x2=Math.max(o-u.right-s,l.x1+1))):(l.x1=u.left,l.x2=Math.max(o-u.right,l.x1+1),l.y2=u.top,l.y1=Math.max(c-u.bottom,l.y2+1)),l},n.createGrid=function(t,e,i,r,s,a,o,c){var u={};u[i.units.pos+"1"]=Math.round(t)+.5,u[i.units.pos+"2"]=Math.round(t)+.5,u[i.counterUnits.pos+"1"]=r,u[i.counterUnits.pos+"2"]=r+s;var l=a.elem("line",u,o.join(" "));c.emit("draw",n.extend({type:"grid",axis:i,index:e,group:a,element:l},u))},n.createLabel=function(t,e,i,r,s,a,o,c,u,l,h){var d,f={};f[s.units.pos]=t+o[s.units.pos],f[s.counterUnits.pos]=o[s.counterUnits.pos],f[s.units.len]=e,f[s.counterUnits.len]=a-10;var p=r[i];if(p=Math.round(100*+p)/100,l){var m=''+p+"";d=c.foreignObject(m,n.extend({style:"overflow: visible;"},f))}else d=c.elem("text",f,u.join(" ")).text(p);h.emit("draw",n.extend({type:"label",axis:s,index:i,group:c,element:d,text:p},f))},n.getSeriesOption=function(t,e,n){if(t.name&&e.series&&e.series[t.name]){var i=e.series[t.name];return i.hasOwnProperty(n)?i[n]:e[n]}return e[n]},n.optionsProvider=function(e,i,r){function s(e){var s=o;if(o=n.extend({},u),i)for(c=0;c1){var c=[];return o.forEach(function(t){c.push(a(t.pathCoordinates,t.valueData))}),n.Svg.Path.join(c)}if(t=o[0].pathCoordinates,i=o[0].valueData,t.length<=4)return n.Interpolation.none()(t,i);for(var u,l=(new n.Svg.Path).move(t[0],t[1],!1,i[0]),h=0,d=t.length;d-2*!u>h;h+=2){var f=[{x:+t[h-2],y:+t[h-1]},{x:+t[h],y:+t[h+1]},{x:+t[h+2],y:+t[h+3]},{x:+t[h+4],y:+t[h+5]}];u?h?d-4===h?f[3]={x:+t[0],y:+t[1]}:d-2===h&&(f[2]={x:+t[0],y:+t[1]},f[3]={x:+t[2],y:+t[3]}):f[0]={x:+t[d-2],y:+t[d-1]}:d-4===h?f[3]=f[2]:h||(f[0]={x:+t[h],y:+t[h+1]}),l.curve(r*(-f[0].x+6*f[1].x+f[2].x)/6+s*f[2].x,r*(-f[0].y+6*f[1].y+f[2].y)/6+s*f[2].y,r*(f[1].x+6*f[2].x-f[3].x)/6+s*f[2].x,r*(f[1].y+6*f[2].y-f[3].y)/6+s*f[2].y,f[2].x,f[2].y,!1,i[(h+2)/2])}return l}return n.Interpolation.none()([])}},n.Interpolation.step=function(t){var e={postpone:!0,fillHoles:!1};return t=n.extend({},e,t),function(e,i){for(var r,s,a,o=new n.Svg.Path,c=0;c1}).map(function(t){var e=t.pathElements[0],n=t.pathElements[t.pathElements.length-1];return t.clone(!0).position(0).remove(1).move(e.x,v).line(e.x,e.y).position(t.pathElements.length+1).line(n.x,v)}).forEach(function(n){var o=c.elem("path",{d:n.stringify()},t.classNames.area,!0);this.eventEmitter.emit("draw",{type:"area",values:e.normalized[a],path:n.clone(),series:s,seriesIndex:a,axisX:i,axisY:r,chartRect:u,index:a,group:c,element:o})}.bind(this))}}.bind(this)),this.eventEmitter.emit("created",{bounds:r.bounds,chartRect:u,axisX:i,axisY:r,svg:this.svg,options:t})}function r(t,e,i,r){n.Line["super"].constructor.call(this,t,e,s,n.extend({},s,i),r)}var s={axisX:{offset:30,position:"end",labelOffset:{x:0,y:0},showLabel:!0,showGrid:!0,labelInterpolationFnc:n.noop,type:void 0},axisY:{offset:40,position:"start",labelOffset:{x:0,y:0},showLabel:!0,showGrid:!0,labelInterpolationFnc:n.noop,type:void 0,scaleMinSpace:20,onlyInteger:!1},width:void 0,height:void 0,showLine:!0,showPoint:!0,showArea:!1,areaBase:0,lineSmooth:!0,low:void 0,high:void 0,chartPadding:{top:15,right:15,bottom:5,left:10},fullWidth:!1,reverseData:!1,classNames:{chart:"ct-chart-line",label:"ct-label",labelGroup:"ct-labels",series:"ct-series",line:"ct-line",point:"ct-point",area:"ct-area",grid:"ct-grid",gridGroup:"ct-grids",vertical:"ct-vertical",horizontal:"ct-horizontal",start:"ct-start",end:"ct-end"}};n.Line=n.Base.extend({constructor:r,createChart:i})}(window,document,t),function(t,e,n){"use strict";function i(t){this.data=n.normalizeData(this.data);var e,i={raw:this.data,normalized:t.distributeSeries?n.getDataArray(this.data,t.reverseData,t.horizontalBars?"x":"y").map(function(t){return[t]}):n.getDataArray(this.data,t.reverseData,t.horizontalBars?"x":"y")};this.svg=n.createSvg(this.container,t.width,t.height,t.classNames.chart+(t.horizontalBars?" "+t.classNames.horizontalBars:""));var r=this.svg.elem("g").addClass(t.classNames.gridGroup),a=this.svg.elem("g"),o=this.svg.elem("g").addClass(t.classNames.labelGroup);if(t.stackBars&&0!==i.normalized.length){var c=n.serialMap(i.normalized,function(){return Array.prototype.slice.call(arguments).map(function(t){return t}).reduce(function(t,e){return{x:t.x+(e&&e.x)||0,y:t.y+(e&&e.y)||0}},{x:0,y:0})});e=n.getHighLow([c],n.extend({},t,{referenceValue:0}),t.horizontalBars?"x":"y")}else e=n.getHighLow(i.normalized,n.extend({},t,{referenceValue:0}),t.horizontalBars?"x":"y");e.high=+t.high||(0===t.high?0:e.high),e.low=+t.low||(0===t.low?0:e.low);var u,l,h,d,f,p=n.createChartRect(this.svg,t,s.padding);l=t.distributeSeries&&t.stackBars?i.raw.labels.slice(0,1):i.raw.labels,t.horizontalBars?(u=d=void 0===t.axisX.type?new n.AutoScaleAxis(n.Axis.units.x,i,p,n.extend({},t.axisX,{highLow:e,referenceValue:0})):t.axisX.type.call(n,n.Axis.units.x,i,p,n.extend({},t.axisX,{highLow:e,referenceValue:0})),h=f=void 0===t.axisY.type?new n.StepAxis(n.Axis.units.y,i,p,{ticks:l}):t.axisY.type.call(n,n.Axis.units.y,i,p,t.axisY)):(h=d=void 0===t.axisX.type?new n.StepAxis(n.Axis.units.x,i,p,{ticks:l}):t.axisX.type.call(n,n.Axis.units.x,i,p,t.axisX),u=f=void 0===t.axisY.type?new n.AutoScaleAxis(n.Axis.units.y,i,p,n.extend({},t.axisY,{highLow:e,referenceValue:0})):t.axisY.type.call(n,n.Axis.units.y,i,p,n.extend({},t.axisY,{highLow:e,referenceValue:0})));var m=t.horizontalBars?p.x1+u.projectValue(0):p.y1-u.projectValue(0),g=[];h.createGridAndLabels(r,o,this.supportsForeignObject,t,this.eventEmitter),u.createGridAndLabels(r,o,this.supportsForeignObject,t,this.eventEmitter),i.raw.series.forEach(function(e,r){var s,o,c=r-(i.raw.series.length-1)/2;s=t.distributeSeries&&!t.stackBars?h.axisLength/i.normalized.length/2:t.distributeSeries&&t.stackBars?h.axisLength/2:h.axisLength/i.normalized[r].length/2,o=a.elem("g"),o.attr({"ct:series-name":e.name,"ct:meta":n.serialize(e.meta)}),o.addClass([t.classNames.series,e.className||t.classNames.series+"-"+n.alphaNumerate(r)].join(" ")),i.normalized[r].forEach(function(a,l){var v,x,y,w;if(w=t.distributeSeries&&!t.stackBars?r:t.distributeSeries&&t.stackBars?0:l,v=t.horizontalBars?{x:p.x1+u.projectValue(a&&a.x?a.x:0,l,i.normalized[r]),y:p.y1-h.projectValue(a&&a.y?a.y:0,w,i.normalized[r])}:{x:p.x1+h.projectValue(a&&a.x?a.x:0,w,i.normalized[r]),y:p.y1-u.projectValue(a&&a.y?a.y:0,l,i.normalized[r])},h instanceof n.StepAxis&&(h.options.stretch||(v[h.units.pos]+=s*(t.horizontalBars?-1:1)),v[h.units.pos]+=t.stackBars||t.distributeSeries?0:c*t.seriesBarDistance*(t.horizontalBars?-1:1)),y=g[l]||m,g[l]=y-(m-v[h.counterUnits.pos]),void 0!==a){var b={};b[h.units.pos+"1"]=v[h.units.pos],b[h.units.pos+"2"]=v[h.units.pos],!t.stackBars||"accumulate"!==t.stackMode&&t.stackMode?(b[h.counterUnits.pos+"1"]=m,b[h.counterUnits.pos+"2"]=v[h.counterUnits.pos]):(b[h.counterUnits.pos+"1"]=y,b[h.counterUnits.pos+"2"]=g[l]),b.x1=Math.min(Math.max(b.x1,p.x1),p.x2),b.x2=Math.min(Math.max(b.x2,p.x1),p.x2),b.y1=Math.min(Math.max(b.y1,p.y2),p.y1),b.y2=Math.min(Math.max(b.y2,p.y2),p.y1),x=o.elem("line",b,t.classNames.bar).attr({"ct:value":[a.x,a.y].filter(n.isNum).join(","),"ct:meta":n.getMetaData(e,l)}),this.eventEmitter.emit("draw",n.extend({type:"bar",value:a,index:l,meta:n.getMetaData(e,l),series:e,seriesIndex:r,axisX:d,axisY:f,chartRect:p,group:o,element:x},b))}}.bind(this))}.bind(this)),this.eventEmitter.emit("created",{bounds:u.bounds,chartRect:p,axisX:d,axisY:f,svg:this.svg,options:t})}function r(t,e,i,r){n.Bar["super"].constructor.call(this,t,e,s,n.extend({},s,i),r)}var s={axisX:{offset:30,position:"end",labelOffset:{x:0,y:0},showLabel:!0,showGrid:!0,labelInterpolationFnc:n.noop,scaleMinSpace:30,onlyInteger:!1},axisY:{offset:40,position:"start",labelOffset:{x:0,y:0},showLabel:!0,showGrid:!0,labelInterpolationFnc:n.noop,scaleMinSpace:20,onlyInteger:!1},width:void 0,height:void 0,high:void 0,low:void 0,chartPadding:{top:15,right:15,bottom:5,left:10},seriesBarDistance:15,stackBars:!1,stackMode:"accumulate",horizontalBars:!1,distributeSeries:!1,reverseData:!1,classNames:{chart:"ct-chart-bar",horizontalBars:"ct-horizontal-bars",label:"ct-label",labelGroup:"ct-labels",series:"ct-series",bar:"ct-bar",grid:"ct-grid",gridGroup:"ct-grids",vertical:"ct-vertical",horizontal:"ct-horizontal",start:"ct-start",end:"ct-end"}};n.Bar=n.Base.extend({constructor:r,createChart:i})}(window,document,t),t}),function(t,e){t["Chartist.plugins.ctAxisTitle"]=e()}(this,function(){return function(t,e,n){"use strict";var i={axisTitle:"",axisClass:"ct-axis-title",offset:{x:0,y:0},textAnchor:"middle",flipText:!1},r={axisX:i,axisY:i};n.plugins=n.plugins||{},n.plugins.ctAxisTitle=function(t){return t=n.extend({},r,t),function(e){e.on("created",function(e){var i,r,s;if(t.axisX.axisTitle&&e.axisX&&(i=e.axisX.axisLength/2+e.options.axisY.offset+e.options.chartPadding.left,r=e.options.chartPadding.top,"end"===e.options.axisY.position&&(i-=e.options.axisY.offset),"end"===e.options.axisX.position&&(r+=e.axisY.axisLength),s=new n.Svg("text"),s.addClass(t.axisX.axisClass),s.text(t.axisX.axisTitle),s.attr({x:i+t.axisX.offset.x,y:r+t.axisX.offset.y,"text-anchor":t.axisX.textAnchor}),e.svg.append(s,!0)),t.axisY.axisTitle&&e.axisY){i=0,r=e.axisY.axisLength/2+e.options.chartPadding.top,"start"===e.options.axisX.position&&(r+=e.options.axisX.offset),"end"===e.options.axisY.position&&(i=e.axisX.axisLength);var a="rotate("+(t.axisY.flipText?-90:90)+", "+i+", "+r+")";s=new n.Svg("text"),s.addClass(t.axisY.axisClass),s.text(t.axisY.axisTitle),s.attr({x:i+t.axisY.offset.x,y:r+t.axisY.offset.y,transform:a,"text-anchor":t.axisY.textAnchor}),e.svg.append(s,!0)}})}}}(window,document,Chartist),Chartist.plugins.ctAxisTitle}),function(t,e){t["Chartist.plugins.zoom"]=e()}(this,function(){return function(t,e,n){"use strict";function i(t){t.attr({style:"display:none"})}function r(t){t.attr({style:"display:block"})}function s(t,e){var n=t.x,i=t.y,r=e.x-n,s=e.y-i;return 0>r&&(r=-r,n=e.x),0>s&&(s=-s,i=e.y),{x:n,y:i,width:r,height:s}}function a(t,e){return o(t.clientX,t.clientY,e)}function o(t,e,n){var i="svg"===n.tagName?n:n.ownerSVGElement,r=i.getScreenCTM(),s=i.createSVGPoint();return s.x=t,s.y=e,s=s.matrixTransform(r.inverse()),s||{x:0,y:0}}function c(t,e){var n=e.bounds.max,i=e.bounds.min;if(e.scale&&"log"===e.scale.type){var r=e.scale.base;return Math.pow(r,t*u(n/i,r)/e.axisLength)*i}return t*e.bounds.range/e.axisLength+i}function u(t,e){return Math.log(t)/Math.log(e)}var l={};n.plugins=n.plugins||{},n.plugins.zoom=function(t){return t=n.extend({},l,t),function(e){function o(t){var e=a(t,w);return e.id=t.identifier,e}function u(t){for(var e=0;e1&&(y.attr(s(O[0],O[1])),r(y))}function h(t){for(var e=t.changedTouches,n=0;n1&&(y.attr(s(O[0],O[1])),r(y),t.preventDefault())}function d(t){f(t.changedTouches)}function f(t){for(var e=0;e=0&&O.splice(n,1)}}function p(t){O.length>1&&v(s(O[0],O[1])),f(t.changedTouches),i(y)}function m(t){0===t.button&&(S=a(t,w),y.attr(s(S,S)),r(y),t.preventDefault())}function g(e){if(0===e.button){var n=s(S,a(e,w));v(n),S=null,i(y),e.preventDefault()}else t.resetOnRightMouseBtn&&2===e.button&&(L(),e.preventDefault())}function v(t){if(t.width>5&&t.height>5){var n=t.x-A.x1,i=n+t.width,r=A.y1-t.y,s=r-t.height;e.options.axisX.highLow={low:c(n,b),high:c(i,b)},e.options.axisY.highLow={low:c(s,E),high:c(r,E)},e.update(e.data,e.options),C&&C(e,L)}}function x(t){if(S){var e=a(t,w);y.attr(s(S,e)),t.preventDefault()}}if(e instanceof n.Line){var y,w,b,E,A,S,C=t.onZoom,O=[];e.on("draw",function(t){var e=t.type;"line"!==e&&"bar"!==e&&"area"!==e&&"point"!==e||t.element.attr({"clip-path":"url(#zoom-mask)"})}),e.on("created",function(t){b=t.axisX,E=t.axisY,A=t.chartRect,w=t.svg._node,y=t.svg.elem("rect",{x:10,y:10,width:100,height:100},"ct-zoom-rect"),i(y);var e=t.svg.querySelector("defs")||t.svg.elem("defs"),n=A.width(),r=A.height();e.elem("clipPath",{id:"zoom-mask"}).elem("rect",{x:A.x1,y:A.y2,width:n,height:r,fill:"white"}),w.addEventListener("mousedown",m),w.addEventListener("mouseup",g),w.addEventListener("mousemove",x),w.addEventListener("touchstart",l),w.addEventListener("touchmove",h),w.addEventListener("touchend",p),w.addEventListener("touchcancel",d)});var L=function(){e.options.axisX.highLow=null,e.options.axisY.highLow=null,e.update(e.data,e.options)}}}}}(window,document,Chartist),Chartist.plugins.zoom}),String.prototype.format=function(){var t=this,e=arguments;1==arguments.length&&(isArray(arguments[0])||isObject(arguments[0]))&&(e=arguments[0]);for(var n in e)if(e.hasOwnProperty(n)){var i=n;n.match(/^\{.*\}$/)||(n="{"+n+"}");var r=new RegExp(regexEscape(n),"g");t=t.replace(r,e[i])}return t};var modal=function(){var t={};return t.show=function(t){var e=$(t);e.removeClass("hidden visible"),setTimeout(function(){e.addClass("visible")},1)},t.hide=function(t){var e=$(t);e.removeClass("visible"),setTimeout(function(){e.addClass("hidden")},500)},t.init=function(){$(".Modal").on("click",function(){t.hide(this)}),$(".Dialog").on("click",function(t){t.stopImmediatePropagation()}),$(window).on("keydown",function(e){27==e.which&&t.hide(".Modal")})},t}();$().ready(function(){setInterval(function(){$(".anim-dots").each(function(t){var e=$(t),n=e.html()+".";5==n.length&&(n="."),e.html(n)})},1e3),modal.init()});var wifi=function(){function t(t,n){if(200!=n)return void i(5e3);t=JSON.parse(t);var a=!bool(t.result.inProgress)&&t.result.APs.length>0;if(i(a?15e3:1e3),a){var o=$("#ap-list");$(".AP").remove(),o.toggle(a),$("#ap-loader").toggle(!a),t.result.APs.sort(function(t,e){return e.rssi-t.rssi}).forEach(function(t){if(t.enc=parseInt(t.enc),!(t.enc>4)){var n=document.createElement("div"),i=$(n).data("ssid",t.essid).data("pwd",0!=t.enc).addClass("AP");t.essid==r.current&&i.addClass("selected");var a=document.createElement("div");$(a).addClass("inner").htmlAppend('
{0}
'.format(rssiPerc(t.rssi))).htmlAppend('
{0}
'.format(e(t.essid))).htmlAppend('
{0}
'.format(s[t.enc]));i.on("click",function(){var t=$(this);$("#conn-essid").val(t.data("ssid")),$("#conn-passwd").val(""),t.data("pwd")?modal.show("#psk-modal"):$("#conn-form").submit()}),n.appendChild(a),o[0].appendChild(n)}})}}function n(){$().get("/wifi/scan.cgi",t,!0,!0)}function i(t){setTimeout(n,t)}var r={},s=["Open","WEP","WPA","WPA2","WPA/WPA2"];return r.init=function(){n()},r}(),wfm=function(){function t(t,e,n){var i=[];t.forEach(function(t,e){i.push({x:e,y:t})});var r=[],s=window.matchMedia("screen and (min-width: 544px)"),a=!s.matches;a||r.push(Chartist.plugins.ctAxisTitle({axisX:{axisTitle:e,offset:{x:0,y:55}},axisY:{axisTitle:n,flipText:!0,offset:{x:0,y:15}}})),new Chartist.Line("#chart",{series:[{name:"a",data:i}]},{showPoint:!1,fullWidth:!0,chartPadding:a?{right:20,bottom:5,left:0}:{right:25,bottom:30,left:25},series:{a:{lineSmooth:Chartist.Interpolation.none()}},axisX:{type:Chartist.AutoScaleAxis,onlyInteger:!0},axisY:{type:Chartist.AutoScaleAxis},plugins:r})}function e(e,n){if(200!=n)return void alert("Request failed.");var i=JSON.parse(e);return i.success?void t(i.samples,"Sample Nr.","ADC value"):void alert("Sampling failed.")}var n={};return n.init=function(){function t(){var t=$("#count").val();$().get("/api/raw.json?n="+t,e,!0,!0)}$("#load").on("click",t),$("#count").on("keyup",function(e){13==e.which&&t()})},n}();