if(!("js"in this))this.js={};js.util=js.util||{};js.util.arrayContainsAll=function(a,b){for(var c=0,d=0;d<b.length;d++){for(var f=0;f<a.length;f++)if(a[f]===b[d]){c++;break}if(c<d)return false}return c===b.length};js.util.objectMergeAll=function(a,b){for(var c,d,f=b.length-1;f>=0;f--){c=b[f];for(d in c)if(c.hasOwnProperty(d))a[d]=c[d]}};js.log=function(a){js.log.appendLog(a);js.settings.debug&&js.log._logger(a)};js.log._logItems=[];
js.log.appendLog=function(a){a={timestamp:Number(new Date),message:String(a)};js.log._logItems.push(a)};js.log._logger=function(a,b){if(a&&"log"in a)return function(c){a.log(c)};else if(b&&b.constructor===Function)return b;return function(){}}(this.console,this.print);js.lang=js.lang||{};js.lang.GlobalContext=function(){return this}();
js.settings={debug:js.lang.GlobalContext.JS_DEBUG||false,globalClass:js.lang.GlobalContext.JS_GLOBAL_CLASS||false,globalInterface:js.lang.GlobalContext.JS_GLOBAL_INTERFACE||false,globalNamespace:js.lang.GlobalContext.JS_GLOBAL_NAMESPACE||false};try{delete js.lang.GlobalContext.JS_DEBUG;delete js.lang.GlobalContext.JS_GLOBAL_CLASS;delete js.lang.GlobalContext.JS_GLOBAL_INTERFACE;delete js.lang.GlobalContext.JS_GLOBAL_NAMESPACE}catch(e){}
Function.prototype.Static=function(a){js.util.objectMergeAll(this,[a]);return this};Function.prototype.Implements=function(){this.__implements__=(this.prototype&&this.prototype.constructor&&this.prototype.constructor.__implements__||[]).slice();Array.prototype.push.apply(this.__implements__,arguments);return this};Function.prototype.enforces=function(){return js.util.arrayContainsAll(this.__implements__,arguments)};
js.lang.Class=function(){var a=js.lang.Class.generateClass(js.lang.Class.classInvokedWithGlobal);js.lang.Class.extend(a,Array.apply([],arguments));return a};js.lang.Class.STATIC_INIT_INVOKED_WITH_GLOBAL="Static method __init__ requires a context. nie: Parent.__init__.call( this );";js.lang.Class.CLASS_INSTANTIATED_WITHOUT_BODY="Class requires a class body. ie:\nA = new Class()  ({\n\t__init__ : function()  {}\n});";js.lang.Class._extending=false;
js.lang.Class.generateClass=function(a){var b=function(){return js.lang.Class.__constructor__.call(this,b,a,arguments)};b.__init__=function(){return js.lang.Class.__init__.call(this,b,arguments)};return b};
js.lang.Class.__constructor__=function(a,b,c){if(this===js.lang.GlobalContext)return b.call(this,a,c);if(!a.__initialized__)throw new ReferenceError(js.lang.Class.CLASS_INSTANTIATED_WITHOUT_BODY);this.constructor=a;if(!(js.lang.Class._extending||!a.prototype.hasOwnProperty("__init__")))return js.lang.Class.invokeIfExists(this,this.__init__,c)};
js.lang.Class.__init__=function(a,b){if(this instanceof Function)throw new TypeError(js.lang.Class.STATIC_INIT_INVOKED_WITH_GLOBAL);return js.lang.Class.invokeIfExists(this,a.prototype.__init__,b)};js.lang.Class.extend=function(a,b){var c=b[0]||Object;js.lang.Class._extending=true;try{a.prototype=new c}finally{js.lang.Class._extending=false}b.length>1&&js.lang.Class.mergePrototypes(a,b);a.prototype.constructor=c;c===Object&&delete a.prototype.constructor.prototype};
js.lang.Class.extendObjects=function(a,b){a.prototype=b[0]||{};b.length>1&&js.util.objectMergeAll(a.prototype,b)};js.lang.Class.invokeIfExists=function(a,b,c){if(b&&b.constructor===Function)return b.apply(a,c||[])};js.lang.Class.mergePrototypes=function(a,b){for(var c=0;c<b.length;c++)b[c]=b[c].prototype;js.util.objectMergeAll(a.prototype,b)};
js.lang.Class.classInvokedWithGlobal=function(a,b){js.util.objectMergeAll(a.prototype,b);"__implements__"in a&&js.lang.Interface.bindStubs(a,a.__implements__);a.__initialized__=true;return a};js.lang.Interface=function(){var a=js.lang.Class.generateClass(js.lang.Interface.interfaceInvokedWithGlobal);js.lang.Class.extendObjects(a,Array.apply([],arguments));return a};js.lang.Interface.METHOD_NOT_IMPLEMENTED="Method '{name}' not implemented; desired signature: {name}({parameters}).";
js.lang.Interface.bindStubs=function(a,b){a=a.prototype;for(var c=0,d,f;c<b.length;c++){f=b[c]._stubs;for(d in f)if(f.hasOwnProperty(d)&&!(d in a)){js.log(f[d].__message);a[d]=f[d]}}};js.lang.Interface.generateStubs=function(a){for(var b in a)if(a.hasOwnProperty(b))a[b]=js.lang.Interface.generateStub(b,a[b]);return a};js.lang.Interface.generateStub=function(a,b){var c=function(){throw new ReferenceError(c.__message);};c.__message=js.lang.Interface.generateStubMessage(a,b);c.__parameters=b;return c};
js.lang.Interface.generateStubMessage=function(a,b){return js.lang.Interface.METHOD_NOT_IMPLEMENTED.replace(/\{name\}/g,a).replace(/\{parameters\}/g,(b||[]).join(", "))};js.lang.Interface.interfaceInvokedWithGlobal=function(a,b){a.__initialized__=true;a=new a;var c={};js.util.objectMergeAll(c,[js.lang.Interface.generateStubs(b[0]),a._stubs]);a._stubs=c;return a};if(js.settings.globalClass)Class=js.lang.Class;if(js.settings.globalInterface)Interface=js.lang.Interface;
