function bool(t){return 1===t||"1"===t||t===!0||"true"===t}function numfmt(t,e){var n=Math.pow(10,e);return Math.round(t*n)/n}function estimateLoadTime(t,e){return 1e3/t*e+1500}function msNow(){return+new Date}function msElapsed(t){return msNow()-t}function copyToClipboard(t){if(!document.execCommand)return!1;var e="_hiddenCopyText_";if(n=document.getElementById(e),!n){var n=document.createElement("textarea");n.style.position="absolute",n.style.left="-9999px",n.style.top="0",n.id=e,document.body.appendChild(n)}n.textContent=t;var r=document.activeElement;n.focus(),n.setSelectionRange(0,n.value.length);var o;try{o=document.execCommand("copy")}catch(a){o=!1}return r&&"function"==typeof r.focus&&r.focus(),n.textContent="",o}function errorMsg(t,e){$("#notif").addClass("error"),notify.show(t,e||3e3)}function infoMsg(t,e){$("#notif").removeClass("error"),notify.show(t,e||3e3)}!function(){"use strict";function t(){var t;for(h=!0,t=0;t=0;n-=1)t(e[n])}function r(t){return t.replace(/-\w/g,function(t){return t.charAt(1).toUpperCase()})}function o(t,e){return t.currentStyle?t.currentStyle[r(e)]:m.getComputedStyle?m.getComputedStyle(t,null).getPropertyValue(e):null}function a(t,e){return encodeURIComponent(t).replace(/%20/g,"+")+"="+encodeURIComponent(e).replace(/%20/g,"+")}function u(t,e,n){try{t.style[r(e)]=n}catch(o){}}function i(t){t.style.display="","none"===o(t,"display")&&(t.style.display="block")}function c(t){var e,r,o,u="";if(t.constructor===Object){for(e in t)if(t.hasOwnProperty(e))if(t[e].constructor===Array)for(r=0;r0&&(u+="&"+a(e.name,e.value));break;case"select-multiple":for(o=0;o0?u.substring(1):""}function f(t,e,r){var o,a,u,i=!1;return t&&(o=t.split(/\s+/),n(function(t){for(u=0;u0?b[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},b),e},e.addClass=function(t){return t&&n(function(e){e.className+=" "+t},b),e},e.removeClass=function(t){return f(t,"remove",b),e},e.toggleClass=function(t){return f(t,"toggle",b),e},e.hasClass=function(t){return f(t,"has",b)},e.html=function(t){return t||""===t?(n(function(e){e.innerHTML=t},b),e):b[0]?b[0].innerHTML:void 0},e.htmlBefore=function(t){return s(t,"before",b),e},e.htmlAfter=function(t){return s(t,"after",b),e},e.htmlAppend=function(t){return s(t,"append",b),e},e.htmlPrepend=function(t){return s(t,"prepend",b),e},e.attr=function(t,r){if(t){if(t=t.toLowerCase(),"undefined"!=typeof r)return n(function(e){"style"===t?e.style.cssText=r:"class"===t?e.className=r:e.setAttribute(t,r)},b),e;if(b[0])if("style"===t){if(b[0].style.cssText)return b[0].style.cssText}else if("class"===t){if(b[0].className)return b[0].className}else if(b[0].getAttribute(t))return b[0].getAttribute(t)}},e.data=function(t,n){return t?e.attr("data-"+t,n):void 0},e.val=function(t){var r,o,a;if(!_.isUndefined(t))return n(function(e){switch(e.nodeName){case"SELECT":for(("string"==typeof t||"number"==typeof t)&&(t=[t]),o=0;o1?r:r[0];case"INPUT":case"TEXTAREA":case"BUTTON":return b[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)},b),e):!b[0]||"INPUT"!==b[0].nodeName||"checkbox"!==b[0].type&&"radio"!==b[0].type?void 0:!!b[0].checked},e.on=function(r,o){return(t===m||t===g)&&(b=[t]),n(function(t){g.addEventListener?t.addEventListener(r,o,!1):g.attachEvent&&(t[r+o]=function(){return o.apply(t,arguments)},t.attachEvent("on"+r,t[r+o]))},b),e},e.off=function(r,o){return(t===m||t===g)&&(b=[t]),n(function(t){g.addEventListener?t.removeEventListener(r,o,!1):g.attachEvent&&(t.detachEvent("on"+r,t[r+o]),t[r+o]=null)},b),e},e.ajax=function(t,e,n,r){var o,a,u=c(b),i=e?e.toUpperCase():"GET";_.isNumber(r)&&(r={timeout:r});var f=_.extend({},{nocache:!0,timeout:5e3,loader:!0},r);if(u&&"GET"===i&&(t+=-1===t.indexOf("?")?"?"+u:"&"+u,u=null),o=new XMLHttpRequest){if(f.nocache){var s=(+new Date).toString(36);t+=(-1===t.indexOf("?")?"?":"&")+"_="+s}f.loader&&$("#loader").addClass("show"),o.open(i,t,!0),o.timeout=f.timeout,a=setTimeout(function(){errorMsg("XHR timed out."),o.abort(),f.loader&&$("#loader").removeClass("show")},f.timeout+10),o.onreadystatechange=function(){4===o.readyState&&(f.loader&&$("#loader").removeClass("show"),n&&0!=o.status&&n(o.responseText,o.status),clearTimeout(a))},o.setRequestHeader("X-Requested-With","XMLHttpRequest"),"POST"===i&&o.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),o.send(u)}return o},e.get=function(t,n,r){return e.ajax(t,"get",n,r)},e.post=function(t,n,r){return e.ajax(t,"post",n,r)},e}var p=[],d=[],h=!1,v=!1,g=document,m=window;g.addEventListener?(g.addEventListener("DOMContentLoaded",t,!1),m.addEventListener("load",e,!1)):g.attachEvent?(g.attachEvent("onreadystatechange",t),m.attachEvent("onload",e)):m.onload=e,m.$=l}(),function(){function t(t,e){return t.set(e[0],e[1]),t}function e(t,e){return t.add(e),t}function n(t,e,n){var r=n.length;switch(r){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}function r(t,e){for(var n=-1,r=t.length;++n-1&&t%1==0&&e>t}function d(t){for(var e,n=[];!(e=t.next()).done;)n.push(e.value);return n}function h(t){var e=-1,n=Array(t.size);return t.forEach(function(t,r){n[++e]=[r,t]}),n}function v(t){var e=-1,n=Array(t.size);return t.forEach(function(t){n[++e]=t}),n}function g(t){return xn[t]}function m(){}function y(){}function b(t,e){return _(t,e)&&delete t[e]}function w(t,e){if(ar){var n=t[e];return n===Ce?Ee:n}return Bn.call(t,e)?t[e]:Ee}function _(t,e){return ar?t[e]!==Ee:Bn.call(t,e)}function $(t,e,n){t[e]=ar&&n===Ee?Ce:n}function E(t){var e=-1,n=t?t.length:0;for(this.clear();++en)return!1;var r=t.length-1;return n==r?t.pop():Qn.call(t,n,1),!0}function R(t,e){var n=U(t,e);return 0>n?Ee:t[n][1]}function I(t,e){return U(t,e)>-1}function U(t,e){for(var n=t.length;n--;)if(Gt(t[n][0],e))return n;return-1}function F(t,e,n){var r=U(t,e);0>r?t.push([e,n]):t[r][1]=n}function B(t,e,n){var r=t[e];Bn.call(t,e)&&Gt(r,n)&&(n!==Ee||e in t)||(t[e]=n)}function q(t,e){return t&&mt(e,pe(e),t)}function H(t){return"function"==typeof t?t:we}function W(t){return mr(t)?t:Ht(t)}function D(t,e,n,o,a,u,i){var c;if(o&&(c=u?o(t,a,u,i):o(t)),c!==Ee)return c;if(!Zt(t))return t;var f=mr(t);if(f){if(c=St(t),!e)return gt(t,c)}else{var s=Nt(t),p=s==Fe||s==Be;if(yr(t))return ft(t,e);if(s==We||s==Le||p&&!u){if(l(t))return u?t:{};if(c=Mt(p?{}:t),!e)return c=q(c,t),n?bt(t,c):c}else{if(!jn[s])return u?t:{};c=Lt(t,s,e)}}i||(i=new O);var d=i.get(t);return d?d:(i.set(t,c),(f?r:z)(t,function(r,a){B(c,a,D(r,e,n,o,a,t,i))}),n&&!f?bt(t,c):c)}function X(t){return Zt(t)?Yn(t):{}}function z(t,e){return t&&hr(t,e,pe)}function G(t,e){e=It(e,t)?[e+""]:W(e);for(var n=0,r=e.length;null!=t&&r>n;)t=t[e[n++]];return n&&n==r?t:Ee}function V(t,e){return Bn.call(t,e)||"object"==typeof t&&e in t&&null===Vn(t)}function J(t,e){return e in Object(t)}function Y(t,e,n,r,o){return t===e?!0:null==t||null==e||!Zt(t)&&!te(e)?t!==t&&e!==e:K(t,e,Y,n,r,o)}function K(t,e,n,r,o,a){var u=mr(t),i=mr(e),c=Pe,f=Pe;u||(c=Nt(t),c=c==Le?We:c),i||(f=Nt(e),f=f==Le?We:f);var s=c==We&&!l(t),p=f==We&&!l(e),d=c==f;if(d&&!s)return a||(a=new O),u||ae(t)?jt(t,e,n,r,o,a):At(t,e,c,n,r,o,a);if(!(o&Oe)){var h=s&&Bn.call(t,"__wrapped__"),v=p&&Bn.call(e,"__wrapped__");if(h||v)return a||(a=new O),n(h?t.value():t,v?e.value():e,r,o,a)}return d?(a||(a=new O),xt(t,e,n,r,o,a)):!1}function Q(t,e,n,r){var o=n.length,a=o,u=!r;if(null==t)return!a;for(t=Object(t);o--;){var i=n[o];if(u&&i[2]?i[1]!==t[i[0]]:!(i[0]in t))return!1}for(;++oe&&(e=-e>o?0:o+e),n=n>o?o:n,0>n&&(n+=o),o=e>n?0:n-e>>>0,e>>>=0;for(var a=Array(o);++r1?n[o-1]:Ee,u=o>2?n[2]:Ee;for(a="function"==typeof a?(o--,a):Ee,u&&Rt(n[0],n[1],u)&&(a=3>o?Ee:a,o=1),e=Object(e);++re?1:-1:ce(r)||0,it(e,n,r,t)}}function jt(t,e,n,r,o,a){var i=-1,c=o&Oe,f=o&Te,s=t.length,l=e.length;if(s!=l&&!(c&&l>s))return!1;var p=a.get(t);if(p)return p==e;var d=!0;for(a.set(t,e);++i-1&&t%1==0&&ke>=t}function Zt(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function te(t){return!!t&&"object"==typeof t}function ee(t){return null==t?!1:Kt(t)?Hn.test(Fn.call(t)):te(t)&&(l(t)?Hn:wn).test(t)}function ne(t){return"number"==typeof t||te(t)&&qn.call(t)==He}function re(t){return"string"==typeof t||!mr(t)&&te(t)&&qn.call(t)==ze}function oe(t){return"symbol"==typeof t||te(t)&&qn.call(t)==Ge}function ae(t){return te(t)&&Qt(t.length)&&!!En[qn.call(t)]}function ue(t){return t===Ee}function ie(t){if(!t)return 0===t?t:0;if(t=ce(t),t===Ne||t===-Ne){var e=0>t?-1:1;return e*Se}var n=t%1;return t===t?n?t-n:t:0}function ce(t){if(Zt(t)){var e=Kt(t.valueOf)?t.valueOf():t;t=Zt(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(vn,"");var n=bn.test(t);return n||_n.test(t)?Tn(t.slice(2),n?2:8):yn.test(t)?Me:+t}function fe(t){if("string"==typeof t)return t;if(null==t)return"";if(oe(t))return pr?pr.call(t):"";var e=t+"";return"0"==e&&1/t==-Ne?"-0":e}function se(t,e,n){var r=null==t?Ee:G(t,e);return r===Ee?n:r}function le(t,e){return kt(t,e,J)}function pe(t){var e=Ft(t);if(!e&&!Jt(t))return tt(t);var n=Pt(t),r=!!n,o=n||[],a=o.length;for(var u in t)!V(t,u)||r&&("length"==u||p(u,a))||e&&"constructor"==u||o.push(u);return o}function de(t){for(var e=-1,n=Ft(t),r=et(t),o=r.length,a=Pt(t),u=!!a,i=a||[],c=i.length;++e"'`]/g,cn=RegExp(an.source),fn=RegExp(un.source),sn=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,ln=/^\w*$/,pn=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g,dn=/[\\^$.*+?()[\]{}|]/g,hn=RegExp(dn.source),vn=/^\s+|\s+$/g,gn=/\\(\\)?/g,mn=/\w*$/,yn=/^[-+]0x[0-9a-f]+$/i,bn=/^0b[01]+$/i,wn=/^\[object .+?Constructor\]$/,_n=/^0o[0-7]+$/i,$n=/^(?:0|[1-9]\d*)$/,En={};En[Ye]=En[Ke]=En[Qe]=En[Ze]=En[tn]=En[en]=En[nn]=En[rn]=En[on]=!0,En[Le]=En[Pe]=En[Je]=En[Re]=En[Ie]=En[Ue]=En[Fe]=En[qe]=En[He]=En[We]=En[De]=En[Xe]=En[ze]=En[Ve]=!1;var jn={};jn[Le]=jn[Pe]=jn[Je]=jn[Re]=jn[Ie]=jn[Ye]=jn[Ke]=jn[Qe]=jn[Ze]=jn[tn]=jn[qe]=jn[He]=jn[We]=jn[De]=jn[Xe]=jn[ze]=jn[Ge]=jn[en]=jn[nn]=jn[rn]=jn[on]=!0,jn[Ue]=jn[Fe]=jn[Ve]=!1;var An={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},xn={"&":"&","<":"<",">":">",""":'"',"'":"'","`":"`"},Cn={"function":!0,object:!0},Tn=parseInt,On=Cn[typeof exports]&&exports&&!exports.nodeType?exports:Ee,Nn=Cn[typeof module]&&module&&!module.nodeType?module:Ee,kn=Nn&&Nn.exports===On?On:Ee,Sn=f(On&&Nn&&"object"==typeof global&&global),Mn=f(Cn[typeof self]&&self),Ln=f(Cn[typeof window]&&window),Pn=f(Cn[typeof this]&&this),Rn=Sn||Ln!==(Pn&&Pn.window)&&Ln||Mn||Pn||Function("return this")(),In=Array.prototype,Un=Object.prototype,Fn=Function.prototype.toString,Bn=Un.hasOwnProperty,qn=Un.toString,Hn=RegExp("^"+Fn.call(Bn).replace(dn,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Wn=kn?Rn.Buffer:Ee,Dn=Rn.Reflect,Xn=Rn.Symbol,zn=Rn.Uint8Array,Gn=Dn?Dn.enumerate:Ee,Vn=Object.getPrototypeOf,Jn=Object.getOwnPropertySymbols,Yn=Object.create,Kn=Un.propertyIsEnumerable,Qn=In.splice,Zn=Math.ceil,tr=Object.keys,er=Math.max,nr=Ot(Rn,"Map"),rr=Ot(Rn,"Set"),or=Ot(Rn,"WeakMap"),ar=Ot(Object,"create"),ur=!Kn.call({valueOf:1},"valueOf"),ir=nr?Fn.call(nr):"",cr=rr?Fn.call(rr):"",fr=or?Fn.call(or):"",sr=Xn?Xn.prototype:Ee,lr=sr?sr.valueOf:Ee,pr=sr?sr.toString:Ee,dr=_t(z),hr=$t();Gn&&!Kn.call({valueOf:1},"valueOf")&&(et=function(t){return d(Gn(t))});var vr=at("length"),gr=Jn||function(){return[]};(nr&&Nt(new nr)!=qe||rr&&Nt(new rr)!=Xe||or&&Nt(new or)!=Ve)&&(Nt=function(t){var e=qn.call(t),n=e==We?t.constructor:null,r="function"==typeof n?Fn.call(n):"";if(r)switch(r){case ir:return qe;case cr:return Xe;case fr:return Ve}return e});var mr=Array.isArray,yr=Wn?function(t){return t instanceof Wn}:be(!1),br=wt(function(t,e){if(ur||Ft(e)||Jt(e))return void mt(e,de(e),t);for(var n in e)B(t,n,e[n])}),wr=Et();y.prototype=ar?ar(null):Un,E.prototype.clear=j,E.prototype["delete"]=A,E.prototype.get=x,E.prototype.has=C,E.prototype.set=T,O.prototype.clear=N,O.prototype["delete"]=k,O.prototype.get=S,O.prototype.has=M,O.prototype.set=L,m.assignIn=br,m.constant=be,m.iteratee=_e,m.keys=pe,m.keysIn=de,m.map=Xt,m.property=$e,m.range=wr,m.rest=zt,m.toPairs=he,m.extend=br,m.eq=Gt,m.escape=ve,m.escapeRegExp=ge,m.forEach=Dt,m.get=se,m.hasIn=le,m.identity=we,m.isArguments=Vt,m.isArray=mr,m.isArrayLike=Jt,m.isArrayLikeObject=Yt,m.isBuffer=yr,m.isFunction=Kt,m.isLength=Qt,m.isNative=ee,m.isNumber=ne,m.isObject=Zt,m.isObjectLike=te,m.isString=re,m.isSymbol=oe,m.isTypedArray=ae,m.isUndefined=ue,m.last=Wt,m.replace=me,m.toInteger=ie,m.toNumber=ce,m.toString=fe,m.unescape=ye,m.each=Dt,m.VERSION=je,(Ln||Mn||{})._=m,Rn._=m}.call(this),Math.log10=Math.log10||function(t){return Math.log(t)/Math.LN10},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 r=n;n.match(/^\{.*\}$/)||(n="{"+n+"}");var o=new RegExp(_.escapeRegExp(n),"g");t=t.replace(o,e[r])}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(){$(this).hasClass("no-close")||t.hide(this)}),$(".Dialog").on("click",function(t){t.stopImmediatePropagation()}),$(window).on("keydown",function(e){27==e.which&&t.hide(".Modal")})},t}(),notify=function(){var t,e,n={},r="#notif";return n.show=function(o,a){$(r).html(o),modal.show(r),clearTimeout(t),clearTimeout(e),_.isUndefined(a)||(t=setTimeout(n.hide,a))},n.hide=function(){var t=$(r);t.removeClass("visible"),e=setTimeout(function(){t.addClass("hidden")},250)},n.init=function(){$(r).on("click",function(){n.hide(this)})},n}();$().ready(function(){setInterval(function(){$(".anim-dots").each(function(t){var e=$(t),n=e.html()+".";5==n.length&&(n="."),e.html(n)})},1e3),$("input[type=number]").on("mousewheel",function(t){var e=+$(this).val(),n=+($(this).attr("step")||1),r=$(this).attr("min"),o=$(this).attr("max");if(t.wheelDelta>0?e+=n:e-=n,_.isUndefined(r)||(e=Math.max(e,r)),_.isUndefined(o)||(e=Math.min(e,o)),$(this).val(e),"createEvent"in document){var a=document.createEvent("HTMLEvents");a.initEvent("change",!1,!0),$(this)[0].dispatchEvent(a)}else $(this)[0].fireEvent("onchange");t.preventDefault()}),modal.init(),notify.init()});var page_wifi=function(){function t(t,e){if(200!=e)return void n(5e3);t=JSON.parse(t);var a=!bool(t.result.inProgress)&&t.result.APs.length>0;if(n(a?15e3:1e3),a){var u=$("#ap-list");$(".AP").remove(),u.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 e=document.createElement("div"),n=$(e).data("ssid",t.essid).data("pwd",0!=t.enc).addClass("AP");t.essid==r.current&&n.addClass("selected");var a=document.createElement("div");$(a).addClass("inner").htmlAppend('
{0}
'.format(t.rssi_perc)).htmlAppend('
{0}
'.format(_.escape(t.essid))).htmlAppend('
{0}
'.format(o[t.enc]));n.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()}),e.appendChild(a),u[0].appendChild(e)}})}}function e(){$().get(_root+"/wifi/scan",t)}function n(t){setTimeout(e,t)}var r={},o=["Open","WEP","WPA","WPA2","WPA/WPA2"];return r.init=function(){e()},r}(),page_home=function(){function t(){var t=$("#control-range").val();if(t!=r){r=t;var e="f";0>t&&(t*=-1,e="r"),t=18432*(t/100),20>t?$().get(_root+"/m/stop"):$().get(_root+"/m/start?dir="+e+"&speed="+Math.round(t))}}function e(){t(),setTimeout(e,150)}var n={},r=0;return n.init=function(){$("#btn-stop").on("mousedown",function(){$().get(_root+"/m/stop"),$("#control-range").val(0)}),$("#btn-rev").on("mousedown",function(){var e=$("#control-range"),n=1*e.val();e.val(n-10),t()}),$("#btn-fwd").on("mousedown",function(){var e=$("#control-range"),n=1*e.val();e.val(n+10),t()}),$("#control-range").on("change",t),e()},n}();