text: /*! neosavvy-javascript-angular-core - v0.2.4 - 2014-09-10
  * Copyright (c) 2014 Neosavvy, Inc.; Licensed  */
  var Neosavvy=Neosavvy||{};Neosavvy.AngularCore=Neosavvy.AngularCore||{},Neosavvy.AngularCore.Directives=angular.module("neosavvy.angularcore.directives",[]),Neosavvy.AngularCore.Filters=angular.module("neosavvy.angularcore.filters",[]),Neosavvy.AngularCore.Services=angular.module("neosavvy.angularcore.services",[]),Neosavvy.AngularCore.Dependencies=["neosavvy.angularcore.directives","neosavvy.angularcore.filters","neosavvy.angularcore.services"],Neosavvy.AngularCore.Directives.directive("nsInlineHtml",["$compile",function(a){return{restrict:"E",template:"<div></div>",replace:!0,scope:!1,link:function(b,c,d){if(!d.hasOwnProperty("value"))throw"You must provide an html value on the scope in order to bind inline html!";var e=d.$observe("value",function(d){d&&(a(c.replaceWith(d))(b),e())})}}}]),Neosavvy.AngularCore.Directives.controller("nsModalCtrl",["$scope",function(){this.positionTooltip=function(a,b){if(a)var c=-.75*a.currentTarget.clientWidth,d=.65*a.currentTarget.clientHeight,e=$(a.target).offset(),f=c+e.left,g=d+e.top;return b.css("position","absolute"),b.css("top",g),b.css("left",f),b}}]),Neosavvy.AngularCore.Directives.directive("nsModal",["nsModal",function(a){return{restrict:"EA",transclude:"element",replace:!0,scope:!1,controller:"nsModalCtrl",compile:function(b,c,d){return function(b,c,e,f){var g=b.$new(),h=!!e.tooltip;if("string"!=typeof e.open)throw"an open handler was not specified";b.$on("$routeChangeStart",function(){a.close()});var i=b[e.callback]||angular.noop;b[e.open]=function(b){d(g,function(c){var d=h?f.positionTooltip(b,c):c;a.open(g,d,i)})},b[e.close]=function(){a.close()}}}}}]),Neosavvy.AngularCore.Directives.directive("nsStaticInclude",["$http","$templateCache","$compile",function(a,b,c){return{restrict:"E",template:"<div></div>",replace:!0,scope:!1,compile:function(d,e){if(_.isEmpty(e.src))throw"You must pass in a source to render a Neosavvy static include directive.";var f=e.waitFor,g=e.watchWaitFor,h=e.waitForRender,i=e.watchWaitForRender;return _.isEmpty(f)&&_.isEmpty(g)&&(a.get(e.src,{cache:b}),_.isEmpty(i)?_.isEmpty(h)||(f=h):g=i),function(d,e,h){var i,j=function(a){e.replaceWith(c(angular.element(a.data))(d))},k=function(){a.get(h.src,{cache:b}).then(j),i&&i()};_.isEmpty(g)?!_.isEmpty(f)&&parseFloat(f)>0?setTimeout(k,parseFloat(f)):k():i=d.$watch(g,function(a){angular.isDefined(a)&&k()})}}}}]),Neosavvy.AngularCore.Directives.directive("nsAnalyticsHook",function(){return{restrict:"A",priority:1e3,link:function(a,b,c){if(Neosavvy.Core.Utils.StringUtils.isBlank(c.nsAnalyticsHook))throw"You must provide a name for your analytics hook.";var d=c.nsAnalyticsHook.split(","),e=d[0].trim(),f="click";d.length>1&&(f=d[1].trim());var g=[];if(d.length>2)for(var h=2;h<d.length;h++)g.push(d[h].trim());a[e]=a[e]||new Function,b.bind(f,function(){a.$apply(function(){a[e].apply(this,_.map(g,function(b){return Neosavvy.Core.Utils.MapUtils.highPerformanceGet(a,b)}))})})}}}),Neosavvy.AngularCore.Directives.directive("nsRetrieveElement",function(){return{restrict:"A",scope:!1,link:function(a,b,c){var d=c.nsRetrieveElement;if(Neosavvy.Core.Utils.StringUtils.isBlank(c.nsRetrieveElement))throw"You must specify a property or function to retrive and element with ns-retrieve-element!";d=d.replace(/\(.*\)|\(\)/g,"");var e=Neosavvy.Core.Utils.MapUtils.highPerformanceGet(a,d);"function"==typeof e?e(b):Neosavvy.Core.Utils.MapUtils.applyTo(a,d,b)}}}),Neosavvy.AngularCore.Directives.directive("nsSerialize",["$injector",function(a){return{restrict:"EA",scope:!1,link:function(b,c,d){if(void 0===d.data)throw"You must provide a data attribute for the nsSerialize directive!";if(void 0===d.property)throw"nsSerialize requires a property to place the data into!";var e=JSON.parse(d.data),f=d.inject?a.get(d.inject):b,g=Neosavvy.Core.Utils.MapUtils.highPerformanceGet(f,d.property.replace(/\(.*\)/g,""));"function"==typeof g?g.call(g,e):Neosavvy.Core.Utils.MapUtils.applyTo(f,d.property,e),"false"!==d.clean&&"0"!==d.clean&&c.removeAttr("data")}}}]),Neosavvy.AngularCore.Directives.directive("nsEvent",["$rootScope",function(){return{restrict:"A",scope:!1,link:function(a,b,c){function d(a){return a.match(/.*?(?=\(|$)/i)[0]}function e(a,b){if(_.isUndefined(a[d(b)])){if(a.$parent)return e(a.$parent,b);throw"Your handler method has not been found in the scope chain, please add "+b+" to the scope chain!"}return a}function f(b){var c=e(a,g[1]);c.$event=b,c.$apply(function(){c[g[1]]()})}var g=c.nsEvent.replace(/ /g,"").split(","),h=_.isUndefined(c.nsEventHighPriority)?!1:!0;if(g.length<2)throw"Specify an event and handler in order to use the ns-event directive!";if(2===g.length)h?b.bindFirst(g[0],f):b.bind(g[0],f);else for(var i=2;i<g.length;i++){var j=$(b).find(g[i]);h?j.bindFirst(g[0],f):j.bind(g[0],f)}}}}]),Neosavvy.AngularCore.Directives.directive("nsModelOnBlur",function(){return{restrict:"A",require:"ngModel",link:function(a,b,c,d){"radio"!==c.type&&"checkbox"!==c.type&&(b.unbind("input").unbind("keydown").unbind("change"),b.bind("blur",function(){a.$apply(function(){d.$setViewValue(b.val())})}))}}}),Neosavvy.AngularCore.Directives.directive("nsRequiredIfShown",function(){return{require:"ngModel",link:function(a,b,c,d){d.$parsers.unshift(function(a){var c=!b.is(":visible")||!Neosavvy.Core.Utils.StringUtils.isBlank(a);return d.$setValidity("nsRequiredIfShown",c),c?a:void 0})}}}),Neosavvy.AngularCore.Directives.directive("nsZurbCheckbox",function(){return{restrict:"E",replace:!0,template:'<label for="{{id}}-checkbox" ng-click="_onClick()"><input type="checkbox" id="{{id}}-checkbox" style="display: none;"><span class="custom checkbox"></span><span ng-bind="label"></span></label>',scope:{label:"@",onClick:"&",value:"=ngModel"},link:function(a,b,c){var d=!1,e=b.find("span.checkbox");a.id=c.id||uuid.v1(),a.$watch("value",function(a){d||(a?e.hasClass("checked")||e.addClass("checked"):e.removeClass("checked")),d=!1}),a._onClick=function(){d=!0,a.value=!e.hasClass("checked"),a.onClick&&a.onClick({value:a.value})}}}}),Neosavvy.AngularCore.Filters.filter("nsCollectionFilterProperties",function(){return function(a,b,c){return a&&c?a.filter(function(a){return-1!==c.indexOf(Neosavvy.Core.Utils.MapUtils.get(a,b))}):a}}),Neosavvy.AngularCore.Filters.filter("nsCollectionFilterPropertyContains",function(){return function(a,b,c){return a&&c?a.filter(function(a){return-1!==String(Neosavvy.Core.Utils.MapUtils.get(a,b)).toLowerCase().indexOf(String(c).toLowerCase())}):a}}),Neosavvy.AngularCore.Filters.filter("nsCollectionFilterProperty",function(){return function(a,b,c){return a&&c?a.filter(function(a){return Neosavvy.Core.Utils.MapUtils.get(a,b)===c}):a}}),Neosavvy.AngularCore.Filters.filter("nsCollectionKeyedNumericExpression",["$parse",function(a){return function(b,c,d){return b&&b.length?c&&_.keys(c).length?b.filter(function(b){for(var e in c)if(!Neosavvy.Core.Utils.StringUtils.isBlank(c[e])){var f=c[e];if(/</.test(f)||/>/.test(f)||(f=f.replace(/=/g,"==")),f&&/\d/.test(f)&&!a(String(Neosavvy.Core.Utils.MapUtils.highPerformanceGet(b,d||e))+f)())return!1}return!0}):b:[]}}]),Neosavvy.AngularCore.Filters.filter("nsCollectionNumericExpression",["$parse",function(a){return function(b,c,d){return b&&b.length?c&&c.length?b.filter(function(b){for(var e=0;e<c.length;e++){var f=c[e],g=f.expression;/</.test(g)||/>/.test(g)||(g=g.replace(/=/g,"=="));var h=d?b[parseInt(f.index)][d]:b[parseInt(f.index)];if(g&&/\d/.test(g)&&!a(String(h)+g)())return!1}return!0}):b:[]}}]),Neosavvy.AngularCore.Filters.filter("nsCollectionPage",function(){return function(a,b,c){if(a&&a.length){if(void 0!==b&&c){var d=b*c;return a.slice(d,Math.min(d+c,a.length))}}else a=[];return a}}),Neosavvy.AngularCore.Filters.filter("nsDateFormatToUnix",function(){return function(a,b){if(Neosavvy.Core.Utils.StringUtils.isBlank(a))return a;if(a=moment(a,b||void 0),!Neosavvy.Core.Utils.StringUtils.isBlank(a)&&a.isValid())return a.unix();throw"You have passed invalid input to nsDateFormatToUnix filter"}}),Neosavvy.AngularCore.Filters.filter("nsDateUnixToFormat",function(){return function(a,b){if(!Neosavvy.Core.Utils.StringUtils.isBlank(a)){b=b||"MMMM Do, YYYY";var c=moment.unix(a);if(c.isValid())return c.utc().format(b);throw"You have passed an invalid epoch time to the date filter."}return a}}),Neosavvy.AngularCore.Filters.filter("nsLogicalIf",function(){return function(a,b,c){return a?b:c}}),Neosavvy.AngularCore.Filters.filter("nsNumericClamp",function(){return function(a,b,c){if(_.isNumber(a)){if(b=b||0===b?parseFloat(b):void 0,c=c||0===c?parseFloat(c):void 0,a=parseFloat(a),_.isNumber(c)&&_.isNumber(b)&&b>c)throw"You have created an impossible clamp with this filter.";(b||0===b)&&(a=Math.max(b,a)),(c||0===c)&&(a=Math.min(c,a))}return a}}),Neosavvy.AngularCore.Filters.filter("nsTextMarkdown",["$sce",function(a){return function(b){if(0==/<[a-z][\s\S]*>/i.test(b))var c=new Showdown.converter,d=c.makeHtml(b||"");else var d=b;return a.trustAsHtml(d)}}]),Neosavvy.AngularCore.Filters.filter("nsTextReplace",function(){return function(a){if(!_.isEmpty(a)&&arguments.length>1)for(var b=1;b<arguments.length;b++)a=a.replace(new RegExp(arguments[b],"g"),"");return a}}),Neosavvy.AngularCore.Filters.filter("nsTruncate",function(){return function(a,b){return!_.isEmpty(a)&&b<a.length&&(a=a.slice(0,b)+"..."),a}}),function(a){function b(b){return h?b.data("events"):a._data(b[0]).events}function c(a,c,d){var e=b(a),f=e[c];if(!h){var g=d?f.splice(f.delegateCount-1,1)[0]:f.pop();return f.splice(d?0:f.delegateCount||0,0,g),void 0}d?e.live.unshift(e.live.pop()):f.unshift(f.pop())}function d(b,d,e){var f=d.split(/\s+/);b.each(function(){for(var b=0;b<f.length;++b){var d=a.trim(f[b]).match(/[^\.]+/i)[0];c(a(this),d,e)}})}var e=a.fn.jquery.split("."),f=parseInt(e[0]),g=parseInt(e[1]),h=1>f||1==f&&7>g;a.fn.bindFirst=function(){var b=a.makeArray(arguments),c=b.shift();return c&&(a.fn.bind.apply(this,arguments),d(this,c)),this},a.fn.delegateFirst=function(){var b=a.makeArray(arguments),c=b[1];return c&&(b.splice(0,2),a.fn.delegate.apply(this,arguments),d(this,c,!0)),this},a.fn.liveFirst=function(){var b=a.makeArray(arguments);return b.unshift(this.selector),a.fn.delegateFirst.apply(a(document),b),this},h||(a.fn.onFirst=function(b,c){var e=a(this),f="string"==typeof c;if(a.fn.on.apply(e,arguments),"object"==typeof b)for(var g in b)b.hasOwnProperty(g)&&d(e,g,f);else"string"==typeof b&&d(e,b,f);return e})}(jQuery),Neosavvy.AngularCore.Services.factory("nsLoadingStatusService",function(){var a={},b=function(b,c){if(!c)throw"a valid identifier was not provided, did you forget to include one?";return _.partial(function(b){return a[c]=!0,b.apply(null,_.rest(arguments))["finally"](function(){a[c]=!1})},b)};return{wrapService:b,registeredIndicators:a}}),Neosavvy.AngularCore.Services.factory("nsModal",["$compile","$document","$animate","$timeout",function(a,b,c,d){function e(b,c,e){var k;if(!b||"object"!=typeof b)throw"missing scope parameter";if(!c)throw"missing template parameter";if(i=e||void 0,g=a(angular.element('<div ng-click="close()" class="modal-backdrop" style="background:rgba(10,10,10, 0.6); position:fixed; top:0px;right:0px;left:0px;bottom:0px;"></div>'))(b),k=angular.element('<div class="modal-position"></div>'),"object"==typeof c)k.append(c);else{if("string"!=typeof c)throw"template parameter must be of type object or string";var l=a(angular.element("<ng-include src=\"'"+c+"' \"></ng-include>"))(b);k.append(l)}h=a(angular.element('<div class="modal-overlay" ng-class="modalOverlayClass"></div>'))(b),h.append(k),b.close=f,d(function(){b.$apply(function(){j.append(g),j.append(h)})},0)}function f(){h&&(c.leave(h,function(){g.remove()}),"function"==typeof i&&i())}var g,h,i,j=b.find("body");return{open:e,close:f}}]),Neosavvy.AngularCore.Services.factory("nsServiceExtensions",["$q","$http",function(a,b){function c(a){var b,c,d,e={};return a?(_.forEach(a.split("\n"),function(a){d=a.indexOf(":"),b=_.lowercase(_.trim(a.substr(0,d))),c=_.trim(a.substr(d+1)),b&&(e[b]?e[b]+=", "+c:e[b]=c)}),e):e}function d(a){if(a.cache&&"GET"===a.method){var b=a.cache.get(a.url);if(b&&b.length)return b}return void 0}function e(a,b,c,d){a.cache&&"GET"===a.method&&a.cache.put(a.url,[b,c,d])}return{request:function(c,d,e){if(!c.method)throw"You must provide a method for each service request.";if(!c.url)throw"You must provide a url for each service request.";var f=a.defer();return b(c).success(function(a){f.resolve(a),d&&d(a)}).error(function(a){f.reject(a),e&&e(a)}),f.promise},xhr:function(b){if(!b.method)throw"You must provide a method for each service request.";if(!b.url)throw"You must provide a url for each service request.";var f=b.$q?a.defer():Q.defer(),g=d(b);if(g)f.resolve(g[1]);else{var h=new XMLHttpRequest;h.onreadystatechange=function(){if(4===h.readyState){var a=h.responseText;200===h.status?(e(b,h.status,a,c(h.getAllResponseHeaders())),b.transformResponse?a=b.transformResponse(a):"application/json"===h.getResponseHeader("Content-Type")&&(a=JSON.parse(a)),f.resolve(a,h.status,h.getAllResponseHeaders())):f.reject(a,h.status,h.getAllResponseHeaders())}},h.onerror=function(){f.reject(h,h.status,h.getAllResponseHeaders())};var i=b.data;i&&(b.transformRequest?i=b.transformRequest(i):_.isString(i)||(i=JSON.stringify(i))),h.withCredentials=b.cors||!1,h.open(b.method,b.url,!0),h.send(i)}return f.promise},jqRequest:function(b){if(!b.method)throw"You must provide a method for each service request.";if(!b.url)throw"You must provide a url for each service request.";var c=b.q?Q.defer():a.defer(),f=d(b);if(f)if(b.transformResponse)c.resolve(b.transformResponse(f[1]));else try{c.resolve(JSON.parse(f[1]))}catch(g){c.resolve(f[1])}else{var h={type:b.method,url:b.url};b.data&&(h.data=b.transformRequest?b.transformRequest(b.data):b.data),b.ajax&&(h=_.merge(h,b.ajax));var i=$.ajax(h);i.done(function(a,d){e(b,d,i.responseText,i.getAllResponseHeaders()||{}),b.transformResponse&&(a=b.transformResponse(i.responseText||JSON.stringify(i.responseJSON))),c.resolve(a)}).fail(function(a){c.reject(a)})}return c.promise}}}]);