/*! grafana - v3.1.0 - 2016-07-18
 * Copyright (c) 2016 Torkel Ödegaard; Licensed Apache-2.0 */

System.register(["angular","../core_module"],function(a){var b,c,d;return{setters:[function(a){b=a},function(a){c=a}],execute:function(){d=function(){function a(a,b,c){this.$compile=a,this.$parse=b,this.$rootScope=c}return a.$inject=["$compile","$parse","$rootScope"],a.prototype.addDirective=function(a,c,d){var e=b["default"].element(document.createElement(c));this.$compile(e)(d),a.empty(),a.append(e)},a.prototype.link=function(a,b,d,e){var f=this;e.directive(a).then(function(e){return e&&e.fn?(e.fn.registered||(c["default"].directive(d.$normalize(e.name),e.fn),e.fn.registered=!0),void f.addDirective(b,e.name,a)):void b.empty()})["catch"](function(a){console.log("Plugin load:",a),f.$rootScope.appEvent("alert-error",["Plugin error",a.toString()])})},a.prototype.create=function(a){var b=this,c={restrict:"E",scope:a.scope,link:function(c,d,e){if(a.watchPath){var f=null;c.$watch(a.watchPath,function(){f&&f.$destroy(),f=c.$new(),b.link(f,d,e,a)})}else b.link(c,d,e,a)}};return c},a}(),c["default"].service("dynamicDirectiveSrv",d)}}});