(function(){var a=angular.module("LocalStorageModule",[]);a.value("prefix","ls"),a.constant("cookie",{expiry:30,path:"/"}),a.constant("notify",{setItem:!0,removeItem:!1}),a.service("localStorageService",["$rootScope","prefix","cookie","notify",function(a,b,c,d){"."!==b.substr(-1)&&(b=b?b+".":"");var e=function(){try{return"localStorage"in window&&null!==window.localStorage}catch(b){return a.$broadcast("LocalStorageModule.notification.error",b.message),!1}},f=function(c,f){if(!e())return a.$broadcast("LocalStorageModule.notification.warning","LOCAL_STORAGE_NOT_SUPPORTED"),d.setItem&&a.$broadcast("LocalStorageModule.notification.setitem",{key:c,newvalue:f,storageType:"cookie"}),l(c,f);"undefined"==typeof f&&(f=null);try{(angular.isObject(f)||angular.isArray(f))&&(f=angular.toJson(f)),localStorage.setItem(b+c,f),d.setItem&&a.$broadcast("LocalStorageModule.notification.setitem",{key:c,newvalue:f,storageType:"localStorage"})}catch(g){return a.$broadcast("LocalStorageModule.notification.error",g.message),l(c,f)}return!0},g=function(c){if(!e())return a.$broadcast("LocalStorageModule.notification.warning","LOCAL_STORAGE_NOT_SUPPORTED"),m(c);var d=localStorage.getItem(b+c);return d&&"null"!==d?"{"===d.charAt(0)||"["===d.charAt(0)?angular.fromJson(d):d:null},h=function(c){if(!e())return a.$broadcast("LocalStorageModule.notification.warning","LOCAL_STORAGE_NOT_SUPPORTED"),d.removeItem&&a.$broadcast("LocalStorageModule.notification.removeitem",{key:c,storageType:"cookie"}),n(c);try{localStorage.removeItem(b+c),d.removeItem&&a.$broadcast("LocalStorageModule.notification.removeitem",{key:c,storageType:"localStorage"})}catch(f){return a.$broadcast("LocalStorageModule.notification.error",f.message),n(c)}return!0},i=function(){if(!e())return a.$broadcast("LocalStorageModule.notification.warning","LOCAL_STORAGE_NOT_SUPPORTED"),!1;var c=b.length,d=[];for(var f in localStorage)if(f.substr(0,c)===b)try{d.push(f.substr(c))}catch(g){return a.$broadcast("LocalStorageModule.notification.error",g.Description),[]}return d},j=function(){if(!e())return a.$broadcast("LocalStorageModule.notification.warning","LOCAL_STORAGE_NOT_SUPPORTED"),o();var c=b.length;for(var d in localStorage)if(d.substr(0,c)===b)try{h(d.substr(c))}catch(f){return a.$broadcast("LocalStorageModule.notification.error",f.message),o()}return!0},k=function(){try{return navigator.cookieEnabled||"cookie"in document&&(document.cookie.length>0||(document.cookie="test").indexOf.call(document.cookie,"test")>-1)}catch(b){return a.$broadcast("LocalStorageModule.notification.error",b.message),!1}},l=function(d,e){if("undefined"==typeof e)return!1;if(!k())return a.$broadcast("LocalStorageModule.notification.error","COOKIES_NOT_SUPPORTED"),!1;try{var f="",g=new Date;null===e?(g.setTime(g.getTime()+-864e5),f="; expires="+g.toGMTString(),e=""):0!==c.expiry&&(g.setTime(g.getTime()+24*c.expiry*60*60*1e3),f="; expires="+g.toGMTString()),d&&(document.cookie=b+d+"="+encodeURIComponent(e)+f+"; path="+c.path)}catch(h){return a.$broadcast("LocalStorageModule.notification.error",h.message),!1}return!0},m=function(c){if(!k())return a.$broadcast("LocalStorageModule.notification.error","COOKIES_NOT_SUPPORTED"),!1;for(var d=document.cookie.split(";"),e=0;e