text: angular.module("ngTools",[]),angular.module("ngTools").factory("debounce",["$timeout",function(a){function b(b,c,d){c=angular.isUndefined(c)?0:c,d=angular.isUndefined(d)?!0:d;var e=0;return function(){var f=this,g=arguments;e++;var h=function(a){return function(){return a===e?b.apply(f,g):void 0}}(e);return a(h,c,d)}}return b}]),angular.module("ngTools").directive("fallbackSrc",function(){return{link:function(a,b,c){void 0!==c.src||void 0!=c.ngSrc&&null!=c.ngSrc||c.$set("src",c.fallbackSrc),b.on("error",function(){c.src!==c.fallbackSrc&&c.$set("src",c.fallbackSrc)})}}}),angular.module("ngTools").filter("trustHtml",["$sce",function(a){return function(b){return a.trustAsHtml(b)}}]).filter("trustUrl",["$sce",function(a){return function(b){return a.trustAsResourceUrl(b)}}]).filter("localizeNumber",function(){return function(a,b,c){return angular.isFunction(a.toLocaleString)?a.toLocaleString(b,c):a}}),angular.module("ngTools").directive("ntIncludeInScope",["$http","$templateCache","$anchorScroll","$compile","$animate",function(a,b,c,d,e){return{restrict:"ECA",terminal:!0,compile:function(f,g){var h=g.onload||"",i=g.autoscroll;return function(f,j){var k=0,l=function(a){j.html(a),d(j.contents())(f),!angular.isDefined(i)||i&&!f.$eval(i)||c(),f.$emit("$includeContentLoaded"),f.$eval(h)},m=function(){e.leave(j),j.html("")};if(g.includeInScope){var n=f.$eval(g.includeInScope);l(n)}else f.$watch(function(){return f.$eval(g.src)},function(c){var d=++k;c?a.get(c,{cache:b}).success(function(a){d===k&&l(a)}).error(function(){d===k&&m()}):m()})}}}}]),angular.module("ngTools").service("loaderSvc",["$q",function(a){this.deferred=a.defer()}]).directive("loader",["loaderSvc",function(a){return{restrict:"A",link:function(b,c){a.deferred.promise.then(function(){angular.isFunction(a.hideMethod)?a.hideMethod(c):c.fadeOut()})}}}]),angular.module("ngTools").directive("markCurrentLinks",function(){return{priority:50,link:function(a,b){a.$on("$locationChangeSuccess",function(a,c){for(var d=b.find("a"),e=d.length;e--;){var f=angular.element(d[e]),g=c.indexOf(f.attr("href"));-1!==g?f.addClass("current"):f.removeClass("current")}})}}}).directive("markCurrentIfAnyChildIs",["$timeout",function(a){return{link:function(b,c){b.$on("$locationChangeSuccess",function(){a(function(){for(var a=c.find("a"),b=a.length;b--;){var d=angular.element(a[b]);if(d.hasClass("current"))return void c.addClass("current")}c.removeClass("current")})})}}}]),angular.module("ngTools").directive("markdown",function(){var a=new Showdown.converter;return{restrict:"E",require:"?ngModel",link:function(b,c,d,e){var f=d.extensions,g=!1;if(f){var h=[];f.split(",").forEach(function(a){h.push(a.replace(/^\s+|\s+$/g,""))}),h.indexOf("prettify")>=0&&(g=!0),a=new Showdown.converter({extensions:h})}var i=d.strip;i="true"==String(i).toLowerCase();var j=d.lineBreaks;j="true"==String(j).toLowerCase();var k=function(){var b="",f="";d.ngModel?e.$modelValue&&(f=e.$modelValue):f=c.text(),i&&(f=f.replace(/^[ /t]+/g,"").replace(/\n[ /t]+/g,"\n")),j&&(f=f.replace(/&#10;/g,"\n")),b=a.makeHtml(f),c.html(b),g&&prettyPrint()};d.ngModel&&b.$watch(d.ngModel,k),k()}}}),angular.module("ngTools").value("promiseClassStates",["not-initialized","in-progress","resolved","rejected"]).directive("promiseClass",["promiseClassStates",function(a){return{restrict:"A",link:function(b,c,d){var e=function(b){c.removeClass(a[0]),c.addClass(a[1]),b.then(function(){c.removeClass(a[1]),c.addClass(a[2])},function(){c.removeClass(a[1]),c.addClass(a[3])})};b.$watch(function(){return b.$eval(d.promiseClass)},function(b){b&&b.then?e(b):c.addClass(a[0])})}}}]),angular.module("ngTools").factory("Set",function(){function a(a){this.hashFn="string"==typeof a?function(b){if(void 0!==b[a])return b[a];throw new Error("Undefined was returned by hash function on object "+JSON.stringify(b))}:a||JSON.stringify,this.clear()}return a.prototype={add:function(a){var b=!this.has(a);return b&&(this.values[this.hashFn(a)]=a,this.size++),b},fromArray:function(a){for(var b=a.length;b--;)this.add(a[b]);return this.size},clear:function(){this.values={},this.size=0},addReplace:function(a){var b=this.remove(a);return this.add(a),b},getValue:function(a){return this.values[a]},remove:function(a){return this.has(a)?(angular.isObject(a)?delete this.values[this.hashFn(a)]:delete this.values[a],this.size--,!0):!1},has:function(a){return angular.isObject(a)?void 0!==this.values[this.hashFn(a)]:void 0!==this.values[a]},size:function(){return this.size},each:function(a,b){for(var c,d=Object.keys(this.values).reverse();c=d.pop();){var e=b||this.values[c];a.call(e,this.values[c])}},toArray:function(){var a=[];for(var b in this.values)a.push(this.values[b]);return a},filter:function(){var a=this.toArray();return a.filter.apply(a,arguments)}},a}),angular.module("ngTools").factory("StoredSet",["Set","storage","$log",function(a,b,c){function d(d){var e=this;return d.storageKey?(angular.extend(e,d),this.set=new a(e.hashFn),void this.onInit(b.get(e.storageKey))):void c.error("storageKey property must be provided for storedSet")}return d.prototype={add:function(a,b){var c=this.set.add(a);return this.onAdd(a,c),c&&this.save(b),c},addReplace:function(a,b){var c=this.set.addReplace(a);return this.onAdd(a,c),this.save(b),!c},remove:function(a){var b=this.set.remove(a);return b&&(this.save(),this.onRemove(a)),b},each:function(){return this.set.each.apply(this.set,arguments)},toArray:function(){return this.set.toArray()},save:function(a){!a&&b.set(this.storageKey,angular.copy(this.toArray()))},onAdd:function(){},onRemove:function(){},onInit:function(a){a&&Array.isArray(a)&&a.forEach(angular.bind(this,function(a){this.add(a,!0)}))}},d}]),angular.module("ngTools").directive("longTextClass",function(){return{restrict:"A",link:function(a,b,c){a.$watch(function(){return b.text().trim()},function(a){a.length>c.longTextClass?b.addClass("long_text"):b.removeClass("long_text")})}}}).directive("textOverflowClass",function(){function a(a,b){var c=a.style.overflow;c&&"visible"!==c||(a.style.overflow="hidden");var d;return d=b.textOverflowClass?a.clientWidth<a.scrollWidth||a.clientHeight<a.scrollHeight:a.clientWidth<a.scrollWidth,a.style.overflow=c,d}return{restrict:"A",link:function(b,c,d){b.$watch(function(){return c.text()},function(){a(c[0],d)?c.addClass("text_overflow"):c.removeClass("text_overflow")})}}}),angular.module("ngTools").factory("urlize",["$location","$route","$log","$timeout",function(a,b,c,d){function e(c,e,g){if(!b.current)throw new Error("Urlize has to be used on route controller with reloadOnSearch set to false");if(b.current.$$route.reloadOnSearch!==!1)throw new Error("Current route reloads on search, reloadOnSearch should be set to false");c[e]||(c[e]={});var h;h=g?function(){if(f){var b=a.search()[e];b&&(angular.isObject(b)||(b=JSON.parse(b)),c[e]=b)}}:function(){if(f){var b=a.search();angular.extend(c[e],b)}},h(),g?c.$watch(e,function(b){b&&(angular.isObject(b)&&(b=JSON.stringify(b)),f=!1,a.search(e,b),d(function(){f=!0}))},!0):c.$watch(e,function(b){b&&angular.isObject(b)&&(f=!1,a.search(b),d(function(){f=!0}))},!0),c.$on("$routeUpdate",h)}var f=!0;return e}]);