!function(){"use strict";angular.module("angular",["ngAnimate","ngCookies","ngStorage","ngTouch","ngSanitize","ngMessages","ngAria","restangular","ui.router","ui.bootstrap","toastr","angularMoment","angular.filter","akoenig.deckgrid"])}(),function(){"use strict";function e(){function e(e,o){var i=this;i.profile=i.owner,i.documents=[],i.openDocument=function(e){o.go("main.profile.page",{page:e.path,profile:e.profile.identifier})},e.profiles.one(i.profile.id).one("articles").get({content_type:"TinyMceArticle"}).then(function(e){i.documents=e.articles})}e.$inject=["noosfero","$state"];var o={restrict:"E",templateUrl:"app/components/noosfero-blocks/recent-documents/recent-documents.html",scope:{block:"=",owner:"="},controller:e,controllerAs:"vm",bindToController:!0};return o}angular.module("angular").directive("noosferoRecentDocumentsBlock",e)}(),function(){"use strict";function e(){function e(){var e=this;e.profile=e.owner}var o={restrict:"E",templateUrl:"app/components/noosfero-blocks/profile-image/profile-image.html",scope:{block:"=",owner:"="},controller:e,controllerAs:"vm",bindToController:!0};return o}angular.module("angular").directive("noosferoProfileImageBlock",e)}(),function(){"use strict";function e(){function e(e){var o=this;o.members=[],e.members(e.profiles.one(o.owner.id)).one().get({per_page:6}).then(function(e){o.members=e.people})}e.$inject=["noosfero"];var o={restrict:"E",templateUrl:"app/components/noosfero-blocks/members-block/members-block.html",scope:{block:"=",owner:"="},controller:e,controllerAs:"vm",bindToController:!0};return o}angular.module("angular").directive("noosferoMembersBlock",e)}(),function(){"use strict";function e(){function e(){}var o={restrict:"E",templateUrl:"app/components/noosfero-blocks/main-block/main-block.html",scope:{block:"=",owner:"="},controller:e,controllerAs:"vm",bindToController:!0};return o}angular.module("angular").directive("noosferoMainBlock",e)}(),function(){"use strict";function e(){function e(){var e=this;e.links=e.block.settings.links}var o={restrict:"E",templateUrl:"app/components/noosfero-blocks/link-list/link-list.html",scope:{block:"=",owner:"="},controller:e,controllerAs:"vm",bindToController:!0};return o}angular.module("angular").directive("noosferoLinkListBlock",e)}(),function(){"use strict";function e(){function e(){}var o={restrict:"E",templateUrl:"app/components/noosfero-articles/blog/blog.html",scope:{article:"=",profile:"="},controller:e,controllerAs:"vm",bindToController:!0};return o}angular.module("angular").directive("noosferoBlog",e)}(),function(){"use strict";function e(e,o){function i(){}var n={restrict:"E",templateUrl:"app/components/noosfero-articles/article/article.html",scope:{article:"=",profile:"="},controller:i,controllerAs:"vm",bindToController:!0,link:function(i,n){var t="noosfero"+i.vm.article.type;if(e.has(t+"Directive")){var r=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();n.replaceWith(o("<"+r+' article="vm.article" profile="vm.profile">'+r+">")(i))}}};return n}e.$inject=["$injector","$compile"],angular.module("angular").directive("noosferoArticle",e)}(),function(){"use strict";function e(){function e(){var e=this;e.getActivityTemplate=function(e){return"app/components/noosfero-activities/activity/"+e.verb+".html"}}var o={restrict:"E",scope:{activity:"="},templateUrl:"app/components/noosfero-activities/activity/activity.html",replace:!0,controller:e,controllerAs:"vm",bindToController:!0};return o}angular.module("angular").directive("noosferoActivity",e)}(),function(){"use strict";function e(){function e(){var e=this;e.defaultIcon="fa-users",e.profile&&"Person"===e.profile.type&&(e.defaultIcon="fa-user")}var o={restrict:"E",templateUrl:"app/components/noosfero/profile-image/profile-image.html",scope:{profile:"="},controller:e,controllerAs:"vm",bindToController:!0};return o}angular.module("angular").directive("noosferoProfileImage",e)}(),function(){"use strict";function e(){function e(){var e=this;e.boxesOrder=function(e){return 2==e.position?0:e.position}}var o={restrict:"E",scope:{boxes:"=",owner:"="},templateUrl:"app/components/noosfero-boxes/boxes.html",controller:e,controllerAs:"vm",bindToController:!0};return o}angular.module("angular").directive("noosferoBoxes",e)}(),function(){"use strict";function e(e){var o={restrict:"E",scope:{block:"=",owner:"="},link:function(o,i){var n=o.block.type.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();i.replaceWith(e("")(o))}};return o}e.$inject=["$compile"],angular.module("angular").directive("noosferoBlock",e)}(),function(){"use strict";function e(){var e={restrict:"E",scope:{activities:"="},templateUrl:"app/components/noosfero-activities/activities.html"};return e}angular.module("angular").directive("noosferoActivities",e)}(),function(){"use strict";angular.module("angular").factory("noosfero",["Restangular",function(e){return{profiles:e.service("profiles"),profile:function(o){return e.one("profiles",o)},members:function(o){return e.service("members",o)},boxes:function(o){return e.service("boxes",e.one("profiles",o))}}}])}(),function(){"use strict";angular.module("angular").filter("noosferoTemplateFilter",function(){return function(e,o){for(var i in o)e=e.replace("{"+i+"}",o[i]);return e}})}(),function(){"use strict";function e(){function e(e,o,i,n,t,r,a){var l=this;l.currentUser=n.getCurrentUser(),l.modalInstance=null,l.openLogin=function(){l.modalInstance=o.open({templateUrl:"app/components/auth/login.html",controller:"AuthController",controllerAs:"vm",bindToController:!0})},l.logout=function(){i.logout(),r.go(r.current,{},{reload:!0})},t.$on(a.loginSuccess,function(){l.modalInstance&&(l.modalInstance.close(),l.modalInstance=null),r.go(r.current,{},{reload:!0})}),t.$on(a.logoutSuccess,function(){l.currentUser=n.getCurrentUser()}),l.activate=function(){l.currentUser||l.openLogin()},l.activate()}e.$inject=["moment","$modal","AuthService","Session","$scope","$state","AUTH_EVENTS"];var o={restrict:"E",templateUrl:"app/components/navbar/navbar.html",scope:{},controller:e,controllerAs:"vm",bindToController:!0};return o}angular.module("angular").directive("acmeNavbar",e)}(),function(){"use strict";function e(e,o,i,n,t,r){function a(e){var i="/api/v1/login",n="login="+e.username+"&password="+e.password;return o.post(i,n).then(s,c)}function l(){var e="/api/v1/login_from_cookie";return o.post(e).then(s,c)}function s(e){t.debug("AuthService.login [SUCCESS] response",e);var o=n.create(e.data);return i.currentUser=o,i.$broadcast(r.loginSuccess,o),o}function c(e){return t.debug("AuthService.login [FAIL] response",e),i.$broadcast(r.loginFailed),null}function p(){n.destroy(),i.currentUser=void 0,i.$broadcast(r.logoutSuccess),o.jsonp("/account/logout")}function u(){return!!n.userId}function m(e){return angular.isArray(e)||(e=[e]),f.isAuthenticated()&&-1!==e.indexOf(n.userRole)}var f={login:a,loginFromCookie:l,logout:p,isAuthenticated:u,isAuthorized:m};return f}function o(e,o){var i={};return i.create=function(i){return e.currentUser=i.user,o.debug("User session created.",e.currentUser),e.currentUser},i.destroy=function(){delete e.currentUser,o.debug("User session destroyed.")},i.getCurrentUser=function(){return e.currentUser},i}e.$inject=["$q","$http","$rootScope","Session","$log","AUTH_EVENTS"],o.$inject=["$localStorage","$log"],angular.module("angular").factory("Session",o).factory("AuthService",e)}(),function(){"use strict";function e(e,o,i,n){var t=this;t.credentials={},t.login=function(){n.login(t.credentials)}}e.$inject=["noosfero","$log","$stateParams","AuthService"],angular.module("angular").controller("AuthController",e)}(),function(){"use strict";function e(e,o,i,n){function t(){r.profile=n.vm.owner,e.profiles.one(r.profile.id).one("activities").get().then(function(e){r.activities=e.activities})}var r=this;r.profile=null,r.activities=[],t()}e.$inject=["noosfero","$log","$stateParams","$scope"],angular.module("angular").controller("ProfileInfoController",e)}(),function(){"use strict";function e(e,o,i){function n(){e.profiles.one().get({identifier:i.profile}).then(function(o){return t.profile=o[0],e.boxes(t.profile.id).one().get()}).then(function(e){t.boxes=e.boxes})}var t=this;t.boxes=[],n()}e.$inject=["noosfero","$log","$stateParams"],angular.module("angular").controller("ProfileController",e)}(),function(){"use strict";function e(e,o,i,n,t){function r(){a.profile=n.vm.owner,e.profile(a.profile.id).customGET("home_page",{fields:"path"}).then(function(e){e.article?t.transitionTo("main.profile.page",{page:e.article.path,profile:a.profile.identifier},{location:!1}):t.transitionTo("main.profile.info",{profile:a.profile.identifier},{location:!1})})}var a=this;r()}e.$inject=["noosfero","$log","$stateParams","$scope","$state"],angular.module("angular").controller("ProfileHomeController",e)}(),function(){"use strict";function e(){}angular.module("angular").controller("MainController",e)}(),function(){"use strict";function e(e,o,i,n){function t(){r.profile=n.vm.owner,e.profiles.one(r.profile.id).one("articles").get({path:i.page}).then(function(e){r.article=e.article})}var r=this;r.article=null,r.profile=null,t()}e.$inject=["noosfero","$log","$stateParams","$scope"],angular.module("angular").controller("ContentViewerController",e)}(),function(){"use strict";function e(e,o,i){o.addFullRequestInterceptor(function(e,o,n,t,r){return i.getCurrentUser()&&(r["Private-Token"]=i.getCurrentUser().private_token),{headers:r}})}e.$inject=["$log","Restangular","Session"],angular.module("angular").run(e)}(),function(){"use strict";function e(e,o){e.state("main",{url:"",templateUrl:"app/main/main.html",controller:"MainController",controllerAs:"vm",resolve:{currentUser:["AuthService",function(e){return e.loginFromCookie()}]}}).state("main.profile",{url:"/:profile",templateUrl:"app/profile/profile.html",controller:"ProfileController",controllerAs:"vm","abstract":!0}).state("main.profile.home",{url:"",controller:"ProfileHomeController",controllerAs:"vm"}).state("main.profile.info",{url:"^/profile/:profile",templateUrl:"app/profile-info/profile-info.html",controller:"ProfileInfoController",controllerAs:"vm"}).state("main.profile.page",{url:"/{page:any}",templateUrl:"app/content-viewer/page.html",controller:"ContentViewerController",controllerAs:"vm"}).state("main.profile.settings",{url:"^/myprofile/:profile"}),o.otherwise("/")}e.$inject=["$stateProvider","$urlRouterProvider"],angular.module("angular").config(e)}(),function(){"use strict";angular.module("angular").constant("moment",moment).constant("AUTH_EVENTS",{loginSuccess:"auth-login-success",loginFailed:"auth-login-failed",logoutSuccess:"auth-logout-success"})}(),function(){"use strict";function e(e,o,i,n){e.debugEnabled(!0),o.html5Mode({enabled:!0}),i.setBaseUrl("/api/v1"),n.defaults.headers.post={"Content-Type":"application/x-www-form-urlencoded; charset=utf-8"}}e.$inject=["$logProvider","$locationProvider","RestangularProvider","$httpProvider"],angular.module("angular").config(e)}(),angular.module("angular").run(["$templateCache",function(e){e.put("app/content-viewer/page.html",''),e.put("app/main/main.html",'
'),e.put("app/profile/profile.html",''),e.put("app/profile-info/profile-info.html",'{{vm.profile.name}}
Profile Wall
'),e.put("app/components/auth/login.html",''),e.put("app/components/boxes/boxes.html",'{{vm.boxesOrder}} {{boxesOrder}}'),e.put("app/components/navbar/navbar.html",''),e.put("app/components/noosfero-activities/activities.html",''),e.put("app/components/noosfero-boxes/box.html",''),e.put("app/components/noosfero-boxes/boxes.html",''),e.put("app/components/noosfero/profile-image/profile-image.html",'
'),e.put("app/components/noosfero-activities/activity/activity.html",'
'),e.put("app/components/noosfero-activities/activity/add_member_in_community.html",'
'),e.put("app/components/noosfero-activities/activity/create_article.html",'
'),e.put("app/components/noosfero-activities/activity/new_friendship.html",'
'),e.put("app/components/noosfero-articles/article/article.html",''),e.put("app/components/noosfero-articles/blog/blog.html",''),e.put("app/components/noosfero-blocks/link-list/link-list.html",''),e.put("app/components/noosfero-blocks/main-block/main-block.html",''),e.put("app/components/noosfero-blocks/members-block/members-block.html",''),e.put("app/components/noosfero-blocks/profile-image/profile-image.html",''),e.put("app/components/noosfero-blocks/recent-documents/recent-documents.html",'')}]);
//# sourceMappingURL=../maps/scripts/app-d4cfe650cd.js.map