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

System.register(["lodash","jquery","app/core/core_module","../alerting/alert_def"],function(a,b){"use strict";function c(a,b,c){function f(b){try{return a(b)}catch(a){return console.log("Could not sanitize annotation string, html escaping instead"),d.default.escape(b)}}return{restrict:"E",scope:{event:"="},link:function(a,h){var i=a.event,j=i.title,k=i.text,l=b.getCurrent(),m='<div class="graph-annotation">',n="";if("panel-alert"===i.source.name){var o=g.default.getStateDisplayModel(i.newState);n=o.stateClass,j='<i class="icon-gf '+o.iconClass+'"></i> '+o.text,k=g.default.getAlertAnnotationInfo(i)}m+='\n        <div class="graph-annotation-header">\n          <span class="graph-annotation-title '+n+'">'+f(j)+'</span>\n          <span class="graph-annotation-time">'+l.formatDate(i.min)+"</span>\n        </div>\n      ",m+='<div class="graph-annotation-body">',k&&(m+=f(k).replace(/\n/g,"<br>")+"<br>");var p=i.tags;d.default.isString(i.tags)&&(p=i.tags.split(","),1===p.length&&(p=i.tags.split(" "))),p&&p.length&&(a.tags=p,m+='<span class="label label-tag small" ng-repeat="tag in tags" tag-color-from-name="tag">{{tag}}</span><br/>'),m+="</div>";var q=e.default(m);q.appendTo(h),c(h.contents())(a)}}}c.$inject=["$sanitize","dashboardSrv","$compile"];b&&b.id;a("annotationTooltipDirective",c);var d,e,f,g;return{setters:[function(a){d=a},function(a){e=a},function(a){f=a},function(a){g=a}],execute:function(){f.default.directive("annotationTooltip",c)}}});