;
(function () {
	'use strict';
	const app_cache = require('app-cache')
	, EventEmitter = require('myevents');

	angular.module('skydriver.app', ['app.filter', 'app.factory', 'app.router', 'app.widgets', 'app.controllers'])
		.run(runBlock);

	runBlock.$inject = ['$rootScope', '$urlRouter', '$timeout', '$log', '$location', '$state'];
	function runBlock($rootScope, $urlRouter, $timeout, $log, $location, $state) {
		$rootScope.$on('$stateChangeStart', function (event, toState, toParams, fromState, fromParams) {
			if (!app_cache.cur_user) {
				EventEmitter.emit('logout');
			}; 
		});
	}
	angular.module("app.factory", []);
	angular.module("app.config", []);
	angular.module("app.filter", []);
	angular.module("app.router", ['ui.router','app.factory']);

	angular.module('app.services', ['app.config']);
	angular.module('app.widgets', ['app.services', 'app.filter','ngMaterial']);
	angular.module('app.controllers', ['app.widgets','app.factory']);

	
})();