// infect.js v0.4.6 (2014-09-24) //
!function(a,b){"use strict";"function"==typeof define&&define.amd?define(b):"object"==typeof exports?module.exports=b():a.infect=b()}(this,function(){"use strict";function a(a){return/ (.*)]/.exec(Object.prototype.toString.call(a))[1]}function b(b){var c,d=[].slice.call(arguments,1),e="";for(c=0;c<d.length;c++)e+=e.length>0?", "+a(d[c]):a(d[c]);throw i+"Invalid call to infect."+b+"("+e+")"}function c(c,d){return"String"===a(c)&&"Undefined"!==a(d)&&d instanceof Object?(c=0===c.indexOf(h)?c.substr(h.length):c,g[c]=d,d):void b("set",c,d)}function d(c){return"String"===a(c)?(c=0===c.indexOf(h)?c.substr(h.length):c,g[c]||void 0):void b("get",c)}function e(c,e){var f,g;if("Object"===a(c)&&e instanceof Array){for(g=e.length;g--;)f=e[g],f=0===f.indexOf(h)?f.substr(h.length):f,c[h+f]=d(f);return c}b("obj",c,e)}function f(c,e){var f,g,j,k,l,m;if("Array"===a(c)&&(m=c,c=m.pop(),c.$infect=m),"Function"===a(c)){for(e=e||{},j=/\(([^)]+)/.exec(c.toString()),j=null!==j?j[1]:"",j&&(j=j.split(/\s*,\s*/)),f=k=j.length;f--;){if(g=j[f],0!==g.indexOf(h)){j=j.slice(f+1);break}j[f]=d(g)||g}return l=function(){j=l.$infect&&l.$infect.length>0&&!j.length?l.$infect:j;var b=[].slice.call(arguments),g=b.length+j.length,h=e;for(this instanceof l&&(h=this);k>g;g++)b.push(void 0);for(f=j.length;f--;)"String"===a(j[f])&&(j[f]=d(j[f]));if(g>k)throw i+"Too many parameters! I expected "+(k-j.length)+" (or less) but got "+b.length;return b=b.concat(j),c.apply(h,b)},l.prototype=c.prototype,l.prototype.constructor=l,l.$infect=c.$infect,l}b("func",c,e)}var g={},h="$",i=" == infect.js => ";return{set:c,get:d,obj:e,func:f,funk:f}});