/*! grafana - v4.5.1 - 2017-09-19
 * Copyright (c) 2017 Torkel Ödegaard; Licensed Apache-2.0 */

System.register(["lodash","app/core/components/query_part/query_part"],function(a,b){"use strict";function c(a){var b=new h.QueryPartDef({type:a.type,defaultParams:[]});return new h.QueryPart(a,b)}function d(a){switch(a){case"ok":return{text:"OK",iconClass:"icon-gf icon-gf-online",stateClass:"alert-state-ok"};case"alerting":return{text:"ALERTING",iconClass:"icon-gf icon-gf-critical",stateClass:"alert-state-critical"};case"no_data":return{text:"NO DATA",iconClass:"fa fa-question",stateClass:"alert-state-warning"};case"paused":return{text:"PAUSED",iconClass:"fa fa-pause",stateClass:"alert-state-paused"};case"pending":return{text:"PENDING",iconClass:"fa fa-exclamation",stateClass:"alert-state-warning"}}}function e(a,b){return g.default.reduce(a,function(a,b){return void 0!==b.metric&&void 0!==b.value&&a.push(b.metric+"="+b.value),void 0!==b.Metric&&void 0!==b.Value&&a.push(b.Metric+"="+b.Value),a},[]).join(b)}function f(a){return g.default.isArray(a.data)?e(a.data,", "):g.default.isArray(a.data.evalMatches)?e(a.data.evalMatches,", "):a.data.error?"Error: "+a.data.error:a.data.noData||a.data.no_data?"No Data":""}var g,h,i,j,k,l,m,n,o,p;b&&b.id;return{setters:[function(a){g=a},function(a){h=a}],execute:function(){i=new h.QueryPartDef({type:"query",params:[{name:"queryRefId",type:"string",dynamicLookup:!0},{name:"from",type:"string",options:["1s","10s","1m","5m","10m","15m","1h","24h","48h"]},{name:"to",type:"string",options:["now"]}],defaultParams:["#A","15m","now","avg"]}),j=[{text:"Query",value:"query"}],k={alerting:1,no_data:2,pending:3,ok:4,paused:5},l=[{text:"IS ABOVE",value:"gt"},{text:"IS BELOW",value:"lt"},{text:"IS OUTSIDE RANGE",value:"outside_range"},{text:"IS WITHIN RANGE",value:"within_range"},{text:"HAS NO VALUE",value:"no_value"}],m=[{text:"OR",value:"or"},{text:"AND",value:"and"}],n=[{text:"avg()",value:"avg"},{text:"min()",value:"min"},{text:"max()",value:"max"},{text:"sum()",value:"sum"},{text:"count()",value:"count"},{text:"last()",value:"last"},{text:"median()",value:"median"}],o=[{text:"Alerting",value:"alerting"},{text:"No Data",value:"no_data"},{text:"Keep Last State",value:"keep_state"},{text:"Ok",value:"ok"}],p=[{text:"Alerting",value:"alerting"},{text:"Keep Last State",value:"keep_state"}],a("default",{alertQueryDef:i,getStateDisplayModel:d,conditionTypes:j,evalFunctions:l,evalOperators:m,noDataModes:o,executionErrorModes:p,reducerTypes:n,createReducerPart:c,getAlertAnnotationInfo:f,alertStateSortScore:k})}}});