!function(e){"use strict";e.module("cas-auth-api",[])}(window.angular),function(e,t){"use strict";e.provider("casAuthApi",function(){function e(e,t,n){var i,a=t.toString();return(angular.isNumber(n)||!isFinite(n)||Math.floor(n)!==n||n>a.length)&&(n=a.length),n-=e.length,i=a.indexOf(e,n),-1!==i&&i===n}function n(e,t,n){return n=n||0,t.indexOf(e,n)===n}function i(e){return void 0!==e&&a.endpoints.hasOwnProperty(e)?a.authenticationApiBaseUrl+"/"+a.endpoints[e]:a.authenticationApiBaseUrl}var a,r,c={endpoints:{service:"service",token:"token/new"},ticketUrl:"",maxAttempts:3,requireAccessToken:!1,cacheAccessToken:!1,cacheExpiresMinutes:25,managedApis:[],casBaseUrl:"https://thekey.me/cas",casLoginPath:"/login",casTicketPath:"/api/oauth/ticket",oAuth:!1,authenticationApiBaseUrl:"https://auth-api.cru.org/v1"},s=["redirectUrl","clientId"];this.configure=function(t){if(a)throw new Error("Already configured.");if(!(t instanceof Object))throw new TypeError("Invalid argument: `config` must be an `Object`.");return a=angular.extend({},c,t),a.oAuth===!0&&angular.forEach(s,function(e){if(!a[e])throw new Error("Missing parameter: "+e+".")}),e("/",a.casBaseUrl)&&(a.casBaseUrl=a.casBaseUrl.slice(0,-1)),e("/",a.authenticationApiBaseUrl)&&(a.authenticationApiBaseUrl=a.authenticationApiBaseUrl.slice(0,-1)),n("/",a.casLoginPath)===!1&&(a.casLoginPath="/"+a.casLoginPath),n("/",a.casLoginPath)===!1&&(a.casTicketPath="/"+a.casTicketPath),a},this.setAuthenticationApiBaseUrl=function(t){return a.authenticationApiBaseUrl=e("/",t)?t.slice(0,-1):t,this},this.setTicketUrl=function(e){return a.ticketUrl=e,this},r=this.addManagedApi=function(e){var t=angular.isString(e)?[e]:e;return angular.forEach(t,function(e){-1===this.indexOf(e)&&this.push(e)},a.managedApis),this},this.setRequireAccessToken=function(e){return a.requireAccessToken=!!e,this},this.setCacheAccessToken=function(e){return a.cacheAccessToken=angular.isUndefined(t)?!1:!!e,this},this.setErrorCallback=function(e){return a.errorCallback=angular.isFunction(e)?e:void 0,this},this.$get=["$injector","$q","$rootScope",function(e,c,s){function o(e){var t;for(t=0;t