text: angular.module("ngAmbassador.activityFeed",["ngAmbassador.services","ngAmbassador.api"]).directive("gaActivityFeed",["$api","$timeout","$promiseKeeper",function($api,$timeout,$promiseKeeper){"use strict";return{restrict:"E",scope:{endpoint:"@",numberOfItems:"@",columns:"@",feedTitle:"@",companyCurrency:"@",companyPoints:"@",ambassadorTemplate:"=",config:"=",filters:"="},templateUrl:"../ambassador/templates/activity-feed.html",link:function(scope,element,attrs){var itemsPerColumn=Math.ceil(scope.numberOfItems/scope.columns),initialized=!1;scope.$watch("filters",function(newValue,oldValue){newValue===oldValue&&!1!==initialized||(function(){scope.activities=[],scope.feedColumns=[];var requestData=void 0!==scope.filters?angular.copy(scope.filters):{};requestData.page_size=scope.numberOfItems;var loadingPromise=$promiseKeeper.add();$api.use("default").all(scope.endpoint).getList(requestData).then(function(data){loadingPromise.deferred.resolve(),scope.activities=data,1==scope.columns?(function(data){angular.forEach(data,function(activity,index){0===index?activity.orientation="left":activity.type!==data[index-1].type?activity.orientation="left"===data[index-1].orientation?"right":"left":activity.orientation=data[index-1].orientation})}(scope.activities),scope.feedColumns[0]=scope.activities):(itemsPerColumn=Math.ceil(data.length/scope.columns),function(data){for(var i=0;i<scope.columns;i++)scope.feedColumns.push([]),angular.forEach(data,function(activity,index){itemsPerColumn*i<=index&&index<itemsPerColumn*(i+1)&&(activity.orientation="right",scope.feedColumns[i].push(activity))})}(scope.activities))})}(),initialized=!0)},!0),scope.activityTime=function(timeUnit){var now=moment.utc(),activityTime=moment.utc(timeUnit),readableDiff=0,timeUnit="seconds",timeUnit=1<=now.diff(activityTime,"years")?1===(readableDiff=now.diff(activityTime,"years"))?"year":"years":1<=now.diff(activityTime,"months")?1===(readableDiff=now.diff(activityTime,"months"))?"month":"months":1<=now.diff(activityTime,"days")?1===(readableDiff=now.diff(activityTime,"days"))?"day":"days":1<=now.diff(activityTime,"hours")?1===(readableDiff=now.diff(activityTime,"hours"))?"hour":"hours":1<=now.diff(activityTime,"minutes")?1===(readableDiff=now.diff(activityTime,"minutes"))?"minute":"minutes":1===(readableDiff=now.diff(activityTime,"seconds"))?"second":"seconds";return"<var>"+readableDiff+"</var> "+timeUnit+" ago"}}}}]).directive("gaProgressFeed",[function(){"use strict";return{restrict:"E",scope:{steps:"="},templateUrl:"../ambassador/templates/progress-feed.html"}}]);