window.Modernizr=function(e,t,n){function r(e){h.cssText=e}function i(e,t){return typeof e===t}var o,a,s,u="2.6.2",c={},l=!0,f=t.documentElement,p="modernizr",d=t.createElement(p),h=d.style,m={}.toString,g=" -webkit- -moz- -o- -ms- ".split(" "),v={svg:"http://www.w3.org/2000/svg"},$={},y=[],b=y.slice,w=function(e,n,r,i){var o,a,s,u,c=t.createElement("div"),l=t.body,d=l||t.createElement("body");if(parseInt(r,10))for(;r--;)s=t.createElement("div"),s.id=i?i[r]:p+(r+1),c.appendChild(s);return o=["­",'"].join(""),c.id=p,(l?c:d).innerHTML+=o,d.appendChild(c),l||(d.style.background="",d.style.overflow="hidden",u=f.style.overflow,f.style.overflow="hidden",f.appendChild(d)),a=n(c,e),l?c.parentNode.removeChild(c):(d.parentNode.removeChild(d),f.style.overflow=u),!!a},x=function(t){var n=e.matchMedia||e.msMatchMedia;if(n)return n(t).matches;var r;return w("@media "+t+" { #"+p+" { position: absolute; } }",function(t){r="absolute"==(e.getComputedStyle?getComputedStyle(t,null):t.currentStyle).position}),r},C={}.hasOwnProperty;s=i(C,"undefined")||i(C.call,"undefined")?function(e,t){return t in e&&i(e.constructor.prototype[t],"undefined")}:function(e,t){return C.call(e,t)},Function.prototype.bind||(Function.prototype.bind=function(e){var t=this;if("function"!=typeof t)throw new TypeError;var n=b.call(arguments,1),r=function(){if(this instanceof r){var i=function(){};i.prototype=t.prototype;var o=new i,a=t.apply(o,n.concat(b.call(arguments)));return Object(a)===a?a:o}return t.apply(e,n.concat(b.call(arguments)))};return r}),$.touch=function(){var n;return"ontouchstart"in e||e.DocumentTouch&&t instanceof DocumentTouch?n=!0:w(["@media (",g.join("touch-enabled),("),p,")","{#modernizr{top:9px;position:absolute}}"].join(""),function(e){n=9===e.offsetTop}),n},$.svg=function(){return!!t.createElementNS&&!!t.createElementNS(v.svg,"svg").createSVGRect},$.inlinesvg=function(){var e=t.createElement("div");return e.innerHTML="",(e.firstChild&&e.firstChild.namespaceURI)==v.svg},$.svgclippaths=function(){return!!t.createElementNS&&/SVGClipPath/.test(m.call(t.createElementNS(v.svg,"clipPath")))};for(var S in $)s($,S)&&(a=S.toLowerCase(),c[a]=$[S](),y.push((c[a]?"":"no-")+a));return c.addTest=function(e,t){if("object"==typeof e)for(var r in e)s(e,r)&&c.addTest(r,e[r]);else{if(e=e.toLowerCase(),c[e]!==n)return c;t="function"==typeof t?t():t,"undefined"!=typeof l&&l&&(f.className+=" "+(t?"":"no-")+e),c[e]=t}return c},r(""),d=o=null,function(e,t){function n(e,t){var n=e.createElement("p"),r=e.getElementsByTagName("head")[0]||e.documentElement;return n.innerHTML="x",r.insertBefore(n.lastChild,r.firstChild)}function r(){var e=v.elements;return"string"==typeof e?e.split(" "):e}function i(e){var t=g[e[h]];return t||(t={},m++,e[h]=m,g[m]=t),t}function o(e,n,r){if(n||(n=t),l)return n.createElement(e);r||(r=i(n));var o;return o=r.cache[e]?r.cache[e].cloneNode():d.test(e)?(r.cache[e]=r.createElem(e)).cloneNode():r.createElem(e),o.canHaveChildren&&!p.test(e)?r.frag.appendChild(o):o}function a(e,n){if(e||(e=t),l)return e.createDocumentFragment();n=n||i(e);for(var o=n.frag.cloneNode(),a=0,s=r(),u=s.length;u>a;a++)o.createElement(s[a]);return o}function s(e,t){t.cache||(t.cache={},t.createElem=e.createElement,t.createFrag=e.createDocumentFragment,t.frag=t.createFrag()),e.createElement=function(n){return v.shivMethods?o(n,e,t):t.createElem(n)},e.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+r().join().replace(/\w+/g,function(e){return t.createElem(e),t.frag.createElement(e),'c("'+e+'")'})+");return n}")(v,t.frag)}function u(e){e||(e=t);var r=i(e);return v.shivCSS&&!c&&!r.hasCSS&&(r.hasCSS=!!n(e,"article,aside,figcaption,figure,footer,header,hgroup,nav,section{display:block}mark{background:#FF0;color:#000}")),l||s(e,r),e}var c,l,f=e.html5||{},p=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,d=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,h="_html5shiv",m=0,g={};!function(){try{var e=t.createElement("a");e.innerHTML="",c="hidden"in e,l=1==e.childNodes.length||function(){t.createElement("a");var e=t.createDocumentFragment();return"undefined"==typeof e.cloneNode||"undefined"==typeof e.createDocumentFragment||"undefined"==typeof e.createElement}()}catch(n){c=!0,l=!0}}();var v={elements:f.elements||"abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video",shivCSS:f.shivCSS!==!1,supportsUnknownElements:l,shivMethods:f.shivMethods!==!1,type:"default",shivDocument:u,createElement:o,createDocumentFragment:a};e.html5=v,u(t)}(this,t),c._version=u,c._prefixes=g,c.mq=x,c.testStyles=w,f.className=f.className.replace(/(^|\s)no-js(\s|$)/,"$1$2")+(l?" js "+y.join(" "):""),c}(this,this.document),function(e,t,n){function r(e){return"[object Function]"==g.call(e)}function i(e){return"string"==typeof e}function o(){}function a(e){return!e||"loaded"==e||"complete"==e||"uninitialized"==e}function s(){var e=v.shift();$=1,e?e.t?h(function(){("c"==e.t?p.injectCss:p.injectJs)(e.s,0,e.a,e.x,e.e,1)},0):(e(),s()):$=0}function u(e,n,r,i,o,u,c){function l(t){if(!d&&a(f.readyState)&&(y.r=d=1,!$&&s(),f.onload=f.onreadystatechange=null,t)){"img"!=e&&h(function(){w.removeChild(f)},50);for(var r in k[n])k[n].hasOwnProperty(r)&&k[n][r].onload()}}var c=c||p.errorTimeout,f=t.createElement(e),d=0,g=0,y={t:r,s:n,e:o,a:u,x:c};1===k[n]&&(g=1,k[n]=[]),"object"==e?f.data=n:(f.src=n,f.type=e),f.width=f.height="0",f.onerror=f.onload=f.onreadystatechange=function(){l.call(this,g)},v.splice(i,0,y),"img"!=e&&(g||2===k[n]?(w.insertBefore(f,b?null:m),h(l,c)):k[n].push(f))}function c(e,t,n,r,o){return $=0,t=t||"j",i(e)?u("c"==t?C:x,e,t,this.i++,n,r,o):(v.splice(this.i++,0,e),1==v.length&&s()),this}function l(){var e=p;return e.loader={load:c,i:0},e}var f,p,d=t.documentElement,h=e.setTimeout,m=t.getElementsByTagName("script")[0],g={}.toString,v=[],$=0,y="MozAppearance"in d.style,b=y&&!!t.createRange().compareNode,w=b?d:m.parentNode,d=e.opera&&"[object Opera]"==g.call(e.opera),d=!!t.attachEvent&&!d,x=y?"object":d?"script":"img",C=d?"script":x,S=Array.isArray||function(e){return"[object Array]"==g.call(e)},T=[],k={},E={timeout:function(e,t){return t.length&&(e.timeout=t[0]),e}};p=function(e){function t(e){var t,n,r,e=e.split("!"),i=T.length,o=e.pop(),a=e.length,o={url:o,origUrl:o,prefixes:e};for(n=0;a>n;n++)r=e[n].split("="),(t=E[r.shift()])&&(o=t(o,r));for(n=0;i>n;n++)o=T[n](o);return o}function a(e,i,o,a,s){var u=t(e),c=u.autoCallback;u.url.split(".").pop().split("?").shift(),u.bypass||(i&&(i=r(i)?i:i[e]||i[a]||i[e.split("/").pop().split("?")[0]]),u.instead?u.instead(e,i,o,a,s):(k[u.url]?u.noexec=!0:k[u.url]=1,o.load(u.url,u.forceCSS||!u.forceJS&&"css"==u.url.split(".").pop().split("?").shift()?"c":n,u.noexec,u.attrs,u.timeout),(r(i)||r(c))&&o.load(function(){l(),i&&i(u.origUrl,s,a),c&&c(u.origUrl,s,a),k[u.url]=2})))}function s(e,t){function n(e,n){if(e){if(i(e))n||(f=function(){var e=[].slice.call(arguments);p.apply(this,e),d()}),a(e,f,t,0,c);else if(Object(e)===e)for(u in s=function(){var t,n=0;for(t in e)e.hasOwnProperty(t)&&n++;return n}(),e)e.hasOwnProperty(u)&&(!n&&!--s&&(r(f)?f=function(){var e=[].slice.call(arguments);p.apply(this,e),d()}:f[u]=function(e){return function(){var t=[].slice.call(arguments);e&&e.apply(this,t),d()}}(p[u])),a(e[u],f,t,u,c))}else!n&&d()}var s,u,c=!!e.test,l=e.load||e.both,f=e.callback||o,p=f,d=e.complete||o;n(c?e.yep:e.nope,!!l),l&&n(l)}var u,c,f=this.yepnope.loader;if(i(e))a(e,0,f,0);else if(S(e))for(u=0;u0&&t-1 in e)}function r(e){var t=ht[e]={};return ot.each(e.match(st)||[],function(e,n){t[n]=!0}),t}function i(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=ot.expando+Math.random()}function o(e,n,r){var i;if(r===t&&1===e.nodeType)if(i="data-"+n.replace($t,"-$1").toLowerCase(),r=e.getAttribute(i),"string"==typeof r){try{r="true"===r?!0:"false"===r?!1:"null"===r?null:+r+""===r?+r:vt.test(r)?JSON.parse(r):r}catch(o){}mt.set(e,n,r)}else r=t;return r}function a(){return!0}function s(){return!1}function u(){try{return z.activeElement}catch(e){}}function c(e,t){for(;(e=e[t])&&1!==e.nodeType;);return e}function l(e,t,n){if(ot.isFunction(t))return ot.grep(e,function(e,r){return!!t.call(e,r,e)!==n});if(t.nodeType)return ot.grep(e,function(e){return e===t!==n});if("string"==typeof t){if(At.test(t))return ot.filter(t,e,n);t=ot.filter(t,e)}return ot.grep(e,function(e){return tt.call(t,e)>=0!==n})}function f(e,t){return ot.nodeName(e,"table")&&ot.nodeName(1===t.nodeType?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function p(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function d(e){var t=qt.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function h(e,t){for(var n=e.length,r=0;n>r;r++)gt.set(e[r],"globalEval",!t||gt.get(t[r],"globalEval"))}function m(e,t){var n,r,i,o,a,s,u,c;if(1===t.nodeType){if(gt.hasData(e)&&(o=gt.access(e),a=gt.set(t,o),c=o.events)){delete a.handle,a.events={};for(i in c)for(n=0,r=c[i].length;r>n;n++)ot.event.add(t,i,c[i][n])}mt.hasData(e)&&(s=mt.access(e),u=ot.extend({},s),mt.set(t,u))}}function g(e,n){var r=e.getElementsByTagName?e.getElementsByTagName(n||"*"):e.querySelectorAll?e.querySelectorAll(n||"*"):[];return n===t||n&&ot.nodeName(e,n)?ot.merge([e],r):r}function v(e,t){var n=t.nodeName.toLowerCase();"input"===n&&Ft.test(e.type)?t.checked=e.checked:("input"===n||"textarea"===n)&&(t.defaultValue=e.defaultValue)}function $(e,t){if(t in e)return t;for(var n=t.charAt(0).toUpperCase()+t.slice(1),r=t,i=Qt.length;i--;)if(t=Qt[i]+n,t in e)return t;return r}function y(e,t){return e=t||e,"none"===ot.css(e,"display")||!ot.contains(e.ownerDocument,e)}function b(t){return e.getComputedStyle(t,null)}function w(e,t){for(var n,r,i,o=[],a=0,s=e.length;s>a;a++)r=e[a],r.style&&(o[a]=gt.get(r,"olddisplay"),n=r.style.display,t?(o[a]||"none"!==n||(r.style.display=""),""===r.style.display&&y(r)&&(o[a]=gt.access(r,"olddisplay",T(r.nodeName)))):o[a]||(i=y(r),(n&&"none"!==n||!i)&>.set(r,"olddisplay",i?n:ot.css(r,"display"))));for(a=0;s>a;a++)r=e[a],r.style&&(t&&"none"!==r.style.display&&""!==r.style.display||(r.style.display=t?o[a]||"":"none"));return e}function x(e,t,n){var r=Wt.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):t}function C(e,t,n,r,i){for(var o=n===(r?"border":"content")?4:"width"===t?1:0,a=0;4>o;o+=2)"margin"===n&&(a+=ot.css(e,n+Kt[o],!0,i)),r?("content"===n&&(a-=ot.css(e,"padding"+Kt[o],!0,i)),"margin"!==n&&(a-=ot.css(e,"border"+Kt[o]+"Width",!0,i))):(a+=ot.css(e,"padding"+Kt[o],!0,i),"padding"!==n&&(a+=ot.css(e,"border"+Kt[o]+"Width",!0,i)));return a}function S(e,t,n){var r=!0,i="width"===t?e.offsetWidth:e.offsetHeight,o=b(e),a=ot.support.boxSizing&&"border-box"===ot.css(e,"boxSizing",!1,o);if(0>=i||null==i){if(i=Ut(e,t,o),(0>i||null==i)&&(i=e.style[t]),Xt.test(i))return i;r=a&&(ot.support.boxSizingReliable||i===e.style[t]),i=parseFloat(i)||0}return i+C(e,t,n||(a?"border":"content"),r,o)+"px"}function T(e){var t=z,n=Yt[e];return n||(n=k(e,t),"none"!==n&&n||(Bt=(Bt||ot("',srcAction:"iframe_src",patterns:{youtube:{index:"youtube.com",id:"v=",src:"//www.youtube.com/embed/%id%?autoplay=1"},vimeo:{index:"vimeo.com/",id:"/",src:"//player.vimeo.com/video/%id%?autoplay=1"},gmaps:{index:"//maps.google.",src:"%id%&output=embed"}}},proto:{initIframe:function(){t.types.push(U),C("BeforeChange",function(e,t,n){t!==n&&(t===U?V():n===U&&V(!0))}),C(u+"."+U,function(){V()})},getIframe:function(n,r){var i=n.src,o=t.st.iframe;e.each(o.patterns,function(){return i.indexOf(this.index)>-1?(this.id&&(i="string"==typeof this.id?i.substr(i.lastIndexOf(this.id)+this.id.length,i.length):this.id.call(this,i)),i=this.src.replace("%id%",i),!1):void 0});var a={};return o.srcAction&&(a[o.srcAction]=i),t._parseMarkup(r,a,n),t.updateStatus("ready"),r}}});var z=function(e){var n=t.items.length;return e>n-1?e-n:0>e?n+e:e},W=function(e,t,n){return e.replace(/%curr%/gi,t+1).replace(/%total%/gi,n)};e.magnificPopup.registerModule("gallery",{options:{enabled:!1,arrowMarkup:'',preload:[0,2],navigateByImgClick:!0,arrows:!0,tPrev:"Previous (Left arrow key)",tNext:"Next (Right arrow key)",tCounter:"%curr% of %total%"},proto:{initGallery:function(){var n=t.st.gallery,r=".mfp-gallery",o=Boolean(e.fn.mfpFastClick);return t.direction=!0,n&&n.enabled?(a+=" mfp-gallery",C(d+r,function(){n.navigateByImgClick&&t.wrap.on("click"+r,".mfp-img",function(){return t.items.length>1?(t.next(),!1):void 0}),i.on("keydown"+r,function(e){37===e.keyCode?t.prev():39===e.keyCode&&t.next()})}),C("UpdateStatus"+r,function(e,n){n.text&&(n.text=W(n.text,t.currItem.index,t.items.length))}),C(p+r,function(e,r,i,o){var a=t.items.length;i.counter=a>1?W(n.tCounter,o.index,a):""}),C("BuildControls"+r,function(){if(t.items.length>1&&n.arrows&&!t.arrowLeft){var r=n.arrowMarkup,i=t.arrowLeft=e(r.replace(/%title%/gi,n.tPrev).replace(/%dir%/gi,"left")).addClass(y),a=t.arrowRight=e(r.replace(/%title%/gi,n.tNext).replace(/%dir%/gi,"right")).addClass(y),s=o?"mfpFastClick":"click";i[s](function(){t.prev()}),a[s](function(){t.next()}),t.isIE7&&(S("b",i[0],!1,!0),S("a",i[0],!1,!0),S("b",a[0],!1,!0),S("a",a[0],!1,!0)),t.container.append(i.add(a))}}),C(h+r,function(){t._preloadTimeout&&clearTimeout(t._preloadTimeout),t._preloadTimeout=setTimeout(function(){t.preloadNearbyImages(),t._preloadTimeout=null},16)}),C(u+r,function(){i.off(r),t.wrap.off("click"+r),t.arrowLeft&&o&&t.arrowLeft.add(t.arrowRight).destroyMfpFastClick(),t.arrowRight=t.arrowLeft=null}),void 0):!1},next:function(){t.direction=!0,t.index=z(t.index+1),t.updateItemHTML()},prev:function(){t.direction=!1,t.index=z(t.index-1),t.updateItemHTML()},goTo:function(e){t.direction=e>=t.index,t.index=e,t.updateItemHTML()},preloadNearbyImages:function(){var e,n=t.st.gallery.preload,r=Math.min(n[0],t.items.length),i=Math.min(n[1],t.items.length);for(e=1;(t.direction?i:r)>=e;e++)t._preloadItem(t.index+e);for(e=1;(t.direction?r:i)>=e;e++)t._preloadItem(t.index-e)},_preloadItem:function(n){if(n=z(n),!t.items[n].preloaded){var r=t.items[n];r.parsed||(r=t.parseEl(n)),T("LazyLoad",r),"image"===r.type&&(r.img=e('').on("load.mfploader",function(){r.hasSize=!0}).on("error.mfploader",function(){r.hasSize=!0,r.loadError=!0,T("LazyLoadError",r)}).attr("src",r.src)),r.preloaded=!0}}}});var X="retina";e.magnificPopup.registerModule(X,{options:{replaceSrc:function(e){return e.src.replace(/\.\w+$/,function(e){return"@2x"+e})},ratio:1},proto:{initRetina:function(){if(window.devicePixelRatio>1){var e=t.st.retina,n=e.ratio;n=isNaN(n)?n():n,n>1&&(C("ImageHasSize."+X,function(e,t){t.img.css({"max-width":t.img[0].naturalWidth/n,width:"100%"})}),C("ElementParse."+X,function(t,r){r.src=e.replaceSrc(r,n)}))}}}}),function(){var t=1e3,n="ontouchstart"in window,r=function(){x.off("touchmove"+o+" touchend"+o)},i="mfpFastClick",o="."+i;e.fn.mfpFastClick=function(i){return e(this).each(function(){var a,s=e(this);if(n){var u,c,l,f,p,d;s.on("touchstart"+o,function(e){f=!1,d=1,p=e.originalEvent?e.originalEvent.touches[0]:e.touches[0],c=p.clientX,l=p.clientY,x.on("touchmove"+o,function(e){p=e.originalEvent?e.originalEvent.touches:e.touches,d=p.length,p=p[0],(Math.abs(p.clientX-c)>10||Math.abs(p.clientY-l)>10)&&(f=!0,r())}).on("touchend"+o,function(e){r(),f||d>1||(a=!0,e.preventDefault(),clearTimeout(u),u=setTimeout(function(){a=!1},t),i())})})}s.on("click"+o,function(){a||i()})})},e.fn.destroyMfpFastClick=function(){e(this).off("touchstart"+o+" click"+o),n&&x.off("touchmove"+o+" touchend"+o)}}(),E()}(window.jQuery||window.Zepto),function(){var e;e=angular.module("adminApp",["ngCookies"]),e.controller("AdminIndexCtrl",["$scope","$location","$q","$cookieStore",function(e,t,n,r){return e.host=t.search().host||r.get("host")||t.host(),e.port=t.search().port||r.get("port"),e.database=t.search().database||r.get("database"),e.username=t.search().username||r.get("username"),e.password=t.search().password||r.get("password"),e.ssl=r.get("ssl")||!1,e.authenticated=!1,e.isClusterAdmin=!1,e.databases=[],e.admins=[],e.data=[],e.readQuery=null,e.writeSeriesName=null,e.writeValues=null,e.successMessage="OK",e.alertMessage="Error",e.authMessage="",e.queryMessage="",e.selectedPane="databases",e.selectedSubPane="users",e.newDbUser={},e.interfaces=[],e.databaseUsers=[],e.retentionPolicies=[],e.databaseUser=null,e.successMessage="",e.failureMessage="",e.newAdminUsername=null,e.newAdminPassword=null,e.newUserPassword=null,e.newUserPasswordConfirmation=null,window.influxdb=null,e.alertSuccess=function(t){return e.successMessage=t,$("#alert-success").show().delay(2500).fadeOut(500)},e.alertFailure=function(t){return e.failureMessage=t,$("#alert-failure").show().delay(2500).fadeOut(500)},e.humanize=function(e){return e.replace(/_/g," ").replace(/(\w+)/g,function(e){return e.charAt(0).toUpperCase()+e.slice(1)})},e.setCurrentInterface=function(t){return $("iframe").prop("src","/interfaces/"+t),e.selectedPane="data"},e.showDefaultInterface=function(t){return window.influxdb.database=t,$("iframe").prop("src","/interfaces/default"),e.selectedPane="data"},e.authenticateUser=function(){return e.database?e.authenticateAsDatabaseAdmin():e.authenticateAsClusterAdmin()},e.authenticateAsClusterAdmin=function(){return window.influxdb=new InfluxDB({hosts:[e.host],port:e.port,username:e.username,password:e.password,ssl:e.ssl}),e.authenticated=!0,e.isClusterAdmin=!0,e.isDatabaseAdmin=!1,e.selectedPane="databases",e.selectedSubPane="users",e.storeAuthenticatedCredentials(),e.getDatabases(),e.database?(e.selectedDatabase=e.database,e.showUsers()):void 0},e.authenticateAsDatabaseAdmin=function(){return window.influxdb=new InfluxDB({host:e.host,port:e.port,username:e.username,password:e.password,database:e.database,ssl:e.ssl}),e.authenticated=!0,e.isDatabaseAdmin=!0,e.isClusterAdmin=!1,e.selectedPane="databases",e.selectedSubPane="users",e.selectedDatabase=e.database,e.storeAuthenticatedCredentials(),e.showUsers()},e.storeAuthenticatedCredentials=function(){return r.put("username",e.username),r.put("password",e.password),r.put("database",e.database),r.put("host",e.host),r.put("port",e.port),r.put("ssl",e.ssl)},e.getDatabases=function(){return n.when(window.influxdb.showDatabases()).then(function(t){var n,r;return n=t.results[0],r=n.series[0],e.databases=r.values.map(function(e){return{name:e[0]}})})},e.getUsers=function(){return n.when(window.influxdb.getUsers()).then(function(t){return e.users=t})},e.createDatabase=function(){return n.when(window.influxdb.createDatabase(e.newDatabaseName)).then(function(){return e.alertSuccess("Successfully created database: "+e.newDatabaseName),e.newDatabaseName=null,e.getDatabases()},function(t){return e.alertFailure("Failed to create database: "+t.responseText)})},e.deleteDatabase=function(t){return n.when(window.influxdb.dropDatabase(t)).then(function(){return e.alertSuccess("Successfully removed database: "+t),e.getDatabases()},function(t){return e.alertFailure("Failed to remove database: "+t.responseText)})},e.authError=function(t){return e.authMessage=t,$("span#authFailure").show().delay(1500).fadeOut(500)},e.error=function(t){return e.alertMessage=t,$("span#writeFailure").show().delay(1500).fadeOut(500)},e.success=function(t){return e.successMessage=t,$("span#writeSuccess").show().delay(1500).fadeOut(500)},e.filteredColumns=function(e){return e.columns.filter(function(e){return"time"!==e&&"sequence_number"!==e})},e.columnPoints=function(e,t){var n;return n=e.columns.indexOf(t),e.points.map(function(e){return{time:new Date(e[0]),value:e[n]}})},e.getDatabaseUsers=function(){return n.when(window.influxdb.showUsers()).then(function(t){var n,r;return n=t.results[0],r=n.series[0],e.databaseUsers=r.values?r.values.map(function(e){return{name:e[0],isAdmin:e[1]}}):[]})},e.getRetentionPolicies=function(){return n.when(window.influxdb.showRetentionPolicies(e.selectedDatabase)).then(function(t){var n,r;return n=t.results[0],r=n.series[0],e.retentionPolicies=r.values?r.values.map(function(e){return{name:e[0],duration:e[1],replicaN:e[2]}}):[]})},e.createRetentionPolicy=function(){return n.when(window.influxdb.createRetentionPolicy(e.selectedDatabase,e.newRetentionPolicyName,e.newRetentionPolicyDuration,e.newRetentionPolicyReplication,e.newRetentionPolicyIsDefault)).then(function(){return e.alertSuccess("Successfully created retention policy: "+e.newRetentionPolicyName),e.newRetentionPolicyName=null,e.newRetentionPolicyDuration=null,e.newRetentionPolicyReplication=null,e.newRetentionPolicyIsDefault=!1,e.getRetentionPolicies()},function(t){return e.alertFailure("Failed to create retention policy: "+t.responseText)})},e.getDatabaseUser=function(){return n.when(window.influxdb.getDatabaseUser(e.selectedDatabase,e.selectedDatabaseUser)).then(function(t){return e.databaseUser=t})},e.showSelectedDatabase=function(){return e.selectedPane="databases",e.selectedSubPane="users",e.selectedDatabaseUser=null,e.getDatabaseUsers(),e.getRetentionPolicies()},e.showDatabases=function(){return e.getDatabases(),e.selectedPane="databases",e.selectedSubPane="users",e.selectedDatabase=null,e.selectedDatabaseUser=null},e.showDatabase=function(t){return e.selectedDatabase=t.name,e.selectedDatabaseUser=null,e.getDatabaseUsers()},e.showDatabaseUsers=function(){return e.selectedDatabaseUser=null,e.selectedSubPane="users",e.getDatabaseUsers()},e.getContinuousQueries=function(){return n.when(window.influxdb.showContinuousQueries()).then(function(t){var n,r,i;return n=t.results[0],i=n.series.filter(function(t){return t.name===e.selectedDatabase}),r=i[0],e.continuousQueries=r.values?r.values.map(function(e){return{id:e[0],query:e[1]}}):[]})},e.showContinuousQueries=function(){return e.selectedDatabaseUser=null,e.selectedSubPane="continuousQueries",e.getContinuousQueries()},e.showRetentionPolicies=function(){return e.selectedDatabaseUser=null,e.selectedSubPane="retentionPolicies",e.getRetentionPolicies()},e.showDatabaseUser=function(t){return e.selectedDatabaseUser=t.name,e.getDatabaseUser()},e.changeDbUserPassword=function(){var t;return e.dbUserPassword!==e.dbUserPasswordConfirmation?e.alertFailure("Sorry, the passwords don't match."):null===e.dbUserPassword||""===e.dbUserPassword?e.alertFailure("Sorry, passwords cannot be blank."):(t={password:e.dbUserPassword},n.when(window.influxdb.updateDatabaseUser(e.selectedDatabase,e.selectedDatabaseUser,t)).then(function(){return e.alertSuccess("Successfully changed password for '"+e.selectedDatabaseUser+"'"),e.dbUserPassword=null,e.dbUserPasswordConfirmation=null},function(t){return e.alertFailure("Failed to change password for user: "+t.responseText)}))},e.changeClusterAdminPassword=function(){var t;return e.clusterAdminPassword!==e.clusterAdminPasswordConfirmation?e.alertFailure("Sorry, the passwords don't match."):null===e.clusterAdminPassword||""===e.clusterAdminPassword?e.alertFailure("Sorry, passwords cannot be blank."):(t={password:e.clusterAdminPassword},n.when(window.influxdb.updateClusterAdmin(e.selectedClusterAdmin,t)).then(function(){return e.alertSuccess("Successfully changed password for '"+e.selectedClusterAdmin+"'"),e.clusterAdminPassword=null,e.clusterAdminPasswordConfirmation=null},function(t){return e.alertFailure("Failed to change password for cluster admin: "+t.responseText)}))},e.updateDatabaseUser=function(){var t;return t={admin:e.databaseUser.isAdmin},n.when(window.influxdb.updateDatabaseUser(e.selectedDatabase,e.selectedDatabaseUser,t)).then(function(){return e.alertSuccess("Successfully updated database user '"+e.selectedDatabaseUser+"'"),e.getDatabaseUsers()},function(t){return e.alertFailure("Failed to update database user: "+t.responseText)})},e.deleteDatabaseUser=function(t){return n.when(window.influxdb.deleteDatabaseUser(e.selectedDatabase,t)).then(function(){return e.alertSuccess("Successfully delete user: "+t),e.getDatabaseUsers()},function(t){return e.alertFailure("Failed to delete user: "+t.responseText)})}}]),e.directive("ngConfirmClick",[function(){return{priority:-1,restrict:"A",link:function(e,t,n){return t.bind("click",function(e){var t;return t=n.ngConfirmClick,t&&!confirm(t)?(e.stopImmediatePropagation(),e.preventDefault()):void 0})}}}])}.call(this),function(){$(function(){var e;return e=function(){return parent.document.getElementById("explorer").style.height=window.innerHeight-45+"px"},e(),$(window).on("resize",e),window.getHashParams=function(){return angular.element(document.getElementsByTagName("body")[0]).scope().getHashParams()},window.setHashParams=function(e){return angular.element(document.getElementsByTagName("body")[0]).scope().setHashParams(e)},$(document).foundation()})}.call(this);