!function(e){if("object"==typeof module&&"object"==typeof module.exports){var t=e(require,exports);void 0!==t&&(module.exports=t)}else"function"==typeof define&&define.amd&&define("pitApp",["require","exports","angularAnimate","angular"],e)}(function(e,t){function r(t,r,o){var i=!1,a=this,u={stack:{},ready:{bootstrap:!1},on:function(e,t){this.ready[e]?t():(this.stack[e]||(this.stack[e]=[]),this.stack[e].push(t))},trigger:function(e){if(this.stack[e])for(var t in this.stack[e]){var r=this.stack[e][t];try{r()}catch(e){}}this.ready[e]||(this.ready[e]=!0)}};this.eventBind=function(e,t){u.on(e,t)},this.eventTrigger=function(e){u.trigger(e)};var c={};this.data=function(e,t){return t?("delete"==t?delete c[e]:c[e]=t,a):!!c[e]&&c[e]};var s={},f={};this.registerScope=function(e,t,r){if(s[e]={scope:t,args:r||[]},f[e])for(var o in f[e])f[e][o]&&n.isFunction(f[e][o])&&(f[e][o].apply(s[e].scope,s[e].args),f[e][o].prototype.once&&delete f[e][o])},this.whenScope=function(e,t,r){f[e]||(f[e]=[]),r&&(t.prototype.once=!0),f[e].indexOf(t)<0&&f[e].push(t)},this.forScope=function(e,t){if(s[e])try{s[e].scope.$applyAsync(function(){t.apply(s[e].scope,s[e].args)})}catch(t){console.log("$scope "+e+" not available, action ignored."),console.log(t)}else console.log("$scope "+e+" not available, action ignored.")},this.offScope=function(e,t){t?f[e]&&f[e].indexOf(t)>-1&&f[e].splice(f[e].indexOf(t),1):f[e]&&delete f[e]},this.scopeApply=function(e,t){t||(t=function(){}),e.$applyAsync(function(){t.call(e)})},this.moduleLoad=null,this.pageInjector=null,this.register=null,this.bootstrap=null,this.angular=n.module(t,r.concat(["ngAnimate"])),this.angular.run(["$rootScope","$templateCache","$q","$http","$injector",function(t,r,o,i,u){a.moduleLoad=function(t,o){o=o||{};var i={js:o.js||"js/modules/"+t,html:void 0!==o.html?o.html:"views/modules/"+t,css:void 0!==o.css?o.css:"css/modules/"+t,success:o.success||n.noop,failed:o.failed||n.noop,skiptemplatecache:o.skiptemplatecache||!1},a={css:!1,html:!1,js:!1,ctrl:null},u=t+".mode",c=function(e){n.extend(a,e),a.js&&a.css&&a.html&&(i.html?s(i.skiptemplatecache?u:r.get(u)?u:null,a.ctrl,i.skiptemplatecache?e.htmltpl:null):s(a.ctrl))},s=i.success||n.noop,f=i.failed||n.noop,l=function(){var t=i.html;t.indexOf(".html")!==t.length-".html".length&&(t+=".html");var n=requirejs.s.contexts._.config;(n.map["*"]&&n.map["*"][i.html]||n.paths[i.html])&&!e.specified("text!"+t)&&(t=i.html),e(["text!"+t],function(e){i.skiptemplatecache||r.put(u,e),c({html:!0,htmltpl:i.skiptemplatecache?e:null})},function(e){c({html:!0}),console.error(e)})};e([i.js],function(e){c({js:!0,ctrl:e||null}),r.get(u)&&!i.skiptemplatecache||!i.html?c({html:!0}):l()},function(e){console.error(e),f(e.xhr)}),i.css?e(["css!"+i.css],function(e){c({css:!0})},function(e){c({css:!0})}):c({css:!0})},a.pageInjector=u}]).config(["$controllerProvider","$compileProvider","$filterProvider","$animateProvider","$provide",function(e,t,r,n,o){a.register={controller:function(t,r){var n=r;return e.register(t,n),a},directive:function(e,r){return t.directive(e,r),a},filter:function(e,t){return r.register(e,t),a},factory:function(e,t){return o.factory(e,t),a},service:function(e,t){return o.service(e,t),a},constant:function(e,t){return o.constant(e,t),a},value:function(e,t){return o.value(e,t),a},animation:function(e,t){return n.register(e,t),a},provider:function(e,t){return o.provider(e,t),a}}}]).config(["$animateProvider",function(e){e.classNameFilter(/ng-animate-enabled/)}]),a.bootstrap=function(){i||(n.bootstrap(document,[t]),u.trigger("bootstrap"),i=!0)},o||i||a.bootstrap()}var n=e("angular");return r}),function(e){if("object"==typeof module&&"object"==typeof module.exports){var t=e(require,exports);void 0!==t&&(module.exports=t)}else"function"==typeof define&&define.amd&&define("polyfills",["require","exports"],e)}(function(e,t){function r(e){return g(e)?e[e.length-1]:null}function n(e){if(!q(e)&&!g(e))return e;var t=!g(e),r=t?{}:[],o=0,i=0;if(t){var a=G(e);for(o=0,i=a.length;o<i;o++){var u=a[o];r[u]=n(e[u])}}else for(o=0,i=e.length;o<i;o++)r[o]=n(e[o]);return r}function o(e,t,r,n,o){t=!isNaN(t=Math.abs(t))&&t>0?Math.pow(10,t):1,r=void 0!==r?r:"$",n=n||",",o=o||".";var i=e<0?"-":"",a=parseInt(e=Math.round(Math.abs(+e||0)*t)/t,10)+"",u=(u=a.length)>3?u%3:0,c=r+i+(u?a.substr(0,u)+n:"")+a.substr(u).replace(/(\d{3})(?=\d)/g,"$1"+n);return t>1&&Math.round(Math.abs(e-a)>0)&&(c+=o+(Math.round(Math.abs(e-a)*t)/t).toString().substring(2)),c}function i(e,t){void 0===e&&(e="");var r,n=function(e,t){return e=parseInt(e,10).toString(16),t<e.length?e.slice(e.length-t):t>e.length?Array(t-e.length+1).join("0")+e:e};return this.php_js||(this.php_js={}),this.php_js.uniqidSeed||(this.php_js.uniqidSeed=Math.floor(123456789*Math.random())),this.php_js.uniqidSeed++,r=e,r+=n(parseInt((new Date).getTime()/1e3,10),8),r+=n(this.php_js.uniqidSeed,5),t&&(r+=(10*Math.random()).toFixed(8).toString()),r}function a(e,t){try{return e()}catch(e){return C(t)?t(e):void 0}}function u(e){return void 0===e||null===e||void 0===e}function c(e){return!!u(e)||(g(e)?O(e):A(e)?E(e):Q(e)?0==e:q(e)?G(e).length<=0:!e)}function s(e,t){var r=!1;return m(t,function(t){if(e===t)return r=!0,!1}),r}function f(e,t){var r,n,o,i=e,a=t,u=i,c=a,s=/(\.0)+[^\.]*$/;for(u=(u+"").replace(s,"").split("."),c=(c+"").replace(s,"").split("."),o=Math.min(u.length,c.length),r=0;r<o;r++)if(0!==(n=parseInt(u[r],10)-parseInt(c[r],10)))return n;return u.length-c.length}function l(e){var t=e+"=";if(document.cookie)for(var r=document.cookie.split(";"),n=0;n<r.length;n++){for(var o=r[n];" "==o.charAt(0);)o=o.substring(1);if(0==o.indexOf(t))return unescape(o.substring(t.length,o.length))}}function p(e,t,r){var n;if(0===r)n='expires=""';else{r||(r=0);var o=new Date;o.setTime(o.getTime()+24*r*60*60*1e3),n="expires="+o.toUTCString()}document.cookie=e+"="+t+"; "+n+"; path=/; secure"}function h(){return!1!==navigator.cookieEnabled&&(document.cookie="testcookie=1",-1!=document.cookie.indexOf("testcookie"))}var g=function(e){return Array.isArray?Array.isArray(e):e&&"[object Array]"===Object.prototype.toString.call(e)},m=function(e,t,r,n){if(!g(e))throw new TypeError("forEach called on a non-array type value. The given value is "+typeof e);var o;if(r||(r=e),n)for(var i=e.length,a=i-1;a>=0&&("boolean"!=typeof(o=t.call(r,e[a],a,e))||o);a--);else for(var a=0,i=e.length;a<i&&("boolean"!=typeof(o=t.call(r,e[a],a,e))||o);a++);},d=function(e,t){if(Array.prototype.filter)return Array.prototype.filter.call(e,t);for(var r=[],n=0,o=e.length;n<o;n++)t(e[n])&&r.push(e[n]);return r},v=function(e,t){if(Array.prototype.map)return Array.prototype.map.call(e,t);for(var r=[],n=0,o=e.length;n<o;n++)r.push(t(e[n]));return r},y=function(e,t,r){if(!g(e))throw new TypeError("Array.some called on a non-array type value. The given value is "+typeof e);if(!C(t))throw new TypeError("Iterator of Array.some is not a function. The given value is "+typeof t);if(r||(r=e),Array.prototype.some)return Array.prototype.some.call(e,t,r);for(var n=Object(e),o=n.length>>>0,i=0;i<o;i++)if(i in n&&t.call(r,n[i],i,n))return!0;return!1},b=function(e,t,r){if(!g(e))throw new TypeError("Array.groupBy called on a non-array type. The given value is "+typeof e);var n=e.reduce(function(e,n){var o=n[t];return e[o]=e[o]||[],e[o].push(n),r&&r(n,e[o]),e},{}),o=[];return L(n,function(e){o.push(e)}),o},w=function(e,t){if(!g(e))throw new TypeError("Array.findIndex called on a non-array type. The given value is "+typeof e);if(Array.prototype.findIndex)return Array.prototype.findIndex.call(e,t);for(var r,n=0,o=e.length;n<o&&("boolean"!=typeof(r=t(e,e[n],n,e))||!r);n++);},x=function(e,t){if(!g(e))throw new TypeError("Array.pushUnique called on a non-array type. The given value is "+typeof e);e.indexOf(t)<0&&e.push(t)},O=function(e){return g(e)?e.length<1:null},T=function(e){return!!g(e)&&!O(e)},k=function(e){return String.prototype.trimLeft?String.prototype.trimLeft.call(e):e.replace(/^\s+/,"")},j=function(e){return String.prototype.trimRight?String.prototype.trimRight.call(e):e.replace(/\s+$/,"")},S=function(e){return String.prototype.trim?String.prototype.trim.call(e):e.replace(/^\s+|\s+$/gm,"")},I=function(e,t){var r=Array.prototype.slice.call(arguments);return r.shift().replace(/\{(\d+)\}/g,function(e,t){return void 0!==r[t]&&null!==r[t]?r[t]:e})},M=function(e,t,r){return A(e)&&!E(e)?e+(t?" ":""):r||""},A=function(e){return"string"==typeof e},E=function(e){return!A(e)||""==e.replace(/\s/g,"")},N=function(e){if(A(e))return e.replace(/\w\S*/g,function(e){return e.charAt(0).toUpperCase()+e.substr(1).toLowerCase()})},_=function(e,t,r){if(A(e))return"b"!="ab".substr(-1)?String.prototype.substr.call(e,t<0?e.length+t:t,r):String.prototype.substr.call(e,t,r);throw new TypeError("String.substr called on a non-string. The given value is "+typeof e)},D=function(e,t,r){if(!A(e))throw new TypeError("String.includes called on a non-string");return String.prototype.includes?String.prototype.includes.call(e,t,r):("number"!=typeof r&&(r=0),!(r+t.length>e.length)&&-1!==e.indexOf(t,r))},$=function(e,t){if(!A(e))throw new TypeError("Contains called on a non-string. The given value is "+typeof e);if(!g(t))return!1;var r=!1;return m(t,function(t){return!A(t)||(D(e,t)?(r=!0,!1):void 0)}),r},F=function(e){if(!A(e))throw new TypeError("String.splitCamel called on a non-string. The given value is "+typeof e);return e.replace(/([A-Z])/g," $1").replace(/^./,function(e){return e.toUpperCase()})},J=function(e){if(!A(e))throw new TypeError("String.digits called on a non-string. The given value is "+typeof e);return S(e).replace(/[^0-9]/g,"")},C=function(e){return"function"==typeof e},q=function(e){return null!==e&&"object"==typeof e&&!g(e)},U=function(e,t){var r=JSON.parse(JSON.stringify(e));if(!q(e)||!q(t))throw new TypeError("First or second argument is not an plain object");return m(G(t),function(n){q(t[n])?r[n]=U(e[n]||{},t[n]):r[n]=t[n]}),r},P=function(e){return n(e)},K=function(e,t){if(void 0===e||null===e)throw new TypeError("Cannot convert first argument to object");if("function"==typeof Object.assign)return Object.assign.apply(this,arguments);for(var r=Object(e),n=1;n<arguments.length;n++){var o=arguments[n];if(void 0!==o&&null!==o)for(var i=Object.keys(Object(o)),a=0,u=i.length;a<u;a++){var c=i[a],s=Object.getOwnPropertyDescriptor(o,c);void 0!==s&&s.enumerable&&(r[c]=o[c])}}return r},G=function(){var e=Object.prototype.hasOwnProperty,t=!{toString:null}.propertyIsEnumerable("toString"),r=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],n=r.length;return function(o){if("function"==typeof Object.keys)return Object.keys(o);if("object"!=typeof o&&"function"!=typeof o||null===o)throw new TypeError("Object.keys called on non-object. The given value is "+typeof o);var i=[];for(var a in o)e.call(o,a)&&i.push(a);if(t)for(var u=0;u<n;u++)e.call(o,r[u])&&i.push(r[u]);return i}}(),L=function(e,t,r){var n,o=r||e;if(!q(e))throw new TypeError("Object.forEach called on non-object. The given value is "+typeof e);if(!C(t))throw new TypeError("The given iterator is not a function");for(var i in e)if(e.hasOwnProperty(i)&&"boolean"==typeof(n=t.apply(o,[e[i],i]))&&!n)break},Y=function(){return"function"!=typeof Object.create?function(e){var t=function(){};return function(e,r){if(e!==Object(e)&&null!==e)throw TypeError("Argument must be an object, or null");t.prototype=e||{};var n=new t;return t.prototype=null,void 0!==r&&Object.defineProperties(n,r),null===e&&(n.__proto__=null),n}}():Object.create}(),R=function(e,t,r){var n=!1;if(!q(e))throw new TypeError("Object.hasKeys called on non-object. The given value is "+typeof e);return m(t,function(t){if(!(t in e))return n=!1,!1;n=!r||!!e[t]}),n},z=function(e,t,r){var n=!1;if(!q(e))throw new TypeError("Object.hasKeys called on non-object. The given value is "+typeof e);return m(t,function(t){if(t in e&&(n=!r||!!e[t]),n)return!1}),n},B=function(){var e={current:new Date,months:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],fromToday:function(t,r,n,o){if(o=o||5,!Q(t)&&(t.indexOf("-")>-1&&(t=t.replace(/-/g,"/")),t.indexOf("/")<0))return"";var i=new Date(e.calcTimeOffset(t,-1*e.current.getTimezoneOffset()/60)),a=e.current.getTime()-i.getTime();a/=1e3;Math.floor(a%60);a/=60;var u=Math.max(1,Math.floor(a%60));a/=60;var c=Math.floor(a%24),s=Math.floor(a/24),f=n?" ":", ";return s>o?e[r?"monthsShort":"months"][i.getMonth()]+" "+i.getDate()+f+(n?"":i.getFullYear()):s>=1?s+" day"+(s>1?"s":"")+" ago":c>=1?c+" hr"+(c>1?"s":"")+". ago":u+" min. ago"},calcTimeOffset:function(e,t){var r=Q(e)?new Date(e):new Date,n=r.getTime()+6e4*r.getTimezoneOffset();return new Date(n+36e5*t).getTime()},getDifference:function(t,r,n,o){var i=t.getTimezoneOffset(),a=t.getTime(),u=e.calcTimeOffset(r.getTime(),-1*i/60),c=Math.round(Math.abs(a-u)/36e5),s=Math.round((a-u)/864e5);n||(n="days");var f="days"==n?s:c;return o&&(f=f.toString()+("days"==n?" day":" hr")+(1!==f?"s":"")),f},getElapsedSeconds:function(e,t){var r=e-t;return r/=1e3,Math.round(r%60*100)/100+" sec."},toText:function(t,r,n,o,i,a){var u;if(Q(t)||A(t)){if(!Q(t)&&t){if(t.indexOf("-")>-1&&(t=t.replace(/-/g,"/")),t.indexOf("/")<0)return""}else if(!t)return"";u=new Date(t)}else{if(!t)return"";u=t}var c=o?" ":", ",s=i?u.getUTCMonth():u.getMonth(),f=i?u.getUTCDate():u.getDate(),l=i?u.getUTCFullYear():u.getFullYear();return a&&(f=f.toString()+function(e){if(e>3&&e<21)return"th";switch(e%10){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}}(f)),e[r?"monthsShort":"months"][s]+(n?" ":" "+f+c)+(o?"":l)},today:function(){return e.toText(e.current.getTime(),!0)},getAge:function(e,t,r){var n=new Date,o=n.getFullYear(),i=n.getMonth(),a=n.getDate(),u=o-r;return i<e-1&&u--,e-1==i&&a<t&&u--,u},toUTC:function(e){return e.setUTCFullYear(e.getFullYear(),e.getMonth(),e.getDate()),e.setUTCHours(e.getHours()),e.setUTCMinutes(e.getMinutes()),e}};return e}(),H=function(){var e;return{counter:{start:function(){e=(new Date).getTime()},end:function(t){if(!e)return null;var r=(new Date).getTime()-e;return e=!1,t?(r/=1e3,Math.round(r%60*100)/100+"sec."):r+"ms."}}}}(),Q=function(e,t){return"number"==typeof e&&(t?isNaN(e)||isFinite(e):isFinite(e))},Z=function(e){if(A(e)){var t=e.trim(),r=t.replace(/[^0-9.]/g,"");return 0==t.indexOf("-")&&(r="-"+r),parseFloat(r)}return Q(e)?e:null},V=function(e,t){var r=!1;e<0&&(r=!0),e=Math.abs(e);var n=t;return n=!isNaN(n=Math.abs(n))&&n>0?Math.pow(10,n):1,e>=1e9?(formattedNumber=(Math.round(e/1e9*n)/n).toString().replace(/\.0$/,"")+"G",r&&(formattedNumber="-"+formattedNumber)):e>=1e6?(formattedNumber=(Math.round(e/1e6*n)/n).toString().replace(/\.0$/,"")+"M",r&&(formattedNumber="-"+formattedNumber)):e>=1e3?(formattedNumber=(Math.round(e/1e3*n)/n).toString().replace(/\.0$/,"")+"K",r&&(formattedNumber="-"+formattedNumber)):formattedNumber=o(e,t,""),formattedNumber},W=function(e){return(e?J(e.toString()):"").replace(/(\d{3})(\d{3})(\d{4})/,"($1) $2-$3")},X=function(e,t,r){if(!Q(e))throw new TypeError("Number.between called on non-number. The given value is "+typeof e);return r?e>=t[0]&&e<=t[1]:e>t[0]&&e<t[1]},ee=function(e){return e*(180/Math.PI)},te=function(e,t,r,n){var o=Math.abs(n-t),i=Math.abs(r-e),a=Math.sqrt(o*o+i*i),u=o/a;return Math.degrees(Math.asin(u))},re=function(e,t){return Math.floor(Math.random()*(t-e+1))+e},ne=function(e,t,r){if(g(e))m(e,t,r);else{if(!q(e))throw new TypeError("forEach can only be used on arrays or plain objects. The object given is "+typeof value);L(e,t,r)}},oe=function(){if("undefined"!=typeof window){if(window.requestAnimationFrame)return function(e,t){return window.requestAnimationFrame.apply(window,[e,t])};var e=0,t=function(t,r){var n=(new Date).getTime(),o=Math.max(0,16-(n-e)),i=window.setTimeout(function(){t(n+o)},o);return e=n+o,i}}else t=function(e){e()};return t}(),ie=function(){return"undefined"!=typeof window&&window.cancelAnimationFrame?window.cancelAnimationFrame:clearTimeout}();return{Array:{isArray:g,forEach:m,filter:d,findIndex:w,map:v,some:y,isEmpty:O,isPopulated:T,pushUnique:x,groupBy:b,last:r},Number:{isNumber:Q,toNumber:Z,formatMoney:o,formatNumber:V,phoneFormat:W,between:X},String:{isString:A,isEmpty:E,trimLeft:k,trimRight:j,trim:S,format:I,capitalize:N,substr:_,includes:D,containsAny:$,splitCamel:F,digits:J,resolve:M},Math:{degrees:ee,getAngle:te,getRandomInt:re},Object:{assign:K,merge:U,isFunction:C,isObject:q,keys:G,forEach:L,copy:P,hasKeys:R,hasAnyKey:z,create:Y,fromUrlParam:function(e){return JSON.parse('{"'+e.replace(/&/g,'","').replace(/=/g,'":"')+'"}',function(e,t){return""===e?t:decodeURIComponent(t)})}},Date:B,Time:H,uniqid:i,tryCatch:a,isNullorUndefined:u,isEmpty:c,isAnyOf:s,forEach:ne,requestAnimationFrame:oe,cancelAnimationFrame:ie,versionCompare:f,Cookie:{get:l,set:p,check:h}}}),function(e){if("object"==typeof module&&"object"==typeof module.exports){var t=e(require,exports);void 0!==t&&(module.exports=t)}else"function"==typeof define&&define.amd&&define("pitLS",["require","exports"],e)}(function(e,t){function r(){var e={setItem:function(e,t,r){var n=new Date;n.setTime(n.getTime()+(r||2592e6));var o="expires="+n.toUTCString();document.cookie=e+"="+t+"; "+o+"; path=/; secure"},removeItem:function(e){document.cookie=e+"=;expires=Thu, 01 Jan 1970 00:00:01 GMT;"},getItem:function(e){for(var t=e+"=",r=document.cookie.split(";"),n=0;n<r.length;n++){for(var o=r[n];" "==o.charAt(0);)o=o.substring(1);if(0==o.indexOf(t))return o.substring(t.length,o.length)}}};f.set=function(t,r,n){t=a+t,e.setItem(t,r,n),this.trigger("valuechange",t,r,n)},f.get=function(t){return t=a+t,e.getItem(t)},f.expireKey=function(t,r){var n=e.getItem("_expirations.json")||!1;try{n=JSON.parse(n),n||(n={})}catch(e){n={}}n[a+t]={in:r,since:(new Date).getTime()};e.setItem("_expirations.json",JSON.stringify(n));var o=a+t,i=e.getItem(o);void 0!==i&&null!==i&&e.setItem(o,i,r)},f.getExpiration=function(t){var r=e.getItem("_expirations.json")||!1;if(!r)return!1;try{if(!(r=JSON.parse(r)))return!1}catch(e){return!1}if(!r)return!1;var n=r[a+t]||!1;return n||!1},f.remove=function(t){t=a+t,e.removeItem(t),this.trigger("valuedelete",t)},f.removeGroup=function(t){var r=s();for(var n in r)0==(""+r[n]).indexOf(t+"_")&&e.removeItem(n)},f.isExpired=function(){console.warn("not available for cookies")},f.renameGroup=function(){console.warn("not available for cookies")},f.isGroup=function(){console.warn("not available for cookies")},f.ascookies=!0}var n,o,i=[".json",".string",".number",".function",".boolean"],a="",u=function(e,t){for(var r in t)t[r]&&t[r].constructor&&t[r].constructor===Object?(e[r]=e[r]||{},arguments.callee(e[r],t[r])):e[r]=t[r];return e},c=function(){var e=!!navigator.cookieEnabled;return void 0!==navigator.cookieEnabled||e||(document.cookie="testcookie",e=-1!=document.cookie.indexOf("testcookie")),!!e},s=function(){for(var e=document.cookie.split(";"),t="",r=1;r<=e.length;r++)t+=r+" "+e[r-1]+"\n";return t},f={useSession:function(e){n=e?window.sessionStorage:window.localStorage},ascookies:!1,useMemory:function(e){e&&!o?(o=n,n={_data:{},setItem:function(e,t){return this._data[e]=String(t)},getItem:function(e){return e in this._data?this._data[e]:void 0},removeItem:function(e){return delete this._data[e]},clear:function(){return this._data={}}}):(n=o,o=!1)},events:[],on:function(e,t,r){this.events[e]||(this.events[e]=[]),r?this.events[e][r+"-key"]=t:this.events[e].push(t)},off:function(e,t){t?this.events[e][t+"-key"]&&delete this.events[e][t+"-key"]:delete this.events[e]},trigger:function(e){if(this.events[e]){var t=arguments;for(var r in this.events[e]){var n=this.events[e][r].apply(this,t);if(this.events[e][r].prototype.once&&delete this.events[e][r],void 0!==n&&!1===n)break}}},one:function(e,t){this.on(e,t),this.events[e][this.events[e].length-1].prototype.once=!0},set:function(e,t,o){var u=e,c=t,s="";if("expirations"==e)return!1;switch(e=a+e,typeof t){case"object":t=JSON.stringify(t),s=i[0];break;case"function":t=t.toString(),s=i[3];break;case"number":t=t.toString(),s=i[2];break;case"boolean":t=t.toString(),s=i[4];break;default:s=i[1]}for(var l=0;l<i.length;l++)if(n.getItem(e+i[l])){n.removeItem(e+i[l]);break}try{n.setItem(e+s,t)}catch(e){e&&e.message&&"QuotaExceededError"==e.message?r():f.useMemory(!0)}o&&f.expireKey(u,o),this.trigger("valuechange",u,c,o)},get:function(e){var t,r=e;e=a+e;for(var o=0;o<i.length;o++)if(n.getItem(e+i[o])){if(f.isExpired(r))return void n.removeItem(e+i[o]);switch(i[o]){case i[0]:t=JSON.parse(n.getItem(e+i[o]));break;case i[1]:t=n.getItem(e+i[o]);break;case i[2]:t=parseFloat(n.getItem(e+i[o]));break;case i[3]:t=new Function(n.getItem(e+i[o]));break;case i[4]:t=JSON.parse(n.getItem(e+i[o]))}break}return"undefined"==t||void 0==t?void 0:"true"==t||"false"!=t&&t},remove:function(e){var t=e;e=a+e;for(var r=0;r<i.length;r++)n.getItem(e+i[r])&&n.removeItem(e+i[r]);this.trigger("valuedelete",t)},group:function(e){if(void 0==e)return a;!1===e&&(a=""),a=e+"_",this.trigger("groupchange",a)},isGroup:function(e){var t=n;for(var r in t)if(0===r.indexOf(e))return!0;return!1},renameGroup:function(e,t,r){r=r||{};var o=e+"_"||a,i={async:r.async||!1,callback:r.callback||!1},c=Object.keys?Object.keys(n):[],s=u({},n);if(a=t+"_",i.async&&Object.keys)return function(){if(ix>=c.length)return i.callback?i.callback():null;var e=c[ix];0===e.indexOf(o)&&(n.setItem(a+e.substring(o.length),s[e]),delete n[e]),ix++}();for(var f in s)0===f.indexOf(o)&&(n.setItem(a+f.substring(o.length),s[f]),delete n[f]);this.trigger("groupchange",a)},removeGroup:function(e,t){e=e?e+"_":a,t=t||{};var r={async:t.async||!1,callback:t.callback||!1,exclude:t.exclude||!1},o=n,i=Object.keys?Object.keys(n):[],u=0;if(asyncDelete=function(){if(u>=i.length)return r.callback?r.callback():null;var t=i[u],o=!1;if(0===t.indexOf(e)){if(r.exclude)for(var a in r.exclude){var c=e+r.exclude[a];if(0===t.indexOf(c+".")){o=!0;break}}o||n.removeItem(t)}u++,setTimeout(asyncDelete)},r.async&&Object.keys)return asyncDelete();for(var c in o){var s=!1;if(0===c.indexOf(e)){if(r.exclude)for(var f in r.exclude){var l=e+r.exclude[f];if(0===c.indexOf(l+".")){s=!0;break}}s||n.removeItem(c)}}},expireKey:function(e,t){var r=n.getItem("_expirations.json")||!1;try{r=JSON.parse(r),r||(r={})}catch(e){r={}}r[a+e]={in:t,since:(new Date).getTime()};n.setItem("_expirations.json",JSON.stringify(r))},isExpired:function(e){var t=n.getItem("_expirations.json")||!1;if(!t)return!1;try{if(!(t=JSON.parse(t)))return!1}catch(e){return!1}var r=t[a+e]||!1;return!!r&&(new Date).getTime()-r.since>=r.in},getExpiration:function(e){var t=n.getItem("_expirations.json")||!1;if(!t)return!1;try{if(!(t=JSON.parse(t)))return!1}catch(e){return!1}if(!t)return!1;var r=t[a+e]||!1;return r||!1}};return function(){var e;try{n=window.localStorage,n.setItem("test","test"),n.removeItem("test")}catch(t){e=!0}if(e&&(c()?r():f.useMemory(!0),f.getKey=f.get,f.setKey=f.set,f.removeKey=f.remove,!e)){var t=n.getItem("_expirations.json")||!1;if(t)try{var o=JSON.parse(t);t=JSON.parse(t);var a=new Date;for(var u in t){var s=t[u]||!1;if(!s)break;if(a.getTime()-s.since>=s.in)for(var l=0;l<i.length;l++)n.getItem(u+i[l])&&(n.removeItem(u+i[l]),delete o[u])}n.setItem("_expirations.json",JSON.stringify(o))}catch(e){}}}(),f});